Merge pull request #3406 from alexanderkyte/mobile_static_default
authorMarek Safar <marek.safar@gmail.com>
Mon, 21 Nov 2016 08:54:08 +0000 (09:54 +0100)
committerGitHub <noreply@github.com>
Mon, 21 Nov 2016 08:54:08 +0000 (09:54 +0100)
[runtime] Default mobile_static AOT type to FullAOT

2531 files changed:
.gitmodules
Makefile.am
README.md
acceptance-tests/Makefile.am
acceptance-tests/SUBMODULES.json
acceptance-tests/ms-test-suite.mk
acceptance-tests/profiler-stress.mk [new file with mode: 0644]
acceptance-tests/profiler-stress/runner.cs [new file with mode: 0644]
acceptance-tests/profiler-stress/runner.exe.sources [new file with mode: 0644]
acceptance-tests/versions.mk
appveyor.yml [deleted file]
configure.ac
data/config.in
data/net_1_1/machine.config
data/net_2_0/machine.config
data/net_4_0/machine.config
data/net_4_5/machine.config
docs/sources/mono-api-gc.html
eglib/configure.ac
eglib/src/Makefile.am
eglib/src/gfile-unix.c
eglib/src/gfile-win32.c
eglib/src/glib.h
eglib/src/gmisc-win32-uwp.c [new file with mode: 0644]
eglib/src/gmisc-win32.c
eglib/src/gmodule-win32-internals.h [new file with mode: 0644]
eglib/src/gmodule-win32-uwp.c [new file with mode: 0644]
eglib/src/gmodule-win32.c
eglib/src/goutput.c
eglib/src/gunicode-win32-uwp.c [new file with mode: 0644]
eglib/src/gunicode-win32.c [new file with mode: 0644]
eglib/src/gunicode.c
eglib/test/driver.c
eglib/winconfig.h
external/binary-reference-assemblies
external/bockbuild [new submodule]
external/boringssl [new submodule]
external/cecil
external/corefx [new submodule]
external/ikvm
external/linker [new submodule]
external/nunit-lite
libgc/include/gc.h
man/Makefile.am
man/caspol.1
man/cccheck.1
man/ccrewrite.1
man/cert-sync.1 [new file with mode: 0644]
man/certmgr.1
man/crlupdate.1
man/csharp.1
man/disco.1
man/mcs.1
man/mkbundle.1
man/mono.1
man/mprof-report.1
mcs/build/Makefile
mcs/build/common/AssemblyRef.cs
mcs/build/common/Consts.cs.in
mcs/build/common/basic-profile-check.cs
mcs/build/config-default.make
mcs/build/executable.make
mcs/build/library.make
mcs/build/nunit-summary.xsl [deleted file]
mcs/build/platforms/win32.make
mcs/build/profiles/basic.make
mcs/build/profiles/mobile_static.make
mcs/build/profiles/monotouch_runtime.make
mcs/build/profiles/monotouch_watch.make
mcs/build/profiles/monotouch_watch_runtime.make
mcs/build/profiles/xammac.make
mcs/build/profiles/xammac_net_4_5.make
mcs/build/rules.make
mcs/build/tests.make
mcs/class/Accessibility/Accessibility-net_4_x.csproj
mcs/class/Commons.Xml.Relaxng/Commons.Xml.Relaxng-net_4_x.csproj
mcs/class/Cscompmgd/Cscompmgd-net_4_x.csproj
mcs/class/CustomMarshalers/CustomMarshalers-net_4_x.csproj
mcs/class/Facades/Microsoft.Win32.Primitives/AssemblyInfo.cs
mcs/class/Facades/Microsoft.Win32.Primitives/Facades_Microsoft.Win32.Primitives-net_4_x.csproj
mcs/class/Facades/Microsoft.Win32.Registry.AccessControl/AssemblyInfo.cs
mcs/class/Facades/Microsoft.Win32.Registry.AccessControl/Facades_Microsoft.Win32.Registry.AccessControl-net_4_x.csproj
mcs/class/Facades/Microsoft.Win32.Registry.AccessControl/RegistryAclExtensions.cs
mcs/class/Facades/Microsoft.Win32.Registry/AssemblyInfo.cs
mcs/class/Facades/Microsoft.Win32.Registry/Facades_Microsoft.Win32.Registry-net_4_x.csproj
mcs/class/Facades/System.AppContext/AssemblyInfo.cs
mcs/class/Facades/System.AppContext/Facades_System.AppContext-net_4_x.csproj
mcs/class/Facades/System.Collections.Concurrent/AssemblyInfo.cs
mcs/class/Facades/System.Collections.Concurrent/Facades_System.Collections.Concurrent-net_4_x.csproj
mcs/class/Facades/System.Collections.NonGeneric/AssemblyInfo.cs
mcs/class/Facades/System.Collections.NonGeneric/Facades_System.Collections.NonGeneric-net_4_x.csproj
mcs/class/Facades/System.Collections.Specialized/AssemblyInfo.cs
mcs/class/Facades/System.Collections.Specialized/Facades_System.Collections.Specialized-net_4_x.csproj
mcs/class/Facades/System.Collections/AssemblyInfo.cs
mcs/class/Facades/System.Collections/Facades_System.Collections-net_4_x.csproj
mcs/class/Facades/System.ComponentModel.Annotations/AssemblyInfo.cs
mcs/class/Facades/System.ComponentModel.Annotations/Facades_System.ComponentModel.Annotations-net_4_x.csproj
mcs/class/Facades/System.ComponentModel.EventBasedAsync/AssemblyInfo.cs
mcs/class/Facades/System.ComponentModel.EventBasedAsync/Facades_System.ComponentModel.EventBasedAsync-net_4_x.csproj
mcs/class/Facades/System.ComponentModel.Primitives/AssemblyInfo.cs
mcs/class/Facades/System.ComponentModel.Primitives/Facades_System.ComponentModel.Primitives-net_4_x.csproj
mcs/class/Facades/System.ComponentModel.TypeConverter/AssemblyInfo.cs
mcs/class/Facades/System.ComponentModel.TypeConverter/Facades_System.ComponentModel.TypeConverter-net_4_x.csproj
mcs/class/Facades/System.ComponentModel/AssemblyInfo.cs
mcs/class/Facades/System.ComponentModel/Facades_System.ComponentModel-net_4_x.csproj
mcs/class/Facades/System.Console/AssemblyInfo.cs
mcs/class/Facades/System.Console/Facades_System.Console-net_4_x.csproj
mcs/class/Facades/System.Data.Common/AssemblyInfo.cs
mcs/class/Facades/System.Data.Common/Facades_System.Data.Common-net_4_x.csproj
mcs/class/Facades/System.Data.SqlClient/AssemblyInfo.cs
mcs/class/Facades/System.Data.SqlClient/Facades_System.Data.SqlClient-net_4_x.csproj
mcs/class/Facades/System.Diagnostics.Contracts/AssemblyInfo.cs
mcs/class/Facades/System.Diagnostics.Contracts/Facades_System.Diagnostics.Contracts-net_4_x.csproj
mcs/class/Facades/System.Diagnostics.Debug/AssemblyInfo.cs
mcs/class/Facades/System.Diagnostics.Debug/Facades_System.Diagnostics.Debug-net_4_x.csproj
mcs/class/Facades/System.Diagnostics.FileVersionInfo/AssemblyInfo.cs
mcs/class/Facades/System.Diagnostics.FileVersionInfo/Facades_System.Diagnostics.FileVersionInfo-net_4_x.csproj
mcs/class/Facades/System.Diagnostics.Process/AssemblyInfo.cs
mcs/class/Facades/System.Diagnostics.Process/Facades_System.Diagnostics.Process-net_4_x.csproj
mcs/class/Facades/System.Diagnostics.StackTrace/AssemblyInfo.cs
mcs/class/Facades/System.Diagnostics.StackTrace/Facades_System.Diagnostics.StackTrace-net_4_x.csproj
mcs/class/Facades/System.Diagnostics.StackTrace/StackFrameExtensions.cs
mcs/class/Facades/System.Diagnostics.TextWriterTraceListener/AssemblyInfo.cs
mcs/class/Facades/System.Diagnostics.TextWriterTraceListener/Facades_System.Diagnostics.TextWriterTraceListener-net_4_x.csproj
mcs/class/Facades/System.Diagnostics.Tools/AssemblyInfo.cs
mcs/class/Facades/System.Diagnostics.Tools/Facades_System.Diagnostics.Tools-net_4_x.csproj
mcs/class/Facades/System.Diagnostics.TraceEvent/AssemblyInfo.cs
mcs/class/Facades/System.Diagnostics.TraceEvent/Facades_System.Diagnostics.TraceEvent-net_4_x.csproj
mcs/class/Facades/System.Diagnostics.TraceSource/AssemblyInfo.cs
mcs/class/Facades/System.Diagnostics.TraceSource/Facades_System.Diagnostics.TraceSource-net_4_x.csproj
mcs/class/Facades/System.Diagnostics.Tracing/AssemblyInfo.cs
mcs/class/Facades/System.Diagnostics.Tracing/EventCounter.cs [deleted file]
mcs/class/Facades/System.Diagnostics.Tracing/Facades_System.Diagnostics.Tracing-net_4_x.csproj
mcs/class/Facades/System.Diagnostics.Tracing/System.Diagnostics.Tracing.dll.sources
mcs/class/Facades/System.Diagnostics.Tracing/TypeForwarders.cs
mcs/class/Facades/System.Drawing.Primitives/AssemblyInfo.cs
mcs/class/Facades/System.Drawing.Primitives/Facades_System.Drawing.Primitives-net_4_x.csproj [new file with mode: 0644]
mcs/class/Facades/System.Dynamic.Runtime/AssemblyInfo.cs
mcs/class/Facades/System.Dynamic.Runtime/Facades_System.Dynamic.Runtime-net_4_x.csproj
mcs/class/Facades/System.Globalization.Calendars/AssemblyInfo.cs
mcs/class/Facades/System.Globalization.Calendars/Facades_System.Globalization.Calendars-net_4_x.csproj
mcs/class/Facades/System.Globalization.Extensions/AssemblyInfo.cs
mcs/class/Facades/System.Globalization.Extensions/Facades_System.Globalization.Extensions-net_4_x.csproj
mcs/class/Facades/System.Globalization.Extensions/StringNormalizationExtensions.cs
mcs/class/Facades/System.Globalization/AssemblyInfo.cs
mcs/class/Facades/System.Globalization/Facades_System.Globalization-net_4_x.csproj
mcs/class/Facades/System.IO.Compression.ZipFile/AssemblyInfo.cs
mcs/class/Facades/System.IO.Compression.ZipFile/Facades_System.IO.Compression.ZipFile-net_4_x.csproj
mcs/class/Facades/System.IO.FileSystem.AccessControl/AssemblyInfo.cs
mcs/class/Facades/System.IO.FileSystem.AccessControl/Facades_System.IO.FileSystem.AccessControl-net_4_x.csproj
mcs/class/Facades/System.IO.FileSystem.AccessControl/FileSystemAclExtensions.cs
mcs/class/Facades/System.IO.FileSystem.DriveInfo/AssemblyInfo.cs
mcs/class/Facades/System.IO.FileSystem.DriveInfo/Facades_System.IO.FileSystem.DriveInfo-net_4_x.csproj
mcs/class/Facades/System.IO.FileSystem.Primitives/AssemblyInfo.cs
mcs/class/Facades/System.IO.FileSystem.Primitives/Facades_System.IO.FileSystem.Primitives-net_4_x.csproj
mcs/class/Facades/System.IO.FileSystem.Watcher/AssemblyInfo.cs
mcs/class/Facades/System.IO.FileSystem.Watcher/Facades_System.IO.FileSystem.Watcher-net_4_x.csproj
mcs/class/Facades/System.IO.FileSystem/AssemblyInfo.cs
mcs/class/Facades/System.IO.FileSystem/Facades_System.IO.FileSystem-net_4_x.csproj
mcs/class/Facades/System.IO.IsolatedStorage/AssemblyInfo.cs
mcs/class/Facades/System.IO.IsolatedStorage/Facades_System.IO.IsolatedStorage-net_4_x.csproj
mcs/class/Facades/System.IO.MemoryMappedFiles/AssemblyInfo.cs
mcs/class/Facades/System.IO.MemoryMappedFiles/Facades_System.IO.MemoryMappedFiles-net_4_x.csproj
mcs/class/Facades/System.IO.Packaging/AssemblyInfo.cs
mcs/class/Facades/System.IO.Pipes/AssemblyInfo.cs
mcs/class/Facades/System.IO.Pipes/Facades_System.IO.Pipes-net_4_x.csproj
mcs/class/Facades/System.IO.UnmanagedMemoryStream/AssemblyInfo.cs
mcs/class/Facades/System.IO.UnmanagedMemoryStream/Facades_System.IO.UnmanagedMemoryStream-net_4_x.csproj
mcs/class/Facades/System.IO/AssemblyInfo.cs
mcs/class/Facades/System.IO/Facades_System.IO-net_4_x.csproj
mcs/class/Facades/System.Linq.Expressions/AssemblyInfo.cs
mcs/class/Facades/System.Linq.Expressions/Facades_System.Linq.Expressions-net_4_x.csproj
mcs/class/Facades/System.Linq.Parallel/AssemblyInfo.cs
mcs/class/Facades/System.Linq.Parallel/Facades_System.Linq.Parallel-net_4_x.csproj
mcs/class/Facades/System.Linq.Queryable/AssemblyInfo.cs
mcs/class/Facades/System.Linq.Queryable/Facades_System.Linq.Queryable-net_4_x.csproj
mcs/class/Facades/System.Linq/AssemblyInfo.cs
mcs/class/Facades/System.Linq/Facades_System.Linq-net_4_x.csproj
mcs/class/Facades/System.Net.AuthenticationManager/AssemblyInfo.cs
mcs/class/Facades/System.Net.AuthenticationManager/Facades_System.Net.AuthenticationManager-net_4_x.csproj
mcs/class/Facades/System.Net.Cache/AssemblyInfo.cs
mcs/class/Facades/System.Net.Cache/Facades_System.Net.Cache-net_4_x.csproj
mcs/class/Facades/System.Net.HttpListener/AssemblyInfo.cs
mcs/class/Facades/System.Net.HttpListener/Facades_System.Net.HttpListener-net_4_x.csproj
mcs/class/Facades/System.Net.Mail/AssemblyInfo.cs
mcs/class/Facades/System.Net.Mail/Facades_System.Net.Mail-net_4_x.csproj
mcs/class/Facades/System.Net.Mail/TypeForwarders.cs
mcs/class/Facades/System.Net.NameResolution/AssemblyInfo.cs
mcs/class/Facades/System.Net.NameResolution/Facades_System.Net.NameResolution-net_4_x.csproj
mcs/class/Facades/System.Net.NetworkInformation/AssemblyInfo.cs
mcs/class/Facades/System.Net.NetworkInformation/Facades_System.Net.NetworkInformation-net_4_x.csproj
mcs/class/Facades/System.Net.Ping/AssemblyInfo.cs
mcs/class/Facades/System.Net.Primitives/AssemblyInfo.cs
mcs/class/Facades/System.Net.Primitives/Facades_System.Net.Primitives-net_4_x.csproj
mcs/class/Facades/System.Net.Requests/AssemblyInfo.cs
mcs/class/Facades/System.Net.Requests/Facades_System.Net.Requests-net_4_x.csproj
mcs/class/Facades/System.Net.Security/AssemblyInfo.cs
mcs/class/Facades/System.Net.Security/Facades_System.Net.Security-net_4_x.csproj
mcs/class/Facades/System.Net.ServicePoint/AssemblyInfo.cs
mcs/class/Facades/System.Net.ServicePoint/Facades_System.Net.ServicePoint-net_4_x.csproj
mcs/class/Facades/System.Net.Sockets/AssemblyInfo.cs
mcs/class/Facades/System.Net.Sockets/Facades_System.Net.Sockets-net_4_x.csproj
mcs/class/Facades/System.Net.Sockets/SocketReceiveFromResult.cs [deleted file]
mcs/class/Facades/System.Net.Sockets/SocketReceiveMessageFromResult.cs [deleted file]
mcs/class/Facades/System.Net.Sockets/SocketTaskExtensions.cs [deleted file]
mcs/class/Facades/System.Net.Sockets/System.Net.Sockets.dll.sources
mcs/class/Facades/System.Net.Sockets/TypeForwarders.cs
mcs/class/Facades/System.Net.Utilities/AssemblyInfo.cs
mcs/class/Facades/System.Net.Utilities/Facades_System.Net.Utilities-net_4_x.csproj
mcs/class/Facades/System.Net.WebHeaderCollection/AssemblyInfo.cs
mcs/class/Facades/System.Net.WebHeaderCollection/Facades_System.Net.WebHeaderCollection-net_4_x.csproj
mcs/class/Facades/System.Net.WebSockets.Client/AssemblyInfo.cs
mcs/class/Facades/System.Net.WebSockets.Client/Facades_System.Net.WebSockets.Client-net_4_x.csproj
mcs/class/Facades/System.Net.WebSockets/AssemblyInfo.cs
mcs/class/Facades/System.Net.WebSockets/Facades_System.Net.WebSockets-net_4_x.csproj
mcs/class/Facades/System.ObjectModel/AssemblyInfo.cs
mcs/class/Facades/System.ObjectModel/Facades_System.ObjectModel-net_4_x.csproj
mcs/class/Facades/System.Private.CoreLib.InteropServices/AssemblyInfo.cs [deleted file]
mcs/class/Facades/System.Private.CoreLib.InteropServices/Facades_System.Private.CoreLib.InteropServices-net_4_x.csproj [deleted file]
mcs/class/Facades/System.Private.CoreLib.InteropServices/Makefile [deleted file]
mcs/class/Facades/System.Private.CoreLib.InteropServices/System.Private.CoreLib.InteropServices-net_4_x.csproj [deleted file]
mcs/class/Facades/System.Private.CoreLib.InteropServices/System.Private.CoreLib.InteropServices.dll.sources [deleted file]
mcs/class/Facades/System.Private.CoreLib.InteropServices/TypeForwarders.cs [deleted file]
mcs/class/Facades/System.Reflection.Emit.ILGeneration/AssemblyInfo.cs
mcs/class/Facades/System.Reflection.Emit.ILGeneration/Facades_System.Reflection.Emit.ILGeneration-net_4_x.csproj
mcs/class/Facades/System.Reflection.Emit.Lightweight/AssemblyInfo.cs
mcs/class/Facades/System.Reflection.Emit.Lightweight/DynamicMethod.cs [new file with mode: 0644]
mcs/class/Facades/System.Reflection.Emit.Lightweight/Facades_System.Reflection.Emit.Lightweight-net_4_x.csproj
mcs/class/Facades/System.Reflection.Emit.Lightweight/System.Reflection.Emit.Lightweight.dll.sources
mcs/class/Facades/System.Reflection.Emit.Lightweight/TypeForwarders.cs
mcs/class/Facades/System.Reflection.Emit/AssemblyInfo.cs
mcs/class/Facades/System.Reflection.Emit/Facades_System.Reflection.Emit-net_4_x.csproj
mcs/class/Facades/System.Reflection.Extensions/AssemblyInfo.cs
mcs/class/Facades/System.Reflection.Extensions/Facades_System.Reflection.Extensions-net_4_x.csproj
mcs/class/Facades/System.Reflection.Primitives/AssemblyInfo.cs
mcs/class/Facades/System.Reflection.Primitives/Facades_System.Reflection.Primitives-net_4_x.csproj
mcs/class/Facades/System.Reflection.TypeExtensions/AssemblyInfo.cs
mcs/class/Facades/System.Reflection.TypeExtensions/Facades_System.Reflection.TypeExtensions-net_4_x.csproj
mcs/class/Facades/System.Reflection.TypeExtensions/TypeExtensions.CoreCLR.cs
mcs/class/Facades/System.Reflection/AssemblyInfo.cs
mcs/class/Facades/System.Reflection/Facades_System.Reflection-net_4_x.csproj
mcs/class/Facades/System.Resources.ReaderWriter/AssemblyInfo.cs
mcs/class/Facades/System.Resources.ReaderWriter/Facades_System.Resources.ReaderWriter-net_4_x.csproj
mcs/class/Facades/System.Resources.ResourceManager/AssemblyInfo.cs
mcs/class/Facades/System.Resources.ResourceManager/Facades_System.Resources.ResourceManager-net_4_x.csproj
mcs/class/Facades/System.Runtime.CompilerServices.VisualC/AssemblyInfo.cs
mcs/class/Facades/System.Runtime.CompilerServices.VisualC/Facades_System.Runtime.CompilerServices.VisualC-net_4_x.csproj
mcs/class/Facades/System.Runtime.Extensions/AssemblyInfo.cs
mcs/class/Facades/System.Runtime.Extensions/Facades_System.Runtime.Extensions-net_4_x.csproj
mcs/class/Facades/System.Runtime.Handles/AssemblyInfo.cs
mcs/class/Facades/System.Runtime.Handles/Facades_System.Runtime.Handles-net_4_x.csproj
mcs/class/Facades/System.Runtime.InteropServices.WindowsRuntime/AssemblyInfo.cs
mcs/class/Facades/System.Runtime.InteropServices.WindowsRuntime/Facades_System.Runtime.InteropServices.WindowsRuntime-net_4_x.csproj
mcs/class/Facades/System.Runtime.InteropServices/AssemblyInfo.cs
mcs/class/Facades/System.Runtime.InteropServices/Facades_System.Runtime.InteropServices-net_4_x.csproj
mcs/class/Facades/System.Runtime.InteropServices/TypeForwarders.cs
mcs/class/Facades/System.Runtime.Numerics/AssemblyInfo.cs
mcs/class/Facades/System.Runtime.Numerics/Facades_System.Runtime.Numerics-net_4_x.csproj
mcs/class/Facades/System.Runtime.Serialization.Formatters/AssemblyInfo.cs
mcs/class/Facades/System.Runtime.Serialization.Json/AssemblyInfo.cs
mcs/class/Facades/System.Runtime.Serialization.Json/Facades_System.Runtime.Serialization.Json-net_4_x.csproj
mcs/class/Facades/System.Runtime.Serialization.Primitives/AssemblyInfo.cs
mcs/class/Facades/System.Runtime.Serialization.Primitives/Facades_System.Runtime.Serialization.Primitives-net_4_x.csproj
mcs/class/Facades/System.Runtime.Serialization.Xml/AssemblyInfo.cs
mcs/class/Facades/System.Runtime.Serialization.Xml/Facades_System.Runtime.Serialization.Xml-net_4_x.csproj
mcs/class/Facades/System.Runtime/AssemblyInfo.cs
mcs/class/Facades/System.Runtime/Facades_System.Runtime-net_4_x.csproj
mcs/class/Facades/System.Security.AccessControl/AssemblyInfo.cs
mcs/class/Facades/System.Security.AccessControl/Facades_System.Security.AccessControl-net_4_x.csproj
mcs/class/Facades/System.Security.Claims/AssemblyInfo.cs
mcs/class/Facades/System.Security.Claims/Facades_System.Security.Claims-net_4_x.csproj
mcs/class/Facades/System.Security.Cryptography.Algorithms/AssemblyInfo.cs
mcs/class/Facades/System.Security.Cryptography.Cng/AssemblyInfo.cs
mcs/class/Facades/System.Security.Cryptography.Csp/AssemblyInfo.cs
mcs/class/Facades/System.Security.Cryptography.DeriveBytes/AssemblyInfo.cs
mcs/class/Facades/System.Security.Cryptography.DeriveBytes/Facades_System.Security.Cryptography.DeriveBytes-net_4_x.csproj
mcs/class/Facades/System.Security.Cryptography.Encoding/AssemblyInfo.cs
mcs/class/Facades/System.Security.Cryptography.Encoding/Facades_System.Security.Cryptography.Encoding-net_4_x.csproj
mcs/class/Facades/System.Security.Cryptography.Encryption.Aes/AssemblyInfo.cs
mcs/class/Facades/System.Security.Cryptography.Encryption.Aes/Facades_System.Security.Cryptography.Encryption.Aes-net_4_x.csproj
mcs/class/Facades/System.Security.Cryptography.Encryption.ECDiffieHellman/AssemblyInfo.cs
mcs/class/Facades/System.Security.Cryptography.Encryption.ECDiffieHellman/Facades_System.Security.Cryptography.Encryption.ECDiffieHellman-net_4_x.csproj
mcs/class/Facades/System.Security.Cryptography.Encryption.ECDsa/AssemblyInfo.cs
mcs/class/Facades/System.Security.Cryptography.Encryption.ECDsa/Facades_System.Security.Cryptography.Encryption.ECDsa-net_4_x.csproj
mcs/class/Facades/System.Security.Cryptography.Encryption/AssemblyInfo.cs
mcs/class/Facades/System.Security.Cryptography.Encryption/Facades_System.Security.Cryptography.Encryption-net_4_x.csproj
mcs/class/Facades/System.Security.Cryptography.Hashing.Algorithms/AssemblyInfo.cs
mcs/class/Facades/System.Security.Cryptography.Hashing.Algorithms/Facades_System.Security.Cryptography.Hashing.Algorithms-net_4_x.csproj
mcs/class/Facades/System.Security.Cryptography.Hashing/AssemblyInfo.cs
mcs/class/Facades/System.Security.Cryptography.Hashing/Facades_System.Security.Cryptography.Hashing-net_4_x.csproj
mcs/class/Facades/System.Security.Cryptography.OpenSsl/AssemblyInfo.cs
mcs/class/Facades/System.Security.Cryptography.Pkcs/AssemblyInfo.cs
mcs/class/Facades/System.Security.Cryptography.Primitives/AssemblyInfo.cs
mcs/class/Facades/System.Security.Cryptography.Primitives/Facades_System.Security.Cryptography.Primitives-net_4_x.csproj [new file with mode: 0644]
mcs/class/Facades/System.Security.Cryptography.ProtectedData/AssemblyInfo.cs
mcs/class/Facades/System.Security.Cryptography.ProtectedData/Facades_System.Security.Cryptography.ProtectedData-net_4_x.csproj
mcs/class/Facades/System.Security.Cryptography.RSA/AssemblyInfo.cs
mcs/class/Facades/System.Security.Cryptography.RSA/Facades_System.Security.Cryptography.RSA-net_4_x.csproj
mcs/class/Facades/System.Security.Cryptography.RandomNumberGenerator/AssemblyInfo.cs
mcs/class/Facades/System.Security.Cryptography.RandomNumberGenerator/Facades_System.Security.Cryptography.RandomNumberGenerator-net_4_x.csproj
mcs/class/Facades/System.Security.Cryptography.X509Certificates/AssemblyInfo.cs
mcs/class/Facades/System.Security.Cryptography.X509Certificates/Facades_System.Security.Cryptography.X509Certificates-net_4_x.csproj
mcs/class/Facades/System.Security.Principal.Windows/AssemblyInfo.cs
mcs/class/Facades/System.Security.Principal.Windows/Facades_System.Security.Principal.Windows-net_4_x.csproj
mcs/class/Facades/System.Security.Principal/AssemblyInfo.cs
mcs/class/Facades/System.Security.Principal/Facades_System.Security.Principal-net_4_x.csproj
mcs/class/Facades/System.Security.SecureString/AssemblyInfo.cs
mcs/class/Facades/System.Security.SecureString/Facades_System.Security.SecureString-net_4_x.csproj
mcs/class/Facades/System.Security.SecureString/SecureStringMarshal.cs
mcs/class/Facades/System.ServiceModel.Duplex/AssemblyInfo.cs
mcs/class/Facades/System.ServiceModel.Duplex/Facades_System.ServiceModel.Duplex-net_4_x.csproj
mcs/class/Facades/System.ServiceModel.Http/AssemblyInfo.cs
mcs/class/Facades/System.ServiceModel.Http/Facades_System.ServiceModel.Http-net_4_x.csproj
mcs/class/Facades/System.ServiceModel.NetTcp/AssemblyInfo.cs
mcs/class/Facades/System.ServiceModel.NetTcp/Facades_System.ServiceModel.NetTcp-net_4_x.csproj
mcs/class/Facades/System.ServiceModel.Primitives/AssemblyInfo.cs
mcs/class/Facades/System.ServiceModel.Primitives/Facades_System.ServiceModel.Primitives-net_4_x.csproj
mcs/class/Facades/System.ServiceModel.Security/AssemblyInfo.cs
mcs/class/Facades/System.ServiceModel.Security/Facades_System.ServiceModel.Security-net_4_x.csproj
mcs/class/Facades/System.ServiceProcess.ServiceController/AssemblyInfo.cs
mcs/class/Facades/System.ServiceProcess.ServiceController/Facades_System.ServiceProcess.ServiceController-net_4_x.csproj
mcs/class/Facades/System.ServiceProcess.ServiceController/ServiceController_mobile.cs
mcs/class/Facades/System.ServiceProcess.ServiceController/TimeoutException_mobile.cs
mcs/class/Facades/System.Text.Encoding.CodePages/AssemblyInfo.cs
mcs/class/Facades/System.Text.Encoding.CodePages/Facades_System.Text.Encoding.CodePages-net_4_x.csproj [new file with mode: 0644]
mcs/class/Facades/System.Text.Encoding.Extensions/AssemblyInfo.cs
mcs/class/Facades/System.Text.Encoding.Extensions/Facades_System.Text.Encoding.Extensions-net_4_x.csproj
mcs/class/Facades/System.Text.Encoding/AssemblyInfo.cs
mcs/class/Facades/System.Text.Encoding/Facades_System.Text.Encoding-net_4_x.csproj
mcs/class/Facades/System.Text.RegularExpressions/AssemblyInfo.cs
mcs/class/Facades/System.Text.RegularExpressions/Facades_System.Text.RegularExpressions-net_4_x.csproj
mcs/class/Facades/System.Threading.AccessControl/AssemblyInfo.cs
mcs/class/Facades/System.Threading.AccessControl/Facades_System.Threading.AccessControl-net_4_x.csproj
mcs/class/Facades/System.Threading.AccessControl/ThreadingAclExtensions.cs
mcs/class/Facades/System.Threading.Overlapped/AssemblyInfo.cs
mcs/class/Facades/System.Threading.Overlapped/Facades_System.Threading.Overlapped-net_4_x.csproj
mcs/class/Facades/System.Threading.Tasks.Parallel/AssemblyInfo.cs
mcs/class/Facades/System.Threading.Tasks.Parallel/Facades_System.Threading.Tasks.Parallel-net_4_x.csproj
mcs/class/Facades/System.Threading.Tasks/AssemblyInfo.cs
mcs/class/Facades/System.Threading.Tasks/Facades_System.Threading.Tasks-net_4_x.csproj
mcs/class/Facades/System.Threading.Thread/AssemblyInfo.cs
mcs/class/Facades/System.Threading.Thread/Facades_System.Threading.Thread-net_4_x.csproj
mcs/class/Facades/System.Threading.ThreadPool/AssemblyInfo.cs
mcs/class/Facades/System.Threading.ThreadPool/Facades_System.Threading.ThreadPool-net_4_x.csproj
mcs/class/Facades/System.Threading.Timer/AssemblyInfo.cs
mcs/class/Facades/System.Threading.Timer/Facades_System.Threading.Timer-net_4_x.csproj
mcs/class/Facades/System.Threading/AssemblyInfo.cs
mcs/class/Facades/System.Threading/Facades_System.Threading-net_4_x.csproj
mcs/class/Facades/System.Xml.ReaderWriter/AssemblyInfo.cs
mcs/class/Facades/System.Xml.ReaderWriter/Facades_System.Xml.ReaderWriter-net_4_x.csproj
mcs/class/Facades/System.Xml.XDocument/AssemblyInfo.cs
mcs/class/Facades/System.Xml.XDocument/Facades_System.Xml.XDocument-net_4_x.csproj
mcs/class/Facades/System.Xml.XPath.XDocument/AssemblyInfo.cs
mcs/class/Facades/System.Xml.XPath.XDocument/Facades_System.Xml.XPath.XDocument-net_4_x.csproj
mcs/class/Facades/System.Xml.XPath/AssemblyInfo.cs
mcs/class/Facades/System.Xml.XPath/Facades_System.Xml.XPath-net_4_x.csproj
mcs/class/Facades/System.Xml.XmlDocument/AssemblyInfo.cs
mcs/class/Facades/System.Xml.XmlDocument/Facades_System.Xml.XmlDocument-net_4_x.csproj
mcs/class/Facades/System.Xml.XmlSerializer/AssemblyInfo.cs
mcs/class/Facades/System.Xml.XmlSerializer/Facades_System.Xml.XmlSerializer-net_4_x.csproj
mcs/class/Facades/System.Xml.Xsl.Primitives/AssemblyInfo.cs
mcs/class/Facades/System.Xml.Xsl.Primitives/Facades_System.Xml.Xsl.Primitives-net_4_x.csproj
mcs/class/Facades/subdirs.make
mcs/class/I18N/CJK/I18N.CJK-net_4_x.csproj
mcs/class/I18N/Common/I18N-net_4_x.csproj
mcs/class/I18N/MidEast/I18N.MidEast-net_4_x.csproj
mcs/class/I18N/Other/I18N.Other-net_4_x.csproj
mcs/class/I18N/Rare/I18N.Rare-net_4_x.csproj
mcs/class/I18N/West/I18N.West-net_4_x.csproj
mcs/class/IBM.Data.DB2/IBM.Data.DB2-net_4_x.csproj
mcs/class/IBM.Data.DB2/IBM.Data.DB2/DB2DataReader.cs
mcs/class/ICSharpCode.SharpZipLib/ICSharpCode.SharpZipLib-net_4_x.csproj
mcs/class/Makefile
mcs/class/Microsoft.Build.Engine/.gitignore
mcs/class/Microsoft.Build.Engine/Makefile
mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BuildItem.cs
mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Project.cs
mcs/class/Microsoft.Build.Engine/Microsoft.Build.Engine-net_4_x.csproj
mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/PredefinedPropertyFunctionsTest.cs
mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/TargetTest.cs
mcs/class/Microsoft.Build.Engine/Test/various/Properties.cs
mcs/class/Microsoft.Build.Framework/.gitignore [new file with mode: 0644]
mcs/class/Microsoft.Build.Framework/Makefile
mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework-net_4_x.csproj
mcs/class/Microsoft.Build.Tasks/.gitignore
mcs/class/Microsoft.Build.Tasks/Makefile
mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks-net_4_x.csproj
mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/Vbc.cs
mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/AssignTargetPathTest.cs
mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/CopyTest.cs
mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/WriteLinesToFileTest.cs
mcs/class/Microsoft.Build.Tasks/Test/test-config-file-net-4.0 [deleted file]
mcs/class/Microsoft.Build.Utilities/.gitignore [new file with mode: 0644]
mcs/class/Microsoft.Build.Utilities/Makefile
mcs/class/Microsoft.Build.Utilities/Microsoft.Build.Utilities-net_4_x.csproj
mcs/class/Microsoft.Build/.gitignore
mcs/class/Microsoft.Build/Makefile
mcs/class/Microsoft.Build/Microsoft.Build-net_4_x.csproj
mcs/class/Microsoft.Build/Microsoft.Build.Internal/BuildNodeManager.cs
mcs/class/Microsoft.Build/Microsoft.Build_test.dll.sources
mcs/class/Microsoft.Build/Test/Microsoft.Build.Construction/ProjectRootElementTest.cs
mcs/class/Microsoft.Build/Test/Microsoft.Build.Evaluation/ProjectCollectionTest.cs
mcs/class/Microsoft.Build/Test/Microsoft.Build.Evaluation/ProjectItemTest.cs
mcs/class/Microsoft.Build/Test/Microsoft.Build.Evaluation/ToolsetTest.cs
mcs/class/Microsoft.Build/Test/Microsoft.Build.Execution/BuildSubmissionTest.cs
mcs/class/Microsoft.Build/Test/Microsoft.Build.Execution/ProjectTargetInstanceTest.cs
mcs/class/Microsoft.Build/Test/Microsoft.Build.Execution/ProjectTaskInstanceTest.cs
mcs/class/Microsoft.CSharp/Microsoft.CSharp-net_4_x.csproj
mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/DynamicContext.cs
mcs/class/Microsoft.VisualC/Microsoft.VisualC-net_4_x.csproj
mcs/class/Microsoft.Web.Infrastructure/Microsoft.Web.Infrastructure-net_4_x.csproj
mcs/class/Mono.Btls.Interface/Makefile [new file with mode: 0644]
mcs/class/Mono.Btls.Interface/Mono.Btls.Interface-net_4_x.csproj [new file with mode: 0644]
mcs/class/Mono.Btls.Interface/Mono.Btls.Interface.dll.sources [new file with mode: 0644]
mcs/class/Mono.Btls.Interface/Mono.Btls.Interface/BtlsObject.cs [new file with mode: 0644]
mcs/class/Mono.Btls.Interface/Mono.Btls.Interface/BtlsProvider.cs [new file with mode: 0644]
mcs/class/Mono.Btls.Interface/Mono.Btls.Interface/BtlsX509.cs [new file with mode: 0644]
mcs/class/Mono.Btls.Interface/Mono.Btls.Interface/BtlsX509Chain.cs [new file with mode: 0644]
mcs/class/Mono.Btls.Interface/Mono.Btls.Interface/BtlsX509Error.cs [new file with mode: 0644]
mcs/class/Mono.Btls.Interface/Mono.Btls.Interface/BtlsX509Format.cs [new file with mode: 0644]
mcs/class/Mono.Btls.Interface/Mono.Btls.Interface/BtlsX509Lookup.cs [new file with mode: 0644]
mcs/class/Mono.Btls.Interface/Mono.Btls.Interface/BtlsX509Name.cs [new file with mode: 0644]
mcs/class/Mono.Btls.Interface/Mono.Btls.Interface/BtlsX509Purpose.cs [new file with mode: 0644]
mcs/class/Mono.Btls.Interface/Mono.Btls.Interface/BtlsX509Store.cs [new file with mode: 0644]
mcs/class/Mono.Btls.Interface/Mono.Btls.Interface/BtlsX509StoreCtx.cs [new file with mode: 0644]
mcs/class/Mono.Btls.Interface/Mono.Btls.Interface/BtlsX509StoreManager.cs [new file with mode: 0644]
mcs/class/Mono.Btls.Interface/Mono.Btls.Interface/BtlsX509StoreType.cs [new file with mode: 0644]
mcs/class/Mono.Btls.Interface/Mono.Btls.Interface/BtlsX509TrustKind.cs [new file with mode: 0644]
mcs/class/Mono.Btls.Interface/Mono.Btls.Interface/BtlsX509VerifyFlags.cs [new file with mode: 0644]
mcs/class/Mono.Btls.Interface/Mono.Btls.Interface/BtlsX509VerifyParam.cs [new file with mode: 0644]
mcs/class/Mono.Btls.Interface/Mono.Btls.Interface/VersionInfo.cs [new file with mode: 0644]
mcs/class/Mono.Btls.Interface/Properties/AssemblyInfo.cs [new file with mode: 0644]
mcs/class/Mono.Btls.Interface/README.md [new file with mode: 0644]
mcs/class/Mono.C5/Mono.C5-net_4_x.csproj
mcs/class/Mono.CSharp/Mono.CSharp-net_4_x.csproj
mcs/class/Mono.CSharp/mobile_static_Mono.CSharp.dll.sources
mcs/class/Mono.CSharp/monotouch.cs
mcs/class/Mono.Cairo/Mono.Cairo-net_4_x.csproj
mcs/class/Mono.Cecil.Mdb/Mono.Cecil.Mdb-net_4_x.csproj
mcs/class/Mono.CodeContracts/Mono.CodeContracts-net_4_x.csproj
mcs/class/Mono.CodeContracts/Mono.CodeContracts_test.dll.sources
mcs/class/Mono.CompilerServices.SymbolWriter/Mono.CompilerServices.SymbolWriter-net_4_x.csproj
mcs/class/Mono.CompilerServices.SymbolWriter/MonoSymbolTable.cs
mcs/class/Mono.CompilerServices.SymbolWriter/SourceMethodBuilder.cs
mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite-net_4_x.csproj
mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/SQLite3.cs
mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/SQLiteBase.cs
mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/SQLiteConvert.cs
mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/UnsafeNativeMethods.cs
mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_test.dll.sources
mcs/class/Mono.Data.Sqlite/Test/Bug27864.cs
mcs/class/Mono.Data.Sqlite/Test/SqliteTests.cs [new file with mode: 0644]
mcs/class/Mono.Data.Tds/Mono.Data.Tds-net_4_x.csproj
mcs/class/Mono.Debugger.Soft/Makefile
mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft-net_4_x.csproj
mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft.dll.sources
mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/Connection.cs
mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/LocalScope.cs [new file with mode: 0644]
mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/MethodMirror.cs
mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/StackFrame.cs
mcs/class/Mono.Debugger.Soft/Test/TypeLoadClass.cs [new file with mode: 0644]
mcs/class/Mono.Debugger.Soft/Test/dtest-app.cs
mcs/class/Mono.Debugger.Soft/Test/dtest.cs
mcs/class/Mono.Http/Mono.Http-net_4_x.csproj
mcs/class/Mono.Management/Mono.Management-net_4_x.csproj
mcs/class/Mono.Messaging.RabbitMQ/Mono.Messaging.RabbitMQ-net_4_x.csproj
mcs/class/Mono.Messaging/Mono.Messaging-net_4_x.csproj
mcs/class/Mono.Options/Mono.Options-net_4_x.csproj
mcs/class/Mono.Parallel/Mono.Parallel-net_4_x.csproj
mcs/class/Mono.Parallel/Mono.Parallel_test.dll.sources
mcs/class/Mono.Posix/Mono.Posix-net_4_x.csproj
mcs/class/Mono.Posix/Mono.Posix_test.dll.sources
mcs/class/Mono.Posix/Mono.Unix.Native/Stdlib.cs
mcs/class/Mono.Posix/Mono.Unix.Native/Syscall.cs
mcs/class/Mono.Posix/Mono.Unix/StdioFileStream.cs
mcs/class/Mono.Posix/Test/Mono.Unix.Native/RealTimeSignumTests.cs
mcs/class/Mono.Posix/Test/Mono.Unix.Native/SocketTest.cs
mcs/class/Mono.Posix/Test/Mono.Unix.Native/StdlibTest.cs
mcs/class/Mono.Posix/Test/Mono.Unix/ReadlinkTest.cs
mcs/class/Mono.Posix/Test/Mono.Unix/StdioFileStreamTest.cs
mcs/class/Mono.Posix/Test/Mono.Unix/UnixEndPointTest.cs
mcs/class/Mono.Posix/Test/Mono.Unix/UnixGroupTest.cs
mcs/class/Mono.Posix/Test/Mono.Unix/UnixListenerTest.cs
mcs/class/Mono.Posix/Test/Mono.Unix/UnixMarshalTest.cs
mcs/class/Mono.Posix/Test/Mono.Unix/UnixPathTest.cs
mcs/class/Mono.Posix/Test/Mono.Unix/UnixSignalTest.cs
mcs/class/Mono.Posix/Test/Mono.Unix/UnixUserTest.cs
mcs/class/Mono.Reactive.Testing/Makefile
mcs/class/Mono.Security.Providers.DotNet/Makefile [deleted file]
mcs/class/Mono.Security.Providers.DotNet/Mono.Security.Providers.DotNet-net_4_x.csproj [deleted file]
mcs/class/Mono.Security.Providers.DotNet/Mono.Security.Providers.DotNet.dll.sources [deleted file]
mcs/class/Mono.Security.Providers.DotNet/Mono.Security.Providers.DotNet/DotNetSslStreamImpl.cs [deleted file]
mcs/class/Mono.Security.Providers.DotNet/Mono.Security.Providers.DotNet/DotNetTlsProvider.cs [deleted file]
mcs/class/Mono.Security.Providers.DotNet/Properties/AssemblyInfo.cs [deleted file]
mcs/class/Mono.Security.Providers.DotNet/README.md [deleted file]
mcs/class/Mono.Security.Providers.NewSystemSource/Makefile [deleted file]
mcs/class/Mono.Security.Providers.NewSystemSource/Mono.Security.Providers.NewSystemSource-net_4_x.csproj [deleted file]
mcs/class/Mono.Security.Providers.NewSystemSource/Mono.Security.Providers.NewSystemSource.dll.sources [deleted file]
mcs/class/Mono.Security.Providers.NewSystemSource/Properties/AssemblyInfo.cs [deleted file]
mcs/class/Mono.Security.Providers.NewSystemSource/README.md [deleted file]
mcs/class/Mono.Security.Providers.NewTls/Makefile [deleted file]
mcs/class/Mono.Security.Providers.NewTls/Mono.Security.Providers.NewTls-net_4_x.csproj [deleted file]
mcs/class/Mono.Security.Providers.NewTls/Mono.Security.Providers.NewTls.dll.sources [deleted file]
mcs/class/Mono.Security.Providers.NewTls/Mono.Security.Providers.NewTls/ITlsConfiguration.cs [deleted file]
mcs/class/Mono.Security.Providers.NewTls/Mono.Security.Providers.NewTls/ITlsContext.cs [deleted file]
mcs/class/Mono.Security.Providers.NewTls/Mono.Security.Providers.NewTls/MonoNewTlsStream.cs [deleted file]
mcs/class/Mono.Security.Providers.NewTls/Mono.Security.Providers.NewTls/MonoNewTlsStreamFactory.cs [deleted file]
mcs/class/Mono.Security.Providers.NewTls/Mono.Security.Providers.NewTls/NewTlsProvider.cs [deleted file]
mcs/class/Mono.Security.Providers.NewTls/Mono.Security.Providers.NewTls/TlsContextWrapper.cs [deleted file]
mcs/class/Mono.Security.Providers.NewTls/Mono.Security.Providers.NewTls/TlsProviderFactory.cs [deleted file]
mcs/class/Mono.Security.Providers.NewTls/Properties/AssemblyInfo.cs [deleted file]
mcs/class/Mono.Security.Providers.NewTls/mobile_Mono.Security.Providers.NewTls.dll.sources [deleted file]
mcs/class/Mono.Security.Providers.NewTls/mobile_static_Mono.Security.Providers.NewTls.dll.sources [deleted file]
mcs/class/Mono.Security.Providers.OldTls/Makefile [deleted file]
mcs/class/Mono.Security.Providers.OldTls/Mono.Security.Providers.OldTls-net_4_x.csproj [deleted file]
mcs/class/Mono.Security.Providers.OldTls/Mono.Security.Providers.OldTls.dll.sources [deleted file]
mcs/class/Mono.Security.Providers.OldTls/Mono.Security.Providers.OldTls/OldTlsProvider.cs [deleted file]
mcs/class/Mono.Security.Providers.OldTls/Properties/AssemblyInfo.cs [deleted file]
mcs/class/Mono.Security.Win32/Mono.Security.Win32-net_4_x.csproj
mcs/class/Mono.Security/Assembly/AssemblyInfo.cs
mcs/class/Mono.Security/Mono.Security-net_4_x.csproj
mcs/class/Mono.Security/Mono.Security.Interface/CertificateValidationHelper.cs
mcs/class/Mono.Security/Mono.Security.Interface/CipherSuiteCode.cs
mcs/class/Mono.Security/Mono.Security.Interface/IMonoTlsContext.cs [deleted file]
mcs/class/Mono.Security/Mono.Security.Interface/MonoTlsConnectionInfo.cs
mcs/class/Mono.Security/Mono.Security.Interface/MonoTlsProvider.cs
mcs/class/Mono.Security/Mono.Security.Interface/MonoTlsProviderFactory.cs
mcs/class/Mono.Security/Mono.Security.Interface/MonoTlsSettings.cs
mcs/class/Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsClientCertificate.cs
mcs/class/Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsServerFinished.cs
mcs/class/Mono.Security/Mono.Security.Protocol.Tls/DebugHelper.cs
mcs/class/Mono.Security/Mono.Security.X509/X509Store.cs
mcs/class/Mono.Security/Mono.Security.X509/X509StoreManager.cs
mcs/class/Mono.Security/Mono.Security.X509/X509Stores.cs
mcs/class/Mono.Security/Mono.Security.dll.sources
mcs/class/Mono.Security/Test/tools/sockethell/Makefile
mcs/class/Mono.Simd/Mono.Simd-net_4_x.csproj
mcs/class/Mono.Tasklets/Mono.Tasklets-net_4_x.csproj
mcs/class/Mono.WebBrowser/Mono.WebBrowser-net_4_x.csproj
mcs/class/Mono.XBuild.Tasks/.gitignore [new file with mode: 0644]
mcs/class/Mono.XBuild.Tasks/Makefile
mcs/class/Mono.XBuild.Tasks/Mono.XBuild.Tasks-net_4_x.csproj
mcs/class/Mono.XBuild.Tasks/Mono.XBuild.Tasks_test.dll.sources
mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap-net_4_x.csproj
mcs/class/PEAPI/PEAPI-net_4_x.csproj
mcs/class/RabbitMQ.Client/src/apigen/RabbitMQ.Client.Apigen-net_4_x.csproj
mcs/class/RabbitMQ.Client/src/client/RabbitMQ.Client-net_4_x.csproj
mcs/class/SMDiagnostics/Assembly/AssemblyInfo.cs
mcs/class/SMDiagnostics/SMDiagnostics-net_4_x.csproj
mcs/class/System.ComponentModel.Composition.4.5/Makefile
mcs/class/System.ComponentModel.Composition.4.5/System.ComponentModel.Composition-net_4_x.csproj
mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations-net_4_x.csproj
mcs/class/System.ComponentModel.DataAnnotations/Test/System.ComponentModel.DataAnnotations/CompareAttributeTest.cs
mcs/class/System.ComponentModel.DataAnnotations/Test/System.ComponentModel.DataAnnotations/CreditCardAttributeTest.cs
mcs/class/System.ComponentModel.DataAnnotations/Test/System.ComponentModel.DataAnnotations/EmailAddressAttributeTest.cs
mcs/class/System.ComponentModel.DataAnnotations/Test/System.ComponentModel.DataAnnotations/FileExtensionsAttributeTest.cs
mcs/class/System.ComponentModel.DataAnnotations/Test/System.ComponentModel.DataAnnotations/PhoneAttributeTest.cs
mcs/class/System.Configuration.Install/System.Configuration.Install-net_4_x.csproj
mcs/class/System.Configuration/Makefile
mcs/class/System.Configuration/System.Configuration-net_4_x.csproj
mcs/class/System.Configuration/Test/App.config [deleted file]
mcs/class/System.Configuration/Test/System.Configuration/AppSettingsSectionTest.cs
mcs/class/System.Configuration/Test/System.Configuration/ConfigurationManagerTest.cs
mcs/class/System.Configuration/Test/System.Configuration/ConfigurationSaveTest.cs
mcs/class/System.Configuration/Test/Util/TestUtil.cs
mcs/class/System.Configuration/Test/test-config-file [new file with mode: 0644]
mcs/class/System.Configuration/net_4_x_System.Configuration_test.dll.config [deleted symlink]
mcs/class/System.Core/Assembly/AssemblyInfo.cs
mcs/class/System.Core/Microsoft.Win32.SafeHandles/SafeMemoryMappedViewHandle.cs
mcs/class/System.Core/Microsoft.Win32.SafeHandles/SafeNCryptHandle.cs
mcs/class/System.Core/Microsoft.Win32.SafeHandles/SafePipeHandle.cs
mcs/class/System.Core/System.Core-net_4_x.csproj
mcs/class/System.Core/System.Core-plaincore-net_4_x.csproj
mcs/class/System.Core/System.IO.MemoryMappedFiles/MemoryMappedFile.cs
mcs/class/System.Core/System.IO.MemoryMappedFiles/MemoryMappedView.cs
mcs/class/System.Core/System.IO.Pipes/AnonymousPipeClientStream.cs
mcs/class/System.Core/System.IO.Pipes/AnonymousPipeServerStream.cs
mcs/class/System.Core/System.IO.Pipes/NamedPipeClientStream.cs
mcs/class/System.Core/System.IO.Pipes/NamedPipeServerStream.cs
mcs/class/System.Core/System.IO.Pipes/PipeStream.cs
mcs/class/System.Core/System.IO.Pipes/PipeUnix.cs
mcs/class/System.Core/System.Security.Cryptography.X509Certificates/RSACertificateExtensions.cs
mcs/class/System.Core/System.Security.Cryptography/AesTransform.cs
mcs/class/System.Core/System.Security.Cryptography/CngAlgorithm.cs [deleted file]
mcs/class/System.Core/System.Security.Cryptography/CngAlgorithmGroup.cs [deleted file]
mcs/class/System.Core/System.Security.Cryptography/CngExportPolicies.cs [deleted file]
mcs/class/System.Core/System.Security.Cryptography/CngKeyCreationOptions.cs [deleted file]
mcs/class/System.Core/System.Security.Cryptography/CngKeyCreationParameters.cs [deleted file]
mcs/class/System.Core/System.Security.Cryptography/CngKeyOpenOptions.cs [deleted file]
mcs/class/System.Core/System.Security.Cryptography/CngKeyUsages.cs [deleted file]
mcs/class/System.Core/System.Security.Cryptography/CngProperty.cs [deleted file]
mcs/class/System.Core/System.Security.Cryptography/CngPropertyCollection.cs [deleted file]
mcs/class/System.Core/System.Security.Cryptography/CngPropertyOptions.cs [deleted file]
mcs/class/System.Core/System.Security.Cryptography/CngProvider.cs [deleted file]
mcs/class/System.Core/System.Security.Cryptography/CngUIPolicy.cs [deleted file]
mcs/class/System.Core/System.Security.Cryptography/CngUIProtectionLevels.cs [deleted file]
mcs/class/System.Core/System.Security.Cryptography/ECDiffieHellmanKeyDerivationFunction.cs [deleted file]
mcs/class/System.Core/System.Security.Cryptography/ECKeyXmlFormat.cs [deleted file]
mcs/class/System.Core/System.Security.Cryptography/IncrementalHash.cs [deleted file]
mcs/class/System.Core/System.Security.Cryptography/MD5Cng.cs
mcs/class/System.Core/System.Security.Cryptography/SHA1Cng.cs
mcs/class/System.Core/System.Security.Cryptography/SHA256Cng.cs
mcs/class/System.Core/System.Security.Cryptography/SHA256CryptoServiceProvider.cs
mcs/class/System.Core/System.Security.Cryptography/SHA384Cng.cs
mcs/class/System.Core/System.Security.Cryptography/SHA384CryptoServiceProvider.cs
mcs/class/System.Core/System.Security.Cryptography/SHA512Cng.cs
mcs/class/System.Core/System.Security.Cryptography/SHA512CryptoServiceProvider.cs
mcs/class/System.Core/Test/System.IO.MemoryMappedFiles/MemoryMappedFileTest.cs
mcs/class/System.Core/Test/System.Linq/EnumerableFixture.cs
mcs/class/System.Core/common_System.Core.dll.sources
mcs/class/System.Core/net_4_x_System.Core.dll.sources
mcs/class/System.Core/tools/hashwrap.cs
mcs/class/System.Data.DataSetExtensions/System.Data.DataSetExtensions-net_4_x.csproj
mcs/class/System.Data.Entity/System.Data.Entity-net_4_x.csproj
mcs/class/System.Data.Linq/System.Data.Linq-net_4_x.csproj
mcs/class/System.Data.Linq/build/.gitignore [new file with mode: 0644]
mcs/class/System.Data.Linq/build/DbLinq.Sqlite_test_mono_strict.dll.sources
mcs/class/System.Data.Linq/build/Makefile
mcs/class/System.Data.Linq/src/DbLinq/Test/Providers/DataContext.cs
mcs/class/System.Data.Linq/src/DbLinq/Test/Providers/DynamicLinqTest.cs
mcs/class/System.Data.Linq/src/DbLinq/Test/Providers/ExecuteCommand_Test.cs
mcs/class/System.Data.Linq/src/DbLinq/Test/Providers/ExecuteQuery_Test.cs
mcs/class/System.Data.Linq/src/DbLinq/Test/Providers/Linq_101_Samples/Advanced.cs
mcs/class/System.Data.Linq/src/DbLinq/Test/Providers/ReadTest.cs
mcs/class/System.Data.Linq/src/DbLinq/Test/Providers/ReadTest_Complex.cs
mcs/class/System.Data.Linq/src/DbLinq/Test/Providers/ReadTest_GroupBy.cs
mcs/class/System.Data.Linq/src/DbLinq/Test/Providers/ReadTests_AnyCountFirst.cs
mcs/class/System.Data.Linq/src/DbLinq/Test/Providers/ReadTests_DateTimeFunctions.cs
mcs/class/System.Data.Linq/src/DbLinq/Test/Providers/ReadTests_EntitySet.cs
mcs/class/System.Data.Linq/src/DbLinq/Test/Providers/StoredProcTest.cs
mcs/class/System.Data.Linq/src/DbLinq/Test/Providers/Table.cs
mcs/class/System.Data.Linq/src/DbLinq/Test/Providers/TestBase.cs
mcs/class/System.Data.Linq/src/DbLinq/Test/Providers/WriteTest.cs
mcs/class/System.Data.OracleClient/README.tests
mcs/class/System.Data.OracleClient/System.Data.OracleClient-net_4_x.csproj
mcs/class/System.Data.OracleClient/System.Data.OracleClient_test_default.dll.config.example [deleted file]
mcs/class/System.Data.OracleClient/Test/System.Data.OracleClient.Oci/OciDefineHandleTest.cs
mcs/class/System.Data.OracleClient/Test/System.Data.OracleClient.jvm/GHTDB.ORACLE.sql
mcs/class/System.Data.OracleClient/Test/System.Data.OracleClient.jvm/MonoTests.System.Data.Utils/ConnectedDataProvider.cs
mcs/class/System.Data.OracleClient/Test/System.Data.OracleClient.jvm/OracleConnection/IDBConnection_For_Oracle.cs
mcs/class/System.Data.OracleClient/Test/System.Data.OracleClient.jvm/readme.txt
mcs/class/System.Data.OracleClient/Test/System.Data.OracleClient/OracleLobTest.cs
mcs/class/System.Data.OracleClient/Test/System.Data.OracleClient/OracleParameterTest.cs
mcs/class/System.Data.Services.Client/System.Data.Services.Client-net_4_x.csproj
mcs/class/System.Data.Services/System.Data.Services-net_4_x.csproj
mcs/class/System.Data/Makefile
mcs/class/System.Data/System.Data-net_4_x.csproj
mcs/class/System.Data/System.Data.SqlClient/SqlBulkCopy.platformnotsupported.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.SqlClient/SqlCommand.cs
mcs/class/System.Data/System.Data.SqlClient/SqlCommand.platformnotsupported.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.SqlClient/SqlCommandBuilder.platformnotsupported.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.SqlClient/SqlConnection.cs
mcs/class/System.Data/System.Data.SqlClient/SqlConnection.platformnotsupported.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.SqlClient/SqlDataReader.cs
mcs/class/System.Data/System.Data.SqlClient/SqlDataReader.platformnotsupported.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.SqlClient/SqlDependency.cs
mcs/class/System.Data/System.Data.SqlClient/SqlException.platformnotsupported.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.SqlClient/SqlParameter.cs
mcs/class/System.Data/System.Data.SqlClient/SqlParameter.platformnotsupported.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.SqlClient/SqlParameterCollection.platformnotsupported.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.SqlClient/SqlTransaction.platformnotsupported.cs [new file with mode: 0644]
mcs/class/System.Data/Test/System.Data.Common/DbDataAdapterTest.cs
mcs/class/System.Data/Test/System.Data.Common/DbDataReaderTest.cs
mcs/class/System.Data/Test/System.Data.SqlClient/SqlBulkCopyTest.cs
mcs/class/System.Data/Test/System.Data.SqlClient/SqlCommandBuilderTest.cs
mcs/class/System.Data/Test/System.Data.SqlClient/SqlCommandTest.cs
mcs/class/System.Data/Test/System.Data.SqlClient/SqlConnectionTest.cs
mcs/class/System.Data/Test/System.Data.SqlClient/SqlDataAdapterTest.cs
mcs/class/System.Data/Test/System.Data.SqlClient/SqlParameterTest.cs
mcs/class/System.Data/Test/System.Data/ConstraintCollectionTest.cs
mcs/class/System.Data/Test/System.Data/ConstraintTest.cs
mcs/class/System.Data/Test/System.Data/DataRelationCollectionTest.cs
mcs/class/System.Data/Test/System.Data/DataRelationTest.cs
mcs/class/System.Data/Test/System.Data/DataTableReadWriteXmlTest.cs [changed mode: 0644->0755]
mcs/class/System.Data/Test/System.Data/DataTableTest.cs [changed mode: 0644->0755]
mcs/class/System.Data/Test/System.Data/TypedDataSetGeneratorTest.cs
mcs/class/System.Data/Test/System.Data/UniqueConstraintTest.cs
mcs/class/System.Data/Test/System.Xml/XmlDataDocumentTest.cs [changed mode: 0644->0755]
mcs/class/System.Data/Test/test-config-file [new file with mode: 0644]
mcs/class/System.Data/app_test_mobile_static.config [deleted file]
mcs/class/System.Data/app_test_net_4_x.config [deleted file]
mcs/class/System.Data/monotouch_watch_System.Data.dll.exclude.sources [new file with mode: 0644]
mcs/class/System.Data/monotouch_watch_System.Data.dll.sources
mcs/class/System.Deployment/System.Deployment-net_4_x.csproj
mcs/class/System.Design/System.Design-net_4_x.csproj
mcs/class/System.Design/System.Design-plaindesign-net_4_x.csproj
mcs/class/System.DirectoryServices.Protocols/System.DirectoryServices.Protocols-net_4_x.csproj
mcs/class/System.DirectoryServices/System.DirectoryServices-net_4_x.csproj
mcs/class/System.Drawing.Design/System.Drawing.Design-net_4_x.csproj
mcs/class/System.Drawing/System.Drawing-net_4_x.csproj
mcs/class/System.Drawing/System.Drawing_test.dll.sources
mcs/class/System.Drawing/Test/DrawingTest/Test/Graphics.cs
mcs/class/System.Dynamic/System.Dynamic-net_4_x.csproj
mcs/class/System.EnterpriseServices/System.EnterpriseServices-net_4_x.csproj
mcs/class/System.IO.Compression.FileSystem/System.IO.Compression.FileSystem-net_4_x.csproj
mcs/class/System.IO.Compression/System.IO.Compression-net_4_x.csproj
mcs/class/System.IdentityModel.Selectors/System.IdentityModel.Selectors-net_4_x.csproj
mcs/class/System.IdentityModel/Assembly/AssemblyInfo.cs
mcs/class/System.IdentityModel/Makefile
mcs/class/System.IdentityModel/System.IdentityModel-net_4_x.csproj
mcs/class/System.IdentityModel/System.ServiceModel.Security.Tokens/BinarySecretSecurityToken.cs [new file with mode: 0644]
mcs/class/System.IdentityModel/System.ServiceModel.Security.Tokens/InternalEncryptedKeyIdentifierClause.cs [new file with mode: 0644]
mcs/class/System.IdentityModel/System.ServiceModel.Security.Tokens/WrappedKeySecurityToken.cs [new file with mode: 0644]
mcs/class/System.IdentityModel/System.ServiceModel.Security/BinarySecretKeyIdentifierClause.cs [new file with mode: 0644]
mcs/class/System.IdentityModel/System.ServiceModel.Security/KeyNameIdentifierClause.cs [new file with mode: 0644]
mcs/class/System.IdentityModel/System.ServiceModel.Security/SecurityContextKeyIdentifierClause.cs [new file with mode: 0644]
mcs/class/System.IdentityModel/Test/System.IdentityModel.Tokens/BootstrapContextTest.cs
mcs/class/System.IdentityModel/net_4_x_System.IdentityModel.dll.sources
mcs/class/System.Json.Microsoft/System.Json.Microsoft-net_4_x.csproj
mcs/class/System.Json/System.Json-net_4_x.csproj
mcs/class/System.Management/System.Management-net_4_x.csproj
mcs/class/System.Messaging/System.Messaging-net_4_x.csproj
mcs/class/System.Net.Http.Formatting/System.Net.Http.Formatting-net_4_x.csproj
mcs/class/System.Net.Http.WebRequest/System.Net.Http.WebRequest-net_4_x.csproj
mcs/class/System.Net.Http/HttpClientEx.cs
mcs/class/System.Net.Http/System.Net.Http-net_4_x.csproj
mcs/class/System.Net.Http/System.Net.Http.Headers/ContentRangeHeaderValue.cs
mcs/class/System.Net.Http/System.Net.Http.Headers/HeaderInfo.cs
mcs/class/System.Net.Http/System.Net.Http.Headers/HttpHeaderValueCollection.cs
mcs/class/System.Net.Http/System.Net.Http.Headers/HttpHeaders.cs
mcs/class/System.Net.Http/System.Net.Http/HttpClientHandler.cs
mcs/class/System.Net.Http/System.Net.Http/HttpClientHandler.platformnotsupported.cs [new file with mode: 0644]
mcs/class/System.Net.Http/Test/System.Net.Http.Headers/ContentRangeHeaderValueTest.cs
mcs/class/System.Net.Http/Test/System.Net.Http.Headers/HttpHeaderValueCollection.cs
mcs/class/System.Net.Http/Test/System.Net.Http/HttpClientHandlerTest.cs
mcs/class/System.Net.Http/Test/System.Net.Http/HttpClientTest.cs
mcs/class/System.Net.Http/monotouch_watch_System.Net.Http.dll.exclude.sources [new file with mode: 0644]
mcs/class/System.Net.Http/monotouch_watch_System.Net.Http.dll.sources [new file with mode: 0644]
mcs/class/System.Net/Assembly/AssemblyInfo.cs
mcs/class/System.Net/System.Net-net_4_x.csproj
mcs/class/System.Net/System.Net.NetworkInformation/NetworkChange_2_1.cs
mcs/class/System.Net/System.Net.NetworkInformation/NetworkInterface_2_1.cs
mcs/class/System.Net/System.Net.Policy/BaseDomainPolicy.cs
mcs/class/System.Net/System.Net.Policy/ClientAccessPolicy.cs
mcs/class/System.Net/System.Net.Policy/ClientAccessPolicyParser.cs
mcs/class/System.Net/System.Net.Policy/CrossDomainPolicyManager.cs
mcs/class/System.Net/System.Net.Policy/FlashCrossDomainPolicy.cs
mcs/class/System.Net/System.Net.Policy/FlashCrossDomainPolicyParser.cs
mcs/class/System.Net/System.Net.Policy/ICrossDomainPolicy.cs
mcs/class/System.Net/System.Net.Policy/NoAccessPolicy.cs
mcs/class/System.Net/System.Net.Policy/PolicyDownloadPolicy.cs
mcs/class/System.Net/System.Net.Policy/SiteOfOriginPolicy.cs
mcs/class/System.Net/System.Net.Sockets/AddressFamily_2_1.cs
mcs/class/System.Net/System.Net.Sockets/ProtocolType_2_1.cs
mcs/class/System.Net/System.Net.Sockets/SocketAsyncOperation_2_1.cs
mcs/class/System.Net/System.Net.Sockets/SocketType_2_1.cs
mcs/class/System.Net/System.Net.Sockets/UdpAnySourceMulticastClient.cs
mcs/class/System.Net/System.Net.Sockets/UdpSingleSourceMulticastClient.cs
mcs/class/System.Net/System.Net/HttpWebRequest_2_1.cs
mcs/class/System.Net/System.Net/HttpWebResponse_2_1.cs
mcs/class/System.Net/System.Net/WebExceptionStatus_2_1.cs
mcs/class/System.Net/System.Net/WebHeaderCollection_2_1.cs
mcs/class/System.Net/System.Net/WebRequest_2_1.cs
mcs/class/System.Net/System.Net/WebResponse_2_1.cs
mcs/class/System.Net/System.Net/WriteStreamClosedEventArgs_2_1.cs
mcs/class/System.Net/System.Net/WriteStreamClosedEventHandler_2_1.cs
mcs/class/System.Numerics.Vectors/System.Numerics.Vectors-net_4_x.csproj
mcs/class/System.Numerics/System.Numerics-net_4_x.csproj
mcs/class/System.Reactive.Core/System.Reactive.Core-net_4_x.csproj
mcs/class/System.Reactive.Debugger/System.Reactive.Debugger-net_4_x.csproj
mcs/class/System.Reactive.Experimental/System.Reactive.Experimental-net_4_x.csproj
mcs/class/System.Reactive.Interfaces/System.Reactive.Interfaces-net_4_x.csproj
mcs/class/System.Reactive.Linq/System.Reactive.Linq-net_4_x.csproj
mcs/class/System.Reactive.Observable.Aliases/System.Reactive.Observable.Aliases-net_4_x.csproj
mcs/class/System.Reactive.PlatformServices/System.Reactive.PlatformServices-net_4_x.csproj
mcs/class/System.Reactive.Providers/System.Reactive.Providers-net_4_x.csproj
mcs/class/System.Reactive.Runtime.Remoting/System.Reactive.Runtime.Remoting-net_4_x.csproj
mcs/class/System.Reactive.Windows.Forms/System.Reactive.Windows.Forms-net_4_x.csproj
mcs/class/System.Reactive.Windows.Threading/System.Reactive.Windows.Threading-net_4_x.csproj
mcs/class/System.Reflection.Context/System.Reflection.Context-net_4_x.csproj [new file with mode: 0644]
mcs/class/System.Runtime.Caching/System.Runtime.Caching-net_4_x.csproj
mcs/class/System.Runtime.DurableInstancing/Assembly/AssemblyInfo.cs
mcs/class/System.Runtime.DurableInstancing/System.Runtime.DurableInstancing-net_4_x.csproj
mcs/class/System.Runtime.InteropServices.RuntimeInformation/Assembly/AssemblyInfo.cs
mcs/class/System.Runtime.InteropServices.RuntimeInformation/System.Runtime.InteropServices.RuntimeInformation-net_4_x.csproj [new file with mode: 0644]
mcs/class/System.Runtime.Remoting/System.Runtime.Remoting-net_4_x.csproj
mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Ipc.Win32/IpcChannel.cs
mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Ipc.Win32/NamedPipeHelper.cs
mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Ipc.Win32/NamedPipeListener.cs
mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Tcp/TcpServerChannel.cs
mcs/class/System.Runtime.Remoting/System.Runtime.Remoting_test.dll.sources
mcs/class/System.Runtime.Remoting/Test/HttpBugTests.cs
mcs/class/System.Runtime.Remoting/Test/IpcChannelTest.cs
mcs/class/System.Runtime.Remoting/Test/RemotingServicesTest.cs
mcs/class/System.Runtime.Serialization.Formatters.Soap/System.Runtime.Serialization.Formatters.Soap-net_4_x.csproj
mcs/class/System.Runtime.Serialization/Assembly/AssemblyInfo.cs
mcs/class/System.Runtime.Serialization/ReferenceSources/SchemaExporter_mobile.cs
mcs/class/System.Runtime.Serialization/ReferenceSources/XsdDataContractExporter_mobile.cs [new file with mode: 0644]
mcs/class/System.Runtime.Serialization/System.Runtime.Serialization-net_4_x.csproj
mcs/class/System.Runtime.Serialization/Test/System.Runtime.Serialization/CollectionSerialization.cs
mcs/class/System.Runtime.Serialization/Test/System.Runtime.Serialization/XsdDataContractExporterTest2.cs
mcs/class/System.Runtime.Serialization/Test/System.Runtime.Serialization/XsdDataContractImporterTest2.cs
mcs/class/System.Runtime.Serialization/mobile_System.Runtime.Serialization.dll.sources
mcs/class/System.Security/Makefile
mcs/class/System.Security/System.Security-net_4_x.csproj
mcs/class/System.Security/System.Security.Cryptography.Pkcs/AlgorithmIdentifier.cs
mcs/class/System.Security/System.Security.Cryptography.Pkcs/ContentInfo.cs
mcs/class/System.Security/System.Security.Cryptography.Pkcs/EnvelopedCms.cs
mcs/class/System.ServiceModel.Activation/System.ServiceModel.Activation-net_4_x.csproj
mcs/class/System.ServiceModel.Discovery/Assembly/AssemblyInfo.cs
mcs/class/System.ServiceModel.Discovery/System.ServiceModel.Discovery-net_4_x.csproj
mcs/class/System.ServiceModel.Internals/Assembly/AssemblyInfo.cs
mcs/class/System.ServiceModel.Internals/System.ServiceModel.Internals-net_4_x.csproj
mcs/class/System.ServiceModel.Routing/Assembly/AssemblyInfo.cs
mcs/class/System.ServiceModel.Routing/System.ServiceModel.Routing-net_4_x.csproj
mcs/class/System.ServiceModel.Syndication/Assembly/AssemblyInfo.cs
mcs/class/System.ServiceModel.Web.Extensions/Assembly/AssemblyInfo.cs
mcs/class/System.ServiceModel.Web/Assembly/AssemblyInfo.cs
mcs/class/System.ServiceModel.Web/System.ServiceModel.Channels/WebMessageEncoder.cs
mcs/class/System.ServiceModel.Web/System.ServiceModel.Channels/WebMessageEncodingBindingElement.cs
mcs/class/System.ServiceModel.Web/System.ServiceModel.Description/WebHttpBehavior.cs
mcs/class/System.ServiceModel.Web/System.ServiceModel.Dispatcher/WebMessageFormatter.cs
mcs/class/System.ServiceModel.Web/System.ServiceModel.Web-net_4_x.csproj
mcs/class/System.ServiceModel.Web/System.ServiceModel.Web/WebChannelFactory.cs
mcs/class/System.ServiceModel.Web/System.ServiceModel.Web/WebOperationContext.cs
mcs/class/System.ServiceModel.Web/System.ServiceModel/WebHttpBinding.cs
mcs/class/System.ServiceModel.Web/System.ServiceModel/WebHttpSecurity.cs
mcs/class/System.ServiceModel.Web/Test/System.ServiceModel.Web/WebOperationContextTest.cs
mcs/class/System.ServiceModel/Assembly/AssemblyInfo.cs
mcs/class/System.ServiceModel/Dummy_2_1.cs
mcs/class/System.ServiceModel/Dummy_XM_4_5.cs
mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeModule.cs
mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/DebugHelper.cs
mcs/class/System.ServiceModel/System.ServiceModel-net_4_x.csproj
mcs/class/System.ServiceModel/System.ServiceModel-plainservice-net_4_x.csproj
mcs/class/System.ServiceModel/System.ServiceModel.Channels.NetTcp/TcpChannelListener.cs
mcs/class/System.ServiceModel/System.ServiceModel.Channels/AddressHeader.cs
mcs/class/System.ServiceModel/System.ServiceModel.Channels/AddressHeaderCollection.cs
mcs/class/System.ServiceModel/System.ServiceModel.Channels/BinaryMessageEncodingBindingElement.cs
mcs/class/System.ServiceModel/System.ServiceModel.Channels/Binding.cs
mcs/class/System.ServiceModel/System.ServiceModel.Channels/BindingContext.cs
mcs/class/System.ServiceModel/System.ServiceModel.Channels/BindingElement.cs
mcs/class/System.ServiceModel/System.ServiceModel.Channels/BindingElementCollection.cs
mcs/class/System.ServiceModel/System.ServiceModel.Channels/ChannelBase.cs
mcs/class/System.ServiceModel/System.ServiceModel.Channels/ChannelFactoryBase.cs
mcs/class/System.ServiceModel/System.ServiceModel.Channels/ChannelManagerBase.cs
mcs/class/System.ServiceModel/System.ServiceModel.Channels/CustomBinding.cs
mcs/class/System.ServiceModel/System.ServiceModel.Channels/FaultConverter.cs
mcs/class/System.ServiceModel/System.ServiceModel.Channels/HttpRequestChannel.cs
mcs/class/System.ServiceModel/System.ServiceModel.Channels/HttpTransportBindingElement.cs
mcs/class/System.ServiceModel/System.ServiceModel.Channels/HttpsTransportBindingElement.cs
mcs/class/System.ServiceModel/System.ServiceModel.Channels/LocalClientSecuritySettings.cs
mcs/class/System.ServiceModel/System.ServiceModel.Channels/Message.cs
mcs/class/System.ServiceModel/System.ServiceModel.Channels/MessageBufferImpl.cs
mcs/class/System.ServiceModel/System.ServiceModel.Channels/MessageEncodingBindingElement.cs
mcs/class/System.ServiceModel/System.ServiceModel.Channels/MessageFault.cs
mcs/class/System.ServiceModel/System.ServiceModel.Channels/MessageHeader.cs
mcs/class/System.ServiceModel/System.ServiceModel.Channels/MessageHeaders.cs
mcs/class/System.ServiceModel/System.ServiceModel.Channels/MessageProperties.cs
mcs/class/System.ServiceModel/System.ServiceModel.Channels/MessageVersion.cs
mcs/class/System.ServiceModel/System.ServiceModel.Channels/ReliableSessionBindingElement.cs
mcs/class/System.ServiceModel/System.ServiceModel.Channels/SecurityBindingElement.cs
mcs/class/System.ServiceModel/System.ServiceModel.Channels/TcpTransportBindingElement.cs
mcs/class/System.ServiceModel/System.ServiceModel.Channels/TextMessageEncodingBindingElement.cs
mcs/class/System.ServiceModel/System.ServiceModel.Channels/TransportBindingElement.cs
mcs/class/System.ServiceModel/System.ServiceModel.Channels/TransportSecurityBindingElement.cs
mcs/class/System.ServiceModel/System.ServiceModel.Description/ClientCredentials.cs
mcs/class/System.ServiceModel/System.ServiceModel.Description/ContractDescriptionGenerator.cs
mcs/class/System.ServiceModel/System.ServiceModel.Description/DataContractSerializerOperationBehavior.cs
mcs/class/System.ServiceModel/System.ServiceModel.Description/IContractBehavior.cs
mcs/class/System.ServiceModel/System.ServiceModel.Description/IEndpointBehavior.cs
mcs/class/System.ServiceModel/System.ServiceModel.Description/IOperationBehavior.cs
mcs/class/System.ServiceModel/System.ServiceModel.Description/MessagePartDescription.cs
mcs/class/System.ServiceModel/System.ServiceModel.Description/XmlSerializerOperationBehavior.cs
mcs/class/System.ServiceModel/System.ServiceModel.Diagnostics/MessageLoggingSettings.cs
mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/BaseMessagesFormatter.cs
mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/ChannelDispatcher.cs
mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/ClientOperation.cs
mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/ClientRuntime.cs
mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/DispatchOperation.cs
mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/DispatchRuntime.cs
mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/IClientMessageFormatter.cs
mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/IClientMessageInspector.cs
mcs/class/System.ServiceModel/System.ServiceModel.Security.Tokens/BinarySecretSecurityToken.cs [deleted file]
mcs/class/System.ServiceModel/System.ServiceModel.Security.Tokens/InternalEncryptedKeyIdentifierClause.cs [deleted file]
mcs/class/System.ServiceModel/System.ServiceModel.Security.Tokens/SecureConversationSecurityTokenParameters.cs
mcs/class/System.ServiceModel/System.ServiceModel.Security.Tokens/WrappedKeySecurityToken.cs [deleted file]
mcs/class/System.ServiceModel/System.ServiceModel.Security/BinarySecretKeyIdentifierClause.cs [deleted file]
mcs/class/System.ServiceModel/System.ServiceModel.Security/KeyNameIdentifierClause.cs [deleted file]
mcs/class/System.ServiceModel/System.ServiceModel.Security/SecurityContextKeyIdentifierClause.cs [deleted file]
mcs/class/System.ServiceModel/System.ServiceModel.Security/X509CertificateInitiatorClientCredential.cs
mcs/class/System.ServiceModel/System.ServiceModel.Security/X509CertificateRecipientClientCredential.cs
mcs/class/System.ServiceModel/System.ServiceModel.dll.sources
mcs/class/System.ServiceModel/System.ServiceModel/ActionNotSupportedException.cs
mcs/class/System.ServiceModel/System.ServiceModel/BasicHttpBinding_4_5.cs
mcs/class/System.ServiceModel/System.ServiceModel/BasicHttpsBinding.cs
mcs/class/System.ServiceModel/System.ServiceModel/ChannelFactory.cs
mcs/class/System.ServiceModel/System.ServiceModel/ChannelFactory_1.cs
mcs/class/System.ServiceModel/System.ServiceModel/ClientProxyGenerator.cs
mcs/class/System.ServiceModel/System.ServiceModel/ClientRealProxy.cs
mcs/class/System.ServiceModel/System.ServiceModel/CommunicationException.cs
mcs/class/System.ServiceModel/System.ServiceModel/CommunicationObjectAbortedException.cs
mcs/class/System.ServiceModel/System.ServiceModel/CommunicationObjectFaultedException.cs
mcs/class/System.ServiceModel/System.ServiceModel/DnsEndpointIdentity.cs
mcs/class/System.ServiceModel/System.ServiceModel/DuplexClientBase.cs
mcs/class/System.ServiceModel/System.ServiceModel/EndpointAddress.cs
mcs/class/System.ServiceModel/System.ServiceModel/EndpointAddress10.cs
mcs/class/System.ServiceModel/System.ServiceModel/EndpointAddressBuilder.cs
mcs/class/System.ServiceModel/System.ServiceModel/EndpointNotFoundException.cs
mcs/class/System.ServiceModel/System.ServiceModel/FaultCode.cs
mcs/class/System.ServiceModel/System.ServiceModel/FaultException.cs
mcs/class/System.ServiceModel/System.ServiceModel/InvalidMessageContractException.cs
mcs/class/System.ServiceModel/System.ServiceModel/Logger.cs
mcs/class/System.ServiceModel/System.ServiceModel/MessageHeaderException.cs
mcs/class/System.ServiceModel/System.ServiceModel/MessageHeader_1.cs
mcs/class/System.ServiceModel/System.ServiceModel/OperationContext.cs
mcs/class/System.ServiceModel/System.ServiceModel/ProtocolException.cs
mcs/class/System.ServiceModel/System.ServiceModel/QuotaExceededException.cs
mcs/class/System.ServiceModel/System.ServiceModel/ServerTooBusyException.cs
mcs/class/System.ServiceModel/System.ServiceModel/ServiceActivationException.cs
mcs/class/System.ServiceModel/System.ServiceModel/SilverlightClientConfigLoader.cs
mcs/class/System.ServiceModel/System.ServiceModel/SpnEndpointIdentity.cs
mcs/class/System.ServiceModel/System.ServiceModel/UpnEndpointIdentity.cs
mcs/class/System.ServiceModel/System.ServiceModel_test.dll.sources
mcs/class/System.ServiceModel/Test/MetadataTests/BindingTestAssertions.cs
mcs/class/System.ServiceModel/Test/MetadataTests/ExportTests.cs
mcs/class/System.ServiceModel/Test/MetadataTests/ImportTests.cs
mcs/class/System.ServiceModel/Test/MetadataTests/ImportTests_LoadMetadata.cs
mcs/class/System.ServiceModel/Test/MetadataTests/MetadataSamples.cs
mcs/class/System.ServiceModel/Test/MetadataTests/MiscImportTests.cs
mcs/class/System.ServiceModel/Test/System.ServiceModel.Channels/CommunicationObjectSyncTest.cs
mcs/class/System.ServiceModel/Test/System.ServiceModel.Channels/MessageEncoderTest.cs
mcs/class/System.ServiceModel/Test/System.ServiceModel.Channels/MessageFaultTest.cs
mcs/class/System.ServiceModel/Test/System.ServiceModel.Dispatcher/DispatchOperationTest.cs
mcs/class/System.ServiceModel/xammac_net_4_5_System.ServiceModel.dll.sources
mcs/class/System.ServiceProcess/System.ServiceProcess-net_4_x.csproj
mcs/class/System.ServiceProcess/System.ServiceProcess/Win32ServiceController.cs
mcs/class/System.ServiceProcess/System.ServiceProcess_test.dll.sources
mcs/class/System.ServiceProcess/Test/System.ServiceProcess/ServiceControllerTest.cs
mcs/class/System.Threading.Tasks.Dataflow/System.Threading.Tasks.Dataflow-net_4_x.csproj
mcs/class/System.Threading.Tasks.Dataflow/System.Threading.Tasks.Dataflow_test.dll.sources
mcs/class/System.Threading.Tasks.Dataflow/Test/System.Threading.Tasks.Dataflow/BoundedCapacityTest.cs
mcs/class/System.Threading.Tasks.Dataflow/Test/System.Threading.Tasks.Dataflow/DataflowBlockTest.cs
mcs/class/System.Threading.Tasks.Dataflow/Test/System.Threading.Tasks.Dataflow/OptionsTest.cs
mcs/class/System.Threading.Tasks.Dataflow/Test/System.Threading.Tasks.Dataflow/TransformBlockTest.cs
mcs/class/System.Transactions/System.Transactions-net_4_x.csproj
mcs/class/System.Web.Abstractions/System.Web.Abstractions-net_4_x.csproj
mcs/class/System.Web.ApplicationServices/System.Web.ApplicationServices-net_4_x.csproj
mcs/class/System.Web.DynamicData/System.Web.DynamicData-net_4_x.csproj
mcs/class/System.Web.DynamicData/System.Web.DynamicData_test.dll.sources
mcs/class/System.Web.DynamicData/Test/Common/Mocks.cs [deleted file]
mcs/class/System.Web.DynamicData/Test/System.Web.DynamicData/DynamicControlTest.cs
mcs/class/System.Web.DynamicData/Test/System.Web.DynamicData/DynamicDataRouteHandlerTest.cs
mcs/class/System.Web.DynamicData/Test/System.Web.DynamicData/DynamicDataRouteTest.cs
mcs/class/System.Web.DynamicData/Test/System.Web.DynamicData/DynamicValidatorTest.cs
mcs/class/System.Web.DynamicData/Test/System.Web.DynamicData/FieldTemplateFactoryTest.cs
mcs/class/System.Web.DynamicData/Test/System.Web.DynamicData/FieldTemplateUserControlTest.cs
mcs/class/System.Web.DynamicData/Test/System.Web.DynamicData/MetaColumnTest.cs
mcs/class/System.Web.DynamicData/Test/System.Web.DynamicData/MetaModelTest.cs
mcs/class/System.Web.DynamicData/Test/System.Web.DynamicData/MetaTableTest.cs
mcs/class/System.Web.Extensions.Design/System.Web.Extensions.Design-net_4_x.csproj
mcs/class/System.Web.Extensions/System.Web.Extensions-net_4_x.csproj
mcs/class/System.Web.Http.SelfHost/System.Web.Http.SelfHost-net_4_x.csproj
mcs/class/System.Web.Http.WebHost/System.Web.Http.WebHost-net_4_x.csproj
mcs/class/System.Web.Http/System.Web.Http-net_4_x.csproj
mcs/class/System.Web.Mobile/System.Web.Mobile-net_4_x.csproj
mcs/class/System.Web.Mvc3/System.Web.Mvc3-net_4_x.csproj
mcs/class/System.Web.Razor/System.Web.Razor-net_4_x.csproj
mcs/class/System.Web.RegularExpressions/System.Web.RegularExpressions-net_4_x.csproj
mcs/class/System.Web.Routing/System.Web.Routing-net_4_x.csproj
mcs/class/System.Web.Services/System.Web.Services-net_4_x.csproj
mcs/class/System.Web.WebPages.Deployment/System.Web.WebPages.Deployment-net_4_x.csproj
mcs/class/System.Web.WebPages.Razor/System.Web.WebPages.Razor-net_4_x.csproj
mcs/class/System.Web.WebPages/System.Web.WebPages-net_4_x.csproj
mcs/class/System.Web/System.Web-net_4_x.csproj
mcs/class/System.Web/System.Web-plainweb-net_4_x.csproj
mcs/class/System.Web/System.Web.Compilation/AppResourcesAssemblyBuilder.cs
mcs/class/System.Web/System.Web.dll.sources
mcs/class/System.Web/System.Web/HttpCookie.cs
mcs/class/System.Web/System.Web_standalone_test.dll.sources
mcs/class/System.Web/System.Web_test.dll.sources
mcs/class/System.Web/Test/System.Web.Hosting/HostingEnvironmentTest.cs
mcs/class/System.Web/Test/System.Web.Security/MachineKeyTest.cs
mcs/class/System.Web/Test/System.Web.Security/MembershipPasswordAttributeTest.cs
mcs/class/System.Web/Test/System.Web.UI.WebControls.Adapters/HideDisabledControlAdapterTest.cs [changed mode: 0644->0755]
mcs/class/System.Web/Test/System.Web.UI.WebControls.Adapters/MenuAdapterTest.cs [changed mode: 0644->0755]
mcs/class/System.Web/Test/System.Web.UI.WebControls.Adapters/WebControlAdapterTest.cs [changed mode: 0644->0755]
mcs/class/System.Web/Test/System.Web.UI.WebControls/WizardTest.cs [changed mode: 0644->0755]
mcs/class/System.Web/Test/System.Web/EventHandlerTaskAsyncHelperTest.cs
mcs/class/System.Web/Test/System.Web/HttpResponseTest.cs
mcs/class/System.Web/Test/System.Web/HttpRuntimeTest.cs
mcs/class/System.Web/Test/System.Web/HttpTaskAsyncHandlerTest.cs
mcs/class/System.Web/Test/System.Web/TaskAsyncResultTest.cs
mcs/class/System.Web/Test/System.Web/XmlSiteMapProviderTest.cs
mcs/class/System.Windows.Forms.DataVisualization/System.Windows.Forms.DataVisualization-net_4_x.csproj
mcs/class/System.Windows.Forms/System.Windows.Forms-net_4_x.csproj
mcs/class/System.Windows.Forms/System.Windows.Forms.dll.sources
mcs/class/System.Windows.Forms/System.Windows.Forms/Application.cs
mcs/class/System.Windows.Forms/System.Windows.Forms/DataGrid.cs
mcs/class/System.Windows.Forms/System.Windows.Forms/Hwnd.cs
mcs/class/System.Windows.Forms/System.Windows.Forms/ListView.cs
mcs/class/System.Windows.Forms/System.Windows.Forms/ThemeVisualStyles.cs
mcs/class/System.Windows.Forms/System.Windows.Forms_test.dll.sources
mcs/class/System.Windows.Forms/Test/System.Resources/ResXDataNodeFileRefGetValueTests.cs
mcs/class/System.Windows.Forms/Test/System.Resources/ResXDataNodeSerialisedGetValueTypeNameTests.cs
mcs/class/System.Windows.Forms/Test/System.Resources/ResXDataNodeSerializedGetValueTests.cs
mcs/class/System.Windows.Forms/Test/System.Resources/ResXDataNodeTest.cs
mcs/class/System.Windows.Forms/Test/System.Resources/ResXDataNodeWriteBehavior.cs
mcs/class/System.Windows.Forms/Test/System.Windows.Forms/ApplicationTest.cs
mcs/class/System.Windows.Forms/Test/System.Windows.Forms/ListViewTest.cs
mcs/class/System.Windows.Forms/Test/System.Windows.Forms/TableLayoutTest.cs
mcs/class/System.Windows/AssemblyInfo.cs
mcs/class/System.Windows/System.Windows-net_4_x.csproj
mcs/class/System.Workflow.Activities/System.Workflow.Activities-net_4_x.csproj
mcs/class/System.Workflow.ComponentModel/System.Workflow.ComponentModel-net_4_x.csproj
mcs/class/System.Workflow.Runtime/System.Workflow.Runtime-net_4_x.csproj
mcs/class/System.XML/Assembly/AssemblyInfo.cs
mcs/class/System.XML/Makefile
mcs/class/System.XML/System.Xml-bare-net_4_x.csproj
mcs/class/System.XML/System.Xml-net_4_x.csproj
mcs/class/System.XML/System.Xml.Serialization/TypeData.cs
mcs/class/System.XML/System.Xml.Serialization/XmlChoiceIdentifierAttribute.cs
mcs/class/System.XML/System.Xml.Serialization/XmlCustomFormatter.cs
mcs/class/System.XML/System.Xml.Serialization/XmlMemberMapping.cs
mcs/class/System.XML/System.Xml.Serialization/XmlReflectionImporter.cs
mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReader.cs
mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReaderInterpreter.cs
mcs/class/System.XML/System.Xml.Serialization/XmlSerializer.cs
mcs/class/System.XML/System.Xml.Serialization/XmlSerializerFactory.cs
mcs/class/System.XML/System.Xml.Xsl/XslCompiledTransform_Mobile.cs
mcs/class/System.XML/Test/System.Xml.Serialization/DeserializeTests.cs
mcs/class/System.XML/Test/System.Xml.Serialization/XmlCodeExporterTests.cs
mcs/class/System.XML/Test/System.Xml.Serialization/XmlReflectionImporterTests.cs [changed mode: 0644->0755]
mcs/class/System.XML/Test/System.Xml.Serialization/XmlSerializerTestClasses.cs
mcs/class/System.XML/Test/System.Xml.Serialization/XmlSerializerTests.cs
mcs/class/System.XML/Test/System.Xml/XmlReaderCommonTests.cs
mcs/class/System.XML/Test/System.Xml/XmlReaderSettingsTests.cs
mcs/class/System.XML/Test/System.Xml/XmlResolverTest.cs
mcs/class/System.XML/Test/System.Xml/XmlSecureResolverTests.cs
mcs/class/System.XML/Test/System.Xml/XmlUrlResolverTests.cs
mcs/class/System.XML/Test/System.Xml/XmlWriterSettingsTests.cs
mcs/class/System.Xaml/Assembly/AssemblyInfo.cs
mcs/class/System.Xaml/System.Xaml-net_4_x.csproj
mcs/class/System.Xaml/System.Xaml/TypeExtensionMethods.cs
mcs/class/System.Xml.Linq/Assembly/AssemblyInfo.cs
mcs/class/System.Xml.Linq/System.Xml.Linq-net_4_x.csproj
mcs/class/System.Xml.Linq/System.Xml.Linq_test.dll.sources
mcs/class/System.Xml.Linq/Test/System.Xml.Linq/XElementTest.cs
mcs/class/System.Xml.Linq/Test/System.Xml.Schema/ExtensionsTest.cs
mcs/class/System.Xml.Serialization/AssemblyInfo.cs
mcs/class/System.Xml.Serialization/System.Xml.Serialization-net_4_x.csproj
mcs/class/System/Assembly/AssemblyInfo.cs
mcs/class/System/Makefile
mcs/class/System/Microsoft.CSharp/CSharpCodeCompiler.cs
mcs/class/System/Microsoft.VisualBasic/VBCodeCompiler.cs
mcs/class/System/Microsoft.Win32.SafeHandles/SafeX509ChainHandle.cs
mcs/class/System/Mono.Btls/MonoBtlsBio.cs [new file with mode: 0644]
mcs/class/System/Mono.Btls/MonoBtlsContext.cs [new file with mode: 0644]
mcs/class/System/Mono.Btls/MonoBtlsError.cs [new file with mode: 0644]
mcs/class/System/Mono.Btls/MonoBtlsException.cs [new file with mode: 0644]
mcs/class/System/Mono.Btls/MonoBtlsKey.cs [new file with mode: 0644]
mcs/class/System/Mono.Btls/MonoBtlsObject.cs [new file with mode: 0644]
mcs/class/System/Mono.Btls/MonoBtlsPkcs12.cs [new file with mode: 0644]
mcs/class/System/Mono.Btls/MonoBtlsProvider.cs [new file with mode: 0644]
mcs/class/System/Mono.Btls/MonoBtlsSsl.cs [new file with mode: 0644]
mcs/class/System/Mono.Btls/MonoBtlsSslCtx.cs [new file with mode: 0644]
mcs/class/System/Mono.Btls/MonoBtlsSslError.cs [new file with mode: 0644]
mcs/class/System/Mono.Btls/MonoBtlsStream.cs [new file with mode: 0644]
mcs/class/System/Mono.Btls/MonoBtlsUtils.cs [new file with mode: 0644]
mcs/class/System/Mono.Btls/MonoBtlsX509.cs [new file with mode: 0644]
mcs/class/System/Mono.Btls/MonoBtlsX509Chain.cs [new file with mode: 0644]
mcs/class/System/Mono.Btls/MonoBtlsX509Crl.cs [new file with mode: 0644]
mcs/class/System/Mono.Btls/MonoBtlsX509Error.cs [new file with mode: 0644]
mcs/class/System/Mono.Btls/MonoBtlsX509Exception.cs [new file with mode: 0644]
mcs/class/System/Mono.Btls/MonoBtlsX509FileType.cs [new file with mode: 0644]
mcs/class/System/Mono.Btls/MonoBtlsX509Format.cs [new file with mode: 0644]
mcs/class/System/Mono.Btls/MonoBtlsX509Lookup.cs [new file with mode: 0644]
mcs/class/System/Mono.Btls/MonoBtlsX509LookupAndroid.cs [new file with mode: 0644]
mcs/class/System/Mono.Btls/MonoBtlsX509LookupMono.cs [new file with mode: 0644]
mcs/class/System/Mono.Btls/MonoBtlsX509LookupMonoCollection.cs [new file with mode: 0644]
mcs/class/System/Mono.Btls/MonoBtlsX509LookupType.cs [new file with mode: 0644]
mcs/class/System/Mono.Btls/MonoBtlsX509Name.cs [new file with mode: 0644]
mcs/class/System/Mono.Btls/MonoBtlsX509NameEntryType.cs [new file with mode: 0644]
mcs/class/System/Mono.Btls/MonoBtlsX509Purpose.cs [new file with mode: 0644]
mcs/class/System/Mono.Btls/MonoBtlsX509Revoked.cs [new file with mode: 0644]
mcs/class/System/Mono.Btls/MonoBtlsX509Store.cs [new file with mode: 0644]
mcs/class/System/Mono.Btls/MonoBtlsX509StoreCtx.cs [new file with mode: 0644]
mcs/class/System/Mono.Btls/MonoBtlsX509StoreManager.cs [new file with mode: 0644]
mcs/class/System/Mono.Btls/MonoBtlsX509StoreType.cs [new file with mode: 0644]
mcs/class/System/Mono.Btls/MonoBtlsX509TrustKind.cs [new file with mode: 0644]
mcs/class/System/Mono.Btls/MonoBtlsX509VerifyFlags.cs [new file with mode: 0644]
mcs/class/System/Mono.Btls/MonoBtlsX509VerifyParam.cs [new file with mode: 0644]
mcs/class/System/Mono.Btls/X509CertificateImplBtls.cs [new file with mode: 0644]
mcs/class/System/Mono.Btls/X509ChainImplBtls.cs [new file with mode: 0644]
mcs/class/System/Mono.Net.Security/AsyncProtocolRequest.cs
mcs/class/System/Mono.Net.Security/ChainValidationHelper.cs
mcs/class/System/Mono.Net.Security/IMonoTlsProvider.cs
mcs/class/System/Mono.Net.Security/LegacySslStream.cs
mcs/class/System/Mono.Net.Security/LegacyTlsProvider.cs [new file with mode: 0644]
mcs/class/System/Mono.Net.Security/MobileAuthenticatedStream.cs
mcs/class/System/Mono.Net.Security/MobileTlsContext.cs
mcs/class/System/Mono.Net.Security/MonoLegacyTlsProvider.cs [deleted file]
mcs/class/System/Mono.Net.Security/MonoTlsProviderFactory.Droid.cs
mcs/class/System/Mono.Net.Security/MonoTlsProviderFactory.cs
mcs/class/System/Mono.Net.Security/MonoTlsProviderImpl.cs [deleted file]
mcs/class/System/Mono.Net.Security/MonoTlsProviderWrapper.cs
mcs/class/System/Mono.Net.Security/MonoTlsStream.cs
mcs/class/System/Mono.Net.Security/NoReflectionHelper.cs
mcs/class/System/Mono.Net.Security/SystemCertificateValidator.cs
mcs/class/System/ReferenceSources/AutoWebProxyScriptEngine.cs
mcs/class/System/ReferenceSources/CAPI.cs
mcs/class/System/ReferenceSources/HttpApi.cs
mcs/class/System/ReferenceSources/Internal.cs [deleted file]
mcs/class/System/ReferenceSources/Logging.cs
mcs/class/System/ReferenceSources/SSPIConfiguration.cs [deleted file]
mcs/class/System/ReferenceSources/SSPISafeHandles.cs [deleted file]
mcs/class/System/ReferenceSources/SSPIWrapper.cs [deleted file]
mcs/class/System/ReferenceSources/SecureStringHelper.cs [new file with mode: 0644]
mcs/class/System/ReferenceSources/SettingsSectionInternal.cs
mcs/class/System/ReferenceSources/Socket.cs
mcs/class/System/ReferenceSources/SslStream.cs [deleted file]
mcs/class/System/ReferenceSources/_SecureChannel.cs [deleted file]
mcs/class/System/ReferenceSources/_SslState.cs [deleted file]
mcs/class/System/ReferenceSources/_SslStream.cs [deleted file]
mcs/class/System/System-bare-net_4_x.csproj
mcs/class/System/System-net_4_x.csproj
mcs/class/System/System-secxml-net_4_x.csproj
mcs/class/System/System.CodeDom.Compiler/CodeDomProvider.cs
mcs/class/System/System.CodeDom.Compiler/TempFileCollection.cs
mcs/class/System/System.Configuration/AppSettingsReader.cs
mcs/class/System/System.Configuration/ConfigHelper.cs
mcs/class/System/System.Configuration/ConfigXmlDocument.cs
mcs/class/System/System.Configuration/ConfigurationSettings.cs
mcs/class/System/System.Configuration/NameValueFileSectionHandler.cs
mcs/class/System/System.Configuration/SingleTagSectionHandler.cs
mcs/class/System/System.Diagnostics.CodeAnalysis/ExcludeFromCodeCoverageAttribute.cs [deleted file]
mcs/class/System/System.Diagnostics/EventLog.cs
mcs/class/System/System.Diagnostics/FileVersionInfo.cs
mcs/class/System/System.Diagnostics/PerformanceCounter.cs
mcs/class/System/System.Diagnostics/Process.cs
mcs/class/System/System.Diagnostics/ProcessModuleCollection.cs [deleted file]
mcs/class/System/System.Diagnostics/ProcessThreadCollection.cs [deleted file]
mcs/class/System/System.Diagnostics/Win32EventLog.cs
mcs/class/System/System.IO.Compression/DeflateStream.cs
mcs/class/System/System.IO.Compression/GZipStream.cs
mcs/class/System/System.IO/FileSystemWatcher.cs
mcs/class/System/System.IO/FileSystemWatcher_mobile.cs
mcs/class/System/System.Net.Configuration/ConnectionManagementHandler.cs
mcs/class/System/System.Net.Configuration/WebRequestModuleHandler.cs
mcs/class/System/System.Net.Mail/MailMessage.cs
mcs/class/System/System.Net.Mail/SmtpClient.platformnotsupported.cs [new file with mode: 0644]
mcs/class/System/System.Net.NetworkInformation/IPAddressCollection.cs
mcs/class/System/System.Net.NetworkInformation/IPGlobalProperties.cs
mcs/class/System/System.Net.NetworkInformation/IPInterfaceProperties.cs
mcs/class/System/System.Net.NetworkInformation/NetworkInterface.cs
mcs/class/System/System.Net.NetworkInformation/Ping.cs
mcs/class/System/System.Net.NetworkInformation/UnicastIPAddressInformation.cs
mcs/class/System/System.Net.Security/EncryptionPolicy.cs
mcs/class/System/System.Net.Security/LocalCertificateSelectionCallback.cs
mcs/class/System/System.Net.Security/NegotiateStream.cs
mcs/class/System/System.Net.Security/RemoteCertificateValidationCallback.cs
mcs/class/System/System.Net.Security/SslPolicyErrors.cs
mcs/class/System/System.Net.Security/SslStream.cs
mcs/class/System/System.Net.Security/SslStream.platformnotsupported.cs [new file with mode: 0644]
mcs/class/System/System.Net.Sockets/SendPacketsElement.cs [deleted file]
mcs/class/System/System.Net.Sockets/Socket.cs
mcs/class/System/System.Net.Sockets/SocketAsyncEventArgs.cs
mcs/class/System/System.Net.Sockets/SocketAsyncOperation.cs [deleted file]
mcs/class/System/System.Net.Sockets/SocketAsyncResult.cs
mcs/class/System/System.Net.Sockets/SocketReceiveFromResult.cs [new file with mode: 0644]
mcs/class/System/System.Net.Sockets/SocketReceiveMessageFromResult.cs [new file with mode: 0644]
mcs/class/System/System.Net.Sockets/SocketTaskExtensions.cs [new file with mode: 0644]
mcs/class/System/System.Net.Sockets/TcpClient.cs [deleted file]
mcs/class/System/System.Net.Sockets/TcpClient.platformnotsupported.cs [new file with mode: 0644]
mcs/class/System/System.Net.Sockets/TcpListener.cs [deleted file]
mcs/class/System/System.Net.Sockets/TcpListener.platformnotsupported.cs [new file with mode: 0644]
mcs/class/System/System.Net.Sockets/UdpClient.cs [deleted file]
mcs/class/System/System.Net.Sockets/UdpClient.platformnotsupported.cs [new file with mode: 0644]
mcs/class/System/System.Net.WebSockets/ClientWebSocket.platformnotsupported.cs [new file with mode: 0644]
mcs/class/System/System.Net/AuthenticationManager.cs
mcs/class/System/System.Net/AuthenticationManager.platformnotsupported.cs [new file with mode: 0644]
mcs/class/System/System.Net/Dns.cs
mcs/class/System/System.Net/FtpRequestCreator.platformnotsupported.cs [new file with mode: 0644]
mcs/class/System/System.Net/FtpWebRequest.cs
mcs/class/System/System.Net/FtpWebRequest.platformnotsupported.cs [new file with mode: 0644]
mcs/class/System/System.Net/FtpWebResponse.platformnotsupported.cs [new file with mode: 0644]
mcs/class/System/System.Net/HttpListener.cs
mcs/class/System/System.Net/HttpListener.platformnotsupported.cs [new file with mode: 0644]
mcs/class/System/System.Net/HttpListenerContext.cs
mcs/class/System/System.Net/HttpListenerContext.platformnotsupported.cs [new file with mode: 0644]
mcs/class/System/System.Net/HttpListenerPrefixCollection.platformnotsupported.cs [new file with mode: 0644]
mcs/class/System/System.Net/HttpListenerRequest.cs
mcs/class/System/System.Net/HttpListenerRequest.platformnotsupported.cs [new file with mode: 0644]
mcs/class/System/System.Net/HttpListenerResponse.cs
mcs/class/System/System.Net/HttpListenerResponse.platformnotsupported.cs [new file with mode: 0644]
mcs/class/System/System.Net/HttpListenerResponseHelper.cs [new file with mode: 0644]
mcs/class/System/System.Net/HttpListenerTimeoutManager.cs
mcs/class/System/System.Net/HttpWebRequest.cs
mcs/class/System/System.Net/HttpWebRequest.platformnotsupported.cs [new file with mode: 0644]
mcs/class/System/System.Net/HttpWebResponse.cs
mcs/class/System/System.Net/HttpWebResponse.platformnotsupported.cs [new file with mode: 0644]
mcs/class/System/System.Net/NetworkCredential.cs [deleted file]
mcs/class/System/System.Net/ResponseStream.cs
mcs/class/System/System.Net/ServicePoint.platformnotsupported.cs [new file with mode: 0644]
mcs/class/System/System.Net/ServicePointManager.cs
mcs/class/System/System.Net/ServicePointManager.platformnotsupported.cs [new file with mode: 0644]
mcs/class/System/System.Net/SimpleAsyncResult.cs
mcs/class/System/System.Net/WebConnection.cs
mcs/class/System/System.Net/WebConnectionStream.cs
mcs/class/System/System.Security.AccessControl/SemaphoreAccessRule.cs
mcs/class/System/System.Security.AccessControl/SemaphoreAuditRule.cs
mcs/class/System/System.Security.AccessControl/SemaphoreSecurity.cs
mcs/class/System/System.Security.Authentication.ExtendedProtection/ServiceNameCollection.cs [deleted file]
mcs/class/System/System.Security.Cryptography.X509Certificates/OSX509Certificates.cs
mcs/class/System/System.Security.Cryptography.X509Certificates/X500DistinguishedName.cs
mcs/class/System/System.Security.Cryptography.X509Certificates/X509Certificate2.cs
mcs/class/System/System.Security.Cryptography.X509Certificates/X509Certificate2Impl.cs
mcs/class/System/System.Security.Cryptography.X509Certificates/X509Certificate2ImplMono.cs
mcs/class/System/System.Security.Cryptography.X509Certificates/X509Chain.cs
mcs/class/System/System.Security.Cryptography.X509Certificates/X509ChainPolicy.cs
mcs/class/System/System.Security.Cryptography.X509Certificates/X509Helper2.cs
mcs/class/System/System.Security.Cryptography.X509Certificates/X509KeyUsageExtension.cs
mcs/class/System/System.Security.Cryptography.X509Certificates/X509SubjectKeyIdentifierExtension.cs
mcs/class/System/System.dll.sources
mcs/class/System/System/AndroidPlatform.cs
mcs/class/System/System/MonoToolsLocator.cs [new file with mode: 0755]
mcs/class/System/System/UriTypeConverter.cs
mcs/class/System/System_test.dll.sources
mcs/class/System/Test/System.CodeDom.Compiler/CodeGeneratorGenerateFromCompileUnitTest.cs
mcs/class/System/Test/System.Collections.Generic/SortedListTest.cs
mcs/class/System/Test/System.ComponentModel/CategoryAttributeTests.cs
mcs/class/System/Test/System.Diagnostics/EventLogTest.cs
mcs/class/System/Test/System.Diagnostics/ProcessTest.cs
mcs/class/System/Test/System.Diagnostics/SourceSwitchTest.cs
mcs/class/System/Test/System.Diagnostics/SwitchesTest.cs
mcs/class/System/Test/System.IO.Compression/DeflateStreamTest.cs
mcs/class/System/Test/System.IO.Compression/GzipStreamTest.cs
mcs/class/System/Test/System.Net.Mail/SmtpClientTest.cs
mcs/class/System/Test/System.Net.NetworkInformation/IPInterfacePropertiesTest.cs
mcs/class/System/Test/System.Net.Security/SslStreamTest.cs
mcs/class/System/Test/System.Net.Sockets/NetworkStreamTest.cs
mcs/class/System/Test/System.Net.Sockets/SocketAcceptAsyncTest.cs
mcs/class/System/Test/System.Net.Sockets/SocketAsyncEventArgsTest.cs
mcs/class/System/Test/System.Net.Sockets/SocketAsyncTest.cs
mcs/class/System/Test/System.Net.Sockets/SocketTest.cs
mcs/class/System/Test/System.Net.Sockets/TcpClientTest.cs
mcs/class/System/Test/System.Net.Sockets/TcpListenerTest.cs
mcs/class/System/Test/System.Net.Sockets/UdpClientTest.cs
mcs/class/System/Test/System.Net.WebSockets/ClientWebSocketTest.cs
mcs/class/System/Test/System.Net/CookieParserTest.cs
mcs/class/System/Test/System.Net/DnsTest.cs
mcs/class/System/Test/System.Net/FileWebRequestTest.cs
mcs/class/System/Test/System.Net/FtpWebRequestTest.cs
mcs/class/System/Test/System.Net/HttpListener2Test.cs
mcs/class/System/Test/System.Net/HttpListenerPrefixCollectionTest.cs
mcs/class/System/Test/System.Net/HttpListenerRequestTest.cs
mcs/class/System/Test/System.Net/HttpListenerTest.cs
mcs/class/System/Test/System.Net/HttpWebRequestTest.cs
mcs/class/System/Test/System.Net/HttpWebResponseTest.cs
mcs/class/System/Test/System.Net/NetworkCredentialTest.cs
mcs/class/System/Test/System.Net/ServicePointManagerTest.cs
mcs/class/System/Test/System.Net/ServicePointTest.cs
mcs/class/System/Test/System.Net/WebClientTest.cs
mcs/class/System/Test/System.Net/WebClientTestAsync.cs
mcs/class/System/Test/System.Net/WebHeaderCollectionTest.cs
mcs/class/System/Test/System.Net/WebRequestTest.cs
mcs/class/System/Test/System.Security.Cryptography.X509Certificates/PkitsTest.cs
mcs/class/System/Test/System/UriPermutationsTest.cs
mcs/class/System/Test/System/UriTest.cs
mcs/class/System/Test/System/UriTest3.cs
mcs/class/System/Test/compressed.bin [new file with mode: 0644]
mcs/class/System/Test/test-config-file
mcs/class/System/Test/test-config-file-net-2.0 [deleted file]
mcs/class/System/mobile_System.dll.sources
mcs/class/System/monodroid_System.dll.sources
mcs/class/System/monotouch_watch_System.dll.exclude.sources [new file with mode: 0644]
mcs/class/System/monotouch_watch_System.dll.sources
mcs/class/System/monotouch_watch_runtime_System.dll.exclude.sources [new file with mode: 0644]
mcs/class/System/monotouch_watch_runtime_System.dll.sources
mcs/class/SystemWebTestShim/SystemWebTestShim-net_4_x.csproj
mcs/class/WebMatrix.Data/WebMatrix.Data-net_4_x.csproj
mcs/class/WebMatrix.Data/WebMatrix.Data_test.dll.sources
mcs/class/WindowsBase/System.IO.Packaging/Package.cs [changed mode: 0644->0755]
mcs/class/WindowsBase/Test/System.Windows/RectTest.cs
mcs/class/WindowsBase/WindowsBase-net_4_x.csproj
mcs/class/WindowsBase/WindowsBase.dll.sources
mcs/class/WindowsBase/WindowsBase_test.dll.sources
mcs/class/WindowsBase/ZipSharp/IOFunctions.cs
mcs/class/WindowsBase/ZipSharp/NativeUnzip.cs
mcs/class/WindowsBase/ZipSharp/NativeVersion.cs [new file with mode: 0755]
mcs/class/WindowsBase/ZipSharp/NativeZip.cs
mcs/class/WindowsBase/ZipSharp/UnzipArchive.cs
mcs/class/WindowsBase/ZipSharp/UnzipFileInfo.cs
mcs/class/WindowsBase/ZipSharp/UnzipReadStream.cs
mcs/class/WindowsBase/ZipSharp/ZipArchive.cs
mcs/class/WindowsBase/ZipSharp/ZipFileInfo.cs
mcs/class/WindowsBase/ZipSharp/ZipStream.cs
mcs/class/aot-compiler/Makefile
mcs/class/corlib/Assembly/AssemblyInfo.cs
mcs/class/corlib/CommonCrypto/SecRandom.cs
mcs/class/corlib/Documentation/s [deleted file]
mcs/class/corlib/Makefile
mcs/class/corlib/Microsoft.Win32/IRegistryApi.cs
mcs/class/corlib/Microsoft.Win32/RegistryKeyPermissionCheck.cs
mcs/class/corlib/Microsoft.Win32/UnixRegistryApi.cs
mcs/class/corlib/Microsoft.Win32/Win32RegistryApi.cs
mcs/class/corlib/Microsoft.Win32/Win32ResultCode.cs
mcs/class/corlib/Mono.Security/Uri.cs
mcs/class/corlib/Mono/Runtime.cs
mcs/class/corlib/Mono/RuntimeStructs.cs
mcs/class/corlib/ReferenceSources/AppContextSwitches.cs
mcs/class/corlib/ReferenceSources/BinaryCompatibility.cs [new file with mode: 0644]
mcs/class/corlib/ReferenceSources/CompatibilitySwitches.cs
mcs/class/corlib/ReferenceSources/RuntimeType.cs
mcs/class/corlib/ReferenceSources/SharedStatics.cs [deleted file]
mcs/class/corlib/ReferenceSources/String.cs
mcs/class/corlib/ReferenceSources/Type.cs
mcs/class/corlib/ReferenceSources/TypeBuilderInstantiation.cs [deleted file]
mcs/class/corlib/System.Diagnostics.Tracing/EventCounter.cs [new file with mode: 0644]
mcs/class/corlib/System.Diagnostics.Tracing/EventSource.cs
mcs/class/corlib/System.Diagnostics.Tracing/EventSourceException.cs [deleted file]
mcs/class/corlib/System.Diagnostics/StackFrame.cs
mcs/class/corlib/System.Diagnostics/StackTrace.cs
mcs/class/corlib/System.Globalization/CultureInfo.cs
mcs/class/corlib/System.IO/Directory.cs
mcs/class/corlib/System.IO/DirectoryInfo.cs
mcs/class/corlib/System.IO/File.cs
mcs/class/corlib/System.IO/FileStream.cs
mcs/class/corlib/System.IO/MonoIO.cs
mcs/class/corlib/System.IO/MonoIOError.cs
mcs/class/corlib/System.IO/Path.cs
mcs/class/corlib/System.Reflection.Emit/AssemblyBuilder.cs
mcs/class/corlib/System.Reflection.Emit/AssemblyBuilder.pns.cs [new file with mode: 0644]
mcs/class/corlib/System.Reflection.Emit/AssemblyBuilderAccess.cs
mcs/class/corlib/System.Reflection.Emit/ConstructorBuilder.cs
mcs/class/corlib/System.Reflection.Emit/ConstructorBuilder.pns.cs [new file with mode: 0644]
mcs/class/corlib/System.Reflection.Emit/ConstructorOnTypeBuilderInst.cs
mcs/class/corlib/System.Reflection.Emit/CustomAttributeBuilder.pns.cs [new file with mode: 0644]
mcs/class/corlib/System.Reflection.Emit/DerivedTypes.cs
mcs/class/corlib/System.Reflection.Emit/EnumBuilder.cs
mcs/class/corlib/System.Reflection.Emit/EnumBuilder.pns.cs [new file with mode: 0644]
mcs/class/corlib/System.Reflection.Emit/EventBuilder.pns.cs [new file with mode: 0644]
mcs/class/corlib/System.Reflection.Emit/EventOnTypeBuilderInst.cs
mcs/class/corlib/System.Reflection.Emit/FieldBuilder.cs
mcs/class/corlib/System.Reflection.Emit/FieldBuilder.pns.cs [new file with mode: 0644]
mcs/class/corlib/System.Reflection.Emit/FieldOnTypeBuilderInst.cs
mcs/class/corlib/System.Reflection.Emit/GenericTypeParameterBuilder.cs
mcs/class/corlib/System.Reflection.Emit/GenericTypeParameterBuilder.pns.cs [new file with mode: 0644]
mcs/class/corlib/System.Reflection.Emit/ILGenerator.cs
mcs/class/corlib/System.Reflection.Emit/ILGenerator.pns.cs [new file with mode: 0644]
mcs/class/corlib/System.Reflection.Emit/Label.cs
mcs/class/corlib/System.Reflection.Emit/LocalBuilder.cs
mcs/class/corlib/System.Reflection.Emit/MethodBuilder.cs
mcs/class/corlib/System.Reflection.Emit/MethodBuilder.pns.cs [new file with mode: 0644]
mcs/class/corlib/System.Reflection.Emit/MethodOnTypeBuilderInst.cs
mcs/class/corlib/System.Reflection.Emit/ModuleBuilder.cs
mcs/class/corlib/System.Reflection.Emit/ModuleBuilder.pns.cs [new file with mode: 0644]
mcs/class/corlib/System.Reflection.Emit/ParameterBuilder.pns.cs [new file with mode: 0644]
mcs/class/corlib/System.Reflection.Emit/PropertyBuilder.pns.cs [new file with mode: 0644]
mcs/class/corlib/System.Reflection.Emit/PropertyOnTypeBuilderInst.cs
mcs/class/corlib/System.Reflection.Emit/SignatureHelper.cs
mcs/class/corlib/System.Reflection.Emit/SignatureHelper.pns.cs [new file with mode: 0644]
mcs/class/corlib/System.Reflection.Emit/TypeBuilder.cs
mcs/class/corlib/System.Reflection.Emit/TypeBuilder.pns.cs [new file with mode: 0644]
mcs/class/corlib/System.Reflection.Emit/TypeBuilderInstantiation.cs [new file with mode: 0644]
mcs/class/corlib/System.Reflection.Emit/UnmanagedMarshal.cs
mcs/class/corlib/System.Reflection/Assembly.cs
mcs/class/corlib/System.Reflection/AssemblyName.cs
mcs/class/corlib/System.Reflection/EventInfo.cs
mcs/class/corlib/System.Reflection/MonoGenericClass.cs [deleted file]
mcs/class/corlib/System.Reflection/MonoGenericMethod.cs [deleted file]
mcs/class/corlib/System.Reflection/MonoMethod.cs
mcs/class/corlib/System.Reflection/MonoModule.cs
mcs/class/corlib/System.Reflection/MonoProperty.cs
mcs/class/corlib/System.Reflection/StrongNameKeyPair.cs
mcs/class/corlib/System.Reflection/TargetException.cs [deleted file]
mcs/class/corlib/System.Reflection/TargetInvocationException.cs [deleted file]
mcs/class/corlib/System.Reflection/TargetParameterCountException.cs [deleted file]
mcs/class/corlib/System.Runtime.CompilerServices/ConditionalWeakTable.cs
mcs/class/corlib/System.Runtime.InteropServices.WindowsRuntime/DefaultInterfaceAttribute.cs [deleted file]
mcs/class/corlib/System.Runtime.InteropServices.WindowsRuntime/EventRegistrationToken.cs [deleted file]
mcs/class/corlib/System.Runtime.InteropServices.WindowsRuntime/EventRegistrationTokenTable.cs [deleted file]
mcs/class/corlib/System.Runtime.InteropServices.WindowsRuntime/IActivationFactory.cs [deleted file]
mcs/class/corlib/System.Runtime.InteropServices.WindowsRuntime/InterfaceImplementedInVersionAttribute.cs [deleted file]
mcs/class/corlib/System.Runtime.InteropServices.WindowsRuntime/ReadOnlyArrayAttribute.cs [deleted file]
mcs/class/corlib/System.Runtime.InteropServices.WindowsRuntime/ReturnValueNameAttribute.cs [deleted file]
mcs/class/corlib/System.Runtime.InteropServices.WindowsRuntime/UnsafeNativeMethods.cs [new file with mode: 0644]
mcs/class/corlib/System.Runtime.InteropServices.WindowsRuntime/WindowsRuntimeMarshal.cs [deleted file]
mcs/class/corlib/System.Runtime.InteropServices.WindowsRuntime/WriteOnlyArrayAttribute.cs [deleted file]
mcs/class/corlib/System.Runtime.InteropServices/Marshal.cs
mcs/class/corlib/System.Runtime.InteropServices/SafeHandle.cs
mcs/class/corlib/System.Runtime.InteropServices/_Assembly.cs
mcs/class/corlib/System.Runtime.Loader/AssemblyLoadContext.cs
mcs/class/corlib/System.Runtime.Remoting.Activation/ActivationServices.cs
mcs/class/corlib/System.Runtime.Remoting.Messaging/CADMessages.cs
mcs/class/corlib/System.Runtime.Remoting/RemotingConfiguration.cs
mcs/class/corlib/System.Runtime.Remoting/RemotingServices.cs
mcs/class/corlib/System.Runtime/GCLatencyMode.cs
mcs/class/corlib/System.Security.AccessControl/EventWaitHandleSecurity.cs
mcs/class/corlib/System.Security.AccessControl/NativeObjectSecurity.cs
mcs/class/corlib/System.Security.Cryptography.X509Certificates/X509Certificate.cs
mcs/class/corlib/System.Security.Cryptography.X509Certificates/X509ContentType.cs
mcs/class/corlib/System.Security.Cryptography.X509Certificates/X509Helper.cs
mcs/class/corlib/System.Security.Cryptography.X509Certificates/X509KeyStorageFlags.cs
mcs/class/corlib/System.Security.Cryptography/CryptoConfig.common.cs [new file with mode: 0644]
mcs/class/corlib/System.Security.Cryptography/CryptoConfig.cs
mcs/class/corlib/System.Security.Cryptography/CryptoConfig.fullaot.cs
mcs/class/corlib/System.Security.Cryptography/CryptoConfig_2_1.cs [deleted file]
mcs/class/corlib/System.Security.Cryptography/IncrementalHash.cs [new file with mode: 0644]
mcs/class/corlib/System.Security.Cryptography/RNGCryptoServiceProvider.cs
mcs/class/corlib/System.Security.Permissions/CodeAccessSecurityAttribute.cs
mcs/class/corlib/System.Security.Permissions/EnvironmentPermissionAttribute.cs
mcs/class/corlib/System.Security.Permissions/FileIOPermissionAttribute.cs
mcs/class/corlib/System.Security.Permissions/HostProtectionAttribute.cs
mcs/class/corlib/System.Security.Permissions/PermissionSetAttribute.cs
mcs/class/corlib/System.Security.Permissions/ReflectionPermissionAttribute.cs
mcs/class/corlib/System.Security.Permissions/SecurityAction.cs
mcs/class/corlib/System.Security.Permissions/SecurityAttribute.cs
mcs/class/corlib/System.Security.Permissions/SecurityPermissionAttribute.cs
mcs/class/corlib/System.Security.Permissions/SecurityPermissionFlag.cs
mcs/class/corlib/System.Security.Permissions/StrongNamePermissionAttribute.cs
mcs/class/corlib/System.Security.Policy/Evidence.cs
mcs/class/corlib/System.Security.Policy/Evidence_2_1.cs
mcs/class/corlib/System.Security.Policy/Zone.cs
mcs/class/corlib/System.Security/PermissionSet.cs
mcs/class/corlib/System.Security/SecurityManager.cs
mcs/class/corlib/System.Text/Latin1Encoding.cs
mcs/class/corlib/System.Threading/EventWaitHandle.cs [deleted file]
mcs/class/corlib/System.Threading/Mutex.cs
mcs/class/corlib/System.Threading/NativeEventCalls.cs
mcs/class/corlib/System.Threading/Thread.cs
mcs/class/corlib/System/AppDomain.cs
mcs/class/corlib/System/AppDomainManager_2_1.cs
mcs/class/corlib/System/AppDomainSetup.cs
mcs/class/corlib/System/CStreamReader.cs
mcs/class/corlib/System/CStreamWriter.cs
mcs/class/corlib/System/Console.cs
mcs/class/corlib/System/ConsoleDriver.cs
mcs/class/corlib/System/Environment.cs
mcs/class/corlib/System/GC.cs [deleted file]
mcs/class/corlib/System/GCCollectionMode.cs [deleted file]
mcs/class/corlib/System/GCNotificationStatus.cs [deleted file]
mcs/class/corlib/System/NullConsoleDriver.cs
mcs/class/corlib/System/Nullable.cs
mcs/class/corlib/System/TermInfoDriver.cs
mcs/class/corlib/System/TermInfoNumbers.cs
mcs/class/corlib/System/TermInfoReader.cs
mcs/class/corlib/System/TermInfoStrings.cs
mcs/class/corlib/System/TimeZoneInfo.Android.cs
mcs/class/corlib/System/TimeZoneInfo.cs
mcs/class/corlib/System/TypeSpec.cs
mcs/class/corlib/System/WeakReference.cs
mcs/class/corlib/System/WindowsConsoleDriver.cs
mcs/class/corlib/System/_AppDomain.cs
mcs/class/corlib/Test/Microsoft.Win32/RegistryKeyTest.cs
mcs/class/corlib/Test/Mono/DataConvertTest.cs
mcs/class/corlib/Test/System.Collections.Concurrent/ConcurrentDictionaryTests.cs
mcs/class/corlib/Test/System.Collections.Concurrent/PartitionerTests.cs
mcs/class/corlib/Test/System.Collections.Generic/ComparerTest.cs
mcs/class/corlib/Test/System.Globalization/CultureInfoTest.cs
mcs/class/corlib/Test/System.IO.IsolatedStorage/IsolatedStorageFileStreamTest.cs
mcs/class/corlib/Test/System.IO.IsolatedStorage/IsolatedStorageFileTest.cs
mcs/class/corlib/Test/System.IO/DirectoryInfoTest.cs
mcs/class/corlib/Test/System.IO/FileInfoTest.cs
mcs/class/corlib/Test/System.IO/FileStreamSafeHandleTest.cs
mcs/class/corlib/Test/System.IO/FileStreamTest.cs
mcs/class/corlib/Test/System.IO/MemoryStreamTest.cs
mcs/class/corlib/Test/System.IO/PathTest.cs
mcs/class/corlib/Test/System.IO/StreamReaderTest.cs
mcs/class/corlib/Test/System.IO/StreamTest.cs
mcs/class/corlib/Test/System.IO/StreamWriterTest.cs
mcs/class/corlib/Test/System.Reflection.Emit/AssemblyBuilderTest.cs
mcs/class/corlib/Test/System.Reflection.Emit/MethodBuilderTest.cs
mcs/class/corlib/Test/System.Reflection.Emit/ModuleBuilderTest.cs
mcs/class/corlib/Test/System.Reflection.Emit/TypeBuilderTest.cs
mcs/class/corlib/Test/System.Reflection/AssemblyNameTest.cs
mcs/class/corlib/Test/System.Reflection/AssemblyTest.cs
mcs/class/corlib/Test/System.Reflection/IntrospectionExtensionsTest.cs
mcs/class/corlib/Test/System.Reflection/ModuleTest.cs
mcs/class/corlib/Test/System.Reflection/MonoGenericClassTest.cs
mcs/class/corlib/Test/System.Reflection/ParameterInfoTest.cs
mcs/class/corlib/Test/System.Reflection/PropertyInfoTest.cs
mcs/class/corlib/Test/System.Resources/ResourceReaderTest.cs
mcs/class/corlib/Test/System.Runtime.CompilerServices/AsyncVoidMethodBuilderTest.cs
mcs/class/corlib/Test/System.Runtime.CompilerServices/RuntimeHelpersTest.cs
mcs/class/corlib/Test/System.Runtime.CompilerServices/TaskAwaiterTest.cs
mcs/class/corlib/Test/System.Runtime.CompilerServices/TaskAwaiterTest_T.cs
mcs/class/corlib/Test/System.Runtime.CompilerServices/YieldAwaitableTest.cs
mcs/class/corlib/Test/System.Runtime.InteropServices/MarshalTest.cs
mcs/class/corlib/Test/System.Runtime.InteropServices/RuntimeEnvironmentTest.cs
mcs/class/corlib/Test/System.Security.AccessControl/FileSecurityTest.cs
mcs/class/corlib/Test/System.Security.AccessControl/RawSecurityDescriptorTest.cs
mcs/class/corlib/Test/System.Security.Claims/ClaimsIdentityTest.cs
mcs/class/corlib/Test/System.Security.Claims/ClaimsPrincipalTest.cs
mcs/class/corlib/Test/System.Security.Cryptography.X509Certificates/X509CapiTest.cs
mcs/class/corlib/Test/System.Security.Cryptography/CryptoConfigTest.cs
mcs/class/corlib/Test/System.Security.Cryptography/CryptoStreamTest.cs
mcs/class/corlib/Test/System.Security.Cryptography/DSACryptoServiceProviderTest.cs
mcs/class/corlib/Test/System.Security.Cryptography/HashAlgorithmTest.cs
mcs/class/corlib/Test/System.Security.Cryptography/PasswordDeriveBytesTest.cs
mcs/class/corlib/Test/System.Security.Cryptography/RNGCryptoServiceProviderTest.cs
mcs/class/corlib/Test/System.Security.Cryptography/RSACryptoServiceProviderTest.cs
mcs/class/corlib/Test/System.Security.Cryptography/RijndaelManagedTest.cs
mcs/class/corlib/Test/System.Security.Cryptography/SignatureDescriptionTest.cs
mcs/class/corlib/Test/System.Security.Policy/ZoneTest.cs
mcs/class/corlib/Test/System.Security/HostSecurityManagerTest.cs
mcs/class/corlib/Test/System.Text/ASCIIEncodingTest.cs
mcs/class/corlib/Test/System.Text/Latin1EncodingTest.cs [new file with mode: 0644]
mcs/class/corlib/Test/System.Text/UTF8EncodingTest.cs
mcs/class/corlib/Test/System.Threading.Tasks/ConcurrentExclusiveSchedulerPairTest.cs
mcs/class/corlib/Test/System.Threading.Tasks/TaskCompletionSourceTests.cs
mcs/class/corlib/Test/System.Threading.Tasks/TaskFactoryTest.cs
mcs/class/corlib/Test/System.Threading.Tasks/TaskFactoryTest_T.cs
mcs/class/corlib/Test/System.Threading.Tasks/TaskSchedulerTest.cs
mcs/class/corlib/Test/System.Threading.Tasks/TaskTest.cs
mcs/class/corlib/Test/System.Threading/CancellationTokenSourceTest.cs
mcs/class/corlib/Test/System.Threading/EventWaitHandleTest.cs
mcs/class/corlib/Test/System.Threading/MutexTest.cs
mcs/class/corlib/Test/System.Threading/ThreadLocalTests.cs
mcs/class/corlib/Test/System.Threading/ThreadTest.cs
mcs/class/corlib/Test/System.Threading/VolatileTest.cs
mcs/class/corlib/Test/System.Threading/WaitHandleTest.cs
mcs/class/corlib/Test/System/AppDomainSetupTest.cs
mcs/class/corlib/Test/System/ArraySegmentTest.cs
mcs/class/corlib/Test/System/AttributeTest.cs
mcs/class/corlib/Test/System/ConsoleTest.cs
mcs/class/corlib/Test/System/DateTimeTest.cs
mcs/class/corlib/Test/System/DecimalTest-Microsoft.cs
mcs/class/corlib/Test/System/DelegateTest.cs
mcs/class/corlib/Test/System/DoubleTest.cs
mcs/class/corlib/Test/System/EnvironmentTest.cs
mcs/class/corlib/Test/System/GCTest.cs [new file with mode: 0644]
mcs/class/corlib/Test/System/SingleTest.cs
mcs/class/corlib/Test/System/TimeZoneInfo.AdjustmentRuleTest.cs
mcs/class/corlib/Test/System/TimeZoneInfoTest.cs
mcs/class/corlib/Test/System/TimeZoneTest.cs
mcs/class/corlib/Test/System/TypeTest.cs
mcs/class/corlib/Test/System/WeakReferenceTest.cs
mcs/class/corlib/coreclr/AsyncLocal.cs [deleted file]
mcs/class/corlib/coreclr/DisablePrivateReflectionAttribute.cs [deleted file]
mcs/class/corlib/coreclr/EncodingProvider.cs [deleted file]
mcs/class/corlib/coreclr/FormattableString.cs [deleted file]
mcs/class/corlib/coreclr/FormattableStringFactory.cs [deleted file]
mcs/class/corlib/coreclr/WaitHandleExtensions.cs [deleted file]
mcs/class/corlib/corefx/SR.cs [new file with mode: 0644]
mcs/class/corlib/corlib-net_4_x.csproj
mcs/class/corlib/corlib.dll.sources
mcs/class/corlib/corlib_test.dll.sources
mcs/class/corlib/monotouch_runtime_corlib.dll.sources
mcs/class/corlib/monotouch_tv_corlib.dll.sources
mcs/class/corlib/monotouch_tv_runtime_corlib.dll.sources
mcs/class/corlib/monotouch_watch_corlib.dll.sources
mcs/class/corlib/monotouch_watch_runtime_corlib.dll.sources
mcs/class/corlib/net_4_x_corlib.dll.sources [deleted file]
mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Actions/DynamicObject.cs
mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/DebugInfoGenerator.cs
mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/DelegateHelpers.cs
mcs/class/legacy/Mono.Cecil/Mono.Cecil-net_4_x.csproj [new file with mode: 0644]
mcs/class/monodoc/Test/Monodoc.Generators/RawGeneratorTests.cs
mcs/class/monodoc/Test/Monodoc/HelpSourceTests.cs
mcs/class/monodoc/Test/Monodoc/SettingsTest.cs
mcs/class/monodoc/monodoc-net_4_x.csproj
mcs/class/monodoc/monodoc_test.dll.sources
mcs/class/referencesource/System.Core/System/Linq/Parallel/QueryOperators/Binary/UnionQueryOperator.cs
mcs/class/referencesource/System.Core/System/Linq/Parallel/QueryOperators/Options/OrderingQueryOperator.cs
mcs/class/referencesource/System.Core/System/Linq/Parallel/QueryOperators/Unary/ConcatQueryOperator.cs
mcs/class/referencesource/System.Core/System/Linq/Parallel/QueryOperators/Unary/SortQueryOperator.cs
mcs/class/referencesource/System.Core/System/Linq/Parallel/Scheduling/OrderPreservingPipeliningSpoolingTask.cs
mcs/class/referencesource/System.Core/System/Linq/Parallel/Utils/Sorting.cs
mcs/class/referencesource/System.Core/System/Linq/SequenceQuery.cs
mcs/class/referencesource/System.Core/System/threading/ReaderWriterLockSlim/ReaderWriterLockSlim.cs
mcs/class/referencesource/System.Data/System/Data/Sql/SqlDataSourceEnumerator.cs
mcs/class/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/XmlSerializableServices.cs
mcs/class/referencesource/System/compmod/system/codedom/CodeNamespace.cs
mcs/class/referencesource/System/compmod/system/codedom/CodePropertyReferenceExpression.cs
mcs/class/referencesource/System/compmod/system/componentmodel/LicFileLicenseProvider.cs
mcs/class/referencesource/System/compmod/system/componentmodel/ReflectEventDescriptor.cs
mcs/class/referencesource/System/compmod/system/componentmodel/ReflectPropertyDescriptor.cs
mcs/class/referencesource/System/compmod/system/componentmodel/TypeConverter.cs
mcs/class/referencesource/System/compmod/system/componentmodel/TypeDescriptor.cs
mcs/class/referencesource/System/compmod/system/diagnostics/TraceInternal.cs
mcs/class/referencesource/System/net/System/Net/IPAddress.cs
mcs/class/referencesource/System/net/System/Net/Internal.cs
mcs/class/referencesource/System/net/System/Net/NetworkCredential.cs
mcs/class/referencesource/System/net/System/Net/Sockets/Socket.cs
mcs/class/referencesource/System/net/System/Net/Sockets/TCPListener.cs
mcs/class/referencesource/System/net/System/Net/WebHeaderCollection.cs
mcs/class/referencesource/System/net/System/Net/WebRequest.cs
mcs/class/referencesource/System/net/System/Net/connectionpool.cs
mcs/class/referencesource/System/net/System/Net/cookiecontainer.cs
mcs/class/referencesource/System/net/System/Net/filewebrequest.cs
mcs/class/referencesource/System/net/System/Net/mail/MimeBasePart.cs
mcs/class/referencesource/System/net/System/Net/webclient.cs
mcs/class/referencesource/System/net/System/Net/webproxy.cs
mcs/class/referencesource/System/net/System/URI.cs
mcs/class/referencesource/System/net/System/UriExt.cs
mcs/class/referencesource/System/regex/system/text/regularexpressions/Regex.cs
mcs/class/referencesource/System/regex/system/text/regularexpressions/RegexCompiler.cs
mcs/class/referencesource/System/regex/system/text/regularexpressions/RegexParser.cs
mcs/class/referencesource/System/services/monitoring/system/diagnosticts/AsyncStreamReader.cs
mcs/class/referencesource/System/services/monitoring/system/diagnosticts/Process.cs
mcs/class/referencesource/System/services/monitoring/system/diagnosticts/ProcessModuleCollection.cs
mcs/class/referencesource/System/services/monitoring/system/diagnosticts/ProcessThreadCollection.cs
mcs/class/referencesource/System/sys/system/IO/ports/InternalResources.cs
mcs/class/referencesource/System/sys/system/threading/semaphore.cs
mcs/class/referencesource/System/sys/system/windows/markup/ValueSerializerAttribute.cs
mcs/class/referencesource/mscorlib/system/boolean.cs
mcs/class/referencesource/mscorlib/system/collections/generic/list.cs
mcs/class/referencesource/mscorlib/system/contextboundobject.cs
mcs/class/referencesource/mscorlib/system/convert.cs
mcs/class/referencesource/mscorlib/system/gc.cs
mcs/class/referencesource/mscorlib/system/globalization/charunicodeinfo.cs
mcs/class/referencesource/mscorlib/system/globalization/compareinfo.cs
mcs/class/referencesource/mscorlib/system/globalization/datetimeformatinfo.cs
mcs/class/referencesource/mscorlib/system/globalization/datetimeparse.cs
mcs/class/referencesource/mscorlib/system/globalization/japanesecalendar.cs
mcs/class/referencesource/mscorlib/system/globalization/sortversion.cs
mcs/class/referencesource/mscorlib/system/io/binaryreader.cs
mcs/class/referencesource/mscorlib/system/io/fileinfo.cs
mcs/class/referencesource/mscorlib/system/io/filesysteminfo.cs
mcs/class/referencesource/mscorlib/system/io/ioexception.cs
mcs/class/referencesource/mscorlib/system/io/stream.cs
mcs/class/referencesource/mscorlib/system/io/streamwriter.cs
mcs/class/referencesource/mscorlib/system/io/textreader.cs
mcs/class/referencesource/mscorlib/system/io/textwriter.cs
mcs/class/referencesource/mscorlib/system/resources/manifestbasedresourcegroveler.cs
mcs/class/referencesource/mscorlib/system/resources/resourcemanager.cs
mcs/class/referencesource/mscorlib/system/rttype.cs
mcs/class/referencesource/mscorlib/system/runtime/compilerservices/typedependencyattribute.cs
mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs
mcs/class/referencesource/mscorlib/system/runtime/interopservices/attributes.cs
mcs/class/referencesource/mscorlib/system/runtime/interopservices/dispatchwrapper.cs
mcs/class/referencesource/mscorlib/system/runtime/interopservices/errorwrapper.cs
mcs/class/referencesource/mscorlib/system/runtime/interopservices/runtimeenvironment.cs
mcs/class/referencesource/mscorlib/system/runtime/interopservices/windowsruntime/windowsruntimemarshal.cs
mcs/class/referencesource/mscorlib/system/runtime/serialization/formatters/binary/binarycommonclasses.cs
mcs/class/referencesource/mscorlib/system/runtime/serialization/formatters/binary/binaryformatter.cs
mcs/class/referencesource/mscorlib/system/runtime/serialization/formatters/binary/binaryformatterwriter.cs
mcs/class/referencesource/mscorlib/system/runtime/serialization/formatters/binary/binarymethodmessage.cs
mcs/class/referencesource/mscorlib/system/runtime/serialization/formatters/binary/binaryobjectreader.cs
mcs/class/referencesource/mscorlib/system/runtime/serialization/formatters/binary/binaryutilclasses.cs
mcs/class/referencesource/mscorlib/system/runtime/serialization/objectmanager.cs
mcs/class/referencesource/mscorlib/system/runtime/serialization/serializationeventscache.cs
mcs/class/referencesource/mscorlib/system/security/attributes.cs
mcs/class/referencesource/mscorlib/system/security/claims/ClaimsIdentity.cs
mcs/class/referencesource/mscorlib/system/security/cryptography/passwordderivebytes.cs
mcs/class/referencesource/mscorlib/system/security/cryptography/rc2cryptoserviceprovider.cs
mcs/class/referencesource/mscorlib/system/security/cryptography/rfc2898derivebytes.cs
mcs/class/referencesource/mscorlib/system/security/cryptography/rsacryptoserviceprovider.cs
mcs/class/referencesource/mscorlib/system/sharedstatics.cs
mcs/class/referencesource/mscorlib/system/string.cs
mcs/class/referencesource/mscorlib/system/text/stringbuilder.cs
mcs/class/referencesource/mscorlib/system/threading/CancellationTokenSource.cs
mcs/class/referencesource/mscorlib/system/threading/Tasks/FutureFactory.cs
mcs/class/referencesource/mscorlib/system/threading/Tasks/Parallel.cs
mcs/class/referencesource/mscorlib/system/threading/Tasks/ParallelLoopState.cs
mcs/class/referencesource/mscorlib/system/threading/Tasks/TaskContinuation.cs
mcs/class/referencesource/mscorlib/system/threading/eventwaithandle.cs
mcs/class/referencesource/mscorlib/system/threading/thread.cs
mcs/class/referencesource/mscorlib/system/threading/threadabortexception.cs
mcs/class/referencesource/mscorlib/system/threading/threadpool.cs
mcs/class/referencesource/mscorlib/system/typedreference.cs
mcs/class/test-helpers/NunitHelpers.cs [new file with mode: 0644]
mcs/class/test-helpers/SocketResponder.cs
mcs/errors/cs0029-37.cs [new file with mode: 0644]
mcs/errors/cs0031-9.cs [new file with mode: 0644]
mcs/errors/cs0122-39.cs [new file with mode: 0644]
mcs/errors/cs0177-15.cs [new file with mode: 0644]
mcs/errors/cs0219-7.cs [new file with mode: 0644]
mcs/errors/cs0246-36.cs [new file with mode: 0644]
mcs/errors/cs0619-59.cs [new file with mode: 0644]
mcs/errors/cs1070-3.cs [new file with mode: 0644]
mcs/errors/cs1501-19.cs [new file with mode: 0644]
mcs/errors/cs1691-2.cs [deleted file]
mcs/errors/cs1691-3.cs [deleted file]
mcs/errors/cs1691-4.cs [deleted file]
mcs/errors/cs1691.cs [deleted file]
mcs/errors/cs1744-3.cs [new file with mode: 0644]
mcs/errors/cs1904.cs [deleted file]
mcs/errors/cs8101.cs [new file with mode: 0644]
mcs/ilasm/ilasm-net_4_x.csproj
mcs/ilasm/parser/ILParser.jay
mcs/mcs/Makefile
mcs/mcs/anonymous.cs
mcs/mcs/assembly.cs
mcs/mcs/class.cs
mcs/mcs/constant.cs
mcs/mcs/context.cs
mcs/mcs/cs-tokenizer.cs
mcs/mcs/decl.cs
mcs/mcs/doc-bootstrap.cs
mcs/mcs/ecore.cs
mcs/mcs/eval.cs
mcs/mcs/expression.cs
mcs/mcs/generic.cs
mcs/mcs/ikvm.cs
mcs/mcs/import.cs
mcs/mcs/iterators.cs
mcs/mcs/location.cs
mcs/mcs/mcs-net_4_x.csproj
mcs/mcs/membercache.cs
mcs/mcs/method.cs
mcs/mcs/namespace.cs
mcs/mcs/property.cs
mcs/mcs/reflection.cs
mcs/mcs/report.cs
mcs/mcs/settings.cs
mcs/mcs/statement.cs
mcs/mcs/typespec.cs
mcs/nunit24/ClientUtilities/util/nunit.util-net_4_x.csproj
mcs/nunit24/ConsoleRunner/nunit-console-exe/Class1.cs
mcs/nunit24/ConsoleRunner/nunit-console-exe/nunit-console-net_4_x.csproj
mcs/nunit24/ConsoleRunner/nunit-console/nunit-console-runner-net_4_x.csproj
mcs/nunit24/NUnitCore/core/nunit.core-net_4_x.csproj
mcs/nunit24/NUnitCore/interfaces/nunit.core.interfaces-net_4_x.csproj
mcs/nunit24/NUnitExtensions/core/nunit.core.extensions-net_4_x.csproj
mcs/nunit24/NUnitExtensions/framework/nunit.framework.extensions-net_4_x.csproj
mcs/nunit24/NUnitFramework/framework/NUnit.Framework-net_4_x.csproj
mcs/nunit24/NUnitFramework/framework/TestFixtureAttribute.cs
mcs/nunit24/NUnitMocks/mocks/nunit.mocks-net_4_x.csproj
mcs/tests/dtest-065.cs [new file with mode: 0644]
mcs/tests/gtest-638.cs [new file with mode: 0644]
mcs/tests/gtest-639.cs [new file with mode: 0644]
mcs/tests/gtest-640.cs [new file with mode: 0644]
mcs/tests/gtest-optional-40.cs [new file with mode: 0644]
mcs/tests/test-16628-lib.il [new file with mode: 0644]
mcs/tests/test-254.cs
mcs/tests/test-908.cs
mcs/tests/test-940.cs [new file with mode: 0644]
mcs/tests/test-941.cs [new file with mode: 0644]
mcs/tests/test-async-88.cs [new file with mode: 0644]
mcs/tests/test-async-89.cs [new file with mode: 0644]
mcs/tests/test-debug-11-ref.xml
mcs/tests/test-debug-21-ref.xml
mcs/tests/test-debug-28-ref.xml
mcs/tests/test-debug-30-ref.xml
mcs/tests/test-debug-30.cs
mcs/tests/test-debug-31-ref.xml [new file with mode: 0644]
mcs/tests/test-debug-31.cs [new file with mode: 0644]
mcs/tests/test-debug-32-ref.xml [new file with mode: 0644]
mcs/tests/test-debug-32.cs [new file with mode: 0644]
mcs/tests/test-interpolation-05.cs
mcs/tests/test-named-10.cs [new file with mode: 0644]
mcs/tests/test-partial-35.cs [new file with mode: 0644]
mcs/tests/ver-il-net_4_x.xml
mcs/tools/Makefile
mcs/tools/al/Al.cs
mcs/tools/al/al-net_4_x.csproj
mcs/tools/browsercaps-updater/browsercaps-updater-net_4_x.csproj
mcs/tools/btls/AssemblyInfo.cs [new file with mode: 0644]
mcs/tools/btls/Makefile [new file with mode: 0644]
mcs/tools/btls/btls-cert-sync-net_4_x.csproj [new file with mode: 0644]
mcs/tools/btls/btls-cert-sync.cs [new file with mode: 0644]
mcs/tools/btls/btls-cert-sync.exe.sources [new file with mode: 0644]
mcs/tools/cccheck/cccheck-net_4_x.csproj
mcs/tools/ccrewrite/ccrewrite-net_4_x.csproj
mcs/tools/cil-stringreplacer/cil-stringreplacer-net_4_x.csproj
mcs/tools/cil-strip/mono-cil-strip-net_4_x.csproj
mcs/tools/commoncryptogenerator/CommonCryptorGenerator.cs
mcs/tools/commoncryptogenerator/commoncryptogenerator-net_4_x.csproj
mcs/tools/commoncryptogenerator/generator.cs
mcs/tools/compiler-tester/compiler-tester-net_4_x.csproj
mcs/tools/compiler-tester/compiler-tester.cs
mcs/tools/compiler-tester/xmldocdiff.cs
mcs/tools/corcompare/mono-api-info-net_4_x.csproj
mcs/tools/corcompare/mono-api-info.cs
mcs/tools/corcompare/mono-api-info.csproj
mcs/tools/csharp/csharp-net_4_x.csproj
mcs/tools/csharp/repl.cs
mcs/tools/culevel/culevel-net_4_x.csproj
mcs/tools/disco/disco-net_4_x.csproj
mcs/tools/dtd2rng/dtd2rng-net_4_x.csproj
mcs/tools/dtd2xsd/dtd2xsd-net_4_x.csproj
mcs/tools/gacutil/Makefile
mcs/tools/gacutil/driver.cs
mcs/tools/gacutil/gacutil-net_4_x.csproj
mcs/tools/gacutil/gacutil.exe.sources
mcs/tools/genxs/genxs-net_4_x.csproj
mcs/tools/ictool/ictool-net_4_x.csproj
mcs/tools/ikdasm/ikdasm-net_4_x.csproj
mcs/tools/installutil/installutil-net_4_x.csproj
mcs/tools/installvst/installvst-net_4_x.csproj
mcs/tools/lc/lc-net_4_x.csproj
mcs/tools/linker-analyzer/linkeranalyzer-net_4_x.csproj
mcs/tools/linker/AUTHORS [deleted file]
mcs/tools/linker/Descriptors/mscorlib.xml
mcs/tools/linker/MIT.X11 [deleted file]
mcs/tools/linker/Mono.Linker.Steps/BaseStep.cs [deleted file]
mcs/tools/linker/Mono.Linker.Steps/BlacklistStep.cs [deleted file]
mcs/tools/linker/Mono.Linker.Steps/CleanStep.cs [deleted file]
mcs/tools/linker/Mono.Linker.Steps/IStep.cs [deleted file]
mcs/tools/linker/Mono.Linker.Steps/LoadI18nAssemblies.cs [deleted file]
mcs/tools/linker/Mono.Linker.Steps/LoadReferencesStep.cs [deleted file]
mcs/tools/linker/Mono.Linker.Steps/MarkStep.cs [deleted file]
mcs/tools/linker/Mono.Linker.Steps/OutputStep.cs [deleted file]
mcs/tools/linker/Mono.Linker.Steps/RegenerateGuidStep.cs [deleted file]
mcs/tools/linker/Mono.Linker.Steps/ResolveFromAssemblyStep.cs [deleted file]
mcs/tools/linker/Mono.Linker.Steps/ResolveFromXApiStep.cs [deleted file]
mcs/tools/linker/Mono.Linker.Steps/ResolveFromXmlStep.cs [deleted file]
mcs/tools/linker/Mono.Linker.Steps/ResolveStep.cs [deleted file]
mcs/tools/linker/Mono.Linker.Steps/SweepStep.cs [deleted file]
mcs/tools/linker/Mono.Linker.Steps/TypeMapStep.cs [deleted file]
mcs/tools/linker/Mono.Linker.csproj [deleted file]
mcs/tools/linker/Mono.Linker/Annotations.cs [deleted file]
mcs/tools/linker/Mono.Linker/AssemblyAction.cs [deleted file]
mcs/tools/linker/Mono.Linker/AssemblyInfo.cs [deleted file]
mcs/tools/linker/Mono.Linker/AssemblyResolver.cs [deleted file]
mcs/tools/linker/Mono.Linker/Driver.cs [deleted file]
mcs/tools/linker/Mono.Linker/I18nAssemblies.cs [deleted file]
mcs/tools/linker/Mono.Linker/IXApiVisitor.cs [deleted file]
mcs/tools/linker/Mono.Linker/LinkContext.cs [deleted file]
mcs/tools/linker/Mono.Linker/MethodAction.cs [deleted file]
mcs/tools/linker/Mono.Linker/Pipeline.cs [deleted file]
mcs/tools/linker/Mono.Linker/TypePreserve.cs [deleted file]
mcs/tools/linker/Mono.Linker/XApiReader.cs [deleted file]
mcs/tools/linker/README [deleted file]
mcs/tools/linker/Tests/Libs/nunit-console-runner.dll [deleted file]
mcs/tools/linker/Tests/Libs/nunit-console.exe [deleted file]
mcs/tools/linker/Tests/Libs/nunit-console.exe.config [deleted file]
mcs/tools/linker/Tests/Libs/nunit.core.dll [deleted file]
mcs/tools/linker/Tests/Libs/nunit.framework.dll [deleted file]
mcs/tools/linker/Tests/Libs/nunit.util.dll [deleted file]
mcs/tools/linker/Tests/Makefile [deleted file]
mcs/tools/linker/Tests/Mono.Linker.Tests.csproj [deleted file]
mcs/tools/linker/Tests/Mono.Linker.Tests/AbstractLinkingTestFixture.cs [deleted file]
mcs/tools/linker/Tests/Mono.Linker.Tests/AbstractTestFixture.cs [deleted file]
mcs/tools/linker/Tests/Mono.Linker.Tests/AssemblyInfo.cs [deleted file]
mcs/tools/linker/Tests/Mono.Linker.Tests/AssemblyLinkingTestFixture.cs [deleted file]
mcs/tools/linker/Tests/Mono.Linker.Tests/IntegrationTestFixture.cs [deleted file]
mcs/tools/linker/Tests/Mono.Linker.Tests/XmlLinkingTestFixture.cs [deleted file]
mcs/tools/linker/Tests/TestCases/Integration/Crypto/Test.cs [deleted file]
mcs/tools/linker/Tests/TestCases/Integration/Crypto/Test.exe [deleted file]
mcs/tools/linker/Tests/TestCases/Integration/HelloWorld/Test.cs [deleted file]
mcs/tools/linker/Tests/TestCases/Integration/HelloWorld/Test.exe [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/Generics/Library.cs [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/Generics/Library.dll [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/Generics/Makefile [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/Generics/desc.xml [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/Interface/Library.cs [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/Interface/Library.dll [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/Interface/Makefile [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/Interface/desc.xml [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/MultipleReferences/Bar.cs [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/MultipleReferences/Bar.dll [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/MultipleReferences/Baz.cs [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/MultipleReferences/Baz.dll [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/MultipleReferences/Foo.cs [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/MultipleReferences/Foo.dll [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/MultipleReferences/Makefile [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/MultipleReferences/NotLinkedAttribute.cs [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/MultipleReferences/NotLinkedAttribute.dll [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/MultipleReferences/Program.cs [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/MultipleReferences/Program.exe [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/NestedNested/Library.cs [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/NestedNested/Library.dll [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/NestedNested/Makefile [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/NestedNested/desc.xml [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/PreserveFieldsRequired/Library.cs [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/PreserveFieldsRequired/Library.dll [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/PreserveFieldsRequired/Makefile [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/PreserveFieldsRequired/desc.xml [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/ReferenceInAttributes/LibLib.cs [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/ReferenceInAttributes/LibLib.dll [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/ReferenceInAttributes/Library.cs [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/ReferenceInAttributes/Library.dll [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/ReferenceInAttributes/desc.xml [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/ReferenceInVirtualMethod/Library.cs [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/ReferenceInVirtualMethod/Library.dll [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/ReferenceInVirtualMethod/Makefile [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/ReferenceInVirtualMethod/desc.xml [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/Simple/Library.cs [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/Simple/Library.dll [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/Simple/Makefile [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/Simple/Program.cs [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/Simple/Program.exe [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/SimpleXml/Library.cs [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/SimpleXml/Library.dll [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/SimpleXml/Makefile [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/SimpleXml/desc.xml [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/VirtualCall/Library.cs [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/VirtualCall/Library.dll [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/VirtualCall/Makefile [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/VirtualCall/Program.cs [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/VirtualCall/Program.exe [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/XmlPattern/Library.cs [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/XmlPattern/Library.dll [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/XmlPattern/Makefile [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/XmlPattern/desc.xml [deleted file]
mcs/tools/linker/Tests/TestCases/config.make [deleted file]
mcs/tools/linker/configure [deleted file]
mcs/tools/linker/monolinker-net_4_x.csproj
mcs/tools/linker/monolinker.exe.sources
mcs/tools/linker/monolinker.in [deleted file]
mcs/tools/linker/profiler/Makefile [deleted file]
mcs/tools/linker/profiler/link.c [deleted file]
mcs/tools/linker/standalone.make [deleted file]
mcs/tools/macpack/macpack-net_4_x.csproj
mcs/tools/mconfig/mconfig-net_4_x.csproj
mcs/tools/mdbrebase/mdbrebase-net_4_x.csproj
mcs/tools/mdoc/Makefile
mcs/tools/mdoc/mdoc-net_4_x.csproj
mcs/tools/mkbundle/Makefile
mcs/tools/mkbundle/mkbundle-net_4_x.csproj
mcs/tools/mkbundle/mkbundle.cs
mcs/tools/mod/mod-net_4_x.csproj
mcs/tools/mono-api-html/Makefile
mcs/tools/mono-api-html/MemberComparer.cs
mcs/tools/mono-api-html/mono-api-html-net_4_x.csproj
mcs/tools/mono-configuration-crypto/cli/mono-configuration-crypto-net_4_x.csproj
mcs/tools/mono-configuration-crypto/lib/Mono.Configuration.Crypto-net_4_x.csproj
mcs/tools/mono-service/mono-service-net_4_x.csproj
mcs/tools/mono-shlib-cop/mono-shlib-cop-net_4_x.csproj
mcs/tools/mono-symbolicate/Makefile
mcs/tools/mono-symbolicate/SymbolManager.cs
mcs/tools/mono-symbolicate/mono-symbolicate-net_4_x.csproj
mcs/tools/mono-symbolicate/mono-symbolicate.exe.sources
mcs/tools/mono-symbolicate/monosymbolicate.csproj
mcs/tools/mono-xmltool/mono-xmltool-net_4_x.csproj
mcs/tools/mono-xsd/xsd-net_4_x.csproj
mcs/tools/monop/monop-net_4_x.csproj
mcs/tools/nunit-lite/NUnitLite/BabysitterSupport.cs [new file with mode: 0644]
mcs/tools/nunit-lite/NUnitLite/nunitlite.dll.sources
mcs/tools/nunit-lite/nunit-lite-console/nunit-lite-console.exe.config [deleted file]
mcs/tools/nunit-lite/nunit-lite-console/nunit-lite-console.exe.config.tmpl [new file with mode: 0644]
mcs/tools/nunitreport/nunitreport-net_4_x.csproj
mcs/tools/pdb2mdb/pdb2mdb-net_4_x.csproj
mcs/tools/resgen/resgen-net_4_x.csproj
mcs/tools/security/cert-sync.cs
mcs/tools/sgen/sgen-net_4_x.csproj
mcs/tools/soapsuds/soapsuds-net_4_x.csproj
mcs/tools/sqlmetal/sqlmetal-net_4_x.csproj
mcs/tools/sqlsharp/Makefile
mcs/tools/sqlsharp/sqlsharp-net_4_x.csproj
mcs/tools/svcutil/svcutil-net_4_x.csproj
mcs/tools/tuner/Makefile [deleted file]
mcs/tools/tuner/Mono.Tuner-net_4_x.csproj [deleted file]
mcs/tools/tuner/Mono.Tuner.csproj [deleted file]
mcs/tools/tuner/Mono.Tuner.dll.sources [deleted file]
mcs/tools/tuner/Mono.Tuner/AdjustVisibility.cs [deleted file]
mcs/tools/tuner/Mono.Tuner/ApplyPreserveAttributeBase.cs [deleted file]
mcs/tools/tuner/Mono.Tuner/CecilRocks.cs [deleted file]
mcs/tools/tuner/Mono.Tuner/CheckVisibility.cs [deleted file]
mcs/tools/tuner/Mono.Tuner/CustomizeActions.cs [deleted file]
mcs/tools/tuner/Mono.Tuner/Dispatcher.cs [deleted file]
mcs/tools/tuner/Mono.Tuner/Extensions.cs [deleted file]
mcs/tools/tuner/Mono.Tuner/FilterAttributes.cs [deleted file]
mcs/tools/tuner/Mono.Tuner/FixModuleFlags.cs [deleted file]
mcs/tools/tuner/Mono.Tuner/InjectSecurityAttributes.cs [deleted file]
mcs/tools/tuner/Mono.Tuner/MarkNSObjectsBase.cs [deleted file]
mcs/tools/tuner/Mono.Tuner/MoonlightA11yApiMarker.cs [deleted file]
mcs/tools/tuner/Mono.Tuner/MoonlightA11yAssemblyStep.cs [deleted file]
mcs/tools/tuner/Mono.Tuner/MoonlightA11yDescriptorGenerator.cs [deleted file]
mcs/tools/tuner/Mono.Tuner/MoonlightA11yProcessor.cs [deleted file]
mcs/tools/tuner/Mono.Tuner/MoonlightA11yUsageInspectionStep.cs [deleted file]
mcs/tools/tuner/Mono.Tuner/MoonlightAssemblyStep.cs [deleted file]
mcs/tools/tuner/Mono.Tuner/PreserveCrypto.cs [deleted file]
mcs/tools/tuner/Mono.Tuner/PreserveHttps.cs [deleted file]
mcs/tools/tuner/Mono.Tuner/PreserveSoapHttpClients.cs [deleted file]
mcs/tools/tuner/Mono.Tuner/PrintStatus.cs [deleted file]
mcs/tools/tuner/Mono.Tuner/PrintTypeMap.cs [deleted file]
mcs/tools/tuner/Mono.Tuner/Profile.cs [deleted file]
mcs/tools/tuner/Mono.Tuner/RemoveAttributesBase.cs [deleted file]
mcs/tools/tuner/Mono.Tuner/RemoveResources.cs [deleted file]
mcs/tools/tuner/Mono.Tuner/RemoveSecurity.cs [deleted file]
mcs/tools/tuner/Mono.Tuner/RemoveSerialization.cs [deleted file]
mcs/tools/tuner/Mono.Tuner/TunerAnnotations.cs [deleted file]
mcs/tools/tuner/MonoMac.Tuner/ApplyPreserveAttribute.cs [deleted file]
mcs/tools/tuner/MonoMac.Tuner/Extensions.cs [deleted file]
mcs/tools/tuner/MonoMac.Tuner/MarkNSObjects.cs [deleted file]
mcs/tools/tuner/MonoMac.Tuner/MethodMapInjection.cs [deleted file]
mcs/tools/tuner/MonoMac.Tuner/MonoMac.xml [deleted file]
mcs/tools/tuner/MonoMac.Tuner/MonoMacProfile.cs [deleted file]
mcs/tools/tuner/MonoMac.Tuner/RemoveSelectors.cs [deleted file]
mcs/tools/wsdl/wsdl-net_4_x.csproj
mcs/tools/xbuild/Makefile
mcs/tools/xbuild/data/12.0/Microsoft.Common.targets
mcs/tools/xbuild/data/14.0/Microsoft.Common.targets
mcs/tools/xbuild/data/4.0/Microsoft.Common.targets
mcs/tools/xbuild/data/xbuild.exe.config_test.in [new file with mode: 0644]
mcs/tools/xbuild/tests/Vbc/1.vbproj [new file with mode: 0644]
mcs/tools/xbuild/tests/Vbc/2.vbproj [new file with mode: 0644]
mcs/tools/xbuild/tests/Vbc/test.vb [new file with mode: 0644]
mcs/tools/xbuild/xbuild_test.make
mono/Makefile.am
mono/btls/.gitignore [new file with mode: 0644]
mono/btls/CMakeLists.txt [new file with mode: 0644]
mono/btls/Makefile.am [new file with mode: 0644]
mono/btls/btls-bio.c [new file with mode: 0644]
mono/btls/btls-bio.h [new file with mode: 0644]
mono/btls/btls-error.c [new file with mode: 0644]
mono/btls/btls-error.h [new file with mode: 0644]
mono/btls/btls-key.c [new file with mode: 0644]
mono/btls/btls-key.h [new file with mode: 0644]
mono/btls/btls-pkcs12.c [new file with mode: 0644]
mono/btls/btls-pkcs12.h [new file with mode: 0644]
mono/btls/btls-ssl-ctx.c [new file with mode: 0644]
mono/btls/btls-ssl-ctx.h [new file with mode: 0644]
mono/btls/btls-ssl.c [new file with mode: 0644]
mono/btls/btls-ssl.h [new file with mode: 0644]
mono/btls/btls-time64.c [new file with mode: 0644]
mono/btls/btls-util.c [new file with mode: 0644]
mono/btls/btls-util.h [new file with mode: 0644]
mono/btls/btls-x509-chain.c [new file with mode: 0644]
mono/btls/btls-x509-chain.h [new file with mode: 0644]
mono/btls/btls-x509-crl.c [new file with mode: 0644]
mono/btls/btls-x509-crl.h [new file with mode: 0644]
mono/btls/btls-x509-lookup-mono.c [new file with mode: 0644]
mono/btls/btls-x509-lookup-mono.h [new file with mode: 0644]
mono/btls/btls-x509-lookup.c [new file with mode: 0644]
mono/btls/btls-x509-lookup.h [new file with mode: 0644]
mono/btls/btls-x509-name.c [new file with mode: 0644]
mono/btls/btls-x509-name.h [new file with mode: 0644]
mono/btls/btls-x509-revoked.c [new file with mode: 0644]
mono/btls/btls-x509-revoked.h [new file with mode: 0644]
mono/btls/btls-x509-store-ctx.c [new file with mode: 0644]
mono/btls/btls-x509-store-ctx.h [new file with mode: 0644]
mono/btls/btls-x509-store.c [new file with mode: 0644]
mono/btls/btls-x509-store.h [new file with mode: 0644]
mono/btls/btls-x509-verify-param.c [new file with mode: 0644]
mono/btls/btls-x509-verify-param.h [new file with mode: 0644]
mono/btls/btls-x509.c [new file with mode: 0644]
mono/btls/btls-x509.h [new file with mode: 0644]
mono/btls/create-object-library.sh [new file with mode: 0755]
mono/dis/get.c
mono/dis/main.c
mono/io-layer/Makefile.am
mono/io-layer/access.h [deleted file]
mono/io-layer/context.c [deleted file]
mono/io-layer/context.h [deleted file]
mono/io-layer/error.c
mono/io-layer/event-private.h [deleted file]
mono/io-layer/events.c [deleted file]
mono/io-layer/events.h [deleted file]
mono/io-layer/io-layer.h
mono/io-layer/io.c
mono/io-layer/locking.c
mono/io-layer/mutex-private.h [deleted file]
mono/io-layer/mutexes.c [deleted file]
mono/io-layer/mutexes.h [deleted file]
mono/io-layer/posix.c
mono/io-layer/process-private.h [deleted file]
mono/io-layer/processes.c [deleted file]
mono/io-layer/processes.h [deleted file]
mono/io-layer/semaphore-private.h [deleted file]
mono/io-layer/semaphores.c [deleted file]
mono/io-layer/semaphores.h [deleted file]
mono/io-layer/shared.c [deleted file]
mono/io-layer/shared.h [deleted file]
mono/io-layer/sockets.c
mono/io-layer/timefuncs-private.h [deleted file]
mono/io-layer/timefuncs.c
mono/io-layer/timefuncs.h
mono/io-layer/uglify.h
mono/io-layer/wait.c
mono/io-layer/wait.h
mono/io-layer/wapi-private.h
mono/io-layer/wapi-remap.h
mono/io-layer/wapi.c
mono/io-layer/wapi.h
mono/io-layer/wapi_glob.c
mono/metadata/Makefile.am
mono/metadata/appdomain.c
mono/metadata/assembly-internals.h [new file with mode: 0644]
mono/metadata/assembly.c
mono/metadata/assembly.h
mono/metadata/attach.c
mono/metadata/boehm-gc.c
mono/metadata/class-accessors.c [new file with mode: 0644]
mono/metadata/class-inlines.h [new file with mode: 0644]
mono/metadata/class-internals.h
mono/metadata/class.c
mono/metadata/cominterop.c
mono/metadata/console-win32-internals.h [new file with mode: 0644]
mono/metadata/console-win32-uwp.c [new file with mode: 0644]
mono/metadata/console-win32.c
mono/metadata/coree-internals.h [new file with mode: 0644]
mono/metadata/coree-windows-uwp.c [new file with mode: 0644]
mono/metadata/coree.c
mono/metadata/custom-attrs-internals.h [new file with mode: 0644]
mono/metadata/custom-attrs.c [new file with mode: 0644]
mono/metadata/debug-mono-symfile.c
mono/metadata/domain-internals.h
mono/metadata/domain.c
mono/metadata/dynamic-image-internals.h [new file with mode: 0644]
mono/metadata/dynamic-image.c [new file with mode: 0644]
mono/metadata/dynamic-stream-internals.h [new file with mode: 0644]
mono/metadata/dynamic-stream.c [new file with mode: 0644]
mono/metadata/exception.c
mono/metadata/file-io-internals.h [new file with mode: 0644]
mono/metadata/file-io-windows-internals.h [new file with mode: 0644]
mono/metadata/file-io-windows-uwp.c [new file with mode: 0644]
mono/metadata/file-io-windows.c [new file with mode: 0644]
mono/metadata/file-io.c
mono/metadata/file-mmap-posix.c
mono/metadata/file-mmap-windows.c
mono/metadata/gc-internals.h
mono/metadata/gc.c
mono/metadata/handle.c
mono/metadata/handle.h
mono/metadata/icall-def.h
mono/metadata/icall-internals.h [new file with mode: 0644]
mono/metadata/icall-windows-internals.h [new file with mode: 0644]
mono/metadata/icall-windows-uwp.c [new file with mode: 0644]
mono/metadata/icall-windows.c [new file with mode: 0644]
mono/metadata/icall.c
mono/metadata/image-internals.h
mono/metadata/image.c
mono/metadata/image.h
mono/metadata/jit-info.c
mono/metadata/loader.c
mono/metadata/loader.h
mono/metadata/locales.c
mono/metadata/lock-tracer.c
mono/metadata/marshal-internals.h [new file with mode: 0644]
mono/metadata/marshal-windows-internals.h [new file with mode: 0644]
mono/metadata/marshal-windows-uwp.c [new file with mode: 0644]
mono/metadata/marshal-windows.c [new file with mode: 0644]
mono/metadata/marshal.c
mono/metadata/marshal.h
mono/metadata/mempool-internals.h
mono/metadata/mempool.c
mono/metadata/metadata-internals.h
mono/metadata/metadata-verify.c
mono/metadata/metadata.c
mono/metadata/metadata.h
mono/metadata/monitor.c
mono/metadata/mono-config-dirs.c
mono/metadata/mono-config-dirs.h
mono/metadata/mono-config.c
mono/metadata/mono-config.h
mono/metadata/mono-endian.c
mono/metadata/mono-gc.h
mono/metadata/mono-perfcounters.c
mono/metadata/mono-route.c
mono/metadata/mono-security-windows-internals.h [new file with mode: 0644]
mono/metadata/mono-security-windows-uwp.c [new file with mode: 0644]
mono/metadata/mono-security-windows.c [new file with mode: 0644]
mono/metadata/mono-security.c
mono/metadata/null-gc.c
mono/metadata/object-internals.h
mono/metadata/object-offsets.h
mono/metadata/object.c
mono/metadata/process.c [deleted file]
mono/metadata/process.h [deleted file]
mono/metadata/profiler-private.h
mono/metadata/profiler.c
mono/metadata/profiler.h
mono/metadata/property-bag.c [new file with mode: 0644]
mono/metadata/property-bag.h [new file with mode: 0644]
mono/metadata/reflection-cache.h [new file with mode: 0644]
mono/metadata/reflection-internals.h
mono/metadata/reflection.c
mono/metadata/reflection.h
mono/metadata/remoting.c
mono/metadata/security-core-clr.c
mono/metadata/seq-points-data.c
mono/metadata/sgen-bridge-internals.h
mono/metadata/sgen-bridge.c
mono/metadata/sgen-bridge.h
mono/metadata/sgen-client-mono.h
mono/metadata/sgen-mono.c
mono/metadata/sgen-new-bridge.c
mono/metadata/sgen-old-bridge.c
mono/metadata/sgen-os-coop.c [deleted file]
mono/metadata/sgen-os-mach.c [deleted file]
mono/metadata/sgen-os-posix.c [deleted file]
mono/metadata/sgen-os-win32.c [deleted file]
mono/metadata/sgen-stw.c
mono/metadata/sgen-tarjan-bridge.c
mono/metadata/socket-io-windows-internals.h [new file with mode: 0644]
mono/metadata/socket-io-windows.c [new file with mode: 0644]
mono/metadata/socket-io.c
mono/metadata/socket-io.h
mono/metadata/sre-encode.c [new file with mode: 0644]
mono/metadata/sre-internals.h [new file with mode: 0644]
mono/metadata/sre-save.c [new file with mode: 0644]
mono/metadata/sre.c [new file with mode: 0644]
mono/metadata/threadpool-ms.c
mono/metadata/threads-types.h
mono/metadata/threads.c
mono/metadata/verify.c
mono/metadata/verify.h
mono/metadata/w32event-unix.c [new file with mode: 0644]
mono/metadata/w32event-win32.c [new file with mode: 0644]
mono/metadata/w32event.h [new file with mode: 0644]
mono/metadata/w32handle-namespace.c [new file with mode: 0644]
mono/metadata/w32handle-namespace.h [new file with mode: 0644]
mono/metadata/w32handle.c [new file with mode: 0644]
mono/metadata/w32handle.h [new file with mode: 0644]
mono/metadata/w32mutex-unix.c [new file with mode: 0644]
mono/metadata/w32mutex-win32.c [new file with mode: 0644]
mono/metadata/w32mutex.h [new file with mode: 0644]
mono/metadata/w32process-internals.h [new file with mode: 0644]
mono/metadata/w32process-unix-bsd.c [new file with mode: 0644]
mono/metadata/w32process-unix-default.c [new file with mode: 0644]
mono/metadata/w32process-unix-haiku.c [new file with mode: 0644]
mono/metadata/w32process-unix-internals.h [new file with mode: 0644]
mono/metadata/w32process-unix-osx.c [new file with mode: 0644]
mono/metadata/w32process-unix.c [new file with mode: 0644]
mono/metadata/w32process-win32-internals.h [new file with mode: 0644]
mono/metadata/w32process-win32-uwp.c [new file with mode: 0644]
mono/metadata/w32process-win32.c [new file with mode: 0644]
mono/metadata/w32process.c [new file with mode: 0644]
mono/metadata/w32process.h [new file with mode: 0644]
mono/metadata/w32semaphore-unix.c [new file with mode: 0644]
mono/metadata/w32semaphore-win32.c [new file with mode: 0644]
mono/metadata/w32semaphore.h [new file with mode: 0644]
mono/mini/.gitignore
mono/mini/Makefile.am.in
mono/mini/abcremoval.c
mono/mini/alias-analysis.c
mono/mini/aot-compiler.c
mono/mini/aot-runtime.c
mono/mini/basic-vectors.cs [new file with mode: 0644]
mono/mini/branch-opts.c
mono/mini/cfold.c
mono/mini/cpu-amd64.md
mono/mini/cpu-arm64.md
mono/mini/cpu-ppc64.md
mono/mini/debugger-agent.c
mono/mini/decompose.c
mono/mini/driver.c
mono/mini/dwarfwriter.c
mono/mini/emitnunit.pl [deleted file]
mono/mini/exceptions-amd64.c
mono/mini/exceptions-arm64.c
mono/mini/exceptions-ppc.c
mono/mini/exceptions-x86.c
mono/mini/generics.cs
mono/mini/graph.c
mono/mini/gshared.cs
mono/mini/image-writer.c
mono/mini/ir-emit.h
mono/mini/jit-icalls.c
mono/mini/jit-icalls.h
mono/mini/linear-scan.c
mono/mini/liveness.c
mono/mini/local-propagation.c
mono/mini/main.c
mono/mini/method-to-ir.c
mono/mini/mini-amd64.c
mono/mini/mini-amd64.h
mono/mini/mini-arm.c
mono/mini/mini-arm.h
mono/mini/mini-arm64.c
mono/mini/mini-arm64.h
mono/mini/mini-codegen.c
mono/mini/mini-darwin.c
mono/mini/mini-exceptions.c
mono/mini/mini-generic-sharing.c
mono/mini/mini-ia64.c
mono/mini/mini-ia64.h
mono/mini/mini-llvm-cpp.cpp
mono/mini/mini-llvm.c
mono/mini/mini-mips.c
mono/mini/mini-mips.h
mono/mini/mini-native-types.c
mono/mini/mini-ops.h
mono/mini/mini-posix.c
mono/mini/mini-ppc.c
mono/mini/mini-ppc.h
mono/mini/mini-runtime.c
mono/mini/mini-s390x.c
mono/mini/mini-sparc.c
mono/mini/mini-trampolines.c
mono/mini/mini-windows-dllmain.c [new file with mode: 0644]
mono/mini/mini-windows-uwp.c [new file with mode: 0644]
mono/mini/mini-windows.c
mono/mini/mini-windows.h [new file with mode: 0644]
mono/mini/mini-x86.c
mono/mini/mini-x86.h
mono/mini/mini.c
mono/mini/mini.h
mono/mini/patch-info.h
mono/mini/simd-intrinsics.c
mono/mini/simd-methods.h
mono/mini/ssa.c
mono/mini/trace.c
mono/mini/tramp-amd64.c
mono/mini/tramp-arm.c
mono/profiler/Makefile.am
mono/profiler/decode.c [deleted file]
mono/profiler/mono-profiler-log.c [new file with mode: 0644]
mono/profiler/mono-profiler-log.h [new file with mode: 0644]
mono/profiler/mono-profiler-vtune.c
mono/profiler/mprof-report.c [new file with mode: 0644]
mono/profiler/proflog.c [deleted file]
mono/profiler/proflog.h [deleted file]
mono/profiler/utils.c [deleted file]
mono/profiler/utils.h [deleted file]
mono/sgen/gc-internal-agnostic.h
mono/sgen/sgen-alloc.c
mono/sgen/sgen-cardtable.c
mono/sgen/sgen-debug.c
mono/sgen/sgen-gc.c
mono/sgen/sgen-gc.h
mono/sgen/sgen-gray.c
mono/sgen/sgen-internal.c
mono/sgen/sgen-layout-stats.c
mono/sgen/sgen-los.c
mono/sgen/sgen-marksweep-drain-gray-stack.h
mono/sgen/sgen-marksweep.c
mono/sgen/sgen-memory-governor.c
mono/sgen/sgen-memory-governor.h
mono/sgen/sgen-protocol.c
mono/sgen/sgen-qsort.c
mono/sgen/sgen-qsort.h
mono/sgen/sgen-workers.c
mono/tests/Makefile.am
mono/tests/TestingReferenceAssembly.cs [new file with mode: 0644]
mono/tests/TestingReferenceReferenceAssembly.cs [new file with mode: 0644]
mono/tests/abort-cctor.cs [new file with mode: 0644]
mono/tests/appdomain-threadpool-unload.cs [new file with mode: 0644]
mono/tests/bug-45841-fpstack-exceptions.il [new file with mode: 0644]
mono/tests/custom-attr-errors.cs
mono/tests/generic-stack-traces.2.cs
mono/tests/libtest.c
mono/tests/namedmutex-destroy-race.cs [new file with mode: 0644]
mono/tests/pinvoke-utf8.cs [new file with mode: 0644]
mono/tests/pinvoke2.cs
mono/tests/pinvoke3.cs
mono/tests/reference-loader.cs [new file with mode: 0644]
mono/tests/sgen-bridge-pathologies.cs
mono/tests/sgen-new-threads-collect.cs [new file with mode: 0644]
mono/tests/test-multi-netmodule-1-netmodule.cs [new file with mode: 0644]
mono/tests/test-multi-netmodule-2-dll1.cs [new file with mode: 0644]
mono/tests/test-multi-netmodule-3-dll2.cs [new file with mode: 0644]
mono/tests/test-multi-netmodule-4-exe.cs [new file with mode: 0644]
mono/tests/thread-native-exit.cs [new file with mode: 0644]
mono/tests/thread-suspend-selfsuspended.cs [new file with mode: 0644]
mono/tests/thread-suspend-suspended.cs [new file with mode: 0644]
mono/unit-tests/test-conc-hashtable.c
mono/unit-tests/test-mono-linked-list-set.c
mono/unit-tests/test-sgen-qsort.c
mono/utils/Makefile.am
mono/utils/atomic.c
mono/utils/atomic.h
mono/utils/checked-build.c
mono/utils/checked-build.h
mono/utils/hazard-pointer.c
mono/utils/hazard-pointer.h
mono/utils/lock-free-alloc.c
mono/utils/lock-free-alloc.h
mono/utils/lock-free-array-queue.c
mono/utils/lock-free-array-queue.h
mono/utils/lock-free-queue.c
mono/utils/mach-support-amd64.c
mono/utils/mach-support-arm.c
mono/utils/mach-support-arm64.c
mono/utils/mach-support-unknown.c
mono/utils/mach-support-x86.c
mono/utils/mach-support.h
mono/utils/mono-codeman.c
mono/utils/mono-compiler.h
mono/utils/mono-conc-hashtable.c
mono/utils/mono-context.c
mono/utils/mono-context.h
mono/utils/mono-coop-mutex.h
mono/utils/mono-counters.c
mono/utils/mono-dl-windows-internals.h [new file with mode: 0644]
mono/utils/mono-dl-windows-uwp.c [new file with mode: 0644]
mono/utils/mono-dl-windows.c
mono/utils/mono-dl.c
mono/utils/mono-error-internals.h
mono/utils/mono-error.c
mono/utils/mono-error.h
mono/utils/mono-hwcap-arm.c
mono/utils/mono-hwcap-arm.h [deleted file]
mono/utils/mono-hwcap-arm64.c
mono/utils/mono-hwcap-arm64.h [deleted file]
mono/utils/mono-hwcap-cross.c [new file with mode: 0644]
mono/utils/mono-hwcap-ia64.c
mono/utils/mono-hwcap-ia64.h [deleted file]
mono/utils/mono-hwcap-mips.c
mono/utils/mono-hwcap-mips.h [deleted file]
mono/utils/mono-hwcap-ppc.c
mono/utils/mono-hwcap-ppc.h [deleted file]
mono/utils/mono-hwcap-s390x.c
mono/utils/mono-hwcap-s390x.h [deleted file]
mono/utils/mono-hwcap-sparc.c
mono/utils/mono-hwcap-vars.h [new file with mode: 0644]
mono/utils/mono-hwcap-x86.c
mono/utils/mono-hwcap-x86.h [deleted file]
mono/utils/mono-hwcap.c
mono/utils/mono-hwcap.h
mono/utils/mono-io-portability.c
mono/utils/mono-linked-list-set.c
mono/utils/mono-linked-list-set.h
mono/utils/mono-log-android.c [new file with mode: 0644]
mono/utils/mono-log-common.c
mono/utils/mono-log-darwin.c [new file with mode: 0644]
mono/utils/mono-log-posix.c
mono/utils/mono-log-windows.c
mono/utils/mono-logger-internals.h
mono/utils/mono-logger.c
mono/utils/mono-logger.h
mono/utils/mono-membar.h
mono/utils/mono-mmap-internals.h
mono/utils/mono-mmap-windows-internals.h [new file with mode: 0644]
mono/utils/mono-mmap-windows-uwp.c [new file with mode: 0644]
mono/utils/mono-mmap-windows.c [new file with mode: 0644]
mono/utils/mono-mmap.c
mono/utils/mono-mmap.h
mono/utils/mono-os-mutex.h
mono/utils/mono-os-semaphore.h
mono/utils/mono-proclib-windows-internals.h [new file with mode: 0644]
mono/utils/mono-proclib-windows-uwp.c [new file with mode: 0644]
mono/utils/mono-proclib-windows.c [new file with mode: 0644]
mono/utils/mono-proclib.c
mono/utils/mono-publib.h
mono/utils/mono-rand-windows-internals.h [new file with mode: 0644]
mono/utils/mono-rand-windows-uwp.c [new file with mode: 0644]
mono/utils/mono-rand-windows.c [new file with mode: 0644]
mono/utils/mono-rand.c
mono/utils/mono-sigcontext.h
mono/utils/mono-threads-coop.c
mono/utils/mono-threads-debug.h [new file with mode: 0644]
mono/utils/mono-threads-mach-abort-syscall.c [deleted file]
mono/utils/mono-threads-mach.c
mono/utils/mono-threads-posix-abort-syscall.c [deleted file]
mono/utils/mono-threads-posix-signals.c
mono/utils/mono-threads-posix-signals.h [deleted file]
mono/utils/mono-threads-posix.c
mono/utils/mono-threads-state-machine.c
mono/utils/mono-threads-windows-abort-syscall.c [deleted file]
mono/utils/mono-threads-windows.c
mono/utils/mono-threads.c
mono/utils/mono-threads.h
mono/utils/mono-tls.h
mono/utils/mono-uri.c
mono/utils/networking-missing.c
mono/utils/os-event-unix.c [new file with mode: 0644]
mono/utils/os-event-win32.c [new file with mode: 0644]
mono/utils/os-event.h [new file with mode: 0644]
mono/utils/w32handle.c [deleted file]
mono/utils/w32handle.h [deleted file]
mono/utils/win64.asm
msvc/eglib.vcxproj
msvc/eglib.vcxproj.filters
msvc/libgcmonosgen.vcxproj
msvc/libgcmonosgen.vcxproj.filters
msvc/libmono-static.vcxproj
msvc/libmono-static.vcxproj.filters
msvc/libmono.vcxproj
msvc/libmono.vcxproj.filters
msvc/libmonoruntime.vcxproj
msvc/libmonoruntime.vcxproj.filters
msvc/libmonoutils.vcxproj
msvc/libmonoutils.vcxproj.filters
msvc/mono-full-aot-compile-test.vcxproj [new file with mode: 0644]
msvc/mono-full-aot-run-test.vcxproj [new file with mode: 0644]
msvc/mono-full-aot-test.props [new file with mode: 0644]
msvc/mono-mini-regression-aot-test.vcxproj [deleted file]
msvc/mono-mini-regression-aot-test.vcxproj.filters [deleted file]
msvc/mono-mini-regression-test-aot.props [deleted file]
msvc/mono-mini-regression-test.props
msvc/mono-mini-regression-test.vcxproj
msvc/mono-nunit-test.props [new file with mode: 0644]
msvc/mono-nunit-test.vcxproj [new file with mode: 0644]
msvc/mono-regression-test-Win32.props [deleted file]
msvc/mono-regression-test-x64.props [deleted file]
msvc/mono-regression-test.props [deleted file]
msvc/mono-test-Win32.props [new file with mode: 0644]
msvc/mono-test-env.props [new file with mode: 0644]
msvc/mono-test-x64.props [new file with mode: 0644]
msvc/mono-test.props [new file with mode: 0644]
msvc/mono-testdriver-test.props [new file with mode: 0644]
msvc/mono-testdriver-test.vcxproj [new file with mode: 0644]
msvc/mono-testdriver-test.vcxproj.filters [new file with mode: 0644]
msvc/mono.def
msvc/mono.props
msvc/mono.sln
msvc/mono.vcxproj
msvc/monodis.vcxproj
msvc/monograph.vcxproj
msvc/monoposixhelper.def
msvc/monoposixhelper.vcxproj
msvc/monoposixhelper.vcxproj.filters
msvc/monosgen.def
msvc/pedump.vcxproj
msvc/pedump.vcxproj.filters
msvc/profiler-vtune.vcxproj
msvc/scripts/csproj.tmpl
msvc/scripts/order.xml
msvc/test-config-setup.bat [new file with mode: 0644]
msvc/test-invoke.vcxproj
msvc/test-metadata.vcxproj
msvc/teste.vcxproj
msvc/winsetup.bat
net_4_x.sln
packaging/MacSDK/__init__.py [new file with mode: 0644]
packaging/MacSDK/fsharp.py [new file with mode: 0644]
packaging/MacSDK/gdk-pixbuf/0001-pixbuf-Add-getter-setter-for-the-2x-variants.patch [new file with mode: 0644]
packaging/MacSDK/gdk-pixbuf/0001-pixbuf-load-2x-variants-as-pixbuf-gobject-data.patch [new file with mode: 0644]
packaging/MacSDK/gtkrc [new file with mode: 0644]
packaging/MacSDK/ironlangs.py [new file with mode: 0644]
packaging/MacSDK/libgdiplus.py [new file with mode: 0644]
packaging/MacSDK/mono-basic.py [new file with mode: 0644]
packaging/MacSDK/mono-llvm.py [new file with mode: 0644]
packaging/MacSDK/mono.py [new file with mode: 0644]
packaging/MacSDK/msbuild.py [new file with mode: 0644]
packaging/MacSDK/nuget.py [new file with mode: 0644]
packaging/MacSDK/packaging/Info.plist [new file with mode: 0644]
packaging/MacSDK/packaging/Info_sdk.plist [new file with mode: 0644]
packaging/MacSDK/packaging/mdk_blacklist.sh [new file with mode: 0755]
packaging/MacSDK/packaging/resources/License.rtf [new file with mode: 0644]
packaging/MacSDK/packaging/resources/ReadMe.rtf [new file with mode: 0644]
packaging/MacSDK/packaging/resources/Welcome.rtf [new file with mode: 0644]
packaging/MacSDK/packaging/resources/distribution.xml [new file with mode: 0644]
packaging/MacSDK/packaging/resources/postinstall [new file with mode: 0755]
packaging/MacSDK/packaging/resources/version.plist [new file with mode: 0644]
packaging/MacSDK/packaging/resources/whitelist.txt [new file with mode: 0644]
packaging/MacSDK/packaging/uninstallMono.sh [new file with mode: 0755]
packaging/MacSDK/patches/find-unused-patches.sh [new file with mode: 0755]
packaging/MacSDK/patches/mcs-pkgconfig.patch [new file with mode: 0644]
packaging/MacSDK/pcl-reference-assemblies.py [new file with mode: 0644]
packaging/MacSDK/profile.py [new file with mode: 0755]
packaging/MacSDK/sqlite.py [new file with mode: 0644]
packaging/MacSDK/xamarin-gtk-theme.py [new file with mode: 0644]
packaging/MacSDK/xsp.py [new file with mode: 0644]
packaging/MacSDKRelease/mono-extensions.py [new file with mode: 0644]
packaging/MacSDKRelease/packaging [new symlink]
packaging/MacSDKRelease/profile.py [new file with mode: 0755]
runtime/Makefile.am
scripts/.gitignore
scripts/Makefile.am
scripts/ci/run-jenkins.sh
scripts/ci/run-test-default.sh
scripts/ci/run-test-profiler-stress-tests.sh [new file with mode: 0755]
scripts/mono-package-runtime [new file with mode: 0755]
support/errno.c
support/map.c
support/map.h
support/stdio.c
support/stdlib.c
support/zlib-helper.c
tools/monograph/monograph.c
tools/offsets-tool/.gitignore
tools/offsets-tool/Makefile
tools/offsets-tool/MonoAotOffsetsDumper.cs
winconfig.h

index d084d3948e49230f088e7e875dd49c409901a7b9..20d831d7e4a2c43ca89426e015f01a2a5b2de344 100644 (file)
        path = external/cecil-legacy
        url = git://github.com/mono/cecil.git
        branch = mono-legacy-0.9.5
+[submodule "external/boringssl"]
+       path = external/boringssl
+       url = git://github.com/mono/boringssl.git
+       branch = mono
+[submodule "external/corefx"]
+       path = external/corefx
+       url = git://github.com/mono/corefx.git
+[submodule "external/bockbuild"]
+       path = external/bockbuild
+       url = git://github.com/mono/bockbuild.git
+[submodule "external/linker"]
+       path = external/linker
+       url = git://github.com/mono/linker.git
index aaffb9842ba9dbe36090cead00afe0d1ebe1232d..74707da14109c704302a1f7eab547e79082b812e 100644 (file)
@@ -49,6 +49,9 @@ dist-hook:
 # Disable this for now because it is very slow and causes wrench to timeout:
 #      test ! -d $(GIT_DIR) || ./scripts/commits-to-changelog.py --root=$(distdir) last-commit-with-compulsory-changelog-entry
 
+mac-sdk-package:
+       external/bockbuild/bb MacSDK --package
+
 pkgconfigdir = $(libdir)/pkgconfig
 noinst_DATA = mono-uninstalled.pc
 DISTCLEANFILES= mono-uninstalled.pc
index 2b583e599be14ae9ab3139c7a11d55e7a1ab574a..15e32dd886d074e63d6f8bb44d2871c34083325e 100644 (file)
--- a/README.md
+++ b/README.md
@@ -15,19 +15,22 @@ The Mono project is part of the [.NET Foundation](http://www.dotnetfoundation.or
 6. [Configuration Options](#configuration-options)
 7. [Working with Submodules](#working-with-submodules)
 
-**Build Status**
-
-Officially supported architectures:
-
-| ubuntu-1404-amd64            | ubuntu-1404-i386            | debian-8-armel            | debian-8-armhf            | debian-8-arm64              | windows-amd64              |
-|------------------------------|-----------------------------|---------------------------|---------------------------|-----------------------------|----------------------------|
-| [![ubuntu-1404-amd64][1]][2] | [![ubuntu-1404-i386][3]][4] | [![debian-8-armel][5]][6] | [![debian-8-armhf][7]][8] | [![debian-8-arm64][9]][10]  | [![windows-amd64][11]][12] |
-
-Community supported architectures:
-
-| centos-s390x              |
-|---------------------------|
-| [![centos-s390x][13]][14] |
+### Build Status
+
+| OS           | Architecture       | Status                       |
+|--------------|--------------------|------------------------------|
+| Ubuntu 14.04 | amd64              | [![ubuntu-1404-amd64][1]][2] |
+| Ubuntu 14.04 | i386               | [![ubuntu-1404-i386][3]][4]  |
+| Debian 8     | armel              | [![debian-8-armel][5]][6]    |
+| Debian 8     | armhf              | [![debian-8-armhf][7]][8]    |
+| Debian 8     | arm64              | [![debian-8-arm64][9]][10]   |
+| OS X         | amd64              | [![osx-amd64][11]][12]       |
+| OS X         | i386               | [![osx-i386][13]][14]        |
+| Windows      | amd64              | [![windows-amd64][15]][16]   |
+| Windows      | i386               | [![windows-amd64][17]][18]   |
+| CentOS       | s390x (cs)         | [![centos-s390x][19]][20]    |
+
+_(cs) = community supported architecture_
 
 [1]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=ubuntu-1404-amd64/badge/icon
 [2]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=ubuntu-1404-amd64
@@ -39,10 +42,16 @@ Community supported architectures:
 [8]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-8-armhf/
 [9]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-8-arm64/badge/icon
 [10]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-8-arm64/
-[11]: https://ci.appveyor.com/api/projects/status/1e61ebdfpbiei58v/branch/master?svg=true
-[12]: https://ci.appveyor.com/project/ajlennon/mono-817/branch/master
-[13]: https://jenkins.mono-project.com/job/z/label=centos-s390x/badge/icon
-[14]: https://jenkins.mono-project.com/job/z/label=centos-s390x
+[11]: https://jenkins.mono-project.com/job/test-mono-mainline/label=osx-amd64/badge/icon
+[12]: https://jenkins.mono-project.com/job/test-mono-mainline/label=osx-amd64/
+[13]: https://jenkins.mono-project.com/job/test-mono-mainline/label=osx-i386/badge/icon
+[14]: https://jenkins.mono-project.com/job/test-mono-mainline/label=osx-i386/
+[15]: https://jenkins.mono-project.com/job/z/label=w64/badge/icon
+[16]: https://jenkins.mono-project.com/job/z/label=w64/
+[17]: https://jenkins.mono-project.com/job/z/label=w32/badge/icon
+[18]: https://jenkins.mono-project.com/job/z/label=w32/
+[19]: https://jenkins.mono-project.com/job/z/label=centos-s390x/badge/icon
+[20]: https://jenkins.mono-project.com/job/z/label=centos-s390x
 
 Compilation and Installation
 ============================
index 522cb36c9ea47999dfd6dbe7474f11567a1aa1b8..c03adcc0c45f20f7be507986a6ddd4437ccfdb9b 100644 (file)
@@ -1,4 +1,5 @@
 ACCEPTANCE_TESTS_PATH=external
+BENCHMARKER_PATH=$(ACCEPTANCE_TESTS_PATH)/benchmarker
 ROSLYN_PATH=$(ACCEPTANCE_TESTS_PATH)/roslyn
 CORECLR_PATH=$(ACCEPTANCE_TESTS_PATH)/coreclr
 MSTESTSUITE_PATH=$(ACCEPTANCE_TESTS_PATH)/ms-test-suite
@@ -14,10 +15,11 @@ MCS = $(RUNTIME) $(mcs_topdir)/class/lib/build/mcs.exe
 ILASM = $(RUNTIME) $(CLASS)/ilasm.exe
 
 include versions.mk
+include profiler-stress.mk
 include roslyn.mk
 include coreclr.mk
 include ms-test-suite.mk
 
-check-full: check-roslyn check-coreclr check-ms-test-suite
+check-full: check-profiler-stress check-roslyn check-coreclr check-ms-test-suite
 
 clean-local: clean-local-coreclr
index 8287c176abcc939d505a19034ebe3baa7411df2b..9df7b8a5811328aafe3a0a58c0def29cf80ec5bb 100644 (file)
   {
     "name": "ms-test-suite", 
     "url": "git@github.com:xamarin/ms-test-suite.git", 
-    "rev": "bcd16462b0b427c582c2b4c81846a42d7ccd527f", 
+    "rev": "55b6637eb1de61c743323ec82db1e0cadfee5b32", 
     "remote-branch": "origin/master", 
     "branch": "master", 
     "directory": "ms-test-suite"
+  }, 
+  {
+    "name": "benchmarker", 
+    "url": "git://github.com/xamarin/benchmarker.git", 
+    "rev": "97f618cd585af549dd861b7c142656c496f6a89b", 
+    "remote-branch": "origin/master", 
+    "branch": "master", 
+    "directory": "benchmarker"
   }
-]
+]
\ No newline at end of file
index bd85bd494bd3b5e960de1e90ffc6c07330dbeb88..1516dc61db68079b727791a9af45918375955c7a 100644 (file)
@@ -1,10 +1,13 @@
-check-ms-test-suite:
+check-ms-test-suite: $(CLASS)/nunitlite.dll
        @if $(MAKE) validate-ms-test-suite RESET_VERSIONS=1; then \
-               $(MAKE) -C $(MSTESTSUITE_PATH)/conformance build MCS="$(MCS) -debug -t:library -warn:1 -r:nunit.framework" && \
-               $(MAKE) -C $(MSTESTSUITE_PATH)/conformance run NUNIT-CONSOLE="$(RUNTIME) $(CLASS)/nunit-console.exe -nologo -exclude=MonoBug,BadTest" NUNIT_XML_RESULT=$(abs_top_builddir)/acceptance-tests/TestResult-ms-test-suite-conformance.xml || EXIT_CODE=1; \
+               $(MAKE) -C $(MSTESTSUITE_PATH)/conformance build MCS="$(MCS) -debug -t:library -warn:1 -r:$(CLASS)/nunitlite.dll" && \
+               $(MAKE) -C $(MSTESTSUITE_PATH)/conformance run NUNIT-CONSOLE="$(RUNTIME) $(CLASS)/nunit-lite-console.exe -exclude=MonoBug,BadTest -format:nunit2" NUNIT_XML_RESULT="-result:$(abs_top_builddir)/acceptance-tests/TestResult-ms-test-suite-conformance.xml" || EXIT_CODE=1; \
                $(MAKE) -C $(MSTESTSUITE_PATH)/systemruntimebringup build MCS="$(MCS) -debug -warn:1" && \
                $(MAKE) -C $(MSTESTSUITE_PATH)/systemruntimebringup run MONO="$(RUNTIME)" || EXIT_CODE=1; \
                exit $$EXIT_CODE; \
        else \
                echo "*** [ms-test-suite] Getting the repository failed, you probably don't have access to this Xamarin-internal resource. Skipping."; \
        fi
+
+$(CLASS)/nunitlite.dll:
+       $(MAKE) -C $(mcs_topdir)/tools/nunit-lite
diff --git a/acceptance-tests/profiler-stress.mk b/acceptance-tests/profiler-stress.mk
new file mode 100644 (file)
index 0000000..ff67772
--- /dev/null
@@ -0,0 +1,13 @@
+SYS_REFS = \
+       System.dll \
+       System.Core.dll \
+       System.Data.dll \
+       System.Runtime.Serialization.dll \
+       System.Xml.dll \
+       System.Xml.Linq.dll \
+       Mono.Posix.dll
+
+check-profiler-stress:
+       @$(MAKE) validate-benchmarker RESET_VERSIONS=1
+       cd profiler-stress && $(MCS) -target:exe $(addprefix -r:, $(SYS_REFS)) -out:runner.exe @runner.exe.sources
+       cd profiler-stress && $(RUNTIME) runner.exe
diff --git a/acceptance-tests/profiler-stress/runner.cs b/acceptance-tests/profiler-stress/runner.cs
new file mode 100644 (file)
index 0000000..5ef4ab0
--- /dev/null
@@ -0,0 +1,278 @@
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Threading;
+using System.Xml;
+using Mono.Unix.Native;
+using Newtonsoft.Json;
+
+// Shut up CLS compliance warnings from Json.NET.
+[assembly: CLSCompliant (true)]
+
+namespace Mono.Profiling.Tests.Stress {
+
+       // https://github.com/xamarin/benchmarker/blob/master/tools/libdbmodel/Benchmark.cs
+       sealed class Benchmark {
+
+               public string Name { get; set; }
+               public string TestDirectory { get; set; }
+               public bool OnlyExplicit { get; set; }
+               public string[] CommandLine { get; set; }
+               public string[] ClientCommandLine { get; set; }
+               public string[] AOTAssemblies { get; set; }
+
+               public static Benchmark Load (string file)
+               {
+                       return JsonConvert.DeserializeObject<Benchmark> (File.ReadAllText (file));
+               }
+       }
+
+       sealed class TestResult {
+
+               public Benchmark Benchmark { get; set; }
+               public ProcessStartInfo StartInfo { get; set; }
+               public Stopwatch Stopwatch { get; set; } = new Stopwatch ();
+               public int? ExitCode { get; set; }
+               public StringBuilder StandardOutput { get; set; } = new StringBuilder ();
+               public StringBuilder StandardError { get; set; } = new StringBuilder ();
+       }
+
+       static class Program {
+
+               static readonly TimeSpan _timeout = TimeSpan.FromHours (6);
+
+               static string FilterInvalidXmlChars (string text) {
+                       return Regex.Replace (text, @"[^\x09\x0A\x0D\x20-\uD7FF\uE000-\uFFFD\u10000-\u10FFFF]", string.Empty);
+               }
+
+               static int Main ()
+               {
+                       var depDir = Path.Combine ("..", "external", "benchmarker");
+                       var benchDir = Path.Combine (depDir, "benchmarks");
+                       var testDir = Path.Combine (depDir, "tests");
+
+                       var benchmarks = Directory.EnumerateFiles (benchDir, "*.benchmark")
+                                        .Select (Benchmark.Load)
+                                        .Where (b => !b.OnlyExplicit && b.ClientCommandLine == null)
+                                        .OrderBy (b => b.Name)
+                                        .ToArray ();
+
+                       var monoPath = Path.GetFullPath (Path.Combine ("..", "..", "runtime", "mono-wrapper"));
+                       var classDir = Path.GetFullPath (Path.Combine ("..", "..", "mcs", "class", "lib", "net_4_x"));
+
+                       var rand = new Random ();
+                       var cpus = Environment.ProcessorCount;
+
+                       var results = new List<TestResult> (benchmarks.Length);
+
+                       var sw = Stopwatch.StartNew ();
+
+                       for (var i = 0; i < benchmarks.Length; i++) {
+                               var bench = benchmarks [i];
+
+                               var sampleFreq = rand.Next (0, 1001);
+                               var sampleMode = rand.Next (0, 2) == 1 ? "real" : "process";
+                               var maxSamples = rand.Next (0, cpus * 2000 + 1);
+                               var heapShotFreq = rand.Next (0, 11);
+                               var maxFrames = rand.Next (0, 33);
+                               var allocMode = rand.Next (0, 2) == 1 ? "alloc" : "noalloc";
+
+                               var profOptions = $"sample=cycles/{sampleFreq},sampling-{sampleMode},maxsamples={maxSamples},heapshot={heapShotFreq}gc,maxframes={maxFrames},{allocMode},output=/dev/null";
+
+                               var info = new ProcessStartInfo {
+                                       UseShellExecute = false,
+                                       WorkingDirectory = Path.Combine (testDir, bench.TestDirectory),
+                                       FileName = monoPath,
+                                       Arguments = $"--debug --profile=log:{profOptions} " + string.Join (" ", bench.CommandLine),
+                                       RedirectStandardOutput = true,
+                                       RedirectStandardError = true,
+                               };
+
+                               info.EnvironmentVariables.Clear ();
+                               info.EnvironmentVariables.Add ("MONO_PATH", classDir);
+
+                               var progress = $"({i + 1}/{benchmarks.Length})";
+
+                               Console.ForegroundColor = ConsoleColor.Blue;
+                               Console.WriteLine ($"[{sw.Elapsed.ToString ("G")}] {progress} Running {bench.Name} with profiler options: {profOptions}");
+                               Console.ResetColor ();
+
+                               var result = new TestResult {
+                                       Benchmark = bench,
+                                       StartInfo = info,
+                               };
+
+                               using (var proc = new Process ()) {
+                                       proc.StartInfo = info;
+
+                                       proc.OutputDataReceived += (sender, args) => {
+                                               if (args.Data != null)
+                                                       result.StandardOutput.AppendLine (args.Data);
+                                       };
+
+                                       proc.ErrorDataReceived += (sender, args) => {
+                                               if (args.Data != null)
+                                                       result.StandardError.AppendLine (args.Data);
+                                       };
+
+                                       result.Stopwatch.Start ();
+
+                                       proc.Start ();
+
+                                       proc.BeginOutputReadLine ();
+                                       proc.BeginErrorReadLine ();
+
+                                       if (!proc.WaitForExit ((int) _timeout.TotalMilliseconds)) {
+                                               // Force a thread dump.
+                                               Syscall.kill (proc.Id, Signum.SIGQUIT);
+                                               Thread.Sleep (1000);
+
+                                               try {
+                                                       proc.Kill ();
+                                               } catch (Exception) {
+                                               }
+                                       } else
+                                               result.ExitCode = proc.ExitCode;
+
+                                       result.Stopwatch.Stop ();
+                               }
+
+                               var resultStr = result.ExitCode == null ? "timed out" : $"exited with code: {result.ExitCode}";
+
+                               Console.ForegroundColor = result.ExitCode != 0 ? ConsoleColor.Red : ConsoleColor.Green;
+                               Console.WriteLine ($"[{sw.Elapsed.ToString ("G")}] {progress} {bench.Name} took {result.Stopwatch.Elapsed.ToString ("G")} and {resultStr}");
+                               Console.ResetColor ();
+
+                               if (result.ExitCode != 0) {
+                                       Console.ForegroundColor = ConsoleColor.Red;
+                                       Console.WriteLine ("===== stdout =====");
+                                       Console.ResetColor ();
+
+                                       Console.WriteLine (result.StandardOutput.ToString ());
+
+                                       Console.ForegroundColor = ConsoleColor.Red;
+                                       Console.WriteLine ("===== stderr =====");
+                                       Console.ResetColor ();
+
+                                       Console.WriteLine (result.StandardError.ToString ());
+                               }
+
+                               results.Add (result);
+                       }
+
+                       sw.Stop ();
+
+                       var successes = results.Count (r => r.ExitCode == 0);
+                       var failures = results.Count (r => r.ExitCode != null && r.ExitCode != 0);
+                       var timeouts = results.Count (r => r.ExitCode == null);
+
+                       var settings = new XmlWriterSettings {
+                               NewLineOnAttributes = true,
+                               Indent = true,
+                       };
+
+                       using (var writer = XmlWriter.Create ("TestResult-profiler-stress.xml", settings)) {
+                               writer.WriteStartDocument ();
+                               writer.WriteComment ("This file represents the results of running a test suite");
+
+                               writer.WriteStartElement ("test-results");
+                               writer.WriteAttributeString ("name", "profiler-stress-tests.dummy");
+                               writer.WriteAttributeString ("total", results.Count.ToString ());
+                               writer.WriteAttributeString ("failures", failures.ToString ());
+                               writer.WriteAttributeString ("not-run", "0");
+                               writer.WriteAttributeString ("date", DateTime.Now.ToString ("yyyy-MM-dd"));
+                               writer.WriteAttributeString ("time", DateTime.Now.ToString ("HH:mm:ss"));
+
+                               writer.WriteStartElement ("environment");
+                               writer.WriteAttributeString ("nunit-version", "2.4.8.0");
+                               writer.WriteAttributeString ("clr-version", Environment.Version.ToString ());
+                               writer.WriteAttributeString ("os-version", Environment.OSVersion.ToString ());
+                               writer.WriteAttributeString ("platform", Environment.OSVersion.Platform.ToString ());
+                               writer.WriteAttributeString ("cwd", Environment.CurrentDirectory);
+                               writer.WriteAttributeString ("machine-name", Environment.MachineName);
+                               writer.WriteAttributeString ("user", Environment.UserName);
+                               writer.WriteAttributeString ("user-domain", Environment.UserDomainName);
+                               writer.WriteEndElement ();
+
+                               writer.WriteStartElement ("culture-info");
+                               writer.WriteAttributeString ("current-culture", CultureInfo.CurrentCulture.Name);
+                               writer.WriteAttributeString ("current-uiculture", CultureInfo.CurrentUICulture.Name);
+                               writer.WriteEndElement ();
+
+                               writer.WriteStartElement ("test-suite");
+                               writer.WriteAttributeString ("name", "profiler-stress-tests.dummy");
+                               writer.WriteAttributeString ("success", (failures + timeouts == 0).ToString ());
+                               writer.WriteAttributeString ("time", ((int) sw.Elapsed.TotalSeconds).ToString ());
+                               writer.WriteAttributeString ("asserts", (failures + timeouts).ToString ());
+                               writer.WriteStartElement ("results");
+
+                               writer.WriteStartElement ("test-suite");
+                               writer.WriteAttributeString ("name", "MonoTests");
+                               writer.WriteAttributeString ("success", (failures + timeouts == 0).ToString ());
+                               writer.WriteAttributeString ("time", ((int) sw.Elapsed.TotalSeconds).ToString ());
+                               writer.WriteAttributeString ("asserts", (failures + timeouts).ToString ());
+                               writer.WriteStartElement ("results");
+
+                               writer.WriteStartElement ("test-suite");
+                               writer.WriteAttributeString ("name", "profiler-stress");
+                               writer.WriteAttributeString ("success", (failures + timeouts == 0).ToString ());
+                               writer.WriteAttributeString ("time", ((int) sw.Elapsed.TotalSeconds).ToString ());
+                               writer.WriteAttributeString ("asserts", (failures + timeouts).ToString ());
+                               writer.WriteStartElement ("results");
+
+                               foreach (var result in results) {
+                                       var timeoutStr = result.ExitCode == null ? "_timeout" : string.Empty;
+
+                                       writer.WriteStartElement ("test-case");
+                                       writer.WriteAttributeString ("name", $"MonoTests.profiler-stress.{result.Benchmark.Name}{timeoutStr}");
+                                       writer.WriteAttributeString ("executed", "True");
+                                       writer.WriteAttributeString ("success", (result.ExitCode == 0).ToString ());
+                                       writer.WriteAttributeString ("time", ((int) result.Stopwatch.Elapsed.TotalSeconds).ToString ());
+                                       writer.WriteAttributeString ("asserts", result.ExitCode == 0 ? "0" : "1");
+
+                                       if (result.ExitCode != 0) {
+                                               writer.WriteStartElement ("failure");
+
+                                               writer.WriteStartElement ("message");
+                                               writer.WriteCData (FilterInvalidXmlChars (result.StandardOutput.ToString ()));
+                                               writer.WriteEndElement ();
+
+                                               writer.WriteStartElement ("stack-trace");
+                                               writer.WriteCData (FilterInvalidXmlChars (result.StandardError.ToString ()));
+                                               writer.WriteEndElement ();
+
+                                               writer.WriteEndElement ();
+                                       }
+
+                                       writer.WriteEndElement ();
+                               }
+
+                               writer.WriteEndElement ();
+                               writer.WriteEndElement ();
+
+                               writer.WriteEndElement ();
+                               writer.WriteEndElement ();
+
+                               writer.WriteEndElement ();
+                               writer.WriteEndElement ();
+
+                               writer.WriteEndElement ();
+
+                               writer.WriteEndDocument ();
+                       }
+
+                       var failureStr = failures + timeouts != 0 ? $" ({failures} failures, {timeouts} timeouts)" : string.Empty;
+
+                       Console.ForegroundColor = failures + timeouts != 0 ? ConsoleColor.Red : ConsoleColor.Green;
+                       Console.WriteLine ($"[{sw.Elapsed.ToString ("G")}] Finished with {successes}/{results.Count} passing tests{failureStr}");
+                       Console.ResetColor ();
+
+                       return failures + timeouts;
+               }
+       }
+}
diff --git a/acceptance-tests/profiler-stress/runner.exe.sources b/acceptance-tests/profiler-stress/runner.exe.sources
new file mode 100644 (file)
index 0000000..fc734ed
--- /dev/null
@@ -0,0 +1,156 @@
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Bson/BsonBinaryType.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Bson/BsonBinaryWriter.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Bson/BsonReader.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Bson/BsonToken.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Bson/BsonType.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Bson/BsonWriter.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Bson/BsonObjectId.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Converters/BinaryConverter.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Converters/DataSetConverter.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Converters/DataTableConverter.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Converters/CustomCreationConverter.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Converters/DateTimeConverterBase.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Converters/EntityKeyMemberConverter.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Converters/ExpandoObjectConverter.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Converters/KeyValuePairConverter.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Converters/BsonObjectIdConverter.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Converters/RegexConverter.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Converters/StringEnumConverter.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/ConstructorHandling.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Converters/VersionConverter.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/DateFormatHandling.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/DateTimeZoneHandling.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Formatting.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/JsonConstructorAttribute.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/JsonPosition.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Linq/JPropertyKeyedCollection.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/DynamicProxy.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Linq/JPath.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Linq/JRaw.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Required.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/JsonDynamicContract.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/JsonFormatterConverter.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/JsonISerializableContract.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/JsonLinqContract.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/JsonPrimitiveContract.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/DynamicValueProvider.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/ErrorEventArgs.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Linq/JPropertyDescriptor.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/DefaultReferenceResolver.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/PreserveReferencesHandling.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/IJsonLineInfo.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/JsonArrayAttribute.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/JsonContainerAttribute.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/DefaultValueHandling.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/JsonConverterAttribute.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/JsonObjectAttribute.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/JsonSerializerSettings.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/JsonValidatingReader.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Linq/IJEnumerable.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Linq/JTokenEqualityComparer.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/MemberSerialization.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/ObjectCreationHandling.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Converters/IsoDateTimeConverter.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Converters/JavaScriptDateTimeConverter.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Converters/XmlNodeConverter.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/JsonTextReader.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/JsonPropertyAttribute.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/JsonIgnoreAttribute.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/JsonTextWriter.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/JsonWriterException.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/JsonReaderException.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/JsonConverter.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/JsonConverterCollection.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/JsonReader.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/JsonConvert.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/JsonSerializationException.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/JsonSerializer.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Linq/Extensions.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Linq/JConstructor.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Linq/JContainer.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Linq/JEnumerable.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Linq/JObject.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Linq/JArray.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Linq/JTokenReader.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Linq/JTokenWriter.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Linq/JToken.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Linq/JProperty.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Linq/JTokenType.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Linq/JValue.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Schema/Extensions.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Schema/JsonSchemaException.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Schema/JsonSchemaModel.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Schema/JsonSchemaModelBuilder.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Schema/JsonSchemaNodeCollection.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Schema/JsonSchemaNode.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Schema/JsonSchemaResolver.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Schema/JsonSchemaWriter.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Schema/UndefinedSchemaIdHandling.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Schema/ValidationEventArgs.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Schema/ValidationEventHandler.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/CamelCasePropertyNamesContractResolver.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/DefaultContractResolver.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/DefaultSerializationBinder.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/ErrorContext.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/IContractResolver.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/IValueProvider.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/JsonArrayContract.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/JsonContract.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/JsonDictionaryContract.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/JsonProperty.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/JsonPropertyCollection.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/MissingMemberHandling.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/NullValueHandling.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/ReferenceLoopHandling.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Schema/JsonSchema.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Schema/JsonSchemaBuilder.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Schema/JsonSchemaConstants.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Schema/JsonSchemaGenerator.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/IReferenceResolver.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Schema/JsonSchemaType.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/JsonObjectContract.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/JsonSerializerInternalBase.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/JsonSerializerInternalWriter.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/JsonSerializerProxy.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/JsonStringContract.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/JsonTypeReflector.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/CachedAttributeGetter.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/LateBoundMetadataTypeAttribute.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/ReflectionValueProvider.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/OnErrorAttribute.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/Base64Encoder.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/DynamicProxyMetaObject.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/DynamicUtils.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/DynamicWrapper.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/DynamicReflectionDelegateFactory.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/ObjectConstructor.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/ILGeneratorExtensions.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/ReflectionDelegateFactory.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/LateBoundReflectionDelegateFactory.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/MethodCall.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/StringReference.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/ThreadSafeStore.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/TypeNameHandling.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/BidirectionalDictionary.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/ConvertUtils.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/CollectionWrapper.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/DateTimeUtils.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/DictionaryWrapper.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/EnumUtils.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/EnumValue.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/EnumValues.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/JavaScriptUtils.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/JsonToken.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/JsonWriter.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/StringBuffer.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/CollectionUtils.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/ListWrapper.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/MathUtils.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/MiscellaneousUtils.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/ReflectionUtils.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/StringUtils.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/TypeExtensions.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/ValidationUtils.cs
+../../external/Newtonsoft.Json/Src/Newtonsoft.Json/WriteState.cs
+runner.cs
index 84b4f85c6cdc1dd693b8a41f339693b0fb73fecf..0c070a0f11462278e44c1b024c2e2408e92bc375 100644 (file)
@@ -3,28 +3,35 @@
 SUBMODULES_CONFIG_FILE = $(top_srcdir)/acceptance-tests/SUBMODULES.json
 include $(top_srcdir)/scripts/submodules/versions.mk
 
+$(eval $(call ValidateVersionTemplate,benchmarker,BENCHMARKER))
 $(eval $(call ValidateVersionTemplate,roslyn,ROSLYN))
 $(eval $(call ValidateVersionTemplate,coreclr,CORECLR))
 $(eval $(call ValidateVersionTemplate,ms-test-suite,MSTESTSUITE))
 
 # Bump the given submodule to the revision given by the REV make variable
 # If COMMIT is 1, commit the change
+bump-benchmarker: __bump-benchmarker
 bump-roslyn: __bump-version-roslyn
 bump-coreclr: __bump-version-coreclr
 bump-ms-test-suite: __bump-version-ms-test-suite
 
 # Bump the given submodule to the branch given by the BRANCH/REMOTE_BRANCH make variables
 # If COMMIT is 1, commit the change
+bump-branch-benchmarker: __bump-branch-benchmarker
 bump-branch-roslyn: __bump-branch-roslyn
 bump-branch-coreclr: __bump-branch-coreclr
 bump-branch-ms-test-suite: __bump-branch-ms-test-suite
 
 # Bump the given submodule to its current GIT version
 # If COMMIT is 1, commit the change
+bump-current-benchmarker: __bump-current-benchmarker
 bump-current-roslyn: __bump-current-version-roslyn
 bump-current-coreclr: __bump-current-version-coreclr
 bump-current-ms-test-suite: __bump-current-version-ms-test-suite
 
+commit-bump-benchmarker:
+       $(MAKE) bump-benchmarker COMMIT=1
+
 commit-bump-roslyn:
        $(MAKE) bump-roslyn COMMIT=1
 
@@ -34,6 +41,9 @@ commit-bump-coreclr:
 commit-bump-ms-test-suite:
        $(MAKE) bump-ms-test-suite COMMIT=1
 
+commit-bump-current-benchmarker:
+       $(MAKE) bump-current-benchmarker COMMIT=1
+
 commit-bump-current-roslyn:
        $(MAKE) bump-current-roslyn COMMIT=1
 
diff --git a/appveyor.yml b/appveyor.yml
deleted file mode 100644 (file)
index 8fa713a..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-#
-# Appveyor configuration file for CI build of Mono on Windows (under Cygwin)
-#
-# For further details see http://www.appveyor.com
-#
-
-#
-# Custom environment variables
-#
-environment:
-    global:
-        CYG_ROOT: C:\cygwin
-        CYG_MIRROR: http://cygwin.mirror.constant.com
-        CYG_CACHE: C:\cygwin\var\cache\setup
-        CYG_BASH: C:\cygwin\bin\bash
-
-#
-# Cache Cygwin files to speed up build
-#
-cache:
-    - '%CYG_CACHE%'
-
-#
-# Do a shallow clone of the repo to speed up build
-#
-clone_depth: 1
-
-#
-# Initialisation prior to pulling the Mono repository
-# Attempt to ensure we don't try to convert line endings to Win32 CRLF as this will cause build to fail
-#
-init:
-    - git config --global core.autocrlf input
-
-#
-# Install needed build dependencies
-# 
-install:
-    - ps: 'Start-FileDownload "http://cygwin.com/setup-x86.exe" -FileName "setup-x86.exe"'
-    - 'setup-x86.exe --quiet-mode --no-shortcuts --only-site --root "%CYG_ROOT%" --site "%CYG_MIRROR%" --local-package-dir "%CYG_CACHE%" --packages autoconf,automake,bison,gcc-core,gcc-g++,mingw-runtime,mingw-binutils,mingw-gcc-core,mingw-gcc-g++,mingw-pthreads,mingw-w32api,libtool,make,python,gettext-devel,gettext,intltool,libiconv,pkg-config,git,curl,libxslt > NUL 2>&1'
-    - '%CYG_BASH% -lc "cygcheck -dc cygwin"'
-
-# Cygwin build script
-#
-# NOTES:
-#
-# The stdin/stdout file descriptor appears not to be valid for the Appveyor
-# build which causes failures as certain functions attempt to redirect 
-# default file handles. Ensure a dummy file descriptor is opened with 'exec'.
-#
-build_script:
-    - 'echo Building...'
-    - '%CYG_BASH% -lc "cd $APPVEYOR_BUILD_FOLDER; exec 0</dev/null; ./autogen.sh --prefix=/usr/local --host=i686-pc-mingw32"'
-    - '%CYG_BASH% -lc "cd $APPVEYOR_BUILD_FOLDER; exec 0</dev/null; make get-monolite-latest"'
-    - '%CYG_BASH% -lc "cd $APPVEYOR_BUILD_FOLDER; exec 0</dev/null; make -j2"'
-    - 'echo Installing...'
-    - 'mkdir %APPVEYOR_BUILD_FOLDER%\install'
-    - '%CYG_BASH% -lc "export CYGWIN=winsymlinks:native; mount \"$APPVEYOR_BUILD_FOLDER\install\" /usr/local; cd $APPVEYOR_BUILD_FOLDER; exec 0</dev/null; make install; umount /usr/local"'
-
-#
-# Disable tests for now
-# 
-test: off
-
-#
-# Only build the master branch
-#
-branches:
-  only:
-    - master
-
-#
-# NOTE: Currently this is the Mono installation tree. In future we will create an installation package artifact.
-#       It has to be relative to the project path. Thus we have installed to within the build tree.
-#
-artifacts:
-    - path: install
-      name: mono-binaries
-      type: zip
index ef3e89663e9ff1c949d83dab99c8a88870da81a5..7021be1ecfb5876dd4e87b29afae390edda38511 100644 (file)
@@ -2,7 +2,7 @@
 #AC_PREREQ([2.62])
 
 # when bumping version number below, keep it in sync with man/mono.1 too
-AC_INIT(mono, [4.7.0],
+AC_INIT(mono, [4.9.0],
         [http://bugzilla.xamarin.com/enter_bug.cgi?classification=Mono])
 
 AC_CONFIG_SRCDIR([README.md])
@@ -52,6 +52,8 @@ CPPFLAGS_FOR_LIBGC=$CPPFLAGS
 CFLAGS_FOR_LIBGC=$CFLAGS
 CPPFLAGS_FOR_EGLIB=$CPPFLAGS
 CFLAGS_FOR_EGLIB=$CFLAGS
+CPPFLAGS_FOR_BTLS=$CPPFLAGS
+CFLAGS_FOR_BTLS=$CFLAGS
 
 # libgc uses some deprecated APIs
 CFLAGS_FOR_LIBGC="$CFLAGS -Wno-deprecated-declarations"
@@ -66,7 +68,11 @@ AC_SUBST(libmono_cflags)
 AC_SUBST(libmono_ldflags)
 
 # Variable to have relocatable .pc files (lib, or lib64)
-reloc_libdir=`basename ${libdir}`
+# realpath isn't always available, and requires that all but the tip of the provided
+# path exists. Fall back to the old behaviour, but realpath allows depth >1
+# e.g. Debian puts Mono in /usr/bin and libs in /usr/lib/x86_64-linux-gnu/ which is
+# too deep for the old method to work
+reloc_libdir=`realpath --relative-to=${prefix} ${libdir} 2> /dev/null || basename ${libdir}`
 AC_SUBST(reloc_libdir)
 
 # Set to yes if Unix sockets cannot be created in an anonymous namespace
@@ -111,6 +117,7 @@ case "$host" in
                libgc_threads=win32
                with_sigaltstack=no
                with_tls=pthread
+               with_sgen_default_concurrent=yes
                LN_S=cp
                # This forces libgc to use the DllMain based thread registration code on win32
                libgc_configure_args="$libgc_configure_args --enable-win32-dllmain=yes"
@@ -126,6 +133,7 @@ case "$host" in
                libgc_threads=pthreads
                with_sigaltstack=no
                use_sigposix=yes
+               with_sgen_default_concurrent=yes
                ;;
        *-*-kfreebsd*-gnu)
                CPPFLAGS="$CPPFLAGS -DGC_FREEBSD_THREADS -D_GNU_SOURCE -D_REENTRANT -DUSE_MMAP -DUSE_MUNMAP -DTHREAD_LOCAL_ALLOC -pthread"
@@ -136,6 +144,7 @@ case "$host" in
                need_link_unlink=yes
                with_sigaltstack=no
                use_sigposix=yes
+               with_sgen_default_concurrent=yes
                ;;
        *-*-*freebsd*)
                if test "x$PTHREAD_CFLAGS" = "x"; then
@@ -159,6 +168,7 @@ case "$host" in
                libgc_threads=pthreads
                use_sigposix=yes
                has_dtrace=yes
+               with_sgen_default_concurrent=yes
                ;;
        *-*-*openbsd*)
                CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE -DGC_OPENBSD_THREADS -DPLATFORM_BSD -D_REENTRANT -DUSE_MMAP"
@@ -173,6 +183,7 @@ case "$host" in
                libgc_threads=pthreads
                with_sigaltstack=no
                use_sigposix=yes
+               with_sgen_default_concurrent=yes
                ;;
        *-*-linux-android*)
                platform_android=yes
@@ -236,6 +247,7 @@ case "$host" in
                        disable_munmap=yes
                        ;;
                esac
+               with_sgen_default_concurrent=yes
                ;;
        *-*-nacl*)
                CPPFLAGS="$CPPFLAGS -DGC_LINUX_THREADS -D_GNU_SOURCE -D_REENTRANT -DUSE_MMAP"
@@ -308,8 +320,10 @@ case "$host" in
                                CFLAGS_FOR_LIBGC="$CFLAGS_FOR_LIBGC $BROKEN_DARWIN_FLAGS"
                                CPPFLAGS_FOR_EGLIB="$CPPFLAGS_FOR_EGLIB $BROKEN_DARWIN_CPPFLAGS"
                                CFLAGS_FOR_EGLIB="$CFLAGS_FOR_EGLIB $BROKEN_DARWIN_FLAGS"
+                               with_sgen_default_concurrent=yes
                                ;;
                        x*64-*-darwin*)
+                               with_sgen_default_concurrent=yes
                                ;;
                        arm*-darwin*)
                                has_dtrace=no
@@ -345,6 +359,10 @@ if test x$target_win32 = xyes; then
    AC_DEFINE(TARGET_WIN32, 1, [Target Platform is Win32])
 fi
 
+# Defined for all targets/platforms using classic Windows API support.
+AC_DEFINE(HAVE_CLASSIC_WINAPI_SUPPORT, 1, [Use classic Windows API support])
+AC_DEFINE(HAVE_UWP_WINAPI_SUPPORT, 0, [Don't use UWP Windows API support])
+
 AC_SUBST(extra_runtime_ldflags)
 AM_CONDITIONAL(HOST_WIN32, test x$host_win32 = xyes)
 AM_CONDITIONAL(TARGET_WIN32, test x$target_win32 = xyes)
@@ -532,9 +550,6 @@ if test x"$GCC" = xyes; then
                # We rely on signed overflow to behave
                CFLAGS="$CFLAGS -fwrapv"
 
-               # We rely on zero length arrays in structs
-               CFLAGS="$CFLAGS -Wno-zero-length-array"
-
                CFLAGS="$CFLAGS -DMONO_DLL_EXPORT"
                if test x"$disable_visibility_hidden" = xno; then
                   # Don't export any symbols by default
@@ -561,6 +576,8 @@ if test x"$GCC" = xyes; then
                   # https://bugzilla.samba.org/show_bug.cgi?id=8118
                   WARN="$WARN -Qunused-arguments"
                   WARN="$WARN -Wno-unused-function -Wno-tautological-compare -Wno-parentheses-equality -Wno-self-assign -Wno-return-stack-address -Wno-constant-logical-operand"
+                  # We rely on zero length arrays in structs
+                  WARN="$WARN -Wno-zero-length-array"
                fi
 else
        # The Sun Forte compiler complains about inline functions that access static variables
@@ -746,7 +763,7 @@ DISABLED_FEATURES=none
 # Set the build profiles and options before things which use them
 #
 
-AC_ARG_WITH(profile4_x,      [  --with-profile4=yes,no          If you want to install the 4.x FX (defaults to yes)],                 [], [with_profile4_x=default])
+AC_ARG_WITH(profile4_x,      [  --with-profile4_x=yes,no        If you want to install the 4.x FX (defaults to yes)],                 [], [with_profile4_x=default])
 AC_ARG_WITH(monodroid,       [  --with-monodroid=yes,no         If you want to build the MonoDroid assemblies (defaults to no)],      [], [with_monodroid=default])
 AC_ARG_WITH(monotouch,       [  --with-monotouch=yes,no         If you want to build the Xamarin.iOS assemblies (defaults to no)],    [], [with_monotouch=default])
 AC_ARG_WITH(monotouch_watch, [  --with-monotouch_watch=yes,no   If you want to build the Xamarin.WatchOS assemblies (defaults to no)],[], [with_monotouch_watch=default])
@@ -763,51 +780,33 @@ dnl
 TEST_PROFILE=default
 enable_llvm_default=no
 
-INVARIANT_AOT_OPTIONS=nimt-trampolines=900,ntrampolines=8000,nrgctx-fetch-trampolines=256,ngsharedvt-trampolines=2800
+with_profile4_x_default=no
+with_monodroid_default=no
+with_monotouch_default=no
+with_monotouch_watch_default=no
+with_monotouch_tv_default=no
+with_xammac_default=no
+with_mobile_static_default=no
+
+with_bitcode_default=no
+with_cooperative_gc_default=no
+
+INVARIANT_AOT_OPTIONS=nimt-trampolines=2000,ntrampolines=8000,nrgctx-fetch-trampolines=256,ngsharedvt-trampolines=4000
 
 if test x$cross_compiling = xyes -o x$enable_mcs_build = xno; then
    DISABLE_MCS_DOCS_default=yes
-   with_profile4_x_default=no
-   with_monodroid_default=no
-   with_monotouch_default=no
-   with_monotouch_watch_default=no
-   with_monotouch_tv_default=no
-   with_xammac_default=no
-   with_mobile_static_default=no
-   with_bitcode_default=no
-   with_cooperative_gc_default=no
 elif test x$with_runtime_preset = xnet_4_x; then
-   with_cooperative_gc_default=no
    with_profile4_x_default=yes
-   with_monodroid_default=no
-   with_monotouch_default=no
-   with_monotouch_watch_default=no
-   with_monotouch_tv_default=no
-   with_xammac_default=no
-   with_mobile_static_default=no
-   with_bitcode_default=no
 elif test x$with_runtime_preset = xall; then
-   with_cooperative_gc_default=no
    with_profile4_x_default=yes
    with_monodroid_default=yes
    with_monotouch_default=yes
    with_monotouch_watch_default=yes
    with_monotouch_tv_default=yes
    with_xammac_default=yes
-   with_mobile_static_default=no
-   with_bitcode_default=no
 elif test x$with_runtime_preset = xmobile_static; then
    DISABLE_MCS_DOCS_default=yes
-   with_cooperative_gc_default=no
-   with_profile4_x_default=no
-   with_monodroid_default=no
-   with_monotouch_default=no
-   with_monotouch_watch_default=no
-   with_monotouch_tv_default=no
-   with_xammac_default=no
    with_mobile_static_default=yes
-   with_bitcode_default=no
-   with_cooperative_gc_default=no
    TEST_PROFILE=mobile_static 
 
    mono_feature_disable_com='yes'
@@ -820,12 +819,6 @@ elif test x$with_runtime_preset = xmobile_static; then
    AOT_RUN_FLAGS="--full-aot"
 elif test x$with_runtime_preset = xbitcode_mobile_static; then
    DISABLE_MCS_DOCS_default=yes
-   with_profile4_x_default=no
-   with_monodroid_default=no
-   with_monotouch_default=no
-   with_monotouch_watch_default=no
-   with_monotouch_tv_default=no
-   with_xammac_default=no
    with_mobile_static_default=yes
    with_bitcode_default=yes
    with_cooperative_gc_default=yes
@@ -840,16 +833,20 @@ elif test x$with_runtime_preset = xbitcode_mobile_static; then
 
    AOT_BUILD_FLAGS="--aot=llvmonly,$INVARIANT_AOT_OPTIONS"
    AOT_RUN_FLAGS="--llvmonly"
+elif test x$with_runtime_preset = xhybrid; then
+   DISABLE_MCS_DOCS_default=yes
+   with_mobile_default=yes
+   TEST_PROFILE=mobile 
+   enable_llvm_default=yes
+
+   mono_feature_disable_com='yes'
+   mono_feature_disable_remoting='yes'
+   mono_feature_disable_appdomains='yes'
+
+   AOT_BUILD_FLAGS="--aot=hybrid,$INVARIANT_AOT_OPTIONS"
+   AOT_RUN_FLAGS="--hybrid-aot"
 else
    with_profile4_x_default=yes
-   with_monodroid_default=no
-   with_monotouch_default=no
-   with_monotouch_watch_default=no
-   with_monotouch_tv_default=no
-   with_bitcode_default=no
-   with_xammac_default=no
-   with_mobile_static_default=no
-   with_cooperative_gc_default=no
 fi
 
 # Have a default AOT mode for mobile_static
@@ -1160,20 +1157,6 @@ AC_COMPILE_IFELSE([
    AC_MSG_RESULT(no)
 ])
 
-AC_MSG_CHECKING(for deprecated __attribute__)
-AC_TRY_COMPILE([
-     int doit (void) __attribute__ ((deprecated));
-     int doit (void) { return 0; }
-], [
-       return 0;
-], [
-   have_deprecated=yes
-   AC_MSG_RESULT(yes)
-], [
-   have_deprecated=no
-   AC_MSG_RESULT(no)
-])
-
 dnl
 dnl Boehm GC configuration
 dnl
@@ -2670,12 +2653,6 @@ fi
 
 AC_ARG_ENABLE(bcl-opt, [  --disable-bcl-opt    BCL is compiled with no optimizations (allows accurate BCL debugging)], test_bcl_opt=$enableval, test_bcl_opt=yes)
 
-AC_ARG_ENABLE(perf-events, [  --enable-perf-events Enable using `perf` for profiling on Linux], test_perf_events=$enableval, test_perf_events=no)
-if test "x$test_perf_events" = "xyes"; then
-       AC_DEFINE(ENABLE_PERF_EVENTS, 1, [Enable using `perf` for profiling on Linux])
-       AC_SUBST(ENABLE_PERF_EVENTS)
-fi
-
 AC_MSG_CHECKING([if big-arrays are to be enabled])
 AC_ARG_ENABLE(big-arrays,  [  --enable-big-arrays      Enable the allocation and indexing of arrays greater than Int32.MaxValue], enable_big_arrays=$enableval, enable_big_arrays=no)
 if test "x$enable_big_arrays" = "xyes" ; then
@@ -2860,13 +2837,12 @@ if test "x$enable_llvm" = "xyes"; then
    LLVM_SYSTEM_LIBS=`$LLVM_CONFIG --system-libs 2>/dev/null | grep -- -`
    llvm_jit_supported=yes
    llvm_jit_libs="jit mcjit $llvm_codegen"
-   if test $llvm_api_version -gt 100; then
-         # Based on llvm 3.9, only aot is currently supported
-      llvm_jit_libs="orcjit $llvm_codegen"
-   elif test "x$host" != "x$target"; then
+   if test "x$host" != "x$target"; then
       # No need for jit libs
          llvm_jit_supported=no
       llvm_jit_libs=""
+   elif test $llvm_api_version -gt 100; then
+      llvm_jit_libs="orcjit $llvm_codegen"
    fi
    LLVM_LIBS=`$LLVM_CONFIG --libs analysis core bitwriter $llvm_jit_libs`
    if test "x$LLVM_LIBS" = "x"; then
@@ -2952,6 +2928,8 @@ sizeof_register="SIZEOF_VOID_P"
 
 jit_wanted=true
 boehm_supported=true
+BTLS_SUPPORTED=no
+BTLS_PLATFORM=
 case "$host" in
        mips*)
                TARGET=MIPS;
@@ -3004,9 +2982,13 @@ case "$host" in
                        ;;
                  linux*)
                        AOT_SUPPORTED="yes"
+                       BTLS_SUPPORTED=yes
+                       BTLS_PLATFORM=i386
                        ;;
                  darwin*)
                        AOT_SUPPORTED="yes"
+                       BTLS_SUPPORTED=yes
+                       BTLS_PLATFORM=i386
                        ;;
                  openbsd*|freebsd*|kfreebsd-gnu*)
                        ;;
@@ -3022,9 +3004,13 @@ case "$host" in
                case $host_os in
                  linux*)
                        AOT_SUPPORTED="yes"
+                       BTLS_SUPPORTED=yes
+                       BTLS_PLATFORM=x86_64
                        ;;
                  darwin*)
                        AOT_SUPPORTED="yes"
+                       BTLS_SUPPORTED=yes
+                       BTLS_PLATFORM=x86_64
                        ;;
                  openbsd*|freebsd*|kfreebsd-gnu*)
                        ;;
@@ -3145,6 +3131,7 @@ HOST=$TARGET
 if test "x$host" != "x$target"; then
    AC_DEFINE(MONO_CROSS_COMPILE,1,[The runtime is compiled for cross-compiling mode])
    enable_mcs_build=no
+   BTLS_SUPPORTED=no
    case "$target" in
    arm*-darwin*)
                TARGET=ARM;
@@ -3430,10 +3417,12 @@ if test "x$target_mach" = "xyes"; then
          AC_DEFINE(TARGET_WATCHOS,1,[The JIT/AOT targets WatchOS])
          CPPFLAGS_FOR_LIBGC="$CPPFLAGS_FOR_LIBGC -DTARGET_WATCHOS"
          CFLAGS_FOR_LIBGC="$CFLAGS_FOR_LIBGC -DTARGET_WATCHOS"
+         BTLS_SUPPORTED=no
    elif test "x$TARGET" = "xARM" -o "x$TARGET" = "xARM64"; then
          AC_DEFINE(TARGET_IOS,1,[The JIT/AOT targets iOS])
          CPPFLAGS_FOR_LIBGC="$CPPFLAGS_FOR_LIBGC -DTARGET_IOS"
          CFLAGS_FOR_LIBGC="$CFLAGS_FOR_LIBGC -DTARGET_IOS"
+         BTLS_SUPPORTED=no
    else
        AC_TRY_COMPILE([#include "TargetConditionals.h"],[
        #if TARGET_IPHONE_SIMULATOR == 1 || TARGET_OS_IPHONE == 1
@@ -3448,6 +3437,7 @@ if test "x$target_mach" = "xyes"; then
           AC_DEFINE(TARGET_IOS,1,[The JIT/AOT targets iOS])
           CPPFLAGS_FOR_LIBGC="$CPPFLAGS_FOR_LIBGC -DTARGET_IOS"
           CFLAGS_FOR_LIBGC="$CFLAGS_FOR_LIBGC -DTARGET_IOS"
+          BTLS_SUPPORTED=no
        ])
        fi
    AC_DEFINE(TARGET_MACH,1,[The JIT/AOT targets Apple platforms])
@@ -3755,6 +3745,45 @@ if test ${TARGET} = unknown; then
        AC_MSG_WARN("mono has not been ported to $host: some things may not work.")
 fi
 
+if test "x$platform_android" = "xyes"; then
+       case "x${TARGET}" in
+       xARM)
+               case "x$arm_ver" in
+               xARMv5)
+                       BTLS_SUPPORTED=yes
+                       BTLS_PLATFORM=android-armv5
+                       ;;
+               xARMv6)
+                       BTLS_SUPPORTED=yes
+                       BTLS_PLATFORM=android-armv6
+                       ;;
+               xARMv7)
+                       BTLS_SUPPORTED=yes
+                       BTLS_PLATFORM=android-armv7
+                       ;;
+               *)
+                       BTLS_SUPPORTED=no
+                       ;;
+               esac
+               ;;
+       xARM64)
+               BTLS_SUPPORTED=yes
+               BTLS_PLATFORM=android-v8a
+               ;;
+       xX86)
+               BTLS_SUPPORTED=yes
+               BTLS_PLATFORM=android-x86
+               ;;
+       xAMD64)
+               BTLS_SUPPORTED=yes
+               BTLS_PLATFORM=android-x64
+               ;;
+       *)
+               BTLS_SUPPORTED=no
+               ;;
+       esac
+fi
+
 if test ${ACCESS_UNALIGNED} = no; then
        CPPFLAGS="$CPPFLAGS -DNO_UNALIGNED_ACCESS"
 fi
@@ -3877,6 +3906,90 @@ else
 fi
 AC_SUBST(LIBMONO_LA)
 
+dnl **************
+dnl ***  Btls  ***
+dnl **************
+
+AC_ARG_ENABLE(btls, [  --disable-btls             Disable the BoringTls provider], enable_btls=$enableval, enable_btls=$BTLS_SUPPORTED)
+AC_ARG_WITH(btls_android_ndk, [  --with-btls-android-ndk        Android NDK for BoringTls])
+
+AC_ARG_ENABLE(dynamic-btls, [ --enable-dynamic-btls Place the BTLS provider into a separate shared library/archive.], enable_dynamic_btls=$enableval, enable_dynamic_btls=no)
+
+AM_CONDITIONAL(BTLS, test x$enable_btls = xyes)
+
+btls_android=no
+if test "x$enable_btls" = "xyes"; then
+       AC_PATH_PROG(CMAKE, [cmake], [no], [$PATH:/Applications/CMake.app/Contents/bin:/usr/local/bin])
+       if test "x$CMAKE" = "xno"; then
+               AC_MSG_ERROR("cmake not found")
+       fi
+
+       BTLS_ROOT=`cd $srcdir && pwd`/external/boringssl
+       AC_SUBST(BTLS_ROOT)
+
+       btls_arch=
+       btls_cflags=
+       BTLS_CMAKE_ARGS=
+
+       case "$BTLS_PLATFORM" in
+       i386)
+               btls_arch=i386
+               btls_cflags="-m32"
+               case $host_os in
+                       darwin*)
+                               btls_cflags="$btls_cflags -arch i386"
+               esac
+               ;;
+       x86_64)
+               btls_arch=x86_64
+               ;;
+       android-armv5)
+               BTLS_CMAKE_ARGS="-DANDROID_ABI=\"armeabi\" -DANDROID_NATIVE_API_LEVEL=12"
+               ;;
+       android-armv6)
+               BTLS_CMAKE_ARGS="-DANDROID_ABI=\"armeabi\" -DANDROID_NATIVE_API_LEVEL=12"
+               ;;
+       android-armv7)
+               BTLS_CMAKE_ARGS="-DANDROID_ABI=\"armeabi-v7a\" -DANDROID_NATIVE_API_LEVEL=12"
+               ;;
+       android-v8a)
+               BTLS_CMAKE_ARGS="-DANDROID_ABI=\"arm64-v8a\" -DANDROID_NATIVE_API_LEVEL=12"
+               ;;
+       android-x86)
+               BTLS_CMAKE_ARGS="-DANDROID_ABI=\"x86\" -DANDROID_NATIVE_API_LEVEL=12"
+               ;;
+       android-x64)
+               BTLS_CMAKE_ARGS="-DANDROID_ABI=\"x86_64\" -DANDROID_NATIVE_API_LEVEL=12"
+               ;;
+       *)
+               AC_MSG_ERROR(Invalid BTLS platform)
+       esac
+
+       if test "x$platform_android" = "xyes"; then
+               btls_android=yes
+               BTLS_CMAKE_ARGS="$BTLS_CMAKE_ARGS -DCMAKE_TOOLCHAIN_FILE=$BTLS_ROOT/util/android-cmake/android.toolchain.cmake"
+               if test "x$with_btls_android_ndk" != "x"; then
+                       BTLS_CMAKE_ARGS="$BTLS_CMAKE_ARGS -DANDROID_NDK=\"$with_btls_android_ndk\""
+               fi
+       fi
+
+       if test "x$btls_arch" != "x"; then
+               BTLS_CMAKE_ARGS="$BTLS_CMAKE_ARGS -DBTLS_ARCH=\"$btls_arch\""
+       fi
+
+       BTLS_CFLAGS="$CPPFLAGS_FOR_BTLS $btls_cflags"
+       AC_SUBST(BTLS_ARCH)
+       AC_SUBST(BTLS_CFLAGS)
+       AC_SUBST(BTLS_PLATFORM)
+       AC_SUBST(BTLS_CMAKE_ARGS)
+
+       AC_DEFINE(HAVE_BTLS, 1, [BoringTls is supported])
+else
+       enable_btls=no
+fi
+
+AM_CONDITIONAL(BTLS_ANDROID, test x$btls_android = xyes)
+
 if test x$DISABLE_MCS_DOCS = xyes; then
    docs_dir=""
 else
@@ -4113,6 +4226,7 @@ llvm/Makefile
 scripts/mono-find-provides
 scripts/mono-find-requires
 mono/Makefile
+mono/btls/Makefile
 mono/utils/Makefile
 mono/metadata/Makefile
 mono/dis/Makefile
@@ -4278,12 +4392,28 @@ fi
       echo "AOT_BUILD_FLAGS=$AOT_BUILD_FLAGS" >> $srcdir/$mcsdir/build/config.make
     fi
 
+    if test "x$enable_btls" = "xyes"; then
+      echo "HAVE_BTLS=1" >> $srcdir/$mcsdir/build/config.make
+      if test "x$enable_dynamic_btls" = "xyes"; then
+        echo "HAVE_DYNAMIC_BTLS=1" >> $srcdir/$mcsdir/build/config.make
+      fi
+    fi
+
   fi
 
 )
 
 libgdiplus_msg=${libgdiplus_loc:-assumed to be installed}
 
+btls_platform_string=
+if test x$enable_btls = xyes; then
+       if test x$btls_android = xyes; then
+               btls_platform_string=" (android:$BTLS_PLATFORM)"
+       else
+               btls_platform_string=" ($BTLS_PLATFORM)"
+       fi
+fi
+
 echo "
         mcs source:    $mcsdir
 
@@ -4309,6 +4439,7 @@ echo "
        JNI support:     $jdk_headers_found
        libgdiplus:      $libgdiplus_msg
        zlib:            $zlib_msg
+       BTLS:            $enable_btls$btls_platform_string
        $disabled
 "
 if test x$with_static_mono = xno -a "x$host_win32" != "xyes"; then
index b4b7243ecfd001bb60aeb9b0979840a8cd170c28..be83151429311d44e1c6d5aaa5c82df050a1aa74 100644 (file)
@@ -11,6 +11,7 @@
        <dllmap dll="oci" target="libclntsh@libsuffix@" os="!windows"/>
        <dllmap dll="db2cli" target="libdb2_36@libsuffix@" os="!windows"/>
        <dllmap dll="MonoPosixHelper" target="$mono_libdir/libMonoPosixHelper@libsuffix@" os="!windows" />
+       <dllmap dll="libmono-btls-shared" target="$mono_libdir/libmono-btls-shared@libsuffix@" os="!windows" />
        <dllmap dll="i:msvcrt" target="@LIBC@" os="!windows"/>
        <dllmap dll="i:msvcrt.dll" target="@LIBC@" os="!windows"/>
        <dllmap dll="sqlite" target="@SQLITE@" os="!windows"/>
index 2e346ad3a88796d3edda11ca11b8ab43c96a227c..2dfec5f02035f14e40680df0e734e240e1563c44 100644 (file)
@@ -74,9 +74,6 @@
                        <add prefix="https" type="System.Net.HttpRequestCreator, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
                        <add prefix="file" type="System.Net.FileWebRequestCreator, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
                </webRequestModules>
-               <settings>
-                       <ipv6 enabled="false"/>
-               </settings>
        </system.net>
        <system.web>
                <httpHandlers>
index c6d1b2c0fa37b35bddf2a83acacd5ba879e38278..2f8090f028844be1164b5fc55788231b305a42ad 100644 (file)
                        <add prefix="file" type="System.Net.FileWebRequestCreator, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
                        <add prefix="ftp" type="System.Net.FtpRequestCreator, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
                </webRequestModules>
-               <settings>
-                       <ipv6 enabled="false"/>
-               </settings>
        </system.net>
        
        <system.runtime.remoting>
index b98a4d3e0072addc1580372fa666ec045a5e0568..30bc2105f3afba38b6ccfc3e99991b770ea41f30 100644 (file)
                        <add prefix="file" type="System.Net.FileWebRequestCreator, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
                        <add prefix="ftp" type="System.Net.FtpRequestCreator, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
                </webRequestModules>
-               <settings>
-                       <ipv6 enabled="false"/>
-               </settings>
        </system.net>
        
        <system.runtime.remoting>
index 8f7e56a4facce6876d87fe6238a4dbe43bed3575..df27ec4003ef4d05ecda25d5590c4139d6be7ff3 100644 (file)
                        <add prefix="file" type="System.Net.FileWebRequestCreator, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
                        <add prefix="ftp" type="System.Net.FtpRequestCreator, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
                </webRequestModules>
-               <settings>
-                       <ipv6 enabled="false"/>
-               </settings>
        </system.net>
        
        <system.runtime.remoting>
index 20d6cb9dc9b3566f7408862163ea6c0c98b30666..cddef0364cbfe34fa2f3fff6e0191d55853c9267 100644 (file)
@@ -40,9 +40,8 @@
        <p>The output of the SCC analysis is passed to the
        `cross_references()` callback.  It is expected to set the
        `is_alive` flag on those strongly connected components that it
-       wishes to be kept alive.  Only bridged objects will be
-       reported to the callback, i.e., non-bridged objects are
-       removed from the callback graph.
+       wishes to be kept alive.  The value of `is_alive` will be
+       ignored on any SCCs which lack bridges.
        
        <p>In monodroid each bridged object has a corresponding Java
        mirror object.  In the bridge callback it reifies the Mono
@@ -63,7 +62,7 @@
 
 <div class="mapi-header">
 enum {
-        SGEN_BRIDGE_VERSION = 4
+        SGEN_BRIDGE_VERSION = 5
 };
         
 typedef enum {
index a33dcb846b2746e4f47275e54c43280cfa982e1c..89f85d18e590434088b672fc593b3f2012052ead 100644 (file)
@@ -130,6 +130,10 @@ AM_CONDITIONAL(TARGET_WIN32, test x$OS = xWIN32)
 AM_CONDITIONAL(PLATFORM_DARWIN, test x$platform_darwin = xyes)
 AM_CONDITIONAL(PLATFORM_ANDROID, test x$platform_android = xyes)
 
+# Defined for all targets/platforms using classic Windows API support.
+AC_DEFINE(HAVE_CLASSIC_WINAPI_SUPPORT, 1, [Use classic Windows API support])
+AC_DEFINE(HAVE_UWP_WINAPI_SUPPORT, 0, [Don't use UWP Windows API support])
+
 AC_CHECK_SIZEOF(int)
 AC_CHECK_SIZEOF(void *)
 AC_CHECK_SIZEOF(long)
index 1527ba26d30452bb70aa7403d6cbc1281ad5ec78..f89138ba851b49bb5ad317571536be5f3af3d632 100644 (file)
@@ -5,7 +5,7 @@ AM_CFLAGS = $(WERROR_CFLAGS)
 win_files  = \
        eglib-config.hw \
        gdate-win32.c gdir-win32.c gfile-win32.c gmisc-win32.c \
-       gmodule-win32.c gtimer-win32.c
+       gmodule-win32.c gtimer-win32.c gunicode-win32.c
 
 unix_files = \
        gdate-unix.c  gdir-unix.c  gfile-unix.c  gmisc-unix.c   \
index 4e17a089b5444b040cb92ed2562f4df52d365eb6..9c34d8756930f4fa7e898995c1d02329843f1be9 100644 (file)
@@ -78,3 +78,11 @@ g_file_test (const gchar *filename, GFileTest test)
        }
        return FALSE;
 }
+
+gchar *
+g_mkdtemp (char *tmp_template)
+{
+       char *template_copy = g_strdup (tmp_template);
+
+       return mkdtemp (template_copy);
+}
index 2dde793dfeec7409333f5d7468a1278ae0cb5286..61e23cbe442856e8cabea65ed09ac4e6ec3d3c3c 100644 (file)
@@ -35,6 +35,7 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <sys/types.h>
+#include <direct.h>
 
 #ifdef G_OS_WIN32
 #include <io.h>
@@ -68,6 +69,26 @@ int mkstemp (char *tmp_template)
        return fd;
 }
 
+gchar *
+g_mkdtemp (char *tmp_template)
+{
+       gunichar2* utf16_template;
+
+       utf16_template  = u8to16 (tmp_template);
+
+       utf16_template = _wmktemp(utf16_template);
+       if (utf16_template && *utf16_template) {
+               if (_wmkdir (utf16_template) == 0){
+                       char *ret = u16to8 (utf16_template);
+                       g_free (utf16_template);
+                       return ret;
+               }
+       }
+
+       g_free (utf16_template);
+       return NULL;
+}
+            
 #ifdef _MSC_VER
 #pragma warning(disable:4701)
 #endif
index 23781c168526edd95498a3260697cbd76af23ff6..8ceec487041d6bb7c3a2a72d3f8e85cfd2ecaa78 100644 (file)
@@ -887,6 +887,8 @@ gboolean   g_file_test (const gchar *filename, GFileTest test);
 #define g_ascii_strtod strtod
 #define g_ascii_isalnum isalnum
 
+gchar *g_mkdtemp (gchar *tmpl);
+
 /*
  * Pattern matching
  */
@@ -1062,6 +1064,10 @@ glong     g_utf8_pointer_to_offset (const gchar *str, const gchar *pos);
 #define _EGLIB_MINOR  0
  
 #define GLIB_CHECK_VERSION(a,b,c) ((a < _EGLIB_MAJOR) || (a == _EGLIB_MAJOR && (b < _EGLIB_MIDDLE || (b == _EGLIB_MIDDLE && c <= _EGLIB_MINOR))))
+
+#define G_HAVE_API_SUPPORT(x) (x)
+#define G_UNSUPPORTED_API "%s:%d: '%s' not supported.", __FILE__, __LINE__
+#define g_unsupported_api(name) G_STMT_START { g_warning (G_UNSUPPORTED_API, name); } G_STMT_END
  
 G_END_DECLS
 
diff --git a/eglib/src/gmisc-win32-uwp.c b/eglib/src/gmisc-win32-uwp.c
new file mode 100644 (file)
index 0000000..cdf5896
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * gmisc-win32-uwp.c: UWP misc support.
+ *
+ * Copyright 2016 Microsoft
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
+*/
+#include <config.h>
+#include <glib.h>
+
+#if G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT)
+#include <windows.h>
+#include <assert.h>
+
+gchar*
+g_win32_getlocale(void)
+{
+       gunichar2 buf[19];
+       gint ccBuf = GetLocaleInfoEx (LOCALE_NAME_USER_DEFAULT, LOCALE_SISO639LANGNAME, buf, 9);
+       assert (ccBuf <= 9);
+       if (ccBuf != 0) {
+               buf[ccBuf - 1] = L'-';
+               ccBuf = GetLocaleInfoEx (LOCALE_NAME_USER_DEFAULT, LOCALE_SISO3166CTRYNAME, buf + ccBuf, 9);
+               assert (ccBuf <= 9);
+       }
+
+       // Check for GetLocaleInfoEx failure.
+       if (ccBuf == 0)
+               buf[0] = L'\0';
+
+       return u16to8 (buf);
+}
+
+#else /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
+
+#ifdef _MSC_VER
+// Quiet Visual Studio linker warning, LNK4221, in cases when this source file intentional ends up empty.
+void __mono_win32_gmisc_win32_uwp_quiet_lnk4221(void) {}
+#endif
+#endif /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
index 9486aff07e3e7fbb7c26cadf328bff24b7bd3b2a..4aac0ef69460fe70c432dfb78f8fcfd2bd931f5a 100644 (file)
  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
 
+#include <config.h>
+
 #include <stdlib.h>
 #include <glib.h>
 
 #include <windows.h>
+#if _MSC_VER && G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
+#include <shlobj.h>
+#endif
 #include <direct.h>
 #include <io.h>
+#include <assert.h>
 
 const gchar *
 g_getenv(const gchar *variable)
@@ -84,6 +90,7 @@ g_unsetenv(const gchar *variable)
        g_free(var);
 }
 
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
 gchar*
 g_win32_getlocale(void)
 {
@@ -94,6 +101,7 @@ g_win32_getlocale(void)
        ccBuf += GetLocaleInfoA(lcid, LOCALE_SISO3166CTRYNAME, buf + ccBuf, 9);
        return g_strdup (buf);
 }
+#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */
 
 gboolean
 g_path_is_absolute (const char *filename)
@@ -113,23 +121,52 @@ g_path_is_absolute (const char *filename)
        return FALSE;
 }
 
+#if _MSC_VER && G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
+static gchar*
+g_get_known_folder_path (void)
+{
+       gchar *folder_path = NULL;
+       PWSTR profile_path = NULL;
+       HRESULT hr = SHGetKnownFolderPath (&FOLDERID_Profile, KF_FLAG_DEFAULT, NULL, &profile_path);
+       if (SUCCEEDED(hr)) {
+               folder_path = u16to8 (profile_path);
+               CoTaskMemFree (profile_path);
+       }
+
+       return folder_path;
+}
+
+#else
+
+static inline gchar *
+g_get_known_folder_path (void)
+{
+       return NULL;
+}
+#endif
+
 const gchar *
 g_get_home_dir (void)
 {
-       /* FIXME */
-       const gchar *drive = g_getenv ("HOMEDRIVE");
-       const gchar *path = g_getenv ("HOMEPATH");
-       gchar *home_dir = NULL;
-       
-       if (drive && path) {
-               home_dir = g_malloc(strlen(drive) + strlen(path) +1);
-               if (home_dir) {
-                       sprintf(home_dir, "%s%s", drive, path);
-               }
+       gchar *home_dir = g_get_known_folder_path ();
+
+       if (!home_dir) {
+               home_dir = (gchar *) g_getenv ("USERPROFILE");
        }
 
-       g_free (drive);
-       g_free (path);
+       if (!home_dir) {
+               const gchar *drive = g_getenv ("HOMEDRIVE");
+               const gchar *path = g_getenv ("HOMEPATH");
+
+               if (drive && path) {
+                       home_dir = g_malloc (strlen (drive) + strlen (path) + 1);
+                       if (home_dir) {
+                               sprintf (home_dir, "%s%s", drive, path);
+                       }
+               }
+               g_free (drive);
+               g_free (path);
+       }
 
        return home_dir;
 }
@@ -163,4 +200,3 @@ g_get_tmp_dir (void)
        }
        return tmp_dir;
 }
-
diff --git a/eglib/src/gmodule-win32-internals.h b/eglib/src/gmodule-win32-internals.h
new file mode 100644 (file)
index 0000000..d18e27f
--- /dev/null
@@ -0,0 +1,13 @@
+#ifndef __G_MODULE_WINDOWS_INTERNALS_H__
+#define __G_MODULE_WINDOWS_INTERNALS_H__
+
+#include <config.h>
+#include <glib.h>
+
+#ifdef G_OS_WIN32
+#include <gmodule.h>
+
+gpointer
+w32_find_symbol (const gchar *symbol_name);
+#endif /* G_OS_WIN32 */
+#endif /* __G_MODULE_WINDOWS_INTERNALS_H__ */
diff --git a/eglib/src/gmodule-win32-uwp.c b/eglib/src/gmodule-win32-uwp.c
new file mode 100644 (file)
index 0000000..5117e3b
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * gmodule-win32-uwp.c: UWP gmodule support.
+ *
+ * Copyright 2016 Microsoft
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
+*/
+#include <config.h>
+#include <glib.h>
+
+#if G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT)
+#include <windows.h>
+#include <gmodule-win32-internals.h>
+
+gpointer
+w32_find_symbol (const gchar *symbol_name)
+{
+       g_unsupported_api ("EnumProcessModules");
+       SetLastError (ERROR_NOT_SUPPORTED);
+       return NULL;
+}
+
+const gchar *
+g_module_error (void)
+{
+       gchar *ret = NULL;
+       TCHAR buf [1024];
+       DWORD code = GetLastError ();
+
+       if (!FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL,
+               code, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), buf, G_N_ELEMENTS (buf) - 1, NULL) )
+               buf[0] = TEXT('\0');
+
+       ret = u16to8 (buf);
+       return ret;
+}
+
+#else /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
+
+#ifdef _MSC_VER
+// Quiet Visual Studio linker warning, LNK4221, in cases when this source file intentional ends up empty.
+void __mono_win32_gmodule_win32_uwp_quiet_lnk4221(void) {}
+#endif
+#endif /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
index 24010b58915e367699e1581e9431eeefbfff310c..72eaca32fb7d96ea29316af51ba14c61c793a570 100644 (file)
  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
+#include <config.h>
 #include <glib.h>
-#include <gmodule.h>
 #include <windows.h>
 #include <psapi.h>
+#include <gmodule-win32-internals.h>
 
 #define LIBSUFFIX ".dll"
 #define LIBPREFIX ""
@@ -68,7 +69,8 @@ g_module_open (const gchar *file, GModuleFlags flags)
        return module;
 }
 
-static gpointer
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
+gpointer
 w32_find_symbol (const gchar *symbol_name)
 {
        HMODULE *modules;
@@ -114,6 +116,7 @@ w32_find_symbol (const gchar *symbol_name)
        g_free (modules);
        return NULL;
 }
+#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */
 
 gboolean
 g_module_symbol (GModule *module, const gchar *symbol_name, gpointer *symbol)
@@ -134,6 +137,7 @@ g_module_symbol (GModule *module, const gchar *symbol_name, gpointer *symbol)
        }
 }
 
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
 const gchar *
 g_module_error (void)
 {
@@ -150,6 +154,7 @@ g_module_error (void)
 
        return ret;
 }
+#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */
 
 gboolean
 g_module_close (GModule *module)
index ef80cff034748e559dea3055bc3bfb175dc3eb76..2dcf8746e08a90a3d3f506d7a19849b93db60295 100644 (file)
@@ -47,8 +47,10 @@ g_print (const gchar *format, ...)
        va_list args;
 
        va_start (args, format);
-       if (g_vasprintf (&msg, format, args) < 0)
+       if (g_vasprintf (&msg, format, args) < 0) {
+               va_end (args);
                return;
+       }
        va_end (args);
 
        if (!stdout_handler)
@@ -65,8 +67,10 @@ g_printerr (const gchar *format, ...)
        va_list args;
 
        va_start (args, format);
-       if (g_vasprintf (&msg, format, args) < 0)
+       if (g_vasprintf (&msg, format, args) < 0) {
+               va_end (args);
                return;
+       }
        va_end (args);
 
        if (!stderr_handler)
diff --git a/eglib/src/gunicode-win32-uwp.c b/eglib/src/gunicode-win32-uwp.c
new file mode 100644 (file)
index 0000000..ef36ffc
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * gunicode-win32-uwp.c: UWP unicode support.
+ *
+ * Copyright 2016 Microsoft
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
+*/
+#include <config.h>
+#include <glib.h>
+
+#if G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT)
+#define CODESET 1
+#include <windows.h>
+
+extern const char *my_charset;
+static gboolean is_utf8;
+
+gboolean
+g_get_charset (G_CONST_RETURN char **charset)
+{
+       if (my_charset == NULL) {
+               static char buf [14];
+               CPINFOEXA cp_info;
+
+               GetCPInfoExA (CP_ACP, 0, &cp_info);
+               sprintf (buf, "CP%u", cp_info.CodePage);
+               my_charset = buf;
+               is_utf8 = FALSE;
+       }
+       
+       if (charset != NULL)
+               *charset = my_charset;
+
+       return is_utf8;
+}
+
+#else /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
+
+#ifdef _MSC_VER
+// Quiet Visual Studio linker warning, LNK4221, in cases when this source file intentional ends up empty.
+void __mono_win32_gunicode_win32_uwp_quiet_lnk4221(void) {}
+#endif
+#endif /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
diff --git a/eglib/src/gunicode-win32.c b/eglib/src/gunicode-win32.c
new file mode 100644 (file)
index 0000000..a35cfcd
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * gunicode-win32.c: Windows unicode support.
+ *
+ * Copyright 2016 Microsoft
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
+*/
+#include <config.h>
+#include <glib.h>
+
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
+#define CODESET 1
+#include <windows.h>
+
+extern const char *my_charset;
+static gboolean is_utf8;
+
+gboolean
+g_get_charset (G_CONST_RETURN char **charset)
+{
+       if (my_charset == NULL) {
+               static char buf [14];
+               sprintf (buf, "CP%u", GetACP ());
+               my_charset = buf;
+               is_utf8 = FALSE;
+       }
+       
+       if (charset != NULL)
+               *charset = my_charset;
+
+       return is_utf8;
+}
+
+#else /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */
+
+#ifdef _MSC_VER
+// Quiet Visual Studio linker warning, LNK4221, in cases when this source file intentional ends up empty.
+void __mono_win32_mono_gunicode_win32_quiet_lnk4221(void) {}
+#endif
+#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */
index 36d6d4acfb76ad52a1bca0da47bbcd6def49b9cd..c1280f9b8bf287517374552620b1b3e2f87fff4d 100644 (file)
 #include <unicode-data.h>
 #include <errno.h>
 
-#if defined(_MSC_VER) || defined(G_OS_WIN32)
-/* FIXME */
-#  define CODESET 1
-#  include <windows.h>
-#else
+#ifndef G_OS_WIN32
 #    ifdef HAVE_LOCALCHARSET_H
 #       include <localcharset.h>
 #    endif
 #endif
 
-static const char *my_charset;
-static gboolean is_utf8;
+const char *my_charset;
 
 /*
  * Character set conversion
@@ -205,16 +200,13 @@ g_filename_from_utf8 (const gchar *utf8string, gssize len, gsize *bytes_read, gs
        return res;
 }
 
+#ifndef G_OS_WIN32
+static gboolean is_utf8;
+
 gboolean
 g_get_charset (G_CONST_RETURN char **charset)
 {
        if (my_charset == NULL) {
-#ifdef G_OS_WIN32
-               static char buf [14];
-               sprintf (buf, "CP%u", GetACP ());
-               my_charset = buf;
-               is_utf8 = FALSE;
-#else
                /* These shouldn't be heap allocated */
 #if defined(HAVE_LOCALCHARSET_H)
                my_charset = locale_charset ();
@@ -222,7 +214,6 @@ g_get_charset (G_CONST_RETURN char **charset)
                my_charset = "UTF-8";
 #endif
                is_utf8 = strcmp (my_charset, "UTF-8") == 0;
-#endif
        }
        
        if (charset != NULL)
@@ -230,6 +221,7 @@ g_get_charset (G_CONST_RETURN char **charset)
 
        return is_utf8;
 }
+#endif /* G_OS_WIN32 */
 
 gchar *
 g_locale_to_utf8 (const gchar *opsysstring, gssize len, gsize *bytes_read, gsize *bytes_written, GError **error)
index 23e7638bdbdbe9929fe7eccd6096a0faf7498596..806e8b66d3f2387f45078ae70af458bf19fca5a1 100644 (file)
 
 #include <config.h>
 #include "test.h"
+
+#ifndef DRIVER_EXTERNAL_TESTS
 #include "tests.h"
+#endif
 
 #include <stdio.h>
 #ifdef HAVE_GETOPT_H
@@ -102,7 +105,11 @@ static void print_help(char *s)
        printf("\n");
 }
 
+#ifdef DRIVER_EXTERNAL_MAIN
+gint run_tests_main(gint argc, gchar **argv)
+#else
 gint main(gint argc, gchar **argv)
+#endif
 {
        gint i, j, c, iterations = 1;
        StringArray *tests_to_run = NULL;
index 04e8d4075ce134087eb22387b8b0da242f4ab482..238250bba05455b75186c920c11dc70efd3d983d 100755 (executable)
 #define VERSION "0.1"
 
 #define HAVE_STRTOK_R 1
+
+#ifndef HAVE_WINAPI_FAMILY_SUPPORT
+
+#define HAVE_WINAPI_FAMILY_SUPPORT
+
+/* WIN API Family support */
+#include <winapifamily.h>
+
+#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
+       #define HAVE_CLASSIC_WINAPI_SUPPORT 1
+       #define HAVE_UWP_WINAPI_SUPPORT 0
+#elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
+       #define HAVE_CLASSIC_WINAPI_SUPPORT 0
+       #define HAVE_UWP_WINAPI_SUPPORT 1
+#ifndef HAVE_EXTERN_DEFINED_WINAPI_SUPPORT
+       #error Unsupported WINAPI family
+#endif
+#else
+       #define HAVE_CLASSIC_WINAPI_SUPPORT 0
+       #define HAVE_UWP_WINAPI_SUPPORT 0
+#ifndef HAVE_EXTERN_DEFINED_WINAPI_SUPPORT
+       #error Unsupported WINAPI family
+#endif
+#endif
+
+#endif
 #endif
index de108cd39453ff4accc0967b7ae2490b43a79c30..6c77197318fe85dfddf75a1b344b9bf8d0007b0b 160000 (submodule)
@@ -1 +1 @@
-Subproject commit de108cd39453ff4accc0967b7ae2490b43a79c30
+Subproject commit 6c77197318fe85dfddf75a1b344b9bf8d0007b0b
diff --git a/external/bockbuild b/external/bockbuild
new file mode 160000 (submodule)
index 0000000..f42561e
--- /dev/null
@@ -0,0 +1 @@
+Subproject commit f42561e9ff8e60483897bb54e2191344556de94e
diff --git a/external/boringssl b/external/boringssl
new file mode 160000 (submodule)
index 0000000..c06ac6b
--- /dev/null
@@ -0,0 +1 @@
+Subproject commit c06ac6b33d3e7442ad878488b9d1100127eff998
index ea18396c86ab3f8ba5d0fcd9ada9e066bd4f9f92..3f37ebd52b49e1a9ab3bfbc5881b6da01c134c0d 160000 (submodule)
@@ -1 +1 @@
-Subproject commit ea18396c86ab3f8ba5d0fcd9ada9e066bd4f9f92
+Subproject commit 3f37ebd52b49e1a9ab3bfbc5881b6da01c134c0d
diff --git a/external/corefx b/external/corefx
new file mode 160000 (submodule)
index 0000000..b1aa1d9
--- /dev/null
@@ -0,0 +1 @@
+Subproject commit b1aa1d92ca33d0cb8ffbac9b6ff73b284db6bbf1
index 9f44f259bf5059df6c8019948ea75313bd09a9fb..367864ef810859ae3ce652864233b35f2dd5fdbe 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 9f44f259bf5059df6c8019948ea75313bd09a9fb
+Subproject commit 367864ef810859ae3ce652864233b35f2dd5fdbe
diff --git a/external/linker b/external/linker
new file mode 160000 (submodule)
index 0000000..e4d9784
--- /dev/null
@@ -0,0 +1 @@
+Subproject commit e4d9784ac37b9ebf4757175c92bc7a3ec9fd867a
index 4bc79a6da1f0ee538560b7e4d0caff46d3c86e4f..670081afaf2a5662ec6471a7e2603c7ca6e8edbc 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 4bc79a6da1f0ee538560b7e4d0caff46d3c86e4f
+Subproject commit 670081afaf2a5662ec6471a7e2603c7ca6e8edbc
index e7929918ad0bb9df8d12b07a7803f660a8a3244f..7b1460a888ae20f5756aa3e8ad71781094541ffd 100644 (file)
@@ -93,6 +93,7 @@ GC_API GC_PTR (*GC_oom_fn) GC_PROTO((size_t bytes_requested));
                        /* pointer to a previously allocated heap       */
                        /* object.                                      */
 
+// Keep somewhat in sync with mono/metadata/profiler.h:enum MonoGCEvent
 typedef enum {
        GC_EVENT_START,
        GC_EVENT_MARK_START,
index de2b6ac7c3ff22a480831f8a10292f0846749835..0c8b29892ff5f582e121af6d36c300073815cdb5 100644 (file)
@@ -2,6 +2,7 @@ man_MANS = \
        al.1                  \
        cert2spc.1            \
        certmgr.1             \
+       cert-sync.1           \
        chktrust.1            \
        cilc.1                \
        crlupdate.1           \
index fe705601b4c7939cecdcb05c6abcebffd6b7e93d..853df717c7575cfdd2cebbf8d495cfdc8286afb6 100644 (file)
@@ -11,7 +11,7 @@ caspol \- Command line tool to modify Code Access Security policies.
 .PP
 .B caspol [options] [policy level] [actions] [parameters] ... 
 .SH DESCRIPTION
-This tools allow to list and modify the different policy levels (user, 
+This tool allows to list and modify the different policy levels (user, 
 machine and enterprise).
 .SH OPTIONS
 .TP
@@ -20,7 +20,7 @@ Do not ask confirmation to change the policy level.
 .TP
 .I -f[orce]
 Caspol.exe is a managed tool. Changing the security policies could affect
-it's ability to work properly. This option permit changes that could 
+it's ability to work properly. This option permits changes that could 
 disallow caspol.exe from working properly.
 .TP
 .I -? | /? | -h[elp]
@@ -90,7 +90,7 @@ Remove the specified named permission set from the policy level
 .TP
 .I -af | -addfulltrust assemblyname
 Add the specified assembly to the fully trusted assembly list in the 
-policy level. If a policy use some custom security permissions then the
+policy level. If a policy uses some custom security permissions then the
 assembly containing the custom permissions must be in the fully trusted
 list. Note that this requirement is recursive (all assemblies required 
 by the specified assembly must also be in the list). The assembly must be
@@ -148,33 +148,33 @@ Use the option to load a custom condition into the policy. The class that
 will deserialize the XML policy must be in a fully trusted assembly.
 .TP
 .I -hash algo [-hex hash | -file assemblyname]
-This condition specify a specific hash that an assembly must generate
+This condition specifies a specific hash that an assembly must generate
 (from itself) to be satisfied. Any change to the assembly will require the
 policy to be updated (as the hash value will have changed).
 .TP
 .I -pub [-cert certificate | -file signedfile | -hex rawdata]
-This condition specify a X.509 Authenticode(r) certificate that must have 
+This condition specifies a X.509 Authenticode(r) certificate that must have 
 signed an assembly in order to be satisfied. The certificate can be referenced
 as a file (binary DER), a signed file (containing the certificate) or with
 the hexadecimal value of the certificate. Note that files outside the 
 policy must also be protected against tempering.
 .TP
 .I -strong -file filename [name | -noname] [version | -noversion]
-This condition specify a specific StrongName that must have signed an
+This condition specifies a specific StrongName that must have signed an
 assembly to be satisfied. Use -noname if the assembly name isn't known
 (or important) and -version if the version isn't known (or important) in
 the resolution.
 .TP
 .I -site hostname
-This condition specify the site from where the assembly must come from to 
+This condition specifies the site from where the assembly must come from to 
 be satisfied.
 .TP
 .I -url URL
-This condition specify the URL from where the assembly must come from to 
+This condition specifies the URL from where the assembly must come from to 
 be satisfied.
 .TP
 .I -zone zonename
-This condition specify the zone from where the assembly must come from to 
+This condition specifies the zone from where the assembly must come from to 
 be satisfied. Existing zones are MyComputer, Internet, Intranet, Trusted 
 and Untrusted.
 
@@ -204,7 +204,7 @@ It is possible to chain several commands with the tool, like:
 .TP
 This will list all machine level code groups, then remove the code group
 labeled 1.6, list again all code groups (missing 1.6), reset the policy
-and finally showing all code groups (where 1.6 is back).
+and finally show all code groups (where 1.6 is back).
 
 .SH KNOWN ISSUES
 .TP
index aead19a58d084fbb76a15eebba1fef9a6367a76a..3614f4ae4ec8d1173f8940122cd2984e7e3db6c2 100644 (file)
@@ -11,7 +11,7 @@ cccheck \- Perform static code contracts verification for CLR assemblies.
 .PP
 .B cccheck --assembly=<assembly> [options]
 .SH DESCRIPTION
-Perform static code contracts verification to find bugs and inconsistences
+Perform static code contracts verification to find bugs and inconsistencies
 between code and specification. This includes non-null, integer analyses. 
 .PP
 The assembly must have been built with the symbol CONTRACTS_FULL defined,
index 22f242b2fb49563d2ed058e459c7af35ac64e4ec..a3907ed699a6efaf99b1e604de7a6ae4c0de9b37 100644 (file)
@@ -1,6 +1,6 @@
 .\" 
 .\" ccrewrite manual page.
-.\" Copyright (C) 2010 Novell, Inc (http://www.novell.com)
+.\" Copyright (C) 2010 Chris Bacon.
 .\" Author:
 .\"   Chris Bacon <chrisbacon76@gmail.com>
 .\"
@@ -28,7 +28,7 @@ specified assembly.
 .TP
 .I "--assembly <assembly-name>"
 The assembly to rewrite. If no --output option is specified, then this file
-overwritten with the rewritten version.
+is overwritten with the rewritten version.
 .TP
 .I "--debug"
 Use debug information if available to improve the usefulness of contract
@@ -38,7 +38,7 @@ failure messages.
 Show help for ccrewrite, listing configuration options.
 .TP
 .I "--level <level> (default=4)"
-Set the which contract types are present in rewritten assembly:
+Set which contract types are present in rewritten assembly:
 0 = No contracts;
 1 = Release requires;
 2 = Requires;
diff --git a/man/cert-sync.1 b/man/cert-sync.1
new file mode 100644 (file)
index 0000000..66d3d60
--- /dev/null
@@ -0,0 +1,52 @@
+.\" 
+.\" cert-sync  manual page.
+.\" Copyright 2016 Microsoft Corp
+.\" Author:
+.\"   Jo Shields <joshield@microsoft.com>
+.\"
+.TH Mono "cert-sync"
+.SH NAME
+cert-sync \- Mono Certificate Store Sync Tool
+.SH SYNOPSIS
+.PP
+.B cert-sync [--quiet] [--user] filename
+.SH DESCRIPTION
+This tool allows you to populate a Mono certificate store, from a large 
+concatenated list of certificates in PEM format (commonly provided on most 
+Linux distributions).
+
+Its use is intended to be automated at Mono install time, by distribution 
+packagers, to seamlessly provide SSL support to Mono applications without 
+further user interaction.
+.SH OPTIONS
+.TP
+.I "--quiet"
+Suppress verbose output
+.TP
+.I "--user"
+Populate the per-user store in the user's home directory, instead of the 
+system-wide store.
+.TP
+.I "filename.crt"
+Path to a certificate bundle. The Mono store will have any extra entries 
+removed, and new entries added, to reflect the provided file.
+
+.SH EXAMPLES
+.TP
+.B cert-sync /etc/ssl/certs/ca-certificates.crt
+Synchronize the machine store, from the Debian cert store location
+.TP
+.B cert-sync --user /etc/pki/tls/certs/ca-bundle.crt
+Synchronize the user store, from the Red Hat cert store location
+
+.SH AUTHOR
+Written by Jo Shields
+
+.SH COPYRIGHT
+Copyright (C) 2016 Microsoft Corp
+.SH MAILING LISTS
+Visit http://lists.ximian.com/mailman/listinfo/mono-list for details.
+.SH WEB SITE
+Visit http://www.mono-project.com for details
+.SH SEE ALSO
+.BR certmgr(1)
index b80ffd0457f9fad271952beb31a7389830f52319..92bfa164b96340f38e80ec070b04222ebeacf264 100644 (file)
@@ -15,7 +15,7 @@ certmgr \- Mono Certificate Manager (CLI version)
 or
 .B certmgr -ssl [options] url
 .SH DESCRIPTION
-This tool allow to list, add, remove or extract certificates, certificate 
+This tool allows to list, add, remove or extract certificates, certificate 
 revocation lists (CRL) or certificate trust lists (CTL) to/from a 
 certificate store. Certificate stores are used to build and validate 
 certificate chains for Authenticode(r) code signing validation and SSL 
@@ -23,7 +23,7 @@ server certificates.
 .SH STORES
 The 
 .I store
-represents the certificate store to use.   It can be one of the
+represents the certificate store to use. It can be one of the
 following:
 .TP
 .I "My"
@@ -46,7 +46,7 @@ This is for untrusted roots
 List the certificates, CTL or CTL in the specified store.
 .TP
 .I "-add"
-Add a certificate, CRL or CTL to specified store. If filename it's a pkcs12 
+Add a certificate, CRL or CTL to specified store. If filename is a pkcs12 
 or pfx file, and it contains a private key, it will be imported to local key
 pair container.
 .TP
@@ -64,25 +64,25 @@ Copy a certificate, CRL or CTL from a store to a file.
 Download and add the certificates from a SSL session. You'll be asked to 
 confirm the addition of every certificate received from the server. Note 
 that SSL/TLS protocols do not requires a server to send the root certificate.
-This action assume an certificate (-c) object type and will import the 
+This action assumes a certificate (-c) object type and will import the 
 certificates in appropriate stores (i.e. server certificate in the 
-OtherPeople store, the root certificate in the Trust store, any other 
+OtherPeople store, the root certificate in the Trust store and any other 
 intermediate certificates in the IntermediateCA store).
 .TP
 .I "-importKey"
 Allows importing a private key from a pkcs12 file into a local key pair
-store. (Usefull when you already have the key's corresponding certificate
+store. (Useful when you already have the key's corresponding certificate
 installed at the specific store.)
 
 .SH OBJECT TYPES
 .TP
 .I "-c", "-cert", "-certificate"
-Add, Delete or Put certificates. That is the specified file must/will contains
+Add, Delete or Put certificates. That is the specified file must/will contain
 X.509 certificates in DER binary encoding.
 .TP
 .I "-crl"
 Add, Delete or Put certificate revocation lists (CRL). That is the specified 
-file must/will contains X.509 CRL in DER binary encoding.
+file must/will contain X.509 CRL in DER binary encoding.
 .TP
 .I "-ctl"
 Add, Delete or Put certificate trust lists (CRL). UNSUPPORTED.
@@ -96,7 +96,7 @@ Use the machine's certificate stores (instead of the default user's stores).
 More details displayed on the console.
 .TP
 .I "-p password"
-Use the specify password when accessing a pkcs12 file.
+Use the specified password when accessing a pkcs12 file.
 .TP
 .I "-help", "-h", "-?", "/?"
 Display help about this tool.
@@ -113,7 +113,7 @@ For example the trusted root certificates for a user would be kept under
 .TP
 Certificates files are kept in DER (binary) format (extension .cer).
 .TP
-The filenames either starts with
+The filenames either start with
 .I tbp 
 (thumbprint) or
 .I ski
index 8e20437b1aaacb0ac2ad2afcee8b09188955dea4..b60c6f708b83ded5d39917eb52fb26f1fd48504a 100644 (file)
@@ -42,7 +42,7 @@ associated with certificates present in user store.
 .B mono crlupdate.exe -f -m
 Force the download of every CRL associated with certificates present in
 the machine store. Note that the user running this needs read/write 
-access to the machine store or not update will occur.
+access to the machine store or update will not occur.
 
 .SH AUTHOR
 Written by Sebastien Pouliot
index 9379658e62e5ec4615a6f61f890f06f56bd458fd..a0f9e6f4f6acd62c6df19b1a0a84aadca07e306c 100644 (file)
@@ -224,7 +224,7 @@ versions uses the standard Gtk# key bindings.
 .PP
 The command set is similar to many other applications (cursor keys)
 and incorporates some of the Emacs commands for editing as well as a
-history mechanism to 
+history mechanism too.
 .PP
 .PP
 The following keyboard input is supported:
@@ -247,7 +247,7 @@ line in the history.
 .TP
 .I Down Arrow Key, Control-n
 Moves forward in the history, replaces the current line with the next
-lien in the history.
+line in the history.
 .TP
 .I Return
 Executes the current line if the statement or expression is complete,
index e8e319ccc65b980a5e568bf1ef2e4e58d95ebbc2..c2f2cfddbd8ba9afaec38a0acfd059e6aaba7a3c 100644 (file)
@@ -29,7 +29,7 @@ option is specified), and saves them to disk.
 The following options are available:
 .TP
 .I "-nologo"
-Supress the startup logo.
+Suppress the startup logo.
 .TP
 .I "-nosave"
 Do not save the discovered documents to disk. The default is to save the documents.
index ce7ff11c27aadf341a2ae73d3ddfdcb20ca329d3..644b85a6e4f123c8987dae19825eeb2f34778196 100644 (file)
--- a/man/mcs.1
+++ b/man/mcs.1
@@ -18,7 +18,8 @@ prepending the @ symbol to the response file name.
 The 
 .I mcs
 compiler is used to compile against the latest Mono Base Class Library
-version and fully implements C# 1.0, 2.0, 3.0 and 4.0 specifications.
+version and fully implements C# 1.0, 2.0, 3.0, 4.0, 5.0 and 6.0
+specifications.
 .PP
 See the section on packages for more information.
 .PP
@@ -163,7 +164,7 @@ The possible values are:
 .TP
 .I "Default"
 Instruct compiler to use the latest version. Equivalent is to omit the
-switch (this currently defaults to the C# 4.0 language specification).
+switch (this currently defaults to the C# 6.0 language specification).
 .TP
 .I "ISO-1"
 Restrict compiler to use only first ISO standardized features.
@@ -183,6 +184,14 @@ Restrict the compiler to use only the features available in C# 3.0
 Restrict the compiler to use only the features available in C# 4.0
 specification.
 .TP
+.I "5"
+Restrict the compiler to use only the features available in C# 5.0
+specification.
+.TP
+.I "6"
+Restrict the compiler to use only the features available in C# 6.0
+specification.
+.TP
 .I "experimental"
 Enables unstable features from upcoming versions of the language.
 .PP
@@ -229,6 +238,9 @@ Names the output file to be generated.
 .I \-\-parse
 Used for benchmarking.  The compiler will only parse its input files.
 .TP
+.I \-pathmap:K=V[,Kn=Vn]
+Sets a mapping for source path names used in generated output.
+.TP
 .I \-pkg:package1[,packageN]
 Reference assemblies for the given packages.
 .Sp
@@ -510,7 +522,7 @@ the MIT X11.  Please read the accompanying `COPYING' file for details.
 Alternative licensing for the compiler is available from Xamarin.
 .PP
 .SH SEE ALSO
-csharp(1), mdb(1), mono(1), mopen(1), pkg-config(1), sn(1)
+csharp(1), mono(1), pkg-config(1), sn(1)
 .PP
 .SH BUGS
 To report bugs in the compiler, you must file them on our bug tracking
index d61fc1757b1d70f822325fb6a661428c3e48aadc..3d067eb27ef9892b7d979a57b40f1d4fa17c4814 100644 (file)
@@ -21,38 +21,237 @@ default only the assemblies specified in the command line will be
 included in the bundle.  To automatically include all of the
 dependencies referenced, use the "--deps" command line option.
 .PP
-There are two modes of operation, the default one uses the
-C compiler to create a bundle and requires a complete C and Mono SDK
-to produced executables.   The simple mode (enabled when using the
-"--simple") command line option does not require this, and also allows
-for cross compilation.
+There are two modes of operation, one uses an existing Mono binary or
+a server-hosted list of binaries and is enabled when you use either
+the 
+.B --cross,
+.B --sdk
+or the
+.B --runtime
+command line options.   
+.PP
+An older mechanism creates a small C stub that links against the
+libmono library to produce a self-contained executable and requires a
+C compiler.   It is described in the "OLD EMBEDDING" section below.
 .PP
 For example, to create a bundle for hello world, use the following
 command:
 .nf
+
        $ mkbundle -o hello --simple hello.exe
+
 .fi
+.PP
+You can configure options to be passed to the Mono runtime directly
+into your executable, for this, use the 
+.I --options
+flag.  For example, the following disables inlining, by passing the
+"-O=-inline" command line option to the embedded executable:
+.nf
+
+       $ mkbundle -o hello --options -O=-inline --simple hello.exe
+
 .PP
 The simple version allows for cross-compiling, this requires a Mono
 runtime to be installed in the ~/.mono/targets/TARGET/mono to be
 available.   You can use the "--local-targets" to list all available
 targets, and the "--cross" argument to specify the target, like this:
 .nf
+
        $ mkbundle --local-targets      
        Available targets:
                default - Current System Mono
                4.4.0-macosx-x86
                4.4.0-debian-8-arm64
        $ mkbundle --cross 4.4.0-debian-8-powerpc hello.exe -o hello-debian
+
 .fi
 .PP
 The above will bundle your native library into hello-debian for
 a Debian 8 system running on a PowerPC machine.
+.PP
+We provide pre-packages binaries for Mono for various architectures,
+which allow you to cross compile, use the
+.B --list-targets
+to get a list of all targets supported, and use the 
+.B --fetch-target
+flag to retrieve a target that you do not have installed, like this:
+.nf
+       
+       $ mkbundle --list-targets
+       Cross-compilation targets available:
+       4.4.0-linux-libc2.13-amd64
+       4.4.0-linux-libc2.13-armel
+       4.4.0-linux-libc2.13-armhf
+       4.4.0-linux-libc2.13-i386
+       4.4.0-macos-10.7-amd64
+       4.4.0-macos-10.7-i386
+       4.4.2-linux-libc2.13-amd64
+       4.4.2-linux-libc2.13-armel
+       4.4.2-linux-libc2.13-armhf
+       4.4.2-linux-libc2.13-i386
+       4.4.2-macos-10.7-amd64
+       4.4.2-macos-10.7-i386
+
+       $ mkbundle --fetch-target 4.4.2-macos-10.7-i386
+
+.fi
+.PP
+And then you can produce a binary that will run on 32-bit Mono on
+MacOS:
+.nf
+
+       $ mkbundle --cross 4.4.2-macos-10.7-i386 hello.exe -o hello-macos
+
+.fi
+.PP
+Downloaded targets are stored
+.B ~/.mono/targets
+directory.
+.SH OPTIONS
+.TP 
+.I "--config FILE"
+Specifies that a machine.config file must be bundled as well.
+Typically this is $prefix/etc/mono/1.0/machine.config or
+$prefix/etc/mono/2.0/machine.config depending on the profile that you
+are using (1.0 or 2.0)
+.TP
+.I "--config-dir DIR"
+When passed, DIR will be set for the MONO_CFG_DIR environment variable
+.TP
+.I "--cross target"
+Use this to request mkbundle generate a cross-compiled binary.  It
+Creates a bundle for the specified target platform.  The target must
+be a directory in ~/.mono/targets/ that contains an SDK installation
+as produced by the mono-package-runtime tool.  You can get a list of
+the precompiled versions of the runtime using --list-targets and you
+can fetch a specific target using the --fetch-target command line
+option.
+.Sp
+This flag is mutually exclusive with 
+.I --sdk
+which is used to specify an absolute path to resolve the Mono runtime
+from and the --runtime option which is used to manually construct the
+cross-platform package.
+.TP
+.I "--deps"
+This option will bundle all of the referenced assemblies for the
+assemblies listed on the command line option.  This is useful to
+distribute a self-contained image.
+.TP
+.I "--env KEY=VALUE"
+Use this to hardcode an environment variable at runtime for KEY to be
+mapped to VALUE.   This is useful in scenarios where you want to
+enable certain Mono runtime configuration options that are controlled
+by environment variables.
+.TP
+.I "--fetch-target target"
+Downloads a precompiled runtime for the specified target from the Mono
+distribution site.
+.TP
+.I "--i18n encoding"
+Specified which encoding tables to ship with the executable.   By
+default, Mono ships the supporting I18N.dll assembly and the
+I18N.West.dll assembly.   If your application will use the
+System.Text.Encoding.GetEncoding with encodings other than the West
+encodings, you should specify them here.
+.Sp
+You can use the
+.B none
+parameter to request that no implicit encodings should be bundled,
+including the supporting I18N.dll, use this option if you have ran a
+linker on your own.
+.Sp
+You can use the 
+.B all
+flag to bundle all available encodings.
+.Sp
+Or you can use a comma delimited list of the workds CJK, MidWest,
+Other, Rare and West to specificy which encoding assemblies to distribute.
+.TP
+.I "-L path"
+Adds the `path' do the search list for assemblies.  The rules are the
+same as for the compiler -lib: or -L flags.
+.TP
+.I "--library [LIB,]PATH"
+Embeds the dynamic library file pointed to by `PATH' and optionally
+give it the name `LIB' into the bundled executable.   This is used to
+ship native library dependencies that are unpacked at startup and
+loaded from the runtime.
+.TP
+.I "--lists-targets"
+Lists all of the available local cross compilation targets available
+as precompiled binaries on the Mono distribution server.
+.TP
+.I "--local-targets"
+Lists all of the available local cross compilation targets.
+.TP
+.I "--machine-config FILE"
+Uses the given FILE as the machine.config file for the generated
+application.   
+.TP
+.I  "--nodeps"
+This is the default: \fImkbundle\fP will only include the assemblies that
+were specified on the command line to reduce the size of the resulting
+image created.
+.TP
+.I "-o filename"
+Places the output on `out'.  If the flag -c is specified, this is the
+C host program.  If not, this contains the resulting executable.
+.TP
+.I "--options OPTS"
+Since the resulting executable will be treated as a standalone
+program, you can use this option to pass configuration options to the
+Mono runtime and bake those into the resulting executable.  These
+options are specified as 
+.I OPTS.
+.Sp
+You can use the above to configure options that you would typically
+pass on the command line to Mono, before the main program is
+executed.   
+.Sp
+Additionally, users of your binary can still configure their own
+options by setting the 
+.I MONO_ENV_OPTIONS
+environment variable.
+.TP
+.I "--sdk SDK_PATH"
+Use this flag to specify a path from which mkbundle will resolve the
+Mono SDK from.   The SDK path should be the prefix path that you used
+to configure a Mono installation.   And would typically contain files
+lik
+.I SDK_PATH/bin/mono
+,
+.I SDK_PATH/lib/mono/4.5
+and so on.
+.Sp
+When this flag is specified,
+.I mkbundle
+will resolve the runtime, the framework libraries, unmanaged resources
+and configuration files from the files located in this directory.
+.Sp
+This flag is mutually exlusive with 
+.I --cross
+.
+.TP
+.I "--target-server SERVER"
+By default the mkbundle tool will download from a Mono server the
+target runtimes, you can specify a different server to provide
+cross-compiled runtimes.
 .SH OLD EMBEDDING
 .PP
+The old embedding system compiles a small C stub that embeds the
+C code and compiles the resulting executable using the system
+compiler.   This requires both a working C compiler installation and
+only works to bundle binaries for the current host.
+.PP
+The feature is still available, but we recommend the simpler, faster
+and more convenient new mode.
+.PP
 For example, to create a bundle for hello world, use the following
 command:
 .nf
+
        $ mkbundle -o hello hello.exe
 .fi
 .PP
@@ -66,6 +265,7 @@ you want to link additional libraries or control the generated output
 in more detail. For example, this could be used to link some libraries
 statically:
 .nf
+
        $ mkbundle -c -o host.c -oo bundles.o --deps hello.exe
 
        $ cc host.c bundles.o /usr/lib/libmono.a -lc -lrt
@@ -77,86 +277,40 @@ both the -c and --nomain options.  The resulting host.c file will
 not have a main() function.  Call mono_mkbundle_init() before
 initializing the JIT in your code so that the bundled assemblies
 are available to the embedded runtime.
-.SH OPTIONS
+.SH OLD EMBEDDING OPTIONS
+These options can only be used instead of using the 
+.B --cross, --runtime 
+or
+.B --simple 
+options.
 .TP
 .I "-c"
 Produce the stub file, do not compile the resulting stub.
 .TP
-.I "--cross target"
-Creates a bundle for the specified target platform.   The target
-must be a directory in ~/.mono/targets/ that contains a "mono"
-binary.   You can fetch various targets using the --fetch-target
-command line option.
-.TP
-.I "-o filename"
-Places the output on `out'.  If the flag -c is specified, this is the
-C host program.  If not, this contains the resulting executable.
-.TP
 .I "-oo filename"
 Specifies the name to be used for the helper object file that contains
 the bundle.
 .TP
-.I "-L path"
-Adds the `path' do the search list for assemblies.  The rules are the
-same as for the compiler -lib: or -L flags.
-.TP "--config FILE"
-Specifies that a machine.config file must be bundled as well.
-Typically this is $prefix/etc/mono/1.0/machine.config or
-$prefix/etc/mono/2.0/machine.config depending on the profile that you
-are using (1.0 or 2.0)
-.TP
-.I "--deps"
-This option will bundle all of the referenced assemblies for the
-assemblies listed on the command line option.  This is useful to
-distribute a self-contained image.
-.TP
-.I "--fetch-target target"
-Downloads a precompiled runtime for the specified target from the Mono
-distribution site.
-.TP
-.I  "--nodeps"
-This is the default: \fImkbundle\fP will only include the assemblies that
-were specified on the command line to reduce the size of the resulting
-image created.
-.TP
 .I "--keeptemp"
 By default \fImkbundle\fP will delete the temporary files that it uses to
 produce the bundle.  This option keeps the file around.
 .TP
-.I "--lists-targets"
-Lists all of the available local cross compilation targets available
-as precompiled binaries on the Mono distribution server.
-.TP
-.I "--local-targets"
-Lists all of the available local cross compilation targets.
-.TP
-.I "--machine-config FILE"
-Uses the given FILE as the machine.config file for the generated
-application.   
-.TP
 .I "--nomain"
 With the -c option, generate the host stub without a main() function.
 .TP
-.I "--config-dir DIR"
-When passed, DIR will be set for the MONO_CFG_DIR environment variable
-.TP
 .I "--static"
 By default \fImkbundle\fP dynamically links to mono and glib.  This option
 causes it to statically link instead.
 .TP
-.I "--target-server SERVER"
-By default the mkbundle tool will download from a Mono server the
-target runtimes, you can specify a different server to provide
-cross-compiled runtimes.
-.TP
 .I "-z"
 Compresses the assemblies before embedding. This results in smaller
 executable files, but increases startup time and requires zlib to be
 installed on the target system.
 .SH WINDOWS
-On Windows systems, it it necessary to have  Unix-like toolchain to be
-installed for \fImkbundle\fP to work.  You can use cygwin's and install gcc,
-gcc-mingw and as packages. 
+If you are using the old embedding on Windows systems, it it necessary
+to have Unix-like toolchain to be installed for \fImkbundle\fP to
+work.  You can use cygwin's and install gcc, gcc-mingw and as
+packages.
 .SH ENVIRONMENT VARIABLES
 .TP
 .I "AS"
@@ -175,7 +329,8 @@ cache.
 .PP
 Targets are loaded from ~/.mono/targets/TARGETNAME/mono
 .SH BUGS
-The option "--static" is not supported under Windows.
+The option "--static" is not supported under Windows when using the
+old embedding.
 Moreover, a full cygwin environment containing at least "gcc" and "as"
 is required for the build process. The generated executable does not
 depend on cygwin.
index c4589ea70c7243f74525d5669f342c983f24f39b..08a93ac91823901085ca08edf8daa9d6b08b2363 100644 (file)
@@ -332,6 +332,12 @@ Currently this merely ensures that you are running either the
 \fBMONO_ENV_OPTIONS\fR environment variable to force all of your child
 processes to use one particular kind of GC with the Mono runtime.
 .TP
+\fB--gc-debug=[options]\fR
+Command line equivalent of the \fBMONO_GC_DEBUG\fR environment variable.
+.TP
+\fB--gc-params=[options]\fR
+Command line equivalent of the \fBMONO_GC_PARAMS\fR environment variable.
+.TP
 \fB--arch=32\fR, \fB--arch=64\fR
 (Mac OS X only): Selects the bitness of the Mono binary used, if
 available. If the binary used is already for the selected bitness, nothing
index af61efa37cb84a91b735581972a4f8dec8565285..f19a02aa14ea8679cda72518cc466f57ee5a4ad8 100644 (file)
@@ -1,4 +1,8 @@
-.TH mprof-report 1 "" 
+.de Sp
+.if t .sp .5v
+.if n .sp
+..
+.TH mprof-report 1 ""
 .SH The Mono log profiler
 .PP
 The Mono \f[I]log\f[] profiler can be used to collect a lot of
@@ -88,7 +92,7 @@ provided by the Mono runtime and write them to a file named
 \f[I]output.mlpd\f[].
 When no option is specified, it is equivalent to using:
 .PP
-\f[B]--profile=log:calls,alloc,output=output.mlpd,maxframes=8,calldepth=100\f[]
+\f[B]--profile=log:calls,alloc,output=output.mlpd,maxframes=32,calldepth=100\f[]
 .PP
 The following options can be used to modify this default behaviour.
 Each option is separated from the next by a \f[B],\f[] character,
@@ -135,41 +139,16 @@ garbage collections
 to the control port
 .RE
 .IP \[bu] 2
-\f[I]sample[=TYPE[/FREQ]]\f[]: collect statistical samples of the
+\f[I]sample[=FREQ]\f[]: collect statistical samples of the
 program behaviour.
 The default is to collect a 100 times per second (100 Hz) the
 instruction pointer.
-This is equivalent to the value \[lq]cycles/100\[rq] for
-\f[I]TYPE\f[].
-On some systems, like with recent Linux kernels, it is possible to
-cause the sampling to happen for other events provided by the
-performance counters of the cpu.
-In this case, \f[I]TYPE\f[] can be one of:
-.RS 2
-.IP \[bu] 2
-\f[I]cycles\f[]: processor cycles
-.IP \[bu] 2
-\f[I]instr\f[]: executed instructions
-.IP \[bu] 2
-\f[I]cacherefs\f[]: cache references
-.IP \[bu] 2
-\f[I]cachemiss\f[]: cache misses
-.IP \[bu] 2
-\f[I]branches\f[]: executed branches
-.IP \[bu] 2
-\f[I]branchmiss\f[]: mispredicted branches
-.RE
-.IP \[bu] 2
-\f[I]time=TIMER\f[]: use the TIMER timestamp mode.
-TIMER can have the following values:
-.RS 2
-.IP \[bu] 2
-\f[I]fast\f[]: a usually faster but possibly more inaccurate timer
-.RE
+This is equivalent to the value \[lq]100\[rq].
+A value of zero for \f[I]FREQ\f[] effectively disables sampling.
 .IP \[bu] 2
 \f[I]maxframes=NUM\f[]: when a stack trace needs to be performed,
 collect \f[I]NUM\f[] frames at the most.
-The default is 8.
+The default is 32.
 .IP \[bu] 2
 \f[I]maxsamples=NUM\f[]: stop allocating reusable sample events
 once \f[I]NUM\f[] events have been allocated (a value of zero for
@@ -230,13 +209,15 @@ The following commands are available:
 \f[I]heapshot\f[]: perform a heapshot as soon as possible
 .RE
 .IP \[bu] 2
-\f[I]counters\f[]: sample counters values every 1 second. This allow
-a really lightweight way to have insight in some of the runtime key
-metrics. Counters displayed in non verbose mode are : Methods from AOT,
-Methods JITted using mono JIT, Methods JITted using LLVM, Total time
-spent JITting (sec), User Time, System Time, Total Time, Working Set,
-Private Bytes, Virtual Bytes, Page Faults and CPU Load Average (1min,
-5min and 15min).
+\f[I]nocounters\f[]: disables sampling of runtime and performance
+counters, which is normally done every 1 second.
+.IP \[bu] 2
+\f[I]coverage\f[]: collect code coverage data. This implies enabling
+the \f[I]calls\f[] option.
+.IP \[bu] 2
+\f[I]onlycoverage\f[]: can only be used with \f[I]coverage\f[]. This
+disables most other events so that the profiler mostly only collects
+coverage data.
 .RE
 .SS Analyzing the profile data
 .PP
@@ -260,19 +241,15 @@ To see this info invoke mprof-report as follows:
 \f[B]mprof-report\ --traces\ output.mlpd\f[]
 .PP
 The maximum number of methods in each stack trace can be specified
-with the \f[I]\[em]maxframes=NUM\f[] option:
+with the \f[I]--maxframes=NUM\f[] option:
 .PP
 \f[B]mprof-report\ --traces\ --maxframes=4\ output.mlpd\f[]
 .PP
 The stack trace info will be available if method enter/leave events
 have been recorded or if stack trace collection wasn't explicitly
 disabled with the \f[I]maxframes=0\f[] profiler option.
-Note that the profiler will collect up to 8 frames by default at
-specific events when the \f[I]nocalls\f[] option is used, so in
-that case, if more stack frames are required in mprof-report, a
-bigger value for maxframes when profiling must be used, too.
 .PP
-The \f[I]\[em]traces\f[] option also controls the reverse reference
+The \f[I]--traces\f[] option also controls the reverse reference
 feature in the heapshot report: for each class it reports how many
 references to objects of that class come from other classes.
 .SS Sort order for methods and allocations
@@ -362,6 +339,10 @@ version
 \f[I]heapshot\f[]: live heap usage at heap shots
 .IP \[bu] 2
 \f[I]counters\f[]: counters samples
+.IP \[bu] 2
+\f[I]coverage\f[]: code coverage data
+.IP \[bu] 2
+\f[I]stats\f[]: event statistics
 .PP
 It is possible to limit some of the data displayed to a timeframe
 of the program execution with the option:
@@ -391,23 +372,23 @@ Instead of printing the usual reports from the profiler data, it is
 possible to track some interesting information about some specific
 object addresses.
 The objects are selected based on their address with the
-\f[I]\[em]track\f[] option as follows:
+\f[I]--track\f[] option as follows:
 .PP
 \f[B]--track=0xaddr1[,0xaddr2,...]\f[]
 .PP
 The reported info (if available in the data file), will be class
 name, size, creation time, stack trace of creation (with the
-\f[I]\[em]traces\f[] option), etc.
+\f[I]--traces\f[] option), etc.
 If heapshot data is available it will be possible to also track
 what other objects reference one of the listed addresses.
 .PP
 The object addresses can be gathered either from the profiler
 report in some cases (like in the monitor lock report), from the
 live application or they can be selected with the
-\f[I]\[em]find=FINDSPEC\f[] option.
+\f[I]--find=FINDSPEC\f[] option.
 FINDSPEC can be one of the following:
 .IP \[bu] 2
-\f[I]S:SIZE\f[]: where the object is selected if it's size is at
+\f[I]S:SIZE\f[]: where the object is selected if its size is at
 least \f[I]SIZE\f[]
 .IP \[bu] 2
 \f[I]T:NAME\f[]: where the object is selected if \f[I]NAME\f[]
@@ -432,6 +413,13 @@ By default mprof-report will print the summary data to the console.
 To print it to a file, instead, use the option:
 .PP
 \f[B]--out=FILENAME\f[]
+.SS Processing code coverage data
+.PP
+If you ran the profiler with the \f[I]coverage\f[] option, you can
+process the collected coverage data into an XML file by running
+mprof-report like this:
+.PP
+\f[B]mprof-report --coverage-out=coverage.xml output.mlpd\f[]
 .SS Dealing with profiler slowness
 .PP
 If the profiler needs to collect lots of data, the execution of the
@@ -439,20 +427,20 @@ program will slow down significantly, usually 10 to 20 times
 slower.
 There are several ways to reduce the impact of the profiler on the
 program execution.
-.SS Use the statistical sampling mode
-.PP
+.IP "\f[I]Use the statistical sampling mode\f[]" 4
+.Sp
 Statistical sampling allows executing a program under the profiler
 with minimal performance overhead (usually less than 10%).
 This mode allows checking where the program is spending most of
-it's execution time without significantly perturbing its behaviour.
-.SS Collect less data
-.PP
+its execution time without significantly perturbing its behaviour.
+.IP "\f[I]Collect less data\f[]" 4
+.Sp
 Collecting method enter/leave events can be very expensive,
 especially in programs that perform many millions of tiny calls.
 The profiler option \f[I]nocalls\f[] can be used to avoid
 collecting this data or it can be limited to only a few call levels
 with the \f[I]calldepth\f[] option.
-.PP
+.Sp
 Object allocation information is expensive as well, though much
 less than method enter/leave events.
 If it's not needed, it can be skipped with the \f[I]noalloc\f[]
@@ -463,21 +451,12 @@ expensive as well.
 The impact of stack trace information can be reduced by setting a
 low value with the \f[I]maxframes\f[] option or by eliminating them
 completely, by setting it to 0.
-.PP
-The other major source of data is the heapshot profiler option:
-especially if the managed heap is big, since every object needs to
-be inspected.
+.Sp
+The other major source of data is the \f[I]heapshot\f[] profiler
+option: especially if the managed heap is big, since every object
+needs to be inspected.
 The \f[I]MODE\f[] parameter of the \f[I]heapshot\f[] option can be
 used to reduce the frequency of the heap shots.
-.SS Reduce the timestamp overhead
-.PP
-On many operating systems or architectures what actually slows down
-profiling is the function provided by the system to get timestamp
-information.
-The \f[I]time=fast\f[] profiler option can be usually used to speed
-up this operation, but, depending on the system, time accounting
-may have some level of approximation (though statistically the data
-should be still fairly valuable).
 .SS Dealing with the size of the data files
 .PP
 When collecting a lot of information about a profiled program, huge
@@ -486,15 +465,15 @@ There are a few ways to minimize the amount of data, for example by
 not collecting some of the more space-consuming information or by
 compressing the information on the fly or by just generating a
 summary report.
-.SS Reducing the amount of data
-.PP
+.IP "\f[I]Reducing the amount of data\f[]" 4
+.Sp
 Method enter/leave events can be excluded completely with the
 \f[I]nocalls\f[] option or they can be limited to just a few levels
 of calls with the \f[I]calldepth\f[] option.
 For example, the option:
-.PP
+.Sp
 \f[B]calldepth=10\f[]
-.PP
+.Sp
 will ignore the method events when there are more than 10 managed
 stack frames.
 This is very useful for programs that have deep recursion or for
@@ -503,59 +482,59 @@ the call stack.
 The optimal number for the calldepth option depends on the program
 and it needs to be balanced between providing enough profiling
 information and allowing fast execution speed.
-.PP
+.Sp
 Note that by default, if method events are not recorded at all, the
 profiler will collect stack trace information at events like
 allocations.
 To avoid gathering this data, use the \f[I]maxframes=0\f[] profiler
 option.
-.PP
+.Sp
 Allocation events can be eliminated with the \f[I]noalloc\f[]
 option.
-.PP
+.Sp
 Heap shot data can also be huge: by default it is collected at each
 major collection.
 To reduce the frequency, you can specify a heapshot mode: for
 example to collect every 5 collections (including major and minor):
-.PP
+.Sp
 \f[B]heapshot=5gc\f[]
-.PP
+.Sp
 or when at least 5 seconds passed since the last heap shot:
-.PP
+.Sp
 \f[B]heapshot=5000ms\f[]
-.SS Compressing the data
-.PP
+.IP "\f[I]Compressing the data\f[]" 4
+.Sp
 To reduce the amout of disk space used by the data, the data can be
 compressed either after it has been generated with the gzip
 command:
-.PP
+.Sp
 \f[B]gzip\ -9\ output.mlpd\f[]
-.PP
+.Sp
 or it can be compressed automatically by using the \f[I]zip\f[]
 profiler option.
 Note that in this case there could be a significant slowdown of the
 profiled program.
-.PP
+.Sp
 The mprof-report program will tranparently deal with either
 compressed or uncompressed data files.
-.SS Generating only a summary report
-.PP
+.IP "\f[I]Generating only a summary report\f[]" 4
+.Sp
 Often it's enough to look at the profiler summary report to
 diagnose an issue and in this case it's possible to avoid saving
 the profiler data file to disk.
 This can be accomplished with the \f[I]report\f[] profiler option,
 which will basically send the data to the mprof-report program for
 display.
-.PP
+.Sp
 To have more control of what summary information is reported (or to
 use a completely different program to decode the profiler data),
 the \f[I]output\f[] profiler option can be used, with \f[B]|\f[] as
 the first character: the rest of the output name will be executed
 as a program with the data fed in on the standard input.
-.PP
+.Sp
 For example, to print only the Monitor summary with stack trace
 information, you could use it like this:
-.PP
+.Sp
 \f[B]output=|mprof-report\ --reports=monitor\ --traces\ -\f[]
 .SH WEB SITE
 http://www.mono-project.com/docs/debug+profile/profile/profiler/
@@ -563,5 +542,4 @@ http://www.mono-project.com/docs/debug+profile/profile/profiler/
 .PP
 mono(1)
 .SH AUTHORS
-Paolo Molaro.
-
+Paolo Molaro, Alex Rønne Petersen
index f33fcccf2d7635f498496404d5ed0dbadd8f1d56..14ad0cbd10c74283e2d25bc4cb1682d77c5dcb90 100644 (file)
@@ -41,7 +41,6 @@ DISTFILES = \
        executable.make                 \
        gensources.sh                   \
        library.make                    \
-       nunit-summary.xsl               \
        rules.make                      \
        tests.make                      \
        $(COMMON_SRCS:%=common/%)       \
index a38d371845a0d89544a628389bebdc2cb7c0117d..0a4673203d5048f0edff23a20fefc49d9bdadd6c 100644 (file)
@@ -5,7 +5,7 @@ static class AssemblyRef
        internal const string System = "System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35";
 
        public const string EcmaPublicKey = "b77a5c561934e089";
-#if NET_2_1
+#if MOBILE
        public const string FrameworkPublicKeyFull = "0024000004800000940000000602000000240000525341310004000001000100B5FC90E7027F67871E773A8FDE8938C81DD402BA65B9201D60593E96C492651E889CC13F1415EBB53FAC1131AE0BD333C5EE6021672D9718EA31A8AEBD0DA0072F25D87DBA6FC90FFD598ED4DA35E44C398C454307E8E33B8426143DAEC9F596836F97C8F74750E5975C64E2189F45DEF46B2A2B1247ADC3652BF5C308055DA9";
        public const string FrameworkPublicKeyFull2 = "00240000048000009400000006020000002400005253413100040000010001008D56C76F9E8649383049F383C44BE0EC204181822A6C31CF5EB7EF486944D032188EA1D3920763712CCB12D75FB77E9811149E6148E5D32FBAAB37611C1878DDC19E20EF135D0CB2CFF2BFEC3D115810C3D9069638FE4BE215DBF795861920E5AB6F7DB2E2CEEF136AC23D5DD2BF031700AEC232F6C6B1C785B4305C123B37AB";
 #else
index 7351be92b403d5543aa0be8ccebb45a45add2842..87b005e763a2c4b30abb0dd0f05862fe49c10380 100644 (file)
@@ -39,7 +39,7 @@ static class Consts
        public const string MonoProduct = "Mono Common Language Infrastructure";
        public const string MonoCopyright = "(c) Various Mono authors";
 
-#if NET_2_1
+#if MOBILE
        // Versions of .NET Framework for Silverlight 4.0
        public const string FxVersion = "2.0.5.0";
        public const string VsVersion = "9.0.0.0"; // unused, but needed for compilation
@@ -118,7 +118,7 @@ static class Consts
        public const string AssemblyPresentationCore_4_0 = "PresentationCore, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35";
        public const string AssemblyPresentationFramework_3_5 = "PresentationFramework, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35";
        public const string AssemblySystemServiceModel_3_0 = "System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089";
-#elif NET_2_1
+#elif MOBILE
        public const string AssemblySystem_Core = "System.Core, Version=" + FxVersion + ", Culture=neutral, PublicKeyToken=b77a5c561934e089";
 #endif
 }
index b9e02f62b26855d207fe6bde66f9900f43b44d19..631b764bf9dd24608afc325f7d47d345ea34edee 100644 (file)
@@ -40,7 +40,7 @@ class X {
                if (!Version.TryParse (field.GetValue (null) as string, out version))
                        return 4;
 
-               if (version < new Version (3, 8))
+               if (version < new Version (4, 0))
                        return 5;
 
                return 0;
index 145665799ccaaccd74e1c7a9617f8f1d725da98b..9e4fcf64a306bda16b94c324ae81371f7e951156 100644 (file)
@@ -10,7 +10,7 @@
 CODEPAGE = 65001
 
 RUNTIME_FLAGS = 
-TEST_HARNESS = $(topdir)/class/lib/$(PROFILE)/$(PARENT_PROFILE)nunit-console.exe
+TEST_HARNESS = $(topdir)/class/lib/$(PROFILE)/$(PARENT_PROFILE)nunit-lite-console.exe
 MCS_FLAGS = 
 MBAS_FLAGS = $(PLATFORM_DEBUG_FLAGS)
 LIBRARY_FLAGS = /noconfig
index afcad223f8e969f9261f2d7c631a2b624beefbc7..8acb0f5df619f789fd717207654d9178d6d9d178 100644 (file)
@@ -42,7 +42,9 @@ executable_CLEAN_FILES += $(build_lib) $(build_lib).so $(build_lib).mdb $(build_
 
 makefrag = $(depsdir)/$(PROFILE)_$(base_prog).makefrag
 
+ifndef NO_BUILD
 all-local: $(the_lib) $(PROGRAM_config)
+endif
 
 install-local: all-local
 test-local: all-local
index e0c16f48e90558609352e080ed67c54f4e64b43e..e604beb8f75e5cdcf411a963970d3423f2f377c6 100644 (file)
@@ -316,8 +316,6 @@ endif
 library_CLEAN_FILES += $(PROFILE)_aot.log
 
 ifdef PLATFORM_AOT_SUFFIX
-Q_AOT=$(if $(V),,@echo "AOT     [$(PROFILE)] $(notdir $(@))";)
-
 $(the_lib)$(PLATFORM_AOT_SUFFIX): $(the_lib)
        $(Q_AOT) MONO_PATH='$(the_libdir_base)' > $(PROFILE)_$(LIBRARY_NAME)_aot.log 2>&1 $(RUNTIME) $(AOT_BUILD_FLAGS) --debug $(the_lib)
 
diff --git a/mcs/build/nunit-summary.xsl b/mcs/build/nunit-summary.xsl
deleted file mode 100644 (file)
index 70972ad..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
-<xsl:output method='text'/>
-
-<xsl:template match="/">
-       <xsl:apply-templates/>
-</xsl:template>
-
-<xsl:template match="test-results">
-<xsl:text>Tests run: </xsl:text>
-<xsl:value-of select="@total"/>
-<xsl:text>, Failures: </xsl:text>
-<xsl:value-of select="@failures"/>
-<xsl:text>, Not run: </xsl:text>
-<xsl:value-of select="@not-run"/>
-<xsl:text>, Time: </xsl:text>
-<xsl:value-of select="test-suite/@time"/>
-<xsl:text> seconds
-</xsl:text>
-<xsl:text>
-</xsl:text>
-
-<xsl:if test="//test-suite[failure]"><xsl:text>Test Fixture SetUp Failures:
-</xsl:text></xsl:if>
-<xsl:apply-templates select="//test-suite[failure]"/>
-<xsl:if test="//test-case[failure]"><xsl:text>Test Case Failures:
-</xsl:text></xsl:if>
-<xsl:apply-templates select="//test-case[failure]"/>
-<xsl:if test="//test-case[@executed='False']"><xsl:text>Tests not run:
-</xsl:text></xsl:if>
-<xsl:apply-templates select="//test-case[@executed='False']"/>
-<xsl:text disable-output-escaping='yes'>&#xD;&#xA;</xsl:text>
-</xsl:template>
-
-<xsl:template match="test-case|test-suite">
-       <xsl:value-of select="position()"/><xsl:text>) </xsl:text>
-       <xsl:value-of select="@name"/>
-       <xsl:text> : </xsl:text>
-       <xsl:value-of select="child::node()/message"/>
-<xsl:text disable-output-escaping='yes'>&#xD;&#xA;</xsl:text>
-       <xsl:if test="failure">
-               <xsl:value-of select="failure/stack-trace"/>
-<xsl:text>
-</xsl:text>
-       </xsl:if>
-</xsl:template>
-
-</xsl:stylesheet>
index bed99f53387d0a7b9860fcb5334478d926a22769..4f34c924f03258a9d7c7f0618f0b33c317e31826 100644 (file)
@@ -7,7 +7,7 @@ PLATFORM_DEBUG_FLAGS = /debug+ /debug:full
 PLATFORM_MCS_FLAGS = /nologo
 PLATFORM_RUNTIME = 
 PLATFORM_CORLIB = mscorlib.dll
-PLATFORM_TEST_HARNESS_EXCLUDES =
+PLATFORM_TEST_HARNESS_EXCLUDES = NotOnWindows,
 
 EXTERNAL_MCS = mcs
 EXTERNAL_MBAS = vbc.exe
index b48617d66fabed49adcbffeccc0e89549afd6a8e..12b80615bdb7f0283c9127348d78b8e005c4b467 100644 (file)
@@ -65,7 +65,7 @@ do-profile-check: $(depsdir)/.stamp
                $(MAKE) -s do-profile-check-monolite ; \
            else \
                echo "*** The compiler '$(BOOTSTRAP_MCS)' doesn't appear to be usable." 1>&2; \
-                echo "*** You need Mono version 3.8 or better installed to build MCS" 1>&2 ; \
+                echo "*** You need Mono version 4.0 or better installed to build MCS" 1>&2 ; \
                 echo "*** Check mono README for information on how to bootstrap a Mono installation." 1>&2 ; \
                echo "*** The version of '$(BOOTSTRAP_MCS)' is: `$(BOOTSTRAP_MCS) --version`." 1>&2 ; \
                exit 1; fi; fi
@@ -74,17 +74,17 @@ do-profile-check: $(depsdir)/.stamp
 ifdef use_monolite
 
 do-profile-check-monolite:
-       echo "*** The contents of your 'monolite' directory may be out-of-date" 1>&2
-       echo "*** You may want to try 'make get-monolite-latest'" 1>&2
+       @echo "*** The contents of your 'monolite' directory may be out-of-date" 1>&2
+       @echo "*** You may want to try 'make get-monolite-latest'" 1>&2
        rm -f $(monolite_flag)
        exit 1
 
 else
 
 do-profile-check-monolite: $(depsdir)/.stamp
-       echo "*** The compiler '$(BOOTSTRAP_MCS)' doesn't appear to be usable." 1>&2
-       echo "*** Trying the 'monolite' directory." 1>&2
-       echo dummy > $(monolite_flag)
+       @echo "*** The compiler '$(BOOTSTRAP_MCS)' doesn't appear to be usable." 1>&2
+       @echo "*** Trying the 'monolite' directory." 1>&2
+       @echo dummy > $(monolite_flag)
        $(MAKE) do-profile-check
 
 endif
index d9ff3b67dc9334f4b6727536b33ef219a08db150..bf52c7e791e9ec240a2e4790565f926dc450828a 100644 (file)
@@ -32,7 +32,6 @@ PROFILE_MCS_FLAGS = \
        $(PLATFORM_DEBUG_FLAGS)
 
 FRAMEWORK_VERSION = 2.1
-NUNIT_LITE = yes
 
 # the tuner takes care of the install
 NO_INSTALL = yes
index e4370cf4f985b188dc80ed333347e114bf4e24c1..ff9e0fd4536182d689f8530b5b40639e5983bfe3 100644 (file)
@@ -31,7 +31,8 @@ PROFILE_MCS_FLAGS = \
        -nowarn:1699 \
        -nostdlib \
        $(DEFAULT_REFERENCES) \
-       $(PLATFORM_DEBUG_FLAGS)
+       $(PLATFORM_DEBUG_FLAGS) \
+       $(MONOTOUCH_MCS_FLAGS)
 
 FRAMEWORK_VERSION = 2.1
 
@@ -39,3 +40,5 @@ FRAMEWORK_VERSION = 2.1
 NO_INSTALL = yes
 MOBILE_STATIC = yes
 MOBILE_PROFILE = yes
+
+PROFILE_DISABLE_BTLS=1
index 0242c20bf515ca05121382763c7a25f3d1d9e86d..4bba2f421ac849b4f0869f32b72a1b4d57f51e3c 100644 (file)
@@ -1,9 +1,11 @@
 include $(topdir)/build/profiles/monotouch.make
 
 PROFILE_MCS_FLAGS += \
+       -d:FEATURE_NO_BSD_SOCKETS \
        -d:MONOTOUCH_WATCH
 
 NO_THREAD_ABORT=1
 NO_THREAD_SUSPEND_RESUME=1
 NO_MULTIPLE_APPDOMAINS=1
 NO_PROCESS_START=1
+NO_MONO_SECURITY=1
index 7b3eb80a551dc7325b9cfde0edc5728899696bf2..e826c7e7e31e1b734fbd5625532536f3184d787a 100644 (file)
@@ -1,6 +1,7 @@
 include $(topdir)/build/profiles/monotouch_runtime.make
 
 PROFILE_MCS_FLAGS += \
+       -d:FEATURE_NO_BSD_SOCKETS \
        -d:MONOTOUCH_WATCH
 
 NO_THREAD_ABORT=1
@@ -8,3 +9,4 @@ NO_THREAD_SUSPEND_RESUME=1
 # The binding generator (bwatch) still needs to execute processes,
 # so we need a System.dll that can do that.
 #NO_PROCESS_START=1
+NO_MONO_SECURITY=1
index 50e8214884dfd91c975de9c1071304447aba3db5..ab1aa6fa0716e6afd0799f5764958fda7cde1e06 100644 (file)
@@ -28,10 +28,13 @@ PROFILE_MCS_FLAGS = \
        -nowarn:1699 \
        -nostdlib \
        $(DEFAULT_REFERENCES) \
-       $(PLATFORM_DEBUG_FLAGS)
+       $(PLATFORM_DEBUG_FLAGS) \
+       $(XAMMAC_MCS_FLAGS)
 
 FRAMEWORK_VERSION = 2.1
 NO_TEST = yes
 NO_INSTALL = yes
 MOBILE_DYNAMIC = yes
 MOBILE_PROFILE = yes
+
+PROFILE_DISABLE_BTLS=1
index 83bfc92fcb26b3dba7f4dac44c22de4506cb0e31..b9881fe64def8d8c9b90731784504d8780795474 100644 (file)
@@ -1,11 +1,14 @@
 include $(topdir)/build/profiles/net_4_x.make
+
 PROFILE_MCS_FLAGS += \
        -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK \
        -d:NO_SYSTEM_DRAWING_DEPENDENCY \
        -d:NO_WINFORMS_DEPENDENCY \
        -d:NO_SYSTEM_WEB_DEPENDENCY \
        -d:XAMMAC_4_5 \
-       -d:XAMARIN_MODERN
+       -d:XAMARIN_MODERN \
+       $(XAMMAC_MCS_FLAGS)
+
 XAMMAC_4_5=1
 NO_WINDOWS_BASE=1
 NO_SYSTEM_WEB_DEPENDENCY=1
@@ -15,3 +18,5 @@ NO_SYSTEM_DRAWING_DEPENDENCY=1
 NO_SYSTEM_SERVICEMODEL_ACTIVATION_DEPENDENCY=1
 NO_SYSTEM_DESIGN_DEPENDENCY=1
 NO_SYSTEM_DIRECTORY_SERVICES_DEPENDENCY=1
+
+PROFILE_DISABLE_BTLS=1
index ac3a476dfb1055fa46cad6cca78fddf90391d007..18e2739bb8686c2a0825af71c4b00c80fac53a49 100644 (file)
@@ -23,6 +23,7 @@ VERSION = 0.93
 Q=$(if $(V),,@)
 # echo -e "\\t" does not work on some systems, so use 5 spaces
 Q_MCS=$(if $(V),,@echo "MCS     [$(intermediate)$(PROFILE)] $(notdir $(@))";)
+Q_AOT=$(if $(V),,@echo "AOT     [$(intermediate)$(PROFILE)] $(notdir $(@))";)
 
 ifndef BUILD_TOOLS_PROFILE
 BUILD_TOOLS_PROFILE = build
@@ -116,22 +117,6 @@ endif
 
 include $(topdir)/build/profiles/$(PROFILE).make
 
-# If the profile is using nunit-lite, use it
-ifdef NUNIT_LITE
-TEST_HARNESS=$(topdir)/class/lib/$(PROFILE)/nunit-lite-console.exe
-endif
-
-# Make sure propagates
-export TEST_HARNESS
-
-# If the profile is using nunit-lite, use it
-ifdef NUNIT_LITE
-TEST_HARNESS=$(topdir)/class/lib/$(PROFILE)/nunit-lite-console.exe
-endif
-
-# Make sure propagates
-export TEST_HARNESS
-
 ifdef BCL_OPTIMIZE
 PROFILE_MCS_FLAGS += -optimize
 endif
@@ -179,7 +164,6 @@ STD_TARGETS = test run-test run-test-ondotnet clean install uninstall doc-update
 $(STD_TARGETS): %: do-%
 
 ifdef PLATFORM_AOT_SUFFIX
-AOT_PROFILE_ASSEMBLIES = $(shell cd $(topdir)/class/lib/$(PROFILE)/ && find . | grep -E '(dll|exe)$$' | grep -v -E 'bare|plaincore|secxml|Facades' | sed 's:\./::g' | tr '\n' ' ')
 
 do-all-aot:
        $(MAKE) do-all TOP_LEVEL_DO=do-all
@@ -190,18 +174,16 @@ do-all-aot:
 # be able to evaluate the .dylibs to make
 ifneq ("$(wildcard $(topdir)/class/lib/$(PROFILE))","")
 
-AOT_PROFILE_ASSEMBLIES_CMD = cd $(topdir)/class/lib/$(PROFILE)/ && find . | grep -E '(dll|exe)$$' | grep -v -E 'bare|plaincore|secxml|Facades|ilasm' | sed 's:\./::g' | tr '\n' ' '
-AOT_PROFILE_ASSEMBLIES_CMD_SAFE = $(AOT_PROFILE_ASSEMBLIES_CMD) || true
-AOT_PROFILE_ASSEMBLIES = $(shell $(AOT_PROFILE_ASSEMBLIES_CMD_SAFE))
+AOT_PROFILE_ASSEMBLIES := $(sort $(patsubst .//%,%,$(filter-out %bare% %plaincore% %secxml% %Facades% %ilasm%,$(filter %.dll %.exe,$(wildcard $(topdir)/class/lib/$(PROFILE)/*)))))
 
 # This can run in parallel
 .PHONY: aot-all-profile
-aot-all-profile: $(patsubst %,$(topdir)/class/lib/$(PROFILE)/%$(PLATFORM_AOT_SUFFIX),$(AOT_PROFILE_ASSEMBLIES))
+aot-all-profile: $(patsubst %,%$(PLATFORM_AOT_SUFFIX),$(AOT_PROFILE_ASSEMBLIES))
 
-$(topdir)/class/lib/$(PROFILE)/%$(PLATFORM_AOT_SUFFIX): $(topdir)/class/lib/$(PROFILE)/%
-       @ mkdir -p $(topdir)/class/lib/$(PROFILE)/$*_bitcode_tmp
-       @echo "AOT     [$(PROFILE)] AOT $* " && cd $(topdir)/class/lib/$(PROFILE)/ && MONO_PATH="." $(RUNTIME) $(RUNTIME_FLAGS) $(AOT_BUILD_FLAGS),temp-path=$*_bitcode_tmp $* >> $(PROFILE)-aot.log
-       @ rm -rf $(topdir)/class/lib/$(PROFILE)/$*_bitcode_tmp
+%$(PLATFORM_AOT_SUFFIX): %
+       @ mkdir -p $*_bitcode_tmp
+       $(Q_AOT) MONO_PATH="$(dir $*)" $(RUNTIME) $(RUNTIME_FLAGS) $(AOT_BUILD_FLAGS),temp-path=$*_bitcode_tmp --verbose $* > $@.aot-log
+       @ rm -rf $*_bitcode_tmp
 
 endif #ifneq ("$(wildcard $(topdir)/class/lib/$(PROFILE))","")
 
index 16d3a64b65ef2890025c644210a2fbaa7fb7ab6b..d9f6a95ff72b5d1653e3a0f809d994029c3ee5cf 100644 (file)
@@ -19,11 +19,7 @@ TEST_RUNTIME_WRAPPERS_PATH = $(shell dirname $(RUNTIME))/_tmpinst/bin
 ## Unit test support
 ifndef NO_TEST
 
-ifdef NUNIT_LITE
 test_nunit_lib = nunitlite.dll
-else
-test_nunit_lib = nunit.framework.dll nunit.core.dll nunit.util.dll nunit.mocks.dll
-endif
 
 TEST_LIB_MCS_FLAGS = $(patsubst %,-r:$(topdir)/class/lib/$(PROFILE)/%.dll,$(TEST_LIB_REFS))
 
@@ -58,19 +54,11 @@ ifndef NO_TEST
 $(test_nunit_dep): $(topdir)/build/deps/nunit-$(PROFILE).stamp
        @if test -f $@; then :; else rm -f $<; $(MAKE) $<; fi
 
-ifdef NUNIT_LITE
 $(topdir)/build/deps/nunit-$(PROFILE).stamp:
 ifndef PARENT_PROFILE
        cd ${topdir}/tools/nunit-lite && $(MAKE)
 endif
        echo "stamp" >$@
-else
-$(topdir)/build/deps/nunit-$(PROFILE).stamp:
-ifndef PARENT_PROFILE
-       cd ${topdir}/nunit24 && $(MAKE)
-endif
-       echo "stamp" >$@
-endif
 
 tests_CLEAN_FILES += $(topdir)/build/deps/nunit-$(PROFILE).stamp
 endif
@@ -90,44 +78,18 @@ run-test-ondotnet-local: run-test-ondotnet-lib
 TEST_HARNESS_EXCLUDES = -exclude=$(PLATFORM_TEST_HARNESS_EXCLUDES)$(PROFILE_TEST_HARNESS_EXCLUDES)NotWorking,ValueAdd,CAS,InetAccess
 TEST_HARNESS_EXCLUDES_ONDOTNET = /exclude:$(PLATFORM_TEST_HARNESS_EXCLUDES)$(PROFILE_TEST_HARNESS_EXCLUDES)NotDotNet,CAS
 
-ifdef NUNIT_LITE
 NOSHADOW_FLAG =
-NUNIT_XML_FLAG = -format:nunit2 -result:
-OUTPUT_FILE_FLAG=-out
-else
-OUTPUT_FILE_FLAG=-output
-NOSHADOW_FLAG = -noshadow
-NUNIT_XML_FLAG = -xml=
-endif
-
-ifdef NUNIT_LITE
-NOSHADOW_FLAG =
-NUNIT_XML_FLAG = -format:nunit2 -result:
-OUTPUT_FILE_FLAG=-out
-else
-OUTPUT_FILE_FLAG=-output
-NOSHADOW_FLAG = -noshadow
-NUNIT_XML_FLAG = -xml=
-endif
-
-ifdef TEST_HARNESS_VERBOSE
-TEST_HARNESS_OUTPUT = -labels
-TEST_HARNESS_OUTPUT_ONDOTNET = -labels
-TEST_HARNESS_POSTPROC = :
-TEST_HARNESS_POSTPROC_ONDOTNET = :
-else
-TEST_HARNESS_OUTPUT = $(OUTPUT_FILE_FLAG)=TestResult-$(PROFILE).log
-TEST_HARNESS_OUTPUT_ONDOTNET = $(OUTPUT_FILE_FLAG)=TestResult-ondotnet-$(PROFILE).log
-TEST_HARNESS_POSTPROC = (echo ''; cat TestResult-$(PROFILE).log) | sed '1,/^Tests run: /d'; xsltproc $(topdir)/build/nunit-summary.xsl TestResult-$(PROFILE).xml >> TestResult-$(PROFILE).log
-TEST_HARNESS_POSTPROC_ONDOTNET = (echo ''; cat TestResult-ondotnet-$(PROFILE).log) | sed '1,/^Tests run: /d'; xsltproc $(topdir)/build/nunit-summary.xsl TestResult-ondotnet-$(PROFILE).xml >> TestResult-ondotnet-$(PROFILE).log
-endif
 
 ifdef FIXTURE
-FIXTURE_ARG = -fixture=MonoTests.$(FIXTURE)
+FIXTURE_ARG = -test=MonoTests.$(FIXTURE)
 endif
 
 ifdef TESTNAME
-TESTNAME_ARG = -run=MonoTests.$(TESTNAME)
+TESTNAME_ARG = -test=MonoTests.$(TESTNAME)
+endif
+
+ifdef TEST_HARNESS_VERBOSE
+LABELS_ARG = -labels
 endif
 
 ifdef ALWAYS_AOT
@@ -139,19 +101,30 @@ test-local-aot-compile: $(topdir)/build/deps/nunit-$(PROFILE).stamp
 
 endif # ALWAYS_AOT
 
+NUNITLITE_CONFIG_FILE=$(topdir)/class/lib/$(PROFILE)/$(PARENT_PROFILE)nunit-lite-console.exe.config
+
+patch-nunitlite-appconfig:
+       cp -f $(topdir)/tools/nunit-lite/nunit-lite-console/nunit-lite-console.exe.config.tmpl $(NUNITLITE_CONFIG_FILE)
+ifdef TEST_NUNITLITE_APP_CONFIG_GLOBAL
+       sed -i -e "/__INSERT_CUSTOM_APP_CONFIG_GLOBAL__/r $(TEST_NUNITLITE_APP_CONFIG_GLOBAL)" $(NUNITLITE_CONFIG_FILE)
+endif
+ifdef TEST_NUNITLITE_APP_CONFIG_RUNTIME
+       sed -i -e "/__INSERT_CUSTOM_APP_CONFIG_RUNTIME__/r $(TEST_NUNITLITE_APP_CONFIG_RUNTIME)" $(NUNITLITE_CONFIG_FILE)
+endif
+
 ## FIXME: i18n problem in the 'sed' command below
-run-test-lib: test-local test-local-aot-compile
+run-test-lib: test-local test-local-aot-compile patch-nunitlite-appconfig
        ok=:; \
-       PATH="$(TEST_RUNTIME_WRAPPERS_PATH):$(PATH)" MONO_REGISTRY_PATH="$(HOME)/.mono/registry" MONO_TESTS_IN_PROGRESS="yes" $(TEST_RUNTIME) $(RUNTIME_FLAGS) $(AOT_RUN_FLAGS) $(TEST_HARNESS) $(test_assemblies) $(NOSHADOW_FLAG) $(TEST_HARNESS_FLAGS) $(LOCAL_TEST_HARNESS_FLAGS) $(TEST_HARNESS_EXCLUDES) $(TEST_HARNESS_OUTPUT) $(NUNIT_XML_FLAG)TestResult-$(PROFILE).xml $(FIXTURE_ARG) $(TESTNAME_ARG)|| ok=false; \
+       PATH="$(TEST_RUNTIME_WRAPPERS_PATH):$(PATH)" MONO_REGISTRY_PATH="$(HOME)/.mono/registry" MONO_TESTS_IN_PROGRESS="yes" $(TEST_RUNTIME) $(RUNTIME_FLAGS) $(AOT_RUN_FLAGS) $(TEST_HARNESS) $(test_assemblies) $(NOSHADOW_FLAG) $(TEST_HARNESS_FLAGS) $(LOCAL_TEST_HARNESS_FLAGS) $(TEST_HARNESS_EXCLUDES) $(LABELS_ARG) -format:nunit2 -result:TestResult-$(PROFILE).xml $(FIXTURE_ARG) $(TESTNAME_ARG)|| ok=false; \
        if [ ! -f "TestResult-$(PROFILE).xml" ]; then echo "<?xml version='1.0' encoding='utf-8'?><test-results failures='1' total='1' not-run='0' name='bcl-tests' date='$$(date +%F)' time='$$(date +%T)'><test-suite name='$(strip $(test_assemblies))' success='False' time='0'><results><test-case name='crash' executed='True' success='False' time='0'><failure><message>The test runner didn't produce a test result XML, probably due to a crash of the runtime. Check the log for more details.</message><stack-trace></stack-trace></failure></test-case></results></test-suite></test-results>" > TestResult-$(PROFILE).xml; fi; \
-       $(TEST_HARNESS_POSTPROC) ; $$ok
+       $$ok
 
 ## Instructs compiler to compile to target .net execution, it can be usefull in rare cases when runtime detection is not possible
 run-test-ondotnet-lib: LOCAL_TEST_COMPILER_ONDOTNET_FLAGS:=-d:RUN_ONDOTNET
 run-test-ondotnet-lib: test-local
        ok=:; \
-       $(TEST_HARNESS) $(test_assemblies) $(NOSHADOW_FLAG) $(TEST_HARNESS_FLAGS) $(LOCAL_TEST_HARNESS_ONDOTNET_FLAGS) $(TEST_HARNESS_EXCLUDES_ONDOTNET) $(TEST_HARNESS_OUTPUT_ONDOTNET) $(NUNIT_XML_FLAG)=TestResult-ondotnet-$(PROFILE).xml $(FIXTURE_ARG) $(TESTNAME_ARG) || ok=false; \
-       $(TEST_HARNESS_POSTPROC_ONDOTNET) ; $$ok
+       $(TEST_HARNESS) $(test_assemblies) $(NOSHADOW_FLAG) $(TEST_HARNESS_FLAGS) $(LOCAL_TEST_HARNESS_ONDOTNET_FLAGS) $(TEST_HARNESS_EXCLUDES_ONDOTNET) $(LABELS_ARG) -format:nunit2 -result:TestResult-ondotnet-$(PROFILE).xml $(FIXTURE_ARG) $(TESTNAME_ARG) || ok=false; \
+       $$ok
 
 
 endif # test_assemblies
@@ -186,3 +159,4 @@ $(test_makefrag): $(test_response)
 
 endif
 
+.PHONY: patch-nunitlite-appconfig
index 50cdfcf6868455e673ebabebbce2a6bd2463a192..6c2d3e78933177af0d432f38c23d704a831480b4 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 2539a5b4b18c3ab5907432eedf73d113a3b8b53d..49b15881e839cab6fa8b19408236f3537905b209 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 2c40504aa6351c064685cbf3d0d647b459cbb9cd..4170af9dbc75aa3ecde29b204ecda5a56b64dad7 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index bf2bc3fb53392e1f95933a009cfc1a73be4c197e..9aa53511751087a1ff89825377feccb99978f4c1 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 1a8f5f3639da7e710d532578334e1e3ce298adec..adf2110e12a683284f95be4fe06280f35952315d 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index ef4329f1ed1651b063c7f75433942c7f959ce4a0..d42d2f56aceb3fe7f040738faffd02922d11908b 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 7af0a4b2115ef8db294f5e8fad483da99a9ecac1..3c218109d8bca05bc35e2a7356dbee0a130221a2 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index 1bca67282f6da67a9c265b87180d2efbb76f547e..a595068c811769babbad596ace775d60fda0cda4 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -54,7 +55,9 @@
   </PropertyGroup>\r
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />\r
   <ItemGroup>\r
+    <Compile Include="..\..\..\build\common\MonoTODOAttribute.cs" />\r
     <Compile Include="AssemblyInfo.cs" />\r
+    <Compile Include="RegistryAclExtensions.cs" />\r
     <Compile Include="TypeForwarders.cs" />\r  </ItemGroup>\r
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \r
        Other similar extension points exist, see Microsoft.Common.targets.\r
index deb3458cc86fce5924c0eb75d3b084adb1322554..e32214de7dedde5e893a303a5a4e07da524c5219 100644 (file)
@@ -36,22 +36,28 @@ namespace Microsoft.Win32
 {
        public static class RegistryAclExtensions
        {
-               [MonoTODO]
                public static RegistrySecurity GetAccessControl (this RegistryKey key)
                {
-                       throw new NotImplementedException ();
+                       if (key == null)
+                               throw new ArgumentNullException (nameof (key));
+
+                       return key.GetAccessControl ();
                }
 
-               [MonoTODO]
                public static RegistrySecurity GetAccessControl (this RegistryKey key, AccessControlSections includeSections)
                {
-                       throw new NotImplementedException ();
+                       if (key == null)
+                               throw new ArgumentNullException (nameof (key));
+
+                       return key.GetAccessControl (includeSections);
                }
 
-               [MonoTODO]
                public static void SetAccessControl (this RegistryKey key, RegistrySecurity registrySecurity)
                {
-                       throw new NotImplementedException ();
+                       if (key == null)
+                               throw new ArgumentNullException (nameof (key));
+
+                       key.SetAccessControl (registrySecurity);
                }
        }
 }
\ No newline at end of file
index 7725ad8cdbd5389c859fc811c828ef6d577928ce..a07a2f1289f8547e6ca68d5c3b2bd8f1156b0e57 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index 5189fe3c1ad9dd1b256172b9821afac1c19b2e51..96fdc26a70b2259eb17cdd7a338d21473f68cffa 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index cb5e8dddf4f8a4c3479705dd9c5706e3fba1c62a..7ad734c7719bee4afbe24617737bd035a1452623 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index 3980a552ddc2b8aad35c6f6b533ca7f019923a42..a1905271772d135403e2954b823faa25072bc7c5 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 62428f4889c55a0a1b23a8b210045bc18f2c0c5b..2a5a8022ba05f1175767722d8fb3082a853fb043 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index eee52ccc352be132c97668daafbb3fbd176c2ea5..45a6552cf0f829a07df1c24ec823d4aa2805f3b3 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 964ecaa0ec04468619f14e4c82821ec9c069112e..b939381138066b194cc325f6465375d9afe309a5 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index a7e0139702fdfc1c2599e014ec02f09cb20f2c67..00b42fe684edb27eb45129ea4ed3f28020ed906d 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 87ce5ca808c604389c189cf01b0f2a4cd280d9f6..5b4595a55bafbe5514a2aa78974f628e5e67a6c2 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index 44e2fc91c581000f5af83d4984d4b4d716973e38..cecbabf92374825b92445c53dce1b76be5ccc42d 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index bf3b05e922a658e12962357c86ec4f39975db471..38bd33934246361deaeea91531130a0fb5965b41 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index c3eb239218a40ec2208cdeb378f65f310e98a374..847b7db67153187d2b5f3a51508c08f27c577146 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index ef0c419a2de3c2ef0c5721a4416cc40fa0dadc62..1f20ad3ac9a2ab3662914463f24bb9d9d980110e 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index a0d3c1b52b02f21e168a7871db5f31aaccc61e61..2b0e3d7a0f30b760615c21f5a7b4a5a68797544c 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index e35600650b32de5949a0242e87cf1f5663098b42..d5419500e3611cc840a2f644b3b41705257a3af3 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index cbeca4b58869d333c35ad5c78d317c77197cde0e..cb34e0aa7978f4e4990df8ed2ce09c62d85eea3f 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 7a73d9b9a904e7fa8f2bf1d55e88ceb40c4a6b28..97155bed0a78ecd167529b38937e3d4f8bf764e0 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index 65e0f7e3271c205df13572d6cb203facb29c5da2..c6931fd8deb2d6abb1e0fd349788face494dd397 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 40ca18905323384086d49875d8b006ee59e9c82c..9a9c86d1663478859591f48966cbc4482a58db1f 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index aea55676326c0896383a095f4852dc473700df10..4124bc5e6fd11fe432cb0df78badbf06a5f2e804 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 944626f1d5dde8dce0039db6a9244b52de1bc19d..dafb55c25c986f6ffc1e8ec6fe5a75e9446a9238 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index a1a92d79df8d9f62075d6b1b450c79195c3e54b7..5dcdc33d6fe44ca99870b389712e393ab3684ee8 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 3114ac2496f32f14782fc8d393a824982b04d94e..c868f9a343415f3216fc9a5e06d5c0e2c6601c90 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index c42832bf3a4d159a9ea9693cae7237c78bb1ca87..92f6b22bf9aa674b39eff137cfb9d54279312183 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 337997163750b0ca26544b4980dfabf739480676..73821cb1d9dac29680d399617c620f0c403027ca 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index 493303cc15ec906a14e54fd18a2a621dca26c829..6644d0f7dc5c5f32a6fb9792bce69ba4b817d619 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -55,6 +56,9 @@
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />\r
   <ItemGroup>\r
     <Compile Include="AssemblyInfo.cs" />\r
+    <Compile Include="DbColumn.cs" />\r
+    <Compile Include="DbDataReaderExtensions.Facade.cs" />\r
+    <Compile Include="IDbColumnSchemaGenerator.cs" />\r
     <Compile Include="TypeForwarders.cs" />\r  </ItemGroup>\r
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \r
        Other similar extension points exist, see Microsoft.Common.targets.\r
       <Project>{EC439BB8-FFED-4A32-A05D-2FA3A70CAD64}</Project>\r
       <Name>System.Data-net_4_x</Name>\r
     </ProjectReference>\r
+    <ProjectReference Include="../../System.XML/System.Xml-net_4_x.csproj">\r
+      <Project>{87FD2F0F-5222-4AE6-BD63-2D4975E11E5B}</Project>\r
+      <Name>System.Xml-net_4_x</Name>\r
+    </ProjectReference>\r
   </ItemGroup>\r
   <ItemGroup>\r
     <Folder Include="Properties\" />\r
index 95aeb6c229e98ffa800c85f48987d38e73528a2c..cb229b702ad37d7990bdaf05af0fc3222cbc21d9 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index 3427bb006e938667d4256e9f89bd02b1f0edb79b..293f05c3ee9b4585d3b4a89cab17d5e905c462fa 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 55e9ec069d3c3825cc8012beb4b89c5308a7efb0..7e6dd250b65a6fde916458a08b124a6da65f41dd 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index 72f03e89c83d80eb417a326407f379f37fd6dc70..e0a1c56c40135b7e6a378f1cf84851813f85aa53 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index b13006f5a5bcddff4eb89fa69e18a59877ce20b8..242e20e8954c3a095bb93e75dae3e9795b0392cb 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index 5de4c3cd3b7d68d8a5bb956c5c51402433673693..66611591bff0db877014215b974941200ae48684 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 070d6dbf61464b3564cc06d787a1e1011d931733..1bd261deaab614ceb64380bc6ffa876dd0a4aab5 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index e8db26624c340b0cfba90efec96e360f6e42b63f..2ddf7e98eb2e61df75968869bd74d42dc2b709ea 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index df4fbcedeb75363fa05a00a7436b689dff0e6195..8d5f7dae743978a4d9fc0a7418e944f531c9b069 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index 210e44530fa073ab5bed443ad33164754fe40355..daa2f78a5ea628532d0429e35aa8cf24d549cb6b 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 6e220091dd10a303b154be3e2ab1e307425e9313..392d6f846a0ea1dccc636a4b4f7a05d3d8961c67 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index 9d1c6f14752dc35a0aa108f1e177babe420c7c13..bd145c9ef3a49c7cfbfb812c18491788ba52d056 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -54,7 +55,9 @@
   </PropertyGroup>\r
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />\r
   <ItemGroup>\r
+    <Compile Include="..\..\..\build\common\MonoTODOAttribute.cs" />\r
     <Compile Include="AssemblyInfo.cs" />\r
+    <Compile Include="StackFrameExtensions.cs" />\r
     <Compile Include="TypeForwarders.cs" />\r  </ItemGroup>\r
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \r
        Other similar extension points exist, see Microsoft.Common.targets.\r
index 7f6a474ab61d72bde71cbe01dadab76dc151849b..0b5d548674510c53b5d57fe865d507423ed923e6 100644 (file)
@@ -37,36 +37,54 @@ namespace System.Diagnostics
                [MonoTODO]
                public static IntPtr GetNativeImageBase (this StackFrame stackFrame)
                {
+                       if (stackFrame == null)
+                               throw new ArgumentNullException (nameof (stackFrame));
+
                        throw new NotImplementedException ();
                }
 
                [MonoTODO]
                public static IntPtr GetNativeIP (this StackFrame stackFrame)
                {
+                       if (stackFrame == null)
+                               throw new ArgumentNullException (nameof (stackFrame));
+
                        throw new NotImplementedException ();
                }
 
                [MonoTODO]
                public static bool HasNativeImage (this StackFrame stackFrame)
                {
+                       if (stackFrame == null)
+                               throw new ArgumentNullException (nameof (stackFrame));
+
                        throw new NotImplementedException ();
                }
 
                [MonoTODO]
                public static bool HasMethod (this StackFrame stackFrame)
                {
+                       if (stackFrame == null)
+                               throw new ArgumentNullException (nameof (stackFrame));
+
                        throw new NotImplementedException ();
                }
 
                [MonoTODO]
                public static bool HasILOffset (this StackFrame stackFrame)
                {
+                       if (stackFrame == null)
+                               throw new ArgumentNullException (nameof (stackFrame));
+
                        throw new NotImplementedException ();
                }
 
                [MonoTODO]
                public static bool HasSource (this StackFrame stackFrame)
                {
+                       if (stackFrame == null)
+                               throw new ArgumentNullException (nameof (stackFrame));
+
                        throw new NotImplementedException ();
                }
        }
index ad5d47e69afdf81a08230b7f0d6951bf16ff7f0d..f99ca87531e44cc78cbbfadcdc7f6112f720a2f7 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index fb2f1485d876758afc65cc09e5a0fe04af71134c..5508fbdf3c55c6bc81bacbc25209a6b7af7ef1f3 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 62b783c9378e2b772fd091693a279b9c564af830..2376da70e9f13331b865cb751a925b6ede159759 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index 5d1e6d7135dd47eb1965187f8dca67af1d32e018..a3cfde6c2e1d0dd0f96f9f8f9b099e240f2e4cfb 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index ad70d7723ca12ec63434eb71730264f24c9e351d..3190b1f59865938c93857c5de5f6669432fd44b1 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index f31a1fc6a5541755ec858f3e0752eede938708f8..00aa1cf01c5438357d17733fd2f5dacae02537a3 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 82810cc6bad8794ae7b18b6975d4a0dae53e945e..9420a46a73b919fc9c49cd6b656509fc2c097447 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index 7003052edfdd6c45faa21a9a8a8f64e3a26510cc..d8d91f90f017b2526cc02046382ee356f145c8a5 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 8a44f5c464cbe84d30a3bf677e8e2b3913665a19..2165fc82ea9ac2a2ad2e2cf15c65bd0bf16bbb62 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
diff --git a/mcs/class/Facades/System.Diagnostics.Tracing/EventCounter.cs b/mcs/class/Facades/System.Diagnostics.Tracing/EventCounter.cs
deleted file mode 100644 (file)
index 7fedc40..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-//
-// EventCounter.cs
-//
-// Authors:
-//     Marek Safar  <marek.safar@gmail.com>
-//
-// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com)
-//
-// 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.
-//
-
-namespace System.Diagnostics.Tracing
-{
-       public class EventCounter
-       {
-               public EventCounter (string name, EventSource eventSource)
-               {
-               }
-
-               public void WriteMetric (float value)
-               {
-               }
-       }
-}
\ No newline at end of file
index 73d08a19bd1819928c7ae99f008a6d699c23233a..14b559585dd00979f180f0341dde767e5b0f0749 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 5c8ab29d77aeb95e7a9fcceeec94fccc04ccecdb..2e4028199f1e1cd52121eef23153f59452851a6c 100644 (file)
@@ -44,3 +44,7 @@
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Tracing.EventTask))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Tracing.EventWrittenEventArgs))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Tracing.NonEventAttribute))]
+
+#if NETSTANDARD
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Tracing.EventCounter))]
+#endif
index 626ecde842785b03ebec362245cf0fc929fb6204..440b1643f3387c049524a77ae34787aafe6dc43b 100644 (file)
@@ -35,5 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
diff --git a/mcs/class/Facades/System.Drawing.Primitives/Facades_System.Drawing.Primitives-net_4_x.csproj b/mcs/class/Facades/System.Drawing.Primitives/Facades_System.Drawing.Primitives-net_4_x.csproj
new file mode 100644 (file)
index 0000000..2dcbe57
--- /dev/null
@@ -0,0 +1,99 @@
+<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
+  <PropertyGroup>\r
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>\r
+    <ProductVersion>9.0.30729</ProductVersion>\r
+    <SchemaVersion>2.0</SchemaVersion>\r
+    <ProjectGuid>{1AFDB281-5FB8-48A9-8694-7F515D835862}</ProjectGuid>\r
+    <OutputType>Library</OutputType>\r
+    <NoWarn>1699,1616,1699</NoWarn>\r
+    <OutputPath>./../../../class/lib/net_4_x/Facades</OutputPath>\r
+    <IntermediateOutputPath>obj-Facades</IntermediateOutputPath>\r
+    <GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>\r
+    <NoStdLib>True</NoStdLib>\r
+    \r
+    <NoConfig>True</NoConfig>\r
+    \r
+    <AppDesignerFolder>Properties</AppDesignerFolder>\r
+    <RootNamespace>\r
+    </RootNamespace>\r
+    <AssemblyName>System.Drawing.Primitives</AssemblyName>\r
+    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
+    <FileAlignment>512</FileAlignment>\r
+  </PropertyGroup>\r
+    <PropertyGroup>\r
+    <SignAssembly>true</SignAssembly>\r
+    <DelaySign>true</DelaySign>\r
+  </PropertyGroup>\r
+  <PropertyGroup>\r
+    <AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
+    <DebugSymbols>true</DebugSymbols>\r
+    <DebugType>full</DebugType>\r
+    <NoWarn>1699,1616,1699</NoWarn>\r
+    <Optimize>false</Optimize>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
+    <ErrorReport>prompt</ErrorReport>\r
+    <WarningLevel>4</WarningLevel>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">\r
+    <DebugType>pdbonly</DebugType>\r
+    <NoWarn>1699,1616,1699</NoWarn>\r
+    <Optimize>true</Optimize>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
+    <ErrorReport>prompt</ErrorReport>\r
+    <WarningLevel>4</WarningLevel>\r
+  </PropertyGroup>\r
+  <!-- Set AddAdditionalExplicitAssemblyReferences to false, otherwise if targetting .NET4.0, \r
+  Microsoft.NETFramework.props will force a dependency on the assembly System.Core. This\r
+  is a problem to compile the Mono mscorlib.dll -->\r
+  <PropertyGroup>\r
+    <AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>\r
+  </PropertyGroup>\r
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />\r
+  <ItemGroup>\r
+    <Compile Include="AssemblyInfo.cs" />\r
+    <Compile Include="TypeForwarders.cs" />\r  </ItemGroup>\r
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \r
+       Other similar extension points exist, see Microsoft.Common.targets.\r
+  <Target Name="BeforeBuild">\r
+  </Target>\r
+  <Target Name="AfterBuild">\r
+  </Target>\r
+  -->\r
+  <PropertyGroup>\r
+    <PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
+
+    </PreBuildEvent>\r
+    <PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">\r
+\r
+    </PreBuildEvent>\r
+    <PostBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
+
+    </PostBuildEvent>\r
+    <PostBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">\r
+\r
+    </PostBuildEvent>\r
+  </PropertyGroup>\r
+  <ItemGroup>\r
+    <ProjectReference Include="../../corlib/corlib-net_4_x.csproj">\r
+      <Project>{2CA6026B-2DC8-4C4C-A12C-1E8234049DB7}</Project>\r
+      <Name>corlib-net_4_x</Name>\r
+    </ProjectReference>\r
+    <ProjectReference Include="../../System/System-net_4_x.csproj">\r
+      <Project>{2762E921-91A8-4C87-91E9-BA628013F753}</Project>\r
+      <Name>System-net_4_x</Name>\r
+    </ProjectReference>\r
+    <ProjectReference Include="../../System.Drawing/System.Drawing-net_4_x.csproj">\r
+      <Project>{584A5E46-2958-4CB2-8DF9-188B420D0BB0}</Project>\r
+      <Name>System.Drawing-net_4_x</Name>\r
+    </ProjectReference>\r
+  </ItemGroup>\r
+  <ItemGroup>\r
+    <Folder Include="Properties\" />\r
+  </ItemGroup>\r
+</Project>\r
+
index 316522d2a60dd010ef30103fe07780c0192e820b..80d903f925067973b6cfe4ca03f12a553647ceb5 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index 076b4d9bfa0ac93bb6e08f71c0df53ec3147817f..a2700a7220645f3e64a375b1575ccea2f0f94ef1 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 161b841ea121def4e3b77db78eec2f09d63d3646..8fa6ecaeb210d8e1a08ccdc937cf19c1caf6877e 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index d0aa63ef3cf82da9c7fbdbdead442cc5046b8624..d213697785c1891055288a0924d1fce6a761f3a9 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 6c41c6e4f3606f2a02c499b6685f007e40aff024..2564d4dbefa10474fab529a623e67cca8608cec6 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index 662128772641f3cae697a1b0e728c7a50f989730..b7d9e785a5d485a737b7d55be5c89369aa443dc8 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
   </PropertyGroup>\r
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />\r
   <ItemGroup>\r
+    <Compile Include="..\..\..\build\common\MonoTODOAttribute.cs" />\r
     <Compile Include="AssemblyInfo.cs" />\r
+    <Compile Include="GlobalizationExtensions.cs" />\r
+    <Compile Include="SR.cs" />\r
+    <Compile Include="StringNormalizationExtensions.cs" />\r
     <Compile Include="TypeForwarders.cs" />\r  </ItemGroup>\r
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \r
        Other similar extension points exist, see Microsoft.Common.targets.\r
index 7953b29b9ab9b6843d70fa311af8aa449abd872d..de606a86dcebf511195cdb1d61c5cf5d9af9efa0 100644 (file)
@@ -33,28 +33,36 @@ namespace System
 {
        public static class StringNormalizationExtensions
        {
-               [MonoTODO]
                public static bool IsNormalized(this string value)
                {
-                       throw new NotImplementedException ();
+                       if (value == null)
+                               throw new ArgumentNullException (nameof (value));
+
+                       return value.IsNormalized ();
                }
 
-               [MonoTODO]
                public static bool IsNormalized(this string value, NormalizationForm normalizationForm)
                {
-                       throw new NotImplementedException ();
+                       if (value == null)
+                               throw new ArgumentNullException (nameof (value));
+
+                       return value.IsNormalized (normalizationForm);
                }
 
-               [MonoTODO]
                public static String Normalize(this string value)
                {
-                       throw new NotImplementedException ();
+                       if (value == null)
+                               throw new ArgumentNullException (nameof (value));
+
+                       return value.Normalize ();
                }
 
-               [MonoTODO]
                public static String Normalize(this string value, NormalizationForm normalizationForm)
                {
-                       throw new NotImplementedException ();
+                       if (value == null)
+                               throw new ArgumentNullException (nameof (value));
+
+                       return value.Normalize (normalizationForm);
                }
        }
 }
index 84c06894f1182bb9d23a3006361f43b24dc8996b..87fe7738310b1a9122aba02d49fc58a4b16bfc46 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index d3117287fbca38b224d4bbde00967369ca809b1d..cc423937805497e2be25f638c22ea620ae841bb1 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 8631ba251a77a3472499bc64fb47f3c881514be1..d47dccdccaff1bbd1745156fc53f1bb3001f624c 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index 4423a9dc9a4a3e09e7c691b45227bd865b208534..12fa724778888c8e4cdab7cd86dd43477f8a45b0 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 30286f0aa49fe9faf309ed94a769432a9e8bb21f..87c50f578ad5dd06620e0591b784e7d9c183e9ba 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index 0f9d44c9cd40cfedd6a28e42d52331d02236ab24..f4091941d7ec1b698811c5da684188dfc0666ed6 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -54,7 +55,9 @@
   </PropertyGroup>\r
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />\r
   <ItemGroup>\r
+    <Compile Include="..\..\..\build\common\MonoTODOAttribute.cs" />\r
     <Compile Include="AssemblyInfo.cs" />\r
+    <Compile Include="FileSystemAclExtensions.cs" />\r
     <Compile Include="TypeForwarders.cs" />\r  </ItemGroup>\r
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \r
        Other similar extension points exist, see Microsoft.Common.targets.\r
index 1dd8d97ab5e13d56ec958fa2d3301980b365e90c..6baeefd5dd9da7f05871f65696b697e0aa5b1d9c 100644 (file)
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+using System.Security.AccessControl;
+
 namespace System.IO
 {
-       public static partial class FileSystemAclExtensions
+       public static class FileSystemAclExtensions
        {
-               [MonoTODO]
-               public static System.Security.AccessControl.DirectorySecurity GetAccessControl(this System.IO.DirectoryInfo directoryInfo)
+               public static DirectorySecurity GetAccessControl(this DirectoryInfo directoryInfo)
                {
-                       throw new NotImplementedException ();
+                       if (directoryInfo == null)
+                               throw new ArgumentNullException (nameof (directoryInfo));
+
+                       return directoryInfo.GetAccessControl ();
                }
 
-               [MonoTODO]
-               public static System.Security.AccessControl.DirectorySecurity GetAccessControl(this System.IO.DirectoryInfo directoryInfo, System.Security.AccessControl.AccessControlSections includeSections)
+               public static DirectorySecurity GetAccessControl(this DirectoryInfo directoryInfo, AccessControlSections includeSections)
                {
-                       throw new NotImplementedException ();
+                       if (directoryInfo == null)
+                               throw new ArgumentNullException (nameof (directoryInfo));
+
+                       return directoryInfo.GetAccessControl (includeSections);
                }
 
-               [MonoTODO]
-               public static System.Security.AccessControl.FileSecurity GetAccessControl(this System.IO.FileInfo fileInfo)
+               public static FileSecurity GetAccessControl(this FileInfo fileInfo)
                {
-                       throw new NotImplementedException ();
+                       if (fileInfo == null)
+                               throw new ArgumentNullException (nameof (fileInfo));
+
+                       return fileInfo.GetAccessControl ();
                }
 
-               [MonoTODO]
-               public static System.Security.AccessControl.FileSecurity GetAccessControl(this System.IO.FileInfo fileInfo, System.Security.AccessControl.AccessControlSections includeSections)
+               public static FileSecurity GetAccessControl(this FileInfo fileInfo, AccessControlSections includeSections)
                {
-                       throw new NotImplementedException ();
+                       if (fileInfo == null)
+                               throw new ArgumentNullException (nameof (fileInfo));
+
+                       return fileInfo.GetAccessControl (includeSections);
                }
 
-               [MonoTODO]
-               public static System.Security.AccessControl.FileSecurity GetAccessControl(this System.IO.FileStream fileStream)
+               public static FileSecurity GetAccessControl(this FileStream fileStream)
                {
-                       throw new NotImplementedException ();
+                       if (fileStream == null)
+                               throw new ArgumentNullException (nameof (fileStream));
+
+                       return fileStream.GetAccessControl ();
                }
 
-               [MonoTODO]
-               public static void SetAccessControl(this System.IO.DirectoryInfo directoryInfo, System.Security.AccessControl.DirectorySecurity directorySecurity)
+               public static void SetAccessControl(this DirectoryInfo directoryInfo, DirectorySecurity directorySecurity)
                {
-                       throw new NotImplementedException ();
+                       if (directoryInfo == null)
+                               throw new ArgumentNullException (nameof (directoryInfo));
+
+                       directoryInfo.SetAccessControl (directorySecurity);
                }
 
-               [MonoTODO]
-               public static void SetAccessControl(this System.IO.FileInfo fileInfo, System.Security.AccessControl.FileSecurity fileSecurity)
+               public static void SetAccessControl(this FileInfo fileInfo, FileSecurity fileSecurity)
                {
-                       throw new NotImplementedException ();
+                       if (fileInfo == null)
+                               throw new ArgumentNullException (nameof (fileInfo));
+
+                       fileInfo.SetAccessControl (fileSecurity);
                }
 
-               [MonoTODO]
-               public static void SetAccessControl(this System.IO.FileStream fileStream, System.Security.AccessControl.FileSecurity fileSecurity)
+               public static void SetAccessControl(this FileStream fileStream, FileSecurity fileSecurity)
                {
-                       throw new NotImplementedException ();
+                       if (fileStream == null)
+                               throw new ArgumentNullException (nameof (fileStream));
+
+                       fileStream.SetAccessControl (fileSecurity);
                }
        }
 }
\ No newline at end of file
index d9b6ee42c56062d933ac3a485a94e351b7bf7775..eb9dacd386fc3582c050bce8b9935eb2f303484b 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index 5edbbbb80347b137bb83e2bfa0bb985e0f6b4778..04dd9296063812c09422178eba8cfb49161e2072 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 9239b2432ebdc3d78bde05b297b53dfd6ed655ce..9c1bdc1d9806489e5ac6a04c1312d6317412ab34 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index 98c67e82710ef515ea18f601007b1f30b55739b6..aa4e67663420a015422c5d26a7a75b7c3c1210f5 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index f6f7bae22293e8fa3ce87cc9ccd84f111b5564ba..1710705c69f892c15c8511eb811ee4e16d20474e 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index 75fe3913f4ea3c52cf87189bce48b0eb0dcbf514..034d4b0622f4ed595ff1129f9999eadd147b4e7e 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 2ad36d313aed4061e63d545dfa56e45ef8e5cb94..8c13ddd645fbd6fb039957eaf9b533f204c1719d 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index 34784bd92b7419b5f5f20fe63b98f17b4c193629..d7a1c1a302e5018cdc31a7f31855d1659cf5121e 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 2ccf0e841b768a6f2cc9a8851dce11bf8297f3e0..2ad6e6ec3798f1ce2abb0078e56e56e73e03d9c6 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index 866e14f1a16e3734c92652ccfdecc6c8452b1038..5b536287b3ce943cf6ff61a5e3a659814707e713 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index bb2e888e638831fa8894b0364a9287142ac2c923..5fdcbc2b5ee23322c1a846587cf63982af1bcae4 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index 3e44aef460638d8aab34147679adde227599c33f..837abbb60c26aa930cfd0a3a632e9e3cda475517 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 7b0813f74ff2eac0944f45e92ce564887ab9f163..b9f9f742734a0308aee5ffb76e32d6ccad49456f 100644 (file)
@@ -35,5 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
index 1cdd54455133d17c658c806e49cc69415cf014c0..0bbce8e55702ff52a8efb2e226a8af06ddf0330a 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index 71c4350a6e7c20e1867e6b1c32d3e493203dce84..36b10921a0430aaa0c0ae108a386abf44fb54423 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 3ddd97f50a5960cfa10bd2f68b943e842b1efb9e..50b6c7a59133192ae9645ca5a8d5c839ae7c040f 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index c65751b53886e1c32a582901ec424f35bcb32a40..d29a8e64ae8346ecc0dd9e7b0b04e61d7afb3a22 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 4bfc1f54650133598edd4ac0e92f076f10946f7a..2e74bfb0e5f56537fc884ded63827b5c7df2763c 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index da00e74eff75fba850356d516f3af781c8ae6393..405420df34294708b5bd9b8e0e15deb4c2f57c9a 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 5169c566782477345483c5b9d3fe566c653bd8d8..169db85b2a0f0d04aebdacef661c9a9690aeb0bd 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index e7c6951666baa12a800cd06d961ab12adff0494b..00be9add982011140299632de9f58ce97f6c9b64 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index b3d86f59f9d5a86c64264cb6b50df0bb5c0727df..a00afa3d8296c825a44ca1d2ac58352a22bffaed 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index de83417856b9f6a86c74409a9e3593229836fee9..f2713341989018b68dc127339b547970069f10b1 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index ec77afbfebb44594f48e273119e4561e3e8c6084..4a2870cb82d3dfb1b4cb4c4677e750e7f9059970 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index 3aa8b75ec1f4a81648903dd966e7597d03515777..22ea547e6680c6d2e4efce49e8e53e33a41bf779 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 0f16e3c07f6086086bef39702eac1b54034ca6ec..65cb98ce56c57d0a737f1a79d8591e39a9d0e67c 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index 9c29c3428fd68336d93598fd0569b8380e8e362d..40bcaee9233eca10e425d5024ad89a6a52c15b70 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 497dd448d327457da9bc68bdf61a928a2c156ab6..62287f3a99907936b5742205f5a8f8ea36e140f5 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index b14fcb89dc591150f40b0a66591ab7577805e667..f65bf881df02b1d0afc8b4aee89e925e11545ef9 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index c9e72d3a2a239b81c66bb34b083a5243fbfb5b0e..e619e2599dc377378e9bb704abaa939ce3a1a3ba 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index 5ff7c8612a0e4c6dcaa84b6cac0aec52ae9b4db7..4ae4bfd23f1d88fba1ec492b2fec697577223d35 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 1de79d2059586753f3d567ad9abfe6046ff30cf3..6949ef4aed23b2984c5cfb21b5c356d9fa54a991 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index 9c59776987caa43f66a7f1c1c3aee48e8ef81b1c..d28fccfab73c8ac4859c3bd8b0b5cc1ff04d41c9 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 9d98c939b0cf2d48801807e54abfd55227d4759a..de825175670f4b6d3105f9b4ecd3844e518dd67f 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index f38a0d52aa5f3b3fd1a258a33a0d841b853fdbf9..2185b99006bb59201e437ce1445cacbf53682d7f 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 81e722e7d75a3f760188d4efed6d66f72ae8d360..a5009840f78876270fda7ca9a479dc9e786bbafe 100644 (file)
@@ -33,7 +33,9 @@
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Mail.MailMessage))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Mail.MailPriority))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Mail.SmtpAccess))]
+#pragma warning disable 618
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Mail.SmtpClient))]
+#pragma warning restore
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Mail.SmtpDeliveryFormat))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Mail.SmtpDeliveryMethod))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Mail.SmtpException))]
index a77684830acccba8531ab10da972d2b5c5183673..54751ca692da20b5186bdc3aa4f152c16572f998 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index 35e6e9a6d32a27560d162550ad17fe3b9fd8f17b..be4d1f8bf9920c91ca7ad3804b214b93f1f6f41d 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 8bb82be686611a16a9d9041608e14735e639a502..ac560532e14f1ed0a58d291ed4e9bafbbb7242b1 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index 042d7ace4fc259801e1e0d1e056b62d2e27945e5..92978cdf378c151c9d4df0f17bf3345daa460273 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 507e590b98f5ce0fd580de0c36098c6f0bae2fa3..98c665431db9164170206167dd63e5e6c80e7996 100644 (file)
@@ -35,5 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
index 8479946f21e4b894c7cb111293f8ba911393cf90..00d82d3d16c32515fe112c01fab754f63836457f 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index aa3200543918b9cb6a55550d132bb9d3b2c2f53c..d9946d004caa6070dabc97be00a9ffca80e4e75c 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 32162844983065dbf83c34dc6c806f980804d232..4162f8a98fbec63a7e36094c37c91f3cda8a6fbf 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index 9d81ac997087f150a62f9d42bccfac4d5b726cfe..f4df4890d27c6e95c73ca291b36884cc55fe3b56 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index c809f83102b4aa89d273330a9604d69fe7872a6b..7b4a0bc23b63e40c41d883d0c5bf6bfd0b209e4e 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index 346a8c821b9f9c189769e64550ad854b165d39d7..7a122c3ba3b8d1988c0a22403a67d20ddf2dcfb0 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index ebad6bf7c70d36546ca3e6ee381b96497f72f4f6..cceb70b41b9e780e353f300a30650f82d92e9846 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index db14b8d3b4ab3e27cfb1afbaf89bc9ceda6bb7d8..39768cc784dc3efa8ff04397466b2ed5469127d4 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 1ea7a8cca477aac56d7222ec2b3291990524f271..6032c3d4dc7011662ad549bd5913c4d83fc22e96 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index ca762d98f2d89af49aca3509a01130414874deb1..29de027958f0b48a0138fe24c7d79cc36597036a 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
diff --git a/mcs/class/Facades/System.Net.Sockets/SocketReceiveFromResult.cs b/mcs/class/Facades/System.Net.Sockets/SocketReceiveFromResult.cs
deleted file mode 100644 (file)
index 2add0e6..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-//
-// SocketReceiveFromResult.cs
-//
-// Authors:
-//     Marek Safar  <marek.safar@gmail.com>
-//
-// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com)
-//
-// 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.
-//
-
-namespace System.Net.Sockets
-{
-       public struct SocketReceiveFromResult
-       {
-               public int ReceivedBytes;
-               public EndPoint RemoteEndPoint;
-       }
-}
\ No newline at end of file
diff --git a/mcs/class/Facades/System.Net.Sockets/SocketReceiveMessageFromResult.cs b/mcs/class/Facades/System.Net.Sockets/SocketReceiveMessageFromResult.cs
deleted file mode 100644 (file)
index ab5ed10..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-//
-// SocketReceiveMessageFromResult.cs
-//
-// Authors:
-//     Marek Safar  <marek.safar@gmail.com>
-//
-// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com)
-//
-// 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.
-//
-
-namespace System.Net.Sockets
-{
-       public struct SocketReceiveMessageFromResult
-       {
-               public int ReceivedBytes;
-               public SocketFlags SocketFlags;
-               public EndPoint RemoteEndPoint;
-               public IPPacketInformation PacketInformation;
-       }
-}
\ No newline at end of file
diff --git a/mcs/class/Facades/System.Net.Sockets/SocketTaskExtensions.cs b/mcs/class/Facades/System.Net.Sockets/SocketTaskExtensions.cs
deleted file mode 100644 (file)
index a3e24ed..0000000
+++ /dev/null
@@ -1,250 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System.Collections.Generic;
-using System.Threading.Tasks;
-
-namespace System.Net.Sockets
-{
-    public static class SocketTaskExtensions
-    {
-        public static Task<Socket> AcceptAsync(this Socket socket)
-        {
-            return Task<Socket>.Factory.FromAsync(
-                (callback, state) => ((Socket)state).BeginAccept(callback, state),
-                asyncResult => ((Socket)asyncResult.AsyncState).EndAccept(asyncResult),
-                state: socket);
-        }
-
-        public static Task<Socket> AcceptAsync(this Socket socket, Socket acceptSocket)
-        {
-            const int ReceiveSize = 0;
-            return Task<Socket>.Factory.FromAsync(
-                (socketForAccept, receiveSize, callback, state) => ((Socket)state).BeginAccept(socketForAccept, receiveSize, callback, state),
-                asyncResult => ((Socket)asyncResult.AsyncState).EndAccept(asyncResult),
-                acceptSocket,
-                ReceiveSize,
-                state: socket);
-        }
-
-        public static Task ConnectAsync(this Socket socket, EndPoint remoteEndPoint)
-        {
-            return Task.Factory.FromAsync(
-                (targetEndPoint, callback, state) => ((Socket)state).BeginConnect(targetEndPoint, callback, state),
-                asyncResult => ((Socket)asyncResult.AsyncState).EndConnect(asyncResult),
-                remoteEndPoint,
-                state: socket);
-        }
-
-        public static Task ConnectAsync(this Socket socket, IPAddress address, int port)
-        {
-            return Task.Factory.FromAsync(
-                (targetAddress, targetPort, callback, state) => ((Socket)state).BeginConnect(targetAddress, targetPort, callback, state),
-                asyncResult => ((Socket)asyncResult.AsyncState).EndConnect(asyncResult),
-                address,
-                port,
-                state: socket);
-        }
-
-        public static Task ConnectAsync(this Socket socket, IPAddress[] addresses, int port)
-        {
-            return Task.Factory.FromAsync(
-                (targetAddresses, targetPort, callback, state) => ((Socket)state).BeginConnect(targetAddresses, targetPort, callback, state),
-                asyncResult => ((Socket)asyncResult.AsyncState).EndConnect(asyncResult),
-                addresses,
-                port,
-                state: socket);
-        }
-
-        public static Task ConnectAsync(this Socket socket, string host, int port)
-        {
-            return Task.Factory.FromAsync(
-                (targetHost, targetPort, callback, state) => ((Socket)state).BeginConnect(targetHost, targetPort, callback, state),
-                asyncResult => ((Socket)asyncResult.AsyncState).EndConnect(asyncResult),
-                host,
-                port,
-                state: socket);
-        }
-
-        public static Task<int> ReceiveAsync(this Socket socket, ArraySegment<byte> buffer, SocketFlags socketFlags)
-        {
-            return Task<int>.Factory.FromAsync(
-                (targetBuffer, flags, callback, state) => ((Socket)state).BeginReceive(
-                                                              targetBuffer.Array,
-                                                              targetBuffer.Offset,
-                                                              targetBuffer.Count,
-                                                              flags,
-                                                              callback,
-                                                              state),
-                asyncResult => ((Socket)asyncResult.AsyncState).EndReceive(asyncResult),
-                buffer,
-                socketFlags,
-                state: socket);
-        }
-
-        public static Task<int> ReceiveAsync(
-            this Socket socket,
-            IList<ArraySegment<byte>> buffers,
-            SocketFlags socketFlags)
-        {
-            return Task<int>.Factory.FromAsync(
-                (targetBuffers, flags, callback, state) => ((Socket)state).BeginReceive(targetBuffers, flags, callback, state),
-                asyncResult => ((Socket)asyncResult.AsyncState).EndReceive(asyncResult),
-                buffers,
-                socketFlags,
-                state: socket);
-        }
-
-        public static Task<SocketReceiveFromResult> ReceiveFromAsync(
-            this Socket socket,
-            ArraySegment<byte> buffer,
-            SocketFlags socketFlags,
-            EndPoint remoteEndPoint)
-        {
-            object[] packedArguments = new object[] { socket, remoteEndPoint };
-
-            return Task<SocketReceiveFromResult>.Factory.FromAsync(
-                (targetBuffer, flags, callback, state) =>
-                {
-                    var arguments = (object[])state;
-                    var s = (Socket)arguments[0];
-                    var e = (EndPoint)arguments[1];
-
-                    IAsyncResult result = s.BeginReceiveFrom(
-                        targetBuffer.Array,
-                        targetBuffer.Offset,
-                        targetBuffer.Count,
-                        flags,
-                        ref e,
-                        callback,
-                        state);
-
-                    arguments[1] = e;
-                    return result;
-                },
-                asyncResult =>
-                {
-                    var arguments = (object[])asyncResult.AsyncState;
-                    var s = (Socket)arguments[0];
-                    var e = (EndPoint)arguments[1];
-
-                    int bytesReceived = s.EndReceiveFrom(asyncResult, ref e);
-
-                    return new SocketReceiveFromResult()
-                    {
-                        ReceivedBytes = bytesReceived,
-                        RemoteEndPoint = e
-                    };
-                },
-                buffer,
-                socketFlags,
-                state: packedArguments);
-        }
-
-        public static Task<SocketReceiveMessageFromResult> ReceiveMessageFromAsync(
-            this Socket socket,
-            ArraySegment<byte> buffer,
-            SocketFlags socketFlags,
-            EndPoint remoteEndPoint)
-        {
-            object[] packedArguments = new object[] { socket, socketFlags, remoteEndPoint };
-
-            return Task<SocketReceiveMessageFromResult>.Factory.FromAsync(
-                (targetBuffer, callback, state) =>
-                {
-                    var arguments = (object[])state;
-                    var s = (Socket)arguments[0];
-                    var f = (SocketFlags)arguments[1];
-                    var e = (EndPoint)arguments[2];
-
-                    IAsyncResult result = s.BeginReceiveMessageFrom(
-                        targetBuffer.Array,
-                        targetBuffer.Offset,
-                        targetBuffer.Count,
-                        f,
-                        ref e,
-                        callback,
-                        state);
-
-                    arguments[2] = e;
-                    return result;
-                },
-                asyncResult =>
-                {
-                    var arguments = (object[])asyncResult.AsyncState;
-                    var s = (Socket)arguments[0];
-                    var f = (SocketFlags)arguments[1];
-                    var e = (EndPoint)arguments[2];
-                    IPPacketInformation ipPacket;
-
-                    int bytesReceived = s.EndReceiveMessageFrom(
-                        asyncResult,
-                        ref f,
-                        ref e,
-                        out ipPacket);
-
-                    return new SocketReceiveMessageFromResult()
-                    {
-                        PacketInformation = ipPacket,
-                        ReceivedBytes = bytesReceived,
-                        RemoteEndPoint = e,
-                        SocketFlags = f
-                    };
-                },
-                buffer,
-                state: packedArguments);
-        }
-
-        public static Task<int> SendAsync(this Socket socket, ArraySegment<byte> buffer, SocketFlags socketFlags)
-        {
-            return Task<int>.Factory.FromAsync(
-                (targetBuffer, flags, callback, state) => ((Socket)state).BeginSend(
-                                                              targetBuffer.Array,
-                                                              targetBuffer.Offset,
-                                                              targetBuffer.Count,
-                                                              flags,
-                                                              callback,
-                                                              state),
-                asyncResult => ((Socket)asyncResult.AsyncState).EndSend(asyncResult),
-                buffer,
-                socketFlags,
-                state: socket);
-        }
-
-        public static Task<int> SendAsync(
-            this Socket socket,
-            IList<ArraySegment<byte>> buffers,
-            SocketFlags socketFlags)
-        {
-            return Task<int>.Factory.FromAsync(
-                (targetBuffers, flags, callback, state) => ((Socket)state).BeginSend(targetBuffers, flags, callback, state),
-                asyncResult => ((Socket)asyncResult.AsyncState).EndSend(asyncResult),
-                buffers,
-                socketFlags,
-                state: socket);
-        }
-
-        public static Task<int> SendToAsync(
-            this Socket socket,
-            ArraySegment<byte> buffer,
-            SocketFlags socketFlags,
-            EndPoint remoteEndPoint)
-        {
-            return Task<int>.Factory.FromAsync(
-                (targetBuffer, flags, endPoint, callback, state) => ((Socket)state).BeginSendTo(
-                                                                        targetBuffer.Array,
-                                                                        targetBuffer.Offset,
-                                                                        targetBuffer.Count,
-                                                                        flags,
-                                                                        endPoint,
-                                                                        callback,
-                                                                        state),
-                asyncResult => ((Socket)asyncResult.AsyncState).EndSendTo(asyncResult),
-                buffer,
-                socketFlags,
-                remoteEndPoint,
-                state: socket);
-        }
-    }
-}
\ No newline at end of file
index a4cab35a66bc194d0b4d44ce6aba3335088ac771..719628dc7c61ac7d0444434320134bf5305b7f73 100644 (file)
@@ -1,5 +1,2 @@
 TypeForwarders.cs
 AssemblyInfo.cs
-SocketReceiveFromResult.cs
-SocketReceiveMessageFromResult.cs
-SocketTaskExtensions.cs
index b27fc8622edeb847c80c6c19bac7d981af2942e5..27258a0831aaea109cbb2b1420fa396ee1cc6147 100644 (file)
@@ -46,4 +46,8 @@
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Sockets.UdpClient))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Sockets.UdpReceiveResult))]
 
-
+#if NETSTANDARD
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Sockets.SocketReceiveFromResult))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Sockets.SocketReceiveMessageFromResult))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Sockets.SocketTaskExtensions))]
+#endif
index bdae143cdb7f48d31e06c9e1ce58095f053ada15..c7d3201cdceac8b8f6f9a9492a06f8d3033f7700 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index 1372878cd18e26f69a40c9b714ab02246bad444f..547a249ed6b5f9e6ce5f6c7f3d4193cb8713e0a2 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 2d8c97682251bfd35a6c67aef272a83cb9130431..3202543ce19365496691961be7b8300a1839e991 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index 3a298830e16696ccb3f84527a9d06e4359c8e1f5..235fccd7523278f65cd4d5b7ba1412decff16c2a 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 529b9e63f3719590d00587693986c378e7c5d108..599270899986d4806c8711555420b5a51d781e02 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index 11199656414794790d3704a3de44e000cb6f5678..9c8cdc598c166650b0b2cddb23d03ede1975f567 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 1513c6011f5a80753e54a5631c7557249b642b52..3f67e57f48f510c4d7d8a6e41bd6e075a43196d3 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index 0103faa7236152f7c62878f87d936f7d827eadf0..434cb97e887c4ef4ccefef57c6db68c7b0a1b25a 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 189175bb52c840f1d28e728644a09845bc6f80df..b07ebd18d2261d921b5522b4c6e6ec89c674eaf6 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index e1230f83e0f2c966e13a586da2ea81e0def0128d..f09b67456af2a160db77550b3c34c10d52697d29 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
diff --git a/mcs/class/Facades/System.Private.CoreLib.InteropServices/AssemblyInfo.cs b/mcs/class/Facades/System.Private.CoreLib.InteropServices/AssemblyInfo.cs
deleted file mode 100644 (file)
index 6ab82d6..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-// 
-// Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)
-// 
-// 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.Reflection;
-using System.Runtime.CompilerServices;
-
-[assembly: AssemblyTitle ("System.Private.CoreLib.InteropServices.dll")]
-[assembly: AssemblyDescription ("System.Private.CoreLib.InteropServices.dll")]
-[assembly: AssemblyDefaultAlias ("System.Private.CoreLib.InteropServices.dll")]
-[assembly: AssemblyCompany ("Xamarin, Inc.")]
-[assembly: AssemblyProduct ("Mono Common Language Infrastructure")]
-[assembly: AssemblyCopyright ("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")]
-[assembly: AssemblyVersion ("4.0.0.0")]
-[assembly: AssemblyInformationalVersion ("4.0.0.0")]
-[assembly: AssemblyFileVersion ("4.0.0.0")]
-[assembly: AssemblyDelaySign (true)]
-[assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
diff --git a/mcs/class/Facades/System.Private.CoreLib.InteropServices/Facades_System.Private.CoreLib.InteropServices-net_4_x.csproj b/mcs/class/Facades/System.Private.CoreLib.InteropServices/Facades_System.Private.CoreLib.InteropServices-net_4_x.csproj
deleted file mode 100644 (file)
index c81a035..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>\r
-<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
-  <PropertyGroup>\r
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
-    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>\r
-    <ProductVersion>9.0.30729</ProductVersion>\r
-    <SchemaVersion>2.0</SchemaVersion>\r
-    <ProjectGuid>{5D05F5E2-7378-4A35-B1A3-76ABEB4A71C3}</ProjectGuid>\r
-    <OutputType>Library</OutputType>\r
-    <NoWarn>1699,1616,1699</NoWarn>\r
-    <OutputPath>./../../../class/lib/net_4_x/Facades</OutputPath>\r
-    <IntermediateOutputPath>obj-Facades</IntermediateOutputPath>\r
-    <GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>\r
-    <NoStdLib>True</NoStdLib>\r
-    \r
-    <NoConfig>True</NoConfig>\r
-    \r
-    <AppDesignerFolder>Properties</AppDesignerFolder>\r
-    <RootNamespace>\r
-    </RootNamespace>\r
-    <AssemblyName>System.Private.CoreLib.InteropServices</AssemblyName>\r
-    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
-    <FileAlignment>512</FileAlignment>\r
-  </PropertyGroup>\r
-    <PropertyGroup>\r
-    <SignAssembly>true</SignAssembly>\r
-    <DelaySign>true</DelaySign>\r
-  </PropertyGroup>\r
-  <PropertyGroup>\r
-    <AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
-  </PropertyGroup>\r
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
-    <DebugSymbols>true</DebugSymbols>\r
-    <DebugType>full</DebugType>\r
-    <NoWarn>1699,1616,1699</NoWarn>\r
-    <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
-    <ErrorReport>prompt</ErrorReport>\r
-    <WarningLevel>4</WarningLevel>\r
-  </PropertyGroup>\r
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">\r
-    <DebugType>pdbonly</DebugType>\r
-    <NoWarn>1699,1616,1699</NoWarn>\r
-    <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
-    <ErrorReport>prompt</ErrorReport>\r
-    <WarningLevel>4</WarningLevel>\r
-  </PropertyGroup>\r
-  <!-- Set AddAdditionalExplicitAssemblyReferences to false, otherwise if targetting .NET4.0, \r
-  Microsoft.NETFramework.props will force a dependency on the assembly System.Core. This\r
-  is a problem to compile the Mono mscorlib.dll -->\r
-  <PropertyGroup>\r
-    <AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>\r
-  </PropertyGroup>\r
-  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />\r
-  <ItemGroup>\r
-    <Compile Include="AssemblyInfo.cs" />\r
-    <Compile Include="TypeForwarders.cs" />\r  </ItemGroup>\r
-  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \r
-       Other similar extension points exist, see Microsoft.Common.targets.\r
-  <Target Name="BeforeBuild">\r
-  </Target>\r
-  <Target Name="AfterBuild">\r
-  </Target>\r
-  -->\r
-  <PropertyGroup>\r
-    <PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
-
-    </PreBuildEvent>\r
-    <PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">\r
-\r
-    </PreBuildEvent>\r
-    <PostBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
-
-    </PostBuildEvent>\r
-    <PostBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">\r
-\r
-    </PostBuildEvent>\r
-  </PropertyGroup>\r
-  <ItemGroup>\r
-    <ProjectReference Include="../../corlib/corlib-net_4_x.csproj">\r
-      <Project>{2CA6026B-2DC8-4C4C-A12C-1E8234049DB7}</Project>\r
-      <Name>corlib-net_4_x</Name>\r
-    </ProjectReference>\r
-    <ProjectReference Include="../../System/System-net_4_x.csproj">\r
-      <Project>{2762E921-91A8-4C87-91E9-BA628013F753}</Project>\r
-      <Name>System-net_4_x</Name>\r
-    </ProjectReference>\r
-  </ItemGroup>\r
-  <ItemGroup>\r
-    <Folder Include="Properties\" />\r
-  </ItemGroup>\r
-</Project>\r
-
diff --git a/mcs/class/Facades/System.Private.CoreLib.InteropServices/Makefile b/mcs/class/Facades/System.Private.CoreLib.InteropServices/Makefile
deleted file mode 100644 (file)
index 7b03ca8..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-MCS_BUILD_DIR = ../../../build
-
-thisdir = class/Facades/System.Private.CoreLib.InteropServices
-SUBDIRS = 
-include $(MCS_BUILD_DIR)/rules.make
-
-LIBRARY_SUBDIR = Facades
-LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)/Facades
-
-LIBRARY = System.Private.CoreLib.InteropServices.dll
-
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
-LIB_REFS = System
-LIB_MCS_FLAGS = $(SIGN_FLAGS) 
-
-PLATFORM_DEBUG_FLAGS =
-
-NO_TEST = yes
-
-include $(MCS_BUILD_DIR)/library.make
-
-
diff --git a/mcs/class/Facades/System.Private.CoreLib.InteropServices/System.Private.CoreLib.InteropServices-net_4_x.csproj b/mcs/class/Facades/System.Private.CoreLib.InteropServices/System.Private.CoreLib.InteropServices-net_4_x.csproj
deleted file mode 100644 (file)
index 4813330..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>\r
-<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
-  <PropertyGroup>\r
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
-    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>\r
-    <ProductVersion>9.0.30729</ProductVersion>\r
-    <SchemaVersion>2.0</SchemaVersion>\r
-    <ProjectGuid>{BE4A05DF-5630-4E80-9521-7B4216229A60}</ProjectGuid>\r
-    <OutputType>Library</OutputType>\r
-    <NoWarn>1699,1616,1699</NoWarn>\r
-    <OutputPath>./../../../class/lib/net_4_x/Facades</OutputPath>\r
-    <NoStdLib>True</NoStdLib>\r
-    <NoConfig>True</NoConfig>\r
-    \r
-    <AppDesignerFolder>Properties</AppDesignerFolder>\r
-    <RootNamespace>\r
-    </RootNamespace>\r
-    <AssemblyName>System.Private.CoreLib.InteropServices</AssemblyName>\r
-    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
-    <FileAlignment>512</FileAlignment>\r
-  </PropertyGroup>\r
-    <PropertyGroup>\r
-    <SignAssembly>true</SignAssembly>\r
-    <DelaySign>true</DelaySign>\r
-  </PropertyGroup>\r
-  <PropertyGroup>\r
-    <AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
-  </PropertyGroup>\r
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
-    <DebugSymbols>true</DebugSymbols>\r
-    <DebugType>full</DebugType>\r
-    <NoWarn>1699,1616,1699</NoWarn>\r
-    <Optimize>false</Optimize>\r
-    <DefineConstants>DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
-    <ErrorReport>prompt</ErrorReport>\r
-    <WarningLevel>4</WarningLevel>\r
-  </PropertyGroup>\r
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">\r
-    <DebugType>pdbonly</DebugType>\r
-    <NoWarn>1699,1616,1699</NoWarn>\r
-    <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
-    <ErrorReport>prompt</ErrorReport>\r
-    <WarningLevel>4</WarningLevel>\r
-  </PropertyGroup>\r
-  <!-- Set AddAdditionalExplicitAssemblyReferences to false, otherwise if targetting .NET4.0, \r
-  Microsoft.NETFramework.props will force a dependency on the assembly System.Core. This\r
-  is a problem to compile the Mono mscorlib.dll -->\r
-  <PropertyGroup>\r
-    <AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>\r
-  </PropertyGroup>\r
-  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />\r
-  <ItemGroup>\r
-    <Compile Include="AssemblyInfo.cs" />\r
-    <Compile Include="TypeForwarders.cs" />\r  </ItemGroup>\r
-  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \r
-       Other similar extension points exist, see Microsoft.Common.targets.\r
-  <Target Name="BeforeBuild">\r
-  </Target>\r
-  <Target Name="AfterBuild">\r
-  </Target>\r
-  -->\r
-  <PropertyGroup>\r
-    <PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">\r
-\r
-    </PreBuildEvent>\r
-    <PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">\r
-\r
-    </PreBuildEvent>\r
-\r
-    <PostBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">\r
-\r
-    </PostBuildEvent>\r
-    <PostBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">\r
-\r
-    </PostBuildEvent>\r
-  </PropertyGroup>\r
-  <ItemGroup>\r
-    <ProjectReference Include="../../corlib/corlib-net_4_x.csproj">\r
-      <Project>{2CA6026B-2DC8-4C4C-A12C-1E8234049DB7}</Project>\r
-      <Name>corlib-net_4_x</Name>\r
-    </ProjectReference>\r
-    <ProjectReference Include="../../corlib/corlib-net_4_x.csproj">\r
-      <Project>{2CA6026B-2DC8-4C4C-A12C-1E8234049DB7}</Project>\r
-      <Name>corlib-net_4_x</Name>\r
-    </ProjectReference>\r
-    <ProjectReference Include="../../System/System-net_4_x.csproj">\r
-      <Project>{2762E921-91A8-4C87-91E9-BA628013F753}</Project>\r
-      <Name>System-net_4_x</Name>\r
-    </ProjectReference>\r
-  </ItemGroup>\r
-  <ItemGroup>\r
-    <Folder Include="Properties\" />\r
-  </ItemGroup>\r
-</Project>\r
-
diff --git a/mcs/class/Facades/System.Private.CoreLib.InteropServices/System.Private.CoreLib.InteropServices.dll.sources b/mcs/class/Facades/System.Private.CoreLib.InteropServices/System.Private.CoreLib.InteropServices.dll.sources
deleted file mode 100644 (file)
index 8e33d4d..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-TypeForwarders.cs
-AssemblyInfo.cs
-
diff --git a/mcs/class/Facades/System.Private.CoreLib.InteropServices/TypeForwarders.cs b/mcs/class/Facades/System.Private.CoreLib.InteropServices/TypeForwarders.cs
deleted file mode 100644 (file)
index 7a1269d..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-// 
-// Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)
-// 
-// 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.
-// 
-
-[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.CallingConvention))]
-[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.DllImportAttribute))]
-[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.GCHandle))]
-[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.GCHandleType))]
-[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.SafeHandle))]
-
-//Missing: [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(Internal.Reflection.Execution.PayForPlayExperience.MissingMetadataExceptionCreator))]
-//Missing: [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.DependencyReductionTypeRemoved))]
-//Missing: [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.PreInitializedAttribute))]
-//Missing: [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.InteropExtensions))]
-//Missing: [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.NativeCallableAttributes))]
-//Missing: [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.RuntimeImportAttribute))]
index 43035ee9d2441f304904c4c51a46ae4b3c43d97d..8b9f6f86f5e9d2c2b029e77d896c9f54396a0f10 100644 (file)
@@ -30,12 +30,8 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyCompany ("Xamarin, Inc.")]
 [assembly: AssemblyProduct ("Mono Common Language Infrastructure")]
 [assembly: AssemblyCopyright ("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")]
-[assembly: AssemblyVersion ("4.0.0.0")]
+[assembly: AssemblyVersion ("4.0.1.0")]
 [assembly: AssemblyInformationalVersion ("4.0.0.0")]
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index 3f6502b6e7a2a0b44463be2802fa3f28cba52435..5c638d1138dbcc0c8ac61ef1df02b04e3e491c57 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 521dee748d32dc4734103f4c78e5e8867993d3db..cd48993eda733461a63b78affd8406309de47df9 100644 (file)
@@ -30,12 +30,8 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyCompany ("Xamarin, Inc.")]
 [assembly: AssemblyProduct ("Mono Common Language Infrastructure")]
 [assembly: AssemblyCopyright ("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")]
-[assembly: AssemblyVersion ("4.0.0.0")]
+[assembly: AssemblyVersion ("4.0.1.0")]
 [assembly: AssemblyInformationalVersion ("4.0.0.0")]
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
diff --git a/mcs/class/Facades/System.Reflection.Emit.Lightweight/DynamicMethod.cs b/mcs/class/Facades/System.Reflection.Emit.Lightweight/DynamicMethod.cs
new file mode 100644 (file)
index 0000000..25fa02f
--- /dev/null
@@ -0,0 +1,136 @@
+//
+// DynamicMethod.cs
+//
+// Authors:
+//   Marek Safar (marek.safar@gmail.com)
+//
+// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com)
+//
+// 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.
+//
+
+#if FULL_AOT_RUNTIME
+
+namespace System.Reflection.Emit
+{
+       public abstract class DynamicMethod : MethodInfo, ICustomAttributeProvider
+       {
+               public DynamicMethod (string name, Type returnType, Type[] parameterTypes)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public DynamicMethod (string name, Type returnType, Type[] parameterTypes, bool restrictedSkipVisibility)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public DynamicMethod (string name, Type returnType, Type[] parameterTypes, Module m)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public DynamicMethod (string name, Type returnType, Type[] parameterTypes, Type owner)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public DynamicMethod (string name, Type returnType, Type[] parameterTypes, Module m, bool skipVisibility)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public DynamicMethod (string name, Type returnType, Type[] parameterTypes, Type owner, bool skipVisibility)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public DynamicMethod (string name, MethodAttributes attributes, CallingConventions callingConvention, Type returnType, Type[] parameterTypes, Module m, bool skipVisibility)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public DynamicMethod (string name, MethodAttributes attributes, CallingConventions callingConvention, Type returnType, Type[] parameterTypes, Type owner, bool skipVisibility)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public override MethodAttributes Attributes { 
+                       get {
+                               throw new PlatformNotSupportedException ();
+                       }
+               }
+
+               public override CallingConventions CallingConvention {
+                       get {
+                               throw new PlatformNotSupportedException ();
+                       }
+               }
+
+               public override Type DeclaringType {
+                       get {
+                               throw new PlatformNotSupportedException ();
+                       }
+               }
+
+               public bool InitLocals { get; set; }
+
+               public override MethodImplAttributes MethodImplementationFlags {
+                       get {
+                               throw new PlatformNotSupportedException ();
+                       }                               
+               }
+
+               public override string Name {
+                       get {
+                               throw new PlatformNotSupportedException ();
+                       }
+               }                               
+
+               public override ParameterInfo ReturnParameter {
+                       get {
+                               throw new PlatformNotSupportedException ();
+                       }
+               }
+
+               public override Type ReturnType {
+                       get {
+                               throw new PlatformNotSupportedException ();
+                       }
+               }
+
+               public ILGenerator GetILGenerator ()
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public ILGenerator GetILGenerator (int streamSize)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public override ParameterInfo[] GetParameters ()
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+       }
+}
+
+#endif
\ No newline at end of file
index 28c20187cf4de525314baba44a38b3038b95b352..94414cdca10d7e905cf445ee8269c95e07ff4379 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -55,6 +56,7 @@
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />\r
   <ItemGroup>\r
     <Compile Include="AssemblyInfo.cs" />\r
+    <Compile Include="DynamicMethod.cs" />\r
     <Compile Include="TypeForwarders.cs" />\r  </ItemGroup>\r
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \r
        Other similar extension points exist, see Microsoft.Common.targets.\r
index 7cd359e90a0d8fcce5eb4df48242bc4d11378507..9fca03abafc330c36076aabe54e6c31614906bc0 100644 (file)
@@ -20,5 +20,6 @@
 // THE SOFTWARE.
 // 
 
+#if !FULL_AOT_RUNTIME
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.Emit.DynamicMethod))]
-
+#endif
index 656df0b122461fd50476ee029e0e5a41b25e2488..03e71faf4b5db5a0e72c47d9fbad04ad216a95b2 100644 (file)
@@ -30,12 +30,8 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyCompany ("Xamarin, Inc.")]
 [assembly: AssemblyProduct ("Mono Common Language Infrastructure")]
 [assembly: AssemblyCopyright ("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")]
-[assembly: AssemblyVersion ("4.0.0.0")]
+[assembly: AssemblyVersion ("4.0.1.0")]
 [assembly: AssemblyInformationalVersion ("4.0.0.0")]
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index e407d0fd9c7825ed41de42d80017ed782c091421..2414792a1bc61fbe9f88a906213e81dd3e540215 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 7b9237816ec909a737368aa2c5c8033c9e1e0bcf..5cd81bd4d4927a694cec98138a3b7950778e3f52 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index 5a41690bc62c94b1d919e03c4bdd86bd62659cd3..c0fd89780ec8f608f29574874cb54b6b19593df8 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 260b4584c69bd991a449844adebc823dc9208791..0257139689737a0cf5af997cb27ad165695f281d 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index 9b883b5f9d788d085bd3b52391f97219fa8d1639..bb0034319643e4df5719ebeba902580eef6250eb 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 120da41f2a29f911f0a0632b35cb6ed7359dfc48..918e35f600a50b415c17c5fa2ef23bc909509b78 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index 2030414734b675bdfeb4fbb1663f37b26627f3c8..08fbc861da352571d3d293779d556bc6ec070a23 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -55,6 +56,9 @@
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />\r
   <ItemGroup>\r
     <Compile Include="AssemblyInfo.cs" />\r
+    <Compile Include="Requires.cs" />\r
+    <Compile Include="SR.cs" />\r
+    <Compile Include="TypeExtensions.CoreCLR.cs" />\r
     <Compile Include="TypeForwarders.cs" />\r  </ItemGroup>\r
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \r
        Other similar extension points exist, see Microsoft.Common.targets.\r
index 661cd67a0eaf371b9a56c8d34e77f940d9cfd80f..2943d31dc0a5ad9cce109751cb8d53b9894b2e46 100644 (file)
@@ -15,199 +15,199 @@ namespace System.Reflection
 {
     public static class TypeExtensions
     {
-        public static ConstructorInfo GetConstructor(Type type, Type[] types)
+        public static ConstructorInfo GetConstructor(this Type type, Type[] types)
         {
             Requires.NotNull(type, nameof(type));
             return type.GetConstructor(types);
         }
 
-        public static ConstructorInfo[] GetConstructors(Type type)
+        public static ConstructorInfo[] GetConstructors(this Type type)
         {
             Requires.NotNull(type, nameof(type));
             return type.GetConstructors();
         }
 
-        public static ConstructorInfo[] GetConstructors(Type type, BindingFlags bindingAttr)
+        public static ConstructorInfo[] GetConstructors(this Type type, BindingFlags bindingAttr)
         {
             Requires.NotNull(type, nameof(type));
             return type.GetConstructors(bindingAttr);
         }
 
-        public static MemberInfo[] GetDefaultMembers(Type type)
+        public static MemberInfo[] GetDefaultMembers(this Type type)
         {
             Requires.NotNull(type, nameof(type));
             return type.GetDefaultMembers();
         }
 
-        public static EventInfo GetEvent(Type type, string name)
+        public static EventInfo GetEvent(this Type type, string name)
         {
             Requires.NotNull(type, nameof(type));
             return type.GetEvent(name);
         }
 
-        public static EventInfo GetEvent(Type type, string name, BindingFlags bindingAttr)
+        public static EventInfo GetEvent(this Type type, string name, BindingFlags bindingAttr)
         {
             Requires.NotNull(type, nameof(type));
             return type.GetEvent(name, bindingAttr);
         }
 
-        public static EventInfo[] GetEvents(Type type)
+        public static EventInfo[] GetEvents(this Type type)
         {
             Requires.NotNull(type, nameof(type));
             return type.GetEvents();
         }
 
-        public static EventInfo[] GetEvents(Type type, BindingFlags bindingAttr)
+        public static EventInfo[] GetEvents(this Type type, BindingFlags bindingAttr)
         {
             Requires.NotNull(type, nameof(type));
             return type.GetEvents(bindingAttr);
         }
 
-        public static FieldInfo GetField(Type type, string name)
+        public static FieldInfo GetField(this Type type, string name)
         {
             Requires.NotNull(type, nameof(type));
             return type.GetField(name);
         }
 
-        public static FieldInfo GetField(Type type, string name, BindingFlags bindingAttr)
+        public static FieldInfo GetField(this Type type, string name, BindingFlags bindingAttr)
         {
             Requires.NotNull(type, nameof(type));
             return type.GetField(name, bindingAttr);
         }
 
-        public static FieldInfo[] GetFields(Type type)
+        public static FieldInfo[] GetFields(this Type type)
         {
             Requires.NotNull(type, nameof(type));
             return type.GetFields();
         }
 
-        public static FieldInfo[] GetFields(Type type, BindingFlags bindingAttr)
+        public static FieldInfo[] GetFields(this Type type, BindingFlags bindingAttr)
         {
             Requires.NotNull(type, nameof(type));
             return type.GetFields(bindingAttr);
         }
 
-        public static Type[] GetGenericArguments(Type type)
+        public static Type[] GetGenericArguments(this Type type)
         {
             Requires.NotNull(type, nameof(type));
             return type.GetGenericArguments();
         }
 
-        public static Type[] GetInterfaces(Type type)
+        public static Type[] GetInterfaces(this Type type)
         {
             Requires.NotNull(type, nameof(type));
             return type.GetInterfaces();
         }
 
-        public static MemberInfo[] GetMember(Type type, string name)
+        public static MemberInfo[] GetMember(this Type type, string name)
         {
             Requires.NotNull(type, nameof(type));
             return type.GetMember(name);
         }
 
-        public static MemberInfo[] GetMember(Type type, string name, BindingFlags bindingAttr)
+        public static MemberInfo[] GetMember(this Type type, string name, BindingFlags bindingAttr)
         {
             Requires.NotNull(type, nameof(type));
             return type.GetMember(name, bindingAttr);
         }
 
-        public static MemberInfo[] GetMembers(Type type)
+        public static MemberInfo[] GetMembers(this Type type)
         {
             Requires.NotNull(type, nameof(type));
             return type.GetMembers();
         }
 
-        public static MemberInfo[] GetMembers(Type type, BindingFlags bindingAttr)
+        public static MemberInfo[] GetMembers(this Type type, BindingFlags bindingAttr)
         {
             Requires.NotNull(type, nameof(type));
             return type.GetMembers(bindingAttr);
         }
 
-        public static MethodInfo GetMethod(Type type, string name)
+        public static MethodInfo GetMethod(this Type type, string name)
         {
             Requires.NotNull(type, nameof(type));
             return type.GetMethod(name);
         }
 
-        public static MethodInfo GetMethod(Type type, string name, BindingFlags bindingAttr)
+        public static MethodInfo GetMethod(this Type type, string name, BindingFlags bindingAttr)
         {
             Requires.NotNull(type, nameof(type));
             return type.GetMethod(name, bindingAttr);
         }
 
-        public static MethodInfo GetMethod(Type type, string name, Type[] types)
+        public static MethodInfo GetMethod(this Type type, string name, Type[] types)
         {
             Requires.NotNull(type, nameof(type));
             return type.GetMethod(name, types);
         }
 
-        public static MethodInfo[] GetMethods(Type type)
+        public static MethodInfo[] GetMethods(this Type type)
         {
             Requires.NotNull(type, nameof(type));
             return type.GetMethods();
         }
 
-        public static MethodInfo[] GetMethods(Type type, BindingFlags bindingAttr)
+        public static MethodInfo[] GetMethods(this Type type, BindingFlags bindingAttr)
         {
             Requires.NotNull(type, nameof(type));
             return type.GetMethods(bindingAttr);
         }
 
-        public static Type GetNestedType(Type type, string name, BindingFlags bindingAttr)
+        public static Type GetNestedType(this Type type, string name, BindingFlags bindingAttr)
         {
             Requires.NotNull(type, nameof(type));
             return type.GetNestedType(name, bindingAttr);
         }
 
-        public static Type[] GetNestedTypes(Type type, BindingFlags bindingAttr)
+        public static Type[] GetNestedTypes(this Type type, BindingFlags bindingAttr)
         {
             Requires.NotNull(type, nameof(type));
             return type.GetNestedTypes(bindingAttr);
         }
 
-        public static PropertyInfo[] GetProperties(Type type)
+        public static PropertyInfo[] GetProperties(this Type type)
         {
             Requires.NotNull(type, nameof(type));
             return type.GetProperties();
         }
 
-        public static PropertyInfo[] GetProperties(Type type, BindingFlags bindingAttr)
+        public static PropertyInfo[] GetProperties(this Type type, BindingFlags bindingAttr)
         {
             Requires.NotNull(type, nameof(type));
             return type.GetProperties(bindingAttr);
         }
 
-        public static PropertyInfo GetProperty(Type type, string name)
+        public static PropertyInfo GetProperty(this Type type, string name)
         {
             Requires.NotNull(type, nameof(type));
             return type.GetProperty(name);
         }
 
-        public static PropertyInfo GetProperty(Type type, string name, BindingFlags bindingAttr)
+        public static PropertyInfo GetProperty(this Type type, string name, BindingFlags bindingAttr)
         {
             Requires.NotNull(type, nameof(type));
             return type.GetProperty(name, bindingAttr);
         }
 
-        public static PropertyInfo GetProperty(Type type, string name, Type returnType)
+        public static PropertyInfo GetProperty(this Type type, string name, Type returnType)
         {
             Requires.NotNull(type, nameof(type));
             return type.GetProperty(name, returnType);
         }
 
-        public static PropertyInfo GetProperty(Type type, string name, Type returnType, Type[] types)
+        public static PropertyInfo GetProperty(this Type type, string name, Type returnType, Type[] types)
         {
             Requires.NotNull(type, nameof(type));
             return type.GetProperty(name, returnType, types);
         }
 
-        public static bool IsAssignableFrom(Type type, Type c)
+        public static bool IsAssignableFrom(this Type type, Type c)
         {
             Requires.NotNull(type, nameof(type));
             return type.IsAssignableFrom(c);
         }
 
-        public static bool IsInstanceOfType(Type type, object o)
+        public static bool IsInstanceOfType(this Type type, object o)
         {
             Requires.NotNull(type, nameof(type));
             return type.IsInstanceOfType(o);
@@ -216,19 +216,19 @@ namespace System.Reflection
 
     public static class AssemblyExtensions
     {
-        public static Type[] GetExportedTypes(Assembly assembly)
+        public static Type[] GetExportedTypes(this Assembly assembly)
         {
             Requires.NotNull(assembly, nameof(assembly));
             return assembly.GetExportedTypes();
         }
 
-        public static Module[] GetModules(Assembly assembly)
+        public static Module[] GetModules(this Assembly assembly)
         {
             Requires.NotNull(assembly, nameof(assembly));
             return assembly.GetModules();
         }
 
-        public static Type[] GetTypes(Assembly assembly)
+        public static Type[] GetTypes(this Assembly assembly)
         {
             Requires.NotNull(assembly, nameof(assembly));
             return assembly.GetTypes();
@@ -237,37 +237,37 @@ namespace System.Reflection
 
     public static class EventInfoExtensions
     {
-        public static MethodInfo GetAddMethod(EventInfo eventInfo)
+        public static MethodInfo GetAddMethod(this EventInfo eventInfo)
         {
             Requires.NotNull(eventInfo, nameof(eventInfo));
             return eventInfo.GetAddMethod();
         }
 
-        public static MethodInfo GetAddMethod(EventInfo eventInfo, bool nonPublic)
+        public static MethodInfo GetAddMethod(this EventInfo eventInfo, bool nonPublic)
         {
             Requires.NotNull(eventInfo, nameof(eventInfo));
             return eventInfo.GetAddMethod(nonPublic);
         }
 
-        public static MethodInfo GetRaiseMethod(EventInfo eventInfo)
+        public static MethodInfo GetRaiseMethod(this EventInfo eventInfo)
         {
             Requires.NotNull(eventInfo, nameof(eventInfo));
             return eventInfo.GetRaiseMethod();
         }
 
-        public static MethodInfo GetRaiseMethod(EventInfo eventInfo, bool nonPublic)
+        public static MethodInfo GetRaiseMethod(this EventInfo eventInfo, bool nonPublic)
         {
             Requires.NotNull(eventInfo, nameof(eventInfo));
             return eventInfo.GetRaiseMethod(nonPublic);
         }
 
-        public static MethodInfo GetRemoveMethod(EventInfo eventInfo)
+        public static MethodInfo GetRemoveMethod(this EventInfo eventInfo)
         {
             Requires.NotNull(eventInfo, nameof(eventInfo));
             return eventInfo.GetRemoveMethod();
         }
 
-        public static MethodInfo GetRemoveMethod(EventInfo eventInfo, bool nonPublic)
+        public static MethodInfo GetRemoveMethod(this EventInfo eventInfo, bool nonPublic)
         {
             Requires.NotNull(eventInfo, nameof(eventInfo));
             return eventInfo.GetRemoveMethod(nonPublic);
@@ -337,7 +337,7 @@ namespace System.Reflection
 
     public static class MethodInfoExtensions
     {
-        public static MethodInfo GetBaseDefinition(MethodInfo method)
+        public static MethodInfo GetBaseDefinition(this MethodInfo method)
         {
             Requires.NotNull(method, nameof(method));
             return method.GetBaseDefinition();
@@ -361,37 +361,37 @@ namespace System.Reflection
 
     public static class PropertyInfoExtensions
     {
-        public static MethodInfo[] GetAccessors(PropertyInfo property)
+        public static MethodInfo[] GetAccessors(this PropertyInfo property)
         {
             Requires.NotNull(property, nameof(property));
             return property.GetAccessors();
         }
 
-        public static MethodInfo[] GetAccessors(PropertyInfo property, bool nonPublic)
+        public static MethodInfo[] GetAccessors(this PropertyInfo property, bool nonPublic)
         {
             Requires.NotNull(property, nameof(property));
             return property.GetAccessors(nonPublic);
         }
 
-        public static MethodInfo GetGetMethod(PropertyInfo property)
+        public static MethodInfo GetGetMethod(this PropertyInfo property)
         {
             Requires.NotNull(property, nameof(property));
             return property.GetGetMethod();
         }
 
-        public static MethodInfo GetGetMethod(PropertyInfo property, bool nonPublic)
+        public static MethodInfo GetGetMethod(this PropertyInfo property, bool nonPublic)
         {
             Requires.NotNull(property, nameof(property));
             return property.GetGetMethod(nonPublic);
         }
 
-        public static MethodInfo GetSetMethod(PropertyInfo property)
+        public static MethodInfo GetSetMethod(this PropertyInfo property)
         {
             Requires.NotNull(property, nameof(property));
             return property.GetSetMethod();
         }
 
-        public static MethodInfo GetSetMethod(PropertyInfo property, bool nonPublic)
+        public static MethodInfo GetSetMethod(this PropertyInfo property, bool nonPublic)
         {
             Requires.NotNull(property, nameof(property));
             return property.GetSetMethod(nonPublic);
index 00f07f8d343aec184102fc16cd6f60498a485cbb..ef752e22d25fec88d9b177ff71743aa4661e57e6 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index 98be695bc274eb11047cf63ab7f9861d1b9b23d7..a7cea643721db6f89a1aeac92f21c893fdca99f3 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 1525b34d50ee0686886ae461b737627aa566d268..f68c22a2d368117a7a89a8ef60fadca43e3d42fe 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index eaafdd2b4b60df04720d5c3cc0219f3a3f57d62e..9ecbd892aa52b6d0de04b7a689c5c49985f464ef 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 067874f4f03e3d9872033ab694e71f4614f10780..1d626a478c414637ab9acdfc180dc9cc2cd79b26 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index e40ceea68096b110e6bb3d8161e0332df38c6979..2c33abedf3b38d1383a4e92f731936285300451f 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 5643e79fd51cc521ea78159742fd3426f04599ca..7476a7fd949a3014ebc2b8fd2a1168728a14299d 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index f3b9b2dadbd3ad659e09c6be1c2d81b126e38473..d8689a5402b44cce6ffa273b3adafcd0de7e61b5 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 37f003529ac03b9133858ba2632d820a2642ffed..3104f8b2b81c20723e10da119d8e6e01f75c4af8 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index f00748c40fa8d979c416ac6c6e50035daaa7aa4e..48177dcea8d87bf2feb34ffa26842b5f2026678a 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 2ff294b0dd114c4e60b6ef59743ef33fdba0a9ae..70a725c14ee34b1a479d854b3d46cefc01c195da 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index d29f79f2d6c8e204bf6c5573ec3f0ad87e7056aa..3de001c94a3cb43ad38ea0b614101d8a35ea68fd 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index f63a705107d9af51999b3c233a016601123c5ac2..129a31fb0ebcf94f5865e4abf3f8aae322f02fa7 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index 0dddc7ef0a7454024c3cbf7b414273c5251f14cc..a5e8e4802fe78f76437c0ae27c25ecbe42909c77 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 9c17934bb4abdbefa23b4ddf311daa10e9f6a70d..1279cedbf103c2d5759646c6af92f0ecd34c835a 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index 7011c5559d7f022611bd5624ed2e031b8bde1fa9..04c6b684710b09620895846d4e81075d918bbbdb 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 94249720f6a1a2130d71d6bacff177e3bd5d47d0..361d3326ff581e40103016493acc53ccd59a4407 100644 (file)
 // THE SOFTWARE.
 // 
 
-#if !FULL_AOT_RUNTIME
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComImportAttribute))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.DispatchWrapper))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ErrorWrapper))]
-#endif
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.DataMisalignedException))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.DllNotFoundException))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.Missing))]
index 00b01219c870dc95ab0ecd64cac85c045816cffb..71a2260ffefbd4c91811174784823f1b0c55afd9 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index a82e8d24fb4044a30ef7abf9fd234442fef0677c..c6a5d2f2032e268f77ef453aabcd3211fb38e954 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 9b921172c12fd8e2bc7ccc20e04d7d2bc9c177b6..23d6ff37d9b82c027a1a6991d8b9219a5f746cea 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index 6710dca152ae0b2b8bcc78348a8ebd40a3b0b19a..214bd0f5b62951868db49f6947eb43065dfe2c80 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index 18a14af836bc321c47cad65d8369c6108487e2a9..6d1e37cfb6ed0ae8470bc05a9a85dd7b8aa654f9 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 09c00ba397e9c1434459458db7d74a257841bce7..cfd4036ef67b0c137ad9092a542012a557127196 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index 71204dcabbd6d8c4fedbfefd37151f115e604e24..da81f5d106c1d3a06dbc0b39f38bdbe026eef4f2 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -55,6 +56,7 @@
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />\r
   <ItemGroup>\r
     <Compile Include="AssemblyInfo.cs" />\r
+    <Compile Include="ISerializationSurrogateProvider.cs" />\r
     <Compile Include="TypeForwarders.cs" />\r  </ItemGroup>\r
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \r
        Other similar extension points exist, see Microsoft.Common.targets.\r
index e64a8fe3440469251669c5841f2d99852480b81b..3683d775f2603ed78f1ab413675bcbabacdfaa5a 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index 058a3e642197a0027dbc590b7f7898153ed7bc0c..6fd12c8ca4b8c78dce367ed2a79a465368514e07 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -55,6 +56,8 @@
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />\r
   <ItemGroup>\r
     <Compile Include="AssemblyInfo.cs" />\r
+    <Compile Include="DataContractSerializerExtensions.cs" />\r
+    <Compile Include="NotImplemented.cs" />\r
     <Compile Include="TypeForwarders.cs" />\r  </ItemGroup>\r
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \r
        Other similar extension points exist, see Microsoft.Common.targets.\r
       <Project>{2CA6026B-2DC8-4C4C-A12C-1E8234049DB7}</Project>\r
       <Name>corlib-net_4_x</Name>\r
     </ProjectReference>\r
+    <ProjectReference Include="../../System/System-net_4_x.csproj">\r
+      <Project>{2762E921-91A8-4C87-91E9-BA628013F753}</Project>\r
+      <Name>System-net_4_x</Name>\r
+    </ProjectReference>\r
     <ProjectReference Include="../../System.Runtime.Serialization/System.Runtime.Serialization-net_4_x.csproj">\r
       <Project>{D845AD9D-3CCB-49CB-9543-028678E94938}</Project>\r
       <Name>System.Runtime.Serialization-net_4_x</Name>\r
       <Project>{87FD2F0F-5222-4AE6-BD63-2D4975E11E5B}</Project>\r
       <Name>System.Xml-net_4_x</Name>\r
     </ProjectReference>\r
+    <ProjectReference Include="../System.Runtime.Serialization.Primitives/Facades_System.Runtime.Serialization.Primitives-net_4_x.csproj">\r
+      <Project>{49BB9015-6989-4BD0-AF82-9184BE637D57}</Project>\r
+      <Name>Facades_System.Runtime.Serialization.Primitives-net_4_x</Name>\r
+    </ProjectReference>\r
   </ItemGroup>\r
   <ItemGroup>\r
     <Folder Include="Properties\" />\r
index 1a9717ec41a0f6a016253d5da0113c81f46429b6..55cb3dc4679e3954cdd51b86778e33a8b3181f1a 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index d88f7bba8c654ad01ac494b7162266ef99e0b6b1..d31e708ecff2553f6799b9adf887c8736777813f 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index f7e930691662aa0ce2c3fe395e92cbaf07fbc98b..09cb993ae685cfc6bb02e4503224e96c502a6d9a 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index 546f03f9c7cae8fb50b05f134b3d4842b75d270a..dbd68e93933b6bb824f84172b320dcc9a2febc78 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index d697b7398486bf4ab02618a17031a807b4b31867..5afb672be75ac91282dffe91fd1752bfc5ba5f0a 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index 341cad800eeca907e8e10c79816f45aa604b1aa0..c99535c6ea5293481042840973fe655734af2273 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 232d6f79a1f4e44034180edfe4e9ce70c8f3cbb0..554f83b7e7141810a5cf9a2d156051929e724f46 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index db3aaf3b2571ec5d191d7f142b3f4ba7bf8ddba9..bbe17f9e5954cdd37b5fcc3f29458d354fd9d25c 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index 0d630533adbf827e4e8b762dd1b01c299b756148..8677fa48cc8ffd873aba3af841532be4af5cb779 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index 3dbb8e8638512dd25df920017183307090c4fedb..51b7a1acad14c34a57f5ad0e6290bddc33d5cbb7 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index 3c274abb796468105212f8566dee5b779a2f9265..b95c6d9cc632f8d7045cbce8d833f6bcf7550064 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index a8394fe77d069bf71d0e68ef9211b6495646b60f..4b9af9893260293f1f5cf9fb0a0a68fc37797760 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index 20640b091c8888c9489aa5ad2cf58a93ff690333..fb417c923d5c49813a96d36f6e7e7bf876295e84 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 61acb09e62ad69216cdd73ce25afacb7674a3d91..6f6c4437a23a2352e1139eac4d9f58a067631a03 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index a523ca9926323bed1c24e3effba3d27267e8b100..3d5217932ea9bf5bf700df83d590e675ee4eb086 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 12a59994f37a31a5cd2b5fbc9b787626098db48d..f0dfe1a720f9cfcdfbce6d02864a935367f7d058 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index 268dc0f5926ea92f5d2e498cf743b6f5c5f15a00..71acd0d43f6ce28088072ce02608ffed2acfe1c9 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 9e44eab66396f92d3750e5a1f21a30b79a26c7b5..f462ba4dbcf162373c91c26911b67c4b5c0a8afd 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index 1608821c77b2d9b41022fc531da38740b488857f..66c5636cbdd9160fb8351bd30c9b78cf770a2b53 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index f3c99c80909915ec0616e4c6219518a23189fdb2..6fc47e93a622e3029be6e04b2fbc24ab367cee47 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index c331d66a40ad313a1e43c98144bd36f3646541be..935d24713c578390559eb377d78876fcb03fd594 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index e6da632890a8ab38789452fadfde28e179738732..9e9384b209bb4711bba32c1ca6408cacdeb8190d 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index 098c162409a25d264746403cf24419c03911e7d7..7a47f7f2c8d606f38ca65d3b4da6ceb6a95cc2f7 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 9a0cb01d1e488bc528fe021b4c79c36830f9f592..02071a99b0f4902420c9c5873a791b34cd89fd4d 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index 9865a1540f82d5bc5d30bbc1f357e09a704d6e67..85ec31d33c03bea3ba88d355bc5bbf5d315a4fe4 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 3560bf23570d91e705531f5fecaa80df52096edc..9c88245aa2c64d37fc75ba3158acdaef940decc5 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index 06089b35e6fd669d125f7a24d10722bf3158fb1f..9a1162f702ca9e55b49a3bcf87b9e44d34ee56e3 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index 9b7aef5a9fd29caaa2a49482ebc90f490963c48a..f6634012ff941a9eea8df93874ac673b54cf8dbf 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
diff --git a/mcs/class/Facades/System.Security.Cryptography.Primitives/Facades_System.Security.Cryptography.Primitives-net_4_x.csproj b/mcs/class/Facades/System.Security.Cryptography.Primitives/Facades_System.Security.Cryptography.Primitives-net_4_x.csproj
new file mode 100644 (file)
index 0000000..861c826
--- /dev/null
@@ -0,0 +1,95 @@
+<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
+  <PropertyGroup>\r
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>\r
+    <ProductVersion>9.0.30729</ProductVersion>\r
+    <SchemaVersion>2.0</SchemaVersion>\r
+    <ProjectGuid>{62880D99-1C4C-4D38-A8FE-57EF2C9E2150}</ProjectGuid>\r
+    <OutputType>Library</OutputType>\r
+    <NoWarn>1699,1616,1699</NoWarn>\r
+    <OutputPath>./../../../class/lib/net_4_x/Facades</OutputPath>\r
+    <IntermediateOutputPath>obj-Facades</IntermediateOutputPath>\r
+    <GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>\r
+    <NoStdLib>True</NoStdLib>\r
+    \r
+    <NoConfig>True</NoConfig>\r
+    \r
+    <AppDesignerFolder>Properties</AppDesignerFolder>\r
+    <RootNamespace>\r
+    </RootNamespace>\r
+    <AssemblyName>System.Security.Cryptography.Primitives</AssemblyName>\r
+    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
+    <FileAlignment>512</FileAlignment>\r
+  </PropertyGroup>\r
+    <PropertyGroup>\r
+    <SignAssembly>true</SignAssembly>\r
+    <DelaySign>true</DelaySign>\r
+  </PropertyGroup>\r
+  <PropertyGroup>\r
+    <AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
+    <DebugSymbols>true</DebugSymbols>\r
+    <DebugType>full</DebugType>\r
+    <NoWarn>1699,1616,1699</NoWarn>\r
+    <Optimize>false</Optimize>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
+    <ErrorReport>prompt</ErrorReport>\r
+    <WarningLevel>4</WarningLevel>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">\r
+    <DebugType>pdbonly</DebugType>\r
+    <NoWarn>1699,1616,1699</NoWarn>\r
+    <Optimize>true</Optimize>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
+    <ErrorReport>prompt</ErrorReport>\r
+    <WarningLevel>4</WarningLevel>\r
+  </PropertyGroup>\r
+  <!-- Set AddAdditionalExplicitAssemblyReferences to false, otherwise if targetting .NET4.0, \r
+  Microsoft.NETFramework.props will force a dependency on the assembly System.Core. This\r
+  is a problem to compile the Mono mscorlib.dll -->\r
+  <PropertyGroup>\r
+    <AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>\r
+  </PropertyGroup>\r
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />\r
+  <ItemGroup>\r
+    <Compile Include="AssemblyInfo.cs" />\r
+    <Compile Include="TypeForwarders.cs" />\r  </ItemGroup>\r
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \r
+       Other similar extension points exist, see Microsoft.Common.targets.\r
+  <Target Name="BeforeBuild">\r
+  </Target>\r
+  <Target Name="AfterBuild">\r
+  </Target>\r
+  -->\r
+  <PropertyGroup>\r
+    <PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
+
+    </PreBuildEvent>\r
+    <PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">\r
+\r
+    </PreBuildEvent>\r
+    <PostBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
+
+    </PostBuildEvent>\r
+    <PostBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">\r
+\r
+    </PostBuildEvent>\r
+  </PropertyGroup>\r
+  <ItemGroup>\r
+    <ProjectReference Include="../../corlib/corlib-net_4_x.csproj">\r
+      <Project>{2CA6026B-2DC8-4C4C-A12C-1E8234049DB7}</Project>\r
+      <Name>corlib-net_4_x</Name>\r
+    </ProjectReference>\r
+    <ProjectReference Include="../../System/System-net_4_x.csproj">\r
+      <Project>{2762E921-91A8-4C87-91E9-BA628013F753}</Project>\r
+      <Name>System-net_4_x</Name>\r
+    </ProjectReference>\r
+  </ItemGroup>\r
+  <ItemGroup>\r
+    <Folder Include="Properties\" />\r
+  </ItemGroup>\r
+</Project>\r
+
index e269b466115fda3bdc234e3bb916019ff1cd84f4..5b28386b8ef61e0653b56ca392ab28b4d218ef19 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index 53e18fa4825430406654467d66ebad8c7e6b10c5..71bbfb4497af5a038cad7f2e75a7556ce0bb54fe 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 63feb7163b87a7481b762edbd8c4a6a56f214a07..95b9a0c51e674febdced93633e7c4bf1c82dae72 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index 1f6584376e92e39c2beeef060ba893551b9d8a57..d6fee2805006df4e073cbe74189c2f7dcf4bfc6f 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 4b0d53f8bde0ceb99710a5e09d11aaabad7972be..79fb0295a47be3a9ff4673297d028d3b1ea84463 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index 3b0e5112389c7a70d1472def7c0607361b91e6f2..996edbfafdc27e648163c31feb0dad3da16c032d 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 011b275a6120d9460542e85b0dbc587dcb4d62b8..efa4c538917417baee493522758628a290806901 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index 0a126a61c73191792605cae1074dc858ae86c585..aa8360ca4c583eb12e6f0ad0540351691b8492a8 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
       <Project>{2762E921-91A8-4C87-91E9-BA628013F753}</Project>\r
       <Name>System-net_4_x</Name>\r
     </ProjectReference>\r
+    <ProjectReference Include="../../System.Core/System.Core-net_4_x.csproj">\r
+      <Project>{359142A1-D80F-401E-AA64-7167C9317649}</Project>\r
+      <Name>System.Core-net_4_x</Name>\r
+    </ProjectReference>\r
   </ItemGroup>\r
   <ItemGroup>\r
     <Folder Include="Properties\" />\r
index 7e52ff670ed904d49d34693979c9a3b20b53bc63..bcb3fc9808d771f95b63b2d7e0d2fdfbfb88ab7a 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index 18aa2ae6185a6f3555e3adb5d3cbe0dce8787f23..b405e5d8b5f089ada8c4049b145c2b7bde707105 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 9d0d014384ad3f9400285f51ede2eafac2cbdf7d..e33e72f07ec65678e5ecac8b2ac88d5e8363f53c 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index 53c26f634d146ebf9a68534fe703b1392394c8f0..d0d85ae5e386308b4d8c608ae0838c0e0e9cafc2 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 27af1f18a2af598f9d436096cb8401ad9a8b56b3..71c3e6756b325e59f9e46fd4e6607af59376f176 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index 7e2fc1e0a8656368b91f77aa3c19870a3f1e256d..dfa35af23b9f078d91b0c0adc0916f0928b42dc6 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -55,6 +56,7 @@
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />\r
   <ItemGroup>\r
     <Compile Include="AssemblyInfo.cs" />\r
+    <Compile Include="SecureStringMarshal.cs" />\r
     <Compile Include="TypeForwarders.cs" />\r  </ItemGroup>\r
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \r
        Other similar extension points exist, see Microsoft.Common.targets.\r
index 59c85a4291e68e4d64bbfafa7b1c5d4a2b49de1c..8fb33b4f63ec675a571587103988e30d0cde7c80 100644 (file)
 // THE SOFTWARE.
 // 
 
+using System.Runtime.InteropServices;
+
 namespace System.Security
 {
        public static class SecureStringMarshal
        {
                public static IntPtr SecureStringToCoTaskMemAnsi (SecureString s)
                {
-                       throw new NotImplementedException ();
+                       return Marshal.SecureStringToCoTaskMemAnsi (s);
                }
 
                public static IntPtr SecureStringToCoTaskMemUnicode (SecureString s)
                {
-                       throw new NotImplementedException ();
+                       return Marshal.SecureStringToCoTaskMemUnicode (s);
                }
 
                public static IntPtr SecureStringToGlobalAllocAnsi (SecureString s)
                {
-                       throw new NotImplementedException ();
+                       return Marshal.SecureStringToGlobalAllocAnsi (s);
                }
 
                public static IntPtr SecureStringToGlobalAllocUnicode (SecureString s)
                {
-                       throw new NotImplementedException ();
+                       return Marshal.SecureStringToGlobalAllocUnicode (s);
                }
        }
 }
index 38f58e9d151a7c5d9b117139e3807d6062cc3bae..fc2332957d19e69066adf16a8ae5e5e0863df002 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index 3a098dcdfc2955aef7c0233e4f6cb3677e850e3a..36cda8836d3eb12e1166120fde3e5bee51a282b2 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 1d34f0634034e3b9cca0ccc14159c1aa77316d2c..6630473daf88dd251f40c0af0e76ee53d971e37e 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index d830d0e08438a3f08c2fcf4a49b25eab9970c16e..001b5b3e4dd2ee6e769108e0d235189f236ec172 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 1d34f0634034e3b9cca0ccc14159c1aa77316d2c..6630473daf88dd251f40c0af0e76ee53d971e37e 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index 0b25b6be19eae86a64166ae03e541be4605577e3..c11821d4869759c887e49693aba9435ad7b66ef8 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index c982bbe4f3d50c2914f289042c0218b6d7a762e9..c00b1d2c35e0d32dd5cda68549ab130c60ffeba6 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index 1508ff5d41a0377da44a29f08a847320b0e0020a..87d9672136f91d156c1e34f8f8971864baa2e757 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
       <Project>{2CA6026B-2DC8-4C4C-A12C-1E8234049DB7}</Project>\r
       <Name>corlib-net_4_x</Name>\r
     </ProjectReference>\r
+    <ProjectReference Include="../../System/System-net_4_x.csproj">\r
+      <Project>{2762E921-91A8-4C87-91E9-BA628013F753}</Project>\r
+      <Name>System-net_4_x</Name>\r
+    </ProjectReference>\r
     <ProjectReference Include="../../System.ServiceModel/System.ServiceModel-net_4_x.csproj">\r
       <Project>{FE596C31-BDA2-4850-8F79-F8F4DF70F44A}</Project>\r
       <Name>System.ServiceModel-net_4_x</Name>\r
       <Project>{87FD2F0F-5222-4AE6-BD63-2D4975E11E5B}</Project>\r
       <Name>System.Xml-net_4_x</Name>\r
     </ProjectReference>\r
+    <ProjectReference Include="../../System.IdentityModel/System.IdentityModel-net_4_x.csproj">\r
+      <Project>{FA718FA9-32C2-4BAC-BAAB-DB3A7A326D4C}</Project>\r
+      <Name>System.IdentityModel-net_4_x</Name>\r
+    </ProjectReference>\r
+    <ProjectReference Include="../System.Security.Cryptography.X509Certificates/Facades_System.Security.Cryptography.X509Certificates-net_4_x.csproj">\r
+      <Project>{C2E71C2B-A806-4FEB-AE2D-A5BE884E3BA7}</Project>\r
+      <Name>Facades_System.Security.Cryptography.X509Certificates-net_4_x</Name>\r
+    </ProjectReference>\r
   </ItemGroup>\r
   <ItemGroup>\r
     <Folder Include="Properties\" />\r
index 1195365cf2cc17e22419e08d5f0be6c63afe6e4c..432e6df602fa1d3bead646579b8f1f02e074cdd5 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index 05cafee86eb8ba471b1c6bdae82d8aeb0ab39ddf..5650c020eec97a4018a5d064ddb91b001f24af75 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 67306cb4adedbad82f74260a6d4bf9eded7979a0..9d5c8e1afe7be83f1a2f8abf9d517838acf2be91 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index 4eedc26e62d9278328420893a73a086f1eb276c8..414a299a75aa5791d5e0ee825ac58ee139eca783 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
   </PropertyGroup>\r
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />\r
   <ItemGroup>\r
+    <Compile Include="..\..\..\build\common\MonoTODOAttribute.cs" />\r
     <Compile Include="AssemblyInfo.cs" />\r
+    <Compile Include="ServiceController_mobile.cs" />\r
+    <Compile Include="ServiceControllerStatus_mobile.cs" />\r
+    <Compile Include="ServiceStartMode_mobile.cs" />\r
+    <Compile Include="ServiceType_mobile.cs" />\r
+    <Compile Include="TimeoutException_mobile.cs" />\r
     <Compile Include="TypeForwarders.cs" />\r  </ItemGroup>\r
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \r
        Other similar extension points exist, see Microsoft.Common.targets.\r
index f84a27d1c9a848f0cbb12a9d6a9a602b7c73c964..617465326fe16653be2dc1ff0ec4c6959c310dc1 100644 (file)
@@ -37,208 +37,180 @@ namespace System.ServiceProcess
 {
        public class ServiceController : IDisposable
        {
-               [MonoTODO]
                public bool CanPauseAndContinue
                {
                        get
                        {
-                               throw new NotImplementedException ();
+                               throw new PlatformNotSupportedException ();
                        }
                }
 
-               [MonoTODO]
                public bool CanShutdown
                {
                        get
                        {
-                               throw new NotImplementedException ();
+                               throw new PlatformNotSupportedException ();
                        }
                }
 
-               [MonoTODO]
                public bool CanStop
                {
                        get
                        {
-                               throw new NotImplementedException ();
+                               throw new PlatformNotSupportedException ();
                        }
                }
 
-               [MonoTODO]
                public ServiceController[] DependentServices
                {
                        get
                        {
-                               throw new NotImplementedException ();
+                               throw new PlatformNotSupportedException ();
                        }
                }
 
-               [MonoTODO]
                public string DisplayName
                {
                        get
                        {
-                               throw new NotImplementedException ();
+                               throw new PlatformNotSupportedException ();
                        }
                }
 
-               [MonoTODO]
                public string MachineName
                {
                        get
                        {
-                               throw new NotImplementedException ();
+                               throw new PlatformNotSupportedException ();
                        }
                }
 
-               [MonoTODO]
                public SafeHandle ServiceHandle
                {
                        get
                        {
-                               throw new NotImplementedException ();
+                               throw new PlatformNotSupportedException ();
                        }
                }
 
-               [MonoTODO]
                public string ServiceName
                {
                        get
                        {
-                               throw new NotImplementedException ();
+                               throw new PlatformNotSupportedException ();
                        }
                }
 
-               [MonoTODO]
                public ServiceController[] ServicesDependedOn
                {
                        get
                        {
-                               throw new NotImplementedException ();
+                               throw new PlatformNotSupportedException ();
                        }
                }
 
-               [MonoTODO]
                public ServiceType ServiceType
                {
                        get
                        {
-                               throw new NotImplementedException ();
+                               throw new PlatformNotSupportedException ();
                        }
                }
 
-               [MonoTODO]
                public ServiceStartMode StartType
                {
                        get
                        {
-                               throw new NotImplementedException ();
+                               throw new PlatformNotSupportedException ();
                        }
                }
 
-               [MonoTODO]
                public ServiceControllerStatus Status
                {
                        get
                        {
-                               throw new NotImplementedException ();
+                               throw new PlatformNotSupportedException ();
                        }
                }
 
-               [MonoTODO]
                public ServiceController (string name)
                {
-                       throw new NotImplementedException ();
+                       throw new PlatformNotSupportedException ();
                }
 
-               [MonoTODO]
                public ServiceController (string name, string machineName)
                {
-                       throw new NotImplementedException ();
+                       throw new PlatformNotSupportedException ();
                }
 
-               [MonoTODO]
                public void Continue ()
                {
-                       throw new NotImplementedException ();
+                       throw new PlatformNotSupportedException ();
                }
 
-               [MonoTODO]
                public void Dispose ()
                {
-                       throw new NotImplementedException ();
+                       throw new PlatformNotSupportedException ();
                }
 
-               [MonoTODO]
                protected virtual void Dispose (bool disposing)
                {
-                       throw new NotImplementedException ();
+                       throw new PlatformNotSupportedException ();
                }
 
-               [MonoTODO]
                public static ServiceController[] GetDevices ()
                {
-                       throw new NotImplementedException ();
+                       throw new PlatformNotSupportedException ();
                }
 
-               [MonoTODO]
                public static ServiceController[] GetDevices (string machineName)
                {
-                       throw new NotImplementedException ();
+                       throw new PlatformNotSupportedException ();
                }
 
-               [MonoTODO]
                public static ServiceController[] GetServices ()
                {
-                       throw new NotImplementedException ();
+                       throw new PlatformNotSupportedException ();
                }
 
-               [MonoTODO]
                public static ServiceController[] GetServices (string machineName)
                {
-                       throw new NotImplementedException ();
+                       throw new PlatformNotSupportedException ();
                }
 
-               [MonoTODO]
                public void Pause ()
                {
-                       throw new NotImplementedException ();
+                       throw new PlatformNotSupportedException ();
                }
 
-               [MonoTODO]
                public void Refresh ()
                {
-                       throw new NotImplementedException ();
+                       throw new PlatformNotSupportedException ();
                }
 
-               [MonoTODO]
                public void Start ()
                {
-                       throw new NotImplementedException ();
+                       throw new PlatformNotSupportedException ();
                }
 
-               [MonoTODO]
                public void Start (string[] args)
                {
-                       throw new NotImplementedException ();
+                       throw new PlatformNotSupportedException ();
                }
 
-               [MonoTODO]
                public void Stop ()
                {
-                       throw new NotImplementedException ();
+                       throw new PlatformNotSupportedException ();
                }
 
-               [MonoTODO]
                public void WaitForStatus (ServiceControllerStatus desiredStatus)
                {
-                       throw new NotImplementedException ();
+                       throw new PlatformNotSupportedException ();
                }
 
-               [MonoTODO]
                public void WaitForStatus (ServiceControllerStatus desiredStatus, TimeSpan timeout)
                {
-                       throw new NotImplementedException ();
+                       throw new PlatformNotSupportedException ();
                }
        }
 }
index c6448d899ffe5a7ee56d31b1a59929fde1b66a47..5dbf4041b386ca9a4fc955f73caa304632832f1f 100644 (file)
@@ -36,22 +36,19 @@ namespace System.ServiceProcess
 {
        public class TimeoutException : Exception
        {
-               [MonoTODO]
                public TimeoutException ()
                {
-                       throw new NotImplementedException ();
+                       throw new PlatformNotSupportedException ();
                }
 
-               [MonoTODO]
                public TimeoutException (string message)
                {
-                       throw new NotImplementedException ();
+                       throw new PlatformNotSupportedException ();
                }
 
-               [MonoTODO]
                public TimeoutException (string message, Exception innerException)
                {
-                       throw new NotImplementedException ();
+                       throw new PlatformNotSupportedException ();
                }
        }
 }
index 3a26f0dca9c2008a2461dc1fb8f5f8e9cd720390..916a1255fa0b361216804425962ab079d49969b3 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
diff --git a/mcs/class/Facades/System.Text.Encoding.CodePages/Facades_System.Text.Encoding.CodePages-net_4_x.csproj b/mcs/class/Facades/System.Text.Encoding.CodePages/Facades_System.Text.Encoding.CodePages-net_4_x.csproj
new file mode 100644 (file)
index 0000000..c9170bc
--- /dev/null
@@ -0,0 +1,95 @@
+<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
+  <PropertyGroup>\r
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>\r
+    <ProductVersion>9.0.30729</ProductVersion>\r
+    <SchemaVersion>2.0</SchemaVersion>\r
+    <ProjectGuid>{DF49AC88-C6F2-43B1-8560-3B74542BD874}</ProjectGuid>\r
+    <OutputType>Library</OutputType>\r
+    <NoWarn>1699,1616,1699</NoWarn>\r
+    <OutputPath>./../../../class/lib/net_4_x/Facades</OutputPath>\r
+    <IntermediateOutputPath>obj-Facades</IntermediateOutputPath>\r
+    <GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>\r
+    <NoStdLib>True</NoStdLib>\r
+    \r
+    <NoConfig>True</NoConfig>\r
+    \r
+    <AppDesignerFolder>Properties</AppDesignerFolder>\r
+    <RootNamespace>\r
+    </RootNamespace>\r
+    <AssemblyName>System.Text.Encoding.CodePages</AssemblyName>\r
+    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
+    <FileAlignment>512</FileAlignment>\r
+  </PropertyGroup>\r
+    <PropertyGroup>\r
+    <SignAssembly>true</SignAssembly>\r
+    <DelaySign>true</DelaySign>\r
+  </PropertyGroup>\r
+  <PropertyGroup>\r
+    <AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
+    <DebugSymbols>true</DebugSymbols>\r
+    <DebugType>full</DebugType>\r
+    <NoWarn>1699,1616,1699</NoWarn>\r
+    <Optimize>false</Optimize>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
+    <ErrorReport>prompt</ErrorReport>\r
+    <WarningLevel>4</WarningLevel>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">\r
+    <DebugType>pdbonly</DebugType>\r
+    <NoWarn>1699,1616,1699</NoWarn>\r
+    <Optimize>true</Optimize>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
+    <ErrorReport>prompt</ErrorReport>\r
+    <WarningLevel>4</WarningLevel>\r
+  </PropertyGroup>\r
+  <!-- Set AddAdditionalExplicitAssemblyReferences to false, otherwise if targetting .NET4.0, \r
+  Microsoft.NETFramework.props will force a dependency on the assembly System.Core. This\r
+  is a problem to compile the Mono mscorlib.dll -->\r
+  <PropertyGroup>\r
+    <AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>\r
+  </PropertyGroup>\r
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />\r
+  <ItemGroup>\r
+    <Compile Include="AssemblyInfo.cs" />\r
+    <Compile Include="CodePagesEncodingProvider.cs" />\r  </ItemGroup>\r
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \r
+       Other similar extension points exist, see Microsoft.Common.targets.\r
+  <Target Name="BeforeBuild">\r
+  </Target>\r
+  <Target Name="AfterBuild">\r
+  </Target>\r
+  -->\r
+  <PropertyGroup>\r
+    <PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
+
+    </PreBuildEvent>\r
+    <PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">\r
+\r
+    </PreBuildEvent>\r
+    <PostBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
+
+    </PostBuildEvent>\r
+    <PostBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">\r
+\r
+    </PostBuildEvent>\r
+  </PropertyGroup>\r
+  <ItemGroup>\r
+    <ProjectReference Include="../../corlib/corlib-net_4_x.csproj">\r
+      <Project>{2CA6026B-2DC8-4C4C-A12C-1E8234049DB7}</Project>\r
+      <Name>corlib-net_4_x</Name>\r
+    </ProjectReference>\r
+    <ProjectReference Include="../../System/System-net_4_x.csproj">\r
+      <Project>{2762E921-91A8-4C87-91E9-BA628013F753}</Project>\r
+      <Name>System-net_4_x</Name>\r
+    </ProjectReference>\r
+  </ItemGroup>\r
+  <ItemGroup>\r
+    <Folder Include="Properties\" />\r
+  </ItemGroup>\r
+</Project>\r
+
index 80d5a5f15e9c0bbe7228ea4050d1df9db96ff51b..1e37fcbbd266e48fb1871328e715fb36e33f094a 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index c478e7918cc0bd00a5c685aa9c30498d09920245..325ec1b29b57f5a24d8d76705963a537783bf573 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 4ff5799c82fc5579f2f7594624abf6a9016dab6b..b05d88342b5ccf1312006fa691d16e991e8d3053 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index 5c8474d8caad113ca876be256d22aec472740b39..e7b870a1e248c514ee26dcf2b421d6b0566a81c0 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 8ad5d918c2008f89e3e7c1e9197d042cb1aa4739..22cb1124c8f89478652cfc929c0010d00e9dbb57 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index 3128965240d2d2d6bd1f35d26360020cc2070ba0..e0e59c2333fc39446ada8d660edc4ec124d31ed5 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 76e2db52c933fc075d112fe766a7c3ef625acfa2..cd7868f27b977c73fd5d780145ff5425956fede3 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index 2a7daad7c162cfa1c8b571bfc765b8df962fe590..322a7111685308d12bd57968625f9d9ae3e75478 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -54,7 +55,9 @@
   </PropertyGroup>\r
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />\r
   <ItemGroup>\r
+    <Compile Include="..\..\..\build\common\MonoTODOAttribute.cs" />\r
     <Compile Include="AssemblyInfo.cs" />\r
+    <Compile Include="ThreadingAclExtensions.cs" />\r
     <Compile Include="TypeForwarders.cs" />\r  </ItemGroup>\r
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \r
        Other similar extension points exist, see Microsoft.Common.targets.\r
index af61a50a0e6c8c45389a5df1e60839a17b551ab5..99b03b28edf5ea1551c5b2d28fd22309f8d2bb07 100644 (file)
@@ -36,40 +36,52 @@ namespace System.Threading
 {
     public static class ThreadingAclExtensions
     {
-        [MonoTODO]
-        public static EventWaitHandleSecurity GetAccessControl (EventWaitHandle handle)
+        public static EventWaitHandleSecurity GetAccessControl (this EventWaitHandle handle)
         {
-            throw new NotImplementedException ();
+            if (handle == null)
+                throw new ArgumentNullException (nameof (handle));
+
+            return handle.GetAccessControl ();
         }
 
-        [MonoTODO]
-        public static void SetAccessControl (EventWaitHandle handle, EventWaitHandleSecurity eventSecurity)
+        public static void SetAccessControl (this EventWaitHandle handle, EventWaitHandleSecurity eventSecurity)
         {
-            throw new NotImplementedException ();
+            if (handle == null)
+                throw new ArgumentNullException (nameof (handle));
+
+            handle.SetAccessControl (eventSecurity);
         }
 
-        [MonoTODO]
-        public static MutexSecurity GetAccessControl (Mutex mutex)
+        public static MutexSecurity GetAccessControl (this Mutex mutex)
         {
-            throw new NotImplementedException ();
+            if (mutex == null)
+                throw new ArgumentNullException (nameof (mutex));
+
+            return mutex.GetAccessControl ();
         }
 
-        [MonoTODO]
-        public static void SetAccessControl (Mutex mutex, MutexSecurity mutexSecurity)
+        public static void SetAccessControl (this Mutex mutex, MutexSecurity mutexSecurity)
         {
-            throw new NotImplementedException ();
+            if (mutex == null)
+                throw new ArgumentNullException (nameof (mutex));
+
+            mutex.SetAccessControl (mutexSecurity);
         }
 
-        [MonoTODO]
-        public static SemaphoreSecurity GetAccessControl (Semaphore semaphore)
+        public static SemaphoreSecurity GetAccessControl (this Semaphore semaphore)
         {
-            throw new NotImplementedException ();
+            if (semaphore == null)
+                throw new ArgumentNullException (nameof (semaphore));
+
+            return semaphore.GetAccessControl ();
         }
 
-        [MonoTODO]
-        public static void SetAccessControl (Semaphore semaphore, SemaphoreSecurity semaphoreSecurity)
+        public static void SetAccessControl (this Semaphore semaphore, SemaphoreSecurity semaphoreSecurity)
         {
-            throw new NotImplementedException ();
+            if (semaphore == null)
+                throw new ArgumentNullException (nameof (semaphore));
+
+            semaphore.SetAccessControl (semaphoreSecurity);
         }
     }
 }
\ No newline at end of file
index e6621486d749b5961c73967284fa1ae518ef3085..5a2feb5f974082fcf016cbfe15148426d3daadad 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index 00de778e120b2fa500fd917abe1d97fd470f7d31..2b41fcc9c4c76fd4010044e9edf7baaab4bf242a 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -14,7 +15,7 @@
     <NoStdLib>True</NoStdLib>\r
     \r
     <NoConfig>True</NoConfig>\r
-    \r
+    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>\r
     <AppDesignerFolder>Properties</AppDesignerFolder>\r
     <RootNamespace>\r
     </RootNamespace>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />\r
   <ItemGroup>\r
     <Compile Include="AssemblyInfo.cs" />\r
+    <Compile Include="ClrThreadPoolBoundHandle.cs" />\r
+    <Compile Include="ClrThreadPoolBoundHandleOverlapped.cs" />\r
+    <Compile Include="ClrThreadPoolPreAllocatedOverlapped.cs" />\r
+    <Compile Include="DeferredDisposableLifetime.cs" />\r
+    <Compile Include="HResults.cs" />\r
+    <Compile Include="SR.cs" />\r
     <Compile Include="TypeForwarders.cs" />\r  </ItemGroup>\r
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \r
        Other similar extension points exist, see Microsoft.Common.targets.\r
index 25719f70bf7f718fd598e46edf095fb6ba4957f2..4a0f27fbc8f5e7f3f9faaa117e3bc6d7c9d82cfe 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index 70915d9a5db74507e4e1ad50ba48451568b9604c..0a2521ced3bfa25d9e8788997ffacec595efdd3c 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 7ba876ff82e40ea81c7d6402e6cf932b19c37432..347f3be59c60a97ff028eff0d9afca53676a6429 100644 (file)
@@ -36,6 +36,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
 
-[assembly: ReferenceAssembly]
-
-
index 3052af6fdcda1c56f16b62edf9910f37515451f8..7d9cfea31b01c4df93b7881cd74ffaecf4c4d410 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index c94f1e2550f87eb544dbe9ceddbd318df40379f3..7914509da0a99418fb6ab9065abf831bcc0ed3b9 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index 58a1e3e48a417a439a086bcf394eca62ab7543d5..be99c95e703daeb51af81ef0bc232287bbadf14a 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index d10a02fae3087e4296928625186b7001f5db9f75..338c9dafeb41d854581f36cc18f51d5088bba117 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index 081c415cfe00443197dcaa8ff6ec74964e36e379..1b49810afb6af14fcd869d1c54b6a0bbadb1f04e 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 8bf5c15039154c4e91011d3559caf1fa562316f0..75e5c0bb5a242921802f62262c08a62f8aa630b5 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index a0450e1ff2dfaa1fc408b1fcea24bdd6d8407002..eff86d643a0517d00145d52578611f790d7a0047 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 9659d44288825364d8d11cea22c4184a5c9580f9..181b40912c40ea9cd99736a7ae2f69e471dd00cb 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index 0b49733d39b11782b4f2fd48e757bd1605962f4c..3fd99d910efbcbaa32b0dbe76b7efbb6bd68c8bc 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 80c8d3a2bb463e92fa8487181b1b5dd4478edf9d..7746bcf569279b84dec6e9216dbc26d056a470b0 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index b607038b511e0fe542bebe205afaaa179cee4e49..3913f87471c38918d09f9476f94cc448fc7e536f 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index f3780608d8a87daea8da6b1714e9de66218bd271..e99e1d6d96cbac2863f34f79734b91b8b86d65a2 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index 6dfebc018ae02420221c9c095442e0c1c33a5d99..93396e1f4deaf82999de42ba16abc05f1d5aae7a 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 6086ef6f44cc5a44dc2c371081f834f363e3fc67..a779abc7c7067031e756b56a4fc26e196953bb72 100644 (file)
@@ -36,6 +36,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
 
-[assembly: ReferenceAssembly]
-
-
index 6fe69f7e13d2aeae84d4380ff3b5524f378cf38b..9415690d83a602e979d12b3a19d195fec6b80ec0 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -55,7 +56,8 @@
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />\r
   <ItemGroup>\r
     <Compile Include="AssemblyInfo.cs" />\r
-    <Compile Include="TypeForwarders.cs" />\r  </ItemGroup>\r
+    <Compile Include="TypeForwarders.cs" />\r
+    <Compile Include="XDocumentExtensions.cs" />\r  </ItemGroup>\r
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \r
        Other similar extension points exist, see Microsoft.Common.targets.\r
   <Target Name="BeforeBuild">\r
       <Project>{2762E921-91A8-4C87-91E9-BA628013F753}</Project>\r
       <Name>System-net_4_x</Name>\r
     </ProjectReference>\r
+    <ProjectReference Include="../../System.XML/System.Xml-net_4_x.csproj">\r
+      <Project>{87FD2F0F-5222-4AE6-BD63-2D4975E11E5B}</Project>\r
+      <Name>System.Xml-net_4_x</Name>\r
+    </ProjectReference>\r
     <ProjectReference Include="../../System.Xml.Linq/System.Xml.Linq-net_4_x.csproj">\r
       <Project>{526286D5-38D9-4579-B001-471440D57752}</Project>\r
       <Name>System.Xml.Linq-net_4_x</Name>\r
index c141099a7bea24f75ed28ae1407e352a1b32fef7..8994ef19e335f399449c5ea0161311095a413a52 100644 (file)
@@ -36,6 +36,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
 
-[assembly: ReferenceAssembly]
-
-
index fcddfd588d8195554f4d748308c03f20950e2cf1..142dadf2e09ff684b19725da59771ff3b6c24e01 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index b9722fd4a4d89d611b0e0fec56178f0629c4075d..f4ddb69f5c73e4657e0bc3cd7d860936f66935ce 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index adc60f7e829ec651563d4bf04398919481e86a1c..1b44a72f297141d071aa09f75e2b374ab413acb9 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 64b18fd19cdff0c0496da8559371b358bef0c606..58c284e627692672e3ccf9d8ac34d32d3fa3dd51 100644 (file)
@@ -35,7 +35,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion ("4.0.0.0")]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
index c4df512148f9c4e53aacb716b68e6919ea28aea0..f7a9166192585803e76e73fc1b28e1cab6473623 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index decfeec098c9fa2b04e4bf487d6918d59a0f634b..e08674f7e69394016b32732ed8634d023a5fb6d9 100644 (file)
@@ -36,6 +36,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../../msfinal.pub")]
 
-[assembly: ReferenceAssembly]
-
-
index 3e95b77fbd1dcc6768e8932cd82530805f5aa20b..92e86ad195c8ae6be61c3fe11a8a0656a4d8dad8 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1616,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index df1dd020404535839b69b35be715b25cdb7a9275..99e5ef51402044e78d1dc6c7032885e6e7edb1bf 100644 (file)
@@ -24,7 +24,7 @@ System.Security.Cryptography.Encryption.Aes System.Security.Cryptography.Encrypt
 System.Security.Cryptography.Hashing.Algorithms System.Security.Cryptography.RSA System.Security.Cryptography.RandomNumberGenerator \
 System.Security.Principal.Windows System.Threading.Thread System.Threading.ThreadPool \
 System.Xml.XPath System.Xml.XmlDocument System.Xml.Xsl.Primitives Microsoft.Win32.Registry.AccessControl System.Diagnostics.StackTrace System.Globalization.Extensions \
-System.IO.FileSystem.AccessControl System.Private.CoreLib.InteropServices System.Reflection.TypeExtensions \
+System.IO.FileSystem.AccessControl System.Reflection.TypeExtensions System.Reflection.Emit.Lightweight System.Reflection.Emit.ILGeneration System.Reflection.Emit \
 System.Security.SecureString System.Threading.AccessControl System.Threading.Overlapped System.Xml.XPath.XDocument \
 System.Security.Cryptography.Primitives System.Text.Encoding.CodePages System.IO.FileSystem.Watcher \
 System.Security.Cryptography.ProtectedData System.ServiceProcess.ServiceController System.IO.Pipes
@@ -34,8 +34,6 @@ common_DEPS_SUBDIRS = System.Security.Cryptography.X509Certificates System.Servi
 
 drawing_DEPS_SUBDIRS = System.Drawing.Primitives
 
-reflection_PARALLEL_SUBDIRS = System.Reflection.Emit.ILGeneration System.Reflection.Emit.Lightweight System.Reflection.Emit
-
 monotouch_SUBDIRS = $(common_DEPS_SUBDIRS) $(mobile_only_DEPS_SUBDIRS)
 monotouch_PARALLEL_SUBDIRS = $(common_SUBDIRS) $(mobile_only_SUBDIRS)
 
@@ -43,10 +41,16 @@ mobile_static_SUBDIRS = $(monotouch_SUBDIRS)
 mobile_static_PARALLEL_SUBDIRS = $(monotouch_PARALLEL_SUBDIRS)
 
 net_4_x_SUBDIRS = $(common_DEPS_SUBDIRS) $(drawing_DEPS_SUBDIRS)
-net_4_x_PARALLEL_SUBDIRS = $(common_SUBDIRS) $(reflection_PARALLEL_SUBDIRS)
+net_4_x_PARALLEL_SUBDIRS = $(common_SUBDIRS)
+
+build_PARALLEL_SUBDIRS = System.Runtime System.Reflection System.Collections System.Resources.ResourceManager System.Globalization \
+System.Threading.Tasks System.Collections.Concurrent System.Text.Encoding System.IO System.Threading System.Diagnostics.Debug \
+System.Linq.Expressions System.Dynamic.Runtime System.Linq System.Threading.Tasks.Parallel System.Xml.ReaderWriter \
+System.Diagnostics.Tools System.Reflection.Primitives System.Runtime.Extensions System.Runtime.InteropServices System.Text.Encoding.Extensions \
+System.Runtime.Numerics System.Xml.XDocument System.Reflection.Extensions
 
 monodroid_SUBDIRS = $(monotouch_SUBDIRS)
-monodroid_PARALLEL_SUBDIRS = $(monotouch_PARALLEL_SUBDIRS) $(reflection_PARALLEL_SUBDIRS)
+monodroid_PARALLEL_SUBDIRS = $(monotouch_PARALLEL_SUBDIRS)
 
 xammac_SUBDIRS = $(monotouch_SUBDIRS)
 xammac_PARALLEL_SUBDIRS = $(monotouch_PARALLEL_SUBDIRS)
index c6c9d3a44bbdbdd5d6c99d427b5324e5189a971c..eee63365fff6f05a7bfc9ee5d189ac686f22f15b 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;DISABLE_UNSAFE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;DISABLE_UNSAFE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>DISABLE_UNSAFE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>DISABLE_UNSAFE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 75ff7a5aac9dd7024ece9f556a05afada47ca3d9..5aa9618abbcbcadff36fa76b46b470da31e92f19 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;DISABLE_UNSAFE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;DISABLE_UNSAFE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>DISABLE_UNSAFE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>DISABLE_UNSAFE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 1afa51aef32e08d5690f8dc840d75402083ec000..3cca6e37a6d2a137472748e9d9ef9e5e05677f75 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 824b31774d50af80a8d219eab82d3afd32429f82..4053be10d18cb08af1c8dccc70ac2bd581ed8fa7 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index abde280e27d6cde0c6e9ad52bd88b3bd5f04aca2..bc50dbf9f698ca94ffd3051003b8f8ab1a8f7fed 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 95900687116613c4d2697c497dc7e03c1e6fa99c..3ea76be294c91e8833cf8e7e138b20cc90ccea1b 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 1479ae7ddb88a683c3f18a83ee9faca50f18f7a9..c911a981b714b8674a268da389c10fc669efb26b 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index a5761603e4d5b5a93b95a041108ea08e76a32a6f..0c22a91db06397e9d339d05bc43f82790e7eb8b8 100644 (file)
@@ -462,14 +462,16 @@ namespace IBM.Data.DB2
                        for(int i = 0; i < columnInfo.Length; i++)\r
                        {\r
                                short sqlRet;\r
-                               short strlen;\r
-                               int numericAttribute;\r
-\r
-                               sqlRet = DB2CLIWrapper.SQLColAttribute(hwndStmt, (short)(i + 1), (short)DB2Constants.SQL_DESC_BASE_COLUMN_NAME, sb, (short)sb.Capacity, out strlen, out numericAttribute);\r
+                               short strlen = 0;\r
+                               int numericAttribute = 0;\r
+                               \r
+                               sb.Clear();\r
+                               sqlRet = DB2CLIWrapper.SQLColAttribute(hwndStmt, (short)(i + 1), (short)DB2Constants.SQL_DESC_COLUMN_NAME, sb, (short)sb.Capacity, out strlen, out numericAttribute);\r
                                DB2ClientUtils.DB2CheckReturn(sqlRet, DB2Constants.SQL_HANDLE_STMT, hwndStmt, "GetSchemaTable");\r
                                columnInfo[i].Colname = sb.ToString();\r
                                columnsNames[columnInfo[i].Colname.ToUpper()] = i;\r
-\r
+                               \r
+                               strlen = 0;\r
                                sqlRet = DB2CLIWrapper.SQLColAttribute(hwndStmt, (short)(i + 1), (short)DB2Constants.SQL_DESC_CONCISE_TYPE, sb, (short)sb.Capacity, out strlen, out columnInfo[i].Sqltype);\r
                                DB2ClientUtils.DB2CheckReturn(sqlRet, DB2Constants.SQL_HANDLE_STMT, hwndStmt, "GetSchemaTable");\r
 \r
index 6f7047f15c02021fe96fad22b955d68d35ebe3f8..c1f6ac9253dbbf42c2ec47ca11c3658867390065 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 8347d9f2d30e364ccbf759bc3a71e7916c62dd52..714033a4eb11f7da0e3cfc9e8e6a781df19840a3 100644 (file)
@@ -1,6 +1,8 @@
 thisdir = class
 
-basic_SUBDIRS := corlib Mono.Security System System.XML System.Core 
+basic_SUBDIRS := corlib Mono.Security System System.XML System.Core
+
+pcl_facade_dirs := Facades
 
 # resgen is corlib specific so we need to wait until corlib is build
 # and build it just a step before first dll needs it
@@ -14,9 +16,11 @@ build_SUBDIRS :=  \
        Mono.Posix \
        System.Core \
        Mono.Cecil \
-       Mono.Cecil.Mdb
-
-pcl_facade_dirs := Facades
+       Mono.Cecil.Mdb \
+       System.ComponentModel.Composition.4.5 \
+       System.Numerics \
+       System.Xml.Linq \
+       $(pcl_facade_dirs)
 
 mobile_common_dirs := \
        corlib  \
@@ -51,9 +55,6 @@ mobile_common_dirs := \
        System.Xml.Serialization \
        Mono.CSharp     \
        Microsoft.CSharp \
-       Mono.Security.Providers.DotNet  \
-       Mono.Security.Providers.NewSystemSource \
-       Mono.Security.Providers.NewTls  \
        System.Runtime.InteropServices.RuntimeInformation       \
        System.Reflection.DispatchProxy \
        System.Xml.XPath.XmlDocument \
@@ -77,12 +78,13 @@ xammac_dirs := \
        $(mobile_dynamic_dirs)
 
 monodroid_dirs := \
-       $(mobile_dynamic_dirs)
+       $(mobile_dynamic_dirs) \
+       Mono.Btls.Interface
 
 monotouch_dirs := \
        $(mobile_static_dirs)
 
-monotouch_watch_dirs := $(monotouch_dirs)
+monotouch_watch_dirs := $(filter-out Mono.Security Mono.Data.Tds,$(monotouch_dirs))
 monotouch_tv_dirs   := $(monotouch_dirs)
 
 monotouch_runtime_dirs := \
@@ -93,7 +95,7 @@ monotouch_runtime_dirs := \
        System.XML \
        Mono.CSharp
 
-monotouch_watch_runtime_dirs := $(monotouch_runtime_dirs)
+monotouch_watch_runtime_dirs := $(filter-out Mono.Security Mono.Data.Tds,$(monotouch_runtime_dirs))
 monotouch_tv_runtime_dirs := $(monotouch_runtime_dirs)
 
 xammac_4_5_dirs := \
@@ -108,6 +110,7 @@ xammac_4_5_dirs := \
        System.ServiceModel.Internals   \
        SMDiagnostics   \
        System.Numerics \
+       System.Numerics.Vectors         \
        Mono.Data.Tds   \
        System.Transactions     \
        System.EnterpriseServices       \
@@ -139,10 +142,6 @@ xammac_4_5_dirs := \
        System.Data.Linq                \
        System.Net.Http \
        System.Net.Http.WebRequest \
-       Mono.Security.Providers.DotNet \
-       Mono.Security.Providers.OldTls \
-       Mono.Security.Providers.NewSystemSource \
-       Mono.Security.Providers.NewTls \
        System.Runtime.InteropServices.RuntimeInformation \
        System.Reflection.Context       \
        System.Net.Http.WinHttpHandler  \
@@ -231,8 +230,6 @@ net_4_x_dirs := \
        System.Web.Http \
        System.Web.Http.SelfHost \
        System.Web.Http.WebHost \
-       Mono.Security.Providers.NewSystemSource \
-       Mono.Security.Providers.NewTls \
        System.Runtime.InteropServices.RuntimeInformation
 
 # These are the subdirs which depends on libs in net_4_x_dirs
@@ -240,6 +237,7 @@ net_4_x_dirs := \
 net_4_x_parallel_dirs := \
        PEAPI                           \
        I18N                            \
+       Mono.Btls.Interface             \
        Mono.Http                       \
        Mono.Cairo                      \
        Mono.Cecil                      \
@@ -276,8 +274,6 @@ net_4_x_parallel_dirs := \
        System.ComponentModel.Composition.4.5 \
        System.Windows \
        System.Xml.Serialization \
-       Mono.Security.Providers.DotNet \
-       Mono.Security.Providers.OldTls \
        System.DirectoryServices.Protocols      \
        RabbitMQ.Client                 \
        Microsoft.VisualC               \
@@ -348,6 +344,7 @@ DISTFILES = \
        MicrosoftAjaxLibrary/License.htm        \
        test-helpers/NetworkHelpers.cs  \
        test-helpers/SocketResponder.cs \
+       lib/$(monolite_dir)/basic.exe   \
        $(monolite_files)
 
 .PHONY: all-local $(STD_TARGETS:=-local)
@@ -356,21 +353,40 @@ all-local $(STD_TARGETS:=-local):
 
 all-local-aot:
 
-# Files needed to bootstrap C# compiler
-basic_files = basic.exe mscorlib.dll System.dll System.Xml.dll Mono.Security.dll System.Core.dll System.Security.dll System.Configuration.dll
-monolite_files = $(basic_files:%=lib/monolite/%)
+monolite_dir := monolite
 
-lib/monolite:
+# Files needed to bootstrap C# compiler
+build_files = mscorlib.dll System.dll System.Xml.dll Mono.Security.dll System.Core.dll System.Security.dll System.Configuration.dll \
+       System.Numerics.dll System.Xml.Linq.dll \
+       Facades/System.Collections.Concurrent.dll Facades/System.Linq.dll Facades/System.Runtime.dll Facades/System.Collections.dll     \
+       Facades/System.Reflection.Extensions.dll Facades/System.Text.Encoding.Extensions.dll Facades/System.Diagnostics.Debug.dll \
+       Facades/System.Reflection.Primitives.dll Facades/System.Text.Encoding.dll Facades/System.Diagnostics.Tools.dll Facades/System.Reflection.dll \
+       Facades/System.Threading.Tasks.Parallel.dll Facades/System.Dynamic.Runtime.dll Facades/System.Resources.ResourceManager.dll \
+       Facades/System.Threading.Tasks.dll Facades/System.Globalization.dll Facades/System.Runtime.Extensions.dll Facades/System.Threading.dll \
+       Facades/System.IO.dll Facades/System.Runtime.InteropServices.dll Facades/System.Xml.ReaderWriter.dll Facades/System.Linq.Expressions.dll \
+       Facades/System.Runtime.Numerics.dll Facades/System.Xml.XDocument.dll
+
+monolite_files = $(build_files:%=lib/$(monolite_dir)/%)
+
+lib/$(monolite_dir):
+lib/$(monolite_dir)/Facades:
        $(MKINSTALLDIRS) $@
 
-$(monolite_files): | lib/monolite
-$(monolite_files): lib/monolite/%: lib/basic/%
+$(monolite_files): | lib/$(monolite_dir)
+$(monolite_files): | lib/$(monolite_dir)/Facades
+$(monolite_files): lib/$(monolite_dir)/%: lib/build/%
        cp -p $< $@
 
-$(basic_files:%=lib/basic/%):
-       cd $(topdir) && $(MAKE) profile-do--basic--all NO_DIR_CHECK=1 SKIP_AOT=1
+lib/$(monolite_dir)/basic.exe:
+       cp -p lib/basic/basic.exe lib/$(monolite_dir)
+
+$(build_files:%=lib/build/%):
+       cd $(topdir) && $(MAKE) profile-do--build--all NO_DIR_CHECK=1 SKIP_AOT=1
+
+dist-monolite: $(monolite_files) lib/$(monolite_dir)/basic.exe
+
+dist-default: dist-monolite
 
-dist-default: $(monolite_files)
 dist-local: dist-default
 
 csproj-local:
index bfa54497303dd9f053607961cff2b346d3bd9914..887bc47e19e6fedb2d06eb6df82549e2057181ff 100644 (file)
@@ -1 +1,2 @@
 /Test/resources/*.proj
+Test/test-config-file-*
index 9aed81206542d94d4976f0974107b89d405a8e89..9acd2e184d4f86e78a2d743390492616e53a54b8 100644 (file)
@@ -12,6 +12,7 @@ LIB_MCS_FLAGS =
 
 TEST_MCS_FLAGS =
 TEST_LIB_REFS = $(XBUILD_FRAMEWORK) $(XBUILD_UTILITIES) $(PARENT_PROFILE)System.Xml
+TEST_NUNITLITE_APP_CONFIG_RUNTIME=Test/test-config-file-$(PROFILE)
 
 EXTRA_DISTFILES = \
        Test/resources/TestTasks.cs             \
index f663120bf798730223c944db359caa7873771dc5..82af83b15232988b1fd1d50b1b18e80d2bc09536 100644 (file)
@@ -226,6 +226,14 @@ namespace Microsoft.Build.BuildEngine {
                public void SetMetadata (string metadataName,
                                         string metadataValue,
                                         bool treatMetadataValueAsLiteral)
+               {
+                       SetMetadata (metadataName, metadataValue, treatMetadataValueAsLiteral, false);
+               }
+
+               void SetMetadata (string metadataName,
+                                        string metadataValue,
+                                        bool treatMetadataValueAsLiteral,
+                                        bool fromDynamicItem)
                {
                        if (metadataName == null)
                                throw new ArgumentNullException ("metadataName");
@@ -251,9 +259,11 @@ namespace Microsoft.Build.BuildEngine {
                        } else if (HasParentItem) {
                                if (parent_item.child_items.Count > 1)
                                        SplitParentItem ();
-                               parent_item.SetMetadata (metadataName, metadataValue, treatMetadataValueAsLiteral);
+                               parent_item.SetMetadata (metadataName, metadataValue, treatMetadataValueAsLiteral, fromDynamicItem);
                        }
-                       if (FromXml || HasParentItem) {
+
+                       // We don't want to reevalute the project for dynamic items
+                       if (!fromDynamicItem && !IsDynamic && (FromXml || HasParentItem)) {
                                parent_item_group.ParentProject.MarkProjectAsDirty ();
                                parent_item_group.ParentProject.NeedToReevaluate ();
                        }
@@ -374,7 +384,7 @@ namespace Microsoft.Build.BuildEngine {
                                        continue;
                                
                                foreach (string name in evaluatedMetadata.Keys) {
-                                       item.SetMetadata (name, (string)evaluatedMetadata [name]);
+                                       item.SetMetadata (name, (string)evaluatedMetadata [name], false, IsDynamic);
                                }
 
                                AddAndRemoveMetadata (project, item);
index 33aad3dea63adebda939e6604a84411ba36560dc..b4ed8562382595c92f99c2b474a5c9ecc4043757 100644 (file)
@@ -374,10 +374,8 @@ namespace Microsoft.Build.BuildEngine {
                                return false;
 
                        ITaskItem[] outputs;
-                       if (ParentEngine.BuiltTargetsOutputByName.TryGetValue (key, out outputs)) {
-                               if (targetOutputs != null)
-                                       targetOutputs.Add (target_name, outputs);
-                       }
+                       if (targetOutputs != null && ParentEngine.BuiltTargetsOutputByName.TryGetValue (key, out outputs))
+                               targetOutputs [target_name] = outputs;
                        return true;
                }
 
index 652aab45f53431245fbb367815ea1c81734aee21..561ece2a3d31bed76f62e44120dc40827a8d46b8 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 1a4e4317421d460b5a13cc638b1514cddf5db232..2398184df6d706fb5fc9aefc0d9bfb3f4c8c4666 100644 (file)
@@ -24,6 +24,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 using System;
+using System.IO;
 using Microsoft.Build.BuildEngine;
 using NUnit.Framework;
 
@@ -61,6 +62,11 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
                                </Project>
                        ";
 
+                       if (Path.DirectorySeparatorChar == '\\') {
+                               documentString = documentString.Replace ("/home", "c:/home");
+                               documentString = documentString.Replace ("/tmp", "c:/tmp");
+                       }
+
                        var engine = new Engine (Consts.BinPath);
                        var project = engine.CreateNewProject ();
                        project.LoadXml (documentString);
index 6c7919e6ae7db4d7c36cc02ad79cc4ceebc10ab3..d36ae158701c0db1fa8a9243e154b77e399d63bd 100644 (file)
@@ -40,6 +40,7 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
        [TestFixture]
        public class TargetTest {
                
+               static bool isMono = Type.GetType ("Mono.Runtime", false) != null;
                Engine                  engine;
                Project                 project;
                
@@ -284,6 +285,51 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
                        t [0].RemoveTask (null);
                }
 
+               [Test]
+               public void TestRunTargetTwice ()
+               {
+                       string documentString = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
+                       <Target Name=""Foo"">
+                               <Message Text=""Foo ran""/>
+                       </Target>
+                       <Target Name=""Main"">
+                               <MSBuild Projects=""$(MSBuildProjectFile)"" Targets=""Foo;Foo"" />
+                       </Target>
+
+               </Project>";
+
+                       var filepath = Path.GetTempFileName ();
+                       try {
+                               File.WriteAllText (filepath, documentString);
+
+                               var engine = new Engine (Consts.BinPath);
+                               var project = engine.CreateNewProject ();
+                               project.Load (filepath);
+
+                               var logger = new TestMessageLogger ();
+                               engine.RegisterLogger (logger);
+
+                               var result = project.Build ("Main");
+                               if (!result) {
+                                       logger.DumpMessages ();
+                                       Assert.Fail ("Build failed, see the logs");
+                               }
+
+                               Assert.AreEqual(1, logger.NormalMessageCount, "Expected number of messages");
+                               logger.CheckLoggedMessageHead ("Foo ran", "A1");
+
+                               Assert.AreEqual(0, logger.NormalMessageCount, "Extra messages found");
+                               Assert.AreEqual(0, logger.WarningMessageCount, "Extra warning messages found");
+
+                               Assert.AreEqual(2, logger.TargetStarted, "TargetStarted count");
+                               Assert.AreEqual(2, logger.TargetFinished, "TargetFinished count");
+
+                               Assert.IsTrue (result);
+                       } finally {
+                               File.Delete (filepath);
+                       }
+               }
+
                [Test]
                public void TestTargetOutputs1 ()
                {
@@ -351,16 +397,16 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
 
                bool Build (string projectXml, ILogger logger)
                {
-                       if (Environment.OSVersion.Platform == PlatformID.Win32NT) {
+                       if (!isMono) {
                                var reader = new StringReader (projectXml);
                                var xml = XmlReader.Create (reader);
-                               return BuildOnWindows (xml, logger);
+                               return BuildOnDotNet (xml, logger);
                        } else {
-                               return BuildOnLinux (projectXml, logger);
+                               return BuildOnMono (projectXml, logger);
                        }
                }
 
-               bool BuildOnWindows (XmlReader reader, ILogger logger)
+               bool BuildOnDotNet (XmlReader reader, ILogger logger)
                {
                        var type = Type.GetType ("Microsoft.Build.Evaluation.ProjectCollection, Microsoft.Build, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a");
 
@@ -376,7 +422,7 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
                        return ret;
                }
 
-               bool BuildOnLinux (string projectXml, ILogger logger)
+               bool BuildOnMono (string projectXml, ILogger logger)
                {
                        var engine = new Engine (Consts.BinPath);
                        var project = engine.CreateNewProject ();
@@ -697,6 +743,33 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
                                </Project>", "D");
                }
 
+               [Test]
+               public void ItemGroupInsideTarget_UpdateMetadata ()
+               {
+                       ItemGroupInsideTarget (
+                               @"<Project ToolsVersion=""4.0"" xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
+                                       <ItemGroup>
+                                               <ProjectReference Include='xyz'/>
+                                       </ItemGroup>
+
+                                       <Target Name='Main' DependsOnTargets='CreateBar'>
+                                               <Message Text='Before: $(Bar)'/>
+                                               <ItemGroup>
+                                                       <ProjectReference>
+                                                               <AdditionalProperties>A=b</AdditionalProperties>
+                                                       </ProjectReference>
+                                               </ItemGroup>
+                                               <Message Text='After: $(Bar)'/>
+                                       </Target>
+
+                                       <Target Name='CreateBar'>
+                                               <PropertyGroup>
+                                                       <Bar>Bar01</Bar>
+                                               </PropertyGroup>
+                                       </Target>
+                               </Project>", 2, "Before: Bar01", "After: Bar01");
+               }
+
                [Test]
                public void ItemGroupInsideTarget_Batching ()
                {
index 54f1c8a94cc2c935c49a573869ba9799aa6568df..144a6d72ea2e134bcfd4cdd96369be9b377fc66c 100644 (file)
@@ -129,6 +129,7 @@ namespace MonoTests.Microsoft.Build.BuildEngine.Various {
                }
 
                [Test]
+               [SetCulture ("en-us")]
                public void AllowedFrameworkMembers ()
                {
                        string documentString = @"
@@ -202,6 +203,7 @@ namespace MonoTests.Microsoft.Build.BuildEngine.Various {
                }
 
                [Test]
+               [SetCulture ("en-us")]
                public void MSBuildPropertyFunctions ()
                {
                        string documentString = @"
diff --git a/mcs/class/Microsoft.Build.Framework/.gitignore b/mcs/class/Microsoft.Build.Framework/.gitignore
new file mode 100644 (file)
index 0000000..c8cb717
--- /dev/null
@@ -0,0 +1 @@
+Test/test-config-file-*
index f31f5a5835ea5f0b8f33c7bdfc059a0490a3e8e9..edd7cc2e8eb7477e19cadd28edf7e759084d932b 100644 (file)
@@ -10,6 +10,8 @@ LIBRARY = Microsoft.Build.Framework.dll
 LIB_REFS = $(PARENT_PROFILE)System
 LIB_MCS_FLAGS =
 
+TEST_NUNITLITE_APP_CONFIG_RUNTIME=Test/test-config-file-$(PROFILE)
+
 EXTRA_DISTFILES = \
        Mono.XBuild.Framework/AssemblyLoadInfo.cs
 
index ad57c7d514e57e4c05ea4c58c2535ef61eb95b60..d79f429e9a55c79ccb2e4dd507260c64ad827f04 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index bfa54497303dd9f053607961cff2b346d3bd9914..887bc47e19e6fedb2d06eb6df82549e2057181ff 100644 (file)
@@ -1 +1,2 @@
 /Test/resources/*.proj
+Test/test-config-file-*
index d451c754e74471c627da9bbd3e6ffd86fd871a90..a919129b083e53916526a0ea1316dc6f313f5771 100644 (file)
@@ -15,6 +15,8 @@ LIB_REFS = $(PARENT_PROFILE)System $(PARENT_PROFILE)System.Core $(PARENT_PROFILE
 TEST_MCS_FLAGS =
 TEST_LIB_REFS = $(PARENT_PROFILE)System.Xml $(XBUILD_ENGINE) $(XBUILD_FRAMEWORK) $(XBUILD_TASKS) $(XBUILD_UTILITIES) $(PARENT_PROFILE)System.Core
 
+TEST_NUNITLITE_APP_CONFIG_RUNTIME=Test/test-config-file-$(PROFILE)
+
 ifeq (4, $(FRAMEWORK_VERSION_MAJOR))
 TEST_LIB_REFS += Microsoft.Build
 endif
@@ -23,8 +25,7 @@ EXTRA_DISTFILES = \
        Test/resources/test.cs \
        Test/resources/Sample.cs \
        Test/resources/Sample.vb \
-       Test/resources/junk.txt \
-       Test/test-config-file*
+       Test/resources/junk.txt
 
 Test/resources/test.dll: Test/resources/test.cs
        $(CSCOMPILE) -target:library /out:$@ $<
index d051dbefb947465da844bc655be2a7017172f4dd..3e09d9948ddde8321df983181125d8285081e1f4 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index cf56b148f117e2427363568d8a2be911ea64e807..ae6d75bf406fd3dfe9260b5a16feb4c4d3ead083 100644 (file)
@@ -153,7 +153,10 @@ namespace Microsoft.Build.Tasks {
                {
                        if (!string.IsNullOrEmpty (ToolPath))
                                return Path.Combine (ToolPath, ToolExe);
-                       return ToolLocationHelper.GetPathToDotNetFrameworkFile (ToolExe, TargetDotNetFrameworkVersion.VersionLatest);
+                       var possibleToolPath = ToolLocationHelper.GetPathToDotNetFrameworkFile (ToolExe, TargetDotNetFrameworkVersion.VersionLatest);
+                       if (!string.IsNullOrEmpty(possibleToolPath))
+                               return  possibleToolPath;
+                       return ToolLocationHelper.GetPathToDotNetFrameworkBinFile(ToolExe); 
                }
                
                [MonoTODO]
index 43917b03e340b8917fac8248808ced3b00b13c5c..19649dadf86b904503eeaa8835d2a4dcca5fa1c9 100755 (executable)
@@ -158,11 +158,11 @@ namespace MonoTests.Microsoft.Build.Tasks
                        Assert.AreEqual(files.Length, include.Count, id + "2");
 
                        for (int i = 0; i < files.Length; i++) {
-                               Assert.AreEqual (files [i], include [i].FinalItemSpec, id + "3, file #" + i);
+                               Assert.AreEqual (files [i], include [i].FinalItemSpec.Replace ("\\", "/"), id + "3, file #" + i);
                                Assert.IsTrue (include[i].HasMetadata ("TargetPath"), id + "4, file #" + i + ", TargetPath metadata missing");
                                Assert.AreEqual (assignedFiles [i], include[i].GetMetadata("TargetPath"), id + "5, file #" + i);
                                Assert.IsTrue (include [i].HasMetadata ("Child"), id + "6, file #" + i + ", Child metadata missing");
-                               Assert.AreEqual ("C" + files [i], include [i].GetMetadata ("Child"), id + "7, file #" + i + ", Child metadata value incorrect");
+                               Assert.AreEqual ("C" + files [i], include [i].GetMetadata ("Child").Replace ("\\", "/"), id + "7, file #" + i + ", Child metadata value incorrect");
                        }
                }
 
index ad7ca03ba5a6ebb9b3fcb611f695492d0a673a3e..dab6adaf7a3aac4ff02f42ee0c16ca3f43590a5f 100644 (file)
@@ -301,7 +301,11 @@ namespace MonoTests.Microsoft.Build.Tasks {
                                Assert.Fail ("Build failed");
                        }
                        Assert.IsTrue (File.Exists (target_file), "A2");
-                       Assert.AreEqual (FileAttributes.Normal, File.GetAttributes (target_file), "A3");                                        
+                       if (Environment.OSVersion.Platform == PlatformID.Unix)
+                               Assert.AreEqual (FileAttributes.Normal, File.GetAttributes (target_file), "A3");
+                       else
+                               // On Windows the Archive attribute will be set, not the Normal attribute.
+                               Assert.AreEqual (FileAttributes.Archive, File.GetAttributes (target_file), "A3");
                }
 
                [Test]
@@ -349,7 +353,12 @@ namespace MonoTests.Microsoft.Build.Tasks {
                                Assert.Fail ("Build failed " + sb.ToString ());
                        }
                        Assert.IsTrue (File.Exists (target_file), "A2");
-                       Assert.AreEqual (FileAttributes.Normal, File.GetAttributes (target_file), "A3");                                        
+                       var target_file_attrs = File.GetAttributes (target_file);
+                       if (Environment.OSVersion.Platform == PlatformID.Unix)
+                               Assert.AreEqual (FileAttributes.Normal, File.GetAttributes (target_file), "A3");
+                       else
+                               // On Windows the Archive attribute will be set, not the Normal attribute.
+                               Assert.AreEqual (FileAttributes.Archive, File.GetAttributes (target_file), "A3");
                }
 
                [Test]
index 3342c003e8bf890d8df77900cb32aee9f6d3eb0f..41c8d8e4f103a7bebdd6737de846e8f57b4654c4 100755 (executable)
@@ -115,6 +115,9 @@ namespace MonoTests.Microsoft.Build.Tasks {
                [Test]
                public void TestLineWithEscapedQuote ()
                {
+                       if (Environment.OSVersion.Platform != PlatformID.Unix) {
+                               Assert.Ignore ("Throws \"Illegal characters in path\" on Windows since \" is not a legal Windows path character");
+                       }
                        string[] lines = new string[] { "%22abc test%22 123 %22def%22" };
                        CreateProjectAndCheck (full_filepath, lines, false, true, delegate () {
                                CheckFileExists (full_filepath, true);
diff --git a/mcs/class/Microsoft.Build.Tasks/Test/test-config-file-net-4.0 b/mcs/class/Microsoft.Build.Tasks/Test/test-config-file-net-4.0
deleted file mode 100644 (file)
index 3c78f3b..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version ="1.0"?>
-<configuration>
-    <runtime>
-        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
-            <dependentAssembly>
-                <assemblyIdentity name="Microsoft.Build.Framework" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
-                <bindingRedirect oldVersion="0.0.0.0-99.9.9.9" newVersion="4.0.0.0"/>
-            </dependentAssembly>
-            <dependentAssembly>
-                <assemblyIdentity name="Microsoft.Build.Engine" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
-                <bindingRedirect oldVersion="0.0.0.0-99.9.9.9" newVersion="4.0.0.0"/>
-            </dependentAssembly>
-        </assemblyBinding>
-    </runtime>
-</configuration>
diff --git a/mcs/class/Microsoft.Build.Utilities/.gitignore b/mcs/class/Microsoft.Build.Utilities/.gitignore
new file mode 100644 (file)
index 0000000..c8cb717
--- /dev/null
@@ -0,0 +1 @@
+Test/test-config-file-*
index 10ef6780d4af6caf04ee40b279df2c40a3915ad6..2c644346e2c34c2c75740bf4afe1b75e8a88ec8c 100644 (file)
@@ -15,6 +15,7 @@ TEST_RESX_RESOURCES = Test/Microsoft.Build.Utilities/Strings.resources
 
 TEST_LIB_REFS = $(XBUILD_ENGINE) $(XBUILD_FRAMEWORK) $(PARENT_PROFILE)System $(PARENT_PROFILE)System.Core
 TEST_MCS_FLAGS = $(TEST_RESX_RESOURCES:%=-resource:%)
+TEST_NUNITLITE_APP_CONFIG_RUNTIME=Test/test-config-file-$(PROFILE)
 
 include $(XBUILD_DIR)/xbuild_test.make
 include ../../build/library.make
index 1e5e1913b4342c0b271bca55f4a260bff1a4288f..bc6b36a67abdfdbc2ad97a9e95adf70dd1ef71d2 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index bc686cf9c839b693f7644e676abd2e75019cdb96..07547b0fc205a26531398ebc34e43439b95ec841 100644 (file)
@@ -6,3 +6,4 @@ bin/
 Microsoft.Build.Internal/ExpressionParser.cs
 Microsoft.Build.Internal/y.output
 Test/FunctionalTestProject*.csproj
+Test/test-config-file-*
index 933782ff268b64d48a5d746d2223c93ffee7d39c..47e9cf9ad41454df2b1fd684577509b0d82cc6b6 100644 (file)
@@ -10,9 +10,10 @@ LIBRARY = Microsoft.Build.dll
 LIB_REFS = $(PARENT_PROFILE)System $(PARENT_PROFILE)System.Core $(PARENT_PROFILE)System.Xml Microsoft.Build.Engine Microsoft.Build.Framework
 LIB_MCS_FLAGS = \
        /d:MICROSOFT_BUILD_DLL
-       
+
 TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
 TEST_LIB_REFS = $(XBUILD_UTILITIES)
+TEST_NUNITLITE_APP_CONFIG_RUNTIME=Test/test-config-file-$(PROFILE)
 
 EXTRA_DISTFILES = \
        Microsoft.Build.Internal/ExpressionParser.jay   \
index 24dd6dd3751303edd192404062260cb9e7a61500..372afa7f5c578c8a1da9b1088db303b208f25318 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;MICROSOFT_BUILD_DLL</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;MICROSOFT_BUILD_DLL</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;MICROSOFT_BUILD_DLL</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;MICROSOFT_BUILD_DLL</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 322006a4e849fadd25b24ad978fb62530d9fe27e..135734fb03064cb7c699bdb5d5281abc22897e7f 100644 (file)
@@ -80,6 +80,9 @@ namespace Microsoft.Build.Internal
                                        if (!queued_builds.TryDequeue (out build))
                                                continue;
                                        StartOneBuild (build);
+                               } catch (ThreadAbortException) {
+                                       // do nothing
+                                       break;
                                } catch (Exception ex) {
                                        // FIXME: I guess INodeLogger should be used instead.
                                        Console.Error.WriteLine ("Uncaught build node exception occured");
index 7b65749c86afd94b360d4eb80d6e619590998359..28c4af1277abbcb7a31cdd66a5310bc2b315498b 100644 (file)
@@ -1,3 +1,4 @@
+../../test-helpers/NunitHelpers.cs
 FunctionalTest.cs
 Microsoft.Build.Construction/ProjectItemElementTest.cs
 Microsoft.Build.Construction/ProjectRootElementTest.cs
index e864f4dfb3923773798acbc766d35e5c8c1376e5..2fbb9f18587853bd786d5125f7e73cd2a2a68e7f 100644 (file)
@@ -58,11 +58,9 @@ namespace MonoTests.Microsoft.Build.Construction
                                ProjectRootElement.Create (XmlReader.Create (new StringReader (" <root/>")));
                                Assert.Fail ("should throw InvalidProjectFileException");
                        } catch (InvalidProjectFileException ex) {
-                               #if NET_4_5
                                Assert.AreEqual (1, ex.LineNumber, "#1");
                                // it is very interesting, but unlike XmlReader.LinePosition it returns the position for '<'.
                                Assert.AreEqual (2, ex.ColumnNumber, "#2");
-                               #endif
                        }
                }
 
@@ -102,11 +100,9 @@ namespace MonoTests.Microsoft.Build.Construction
                                ProjectRootElement.Create (xml);
                                Assert.Fail ("should throw InvalidProjectFileException");
                        } catch (InvalidProjectFileException ex) {
-                               #if NET_4_5
                                Assert.AreEqual (1, ex.LineNumber, "#1");
                                // unlike unexpected element case which returned the position for '<', it does return the name start char...
                                Assert.AreEqual (70, ex.ColumnNumber, "#2");
-                               #endif
                        }
                }
 
index 970240fa74bda41ddb4db3b1b399e5d0e5c79211..700a41663d3b77777c48d5fc8408383a625bab50 100644 (file)
@@ -44,9 +44,7 @@ namespace MonoTests.Microsoft.Build.Evaluation
                {
                        var g = ProjectCollection.GlobalProjectCollection;
                        Assert.AreEqual (0, g.GlobalProperties.Count, "#1");
-                       #if NET_4_5
                        Assert.IsTrue (g.GlobalProperties.IsReadOnly, "#2");
-                       #endif
                }
                
                [Test]
index 61973b7ceb48f80a4f2b7c64eac02b7f11934e25..f3b3524ba81277d944e710e63f7c0760c31786ba 100644 (file)
@@ -90,7 +90,7 @@ namespace MonoTests.Microsoft.Build.Evaluation
                {
                        string project_xml = @"<Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>
   <ItemGroup>
-    <Foo Include='Test/ProjectItemTestTemporary/parent/dir*/a*.cs;Test/ProjectItemTestTemporary/x.cs' />
+    <Foo Include='" + "Test/ProjectItemTestTemporary/parent/dir*/a*.cs;Test/ProjectItemTestTemporary/x.cs".Replace ('/', Path.DirectorySeparatorChar) + @"' />
   </ItemGroup>
 </Project>";
                        try {
@@ -106,7 +106,7 @@ namespace MonoTests.Microsoft.Build.Evaluation
                {
                        string project_xml = @"<Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>
   <ItemGroup>
-    <Foo Include='Test/ProjectItemTestTemporary/parent/**/a*.cs;Test/ProjectItemTestTemporary/x.cs' />
+    <Foo Include='" + "Test/ProjectItemTestTemporary/parent/**/a*.cs;Test/ProjectItemTestTemporary/x.cs".Replace ('/', Path.DirectorySeparatorChar) + @"' />
   </ItemGroup>
 </Project>";
                        try {
@@ -127,23 +127,23 @@ namespace MonoTests.Microsoft.Build.Evaluation
                        // sort is needed because they are only sorted by ItemType.
                        var items = proj.Items.OrderBy (p => p.EvaluatedInclude).ToArray ();
                        Assert.AreEqual (5, items.Length, "#1");
-                       Assert.AreEqual (string.Format ("Test/ProjectItemTestTemporary/parent/dir1{0}a.cs", Path.DirectorySeparatorChar), items [0].EvaluatedInclude, "#2");
+                       Assert.AreEqual ("Test/ProjectItemTestTemporary/parent/dir1/a.cs", items [0].EvaluatedInclude.Replace (Path.DirectorySeparatorChar, '/'), "#2");
                        Assert.AreEqual ("a", items [0].GetMetadataValue ("Filename"), "#3");
                        if (hasRecursiveDir)
                                Assert.AreEqual ("dir1" + sep, items [0].GetMetadataValue ("RecursiveDir"), "#3.2");
-                       Assert.AreEqual (string.Format ("Test/ProjectItemTestTemporary/parent/dir1{0}a1.cs", Path.DirectorySeparatorChar), items [1].EvaluatedInclude, "#4");
+                       Assert.AreEqual ("Test/ProjectItemTestTemporary/parent/dir1/a1.cs", items [1].EvaluatedInclude.Replace (Path.DirectorySeparatorChar, '/'), "#4");
                        Assert.AreEqual ("a1", items [1].GetMetadataValue ("Filename"), "#5");
                        if (hasRecursiveDir)
                                Assert.AreEqual ("dir1" + sep, items [1].GetMetadataValue ("RecursiveDir"), "#5.2");
-                       Assert.AreEqual (string.Format ("Test/ProjectItemTestTemporary/parent/dir2{0}a.cs", Path.DirectorySeparatorChar), items [2].EvaluatedInclude, "#6");
+                       Assert.AreEqual ("Test/ProjectItemTestTemporary/parent/dir2/a.cs", items [2].EvaluatedInclude.Replace (Path.DirectorySeparatorChar, '/'), "#6");
                        Assert.AreEqual ("a", items [2].GetMetadataValue ("Filename"), "#7");
                        if (hasRecursiveDir)
                                Assert.AreEqual ("dir2" + sep, items [2].GetMetadataValue ("RecursiveDir"), "#7.2");
-                       Assert.AreEqual (string.Format ("Test/ProjectItemTestTemporary/parent/dir2{0}a2.cs", Path.DirectorySeparatorChar), items [3].EvaluatedInclude, "#8");
+                       Assert.AreEqual ("Test/ProjectItemTestTemporary/parent/dir2/a2.cs", items [3].EvaluatedInclude.Replace (Path.DirectorySeparatorChar, '/'), "#8");
                        Assert.AreEqual ("a2", items [3].GetMetadataValue ("Filename"), "#9");
                        if (hasRecursiveDir)
                                Assert.AreEqual ("dir2" + sep, items [3].GetMetadataValue ("RecursiveDir"), "#9.2");
-                       Assert.AreEqual ("Test/ProjectItemTestTemporary/x.cs", items [4].EvaluatedInclude, "#10");
+                       Assert.AreEqual ("Test/ProjectItemTestTemporary/x.cs", items [4].EvaluatedInclude.Replace (Path.DirectorySeparatorChar, '/'), "#10");
                        for (int i = 0; i < items.Length; i++)
                                Assert.AreEqual (xitem, items [i].Xml, "#11:" + i);
                }
index ac4e2d6610e7805edaebaaf6000e334b0f9b5c29..81392010d79782990e53bb98b5c5c385ff2a5479 100644 (file)
@@ -40,11 +40,9 @@ namespace MonoTests.Microsoft.Build.Evaluation
                        var ts = new Toolset ("4.3", "c:\\", ProjectCollection.GlobalProjectCollection, null);
                        Assert.IsNotNull (ts.Properties, "#1");
                        Assert.AreEqual (0, ts.Properties.Count, "#2");
-#if NET_4_5
                        Assert.IsNull (ts.DefaultSubToolsetVersion, "#3");
                        Assert.IsNotNull (ts.SubToolsets, "#4");
                        Assert.AreEqual (0, ts.SubToolsets.Count, "#5");
-#endif
                        Assert.AreEqual ("c:\\", ts.ToolsPath, "#6");
                        Assert.AreEqual ("4.3", ts.ToolsVersion, "#7");
                }
index 9723191bf164f6643724dcc990d59e609bf35003..f14bcd864ac75839762a8220b18f9fb9090fc187 100644 (file)
@@ -108,7 +108,8 @@ namespace MonoTests.Microsoft.Build.Execution
                        Assert.IsTrue (sub.BuildResult.OverallResult == BuildResultCode.Success, "#1");
                        DateTime endBuildDone = DateTime.Now;
                        Assert.IsTrue (endBuildDone - beforeExec >= TimeSpan.FromSeconds (1), "#2");
-                       Assert.IsTrue (endBuildDone > waitDone, "#3");
+                       Assert.IsTrue (waitDone >= beforeExec, "#3");
+                       Assert.IsTrue (endBuildDone >= waitDone, "#4");
                }
                
                [Test]
index ce13ce36469c04301533b099a8b023bbaff34683..5b24db55b27dc3247f7a1a9b5f726f1962efba82 100644 (file)
@@ -143,9 +143,7 @@ namespace MonoTests.Microsoft.Build.Execution
                        var root = ProjectRootElement.Create (xml);
                        root.FullPath = "ProjectInstanceTest.DependsOnTargets.proj";
                        var proj = new ProjectInstance (root);
-#if NET_4_5
                        Assert.AreEqual (2, proj.Targets.Count, "#1");
-#endif
                        Assert.IsFalse (proj.Build ("Bar", new ILogger [0]), "#2");
                }
                
index c94bef7d695da5454c2c73592fe838d51f7ebd0d..1663f71c682d768de1712ba13fa76f77e32c47d3 100644 (file)
@@ -42,7 +42,6 @@ namespace MonoTests.Microsoft.Build.Execution
        [TestFixture]
        public class ProjectTaskInstanceTest
        {
-#if NET_4_5
                [Test]
                public void OutputPropertyExists ()
                {
@@ -78,7 +77,6 @@ namespace MonoTests.Microsoft.Build.Execution
                        Assert.AreEqual (string.Empty, foo.Outputs, "#6");
                        Assert.AreEqual ("True", proj.GetPropertyValue ("C"), "#7");
                }
-#endif
        }
 }
 
index 4b2bc7d98a77bfc48a27217a80408c71ab94ffbe..74a38e30ef22d225913d48b85867e4d95abe92be 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 9c466c5ed9c9875b31f69f0f0ec9654075f3ac37..d03145e0df346c783650a15ff080a963e4ddcbda 100644 (file)
@@ -93,7 +93,8 @@ namespace Microsoft.CSharp.RuntimeBinder
                                module.SetDeclaringAssembly (temp);
 
                                var importer = new Compiler.ReflectionImporter (module, cc.BuiltinTypes) {
-                                       IgnorePrivateMembers = false
+                                       IgnorePrivateMembers = false,
+                                       IgnoreCompilerGeneratedField = false
                                };
 
                                // Import all currently loaded assemblies
index 8fe58e637bdc6d3f943942127a89a8afa7c899d0..076bf42e56dd59700858ea4026fbfe59f2eaf104 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index e68b8bf4ab61403e253de8e4cd805fcebe1ee00b..8bfd05df65c2c6e9274a96fb1aa67a94a99d953f 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
diff --git a/mcs/class/Mono.Btls.Interface/Makefile b/mcs/class/Mono.Btls.Interface/Makefile
new file mode 100644 (file)
index 0000000..aa5b54c
--- /dev/null
@@ -0,0 +1,19 @@
+thisdir = class/Mono.Btls.Interface
+SUBDIRS = 
+include ../../build/rules.make
+
+LIBRARY = Mono.Btls.Interface.dll
+LIB_REFS = System Mono.Security
+LIB_MCS_FLAGS = -unsafe -nowarn:1030 -keyfile:../mono.pub -delaysign -d:SECURITY_DEP
+
+ifndef HAVE_BTLS
+NO_INSTALL = yes
+NO_SIGN_ASSEMBLY = yes
+NO_TEST = yes
+NO_BUILD = yes
+endif
+
+include ../../build/library.make
+
+$(the_lib): ../Mono.Security/Makefile
+
diff --git a/mcs/class/Mono.Btls.Interface/Mono.Btls.Interface-net_4_x.csproj b/mcs/class/Mono.Btls.Interface/Mono.Btls.Interface-net_4_x.csproj
new file mode 100644 (file)
index 0000000..b141a55
--- /dev/null
@@ -0,0 +1,118 @@
+<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
+  <PropertyGroup>\r
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>\r
+    <ProductVersion>9.0.30729</ProductVersion>\r
+    <SchemaVersion>2.0</SchemaVersion>\r
+    <ProjectGuid>{BF32D586-8FBB-4A2A-A734-AA17CDAB283F}</ProjectGuid>\r
+    <OutputType>Library</OutputType>\r
+    <NoWarn>1699,1030</NoWarn>\r
+    <OutputPath>./../../class/lib/net_4_x</OutputPath>\r
+    <IntermediateOutputPath>obj-net_4_x</IntermediateOutputPath>\r
+    <GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>\r
+    <NoStdLib>True</NoStdLib>\r
+    \r
+    <NoConfig>True</NoConfig>\r
+    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>\r
+    <AppDesignerFolder>Properties</AppDesignerFolder>\r
+    <RootNamespace>\r
+    </RootNamespace>\r
+    <AssemblyName>Mono.Btls.Interface</AssemblyName>\r
+    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
+    <FileAlignment>512</FileAlignment>\r
+  </PropertyGroup>\r
+    <PropertyGroup>\r
+    <SignAssembly>true</SignAssembly>\r
+    <DelaySign>true</DelaySign>\r
+  </PropertyGroup>\r
+  <PropertyGroup>\r
+    <AssemblyOriginatorKeyFile>../mono.pub</AssemblyOriginatorKeyFile>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
+    <DebugSymbols>true</DebugSymbols>\r
+    <DebugType>full</DebugType>\r
+    <NoWarn>1699,1030</NoWarn>\r
+    <Optimize>false</Optimize>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;SECURITY_DEP</DefineConstants>\r
+    <ErrorReport>prompt</ErrorReport>\r
+    <WarningLevel>4</WarningLevel>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">\r
+    <DebugType>pdbonly</DebugType>\r
+    <NoWarn>1699,1030</NoWarn>\r
+    <Optimize>true</Optimize>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;SECURITY_DEP</DefineConstants>\r
+    <ErrorReport>prompt</ErrorReport>\r
+    <WarningLevel>4</WarningLevel>\r
+  </PropertyGroup>\r
+  <!-- Set AddAdditionalExplicitAssemblyReferences to false, otherwise if targetting .NET4.0, \r
+  Microsoft.NETFramework.props will force a dependency on the assembly System.Core. This\r
+  is a problem to compile the Mono mscorlib.dll -->\r
+  <PropertyGroup>\r
+    <AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>\r
+  </PropertyGroup>\r
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />\r
+  <ItemGroup>\r
+    <Compile Include="..\..\build\common\Consts.cs" />\r
+    <Compile Include="..\..\build\common\Locale.cs" />\r
+    <Compile Include="..\..\build\common\MonoTODOAttribute.cs" />\r
+    <Compile Include=".\Properties\AssemblyInfo.cs" />\r
+    <Compile Include="Mono.Btls.Interface\BtlsObject.cs" />\r
+    <Compile Include="Mono.Btls.Interface\BtlsProvider.cs" />\r
+    <Compile Include="Mono.Btls.Interface\BtlsX509.cs" />\r
+    <Compile Include="Mono.Btls.Interface\BtlsX509Chain.cs" />\r
+    <Compile Include="Mono.Btls.Interface\BtlsX509Error.cs" />\r
+    <Compile Include="Mono.Btls.Interface\BtlsX509Format.cs" />\r
+    <Compile Include="Mono.Btls.Interface\BtlsX509Lookup.cs" />\r
+    <Compile Include="Mono.Btls.Interface\BtlsX509Name.cs" />\r
+    <Compile Include="Mono.Btls.Interface\BtlsX509Purpose.cs" />\r
+    <Compile Include="Mono.Btls.Interface\BtlsX509Store.cs" />\r
+    <Compile Include="Mono.Btls.Interface\BtlsX509StoreCtx.cs" />\r
+    <Compile Include="Mono.Btls.Interface\BtlsX509StoreManager.cs" />\r
+    <Compile Include="Mono.Btls.Interface\BtlsX509StoreType.cs" />\r
+    <Compile Include="Mono.Btls.Interface\BtlsX509TrustKind.cs" />\r
+    <Compile Include="Mono.Btls.Interface\BtlsX509VerifyFlags.cs" />\r
+    <Compile Include="Mono.Btls.Interface\BtlsX509VerifyParam.cs" />\r
+    <Compile Include="Mono.Btls.Interface\VersionInfo.cs" />\r  </ItemGroup>\r
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \r
+       Other similar extension points exist, see Microsoft.Common.targets.\r
+  <Target Name="BeforeBuild">\r
+  </Target>\r
+  <Target Name="AfterBuild">\r
+  </Target>\r
+  -->\r
+  <PropertyGroup>\r
+    <PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
+
+    </PreBuildEvent>\r
+    <PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">\r
+\r
+    </PreBuildEvent>\r
+    <PostBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
+
+    </PostBuildEvent>\r
+    <PostBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">\r
+\r
+    </PostBuildEvent>\r
+  </PropertyGroup>\r
+  <ItemGroup>\r
+    <ProjectReference Include="../corlib/corlib-net_4_x.csproj">\r
+      <Project>{2CA6026B-2DC8-4C4C-A12C-1E8234049DB7}</Project>\r
+      <Name>corlib-net_4_x</Name>\r
+    </ProjectReference>\r
+    <ProjectReference Include="../System/System-net_4_x.csproj">\r
+      <Project>{2762E921-91A8-4C87-91E9-BA628013F753}</Project>\r
+      <Name>System-net_4_x</Name>\r
+    </ProjectReference>\r
+    <ProjectReference Include="../Mono.Security/Mono.Security-net_4_x.csproj">\r
+      <Project>{42D59DE7-586F-4ACF-BDD5-E7869E39E3EF}</Project>\r
+      <Name>Mono.Security-net_4_x</Name>\r
+    </ProjectReference>\r
+  </ItemGroup>\r
+  <ItemGroup>\r
+    <Folder Include="Properties\" />\r
+  </ItemGroup>\r
+</Project>\r
+
diff --git a/mcs/class/Mono.Btls.Interface/Mono.Btls.Interface.dll.sources b/mcs/class/Mono.Btls.Interface/Mono.Btls.Interface.dll.sources
new file mode 100644 (file)
index 0000000..710e06d
--- /dev/null
@@ -0,0 +1,22 @@
+./Properties/AssemblyInfo.cs
+../../build/common/Consts.cs
+../../build/common/Locale.cs
+../../build/common/MonoTODOAttribute.cs
+
+Mono.Btls.Interface/BtlsObject.cs
+Mono.Btls.Interface/BtlsProvider.cs
+Mono.Btls.Interface/BtlsX509.cs
+Mono.Btls.Interface/BtlsX509Chain.cs
+Mono.Btls.Interface/BtlsX509Error.cs
+Mono.Btls.Interface/BtlsX509Format.cs
+Mono.Btls.Interface/BtlsX509Lookup.cs
+Mono.Btls.Interface/BtlsX509Name.cs
+Mono.Btls.Interface/BtlsX509Purpose.cs
+Mono.Btls.Interface/BtlsX509Store.cs
+Mono.Btls.Interface/BtlsX509StoreCtx.cs
+Mono.Btls.Interface/BtlsX509StoreManager.cs
+Mono.Btls.Interface/BtlsX509StoreType.cs
+Mono.Btls.Interface/BtlsX509TrustKind.cs
+Mono.Btls.Interface/BtlsX509VerifyFlags.cs
+Mono.Btls.Interface/BtlsX509VerifyParam.cs
+Mono.Btls.Interface/VersionInfo.cs
diff --git a/mcs/class/Mono.Btls.Interface/Mono.Btls.Interface/BtlsObject.cs b/mcs/class/Mono.Btls.Interface/Mono.Btls.Interface/BtlsObject.cs
new file mode 100644 (file)
index 0000000..b2e607c
--- /dev/null
@@ -0,0 +1,73 @@
+//
+// BtlsObject.cs
+//
+// Author:
+//       Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
+//
+// 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;
+
+namespace Mono.Btls.Interface
+{
+       public abstract class BtlsObject : IDisposable
+       {
+               MonoBtlsObject instance;
+
+               internal MonoBtlsObject Instance {
+                       get {
+                               if (!IsValid)
+                                       throw new ObjectDisposedException (GetType ().Name);
+                               return instance;
+                       }
+               }
+
+               internal BtlsObject (MonoBtlsObject instance)
+               {
+                       this.instance = instance;
+               }
+
+               public bool IsValid {
+                       get { return instance != null && instance.IsValid; }
+               }
+
+               protected void Dispose (bool disposing)
+               {
+                       if (disposing) {
+                               if (instance != null) {
+                                       instance.Dispose ();
+                                       instance = null;
+                               }
+                       }
+               }
+
+               public void Dispose ()
+               {
+                       Dispose (true);
+                       GC.SuppressFinalize (this);
+               }
+
+               ~BtlsObject ()
+               {
+                       Dispose (false);
+               }
+       }
+}
+
diff --git a/mcs/class/Mono.Btls.Interface/Mono.Btls.Interface/BtlsProvider.cs b/mcs/class/Mono.Btls.Interface/Mono.Btls.Interface/BtlsProvider.cs
new file mode 100644 (file)
index 0000000..0959dd0
--- /dev/null
@@ -0,0 +1,107 @@
+//
+// BtlsProvider.cs
+//
+// Author:
+//       Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
+//
+// 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 Mono.Security.Interface;
+using System.Security.Cryptography.X509Certificates;
+using MNS = Mono.Net.Security;
+
+namespace Mono.Btls.Interface
+{
+       public static class BtlsProvider
+       {
+               public static bool IsSupported ()
+               {
+                       return MNS.MonoTlsProviderFactory.IsBtlsSupported ();
+               }
+
+               public static MonoTlsProvider GetProvider ()
+               {
+                       return new MonoBtlsProvider ();
+               }
+
+               public static BtlsX509 CreateNative (byte[] data, BtlsX509Format format)
+               {
+                       var x509 = MonoBtlsX509.LoadFromData (data, (MonoBtlsX509Format)format);
+                       return new BtlsX509 (x509);
+               }
+
+               public static X509Certificate CreateCertificate (byte[] data, BtlsX509Format format, bool disallowFallback = false)
+               {
+                       return MonoBtlsProvider.CreateCertificate (data, (MonoBtlsX509Format)format, disallowFallback);
+               }
+
+               public static X509Certificate2 CreateCertificate2 (byte[] data, BtlsX509Format format, bool disallowFallback = false)
+               {
+                       return MonoBtlsProvider.CreateCertificate2 (data, (MonoBtlsX509Format)format, disallowFallback);
+               }
+
+               public static X509Certificate2 CreateCertificate2 (byte[] data, string password, bool disallowFallback = false)
+               {
+                       return MonoBtlsProvider.CreateCertificate2 (data, password, disallowFallback);
+               }
+
+               public static BtlsX509Chain CreateNativeChain ()
+               {
+                       return new BtlsX509Chain (new MonoBtlsX509Chain ());
+               }
+
+               public static BtlsX509Store CreateNativeStore ()
+               {
+                       return new BtlsX509Store (new MonoBtlsX509Store ());
+               }
+
+               public static BtlsX509StoreCtx CreateNativeStoreCtx ()
+               {
+                       return new BtlsX509StoreCtx (new MonoBtlsX509StoreCtx ());
+               }
+
+               public static X509Chain CreateChain ()
+               {
+                       return MonoBtlsProvider.CreateChain ();
+               }
+
+               public static string GetSystemStoreLocation ()
+               {
+                       return MonoBtlsProvider.GetSystemStoreLocation ();
+               }
+
+               public static BtlsX509VerifyParam GetVerifyParam_SslClient ()
+               {
+                       return new BtlsX509VerifyParam (MonoBtlsX509VerifyParam.GetSslClient ());
+               }
+
+               public static BtlsX509VerifyParam GetVerifyParam_SslServer ()
+               {
+                       return new BtlsX509VerifyParam (MonoBtlsX509VerifyParam.GetSslServer ());
+               }
+
+               public static X509Chain GetManagedChain (BtlsX509Chain chain)
+               {
+                       return MonoBtlsProvider.GetManagedChain (chain.Instance);
+               }
+       }
+}
+
diff --git a/mcs/class/Mono.Btls.Interface/Mono.Btls.Interface/BtlsX509.cs b/mcs/class/Mono.Btls.Interface/Mono.Btls.Interface/BtlsX509.cs
new file mode 100644 (file)
index 0000000..abcdafb
--- /dev/null
@@ -0,0 +1,132 @@
+//
+// BtlsX509.cs
+//
+// Author:
+//       Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
+//
+// 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.IO;
+using System.Security.Cryptography;
+
+namespace Mono.Btls.Interface
+{
+       public class BtlsX509 : BtlsObject
+       {
+               new internal MonoBtlsX509 Instance {
+                       get { return (MonoBtlsX509)base.Instance; }
+               }
+
+               internal BtlsX509 (MonoBtlsX509 x509)
+                       : base (x509)
+               {
+               }
+
+               public BtlsX509Name GetSubjectName ()
+               {
+                       return new BtlsX509Name (Instance.GetSubjectName ());
+               }
+
+               public BtlsX509Name GetIssuerName ()
+               {
+                       return new BtlsX509Name (Instance.GetIssuerName ());
+               }
+
+               public string GetSubjectNameString ()
+               {
+                       return Instance.GetSubjectNameString ();
+               }
+
+               public string GetIssuerNameString ()
+               {
+                       return Instance.GetIssuerNameString ();
+               }
+
+               public byte[] GetRawData (BtlsX509Format format)
+               {
+                       return Instance.GetRawData ((MonoBtlsX509Format)format);
+               }
+
+               public byte[] GetCertHash ()
+               {
+                       return Instance.GetCertHash ();
+               }
+
+               public DateTime GetNotBefore ()
+               {
+                       return Instance.GetNotBefore ();
+               }
+
+               public DateTime GetNotAfter ()
+               {
+                       return Instance.GetNotAfter ();
+               }
+
+               public byte[] GetPublicKeyData ()
+               {
+                       return Instance.GetPublicKeyData ();
+               }
+
+               public byte[] GetSerialNumber (bool mono_style)
+               {
+                       return Instance.GetSerialNumber (mono_style);
+               }
+
+               public int GetVersion ()
+               {
+                       return Instance.GetVersion ();
+               }
+
+               public Oid GetSignatureAlgorithm ()
+               {
+                       return Instance.GetSignatureAlgorithm ();
+               }
+
+               public AsnEncodedData GetPublicKeyAsn1 ()
+               {
+                       return Instance.GetPublicKeyAsn1 ();
+               }
+
+               public AsnEncodedData GetPublicKeyParameters ()
+               {
+                       return Instance.GetPublicKeyParameters (); 
+               }
+
+               public long GetSubjectNameHash ()
+               {
+                       using (var name = GetSubjectName ())
+                               return name.GetHash ();
+               }
+
+               public void Print (Stream stream)
+               {
+                       using (var bio = MonoBtlsBio.CreateMonoStream (stream))
+                               Instance.Print (bio);
+               }
+
+               public void ExportAsPEM (Stream stream, bool includeHumanReadableForm)
+               {
+                       using (var bio = MonoBtlsBio.CreateMonoStream (stream))
+                               Instance.ExportAsPEM (bio, includeHumanReadableForm);
+               }
+       }
+}
+
diff --git a/mcs/class/Mono.Btls.Interface/Mono.Btls.Interface/BtlsX509Chain.cs b/mcs/class/Mono.Btls.Interface/Mono.Btls.Interface/BtlsX509Chain.cs
new file mode 100644 (file)
index 0000000..38e9ec5
--- /dev/null
@@ -0,0 +1,58 @@
+//
+// BtlsX509Chain.cs
+//
+// Author:
+//       Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
+//
+// 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;
+
+namespace Mono.Btls.Interface
+{
+       public class BtlsX509Chain : BtlsObject
+       {
+               new internal MonoBtlsX509Chain Instance {
+                       get { return (MonoBtlsX509Chain)base.Instance; }
+               }
+
+               internal BtlsX509Chain (MonoBtlsX509Chain chain)
+                       : base (chain)
+               {
+               }
+
+               public int Count {
+                       get { return Instance.Count; }
+               }
+
+               public BtlsX509 this[int index] {
+                       get {
+                               var x509 = Instance.GetCertificate (index);
+                               return new BtlsX509 (x509.Copy ());
+                       }
+               }
+
+               public void Add (BtlsX509 x509)
+               {
+                       Instance.AddCertificate (x509.Instance);
+               }
+       }
+}
+
diff --git a/mcs/class/Mono.Btls.Interface/Mono.Btls.Interface/BtlsX509Error.cs b/mcs/class/Mono.Btls.Interface/Mono.Btls.Interface/BtlsX509Error.cs
new file mode 100644 (file)
index 0000000..089b4f2
--- /dev/null
@@ -0,0 +1,110 @@
+//
+// BtlsX509Error.cs
+//
+// Author:
+//       Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
+//
+// 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;
+namespace Mono.Btls.Interface
+{
+       // Keep in sync with NativeBoringX509Error
+       public enum BtlsX509Error
+       {
+               OK = 0,
+               /* illegal error (for uninitialized values, to avoid X509_V_OK): 1 */
+
+               UNABLE_TO_GET_ISSUER_CERT = 2,
+               UNABLE_TO_GET_CRL = 3,
+               UNABLE_TO_DECRYPT_CERT_SIGNATURE = 4,
+               UNABLE_TO_DECRYPT_CRL_SIGNATURE = 5,
+               UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY = 6,
+               CERT_SIGNATURE_FAILURE = 7,
+               CRL_SIGNATURE_FAILURE = 8,
+               CERT_NOT_YET_VALID = 9,
+               CERT_HAS_EXPIRED = 10,
+               CRL_NOT_YET_VALID = 11,
+               CRL_HAS_EXPIRED = 12,
+               ERROR_IN_CERT_NOT_BEFORE_FIELD = 13,
+               ERROR_IN_CERT_NOT_AFTER_FIELD = 14,
+               ERROR_IN_CRL_LAST_UPDATE_FIELD = 15,
+               ERROR_IN_CRL_NEXT_UPDATE_FIELD = 16,
+               OUT_OF_MEM = 17,
+               DEPTH_ZERO_SELF_SIGNED_CERT = 18,
+               SELF_SIGNED_CERT_IN_CHAIN = 19,
+               UNABLE_TO_GET_ISSUER_CERT_LOCALLY = 20,
+               UNABLE_TO_VERIFY_LEAF_SIGNATURE = 21,
+               CERT_CHAIN_TOO_LONG = 22,
+               CERT_REVOKED = 23,
+               INVALID_CA = 24,
+               PATH_LENGTH_EXCEEDED = 25,
+               INVALID_PURPOSE = 26,
+               CERT_UNTRUSTED = 27,
+               CERT_REJECTED = 28,
+               /* These are 'informational' when looking for issuer cert */
+               SUBJECT_ISSUER_MISMATCH = 29,
+               AKID_SKID_MISMATCH = 30,
+               AKID_ISSUER_SERIAL_MISMATCH = 31,
+               KEYUSAGE_NO_CERTSIGN = 32,
+
+               UNABLE_TO_GET_CRL_ISSUER = 33,
+               UNHANDLED_CRITICAL_EXTENSION = 34,
+               KEYUSAGE_NO_CRL_SIGN = 35,
+               UNHANDLED_CRITICAL_CRL_EXTENSION = 36,
+               INVALID_NON_CA = 37,
+               PROXY_PATH_LENGTH_EXCEEDED = 38,
+               KEYUSAGE_NO_DIGITAL_SIGNATURE = 39,
+               PROXY_CERTIFICATES_NOT_ALLOWED = 40,
+
+               INVALID_EXTENSION = 41,
+               INVALID_POLICY_EXTENSION = 42,
+               NO_EXPLICIT_POLICY = 43,
+               DIFFERENT_CRL_SCOPE = 44,
+               UNSUPPORTED_EXTENSION_FEATURE = 45,
+
+               UNNESTED_RESOURCE = 46,
+
+               PERMITTED_VIOLATION = 47,
+               EXCLUDED_VIOLATION = 48,
+               SUBTREE_MINMAX = 49,
+               UNSUPPORTED_CONSTRAINT_TYPE = 51,
+               UNSUPPORTED_CONSTRAINT_SYNTAX = 52,
+               UNSUPPORTED_NAME_SYNTAX = 53,
+               CRL_PATH_VALIDATION_ERROR = 54,
+
+               /* Suite B mode algorithm violation */
+               SUITE_B_INVALID_VERSION = 56,
+               SUITE_B_INVALID_ALGORITHM = 57,
+               SUITE_B_INVALID_CURVE = 58,
+               SUITE_B_INVALID_SIGNATURE_ALGORITHM = 59,
+               SUITE_B_LOS_NOT_ALLOWED = 60,
+               SUITE_B_CANNOT_SIGN_P_384_WITH_P_256 = 61,
+
+               /* Host, email and IP check errors */
+               HOSTNAME_MISMATCH = 62,
+               EMAIL_MISMATCH = 63,
+               IP_ADDRESS_MISMATCH = 64,
+
+               /* The application is not happy */
+               APPLICATION_VERIFICATION = 50
+       }
+}
+
diff --git a/mcs/class/Mono.Btls.Interface/Mono.Btls.Interface/BtlsX509Format.cs b/mcs/class/Mono.Btls.Interface/Mono.Btls.Interface/BtlsX509Format.cs
new file mode 100644 (file)
index 0000000..6ff63ce
--- /dev/null
@@ -0,0 +1,37 @@
+//
+// BtlsX509Format.cs
+//
+// Author:
+//       Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
+//
+// 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;
+
+namespace Mono.Btls.Interface
+{
+       // Keep in sync with NativeBoringX509Format
+       public enum BtlsX509Format
+       {
+               DER = 1,
+               PEM = 2
+       }
+}
+
diff --git a/mcs/class/Mono.Btls.Interface/Mono.Btls.Interface/BtlsX509Lookup.cs b/mcs/class/Mono.Btls.Interface/Mono.Btls.Interface/BtlsX509Lookup.cs
new file mode 100644 (file)
index 0000000..836088f
--- /dev/null
@@ -0,0 +1,72 @@
+//
+// BtlsX509Lookup.cs
+//
+// Author:
+//       Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
+//
+// 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.IO;
+using System.Security.Cryptography;
+
+namespace Mono.Btls.Interface
+{
+       public class BtlsX509Lookup : BtlsObject
+       {
+               new internal MonoBtlsX509Lookup Instance {
+                       get { return (MonoBtlsX509Lookup)base.Instance; }
+               }
+
+               internal BtlsX509Lookup (MonoBtlsX509Lookup lookup)
+                       : base (lookup)
+               {
+               }
+
+               public void Initialize ()
+               {
+                       Instance.Initialize ();
+               }
+
+               public void Shutdown ()
+               {
+                       Instance.Shutdown ();
+               }
+
+               public BtlsX509 LookupBySubject (BtlsX509Name name)
+               {
+                       var x509 = Instance.LookupBySubject (name.Instance);
+                       if (x509 == null)
+                               return null;
+
+                       return new BtlsX509 (x509);
+               }
+
+               public void LoadFile (string file, BtlsX509Format type)
+               {
+                       Instance.LoadFile (file, (MonoBtlsX509FileType)type);
+               }
+
+               public void AddDirectory (string dir, BtlsX509Format type)
+               {
+                       Instance.AddDirectory (dir, (MonoBtlsX509FileType)type);
+               }
+       }
+}
diff --git a/mcs/class/Mono.Btls.Interface/Mono.Btls.Interface/BtlsX509Name.cs b/mcs/class/Mono.Btls.Interface/Mono.Btls.Interface/BtlsX509Name.cs
new file mode 100644 (file)
index 0000000..69ca5a9
--- /dev/null
@@ -0,0 +1,62 @@
+//
+// BtlsX509Name.cs
+//
+// Author:
+//       Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
+//
+// 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;
+
+namespace Mono.Btls.Interface
+{
+       public class BtlsX509Name : BtlsObject
+       {
+               new internal MonoBtlsX509Name Instance {
+                       get { return (MonoBtlsX509Name)base.Instance; }
+               }
+
+               internal BtlsX509Name (MonoBtlsX509Name name)
+                       : base (name)
+               {
+               }
+
+               public string GetString ()
+               {
+                       return Instance.GetString ();
+               }
+
+               public byte[] GetRawData (bool use_canon_enc)
+               {
+                       return Instance.GetRawData (use_canon_enc);
+               }
+
+               public long GetHash ()
+               {
+                       return Instance.GetHash ();
+               }
+
+               public long GetHashOld ()
+               {
+                       return Instance.GetHashOld ();
+               }
+       }
+}
+
diff --git a/mcs/class/Mono.Btls.Interface/Mono.Btls.Interface/BtlsX509Purpose.cs b/mcs/class/Mono.Btls.Interface/Mono.Btls.Interface/BtlsX509Purpose.cs
new file mode 100644 (file)
index 0000000..ac906df
--- /dev/null
@@ -0,0 +1,43 @@
+//
+// BtlsX509Purpose.cs
+//
+// Author:
+//       Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
+//
+// 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;
+namespace Mono.Btls.Interface
+{
+       // Keep in sync with NativeBoringX509Purpose
+       public enum BtlsX509Purpose
+       {
+               SSL_CLIENT = 1,
+               SSL_SERVER = 2,
+               NS_SSL_SERVER = 3,
+               SMIME_SIGN = 4,
+               SMIME_ENCRYPT = 5,
+               CRL_SIGN = 6,
+               ANY = 7,
+               OCSP_HELPER = 8,
+               TIMESTAMP_SIGN = 9,
+       }
+}
+
diff --git a/mcs/class/Mono.Btls.Interface/Mono.Btls.Interface/BtlsX509Store.cs b/mcs/class/Mono.Btls.Interface/Mono.Btls.Interface/BtlsX509Store.cs
new file mode 100644 (file)
index 0000000..7b8f03f
--- /dev/null
@@ -0,0 +1,91 @@
+//
+// BtlsX509Store.cs
+//
+// Author:
+//       Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
+//
+// 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.Security.Cryptography.X509Certificates;
+
+namespace Mono.Btls.Interface
+{
+       public class BtlsX509Store : BtlsObject
+       {
+               new internal MonoBtlsX509Store Instance {
+                       get { return (MonoBtlsX509Store)base.Instance; }
+               }
+
+               internal BtlsX509Store (MonoBtlsX509Store store)
+                       : base (store)
+               {
+               }
+
+               public void LoadLocations (string file, string path)
+               {
+                       Instance.LoadLocations (file, path);
+               }
+
+               public void AddTrustedRoots ()
+               {
+                       Instance.AddTrustedRoots ();
+               }
+
+               public void AddCertificate (BtlsX509 x509)
+               {
+                       Instance.AddCertificate (x509.Instance);
+               }
+
+               public int GetCount ()
+               {
+                       return Instance.GetCount ();
+               }
+
+               public void AddLookup (X509CertificateCollection certificates, BtlsX509TrustKind trust)
+               {
+                       Instance.AddCollection (certificates, (MonoBtlsX509TrustKind)trust);
+               }
+
+               static MonoBtlsX509FileType GetFileType (BtlsX509Format format)
+               {
+                       switch (format) {
+                       case BtlsX509Format.DER:
+                               return MonoBtlsX509FileType.ASN1;
+                       case BtlsX509Format.PEM:
+                               return MonoBtlsX509FileType.PEM;
+                       default:
+                               throw new NotSupportedException ();
+                       }
+               }
+
+               public void AddDirectoryLookup (string dir, BtlsX509Format format)
+               {
+                       Instance.AddDirectoryLookup (dir, GetFileType (format));
+               }
+
+               public void AddFileLookup (string file, BtlsX509Format format)
+               {
+                       Instance.AddFileLookup (file, GetFileType (format));
+               }
+
+       }
+}
+
diff --git a/mcs/class/Mono.Btls.Interface/Mono.Btls.Interface/BtlsX509StoreCtx.cs b/mcs/class/Mono.Btls.Interface/Mono.Btls.Interface/BtlsX509StoreCtx.cs
new file mode 100644 (file)
index 0000000..97d4a06
--- /dev/null
@@ -0,0 +1,71 @@
+//
+// BtlsX509StoreCtx.cs
+//
+// Author:
+//       Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
+//
+// 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;
+namespace Mono.Btls.Interface
+{
+       public class BtlsX509StoreCtx : BtlsObject
+       {
+               new internal MonoBtlsX509StoreCtx Instance {
+                       get { return (MonoBtlsX509StoreCtx)base.Instance; }
+               }
+
+               internal BtlsX509StoreCtx (MonoBtlsX509StoreCtx ctx)
+                       : base (ctx)
+               {
+               }
+
+               public void Initialize (BtlsX509Store store, BtlsX509Chain chain)
+               {
+                       Instance.Initialize (store.Instance, chain.Instance);
+               }
+
+               public void SetVerifyParam (BtlsX509VerifyParam param)
+               {
+                       Instance.SetVerifyParam (param.Instance);
+               }
+
+               public int Verify ()
+               {
+                       return Instance.Verify ();
+               }
+
+               public BtlsX509Error GetError ()
+               {
+                       return (BtlsX509Error)Instance.GetError ();
+               }
+
+               public Exception GetException ()
+               {
+                       return Instance.GetException ();
+               }
+
+               public BtlsX509Chain GetChain ()
+               {
+                       return new BtlsX509Chain (Instance.GetChain ());
+               }
+       }
+}
+
diff --git a/mcs/class/Mono.Btls.Interface/Mono.Btls.Interface/BtlsX509StoreManager.cs b/mcs/class/Mono.Btls.Interface/Mono.Btls.Interface/BtlsX509StoreManager.cs
new file mode 100644 (file)
index 0000000..1989ff4
--- /dev/null
@@ -0,0 +1,44 @@
+//
+// BtlsX509StoreManager.cs
+//
+// Author:
+//       Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
+//
+// 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.IO;
+using System.Security.Cryptography;
+
+namespace Mono.Btls.Interface
+{
+       public static class BtlsX509StoreManager
+       {
+               public static bool HasStore (BtlsX509StoreType type)
+               {
+                       return MonoBtlsX509StoreManager.HasStore ((MonoBtlsX509StoreType)type);
+               }
+
+               public static string GetStorePath (BtlsX509StoreType type)
+               {
+                       return MonoBtlsX509StoreManager.GetStorePath ((MonoBtlsX509StoreType)type);
+               }
+       }
+}
diff --git a/mcs/class/Mono.Btls.Interface/Mono.Btls.Interface/BtlsX509StoreType.cs b/mcs/class/Mono.Btls.Interface/Mono.Btls.Interface/BtlsX509StoreType.cs
new file mode 100644 (file)
index 0000000..acdfb98
--- /dev/null
@@ -0,0 +1,43 @@
+//
+// BtlsX509StoreType.cs
+//
+// Author:
+//       Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
+//
+// 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.IO;
+using System.Security.Cryptography;
+
+namespace Mono.Btls.Interface
+{
+       // Keep in sync with MonoBtlsX509StoreType
+       public enum BtlsX509StoreType
+       {
+               Custom,
+               MachineTrustedRoots,
+               MachineIntermediateCA,
+               MachineUntrusted,
+               UserTrustedRoots,
+               UserIntermediateCA,
+               UserUntrusted
+       }
+}
diff --git a/mcs/class/Mono.Btls.Interface/Mono.Btls.Interface/BtlsX509TrustKind.cs b/mcs/class/Mono.Btls.Interface/Mono.Btls.Interface/BtlsX509TrustKind.cs
new file mode 100644 (file)
index 0000000..9338ec6
--- /dev/null
@@ -0,0 +1,42 @@
+//
+// BtlsX509TrustKind.cs
+//
+// Author:
+//       Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
+//
+// 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;
+namespace Mono.Btls.Interface
+{
+       // Keep in sync with MonoBtlsX509TrustKind
+       [Flags]
+       public enum BtlsX509TrustKind
+       {
+               DEFAULT         = 0,
+               TRUST_CLIENT    = 1,
+               TRUST_SERVER    = 2,
+               TRUST_ALL       = 4,
+               REJECT_CLIENT   = 32,
+               REJECT_SERVER   = 64,
+               REJECT_ALL      = 128
+       }
+}
+
diff --git a/mcs/class/Mono.Btls.Interface/Mono.Btls.Interface/BtlsX509VerifyFlags.cs b/mcs/class/Mono.Btls.Interface/Mono.Btls.Interface/BtlsX509VerifyFlags.cs
new file mode 100644 (file)
index 0000000..02640c8
--- /dev/null
@@ -0,0 +1,38 @@
+//
+// BtlsX509VerifyFlags.cs
+//
+// Author:
+//       Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
+//
+// 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;
+namespace Mono.Btls.Interface
+{
+       // Keep in sync with NativeBoringX509VerifyFlags
+       public enum BtlsX509VerifyFlags
+       {
+               DEFAULT = 0,
+               CRL_CHECK = 1,
+               CRL_CHECK_ALL = 2,
+               X509_STRIC = 4
+       }
+}
+
diff --git a/mcs/class/Mono.Btls.Interface/Mono.Btls.Interface/BtlsX509VerifyParam.cs b/mcs/class/Mono.Btls.Interface/Mono.Btls.Interface/BtlsX509VerifyParam.cs
new file mode 100644 (file)
index 0000000..8d4e5eb
--- /dev/null
@@ -0,0 +1,91 @@
+//
+// BtlsX509VerifyParam.cs
+//
+// Author:
+//       Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
+//
+// 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;
+namespace Mono.Btls.Interface
+{
+       public class BtlsX509VerifyParam : BtlsObject
+       {
+               new internal MonoBtlsX509VerifyParam Instance {
+                       get { return (MonoBtlsX509VerifyParam)base.Instance; }
+               }
+
+               internal BtlsX509VerifyParam (MonoBtlsX509VerifyParam param)
+                       : base (param)
+               {
+               }
+
+               public BtlsX509VerifyParam Copy ()
+               {
+                       return new BtlsX509VerifyParam (Instance.Copy ());
+               }
+
+               public void SetName (string name)
+               {
+                       Instance.SetName (name);
+               }
+
+               public void SetHost (string name)
+               {
+                       Instance.SetHost (name);
+               }
+
+               public void AddHost (string name)
+               {
+                       Instance.AddHost (name);
+               }
+
+               public BtlsX509VerifyFlags GetFlags ()
+               {
+                       return (BtlsX509VerifyFlags)Instance.GetFlags ();
+               }
+
+               public void SetFlags (BtlsX509VerifyFlags flags)
+               {
+                       Instance.SetFlags ((ulong)flags);
+               }
+
+               public void SetPurpose (BtlsX509Purpose purpose)
+               {
+                       Instance.SetPurpose ((MonoBtlsX509Purpose)purpose);
+               }
+
+               public int GetDepth ()
+               {
+                       return Instance.GetDepth ();
+               }
+
+               public void SetDepth (int depth)
+               {
+                       Instance.SetDepth (depth);
+               }
+
+               public void SetTime (DateTime time)
+               {
+                       Instance.SetTime (time);
+               }
+       }
+}
+
diff --git a/mcs/class/Mono.Btls.Interface/Mono.Btls.Interface/VersionInfo.cs b/mcs/class/Mono.Btls.Interface/Mono.Btls.Interface/VersionInfo.cs
new file mode 100644 (file)
index 0000000..726c4ba
--- /dev/null
@@ -0,0 +1,34 @@
+//
+// VersionInfo.cs
+//
+// Author:
+//       Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
+//
+// 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;
+namespace Mono.Btls.Interface
+{
+       public static class VersionInfo
+       {
+               public const string Version = "1.0.0";
+       }
+}
+
diff --git a/mcs/class/Mono.Btls.Interface/Properties/AssemblyInfo.cs b/mcs/class/Mono.Btls.Interface/Properties/AssemblyInfo.cs
new file mode 100644 (file)
index 0000000..5ff0bcb
--- /dev/null
@@ -0,0 +1,47 @@
+//
+// AssemblyInfo.cs
+//
+// Author:
+//       Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
+
+//
+// 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.Reflection;
+using System.Resources;
+using System.Security;
+using System.Security.Permissions;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about the system assembly
+
+[assembly: AssemblyVersion (Consts.FxVersion)]
+
+[assembly: AssemblyCompany ("MONO development team")]
+[assembly: AssemblyCopyright ("(c) 2016 Xamarin")]
+[assembly: AssemblyDescription ("Mono.Btls.Interface")]
+[assembly: AssemblyProduct ("MONO CLI")]
+[assembly: AssemblyTitle ("Mono.Btls.Interface")]
+[assembly: CLSCompliant (true)]
+[assembly: ComVisible (false)]
+[assembly: NeutralResourcesLanguage ("en-US")]
+
diff --git a/mcs/class/Mono.Btls.Interface/README.md b/mcs/class/Mono.Btls.Interface/README.md
new file mode 100644 (file)
index 0000000..81e169c
--- /dev/null
@@ -0,0 +1,9 @@
+Mono.Btls.Interface
+===================
+
+The purpose of this assembly is to allow test suites such as xamarin/web-tests
+(https://github.com/xamarin/web-tests/tree/stable) to test parts of BTLS without
+making System.dll internals visible.
+
+It should not be considered a stable and maintained API for third parties.
+
index 1f86305857f2d743b5a753a20afa9bad286bde69..a262391989b81b504b2ab4a0f1843ceeee11fd51 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,169,219,414,1030,3001,3005,3006</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,169,219,414,1030,3001,3005,3006</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 36c99153b4962d85f4f9e3620e29543ed07348e4..38b09b4f05f5cea62cb0244624e5378bef98f429 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;MONO_FEATURE_THREAD_ABORT</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;MONO_FEATURE_THREAD_ABORT</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;MONO_FEATURE_THREAD_ABORT</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;MONO_FEATURE_THREAD_ABORT</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index bd7397407ae304e5fd8aa32fdf5e7b533a8f9c7a..4c30fc6e1485b984dac425d97a47c9d1b938889a 100644 (file)
@@ -1,13 +1,4 @@
 #include Mono.CSharp.dll.sources
-../corlib/System.Reflection.Emit/AssemblyBuilderAccess.cs
-../corlib/System.Reflection.Emit/FlowControl.cs
-../corlib/System.Reflection.Emit/OpCode.cs
-../corlib/System.Reflection.Emit/OpCodeNames.cs
-../corlib/System.Reflection.Emit/OpCodes.cs
-../corlib/System.Reflection.Emit/OpCodeType.cs
-../corlib/System.Reflection.Emit/OperandType.cs
 ../corlib/System.Reflection.Emit/PEFileKinds.cs
-../corlib/System.Reflection.Emit/Label.cs
 ../corlib/System.Reflection.Emit/MethodToken.cs
-../corlib/System.Reflection.Emit/StackBehaviour.cs
 monotouch.cs
index a8260819907e8cef35ea7e90ed327970965f6c00..06feb3cc396d5ceddd3255f98dd2e0a839a880e6 100644 (file)
 
 namespace System.Reflection.Emit
 {
-       public class ILGenerator
-       {
-               public void BeginCatchBlock (Type exceptionType)                
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public Label BeginExceptionBlock ()
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public void BeginExceptFilterBlock ()
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public void BeginFinallyBlock ()
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public LocalBuilder DeclareLocal (params object[] args)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public Label DefineLabel ()
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public void Emit (OpCode opcode)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public void Emit (OpCode opcode, object args)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public  void EmitCall (OpCode opcode, params object[] args)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public void EndExceptionBlock ()
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public void MarkLabel (Label loc)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public int ILOffset { get; set; }
-       }
-
        public class TypeBuilder : Type
        {
                #region implemented abstract members of MemberInfo
@@ -528,230 +468,6 @@ namespace System.Reflection.Emit
                }
        }
 
-       public class LocalBuilder : LocalVariableInfo
-       {       
-       }
-
-       public class GenericTypeParameterBuilder : Type
-       {
-               #region implemented abstract members of MemberInfo
-
-               public override bool IsDefined (Type attributeType, bool inherit)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public override object[] GetCustomAttributes (bool inherit)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public override object[] GetCustomAttributes (Type attributeType, bool inherit)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public override string Name {
-                       get {
-                               throw new NotSupportedException ();
-                       }
-               }
-
-               #endregion
-
-               #region implemented abstract members of Type
-
-               public override Type GetInterface (string name, bool ignoreCase)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public override Type[] GetInterfaces ()
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public override Type GetElementType ()
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public override EventInfo GetEvent (string name, BindingFlags bindingAttr)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public override EventInfo[] GetEvents (BindingFlags bindingAttr)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public override FieldInfo GetField (string name, BindingFlags bindingAttr)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public override FieldInfo[] GetFields (BindingFlags bindingAttr)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public override MemberInfo[] GetMembers (BindingFlags bindingAttr)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               protected override MethodInfo GetMethodImpl (string name, BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public override MethodInfo[] GetMethods (BindingFlags bindingAttr)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public override Type GetNestedType (string name, BindingFlags bindingAttr)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public override Type[] GetNestedTypes (BindingFlags bindingAttr)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public override PropertyInfo[] GetProperties (BindingFlags bindingAttr)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               protected override PropertyInfo GetPropertyImpl (string name, BindingFlags bindingAttr, Binder binder, Type returnType, Type[] types, ParameterModifier[] modifiers)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               protected override ConstructorInfo GetConstructorImpl (BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               protected override TypeAttributes GetAttributeFlagsImpl ()
-               {
-                       throw new NotSupportedException ();
-               }
-
-               protected override bool HasElementTypeImpl ()
-               {
-                       throw new NotSupportedException ();
-               }
-
-               protected override bool IsArrayImpl ()
-               {
-                       throw new NotSupportedException ();
-               }
-
-               protected override bool IsByRefImpl ()
-               {
-                       throw new NotSupportedException ();
-               }
-
-               protected override bool IsCOMObjectImpl ()
-               {
-                       throw new NotSupportedException ();
-               }
-
-               protected override bool IsPointerImpl ()
-               {
-                       throw new NotSupportedException ();
-               }
-
-               protected override bool IsPrimitiveImpl ()
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public override ConstructorInfo[] GetConstructors (BindingFlags bindingAttr)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public override object InvokeMember (string name, BindingFlags invokeAttr, Binder binder, object target, object[] args, ParameterModifier[] modifiers, System.Globalization.CultureInfo culture, string[] namedParameters)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public override Assembly Assembly {
-                       get {
-                               throw new NotSupportedException ();
-                       }
-               }
-
-               public override string AssemblyQualifiedName {
-                       get {
-                               throw new NotSupportedException ();
-                       }
-               }
-
-               public override Type BaseType {
-                       get {
-                               throw new NotSupportedException ();
-                       }
-               }
-
-               public override string FullName {
-                       get {
-                               throw new NotSupportedException ();
-                       }
-               }
-
-               public override Guid GUID {
-                       get {
-                               throw new NotSupportedException ();
-                       }
-               }
-
-               public override Module Module {
-                       get {
-                               throw new NotSupportedException ();
-                       }
-               }
-
-               public override string Namespace {
-                       get {
-                               throw new NotSupportedException ();
-                       }
-               }
-
-               public override Type UnderlyingSystemType {
-                       get {
-                               throw new NotSupportedException ();
-                       }
-               }
-
-               #endregion
-
-               public void SetCustomAttribute (params object[] args)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public void SetGenericParameterAttributes (GenericParameterAttributes genericParameterAttributes)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public void SetInterfaceConstraints (params Type[] interfaceConstraints)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public void SetBaseTypeConstraint (Type baseTypeConstraint)
-               {
-                       throw new NotSupportedException ();
-               }               
-       }
-
        public class ConstructorBuilder : MethodBase
        {
                #region implemented abstract members of MemberInfo
@@ -1087,19 +803,6 @@ namespace System.Reflection.Emit
                }
        }
 
-       public class ParameterBuilder : ParameterInfo
-       {
-               public void SetConstant (object arg)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public void SetCustomAttribute (params object[] args)
-               {
-                       throw new NotSupportedException ();
-               }
-       }
-
        public class EventBuilder
        {
                public void SetAddOnMethod (MethodBuilder mdBuilder)
@@ -1118,11 +821,4 @@ namespace System.Reflection.Emit
                }
        }
 
-       public class CustomAttributeBuilder
-       {
-               public CustomAttributeBuilder (params object[] args)
-               {
-                       throw new NotSupportedException ();
-               }
-       }
 }
\ No newline at end of file
index 51868debb9ffd59aa543ab0c2aa416e90a5278ae..23f16885730d463b2573cfdd8dc0936c8ecd49ea 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index c4aee220b49858a4c6b34793604d5c0f575932a9..80b7d1aec757556dcd1e0568cadb755890a814a1 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -33,7 +34,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;CECIL</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;CECIL</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -41,7 +42,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;CECIL</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;CECIL</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
   </PropertyGroup>\r
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />\r
   <ItemGroup>\r
-    <Compile Include="..\..\..\external\cecil\symbols\mdb\Mono.Cecil.Mdb\AssemblyInfo.cs" />\r
-    <Compile Include="..\..\..\external\cecil\symbols\mdb\Mono.Cecil.Mdb\MdbReader.cs" />\r
-    <Compile Include="..\..\..\external\cecil\symbols\mdb\Mono.Cecil.Mdb\MdbWriter.cs" />\r
-    <Compile Include="..\..\..\external\cecil\symbols\mdb\Mono.CompilerServices.SymbolWriter\MonoSymbolFile.cs" />\r
-    <Compile Include="..\..\..\external\cecil\symbols\mdb\Mono.CompilerServices.SymbolWriter\MonoSymbolTable.cs" />\r
-    <Compile Include="..\..\..\external\cecil\symbols\mdb\Mono.CompilerServices.SymbolWriter\MonoSymbolWriter.cs" />\r
-    <Compile Include="..\..\..\external\cecil\symbols\mdb\Mono.CompilerServices.SymbolWriter\SymbolWriterImpl.cs" />\r  </ItemGroup>\r
+    <Compile Include="..\..\..\external\cecil\ProjectInfo.cs" />\r
+    <Compile Include="..\..\..\external\cecil\symbols\mdb\Mono.Cecil.Mdb\*.cs" />\r
+    <Compile Include="..\..\..\external\cecil\symbols\mdb\Mono.CompilerServices.SymbolWriter\*.cs" />\r  </ItemGroup>\r
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \r
        Other similar extension points exist, see Microsoft.Common.targets.\r
   <Target Name="BeforeBuild">\r
       <Project>{2762E921-91A8-4C87-91E9-BA628013F753}</Project>\r
       <Name>System-net_4_x</Name>\r
     </ProjectReference>\r
-    <ProjectReference Include="../Mono.Cecil/Mono.Cecil-net_4_x.csproj">\r
-      <Project>{2C0D558F-0B38-4691-967E-A910A1B995C1}</Project>\r
-      <Name>Mono.Cecil-net_4_x</Name>\r
-    </ProjectReference>\r
+    <Reference Include="./../../class/lib/net_4_x/Mono.Cecil.dll">\r
+      <SpecificVersion>False</SpecificVersion>\r
+      <HintPath>./../../class/lib/net_4_x/Mono.Cecil.dll</HintPath>\r
+      <Private>False</Private>\r
+    </Reference>\r
   </ItemGroup>\r
   <ItemGroup>\r
     <Folder Include="Properties\" />\r
index e2169fc9aeb7aadfad157975d8e8201a44ad1ff9..a497f4b62ff89d124fd7089982132c0082e2a6bb 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -7,7 +8,7 @@
     <SchemaVersion>2.0</SchemaVersion>\r
     <ProjectGuid>{9BE8D62B-471D-4538-8287-691B4ECE3209}</ProjectGuid>\r
     <OutputType>Library</OutputType>\r
-    <NoWarn>1699</NoWarn>\r
+    <NoWarn>1699,618</NoWarn>\r
     <OutputPath>./../../class/lib/net_4_x</OutputPath>\r
     <IntermediateOutputPath>obj-net_4_x</IntermediateOutputPath>\r
     <GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>\r
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
     <DebugSymbols>true</DebugSymbols>\r
     <DebugType>full</DebugType>\r
-    <NoWarn>1699</NoWarn>\r
+    <NoWarn>1699,618</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">\r
     <DebugType>pdbonly</DebugType>\r
-    <NoWarn>1699</NoWarn>\r
+    <NoWarn>1699,618</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
       <Project>{359142A1-D80F-401E-AA64-7167C9317649}</Project>\r
       <Name>System.Core-net_4_x</Name>\r
     </ProjectReference>\r
-    <ProjectReference Include="../Mono.Cecil/Mono.Cecil-net_4_x.csproj">\r
-      <Project>{2C0D558F-0B38-4691-967E-A910A1B995C1}</Project>\r
-      <Name>Mono.Cecil-net_4_x</Name>\r
-    </ProjectReference>\r
+    <Reference Include="./../../class/lib/net_4_x/Mono.Cecil.dll">\r
+      <SpecificVersion>False</SpecificVersion>\r
+      <HintPath>./../../class/lib/net_4_x/Mono.Cecil.dll</HintPath>\r
+      <Private>False</Private>\r
+    </Reference>\r
     <ProjectReference Include="../Mono.Cecil.Mdb/Mono.Cecil.Mdb-net_4_x.csproj">\r
       <Project>{CF14D34A-F69B-47FB-A99C-D25C77198F30}</Project>\r
       <Name>Mono.Cecil.Mdb-net_4_x</Name>\r
index 984809180a1ea283051576f8071c219b890182a5..9e77c38bdf12f6e1000da5833db06f75588354cc 100644 (file)
@@ -1,2 +1,3 @@
+../../test-helpers/NunitHelpers.cs
 RewriteAndLoad.cs
 TestCCRewrite.cs
index 0b59fa3d3c91b2a45090c2f6ec514b969f00d954..7009825f298fa2e0caa78acb06527202ef39cf31 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 4d142314b9efb96d53d59d4ab4b061ccf22d780d..acd269f5c4e3dcec29a7524fc9fecfa536c17d41 100644 (file)
@@ -682,6 +682,7 @@ namespace Mono.CompilerServices.SymbolWriter
                byte[] hash;
                bool creating;
                bool auto_generated;
+               readonly string sourceFile;
 
                public static int Size {
                        get { return 8; }
@@ -696,11 +697,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,7 +726,7 @@ namespace Mono.CompilerServices.SymbolWriter
 
                        if (hash == null) {
                                try {
-                                   using (FileStream fs = new FileStream (file_name, FileMode.Open, FileAccess.Read)) {
+                                   using (FileStream fs = new FileStream (sourceFile, FileMode.Open, FileAccess.Read)) {
                                        MD5 md5 = MD5.Create ();
                                        hash = md5.ComputeHash (fs);
                                    }
@@ -749,7 +756,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;
@@ -778,7 +785,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++)
index 89763f52ec9185327ba7f17d63a6ffc14e349b6e..816fb68dc5fc3bcbc9fb8669317cfd8e68fb3166 100644 (file)
@@ -187,13 +187,54 @@ namespace Mono.CompilerServices.SymbolWriter
                public void DefineMethod (MonoSymbolFile file, int token)
                {
                        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));
+                               }
 
-                       //
-                       // When index is provided by user it can be inserted in
-                       // any order but mdb format does not store its value. It
-                       // uses store order instead as the index.
-                       //
-                       Array.Sort (blocks, (x, y) => x.Index.CompareTo (y.Index));
+                               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,
index 7a1ee0ced12a4d53865db6a531fc8e46ddc87f7b..68b8199972c39cc9aefc7b17e324330983d236be 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;SQLITE_STANDARD</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;SQLITE_STANDARD</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;SQLITE_STANDARD</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;SQLITE_STANDARD</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 6f757238cd4139809efe4ca4230369ff3344c0bc..34556edb930a21476dd4240285fe9865ea428db6 100644 (file)
@@ -125,9 +125,9 @@ namespace Mono.Data.Sqlite
        // Compatibility with versions < 3.5.0\r
         int n;\r
 \r
-       try {\r
+       if (UnsafeNativeMethods.use_sqlite3_open_v2) {\r
                n = UnsafeNativeMethods.sqlite3_open_v2(ToUTF8(strFilename), out db, (int)flags, IntPtr.Zero);\r
-       } catch (EntryPointNotFoundException) {\r
+       } else {\r
                Console.WriteLine ("Your sqlite3 version is old - please upgrade to at least v3.5.0!");\r
                n = UnsafeNativeMethods.sqlite3_open (ToUTF8 (strFilename), out db);\r
        }\r
index df8a5d787ab0daefe2ea5714dc621b1342f9f8b2..eca1bddfc6b406b6159fccd06ae84ca69a2f6486 100644 (file)
@@ -208,9 +208,9 @@ namespace Mono.Data.Sqlite
 #else\r
         ResetConnection(db);\r
         int n;\r
-        try {\r
+        if (UnsafeNativeMethods.use_sqlite3_close_v2) {\r
           n = UnsafeNativeMethods.sqlite3_close_v2(db);\r
-        } catch (EntryPointNotFoundException) {\r
+        } else {\r
           n = UnsafeNativeMethods.sqlite3_close(db);\r
         }\r
 #endif\r
index 7f35914d241f72792d3667671bf8add783dd3dca..45b2db176875cbf3a4dc9fc0811ae180b64a71d3 100644 (file)
@@ -221,7 +221,7 @@ namespace Mono.Data.Sqlite
         case SQLiteDateFormats.UnixEpoch:\r
           return ((long)(dateValue.Subtract(UnixEpoch).Ticks / TimeSpan.TicksPerSecond)).ToString();\r
         default:\r
-          return dateValue.ToString(_datetimeFormats[7], CultureInfo.InvariantCulture);\r
+          return dateValue.ToString(_datetimeFormats[5], CultureInfo.InvariantCulture);\r
       }\r
     }\r
 \r
index ba16a1763ff92b3141d7515bf8f463affd6c2ab4..bc9826d29f47dc83a2ad0875d14c046ae60b7343 100644 (file)
@@ -16,6 +16,27 @@ namespace Mono.Data.Sqlite
 #endif\r
   internal static class UnsafeNativeMethods\r
   {\r
+    internal static readonly bool use_sqlite3_close_v2 = false;\r
+    internal static readonly bool use_sqlite3_open_v2 = false;\r
+    internal static readonly bool use_sqlite3_create_function_v2 = false;\r
+    static UnsafeNativeMethods()\r
+    {\r
+      // calculate the version number parts\r
+      // https://www.sqlite.org/c3ref/c_source_id.html\r
+      // (<major> * 1000000) + (<minor> * 1000) + (<release>)\r
+      int versionNumber = sqlite3_libversion_number();\r
+      int release = versionNumber % 1000;\r
+      int minor = (versionNumber / 1000) % 1000;\r
+      int major = versionNumber / 1000000;\r
+      Version version = new Version(major, minor, release);\r
+\r
+      // set the various versions\r
+      // https://sqlite.org/changes.html\r
+      use_sqlite3_open_v2 = version >= new Version(3, 5, 0);\r
+      use_sqlite3_close_v2 = version >= new Version(3, 7, 14);\r
+      use_sqlite3_create_function_v2 = version >= new Version(3, 7, 3);\r
+    }\r
+\r
 #if !SQLITE_STANDARD\r
 \r
 #if !USE_INTEROP_DLL\r
@@ -730,6 +751,13 @@ namespace Mono.Data.Sqlite
 #endif\r
     internal static extern int sqlite3_free (IntPtr ptr);\r
 \r
+#if !PLATFORM_COMPACTFRAMEWORK\r
+    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]\r
+#else\r
+    [DllImport(SQLITE_DLL)]\r
+#endif\r
+    internal static extern int sqlite3_libversion_number();\r
+\r
     #endregion\r
   }\r
 \r
index 0a02896ef8ddaa01b2ebec83459d4cfeadc88807..643c40a86da80e8ac3d3afd94d1d04c4cf43d7f2 100644 (file)
@@ -6,4 +6,4 @@ SqliteExceptionUnitTests.cs
 SqliteParameterUnitTests.cs
 SqliteFunctionTests.cs
 Bug27864.cs
-
+SqliteTests.cs
index d64d3055b999b36e07e8ba66aeed04a5aba275c0..b381e1fde72bbdc7d29dd4ffdb482cb863bd5a9c 100644 (file)
@@ -9,7 +9,6 @@
 // Copyright 2015 Xamarin Inc.
 //
 
-#if MONOTOUCH
 using System;
 using System.Data;
 using System.IO;
@@ -96,13 +95,14 @@ namespace MonoTests.Mono.Data.Sqlite {
                                        }
                                }
                        } catch (SqliteException ex) {
+#if MONOTOUCH
                                // Expected Exception from iOS 8.2 (broken) to 9.0 (fixed)
                                if (BCL.Tests.TestRuntime.CheckSystemVersion (8,2) && !BCL.Tests.TestRuntime.CheckSystemVersion (9,0)) 
                                        Assert.That (ex.Message.Contains ("no such column: com.Name"));
                                else
-                                       throw new AssertionException ("Unexpected Sqlite Error", ex); // This should not happen
+                                       throw;
+#endif
                        }
                }
        }
 }
-#endif
\ No newline at end of file
diff --git a/mcs/class/Mono.Data.Sqlite/Test/SqliteTests.cs b/mcs/class/Mono.Data.Sqlite/Test/SqliteTests.cs
new file mode 100644 (file)
index 0000000..1533945
--- /dev/null
@@ -0,0 +1,102 @@
+//
+// SqliteTests.cs
+//
+// Authors:
+//     Marek Safar  <marek.safar@gmail.com>
+//
+// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com)
+//
+// 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.Data;
+using System.IO;
+using System.Text;
+using Mono.Data.Sqlite;
+using NUnit.Framework;
+
+namespace MonoTests.Mono.Data.Sqlite
+{
+       [TestFixture]
+       public class SqliteTests
+       {
+               string _databasePath;
+
+               [SetUp]
+               public void Setup ()
+               {
+                       var dataFolder = Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.Personal), "SqlTest");
+
+                       _databasePath = Path.Combine (dataFolder, "database.db");
+
+                       if (!Directory.Exists (dataFolder)) {
+                               Directory.CreateDirectory (dataFolder);
+                       }
+
+                       File.Delete (_databasePath);
+               }
+
+               [TearDown]
+               public void TearDown ()
+               {
+                       try {
+                               File.Delete (_databasePath);
+                       } catch {
+                       }
+               }
+
+               [Test]
+               public void DateTimeConvert ()
+               {
+                       var dateTime = new DateTime (2016, 9, 15, 12, 1, 53);
+                       var guid = Guid.NewGuid ();
+
+                       using (var connection = new SqliteConnection ("Data Source=" + _databasePath)) {
+                               connection.Open ();
+
+                               var sqlCreate = "CREATE TABLE TestTable (ID uniqueidentifier PRIMARY KEY, Modified datetime)";
+                               using (var cmd = new SqliteCommand (sqlCreate, connection)) {
+                                       cmd.ExecuteNonQuery ();
+                               }
+
+                               var sqlInsert = "INSERT INTO TestTable (ID, Modified) VALUES (@id, @mod)";
+                               using (var cmd = new SqliteCommand (sqlInsert, connection)) {
+                                       cmd.Parameters.Add (new SqliteParameter ("@id", guid));
+                                       cmd.Parameters.Add (new SqliteParameter ("@mod", dateTime));
+                                       cmd.ExecuteNonQuery ();
+                               }
+                       }
+
+                       using (var connection = new SqliteConnection ("Data Source=" + _databasePath)) {
+                               connection.Open ();
+
+                               var sqlSelect = "SELECT * from TestTable";
+                               using (var cmd = new SqliteCommand (sqlSelect, connection))
+                               using (var reader = cmd.ExecuteReader ()) {
+                                       while (reader.Read ()) {
+                                               Assert.AreEqual (guid, reader.GetGuid (0), "#1");
+                                               Assert.AreEqual (dateTime, reader.GetDateTime (1), "#2");
+                                       }
+                               }
+                       }
+               }
+       }
+}
index a1b59026c1d47d9fb1fb80625a395623579d1e80..bbd4da09f77dddfd312f823c24184f808948ba9d 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 1f20c1f89c63b6dceeb793a7241f8a2d4a6d34c2..e2fa98dcebe04e7629af935ed7847e9df90bfd16 100644 (file)
@@ -16,7 +16,8 @@ VALID_TEST_PROFILE := $(filter net_4_x, $(PROFILE))
 ifdef VALID_TEST_PROFILE
 
 TEST_HELPERS_SOURCES = \
-       ../test-helpers/NetworkHelpers.cs
+       ../test-helpers/NetworkHelpers.cs \
+       Test/TypeLoadClass.cs
 
 test-local: dtest-app.exe dtest-excfilter.exe
 
index 51d78f17c2fbf656c1dbb7b1a121a458e6ad6bfb..5d1f3e7554654c2f96bea87b6881d6b4be780e82 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -33,7 +34,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;MONO_DATACONVERTER_STATIC_METHODS</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;MONO_DATACONVERTER_STATIC_METHODS</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -41,7 +42,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;MONO_DATACONVERTER_STATIC_METHODS</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;MONO_DATACONVERTER_STATIC_METHODS</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -91,6 +92,7 @@
     <Compile Include="Mono.Debugger.Soft\InvocationException.cs" />\r
     <Compile Include="Mono.Debugger.Soft\InvokeOptions.cs" />\r
     <Compile Include="Mono.Debugger.Soft\ITargetProcess.cs" />\r
+    <Compile Include="Mono.Debugger.Soft\LocalScope.cs" />\r
     <Compile Include="Mono.Debugger.Soft\LocalVariable.cs" />\r
     <Compile Include="Mono.Debugger.Soft\Location.cs" />\r
     <Compile Include="Mono.Debugger.Soft\MethodBodyMirror.cs" />\r
       <Project>{2762E921-91A8-4C87-91E9-BA628013F753}</Project>\r
       <Name>System-net_4_x</Name>\r
     </ProjectReference>\r
-    <ProjectReference Include="../Mono.Cecil/Mono.Cecil-net_4_x.csproj">\r
-      <Project>{2C0D558F-0B38-4691-967E-A910A1B995C1}</Project>\r
-      <Name>Mono.Cecil-net_4_x</Name>\r
-    </ProjectReference>\r
+    <Reference Include="./../../class/lib/net_4_x/Mono.Cecil.dll">\r
+      <SpecificVersion>False</SpecificVersion>\r
+      <HintPath>./../../class/lib/net_4_x/Mono.Cecil.dll</HintPath>\r
+      <Private>False</Private>\r
+    </Reference>\r
     <ProjectReference Include="../System.Core/System.Core-net_4_x.csproj">\r
       <Project>{359142A1-D80F-401E-AA64-7167C9317649}</Project>\r
       <Name>System.Core-net_4_x</Name>\r
index 9313227067d8d83dfe78389c285f6058e8a5c75b..3ea9e744843837ca6d031ee3362ae37393a1c97f 100644 (file)
@@ -40,6 +40,7 @@ Mono.Debugger.Soft/BreakpointEventRequest.cs
 Mono.Debugger.Soft/MethodEntryEventRequest.cs
 Mono.Debugger.Soft/AssemblyLoadEventRequest.cs
 Mono.Debugger.Soft/LocalVariable.cs
+Mono.Debugger.Soft/LocalScope.cs
 Mono.Debugger.Soft/ParameterInfoMirror.cs
 Mono.Debugger.Soft/Event.cs
 Mono.Debugger.Soft/EventSet.cs
index 05ea6bcdaf44aa4a2714b2c8758767164ffb0170..a5b902db57322eaff402889d0becf162902b735b 100644 (file)
@@ -117,6 +117,8 @@ namespace Mono.Debugger.Soft
                public string[] names;
                public int[] live_range_start;
                public int[] live_range_end;
+               public int[] scopes_start;
+               public int[] scopes_end;
        }
 
        struct PropInfo {
@@ -418,7 +420,7 @@ namespace Mono.Debugger.Soft
                 * with newer runtimes, and vice versa.
                 */
                internal const int MAJOR_VERSION = 2;
-               internal const int MINOR_VERSION = 42;
+               internal const int MINOR_VERSION = 44;
 
                enum WPSuspendPolicy {
                        NONE = 0,
@@ -588,6 +590,7 @@ namespace Mono.Debugger.Soft
                        GET_THIS = 2,
                        SET_VALUES = 3,
                        GET_DOMAIN = 4,
+                       SET_THIS = 5,
                }
 
                enum CmdArrayRef {
@@ -1910,6 +1913,19 @@ namespace Mono.Debugger.Soft
                        var res = SendReceive (CommandSet.METHOD, (int)CmdMethod.GET_LOCALS_INFO, new PacketWriter ().WriteId (id));
 
                        LocalsInfo info = new LocalsInfo ();
+
+                       if (Version.AtLeast (2, 43)) {
+                               int nscopes = res.ReadInt ();
+                               info.scopes_start = new int [nscopes];
+                               info.scopes_end = new int [nscopes];
+                               int last_start = 0;
+                               for (int i = 0; i < nscopes; ++i) {
+                                       info.scopes_start [i] = last_start + res.ReadInt ();
+                                       info.scopes_end [i] = info.scopes_start [i] + res.ReadInt ();
+                                       last_start = info.scopes_start [i];
+                               }
+                       }
+
                        int nlocals = res.ReadInt ();
                        info.types = new long [nlocals];
                        for (int i = 0; i < nlocals; ++i)
@@ -2395,6 +2411,10 @@ namespace Mono.Debugger.Soft
                        return SendReceive (CommandSet.STACK_FRAME, (int)CmdStackFrame.GET_DOMAIN, new PacketWriter ().WriteId (thread_id).WriteId (id)).ReadId ();
                }
 
+               internal void StackFrame_SetThis (long thread_id, long id, ValueImpl value) {
+                       SendReceive (CommandSet.STACK_FRAME, (int)CmdStackFrame.SET_THIS, new PacketWriter ().WriteId (thread_id).WriteId (id).WriteValue (value));
+               }
+
                /*
                 * ARRAYS
                 */
diff --git a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/LocalScope.cs b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/LocalScope.cs
new file mode 100644 (file)
index 0000000..52c58b2
--- /dev/null
@@ -0,0 +1,35 @@
+using System;
+
+namespace Mono.Debugger.Soft
+{
+       public class LocalScope : Mirror {
+
+               MethodMirror method;
+               int live_range_start, live_range_end;
+
+           internal LocalScope (VirtualMachine vm, MethodMirror method, int live_range_start, int live_range_end) : base (vm, 0) {
+                       this.method = method;
+                       this.live_range_start = live_range_start;
+                       this.live_range_end = live_range_end;
+               }
+
+               public MethodMirror Method {
+                       get {
+                               return method;
+                       }
+               }
+
+               public int LiveRangeStart {
+                       get {
+                               return live_range_start;
+                       }
+               }
+
+               public int LiveRangeEnd {
+                       get {
+                               return live_range_end;
+                       }
+               }
+       }
+}
+
index 88dd7277c20262752cb2ecaf7a21f8e5e48432cf..fb10f7117c30258350bad2e93053dac7cbb14cbe 100644 (file)
@@ -19,6 +19,7 @@ namespace Mono.Debugger.Soft
                ParameterInfoMirror[] param_info;
                ParameterInfoMirror ret_param;
                LocalVariable[] locals;
+               LocalScope[] scopes;
                IList<Location> locations;
                MethodBodyMirror body;
                MethodMirror gmd;
@@ -239,6 +240,12 @@ namespace Mono.Debugger.Soft
                        }
                }
 
+               public LocalScope [] GetScopes () {
+                       vm.CheckProtocolVersion (2, 43);
+                       GetLocals ();
+                       return scopes;
+               }
+
                public LocalVariable[] GetLocals () {
                        if (locals == null) {
                                LocalsInfo li = new LocalsInfo ();
@@ -258,6 +265,12 @@ namespace Mono.Debugger.Soft
 
                                for (int i = 0; i < li.names.Length; ++i)
                                        locals [i + pi.Length] = new LocalVariable (vm, this, i, li.types [i], li.names [i], li.live_range_start [i], li.live_range_end [i], false);
+
+                               if (vm.Version.AtLeast (2, 43)) {
+                                       scopes = new LocalScope [li.scopes_start.Length];
+                                       for (int i = 0; i < scopes.Length; ++i)
+                                               scopes [i] = new LocalScope (vm, this, li.scopes_start [i], li.scopes_end [i]);
+                               }
                        }
                        return locals;
                }
index f160c4a37a716890c6619877aaff762374e10395..c92f2240ef8036b0d2a162a82846dba70c082bfb 100644 (file)
@@ -166,6 +166,15 @@ namespace Mono.Debugger.Soft
                        return vm.DecodeValue (vm.conn.StackFrame_GetThis (thread.Id, Id));
                }
 
+               // Since protocol version 2.44
+               public void SetThis (Value value) {
+                       if (value == null)
+                               throw new ArgumentNullException ("value");
+                       if (Method.IsStatic || !Method.DeclaringType.IsValueType)
+                               throw new InvalidOperationException ("The frame's method needs to be a valuetype instance method.");
+                       vm.conn.StackFrame_SetThis (thread.Id, Id, vm.EncodeValue (value));
+               }
+
                public void SetValue (LocalVariable var, Value value) {
                        if (var == null)
                                throw new ArgumentNullException ("var");
diff --git a/mcs/class/Mono.Debugger.Soft/Test/TypeLoadClass.cs b/mcs/class/Mono.Debugger.Soft/Test/TypeLoadClass.cs
new file mode 100644 (file)
index 0000000..dfe4c3e
--- /dev/null
@@ -0,0 +1,11 @@
+
+class TypeLoadClass
+{
+       static TypeLoadClass ()
+       {
+       }
+}
+
+class TypeLoadClass2
+{
+}
\ No newline at end of file
index 6617c146f6e138bb2e93ff51df41e1db164d1d84..16e35d301e12b9121e63c5a8a3a2e98c22c363d5 100644 (file)
@@ -430,6 +430,7 @@ public class Tests : TestsBase, ITest2
                ss_recursive2 (1);
                ss_recursive_chaotic ();
                ss_fp_clobber ();
+               ss_no_frames ();
        }
 
        [MethodImplAttribute (MethodImplOptions.NoInlining)]
@@ -679,6 +680,25 @@ public class Tests : TestsBase, ITest2
        public static void ss_fp_clobber_2 (double d) {
        }
 
+       [MethodImplAttribute (MethodImplOptions.NoInlining)]
+       public static void ss_no_frames () {
+               Action a = ss_no_frames_2;
+               var ar = a.BeginInvoke (null, null);
+               ar.AsyncWaitHandle.WaitOne ();
+               // Avoid waiting every time this runs
+               if (static_i == 56)
+                       Thread.Sleep (200);
+               ss_no_frames_3 ();
+       }
+
+       [MethodImplAttribute (MethodImplOptions.NoInlining)]
+       public static void ss_no_frames_2 () {
+       }
+
+       [MethodImplAttribute (MethodImplOptions.NoInlining)]
+       public static void ss_no_frames_3 () {
+       }
+
        [MethodImplAttribute (MethodImplOptions.NoInlining)]
        public static bool is_even (int i) {
                return i % 2 == 0;
@@ -829,9 +849,7 @@ public class Tests : TestsBase, ITest2
        }
 
        [MethodImplAttribute (MethodImplOptions.NoInlining)]
-#if NET_4_5
        [StateMachine (typeof (int))]
-#endif
        public static void locals2<T> (string[] args, int arg, T t, ref string rs, ref AStruct astruct) {
                long i = 42;
                string s = "AB";
@@ -1184,12 +1202,10 @@ public class Tests : TestsBase, ITest2
 
        [MethodImplAttribute (MethodImplOptions.NoInlining)]
        public static void unhandled_exception_user () {
-#if NET_4_5
                System.Threading.Tasks.Task.Factory.StartNew (() => {
                                Throw ();
                        });
                Thread.Sleep (10000);
-#endif
        }
 
        [MethodImplAttribute (MethodImplOptions.NoInlining)]
@@ -1306,6 +1322,8 @@ public class Tests : TestsBase, ITest2
 
                o.invoke_2 ();
 
+               o.assembly_load ();
+
                AppDomain.Unload (domain);
 
                domains_3 ();
@@ -1337,6 +1355,11 @@ public class Tests : TestsBase, ITest2
        public static void invoke_in_domain_2 () {
        }
 
+       [MethodImplAttribute (MethodImplOptions.NoInlining)]
+       public static void assembly_load_in_domain () {
+               Assembly.Load ("System.Transactions");
+       }
+
        [MethodImplAttribute (MethodImplOptions.NoInlining)]
        public static void dynamic_methods () {
                var m = new DynamicMethod ("dyn_method", typeof (void), new Type []  { typeof (int) }, typeof (object).Module);
@@ -1593,12 +1616,6 @@ public class Tests : TestsBase, ITest2
        }
 }
 
-class TypeLoadClass {
-}
-
-class TypeLoadClass2 {
-}
-
 public class SentinelClass : MarshalByRefObject {
 }
 
@@ -1617,6 +1634,10 @@ public class CrossDomain : MarshalByRefObject
        public int invoke_3 () {
                return 42;
        }
+
+       public void assembly_load () {
+               Tests.assembly_load_in_domain ();
+       }
 }      
 
 public class Foo
@@ -1624,6 +1645,25 @@ public class Foo
        public ProcessStartInfo info;
 }
 
+class LocalReflectClass
+{
+       public static void RunMe ()
+       {
+               var reflectMe = new someClass ();
+               var temp = reflectMe; // Breakpoint location
+               reflectMe.someMethod ();
+       }
+
+       class someClass : ContextBoundObject
+       {
+               public object someField;
+
+               public void someMethod ()
+               {
+               }
+       }
+}
+
 // Class used for line number info testing, don't change its layout
 public class LineNumbers
 {
@@ -1647,22 +1687,5 @@ public class LineNumbers
        }
 }
 
-class LocalReflectClass
-{
-       public static void RunMe ()
-       {
-               var reflectMe = new someClass ();
-               reflectMe.someMethod ();
-       }
-
-       class someClass : ContextBoundObject
-       {
-               public object someField;
-
-               public void someMethod ()
-               {
-               }
-       }
-}
 
 
index 88ed411da35bcabcf36968da7de70dcaa9fc7d16..f40e1aa83de6b7d0c9d25271c811c4b582727c93 100644 (file)
@@ -69,9 +69,17 @@ public class DebuggerTests
                if (!listening) {
                        var pi = new Diag.ProcessStartInfo ();
 
-                       if (runtime != null)
+                       if (runtime != null) {
                                pi.FileName = runtime;
-                       else
+                       } else if (Path.DirectorySeparatorChar == '\\') {
+                               string processExe = Diag.Process.GetCurrentProcess ().MainModule.FileName;
+                               if (processExe != null) {
+                                       string fileName = Path.GetFileName (processExe);
+                                       if (fileName.StartsWith ("mono") && fileName.EndsWith (".exe"))
+                                               pi.FileName = processExe;
+                               }
+                       }
+                       if (string.IsNullOrEmpty (pi.FileName))
                                pi.FileName = "mono";
                        pi.Arguments = String.Join (" ", args);
                        vm = VirtualMachineManager.Launch (pi, new LaunchOptions { AgentArgs = agent_args });
@@ -550,7 +558,11 @@ public class DebuggerTests
                MethodMirror m = entry_point.DeclaringType.Assembly.GetType ("LocalReflectClass").GetMethod ("RunMe");
 
                Assert.IsNotNull (m);
-               //Console.WriteLine ("X: " + name + " " + m.ILOffsets.Count + " " + m.Locations.Count);
+
+//             foreach (var x in m.Locations) {
+//                     Console.WriteLine (x);
+//             }
+
                var offset = -1;
                int method_base_linum = m.Locations [0].LineNumber;
                foreach (var location in m.Locations)
@@ -578,7 +590,11 @@ public class DebuggerTests
                e = single_step (e.Thread);
 
                var frame = e.Thread.GetFrames ()[0];
-               Value variable = frame.GetValue (frame.Method.GetLocal ("reflectMe"));
+
+               Assert.IsNotNull (frame);
+               var field = frame.Method.GetLocal ("reflectMe");
+               Assert.IsNotNull (field);
+               Value variable = frame.GetValue (field);
 
                ObjectMirror thisObj = (ObjectMirror)variable;
                TypeMirror thisType = thisObj.Type;
@@ -890,6 +906,28 @@ public class DebuggerTests
                req.Disable ();
        }
 
+       [Test]
+       public void SingleSteppingNoFrames () {
+               //
+               // Test what happens when starting a single step operation on a thread
+               // with no managed frames
+               //
+               // Run a delegate on a tp thread
+               var e = run_until ("ss_no_frames_2");
+
+               var this_type = e.Thread.GetFrames ()[0].Method.DeclaringType;
+               this_type.SetValue (this_type.GetField ("static_i"), vm.CreateValue (56));
+
+               var thread = e.Thread;
+               var e2 = run_until ("ss_no_frames_3");
+               // The tp thread should be idle now
+               step_req = vm.CreateStepRequest (thread);
+               step_req.Depth = StepDepth.Over;
+               AssertThrows<Exception> (delegate {
+                       step_req.Enable ();
+                       });
+       }
+
        [Test]
        public void MethodEntryExit () {
                run_until ("single_stepping");
@@ -1767,6 +1805,16 @@ public class DebuggerTests
                AssertValue ("T", s ["s"]);
                AssertValue (45, s ["k"]);
 
+               // Test SetThis ()
+               s ["i"] = vm.CreateValue (55);
+               frame.SetThis (s);
+               obj = frame.GetThis ();
+               Assert.IsTrue (obj is StructMirror);
+               s = obj as StructMirror;
+               AssertValue (55, s ["i"]);
+               AssertValue ("T", s ["s"]);
+               AssertValue (45, s ["k"]);
+
                // this on static vtype methods
                e = run_until ("vtypes3");
                e = step_until (e.Thread, "static_foo");
@@ -1846,6 +1894,9 @@ public class DebuggerTests
                                Assert.Fail ();
                        }
                }
+
+               var scopes = frame.Method.GetScopes ();
+               Assert.AreEqual (2, scopes.Length);
        }
 
        Event step_once () {
@@ -2447,7 +2498,6 @@ public class DebuggerTests
                        Assert.AreEqual ("Exception", ex.Exception.Type.Name);
                }
 
-#if NET_4_5
                // out argument
                m = t.GetMethod ("invoke_out");
                var out_task = this_obj.InvokeMethodAsyncWithResult (e.Thread, m, new Value [] { vm.CreateValue (1), vm.CreateValue (null) }, InvokeOptions.ReturnOutArgs);
@@ -2460,7 +2510,6 @@ public class DebuggerTests
                out_task = this_obj.InvokeMethodAsyncWithResult (e.Thread, m, new Value [] { vm.CreateValue (1), vm.CreateValue (null) });
                out_args = out_task.Result.OutArgs;
                Assert.IsNull (out_args);
-#endif
 
                // newobj
                m = t.GetMethod (".ctor");
@@ -2484,7 +2533,6 @@ public class DebuggerTests
                v = t.InvokeMethod (e.Thread, m, new Value [] { vm.RootDomain.CreateString ("ABC") }, InvokeOptions.Virtual);
                AssertValue ("ABC", v);
 
-#if NET_4_5
                // instance
                m = t.GetMethod ("invoke_pass_ref");
                var task = this_obj.InvokeMethodAsync (e.Thread, m, new Value [] { vm.RootDomain.CreateString ("ABC") });
@@ -2494,7 +2542,6 @@ public class DebuggerTests
                m = t.GetMethod ("invoke_static_pass_ref");
                task = t.InvokeMethodAsync (e.Thread, m, new Value [] { vm.RootDomain.CreateString ("ABC") });
                AssertValue ("ABC", task.Result);
-#endif
 
                // Argument checking
                
@@ -2588,7 +2635,6 @@ public class DebuggerTests
                v = t.InvokeMethod (e.Thread, m, new Value [] { vm.CreateValue (1) });
                AssertValue (1, (v as StructMirror)["i"]);
 
-#if NET_4_5
                // Invoke a method which changes state
                s = frame.GetArgument (1) as StructMirror;
                t = s.Type;
@@ -2615,7 +2661,6 @@ public class DebuggerTests
                m = vm.RootDomain.Corlib.GetType ("System.Object").GetMethod ("ToString");
                v = s.InvokeMethod (e.Thread, m, null, InvokeOptions.Virtual);
                AssertValue ("42", v);
-#endif
        }
 
        [Test]
@@ -3300,6 +3345,9 @@ public class DebuggerTests
                        vm.Resume ();
                        e = GetNextEvent ();
                        if (e is AssemblyUnloadEvent) {
+                               AssertThrows<Exception> (delegate () {
+                                               var assembly_obj = (e as AssemblyUnloadEvent).Assembly.GetAssemblyObject ();
+                                       });
                                continue;
                        } else {
                                break;
@@ -3578,6 +3626,8 @@ public class DebuggerTests
                        return;
 
                string srcfile = (e as BreakpointEvent).Method.DeclaringType.GetSourceFiles (true)[0];
+               srcfile = srcfile.Replace ("dtest-app.cs", "TypeLoadClass.cs");
+               Assert.IsTrue (srcfile.Contains ("TypeLoadClass.cs"));
 
                var req = vm.CreateTypeLoadRequest ();
                req.SourceFileFilter = new string [] { srcfile.ToUpper () };
@@ -3790,7 +3840,6 @@ public class DebuggerTests
                vm = null;
        }
 
-#if NET_4_5
        [Test]
        public void UnhandledExceptionUserCode () {
                vm.Detach ();
@@ -3811,7 +3860,6 @@ public class DebuggerTests
                vm.Exit (0);
                vm = null;
        }
-#endif
 
        [Test]
        public void GCWhileSuspended () {
index 781affa962a70637a5b24e3271886ad1ec55044f..e99fba0cfa4cc6e8665d84ae867b5fe14d815265 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,618</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,618</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 9aa0a5dffaf85f310ce84f3c8828737d2dc8699a..2cd63b068243800bf740413c2b2d74a98a1f080d 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 40771592cda08379045b3013d8644da60516962d..3f75b4c374739e16afdf6f807737a91f8f359cda 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,618</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,618</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 8b83f6323907e479ef4c20d46a86603b246a5c8b..35d36d22cc04bfa8d2a4441c77d1d4744a57d005 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index d8f8685ff498a07648df1afe0ae3ba96eb694e45..6269cc1d4c3fd0292b6dad0640f438fa1c0c811e 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index f5de89dfdd4753428e3242c3e3ddbd21c02f9cf3..f6ff6cfff287631136bb5930dbb631a26aa09968 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;INSIDE_MONO_PARALLEL</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;INSIDE_MONO_PARALLEL</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;INSIDE_MONO_PARALLEL</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;INSIDE_MONO_PARALLEL</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 1eb8276dbde5a7eae4bf842def1b68edff5afaea..c187abfe371c2a2309625f06d481169d4f1a32b7 100644 (file)
@@ -1,3 +1,4 @@
+../../test-helpers/NunitHelpers.cs
 Mono.Collections.Concurrent/CollectionStressTestHelper.cs
 Mono.Collections.Concurrent/ConcurrentSkipListTests.cs
 Mono.Threading/ParallelTestHelper.cs
index 51e6db7e1d820b7e97deff2aa6f6370cd2ec5978..c0606e3fecdbd38e00e86531fec860a174ac67bb 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,618,612</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,618,612</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index a2f290f8656ed6bd2f002f6c1d1f468e9007ea15..55773333f78b9a554cc45b94c2698868d4f26fdf 100644 (file)
@@ -1,3 +1,4 @@
+../../test-helpers/NunitHelpers.cs
 Mono.Unix/ReadlinkTest.cs
 Mono.Unix/StdioFileStreamTest.cs
 Mono.Unix/UnixEncodingTest.cs
index e4c34cba317f28629d885cb370e536fc3cabb29f..9b95fba6f3c115923b9c1b1c1e3722326f145f43 100644 (file)
@@ -426,10 +426,20 @@ namespace Mono.Unix.Native {
 
                public static Errno GetLastError ()
                {
-                       int errno = Marshal.GetLastWin32Error ();
-                       return NativeConvert.ToErrno (errno);
+                       if (Environment.OSVersion.Platform != PlatformID.Unix) {
+                               // On Windows Marshal.GetLastWin32Error() doesn't take errno
+                               // into account so we need to call Mono_Posix_Stdlib_GetLastError()
+                               // which returns the value of errno in the C runtime
+                               // libMonoPosixHelper.dll was linked against.
+                               return (Errno) _GetLastError ();
+                       }
+                       return NativeConvert.ToErrno (Marshal.GetLastWin32Error ());
                }
 
+               [DllImport (MPH, CallingConvention=CallingConvention.Cdecl,
+                               EntryPoint="Mono_Posix_Stdlib_GetLastError")]
+               private static extern int _GetLastError ();
+
                [DllImport (MPH, CallingConvention=CallingConvention.Cdecl,
                                EntryPoint="Mono_Posix_Stdlib_SetLastError")]
                private static extern void SetLastError (int error);
@@ -675,7 +685,8 @@ namespace Mono.Unix.Native {
                                [MarshalAs (UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(FileNameMarshaler))]
                                string newpath);
 
-               [DllImport (LIBC, CallingConvention=CallingConvention.Cdecl, SetLastError=true)]
+               [DllImport (MPH, CallingConvention=CallingConvention.Cdecl,
+                               SetLastError=true, EntryPoint="Mono_Posix_Stdlib_tmpfile")]
                public static extern IntPtr tmpfile ();
 
                private static object tmpnam_lock = new object ();
@@ -704,18 +715,22 @@ namespace Mono.Unix.Native {
                        }
                }
 
-               [DllImport (LIBC, CallingConvention=CallingConvention.Cdecl, SetLastError=true)]
+               [DllImport (MPH, CallingConvention=CallingConvention.Cdecl,
+                               SetLastError=true, EntryPoint="Mono_Posix_Stdlib_fclose")]
                public static extern int fclose (IntPtr stream);
 
-               [DllImport (LIBC, CallingConvention=CallingConvention.Cdecl, SetLastError=true)]
+               [DllImport (MPH, CallingConvention=CallingConvention.Cdecl,
+                               SetLastError=true, EntryPoint="Mono_Posix_Stdlib_fflush")]
                public static extern int fflush (IntPtr stream);
 
-               [DllImport (LIBC, CallingConvention=CallingConvention.Cdecl, SetLastError=true)]
+               [DllImport (MPH, CallingConvention=CallingConvention.Cdecl,
+                               SetLastError=true, EntryPoint="Mono_Posix_Stdlib_fopen")]
                public static extern IntPtr fopen (
                                [MarshalAs (UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(FileNameMarshaler))]
                                string path, string mode);
 
-               [DllImport (LIBC, CallingConvention=CallingConvention.Cdecl, SetLastError=true)]
+               [DllImport (MPH, CallingConvention=CallingConvention.Cdecl,
+                               SetLastError=true, EntryPoint="Mono_Posix_Stdlib_freopen")]
                public static extern IntPtr freopen (
                                [MarshalAs (UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(FileNameMarshaler))]
                                string path, string mode, IntPtr stream);
@@ -741,8 +756,8 @@ namespace Mono.Unix.Native {
                        return setvbuf (stream, (IntPtr) buf, mode, size);
                }
 
-               [DllImport (LIBC, CallingConvention=CallingConvention.Cdecl,
-                               EntryPoint="fprintf")]
+               [DllImport (MPH, CallingConvention=CallingConvention.Cdecl,
+                               EntryPoint="Mono_Posix_Stdlib_fprintf")]
                private static extern int sys_fprintf (IntPtr stream, string format, string message);
 
                public static int fprintf (IntPtr stream, string message)
@@ -846,11 +861,12 @@ namespace Mono.Unix.Native {
                 *    vsscanf(3)
                 */
 
-               [DllImport (LIBC, CallingConvention=CallingConvention.Cdecl, SetLastError=true)]
+               [DllImport (MPH, CallingConvention=CallingConvention.Cdecl,
+                               SetLastError=true, EntryPoint="Mono_Posix_Stdlib_fgetc")]
                public static extern int fgetc (IntPtr stream);
 
-               [DllImport (LIBC, CallingConvention=CallingConvention.Cdecl,
-                               SetLastError=true, EntryPoint="fgets")]
+               [DllImport (MPH, CallingConvention=CallingConvention.Cdecl,
+                               SetLastError=true, EntryPoint="Mono_Posix_Stdlib_fgets")]
                private static extern IntPtr sys_fgets (StringBuilder sb, int size, IntPtr stream);
 
                public static StringBuilder fgets (StringBuilder sb, int size, IntPtr stream)
@@ -866,22 +882,28 @@ namespace Mono.Unix.Native {
                        return fgets (sb, sb.Capacity, stream);
                }
 
-               [DllImport (LIBC, CallingConvention=CallingConvention.Cdecl, SetLastError=true)]
+               [DllImport (MPH, CallingConvention=CallingConvention.Cdecl,
+                               SetLastError=true, EntryPoint="Mono_Posix_Stdlib_fputc")]
                public static extern int fputc (int c, IntPtr stream);
 
-               [DllImport (LIBC, CallingConvention=CallingConvention.Cdecl, SetLastError=true)]
+               [DllImport (MPH, CallingConvention=CallingConvention.Cdecl,
+                               SetLastError=true, EntryPoint="Mono_Posix_Stdlib_fputs")]
                public static extern int fputs (string s, IntPtr stream);
 
-               [DllImport (LIBC, CallingConvention=CallingConvention.Cdecl, SetLastError=true)]
-               public static extern int getc (IntPtr stream);
+               public static int getc (IntPtr stream)
+               {
+                       return fgetc (stream);
+               }
 
                [DllImport (LIBC, CallingConvention=CallingConvention.Cdecl, SetLastError=true)]
                public static extern int getchar ();
 
                /* SKIP: gets(3) */
 
-               [DllImport (LIBC, CallingConvention=CallingConvention.Cdecl, SetLastError=true)]
-               public static extern int putc (int c, IntPtr stream);
+               public static int putc (int c, IntPtr stream)
+               {
+                       return fputc (c, stream);
+               }
 
                [DllImport (LIBC, CallingConvention=CallingConvention.Cdecl, SetLastError=true)]
                public static extern int putchar (int c);
@@ -889,7 +911,8 @@ namespace Mono.Unix.Native {
                [DllImport (LIBC, CallingConvention=CallingConvention.Cdecl, SetLastError=true)]
                public static extern int puts (string s);
 
-               [DllImport (LIBC, CallingConvention=CallingConvention.Cdecl, SetLastError=true)]
+               [DllImport (MPH, CallingConvention=CallingConvention.Cdecl,
+                               SetLastError=true, EntryPoint="Mono_Posix_Stdlib_ungetc")]
                public static extern int ungetc (int c, IntPtr stream);
 
                [CLSCompliant (false)]
@@ -993,10 +1016,12 @@ namespace Mono.Unix.Native {
                                SetLastError=true, EntryPoint="Mono_Posix_Stdlib_clearerr")]
                public static extern int clearerr (IntPtr stream);
 
-               [DllImport (LIBC, CallingConvention=CallingConvention.Cdecl)]
+               [DllImport (MPH, CallingConvention=CallingConvention.Cdecl,
+                               SetLastError=true, EntryPoint="Mono_Posix_Stdlib_feof")]
                public static extern int feof (IntPtr stream);
 
-               [DllImport (LIBC, CallingConvention=CallingConvention.Cdecl)]
+               [DllImport (MPH, CallingConvention=CallingConvention.Cdecl,
+                               SetLastError=true, EntryPoint="Mono_Posix_Stdlib_ferror")]
                public static extern int ferror (IntPtr stream);
 
                [DllImport (MPH, CallingConvention=CallingConvention.Cdecl, 
@@ -1050,7 +1075,8 @@ namespace Mono.Unix.Native {
                                SetLastError=true, EntryPoint="Mono_Posix_Stdlib_calloc")]
                public static extern IntPtr calloc (ulong nmemb, ulong size);
 
-               [DllImport (LIBC, CallingConvention=CallingConvention.Cdecl)]
+               [DllImport (MPH, CallingConvention=CallingConvention.Cdecl,
+                               EntryPoint="Mono_Posix_Stdlib_free")]
                public static extern void free (IntPtr ptr);
 
                // malloc(3):
index cbeb54b0ec2778f87a457f5494c2f349d5ddb223..e998a74ee4969ffdb481b54de4edcf00f01a687a 100644 (file)
@@ -3085,7 +3085,7 @@ namespace Mono.Unix.Native {
                                EntryPoint="Mono_Posix_Syscall_get_at_fdcwd")]
                private static extern int get_at_fdcwd ();
 
-               public static readonly int AT_FDCWD = get_at_fdcwd ();
+               public static int AT_FDCWD { get { return get_at_fdcwd (); } }
 
                #endregion
 
@@ -3657,12 +3657,12 @@ namespace Mono.Unix.Native {
                [DllImport (MPH, EntryPoint="Mono_Posix_Syscall_L_ctermid")]
                private static extern int _L_ctermid ();
 
-               public static readonly int L_ctermid = _L_ctermid ();
+               public static int L_ctermid { get { return _L_ctermid (); } }
 
                [DllImport (MPH, EntryPoint="Mono_Posix_Syscall_L_cuserid")]
                private static extern int _L_cuserid ();
 
-               public static readonly int L_cuserid = _L_cuserid ();
+               public static int L_cuserid { get { return _L_cuserid (); } }
 
                internal static object getlogin_lock = new object ();
 
@@ -4043,9 +4043,9 @@ namespace Mono.Unix.Native {
                                EntryPoint="Mono_Posix_Syscall_get_utime_omit")]
                private static extern long get_utime_omit ();
 
-               public static readonly long UTIME_NOW = get_utime_now ();
+               public static long UTIME_NOW { get { return get_utime_now (); } }
 
-               public static readonly long UTIME_OMIT = get_utime_omit ();
+               public static long UTIME_OMIT { get { return get_utime_omit (); } }
 
                [DllImport (MPH, SetLastError=true, 
                                EntryPoint="Mono_Posix_Syscall_futimens")]
index 7eed08157b0748ff075ad7bcc362aa8709d4b74a..1d0ef97e9f7e5aeb081304271e8211a586084abe 100644 (file)
@@ -60,35 +60,43 @@ namespace Mono.Unix {
 
                public StdioFileStream (string path)
                {
+                       if (path == null)
+                               throw new ArgumentNullException ("path");
                        InitStream (Fopen (path, "rb"), true);
                }
 
                public StdioFileStream (string path, string mode)
                {
+                       if (path == null)
+                               throw new ArgumentNullException ("path");
                        InitStream (Fopen (path, mode), true);
                }
 
                public StdioFileStream (string path, FileMode mode)
                {
+                       if (path == null)
+                               throw new ArgumentNullException ("path");
                        InitStream (Fopen (path, ToFopenMode (path, mode)), true);
                }
 
                public StdioFileStream (string path, FileAccess access)
                {
+                       if (path == null)
+                               throw new ArgumentNullException ("path");
                        InitStream (Fopen (path, ToFopenMode (path, access)), true);
                        InitCanReadWrite (access);
                }
 
                public StdioFileStream (string path, FileMode mode, FileAccess access)
                {
+                       if (path == null)
+                               throw new ArgumentNullException ("path");
                        InitStream (Fopen (path, ToFopenMode (path, mode, access)), true);
                        InitCanReadWrite (access);
                }
 
                private static IntPtr Fopen (string path, string mode)
                {
-                       if (path == null)
-                               throw new ArgumentNullException ("path");
                        if (path.Length == 0)
                                throw new ArgumentException ("path");
                        if (mode == null)
index f68fe53b8ce70b896dbb603a9530042fddae1885..892f087e48f9b00aa3dbefa0b306c454c522fe91 100644 (file)
@@ -8,9 +8,7 @@
 //
 
 using NUnit.Framework;
-#if !MONODROID
-using NUnit.Framework.SyntaxHelpers;
-#endif
+
 using System;
 using System.Text;
 using System.Threading;
@@ -21,7 +19,7 @@ using Mono.Unix.Native;
 namespace MonoTests.Mono.Unix.Native {
 
        [TestFixture]
-       [Category ("NotOnMac")]
+       [Category ("NotOnMac"), Category ("NotOnWindows")]
        public class RealTimeSignumTest 
        {
                [Test]
index 3ec10f916cebc48da8f46d660c50e2baf61dd1fd..31c4549dd6e2a3e8a269eafd6b4c6e7d880a4c3c 100644 (file)
@@ -20,7 +20,7 @@ using NUnit.Framework;
 
 namespace MonoTests.Mono.Unix.Native
 {
-       [TestFixture, Category ("NotDotNet")]
+       [TestFixture, Category ("NotDotNet"), Category ("NotOnWindows")]
        public class SocketTest {
 
                string TempFolder;
index 1b7b77d5aca4704f5ff51304098543516268bfb2..aa0c06b76c61b87b2f76f222457d2069badf59ac 100644 (file)
@@ -17,7 +17,7 @@ using Mono.Unix.Native;
 
 namespace MonoTests.Mono.Unix.Native {
 
-       [TestFixture]
+       [TestFixture, Category ("NotOnWindows")]
        public class StdlibTest
        {
                private class SignalTest {
index 608127b568c81272027312ca22a7629841e02e3a..2f286d49b8193765c9f2cbd57c432e7b0c0e857d 100644 (file)
@@ -18,7 +18,7 @@ using NUnit.Framework;
 
 namespace MonoTests.Mono.Unix
 {
-       [TestFixture, Category ("NotDotNet")]
+       [TestFixture, Category ("NotDotNet"), Category ("NotOnWindows")]
        public class ReadlinkTest {
 
                static string[] Targets = {
@@ -173,7 +173,7 @@ namespace MonoTests.Mono.Unix
                                        long r = Syscall.readlink (link, buf);
                                        if (r < 0)
                                                UnixMarshal.ThrowExceptionForLastError ();
-                                       Assert.GreaterOrEqual (buf.Length, r);
+                                       AssertHelper.GreaterOrEqual (buf.Length, r);
                                        if (r == buf.Length)
                                                buf = new byte[checked (buf.Length * 2)];
                                        else
@@ -199,7 +199,7 @@ namespace MonoTests.Mono.Unix
                                        long r = Syscall.readlinkat (TempFD, "link", buf);
                                        if (r < 0)
                                                UnixMarshal.ThrowExceptionForLastError ();
-                                       Assert.GreaterOrEqual (buf.Length, r);
+                                       AssertHelper.GreaterOrEqual (buf.Length, r);
                                        if (r == buf.Length)
                                                buf = new byte[checked (buf.Length * 2)];
                                        else
@@ -226,7 +226,7 @@ namespace MonoTests.Mono.Unix
                                        if (r < 0)
                                                UnixMarshal.ThrowExceptionForLastError ();
                                        Assert.AreEqual (r, sb.Length);
-                                       Assert.GreaterOrEqual (sb.Capacity, r);
+                                       AssertHelper.GreaterOrEqual (sb.Capacity, r);
                                        if (r == sb.Capacity)
                                                checked { sb.Capacity *= 2; }
                                        else
@@ -255,7 +255,7 @@ namespace MonoTests.Mono.Unix
                                        if (r < 0)
                                                UnixMarshal.ThrowExceptionForLastError ();
                                        Assert.AreEqual (r, sb.Length);
-                                       Assert.GreaterOrEqual (sb.Capacity, r);
+                                       AssertHelper.GreaterOrEqual (sb.Capacity, r);
                                        if (r == sb.Capacity)
                                                checked { sb.Capacity *= 2; }
                                        else
index aaae08271ed602f6f7d2db79f171aafc98a013bb..9ae0c61b288180fe2c44e97acb3a7a855f321c6f 100644 (file)
@@ -21,25 +21,43 @@ namespace MonoTests.System.IO
        [TestFixture]
        public class StdioFileStreamTest {
 
-               string TempFolder = Path.Combine (Path.GetTempPath (), "MonoTests.Mono.Unix.Tests");
+               static string BaseTempFolder = Path.Combine (Path.GetTempPath (),
+                       "MonoTests.Mono.Unix.Tests");
+               static string TempFolder;
                static readonly char DSC = Path.DirectorySeparatorChar;
 
-               [TearDown]
-               public void TearDown()
+               [TestFixtureSetUp]
+               public void FixtureSetUp ()
                {
-                       if (Directory.Exists (TempFolder))
-                               Directory.Delete (TempFolder, true);
+                       try {
+                               // Try to cleanup from any previous NUnit run.
+                               Directory.Delete (BaseTempFolder, true);
+                       } catch (Exception) {
+                       }
                }
 
                [SetUp]
                public void SetUp ()
                {
-                       if (Directory.Exists (TempFolder))
-                               Directory.Delete (TempFolder, true);
-
+                       int i = 0;
+                       do {
+                               TempFolder = Path.Combine (BaseTempFolder, (++i).ToString());
+                       } while (Directory.Exists (TempFolder));
                        Directory.CreateDirectory (TempFolder);
                }
 
+               [TearDown]
+               public void TearDown ()
+               {
+                       try {
+                               // This might throw an exception on Windows
+                               // since the directory may contain open files.
+                               Directory.Delete (TempFolder, true);
+                       } catch (Exception e) {
+                               Console.WriteLine (e);
+                       }
+               }
+
                public void TestCtr ()
                {
                        string path = TempFolder + DSC + "testfilestream.tmp.1";
@@ -226,7 +244,7 @@ namespace MonoTests.System.IO
                {
                        StdioFileStream fs = null;
                        StdioFileStream fs2 = null;
-                       string tempPath = Path.Combine (Path.GetTempPath (), "temp");
+                       string tempPath = Path.Combine (TempFolder, "temp");
                        try {
                                if (!File.Exists (tempPath)) {
                                        TextWriter tw = File.CreateText (tempPath);
@@ -240,8 +258,6 @@ namespace MonoTests.System.IO
                                        fs.Close ();
                                if (fs2 != null)
                                        fs2.Close ();
-                               if (File.Exists (tempPath))
-                                       File.Delete (tempPath);
                        }
                }
 
@@ -273,8 +289,9 @@ namespace MonoTests.System.IO
                        stream.Write (outbytes, 7, 7);
                        stream.Write (outbytes, 14, 1);
 
-                       stream.Read (bytes, 0, 15);
                        stream.Seek (15, SeekOrigin.Begin);
+                       Array.Clear (bytes, 0, bytes.Length);
+                       stream.Read (bytes, 0, 15);
                        for (int i = 0; i < 15; ++i)
                                Assert.AreEqual (i + 1, bytes [i]);
                        stream.Close ();
index 21e5b791636f6aa6da1e6b9b3a9ce0091155cadd..837fe4ec26309bc7fb336de4165c57cc263700e5 100644 (file)
@@ -17,7 +17,7 @@ using Mono.Unix;
 
 namespace MonoTests.Mono.Unix {
 
-    [TestFixture]
+    [TestFixture, Category ("NotOnWindows")]
     public class UnixEndPointTest {
 
         // Regression test for https://bugzilla.xamarin.com/show_bug.cgi?id=35004
index 81e775e64b0d517b962928b2b4bd04301390aabf..da6bbe083723479f7d3e4bcb9a1ac199d2f6fe4c 100644 (file)
@@ -21,7 +21,7 @@ using Syscall = Mono.Unix.Native.Syscall;
 
 namespace MonoTests.Mono.Unix {
 
-       [TestFixture, Category ("NotDotNet")]
+       [TestFixture, Category ("NotDotNet"), Category ("NotOnWindows")]
        public class UnixGroupTest
        {
                [Test]
index b2312b5590fe9751ff1a8c42f15d92a2779aa50e..ad2d3089a42918407f930f779c260b40774e3cb3 100644 (file)
@@ -14,7 +14,7 @@ using Mono.Unix;
 
 namespace MonoTests.Mono.Unix {
 
-    [TestFixture]
+    [TestFixture, Category ("NotOnWindows")]
     public class UnixListenerTest {
 
         // test that a socket file is created and deleted by the UnixListener
index e27a5dd246c68ef04c4f602b6fda95195e4f69aa..8ae50b98c977fa9af5531e7dbae9227c8d8586cd 100644 (file)
@@ -28,7 +28,7 @@ namespace MonoTests.Mono.Unix {
                }
        }
 
-       [TestFixture]
+       [TestFixture, Category ("NotOnWindows")]
        public class UnixMarshalTest {
 #if false
                public static void Main ()
index c21348748dcbace4ecaa98b58e0591dfa6012e5a..6c10225dfe72a0876dd329f2c97b98121c00f9ce 100644 (file)
@@ -16,7 +16,7 @@ using Mono.Unix;
 namespace MonoTests.Mono.Unix
 {
 
-       [TestFixture, Category ("NotDotNet")]
+       [TestFixture, Category ("NotDotNet"), Category ("NotOnWindows")]
        public class UnixPathTest {
 
                private static readonly char DSC = UnixPath.DirectorySeparatorChar;
index 9abc27094c9d0fe4c8fb8610e8b767386a4e0e8e..5dc422d5a344aba7e90b92009d455925ed63dd0d 100644 (file)
@@ -8,21 +8,17 @@
 //
 
 using NUnit.Framework;
-#if !MONODROID
-using NUnit.Framework.SyntaxHelpers;
-#endif
+
 using System;
 using System.Text;
 using System.Threading;
 using Mono.Unix;
 using Mono.Unix.Android;
 using Mono.Unix.Native;
-#if !MONODROID
-namespace NUnit.Framework.SyntaxHelpers { class Dummy {} }
-#endif
+
 namespace MonoTests.Mono.Unix {
 
-       [TestFixture]
+       [TestFixture, Category ("NotOnWindows")]
        public class UnixSignalTest {
 
                // helper method to create a thread waiting on a UnixSignal
index 30f0450637ca6e68faa464296628120ee4abfd73..68a36c935c67f09a1217056961986a3762a9be67 100644 (file)
@@ -21,7 +21,7 @@ using Syscall = Mono.Unix.Native.Syscall;
 
 namespace MonoTests.Mono.Unix {
 
-       [TestFixture, Category ("NotDotNet")]
+       [TestFixture, Category ("NotDotNet"), Category ("NotOnWindows")]
        public class UnixUserTest
        {
                [Test]
index ae7afa670cb5380ad33e9656aace557e13adde50..aa931ee9db789b334cb89012a555eff52bc07c37 100644 (file)
@@ -3,7 +3,7 @@ SUBDIRS =
 include ../../build/rules.make
 
 LIBRARY = Mono.Reactive.Testing.dll
-LIB_REFS = System System.Core System.Reactive.Interfaces System.Reactive.Core System.Reactive.Linq System.Reactive.PlatformServices System.Reactive.Providers System.Reactive.Runtime.Remoting System.Reactive.Experimental System.Reactive.Windows.Forms System.Reactive.Windows.Threading System.Reactive.Observable.Aliases System.Windows.Forms WindowsBase nunit.framework
+LIB_REFS = System System.Core System.Reactive.Interfaces System.Reactive.Core System.Reactive.Linq System.Reactive.PlatformServices System.Reactive.Providers System.Reactive.Runtime.Remoting System.Reactive.Experimental System.Reactive.Windows.Forms System.Reactive.Windows.Threading System.Reactive.Observable.Aliases System.Windows.Forms WindowsBase nunitlite
 LIB_MCS_FLAGS = \
                @more_build_args \
                -d:NUNIT -d:MONO -d:DESKTOPCLR
diff --git a/mcs/class/Mono.Security.Providers.DotNet/Makefile b/mcs/class/Mono.Security.Providers.DotNet/Makefile
deleted file mode 100644 (file)
index a42b8c5..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-thisdir = class/Mono.Security.Providers.DotNet
-SUBDIRS = 
-include ../../build/rules.make
-
-LIBRARY = Mono.Security.Providers.DotNet.dll
-LIB_REFS = System Mono.Security
-LIB_MCS_FLAGS = -unsafe -nowarn:1030 -keyfile:../mono.pub -delaysign
-
-EXTRA_DISTFILES = README.md
-
-include ../../build/library.make
-
-$(the_lib): ../Mono.Security/Makefile
-
diff --git a/mcs/class/Mono.Security.Providers.DotNet/Mono.Security.Providers.DotNet-net_4_x.csproj b/mcs/class/Mono.Security.Providers.DotNet/Mono.Security.Providers.DotNet-net_4_x.csproj
deleted file mode 100644 (file)
index 115c3f2..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>\r
-<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
-  <PropertyGroup>\r
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
-    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>\r
-    <ProductVersion>9.0.30729</ProductVersion>\r
-    <SchemaVersion>2.0</SchemaVersion>\r
-    <ProjectGuid>{391EDD2B-85AC-4FCA-B607-AAD6C51E6799}</ProjectGuid>\r
-    <OutputType>Library</OutputType>\r
-    <NoWarn>1699,1030</NoWarn>\r
-    <OutputPath>./../../class/lib/net_4_x</OutputPath>\r
-    <IntermediateOutputPath>obj-net_4_x</IntermediateOutputPath>\r
-    <GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>\r
-    <NoStdLib>True</NoStdLib>\r
-    \r
-    <NoConfig>True</NoConfig>\r
-    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>\r
-    <AppDesignerFolder>Properties</AppDesignerFolder>\r
-    <RootNamespace>\r
-    </RootNamespace>\r
-    <AssemblyName>Mono.Security.Providers.DotNet</AssemblyName>\r
-    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
-    <FileAlignment>512</FileAlignment>\r
-  </PropertyGroup>\r
-    <PropertyGroup>\r
-    <SignAssembly>true</SignAssembly>\r
-    <DelaySign>true</DelaySign>\r
-  </PropertyGroup>\r
-  <PropertyGroup>\r
-    <AssemblyOriginatorKeyFile>../mono.pub</AssemblyOriginatorKeyFile>\r
-  </PropertyGroup>\r
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
-    <DebugSymbols>true</DebugSymbols>\r
-    <DebugType>full</DebugType>\r
-    <NoWarn>1699,1030</NoWarn>\r
-    <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
-    <ErrorReport>prompt</ErrorReport>\r
-    <WarningLevel>4</WarningLevel>\r
-  </PropertyGroup>\r
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">\r
-    <DebugType>pdbonly</DebugType>\r
-    <NoWarn>1699,1030</NoWarn>\r
-    <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
-    <ErrorReport>prompt</ErrorReport>\r
-    <WarningLevel>4</WarningLevel>\r
-  </PropertyGroup>\r
-  <!-- Set AddAdditionalExplicitAssemblyReferences to false, otherwise if targetting .NET4.0, \r
-  Microsoft.NETFramework.props will force a dependency on the assembly System.Core. This\r
-  is a problem to compile the Mono mscorlib.dll -->\r
-  <PropertyGroup>\r
-    <AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>\r
-  </PropertyGroup>\r
-  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />\r
-  <ItemGroup>\r
-    <Compile Include="..\..\build\common\Consts.cs" />\r
-    <Compile Include="..\..\build\common\Locale.cs" />\r
-    <Compile Include=".\Mono.Security.Providers.DotNet\DotNetSslStreamImpl.cs" />\r
-    <Compile Include=".\Mono.Security.Providers.DotNet\DotNetTlsProvider.cs" />\r
-    <Compile Include=".\Properties\AssemblyInfo.cs" />\r  </ItemGroup>\r
-  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \r
-       Other similar extension points exist, see Microsoft.Common.targets.\r
-  <Target Name="BeforeBuild">\r
-  </Target>\r
-  <Target Name="AfterBuild">\r
-  </Target>\r
-  -->\r
-  <PropertyGroup>\r
-    <PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
-
-    </PreBuildEvent>\r
-    <PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">\r
-\r
-    </PreBuildEvent>\r
-    <PostBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
-
-    </PostBuildEvent>\r
-    <PostBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">\r
-\r
-    </PostBuildEvent>\r
-  </PropertyGroup>\r
-  <ItemGroup>\r
-    <ProjectReference Include="../corlib/corlib-net_4_x.csproj">\r
-      <Project>{2CA6026B-2DC8-4C4C-A12C-1E8234049DB7}</Project>\r
-      <Name>corlib-net_4_x</Name>\r
-    </ProjectReference>\r
-    <ProjectReference Include="../System/System-net_4_x.csproj">\r
-      <Project>{2762E921-91A8-4C87-91E9-BA628013F753}</Project>\r
-      <Name>System-net_4_x</Name>\r
-    </ProjectReference>\r
-    <ProjectReference Include="../Mono.Security/Mono.Security-net_4_x.csproj">\r
-      <Project>{42D59DE7-586F-4ACF-BDD5-E7869E39E3EF}</Project>\r
-      <Name>Mono.Security-net_4_x</Name>\r
-    </ProjectReference>\r
-  </ItemGroup>\r
-  <ItemGroup>\r
-    <Folder Include="Properties\" />\r
-  </ItemGroup>\r
-</Project>\r
-
diff --git a/mcs/class/Mono.Security.Providers.DotNet/Mono.Security.Providers.DotNet.dll.sources b/mcs/class/Mono.Security.Providers.DotNet/Mono.Security.Providers.DotNet.dll.sources
deleted file mode 100644 (file)
index 7afb9f3..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-./Properties/AssemblyInfo.cs
-../../build/common/Consts.cs
-../../build/common/Locale.cs
-
-./Mono.Security.Providers.DotNet/DotNetTlsProvider.cs
-./Mono.Security.Providers.DotNet/DotNetSslStreamImpl.cs
diff --git a/mcs/class/Mono.Security.Providers.DotNet/Mono.Security.Providers.DotNet/DotNetSslStreamImpl.cs b/mcs/class/Mono.Security.Providers.DotNet/Mono.Security.Providers.DotNet/DotNetSslStreamImpl.cs
deleted file mode 100644 (file)
index c6be703..0000000
+++ /dev/null
@@ -1,317 +0,0 @@
-//
-// DotNetSslStreamImpl.cs
-//
-// Author:
-//       Martin Baulig <martin.baulig@xamarin.com>
-//
-// Copyright (c) 2015 Xamarin, Inc.
-//
-// 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.IO;
-using System.Net;
-using System.Net.Security;
-using System.Threading.Tasks;
-using System.Security.Authentication;
-using System.Security.Cryptography.X509Certificates;
-using System.Security.Principal;
-using System.Security.Cryptography;
-using MSI = Mono.Security.Interface;
-
-namespace Mono.Security.Providers.DotNet
-{
-       class DotNetSslStreamImpl : MSI.IMonoSslStream
-       {
-               DotNetTlsProvider provider;
-               SslStream impl;
-
-               internal SslStream Impl {
-                       get {
-                               CheckDisposed ();
-                               return impl;
-                       }
-               }
-
-               public DotNetSslStreamImpl (
-                       Stream innerStream, bool leaveInnerStreamOpen, DotNetTlsProvider provider,
-                       RemoteCertificateValidationCallback userCertificateValidationCallback,
-                       LocalCertificateSelectionCallback userCertificateSelectionCallback)
-               {
-                       this.provider = provider;
-                       impl = new SslStream (
-                               innerStream, leaveInnerStreamOpen,
-                               userCertificateValidationCallback,
-                               userCertificateSelectionCallback);
-               }
-
-               public void AuthenticateAsClient (string targetHost)
-               {
-                       Impl.AuthenticateAsClient (targetHost);
-               }
-
-               public void AuthenticateAsClient (string targetHost, X509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
-               {
-                       Impl.AuthenticateAsClient (targetHost, clientCertificates, enabledSslProtocols, checkCertificateRevocation);
-               }
-
-               public IAsyncResult BeginAuthenticateAsClient (string targetHost, AsyncCallback asyncCallback, object asyncState)
-               {
-                       return Impl.BeginAuthenticateAsClient (targetHost, asyncCallback, asyncState);
-               }
-
-               public IAsyncResult BeginAuthenticateAsClient (string targetHost, X509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, bool checkCertificateRevocation, AsyncCallback asyncCallback, object asyncState)
-               {
-                       return Impl.BeginAuthenticateAsClient (targetHost, clientCertificates, enabledSslProtocols, checkCertificateRevocation, asyncCallback, asyncState);
-               }
-
-               public void EndAuthenticateAsClient (IAsyncResult asyncResult)
-               {
-                       Impl.EndAuthenticateAsClient (asyncResult);
-               }
-
-               public void AuthenticateAsServer (X509Certificate serverCertificate)
-               {
-                       Impl.AuthenticateAsServer (serverCertificate);
-               }
-
-               public void AuthenticateAsServer (X509Certificate serverCertificate, bool clientCertificateRequired, SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
-               {
-                       Impl.AuthenticateAsServer (serverCertificate, clientCertificateRequired, enabledSslProtocols, checkCertificateRevocation);
-               }
-
-               public IAsyncResult BeginAuthenticateAsServer (X509Certificate serverCertificate, AsyncCallback asyncCallback, object asyncState)
-               {
-                       return Impl.BeginAuthenticateAsServer (serverCertificate, asyncCallback, asyncState);
-               }
-
-               public IAsyncResult BeginAuthenticateAsServer (X509Certificate serverCertificate, bool clientCertificateRequired, SslProtocols enabledSslProtocols, bool checkCertificateRevocation, AsyncCallback asyncCallback, object asyncState)
-               {
-                       return Impl.BeginAuthenticateAsServer (serverCertificate, clientCertificateRequired, enabledSslProtocols, checkCertificateRevocation, asyncCallback, asyncState);
-               }
-
-               public void EndAuthenticateAsServer (IAsyncResult asyncResult)
-               {
-                       Impl.EndAuthenticateAsServer (asyncResult);
-               }
-
-               public Task AuthenticateAsClientAsync (string targetHost)
-               {
-                       return Impl.AuthenticateAsClientAsync (targetHost);
-               }
-
-               public Task AuthenticateAsClientAsync (string targetHost, X509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
-               {
-                       return Impl.AuthenticateAsClientAsync (targetHost, clientCertificates, enabledSslProtocols, checkCertificateRevocation);
-               }
-
-               public Task AuthenticateAsServerAsync (X509Certificate serverCertificate)
-               {
-                       return Impl.AuthenticateAsServerAsync (serverCertificate);
-               }
-
-               public Task AuthenticateAsServerAsync (X509Certificate serverCertificate, bool clientCertificateRequired, SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
-               {
-                       return Impl.AuthenticateAsServerAsync (serverCertificate, clientCertificateRequired, enabledSslProtocols, checkCertificateRevocation);
-               }
-
-               public void Flush ()
-               {
-                       Impl.Flush ();
-               }
-
-               public int Read (byte[] buffer, int offset, int count)
-               {
-                       return Impl.Read (buffer, offset, count);
-               }
-
-               public void Write (byte[] buffer)
-               {
-                       Impl.Write (buffer);
-               }
-
-               public void Write (byte[] buffer, int offset, int count)
-               {
-                       Impl.Write (buffer, offset, count);
-               }
-
-               public IAsyncResult BeginRead (byte[] buffer, int offset, int count, AsyncCallback asyncCallback, object asyncState)
-               {
-                       return Impl.BeginRead (buffer, offset, count, asyncCallback, asyncState);
-               }
-
-               public int EndRead (IAsyncResult asyncResult)
-               {
-                       return Impl.EndRead (asyncResult);
-               }
-
-               public IAsyncResult BeginWrite (byte[] buffer, int offset, int count, AsyncCallback asyncCallback, object asyncState)
-               {
-                       return Impl.BeginWrite (buffer, offset, count, asyncCallback, asyncState);
-               }
-
-               public void EndWrite (IAsyncResult asyncResult)
-               {
-                       Impl.EndWrite (asyncResult);
-               }
-
-               public TransportContext TransportContext {
-                       get { throw new NotSupportedException (); }
-               }
-
-               public bool IsAuthenticated {
-                       get { return Impl.IsAuthenticated; }
-               }
-
-               public bool IsMutuallyAuthenticated {
-                       get { return Impl.IsMutuallyAuthenticated; }
-               }
-
-               public bool IsEncrypted {
-                       get { return Impl.IsEncrypted; }
-               }
-
-               public bool IsSigned {
-                       get { return Impl.IsSigned; }
-               }
-
-               public bool IsServer {
-                       get { return Impl.IsServer; }
-               }
-
-               public CipherAlgorithmType CipherAlgorithm {
-                       get { return Impl.CipherAlgorithm; }
-               }
-
-               public int CipherStrength {
-                       get { return Impl.CipherStrength; }
-               }
-
-               public HashAlgorithmType HashAlgorithm {
-                       get { return Impl.HashAlgorithm; }
-               }
-
-               public int HashStrength {
-                       get { return Impl.HashStrength; }
-               }
-
-               public ExchangeAlgorithmType KeyExchangeAlgorithm {
-                       get { return Impl.KeyExchangeAlgorithm; }
-               }
-
-               public int KeyExchangeStrength {
-                       get { return KeyExchangeStrength; }
-               }
-
-               public bool CanRead {
-                       get { return Impl.CanRead; }
-               }
-
-               public bool CanTimeout {
-                       get { return Impl.CanTimeout; }
-               }
-
-               public bool CanWrite {
-                       get { return Impl.CanWrite; }
-               }
-
-               public long Length {
-                       get { return Impl.Length; }
-               }
-
-               public long Position {
-                       get { return Impl.Position; }
-               }
-
-               public void SetLength (long value)
-               {
-                       Impl.SetLength (value);
-               }
-
-               public AuthenticatedStream AuthenticatedStream {
-                       get { return Impl; }
-               }
-
-               public int ReadTimeout {
-                       get { return Impl.ReadTimeout; }
-                       set { Impl.ReadTimeout = value; }
-               }
-
-               public int WriteTimeout {
-                       get { return Impl.WriteTimeout; }
-                       set { Impl.WriteTimeout = value; }
-               }
-
-               public bool CheckCertRevocationStatus {
-                       get { return Impl.CheckCertRevocationStatus; }
-               }
-
-               public X509Certificate InternalLocalCertificate {
-                       get {
-                               try {
-                                       return LocalCertificate;
-                               } catch {
-                                       return null;
-                               }
-                       }
-               }
-
-               public X509Certificate LocalCertificate {
-                       get { return Impl.LocalCertificate; }
-               }
-
-               public X509Certificate RemoteCertificate {
-                       get { return Impl.RemoteCertificate; }
-               }
-
-               public SslProtocols SslProtocol {
-                       get { return Impl.SslProtocol; }
-               }
-
-               MSI.MonoTlsProvider MSI.IMonoSslStream.Provider {
-                       get { return provider; }
-               }
-
-               MSI.MonoTlsConnectionInfo MSI.IMonoSslStream.GetConnectionInfo ()
-               {
-                       return null;
-               }
-
-               void CheckDisposed ()
-               {
-                       if (impl == null)
-                               throw new ObjectDisposedException ("MonoSslStream");
-               }
-
-               public void Dispose ()
-               {
-                       Dispose (true);
-                       GC.SuppressFinalize (this);
-               }
-
-               protected void Dispose (bool disposing)
-               {
-                       if (impl != null && disposing) {
-                               impl.Dispose ();
-                               impl = null;
-                       }
-               }
-       }
-}
-
diff --git a/mcs/class/Mono.Security.Providers.DotNet/Mono.Security.Providers.DotNet/DotNetTlsProvider.cs b/mcs/class/Mono.Security.Providers.DotNet/Mono.Security.Providers.DotNet/DotNetTlsProvider.cs
deleted file mode 100644 (file)
index 3be685a..0000000
+++ /dev/null
@@ -1,118 +0,0 @@
-//
-// MonoDefaultTlsProvider.cs
-//
-// Author:
-//       Martin Baulig <martin.baulig@xamarin.com>
-//
-// Copyright (c) 2015 Xamarin, Inc.
-//
-// 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.IO;
-using System.Net;
-using System.Net.Security;
-using System.Security.Authentication;
-using System.Security.Cryptography.X509Certificates;
-using Mono.Security.Interface;
-
-namespace Mono.Security.Providers.DotNet
-{
-       /*
-        * This provider only uses the public .NET APIs from System.dll.
-        * 
-        * It is primarily intended for testing.
-        */
-       public class DotNetTlsProvider : MonoTlsProvider
-       {
-               static readonly Guid id = new Guid ("3a7b3a26-0dbd-4572-a5b8-fdce766bf0dd");
-
-               public override Guid ID {
-                       get { return id; }
-               }
-
-               public override string Name {
-                       get { return "dotnet"; }
-               }
-
-               public override bool SupportsSslStream {
-                       get { return true; }
-               }
-
-               public override bool SupportsConnectionInfo {
-                       get { return false; }
-               }
-
-               public override bool SupportsMonoExtensions {
-                       get { return false; }
-               }
-
-               internal override bool SupportsTlsContext {
-                       get { return false; }
-               }
-
-               public override SslProtocols SupportedProtocols {
-                       get { return (SslProtocols)ServicePointManager.SecurityProtocol; }
-               }
-
-               public override IMonoSslStream CreateSslStream (
-                       Stream innerStream, bool leaveInnerStreamOpen,
-                       MonoTlsSettings settings = null)
-               {
-                       if (settings != null)
-                               throw new NotSupportedException ("Mono-specific API Extensions not available.");
-
-                       RemoteCertificateValidationCallback validation_callback = null;
-                       LocalCertificateSelectionCallback selection_callback = null;
-
-                       if (settings != null) {
-                               validation_callback = ConvertCallback (settings.RemoteCertificateValidationCallback);
-                               selection_callback = ConvertCallback (settings.ClientCertificateSelectionCallback);
-                       }
-
-                       return new DotNetSslStreamImpl (innerStream, leaveInnerStreamOpen, this, validation_callback, selection_callback);
-               }
-
-               internal override IMonoTlsContext CreateTlsContext (
-                       string hostname, bool serverMode, TlsProtocols protocolFlags,
-                       X509Certificate serverCertificate, X509CertificateCollection clientCertificates,
-                       bool remoteCertRequired, MonoEncryptionPolicy encryptionPolicy,
-                       MonoTlsSettings settings)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               internal static RemoteCertificateValidationCallback ConvertCallback (MonoRemoteCertificateValidationCallback callback)
-               {
-                       if (callback == null)
-                               return null;
-
-                       return (s, c, ch, e) => callback (null, c, ch, (MonoSslPolicyErrors)e);
-               }
-
-               internal static LocalCertificateSelectionCallback ConvertCallback (MonoLocalCertificateSelectionCallback callback)
-               {
-                       if (callback == null)
-                               return null;
-
-                       return (s, t, lc, rc, ai) => callback (t, lc, rc, ai);
-               }
-
-       }
-}
-
diff --git a/mcs/class/Mono.Security.Providers.DotNet/Properties/AssemblyInfo.cs b/mcs/class/Mono.Security.Providers.DotNet/Properties/AssemblyInfo.cs
deleted file mode 100644 (file)
index cbbd002..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-//
-// AssemblyInfo.cs
-//
-// Author:
-//       Martin Baulig <martin.baulig@xamarin.com>
-//
-// Copyright (c) 2015 Xamarin, Inc.
-//
-// 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.Reflection;
-using System.Resources;
-using System.Security;
-using System.Security.Permissions;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about the system assembly
-
-[assembly: AssemblyVersion (Consts.FxVersion)]
-
-[assembly: AssemblyCompany ("MONO development team")]
-[assembly: AssemblyCopyright ("(c) 2015 Xamarin")]
-[assembly: AssemblyDescription ("Mono.Security.Providers.DotNet.dll")]
-[assembly: AssemblyProduct ("MONO CLI")]
-[assembly: AssemblyTitle ("Mono.Security.Providers.DotNet.dll")]
-[assembly: CLSCompliant (true)]
-[assembly: ComVisible (false)]
-[assembly: NeutralResourcesLanguage ("en-US")]
-
diff --git a/mcs/class/Mono.Security.Providers.DotNet/README.md b/mcs/class/Mono.Security.Providers.DotNet/README.md
deleted file mode 100644 (file)
index 4c47efd..0000000
+++ /dev/null
@@ -1 +0,0 @@
-See mcs/class/Mono.Security.Providers.NewSystemSource/README.md for a detailed README.
diff --git a/mcs/class/Mono.Security.Providers.NewSystemSource/Makefile b/mcs/class/Mono.Security.Providers.NewSystemSource/Makefile
deleted file mode 100644 (file)
index 61beeb4..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-thisdir = class/Mono.Security.Providers.NewSystemSource
-SUBDIRS = 
-include ../../build/rules.make
-
-LIB_REFS = System
-
-LIBRARY = Mono.Security.Providers.NewSystemSource.dll
-
-LIB_MCS_FLAGS = -d:SECURITY_DEP \
-       -unsafe -nowarn:1030 -keyfile:../mono.pub -delaysign -d:MONO -d:FEATURE_PAL -d:MONO_FEATURE_NEW_TLS \
-       -d:MONO_FEATURE_NEW_SYSTEM_SOURCE -d:DISABLE_CAS_USE
-
-ifdef MOBILE_PROFILE
-LIB_REFS += Mono.Security
-else
-LIB_REFS += MonoSecurity=Mono.Security
-LIB_MCS_FLAGS += -d:MONO_SECURITY_ALIAS
-endif
-
-EXTRA_DISTFILES = README.md
-
-include ../../build/library.make
-
-$(the_lib): ../Mono.Security/Makefile
diff --git a/mcs/class/Mono.Security.Providers.NewSystemSource/Mono.Security.Providers.NewSystemSource-net_4_x.csproj b/mcs/class/Mono.Security.Providers.NewSystemSource/Mono.Security.Providers.NewSystemSource-net_4_x.csproj
deleted file mode 100644 (file)
index 771d99f..0000000
+++ /dev/null
@@ -1,126 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>\r
-<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
-  <PropertyGroup>\r
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
-    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>\r
-    <ProductVersion>9.0.30729</ProductVersion>\r
-    <SchemaVersion>2.0</SchemaVersion>\r
-    <ProjectGuid>{0BB4541F-9B1A-4CBC-BEB1-00B31B37F74E}</ProjectGuid>\r
-    <OutputType>Library</OutputType>\r
-    <NoWarn>1699,1030</NoWarn>\r
-    <OutputPath>./../../class/lib/net_4_x</OutputPath>\r
-    <IntermediateOutputPath>obj-net_4_x</IntermediateOutputPath>\r
-    <GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>\r
-    <NoStdLib>True</NoStdLib>\r
-    \r
-    <NoConfig>True</NoConfig>\r
-    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>\r
-    <AppDesignerFolder>Properties</AppDesignerFolder>\r
-    <RootNamespace>\r
-    </RootNamespace>\r
-    <AssemblyName>Mono.Security.Providers.NewSystemSource</AssemblyName>\r
-    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
-    <FileAlignment>512</FileAlignment>\r
-  </PropertyGroup>\r
-    <PropertyGroup>\r
-    <SignAssembly>true</SignAssembly>\r
-    <DelaySign>true</DelaySign>\r
-  </PropertyGroup>\r
-  <PropertyGroup>\r
-    <AssemblyOriginatorKeyFile>../mono.pub</AssemblyOriginatorKeyFile>\r
-  </PropertyGroup>\r
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
-    <DebugSymbols>true</DebugSymbols>\r
-    <DebugType>full</DebugType>\r
-    <NoWarn>1699,1030</NoWarn>\r
-    <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;SECURITY_DEP;MONO;FEATURE_PAL;MONO_FEATURE_NEW_TLS;MONO_FEATURE_NEW_SYSTEM_SOURCE;DISABLE_CAS_USE;MONO_SECURITY_ALIAS</DefineConstants>\r
-    <ErrorReport>prompt</ErrorReport>\r
-    <WarningLevel>4</WarningLevel>\r
-  </PropertyGroup>\r
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">\r
-    <DebugType>pdbonly</DebugType>\r
-    <NoWarn>1699,1030</NoWarn>\r
-    <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;SECURITY_DEP;MONO;FEATURE_PAL;MONO_FEATURE_NEW_TLS;MONO_FEATURE_NEW_SYSTEM_SOURCE;DISABLE_CAS_USE;MONO_SECURITY_ALIAS</DefineConstants>\r
-    <ErrorReport>prompt</ErrorReport>\r
-    <WarningLevel>4</WarningLevel>\r
-  </PropertyGroup>\r
-  <!-- Set AddAdditionalExplicitAssemblyReferences to false, otherwise if targetting .NET4.0, \r
-  Microsoft.NETFramework.props will force a dependency on the assembly System.Core. This\r
-  is a problem to compile the Mono mscorlib.dll -->\r
-  <PropertyGroup>\r
-    <AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>\r
-  </PropertyGroup>\r
-  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />\r
-  <ItemGroup>\r
-    <Compile Include="..\..\build\common\Consts.cs" />\r
-    <Compile Include="..\..\build\common\Locale.cs" />\r
-    <Compile Include="..\..\build\common\SR.cs" />\r
-    <Compile Include="..\referencesource\mscorlib\InternalApis\NDP_Common\inc\PinnableBufferCache.cs" />\r
-    <Compile Include="..\referencesource\System\net\System\Net\_LazyAsyncResult.cs" />\r
-    <Compile Include="..\referencesource\System\net\System\Net\_LoggingObject.cs" />\r
-    <Compile Include="..\referencesource\System\net\System\Net\_NTAuthentication.cs" />\r
-    <Compile Include="..\referencesource\System\net\System\Net\_SecureChannel.cs" />\r
-    <Compile Include="..\referencesource\System\net\System\Net\_SslSessionsCache.cs" />\r
-    <Compile Include="..\referencesource\System\net\System\Net\Logging.cs" />\r
-    <Compile Include="..\referencesource\System\net\System\Net\SecureProtocols\_FixedSizeReader.cs" />\r
-    <Compile Include="..\referencesource\System\net\System\Net\SecureProtocols\_HelperAsyncResults.cs" />\r
-    <Compile Include="..\referencesource\System\net\System\Net\SecureProtocols\_SslState.cs" />\r
-    <Compile Include="..\referencesource\System\net\System\Net\SecureProtocols\_SslStream.cs" />\r
-    <Compile Include="..\referencesource\System\net\System\Net\SecureProtocols\SslStream.cs" />\r
-    <Compile Include="..\System\Mono.Net.Security\CallbackHelpers.cs" />\r
-    <Compile Include="..\System\Mono.Net.Security\IMonoTlsProvider.cs" />\r
-    <Compile Include="..\System\Mono.Net.Security\MonoTlsProviderFactory.cs" />\r
-    <Compile Include="..\System\Mono.Net.Security\MonoTlsProviderWrapper.cs" />\r
-    <Compile Include="..\System\ReferenceSources\_SecureChannel.cs" />\r
-    <Compile Include="..\System\ReferenceSources\_SslState.cs" />\r
-    <Compile Include="..\System\ReferenceSources\_SslStream.cs" />\r
-    <Compile Include="..\System\ReferenceSources\Internal.cs" />\r
-    <Compile Include="..\System\ReferenceSources\SR.cs" />\r
-    <Compile Include="..\System\ReferenceSources\SR2.cs" />\r
-    <Compile Include="..\System\ReferenceSources\SslStream.cs" />\r
-    <Compile Include="..\System\ReferenceSources\SSPIConfiguration.cs" />\r
-    <Compile Include="..\System\ReferenceSources\SSPISafeHandles.cs" />\r
-    <Compile Include="..\System\ReferenceSources\SSPIWrapper.cs" />\r
-    <Compile Include=".\Properties\AssemblyInfo.cs" />\r  </ItemGroup>\r
-  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \r
-       Other similar extension points exist, see Microsoft.Common.targets.\r
-  <Target Name="BeforeBuild">\r
-  </Target>\r
-  <Target Name="AfterBuild">\r
-  </Target>\r
-  -->\r
-  <PropertyGroup>\r
-    <PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
-
-    </PreBuildEvent>\r
-    <PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">\r
-\r
-    </PreBuildEvent>\r
-    <PostBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
-
-    </PostBuildEvent>\r
-    <PostBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">\r
-\r
-    </PostBuildEvent>\r
-  </PropertyGroup>\r
-  <ItemGroup>\r
-    <ProjectReference Include="../corlib/corlib-net_4_x.csproj">\r
-      <Project>{2CA6026B-2DC8-4C4C-A12C-1E8234049DB7}</Project>\r
-      <Name>corlib-net_4_x</Name>\r
-    </ProjectReference>\r
-    <ProjectReference Include="../System/System-net_4_x.csproj">\r
-      <Project>{2762E921-91A8-4C87-91E9-BA628013F753}</Project>\r
-      <Name>System-net_4_x</Name>\r
-    </ProjectReference>\r
-    <ProjectReference Include="../Mono.Security/Mono.Security-net_4_x.csproj">\r
-      <Project>{42D59DE7-586F-4ACF-BDD5-E7869E39E3EF}</Project>\r
-      <Name>Mono.Security-net_4_x</Name>\r
-      <Aliases>MonoSecurity</Aliases>    </ProjectReference>\r
-  </ItemGroup>\r
-  <ItemGroup>\r
-    <Folder Include="Properties\" />\r
-  </ItemGroup>\r
-</Project>\r
-
diff --git a/mcs/class/Mono.Security.Providers.NewSystemSource/Mono.Security.Providers.NewSystemSource.dll.sources b/mcs/class/Mono.Security.Providers.NewSystemSource/Mono.Security.Providers.NewSystemSource.dll.sources
deleted file mode 100644 (file)
index c0765d5..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-./Properties/AssemblyInfo.cs
-../../build/common/SR.cs
-../../build/common/Consts.cs
-../../build/common/Locale.cs
-
-../referencesource/System/net/System/Net/Logging.cs
-../referencesource/System/net/System/Net/_SslSessionsCache.cs
-../referencesource/System/net/System/Net/_LazyAsyncResult.cs
-../referencesource/System/net/System/Net/_LoggingObject.cs
-../referencesource/System/net/System/Net/_NTAuthentication.cs
-../referencesource/System/net/System/Net/_SecureChannel.cs
-../referencesource/System/net/System/Net/SecureProtocols/SslStream.cs
-../referencesource/System/net/System/Net/SecureProtocols/_SslState.cs
-../referencesource/System/net/System/Net/SecureProtocols/_SslStream.cs
-../referencesource/System/net/System/Net/SecureProtocols/_FixedSizeReader.cs
-../referencesource/System/net/System/Net/SecureProtocols/_HelperAsyncResults.cs
-../referencesource/mscorlib/InternalApis/NDP_Common/inc/PinnableBufferCache.cs
-
-../System/ReferenceSources/SR.cs
-../System/ReferenceSources/SR2.cs
-../System/ReferenceSources/Internal.cs
-../System/ReferenceSources/SSPIWrapper.cs
-../System/ReferenceSources/SSPISafeHandles.cs
-../System/ReferenceSources/SslStream.cs
-../System/ReferenceSources/_SslState.cs
-../System/ReferenceSources/_SslStream.cs
-../System/ReferenceSources/_SecureChannel.cs
-../System/ReferenceSources/SSPIConfiguration.cs
-../System/Mono.Net.Security/CallbackHelpers.cs
-../System/Mono.Net.Security/IMonoTlsProvider.cs
-../System/Mono.Net.Security/MonoTlsProviderFactory.cs
-../System/Mono.Net.Security/MonoTlsProviderWrapper.cs
-
diff --git a/mcs/class/Mono.Security.Providers.NewSystemSource/Properties/AssemblyInfo.cs b/mcs/class/Mono.Security.Providers.NewSystemSource/Properties/AssemblyInfo.cs
deleted file mode 100644 (file)
index 23ba5bb..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-//
-// AssemblyInfo.cs
-//
-// Author:
-//       Martin Baulig <martin.baulig@xamarin.com>
-//
-// Copyright (c) 2015 Xamarin, Inc.
-//
-// 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.Reflection;
-using System.Resources;
-using System.Security;
-using System.Security.Permissions;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about the system assembly
-
-[assembly: AssemblyVersion (Consts.FxVersion)]
-
-[assembly: AssemblyCompany ("MONO development team")]
-[assembly: AssemblyCopyright ("(c) 2015 Xamarin")]
-[assembly: AssemblyDescription ("Mono.Security.Providers.NewSystemSource.dll")]
-[assembly: AssemblyProduct ("MONO CLI")]
-[assembly: AssemblyTitle ("Mono.Security.Providers.NewSystemSource.dll")]
-[assembly: CLSCompliant (true)]
-[assembly: ComVisible (false)]
-[assembly: NeutralResourcesLanguage ("en-US")]
-
-[assembly: InternalsVisibleTo ("Mono.Security.Providers.NewTls, PublicKey=002400000480000094000000060200000024000052534131000400001100000003336d6aed41624ca156ab579881fe90a576f1dfec48378fc94e4e440f4556776224e2d70c18996d91f36227f539fdb44340e07651f1455a489b29a7e6219a8f85e52b0f8588b4f8a857746a8468d37b556223d1452f3fcbaf0f269cdf1900ceb68f69485dc5887750d19571030c732331e00387d9b813a9ad52891087301793")]
-[assembly: InternalsVisibleTo ("Mono.Security.Providers.NewTls, PublicKey=002400000480000094000000060200000024000052534131000400000100010079159977d2d03a8e6bea7a2e74e8d1afcc93e8851974952bb480a12c9134474d04062447c37e0e68c080536fcf3c3fbe2ff9c979ce998475e506e8ce82dd5b0f350dc10e93bf2eeecf874b24770c5081dbea7447fddafa277b22de47d6ffea449674a4f9fccf84d15069089380284dbdd35f46cdff12a1bd78e4ef0065d016df")]
diff --git a/mcs/class/Mono.Security.Providers.NewSystemSource/README.md b/mcs/class/Mono.Security.Providers.NewSystemSource/README.md
deleted file mode 100644 (file)
index 03447c0..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-Mono.Security.Interface / Mono.Security.Providers
-=================================================
-
-This is not a public API yet, but will eventually become public.
-
-
-Mono.Security.Interface
------------------------
-
-`Mono.Security.Interface` provides an abstraction layer for the TLS
-APIs that are currently being used by Mono's class libraries.
-
-The main API entry points are `MonoTlsProviderFactory.GetProvider()`
-and `MonoTlsProviderFactory.InstallProvider()`.
-
-Mono.Net.Security
------------------
-
-`Mono.Net.Security` provides the internal implementation and lives
-inside `System.dll` as private and internal APIs.  `Mono.Security.dll`
-uses reflection to access these.
-
-On Mobile, the `Mono.Security.Interface` APIs are included as public
-APIs in `System.dll`.
-
-Mono.Security.Providers
------------------------
-
-Implementations of the `Mono.Security.Interface.MonoTlsProvider` class
-to provide TLS functionality.
-
-The default provider is inside `System.dll` - it will be used automatically
-if you don't explicitly install a custom provider, so simply call
-`MonoTlsProviderFactory.GetProvider()` to use it.
-
-* DotNet:
-  Provides the default `SslStream` implementation from `System.dll`, only using
-  public .NET types.
-  
-* NewSystemSource:
-  Compiles several referencesource files which would normally live inside
-  `System.dll` if we compiled it with their `SslStream` implementation.
-  
-  This allows to keep the code in `System.dll` as-is, while still providing the
-  new `SslStream`, which will be required by the new TLS code.
-  
-  `System.dll` needs to make its internals visible and we're using several compiler /
-  external alias tricks in here to make this work.
-  
-  In this configuration, `MONO_SYSTEM_ALIAS`, `MONO_FEATURE_NEW_TLS` and
-  `MONO_FEATURE_NEW_SYSTEM_SOURCE` (defining conditional for this configuration)
-  are defined.  We do not define `MONO_X509_ALIAS here`.
-  
-The `Mono.Security.Providers.DotNet` and `Mono.Security.Providers.NewSystemSource` directory is currently
-enabled in the top-level `Makefile`, but the resulting binaries should only be used to test the new TLS
-code and not shipped as stable APIs.
-
-Pending changes
----------------
-
-This code is not actually being used in `System.dll` yet.  I have some
-local changes which will switch the existing code in `WebClient`,
-`SmptClient` and `FtpWebRequest` over, but these need to be carefully
-tested.
-
-At the moment, this work branch only provides new code and build
-changes, which shuffle some stuff around.  There are also several
-new files which are conditional and not actually being built by
-default.
-
-Build Configurations
---------------------
-
-* Normal build:
-  Builds everything as before with some new APIs added, but without
-  modifying any existing functionality.
-  
-* Build with the `newtls` profile:
-  Builds `System.dll` with the new `SslStream` implementation from the
-  referencesource.  This is currently a "build then throw away" profile
-  and not enabled from the top-level Makefile.  The resulting `System.dll`
-  won't actually work at runtime since it's missing the new TLS code;
-  building it helps find problems and ensures that it will actually
-  be possible to build this once we deploy it.
-
-* Mono.Security.Providers:
-  The new TLS code requires the newly built `System` and `Mono.Security.Providers.NewSystemSource`
-  from this branch installed in the system.  It is recommended to install it
-  into a custom prefix and set that as custom runtime in Xamarin Studio.
-
-
-Last changed March 07th, 2015,
-Martin Baulig <martin.baulig@xamarin.com>
-
-
diff --git a/mcs/class/Mono.Security.Providers.NewTls/Makefile b/mcs/class/Mono.Security.Providers.NewTls/Makefile
deleted file mode 100644 (file)
index 54270bc..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-thisdir = class/Mono.Security.Providers.NewTls
-SUBDIRS = 
-include ../../build/rules.make
-
-LIBRARY = Mono.Security.Providers.NewTls.dll
-LIB_REFS = System NewSystemSource=Mono.Security.Providers.NewSystemSource Mono.Security
-LIB_MCS_FLAGS = -unsafe -nowarn:1030 -keyfile:../mono.pub -delaysign
-
-include ../../build/library.make
-
-$(the_lib): ../Mono.Security/Makefile
-
diff --git a/mcs/class/Mono.Security.Providers.NewTls/Mono.Security.Providers.NewTls-net_4_x.csproj b/mcs/class/Mono.Security.Providers.NewTls/Mono.Security.Providers.NewTls-net_4_x.csproj
deleted file mode 100644 (file)
index 158b095..0000000
+++ /dev/null
@@ -1,111 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>\r
-<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
-  <PropertyGroup>\r
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
-    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>\r
-    <ProductVersion>9.0.30729</ProductVersion>\r
-    <SchemaVersion>2.0</SchemaVersion>\r
-    <ProjectGuid>{C8B8E524-BB3A-44E2-8C22-E3313E9F477C}</ProjectGuid>\r
-    <OutputType>Library</OutputType>\r
-    <NoWarn>1699,1030</NoWarn>\r
-    <OutputPath>./../../class/lib/net_4_x</OutputPath>\r
-    <IntermediateOutputPath>obj-net_4_x</IntermediateOutputPath>\r
-    <GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>\r
-    <NoStdLib>True</NoStdLib>\r
-    \r
-    <NoConfig>True</NoConfig>\r
-    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>\r
-    <AppDesignerFolder>Properties</AppDesignerFolder>\r
-    <RootNamespace>\r
-    </RootNamespace>\r
-    <AssemblyName>Mono.Security.Providers.NewTls</AssemblyName>\r
-    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
-    <FileAlignment>512</FileAlignment>\r
-  </PropertyGroup>\r
-    <PropertyGroup>\r
-    <SignAssembly>true</SignAssembly>\r
-    <DelaySign>true</DelaySign>\r
-  </PropertyGroup>\r
-  <PropertyGroup>\r
-    <AssemblyOriginatorKeyFile>../mono.pub</AssemblyOriginatorKeyFile>\r
-  </PropertyGroup>\r
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
-    <DebugSymbols>true</DebugSymbols>\r
-    <DebugType>full</DebugType>\r
-    <NoWarn>1699,1030</NoWarn>\r
-    <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
-    <ErrorReport>prompt</ErrorReport>\r
-    <WarningLevel>4</WarningLevel>\r
-  </PropertyGroup>\r
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">\r
-    <DebugType>pdbonly</DebugType>\r
-    <NoWarn>1699,1030</NoWarn>\r
-    <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
-    <ErrorReport>prompt</ErrorReport>\r
-    <WarningLevel>4</WarningLevel>\r
-  </PropertyGroup>\r
-  <!-- Set AddAdditionalExplicitAssemblyReferences to false, otherwise if targetting .NET4.0, \r
-  Microsoft.NETFramework.props will force a dependency on the assembly System.Core. This\r
-  is a problem to compile the Mono mscorlib.dll -->\r
-  <PropertyGroup>\r
-    <AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>\r
-  </PropertyGroup>\r
-  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />\r
-  <ItemGroup>\r
-    <Compile Include="..\..\build\common\Consts.cs" />\r
-    <Compile Include="..\..\build\common\Locale.cs" />\r
-    <Compile Include="..\..\build\common\SR.cs" />\r
-    <Compile Include=".\Mono.Security.Providers.NewTls\ITlsConfiguration.cs" />\r
-    <Compile Include=".\Mono.Security.Providers.NewTls\ITlsContext.cs" />\r
-    <Compile Include=".\Mono.Security.Providers.NewTls\MonoNewTlsStream.cs" />\r
-    <Compile Include=".\Mono.Security.Providers.NewTls\MonoNewTlsStreamFactory.cs" />\r
-    <Compile Include=".\Mono.Security.Providers.NewTls\NewTlsProvider.cs" />\r
-    <Compile Include=".\Mono.Security.Providers.NewTls\TlsContextWrapper.cs" />\r
-    <Compile Include=".\Mono.Security.Providers.NewTls\TlsProviderFactory.cs" />\r
-    <Compile Include=".\Properties\AssemblyInfo.cs" />\r  </ItemGroup>\r
-  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \r
-       Other similar extension points exist, see Microsoft.Common.targets.\r
-  <Target Name="BeforeBuild">\r
-  </Target>\r
-  <Target Name="AfterBuild">\r
-  </Target>\r
-  -->\r
-  <PropertyGroup>\r
-    <PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
-
-    </PreBuildEvent>\r
-    <PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">\r
-\r
-    </PreBuildEvent>\r
-    <PostBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
-
-    </PostBuildEvent>\r
-    <PostBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">\r
-\r
-    </PostBuildEvent>\r
-  </PropertyGroup>\r
-  <ItemGroup>\r
-    <ProjectReference Include="../corlib/corlib-net_4_x.csproj">\r
-      <Project>{2CA6026B-2DC8-4C4C-A12C-1E8234049DB7}</Project>\r
-      <Name>corlib-net_4_x</Name>\r
-    </ProjectReference>\r
-    <ProjectReference Include="../System/System-net_4_x.csproj">\r
-      <Project>{2762E921-91A8-4C87-91E9-BA628013F753}</Project>\r
-      <Name>System-net_4_x</Name>\r
-    </ProjectReference>\r
-    <ProjectReference Include="../Mono.Security/Mono.Security-net_4_x.csproj">\r
-      <Project>{42D59DE7-586F-4ACF-BDD5-E7869E39E3EF}</Project>\r
-      <Name>Mono.Security-net_4_x</Name>\r
-    </ProjectReference>\r
-    <ProjectReference Include="../Mono.Security.Providers.NewSystemSource/Mono.Security.Providers.NewSystemSource-net_4_x.csproj">\r
-      <Project>{0BB4541F-9B1A-4CBC-BEB1-00B31B37F74E}</Project>\r
-      <Name>Mono.Security.Providers.NewSystemSource-net_4_x</Name>\r
-      <Aliases>NewSystemSource</Aliases>    </ProjectReference>\r
-  </ItemGroup>\r
-  <ItemGroup>\r
-    <Folder Include="Properties\" />\r
-  </ItemGroup>\r
-</Project>\r
-
diff --git a/mcs/class/Mono.Security.Providers.NewTls/Mono.Security.Providers.NewTls.dll.sources b/mcs/class/Mono.Security.Providers.NewTls/Mono.Security.Providers.NewTls.dll.sources
deleted file mode 100644 (file)
index 12d8a20..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-./Properties/AssemblyInfo.cs
-../../build/common/SR.cs
-../../build/common/Consts.cs
-../../build/common/Locale.cs
-
-./Mono.Security.Providers.NewTls/ITlsConfiguration.cs
-./Mono.Security.Providers.NewTls/ITlsContext.cs
-
-./Mono.Security.Providers.NewTls/MonoNewTlsStream.cs
-./Mono.Security.Providers.NewTls/MonoNewTlsStreamFactory.cs
-./Mono.Security.Providers.NewTls/NewTlsProvider.cs
-./Mono.Security.Providers.NewTls/TlsContextWrapper.cs
-./Mono.Security.Providers.NewTls/TlsProviderFactory.cs
diff --git a/mcs/class/Mono.Security.Providers.NewTls/Mono.Security.Providers.NewTls/ITlsConfiguration.cs b/mcs/class/Mono.Security.Providers.NewTls/Mono.Security.Providers.NewTls/ITlsConfiguration.cs
deleted file mode 100644 (file)
index 401afd7..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-//
-// ITlsContext.cs
-//
-// Author:
-//       Martin Baulig <martin.baulig@xamarin.com>
-//
-// Copyright (c) 2015-2016 Xamarin, Inc.
-//
-// 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.Security.Cryptography;
-
-using Mono.Security.Interface;
-using MX = Mono.Security.X509;
-
-namespace Mono.Security.Providers.NewTls
-{
-       interface ITlsConfiguration
-       {
-               bool HasCredentials {
-                       get;
-               }
-
-               void SetCertificate (MX.X509Certificate certificate, AsymmetricAlgorithm privateKey);
-
-               bool? AskForClientCertificate {
-                       get; set;
-               }
-       }
-}
diff --git a/mcs/class/Mono.Security.Providers.NewTls/Mono.Security.Providers.NewTls/ITlsContext.cs b/mcs/class/Mono.Security.Providers.NewTls/Mono.Security.Providers.NewTls/ITlsContext.cs
deleted file mode 100644 (file)
index 0d69805..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-//
-// ITlsContext.cs
-//
-// Author:
-//       Martin Baulig <martin.baulig@xamarin.com>
-//
-// Copyright (c) 2015-2016 Xamarin, Inc.
-//
-// 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.
-
-extern alias NewSystemSource;
-
-using System;
-using System.Security.Cryptography;
-
-using Mono.Security.Interface;
-using MX = Mono.Security.X509;
-
-namespace Mono.Security.Providers.NewTls
-{
-       interface ITlsContext : IDisposable
-       {
-               bool IsValid {
-                       get;
-               }
-
-               TlsException LastError {
-                       get;
-               }
-
-               bool ReceivedCloseNotify {
-                       get;
-               }
-
-               MonoTlsConnectionInfo ConnectionInfo {
-                       get;
-               }
-
-               MX.X509Certificate GetRemoteCertificate (out MX.X509CertificateCollection remoteCertificateStore);
-
-               bool VerifyRemoteCertificate ();
-
-               int GenerateNextToken (TlsBuffer incoming, TlsMultiBuffer outgoing);
-
-               int DecryptMessage (ref TlsBuffer incoming);
-
-               int EncryptMessage (ref TlsBuffer incoming);
-
-               byte[] CreateAlert (Alert alert);
-
-               byte[] CreateHelloRequest ();
-       }
-}
-
diff --git a/mcs/class/Mono.Security.Providers.NewTls/Mono.Security.Providers.NewTls/MonoNewTlsStream.cs b/mcs/class/Mono.Security.Providers.NewTls/Mono.Security.Providers.NewTls/MonoNewTlsStream.cs
deleted file mode 100644 (file)
index 6117f0f..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-//
-// MonoNewTlsStream.cs
-//
-// Author:
-//       Martin Baulig <martin.baulig@xamarin.com>
-//
-// Copyright (c) 2015 Xamarin, Inc.
-//
-// 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.
-
-extern alias NewSystemSource;
-
-using EncryptionPolicy = NewSystemSource::System.Net.Security.EncryptionPolicy;
-using LocalCertificateSelectionCallback = NewSystemSource::System.Net.Security.LocalCertificateSelectionCallback;
-using RemoteCertificateValidationCallback = NewSystemSource::System.Net.Security.RemoteCertificateValidationCallback;
-using SslStream = NewSystemSource::System.Net.Security.SslStream;
-
-using System;
-using System.IO;
-using System.Threading.Tasks;
-
-using MSI = Mono.Security.Interface;
-
-using XAuthenticatedStream = System.Net.Security.AuthenticatedStream;
-using System.Security.Cryptography.X509Certificates;
-
-namespace Mono.Security.Providers.NewTls
-{
-       public class MonoNewTlsStream : SslStream, MSI.IMonoSslStream
-       {
-               MSI.MonoTlsProvider provider;
-
-               internal MonoNewTlsStream (Stream innerStream, MSI.MonoTlsProvider provider, MSI.MonoTlsSettings settings)
-                       : this (innerStream, false, provider, settings)
-               {
-               }
-
-               internal MonoNewTlsStream (Stream innerStream, bool leaveOpen, MSI.MonoTlsProvider provider, MSI.MonoTlsSettings settings)
-                       : base (innerStream, leaveOpen, EncryptionPolicy.RequireEncryption, provider, settings)
-               {
-                       this.provider = provider;
-               }
-
-               public MSI.MonoTlsProvider Provider {
-                       get { return provider; }
-               }
-
-               new public bool IsClosed {
-                       get { return base.IsClosed; }
-               }
-
-               public MSI.MonoTlsConnectionInfo GetConnectionInfo ()
-               {
-                       return GetMonoConnectionInfo ();
-               }
-
-               public Task Shutdown ()
-               {
-                       return Task.Factory.FromAsync ((state, result) => BeginShutdown (state, result), EndShutdown, null);
-               }
-
-               public Task RequestRenegotiation ()
-               {
-                       return Task.Factory.FromAsync ((state, result) => BeginRenegotiate (state, result), EndRenegotiate, null);
-               }
-
-                X509Certificate MSI.IMonoSslStream.InternalLocalCertificate {
-                       get { return InternalLocalCertificate; }
-               }
-
-               XAuthenticatedStream MSI.IMonoSslStream.AuthenticatedStream {
-                       get { return this; }
-               }
-       }
-}
-
-
diff --git a/mcs/class/Mono.Security.Providers.NewTls/Mono.Security.Providers.NewTls/MonoNewTlsStreamFactory.cs b/mcs/class/Mono.Security.Providers.NewTls/Mono.Security.Providers.NewTls/MonoNewTlsStreamFactory.cs
deleted file mode 100644 (file)
index d39f1bb..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-//
-// MonoNewTlsStreamFactory.cs
-//
-// Author:
-//       Martin Baulig <martin.baulig@xamarin.com>
-//
-// Copyright (c) 2015 Xamarin, Inc.
-//
-// 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.
-
-extern alias NewSystemSource;
-
-using XEncryptionPolicy = NewSystemSource::System.Net.Security.EncryptionPolicy;
-using XSslPolicyErrors = NewSystemSource::System.Net.Security.SslPolicyErrors;
-using XLocalCertificateSelectionCallback = NewSystemSource::System.Net.Security.LocalCertificateSelectionCallback;
-using XRemoteCertificateValidationCallback = NewSystemSource::System.Net.Security.RemoteCertificateValidationCallback;
-
-using System;
-using System.IO;
-using System.Net.Security;
-using System.Security.Authentication;
-
-using Mono.Security.Interface;
-
-using PSSCX = System.Security.Cryptography.X509Certificates;
-using SSCX = System.Security.Cryptography.X509Certificates;
-
-namespace Mono.Security.Providers.NewTls
-{
-       public static class MonoNewTlsStreamFactory
-       {
-               internal static IMonoSslStream CreateSslStream (
-                       Stream innerStream, bool leaveInnerStreamOpen,
-                       MonoTlsProvider provider, MonoTlsSettings settings = null)
-               {
-                       return new MonoNewTlsStream (innerStream, leaveInnerStreamOpen, provider, settings);
-               }
-
-               public static MonoNewTlsStream CreateServer (
-                       Stream innerStream, bool leaveOpen, MonoTlsProvider provider, MonoTlsSettings settings,
-                       SSCX.X509Certificate serverCertificate, bool clientCertificateRequired,
-                       SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
-               {
-                       var stream = new MonoNewTlsStream (innerStream, leaveOpen, provider, settings);
-
-                       try {
-                               stream.AuthenticateAsServer (serverCertificate, clientCertificateRequired, enabledSslProtocols, checkCertificateRevocation);
-                       } catch (Exception ex) {
-                               var tlsEx = stream.LastError;
-                               if (tlsEx != null)
-                                       throw new AggregateException (ex, tlsEx);
-                               throw;
-                       }
-
-                       return stream;
-               }
-
-               public static MonoNewTlsStream CreateClient (
-                       Stream innerStream, bool leaveOpen, MonoTlsProvider provider, MonoTlsSettings settings,
-                       string targetHost, PSSCX.X509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
-               {
-                       var stream = new MonoNewTlsStream (innerStream, leaveOpen, provider, settings);
-
-                       try {
-                               stream.AuthenticateAsClient (targetHost, clientCertificates, enabledSslProtocols, checkCertificateRevocation);
-                       } catch (Exception ex) {
-                               var tlsEx = stream.LastError;
-                               if (tlsEx != null)
-                                       throw new AggregateException (ex, tlsEx);
-                               throw;
-                       }
-                       return stream;
-               }
-       }
-}
diff --git a/mcs/class/Mono.Security.Providers.NewTls/Mono.Security.Providers.NewTls/NewTlsProvider.cs b/mcs/class/Mono.Security.Providers.NewTls/Mono.Security.Providers.NewTls/NewTlsProvider.cs
deleted file mode 100644 (file)
index e2b347f..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-//
-// NewTlsProvider.cs
-//
-// Author:
-//       Martin Baulig <martin.baulig@xamarin.com>
-//
-// Copyright (c) 2015 Xamarin, Inc.
-//
-// 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.
-
-extern alias NewSystemSource;
-
-using System;
-using System.IO;
-using System.Net;
-using System.Net.Security;
-using System.Security.Authentication;
-
-using MSI = Mono.Security.Interface;
-using MX = Mono.Security.X509;
-
-using PSSCX = System.Security.Cryptography.X509Certificates;
-using SSCX = System.Security.Cryptography.X509Certificates;
-
-namespace Mono.Security.Providers.NewTls
-{
-       public class NewTlsProvider : MSI.MonoTlsProvider
-       {
-               static readonly Guid id = new Guid ("e5ff34f1-8b7a-4aa6-aff9-24719d709693");
-
-               public override Guid ID {
-                       get { return id; }
-               }
-
-               public override string Name {
-                       get { return "newtls"; }
-               }
-
-               public override bool SupportsSslStream {
-                       get { return true; }
-               }
-
-               public override bool SupportsConnectionInfo {
-                       get { return true; }
-               }
-
-               public override bool SupportsMonoExtensions {
-                       get { return true; }
-               }
-
-               internal override bool SupportsTlsContext {
-                       get { return true; }
-               }
-
-               public override SslProtocols SupportedProtocols {
-                       get { return SslProtocols.Tls12 | SslProtocols.Tls11 | SslProtocols.Tls; }
-               }
-
-               public override MSI.IMonoSslStream CreateSslStream (
-                       Stream innerStream, bool leaveInnerStreamOpen,
-                       MSI.MonoTlsSettings settings = null)
-               {
-                       return MonoNewTlsStreamFactory.CreateSslStream (innerStream, leaveInnerStreamOpen, this, settings);
-               }
-
-               internal override MSI.IMonoTlsContext CreateTlsContext (
-                       string hostname, bool serverMode, MSI.TlsProtocols protocolFlags,
-                       SSCX.X509Certificate serverCertificate, PSSCX.X509CertificateCollection clientCertificates,
-                       bool remoteCertRequired, MSI.MonoEncryptionPolicy encryptionPolicy,
-                       MSI.MonoTlsSettings settings)
-               {
-                       var config = TlsProviderFactory.CreateTlsConfiguration (
-                               hostname, serverMode, protocolFlags, serverCertificate,
-                               remoteCertRequired, settings);
-                       return new TlsContextWrapper (config, serverMode);
-               }
-       }
-}
-
diff --git a/mcs/class/Mono.Security.Providers.NewTls/Mono.Security.Providers.NewTls/TlsContextWrapper.cs b/mcs/class/Mono.Security.Providers.NewTls/Mono.Security.Providers.NewTls/TlsContextWrapper.cs
deleted file mode 100644 (file)
index 389dd1a..0000000
+++ /dev/null
@@ -1,221 +0,0 @@
-//
-// TlsContextWrapper.cs
-//
-// Author:
-//       Martin Baulig <martin.baulig@xamarin.com>
-//
-// Copyright (c) 2015 Xamarin, Inc.
-//
-// 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.
-
-extern alias NewSystemSource;
-
-using System;
-using System.Security.Cryptography;
-
-using SSCX = System.Security.Cryptography.X509Certificates;
-using PSSCX = System.Security.Cryptography.X509Certificates;
-
-using MSI = Mono.Security.Interface;
-using MX = Mono.Security.X509;
-
-namespace Mono.Security.Providers.NewTls
-{
-       class TlsContextWrapper : IDisposable, MSI.IMonoTlsContext
-       {
-               ITlsConfiguration config;
-               ITlsContext context;
-               bool serverMode;
-
-               public TlsContextWrapper (ITlsConfiguration config, bool serverMode)
-               {
-                       this.config = config;
-                       this.serverMode = serverMode;
-               }
-
-               public bool IsServer {
-                       get { return serverMode; }
-               }
-
-               public bool IsValid {
-                       get { return context != null && context.IsValid; }
-               }
-
-               public void Initialize (MSI.IMonoTlsEventSink eventSink)
-               {
-                       if (context != null)
-                               throw new InvalidOperationException ();
-                       context = TlsProviderFactory.CreateTlsContext (config, serverMode, eventSink);
-               }
-
-               void Clear ()
-               {
-                       if (context != null) {
-                               context.Dispose ();
-                               context = null;
-                       }
-               }
-
-               public ITlsConfiguration Configuration {
-                       get {
-                               if (config == null)
-                                       throw new ObjectDisposedException ("TlsConfiguration");
-                               return config;
-                       }
-               }
-
-               public ITlsContext Context {
-                       get {
-                               if (!IsValid)
-                                       throw new ObjectDisposedException ("TlsContext");
-                               return context;
-                       }
-               }
-
-               public bool HasCredentials {
-                       get { return Configuration.HasCredentials; }
-               }
-
-               public void SetCertificate (SSCX.X509Certificate certificate, AsymmetricAlgorithm privateKey)
-               {
-                       var monoCert = new MX.X509Certificate (certificate.GetRawCertData ());
-                       Configuration.SetCertificate (monoCert, privateKey);
-               }
-
-               public int GenerateNextToken (MSI.IBufferOffsetSize incoming, out MSI.IBufferOffsetSize outgoing)
-               {
-                       var input = incoming != null ? new MSI.TlsBuffer (BOSWrapper.Wrap (incoming)) : null;
-                       var output = new MSI.TlsMultiBuffer ();
-                       var retval = Context.GenerateNextToken (input, output);
-                       if (output.IsEmpty)
-                               outgoing = null;
-                       outgoing = BOSWrapper.Wrap (output.StealBuffer ());
-                       return (int)retval;
-               }
-
-               public int EncryptMessage (ref MSI.IBufferOffsetSize incoming)
-               {
-                       var buffer = new MSI.TlsBuffer (BOSWrapper.Wrap (incoming));
-                       var retval = Context.EncryptMessage (ref buffer);
-                       incoming = BOSWrapper.Wrap (buffer.GetRemaining ());
-                       return (int)retval;
-               }
-
-               public int DecryptMessage (ref MSI.IBufferOffsetSize incoming)
-               {
-                       var buffer = new MSI.TlsBuffer (BOSWrapper.Wrap (incoming));
-                       var retval = Context.DecryptMessage (ref buffer);
-                       incoming = buffer != null ? BOSWrapper.Wrap (buffer.GetRemaining ()) : null;
-                       return (int)retval;
-               }
-
-               class BOSWrapper : MSI.IBufferOffsetSize
-               {
-                       public byte[] Buffer {
-                               get;
-                               private set;
-                       }
-
-                       public int Offset {
-                               get;
-                               private set;
-                       }
-
-                       public int Size {
-                               get;
-                               private set;
-                       }
-
-                       BOSWrapper (byte[] buffer, int offset, int size)
-                       {
-                               Buffer = buffer;
-                               Offset = offset;
-                               Size = size;
-                       }
-
-                       public static BOSWrapper Wrap (MSI.IBufferOffsetSize bos)
-                       {
-                               return bos != null ? new BOSWrapper (bos.Buffer, bos.Offset, bos.Size) : null;
-                       }
-               }
-
-               public byte[] CreateCloseNotify ()
-               {
-                       return Context.CreateAlert (new MSI.Alert (MSI.AlertLevel.Warning, MSI.AlertDescription.CloseNotify));
-               }
-
-               public byte[] CreateHelloRequest ()
-               {
-                       return Context.CreateHelloRequest ();
-               }
-
-               public SSCX.X509Certificate GetRemoteCertificate (out PSSCX.X509CertificateCollection remoteCertificateStore)
-               {
-                       MX.X509CertificateCollection monoCollection;
-                       var remoteCert = Context.GetRemoteCertificate (out monoCollection);
-                       if (remoteCert == null) {
-                               remoteCertificateStore = null;
-                               return null;
-                       }
-
-                       remoteCertificateStore = new PSSCX.X509CertificateCollection ();
-                       foreach (var cert in monoCollection) {
-                               remoteCertificateStore.Add (new PSSCX.X509Certificate2 (cert.RawData));
-                       }
-                       return new PSSCX.X509Certificate2 (remoteCert.RawData);
-
-               }
-
-               public bool VerifyRemoteCertificate ()
-               {
-                       return Context.VerifyRemoteCertificate ();
-               }
-
-               public Exception LastError {
-                       get {
-                               if (context != null)
-                                       return context.LastError;
-                               return null;
-                       }
-               }
-
-               public bool ReceivedCloseNotify {
-                       get {
-                               return Context.ReceivedCloseNotify;
-                       }
-               }
-
-               public MSI.MonoTlsConnectionInfo GetConnectionInfo ()
-               {
-                       return Context.ConnectionInfo;
-               }
-
-               public void Dispose ()
-               {
-                       Dispose (true);
-                       GC.SuppressFinalize (this);
-               }
-
-               void Dispose (bool disposing)
-               {
-                       Clear ();
-               }
-       }
-}
-
diff --git a/mcs/class/Mono.Security.Providers.NewTls/Mono.Security.Providers.NewTls/TlsProviderFactory.cs b/mcs/class/Mono.Security.Providers.NewTls/Mono.Security.Providers.NewTls/TlsProviderFactory.cs
deleted file mode 100644 (file)
index 92d8ab0..0000000
+++ /dev/null
@@ -1,97 +0,0 @@
-//
-// TlsProviderFactory.cs
-//
-// Author:
-//       Martin Baulig <martin.baulig@xamarin.com>
-//
-// Copyright (c) 2015-2016 Xamarin, Inc.
-//
-// 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.
-
-extern alias NewSystemSource;
-
-using System;
-using System.IO;
-
-using System.Net;
-using System.Net.Security;
-using System.Security.Authentication;
-
-using MSI = Mono.Security.Interface;
-using MX = Mono.Security.X509;
-
-using PSSCX = System.Security.Cryptography.X509Certificates;
-using SSCX = System.Security.Cryptography.X509Certificates;
-
-namespace Mono.Security.Providers.NewTls
-{
-       static class TlsProviderFactory
-       {
-               const string assemblyName = "Mono.Security.NewTls, Version=4.0.0.0, Culture=neutral, PublicKeyToken=84e3aee7225169c2";
-               const string tlsConfigTypeName = "Mono.Security.NewTls.TlsConfiguration";
-               const string tlsContextTypeName = "Mono.Security.NewTls.TlsContext";
-
-               static object CreateInstance (string typeName, object[] args)
-               {
-                       var type = Type.GetType (typeName + ", " + assemblyName);
-                       return Activator.CreateInstance (type, args);
-               }
-
-               internal static ITlsConfiguration CreateTlsConfiguration (
-                       string hostname, bool serverMode, MSI.TlsProtocols protocolFlags,
-                       SSCX.X509Certificate serverCertificate, bool remoteCertRequired,
-                       MSI.MonoTlsSettings settings)
-               {
-                       object[] args;
-                       ITlsConfiguration config;
-                       if (serverMode) {
-                               var cert = (PSSCX.X509Certificate2)serverCertificate;
-                               var monoCert = new MX.X509Certificate (cert.RawData);
-                               args = new object[] {
-                                       (MSI.TlsProtocols)protocolFlags,
-                                       (MSI.MonoTlsSettings)settings,
-                                       monoCert,
-                                       cert.PrivateKey
-                               };
-                       } else {
-                               args = new object[] {
-                                       (MSI.TlsProtocols)protocolFlags,
-                                       (MSI.MonoTlsSettings)settings,
-                                       hostname
-                               };
-                       }
-
-                       config = (ITlsConfiguration)CreateInstance (tlsConfigTypeName, args);
-
-                       if (serverMode && remoteCertRequired)
-                               config.AskForClientCertificate = true;
-
-                       return config;
-               }
-
-               internal static ITlsContext CreateTlsContext (
-                       ITlsConfiguration config, bool serverMode,
-                       MSI.IMonoTlsEventSink eventSink)
-               {
-                       return (ITlsContext)CreateInstance (
-                               tlsContextTypeName,
-                               new object[] { config, serverMode, eventSink });
-               }
-       }
-}
diff --git a/mcs/class/Mono.Security.Providers.NewTls/Properties/AssemblyInfo.cs b/mcs/class/Mono.Security.Providers.NewTls/Properties/AssemblyInfo.cs
deleted file mode 100644 (file)
index e369093..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-//
-// AssemblyInfo.cs
-//
-// Author:
-//       Martin Baulig <martin.baulig@xamarin.com>
-//
-// Copyright (c) 2015 Xamarin, Inc.
-//
-// 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.Reflection;
-using System.Resources;
-using System.Security;
-using System.Security.Permissions;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about the system assembly
-
-[assembly: AssemblyVersion (Consts.FxVersion)]
-
-[assembly: AssemblyCompany ("Xamarin")]
-[assembly: AssemblyCopyright ("(c) 2015 Xamarin")]
-[assembly: AssemblyDescription ("Mono.Security.Providers.NewTls.dll")]
-[assembly: AssemblyProduct ("MONO CLI")]
-[assembly: AssemblyTitle ("Mono.Security.Providers.NewTls.dll")]
-[assembly: CLSCompliant (false)]
-[assembly: ComVisible (false)]
-[assembly: NeutralResourcesLanguage ("en-US")]
-
-[assembly: InternalsVisibleTo ("Mono.Security.NewTls, PublicKey=002400000480000094000000060200000024000052534131000400001100000003336d6aed41624ca156ab579881fe90a576f1dfec48378fc94e4e440f4556776224e2d70c18996d91f36227f539fdb44340e07651f1455a489b29a7e6219a8f85e52b0f8588b4f8a857746a8468d37b556223d1452f3fcbaf0f269cdf1900ceb68f69485dc5887750d19571030c732331e00387d9b813a9ad52891087301793")]
diff --git a/mcs/class/Mono.Security.Providers.NewTls/mobile_Mono.Security.Providers.NewTls.dll.sources b/mcs/class/Mono.Security.Providers.NewTls/mobile_Mono.Security.Providers.NewTls.dll.sources
deleted file mode 100644 (file)
index 7218dab..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-Properties/AssemblyInfo.cs
-
-Mono.Security.Providers.NewTls/ITlsConfiguration.cs
-Mono.Security.Providers.NewTls/ITlsContext.cs
-
-Mono.Security.Providers.NewTls/MonoNewTlsStream.cs
-Mono.Security.Providers.NewTls/MonoNewTlsStreamFactory.cs
diff --git a/mcs/class/Mono.Security.Providers.NewTls/mobile_static_Mono.Security.Providers.NewTls.dll.sources b/mcs/class/Mono.Security.Providers.NewTls/mobile_static_Mono.Security.Providers.NewTls.dll.sources
deleted file mode 100644 (file)
index baded51..0000000
+++ /dev/null
@@ -1 +0,0 @@
-#include mobile_Mono.Security.Providers.NewTls.dll.sources
diff --git a/mcs/class/Mono.Security.Providers.OldTls/Makefile b/mcs/class/Mono.Security.Providers.OldTls/Makefile
deleted file mode 100644 (file)
index 5dc06c0..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-thisdir = class/Mono.Security.Providers.OldTls
-SUBDIRS = 
-include ../../build/rules.make
-
-LIBRARY = Mono.Security.Providers.OldTls.dll
-LIB_REFS = System Mono.Security
-LIB_MCS_FLAGS = -unsafe -nowarn:1030 -keyfile:../mono.pub -delaysign -d:SECURITY_DEP
-
-include ../../build/library.make
-
-$(the_lib): ../Mono.Security/Makefile
-
diff --git a/mcs/class/Mono.Security.Providers.OldTls/Mono.Security.Providers.OldTls-net_4_x.csproj b/mcs/class/Mono.Security.Providers.OldTls/Mono.Security.Providers.OldTls-net_4_x.csproj
deleted file mode 100644 (file)
index 32ceb30..0000000
+++ /dev/null
@@ -1,167 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>\r
-<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
-  <PropertyGroup>\r
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
-    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>\r
-    <ProductVersion>9.0.30729</ProductVersion>\r
-    <SchemaVersion>2.0</SchemaVersion>\r
-    <ProjectGuid>{E485E885-59B1-4081-BC66-56AAAFD8771A}</ProjectGuid>\r
-    <OutputType>Library</OutputType>\r
-    <NoWarn>1699,1030</NoWarn>\r
-    <OutputPath>./../../class/lib/net_4_x</OutputPath>\r
-    <IntermediateOutputPath>obj-net_4_x</IntermediateOutputPath>\r
-    <GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>\r
-    <NoStdLib>True</NoStdLib>\r
-    \r
-    <NoConfig>True</NoConfig>\r
-    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>\r
-    <AppDesignerFolder>Properties</AppDesignerFolder>\r
-    <RootNamespace>\r
-    </RootNamespace>\r
-    <AssemblyName>Mono.Security.Providers.OldTls</AssemblyName>\r
-    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
-    <FileAlignment>512</FileAlignment>\r
-  </PropertyGroup>\r
-    <PropertyGroup>\r
-    <SignAssembly>true</SignAssembly>\r
-    <DelaySign>true</DelaySign>\r
-  </PropertyGroup>\r
-  <PropertyGroup>\r
-    <AssemblyOriginatorKeyFile>../mono.pub</AssemblyOriginatorKeyFile>\r
-  </PropertyGroup>\r
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
-    <DebugSymbols>true</DebugSymbols>\r
-    <DebugType>full</DebugType>\r
-    <NoWarn>1699,1030</NoWarn>\r
-    <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;SECURITY_DEP</DefineConstants>\r
-    <ErrorReport>prompt</ErrorReport>\r
-    <WarningLevel>4</WarningLevel>\r
-  </PropertyGroup>\r
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">\r
-    <DebugType>pdbonly</DebugType>\r
-    <NoWarn>1699,1030</NoWarn>\r
-    <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;SECURITY_DEP</DefineConstants>\r
-    <ErrorReport>prompt</ErrorReport>\r
-    <WarningLevel>4</WarningLevel>\r
-  </PropertyGroup>\r
-  <!-- Set AddAdditionalExplicitAssemblyReferences to false, otherwise if targetting .NET4.0, \r
-  Microsoft.NETFramework.props will force a dependency on the assembly System.Core. This\r
-  is a problem to compile the Mono mscorlib.dll -->\r
-  <PropertyGroup>\r
-    <AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>\r
-  </PropertyGroup>\r
-  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />\r
-  <ItemGroup>\r
-    <Compile Include="..\..\build\common\Consts.cs" />\r
-    <Compile Include="..\..\build\common\Locale.cs" />\r
-    <Compile Include="..\..\build\common\MonoTODOAttribute.cs" />\r
-    <Compile Include="..\Mono.Security\Mono.Security.Cryptography\MD5SHA1.cs" />\r
-    <Compile Include="..\Mono.Security\Mono.Security.Cryptography\TlsHMAC.cs" />\r
-    <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls.Handshake.Client\TlsClientCertificate.cs" />\r
-    <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls.Handshake.Client\TlsClientCertificateVerify.cs" />\r
-    <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls.Handshake.Client\TlsClientFinished.cs" />\r
-    <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls.Handshake.Client\TlsClientHello.cs" />\r
-    <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls.Handshake.Client\TlsClientKeyExchange.cs" />\r
-    <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls.Handshake.Client\TlsServerCertificate.cs" />\r
-    <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls.Handshake.Client\TlsServerCertificateRequest.cs" />\r
-    <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls.Handshake.Client\TlsServerFinished.cs" />\r
-    <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls.Handshake.Client\TlsServerHello.cs" />\r
-    <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls.Handshake.Client\TlsServerHelloDone.cs" />\r
-    <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls.Handshake.Client\TlsServerKeyExchange.cs" />\r
-    <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls.Handshake.Server\TlsClientCertificate.cs" />\r
-    <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls.Handshake.Server\TlsClientCertificateVerify.cs" />\r
-    <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls.Handshake.Server\TlsClientFinished.cs" />\r
-    <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls.Handshake.Server\TlsClientHello.cs" />\r
-    <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls.Handshake.Server\TlsClientKeyExchange.cs" />\r
-    <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls.Handshake.Server\TlsServerCertificate.cs" />\r
-    <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls.Handshake.Server\TlsServerCertificateRequest.cs" />\r
-    <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls.Handshake.Server\TlsServerFinished.cs" />\r
-    <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls.Handshake.Server\TlsServerHello.cs" />\r
-    <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls.Handshake.Server\TlsServerHelloDone.cs" />\r
-    <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls.Handshake.Server\TlsServerKeyExchange.cs" />\r
-    <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls.Handshake\ClientCertificateType.cs" />\r
-    <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls.Handshake\HandshakeMessage.cs" />\r
-    <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls.Handshake\HandshakeType.cs" />\r
-    <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\Alert.cs" />\r
-    <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\CipherAlgorithmType.cs" />\r
-    <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\CipherSuite.cs" />\r
-    <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\CipherSuiteCollection.cs" />\r
-    <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\CipherSuiteFactory.cs" />\r
-    <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\ClientContext.cs" />\r
-    <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\ClientRecordProtocol.cs" />\r
-    <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\ClientSessionCache.cs" />\r
-    <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\ContentType.cs" />\r
-    <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\Context.cs" />\r
-    <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\DebugHelper.cs" />\r
-    <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\ExchangeAlgorithmType.cs" />\r
-    <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\HandshakeState.cs" />\r
-    <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\HashAlgorithmType.cs" />\r
-    <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\HttpsClientStream.cs" />\r
-    <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\RecordProtocol.cs" />\r
-    <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\RSASslSignatureDeformatter.cs" />\r
-    <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\RSASslSignatureFormatter.cs" />\r
-    <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\SecurityCompressionType.cs" />\r
-    <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\SecurityParameters.cs" />\r
-    <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\SecurityProtocolType.cs" />\r
-    <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\ServerContext.cs" />\r
-    <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\ServerRecordProtocol.cs" />\r
-    <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\SslCipherSuite.cs" />\r
-    <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\SslClientStream.cs" />\r
-    <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\SslHandshakeHash.cs" />\r
-    <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\SslServerStream.cs" />\r
-    <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\SslStreamBase.cs" />\r
-    <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\TlsCipherSuite.cs" />\r
-    <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\TlsClientSettings.cs" />\r
-    <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\TlsException.cs" />\r
-    <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\TlsServerSettings.cs" />\r
-    <Compile Include="..\Mono.Security\Mono.Security.Protocol.Tls\TlsStream.cs" />\r
-    <Compile Include="..\Mono.Security\Mono.Security.X509.Extensions\AuthorityKeyIdentifierExtension.cs" />\r
-    <Compile Include="..\Mono.Security\Mono.Security.X509.Extensions\ExtendedKeyUsageExtension.cs" />\r
-    <Compile Include="..\Mono.Security\Mono.Security.X509.Extensions\GeneralNames.cs" />\r
-    <Compile Include="..\Mono.Security\Mono.Security.X509.Extensions\NetscapeCertTypeExtension.cs" />\r
-    <Compile Include="..\Mono.Security\Mono.Security.X509.Extensions\SubjectAltNameExtension.cs" />\r
-    <Compile Include="..\System\Mono.Net.Security\LegacySslStream.cs" />\r
-    <Compile Include=".\Mono.Security.Providers.OldTls\OldTlsProvider.cs" />\r
-    <Compile Include=".\Properties\AssemblyInfo.cs" />\r  </ItemGroup>\r
-  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \r
-       Other similar extension points exist, see Microsoft.Common.targets.\r
-  <Target Name="BeforeBuild">\r
-  </Target>\r
-  <Target Name="AfterBuild">\r
-  </Target>\r
-  -->\r
-  <PropertyGroup>\r
-    <PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
-
-    </PreBuildEvent>\r
-    <PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">\r
-\r
-    </PreBuildEvent>\r
-    <PostBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
-
-    </PostBuildEvent>\r
-    <PostBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">\r
-\r
-    </PostBuildEvent>\r
-  </PropertyGroup>\r
-  <ItemGroup>\r
-    <ProjectReference Include="../corlib/corlib-net_4_x.csproj">\r
-      <Project>{2CA6026B-2DC8-4C4C-A12C-1E8234049DB7}</Project>\r
-      <Name>corlib-net_4_x</Name>\r
-    </ProjectReference>\r
-    <ProjectReference Include="../System/System-net_4_x.csproj">\r
-      <Project>{2762E921-91A8-4C87-91E9-BA628013F753}</Project>\r
-      <Name>System-net_4_x</Name>\r
-    </ProjectReference>\r
-    <ProjectReference Include="../Mono.Security/Mono.Security-net_4_x.csproj">\r
-      <Project>{42D59DE7-586F-4ACF-BDD5-E7869E39E3EF}</Project>\r
-      <Name>Mono.Security-net_4_x</Name>\r
-    </ProjectReference>\r
-  </ItemGroup>\r
-  <ItemGroup>\r
-    <Folder Include="Properties\" />\r
-  </ItemGroup>\r
-</Project>\r
-
diff --git a/mcs/class/Mono.Security.Providers.OldTls/Mono.Security.Providers.OldTls.dll.sources b/mcs/class/Mono.Security.Providers.OldTls/Mono.Security.Providers.OldTls.dll.sources
deleted file mode 100644 (file)
index 13653b8..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-./Properties/AssemblyInfo.cs
-../../build/common/Consts.cs
-../../build/common/Locale.cs
-../../build/common/MonoTODOAttribute.cs
-
-./Mono.Security.Providers.OldTls/OldTlsProvider.cs
-../System/Mono.Net.Security/LegacySslStream.cs
-
-../Mono.Security/Mono.Security.Cryptography/MD5SHA1.cs
-../Mono.Security/Mono.Security.Cryptography/TlsHMAC.cs
-../Mono.Security/Mono.Security.Protocol.Tls/Alert.cs
-../Mono.Security/Mono.Security.Protocol.Tls/CipherAlgorithmType.cs
-../Mono.Security/Mono.Security.Protocol.Tls/CipherSuite.cs
-../Mono.Security/Mono.Security.Protocol.Tls/CipherSuiteCollection.cs
-../Mono.Security/Mono.Security.Protocol.Tls/CipherSuiteFactory.cs
-../Mono.Security/Mono.Security.Protocol.Tls/ClientContext.cs
-../Mono.Security/Mono.Security.Protocol.Tls/ClientRecordProtocol.cs
-../Mono.Security/Mono.Security.Protocol.Tls/ClientSessionCache.cs
-../Mono.Security/Mono.Security.Protocol.Tls/ContentType.cs
-../Mono.Security/Mono.Security.Protocol.Tls/Context.cs
-../Mono.Security/Mono.Security.Protocol.Tls/DebugHelper.cs
-../Mono.Security/Mono.Security.Protocol.Tls/ExchangeAlgorithmType.cs
-../Mono.Security/Mono.Security.Protocol.Tls/HandshakeState.cs
-../Mono.Security/Mono.Security.Protocol.Tls/HashAlgorithmType.cs
-../Mono.Security/Mono.Security.Protocol.Tls/HttpsClientStream.cs
-../Mono.Security/Mono.Security.Protocol.Tls/RecordProtocol.cs
-../Mono.Security/Mono.Security.Protocol.Tls/RSASslSignatureDeformatter.cs
-../Mono.Security/Mono.Security.Protocol.Tls/RSASslSignatureFormatter.cs
-../Mono.Security/Mono.Security.Protocol.Tls/SecurityCompressionType.cs
-../Mono.Security/Mono.Security.Protocol.Tls/SecurityParameters.cs
-../Mono.Security/Mono.Security.Protocol.Tls/SecurityProtocolType.cs
-../Mono.Security/Mono.Security.Protocol.Tls/ServerContext.cs
-../Mono.Security/Mono.Security.Protocol.Tls/ServerRecordProtocol.cs
-../Mono.Security/Mono.Security.Protocol.Tls/SslClientStream.cs
-../Mono.Security/Mono.Security.Protocol.Tls/SslCipherSuite.cs
-../Mono.Security/Mono.Security.Protocol.Tls/SslHandshakeHash.cs
-../Mono.Security/Mono.Security.Protocol.Tls/SslServerStream.cs
-../Mono.Security/Mono.Security.Protocol.Tls/SslStreamBase.cs
-../Mono.Security/Mono.Security.Protocol.Tls/TlsCipherSuite.cs
-../Mono.Security/Mono.Security.Protocol.Tls/TlsClientSettings.cs
-../Mono.Security/Mono.Security.Protocol.Tls/TlsException.cs
-../Mono.Security/Mono.Security.Protocol.Tls/TlsServerSettings.cs
-../Mono.Security/Mono.Security.Protocol.Tls/TlsStream.cs
-../Mono.Security/Mono.Security.Protocol.Tls.Handshake/ClientCertificateType.cs
-../Mono.Security/Mono.Security.Protocol.Tls.Handshake/HandshakeMessage.cs
-../Mono.Security/Mono.Security.Protocol.Tls.Handshake/HandshakeType.cs
-../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsClientCertificate.cs
-../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsClientCertificateVerify.cs
-../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsClientFinished.cs
-../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsClientHello.cs
-../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsClientKeyExchange.cs
-../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsServerCertificate.cs
-../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsServerCertificateRequest.cs
-../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsServerFinished.cs
-../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsServerHello.cs
-../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsServerHelloDone.cs
-../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsServerKeyExchange.cs
-../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsClientCertificate.cs
-../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsClientCertificateVerify.cs
-../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsClientFinished.cs
-../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsClientHello.cs
-../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsClientKeyExchange.cs
-../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsServerCertificate.cs
-../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsServerCertificateRequest.cs
-../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsServerFinished.cs
-../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsServerHello.cs
-../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsServerHelloDone.cs
-../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsServerKeyExchange.cs
-../Mono.Security/Mono.Security.X509.Extensions/AuthorityKeyIdentifierExtension.cs
-../Mono.Security/Mono.Security.X509.Extensions/ExtendedKeyUsageExtension.cs
-../Mono.Security/Mono.Security.X509.Extensions/GeneralNames.cs
-../Mono.Security/Mono.Security.X509.Extensions/NetscapeCertTypeExtension.cs
-../Mono.Security/Mono.Security.X509.Extensions/SubjectAltNameExtension.cs
diff --git a/mcs/class/Mono.Security.Providers.OldTls/Mono.Security.Providers.OldTls/OldTlsProvider.cs b/mcs/class/Mono.Security.Providers.OldTls/Mono.Security.Providers.OldTls/OldTlsProvider.cs
deleted file mode 100644 (file)
index 4532a17..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-//
-// OldTlsProvider.cs
-//
-// Author:
-//       Martin Baulig <martin.baulig@xamarin.com>
-//
-// Copyright (c) 2015 Xamarin, Inc.
-//
-// 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.IO;
-using System.Net;
-using System.Net.Security;
-using System.Security.Authentication;
-using System.Security.Cryptography.X509Certificates;
-using Mono.Security.Interface;
-using MNS = Mono.Net.Security;
-
-namespace Mono.Security.Providers.OldTls
-{
-       public class OldTlsProvider : MonoTlsProvider
-       {
-               static readonly Guid id = new Guid ("cf8baa0d-c6ed-40ae-b512-dec8d097e9af");
-
-               public override Guid ID {
-                       get { return id; }
-               }
-
-               public override string Name {
-                       get { return "old"; }
-               }
-
-               public override bool SupportsSslStream {
-                       get { return true; }
-               }
-
-               public override bool SupportsMonoExtensions {
-                       get { return false; }
-               }
-
-               public override bool SupportsConnectionInfo {
-                       get { return false; }
-               }
-
-               internal override bool SupportsTlsContext {
-                       get { return false; }
-               }
-
-               public override SslProtocols SupportedProtocols {
-                       get { return SslProtocols.Tls; }
-               }
-
-               public override IMonoSslStream CreateSslStream (
-                       Stream innerStream, bool leaveInnerStreamOpen,
-                       MonoTlsSettings settings = null)
-               {
-                       var impl = new MNS.Private.LegacySslStream (innerStream, leaveInnerStreamOpen, this, settings);
-                       return new MNS.Private.MonoSslStreamImpl (impl);
-               }
-
-               internal override IMonoTlsContext CreateTlsContext (
-                       string hostname, bool serverMode, TlsProtocols protocolFlags,
-                       X509Certificate serverCertificate, X509CertificateCollection clientCertificates,
-                       bool remoteCertRequired, MonoEncryptionPolicy encryptionPolicy,
-                       MonoTlsSettings settings)
-               {
-                       throw new NotSupportedException ();
-               }
-       }
-}
-
diff --git a/mcs/class/Mono.Security.Providers.OldTls/Properties/AssemblyInfo.cs b/mcs/class/Mono.Security.Providers.OldTls/Properties/AssemblyInfo.cs
deleted file mode 100644 (file)
index 923beca..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-//
-// AssemblyInfo.cs
-//
-// Author:
-//       Martin Baulig <martin.baulig@xamarin.com>
-//
-// Copyright (c) 2015 Xamarin, Inc.
-//
-// 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.Reflection;
-using System.Resources;
-using System.Security;
-using System.Security.Permissions;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about the system assembly
-
-[assembly: AssemblyVersion (Consts.FxVersion)]
-
-[assembly: AssemblyCompany ("MONO development team")]
-[assembly: AssemblyCopyright ("(c) 2015 Xamarin")]
-[assembly: AssemblyDescription ("Mono.Security.Providers.OldTls.dll")]
-[assembly: AssemblyProduct ("MONO CLI")]
-[assembly: AssemblyTitle ("Mono.Security.Providers.OldTls.dll")]
-[assembly: CLSCompliant (true)]
-[assembly: ComVisible (false)]
-[assembly: NeutralResourcesLanguage ("en-US")]
-
index 6eb3f05da224a9b1b444b7156f27f34b432d7c08..f1d5e78befe533293c1d0fd220be30bc5e6173b7 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index b5bf191148e12eb7995fa6f6b1ebbddc328ce77e..eeccc251f7d6ed12f515024c5183ee374d19e6e4 100644 (file)
@@ -60,14 +60,9 @@ using System.Runtime.InteropServices;
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../mono.pub")]
 
-#if NET_2_1
+#if MOBILE
 [assembly: InternalsVisibleTo ("System, PublicKey=00240000048000009400000006020000002400005253413100040000010001008D56C76F9E8649383049F383C44BE0EC204181822A6C31CF5EB7EF486944D032188EA1D3920763712CCB12D75FB77E9811149E6148E5D32FBAAB37611C1878DDC19E20EF135D0CB2CFF2BFEC3D115810C3D9069638FE4BE215DBF795861920E5AB6F7DB2E2CEEF136AC23D5DD2BF031700AEC232F6C6B1C785B4305C123B37AB")]
 #else
 [assembly: InternalsVisibleTo ("System, PublicKey=00000000000000000400000000000000")]
 #endif
 
-[assembly: InternalsVisibleTo ("Mono.Security.Providers.NewTls, PublicKey=002400000480000094000000060200000024000052534131000400000100010079159977d2d03a8e6bea7a2e74e8d1afcc93e8851974952bb480a12c9134474d04062447c37e0e68c080536fcf3c3fbe2ff9c979ce998475e506e8ce82dd5b0f350dc10e93bf2eeecf874b24770c5081dbea7447fddafa277b22de47d6ffea449674a4f9fccf84d15069089380284dbdd35f46cdff12a1bd78e4ef0065d016df")]
-[assembly: InternalsVisibleTo ("Mono.Security.Providers.OldTls, PublicKey=002400000480000094000000060200000024000052534131000400000100010079159977d2d03a8e6bea7a2e74e8d1afcc93e8851974952bb480a12c9134474d04062447c37e0e68c080536fcf3c3fbe2ff9c979ce998475e506e8ce82dd5b0f350dc10e93bf2eeecf874b24770c5081dbea7447fddafa277b22de47d6ffea449674a4f9fccf84d15069089380284dbdd35f46cdff12a1bd78e4ef0065d016df")]
-[assembly: InternalsVisibleTo ("Mono.Security.Providers.DotNet, PublicKey=002400000480000094000000060200000024000052534131000400000100010079159977d2d03a8e6bea7a2e74e8d1afcc93e8851974952bb480a12c9134474d04062447c37e0e68c080536fcf3c3fbe2ff9c979ce998475e506e8ce82dd5b0f350dc10e93bf2eeecf874b24770c5081dbea7447fddafa277b22de47d6ffea449674a4f9fccf84d15069089380284dbdd35f46cdff12a1bd78e4ef0065d016df")]
-[assembly: InternalsVisibleTo ("Mono.Security.Providers.NewSystemSource, PublicKey=002400000480000094000000060200000024000052534131000400000100010079159977d2d03a8e6bea7a2e74e8d1afcc93e8851974952bb480a12c9134474d04062447c37e0e68c080536fcf3c3fbe2ff9c979ce998475e506e8ce82dd5b0f350dc10e93bf2eeecf874b24770c5081dbea7447fddafa277b22de47d6ffea449674a4f9fccf84d15069089380284dbdd35f46cdff12a1bd78e4ef0065d016df")]
-[assembly: InternalsVisibleTo ("Xamarin.BoringTls, PublicKey=002400000480000094000000060200000024000052534131000400001100000099dd12eda85767ae6f06023ee28e711c7e5a212462095c83868c29db75eddf6d8e296e03824c14fedd5f55553fed0b6173be3cc985a4b7f9fb7c83ccff8ba3938563b3d1f45a81122f12a1bcb73edcaad61a8456c7595a6da5184b4dd9d10f011b949ef1391fccfeab1ba62aa51c267ef8bd57ef1b6ba5a4c515d0badb81a78f")]
index e6e48767bf6173f7e82fe65dc206f5ef05123932..9c02550eca2719a40bbc41ddc41a2e60f87efb07 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1030,3009</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1030,3009</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -92,7 +93,6 @@
     <Compile Include=".\Mono.Security.Interface\HashAlgorithmType.cs" />\r
     <Compile Include=".\Mono.Security.Interface\IBufferOffsetSize.cs" />\r
     <Compile Include=".\Mono.Security.Interface\IMonoSslStream.cs" />\r
-    <Compile Include=".\Mono.Security.Interface\IMonoTlsContext.cs" />\r
     <Compile Include=".\Mono.Security.Interface\IMonoTlsEventSink.cs" />\r
     <Compile Include=".\Mono.Security.Interface\MonoTlsConnectionInfo.cs" />\r
     <Compile Include=".\Mono.Security.Interface\MonoTlsProvider.cs" />\r
index fd392b409e5a4bef6de68f174911b79f638997be..98805605c08ba236deee6556e1a31dcca5cd9989 100644 (file)
@@ -103,13 +103,6 @@ namespace Mono.Security.Interface
                 * Internal use only.
                 */
                ValidationResult ValidateCertificate (string targetHost, bool serverMode, X509Certificate leaf, X509Chain chain);
-
-               /*
-                * On OS X and Mobile, the @chain will be initialized with the @certificates, but not actually built.
-                */
-               bool InvokeSystemValidator (
-                       string targetHost, bool serverMode, X509CertificateCollection certificates,
-                       X509Chain chain, ref MonoSslPolicyErrors errors, ref int status11);
        }
 
        public static class CertificateValidationHelper
@@ -148,17 +141,23 @@ namespace Mono.Security.Interface
                /*
                 * Internal API, intended to be used by MonoTlsProvider implementations.
                 */
+               internal static ICertificateValidator2 GetInternalValidator (MonoTlsSettings settings, MonoTlsProvider provider)
+               {
+                       return (ICertificateValidator2)NoReflectionHelper.GetInternalValidator (provider, settings);
+               }
+
+               [Obsolete ("Use GetInternalValidator")]
                internal static ICertificateValidator2 GetDefaultValidator (MonoTlsSettings settings, MonoTlsProvider provider)
                {
-                       return (ICertificateValidator2)NoReflectionHelper.GetDefaultCertificateValidator (provider, settings);
+                       return GetInternalValidator (settings, provider);
                }
 
                /*
                 * Use this overloaded version in user code.
                 */
-               public static ICertificateValidator GetValidator (MonoTlsSettings settings, MonoTlsProvider provider = null)
+               public static ICertificateValidator GetValidator (MonoTlsSettings settings)
                {
-                       return GetDefaultValidator (settings, provider);
+                       return (ICertificateValidator)NoReflectionHelper.GetDefaultValidator (settings);
                }
        }
 }
index 66980df81a6ab254278b5c6a057681128fa431ba..1060677c59401a0666c75cac1cc844348f3a60be 100644 (file)
@@ -31,6 +31,7 @@ namespace Mono.Security.Interface
        /// <summary>
        /// RFC 2246 A.5
        /// </summary>
+       [CLSCompliant (false)]
        public enum CipherSuiteCode : ushort
        {
                TLS_NULL_WITH_NULL_NULL = 0x0000,
diff --git a/mcs/class/Mono.Security/Mono.Security.Interface/IMonoTlsContext.cs b/mcs/class/Mono.Security/Mono.Security.Interface/IMonoTlsContext.cs
deleted file mode 100644 (file)
index d1ac4e2..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-//
-// IMonoTlsContext.cs
-//
-// Author:
-//       Martin Baulig <martin.baulig@xamarin.com>
-//
-// Copyright (c) 2015 Xamarin, Inc.
-//
-// 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.Security.Cryptography;
-using System.Security.Cryptography.X509Certificates;
-
-namespace Mono.Security.Interface
-{
-       interface IMonoTlsContext : IDisposable
-       {
-               bool IsServer {
-                       get;
-               }
-
-               bool IsValid {
-                       get;
-               }
-
-               void Initialize (IMonoTlsEventSink eventSink);
-
-               bool HasCredentials {
-                       get;
-               }
-
-               void SetCertificate (X509Certificate certificate, AsymmetricAlgorithm privateKey);
-
-               int GenerateNextToken (IBufferOffsetSize incoming, out IBufferOffsetSize outgoing);
-
-               int EncryptMessage (ref IBufferOffsetSize incoming);
-
-               int DecryptMessage (ref IBufferOffsetSize incoming);
-
-               bool ReceivedCloseNotify {
-                       get;
-               }
-
-               byte[] CreateCloseNotify ();
-
-               byte[] CreateHelloRequest ();
-
-               X509Certificate GetRemoteCertificate (out X509CertificateCollection remoteCertificateStore);
-
-               bool VerifyRemoteCertificate ();
-
-               MonoTlsConnectionInfo GetConnectionInfo ();
-       }
-}
-
index 4bc5f436f454b6bb8e2e7e1896524836ddcc728f..120d885eaf07985e921eae567a3ef56bfa63177a 100644 (file)
@@ -29,6 +29,7 @@ namespace Mono.Security.Interface
 {
        public class MonoTlsConnectionInfo
        {
+               [CLSCompliant (false)]
                public CipherSuiteCode CipherSuiteCode {
                        get; set;
                }
@@ -49,6 +50,10 @@ namespace Mono.Security.Interface
                        get; set;
                }
 
+               public string PeerDomainName {
+                       get; set;
+               }
+
                public override string ToString ()
                {
                        return string.Format ("[MonoTlsConnectionInfo: {0}:{1}]", ProtocolVersion, CipherSuiteCode);
index 089d8447a78993d3a4015cf4ad40b6a47cb6f6ed..0d7a7512d6a758659c5d10268874eaae2e726b02 100644 (file)
@@ -145,14 +145,6 @@ namespace Mono.Security.Interface
 #endregion
 
 #region Certificate Validation
-
-               /*
-                * Allows a TLS provider to provide a custom system certificiate validator.
-                */
-               internal virtual bool HasCustomSystemCertificateValidator {
-                       get { return false; }
-               }
-
                /*
                 * If @serverMode is true, then we're a server and want to validate a certificate
                 * that we received from a client.
@@ -162,32 +154,10 @@ namespace Mono.Security.Interface
                 * Returns `true` if certificate validation has been performed and `false` to invoke the
                 * default system validator.
                 */
-               internal virtual bool InvokeSystemCertificateValidator (
+               internal abstract bool ValidateCertificate (
                        ICertificateValidator2 validator, string targetHost, bool serverMode,
                        X509CertificateCollection certificates, bool wantsChain, ref X509Chain chain,
-                       out bool success, ref MonoSslPolicyErrors errors, ref int status11)
-               {
-                       throw new InvalidOperationException ();
-               }
-
-#endregion
-
-#region Manged SSPI
-
-               /*
-                * The managed SSPI implementation from the new TLS code.
-                */
-
-               internal abstract bool SupportsTlsContext {
-                       get;
-               }
-
-               internal abstract IMonoTlsContext CreateTlsContext (
-                       string hostname, bool serverMode, TlsProtocols protocolFlags,
-                       X509Certificate serverCertificate, X509CertificateCollection clientCertificates,
-                       bool remoteCertRequired, MonoEncryptionPolicy encryptionPolicy,
-                       MonoTlsSettings settings);
-
+                       ref MonoSslPolicyErrors errors, ref int status11);
 #endregion
        }
 }
index 557d024da21f8495e0dfdc804c3f030f641c13af..a9983f129077b3e9e21bb19f3a533bdda60df04e 100644 (file)
@@ -39,7 +39,37 @@ namespace Mono.Security.Interface
        public static partial class MonoTlsProviderFactory
        {
                /*
-                * Returns the currently installed @MonoTlsProvider, falling back to the default one.
+                * TLS Provider Initialization
+                * ===========================
+                * 
+                * The "global" TLS Provider (returned by GetProvider()) may only be modified at
+                * application startup (before any of the TLS / Certificate code has been used).
+                * 
+                * On mobile, the default provider is specified at compile time using a property
+                * in the .csproj file (which can be set from the IDE).  When using the linker, all
+                * other providers will be linked-out, so you won't be able to choose a different
+                * provider at run-time.
+                * 
+                * On desktop, the default provider can be specified with the MONO_TLS_PROVIDER
+                * environment variable.  The following options are currently supported:
+                * 
+                *    "default" - let Mono pick the best one for you (recommended)
+                *    "old" or "legacy" - Mono's old managed TLS implementation
+                *    "appletls" (currently XamMac only, set via .csproj property)
+                *    "btls" - the new boringssl based provider (coming soon).
+                * 
+                * On all platforms (except mobile with linker), you can call
+                * 
+                *     MonoTlsProviderFactory.Initialize(string)
+                * 
+                * to use a different provider.
+                * 
+                */
+
+               #region Provider Initialization
+
+               /*
+                * Returns the global @MonoTlsProvider, initializing the TLS Subsystem if necessary.
                 *
                 * This method throws @NotSupportedException if no TLS Provider can be found.
                 */
@@ -49,42 +79,64 @@ namespace Mono.Security.Interface
                }
 
                /*
-                * Returns the default @MonoTlsProvider.
-                *
-                * This method throws @NotSupportedException if no TLS Provider can be found.
+                * Check whether the TLS Subsystem is initialized.
                 */
-               public static MonoTlsProvider GetDefaultProvider ()
+               public static bool IsInitialized {
+                       get {
+                               return NoReflectionHelper.IsInitialized;
+                       }
+               }
+
+               /*
+                * Initialize the TLS Subsystem.
+                * 
+                * This method may be called at any time.  It ensures that the TLS Subsystem is
+                * initialized and a provider available.
+                */
+               public static void Initialize ()
                {
-                       return (MonoTlsProvider)NoReflectionHelper.GetDefaultProvider ();
+                       NoReflectionHelper.Initialize ();
                }
 
                /*
-                * GetProvider() attempts to load and install the default provider and throws on error.
-                *
-                * This property checks whether a provider has previously been installed by a call
-                * to either GetProvider() or InstallProvider().
-                *
+                * Initialize the TLS Subsystem with a specific provider.
+                * 
+                * May only be called at application startup (before any of the TLS / Certificate
+                * APIs have been used).
+                * 
+                * Throws @NotSupportedException if the TLS Subsystem is already initialized
+                * (@IsInitialized returns true) or the requested provider is not supported.
+                * 
+                * On mobile, this will always throw @NotSupportedException when using the linker.
                 */
-               public static bool HasProvider {
-                       get {
-                               return NoReflectionHelper.HasProvider;
-                       }
+               public static void Initialize (string provider)
+               {
+                       NoReflectionHelper.Initialize (provider);
                }
 
                /*
-                * Selects the default TLS Provider.
+                * Checks whether @provider is supported.
                 *
-                * May only be called at application startup and will throw
-                * @InvalidOperationException if a provider has already been installed.
+                * On mobile, this will always return false when using the linker.
                 */
-               public static void SetDefaultProvider (string name)
+               public static bool IsProviderSupported (string provider)
                {
-                       NoReflectionHelper.SetDefaultProvider (name);
+                       return NoReflectionHelper.IsProviderSupported (provider);
                }
 
-               public static MonoTlsProvider GetProvider (string name)
+               #endregion
+
+               #region Call-by-call selection
+
+               /*
+                * Returns the requested TLS Provider, for use with the call-by-call APIs below.
+                * 
+                * Throw @NotSupportedException if the requested provider is not supported or
+                * when using the linker on mobile.
+                */
+               public static MonoTlsProvider GetProvider (string provider)
                {
-                       return (MonoTlsProvider)NoReflectionHelper.GetProvider (name);
+                       return (MonoTlsProvider)NoReflectionHelper.GetProvider (provider);
                }
 
                /*
@@ -108,6 +160,24 @@ namespace Mono.Security.Interface
                {
                        return (IMonoSslStream)NoReflectionHelper.GetMonoSslStream (stream);
                }
+
+               #endregion
+
+               #region Obsolete APIs
+
+               [Obsolete]
+               public static MonoTlsProvider GetDefaultProvider ()
+               {
+                       return GetProvider ();
+               }
+
+               [Obsolete]
+               public static void SetDefaultProvider (string name)
+               {
+                       Initialize (name);
+               }
+
+               #endregion
        }
 }
 
index 24b28a790efd6398311b34e526a8b9fb395bce0c..7721bb00a51d6add53e50ce177ef3dacbdcf8803 100644 (file)
@@ -82,6 +82,7 @@ namespace Mono.Security.Interface
                        get; set;
                }
 
+               [CLSCompliant (false)]
                public CipherSuiteCode[] EnabledCiphers {
                        get; set;
                }
index f92ad900e84de0dc65e7169d767c6164d76139da..89f9aaed0748d2760ef74c49be8c6763426889de 100644 (file)
@@ -72,7 +72,7 @@ namespace Mono.Security.Protocol.Tls.Handshake.Client
 
                private void GetClientCertificate ()
                {
-#warning "Client certificate selection is unfinished"
+// TODO: Client certificate selection is unfinished
                        ClientContext context = (ClientContext)this.Context;
 
                        // note: the server may ask for mutual authentication 
index b3831248d425de52dae3104c78ee4362e4ca1334..f741f95a7daf8097d8900daa2f32cd2c480bdb7a 100644 (file)
@@ -73,7 +73,7 @@ namespace Mono.Security.Protocol.Tls.Handshake.Client
                        // Check server prf against client prf
                        if (!Compare (clientHash, serverHash))
                        {
-#warning Review that selected alert is correct
+// TODO: Review that selected alert is correct
                                throw new TlsException(AlertDescription.InsuficientSecurity, "Invalid ServerFinished message received.");
                        }
                }
index 70b25bd1d576926e397c6d3352a8ef1e8f887efd..ff122878c95b737e5b1572d85dd2aa9e29f2bd8a 100644 (file)
@@ -36,7 +36,7 @@ namespace Mono.Security.Protocol.Tls
                {
                        if (!isInitialized)
                        {
-#if !NET_2_1
+#if !MOBILE
                                Debug.Listeners.Add(new TextWriterTraceListener(Console.Out));
                                // Debug.Listeners.Add(new TextWriterTraceListener(@"c:\ssl.log"));
                                Debug.AutoFlush = true;
index 23ccc8316eb33e91380eb63a3c1a931c42ee7715..e74c7be0dd9773ce6f048fadc031d3178e8cc40e 100644 (file)
@@ -38,6 +38,8 @@ using System.Security.Cryptography;
 using Mono.Security.Cryptography;
 using Mono.Security.X509.Extensions;
 
+using SSCX = System.Security.Cryptography.X509Certificates;
+
 namespace Mono.Security.X509 {
 
 #if INSIDE_CORLIB
@@ -51,12 +53,14 @@ namespace Mono.Security.X509 {
                private X509CertificateCollection _certificates;
                private ArrayList _crls;
                private bool _crl;
+               private bool _newFormat;
                private string _name;
 
-               internal X509Store (string path, bool crl
+               internal X509Store (string path, bool crl, bool newFormat)
                {
                        _storePath = path;
                        _crl = crl;
+                       _newFormat = newFormat;
                }
 
                // properties
@@ -126,6 +130,11 @@ namespace Mono.Security.X509 {
                {
                        CheckStore (_storePath, true);
 
+                       if (_newFormat) {
+                               ImportNewFormat (certificate);
+                               return;
+                       }
+
                        string filename = Path.Combine (_storePath, GetUniqueName (certificate));
                        if (!File.Exists (filename)) {
                                filename = Path.Combine (_storePath, GetUniqueNameWithSerial (certificate));
@@ -148,7 +157,7 @@ namespace Mono.Security.X509 {
                                        ClearCertificates ();   // We have modified the store on disk.  So forget the old state.
                                }
                        }
-#if !NET_2_1
+#if !MOBILE
                        // Try to save privateKey if available..
                        CspParameters cspParams = new CspParameters ();
                        cspParams.KeyContainerName = CryptoConvert.ToHex (certificate.Hash);
@@ -165,6 +174,9 @@ namespace Mono.Security.X509 {
                {
                        CheckStore (_storePath, true);
 
+                       if (_newFormat)
+                               throw new NotSupportedException ();
+
                        string filename = Path.Combine (_storePath, GetUniqueName (crl));
                        if (!File.Exists (filename)) {
                                using (FileStream fs = File.Create (filename)) {
@@ -177,6 +189,11 @@ namespace Mono.Security.X509 {
 
                public void Remove (X509Certificate certificate) 
                {
+                       if (_newFormat) {
+                               RemoveNewFormat (certificate);
+                               return;
+                       }
+
                        string filename = Path.Combine (_storePath, GetUniqueNameWithSerial (certificate));
                        if (File.Exists (filename)) {
                                File.Delete (filename);
@@ -192,6 +209,9 @@ namespace Mono.Security.X509 {
 
                public void Remove (X509Crl crl) 
                {
+                       if (_newFormat)
+                               throw new NotSupportedException ();
+
                        string filename = Path.Combine (_storePath, GetUniqueName (crl));
                        if (File.Exists (filename)) {
                                File.Delete (filename);
@@ -199,6 +219,41 @@ namespace Mono.Security.X509 {
                        }
                }
 
+               // new format
+
+               void ImportNewFormat (X509Certificate certificate)
+               {
+#if INSIDE_CORLIB
+                       throw new NotSupportedException ();
+#else
+                       using (var sscxCert = new SSCX.X509Certificate (certificate.RawData)) {
+                               var hash = SSCX.X509Helper2.GetSubjectNameHash (sscxCert);
+                               var filename = Path.Combine (_storePath, string.Format ("{0:x8}.0", hash));
+                               if (!File.Exists (filename)) {
+                                       using (FileStream fs = File.Create (filename))
+                                               SSCX.X509Helper2.ExportAsPEM (sscxCert, fs, true);
+                                       ClearCertificates ();
+                               }
+                       }
+#endif
+               }
+
+               void RemoveNewFormat (X509Certificate certificate)
+               {
+#if INSIDE_CORLIB
+                       throw new NotSupportedException ();
+#else
+                       using (var sscxCert = new SSCX.X509Certificate (certificate.RawData)) {
+                               var hash = SSCX.X509Helper2.GetSubjectNameHash (sscxCert);
+                               var filename = Path.Combine (_storePath, string.Format ("{0:x8}.0", hash));
+                               if (File.Exists (filename)) {
+                                       File.Delete (filename);
+                                       ClearCertificates ();
+                               }
+                       }
+#endif
+               }
+
                // private stuff
 
                private string GetUniqueNameWithSerial (X509Certificate certificate)
@@ -279,7 +334,7 @@ namespace Mono.Security.X509 {
                {
                        byte[] data = Load (filename);
                        X509Certificate cert = new X509Certificate (data);
-#if !NET_2_1
+#if !MOBILE
                        // If privateKey it's available, load it too..
                        CspParameters cspParams = new CspParameters ();
                        cspParams.KeyContainerName = CryptoConvert.ToHex (cert.Hash);
@@ -371,7 +426,7 @@ namespace Mono.Security.X509 {
                        }
                        return list;
                }
-#if !NET_2_1
+#if !MOBILE
                private void ImportPrivateKey (X509Certificate certificate, CspParameters cspParams)
                {
                        RSACryptoServiceProvider rsaCsp = certificate.RSA as RSACryptoServiceProvider;
index db735834acd4ca39c0310cca71612eeadac7a7c9..7f31713b1b226e6aed757774cbd181afb28c159a 100644 (file)
@@ -45,8 +45,12 @@ namespace Mono.Security.X509 {
 
                static private string _userPath;
                static private string _localMachinePath;
+               static private string _newUserPath;
+               static private string _newLocalMachinePath;
                static private X509Stores _userStore;
                static private X509Stores _machineStore;
+               static private X509Stores _newUserStore;
+               static private X509Stores _newMachineStore;
 
                private X509StoreManager ()
                {
@@ -55,10 +59,10 @@ namespace Mono.Security.X509 {
                internal static string CurrentUserPath {
                        get {
                                if (_userPath == null) {
-                                       _userPath = Path.Combine(
-                                                       Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
+                                       _userPath = Path.Combine (
+                                                       Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData),
                                                        ".mono");
-                                       _userPath = Path.Combine(_userPath, "certs");
+                                       _userPath = Path.Combine (_userPath, "certs");
                                }
                                return _userPath;
                        }
@@ -76,10 +80,34 @@ namespace Mono.Security.X509 {
                        }
                }
 
+               internal static string NewCurrentUserPath {
+                       get {
+                               if (_newUserPath == null) {
+                                       _newUserPath = Path.Combine (
+                                                       Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData),
+                                                       ".mono");
+                                       _newUserPath = Path.Combine (_newUserPath, "new-certs");
+                               }
+                               return _newUserPath;
+                       }
+               }
+
+               internal static string NewLocalMachinePath {
+                       get {
+                               if (_newLocalMachinePath == null) {
+                                       _newLocalMachinePath = Path.Combine (
+                                               Environment.GetFolderPath (Environment.SpecialFolder.CommonApplicationData),
+                                               ".mono");
+                                       _newLocalMachinePath = Path.Combine (_newLocalMachinePath, "new-certs");
+                               }
+                               return _newLocalMachinePath;
+                       }
+               }
+
                static public X509Stores CurrentUser {
                        get { 
                                if (_userStore == null)
-                                       _userStore = new X509Stores(CurrentUserPath);
+                                       _userStore = new X509Stores (CurrentUserPath, false);
                                
                                return _userStore;
                        }
@@ -88,12 +116,30 @@ namespace Mono.Security.X509 {
                static public X509Stores LocalMachine {
                        get {
                                if (_machineStore == null) 
-                                       _machineStore = new X509Stores (LocalMachinePath);
+                                       _machineStore = new X509Stores (LocalMachinePath, false);
 
                                return _machineStore;
                        }
                }
 
+               static public X509Stores NewCurrentUser {
+                       get {
+                               if (_newUserStore == null)
+                                       _newUserStore = new X509Stores (NewCurrentUserPath, true);
+
+                               return _newUserStore;
+                       }
+               }
+
+               static public X509Stores NewLocalMachine {
+                       get {
+                               if (_newMachineStore == null)
+                                       _newMachineStore = new X509Stores (NewLocalMachinePath, true);
+
+                               return _newMachineStore;
+                       }
+               }
+
                // Merged stores collections
                // we need to look at both the user and the machine (entreprise)
                // certificates/CRLs when building/validating a chain
index bfe7451b5dee1c229ac4ff2ae990ff92a60af0b8..071faa70dddefdf8aa7c6f8f7b33f2f80dad92e4 100644 (file)
@@ -44,15 +44,17 @@ namespace Mono.Security.X509 {
        class X509Stores {
 
                private string _storePath;
+               private bool _newFormat;
                private X509Store _personal;
                private X509Store _other;
                private X509Store _intermediate;
                private X509Store _trusted;
                private X509Store _untrusted;
 
-               internal X509Stores (string path
+               internal X509Stores (string path, bool newFormat)
                {
                        _storePath = path;
+                       _newFormat = newFormat;
                }
 
                // properties
@@ -61,7 +63,7 @@ namespace Mono.Security.X509 {
                        get { 
                                if (_personal == null) {
                                        string path = Path.Combine (_storePath, Names.Personal);
-                                       _personal = new X509Store (path, false);
+                                       _personal = new X509Store (path, false, false);
                                }
                                return _personal; 
                        }
@@ -71,7 +73,7 @@ namespace Mono.Security.X509 {
                        get { 
                                if (_other == null) {
                                        string path = Path.Combine (_storePath, Names.OtherPeople);
-                                       _other = new X509Store (path, false);
+                                       _other = new X509Store (path, false, false);
                                }
                                return _other; 
                        }
@@ -81,7 +83,7 @@ namespace Mono.Security.X509 {
                        get { 
                                if (_intermediate == null) {
                                        string path = Path.Combine (_storePath, Names.IntermediateCA);
-                                       _intermediate = new X509Store (path, true);
+                                       _intermediate = new X509Store (path, true, _newFormat);
                                }
                                return _intermediate; 
                        }
@@ -91,7 +93,7 @@ namespace Mono.Security.X509 {
                        get { 
                                if (_trusted == null) {
                                        string path = Path.Combine (_storePath, Names.TrustedRoot);
-                                       _trusted = new X509Store (path, true);
+                                       _trusted = new X509Store (path, true, _newFormat);
                                }
                                return _trusted; 
                        }
@@ -101,7 +103,7 @@ namespace Mono.Security.X509 {
                        get { 
                                if (_untrusted == null) {
                                        string path = Path.Combine (_storePath, Names.Untrusted);
-                                       _untrusted = new X509Store (path, false);
+                                       _untrusted = new X509Store (path, false, _newFormat);
                                }
                                return _untrusted; 
                        }
@@ -138,7 +140,7 @@ namespace Mono.Security.X509 {
                        if (!create && !Directory.Exists (path))
                                return null;
 
-                       return new X509Store (path, true);
+                       return new X509Store (path, true, false);
                }
 
                // names
@@ -151,7 +153,7 @@ namespace Mono.Security.X509 {
                        public const string IntermediateCA = "CA";
                        public const string TrustedRoot = "Trust";
                        public const string Untrusted = "Disallowed";
-                       
+
                        public Names () {}
                }
        }
index 652115f85a3b524b73977d9143b9aba4d30f45e1..65d146e17e50d7f944ec03e44f1b8080fbd53f43 100644 (file)
 ./Mono.Security.Interface/HashAlgorithmType.cs
 ./Mono.Security.Interface/IBufferOffsetSize.cs
 ./Mono.Security.Interface/IMonoTlsEventSink.cs
-./Mono.Security.Interface/IMonoTlsContext.cs
 ./Mono.Security.Interface/IMonoSslStream.cs
 ./Mono.Security.Interface/MonoTlsConnectionInfo.cs
 ./Mono.Security.Interface/MonoTlsProvider.cs
index 0ad21f2c4362fb069ea223c73805ebcfc041e0e6..6557bccc3e565b4202e2633eb30aa84b50b263cc 100644 (file)
@@ -2,7 +2,7 @@ thisdir = class/Mono.Security/Test/tools/sockethell
 SUBDIRS = 
 include ../../../../../build/rules.make
 
-LOCAL_MCS_FLAGS = -r:System.dll -r:Mono.Security.dll -r:../../../../lib/net_4_x/nunit.framework.dll
+LOCAL_MCS_FLAGS = -r:System.dll -r:Mono.Security.dll -r:../../../../lib/net_4_x/nunitlite.dll
 
 all-local install-local uninstall-local:
 
index 6c2e89d188014cbb752cd53ab70afa79703f3ab0..e904d162f830610e267282a3cc9649c9d7f021cc 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 2549142742184addc6e9678cd7f24e1ca9575fa4..61e1e3e6ace92929580a173f1eb78afc3049e354 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 7184cb7c2e5fcdb2f8d140c0e8cf06e22714adcb..5c5e3ef046a9f4a1fbbdae59e1345380fb86aa56 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
diff --git a/mcs/class/Mono.XBuild.Tasks/.gitignore b/mcs/class/Mono.XBuild.Tasks/.gitignore
new file mode 100644 (file)
index 0000000..c8cb717
--- /dev/null
@@ -0,0 +1 @@
+Test/test-config-file-*
index 8d50c7ad6294d7f8c10c527a4b39005e1c272e01..11f7b791c432538d4dfaff4ee48fd22745c6fe20 100644 (file)
@@ -10,6 +10,8 @@ LIBRARY = Mono.XBuild.Tasks.dll
 LIB_REFS = $(PARENT_PROFILE)System $(PARENT_PROFILE)System.Xml
 LIB_MCS_FLAGS =
 
+TEST_NUNITLITE_APP_CONFIG_RUNTIME=Test/test-config-file-$(PROFILE)
+
 include $(XBUILD_DIR)/xbuild_test.make
 
 include ../../build/library.make
index 88bcc5bf2e1db6c177a74ae2a768f039d4ea15b7..88fb6132b1e49dccfd0ff4d13c9526ee254f471e 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 0dbb1260ba9b06120690e6ce8b91397243621c1c..902f1ac16296e1358a959ce77aca605e4cbe1ade 100644 (file)
@@ -1 +1,2 @@
+../../test-helpers/NunitHelpers.cs
 Mono.XBuild.Tasks/PcFileCacheTest.cs
index 90e5b13419f317c41238330a6020a81ca03f0e0d..85023f8c15f1c6018c15ed8ad27ab440b258a8d9 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,612</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,612</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index dd4b88112dd7d1bac281c6ff8fd7c9c6d6a275e9..512068a6a1bd2a3ac612f6c6cf8733c008a0f157 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,414,618</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,414,618</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 21fe03503f4fba1d875c8834f261957f834cef81..e5d478024a1ab1578dbb3d56bd98b64ef16895e5 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index e062f5481634cc77b9baf72a0bfdbcad31debe1f..a479277657a59484fe8fa73d2cf940384e9cfef1 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,618</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,618</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 561d2fef4b2a656d5dde288fab45d8d9ca8cdd83..ce13a3687709430312c06b3db0079f700f1d80b5 100644 (file)
@@ -40,7 +40,7 @@ using System.Runtime.InteropServices;
 [assembly: NeutralResourcesLanguage ("en-US")]
 [assembly: CLSCompliant (true)]
 [assembly: AssemblyDelaySign (true)]
-#if NET_2_1
+#if MOBILE
 [assembly: AssemblyKeyFile ("../winfx.pub")]
 #else
 [assembly: AssemblyKeyFile ("../ecma.pub")]
index d20c1ba9eb9fa5fa8ce54dd469a5be393197e23c..9172432afe18bea81497ea8196107fcd5d5905e2 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 9c35c71ec5627798b735f29e46db1c9224af615b..6c6a5b5d52a5dcb1f7ee606f3a8aa309da4e9ea9 100644 (file)
@@ -5,7 +5,11 @@ include ../../build/rules.make
 LIBRARY = System.ComponentModel.Composition.dll
 LIB_REFS = System System.Core
 
-RESOURCE_DEFS = Microsoft.Internal.Strings,src/ComponentModel/Strings.resx
+NO_RESGEN := $(filter basic build, $(PROFILE))
+ifndef NO_RESGEN
+  RESOURCE_DEFS = Microsoft.Internal.Strings,src/ComponentModel/Strings.resx
+endif
+
 LIB_MCS_FLAGS = -d:CLR40 -d:USE_ECMA_KEY,FEATURE_REFLECTIONCONTEXT,FEATURE_REFLECTIONFILEIO,FEATURE_SERIALIZATION,FEATURE_SLIMLOCK -nowarn:219,414
 
 
index 598f507463cecd04fba5626b8c97d39b2e052aa2..2ba8941c832636c91cbd2eb6472a3bbbd66c0106 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,219,414</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;CLR40;USE_ECMA_KEY;FEATURE_REFLECTIONCONTEXT;FEATURE_REFLECTIONFILEIO;FEATURE_SERIALIZATION;FEATURE_SLIMLOCK</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;CLR40;USE_ECMA_KEY;FEATURE_REFLECTIONCONTEXT;FEATURE_REFLECTIONFILEIO;FEATURE_SERIALIZATION;FEATURE_SLIMLOCK</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,219,414</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;CLR40;USE_ECMA_KEY;FEATURE_REFLECTIONCONTEXT;FEATURE_REFLECTIONFILEIO;FEATURE_SERIALIZATION;FEATURE_SLIMLOCK</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;CLR40;USE_ECMA_KEY;FEATURE_REFLECTIONCONTEXT;FEATURE_REFLECTIONFILEIO;FEATURE_SERIALIZATION;FEATURE_SLIMLOCK</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 69eacf9c62079cd72bb359dc9ff3a731ee6b72c7..92b24b992ee80ee0b6f5f6a70a3517f547d6bb99 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,414</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,414</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index dc95296fbed551d7da20859dbab91e5f821b4ca7..d98c051699e6d8e3e16a4896ac4d6e8f1f834242 100644 (file)
@@ -36,7 +36,6 @@ using MonoTests.Common;
 
 namespace MonoTests.System.ComponentModel.DataAnnotations
 {
-#if NET_4_5
        [TestFixture]
        public class CompareAttributeTest
        {
@@ -66,5 +65,4 @@ namespace MonoTests.System.ComponentModel.DataAnnotations
                        Assert.IsNotNull (sla.GetValidationResult (DateTime.Now, ctx), "#B-4");
                }
        }
-#endif
 }
index 846ee326176cf4aaa46dd69ba1421be78055a3af..00cc74573f4a174f276b9c3882654a8e829926fc 100644 (file)
@@ -36,7 +36,6 @@ using MonoTests.Common;
 
 namespace MonoTests.System.ComponentModel.DataAnnotations
 {
-#if NET_4_5
        [TestFixture]
        public class CreditCardAttributeTest
        {
@@ -56,5 +55,4 @@ namespace MonoTests.System.ComponentModel.DataAnnotations
                        Assert.IsFalse (sla.IsValid (DateTime.Now), "#A1-8");
                }
        }
-#endif
 }
index 552e3eae6a44da5ba82b9dfc5e24f6604f6a0b9b..f85887cef65a51e78d8769ed6f5d130342301dab 100644 (file)
@@ -36,7 +36,6 @@ using MonoTests.Common;
 
 namespace MonoTests.System.ComponentModel.DataAnnotations
 {
-#if NET_4_5
        [TestFixture]
        public class EmailAddressAttributeTest
        {
@@ -84,5 +83,4 @@ namespace MonoTests.System.ComponentModel.DataAnnotations
                                Assert.IsFalse (sla.IsValid (InvalidAddresses[i]), "#B1-{0}", i);
                }
        }
-#endif
 }
index 257161fc06c0998d4ed161a1a55c587d85337c47..6ef0263365ce154383e65d1aef9a42887ae5b032 100644 (file)
@@ -36,7 +36,6 @@ using MonoTests.Common;
 
 namespace MonoTests.System.ComponentModel.DataAnnotations
 {
-#if NET_4_5
        [TestFixture]
        public class FileExtensionsAttributeTest
        {
@@ -57,5 +56,4 @@ namespace MonoTests.System.ComponentModel.DataAnnotations
                        Assert.IsFalse (sla.IsValid (DateTime.Now), "#A1-8");
                }
        }
-#endif
 }
index 3ca6e0bf3d42c2c5bc022c8848f877aae9cc191a..ef9c95dfb755847dbda80726394c0488fc663563 100644 (file)
@@ -36,7 +36,6 @@ using MonoTests.Common;
 
 namespace MonoTests.System.ComponentModel.DataAnnotations
 {
-#if NET_4_5
        [TestFixture]
        public class PhoneAttributeTest
        {
@@ -54,5 +53,4 @@ namespace MonoTests.System.ComponentModel.DataAnnotations
                        Assert.IsFalse (sla.IsValid (DateTime.Now), "#A1-7");
                }
        }
-#endif
 }
index d830e4f80397d064a3b6f160b934ee9328036c69..2e929fdbe321bec5fd34ec06808d20130a2e6b02 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 7cdf1b26842530f14994900c373c071a139c4e9c..e6f48050a99ed2acf322ac2d6d3ce25cb37d1eab 100644 (file)
@@ -10,6 +10,7 @@ LIB_REFS = secxml/System bare/System.Xml System.Security
 LIB_MCS_FLAGS = -nowarn:618
 TEST_MCS_FLAGS =
 TEST_LIB_REFS = System.Xml System
+TEST_NUNITLITE_APP_CONFIG_GLOBAL=Test/test-config-file
 
 include ../../build/library.make
 
@@ -20,6 +21,9 @@ configuration_library_deps = \
 
 $(build_lib): $(configuration_library_deps)
 
+test-local:
+       cp Test/appSettings.config $(dir $(NUNITLITE_CONFIG_FILE))/Test-appSettings.config
+
 .NOTPARALLEL: $(configuration_library_deps)
 
 $(secxml_libdir)/System.dll:
index 61bfe7fa885569ab3c0bfd7be709fa77954791c2..0bfbadd5ea387f6de3a6ce8e04a1dd8ddc4fc1de 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,618</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,618</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
diff --git a/mcs/class/System.Configuration/Test/App.config b/mcs/class/System.Configuration/Test/App.config
deleted file mode 100644 (file)
index d07b4f8..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<configuration>
-       <connectionStrings>
-               <add name="test-connstring"
-                       connectionString="Server=(local);Initial Catalog=someDb;User Id=someUser;Password=somePassword;Application Name=someAppName;Min Pool Size=5;Max Pool Size=500;Connect Timeout=10;Connection Lifetime=29;" />
-       </connectionStrings>
-  <appSettings file="Test/appSettings.config" />
-</configuration>
index 83e87e21b6a4deb891818d1ec5744fb290ba6d44..f0445810330c81bf312037684e889cf54e50d30a 100644 (file)
@@ -65,9 +65,9 @@ namespace MonoTests.System.Configuration
                {
                        Directory.SetCurrentDirectory (tempFolder);
 
-                       var currentAssembly = Assembly.GetExecutingAssembly ().Location;
+                       var currentAssembly = TestUtil.ThisApplicationPath;
                        var config = ConfigurationManager.OpenExeConfiguration (currentAssembly);
-                       Assert.AreEqual ("Test/appSettings.config", config.AppSettings.File, "#A01");
+                       Assert.AreEqual ("Test-appSettings.config", config.AppSettings.File, "#A01");
                        Assert.AreEqual ("foo", ConfigurationSettings.AppSettings["TestKey1"], "#A02");
                        Assert.AreEqual ("bar", ConfigurationSettings.AppSettings["TestKey2"], "#A03");
                }
index 7efff1dddffcf879f53a0a534b24cded54d0a213..0b5b3cde0dc1117329452266bc424283f5e90573 100644 (file)
@@ -257,10 +257,9 @@ namespace MonoTests.System.Configuration {
                [Test]
                public void exePath_UserLevelNone ()
                {
-                       string basedir = AppDomain.CurrentDomain.BaseDirectory;
-                       string name = TestUtil.ThisDllName;
+                       string name = TestUtil.ThisApplicationPath;
                        SysConfig config = ConfigurationManager.OpenExeConfiguration (name);
-                       Assert.AreEqual (Path.Combine (basedir, name + ".config"), config.FilePath);
+                       Assert.AreEqual (TestUtil.ThisApplicationPath + ".config", config.FilePath);
                }
 
                [Test]
@@ -615,11 +614,6 @@ namespace MonoTests.System.Configuration {
                [Test]
                public void TestConnectionStringRetrieval ()
                {
-                       var currentAssembly = Assembly.GetExecutingAssembly().Location;
-                       Assert.IsTrue (File.Exists (currentAssembly + ".config"),
-                                      String.Format ("This test cannot succeed without the .config file being in the same place as the assembly ({0})",
-                                                     currentAssembly));
-
                        var connStringObj = ConfigurationManager.ConnectionStrings ["test-connstring"];
                        Assert.IsNotNull (connStringObj);
                        var connString = connStringObj.ConnectionString;
index 4d0e369b414a45eebbdad975446df6e8e7c584f7..2bb7723f7a0dc37d6d8e8f64c455b583a10ce16f 100644 (file)
@@ -37,7 +37,6 @@ using SysConfig = System.Configuration.Configuration;
 
 using NUnit.Framework;
 using NUnit.Framework.Constraints;
-using NUnit.Framework.SyntaxHelpers;
 
 namespace MonoTests.System.Configuration {
        using Util;
index 6faeba67a14b2212d74a2b3643828c129d7678ee..497a8a8081da1ee056ebed31b4bb34427ee2c5b3 100644 (file)
@@ -64,17 +64,16 @@ namespace MonoTests.System.Configuration.Util {
                        }
                }
 
-               public static string ThisDllName {
+               public static string ThisApplicationPath {
                        get {
-                               var asm = Assembly.GetCallingAssembly ();
-                               return Path.GetFileName (asm.Location);
+                               var asm = Assembly.GetEntryAssembly ();
+                               return asm.Location;
                        }
                }
 
                public static string ThisConfigFileName {
                        get {
-                               var asm = Assembly.GetCallingAssembly ();
-                               var exe = Path.GetFileName (asm.Location);
+                               var exe = Path.GetFileName (ThisApplicationPath);
                                return exe + ".config";
                        }
                }
diff --git a/mcs/class/System.Configuration/Test/test-config-file b/mcs/class/System.Configuration/Test/test-config-file
new file mode 100644 (file)
index 0000000..5920c6c
--- /dev/null
@@ -0,0 +1,5 @@
+       <connectionStrings>
+               <add name="test-connstring"
+                       connectionString="Server=(local);Initial Catalog=someDb;User Id=someUser;Password=somePassword;Application Name=someAppName;Min Pool Size=5;Max Pool Size=500;Connect Timeout=10;Connection Lifetime=29;" />
+       </connectionStrings>
+  <appSettings file="Test-appSettings.config" />
diff --git a/mcs/class/System.Configuration/net_4_x_System.Configuration_test.dll.config b/mcs/class/System.Configuration/net_4_x_System.Configuration_test.dll.config
deleted file mode 120000 (symlink)
index 6f31b34..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Test/App.config
\ No newline at end of file
index aa3a0e53cccccec171e0c8e6eeba6e971f605886..c4ab9f0d23af8c11ac3f09211981388aeda4118e 100644 (file)
@@ -52,7 +52,7 @@ using System.Runtime.InteropServices;
 [assembly: NeutralResourcesLanguage ("en-US")]
 [assembly: CLSCompliant (true)]
 [assembly: AssemblyDelaySign (true)]
-#if NET_2_1
+#if MOBILE
        // attributes specific to FX 3.5
        [assembly: AssemblyKeyFile ("../silverlight.pub")]
 #else
index f165f3f62796abe4f1b545373fa8790efda7696f..e48161a358af4bccd8f1119cab6092ebebe55df3 100644 (file)
@@ -44,6 +44,10 @@ namespace Microsoft.Win32.SafeHandles
                        Initialize ((ulong)size);
                }
 
+               internal void Flush () {
+                       MemoryMapImpl.Flush (this.mmap_handle);
+               }
+
                protected override bool ReleaseHandle () {
                        if (this.handle != (IntPtr) (-1))
                                return MemoryMapImpl.Unmap (this.mmap_handle);
index 873ce5782aa4d48a2f32f86ee01e91746d8b9f9e..cbf1491612fcb12ef9a378c26e6cf214b0d30835 100644 (file)
@@ -30,10 +30,10 @@ using System;
 
 namespace Microsoft.Win32.SafeHandles
 {
-       public abstract class SafeNCryptHandle : System.Runtime.InteropServices.SafeHandle
+       public abstract class SafeNCryptHandle : SafeHandleZeroOrMinusOneIsInvalid
        {
                protected SafeNCryptHandle ()
-                       : base (IntPtr.Zero, true)
+                       : base (true)
                {
                }
 
index e2e8aaeba0c3fb58714b37f5cf13f816bf618d68..0c5768009b5b299ad165eca954ad455a1c04867e 100644 (file)
@@ -46,12 +46,8 @@ namespace Microsoft.Win32.SafeHandles
 
                protected override bool ReleaseHandle ()
                {
-                       try {
-                               Marshal.FreeHGlobal (handle);
-                               return true;
-                       } catch (ArgumentException) {
-                               return false;
-                       }
+                       MonoIOError error;
+                       return MonoIO.Close (handle, out error);
                }
        }
 }
index 2f65fc4c3bec1a546f3eb5e5eac62f4bef381221..00322d47801c24fe02ab1c1b23e5b947f569e9e7 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1720</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;FEATURE_PAL;PFX_LEGACY_3_5;FEATURE_NETCORE;INSIDE_SYSCORE;LIBC;NET_3_5;FEATURE_CORE_DLR;FEATURE_REFEMIT;FEATURE_PDBEMIT</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;FEATURE_PAL;PFX_LEGACY_3_5;FEATURE_NETCORE;INSIDE_SYSCORE;LIBC;NET_3_5;FEATURE_CORE_DLR;FEATURE_REFEMIT;FEATURE_PDBEMIT</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1720</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;FEATURE_PAL;PFX_LEGACY_3_5;FEATURE_NETCORE;INSIDE_SYSCORE;LIBC;NET_3_5;FEATURE_CORE_DLR;FEATURE_REFEMIT;FEATURE_PDBEMIT</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;FEATURE_PAL;PFX_LEGACY_3_5;FEATURE_NETCORE;INSIDE_SYSCORE;LIBC;NET_3_5;FEATURE_CORE_DLR;FEATURE_REFEMIT;FEATURE_PDBEMIT</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -48,6 +49,7 @@
   </PropertyGroup>\r
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />\r
   <ItemGroup>\r
+    <Compile Include="..\..\build\common\MonoTODOAttribute.cs" />\r
     <Compile Include="..\..\build\common\SR.cs" />\r
     <Compile Include="..\dlr\Runtime\Microsoft.Scripting.Core\Actions\BinaryOperationBinder.cs" />\r
     <Compile Include="..\dlr\Runtime\Microsoft.Scripting.Core\Actions\BindingRestrictions.cs" />\r
     <Compile Include="..\referencesource\System.Core\System\Runtime\CompilerServices\ExecutionScope.cs" />\r
     <Compile Include="..\referencesource\System.Core\System\Security\Cryptography\Aes.cs" />\r
     <Compile Include="..\referencesource\System.Core\System\Security\Cryptography\AesManaged.cs" />\r
+    <Compile Include="..\referencesource\System.Core\System\Security\Cryptography\BCryptNative.cs" />\r
+    <Compile Include="..\referencesource\System.Core\System\Security\Cryptography\CngAlgorithm.cs" />\r
+    <Compile Include="..\referencesource\System.Core\System\Security\Cryptography\CngAlgorithmGroup.cs" />\r
+    <Compile Include="..\referencesource\System.Core\System\Security\Cryptography\CngKey.cs" />\r
     <Compile Include="..\referencesource\System.Core\System\Security\Cryptography\CngKeyBlobFormat.cs" />\r
+    <Compile Include="..\referencesource\System.Core\System\Security\Cryptography\CngKeyCreationParameters.cs" />\r
+    <Compile Include="..\referencesource\System.Core\System\Security\Cryptography\CngProperty.cs" />\r
+    <Compile Include="..\referencesource\System.Core\System\Security\Cryptography\CngProvider.cs" />\r
+    <Compile Include="..\referencesource\System.Core\System\Security\Cryptography\CngUIPolicy.cs" />\r
     <Compile Include="..\referencesource\System.Core\System\Security\Cryptography\ECDiffieHellman.cs" />\r
     <Compile Include="..\referencesource\System.Core\System\Security\Cryptography\ECDiffieHellmanPublicKey.cs" />\r
     <Compile Include="..\referencesource\System.Core\System\Security\Cryptography\ECDsa.cs" />\r
+    <Compile Include="..\referencesource\System.Core\System\Security\Cryptography\ECDsaCng.cs" />\r
     <Compile Include="..\referencesource\System.Core\System\Security\Cryptography\ECKeyXmlFormat.cs" />\r
+    <Compile Include="..\referencesource\System.Core\System\Security\Cryptography\NCryptNative.cs" />\r
+    <Compile Include="..\referencesource\System.Core\System\Security\Cryptography\RsaCng.cs" />\r
     <Compile Include="..\referencesource\System.Core\System\threading\ReaderWriterLockSlim\LockRecursionException.cs" />\r
     <Compile Include="..\referencesource\System.Core\System\threading\ReaderWriterLockSlim\ReaderWriterLockSlim.cs" />\r
     <Compile Include="..\referencesource\System.Core\System\threading\Tasks\TaskExtensions.cs" />\r
     <Compile Include="Assembly\AssemblyInfo.cs" />\r
     <Compile Include="Microsoft.Win32.SafeHandles\SafeMemoryMappedFileHandle.cs" />\r
     <Compile Include="Microsoft.Win32.SafeHandles\SafeMemoryMappedViewHandle.cs" />\r
+    <Compile Include="Microsoft.Win32.SafeHandles\SafeNCryptHandle.cs" />\r
+    <Compile Include="Microsoft.Win32.SafeHandles\SafeNCryptKeyHandle.cs" />\r
+    <Compile Include="Microsoft.Win32.SafeHandles\SafeNCryptProviderHandle.cs" />\r
+    <Compile Include="Microsoft.Win32.SafeHandles\SafeNCryptSecretHandle.cs" />\r
     <Compile Include="Microsoft.Win32.SafeHandles\SafePipeHandle.cs" />\r
     <Compile Include="ReferenceSources\Error.cs" />\r
     <Compile Include="ReferenceSources\SR.cs" />\r
     <Compile Include="System.IO.Pipes\PipeTransmissionMode.cs" />\r
     <Compile Include="System.IO.Pipes\PipeUnix.cs" />\r
     <Compile Include="System.IO.Pipes\PipeWin32.cs" />\r
+    <Compile Include="System.Security.Cryptography.X509Certificates\ECDsaCertificateExtensions.cs" />\r
+    <Compile Include="System.Security.Cryptography.X509Certificates\RSACertificateExtensions.cs" />\r
+    <Compile Include="System.Security.Cryptography\AesCng.cs" />\r
     <Compile Include="System.Security.Cryptography\AesCryptoServiceProvider.cs" />\r
     <Compile Include="System.Security.Cryptography\AesTransform.cs" />\r
-    <Compile Include="System.Security.Cryptography\CngAlgorithm.cs" />\r
-    <Compile Include="System.Security.Cryptography\CngAlgorithmGroup.cs" />\r
+    <Compile Include="System.Security.Cryptography\ECCurve.cs" />\r
+    <Compile Include="System.Security.Cryptography\ECParameters.cs" />\r
+    <Compile Include="System.Security.Cryptography\ECPoint.cs" />\r
     <Compile Include="System.Security.Cryptography\MD5Cng.cs" />\r
     <Compile Include="System.Security.Cryptography\SHA1Cng.cs" />\r
     <Compile Include="System.Security.Cryptography\SHA256Cng.cs" />\r
     <Compile Include="System.Security.Cryptography\SHA384CryptoServiceProvider.cs" />\r
     <Compile Include="System.Security.Cryptography\SHA512Cng.cs" />\r
     <Compile Include="System.Security.Cryptography\SHA512CryptoServiceProvider.cs" />\r
+    <Compile Include="System.Security.Cryptography\TripleDESCng.cs" />\r
     <Compile Include="System\Util.cs" />\r  </ItemGroup>\r
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \r
        Other similar extension points exist, see Microsoft.Common.targets.\r
index 110a22b1b29efd2295f370df532da13da5bba1ee..4ee13c996168fce7f282e77c01c78637b85da4c8 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1720</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;FEATURE_PAL;PFX_LEGACY_3_5;FEATURE_NETCORE;INSIDE_SYSCORE;LIBC;NET_3_5;FEATURE_CORE_DLR;FEATURE_REFEMIT;FEATURE_PDBEMIT</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;FEATURE_PAL;PFX_LEGACY_3_5;FEATURE_NETCORE;INSIDE_SYSCORE;LIBC;NET_3_5;FEATURE_CORE_DLR;FEATURE_REFEMIT;FEATURE_PDBEMIT</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1720</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;FEATURE_PAL;PFX_LEGACY_3_5;FEATURE_NETCORE;INSIDE_SYSCORE;LIBC;NET_3_5;FEATURE_CORE_DLR;FEATURE_REFEMIT;FEATURE_PDBEMIT</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;FEATURE_PAL;PFX_LEGACY_3_5;FEATURE_NETCORE;INSIDE_SYSCORE;LIBC;NET_3_5;FEATURE_CORE_DLR;FEATURE_REFEMIT;FEATURE_PDBEMIT</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -48,6 +49,7 @@
   </PropertyGroup>\r
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />\r
   <ItemGroup>\r
+    <Compile Include="..\..\build\common\MonoTODOAttribute.cs" />\r
     <Compile Include="..\..\build\common\SR.cs" />\r
     <Compile Include="..\dlr\Runtime\Microsoft.Scripting.Core\Actions\BinaryOperationBinder.cs" />\r
     <Compile Include="..\dlr\Runtime\Microsoft.Scripting.Core\Actions\BindingRestrictions.cs" />\r
     <Compile Include="..\referencesource\System.Core\System\Runtime\CompilerServices\ExecutionScope.cs" />\r
     <Compile Include="..\referencesource\System.Core\System\Security\Cryptography\Aes.cs" />\r
     <Compile Include="..\referencesource\System.Core\System\Security\Cryptography\AesManaged.cs" />\r
+    <Compile Include="..\referencesource\System.Core\System\Security\Cryptography\BCryptNative.cs" />\r
+    <Compile Include="..\referencesource\System.Core\System\Security\Cryptography\CngAlgorithm.cs" />\r
+    <Compile Include="..\referencesource\System.Core\System\Security\Cryptography\CngAlgorithmGroup.cs" />\r
+    <Compile Include="..\referencesource\System.Core\System\Security\Cryptography\CngKey.cs" />\r
     <Compile Include="..\referencesource\System.Core\System\Security\Cryptography\CngKeyBlobFormat.cs" />\r
+    <Compile Include="..\referencesource\System.Core\System\Security\Cryptography\CngKeyCreationParameters.cs" />\r
+    <Compile Include="..\referencesource\System.Core\System\Security\Cryptography\CngProperty.cs" />\r
+    <Compile Include="..\referencesource\System.Core\System\Security\Cryptography\CngProvider.cs" />\r
+    <Compile Include="..\referencesource\System.Core\System\Security\Cryptography\CngUIPolicy.cs" />\r
     <Compile Include="..\referencesource\System.Core\System\Security\Cryptography\ECDiffieHellman.cs" />\r
     <Compile Include="..\referencesource\System.Core\System\Security\Cryptography\ECDiffieHellmanPublicKey.cs" />\r
     <Compile Include="..\referencesource\System.Core\System\Security\Cryptography\ECDsa.cs" />\r
+    <Compile Include="..\referencesource\System.Core\System\Security\Cryptography\ECDsaCng.cs" />\r
     <Compile Include="..\referencesource\System.Core\System\Security\Cryptography\ECKeyXmlFormat.cs" />\r
+    <Compile Include="..\referencesource\System.Core\System\Security\Cryptography\NCryptNative.cs" />\r
+    <Compile Include="..\referencesource\System.Core\System\Security\Cryptography\RsaCng.cs" />\r
     <Compile Include="..\referencesource\System.Core\System\threading\ReaderWriterLockSlim\LockRecursionException.cs" />\r
     <Compile Include="..\referencesource\System.Core\System\threading\ReaderWriterLockSlim\ReaderWriterLockSlim.cs" />\r
     <Compile Include="..\referencesource\System.Core\System\threading\Tasks\TaskExtensions.cs" />\r
     <Compile Include="Assembly\AssemblyInfo.cs" />\r
     <Compile Include="Microsoft.Win32.SafeHandles\SafeMemoryMappedFileHandle.cs" />\r
     <Compile Include="Microsoft.Win32.SafeHandles\SafeMemoryMappedViewHandle.cs" />\r
+    <Compile Include="Microsoft.Win32.SafeHandles\SafeNCryptHandle.cs" />\r
+    <Compile Include="Microsoft.Win32.SafeHandles\SafeNCryptKeyHandle.cs" />\r
+    <Compile Include="Microsoft.Win32.SafeHandles\SafeNCryptProviderHandle.cs" />\r
+    <Compile Include="Microsoft.Win32.SafeHandles\SafeNCryptSecretHandle.cs" />\r
     <Compile Include="Microsoft.Win32.SafeHandles\SafePipeHandle.cs" />\r
     <Compile Include="ReferenceSources\Error.cs" />\r
     <Compile Include="ReferenceSources\SR.cs" />\r
     <Compile Include="System.IO.Pipes\PipeTransmissionMode.cs" />\r
     <Compile Include="System.IO.Pipes\PipeUnix.cs" />\r
     <Compile Include="System.IO.Pipes\PipeWin32.cs" />\r
+    <Compile Include="System.Security.Cryptography.X509Certificates\ECDsaCertificateExtensions.cs" />\r
+    <Compile Include="System.Security.Cryptography.X509Certificates\RSACertificateExtensions.cs" />\r
+    <Compile Include="System.Security.Cryptography\AesCng.cs" />\r
     <Compile Include="System.Security.Cryptography\AesCryptoServiceProvider.cs" />\r
     <Compile Include="System.Security.Cryptography\AesTransform.cs" />\r
-    <Compile Include="System.Security.Cryptography\CngAlgorithm.cs" />\r
-    <Compile Include="System.Security.Cryptography\CngAlgorithmGroup.cs" />\r
+    <Compile Include="System.Security.Cryptography\ECCurve.cs" />\r
+    <Compile Include="System.Security.Cryptography\ECParameters.cs" />\r
+    <Compile Include="System.Security.Cryptography\ECPoint.cs" />\r
     <Compile Include="System.Security.Cryptography\MD5Cng.cs" />\r
     <Compile Include="System.Security.Cryptography\SHA1Cng.cs" />\r
     <Compile Include="System.Security.Cryptography\SHA256Cng.cs" />\r
     <Compile Include="System.Security.Cryptography\SHA384CryptoServiceProvider.cs" />\r
     <Compile Include="System.Security.Cryptography\SHA512Cng.cs" />\r
     <Compile Include="System.Security.Cryptography\SHA512CryptoServiceProvider.cs" />\r
+    <Compile Include="System.Security.Cryptography\TripleDESCng.cs" />\r
     <Compile Include="System\Util.cs" />\r  </ItemGroup>\r
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \r
        Other similar extension points exist, see Microsoft.Common.targets.\r
index 18bfca4934c79d7c257bd8a1f4f0451049da4e7b..7a3cce164f61e2feffc9b46fcd751d1c75626e91 100644 (file)
@@ -70,7 +70,7 @@ namespace System.IO.MemoryMappedFiles
                        case 1:
                                return new ArgumentException ("A positive capacity must be specified for a Memory Mapped File backed by an empty file.");
                        case 2:
-                               return new ArgumentOutOfRangeException ("The capacity may not be smaller than the file size.");
+                               return new ArgumentOutOfRangeException ("capacity", "The capacity may not be smaller than the file size.");
                        case 3:
                                return new FileNotFoundException (path);
                        case 4:
@@ -85,6 +85,10 @@ namespace System.IO.MemoryMappedFiles
                                return new ArgumentException ("Invalid FileMode value.");
                        case 9:
                                return new IOException ("Could not map file");
+                       case 10:
+                               return new UnauthorizedAccessException ("Access to the path is denied.");
+                       case 11:
+                               return new ArgumentOutOfRangeException ("capacity", "The capacity cannot be greater than the size of the system's logical address space.");
                        default:
                                return new IOException ("Failed with unknown error code " + error);
                        }
@@ -111,9 +115,9 @@ namespace System.IO.MemoryMappedFiles
 
 
        public class MemoryMappedFile : IDisposable {
-               MemoryMappedFileAccess fileAccess;
-               string name;
-               long fileCapacity;
+               // MemoryMappedFileAccess fileAccess;
+               // string name;
+               // long fileCapacity;
 
                //
                // We allow the use of either the FileStream/keepOpen combo
@@ -140,12 +144,12 @@ namespace System.IO.MemoryMappedFiles
                        if (mode == FileMode.Append)
                                throw new ArgumentException ("mode");
 
-                       IntPtr handle = MemoryMapImpl.OpenFile (path, mode, null, out capacity, MemoryMappedFileAccess.ReadWrite, MemoryMappedFileOptions.DelayAllocatePages);
+                       IntPtr handle = MemoryMapImpl.OpenFile (path, mode, null, out capacity, MemoryMappedFileAccess.ReadWrite, MemoryMappedFileOptions.None);
 
                        return new MemoryMappedFile () {
                                handle = handle,
-                               fileAccess = MemoryMappedFileAccess.ReadWrite,
-                               fileCapacity = capacity
+                               // fileAccess = MemoryMappedFileAccess.ReadWrite,
+                               // fileCapacity = capacity
                        };
                }
 
@@ -172,13 +176,13 @@ namespace System.IO.MemoryMappedFiles
                        if (capacity < 0)
                                throw new ArgumentOutOfRangeException ("capacity");
 
-                       IntPtr handle = MemoryMapImpl.OpenFile (path, mode, mapName, out capacity, access, MemoryMappedFileOptions.DelayAllocatePages);
+                       IntPtr handle = MemoryMapImpl.OpenFile (path, mode, mapName, out capacity, access, MemoryMappedFileOptions.None);
                        
                        return new MemoryMappedFile () {
                                handle = handle,
-                               fileAccess = access,
-                               name = mapName,
-                               fileCapacity = capacity
+                               // fileAccess = access,
+                               // name = mapName,
+                               // fileCapacity = capacity
                        };
                }
 
@@ -193,15 +197,15 @@ namespace System.IO.MemoryMappedFiles
                        if ((!MonoUtil.IsUnix && capacity == 0 && fileStream.Length == 0) || (capacity > fileStream.Length))
                                throw new ArgumentException ("capacity");
 
-                       IntPtr handle = MemoryMapImpl.OpenHandle (fileStream.Handle, mapName, out capacity, access, MemoryMappedFileOptions.DelayAllocatePages);
+                       IntPtr handle = MemoryMapImpl.OpenHandle (fileStream.SafeFileHandle.DangerousGetHandle (), mapName, out capacity, access, MemoryMappedFileOptions.None);
                        
                        MemoryMapImpl.ConfigureHandleInheritability (handle, inheritability);
                                
                        return new MemoryMappedFile () {
                                handle = handle,
-                               fileAccess = access,
-                               name = mapName,
-                               fileCapacity = capacity,
+                               // fileAccess = access,
+                               // name = mapName,
+                               // fileCapacity = capacity,
 
                                stream = fileStream,
                                keepOpen = leaveOpen
@@ -220,15 +224,15 @@ namespace System.IO.MemoryMappedFiles
                        if ((!MonoUtil.IsUnix && capacity == 0 && fileStream.Length == 0) || (capacity > fileStream.Length))
                                throw new ArgumentException ("capacity");
 
-                       IntPtr handle = MemoryMapImpl.OpenHandle (fileStream.Handle, mapName, out capacity, access, MemoryMappedFileOptions.DelayAllocatePages);
+                       IntPtr handle = MemoryMapImpl.OpenHandle (fileStream.SafeFileHandle.DangerousGetHandle (), mapName, out capacity, access, MemoryMappedFileOptions.None);
                        
                        MemoryMapImpl.ConfigureHandleInheritability (handle, inheritability);
                                
                        return new MemoryMappedFile () {
                                handle = handle,
-                               fileAccess = access,
-                               name = mapName,
-                               fileCapacity = capacity,
+                               // fileAccess = access,
+                               // name = mapName,
+                               // fileCapacity = capacity,
 
                                stream = fileStream,
                                keepOpen = leaveOpen
@@ -249,22 +253,22 @@ namespace System.IO.MemoryMappedFiles
                        
                        return new MemoryMappedFile () {
                                handle = handle,
-                               fileAccess = access,
-                               name = mapName,
-                               fileCapacity = capacity
+                               // fileAccess = access,
+                               // name = mapName,
+                               // fileCapacity = capacity
                        };                      
                }
 
                [MonoLimitation ("Named mappings scope is process local")]
                public static MemoryMappedFile CreateNew (string mapName, long capacity)
                {
-                       return CreateNew (mapName, capacity, MemoryMappedFileAccess.ReadWrite, MemoryMappedFileOptions.DelayAllocatePages, null, HandleInheritability.None);
+                       return CreateNew (mapName, capacity, MemoryMappedFileAccess.ReadWrite, MemoryMappedFileOptions.None, null, HandleInheritability.None);
                }
 
                [MonoLimitation ("Named mappings scope is process local")]
                public static MemoryMappedFile CreateNew (string mapName, long capacity, MemoryMappedFileAccess access) 
                {
-                       return CreateNew (mapName, capacity, access, MemoryMappedFileOptions.DelayAllocatePages, null, HandleInheritability.None);
+                       return CreateNew (mapName, capacity, access, MemoryMappedFileOptions.None, null, HandleInheritability.None);
                }
 
                [MonoLimitation ("Named mappings scope is process local; options is ignored")]
@@ -290,7 +294,7 @@ namespace System.IO.MemoryMappedFiles
                [MonoLimitation ("Named mappings scope is process local")]
                public static MemoryMappedFile CreateOrOpen (string mapName, long capacity, MemoryMappedFileAccess access)
                {
-                       return CreateOrOpen (mapName, capacity, access, MemoryMappedFileOptions.DelayAllocatePages, null, HandleInheritability.None);
+                       return CreateOrOpen (mapName, capacity, access, MemoryMappedFileOptions.None, null, HandleInheritability.None);
                }
 
                [MonoLimitation ("Named mappings scope is process local")]
index 9362f00b1626a3e4aab06a5dc47f34d51358a6e0..b0be2e4f1885c20f28947b8de734b76d478a96d8 100644 (file)
@@ -92,7 +92,7 @@ namespace System.IO.MemoryMappedFiles
 
                public void Flush (IntPtr capacity)
                {
-                       MemoryMapImpl.Flush (m_viewHandle.DangerousGetHandle ());
+                       m_viewHandle.Flush ();
                }
                
                protected virtual void Dispose (bool disposing)
index 23bf26f7482bb7654e1e5043f8381c937000f460..a4818f76049ea471ba429953552c602269a8a6b3 100644 (file)
@@ -77,8 +77,8 @@ namespace System.IO.Pipes
                        throw new NotImplementedException ();
 #else
                        InitializeHandle (safePipeHandle, false, false);
-#endif
                        IsConnected = true;
+#endif
                }
 
                ~AnonymousPipeClientStream ()
index 97455f30cdab55d78766508ad566684a21674a3b..18c82aeac3123a789d24b4f03217d087ec1429bf 100644 (file)
@@ -70,13 +70,15 @@ namespace System.IO.Pipes
                }
 #endif
 
-#if !MOBILE
                public AnonymousPipeServerStream (PipeDirection direction, HandleInheritability inheritability, int bufferSize, PipeSecurity pipeSecurity)
                        : base (direction, bufferSize)
                {
                        if (direction == PipeDirection.InOut)
                                throw new NotSupportedException ("Anonymous pipe direction can only be either in or out.");
 
+#if MOBILE
+                       throw new NotImplementedException ();
+#else
                        if (IsWindows)
                                impl = new Win32AnonymousPipeServer (this, direction, inheritability, bufferSize, pipeSecurity);
                        else
@@ -84,8 +86,8 @@ namespace System.IO.Pipes
 
                        InitializeHandle (impl.Handle, false, false);
                        IsConnected = true;
-               }
 #endif
+               }
 
                [MonoTODO]
                public AnonymousPipeServerStream (PipeDirection direction, SafePipeHandle serverSafePipeHandle, SafePipeHandle clientSafePipeHandle)
index a5a9ebd3fbc698acd1801824f8ac2d37fc21ab3b..a27c4dc0b4d3697f8aca9edf8f2cad7bf8d10499 100644 (file)
@@ -100,26 +100,30 @@ namespace System.IO.Pipes
 #endif
                }
 
-#if !MOBILE
                public NamedPipeClientStream (string serverName, string pipeName, PipeAccessRights desiredAccessRights, PipeOptions options, TokenImpersonationLevel impersonationLevel, HandleInheritability inheritability)
                        : base (ToDirection (desiredAccessRights), DefaultBufferSize)
                {
                        if (impersonationLevel != TokenImpersonationLevel.None ||
                            inheritability != HandleInheritability.None)
                                throw ThrowACLException ();
-
+#if MOBILE
+                       throw new NotImplementedException ();
+#else
                        if (IsWindows)
                                impl = new Win32NamedPipeClient (this, serverName, pipeName, desiredAccessRights, options, inheritability);
                        else
                                impl = new UnixNamedPipeClient (this, serverName, pipeName, desiredAccessRights, options, inheritability);
-               }
 #endif
 
+               }
+
                ~NamedPipeClientStream () {
                        Dispose (false);
                }
-               
+
+#if !MOBILE
                INamedPipeClient impl;
+#endif
 
                public void Connect ()
                {
@@ -163,10 +167,18 @@ namespace System.IO.Pipes
                        throw new NotImplementedException ();
                }
 
+               protected override internal void CheckPipePropertyOperations () {
+                       base.CheckPipePropertyOperations();
+               }
+
                public int NumberOfServerInstances {
                        get {
                                CheckPipePropertyOperations ();
+#if MOBILE
+                               throw new NotImplementedException ();
+#else
                                return impl.NumberOfServerInstances;
+#endif
                        }
                }
        }
index 3ffe89436727acf71c4a3be5afbd61aed7d9712f..d4d02ade208f4f415a2a1d817ac3c6598b103895 100644 (file)
@@ -83,7 +83,6 @@ namespace System.IO.Pipes
                }
 #endif
 
-#if !MOBILE
                public NamedPipeServerStream (string pipeName, PipeDirection direction, int maxNumberOfServerInstances, PipeTransmissionMode transmissionMode, PipeOptions options, int inBufferSize, int outBufferSize, PipeSecurity pipeSecurity)
                        : this (pipeName, direction, maxNumberOfServerInstances, transmissionMode, options, inBufferSize, outBufferSize, pipeSecurity, HandleInheritability.None)
                {
@@ -98,6 +97,9 @@ namespace System.IO.Pipes
                public NamedPipeServerStream (string pipeName, PipeDirection direction, int maxNumberOfServerInstances, PipeTransmissionMode transmissionMode, PipeOptions options, int inBufferSize, int outBufferSize, PipeSecurity pipeSecurity, HandleInheritability inheritability, PipeAccessRights additionalAccessRights)
                        : base (direction, transmissionMode, outBufferSize)
                {
+#if MOBILE
+                       throw new NotImplementedException ();
+#else
                        var rights = ToAccessRights (direction) | additionalAccessRights;
                        // FIXME: reject some rights declarations (for ACL).
 
@@ -110,8 +112,8 @@ namespace System.IO.Pipes
                                                                rights, options, inBufferSize, outBufferSize, inheritability);
 
                        InitializeHandle (impl.Handle, false, (options & PipeOptions.Asynchronous) != PipeOptions.None);
-               }
 #endif
+               }
 
                public NamedPipeServerStream (PipeDirection direction, bool isAsync, bool isConnected, SafePipeHandle safePipeHandle)
                        : base (direction, DefaultBufferSize)
@@ -140,14 +142,12 @@ namespace System.IO.Pipes
                        impl.Disconnect ();
                }
 
-#if !MOBILE
                [MonoTODO]
                [SecurityPermission (SecurityAction.Demand, Flags = SecurityPermissionFlag.ControlPrincipal)]
                public void RunAsClient (PipeStreamImpersonationWorker impersonationWorker)
                {
                        throw new NotImplementedException ();
                }
-#endif
 
                public void WaitForConnection ()
                {
@@ -173,7 +173,6 @@ namespace System.IO.Pipes
                        throw new NotImplementedException ();
                }
 
-#if !MOBILE
                // async operations
 
                Action wait_connect_delegate;
@@ -190,7 +189,6 @@ namespace System.IO.Pipes
                {
                        wait_connect_delegate.EndInvoke (asyncResult);
                }
-#endif
        }
 }
 
index 20b7e7ec09cb8fa3a7f17df609d7f240237f2434..8dea76a2cacf96b9ff3010364d82008dbf7e31dd 100644 (file)
@@ -57,7 +57,6 @@ namespace System.IO.Pipes
                        return new NotImplementedException ("ACL is not supported in Mono");
                }
 
-#if !MOBILE
                internal static PipeAccessRights ToAccessRights (PipeDirection direction)
                {
                        switch (direction) {
@@ -88,7 +87,6 @@ namespace System.IO.Pipes
                                        throw new ArgumentOutOfRangeException ();
                        }
                }
-#endif
 
                protected PipeStream (PipeDirection direction, int bufferSize)
                        : this (direction, PipeTransmissionMode.Byte, bufferSize)
@@ -144,9 +142,7 @@ namespace System.IO.Pipes
                        set { stream = value; }
                }
 
-#if !MOBILE
                protected bool IsHandleExposed { get; private set; }
-#endif
 
                [MonoTODO]
                public bool IsMessageComplete { get; private set; }
@@ -182,19 +178,7 @@ namespace System.IO.Pipes
                }
 
                // initialize/dispose/state check
-#if MOBILE
-               internal static void CheckPipePropertyOperations ()
-               {
-               }
-
-               static void CheckReadOperations ()
-               {
-               }
 
-               static void CheckWriteOperations ()
-               {
-               }
-#else
                [MonoTODO]
                protected internal virtual void CheckPipePropertyOperations ()
                {
@@ -224,7 +208,6 @@ namespace System.IO.Pipes
                        this.IsHandleExposed = isExposed;
                        this.IsAsync = isAsync;
                }
-#endif
 
                protected override void Dispose (bool disposing)
                {
@@ -253,23 +236,29 @@ namespace System.IO.Pipes
                        throw new NotSupportedException ();
                }
 
-#if !MOBILE
                public PipeSecurity GetAccessControl ()
                {
+#if MOBILE
+                       throw new PlatformNotSupportedException ();
+#else
                        return new PipeSecurity (SafePipeHandle,
                                                 AccessControlSections.Owner |
                                                 AccessControlSections.Group |
                                                 AccessControlSections.Access);
+#endif
                }
 
                public void SetAccessControl (PipeSecurity pipeSecurity)
                {
+#if MOBILE
+                       throw new PlatformNotSupportedException ();
+#else
                        if (pipeSecurity == null)
                                throw new ArgumentNullException ("pipeSecurity");
                                
                        pipeSecurity.Persist (SafePipeHandle);
-               }
 #endif
+               }
 
                // pipe I/O
 
@@ -319,7 +308,6 @@ namespace System.IO.Pipes
 
                // async
 
-#if !MOBILE
                Func<byte [],int,int,int> read_delegate;
 
                [HostProtection (SecurityAction.LinkDemand, ExternalThreading = true)]
@@ -349,7 +337,6 @@ namespace System.IO.Pipes
                {
                        write_delegate.EndInvoke (asyncResult);
                }
-#endif
        }
 }
 
index 2f06df8949a4e2d2efc15a07fd8d581f7be49880..a1c7e22d8c49a07fe5b4e6ac31482a3a8a887449 100644 (file)
@@ -205,7 +205,7 @@ namespace System.IO.Pipes
                        opener = delegate {
                                var fs = new FileStream (name, FileMode.Open, RightsToFileAccess (desiredAccessRights), FileShare.ReadWrite);
                                owner.Stream = fs;
-                               handle = new SafePipeHandle (fs.Handle, false);
+                               handle = new SafePipeHandle (fs.SafeFileHandle.DangerousGetHandle (), false);
                        };
                }
 
@@ -271,7 +271,7 @@ namespace System.IO.Pipes
                        // FIXME: maxNumberOfServerInstances, modes, sizes, handle inheritability
                        
                        var fs = new FileStream (name, FileMode.Open, RightsToFileAccess (rights), FileShare.ReadWrite);
-                       handle = new SafePipeHandle (fs.Handle, false);
+                       handle = new SafePipeHandle (fs.SafeFileHandle.DangerousGetHandle (), false);
                        owner.Stream = fs;
                        should_close_handle = true;
                }
index 0e322e4b109a266a47bfa122883c76f917019494..81c303bd09135b7184ab1f67e1af9c63e1dcde17 100644 (file)
@@ -30,16 +30,18 @@ namespace System.Security.Cryptography.X509Certificates
 {
        public static class RSACertificateExtensions
        {
-               [MonoTODO]
                public static RSA GetRSAPrivateKey(this X509Certificate2 certificate)
                {
-                       throw new NotImplementedException ();
+                       if (certificate == null)
+                               throw new ArgumentNullException("certificate");
+                       return certificate.PrivateKey as RSA;
                }
 
-               [MonoTODO]
                public static RSA GetRSAPublicKey(this X509Certificate2 certificate)
                {
-                       throw new NotImplementedException ();
+                       if (certificate == null)
+                               throw new ArgumentNullException("certificate");
+                       return certificate.PublicKey.Key as RSA;
                }
        }
 }
index b9700de921e1c062d5f52bc77c22986ee61149aa..9e7d82c176b80df23e92be00d6b3249996a3202e 100644 (file)
@@ -99,7 +99,7 @@ namespace System.Security.Cryptography {
                                exKey [i] = exKey [i-Nk] ^ temp;
                        }
 
-#if NET_2_1
+#if MOBILE
                        // Silverlight 2.0 only supports CBC
                        if (!encryption) {
 #else
diff --git a/mcs/class/System.Core/System.Security.Cryptography/CngAlgorithm.cs b/mcs/class/System.Core/System.Security.Cryptography/CngAlgorithm.cs
deleted file mode 100644 (file)
index ea87b30..0000000
+++ /dev/null
@@ -1,192 +0,0 @@
-//
-// System.Security.Cryptography.CngAlgorithm
-//
-// Authors:
-//     Sebastien Pouliot  <sebastien@ximian.com>
-//
-// Copyright (C) 2008 Novell, Inc (http://www.novell.com)
-//
-// 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;
-
-namespace System.Security.Cryptography {
-
-       // note: CNG stands for "Cryptography API: Next Generation"
-
-       [Serializable]
-       public sealed class CngAlgorithm : IEquatable<CngAlgorithm> {
-
-               private string m_algorithm;
-
-               public CngAlgorithm (string algorithm)
-               {
-                       if (algorithm == null)
-                               throw new ArgumentNullException ("algorithm");
-                       if (algorithm.Length == 0)
-                               throw new ArgumentException ("algorithm");
-
-                       m_algorithm = algorithm;
-               }
-
-               public string Algorithm {
-                       get { return m_algorithm; }
-               }
-
-               public bool Equals (CngAlgorithm other)
-               {
-                       if (other == null)
-                               return false;
-                       return m_algorithm == other.m_algorithm;
-               }
-
-               public override bool Equals (object obj)
-               {
-                       return Equals (obj as CngAlgorithm);
-               }
-
-               public override int GetHashCode ()
-               {
-                       return m_algorithm.GetHashCode ();
-               }
-
-               public override string ToString ()
-               {
-                       return m_algorithm;
-               }
-
-               // static
-
-               static CngAlgorithm dh256;
-               static CngAlgorithm dh384;
-               static CngAlgorithm dh521;
-               static CngAlgorithm dsa256;
-               static CngAlgorithm dsa384;
-               static CngAlgorithm dsa521;
-               static CngAlgorithm md5;
-               static CngAlgorithm sha1;
-               static CngAlgorithm sha256;
-               static CngAlgorithm sha384;
-               static CngAlgorithm sha512;
-
-               public static CngAlgorithm ECDiffieHellmanP256 {
-                       get {
-                               if (dh256 == null)
-                                       dh256 = new CngAlgorithm ("ECDH_P256");
-                               return dh256;
-                       }
-               }
-
-               public static CngAlgorithm ECDiffieHellmanP384 {
-                       get {
-                               if (dh384 == null)
-                                       dh384 = new CngAlgorithm ("ECDH_P384");
-                               return dh384;
-                       }
-               }
-
-               public static CngAlgorithm ECDiffieHellmanP521 {
-                       get {
-                               if (dh521 == null)
-                                       dh521 = new CngAlgorithm ("ECDH_P521");
-                               return dh521;
-                       }
-               }
-
-               public static CngAlgorithm ECDsaP256 {
-                       get {
-                               if (dsa256 == null)
-                                       dsa256 = new CngAlgorithm ("ECDSA_P256");
-                               return dsa256;
-                       }
-               }
-
-               public static CngAlgorithm ECDsaP384 {
-                       get {
-                               if (dsa384 == null)
-                                       dsa384 = new CngAlgorithm ("ECDSA_P384");
-                               return dsa384;
-                       }
-               }
-
-               public static CngAlgorithm ECDsaP521 {
-                       get {
-                               if (dsa521 == null)
-                                       dsa521 = new CngAlgorithm ("ECDSA_P521");
-                               return dsa521;
-                       }
-               }
-
-               public static CngAlgorithm MD5 {
-                       get {
-                               if (md5 == null)
-                                       md5 = new CngAlgorithm ("MD5");
-                               return md5;
-                       }
-               }
-
-               public static CngAlgorithm Sha1 {
-                       get {
-                               if (sha1 == null)
-                                       sha1 = new CngAlgorithm ("SHA1");
-                               return sha1;
-                       }
-               }
-
-               public static CngAlgorithm Sha256 {
-                       get {
-                               if (sha256 == null)
-                                       sha256 = new CngAlgorithm ("SHA256");
-                               return sha256;
-                       }
-               }
-
-               public static CngAlgorithm Sha384 {
-                       get {
-                               if (sha384 == null)
-                                       sha384 = new CngAlgorithm ("SHA384");
-                               return sha384;
-                       }
-               }
-
-               public static CngAlgorithm Sha512 {
-                       get {
-                               if (sha512 == null)
-                                       sha512 = new CngAlgorithm ("SHA512");
-                               return sha512;
-                       }
-               }
-
-               public static bool operator == (CngAlgorithm left, CngAlgorithm right)
-               {
-                       if ((object)left == null)
-                               return ((object)right == null);
-                       return left.Equals (right);
-               }
-
-               public static bool operator != (CngAlgorithm left, CngAlgorithm right)
-               {
-                       if ((object)left == null)
-                               return ((object)right != null);
-                       return !left.Equals (right);
-               }
-       }
-}
diff --git a/mcs/class/System.Core/System.Security.Cryptography/CngAlgorithmGroup.cs b/mcs/class/System.Core/System.Security.Cryptography/CngAlgorithmGroup.cs
deleted file mode 100644 (file)
index fa43965..0000000
+++ /dev/null
@@ -1,138 +0,0 @@
-//
-// System.Security.Cryptography.CngAlgorithmGroup
-//
-// Authors:
-//     Sebastien Pouliot  <sebastien@ximian.com>
-//
-// Copyright (C) 2008 Novell, Inc (http://www.novell.com)
-//
-// 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;
-
-namespace System.Security.Cryptography {
-
-       // note: CNG stands for "Cryptography API: Next Generation"
-
-       [Serializable]
-       public sealed class CngAlgorithmGroup : IEquatable<CngAlgorithmGroup> {
-
-               private string m_algorithmGroup;
-
-               public CngAlgorithmGroup (string algorithmGroup)
-               {
-                       if (algorithmGroup == null)
-                               throw new ArgumentNullException ("algorithmGroup");
-                       if (algorithmGroup.Length == 0)
-                               throw new ArgumentException ("algorithmGroup");
-
-                       m_algorithmGroup = algorithmGroup;
-               }
-
-               public string AlgorithmGroup {
-                       get { return m_algorithmGroup; }
-               }
-
-               public bool Equals (CngAlgorithmGroup other)
-               {
-                       if (other == null)
-                               return false;
-                       return m_algorithmGroup == other.m_algorithmGroup;
-               }
-
-               public override bool Equals (object obj)
-               {
-                       return Equals (obj as CngAlgorithmGroup);
-               }
-
-               public override int GetHashCode ()
-               {
-                       return m_algorithmGroup.GetHashCode ();
-               }
-
-               public override string ToString ()
-               {
-                       return m_algorithmGroup;
-               }
-
-               // static
-
-               private static CngAlgorithmGroup dh;
-               private static CngAlgorithmGroup dsa;
-               private static CngAlgorithmGroup ecdh;
-               private static CngAlgorithmGroup ecdsa;
-               private static CngAlgorithmGroup rsa;
-
-               public static CngAlgorithmGroup DiffieHellman {
-                       get {
-                               if (dh == null)
-                                       dh = new CngAlgorithmGroup ("DH");
-                               return dh;
-                       }
-               }
-
-               public static CngAlgorithmGroup Dsa {
-                       get {
-                               if (dsa == null)
-                                       dsa = new CngAlgorithmGroup ("DSA");
-                               return dsa;
-                       }
-               }
-
-               public static CngAlgorithmGroup ECDiffieHellman {
-                       get {
-                               if (ecdh == null)
-                                       ecdh = new CngAlgorithmGroup ("ECDH");
-                               return ecdh;
-                       }
-               }
-
-               public static CngAlgorithmGroup ECDsa {
-                       get {
-                               if (ecdsa == null)
-                                       ecdsa = new CngAlgorithmGroup ("ECDSA");
-                               return ecdsa;
-                       }
-               }
-
-               public static CngAlgorithmGroup Rsa {
-                       get {
-                               if (rsa == null)
-                                       rsa = new CngAlgorithmGroup ("RSA");
-                               return rsa;
-                       }
-               }
-
-               public static bool operator == (CngAlgorithmGroup left, CngAlgorithmGroup right)
-               {
-                       if ((object)left == null)
-                               return ((object)right == null);
-                       return left.Equals (right);
-               }
-
-               public static bool operator != (CngAlgorithmGroup left, CngAlgorithmGroup right)
-               {
-                       if ((object)left == null)
-                               return ((object)right != null);
-                       return !left.Equals (right);
-               }
-       }
-}
diff --git a/mcs/class/System.Core/System.Security.Cryptography/CngExportPolicies.cs b/mcs/class/System.Core/System.Security.Cryptography/CngExportPolicies.cs
deleted file mode 100644 (file)
index 90a1aa5..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-//
-// System.Security.Cryptography.CngExportPolicies
-//
-// Copyright (C) 2011 Juho Vähä-Herttua
-//
-// 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;
-
-namespace System.Security.Cryptography {
-
-       // note: CNG stands for "Cryptography API: Next Generation"
-
-       [Flags]
-       public enum CngExportPolicies {
-               None,
-               AllowExport,
-               AllowPlaintextExport,
-               AllowArchiving,
-               AllowPlaintextArchiving
-       }
-}
diff --git a/mcs/class/System.Core/System.Security.Cryptography/CngKeyCreationOptions.cs b/mcs/class/System.Core/System.Security.Cryptography/CngKeyCreationOptions.cs
deleted file mode 100644 (file)
index da28e7b..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-//
-// System.Security.Cryptography.CngKeyCreationOptions
-//
-// Copyright (C) 2011 Juho Vähä-Herttua
-//
-// 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;
-
-namespace System.Security.Cryptography {
-
-       // note: CNG stands for "Cryptography API: Next Generation"
-
-       [Flags]
-       public enum CngKeyCreationOptions {
-               None                 = 0x00,
-               MachineKey           = 0x20,
-               OverwriteExistingKey = 0x80
-       }
-}
diff --git a/mcs/class/System.Core/System.Security.Cryptography/CngKeyCreationParameters.cs b/mcs/class/System.Core/System.Security.Cryptography/CngKeyCreationParameters.cs
deleted file mode 100644 (file)
index 8963324..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-//
-// System.Security.Cryptography.CngKeyCreationParameters
-//
-// Copyright (C) 2011 Juho Vähä-Herttua
-//
-// 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;
-
-namespace System.Security.Cryptography {
-
-       // note: CNG stands for "Cryptography API: Next Generation"
-
-       public class CngKeyCreationParameters {
-               private Nullable<CngExportPolicies> exportPolicy;
-               private CngKeyCreationOptions keyCreationOptions;
-               private Nullable<CngKeyUsages> keyUsage;
-               private CngPropertyCollection parameters;
-               private IntPtr parentWindowHandle;
-               private CngProvider provider;
-               private CngUIPolicy uiPolicy;
-
-               public CngKeyCreationParameters ()
-               {
-                       parameters = new CngPropertyCollection ();
-                       provider = CngProvider.MicrosoftSoftwareKeyStorageProvider;
-               }
-
-               public Nullable<CngExportPolicies> ExportPolicy
-               {
-                       get { return exportPolicy; }
-                       set { exportPolicy = value; }
-               }
-
-               public CngKeyCreationOptions KeyCreationOptions
-               {
-                       get { return keyCreationOptions; }
-                       set { keyCreationOptions = value; }
-               }
-
-               public Nullable<CngKeyUsages> KeyUsage
-               {
-                       get { return keyUsage; }
-                       set { keyUsage = value; }
-               }
-
-               public CngPropertyCollection Parameters
-               {
-                       get { return parameters; }
-               }
-
-               public IntPtr ParentWindowHandle
-               {
-                       get { return parentWindowHandle; }
-                       set { parentWindowHandle = value; }
-               }
-
-               public CngProvider Provider
-               {
-                       get { return provider; }
-                       set {
-                               if (value == null)
-                                       throw new ArgumentNullException ("value");
-                               provider = value;
-                       }
-               }
-
-               public CngUIPolicy UIPolicy
-               {
-                       get { return uiPolicy; }
-                       set { uiPolicy = value; }
-               }
-       }
-}
diff --git a/mcs/class/System.Core/System.Security.Cryptography/CngKeyOpenOptions.cs b/mcs/class/System.Core/System.Security.Cryptography/CngKeyOpenOptions.cs
deleted file mode 100644 (file)
index dcc3289..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-//
-// System.Security.Cryptography.CngKeyOpenOptions
-//
-// Copyright (C) 2011 Juho Vähä-Herttua
-//
-// 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;
-
-namespace System.Security.Cryptography {
-
-       // note: CNG stands for "Cryptography API: Next Generation"
-
-       [Flags]
-       public enum CngKeyOpenOptions {
-               None       = 0x00,
-               UserKey    = 0x00,
-               MachineKey = 0x20,
-               Silent     = 0x40
-       }
-}
diff --git a/mcs/class/System.Core/System.Security.Cryptography/CngKeyUsages.cs b/mcs/class/System.Core/System.Security.Cryptography/CngKeyUsages.cs
deleted file mode 100644 (file)
index 35f1d43..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-//
-// System.Security.Cryptography.CngKeyUsages
-//
-// Copyright (C) 2011 Juho Vähä-Herttua
-//
-// 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;
-
-namespace System.Security.Cryptography {
-
-       // note: CNG stands for "Cryptography API: Next Generation"
-
-       [Flags]
-       public enum CngKeyUsages {
-               None,
-               Decryption,
-               Signing,
-               KeyAgreement,
-               AllUsages = 0xffffff
-       }
-}
diff --git a/mcs/class/System.Core/System.Security.Cryptography/CngProperty.cs b/mcs/class/System.Core/System.Security.Cryptography/CngProperty.cs
deleted file mode 100644 (file)
index f0948bb..0000000
+++ /dev/null
@@ -1,115 +0,0 @@
-//
-// System.Security.Cryptography.CngProperty
-//
-// Copyright (C) 2011 Juho Vähä-Herttua
-//
-// 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;
-
-namespace System.Security.Cryptography {
-
-       // note: CNG stands for "Cryptography API: Next Generation"
-
-       public struct CngProperty : IEquatable<CngProperty> {
-               private string name;
-               private byte[] val;
-               private CngPropertyOptions opts;
-
-               public CngProperty(string name, byte[] value, CngPropertyOptions options)
-               {
-                       if (name == null)
-                               throw new ArgumentNullException("name");
-
-                       this.name = name;
-                       this.val = (value != null) ? (byte[]) value.Clone () : null;
-                       this.opts = options;
-               }
-
-               public string Name {
-                       get { return name; }
-               }
-
-               public CngPropertyOptions Options {
-                       get { return opts; }
-               }
-
-               public byte[] GetValue ()
-               {
-                       if (val == null)
-                               return null;
-                       return (byte[]) val.Clone ();
-               }
-
-               public bool Equals (CngProperty other)
-               {
-                       if (this.name != other.name || this.opts != other.opts)
-                               return false;
-                       if (this.val == null && other.val == null)
-                               return true;
-                       if (this.val == null || other.val == null)
-                               return false;
-                       if (this.val.Length != other.val.Length)
-                               return false;
-
-                       for (int i=0; i<val.Length; i++) {
-                               if (this.val[i] != other.val[i])
-                                       return false;
-                       }
-                       return true;
-               }
-
-               public override bool Equals (object obj)
-               {
-                       if (obj == null)
-                               return false;
-                       if (!(obj is CngProperty))
-                               return false;
-                       return Equals ((CngProperty) obj);
-               }
-
-               public override int GetHashCode ()
-               {
-                       int ret = name.GetHashCode () ^ opts.GetHashCode ();
-                       if (val == null)
-                               return ret;
-
-                       for (int i=0; i<val.Length; i++) {
-                               // Handle each 4 bytes of byte array as a little-endian
-                               // integer and XOR it with the resulting hash code value
-                               ret ^= val[i] << 8*(i % 4);
-                       }
-                       return ret;
-               }
-
-               // static
-
-               public static bool operator == (CngProperty left, CngProperty right)
-               {
-                       return left.Equals (right);
-               }
-
-               public static bool operator != (CngProperty left, CngProperty right)
-               {
-                       return !left.Equals (right);
-               }
-       }
-}
diff --git a/mcs/class/System.Core/System.Security.Cryptography/CngPropertyCollection.cs b/mcs/class/System.Core/System.Security.Cryptography/CngPropertyCollection.cs
deleted file mode 100644 (file)
index afc5269..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-//
-// System.Security.Cryptography.CngPropertyCollection
-//
-// Copyright (C) 2011 Juho Vähä-Herttua
-//
-// 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.ObjectModel;
-
-namespace System.Security.Cryptography {
-
-       // note: CNG stands for "Cryptography API: Next Generation"
-
-       public sealed class CngPropertyCollection : Collection<CngProperty> {
-               public CngPropertyCollection ()
-               {
-               }
-       }
-}
diff --git a/mcs/class/System.Core/System.Security.Cryptography/CngPropertyOptions.cs b/mcs/class/System.Core/System.Security.Cryptography/CngPropertyOptions.cs
deleted file mode 100644 (file)
index 336d26a..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-//
-// System.Security.Cryptography.CngPropertyOptions
-//
-// Copyright (C) 2011 Juho Vähä-Herttua
-//
-// 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;
-
-namespace System.Security.Cryptography {
-
-       // note: CNG stands for "Cryptography API: Next Generation"
-
-       [Flags]
-       public enum CngPropertyOptions {
-               None           = 0x00 << 24,
-               CustomProperty = 0x40 << 24,
-               Persist        = 0x80 << 24
-       }
-}
diff --git a/mcs/class/System.Core/System.Security.Cryptography/CngProvider.cs b/mcs/class/System.Core/System.Security.Cryptography/CngProvider.cs
deleted file mode 100644 (file)
index 8c868a7..0000000
+++ /dev/null
@@ -1,112 +0,0 @@
-//
-// System.Security.Cryptography.CngProvider
-//
-// Authors:
-//      Sebastien Pouliot  <sebastien@ximian.com>
-//
-// Copyright (C) 2008 Novell, Inc (http://www.novell.com)
-// Copyright (C) 2011 Juho Vähä-Herttua
-//
-// 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;
-
-namespace System.Security.Cryptography {
-
-       // note: CNG stands for "Cryptography API: Next Generation"
-
-       [Serializable]
-       public sealed class CngProvider : IEquatable<CngProvider> {
-
-               private string m_Provider;
-
-               public CngProvider (string provider)
-               {
-                       if (provider == null)
-                               throw new ArgumentNullException ("provider");
-                       if (provider.Length == 0)
-                               throw new ArgumentException ("provider");
-
-                       m_Provider = provider;
-               }
-
-               public string Provider {
-                       get { return m_Provider; }
-               }
-
-               public bool Equals (CngProvider other)
-               {
-                       if (other == null)
-                               return false;
-                       return m_Provider == other.m_Provider;
-               }
-
-               public override bool Equals (object obj)
-               {
-                       return Equals (obj as CngProvider);
-               }
-
-               public override int GetHashCode ()
-               {
-                       return m_Provider.GetHashCode ();
-               }
-
-               public override string ToString ()
-               {
-                       return m_Provider;
-               }
-
-               // static
-
-               private static CngProvider microsoftSmartCardKeyStorageProvider;
-               private static CngProvider microsoftSoftwareKeyStorageProvider;
-
-               public static CngProvider MicrosoftSmartCardKeyStorageProvider {
-                       get {
-                               if (microsoftSmartCardKeyStorageProvider == null)
-                                       microsoftSmartCardKeyStorageProvider = new CngProvider ("Microsoft Smart Card Key Storage Provider");
-                               return microsoftSmartCardKeyStorageProvider;
-                       }
-               }
-
-               public static CngProvider MicrosoftSoftwareKeyStorageProvider {
-                       get {
-                               if (microsoftSoftwareKeyStorageProvider == null)
-                                       microsoftSoftwareKeyStorageProvider = new CngProvider ("Microsoft Software Key Storage Provider");
-                               return microsoftSoftwareKeyStorageProvider;
-                       }
-               }
-
-               public static bool operator == (CngProvider left, CngProvider right)
-               {
-                       if ((object)left == null)
-                               return ((object)right == null);
-                       return left.Equals (right);
-               }
-
-               public static bool operator != (CngProvider left, CngProvider right)
-               {
-                       if ((object)left == null)
-                               return ((object)right != null);
-                       return !left.Equals (right);
-               }
-       }
-}
diff --git a/mcs/class/System.Core/System.Security.Cryptography/CngUIPolicy.cs b/mcs/class/System.Core/System.Security.Cryptography/CngUIPolicy.cs
deleted file mode 100644 (file)
index 4e0c36c..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-//
-// System.Security.Cryptography.CngUIPolicy
-//
-// Copyright (C) 2011 Juho Vähä-Herttua
-//
-// 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;
-
-namespace System.Security.Cryptography {
-
-       // note: CNG stands for "Cryptography API: Next Generation"
-
-       public sealed class CngUIPolicy {
-               private CngUIProtectionLevels level;
-               private string name;
-               private string desc;
-               private string context;
-               private string title;
-
-               public CngUIPolicy (CngUIProtectionLevels protectionLevel)
-                       : this (protectionLevel, null)
-               {
-               }
-
-               public CngUIPolicy (CngUIProtectionLevels protectionLevel,
-                                   string friendlyName)
-                       : this (protectionLevel, friendlyName, null)
-               {
-               }
-
-               public CngUIPolicy (CngUIProtectionLevels protectionLevel,
-                                   string friendlyName,
-                                   string description)
-                       : this (protectionLevel, friendlyName, description, null)
-               {
-               }
-
-               public CngUIPolicy (CngUIProtectionLevels protectionLevel,
-                                   string friendlyName,
-                                   string description,
-                                   string useContext)
-                       : this (protectionLevel, friendlyName, description, useContext, null)
-               {
-               }
-
-               public CngUIPolicy (CngUIProtectionLevels protectionLevel,
-                                   string friendlyName,
-                                   string description,
-                                   string useContext,
-                                   string creationTitle)
-               {
-                       level = protectionLevel;
-                       name = friendlyName;
-                       desc = description;
-                       context = useContext;
-                       title = creationTitle;
-               }
-
-               public CngUIProtectionLevels ProtectionLevel {
-                       get { return level; }
-               }
-
-               public string FriendlyName {
-                       get { return name; }
-               }
-
-               public string Description {
-                       get { return desc; }
-               }
-
-               public string UseContext {
-                       get { return context; }
-               }
-
-               public string CreationTitle {
-                       get { return title; }
-               }
-       }
-}
diff --git a/mcs/class/System.Core/System.Security.Cryptography/CngUIProtectionLevels.cs b/mcs/class/System.Core/System.Security.Cryptography/CngUIProtectionLevels.cs
deleted file mode 100644 (file)
index 22f4178..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-//
-// System.Security.Cryptography.CngUIProtectionLevels
-//
-// Copyright (C) 2011 Juho Vähä-Herttua
-//
-// 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;
-
-namespace System.Security.Cryptography {
-
-       // note: CNG stands for "Cryptography API: Next Generation"
-
-       [Flags]
-       public enum CngUIProtectionLevels {
-               None,
-               ProtectKey,
-               ForceHighProtection
-       }
-}
diff --git a/mcs/class/System.Core/System.Security.Cryptography/ECDiffieHellmanKeyDerivationFunction.cs b/mcs/class/System.Core/System.Security.Cryptography/ECDiffieHellmanKeyDerivationFunction.cs
deleted file mode 100644 (file)
index a2a9880..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-//
-// System.Security.Cryptography.ECDiffieHellmanKeyDerivationFunction
-//
-// Copyright (C) 2011 Juho Vähä-Herttua
-//
-// 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;
-
-namespace System.Security.Cryptography {
-
-       public enum ECDiffieHellmanKeyDerivationFunction {
-               Hash,
-               Hmac,
-               Tls
-       }
-}
diff --git a/mcs/class/System.Core/System.Security.Cryptography/ECKeyXmlFormat.cs b/mcs/class/System.Core/System.Security.Cryptography/ECKeyXmlFormat.cs
deleted file mode 100644 (file)
index 3ed2910..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-//
-// System.Security.Cryptography.ECKeyXmlFormat
-//
-// Copyright (C) 2011 Juho Vähä-Herttua
-//
-// 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;
-
-namespace System.Security.Cryptography {
-
-       public enum ECKeyXmlFormat {
-               Rfc4050
-       }
-}
diff --git a/mcs/class/System.Core/System.Security.Cryptography/IncrementalHash.cs b/mcs/class/System.Core/System.Security.Cryptography/IncrementalHash.cs
deleted file mode 100644 (file)
index 14c895e..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-//
-// IncrementalHash.cs
-//
-// Authors:
-//     Marek Safar  <marek.safar@gmail.com>
-//
-// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com)
-//
-// 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.
-//
-
-#if NETSTANDARD
-
-namespace System.Security.Cryptography
-{
-    public sealed class IncrementalHash : IDisposable
-    {
-        private IncrementalHash () { }
-        public HashAlgorithmName AlgorithmName { get { throw new NotImplementedException (); } }
-        public void AppendData (byte[] data) { }
-        public void AppendData (byte[] data, int offset, int count) { }
-        public static IncrementalHash CreateHash (HashAlgorithmName hashAlgorithm) { throw new NotImplementedException (); }
-        public static IncrementalHash CreateHMAC (HashAlgorithmName hashAlgorithm, byte[] key) { throw new NotImplementedException (); }
-        public void Dispose () { }
-        public byte[] GetHashAndReset () { throw new NotImplementedException (); }
-    }
-}
-
-#endif
\ No newline at end of file
index 9a6920efe174229b019e79590659daa2b158ebd5..0e3658c5c12486ed181c527de817734742aae1a1 100644 (file)
@@ -29,7 +29,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if !NET_2_1
+#if !MOBILE
 
 namespace System.Security.Cryptography {
 
index 45d4ab55ea39f86d412d9e8574ded1ab5a154275..95d1034aa31586ee64aaaadf34be43b8dbc3a01f 100644 (file)
@@ -29,7 +29,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if !NET_2_1
+#if !MOBILE
 
 namespace System.Security.Cryptography {
 
index 347683170e0fe5ef7eaba8bad27a9b8b01077617..772b81faabf772b16bc70e14dd62d1cd45250f66 100644 (file)
@@ -29,7 +29,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if !NET_2_1
+#if !MOBILE
 
 namespace System.Security.Cryptography {
 
index ac1016d726572f65037145c343a64bd39016ea22..9012c58b2167cd1607cbf267db3783e60fa53b89 100644 (file)
@@ -29,7 +29,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if !NET_2_1
+#if !MOBILE
 
 namespace System.Security.Cryptography {
 
index bbcdde1ffa737fc9abfbf30217a35bdbdde853d1..b573aad961e66e3f8e77a50ffd19ba6a45e5da82 100644 (file)
@@ -29,7 +29,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if !NET_2_1
+#if !MOBILE
 
 namespace System.Security.Cryptography {
 
index 43d8e0921afcee31901a4122ade038078ec2e074..af0abc744bf3592cdb588aa88a027486cfdb897f 100644 (file)
@@ -29,7 +29,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if !NET_2_1
+#if !MOBILE
 
 namespace System.Security.Cryptography {
 
index 5bcdcc29982204f552ad2d8da2cc6474e53f1dbe..bf5689ecb392c5352a5c42c586f8ed88abe4e7ed 100644 (file)
@@ -29,7 +29,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if !NET_2_1
+#if !MOBILE
 
 namespace System.Security.Cryptography {
 
index ed8dabec1750554e723dd42c6d70996366a66e1d..9425a94e0c0361a6a85506891b4abd1ab39002d7 100644 (file)
@@ -29,7 +29,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if !NET_2_1
+#if !MOBILE
 
 namespace System.Security.Cryptography {
 
index 27191c37ed2b7b121d2f1926471d459add1d013f..9c273b84a596e848680054d9889147050a6b2530 100644 (file)
@@ -56,16 +56,28 @@ namespace MonoTests.System.IO.MemoryMappedFiles {
                        return "test-" + named_index++;
                }
 
-
+               static string baseTempDir = Path.Combine (Path.GetTempPath (), typeof (MemoryMappedFileTest).FullName);
                static string tempDir = Path.Combine (Path.GetTempPath (), typeof (MemoryMappedFileTest).FullName);
 
                string fname;
 
-               [SetUp]
-               protected void SetUp () {
-                       if (Directory.Exists (tempDir))
-                               Directory.Delete (tempDir, true);
+               [TestFixtureSetUp]
+               public void FixtureSetUp ()
+               {
+                       try {
+                               // Try to cleanup from any previous NUnit run.
+                               Directory.Delete (baseTempDir, true);
+                       } catch (Exception) {
+                       }
+               }
 
+               [SetUp]
+               public void SetUp ()
+               {
+                       int i = 0;
+                       do {
+                               tempDir = Path.Combine (baseTempDir, (++i).ToString());
+                       } while (Directory.Exists (tempDir));
                        Directory.CreateDirectory (tempDir);
 
                        fname = Path.Combine (tempDir, "basic.txt");
@@ -77,9 +89,14 @@ namespace MonoTests.System.IO.MemoryMappedFiles {
                }
 
                [TearDown]
-               protected void TearDown () {
-                       if (Directory.Exists (tempDir))
+               public void TearDown ()
+               {
+                       try {
+                               // This throws an exception under MS.NET and Mono on Windows,
+                               // since the directory contains open files.
                                Directory.Delete (tempDir, true);
+                       } catch (Exception) {
+                       }
                }
 
                [Test]
@@ -102,26 +119,16 @@ namespace MonoTests.System.IO.MemoryMappedFiles {
                public void CreateNew ()
                {
                        // This must succeed
-                       MemoryMappedFile.CreateNew (Path.Combine (tempDir, "createNew.test"), 8192);
-               }
-
-               [Test]
-               [ExpectedException (typeof (IOException))]
-               public void CreateNew_OnExistingFile ()
-               {
-                       // This must succeed
-                       MemoryMappedFile.CreateNew (Path.Combine (tempDir, "createNew.test"), 8192);
-                       
-                       // This should fail, the file exists
-                       MemoryMappedFile.CreateNew (Path.Combine (tempDir, "createNew.test"), 8192);
+                       MemoryMappedFile.CreateNew (MkNamedMapping (), 8192);
                }
 
                // Call this twice, it should always work
                [Test]
                public void CreateOrOpen_Multiple ()
                {
-                       MemoryMappedFile.CreateOrOpen (Path.Combine (tempDir, "createOrOpen.test"), 8192);
-                       MemoryMappedFile.CreateOrOpen (Path.Combine (tempDir, "createOrOpen.test"), 8192);
+                       var name = MkNamedMapping ();
+                       MemoryMappedFile.CreateOrOpen (name, 8192);
+                       MemoryMappedFile.CreateOrOpen (name, 8192);
                }
 
                [Test]
@@ -134,7 +141,7 @@ namespace MonoTests.System.IO.MemoryMappedFiles {
                        // We are requesting fewer bytes to map.
                        MemoryMappedFile.CreateFromFile (f, FileMode.Open, "myMap", 4192);
                }
-       
+
                [Test]
                public void CreateFromFile_Null () {
                        AssertThrows<ArgumentNullException> (delegate () {
@@ -252,6 +259,9 @@ namespace MonoTests.System.IO.MemoryMappedFiles {
                [Test]
                public void NamedMappingToInvalidFile ()
                {
+                       if (Environment.OSVersion.Platform != PlatformID.Unix) {
+                               Assert.Ignore ("Backslashes in mapping names are disallowed on .NET and Mono on Windows");
+                       }
                        var fileName = Path.Combine (tempDir, "temp_file_123");
                if (File.Exists (fileName))
                    File.Delete (fileName);
@@ -352,7 +362,7 @@ namespace MonoTests.System.IO.MemoryMappedFiles {
                }
 
                [Test]
-               [ExpectedException(typeof(IOException))]
+               [ExpectedException(typeof(UnauthorizedAccessException))]
                public void CreateViewStreamWithOffsetPastFileEnd ()
                {
                        string f = Path.Combine (tempDir, "8192-file");
@@ -365,7 +375,7 @@ namespace MonoTests.System.IO.MemoryMappedFiles {
                }
 
                [Test]
-               [ExpectedException(typeof(IOException))]
+               [ExpectedException(typeof(UnauthorizedAccessException))]
                public void CreateViewStreamWithOffsetPastFileEnd2 ()
                {
                        string f = Path.Combine (tempDir, "8192-file");
@@ -394,7 +404,7 @@ namespace MonoTests.System.IO.MemoryMappedFiles {
 
                        MemoryMappedViewStream stream = mappedFile.CreateViewStream (pageSize * 2, 0, MemoryMappedFileAccess.ReadWrite);
 #if !MONOTOUCH
-                       Assert.AreEqual (stream.Capacity, Environment.SystemPageSize);
+                       Assert.AreEqual (Environment.SystemPageSize, stream.Capacity);
 #endif
                        stream.Write (new byte [pageSize], 0, pageSize);
                }
@@ -407,9 +417,39 @@ namespace MonoTests.System.IO.MemoryMappedFiles {
                        File.WriteAllBytes (f, new byte [size]);
 
                        FileStream file = File.OpenRead (f);
-                       MemoryMappedFile.CreateFromFile (file, null, size, MemoryMappedFileAccess.ReadExecute, null, 0, false);
+                       MemoryMappedFile.CreateFromFile (file, null, size, MemoryMappedFileAccess.Read, null, 0, false);
                }
-       }
-}
 
+               [Test]
+               [ExpectedException(typeof(ArgumentOutOfRangeException))]
+               public void CreateNewLargerThanLogicalAddressSpace ()
+               {
+                       if (IntPtr.Size != 4) {
+                               Assert.Ignore ("Only applies to 32-bit systems");
+                       }
+                       MemoryMappedFile.CreateNew (MkNamedMapping (), (long) uint.MaxValue + 1);
+               }
 
+               [Test]
+               [ExpectedException(typeof(ArgumentOutOfRangeException))]
+               public void CreateOrOpenLargerThanLogicalAddressSpace ()
+               {
+                       if (IntPtr.Size != 4) {
+                               Assert.Ignore ("Only applies to 32-bit systems");
+                       }
+                       MemoryMappedFile.CreateOrOpen (MkNamedMapping (), (long) uint.MaxValue + 1);
+               }
+
+               [Test]
+               public void NamedMappingWithDelayAllocatePages ()
+               {
+                       var name = MkNamedMapping ();
+                       using (var m0 = MemoryMappedFile.CreateNew(name, 4096, MemoryMappedFileAccess.ReadWrite, MemoryMappedFileOptions.DelayAllocatePages, HandleInheritability.None)) {
+                               using (MemoryMappedViewAccessor v0 = m0.CreateViewAccessor ()) {
+                                       Assert.AreEqual (0, v0.ReadInt32 (0));
+                               }
+                       }
+               }
+
+       }
+}
index a9389f9b49710d088c2f7baf64b566d424566a2c..ceef4c02157565a3e3ce4f4f0e0ef046e8ffd06f 100644 (file)
@@ -34,12 +34,9 @@ using System.Text;
 using System.Threading;
 using NUnit.Framework;
 using System.Linq;
-using NUnit.Framework.SyntaxHelpers;
 using NUnit.Framework.Constraints;
 using System.Diagnostics;
 
-namespace NUnit.Framework.SyntaxHelpers { class Dummy {} }
-
 namespace MonoTests.System.Linq
 {
        [TestFixture]
index f6a3f9b546078bc94ddbe43598ca8cdb33f58b3e..52dad5c3c18ca9ddbcb78697c3f48b87e206a1be 100644 (file)
@@ -21,10 +21,15 @@ System.IO.Pipes/AnonymousPipeClientStream.cs
 System.IO.Pipes/AnonymousPipeServerStream.cs
 System.IO.Pipes/NamedPipeClientStream.cs
 System.IO.Pipes/NamedPipeServerStream.cs
+System.IO.Pipes/PipeAccessRights.cs
+System.IO.Pipes/PipeAccessRule.cs
+System.IO.Pipes/PipeAuditRule.cs
 System.IO.Pipes/PipeDirection.cs
 System.IO.Pipes/PipeInterfaces.cs
 System.IO.Pipes/PipeOptions.cs
+System.IO.Pipes/PipeSecurity.cs
 System.IO.Pipes/PipeStream.cs
+System.IO.Pipes/PipeStreamImpersonationWorker.cs
 System.IO.Pipes/PipeTransmissionMode.cs
 
 ReferenceSources/SR.cs
@@ -227,4 +232,3 @@ ReferenceSources/Strings.cs
 System.Security.Cryptography/ECCurve.cs
 System.Security.Cryptography/ECPoint.cs
 System.Security.Cryptography/ECParameters.cs
-System.Security.Cryptography/IncrementalHash.cs
index f367efd60c7562e4d1253707eed5828ace4a90e5..72d78659215f4a1661166b8791c9a345beb43182 100644 (file)
@@ -1,11 +1,6 @@
 #include common_System.Core.dll.sources
 #include dynamic_System.Core.dll.sources
 
-System.IO.Pipes/PipeAccessRights.cs
-System.IO.Pipes/PipeAccessRule.cs
-System.IO.Pipes/PipeAuditRule.cs
-System.IO.Pipes/PipeSecurity.cs
-System.IO.Pipes/PipeStreamImpersonationWorker.cs
 System.IO.Pipes/PipeUnix.cs
 System.IO.Pipes/PipeWin32.cs
 
index cc22c959c4e55300d9ec3a7be30b42c424b30947..e80e209fe74e67d3b058e13e2ed833d3b4474113 100644 (file)
@@ -62,7 +62,7 @@ class Program {
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if !NET_2_1
+#if !MOBILE
 
 namespace System.Security.Cryptography {
 
index 8d845d576bfdb841b95a8725dad1639f3457a468..e47575986e7e9f076c13226d6cb355c71402a0ab 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 25275651f16facb771430c017c4c282435c06060..cc05f509439d1aafb03e8e11a557530ce857ab08 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 02e0b4aba48b76bfea5950cb7ce2047824976016..1a9d4ea388bea975c998dbc941705964b4de32b6 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;MONO_STRICT;MONO_DEPLOY</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;MONO_STRICT;MONO_DEPLOY</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;MONO_STRICT;MONO_DEPLOY</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;MONO_STRICT;MONO_DEPLOY</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
diff --git a/mcs/class/System.Data.Linq/build/.gitignore b/mcs/class/System.Data.Linq/build/.gitignore
new file mode 100644 (file)
index 0000000..f2cf7dc
--- /dev/null
@@ -0,0 +1,2 @@
+Northwind.db3
+
index 1079699a00fdf4e7c0e9fc00b93647933827697f..22f797c60f45de74c02e24453283aa7be8030900 100644 (file)
@@ -1,3 +1,4 @@
+../../test-helpers/NunitHelpers.cs
 ../examples/DbLinq.SQLite.Example/nwind/Northwind.cs
 ../src/DbLinq.Sqlite/Test/DirectDataContext.cs
 ../src/DbLinq.Sqlite/Test/TestBase_mono.cs
index bf28637588ce4107b9df01ff7077386fc17122d2..71e2154664a5940fe59b458727be871ecb24e5ab 100644 (file)
@@ -25,15 +25,14 @@ sqlite_tests_dep = \
 
 $(sqlite_tests): $(sqlite_tests_dep)
        $(TEST_COMPILE) -target:library -out:$@ \
-               -r:System.Data.dll -r:$(the_assembly) -r:Mono.Data.Sqlite $(test_nunit_ref) \
+               -r:$(topdir)/class/lib/$(PROFILE)/System.Data.dll -r:$(the_assembly) -r:$(topdir)/class/lib/$(PROFILE)/Mono.Data.Sqlite.dll -r:$(topdir)/class/lib/$(PROFILE)/System.Core.dll -r:$(topdir)/class/lib/$(PROFILE)/System.dll -r:$(topdir)/class/lib/$(PROFILE)/System.Xml.dll $(test_nunit_ref) \
                $(TEST_MCS_FLAGS) -d:MONO_STRICT -d:SQLITE \
                @$< $(TEST_SOURCES_WITH_SPACES)
 
 test-sqlite: $(sqlite_tests)
 
 RUN_TEST_COMMAND = \
-       MONO_REGISTRY_PATH="$(HOME)/.mono/registry" $(TEST_RUNTIME) $(RUNTIME_FLAGS) $(TEST_HARNESS) $(1) -noshadow $(TEST_HARNESS_FLAGS) $(LOCAL_TEST_HARNESS_FLAGS) $(TEST_HARNESS_EXCLUDES) $(TEST_HARNESS_OUTPUT) -xml=TestResult-$(1:.dll=)-$(PROFILE).xml -out:TestResult-$(1:.dll=)-$(PROFILE).out $(FIXTURE_ARG) $(TESTNAME_ARG) ; \
-       xsltproc $(topdir)/build/nunit-summary.xsl TestResult-$(1)-$(PROFILE).xml > TestResult-$(1:.dll=)-$(PROFILE).log
+       MONO_REGISTRY_PATH="$(HOME)/.mono/registry" $(TEST_RUNTIME) $(RUNTIME_FLAGS) $(TEST_HARNESS) $(1) $(TEST_HARNESS_FLAGS) $(LOCAL_TEST_HARNESS_FLAGS) $(TEST_HARNESS_EXCLUDES) $(TEST_HARNESS_OUTPUT) -labels -format:nunit2 -result=TestResult-$(1:.dll=)-$(PROFILE).xml $(FIXTURE_ARG) $(TESTNAME_ARG) ;
 
 run-test-sqlite:
        $(call RUN_TEST_COMMAND,$(sqlite_tests))
index c9bea8ea40c594e715c35af32ad3789c10603f76..f2b6d3ede66e1a19fd2a1812c53784df489fce70 100644 (file)
@@ -71,7 +71,7 @@ using MsNorthwind;
             \r
 \r
             Assert.IsNotNull(dbCommand.CommandText);\r
-            Assert.Greater(dbCommand.Parameters.Count, 0);\r
+            AssertHelper.Greater(dbCommand.Parameters.Count, 0);\r
         }\r
     }\r
 }\r
index 5ea0dbc7d761f83e6eac880c174482a1c55ce012..9bd6aac50f90e6faa0e01157d6969f38d354f2a9 100644 (file)
@@ -186,7 +186,7 @@ using nwind;
             Northwind db = CreateDB();\r
             Expression<Func<Customer, bool>> predicate = c => c.City == "Paris";\r
             int count = db.Customers.Count(predicate);\r
-            Assert.Greater(count, 0); // Some databases have more than 1 customer in Paris\r
+            AssertHelper.Greater(count, 0); // Some databases have more than 1 customer in Paris\r
         }\r
 \r
         /// <summary>\r
index 87bf3d8cdeee9b5e7347f7df43ca47a0d2ec07cc..b8a1c728d8eea9ff9dcbaf6a9787ab24d910c074 100644 (file)
@@ -68,7 +68,7 @@ using nwind;
         {\r
             Northwind db = CreateDB();\r
             int result = db.ExecuteCommand("SELECT count(*) FROM \"Products\"");\r
-            Assert.Greater(result, 0, "Expecting some rows in Products table, got:" + result);\r
+            AssertHelper.Greater(result, 0, "Expecting some rows in Products table, got:" + result);\r
         }\r
 \r
         /// <summary>\r
@@ -85,7 +85,7 @@ using nwind;
             Northwind db = CreateDB();\r
             int result = db.ExecuteCommand("SELECT count(*) FROM [Products] WHERE [ProductID]>{0}", 3);\r
             //long iResult = base.ExecuteScalar(sql);\r
-            Assert.Greater(result, 0, "Expecting some rows in Products table, got:" + result);\r
+            AssertHelper.Greater(result, 0, "Expecting some rows in Products table, got:" + result);\r
         }\r
 \r
     }\r
index ea375055d7eff42f3f25fbcd002a30e9d7d6f16d..fac3d615da592c19bc60a65c3790046525a07c6a 100644 (file)
@@ -67,7 +67,7 @@ using nwind;
             string beforecountry = character.Country;\r
             character.Country = "Burmuda";\r
 \r
-            Assert.Greater(db.GetChangeSet().Updates.Count, 0);\r
+            AssertHelper.Greater(db.GetChangeSet().Updates.Count, 0);\r
             db.SubmitChanges();\r
 \r
             var character2 = db.Customers.First(c=>c.CustomerID==character.CustomerID);\r
index e420e84f6bbbf621550f8192920040ce02954382..dd976666e05742c322045241a451dc14c98f2613 100644 (file)
@@ -159,7 +159,7 @@ using nwind;
 \r
             var q3 = q1.Union(q2);\r
 \r
-            Assert.Greater(q1.Count(), 0);\r
+            AssertHelper.Greater(q1.Count(), 0);\r
             Assert.IsTrue(q1.Count() + q2.Count() >= q3.Count());\r
 \r
         }\r
index 1f443c32ac66030d295c8a83b74bbbef11f0b92b..efde50c3dcce75b227dda8bd8c37988e1da97f34 100644 (file)
@@ -234,7 +234,7 @@ namespace nwind
             var q = from p in db.Products select p;\r
             List<Product> products = q.ToList();\r
             int productCount = products.Count;\r
-            Assert.Greater(productCount, 0, "Expected some products, got none");\r
+            AssertHelper.Greater(productCount, 0, "Expected some products, got none");\r
         }\r
 \r
 #if !DEBUG && SQLITE\r
@@ -443,7 +443,7 @@ namespace nwind
                     select p;\r
 \r
             int count = q.Count();\r
-            Assert.Less(count, db.Customers.Count());\r
+            AssertHelper.Less(count, db.Customers.Count());\r
         }\r
 \r
         [Test]\r
@@ -455,7 +455,7 @@ namespace nwind
                     select p;\r
 \r
             int count = q.Count();\r
-            Assert.Less(count, db.Customers.Count());\r
+            AssertHelper.Less(count, db.Customers.Count());\r
         }\r
 \r
         [Test]\r
@@ -496,7 +496,7 @@ namespace nwind
         }\r
 \r
         [Test]\r
-        [ExpectedException(ExceptionType=typeof(InvalidOperationException), ExpectedMessage="Data context options cannot be modified after results have been returned from a query.")]\r
+        [ExpectedException(typeof(InvalidOperationException), ExpectedMessage="Data context options cannot be modified after results have been returned from a query.")]\r
         public void C13_Changing_ObjectTrackingEnabled2False()\r
         {\r
             Northwind db = CreateDB();\r
@@ -507,7 +507,7 @@ namespace nwind
         }\r
 \r
         [Test]\r
-        [ExpectedException(ExceptionType = typeof(InvalidOperationException), ExpectedMessage = "Data context options cannot be modified after results have been returned from a query.")]\r
+        [ExpectedException(typeof(InvalidOperationException), ExpectedMessage = "Data context options cannot be modified after results have been returned from a query.")]\r
         public void C14_Changing_DeferredLoadingEnabled2False()\r
         {\r
             Northwind db = CreateDB();\r
@@ -518,7 +518,7 @@ namespace nwind
         }\r
 \r
         [Test]\r
-        [ExpectedException(ExceptionType = typeof(InvalidOperationException), ExpectedMessage = "Object tracking is not enabled for the current data context instance.")]\r
+        [ExpectedException(typeof(InvalidOperationException), ExpectedMessage = "Object tracking is not enabled for the current data context instance.")]\r
         public void C15_SubmitChanges_DeferredLoadingEnabled_False()\r
         {\r
             Northwind db = CreateDB();\r
@@ -572,7 +572,7 @@ namespace nwind
                         .Join(db.GetTable<EmployeeTerritory>(), t => t.TerritoryID, l => l.TerritoryID, (t, l) => l)\r
                         .Join(db.GetTable<Employee>().Where(e => e.EmployeeID > 0), l => l.EmployeeID, e => e.EmployeeID, (l, e) => e);\r
             var employeeCount = q.Count();\r
-            Assert.Greater(employeeCount, 0, "Expected any employees, got count=" + employeeCount);\r
+            AssertHelper.Greater(employeeCount, 0, "Expected any employees, got count=" + employeeCount);\r
         }\r
 \r
         /// <summary>\r
@@ -839,7 +839,7 @@ namespace nwind
 \r
             var q = from p in db.Products where p.ProductName == "Chai" select p.ProductID;\r
             var productID = q.First();\r
-            Assert.Greater(productID, 0, "Expected penID>0, got " + productID);\r
+            AssertHelper.Greater(productID, 0, "Expected penID>0, got " + productID);\r
         }\r
 \r
 \r
@@ -880,7 +880,7 @@ namespace nwind
 \r
             var q = from p in db.Products where p.ProductName == "Chai" select p.ProductID;\r
             var productID = q.Last();\r
-            Assert.Greater(productID, 0, "Expected penID>0, got " + productID);\r
+            AssertHelper.Greater(productID, 0, "Expected penID>0, got " + productID);\r
         }\r
 \r
 #if !DEBUG && (POSTGRES || (MSSQL && !L2SQL))\r
@@ -902,11 +902,11 @@ namespace nwind
                 {\r
                     //int compareNames = prevProductName.CompareTo(p.ProductName);\r
                     int compareNames = string.Compare(prevProductName, p.ProductName, stringComparisonType);\r
-                    Assert.Less(compareNames, 0, "When ordering by names, expected " + prevProductName + " to come after " + p.ProductName);\r
+                    AssertHelper.Less(compareNames, 0, "When ordering by names, expected " + prevProductName + " to come after " + p.ProductName);\r
                 }\r
                 prevProductName = p.ProductName;\r
             }\r
-            //Assert.Greater(productID,0,"Expected penID>0, got "+productID);\r
+            //AssertHelper.Greater(productID,0,"Expected penID>0, got "+productID);\r
         }\r
 \r
         [Test]\r
@@ -915,7 +915,7 @@ namespace nwind
             Northwind db = CreateDB();\r
             //var q = from p in db.Products where "Chai"==p.ProductName select p.Order;\r
             //List<Order> penOrders = q.ToList();\r
-            //Assert.Greater(penOrders.Count,0,"Expected some orders for product 'Chai'");\r
+            //AssertHelper.Greater(penOrders.Count,0,"Expected some orders for product 'Chai'");\r
 \r
             var q =\r
                 from o in db.Orders\r
@@ -929,7 +929,7 @@ namespace nwind
                 Assert.IsNotNull(co.c.City, "Expected non-null customer city");\r
                 Assert.IsNotNull(co.o, "Expected non-null order");\r
             }\r
-            Assert.Greater(list1.Count, 0, "Expected some orders for London customers");\r
+            AssertHelper.Greater(list1.Count, 0, "Expected some orders for London customers");\r
         }\r
 \r
         [Test]\r
@@ -947,7 +947,7 @@ namespace nwind
                 Assert.IsNotNull(co.c, "Expected non-null customer");\r
                 Assert.IsNotNull(co.o, "Expected non-null order");\r
             }\r
-            Assert.Greater(list1.Count, 0, "Expected some orders for London customers");\r
+            AssertHelper.Greater(list1.Count, 0, "Expected some orders for London customers");\r
         }\r
 \r
         [Test]\r
@@ -962,7 +962,7 @@ namespace nwind
                 where c.City == "London"\r
                 select new { c, o };\r
 \r
-            Assert.Greater(q.ToList().Count, 0, "Expected some orders for London customers");\r
+            AssertHelper.Greater(q.ToList().Count, 0, "Expected some orders for London customers");\r
         }\r
 \r
         [Test]\r
@@ -987,7 +987,7 @@ namespace nwind
 #else\r
             int expectedCount = 2; //Oracle, Mysql: 'Toilet Paper' and 'iPod'\r
 #endif\r
-            Assert.Greater(prods.Count, expectedCount, "Expected couple of products with letter 'p'");\r
+            AssertHelper.Greater(prods.Count, expectedCount, "Expected couple of products with letter 'p'");\r
         }\r
 \r
         [Test]\r
@@ -1002,11 +1002,11 @@ namespace nwind
             ).Take(5);\r
             //var q = db.Products.Where( p=>p.ProductName.Contains("p")).Take(5);\r
             List<Product> prods = q.ToList();\r
-            Assert.Greater(prods.Count, 2, "Expected couple of products with letter 'p'");\r
+            AssertHelper.Greater(prods.Count, 2, "Expected couple of products with letter 'p'");\r
 \r
             var prodID0 = prods[0].ProductID;\r
             var prodID1 = prods[1].ProductID;\r
-            Assert.Greater(prodID0, prodID1, "Sorting is broken");\r
+            AssertHelper.Greater(prodID0, prodID1, "Sorting is broken");\r
         }\r
 \r
         [Test]\r
index 8d8c325cbec773aba06c7b293d75553ace8c292b..fe7a675318132bfcbb66b452cc5e859e594b00b1 100644 (file)
@@ -136,7 +136,7 @@ using Id = System.Int32;
         {\r
             var q = from p in db.Products select p;\r
             int productCount = q.Count();\r
-            Assert.Greater(productCount, 0, "Expected non-zero product count");\r
+            AssertHelper.Greater(productCount, 0, "Expected non-zero product count");\r
         }\r
 \r
         [Test]\r
@@ -144,7 +144,7 @@ using Id = System.Int32;
         {\r
             var q = from p in db.Products select p.ProductID;\r
             int productCount = q.Count();\r
-            Assert.Greater(productCount, 0, "Expected non-zero product count");\r
+            AssertHelper.Greater(productCount, 0, "Expected non-zero product count");\r
             Console.WriteLine();\r
         }\r
         [Test]\r
@@ -152,7 +152,7 @@ using Id = System.Int32;
         {\r
             var q = from p in db.Products select p.ProductID;\r
             int productCount = q.Count(i => i < 3);\r
-            Assert.Greater(productCount, 0, "Expected non-zero product count");\r
+            AssertHelper.Greater(productCount, 0, "Expected non-zero product count");\r
             Assert.IsTrue(productCount < 4, "Expected product count < 3");\r
         }\r
 \r
@@ -161,7 +161,7 @@ using Id = System.Int32;
         {\r
             var q = from p in db.Products select p.ProductID;\r
             var maxID = q.Max();\r
-            Assert.Greater(maxID, 0, "Expected non-zero product count");\r
+            AssertHelper.Greater(maxID, 0, "Expected non-zero product count");\r
         }\r
 \r
         [Test]\r
@@ -169,7 +169,7 @@ using Id = System.Int32;
         {\r
             var q = from p in db.Products select p.ProductID;\r
             var minID = q.Min();\r
-            Assert.Greater(minID, 0, "Expected non-zero product count");\r
+            AssertHelper.Greater(minID, 0, "Expected non-zero product count");\r
         }\r
 \r
 #if !ORACLE // picrap: this test causes an internal buffer overflow when marshaling with oracle win32 driver\r
@@ -179,7 +179,7 @@ using Id = System.Int32;
         {\r
             var q = from p in db.Products select p.ProductID;\r
             double avg = q.Average();\r
-            Assert.Greater(avg, 0, "Expected non-zero productID average");\r
+            AssertHelper.Greater(avg, 0, "Expected non-zero productID average");\r
         }\r
 \r
 #endif\r
@@ -268,7 +268,7 @@ using Id = System.Int32;
             var q4 = from p in db.Products select p.ProductName + p.ProductID;\r
             //var q4 = from p in db.Products select p.ProductID;\r
             var q5 = q4.ToList();\r
-            Assert.Greater(q5.Count, 2, "Expected to see some concat strings");\r
+            AssertHelper.Greater(q5.Count, 2, "Expected to see some concat strings");\r
             foreach (string s0 in q5)\r
             {\r
                 bool startWithLetter = Char.IsLetter(s0[0]);\r
@@ -288,7 +288,7 @@ using Id = System.Int32;
                      select p.ProductName+p.ProductID;\r
             //var q4 = from p in db.Products select p.ProductID;\r
             //var q5 = q4.ToList();\r
-            Assert.Greater( q4.Count(), 2, "Expected to see some concat strings");\r
+            AssertHelper.Greater( q4.Count(), 2, "Expected to see some concat strings");\r
             foreach(string s0 in q4)\r
             {\r
                 bool startWithLetter = Char.IsLetter(s0[0]);\r
@@ -312,8 +312,8 @@ using Id = System.Int32;
                                           CustomerID = c.CustomerID\r
                                       });\r
             var list = q.ToList();\r
-            Assert.Greater(list.Count(), 0, "Expected list");\r
-            //Assert.Greater(list.Count(), 0, "Expected list");\r
+            AssertHelper.Greater(list.Count(), 0, "Expected list");\r
+            //AssertHelper.Greater(list.Count(), 0, "Expected list");\r
             Assert.Ignore("test passed but: theoretically constructions of entity types are not allowed");\r
         }\r
 \r
@@ -331,8 +331,8 @@ using Id = System.Int32;
             //this OrderBy clause messes up the SQL statement\r
             var q2 = q.OrderBy(c => c.CustomerID);\r
             var list = q2.ToList();\r
-            Assert.Greater(list.Count(), 0, "Expected list");\r
-            //Assert.Greater(list.Count(), 0, "Expected list");\r
+            AssertHelper.Greater(list.Count(), 0, "Expected list");\r
+            //AssertHelper.Greater(list.Count(), 0, "Expected list");\r
         }\r
 \r
 \r
@@ -344,7 +344,7 @@ using Id = System.Int32;
                     orderby c.ContactName ?? ""\r
                     select c;\r
             var list = q.ToList();\r
-            Assert.Greater(list.Count(), 0, "Expected list");\r
+            AssertHelper.Greater(list.Count(), 0, "Expected list");\r
         }\r
 \r
         [Test(Description = "Non-dynamic version of DL5_NestedObjectSelect")]\r
index 4d87952ed79e63e09cf587601e842cb2db2a6728..9ff4496ee8bbb3dd413af5a111b6ac3d835a8087 100644 (file)
@@ -231,10 +231,10 @@ using nwind;
                      select new { g.Key, OrderCount = g.Count() };\r
 \r
             var lst = q2.ToList();\r
-            Assert.Greater(lst.Count, 0, "Expected some grouped order results");\r
+            AssertHelper.Greater(lst.Count, 0, "Expected some grouped order results");\r
             var result0 = lst[0];\r
             Assert.IsTrue(result0.Key != null, "Key must be non-null");\r
-            Assert.Greater(result0.OrderCount, 0, "Count must be > 0");\r
+            AssertHelper.Greater(result0.OrderCount, 0, "Count must be > 0");\r
             //select new { g.Key , SumPerCustomer = g.Sum(o2=>o2.OrderID) };\r
         }\r
 \r
@@ -252,10 +252,10 @@ using nwind;
                      select new { g.Key, OrderCount = g.Count() };\r
 \r
             var lst = q2.ToList();\r
-            Assert.Greater(lst.Count, 0, "Expected some grouped order results");\r
+            AssertHelper.Greater(lst.Count, 0, "Expected some grouped order results");\r
             var result0 = lst[0];\r
             Assert.IsTrue(result0.Key != null, "Key must be non-null");\r
-            Assert.Greater(result0.OrderCount, 0, "Count must be > 0");\r
+            AssertHelper.Greater(result0.OrderCount, 0, "Count must be > 0");\r
             //select new { g.Key , SumPerCustomer = g.Sum(o2=>o2.OrderID) };\r
         }\r
 \r
@@ -272,12 +272,12 @@ using nwind;
                      //where g.Count()>1\r
                      select new { g.Key, OrderSum = g.Sum(o => o.OrderID) };\r
             var lst = q2.ToList();\r
-            Assert.Greater(lst.Count, 0, "Expected some grouped order results");\r
+            AssertHelper.Greater(lst.Count, 0, "Expected some grouped order results");\r
             foreach (var result in lst)\r
             {\r
                 Console.WriteLine("  Result: custID=" + result.Key + " sum=" + result.OrderSum);\r
                 Assert.IsTrue(result.Key != null, "Key must be non-null");\r
-                Assert.Greater(result.OrderSum, 0, "OrderSum must be > 0");\r
+                AssertHelper.Greater(result.OrderSum, 0, "OrderSum must be > 0");\r
             }\r
             //select new { g.Key , SumPerCustomer = g.Sum(o2=>o2.OrderID) };\r
         }\r
index 0c58ea44d4cbefd5efec0dffd7a9f2b588702477..48e0020e30fc8e9cb3334fc7167ff4e0619e0773 100644 (file)
@@ -331,7 +331,7 @@ using nwind;
             decimal[] d = new decimal[] { 1, 4, 5, 6, 10248, 10255 };\r
             var q = db.OrderDetails.Where(o => d.Contains(o.OrderID));\r
 \r
-            Assert.Greater(q.Count(), 0);\r
+            AssertHelper.Greater(q.Count(), 0);\r
         }\r
 \r
 \r
index 3d1981a405db66e0839c904a66b8ae41945fdf60..dabe2f12a7819a833252d38b3ec60a713d51995a 100644 (file)
@@ -265,7 +265,7 @@ using DbLinq.Data.Linq;
 \r
 \r
             var list = query.ToList();\r
-            Assert.Greater(list.Count, 0);\r
+            AssertHelper.Greater(list.Count, 0);\r
         }\r
 \r
 #if !DEBUG && SQLITE\r
@@ -299,7 +299,7 @@ using DbLinq.Data.Linq;
 \r
 \r
             var list = query.ToList();\r
-            Assert.Greater(list.Count, 0);\r
+            AssertHelper.Greater(list.Count, 0);\r
         }\r
 \r
 \r
@@ -334,7 +334,7 @@ using DbLinq.Data.Linq;
 \r
 \r
             var list = query.ToList();\r
-            Assert.Greater(list.Count, 0);\r
+            AssertHelper.Greater(list.Count, 0);\r
         }\r
 \r
 #if !DEBUG && (SQLITE || MSSQL)\r
@@ -354,7 +354,7 @@ using DbLinq.Data.Linq;
             \r
 \r
             var list = query.ToList();\r
-            Assert.Greater(list.Count, 0);\r
+            AssertHelper.Greater(list.Count, 0);\r
         }\r
 \r
 #if !DEBUG && SQLITE\r
@@ -388,7 +388,7 @@ using DbLinq.Data.Linq;
 \r
 \r
             var list = query.ToList();\r
-            Assert.Greater(list.Count, 0);\r
+            AssertHelper.Greater(list.Count, 0);\r
         }\r
 \r
 #if !DEBUG && SQLITE\r
@@ -410,7 +410,7 @@ using DbLinq.Data.Linq;
 \r
             var list = query.ToList();\r
 \r
-            Assert.Greater(list.Count, 0);\r
+            AssertHelper.Greater(list.Count, 0);\r
         }\r
 \r
 #if !DEBUG && POSTGRES\r
@@ -443,7 +443,7 @@ using DbLinq.Data.Linq;
 \r
                 var list = query.ToList();\r
 \r
-                Assert.Greater(list.Count, 0);\r
+                AssertHelper.Greater(list.Count, 0);\r
             }\r
             finally\r
             {\r
@@ -481,7 +481,7 @@ using DbLinq.Data.Linq;
 \r
                 var list = query.ToList();\r
 \r
-                Assert.Greater(list.Count, 0);\r
+                AssertHelper.Greater(list.Count, 0);\r
             }\r
             finally\r
             {\r
index 40503fed4f534d09174c598ac28f34299f5234b4..16a0b0a7ba0b478dd10b0d763fce6ab91634f70a 100644 (file)
@@ -53,7 +53,7 @@ using nwind;
         {\r
             var db = CreateDB();\r
             var customer = db.Customers.First();\r
-            Assert.Greater(customer.Orders.Count, 0);\r
+            AssertHelper.Greater(customer.Orders.Count, 0);\r
         }\r
 \r
 #if !DEBUG && (SQLITE || (MSSQL && !L2SQL))\r
@@ -65,7 +65,7 @@ using nwind;
             var db = CreateDB();\r
             var results = (from c in db.Customers select c.Orders).ToList();\r
 \r
-            Assert.Greater(results.Count, 0);\r
+            AssertHelper.Greater(results.Count, 0);\r
         }\r
 \r
         [Test]\r
@@ -98,7 +98,7 @@ using nwind;
             var db = CreateDB();\r
             var customer = db.Customers.First();\r
 \r
-            Assert.Greater(customer.Orders.Count, 0, "#1");\r
+            AssertHelper.Greater(customer.Orders.Count, 0, "#1");\r
             Assert.IsTrue(customer.Orders.HasLoadedOrAssignedValues, "#2");\r
             customer.Orders.SetSource(System.Linq.Enumerable.Empty<Order>());\r
         }\r
@@ -136,7 +136,7 @@ using nwind;
             int ordersCount = (from cust in db.Customers\r
                                select cust.Orders.Count).First();\r
 \r
-            Assert.Greater(ordersCount, 0);\r
+            AssertHelper.Greater(ordersCount, 0);\r
 \r
             var customer2 = db.Customers.First();\r
             customer2.Orders.SetSource(System.Linq.Enumerable.Empty<Order>());\r
@@ -154,11 +154,11 @@ using nwind;
             var c = db.Customers.First();\r
 \r
             int beforeCount = c.Orders.Count;\r
-            Assert.Greater(beforeCount, 0);\r
+            AssertHelper.Greater(beforeCount, 0);\r
             c.Orders.Clear();\r
             Assert.AreEqual(c.Orders.Count, 0);\r
             c.Orders.AddRange(db.Orders);\r
-            Assert.Greater(c.Orders.Count, beforeCount);\r
+            AssertHelper.Greater(c.Orders.Count, beforeCount);\r
             db.Refresh(RefreshMode.OverwriteCurrentValues, c.Orders);\r
 \r
             Assert.AreEqual(c.Orders.Count, beforeCount);\r
@@ -174,13 +174,13 @@ using nwind;
             var c = db.Customers.First();\r
 \r
             int beforeCount = c.Orders.Count;\r
-            Assert.Greater(beforeCount, 0);\r
+            AssertHelper.Greater(beforeCount, 0);\r
             c.Orders.Clear();\r
             Assert.AreEqual(c.Orders.Count, 0);\r
             c.Orders.AddRange(db.Orders);\r
 \r
             int middleCount = c.Orders.Count;\r
-            Assert.Greater(c.Orders.Count, beforeCount);\r
+            AssertHelper.Greater(c.Orders.Count, beforeCount);\r
 \r
             db.Refresh(RefreshMode.KeepCurrentValues, c.Orders);\r
             Assert.AreEqual(c.Orders.Count, middleCount);\r
@@ -233,7 +233,7 @@ using nwind;
         {\r
             var db = CreateDB();\r
             var customer = db.Customers.Where(c => c.Orders.Count > 0).First();\r
-            Assert.Greater(customer.Orders.Count, 0);\r
+            AssertHelper.Greater(customer.Orders.Count, 0);\r
             bool ok;\r
             System.ComponentModel.ListChangedEventArgs args = null;\r
             customer.Orders.ListChanged += delegate(object sender, System.ComponentModel.ListChangedEventArgs a) \r
index f792f8e585fb0e173c1d07d5553c36dfbc050535..e32291198abae2c9f7e5920020984dceb129f7a0 100644 (file)
@@ -86,10 +86,10 @@ using nwind;
             foreach (var c in q)\r
             {\r
                 Assert.IsNotNull(c.CustomerID);\r
-                Assert.Greater(c.OrderCount, -1);\r
+                AssertHelper.Greater(c.OrderCount, -1);\r
                 count++;\r
             }\r
-            Assert.Greater(count, 0);\r
+            AssertHelper.Greater(count, 0);\r
         }\r
 \r
         [Test]\r
@@ -103,10 +103,10 @@ using nwind;
             foreach (var v in q)\r
             {\r
                 Assert.IsNotNull(v.c.CustomerID);\r
-                Assert.Greater(v.OrderCount, -1);\r
+                AssertHelper.Greater(v.OrderCount, -1);\r
                 count++;\r
             }\r
-            Assert.Greater(count, 0);\r
+            AssertHelper.Greater(count, 0);\r
         }\r
 \r
         [Test]\r
@@ -121,7 +121,7 @@ using nwind;
                 Assert.IsTrue(c.CustomerID!=null, "Non-null customerID required");\r
                 count++;\r
             }\r
-            Assert.Greater(count, 0);\r
+            AssertHelper.Greater(count, 0);\r
         }\r
 #endif\r
     }\r
index 3aa1c9e1b6f1484b396c8124c6b95cc4e8c97d3d..08ed664f1b3c16cfeab659b9a61fe7cdd0ffc967 100644 (file)
@@ -161,7 +161,7 @@ using nwind;
             var customer = new Customer();\r
             db.Customers.Attach(customer, originalCustomer);\r
 \r
-            Assert.Greater(db.Customers.GetModifiedMembers(customer).Count(), 0);\r
+            AssertHelper.Greater(db.Customers.GetModifiedMembers(customer).Count(), 0);\r
         }\r
 \r
 #if !DEBUG && (SQLITE || POSTGRES || (MSSQL && !L2SQL))\r
index e593fc37c6e51b376f15d4f6086362102fd64966..ba0734df607a65de5db2347ea94a8a5abcac2fcb 100644 (file)
@@ -33,7 +33,7 @@ using NUnit.Framework;
 \r
 using nwind;\r
 \r
-#if MONO_STRICT && !MONO\r
+#if MONO_STRICT\r
 using System.Diagnostics;\r
 public static class Profiler\r
 {\r
index a30b2cff6a41dd2dac870107118fdb4dfee07e77..11fe0098a2a8b3e20d57fe91c44beb1da793ab69 100644 (file)
@@ -165,7 +165,7 @@ using Id = System.Int32;
             newProd.QuantityPerUnit = "33 1/2";\r
             db.Products.InsertOnSubmit(newProd);\r
             db.SubmitChanges();\r
-            Assert.Greater(newProd.ProductID, 0, "After insertion, ProductID should be non-zero");\r
+            AssertHelper.Greater(newProd.ProductID, 0, "After insertion, ProductID should be non-zero");\r
             //Assert.IsFalse(newProd.IsModified, "After insertion, Product.IsModified should be false");\r
             return (int)newProd.ProductID; //this test cab be used from delete tests\r
         }\r
@@ -180,7 +180,7 @@ using Id = System.Int32;
         public void G2_DeleteTest()\r
         {\r
             int insertedID = insertProduct_priv();\r
-            Assert.Greater(insertedID, 0, "DeleteTest cannot operate if row was not inserted");\r
+            AssertHelper.Greater(insertedID, 0, "DeleteTest cannot operate if row was not inserted");\r
 \r
             Northwind db = CreateDB();\r
 \r
@@ -200,7 +200,7 @@ using Id = System.Int32;
         public void G3_DeleteTest()\r
         {\r
             int insertedID = insertProduct_priv();\r
-            Assert.Greater(insertedID, 0, "DeleteTest cannot operate if row was not inserted");\r
+            AssertHelper.Greater(insertedID, 0, "DeleteTest cannot operate if row was not inserted");\r
 \r
             Northwind db = CreateDB();\r
 \r
index 431634ee37c844608af0fe6e97d360b27ff6f537..a3ef05590f275059b6e8f1a6bba5bc79a7d30f79 100644 (file)
@@ -1,10 +1,8 @@
 Some tests located require a connection to Oracle database to execute.
-To configure a connection, copy System.Data.OracleClient_test_default.dll.config.example
-to System.Data.OracleClient_test_default.dll.config and fill in the ConnectionString with appropriate Data Source.
+To configure a connection, set the MONO_TESTS_ORACLE_CONNECTION_STRING environment variable to a connection string like the following:
 
-If no System.Data.OracleClient_test_default.dll.config is present, those tests will be ignored.
+Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=<host ip>)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=<sid>)));uid=<user name>;pwd=<password>;
 
-To test .Net 2.0 profile, copy System.Data.OracleClient_test_default.dll.config
-to System.Data.OracleClient_test_net_2_0.dll.config and launch tests with PROFILE=net_2_0 .
+If the environment variable is not present, those tests will be ignored.
 
 Scripts for populating the database are located in Test/System.Data.OracleClient.jvm (for their usage, consult Test/System.Data.OracleClient.jvm/readme.txt).
index e569ce44aadc5670c18fb99983c1862d418eb8d4..092f11382bb2942f726449daee6ae36f53b4c3b2 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
diff --git a/mcs/class/System.Data.OracleClient/System.Data.OracleClient_test_default.dll.config.example b/mcs/class/System.Data.OracleClient/System.Data.OracleClient_test_default.dll.config.example
deleted file mode 100644 (file)
index 03703a7..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-<configuration>
-       <appSettings>
-               <add key="ConnectionString" value="Data Source=;User ID=GHTDB;Password=GHTDB;" />
-       </appSettings>
-</configuration>
index 43e77ef1b220a4deaae4290a89729a76531ca3da..02c12ee3c947ee04bfb31a152a8935cbe4a60dd7 100644 (file)
@@ -51,7 +51,7 @@ namespace MonoTests.System.Data.OracleClient {
                 [TestFixtureSetUp]
                 public void FixtureSetUp ()
                 {
-                        connection_string = ConfigurationSettings.AppSettings.Get ("ConnectionString");
+                        connection_string = Environment.GetEnvironmentVariable ("MONO_TESTS_ORACLE_CONNECTION_STRING");
                         if(connection_string == null)
                                 Assert.Ignore ("Please consult README.tests.");
                 }
index a5feb72a00ba44d3ede3845b4f7b683384e90a99..70421c51a8dd6d1a7cc846e81d6261735282e75c 100755 (executable)
@@ -47,6 +47,7 @@ CREATE USER "GHTDB"
     TEMPORARY TABLESPACE "TEMP" ;
 
 GRANT CONNECT, RESOURCE, CREATE TABLE  TO "GHTDB";
+ALTER USER GHTDB quota unlimited on USERS;
 
 CREATE OR REPLACE  PACKAGE "GHTDB"."GHTPKG"  AS
        TYPE RCT1 IS REF CURSOR;
@@ -923,6 +924,7 @@ CREATE USER "GHTDB_EX"
     TEMPORARY TABLESPACE "TEMP" ;
 
 GRANT CONNECT, RESOURCE TO "GHTDB_EX";
+ALTER USER GHTDB_EX quota unlimited on USERS;
 
 CREATE OR REPLACE PACKAGE GHTDB_EX.GHTPKG
 AS
index 3fd8b632a9f0416ac6fb84124c0afd96e1ffb30f..ebe3de47ce51b12b707fbe72d145f116ce7b7c6e 100644 (file)
@@ -72,7 +72,7 @@ namespace MonoTests.System.Data.Utils {
 
                public static string ConnectionString {
                        get {
-                                string connection_string = Sys.Configuration.ConfigurationSettings.AppSettings["ConnectionString"];
+                                string connection_string = Environment.GetEnvironmentVariable ("MONO_TESTS_ORACLE_CONNECTION_STRING");
                                 if(connection_string == null)
                                         NUnit.Framework.Assert.Ignore ("Please consult README.tests.");
                                 return connection_string;
index 9c638e8252de6902084d8ce007233976202dc9cc..f544c35100675c0157f984d2ac1bea9a378339bd 100644 (file)
@@ -39,14 +39,7 @@ namespace MonoTests.System.Data.OracleClient
                [SetUp]
                public void SetUp()
                {
-                       try
-                       {
-                               _ConnectionString = MonoTests.System.Data.Utils.ConnectedDataProvider.ConnectionString;
-                       }
-                       catch(Exception ex)
-                       {
-                               EndCase(ex);
-                       }
+                       _ConnectionString = MonoTests.System.Data.Utils.ConnectedDataProvider.ConnectionString;
                }
 
                [TearDown]
index a9164fb27a7f7566484a53606e6e303833a2f451..9c36355d57f43f429d509dbe5cd36e21265c878e 100755 (executable)
@@ -1,15 +1,6 @@
 To run unit test the following should be prepared:
 
-1. Test\System.Data.OracleClient.J2EE.config should contain an ConnectionString setting, i.e.:
-
-<?xml version="1.0" encoding="utf-8" ?>
-<configuration>
-<appSettings>
-    <add key="ConnectionString" value="User ID=ghtdb;Password=ghtdb;Data Source=xp050" />
-  </appSettings>
-</configuration>
-
-2. A target db should be prepared with the relevant structure, following are the instruction for each supported database.
+A target db should be prepared with the relevant structure, following are the instruction for each supported database.
 
 in order to create the testing database, on ORACLE, run:
 Run the scripts with a user wich have administrator permissions. (by default user:system, password:mainsoft).
index 6b758dea47fae69022ab79245b4e2e6eeb3644f7..0dfd37e6402f0cfd2cb50d42dbe5413f641088b8 100644 (file)
@@ -48,7 +48,7 @@ namespace MonoTests.System.Data.OracleClient {
                 [TestFixtureSetUp]
                 public void FixtureSetUp ()
                 {
-                        connection_string = ConfigurationSettings.AppSettings.Get ("ConnectionString");
+                        connection_string = Environment.GetEnvironmentVariable ("MONO_TESTS_ORACLE_CONNECTION_STRING");
                         if(connection_string == null)
                                 Assert.Ignore ("Please consult README.tests.");
                 }
index d625b6bf129ac25230f1c2e35a9d80002b624b14..29c2e9022c74553dfb14d5ebab6aa3228eaffd12 100644 (file)
@@ -52,7 +52,7 @@ namespace MonoTests.System.Data.OracleClient
                [TestFixtureSetUp]
                public void FixtureSetUp ()
                {
-                       connection_string = ConfigurationSettings.AppSettings.Get ("ConnectionString");
+                       connection_string = Environment.GetEnvironmentVariable ("MONO_TESTS_ORACLE_CONNECTION_STRING");
                }
 
                [SetUp]
index e5d64222fa84dd2641e4f4a7f659b3028e15c7fd..29a16573c7c7a53852b64c7f53ab16dedf4a3365 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;NET_3_5</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;NET_3_5</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;NET_3_5</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;NET_3_5</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 6a4ef89e6c8bf13b70136105c1fa71096935b7c4..116bd6fa73d4f4891efa67c706abaf0ef67a5bf7 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;NET_3_5</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;NET_3_5</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;NET_3_5</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;NET_3_5</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index b5bd23a7cbe8cb79f73e38af70f4a38447fa87ee..0806c36fb52977bfd5104e32117ff0e1e4d07994 100644 (file)
@@ -6,17 +6,23 @@ LIBRARY = System.Data.dll
 
 LIB_REFS = System System.Xml System.Core System.Numerics
 LIB_MCS_FLAGS = \
-       -nowarn:169,219,414,649 \
+       -nowarn:219,414,649 \
        -d:PLATFORM_UNIX \
        -d:USEOFFSET \
        -d:MONO_PARTIAL_DATA_IMPORT \
        -unsafe
 
+ifdef NO_MONO_SECURITY
+MONO_DATA_TDS=
+else
+MONO_DATA_TDS=Mono.Data.Tds
+endif
+
 ifdef MOBILE_PROFILE
-LIB_REFS += Mono.Data.Tds System.Transactions
+LIB_REFS += $(MONO_DATA_TDS) System.Transactions
 LIB_MCS_FLAGS += -d:NO_CODEDOM -d:NO_OLEDB -d:NO_ODBC -d:NO_CONFIGURATION
 else
-LIB_REFS += System.EnterpriseServices Mono.Data.Tds System.Configuration System.Transactions
+LIB_REFS += System.EnterpriseServices $(MONO_DATA_TDS) System.Configuration System.Transactions
 BUILT_SOURCES = \
        gen_OdbcConnection.cs \
        gen_OleDbConnection.cs \
@@ -31,6 +37,8 @@ TXT_RESOURCE_STRINGS = ../referencesource/System.Data/system.data.txt
 TEST_LIB_REFS = System.Core Mono.Data.Sqlite
 TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) -nowarn:618,169,612,219,168
 
+TEST_NUNITLITE_APP_CONFIG_GLOBAL=Test/test-config-file
+
 TEST_MONO_PATH = .
 
 EXTRA_DISTFILES = \
@@ -39,7 +47,7 @@ EXTRA_DISTFILES = \
        $(wildcard Test/System.Xml/*.xml)               \
        $(wildcard Test/System.Xml/*.xsd)               \
        $(wildcard Test/System.Data/schemas/*.xsd)              \
-       app_test_net_4_x.config                 \
+       Test/test-config-file                   \
        Test/System.Data/binserialize/*.bin     \
        SqliteTest.db   \
        referencesource.sources
@@ -85,8 +93,3 @@ gen_SqlParameterCollection.cs: ../referencesource/System.Data/System/Data/Provid
        sed -e s/PARAMETEROBJECTNAME/SqlParameter/g >$@
 
 include ../../build/library.make
-
-$(test_lib): $(test_lib).config
-
-$(test_lib).config: app_test_$(PROFILE).config
-       cp $< $@
index 552ec452530cb80208bf70b344bf1986735968df..5bb4f1f25cab109f64ef53c241349f873b26a927 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -7,7 +8,7 @@
     <SchemaVersion>2.0</SchemaVersion>\r
     <ProjectGuid>{EC439BB8-FFED-4A32-A05D-2FA3A70CAD64}</ProjectGuid>\r
     <OutputType>Library</OutputType>\r
-    <NoWarn>1699,169,219,414,649</NoWarn>\r
+    <NoWarn>1699,219,414,649</NoWarn>\r
     <OutputPath>./../../class/lib/net_4_x</OutputPath>\r
     <IntermediateOutputPath>obj-net_4_x</IntermediateOutputPath>\r
     <GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>\r
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
     <DebugSymbols>true</DebugSymbols>\r
     <DebugType>full</DebugType>\r
-    <NoWarn>1699,169,219,414,649</NoWarn>\r
+    <NoWarn>1699,219,414,649</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;PLATFORM_UNIX;USEOFFSET;MONO_PARTIAL_DATA_IMPORT</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;PLATFORM_UNIX;USEOFFSET;MONO_PARTIAL_DATA_IMPORT</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">\r
     <DebugType>pdbonly</DebugType>\r
-    <NoWarn>1699,169,219,414,649</NoWarn>\r
+    <NoWarn>1699,219,414,649</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;PLATFORM_UNIX;USEOFFSET;MONO_PARTIAL_DATA_IMPORT</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;PLATFORM_UNIX;USEOFFSET;MONO_PARTIAL_DATA_IMPORT</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
     <Compile Include="Microsoft.SqlServer.Server\SqlDataRecord.cs" />\r
     <Compile Include="Microsoft.SqlServer.Server\SqlMetaData.cs" />\r
     <Compile Include="ReferenceSources\NativeOledbWrapper.cs" />\r
+    <Compile Include="ReferenceSources\PoolBlockingPeriod.cs" />\r
     <Compile Include="ReferenceSources\Res.cs" />\r
     <Compile Include="ReferenceSources\Res.missing.cs" />\r
     <Compile Include="ReferenceSources\ResCategoryAttribute.cs" />\r
diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlBulkCopy.platformnotsupported.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlBulkCopy.platformnotsupported.cs
new file mode 100644 (file)
index 0000000..95d6801
--- /dev/null
@@ -0,0 +1,136 @@
+//
+// SqlBulkCopy.cs
+//
+// Author:
+//       Rolf Bjarne Kvinge <rolf@xamarin.com>
+//
+// Copyright (c) 2016 Xamarin, Inc.
+//
+// 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.Data.Common;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace System.Data.SqlClient {
+       public sealed class SqlBulkCopy : IDisposable
+       {
+               const string EXCEPTION_MESSAGE = "System.Data.SqlClient.SqlBulkCopy is not supported on the current platform.";
+
+               public SqlBulkCopy (SqlConnection connection)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public SqlBulkCopy (string connectionString)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public SqlBulkCopy (string connectionString, SqlBulkCopyOptions copyOptions)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public SqlBulkCopy (SqlConnection connection, SqlBulkCopyOptions copyOptions, SqlTransaction externalTransaction)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public int BatchSize {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public int BulkCopyTimeout {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public SqlBulkCopyColumnMappingCollection ColumnMappings  {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public string DestinationTableName {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public bool EnableStreaming {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public int NotifyAfter {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public void Close ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public void WriteToServer (DataRow [] rows)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public void WriteToServer (DataTable table)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public void WriteToServer (IDataReader reader)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public void WriteToServer (DataTable table, DataRowState rowState)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public void WriteToServer (DbDataReader reader)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public Task WriteToServerAsync (DbDataReader reader)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public Task WriteToServerAsync (DbDataReader reader, CancellationToken cancellationToken)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               private void RowsCopied (long rowsCopied)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public event SqlRowsCopiedEventHandler SqlRowsCopied;
+
+               void IDisposable.Dispose ()
+               {
+               }
+       }
+}
index c6dc7712baea19fa4846ae2da30eb5529c284944..1fd5443df85192ea7e3fcffd5461c19356952b59 100644 (file)
@@ -510,40 +510,104 @@ namespace System.Data.SqlClient {
                        }
                }
 
-               [MonoTODO]
                public new Task<SqlDataReader> ExecuteReaderAsync ()
                {
-                       throw new NotImplementedException ();
+                       return ExecuteReaderAsync (CommandBehavior.Default, CancellationToken.None);
                }
 
-               [MonoTODO]
                public new Task<SqlDataReader> ExecuteReaderAsync (CancellationToken cancellationToken)
                {
-                       throw new NotImplementedException ();
+                       return ExecuteReaderAsync (behavior, CancellationToken.None);
                }
 
-               [MonoTODO]
                public new Task<SqlDataReader> ExecuteReaderAsync (CommandBehavior behavior)
                {
-                       throw new NotImplementedException ();
+                       return ExecuteReaderAsync (CommandBehavior.Default, CancellationToken.None);
                }
 
-               [MonoTODO]
                public new Task<SqlDataReader> ExecuteReaderAsync (CommandBehavior behavior, CancellationToken cancellationToken)
                {
-                       throw new NotImplementedException ();
+                       TaskCompletionSource<SqlDataReader> source = new TaskCompletionSource<SqlDataReader>();
+
+                       CancellationTokenRegistration registration = new CancellationTokenRegistration();
+                       if (cancellationToken.CanBeCanceled) {
+                               if (cancellationToken.IsCancellationRequested) {
+                                       source.SetCanceled();
+                                       return source.Task;
+                               }
+                               registration = cancellationToken.Register(CancelIgnoreFailure);
+                       }
+
+                       Task<SqlDataReader> returnedTask = source.Task;
+                       try {
+                               // TODO: RegisterForConnectionCloseNotification(ref returnedTask);
+
+                               Task<SqlDataReader>.Factory.FromAsync(BeginExecuteReaderAsync, EndExecuteReader, behavior, null).ContinueWith((t) => {
+                                       registration.Dispose();
+                                       if (t.IsFaulted) {
+                                               Exception e = t.Exception.InnerException;
+                                               source.SetException(e);
+                                       }
+                                       else {
+                                               if (t.IsCanceled) {
+                                                       source.SetCanceled();
+                                               }
+                                               else {
+                                                       source.SetResult(t.Result);
+                                               }
+                                       }
+                               }, TaskScheduler.Default);
+                       }
+                       catch (Exception e) {
+                               source.SetException(e);
+                       }
+
+                       return returnedTask;
                }
 
-               [MonoTODO]
                public Task<XmlReader> ExecuteXmlReaderAsync ()
                {
-                       throw new NotImplementedException ();
+                       return ExecuteXmlReaderAsync (CancellationToken.None);
                }
  
-               [MonoTODO]
                public Task<XmlReader> ExecuteXmlReaderAsync (CancellationToken cancellationToken)
                {
-                       throw new NotImplementedException ();
+                       TaskCompletionSource<XmlReader> source = new TaskCompletionSource<XmlReader>();
+
+                       CancellationTokenRegistration registration = new CancellationTokenRegistration();
+                       if (cancellationToken.CanBeCanceled) {
+                               if (cancellationToken.IsCancellationRequested) {
+                                       source.SetCanceled();
+                                       return source.Task;
+                               }
+                               registration = cancellationToken.Register(CancelIgnoreFailure);
+                       }
+
+                       Task<XmlReader> returnedTask = source.Task;
+                       try {
+                               // TODO: RegisterForConnectionCloseNotification(ref returnedTask);
+
+                               Task<XmlReader>.Factory.FromAsync(BeginExecuteXmlReader, EndExecuteXmlReader, null).ContinueWith((t) => {
+                                       registration.Dispose();
+                                       if (t.IsFaulted) {
+                                               Exception e = t.Exception.InnerException;
+                                               source.SetException(e);
+                                       }
+                                       else {
+                                               if (t.IsCanceled) {
+                                                       source.SetCanceled();
+                                               }
+                                               else {
+                                                       source.SetResult(t.Result);
+                                               }
+                                       }
+                               }, TaskScheduler.Default);
+                       }
+                       catch (Exception e) {
+                               source.SetException(e);
+                       }
+
+                       return returnedTask;
                }
 
                public
@@ -846,6 +910,11 @@ namespace System.Data.SqlClient {
                        return BeginExecuteReader (callback, stateObject, CommandBehavior.Default);
                }
 
+               IAsyncResult BeginExecuteReaderAsync(CommandBehavior behavior, AsyncCallback callback, object stateObject)
+               {
+                       return BeginExecuteReader (callback, stateObject, behavior);
+               }
+
                public IAsyncResult BeginExecuteReader (AsyncCallback callback, object stateObject, CommandBehavior behavior)
                {
                        ValidateCommand ("BeginExecuteReader", true);
@@ -925,6 +994,9 @@ namespace System.Data.SqlClient {
 
                #endregion // Asynchronous Methods
 
+#pragma warning disable 0067
+               // TODO: Not implemented
                public event StatementCompletedEventHandler StatementCompleted;
+#pragma warning restore
        }
 }
diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlCommand.platformnotsupported.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlCommand.platformnotsupported.cs
new file mode 100644 (file)
index 0000000..491483e
--- /dev/null
@@ -0,0 +1,277 @@
+//
+// SqlCommand.cs
+//
+// Author:
+//       Rolf Bjarne Kvinge <rolf@xamarin.com>
+//
+// Copyright (c) 2016 Xamarin, Inc.
+//
+// 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.Data.Common;
+using System.Data.Sql;
+using System.Threading.Tasks;
+using System.Threading;
+using System.Xml;
+
+namespace System.Data.SqlClient {
+       public sealed class SqlCommand : DbCommand, IDbCommand, ICloneable
+       {
+               const string EXCEPTION_MESSAGE = "System.Data.SqlClient.SqlCommand is not supported on the current platform.";
+
+               public SqlCommand()
+                       : this (String.Empty, null, null)
+               {
+               }
+
+               public SqlCommand (string cmdText)
+                       : this (cmdText, null, null)
+               {
+               }
+
+               public SqlCommand (string cmdText, SqlConnection connection)
+                       : this (cmdText, connection, null)
+               {
+               }
+
+               public SqlCommand (string cmdText, SqlConnection connection, SqlTransaction transaction)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override string CommandText {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override int CommandTimeout {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override CommandType CommandType {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public new SqlConnection Connection {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override bool DesignTimeVisible {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public new SqlParameterCollection Parameters {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public new SqlTransaction Transaction {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override UpdateRowSource UpdatedRowSource {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public SqlNotificationRequest Notification {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public bool NotificationAutoEnlist {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override void Cancel ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public SqlCommand Clone ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public new SqlParameter CreateParameter ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override int ExecuteNonQuery ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public new SqlDataReader ExecuteReader ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public new SqlDataReader ExecuteReader (CommandBehavior behavior)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public new Task<SqlDataReader> ExecuteReaderAsync ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public new Task<SqlDataReader> ExecuteReaderAsync (CancellationToken cancellationToken)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public new Task<SqlDataReader> ExecuteReaderAsync (CommandBehavior behavior)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public new Task<SqlDataReader> ExecuteReaderAsync (CommandBehavior behavior, CancellationToken cancellationToken)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public Task<XmlReader> ExecuteXmlReaderAsync ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public Task<XmlReader> ExecuteXmlReaderAsync (CancellationToken cancellationToken)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override object ExecuteScalar ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public XmlReader ExecuteXmlReader ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               object ICloneable.Clone ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               protected override void Dispose (bool disposing)
+               {
+               }
+
+               public override void Prepare ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public void ResetCommandTimeout ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               protected override DbParameter CreateDbParameter ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               protected override DbDataReader ExecuteDbDataReader (CommandBehavior behavior)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               protected override DbConnection DbConnection {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               protected override DbParameterCollection DbParameterCollection {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               protected override DbTransaction DbTransaction {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public IAsyncResult BeginExecuteNonQuery ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public IAsyncResult BeginExecuteNonQuery (AsyncCallback callback, object stateObject)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public int EndExecuteNonQuery (IAsyncResult asyncResult)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public IAsyncResult BeginExecuteReader ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public IAsyncResult BeginExecuteReader (CommandBehavior behavior)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public IAsyncResult BeginExecuteReader (AsyncCallback callback, object stateObject)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public IAsyncResult BeginExecuteReader (AsyncCallback callback, object stateObject, CommandBehavior behavior)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public SqlDataReader EndExecuteReader (IAsyncResult asyncResult)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public IAsyncResult BeginExecuteXmlReader (AsyncCallback callback, object stateObject)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public IAsyncResult BeginExecuteXmlReader ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public XmlReader EndExecuteXmlReader (IAsyncResult asyncResult)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public event StatementCompletedEventHandler StatementCompleted;
+       }
+}
diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlCommandBuilder.platformnotsupported.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlCommandBuilder.platformnotsupported.cs
new file mode 100644 (file)
index 0000000..155ddab
--- /dev/null
@@ -0,0 +1,158 @@
+//
+// SqlCommandBuilder.cs
+//
+// Author:
+//       Rolf Bjarne Kvinge <rolf@xamarin.com>
+//
+// Copyright (c) 2016 Xamarin, Inc.
+//
+// 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.Data;
+using System.Data.Common;
+using System.Data.SqlClient;
+
+namespace System.Data.SqlClient
+{
+       public class SqlCommandBuilder : DbCommandBuilder 
+       {
+               const string EXCEPTION_MESSAGE = "System.Data.SqlClient.SqlCommandBuilder is not supported on the current platform.";
+
+               public SqlCommandBuilder ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public SqlCommandBuilder (SqlDataAdapter adapter)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public static void DeriveParameters (SqlCommand command)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public SqlCommand GetDeleteCommand ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public SqlCommand GetInsertCommand ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public SqlCommand GetUpdateCommand ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public SqlCommand GetUpdateCommand (bool useColumnsForParameterNames)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public SqlCommand GetDeleteCommand (bool useColumnsForParameterNames)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public SqlCommand GetInsertCommand (bool useColumnsForParameterNames)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override string QuoteIdentifier (string unquotedIdentifier)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override string UnquoteIdentifier (string quotedIdentifier)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               protected override void ApplyParameterInfo (DbParameter parameter, DataRow datarow, StatementType statementType, bool whereClause)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               protected override string GetParameterName (int parameterOrdinal)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               protected override string GetParameterName (string parameterName)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               protected override string GetParameterPlaceholder (int parameterOrdinal)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               protected override void SetRowUpdatingHandler (DbDataAdapter adapter)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               protected override DataTable GetSchemaTable (DbCommand srcCommand)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               protected override DbCommand InitializeCommand (DbCommand command)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public SqlDataAdapter DataAdapter {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override string QuotePrefix {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override string QuoteSuffix {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override string CatalogSeparator {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override string SchemaSeparator {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override CatalogLocation CatalogLocation {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+       }
+}
index 9af24e650543168cb7543aee345b08dafcf815a9..ff5dc821d854f550cd59f6b5ab6be1db6207fb17 100644 (file)
@@ -138,7 +138,9 @@ namespace System.Data.SqlClient
 
                [DefaultValue ("")]
                [EditorAttribute ("Microsoft.VSDesigner.Data.SQL.Design.SqlConnectionStringEditor, "+ Consts.AssemblyMicrosoft_VSDesigner, "System.Drawing.Design.UITypeEditor, "+ Consts.AssemblySystem_Drawing )]
-               [RecommendedAsConfigurable (true)]
+#pragma warning disable 618 // ignore obsolete warning about RecommendedAsConfigurable to use SettingsBindableAttribute
+               [RecommendedAsConfigurable(true)]
+#pragma warning restore 618
                [RefreshProperties (RefreshProperties.All)]
                public override string ConnectionString {
                        get {
@@ -928,10 +930,22 @@ namespace System.Data.SqlClient
 
                                if (Client.Available <= 0)
                                        return -1; // Error
-                               IPEndPoint endpoint = new IPEndPoint (Dns.GetHostEntry ("localhost").AddressList [0], 0);
+
+                               IPEndPoint remoteEndpoint;
+                               switch (Client.AddressFamily) {
+                                       case AddressFamily.InterNetwork:
+                                               remoteEndpoint = new IPEndPoint(IPAddress.Any, 0);
+                                               break;
+                                       case AddressFamily.InterNetworkV6:
+                                               remoteEndpoint = new IPEndPoint(IPAddress.IPv6Any, 0);
+                                               break;
+                                       default:
+                                               return -1; // Error
+                               }
+
                                Byte [] rawrs;
 
-                               rawrs = Receive (ref endpoint);
+                               rawrs = Receive (ref remoteEndpoint);
 
                                string rs = Encoding.ASCII.GetString (rawrs);
 
diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlConnection.platformnotsupported.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlConnection.platformnotsupported.cs
new file mode 100644 (file)
index 0000000..bb35026
--- /dev/null
@@ -0,0 +1,214 @@
+//
+// SqlConnection.cs
+//
+// Author:
+//       Rolf Bjarne Kvinge <rolf@xamarin.com>
+//
+// Copyright (c) 2016 Xamarin, Inc.
+//
+// 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.Collections;
+using System.Data.Common;
+
+namespace System.Data.SqlClient
+{
+       public sealed class SqlConnection : DbConnection, IDbConnection, ICloneable
+       {
+               const string EXCEPTION_MESSAGE = "System.Data.SqlClient.SqlConnection is not supported on the current platform.";
+
+               public SqlConnection () : this (null)
+               {
+               }
+
+               public SqlConnection (string connectionString)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public SqlConnection (string connectionString, SqlCredential cred)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override string ConnectionString {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public SqlCredential Credentials {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public Guid ClientConnectionId {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override int ConnectionTimeout {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override string Database {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override string DataSource {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public int PacketSize {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override string ServerVersion {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override ConnectionState State {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public string WorkstationId {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public bool FireInfoMessageEventOnUserErrors {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public bool StatisticsEnabled {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               protected override DbProviderFactory DbProviderFactory {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public event SqlInfoMessageEventHandler InfoMessage;
+
+               public new SqlTransaction BeginTransaction ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public new SqlTransaction BeginTransaction (IsolationLevel iso)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public SqlTransaction BeginTransaction (string transactionName)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public SqlTransaction BeginTransaction (IsolationLevel iso, string transactionName)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override void ChangeDatabase (string database)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override void Close ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public new SqlCommand CreateCommand ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               protected override void Dispose (bool disposing)
+               {
+               }
+
+#if !MOBILE
+               public void EnlistDistributedTransaction (ITransaction transaction)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+#endif
+
+               object ICloneable.Clone ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               protected override DbTransaction BeginDbTransaction (IsolationLevel isolationLevel)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               protected override DbCommand CreateDbCommand ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override void Open ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override DataTable GetSchema ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override DataTable GetSchema (String collectionName)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override DataTable GetSchema (String collectionName, string [] restrictionValues)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public static void ChangePassword (string connectionString, string newPassword)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public static void ClearAllPools ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public static void ClearPool (SqlConnection connection)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public void ResetStatistics ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public IDictionary RetrieveStatistics ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+       }
+}
index 4877d434a20c62afb5eb11c4277b62ee74d70ea5..9cb4b8a6eeae73078ce759004903398213075241 100644 (file)
@@ -38,6 +38,8 @@ using Mono.Data.Tds.Protocol;
 using System;
 using System.IO;
 using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
 using System.Collections;
 using System.ComponentModel;
 using System.Data;
@@ -1426,6 +1428,25 @@ namespace System.Data.SqlClient
                        throw new NotImplementedException ();   
                }
 
+               override public Task<T> GetFieldValueAsync<T> (int i, CancellationToken cancellationToken)
+               {
+                       return base.GetFieldValueAsync<T> (i, cancellationToken);
+               }
+
+               override public Stream GetStream (int i)
+               {
+                       return base.GetStream (i);
+               }
+               override public TextReader GetTextReader (int i)
+               {
+                       return base.GetTextReader (i);
+               }
+
+               override public Task<bool> IsDBNullAsync (int i, CancellationToken cancellationToken)
+               {
+                       return base.IsDBNullAsync (i, cancellationToken);
+               }
+
                #endregion // Methods
        }
 }
diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlDataReader.platformnotsupported.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlDataReader.platformnotsupported.cs
new file mode 100644 (file)
index 0000000..395e97a
--- /dev/null
@@ -0,0 +1,363 @@
+//
+// SqlDataReader.cs
+//
+// Author:
+//       Rolf Bjarne Kvinge <rolf@xamarin.com>
+//
+// Copyright (c) 2016 Xamarin, Inc.
+//
+// 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;
+using System.Data.Common;
+using System.Data.SqlClient;
+using System.Data.SqlTypes;
+using System.Data;
+using System.IO;
+using System.Threading.Tasks;
+using System.Threading;
+using System.Xml;
+
+
+namespace System.Data.SqlClient
+{
+       public class SqlDataReader : DbDataReader , IDataReader, IDisposable, IDataRecord
+       {
+               const string EXCEPTION_MESSAGE = "System.Data.SqlClient.SqlDataReader is not supported on the current platform.";
+
+               SqlDataReader () {}
+
+               protected bool IsCommandBehavior (CommandBehavior condition)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override void Close ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override bool GetBoolean (int i)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override byte GetByte (int i)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override long GetBytes (int i, long dataIndex, byte [] buffer, int bufferIndex, int length)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override char GetChar (int i)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override long GetChars (int i, long dataIndex, char [] buffer, int bufferIndex, int length)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override string GetDataTypeName (int i)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override DateTime GetDateTime (int i)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public virtual DateTimeOffset GetDateTimeOffset (int i)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public virtual TimeSpan GetTimeSpan (int i)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public virtual SqlChars GetSqlChars (int i)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override Decimal GetDecimal (int i)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override Double GetDouble (int i)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override Type GetFieldType (int i)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override Single GetFloat (int i)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override Guid GetGuid (int i)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override short GetInt16 (int i)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override int GetInt32 (int i)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override long GetInt64 (int i)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override string GetName (int i)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override int GetOrdinal (string name)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override DataTable GetSchemaTable ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public virtual SqlBinary GetSqlBinary (int i)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public virtual SqlBoolean GetSqlBoolean (int i)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public virtual SqlByte GetSqlByte (int i)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public virtual SqlDateTime GetSqlDateTime (int i)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public virtual SqlDecimal GetSqlDecimal (int i)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public virtual SqlDouble GetSqlDouble (int i)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public virtual SqlGuid GetSqlGuid (int i)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public virtual SqlInt16 GetSqlInt16 (int i)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public virtual SqlInt32 GetSqlInt32 (int i)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public virtual SqlInt64 GetSqlInt64 (int i)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public virtual SqlMoney GetSqlMoney (int i)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public virtual SqlSingle GetSqlSingle (int i)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public virtual SqlString GetSqlString (int i)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public virtual SqlXml GetSqlXml (int i)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public virtual object GetSqlValue (int i)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public virtual int GetSqlValues (object [] values)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override string GetString (int i)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override object GetValue (int i)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override int GetValues (object [] values)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override IEnumerator GetEnumerator ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override bool IsDBNull (int i)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override bool NextResult ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override bool Read ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override Type GetProviderSpecificFieldType (int i)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override object GetProviderSpecificValue (int i)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override int GetProviderSpecificValues (object [] values)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public virtual SqlBytes GetSqlBytes (int i)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override T GetFieldValue<T> (int i)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public virtual XmlReader GetXmlReader (int i)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override Task<T> GetFieldValueAsync<T> (int i, CancellationToken cancellationToken)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override Stream GetStream (int i)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override TextReader GetTextReader (int i)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override Task<bool> IsDBNullAsync (int i, CancellationToken cancellationToken)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override int Depth {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override int FieldCount {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override bool IsClosed {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override object this [int i] {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override object this [string name] {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override int RecordsAffected {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override bool HasRows {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override int VisibleFieldCount {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               protected SqlConnection Connection {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+       }
+}
index 3962bf4f55c9fa193525a4f35a2e51b7d4a617d5..5cb920c0e9a0beaf226613ae01367810f81c3603 100644 (file)
@@ -65,8 +65,11 @@ namespace System.Data.SqlClient
                public bool HasChanges {
                        get { return true; }
                }
-               
+
+#pragma warning disable 0067
+               [MonoTODO]
                public event OnChangeEventHandler OnChange;
+#pragma warning restore
 
                [MonoTODO]
                public void AddCommandDependency(SqlCommand command)
diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlException.platformnotsupported.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlException.platformnotsupported.cs
new file mode 100644 (file)
index 0000000..24d102d
--- /dev/null
@@ -0,0 +1,102 @@
+//
+// SqlException.cs
+//
+// Author:
+//       Rolf Bjarne Kvinge <rolf@xamarin.com>
+//
+// Copyright (c) 2016 Xamarin, Inc.
+//
+// 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.Data.Common;
+using System.Data.SqlClient;
+using System.Runtime.Serialization;
+
+namespace System.Data.SqlClient
+{
+       public class SqlException : DbException 
+       {
+               const string EXCEPTION_MESSAGE = "System.Data.SqlClient.SqlException is not supported on the current platform.";
+
+               internal bool _doNotReconnect;
+
+               static internal SqlException CreateException(SqlErrorCollection errorCollection, string serverVersion)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               static internal SqlException CreateException(SqlErrorCollection errorCollection, string serverVersion, SqlInternalConnectionTds internalConnection, Exception innerException = null)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               static internal SqlException CreateException(SqlErrorCollection errorCollection, string serverVersion, Guid conId, Exception innerException = null)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               SqlException () {}
+
+               public override void GetObjectData (SerializationInfo si, StreamingContext context)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public byte Class {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public Guid ClientConnectionId {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public SqlErrorCollection Errors {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public int LineNumber {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override string Message {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public int Number {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public string Procedure {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public string Server {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override string Source {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public byte State {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+       }
+}
index f6153fb60b55074b71511c3baae109d00f466b7f..33531b7c1fff5de910f931d1aa6f872d8e67bd04 100644 (file)
@@ -361,13 +361,13 @@ namespace System.Data.SqlClient {
                }
 
                [DefaultValue (0)]
-               public byte Precision {
+               public new byte Precision {
                        get { return metaParameter.Precision; }
                        set { metaParameter.Precision = value; }
                }
 
                [DefaultValue (0)]
-               public byte Scale {
+               public new byte Scale {
                        get { return metaParameter.Scale; }
                        set { metaParameter.Scale = value; }
                }
diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlParameter.platformnotsupported.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlParameter.platformnotsupported.cs
new file mode 100644 (file)
index 0000000..79f6f95
--- /dev/null
@@ -0,0 +1,198 @@
+//
+// SqlParameter.cs
+//
+// Author:
+//       Rolf Bjarne Kvinge <rolf@xamarin.com>
+//
+// Copyright (c) 2016 Xamarin, Inc.
+//
+// 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.Data;
+using System.Data.Common;
+using System.Data.SqlTypes;
+
+namespace System.Data.SqlClient
+{
+       public class SqlParameter : DbParameter , IDbDataParameter, IDataParameter, ICloneable
+       {
+               const string EXCEPTION_MESSAGE = "System.Data.SqlClient.SqlParameter is not supported on the current platform.";
+
+               public SqlParameter ()
+                       : this (String.Empty, SqlDbType.NVarChar, 0, ParameterDirection.Input, false, 0, 0, String.Empty, DataRowVersion.Current, null)
+               {
+               }
+
+               public SqlParameter (string parameterName, object value)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public SqlParameter (string parameterName, SqlDbType dbType) 
+                       : this (parameterName, dbType, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, null)
+               {
+               }
+
+               public SqlParameter (string parameterName, SqlDbType dbType, int size) 
+                       : this (parameterName, dbType, size, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, null)
+               {
+               }
+
+               public SqlParameter (string parameterName, SqlDbType dbType, int size, string sourceColumn) 
+                       : this (parameterName, dbType, size, ParameterDirection.Input, false, 0, 0, sourceColumn, DataRowVersion.Current, null)
+               {
+               }
+
+               public SqlParameter (string parameterName, SqlDbType dbType, int size, ParameterDirection direction, bool isNullable, byte precision, byte scale, string sourceColumn, DataRowVersion sourceVersion, object value) 
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public SqlParameter (string parameterName, SqlDbType dbType, int size, ParameterDirection direction, byte precision, byte scale, string sourceColumn, DataRowVersion sourceVersion, bool sourceColumnNullMapping, Object value, string xmlSchemaCollectionDatabase, string xmlSchemaCollectionOwningSchema, string xmlSchemaCollectionName)
+                       : this (parameterName, dbType, size, direction, false, precision, scale, sourceColumn, sourceVersion, value)
+               {
+               }
+
+               public override string ToString ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override void ResetDbType ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public void ResetSqlDbType ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override DbType DbType {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override ParameterDirection Direction {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override bool IsNullable {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public int Offset {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override string ParameterName {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public byte Precision {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public byte Scale {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override int Size {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override string SourceColumn {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override DataRowVersion SourceVersion {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public SqlDbType SqlDbType {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override object Value {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public SqlCompareOptions CompareInfo {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public int LocaleId {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public object SqlValue {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override bool SourceColumnNullMapping {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public string XmlSchemaCollectionDatabase {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public string XmlSchemaCollectionName {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public string XmlSchemaCollectionOwningSchema {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public string UdtTypeName {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public string TypeName {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               object ICloneable.Clone ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+       }
+}
diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlParameterCollection.platformnotsupported.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlParameterCollection.platformnotsupported.cs
new file mode 100644 (file)
index 0000000..cc3a6ab
--- /dev/null
@@ -0,0 +1,216 @@
+//
+// SqlParameterCollection.cs
+//
+// Author:
+//       Rolf Bjarne Kvinge <rolf@xamarin.com>
+//
+// Copyright (c) 2016 Xamarin, Inc.
+//
+// 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;
+using System.Data;
+using System.Data.Common;
+using System.Data.SqlClient;
+
+namespace System.Data.SqlClient
+{
+       public class SqlParameterCollection : DbParameterCollection , IDataParameterCollection, IList, ICollection, IEnumerable
+       {
+               const string EXCEPTION_MESSAGE = "System.Data.SqlClient.SqlParameterCollection is not supported on the current platform.";
+
+               SqlParameterCollection () {}
+
+               protected override DbParameter GetParameter (int index)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               protected override DbParameter GetParameter (string parameterName)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               protected override void SetParameter (int index, DbParameter value)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               protected override void SetParameter (string parameterName, DbParameter value)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override int Add (object value)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public SqlParameter Add (SqlParameter value)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public SqlParameter Add (string parameterName, object value)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public SqlParameter AddWithValue (string parameterName, object value)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public SqlParameter Add (string parameterName, SqlDbType sqlDbType)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public SqlParameter Add (string parameterName, SqlDbType sqlDbType, int size)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public SqlParameter Add (string parameterName, SqlDbType sqlDbType, int size, string sourceColumn)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override void Clear ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override bool Contains (object value)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override bool Contains (string value)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public bool Contains (SqlParameter value)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override void CopyTo (Array array, int index)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override IEnumerator GetEnumerator ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override int IndexOf (object value)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override int IndexOf (string parameterName)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public int IndexOf (SqlParameter value)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override void Insert (int index, object value)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public void Insert (int index, SqlParameter value)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override void Remove (object value)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public void Remove (SqlParameter value)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override void RemoveAt (int index)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override void RemoveAt (string parameterName)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override void AddRange (Array values)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public void AddRange (SqlParameter [] values)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public void CopyTo (SqlParameter [] array, int index)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override int Count {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override bool IsFixedSize {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override bool IsReadOnly {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override bool IsSynchronized {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override object SyncRoot {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public SqlParameter this [int index] {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public SqlParameter this [string parameterName] {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+       }
+}
diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlTransaction.platformnotsupported.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlTransaction.platformnotsupported.cs
new file mode 100644 (file)
index 0000000..880b740
--- /dev/null
@@ -0,0 +1,77 @@
+//
+// SqlTransaction.cs
+//
+// Author:
+//       Rolf Bjarne Kvinge <rolf@xamarin.com>
+//
+// Copyright (c) 2016 Xamarin, Inc.
+//
+// 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.Data;
+using System.Data.Common;
+using System.Data.SqlClient;
+
+namespace System.Data.SqlClient
+{
+       public class SqlTransaction : DbTransaction , IDbTransaction, IDisposable
+       {
+               const string EXCEPTION_MESSAGE = "System.Data.SqlClient.SqlTransaction is not supported on the current platform.";
+
+               SqlTransaction () {}
+
+               public override void Commit ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               protected override void Dispose (bool disposing)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override void Rollback ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public void Rollback (string transactionName)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public void Save (string savePointName)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public SqlConnection Connection {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override IsolationLevel IsolationLevel {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               protected override DbConnection DbConnection {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+       }
+}
index 3749af5091222bf0b8dce37071dbb1a947749f3f..a8974949973e3fc8afcd95fc9b88c3a91b5f588e 100644 (file)
@@ -96,10 +96,14 @@ namespace MonoTests.System.Data.Common
                        try {
                                da.AddToBatch (new SqlCommand ());
                                Assert.Fail ("#1");
+#if FEATURE_NO_BSD_SOCKETS
+                       } catch (PlatformNotSupportedException) {
+#else
                        } catch (NotSupportedException ex) {
                                Assert.AreEqual (typeof (NotSupportedException), ex.GetType (), "#2");
                                Assert.IsNull (ex.InnerException, "#3");
                                Assert.IsNotNull (ex.Message, "#4");
+#endif
                        }
                }
 
index 20d5c1ab0bf41c9e87f2eb16d793df4693eb67fe..ff7ebcbe0c4358ba1fd7e16beaf28bb15975c929 100644 (file)
@@ -61,7 +61,6 @@ namespace MonoTests.System.Data.Common
                {
                }
 
-               #if NET_4_5
                [Test]
                public void GetFieldValueTest ()
                {
@@ -155,7 +154,6 @@ namespace MonoTests.System.Data.Common
                        Assert.IsFalse (dataReader.Read (), "#5");
                }
 
-               #endif //NET_4_5
        }
 }
 
index b65ba7abab6fdd5c63cd9118676cf9393fc4f524..4fbbbbefe4aa6eb41f5da888b4026a4a4da4b09f 100644 (file)
@@ -39,21 +39,33 @@ namespace MonoTests.System.Data.SqlClient {
                private const string testFailParamNameMessage = "We have to provide the same parameter name as in original .NET";
                
                [Test] // .ctor(SqlConnection connection)
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
                [ExpectedException (typeof(ArgumentNullException))]
+#endif
                public void ConstructorNotNull1 ()
                {
                        new SqlBulkCopy ((SqlConnection)null);
                }
                
                [Test] // .ctor(string connectionString)
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
                [ExpectedException (typeof(ArgumentNullException))]
+#endif
                public void ConstructorNotNull2 ()
                {
                        new SqlBulkCopy ((string)null);
                }
                
                [Test] // .ctor(SqlConnection connection)
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
                [ExpectedException (typeof(ArgumentNullException))]
+#endif
                public void ConstructorNotNull3 ()
                {
                        try {
@@ -65,7 +77,11 @@ namespace MonoTests.System.Data.SqlClient {
                }
                
                [Test] // .ctor(string connectionString)
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
                [ExpectedException (typeof(ArgumentNullException))]
+#endif
                public void ConstructorNotNull4 ()
                {
                        try {
@@ -77,7 +93,11 @@ namespace MonoTests.System.Data.SqlClient {
                }
                
                [Test] // .ctor(string connectionString)
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
                [ExpectedException (typeof(ArgumentNullException))]
+#endif
                public void ConstructorNotNull5 ()
                {
                        try {
@@ -89,7 +109,11 @@ namespace MonoTests.System.Data.SqlClient {
                }
                
                [Test] // .ctor(string connectionString)
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
                [ExpectedException (typeof(ArgumentNullException))]
+#endif
                public void ConstructorNotNull6 ()
                {
                        try {
index c2d788bd3f54d734c82e581e0f6905f6cadd77e5..49abd6064dcead039e99b1450d308127e8f71086 100644 (file)
@@ -38,6 +38,9 @@ namespace MonoTests.System.Data.Odbc
        public class SqlCommandBuilderTest
        {
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void CatalogLocationTest ()
                {
                        SqlCommandBuilder cb = new SqlCommandBuilder ();
@@ -47,6 +50,9 @@ namespace MonoTests.System.Data.Odbc
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void CatalogLocation_Value_Invalid ()
                {
                        SqlCommandBuilder cb = new SqlCommandBuilder ();
@@ -82,6 +88,9 @@ namespace MonoTests.System.Data.Odbc
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void CatalogSeparator ()
                {
                        SqlCommandBuilder cb = new SqlCommandBuilder ();
@@ -89,6 +98,9 @@ namespace MonoTests.System.Data.Odbc
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void CatalogSeparator_Value_Invalid ()
                {
                        string [] separators = new string [] {
@@ -118,6 +130,9 @@ namespace MonoTests.System.Data.Odbc
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void ConflictOptionTest ()
                {
                        SqlCommandBuilder cb = new SqlCommandBuilder ();
@@ -127,6 +142,9 @@ namespace MonoTests.System.Data.Odbc
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void ConflictOption_Value_Invalid ()
                {
                        SqlCommandBuilder cb = new SqlCommandBuilder ();
@@ -147,6 +165,9 @@ namespace MonoTests.System.Data.Odbc
                }
 
                [Test] // QuoteIdentifier (String)
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void QuoteIdentifier ()
                {
                        SqlCommandBuilder cb;
@@ -173,6 +194,9 @@ namespace MonoTests.System.Data.Odbc
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void QuoteIdentifier_PrefixSuffix_NoMatch ()
                {
                        SqlCommandBuilder cb;
@@ -211,6 +235,9 @@ namespace MonoTests.System.Data.Odbc
                }
 
                [Test] // QuoteIdentifier (String)
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void QuoteIdentifier_UnquotedIdentifier_Null ()
                {
                        SqlCommandBuilder cb = new SqlCommandBuilder ();
@@ -226,6 +253,9 @@ namespace MonoTests.System.Data.Odbc
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void QuotePrefix ()
                {
                        SqlCommandBuilder cb = new SqlCommandBuilder ();
@@ -240,6 +270,9 @@ namespace MonoTests.System.Data.Odbc
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void QuotePrefix_Value_Invalid ()
                {
                        string [] prefixes = new string [] {
@@ -268,6 +301,9 @@ namespace MonoTests.System.Data.Odbc
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void QuoteSuffix ()
                {
                        SqlCommandBuilder cb = new SqlCommandBuilder ();
@@ -282,6 +318,9 @@ namespace MonoTests.System.Data.Odbc
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void QuoteSuffix_Value_Invalid ()
                {
                        string [] suffixes = new string [] {
@@ -310,6 +349,9 @@ namespace MonoTests.System.Data.Odbc
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void SchemaSeparator ()
                {
                        SqlCommandBuilder cb = new SqlCommandBuilder ();
@@ -319,6 +361,9 @@ namespace MonoTests.System.Data.Odbc
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void SchemaSeparator_Value_Invalid ()
                {
                        string [] separators = new string [] {
index d02532a45d9d0804d73ed5255084fda83cfcb1b8..be36ba383c1bcf6fec1d5d15b7f04d057c365e7d 100644 (file)
@@ -42,6 +42,9 @@ namespace MonoTests.System.Data.SqlClient
                const string COMMAND_TEXT = "SELECT * FROM Authors";
 
                [Test] // SqlCommand ()
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Constructor1 ()
                {
                        SqlCommand cmd = new SqlCommand ();
@@ -61,6 +64,9 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test] // SqlCommand (string)
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Constructor2 ()
                {
                        SqlCommand cmd = new SqlCommand (COMMAND_TEXT);
@@ -95,6 +101,9 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test] // SqlCommand (string, SqlConnection)
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Constructor3 ()
                {
                        SqlConnection conn = new SqlConnection ();
@@ -147,6 +156,9 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test] // SqlCommand (string, SqlConnection, SqlTransaction)
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Constructor4 ()
                {
                        SqlConnection conn = new SqlConnection ();
@@ -199,6 +211,9 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Clone ()
                {
                        SqlNotificationRequest notificationReq = new SqlNotificationRequest ();
@@ -237,6 +252,9 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void CommandText ()
                {
                        SqlCommand cmd = new SqlCommand ();
@@ -251,6 +269,9 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void CommandTimeout ()
                {
                        SqlCommand cmd = new SqlCommand ();
@@ -263,6 +284,9 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void CommandTimeout_Value_Negative ()
                {
                        SqlCommand cmd = new SqlCommand ();
@@ -279,6 +303,9 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void CommandType_Value_Invalid ()
                {
                        SqlCommand cmd = new SqlCommand ();
@@ -296,6 +323,9 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test] // bug #324386
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Dispose ()
                {
                        string connectionString = "Initial Catalog=a;Server=b;User ID=c;"
@@ -307,6 +337,9 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void ExecuteNonQuery_Connection_Closed ()
                {
                        string connectionString = "Initial Catalog=a;Server=b;User ID=c;"
@@ -329,6 +362,9 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void ExecuteNonQuery_Connection_Null ()
                {
                        SqlCommand cmd = new SqlCommand ("delete from whatever");
@@ -346,6 +382,9 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void ExecuteReader_Connection_Closed ()
                {
                        string connectionString = "Initial Catalog=a;Server=b;User ID=c;"
@@ -368,6 +407,9 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void ExecuteReader_Connection_Null ()
                {
                        SqlCommand cmd = new SqlCommand ("select * from whatever");
@@ -385,6 +427,9 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void ExecuteScalar_Connection_Closed ()
                {
                        string connectionString = "Initial Catalog=a;Server=b;User ID=c;"
@@ -407,6 +452,9 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test] // bug #412584
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void ExecuteScalar_Connection_Null ()
                {
                        SqlCommand cmd = new SqlCommand ("select count(*) from whatever");
@@ -425,6 +473,9 @@ namespace MonoTests.System.Data.SqlClient
 
                // FIXME: this actually doesn't match .NET behavior. It shouldn't throw NRE.
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Prepare_Connection_Null ()
                {
                        SqlCommand cmd;
@@ -477,6 +528,9 @@ namespace MonoTests.System.Data.SqlClient
                }
                
                [Test] // bug #412586
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Prepare_Connection_Closed ()
                {
                        string connectionString = "Initial Catalog=a;Server=b;User ID=c;"
@@ -527,6 +581,9 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void ResetCommandTimeout ()
                {
                        SqlCommand cmd = new SqlCommand ();
@@ -537,6 +594,9 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void UpdatedRowSource ()
                {
                        SqlCommand cmd = new SqlCommand ();
@@ -547,6 +607,9 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void UpdatedRowSource_Value_Invalid ()
                {
                        SqlCommand cmd = new SqlCommand ();
@@ -565,6 +628,9 @@ namespace MonoTests.System.Data.SqlClient
 
 
                [Test] // bug #381100
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void ParameterCollectionTest ()
                {
                        SqlCommand cmd = new SqlCommand();
index 04a4b99871cc8f8af14614167cb6f3e35482eb5a..9511be24f7535375f8298d0c559a174d70452296 100644 (file)
@@ -39,6 +39,9 @@ namespace MonoTests.System.Data.SqlClient
        public class SqlConnectionTest\r
        {\r
                [Test] // SqlConnection ()\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
                public void Constructor1 ()\r
                {\r
                        SqlConnection cn = new SqlConnection ();\r
@@ -57,6 +60,9 @@ namespace MonoTests.System.Data.SqlClient
                }\r
 \r
                [Test] // SqlConnection (string)\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
                public void Constructor2 ()\r
                {\r
                        string connectionString = "server=SQLSRV; database=Mono;";\r
@@ -89,6 +95,9 @@ namespace MonoTests.System.Data.SqlClient
                }\r
 \r
                [Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
                public void Constructor2_ConnectionString_Invalid ()\r
                {\r
                        try {\r
@@ -181,6 +190,9 @@ namespace MonoTests.System.Data.SqlClient
                }\r
 \r
                [Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
                public void BeginTransaction_Connection_Closed ()\r
                {\r
                        SqlConnection cn = new SqlConnection ();\r
@@ -247,6 +259,9 @@ namespace MonoTests.System.Data.SqlClient
                }\r
 \r
                [Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
                public void ChangeDatabase_Connection_Closed ()\r
                {\r
                        SqlConnection cn = new SqlConnection ();\r
@@ -264,6 +279,9 @@ namespace MonoTests.System.Data.SqlClient
                }\r
 \r
                [Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
                public void ChangePassword_ConnectionString_Empty ()\r
                {\r
                        try {\r
@@ -279,6 +297,9 @@ namespace MonoTests.System.Data.SqlClient
                }\r
 \r
                [Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
                public void ChangePassword_ConnectionString_Null ()\r
                {\r
                        try {\r
@@ -293,7 +314,10 @@ namespace MonoTests.System.Data.SqlClient
                        }\r
                }\r
 \r
-               [Test]\r
+               \r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
                public void ChangePassword_NewPassword_Empty ()\r
                {\r
                        try {\r
@@ -309,6 +333,9 @@ namespace MonoTests.System.Data.SqlClient
                }\r
 \r
                [Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
                public void ChangePassword_NewPassword_ExceedMaxLength ()\r
                {\r
                        try {\r
@@ -328,6 +355,9 @@ namespace MonoTests.System.Data.SqlClient
                }\r
 \r
                [Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
                public void ChangePassword_NewPassword_Null ()\r
                {\r
                        try {\r
@@ -343,6 +373,9 @@ namespace MonoTests.System.Data.SqlClient
                }\r
 \r
                [Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
                public void ClearPool_Connection_Null ()\r
                {\r
                        try {\r
@@ -357,6 +390,9 @@ namespace MonoTests.System.Data.SqlClient
                }\r
 \r
                [Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
                public void ConnectionString ()\r
                {\r
                        SqlConnection cn = new SqlConnection ();\r
@@ -371,6 +407,9 @@ namespace MonoTests.System.Data.SqlClient
                }\r
 \r
                [Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
                public void ConnectionString_Value_Invalid ()\r
                {\r
                        SqlConnection cn = new SqlConnection ();\r
@@ -403,6 +442,9 @@ namespace MonoTests.System.Data.SqlClient
                }\r
 \r
                [Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
                public void CreateCommand ()\r
                {\r
                        SqlConnection cn = new SqlConnection ();\r
@@ -424,6 +466,9 @@ namespace MonoTests.System.Data.SqlClient
                }\r
 \r
                [Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
                public void Dispose ()\r
                {\r
                        SqlConnection cn = new SqlConnection ("Server=SQLSRV;Database=master;Timeout=25;Packet Size=512;Workstation ID=DUMMY");\r
@@ -443,6 +488,9 @@ namespace MonoTests.System.Data.SqlClient
                }\r
 \r
                [Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
                public void GetSchema_Connection_Closed ()\r
                {\r
                        SqlConnection cn = new SqlConnection ();\r
@@ -519,6 +567,9 @@ namespace MonoTests.System.Data.SqlClient
                }\r
 \r
                [Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
                public void ConnectionString_AsynchronousProcessing ()\r
                {\r
                        SqlConnection cn = new SqlConnection ();\r
@@ -527,6 +578,9 @@ namespace MonoTests.System.Data.SqlClient
                }\r
 \r
                [Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
                public void ConnectionString_ConnectTimeout ()\r
                {\r
                        SqlConnection cn = new SqlConnection ();\r
@@ -543,6 +597,9 @@ namespace MonoTests.System.Data.SqlClient
                }\r
 \r
                [Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
                public void ConnectionString_ConnectTimeout_Invalid ()\r
                {\r
                        SqlConnection cn = new SqlConnection ();\r
@@ -600,6 +657,9 @@ namespace MonoTests.System.Data.SqlClient
                }\r
 \r
                [Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
                public void ConnectionString_Database_Synonyms ()\r
                {\r
                        SqlConnection cn = null;\r
@@ -614,6 +674,9 @@ namespace MonoTests.System.Data.SqlClient
                }\r
 \r
                [Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
                public void ConnectionString_DataSource_Synonyms ()\r
                {\r
                        SqlConnection cn = null;\r
@@ -640,6 +703,9 @@ namespace MonoTests.System.Data.SqlClient
                }\r
 \r
                [Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
                public void ConnectionString_MaxPoolSize ()\r
                {\r
                        SqlConnection cn = new SqlConnection ();\r
@@ -649,6 +715,9 @@ namespace MonoTests.System.Data.SqlClient
                }\r
 \r
                [Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
                public void ConnectionString_MaxPoolSize_Invalid ()\r
                {\r
                        SqlConnection cn = new SqlConnection ();\r
@@ -733,6 +802,9 @@ namespace MonoTests.System.Data.SqlClient
                }\r
 \r
                [Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
                public void ConnectionString_MinPoolSize ()\r
                {\r
                        SqlConnection cn = new SqlConnection ();\r
@@ -742,6 +814,9 @@ namespace MonoTests.System.Data.SqlClient
                }\r
 \r
                [Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
                public void ConnectionString_MinPoolSize_Invalid ()\r
                {\r
                        SqlConnection cn = new SqlConnection ();\r
@@ -799,6 +874,9 @@ namespace MonoTests.System.Data.SqlClient
                }\r
 \r
                [Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
                public void ConnectionString_MultipleActiveResultSets ()\r
                {\r
                        SqlConnection cn = new SqlConnection ();\r
@@ -806,6 +884,9 @@ namespace MonoTests.System.Data.SqlClient
                }\r
 \r
                [Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
                public void ConnectionString_MultipleActiveResultSets_Invalid ()\r
                {\r
                        SqlConnection cn = new SqlConnection ();\r
@@ -823,6 +904,9 @@ namespace MonoTests.System.Data.SqlClient
                }\r
 \r
                [Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
                public void ConnectionString_NetworkLibrary_Synonyms ()\r
                {\r
                        SqlConnection cn = new SqlConnection ();\r
@@ -832,6 +916,9 @@ namespace MonoTests.System.Data.SqlClient
                }\r
 \r
                [Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
                public void ConnectionString_PacketSize ()\r
                {\r
                        SqlConnection cn = new SqlConnection ();\r
@@ -848,6 +935,9 @@ namespace MonoTests.System.Data.SqlClient
                }\r
 \r
                [Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
                public void ConnectionString_PacketSize_Invalid ()\r
                {\r
                        SqlConnection cn = new SqlConnection ();\r
@@ -901,6 +991,9 @@ namespace MonoTests.System.Data.SqlClient
                }\r
 \r
                [Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
                public void ConnectionString_Password_Synonyms ()\r
                {\r
                        SqlConnection cn = new SqlConnection ();\r
@@ -909,6 +1002,9 @@ namespace MonoTests.System.Data.SqlClient
                }\r
 \r
                [Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
                public void ConnectionString_PersistSecurityInfo_Synonyms ()\r
                {\r
                        SqlConnection cn = new SqlConnection ();\r
@@ -917,6 +1013,9 @@ namespace MonoTests.System.Data.SqlClient
                }\r
 \r
                [Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
                public void ConnectionString_UserID_Synonyms ()\r
                {\r
                        SqlConnection cn = new SqlConnection ();\r
@@ -926,6 +1025,9 @@ namespace MonoTests.System.Data.SqlClient
                }\r
 \r
                [Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
                public void ConnectionString_UserInstance ()\r
                {\r
                        SqlConnection cn = new SqlConnection ();\r
@@ -933,6 +1035,9 @@ namespace MonoTests.System.Data.SqlClient
                }\r
 \r
                [Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
                public void ConnectionString_UserInstance_Invalid ()\r
                {\r
                        SqlConnection cn = new SqlConnection ();\r
@@ -950,6 +1055,9 @@ namespace MonoTests.System.Data.SqlClient
                }\r
 \r
                [Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
                public void ConnectionString_OtherKeywords ()\r
                {\r
                        SqlConnection cn = new SqlConnection ();\r
@@ -973,6 +1081,9 @@ namespace MonoTests.System.Data.SqlClient
                }\r
 \r
                [Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
                public void Open_ConnectionString_Empty ()\r
                {\r
                        SqlConnection cn = new SqlConnection ();\r
@@ -991,6 +1102,9 @@ namespace MonoTests.System.Data.SqlClient
                }\r
 \r
                [Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
                public void Open_ConnectionString_Null ()\r
                {\r
                        SqlConnection cn = new SqlConnection ();\r
@@ -1009,6 +1123,9 @@ namespace MonoTests.System.Data.SqlClient
                }\r
 \r
                [Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
                public void Open_ConnectionString_Whitespace ()\r
                {\r
                        SqlConnection cn = new SqlConnection ();\r
@@ -1027,6 +1144,9 @@ namespace MonoTests.System.Data.SqlClient
                }\r
 \r
                [Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
                public void ServerVersion_Connection_Closed ()\r
                {\r
                        SqlConnection cn = new SqlConnection ();\r
@@ -1051,3 +1171,4 @@ namespace MonoTests.System.Data.SqlClient
                }\r
        }\r
 }\r
+\r
index 301f62bf7f22efba750f3a3ac4cc9d7c46183bd3..3a8b619baa1bb64e0c1525c50bf271ee41f3b6c0 100644 (file)
@@ -63,6 +63,9 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test] // SqlDataAdapter (SqlCommand)
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Constructor2 ()
                {
                        SqlCommand cmd = new SqlCommand ();
@@ -109,6 +112,9 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test] // SqlDataAdapter (string, SqlConnection)
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Constructor3 ()
                {
                        string selectCommandText = "SELECT * FROM Authors";
@@ -137,6 +143,9 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test] // SqlDataAdapter (string, SqlConnection)
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Constructor3_SelectCommandText_Null ()
                {
                        SqlConnection selectConnection = new SqlConnection ();
@@ -165,6 +174,9 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test] // SqlDataAdapter (string, SqlConnection)
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Constructor3_SelectConnection_Null ()
                {
                        string selectCommandText = "SELECT * FROM Authors";
@@ -192,6 +204,9 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test] // SqlDataAdapter (string, string)]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Constructor4 ()
                {
                        string selectCommandText = "SELECT * FROM Authors";
@@ -221,6 +236,9 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test] // SqlDataAdapter (string, string)]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Constructor4_SelectCommandText_Null ()
                {
                        string selectConnectionString = "server=SQLSRV;database=Mono";
@@ -250,6 +268,9 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test] // SqlDataAdapter (string, string)]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Constructor4_SelectConnectionString_Null ()
                {
                        string selectCommandText = "SELECT * FROM Authors";
@@ -278,6 +299,9 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void DeleteCommand ()
                {
                        SqlDataAdapter da = new SqlDataAdapter ();
@@ -293,6 +317,9 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Dispose ()
                {
                        SqlDataAdapter da = new SqlDataAdapter ();
@@ -311,6 +338,9 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void InsertCommand ()
                {
                        SqlDataAdapter da = new SqlDataAdapter ();
@@ -326,6 +356,9 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void SelectCommand ()
                {
                        SqlDataAdapter da = new SqlDataAdapter ();
@@ -369,6 +402,9 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void UpdateCommand ()
                {
                        SqlDataAdapter da = new SqlDataAdapter ();
index 27e6fd1bf4ad9b4a5a884af737c5581aba5d4a71..e2048cfb9baf86b0b814c3a06f73248d0559cb1a 100644 (file)
@@ -45,6 +45,9 @@ namespace MonoTests.System.Data.SqlClient
        public class SqlParameterTest
        {
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Constructor1 ()
                {
                        SqlParameter p = new SqlParameter ();
@@ -68,6 +71,9 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Constructor2_Value_DateTime ()
                {
                        DateTime value = new DateTime (2004, 8, 24);
@@ -94,6 +100,9 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Constructor2_Value_DBNull ()
                {
                        SqlParameter p = new SqlParameter ("address", DBNull.Value);
@@ -118,6 +127,9 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Constructor2_Value_Null ()
                {
                        SqlParameter p = new SqlParameter ("address", (Object) null);
@@ -141,6 +153,9 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test] // .ctor (String, SqlDbType, Int32, ParameterDirection, Byte, Byte, String, DataRowVersion, Boolean, Object, String, String, String)
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Constructor7 ()
                {
                        SqlParameter p1 = new SqlParameter ("p1Name", SqlDbType.VarChar, 20,
@@ -167,6 +182,9 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void CompareInfo ()
                {
                        SqlParameter parameter = new SqlParameter ();
@@ -176,6 +194,9 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void InferType_Byte ()
                {
                        Byte value = 0x0a;
@@ -187,6 +208,9 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void InferType_ByteArray ()
                {
                        Byte [] value = new Byte [] { 0x0a, 0x0d };
@@ -289,6 +313,9 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void InferType_DateTime ()
                {
                        DateTime value;
@@ -314,6 +341,9 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void InferType_Decimal ()
                {
                        Decimal value;
@@ -339,6 +369,9 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void InferType_Double ()
                {
                        Double value;
@@ -364,6 +397,9 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void InferType_Enum ()
                {
                        SqlParameter param;
@@ -380,6 +416,9 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void InferType_Guid ()
                {
                        Guid value = Guid.NewGuid ();
@@ -391,6 +430,9 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void InferType_Int16 ()
                {
                        Int16 value;
@@ -416,6 +458,9 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void InferType_Int32 ()
                {
                        Int32 value;
@@ -441,6 +486,9 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void InferType_Int64 ()
                {
                        Int64 value;
@@ -506,6 +554,9 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void InferType_Object ()
                {
                        Object value = new Object ();
@@ -517,6 +568,9 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void InferType_Single ()
                {
                        Single value = Single.MaxValue;
@@ -528,6 +582,9 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void InferType_String ()
                {
                        String value = "some text";
@@ -551,6 +608,9 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void LocaleId ()
                {
                        SqlParameter parameter = new SqlParameter ();
@@ -560,6 +620,9 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test] // bug #320196
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void ParameterNullTest ()
                {
                        SqlParameter param = new SqlParameter ("param", SqlDbType.Decimal);
@@ -574,6 +637,9 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void ParameterType ()
                {
                        SqlParameter p;
@@ -632,6 +698,9 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void InferType_Boolean ()
                {
                        Boolean value;
@@ -651,6 +720,9 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void ParameterName ()
                {
                        SqlParameter p = new SqlParameter ();
@@ -676,6 +748,9 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void ResetDbType ()
                {
                        SqlParameter p;
@@ -739,6 +814,9 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void ResetSqlDbType ()
                {
                        //Parameter with an assigned value but no SqlDbType specified
@@ -779,6 +857,9 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void SourceColumn ()
                {
                        SqlParameter p = new SqlParameter ();
@@ -804,6 +885,9 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void SourceColumnNullMapping ()
                {
                        SqlParameter p = new SqlParameter ();
@@ -815,6 +899,9 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void SqlDbTypeTest ()
                {
                        SqlParameter p = new SqlParameter ("zipcode", 3510);
@@ -829,6 +916,9 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void SqlDbTypeTest_Value_Invalid ()
                {
                        SqlParameter p = new SqlParameter ("zipcode", 3510);
@@ -847,6 +937,9 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void SqlValue ()
                {
                        SqlParameter parameter = new SqlParameter ();
@@ -970,6 +1063,9 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void SqlTypes_SqlBinary ()
                {
                        SqlParameter parameter;
@@ -995,6 +1091,9 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void SqlTypes_SqlBoolean ()
                {
                        SqlParameter parameter;
@@ -1020,6 +1119,9 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void SqlTypes_SqlByte ()
                {
                        SqlParameter parameter;
@@ -1107,6 +1209,9 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void SqlTypes_SqlDateTime ()
                {
                        SqlParameter parameter;
@@ -1132,6 +1237,9 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void SqlTypes_SqlDecimal ()
                {
                        SqlParameter parameter;
@@ -1157,6 +1265,9 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void SqlTypes_SqlDouble ()
                {
                        SqlParameter parameter;
@@ -1182,6 +1293,9 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void SqlTypes_SqlGuid ()
                {
                        SqlParameter parameter;
@@ -1207,6 +1321,9 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void SqlTypes_SqlInt16 ()
                {
                        SqlParameter parameter;
@@ -1232,6 +1349,9 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void SqlTypes_SqlInt32 ()
                {
                        SqlParameter parameter;
@@ -1257,6 +1377,9 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void SqlTypes_SqlInt64 ()
                {
                        SqlParameter parameter;
@@ -1282,6 +1405,9 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void SqlTypes_SqlMoney ()
                {
                        SqlParameter parameter;
@@ -1307,6 +1433,9 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void SqlTypes_SqlSingle ()
                {
                        SqlParameter parameter;
@@ -1332,6 +1461,9 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void SqlTypes_SqlString ()
                {
                        SqlParameter parameter;
@@ -1357,6 +1489,9 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void SqlTypes_SqlXml ()
                {
                        SqlParameter parameter;
@@ -1386,6 +1521,9 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Value ()
                {
                        SqlParameter p;
@@ -1429,6 +1567,9 @@ namespace MonoTests.System.Data.SqlClient
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void XmlSchemaTest ()
                {
                        SqlParameter p1 = new SqlParameter ();
index 2fbdeb16c8ad740a5f0c178bec74bbcd05adc3e7..1357f253347fb5c49ff34958f600f70b6b374b9a 100644 (file)
@@ -34,9 +34,6 @@
 using NUnit.Framework;
 using System;
 using System.Data;
-#if !MOBILE
-using NUnit.Framework.SyntaxHelpers;
-#endif
 
 namespace MonoTests.System.Data
 {
index 2875dc0a1090f8bfa9dafb2ce0a061c0dcce8c15..37a12abcffdbe9947dd367e41a5d3e6b6483cde1 100644 (file)
@@ -34,9 +34,6 @@
 using NUnit.Framework;
 using System;
 using System.Data;
-#if !MOBILE
-using NUnit.Framework.SyntaxHelpers;
-#endif
 
 namespace MonoTests.System.Data
 {
index 7da3dca21f0b2db64186b45234732d8366561c5c..9ba7870e7e083ed90baebe989724d1a7c96515d0 100644 (file)
@@ -30,9 +30,6 @@
 using NUnit.Framework;
 using System;
 using System.Data;
-#if !MOBILE
-using NUnit.Framework.SyntaxHelpers;
-#endif
 
 namespace MonoTests.System.Data
 {
index 63d75f2c410a66a8f479cc1d57059168a7be79a3..f020a208e6f65e4e0c0eb416cf1aa587e7e4de4f 100644 (file)
@@ -34,9 +34,6 @@
 using NUnit.Framework;\r
 using System;\r
 using System.Data;\r
-#if !MOBILE\r
-using NUnit.Framework.SyntaxHelpers;\r
-#endif\r
 \r
 namespace MonoTests.System.Data\r
 {\r
old mode 100644 (file)
new mode 100755 (executable)
index 1993e7f..4412990
@@ -35,7 +35,6 @@ namespace MonoTests.System.Data
     [TestFixture]
     public class DataTableReadWriteXmlTest
     {
-        public static readonly string EOL = Environment.NewLine;
 
         void StandardizeXmlFormat(ref string xml)
         {
@@ -126,11 +125,11 @@ namespace MonoTests.System.Data
             // Get XML for DataSet writes.
             sw.GetStringBuilder().Length = 0;
             ds.WriteXml(sw);
-            string xmlDSNone = sw.ToString().Replace ("\n", EOL);
+            string xmlDSNone = sw.ToString();
             
             sw.GetStringBuilder().Length = 0;
             ds.WriteXml(sw, XmlWriteMode.DiffGram);
-            string xmlDSDiffGram = sw.ToString().Replace ("\n", EOL);
+            string xmlDSDiffGram = sw.ToString();
 
             sw.GetStringBuilder().Length = 0;
             ds.WriteXml(sw, XmlWriteMode.WriteSchema);
@@ -188,11 +187,11 @@ namespace MonoTests.System.Data
             
             sw.GetStringBuilder().Length = 0;
             ds.WriteXml(sw);
-            xmlDSNone = sw.ToString().Replace ("\n", EOL);
+            xmlDSNone = sw.ToString();
             
             sw.GetStringBuilder().Length = 0;
             ds.WriteXml(sw, XmlWriteMode.DiffGram);
-            xmlDSDiffGram = sw.ToString().Replace ("\n", EOL);
+            xmlDSDiffGram = sw.ToString();
 
             sw.GetStringBuilder().Length = 0;
             ds.WriteXml(sw, XmlWriteMode.WriteSchema);
old mode 100644 (file)
new mode 100755 (executable)
index 388f547..9d54c82
@@ -3236,7 +3236,6 @@ namespace MonoTests.System.Data
                        string TextString = GetNormalizedSchema (writer.ToString ());
                        //string TextString = writer.ToString ();
 
-                       EOL = "\n";
                        string substring = TextString.Substring (0, TextString.IndexOf (EOL));
                        TextString = TextString.Substring (TextString.IndexOf (EOL) + EOL.Length);
                        Assert.AreEqual ("<?xml version=\"1.0\" encoding=\"utf-16\"?>", substring, "test#01");
index 945b22a484c133f221f36a64228b248096e57777..2e2890b4ec5b303c526d81cb0062289831fd1a55 100644 (file)
@@ -40,7 +40,7 @@ using Microsoft.CSharp;
 namespace MonoTests.System.Data
 {
        [TestFixture]
-       public class TypedDataSetGeneratorTest : Assertion
+       public class TypedDataSetGeneratorTest
        {
                private ICodeGenerator gen;
                private ICodeCompiler compiler;
@@ -70,20 +70,20 @@ namespace MonoTests.System.Data
                public void TestGenerateIdName ()
                {
                
-                       AssertEquals ("#1", "a", TypedDataSetGenerator.GenerateIdName ("a", gen));
-                       AssertEquals ("#2", "_int", TypedDataSetGenerator.GenerateIdName ("int", gen));
-                       AssertEquals ("#3", "_", TypedDataSetGenerator.GenerateIdName ("_", gen));
-                       AssertEquals ("#3-2", "_", TypedDataSetGenerator.GenerateIdName ("_", gen));
-                       AssertEquals ("#4", "_1", TypedDataSetGenerator.GenerateIdName ("1", gen));
-                       AssertEquals ("#4-2", "_1", TypedDataSetGenerator.GenerateIdName ("1", gen));
-                       AssertEquals ("#5", "_1a", TypedDataSetGenerator.GenerateIdName ("1a", gen));
-                       AssertEquals ("#6", "_1_2", TypedDataSetGenerator.GenerateIdName ("1*2", gen));
-                       AssertEquals ("#7", "__", TypedDataSetGenerator.GenerateIdName ("-", gen));
-                       AssertEquals ("#8", "__", TypedDataSetGenerator.GenerateIdName ("+", gen));
-                       AssertEquals ("#9", "_", TypedDataSetGenerator.GenerateIdName ("", gen));
-                       AssertEquals ("#10", "___", TypedDataSetGenerator.GenerateIdName ("--", gen));
-                       AssertEquals ("#11", "___", TypedDataSetGenerator.GenerateIdName ("++", gen));
-                       AssertEquals ("#12", "\u3042", TypedDataSetGenerator.GenerateIdName ("\u3042", gen));
+                       Assert.AreEqual ("a", TypedDataSetGenerator.GenerateIdName ("a", gen), "#1");
+                       Assert.AreEqual ("_int", TypedDataSetGenerator.GenerateIdName ("int", gen), "#2");
+                       Assert.AreEqual ("_", TypedDataSetGenerator.GenerateIdName ("_", gen), "#3");
+                       Assert.AreEqual ("_", TypedDataSetGenerator.GenerateIdName ("_", gen), "#3-2");
+                       Assert.AreEqual ("_1", TypedDataSetGenerator.GenerateIdName ("1", gen), "#4");
+                       Assert.AreEqual ("_1", TypedDataSetGenerator.GenerateIdName ("1", gen), "#4-2");
+                       Assert.AreEqual ("_1a", TypedDataSetGenerator.GenerateIdName ("1a", gen), "#5");
+                       Assert.AreEqual ("_1_2", TypedDataSetGenerator.GenerateIdName ("1*2", gen), "#6");
+                       Assert.AreEqual ("__", TypedDataSetGenerator.GenerateIdName ("-", gen), "#7");
+                       Assert.AreEqual ("__", TypedDataSetGenerator.GenerateIdName ("+", gen), "#8");
+                       Assert.AreEqual ("_", TypedDataSetGenerator.GenerateIdName ("", gen), "#9");
+                       Assert.AreEqual ("___", TypedDataSetGenerator.GenerateIdName ("--", gen), "#10");
+                       Assert.AreEqual ("___", TypedDataSetGenerator.GenerateIdName ("++", gen), "#11");
+                       Assert.AreEqual ("\u3042", TypedDataSetGenerator.GenerateIdName ("\u3042", gen), "#12");
                }
 
                [Test]
@@ -98,7 +98,7 @@ namespace MonoTests.System.Data
                        ccu.Namespaces.Add (cns);
                        CompilerResults r = compiler.CompileAssemblyFromDom (
                                new CompilerParameters (), ccu);
-                       AssertEquals (0, r.Errors.Count);
+                       Assert.AreEqual (0, r.Errors.Count);
                }
        }
 }
index 2be7b264d09d432d6411966d0ded3330209fe21c..b1f4d2d1b7c6815e0cc5d0ffb3f2c2da69361597 100644 (file)
@@ -33,9 +33,6 @@
 using NUnit.Framework;
 using System;
 using System.Data;
-#if !MOBILE
-using NUnit.Framework.SyntaxHelpers;
-#endif
 
 namespace MonoTests.System.Data
 {
old mode 100644 (file)
new mode 100755 (executable)
index 053ecdb..93b0cc6
@@ -174,9 +174,9 @@ namespace MonoTests.System.Data.Xml
                        StringWriter sw = new StringWriter ();
                        XmlTextWriter xw = new XmlTextWriter (sw);
                        Doc.DataSet.WriteXml (xw);
-                       string s = sw.ToString ();
+                       string s = sw.ToString ().Replace ("\r", "").Replace ("\n", Environment.NewLine);
                        Assert.AreEqual (xml, s, "#1");
-                       Assert.AreEqual (xml, Doc.InnerXml, "#2");
+                       Assert.AreEqual (xml, Doc.InnerXml.Replace ("\r", "").Replace ("\n", Environment.NewLine), "#2");
                        Assert.AreEqual ("EndOfFile", Reader.ReadState.ToString (), "test#01");
 
                        DataSet Set = Doc.DataSet;
diff --git a/mcs/class/System.Data/Test/test-config-file b/mcs/class/System.Data/Test/test-config-file
new file mode 100644 (file)
index 0000000..8135637
--- /dev/null
@@ -0,0 +1,45 @@
+       <configSections>
+               <section name="system.data_test" 
+                       type="System.Data.Common.DbProviderFactoriesConfigurationHandler, System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
+               <section name="connectionStrings_test"
+                       type="System.Configuration.ConnectionStringsSection, System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
+       </configSections>
+       <system.data>
+               <DbProviderFactories>
+                       <add name="ProviderTest2.Name"
+                               invariant="ProviderTest2.InvariantName"
+                               support="FF"
+                               description="ProviderTest2.Description"
+                               type="ProviderTest2.AssemblyQualifiedName"/>
+               </DbProviderFactories>
+       </system.data>
+       <system.data_test>
+               <DbProviderFactories>
+                       <add name="ProviderTest3.Name"
+                               invariant="ProviderTest3.InvariantName"
+                               support="FF"
+                               description="ProviderTest3.Description"
+                               type="ProviderTest3.AssemblyQualifiedName"/>
+                       <clear />
+                       <add name="ProviderTest4.Name"
+                               invariant="ProviderTest4.InvariantName"
+                               support="FF"
+                               description="ProviderTest4.Description"
+                               type="ProviderTest4.AssemblyQualifiedName"/>
+                       <add name="ProviderTest5.Name"
+                               invariant="ProviderTest5.InvariantName"
+                               support="FF"
+                               description="ProviderTest5.Description"
+                               type="ProviderTest5.AssemblyQualifiedName"/>
+                       <remove invariant="ProviderTest5.InvariantName" />
+                       <add name="ProviderTest.Name"
+                               invariant="ProviderTest.InvariantName"
+                               support="FF"
+                               description="ProviderTest.Description"
+                               type="ProviderTest.AssemblyQualifiedName"/>
+               </DbProviderFactories>
+       </system.data_test>
+       <connectionStrings_test>
+               <add name="Publications" providerName="System.Data.SqlClient" 
+                       connectionString="Data Source=MyServer;Initial Catalog=pubs;integrated security=SSPI" />
+       </connectionStrings_test>
diff --git a/mcs/class/System.Data/app_test_mobile_static.config b/mcs/class/System.Data/app_test_mobile_static.config
deleted file mode 100644 (file)
index 4f31597..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<configuration>
-       <configSections>
-               <section name="system.data_test" 
-                       type="System.Data.Common.DbProviderFactoriesConfigurationHandler, System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
-               <section name="connectionStrings_test"
-                       type="System.Configuration.ConnectionStringsSection, System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
-       </configSections>
-       <system.data>
-               <DbProviderFactories>
-                       <add name="ProviderTest2.Name"
-                               invariant="ProviderTest2.InvariantName"
-                               support="FF"
-                               description="ProviderTest2.Description"
-                               type="ProviderTest2.AssemblyQualifiedName"/>
-               </DbProviderFactories>
-       </system.data>
-       <system.data_test>
-               <DbProviderFactories>
-                       <add name="ProviderTest3.Name"
-                               invariant="ProviderTest3.InvariantName"
-                               support="FF"
-                               description="ProviderTest3.Description"
-                               type="ProviderTest3.AssemblyQualifiedName"/>
-                       <clear />
-                       <add name="ProviderTest4.Name"
-                               invariant="ProviderTest4.InvariantName"
-                               support="FF"
-                               description="ProviderTest4.Description"
-                               type="ProviderTest4.AssemblyQualifiedName"/>
-                       <add name="ProviderTest5.Name"
-                               invariant="ProviderTest5.InvariantName"
-                               support="FF"
-                               description="ProviderTest5.Description"
-                               type="ProviderTest5.AssemblyQualifiedName"/>
-                       <remove invariant="ProviderTest5.InvariantName" />
-                       <add name="ProviderTest.Name"
-                               invariant="ProviderTest.InvariantName"
-                               support="FF"
-                               description="ProviderTest.Description"
-                               type="ProviderTest.AssemblyQualifiedName"/>
-               </DbProviderFactories>
-       </system.data_test>
-       <connectionStrings_test>
-               <add name="Publications" providerName="System.Data.SqlClient" 
-                       connectionString="Data Source=MyServer;Initial Catalog=pubs;integrated security=SSPI" />
-       </connectionStrings_test>
-</configuration>
diff --git a/mcs/class/System.Data/app_test_net_4_x.config b/mcs/class/System.Data/app_test_net_4_x.config
deleted file mode 100644 (file)
index 4f31597..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<configuration>
-       <configSections>
-               <section name="system.data_test" 
-                       type="System.Data.Common.DbProviderFactoriesConfigurationHandler, System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
-               <section name="connectionStrings_test"
-                       type="System.Configuration.ConnectionStringsSection, System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
-       </configSections>
-       <system.data>
-               <DbProviderFactories>
-                       <add name="ProviderTest2.Name"
-                               invariant="ProviderTest2.InvariantName"
-                               support="FF"
-                               description="ProviderTest2.Description"
-                               type="ProviderTest2.AssemblyQualifiedName"/>
-               </DbProviderFactories>
-       </system.data>
-       <system.data_test>
-               <DbProviderFactories>
-                       <add name="ProviderTest3.Name"
-                               invariant="ProviderTest3.InvariantName"
-                               support="FF"
-                               description="ProviderTest3.Description"
-                               type="ProviderTest3.AssemblyQualifiedName"/>
-                       <clear />
-                       <add name="ProviderTest4.Name"
-                               invariant="ProviderTest4.InvariantName"
-                               support="FF"
-                               description="ProviderTest4.Description"
-                               type="ProviderTest4.AssemblyQualifiedName"/>
-                       <add name="ProviderTest5.Name"
-                               invariant="ProviderTest5.InvariantName"
-                               support="FF"
-                               description="ProviderTest5.Description"
-                               type="ProviderTest5.AssemblyQualifiedName"/>
-                       <remove invariant="ProviderTest5.InvariantName" />
-                       <add name="ProviderTest.Name"
-                               invariant="ProviderTest.InvariantName"
-                               support="FF"
-                               description="ProviderTest.Description"
-                               type="ProviderTest.AssemblyQualifiedName"/>
-               </DbProviderFactories>
-       </system.data_test>
-       <connectionStrings_test>
-               <add name="Publications" providerName="System.Data.SqlClient" 
-                       connectionString="Data Source=MyServer;Initial Catalog=pubs;integrated security=SSPI" />
-       </connectionStrings_test>
-</configuration>
diff --git a/mcs/class/System.Data/monotouch_watch_System.Data.dll.exclude.sources b/mcs/class/System.Data/monotouch_watch_System.Data.dll.exclude.sources
new file mode 100644 (file)
index 0000000..2782624
--- /dev/null
@@ -0,0 +1,11 @@
+System.Data.SqlClient/SqlBulkCopy.cs
+System.Data.SqlClient/SqlCommand.cs
+System.Data.SqlClient/SqlCommandBuilder.cs
+System.Data.SqlClient/SqlConnection.cs
+System.Data.SqlClient/SqlDataReader.cs
+System.Data.SqlClient/SqlDecimalExtensions.cs
+System.Data.SqlClient/SqlException.cs
+System.Data.SqlClient/SqlParameter.cs
+System.Data.SqlClient/SqlParameterCollection.cs
+System.Data.SqlClient/SqlTransaction.cs
+System.Data.SqlClient/SqlXmlTextReader.cs
index bbc860b8cd783f47398a9a084950cde37d3e6221..f279aec80605393212efc69e5caf5703d0a8480c 100644 (file)
@@ -1 +1,10 @@
 #include mobile_System.Data.dll.sources
+System.Data.SqlClient/SqlBulkCopy.platformnotsupported.cs
+System.Data.SqlClient/SqlCommand.platformnotsupported.cs
+System.Data.SqlClient/SqlCommandBuilder.platformnotsupported.cs
+System.Data.SqlClient/SqlConnection.platformnotsupported.cs
+System.Data.SqlClient/SqlDataReader.platformnotsupported.cs
+System.Data.SqlClient/SqlException.platformnotsupported.cs
+System.Data.SqlClient/SqlParameter.platformnotsupported.cs
+System.Data.SqlClient/SqlParameterCollection.platformnotsupported.cs
+System.Data.SqlClient/SqlTransaction.platformnotsupported.cs
index bd40ae2f3a7c56941ed90529dd97837e421f365b..ca3f827e707e55166ec49106e6854a3f8d40b4e2 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 4750c28d29fd9972de0daaeb2c9f2953b2a77d46..898766badccef0d14240cd77b6e32d3b4eff420f 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 1248aef2a74f2e9efc3b889b2ace8dc482c994fe..eec7610ece0300d5774cc5a050e6c6a60198a5a6 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index f00cf92ef4e5efd6ec28760c9ff4d9341a24662d..6174a09878fa726cb00747d9ce8f2b5a10544f92 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 31cfc603485e3bc1bda074c53dc138df526d7e12..8ee4b099b920014dd786ec0c07c03478fc743fbb 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index cd5243850061ff0556e89678951c9837a4f8029a..a89191b814f2da54b812a595515c4175cb5b8bbb 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 00f54219c78c3923f771a72924af6a13a7a73d15..f46f7c3a73ef629983676940537673a87286abd6 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;FEATURE_TYPECONVERTER</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;FEATURE_TYPECONVERTER</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 83e8ca47378f06ef7acdd6c3eb3dfa366abf4e94..4b7cf62280f8cf5ee961798a8d2ddc8f541ff3a8 100644 (file)
@@ -1,3 +1,4 @@
+../../test-helpers/NunitHelpers.cs
 ../../../build/common/Locale.cs
 ../System.Drawing/gdipEnums.cs    
 ../System.Drawing/gdipFunctions.cs
index 9848565605712e7fde336a7da9279d79c3dca56e..061d5e3ed70610688872b141a512f2e2fdeb3944 100644 (file)
@@ -38,9 +38,6 @@ using System.Drawing.Text;
 using System.Drawing.Imaging;\r
 using DrawingTestHelper;\r
 using System.IO;\r
-#if !MONOTOUCH\r
-using  NUnit.Framework.SyntaxHelpers;\r
-#endif\r
 \r
 namespace Test.Sys.Drawing.GraphicsFixtures {\r
        #region GraphicsFixtureProps\r
index 788104cabe5d626d6e7c3fdc72a29bf1ca6d531a..263ed4b1afb20bba0a13dad1da4d54d2b99c30b4 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,414,169</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;CODEPLEX_40</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;CODEPLEX_40</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,414,169</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;CODEPLEX_40</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;CODEPLEX_40</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index d0a7c52ddb6c39b21351b577a2544d7981f80b20..0bc9d350f98f38430added9f081f5a1543afff51 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,168,162</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,168,162</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 63bf1dbfbf12cd0ba5c75e5ad8f71ead09a12a7c..44bcdd9a644b601bb0c17327ef0a2ac5de5399de 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 48529c618dd8e62177cf11e211a4375d7d39ca09..2b43b04be5e04277894087e3f4f56b7f787aaada 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index e834a58af15ca7366fb3e520c06c9523fa2a7495..7142a657ba0e4474d444018ce9aefa8a8430fb65 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;NET_3_0</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;NET_3_0</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;NET_3_0</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;NET_3_0</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 05426acf59fa26a02389725838c1db7926f7c226..0b98df20420097218f37b5da5b635066723fe1f5 100644 (file)
@@ -61,6 +61,7 @@ using System.Runtime.InteropServices;
 [assembly: ComCompatibleVersion (1, 0, 3300, 0)]
 [assembly: AllowPartiallyTrustedCallers]
 
-#if !NET_2_1
+#if !MOBILE
 [assembly: SecurityCritical (SecurityCriticalScope.Explicit)]
-#endif
\ No newline at end of file
+[assembly: InternalsVisibleTo ("System.ServiceModel, PublicKey=00000000000000000400000000000000")]
+#endif
index 7eea754cfa905116418953dd58a636f7fbea109f..29bb7acd6ee63617f77795f248bccf18f87da3ff 100644 (file)
@@ -2,8 +2,12 @@ thisdir = class/System.IdentityModel
 SUBDIRS = 
 include ../../build/rules.make
 
+ifndef NO_MONO_SECURITY
+MONO_SECURITY=Mono.Security
+endif
+
 LIBRARY = System.IdentityModel.dll
-LIB_REFS = System System.Xml System.Security Mono.Security System.Runtime.Serialization
+LIB_REFS = System System.Xml System.Security $(MONO_SECURITY) System.Runtime.Serialization
 LIB_MCS_FLAGS = \
                /d:NET_3_0      \
                $(OTHER_LIB_MCS_FLAGS)
index ea349ebcc43a57fd85ffff74bf19184035f5fb7f..e77c915f1ff9f818b67d0eefba0fff895fcf0d63 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;NET_3_0</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;NET_3_0</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;NET_3_0</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;NET_3_0</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
     <Compile Include="System.IdentityModel\OpenObject.cs" />\r
     <Compile Include="System.IdentityModel\SignatureVerificationFailedException.cs" />\r
     <Compile Include="System.Security.Claims\AuthenticationTypes.cs" />\r
+    <Compile Include="System.ServiceModel.Security.Tokens\BinarySecretSecurityToken.cs" />\r
+    <Compile Include="System.ServiceModel.Security.Tokens\InternalEncryptedKeyIdentifierClause.cs" />\r
+    <Compile Include="System.ServiceModel.Security.Tokens\WrappedKeySecurityToken.cs" />\r
+    <Compile Include="System.ServiceModel.Security\BinarySecretKeyIdentifierClause.cs" />\r
+    <Compile Include="System.ServiceModel.Security\KeyNameIdentifierClause.cs" />\r
+    <Compile Include="System.ServiceModel.Security\SecurityContextKeyIdentifierClause.cs" />\r
     <Compile Include="System.ServiceModel.Security\X509CertificateValidationMode.cs" />\r  </ItemGroup>\r
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \r
        Other similar extension points exist, see Microsoft.Common.targets.\r
       <Project>{3ED36717-A9D1-4289-8949-9B7F39766DEB}</Project>\r
       <Name>System.Security-net_4_x</Name>\r
     </ProjectReference>\r
-    <ProjectReference Include="../System.Configuration/System.Configuration-net_4_x.csproj">\r
-      <Project>{D5CDC09C-F19A-4811-A6C8-70F51CBFB644}</Project>\r
-      <Name>System.Configuration-net_4_x</Name>\r
-    </ProjectReference>\r
     <ProjectReference Include="../Mono.Security/Mono.Security-net_4_x.csproj">\r
       <Project>{42D59DE7-586F-4ACF-BDD5-E7869E39E3EF}</Project>\r
       <Name>Mono.Security-net_4_x</Name>\r
       <Project>{D845AD9D-3CCB-49CB-9543-028678E94938}</Project>\r
       <Name>System.Runtime.Serialization-net_4_x</Name>\r
     </ProjectReference>\r
+    <ProjectReference Include="../System.Configuration/System.Configuration-net_4_x.csproj">\r
+      <Project>{D5CDC09C-F19A-4811-A6C8-70F51CBFB644}</Project>\r
+      <Name>System.Configuration-net_4_x</Name>\r
+    </ProjectReference>\r
     <ProjectReference Include="../System.Web/System.Web-net_4_x.csproj">\r
       <Project>{9DB806CB-B828-49B7-BAE2-2E52402CB4DC}</Project>\r
       <Name>System.Web-net_4_x</Name>\r
diff --git a/mcs/class/System.IdentityModel/System.ServiceModel.Security.Tokens/BinarySecretSecurityToken.cs b/mcs/class/System.IdentityModel/System.ServiceModel.Security.Tokens/BinarySecretSecurityToken.cs
new file mode 100644 (file)
index 0000000..464c936
--- /dev/null
@@ -0,0 +1,119 @@
+//
+// BinarySecretSecurityToken.cs
+//
+// Author:
+//     Atsushi Enomoto <atsushi@ximian.com>
+//
+// Copyright (C) 2006 Novell, Inc.  http://www.novell.com
+//
+// 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.ObjectModel;
+using System.Xml;
+using System.IdentityModel.Policy;
+using System.IdentityModel.Tokens;
+
+namespace System.ServiceModel.Security.Tokens
+{
+       public class BinarySecretSecurityToken : SecurityToken
+       {
+               ReadOnlyCollection<SecurityKey> keys;
+
+               string id;
+               byte [] key;
+               bool allow_crypto;
+               DateTime valid_from = DateTime.Now.ToUniversalTime ();
+
+               BinarySecretSecurityToken (string id, bool allowCrypto)
+               {
+                       this.id = id;
+                       allow_crypto = allowCrypto;
+               }
+
+               public BinarySecretSecurityToken (byte [] key)
+                       : this ("uuid:" + Guid.NewGuid ().ToString (), key)
+               {
+               }
+
+               public BinarySecretSecurityToken (string id, byte [] key)
+                       : this (id, key, false)
+               {
+               }
+
+               protected BinarySecretSecurityToken (string id, byte [] key, bool allowCrypto)
+                       : this (id, allowCrypto)
+               {
+                       if (key == null)
+                               throw new ArgumentNullException ("key");
+                       this.key = key;
+
+                       SecurityKey [] arr = new SecurityKey [] {new InMemorySymmetricSecurityKey (key)};
+                       keys = new ReadOnlyCollection<SecurityKey> (arr);
+               }
+
+               public BinarySecretSecurityToken (int keySizeInBits)
+                       : this ("uuid:" + Guid.NewGuid ().ToString (), keySizeInBits)
+               {
+               }
+
+               public BinarySecretSecurityToken (string id, int keySizeInBits)
+                       : this (id, keySizeInBits, false)
+               {
+               }
+
+               protected BinarySecretSecurityToken (string id, int keySizeInBits, bool allowCrypto)
+                       : this (id, allowCrypto)
+               {
+                       if (keySizeInBits < 0)
+                               throw new ArgumentOutOfRangeException ("keySizeInBits");
+
+                       this.key = new byte [keySizeInBits >> 3 + (keySizeInBits % 8 == 0 ? 0 : 1)];
+
+                       SecurityKey [] arr = new SecurityKey [] {new InMemorySymmetricSecurityKey (key)};
+                       keys = new ReadOnlyCollection<SecurityKey> (arr);
+               }
+
+               public override DateTime ValidFrom {
+                       get { return valid_from; }
+               }
+
+               public override DateTime ValidTo {
+                       get { return DateTime.MaxValue.AddDays (-1); }
+               }
+
+               public override string Id {
+                       get { return id; }
+               }
+
+               public int KeySize {
+                       get { return key.Length; }
+               }
+
+               public override ReadOnlyCollection<SecurityKey> SecurityKeys {
+                       get { return keys; }
+               }
+
+               public byte [] GetKeyBytes ()
+               {
+                       return (byte []) key.Clone ();
+               }
+       }
+}
diff --git a/mcs/class/System.IdentityModel/System.ServiceModel.Security.Tokens/InternalEncryptedKeyIdentifierClause.cs b/mcs/class/System.IdentityModel/System.ServiceModel.Security.Tokens/InternalEncryptedKeyIdentifierClause.cs
new file mode 100644 (file)
index 0000000..95e4334
--- /dev/null
@@ -0,0 +1,51 @@
+//
+// InternalEncryptedKeyIdentifierClause.cs
+//
+// Author:
+//     Atsushi Enomoto <atsushi@ximian.com>
+//
+// Copyright (C) 2007 Novell, Inc.  http://www.novell.com
+//
+// 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.ObjectModel;
+using System.Security.Cryptography.Xml;
+using System.Xml;
+using System.IdentityModel.Tokens;
+
+namespace System.ServiceModel.Security.Tokens
+{
+       internal class InternalEncryptedKeyIdentifierClause : BinaryKeyIdentifierClause
+       {
+               public InternalEncryptedKeyIdentifierClause (byte [] hash)
+                       : base (null, hash, false)
+               {
+               }
+
+               public override bool Matches (SecurityKeyIdentifierClause keyIdentifierClause)
+               {
+                       InternalEncryptedKeyIdentifierClause kic = keyIdentifierClause as InternalEncryptedKeyIdentifierClause;
+                       if (kic == null)
+                               return false;
+                       return Matches (kic.GetRawBuffer ());
+               }
+       }
+}
diff --git a/mcs/class/System.IdentityModel/System.ServiceModel.Security.Tokens/WrappedKeySecurityToken.cs b/mcs/class/System.IdentityModel/System.ServiceModel.Security.Tokens/WrappedKeySecurityToken.cs
new file mode 100644 (file)
index 0000000..d3c47f2
--- /dev/null
@@ -0,0 +1,176 @@
+//
+// WrappedKeySecurityToken.cs
+//
+// Author:
+//     Atsushi Enomoto <atsushi@ximian.com>
+//
+// Copyright (C) 2006 Novell, Inc.  http://www.novell.com
+//
+// 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.ObjectModel;
+using System.Security.Cryptography;
+using System.Security.Cryptography.Xml;
+using System.Xml;
+using System.IdentityModel.Policy;
+using System.IdentityModel.Tokens;
+
+namespace System.ServiceModel.Security.Tokens
+{
+       public class WrappedKeySecurityToken : SecurityToken
+       {
+               string id;
+               byte [] raw_key;
+               byte [] wrapped_key;
+               string wrap_alg;
+               SecurityToken wrap_token;
+               SecurityKeyIdentifier wrap_token_ref;
+               DateTime valid_from = DateTime.Now.ToUniversalTime ();
+               ReadOnlyCollection<SecurityKey> keys;
+               ReferenceList reference_list;
+               byte [] keyhash;
+
+               public WrappedKeySecurityToken (
+                       string id,
+                       byte [] keyToWrap,
+                       string wrappingAlgorithm,
+                       SecurityToken wrappingToken,
+                       SecurityKeyIdentifier wrappingTokenReference)
+               {
+                       if (id == null)
+                               throw new ArgumentNullException ("id");
+                       if (keyToWrap == null)
+                               throw new ArgumentNullException ("keyToWrap");
+                       if (wrappingAlgorithm == null)
+                               throw new ArgumentNullException ("wrappingAlgorithm");
+                       if (wrappingToken == null)
+                               throw new ArgumentNullException ("wrappingToken");
+
+                       raw_key = keyToWrap;
+                       this.id = id;
+                       wrap_alg = wrappingAlgorithm;
+                       wrap_token = wrappingToken;
+                       wrap_token_ref = wrappingTokenReference;
+                       Collection<SecurityKey> l = new Collection<SecurityKey> ();
+                       foreach (SecurityKey sk in wrappingToken.SecurityKeys) {
+                               if (sk.IsSupportedAlgorithm (wrappingAlgorithm)) {
+                                       wrapped_key = sk.EncryptKey (wrappingAlgorithm, keyToWrap);
+                                       l.Add (new InMemorySymmetricSecurityKey (keyToWrap));
+                                       break;
+                               }
+                       }
+                       keys = new ReadOnlyCollection<SecurityKey> (l);
+                       if (wrapped_key == null)
+                               throw new ArgumentException (String.Format ("None of the security keys in the argument token supports specified wrapping algorithm '{0}'", wrappingAlgorithm));
+               }
+
+               internal byte [] RawKey {
+                       get { return raw_key; }
+               }
+
+               // It is kind of compromised solution to output
+               // ReferenceList inside e:EncryptedKey and might disappear
+               // when non-wrapped key is represented by another token type.
+               internal ReferenceList ReferenceList {
+                       get { return reference_list; }
+                       set { reference_list = value; }
+               }
+
+               public override DateTime ValidFrom {
+                       get { return valid_from; }
+               }
+
+               public override DateTime ValidTo {
+                       get { return DateTime.MaxValue.AddDays (-1); }
+               }
+
+               public override string Id {
+                       get { return id; }
+               }
+
+               public override ReadOnlyCollection<SecurityKey> SecurityKeys {
+                       get { return keys; }
+               }
+
+               public string WrappingAlgorithm {
+                       get { return wrap_alg; }
+               }
+
+               public SecurityToken WrappingToken {
+                       get { return wrap_token; }
+               }
+
+               public SecurityKeyIdentifier WrappingTokenReference {
+                       get { return wrap_token_ref; }
+               }
+
+               public byte [] GetWrappedKey ()
+               {
+                       return (byte []) wrapped_key.Clone ();
+               }
+
+               internal void SetWrappedKey (byte [] value)
+               {
+                       wrapped_key = (byte []) value.Clone ();
+               }
+
+               [MonoTODO]
+               public override bool CanCreateKeyIdentifierClause<T> ()
+               {
+                       /*
+                       foreach (SecurityKeyIdentifierClause k in WrappingTokenReference) {
+                               Type t = k.GetType ();
+                               if (t == typeof (T) || t.IsSubclassOf (typeof (T)))
+                                       return true;
+                       }
+                       */
+                       return false;
+               }
+
+               [MonoTODO]
+               public override T CreateKeyIdentifierClause<T> ()
+               {
+                       /*
+                       foreach (SecurityKeyIdentifierClause k in WrappingTokenReference) {
+                               Type t = k.GetType ();
+                               if (t == typeof (T) || t.IsSubclassOf (typeof (T)))
+                                       return (T) k;
+                       }
+                       */
+                       throw new NotSupportedException (String.Format ("WrappedKeySecurityToken cannot create '{0}'", typeof (T)));
+               }
+
+               public override bool MatchesKeyIdentifierClause (SecurityKeyIdentifierClause keyIdentifierClause)
+               {
+                       LocalIdKeyIdentifierClause lkic = keyIdentifierClause as LocalIdKeyIdentifierClause;
+                       if (lkic != null && lkic.LocalId == Id)
+                               return true;
+
+                       InternalEncryptedKeyIdentifierClause khic = keyIdentifierClause as InternalEncryptedKeyIdentifierClause;
+                       if (keyhash == null)
+                               keyhash = SHA1.Create ().ComputeHash (wrapped_key);
+                       if (khic != null && khic.Matches (keyhash))
+                               return true;
+
+                       return false;
+               }
+       }
+}
diff --git a/mcs/class/System.IdentityModel/System.ServiceModel.Security/BinarySecretKeyIdentifierClause.cs b/mcs/class/System.IdentityModel/System.ServiceModel.Security/BinarySecretKeyIdentifierClause.cs
new file mode 100644 (file)
index 0000000..497d5c7
--- /dev/null
@@ -0,0 +1,87 @@
+//
+// BinarySecretKeyIdentifierClause.cs
+//
+// Author:
+//     Atsushi Enomoto <atsushi@ximian.com>
+//
+// Copyright (C) 2006 Novell, Inc.  http://www.novell.com
+//
+// 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.Xml;
+using System.IdentityModel.Policy;
+using System.IdentityModel.Tokens;
+
+namespace System.ServiceModel.Security
+{
+       public class BinarySecretKeyIdentifierClause : BinaryKeyIdentifierClause
+       {
+               public BinarySecretKeyIdentifierClause (byte [] key)
+                       : this (key, true)
+               {
+               }
+
+               [MonoTODO ("ClauseType")]
+               public BinarySecretKeyIdentifierClause (byte [] key, bool cloneBuffer)
+                       : base ("", key, cloneBuffer)
+               {
+               }
+
+               [MonoTODO ("ClauseType")]
+               public BinarySecretKeyIdentifierClause (byte [] key, bool cloneBuffer, byte [] derivationNonce, int derivationLength)
+                       : base ("", key, cloneBuffer, derivationNonce, derivationLength)
+               {
+               }
+
+               public override bool CanCreateKey {
+                       get { return true; }
+               }
+
+               public byte [] GetKeyBytes ()
+               {
+                       return GetBuffer ();
+               }
+
+               public override SecurityKey CreateKey ()
+               {
+                       return new InMemorySymmetricSecurityKey (GetRawBuffer (), true);
+               }
+
+               public override bool Matches (SecurityKeyIdentifierClause clause)
+               {
+                       if (clause == null)
+                               throw new ArgumentNullException ("clause");
+                       BinarySecretKeyIdentifierClause other =
+                               clause as BinarySecretKeyIdentifierClause;
+                       if (other == null)
+                               return false;
+                       byte [] b1 = GetRawBuffer ();
+                       byte [] b2 = other.GetRawBuffer ();
+                       if (b1.Length != b2.Length)
+                               return false;
+                       for (int i = 0; i < b1.Length; i++)
+                               if (b1 [i] != b2 [i])
+                                       return false;
+                       return true;
+               }
+       }
+}
diff --git a/mcs/class/System.IdentityModel/System.ServiceModel.Security/KeyNameIdentifierClause.cs b/mcs/class/System.IdentityModel/System.ServiceModel.Security/KeyNameIdentifierClause.cs
new file mode 100644 (file)
index 0000000..ad7a84a
--- /dev/null
@@ -0,0 +1,69 @@
+//
+// KeyNameIdentifierClause.cs
+//
+// Author:
+//     Atsushi Enomoto <atsushi@ximian.com>
+//
+// Copyright (C) 2006 Novell, Inc.  http://www.novell.com
+//
+// 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.Xml;
+using System.IdentityModel.Policy;
+using System.IdentityModel.Tokens;
+
+namespace System.ServiceModel.Security
+{
+       public class KeyNameIdentifierClause : SecurityKeyIdentifierClause
+       {
+               public KeyNameIdentifierClause (string keyName)
+                       : base (null)
+               {
+                       key_name = keyName;
+               }
+
+               string key_name;
+
+               public string KeyName {
+                       get { return key_name; }
+               }
+
+               public override bool Matches (SecurityKeyIdentifierClause clause)
+               {
+                       if (clause == null)
+                               throw new ArgumentNullException ("clause");
+                       KeyNameIdentifierClause knic =
+                               clause as KeyNameIdentifierClause;
+                       return knic != null && Matches (knic.KeyName);
+               }
+
+               public bool Matches (string keyName)
+               {
+                       return key_name == keyName;
+               }
+
+               public override string ToString ()
+               {
+                       return String.Concat ("KeyNameIdentifierClause(KeyName = '", KeyName, "')");
+               }
+       }
+}
diff --git a/mcs/class/System.IdentityModel/System.ServiceModel.Security/SecurityContextKeyIdentifierClause.cs b/mcs/class/System.IdentityModel/System.ServiceModel.Security/SecurityContextKeyIdentifierClause.cs
new file mode 100644 (file)
index 0000000..2ac33ba
--- /dev/null
@@ -0,0 +1,84 @@
+//
+// SecurityContextKeyIdentifierClause.cs
+//
+// Author:
+//     Atsushi Enomoto <atsushi@ximian.com>
+//
+// Copyright (C) 2006 Novell, Inc.  http://www.novell.com
+//
+// 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.IdentityModel.Selectors;
+using System.IdentityModel.Tokens;
+using System.Xml;
+
+namespace System.ServiceModel.Security
+{
+       public class SecurityContextKeyIdentifierClause : SecurityKeyIdentifierClause
+       {
+               public SecurityContextKeyIdentifierClause (UniqueId contextId)
+                       : this (contextId, new UniqueId ())
+               {
+               }
+
+               public SecurityContextKeyIdentifierClause (UniqueId contextId, UniqueId generation)
+                       : this (contextId, generation, null, 0)
+               {
+               }
+
+               public SecurityContextKeyIdentifierClause (UniqueId contextId, UniqueId generation, byte [] derivationNonce, int derivationLength)
+                       : base (null, derivationNonce, derivationLength)
+               {
+                       this.context = contextId;
+                       this.generation = generation;
+               }
+
+               UniqueId context, generation;
+
+               public UniqueId ContextId {
+                       get { return context; }
+               }
+
+               public UniqueId Generation {
+                       get { return generation; }
+               }
+
+               public override bool Matches (
+                       SecurityKeyIdentifierClause keyIdentifierClause)
+               {
+                       SecurityContextKeyIdentifierClause other =
+                               keyIdentifierClause as SecurityContextKeyIdentifierClause;
+                       return  other != null && Matches (other.context, other.generation);
+               }
+
+               public bool Matches (UniqueId contextId, UniqueId generation)
+               {
+                       return context == contextId &&
+                               this.generation == generation;
+               }
+
+               [MonoTODO]
+               public override string ToString ()
+               {
+                       return base.ToString ();
+               }
+       }
+}
index 1d5090748cd12476a0c682e30a969bbb1c69611a..d55b6a06923f1f595cefa32666c6244339da49aa 100644 (file)
@@ -2,7 +2,6 @@
 // BootstrapContextTest.cs - NUnit Test Cases for System.IdentityModel.Tokens.BootstrapContext
 //
 
-#if NET_4_5
 using System;
 using System.IO;
 using System.IdentityModel.Tokens;
@@ -248,4 +247,3 @@ namespace MonoTests.System.IdentityModel.Tokens.net_4_5 {
                }
        }
 }
-#endif
index 4d705d24d5794a9bb090e62ad31cf76312c4c1e0..c6ab55fe8d704fbf8df35ef92c09de4dd3177c08 100755 (executable)
@@ -128,4 +128,10 @@ System.IdentityModel.Tokens/X509SubjectKeyIdentifierClause.cs
 System.IdentityModel.Tokens/X509ThumbprintKeyIdentifierClause.cs
 System.IdentityModel.Tokens/X509WindowsSecurityToken.cs
 System.Security.Claims/AuthenticationTypes.cs
+System.ServiceModel.Security/BinarySecretKeyIdentifierClause.cs
+System.ServiceModel.Security/KeyNameIdentifierClause.cs
+System.ServiceModel.Security/SecurityContextKeyIdentifierClause.cs
 System.ServiceModel.Security/X509CertificateValidationMode.cs
+System.ServiceModel.Security.Tokens/BinarySecretSecurityToken.cs
+System.ServiceModel.Security.Tokens/InternalEncryptedKeyIdentifierClause.cs
+System.ServiceModel.Security.Tokens/WrappedKeySecurityToken.cs
index 136d3cc0f0f60f82bbb5d4a99d7c281a053c8537..f1f3da90e103829f20b8cbd9f6641361d582bb90 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;ASPNETMVC;FEATURE_DYNAMIC</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;ASPNETMVC;FEATURE_DYNAMIC</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;ASPNETMVC;FEATURE_DYNAMIC</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;ASPNETMVC;FEATURE_DYNAMIC</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 5a5dadfa168d8e4a3328de5149864d95cd1a2e2e..089c3056c1abf3d797cc83f9e63030c6bcb130e7 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 7d9b5c4017292ec9fffd36c9d7cee45d52d3182e..b41b80068cf4f41deedf1af31748004be0db3faa 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 939068bd6f7a40d3d1d00ee3d31952ba2adbaeeb..74446b38cb8bdb4e9dfeedb838ed5300c922aae4 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index f987c65b4e4ef67b74ca0df3da3e416ea08872d0..48defdeb71fc94283af391573abe2b81f66842a7 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;ASPNETMVC</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;ASPNETMVC</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;ASPNETMVC</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;ASPNETMVC</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 519b2833cba57777ffc6909578023f34fc0c4af8..2a8218cb70d7aed07e1c4662bf0dd30f04b07814 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 59456d6df0bb91dbaaae0de6a84b01c3e6b4ccf0..14ebd8ff85de73380a0b30f2e7c0aa41363ffeef 100644 (file)
@@ -29,7 +29,12 @@ namespace System.Net.Http {
                // but we want this to work "as expected" even if the application is not being linked
                static HttpMessageHandler GetDefaultHandler ()
                {
+#if MONOTOUCH_WATCH
+                       // There's only one valid handler type for watchOS
+                       return new NSUrlSessionHandler ();
+#else
                        return RuntimeOptions.GetHttpMessageHandler ();
+#endif
                }
        }
 #else
index e6e2d68457e26d135f2b8691238a53d4daf7357e..f4cd00da2bf9d21ad96eedb6d03a916742cf2ae6 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index ee2dbe74b67855bf0c9bf4a7210aea2df3b02c46..e90cc29f822a82c5b405de37c856f78a33a1850b 100644 (file)
@@ -147,7 +147,7 @@ namespace System.Net.Http.Headers
                        if (t != Token.Type.Token)
                                return false;
 
-                       int nvalue;
+                       long nvalue;
                        if (!lexer.IsStarStringValue (t)) {
                                if (!lexer.TryGetNumericValue (t, out nvalue)) {
                                        var s = lexer.GetStringValue (t);
@@ -158,12 +158,12 @@ namespace System.Net.Http.Headers
                                        if (sep.Length != 2)
                                                return false;
 
-                                       if (!int.TryParse (sep[0], NumberStyles.None, CultureInfo.InvariantCulture, out nvalue))
+                                       if (!long.TryParse (sep[0], NumberStyles.None, CultureInfo.InvariantCulture, out nvalue))
                                                return false;
 
                                        value.From = nvalue;
 
-                                       if (!int.TryParse (sep[1], NumberStyles.None, CultureInfo.InvariantCulture, out nvalue))
+                                       if (!long.TryParse (sep[1], NumberStyles.None, CultureInfo.InvariantCulture, out nvalue))
                                                return false;
 
                                        value.To = nvalue;
index 9ca277dbbcd3ed5f92ef9a04e09fa3b6b5cade31..3da8be8c435ac602e3b50011669eaf5eccdaa244 100644 (file)
@@ -70,14 +70,21 @@ namespace System.Net.Http.Headers
                                        return null;
 
                                var c = (HttpHeaderValueCollection<U>) collection;
-                               if (c.Count == 0)
-                                       return null;
+                               if (c.Count == 0) {
+                                       if (c.InvalidValues == null)
+                                               return null;
+
+                                       return new List<string> (c.InvalidValues);
+                               }
 
                                var list = new List<string> ();
                                foreach (var item in c) {
                                        list.Add (item.ToString ());
                                }
 
+                               if (c.InvalidValues != null)
+                                       list.AddRange (c.InvalidValues);
+
                                return list;
                        }
 
index 72c4299e64ad4c8eb85239f9d849037435a10de0..35f8556bdc557ee733c41bd455f570010f8cdedc 100644 (file)
@@ -36,6 +36,7 @@ namespace System.Net.Http.Headers
                readonly List<T> list;
                readonly HttpHeaders headers;
                readonly HeaderInfo headerInfo;
+               List<string> invalidValues;
 
                internal HttpHeaderValueCollection (HttpHeaders headers, HeaderInfo headerInfo)
                {
@@ -50,6 +51,12 @@ namespace System.Net.Http.Headers
                        }
                }
 
+               internal List<string> InvalidValues {
+                       get {
+                               return invalidValues;
+                       }
+               }
+
                public bool IsReadOnly {
                        get {
                                return false;
@@ -66,9 +73,18 @@ namespace System.Net.Http.Headers
                        list.AddRange (values);
                }
 
+               internal void AddInvalidValue (string invalidValue)
+               {
+                       if (invalidValues == null)
+                               invalidValues = new List<string> ();
+
+                       invalidValues.Add (invalidValue);
+               }
+
                public void Clear ()
                {
                        list.Clear ();
+                       invalidValues = null;
                }
 
                public bool Contains (T item)
@@ -93,11 +109,12 @@ namespace System.Net.Http.Headers
 
                public override string ToString ()
                {
-                       // This implementation prints different values than
-                       // what .NET does when one of the values is invalid
-                       // But it better represents what is actually hold by
-                       // the collection
-                       return string.Join (headerInfo.Separator, list);
+                       var res = string.Join (headerInfo.Separator, list);
+
+                       if (invalidValues != null)
+                               res += string.Join (headerInfo.Separator, invalidValues);
+
+                       return res;
                }
 
                public bool TryParseAdd (string input)
index 05b5fe62681f3f981b067777d1cb7a7f9f32a03b..c22a6695593718e430899cf0ffd3dd20d11433a1 100644 (file)
@@ -481,23 +481,28 @@ namespace System.Net.Http.Headers
                                headers.Add (name, value);
                        }
 
+                       var col = (HttpHeaderValueCollection<T>) value.Parsed;
+
                        if (value.HasStringValues) {
                                var hinfo = known_headers[name];
-                               if (value.Parsed == null)
-                                       value.Parsed = hinfo.CreateCollection (this);
+                               if (col == null) {
+                                       value.Parsed = col = new HttpHeaderValueCollection<T> (this, hinfo);
+                               }
 
                                object pvalue;
                                for (int i = 0; i < value.Values.Count; ++i) {
-                                       if (!hinfo.TryParse (value.Values[i], out pvalue))
-                                               continue;
-
-                                       hinfo.AddToCollection (value.Parsed, pvalue);
-                                       value.Values.RemoveAt (i);
-                                       --i;
+                                       var svalue = value.Values[i];
+                                       if (!hinfo.TryParse (svalue, out pvalue)) {
+                                               col.AddInvalidValue (svalue);
+                                       } else {
+                                               hinfo.AddToCollection (col, pvalue);
+                                       }
                                }
+
+                               value.Values.Clear ();
                        }
 
-                       return (HttpHeaderValueCollection<T>) value.Parsed;
+                       return col;
                }
 
                internal void SetValue<T> (string name, T value, Func<object, string> toStringConverter = null)
index 78f2fafcc83284e5e87abfbcbfb13e4935abbd1a..a3335ea5506ffe67aafedba5773301d48b9cee77 100644 (file)
@@ -380,7 +380,9 @@ namespace System.Net.Http
                                }
                        } catch (WebException we) {
                                if (we.Status != WebExceptionStatus.RequestCanceled)
-                                       throw;
+                                       throw new HttpRequestException ("An error occurred while sending the request", we);
+                       } catch (System.IO.IOException ex) {
+                               throw new HttpRequestException ("An error occurred while sending the request", ex);
                        }
 
                        if (cancellationToken.IsCancellationRequested) {
diff --git a/mcs/class/System.Net.Http/System.Net.Http/HttpClientHandler.platformnotsupported.cs b/mcs/class/System.Net.Http/System.Net.Http/HttpClientHandler.platformnotsupported.cs
new file mode 100644 (file)
index 0000000..eb5b7ff
--- /dev/null
@@ -0,0 +1,175 @@
+//
+// System.Net.Http/HttpClientHandler.cs
+//
+// Author:
+//     Rolf Bjarne Kvinge <rolf@xamarin.com>
+//
+// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com)
+//
+// 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.Collections.Generic;
+using System.Net.Security;
+using System.Security.Authentication;
+using System.Security.Cryptography.X509Certificates;
+using System.Threading.Tasks;
+using System.Threading;
+
+namespace System.Net.Http
+{
+       public class HttpClientHandler : HttpMessageHandler
+       {
+               const string EXCEPTION_MESSAGE = "System.Net.Http.HttpClientHandler is not supported on the current platform.";
+
+               public HttpClientHandler ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public bool AllowAutoRedirect {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public DecompressionMethods AutomaticDecompression {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public ClientCertificateOption ClientCertificateOptions {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public CookieContainer CookieContainer {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public ICredentials Credentials {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public int MaxAutomaticRedirections {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public long MaxRequestContentBufferSize {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public bool PreAuthenticate {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public IWebProxy Proxy {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public virtual bool SupportsAutomaticDecompression {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public virtual bool SupportsProxy {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public virtual bool SupportsRedirectConfiguration {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public bool UseCookies {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public bool UseDefaultCredentials {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public bool UseProxy {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               protected override void Dispose (bool disposing)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               HttpResponseMessage CreateResponseMessage (HttpWebResponse wr, HttpRequestMessage requestMessage, CancellationToken cancellationToken)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               protected internal async override Task<HttpResponseMessage> SendAsync (HttpRequestMessage request, CancellationToken cancellationToken)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+#if NETSTANDARD
+               public bool CheckCertificateRevocationList {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public X509CertificateCollection ClientCertificates {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public ICredentials DefaultProxyCredentials {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public int MaxConnectionsPerServer {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public int MaxResponseHeadersLength {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public IDictionary<string,object> Properties {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public Func<HttpRequestMessage,X509Certificate2,X509Chain,SslPolicyErrors,bool> ServerCertificateCustomValidationCallback {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public SslProtocols SslProtocols {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+#endif
+       }
+}
index 62b740c33cd5b9ba2ee05a5ab7741938037be95a..7522def2d7b2999527d732a93cc3006bac2b0d24 100644 (file)
@@ -101,6 +101,12 @@ namespace MonoTests.System.Net.Http.Headers
                        Assert.IsNull (res.To, "#22");
                        Assert.IsNull (res.Length, "#23");
                        Assert.AreEqual ("by */*", res.ToString (), "#24");
+
+                       res = ContentRangeHeaderValue.Parse("bytes  199999999999999999 - 999999999999999999/ 9223372036854775807");
+                       Assert.AreEqual (199999999999999999, res.From, "#31");
+                       Assert.AreEqual (999999999999999999, res.To, "#32");
+                       Assert.AreEqual (9223372036854775807, res.Length, "#33");
+                       Assert.AreEqual ("bytes 199999999999999999-999999999999999999/9223372036854775807", res.ToString (), "#34");
                }
 
                [Test]
index 50f8432f8ecb4ac99e1eb6ab1a7cd2c51bea74dc..0fd756037532eebca3f8ae890dbac52906503004 100644 (file)
@@ -91,5 +91,42 @@ namespace MonoTests.System.Net.Http.Headers
 
                        Assert.AreEqual ("kk, ttt", headers.Connection.ToString (), "#3");
                }
+
+               [Test]
+               public void AddInvalid ()
+               {
+                       HttpRequestMessage message = new HttpRequestMessage ();
+                       HttpRequestHeaders headers = message.Headers;
+
+                       headers.TryAddWithoutValidation ("User-Agent", "user,agent/1.0");
+
+                       Assert.AreEqual (0, headers.UserAgent.Count, "#1");
+                       Assert.AreEqual ("user,agent/1.0", headers.UserAgent.ToString (), "#2");
+
+                       Assert.AreEqual ("User-Agent: user,agent/1.0\r\n", headers.ToString (), "#3");
+
+                       headers.UserAgent.Clear ();
+                       Assert.AreEqual ("", headers.UserAgent.ToString (), "#4");
+                       Assert.AreEqual ("", headers.ToString (), "#5");
+               }
+
+               [Test]
+               public void AddInvalidAndValid ()
+               {
+                       HttpRequestMessage message = new HttpRequestMessage ();
+                       HttpRequestHeaders headers = message.Headers;
+
+                       headers.TryAddWithoutValidation ("User-Agent", "user,agent/1.0");
+                       headers.TryAddWithoutValidation("User-Agent", "agent2/2.0");
+
+                       Assert.AreEqual (1, headers.UserAgent.Count, "#1");
+                       Assert.AreEqual ("agent2/2.0user,agent/1.0", headers.UserAgent.ToString (), "#2");
+
+                       Assert.AreEqual ("User-Agent: agent2/2.0 user,agent/1.0\r\n", headers.ToString (), "#3");
+
+                       headers.UserAgent.Clear ();
+                       Assert.AreEqual ("", headers.UserAgent.ToString (), "#4");
+                       Assert.AreEqual ("", headers.ToString (), "#5");
+               }
        }
 }
index 78f8a0c225d5eb089658e94aa3aa821bc1706f42..3f06e1c316da8440c0a8701439deb9e5ee18b770 100644 (file)
@@ -61,6 +61,9 @@ namespace MonoTests.System.Net.Http
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Properties_Defaults ()
                {
                        var h = new HttpClientHandler ();
@@ -83,6 +86,9 @@ namespace MonoTests.System.Net.Http
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Properties_Invalid ()
                {
                        var h = new HttpClientHandler ();
@@ -107,6 +113,9 @@ namespace MonoTests.System.Net.Http
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Properties_AfterClientCreation ()
                {
                        var h = new HttpClientHandler ();
@@ -119,6 +128,9 @@ namespace MonoTests.System.Net.Http
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Disposed ()
                {
                        var h = new HttpClientHandler ();
index f1af864e214943a61321e2cf20cf93ff4a215cc7..d9aab417dfa00762ff0848ae78385316ada5a7e3 100644 (file)
@@ -263,6 +263,10 @@ namespace MonoTests.System.Net.Http
 
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               // Using HttpClientHandler, which indirectly requires BSD sockets.
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void CancelRequestViaProxy ()
                {
                        var handler = new HttpClientHandler {
@@ -321,7 +325,9 @@ namespace MonoTests.System.Net.Http
                }
 
                [Test]
-               [Category ("RequiresBSDSockets")]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Proxy_Disabled ()
                {
                        var pp = WebRequest.DefaultWebProxy;
@@ -398,7 +404,9 @@ namespace MonoTests.System.Net.Http
                }
 
                [Test]
-               [Category ("RequiresBSDSockets")]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Send_Complete_Default ()
                {
                        bool? failed = null;
@@ -443,7 +451,9 @@ namespace MonoTests.System.Net.Http
                }
 
                [Test]
-               [Category ("RequiresBSDSockets")]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Send_Complete_Version_1_0 ()
                {
                        bool? failed = null;
@@ -491,7 +501,9 @@ namespace MonoTests.System.Net.Http
                }
 
                [Test]
-               [Category ("RequiresBSDSockets")]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Send_Complete_ClientHandlerSettings ()
                {
                        bool? failed = null;
@@ -556,7 +568,9 @@ namespace MonoTests.System.Net.Http
                }
 
                [Test]
-               [Category ("RequiresBSDSockets")]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Send_Complete_CustomHeaders ()
                {
                        bool? failed = null;
@@ -621,7 +635,9 @@ namespace MonoTests.System.Net.Http
                }
 
                [Test]
-               [Category ("RequiresBSDSockets")]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Send_Complete_CustomHeaders_SpecialSeparators ()
                {
                        bool? failed = null;
@@ -656,7 +672,9 @@ namespace MonoTests.System.Net.Http
                }
 
                [Test]
-               [Category ("RequiresBSDSockets")]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Send_Complete_CustomHeaders_Host ()
                {
                        bool? failed = null;
@@ -690,7 +708,9 @@ namespace MonoTests.System.Net.Http
                }
 
                [Test]
-               [Category ("RequiresBSDSockets")]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Send_Transfer_Encoding_Chunked ()
                {
                        bool? failed = null;
@@ -720,7 +740,9 @@ namespace MonoTests.System.Net.Http
                }
 
                [Test]
-               [Category ("RequiresBSDSockets")]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Send_Transfer_Encoding_Custom ()
                {
                        bool? failed = null;
@@ -749,7 +771,9 @@ namespace MonoTests.System.Net.Http
                }
 
                [Test]
-               [Category ("RequiresBSDSockets")]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Send_Complete_Content ()
                {
                        var listener = CreateListener (l => {
@@ -777,7 +801,9 @@ namespace MonoTests.System.Net.Http
                }
 
                [Test]
-               [Category ("RequiresBSDSockets")]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Send_Complete_Content_MaxResponseContentBufferSize ()
                {
                        var listener = CreateListener (l => {
@@ -800,7 +826,9 @@ namespace MonoTests.System.Net.Http
                }
 
                [Test]
-               [Category ("RequiresBSDSockets")]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Send_Complete_Content_MaxResponseContentBufferSize_Error ()
                {
                        var listener = CreateListener (l => {
@@ -827,7 +855,9 @@ namespace MonoTests.System.Net.Http
                }
 
                [Test]
-               [Category ("RequiresBSDSockets")]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Send_Complete_NoContent ()
                {
                        foreach (var method in new HttpMethod[] { HttpMethod.Post, HttpMethod.Put, HttpMethod.Delete }) {
@@ -860,7 +890,9 @@ namespace MonoTests.System.Net.Http
                }
 
                [Test]
-               [Category ("RequiresBSDSockets")]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Send_Complete_Error ()
                {
                        var listener = CreateListener (l => {
@@ -881,7 +913,9 @@ namespace MonoTests.System.Net.Http
                }
 
                [Test]
-               [Category ("RequiresBSDSockets")]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Send_Content_Get ()
                {
                        var listener = CreateListener (l => {
@@ -901,7 +935,9 @@ namespace MonoTests.System.Net.Http
                }
 
                [Test]
-               [Category ("RequiresBSDSockets")]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Send_Content_BomEncoding ()
                {
                        var listener = CreateListener (l => {
@@ -926,7 +962,9 @@ namespace MonoTests.System.Net.Http
                }
 
                [Test]
-               [Category ("RequiresBSDSockets")]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Send_Content_Put ()
                {
                        bool passed = false;
@@ -952,7 +990,9 @@ namespace MonoTests.System.Net.Http
                }
 
                [Test]
-               [Category ("RequiresBSDSockets")]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Send_Content_Put_CustomStream ()
                {
                        bool passed = false;
@@ -1055,7 +1095,9 @@ namespace MonoTests.System.Net.Http
 
                [Test]
                [Category ("MobileNotWorking")] // Missing encoding
-               [Category ("RequiresBSDSockets")]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void GetString_Many ()
                {
                        Action<HttpListenerContext> context = (HttpListenerContext l) => {
@@ -1085,7 +1127,9 @@ namespace MonoTests.System.Net.Http
                }
 
                [Test]
-               [Category ("RequiresBSDSockets")]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void GetByteArray_ServerError ()
                {
                        var listener = CreateListener (l => {
@@ -1108,7 +1152,9 @@ namespace MonoTests.System.Net.Http
                }
 
                [Test]
-               [Category ("RequiresBSDSockets")]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void DisallowAutoRedirect ()
                {
                        var listener = CreateListener (l => {
@@ -1137,7 +1183,9 @@ namespace MonoTests.System.Net.Http
                }
 
                [Test]
-               [Category ("RequiresBSDSockets")]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void RequestUriAfterRedirect ()
                {
                        var listener = CreateListener (l => {
@@ -1178,7 +1226,9 @@ namespace MonoTests.System.Net.Http
                }
 
                [Test]
-               [Category ("RequiresBSDSockets")]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                /*
                 * Properties may only be modified before sending the first request.
                 */
@@ -1209,6 +1259,10 @@ namespace MonoTests.System.Net.Http
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               // Using HttpClientHandler, which indirectly requires BSD sockets.
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                /*
                 * However, this policy is not enforced for custom handlers and there
                 * is also no way a derived class could tell its HttpClientHandler parent
diff --git a/mcs/class/System.Net.Http/monotouch_watch_System.Net.Http.dll.exclude.sources b/mcs/class/System.Net.Http/monotouch_watch_System.Net.Http.dll.exclude.sources
new file mode 100644 (file)
index 0000000..5c2ff8a
--- /dev/null
@@ -0,0 +1 @@
+System.Net.Http/HttpClientHandler.cs
diff --git a/mcs/class/System.Net.Http/monotouch_watch_System.Net.Http.dll.sources b/mcs/class/System.Net.Http/monotouch_watch_System.Net.Http.dll.sources
new file mode 100644 (file)
index 0000000..a9d766e
--- /dev/null
@@ -0,0 +1,2 @@
+#include System.Net.Http.dll.sources
+System.Net.Http/HttpClientHandler.platformnotsupported.cs
index 249f6ebf8f6b561c09b00998194bddeaefe6526c..600e5eb6c6c1f16ba6fbbc9e100e52e2b8f4eb7e 100644 (file)
@@ -54,7 +54,7 @@ using System.Runtime.InteropServices;
 [assembly: NeutralResourcesLanguage ("en-US")]
 [assembly: CLSCompliant (true)]
 [assembly: AssemblyDelaySign (true)]
-#if NET_2_1
+#if MOBILE
        [assembly: AssemblyKeyFile ("../silverlight.pub")]
        [assembly: InternalsVisibleTo ("System.Windows, PublicKey=00240000048000009400000006020000002400005253413100040000010001008D56C76F9E8649383049F383C44BE0EC204181822A6C31CF5EB7EF486944D032188EA1D3920763712CCB12D75FB77E9811149E6148E5D32FBAAB37611C1878DDC19E20EF135D0CB2CFF2BFEC3D115810C3D9069638FE4BE215DBF795861920E5AB6F7DB2E2CEEF136AC23D5DD2BF031700AEC232F6C6B1C785B4305C123B37AB")]
        [assembly: InternalsVisibleTo ("System.Windows.Browser, PublicKey=00240000048000009400000006020000002400005253413100040000010001008D56C76F9E8649383049F383C44BE0EC204181822A6C31CF5EB7EF486944D032188EA1D3920763712CCB12D75FB77E9811149E6148E5D32FBAAB37611C1878DDC19E20EF135D0CB2CFF2BFEC3D115810C3D9069638FE4BE215DBF795861920E5AB6F7DB2E2CEEF136AC23D5DD2BF031700AEC232F6C6B1C785B4305C123B37AB")]
index ac5858d1adb7fb2e77bd7ffb1f18c9db0aedf559..d1b87a5741a7ad73d94d771abfa324ac1042b4e3 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1720</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;NET_3_5</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;NET_3_5</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1720</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;NET_3_5</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;NET_3_5</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 3ec3f7dce028c2530f288238c0d3cd873983eec9..5cdf15f1db97b99fe82d0cce1dc85d7c75c2bc0d 100644 (file)
@@ -25,7 +25,7 @@
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
-#if NET_2_1
+#if MOBILE
 using System.Runtime.InteropServices;
 
 namespace System.Net.NetworkInformation {
index 4d68350ebaf7ad63b5c06eaa4d05a2b5082b5b50..cafd9ed86e01086103657539975cca73e885f462 100644 (file)
@@ -30,7 +30,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if NET_2_1
+#if MOBILE
 
 namespace System.Net.NetworkInformation {
 
index ed40418052c502b18550f3834addb8f57d806b40..16089b5c933a83871d210cca6aadf82cdba03b3b 100644 (file)
@@ -27,7 +27,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if NET_2_1
+#if MOBILE
 
 using System;
 using System.Collections.Generic;
index ab6af6c6d3ada59fd36d1b9fcca7f18fd15e63e1..bd136e29803db01409060ec897905d160b60fd2d 100644 (file)
@@ -27,7 +27,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if NET_2_1
+#if MOBILE
 
 using System;
 using System.Collections.Generic;
index 78308a96b699e539baf78ee4126fdcde484f35b5..91c45e58801ceb3fc61134893fb0cbd2fdb3edbd 100644 (file)
@@ -27,7 +27,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if NET_2_1
+#if MOBILE
 
 using System;
 using System.Collections.Generic;
index 0319404caf65549ab6f202948287bb6fd7253bd8..82ac9f93cae12f71c89046031aa66374d527d9e0 100644 (file)
@@ -27,7 +27,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if NET_2_1
+#if MOBILE
 
 using System;
 using System.Collections.Generic;
index 0ed9107e46756d4e6d67cdc0247596d5d6ffa3f1..4bb8ffa3ff648022c3a20fe86ca3a77578f9bfbb 100644 (file)
@@ -27,7 +27,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if NET_2_1
+#if MOBILE
 
 using System;
 using System.Collections.Generic;
index b3157df2a1c7ef48208b3f497f0ab87231d5baf4..c546e9d971a5489d5de03d9bcdfda6ec730d14cb 100644 (file)
@@ -27,7 +27,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if NET_2_1
+#if MOBILE
 
 using System;
 using System.Collections.Generic;
index 6a376685c15b84080ef61496a90743f5cb3eddf4..a580fdd1bba59498d40b927da68911142834d91b 100644 (file)
@@ -26,7 +26,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if NET_2_1
+#if MOBILE
 
 namespace System.Net.Policy {
 
index 8d51d8361baa26ef177a09271249f5b451e65cf7..d15e57dd103ce5d962ace32129ad001e74062e6b 100644 (file)
@@ -26,7 +26,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if NET_2_1
+#if MOBILE
 
 using System.Security;
 
index 797d4d9f7a43c63519a0cff6656e013e87c07309..1114d7ec05540969d8a350492cb7a159ec4ab5e4 100644 (file)
@@ -26,7 +26,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if NET_2_1
+#if MOBILE
 
 namespace System.Net.Policy {
 
index 9b2ca1f4b71e759c8d424fa3f8ad1448e3249417..8b17bcad1f0fa06addb095554569d4a23f252f10 100644 (file)
@@ -26,7 +26,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if NET_2_1
+#if MOBILE
 
 namespace System.Net.Policy {
 
index 0b9bb2b479da6f1fdafa002439d38356b4bf8dbe..597109b3bb5d40036e11749fe8ab9e61b361c93d 100644 (file)
@@ -20,7 +20,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if NET_2_1
+#if MOBILE
 
 namespace System.Net.Sockets {
 
index d806f72367171d3e9588009d0d4194aa4514925d..06a814a5fd088ea14263883aba346402774a5d0f 100644 (file)
@@ -20,7 +20,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if NET_2_1
+#if MOBILE
 
 namespace System.Net.Sockets {
 
index 1260c7add6cb87c820774ee13eb7e6c99d6deb75..475742b1bdf09412395512e58d88a425fabd28b6 100644 (file)
@@ -27,7 +27,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if NET_2_1
+#if MOBILE
 namespace System.Net.Sockets {
        public enum SocketAsyncOperation {
                None,
index 5e76dd9f61c65ed697f89f69b93b3e2a66386b35..c1d7c3b1da40b08db4de2fb9d24b2c58cfb954f3 100644 (file)
@@ -20,7 +20,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if NET_2_1
+#if MOBILE
 
 namespace System.Net.Sockets {
 
index d44f7be28a627763913bde5cda30575dcd0038e3..a56c4db6b4bf2a8d99e8c1620d890d3101f23a9b 100644 (file)
@@ -26,7 +26,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if NET_2_1
+#if MOBILE
 
 namespace System.Net.Sockets {
 
index c33c24f37947949cf4c6b8532894c709e8c350f9..e84762a7f31dc7ccc7f7c6d76813b7ba1dba59b5 100644 (file)
@@ -26,7 +26,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if NET_2_1
+#if MOBILE
 
 namespace System.Net.Sockets {
 
index 69001b5d89bae14753ac7515b3cc462db6477661..fecd786e7fb9d2bdb27bc068534e9c05682177c5 100644 (file)
@@ -29,7 +29,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if NET_2_1
+#if MOBILE
 
 using System.IO;
 
index d26af21025023478d58626d169e8921651806e6d..a461f3029f4f31250d5ca3271080e984eb26acc4 100644 (file)
@@ -29,7 +29,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if NET_2_1
+#if MOBILE
 
 namespace System.Net {
 
index 4af48941bf0f47da3c3eae2a3112f4ea1dd2178c..b6b8739f86db823f103f1f3fadcb53486087db90 100644 (file)
@@ -27,7 +27,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if NET_2_1
+#if MOBILE
 
 namespace System.Net {
        public enum WebExceptionStatus {
index 16a0d38b7ebe327eac46f04d1f674b7eaeb0c6d3..aa865bc077b1c508af843beaae9395d062c7992b 100644 (file)
@@ -33,7 +33,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if NET_2_1
+#if MOBILE
 
 using System;
 using System.Collections;
index 128708d31d622f189c61409f3c80d054d19fca6b..bc8d445c5d216b29de4ec12e7836525c533b9d72 100644 (file)
@@ -29,7 +29,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if NET_2_1
+#if MOBILE
 
 using System.Collections.Generic;
 using System.IO;
index 495069b64cb8c5b892a269fbdc9d3060010510a0..1f991db627614cbf3441791eeba8df0303d83164 100644 (file)
@@ -28,7 +28,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if NET_2_1
+#if MOBILE
 
 using System.IO;
 
index 049d93922591acd2bac4343a8a5fbec5224f4727..51ad85c2e06292901dcb9e1334bc3d46193f5c69 100644 (file)
@@ -28,7 +28,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if NET_2_1
+#if MOBILE
 
 using System.ComponentModel;
 using System.IO;
index b901c07142f7f347995bd7e3ac07fc6eb4d6cc3c..26e4dbc454b115e361b087421c96dd34f227e61e 100644 (file)
@@ -26,7 +26,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if NET_2_1
+#if MOBILE
 
 namespace System.Net
 {
index f782c91e5cdece5a45361cd240173ebd832cb362..622801b60a8365814dcd2b087d78be391dffbe6d 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -14,7 +15,7 @@
     <NoStdLib>True</NoStdLib>\r
     \r
     <NoConfig>True</NoConfig>\r
-    \r
+    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>\r
     <AppDesignerFolder>Properties</AppDesignerFolder>\r
     <RootNamespace>\r
     </RootNamespace>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -50,7 +51,8 @@
   <ItemGroup>\r
     <Compile Include="..\..\build\common\Consts.cs" />\r
     <Compile Include="..\..\build\common\SR.cs" />\r
-    <Compile Include="Assembly\AssemblyInfo.cs" />\r  </ItemGroup>\r
+    <Compile Include="Assembly\AssemblyInfo.cs" />\r
+    <Compile Include="Assembly\TypeForwarders.cs" />\r  </ItemGroup>\r
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \r
        Other similar extension points exist, see Microsoft.Common.targets.\r
   <Target Name="BeforeBuild">\r
       <Project>{2762E921-91A8-4C87-91E9-BA628013F753}</Project>\r
       <Name>System-net_4_x</Name>\r
     </ProjectReference>\r
+    <ProjectReference Include="../System.Numerics/System.Numerics-net_4_x.csproj">\r
+      <Project>{BD2FFDDC-BD89-4041-82F5-A696C941C7BE}</Project>\r
+      <Name>System.Numerics-net_4_x</Name>\r
+    </ProjectReference>\r
   </ItemGroup>\r
   <ItemGroup>\r
     <Folder Include="Properties\" />\r
index 6fe1d3aa59a18d18af49651d7566b8caf2e1edca..7281ba9fca9f38328b07b57aa6fff6c13dde71c8 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -7,7 +8,7 @@
     <SchemaVersion>2.0</SchemaVersion>\r
     <ProjectGuid>{BD2FFDDC-BD89-4041-82F5-A696C941C7BE}</ProjectGuid>\r
     <OutputType>Library</OutputType>\r
-    <NoWarn>1699</NoWarn>\r
+    <NoWarn>1699,414</NoWarn>\r
     <OutputPath>./../../class/lib/net_4_x</OutputPath>\r
     <IntermediateOutputPath>obj-net_4_x</IntermediateOutputPath>\r
     <GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>\r
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
     <DebugSymbols>true</DebugSymbols>\r
     <DebugType>full</DebugType>\r
-    <NoWarn>1699</NoWarn>\r
+    <NoWarn>1699,414</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;MONO</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">\r
     <DebugType>pdbonly</DebugType>\r
-    <NoWarn>1699</NoWarn>\r
+    <NoWarn>1699,414</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;MONO</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
     <Compile Include="..\referencesource\System.Numerics\System\Numerics\BigIntegerBuilder.cs" />\r
     <Compile Include="..\referencesource\System.Numerics\System\Numerics\BigNumber.cs" />\r
     <Compile Include="..\referencesource\System.Numerics\System\Numerics\Complex.cs" />\r
+    <Compile Include="..\referencesource\System.Numerics\System\Numerics\HashCodeHelper.cs" />\r
+    <Compile Include="..\referencesource\System.Numerics\System\Numerics\JITIntrinsicAttribute.cs" />\r
+    <Compile Include="..\referencesource\System.Numerics\System\Numerics\Matrix3x2.cs" />\r
+    <Compile Include="..\referencesource\System.Numerics\System\Numerics\Matrix4x4.cs" />\r
     <Compile Include="..\referencesource\System.Numerics\System\Numerics\NumericsHelpers.cs" />\r
+    <Compile Include="..\referencesource\System.Numerics\System\Numerics\Plane.cs" />\r
+    <Compile Include="..\referencesource\System.Numerics\System\Numerics\Quaternion.cs" />\r
+    <Compile Include="..\referencesource\System.Numerics\System\Numerics\Vector_Operations.cs" />\r
+    <Compile Include="..\referencesource\System.Numerics\System\Numerics\Vector2.cs" />\r
+    <Compile Include="..\referencesource\System.Numerics\System\Numerics\Vector2_Intrinsics.cs" />\r
+    <Compile Include="..\referencesource\System.Numerics\System\Numerics\Vector3.cs" />\r
+    <Compile Include="..\referencesource\System.Numerics\System\Numerics\Vector3_Intrinsics.cs" />\r
+    <Compile Include="..\referencesource\System.Numerics\System\Numerics\Vector4.cs" />\r
+    <Compile Include="..\referencesource\System.Numerics\System\Numerics\Vector4_Intrinsics.cs" />\r
     <Compile Include="Assembly\AssemblyInfo.cs" />\r
-    <Compile Include="ReferenceSources\Environment.cs" />\r
     <Compile Include="ReferenceSources\SR.cs" />\r  </ItemGroup>\r
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \r
        Other similar extension points exist, see Microsoft.Common.targets.\r
index 7b3dfa248deb2b63a1acb932b86e6159e12da601..7140954c4c4c9f6d64b0e6b1600bf1ca7c323185 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT;SIGNED</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT;SIGNED</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT;SIGNED</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT;SIGNED</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 0fef571313a78994b8dd281b71353315ac4602ef..a291406715980f6b0f6b7d5cedbfa1e621bbf26a 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT;SIGNED</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT;SIGNED</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT;SIGNED</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT;SIGNED</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 55e768b3fa4272cb3b755836b19dbdcc238f2f88..532517ae77a9e59eedd51887c7ed04d9f817c72e 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT;SIGNED</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT;SIGNED</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT;SIGNED</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT;SIGNED</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index f0057b389b23ddf9bd27deccf199f90d5b71bfa8..583a3cb2ca7eb4965443e6454b7ff388673c604e 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT;SIGNED</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT;SIGNED</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT;SIGNED</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT;SIGNED</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 67b2b8a8844cc12c1ecf09fdb1ff9da5ae8edbae..4967b9c1c5b14b51a08097b825942e6701a6b467 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT;SIGNED</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT;SIGNED</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT;SIGNED</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT;SIGNED</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index fcff09f9daf815ddac9f5f1b5199b28bb053b0ab..3f4b1fb89a7948dfca0f9b9c9ff3e0ea5accbc05 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT;SIGNED</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT;SIGNED</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT;SIGNED</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT;SIGNED</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 538ff9529d94ea3bd5a2ad3e223c27f652e82fa0..1aeaee173c6aff75dc3a4ff12ae79b6600db6108 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT;SIGNED</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT;SIGNED</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT;SIGNED</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT;SIGNED</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 0099448bd54ccb6132e7b2184164293adc9b2ec2..49678ecfa408635cea70b94efd32c20b4e44e0b4 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT;SIGNED</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT;SIGNED</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT;SIGNED</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT;SIGNED</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 2802930f4d4ca978a4218700062546d9b54c76da..7268b7a376c6c433bcc17ecf88249673efcd6b98 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT;SIGNED</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT;SIGNED</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT;SIGNED</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT;SIGNED</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 6aacf0d324f2c8fdd73912eaab23c142523f3287..9b36305b41894f102020a3c696bbeddd86a4237d 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT;SIGNED</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT;SIGNED</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT;SIGNED</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT;SIGNED</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 2399dc270ca57124a3c099787d3a8175fd4cd871..d79683bf974d84f8e21ec5a6d1e1ebca2bde5fe2 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT;SIGNED</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT;SIGNED</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT;SIGNED</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT;SIGNED</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
diff --git a/mcs/class/System.Reflection.Context/System.Reflection.Context-net_4_x.csproj b/mcs/class/System.Reflection.Context/System.Reflection.Context-net_4_x.csproj
new file mode 100644 (file)
index 0000000..41317af
--- /dev/null
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
+  <PropertyGroup>\r
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>\r
+    <ProductVersion>9.0.30729</ProductVersion>\r
+    <SchemaVersion>2.0</SchemaVersion>\r
+    <ProjectGuid>{50A4818C-4BD7-49DB-AD2C-FF3FB0A9D392}</ProjectGuid>\r
+    <OutputType>Library</OutputType>\r
+    <NoWarn>1699</NoWarn>\r
+    <OutputPath>./../../class/lib/net_4_x</OutputPath>\r
+    <IntermediateOutputPath>obj-net_4_x</IntermediateOutputPath>\r
+    <GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>\r
+    <NoStdLib>True</NoStdLib>\r
+    \r
+    <NoConfig>True</NoConfig>\r
+    \r
+    <AppDesignerFolder>Properties</AppDesignerFolder>\r
+    <RootNamespace>\r
+    </RootNamespace>\r
+    <AssemblyName>System.Reflection.Context</AssemblyName>\r
+    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
+    <FileAlignment>512</FileAlignment>\r
+  </PropertyGroup>\r
+  \r
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
+    <DebugSymbols>true</DebugSymbols>\r
+    <DebugType>full</DebugType>\r
+    <NoWarn>1699</NoWarn>\r
+    <Optimize>false</Optimize>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
+    <ErrorReport>prompt</ErrorReport>\r
+    <WarningLevel>4</WarningLevel>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">\r
+    <DebugType>pdbonly</DebugType>\r
+    <NoWarn>1699</NoWarn>\r
+    <Optimize>true</Optimize>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
+    <ErrorReport>prompt</ErrorReport>\r
+    <WarningLevel>4</WarningLevel>\r
+  </PropertyGroup>\r
+  <!-- Set AddAdditionalExplicitAssemblyReferences to false, otherwise if targetting .NET4.0, \r
+  Microsoft.NETFramework.props will force a dependency on the assembly System.Core. This\r
+  is a problem to compile the Mono mscorlib.dll -->\r
+  <PropertyGroup>\r
+    <AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>\r
+  </PropertyGroup>\r
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />\r
+  <ItemGroup>\r
+    <Compile Include="..\..\build\common\Consts.cs" />\r
+    <Compile Include="..\..\build\common\Locale.cs" />\r
+    <Compile Include="..\..\build\common\MonoTODOAttribute.cs" />\r
+    <Compile Include="Assembly\AssemblyInfo.cs" />\r
+    <Compile Include="System.Reflection.Context\CustomReflectionContext.cs" />\r  </ItemGroup>\r
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \r
+       Other similar extension points exist, see Microsoft.Common.targets.\r
+  <Target Name="BeforeBuild">\r
+  </Target>\r
+  <Target Name="AfterBuild">\r
+  </Target>\r
+  -->\r
+  <PropertyGroup>\r
+    <PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
+
+    </PreBuildEvent>\r
+    <PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">\r
+\r
+    </PreBuildEvent>\r
+    <PostBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
+
+    </PostBuildEvent>\r
+    <PostBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">\r
+\r
+    </PostBuildEvent>\r
+  </PropertyGroup>\r
+  <ItemGroup>\r
+    <ProjectReference Include="../corlib/corlib-net_4_x.csproj">\r
+      <Project>{2CA6026B-2DC8-4C4C-A12C-1E8234049DB7}</Project>\r
+      <Name>corlib-net_4_x</Name>\r
+    </ProjectReference>\r
+    <ProjectReference Include="../System/System-net_4_x.csproj">\r
+      <Project>{2762E921-91A8-4C87-91E9-BA628013F753}</Project>\r
+      <Name>System-net_4_x</Name>\r
+    </ProjectReference>\r
+  </ItemGroup>\r
+  <ItemGroup>\r
+    <Folder Include="Properties\" />\r
+  </ItemGroup>\r
+</Project>\r
+
index 3089b404bdf517604d7f302d2fc44182f6ac7e4c..52c7a97872c7bc4ff046574d9b0cc9b8eb38574a 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,414</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,414</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
     <Compile Include="..\referencesource\System.Runtime.Caching\System\Caching\SafeBitVector32.cs" />\r
     <Compile Include="..\referencesource\System.Runtime.Caching\System\Caching\SafeRegistryHandle.cs" />\r
     <Compile Include="..\referencesource\System.Runtime.Caching\System\Caching\SqlChangeMonitor.cs" />\r
+    <Compile Include="..\referencesource\System.Runtime.Caching\System\Caching\SRef.cs" />\r
     <Compile Include="..\System.Web\System.Web.Configuration_2.0\NullableStringValidator.cs" />\r
     <Compile Include="Assembly\AssemblyInfo.cs" />\r
     <Compile Include="ReferenceSources\CacheEntryCollection.cs" />\r
     <Compile Include="ReferenceSources\CacheExpires.cs" />\r
     <Compile Include="ReferenceSources\CacheUsage.cs" />\r
-    <Compile Include="ReferenceSources\R.Designer.cs" />\r
-    <Compile Include="ReferenceSources\SRef.cs" />\r  </ItemGroup>\r
+    <Compile Include="ReferenceSources\R.Designer.cs" />\r  </ItemGroup>\r
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \r
        Other similar extension points exist, see Microsoft.Common.targets.\r
   <Target Name="BeforeBuild">\r
index 72f0502653ff20a5fbdbc762065705a8df2670fc..edeecbe4e5c1be47790c2b1240bd3a83eaba3be9 100644 (file)
@@ -55,7 +55,7 @@ using System.Runtime.InteropServices;
 [assembly: NeutralResourcesLanguage ("en-US")]
 [assembly: CLSCompliant (true)]
 [assembly: AssemblyDelaySign (true)]
-#if NET_2_1
+#if MOBILE
 [assembly: AssemblyKeyFile ("../silverlight.pub")]
 #else
 [assembly: AssemblyKeyFile ("../winfx.pub")]
index 480589216b314108be5f2287752892126350686b..2534e9c8a83d14576ba26d0403dd848127841151 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 21e80b5733e436012cda6b5477f9ef220c5c93c0..1a408f27117fac1a5cbac388c0d2d7cbd09aa258 100644 (file)
@@ -46,7 +46,7 @@ using System.Runtime.InteropServices;
 [assembly: AssemblyCompany (Consts.MonoCompany)]
 [assembly: AssemblyProduct (Consts.MonoProduct)]
 [assembly: AssemblyCopyright (Consts.MonoCopyright)]
-[assembly: AssemblyVersion (Consts.FxVersion)]
+[assembly: AssemblyVersion ("4.0.0.0")]
 [assembly: SatelliteContractVersion (Consts.FxVersion)]
 [assembly: AssemblyInformationalVersion (Consts.FxFileVersion)]
 [assembly: AssemblyFileVersion (Consts.FxFileVersion)]
diff --git a/mcs/class/System.Runtime.InteropServices.RuntimeInformation/System.Runtime.InteropServices.RuntimeInformation-net_4_x.csproj b/mcs/class/System.Runtime.InteropServices.RuntimeInformation/System.Runtime.InteropServices.RuntimeInformation-net_4_x.csproj
new file mode 100644 (file)
index 0000000..dda5c76
--- /dev/null
@@ -0,0 +1,94 @@
+<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
+  <PropertyGroup>\r
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>\r
+    <ProductVersion>9.0.30729</ProductVersion>\r
+    <SchemaVersion>2.0</SchemaVersion>\r
+    <ProjectGuid>{1E1BC1A8-EAD2-496C-A6D6-8AFABD741F56}</ProjectGuid>\r
+    <OutputType>Library</OutputType>\r
+    <NoWarn>1699</NoWarn>\r
+    <OutputPath>./../../class/lib/net_4_x</OutputPath>\r
+    <IntermediateOutputPath>obj-net_4_x</IntermediateOutputPath>\r
+    <GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>\r
+    <NoStdLib>True</NoStdLib>\r
+    \r
+    <NoConfig>True</NoConfig>\r
+    \r
+    <AppDesignerFolder>Properties</AppDesignerFolder>\r
+    <RootNamespace>\r
+    </RootNamespace>\r
+    <AssemblyName>System.Runtime.InteropServices.RuntimeInformation</AssemblyName>\r
+    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
+    <FileAlignment>512</FileAlignment>\r
+  </PropertyGroup>\r
+  \r
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
+    <DebugSymbols>true</DebugSymbols>\r
+    <DebugType>full</DebugType>\r
+    <NoWarn>1699</NoWarn>\r
+    <Optimize>false</Optimize>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
+    <ErrorReport>prompt</ErrorReport>\r
+    <WarningLevel>4</WarningLevel>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">\r
+    <DebugType>pdbonly</DebugType>\r
+    <NoWarn>1699</NoWarn>\r
+    <Optimize>true</Optimize>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
+    <ErrorReport>prompt</ErrorReport>\r
+    <WarningLevel>4</WarningLevel>\r
+  </PropertyGroup>\r
+  <!-- Set AddAdditionalExplicitAssemblyReferences to false, otherwise if targetting .NET4.0, \r
+  Microsoft.NETFramework.props will force a dependency on the assembly System.Core. This\r
+  is a problem to compile the Mono mscorlib.dll -->\r
+  <PropertyGroup>\r
+    <AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>\r
+  </PropertyGroup>\r
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />\r
+  <ItemGroup>\r
+    <Compile Include="..\..\build\common\Consts.cs" />\r
+    <Compile Include="..\..\build\common\Locale.cs" />\r
+    <Compile Include="..\..\build\common\MonoTODOAttribute.cs" />\r
+    <Compile Include="Assembly\AssemblyInfo.cs" />\r
+    <Compile Include="System.Runtime.InteropServices\Architecture.cs" />\r
+    <Compile Include="System.Runtime.InteropServices\OSPlatform.cs" />\r
+    <Compile Include="System.Runtime.InteropServices\RuntimeInformation.cs" />\r  </ItemGroup>\r
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \r
+       Other similar extension points exist, see Microsoft.Common.targets.\r
+  <Target Name="BeforeBuild">\r
+  </Target>\r
+  <Target Name="AfterBuild">\r
+  </Target>\r
+  -->\r
+  <PropertyGroup>\r
+    <PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
+
+    </PreBuildEvent>\r
+    <PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">\r
+\r
+    </PreBuildEvent>\r
+    <PostBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
+
+    </PostBuildEvent>\r
+    <PostBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">\r
+\r
+    </PostBuildEvent>\r
+  </PropertyGroup>\r
+  <ItemGroup>\r
+    <ProjectReference Include="../corlib/corlib-net_4_x.csproj">\r
+      <Project>{2CA6026B-2DC8-4C4C-A12C-1E8234049DB7}</Project>\r
+      <Name>corlib-net_4_x</Name>\r
+    </ProjectReference>\r
+    <ProjectReference Include="../System/System-net_4_x.csproj">\r
+      <Project>{2762E921-91A8-4C87-91E9-BA628013F753}</Project>\r
+      <Name>System-net_4_x</Name>\r
+    </ProjectReference>\r
+  </ItemGroup>\r
+  <ItemGroup>\r
+    <Folder Include="Properties\" />\r
+  </ItemGroup>\r
+</Project>\r
+
index 5601f7c47a15cf354274bdf16b14caf1f3f81306..9a8cb2a5f9c7d30c07641f3d882218ce5284cb0c 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 883ea72ebe25f4b079ae0a684e021cede538bda7..599edd8a8039f54801a5191592799319ee077632 100644 (file)
@@ -115,7 +115,8 @@ namespace System.Runtime.Remoting.Channels.Ipc.Win32
 
         public void StartListening(object data)
         {
-            serverChannel.StartListening(data);
+            if (serverChannel != null)
+                serverChannel.StartListening(data);
         }
 
         public object ChannelData
@@ -128,7 +129,8 @@ namespace System.Runtime.Remoting.Channels.Ipc.Win32
 
         public void StopListening(object data)
         {
-            serverChannel.StopListening(data);
+            if (serverChannel != null)
+                serverChannel.StopListening(data);
         }
 
         public string[] GetUrlsForUri(string objectURI)
index 089cd330b62162234109a3cec01b7df9f256053b..974caaaaa8b76eae21cd74f42d81abe1c68d169c 100644 (file)
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-
-using System;
 using System.Runtime.InteropServices;
 using System.Text;
+using System.Threading;
 
 namespace System.Runtime.Remoting.Channels.Ipc.Win32
 {
@@ -89,6 +88,7 @@ namespace System.Runtime.Remoting.Channels.Ipc.Win32
         public const uint OPEN_EXISTING     = 3;
         public const uint OPEN_ALWAYS       = 4;
         public const uint TRUNCATE_EXISTING = 5;
+           public const uint FILE_FLAG_OVERLAPPED = 0x40000000;
         
         // Access flags
         public const uint GENERIC_READ = 0x80000000;
@@ -103,6 +103,7 @@ namespace System.Runtime.Remoting.Channels.Ipc.Win32
         public const int ERROR_PIPE_NOT_CONNECTED = 233;
         public const int ERROR_PIPE_CONNECTED = 535;
         public const int ERROR_PIPE_LISTENING = 536;
+           public const int ERROR_IO_PENDING = 997;
 
         public const int INVALID_HANDLE_VALUE = -1;
 
@@ -121,7 +122,7 @@ namespace System.Runtime.Remoting.Channels.Ipc.Win32
         [DllImport("kernel32.dll", SetLastError = true)]
         public static extern bool ConnectNamedPipe(
             IntPtr hPipe,
-            IntPtr lpOverlapped
+            [In] ref NativeOverlapped lpOverlapped
             );
 
         [DllImport("kernel32.dll", SetLastError = true)]
index 8270e3d157fd3545cdc3e798508a7dbbcb3d3a6a..7170b7e932a49d84cfe164b96ed4f50405574159 100644 (file)
@@ -27,8 +27,8 @@
 //
 
 
-using System;
 using System.Runtime.InteropServices;
+using System.Threading;
 
 namespace System.Runtime.Remoting.Channels.Ipc.Win32
 {
@@ -74,7 +74,7 @@ namespace System.Runtime.Remoting.Channels.Ipc.Win32
         {
             IntPtr hPipe = NamedPipeHelper.CreateNamedPipe(
                 pipeName,
-                NamedPipeHelper.PIPE_ACCESS_DUPLEX,
+                NamedPipeHelper.PIPE_ACCESS_DUPLEX | NamedPipeHelper.FILE_FLAG_OVERLAPPED,
                 NamedPipeHelper.PIPE_TYPE_MESSAGE
                 | NamedPipeHelper.PIPE_READMODE_MESSAGE
                 | NamedPipeHelper.PIPE_WAIT,
@@ -85,27 +85,43 @@ namespace System.Runtime.Remoting.Channels.Ipc.Win32
                 IntPtr.Zero
                 );
 
-            if (hPipe.ToInt32() == NamedPipeHelper.INVALID_HANDLE_VALUE) 
-            {
-                throw new NamedPipeException();
+            if (hPipe.ToInt32 () == NamedPipeHelper.INVALID_HANDLE_VALUE) {
+                throw new NamedPipeException (Marshal.GetLastWin32Error ());
             }
 
-            bool canConnect = NamedPipeHelper.ConnectNamedPipe(hPipe, IntPtr.Zero);
-            int lastError = Marshal.GetLastWin32Error();
-            if (!canConnect && lastError == NamedPipeHelper.ERROR_PIPE_CONNECTED)
-                canConnect = true;
+                       // Connect the named pipe with overlapped structure
+                       // in order to make it altertable. This way we will
+                       // wake up when someone aborts a thread waiting 
+                       // for this pipe.
+                       NativeOverlapped overlapped = new NativeOverlapped ();
+            bool canConnect = NamedPipeHelper.ConnectNamedPipe (hPipe, ref overlapped);
 
-            if (canConnect) 
-            {
-                return new NamedPipeSocket(hPipe);
-            }
-            else 
-            {
-                NamedPipeHelper.CloseHandle(hPipe);
-                throw new NamedPipeException(lastError);
-            }
+            int lastError = Marshal.GetLastWin32Error ();
+                       if (!canConnect) {
+                               if (lastError == NamedPipeHelper.ERROR_IO_PENDING) {
+                                       uint bytesTransferred = 0;
+                                       if (!GetOverlappedResultEx (hPipe, ref overlapped, out bytesTransferred, Timeout.Infinite, true)) {
+                                               lastError = Marshal.GetLastWin32Error ();
+                                               NamedPipeHelper.CloseHandle (hPipe);
+                                               throw new NamedPipeException (lastError);
+                                       }
+                                       canConnect = true;
+                               } else if (lastError == NamedPipeHelper.ERROR_PIPE_CONNECTED)
+                                       canConnect = true;
+                       }
+
+                       if (!canConnect) {
+                               NamedPipeHelper.CloseHandle (hPipe);
+                               throw new NamedPipeException (lastError);
+                       }
+
+                       return new NamedPipeSocket (hPipe);
         }
 
+               [DllImport("kernel32.dll", SetLastError = true)]
+               static extern bool GetOverlappedResultEx (IntPtr hFile, [In] ref System.Threading.NativeOverlapped lpOverlapped,
+                                                                                                 out uint lpNumberOfBytesTransferred, int dwMilliseconds, bool bAltertable);
+
     }
 }
 
index cab5d34208680ac5f12accbe69744d2238c513cc..2ca12fb601a69ce9e90cc073953f6e34ac86690c 100644 (file)
@@ -71,7 +71,12 @@ namespace System.Runtime.Remoting.Channels.Tcp
                                        else {
                                                IPHostEntry he = Dns.Resolve (Dns.GetHostName());
                                                if (he.AddressList.Length == 0) throw new RemotingException ("IP address could not be determined for this host");
-                                               host = he.AddressList [0].ToString ();
+                                               AddressFamily addressFamily = (Socket.OSSupportsIPv4) ? AddressFamily.InterNetwork : AddressFamily.InterNetworkV6;
+                                               IPAddress addr = GetMachineAddress (he, addressFamily);
+                                               if (addr != null)
+                                                       host = addr.ToString ();
+                                               else
+                                                       host = he.AddressList [0].ToString ();
                                        }
                                }
                                else
@@ -259,6 +264,22 @@ namespace System.Runtime.Remoting.Channels.Tcp
                        server_thread.Join ();
                        server_thread = null;                   
                }
+
+               private static IPAddress GetMachineAddress (IPHostEntry host, AddressFamily addressFamily)
+               {
+                       IPAddress result = null;
+                       if (host != null) {
+                               IPAddress[] addressList = host.AddressList;
+                               for (int i = 0; i < addressList.Length; i++) {
+                                       if (addressList[i].AddressFamily == addressFamily) {
+                                               result = addressList[i];
+                                               break;
+                                       }
+                               }
+                       }
+
+                       return result;
+               }
        }
 
        class ClientConnection
index ff09e03824c327e865236b5a4b8568bdfb3bd3a6..8aae7d9e602904bd3c5b2c4e181e210051db3ffb 100644 (file)
@@ -1,3 +1,4 @@
+../../test-helpers/NunitHelpers.cs
 System.Runtime.Remoting.Channels.Tcp/TcpChannelTest.cs
 ServerObject.cs
 ContextsTest.cs
index 68930b0d640addd065d2408c87f3790d3fe5d006..c809f96c9401173bd5de5f7a6817026bd9291f24 100644 (file)
@@ -169,16 +169,12 @@ namespace MonoTests.Remoting.Http
                public void Main ()
                {
                        channel = new HttpChannel (0);
-                       try {
                        ChannelServices.RegisterChannel (channel);
                        MarshalByRefObject obj = (MarshalByRefObject) RemotingServices.Connect (
                                typeof (IFactorial),
                                "http://localhost:60000/MyEndPoint");
                        IFactorial cal = (IFactorial) obj;
-                       Assert.AreEqual (cal.CalculateFactorial (4), 24); 
-                       } finally {
-                       ChannelServices.UnregisterChannel (channel);
-                       }
+                       Assert.AreEqual (cal.CalculateFactorial (4), 24);
                }
                
                [TestFixtureSetUp]
index 831c69e72b54f79b0b9b454ec152261ea9864cc1..45f76791b7cf6841752a917937f876b03e70b52e 100644 (file)
@@ -78,7 +78,7 @@ namespace MonoTests.Remoting
                        IpcServerChannel chan = new IpcServerChannel (channelName, portName);
                        string[] uris = chan.GetUrlsForUri ("server.rem");
                        Assert.IsNotNull (uris);
-                       Assert.Greater (uris.Length, 0);
+                       AssertHelper.Greater (uris.Length, 0);
 
                        bool found = false;
                        foreach (string s in uris) {
@@ -101,7 +101,7 @@ namespace MonoTests.Remoting
                        IpcChannel chan = new IpcChannel (props, null, null);
                        string[] uris = chan.GetUrlsForUri ("server.rem");
                        Assert.IsNotNull (uris);
-                       Assert.Greater (uris.Length, 0);
+                       AssertHelper.Greater (uris.Length, 0);
 
                        bool found = false;
                        foreach (string s in uris) {
index f9ad75cd3ac4a05f55b984212b19982d795a576a..02c6a532c00ce24d94a757b312892a2df1920c86 100644 (file)
@@ -193,7 +193,7 @@ namespace MonoTests.Remoting
 \r
        // The main test class\r
        [TestFixture]\r
-       public class RemotingServicesTest : Assertion\r
+       public class RemotingServicesTest\r
        {\r
                private static int MarshalObjectId = 0;\r
 \r
@@ -233,13 +233,13 @@ namespace MonoTests.Remoting
                        MarshalObject objMarshal = NewMarshalObject ();\r
                        ObjRef objRef = RemotingServices.Marshal (objMarshal);\r
 \r
-                       Assert ("#A01", objRef.URI != null);\r
+                       Assert.IsNotNull (objRef.URI, "#A01");\r
 \r
                        MarshalObject objRem = (MarshalObject) RemotingServices.Unmarshal (objRef);\r
-                       AssertEquals ("#A02", objMarshal.Id, objRem.Id);\r
+                       Assert.AreEqual (objMarshal.Id, objRem.Id, "#A02");\r
 \r
                        objRem.Id = 2;\r
-                       AssertEquals ("#A03", objMarshal.Id, objRem.Id);\r
+                       Assert.AreEqual (objMarshal.Id, objRem.Id, "#A03");\r
 \r
                        // TODO: uncomment when RemotingServices.Disconnect is implemented\r
                        //RemotingServices.Disconnect(objMarshal);\r
@@ -248,7 +248,7 @@ namespace MonoTests.Remoting
 \r
                        objRef = RemotingServices.Marshal (objMarshal, objMarshal.Uri);\r
 \r
-                       Assert ("#A04", objRef.URI.EndsWith (objMarshal.Uri));\r
+                       Assert.IsTrue (objRef.URI.EndsWith (objMarshal.Uri), "#A04");\r
                        // TODO: uncomment when RemotingServices.Disconnect is implemented\r
                        //RemotingServices.Disconnect(objMarshal);\r
                }\r
@@ -261,7 +261,7 @@ namespace MonoTests.Remoting
                        ObjRef objRef = RemotingServices.Marshal (derivedObjMarshal, derivedObjMarshal.Uri, typeof (MarshalObject));\r
 \r
                        // Check that the type of the marshaled object is MarshalObject\r
-                       Assert ("#A05", objRef.TypeInfo.TypeName.StartsWith ((typeof (MarshalObject)).ToString ()));\r
+                       Assert.IsTrue (objRef.TypeInfo.TypeName.StartsWith ((typeof (MarshalObject)).ToString ()), "#A05");\r
 \r
                        // TODO: uncomment when RemotingServices.Disconnect is implemented\r
                        //RemotingServices.Disconnect(derivedObjMarshal);\r
@@ -273,11 +273,11 @@ namespace MonoTests.Remoting
                {\r
                        MarshalObject objMarshal = NewMarshalObject ();\r
 \r
-                       Assert ("#A06", RemotingServices.GetObjectUri (objMarshal) == null);\r
+                       Assert.IsNull (RemotingServices.GetObjectUri (objMarshal), "#A06");\r
 \r
                        RemotingServices.Marshal (objMarshal);\r
 \r
-                       Assert ("#A07", RemotingServices.GetObjectUri (objMarshal) != null);\r
+                       Assert.IsNotNull (RemotingServices.GetObjectUri (objMarshal), "#A07");\r
                        // TODO: uncomment when RemotingServices.Disconnect is implemented\r
                        //RemotingServices.Disconnect(objMarshal);\r
                }\r
@@ -297,7 +297,7 @@ namespace MonoTests.Remoting
                        try {\r
                                RemotingServices.Marshal (objMarshal, objMarshal.Uri);\r
                                MarshalObject objRem = (MarshalObject) RemotingServices.Connect (typeof (MarshalObject), "tcp://localhost:1236/" + objMarshal.Uri);\r
-                               Assert ("#A08", RemotingServices.IsTransparentProxy (objRem));\r
+                               Assert.IsTrue (RemotingServices.IsTransparentProxy (objRem), "#A08");\r
                        } finally {\r
                                ChannelServices.UnregisterChannel (chn);\r
                                RemotingServices.Disconnect (objMarshal);\r
@@ -324,7 +324,7 @@ namespace MonoTests.Remoting
                                // a real object\r
                                try {\r
                                        RemotingServices.Marshal (objRem, objMarshal.Uri);\r
-                                       Fail ("#1");\r
+                                       Assert.Fail ("#1");\r
                                } catch (RemotingException e) {\r
                                }\r
                        } finally {\r
@@ -355,15 +355,15 @@ namespace MonoTests.Remoting
                                objRem.Method1 ();\r
 \r
                                // Tests RemotingServices.GetMethodBaseFromMethodMessage()\r
-                               AssertEquals ("#A09", "Method1", proxy.MthBase.Name);\r
-                               Assert ("#A09.1", !proxy.IsMethodOverloaded);\r
+                               Assert.AreEqual ("Method1", proxy.MthBase.Name, "#A09");\r
+                               Assert.IsFalse (proxy.IsMethodOverloaded, "#A09.1");\r
 \r
                                objRem.Method2 ();\r
-                               Assert ("#A09.2", proxy.IsMethodOverloaded);\r
+                               Assert.IsTrue (proxy.IsMethodOverloaded, "#A09.2");\r
 \r
                                // Tests RemotingServices.ExecuteMessage();\r
                                // If ExecuteMessage does it job well, Method1 should be called 2 times\r
-                               AssertEquals ("#A10", 2, MarshalObject.Called);\r
+                               Assert.AreEqual (2, MarshalObject.Called, "#A10");\r
                        } finally {\r
                                ChannelServices.UnregisterChannel (chn);\r
                        }\r
@@ -380,14 +380,14 @@ namespace MonoTests.Remoting
 \r
                                MarshalObject objRem = (MarshalObject) Activator.GetObject (typeof (MarshalObject), "tcp://localhost:1238/MarshalObject.rem");\r
 \r
-                               Assert ("#A10.1", RemotingServices.IsTransparentProxy (objRem));\r
+                               Assert.IsTrue (RemotingServices.IsTransparentProxy (objRem), "#A10.1");\r
 \r
                                objRem.Method1 ();\r
                                Thread.Sleep (20);\r
-                               Assert ("#A10.2", !MarshalObject.IsMethodOneWay);\r
+                               Assert.IsFalse (MarshalObject.IsMethodOneWay, "#A10.2");\r
                                objRem.Method3 ();\r
                                Thread.Sleep (20);\r
-                               Assert ("#A10.3", MarshalObject.IsMethodOneWay);\r
+                               Assert.IsTrue (MarshalObject.IsMethodOneWay, "#A10.3");\r
                        } finally {\r
                                ChannelServices.UnregisterChannel (chn);\r
                        }\r
@@ -409,7 +409,7 @@ namespace MonoTests.Remoting
 \r
                                ObjRef objRefRem = RemotingServices.GetObjRefForProxy ((MarshalByRefObject) objRem);\r
 \r
-                               Assert ("#A11", objRefRem != null);\r
+                               Assert.IsNotNull (objRefRem, "#A11");\r
                        } finally {\r
                                ChannelServices.UnregisterChannel (chn);\r
                        }\r
@@ -429,8 +429,8 @@ namespace MonoTests.Remoting
 \r
                                RealProxy rp = RemotingServices.GetRealProxy (objRem);\r
 \r
-                               Assert ("#A12", rp != null);\r
-                               AssertEquals ("#A13", "MonoTests.System.Runtime.Remoting.RemotingServicesInternal.MyProxy", rp.GetType ().ToString ());\r
+                               Assert.IsNotNull (rp, "#A12");\r
+                               Assert.AreEqual ("MonoTests.System.Runtime.Remoting.RemotingServicesInternal.MyProxy", rp.GetType ().ToString (), "#A13");\r
                        } finally {\r
                                ChannelServices.UnregisterChannel (chn);\r
                        }\r
@@ -448,7 +448,7 @@ namespace MonoTests.Remoting
                                RemotingServices.Marshal (objRem);\r
 \r
                                objRem = (MarshalObject) Activator.GetObject (typeof (MarshalObject), "tcp://localhost:1242/" + objRem.Uri);\r
-                               Assert ("#A14", objRem != null);\r
+                               Assert.IsNotNull (objRem, "#A14");\r
                        } finally {\r
                                ChannelServices.UnregisterChannel (chn);\r
                        }\r
@@ -468,7 +468,7 @@ namespace MonoTests.Remoting
                                RemotingServices.Marshal (objRem);\r
 \r
                                Type typeRem = RemotingServices.GetServerTypeForUri (RemotingServices.GetObjectUri (objRem));\r
-                               AssertEquals ("#A15", type, typeRem);\r
+                               Assert.AreEqual (type, typeRem, "#A15");\r
                        } finally {\r
                                ChannelServices.UnregisterChannel (chn);\r
                        }\r
@@ -487,12 +487,12 @@ namespace MonoTests.Remoting
 \r
                                MarshalObject objRem = (MarshalObject) Activator.GetObject (typeof (MarshalObject), "tcp://localhost:1245/MarshalObject2.rem");\r
 \r
-                               Assert ("#A16", RemotingServices.IsObjectOutOfAppDomain (objRem));\r
-                               Assert ("#A17", RemotingServices.IsObjectOutOfContext (objRem));\r
+                               Assert.IsTrue (RemotingServices.IsObjectOutOfAppDomain (objRem), "#A16");\r
+                               Assert.IsTrue (RemotingServices.IsObjectOutOfContext (objRem), "#A17");\r
 \r
                                MarshalObject objMarshal = new MarshalObject ();\r
-                               Assert ("#A18", !RemotingServices.IsObjectOutOfAppDomain (objMarshal));\r
-                               Assert ("#A19", !RemotingServices.IsObjectOutOfContext (objMarshal));\r
+                               Assert.IsFalse (RemotingServices.IsObjectOutOfAppDomain (objMarshal), "#A18");\r
+                               Assert.IsFalse (RemotingServices.IsObjectOutOfContext (objMarshal), "#A19");\r
                        } finally {\r
                                ChannelServices.UnregisterChannel (chn);\r
                        }\r
@@ -510,16 +510,16 @@ namespace MonoTests.Remoting
                                MarshalObject objRem = (MarshalObject) Activator.GetObject (typeof (MarshalObject), "tcp://localhost:1246/app/obj3.rem");\r
                                MarshalObject objRem2 = (MarshalObject) Activator.GetObject (typeof (MarshalObject), "tcp://localhost:1246/obj3.rem");\r
 \r
-                               Assert ("#AN1", RemotingServices.IsTransparentProxy (objRem));\r
-                               Assert ("#AN2", RemotingServices.IsTransparentProxy (objRem2));\r
+                               Assert.IsTrue (RemotingServices.IsTransparentProxy (objRem), "#AN1");\r
+                               Assert.IsTrue (RemotingServices.IsTransparentProxy (objRem2), "#AN2");\r
 \r
-                               AssertNotNull ("#AN3", RemotingServices.GetServerTypeForUri ("obj3.rem"));\r
-                               AssertNotNull ("#AN4", RemotingServices.GetServerTypeForUri ("/app/obj3.rem"));\r
-                               AssertNull ("#AN5", RemotingServices.GetServerTypeForUri ("//app/obj3.rem"));\r
-                               AssertNull ("#AN6", RemotingServices.GetServerTypeForUri ("app/obj3.rem"));\r
-                               AssertNull ("#AN7", RemotingServices.GetServerTypeForUri ("/whatever/obj3.rem"));\r
-                               AssertNotNull ("#AN8", RemotingServices.GetServerTypeForUri ("/obj3.rem"));\r
-                               AssertNull ("#AN9", RemotingServices.GetServerTypeForUri ("//obj3.rem"));\r
+                               Assert.IsNotNull (RemotingServices.GetServerTypeForUri ("obj3.rem"), "#AN3");\r
+                               Assert.IsNotNull (RemotingServices.GetServerTypeForUri ("/app/obj3.rem"), "#AN4");\r
+                               Assert.IsNull (RemotingServices.GetServerTypeForUri ("//app/obj3.rem"), "#AN5");\r
+                               Assert.IsNull (RemotingServices.GetServerTypeForUri ("app/obj3.rem"), "#AN6");\r
+                               Assert.IsNull (RemotingServices.GetServerTypeForUri ("/whatever/obj3.rem"), "#AN7");\r
+                               Assert.IsNotNull (RemotingServices.GetServerTypeForUri ("/obj3.rem"), "#AN8");\r
+                               Assert.IsNull (RemotingServices.GetServerTypeForUri ("//obj3.rem"), "#AN9");\r
                        } finally {\r
                                ChannelServices.UnregisterChannel (chn);\r
                        }\r
@@ -534,7 +534,7 @@ namespace MonoTests.Remoting
                                RemotingConfiguration.RegisterWellKnownServiceType (typeof (MarshalObject), "getobjectwithchanneldata.rem", WellKnownObjectMode.Singleton);\r
 \r
                                string channelData = "test";\r
-                               AssertNotNull ("#01", Activator.GetObject (typeof (MarshalObject), "tcp://localhost:1247/getobjectwithchanneldata.rem", channelData));\r
+                               Assert.IsNotNull (Activator.GetObject (typeof (MarshalObject), "tcp://localhost:1247/getobjectwithchanneldata.rem", channelData), "#01");\r
                        } finally {\r
                                ChannelServices.UnregisterChannel (chn);\r
                        }\r
@@ -548,28 +548,28 @@ namespace MonoTests.Remoting
                        RemotingConfiguration.Configure (null);\r
 \r
                        o = RemotingServices.Connect (typeof (MarshalByRefObject), "tcp://localhost:3434/ff1.rem");\r
-                       Assert ("#m1", o is DD);\r
-                       Assert ("#m2", o is A);\r
-                       Assert ("#m3", o is B);\r
-                       Assert ("#m4", !(o is CC));\r
+                       Assert.IsInstanceOfType (typeof (DD), o, "#m1");\r
+                       Assert.IsInstanceOfType (typeof (A), o, "#m2");\r
+                       Assert.IsInstanceOfType (typeof (B), o, "#m3");\r
+                       AssertHelper.IsNotInstanceOfType (typeof (CC), !(o is CC), "#m4");\r
 \r
                        o = RemotingServices.Connect (typeof (A), "tcp://localhost:3434/ff3.rem");\r
-                       Assert ("#a1", o is DD);\r
-                       Assert ("#a2", o is A);\r
-                       Assert ("#a3", o is B);\r
-                       Assert ("#a4", !(o is CC));\r
+                       Assert.IsInstanceOfType (typeof (DD), o, "#a1");\r
+                       Assert.IsInstanceOfType (typeof (A), o, "#a2");\r
+                       Assert.IsInstanceOfType (typeof (B), o, "#a3");\r
+                       AssertHelper.IsNotInstanceOfType (typeof (CC), o, "#a4");\r
 \r
                        o = RemotingServices.Connect (typeof (DD), "tcp://localhost:3434/ff4.rem");\r
-                       Assert ("#d1", o is DD);\r
-                       Assert ("#d2", o is A);\r
-                       Assert ("#d3", o is B);\r
-                       Assert ("#d4", !(o is CC));\r
+                       Assert.IsInstanceOfType (typeof (DD), o, "#d1");\r
+                       Assert.IsInstanceOfType (typeof (A), o, "#d2");\r
+                       Assert.IsInstanceOfType (typeof (B), o, "#d3");\r
+                       AssertHelper.IsNotInstanceOfType (typeof (CC), o, "#d4");\r
 \r
                        o = RemotingServices.Connect (typeof (CC), "tcp://localhost:3434/ff5.rem");\r
-                       Assert ("#c1", !(o is DD));\r
-                       Assert ("#c2", o is A);\r
-                       Assert ("#c3", o is B);\r
-                       Assert ("#c4", o is CC);\r
+                       AssertHelper.IsNotInstanceOfType (typeof (DD), o, "#c1");\r
+                       Assert.IsInstanceOfType (typeof (A), o, "#c2");\r
+                       Assert.IsInstanceOfType (typeof (B), o, "#c3");\r
+                       Assert.IsInstanceOfType (typeof (CC), o, "#c4");\r
                }\r
                // Don't add any tests that must create channels\r
                // after ConnectProxyCast (), because this test calls\r
index d5192c051b056e3b62ef93bccd3533541c3a95ce..6f52faac5a89b232d5f1801eb2223c492688f085 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index bc2dc31dae842ba60fd7dfa13f9dfd37961030fd..5995195a22e3cde5b56578d389fda76f64c180f4 100644 (file)
@@ -55,7 +55,7 @@ using System.Runtime.InteropServices;
 [assembly: NeutralResourcesLanguage ("en-US")]
 [assembly: CLSCompliant (true)]
 [assembly: AssemblyDelaySign (true)]
-#if NET_2_1
+#if MOBILE
 [assembly: AssemblyKeyFile ("../silverlight.pub")]
 #else
 [assembly: AssemblyKeyFile ("../ecma.pub")]
index 74ed3335acb89306584341d1642cb1371a64b870..19da4ee2235bf1c77971ebe32cb77cf6e94aa002 100644 (file)
@@ -55,6 +55,11 @@ namespace System.Runtime.Serialization
             return false;
         }
 
+        internal static void AddDefaultXmlType(XmlSchemaSet schemas, string localName, string ns)
+        {
+            throw new NotImplementedException();
+        }
+
         static bool InvokeSchemaProviderMethod(Type clrType, XmlSchemaSet schemas, out XmlQualifiedName stableName, out XmlSchemaType xsdType, out bool hasRoot)
         {
             xsdType = null;
diff --git a/mcs/class/System.Runtime.Serialization/ReferenceSources/XsdDataContractExporter_mobile.cs b/mcs/class/System.Runtime.Serialization/ReferenceSources/XsdDataContractExporter_mobile.cs
new file mode 100644 (file)
index 0000000..bc1bf43
--- /dev/null
@@ -0,0 +1,54 @@
+//
+// XsdDataContractExporter_mobile.cs
+//
+// Authors:
+//     Alexander Köplinger <alexander.koeplinger@xamarin.com>
+//
+// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com)
+//
+// 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.Reflection;
+using System.Xml;
+using System.Xml.Schema;
+
+namespace System.Runtime.Serialization
+{
+       public class XsdDataContractExporter
+       {
+               public XsdDataContractExporter () { throw new NotImplementedException (); }
+               public XsdDataContractExporter (XmlSchemaSet schemas) { throw new NotImplementedException (); }
+               public ExportOptions Options { get { throw new NotImplementedException (); } set { throw new NotImplementedException (); } }
+               public XmlSchemaSet Schemas { get { throw new NotImplementedException (); } }
+               public bool CanExport (ICollection<Assembly> assemblies) { throw new NotImplementedException ();}
+               public bool CanExport (ICollection<Type> types) { throw new NotImplementedException (); }
+               public bool CanExport (Type type) { throw new NotImplementedException (); }
+               public void Export (ICollection<Assembly> assemblies) { throw new NotImplementedException (); }
+               public void Export (ICollection<Type> types) { throw new NotImplementedException (); }
+               public void Export (Type type) { throw new NotImplementedException (); }
+               public XmlQualifiedName GetRootElementName (Type type) { throw new NotImplementedException (); }
+               public XmlSchemaType GetSchemaType (Type type) { throw new NotImplementedException (); }
+               public XmlQualifiedName GetSchemaTypeName (Type type) { throw new NotImplementedException (); }
+       }
+}
+
index f5de8b68d7f091c236651c67a4557732dffa711c..f0198c0ada57881b59b93e2896ecf3c37369b715 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,168,169,219,414</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;NO_DYNAMIC_CODEGEN;NET_3_0</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;NO_DYNAMIC_CODEGEN;NET_3_0</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,168,169,219,414</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;NO_DYNAMIC_CODEGEN;NET_3_0</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;NO_DYNAMIC_CODEGEN;NET_3_0</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
     <Compile Include="ReferenceSources\FxTrace.cs" />\r
     <Compile Include="ReferenceSources\JsonFormatReaderGenerator_static.cs" />\r
     <Compile Include="ReferenceSources\JsonFormatWriterGenerator_static.cs" />\r
+    <Compile Include="ReferenceSources\LocalAppContextSwitches.cs" />\r
     <Compile Include="ReferenceSources\SR.cs" />\r
     <Compile Include="ReferenceSources\SR.missing.cs" />\r
     <Compile Include="ReferenceSources\XmlDataContract_static.cs" />\r
       <Project>{5769B536-7E8E-4C2A-8671-6B256D0F620B}</Project>\r
       <Name>System.ServiceModel.Internals-net_4_x</Name>\r
     </ProjectReference>\r
-    <ProjectReference Include="../SMDiagnostics/SMDiagnostics-net_4_x.csproj">\r
-      <Project>{8B8C3ED9-96F9-49B3-B355-9FD3D29DD3AD}</Project>\r
-      <Name>SMDiagnostics-net_4_x</Name>\r
-    </ProjectReference>\r
     <ProjectReference Include="../System.Data/System.Data-net_4_x.csproj">\r
       <Project>{EC439BB8-FFED-4A32-A05D-2FA3A70CAD64}</Project>\r
       <Name>System.Data-net_4_x</Name>\r
       <Project>{D5CDC09C-F19A-4811-A6C8-70F51CBFB644}</Project>\r
       <Name>System.Configuration-net_4_x</Name>\r
     </ProjectReference>\r
+    <ProjectReference Include="../SMDiagnostics/SMDiagnostics-net_4_x.csproj">\r
+      <Project>{8B8C3ED9-96F9-49B3-B355-9FD3D29DD3AD}</Project>\r
+      <Name>SMDiagnostics-net_4_x</Name>\r
+    </ProjectReference>\r
   </ItemGroup>\r
   <ItemGroup>\r
     <Folder Include="Properties\" />\r
index 7a3834dd93c94c871a4c0cbd973d0ea053c1a6b6..cda78a94112d9d0ccba703a3516833a184940830 100644 (file)
@@ -38,9 +38,6 @@ using System.Runtime.Serialization;
 using System.ServiceModel;
 using NUnit.Framework;
 using NUnit.Framework.Constraints;
-#if !MOBILE
-using NUnit.Framework.SyntaxHelpers;
-#endif
 
 namespace MonoTests.System.Runtime.Serialization
 {
index 6a9b66a6485cfa4b050f788b6ced91d33a28ae9c..394d7d48ad056c2ba8e5be0c6362cf86e978b8b1 100644 (file)
@@ -44,7 +44,6 @@ using System.Xml.Serialization;
 using Microsoft.CSharp;
 using NUnit.Framework;
 using NUnit.Framework.Constraints;
-using NUnit.Framework.SyntaxHelpers;
 
 using QName = System.Xml.XmlQualifiedName;
 
@@ -67,7 +66,7 @@ namespace MonoTests.System.Runtime.Serialization
                        var type = exporter.Schemas.GlobalTypes [typeName];
 
                        Assert.That (type, Is.Not.Null, "#2");
-                       Assert.That (type, Is.InstanceOfType (typeof (XmlSchemaComplexType)), "#3");
+                       Assert.IsInstanceOfType (typeof (XmlSchemaComplexType), type, "#3");
 
                        var complex = (XmlSchemaComplexType)type;
                        Assert.That (complex.Annotation, Is.Null, "#4");
@@ -83,16 +82,16 @@ namespace MonoTests.System.Runtime.Serialization
                        Assert.That (list, Is.Not.Null, "#6");
                        Assert.That (list.Annotation, Is.Null, "#6a");
                        Assert.That (list.Name, Is.EqualTo ("list"), "#6b");
-                       Assert.That (list.ElementSchemaType, Is.InstanceOfType (typeof (XmlSchemaComplexType)), "#6c");
+                       Assert.IsInstanceOfType (typeof (XmlSchemaComplexType), list.ElementSchemaType, "#6c");
 
                        var listElement = (XmlSchemaComplexType)list.ElementSchemaType;
                        Assert.That (listElement.QualifiedName.Namespace, Is.EqualTo (MSArraysNamespace), "#6d");
                        Assert.That (listElement.QualifiedName.Name, Is.EqualTo ("ArrayOfint"), "#6e");
 
-                       Assert.That (listElement.Particle, Is.InstanceOfType (typeof(XmlSchemaSequence)), "#7");
+                       Assert.IsInstanceOfType (typeof(XmlSchemaSequence), listElement.Particle, "#7");
                        var listSeq = (XmlSchemaSequence)listElement.Particle;
                        Assert.That (listSeq.Items.Count, Is.EqualTo (1), "#7b");
-                       Assert.That (listSeq.Items[0], Is.InstanceOfType (typeof(XmlSchemaElement)), "#7c");
+                       Assert.IsInstanceOfType (typeof(XmlSchemaElement), listSeq.Items[0], "#7c");
                        Assert.That (listSeq.Annotation, Is.Null, "#7d");
 
                        var listSeqElement = (XmlSchemaElement)listSeq.Items[0];
@@ -103,16 +102,16 @@ namespace MonoTests.System.Runtime.Serialization
                        Assert.That (dict, Is.Not.Null, "#8");
                        Assert.That (dict.Annotation, Is.Null, "#8a");
                        Assert.That (dict.Name, Is.EqualTo ("dictionary"), "#8b");
-                       Assert.That (dict.ElementSchemaType, Is.InstanceOfType (typeof (XmlSchemaComplexType)), "#8c");
+                       Assert.IsInstanceOfType (typeof (XmlSchemaComplexType), dict.ElementSchemaType, "#8c");
                        
                        var dictElement = (XmlSchemaComplexType)dict.ElementSchemaType;
                        Assert.That (dictElement.QualifiedName.Namespace, Is.EqualTo (MSArraysNamespace), "#8d");
                        Assert.That (dictElement.QualifiedName.Name, Is.EqualTo ("ArrayOfKeyValueOfstringdouble"), "#8e");
 
-                       Assert.That (dictElement.Particle, Is.InstanceOfType (typeof(XmlSchemaSequence)), "#9");
+                       Assert.IsInstanceOfType (typeof(XmlSchemaSequence), dictElement.Particle, "#9");
                        var dictSeq = (XmlSchemaSequence)dictElement.Particle;
                        Assert.That (dictSeq.Items.Count, Is.EqualTo (1), "#9b");
-                       Assert.That (dictSeq.Items[0], Is.InstanceOfType (typeof(XmlSchemaElement)), "#9c");
+                       Assert.IsInstanceOfType (typeof(XmlSchemaElement), dictSeq.Items[0], "#9c");
                        Assert.That (dictSeq.Annotation, Is.Null, "#9d");
                        
                        var dictSeqElement = (XmlSchemaElement)dictSeq.Items[0];
@@ -124,7 +123,7 @@ namespace MonoTests.System.Runtime.Serialization
                        Assert.That (custom, Is.Not.Null, "#10");
                        Assert.That (custom.Annotation, Is.Null, "#10a");
                        Assert.That (custom.Name, Is.EqualTo ("customCollection"), "#10b");
-                       Assert.That (custom.ElementSchemaType, Is.InstanceOfType (typeof (XmlSchemaComplexType)), "#10c");
+                       Assert.IsInstanceOfType (typeof (XmlSchemaComplexType), custom.ElementSchemaType, "#10c");
                        
                        var customElement = (XmlSchemaComplexType)custom.ElementSchemaType;
                        var customEQN = customElement.QualifiedName;
@@ -132,10 +131,10 @@ namespace MonoTests.System.Runtime.Serialization
                        Assert.That (customEQN.Name.StartsWith ("XsdDataContractExporterTest2.MyCollectionOfstring", StringComparison.InvariantCultureIgnoreCase),
                                     Is.True, "#10e");
 
-                       Assert.That (customElement.Particle, Is.InstanceOfType (typeof(XmlSchemaSequence)), "#11");
+                       Assert.IsInstanceOfType (typeof(XmlSchemaSequence), customElement.Particle, "#11");
                        var customSeq = (XmlSchemaSequence)customElement.Particle;
                        Assert.That (customSeq.Items.Count, Is.EqualTo (1), "#11b");
-                       Assert.That (customSeq.Items[0], Is.InstanceOfType (typeof(XmlSchemaElement)), "#11c");
+                       Assert.IsInstanceOfType (typeof(XmlSchemaElement), customSeq.Items[0], "#11c");
                        Assert.That (customSeq.Annotation, Is.Null, "#11d");
                        
                        var customSeqElement = (XmlSchemaElement)customSeq.Items[0];
index bee52d3e4f896eb4a66a1f00b47fe8b14c7b33b4..7e86906afe3b68b833efa3f65e439a6c9ebdd379 100644 (file)
@@ -43,7 +43,6 @@ using System.Xml.Serialization;
 using Microsoft.CSharp;
 using NUnit.Framework;
 using NUnit.Framework.Constraints;
-using NUnit.Framework.SyntaxHelpers;
 
 using QName = System.Xml.XmlQualifiedName;
 
index c0c73b07ad060fd22023aa3448912020fa0071df..bc4259a994c55a6d42e1e290835bd9f7dd7ebfac 100644 (file)
@@ -2,4 +2,5 @@
 #include ReferenceSource.common.sources
 
 ReferenceSources/SchemaExporter_mobile.cs
+ReferenceSources/XsdDataContractExporter_mobile.cs
 ReferenceSources/SimplifiedCodeTypeReference.cs
index 5c009acb56608c1d391e86faea97071af7e3f33e..145f30f4b6ccd9d7acf6a9c1650b765c85b89d6e 100644 (file)
@@ -2,8 +2,13 @@ thisdir = class/System.Security
 SUBDIRS = 
 include ../../build/rules.make
 
+ifndef NO_MONO_SECURITY
+MONO_SECURITY_DLL=$(the_libdir_base)/Mono.Security.dll
+MONO_SECURITY=Mono.Security
+endif
+
 LIBRARY = System.Security.dll
-LIB_REFS = secxml/System bare/System.Xml Mono.Security
+LIB_REFS = secxml/System bare/System.Xml $(MONO_SECURITY)
 LIB_MCS_FLAGS = -nowarn:618 \
        -d:SECURITY_DEP \
        -nowarn:414
@@ -22,7 +27,7 @@ EXTRA_DISTFILES = \
 
 include ../../build/library.make
 
-$(build_lib): $(secxml_libdir)/System.dll $(the_libdir_base)/Mono.Security.dll
+$(build_lib): $(secxml_libdir)/System.dll $(MONO_SECURITY_DLL)
 
 $(secxml_libdir)/System.dll:
        (cd ../System; $(MAKE) $@)
index c272c83959de1942c83c6adbfd1dce692475b279..f32de28306fa3000f2c45302b1f2b473390be16c 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,618,414</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;SECURITY_DEP</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;SECURITY_DEP</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,618,414</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;SECURITY_DEP</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;SECURITY_DEP</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index d836c1e4ff2b75442e9e59883be7e127f316a278..27c57d109251c83dbfc42e9ebf1ebba3a5328216 100644 (file)
@@ -45,15 +45,15 @@ namespace System.Security.Cryptography.Pkcs {
                        _params = new byte [0];
                }
 
-               public AlgorithmIdentifier (Oid algorithm)
+               public AlgorithmIdentifier (Oid oid)
                {
-                       _oid = algorithm;
+                       _oid = oid;
                        _params = new byte [0];
                }
 
-               public AlgorithmIdentifier (Oid algorithm, int keyLength)
+               public AlgorithmIdentifier (Oid oid, int keyLength)
                {
-                       _oid = algorithm;
+                       _oid = oid;
                        _length = keyLength;
                        _params = new byte [0];
                }
index 32b675abb28ac40a7af30d039ecab9d79120aeca..3bf9efb989dc9bb946960b5bd771dfc3f3b33f23 100644 (file)
@@ -53,14 +53,14 @@ namespace System.Security.Cryptography.Pkcs {
                {
                } 
 
-               public ContentInfo (Oid oid, byte[] content) 
+               public ContentInfo (Oid contentType, byte[] content) 
                {
-                       if (oid == null)
-                               throw new ArgumentNullException ("oid");
+                       if (contentType == null)
+                               throw new ArgumentNullException ("contentType");
                        if (content == null)
                                throw new ArgumentNullException ("content");
 
-                       _oid = oid;
+                       _oid = contentType;
                        _content = content;
                }
 
index 1f57f5c55169931680496f4ed99ac4b1fd1e2aa6..3942e5bba1bb2f4a49e07374b3a01c6766360c62 100644 (file)
@@ -61,12 +61,12 @@ namespace System.Security.Cryptography.Pkcs {
                        _uattribs = new CryptographicAttributeObjectCollection ();
                }
 
-               public EnvelopedCms (ContentInfo content) : this ()
+               public EnvelopedCms (ContentInfo contentInfo) : this ()
                {
-                       if (content == null)
-                               throw new ArgumentNullException ("content");
+                       if (contentInfo == null)
+                               throw new ArgumentNullException ("contentInfo");
 
-                       _content = content;
+                       _content = contentInfo;
                }
 
                public EnvelopedCms (ContentInfo contentInfo, AlgorithmIdentifier encryptionAlgorithm)
index e959175b7337b33974be70ec92e7506991727fd4..1431413d014ba3deae0db4135b3380f6e5da2d5c 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index f8ff5c399cfdd252f14eb773c177ad9a819830eb..6a9d85f5c70431892b5bf30138af2f4514ab0cd6 100644 (file)
@@ -54,7 +54,7 @@ using System.Runtime.InteropServices;
 [assembly: ComVisible (false)]
 
 [assembly: AssemblyDelaySign (true)]
-#if NET_2_1
+#if MOBILE
 [assembly: AssemblyKeyFile ("../silverlight.pub")]
 #else
 [assembly: AssemblyKeyFile("../winfx.pub")]
index 3f021276d449fd7fe9e12d6d8b883358c8b1328c..f487f95633cfdbdd4013dfe1292769451d91c3c5 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;NET_3_5;NET_3_0</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;NET_3_5;NET_3_0</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;NET_3_5;NET_3_0</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;NET_3_5;NET_3_0</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 80b1075ba774d6f04c853e2082f415cc14e0a7e7..a9f41b5c7f9eeaea9d00e09803c5b7a9dbf8e2b2 100644 (file)
@@ -40,7 +40,7 @@ using System.Runtime.InteropServices;
 [assembly: NeutralResourcesLanguage ("en-US")]
 [assembly: CLSCompliant (true)]
 [assembly: AssemblyDelaySign (true)]
-#if NET_2_1
+#if MOBILE
 [assembly: AssemblyKeyFile ("../winfx.pub")]
 #else
 [assembly: AssemblyKeyFile ("../ecma.pub")]
index 39e5a6128f2c71bb77153b2b7cc99392b8504400..b9c5a9d97fb4d4ed5574106a79bd0508f780e1b8 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;MONO_FEATURE_MULTIPLE_APPDOMAINS</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;MONO_FEATURE_MULTIPLE_APPDOMAINS</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;MONO_FEATURE_MULTIPLE_APPDOMAINS</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;MONO_FEATURE_MULTIPLE_APPDOMAINS</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 6dd4a866226374c44866bffddf2b0dd0f236fc69..0202afecb934074fa0089ed2b77ef53d7d4596cf 100644 (file)
@@ -54,7 +54,7 @@ using System.Runtime.InteropServices;
 [assembly: ComVisible (false)]
 
 [assembly: AssemblyDelaySign (true)]
-#if NET_2_1
+#if MOBILE
 [assembly: AssemblyKeyFile ("../silverlight.pub")]
 #else
 [assembly: AssemblyKeyFile("../winfx.pub")]
index 35714061b5b859fc3855c3028d79876331eceba9..b8809b9423f17e4d8fc0ab3df0d7702205def875 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;NET_3_5;NET_3_0</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;NET_3_5;NET_3_0</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;NET_3_5;NET_3_0</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;NET_3_5;NET_3_0</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index c7c676fb7bf0b8905edd3e77e394f70968a71d55..f9e112c54ebb0caabc2ef36f7557f15eec4da5d0 100644 (file)
@@ -54,7 +54,7 @@ using System.Runtime.InteropServices;
 [assembly: NeutralResourcesLanguage ("en-US")]
 [assembly: CLSCompliant (true)]
 [assembly: AssemblyDelaySign (true)]
-#if NET_2_1
+#if MOBILE
 [assembly: AssemblyKeyFile ("../silverlight.pub")]
 #else
 [assembly: AssemblyKeyFile ("../ecma.pub")]
index 0bd1bd0e04faacdd2557954259abd096179a98e1..fc271094cd0a3ead95b072186f788d40a4b48c06 100644 (file)
@@ -54,7 +54,7 @@ using System.Runtime.InteropServices;
 [assembly: NeutralResourcesLanguage ("en-US")]
 [assembly: CLSCompliant (true)]
 [assembly: AssemblyDelaySign (true)]
-#if NET_2_1
+#if MOBILE
 [assembly: AssemblyKeyFile ("../silverlight.pub")]
 #else
 [assembly: AssemblyKeyFile ("../silverlight.pub")] // easing InternalVisibleTo use.
index a974b19de94aceb0878e5db698031a2121f5914f..2e2baf595ce49623904ffc7704e814c7b510d39c 100644 (file)
@@ -53,7 +53,7 @@ using System.Runtime.InteropServices;
 [assembly: ComVisible (false)]
 
 [assembly: AssemblyDelaySign (true)]
-#if NET_2_1
+#if MOBILE
 [assembly: AssemblyInformationalVersion (Consts.FxFileVersion)]
 [assembly: AssemblyKeyFile ("../silverlight.pub")]
 #else
@@ -61,7 +61,7 @@ using System.Runtime.InteropServices;
 [assembly: AssemblyKeyFile("../winfx.pub")]
 #endif
 
-#if NET_2_1
+#if MOBILE
 [assembly: InternalsVisibleTo ("System.Json, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")]
 [assembly: InternalsVisibleTo ("System.ServiceModel.Web.Extensions, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")]
 [assembly: InternalsVisibleTo ("System.Windows.Browser, PublicKey=00240000048000009400000006020000002400005253413100040000010001008D56C76F9E8649383049F383C44BE0EC204181822A6C31CF5EB7EF486944D032188EA1D3920763712CCB12D75FB77E9811149E6148E5D32FBAAB37611C1878DDC19E20EF135D0CB2CFF2BFEC3D115810C3D9069638FE4BE215DBF795861920E5AB6F7DB2E2CEEF136AC23D5DD2BF031700AEC232F6C6B1C785B4305C123B37AB")]
index b438b10968481216020eb087dce8d5b0e6b6a0f6..0cf2bc5778b114f4863056bc7e8961701aef14bf 100644 (file)
@@ -47,7 +47,7 @@ namespace System.ServiceModel.Channels
                }
 
                public override string ContentType {
-#if NET_2_1
+#if MOBILE
                        get { return MediaType; }
 #else
                        get { return MediaType + "; charset=" + source.WriteEncoding.HeaderName; }
@@ -114,7 +114,7 @@ namespace System.ServiceModel.Channels
                                break;
                        case WebContentFormat.Json:
                                // FIXME: is it safe/unsafe/required to keep XmlReader open?
-#if NET_2_1
+#if MOBILE
                                msg = Message.CreateMessage (MessageVersion.None, null, JsonReaderWriterFactory.CreateJsonReader (stream, source.ReaderQuotas));
 #else
                                msg = Message.CreateMessage (MessageVersion.None, null, JsonReaderWriterFactory.CreateJsonReader (stream, enc, source.ReaderQuotas, null));
@@ -174,7 +174,7 @@ namespace System.ServiceModel.Channels
 
                        switch (GetContentFormat (message)) {
                        case WebContentFormat.Xml:
-#if NET_2_1
+#if MOBILE
                                using (XmlWriter w = XmlDictionaryWriter.CreateDictionaryWriter (XmlWriter.Create (new StreamWriter (stream, source.WriteEncoding))))
                                        message.WriteMessage (w);
 #else
index 3049f2901e31c1f6a2f0ecb322ac6ad03aab9507..c6a0b107553529843667fcbb3348a985ec104b3b 100644 (file)
@@ -34,7 +34,7 @@ using System.Xml;
 namespace System.ServiceModel.Channels
 {
        public sealed class WebMessageEncodingBindingElement
-#if NET_2_1
+#if MOBILE
                : MessageEncodingBindingElement
 #else
                : MessageEncodingBindingElement, IWsdlExportExtension
@@ -109,7 +109,7 @@ namespace System.ServiceModel.Channels
                        return base.BuildChannelFactory<TChannel> (context);
                }
 
-#if !NET_2_1
+#if !MOBILE
                [MonoTODO ("Why is it overriden?")]
                public override bool CanBuildChannelListener<TChannel> (BindingContext context)
                {
@@ -146,7 +146,7 @@ namespace System.ServiceModel.Channels
                        return context.GetInnerProperty<T> ();
                }
 
-#if !NET_2_1 && !XAMMAC_4_5
+#if !MOBILE && !XAMMAC_4_5
                [MonoTODO]
                void IWsdlExportExtension.ExportContract (WsdlExporter exporter, WsdlContractConversionContext context)
                {
index d207385c97ee641f880e4d251c7e95e60a0ebb27..dc8915ff76d1f6306769e1dd71493a2572f6c076 100644 (file)
@@ -84,7 +84,7 @@ namespace System.ServiceModel.Description
                        // clientRuntime.MessageInspectors.Add (something);
                }
 
-#if !NET_2_1 && !XAMMAC_4_5
+#if !MOBILE && !XAMMAC_4_5
                protected virtual void AddServerErrorHandlers (ServiceEndpoint endpoint, EndpointDispatcher endpointDispatcher)
                {
                        endpointDispatcher.ChannelDispatcher.ErrorHandlers.Add (new WebHttpErrorHandler ());
@@ -103,7 +103,7 @@ namespace System.ServiceModel.Description
 
                public virtual void ApplyDispatchBehavior (ServiceEndpoint endpoint, EndpointDispatcher endpointDispatcher)
                {
-#if NET_2_1 || XAMMAC_4_5
+#if MOBILE || XAMMAC_4_5
                        throw new NotImplementedException ();
 #else
                        endpointDispatcher.DispatchRuntime.OperationSelector = GetOperationSelector (endpoint);
@@ -146,7 +146,7 @@ namespace System.ServiceModel.Description
                        }
                }
 
-#if !NET_2_1 && !XAMMAC_4_5
+#if !MOBILE && !XAMMAC_4_5
                internal class DispatchPairFormatter : IDispatchMessageFormatter
                {
                        public DispatchPairFormatter (IDispatchMessageFormatter request, IDispatchMessageFormatter reply)
@@ -185,7 +185,7 @@ namespace System.ServiceModel.Description
                        return new WebMessageFormatter.ReplyClientFormatter (operationDescription, endpoint, GetQueryStringConverter (operationDescription), this);
                }
 
-#if !NET_2_1
+#if !MOBILE
                protected virtual IDispatchMessageFormatter GetReplyDispatchFormatter (OperationDescription operationDescription, ServiceEndpoint endpoint)
                {
                        return new WebMessageFormatter.ReplyDispatchFormatter (operationDescription, endpoint, GetQueryStringConverter (operationDescription), this);
@@ -197,7 +197,7 @@ namespace System.ServiceModel.Description
                        return new WebMessageFormatter.RequestClientFormatter (operationDescription, endpoint, GetQueryStringConverter (operationDescription), this);
                }
 
-#if !NET_2_1
+#if !MOBILE
                protected virtual IDispatchMessageFormatter GetRequestDispatchFormatter (OperationDescription operationDescription, ServiceEndpoint endpoint)
                {
                        return new WebMessageFormatter.RequestDispatchFormatter (operationDescription, endpoint, GetQueryStringConverter (operationDescription), this);
@@ -287,7 +287,7 @@ namespace System.ServiceModel.Description
                                throw new InvalidOperationException ("ManualAddressing in the transport binding element in the binding must be true for WebHttpBehavior");
                }
 
-#if !NET_2_1
+#if !MOBILE
                internal class WebHttpErrorHandler : IErrorHandler
                {
                        public void ProvideFault (Exception error, MessageVersion version, ref Message fault)
index 6fb3b86590393c340b967a78401b5bee91c3b58e..aa1590759986e05d47cf1d741a2aa2d027a522c5 100644 (file)
@@ -41,7 +41,7 @@ using System.ServiceModel.Web;
 using System.Text;
 using System.Xml;
 
-#if NET_2_1
+#if MOBILE
 using XmlObjectSerializer = System.Object;
 #endif
 
@@ -81,7 +81,7 @@ namespace System.ServiceModel.Dispatcher
                        this.converter = converter;
                        this.behavior = behavior;
                        ApplyWebAttribute ();
-#if !NET_2_1
+#if !MOBILE
                        // This is a hack for WebScriptEnablingBehavior
                        var jqc = converter as JsonQueryStringConverter;
                        if (jqc != null)
@@ -248,7 +248,7 @@ namespace System.ServiceModel.Dispatcher
                
                protected object ReadObjectBody (XmlObjectSerializer serializer, XmlReader reader)
                {
-#if NET_2_1
+#if MOBILE
                        return (serializer is DataContractJsonSerializer) ?
                                ((DataContractJsonSerializer) serializer).ReadObject (reader) :
                                ((DataContractSerializer) serializer).ReadObject (reader, true);
@@ -283,7 +283,7 @@ namespace System.ServiceModel.Dispatcher
                        }
                }
 
-#if !NET_2_1
+#if !MOBILE
                internal class RequestDispatchFormatter : WebDispatchMessageFormatter
                {
                        public RequestDispatchFormatter (OperationDescription operation, ServiceEndpoint endpoint, QueryStringConverter converter, WebHttpBehavior behavior)
@@ -363,7 +363,7 @@ namespace System.ServiceModel.Dispatcher
                                // FIXME: get encoding from somewhere
                                hp.Headers ["Content-Type"] = mediaType + "; charset=utf-8";
 
-#if !NET_2_1
+#if !MOBILE
                                if (WebOperationContext.Current != null)
                                        WebOperationContext.Current.OutgoingRequest.Apply (hp);
 #endif
@@ -382,7 +382,7 @@ namespace System.ServiceModel.Dispatcher
                                        throw new ArgumentNullException ("parameters");
                                CheckMessageVersion (message.Version);
 
-#if !NET_2_1
+#if !MOBILE
                                if (OperationContext.Current != null) {
                                        // Set response in the context
                                        OperationContext.Current.IncomingMessage = message;
@@ -423,7 +423,7 @@ namespace System.ServiceModel.Dispatcher
                        object value;
                        XmlObjectSerializer serializer;
 
-#if !NET_2_1
+#if !MOBILE
                        protected override BodyWriter OnCreateBufferedCopy (int maxBufferSize)
                        {
                                return new WrappedBodyWriter (value, serializer, name, ns, fmt);
@@ -473,7 +473,7 @@ namespace System.ServiceModel.Dispatcher
                        void WriteObject (XmlObjectSerializer serializer, XmlDictionaryWriter writer, object value)
                        {
                                if (serializer != null){
-#if NET_2_1
+#if MOBILE
                                        if (serializer is DataContractJsonSerializer)
                                                ((DataContractJsonSerializer) serializer).WriteObject (writer, value);
                                        else
@@ -485,7 +485,7 @@ namespace System.ServiceModel.Dispatcher
                        }
                }
 
-#if !NET_2_1
+#if !MOBILE
                internal abstract class WebDispatchMessageFormatter : WebMessageFormatter, IDispatchMessageFormatter
                {
                        protected WebDispatchMessageFormatter (OperationDescription operation, ServiceEndpoint endpoint, QueryStringConverter converter, WebHttpBehavior behavior)
index 6724c3786315a574fd46d4351ab2bb65fa561edf..037fbec4ef6b76cf8df434c49e71bb1ee84154a7 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;NET_3_5;NET_3_0</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;NET_3_5;NET_3_0</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;NET_3_5;NET_3_0</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;NET_3_5;NET_3_0</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index bee02209a1a5c5276bdb1a39aa6345e290278448..4a5289dd51f235ed5f8067c560a1b46c627893f0 100644 (file)
@@ -39,7 +39,7 @@ namespace System.ServiceModel.Web
 {
        public class WebChannelFactory<TChannel> : ChannelFactory<TChannel>
        {
-#if !NET_2_1
+#if !MOBILE
                public WebChannelFactory ()
                        : base ()
                {
@@ -84,7 +84,7 @@ namespace System.ServiceModel.Web
 
                protected override void OnOpening ()
                {
-#if !NET_2_1
+#if !MOBILE
                        if (Endpoint.Behaviors.Find<WebHttpBehavior> () == null)
                                Endpoint.Behaviors.Add (new WebHttpBehavior ());
 #endif
index dfec47afe0e33b33c401216448ee906143664340..a372b24c6b696e9bc809f0f58a9f5312092f6666 100644 (file)
@@ -31,7 +31,7 @@ using System.ServiceModel;
 using System.ServiceModel.Channels;
 using System.ServiceModel.Description;
 
-#if NET_2_1 // Note that moonlight System.ServiceModel.Web.dll does not contain this class.
+#if MOBILE // Note that moonlight System.ServiceModel.Web.dll does not contain this class.
 using IncomingWebRequestContext = System.Object;
 using OutgoingWebResponseContext = System.Object;
 #else
@@ -44,11 +44,11 @@ using System.Xml.Serialization;
 namespace System.ServiceModel.Web
 {
        public class WebOperationContext
-#if !NET_2_1
+#if !MOBILE
         : IExtension<OperationContext>
 #endif
        {
-#if !NET_2_1
+#if !MOBILE
                public static WebOperationContext Current {
                        get {
                                if (OperationContext.Current == null)
@@ -75,13 +75,13 @@ namespace System.ServiceModel.Web
 
                        outgoing_request = new OutgoingWebRequestContext ();
                        incoming_response = new IncomingWebResponseContext (operation);
-#if !NET_2_1
+#if !MOBILE
                        incoming_request = new IncomingWebRequestContext (operation);
                        outgoing_response = new OutgoingWebResponseContext ();
 #endif
                }
 
-#if !NET_2_1
+#if !MOBILE
                public IncomingWebRequestContext IncomingRequest {
                        get { return incoming_request; }
                }
@@ -95,7 +95,7 @@ namespace System.ServiceModel.Web
                        get { return outgoing_request; }
                }
 
-#if !NET_2_1
+#if !MOBILE
                public OutgoingWebResponseContext OutgoingResponse {
                        get { return outgoing_response; }
                }
index 8eee88bb876ad8387abadae15f001784359e2f8f..a182f4f51925f62060168b98897b55e0ee087950 100644 (file)
@@ -31,7 +31,7 @@ using System.Linq;
 using System.ServiceModel.Channels;
 using System.Text;
 using System.Xml;
-#if !NET_2_1
+#if !MOBILE
 using System.Configuration;
 using System.ServiceModel.Configuration;
 #endif
@@ -52,7 +52,7 @@ namespace System.ServiceModel
 
                public WebHttpBinding (string configurationName)
                {
-#if !NET_2_1 && !XAMMAC_4_5
+#if !MOBILE && !XAMMAC_4_5
                        BindingsSection bindingsSection = ConfigUtil.BindingsSection;
                        WebHttpBindingElement el = (WebHttpBindingElement) bindingsSection ["webHttpBinding"].ConfiguredBindings.FirstOrDefault (c => c.Name == configurationName);
                        if (el != null) {
@@ -88,7 +88,7 @@ namespace System.ServiceModel
                        get { return EnvelopeVersion.None; }
                }
 
-#if !NET_2_1 && !XAMMAC_4_5
+#if !MOBILE && !XAMMAC_4_5
                [DefaultValue (false)]
                public bool AllowCookies {
                        get { return t.AllowCookies; }
index 4effb2e71a7d4f5a51c0e0c0de63122986f7c1e0..b7aefe52dfda3232ca9258fa9d0cd3d8402ebc47 100644 (file)
@@ -34,7 +34,7 @@ namespace System.ServiceModel
                public WebHttpSecurity ()
                {
                        // there is no public constructor for transport ...
-#if !NET_2_1
+#if !MOBILE
                        Transport = new BasicHttpBinding ().Security.Transport;
 #endif
                }
index f25171f793f2c5b909b603bc30be8f6d48af81a5..909ae4f9cf04cc9c2cd483dfbe4d5e906e94e0bc 100644 (file)
@@ -48,7 +48,7 @@ namespace MonoTests.System.ServiceModel.Web
        public class WebOperationContextTest
        {
 // MonoTouch does not support dynamic proxy code generation.
-#if !MONOTOUCH
+#if !MONOTOUCH && !MOBILE_STATIC
                [Test]
 #endif
                public void Current ()
index c13a103d20ad7ccd09b8e50ca1cf87b70b6bcc9d..f4779a1e60091bee2892b2495ba22861888213a6 100644 (file)
@@ -54,7 +54,7 @@ using System.Runtime.InteropServices;
 [assembly: NeutralResourcesLanguage ("en-US")]
 [assembly: CLSCompliant (true)]
 [assembly: AssemblyDelaySign (true)]
-#if NET_2_1
+#if MOBILE
 [assembly: AssemblyKeyFile ("../winfx.pub")]
 #else
 [assembly: AssemblyKeyFile ("../ecma.pub")]
@@ -65,11 +65,11 @@ using System.Runtime.InteropServices;
 
 [assembly: ComVisible (false)]
 
-#if NET_2_1
+#if MOBILE
 //[assembly: InternalsVisibleTo ("System.Xml.Serialization, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")]
 #endif
 
-#if !NET_2_1
+#if !MOBILE
 [assembly: InternalsVisibleTo ("System.ServiceModel.Web, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")]
 [assembly: InternalsVisibleTo ("System.ServiceModel.Routing, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")]
 [assembly: InternalsVisibleTo ("System.ServiceModel.Discovery, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] // AnnouncementChannelEndpointElementCollection requires it.
@@ -82,4 +82,13 @@ using System.Runtime.InteropServices;
 
 #endif
 
+#if !MOBILE
 
+[assembly: TypeForwardedTo (typeof (System.ServiceModel.Security.BinarySecretKeyIdentifierClause))]
+[assembly: TypeForwardedTo (typeof (System.ServiceModel.Security.KeyNameIdentifierClause))]
+[assembly: TypeForwardedTo (typeof (System.ServiceModel.Security.SecurityContextKeyIdentifierClause))]
+[assembly: TypeForwardedTo (typeof (System.ServiceModel.Security.X509CertificateValidationMode))]
+[assembly: TypeForwardedTo (typeof (System.ServiceModel.Security.Tokens.BinarySecretSecurityToken))]
+[assembly: TypeForwardedTo (typeof (System.ServiceModel.Security.Tokens.WrappedKeySecurityToken))]
+
+#endif
index 526b5f1f4b813e14f91a6c53c844adc3d954f62c..fd890ec76e12d40f57bccb53759b77b7a8a68aa7 100644 (file)
@@ -47,7 +47,6 @@ namespace System.ServiceModel
 
                public InstanceContext (object implementation)
                {
-                       throw new NotImplementedException ();
                }
 
                public object GetServiceInstance (Message message)
index 0106b2237d588cce2a1e90f9d21db7ac3de49e0a..c36efe1ad2a4c806f5e17c8248260f49578d4ee3 100644 (file)
@@ -34,7 +34,6 @@ namespace System.ServiceModel
 
                public InstanceContext (object implementation)
                {
-                       throw new NotImplementedException ();
                }
 
                public object GetServiceInstance (Message message)
index ff8251f18158475d04de5c4707eb0a6fa5a389de..f7031432d8506a14aa4f6bf95de0773c2eccc7c3 100644 (file)
@@ -40,7 +40,7 @@ namespace Mono.CodeGeneration
                        AppDomain myDomain = System.Threading.Thread.GetDomain();
                        AssemblyName myAsmName = new AssemblyName();
                        myAsmName.Name = name;
-#if NET_2_1
+#if MOBILE
                        AssemblyBuilder myAsmBuilder = myDomain.DefineDynamicAssembly (myAsmName, AssemblyBuilderAccess.Run);
 #else
                        AssemblyBuilder myAsmBuilder = myDomain.DefineDynamicAssembly (myAsmName, AssemblyBuilderAccess.RunAndSave);
index 70b25bd1d576926e397c6d3352a8ef1e8f887efd..ff122878c95b737e5b1572d85dd2aa9e29f2bd8a 100644 (file)
@@ -36,7 +36,7 @@ namespace Mono.Security.Protocol.Tls
                {
                        if (!isInitialized)
                        {
-#if !NET_2_1
+#if !MOBILE
                                Debug.Listeners.Add(new TextWriterTraceListener(Console.Out));
                                // Debug.Listeners.Add(new TextWriterTraceListener(@"c:\ssl.log"));
                                Debug.AutoFlush = true;
index e986534126d2fbd8661da2b2f4ffe1acc5eb2a41..9927f67bbb0eeb9767a0b1de21bb48c424ff23e2 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,414,169,67,3005,436,219,618</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;TRACE;NET_3_0;HAS_ACTIVATION</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;TRACE;NET_3_0;HAS_ACTIVATION</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,414,169,67,3005,436,219,618</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;TRACE;NET_3_0;HAS_ACTIVATION</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;TRACE;NET_3_0;HAS_ACTIVATION</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
     <Compile Include="System.ServiceModel.PeerResolvers\UnregisterInfo.cs" />\r
     <Compile Include="System.ServiceModel.PeerResolvers\UpdateInfo.cs" />\r
     <Compile Include="System.ServiceModel.Security.Tokens\AuthenticatorCommunicationObject.cs" />\r
-    <Compile Include="System.ServiceModel.Security.Tokens\BinarySecretSecurityToken.cs" />\r
     <Compile Include="System.ServiceModel.Security.Tokens\ClaimTypeRequirement.cs" />\r
     <Compile Include="System.ServiceModel.Security.Tokens\CommunicationSecurityTokenAuthenticator.cs" />\r
     <Compile Include="System.ServiceModel.Security.Tokens\CommunicationSecurityTokenProvider.cs" />\r
     <Compile Include="System.ServiceModel.Security.Tokens\DerivedKeySecurityToken.cs" />\r
     <Compile Include="System.ServiceModel.Security.Tokens\IIssuanceSecurityTokenAuthenticator.cs" />\r
     <Compile Include="System.ServiceModel.Security.Tokens\InitiatorServiceModelSecurityTokenRequirement.cs" />\r
-    <Compile Include="System.ServiceModel.Security.Tokens\InternalEncryptedKeyIdentifierClause.cs" />\r
     <Compile Include="System.ServiceModel.Security.Tokens\ISecurityContextSecurityTokenCache.cs" />\r
     <Compile Include="System.ServiceModel.Security.Tokens\IssuedSecurityTokenHandler.cs" />\r
     <Compile Include="System.ServiceModel.Security.Tokens\IssuedSecurityTokenParameters.cs" />\r
     <Compile Include="System.ServiceModel.Security.Tokens\TlsClientSession.cs" />\r
     <Compile Include="System.ServiceModel.Security.Tokens\TlsServerSession.cs" />\r
     <Compile Include="System.ServiceModel.Security.Tokens\UserNameSecurityTokenParameters.cs" />\r
-    <Compile Include="System.ServiceModel.Security.Tokens\WrappedKeySecurityToken.cs" />\r
     <Compile Include="System.ServiceModel.Security.Tokens\X509SecurityTokenParameters.cs" />\r
     <Compile Include="System.ServiceModel.Security\BasicSecurityProfileVersion.cs" />\r
-    <Compile Include="System.ServiceModel.Security\BinarySecretKeyIdentifierClause.cs" />\r
     <Compile Include="System.ServiceModel.Security\ChannelProtectionRequirements.cs" />\r
     <Compile Include="System.ServiceModel.Security\DataProtectionSecurityStateEncoder.cs" />\r
     <Compile Include="System.ServiceModel.Security\ExpiredSecurityTokenException.cs" />\r
     <Compile Include="System.ServiceModel.Security\IssuedTokenClientCredential.cs" />\r
     <Compile Include="System.ServiceModel.Security\IssuedTokenServiceCredential.cs" />\r
     <Compile Include="System.ServiceModel.Security\KeyEntropyMode.cs" />\r
-    <Compile Include="System.ServiceModel.Security\KeyNameIdentifierClause.cs" />\r
     <Compile Include="System.ServiceModel.Security\MessagePartSpecification.cs" />\r
     <Compile Include="System.ServiceModel.Security\MessageProtectionOrder.cs" />\r
     <Compile Include="System.ServiceModel.Security\MessageSecurityException.cs" />\r
     <Compile Include="System.ServiceModel.Security\SecureConversationVersion.cs" />\r
     <Compile Include="System.ServiceModel.Security\SecurityAccessDeniedException.cs" />\r
     <Compile Include="System.ServiceModel.Security\SecurityAlgorithmSuite.cs" />\r
-    <Compile Include="System.ServiceModel.Security\SecurityContextKeyIdentifierClause.cs" />\r
     <Compile Include="System.ServiceModel.Security\SecurityCredentialsManager.cs" />\r
     <Compile Include="System.ServiceModel.Security\SecurityMessageProperty.cs" />\r
     <Compile Include="System.ServiceModel.Security\SecurityNegotiationException.cs" />\r
     <Compile Include="System.ServiceModel\NamedPipeTransportSecurity.cs" />\r
     <Compile Include="System.ServiceModel\NetHttpBinding.cs" />\r
     <Compile Include="System.ServiceModel\NetHttpMessageEncoding.cs" />\r
+    <Compile Include="System.ServiceModel\NetHttpsBinding.cs" />\r
     <Compile Include="System.ServiceModel\NetMsmqBinding.cs" />\r
     <Compile Include="System.ServiceModel\NetMsmqSecurity.cs" />\r
     <Compile Include="System.ServiceModel\NetNamedPipeBinding.cs" />\r
       <Project>{D845AD9D-3CCB-49CB-9543-028678E94938}</Project>\r
       <Name>System.Runtime.Serialization-net_4_x</Name>\r
     </ProjectReference>\r
+    <ProjectReference Include="../System.IdentityModel/System.IdentityModel-net_4_x.csproj">\r
+      <Project>{FA718FA9-32C2-4BAC-BAAB-DB3A7A326D4C}</Project>\r
+      <Name>System.IdentityModel-net_4_x</Name>\r
+    </ProjectReference>\r
     <ProjectReference Include="../System.Configuration/System.Configuration-net_4_x.csproj">\r
       <Project>{D5CDC09C-F19A-4811-A6C8-70F51CBFB644}</Project>\r
       <Name>System.Configuration-net_4_x</Name>\r
       <Project>{3ED36717-A9D1-4289-8949-9B7F39766DEB}</Project>\r
       <Name>System.Security-net_4_x</Name>\r
     </ProjectReference>\r
-    <ProjectReference Include="../System.IdentityModel/System.IdentityModel-net_4_x.csproj">\r
-      <Project>{FA718FA9-32C2-4BAC-BAAB-DB3A7A326D4C}</Project>\r
-      <Name>System.IdentityModel-net_4_x</Name>\r
-    </ProjectReference>\r
     <ProjectReference Include="../System.IdentityModel.Selectors/System.IdentityModel.Selectors-net_4_x.csproj">\r
       <Project>{BBA32980-B28C-476D-AEB0-892F1B1DFB5E}</Project>\r
       <Name>System.IdentityModel.Selectors-net_4_x</Name>\r
index 4608b887c5e188ac2bf80cecbc1120f93056a827..80ad61bc32b4a06b076de59bd87c5d935feb50d0 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,414,169,67,3005,436,219,618</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;TRACE;NET_3_0</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;TRACE;NET_3_0</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,414,169,67,3005,436,219,618</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;TRACE;NET_3_0</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;TRACE;NET_3_0</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
     <Compile Include="System.ServiceModel.PeerResolvers\UnregisterInfo.cs" />\r
     <Compile Include="System.ServiceModel.PeerResolvers\UpdateInfo.cs" />\r
     <Compile Include="System.ServiceModel.Security.Tokens\AuthenticatorCommunicationObject.cs" />\r
-    <Compile Include="System.ServiceModel.Security.Tokens\BinarySecretSecurityToken.cs" />\r
     <Compile Include="System.ServiceModel.Security.Tokens\ClaimTypeRequirement.cs" />\r
     <Compile Include="System.ServiceModel.Security.Tokens\CommunicationSecurityTokenAuthenticator.cs" />\r
     <Compile Include="System.ServiceModel.Security.Tokens\CommunicationSecurityTokenProvider.cs" />\r
     <Compile Include="System.ServiceModel.Security.Tokens\DerivedKeySecurityToken.cs" />\r
     <Compile Include="System.ServiceModel.Security.Tokens\IIssuanceSecurityTokenAuthenticator.cs" />\r
     <Compile Include="System.ServiceModel.Security.Tokens\InitiatorServiceModelSecurityTokenRequirement.cs" />\r
-    <Compile Include="System.ServiceModel.Security.Tokens\InternalEncryptedKeyIdentifierClause.cs" />\r
     <Compile Include="System.ServiceModel.Security.Tokens\ISecurityContextSecurityTokenCache.cs" />\r
     <Compile Include="System.ServiceModel.Security.Tokens\IssuedSecurityTokenHandler.cs" />\r
     <Compile Include="System.ServiceModel.Security.Tokens\IssuedSecurityTokenParameters.cs" />\r
     <Compile Include="System.ServiceModel.Security.Tokens\TlsClientSession.cs" />\r
     <Compile Include="System.ServiceModel.Security.Tokens\TlsServerSession.cs" />\r
     <Compile Include="System.ServiceModel.Security.Tokens\UserNameSecurityTokenParameters.cs" />\r
-    <Compile Include="System.ServiceModel.Security.Tokens\WrappedKeySecurityToken.cs" />\r
     <Compile Include="System.ServiceModel.Security.Tokens\X509SecurityTokenParameters.cs" />\r
     <Compile Include="System.ServiceModel.Security\BasicSecurityProfileVersion.cs" />\r
-    <Compile Include="System.ServiceModel.Security\BinarySecretKeyIdentifierClause.cs" />\r
     <Compile Include="System.ServiceModel.Security\ChannelProtectionRequirements.cs" />\r
     <Compile Include="System.ServiceModel.Security\DataProtectionSecurityStateEncoder.cs" />\r
     <Compile Include="System.ServiceModel.Security\ExpiredSecurityTokenException.cs" />\r
     <Compile Include="System.ServiceModel.Security\IssuedTokenClientCredential.cs" />\r
     <Compile Include="System.ServiceModel.Security\IssuedTokenServiceCredential.cs" />\r
     <Compile Include="System.ServiceModel.Security\KeyEntropyMode.cs" />\r
-    <Compile Include="System.ServiceModel.Security\KeyNameIdentifierClause.cs" />\r
     <Compile Include="System.ServiceModel.Security\MessagePartSpecification.cs" />\r
     <Compile Include="System.ServiceModel.Security\MessageProtectionOrder.cs" />\r
     <Compile Include="System.ServiceModel.Security\MessageSecurityException.cs" />\r
     <Compile Include="System.ServiceModel.Security\SecureConversationVersion.cs" />\r
     <Compile Include="System.ServiceModel.Security\SecurityAccessDeniedException.cs" />\r
     <Compile Include="System.ServiceModel.Security\SecurityAlgorithmSuite.cs" />\r
-    <Compile Include="System.ServiceModel.Security\SecurityContextKeyIdentifierClause.cs" />\r
     <Compile Include="System.ServiceModel.Security\SecurityCredentialsManager.cs" />\r
     <Compile Include="System.ServiceModel.Security\SecurityMessageProperty.cs" />\r
     <Compile Include="System.ServiceModel.Security\SecurityNegotiationException.cs" />\r
     <Compile Include="System.ServiceModel\NamedPipeTransportSecurity.cs" />\r
     <Compile Include="System.ServiceModel\NetHttpBinding.cs" />\r
     <Compile Include="System.ServiceModel\NetHttpMessageEncoding.cs" />\r
+    <Compile Include="System.ServiceModel\NetHttpsBinding.cs" />\r
     <Compile Include="System.ServiceModel\NetMsmqBinding.cs" />\r
     <Compile Include="System.ServiceModel\NetMsmqSecurity.cs" />\r
     <Compile Include="System.ServiceModel\NetNamedPipeBinding.cs" />\r
       <Project>{D845AD9D-3CCB-49CB-9543-028678E94938}</Project>\r
       <Name>System.Runtime.Serialization-net_4_x</Name>\r
     </ProjectReference>\r
+    <ProjectReference Include="../System.IdentityModel/System.IdentityModel-net_4_x.csproj">\r
+      <Project>{FA718FA9-32C2-4BAC-BAAB-DB3A7A326D4C}</Project>\r
+      <Name>System.IdentityModel-net_4_x</Name>\r
+    </ProjectReference>\r
     <ProjectReference Include="../System.Configuration/System.Configuration-net_4_x.csproj">\r
       <Project>{D5CDC09C-F19A-4811-A6C8-70F51CBFB644}</Project>\r
       <Name>System.Configuration-net_4_x</Name>\r
       <Project>{3ED36717-A9D1-4289-8949-9B7F39766DEB}</Project>\r
       <Name>System.Security-net_4_x</Name>\r
     </ProjectReference>\r
-    <ProjectReference Include="../System.IdentityModel/System.IdentityModel-net_4_x.csproj">\r
-      <Project>{FA718FA9-32C2-4BAC-BAAB-DB3A7A326D4C}</Project>\r
-      <Name>System.IdentityModel-net_4_x</Name>\r
-    </ProjectReference>\r
     <ProjectReference Include="../System.IdentityModel.Selectors/System.IdentityModel.Selectors-net_4_x.csproj">\r
       <Project>{BBA32980-B28C-476D-AEB0-892F1B1DFB5E}</Project>\r
       <Name>System.IdentityModel.Selectors-net_4_x</Name>\r
index 9fc6f5d921734451bac785798fd3f10364832135..598ce3940299614566c568117cf2aefd46c8fb4e 100644 (file)
@@ -201,13 +201,13 @@ namespace System.ServiceModel.Channels.NetTcp
                                        if (accept_handles.Count > 0)
                                                accept_handles [0].Set ();
                                }
-                       } catch {
+                       } catch (ObjectDisposedException) {
                                /* If an accept fails, just ignore it. Maybe the remote peer disconnected already */
                        } finally {
                                if (State == CommunicationState.Opened) {
                                        try {
                                                listener.BeginAcceptTcpClient (TcpListenerAcceptedClient, listener);
-                                       } catch {
+                                       } catch (ObjectDisposedException) {
                                                /* If this fails, we must have disposed the listener */
                                        }
                                }
index 4372574e1ee682c41f15f46b2d90d94aa816086d..1e07c4830d9bab68512ff729edc9e9647e048656 100644 (file)
@@ -45,9 +45,9 @@ namespace System.ServiceModel.Channels
                        return new DefaultAddressHeader (value);
                }
 
-               public static AddressHeader CreateAddressHeader (object value, XmlObjectSerializer formatter)
+               public static AddressHeader CreateAddressHeader (object value, XmlObjectSerializer serializer)
                {
-                       return new DefaultAddressHeader (value, formatter);
+                       return new DefaultAddressHeader (value, serializer);
                }
 
                public static AddressHeader CreateAddressHeader (string name, string ns, object value)
@@ -56,11 +56,11 @@ namespace System.ServiceModel.Channels
                }
 
                public static AddressHeader CreateAddressHeader (string name, string ns, object value, 
-                                                                XmlObjectSerializer formatter)
+                                                                XmlObjectSerializer serializer)
                {
-                       if (formatter == null)
-                               throw new ArgumentNullException ("formatter");
-                       return new DefaultAddressHeader (name, ns, value, formatter);
+                       if (serializer == null)
+                               throw new ArgumentNullException ("serializer");
+                       return new DefaultAddressHeader (name, ns, value, serializer);
                }
 
                public override bool Equals (object obj)
@@ -93,9 +93,9 @@ namespace System.ServiceModel.Channels
                        return GetValue<T> (new DataContractSerializer (typeof (T)));
                }
 
-               public T GetValue<T> (XmlObjectSerializer formatter)
+               public T GetValue<T> (XmlObjectSerializer serializer)
                {
-                       return (T) formatter.ReadObject (GetAddressHeaderReader ());
+                       return (T) serializer.ReadObject (GetAddressHeaderReader ());
                }
 
                protected abstract void OnWriteAddressHeaderContents (XmlDictionaryWriter writer);
index 3969ad3b5718affc8e44b05ed9633bc680d4199b..e8f2470d560aac4091cbfd6ad4840eb2a8f5a338 100644 (file)
@@ -47,8 +47,8 @@ namespace System.ServiceModel.Channels
                {
                }
 
-               public AddressHeaderCollection (IEnumerable<AddressHeader> headers)
-                       : base (GetList (headers))
+               public AddressHeaderCollection (IEnumerable<AddressHeader> addressHeaders)
+                       : base (GetList (addressHeaders))
                {
                }
 
index 32ab72a9cb95ff67528d99e30d3e5f63914f4492..b89e21a55270c212a238d1c8c3e633cb2008c31c 100644 (file)
@@ -94,7 +94,7 @@ namespace System.ServiceModel.Channels
                        return base.BuildChannelFactory<TChannel> (context);
                }
 
-#if !NET_2_1
+#if !MOBILE
                public override IChannelListener<TChannel> BuildChannelListener<TChannel> (
                        BindingContext context)
                {
@@ -131,7 +131,7 @@ namespace System.ServiceModel.Channels
                        return new BinaryMessageEncoderFactory (this);
                }
 
-#if !NET_2_1 && !XAMMAC_4_5
+#if !MOBILE && !XAMMAC_4_5
                [MonoTODO]
                void IWsdlExportExtension.ExportContract (WsdlExporter exporter,
                        WsdlContractConversionContext context)
index 12c8ed6af07bc806a0a4a1afdcd05d202fe7adeb..9e66babb71aff4f93a2a183a089baa7ec2dba92f 100644 (file)
@@ -133,7 +133,7 @@ namespace System.ServiceModel.Channels
                        return CreateContext (parameters).BuildInnerChannelFactory<TChannel> ();
                }
 
-#if !NET_2_1
+#if !MOBILE
                public virtual IChannelListener<TChannel>
                        BuildChannelListener<TChannel> (
                        Uri listenUriBaseAddress,
@@ -267,7 +267,7 @@ namespace System.ServiceModel.Channels
                        return CreateContext (parameters).CanBuildInnerChannelFactory<TChannel> ();
                }
 
-#if !NET_2_1
+#if !MOBILE
                public bool CanBuildChannelListener<TChannel> (
                        params object [] parameters)
                        where TChannel : class, IChannel
index ad0742ce8de18c2ccdd27831f53e9bf0b8b4aa36..2fecf2264681fbf522acf63c01b639ce6c9e81cb 100644 (file)
@@ -44,17 +44,17 @@ namespace System.ServiceModel.Channels
                BindingElementCollection elements; // for internal use
 
                public BindingContext (CustomBinding binding,
-                       BindingParameterCollection parms)
+                       BindingParameterCollection parameters)
                {
                        if (binding == null)
                                throw new ArgumentNullException ("binding");
-                       if (parms == null)
-                               throw new ArgumentNullException ("parms");
+                       if (parameters == null)
+                               throw new ArgumentNullException ("parameters");
 
                        this.binding = binding;
-                       parameters = new BindingParameterCollection ();
-                       foreach (var item in parms)
-                               parameters.Add (item);
+                       this.parameters = new BindingParameterCollection ();
+                       foreach (var item in parameters)
+                               this.parameters.Add (item);
                        this.elements = new BindingElementCollection ();
                        foreach (var item in binding.Elements)
                                this.elements.Add (item);
@@ -149,7 +149,7 @@ namespace System.ServiceModel.Channels
                        return ctx.DequeueBindingElement ().BuildChannelFactory<TChannel> (ctx);
                }
 
-#if !NET_2_1
+#if !MOBILE
                public IChannelListener<TChannel>
                        BuildInnerChannelListener<TChannel> ()
                        where TChannel : class, IChannel
@@ -168,7 +168,7 @@ namespace System.ServiceModel.Channels
                        return ctx.DequeueBindingElement ().CanBuildChannelFactory<TChannel> (ctx);
                }
 
-#if !NET_2_1
+#if !MOBILE
                public bool CanBuildInnerChannelListener<TChannel> ()
                        where TChannel : class, IChannel
                {
index d7bd810a4f6d7d6a2aaf409560fe12c35843f94a..be628e07ccb4bab99490552553ad709a2ccb3ad0 100644 (file)
@@ -40,7 +40,7 @@ namespace System.ServiceModel.Channels
                }
 
                [MonoTODO]
-               protected BindingElement (BindingElement other)
+               protected BindingElement (BindingElement elementToBeCloned)
                {
                }
 
@@ -52,7 +52,7 @@ namespace System.ServiceModel.Channels
                        return context.BuildInnerChannelFactory<TChannel> ();
                }
 
-#if !NET_2_1
+#if !MOBILE
                public virtual IChannelListener<TChannel>
                        BuildChannelListener<TChannel> (
                        BindingContext context)
@@ -70,7 +70,7 @@ namespace System.ServiceModel.Channels
                        return context.CanBuildInnerChannelFactory<TChannel> ();
                }
 
-#if !NET_2_1
+#if !MOBILE
                public virtual bool CanBuildChannelListener<TChannel> (
                        BindingContext context)
                        where TChannel : class, IChannel
index 762cb61b517513fc5a2cb5d42280a6367dc818a7..ea1fa491efa307fe767b38dc8dc94863bfea73ed 100644 (file)
@@ -38,14 +38,14 @@ namespace System.ServiceModel.Channels
                {
                }
 
-               public BindingElementCollection (BindingElement [] bindings)
+               public BindingElementCollection (BindingElement [] elements)
                {
-                       AddRange (bindings);
+                       AddRange (elements);
                }
 
-               public BindingElementCollection (IEnumerable<BindingElement> bindings)
+               public BindingElementCollection (IEnumerable<BindingElement> elements)
                {
-                       foreach (BindingElement e in bindings)
+                       foreach (BindingElement e in elements)
                                Add (e);
                }
 
index 693799434b3a819f530b61b1abb0beea42d04419..b251375659c2ba4eeab423badc432a29b093a2e1 100644 (file)
@@ -39,9 +39,9 @@ namespace System.ServiceModel.Channels
        {
                ChannelManagerBase manager;
 
-               protected ChannelBase (ChannelManagerBase manager)
+               protected ChannelBase (ChannelManagerBase channelManager)
                {
-                       this.manager = manager;
+                       this.manager = channelManager;
                }
 
                protected internal override TimeSpan DefaultCloseTimeout {
index cd573744e202d5b912c2f2e0d38c51751ae02738..d4df2f0f12fbe00c94cc284c68bbbf2a7299b997 100644 (file)
@@ -98,29 +98,29 @@ namespace System.ServiceModel.Channels
                }
 
                public TChannel CreateChannel (
-                       EndpointAddress remoteAddress)
+                       EndpointAddress address)
                {
-                       if (remoteAddress == null)
-                               throw new ArgumentNullException ("remoteAddress");
-                       return CreateChannel (remoteAddress, remoteAddress.Uri);
+                       if (address == null)
+                               throw new ArgumentNullException ("address");
+                       return CreateChannel (address, address.Uri);
                }
 
                public TChannel CreateChannel (
-                       EndpointAddress remoteAddress, Uri via)
+                       EndpointAddress address, Uri via)
                {
-                       if (remoteAddress == null)
-                               throw new ArgumentNullException ("remoteAddress");
+                       if (address == null)
+                               throw new ArgumentNullException ("address");
                        if (via == null)
                                throw new ArgumentNullException ("via");
 
                        ValidateCreateChannel ();
-                       var ch = OnCreateChannel (remoteAddress, via);
+                       var ch = OnCreateChannel (address, via);
                        channels.Add (ch);
                        return ch;
                }
 
                protected abstract TChannel OnCreateChannel (
-                       EndpointAddress remoteAddress, Uri via);
+                       EndpointAddress address, Uri via);
 
                protected override void OnAbort ()
                {
index 7541ca08a04d2b9f214f7d1572308ff252e23e9b..3be8fa805694d664837bca1f6f921f750e102417 100644 (file)
@@ -65,7 +65,7 @@ namespace System.ServiceModel.Channels
                        var f = mbe.CreateMessageEncoderFactory ();
                        var t = typeof (TChannel);
                        if (t == typeof (IRequestSessionChannel) ||
-#if !NET_2_1
+#if !MOBILE
                            t == typeof (IReplySessionChannel) ||
 #endif
                            t == typeof (IInputSessionChannel) ||
index cecbb8ccb120f20d974ebc7ef45dd543a33b4915..feb1f9ae7758247e9ce9563dccc7d1c09d4d0e25 100644 (file)
@@ -68,19 +68,19 @@ namespace System.ServiceModel.Channels
                        security = binding as ISecurityCapabilities;
                }
 
-               public CustomBinding (params BindingElement [] binding)
-                       : this ("CustomBinding", default_ns, binding)
+               public CustomBinding (params BindingElement [] bindingElementsInTopDownChannelStackOrder)
+                       : this ("CustomBinding", default_ns, bindingElementsInTopDownChannelStackOrder)
                {
                }
 
-               public CustomBinding (IEnumerable<BindingElement> bindingElements)
-                       : this (bindingElements, "CustomBinding", default_ns)
+               public CustomBinding (IEnumerable<BindingElement> bindingElementsInTopDownChannelStackOrder)
+                       : this (bindingElementsInTopDownChannelStackOrder, "CustomBinding", default_ns)
                {
                }
 
                public CustomBinding (string name, string ns,
-                       params BindingElement [] binding)
-                       : this (binding, name, ns)
+                       params BindingElement [] bindingElementsInTopDownChannelStackOrder)
+                       : this (bindingElementsInTopDownChannelStackOrder, name, ns)
                {
                }
 
index 23c8081ebebe84c480ffac4f03540850c6ae5a3f..a2918a06e6dcb4e573c28addc3a4453b311dc60b 100644 (file)
@@ -47,20 +47,20 @@ namespace System.ServiceModel.Channels
 
                [MonoTODO]
                protected abstract bool OnTryCreateException (
-                       Message message, MessageFault fault, out Exception error);
+                       Message message, MessageFault fault, out Exception exception);
 
                [MonoTODO]
                protected abstract bool OnTryCreateFaultMessage (
-                       Exception error, out Message message);
+                       Exception exception, out Message message);
 
-               public bool TryCreateException (Message message, MessageFault fault, out Exception error)
+               public bool TryCreateException (Message message, MessageFault fault, out Exception exception)
                {
-                       return OnTryCreateException (message, fault, out error);
+                       return OnTryCreateException (message, fault, out exception);
                }
 
-               public bool TryCreateFaultMessage (Exception error, out Message message)
+               public bool TryCreateFaultMessage (Exception exception, out Message message)
                {
-                       return OnTryCreateFaultMessage (error, out message);
+                       return OnTryCreateFaultMessage (exception, out message);
                }
        }
 
@@ -137,7 +137,7 @@ namespace System.ServiceModel.Channels
 
                        OperationContext ctx = OperationContext.Current;
                        // FIXME: support more fault code depending on the exception type.
-#if !NET_2_1 && !XAMMAC_4_5
+#if !MOBILE && !XAMMAC_4_5
                        // FIXME: set correct fault reason.
                        if (ctx != null && ctx.EndpointDispatcher.ChannelDispatcher.IncludeExceptionDetailInFaults) {
                                ExceptionDetail detail = new ExceptionDetail (error);
index 19faf78c143de4c491c1896c040b61ef2aca1f40..4e4d73f9fb186fe974c15de0cfd45fdfa692f4eb 100644 (file)
@@ -56,7 +56,7 @@ namespace System.ServiceModel.Channels
                        get { return source.MessageEncoder; }
                }
 
-#if NET_2_1
+#if MOBILE
                public override T GetProperty<T> ()
                {
                        if (typeof (T) == typeof (IHttpCookieContainerManager))
@@ -126,6 +126,7 @@ namespace System.ServiceModel.Channels
                        }
 
                        web_request.Timeout = (int) timeout.TotalMilliseconds;
+                       web_request.KeepAlive = httpbe.KeepAliveEnabled;
 
                        // There is no SOAP Action/To header when AddressingVersion is None.
                        if (message.Version.Envelope.Equals (EnvelopeVersion.Soap11) ||
@@ -189,7 +190,7 @@ namespace System.ServiceModel.Channels
                                        suppressEntityBody = true;
                        }
 
-#if !NET_2_1
+#if !MOBILE
                        if (source.ClientCredentials != null) {
                                var cred = source.ClientCredentials;
                                if ((cred.ClientCertificate != null) && (cred.ClientCertificate.Certificate != null))
@@ -476,7 +477,7 @@ namespace System.ServiceModel.Channels
                                        // FIXME: Do we need to use the timeout? If so, what happens when the timeout is reached.
                                        // Is the current request cancelled and an exception thrown? If so we need to pass the
                                        // exception to the Complete () method and allow the result to complete 'normally'.
-#if NET_2_1
+#if MOBILE
                                        // neither Moonlight nor MonoTouch supports contexts (WaitOne default to false)
                                        bool result = AsyncWaitHandle.WaitOne (Timeout);
 #else
index 6b70a26e3b8ec5eb229631210f77928330faaaf1..d3c70970adfcd8490014b5cdfea51b888c8adfd7 100644 (file)
@@ -32,7 +32,7 @@ using System.Net;
 using System.Net.Security;
 using System.Security.Authentication.ExtendedProtection;
 using System.ServiceModel.Channels;
-#if !NET_2_1
+#if !MOBILE
 using System.ServiceModel.Channels.Http;
 #endif
 using System.ServiceModel.Description;
@@ -67,28 +67,28 @@ namespace System.ServiceModel.Channels
                }
 
                protected HttpTransportBindingElement (
-                       HttpTransportBindingElement other)
-                       : base (other)
+                       HttpTransportBindingElement elementToBeCloned)
+                       : base (elementToBeCloned)
                {
-                       allow_cookies = other.allow_cookies;
-                       bypass_proxy_on_local = other.bypass_proxy_on_local;
-                       unsafe_ntlm_auth = other.unsafe_ntlm_auth;
-                       use_default_proxy = other.use_default_proxy;
-                       keep_alive_enabled = other.keep_alive_enabled;
-                       max_buffer_size = other.max_buffer_size;
-                       host_cmp_mode = other.host_cmp_mode;
-                       proxy_address = other.proxy_address;
-                       realm = other.realm;
-                       transfer_mode = other.transfer_mode;
+                       allow_cookies = elementToBeCloned.allow_cookies;
+                       bypass_proxy_on_local = elementToBeCloned.bypass_proxy_on_local;
+                       unsafe_ntlm_auth = elementToBeCloned.unsafe_ntlm_auth;
+                       use_default_proxy = elementToBeCloned.use_default_proxy;
+                       keep_alive_enabled = elementToBeCloned.keep_alive_enabled;
+                       max_buffer_size = elementToBeCloned.max_buffer_size;
+                       host_cmp_mode = elementToBeCloned.host_cmp_mode;
+                       proxy_address = elementToBeCloned.proxy_address;
+                       realm = elementToBeCloned.realm;
+                       transfer_mode = elementToBeCloned.transfer_mode;
                        // FIXME: it does not look safe
-                       timeouts = other.timeouts;
-                       auth_scheme = other.auth_scheme;
-                       proxy_auth_scheme = other.proxy_auth_scheme;
+                       timeouts = elementToBeCloned.timeouts;
+                       auth_scheme = elementToBeCloned.auth_scheme;
+                       proxy_auth_scheme = elementToBeCloned.proxy_auth_scheme;
 
-                       DecompressionEnabled = other.DecompressionEnabled;
-                       LegacyExtendedProtectionPolicy = other.LegacyExtendedProtectionPolicy;
-                       ExtendedProtectionPolicy = other.ExtendedProtectionPolicy;
-                       cookie_manager = other.cookie_manager;
+                       DecompressionEnabled = elementToBeCloned.DecompressionEnabled;
+                       LegacyExtendedProtectionPolicy = elementToBeCloned.LegacyExtendedProtectionPolicy;
+                       ExtendedProtectionPolicy = elementToBeCloned.ExtendedProtectionPolicy;
+                       cookie_manager = elementToBeCloned.cookie_manager;
                }
 
                [DefaultValue (AuthenticationSchemes.Anonymous)]
@@ -185,7 +185,7 @@ namespace System.ServiceModel.Channels
                        return typeof (TChannel) == typeof (IRequestChannel);
                }
 
-#if !NET_2_1 && !XAMMAC_4_5
+#if !MOBILE && !XAMMAC_4_5
                public override bool CanBuildChannelListener<TChannel> (
                        BindingContext context)
                {
@@ -201,7 +201,7 @@ namespace System.ServiceModel.Channels
                        return new HttpChannelFactory<TChannel> (this, context);
                }
 
-#if !NET_2_1 && !XAMMAC_4_5
+#if !MOBILE && !XAMMAC_4_5
                internal static object ListenerBuildLock = new object ();
 
                public override IChannelListener<TChannel> BuildChannelListener<TChannel> (
@@ -242,7 +242,7 @@ namespace System.ServiceModel.Channels
                        set { throw new NotImplementedException (); }
                }
 
-#if !NET_2_1 && !XAMMAC_4_5
+#if !MOBILE && !XAMMAC_4_5
                void IPolicyExportExtension.ExportPolicy (
                        MetadataExporter exporter,
                        PolicyConversionContext context)
index d95dd5f35ef09e0c2122eef6b84f20450ed617d3..3d890b95142d29f5ba2e8d49730c6a6086843103 100644 (file)
@@ -47,10 +47,10 @@ namespace System.ServiceModel.Channels
                }
 
                protected HttpsTransportBindingElement (
-                       HttpsTransportBindingElement other)
-                       : base (other)
+                       HttpsTransportBindingElement elementToBeCloned)
+                       : base (elementToBeCloned)
                {
-                       req_cli_cert = other.req_cli_cert;
+                       req_cli_cert = elementToBeCloned.req_cli_cert;
                }
 
                public bool RequireClientCertificate {
@@ -68,7 +68,7 @@ namespace System.ServiceModel.Channels
                        return base.BuildChannelFactory <TChannel> (context);
                }
 
-#if !NET_2_1 && !XAMMAC_4_5
+#if !MOBILE && !XAMMAC_4_5
                [MonoTODO]
                public override IChannelListener<TChannel>
                        BuildChannelListener<TChannel> (
@@ -83,7 +83,7 @@ namespace System.ServiceModel.Channels
                        return new HttpsTransportBindingElement (this);
                }
 
-#if !NET_2_1 && !XAMMAC_4_5
+#if !MOBILE && !XAMMAC_4_5
                public XmlElement GetTransportTokenAssertion ()
                {
                        var doc = new XmlDocument ();
index ef58f946dff47038fb7ba7205b1bcf65e850b9ff..05fc00512be492a08dc4461d885916ef254911cc 100644 (file)
@@ -33,7 +33,7 @@ namespace System.ServiceModel.Channels
        [MonoTODO]
        public sealed class LocalClientSecuritySettings
        {
-#if !NET_2_1
+#if !MOBILE
                bool cache_cookies = true;
                int cookie_renewal = 60;
                bool detect_replays = true;
@@ -56,7 +56,7 @@ namespace System.ServiceModel.Channels
                public TimeSpan ReplayWindow { get; set; }
                public TimeSpan TimestampValidityDuration { get; set; }
 
-#if !NET_2_1
+#if !MOBILE
                public bool CacheCookies {
                        get { return cache_cookies; }
                        set { cache_cookies = value; }
index f67ce5dd8ad5a357f0d1408aec19137c4e16ac62..1b6be5ad60d66d7d4064dcf22255545d65abf0a7 100644 (file)
@@ -98,10 +98,10 @@ namespace System.ServiceModel.Channels
                        return OnGetBody<T> (GetReaderAtBodyContents ());
                }
 
-               public T GetBody<T> (XmlObjectSerializer xmlFormatter)
+               public T GetBody<T> (XmlObjectSerializer serializer)
                {
                        // FIXME: Somehow use OnGetBody() here as well?
-                       return (T)xmlFormatter.ReadObject (GetReaderAtBodyContents ());
+                       return (T)serializer.ReadObject (GetReaderAtBodyContents ());
                }
 
                protected virtual T OnGetBody<T> (XmlDictionaryReader reader)
@@ -369,13 +369,13 @@ namespace System.ServiceModel.Channels
 
                // 5)
                public static Message CreateMessage (MessageVersion version,
-                       string action, object body, XmlObjectSerializer xmlFormatter)
+                       string action, object body, XmlObjectSerializer serializer)
                {
                        return body == null ?
                                CreateMessage (version, action) :
                                CreateMessage (
                                        version, action,
-                                       new XmlObjectSerializerBodyWriter (body, xmlFormatter));
+                                       new XmlObjectSerializerBodyWriter (body, serializer));
                }
 
                // 6)
index 4f3d010088ab78b68be8535be00fa4d8e06bc565..caebb3a7eba951ed814029b5f0caf6a2c05fe37e 100644 (file)
@@ -89,7 +89,7 @@ namespace System.ServiceModel.Channels
                }
        }
 
-#if !NET_2_1
+#if !MOBILE
        internal class XPathMessageBuffer : MessageBuffer
        {
                IXPathNavigable source;
index 49a8478f6f98af7b61a9254940ec6df38bb958b3..9a40e499eb2806b29820caaace34b34d874d859a 100644 (file)
@@ -42,9 +42,9 @@ namespace System.ServiceModel.Channels
 
                [MonoTODO]
                public
-               MessageEncodingBindingElement (MessageEncodingBindingElement source)
+               MessageEncodingBindingElement (MessageEncodingBindingElement elementToBeCloned)
                {
-                       MessageVersion = source.MessageVersion;
+                       MessageVersion = elementToBeCloned.MessageVersion;
                }
 
                public abstract MessageEncoderFactory
@@ -52,14 +52,14 @@ namespace System.ServiceModel.Channels
 
                public abstract MessageVersion MessageVersion { get; set; }
 
-               public override T GetProperty<T> (BindingContext ctx)
+               public override T GetProperty<T> (BindingContext context)
                {
                        if (typeof (T) == typeof (MessageVersion))
                                return (T) (object) MessageVersion;
-                       return ctx.GetInnerProperty<T> ();
+                       return context.GetInnerProperty<T> ();
                }
 
-#if !NET_2_1 && !XAMMAC_4_5
+#if !MOBILE && !XAMMAC_4_5
                [MonoTODO]
                protected virtual void OnImportPolicy (XmlElement assertion,
                        MessageVersion messageVersion,
index 3e809c4b1372773663015b841a8fa0ea60d86286..8527e5c313419206b5ee66e7b38885e7a449c393 100644 (file)
@@ -53,7 +53,7 @@ namespace System.ServiceModel.Channels
                {
                        FaultCode fc = null;
                        FaultReason fr = null;
-                       object details = null;
+                       string actor = null;
                        XmlDictionaryReader r = message.GetReaderAtBodyContents ();
                        r.ReadStartElement ("Fault", message.Version.Envelope.Namespace);
                        r.MoveToContent ();
@@ -66,11 +66,13 @@ namespace System.ServiceModel.Channels
                                case "faultstring":
                                        fr = new FaultReason (r.ReadElementContentAsString());
                                        break;
-                               case "detail":
-                                       return new XmlReaderDetailMessageFault (message, r, fc, fr, null, null);
                                case "faultactor":
+                                       actor = r.ReadElementContentAsString();
+                                       break;
+                               case "detail":
+                                       return new XmlReaderDetailMessageFault (message, r, fc, fr, actor, null);
                                default:
-                                       throw new NotImplementedException ();
+                                       throw new XmlException (String.Format ("Unexpected node {0} name {1}", r.NodeType, r.Name));
                                }
                                r.MoveToContent ();
                        }
@@ -79,9 +81,7 @@ namespace System.ServiceModel.Channels
                        if (fr == null)
                                throw new XmlException ("Reason is missing in the Fault message");
 
-                       if (details == null)
-                               return CreateFault (fc, fr);
-                       return CreateFault (fc, fr, details);
+                       return new SimpleMessageFault (fc, fr, false, null, null, actor, null);
                }
 
                static MessageFault CreateFault12 (Message message, int maxBufferSize)
@@ -397,12 +397,12 @@ namespace System.ServiceModel.Channels
                        return GetDetail<T> (new DataContractSerializer (typeof (T)));
                }
 
-               public T GetDetail<T> (XmlObjectSerializer formatter)
+               public T GetDetail<T> (XmlObjectSerializer serializer)
                {
                        if (!HasDetail)
                                throw new InvalidOperationException ("This message does not have details.");
 
-                       return (T) formatter.ReadObject (GetReaderAtDetailContents ());
+                       return (T) serializer.ReadObject (GetReaderAtDetailContents ());
                }
 
                public XmlDictionaryReader GetReaderAtDetailContents ()
index 8427b92c5697d643b7cd42c1b813ce5c1750c879..4769523848907ce28b261a5a778a3612dcc393ef 100644 (file)
@@ -59,56 +59,56 @@ namespace System.ServiceModel.Channels
                        return CreateHeader (name, ns, value, default_must_understand);
                }
 
-               public static MessageHeader CreateHeader (string name, string ns, object value, bool must_understand)
+               public static MessageHeader CreateHeader (string name, string ns, object value, bool mustUnderstand)
                {
-                       return CreateHeader (name, ns, value, must_understand, default_actor);
+                       return CreateHeader (name, ns, value, mustUnderstand, default_actor);
                }
 
-               public static MessageHeader CreateHeader (string name, string ns, object value, XmlObjectSerializer formatter)
+               public static MessageHeader CreateHeader (string name, string ns, object value, XmlObjectSerializer serializer)
                {
-                       return CreateHeader (name, ns, value, formatter, default_must_understand, 
+                       return CreateHeader (name, ns, value, serializer, default_must_understand, 
                                             default_actor, default_relay);
                }
 
                public static MessageHeader CreateHeader (string name, string ns, object value, 
-                                                  bool must_understand, string actor)
+                                                  bool mustUnderstand, string actor)
                {
-                       return CreateHeader (name, ns, value, must_understand, actor, default_relay);
+                       return CreateHeader (name, ns, value, mustUnderstand, actor, default_relay);
                }
 
-               public static MessageHeader CreateHeader (string name, string ns, object value, XmlObjectSerializer formatter, 
-                                                  bool must_understand)
+               public static MessageHeader CreateHeader (string name, string ns, object value, XmlObjectSerializer serializer, 
+                                                  bool mustUnderstand)
                {
-                       return CreateHeader (name, ns, value, formatter, must_understand, default_actor, default_relay);
+                       return CreateHeader (name, ns, value, serializer, mustUnderstand, default_actor, default_relay);
                }
                
                public static MessageHeader CreateHeader (string name, string ns, object value, 
-                                                  bool must_understand, string actor, bool relay)
+                                                  bool mustUnderstand, string actor, bool relay)
                {
                        return CreateHeader (name, ns, value, new DataContractSerializer (value.GetType ()),
-                                       must_understand, actor, relay);
+                                       mustUnderstand, actor, relay);
                }
 
-               public static MessageHeader CreateHeader (string name, string ns, object value, XmlObjectSerializer formatter,
-                                                  bool must_understand, string actor)
+               public static MessageHeader CreateHeader (string name, string ns, object value, XmlObjectSerializer serializer,
+                                                  bool mustUnderstand, string actor)
                {
-                       return CreateHeader (name, ns, value, formatter, must_understand, actor, default_relay);
+                       return CreateHeader (name, ns, value, serializer, mustUnderstand, actor, default_relay);
                }
                
-               public static MessageHeader CreateHeader (string name, string ns, object value, XmlObjectSerializer formatter,
-                                                  bool must_understand, string actor, bool relay)
+               public static MessageHeader CreateHeader (string name, string ns, object value, XmlObjectSerializer serializer,
+                                                  bool mustUnderstand, string actor, bool relay)
                {
                        // FIXME: how to get IsReferenceParameter ?
-                       return new DefaultMessageHeader (name, ns, value, formatter, default_is_ref, must_understand, actor, relay);
+                       return new DefaultMessageHeader (name, ns, value, serializer, default_is_ref, mustUnderstand, actor, relay);
                }
 
-               public virtual bool IsMessageVersionSupported (MessageVersion version)
+               public virtual bool IsMessageVersionSupported (MessageVersion messageVersion)
                {
-                       if (version.Envelope == EnvelopeVersion.Soap12)
+                       if (messageVersion.Envelope == EnvelopeVersion.Soap12)
                                if (Actor == EnvelopeVersion.Soap11.NextDestinationActorValue)
                                        return false;
 
-                       if (version.Envelope == EnvelopeVersion.Soap11)
+                       if (messageVersion.Envelope == EnvelopeVersion.Soap11)
                                if (Actor == EnvelopeVersion.Soap12.NextDestinationActorValue ||
                                    Actor == EnvelopeVersion.Soap12UltimateReceiver)
                                        return false;
@@ -117,9 +117,9 @@ namespace System.ServiceModel.Channels
                        return true;
                }
 
-               protected abstract void OnWriteHeaderContents (XmlDictionaryWriter writer, MessageVersion version);
+               protected abstract void OnWriteHeaderContents (XmlDictionaryWriter writer, MessageVersion messageVersion);
 
-               protected virtual void OnWriteStartHeader (XmlDictionaryWriter writer, MessageVersion version)
+               protected virtual void OnWriteStartHeader (XmlDictionaryWriter writer, MessageVersion messageVersion)
                {
                        var dic = Constants.SoapDictionary;
                        XmlDictionaryString name, ns;
@@ -128,7 +128,7 @@ namespace System.ServiceModel.Channels
                                writer.WriteStartElement (prefix, name, ns);
                        else
                                writer.WriteStartElement (prefix, this.Name, this.Namespace);
-                       WriteHeaderAttributes (writer, version);
+                       WriteHeaderAttributes (writer, messageVersion);
                }
 
                public override string ToString ()
@@ -143,58 +143,58 @@ namespace System.ServiceModel.Channels
                        return sb.ToString ();
                }
 
-               public void WriteHeader (XmlDictionaryWriter writer, MessageVersion version)
+               public void WriteHeader (XmlDictionaryWriter writer, MessageVersion messageVersion)
                {
                        if (writer == null)
                                throw new ArgumentNullException ("writer is null.");
 
-                       if (version == null)
-                               throw new ArgumentNullException ("version is null.");
+                       if (messageVersion == null)
+                               throw new ArgumentNullException ("messageVersion is null.");
 
-                       if (version.Envelope == EnvelopeVersion.None)
+                       if (messageVersion.Envelope == EnvelopeVersion.None)
                                return;
 
-                       WriteStartHeader (writer, version);
-                       WriteHeaderContents (writer, version);
+                       WriteStartHeader (writer, messageVersion);
+                       WriteHeaderContents (writer, messageVersion);
 
                        writer.WriteEndElement ();
                }
 
-               public void WriteHeader (XmlWriter writer, MessageVersion version)
+               public void WriteHeader (XmlWriter writer, MessageVersion messageVersion)
                {
-                       WriteHeader (XmlDictionaryWriter.CreateDictionaryWriter (writer), version);
+                       WriteHeader (XmlDictionaryWriter.CreateDictionaryWriter (writer), messageVersion);
                }
 
-               protected void WriteHeaderAttributes (XmlDictionaryWriter writer, MessageVersion version)
+               protected void WriteHeaderAttributes (XmlDictionaryWriter writer, MessageVersion messageVersion)
                {
                        var dic = Constants.SoapDictionary;
                        if (Id != null)
                                writer.WriteAttributeString ("u", dic.Add ("Id"), dic.Add (Constants.WsuNamespace), Id);
                        if (!String.IsNullOrEmpty (Actor)) {
-                               if (version.Envelope == EnvelopeVersion.Soap11) 
-                                       writer.WriteAttributeString ("s", dic.Add ("actor"), dic.Add (version.Envelope.Namespace), Actor);
+                               if (messageVersion.Envelope == EnvelopeVersion.Soap11) 
+                                       writer.WriteAttributeString ("s", dic.Add ("actor"), dic.Add (messageVersion.Envelope.Namespace), Actor);
 
-                               if (version.Envelope == EnvelopeVersion.Soap12) 
-                                       writer.WriteAttributeString ("s", dic.Add ("role"), dic.Add (version.Envelope.Namespace), Actor);
+                               if (messageVersion.Envelope == EnvelopeVersion.Soap12) 
+                                       writer.WriteAttributeString ("s", dic.Add ("role"), dic.Add (messageVersion.Envelope.Namespace), Actor);
                        }
 
                        // mustUnderstand is the same across SOAP 1.1 and 1.2
                        if (MustUnderstand == true)
-                               writer.WriteAttributeString ("s", dic.Add ("mustUnderstand"), dic.Add (version.Envelope.Namespace), "1");
+                               writer.WriteAttributeString ("s", dic.Add ("mustUnderstand"), dic.Add (messageVersion.Envelope.Namespace), "1");
 
                        // relay is only available on SOAP 1.2
-                       if (Relay == true && version.Envelope == EnvelopeVersion.Soap12)
-                               writer.WriteAttributeString ("s", dic.Add ("relay"), dic.Add (version.Envelope.Namespace), "true");
+                       if (Relay == true && messageVersion.Envelope == EnvelopeVersion.Soap12)
+                               writer.WriteAttributeString ("s", dic.Add ("relay"), dic.Add (messageVersion.Envelope.Namespace), "true");
                }
 
-               public void WriteHeaderContents (XmlDictionaryWriter writer, MessageVersion version)
+               public void WriteHeaderContents (XmlDictionaryWriter writer, MessageVersion messageVersion)
                {
-                       this.OnWriteHeaderContents (writer, version);
+                       this.OnWriteHeaderContents (writer, messageVersion);
                }
 
-               public void WriteStartHeader (XmlDictionaryWriter writer, MessageVersion version)
+               public void WriteStartHeader (XmlDictionaryWriter writer, MessageVersion messageVersion)
                {
-                       this.OnWriteStartHeader (writer, version);
+                       this.OnWriteStartHeader (writer, messageVersion);
                }
 
                public override string Actor { get { return default_actor; }}
@@ -209,7 +209,7 @@ namespace System.ServiceModel.Channels
                {
                        bool is_ref, must_understand, relay;
                        string actor;
-#if NET_2_1
+#if MOBILE
                        string body;
 #else
                        // This is required to completely clone body xml that 
@@ -238,7 +238,7 @@ namespace System.ServiceModel.Channels
 
                                local_name = reader.LocalName;
                                namespace_uri = reader.NamespaceURI;
-#if NET_2_1
+#if MOBILE
                                body = reader.ReadOuterXml ();
 #else
                                body = new XmlDocument ();
@@ -250,7 +250,7 @@ namespace System.ServiceModel.Channels
 
                        public XmlReader CreateReader ()
                        {
-#if NET_2_1
+#if MOBILE
                                var reader = XmlReader.Create (new StringReader (body));
 #else
                                var reader = new XmlNodeReader (body);
index 4060586ca1c164ccb7d44b9620101412663ceb7a..c08ef8697dd13e5cba749f5e94fc573d69450439 100644 (file)
@@ -72,9 +72,9 @@ namespace System.ServiceModel.Channels
                        l.Add (header);
                }
 
-               public void CopyHeaderFrom (Message m, int index)
+               public void CopyHeaderFrom (Message message, int headerIndex)
                {
-                       CopyHeaderFrom (m.Headers, index);
+                       CopyHeaderFrom (message.Headers, headerIndex);
                }
 
                public void Clear ()
@@ -82,25 +82,25 @@ namespace System.ServiceModel.Channels
                        l.Clear ();
                }
 
-               public void CopyHeaderFrom (MessageHeaders headers, int index)
+               public void CopyHeaderFrom (MessageHeaders collection, int headerIndex)
                {
-                       l.Add (headers [index]);
+                       l.Add (collection [headerIndex]);
                }
 
-               public void CopyHeadersFrom (Message m)
+               public void CopyHeadersFrom (Message message)
                {
-                       CopyHeadersFrom (m.Headers);
+                       CopyHeadersFrom (message.Headers);
                }
 
-               public void CopyHeadersFrom (MessageHeaders headers)
+               public void CopyHeadersFrom (MessageHeaders collection)
                {
-                       foreach (MessageHeaderInfo h in headers)
+                       foreach (MessageHeaderInfo h in collection)
                                l.Add (h);
                }
 
-               public void CopyTo (MessageHeaderInfo [] dst, int index)
+               public void CopyTo (MessageHeaderInfo [] array, int index)
                {
-                       l.CopyTo (dst, index);
+                       l.CopyTo (array, index);
                }
 
                public int FindHeader (string name, string ns)
@@ -203,11 +203,11 @@ namespace System.ServiceModel.Channels
                        return GetHeader<T> (idx, serializer);
                }
 
-               public XmlDictionaryReader GetReaderAtHeader (int index)
+               public XmlDictionaryReader GetReaderAtHeader (int headerIndex)
                {
-                       if (index >= l.Count)
-                               throw new ArgumentOutOfRangeException (String.Format ("Index is out of range. Current header count is {0}", index));
-                       MessageHeader item = (MessageHeader) l [index];
+                       if (headerIndex >= l.Count)
+                               throw new ArgumentOutOfRangeException (String.Format ("Index is out of range. Current header count is {0}", l.Count));
+                       MessageHeader item = (MessageHeader) l [headerIndex];
 
                        XmlReader reader =
                                item is MessageHeader.XmlMessageHeader ?
@@ -231,9 +231,9 @@ namespace System.ServiceModel.Channels
                        throw new NotImplementedException ();
                }
 
-               public void Insert (int index, MessageHeader header)
+               public void Insert (int headerIndex, MessageHeader header)
                {
-                       l.Insert (index, header);
+                       l.Insert (headerIndex, header);
                }
 
                public void RemoveAll (string name, string ns)
@@ -251,9 +251,9 @@ namespace System.ServiceModel.Channels
                                l.RemoveAt (l.Count - 1);
                }
 
-               public void RemoveAt (int index)
+               public void RemoveAt (int headerIndex)
                {
-                       l.RemoveAt (index);
+                       l.RemoveAt (headerIndex);
                }
 
                IEnumerator IEnumerable.GetEnumerator ()
@@ -261,48 +261,48 @@ namespace System.ServiceModel.Channels
                        return ((IEnumerable) l).GetEnumerator ();
                }
 
-               public void WriteHeader (int index, XmlDictionaryWriter writer)
+               public void WriteHeader (int headerIndex, XmlDictionaryWriter writer)
                {
                        if (version.Envelope == EnvelopeVersion.None)
                                return;
-                       WriteStartHeader (index, writer);
-                       WriteHeaderContents (index, writer);
+                       WriteStartHeader (headerIndex, writer);
+                       WriteHeaderContents (headerIndex, writer);
                        writer.WriteEndElement ();
                }
 
-               public void WriteHeader (int index, XmlWriter writer)
+               public void WriteHeader (int headerIndex, XmlWriter writer)
                {
-                       WriteHeader (index, XmlDictionaryWriter.CreateDictionaryWriter (writer));
+                       WriteHeader (headerIndex, XmlDictionaryWriter.CreateDictionaryWriter (writer));
                }
 
-               public void WriteHeaderContents (int index, XmlDictionaryWriter writer)
+               public void WriteHeaderContents (int headerIndex, XmlDictionaryWriter writer)
                {
-                       if (index > l.Count)
-                               throw new ArgumentOutOfRangeException ("There is no header at position " + index + ".");
+                       if (headerIndex > l.Count)
+                               throw new ArgumentOutOfRangeException ("There is no header at position " + headerIndex + ".");
                        
-                       MessageHeader h = l [index] as MessageHeader;
+                       MessageHeader h = l [headerIndex] as MessageHeader;
 
                        h.WriteHeaderContents (writer, version);
                }
 
-               public void WriteHeaderContents (int index, XmlWriter writer)
+               public void WriteHeaderContents (int headerIndex, XmlWriter writer)
                {
-                       WriteHeaderContents (index, XmlDictionaryWriter.CreateDictionaryWriter (writer));
+                       WriteHeaderContents (headerIndex, XmlDictionaryWriter.CreateDictionaryWriter (writer));
                }
 
-               public void WriteStartHeader (int index, XmlDictionaryWriter writer)
+               public void WriteStartHeader (int headerIndex, XmlDictionaryWriter writer)
                {
-                       if (index > l.Count)
-                               throw new ArgumentOutOfRangeException ("There is no header at position " + index + ".");
+                       if (headerIndex > l.Count)
+                               throw new ArgumentOutOfRangeException ("There is no header at position " + headerIndex + ".");
 
-                       MessageHeader h = l [index] as MessageHeader;
+                       MessageHeader h = l [headerIndex] as MessageHeader;
                        
                        h.WriteStartHeader (writer, version);
                }
 
-               public void WriteStartHeader (int index, XmlWriter writer)
+               public void WriteStartHeader (int headerIndex, XmlWriter writer)
                {
-                       WriteStartHeader (index, XmlDictionaryWriter.CreateDictionaryWriter (writer));
+                       WriteStartHeader (headerIndex, XmlDictionaryWriter.CreateDictionaryWriter (writer));
                }
 
                public string Action {
@@ -327,7 +327,7 @@ namespace System.ServiceModel.Channels
                                return;
                        if (MessageVersion.Addressing.Equals (AddressingVersion.WSAddressing10))
                                Add (MessageHeader.CreateHeader (name, ns, EndpointAddress10.FromEndpointAddress (address)));
-#if !NET_2_1
+#if !MOBILE
                        else if (MessageVersion.Addressing.Equals (AddressingVersion.WSAddressingAugust2004))
                                Add (MessageHeader.CreateHeader (name, ns, EndpointAddressAugust2004.FromEndpointAddress (address)));
 #endif
index db1c8fd46b7c2dfa6dc72f6f2ef2f7f871a566d5..f46f2ffe2cfa5926ea8ed7e05b3d93231f812fbc 100644 (file)
@@ -98,7 +98,7 @@ namespace System.ServiceModel.Channels
                        }
                }
 
-#if !NET_2_1
+#if !MOBILE
                public SecurityMessageProperty Security {
                        get { return (SecurityMessageProperty) this ["Security"]; }
                        set { this ["Security"] = value; }
index f79b9e94c42f61c06a329b5385b6ede9a58bfd69..27f3ea130c75f2a4ab2ca895296566373566889e 100644 (file)
@@ -53,36 +53,36 @@ namespace System.ServiceModel.Channels {
                        this.addressing = addressing;
                }
                
-               public static MessageVersion CreateVersion (EnvelopeVersion envelope_version)
+               public static MessageVersion CreateVersion (EnvelopeVersion envelopeVersion)
                {
-                       return CreateVersion (envelope_version,
+                       return CreateVersion (envelopeVersion,
                                AddressingVersion.WSAddressing10);
                }
 
-               public static MessageVersion CreateVersion (EnvelopeVersion envelope_version,
-                                                           AddressingVersion addressing_version)
+               public static MessageVersion CreateVersion (EnvelopeVersion envelopeVersion,
+                                                           AddressingVersion addressingVersion)
                {
-                       if (envelope_version == EnvelopeVersion.None && addressing_version == AddressingVersion.None)
+                       if (envelopeVersion == EnvelopeVersion.None && addressingVersion == AddressingVersion.None)
                                return None;
-                       if (envelope_version == EnvelopeVersion.Soap11 && addressing_version == AddressingVersion.None)
+                       if (envelopeVersion == EnvelopeVersion.Soap11 && addressingVersion == AddressingVersion.None)
                                return Soap11;
-                       if (envelope_version == EnvelopeVersion.Soap12 && addressing_version == AddressingVersion.WSAddressing10)
+                       if (envelopeVersion == EnvelopeVersion.Soap12 && addressingVersion == AddressingVersion.WSAddressing10)
                                return Soap12WSAddressing10;
 
-                       if (envelope_version == EnvelopeVersion.Soap12 && addressing_version == AddressingVersion.None)
+                       if (envelopeVersion == EnvelopeVersion.Soap12 && addressingVersion == AddressingVersion.None)
                                return Soap12;
-                       if (envelope_version == EnvelopeVersion.Soap11 && addressing_version == AddressingVersion.WSAddressing10)
+                       if (envelopeVersion == EnvelopeVersion.Soap11 && addressingVersion == AddressingVersion.WSAddressing10)
                                return Soap11WSAddressing10;
-                       if (envelope_version == EnvelopeVersion.Soap11 && addressing_version == AddressingVersion.WSAddressingAugust2004)
+                       if (envelopeVersion == EnvelopeVersion.Soap11 && addressingVersion == AddressingVersion.WSAddressingAugust2004)
                                return Soap11WSAddressingAugust2004;
-                       if (envelope_version == EnvelopeVersion.Soap12 && addressing_version == AddressingVersion.WSAddressingAugust2004)
+                       if (envelopeVersion == EnvelopeVersion.Soap12 && addressingVersion == AddressingVersion.WSAddressingAugust2004)
                                return Soap12WSAddressingAugust2004;
-                       throw new ArgumentException (string.Format ("EnvelopeVersion {0} cannot be used with AddressingVersion {1}", envelope_version, addressing_version));
+                       throw new ArgumentException (string.Format ("EnvelopeVersion {0} cannot be used with AddressingVersion {1}", envelopeVersion, addressingVersion));
                }
 
-               public override bool Equals (object value)
+               public override bool Equals (object obj)
                {
-                       MessageVersion other = value as MessageVersion;
+                       MessageVersion other = obj as MessageVersion;
 
                        if (other == null)
                                return false;
index 422e6e92c1f74619a899c1979d834bcd91a09733..1e3bf6cbefb1d3df14ac9d211672e1f4f787eb46 100644 (file)
@@ -69,7 +69,7 @@ namespace System.ServiceModel.Channels
                        throw new NotImplementedException ();
                }
                
-#if !NET_2_1
+#if !MOBILE
                [MonoTODO]
                public override IChannelListener<TChannel> BuildChannelListener<TChannel> (BindingContext context)
                {
index 1f47b906c0367a0d89384401d31f0723fa51deb7..ffcc6110be6b8219fe27b0aa7131899ebb060e9a 100644 (file)
@@ -30,7 +30,7 @@ using System.Collections.ObjectModel;
 using System.ServiceModel.Description;
 using System.ServiceModel.Channels;
 using System.ServiceModel.Security;
-#if !NET_2_1 && !XAMMAC_4_5
+#if !MOBILE && !XAMMAC_4_5
 using System.ServiceModel.Channels.Security;
 using System.IdentityModel.Selectors;
 using System.IdentityModel.Tokens;
@@ -46,7 +46,7 @@ namespace System.ServiceModel.Channels
                {
                        MessageSecurityVersion = MessageSecurityVersion.Default;
                        endpoint = new SupportingTokenParameters ();
-#if !NET_2_1 && !XAMMAC_4_5
+#if !MOBILE && !XAMMAC_4_5
                        DefaultAlgorithmSuite = SecurityAlgorithmSuite.Default;
                        KeyEntropyMode = SecurityKeyEntropyMode.CombinedEntropy;
                        operation = new Dictionary<string,SupportingTokenParameters> ();
@@ -63,7 +63,7 @@ namespace System.ServiceModel.Channels
                        security_header_layout = other.security_header_layout;
                        msg_security_version = other.msg_security_version;
                        endpoint = other.endpoint.Clone ();
-#if !NET_2_1 && !XAMMAC_4_5
+#if !MOBILE && !XAMMAC_4_5
                        alg_suite = other.alg_suite;
                        key_entropy_mode = other.key_entropy_mode;
                        opt_endpoint = other.opt_endpoint.Clone ();
@@ -83,7 +83,7 @@ namespace System.ServiceModel.Channels
                MessageSecurityVersion msg_security_version;
                SupportingTokenParameters endpoint;
 
-#if !NET_2_1 && !XAMMAC_4_5
+#if !MOBILE && !XAMMAC_4_5
                SecurityAlgorithmSuite alg_suite;
                SecurityKeyEntropyMode key_entropy_mode;
                SupportingTokenParameters opt_endpoint;
@@ -109,7 +109,7 @@ namespace System.ServiceModel.Channels
                        get { return endpoint; }
                }
 
-#if !NET_2_1 && !XAMMAC_4_5
+#if !MOBILE && !XAMMAC_4_5
                public SecurityAlgorithmSuite DefaultAlgorithmSuite {
                        get { return alg_suite; }
                        set { alg_suite = value; }
@@ -140,7 +140,7 @@ namespace System.ServiceModel.Channels
                [MonoTODO ("Implement for TransportSecurityBindingElement")]
                public override bool CanBuildChannelFactory<TChannel> (BindingContext context)
                {
-#if NET_2_1 || XAMMAC_4_5
+#if MOBILE || XAMMAC_4_5
                        // not sure this should be like this, but there isn't Symmetric/Asymmetric elements in 2.1 anyways.
                        return context.CanBuildInnerChannelFactory<TChannel> ();
 #else
@@ -185,7 +185,7 @@ namespace System.ServiceModel.Channels
                protected abstract IChannelFactory<TChannel>
                        BuildChannelFactoryCore<TChannel> (BindingContext context);
 
-#if !NET_2_1 && !XAMMAC_4_5
+#if !MOBILE && !XAMMAC_4_5
                [MonoTODO ("Implement for TransportSecurityBindingElement")]
                public override bool CanBuildChannelListener<TChannel> (BindingContext context)
                {
@@ -272,7 +272,7 @@ namespace System.ServiceModel.Channels
 #endif
 
                #region Factory methods
-#if !NET_2_1 && !XAMMAC_4_5
+#if !MOBILE && !XAMMAC_4_5
                public static SymmetricSecurityBindingElement 
                        CreateAnonymousForCertificateBindingElement ()
                {
@@ -531,29 +531,29 @@ namespace System.ServiceModel.Channels
 #endif
 
                public static SecurityBindingElement 
-                       CreateSecureConversationBindingElement (SecurityBindingElement binding)
+                       CreateSecureConversationBindingElement (SecurityBindingElement bootstrapSecurity)
                {
-                       return CreateSecureConversationBindingElement (binding, false);
+                       return CreateSecureConversationBindingElement (bootstrapSecurity, false);
                }
 
                public static SecurityBindingElement 
                        CreateSecureConversationBindingElement (
-                       SecurityBindingElement binding, bool requireCancellation)
+                       SecurityBindingElement bootstrapSecurity, bool requireCancellation)
                {
-                       return CreateSecureConversationBindingElement (binding, requireCancellation, null);
+                       return CreateSecureConversationBindingElement (bootstrapSecurity, requireCancellation, null);
                }
 
                public static SecurityBindingElement 
                        CreateSecureConversationBindingElement (
-                       SecurityBindingElement binding, bool requireCancellation,
-                       ChannelProtectionRequirements protectionRequirements)
+                       SecurityBindingElement bootstrapSecurity, bool requireCancellation,
+                       ChannelProtectionRequirements bootstrapProtectionRequirements)
                {
-#if !NET_2_1 && !XAMMAC_4_5
+#if !MOBILE && !XAMMAC_4_5
                        SymmetricSecurityBindingElement be =
                                new SymmetricSecurityBindingElement ();
                        be.ProtectionTokenParameters =
                                new SecureConversationSecurityTokenParameters (
-                                       binding, requireCancellation, protectionRequirements);
+                                       bootstrapSecurity, requireCancellation, bootstrapProtectionRequirements);
                        return be;
 #else
                        throw new NotImplementedException ();
@@ -565,14 +565,14 @@ namespace System.ServiceModel.Channels
                        CreateUserNameOverTransportBindingElement ()
                {
                        var be = new TransportSecurityBindingElement ();
-#if !NET_2_1 && !XAMMAC_4_5 // FIXME: there should be whatever else to do for 2.1 instead.
+#if !MOBILE && !XAMMAC_4_5 // FIXME: there should be whatever else to do for 2.1 instead.
                        be.EndpointSupportingTokenParameters.SignedEncrypted.Add (new UserNameSecurityTokenParameters ());
 #endif
                        return be;
                }
                #endregion
 
-#if !NET_2_1 && !XAMMAC_4_5
+#if !MOBILE && !XAMMAC_4_5
                // It seems almost internal, hardcoded like this (I tried
                // custom parameters that sets IssuedTokenSecurityTokenParameters
                // like below ones, but that didn't trigger this method).
index ae823e534ebd876c8672cf0708f3f2e2891886d6..e80c26c308fb39add3bfc8cd976478705923824f 100644 (file)
@@ -53,12 +53,12 @@ namespace System.ServiceModel.Channels
                }
 
                protected TcpTransportBindingElement (
-                       TcpTransportBindingElement other)
-                       : base (other)
+                       TcpTransportBindingElement elementToBeCloned)
+                       : base (elementToBeCloned)
                {
-                       listen_backlog = other.listen_backlog;
-                       port_sharing_enabled = other.port_sharing_enabled;
-                       pool.CopyPropertiesFrom (other.pool);
+                       listen_backlog = elementToBeCloned.listen_backlog;
+                       port_sharing_enabled = elementToBeCloned.port_sharing_enabled;
+                       pool.CopyPropertiesFrom (elementToBeCloned.pool);
                }
                
                public TcpConnectionPoolSettings ConnectionPoolSettings {
index 2330e8134c39c15a71d720b170f436b6c700f5de..2b27840eec5d201757835b542bf2c23d97c0c85b 100644 (file)
@@ -105,7 +105,7 @@ namespace System.ServiceModel.Channels
                        return base.BuildChannelFactory<TChannel> (context);
                }
 
-#if !NET_2_1
+#if !MOBILE
                public override IChannelListener<TChannel> BuildChannelListener<TChannel> (
                        BindingContext context)
                {
@@ -143,7 +143,7 @@ namespace System.ServiceModel.Channels
                        return new TextMessageEncoderFactory (this);
                }
 
-#if !NET_2_1 && !XAMMAC_4_5
+#if !MOBILE && !XAMMAC_4_5
                [MonoTODO]
                protected override void OnImportPolicy (XmlElement assertion,
                        MessageVersion messageVersion,
index bab577c5bae65551901ae3f14e54e84dc1b61a06..17f3a1c36d098b5a51cc2a79a544469502f4943e 100644 (file)
@@ -48,12 +48,12 @@ namespace System.ServiceModel.Channels
                }
 
                protected TransportBindingElement (
-                       TransportBindingElement other)
-                       : base (other)
+                       TransportBindingElement elementToBeCloned)
+                       : base (elementToBeCloned)
                {
-                       manual_addressing = other.manual_addressing;
-                       max_buffer_pool_size = other.max_buffer_pool_size;
-                       max_recv_message_size = other.max_recv_message_size;
+                       manual_addressing = elementToBeCloned.manual_addressing;
+                       max_buffer_pool_size = elementToBeCloned.max_buffer_pool_size;
+                       max_recv_message_size = elementToBeCloned.max_recv_message_size;
                }
 
                public virtual bool ManualAddressing {
@@ -81,7 +81,7 @@ namespace System.ServiceModel.Channels
                                q.MaxStringContentLength = (int) MaxReceivedMessageSize;
                                return (T) (object) q;
                        }
-#if !NET_2_1
+#if !MOBILE
                        if (typeof (T) == typeof (ChannelProtectionRequirements))
                                // blank one, basically it should not be used
                                // for any secure channels (
@@ -92,7 +92,7 @@ namespace System.ServiceModel.Channels
                        return context.GetInnerProperty<T> ();
                }
 
-#if !NET_2_1 && !XAMMAC_4_5
+#if !MOBILE && !XAMMAC_4_5
                internal static XmlElement CreateTransportBinding (XmlElement transportToken)
                {
                        var doc = new XmlDocument ();
index e29e6f0c554491303a5028ff7c5c8c982a848b0d..60ff280d327a810566546583cffa34d0ec9c1835 100644 (file)
@@ -36,7 +36,7 @@ using System.ServiceModel.Security.Tokens;
 namespace System.ServiceModel.Channels
 {
        public sealed class TransportSecurityBindingElement
-#if NET_2_1
+#if MOBILE
                : SecurityBindingElement
 #else
                : SecurityBindingElement, IPolicyExportExtension
@@ -65,7 +65,7 @@ namespace System.ServiceModel.Channels
                        throw new NotImplementedException ();
                }
 
-#if !NET_2_1 && !XAMMAC_4_5
+#if !MOBILE && !XAMMAC_4_5
                [MonoTODO]
                protected override IChannelListener<TChannel>
                        BuildChannelListenerCore<TChannel> (
index c50146bfb3cbdd1dd7d54056172046b2756b30f9..db06df4e288e2f4718b7732662fb7101be641c3d 100644 (file)
@@ -31,7 +31,7 @@ using System.ServiceModel.Channels;
 using System.ServiceModel.Description;
 using System.ServiceModel.Dispatcher;
 using System.ServiceModel.Security;
-#if !NET_2_1
+#if !MOBILE
 using System.IdentityModel.Selectors;
 using System.IdentityModel.Tokens;
 using System.ServiceModel.Security.Tokens;
@@ -40,7 +40,7 @@ using System.ServiceModel.Security.Tokens;
 namespace System.ServiceModel.Description
 {
        public class ClientCredentials
-#if NET_2_1 || XAMMAC_4_5
+#if MOBILE || XAMMAC_4_5
                : IEndpointBehavior
 #else
                : SecurityCredentialsManager, IEndpointBehavior
@@ -51,17 +51,17 @@ namespace System.ServiceModel.Description
                }
 
                [MonoTODO]
-               protected ClientCredentials (ClientCredentials source)
+               protected ClientCredentials (ClientCredentials other)
                {
-                       userpass = source.userpass.Clone ();
-                       digest = source.digest.Clone ();
-                       initiator = source.initiator.Clone ();
-                       recipient = source.recipient.Clone ();
-                       windows = source.windows.Clone ();
-#if !NET_2_1
-                       issued_token = source.issued_token.Clone ();
-                       peer = source.peer.Clone ();
-                       support_interactive = source.support_interactive;
+                       userpass = other.userpass.Clone ();
+                       digest = other.digest.Clone ();
+                       initiator = other.initiator.Clone ();
+                       recipient = other.recipient.Clone ();
+                       windows = other.windows.Clone ();
+#if !MOBILE
+                       issued_token = other.issued_token.Clone ();
+                       peer = other.peer.Clone ();
+                       support_interactive = other.support_interactive;
 #endif
                }
 
@@ -93,7 +93,7 @@ namespace System.ServiceModel.Description
                        get { return windows; }
                }
 
-#if !NET_2_1
+#if !MOBILE
                IssuedTokenClientCredential issued_token =
                        new IssuedTokenClientCredential ();
                PeerCredential peer = new PeerCredential ();
@@ -130,7 +130,7 @@ namespace System.ServiceModel.Description
                        return new ClientCredentials (this);
                }
 
-#if !NET_2_1 && !XAMMAC_4_5
+#if !MOBILE && !XAMMAC_4_5
                public override SecurityTokenManager CreateSecurityTokenManager ()
                {
                        return new ClientCredentialsSecurityTokenManager (this);
@@ -159,10 +159,10 @@ namespace System.ServiceModel.Description
 
                [MonoTODO]
                public virtual void ApplyClientBehavior (
-                       ServiceEndpoint endpoint, ClientRuntime behavior)
+                       ServiceEndpoint serviceEndpoint, ClientRuntime behavior)
                {
-                       if (endpoint == null)
-                               throw new ArgumentNullException ("endpoint");
+                       if (serviceEndpoint == null)
+                               throw new ArgumentNullException ("serviceEndpoint");
                        if (behavior == null)
                                throw new ArgumentNullException ("behavior");
 
index 80238d41ff89bf3ee89270260cc6cbfb82a4f12d..50ea0a905887f8d234ca42e194a61857698b34d1 100644 (file)
@@ -373,7 +373,7 @@ namespace System.ServiceModel.Description
                                        var fname = a.Name ?? a.DetailType.Name + "Fault";
                                        var fns = a.Namespace ?? cd.Namespace;
                                        var fd = new FaultDescription (a.Action ?? cd.Namespace + cd.Name + "/" + od.Name + fname) { DetailType = a.DetailType, Name = fname, Namespace = fns };
-#if !NET_2_1
+#if !MOBILE
                                        if (a.HasProtectionLevel)
                                                fd.ProtectionLevel = a.ProtectionLevel;
 #endif
@@ -400,7 +400,7 @@ namespace System.ServiceModel.Description
                                foreach (object obj in serviceMethod.GetCustomAttributes (typeof(IOperationBehavior),true))
                                        od.Behaviors.Add ((IOperationBehavior) obj);
                        }
-#if !NET_2_1
+#if !MOBILE
                        if (od.Behaviors.Find<OperationBehaviorAttribute>() == null)
                                od.Behaviors.Add (new OperationBehaviorAttribute ());
 #endif
index dc25161d460e7f1d1af46ac6637f046f1f76f09b..b763c15ca98f62b7eda8cda01db00a7795a43d4f 100644 (file)
@@ -65,13 +65,13 @@ namespace System.ServiceModel.Description
 
                public int MaxItemsInObjectGraph { get; set; }
 
-#if !NET_2_1
+#if !MOBILE
                public IDataContractSurrogate DataContractSurrogate { get; set; }
 #endif
 
                public virtual XmlObjectSerializer CreateSerializer (Type type, string name, string ns, IList<Type> knownTypes)
                {
-#if NET_2_1
+#if MOBILE
                        return new DataContractSerializer (type, name, ns, knownTypes);
 #else
                        return new DataContractSerializer (type, name, ns, knownTypes, MaxItemsInObjectGraph, IgnoreExtensionDataObject, false, DataContractSurrogate);
@@ -80,7 +80,7 @@ namespace System.ServiceModel.Description
 
                public virtual XmlObjectSerializer CreateSerializer (Type type, XmlDictionaryString name, XmlDictionaryString ns, IList<Type> knownTypes)
                {
-#if NET_2_1
+#if MOBILE
                        return new DataContractSerializer (type, name, ns, knownTypes);
 #else
                        return new DataContractSerializer (type, name, ns, knownTypes, MaxItemsInObjectGraph, IgnoreExtensionDataObject, false, DataContractSurrogate);
@@ -112,7 +112,7 @@ namespace System.ServiceModel.Description
                {
                }
                
-#if !NET_2_1 && !XAMMAC_4_5
+#if !MOBILE && !XAMMAC_4_5
                //IWsdlExportExtension
 
                void IWsdlExportExtension.ExportContract (WsdlExporter exporter,
index 9d12a23d4d2fb12f8c595c6678260f85a6d1b105..08327a5b50d6aeb2ca769534ff9a134790921dff 100644 (file)
@@ -35,22 +35,22 @@ namespace System.ServiceModel.Description
        public interface IContractBehavior
        {
                void AddBindingParameters (
-                       ContractDescription description,
+                       ContractDescription contractDescription,
                        ServiceEndpoint endpoint,
-                       BindingParameterCollection parameters);
+                       BindingParameterCollection bindingParameters);
 
                void ApplyClientBehavior (
-                       ContractDescription description,
+                       ContractDescription contractDescription,
                        ServiceEndpoint endpoint,
-                       ClientRuntime proxy);
+                       ClientRuntime clientRuntime);
 
                void ApplyDispatchBehavior (
-                       ContractDescription description,
+                       ContractDescription contractDescription,
                        ServiceEndpoint endpoint,
-                       DispatchRuntime dispatch);
+                       DispatchRuntime dispatchRuntime);
 
                void Validate (
-                       ContractDescription description,
+                       ContractDescription contractDescription,
                        ServiceEndpoint endpoint);
        }
 }
index 6eb47ec704580f8fb51f04d8a5ae42bc853ad216..773d2676dabe9cadae5e95ae7f8480c52bf13b84 100644 (file)
@@ -34,11 +34,11 @@ namespace System.ServiceModel.Description
        public interface IEndpointBehavior
        {
                void AddBindingParameters (ServiceEndpoint endpoint,
-                       BindingParameterCollection parameters);
-               void ApplyDispatchBehavior (ServiceEndpoint serviceEndpoint,
-                       EndpointDispatcher dispatcher);
-               void ApplyClientBehavior (ServiceEndpoint serviceEndpoint,
-                       ClientRuntime behavior);
-               void Validate (ServiceEndpoint serviceEndpoint);
+                       BindingParameterCollection bindingParameters);
+               void ApplyDispatchBehavior (ServiceEndpoint endpoint,
+                       EndpointDispatcher endpointDispatcher);
+               void ApplyClientBehavior (ServiceEndpoint endpoint,
+                       ClientRuntime clientRuntime);
+               void Validate (ServiceEndpoint endpoint);
        }
 }
index aa67812dfe50beddf7019f178cf4c51a0b017be1..5c887c122bea2aa77ab241f6b8122b7359b17145 100644 (file)
@@ -34,18 +34,18 @@ namespace System.ServiceModel.Description
        public interface IOperationBehavior
        {
                void AddBindingParameters (
-                       OperationDescription description,
-                       BindingParameterCollection parameters);
+                       OperationDescription operationDescription,
+                       BindingParameterCollection bindingParameters);
 
                void ApplyDispatchBehavior (
-                       OperationDescription description,
-                       DispatchOperation dispatch);
+                       OperationDescription operationDescription,
+                       DispatchOperation dispatchOperation);
 
                void ApplyClientBehavior (
-                       OperationDescription description,
-                       ClientOperation proxy);
+                       OperationDescription operationDescription,
+                       ClientOperation clientOperation);
 
                void Validate (
-                       OperationDescription description);
+                       OperationDescription operationDescription);
        }
 }
index 5e3924b26ee1b5e69e5e1a3bed6252213ec4feb3..6dc65cc0d54274783f3d3c4c145cf2567c1815d2 100644 (file)
@@ -100,7 +100,7 @@ namespace System.ServiceModel.Description
                        set { type = value; }
                }
 
-#if !NET_2_1 && !XAMMAC_4_5
+#if !MOBILE && !XAMMAC_4_5
                internal XsdDataContractImporter DataContractImporter { get; set; }
                internal XmlSerializerMessageContractImporterInternal XmlSerializationImporter { get; set; }
                internal System.CodeDom.CodeTypeReference CodeTypeReference { get; set; }
index 1895c10e75968bf968d91bae86ea149212f5b744..26ee9d753d8beec3770a30e0154032b6e7534cc7 100644 (file)
@@ -36,7 +36,7 @@ namespace System.ServiceModel.Description
 {
        public class XmlSerializerOperationBehavior
                : IOperationBehavior
-#if !NET_2_1
+#if !MOBILE
                        , IWsdlExportExtension
 #endif
        {
@@ -104,7 +104,7 @@ namespace System.ServiceModel.Description
                {
                }
 
-#if !NET_2_1 && !XAMMAC_4_5
+#if !MOBILE && !XAMMAC_4_5
                void IWsdlExportExtension.ExportContract (
                        WsdlExporter exporter,
                        WsdlContractConversionContext context)
index db050b9067f727c474ed694a46e39a81ba62d7cf..435b7ef3234b7dbf2818d839f5a1bb397aa7afc4 100644 (file)
@@ -36,7 +36,7 @@ namespace System.ServiceModel.Diagnostics
        {
                public MessageLoggingSettings ()
                {
-#if !NET_2_1 && !XAMMAC_4_5
+#if !MOBILE && !XAMMAC_4_5
                        var e = ConfigUtil.DiagnosticSection.MessageLogging;
                        LogEntireMessage = e.LogEntireMessage;
                        LogKnownPii = e.LogKnownPii;
index db1c49650c16598dc9b8b01cec02eb90aad6459b..dd50fedc3ffd26cfbbbf4cb37ba3b8d2c30ae26b 100644 (file)
@@ -243,7 +243,7 @@ namespace System.ServiceModel.Dispatcher
                        var headers = MessageToHeaderObjects (md, message);
                        object [] parts = MessageToParts (md, message);
                        if (md.MessageType != null) {
-#if NET_2_1
+#if MOBILE
                                parameters [0] = Activator.CreateInstance (md.MessageType);
 #else
                                parameters [0] = Activator.CreateInstance (md.MessageType, true);
@@ -271,7 +271,7 @@ namespace System.ServiceModel.Dispatcher
                        var headers = MessageToHeaderObjects (md, message);
                        object [] parts = MessageToParts (md, message);
                        if (md.MessageType != null) {
-#if NET_2_1
+#if MOBILE
                                object msgObject = Activator.CreateInstance (md.MessageType);
 #else
                                object msgObject = Activator.CreateInstance (md.MessageType, true);
@@ -355,14 +355,14 @@ namespace System.ServiceModel.Dispatcher
        class DataContractMessagesFormatter : BaseMessagesFormatter
        {
                DataContractFormatAttribute attr;
-#if !NET_2_1
+#if !MOBILE
                DataContractSerializerOperationBehavior serializerBehavior;
 #endif
 
                public DataContractMessagesFormatter (OperationDescription desc, DataContractFormatAttribute attr)
                        : base (desc)
                {
-#if !NET_2_1
+#if !MOBILE
                        this.serializerBehavior = desc.Behaviors.Find<DataContractSerializerOperationBehavior>();
 #endif
                        this.attr = attr;
@@ -442,7 +442,7 @@ namespace System.ServiceModel.Dispatcher
                XmlObjectSerializer GetSerializer (MessagePartDescription partDesc)
                {
                        if (!serializers.ContainsKey (partDesc))
-#if !NET_2_1
+#if !MOBILE
                                if (serializerBehavior != null)
                                        serializers [partDesc] = serializerBehavior.CreateSerializer(
                                                partDesc.Type, partDesc.Name, partDesc.Namespace, OperationKnownTypes as IList<Type>);
index 65b5c8cf38ae6913b2482b54609ecc8ee45064e4..f1a7ca308c058f0ec29cfea5e1516b933687a712 100644 (file)
@@ -364,8 +364,11 @@ namespace System.ServiceModel.Dispatcher
 
                        public void Start ()
                        {
-                               if (loop_thread == null)
+                               if (loop_thread == null) {
                                        loop_thread = new Thread (new ThreadStart (Loop));
+                                       loop_thread.IsBackground = true;
+                               }
+
                                loop_thread.Start ();
                        }
 
@@ -425,8 +428,10 @@ namespace System.ServiceModel.Dispatcher
                                        Logger.Warning (String.Format ("Channel listener '{0}' is not closed. Aborting.", owner.Listener.GetType ()));
                                        owner.Listener.Abort ();
                                }
-                               if (loop_thread != null && loop_thread.IsAlive)
-                                       loop_thread.Abort ();
+                               if (loop_thread != null && loop_thread.IsAlive) {
+                                       if (!loop_thread.Join (500))
+                                               loop_thread.Abort ();
+                               }
                                loop_thread = null;
                        }
 
index 3f218beb72812439719c749adf694da4db120165..1984a76985cc63a9e14de39769bf8d7119d6cb08 100644 (file)
@@ -39,7 +39,7 @@ namespace System.ServiceModel.Dispatcher
        public sealed class ClientOperation
        {
                internal class ClientOperationCollection :
-#if NET_2_1
+#if MOBILE
                        KeyedCollection<string, ClientOperation>
 #else
                        SynchronizedKeyedCollection<string, ClientOperation>
index 08f1839c4f7fbec31faf7228f1e9cf947528168e..b23a6ef834532c563166bd0ad2695bd232b690c8 100644 (file)
@@ -54,7 +54,7 @@ namespace System.ServiceModel.Dispatcher
                {
                        contract_name = name;
                        contract_ns = ns;
-#if !NET_2_1
+#if !MOBILE
                        CallbackDispatchRuntime = (DispatchRuntime) callbackDispatchRuntime ?? new DispatchRuntime (null, this);
 #endif
                }
@@ -80,7 +80,7 @@ namespace System.ServiceModel.Dispatcher
                
                public Type ContractClientType { get; set; }
 
-#if !NET_2_1
+#if !MOBILE
                public DispatchRuntime CallbackDispatchRuntime { get; internal set; }
 #endif
 
@@ -88,7 +88,7 @@ namespace System.ServiceModel.Dispatcher
                        get { return inspectors; }
                }
 
-#if NET_2_1
+#if MOBILE
                public KeyedCollection<string,ClientOperation> Operations {
                        get { return operations; }
                }
index e9fb67f98e9e2c13265ba3fd6e333911b8fc016c..0397c9bf3cb67cd52221db9d9744d21b18765585 100644 (file)
@@ -54,7 +54,7 @@ namespace System.ServiceModel.Dispatcher
                        tx_auto_complete, tx_required,
                        auto_dispose_params = true;
                IDispatchMessageFormatter formatter;
-#if !NET_2_1
+#if !MOBILE
                ImpersonationOption impersonation;
                IOperationInvoker invoker;
                SynchronizedCollection<IParameterInspector> inspectors
@@ -93,7 +93,7 @@ namespace System.ServiceModel.Dispatcher
                        get { return action; }
                }
 
-#if !NET_2_1
+#if !MOBILE
                public SynchronizedCollection<ICallContextInitializer> CallContextInitializers {
                        get { return ctx_initializers; }
                }
@@ -214,7 +214,7 @@ namespace System.ServiceModel.Dispatcher
 
                void ThrowIfOpened ()
                {
-#if !NET_2_1 && !XAMMAC_4_5
+#if !MOBILE && !XAMMAC_4_5
                        // FIXME: get callback client runtime status when ChannelDispatcher is not available.
                        var state = Parent.ChannelDispatcher != null ? Parent.ChannelDispatcher.State : CommunicationState.Created; // Parent.CallbackClientRuntime.ChannelFactory.State;
                        switch (state) {
index f6660e1c19c3826ffc1892a3898ffe97152e434d..8dc605443efb802a0aab68a19e879a16f3cfdd8b 100644 (file)
@@ -29,7 +29,7 @@ using System;
 using System.Collections.Generic;
 using System.Collections.ObjectModel;
 using System.Reflection;
-#if !NET_2_1
+#if !MOBILE
 using System.IdentityModel.Policy;
 #if !XAMMAC_4_5
 using System.Web.Security;
@@ -45,7 +45,7 @@ namespace System.ServiceModel.Dispatcher
 {
        public sealed class DispatchRuntime
        {
-#if NET_2_1 || XAMMAC_4_5
+#if MOBILE || XAMMAC_4_5
                internal DispatchRuntime (EndpointDispatcher dispatcher, ClientRuntime callbackClientRuntime)
                {
                        UnhandledDispatchOperation = new DispatchOperation (
index 7c0afae785c632047907df2567ea18f4df6c9ac2..ddf9735e5dbbacd0d91f448d705768dd821cf0e2 100644 (file)
@@ -31,7 +31,7 @@ namespace System.ServiceModel.Dispatcher
 {
        public interface IClientMessageFormatter
        {
-               object DeserializeReply (Message message, object [] paremeters);
-               Message SerializeRequest (MessageVersion version, object [] inputs);
+               object DeserializeReply (Message message, object [] parameters);
+               Message SerializeRequest (MessageVersion messageVersion, object [] parameters);
        }
 }
index 5e331a0bd60cafab27689b7a8b395d3b3d9fe7ff..f1eb699517880beae462e99735d8179576ad1362 100644 (file)
@@ -31,7 +31,7 @@ namespace System.ServiceModel.Dispatcher
 {
        public interface IClientMessageInspector
        {
-               void AfterReceiveReply (ref Message message, object correlationState);
-               object BeforeSendRequest (ref Message message, IClientChannel channel);
+               void AfterReceiveReply (ref Message reply, object correlationState);
+               object BeforeSendRequest (ref Message request, IClientChannel channel);
        }
 }
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Security.Tokens/BinarySecretSecurityToken.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Security.Tokens/BinarySecretSecurityToken.cs
deleted file mode 100644 (file)
index 464c936..0000000
+++ /dev/null
@@ -1,119 +0,0 @@
-//
-// BinarySecretSecurityToken.cs
-//
-// Author:
-//     Atsushi Enomoto <atsushi@ximian.com>
-//
-// Copyright (C) 2006 Novell, Inc.  http://www.novell.com
-//
-// 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.ObjectModel;
-using System.Xml;
-using System.IdentityModel.Policy;
-using System.IdentityModel.Tokens;
-
-namespace System.ServiceModel.Security.Tokens
-{
-       public class BinarySecretSecurityToken : SecurityToken
-       {
-               ReadOnlyCollection<SecurityKey> keys;
-
-               string id;
-               byte [] key;
-               bool allow_crypto;
-               DateTime valid_from = DateTime.Now.ToUniversalTime ();
-
-               BinarySecretSecurityToken (string id, bool allowCrypto)
-               {
-                       this.id = id;
-                       allow_crypto = allowCrypto;
-               }
-
-               public BinarySecretSecurityToken (byte [] key)
-                       : this ("uuid:" + Guid.NewGuid ().ToString (), key)
-               {
-               }
-
-               public BinarySecretSecurityToken (string id, byte [] key)
-                       : this (id, key, false)
-               {
-               }
-
-               protected BinarySecretSecurityToken (string id, byte [] key, bool allowCrypto)
-                       : this (id, allowCrypto)
-               {
-                       if (key == null)
-                               throw new ArgumentNullException ("key");
-                       this.key = key;
-
-                       SecurityKey [] arr = new SecurityKey [] {new InMemorySymmetricSecurityKey (key)};
-                       keys = new ReadOnlyCollection<SecurityKey> (arr);
-               }
-
-               public BinarySecretSecurityToken (int keySizeInBits)
-                       : this ("uuid:" + Guid.NewGuid ().ToString (), keySizeInBits)
-               {
-               }
-
-               public BinarySecretSecurityToken (string id, int keySizeInBits)
-                       : this (id, keySizeInBits, false)
-               {
-               }
-
-               protected BinarySecretSecurityToken (string id, int keySizeInBits, bool allowCrypto)
-                       : this (id, allowCrypto)
-               {
-                       if (keySizeInBits < 0)
-                               throw new ArgumentOutOfRangeException ("keySizeInBits");
-
-                       this.key = new byte [keySizeInBits >> 3 + (keySizeInBits % 8 == 0 ? 0 : 1)];
-
-                       SecurityKey [] arr = new SecurityKey [] {new InMemorySymmetricSecurityKey (key)};
-                       keys = new ReadOnlyCollection<SecurityKey> (arr);
-               }
-
-               public override DateTime ValidFrom {
-                       get { return valid_from; }
-               }
-
-               public override DateTime ValidTo {
-                       get { return DateTime.MaxValue.AddDays (-1); }
-               }
-
-               public override string Id {
-                       get { return id; }
-               }
-
-               public int KeySize {
-                       get { return key.Length; }
-               }
-
-               public override ReadOnlyCollection<SecurityKey> SecurityKeys {
-                       get { return keys; }
-               }
-
-               public byte [] GetKeyBytes ()
-               {
-                       return (byte []) key.Clone ();
-               }
-       }
-}
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Security.Tokens/InternalEncryptedKeyIdentifierClause.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Security.Tokens/InternalEncryptedKeyIdentifierClause.cs
deleted file mode 100644 (file)
index 95e4334..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-//
-// InternalEncryptedKeyIdentifierClause.cs
-//
-// Author:
-//     Atsushi Enomoto <atsushi@ximian.com>
-//
-// Copyright (C) 2007 Novell, Inc.  http://www.novell.com
-//
-// 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.ObjectModel;
-using System.Security.Cryptography.Xml;
-using System.Xml;
-using System.IdentityModel.Tokens;
-
-namespace System.ServiceModel.Security.Tokens
-{
-       internal class InternalEncryptedKeyIdentifierClause : BinaryKeyIdentifierClause
-       {
-               public InternalEncryptedKeyIdentifierClause (byte [] hash)
-                       : base (null, hash, false)
-               {
-               }
-
-               public override bool Matches (SecurityKeyIdentifierClause keyIdentifierClause)
-               {
-                       InternalEncryptedKeyIdentifierClause kic = keyIdentifierClause as InternalEncryptedKeyIdentifierClause;
-                       if (kic == null)
-                               return false;
-                       return Matches (kic.GetRawBuffer ());
-               }
-       }
-}
index 3d8e71035a0f6c3a1bff8dd34dc527866e2b3131..41a1376f053884266ff70be148235365855c5d36 100644 (file)
@@ -75,30 +75,30 @@ namespace System.ServiceModel.Security.Tokens
                }
 
                public SecureConversationSecurityTokenParameters (
-                       SecurityBindingElement element)
-                       : this (element, true)
+                       SecurityBindingElement bootstrapSecurityBindingElement)
+                       : this (bootstrapSecurityBindingElement, true)
                {
                }
 
                public SecureConversationSecurityTokenParameters (
-                       SecurityBindingElement element,
+                       SecurityBindingElement bootstrapSecurityBindingElement,
                        bool requireCancellation)
-                       : this (element, requireCancellation, null)
+                       : this (bootstrapSecurityBindingElement, requireCancellation, null)
                {
                }
 
 #if !MOBILE && !XAMMAC_4_5
                public SecureConversationSecurityTokenParameters (
-                       SecurityBindingElement element,
+                       SecurityBindingElement bootstrapSecurityBindingElement,
                        bool requireCancellation,
-                       ChannelProtectionRequirements requirements)
+                       ChannelProtectionRequirements bootstrapProtectionRequirements)
                {
-                       this.element = element;
+                       this.element = bootstrapSecurityBindingElement;
                        this.cancellable = requireCancellation;
-                       if (requirements == null)
+                       if (bootstrapProtectionRequirements == null)
                                this.requirements = new ChannelProtectionRequirements (default_channel_protection_requirements);
                        else
-                               this.requirements = new ChannelProtectionRequirements (requirements);
+                               this.requirements = new ChannelProtectionRequirements (bootstrapProtectionRequirements);
                }
 #else
                internal SecureConversationSecurityTokenParameters (
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Security.Tokens/WrappedKeySecurityToken.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Security.Tokens/WrappedKeySecurityToken.cs
deleted file mode 100644 (file)
index d3c47f2..0000000
+++ /dev/null
@@ -1,176 +0,0 @@
-//
-// WrappedKeySecurityToken.cs
-//
-// Author:
-//     Atsushi Enomoto <atsushi@ximian.com>
-//
-// Copyright (C) 2006 Novell, Inc.  http://www.novell.com
-//
-// 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.ObjectModel;
-using System.Security.Cryptography;
-using System.Security.Cryptography.Xml;
-using System.Xml;
-using System.IdentityModel.Policy;
-using System.IdentityModel.Tokens;
-
-namespace System.ServiceModel.Security.Tokens
-{
-       public class WrappedKeySecurityToken : SecurityToken
-       {
-               string id;
-               byte [] raw_key;
-               byte [] wrapped_key;
-               string wrap_alg;
-               SecurityToken wrap_token;
-               SecurityKeyIdentifier wrap_token_ref;
-               DateTime valid_from = DateTime.Now.ToUniversalTime ();
-               ReadOnlyCollection<SecurityKey> keys;
-               ReferenceList reference_list;
-               byte [] keyhash;
-
-               public WrappedKeySecurityToken (
-                       string id,
-                       byte [] keyToWrap,
-                       string wrappingAlgorithm,
-                       SecurityToken wrappingToken,
-                       SecurityKeyIdentifier wrappingTokenReference)
-               {
-                       if (id == null)
-                               throw new ArgumentNullException ("id");
-                       if (keyToWrap == null)
-                               throw new ArgumentNullException ("keyToWrap");
-                       if (wrappingAlgorithm == null)
-                               throw new ArgumentNullException ("wrappingAlgorithm");
-                       if (wrappingToken == null)
-                               throw new ArgumentNullException ("wrappingToken");
-
-                       raw_key = keyToWrap;
-                       this.id = id;
-                       wrap_alg = wrappingAlgorithm;
-                       wrap_token = wrappingToken;
-                       wrap_token_ref = wrappingTokenReference;
-                       Collection<SecurityKey> l = new Collection<SecurityKey> ();
-                       foreach (SecurityKey sk in wrappingToken.SecurityKeys) {
-                               if (sk.IsSupportedAlgorithm (wrappingAlgorithm)) {
-                                       wrapped_key = sk.EncryptKey (wrappingAlgorithm, keyToWrap);
-                                       l.Add (new InMemorySymmetricSecurityKey (keyToWrap));
-                                       break;
-                               }
-                       }
-                       keys = new ReadOnlyCollection<SecurityKey> (l);
-                       if (wrapped_key == null)
-                               throw new ArgumentException (String.Format ("None of the security keys in the argument token supports specified wrapping algorithm '{0}'", wrappingAlgorithm));
-               }
-
-               internal byte [] RawKey {
-                       get { return raw_key; }
-               }
-
-               // It is kind of compromised solution to output
-               // ReferenceList inside e:EncryptedKey and might disappear
-               // when non-wrapped key is represented by another token type.
-               internal ReferenceList ReferenceList {
-                       get { return reference_list; }
-                       set { reference_list = value; }
-               }
-
-               public override DateTime ValidFrom {
-                       get { return valid_from; }
-               }
-
-               public override DateTime ValidTo {
-                       get { return DateTime.MaxValue.AddDays (-1); }
-               }
-
-               public override string Id {
-                       get { return id; }
-               }
-
-               public override ReadOnlyCollection<SecurityKey> SecurityKeys {
-                       get { return keys; }
-               }
-
-               public string WrappingAlgorithm {
-                       get { return wrap_alg; }
-               }
-
-               public SecurityToken WrappingToken {
-                       get { return wrap_token; }
-               }
-
-               public SecurityKeyIdentifier WrappingTokenReference {
-                       get { return wrap_token_ref; }
-               }
-
-               public byte [] GetWrappedKey ()
-               {
-                       return (byte []) wrapped_key.Clone ();
-               }
-
-               internal void SetWrappedKey (byte [] value)
-               {
-                       wrapped_key = (byte []) value.Clone ();
-               }
-
-               [MonoTODO]
-               public override bool CanCreateKeyIdentifierClause<T> ()
-               {
-                       /*
-                       foreach (SecurityKeyIdentifierClause k in WrappingTokenReference) {
-                               Type t = k.GetType ();
-                               if (t == typeof (T) || t.IsSubclassOf (typeof (T)))
-                                       return true;
-                       }
-                       */
-                       return false;
-               }
-
-               [MonoTODO]
-               public override T CreateKeyIdentifierClause<T> ()
-               {
-                       /*
-                       foreach (SecurityKeyIdentifierClause k in WrappingTokenReference) {
-                               Type t = k.GetType ();
-                               if (t == typeof (T) || t.IsSubclassOf (typeof (T)))
-                                       return (T) k;
-                       }
-                       */
-                       throw new NotSupportedException (String.Format ("WrappedKeySecurityToken cannot create '{0}'", typeof (T)));
-               }
-
-               public override bool MatchesKeyIdentifierClause (SecurityKeyIdentifierClause keyIdentifierClause)
-               {
-                       LocalIdKeyIdentifierClause lkic = keyIdentifierClause as LocalIdKeyIdentifierClause;
-                       if (lkic != null && lkic.LocalId == Id)
-                               return true;
-
-                       InternalEncryptedKeyIdentifierClause khic = keyIdentifierClause as InternalEncryptedKeyIdentifierClause;
-                       if (keyhash == null)
-                               keyhash = SHA1.Create ().ComputeHash (wrapped_key);
-                       if (khic != null && khic.Matches (keyhash))
-                               return true;
-
-                       return false;
-               }
-       }
-}
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Security/BinarySecretKeyIdentifierClause.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Security/BinarySecretKeyIdentifierClause.cs
deleted file mode 100644 (file)
index 497d5c7..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-//
-// BinarySecretKeyIdentifierClause.cs
-//
-// Author:
-//     Atsushi Enomoto <atsushi@ximian.com>
-//
-// Copyright (C) 2006 Novell, Inc.  http://www.novell.com
-//
-// 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.Xml;
-using System.IdentityModel.Policy;
-using System.IdentityModel.Tokens;
-
-namespace System.ServiceModel.Security
-{
-       public class BinarySecretKeyIdentifierClause : BinaryKeyIdentifierClause
-       {
-               public BinarySecretKeyIdentifierClause (byte [] key)
-                       : this (key, true)
-               {
-               }
-
-               [MonoTODO ("ClauseType")]
-               public BinarySecretKeyIdentifierClause (byte [] key, bool cloneBuffer)
-                       : base ("", key, cloneBuffer)
-               {
-               }
-
-               [MonoTODO ("ClauseType")]
-               public BinarySecretKeyIdentifierClause (byte [] key, bool cloneBuffer, byte [] derivationNonce, int derivationLength)
-                       : base ("", key, cloneBuffer, derivationNonce, derivationLength)
-               {
-               }
-
-               public override bool CanCreateKey {
-                       get { return true; }
-               }
-
-               public byte [] GetKeyBytes ()
-               {
-                       return GetBuffer ();
-               }
-
-               public override SecurityKey CreateKey ()
-               {
-                       return new InMemorySymmetricSecurityKey (GetRawBuffer (), true);
-               }
-
-               public override bool Matches (SecurityKeyIdentifierClause clause)
-               {
-                       if (clause == null)
-                               throw new ArgumentNullException ("clause");
-                       BinarySecretKeyIdentifierClause other =
-                               clause as BinarySecretKeyIdentifierClause;
-                       if (other == null)
-                               return false;
-                       byte [] b1 = GetRawBuffer ();
-                       byte [] b2 = other.GetRawBuffer ();
-                       if (b1.Length != b2.Length)
-                               return false;
-                       for (int i = 0; i < b1.Length; i++)
-                               if (b1 [i] != b2 [i])
-                                       return false;
-                       return true;
-               }
-       }
-}
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Security/KeyNameIdentifierClause.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Security/KeyNameIdentifierClause.cs
deleted file mode 100644 (file)
index ad7a84a..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-//
-// KeyNameIdentifierClause.cs
-//
-// Author:
-//     Atsushi Enomoto <atsushi@ximian.com>
-//
-// Copyright (C) 2006 Novell, Inc.  http://www.novell.com
-//
-// 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.Xml;
-using System.IdentityModel.Policy;
-using System.IdentityModel.Tokens;
-
-namespace System.ServiceModel.Security
-{
-       public class KeyNameIdentifierClause : SecurityKeyIdentifierClause
-       {
-               public KeyNameIdentifierClause (string keyName)
-                       : base (null)
-               {
-                       key_name = keyName;
-               }
-
-               string key_name;
-
-               public string KeyName {
-                       get { return key_name; }
-               }
-
-               public override bool Matches (SecurityKeyIdentifierClause clause)
-               {
-                       if (clause == null)
-                               throw new ArgumentNullException ("clause");
-                       KeyNameIdentifierClause knic =
-                               clause as KeyNameIdentifierClause;
-                       return knic != null && Matches (knic.KeyName);
-               }
-
-               public bool Matches (string keyName)
-               {
-                       return key_name == keyName;
-               }
-
-               public override string ToString ()
-               {
-                       return String.Concat ("KeyNameIdentifierClause(KeyName = '", KeyName, "')");
-               }
-       }
-}
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Security/SecurityContextKeyIdentifierClause.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Security/SecurityContextKeyIdentifierClause.cs
deleted file mode 100644 (file)
index 2ac33ba..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-//
-// SecurityContextKeyIdentifierClause.cs
-//
-// Author:
-//     Atsushi Enomoto <atsushi@ximian.com>
-//
-// Copyright (C) 2006 Novell, Inc.  http://www.novell.com
-//
-// 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.IdentityModel.Selectors;
-using System.IdentityModel.Tokens;
-using System.Xml;
-
-namespace System.ServiceModel.Security
-{
-       public class SecurityContextKeyIdentifierClause : SecurityKeyIdentifierClause
-       {
-               public SecurityContextKeyIdentifierClause (UniqueId contextId)
-                       : this (contextId, new UniqueId ())
-               {
-               }
-
-               public SecurityContextKeyIdentifierClause (UniqueId contextId, UniqueId generation)
-                       : this (contextId, generation, null, 0)
-               {
-               }
-
-               public SecurityContextKeyIdentifierClause (UniqueId contextId, UniqueId generation, byte [] derivationNonce, int derivationLength)
-                       : base (null, derivationNonce, derivationLength)
-               {
-                       this.context = contextId;
-                       this.generation = generation;
-               }
-
-               UniqueId context, generation;
-
-               public UniqueId ContextId {
-                       get { return context; }
-               }
-
-               public UniqueId Generation {
-                       get { return generation; }
-               }
-
-               public override bool Matches (
-                       SecurityKeyIdentifierClause keyIdentifierClause)
-               {
-                       SecurityContextKeyIdentifierClause other =
-                               keyIdentifierClause as SecurityContextKeyIdentifierClause;
-                       return  other != null && Matches (other.context, other.generation);
-               }
-
-               public bool Matches (UniqueId contextId, UniqueId generation)
-               {
-                       return context == contextId &&
-                               this.generation == generation;
-               }
-
-               [MonoTODO]
-               public override string ToString ()
-               {
-                       return base.ToString ();
-               }
-       }
-}
index 3a1da201c8ca41db568c1c0d00e0bac671e84d62..c823ce38e9502a483c05ada7c0198f094a802a27 100644 (file)
@@ -57,7 +57,7 @@ namespace System.ServiceModel.Security
                        StoreName storeName, X509FindType findType,
                        object findValue)
                {
-#if !NET_2_1
+#if !MOBILE
                        certificate = ConfigUtil.CreateCertificateFrom (storeLocation, storeName, findType, findValue);
 #else
                        throw new NotImplementedException ();
@@ -68,7 +68,7 @@ namespace System.ServiceModel.Security
                        string subjectName, StoreLocation storeLocation,
                        StoreName storeName)
                {
-#if !NET_2_1
+#if !MOBILE
                        certificate = ConfigUtil.CreateCertificateFrom (storeLocation, storeName, X509FindType.FindBySubjectName, subjectName);
 #else
                        throw new NotImplementedException ();
index c6aa5acfa973d46f95fb8ac2e732db1dcebaa45e..93dc52005453c59d50b3f0b6cc9c3e233549778f 100644 (file)
@@ -27,7 +27,7 @@
 //
 using System;
 using System.Collections.Generic;
-#if !NET_2_1
+#if !MOBILE
 using System.IdentityModel.Selectors;
 #endif
 using System.Security.Cryptography.X509Certificates;
@@ -49,7 +49,7 @@ namespace System.ServiceModel.Security
                X509Certificate2 certificate;
                Dictionary<Uri,X509Certificate2> scoped =
                        new Dictionary<Uri,X509Certificate2> ();
-#if !NET_2_1
+#if !MOBILE
                X509CertificateValidator validator;
 #endif
                X509RevocationMode revocation_mode;
@@ -92,7 +92,7 @@ namespace System.ServiceModel.Security
                public void SetDefaultCertificate (StoreLocation storeLocation,
                        StoreName storeName, X509FindType findType, Object findValue)
                {
-#if !NET_2_1
+#if !MOBILE
                        DefaultCertificate = ConfigUtil.CreateCertificateFrom (storeLocation, storeName, findType, findValue);
 #else
                        throw new NotImplementedException ();
@@ -110,7 +110,7 @@ namespace System.ServiceModel.Security
                        StoreName storeName, X509FindType findType,
                        Object findValue, Uri targetService)
                {
-#if !NET_2_1
+#if !MOBILE
                        ScopedCertificates [targetService] = ConfigUtil.CreateCertificateFrom (storeLocation, storeName, findType, findValue);
 #else
                        throw new NotImplementedException ();
index 8e54cb5c622cfbb4f2f7f328292feb1605ee3d24..3f62fe4b035b325691c6d97569f7efc3284bae05 100644 (file)
@@ -726,7 +726,6 @@ System.ServiceModel.PeerResolvers/ServiceSettingsResponseInfo.cs
 System.ServiceModel.PeerResolvers/UnregisterInfo.cs
 System.ServiceModel.PeerResolvers/UpdateInfo.cs
 System.ServiceModel.Security.Tokens/AuthenticatorCommunicationObject.cs
-System.ServiceModel.Security.Tokens/BinarySecretSecurityToken.cs
 System.ServiceModel.Security.Tokens/ClaimTypeRequirement.cs
 System.ServiceModel.Security.Tokens/CommunicationSecurityTokenAuthenticator.cs
 System.ServiceModel.Security.Tokens/CommunicationSecurityTokenProvider.cs
@@ -734,7 +733,6 @@ System.ServiceModel.Security.Tokens/DerivedKeySecurityToken.cs
 System.ServiceModel.Security.Tokens/IIssuanceSecurityTokenAuthenticator.cs
 System.ServiceModel.Security.Tokens/ISecurityContextSecurityTokenCache.cs
 System.ServiceModel.Security.Tokens/InitiatorServiceModelSecurityTokenRequirement.cs
-System.ServiceModel.Security.Tokens/InternalEncryptedKeyIdentifierClause.cs
 System.ServiceModel.Security.Tokens/IssuedSecurityTokenHandler.cs
 System.ServiceModel.Security.Tokens/IssuedSecurityTokenParameters.cs
 System.ServiceModel.Security.Tokens/IssuedSecurityTokenProvider.cs
@@ -767,10 +765,8 @@ System.ServiceModel.Security.Tokens/SupportingTokenParameters.cs
 System.ServiceModel.Security.Tokens/TlsClientSession.cs
 System.ServiceModel.Security.Tokens/TlsServerSession.cs
 System.ServiceModel.Security.Tokens/UserNameSecurityTokenParameters.cs
-System.ServiceModel.Security.Tokens/WrappedKeySecurityToken.cs
 System.ServiceModel.Security.Tokens/X509SecurityTokenParameters.cs
 System.ServiceModel.Security/BasicSecurityProfileVersion.cs
-System.ServiceModel.Security/BinarySecretKeyIdentifierClause.cs
 System.ServiceModel.Security/ChannelProtectionRequirements.cs
 System.ServiceModel.Security/DataProtectionSecurityStateEncoder.cs
 System.ServiceModel.Security/ExpiredSecurityTokenException.cs
@@ -783,7 +779,6 @@ System.ServiceModel.Security/InfocardInteractiveChannelInitializer.cs
 System.ServiceModel.Security/IssuedTokenClientCredential.cs
 System.ServiceModel.Security/IssuedTokenServiceCredential.cs
 System.ServiceModel.Security/KeyEntropyMode.cs
-System.ServiceModel.Security/KeyNameIdentifierClause.cs
 System.ServiceModel.Security/MessagePartSpecification.cs
 System.ServiceModel.Security/MessageProtectionOrder.cs
 System.ServiceModel.Security/MessageSecurityException.cs
@@ -793,7 +788,6 @@ System.ServiceModel.Security/SecureConversationServiceCredential.cs
 System.ServiceModel.Security/SecureConversationVersion.cs
 System.ServiceModel.Security/SecurityAccessDeniedException.cs
 System.ServiceModel.Security/SecurityAlgorithmSuite.cs
-System.ServiceModel.Security/SecurityContextKeyIdentifierClause.cs
 System.ServiceModel.Security/SecurityCredentialsManager.cs
 System.ServiceModel.Security/SecurityMessageProperty.cs
 System.ServiceModel.Security/SecurityNegotiationException.cs
index bd2b762d9473c68ccd3cdd9fc9f33d4b49d0281c..5b558599b08a5ed866d820a3a2a947a14bc6f7f6 100644 (file)
@@ -35,8 +35,8 @@ namespace System.ServiceModel
        public class ActionNotSupportedException : CommunicationException
        {
                public ActionNotSupportedException () : base () {}
-               public ActionNotSupportedException (string msg) : base (msg) {}
-               public ActionNotSupportedException (string msg, Exception inner) : base (msg, inner) {}
+               public ActionNotSupportedException (string message) : base (message) {}
+               public ActionNotSupportedException (string message, Exception innerException) : base (message, innerException) {}
                protected ActionNotSupportedException (SerializationInfo info, StreamingContext context) :
                        base (info, context) {}
        }
index ef9715fb4b4fb00e0cc5ffb30c1fac359060ec25..49140b9f6477d0140b24cccc78c4d97b190796e3 100644 (file)
@@ -50,7 +50,7 @@ namespace System.ServiceModel
                {
                }
                
-#if !NET_2_1 && !XAMMAC_4_5
+#if !MOBILE && !XAMMAC_4_5
                public BasicHttpBinding (string configurationName)
                        : this ()
                {
@@ -110,7 +110,7 @@ namespace System.ServiceModel
                        SecurityBindingElement element;
                        switch (Security.Mode) {
                        case BasicHttpSecurityMode.Message:
-#if NET_2_1 || XAMMAC_4_5
+#if MOBILE || XAMMAC_4_5
                                throw new NotImplementedException ();
 #else
                                if (Security.Message.ClientCredentialType != BasicHttpMessageCredentialType.Certificate)
@@ -121,7 +121,7 @@ namespace System.ServiceModel
 #endif
 
                        case BasicHttpSecurityMode.TransportWithMessageCredential:
-#if NET_2_1 || XAMMAC_4_5
+#if MOBILE || XAMMAC_4_5
                                throw new NotImplementedException ();
 #else
                                if (Security.Message.ClientCredentialType != BasicHttpMessageCredentialType.Certificate)
@@ -135,7 +135,7 @@ namespace System.ServiceModel
                                return null;
                        }
                        
-#if !NET_2_1 && !XAMMAC_4_5
+#if !MOBILE && !XAMMAC_4_5
                        element.SetKeyDerivation (false);
                        element.SecurityHeaderLayout = SecurityHeaderLayout.Lax;
 #endif
@@ -150,7 +150,7 @@ namespace System.ServiceModel
                                ReaderQuotas.CopyTo (tm.ReaderQuotas);
                                return tm;
                        } else {
-#if NET_2_1 || XAMMAC_4_5
+#if MOBILE || XAMMAC_4_5
                                throw new NotImplementedException ();
 #else
                                return new MtomMessageEncodingBindingElement (
index 21e66a4f65b462670d2c38ea5b0ee018943b6617..b328f91e146957814bea82bae4867a86a0c1fcd9 100644 (file)
@@ -50,7 +50,7 @@ namespace System.ServiceModel
                {
                }
                
-#if !NET_2_1 && !XAMMAC_4_5
+#if !MOBILE && !XAMMAC_4_5
                public BasicHttpsBinding (string configurationName)
                        : this ()
                {
@@ -102,7 +102,7 @@ namespace System.ServiceModel
                        SecurityBindingElement element;
                        switch (Security.Mode) {
                        case BasicHttpsSecurityMode.TransportWithMessageCredential:
-#if NET_2_1 || XAMMAC_4_5
+#if MOBILE || XAMMAC_4_5
 
                                throw new NotImplementedException ();
 #else
@@ -117,7 +117,7 @@ namespace System.ServiceModel
                                return null;
                        }
                        
-#if !NET_2_1 && !XAMMAC_4_5
+#if !MOBILE && !XAMMAC_4_5
                        element.SetKeyDerivation (false);
                        element.SecurityHeaderLayout = SecurityHeaderLayout.Lax;
 #endif
@@ -132,7 +132,7 @@ namespace System.ServiceModel
                                ReaderQuotas.CopyTo (tm.ReaderQuotas);
                                return tm;
                        } else {
-#if NET_2_1 || XAMMAC_4_5
+#if MOBILE || XAMMAC_4_5
                                throw new NotImplementedException ();
 #else
                                return new MtomMessageEncodingBindingElement (
index e5ef83357f35ebc8401a4bed40e6d6fb43a5a2e6..84b8f96db81167bdaab35788a4e94545208a1d82 100644 (file)
@@ -85,33 +85,33 @@ namespace System.ServiceModel
                        get { return Endpoint.Binding.OpenTimeout; }
                }
 
-               protected virtual void ApplyConfiguration (string endpointConfig)
+               protected virtual void ApplyConfiguration (string configurationName)
                {
-                       if (endpointConfig == null)
+                       if (configurationName == null)
                                return;
 
-#if NET_2_1 || XAMMAC_4_5
+#if MOBILE || XAMMAC_4_5
                        try {
                                // It should automatically use XmlXapResolver
                                var cfg = new SilverlightClientConfigLoader ().Load (XmlReader.Create ("ServiceReferences.ClientConfig"));
 
                                SilverlightClientConfigLoader.ServiceEndpointConfiguration se = null;
-                               if (endpointConfig == "*")
+                               if (configurationName == "*")
                                        se = cfg.GetServiceEndpointConfiguration (Endpoint.Contract.Name);
                                if (se == null)
-                                       se = cfg.GetServiceEndpointConfiguration (endpointConfig);
+                                       se = cfg.GetServiceEndpointConfiguration (configurationName);
 
                                if (se.Binding != null && Endpoint.Binding == null)
                                        Endpoint.Binding = se.Binding;
                                else // ignore it
-                                       Console.WriteLine ("WARNING: Configured binding not found in configuration {0}", endpointConfig);
+                                       Console.WriteLine ("WARNING: Configured binding not found in configuration {0}", configurationName);
                                if (se.Address != null && Endpoint.Address == null)
                                        Endpoint.Address = se.Address;
                                else // ignore it
-                                       Console.WriteLine ("WARNING: Configured endpoint address not found in configuration {0}", endpointConfig);
+                                       Console.WriteLine ("WARNING: Configured endpoint address not found in configuration {0}", configurationName);
                        } catch (Exception) {
                                // ignore it.
-                               Console.WriteLine ("WARNING: failed to load endpoint configuration for {0}", endpointConfig);
+                               Console.WriteLine ("WARNING: failed to load endpoint configuration for {0}", configurationName);
                        }
 #else
 
@@ -120,7 +120,7 @@ namespace System.ServiceModel
                        ChannelEndpointElement endpoint = null;
 
                        foreach (ChannelEndpointElement el in client.Endpoints) {
-                               if (el.Contract == contractName && (endpointConfig == el.Name || endpointConfig == "*")) {
+                               if (el.Contract == contractName && (configurationName == el.Name || configurationName == "*")) {
                                        if (endpoint != null)
                                                throw new InvalidOperationException (String.Format ("More then one endpoint matching contract {0} was found.", contractName));
                                        endpoint = el;
@@ -128,7 +128,7 @@ namespace System.ServiceModel
                        }
 
                        if (endpoint == null)
-                               throw new InvalidOperationException (String.Format ("Client endpoint configuration '{0}' was not found in {1} endpoints.", endpointConfig, client.Endpoints.Count));
+                               throw new InvalidOperationException (String.Format ("Client endpoint configuration '{0}' was not found in {1} endpoints.", configurationName, client.Endpoints.Count));
 
                        var binding = String.IsNullOrEmpty (endpoint.Binding) ? null : ConfigUtil.CreateBinding (endpoint.Binding, endpoint.BindingConfiguration);
                        var contractType = ConfigUtil.GetTypeFromConfigString (endpoint.Contract, NamedConfigCategory.Contract);
@@ -160,7 +160,7 @@ namespace System.ServiceModel
 #endif
                }
 
-#if !NET_2_1 && !XAMMAC_4_5
+#if !MOBILE && !XAMMAC_4_5
                private void ApplyBehavior (string behaviorConfig)
                {
                        BehaviorsSection behaviorsSection = ConfigUtil.BehaviorsSection;
@@ -260,7 +260,7 @@ namespace System.ServiceModel
                                new BindingParameterCollection ();
 
                        ContractDescription cd = Endpoint.Contract;
-#if !NET_2_1
+#if !MOBILE
                        pl.Add (ChannelProtectionRequirements.CreateFromContract (cd));
 #endif
 
@@ -298,23 +298,23 @@ namespace System.ServiceModel
                }
 
                protected void InitializeEndpoint (
-                       string endpointConfigurationName,
+                       string configurationName,
                        EndpointAddress remoteAddress)
                {
                        InitializeEndpoint (CreateDescription ());
                        if (remoteAddress != null)
                                service_endpoint.Address = remoteAddress;
-                       ApplyConfiguration (endpointConfigurationName);
+                       ApplyConfiguration (configurationName);
                }
 
                protected void InitializeEndpoint (Binding binding,
-                       EndpointAddress remoteAddress)
+                       EndpointAddress address)
                {
                        InitializeEndpoint (CreateDescription ());
                        if (binding != null)
                                service_endpoint.Binding = binding;
-                       if (remoteAddress != null)
-                               service_endpoint.Address = remoteAddress;
+                       if (address != null)
+                               service_endpoint.Address = address;
                }
 
                protected void InitializeEndpoint (ServiceEndpoint endpoint)
index 1af7625027ecea7470b966e0a0c214edbdb31571..0f6560c743f6dec1e8d53e34efbeca3bf3b40dba 100644 (file)
@@ -46,12 +46,12 @@ namespace System.ServiceModel
                {
                }
 
-               protected ChannelFactory (Type type)
+               protected ChannelFactory (Type channelType)
                {
-                       if (type == null)
-                               throw new ArgumentNullException ("type");
-                       if (!type.IsInterface)
-                               throw new InvalidOperationException ("The type argument to the generic ChannelFactory constructor must be an interface type.");
+                       if (channelType == null)
+                               throw new ArgumentNullException ("channelType");
+                       if (!channelType.IsInterface)
+                               throw new InvalidOperationException ("The channelType argument to the generic ChannelFactory constructor must be an interface type.");
 
                        InitializeEndpoint (CreateDescription ());
                }
index a7b5587abf84f9809a24c4dae57b31ee730ae139..1e2724f95434c49768dd7c4fe6eee4d0c32e11cf 100644 (file)
@@ -79,7 +79,7 @@ namespace System.ServiceModel
 
                        string modname = "dummy";
                        Type crtype =
-#if !NET_2_1
+#if !MOBILE
                                duplex ? typeof (DuplexClientRuntimeChannel) :
 #endif
                                typeof (ClientRuntimeChannel);
@@ -131,7 +131,7 @@ namespace System.ServiceModel
                        BindingFlags bf = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance;
                        foreach (OperationDescription od in cd.Operations) {
                                // FIXME: handle properties and events.
-#if !NET_2_1
+#if !MOBILE
                                if (od.SyncMethod != null)
                                        GenerateMethodImpl (c, crtype.GetMethod ("Process", bf), od.Name, od.SyncMethod);
 #endif
index 41d75e98f9cf83d16024f9373086d2d27c56cf99..986fb69f1ec8ac95b1a7403819bb232da64946ac 100644 (file)
@@ -71,7 +71,7 @@ namespace System.ServiceModel
                {
                        if (CanCastTo<IClientChannel> (t))
                                return true;
-#if !NET_2_1
+#if !MOBILE
                        if (isDuplex && CanCastTo<IDuplexContextChannel> (t))
                                return true;
 #endif
index a41db9ad05281e5248f4d20f1493d4e3f8c07e63..9acde8e4f9c161f533a3b37c8c361a614ac8dc87 100644 (file)
@@ -34,8 +34,8 @@ namespace System.ServiceModel {
        public class CommunicationException : SystemException
        {
                public CommunicationException () : base () {}
-               public CommunicationException (string msg) : base (msg) {}
-               public CommunicationException (string msg, Exception inner) : base (msg, inner) {}
+               public CommunicationException (string message) : base (message) {}
+               public CommunicationException (string message, Exception innerException) : base (message, innerException) {}
                protected CommunicationException (SerializationInfo info, StreamingContext context)
                        : base (info, context) {}
        }
index 720d23eb9c60b842052935199dcab533ce226fad..57f814c2a93536b654bbe17ff0bc12221d9453d4 100644 (file)
@@ -34,9 +34,9 @@ namespace System.ServiceModel {
        public class CommunicationObjectAbortedException : CommunicationException
        {
                public CommunicationObjectAbortedException () : base () {}
-               public CommunicationObjectAbortedException (string msg) : base (msg) {}
-               public CommunicationObjectAbortedException (string msg, Exception inner)
-                       : base (msg, inner) {}          
+               public CommunicationObjectAbortedException (string message) : base (message) {}
+               public CommunicationObjectAbortedException (string message, Exception innerException)
+                       : base (message, innerException) {}             
                protected CommunicationObjectAbortedException (SerializationInfo info,
                                               StreamingContext context)
                        : base (info, context) {}
index c6fb51ee968da8915ff0e201896721e0f03e208c..6538d6a338923150ce0e060771e9f899de4be6f2 100644 (file)
@@ -34,9 +34,9 @@ namespace System.ServiceModel {
        public class CommunicationObjectFaultedException : CommunicationException
        {
                public CommunicationObjectFaultedException () : base () {}
-               public CommunicationObjectFaultedException (string msg) : base (msg) {}
-               public CommunicationObjectFaultedException (string msg, Exception inner)
-                       : base (msg, inner) {}
+               public CommunicationObjectFaultedException (string message) : base (message) {}
+               public CommunicationObjectFaultedException (string message, Exception innerException)
+                       : base (message, innerException) {}
                protected CommunicationObjectFaultedException (SerializationInfo info, StreamingContext context)
                        : base (info, context) {}
        }
index 9c9b76aec61ac33aae7400c40f01df1c6004c1b3..fb4d18dc563450e5fe7312077c7ad5df1c14c8a5 100644 (file)
@@ -45,12 +45,12 @@ namespace System.ServiceModel
                        Initialize (identity);
                }
 
-               public DnsEndpointIdentity (string dns)
-                       : this (Claim.CreateDnsClaim (dns))
+               public DnsEndpointIdentity (string dnsName)
+                       : this (Claim.CreateDnsClaim (dnsName))
                {
                }
 #else
-               public DnsEndpointIdentity (string dns)
+               public DnsEndpointIdentity (string dnsName)
                {
                        throw new NotImplementedException ();
                }
index f437b1a495b5b43cbabf5fca29b4e8204be77da8..64ce85812b5dabce76d928c81a1a802369c78231 100644 (file)
@@ -34,71 +34,71 @@ namespace System.ServiceModel
 {
        public class DuplexClientBase<TChannel> : ClientBase<TChannel> where TChannel : class
        {
-               protected DuplexClientBase (object instance)
-                       : this (new InstanceContext (instance), (Binding) null, null)
+               protected DuplexClientBase (object callbackInstance)
+                       : this (new InstanceContext (callbackInstance), (Binding) null, null)
                {
                }
 
-               protected DuplexClientBase (object instance,
-                       Binding binding, EndpointAddress address)
-                       : this (new InstanceContext (instance), binding, address)
+               protected DuplexClientBase (object callbackInstance,
+                       Binding binding, EndpointAddress remoteAddress)
+                       : this (new InstanceContext (callbackInstance), binding, remoteAddress)
                {
                }
 
-               protected DuplexClientBase (object instance,
-                       string configurationName)
-                       : this (new InstanceContext (instance), configurationName)
+               protected DuplexClientBase (object callbackInstance,
+                       string endpointConfigurationName)
+                       : this (new InstanceContext (callbackInstance), endpointConfigurationName)
                {
                }
 
-               protected DuplexClientBase (object instance,
-                       string bindingConfigurationName, EndpointAddress address)
-                       : this (new InstanceContext (instance), bindingConfigurationName, address)
+               protected DuplexClientBase (object callbackInstance,
+                       string bindingConfigurationName, EndpointAddress remoteAddress)
+                       : this (new InstanceContext (callbackInstance), bindingConfigurationName, remoteAddress)
                {
                }
 
-               protected DuplexClientBase (object instance,
+               protected DuplexClientBase (object callbackInstance,
                        string endpointConfigurationName, string remoteAddress)
-                       : this (new InstanceContext (instance), endpointConfigurationName, remoteAddress)
+                       : this (new InstanceContext (callbackInstance), endpointConfigurationName, remoteAddress)
                {
                }
 
-               protected DuplexClientBase (InstanceContext instance)
-                       : base (instance)
+               protected DuplexClientBase (InstanceContext callbackInstance)
+                       : base (callbackInstance)
                {
                }
 
-               protected DuplexClientBase (InstanceContext instance,
-                       Binding binding, EndpointAddress address)
-                       : base (instance, binding, address)
+               protected DuplexClientBase (InstanceContext callbackInstance,
+                       Binding binding, EndpointAddress remoteAddress)
+                       : base (callbackInstance, binding, remoteAddress)
                {
                }
 
-               protected DuplexClientBase (InstanceContext instance,
-                       string configurationName)
-                       : base (instance, configurationName)
+               protected DuplexClientBase (InstanceContext callbackInstance,
+                       string endpointConfigurationName)
+                       : base (callbackInstance, endpointConfigurationName)
                {
                }
 
-               protected DuplexClientBase (InstanceContext instance,
+               protected DuplexClientBase (InstanceContext callbackInstance,
                        string endpointConfigurationName, string remoteAddress)
-                       : base (instance, endpointConfigurationName, remoteAddress)
+                       : base (callbackInstance, endpointConfigurationName, remoteAddress)
                {
                }
 
-               protected DuplexClientBase (InstanceContext instance,
-                       string configurationName, EndpointAddress address)
-                       : base (instance, configurationName, address)
+               protected DuplexClientBase (InstanceContext callbackInstance,
+                       string endpointConfigurationName, EndpointAddress address)
+                       : base (callbackInstance, endpointConfigurationName, address)
                {
                }
 
-               protected DuplexClientBase (object instance, ServiceEndpoint endpoint)
-                       : this (new InstanceContext (instance), endpoint)
+               protected DuplexClientBase (object callbackInstance, ServiceEndpoint endpoint)
+                       : this (new InstanceContext (callbackInstance), endpoint)
                {
                }
 
-               protected DuplexClientBase (InstanceContext instance, ServiceEndpoint endpoint)
-                       : base (instance, endpoint)
+               protected DuplexClientBase (InstanceContext callbackInstance, ServiceEndpoint endpoint)
+                       : base (callbackInstance, endpoint)
                {
                }
 
index 7c09860e4813298410ab4efaa3fc671a6b20ebc0..1740e4d99066ab81ce59ebfa32cce5e3c797bcfa 100644 (file)
@@ -37,7 +37,7 @@ using System.Xml.Schema;
 using System.Xml.Serialization;
 using System.ServiceModel.Channels;
 using System.ServiceModel.Description;
-#if !NET_2_1
+#if !MOBILE
 using System.Security.Cryptography.Xml;
 #endif
 
@@ -70,11 +70,11 @@ namespace System.ServiceModel
                {
                }
 
-               public EndpointAddress (Uri uri, params AddressHeader [] headers)
-                       : this (uri, null, new AddressHeaderCollection (headers), null, null) {}
+               public EndpointAddress (Uri uri, params AddressHeader [] addressHeaders)
+                       : this (uri, null, new AddressHeaderCollection (addressHeaders), null, null) {}
 
-               public EndpointAddress (Uri uri, EndpointIdentity identity, params AddressHeader [] headers)
-                       : this (uri, identity, new AddressHeaderCollection (headers), null, null) {}
+               public EndpointAddress (Uri uri, EndpointIdentity identity, params AddressHeader [] addressHeaders)
+                       : this (uri, identity, new AddressHeaderCollection (addressHeaders), null, null) {}
 
                public EndpointAddress (Uri uri, EndpointIdentity identity, AddressHeaderCollection headers)
                        : this (uri, identity, headers, null, null) {}
@@ -116,7 +116,7 @@ namespace System.ServiceModel
                        get { return address; }
                }
 
-#if !NET_2_1
+#if !MOBILE
                internal static XmlSchema Schema {
                        get {
                                if (schema == null) {
@@ -187,7 +187,7 @@ namespace System.ServiceModel
                        return ! (address1 == address2);
                }
 
-//#if !NET_2_1
+//#if !MOBILE
                public static EndpointAddress ReadFrom (
                        XmlDictionaryReader reader)
                {
@@ -296,7 +296,7 @@ namespace System.ServiceModel
                                        addressingVersion.Namespace, reader.LocalName, reader.NamespaceURI));
 
                        reader.MoveToContent ();
-#if !NET_2_1
+#if !MOBILE
                        MetadataSet metadata = null;
                        if (reader.LocalName == "Metadata" &&
                            reader.NamespaceURI == addressingVersion.Namespace &&
@@ -317,7 +317,7 @@ namespace System.ServiceModel
                        if (addressingVersion == AddressingVersion.WSAddressing10 && uri == w3c_anonymous)
                                uri = anonymous_role;
 
-#if NET_2_1
+#if MOBILE
                        return new EndpointAddress (uri, identity);
 #else
                        if (metadata == null)
@@ -338,7 +338,7 @@ namespace System.ServiceModel
                {
                        if (writer == null)
                                throw new ArgumentNullException ("writer");
-#if NET_2_1
+#if MOBILE
                        if (addressingVersion == AddressingVersion.None) {
                                writer.WriteString (Uri.AbsoluteUri);
                        } else {
index 862830b0c76eb927a2b38a78c9b321365f3b2440..d26293b0e70ef6b0900fbbef725c56710f88ae3e 100644 (file)
@@ -42,7 +42,7 @@ namespace System.ServiceModel
 {
        [XmlSchemaProvider ("GetSchema")]
        [XmlRoot ("EndpointReference", Namespace = "http://www.w3.org/2005/08/addressing")]
-#if NET_2_1
+#if MOBILE
        internal class EndpointAddress10 : IXmlSerializable
 #else
        public class EndpointAddress10 : IXmlSerializable
index 7500d76322cdc1abb5b123c28fb6f896c3ad22c0..f56bb33330dedc5ccdddcd0091c872b1ef26ef52 100644 (file)
@@ -67,7 +67,7 @@ namespace System.ServiceModel
                        set { identity = value; }
                }
 
-#if !NET_2_1
+#if !MOBILE
                public XmlDictionaryReader GetReaderAtExtensions ()
                {
                        if (extension == null)
index a3b644824598d30c3f8db1a4c29a86a43f734d6e..fc44796f7c9d0f93dd332b6f2f295fe01f84ea26 100644 (file)
@@ -34,8 +34,8 @@ namespace System.ServiceModel {
        public class EndpointNotFoundException : CommunicationException
        {
                public EndpointNotFoundException () : base () {}
-               public EndpointNotFoundException (string msg) : base (msg) {}
-               public EndpointNotFoundException (string msg, Exception inner) : base (msg, inner) {}
+               public EndpointNotFoundException (string message) : base (message) {}
+               public EndpointNotFoundException (string message, Exception innerException) : base (message, innerException) {}
                protected EndpointNotFoundException (SerializationInfo info, StreamingContext context) :
                        base (info, context) {}
        }
index c33159baca43a21195cdfa08d0cdff181bc02b3f..a2b47aa4f6a4e482871c79a28a272847e63f002b 100644 (file)
@@ -42,16 +42,16 @@ namespace System.ServiceModel
                {
                }
 
-               public FaultCode (string name, FaultCode subcode)
-                       : this (name, String.Empty, subcode)
+               public FaultCode (string name, FaultCode subCode)
+                       : this (name, String.Empty, subCode)
                {
                }
 
-               public FaultCode (string name, string ns, FaultCode subcode)
+               public FaultCode (string name, string ns, FaultCode subCode)
                {
                        this.name = name;
                        this.ns = ns;
-                       this.subcode = subcode;
+                       this.subcode = subCode;
                }
 
                public bool IsPredefinedFault {
@@ -78,9 +78,9 @@ namespace System.ServiceModel
                        get { return subcode; }
                }
 
-               public static FaultCode CreateReceiverFaultCode (FaultCode subcode)
+               public static FaultCode CreateReceiverFaultCode (FaultCode subCode)
                {
-                       return new FaultCode ("Receiver", subcode);
+                       return new FaultCode ("Receiver", subCode);
                }
 
                public static FaultCode CreateReceiverFaultCode (string name, string ns)
@@ -88,9 +88,9 @@ namespace System.ServiceModel
                        return CreateReceiverFaultCode (new FaultCode (name, ns));
                }
                
-               public static FaultCode CreateSenderFaultCode (FaultCode subcode)
+               public static FaultCode CreateSenderFaultCode (FaultCode subCode)
                {
-                       return new FaultCode ("Sender", subcode);
+                       return new FaultCode ("Sender", subCode);
                }
 
                public static FaultCode CreateSenderFaultCode (string name, string ns)
index 5e06e2f1287096be96fa594acaf68f370f43c00b..05b3af01caf8117bb1e39b4eae01a04e70323469 100644 (file)
@@ -100,7 +100,7 @@ namespace System.ServiceModel
                }
 
                [MonoTODO]
-               public static FaultException CreateFault (MessageFault fault,  params Type [] details)
+               public static FaultException CreateFault (MessageFault messageFault,  params Type [] faultDetailTypes)
                {
                        throw new NotImplementedException ();
                }
index fe787f2312950d03954a452f7705fa63b8b93786..eb0f348ffdbbcc036bca0812ef22c152694c9a72 100644 (file)
@@ -34,8 +34,8 @@ namespace System.ServiceModel {
        public class InvalidMessageContractException : SystemException
        {
                public InvalidMessageContractException () : base () {}
-               public InvalidMessageContractException (string msg) : base (msg) {}
-               public InvalidMessageContractException (string msg, Exception inner) : base (msg, inner) {}
+               public InvalidMessageContractException (string message) : base (message) {}
+               public InvalidMessageContractException (string message, Exception innerException) : base (message, innerException) {}
                protected InvalidMessageContractException (SerializationInfo info, StreamingContext context) :
                        base (info, context) {}
        }
index 79c743c48fba84d2da4e0d3f0582a3100f464f87..b00afa8203f0401657bac473dbc9bfc164ffa64e 100644 (file)
@@ -50,7 +50,7 @@ namespace System.ServiceModel
 
        internal static class Logger
        {
-#if NET_2_1
+#if MOBILE
                enum TraceEventType // dummy
                {
                        Critical,
@@ -71,7 +71,7 @@ namespace System.ServiceModel
                static int event_id;
                static TextWriter log_writer;
                static XmlWriter xml_writer;
-#if !NET_2_1
+#if !MOBILE
                static readonly TraceSource source = new TraceSource ("System.ServiceModel");
                static readonly TraceSource message_source = new TraceSource ("System.ServiceModel.MessageLogging");
 #endif
@@ -89,7 +89,7 @@ namespace System.ServiceModel
                        case "stderr":
                                log_writer = Console.Error;
                                break;
-#if !NET_2_1
+#if !MOBILE
                        default:
                                try {
                                        if (!String.IsNullOrEmpty (env))
@@ -104,7 +104,7 @@ namespace System.ServiceModel
                        if (log_writer != null)
                                xml_writer = XmlWriter.Create (log_writer, new XmlWriterSettings () { OmitXmlDeclaration = true });
 
-#if !NET_2_1
+#if !MOBILE
                        message_source.Switch.Level = SourceLevels.Information;
 #endif
                }
@@ -143,7 +143,7 @@ namespace System.ServiceModel
                        if (log_writer != null) {
                                lock (log_writer){
                                        event_id++;
-#if NET_2_1
+#if MOBILE
                                        log_writer.Write ("[{0}] ", event_id);
 #endif
                                        TraceCore (TraceEventType.Information, event_id,
@@ -151,7 +151,7 @@ namespace System.ServiceModel
                                                message, args);
                                        log_writer.WriteLine (message, args);
                                        log_writer.Flush ();
-#if !NET_2_1
+#if !MOBILE
                                        source.TraceEvent (eventType, event_id, message, args);
 #endif
                                }
@@ -179,7 +179,7 @@ namespace System.ServiceModel
                {
                        if (log_writer != null) {
                                var sw = new StringWriter ();
-#if NET_2_1
+#if MOBILE
                                var xw = XmlWriter.Create (sw, xws);
 #else
                                var doc = new XmlDocument ();
@@ -199,7 +199,7 @@ namespace System.ServiceModel
 
                                event_id++;
                                lock (log_writer){
-#if NET_2_1
+#if MOBILE
                                        log_writer.Write ("[{0}] ", event_id);
 
                                        TraceCore (TraceEventType.Information, event_id, /*FIXME*/false, /*FIXME*/Guid.Empty, sw);
index b47c54750f5cefe905cb954958bf4e4e0e4f5db7..376c3861ad12887081c0db2a5f8be274bd7fda8a 100644 (file)
@@ -35,8 +35,8 @@ namespace System.ServiceModel {
        public class MessageHeaderException : ProtocolException
        {
                public MessageHeaderException () : this ("Message header exception") {}
-               public MessageHeaderException (string msg) : this (msg, null) {}
-               public MessageHeaderException (string msg, Exception inner) : base (msg, inner) {}
+               public MessageHeaderException (string message) : this (message, null) {}
+               public MessageHeaderException (string message, Exception innerException) : base (message, innerException) {}
                protected MessageHeaderException (SerializationInfo info, StreamingContext context) :
                        base (info, context)
                {
index 04814785c61ba95cfe1be7ccc63456fb658038c1..e6d17aab279782f73799da0573c5c36337057438 100644 (file)
@@ -53,10 +53,10 @@ namespace System.ServiceModel
                {
                }
 
-               public MessageHeader (T content, bool must_understand, string actor, bool relay)
+               public MessageHeader (T content, bool mustUnderstand, string actor, bool relay)
                {
                        this.content = content;
-                       this.must_understand = must_understand;
+                       this.must_understand = mustUnderstand;
                        this.actor = actor;
                        this.relay = relay;
                }
index 097e8cbfa4e1097b207794fafa5e9921ee43479c..7d64d43d6350908c6edb78c6bc2acd47efd009ca 100644 (file)
@@ -45,7 +45,7 @@ namespace System.ServiceModel
                }
 
                Message incoming_message;
-#if !NET_2_1 && !XAMMAC_4_5
+#if !MOBILE && !XAMMAC_4_5
                EndpointDispatcher dispatcher;
 #endif
                IContextChannel channel;
@@ -83,7 +83,7 @@ namespace System.ServiceModel
                }
 
 
-#if !NET_2_1 && !XAMMAC_4_5
+#if !MOBILE && !XAMMAC_4_5
                public EndpointDispatcher EndpointDispatcher {
                        get { return dispatcher; }
                        set { dispatcher = value; }
@@ -146,7 +146,7 @@ namespace System.ServiceModel
                        get { return Channel.SessionId; }
                }
 
-#if !NET_2_1
+#if !MOBILE
                public ServiceSecurityContext ServiceSecurityContext {
                        get { return IncomingMessageProperties != null ? IncomingMessageProperties.Security.ServiceSecurityContext : null; }
                }
index e2fc290816d06c2b9c9bfca9770aee980eb49526..4a2a89d205777f2dc178410da25623b9eb5f1eec 100644 (file)
@@ -34,9 +34,9 @@ namespace System.ServiceModel {
        public class ProtocolException : CommunicationException
        {
                public ProtocolException () : base () {}
-               public ProtocolException (string msg) : base (msg) {}
-               public ProtocolException (string msg, Exception inner)
-                       : base (msg, inner) {}          
+               public ProtocolException (string message) : base (message) {}
+               public ProtocolException (string message, Exception innerException)
+                       : base (message, innerException) {}             
                protected ProtocolException (SerializationInfo info,
                                          StreamingContext context)
                        : base (info, context) {}
index adf08d2a071072488a85597f224b0a22cc5936f0..0407be88306732fe349607fff9c62162c0480a9b 100644 (file)
@@ -34,9 +34,9 @@ namespace System.ServiceModel {
        public class QuotaExceededException : SystemException
        {
                public QuotaExceededException () : base () {}
-               public QuotaExceededException (string msg) : base (msg) {}
-               public QuotaExceededException (string msg, Exception inner)
-                       : base (msg, inner) {}          
+               public QuotaExceededException (string message) : base (message) {}
+               public QuotaExceededException (string message, Exception innerException)
+                       : base (message, innerException) {}             
                protected QuotaExceededException (SerializationInfo info,
                                               StreamingContext context)
                        : base (info, context) {}
index f38f3125209f24612b966381702b5d35c3004ca1..c96b274e2af3050d17895a7c639cf7d06db913d5 100644 (file)
@@ -34,9 +34,9 @@ namespace System.ServiceModel {
        public class ServerTooBusyException : CommunicationException
        {
                public ServerTooBusyException () : base () {}
-               public ServerTooBusyException (string msg) : base (msg) {}
-               public ServerTooBusyException (string msg, Exception inner)
-                       : base (msg, inner) {}          
+               public ServerTooBusyException (string message) : base (message) {}
+               public ServerTooBusyException (string message, Exception innerException)
+                       : base (message, innerException) {}             
                protected ServerTooBusyException (SerializationInfo info,
                                               StreamingContext context)
                        : base (info, context) {}
index 6fe64902d4ce30ed2ce3013cd2db8740c19748e6..a55841387a817df5fff54780e40bcb701f6ce399 100644 (file)
@@ -34,9 +34,9 @@ namespace System.ServiceModel {
        public class ServiceActivationException : CommunicationException
        {
                public ServiceActivationException () : base () {}
-               public ServiceActivationException (string msg) : base (msg) {}
-               public ServiceActivationException (string msg, Exception inner)
-                       : base (msg, inner) {}          
+               public ServiceActivationException (string message) : base (message) {}
+               public ServiceActivationException (string message, Exception innerException)
+                       : base (message, innerException) {}             
                protected ServiceActivationException (SerializationInfo info,
                                               StreamingContext context)
                        : base (info, context) {}
index 75d412d50c25720ad3b65b08644607ae5d15cc75..eaf7d5ce2c42f28ca2836757bbf0626f11162c06 100644 (file)
@@ -25,7 +25,7 @@
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
-#if NET_2_1 || XAMMAC_4_5
+#if MOBILE || XAMMAC_4_5
 
 using System;
 using System.Collections.Generic;
index 396579fd2555c54aab9803f9eb3b90604c0dd641..4381d758cfc854e047c3baa368ddcf19350da01c 100644 (file)
@@ -45,12 +45,12 @@ namespace System.ServiceModel
                        Initialize (identity);
                }
 
-               public SpnEndpointIdentity (string spn)
-                       : this (Claim.CreateSpnClaim (spn))
+               public SpnEndpointIdentity (string spnName)
+                       : this (Claim.CreateSpnClaim (spnName))
                {
                }
 #else
-               public SpnEndpointIdentity (string spn)
+               public SpnEndpointIdentity (string spnName)
                {
                        throw new NotImplementedException ();
                }
index e53d72009a66a6c7591354242e2b7d8a20997dfb..93863a78e5f54876595ff8535113c2eae8589a6d 100644 (file)
@@ -45,12 +45,12 @@ namespace System.ServiceModel
                        Initialize (identity);
                }
 
-               public UpnEndpointIdentity (string upn)
-                       : this (Claim.CreateUpnClaim (upn))
+               public UpnEndpointIdentity (string upnName)
+                       : this (Claim.CreateUpnClaim (upnName))
                {
                }
 #else
-               public UpnEndpointIdentity (string upn)
+               public UpnEndpointIdentity (string upnName)
                {
                        throw new NotImplementedException ();
                }
index d06cb33fe21c43bca6002a04358d3c9f0c28bbe9..c788a402138e04da469f0701d7f16f5e10fdcd91 100644 (file)
@@ -1,3 +1,4 @@
+../../test-helpers/NunitHelpers.cs
 NUnitMoonHelper.cs
 FeatureBased/Features.Client/AsyncCallTesterProxy.cs
 FeatureBased/Features.Client/AsyncPatternServer.cs
index b85b9f02f4cabc7f0e9893114b241ac472fe3dd0..8942c7abf32b4d63e8999cb126f4e63aca43b57a 100644 (file)
@@ -37,7 +37,6 @@ using System.ServiceModel.Channels;
 using System.ServiceModel.Description;
 using NUnit.Framework;
 using NUnit.Framework.Constraints;
-using NUnit.Framework.SyntaxHelpers;
 
 using QName = System.Xml.XmlQualifiedName;
 using WS = System.Web.Services.Description;
@@ -91,7 +90,7 @@ namespace MonoTests.System.ServiceModel.MetadataTests {
                static void CheckSoapBinding (object extension, string transport, TestLabel label)
                {
                        label.EnterScope ("soap");
-                       Assert.That (extension, Is.InstanceOfType (typeof (WS.SoapBinding)), label.Get ());
+                       Assert.That (extension, Is.AssignableTo<WS.SoapBinding>(), label.Get ());
                        var soap = (WS.SoapBinding)extension;
                        Assert.That (soap.Style, Is.EqualTo (WS.SoapBindingStyle.Document), label.Get ());
                        Assert.That (soap.Transport, Is.EqualTo (transport), label.Get ());
@@ -107,9 +106,9 @@ namespace MonoTests.System.ServiceModel.MetadataTests {
                        label.EnterScope ("http");
 
                        if (security == BasicHttpSecurityMode.Message) {
-                               Assert.That (binding, Is.InstanceOfType (typeof(CustomBinding)), label.Get ());
+                               Assert.IsInstanceOfType (typeof(CustomBinding), binding, label.Get ());
                        } else {
-                               Assert.That (binding, Is.InstanceOfType (typeof(BasicHttpBinding)), label.Get ());
+                               Assert.IsInstanceOfType (typeof(BasicHttpBinding), binding, label.Get ());
                                var basicHttp = (BasicHttpBinding)binding;
                                Assert.That (basicHttp.EnvelopeVersion, Is.EqualTo (EnvelopeVersion.Soap11), label.Get ());
                                Assert.That (basicHttp.MessageVersion, Is.EqualTo (MessageVersion.Soap11), label.Get ());
@@ -157,7 +156,7 @@ namespace MonoTests.System.ServiceModel.MetadataTests {
                        label.EnterScope ("text");
                        if (encoding == WSMessageEncoding.Text) {
                                Assert.That (textElement, Is.Not.Null, label.Get ());
-                               Assert.That (textElement.WriteEncoding, Is.InstanceOfType (typeof(UTF8Encoding)), label.Get ());
+                               Assert.IsInstanceOfType (typeof(UTF8Encoding), textElement.WriteEncoding, label.Get ());
                        } else {
                                Assert.That (textElement, Is.Null, label.Get ());
                        }
@@ -409,9 +408,9 @@ namespace MonoTests.System.ServiceModel.MetadataTests {
                {
                        label.EnterScope ("net-tcp");
                        if (security == SecurityMode.Message) {
-                               Assert.That (binding, Is.InstanceOfType (typeof(CustomBinding)), label.Get ());
+                               Assert.IsInstanceOfType (typeof(CustomBinding), binding, label.Get ());
                        } else {
-                               Assert.That (binding, Is.InstanceOfType (typeof(NetTcpBinding)), label.Get ());
+                               Assert.IsInstanceOfType (typeof(NetTcpBinding), binding, label.Get ());
                                var netTcp = (NetTcpBinding)binding;
                                Assert.That (netTcp.EnvelopeVersion, Is.EqualTo (EnvelopeVersion.Soap12), label.Get ());
                                Assert.That (netTcp.MessageVersion, Is.EqualTo (MessageVersion.Soap12WSAddressing10), label.Get ());
@@ -751,7 +750,7 @@ namespace MonoTests.System.ServiceModel.MetadataTests {
                        foreach (var node in all.ChildNodes) {
                                if (node is XmlWhitespace)
                                        continue;
-                               Assert.That (node, Is.InstanceOfType (typeof (XmlElement)), label.ToString ());
+                               Assert.IsInstanceOfType (typeof (XmlElement), node, label.ToString ());
                                collection.Add ((XmlElement)node);
                        }
                        label.LeaveScope ();
@@ -789,7 +788,7 @@ namespace MonoTests.System.ServiceModel.MetadataTests {
                        label.EnterScope ("extensions");
                        Assert.That (op.Extensions, Is.Not.Null, label.Get ());
                        Assert.That (op.Extensions.Count, Is.EqualTo (1), label.Get ());
-                       Assert.That (op.Extensions [0], Is.InstanceOfType (typeof (WS.SoapOperationBinding)), label.Get ());
+                       Assert.That (op.Extensions [0], Is.AssignableTo<WS.SoapOperationBinding>(), label.Get ());
                        var soap = (WS.SoapOperationBinding)op.Extensions [0];
                        TestSoap (soap, soap12, label);
                        label.LeaveScope ();
@@ -821,7 +820,7 @@ namespace MonoTests.System.ServiceModel.MetadataTests {
                        Assert.That (binding.ExtensibleAttributes, Is.Null, label.Get ());
                        Assert.That (binding.Extensions, Is.Not.Null, label.Get ());
                        Assert.That (binding.Extensions.Count, Is.EqualTo (1), label.Get ());
-                       Assert.That (binding.Extensions [0], Is.InstanceOfType (typeof (WS.SoapBodyBinding)), label.Get ());
+                       Assert.That (binding.Extensions [0], Is.AssignableTo<WS.SoapBodyBinding> (), label.Get ());
                        var body = (WS.SoapBodyBinding)binding.Extensions [0];
                        TestSoapBody (body, soap12, label);
                        label.LeaveScope ();
index 3bd64b70dedce02d94b06b2bc65c923ab133c830..a4cbb9cd3eeaec39c008895366358e6a1369a4ce 100644 (file)
@@ -36,7 +36,6 @@ using WS = System.Web.Services.Description;
 
 using NUnit.Framework;
 using NUnit.Framework.Constraints;
-using NUnit.Framework.SyntaxHelpers;
 
 namespace MonoTests.System.ServiceModel.MetadataTests {
 
index 976dc6728eac0dd5c1b272859bdae78a2a787ecb..6262109c1169a09a5cd0235f4a543030c185db48 100644 (file)
@@ -34,7 +34,6 @@ using System.ServiceModel.Channels;
 using System.ServiceModel.Description;
 using NUnit.Framework;
 using NUnit.Framework.Constraints;
-using NUnit.Framework.SyntaxHelpers;
 
 using WS = System.Web.Services.Description;
 
@@ -129,7 +128,6 @@ namespace MonoTests.System.ServiceModel.MetadataTests {
                                AuthenticationSchemes.Ntlm, label);
                }
 
-#if NET_4_5
                [Test]
                public virtual void BasicHttps ()
                {
@@ -179,7 +177,6 @@ namespace MonoTests.System.ServiceModel.MetadataTests {
                                WSMessageEncoding.Text, HttpClientCredentialType.None,
                                AuthenticationSchemes.Anonymous, label);
                }
-#endif
                
                [Test]
                public virtual void NetTcp ()
index 3a92db121d5f92b59acc561e9478754899d6638b..4da65c703a524f6083cc7aaac19ca97f9d44f09c 100644 (file)
@@ -34,7 +34,6 @@ using System.ServiceModel.Channels;
 using System.ServiceModel.Description;
 using NUnit.Framework;
 using NUnit.Framework.Constraints;
-using NUnit.Framework.SyntaxHelpers;
 
 namespace MonoTests.System.ServiceModel.MetadataTests {
        
index e04de3e58968947d49fc44b80ac83be916ae00d4..ab336b3c0500b53f17ba6bcb10a32e67664c140c 100644 (file)
@@ -136,7 +136,6 @@ namespace MonoTests.System.ServiceModel.MetadataTests {
                        return exporter.GetGeneratedMetadata ();
                }
                
-#if NET_4_5
                [MetadataSample]
                public static MetadataSet BasicHttps ()
                {
@@ -197,7 +196,6 @@ namespace MonoTests.System.ServiceModel.MetadataTests {
                        
                        return exporter.GetGeneratedMetadata ();
                }
-#endif
                
                [MetadataSample]
                public static MetadataSet NetTcp ()
index f6656e5c7d9603377dd5858ecc08c32db865c4e8..1e5c270d988b57f7c15dab049c81c37097cf54a5 100644 (file)
@@ -34,7 +34,6 @@ using System.ServiceModel.Channels;
 using System.ServiceModel.Description;
 using NUnit.Framework;
 using NUnit.Framework.Constraints;
-using NUnit.Framework.SyntaxHelpers;
 
 using WS = System.Web.Services.Description;
 
index 798a77915f1087768fd516c00c5d492ece21ed14..6f448cb59a34b2269cd9c4a93f3defa2857fea83 100644 (file)
@@ -168,7 +168,7 @@ namespace MonoTests.System.ServiceModel.Channels {
                }
 
                [TestMethod]
-#if NET_2_1
+#if MOBILE
                [MoonlightBug]
 #else
                [NUnit.Framework.Ignore]
@@ -237,7 +237,7 @@ namespace MonoTests.System.ServiceModel.Channels {
                }
 
                [TestMethod]
-#if NET_2_1
+#if MOBILE
                [MoonlightBug]
 #else
                [NUnit.Framework.Ignore]
@@ -340,7 +340,7 @@ namespace MonoTests.System.ServiceModel.Channels {
                }
 
                [TestMethod]
-#if NET_2_1
+#if MOBILE
                [MoonlightBug]
 #else
                [NUnit.Framework.Ignore]
@@ -361,7 +361,7 @@ namespace MonoTests.System.ServiceModel.Channels {
                }
 
                [TestMethod]
-#if NET_2_1
+#if MOBILE
                [MoonlightBug]
 #else
                [NUnit.Framework.Ignore]
@@ -453,7 +453,7 @@ namespace MonoTests.System.ServiceModel.Channels {
                }
 
                [TestMethod]
-#if NET_2_1
+#if MOBILE
                [MoonlightBug]
 #else
                [NUnit.Framework.Ignore]
@@ -546,7 +546,7 @@ namespace MonoTests.System.ServiceModel.Channels {
                }
 
                [TestMethod]
-#if NET_2_1
+#if MOBILE
                [MoonlightBug]
 #else
                [NUnit.Framework.Ignore]
@@ -641,7 +641,7 @@ namespace MonoTests.System.ServiceModel.Channels {
                }
 
                [TestMethod]
-#if NET_2_1
+#if MOBILE
                [MoonlightBug]
 #else
                [NUnit.Framework.Ignore]
@@ -733,7 +733,7 @@ namespace MonoTests.System.ServiceModel.Channels {
                }
 
                [TestMethod]
-#if NET_2_1
+#if MOBILE
                [MoonlightBug]
 #else
                [NUnit.Framework.Ignore]
@@ -777,7 +777,7 @@ namespace MonoTests.System.ServiceModel.Channels {
                // ThrowIfDisposed throws an exception if the state is Closing, Closed or Faulted.
 
                [TestMethod]
-#if NET_2_1
+#if MOBILE
                [MoonlightBug]
 #else
                [NUnit.Framework.Ignore]
@@ -843,7 +843,7 @@ namespace MonoTests.System.ServiceModel.Channels {
 
 
                [TestMethod]
-#if NET_2_1
+#if MOBILE
                [MoonlightBug]
 #else
                [NUnit.Framework.Ignore]
@@ -910,7 +910,7 @@ namespace MonoTests.System.ServiceModel.Channels {
                // ThrowIfDisposedOrImmutable throws an exception if the state is not Created.
 
                [TestMethod]
-#if NET_2_1
+#if MOBILE
                [MoonlightBug]
 #else
                [NUnit.Framework.Ignore]
@@ -979,7 +979,7 @@ namespace MonoTests.System.ServiceModel.Channels {
                }
 
                [TestMethod]
-#if NET_2_1
+#if MOBILE
                [MoonlightBug]
 #else
                [NUnit.Framework.Ignore]
@@ -1050,7 +1050,7 @@ namespace MonoTests.System.ServiceModel.Channels {
                // ThrowIfDisposedOrNotOpen throws an exception if the state is not Opened. 
 
                [TestMethod]
-#if NET_2_1
+#if MOBILE
                [MoonlightBug]
 #else
                [NUnit.Framework.Ignore]
@@ -1119,7 +1119,7 @@ namespace MonoTests.System.ServiceModel.Channels {
                }
 
                [TestMethod]
-#if NET_2_1
+#if MOBILE
                [MoonlightBug]
 #else
                [NUnit.Framework.Ignore]
@@ -1196,7 +1196,7 @@ namespace MonoTests.System.ServiceModel.Channels {
                }
 
                [TestMethod]
-#if NET_2_1
+#if MOBILE
                [MoonlightBug]
 #else
                [NUnit.Framework.Ignore]
@@ -1223,7 +1223,7 @@ namespace MonoTests.System.ServiceModel.Channels {
                }
 
                [TestMethod]
-#if NET_2_1
+#if MOBILE
                [MoonlightBug]
 #else
                [NUnit.Framework.Ignore]
@@ -1239,7 +1239,7 @@ namespace MonoTests.System.ServiceModel.Channels {
                }
 
                [TestMethod]
-#if NET_2_1
+#if MOBILE
                [MoonlightBug]
 #else
                [NUnit.Framework.Ignore]
@@ -1267,7 +1267,7 @@ namespace MonoTests.System.ServiceModel.Channels {
                }
 
                [TestMethod]
-#if NET_2_1
+#if MOBILE
                [MoonlightBug]
 #else
                [NUnit.Framework.Ignore]
@@ -1303,7 +1303,7 @@ namespace MonoTests.System.ServiceModel.Channels {
                }
 
                [TestMethod]
-#if NET_2_1
+#if MOBILE
                [MoonlightBug]
 #else
                [NUnit.Framework.Ignore]
index 19560b9315095ec4183d79f33e2af1de49fe1114..2acf8f04b81cbaca4b5eeff56d230438f4853c66 100644 (file)
@@ -34,7 +34,6 @@ using System.ServiceModel.Description;
 using System.Text;
 using NUnit.Framework;
 using NUnit.Framework.Constraints;
-using NUnit.Framework.SyntaxHelpers;
 
 using TextElement = System.ServiceModel.Channels.TextMessageEncodingBindingElement;
 using BinaryElement = System.ServiceModel.Channels.BinaryMessageEncodingBindingElement;
index eae3d7ca74b439878c6a87619bd791926cb0cfcf..5c73c059324be5ac4dc2198f80e65d3454e77a59 100644 (file)
@@ -71,6 +71,7 @@ namespace MonoTests.System.ServiceModel.Channels
     <s:Fault>
       <faultcode>a:ActionNotSupported</faultcode>
       <faultstring xml:lang='en-US'>some error</faultstring>
+      <faultactor>Random</faultactor>
     </s:Fault>
   </s:Body>
 </s:Envelope>";
index 641a95852ee198c0bfd2d652495f9de556f8c91a..f7d30c63c3466ab403f9033814f6cfcc12eaa892 100644 (file)
@@ -105,23 +105,53 @@ namespace MonoTests.System.ServiceModel.Dispatcher
                                        Assert.AreEqual (5, p.ErrorCode, "#2");
                                        Assert.AreEqual ("foobarerror", p.Text, "#3");
                                }
+                       } finally {
+                               host.Close ();
+                       }
+               }
+
+               [Test]
+               public void FaultContractInfos_2 ()
+               {
+                       var host = new ServiceHost (typeof (TestFaultContract));
+                       int port = NetworkHelpers.FindFreePort ();
+                       host.Description.Behaviors.Find<ServiceDebugBehavior> ().IncludeExceptionDetailInFaults = false;
+                       host.AddServiceEndpoint (typeof (ITestFaultContract), new BasicHttpBinding (), new Uri ("http://localhost:" + port));
+                       host.Open ();
+                       try {
+                               var cf = new ChannelFactory<ITestFaultContract> (new BasicHttpBinding (), new EndpointAddress ("http://localhost:" + port));
+                               var cli = cf.CreateChannel ();
 
                                try {
                                        cli.Run ("deriveddata");
                                        Assert.Fail ("#4");
-                               } catch (Exception ex) {
+                               } catch (FaultException ex) {
                                        // The type must be explicitly listed in the [FaultContract],
                                        // it is not allowed to use a subclass of the exception data type.
-                                       Assert.AreEqual (typeof (FaultException), ex.GetType (), "#5");
                                }
+                       } finally {
+                               host.Close ();
+                       }
+               }
 
+               [Test]
+               public void FaultContractInfos_3 ()
+               {
+                       var host = new ServiceHost (typeof (TestFaultContract));
+                       int port = NetworkHelpers.FindFreePort ();
+                       host.Description.Behaviors.Find<ServiceDebugBehavior> ().IncludeExceptionDetailInFaults = false;
+                       host.AddServiceEndpoint (typeof (ITestFaultContract), new BasicHttpBinding (), new Uri ("http://localhost:" + port));
+                       host.Open ();
+                       try {
+                               var cf = new ChannelFactory<ITestFaultContract> (new BasicHttpBinding (), new EndpointAddress ("http://localhost:" + port));
+                               var cli = cf.CreateChannel ();
+                               
                                try {
                                        cli.Run ("derivedexception");
                                        Assert.Fail ("#6");
-                               } catch (Exception ex) {
+                               } catch (FaultException<PrivateAffairError> ex) {
                                        // However, it is allowed to derive from FaultException<T>, provided
                                        // that T is explicitly listed in [FaultContract].  Bug #7177.
-                                       Assert.AreEqual (typeof (FaultException<PrivateAffairError>), ex.GetType (), "#7");
                                }
                        } finally {
                                host.Close ();
index f5b081aeda63022867e832a90b824e1233c4e4d7..ea92e69528ec021e5fffb7903ed05bd982bb561e 100644 (file)
@@ -41,7 +41,6 @@ System.ServiceModel.Security/MessagePartSpecification.cs
 System.ServiceModel.Security/PeerCredential.cs
 System.ServiceModel.Security/ScopedMessagePartSpecification.cs
 System.ServiceModel.Security/SecurityAlgorithmSuite.cs
-System.ServiceModel.Security/SecurityContextKeyIdentifierClause.cs
 System.ServiceModel.Security/SecurityMessageProperty.cs
 System.ServiceModel.Security/SecurityStateEncoder.cs
 System.ServiceModel.Security/SecurityTokenAttachmentMode.cs
index ade3d4333395f267221663d4154f8c734a33f6aa..1efcefe3f864e2966d4b225ad005e934dced8f6e 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,618</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,618</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index fee6147202eec4b96a90408dce6fe7519b55cfc1..11a62dd6529ccb39aaf2717850500d883de7f0a6 100644 (file)
@@ -390,17 +390,17 @@ namespace System.ServiceProcess
                                                        throw new Win32Exception (err);
                                                }
                                        } else {
-                                               int iPtr = buffer.ToInt32 ();
+                                               IntPtr iPtr = buffer;
 
                                                services = new ServiceController [servicesReturned];
                                                for (int i = 0; i < servicesReturned; i++) {
                                                        ENUM_SERVICE_STATUS serviceStatus = (ENUM_SERVICE_STATUS) Marshal.PtrToStructure (
-                                                               new IntPtr (iPtr), typeof (ENUM_SERVICE_STATUS));
+                                                               iPtr, typeof (ENUM_SERVICE_STATUS));
                                                        // TODO: use internal ctor that takes displayname too ?
                                                        services [i] = new ServiceController (serviceStatus.pServiceName,
                                                                machineName);
                                                        // move on to the next services
-                                                       iPtr += ENUM_SERVICE_STATUS.SizeOf;
+                                                       iPtr = IntPtr.Add(iPtr, ENUM_SERVICE_STATUS.SizeOf);
                                                }
 
                                                // we're done, so exit the loop
@@ -611,17 +611,17 @@ namespace System.ServiceProcess
                                                        throw new Win32Exception (err);
                                                }
                                        } else {
-                                               int iPtr = buffer.ToInt32 ();
+                                               IntPtr iPtr = buffer;
 
                                                services = new ServiceController [servicesReturned];
                                                for (int i = 0; i < servicesReturned; i++) {
                                                        ENUM_SERVICE_STATUS_PROCESS serviceStatus = (ENUM_SERVICE_STATUS_PROCESS) Marshal.PtrToStructure (
-                                                               new IntPtr (iPtr), typeof (ENUM_SERVICE_STATUS_PROCESS));
+                                                               iPtr, typeof (ENUM_SERVICE_STATUS_PROCESS));
                                                        // TODO: use internal ctor that takes displayname too
                                                        services [i] = new ServiceController (serviceStatus.pServiceName,
                                                                machineName);
                                                        // move on to the next services
-                                                       iPtr += ENUM_SERVICE_STATUS_PROCESS.SizeOf;
+                                                       iPtr = IntPtr.Add(iPtr, ENUM_SERVICE_STATUS_PROCESS.SizeOf);
                                                }
 
                                                // we're done, so exit the loop
index 6a85bfc9e8d22ac0068c5de552aa2012bbecaf92..23c4a7ed6b86a121e5d3aaf0a8fd216fca5748e0 100644 (file)
@@ -1,3 +1,4 @@
+../../test-helpers/NunitHelpers.cs
 System.ServiceProcess/ServiceBaseTest.cs
 System.ServiceProcess/ServiceControllerTest.cs
 System.ServiceProcess/ServiceControllerPermissionAttributeTest.cs
index 8f5b8f6000b50c1927c8e79c4b36e834fa09ca5b..9f5ae98d470b75b5c838143b69fda659de97fce2 100644 (file)
@@ -31,6 +31,7 @@
 // - Start
 
 using System;
+using System.Collections.Generic;
 using System.ComponentModel;
 using System.ServiceProcess;
 using TimeoutException = System.ServiceProcess.TimeoutException;
@@ -42,6 +43,58 @@ namespace MonoTests.System.ServiceProcess
        [TestFixture]
        public class ServiceControllerTest
        {
+               class ServiceInfo
+               {
+                       public string ServiceName;
+                       public string DisplayName;
+                       public ServiceType ServiceType = ServiceType.Win32ShareProcess;
+                       public string[] Dependents = new string[] {};
+                       public string[] DependedOn = new string[] {};
+               }
+
+               static ServiceInfo DISK_DRIVER_SERVICE = new ServiceInfo { ServiceName = "disk", DisplayName = "Disk Driver", ServiceType = ServiceType.KernelDriver };
+               static ServiceInfo ROUTING_AND_REMOTE_ACCESS_SERVICE = new ServiceInfo { ServiceName = "RemoteAccess", DisplayName = "Routing and Remote Access", DependedOn = new [] { "bfe", "http", "rasman", "rpcss" } };
+               static ServiceInfo SECONDARY_LOGON_SERVICE = new ServiceInfo { ServiceName = "seclogon", DisplayName = "Secondary Logon", Dependents = new [] { "te.service" } };
+               static ServiceInfo SECURITY_ACCOUNTS_MANAGER_SERVICE = new ServiceInfo { ServiceName = "SamSs", DisplayName = "Security Accounts Manager", Dependents = new [] { "browser", "ktmrm", "lanmanserver", "msdtc" }, DependedOn = new [] { "rpcss" } };
+               static ServiceInfo WINDOWS_IMAGE_ACQUISITION_SERVICE = new ServiceInfo { ServiceName = "stisvc", DisplayName = "Windows Image Acquisition (WIA)", ServiceType = ServiceType.Win32OwnProcess, DependedOn = new [] { "rpcss" } };
+               static ServiceInfo WINDOWS_SEARCH_SERVICE = new ServiceInfo { ServiceName = "WSearch", DisplayName = "Windows Search", ServiceType = ServiceType.Win32OwnProcess, Dependents = new [] { "wmpnetworksvc", "workfolderssvc" }, DependedOn = new [] { "rpcss" } };
+               static ServiceInfo WINDOWS_TIME_SERVICE = new ServiceInfo { ServiceName = "W32Time", DisplayName = "Windows Time" };
+               static ServiceInfo WINDOWS_UPDATE_SERVICE = new ServiceInfo { ServiceName = "wuauserv", DisplayName = "Windows Update", DependedOn = new [] { "rpcss" } };
+               static ServiceInfo WORKSTATION_SERVICE = new ServiceInfo { ServiceName = "LanmanWorkstation", DisplayName = "Workstation", Dependents = new [] { "browser", "netlogon", "sessionenv" }, DependedOn = new [] { "bowser", "mrxsmb20", "nsi" } };
+
+               // A service which is expected to be disabled by default on all supported Windows versions.
+               static ServiceInfo DISABLED_SERVICE = ROUTING_AND_REMOTE_ACCESS_SERVICE;
+               // A service which is running by default and can be stopped/paused by the current user when running with admin rights.
+               static ServiceInfo CONTROLLABLE_SERVICE = WINDOWS_IMAGE_ACQUISITION_SERVICE;
+               // A service which cannot be stopped/paused.
+               static ServiceInfo UNCONTROLLABLE_SERVICE = SECURITY_ACCOUNTS_MANAGER_SERVICE;
+               // A service with ServiceType == KernelDriver
+               static ServiceInfo KERNEL_SERVICE = DISK_DRIVER_SERVICE;
+               // A service with ServiceType == Win32ShareProcess.
+               static ServiceInfo SHARE_PROCESS_SERVICE = WORKSTATION_SERVICE;
+
+               static ServiceInfo SERVICE_1_WITH_DEPENDENTS_AND_DEPENDED_ON = SECURITY_ACCOUNTS_MANAGER_SERVICE;
+               static ServiceInfo SERVICE_2_WITH_DEPENDENTS_AND_DEPENDED_ON = WINDOWS_SEARCH_SERVICE;
+               static ServiceInfo SERVICE_3_WITH_DEPENDENTS_AND_DEPENDED_ON = WORKSTATION_SERVICE;
+
+               static ServiceInfo SERVICE_WITH_MANY_DEPENDENTS = WORKSTATION_SERVICE;
+               static ServiceInfo SERVICE_WITH_ONE_DEPENDENT = SECONDARY_LOGON_SERVICE;
+               static ServiceInfo SERVICE_WITH_NO_DEPENDENTS = WINDOWS_TIME_SERVICE;
+
+               static ServiceInfo SERVICE_WITH_MANY_DEPENDED_ON = WORKSTATION_SERVICE;
+               static ServiceInfo SERVICE_WITH_ONE_DEPENDED_ON = WINDOWS_UPDATE_SERVICE;
+               static ServiceInfo SERVICE_WITH_NO_DEPENDED_ON = WINDOWS_TIME_SERVICE;
+
+               [TestFixtureSetUp]
+               public void FixtureSetUp ()
+               {
+                       try {
+                               EnsureServiceIsRunning (new ServiceController (CONTROLLABLE_SERVICE.ServiceName));
+                       } catch {
+                               Assert.Ignore ($"Failed to start the service '{CONTROLLABLE_SERVICE.DisplayName}'. Ensure you are running the tests with admin privileges.");
+                       }
+               }
+
                [Test]
                public void Constructor1 ()
                {
@@ -164,7 +217,7 @@ namespace MonoTests.System.ServiceProcess
                        if (RunningOnUnix)
                                Assert.Ignore ("Running on Unix.");
 
-                       ServiceController sc = new ServiceController ("lanmanworkstation");
+                       ServiceController sc = new ServiceController (CONTROLLABLE_SERVICE.ServiceName);
 
                        Assert.IsTrue (sc.CanPauseAndContinue, "#A1");
                        Assert.IsTrue (sc.CanShutdown, "#B1");
@@ -175,10 +228,10 @@ namespace MonoTests.System.ServiceProcess
 
                        ServiceController [] dependentServices = sc.DependentServices;
                        Assert.IsNotNull (dependentServices, "#D1");
-                       Assert.IsTrue (dependentServices.Length > 1, "#D2");
+                       Assert.AreEqual (CONTROLLABLE_SERVICE.Dependents, ServiceNames (dependentServices), "#D2");
 
                        Assert.IsNotNull (sc.DisplayName, "#E1");
-                       Assert.AreEqual ("Workstation", sc.DisplayName, "#E2");
+                       Assert.AreEqual (CONTROLLABLE_SERVICE.DisplayName, sc.DisplayName, "#E2");
 
                        Assert.IsNotNull (sc.MachineName, "#F1");
                        Assert.AreEqual (".", sc.MachineName, "#F2");
@@ -186,13 +239,13 @@ namespace MonoTests.System.ServiceProcess
                        sc.Refresh ();
 
                        Assert.IsNotNull (sc.ServiceName, "#G1");
-                       Assert.AreEqual ("lanmanworkstation", sc.ServiceName, "#G2");
+                       Assert.AreEqual (CONTROLLABLE_SERVICE.ServiceName, sc.ServiceName, "#G2");
 
                        ServiceController [] servicesDependedOn = sc.ServicesDependedOn;
                        Assert.IsNotNull (servicesDependedOn, "#H1");
-                       Assert.AreEqual (0, servicesDependedOn.Length, "#H2");
+                       Assert.AreEqual (CONTROLLABLE_SERVICE.DependedOn, ServiceNames (servicesDependedOn), "#H2");
 
-                       Assert.AreEqual (ServiceType.Win32ShareProcess, sc.ServiceType, "#I1");
+                       Assert.AreEqual (CONTROLLABLE_SERVICE.ServiceType, sc.ServiceType, "#I1");
                        Assert.AreEqual (ServiceControllerStatus.Running, sc.Status, "#J1");
                }
 
@@ -219,7 +272,7 @@ namespace MonoTests.System.ServiceProcess
                        if (RunningOnUnix)
                                Assert.Ignore ("Running on Unix.");
 
-                       ServiceController sc = new ServiceController ("workstation");
+                       ServiceController sc = new ServiceController (CONTROLLABLE_SERVICE.DisplayName);
 
                        Assert.IsTrue (sc.CanPauseAndContinue, "#A1");
                        Assert.IsTrue (sc.CanShutdown, "#B1");
@@ -249,7 +302,7 @@ namespace MonoTests.System.ServiceProcess
                        if (RunningOnUnix)
                                Assert.Ignore ("Running on Unix.");
 
-                       ServiceController sc = new ServiceController ("lanmanworkstation");
+                       ServiceController sc = new ServiceController (CONTROLLABLE_SERVICE.ServiceName);
 
                        Assert.IsTrue (sc.CanPauseAndContinue, "#A1");
                        Assert.IsTrue (sc.CanShutdown, "#B1");
@@ -262,7 +315,7 @@ namespace MonoTests.System.ServiceProcess
                        if (RunningOnUnix)
                                Assert.Ignore ("Running on Unix.");
 
-                       ServiceController sc = new ServiceController ("lanmanworkstation",
+                       ServiceController sc = new ServiceController (CONTROLLABLE_SERVICE.ServiceName,
                                Environment.MachineName);
 
                        Assert.IsTrue (sc.CanPauseAndContinue, "#A1");
@@ -274,10 +327,10 @@ namespace MonoTests.System.ServiceProcess
 
                        ServiceController [] dependentServices = sc.DependentServices;
                        Assert.IsNotNull (dependentServices, "#D1");
-                       Assert.IsTrue (dependentServices.Length > 1, "#D2");
+                       Assert.AreEqual (CONTROLLABLE_SERVICE.Dependents, ServiceNames (dependentServices), "#D2");
 
                        Assert.IsNotNull (sc.DisplayName, "#E1");
-                       Assert.AreEqual ("Workstation", sc.DisplayName, "#E2");
+                       Assert.AreEqual (CONTROLLABLE_SERVICE.DisplayName, sc.DisplayName, "#E2");
 
                        Assert.IsNotNull (sc.MachineName, "#F1");
                        Assert.AreEqual (Environment.MachineName, sc.MachineName, "#F2");
@@ -285,13 +338,13 @@ namespace MonoTests.System.ServiceProcess
                        sc.Refresh ();
 
                        Assert.IsNotNull (sc.ServiceName, "#G1");
-                       Assert.AreEqual ("lanmanworkstation", sc.ServiceName, "#G2");
+                       Assert.AreEqual (CONTROLLABLE_SERVICE.ServiceName, sc.ServiceName, "#G2");
 
                        ServiceController [] servicesDependedOn = sc.ServicesDependedOn;
                        Assert.IsNotNull (servicesDependedOn, "#H1");
-                       Assert.AreEqual (0, servicesDependedOn.Length, "#H2");
+                       Assert.AreEqual (CONTROLLABLE_SERVICE.DependedOn, ServiceNames (servicesDependedOn), "#H2");
 
-                       Assert.AreEqual (ServiceType.Win32ShareProcess, sc.ServiceType, "#I1");
+                       Assert.AreEqual (CONTROLLABLE_SERVICE.ServiceType, sc.ServiceType, "#I1");
                        Assert.AreEqual (ServiceControllerStatus.Running, sc.Status, "#J1");
                }
 
@@ -299,7 +352,7 @@ namespace MonoTests.System.ServiceProcess
                public void Constructor3_MachineName_Empty ()
                {
                        try {
-                               new ServiceController ("alerter", string.Empty);
+                               new ServiceController (CONTROLLABLE_SERVICE.ServiceName, string.Empty);
                                Assert.Fail ("#1");
                        } catch (ArgumentException ex) {
                                // MachineName value  is invalid
@@ -316,7 +369,7 @@ namespace MonoTests.System.ServiceProcess
                public void Constructor3_MachineName_Null ()
                {
                        try {
-                               new ServiceController ("alerter", null);
+                               new ServiceController (CONTROLLABLE_SERVICE.ServiceName, null);
                                Assert.Fail ("#1");
                        } catch (ArgumentException ex) {
                                // MachineName value  is invalid
@@ -369,11 +422,11 @@ namespace MonoTests.System.ServiceProcess
                        if (RunningOnUnix)
                                Assert.Ignore ("Running on Unix.");
 
-                       ServiceController sc = new ServiceController ("Schedule", ".");
+                       ServiceController sc = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
                        Assert.IsTrue (sc.CanPauseAndContinue, "#1");
-                       sc.ServiceName = "SamSs";
+                       sc.ServiceName = UNCONTROLLABLE_SERVICE.ServiceName;
                        Assert.IsFalse (sc.CanPauseAndContinue, "#2");
-                       sc.DisplayName = "Workstation";
+                       sc.DisplayName = CONTROLLABLE_SERVICE.DisplayName;
                        Assert.IsTrue (sc.CanPauseAndContinue, "#3");
                        sc.MachineName = "doesnotexist";
                        try {
@@ -403,7 +456,7 @@ namespace MonoTests.System.ServiceProcess
                        if (RunningOnUnix)
                                Assert.Ignore ("Running on Unix.");
 
-                       ServiceController sc = new ServiceController ("Schedule",
+                       ServiceController sc = new ServiceController (CONTROLLABLE_SERVICE.ServiceName,
                                "doesnotexist");
                        try {
                                bool canPauseAndContinue = sc.CanPauseAndContinue;
@@ -432,7 +485,7 @@ namespace MonoTests.System.ServiceProcess
                        if (RunningOnUnix)
                                Assert.Ignore ("Running on Unix.");
 
-                       ServiceController sc1 = new ServiceController ("NetDDE", ".");
+                       ServiceController sc1 = new ServiceController (DISABLED_SERVICE.ServiceName, ".");
                        Assert.IsFalse (sc1.CanPauseAndContinue);
                }
 
@@ -470,7 +523,7 @@ namespace MonoTests.System.ServiceProcess
                        if (RunningOnUnix)
                                Assert.Ignore ("Running on Unix.");
 
-                       ServiceController sc1 = new ServiceController ("SamSs", ".");
+                       ServiceController sc1 = new ServiceController (UNCONTROLLABLE_SERVICE.ServiceName, ".");
                        Assert.IsFalse (sc1.CanPauseAndContinue);
                }
 
@@ -480,7 +533,7 @@ namespace MonoTests.System.ServiceProcess
                        if (RunningOnUnix)
                                Assert.Ignore ("Running on Unix.");
 
-                       ServiceController sc = new ServiceController ("Schedule", ".");
+                       ServiceController sc = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
                        Assert.AreEqual (ServiceControllerStatus.Running, sc.Status, "#1");
                        Assert.IsTrue (sc.CanPauseAndContinue, "#2");
                }
@@ -491,8 +544,8 @@ namespace MonoTests.System.ServiceProcess
                        if (RunningOnUnix)
                                Assert.Ignore ("Running on Unix.");
 
-                       ServiceController sc1 = new ServiceController ("Schedule", ".");
-                       ServiceController sc2 = new ServiceController ("Schedule", ".");
+                       ServiceController sc1 = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
+                       ServiceController sc2 = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
 
                        Assert.AreEqual (ServiceControllerStatus.Running, sc1.Status, "#A1");
                        Assert.AreEqual (ServiceControllerStatus.Running, sc2.Status, "#A2");
@@ -528,8 +581,8 @@ namespace MonoTests.System.ServiceProcess
                        if (RunningOnUnix)
                                Assert.Ignore ("Running on Unix.");
 
-                       ServiceController sc1 = new ServiceController ("Schedule", ".");
-                       ServiceController sc2 = new ServiceController ("Schedule", ".");
+                       ServiceController sc1 = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
+                       ServiceController sc2 = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
 
                        Assert.AreEqual (ServiceControllerStatus.Running, sc1.Status, "#A1");
                        Assert.AreEqual (ServiceControllerStatus.Running, sc2.Status, "#A2");
@@ -584,11 +637,11 @@ namespace MonoTests.System.ServiceProcess
                        if (RunningOnUnix)
                                Assert.Ignore ("Running on Unix.");
 
-                       ServiceController sc = new ServiceController ("Schedule", ".");
+                       ServiceController sc = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
                        Assert.IsTrue (sc.CanShutdown, "#1");
-                       sc.ServiceName = "SamSs";
+                       sc.ServiceName = UNCONTROLLABLE_SERVICE.ServiceName;
                        Assert.IsFalse (sc.CanShutdown, "#2");
-                       sc.DisplayName = "Workstation";
+                       sc.DisplayName = CONTROLLABLE_SERVICE.DisplayName;
                        Assert.IsTrue (sc.CanShutdown, "#3");
                        sc.MachineName = "doesnotexist";
                        try {
@@ -618,7 +671,7 @@ namespace MonoTests.System.ServiceProcess
                        if (RunningOnUnix)
                                Assert.Ignore ("Running on Unix.");
 
-                       ServiceController sc = new ServiceController ("Schedule",
+                       ServiceController sc = new ServiceController (CONTROLLABLE_SERVICE.ServiceName,
                                "doesnotexist");
                        try {
                                bool canShutdown = sc.CanShutdown;
@@ -647,7 +700,7 @@ namespace MonoTests.System.ServiceProcess
                        if (RunningOnUnix)
                                Assert.Ignore ("Running on Unix.");
 
-                       ServiceController sc1 = new ServiceController ("NetDDE", ".");
+                       ServiceController sc1 = new ServiceController (DISABLED_SERVICE.ServiceName, ".");
                        Assert.IsFalse (sc1.CanShutdown);
                }
 
@@ -685,7 +738,7 @@ namespace MonoTests.System.ServiceProcess
                        if (RunningOnUnix)
                                Assert.Ignore ("Running on Unix.");
 
-                       ServiceController sc1 = new ServiceController ("SamSs", ".");
+                       ServiceController sc1 = new ServiceController (UNCONTROLLABLE_SERVICE.ServiceName, ".");
                        Assert.IsFalse (sc1.CanShutdown);
                }
 
@@ -695,7 +748,7 @@ namespace MonoTests.System.ServiceProcess
                        if (RunningOnUnix)
                                Assert.Ignore ("Running on Unix.");
 
-                       ServiceController sc = new ServiceController ("Schedule", ".");
+                       ServiceController sc = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
                        Assert.AreEqual (ServiceControllerStatus.Running, sc.Status, "#1");
                        Assert.IsTrue (sc.CanShutdown, "#2");
                }
@@ -706,8 +759,8 @@ namespace MonoTests.System.ServiceProcess
                        if (RunningOnUnix)
                                Assert.Ignore ("Running on Unix.");
 
-                       ServiceController sc1 = new ServiceController ("Schedule", ".");
-                       ServiceController sc2 = new ServiceController ("Schedule", ".");
+                       ServiceController sc1 = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
+                       ServiceController sc2 = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
 
                        Assert.AreEqual (ServiceControllerStatus.Running, sc1.Status, "#A1");
                        Assert.AreEqual (ServiceControllerStatus.Running, sc2.Status, "#A2");
@@ -743,8 +796,8 @@ namespace MonoTests.System.ServiceProcess
                        if (RunningOnUnix)
                                Assert.Ignore ("Running on Unix.");
 
-                       ServiceController sc1 = new ServiceController ("Schedule", ".");
-                       ServiceController sc2 = new ServiceController ("Schedule", ".");
+                       ServiceController sc1 = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
+                       ServiceController sc2 = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
 
                        Assert.AreEqual (ServiceControllerStatus.Running, sc1.Status, "#A1");
                        Assert.AreEqual (ServiceControllerStatus.Running, sc2.Status, "#A2");
@@ -799,11 +852,11 @@ namespace MonoTests.System.ServiceProcess
                        if (RunningOnUnix)
                                Assert.Ignore ("Running on Unix.");
 
-                       ServiceController sc = new ServiceController ("Schedule", ".");
+                       ServiceController sc = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
                        Assert.IsTrue (sc.CanStop, "#1");
-                       sc.ServiceName = "SamSs";
+                       sc.ServiceName = UNCONTROLLABLE_SERVICE.ServiceName;
                        Assert.IsFalse (sc.CanStop, "#2");
-                       sc.DisplayName = "Workstation";
+                       sc.DisplayName = CONTROLLABLE_SERVICE.DisplayName;
                        Assert.IsTrue (sc.CanStop, "#3");
                        sc.MachineName = "doesnotexist";
                        try {
@@ -833,7 +886,7 @@ namespace MonoTests.System.ServiceProcess
                        if (RunningOnUnix)
                                Assert.Ignore ("Running on Unix.");
 
-                       ServiceController sc = new ServiceController ("Schedule",
+                       ServiceController sc = new ServiceController (CONTROLLABLE_SERVICE.ServiceName,
                                "doesnotexist");
                        try {
                                bool canStop = sc.CanStop;
@@ -862,7 +915,7 @@ namespace MonoTests.System.ServiceProcess
                        if (RunningOnUnix)
                                Assert.Ignore ("Running on Unix.");
 
-                       ServiceController sc1 = new ServiceController ("NetDDE", ".");
+                       ServiceController sc1 = new ServiceController (DISABLED_SERVICE.ServiceName, ".");
                        Assert.IsFalse (sc1.CanStop);
                }
 
@@ -900,7 +953,7 @@ namespace MonoTests.System.ServiceProcess
                        if (RunningOnUnix)
                                Assert.Ignore ("Running on Unix.");
 
-                       ServiceController sc1 = new ServiceController ("SamSs", ".");
+                       ServiceController sc1 = new ServiceController (UNCONTROLLABLE_SERVICE.ServiceName, ".");
                        Assert.IsFalse (sc1.CanStop);
                }
 
@@ -910,7 +963,7 @@ namespace MonoTests.System.ServiceProcess
                        if (RunningOnUnix)
                                Assert.Ignore ("Running on Unix.");
 
-                       ServiceController sc = new ServiceController ("Schedule", ".");
+                       ServiceController sc = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
                        Assert.AreEqual (ServiceControllerStatus.Running, sc.Status, "#1");
                        Assert.IsTrue (sc.CanStop, "#2");
                }
@@ -921,8 +974,8 @@ namespace MonoTests.System.ServiceProcess
                        if (RunningOnUnix)
                                Assert.Ignore ("Running on Unix.");
 
-                       ServiceController sc1 = new ServiceController ("Schedule", ".");
-                       ServiceController sc2 = new ServiceController ("Schedule", ".");
+                       ServiceController sc1 = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
+                       ServiceController sc2 = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
 
                        Assert.AreEqual (ServiceControllerStatus.Running, sc1.Status, "#A1");
                        Assert.AreEqual (ServiceControllerStatus.Running, sc2.Status, "#A2");
@@ -958,8 +1011,8 @@ namespace MonoTests.System.ServiceProcess
                        if (RunningOnUnix)
                                Assert.Ignore ("Running on Unix.");
 
-                       ServiceController sc1 = new ServiceController ("Schedule", ".");
-                       ServiceController sc2 = new ServiceController ("Schedule", ".");
+                       ServiceController sc1 = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
+                       ServiceController sc2 = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
 
                        Assert.AreEqual (ServiceControllerStatus.Running, sc1.Status, "#A1");
                        Assert.AreEqual (ServiceControllerStatus.Running, sc2.Status, "#A2");
@@ -1014,8 +1067,8 @@ namespace MonoTests.System.ServiceProcess
                        if (RunningOnUnix)
                                Assert.Ignore ("Running on Unix.");
 
-                       ServiceController sc1 = new ServiceController ("Schedule", ".");
-                       ServiceController sc2 = new ServiceController ("Schedule", ".");
+                       ServiceController sc1 = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
+                       ServiceController sc2 = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
 
                        Assert.AreEqual (ServiceControllerStatus.Running, sc1.Status, "#A1");
                        Assert.AreEqual (ServiceControllerStatus.Running, sc2.Status, "#A2");
@@ -1052,7 +1105,7 @@ namespace MonoTests.System.ServiceProcess
                        if (RunningOnUnix)
                                Assert.Ignore ("Running on Unix.");
 
-                       ServiceController sc = new ServiceController ("Schedule",
+                       ServiceController sc = new ServiceController (CONTROLLABLE_SERVICE.ServiceName,
                                "doesnotexist");
                        try {
                                sc.Continue ();
@@ -1081,8 +1134,8 @@ namespace MonoTests.System.ServiceProcess
                        if (RunningOnUnix)
                                Assert.Ignore ("Running on Unix.");
 
-                       ServiceController sc1 = new ServiceController ("NetDDE", ".");
-                       ServiceController sc2 = new ServiceController ("NetDDE", ".");
+                       ServiceController sc1 = new ServiceController (DISABLED_SERVICE.ServiceName, ".");
+                       ServiceController sc2 = new ServiceController (DISABLED_SERVICE.ServiceName, ".");
 
                        Assert.AreEqual (ServiceControllerStatus.Stopped, sc1.Status, "#A1");
                        Assert.AreEqual (ServiceControllerStatus.Stopped, sc2.Status, "#A2");
@@ -1094,7 +1147,7 @@ namespace MonoTests.System.ServiceProcess
                                // Cannot resume NetDDE service on computer '.'
                                Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#B2");
                                Assert.IsNotNull (ex.Message, "#B3");
-                               Assert.IsTrue (ex.Message.IndexOf ("NetDDE") != -1, "#B4");
+                               Assert.IsTrue (ex.Message.IndexOf (DISABLED_SERVICE.ServiceName) != -1, "#B4");
                                Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#B5");
                                Assert.IsNotNull (ex.InnerException, "#B6");
 
@@ -1145,8 +1198,8 @@ namespace MonoTests.System.ServiceProcess
                        if (RunningOnUnix)
                                Assert.Ignore ("Running on Unix.");
 
-                       ServiceController sc1 = new ServiceController ("SamSs", ".");
-                       ServiceController sc2 = new ServiceController ("SamSs", ".");
+                       ServiceController sc1 = new ServiceController (UNCONTROLLABLE_SERVICE.ServiceName, ".");
+                       ServiceController sc2 = new ServiceController (UNCONTROLLABLE_SERVICE.ServiceName, ".");
 
                        Assert.AreEqual (ServiceControllerStatus.Running, sc1.Status, "#A1");
                        Assert.AreEqual (ServiceControllerStatus.Running, sc2.Status, "#A2");
@@ -1155,10 +1208,10 @@ namespace MonoTests.System.ServiceProcess
                                sc1.Continue ();
                                Assert.Fail ("#B1");
                        } catch (InvalidOperationException ex) {
-                               // Cannot resume SamSs service on computer '.'
+                               // Cannot resume service on computer '.'
                                Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#B2");
                                Assert.IsNotNull (ex.Message, "#B3");
-                               Assert.IsTrue (ex.Message.IndexOf ("SamSs") != -1, "#B4");
+                               Assert.IsTrue (ex.Message.IndexOf (UNCONTROLLABLE_SERVICE.ServiceName) != -1, "#B4");
                                Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#B5");
                                Assert.IsNotNull (ex.InnerException, "#B6");
 
@@ -1181,8 +1234,8 @@ namespace MonoTests.System.ServiceProcess
                        if (RunningOnUnix)
                                Assert.Ignore ("Running on Unix.");
 
-                       ServiceController sc1 = new ServiceController ("Schedule", ".");
-                       ServiceController sc2 = new ServiceController ("Schedule", ".");
+                       ServiceController sc1 = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
+                       ServiceController sc2 = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
 
                        Assert.AreEqual (ServiceControllerStatus.Running, sc1.Status, "#A1");
                        Assert.AreEqual (ServiceControllerStatus.Running, sc2.Status, "#A2");
@@ -1199,8 +1252,8 @@ namespace MonoTests.System.ServiceProcess
                        if (RunningOnUnix)
                                Assert.Ignore ("Running on Unix.");
 
-                       ServiceController sc1 = new ServiceController ("Schedule", ".");
-                       ServiceController sc2 = new ServiceController ("Schedule", ".");
+                       ServiceController sc1 = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
+                       ServiceController sc2 = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
 
                        Assert.AreEqual (ServiceControllerStatus.Running, sc1.Status, "#A1");
                        Assert.AreEqual (ServiceControllerStatus.Running, sc2.Status, "#A2");
@@ -1219,10 +1272,10 @@ namespace MonoTests.System.ServiceProcess
                                sc1.Continue ();
                                Assert.Fail ("#D1");
                        } catch (InvalidOperationException ex) {
-                               // Cannot resume Schedule service on computer '.'
+                               // Cannot resume the service on computer '.'
                                Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#D2");
                                Assert.IsNotNull (ex.Message, "#D3");
-                               Assert.IsTrue (ex.Message.IndexOf ("Schedule") != -1, "#D4");
+                               Assert.IsTrue (ex.Message.IndexOf (CONTROLLABLE_SERVICE.ServiceName) != -1, "#D4");
                                Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#D5");
                                Assert.IsNotNull (ex.InnerException, "#D6");
 
@@ -1271,52 +1324,52 @@ namespace MonoTests.System.ServiceProcess
                        ServiceController [] dependentServices = null;
 
                        // single dependent service
-                       sc = new ServiceController ("dmserver", ".");
+                       sc = new ServiceController (SERVICE_WITH_ONE_DEPENDENT.ServiceName, ".");
                        dependentServices = sc.DependentServices;
                        Assert.IsNotNull (dependentServices, "#A1");
                        Assert.AreEqual (1, dependentServices.Length, "#A2");
-                       Assert.AreEqual ("dmadmin", dependentServices [0].ServiceName, "#A3");
+                       Assert.AreEqual (SERVICE_WITH_ONE_DEPENDENT.Dependents, ServiceNames (dependentServices), "#A3");
 
                        // modifying ServiceName does not cause cache to be cleared:
                        // https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=201762
-                       sc.ServiceName = "alerter";
+                       sc.ServiceName = SERVICE_WITH_NO_DEPENDENTS.ServiceName;
                        dependentServices = sc.DependentServices;
                        Assert.IsNotNull (dependentServices, "#B1");
                        Assert.AreEqual (1, dependentServices.Length, "#B2");
-                       Assert.AreEqual ("dmadmin", dependentServices [0].ServiceName, "#B3");
+                       Assert.AreEqual (SERVICE_WITH_ONE_DEPENDENT.Dependents, ServiceNames (dependentServices), "#B3");
 
                        // modifying DisplayName does not cause cache to be cleared:
                        // https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=201762
-                       sc.DisplayName = "Spooler";
+                       sc.DisplayName = SERVICE_WITH_MANY_DEPENDENTS.DisplayName;
                        dependentServices = sc.DependentServices;
                        Assert.IsNotNull (dependentServices, "#C1");
                        Assert.AreEqual (1, dependentServices.Length, "#C2");
-                       Assert.AreEqual ("dmadmin", dependentServices [0].ServiceName, "#C3");
+                       Assert.AreEqual (SERVICE_WITH_ONE_DEPENDENT.Dependents, ServiceNames (dependentServices), "#C3");
 
                        // modifying MachineName does not cause cache to be cleared:
                        // https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=201762
                        sc.MachineName = "doesnotexist";
                        dependentServices = sc.DependentServices;
                        Assert.IsNotNull (dependentServices, "#D1");
-                       Assert.AreEqual (1, dependentServices.Length, "#D2");
-                       Assert.AreEqual ("dmadmin", dependentServices [0].ServiceName, "#D3");
+                       Assert.AreEqual (1, dependentServices.Length, "#D");
+                       Assert.AreEqual (SERVICE_WITH_ONE_DEPENDENT.Dependents, ServiceNames (dependentServices), "#D3");
 
                        // no dependent services
-                       sc = new ServiceController ("alerter", ".");
+                       sc = new ServiceController (SERVICE_WITH_NO_DEPENDENTS.ServiceName, ".");
                        dependentServices = sc.DependentServices;
                        Assert.IsNotNull (dependentServices, "#E1");
                        Assert.AreEqual (0, dependentServices.Length, "#E2");
 
                        // modifying ServiceName does not cause cache to be cleared:
                        // https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=201762
-                       sc.ServiceName = "dmserver";
+                       sc.ServiceName = SERVICE_WITH_MANY_DEPENDENTS.ServiceName;
                        dependentServices = sc.DependentServices;
                        Assert.IsNotNull (dependentServices, "#F1");
                        Assert.AreEqual (0, dependentServices.Length, "#F2");
 
                        // modifying DisplayName does not cause cache to be cleared:
                        // https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=201762
-                       sc.DisplayName = "Workstation";
+                       sc.DisplayName = SERVICE_WITH_ONE_DEPENDENT.DisplayName;
                        dependentServices = sc.DependentServices;
                        Assert.IsNotNull (dependentServices, "#G1");
                        Assert.AreEqual (0, dependentServices.Length, "#G2");
@@ -1329,39 +1382,35 @@ namespace MonoTests.System.ServiceProcess
                        Assert.AreEqual (0, dependentServices.Length, "#H2");
 
                        // multiple dependent services
-                       sc = new ServiceController ("TapiSrv", ".");
+                       sc = new ServiceController (SERVICE_WITH_MANY_DEPENDENTS.ServiceName, ".");
                        dependentServices = sc.DependentServices;
                        Assert.IsNotNull (dependentServices, "#I1");
-                       Assert.AreEqual (2, dependentServices.Length, "#I2");
-                       Assert.AreEqual ("RasAuto", dependentServices [0].ServiceName, "#I3");
-                       Assert.AreEqual ("RasMan", dependentServices [1].ServiceName, "#I4");
+                       Assert.AreEqual (SERVICE_WITH_MANY_DEPENDENTS.Dependents.Length, dependentServices.Length, "#I2");
+                       Assert.AreEqual (SERVICE_WITH_MANY_DEPENDENTS.Dependents, ServiceNames (dependentServices), "#I3");
 
                        // modifying ServiceName does not cause cache to be cleared:
                        // https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=201762
-                       sc.ServiceName = "spooler";
+                       sc.ServiceName = SERVICE_WITH_NO_DEPENDENTS.ServiceName;
                        dependentServices = sc.DependentServices;
                        Assert.IsNotNull (dependentServices, "#J1");
-                       Assert.AreEqual (2, dependentServices.Length, "#J3");
-                       Assert.AreEqual ("RasAuto", dependentServices [0].ServiceName, "#J4");
-                       Assert.AreEqual ("RasMan", dependentServices [1].ServiceName, "#J5");
+                       Assert.AreEqual (SERVICE_WITH_MANY_DEPENDENTS.Dependents.Length, dependentServices.Length, "#J3");
+                       Assert.AreEqual (SERVICE_WITH_MANY_DEPENDENTS.Dependents, ServiceNames (dependentServices), "#J3");
 
                        // modifying DisplayName does not cause cache to be cleared:
                        // https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=201762
-                       sc.DisplayName = "Alerter";
+                       sc.DisplayName = SERVICE_WITH_ONE_DEPENDENT.DisplayName;
                        dependentServices = sc.DependentServices;
                        Assert.IsNotNull (dependentServices, "#K1");
-                       Assert.AreEqual (2, dependentServices.Length, "#K2");
-                       Assert.AreEqual ("RasAuto", dependentServices [0].ServiceName, "#K3");
-                       Assert.AreEqual ("RasMan", dependentServices [1].ServiceName, "#K4");
+                       Assert.AreEqual (SERVICE_WITH_MANY_DEPENDENTS.Dependents.Length, dependentServices.Length, "#K2");
+                       Assert.AreEqual (SERVICE_WITH_MANY_DEPENDENTS.Dependents, ServiceNames (dependentServices), "#K3");
 
                        // modifying MachineName does not cause cache to be cleared:
                        // https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=201762
                        sc.MachineName = Environment.MachineName;
                        dependentServices = sc.DependentServices;
                        Assert.IsNotNull (dependentServices, "#L1");
-                       Assert.AreEqual (2, dependentServices.Length, "#L2");
-                       Assert.AreEqual ("RasAuto", dependentServices [0].ServiceName, "#L3");
-                       Assert.AreEqual ("RasMan", dependentServices [1].ServiceName, "#L4");
+                       Assert.AreEqual (SERVICE_WITH_MANY_DEPENDENTS.Dependents.Length, dependentServices.Length, "#L2");
+                       Assert.AreEqual (SERVICE_WITH_MANY_DEPENDENTS.Dependents, ServiceNames (dependentServices), "#L3");
                }
 
                [Test]
@@ -1370,7 +1419,7 @@ namespace MonoTests.System.ServiceProcess
                        if (RunningOnUnix)
                                Assert.Ignore ("Running on Unix.");
 
-                       ServiceController sc = new ServiceController ("dmserver",
+                       ServiceController sc = new ServiceController (CONTROLLABLE_SERVICE.ServiceName,
                                "doesnotexist");
                        try {
                                ServiceController [] dependenServices = sc.DependentServices;
@@ -1399,11 +1448,10 @@ namespace MonoTests.System.ServiceProcess
                        if (RunningOnUnix)
                                Assert.Ignore ("Running on Unix.");
 
-                       ServiceController sc = new ServiceController ("NetDDE", ".");
+                       ServiceController sc = new ServiceController (DISABLED_SERVICE.ServiceName, ".");
                        ServiceController [] dependentServices = sc.DependentServices;
                        Assert.IsNotNull (dependentServices, "#1");
-                       Assert.AreEqual (1, dependentServices.Length, "#2");
-                       Assert.AreEqual ("ClipSrv", dependentServices [0].ServiceName, "#3");
+                       Assert.AreEqual (DISABLED_SERVICE.Dependents, ServiceNames (dependentServices), "#2");
                }
 
                [Test]
@@ -1459,36 +1507,39 @@ namespace MonoTests.System.ServiceProcess
                        if (RunningOnUnix)
                                Assert.Ignore ("Running on Unix.");
 
+                       var s1 = WORKSTATION_SERVICE;
+                       var s2 = WINDOWS_SEARCH_SERVICE;
+
                        ServiceController sc = new ServiceController ();
-                       sc.DisplayName = "workstation";
-                       Assert.AreEqual ("workstation", sc.DisplayName, "#A1");
-                       Assert.AreEqual ("lanmanworkstation", sc.ServiceName, "#A2");
+                       sc.DisplayName = s1.DisplayName.ToLower ();
+                       Assert.AreEqual (s1.DisplayName.ToLower (), sc.DisplayName, "#A1");
+                       Assert.AreEqual (s1.ServiceName, sc.ServiceName, "#A2");
 
-                       sc.DisplayName = "alerter";
-                       Assert.AreEqual ("alerter", sc.DisplayName, "#B1");
-                       Assert.AreEqual ("Alerter", sc.ServiceName, "#B2");
+                       sc.DisplayName = s2.DisplayName.ToLower ();
+                       Assert.AreEqual (s2.DisplayName.ToLower (), sc.DisplayName, "#B1");
+                       Assert.AreEqual (s2.ServiceName, sc.ServiceName, "#B2");
 
-                       sc = new ServiceController ("workstation");
-                       sc.DisplayName = "alerter";
-                       Assert.AreEqual ("alerter", sc.DisplayName, "#C1");
-                       Assert.AreEqual ("lanmanworkstation", sc.ServiceName, "#C2");
-                       Assert.AreEqual ("workstation", sc.DisplayName, "#C3");
+                       sc = new ServiceController (s1.DisplayName.ToLower ());
+                       sc.DisplayName = s2.DisplayName.ToLower ();
+                       Assert.AreEqual (s2.DisplayName.ToLower (), sc.DisplayName, "#C1");
+                       Assert.AreEqual (s1.ServiceName, sc.ServiceName, "#C2");
+                       Assert.AreEqual (s1.DisplayName.ToLower (), sc.DisplayName, "#C3");
 
-                       sc.DisplayName = "alerter";
-                       Assert.AreEqual ("alerter", sc.DisplayName, "#D1");
-                       Assert.AreEqual ("Alerter", sc.ServiceName, "#D2");
+                       sc.DisplayName = s2.DisplayName.ToLower ();
+                       Assert.AreEqual (s2.DisplayName.ToLower (), sc.DisplayName, "#D1");
+                       Assert.AreEqual (s2.ServiceName, sc.ServiceName, "#D2");
 
-                       sc.DisplayName = "workstation";
-                       Assert.AreEqual ("workstation", sc.DisplayName, "#E1");
-                       Assert.AreEqual ("lanmanworkstation", sc.ServiceName, "#E2");
+                       sc.DisplayName = s1.DisplayName;
+                       Assert.AreEqual (s1.DisplayName, sc.DisplayName, "#E1");
+                       Assert.AreEqual (s1.ServiceName, sc.ServiceName, "#E2");
 
-                       sc = new ServiceController ("workstation");
-                       Assert.AreEqual ("workstation", sc.DisplayName, "#F1");
-                       Assert.AreEqual ("lanmanworkstation", sc.ServiceName, "#F2");
+                       sc = new ServiceController (s1.DisplayName.ToLower ());
+                       Assert.AreEqual (s1.DisplayName.ToLower (), sc.DisplayName, "#F1");
+                       Assert.AreEqual (s1.ServiceName, sc.ServiceName, "#F2");
 
-                       sc.DisplayName = "Workstation";
-                       Assert.AreEqual ("Workstation", sc.DisplayName, "#G1");
-                       Assert.AreEqual ("lanmanworkstation", sc.ServiceName, "#G2");
+                       sc.DisplayName = s1.DisplayName;
+                       Assert.AreEqual (s1.DisplayName, sc.DisplayName, "#G1");
+                       Assert.AreEqual (s1.ServiceName, sc.ServiceName, "#G2");
                }
 
                [Test]
@@ -1497,7 +1548,7 @@ namespace MonoTests.System.ServiceProcess
                        if (RunningOnUnix)
                                Assert.Ignore ("Running on Unix.");
 
-                       ServiceController sc = new ServiceController ("dmserver",
+                       ServiceController sc = new ServiceController (CONTROLLABLE_SERVICE.ServiceName,
                                "doesnotexist");
                        try {
                                string displayName = sc.DisplayName;
@@ -1526,8 +1577,8 @@ namespace MonoTests.System.ServiceProcess
                        if (RunningOnUnix)
                                Assert.Ignore ("Running on Unix.");
 
-                       ServiceController sc = new ServiceController ("NetDDE", ".");
-                       Assert.AreEqual ("Network DDE", sc.DisplayName);
+                       ServiceController sc = new ServiceController (DISABLED_SERVICE.ServiceName, ".");
+                       Assert.AreEqual (DISABLED_SERVICE.DisplayName, sc.DisplayName);
                }
 
                [Test]
@@ -1565,9 +1616,9 @@ namespace MonoTests.System.ServiceProcess
                                Assert.Ignore ("Running on Unix.");
 
                        ServiceController sc = new ServiceController ();
-                       sc.DisplayName = "workstation";
-                       Assert.AreEqual ("workstation", sc.DisplayName, "#A1");
-                       Assert.AreEqual ("lanmanworkstation", sc.ServiceName, "#A2");
+                       sc.DisplayName = WORKSTATION_SERVICE.DisplayName.ToLower ();
+                       Assert.AreEqual (WORKSTATION_SERVICE.DisplayName.ToLower (), sc.DisplayName, "#A1");
+                       Assert.AreEqual (WORKSTATION_SERVICE.ServiceName, sc.ServiceName, "#A2");
                }
 
                [Test]
@@ -1611,10 +1662,10 @@ namespace MonoTests.System.ServiceProcess
                        Assert.AreEqual (string.Empty, sc.DisplayName, "#A1");
                        Assert.AreEqual (string.Empty, sc.ServiceName, "#A2");
 
-                       sc.DisplayName = "WorkStation";
+                       sc.DisplayName = WORKSTATION_SERVICE.DisplayName;
 
-                       Assert.AreEqual ("WorkStation", sc.DisplayName, "#B1");
-                       Assert.AreEqual ("lanmanworkstation", sc.ServiceName, "#B2");
+                       Assert.AreEqual (WORKSTATION_SERVICE.DisplayName, sc.DisplayName, "#B1");
+                       Assert.AreEqual (WORKSTATION_SERVICE.ServiceName, sc.ServiceName, "#B2");
 
                        sc.DisplayName = string.Empty;
 
@@ -1629,7 +1680,7 @@ namespace MonoTests.System.ServiceProcess
                                Assert.Ignore ("Running on Unix.");
 
                        ServiceController sc = new ServiceController ();
-                       sc.DisplayName = "Alerter";
+                       sc.DisplayName = CONTROLLABLE_SERVICE.DisplayName;
                        try {
                                sc.DisplayName = null;
                                Assert.Fail ("#1");
@@ -1640,7 +1691,7 @@ namespace MonoTests.System.ServiceProcess
                                Assert.AreEqual ("value", ex.ParamName, "#5");
                                Assert.IsNull (ex.InnerException, "#6");
                        }
-                       Assert.AreEqual ("Alerter", sc.DisplayName, "#7");
+                       Assert.AreEqual (CONTROLLABLE_SERVICE.DisplayName, sc.DisplayName, "#7");
                }
 
                [Test]
@@ -1650,10 +1701,10 @@ namespace MonoTests.System.ServiceProcess
                                Assert.Ignore ("Running on Unix.");
 
                        ServiceController sc = new ServiceController ();
-                       sc.DisplayName = "lanmanworkstation";
-                       Assert.AreEqual ("lanmanworkstation", sc.DisplayName, "#A1");
-                       Assert.AreEqual ("lanmanworkstation", sc.ServiceName, "#A2");
-                       Assert.AreEqual ("Workstation", sc.DisplayName, "#A3");
+                       sc.DisplayName = WORKSTATION_SERVICE.ServiceName;
+                       Assert.AreEqual (WORKSTATION_SERVICE.ServiceName, sc.DisplayName, "#A1");
+                       Assert.AreEqual (WORKSTATION_SERVICE.ServiceName, sc.ServiceName, "#A2");
+                       Assert.AreEqual (WORKSTATION_SERVICE.DisplayName, sc.DisplayName, "#A3");
                }
 
                [Test]
@@ -1662,7 +1713,7 @@ namespace MonoTests.System.ServiceProcess
                        if (RunningOnUnix)
                                Assert.Ignore ("Running on Unix.");
 
-                       ServiceController sc = new ServiceController ("Disk", ".");
+                       ServiceController sc = new ServiceController (DISK_DRIVER_SERVICE.ServiceName, ".");
                        Assert.AreEqual (ServiceControllerStatus.Running, sc.Status, "#A");
 
                        try {
@@ -1670,10 +1721,10 @@ namespace MonoTests.System.ServiceProcess
                                        sc.ExecuteCommand ((int) SERVICE_CONTROL_TYPE.SERVICE_CONTROL_CONTINUE);
                                        Assert.Fail ("#B1");
                                } catch (InvalidOperationException ex) {
-                                       // Cannot control Schedule service on computer '.'
+                                       // Cannot control XXX service on computer '.'
                                        Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#B2");
                                        Assert.IsNotNull (ex.Message, "#B3");
-                                       Assert.IsTrue (ex.Message.IndexOf ("Disk") != -1, "#B4");
+                                       Assert.IsTrue (ex.Message.IndexOf (DISK_DRIVER_SERVICE.ServiceName) != -1, "#B4");
                                        Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#B5");
                                        Assert.IsNotNull (ex.InnerException, "#B6");
 
@@ -1690,10 +1741,10 @@ namespace MonoTests.System.ServiceProcess
                                        sc.ExecuteCommand ((int) SERVICE_CONTROL_TYPE.SERVICE_CONTROL_DEVICEEVENT);
                                        Assert.Fail ("#C1");
                                } catch (InvalidOperationException ex) {
-                                       // Cannot control Schedule service on computer '.'
+                                       // Cannot control XXX service on computer '.'
                                        Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#C2");
                                        Assert.IsNotNull (ex.Message, "#C3");
-                                       Assert.IsTrue (ex.Message.IndexOf ("Disk") != -1, "#C4");
+                                       Assert.IsTrue (ex.Message.IndexOf (DISK_DRIVER_SERVICE.ServiceName) != -1, "#C4");
                                        Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#C5");
                                        Assert.IsNotNull (ex.InnerException, "#C6");
 
@@ -1710,10 +1761,10 @@ namespace MonoTests.System.ServiceProcess
                                        sc.ExecuteCommand ((int) SERVICE_CONTROL_TYPE.SERVICE_CONTROL_HARDWAREPROFILECHANGE);
                                        Assert.Fail ("#D1");
                                } catch (InvalidOperationException ex) {
-                                       // Cannot control Schedule service on computer '.'
+                                       // Cannot control XXX service on computer '.'
                                        Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#D2");
                                        Assert.IsNotNull (ex.Message, "#D3");
-                                       Assert.IsTrue (ex.Message.IndexOf ("Disk") != -1, "#D4");
+                                       Assert.IsTrue (ex.Message.IndexOf (DISK_DRIVER_SERVICE.ServiceName) != -1, "#D4");
                                        Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#D5");
                                        Assert.IsNotNull (ex.InnerException, "#D6");
 
@@ -1730,10 +1781,10 @@ namespace MonoTests.System.ServiceProcess
                                        sc.ExecuteCommand ((int) SERVICE_CONTROL_TYPE.SERVICE_CONTROL_INTERROGATE);
                                        Assert.Fail ("#E1");
                                } catch (InvalidOperationException ex) {
-                                       // Cannot control Schedule service on computer '.'
+                                       // Cannot control XXX service on computer '.'
                                        Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#E2");
                                        Assert.IsNotNull (ex.Message, "#E3");
-                                       Assert.IsTrue (ex.Message.IndexOf ("Disk") != -1, "#E4");
+                                       Assert.IsTrue (ex.Message.IndexOf (DISK_DRIVER_SERVICE.ServiceName) != -1, "#E4");
                                        Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#E5");
                                        Assert.IsNotNull (ex.InnerException, "#E6");
 
@@ -1750,10 +1801,10 @@ namespace MonoTests.System.ServiceProcess
                                        sc.ExecuteCommand ((int) SERVICE_CONTROL_TYPE.SERVICE_CONTROL_NETBINDADD);
                                        Assert.Fail ("#F1");
                                } catch (InvalidOperationException ex) {
-                                       // Cannot control Schedule service on computer '.'
+                                       // Cannot control XXX service on computer '.'
                                        Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#F2");
                                        Assert.IsNotNull (ex.Message, "#F3");
-                                       Assert.IsTrue (ex.Message.IndexOf ("Disk") != -1, "#F4");
+                                       Assert.IsTrue (ex.Message.IndexOf (DISK_DRIVER_SERVICE.ServiceName) != -1, "#F4");
                                        Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#F5");
                                        Assert.IsNotNull (ex.InnerException, "#F6");
 
@@ -1770,10 +1821,10 @@ namespace MonoTests.System.ServiceProcess
                                        sc.ExecuteCommand ((int) SERVICE_CONTROL_TYPE.SERVICE_CONTROL_NETBINDDISABLE);
                                        Assert.Fail ("#G1");
                                } catch (InvalidOperationException ex) {
-                                       // Cannot control Schedule service on computer '.'
+                                       // Cannot control XXX service on computer '.'
                                        Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#G2");
                                        Assert.IsNotNull (ex.Message, "#G3");
-                                       Assert.IsTrue (ex.Message.IndexOf ("Disk") != -1, "#G4");
+                                       Assert.IsTrue (ex.Message.IndexOf (DISK_DRIVER_SERVICE.ServiceName) != -1, "#G4");
                                        Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#G5");
                                        Assert.IsNotNull (ex.InnerException, "#G6");
 
@@ -1790,10 +1841,10 @@ namespace MonoTests.System.ServiceProcess
                                        sc.ExecuteCommand ((int) SERVICE_CONTROL_TYPE.SERVICE_CONTROL_NETBINDENABLE);
                                        Assert.Fail ("#H1");
                                } catch (InvalidOperationException ex) {
-                                       // Cannot control Schedule service on computer '.'
+                                       // Cannot control XXX service on computer '.'
                                        Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#H2");
                                        Assert.IsNotNull (ex.Message, "#H3");
-                                       Assert.IsTrue (ex.Message.IndexOf ("Disk") != -1, "#H4");
+                                       Assert.IsTrue (ex.Message.IndexOf (DISK_DRIVER_SERVICE.ServiceName) != -1, "#H4");
                                        Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#H5");
                                        Assert.IsNotNull (ex.InnerException, "#H6");
 
@@ -1810,10 +1861,10 @@ namespace MonoTests.System.ServiceProcess
                                        sc.ExecuteCommand ((int) SERVICE_CONTROL_TYPE.SERVICE_CONTROL_NETBINDREMOVE);
                                        Assert.Fail ("#I1");
                                } catch (InvalidOperationException ex) {
-                                       // Cannot control Schedule service on computer '.'
+                                       // Cannot control XXX service on computer '.'
                                        Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#I2");
                                        Assert.IsNotNull (ex.Message, "#I3");
-                                       Assert.IsTrue (ex.Message.IndexOf ("Disk") != -1, "#I4");
+                                       Assert.IsTrue (ex.Message.IndexOf (DISK_DRIVER_SERVICE.ServiceName) != -1, "#I4");
                                        Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#I5");
                                        Assert.IsNotNull (ex.InnerException, "#I6");
 
@@ -1830,10 +1881,10 @@ namespace MonoTests.System.ServiceProcess
                                        sc.ExecuteCommand ((int) SERVICE_CONTROL_TYPE.SERVICE_CONTROL_PARAMCHANGE);
                                        Assert.Fail ("#J1");
                                } catch (InvalidOperationException ex) {
-                                       // Cannot control Schedule service on computer '.'
+                                       // Cannot control XXX service on computer '.'
                                        Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#J2");
                                        Assert.IsNotNull (ex.Message, "#J3");
-                                       Assert.IsTrue (ex.Message.IndexOf ("Disk") != -1, "#J4");
+                                       Assert.IsTrue (ex.Message.IndexOf (DISK_DRIVER_SERVICE.ServiceName) != -1, "#J4");
                                        Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#J5");
                                        Assert.IsNotNull (ex.InnerException, "#J6");
 
@@ -1850,10 +1901,10 @@ namespace MonoTests.System.ServiceProcess
                                        sc.ExecuteCommand ((int) SERVICE_CONTROL_TYPE.SERVICE_CONTROL_PAUSE);
                                        Assert.Fail ("#K1");
                                } catch (InvalidOperationException ex) {
-                                       // Cannot control Schedule service on computer '.'
+                                       // Cannot control XXX service on computer '.'
                                        Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#K2");
                                        Assert.IsNotNull (ex.Message, "#K3");
-                                       Assert.IsTrue (ex.Message.IndexOf ("Disk") != -1, "#K4");
+                                       Assert.IsTrue (ex.Message.IndexOf (DISK_DRIVER_SERVICE.ServiceName) != -1, "#K4");
                                        Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#K5");
                                        Assert.IsNotNull (ex.InnerException, "#K6");
 
@@ -1870,10 +1921,10 @@ namespace MonoTests.System.ServiceProcess
                                        sc.ExecuteCommand ((int) SERVICE_CONTROL_TYPE.SERVICE_CONTROL_POWEREVENT);
                                        Assert.Fail ("#L1");
                                } catch (InvalidOperationException ex) {
-                                       // Cannot control Schedule service on computer '.'
+                                       // Cannot control XXX service on computer '.'
                                        Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#L2");
                                        Assert.IsNotNull (ex.Message, "#L3");
-                                       Assert.IsTrue (ex.Message.IndexOf ("Disk") != -1, "#L4");
+                                       Assert.IsTrue (ex.Message.IndexOf (DISK_DRIVER_SERVICE.ServiceName) != -1, "#L4");
                                        Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#L5");
                                        Assert.IsNotNull (ex.InnerException, "#L6");
 
@@ -1890,10 +1941,10 @@ namespace MonoTests.System.ServiceProcess
                                        sc.ExecuteCommand ((int) SERVICE_CONTROL_TYPE.SERVICE_CONTROL_SESSIONCHANGE);
                                        Assert.Fail ("#M1");
                                } catch (InvalidOperationException ex) {
-                                       // Cannot control Schedule service on computer '.'
+                                       // Cannot control XXX service on computer '.'
                                        Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#M2");
                                        Assert.IsNotNull (ex.Message, "#M3");
-                                       Assert.IsTrue (ex.Message.IndexOf ("Disk") != -1, "#M4");
+                                       Assert.IsTrue (ex.Message.IndexOf (DISK_DRIVER_SERVICE.ServiceName) != -1, "#M4");
                                        Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#M5");
                                        Assert.IsNotNull (ex.InnerException, "#M6");
 
@@ -1910,10 +1961,10 @@ namespace MonoTests.System.ServiceProcess
                                        sc.ExecuteCommand ((int) SERVICE_CONTROL_TYPE.SERVICE_CONTROL_SHUTDOWN);
                                        Assert.Fail ("#N1");
                                } catch (InvalidOperationException ex) {
-                                       // Cannot control Schedule service on computer '.'
+                                       // Cannot control XXX service on computer '.'
                                        Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#N2");
                                        Assert.IsNotNull (ex.Message, "#N3");
-                                       Assert.IsTrue (ex.Message.IndexOf ("Disk") != -1, "#N4");
+                                       Assert.IsTrue (ex.Message.IndexOf (DISK_DRIVER_SERVICE.ServiceName) != -1, "#N4");
                                        Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#N5");
                                        Assert.IsNotNull (ex.InnerException, "#N6");
 
@@ -1930,10 +1981,10 @@ namespace MonoTests.System.ServiceProcess
                                        sc.ExecuteCommand ((int) SERVICE_CONTROL_TYPE.SERVICE_CONTROL_STOP);
                                        Assert.Fail ("#O1");
                                } catch (InvalidOperationException ex) {
-                                       // Cannot control Schedule service on computer '.'
+                                       // Cannot control XXX service on computer '.'
                                        Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#O2");
                                        Assert.IsNotNull (ex.Message, "#O3");
-                                       Assert.IsTrue (ex.Message.IndexOf ("Disk") != -1, "#O4");
+                                       Assert.IsTrue (ex.Message.IndexOf (DISK_DRIVER_SERVICE.ServiceName) != -1, "#O4");
                                        Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#O5");
                                        Assert.IsNotNull (ex.InnerException, "#O6");
 
@@ -1958,7 +2009,7 @@ namespace MonoTests.System.ServiceProcess
                        if (RunningOnUnix)
                                Assert.Ignore ("Running on Unix.");
 
-                       ServiceController sc = new ServiceController ("Schedule",
+                       ServiceController sc = new ServiceController (CONTROLLABLE_SERVICE.ServiceName,
                                "doesnotexist");
                        try {
                                sc.ExecuteCommand ((int) SERVICE_CONTROL_TYPE.SERVICE_CONTROL_PAUSE);
@@ -1987,7 +2038,7 @@ namespace MonoTests.System.ServiceProcess
                        if (RunningOnUnix)
                                Assert.Ignore ("Running on Unix.");
 
-                       ServiceController sc = new ServiceController ("Schedule", ".");
+                       ServiceController sc = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
                        Assert.AreEqual (ServiceControllerStatus.Running, sc.Status, "#A");
 
                        try {
@@ -1995,10 +2046,10 @@ namespace MonoTests.System.ServiceProcess
                                        sc.ExecuteCommand (127);
                                        Assert.Fail ("#B1");
                                } catch (InvalidOperationException ex) {
-                                       // Cannot control Schedule service on computer '.'
+                                       // Cannot control XXX service on computer '.'
                                        Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#B2");
                                        Assert.IsNotNull (ex.Message, "#B3");
-                                       Assert.IsTrue (ex.Message.IndexOf ("Schedule") != -1, "#B4");
+                                       Assert.IsTrue (ex.Message.IndexOf (CONTROLLABLE_SERVICE.ServiceName) != -1, "#B4");
                                        Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#B5");
                                        Assert.IsNotNull (ex.InnerException, "#B6");
 
@@ -2018,10 +2069,10 @@ namespace MonoTests.System.ServiceProcess
                                        sc.ExecuteCommand (256);
                                        Assert.Fail ("#C1");
                                } catch (InvalidOperationException ex) {
-                                       // Cannot control Schedule service on computer '.'
+                                       // Cannot control XXX service on computer '.'
                                        Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#C2");
                                        Assert.IsNotNull (ex.Message, "#C3");
-                                       Assert.IsTrue (ex.Message.IndexOf ("Schedule") != -1, "#C4");
+                                       Assert.IsTrue (ex.Message.IndexOf (CONTROLLABLE_SERVICE.ServiceName) != -1, "#C4");
                                        Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#C5");
                                        Assert.IsNotNull (ex.InnerException, "#C6");
 
@@ -2046,7 +2097,7 @@ namespace MonoTests.System.ServiceProcess
                        if (RunningOnUnix)
                                Assert.Ignore ("Running on Unix.");
 
-                       ServiceController sc = new ServiceController ("Schedule", ".");
+                       ServiceController sc = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
                        Assert.AreEqual (ServiceControllerStatus.Running, sc.Status, "#A");
 
                        sc.Pause ();
@@ -2063,10 +2114,10 @@ namespace MonoTests.System.ServiceProcess
                                        sc.ExecuteCommand (127);
                                        Assert.Fail ("#C1");
                                } catch (InvalidOperationException ex) {
-                                       // Cannot control Schedule service on computer '.'
+                                       // Cannot control XXX service on computer '.'
                                        Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#C2");
                                        Assert.IsNotNull (ex.Message, "#C3");
-                                       Assert.IsTrue (ex.Message.IndexOf ("Schedule") != -1, "#C4");
+                                       Assert.IsTrue (ex.Message.IndexOf (CONTROLLABLE_SERVICE.ServiceName) != -1, "#C4");
                                        Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#C5");
                                        Assert.IsNotNull (ex.InnerException, "#C6");
 
@@ -2091,7 +2142,7 @@ namespace MonoTests.System.ServiceProcess
                        if (RunningOnUnix)
                                Assert.Ignore ("Running on Unix.");
 
-                       ServiceController sc = new ServiceController ("Schedule", ".");
+                       ServiceController sc = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
                        Assert.AreEqual (ServiceControllerStatus.Running, sc.Status, "#A");
 
                        try {
@@ -2099,10 +2150,10 @@ namespace MonoTests.System.ServiceProcess
                                        sc.ExecuteCommand ((int) SERVICE_CONTROL_TYPE.SERVICE_CONTROL_CONTINUE);
                                        Assert.Fail ("#B1");
                                } catch (InvalidOperationException ex) {
-                                       // Cannot control Schedule service on computer '.'
+                                       // Cannot control XXX service on computer '.'
                                        Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#B2");
                                        Assert.IsNotNull (ex.Message, "#B3");
-                                       Assert.IsTrue (ex.Message.IndexOf ("Schedule") != -1, "#B4");
+                                       Assert.IsTrue (ex.Message.IndexOf (CONTROLLABLE_SERVICE.ServiceName) != -1, "#B4");
                                        Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#B5");
                                        Assert.IsNotNull (ex.InnerException, "#B6");
 
@@ -2119,10 +2170,10 @@ namespace MonoTests.System.ServiceProcess
                                        sc.ExecuteCommand ((int) SERVICE_CONTROL_TYPE.SERVICE_CONTROL_DEVICEEVENT);
                                        Assert.Fail ("#C1");
                                } catch (InvalidOperationException ex) {
-                                       // Cannot control Schedule service on computer '.'
+                                       // Cannot control XXX service on computer '.'
                                        Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#C2");
                                        Assert.IsNotNull (ex.Message, "#C3");
-                                       Assert.IsTrue (ex.Message.IndexOf ("Schedule") != -1, "#C4");
+                                       Assert.IsTrue (ex.Message.IndexOf (CONTROLLABLE_SERVICE.ServiceName) != -1, "#C4");
                                        Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#C5");
                                        Assert.IsNotNull (ex.InnerException, "#C6");
 
@@ -2139,10 +2190,10 @@ namespace MonoTests.System.ServiceProcess
                                        sc.ExecuteCommand ((int) SERVICE_CONTROL_TYPE.SERVICE_CONTROL_HARDWAREPROFILECHANGE);
                                        Assert.Fail ("#D1");
                                } catch (InvalidOperationException ex) {
-                                       // Cannot control Schedule service on computer '.'
+                                       // Cannot control XXX service on computer '.'
                                        Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#D2");
                                        Assert.IsNotNull (ex.Message, "#D3");
-                                       Assert.IsTrue (ex.Message.IndexOf ("Schedule") != -1, "#D4");
+                                       Assert.IsTrue (ex.Message.IndexOf (CONTROLLABLE_SERVICE.ServiceName) != -1, "#D4");
                                        Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#D5");
                                        Assert.IsNotNull (ex.InnerException, "#D6");
 
@@ -2159,10 +2210,10 @@ namespace MonoTests.System.ServiceProcess
                                        sc.ExecuteCommand ((int) SERVICE_CONTROL_TYPE.SERVICE_CONTROL_INTERROGATE);
                                        Assert.Fail ("#E1");
                                } catch (InvalidOperationException ex) {
-                                       // Cannot control Schedule service on computer '.'
+                                       // Cannot control XXX service on computer '.'
                                        Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#E2");
                                        Assert.IsNotNull (ex.Message, "#E3");
-                                       Assert.IsTrue (ex.Message.IndexOf ("Schedule") != -1, "#E4");
+                                       Assert.IsTrue (ex.Message.IndexOf (CONTROLLABLE_SERVICE.ServiceName) != -1, "#E4");
                                        Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#E5");
                                        Assert.IsNotNull (ex.InnerException, "#E6");
 
@@ -2179,10 +2230,10 @@ namespace MonoTests.System.ServiceProcess
                                        sc.ExecuteCommand ((int) SERVICE_CONTROL_TYPE.SERVICE_CONTROL_NETBINDADD);
                                        Assert.Fail ("#F1");
                                } catch (InvalidOperationException ex) {
-                                       // Cannot control Schedule service on computer '.'
+                                       // Cannot control XXX service on computer '.'
                                        Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#F2");
                                        Assert.IsNotNull (ex.Message, "#F3");
-                                       Assert.IsTrue (ex.Message.IndexOf ("Schedule") != -1, "#F4");
+                                       Assert.IsTrue (ex.Message.IndexOf (CONTROLLABLE_SERVICE.ServiceName) != -1, "#F4");
                                        Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#F5");
                                        Assert.IsNotNull (ex.InnerException, "#F6");
 
@@ -2199,10 +2250,10 @@ namespace MonoTests.System.ServiceProcess
                                        sc.ExecuteCommand ((int) SERVICE_CONTROL_TYPE.SERVICE_CONTROL_NETBINDDISABLE);
                                        Assert.Fail ("#G1");
                                } catch (InvalidOperationException ex) {
-                                       // Cannot control Schedule service on computer '.'
+                                       // Cannot control XXX service on computer '.'
                                        Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#G2");
                                        Assert.IsNotNull (ex.Message, "#G3");
-                                       Assert.IsTrue (ex.Message.IndexOf ("Schedule") != -1, "#G4");
+                                       Assert.IsTrue (ex.Message.IndexOf (CONTROLLABLE_SERVICE.ServiceName) != -1, "#G4");
                                        Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#G5");
                                        Assert.IsNotNull (ex.InnerException, "#G6");
 
@@ -2219,10 +2270,10 @@ namespace MonoTests.System.ServiceProcess
                                        sc.ExecuteCommand ((int) SERVICE_CONTROL_TYPE.SERVICE_CONTROL_NETBINDENABLE);
                                        Assert.Fail ("#H1");
                                } catch (InvalidOperationException ex) {
-                                       // Cannot control Schedule service on computer '.'
+                                       // Cannot control XXX service on computer '.'
                                        Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#H2");
                                        Assert.IsNotNull (ex.Message, "#H3");
-                                       Assert.IsTrue (ex.Message.IndexOf ("Schedule") != -1, "#H4");
+                                       Assert.IsTrue (ex.Message.IndexOf (CONTROLLABLE_SERVICE.ServiceName) != -1, "#H4");
                                        Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#H5");
                                        Assert.IsNotNull (ex.InnerException, "#H6");
 
@@ -2239,10 +2290,10 @@ namespace MonoTests.System.ServiceProcess
                                        sc.ExecuteCommand ((int) SERVICE_CONTROL_TYPE.SERVICE_CONTROL_NETBINDREMOVE);
                                        Assert.Fail ("#I1");
                                } catch (InvalidOperationException ex) {
-                                       // Cannot control Schedule service on computer '.'
+                                       // Cannot control XXX service on computer '.'
                                        Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#I2");
                                        Assert.IsNotNull (ex.Message, "#I3");
-                                       Assert.IsTrue (ex.Message.IndexOf ("Schedule") != -1, "#I4");
+                                       Assert.IsTrue (ex.Message.IndexOf (CONTROLLABLE_SERVICE.ServiceName) != -1, "#I4");
                                        Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#I5");
                                        Assert.IsNotNull (ex.InnerException, "#I6");
 
@@ -2259,10 +2310,10 @@ namespace MonoTests.System.ServiceProcess
                                        sc.ExecuteCommand ((int) SERVICE_CONTROL_TYPE.SERVICE_CONTROL_PARAMCHANGE);
                                        Assert.Fail ("#J1");
                                } catch (InvalidOperationException ex) {
-                                       // Cannot control Schedule service on computer '.'
+                                       // Cannot control XXX service on computer '.'
                                        Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#J2");
                                        Assert.IsNotNull (ex.Message, "#J3");
-                                       Assert.IsTrue (ex.Message.IndexOf ("Schedule") != -1, "#J4");
+                                       Assert.IsTrue (ex.Message.IndexOf (CONTROLLABLE_SERVICE.ServiceName) != -1, "#J4");
                                        Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#J5");
                                        Assert.IsNotNull (ex.InnerException, "#J6");
 
@@ -2279,10 +2330,10 @@ namespace MonoTests.System.ServiceProcess
                                        sc.ExecuteCommand ((int) SERVICE_CONTROL_TYPE.SERVICE_CONTROL_PAUSE);
                                        Assert.Fail ("#K1");
                                } catch (InvalidOperationException ex) {
-                                       // Cannot control Schedule service on computer '.'
+                                       // Cannot control XXX service on computer '.'
                                        Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#K2");
                                        Assert.IsNotNull (ex.Message, "#K3");
-                                       Assert.IsTrue (ex.Message.IndexOf ("Schedule") != -1, "#K4");
+                                       Assert.IsTrue (ex.Message.IndexOf (CONTROLLABLE_SERVICE.ServiceName) != -1, "#K4");
                                        Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#K5");
                                        Assert.IsNotNull (ex.InnerException, "#K6");
 
@@ -2299,10 +2350,10 @@ namespace MonoTests.System.ServiceProcess
                                        sc.ExecuteCommand ((int) SERVICE_CONTROL_TYPE.SERVICE_CONTROL_POWEREVENT);
                                        Assert.Fail ("#L1");
                                } catch (InvalidOperationException ex) {
-                                       // Cannot control Schedule service on computer '.'
+                                       // Cannot control XXX service on computer '.'
                                        Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#L2");
                                        Assert.IsNotNull (ex.Message, "#L3");
-                                       Assert.IsTrue (ex.Message.IndexOf ("Schedule") != -1, "#L4");
+                                       Assert.IsTrue (ex.Message.IndexOf (CONTROLLABLE_SERVICE.ServiceName) != -1, "#L4");
                                        Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#L5");
                                        Assert.IsNotNull (ex.InnerException, "#L6");
 
@@ -2319,10 +2370,10 @@ namespace MonoTests.System.ServiceProcess
                                        sc.ExecuteCommand ((int) SERVICE_CONTROL_TYPE.SERVICE_CONTROL_SESSIONCHANGE);
                                        Assert.Fail ("#M1");
                                } catch (InvalidOperationException ex) {
-                                       // Cannot control Schedule service on computer '.'
+                                       // Cannot control XXX service on computer '.'
                                        Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#M2");
                                        Assert.IsNotNull (ex.Message, "#M3");
-                                       Assert.IsTrue (ex.Message.IndexOf ("Schedule") != -1, "#M4");
+                                       Assert.IsTrue (ex.Message.IndexOf (CONTROLLABLE_SERVICE.ServiceName) != -1, "#M4");
                                        Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#M5");
                                        Assert.IsNotNull (ex.InnerException, "#M6");
 
@@ -2339,10 +2390,10 @@ namespace MonoTests.System.ServiceProcess
                                        sc.ExecuteCommand ((int) SERVICE_CONTROL_TYPE.SERVICE_CONTROL_SHUTDOWN);
                                        Assert.Fail ("#N1");
                                } catch (InvalidOperationException ex) {
-                                       // Cannot control Schedule service on computer '.'
+                                       // Cannot control XXX service on computer '.'
                                        Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#N2");
                                        Assert.IsNotNull (ex.Message, "#N3");
-                                       Assert.IsTrue (ex.Message.IndexOf ("Schedule") != -1, "#N4");
+                                       Assert.IsTrue (ex.Message.IndexOf (CONTROLLABLE_SERVICE.ServiceName) != -1, "#N4");
                                        Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#N5");
                                        Assert.IsNotNull (ex.InnerException, "#N6");
 
@@ -2359,10 +2410,10 @@ namespace MonoTests.System.ServiceProcess
                                        sc.ExecuteCommand ((int) SERVICE_CONTROL_TYPE.SERVICE_CONTROL_STOP);
                                        Assert.Fail ("#O1");
                                } catch (InvalidOperationException ex) {
-                                       // Cannot control Schedule service on computer '.'
+                                       // Cannot control XXX service on computer '.'
                                        Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#O2");
                                        Assert.IsNotNull (ex.Message, "#O3");
-                                       Assert.IsTrue (ex.Message.IndexOf ("Schedule") != -1, "#O4");
+                                       Assert.IsTrue (ex.Message.IndexOf (CONTROLLABLE_SERVICE.ServiceName) != -1, "#O4");
                                        Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#O5");
                                        Assert.IsNotNull (ex.InnerException, "#O6");
 
@@ -2415,7 +2466,7 @@ namespace MonoTests.System.ServiceProcess
                        if (RunningOnUnix)
                                Assert.Ignore ("Running on Unix.");
 
-                       ServiceController sc = new ServiceController ("Schedule", ".");
+                       ServiceController sc = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
                        Assert.AreEqual (ServiceControllerStatus.Running, sc.Status, "#A");
 
                        sc.Pause ();
@@ -2440,7 +2491,7 @@ namespace MonoTests.System.ServiceProcess
                        if (RunningOnUnix)
                                Assert.Ignore ("Running on Unix.");
 
-                       ServiceController sc = new ServiceController ("Schedule", ".");
+                       ServiceController sc = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
                        Assert.AreEqual (ServiceControllerStatus.Running, sc.Status, "#A");
 
                        sc.Pause ();
@@ -2452,10 +2503,10 @@ namespace MonoTests.System.ServiceProcess
                                        sc.ExecuteCommand (127);
                                        Assert.Fail ("#B1");
                                } catch (InvalidOperationException ex) {
-                                       // Cannot control Schedule service on computer '.'
+                                       // Cannot control XXX service on computer '.'
                                        Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#B2");
                                        Assert.IsNotNull (ex.Message, "#B3");
-                                       Assert.IsTrue (ex.Message.IndexOf ("Schedule") != -1, "#B4");
+                                       Assert.IsTrue (ex.Message.IndexOf (CONTROLLABLE_SERVICE.ServiceName) != -1, "#B4");
                                        Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#B5");
                                        Assert.IsNotNull (ex.InnerException, "#B6");
 
@@ -2480,7 +2531,7 @@ namespace MonoTests.System.ServiceProcess
                        if (RunningOnUnix)
                                Assert.Ignore ("Running on Unix.");
 
-                       ServiceController sc = new ServiceController ("Schedule", ".");
+                       ServiceController sc = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
                        Assert.AreEqual (ServiceControllerStatus.Running, sc.Status, "#A");
 
                        sc.Stop ();
@@ -2495,10 +2546,10 @@ namespace MonoTests.System.ServiceProcess
                                        sc.ExecuteCommand (127);
                                        Assert.Fail ("#C1");
                                } catch (InvalidOperationException ex) {
-                                       // Cannot control Schedule service on computer '.'
+                                       // Cannot control XXX service on computer '.'
                                        Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#C2");
                                        Assert.IsNotNull (ex.Message, "#C3");
-                                       Assert.IsTrue (ex.Message.IndexOf ("Schedule") != -1, "#C4");
+                                       Assert.IsTrue (ex.Message.IndexOf (CONTROLLABLE_SERVICE.ServiceName) != -1, "#C4");
                                        Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#C5");
                                        Assert.IsNotNull (ex.InnerException, "#C6");
 
@@ -2515,10 +2566,10 @@ namespace MonoTests.System.ServiceProcess
                                        sc.ExecuteCommand (128);
                                        Assert.Fail ("#D1");
                                } catch (InvalidOperationException ex) {
-                                       // Cannot control Schedule service on computer '.'
+                                       // Cannot control XXX service on computer '.'
                                        Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#D2");
                                        Assert.IsNotNull (ex.Message, "#D3");
-                                       Assert.IsTrue (ex.Message.IndexOf ("Schedule") != -1, "#D4");
+                                       Assert.IsTrue (ex.Message.IndexOf (CONTROLLABLE_SERVICE.ServiceName) != -1, "#D4");
                                        Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#D5");
                                        Assert.IsNotNull (ex.InnerException, "#D6");
 
@@ -2543,7 +2594,7 @@ namespace MonoTests.System.ServiceProcess
                        if (RunningOnUnix)
                                Assert.Ignore ("Running on Unix.");
 
-                       ServiceController sc = new ServiceController ("Schedule", ".");
+                       ServiceController sc = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
                        Assert.AreEqual (ServiceControllerStatus.Running, sc.Status, "#A");
 
                        sc.Stop ();
@@ -2556,10 +2607,10 @@ namespace MonoTests.System.ServiceProcess
                                        sc.ExecuteCommand (127);
                                        Assert.Fail ("#C1");
                                } catch (InvalidOperationException ex) {
-                                       // Cannot control Schedule service on computer '.'
+                                       // Cannot control XXX service on computer '.'
                                        Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#B2");
                                        Assert.IsNotNull (ex.Message, "#C3");
-                                       Assert.IsTrue (ex.Message.IndexOf ("Schedule") != -1, "#C4");
+                                       Assert.IsTrue (ex.Message.IndexOf (CONTROLLABLE_SERVICE.ServiceName) != -1, "#C4");
                                        Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#C5");
                                        Assert.IsNotNull (ex.InnerException, "#C6");
 
@@ -2576,10 +2627,10 @@ namespace MonoTests.System.ServiceProcess
                                        sc.ExecuteCommand (128);
                                        Assert.Fail ("#D1");
                                } catch (InvalidOperationException ex) {
-                                       // Cannot control Schedule service on computer '.'
+                                       // Cannot control XXX service on computer '.'
                                        Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#D2");
                                        Assert.IsNotNull (ex.Message, "#D3");
-                                       Assert.IsTrue (ex.Message.IndexOf ("Schedule") != -1, "#D4");
+                                       Assert.IsTrue (ex.Message.IndexOf (CONTROLLABLE_SERVICE.ServiceName) != -1, "#D4");
                                        Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#D5");
                                        Assert.IsNotNull (ex.InnerException, "#D6");
 
@@ -2604,7 +2655,7 @@ namespace MonoTests.System.ServiceProcess
                        if (RunningOnUnix)
                                Assert.Ignore ("Running on Unix.");
 
-                       ServiceController sc = new ServiceController ("Schedule", ".");
+                       ServiceController sc = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
                        Assert.AreEqual (ServiceControllerStatus.Running, sc.Status, "#A");
 
                        sc.Stop ();
@@ -2614,10 +2665,10 @@ namespace MonoTests.System.ServiceProcess
                                        sc.ExecuteCommand (127);
                                        Assert.Fail ("#B1");
                                } catch (InvalidOperationException ex) {
-                                       // Cannot control Schedule service on computer '.'
+                                       // Cannot control XXX service on computer '.'
                                        Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#B2");
                                        Assert.IsNotNull (ex.Message, "#B3");
-                                       Assert.IsTrue (ex.Message.IndexOf ("Schedule") != -1, "#B4");
+                                       Assert.IsTrue (ex.Message.IndexOf (CONTROLLABLE_SERVICE.ServiceName) != -1, "#B4");
                                        Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#B5");
                                        Assert.IsNotNull (ex.InnerException, "#B6");
 
@@ -2634,10 +2685,10 @@ namespace MonoTests.System.ServiceProcess
                                        sc.ExecuteCommand (128);
                                        Assert.Fail ("#C1");
                                } catch (InvalidOperationException ex) {
-                                       // Cannot control Schedule service on computer '.'
+                                       // Cannot control XXX service on computer '.'
                                        Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#C2");
                                        Assert.IsNotNull (ex.Message, "#C3");
-                                       Assert.IsTrue (ex.Message.IndexOf ("Schedule") != -1, "#C4");
+                                       Assert.IsTrue (ex.Message.IndexOf (CONTROLLABLE_SERVICE.ServiceName) != -1, "#C4");
                                        Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#C5");
                                        Assert.IsNotNull (ex.InnerException, "#C6");
 
@@ -2686,46 +2737,40 @@ namespace MonoTests.System.ServiceProcess
                        devices = ServiceController.GetDevices ();
                        Assert.IsNotNull (devices, "#A1");
 
-                       bool foundDisk = false;
-                       bool foundAlerter = false;
+                       bool foundKernelService = false;
+                       bool foundShareProcessService = false;
 
                        foreach (ServiceController sc in devices) {
-                               switch (sc.ServiceName) {
-                               case "Disk":
-                                       Assert.AreEqual ("Disk Driver", sc.DisplayName, "#A2");
+                               if (sc.ServiceName.ToLower () == KERNEL_SERVICE.ServiceName.ToLower ()) {
+                                       Assert.AreEqual (KERNEL_SERVICE.DisplayName, sc.DisplayName, "#A2");
                                        Assert.AreEqual (ServiceControllerStatus.Running, sc.Status, "#A3");
-                                       foundDisk = true;
-                                       break;
-                               case "Alerter":
-                                       foundAlerter = true;
-                                       break;
+                                       foundKernelService = true;
+                               } else if (sc.ServiceName.ToLower () == SHARE_PROCESS_SERVICE.ServiceName.ToLower ()) {
+                                       foundShareProcessService = true;
                                }
                        }
 
-                       Assert.IsTrue (foundDisk, "#A4");
-                       Assert.IsFalse (foundAlerter, "#A5");
+                       Assert.IsTrue (foundKernelService, "#A4");
+                       Assert.IsFalse (foundShareProcessService, "#A5");
 
                        devices = ServiceController.GetDevices (Environment.MachineName);
                        Assert.IsNotNull (devices, "#B1");
 
-                       foundDisk = false;
-                       foundAlerter = false;
+                       foundKernelService = false;
+                       foundShareProcessService = false;
 
                        foreach (ServiceController sc in devices) {
-                               switch (sc.ServiceName) {
-                               case "Disk":
-                                       Assert.AreEqual ("Disk Driver", sc.DisplayName, "#B2");
+                               if (sc.ServiceName.ToLower () == KERNEL_SERVICE.ServiceName.ToLower ()) {
+                                       Assert.AreEqual (KERNEL_SERVICE.DisplayName, sc.DisplayName, "#B2");
                                        Assert.AreEqual (ServiceControllerStatus.Running, sc.Status, "#B3");
-                                       foundDisk = true;
-                                       break;
-                               case "Alerter":
-                                       foundAlerter = true;
-                                       break;
+                                       foundKernelService = true;
+                               } else if (sc.ServiceName.ToLower () == SHARE_PROCESS_SERVICE.ServiceName.ToLower ()) {
+                                       foundShareProcessService = true;
                                }
                        }
 
-                       Assert.IsTrue (foundDisk, "#B4");
-                       Assert.IsFalse (foundAlerter, "#B5");
+                       Assert.IsTrue (foundKernelService, "#B4");
+                       Assert.IsFalse (foundShareProcessService, "#B5");
                }
 
                [Test]
@@ -2800,44 +2845,38 @@ namespace MonoTests.System.ServiceProcess
                        services = ServiceController.GetServices ();
                        Assert.IsNotNull (services, "#A1");
 
-                       bool foundDisk = false;
-                       bool foundWorkstation = false;
+                       bool foundKernelService = false;
+                       bool foundShareProcessService = false;
 
                        foreach (ServiceController sc in services) {
-                               switch (sc.ServiceName) {
-                               case "Disk":
-                                       foundDisk = true;
-                                       break;
-                               case "lanmanworkstation":
-                                       foundWorkstation = true;
-                                       break;
+                               if (sc.ServiceName.ToLower () == KERNEL_SERVICE.ServiceName.ToLower ()) {
+                                       foundKernelService = true;
+                               } else if (sc.ServiceName.ToLower () == SHARE_PROCESS_SERVICE.ServiceName.ToLower ()) {
+                                       foundShareProcessService = true;
                                }
                        }
 
-                       Assert.IsFalse (foundDisk, "#A4");
-                       Assert.IsTrue (foundWorkstation, "#A5");
+                       Assert.IsFalse (foundKernelService, "#A4");
+                       Assert.IsTrue (foundShareProcessService, "#A5");
 
                        services = ServiceController.GetServices (Environment.MachineName);
                        Assert.IsNotNull (services, "#B1");
 
-                       foundDisk = false;
-                       foundWorkstation = false;
+                       foundKernelService = false;
+                       foundShareProcessService = false;
 
                        foreach (ServiceController sc in services) {
-                               switch (sc.ServiceName) {
-                               case "Disk":
-                                       foundDisk = true;
-                                       break;
-                               case "lanmanworkstation":
-                                       Assert.AreEqual ("Workstation", sc.DisplayName, "#B2");
+                               if (sc.ServiceName.ToLower () == KERNEL_SERVICE.ServiceName.ToLower ()) {
+                                       foundKernelService = true;
+                               } else if (sc.ServiceName.ToLower () == SHARE_PROCESS_SERVICE.ServiceName.ToLower ()) {
+                                       Assert.AreEqual (SHARE_PROCESS_SERVICE.DisplayName, sc.DisplayName, "#B2");
                                        Assert.AreEqual (ServiceControllerStatus.Running, sc.Status, "#B3");
-                                       foundWorkstation = true;
-                                       break;
+                                       foundShareProcessService = true;
                                }
                        }
 
-                       Assert.IsFalse (foundDisk, "#B4");
-                       Assert.IsTrue (foundWorkstation, "#B5");
+                       Assert.IsFalse (foundKernelService, "#B4");
+                       Assert.IsTrue (foundShareProcessService, "#B5");
                }
 
                [Test]
@@ -2908,25 +2947,25 @@ namespace MonoTests.System.ServiceProcess
                                Assert.Ignore ("Running on Unix.");
 
                        ServiceController sc = new ServiceController ();
-                       sc.ServiceName = "alerter";
-                       Assert.AreEqual ("Alerter", sc.DisplayName, "#A1");
+                       sc.ServiceName = WORKSTATION_SERVICE.ServiceName;
+                       Assert.AreEqual (WORKSTATION_SERVICE.DisplayName, sc.DisplayName, "#A1");
                        Assert.AreEqual (".", sc.MachineName, "#A2");
-                       Assert.AreEqual ("alerter", sc.ServiceName, "#A3");
+                       Assert.AreEqual (WORKSTATION_SERVICE.ServiceName, sc.ServiceName, "#A3");
 
                        sc.MachineName = Environment.MachineName;
-                       Assert.AreEqual ("Alerter", sc.DisplayName, "#B1");
+                       Assert.AreEqual (WORKSTATION_SERVICE.DisplayName, sc.DisplayName, "#B1");
                        Assert.AreEqual (Environment.MachineName, sc.MachineName, "#B2");
-                       Assert.AreEqual ("alerter", sc.ServiceName, "#B3");
+                       Assert.AreEqual (WORKSTATION_SERVICE.ServiceName, sc.ServiceName, "#B3");
 
                        sc.MachineName = "doesnotexist";
-                       Assert.AreEqual ("Alerter", sc.DisplayName, "#C1");
+                       Assert.AreEqual (WORKSTATION_SERVICE.DisplayName, sc.DisplayName, "#C1");
                        Assert.AreEqual ("doesnotexist", sc.MachineName, "#C2");
-                       Assert.AreEqual ("alerter", sc.ServiceName, "#C3");
+                       Assert.AreEqual (WORKSTATION_SERVICE.ServiceName, sc.ServiceName, "#C3");
 
                        sc.MachineName = "DoesNotExist";
-                       Assert.AreEqual ("Alerter", sc.DisplayName, "#D1");
+                       Assert.AreEqual (WORKSTATION_SERVICE.DisplayName, sc.DisplayName, "#D1");
                        Assert.AreEqual ("DoesNotExist", sc.MachineName, "#D2");
-                       Assert.AreEqual ("alerter", sc.ServiceName, "#D3");
+                       Assert.AreEqual (WORKSTATION_SERVICE.ServiceName, sc.ServiceName, "#D3");
                }
 
                [Test]
@@ -2981,8 +3020,8 @@ namespace MonoTests.System.ServiceProcess
                        if (RunningOnUnix)
                                Assert.Ignore ("Running on Unix.");
 
-                       ServiceController sc1 = new ServiceController ("Schedule", ".");
-                       ServiceController sc2 = new ServiceController ("Schedule", ".");
+                       ServiceController sc1 = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
+                       ServiceController sc2 = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
 
                        Assert.AreEqual (ServiceControllerStatus.Running, sc1.Status, "#A1");
                        Assert.AreEqual (ServiceControllerStatus.Running, sc2.Status, "#A2");
@@ -3012,7 +3051,7 @@ namespace MonoTests.System.ServiceProcess
                        if (RunningOnUnix)
                                Assert.Ignore ("Running on Unix.");
 
-                       ServiceController sc = new ServiceController ("Schedule",
+                       ServiceController sc = new ServiceController (CONTROLLABLE_SERVICE.ServiceName,
                                "doesnotexist");
                        try {
                                sc.Pause ();
@@ -3041,8 +3080,8 @@ namespace MonoTests.System.ServiceProcess
                        if (RunningOnUnix)
                                Assert.Ignore ("Running on Unix.");
 
-                       ServiceController sc1 = new ServiceController ("NetDDE", ".");
-                       ServiceController sc2 = new ServiceController ("NetDDE", ".");
+                       ServiceController sc1 = new ServiceController (DISABLED_SERVICE.ServiceName, ".");
+                       ServiceController sc2 = new ServiceController (DISABLED_SERVICE.ServiceName, ".");
 
                        Assert.AreEqual (ServiceControllerStatus.Stopped, sc1.Status, "#A1");
                        Assert.AreEqual (ServiceControllerStatus.Stopped, sc2.Status, "#A2");
@@ -3054,7 +3093,7 @@ namespace MonoTests.System.ServiceProcess
                                // Cannot pause NetDDE service on computer '.'
                                Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#B2");
                                Assert.IsNotNull (ex.Message, "#B3");
-                               Assert.IsTrue (ex.Message.IndexOf ("NetDDE") != -1, "#B4");
+                               Assert.IsTrue (ex.Message.IndexOf (DISABLED_SERVICE.ServiceName) != -1, "#B4");
                                Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#B5");
                                Assert.IsNotNull (ex.InnerException, "#B6");
 
@@ -3105,8 +3144,8 @@ namespace MonoTests.System.ServiceProcess
                        if (RunningOnUnix)
                                Assert.Ignore ("Running on Unix.");
 
-                       ServiceController sc1 = new ServiceController ("SamSs", ".");
-                       ServiceController sc2 = new ServiceController ("SamSs", ".");
+                       ServiceController sc1 = new ServiceController (UNCONTROLLABLE_SERVICE.ServiceName, ".");
+                       ServiceController sc2 = new ServiceController (UNCONTROLLABLE_SERVICE.ServiceName, ".");
 
                        Assert.AreEqual (ServiceControllerStatus.Running, sc1.Status, "#A1");
                        Assert.AreEqual (ServiceControllerStatus.Running, sc2.Status, "#A2");
@@ -3115,10 +3154,10 @@ namespace MonoTests.System.ServiceProcess
                                sc1.Pause ();
                                Assert.Fail ("#B1");
                        } catch (InvalidOperationException ex) {
-                               // Cannot pause SamSs service on computer '.'
+                               // Cannot pause XXX service on computer '.'
                                Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#B2");
                                Assert.IsNotNull (ex.Message, "#B3");
-                               Assert.IsTrue (ex.Message.IndexOf ("SamSs") != -1, "#B4");
+                               Assert.IsTrue (ex.Message.IndexOf (UNCONTROLLABLE_SERVICE.ServiceName) != -1, "#B4");
                                Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#B5");
                                Assert.IsNotNull (ex.InnerException, "#B6");
 
@@ -3141,8 +3180,8 @@ namespace MonoTests.System.ServiceProcess
                        if (RunningOnUnix)
                                Assert.Ignore ("Running on Unix.");
 
-                       ServiceController sc1 = new ServiceController ("Schedule", ".");
-                       ServiceController sc2 = new ServiceController ("Schedule", ".");
+                       ServiceController sc1 = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
+                       ServiceController sc2 = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
 
                        Assert.AreEqual (ServiceControllerStatus.Running, sc1.Status, "#A1");
                        Assert.AreEqual (ServiceControllerStatus.Running, sc2.Status, "#A2");
@@ -3177,8 +3216,8 @@ namespace MonoTests.System.ServiceProcess
                        if (RunningOnUnix)
                                Assert.Ignore ("Running on Unix.");
 
-                       ServiceController sc1 = new ServiceController ("Schedule", ".");
-                       ServiceController sc2 = new ServiceController ("Schedule", ".");
+                       ServiceController sc1 = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
+                       ServiceController sc2 = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
 
                        Assert.AreEqual (ServiceControllerStatus.Running, sc1.Status, "#A1");
                        Assert.AreEqual (ServiceControllerStatus.Running, sc2.Status, "#A2");
@@ -3197,10 +3236,10 @@ namespace MonoTests.System.ServiceProcess
                                sc1.Pause ();
                                Assert.Fail ("#D1");
                        } catch (InvalidOperationException ex) {
-                               // Cannot pause Schedule service on computer '.'
+                               // Cannot pause XXX service on computer '.'
                                Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#D2");
                                Assert.IsNotNull (ex.Message, "#D3");
-                               Assert.IsTrue (ex.Message.IndexOf ("Schedule") != -1, "#D4");
+                               Assert.IsTrue (ex.Message.IndexOf (CONTROLLABLE_SERVICE.ServiceName) != -1, "#D4");
                                Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#D5");
                                Assert.IsNotNull (ex.InnerException, "#D6");
 
@@ -3249,39 +3288,32 @@ namespace MonoTests.System.ServiceProcess
                        ServiceController [] dependentServices = null;
                        ServiceController [] servicesDependedOn = null;
 
-                       sc = new ServiceController ("NetDDE", ".");
+                       sc = new ServiceController (SERVICE_1_WITH_DEPENDENTS_AND_DEPENDED_ON.ServiceName, ".");
                        dependentServices = sc.DependentServices;
                        Assert.IsNotNull (dependentServices, "#A1");
-                       Assert.AreEqual (1, dependentServices.Length, "#A2");
-                       Assert.AreEqual ("ClipSrv", dependentServices [0].ServiceName, "#A3");
+                       Assert.AreEqual (SERVICE_1_WITH_DEPENDENTS_AND_DEPENDED_ON.Dependents, ServiceNames (dependentServices), "#A2");
                        servicesDependedOn = sc.ServicesDependedOn;
-                       Assert.IsNotNull (servicesDependedOn, "#A4");
-                       Assert.AreEqual (1, servicesDependedOn.Length, "#A5");
-                       Assert.AreEqual ("NetDDEDSDM", servicesDependedOn [0].ServiceName, "#A6");
+                       Assert.AreEqual (SERVICE_1_WITH_DEPENDENTS_AND_DEPENDED_ON.DependedOn, ServiceNames (servicesDependedOn), "#A3");
 
-                       sc.ServiceName = "rasman";
+                       sc.ServiceName = SERVICE_2_WITH_DEPENDENTS_AND_DEPENDED_ON.ServiceName;
                        sc.Refresh ();
 
                        dependentServices = sc.DependentServices;
                        Assert.IsNotNull (dependentServices, "#B1");
-                       Assert.AreEqual (1, dependentServices.Length, "#B2");
-                       Assert.AreEqual ("RasAuto", dependentServices [0].ServiceName, "#B3");
+                       Assert.AreEqual (SERVICE_2_WITH_DEPENDENTS_AND_DEPENDED_ON.Dependents, ServiceNames (dependentServices), "#B2");
                        servicesDependedOn = sc.ServicesDependedOn;
-                       Assert.IsNotNull (servicesDependedOn, "#B4");
-                       Assert.AreEqual (1, servicesDependedOn.Length, "#B5");
-                       Assert.AreEqual ("Tapisrv", servicesDependedOn [0].ServiceName, "#B6");
+                       Assert.IsNotNull (servicesDependedOn, "#B3");
+                       Assert.AreEqual (SERVICE_2_WITH_DEPENDENTS_AND_DEPENDED_ON.DependedOn, ServiceNames (servicesDependedOn), "#A4");
 
-                       sc.DisplayName = "NetDDE";
+                       sc.DisplayName = SERVICE_3_WITH_DEPENDENTS_AND_DEPENDED_ON.ServiceName;
                        sc.Refresh ();
 
                        dependentServices = sc.DependentServices;
                        Assert.IsNotNull (dependentServices, "#C1");
-                       Assert.AreEqual (1, dependentServices.Length, "#C2");
-                       Assert.AreEqual ("ClipSrv", dependentServices [0].ServiceName, "#C3");
+                       Assert.AreEqual (SERVICE_3_WITH_DEPENDENTS_AND_DEPENDED_ON.Dependents, ServiceNames (dependentServices), "#C2");
                        servicesDependedOn = sc.ServicesDependedOn;
-                       Assert.IsNotNull (servicesDependedOn, "#C4");
-                       Assert.AreEqual (1, servicesDependedOn.Length, "#C5");
-                       Assert.AreEqual ("NetDDEDSDM", servicesDependedOn [0].ServiceName, "#C6");
+                       Assert.IsNotNull (servicesDependedOn, "#C3");
+                       Assert.AreEqual (SERVICE_3_WITH_DEPENDENTS_AND_DEPENDED_ON.DependedOn, ServiceNames (servicesDependedOn), "#C4");
                }
 
                [Test]
@@ -3290,7 +3322,7 @@ namespace MonoTests.System.ServiceProcess
                        if (RunningOnUnix)
                                Assert.Ignore ("Running on Unix.");
 
-                       ServiceController sc = new ServiceController ("Schedule",
+                       ServiceController sc = new ServiceController (CONTROLLABLE_SERVICE.ServiceName,
                                "doesnotexist");
                        sc.Refresh ();
                }
@@ -3311,8 +3343,8 @@ namespace MonoTests.System.ServiceProcess
                        if (RunningOnUnix)
                                Assert.Ignore ("Running on Unix.");
 
-                       ServiceController sc1 = new ServiceController ("Schedule", ".");
-                       ServiceController sc2 = new ServiceController ("Schedule", ".");
+                       ServiceController sc1 = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
+                       ServiceController sc2 = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
 
                        Assert.AreEqual (ServiceControllerStatus.Running, sc1.Status, "#A1");
                        Assert.AreEqual (ServiceControllerStatus.Running, sc2.Status, "#A2");
@@ -3352,8 +3384,8 @@ namespace MonoTests.System.ServiceProcess
                        if (RunningOnUnix)
                                Assert.Ignore ("Running on Unix.");
 
-                       ServiceController sc1 = new ServiceController ("Schedule", ".");
-                       ServiceController sc2 = new ServiceController ("Schedule", ".");
+                       ServiceController sc1 = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
+                       ServiceController sc2 = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
 
                        Assert.AreEqual (ServiceControllerStatus.Running, sc1.Status, "#A1");
                        Assert.AreEqual (ServiceControllerStatus.Running, sc2.Status, "#A2");
@@ -3404,8 +3436,8 @@ namespace MonoTests.System.ServiceProcess
                        if (RunningOnUnix)
                                Assert.Ignore ("Running on Unix.");
 
-                       ServiceController sc1 = new ServiceController ("Schedule", ".");
-                       ServiceController sc2 = new ServiceController ("Schedule", ".");
+                       ServiceController sc1 = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
+                       ServiceController sc2 = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
 
                        Assert.AreEqual (ServiceControllerStatus.Running, sc1.Status, "#A1");
                        Assert.AreEqual (ServiceControllerStatus.Running, sc2.Status, "#A2");
@@ -3450,36 +3482,40 @@ namespace MonoTests.System.ServiceProcess
                        if (RunningOnUnix)
                                Assert.Ignore ("Running on Unix.");
 
+                       var s1 = WORKSTATION_SERVICE;
+                       var s2 = WINDOWS_SEARCH_SERVICE;
+
                        ServiceController sc = new ServiceController ();
-                       sc.ServiceName = "lanmanworkstation";
-                       Assert.AreEqual ("Workstation", sc.DisplayName, "#A1");
-                       Assert.AreEqual ("lanmanworkstation", sc.ServiceName, "#A2");
+                       sc.ServiceName = s1.ServiceName;
+                       Assert.AreEqual (s1.DisplayName, sc.DisplayName, "#A1");
+                       Assert.AreEqual (s1.ServiceName, sc.ServiceName, "#A2");
 
-                       sc.ServiceName = "alerter";
-                       Assert.AreEqual ("Alerter", sc.DisplayName, "#B1");
-                       Assert.AreEqual ("alerter", sc.ServiceName, "#B2");
+                       sc.ServiceName = s2.ServiceName;
+                       Assert.AreEqual (s2.DisplayName, sc.DisplayName, "#B1");
+                       Assert.AreEqual (s2.ServiceName, sc.ServiceName, "#B2");
 
-                       sc = new ServiceController ("lanmanworkstation");
-                       sc.ServiceName = "alerter";
-                       Assert.AreEqual ("alerter", sc.ServiceName, "#C1");
-                       Assert.AreEqual ("Alerter", sc.DisplayName, "#C2");
-                       Assert.AreEqual ("Alerter", sc.DisplayName, "#C3");
+                       sc = new ServiceController (s1.ServiceName);
+                       sc.ServiceName = s2.ServiceName;
+                       Assert.AreEqual (s2.ServiceName, sc.ServiceName, "#C1");
+                       Assert.AreEqual (s2.DisplayName, sc.DisplayName, "#C2");
+                       Assert.AreEqual (s2.DisplayName, sc.DisplayName, "#C3");
 
-                       sc.ServiceName = "alerter";
-                       Assert.AreEqual ("alerter", sc.ServiceName, "#D1");
-                       Assert.AreEqual ("Alerter", sc.DisplayName, "#D2");
+                       sc.ServiceName = s2.ServiceName;
+                       Assert.AreEqual (s2.ServiceName, sc.ServiceName, "#D1");
+                       Assert.AreEqual (s2.DisplayName, sc.DisplayName, "#D2");
 
-                       sc.ServiceName = "lanmanworkstation";
-                       Assert.AreEqual ("lanmanworkstation", sc.ServiceName, "#E1");
-                       Assert.AreEqual ("Workstation", sc.DisplayName, "#E2");
+                       sc.ServiceName = s1.ServiceName;
+                       Assert.AreEqual (s1.ServiceName, sc.ServiceName, "#E1");
+                       Assert.AreEqual (s1.DisplayName, sc.DisplayName, "#E2");
 
-                       sc = new ServiceController ("lanmanWorkstation");
-                       Assert.AreEqual ("lanmanWorkstation", sc.ServiceName, "#F1");
-                       Assert.AreEqual ("Workstation", sc.DisplayName, "#F2");
+                       sc = new ServiceController (s1.ServiceName.ToUpper ());
+                       Assert.AreEqual (s1.ServiceName.ToUpper (), sc.ServiceName, "#F1");
+                       Assert.AreEqual (s1.DisplayName, sc.DisplayName, "#F2");
 
-                       sc.ServiceName = "LanManWorkstation";
-                       Assert.AreEqual ("LanManWorkstation", sc.ServiceName, "#G1");
-                       Assert.AreEqual ("Workstation", sc.DisplayName, "#G2");
+                       var serviceName = s1.ServiceName [0].ToString ().ToUpper () + s1.ServiceName.Substring (1).ToLower ();
+                       sc.ServiceName = serviceName;
+                       Assert.AreEqual (serviceName, sc.ServiceName, "#G1");
+                       Assert.AreEqual (s1.DisplayName, sc.DisplayName, "#G2");
                }
 
                [Test]
@@ -3488,7 +3524,7 @@ namespace MonoTests.System.ServiceProcess
                        if (RunningOnUnix)
                                Assert.Ignore ("Running on Unix.");
 
-                       ServiceController sc = new ServiceController ("dmserver",
+                       ServiceController sc = new ServiceController (CONTROLLABLE_SERVICE.ServiceName,
                                "doesnotexist");
                        try {
                                string serviceName = sc.ServiceName;
@@ -3517,8 +3553,8 @@ namespace MonoTests.System.ServiceProcess
                        if (RunningOnUnix)
                                Assert.Ignore ("Running on Unix.");
 
-                       ServiceController sc = new ServiceController ("NetDDE", ".");
-                       Assert.AreEqual ("NetDDE", sc.ServiceName);
+                       ServiceController sc = new ServiceController (DISABLED_SERVICE.ServiceName, ".");
+                       Assert.AreEqual (DISABLED_SERVICE.ServiceName, sc.ServiceName);
                }
 
                [Test]
@@ -3556,9 +3592,9 @@ namespace MonoTests.System.ServiceProcess
                                Assert.Ignore ("Running on Unix.");
 
                        ServiceController sc = new ServiceController ();
-                       sc.ServiceName = "lanmanworkstation";
-                       Assert.AreEqual ("Workstation", sc.DisplayName, "#1");
-                       Assert.AreEqual ("lanmanworkstation", sc.ServiceName, "#2");
+                       sc.ServiceName = WORKSTATION_SERVICE.ServiceName;
+                       Assert.AreEqual (WORKSTATION_SERVICE.DisplayName, sc.DisplayName, "#1");
+                       Assert.AreEqual (WORKSTATION_SERVICE.ServiceName, sc.ServiceName, "#2");
                }
 
                [Test]
@@ -3601,10 +3637,10 @@ namespace MonoTests.System.ServiceProcess
                        Assert.AreEqual (string.Empty, sc.DisplayName, "#A1");
                        Assert.AreEqual (string.Empty, sc.ServiceName, "#A2");
 
-                       sc.ServiceName = "lanmanworkstation";
+                       sc.ServiceName = WORKSTATION_SERVICE.ServiceName;
 
-                       Assert.AreEqual ("Workstation", sc.DisplayName, "#B1");
-                       Assert.AreEqual ("lanmanworkstation", sc.ServiceName, "#B2");
+                       Assert.AreEqual (WORKSTATION_SERVICE.DisplayName, sc.DisplayName, "#B1");
+                       Assert.AreEqual (WORKSTATION_SERVICE.ServiceName, sc.ServiceName, "#B2");
 
                        try {
                                sc.ServiceName = string.Empty;
@@ -3628,7 +3664,7 @@ namespace MonoTests.System.ServiceProcess
                                Assert.Ignore ("Running on Unix.");
 
                        ServiceController sc = new ServiceController ();
-                       sc.ServiceName = "lanmanworkstation";
+                       sc.ServiceName = WORKSTATION_SERVICE.ServiceName;
                        try {
                                sc.ServiceName = null;
                                Assert.Fail ("#1");
@@ -3640,7 +3676,7 @@ namespace MonoTests.System.ServiceProcess
                                Assert.IsNull (ex.InnerException, "#6");
                        }
 
-                       Assert.AreEqual ("lanmanworkstation", sc.ServiceName, "#7");
+                       Assert.AreEqual (WORKSTATION_SERVICE.ServiceName, sc.ServiceName, "#7");
                }
 
                [Test]
@@ -3650,16 +3686,16 @@ namespace MonoTests.System.ServiceProcess
                                Assert.Ignore ("Running on Unix.");
 
                        ServiceController sc = new ServiceController ();
-                       sc.ServiceName = "workstation";
+                       sc.ServiceName = WORKSTATION_SERVICE.DisplayName.ToLower ();
                        try {
                                string displayName = sc.DisplayName;
                                Assert.Fail ("#1: " + displayName);
                        } catch (InvalidOperationException ex) {
-                               // Display name could not be retrieved for service workstation
+                               // Display name could not be retrieved for service XXX
                                // on computer '.'
                                Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#2");
                                Assert.IsNotNull (ex.Message, "#3");
-                               Assert.IsTrue (ex.Message.IndexOf ("workstation") != -1, "#4");
+                               Assert.IsTrue (ex.Message.IndexOf (WORKSTATION_SERVICE.DisplayName.ToLower ()) != -1, "#4");
                                Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#5");
                                Assert.IsNotNull (ex.InnerException, "#6");
 
@@ -3671,7 +3707,7 @@ namespace MonoTests.System.ServiceProcess
                                Assert.AreEqual (1060, win32Error.NativeErrorCode, "#10");
                                Assert.IsNull (win32Error.InnerException, "#11");
                        }
-                       Assert.AreEqual ("workstation", sc.ServiceName, "#12");
+                       Assert.AreEqual (WORKSTATION_SERVICE.DisplayName.ToLower (), sc.ServiceName, "#12");
                }
 
                [Test]
@@ -3684,27 +3720,27 @@ namespace MonoTests.System.ServiceProcess
                        ServiceController [] servicesDependedOn = null;
 
                        // single depended service
-                       sc = new ServiceController ("spooler", ".");
+                       sc = new ServiceController (SERVICE_WITH_ONE_DEPENDED_ON.ServiceName, ".");
                        servicesDependedOn = sc.ServicesDependedOn;
                        Assert.IsNotNull (servicesDependedOn, "#A1");
                        Assert.AreEqual (1, servicesDependedOn.Length, "#A2");
-                       Assert.AreEqual ("RPCSS", servicesDependedOn [0].ServiceName, "#A3");
+                       Assert.AreEqual (SERVICE_WITH_ONE_DEPENDED_ON.DependedOn, ServiceNames (servicesDependedOn), "#A3");
 
                        // modifying ServiceName does not cause cache to be cleared:
                        // https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=201762
-                       sc.ServiceName = "lanmanworkstation";
+                       sc.ServiceName = SERVICE_WITH_NO_DEPENDED_ON.ServiceName;
                        servicesDependedOn = sc.ServicesDependedOn;
                        Assert.IsNotNull (servicesDependedOn, "#B1");
                        Assert.AreEqual (1, servicesDependedOn.Length, "#B2");
-                       Assert.AreEqual ("RPCSS", servicesDependedOn [0].ServiceName, "#B3");
+                       Assert.AreEqual (SERVICE_WITH_ONE_DEPENDED_ON.DependedOn, ServiceNames (servicesDependedOn), "#B3");
 
                        // modifying DisplayName does not cause cache to be cleared:
                        // https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=201762
-                       sc.DisplayName = "alerter";
+                       sc.DisplayName = SERVICE_WITH_MANY_DEPENDED_ON.DisplayName;
                        servicesDependedOn = sc.ServicesDependedOn;
                        Assert.IsNotNull (servicesDependedOn, "#C1");
                        Assert.AreEqual (1, servicesDependedOn.Length, "#C2");
-                       Assert.AreEqual ("RPCSS", servicesDependedOn [0].ServiceName, "#C3");
+                       Assert.AreEqual (SERVICE_WITH_ONE_DEPENDED_ON.DependedOn, ServiceNames (servicesDependedOn), "#C3");
 
                        // modifying MachineName does not cause cache to be cleared:
                        // https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=201762
@@ -3712,24 +3748,24 @@ namespace MonoTests.System.ServiceProcess
                        servicesDependedOn = sc.ServicesDependedOn;
                        Assert.IsNotNull (servicesDependedOn, "#D1");
                        Assert.AreEqual (1, servicesDependedOn.Length, "#D2");
-                       Assert.AreEqual ("RPCSS", servicesDependedOn [0].ServiceName, "#D3");
+                       Assert.AreEqual (SERVICE_WITH_ONE_DEPENDED_ON.DependedOn, ServiceNames (servicesDependedOn), "#D3");
 
                        // no depended services
-                       sc = new ServiceController ("lanmanworkstation", ".");
+                       sc = new ServiceController (SERVICE_WITH_NO_DEPENDED_ON.ServiceName, ".");
                        servicesDependedOn = sc.ServicesDependedOn;
                        Assert.IsNotNull (servicesDependedOn, "#E1");
                        Assert.AreEqual (0, servicesDependedOn.Length, "#E2");
 
                        // modifying ServiceName does not cause cache to be cleared:
                        // https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=201762
-                       sc.ServiceName = "spooler";
+                       sc.ServiceName = SERVICE_WITH_MANY_DEPENDED_ON.ServiceName;
                        servicesDependedOn = sc.ServicesDependedOn;
                        Assert.IsNotNull (servicesDependedOn, "#F1");
                        Assert.AreEqual (0, servicesDependedOn.Length, "#F2");
 
                        // modifying DisplayName does not cause cache to be cleared:
                        // https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=201762
-                       sc.DisplayName = "Alerter";
+                       sc.DisplayName = SERVICE_WITH_ONE_DEPENDED_ON.DisplayName;
                        servicesDependedOn = sc.ServicesDependedOn;
                        Assert.IsNotNull (servicesDependedOn, "#G1");
                        Assert.AreEqual (0, servicesDependedOn.Length, "#G2");
@@ -3742,47 +3778,35 @@ namespace MonoTests.System.ServiceProcess
                        Assert.AreEqual (0, servicesDependedOn.Length, "#H2");
 
                        // multiple depended services
-                       sc = new ServiceController ("dmadmin", ".");
+                       sc = new ServiceController (SERVICE_WITH_MANY_DEPENDED_ON.ServiceName, ".");
                        servicesDependedOn = sc.ServicesDependedOn;
                        Assert.IsNotNull (servicesDependedOn, "#I1");
-                       Assert.AreEqual (3, servicesDependedOn.Length, "#I2");
-                       // do not rely on the order of the services
-                       Assert.IsTrue (ContainsService (servicesDependedOn, "RpcSs"), "#I3");
-                       Assert.IsTrue (ContainsService (servicesDependedOn, "PlugPlay"), "#I4");
-                       Assert.IsTrue (ContainsService (servicesDependedOn, "DmServer"), "#I5");
+                       Assert.AreEqual (SERVICE_WITH_MANY_DEPENDED_ON.DependedOn.Length, servicesDependedOn.Length, "#I2");
+                       Assert.AreEqual (SERVICE_WITH_MANY_DEPENDED_ON.DependedOn, ServiceNames (servicesDependedOn), "#I3");
 
                        // modifying ServiceName does not cause cache to be cleared:
                        // https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=201762
-                       sc.ServiceName = "spooler";
+                       sc.ServiceName = SERVICE_WITH_NO_DEPENDED_ON.ServiceName;
                        servicesDependedOn = sc.ServicesDependedOn;
                        Assert.IsNotNull (servicesDependedOn, "#J1");
-                       Assert.AreEqual (3, servicesDependedOn.Length, "#J2");
-                       // do not rely on the order of the services
-                       Assert.IsTrue (ContainsService (servicesDependedOn, "RpcSs"), "#J3");
-                       Assert.IsTrue (ContainsService (servicesDependedOn, "PlugPlay"), "#J4");
-                       Assert.IsTrue (ContainsService (servicesDependedOn, "DmServer"), "#J5");
+                       Assert.AreEqual (SERVICE_WITH_MANY_DEPENDED_ON.DependedOn.Length, servicesDependedOn.Length, "#J2");
+                       Assert.AreEqual (SERVICE_WITH_MANY_DEPENDED_ON.DependedOn, ServiceNames (servicesDependedOn), "#J3");
 
                        // modifying DisplayName does not cause cache to be cleared:
                        // https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=201762
-                       sc.DisplayName = "Alerter";
+                       sc.DisplayName = SERVICE_WITH_ONE_DEPENDED_ON.DisplayName;
                        servicesDependedOn = sc.ServicesDependedOn;
                        Assert.IsNotNull (servicesDependedOn, "#K1");
-                       Assert.AreEqual (3, servicesDependedOn.Length, "#K2");
-                       // do not rely on the order of the services
-                       Assert.IsTrue (ContainsService (servicesDependedOn, "RpcSs"), "#K3");
-                       Assert.IsTrue (ContainsService (servicesDependedOn, "PlugPlay"), "#K4");
-                       Assert.IsTrue (ContainsService (servicesDependedOn, "DmServer"), "#K5");
+                       Assert.AreEqual (SERVICE_WITH_MANY_DEPENDED_ON.DependedOn.Length, servicesDependedOn.Length, "#K2");
+                       Assert.AreEqual (SERVICE_WITH_MANY_DEPENDED_ON.DependedOn, ServiceNames (servicesDependedOn), "#K3");
 
                        // modifying MachineName does not cause cache to be cleared:
                        // https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=201762
                        sc.MachineName = Environment.MachineName;
                        servicesDependedOn = sc.ServicesDependedOn;
                        Assert.IsNotNull (servicesDependedOn, "#L1");
-                       Assert.AreEqual (3, servicesDependedOn.Length, "#L2");
-                       // do not rely on the order of the services
-                       Assert.IsTrue (ContainsService (servicesDependedOn, "RpcSs"), "#L3");
-                       Assert.IsTrue (ContainsService (servicesDependedOn, "PlugPlay"), "#L4");
-                       Assert.IsTrue (ContainsService (servicesDependedOn, "DmServer"), "#L5");
+                       Assert.AreEqual (SERVICE_WITH_MANY_DEPENDED_ON.DependedOn.Length, servicesDependedOn.Length, "#L2");
+                       Assert.AreEqual (SERVICE_WITH_MANY_DEPENDED_ON.DependedOn, ServiceNames (servicesDependedOn), "#L3");
                }
 
                [Test]
@@ -3791,7 +3815,7 @@ namespace MonoTests.System.ServiceProcess
                        if (RunningOnUnix)
                                Assert.Ignore ("Running on Unix.");
 
-                       ServiceController sc = new ServiceController ("dmserver",
+                       ServiceController sc = new ServiceController (CONTROLLABLE_SERVICE.ServiceName,
                                "doesnotexist");
                        try {
                                ServiceController [] servicesDependedOn = sc.ServicesDependedOn;
@@ -3820,11 +3844,10 @@ namespace MonoTests.System.ServiceProcess
                        if (RunningOnUnix)
                                Assert.Ignore ("Running on Unix.");
 
-                       ServiceController sc = new ServiceController ("ClipSrv", ".");
+                       ServiceController sc = new ServiceController (DISABLED_SERVICE.ServiceName, ".");
                        ServiceController [] servicesDependedOn = sc.ServicesDependedOn;
                        Assert.IsNotNull (servicesDependedOn, "#1");
-                       Assert.AreEqual (1, servicesDependedOn.Length, "#2");
-                       Assert.AreEqual ("NetDDE", servicesDependedOn [0].ServiceName, "#3");
+                       Assert.AreEqual (DISABLED_SERVICE.DependedOn, ServiceNames (servicesDependedOn), "#2");
                }
 
                [Test]
@@ -3882,11 +3905,11 @@ namespace MonoTests.System.ServiceProcess
 
                        ServiceController sc = null;
                        
-                       sc = new ServiceController ("dmserver", ".");
+                       sc = new ServiceController (SHARE_PROCESS_SERVICE.ServiceName, ".");
                        Assert.AreEqual (ServiceType.Win32ShareProcess, sc.ServiceType, "#A1");
-                       sc.ServiceName = "Disk";
+                       sc.ServiceName = KERNEL_SERVICE.ServiceName;
                        Assert.AreEqual (ServiceType.KernelDriver, sc.ServiceType, "#A2");
-                       sc.DisplayName = "Workstation";
+                       sc.DisplayName = SHARE_PROCESS_SERVICE.ServiceName;
                        Assert.AreEqual (ServiceType.Win32ShareProcess, sc.ServiceType, "#A3");
                        sc.MachineName = "doesnotexist";
                        try {
@@ -3909,13 +3932,13 @@ namespace MonoTests.System.ServiceProcess
                                Assert.IsNull (win32Error.InnerException, "#A13");
                        }
 
-                       sc = new ServiceController ("Disk", ".");
+                       sc = new ServiceController (KERNEL_SERVICE.ServiceName, ".");
                        Assert.AreEqual (ServiceType.KernelDriver, sc.ServiceType, "#B1");
-                       sc.DisplayName = "Alerter";
+                       sc.DisplayName = SHARE_PROCESS_SERVICE.DisplayName;
                        Assert.AreEqual (ServiceType.Win32ShareProcess, sc.ServiceType, "#B2");
                        sc.MachineName = Environment.MachineName;
                        Assert.AreEqual (ServiceType.Win32ShareProcess, sc.ServiceType, "#B3");
-                       sc.ServiceName = "Disk";
+                       sc.ServiceName = KERNEL_SERVICE.ServiceName;
                        Assert.AreEqual (ServiceType.KernelDriver, sc.ServiceType, "#B4");
                }
 
@@ -3925,7 +3948,7 @@ namespace MonoTests.System.ServiceProcess
                        if (RunningOnUnix)
                                Assert.Ignore ("Running on Unix.");
 
-                       ServiceController sc = new ServiceController ("dmserver",
+                       ServiceController sc = new ServiceController (SHARE_PROCESS_SERVICE.ServiceName,
                                "doesnotexist");
                        try {
                                ServiceType serviceType = sc.ServiceType;
@@ -3954,7 +3977,7 @@ namespace MonoTests.System.ServiceProcess
                        if (RunningOnUnix)
                                Assert.Ignore ("Running on Unix.");
 
-                       ServiceController sc = new ServiceController ("NetDDE", ".");
+                       ServiceController sc = new ServiceController (DISABLED_SERVICE.ServiceName, ".");
                        Assert.AreEqual (ServiceType.Win32ShareProcess, sc.ServiceType);
                }
 
@@ -3995,11 +4018,11 @@ namespace MonoTests.System.ServiceProcess
                        ServiceController sc = null;
 
                        sc = new ServiceController ();
-                       sc.DisplayName = "workstation";
+                       sc.DisplayName = SHARE_PROCESS_SERVICE.DisplayName.ToLower ();
                        Assert.AreEqual (ServiceType.Win32ShareProcess, sc.ServiceType, "#1");
 
                        sc = new ServiceController ();
-                       sc.DisplayName = "disk driver";
+                       sc.DisplayName = KERNEL_SERVICE.DisplayName.ToLower ();
                        Assert.AreEqual (ServiceType.KernelDriver, sc.ServiceType, "#2");
                }
 
@@ -4023,8 +4046,8 @@ namespace MonoTests.System.ServiceProcess
                        if (RunningOnUnix)
                                Assert.Ignore ("Running on Unix.");
 
-                       ServiceController sc1 = new ServiceController ("Schedule", ".");
-                       ServiceController sc2 = new ServiceController ("Schedule", ".");
+                       ServiceController sc1 = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
+                       ServiceController sc2 = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
 
                        Assert.AreEqual (ServiceControllerStatus.Running, sc1.Status, "#A1");
                        Assert.AreEqual (ServiceControllerStatus.Running, sc2.Status, "#A2");
@@ -4054,7 +4077,7 @@ namespace MonoTests.System.ServiceProcess
                        if (RunningOnUnix)
                                Assert.Ignore ("Running on Unix.");
 
-                       ServiceController sc = new ServiceController ("Schedule",
+                       ServiceController sc = new ServiceController (CONTROLLABLE_SERVICE.ServiceName,
                                "doesnotexist");
                        try {
                                sc.Stop ();
@@ -4083,8 +4106,8 @@ namespace MonoTests.System.ServiceProcess
                        if (RunningOnUnix)
                                Assert.Ignore ("Running on Unix.");
 
-                       ServiceController sc1 = new ServiceController ("NetDDE", ".");
-                       ServiceController sc2 = new ServiceController ("NetDDE", ".");
+                       ServiceController sc1 = new ServiceController (DISABLED_SERVICE.ServiceName, ".");
+                       ServiceController sc2 = new ServiceController (DISABLED_SERVICE.ServiceName, ".");
 
                        Assert.AreEqual (ServiceControllerStatus.Stopped, sc1.Status, "#A1");
                        Assert.AreEqual (ServiceControllerStatus.Stopped, sc2.Status, "#A2");
@@ -4096,7 +4119,7 @@ namespace MonoTests.System.ServiceProcess
                                // Cannot stop NetDDE service on computer '.'
                                Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#B2");
                                Assert.IsNotNull (ex.Message, "#B3");
-                               Assert.IsTrue (ex.Message.IndexOf ("NetDDE") != -1, "#B4");
+                               Assert.IsTrue (ex.Message.IndexOf (DISABLED_SERVICE.ServiceName) != -1, "#B4");
                                Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#B5");
                                Assert.IsNotNull (ex.InnerException, "#B6");
 
@@ -4147,8 +4170,8 @@ namespace MonoTests.System.ServiceProcess
                        if (RunningOnUnix)
                                Assert.Ignore ("Running on Unix.");
 
-                       ServiceController sc1 = new ServiceController ("SamSs", ".");
-                       ServiceController sc2 = new ServiceController ("SamSs", ".");
+                       ServiceController sc1 = new ServiceController (UNCONTROLLABLE_SERVICE.ServiceName, ".");
+                       ServiceController sc2 = new ServiceController (UNCONTROLLABLE_SERVICE.ServiceName, ".");
 
                        Assert.AreEqual (ServiceControllerStatus.Running, sc1.Status, "#A1");
                        Assert.AreEqual (ServiceControllerStatus.Running, sc2.Status, "#A2");
@@ -4157,10 +4180,10 @@ namespace MonoTests.System.ServiceProcess
                                sc1.Stop ();
                                Assert.Fail ("#B1");
                        } catch (InvalidOperationException ex) {
-                               // Cannot stop SamSs service on computer '.'
+                               // Cannot stop XXX service on computer '.'
                                Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#B2");
                                Assert.IsNotNull (ex.Message, "#B3");
-                               Assert.IsTrue (ex.Message.IndexOf ("SamSs") != -1, "#B4");
+                               Assert.IsTrue (ex.Message.IndexOf (UNCONTROLLABLE_SERVICE.ServiceName) != -1, "#B4");
                                Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#B5");
                                Assert.IsNotNull (ex.InnerException, "#B6");
 
@@ -4183,8 +4206,8 @@ namespace MonoTests.System.ServiceProcess
                        if (RunningOnUnix)
                                Assert.Ignore ("Running on Unix.");
 
-                       ServiceController sc1 = new ServiceController ("Schedule", ".");
-                       ServiceController sc2 = new ServiceController ("Schedule", ".");
+                       ServiceController sc1 = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
+                       ServiceController sc2 = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
 
                        Assert.AreEqual (ServiceControllerStatus.Running, sc1.Status, "#A1");
                        Assert.AreEqual (ServiceControllerStatus.Running, sc2.Status, "#A2");
@@ -4224,8 +4247,8 @@ namespace MonoTests.System.ServiceProcess
                        if (RunningOnUnix)
                                Assert.Ignore ("Running on Unix.");
 
-                       ServiceController sc1 = new ServiceController ("Schedule", ".");
-                       ServiceController sc2 = new ServiceController ("Schedule", ".");
+                       ServiceController sc1 = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
+                       ServiceController sc2 = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
 
                        Assert.AreEqual (ServiceControllerStatus.Running, sc1.Status, "#A1");
                        Assert.AreEqual (ServiceControllerStatus.Running, sc2.Status, "#A2");
@@ -4244,10 +4267,10 @@ namespace MonoTests.System.ServiceProcess
                                sc1.Stop ();
                                Assert.Fail ("#D1");
                        } catch (InvalidOperationException ex) {
-                               // Cannot stop Schedule service on computer '.'
+                               // Cannot stop XXX service on computer '.'
                                Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#D2");
                                Assert.IsNotNull (ex.Message, "#D3");
-                               Assert.IsTrue (ex.Message.IndexOf ("Schedule") != -1, "#D4");
+                               Assert.IsTrue (ex.Message.IndexOf (CONTROLLABLE_SERVICE.ServiceName) != -1, "#D4");
                                Assert.IsTrue (ex.Message.IndexOf ("'.'") != -1, "#D5");
                                Assert.IsNotNull (ex.InnerException, "#D6");
 
@@ -4292,8 +4315,8 @@ namespace MonoTests.System.ServiceProcess
                        if (RunningOnUnix)
                                Assert.Ignore ("Running on Unix.");
 
-                       ServiceController sc1 = new ServiceController ("Schedule", ".");
-                       ServiceController sc2 = new ServiceController ("Schedule", ".");
+                       ServiceController sc1 = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
+                       ServiceController sc2 = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
 
                        Assert.AreEqual (ServiceControllerStatus.Running, sc1.Status, "#A1");
                        Assert.AreEqual (ServiceControllerStatus.Running, sc2.Status, "#A2");
@@ -4338,7 +4361,7 @@ namespace MonoTests.System.ServiceProcess
                        if (RunningOnUnix)
                                Assert.Ignore ("Running on Unix.");
 
-                       ServiceController sc = new ServiceController ("Schedule",
+                       ServiceController sc = new ServiceController (CONTROLLABLE_SERVICE.ServiceName,
                                "doesnotexist");
                        try {
                                sc.WaitForStatus (ServiceControllerStatus.Stopped,
@@ -4368,8 +4391,8 @@ namespace MonoTests.System.ServiceProcess
                        if (RunningOnUnix)
                                Assert.Ignore ("Running on Unix.");
 
-                       ServiceController sc1 = new ServiceController ("NetDDE", ".");
-                       ServiceController sc2 = new ServiceController ("NetDDE", ".");
+                       ServiceController sc1 = new ServiceController (DISABLED_SERVICE.ServiceName, ".");
+                       ServiceController sc2 = new ServiceController (DISABLED_SERVICE.ServiceName, ".");
 
                        Assert.AreEqual (ServiceControllerStatus.Stopped, sc1.Status, "#A1");
                        Assert.AreEqual (ServiceControllerStatus.Stopped, sc2.Status, "#A2");
@@ -4428,8 +4451,8 @@ namespace MonoTests.System.ServiceProcess
                        if (RunningOnUnix)
                                Assert.Ignore ("Running on Unix.");
 
-                       ServiceController sc1 = new ServiceController ("SamSs", ".");
-                       ServiceController sc2 = new ServiceController ("SamSs", ".");
+                       ServiceController sc1 = new ServiceController (UNCONTROLLABLE_SERVICE.ServiceName, ".");
+                       ServiceController sc2 = new ServiceController (UNCONTROLLABLE_SERVICE.ServiceName, ".");
 
                        Assert.AreEqual (ServiceControllerStatus.Running, sc1.Status, "#A1");
                        Assert.AreEqual (ServiceControllerStatus.Running, sc2.Status, "#A2");
@@ -4480,8 +4503,8 @@ namespace MonoTests.System.ServiceProcess
                        if (RunningOnUnix)
                                Assert.Ignore ("Running on Unix.");
 
-                       ServiceController sc1 = new ServiceController ("Schedule", ".");
-                       ServiceController sc2 = new ServiceController ("Schedule", ".");
+                       ServiceController sc1 = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
+                       ServiceController sc2 = new ServiceController (CONTROLLABLE_SERVICE.ServiceName, ".");
 
                        Assert.AreEqual (ServiceControllerStatus.Running, sc1.Status, "#A1");
                        Assert.AreEqual (ServiceControllerStatus.Running, sc2.Status, "#A2");
@@ -4503,6 +4526,28 @@ namespace MonoTests.System.ServiceProcess
                        Assert.AreEqual (ServiceControllerStatus.Running, sc2.Status, "#C2");
                }
 
+               // Run this on .NET to generate ServiceInfo objects for services on the current machine
+//             [Test]
+               public static void DumpServices ()
+               {
+                       foreach (ServiceController sc in ServiceController.GetServices ()) {
+                               try {
+                                       var si = new ServiceInfo { ServiceName = sc.ServiceName, DisplayName = sc.DisplayName, ServiceType = sc.ServiceType, Dependents = ServiceNames (sc.DependentServices), DependedOn = ServiceNames (sc.ServicesDependedOn) };
+                                       var l = new List<string> ();
+                                       l.Add ($"ServiceName = \"{si.ServiceName}\"");
+                                       l.Add ($"DisplayName = \"{si.DisplayName}\"");
+                                       if (si.ServiceType != ServiceType.Win32ShareProcess)
+                                               l.Add ($"ServiceType = ServiceType.{si.ServiceType}");
+                                       if (si.Dependents.Length > 0)
+                                               l.Add ("Dependents = new [] { \"" + String.Join ("\", \"", si.Dependents) + "\" }");
+                                       if (si.DependedOn.Length > 0)
+                                               l.Add ("DependedOn = new [] { \"" + String.Join ("\", \"", si.DependedOn) + "\" }");
+                                       Console.WriteLine ("static ServiceInfo " + si.DisplayName.ToUpper ().Replace (' ', '_').Replace ('-', '_') + "_SERVICE = new ServiceInfo { " + String.Join (", ", l) + " };");
+                               } catch {
+                               }
+                       }
+               }
+
                private static void EnsureServiceIsRunning (ServiceController sc)
                {
                        sc.Refresh ();
@@ -4543,6 +4588,15 @@ namespace MonoTests.System.ServiceProcess
                        return false;
                }
 
+               private static string[] ServiceNames (ServiceController [] services)
+               {
+                       var result = new string [services.Length];
+                       for (var i = 0; i < result.Length; i++)
+                               result [i] = services [i].ServiceName.ToLower ();
+                       Array.Sort<string> (result);
+                       return result;
+               }
+
                private bool RunningOnUnix
                {
                        get {
index a793bf739fc8c9d0daf85ee11da99df0082176aa..605835807d85e8a95a8669b17b01e61d19fa8a60 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;CONCURRENT_COLLECTIONS</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;CONCURRENT_COLLECTIONS</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;CONCURRENT_COLLECTIONS</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;CONCURRENT_COLLECTIONS</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index bec9f30a1884947be265b146bcbe9a14ad3d76e3..46953497fd3b0669a9f1d3339492d34c64df71ba 100644 (file)
@@ -131,7 +131,7 @@ namespace MonoTests.System.Threading.Tasks.Dataflow {
                        Assert.IsTrue (transform.Post (1));
                        Assert.IsTrue (transform.Post (2));
 
-                       Assert.GreaterOrEqual (scheduler.ExecuteAll (), 1);
+                       AssertHelper.GreaterOrEqual (scheduler.ExecuteAll (), 1);
 
                        Assert.AreEqual (2, Volatile.Read (ref n));
                }
@@ -154,7 +154,7 @@ namespace MonoTests.System.Threading.Tasks.Dataflow {
                        Assert.IsTrue (transform.Post (1));
                        Assert.IsTrue (transform.Post (2));
 
-                       Assert.GreaterOrEqual (scheduler.ExecuteAll (), 1);
+                       AssertHelper.GreaterOrEqual (scheduler.ExecuteAll (), 1);
 
                        Assert.AreEqual (2, Volatile.Read (ref n));
                }
@@ -177,7 +177,7 @@ namespace MonoTests.System.Threading.Tasks.Dataflow {
 
                        Assert.IsFalse (transform.Post (101));
 
-                       Assert.GreaterOrEqual (scheduler.ExecuteAll (), 1);
+                       AssertHelper.GreaterOrEqual (scheduler.ExecuteAll (), 1);
 
                        Assert.IsFalse (transform.Post (102));
 
index f897f06e23ec0462959abcb771decc277aa2ed6f..65ed145d72c40b9180e7655942714c806f95108e 100644 (file)
@@ -128,7 +128,7 @@ namespace MonoTests.System.Threading.Tasks.Dataflow {
 
                        Assert.IsNotNull (ex);
                        Assert.IsNotNull (ex.InnerException);
-                       Assert.IsInstanceOfType (typeof(OperationCanceledException),
+                       Assert.IsInstanceOfType (typeof(TaskCanceledException),
                                ex.InnerException);
                        Assert.IsTrue (task.IsCompleted);
                        Assert.AreEqual (TaskStatus.Canceled, task.Status);
index 6d87932058401cac0c2528c0ed6da421068ea900..087385c2ffc4f9e009a6d4815195fc2a9229cdc6 100644 (file)
@@ -90,7 +90,7 @@ namespace MonoTests.System.Threading.Tasks.Dataflow {
                                var queue = new ConcurrentQueue<Tuple<int, int>> ();
                                var block = factory (queue);
 
-                               Assert.IsEmpty (queue);
+                               CollectionAssert.IsEmpty (queue);
 
                                for (int i = 0; i < 100; i++)
                                        block.Post (i);
@@ -170,15 +170,15 @@ namespace MonoTests.System.Threading.Tasks.Dataflow {
 
                                options = new ExecutionDataflowBlockOptions { MaxDegreeOfParallelism = 2 };
                                foreach (var taskIds in GetTaskIdsForExecutionsOptions (options))
-                                       Assert.LessOrEqual (CalculateDegreeOfParallelism (taskIds), 2);
+                                       AssertHelper.LessOrEqual (CalculateDegreeOfParallelism (taskIds), 2);
 
                                options = new ExecutionDataflowBlockOptions { MaxDegreeOfParallelism = 4 };
                                foreach (var taskIds in GetTaskIdsForExecutionsOptions (options))
-                                       Assert.LessOrEqual (CalculateDegreeOfParallelism (taskIds), 4);
+                                       AssertHelper.LessOrEqual (CalculateDegreeOfParallelism (taskIds), 4);
 
                                options = new ExecutionDataflowBlockOptions { MaxDegreeOfParallelism = -1 };
                                foreach (var taskIds in GetTaskIdsForExecutionsOptions (options))
-                                       Assert.LessOrEqual (CalculateDegreeOfParallelism (taskIds), taskIds.Length);
+                                       AssertHelper.LessOrEqual (CalculateDegreeOfParallelism (taskIds), taskIds.Length);
                        }
                }
 
@@ -187,7 +187,7 @@ namespace MonoTests.System.Threading.Tasks.Dataflow {
                {
                        var options = new ExecutionDataflowBlockOptions ();
                        foreach (var taskIds in GetTaskIdsForExecutionsOptions (options))
-                               Assert.GreaterOrEqual (taskIds.Distinct ().Count (), 1);
+                               AssertHelper.GreaterOrEqual (taskIds.Distinct ().Count (), 1);
 
                        options = new ExecutionDataflowBlockOptions { MaxMessagesPerTask = 1 };
                        foreach (var taskIds in GetTaskIdsForExecutionsOptions (options))
@@ -195,11 +195,11 @@ namespace MonoTests.System.Threading.Tasks.Dataflow {
 
                        options = new ExecutionDataflowBlockOptions { MaxMessagesPerTask = 2 };
                        foreach (var taskIds in GetTaskIdsForExecutionsOptions (options))
-                               Assert.GreaterOrEqual (taskIds.Distinct ().Count (), taskIds.Length / 2);
+                               AssertHelper.GreaterOrEqual (taskIds.Distinct ().Count (), taskIds.Length / 2);
 
                        options = new ExecutionDataflowBlockOptions { MaxMessagesPerTask = 4 };
                        foreach (var taskIds in GetTaskIdsForExecutionsOptions (options))
-                               Assert.GreaterOrEqual (taskIds.Distinct ().Count (), taskIds.Length / 4);
+                               AssertHelper.GreaterOrEqual (taskIds.Distinct ().Count (), taskIds.Length / 4);
                }
 
                [Test]
index 3901a55afcd66efc16d509179183619a08f15916..b2193a91ba05029e967643024c803ee7a21de3f3 100644 (file)
@@ -68,9 +68,9 @@ namespace MonoTests.System.Threading.Tasks.Dataflow {
                        for (int i = 0; i < array.Length; ++i)
                                Assert.IsTrue (block.Post (i), "Not accepted");
 
-                       Thread.Sleep (300);
+                       Thread.Sleep (600);
                        block.LinkTo (action);
-                       Thread.Sleep (100);
+                       Thread.Sleep (300);
 
                        CollectionAssert.AreEqual (new[] { 0, -1, -2, -3, -4, -5, -6, -7, -8, -9 }, array);
                }
index 0040fd6840b17b446d8eaca8e51b434d279d5b46..f41504c857ec237691508e4f5363609aba14dc9b 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index b7bfc3e76b57a1ebd6138fa56004e6ad47b2fc75..ab01576214c284bf011e4b6981b612a013712d76 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 461643c497be3fb04509e909a0f06f17c22cc2cb..f9a9fb250f87cfb52c985e3037676f19d4edc093 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;SYSTEM_WEB_APPLICATIONSERVICES</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;SYSTEM_WEB_APPLICATIONSERVICES</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;SYSTEM_WEB_APPLICATIONSERVICES</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;SYSTEM_WEB_APPLICATIONSERVICES</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 84781bfe0b9fd06b4142c3fbf9493afc157f18b4..ebd674760cc8a02bc30c8906665e343940f658f2 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index f619c25efb836f13b1917d0271c2844403b5ec34..67e3e1a64087ed1f59f6793603081d499d3dc91c 100644 (file)
@@ -1,3 +1,4 @@
+../../test-helpers/NunitHelpers.cs
 ../../System.Web/Test/mainsoft/MainsoftWebTest/HtmlAgilityPack/crc32.cs
 ../../System.Web/Test/mainsoft/MainsoftWebTest/HtmlAgilityPack/Header.cs
 ../../System.Web/Test/mainsoft/MainsoftWebTest/HtmlAgilityPack/HtmlAttribute.cs
@@ -71,7 +72,6 @@ Common/FooWithToString.cs
 Common/ITestDataContext.cs
 Common/KnownResponseHeader.cs
 Common/MiscExtensions.cs
-Common/Mocks.cs
 Common/MyDynamicDataRouteHandler.cs
 Common/MyHttpContextWrapper.cs
 Common/MyHttpRequestWrapper.cs
diff --git a/mcs/class/System.Web.DynamicData/Test/Common/Mocks.cs b/mcs/class/System.Web.DynamicData/Test/Common/Mocks.cs
deleted file mode 100644 (file)
index 5010769..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Web;
-
-using NUnit.Framework;
-using NUnit.Mocks;
-
-namespace MonoTests.Common
-{
-    static class Mocks
-    {
-     
-    }
-}
index cbd6a10a5331af005b1c8f7125f438a3818a7015..7f2d214ea49ef93befc1f62dec1af8d97e6d3357 100644 (file)
@@ -52,7 +52,6 @@ using System.Web.UI.WebControls;
 using System.IO;
 
 using NUnit.Framework;
-using NUnit.Mocks;
 using MonoTests.stand_alone.WebHarness;
 using MonoTests.SystemWeb.Framework;
 using MonoTests.Common;
index b144e17e4ed64f676c0b9b7d9895ec0da0153d6a..b44c8bd9327ed8fcedede646fba2d66487cef16e 100644 (file)
@@ -47,7 +47,6 @@ using System.Web.DynamicData.ModelProviders;
 using System.Web.Routing;
 
 using NUnit.Framework;
-using NUnit.Mocks;
 using MonoTests.stand_alone.WebHarness;
 using MonoTests.SystemWeb.Framework;
 using MonoTests.Common;
index 3954861970bb5b674e8c4d44ed149a535c14ceda..1151fb86612a273fe4d427e4c80eb0f29147ae99 100644 (file)
@@ -49,7 +49,6 @@ using System.Web.DynamicData.ModelProviders;
 using System.Web.Routing;
 
 using NUnit.Framework;
-using NUnit.Mocks;
 using MonoTests.stand_alone.WebHarness;
 using MonoTests.SystemWeb.Framework;
 using MonoTests.Common;
index 6f5f4fdd3dc22f3f4879dad9fbec0357577deba5..0884c7a5cef1aa91ea4f05625d08844f98d1921c 100644 (file)
@@ -52,7 +52,6 @@ using System.Web.UI.WebControls;
 using System.IO;
 
 using NUnit.Framework;
-using NUnit.Mocks;
 using MonoTests.stand_alone.WebHarness;
 using MonoTests.SystemWeb.Framework;
 using MonoTests.Common;
index 4398b8bf4f5e42b01efb1a3b3c26b6736fbc2f97..8362f3b6a96ccebb306b4c78c13b6a462737cfec 100644 (file)
@@ -52,7 +52,6 @@ using System.Web.UI.WebControls;
 using System.IO;
 
 using NUnit.Framework;
-using NUnit.Mocks;
 using MonoTests.stand_alone.WebHarness;
 using MonoTests.SystemWeb.Framework;
 using MonoTests.Common;
@@ -647,7 +646,7 @@ namespace MonoTests.System.Web.DynamicData
                        // Custom with UIHint attribute
                        mc = t.GetColumn ("CustomColumn2");
                        Assert.IsNotNull (mc.UIHint, "#A2");
-                       Assert.Greater (mc.UIHint.Length, 0, "#A2-1");
+                       AssertHelper.Greater (mc.UIHint.Length, 0, "#A2-1");
 
                        // Proves that UIHint on the column is not used, just the uiHint argument
                        AssertExtensions.Throws<InvalidOperationException> (() => {
@@ -669,7 +668,7 @@ namespace MonoTests.System.Web.DynamicData
                        // Custom with UIHint attribute
                        mc = t.GetColumn ("CustomColumn4");
                        Assert.IsNotNull (mc.UIHint, "#A4");
-                       Assert.Greater (mc.UIHint.Length, 0, "#A4-1");
+                       AssertHelper.Greater (mc.UIHint.Length, 0, "#A4-1");
 
                        // Proves that UIHint on the column is not used, just the uiHint argument
                        Assert.AreEqual (ftf.TemplateFolderVirtualPath + "Text.ascx", ftf.GetFieldTemplateVirtualPath (mc, DataBoundControlMode.ReadOnly, null), "#A4-2");
@@ -686,7 +685,7 @@ namespace MonoTests.System.Web.DynamicData
 
                        mc = t.GetColumn ("DateTimeColumn2");
                        Assert.IsNotNull (mc.UIHint, "#B2");
-                       Assert.Greater (mc.UIHint.Length, 0, "#B2-1");
+                       AssertHelper.Greater (mc.UIHint.Length, 0, "#B2-1");
                        Assert.AreEqual (ftf.TemplateFolderVirtualPath + "DateTime.ascx", ftf.GetFieldTemplateVirtualPath (mc, DataBoundControlMode.ReadOnly, null), "#B2-3");
                        Assert.AreEqual (ftf.TemplateFolderVirtualPath + "DateTime.ascx", ftf.GetFieldTemplateVirtualPath (mc, DataBoundControlMode.ReadOnly, String.Empty), "#B2-4");
                        Assert.AreEqual (ftf.TemplateFolderVirtualPath + "DateTime.ascx", ftf.GetFieldTemplateVirtualPath (mc, DataBoundControlMode.ReadOnly, "Boolean.ascx"), "#B2-5");
@@ -701,7 +700,7 @@ namespace MonoTests.System.Web.DynamicData
 
                        mc = t.GetColumn ("DateColumn2");
                        Assert.IsNotNull (mc.UIHint, "#C2");
-                       Assert.Greater (mc.UIHint.Length, 0, "#C2-1");
+                       AssertHelper.Greater (mc.UIHint.Length, 0, "#C2-1");
                        Assert.AreEqual (ftf.TemplateFolderVirtualPath + "Text.ascx", ftf.GetFieldTemplateVirtualPath (mc, DataBoundControlMode.ReadOnly, null), "#C2-3");
                        Assert.AreEqual (ftf.TemplateFolderVirtualPath + "Text.ascx", ftf.GetFieldTemplateVirtualPath (mc, DataBoundControlMode.ReadOnly, String.Empty), "#C2-4");
                        Assert.AreEqual (ftf.TemplateFolderVirtualPath + "Text.ascx", ftf.GetFieldTemplateVirtualPath (mc, DataBoundControlMode.ReadOnly, "Boolean.ascx"), "#C2-5");
@@ -715,7 +714,7 @@ namespace MonoTests.System.Web.DynamicData
 
                        mc = t.GetColumn ("DateColumn4");
                        Assert.IsNotNull (mc.UIHint, "#C4");
-                       Assert.Greater (mc.UIHint.Length, 0, "#C4-1");
+                       AssertHelper.Greater (mc.UIHint.Length, 0, "#C4-1");
                        Assert.AreEqual (ftf.TemplateFolderVirtualPath + "Text.ascx", ftf.GetFieldTemplateVirtualPath (mc, DataBoundControlMode.ReadOnly, null), "#C4-3");
                        Assert.AreEqual (ftf.TemplateFolderVirtualPath + "Text.ascx", ftf.GetFieldTemplateVirtualPath (mc, DataBoundControlMode.ReadOnly, String.Empty), "#C4-4");
                        Assert.AreEqual (ftf.TemplateFolderVirtualPath + "Text.ascx", ftf.GetFieldTemplateVirtualPath (mc, DataBoundControlMode.ReadOnly, "Boolean.ascx"), "#C4-5");
@@ -730,7 +729,7 @@ namespace MonoTests.System.Web.DynamicData
 
                        mc = t.GetColumn ("TimeColumn2");
                        Assert.IsNotNull (mc.UIHint, "#D2");
-                       Assert.Greater (mc.UIHint.Length, 0, "#D2-1");
+                       AssertHelper.Greater (mc.UIHint.Length, 0, "#D2-1");
                        Assert.AreEqual (ftf.TemplateFolderVirtualPath + "Text.ascx", ftf.GetFieldTemplateVirtualPath (mc, DataBoundControlMode.ReadOnly, null), "#D2-3");
                        Assert.AreEqual (ftf.TemplateFolderVirtualPath + "Text.ascx", ftf.GetFieldTemplateVirtualPath (mc, DataBoundControlMode.ReadOnly, String.Empty), "#D2-4");
                        Assert.AreEqual (ftf.TemplateFolderVirtualPath + "Text.ascx", ftf.GetFieldTemplateVirtualPath (mc, DataBoundControlMode.ReadOnly, "Boolean.ascx"), "#D2-5");
@@ -745,7 +744,7 @@ namespace MonoTests.System.Web.DynamicData
 
                        mc = t.GetColumn ("DurationColumn2");
                        Assert.IsNotNull (mc.UIHint, "#E2");
-                       Assert.Greater (mc.UIHint.Length, 0, "#E2-1");
+                       AssertHelper.Greater (mc.UIHint.Length, 0, "#E2-1");
                        Assert.AreEqual (ftf.TemplateFolderVirtualPath + "Text.ascx", ftf.GetFieldTemplateVirtualPath (mc, DataBoundControlMode.ReadOnly, null), "#E2-3");
                        Assert.AreEqual (ftf.TemplateFolderVirtualPath + "Text.ascx", ftf.GetFieldTemplateVirtualPath (mc, DataBoundControlMode.ReadOnly, String.Empty), "#E2-4");
                        Assert.AreEqual (ftf.TemplateFolderVirtualPath + "Text.ascx", ftf.GetFieldTemplateVirtualPath (mc, DataBoundControlMode.ReadOnly, "Boolean.ascx"), "#E2-5");
@@ -760,7 +759,7 @@ namespace MonoTests.System.Web.DynamicData
 
                        mc = t.GetColumn ("PhoneNumberColumn2");
                        Assert.IsNotNull (mc.UIHint, "#F2");
-                       Assert.Greater (mc.UIHint.Length, 0, "#F2-1");
+                       AssertHelper.Greater (mc.UIHint.Length, 0, "#F2-1");
                        Assert.AreEqual (ftf.TemplateFolderVirtualPath + "Text.ascx", ftf.GetFieldTemplateVirtualPath (mc, DataBoundControlMode.ReadOnly, null), "#F2-3");
                        Assert.AreEqual (ftf.TemplateFolderVirtualPath + "Text.ascx", ftf.GetFieldTemplateVirtualPath (mc, DataBoundControlMode.ReadOnly, String.Empty), "#F2-4");
                        Assert.AreEqual (ftf.TemplateFolderVirtualPath + "Text.ascx", ftf.GetFieldTemplateVirtualPath (mc, DataBoundControlMode.ReadOnly, "Boolean.ascx"), "#F2-5");
@@ -775,7 +774,7 @@ namespace MonoTests.System.Web.DynamicData
 
                        mc = t.GetColumn ("CurrencyColumn2");
                        Assert.IsNotNull (mc.UIHint, "#G2");
-                       Assert.Greater (mc.UIHint.Length, 0, "#G2-1");
+                       AssertHelper.Greater (mc.UIHint.Length, 0, "#G2-1");
                        Assert.AreEqual (ftf.TemplateFolderVirtualPath + "Text.ascx", ftf.GetFieldTemplateVirtualPath (mc, DataBoundControlMode.ReadOnly, null), "#G2-3");
                        Assert.AreEqual (ftf.TemplateFolderVirtualPath + "Text.ascx", ftf.GetFieldTemplateVirtualPath (mc, DataBoundControlMode.ReadOnly, String.Empty), "#G2-4");
                        Assert.AreEqual (ftf.TemplateFolderVirtualPath + "Text.ascx", ftf.GetFieldTemplateVirtualPath (mc, DataBoundControlMode.ReadOnly, "Boolean.ascx"), "#G2-5");
@@ -790,7 +789,7 @@ namespace MonoTests.System.Web.DynamicData
 
                        mc = t.GetColumn ("TextColumn2");
                        Assert.IsNotNull (mc.UIHint, "#H2");
-                       Assert.Greater (mc.UIHint.Length, 0, "#H2-1");
+                       AssertHelper.Greater (mc.UIHint.Length, 0, "#H2-1");
                        Assert.AreEqual (ftf.TemplateFolderVirtualPath + "Text.ascx", ftf.GetFieldTemplateVirtualPath (mc, DataBoundControlMode.ReadOnly, null), "#H2-3");
                        Assert.AreEqual (ftf.TemplateFolderVirtualPath + "Text.ascx", ftf.GetFieldTemplateVirtualPath (mc, DataBoundControlMode.ReadOnly, String.Empty), "#H2-4");
                        Assert.AreEqual (ftf.TemplateFolderVirtualPath + "Text.ascx", ftf.GetFieldTemplateVirtualPath (mc, DataBoundControlMode.ReadOnly, "Boolean.ascx"), "#H2-5");
@@ -805,7 +804,7 @@ namespace MonoTests.System.Web.DynamicData
 
                        mc = t.GetColumn ("HtmlColumn2");
                        Assert.IsNotNull (mc.UIHint, "#I2");
-                       Assert.Greater (mc.UIHint.Length, 0, "#I2-1");
+                       AssertHelper.Greater (mc.UIHint.Length, 0, "#I2-1");
                        Assert.AreEqual (ftf.TemplateFolderVirtualPath + "Text.ascx", ftf.GetFieldTemplateVirtualPath (mc, DataBoundControlMode.ReadOnly, null), "#I2-3");
                        Assert.AreEqual (ftf.TemplateFolderVirtualPath + "Text.ascx", ftf.GetFieldTemplateVirtualPath (mc, DataBoundControlMode.ReadOnly, String.Empty), "#I2-4");
                        Assert.AreEqual (ftf.TemplateFolderVirtualPath + "Text.ascx", ftf.GetFieldTemplateVirtualPath (mc, DataBoundControlMode.ReadOnly, "Boolean.ascx"), "#I2-5");
@@ -820,7 +819,7 @@ namespace MonoTests.System.Web.DynamicData
 
                        mc = t.GetColumn ("MultilineTextColumn2");
                        Assert.IsNotNull (mc.UIHint, "#J2");
-                       Assert.Greater (mc.UIHint.Length, 0, "#J2-1");
+                       AssertHelper.Greater (mc.UIHint.Length, 0, "#J2-1");
                        Assert.AreEqual (ftf.TemplateFolderVirtualPath + "Text.ascx", ftf.GetFieldTemplateVirtualPath (mc, DataBoundControlMode.ReadOnly, null), "#J2-3");
                        Assert.AreEqual (ftf.TemplateFolderVirtualPath + "Text.ascx", ftf.GetFieldTemplateVirtualPath (mc, DataBoundControlMode.ReadOnly, String.Empty), "#J2-4");
                        Assert.AreEqual (ftf.TemplateFolderVirtualPath + "Text.ascx", ftf.GetFieldTemplateVirtualPath (mc, DataBoundControlMode.ReadOnly, "Boolean.ascx"), "#J2-5");
@@ -835,7 +834,7 @@ namespace MonoTests.System.Web.DynamicData
 
                        mc = t.GetColumn ("EmailAddressColumn2");
                        Assert.IsNotNull (mc.UIHint, "#K2");
-                       Assert.Greater (mc.UIHint.Length, 0, "#K2-1");
+                       AssertHelper.Greater (mc.UIHint.Length, 0, "#K2-1");
                        Assert.AreEqual (ftf.TemplateFolderVirtualPath + "Text.ascx", ftf.GetFieldTemplateVirtualPath (mc, DataBoundControlMode.ReadOnly, null), "#K2-3");
                        Assert.AreEqual (ftf.TemplateFolderVirtualPath + "Text.ascx", ftf.GetFieldTemplateVirtualPath (mc, DataBoundControlMode.ReadOnly, String.Empty), "#K2-4");
                        Assert.AreEqual (ftf.TemplateFolderVirtualPath + "Text.ascx", ftf.GetFieldTemplateVirtualPath (mc, DataBoundControlMode.ReadOnly, "Boolean.ascx"), "#K2-5");
@@ -850,7 +849,7 @@ namespace MonoTests.System.Web.DynamicData
 
                        mc = t.GetColumn ("PasswordColumn2");
                        Assert.IsNotNull (mc.UIHint, "#L2");
-                       Assert.Greater (mc.UIHint.Length, 0, "#L2-1");
+                       AssertHelper.Greater (mc.UIHint.Length, 0, "#L2-1");
                        Assert.AreEqual (ftf.TemplateFolderVirtualPath + "Text.ascx", ftf.GetFieldTemplateVirtualPath (mc, DataBoundControlMode.ReadOnly, null), "#L2-3");
                        Assert.AreEqual (ftf.TemplateFolderVirtualPath + "Text.ascx", ftf.GetFieldTemplateVirtualPath (mc, DataBoundControlMode.ReadOnly, String.Empty), "#L2-4");
                        Assert.AreEqual (ftf.TemplateFolderVirtualPath + "Text.ascx", ftf.GetFieldTemplateVirtualPath (mc, DataBoundControlMode.ReadOnly, "Boolean.ascx"), "#L2-5");
@@ -865,7 +864,7 @@ namespace MonoTests.System.Web.DynamicData
 
                        mc = t.GetColumn ("UrlColumn2");
                        Assert.IsNotNull (mc.UIHint, "#M2");
-                       Assert.Greater (mc.UIHint.Length, 0, "#M2-1");
+                       AssertHelper.Greater (mc.UIHint.Length, 0, "#M2-1");
                        Assert.AreEqual (ftf.TemplateFolderVirtualPath + "Text.ascx", ftf.GetFieldTemplateVirtualPath (mc, DataBoundControlMode.ReadOnly, null), "#M2-3");
                        Assert.AreEqual (ftf.TemplateFolderVirtualPath + "Text.ascx", ftf.GetFieldTemplateVirtualPath (mc, DataBoundControlMode.ReadOnly, String.Empty), "#M2-4");
                        Assert.AreEqual (ftf.TemplateFolderVirtualPath + "Text.ascx", ftf.GetFieldTemplateVirtualPath (mc, DataBoundControlMode.ReadOnly, "Boolean.ascx"), "#M2-5");
index 46de57ad76c287813c64267eddba63dfca055946..423237d1ec0fa6c95cc6227714325f5c37d3bee7 100644 (file)
@@ -52,7 +52,6 @@ using System.Web.UI.WebControls;
 using System.IO;
 
 using NUnit.Framework;
-using NUnit.Mocks;
 using MonoTests.stand_alone.WebHarness;
 using MonoTests.SystemWeb.Framework;
 using MonoTests.Common;
index e2e1e24b1548853ef3371778c24f9b72d11284fe..17766eae14e236c4b4504c655c5e74893b112581 100644 (file)
@@ -47,7 +47,6 @@ using System.Web.DynamicData.ModelProviders;
 using System.Web.Routing;
 
 using NUnit.Framework;
-using NUnit.Mocks;
 using MonoTests.stand_alone.WebHarness;
 using MonoTests.SystemWeb.Framework;
 using MonoTests.Common;
index fe43459bfc717f97c93a55496e08f2494c92474b..ed33152de0d52e743bc7730e216bfd4b764ccf33 100644 (file)
@@ -48,7 +48,6 @@ using System.Web.DynamicData.ModelProviders;
 using System.Web.Routing;
 
 using NUnit.Framework;
-using NUnit.Mocks;
 using MonoTests.stand_alone.WebHarness;
 using MonoTests.SystemWeb.Framework;
 using MonoTests.Common;
index 76d528e4e790089e3eb0eddd9456c36a1a06858d..b51fb6d731401e2d57603bd85814325ed1a9eec9 100644 (file)
@@ -49,7 +49,6 @@ using System.Web.Routing;
 using System.Web.UI.WebControls;
 
 using NUnit.Framework;
-using NUnit.Mocks;
 using MonoTests.stand_alone.WebHarness;
 using MonoTests.SystemWeb.Framework;
 using MonoTests.Common;
index a812da1666512c6952fa26671fee20c038ae41f5..ce6be88aa1424c5b8c0889c59a7756364f51472b 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;NET_3_5</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;NET_3_5</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;NET_3_5</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;NET_3_5</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index d008409de93ceb62724eb093777654e53c135be9..67dc8fdf46681bdd4a72e018241a16ed0b10f965 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;NET_3_5;SYSTEM_WEB_EXTENSIONS</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;NET_3_5;SYSTEM_WEB_EXTENSIONS</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;NET_3_5;SYSTEM_WEB_EXTENSIONS</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;NET_3_5;SYSTEM_WEB_EXTENSIONS</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 70ba4af74c2bc27f6ecfa11211b2903d7bd0c446..f22283343a92f66e00475acccf8aea07714a62e7 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;ASPNETMVC</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;ASPNETMVC</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;ASPNETMVC</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;ASPNETMVC</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 0d1b62859ab115e15eb8d255bd48d8bc45892522..01aa27d48e3b8809c7313d3dc4ef348e6508bc59 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;ASPNETMVC</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;ASPNETMVC</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;ASPNETMVC</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;ASPNETMVC</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index bb5c8db8c3f130b909c1ec27769405d46a3d5b92..560bd38bf071e1cc5ab99aacff0ab70807d46e84 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;ASPNETMVC</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;ASPNETMVC</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;ASPNETMVC</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;ASPNETMVC</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index bc1337a2a49b2e6f2567798e58a082117311f748..9725f7b56f2538c3f0afbdcbb1eea8e9274c5ec2 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 3b76937bb6285bddab64b7752f01287a29760775..e5c1fa6b2f81272e6fda9e948d919dd5c01224d2 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;MONO</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;MONO</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 7b693416b897c7b8a85bb37efb2b7daac80698a2..0cb68b46eedaed337ea34262b049edaa2e0a0ecd 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;ASPNETWEBPAGES</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;ASPNETWEBPAGES</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;ASPNETWEBPAGES</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;ASPNETWEBPAGES</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index be101eaa2a8a51643a79d308a6c3f2ec594b2908..e69a280b041ed17efab8290d979d60d3f392343e 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 4f47b14286db28704527e8d43ee27a23b454260c..7f1c39753d952c12ea7d80c5462b924226f30ea6 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 0dfc8236d4b1c71de2ee476616b03e9501c3b146..1dd86dcc1130c434b48c5fad2829c889ba34ec09 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,168,169,219,414,612,649</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;MONO_BROKEN_CONFIGURATION_DLL</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;MONO_BROKEN_CONFIGURATION_DLL</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,168,169,219,414,612,649</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;MONO_BROKEN_CONFIGURATION_DLL</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;MONO_BROKEN_CONFIGURATION_DLL</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 6fd9784625d0608769e75495cab00b7179016e0d..1f047d204fba57afbe17fc9fc0a14a4ee950eadc 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;ASPNETWEBPAGES</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;ASPNETWEBPAGES</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;ASPNETWEBPAGES</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;ASPNETWEBPAGES</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 9e427e5ed1a72fd8078481143287c386ab12e38a..ddeedce17b93474d74818bed04518e83eb9e3b49 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;ASPNETWEBPAGES</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;ASPNETWEBPAGES</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;ASPNETWEBPAGES</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;ASPNETWEBPAGES</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 28ca085172c7cc7f4344a6487b358146e755cdc0..c61327be0e5f8bf2db733c8f98fd45fe22069193 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;ASPNETWEBPAGES</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;ASPNETWEBPAGES</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;ASPNETWEBPAGES</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;ASPNETWEBPAGES</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 0b1699b80a47715877f7cebe3453c131b7eecf9d..d79222b2568b4116cbbd893a5fa383f446a859bd 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,612,618,618</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;INSIDE_SYSTEM_WEB;WEBSERVICES_DEP</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;INSIDE_SYSTEM_WEB;WEBSERVICES_DEP</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,612,618,618</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;INSIDE_SYSTEM_WEB;WEBSERVICES_DEP</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;INSIDE_SYSTEM_WEB;WEBSERVICES_DEP</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
     <Compile Include="..\referencesource\System.Web\Util\AssemblyUtil.cs" />\r
     <Compile Include="..\referencesource\System.Web\Util\BinaryCompatibility.cs" />\r
     <Compile Include="..\referencesource\System.Web\Util\DateTimeUtil.cs" />\r
+    <Compile Include="..\referencesource\System.Web\Util\Debug.cs" />\r
     <Compile Include="..\referencesource\System.Web\Util\DisposableAction.cs" />\r
     <Compile Include="..\referencesource\System.Web\Util\DoNotResetAttribute.cs" />\r
     <Compile Include="..\referencesource\System.Web\Util\EmptyCollection.cs" />\r
     <Compile Include="..\System.Windows.Forms\System.Resources\ResXResourceWriter.cs" />\r
     <Compile Include="..\System.Windows.Forms\System.Resources\SerializedFromResXHandler.cs" />\r
     <Compile Include="..\System.Windows.Forms\System.Resources\TypeConverterFromResXHandler.cs" />\r
+    <Compile Include="..\System\System\MonoToolsLocator.cs" />\r
     <Compile Include="Assembly\AssemblyInfo.cs" />\r
     <Compile Include="Mono.Web.Util\ISectionSettingsMapper.cs" />\r
     <Compile Include="Mono.Web.Util\MembershipSectionMapper.cs" />\r
index 9d2976f9148216411ff9d3a779ca5170c6bc5562..a4fc142507f8fb172f0fffe32673cc35c1bda716 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,612,618,618</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;INSIDE_SYSTEM_WEB</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;INSIDE_SYSTEM_WEB</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,612,618,618</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;INSIDE_SYSTEM_WEB</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;INSIDE_SYSTEM_WEB</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
     <Compile Include="..\referencesource\System.Web\Util\AssemblyUtil.cs" />\r
     <Compile Include="..\referencesource\System.Web\Util\BinaryCompatibility.cs" />\r
     <Compile Include="..\referencesource\System.Web\Util\DateTimeUtil.cs" />\r
+    <Compile Include="..\referencesource\System.Web\Util\Debug.cs" />\r
     <Compile Include="..\referencesource\System.Web\Util\DisposableAction.cs" />\r
     <Compile Include="..\referencesource\System.Web\Util\DoNotResetAttribute.cs" />\r
     <Compile Include="..\referencesource\System.Web\Util\EmptyCollection.cs" />\r
     <Compile Include="..\System.Windows.Forms\System.Resources\ResXResourceWriter.cs" />\r
     <Compile Include="..\System.Windows.Forms\System.Resources\SerializedFromResXHandler.cs" />\r
     <Compile Include="..\System.Windows.Forms\System.Resources\TypeConverterFromResXHandler.cs" />\r
+    <Compile Include="..\System\System\MonoToolsLocator.cs" />\r
     <Compile Include="Assembly\AssemblyInfo.cs" />\r
     <Compile Include="Mono.Web.Util\ISectionSettingsMapper.cs" />\r
     <Compile Include="Mono.Web.Util\MembershipSectionMapper.cs" />\r
index 895440d3a6a8ec33f843523b24777261e37e3014..15c0393412b8635cf4f59d61b10e3bd32799544e 100644 (file)
@@ -47,8 +47,6 @@ namespace System.Web.Compilation
 {
        class AppResourcesAssemblyBuilder
        {
-               static string framework_version = "4.5";
-               static string profile_path = "net_4_x";
                CompilationSection config;
                CompilerInfo ci;
                CodeDomProvider _provider;
@@ -233,36 +231,14 @@ namespace System.Web.Compilation
                string SetAlPath (ProcessStartInfo info)
                {                       
                        if (RuntimeHelpers.RunningOnWindows) {
-                               string alPath;
-                               string monoPath;
-                               PropertyInfo gac = typeof (Environment).GetProperty ("GacPath", BindingFlags.Static|BindingFlags.NonPublic);
-                                MethodInfo get_gac = gac.GetGetMethod (true);
-                                string p = Path.GetDirectoryName ((string) get_gac.Invoke (null, null));
-                               monoPath = Path.Combine (Path.GetDirectoryName (Path.GetDirectoryName (p)), "bin\\mono.bat");
-                                if (!File.Exists (monoPath)) {
-                                        monoPath = Path.Combine (Path.GetDirectoryName (Path.GetDirectoryName (p)), "bin\\mono.exe");
-                                       if (!File.Exists (monoPath)) {
-                                               monoPath = Path.Combine (Path.GetDirectoryName (Path.GetDirectoryName (Path.GetDirectoryName (p))), "mono\\mono\\mini\\mono.exe");
-                                               if (!File.Exists (monoPath))
-                                                       throw new FileNotFoundException ("Windows mono path not found: " + monoPath);
-                                       }
-                               }
-                               alPath = Path.Combine (p, framework_version + "\\al.exe");
-                               
-                                if (!File.Exists (alPath)) {
-                                       alPath = Path.Combine (Path.GetDirectoryName (p), "lib\\" + profile_path + "\\al.exe");
-                                       if (!File.Exists (alPath))
-                                               throw new FileNotFoundException ("Windows al path not found: " + alPath);
-                               }
-
-                               info.FileName = monoPath;
-                               return alPath + " ";
+                               info.FileName = MonoToolsLocator.Mono;
+                               return MonoToolsLocator.AssemblyLinker + " ";
                        } else {
-                               info.FileName = "al";
+                               info.FileName = MonoToolsLocator.AssemblyLinker;
                                return String.Empty;
                        }
                }
-               
+
                string BuildAssemblyPath (string cultureName)
                {
                        string baseDir = Path.Combine (baseAssemblyDirectory, cultureName);
index 248b80f3537526f9501de642c6f69698a20bcf75..46f3627f416fa5f5342ba4ef05c35b8a56e65ba1 100644 (file)
@@ -2,6 +2,7 @@ Assembly/AssemblyInfo.cs
 ../../build/common/Consts.cs
 ../../build/common/Locale.cs
 ../../build/common/MonoTODOAttribute.cs
+../System/System/MonoToolsLocator.cs
 ../System.Windows.Forms/System.Resources/AssemblyNamesTypeResolutionService.cs
 ../System.Windows.Forms/System.Resources/ByteArrayFromResXHandler.cs
 ../System.Windows.Forms/System.Resources/ResXNullRef.cs
index 2b4e68cf8ed8d8ad018ea72686d0fa9134cabaa0..a413f1140da720b97104bb309894793cbb9ac1cb 100644 (file)
@@ -3,6 +3,7 @@
 //
 // Author:
 //     Chris Toshok (toshok@novell.com)
+//     Katharina Bogad (bogad@cs.tum.edu)
 //
 
 //
@@ -31,6 +32,7 @@
 using System.Text;
 using System.Collections.Specialized;
 using System.Security.Permissions;
+using System.Web.Configuration;
 
 namespace System.Web
 {
@@ -66,6 +68,17 @@ namespace System.Web
                        this.name = name;
                        values = new CookieNVC();
                        Value = "";
+
+                       HttpCookiesSection cookieConfig = (HttpCookiesSection) WebConfigurationManager.GetSection ("system.web/httpCookies");
+
+                       if(!string.IsNullOrWhiteSpace(cookieConfig.Domain))
+                               domain = cookieConfig.Domain;
+
+                       if(cookieConfig.HttpOnlyCookies)
+                               flags |= CookieFlags.HttpOnly;
+
+                       if(cookieConfig.RequireSSL)
+                               flags |= CookieFlags.Secure;
                }
 
                public HttpCookie (string name, string value)
index 09bd670bd4d091650ebc39a84c89dd0aecf45ae7..47a1fa4a8dedb246bb0f5720262453c766a8b67f 100644 (file)
@@ -1,3 +1,4 @@
+../../test-helpers/NunitHelpers.cs
 Test/standalone-tests/Consts.cs
 Test/standalone-tests/Locations.cs
 Test/standalone-tests/OutputCacheProvider.cs
index 4416f5a698b9262d036092092c23f1b41e3585a4..70593c25d06a0d72c3314d40fad9d64d4688b7a0 100644 (file)
@@ -1,3 +1,4 @@
+../../test-helpers/NunitHelpers.cs
 ../../System.Web.DynamicData/Test/Common/AssertExtensions.cs
 mainsoft/MainsoftWebTest/HtmlAgilityPack/AssemblyInfo.cs
 mainsoft/MainsoftWebTest/HtmlAgilityPack/crc32.cs
index 22f3996e76bde65974fdc6873edf26fa350da26f..e240e4355ff5dc3e47b72d8ef5ec25369c05886e 100644 (file)
@@ -77,13 +77,13 @@ namespace MonoTests.System.Web.Hosting {
                        Assert.IsNull (HostingEnvironment.InitializationException, "During:InitializationException");
                        Assert.IsTrue (HostingEnvironment.IsHosted, "During:IsHosted");
                        Assert.IsNotNull (HostingEnvironment.ApplicationID, "During:ApplicationID:Null");
-                       Assert.IsNotEmpty (HostingEnvironment.ApplicationID, "During:ApplicationID:Empty");
+                       AssertHelper.IsNotEmpty (HostingEnvironment.ApplicationID, "During:ApplicationID:Empty");
                        Assert.IsNotNull (HostingEnvironment.ApplicationPhysicalPath, "During:ApplicationPhysicalPath:Null");
-                       Assert.IsNotEmpty (HostingEnvironment.ApplicationPhysicalPath, "During:ApplicationPhysicalPath:Empty");
+                       AssertHelper.IsNotEmpty (HostingEnvironment.ApplicationPhysicalPath, "During:ApplicationPhysicalPath:Empty");
                        Assert.IsNotNull (HostingEnvironment.ApplicationVirtualPath, "During:ApplicationVirtualPath:Null");
-                       Assert.IsNotEmpty (HostingEnvironment.ApplicationVirtualPath, "During:ApplicationVirtualPath:Empty");
+                       AssertHelper.IsNotEmpty (HostingEnvironment.ApplicationVirtualPath, "During:ApplicationVirtualPath:Empty");
                        Assert.IsNotNull (HostingEnvironment.SiteName, "During:SiteName:Null");
-                       Assert.IsNotEmpty (HostingEnvironment.SiteName, "During:SiteName:Empty");
+                       AssertHelper.IsNotEmpty (HostingEnvironment.SiteName, "During:SiteName:Empty");
                        Assert.IsNotNull (HostingEnvironment.Cache, "During:Cache");
                        Assert.AreEqual (ApplicationShutdownReason.None, HostingEnvironment.ShutdownReason, "During:ShutdownReason");
                        Assert.IsNotNull (HostingEnvironment.VirtualPathProvider, "During:VirtualPathProvider");
index 06ee42a1a11954ad135e2bceda783c3e00a6beec..a88bfa88c0efb44c29e23019914ba4b46a2ee29b 100644 (file)
@@ -169,7 +169,6 @@ namespace MonoTests.System.Web.Security
                        }
                }
 
-#if NET_4_5
                [Test]
                public void Protect ()
                {
@@ -200,6 +199,5 @@ namespace MonoTests.System.Web.Security
                                MachineKey.Unprotect (encryptedBytes, oneUsage), 
                                "Single purpose working when multiple supplied");
                }
-#endif
        }
 }
index 4ace2ca1b3721eb2099edabdd4f8e152cca3d218..b9900b94a5f8cd1594b9ae10604353e075c97144 100644 (file)
@@ -1,4 +1,3 @@
-#if NET_4_5
 
 using System.ComponentModel.DataAnnotations;
 using System.Linq;
@@ -137,4 +136,3 @@ namespace MonoTests.System.Web.Security {
                }
        }
 }
-#endif
old mode 100644 (file)
new mode 100755 (executable)
index 0e1bb04..5e07845
@@ -57,7 +57,7 @@ namespace MonoTests.System.Web.UI.WebControls.Adapters
                        sw = new StringWriter();
                        w = new HtmlTextWriter(sw);
                        a.Render (w);
-                       Assert.AreEqual ("RenderBeginTag\nRenderContents\nRenderEndTag\n", sw.ToString(), "Render #1");
+                       Assert.AreEqual ("RenderBeginTag\nRenderContents\nRenderEndTag\n", sw.ToString().Replace ("\r", ""), "Render #1");
                        
                        
                        sw = new StringWriter();
old mode 100644 (file)
new mode 100755 (executable)
index fe1cb73..a40764b
@@ -91,21 +91,21 @@ namespace MonoTests.System.Web.UI.WebControls.Adapters
                public void RenderBeginTag ()
                {
                        a.RenderBeginTag (w);
-                       Assert.AreEqual ("RenderBeginTag\n", sw.ToString (), "RenderBeginTag #1");
+                       Assert.AreEqual ("RenderBeginTag\n", sw.ToString ().Replace ("\r", ""), "RenderBeginTag #1");
                }
 
                [Test]
                public void RenderContentsTag ()
                {
                        a.RenderContents (w);
-                       Assert.AreEqual ("RenderContents\n", sw.ToString (), "RenderContents #1");
+                       Assert.AreEqual ("RenderContents\n", sw.ToString ().Replace ("\r", ""), "RenderContents #1");
                }
 
                [Test]
                public void RenderEndTag ()
                {
                        a.RenderEndTag (w);
-                       Assert.AreEqual ("RenderEndTag\n", sw.ToString (), "RenderEndTag #1");
+                       Assert.AreEqual ("RenderEndTag\n", sw.ToString ().Replace ("\r", ""), "RenderEndTag #1");
                }
 
                [Test]
old mode 100644 (file)
new mode 100755 (executable)
index 12b2d0f..85f5040
@@ -63,28 +63,28 @@ namespace MonoTests.System.Web.UI.WebControls.Adapters
                public void RenderBeginTag ()
                {
                        a.RenderBeginTag (w);
-                       Assert.AreEqual ("RenderBeginTag\n", sw.ToString (), "RenderBeginTag #1");
+                       Assert.AreEqual ("RenderBeginTag\n", sw.ToString ().Replace ("\r", ""), "RenderBeginTag #1");
                }
 
                [Test]
                public void RenderContentsTag ()
                {
                        a.RenderContents (w);
-                       Assert.AreEqual ("RenderContents\n", sw.ToString (), "RenderContents #1");
+                       Assert.AreEqual ("RenderContents\n", sw.ToString ().Replace ("\r", ""), "RenderContents #1");
                }
 
                [Test]
                public void RenderEndTag ()
                {
                        a.RenderEndTag (w);
-                       Assert.AreEqual ("RenderEndTag\n", sw.ToString (), "RenderEndTag #1");
+                       Assert.AreEqual ("RenderEndTag\n", sw.ToString ().Replace ("\r", ""), "RenderEndTag #1");
                }
 
                [Test]
                public void Render ()
                {
                        a.Render (w);
-                       Assert.AreEqual ("RenderBeginTag\nRenderContents\nRenderEndTag\n", sw.ToString (), "Render #1");
+                       Assert.AreEqual ("RenderBeginTag\nRenderContents\nRenderEndTag\n", sw.ToString ().Replace ("\r", ""), "Render #1");
                }
                
                [Test]
old mode 100644 (file)
new mode 100755 (executable)
index f81a3a8..df2d711
@@ -1538,7 +1538,7 @@ namespace MonoTests.System.Web.UI.WebControls
                        Console.WriteLine ("----------------------------");
                        Console.WriteLine (renderedHtml);
                        
-                       Assert.AreEqual (origHtml, renderedHtml, "#A1");
+                       Assert.AreEqual (origHtml.Replace ("\r", ""), renderedHtml.Replace ("\r", ""), "#A1");
                }
 
                [Test]
@@ -1566,13 +1566,13 @@ namespace MonoTests.System.Web.UI.WebControls
                        string origHtml = "Header<table cellspacing=\"5\" cellpadding=\"5\">\r\n\t<tr>\r\n\t\t<td align=\"right\"><input type=\"submit\" name=\"MyWizard$StepNavigationTemplateContainerID$StepPreviousButton\" value=\"Previous\" id=\"MyWizard_StepNavigationTemplateContainerID_StepPreviousButton\" /></td><td align=\"right\"><input type=\"submit\" name=\"MyWizard$StepNavigationTemplateContainerID$StepNextButton\" value=\"Next\" id=\"MyWizard_StepNavigationTemplateContainerID_StepNextButton\" /></td>\n\t</tr>\n</table>Step";
                        string renderedHtml = HtmlDiff.GetControlFromPageHtml (result);
 
-                       Assert.AreEqual (origHtml, renderedHtml, "#A1");
+                       Assert.AreEqual (origHtml.Replace ("\r", ""), renderedHtml.Replace ("\r", ""), "#A1");
 
                        t.UserData = "RenderHeader_InSpan";
                        result = t.Run ();
                        origHtml = "Header<table cellspacing=\"5\" cellpadding=\"5\">\r\n\t<tr>\r\n\t\t<td align=\"right\"><input type=\"submit\" name=\"MyWizard$StepNavigationTemplateContainerID$StepPreviousButton\" value=\"Previous\" id=\"MyWizard_StepNavigationTemplateContainerID_StepPreviousButton\" /></td><td align=\"right\"><input type=\"submit\" name=\"MyWizard$StepNavigationTemplateContainerID$StepNextButton\" value=\"Next\" id=\"MyWizard_StepNavigationTemplateContainerID_StepNextButton\" /></td>\n\t</tr>\n</table>Step";
                        renderedHtml = HtmlDiff.GetControlFromPageHtml (result);
-                       Assert.AreEqual (origHtml, renderedHtml, "#A2");
+                       Assert.AreEqual (origHtml.Replace ("\r", ""), renderedHtml.Replace ("\r", ""), "#A2");
                }
 
                [Test]
index 9ae8aae05541ffcfd3b32b09fcdde4b773eb7273..192623ce4c4abca6f0289beb257f1f22833f5627 100644 (file)
@@ -26,7 +26,6 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if NET_4_5
 
 using System;
 using System.Threading.Tasks;
@@ -115,4 +114,3 @@ namespace MonoTests.System.Web
        }
 }
 
-#endif
index 2ce8621aec4781a1245a02df3114d4f7c8d3b030..0342a707978e4971ebe73e3217ea353d9be06a79 100644 (file)
@@ -547,7 +547,7 @@ namespace MonoTests.System.Web {
 
                        KnownResponseHeader known;
 
-                       Assert.LessOrEqual (1, f.KnownResponseHeaders.Count, "#B1");
+                       AssertHelper.LessOrEqual (1, f.KnownResponseHeaders.Count, "#B1");
 
                        known = (KnownResponseHeader)f.KnownResponseHeaders ["Content-Type"];
                        Assert.AreEqual (HttpWorkerRequest.HeaderContentType, known.Index, "#B2");
@@ -571,7 +571,7 @@ namespace MonoTests.System.Web {
 
                        KnownResponseHeader known;
 
-                       Assert.LessOrEqual (1, f.KnownResponseHeaders.Count, "#B1");
+                       AssertHelper.LessOrEqual (1, f.KnownResponseHeaders.Count, "#B1");
 
                        known = (KnownResponseHeader)f.KnownResponseHeaders ["Content-Type"];
                        Assert.AreEqual (HttpWorkerRequest.HeaderContentType, known.Index, "#B2");
index 52439e975abadcb7073dca94f9ae0f42e9ef4f51..51742ec6bc9d739aa44ef9b69d317e285427df3a 100644 (file)
@@ -55,7 +55,6 @@ namespace MonoTests.System.Web
                [Test]
                [Category ("NunitWeb")]
                [Ignore ("Pending fix for bug 351878")]
-               [Explicit]
                public void UnloadAppDomain100Times () 
                {
                        for (int i = 0; i < 100; i++)
index 50afda19bcb9cc67595c47edda027a42d7467236..bfd5b216249c9ad08bf01758522b4fb4fc712b19 100644 (file)
@@ -26,7 +26,6 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if NET_4_5
 
 using System;
 using System.IO;
@@ -129,4 +128,3 @@ namespace MonoTests.System.Web
        }
 }
 
-#endif
index 301a2988a3c10309c4ccfb8f74c79524c2ac8e08..05a67e4da0493a6ab3bffc6b9107b1891afcccc6 100644 (file)
@@ -26,7 +26,6 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if NET_4_5
 
 using System;
 using System.Threading;
@@ -331,4 +330,3 @@ namespace MonoTests.System.Web
        }
 }
 
-#endif
index 23487dacb07c844cc0fc2046b631820a1ba1d34b..73c5c75bb2c29ba36d618e41e1da91a03cf51702 100644 (file)
@@ -148,7 +148,7 @@ namespace MonoTests.System.Web
                        provider.DoAddNode (node, rootNode);
 
                        Assert.IsNotNull (provider.CallTrace, "#A1");
-                       Assert.Greater (provider.CallTrace.Length, 1, "#A1-1");
+                       AssertHelper.Greater (provider.CallTrace.Length, 1, "#A1-1");
                        Assert.AreEqual (provider.CallTrace[0].Name, "BuildSiteMap", "#A1-2");
                }
 
@@ -247,7 +247,7 @@ namespace MonoTests.System.Web
                        Assert.IsNotNull (provider.RootNode, "#A1");
                        Assert.AreEqual (provider.RootNode.Provider, provider, "#A2");
                        Assert.IsNotNull (provider.CallTrace, "#A3");
-                       Assert.Greater (provider.CallTrace.Length, 1, "#A3-1");
+                       AssertHelper.Greater (provider.CallTrace.Length, 1, "#A3-1");
                        Assert.AreEqual ("BuildSiteMap", provider.CallTrace[0].Name, "#A3-2");
                        Assert.AreEqual ("get_RootNode", provider.CallTrace[1].Name, "#A3-3");
                }
index 9064929de012eb685ebf71f8563c19b332e3c076..1a523884ce95053f0ee2affae05252ef95013f22 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index c1e931e0a9b631f15f767dc754ddaefec8e4bd9b..2f8b7fd1318f8b91eaf2448eab1ea7a15f28a3cc 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,618,612,809</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,618,612,809</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -50,6 +51,7 @@
   <ItemGroup>\r
     <Compile Include="..\..\build\common\Consts.cs" />\r
     <Compile Include="..\..\build\common\MonoTODOAttribute.cs" />\r
+    <Compile Include="..\System\System\MonoToolsLocator.cs" />\r
     <Compile Include="Assembly\AssemblyInfo.cs" />\r
     <Compile Include="Assembly\Locale.cs" />\r
     <Compile Include="System.Resources\AssemblyNamesTypeResolutionService.cs" />\r
index 90e91d144e12ba407ecd5e9c6ea1a357532dc3d0..5774443e80666a890065b83dba4e9165cb0e6b7a 100644 (file)
@@ -2,6 +2,7 @@
 ../../build/common/MonoTODOAttribute.cs
 Assembly/AssemblyInfo.cs
 Assembly/Locale.cs
+../System/System/MonoToolsLocator.cs
 System.Resources/AssemblyNamesTypeResolutionService.cs
 System.Resources/ByteArrayFromResXHandler.cs
 System.Resources/ResXNullRef.cs
index e4f980e60df8a82c6a80b770f933bdea8f0f7be2..07353efcb7a4dca16fa76fec7e5c817fc8828c4a 100644 (file)
@@ -560,35 +560,7 @@ namespace System.Windows.Forms
                        if (Assembly.GetEntryAssembly () == null)
                                throw new NotSupportedException ("The method 'Restart' is not supported by this application type.");
 
-                       string mono_path = null;
-
-                       //Get mono path
-                       PropertyInfo gac = typeof (Environment).GetProperty ("GacPath", BindingFlags.Static | BindingFlags.NonPublic);
-                       MethodInfo get_gac = null;
-                       if (gac != null)
-                               get_gac = gac.GetGetMethod (true);
-
-                       if (get_gac != null) {
-                               string gac_path = Path.GetDirectoryName ((string)get_gac.Invoke (null, null));
-                               string mono_prefix = Path.GetDirectoryName (Path.GetDirectoryName (gac_path));
-
-                               if (XplatUI.RunningOnUnix) {
-                                       mono_path = Path.Combine (mono_prefix, "bin/mono");
-                                       if (!File.Exists (mono_path))
-                                               mono_path = "mono";
-                               } else {
-                                       mono_path = Path.Combine (mono_prefix, "bin\\mono.bat");
-
-                                       if (!File.Exists (mono_path))
-                                               mono_path = Path.Combine (mono_prefix, "bin\\mono.exe");
-
-                                       if (!File.Exists (mono_path))
-                                               mono_path = Path.Combine (mono_prefix, "mono\\mono\\mini\\mono.exe");
-
-                                       if (!File.Exists (mono_path))
-                                               throw new FileNotFoundException (string.Format ("Windows mono path not found: '{0}'", mono_path));
-                               }
-                       }
+                       string mono_path = MonoToolsLocator.Mono;
 
                        //Get command line arguments
                        StringBuilder argsBuilder = new StringBuilder ();
index 23e29ad314fb504be3ae89b22b5efcab070cfbc0..70a1c6e2bfe4c0b06401403132ad3aaa02cb049e 100644 (file)
@@ -2222,7 +2222,7 @@ namespace System.Windows.Forms
 
                protected virtual bool ShouldSerializeLinkHoverColor ()
                {
-                       return grid_style.LinkHoverColor != grid_style.LinkHoverColor;
+                       return grid_style.LinkHoverColor != default_style.LinkHoverColor;
                }
 
                protected virtual bool ShouldSerializeParentRowsBackColor ()
index 505a41a0449b6d1c23dabd6e790f4add37288d88..b926e4ed1a8052054703a59723d0aefc3887c534 100644 (file)
@@ -596,7 +596,7 @@ namespace System.Windows.Forms {
 
                                if (this.title_style == TitleStyle.Normal)  {
                                        pt.Y += caption_height;
-                               } else if (this.title_style == TitleStyle.Normal)  {
+                               } else if (this.title_style == TitleStyle.Tool)  {
                                        pt.Y += tool_caption_height;
                                }
 
index 1087563b16ad124ceb91234588b7e4bfdf55388a..a6b37d7c2a812d0531b3ca17e66d67fbc6342b4b 100644 (file)
@@ -5411,9 +5411,12 @@ namespace System.Windows.Forms
                                bool selection_changed = false;
                                if (is_main_collection && owner != null) {
 
-                                       int display_index = item.DisplayIndex;
-                                       if (item.Focused && display_index + 1 == Count) // Last item
-                                               owner.SetFocusedItem (display_index == 0 ? -1 : display_index - 1);
+                                       ListViewItem focused_item = owner.FocusedItem;
+                                       if (focused_item != null) {
+                                               int focused_item_index = focused_item.DisplayIndex;
+                                               if (focused_item_index + 1 >= Count) // Last item
+                                                       owner.SetFocusedItem (Count - 2);
+                                       }
 
                                        selection_changed = owner.SelectedIndices.Contains (index);
                                        owner.item_control.CancelEdit (item);
@@ -5479,7 +5482,7 @@ namespace System.Windows.Forms
 
                                        value.SetGroup (group);
                                }
-
+                               value.DisplayIndex = -1;
                                list.Add (value);
 
                                // force an update of the selected info if the new item is selected.
index 3e087ef5ac6bb9ecad20206ee909ee8c405743e3..72034979fdb48590c5b9a550f2624f15e2b2e4cb 100644 (file)
@@ -2138,7 +2138,7 @@ namespace System.Windows.Forms
                static bool AreEqual (VisualStyleElement value1, VisualStyleElement value2)
                {
                        return
-                               value1.ClassName == value1.ClassName &&
+                               value1.ClassName == value2.ClassName &&
                                value1.Part == value2.Part &&
                                value1.State == value2.State;
                }
index f336b1537be36e1a8975e7fe1d530d1e8fe23f6f..884953ac3dd9e06e8d460a54b70cbc646b84ebbd 100644 (file)
@@ -1,3 +1,4 @@
+../../test-helpers/NunitHelpers.cs
 ../../../build/common/Consts.cs
 System.Windows.Forms/ApplicationTest.cs
 System.Windows.Forms/AutoCompleteStringCollectionTest.cs
index d0e3fc1bd3d8315e2dfd49e19881ce93b76d0590..0414fa18e710249b0d7c4f2a74448c8cfb4bce69 100644 (file)
@@ -47,7 +47,7 @@ namespace MonoTests.System.Resources {
 
                        Assert.IsNotNull (returnedNode, "#A1");
                        object val = returnedNode.GetValue (new ReturnSerializableSubClassITRS ());
-                       Assert.IsNotInstanceOfType (typeof (serializableSubClass), val, "#A2");
+                       AssertHelper.IsNotInstanceOfType (typeof (serializableSubClass), val, "#A2");
                        Assert.IsInstanceOfType (typeof (serializable), val, "#A3");
                }
 
@@ -84,7 +84,7 @@ namespace MonoTests.System.Resources {
                        node = GetNodeFileRefToSerializable ("ser.bbb",true);
 
                        object val = node.GetValue (new ReturnSerializableSubClassITRS ());
-                       Assert.IsNotInstanceOfType (typeof (serializableSubClass), val, "#A1");
+                       AssertHelper.IsNotInstanceOfType (typeof (serializableSubClass), val, "#A1");
                        Assert.IsInstanceOfType (typeof (serializable), val, "#A2");
                }
 
index 8ca5f4eb574d131270e3a12297929e39a02f9f86..3c0fc3beaaff338c0fa31e85244079d349c433da 100644 (file)
@@ -90,7 +90,7 @@ namespace MonoTests.System.Resources {
                        // get value passing no params
                        object val = returnedNode.GetValue ((ITypeResolutionService) null);
                        Assert.IsInstanceOfType (typeof (serializable), val, "#A2");
-                       Assert.IsNotInstanceOfType (typeof (serializableSubClass), val, "#A3");
+                       AssertHelper.IsNotInstanceOfType (typeof (serializableSubClass), val, "#A3");
 
                        //get value type passing different params
                        string newType = returnedNode.GetValueTypeName (new ReturnSerializableSubClassITRS ());
index d27d4439bb680fdf7c9f9aa919c08de6694f3f3c..ffd3711a8c298212c8d3af3d1ff8feaff2235e0e 100644 (file)
@@ -50,10 +50,10 @@ namespace MonoTests.System.Resources {
 
                        object defaultVal = returnedNode.GetValue ((ITypeResolutionService) null);
                        Assert.IsInstanceOfType (typeof (serializable), defaultVal, "#A2");
-                       Assert.IsNotInstanceOfType (typeof (serializableSubClass), defaultVal, "#A3");
+                       AssertHelper.IsNotInstanceOfType (typeof (serializableSubClass), defaultVal, "#A3");
 
                        object newVal = returnedNode.GetValue (new ReturnSerializableSubClassITRS ());
-                       Assert.IsNotInstanceOfType (typeof (serializableSubClass), newVal, "#A4");
+                       AssertHelper.IsNotInstanceOfType (typeof (serializableSubClass), newVal, "#A4");
                        Assert.IsInstanceOfType (typeof (serializable), newVal, "#A5");
                }
 
@@ -88,7 +88,7 @@ namespace MonoTests.System.Resources {
 
                        // get value passing null params
                        object val = returnedNode.GetValue ((ITypeResolutionService) null);
-                       // Assert.IsNotInstanceOfType (typeof (serializable), val, "#A5"); this would fail as subclasses are id-ed as instances of parents
+                       // AssertHelper.IsNotInstanceOfType (typeof (serializable), val, "#A5"); this would fail as subclasses are id-ed as instances of parents
                        Assert.IsInstanceOfType (typeof (serializableSubClass), val, "#A4");
                }
 
index 3a6cfbda95ad293b920e005e167a955b932c697c..5c6d1a960cc56f9f898cbe9f857433d9d5ef4b9b 100644 (file)
@@ -314,7 +314,7 @@ namespace MonoTests.System.Resources {
 
                        object o = node.GetValue ((AssemblyName []) null);
 
-                       Assert.IsNotInstanceOfType (typeof (serializableSubClass), o, "#A2");
+                       AssertHelper.IsNotInstanceOfType (typeof (serializableSubClass), o, "#A2");
                        Assert.IsInstanceOfType (typeof (serializable), o, "#A3");
                        rr.Close ();
                }
index 6c69a328a088f11f3a44bdb27dd44fdc74194928..9bfe7b1b416b192272f84c49492d78bb8aa94516 100644 (file)
@@ -252,7 +252,7 @@ namespace MonoTests.System.Resources {
                        Assert.IsNotNull (finalNode, "#A3");
 
                        object finalVal = finalNode.GetValue ((ITypeResolutionService) null);
-                       Assert.IsNotInstanceOfType (typeof (serializableSubClass), finalVal, "#A4");
+                       AssertHelper.IsNotInstanceOfType (typeof (serializableSubClass), finalVal, "#A4");
                        Assert.IsInstanceOfType (typeof (serializable), finalVal, "#A5");
                }
 
index 02f4db20f28c475e67c584a36c293f3fbc5e2ac0..6514bfe1c030a91bd8928d05d494781df7933cb4 100644 (file)
@@ -91,6 +91,7 @@ namespace MonoTests.System.Windows.Forms
                }
 
                [Test]
+               [Ignore ("causes an infinite restart loop since we're not in a separate AppDomain with nunit-lite")]
                [ExpectedException (typeof (NotSupportedException))]
                public void RestartNotSupportedExceptionTest ()
                {
index 46adeaaccb4d967f207eb6befe7015306307bad9..a71067dc5f4e8985bd9b799a003414f7c25f198d 100644 (file)
@@ -1958,5 +1958,56 @@ namespace MonoTests.System.Windows.Forms
                                return base.IsInputChar (charCode);
                        }
                }
+
+               [Test]  // Should not throw IndexOutOfBoundsException
+               public void ReaddingItem ()
+               {
+                       Form form = new Form ();
+                       form.ShowInTaskbar = false;
+                       ListView lvw1 = new ListView ();
+                       ListView lvw2 = new ListView ();
+                       lvw1.View = View.Details;
+                       lvw2.View = View.Details;
+                       lvw1.Columns.Add (new ColumnHeader ("1"));
+                       lvw2.Columns.Add (new ColumnHeader ("2"));
+                       form.Controls.Add (lvw1);
+                       form.Controls.Add (lvw2);
+                       form.Show ();
+
+                       for (int i = 0; i < 50; i++)
+                               lvw1.Items.Add ("A");
+                       lvw2.Items.Add ("B1");
+
+                       ListViewItem item = lvw1.Items [lvw1.Items.Count - 1];
+                       item.Selected = true;
+                       item.Remove ();
+                       lvw2.Items.Add (item);
+                       item.Selected = true;
+
+                       Assert.AreEqual (lvw1.Items.Count, 49, "#1");
+                       Assert.AreEqual (lvw2.Items.Count, 2, "#2");
+                       Assert.AreEqual (lvw2.Items [1].Selected, true, "#3");
+
+                       form.Dispose ();
+               }
+
+               [Test]  // Should not throw ArgumentOutOfRangeException
+               public void DeleteNotFocusedItem ()
+               {
+                       Form form = new Form ();
+                       form.ShowInTaskbar = false;
+                       ListView lvw = new ListView ();
+                       form.Controls.Add (lvw);
+                       form.Show ();
+
+                       for (int i = 0; i < 3; i++)
+                               lvw.Items.Add ("A");
+
+                       lvw.Items [lvw.Items.Count - 1].Focused = true;
+                       lvw.Items [0].Remove ();
+                       lvw.Items [0].Remove ();
+
+                       form.Dispose ();
+               }
        }
 }
index acade5f6933827a5755cc1f7758ddf32ab6c3bac..18271cfba2d479509548c2ce1b963ad781bb4ca4 100644 (file)
@@ -946,10 +946,10 @@ namespace MonoTests.System.Windows.Forms
                        Assert.AreEqual (31, p.GetRowHeights ()[0], "D1");\r
                        Assert.AreEqual (31, p.GetRowHeights ()[1], "D2");\r
                        Assert.AreEqual (81, p.GetColumnWidths ()[0], "D3");\r
-                       Assert.LessOrEqual (75, p.GetColumnWidths ()[1], "D4");\r
-                       Assert.GreaterOrEqual (78, p.GetColumnWidths ()[1], "D5");\r
-                       Assert.LessOrEqual (78, p.GetColumnWidths ()[2], "D6");\r
-                       Assert.GreaterOrEqual (81, p.GetColumnWidths ()[2], "D7");\r
+                       AssertHelper.LessOrEqual (75, p.GetColumnWidths ()[1], "D4");\r
+                       AssertHelper.GreaterOrEqual (78, p.GetColumnWidths ()[1], "D5");\r
+                       AssertHelper.LessOrEqual (78, p.GetColumnWidths ()[2], "D6");\r
+                       AssertHelper.GreaterOrEqual (81, p.GetColumnWidths ()[2], "D7");\r
                }\r
                \r
                [Test]\r
@@ -1702,7 +1702,7 @@ namespace MonoTests.System.Windows.Forms
                        Assert.AreEqual (4, tlp.RowCount, "X18638-1");\r
                        Assert.AreEqual (3, tlp.ColumnCount, "X18638-2");\r
                        Assert.AreEqual (60, widths[0], "X18638-3");\r
-                       Assert.Greater (label2.Width, widths[1], "X18638-5");\r
+                       AssertHelper.Greater (label2.Width, widths[1], "X18638-5");\r
                        Assert.AreEqual (45, widths[2], "X18638-4");\r
                }\r
 \r
index 9c9952d57249a24879e61298ab602a82f49e9599..e7b124905a301dad0d09b5bf95769d1ec91f6893 100644 (file)
@@ -1,5 +1,5 @@
 //
-// TypeForwarders.cs
+// AssemblyInfo.cs
 //
 // Author:
 //       Martin Baulig <martin.baulig@xamarin.com>
@@ -40,5 +40,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion (Consts.FxFileVersion)]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
index 59ba68253f7678d90e83373cafbee8397a1bced5..8ecaa25e3df7ad48e4f810ddcd8b1d18dbba0c89 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index c4285270bae308c734bd1136297b0373fad48b71..7a56cecb473c1c3c74b7f0f58608d509e9b19da3 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 32d268ac86e9ff227b087e84e8a504c558b56f74..8f04dff8786694af28eaa08009a9d9c6e9eda4ae 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index ecceeff1d25ab131fedbf915563dc943f5d41b32..1130cf15ff59395838371f4c649f7af04ad9e44b 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -34,7 +35,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -42,7 +43,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 3b61fe6384ad5cb0384fd7b329d1f7ac1133b281..cd45fc2ed31b7cc5e276ddbe11193c286a03bf16 100644 (file)
@@ -55,13 +55,13 @@ using System.Runtime.InteropServices;
 
        [assembly: CLSCompliant (true)]
        [assembly: AssemblyDelaySign (true)]
-#if NET_2_1
+#if MOBILE
        [assembly: AssemblyKeyFile ("../silverlight.pub")]
 #else
        [assembly: AssemblyKeyFile ("../ecma.pub")]
 #endif
 
-#if NET_2_1
+#if MOBILE
        [assembly: InternalsVisibleTo ("System.ServiceModel.Web, PublicKey=00240000048000009400000006020000002400005253413100040000010001008D56C76F9E8649383049F383C44BE0EC204181822A6C31CF5EB7EF486944D032188EA1D3920763712CCB12D75FB77E9811149E6148E5D32FBAAB37611C1878DDC19E20EF135D0CB2CFF2BFEC3D115810C3D9069638FE4BE215DBF795861920E5AB6F7DB2E2CEEF136AC23D5DD2BF031700AEC232F6C6B1C785B4305C123B37AB")]
 #else
        [assembly: AllowPartiallyTrustedCallers]
index 84a898e6ee38c368c523ded16755554ad6833bb1..4c6d072bd6e54f1d941afc3c26b58a573101ae96 100644 (file)
@@ -20,7 +20,7 @@ TXT_RESOURCE_STRINGS = \
 LIB_MCS_FLAGS = -nowarn:219,414,649,1717 -unsafe -d:ASYNC
 
 ifeq (2.1, $(FRAMEWORK_VERSION))
-LIB_MCS_FLAGS += -d:AGCLR -d:NET_2_1_HACK -d:DISABLE_XSLT_COMPILER -d:DISABLE_XSLT_SCRIPT,MONO_HYBRID_SYSTEM_XML -d:DISABLE_CAS_USE
+LIB_MCS_FLAGS += -d:AGCLR -d:DISABLE_XSLT_COMPILER -d:DISABLE_XSLT_SCRIPT,MONO_HYBRID_SYSTEM_XML -d:DISABLE_CAS_USE
 endif
 
 TEST_LIB_REFS = System.Data System.Core
index 7eacb3ddd76186652336c001a6d305daf646eb96..559fe4fd245f4e9515b2fe3380932b1224b44d72 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,219,414,649,1717</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;ASYNC</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;ASYNC</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,219,414,649,1717</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;ASYNC</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;ASYNC</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 753fdd5bbb8f23a12b369415577b1624e2dfae04..917ebd0b54caa29fcd6c69e354d494e6e595b265 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,219,414,649,1717</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;ASYNC;CONFIGURATION_DEP</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;ASYNC;CONFIGURATION_DEP</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,219,414,649,1717</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;ASYNC;CONFIGURATION_DEP</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;ASYNC;CONFIGURATION_DEP</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index f32bb39e09182b6d88559c0758c6af511e14cddc..55de52a77844e4a891fafbbc60cafa9476b45199 100644 (file)
@@ -135,10 +135,16 @@ namespace System.Xml.Serialization
 
                void LookupTypeConvertor ()
                {
-                       // We only need this for System.Xml.Linq.
-                       var convertor = type.GetCustomAttribute<XmlTypeConvertorAttribute> ();
-                       if (convertor != null)
-                               typeConvertor = type.GetMethod (convertor.Method, BindingFlags.Static | BindingFlags.NonPublic);
+                       // We only need this for System.Xml.Linq
+                       var t = type;
+                       // HACK: because interpreter array handling is so bad
+                       if (t.IsArray)
+                               t = t.GetElementType ();
+
+                       var convertor = t.GetCustomAttribute<XmlTypeConvertorAttribute> ();
+                       if (convertor != null) {
+                               typeConvertor = t.GetMethod (convertor.Method, BindingFlags.Static | BindingFlags.NonPublic);
+                       }
                }
 
                internal void ConvertForAssignment (ref object value)
index cf1434afff2497758d294f9e84a6cc9ee47bae2e..fc4fefc96676946ef278c46093de0e3e346f384d 100644 (file)
@@ -60,7 +60,7 @@ namespace System.Xml.Serialization
                        set { memberName = value; }
                }
 
-#if NET_2_1
+#if MOBILE
                MemberInfo member;
                // It is used only in 2.1 S.X.Serialization.dll in MS SDK.
                internal MemberInfo MemberInfo {
index a7343e0182087700e47107335d8613fc6d891a01..e27f99a0fb7e3bf66a545cf486b281a115e2be1e 100644 (file)
@@ -243,6 +243,33 @@ namespace System.Xml.Serialization {
                        }
                }
 
+               static string[] allTimeFormats = new string[] {
+                       "HH:mm:ss.fffffffzzzzzz",
+                       "HH:mm:ss",
+                       "HH:mm:ss.f",
+                       "HH:mm:ss.ff",
+                       "HH:mm:ss.fff",
+                       "HH:mm:ss.ffff",
+                       "HH:mm:ss.fffff",
+                       "HH:mm:ss.ffffff",
+                       "HH:mm:ss.fffffff",
+                       "HH:mm:ssZ",
+                       "HH:mm:ss.fZ",
+                       "HH:mm:ss.ffZ",
+                       "HH:mm:ss.fffZ",
+                       "HH:mm:ss.ffffZ",
+                       "HH:mm:ss.fffffZ",
+                       "HH:mm:ss.ffffffZ",
+                       "HH:mm:ss.fffffffZ",
+                       "HH:mm:sszzzzzz",
+                       "HH:mm:ss.fzzzzzz",
+                       "HH:mm:ss.ffzzzzzz",
+                       "HH:mm:ss.fffzzzzzz",
+                       "HH:mm:ss.ffffzzzzzz",
+                       "HH:mm:ss.fffffzzzzzz",
+                       "HH:mm:ss.ffffffzzzzzz",
+               };
+
                internal static object FromXmlString (TypeData type, string value)
                {
                        if (value == null) return null;
@@ -254,7 +281,7 @@ namespace System.Xml.Serialization {
                                case "char": return (char)XmlConvert.ToInt32 (value);
                                case "dateTime": return XmlConvert.ToDateTime (value, XmlDateTimeSerializationMode.RoundtripKind);
                                case "date": return XmlConvert.ToDateTime (value).Date;
-                               case "time": return DateTime.ParseExact (value, "HH:mm:ss.FFFFFFF", null);
+                               case "time": return DateTime.ParseExact(value, allTimeFormats, DateTimeFormatInfo.InvariantInfo, DateTimeStyles.AllowLeadingWhite | DateTimeStyles.AllowTrailingWhite | DateTimeStyles.NoCurrentDateDefault | DateTimeStyles.RoundtripKind);
                                case "decimal": return XmlConvert.ToDecimal (value);
                                case "double": return XmlConvert.ToDouble (value);
                                case "short": return XmlConvert.ToInt16 (value);
index b68d33eec94f2109a6cbad94f7e44d05ba41897a..fc0a36035c75421a3c37c18d4f1208defd465bd0 100644 (file)
@@ -126,7 +126,7 @@ namespace System.Xml.Serialization
                {
                        get { return _mapMember.Name; }
                }
-#if !NET_2_1
+#if !MOBILE
                public string GenerateTypeName (System.CodeDom.Compiler.CodeDomProvider codeProvider)
                {
                        string ret = codeProvider.CreateValidIdentifier (_mapMember.TypeData.FullTypeName);
index 6338a8dc14fa969a063a25a33b655de5242ce88c..0c4e131b87d993693f86e80fab46b45468e4464a 100644 (file)
@@ -157,7 +157,7 @@ namespace System.Xml.Serialization {
                        mps.RelatedMaps = relatedMaps;
                        mps.Format = SerializationFormat.Literal;
                        Type[] extraTypes = includedTypes != null ? (Type[])includedTypes.ToArray(typeof(Type)) : null;
-#if !NET_2_1
+#if !MOBILE
                        mps.Source = new MembersSerializationSource (elementName, hasWrapperElement, members, false, true, ns, extraTypes);
                        if (allowPrivateTypes) mps.Source.CanBeGenerated = false;
 #endif
@@ -226,7 +226,7 @@ namespace System.Xml.Serialization {
                                map.RelatedMaps = relatedMaps;
                                map.Format = SerializationFormat.Literal;
                                Type[] extraTypes = includedTypes != null ? (Type[]) includedTypes.ToArray (typeof (Type)) : null;
-#if !NET_2_1
+#if !MOBILE
                                map.Source = new XmlTypeSerializationSource (typeData.Type, root, attributeOverrides, defaultNamespace, extraTypes);
                                if (allowPrivateTypes) map.Source.CanBeGenerated = false;
 #endif
index 32593bc4e016164b22b2f5942fc4db6aa3f09afd..de6710af0a5f3fd9b95fecbe7b12e41c486311c3 100644 (file)
@@ -729,6 +729,29 @@ namespace System.Xml.Serialization
                        return serializable;
                }
 
+               protected IXmlSerializable ReadSerializable (IXmlSerializable serializable, bool wrappedAny)
+               {
+                       string name = null;
+                       string ns = null;
+
+                       if (wrappedAny) {
+                               name = reader.LocalName;
+                               ns = reader.NamespaceURI;
+                               reader.Read ();
+                               reader.MoveToContent ();
+                       }
+                       serializable.ReadXml (reader);
+
+                       if (wrappedAny) {
+                               while (reader.NodeType == XmlNodeType.Whitespace) reader.Skip ();
+                               if (reader.NodeType == XmlNodeType.None) reader.Skip ();
+                               if (reader.NodeType == XmlNodeType.EndElement && reader.LocalName == name && reader.NamespaceURI == ns) {
+                                       reader.Read ();
+                               }
+                       }
+                       return serializable;
+               }
+
                protected string ReadString (string value)
                {
                        readCount++;
index 5d9e4b24f341cd6a2054bb8d1ab9aea3d18342e5..d03dea1ff01228e237db86dfc4a9a7028f2da73e 100644 (file)
@@ -737,7 +737,8 @@ namespace System.Xml.Serialization
                        Type type = listType.Type;
                        if (type.IsArray)
                        {
-                               list = EnsureArrayIndex ((Array)list, index, type.GetElementType());
+                               list = EnsureArrayIndex ((Array)list, index, type.GetElementType ());
+                               listType.ConvertForAssignment (ref value);
                                ((Array)list).SetValue (value, index);
                        }
                        else    // Must be IEnumerable
index aa2852faf196b08b887679ada589ac6bd6b3c5f2..60bbc316699e378070fa9628ddd884b9e818f2da 100644 (file)
@@ -37,7 +37,7 @@ using System.Reflection;
 using System.Xml;
 using System.Xml.Schema;
 using System.Text;
-#if !NET_2_1
+#if !MOBILE
 using System.CodeDom;
 using System.CodeDom.Compiler;
 using Microsoft.CSharp;
@@ -121,7 +121,7 @@ namespace System.Xml.Serialization
                        //       debugging pourposes by adding the "nofallback" option.
                        //       For example: MONO_XMLSERIALIZER_THS=0,nofallback
                        
-#if NET_2_1
+#if MOBILE
                        string db = null;
                        string th = null;
                        generationThreshold = -1;
@@ -150,7 +150,7 @@ namespace System.Xml.Serialization
                        }
 #endif
                        deleteTempFiles = (db == null || db == "no");
-#if !NET_2_1 && CONFIGURATION_DEP
+#if !MOBILE && CONFIGURATION_DEP
                        // DiagnosticsSection
                        ConfigurationSection table = (ConfigurationSection) ConfigurationSettings.GetConfig("system.diagnostics");
                        var bf = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance;
@@ -204,6 +204,11 @@ namespace System.Xml.Serialization
                {
                }
 
+               public XmlSerializer (Type type, XmlAttributeOverrides overrides, Type[] extraTypes, XmlRootAttribute root, string defaultNamespace, string location)
+                       : this (type, overrides, extraTypes, root, defaultNamespace, location, null)
+               {
+               }
+
                public XmlSerializer (Type type, XmlAttributeOverrides overrides)
                        : this (type, overrides, null, null, null)
                {
@@ -579,7 +584,7 @@ namespace System.Xml.Serialization
                                }
                        }
                        
-#if !NET_2_1
+#if !MOBILE
                        if (!typeMapping.Source.CanBeGenerated || generationThreshold == -1)
                                return new XmlSerializationWriterInterpreter (typeMapping);
 
@@ -600,7 +605,7 @@ namespace System.Xml.Serialization
                
                XmlSerializationReader CreateReader (XmlMapping typeMapping)
                {
-#if !NET_2_1
+#if !MOBILE
                        XmlSerializationReader reader;
                        
                        lock (this) {
@@ -630,7 +635,7 @@ namespace System.Xml.Serialization
                        return new XmlSerializationReaderInterpreter (typeMapping);
                }
                
-#if NET_2_1
+#if MOBILE
                void CheckGeneratedTypes (XmlMapping typeMapping)
                {
                        throw new NotImplementedException();
index 204b67f71c943000e00b32deb54bf72ea6c037fb..02c86fd7e62febdee00ab74f114d16e88a322304 100644 (file)
@@ -61,6 +61,11 @@ namespace System.Xml.Serialization
                        }
                }
 
+               public XmlSerializer CreateSerializer (Type type, XmlAttributeOverrides overrides, Type[] extraTypes, XmlRootAttribute root, string defaultNamespace, string location)
+               {
+                       return CreateSerializer (type, overrides, extraTypes, root, defaultNamespace, location, null);
+               }
+
                public XmlSerializer CreateSerializer (Type type, string defaultNamespace)
                {
                        return CreateSerializer (type, null, null, null, defaultNamespace);
index 94dcc0285baf146428ccc8cb596d6777d8f015de..e2b3432b0ae877efc26dc6ec8dd503af3ed33856 100644 (file)
@@ -32,6 +32,7 @@ using System.CodeDom.Compiler;
 using System.Collections;
 using System.IO;
 using System.Text;
+using System.Reflection;
 using System.Runtime.InteropServices;
 using System.Security;
 using System.Security.Policy;
@@ -136,6 +137,11 @@ namespace System.Xml.Xsl
                        Transform (input.CreateNavigator (), arguments, results, null);
                }
 
+               public void Transform (IXPathNavigable input, XsltArgumentList arguments, XmlWriter results, XmlResolver documentResolver)
+               {
+                       Transform (input.CreateNavigator (), arguments, results, documentResolver);
+               }
+
                public void Transform (XmlReader input, XsltArgumentList arguments, XmlWriter results, XmlResolver documentResolver)
                {
                        Transform (new XPathDocument (input, XmlSpace.Preserve).CreateNavigator (), arguments, results, documentResolver);
@@ -203,6 +209,15 @@ namespace System.Xml.Xsl
                        Load (new XPathDocument (stylesheetUri, XmlSpace.Preserve).CreateNavigator (), settings, stylesheetResolver);
                }
 
+               public void Load (MethodInfo executeMethod, byte[] queryData, Type[] earlyBoundTypes)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public void Load (Type compiledStylesheet)
+               {
+                       throw new NotImplementedException ();
+               }
                #endregion
        }
 
index ec13691da1c6f391354da03759db0b487818446c..1393c354207eeb7596880a9dd9755adcddf337bb 100644 (file)
@@ -1555,6 +1555,13 @@ namespace MonoTests.System.XmlSerialization
                        Assert.AreEqual (new DateTime (2012,2,5,9,0,0,DateTimeKind.Utc), o.SomeDate.ToUniversalTime ());
                }
 
+               [Test]
+               public void TimeWithUtc ()
+               {
+                       XmlSerializer xs = new XmlSerializer (typeof (UtcTimeClass));
+                       var o = (UtcTimeClass) xs.Deserialize (new StringReader ("<UtcTimeClass xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><DateTimeValue>12:34:56.0Z</DateTimeValue></UtcTimeClass>"));
+                       Assert.AreEqual (new DateTime (1,1,1,12,34,56,DateTimeKind.Utc), o.DateTimeValue);
+               }
 
                public class Foo
                {
index 661273a3bf73358944481c32ae4ab7d58a7cc0d4..e8bdfd8829c1ef8d4662dce4a739de610503f2ac 100644 (file)
@@ -46,7 +46,7 @@ namespace MonoTests.System.XmlSerialization
                        Assert.AreEqual (string.Format(CultureInfo.InvariantCulture,
                                "{0}{0}" +
                                "/// <remarks/>{0}" +
-                               "[System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.Xml\", \"{1}\")]{0}" +
+                               "[System.CodeDom.Compiler.GeneratedCodeAttribute(\"nunit-lite-console\", \"0.0.0.0\")]{0}" +
                                "[System.SerializableAttribute()]{0}" +
                                "[System.Diagnostics.DebuggerStepThroughAttribute()]{0}" +
                                "[System.ComponentModel.DesignerCategoryAttribute(\"code\")]{0}" +
@@ -64,7 +64,7 @@ namespace MonoTests.System.XmlSerialization
                                "            this.namesField = value;{0}" +
                                "        }}{0}" +
                                "    }}{0}" +
-                               "}}{0}", Environment.NewLine, XmlFileVersion), sw.ToString (), "#2");
+                               "}}{0}", Environment.NewLine), sw.ToString (), "#2");
 
 
                        codeNamespace = ExportCode (typeof (ArrayClass[]));
@@ -76,7 +76,7 @@ namespace MonoTests.System.XmlSerialization
                        Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
                                "{0}{0}" +
                                "/// <remarks/>{0}" +
-                               "[System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.Xml\", \"{1}\")]{0}" +
+                               "[System.CodeDom.Compiler.GeneratedCodeAttribute(\"nunit-lite-console\", \"0.0.0.0\")]{0}" +
                                "[System.SerializableAttribute()]{0}" +
                                "[System.Diagnostics.DebuggerStepThroughAttribute()]{0}" +
                                "[System.ComponentModel.DesignerCategoryAttribute(\"code\")]{0}" +
@@ -93,7 +93,7 @@ namespace MonoTests.System.XmlSerialization
                                "            this.namesField = value;{0}" +
                                "        }}{0}" +
                                "    }}{0}" +
-                               "}}{0}", Environment.NewLine, XmlFileVersion), sw.ToString (), "#4");
+                               "}}{0}", Environment.NewLine), sw.ToString (), "#4");
                }
 
                [Test]
@@ -110,7 +110,7 @@ namespace MonoTests.System.XmlSerialization
                        Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
                                "{0}{0}" +
                                "/// <remarks/>{0}" +
-                               "[System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.Xml\", \"{1}\")]{0}" +
+                               "[System.CodeDom.Compiler.GeneratedCodeAttribute(\"nunit-lite-console\", \"0.0.0.0\")]{0}" +
                                "[System.SerializableAttribute()]{0}" +
                                "[System.Diagnostics.DebuggerStepThroughAttribute()]{0}" +
                                "[System.ComponentModel.DesignerCategoryAttribute(\"code\")]{0}" +
@@ -128,7 +128,7 @@ namespace MonoTests.System.XmlSerialization
                                "            this.itemsField = value;{0}" +
                                "        }}{0}" +
                                "    }}{0}" +
-                               "}}{0}", Environment.NewLine, XmlFileVersion), sw.ToString (), "#2");
+                               "}}{0}", Environment.NewLine), sw.ToString (), "#2");
                }
 
                [Test]
@@ -145,7 +145,7 @@ namespace MonoTests.System.XmlSerialization
                        Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
                                "{0}{0}" +
                                "/// <remarks/>{0}" +
-                               "[System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.Xml\", \"{1}\")]{0}" +
+                               "[System.CodeDom.Compiler.GeneratedCodeAttribute(\"nunit-lite-console\", \"0.0.0.0\")]{0}" +
                                "[System.SerializableAttribute()]{0}" +
                                "[System.Diagnostics.DebuggerStepThroughAttribute()]{0}" +
                                "[System.ComponentModel.DesignerCategoryAttribute(\"code\")]{0}" +
@@ -163,7 +163,7 @@ namespace MonoTests.System.XmlSerialization
                                "            this.cdataField = value;{0}" +
                                "        }}{0}" +
                                "    }}{0}" +
-                               "}}{0}", Environment.NewLine, XmlFileVersion), sw.ToString (), "#2");
+                               "}}{0}", Environment.NewLine), sw.ToString (), "#2");
                }
 
                [Test]
@@ -182,7 +182,7 @@ namespace MonoTests.System.XmlSerialization
                        Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
                                "{0}{0}" +
                                "/// <remarks/>{0}" +
-                               "[System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.Xml\", \"{1}\")]{0}" +
+                               "[System.CodeDom.Compiler.GeneratedCodeAttribute(\"nunit-lite-console\", \"0.0.0.0\")]{0}" +
                                "[System.SerializableAttribute()]{0}" +
                                "[System.Diagnostics.DebuggerStepThroughAttribute()]{0}" +
                                "[System.ComponentModel.DesignerCategoryAttribute(\"code\")]{0}" +
@@ -204,7 +204,7 @@ namespace MonoTests.System.XmlSerialization
                                "            this.myChoiceField = value;{0}" +
                                "        }}{0}" +
                                "    }}{0}" +
-                               "}}{0}", Environment.NewLine, XmlFileVersion), sw.ToString (), "#2");
+                               "}}{0}", Environment.NewLine), sw.ToString (), "#2");
                }
 
                [Test]
@@ -222,7 +222,7 @@ namespace MonoTests.System.XmlSerialization
                        Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
                                "{0}{0}" +
                                "/// <remarks/>{0}" +
-                               "[System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.Xml\", \"{1}\")]{0}" +
+                               "[System.CodeDom.Compiler.GeneratedCodeAttribute(\"nunit-lite-console\", \"0.0.0.0\")]{0}" +
                                "[System.SerializableAttribute()]{0}" +
                                "[System.Diagnostics.DebuggerStepThroughAttribute()]{0}" +
                                "[System.ComponentModel.DesignerCategoryAttribute(\"code\")]{0}" +
@@ -403,7 +403,7 @@ namespace MonoTests.System.XmlSerialization
                                "{0}" +
                                "/// <remarks/>{0}" +
                                "[System.FlagsAttribute()]{0}" +
-                               "[System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.Xml\", \"{1}\")]{0}" +
+                               "[System.CodeDom.Compiler.GeneratedCodeAttribute(\"nunit-lite-console\", \"0.0.0.0\")]{0}" +
                                "[System.SerializableAttribute()]{0}" +
                                "public enum MapModifiers {{{0}" +
                                "    {0}" +
@@ -414,7 +414,7 @@ namespace MonoTests.System.XmlSerialization
                                "    /// <remarks/>{0}" +
                                "    [System.Xml.Serialization.XmlEnumAttribute(\"protected\")]{0}" +
                                "    Protected = 2,{0}" +
-                               "}}{0}", Environment.NewLine, XmlFileVersion), sw.ToString (), "#2");
+                               "}}{0}", Environment.NewLine), sw.ToString (), "#2");
                }
 
                [Test]
@@ -431,7 +431,7 @@ namespace MonoTests.System.XmlSerialization
                        Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
                                "{0}{0}" +
                                "/// <remarks/>{0}" +
-                               "[System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.Xml\", \"{1}\")]{0}" +
+                               "[System.CodeDom.Compiler.GeneratedCodeAttribute(\"nunit-lite-console\", \"0.0.0.0\")]{0}" +
                                "[System.SerializableAttribute()]{0}" +
                                "[System.Xml.Serialization.XmlTypeAttribute(IncludeInSchema=false)]{0}" +
                                "[System.Xml.Serialization.XmlRootAttribute(Namespace=\"\", IsNullable=false)]{0}" +
@@ -446,7 +446,7 @@ namespace MonoTests.System.XmlSerialization
                                "    {0}" +
                                "    /// <remarks/>{0}" +
                                "    ChoiceTwo,{0}" +
-                               "}}{0}", Environment.NewLine, XmlFileVersion), sw.ToString (), "#2");
+                               "}}{0}", Environment.NewLine), sw.ToString (), "#2");
 
                        codeNamespace = ExportCode (typeof (ItemChoiceType[]));
                        Assert.IsNotNull (codeNamespace, "#3");
@@ -457,7 +457,7 @@ namespace MonoTests.System.XmlSerialization
                        Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
                                "{0}{0}" +
                                "/// <remarks/>{0}" +
-                               "[System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.Xml\", \"{1}\")]{0}" +
+                               "[System.CodeDom.Compiler.GeneratedCodeAttribute(\"nunit-lite-console\", \"0.0.0.0\")]{0}" +
                                "[System.SerializableAttribute()]{0}" +
                                "[System.Xml.Serialization.XmlTypeAttribute(IncludeInSchema=false)]{0}" +
                                "public enum ItemChoiceType {{{0}" +
@@ -471,7 +471,7 @@ namespace MonoTests.System.XmlSerialization
                                "    {0}" +
                                "    /// <remarks/>{0}" +
                                "    ChoiceTwo,{0}" +
-                               "}}{0}", Environment.NewLine, XmlFileVersion), sw.ToString (), "#4");
+                               "}}{0}", Environment.NewLine), sw.ToString (), "#4");
                }
 
                [Test]
@@ -488,7 +488,7 @@ namespace MonoTests.System.XmlSerialization
                        Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
                                "{0}{0}" +
                                "/// <remarks/>{0}" +
-                               "[System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.Xml\", \"{1}\")]{0}" +
+                               "[System.CodeDom.Compiler.GeneratedCodeAttribute(\"nunit-lite-console\", \"0.0.0.0\")]{0}" +
                                "[System.SerializableAttribute()]{0}" +
                                "[System.Diagnostics.DebuggerStepThroughAttribute()]{0}" +
                                "[System.ComponentModel.DesignerCategoryAttribute(\"code\")]{0}" +
@@ -509,7 +509,7 @@ namespace MonoTests.System.XmlSerialization
                                "}}{0}" +
                                "{0}" +
                                "/// <remarks/>{0}" +
-                               "[System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.Xml\", \"{1}\")]{0}" +
+                               "[System.CodeDom.Compiler.GeneratedCodeAttribute(\"nunit-lite-console\", \"0.0.0.0\")]{0}" +
                                "[System.SerializableAttribute()]{0}" +
                                "[System.Diagnostics.DebuggerStepThroughAttribute()]{0}" +
                                "[System.ComponentModel.DesignerCategoryAttribute(\"code\")]{0}" +
@@ -526,7 +526,7 @@ namespace MonoTests.System.XmlSerialization
                                "            this.somethingField = value;{0}" +
                                "        }}{0}" +
                                "    }}{0}" +
-                               "}}{0}", Environment.NewLine, XmlFileVersion), sw.ToString (), "#2");
+                               "}}{0}", Environment.NewLine), sw.ToString (), "#2");
                }
 
                [Test]
@@ -544,7 +544,7 @@ namespace MonoTests.System.XmlSerialization
                        Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
                                "{0}{0}" +
                                "/// <remarks/>{0}" +
-                               "[System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.Xml\", \"{1}\")]{0}" +
+                               "[System.CodeDom.Compiler.GeneratedCodeAttribute(\"nunit-lite-console\", \"0.0.0.0\")]{0}" +
                                "[System.SerializableAttribute()]{0}" +
                                "[System.Diagnostics.DebuggerStepThroughAttribute()]{0}" +
                                "[System.ComponentModel.DesignerCategoryAttribute(\"code\")]{0}" +
@@ -578,7 +578,7 @@ namespace MonoTests.System.XmlSerialization
                                "}}{0}" +
                                "{0}" +
                                "/// <remarks/>{0}" +
-                               "[System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.Xml\", \"{1}\")]{0}" +
+                               "[System.CodeDom.Compiler.GeneratedCodeAttribute(\"nunit-lite-console\", \"0.0.0.0\")]{0}" +
                                "[System.SerializableAttribute()]{0}" +
                                "[System.Diagnostics.DebuggerStepThroughAttribute()]{0}" +
                                "[System.ComponentModel.DesignerCategoryAttribute(\"code\")]{0}" +
@@ -667,7 +667,7 @@ namespace MonoTests.System.XmlSerialization
                                "{0}" +
                                "/// <remarks/>{0}" +
                                "[System.FlagsAttribute()]{0}" +
-                               "[System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.Xml\", \"{1}\")]{0}" +
+                               "[System.CodeDom.Compiler.GeneratedCodeAttribute(\"nunit-lite-console\", \"0.0.0.0\")]{0}" +
                                "[System.SerializableAttribute()]{0}" +
                                "[System.Xml.Serialization.XmlTypeAttribute(Namespace=\"some:urn\")]{0}" +
                                "public enum FlagEnum {{{0}" +
@@ -786,7 +786,7 @@ namespace MonoTests.System.XmlSerialization
                                "{0}" +
                                "/// <remarks/>{0}" +
                                "[System.FlagsAttribute()]{0}" +
-                               "[System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.Xml\", \"{1}\")]{0}" +
+                               "[System.CodeDom.Compiler.GeneratedCodeAttribute(\"nunit-lite-console\", \"0.0.0.0\")]{0}" +
                                "[System.SerializableAttribute()]{0}" +
                                "[System.Xml.Serialization.XmlTypeAttribute(Namespace=\"urn:myNS\")]{0}" +
                                "public enum FlagEnum {{{0}" +
@@ -806,7 +806,7 @@ namespace MonoTests.System.XmlSerialization
                                "{0}" +
                                "/// <remarks/>{0}" +
                                "[System.FlagsAttribute()]{0}" +
-                               "[System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.Xml\", \"{1}\")]{0}" +
+                               "[System.CodeDom.Compiler.GeneratedCodeAttribute(\"nunit-lite-console\", \"0.0.0.0\")]{0}" +
                                "[System.SerializableAttribute()]{0}" +
                                "[System.Xml.Serialization.XmlTypeAttribute(Namespace=\"urn:myNS\")]{0}" +
                                "public enum FlagEnum_Encoded {{{0}" +
@@ -819,7 +819,7 @@ namespace MonoTests.System.XmlSerialization
                                "    {0}" +
                                "    /// <remarks/>{0}" +
                                "    e4 = 4,{0}" +
-                               "}}{0}", Environment.NewLine, XmlFileVersion), sw.ToString (), "#2");
+                               "}}{0}", Environment.NewLine), sw.ToString (), "#2");
                }
 
                [Test]
@@ -836,7 +836,7 @@ namespace MonoTests.System.XmlSerialization
                        Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
                                "{0}{0}" +
                                "/// <remarks/>{0}" +
-                               "[System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.Xml\", \"{1}\")]{0}" +
+                               "[System.CodeDom.Compiler.GeneratedCodeAttribute(\"nunit-lite-console\", \"0.0.0.0\")]{0}" +
                                "[System.SerializableAttribute()]{0}" +
                                "[System.Diagnostics.DebuggerStepThroughAttribute()]{0}" +
                                "[System.ComponentModel.DesignerCategoryAttribute(\"code\")]{0}" +
@@ -855,7 +855,7 @@ namespace MonoTests.System.XmlSerialization
                                "            this.somethingField = value;{0}" +
                                "        }}{0}" +
                                "    }}{0}" +
-                               "}}{0}", Environment.NewLine, XmlFileVersion), sw.ToString (), "#2");
+                               "}}{0}", Environment.NewLine), sw.ToString (), "#2");
                }
 
                [Test]
@@ -909,7 +909,7 @@ namespace MonoTests.System.XmlSerialization
                                "{0}{0}" +
                                "/// <remarks/>{0}" +
                                "[System.FlagsAttribute()]{0}" +
-                               "[System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.Xml\", \"{1}\")]{0}" +
+                               "[System.CodeDom.Compiler.GeneratedCodeAttribute(\"nunit-lite-console\", \"0.0.0.0\")]{0}" +
                                "[System.SerializableAttribute()]{0}" +
                                "[System.Xml.Serialization.XmlRootAttribute(Namespace=\"\", IsNullable=false)]{0}" +
                                "public enum ZeroFlagEnum {{{0}" +
@@ -925,7 +925,7 @@ namespace MonoTests.System.XmlSerialization
                                "    /// <remarks/>{0}" +
                                "    [System.Xml.Serialization.XmlEnumAttribute(\"tns:t<w>o\")]{0}" +
                                "    e2 = 4,{0}" +
-                               "}}{0}", Environment.NewLine, XmlFileVersion), sw.ToString (), "#2");
+                               "}}{0}", Environment.NewLine), sw.ToString (), "#2");
                }
 
                [Test]
@@ -1005,15 +1005,6 @@ namespace MonoTests.System.XmlSerialization
                        return codeNamespace;
                }
 
-               string XmlFileVersion {
-                       get {
-                               Assembly xmlAsm = typeof (XmlDocument).Assembly;
-                               AssemblyFileVersionAttribute afv = (AssemblyFileVersionAttribute)
-                                       Attribute.GetCustomAttribute (xmlAsm, typeof (AssemblyFileVersionAttribute));
-                               return afv.Version;
-                       }
-               }
-
                [XmlRootAttribute ("root", Namespace="urn:aNS", IsNullable=false)]
                public class Root
                {
old mode 100644 (file)
new mode 100755 (executable)
index 98942e5..bec6232
@@ -2052,8 +2052,8 @@ namespace MonoTests.System.XmlSerialization
                                serializer.Serialize (writer, obj);
                                writer.Close ();
 
-                               Assert.AreEqual (@"<?xml version=""1.0"" encoding=""utf-16""?>
-<Bug594490Class xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xml:lang=""hello world"" />",
+                               Assert.AreEqual (@"<?xml version=""1.0"" encoding=""utf-16""?>" + Environment.NewLine +
+                                                @"<Bug594490Class xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xml:lang=""hello world"" />",
                                        writer.ToString (),
                                        "Novell bug #594490 (https://bugzilla.novell.com/show_bug.cgi?id=594490) not fixed.");
                        }
index 116bbe323ad312f2fcfb8779cb5a1027ba7b69c3..4adcc11b20d8032cfb427bb0490a8a093fc7eace 100644 (file)
@@ -1071,6 +1071,12 @@ namespace MonoTests.System.Xml.TestClasses
                public DateTime SomeDate;
        }
 
+       public class UtcTimeClass
+       {
+               [XmlElementAttribute (DataType = "time")]
+               public DateTime DateTimeValue;
+       }
+
        public class Bug8468BaseClass
        {
                public string Base;
index bdd08aa7c69f5101ca4b85479f374d3da2f89b16..61835e709a09541daa56c89b501efc256c0ba3c1 100644 (file)
@@ -161,14 +161,12 @@ namespace MonoTests.System.XmlSerialization
                }
 
                // test constructors
-#if USE_VERSION_1_1    // It doesn't pass on MS.NET 1.1.
                [Test]
+               [ExpectedException (typeof (ArgumentNullException))]
                public void TestConstructor()
                {
                        XmlSerializer ser = new XmlSerializer (null, "");
                }
-#else
-#endif
 
                // test basic types ////////////////////////////////////////////////////////
                [Test]
@@ -2323,6 +2321,7 @@ namespace MonoTests.System.XmlSerialization
                        Assert.AreEqual ("<:ErrorneousGetSchema></>", Infoset (sw.ToString ()));
                }
 
+               [Test]
                public void DateTimeRoundtrip ()
                {
                        // bug #337729
index 16c46b496f4ce7a996bdbf568db76d706bd7e52a..26f461aeb30ff94cdb2f6dea7afffb0ae06499e8 100644 (file)
@@ -15,10 +15,8 @@ using System.Text;
 using System.Xml;\r
 using System.Xml.Schema;\r
 using System.Xml.XPath;\r
-#if NET_4_5\r
 using System.Threading;\r
 using System.Threading.Tasks;\r
-#endif\r
 \r
 using NUnit.Framework;\r
 \r
@@ -2298,7 +2296,6 @@ namespace MonoTests.System.Xml
                        Assert.AreEqual ((UInt64) 1, xr.ReadContentAs (typeof (UInt64), null), "#8");\r
                }\r
 \r
-#if NET_4_5\r
                [Test]\r
                [ExpectedException(typeof(InvalidOperationException))]\r
                public void MustSetAsyncFlag ()\r
@@ -2347,6 +2344,5 @@ namespace MonoTests.System.Xml
                        if (task.Result != null)\r
                                throw task.Result;\r
                }\r
-#endif\r
        }\r
 }\r
index effd9df94fe506380243727a24bcdf30a8449e3d..768cd5671dac943f4f59ee39dbed06dedf1daabe 100644 (file)
@@ -419,7 +419,6 @@ namespace MonoTests.System.Xml
                        Assert.AreEqual ("urn:foo", r.BaseURI);
                }
 
-#if NET_4_5
                [Test]
                [ExpectedException (typeof (XmlException))]
                public void ReadonlyAsync ()
@@ -444,6 +443,5 @@ namespace MonoTests.System.Xml
                        var r2 = XmlReader.Create (r, c);
                        Assert.IsTrue (r2.Settings.Async);
                }
-#endif
        }
 }
index df9756ee8f17739f224b7c92ebc770dc481bef09..15b20974487f087fc833d2132fa1c5de6df42d22 100644 (file)
@@ -103,7 +103,6 @@ namespace MonoTests.System.Xml {
                        Assert.IsTrue (u2.IsAbsoluteUri, "null,absolute/file");
                }
 
-#if NET_4_5
                class AsyncXmlResolver : XmlResolver
                {
                        public override object GetEntity (Uri absoluteUri, string role, Type ofObjectToReturn)
@@ -121,6 +120,5 @@ namespace MonoTests.System.Xml {
                        var uri = new Uri ("http://www.mono-project.com");
                        ar.GetEntityAsync (uri, null, typeof(string));
                }
-#endif
        }
 }
index 8f2de60a83892664ac61f5cb90d72dc37813427d..2624f2a5ba087f3629c397f41d376b6fd072317d 100644 (file)
@@ -124,7 +124,6 @@ namespace MonoTests.System.Xml
                        Assert.IsTrue (site, "Site-2");
                }
 
-#if NET_4_5
                [Test]
                [Category("Async")]
                public void TestAsync ()
@@ -137,9 +136,8 @@ namespace MonoTests.System.Xml
                        Assert.AreEqual ("file", resolved.Scheme);
                        var task = sr.GetEntityAsync (resolved, null, typeof (Stream));
                        Assert.That (task.Wait (3000));
-                       Assert.IsInstanceOfType (typeof (Stream), task.Result);
+                       Assert.IsInstanceOfType (typeof (FileStream), task.Result);
                }
-#endif
 
        }
 }
index e62e8cebad0d717565a4bfb6ae35bd4c28ec7130..f637e8cc326abd7c019506a39af0ed43e59ad850 100644 (file)
@@ -10,9 +10,7 @@ using System;
 using System.IO;\r
 using System.Xml;\r
 using NUnit.Framework;\r
-#if NET_4_5\r
 using System.Reflection;\r
-#endif\r
 \r
 namespace MonoTests.System.Xml\r
 {\r
@@ -98,7 +96,6 @@ namespace MonoTests.System.Xml
                        Assert.AreEqual ("view:Standard.xslt", uri.AbsoluteUri, "#2");\r
                }\r
 \r
-#if NET_4_5\r
                [Test]\r
                public void TestAsync ()\r
                {\r
@@ -126,6 +123,5 @@ namespace MonoTests.System.Xml
                                Assert.IsTrue (ex is XmlException);\r
                        }\r
                }\r
-#endif\r
        }\r
 }\r
index f70d43bd46d6e27ffd6c510d897722d2af9e4e34..3ee725dff252e037feb6f562b65756bf7ee8b961 100644 (file)
@@ -40,9 +40,7 @@ namespace MonoTests.System.Xml
                        Assert.AreEqual (false, s.NewLineOnAttributes);
                        Assert.AreEqual (false, s.OmitXmlDeclaration);
                        Assert.AreEqual (NewLineHandling.Replace, s.NewLineHandling);
-#if NET_4_5
                        Assert.IsFalse (s.Async);
-#endif
                }
 
                [Test]
@@ -381,7 +379,6 @@ namespace MonoTests.System.Xml
                        Assert.AreEqual (xml, sw.ToString ());
                }
 
-#if NET_4_5
                [Test]
                [ExpectedException (typeof (XmlException))]
                public void ReadonlyAsync ()
@@ -408,7 +405,6 @@ namespace MonoTests.System.Xml
                        var w2 = XmlWriter.Create (w, c);
                        Assert.IsTrue (w2.Settings.Async);
                }
-#endif
 
        }
 }
index 54cd8471352f2f1c9ea6a643504f3dabec99775c..8581509e354e17a2f75f4272a381b626a0d56ee6 100644 (file)
@@ -54,7 +54,7 @@ using System.Runtime.InteropServices;
 [assembly: NeutralResourcesLanguage ("en-US")]
 [assembly: CLSCompliant (true)]
 [assembly: AssemblyDelaySign (true)]
-#if NET_2_1
+#if MOBILE
 [assembly: AssemblyKeyFile ("../silverlight.pub")]
 #else
 [assembly: AssemblyKeyFile ("../ecma.pub")]
index a5d11aeffb1c16f590397c74502c490045f6e757..190dbdbe5e05ff385392643855eeee4952013f80 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index c7002e5c8eeecc6a33cfee6ba0e17835af563f41..ccf8e0f703a662f10c5a92fc720fa16c1813dd84 100644 (file)
@@ -124,7 +124,7 @@ namespace System.Xaml
                        return TypeDescriptor.GetConverter (type);
                }
                
-               // FIXME: I want this to cover all the existing types and make it valid in both NET_2_1 and !NET_2_1.
+               // FIXME: I want this to cover all the existing types and make it valid in both MOBILE and !MOBILE.
                class ConvertibleTypeConverter<T> : TypeConverter
                {
                        Type type;
index 169f6d172715e457bc3f6a70965a988e439ab012..e6ac4809d4bd86044e8fd37cbf8a635bd9e0c647 100644 (file)
@@ -54,7 +54,7 @@ using System.Runtime.InteropServices;
 [assembly: NeutralResourcesLanguage ("en-US")]
 [assembly: CLSCompliant (true)]
 [assembly: AssemblyDelaySign (true)]
-#if NET_2_1
+#if MOBILE
 [assembly: AssemblyKeyFile ("../winfx.pub")]
 #else
 [assembly: AssemblyKeyFile ("../ecma.pub")]
index e3988ed811ffcb03d826fec78c7a4b1d4fbb96d8..10ca891ef7cc469897ed47d49be4580242697ccd 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;FEATURE_SERIALIZATION</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;FEATURE_SERIALIZATION</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;FEATURE_SERIALIZATION</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;FEATURE_SERIALIZATION</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 693d4a2e296436b7c6c4cc7a24c97a727acd6c46..67efb6025e6504d6830210c54bb1fa53b28dbe70 100644 (file)
@@ -1,3 +1,4 @@
+../../test-helpers/NunitHelpers.cs
 System.Xml.Linq/ExtensionsTest.cs
 System.Xml.Linq/XAttributeTest.cs
 System.Xml.Linq/XCommentTest.cs
index dc395b7d110e122b8dcf779cc8490f9e24ffb6e7..f93bbabc3d88e21bca92fc48e741c150f261a945 100644 (file)
@@ -2084,7 +2084,6 @@ namespace MonoTests.System.Xml.Linq
                        public XElement Content;
                }
 
-#if NET_4_5
                [Test]
                // Bug #12571
                public void DeserializeXElement ()
@@ -2099,7 +2098,27 @@ namespace MonoTests.System.Xml.Linq
                        var xe = (SerializableClass)res;
                        Assert.AreEqual (xe.Content.ToString (), "<Data />", "#3");
                }
-#endif
+
+               [XmlType ("Root")]
+               public class DeserializeXElementArray_Data
+               {
+                       [XmlAnyElement]
+                       public XElement[] Content;
+               }
+
+               [Test]
+               public void DeserializeXElementArray ()
+               {
+                       var xmlString = "<Root><Data /></Root>";
+
+                       var serializer = new XmlSerializer (typeof (DeserializeXElementArray_Data));
+                       var res = serializer.Deserialize (new StringReader (xmlString));
+
+                       Assert.IsNotNull (res, "#1");
+                       Assert.AreEqual (typeof (DeserializeXElementArray_Data), res.GetType (), "#2");
+                       var xe = (DeserializeXElementArray_Data)res;
+                       Assert.AreEqual (xe.Content [0].ToString (), "<Data />", "#3");
+               }
 
                [Test] // Bug #20151
                public void XElementFromArrayWithNullValuesAsObject ()
index da577e644effc0f851c9617fa46466d4140a3c4a..bbbf42e13f5d5a1b9374221ec8f40308bd423432 100644 (file)
@@ -220,8 +220,8 @@ namespace MonoTests.System.Xml.Schema
                                }
                        }
 
-                       Assert.GreaterOrEqual (afterNoOfAttributes, beforeNoOfAttributes, "newAttributes");
-                       Assert.GreaterOrEqual (afterNoOfElements, beforeNoOfElements, "newElements");       
+                       AssertHelper.GreaterOrEqual (afterNoOfAttributes, beforeNoOfAttributes, "newAttributes");
+                       AssertHelper.GreaterOrEqual (afterNoOfElements, beforeNoOfElements, "newElements");       
                }
 
                /*
index 0a8d012190109c5b10b6125c1780121e318cf82a..67be7c03bdb691dc88184f19d35cfb4f49a6616a 100644 (file)
@@ -1,5 +1,5 @@
 //
-// TypeForwarders.cs
+// AssemblyInfo.cs
 //
 // Author:
 //       Martin Baulig <martin.baulig@xamarin.com>
@@ -40,5 +40,3 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyFileVersion (Consts.FxFileVersion)]
 [assembly: AssemblyDelaySign (true)]
 [assembly: AssemblyKeyFile ("../ecma.pub")]
-
-[assembly: ReferenceAssembly]
index 5168c310d8608d21d54db0c43b9d10c90567c014..fa1bdd68c392c865451da9c9e2b6db2690ac2e02 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 69456085a2bda90e18facc43bc4dcfcdffedf776..6ed83d7c1e03020ffe63c8d68f4d129ec468b6bd 100644 (file)
@@ -55,33 +55,26 @@ using System.Runtime.InteropServices;
 [assembly: NeutralResourcesLanguage ("en-US")]
 
 [assembly: ComVisible (false)]
-#if !NET_2_1
+#if !MOBILE
 [assembly: ComCompatibleVersion (1, 0, 3300, 0)]
 [assembly: AllowPartiallyTrustedCallers]
 #endif
 
 #if !BOOTSTRAP_WITH_OLDLIB
        [assembly: AssemblyDelaySign (true)]
-#if NET_2_1
+#if MOBILE
        [assembly: AssemblyKeyFile ("../silverlight.pub")]
 #else
        [assembly: AssemblyKeyFile ("../ecma.pub")]
 #endif
 #endif
 
-#if NET_2_1 && !MOBILE
-       [assembly: InternalsVisibleTo ("System.Net, PublicKey=00240000048000009400000006020000002400005253413100040000010001008D56C76F9E8649383049F383C44BE0EC204181822A6C31CF5EB7EF486944D032188EA1D3920763712CCB12D75FB77E9811149E6148E5D32FBAAB37611C1878DDC19E20EF135D0CB2CFF2BFEC3D115810C3D9069638FE4BE215DBF795861920E5AB6F7DB2E2CEEF136AC23D5DD2BF031700AEC232F6C6B1C785B4305C123B37AB")]
-#else
        [assembly: InternalsVisibleTo ("System.ComponentModel.DataAnnotations, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")]
        [assembly: InternalsVisibleTo ("System.Net.Http, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")]
        [assembly: StringFreezing]
        [assembly: DefaultDependency (LoadHint.Always)]
-#endif
 
-       [assembly: InternalsVisibleTo ("Mono.Security.Providers.NewSystemSource, PublicKey=002400000480000094000000060200000024000052534131000400000100010079159977d2d03a8e6bea7a2e74e8d1afcc93e8851974952bb480a12c9134474d04062447c37e0e68c080536fcf3c3fbe2ff9c979ce998475e506e8ce82dd5b0f350dc10e93bf2eeecf874b24770c5081dbea7447fddafa277b22de47d6ffea449674a4f9fccf84d15069089380284dbdd35f46cdff12a1bd78e4ef0065d016df")]
-       [assembly: InternalsVisibleTo ("Mono.Security.Providers.OldTls, PublicKey=002400000480000094000000060200000024000052534131000400000100010079159977d2d03a8e6bea7a2e74e8d1afcc93e8851974952bb480a12c9134474d04062447c37e0e68c080536fcf3c3fbe2ff9c979ce998475e506e8ce82dd5b0f350dc10e93bf2eeecf874b24770c5081dbea7447fddafa277b22de47d6ffea449674a4f9fccf84d15069089380284dbdd35f46cdff12a1bd78e4ef0065d016df")]
-       [assembly: InternalsVisibleTo ("Mono.Security.Providers.NewTls, PublicKey=002400000480000094000000060200000024000052534131000400000100010079159977d2d03a8e6bea7a2e74e8d1afcc93e8851974952bb480a12c9134474d04062447c37e0e68c080536fcf3c3fbe2ff9c979ce998475e506e8ce82dd5b0f350dc10e93bf2eeecf874b24770c5081dbea7447fddafa277b22de47d6ffea449674a4f9fccf84d15069089380284dbdd35f46cdff12a1bd78e4ef0065d016df")]
-       [assembly: InternalsVisibleTo ("Mono.Security.Providers.DotNet, PublicKey=002400000480000094000000060200000024000052534131000400000100010079159977d2d03a8e6bea7a2e74e8d1afcc93e8851974952bb480a12c9134474d04062447c37e0e68c080536fcf3c3fbe2ff9c979ce998475e506e8ce82dd5b0f350dc10e93bf2eeecf874b24770c5081dbea7447fddafa277b22de47d6ffea449674a4f9fccf84d15069089380284dbdd35f46cdff12a1bd78e4ef0065d016df")]
+       [assembly: InternalsVisibleTo ("btls-cert-sync, PublicKey=002400000480000094000000060200000024000052534131000400000100010079159977d2d03a8e6bea7a2e74e8d1afcc93e8851974952bb480a12c9134474d04062447c37e0e68c080536fcf3c3fbe2ff9c979ce998475e506e8ce82dd5b0f350dc10e93bf2eeecf874b24770c5081dbea7447fddafa277b22de47d6ffea449674a4f9fccf84d15069089380284dbdd35f46cdff12a1bd78e4ef0065d016df")]
+       [assembly: InternalsVisibleTo ("Mono.Btls.Interface, PublicKey=002400000480000094000000060200000024000052534131000400000100010079159977d2d03a8e6bea7a2e74e8d1afcc93e8851974952bb480a12c9134474d04062447c37e0e68c080536fcf3c3fbe2ff9c979ce998475e506e8ce82dd5b0f350dc10e93bf2eeecf874b24770c5081dbea7447fddafa277b22de47d6ffea449674a4f9fccf84d15069089380284dbdd35f46cdff12a1bd78e4ef0065d016df")]
        [assembly: InternalsVisibleTo ("Mono.Security, PublicKey=002400000480000094000000060200000024000052534131000400000100010079159977d2d03a8e6bea7a2e74e8d1afcc93e8851974952bb480a12c9134474d04062447c37e0e68c080536fcf3c3fbe2ff9c979ce998475e506e8ce82dd5b0f350dc10e93bf2eeecf874b24770c5081dbea7447fddafa277b22de47d6ffea449674a4f9fccf84d15069089380284dbdd35f46cdff12a1bd78e4ef0065d016df")]
 
-       [assembly: InternalsVisibleTo ("Xamarin.BoringTls, PublicKey=002400000480000094000000060200000024000052534131000400001100000099dd12eda85767ae6f06023ee28e711c7e5a212462095c83868c29db75eddf6d8e296e03824c14fedd5f55553fed0b6173be3cc985a4b7f9fb7c83ccff8ba3938563b3d1f45a81122f12a1bcb73edcaad61a8456c7595a6da5184b4dd9d10f011b949ef1391fccfeab1ba62aa51c267ef8bd57ef1b6ba5a4c515d0badb81a78f")]
index fe01d7e4317c78eaa7a368f31ccd41952da83cb4..3c4d4dfc432545695f408db248194988c893da40 100644 (file)
@@ -19,22 +19,38 @@ TEST_RESOURCES = \
        Test/System/test-uri-props-manual.txt \
        Test/System/test-uri-relative-props.txt
 
+ifndef NO_MONO_SECURITY
+MONO_SECURITY=Mono.Security
+MONO_SECURITY_REF=MonoSecurity=Mono.Security
+MONO_SECURITY_DLL=$(the_libdir_base)Mono.Security.dll
+endif
+
 ifndef MOBILE_PROFILE
-TEST_LIB_REFS = System.Drawing Mono.Security System.Data System.Xml System.Core System.Configuration
+TEST_LIB_REFS = System.Drawing $(MONO_SECURITY) System.Data System.Xml System.Core System.Configuration
 else
-TEST_LIB_REFS = Mono.Security System.Data System.Xml System.Core
+TEST_LIB_REFS = $(MONO_SECURITY) System.Data System.Xml System.Core
 endif
 
 TEST_MCS_FLAGS = -nowarn:618,672,219,67,169,612 \
        $(foreach f, $(TEST_RESOURCES), -resource:$(f),$(notdir $(f)))
 
+TEST_NUNITLITE_APP_CONFIG_GLOBAL=Test/test-config-file
+
 REFERENCE_SOURCES_FLAGS = -d:FEATURE_PAL,SYSTEM_NAMESPACE,MONO,PLATFORM_UNIX
 ifndef NO_PROCESS_START
 REFERENCE_SOURCES_FLAGS += -d:MONO_FEATURE_PROCESS_START
 TEST_MCS_FLAGS += -d:MONO_FEATURE_PROCESS_START
 endif
 
-LIB_MCS_FLAGS = -nowarn:618 -d:CONFIGURATION_2_0 $(REFERENCE_SOURCES_FLAGS) -unsafe $(RESOURCE_FILES:%=-resource:%)
+LIB_MCS_FLAGS = -d:CONFIGURATION_2_0 $(REFERENCE_SOURCES_FLAGS) -unsafe $(RESOURCE_FILES:%=-resource:%)
+
+ifndef PROFILE_DISABLE_BTLS
+ifdef HAVE_BTLS
+
+LIB_MCS_FLAGS += -d:MONO_FEATURE_BTLS
+
+endif
+endif
 
 ifndef NO_THREAD_ABORT
 REFERENCE_SOURCES_FLAGS += -d:MONO_FEATURE_THREAD_ABORT
@@ -57,7 +73,7 @@ TXT_RESOURCE_STRINGS = ../referencesource/System/System.txt
 # MOBILE_PROFILE needs SECURITY_DEP
 #
 ifdef MOBILE_PROFILE
-LIB_MCS_FLAGS += -d:INSIDE_SYSTEM -d:SECURITY_DEP
+LIB_MCS_FLAGS += -d:INSIDE_SYSTEM -d:SECURITY_DEP -nowarn:618,1635
 else
 EXTERN_ALIAS_FLAGS = -d:MONO_SECURITY_ALIAS
 endif
@@ -67,7 +83,7 @@ endif
 #
 ifeq (secxml/, $(intermediate))
 LOCAL_MCS_FLAGS =
-LIB_REFS += bare/System.Xml MonoSecurity=Mono.Security
+LIB_REFS += bare/System.Xml $(MONO_SECURITY_REF)
 LIB_MCS_FLAGS += -d:SECURITY_DEP -d:XML_DEP $(EXTERN_ALIAS_FLAGS)
 endif
 
@@ -75,7 +91,7 @@ endif
 # Flags used to build the final version of System (when intermediate is not defined)
 #
 ifndef intermediate
-LIB_REFS += System.Xml MonoSecurity=Mono.Security
+LIB_REFS += System.Xml $(MONO_SECURITY_REF)
 LIB_MCS_FLAGS += -d:SECURITY_DEP -d:XML_DEP $(EXTERN_ALIAS_FLAGS)
 
 ifndef MOBILE_PROFILE
@@ -87,7 +103,6 @@ endif
 
 EXTRA_DISTFILES = \
        Test/test-config-file                           \
-       Test/test-config-file-net-2.0                   \
        Test/System.Security.Cryptography.X509Certificates/pkits/Makefile       \
        Test/System.Security.Cryptography.X509Certificates/pkits/README         \
        Test/System.Security.Cryptography.X509Certificates/pkits/x509build.cs   \
@@ -99,7 +114,7 @@ include ../../build/library.make
 system_library_deps := \
        $(secxml_libdir)/System.dll             \
        $(the_libdir_base)System.Xml.dll        \
-       $(the_libdir_base)Mono.Security.dll     \
+       $(MONO_SECURITY_DLL)                            \
        $(bare_libdir)/System.dll
 
 ifndef MOBILE_PROFILE
@@ -108,7 +123,7 @@ endif
 
 artifacts = $(system_library_deps)                     \
        $(bare_libdir)/System.Xml.dll                   \
-       $(the_libdir_base)Mono.Security.dll             \
+       $(MONO_SECURITY_DLL)                            \
        $(the_libdir_base)System.Configuration.dll
 
 .NOTPARALLEL: $(system_library_deps)
@@ -123,7 +138,7 @@ $(bare_libdir)/System.dll:
 endif
 
 ifneq (secxml/,$(intermediate))
-$(secxml_libdir)/System.dll: $(bare_libdir)/System.dll $(bare_libdir)/System.Xml.dll $(the_libdir_base)Mono.Security.dll $(bare_libdir)/System.dll
+$(secxml_libdir)/System.dll: $(bare_libdir)/System.dll $(bare_libdir)/System.Xml.dll $(MONO_SECURITY_DLL) $(bare_libdir)/System.dll
        $(MAKE) intermediate=secxml/ $(secxml_libdir)/System.dll
 else
 build-sec:
@@ -143,10 +158,7 @@ $(the_libdir_base)System.Configuration.dll:
 
 $(build_lib): $(CYCLIC_DEP_FILES)
 
-$(test_lib): $(test_lib).config $(TEST_RESOURCES)
-
-$(test_lib).config: Test/test-config-file
-       cp $< $@
+$(test_lib): $(TEST_RESOURCES)
 
 CLEAN_FILES = $(test_lib).config $(bare_libdir)/System.dll $(secxml_libdir)/System.dll $(bare_libdir)/System.dll.mdb $(secxml_libdir)/System.dll.mdb
 
index 00424bd70f370d8cc10be4b2e2ddeec4ead96442..c41240fab9e280d5ace8c1e9527f4a5ab080254b 100644 (file)
@@ -48,54 +48,9 @@ namespace Mono.CSharp
        
        internal class CSharpCodeCompiler : CSharpCodeGenerator, ICodeCompiler
        {
-               static string windowsMcsPath;
-               static string windowsMonoPath;
-               static string unixMcsCommand;
-
                Mutex mcsOutMutex;
                StringCollection mcsOutput;
                
-               static CSharpCodeCompiler ()
-               {
-                       if (Path.DirectorySeparatorChar == '\\') {
-                               PropertyInfo gac = typeof (Environment).GetProperty ("GacPath", BindingFlags.Static|BindingFlags.NonPublic);
-                               MethodInfo get_gac = gac.GetGetMethod (true);
-                               string p = Path.GetDirectoryName (
-                                       (string) get_gac.Invoke (null, null));
-                               windowsMonoPath = Path.Combine (
-                                       Path.GetDirectoryName (
-                                               Path.GetDirectoryName (p)),
-                                       "bin\\mono.bat");
-                               if (!File.Exists (windowsMonoPath))
-                                       windowsMonoPath = Path.Combine (
-                                               Path.GetDirectoryName (
-                                                       Path.GetDirectoryName (p)),
-                                               "bin\\mono.exe");
-                               if (!File.Exists (windowsMonoPath))
-                                       windowsMonoPath = Path.Combine (
-                                               Path.GetDirectoryName (
-                                                       Path.GetDirectoryName (
-                                                               Path.GetDirectoryName (p))),
-                                               "mono\\mono\\mini\\mono.exe");
-                               if (!File.Exists (windowsMonoPath))
-                                       throw new FileNotFoundException ("Windows mono path not found: " + windowsMonoPath);
-
-                               windowsMcsPath = Path.Combine (p, "4.5\\mcs.exe");
-                               if (!File.Exists (windowsMcsPath))
-                                       windowsMcsPath = Path.Combine(Path.GetDirectoryName (p), "lib\\build\\mcs.exe");
-                               
-                               if (!File.Exists (windowsMcsPath))
-                                       throw new FileNotFoundException ("Windows mcs path not found: " + windowsMcsPath);
-                       } else {
-                               var mscorlibPath = new Uri (typeof (object).Assembly.CodeBase).LocalPath;
-                               var unixMcsPath = Path.GetFullPath (Path.Combine (mscorlibPath, "..", "..", "..", "..", "bin", "mcs"));
-                               if (File.Exists (unixMcsPath))
-                                       unixMcsCommand = unixMcsPath;
-                               else
-                                       unixMcsCommand = "mcs";
-                       }
-               }
-
                //
                // Constructors
                //
@@ -177,14 +132,14 @@ namespace Mono.CSharp
 
                        // FIXME: these lines had better be platform independent.
                        if (Path.DirectorySeparatorChar == '\\') {
-                               mcs.StartInfo.FileName = windowsMonoPath;
-                               mcs.StartInfo.Arguments = "\"" + windowsMcsPath + "\" " +
-                                       BuildArgs (options, fileNames, ProviderOptions);
+                               mcs.StartInfo.FileName = MonoToolsLocator.Mono;
+                               mcs.StartInfo.Arguments = "\"" + MonoToolsLocator.CSharpCompiler + "\" ";
                        } else {
-                               mcs.StartInfo.FileName=unixMcsCommand;
-                               mcs.StartInfo.Arguments=BuildArgs(options, fileNames, ProviderOptions);
+                               mcs.StartInfo.FileName = MonoToolsLocator.CSharpCompiler;
                        }
 
+                       mcs.StartInfo.Arguments += BuildArgs (options, fileNames, ProviderOptions);
+
                        mcsOutput = new StringCollection ();
                        mcsOutMutex = new Mutex ();
 /*                    
index bdb08db595adb849f3cea1b849b7b8a12fb9917a..907acebaa66f7ece769bbe4a359af68ba0a328dd 100644 (file)
@@ -48,38 +48,6 @@ namespace Microsoft.VisualBasic
 {
        internal class VBCodeCompiler : VBCodeGenerator, ICodeCompiler
        {
-               static string windowsMonoPath;
-               static string windowsvbncPath;
-               static string unixVbncCommand;
-
-               static VBCodeCompiler ()
-               {
-                       if (Path.DirectorySeparatorChar == '\\') {
-                               PropertyInfo gac = typeof (Environment).GetProperty ("GacPath", BindingFlags.Static | BindingFlags.NonPublic);
-                               MethodInfo get_gac = gac.GetGetMethod (true);
-                               string p = Path.GetDirectoryName (
-                                       (string) get_gac.Invoke (null, null));
-                               windowsMonoPath = Path.Combine (
-                                       Path.GetDirectoryName (
-                                               Path.GetDirectoryName (p)),
-                                       "bin\\mono.bat");
-                               if (!File.Exists (windowsMonoPath))
-                                       windowsMonoPath = Path.Combine (
-                                               Path.GetDirectoryName (
-                                                       Path.GetDirectoryName (p)),
-                                               "bin\\mono.exe");
-                               windowsvbncPath =
-                                       Path.Combine (p, "2.0\\vbnc.exe");
-                       } else {
-                               var mscorlibPath = new Uri (typeof (object).Assembly.CodeBase).LocalPath;
-                               var unixMcsPath = Path.GetFullPath (Path.Combine (mscorlibPath, "..", "..", "..", "..", "bin", "vbnc"));
-                               if (File.Exists (unixMcsPath))
-                                       unixVbncCommand = unixMcsPath;
-                               else
-                                       unixVbncCommand = "vbnc";
-                       }
-               }
-
                public CompilerResults CompileAssemblyFromDom (CompilerParameters options, CodeCompileUnit e)
                {
                        return CompileAssemblyFromDomBatch (options, new CodeCompileUnit[] { e });
@@ -248,10 +216,10 @@ namespace Microsoft.VisualBasic
                        string[] vbnc_output_lines;
                        // FIXME: these lines had better be platform independent.
                        if (Path.DirectorySeparatorChar == '\\') {
-                               vbnc.StartInfo.FileName = windowsMonoPath;
-                               vbnc.StartInfo.Arguments = windowsvbncPath + ' ' + BuildArgs (options, fileNames);
+                               vbnc.StartInfo.FileName = MonoToolsLocator.Mono;
+                               vbnc.StartInfo.Arguments = MonoToolsLocator.VBCompiler + ' ' + BuildArgs (options, fileNames);
                        } else {
-                               vbnc.StartInfo.FileName = "vbnc";
+                               vbnc.StartInfo.FileName = MonoToolsLocator.VBCompiler;
                                vbnc.StartInfo.Arguments = BuildArgs (options, fileNames);
                        }
                        //Console.WriteLine (vbnc.StartInfo.Arguments);
index f3091aa38bc1de43829a03ffeb0b886659949df0..9bad4ea25dd9ae03b4f64426bdfec98f006228fa 100644 (file)
@@ -34,25 +34,16 @@ using System.Security;
 
 namespace Microsoft.Win32.SafeHandles
 {
-       public sealed class SafeX509ChainHandle : SafeHandle
+       public sealed class SafeX509ChainHandle : SafeHandleZeroOrMinusOneIsInvalid
        {
-               [MonoTODO]
-               public override bool IsInvalid
-               {
-                       get
-                       {
-                               throw new NotImplementedException ();
-                       }
-               }
-
-               [MonoTODO]
-               internal SafeX509ChainHandle() : base ((IntPtr)0, false)
+               internal SafeX509ChainHandle (IntPtr handle)
+                       : base (true)
                {
                        throw new NotImplementedException ();
                }
 
                [MonoTODO]
-               protected override bool ReleaseHandle()
+               protected override bool ReleaseHandle ()
                {
                        throw new NotImplementedException ();
                }
diff --git a/mcs/class/System/Mono.Btls/MonoBtlsBio.cs b/mcs/class/System/Mono.Btls/MonoBtlsBio.cs
new file mode 100644 (file)
index 0000000..204d167
--- /dev/null
@@ -0,0 +1,449 @@
+//
+// MonoBtlsBio.cs
+//
+// Author:
+//       Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
+//
+// 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.
+#if SECURITY_DEP && MONO_FEATURE_BTLS
+using System;
+using System.IO;
+using System.Text;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+#if MONOTOUCH
+using MonoTouch;
+#endif
+
+namespace Mono.Btls
+{
+       class MonoBtlsBio : MonoBtlsObject
+       {
+               internal MonoBtlsBio (BoringBioHandle handle)
+                       : base (handle)
+               {
+               }
+
+               new protected internal BoringBioHandle Handle {
+                       get { return (BoringBioHandle)base.Handle; }
+               }
+
+               protected internal class BoringBioHandle : MonoBtlsHandle
+               {
+                       public BoringBioHandle (IntPtr handle)
+                               : base (handle, true)
+                       {
+                       }
+
+                       protected override bool ReleaseHandle ()
+                       {
+                               if (handle != IntPtr.Zero) {
+                                       mono_btls_bio_free (handle);
+                                       handle = IntPtr.Zero;
+                               }
+                               return true;
+                       }
+
+               }
+
+               public static MonoBtlsBio CreateMonoStream (Stream stream)
+               {
+                       return MonoBtlsBioMono.CreateStream (stream, false);
+               }
+
+               [DllImport (BTLS_DYLIB)]
+               extern static int mono_btls_bio_read (IntPtr bio, IntPtr data, int len);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static int mono_btls_bio_write (IntPtr bio, IntPtr data, int len);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static int mono_btls_bio_flush (IntPtr bio);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static int mono_btls_bio_indent (IntPtr bio, uint indent, uint max_indent);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static int mono_btls_bio_hexdump (IntPtr bio, IntPtr data, int len, uint indent);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static void mono_btls_bio_print_errors (IntPtr bio);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static void mono_btls_bio_free (IntPtr handle);
+
+               public int Read (byte[] buffer, int offset, int size)
+               {
+                       CheckThrow ();
+                       var data = Marshal.AllocHGlobal (size);
+                       if (data == IntPtr.Zero)
+                               throw new OutOfMemoryException ();
+
+                       bool release = false;
+                       try {
+                               Handle.DangerousAddRef (ref release);
+                               var ret = mono_btls_bio_read (Handle.DangerousGetHandle (), data, size);
+                               if (ret > 0)
+                                       Marshal.Copy (data, buffer,offset, ret);
+                               return ret;
+                       } finally {
+                               if (release)
+                                       Handle.DangerousRelease ();
+                               Marshal.FreeHGlobal (data);
+                       }
+               }
+
+               public int Write (byte[] buffer, int offset, int size)
+               {
+                       CheckThrow ();
+                       var data = Marshal.AllocHGlobal (size);
+                       if (data == IntPtr.Zero)
+                               throw new OutOfMemoryException ();
+
+                       bool release = false;
+                       try {
+                               Handle.DangerousAddRef (ref release);
+                               Marshal.Copy (buffer, offset, data, size);
+                               return mono_btls_bio_write (Handle.DangerousGetHandle (), data, size);
+                       } finally {
+                               if (release)
+                                       Handle.DangerousRelease ();
+                               Marshal.FreeHGlobal (data);
+                       }
+               }
+
+               public int Flush ()
+               {
+                       CheckThrow ();
+                       bool release = false;
+                       try {
+                               Handle.DangerousAddRef (ref release);
+                               return mono_btls_bio_flush (Handle.DangerousGetHandle ());
+                       } finally {
+                               if (release)
+                                       Handle.DangerousRelease ();
+                       }
+               }
+
+               public int Indent (uint indent, uint max_indent)
+               {
+                       CheckThrow ();
+                       bool release = false;
+                       try {
+                               Handle.DangerousAddRef (ref release);
+                               return mono_btls_bio_indent (Handle.DangerousGetHandle (), indent, max_indent);
+                       } finally {
+                               if (release)
+                                       Handle.DangerousRelease ();
+                       }
+               }
+
+               public int HexDump (byte[] buffer, uint indent)
+               {
+                       CheckThrow ();
+                       var data = Marshal.AllocHGlobal (buffer.Length);
+                       if (data == IntPtr.Zero)
+                               throw new OutOfMemoryException ();
+
+                       bool release = false;
+                       try {
+                               Handle.DangerousAddRef (ref release);
+                               Marshal.Copy (buffer, 0, data, buffer.Length);
+                               return mono_btls_bio_hexdump (Handle.DangerousGetHandle (), data, buffer.Length, indent);
+                       } finally {
+                               if (release)
+                                       Handle.DangerousRelease ();
+                               Marshal.FreeHGlobal (data);
+                       }
+               }
+
+               public void PrintErrors ()
+               {
+                       CheckThrow ();
+                       bool release = false;
+                       try {
+                               Handle.DangerousAddRef (ref release);
+                               mono_btls_bio_print_errors (Handle.DangerousGetHandle ());
+                       } finally {
+                               if (release)
+                                       Handle.DangerousRelease ();
+                       }
+               }
+       }
+
+       class MonoBtlsBioMemory : MonoBtlsBio
+       {
+               [DllImport (BTLS_DYLIB)]
+               extern static IntPtr mono_btls_bio_mem_new ();
+
+               [DllImport (BTLS_DYLIB)]
+               extern static int mono_btls_bio_mem_get_data (IntPtr handle, out IntPtr data);
+
+               public MonoBtlsBioMemory ()
+                       : base (new BoringBioHandle (mono_btls_bio_mem_new ()))
+               {
+               }
+
+               public byte[] GetData ()
+               {
+                       IntPtr data;
+                       bool release = false;
+                       try {
+                               Handle.DangerousAddRef (ref release);
+                               var size = mono_btls_bio_mem_get_data (Handle.DangerousGetHandle (), out data);
+                               CheckError (size > 0);
+                               var buffer = new byte[size];
+                               Marshal.Copy (data, buffer, 0, size);
+                               return buffer;
+                       } finally {
+                               if (release)
+                                       Handle.DangerousRelease ();
+                       }
+               }
+       }
+
+       interface IMonoBtlsBioMono
+       {
+               int Read (byte[] buffer, int offset, int size, out bool wantMore);
+
+               bool Write (byte[] buffer, int offset, int size);
+
+               void Flush ();
+
+               void Close ();
+       }
+
+       class MonoBtlsBioMono : MonoBtlsBio
+       {
+               GCHandle handle;
+               IntPtr instance;
+               BioReadFunc readFunc;
+               BioWriteFunc writeFunc;
+               BioControlFunc controlFunc;
+               IntPtr readFuncPtr;
+               IntPtr writeFuncPtr;
+               IntPtr controlFuncPtr;
+               IMonoBtlsBioMono backend;
+
+               public MonoBtlsBioMono (IMonoBtlsBioMono backend)
+                       : base (new BoringBioHandle (mono_btls_bio_mono_new ()))
+               {
+                       this.backend = backend;
+                       handle = GCHandle.Alloc (this);
+                       instance = GCHandle.ToIntPtr (handle);
+                       readFunc = OnRead;
+                       writeFunc = OnWrite;
+                       controlFunc = Control;
+                       readFuncPtr = Marshal.GetFunctionPointerForDelegate (readFunc);
+                       writeFuncPtr = Marshal.GetFunctionPointerForDelegate (writeFunc);
+                       controlFuncPtr = Marshal.GetFunctionPointerForDelegate (controlFunc);
+                       mono_btls_bio_mono_initialize (Handle.DangerousGetHandle (), instance, readFuncPtr, writeFuncPtr, controlFuncPtr);
+               }
+
+               public static MonoBtlsBioMono CreateStream (Stream stream, bool ownsStream)
+               {
+                       return new MonoBtlsBioMono (new StreamBackend (stream, ownsStream));
+               }
+
+               public static MonoBtlsBioMono CreateString (StringWriter writer)
+               {
+                       return new MonoBtlsBioMono (new StringBackend (writer));
+               }
+
+               enum ControlCommand
+               {
+                       Flush = 1
+               }
+
+               delegate int BioReadFunc (IntPtr bio, IntPtr data, int dataLength, out int wantMore);
+               delegate int BioWriteFunc (IntPtr bio, IntPtr data, int dataLength);
+               delegate long BioControlFunc (IntPtr bio, ControlCommand command, long arg);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static IntPtr mono_btls_bio_mono_new ();
+
+               [DllImport (BTLS_DYLIB)]
+               extern static void mono_btls_bio_mono_initialize (IntPtr handle, IntPtr instance, IntPtr readFunc, IntPtr writeFunc, IntPtr controlFunc);
+
+               long Control (ControlCommand command, long arg)
+               {
+                       switch (command) {
+                       case ControlCommand.Flush:
+                               backend.Flush ();
+                               return 1;
+
+                       default:
+                               throw new NotImplementedException ();
+                       }
+               }
+
+               int OnRead (IntPtr data, int dataLength, out int wantMore)
+               {
+                       bool wantMoreBool;
+                       var buffer = new byte[dataLength];
+                       var ret = backend.Read (buffer, 0, dataLength, out wantMoreBool);
+                       wantMore = wantMoreBool ? 1 : 0;
+                       if (ret <= 0)
+                               return ret;
+                       Marshal.Copy (buffer, 0, data, ret);
+                       return ret;
+               }
+
+#if MONOTOUCH
+               [MonoPInvokeCallback (typeof (BioReadFunc))]
+#endif
+               static int OnRead (IntPtr instance, IntPtr data, int dataLength, out int wantMore)
+               {
+                       var c = (MonoBtlsBioMono)GCHandle.FromIntPtr (instance).Target;
+                       try {
+                               return c.OnRead (data, dataLength, out wantMore);
+                       } catch (Exception ex) {
+                               c.SetException (ex);
+                               wantMore = 0;
+                               return -1;
+                       }
+               }
+
+               int OnWrite (IntPtr data, int dataLength)
+               {
+                       var buffer = new byte[dataLength];
+                       Marshal.Copy (data, buffer, 0, dataLength);
+                       var ok = backend.Write (buffer, 0, dataLength);
+                       return ok ? dataLength : -1;
+               }
+
+#if MONOTOUCH
+               [MonoPInvokeCallback (typeof (BioWriteFunc))]
+#endif
+               static int OnWrite (IntPtr instance, IntPtr data, int dataLength)
+               {
+                       var c = (MonoBtlsBioMono)GCHandle.FromIntPtr (instance).Target;
+                       try {
+                               return c.OnWrite (data, dataLength);
+                       } catch (Exception ex) {
+                               c.SetException (ex);
+                               return -1;
+                       }
+               }
+
+#if MONOTOUCH
+               [MonoPInvokeCallback (typeof (BioControlFunc))]
+#endif
+               static long Control (IntPtr instance, ControlCommand command, long arg)
+               {
+                       var c = (MonoBtlsBioMono)GCHandle.FromIntPtr (instance).Target;
+                       try {
+                               return c.Control (command, arg);
+                       } catch (Exception ex) {
+                               c.SetException (ex);
+                               return -1;
+                       }
+               }
+
+               protected override void Close ()
+               {
+                       try {
+                               if (backend != null) {
+                                       backend.Close ();
+                                       backend = null;
+                               }
+                               if (handle.IsAllocated)
+                                       handle.Free ();
+                       } finally {
+                               base.Close ();
+                       }
+               }
+
+               class StreamBackend : IMonoBtlsBioMono
+               {
+                       Stream stream;
+                       bool ownsStream;
+
+                       public Stream InnerStream {
+                               get { return stream; }
+                       }
+
+                       public StreamBackend (Stream stream, bool ownsStream)
+                       {
+                               this.stream = stream;
+                               this.ownsStream = ownsStream;
+                       }
+
+                       public int Read (byte[] buffer, int offset, int size, out bool wantMore)
+                       {
+                               wantMore = false;
+                               return stream.Read (buffer, offset, size);
+                       }
+
+                       public bool Write (byte[] buffer, int offset, int size)
+                       {
+                               stream.Write (buffer, offset, size);
+                               return true;
+                       }
+
+                       public void Flush ()
+                       {
+                               stream.Flush ();
+                       }
+
+                       public void Close ()
+                       {
+                               if (ownsStream && stream != null)
+                                       stream.Dispose ();
+                               stream = null;
+                       }
+               }
+
+               class StringBackend : IMonoBtlsBioMono
+               {
+                       StringWriter writer;
+                       Encoding encoding = new UTF8Encoding ();
+
+                       public StringBackend (StringWriter writer)
+                       {
+                               this.writer = writer;
+                       }
+
+                       public int Read (byte[] buffer, int offset, int size, out bool wantMore)
+                       {
+                               wantMore = false;
+                               return -1;
+                       }
+
+                       public bool Write (byte[] buffer, int offset, int size)
+                       {
+                               var text = encoding.GetString (buffer, offset, size);
+                               writer.Write (text);
+                               return true;
+                       }
+
+                       public void Flush ()
+                       {
+                       }
+
+                       public void Close ()
+                       {
+                       }
+               }
+       }
+}
+#endif
diff --git a/mcs/class/System/Mono.Btls/MonoBtlsContext.cs b/mcs/class/System/Mono.Btls/MonoBtlsContext.cs
new file mode 100644 (file)
index 0000000..343ecc4
--- /dev/null
@@ -0,0 +1,446 @@
+//
+// MonoBtlsContext.cs
+//
+// Author:
+//       Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
+//
+// 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.
+#if SECURITY_DEP && MONO_FEATURE_BTLS
+#if MONO_SECURITY_ALIAS
+extern alias MonoSecurity;
+#endif
+
+using System;
+using System.IO;
+using System.Threading;
+using System.Threading.Tasks;
+using System.Security.Cryptography.X509Certificates;
+using System.Security.Authentication;
+using System.Runtime.InteropServices;
+
+#if MONO_SECURITY_ALIAS
+using MonoSecurity::Mono.Security.Interface;
+#else
+using Mono.Security.Interface;
+#endif
+
+using MNS = Mono.Net.Security;
+
+namespace Mono.Btls
+{
+       class MonoBtlsContext : MNS.MobileTlsContext, IMonoBtlsBioMono
+       {
+               X509Certificate remoteCertificate;
+               X509Certificate clientCertificate;
+               X509CertificateImplBtls nativeServerCertificate;
+               X509CertificateImplBtls nativeClientCertificate;
+               MonoBtlsSslCtx ctx;
+               MonoBtlsSsl ssl;
+               MonoBtlsBio bio;
+               MonoBtlsBio errbio;
+
+               MonoTlsConnectionInfo connectionInfo;
+               bool certificateValidated;
+               bool isAuthenticated;
+               bool connected;
+
+               public MonoBtlsContext (
+                       MNS.MobileAuthenticatedStream parent,
+                       bool serverMode, string targetHost,
+                       SslProtocols enabledProtocols, X509Certificate serverCertificate,
+                       X509CertificateCollection clientCertificates, bool askForClientCert)
+                       : base (parent, serverMode, targetHost, enabledProtocols,
+                               serverCertificate, clientCertificates, askForClientCert)
+               {
+                       if (serverMode)
+                               nativeServerCertificate = GetPrivateCertificate (serverCertificate);
+               }
+
+               static X509CertificateImplBtls GetPrivateCertificate (X509Certificate certificate)
+               {
+                       var impl = certificate.Impl as X509CertificateImplBtls;
+                       if (impl != null)
+                               return (X509CertificateImplBtls)impl.Clone ();
+
+                       var password = Guid.NewGuid ().ToString ();
+                       var buffer = certificate.Export (X509ContentType.Pfx, password);
+
+                       impl = new X509CertificateImplBtls ();
+                       impl.Import (buffer, password, X509KeyStorageFlags.DefaultKeySet);
+                       return impl;
+               }
+
+               new public MonoBtlsProvider Provider {
+                       get { return (MonoBtlsProvider)base.Provider; }
+               }
+
+               int VerifyCallback (MonoBtlsX509StoreCtx storeCtx)
+               {
+                       using (var chainImpl = new X509ChainImplBtls (storeCtx))
+                       using (var managedChain = new X509Chain (chainImpl)) {
+                               var leaf = managedChain.ChainElements[0].Certificate;
+                               var result = ValidateCertificate (leaf, managedChain);
+                               certificateValidated = true;
+                               return result ? 1 : 0;
+                       }
+               }
+
+               int SelectCallback ()
+               {
+                       Debug ("SELECT CALLBACK!");
+
+                       GetPeerCertificate ();
+                       if (remoteCertificate == null)
+                               throw new TlsException (AlertDescription.InternalError, "Cannot request client certificate before receiving one from the server.");
+
+                       var clientCert = SelectClientCertificate (remoteCertificate, null);
+                       Debug ("SELECT CALLBACK #1: {0}", clientCert);
+                       if (clientCert == null)
+                               return 1;
+
+                       nativeClientCertificate = GetPrivateCertificate (clientCert);
+                       Debug ("SELECT CALLBACK #2: {0}", nativeClientCertificate);
+                       clientCertificate = new X509Certificate (nativeClientCertificate);
+                       SetPrivateCertificate (nativeClientCertificate);
+                       return 1;
+               }
+
+               public override void StartHandshake ()
+               {
+                       InitializeConnection ();
+
+                       ssl = new MonoBtlsSsl (ctx);
+
+                       bio = new MonoBtlsBioMono (this);
+                       ssl.SetBio (bio);
+
+                       if (IsServer) {
+                               SetPrivateCertificate (nativeServerCertificate);
+                       } else {
+                               ssl.SetServerName (ServerName);
+                       }
+               }
+
+               void SetPrivateCertificate (X509CertificateImplBtls privateCert)
+               {
+                       Debug ("SetPrivateCertificate: {0}", privateCert);
+                       ssl.SetCertificate (privateCert.X509);
+                       ssl.SetPrivateKey (privateCert.NativePrivateKey);
+                       var intermediate = privateCert.IntermediateCertificates;
+                       if (intermediate == null)
+                               return;
+                       for (int i = 0; i < intermediate.Count; i++) {
+                               var impl = (X509CertificateImplBtls)intermediate [i];
+                               Debug ("SetPrivateCertificate - add intermediate: {0}", impl);
+                               ssl.AddIntermediateCertificate (impl.X509);
+                       }
+               }
+
+               static Exception GetException (MonoBtlsSslError status)
+               {
+                       var error = MonoBtlsError.GetError ();
+                       var text = MonoBtlsError.GetErrorString (error);
+                       return new MonoBtlsException ("{0} {1}", status, text);
+               }
+
+               public override bool ProcessHandshake ()
+               {
+                       var done = false;
+                       while (!done) {
+                               Debug ("ProcessHandshake");
+                               MonoBtlsError.ClearError ();
+                               var status = DoProcessHandshake ();
+                               Debug ("ProcessHandshake #1: {0}", status);
+
+                               switch (status) {
+                               case MonoBtlsSslError.None:
+                                       if (connected)
+                                               done = true;
+                                       else
+                                               connected = true;
+                                       break;
+                               case MonoBtlsSslError.WantRead:
+                               case MonoBtlsSslError.WantWrite:
+                                       return false;
+                               default:
+                                       throw GetException (status);
+                               }
+                       }
+
+                       ssl.PrintErrors ();
+
+                       return true;
+               }
+
+               MonoBtlsSslError DoProcessHandshake ()
+               {
+                       if (connected)
+                               return ssl.Handshake ();
+                       else if (IsServer)
+                               return ssl.Accept ();
+                       else
+                               return ssl.Connect ();
+               }
+
+               public override void FinishHandshake ()
+               {
+                       InitializeSession ();
+
+                       isAuthenticated = true;
+               }
+
+               void SetupCertificateStore ()
+               {
+                       MonoBtlsProvider.SetupCertificateStore (ctx.CertificateStore);
+
+                       if (Settings != null && Settings.TrustAnchors != null) {
+                               var trust = IsServer ? MonoBtlsX509TrustKind.TRUST_CLIENT : MonoBtlsX509TrustKind.TRUST_SERVER;
+                               ctx.CertificateStore.AddCollection (Settings.TrustAnchors, trust);
+                       }
+               }
+
+               void InitializeConnection ()
+               {
+                       ctx = new MonoBtlsSslCtx ();
+
+#if MARTIN_DEBUG
+                       errbio = MonoBtlsBio.CreateMonoStream (Console.OpenStandardError ());
+                       ctx.SetDebugBio (errbio);
+#endif
+
+                       SetupCertificateStore ();
+
+                       if (!IsServer || AskForClientCertificate)
+                               ctx.SetVerifyCallback (VerifyCallback, false);
+                       if (!IsServer)
+                               ctx.SetSelectCallback (SelectCallback);
+
+                       ctx.SetVerifyParam (MonoBtlsProvider.GetVerifyParam (ServerName, IsServer));
+
+                       TlsProtocolCode minProtocol, maxProtocol;
+                       GetProtocolVersions (out minProtocol, out maxProtocol);
+
+                       ctx.SetMinVersion ((int)minProtocol);
+                       ctx.SetMaxVersion ((int)maxProtocol);
+
+                       if (Settings != null && Settings.EnabledCiphers != null) {
+                               var ciphers = new short [Settings.EnabledCiphers.Length];
+                               for (int i = 0; i < ciphers.Length; i++)
+                                       ciphers [i] = (short)Settings.EnabledCiphers [i];
+                               ctx.SetCiphers (ciphers, true);
+                       }
+               }
+
+               void GetPeerCertificate ()
+               {
+                       if (remoteCertificate != null)
+                               return;
+                       using (var remoteCert = ssl.GetPeerCertificate ()) {
+                               if (remoteCert != null)
+                                       remoteCertificate = MonoBtlsProvider.CreateCertificate (remoteCert);
+                       }
+               }
+
+               void InitializeSession ()
+               {
+                       GetPeerCertificate ();
+
+                       if (IsServer && AskForClientCertificate && !certificateValidated) {
+                               if (!ValidateCertificate (null, null))
+                                       throw new TlsException (AlertDescription.CertificateUnknown);
+                       }
+
+                       var cipher = (CipherSuiteCode)ssl.GetCipher ();
+                       var protocol = (TlsProtocolCode)ssl.GetVersion ();
+                       var serverName = ssl.GetServerName ();
+                       Debug ("GET CONNECTION INFO: {0:x}:{0} {1:x}:{1} {2}", cipher, protocol, (TlsProtocolCode)protocol);
+
+                       connectionInfo = new MonoTlsConnectionInfo {
+                               CipherSuiteCode = cipher,
+                               ProtocolVersion = GetProtocol (protocol),
+                               PeerDomainName = serverName
+                       };
+               }
+
+               static TlsProtocols GetProtocol (TlsProtocolCode protocol)
+               {
+                       switch (protocol) {
+                       case TlsProtocolCode.Tls10:
+                               return TlsProtocols.Tls10;
+                       case TlsProtocolCode.Tls11:
+                               return TlsProtocols.Tls11;
+                       case TlsProtocolCode.Tls12:
+                               return TlsProtocols.Tls12;
+                       default:
+                               throw new NotSupportedException ();
+                       }
+               }
+
+               public override void Flush ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override int Read (byte[] buffer, int offset, int size, out bool wantMore)
+               {
+                       Debug ("Read: {0} {1} {2}", buffer.Length, offset, size);
+
+                       var data = Marshal.AllocHGlobal (size);
+                       if (data == IntPtr.Zero)
+                               throw new OutOfMemoryException ();
+
+                       try {
+                               MonoBtlsError.ClearError ();
+                               var status = ssl.Read (data, ref size);
+                               Debug ("Read done: {0} {1}", status, size);
+
+                               if (status == MonoBtlsSslError.WantRead) {
+                                       wantMore = true;
+                                       return 0;
+                               } else if (status != MonoBtlsSslError.None) {
+                                       throw GetException (status);
+                               }
+
+                               if (size > 0)
+                                       Marshal.Copy (data, buffer, offset, size);
+
+                               wantMore = false;
+                               return size;
+                       } finally {
+                               Marshal.FreeHGlobal (data);
+                       }
+               }
+
+               public override int Write (byte[] buffer, int offset, int size, out bool wantMore)
+               {
+                       Debug ("Write: {0} {1} {2}", buffer.Length, offset, size);
+
+                       var data = Marshal.AllocHGlobal (size);
+                       if (data == IntPtr.Zero)
+                               throw new OutOfMemoryException ();
+
+                       try {
+                               MonoBtlsError.ClearError ();
+                               Marshal.Copy (buffer, offset, data, size);
+                               var status = ssl.Write (data, ref size);
+                               Debug ("Write done: {0} {1}", status, size);
+
+                               if (status == MonoBtlsSslError.WantWrite) {
+                                       wantMore = true;
+                                       return 0;
+                               } else if (status != MonoBtlsSslError.None) {
+                                       throw GetException (status);
+                               }
+
+                               wantMore = false;
+                               return size;
+                       } finally {
+                               Marshal.FreeHGlobal (data);
+                       }
+               }
+
+               public override void Close ()
+               {
+                       Debug ("Close!");
+                       ssl.Dispose ();
+               }
+
+               void Dispose<T> (ref T disposable)
+                       where T : class, IDisposable
+               {
+                       try {
+                               if (disposable != null)
+                                       disposable.Dispose ();
+                       } catch {
+                               ;
+                       } finally {
+                               disposable = null;
+                       }
+               }
+
+               protected override void Dispose (bool disposing)
+               {
+                       try {
+                               if (disposing) {
+                                       Dispose (ref remoteCertificate);
+                                       Dispose (ref nativeServerCertificate);
+                                       Dispose (ref nativeClientCertificate);
+                                       Dispose (ref clientCertificate);
+                                       Dispose (ref ctx);
+                                       Dispose (ref ssl);
+                                       Dispose (ref bio);
+                                       Dispose (ref errbio);
+                               }
+                       } finally {
+                               base.Dispose (disposing);
+                       }
+               }
+
+               int IMonoBtlsBioMono.Read (byte[] buffer, int offset, int size, out bool wantMore)
+               {
+                       Debug ("InternalRead: {0} {1}", offset, size);
+                       var ret = Parent.InternalRead (buffer, offset, size, out wantMore);
+                       Debug ("InternalReadDone: {0} {1}", ret, wantMore);
+                       return ret;
+               }
+
+               bool IMonoBtlsBioMono.Write (byte[] buffer, int offset, int size)
+               {
+                       Debug ("InternalWrite: {0} {1}", offset, size);
+                       var ret = Parent.InternalWrite (buffer, offset, size);
+                       Debug ("InternalWrite done: {0}", ret);
+                       return ret;
+               }
+
+               void IMonoBtlsBioMono.Flush ()
+               {
+                       ;
+               }
+
+               void IMonoBtlsBioMono.Close ()
+               {
+                       ;
+               }
+
+               public override bool HasContext {
+                       get { return ssl != null && ssl.IsValid; }
+               }
+               public override bool IsAuthenticated {
+                       get { return isAuthenticated; }
+               }
+               public override MonoTlsConnectionInfo ConnectionInfo {
+                       get { return connectionInfo; }
+               }
+               internal override bool IsRemoteCertificateAvailable {
+                       get { return remoteCertificate != null; }
+               }
+               internal override X509Certificate LocalClientCertificate {
+                       get { return clientCertificate; }
+               }
+               public override X509Certificate RemoteCertificate {
+                       get { return remoteCertificate; }
+               }
+               public override TlsProtocols NegotiatedProtocol {
+                       get { return connectionInfo.ProtocolVersion; }
+               }
+       }
+}
+#endif
diff --git a/mcs/class/System/Mono.Btls/MonoBtlsError.cs b/mcs/class/System/Mono.Btls/MonoBtlsError.cs
new file mode 100644 (file)
index 0000000..5e61bcf
--- /dev/null
@@ -0,0 +1,83 @@
+//
+// MonoBtlsError.cs
+//
+// Author:
+//       Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)
+//
+// 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.
+#if SECURITY_DEP && MONO_FEATURE_BTLS
+using System;
+using System.IO;
+using System.Text;
+using System.Runtime.InteropServices;
+using System.Runtime.CompilerServices;
+
+#if MONOTOUCH
+using MonoTouch;
+#endif
+
+namespace Mono.Btls
+{
+       static class MonoBtlsError
+       {
+               [DllImport (MonoBtlsObject.BTLS_DYLIB)]
+               extern static int mono_btls_error_peek_error ();
+
+               [DllImport (MonoBtlsObject.BTLS_DYLIB)]
+               extern static int mono_btls_error_get_error ();
+
+               [DllImport (MonoBtlsObject.BTLS_DYLIB)]
+               extern static void mono_btls_error_clear_error ();
+
+               [DllImport (MonoBtlsObject.BTLS_DYLIB)]
+               extern static void mono_btls_error_get_error_string_n (int error, IntPtr buf, int len);
+
+               public static int PeekError ()
+               {
+                       return mono_btls_error_peek_error ();
+               }
+
+               public static int GetError ()
+               {
+                       return mono_btls_error_get_error ();
+               }
+
+               public static void ClearError ()
+               {
+                       mono_btls_error_clear_error ();
+               }
+
+               public static string GetErrorString (int error)
+               {
+                       var size = 1024;
+                       var buffer = Marshal.AllocHGlobal (size);
+                       if (buffer == IntPtr.Zero)
+                               throw new OutOfMemoryException ();
+                       try {
+                               mono_btls_error_get_error_string_n (error, buffer, size);
+                               return Marshal.PtrToStringAnsi (buffer);
+                       } finally {
+                               Marshal.FreeHGlobal (buffer);
+                       }
+               }
+       }
+}
+#endif
diff --git a/mcs/class/System/Mono.Btls/MonoBtlsException.cs b/mcs/class/System/Mono.Btls/MonoBtlsException.cs
new file mode 100644 (file)
index 0000000..44282c9
--- /dev/null
@@ -0,0 +1,53 @@
+//
+// MonoBtlsException.cs
+//
+// Author:
+//       Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
+//
+// 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.
+#if SECURITY_DEP && MONO_FEATURE_BTLS
+using System;
+
+namespace Mono.Btls
+{
+       class MonoBtlsException : Exception
+       {
+               public MonoBtlsException ()
+               {
+               }
+
+               public MonoBtlsException (MonoBtlsSslError error)
+                       : base (error.ToString ())
+               {
+               }
+
+               public MonoBtlsException (string message)
+                       : base (message)
+               {
+               }
+
+               public MonoBtlsException (string format, params object[] args)
+                       : base (string.Format (format, args))
+               {
+               }
+       }
+}
+#endif
diff --git a/mcs/class/System/Mono.Btls/MonoBtlsKey.cs b/mcs/class/System/Mono.Btls/MonoBtlsKey.cs
new file mode 100644 (file)
index 0000000..f0cc376
--- /dev/null
@@ -0,0 +1,104 @@
+//
+// MonoBtlsKey.cs
+//
+// Author:
+//       Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
+//
+// 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.
+#if SECURITY_DEP && MONO_FEATURE_BTLS
+using System;
+using System.IO;
+using System.Text;
+using System.Runtime.InteropServices;
+using System.Runtime.CompilerServices;
+
+namespace Mono.Btls
+{
+       class MonoBtlsKey : MonoBtlsObject
+       {
+               internal class BoringKeyHandle : MonoBtlsHandle
+               {
+                       internal BoringKeyHandle (IntPtr handle)
+                               : base (handle, true)
+                       {
+                       }
+
+                       protected override bool ReleaseHandle ()
+                       {
+                               mono_btls_key_free (handle);
+                               return true;
+                       }
+               }
+
+               [DllImport (BTLS_DYLIB)]
+               extern static void mono_btls_key_free (IntPtr handle);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static IntPtr mono_btls_key_up_ref (IntPtr handle);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static int mono_btls_key_get_bytes (IntPtr handle, out IntPtr data, out int size, int include_private_bits);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static int mono_btls_key_get_bits (IntPtr handle);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static int mono_btls_key_is_rsa (IntPtr handle);
+
+               new internal BoringKeyHandle Handle {
+                       get { return (BoringKeyHandle)base.Handle; }
+               }
+
+               internal MonoBtlsKey (BoringKeyHandle handle)
+                       : base (handle)
+               {
+               }
+
+               public byte[] GetBytes (bool include_private_bits)
+               {
+                       int size;
+                       IntPtr data;
+
+                       var ret = mono_btls_key_get_bytes (Handle.DangerousGetHandle (), out data, out size, include_private_bits ? 1 : 0);
+                       CheckError (ret);
+
+                       var buffer = new byte [size];
+                       Marshal.Copy (data, buffer, 0, size);
+                       FreeDataPtr (data);
+                       return buffer;
+               }
+
+               public bool IsRsa {
+                       get {
+                               return mono_btls_key_is_rsa (Handle.DangerousGetHandle ()) != 0;
+                       }
+               }
+
+               public MonoBtlsKey Copy ()
+               {
+                       CheckThrow ();
+                       var copy = mono_btls_key_up_ref (Handle.DangerousGetHandle ());
+                       CheckError (copy != IntPtr.Zero);
+                       return new MonoBtlsKey (new BoringKeyHandle (copy));
+               }
+       }
+}
+#endif
diff --git a/mcs/class/System/Mono.Btls/MonoBtlsObject.cs b/mcs/class/System/Mono.Btls/MonoBtlsObject.cs
new file mode 100644 (file)
index 0000000..4264411
--- /dev/null
@@ -0,0 +1,145 @@
+//
+// MonoBtlsObject.cs
+//
+// Author:
+//       Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
+//
+// 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.
+#if SECURITY_DEP && MONO_FEATURE_BTLS
+using System;
+using System.Threading;
+using System.Runtime.InteropServices;
+using System.Runtime.CompilerServices;
+
+namespace Mono.Btls
+{
+       abstract class MonoBtlsObject : IDisposable
+       {
+               internal const string BTLS_DYLIB = "libmono-btls-shared";
+
+               internal MonoBtlsObject (MonoBtlsHandle handle)
+               {
+                       this.handle = handle;
+               }
+
+               protected internal abstract class MonoBtlsHandle : SafeHandle
+               {
+                       internal MonoBtlsHandle ()
+                               : base (IntPtr.Zero, true)
+                       {
+                       }
+
+                       internal MonoBtlsHandle (IntPtr handle, bool ownsHandle)
+                               : base (handle, ownsHandle)
+                       {
+                       }
+
+                       public override bool IsInvalid {
+                               get { return handle == IntPtr.Zero; }
+                       }
+               }
+
+               internal MonoBtlsHandle Handle {
+                       get {
+                               CheckThrow ();
+                               return handle;
+                       }
+               }
+
+               public bool IsValid {
+                       get { return handle != null && !handle.IsInvalid; }
+               }
+
+               MonoBtlsHandle handle;
+               Exception lastError;
+
+               protected void CheckThrow ()
+               {
+                       if (lastError != null)
+                               throw lastError;
+                       if (handle == null || handle.IsInvalid)
+                               throw new ObjectDisposedException ("MonoBtlsSsl");
+               }
+
+               protected Exception SetException (Exception ex)
+               {
+                       if (lastError == null)
+                               lastError = ex;
+                       return ex;
+               }
+
+               protected void CheckError (bool ok, [CallerMemberName] string callerName = null)
+               {
+                       if (!ok) {
+                               if (callerName != null)
+                                       throw new MonoBtlsException ("{0}.{1} failed.", GetType ().Name, callerName);
+                               else
+                                       throw new MonoBtlsException ();
+                       }
+
+               }
+
+               protected void CheckError (int ret, [CallerMemberName] string callerName = null)
+               {
+                       CheckError (ret == 1, callerName);
+               }
+
+               [DllImport (BTLS_DYLIB)]
+               extern static void mono_btls_free (IntPtr data);
+
+               protected void FreeDataPtr (IntPtr data)
+               {
+                       mono_btls_free (data);
+               }
+
+               protected virtual void Close ()
+               {
+               }
+
+               protected void Dispose (bool disposing)
+               {
+                       if (disposing) {
+                               try {
+                                       if (handle != null) {
+                                               Close ();
+                                               handle.Dispose ();
+                                               handle = null;
+                                       }
+                               } finally {
+                                       var disposedExc = new ObjectDisposedException (GetType ().Name);
+                                       Interlocked.CompareExchange (ref lastError, disposedExc, null);
+                               }
+                       }
+               }
+
+               public void Dispose ()
+               {
+                       Dispose (true);
+                       GC.SuppressFinalize (this);
+               }
+
+               ~MonoBtlsObject ()
+               {
+                       Dispose (false);
+               }
+       }
+}
+#endif
diff --git a/mcs/class/System/Mono.Btls/MonoBtlsPkcs12.cs b/mcs/class/System/Mono.Btls/MonoBtlsPkcs12.cs
new file mode 100644 (file)
index 0000000..92e4320
--- /dev/null
@@ -0,0 +1,145 @@
+//
+// MonoBtlsPkcs12.cs
+//
+// Author:
+//       Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)
+//
+// 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.
+#if SECURITY_DEP && MONO_FEATURE_BTLS
+using System;
+using System.IO;
+using System.Security.Cryptography.X509Certificates;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+namespace Mono.Btls
+{
+       class MonoBtlsPkcs12 : MonoBtlsObject
+       {
+               internal class BoringPkcs12Handle : MonoBtlsHandle
+               {
+                       public BoringPkcs12Handle (IntPtr handle)
+                               : base (handle, true)
+                       {
+                       }
+
+                       protected override bool ReleaseHandle ()
+                       {
+                               mono_btls_pkcs12_free (handle);
+                               return true;
+                       }
+               }
+
+               new internal BoringPkcs12Handle Handle {
+                       get { return (BoringPkcs12Handle)base.Handle; }
+               }
+
+               [DllImport (BTLS_DYLIB)]
+               extern static void mono_btls_pkcs12_free (IntPtr handle);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static IntPtr mono_btls_pkcs12_new ();
+
+               [DllImport (BTLS_DYLIB)]
+               extern static int mono_btls_pkcs12_get_count (IntPtr handle);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static IntPtr mono_btls_pkcs12_get_cert (IntPtr Handle, int index);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static int mono_btls_pkcs12_add_cert (IntPtr chain, IntPtr x509);
+
+               [DllImport (BTLS_DYLIB)]
+               extern unsafe static int mono_btls_pkcs12_import (IntPtr chain, void* data, int len, IntPtr password);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static int mono_btls_pkcs12_has_private_key (IntPtr pkcs12);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static IntPtr mono_btls_pkcs12_get_private_key (IntPtr pkcs12);
+
+               internal MonoBtlsPkcs12 ()
+                       : base (new BoringPkcs12Handle (mono_btls_pkcs12_new ()))
+               {
+               }
+
+               internal MonoBtlsPkcs12 (BoringPkcs12Handle handle)
+                       : base (handle)
+               {
+               }
+
+               MonoBtlsKey privateKey;
+
+               public int Count {
+                       get { return mono_btls_pkcs12_get_count (Handle.DangerousGetHandle ()); }
+               }
+
+               public MonoBtlsX509 GetCertificate (int index)
+               {
+                       if (index >= Count)
+                               throw new IndexOutOfRangeException ();
+                       var handle = mono_btls_pkcs12_get_cert (Handle.DangerousGetHandle (), index);
+                       CheckError (handle != IntPtr.Zero);
+                       return new MonoBtlsX509 (new MonoBtlsX509.BoringX509Handle (handle));
+               }
+
+               public void AddCertificate (MonoBtlsX509 x509)
+               {
+                       mono_btls_pkcs12_add_cert (
+                               Handle.DangerousGetHandle (),
+                               x509.Handle.DangerousGetHandle ());
+               }
+
+               public unsafe void Import (byte[] buffer, string password)
+               {
+                       var passptr = IntPtr.Zero;
+                       fixed (void* ptr = buffer)
+                       try {
+                               if (password != null)
+                                       passptr = Marshal.StringToHGlobalAnsi (password);
+                               var ret = mono_btls_pkcs12_import (
+                                       Handle.DangerousGetHandle (), ptr,
+                                       buffer.Length, passptr);
+                               CheckError (ret);
+                       } finally {
+                               if (passptr != IntPtr.Zero)
+                                       Marshal.FreeHGlobal (passptr);
+                       }
+               }
+
+               public bool HasPrivateKey {
+                       get { return mono_btls_pkcs12_has_private_key (Handle.DangerousGetHandle ()) != 0; }
+               }
+
+               public MonoBtlsKey GetPrivateKey ()
+               {
+                       if (!HasPrivateKey)
+                               throw new InvalidOperationException ();
+                       if (privateKey == null) {
+                               var handle = mono_btls_pkcs12_get_private_key (Handle.DangerousGetHandle ());
+                               CheckError (handle != IntPtr.Zero);
+                               privateKey = new MonoBtlsKey (new MonoBtlsKey.BoringKeyHandle (handle));
+                       }
+                       return privateKey;
+               }
+       }
+}
+#endif
diff --git a/mcs/class/System/Mono.Btls/MonoBtlsProvider.cs b/mcs/class/System/Mono.Btls/MonoBtlsProvider.cs
new file mode 100644 (file)
index 0000000..b300585
--- /dev/null
@@ -0,0 +1,295 @@
+//
+// MonoBtlsProvider.cs
+//
+// Author:
+//       Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
+//
+// 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.
+#if SECURITY_DEP && MONO_FEATURE_BTLS
+#if MONO_SECURITY_ALIAS
+extern alias MonoSecurity;
+#endif
+
+using System;
+using System.IO;
+using System.Threading;
+using System.Threading.Tasks;
+using System.Security.Cryptography.X509Certificates;
+using System.Security.Authentication;
+
+#if MONO_SECURITY_ALIAS
+using MonoSecurity::Mono.Security.Interface;
+using MX = MonoSecurity::Mono.Security.X509;
+#else
+using Mono.Security.Interface;
+using MX = Mono.Security.X509;
+#endif
+
+using MNS = Mono.Net.Security;
+
+namespace Mono.Btls
+{
+       class MonoBtlsProvider : MonoTlsProvider
+       {
+               static readonly Guid id = new Guid ("432d18c9-9348-4b90-bfbf-9f2a10e1f15b");
+
+               public override Guid ID {
+                       get { return id; }
+               }
+               public override string Name {
+                       get { return "btls"; }
+               }
+
+               internal MonoBtlsProvider ()
+               {
+                       if (!MNS.MonoTlsProviderFactory.IsBtlsSupported ())
+                               throw new NotSupportedException ("BTLS is not supported in this runtime.");
+               }
+
+               public override bool SupportsSslStream {
+                       get { return true; }
+               }
+
+               public override bool SupportsMonoExtensions {
+                       get { return true; }
+               }
+
+               public override bool SupportsConnectionInfo {
+                       get { return true; }
+               }
+
+               public override SslProtocols SupportedProtocols {
+                       get { return SslProtocols.Tls12 | SslProtocols.Tls11 | SslProtocols.Tls; }
+               }
+
+               public override IMonoSslStream CreateSslStream (
+                       Stream innerStream, bool leaveInnerStreamOpen,
+                       MonoTlsSettings settings = null)
+               {
+                       return new MonoBtlsStream (
+                               innerStream, leaveInnerStreamOpen, settings, this);
+               }
+
+               internal override bool HasNativeCertificates {
+                       get { return true; }
+               }
+
+               internal override X509Certificate2Impl GetNativeCertificate (
+                       byte[] data, string password, X509KeyStorageFlags flags)
+               {
+                       var impl = new X509CertificateImplBtls (false);
+                       impl.Import (data, password, flags);
+                       return impl;
+               }
+
+               internal override X509Certificate2Impl GetNativeCertificate (
+                       X509Certificate certificate)
+               {
+                       var impl = certificate.Impl as X509CertificateImplBtls;
+                       if (impl != null)
+                               return (X509Certificate2Impl)impl.Clone ();
+
+                       var data = certificate.GetRawCertData ();
+                       return new X509CertificateImplBtls (data, MonoBtlsX509Format.DER, false);
+               }
+
+               internal static MonoBtlsX509VerifyParam GetVerifyParam (string targetHost, bool serverMode)
+               {
+                       MonoBtlsX509VerifyParam param;
+                       if (serverMode)
+                               param = MonoBtlsX509VerifyParam.GetSslClient ();
+                       else
+                               param = MonoBtlsX509VerifyParam.GetSslServer ();
+
+                       if (targetHost == null)
+                               return param;
+
+                       try {
+                               var copy = param.Copy ();
+                               copy.SetHost (targetHost);
+                               return copy;
+                       } finally {
+                               param.Dispose ();
+                       }
+               }
+
+               internal override bool ValidateCertificate (
+                       ICertificateValidator2 validator, string targetHost, bool serverMode,
+                       X509CertificateCollection certificates, bool wantsChain, ref X509Chain chain,
+                       ref MonoSslPolicyErrors errors, ref int status11)
+               {
+                       if (chain != null) {
+                               var chainImpl = (X509ChainImplBtls)chain.Impl;
+                               var success = chainImpl.StoreCtx.VerifyResult == 1;
+                               CheckValidationResult (
+                                       validator, targetHost, serverMode, certificates,
+                                       wantsChain, chain, chainImpl.StoreCtx,
+                                       success, ref errors, ref status11);
+                               return success;
+                       }
+
+                       using (var store = new MonoBtlsX509Store ())
+                       using (var nativeChain = MonoBtlsProvider.GetNativeChain (certificates))
+                       using (var param = GetVerifyParam (targetHost, serverMode))
+                       using (var storeCtx = new MonoBtlsX509StoreCtx ()) {
+                               SetupCertificateStore (store);
+
+                               storeCtx.Initialize (store, nativeChain);
+
+                               storeCtx.SetVerifyParam (param);
+
+                               var ret = storeCtx.Verify ();
+
+                               var success = ret == 1;
+
+                               if (wantsChain && chain == null) {
+                                       chain = GetManagedChain (nativeChain);
+                               }
+
+                               CheckValidationResult (
+                                       validator, targetHost, serverMode, certificates,
+                                       wantsChain, null, storeCtx,
+                                       success, ref errors, ref status11);
+                               return success;
+                       }
+               }
+
+               internal static bool ValidateCertificate (MonoBtlsX509Chain chain, MonoBtlsX509VerifyParam param)
+               {
+                       using (var store = new MonoBtlsX509Store ())
+                       using (var storeCtx = new MonoBtlsX509StoreCtx ()) {
+                               SetupCertificateStore (store);
+
+                               storeCtx.Initialize (store, chain);
+
+                               if (param != null)
+                                       storeCtx.SetVerifyParam (param);
+
+                               var ret = storeCtx.Verify ();
+
+                               return ret == 1;
+                       }
+               }
+
+               void CheckValidationResult (
+                       ICertificateValidator validator, string targetHost, bool serverMode,
+                       X509CertificateCollection certificates, bool wantsChain,
+                       X509Chain chain, MonoBtlsX509StoreCtx storeCtx,
+                       bool success, ref MonoSslPolicyErrors errors, ref int status11)
+               {
+                       if (!success) {
+                               errors = MonoSslPolicyErrors.RemoteCertificateChainErrors;
+                               status11 = unchecked((int)0x800B010B);
+                       }
+               }
+
+               internal static void SetupCertificateStore (MonoBtlsX509Store store)
+               {
+#if MONODROID
+                       store.SetDefaultPaths ();
+                       store.AddAndroidLookup ();
+#else
+                       var userPath = MonoBtlsX509StoreManager.GetStorePath (MonoBtlsX509StoreType.UserTrustedRoots);
+                       if (Directory.Exists (userPath))
+                               store.AddDirectoryLookup (userPath, MonoBtlsX509FileType.PEM);
+                       var machinePath = MonoBtlsX509StoreManager.GetStorePath (MonoBtlsX509StoreType.MachineTrustedRoots);
+                       if (Directory.Exists (machinePath))
+                               store.AddDirectoryLookup (machinePath, MonoBtlsX509FileType.PEM);
+#endif
+               }
+
+               public static string GetSystemStoreLocation ()
+               {
+#if ANDROID
+                       return "/system/etc/security/cacerts";
+#else
+                       var appData = Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData);
+                       var path = Path.Combine (appData, ".mono", "certs", "NewTrust");
+                       return path;
+#endif
+               }
+
+               public static X509Certificate CreateCertificate (byte[] data, MonoBtlsX509Format format, bool disallowFallback = false)
+               {
+                       using (var impl = new X509CertificateImplBtls (data, format, disallowFallback)) {
+                               return new X509Certificate (impl);
+                       }
+               }
+
+               public static X509Certificate2 CreateCertificate2 (byte[] data, MonoBtlsX509Format format, bool disallowFallback = false)
+               {
+                       using (var impl = new X509CertificateImplBtls (data, format, disallowFallback)) {
+                               return new X509Certificate2 (impl);
+                       }
+               }
+
+               public static X509Certificate2 CreateCertificate2 (byte[] data, string password, bool disallowFallback = false)
+               {
+                       using (var impl = new X509CertificateImplBtls (disallowFallback)) {
+                               impl.Import (data, password, X509KeyStorageFlags.DefaultKeySet);
+                               return new X509Certificate2 (impl);
+                       }
+               }
+
+               public static X509Certificate CreateCertificate (MonoBtlsX509 x509)
+               {
+                       using (var impl = new X509CertificateImplBtls (x509, true))
+                               return new X509Certificate (impl);
+               }
+
+               public static X509Chain CreateChain ()
+               {
+                       using (var impl = new X509ChainImplBtls ())
+                               return new X509Chain (impl);
+               }
+
+               public static X509Chain GetManagedChain (MonoBtlsX509Chain chain)
+               {
+                       var impl = new X509ChainImplBtls (chain);
+                       return new X509Chain (impl);
+               }
+
+               public static MonoBtlsX509 GetBtlsCertificate (X509Certificate certificate)
+               {
+                       var impl = certificate.Impl as X509CertificateImplBtls;
+                       if (impl != null)
+                               return impl.X509.Copy ();
+
+                       return MonoBtlsX509.LoadFromData (certificate.GetRawCertData (), MonoBtlsX509Format.DER);
+               }
+
+               public static MonoBtlsX509Chain GetNativeChain (X509CertificateCollection certificates)
+               {
+                       var chain = new MonoBtlsX509Chain ();
+                       try {
+                               foreach (var cert in certificates) {
+                                       using (var x509 = GetBtlsCertificate (cert))
+                                               chain.AddCertificate (x509);
+                               }
+                               return chain;
+                       } catch {
+                               chain.Dispose ();
+                               throw;
+                       }
+               }
+       }
+}
+#endif
diff --git a/mcs/class/System/Mono.Btls/MonoBtlsSsl.cs b/mcs/class/System/Mono.Btls/MonoBtlsSsl.cs
new file mode 100644 (file)
index 0000000..8ef902f
--- /dev/null
@@ -0,0 +1,431 @@
+//
+// MonoBtlsSsl.cs
+//
+// Author:
+//       Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)
+//
+// 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.
+#if SECURITY_DEP && MONO_FEATURE_BTLS
+using System;
+using System.IO;
+using System.Text;
+using System.Runtime.InteropServices;
+using System.Runtime.CompilerServices;
+
+#if MONOTOUCH
+using MonoTouch;
+#endif
+
+namespace Mono.Btls
+{
+       delegate int MonoBtlsVerifyCallback (MonoBtlsX509StoreCtx ctx);
+       delegate int MonoBtlsSelectCallback ();
+
+       class MonoBtlsSsl : MonoBtlsObject
+       {
+               internal class BoringSslHandle : MonoBtlsHandle
+               {
+                       public BoringSslHandle (IntPtr handle)
+                               : base (handle, true)
+                       {
+                       }
+
+                       protected override bool ReleaseHandle ()
+                       {
+                               mono_btls_ssl_destroy (handle);
+                               return true;
+                       }
+               }
+
+               [DllImport (BTLS_DYLIB)]
+               extern static void mono_btls_ssl_destroy (IntPtr handle);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static IntPtr mono_btls_ssl_new (IntPtr handle);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static int mono_btls_ssl_use_certificate (IntPtr handle, IntPtr x509);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static int mono_btls_ssl_use_private_key (IntPtr handle, IntPtr key);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static int mono_btls_ssl_add_chain_certificate (IntPtr handle, IntPtr x509);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static int mono_btls_ssl_accept (IntPtr handle);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static int mono_btls_ssl_connect (IntPtr handle);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static int mono_btls_ssl_handshake (IntPtr handle);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static void mono_btls_ssl_close (IntPtr handle);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static void mono_btls_ssl_set_bio (IntPtr handle, IntPtr bio);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static int mono_btls_ssl_read (IntPtr handle, IntPtr data, int len);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static int mono_btls_ssl_write (IntPtr handle, IntPtr data, int len);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static int mono_btls_ssl_get_error (IntPtr handle, int ret_code);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static int mono_btls_ssl_get_version (IntPtr handle);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static void mono_btls_ssl_set_min_version (IntPtr handle, int version);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static void mono_btls_ssl_set_max_version (IntPtr handle, int version);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static int mono_btls_ssl_get_cipher (IntPtr handle);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static int mono_btls_ssl_get_ciphers (IntPtr handle, out IntPtr data);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static IntPtr mono_btls_ssl_get_peer_certificate (IntPtr handle);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static int mono_btls_ssl_set_cipher_list (IntPtr handle, IntPtr str);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static void mono_btls_ssl_print_errors_cb (IntPtr func, IntPtr ctx);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static int mono_btls_ssl_set_verify_param (IntPtr handle, IntPtr param);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static int mono_btls_ssl_set_server_name (IntPtr handle, IntPtr name);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static IntPtr mono_btls_ssl_get_server_name (IntPtr handle);
+
+               static BoringSslHandle Create_internal (MonoBtlsSslCtx ctx)
+               {
+                       var handle = mono_btls_ssl_new (ctx.Handle.DangerousGetHandle ());
+                       if (handle == IntPtr.Zero)
+                               throw new MonoBtlsException ();
+                       return new BoringSslHandle (handle);
+               }
+
+               PrintErrorsCallbackFunc printErrorsFunc;
+               IntPtr printErrorsFuncPtr;
+
+               public MonoBtlsSsl (MonoBtlsSslCtx ctx)
+                       : base (Create_internal (ctx))
+               {
+                       printErrorsFunc = PrintErrorsCallback;
+                       printErrorsFuncPtr = Marshal.GetFunctionPointerForDelegate (printErrorsFunc);
+               }
+
+               new internal BoringSslHandle Handle {
+                       get { return (BoringSslHandle)base.Handle; }
+               }
+
+               public void SetBio (MonoBtlsBio bio)
+               {
+                       CheckThrow ();
+                       mono_btls_ssl_set_bio (
+                               Handle.DangerousGetHandle (),
+                               bio.Handle.DangerousGetHandle ());
+               }
+
+               Exception ThrowError ([CallerMemberName] string callerName = null)
+               {
+                       string errors;
+                       try {
+                               if (callerName == null)
+                                       callerName = GetType ().Name;
+                               errors = GetErrors ();
+                       } catch {
+                               errors = null;
+                       }
+
+                       if (errors != null) {
+                               Console.Error.WriteLine ("ERROR: {0} failed: {1}", callerName, errors);
+                               throw new MonoBtlsException ("{0} failed: {1}.", callerName, errors);
+                       } else {
+                               Console.Error.WriteLine ("ERROR: {0} failed.", callerName);
+                               throw new MonoBtlsException ("{0} failed.", callerName);
+                       }
+               }
+
+               MonoBtlsSslError GetError (int ret_code)
+               {
+                       CheckThrow ();
+                       var error = mono_btls_ssl_get_error (
+                               Handle.DangerousGetHandle (), ret_code);
+                       return (MonoBtlsSslError)error;
+               }
+
+               public void SetCertificate (MonoBtlsX509 x509)
+               {
+                       CheckThrow ();
+
+                       var ret = mono_btls_ssl_use_certificate (
+                               Handle.DangerousGetHandle (),
+                               x509.Handle.DangerousGetHandle ());
+                       if (ret <= 0)
+                               throw ThrowError ();
+               }
+
+               public void SetPrivateKey (MonoBtlsKey key)
+               {
+                       CheckThrow ();
+
+                       var ret = mono_btls_ssl_use_private_key (
+                               Handle.DangerousGetHandle (),
+                               key.Handle.DangerousGetHandle ());
+                       if (ret <= 0)
+                               throw ThrowError ();
+               }
+
+               public void AddIntermediateCertificate (MonoBtlsX509 x509)
+               {
+                       CheckThrow ();
+
+                       var ret = mono_btls_ssl_add_chain_certificate (
+                               Handle.DangerousGetHandle (),
+                               x509.Handle.DangerousGetHandle ());
+                       if (ret <= 0)
+                               throw ThrowError ();
+               }
+
+               public MonoBtlsSslError Accept ()
+               {
+                       CheckThrow ();
+
+                       var ret = mono_btls_ssl_accept (Handle.DangerousGetHandle ());
+
+                       var error = GetError (ret);
+                       return error;
+               }
+
+               public MonoBtlsSslError Connect ()
+               {
+                       CheckThrow ();
+
+                       var ret = mono_btls_ssl_connect (Handle.DangerousGetHandle ());
+
+                       var error = GetError (ret);
+                       return error;
+               }
+
+               public MonoBtlsSslError Handshake ()
+               {
+                       CheckThrow ();
+
+                       var ret = mono_btls_ssl_handshake (Handle.DangerousGetHandle ());
+
+                       var error = GetError (ret);
+                       return error;
+               }
+
+               delegate int PrintErrorsCallbackFunc (IntPtr str, IntPtr len, IntPtr ctx);
+
+#if MONOTOUCH
+               [MonoPInvokeCallback (typeof (PrintErrorsCallbackFunc))]
+#endif
+               static int PrintErrorsCallback (IntPtr str, IntPtr len, IntPtr ctx)
+               {
+                       var sb = (StringBuilder)GCHandle.FromIntPtr (ctx).Target;
+                       try {
+                               var text = Marshal.PtrToStringAnsi (str, (int)len);
+                               sb.Append (text);
+                               return 1;
+                       } catch {
+                               return 0;
+                       }
+               }
+
+               public string GetErrors ()
+               {
+                       var text = new StringBuilder ();
+                       var handle = GCHandle.Alloc (text);
+
+                       try {
+                               mono_btls_ssl_print_errors_cb (printErrorsFuncPtr, GCHandle.ToIntPtr (handle));
+                               return text.ToString ();
+                       } finally {
+                               if (handle.IsAllocated)
+                                       handle.Free ();
+                       }
+               }
+
+               public void PrintErrors ()
+               {
+                       var errors = GetErrors ();
+                       if (string.IsNullOrEmpty (errors))
+                               return;
+                       Console.Error.WriteLine (errors);
+               }
+
+               public MonoBtlsSslError Read (IntPtr data, ref int dataSize)
+               {
+                       CheckThrow ();
+                       var ret = mono_btls_ssl_read (
+                               Handle.DangerousGetHandle (), data, dataSize);
+
+                       if (ret >= 0) {
+                               dataSize = ret;
+                               return MonoBtlsSslError.None;
+                       }
+
+                       var error = mono_btls_ssl_get_error (
+                               Handle.DangerousGetHandle (), ret);
+                       dataSize = 0;
+                       return (MonoBtlsSslError)error;
+               }
+
+               public MonoBtlsSslError Write (IntPtr data, ref int dataSize)
+               {
+                       CheckThrow ();
+                       var ret = mono_btls_ssl_write (
+                               Handle.DangerousGetHandle (), data, dataSize);
+
+                       if (ret >= 0) {
+                               dataSize = ret;
+                               return MonoBtlsSslError.None;
+                       }
+
+                       var error = mono_btls_ssl_get_error (
+                               Handle.DangerousGetHandle (), ret);
+                       dataSize = 0;
+                       return (MonoBtlsSslError)error;
+               }
+
+               public int GetVersion ()
+               {
+                       CheckThrow ();
+                       return mono_btls_ssl_get_version (Handle.DangerousGetHandle ());
+               }
+
+               public void SetMinVersion (int version)
+               {
+                       CheckThrow ();
+                       mono_btls_ssl_set_min_version (Handle.DangerousGetHandle (), version);
+               }
+
+               public void SetMaxVersion (int version)
+               {
+                       CheckThrow ();
+                       mono_btls_ssl_set_max_version (Handle.DangerousGetHandle (), version);
+               }
+
+               public int GetCipher ()
+               {
+                       CheckThrow ();
+                       var cipher = mono_btls_ssl_get_cipher (Handle.DangerousGetHandle ());
+                       CheckError (cipher > 0);
+                       return cipher;
+               }
+
+               public short[] GetCiphers ()
+               {
+                       CheckThrow ();
+                       IntPtr data;
+                       var count = mono_btls_ssl_get_ciphers (
+                               Handle.DangerousGetHandle (), out data);
+                       CheckError (count > 0);
+                       try {
+                               short[] ciphers = new short[count];
+                               Marshal.Copy (data, ciphers, 0, count);
+                               return ciphers;
+                       } finally {
+                               FreeDataPtr (data);
+                       }
+               }
+
+               public void SetCipherList (string str)
+               {
+                       CheckThrow ();
+                       IntPtr strPtr = IntPtr.Zero;
+                       try {
+                               strPtr = Marshal.StringToHGlobalAnsi (str);
+                               var ret = mono_btls_ssl_set_cipher_list (
+                                       Handle.DangerousGetHandle (), strPtr);
+                               CheckError (ret);
+                       } finally {
+                               if (strPtr != IntPtr.Zero)
+                                       Marshal.FreeHGlobal (strPtr);
+                       }
+               }
+
+               public MonoBtlsX509 GetPeerCertificate ()
+               {
+                       CheckThrow ();
+                       var x509 = mono_btls_ssl_get_peer_certificate (
+                               Handle.DangerousGetHandle ());
+                       if (x509 == IntPtr.Zero)
+                               return null;
+                       return new MonoBtlsX509 (new MonoBtlsX509.BoringX509Handle (x509));
+               }
+
+               public void SetVerifyParam (MonoBtlsX509VerifyParam param)
+               {
+                       CheckThrow ();
+                       var ret = mono_btls_ssl_set_verify_param (
+                               Handle.DangerousGetHandle (),
+                               param.Handle.DangerousGetHandle ());
+                       CheckError (ret);
+               }
+
+               public void SetServerName (string name)
+               {
+                       CheckThrow ();
+                       IntPtr namePtr = IntPtr.Zero;
+                       try {
+                               namePtr = Marshal.StringToHGlobalAnsi (name);
+                               var ret = mono_btls_ssl_set_server_name (
+                                       Handle.DangerousGetHandle (), namePtr);
+                               CheckError (ret);
+                       } finally {
+                               if (namePtr != IntPtr.Zero)
+                                       Marshal.FreeHGlobal (namePtr);
+                       }
+               }
+
+               public string GetServerName ()
+               {
+                       CheckThrow ();
+                       var namePtr = mono_btls_ssl_get_server_name (
+                               Handle.DangerousGetHandle ());
+                       if (namePtr == IntPtr.Zero)
+                               return null;
+                       return Marshal.PtrToStringAnsi (namePtr);
+               }
+
+               protected override void Close ()
+               {
+                       mono_btls_ssl_close (Handle.DangerousGetHandle ());
+               }
+       }
+}
+#endif
diff --git a/mcs/class/System/Mono.Btls/MonoBtlsSslCtx.cs b/mcs/class/System/Mono.Btls/MonoBtlsSslCtx.cs
new file mode 100644 (file)
index 0000000..fd9b6f1
--- /dev/null
@@ -0,0 +1,260 @@
+//
+// MonoBtlsSslCtx.cs
+//
+// Author:
+//       Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
+//
+// 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.
+#if SECURITY_DEP && MONO_FEATURE_BTLS
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+#if MONOTOUCH
+using MonoTouch;
+#endif
+
+namespace Mono.Btls
+{
+       class MonoBtlsSslCtx : MonoBtlsObject
+       {
+               internal class BoringSslCtxHandle : MonoBtlsHandle
+               {
+                       public BoringSslCtxHandle (IntPtr handle)
+                               : base (handle, true)
+                       {
+                       }
+
+                       protected override bool ReleaseHandle ()
+                       {
+                               mono_btls_ssl_ctx_free (handle);
+                               return true;
+                       }
+               }
+
+               new internal BoringSslCtxHandle Handle {
+                       get { return (BoringSslCtxHandle)base.Handle; }
+               }
+
+               [DllImport (BTLS_DYLIB)]
+               extern static IntPtr mono_btls_ssl_ctx_new ();
+
+               [DllImport (BTLS_DYLIB)]
+               extern static int mono_btls_ssl_ctx_free (IntPtr handle);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static IntPtr mono_btls_ssl_ctx_up_ref (IntPtr handle);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static void mono_btls_ssl_ctx_initialize (IntPtr handle, IntPtr instance);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static void mono_btls_ssl_ctx_set_debug_bio (IntPtr handle, IntPtr bio);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static void mono_btls_ssl_ctx_set_cert_verify_callback (IntPtr handle, IntPtr func, int cert_required);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static void mono_btls_ssl_ctx_set_cert_select_callback (IntPtr handle, IntPtr func);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static void mono_btls_ssl_ctx_set_min_version (IntPtr handle, int version);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static void mono_btls_ssl_ctx_set_max_version (IntPtr handle, int version);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static int mono_btls_ssl_ctx_is_cipher_supported (IntPtr handle, short value);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static int mono_btls_ssl_ctx_set_ciphers (IntPtr handle, int count, IntPtr data, int allow_unsupported);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static int mono_btls_ssl_ctx_set_verify_param (IntPtr handle, IntPtr param);
+
+               delegate int NativeVerifyFunc (IntPtr instance, int preverify_ok, IntPtr ctx);
+               delegate int NativeSelectFunc (IntPtr instance);
+
+               NativeVerifyFunc verifyFunc;
+               NativeSelectFunc selectFunc;
+               IntPtr verifyFuncPtr;
+               IntPtr selectFuncPtr;
+               MonoBtlsVerifyCallback verifyCallback;
+               MonoBtlsSelectCallback selectCallback;
+               MonoBtlsX509Store store;
+               GCHandle instance;
+               IntPtr instancePtr;
+
+               public MonoBtlsSslCtx ()
+                       : this (new BoringSslCtxHandle (mono_btls_ssl_ctx_new ()))
+               {
+               }
+
+               internal MonoBtlsSslCtx (BoringSslCtxHandle handle)
+                       : base (handle)
+               {
+                       instance = GCHandle.Alloc (this);
+                       instancePtr = GCHandle.ToIntPtr (instance);
+                       mono_btls_ssl_ctx_initialize (
+                               handle.DangerousGetHandle (), instancePtr);
+
+                       verifyFunc = NativeVerifyCallback;
+                       selectFunc = NativeSelectCallback;
+                       verifyFuncPtr = Marshal.GetFunctionPointerForDelegate (verifyFunc);
+                       selectFuncPtr = Marshal.GetFunctionPointerForDelegate (selectFunc);
+
+                       store = new MonoBtlsX509Store (Handle);
+               }
+
+               internal MonoBtlsSslCtx Copy ()
+               {
+                       var copy = mono_btls_ssl_ctx_up_ref (Handle.DangerousGetHandle ());
+                       return new MonoBtlsSslCtx (new BoringSslCtxHandle (copy));
+               }
+
+               public MonoBtlsX509Store CertificateStore {
+                       get { return store; }
+               }
+
+               int VerifyCallback (bool preverify_ok, MonoBtlsX509StoreCtx ctx)
+               {
+                       if (verifyCallback != null)
+                               return verifyCallback (ctx);
+                       return 0;
+               }
+
+#if MONOTOUCH
+               [MonoPInvokeCallback (typeof (NativeVerifyFunc))]
+#endif
+               static int NativeVerifyCallback (IntPtr instance, int preverify_ok, IntPtr store_ctx)
+               {
+                       var c = (MonoBtlsSslCtx)GCHandle.FromIntPtr (instance).Target;
+                       using (var ctx = new MonoBtlsX509StoreCtx (preverify_ok, store_ctx)) {
+                               try {
+                                       return c.VerifyCallback (preverify_ok != 0, ctx);
+                               } catch (Exception ex) {
+                                       c.SetException (ex);
+                               }
+                       }
+                       return 0;
+               }
+
+               int SelectCallback ()
+               {
+                       if (selectCallback != null)
+                               return selectCallback ();
+                       return 1;
+               }
+
+#if MONOTOUCH
+               [MonoPInvokeCallback (typeof (NativeSelectFunc))]
+#endif
+               static int NativeSelectCallback (IntPtr instance)
+               {
+                       var c = (MonoBtlsSslCtx)GCHandle.FromIntPtr (instance).Target;
+                       try {
+                               return c.SelectCallback ();
+                       } catch (Exception ex) {
+                               c.SetException (ex);
+                               return 0;
+                       }
+               }
+
+               public void SetDebugBio (MonoBtlsBio bio)
+               {
+                       CheckThrow ();
+                       mono_btls_ssl_ctx_set_debug_bio (Handle.DangerousGetHandle (), bio.Handle.DangerousGetHandle ());
+               }
+
+               public void SetVerifyCallback (MonoBtlsVerifyCallback callback, bool client_cert_required)
+               {
+                       CheckThrow ();
+
+                       verifyCallback = callback;
+                       mono_btls_ssl_ctx_set_cert_verify_callback (
+                               Handle.DangerousGetHandle (), verifyFuncPtr,
+                               client_cert_required ? 1 : 0);
+               }
+
+               public void SetSelectCallback (MonoBtlsSelectCallback callback)
+               {
+                       CheckThrow ();
+
+                       selectCallback = callback;
+                       mono_btls_ssl_ctx_set_cert_select_callback (
+                               Handle.DangerousGetHandle (), selectFuncPtr);
+               }
+
+               public void SetMinVersion (int version)
+               {
+                       CheckThrow ();
+                       mono_btls_ssl_ctx_set_min_version (Handle.DangerousGetHandle (), version);
+               }
+
+               public void SetMaxVersion (int version)
+               {
+                       CheckThrow ();
+                       mono_btls_ssl_ctx_set_max_version (Handle.DangerousGetHandle (), version);
+               }
+
+               public bool IsCipherSupported (short value)
+               {
+                       CheckThrow ();
+                       return mono_btls_ssl_ctx_is_cipher_supported (Handle.DangerousGetHandle (), value) != 0;
+               }
+
+               public void SetCiphers (short[] ciphers, bool allow_unsupported)
+               {
+                       CheckThrow ();
+                       var data = Marshal.AllocHGlobal (ciphers.Length * 2);
+                       try {
+                               Marshal.Copy (ciphers, 0, data, ciphers.Length);
+                               var ret = mono_btls_ssl_ctx_set_ciphers (
+                                       Handle.DangerousGetHandle (),
+                                       ciphers.Length, data, allow_unsupported ? 1 : 0);
+                               CheckError (ret > 0);
+                       } finally {
+                               Marshal.FreeHGlobal (data);
+                       }
+               }
+
+               public void SetVerifyParam (MonoBtlsX509VerifyParam param)
+               {
+                       CheckThrow ();
+                       var ret = mono_btls_ssl_ctx_set_verify_param (
+                               Handle.DangerousGetHandle (),
+                               param.Handle.DangerousGetHandle ());
+                       CheckError (ret);
+               }
+
+               protected override void Close ()
+               {
+                       if (store != null) {
+                               store.Dispose ();
+                               store = null;
+                       }
+                       if (instance.IsAllocated)
+                               instance.Free ();
+                       base.Close ();
+               }
+       }
+}
+#endif
diff --git a/mcs/class/System/Mono.Btls/MonoBtlsSslError.cs b/mcs/class/System/Mono.Btls/MonoBtlsSslError.cs
new file mode 100644 (file)
index 0000000..432ba5d
--- /dev/null
@@ -0,0 +1,47 @@
+//
+// MonoBtlsSslError.cs
+//
+// Author:
+//       Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)
+//
+// 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.
+#if SECURITY_DEP && MONO_FEATURE_BTLS
+namespace Mono.Btls
+{
+       // keep in sync with boringssl/include/ssl.h
+       enum MonoBtlsSslError
+       {
+               None = 0,
+               Ssl = 1,
+               WantRead = 2,
+               WantWrite = 3,
+               WantX509Lookup = 4,
+               Syscall = 5,
+               ZeroReturn = 6,
+               WantConnect = 7,
+               WantAccept = 8,
+               WantChannelIdLookup = 9,
+               PendingSession = 11,
+               PendingCertificate = 12,
+               WantPrivateKeyOperation = 13
+       }
+}
+#endif
diff --git a/mcs/class/System/Mono.Btls/MonoBtlsStream.cs b/mcs/class/System/Mono.Btls/MonoBtlsStream.cs
new file mode 100644 (file)
index 0000000..38b6d83
--- /dev/null
@@ -0,0 +1,65 @@
+//
+// MonoBtlsStream.cs
+//
+// Author:
+//       Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
+//
+// 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.
+#if SECURITY_DEP && MONO_FEATURE_BTLS
+#if MONO_SECURITY_ALIAS
+extern alias MonoSecurity;
+#endif
+
+using System;
+using System.IO;
+using System.Security.Authentication;
+using System.Security.Cryptography.X509Certificates;
+
+#if MONO_SECURITY_ALIAS
+using MonoSecurity::Mono.Security.Interface;
+#else
+using Mono.Security.Interface;
+#endif
+
+using MNS = Mono.Net.Security;
+
+namespace Mono.Btls
+{
+       class MonoBtlsStream : MNS.MobileAuthenticatedStream
+       {
+               public MonoBtlsStream (Stream innerStream, bool leaveInnerStreamOpen, MonoTlsSettings settings, MonoTlsProvider provider)
+                       : base (innerStream, leaveInnerStreamOpen, settings, provider)
+               {
+               }
+
+               protected override MNS.MobileTlsContext CreateContext (
+                       MNS.MobileAuthenticatedStream parent, bool serverMode, string targetHost,
+                       SslProtocols enabledProtocols, X509Certificate serverCertificate,
+                       X509CertificateCollection clientCertificates, bool askForClientCert)
+               {
+                       return new MonoBtlsContext (
+                               parent, serverMode, targetHost,
+                               enabledProtocols, serverCertificate,
+                               clientCertificates, askForClientCert);
+               }
+       }
+}
+#endif
diff --git a/mcs/class/System/Mono.Btls/MonoBtlsUtils.cs b/mcs/class/System/Mono.Btls/MonoBtlsUtils.cs
new file mode 100644 (file)
index 0000000..4175968
--- /dev/null
@@ -0,0 +1,187 @@
+//
+// MonoBtlsUtils.cs
+//
+// Author:
+//       Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
+//
+// 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.
+#if SECURITY_DEP && MONO_FEATURE_BTLS
+using System;
+using System.Text;
+using System.Security.Cryptography.X509Certificates;
+
+namespace Mono.Btls
+{
+       static class MonoBtlsUtils
+       {
+               static byte[] emailOid = { 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x09, 0x01 };
+
+               public static bool Compare (byte[] a, byte[] b)
+               {
+                       if (a.Length != b.Length)
+                               return false;
+                       for (int i = 0; i < a.Length; i++) {
+                               if (a[i] != b[i])
+                                       return false;
+                       }
+                       return true;
+               }
+
+               static bool AppendEntry (StringBuilder sb, MonoBtlsX509Name name, int index, string separator, bool quotes)
+               {
+                       var type = name.GetEntryType (index);
+                       if (type < 0)
+                               return false;
+                       else if (type == 0) {
+                               var oidValue = name.GetEntryOidData (index);
+                               if (Compare (oidValue, emailOid))
+                                       type = MonoBtlsX509NameEntryType.Email;
+                       }
+                       int tag;
+                       var text = name.GetEntryValue (index, out tag);
+                       if (text == null)
+                               return false;
+                       var oid = name.GetEntryOid (index);
+                       if (oid == null)
+                               return false;
+
+                       if (sb.Length > 0)
+                               sb.Append (separator);
+
+                       switch (type) {
+                       case MonoBtlsX509NameEntryType.CountryName:
+                               sb.Append ("C=");
+                               break;
+                       case MonoBtlsX509NameEntryType.OrganizationName:
+                               sb.Append ("O=");
+                               break;
+                       case MonoBtlsX509NameEntryType.OrganizationalUnitName:
+                               sb.Append ("OU=");
+                               break;
+                       case MonoBtlsX509NameEntryType.CommonName:
+                               sb.Append ("CN=");
+                               break;
+                       case MonoBtlsX509NameEntryType.LocalityName:
+                               sb.Append ("L=");
+                               break;
+                       case MonoBtlsX509NameEntryType.StateOrProvinceName:
+                               sb.Append ("S=");       // NOTE: RFC2253 uses ST=
+                               break;
+                       case MonoBtlsX509NameEntryType.StreetAddress:
+                               sb.Append ("STREET=");
+                               break;
+                       case MonoBtlsX509NameEntryType.DomainComponent:
+                               sb.Append ("DC=");
+                               break;
+                       case MonoBtlsX509NameEntryType.UserId:
+                               sb.Append ("UID=");
+                               break;
+                       case MonoBtlsX509NameEntryType.Email:
+                               sb.Append ("E=");       // NOTE: Not part of RFC2253
+                               break;
+                       case MonoBtlsX509NameEntryType.DnQualifier:
+                               sb.Append ("dnQualifier=");
+                               break;
+                       case MonoBtlsX509NameEntryType.Title:
+                               sb.Append ("T=");
+                               break;
+                       case MonoBtlsX509NameEntryType.Surname:
+                               sb.Append ("SN=");
+                               break;
+                       case MonoBtlsX509NameEntryType.GivenName:
+                               sb.Append ("G=");
+                               break;
+                       case MonoBtlsX509NameEntryType.Initial:
+                               sb.Append ("I=");
+                               break;
+                       default:
+                               // unknown OID
+                               sb.Append ("OID.");     // NOTE: Not present as RFC2253
+                               sb.Append (oid);
+                               sb.Append ("=");
+                               break;
+                       }
+
+                       // 16bits or 8bits string ? TODO not complete (+special chars!)
+                       char[] specials = { ',', '+', '"', '\\', '<', '>', ';' };
+                       if (quotes && tag != 0x1E) {
+                               if ((text.IndexOfAny (specials, 0, text.Length) > 0) ||
+                                   text.StartsWith (" ") || (text.EndsWith (" ")))
+                                       text = "\"" + text + "\"";
+                       }
+
+                       sb.Append (text);
+                       return true;
+               }
+
+               const X500DistinguishedNameFlags AllFlags = X500DistinguishedNameFlags.Reversed |
+                       X500DistinguishedNameFlags.UseSemicolons | X500DistinguishedNameFlags.DoNotUsePlusSign |
+                       X500DistinguishedNameFlags.DoNotUseQuotes | X500DistinguishedNameFlags.UseCommas |
+                       X500DistinguishedNameFlags.UseNewLines | X500DistinguishedNameFlags.UseUTF8Encoding |
+                       X500DistinguishedNameFlags.UseT61Encoding | X500DistinguishedNameFlags.ForceUTF8Encoding;
+
+               static string GetSeparator (X500DistinguishedNameFlags flag)
+               {
+                       if ((flag & X500DistinguishedNameFlags.UseSemicolons) != 0)
+                               return "; ";
+                       if ((flag & X500DistinguishedNameFlags.UseCommas) != 0)
+                               return ", ";
+                       if ((flag & X500DistinguishedNameFlags.UseNewLines) != 0)
+                               return Environment.NewLine;
+                       return ", "; //default
+               }
+
+               public static string FormatName (MonoBtlsX509Name name, X500DistinguishedNameFlags flag)
+               {
+                       if ((flag != 0) && ((flag & AllFlags) == 0))
+                               throw new ArgumentException ("flag");
+
+                       if (name.GetEntryCount () == 0)
+                               return String.Empty;
+
+                       // Mono.Security reversed isn't the same as fx 2.0 (which is the reverse of 1.x)
+                       bool reversed = ((flag & X500DistinguishedNameFlags.Reversed) != 0);
+                       bool quotes = ((flag & X500DistinguishedNameFlags.DoNotUseQuotes) == 0);
+                       string separator = GetSeparator (flag);
+
+                       return FormatName (name, reversed, separator, quotes);
+               }
+
+               public static string FormatName (MonoBtlsX509Name name, bool reversed, string separator, bool quotes)
+               {
+                       var count = name.GetEntryCount ();
+                       StringBuilder sb = new StringBuilder ();
+
+                       if (reversed) {
+                               for (int i = count - 1; i >= 0; i--) {
+                                       AppendEntry (sb, name, i, separator, quotes);
+                               }
+                       } else {
+                               for (int i = 0; i < count; i++) {
+                                       AppendEntry (sb, name, i, separator, quotes);
+                               }
+                       }
+
+                       return sb.ToString ();
+               }
+       }
+}
+#endif
diff --git a/mcs/class/System/Mono.Btls/MonoBtlsX509.cs b/mcs/class/System/Mono.Btls/MonoBtlsX509.cs
new file mode 100644 (file)
index 0000000..c722ad9
--- /dev/null
@@ -0,0 +1,465 @@
+//
+// MonoBtlsX509.cs
+//
+// Author:
+//       Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
+//
+// 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.
+#if SECURITY_DEP && MONO_FEATURE_BTLS
+using System;
+using System.IO;
+using System.Text;
+using System.Threading;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Security.Cryptography.X509Certificates;
+using System.Security.Cryptography;
+
+namespace Mono.Btls
+{
+       class MonoBtlsX509 : MonoBtlsObject
+       {
+               internal class BoringX509Handle : MonoBtlsHandle
+               {
+                       public BoringX509Handle (IntPtr handle)
+                               : base (handle, true)
+                       {
+                       }
+
+                       protected override bool ReleaseHandle ()
+                       {
+                               if (handle != IntPtr.Zero)
+                                       mono_btls_x509_free (handle);
+                               return true;
+                       }
+
+                       public IntPtr StealHandle ()
+                       {
+                               var retval = Interlocked.Exchange (ref handle, IntPtr.Zero);
+                               return retval;
+                       }
+               }
+
+               new internal BoringX509Handle Handle {
+                       get { return (BoringX509Handle)base.Handle; }
+               }
+
+               internal MonoBtlsX509 (BoringX509Handle handle) 
+                       : base (handle)
+               {
+               }
+
+               [DllImport (BTLS_DYLIB)]
+               extern static IntPtr mono_btls_x509_up_ref (IntPtr handle);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static IntPtr mono_btls_x509_from_data (IntPtr data, int len, MonoBtlsX509Format format);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static IntPtr mono_btls_x509_get_subject_name (IntPtr handle);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static IntPtr mono_btls_x509_get_issuer_name (IntPtr handle);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static int mono_btls_x509_get_subject_name_string (IntPtr handle, IntPtr buffer, int size);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static int mono_btls_x509_get_issuer_name_string (IntPtr handle, IntPtr buffer, int size);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static int mono_btls_x509_get_raw_data (IntPtr handle, IntPtr bio, MonoBtlsX509Format format);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static int mono_btls_x509_cmp (IntPtr a, IntPtr b);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static int mono_btls_x509_get_hash (IntPtr handle, out IntPtr data);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static long mono_btls_x509_get_not_before (IntPtr handle);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static long mono_btls_x509_get_not_after (IntPtr handle);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static int mono_btls_x509_get_public_key (IntPtr handle, IntPtr bio);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static int mono_btls_x509_get_serial_number (IntPtr handle, IntPtr data, int size, int mono_style);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static int mono_btls_x509_get_version (IntPtr handle);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static int mono_btls_x509_get_signature_algorithm (IntPtr handle, IntPtr buffer, int size);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static int mono_btls_x509_get_public_key_asn1 (IntPtr handle, IntPtr oid, int oid_size, out IntPtr data, out int size);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static int mono_btls_x509_get_public_key_parameters (IntPtr handle, IntPtr oid, int oid_size, out IntPtr data, out int size);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static IntPtr mono_btls_x509_get_pubkey (IntPtr handle);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static int mono_btls_x509_get_subject_key_identifier (IntPtr handle, out IntPtr data, out int size);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static int mono_btls_x509_print (IntPtr handle, IntPtr bio);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static void mono_btls_x509_free (IntPtr handle);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static IntPtr mono_btls_x509_dup (IntPtr handle);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static int mono_btls_x509_add_trust_object (IntPtr handle, MonoBtlsX509Purpose purpose);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static int mono_btls_x509_add_reject_object (IntPtr handle, MonoBtlsX509Purpose purpose);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static int mono_btls_x509_add_explicit_trust (IntPtr handle, MonoBtlsX509TrustKind kind);
+
+               internal MonoBtlsX509 Copy ()
+               {
+                       var copy = mono_btls_x509_up_ref (Handle.DangerousGetHandle ());
+                       CheckError (copy != IntPtr.Zero);
+                       return new MonoBtlsX509 (new BoringX509Handle (copy));
+               }
+
+               // This will actually duplicate the underlying 'X509 *' object instead of
+               // simply increasing the reference count.
+               internal MonoBtlsX509 Duplicate ()
+               {
+                       var copy = mono_btls_x509_dup (Handle.DangerousGetHandle ());
+                       CheckError (copy != IntPtr.Zero);
+                       return new MonoBtlsX509 (new BoringX509Handle (copy));
+               }
+
+               public static MonoBtlsX509 LoadFromData (byte[] buffer, MonoBtlsX509Format format)
+               {
+                       var data = Marshal.AllocHGlobal (buffer.Length);
+                       if (data == IntPtr.Zero)
+                               throw new OutOfMemoryException ();
+
+                       try {
+                               Marshal.Copy (buffer, 0, data, buffer.Length);
+                               var x509 = mono_btls_x509_from_data (data, buffer.Length, format);
+                               if (x509 == IntPtr.Zero)
+                                       throw new MonoBtlsException ("Failed to read certificate from data.");
+
+                               return new MonoBtlsX509 (new BoringX509Handle (x509));
+                       } finally {
+                               Marshal.FreeHGlobal (data);
+                       }
+               }
+
+               public MonoBtlsX509Name GetSubjectName ()
+               {
+                       var handle = mono_btls_x509_get_subject_name (Handle.DangerousGetHandle ());
+                       CheckError (handle != IntPtr.Zero);
+                       return new MonoBtlsX509Name (new MonoBtlsX509Name.BoringX509NameHandle (handle, false));
+               }
+
+               public string GetSubjectNameString ()
+               {
+                       const int size = 4096;
+                       var data = Marshal.AllocHGlobal (size);
+                       try {
+                               var ret = mono_btls_x509_get_subject_name_string (
+                                       Handle.DangerousGetHandle (), data, size);
+                               CheckError (ret);
+                               return Marshal.PtrToStringAnsi (data);
+                       } finally {
+                               Marshal.FreeHGlobal (data);
+                       }
+               }
+
+               public long GetSubjectNameHash ()
+               {
+                       CheckThrow ();
+                       using (var subject = GetSubjectName ())
+                               return subject.GetHash ();
+               }
+
+               public MonoBtlsX509Name GetIssuerName ()
+               {
+                       var handle = mono_btls_x509_get_issuer_name (Handle.DangerousGetHandle ());
+                       CheckError (handle != IntPtr.Zero);
+                       return new MonoBtlsX509Name (new MonoBtlsX509Name.BoringX509NameHandle (handle, false));
+               }
+
+               public string GetIssuerNameString ()
+               {
+                       const int size = 4096;
+                       var data = Marshal.AllocHGlobal (size);
+                       try {
+                               var ret = mono_btls_x509_get_issuer_name_string (
+                                       Handle.DangerousGetHandle (), data, size);
+                               CheckError (ret);
+                               return Marshal.PtrToStringAnsi (data);
+                       } finally {
+                               Marshal.FreeHGlobal (data);
+                       }
+               }
+
+               public byte[] GetRawData (MonoBtlsX509Format format)
+               {
+                       using (var bio = new MonoBtlsBioMemory ()) {
+                               var ret = mono_btls_x509_get_raw_data (
+                                       Handle.DangerousGetHandle (),
+                                       bio.Handle.DangerousGetHandle (),
+                                       format);
+                               CheckError (ret);
+                               return bio.GetData ();
+                       }
+               }
+
+               public void GetRawData (MonoBtlsBio bio, MonoBtlsX509Format format)
+               {
+                       CheckThrow ();
+                       var ret = mono_btls_x509_get_raw_data (
+                               Handle.DangerousGetHandle (),
+                               bio.Handle.DangerousGetHandle (),
+                               format);
+                       CheckError (ret);
+               }
+
+               public static int Compare (MonoBtlsX509 a, MonoBtlsX509 b)
+               {
+                       return mono_btls_x509_cmp (
+                               a.Handle.DangerousGetHandle (),
+                               b.Handle.DangerousGetHandle ());
+               }
+
+               public byte[] GetCertHash ()
+               {
+                       IntPtr data;
+                       var ret = mono_btls_x509_get_hash (Handle.DangerousGetHandle (), out data);
+                       CheckError (ret > 0);
+                       var buffer = new byte [ret];
+                       Marshal.Copy (data, buffer, 0, ret);
+                       return buffer;
+               }
+
+               public DateTime GetNotBefore ()
+               {
+                       var ticks = mono_btls_x509_get_not_before (Handle.DangerousGetHandle ());
+                       return new DateTime (1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds (ticks);
+               }
+
+               public DateTime GetNotAfter ()
+               {
+                       var ticks = mono_btls_x509_get_not_after (Handle.DangerousGetHandle ());
+                       return new DateTime (1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds (ticks);
+               }
+
+               public byte[] GetPublicKeyData ()
+               {
+                       using (var bio = new MonoBtlsBioMemory ()) {
+                               var ret = mono_btls_x509_get_public_key (
+                                       Handle.DangerousGetHandle (),
+                                       bio.Handle.DangerousGetHandle ());
+                               CheckError (ret > 0);
+                               return bio.GetData ();
+                       }
+               }
+
+               public byte[] GetSerialNumber (bool mono_style)
+               {
+                       int size = 256;
+                       IntPtr data = Marshal.AllocHGlobal (size);
+                       try {
+                               var ret = mono_btls_x509_get_serial_number (
+                                       Handle.DangerousGetHandle (), data,
+                                       size, mono_style ? 1 : 0);
+                               CheckError (ret > 0);
+                               var buffer = new byte [ret];
+                               Marshal.Copy (data, buffer, 0, ret);
+                               return buffer;
+                       } finally {
+                               if (data != IntPtr.Zero)
+                                       Marshal.FreeHGlobal (data);
+                       }
+               }
+
+               public int GetVersion ()
+               {
+                       return mono_btls_x509_get_version (Handle.DangerousGetHandle ());
+               }
+
+               public Oid GetSignatureAlgorithm ()
+               {
+                       int size = 256;
+                       IntPtr data = Marshal.AllocHGlobal (size);
+                       try {
+                               var ret = mono_btls_x509_get_signature_algorithm (
+                                       Handle.DangerousGetHandle (), data, size);
+                               CheckError (ret > 0);
+                               return new Oid (Marshal.PtrToStringAnsi (data));
+                       } finally {
+                               Marshal.FreeHGlobal (data);
+                       }
+               }
+
+               public AsnEncodedData GetPublicKeyAsn1 ()
+               {
+                       int size;
+                       IntPtr data;
+
+                       int oidSize = 256;
+                       var oidData = Marshal.AllocHGlobal (256);
+                       string oid;
+
+                       try {
+                               var ret = mono_btls_x509_get_public_key_asn1 (
+                                       Handle.DangerousGetHandle (), oidData, oidSize,
+                                       out data, out size);
+                               CheckError (ret);
+                               oid = Marshal.PtrToStringAnsi (oidData);
+                       } finally {
+                               Marshal.FreeHGlobal (oidData);
+                       }
+
+                       try {
+                               var buffer = new byte[size];
+                               Marshal.Copy (data, buffer, 0, size);
+                               return new AsnEncodedData (oid.ToString (), buffer);
+                       } finally {
+                               if (data != IntPtr.Zero)
+                                       FreeDataPtr (data);
+                       }
+               }
+
+               public AsnEncodedData GetPublicKeyParameters ()
+               {
+                       int size;
+                       IntPtr data;
+
+                       int oidSize = 256;
+                       var oidData = Marshal.AllocHGlobal (256);
+                       string oid;
+
+                       try {
+                               var ret = mono_btls_x509_get_public_key_parameters (
+                                       Handle.DangerousGetHandle (), oidData, oidSize,
+                                       out data, out size);
+                               CheckError (ret);
+                               oid = Marshal.PtrToStringAnsi (oidData);
+                       } finally {
+                               Marshal.FreeHGlobal (oidData);
+                       }
+
+                       try {
+                               var buffer = new byte[size];
+                               Marshal.Copy (data, buffer, 0, size);
+                               return new AsnEncodedData (oid.ToString (), buffer);
+                       } finally {
+                               if (data != IntPtr.Zero)
+                                       FreeDataPtr (data);
+                       }
+               }
+
+               public byte[] GetSubjectKeyIdentifier ()
+               {
+                       int size;
+                       IntPtr data = IntPtr.Zero;
+
+                       try {
+                               var ret = mono_btls_x509_get_subject_key_identifier (
+                                       Handle.DangerousGetHandle (), out data, out size);
+                               CheckError (ret);
+                               var buffer = new byte[size];
+                               Marshal.Copy (data, buffer, 0, size);
+                               return buffer;
+                       } finally {
+                               if (data != IntPtr.Zero)
+                                       FreeDataPtr (data);
+                       }
+               }
+
+               public MonoBtlsKey GetPublicKey ()
+               {
+                       var handle = mono_btls_x509_get_pubkey (Handle.DangerousGetHandle ());
+                       CheckError (handle != IntPtr.Zero);
+                       return new MonoBtlsKey (new MonoBtlsKey.BoringKeyHandle (handle));
+               }
+
+               public void Print (MonoBtlsBio bio)
+               {
+                       var ret = mono_btls_x509_print (
+                               Handle.DangerousGetHandle (),
+                               bio.Handle.DangerousGetHandle ());
+                       CheckError (ret);
+               }
+
+               public void ExportAsPEM (MonoBtlsBio bio, bool includeHumanReadableForm)
+               {
+                       GetRawData (bio, MonoBtlsX509Format.PEM);
+
+                       if (!includeHumanReadableForm)
+                               return;
+
+                       Print (bio);
+
+                       var hash = GetCertHash ();
+                       var output = new StringBuilder ();
+                       output.Append ("SHA1 Fingerprint=");
+                       for (int i = 0; i < hash.Length; i++) {
+                               if (i > 0)
+                                       output.Append (":");
+                               output.AppendFormat ("{0:X2}", hash [i]);
+                       }
+                       output.AppendLine ();
+                       var outputData = Encoding.ASCII.GetBytes (output.ToString ());
+                       bio.Write (outputData, 0, outputData.Length);
+               }
+
+               public void AddTrustObject (MonoBtlsX509Purpose purpose)
+               {
+                       CheckThrow ();
+                       var ret = mono_btls_x509_add_trust_object (
+                               Handle.DangerousGetHandle (), purpose);
+                       CheckError (ret);
+               }
+
+               public void AddRejectObject (MonoBtlsX509Purpose purpose)
+               {
+                       CheckThrow ();
+                       var ret = mono_btls_x509_add_reject_object (
+                               Handle.DangerousGetHandle (), purpose);
+                       CheckError (ret);
+               }
+
+               public void AddExplicitTrust (MonoBtlsX509TrustKind kind)
+               {
+                       CheckThrow ();
+                       var ret = mono_btls_x509_add_explicit_trust (
+                               Handle.DangerousGetHandle (), kind);
+                       CheckError (ret);
+               }
+       }
+}
+#endif
diff --git a/mcs/class/System/Mono.Btls/MonoBtlsX509Chain.cs b/mcs/class/System/Mono.Btls/MonoBtlsX509Chain.cs
new file mode 100644 (file)
index 0000000..7113d1f
--- /dev/null
@@ -0,0 +1,122 @@
+//
+// MonoBtlsX509Chain.cs
+//
+// Author:
+//       Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
+//
+// 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.
+#if SECURITY_DEP && MONO_FEATURE_BTLS
+using System;
+using System.IO;
+using System.Security.Cryptography.X509Certificates;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+namespace Mono.Btls
+{
+       class MonoBtlsX509Chain : MonoBtlsObject
+       {
+               internal class BoringX509ChainHandle : MonoBtlsHandle
+               {
+                       public BoringX509ChainHandle (IntPtr handle)
+                               : base (handle, true)
+                       {
+                       }
+
+                       protected override bool ReleaseHandle ()
+                       {
+                               mono_btls_x509_chain_free (handle);
+                               return true;
+                       }
+               }
+
+               new internal BoringX509ChainHandle Handle {
+                       get { return (BoringX509ChainHandle)base.Handle; }
+               }
+
+               [DllImport (BTLS_DYLIB)]
+               extern static IntPtr mono_btls_x509_chain_new ();
+
+               [DllImport (BTLS_DYLIB)]
+               extern static int mono_btls_x509_chain_get_count (IntPtr handle);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static IntPtr mono_btls_x509_chain_get_cert (IntPtr Handle, int index);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static int mono_btls_x509_chain_add_cert (IntPtr chain, IntPtr x509);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static IntPtr mono_btls_x509_chain_up_ref (IntPtr handle);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static void mono_btls_x509_chain_free (IntPtr handle);
+
+               public MonoBtlsX509Chain ()
+                       : base (new BoringX509ChainHandle (mono_btls_x509_chain_new ()))
+               {
+               }
+
+               internal MonoBtlsX509Chain (BoringX509ChainHandle handle)
+                       : base (handle)
+               {
+               }
+
+               public int Count {
+                       get { return mono_btls_x509_chain_get_count (Handle.DangerousGetHandle ()); }
+               }
+
+               public MonoBtlsX509 GetCertificate (int index)
+               {
+                       if (index >= Count)
+                               throw new IndexOutOfRangeException ();
+                       var handle = mono_btls_x509_chain_get_cert (
+                               Handle.DangerousGetHandle (), index);
+                       CheckError (handle != IntPtr.Zero);
+                       return new MonoBtlsX509 (new MonoBtlsX509.BoringX509Handle (handle));
+               }
+
+               public void Dump ()
+               {
+                       Console.Error.WriteLine ("CHAIN: {0:x} {1}", Handle, Count);
+                       for (int i = 0; i < Count; i++) {
+                               using (var cert = GetCertificate (i)) {
+                                       Console.Error.WriteLine ("  CERT #{0}: {1}", i, cert.GetSubjectNameString ());
+                               }
+                       }
+               }
+
+               public void AddCertificate (MonoBtlsX509 x509)
+               {
+                       mono_btls_x509_chain_add_cert (
+                               Handle.DangerousGetHandle (),
+                               x509.Handle.DangerousGetHandle ());
+               }
+
+               internal MonoBtlsX509Chain Copy ()
+               {
+                       var copy = mono_btls_x509_chain_up_ref (Handle.DangerousGetHandle ());
+                       CheckError (copy != IntPtr.Zero);
+                       return new MonoBtlsX509Chain (new BoringX509ChainHandle (copy));
+               }
+       }
+}
+#endif
diff --git a/mcs/class/System/Mono.Btls/MonoBtlsX509Crl.cs b/mcs/class/System/Mono.Btls/MonoBtlsX509Crl.cs
new file mode 100644 (file)
index 0000000..6801b79
--- /dev/null
@@ -0,0 +1,185 @@
+//
+// MonoBtlsX509Crl.cs
+//
+// Author:
+//       Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
+//
+// 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.
+#if SECURITY_DEP && MONO_FEATURE_BTLS
+using System;
+using System.IO;
+using System.Text;
+using System.Threading;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Security.Cryptography.X509Certificates;
+using System.Security.Cryptography;
+
+namespace Mono.Btls
+{
+       class MonoBtlsX509Crl : MonoBtlsObject
+       {
+               internal class BoringX509CrlHandle : MonoBtlsHandle
+               {
+                       public BoringX509CrlHandle (IntPtr handle)
+                               : base (handle, true)
+                       {
+                       }
+
+                       protected override bool ReleaseHandle ()
+                       {
+                               if (handle != IntPtr.Zero)
+                                       mono_btls_x509_crl_free (handle);
+                               return true;
+                       }
+
+                       public IntPtr StealHandle ()
+                       {
+                               var retval = Interlocked.Exchange (ref handle, IntPtr.Zero);
+                               return retval;
+                       }
+               }
+
+               new internal BoringX509CrlHandle Handle {
+                       get { return (BoringX509CrlHandle)base.Handle; }
+               }
+
+               internal MonoBtlsX509Crl (BoringX509CrlHandle handle) 
+                       : base (handle)
+               {
+               }
+
+               [DllImport (BTLS_DYLIB)]
+               extern static IntPtr mono_btls_x509_crl_ref (IntPtr handle);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static IntPtr mono_btls_x509_crl_from_data (IntPtr data, int len, MonoBtlsX509Format format);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static IntPtr mono_btls_x509_crl_get_by_cert (IntPtr handle, IntPtr x509);
+
+               [DllImport (BTLS_DYLIB)]
+               unsafe extern static IntPtr mono_btls_x509_crl_get_by_serial (IntPtr handle, void *serial, int len);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static int mono_btls_x509_crl_get_revoked_count (IntPtr handle);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static IntPtr mono_btls_x509_crl_get_revoked (IntPtr handle, int index);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static long mono_btls_x509_crl_get_last_update (IntPtr handle);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static long mono_btls_x509_crl_get_next_update (IntPtr handle);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static long mono_btls_x509_crl_get_version (IntPtr handle);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static IntPtr mono_btls_x509_crl_get_issuer (IntPtr handle);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static void mono_btls_x509_crl_free (IntPtr handle);
+
+               public static MonoBtlsX509Crl LoadFromData (byte[] buffer, MonoBtlsX509Format format)
+               {
+                       var data = Marshal.AllocHGlobal (buffer.Length);
+                       if (data == IntPtr.Zero)
+                               throw new OutOfMemoryException ();
+
+                       try {
+                               Marshal.Copy (buffer, 0, data, buffer.Length);
+                               var crl = mono_btls_x509_crl_from_data (data, buffer.Length, format);
+                               if (crl == IntPtr.Zero)
+                                       throw new MonoBtlsException ("Failed to read CRL from data.");
+
+                               return new MonoBtlsX509Crl (new BoringX509CrlHandle (crl));
+                       } finally {
+                               Marshal.FreeHGlobal (data);
+                       }
+               }
+
+               public MonoBtlsX509Revoked GetByCert (MonoBtlsX509 x509)
+               {
+                       var revoked = mono_btls_x509_crl_get_by_cert (
+                               Handle.DangerousGetHandle (),
+                               x509.Handle.DangerousGetHandle ());
+                       if (revoked == IntPtr.Zero)
+                               return null;
+                       return new MonoBtlsX509Revoked (new MonoBtlsX509Revoked.BoringX509RevokedHandle (revoked));
+               }
+
+               public unsafe MonoBtlsX509Revoked GetBySerial (byte[] serial)
+               {
+                       fixed (void *ptr = serial)
+                       {
+                               var revoked = mono_btls_x509_crl_get_by_serial (
+                                       Handle.DangerousGetHandle (), ptr, serial.Length);
+                               if (revoked == IntPtr.Zero)
+                                       return null;
+                               return new MonoBtlsX509Revoked (new MonoBtlsX509Revoked.BoringX509RevokedHandle (revoked));
+                       }
+               }
+
+               public int GetRevokedCount ()
+               {
+                       return mono_btls_x509_crl_get_revoked_count (Handle.DangerousGetHandle ());
+               }
+
+               public MonoBtlsX509Revoked GetRevoked (int index)
+               {
+                       if (index >= GetRevokedCount ())
+                               throw new ArgumentOutOfRangeException ();
+
+                       var revoked = mono_btls_x509_crl_get_revoked (
+                               Handle.DangerousGetHandle (), index);
+                       if (revoked == IntPtr.Zero)
+                               return null;
+                       return new MonoBtlsX509Revoked (new MonoBtlsX509Revoked.BoringX509RevokedHandle (revoked));
+               }
+
+               public DateTime GetLastUpdate ()
+               {
+                       var ticks = mono_btls_x509_crl_get_last_update (Handle.DangerousGetHandle ());
+                       return new DateTime (1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds (ticks);
+               }
+
+               public DateTime GetNextUpdate ()
+               {
+                       var ticks = mono_btls_x509_crl_get_next_update (Handle.DangerousGetHandle ());
+                       return new DateTime (1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds (ticks);
+               }
+
+               public long GetVersion ()
+               {
+                       return mono_btls_x509_crl_get_version (Handle.DangerousGetHandle ());
+               }
+
+               public MonoBtlsX509Name GetIssuerName ()
+               {
+                       var handle = mono_btls_x509_crl_get_issuer (Handle.DangerousGetHandle ());
+                       CheckError (handle != IntPtr.Zero);
+                       return new MonoBtlsX509Name (new MonoBtlsX509Name.BoringX509NameHandle (handle, false));
+               }
+       }
+}
+#endif
diff --git a/mcs/class/System/Mono.Btls/MonoBtlsX509Error.cs b/mcs/class/System/Mono.Btls/MonoBtlsX509Error.cs
new file mode 100644 (file)
index 0000000..bf40275
--- /dev/null
@@ -0,0 +1,111 @@
+//
+// MonoBtlsX509Error.cs
+//
+// Author:
+//       Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
+//
+// 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.
+#if SECURITY_DEP && MONO_FEATURE_BTLS
+using System;
+namespace Mono.Btls
+{
+       // Keep in sync with x509_vfy.h
+       enum MonoBtlsX509Error
+       {
+               OK = 0,
+               /* illegal error (for uninitialized values, to avoid X509_V_OK): 1 */
+
+               UNABLE_TO_GET_ISSUER_CERT = 2,
+               UNABLE_TO_GET_CRL = 3,
+               UNABLE_TO_DECRYPT_CERT_SIGNATURE = 4,
+               UNABLE_TO_DECRYPT_CRL_SIGNATURE = 5,
+               UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY = 6,
+               CERT_SIGNATURE_FAILURE = 7,
+               CRL_SIGNATURE_FAILURE = 8,
+               CERT_NOT_YET_VALID = 9,
+               CERT_HAS_EXPIRED = 10,
+               CRL_NOT_YET_VALID = 11,
+               CRL_HAS_EXPIRED = 12,
+               ERROR_IN_CERT_NOT_BEFORE_FIELD = 13,
+               ERROR_IN_CERT_NOT_AFTER_FIELD = 14,
+               ERROR_IN_CRL_LAST_UPDATE_FIELD = 15,
+               ERROR_IN_CRL_NEXT_UPDATE_FIELD = 16,
+               OUT_OF_MEM = 17,
+               DEPTH_ZERO_SELF_SIGNED_CERT = 18,
+               SELF_SIGNED_CERT_IN_CHAIN = 19,
+               UNABLE_TO_GET_ISSUER_CERT_LOCALLY = 20,
+               UNABLE_TO_VERIFY_LEAF_SIGNATURE = 21,
+               CERT_CHAIN_TOO_LONG = 22,
+               CERT_REVOKED = 23,
+               INVALID_CA = 24,
+               PATH_LENGTH_EXCEEDED = 25,
+               INVALID_PURPOSE = 26,
+               CERT_UNTRUSTED = 27,
+               CERT_REJECTED = 28,
+               /* These are 'informational' when looking for issuer cert */
+               SUBJECT_ISSUER_MISMATCH = 29,
+               AKID_SKID_MISMATCH = 30,
+               AKID_ISSUER_SERIAL_MISMATCH = 31,
+               KEYUSAGE_NO_CERTSIGN = 32,
+
+               UNABLE_TO_GET_CRL_ISSUER = 33,
+               UNHANDLED_CRITICAL_EXTENSION = 34,
+               KEYUSAGE_NO_CRL_SIGN = 35,
+               UNHANDLED_CRITICAL_CRL_EXTENSION = 36,
+               INVALID_NON_CA = 37,
+               PROXY_PATH_LENGTH_EXCEEDED = 38,
+               KEYUSAGE_NO_DIGITAL_SIGNATURE = 39,
+               PROXY_CERTIFICATES_NOT_ALLOWED = 40,
+
+               INVALID_EXTENSION = 41,
+               INVALID_POLICY_EXTENSION = 42,
+               NO_EXPLICIT_POLICY = 43,
+               DIFFERENT_CRL_SCOPE = 44,
+               UNSUPPORTED_EXTENSION_FEATURE = 45,
+
+               UNNESTED_RESOURCE = 46,
+
+               PERMITTED_VIOLATION = 47,
+               EXCLUDED_VIOLATION = 48,
+               SUBTREE_MINMAX = 49,
+               UNSUPPORTED_CONSTRAINT_TYPE = 51,
+               UNSUPPORTED_CONSTRAINT_SYNTAX = 52,
+               UNSUPPORTED_NAME_SYNTAX = 53,
+               CRL_PATH_VALIDATION_ERROR = 54,
+
+               /* Suite B mode algorithm violation */
+               SUITE_B_INVALID_VERSION = 56,
+               SUITE_B_INVALID_ALGORITHM = 57,
+               SUITE_B_INVALID_CURVE = 58,
+               SUITE_B_INVALID_SIGNATURE_ALGORITHM = 59,
+               SUITE_B_LOS_NOT_ALLOWED = 60,
+               SUITE_B_CANNOT_SIGN_P_384_WITH_P_256 = 61,
+
+               /* Host, email and IP check errors */
+               HOSTNAME_MISMATCH = 62,
+               EMAIL_MISMATCH = 63,
+               IP_ADDRESS_MISMATCH = 64,
+
+               /* The application is not happy */
+               APPLICATION_VERIFICATION = 50
+       }
+}
+#endif
diff --git a/mcs/class/System/Mono.Btls/MonoBtlsX509Exception.cs b/mcs/class/System/Mono.Btls/MonoBtlsX509Exception.cs
new file mode 100644 (file)
index 0000000..bb982bc
--- /dev/null
@@ -0,0 +1,56 @@
+//
+// MonoBtlsX509Exception.cs
+//
+// Author:
+//       Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
+//
+// 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.
+#if SECURITY_DEP && MONO_FEATURE_BTLS
+using System;
+
+namespace Mono.Btls
+{
+       class MonoBtlsX509Exception : Exception
+       {
+               public MonoBtlsX509Error ErrorCode {
+                       get;
+                       private set;
+               }
+
+               public string ErrorMessage {
+                       get;
+                       private set;
+               }
+
+               public MonoBtlsX509Exception (MonoBtlsX509Error code, string message)
+                       : base (message)
+               {
+                       ErrorCode = code;
+                       ErrorMessage = message;
+               }
+
+               public override string ToString ()
+               {
+                       return string.Format ("[MonoBtlsX509Exception: ErrorCode={0}, ErrorMessage={1}]", ErrorCode, ErrorMessage);
+               }
+       }
+}
+#endif
diff --git a/mcs/class/System/Mono.Btls/MonoBtlsX509FileType.cs b/mcs/class/System/Mono.Btls/MonoBtlsX509FileType.cs
new file mode 100644 (file)
index 0000000..1475457
--- /dev/null
@@ -0,0 +1,37 @@
+//
+// MonoBtlsX509FileType.cs
+//
+// Author:
+//       Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
+//
+// 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.
+#if SECURITY_DEP && MONO_FEATURE_BTLS
+using System;
+namespace Mono.Btls
+{
+       enum MonoBtlsX509FileType
+       {
+               PEM = 1,
+               ASN1 = 2,
+               DEFAULT = 3
+       }
+}
+#endif
diff --git a/mcs/class/System/Mono.Btls/MonoBtlsX509Format.cs b/mcs/class/System/Mono.Btls/MonoBtlsX509Format.cs
new file mode 100644 (file)
index 0000000..609d0c1
--- /dev/null
@@ -0,0 +1,36 @@
+//
+// MonoBtlsX509Format.cs
+//
+// Author:
+//       Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
+//
+// 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.
+#if SECURITY_DEP && MONO_FEATURE_BTLS
+using System;
+namespace Mono.Btls
+{
+       enum MonoBtlsX509Format
+       {
+               DER = 1,
+               PEM = 2
+       }
+}
+#endif
diff --git a/mcs/class/System/Mono.Btls/MonoBtlsX509Lookup.cs b/mcs/class/System/Mono.Btls/MonoBtlsX509Lookup.cs
new file mode 100644 (file)
index 0000000..8a6bf30
--- /dev/null
@@ -0,0 +1,213 @@
+//
+// MonoBtlsX509Lookup.cs
+//
+// Author:
+//       Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
+//
+// 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.
+#if SECURITY_DEP && MONO_FEATURE_BTLS
+using System;
+using System.IO;
+using System.Runtime.InteropServices;
+using System.Runtime.CompilerServices;
+using System.Collections.Generic;
+
+namespace Mono.Btls
+{
+       class MonoBtlsX509Lookup : MonoBtlsObject
+       {
+               internal class BoringX509LookupHandle : MonoBtlsHandle
+               {
+                       public BoringX509LookupHandle (IntPtr handle)
+                               : base (handle, true)
+                       {
+                       }
+
+                       protected override bool ReleaseHandle ()
+                       {
+                               mono_btls_x509_lookup_free (handle);
+                               return true;
+                       }
+               }
+
+               new internal BoringX509LookupHandle Handle {
+                       get { return (BoringX509LookupHandle)base.Handle; }
+               }
+
+               [DllImport (BTLS_DYLIB)]
+               extern static IntPtr mono_btls_x509_lookup_new (IntPtr store, MonoBtlsX509LookupType type);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static int mono_btls_x509_lookup_load_file (IntPtr handle, IntPtr file, MonoBtlsX509FileType type);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static int mono_btls_x509_lookup_add_dir (IntPtr handle, IntPtr dir, MonoBtlsX509FileType type);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static int mono_btls_x509_lookup_add_mono (IntPtr handle, IntPtr monoLookup);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static int mono_btls_x509_lookup_init (IntPtr handle);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static int mono_btls_x509_lookup_shutdown (IntPtr handle);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static IntPtr mono_btls_x509_lookup_by_subject (IntPtr handle, IntPtr name);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static IntPtr mono_btls_x509_lookup_by_fingerprint (IntPtr handle, IntPtr bytes, int len);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static void mono_btls_x509_lookup_free (IntPtr handle);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static IntPtr mono_btls_x509_lookup_peek_lookup (IntPtr handle);
+
+               MonoBtlsX509LookupType type;
+               List<MonoBtlsX509LookupMono> monoLookups;
+
+#if FIXME
+               // Do we need this?
+               internal MonoBtlsX509Lookup (BoringX509LookupHandle handle)
+                       : base (handle)
+               {
+               }
+#endif
+
+               static BoringX509LookupHandle Create_internal (MonoBtlsX509Store store, MonoBtlsX509LookupType type)
+               {
+                       var handle = mono_btls_x509_lookup_new (
+                               store.Handle.DangerousGetHandle (), type);
+                       if (handle == IntPtr.Zero)
+                               throw new MonoBtlsException ();
+                       return new BoringX509LookupHandle (handle);
+               }
+
+               internal MonoBtlsX509Lookup (MonoBtlsX509Store store, MonoBtlsX509LookupType type)
+                       : base (Create_internal (store, type))
+               {
+                       this.type = type;
+               }
+
+               internal IntPtr GetNativeLookup ()
+               {
+                       return mono_btls_x509_lookup_peek_lookup (Handle.DangerousGetHandle ());
+               }
+
+               public void LoadFile (string file, MonoBtlsX509FileType type)
+               {
+                       IntPtr filePtr = IntPtr.Zero;
+                       try {
+                               if (file != null)
+                                       filePtr = Marshal.StringToHGlobalAnsi (file);
+                               var ret = mono_btls_x509_lookup_load_file (
+                                       Handle.DangerousGetHandle (), filePtr, type);
+                               CheckError (ret);
+                       } finally {
+                               if (filePtr != IntPtr.Zero)
+                                       Marshal.FreeHGlobal (filePtr);
+                       }
+               }
+
+               public void AddDirectory (string dir, MonoBtlsX509FileType type)
+               {
+                       IntPtr dirPtr = IntPtr.Zero;
+                       try {
+                               if (dir != null)
+                                       dirPtr = Marshal.StringToHGlobalAnsi (dir);
+                               var ret = mono_btls_x509_lookup_add_dir (
+                                       Handle.DangerousGetHandle (), dirPtr, type);
+                               CheckError (ret);
+                       } finally {
+                               if (dirPtr != IntPtr.Zero)
+                                       Marshal.FreeHGlobal (dirPtr);
+                       }
+               }
+
+               // Takes ownership of the 'monoLookup'.
+               internal void AddMono (MonoBtlsX509LookupMono monoLookup)
+               {
+                       if (type != MonoBtlsX509LookupType.MONO)
+                               throw new NotSupportedException ();
+                       var ret = mono_btls_x509_lookup_add_mono (
+                               Handle.DangerousGetHandle (), monoLookup.Handle.DangerousGetHandle ());
+                       CheckError (ret);
+
+                       if (monoLookups == null)
+                               monoLookups = new List<MonoBtlsX509LookupMono> ();
+                       monoLookups.Add (monoLookup);
+               }
+
+               public void Initialize ()
+               {
+                       var ret = mono_btls_x509_lookup_init (Handle.DangerousGetHandle ());
+                       CheckError (ret);
+               }
+
+               public void Shutdown ()
+               {
+                       var ret = mono_btls_x509_lookup_shutdown (Handle.DangerousGetHandle ());
+                       CheckError (ret);
+               }
+
+               public MonoBtlsX509 LookupBySubject (MonoBtlsX509Name name)
+               {
+                       var handle = mono_btls_x509_lookup_by_subject (
+                               Handle.DangerousGetHandle (),
+                               name.Handle.DangerousGetHandle ());
+                       if (handle == IntPtr.Zero)
+                               return null;
+                       return new MonoBtlsX509 (new MonoBtlsX509.BoringX509Handle (handle));
+               }
+
+               public MonoBtlsX509 LookupByFingerPrint (byte[] fingerprint)
+               {
+                       var bytes = Marshal.AllocHGlobal (fingerprint.Length);
+                       try {
+                               Marshal.Copy (fingerprint, 0, bytes, fingerprint.Length);
+                               var handle = mono_btls_x509_lookup_by_fingerprint (
+                                       Handle.DangerousGetHandle (),
+                                       bytes, fingerprint.Length);
+                               if (handle == IntPtr.Zero)
+                                       return null;
+                               return new MonoBtlsX509 (new MonoBtlsX509.BoringX509Handle (handle));
+                       } finally {
+                               if (bytes != IntPtr.Zero)
+                                       Marshal.FreeHGlobal (bytes);
+                       }
+               }
+
+               protected override void Close ()
+               {
+                       try {
+                               if (monoLookups != null) {
+                                       foreach (var monoLookup in monoLookups)
+                                               monoLookup.Dispose ();
+                               monoLookups = null;
+                               }
+                       } finally {
+                               base.Close ();
+                       }
+               }
+       }
+}
+#endif
diff --git a/mcs/class/System/Mono.Btls/MonoBtlsX509LookupAndroid.cs b/mcs/class/System/Mono.Btls/MonoBtlsX509LookupAndroid.cs
new file mode 100644 (file)
index 0000000..db0151a
--- /dev/null
@@ -0,0 +1,43 @@
+//
+// MonoBtlsX509LookupAndroid.cs
+//
+// Author:
+//       Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
+//
+// 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.
+#if SECURITY_DEP && MONO_FEATURE_BTLS && MONODROID
+using System;
+using System.IO;
+using System.Runtime.InteropServices;
+using System.Runtime.CompilerServices;
+using System.Security.Cryptography.X509Certificates;
+
+namespace Mono.Btls
+{
+       internal class MonoBtlsX509LookupAndroid : MonoBtlsX509LookupMono
+       {
+               protected override MonoBtlsX509 OnGetBySubject (MonoBtlsX509Name name)
+               {
+                       return AndroidPlatform.CertStoreLookup (name);
+               }
+       }
+}
+#endif
diff --git a/mcs/class/System/Mono.Btls/MonoBtlsX509LookupMono.cs b/mcs/class/System/Mono.Btls/MonoBtlsX509LookupMono.cs
new file mode 100644 (file)
index 0000000..cd86cde
--- /dev/null
@@ -0,0 +1,128 @@
+//
+// MonoBtlsX509LookupMono.cs
+//
+// Author:
+//       Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
+//
+// 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.
+#if SECURITY_DEP && MONO_FEATURE_BTLS
+using System;
+using System.IO;
+using System.Runtime.InteropServices;
+using System.Runtime.CompilerServices;
+
+namespace Mono.Btls
+{
+       abstract class MonoBtlsX509LookupMono : MonoBtlsObject
+       {
+               internal class BoringX509LookupMonoHandle : MonoBtlsHandle
+               {
+                       public BoringX509LookupMonoHandle (IntPtr handle)
+                               : base (handle, true)
+                       {
+                       }
+
+                       protected override bool ReleaseHandle ()
+                       {
+                               mono_btls_x509_lookup_mono_free (handle);
+                               return true;
+                       }
+               }
+
+               new internal BoringX509LookupMonoHandle Handle {
+                       get { return (BoringX509LookupMonoHandle)base.Handle; }
+               }
+
+               [DllImport (BTLS_DYLIB)]
+               extern static IntPtr mono_btls_x509_lookup_mono_new ();
+
+               [DllImport (BTLS_DYLIB)]
+               extern static void mono_btls_x509_lookup_mono_init (
+                       IntPtr handle, IntPtr instance, IntPtr by_subject_func);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static int mono_btls_x509_lookup_mono_free (IntPtr handle);
+
+               delegate int BySubjectFunc (IntPtr instance, IntPtr name, out IntPtr x509_ptr);
+
+               GCHandle gch;
+               IntPtr instance;
+               BySubjectFunc bySubjectFunc;
+               IntPtr bySubjectFuncPtr;
+
+               internal MonoBtlsX509LookupMono ()
+                       : base (new BoringX509LookupMonoHandle (mono_btls_x509_lookup_mono_new ()))
+               {
+                       gch = GCHandle.Alloc (this);
+                       instance = GCHandle.ToIntPtr (gch);
+                       bySubjectFunc = OnGetBySubject;
+                       bySubjectFuncPtr = Marshal.GetFunctionPointerForDelegate (bySubjectFunc);
+                       mono_btls_x509_lookup_mono_init (Handle.DangerousGetHandle (), instance, bySubjectFuncPtr);
+               }
+
+               protected abstract MonoBtlsX509 OnGetBySubject (MonoBtlsX509Name name);
+
+#if MONOTOUCH
+               [MonoTouch.MonoPInvokeCallback (typeof (BySubjectFunc))]
+#endif
+               static int OnGetBySubject (IntPtr instance, IntPtr name_ptr, out IntPtr x509_ptr)
+               {
+                       try {
+                               MonoBtlsX509LookupMono obj;
+                               MonoBtlsX509Name.BoringX509NameHandle name_handle = null;
+                               try {
+                                       obj = (MonoBtlsX509LookupMono)GCHandle.FromIntPtr (instance).Target;
+                                       name_handle = new MonoBtlsX509Name.BoringX509NameHandle (name_ptr, false);
+                                       MonoBtlsX509Name name_obj = new MonoBtlsX509Name (name_handle);
+                                       var x509 = obj.OnGetBySubject (name_obj);
+                                       if (x509 != null) {
+                                               x509_ptr = x509.Handle.StealHandle ();
+                                               return 1;
+                                       } else {
+                                               x509_ptr = IntPtr.Zero;
+                                               return 0;
+                                       }
+                               } finally {
+                                       if (name_handle != null)
+                                               name_handle.Dispose ();
+                               }
+                       } catch (Exception ex) {
+                               Console.WriteLine ("LOOKUP METHOD - GET BY SUBJECT EX: {0}", ex);
+                               x509_ptr = IntPtr.Zero;
+                               return 0;
+                       }
+               }
+
+               protected override void Close ()
+               {
+                       try {
+                               if (gch.IsAllocated)
+                                       gch.Free ();
+                       } finally {
+                               instance = IntPtr.Zero;
+                               bySubjectFunc = null;
+                               bySubjectFuncPtr = IntPtr.Zero;
+                               base.Close ();
+                       }
+               }
+       }
+}
+#endif
diff --git a/mcs/class/System/Mono.Btls/MonoBtlsX509LookupMonoCollection.cs b/mcs/class/System/Mono.Btls/MonoBtlsX509LookupMonoCollection.cs
new file mode 100644 (file)
index 0000000..139243e
--- /dev/null
@@ -0,0 +1,102 @@
+//
+// MonoBtlsX509LookupMonoCollection.cs
+//
+// Author:
+//       Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
+//
+// 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.
+#if SECURITY_DEP && MONO_FEATURE_BTLS
+using System;
+using System.IO;
+using System.Runtime.InteropServices;
+using System.Runtime.CompilerServices;
+using System.Security.Cryptography.X509Certificates;
+
+#if MONOTOUCH
+using MonoTouch;
+#endif
+
+namespace Mono.Btls
+{
+       internal class MonoBtlsX509LookupMonoCollection : MonoBtlsX509LookupMono
+       {
+               long[] hashes;
+               MonoBtlsX509[] certificates;
+               X509CertificateCollection collection;
+               MonoBtlsX509TrustKind trust;
+
+               internal MonoBtlsX509LookupMonoCollection (X509CertificateCollection collection, MonoBtlsX509TrustKind trust)
+               {
+                       this.collection = collection;
+                       this.trust = trust;
+               }
+
+               void Initialize ()
+               {
+                       if (certificates != null)
+                               return;
+
+                       hashes = new long [collection.Count];
+                       certificates = new MonoBtlsX509 [collection.Count];
+                       for (int i = 0; i < collection.Count; i++) {
+                               // Create new 'X509 *' instance since we need to modify it to add the
+                               // trust settings.
+                               var data = collection [i].GetRawCertData ();
+                               certificates [i] = MonoBtlsX509.LoadFromData (data, MonoBtlsX509Format.DER);
+                               certificates [i].AddExplicitTrust (trust);
+                               hashes [i] = certificates [i].GetSubjectNameHash ();
+                       }
+               }
+
+               protected override MonoBtlsX509 OnGetBySubject (MonoBtlsX509Name name)
+               {
+                       Console.WriteLine ("COLLECTION LOOKUP: {0:x} - {1}", name.GetHash (), name.GetString ());
+                       Initialize ();
+
+                       var hash = name.GetHash ();
+                       for (int i = 0; i < certificates.Length; i++) {
+                               if (hashes [i] == hash)
+                                       return certificates [i];
+                       }
+
+                       return null;
+               }
+
+               protected override void Close ()
+               {
+                       try {
+                               if (certificates != null) {
+                                       for (int i = 0; i < certificates.Length; i++) {
+                                               if (certificates [i] != null) {
+                                                       certificates [i].Dispose ();
+                                                       certificates [i] = null;
+                                               }
+                                       }
+                                       certificates = null;
+                                       hashes = null;
+                               }
+                       } finally {
+                               base.Close ();
+                       }
+               }
+       }
+}
+#endif
diff --git a/mcs/class/System/Mono.Btls/MonoBtlsX509LookupType.cs b/mcs/class/System/Mono.Btls/MonoBtlsX509LookupType.cs
new file mode 100644 (file)
index 0000000..6bb42d9
--- /dev/null
@@ -0,0 +1,39 @@
+//
+// MonoBtlsX509LookupCollection.cs
+//
+// Author:
+//       Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
+//
+// 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.
+#if SECURITY_DEP && MONO_FEATURE_BTLS
+using System;
+
+namespace Mono.Btls
+{
+       enum MonoBtlsX509LookupType
+       {
+               UNKNOWN = 0,
+               FILE,
+               HASH_DIR,
+               MONO
+       }
+}
+#endif
diff --git a/mcs/class/System/Mono.Btls/MonoBtlsX509Name.cs b/mcs/class/System/Mono.Btls/MonoBtlsX509Name.cs
new file mode 100644 (file)
index 0000000..74e335a
--- /dev/null
@@ -0,0 +1,216 @@
+//
+// MonoBtlsX509Name.cs
+//
+// Author:
+//       Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
+//
+// 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.
+#if SECURITY_DEP && MONO_FEATURE_BTLS
+using System;
+using System.IO;
+using System.Text;
+using System.Runtime.InteropServices;
+using System.Runtime.CompilerServices;
+
+namespace Mono.Btls
+{
+       class MonoBtlsX509Name : MonoBtlsObject
+       {
+               internal class BoringX509NameHandle : MonoBtlsHandle
+               {
+                       bool dontFree;
+
+                       internal BoringX509NameHandle (IntPtr handle, bool ownsHandle)
+                               : base (handle, ownsHandle)
+                       {
+                               this.dontFree = !ownsHandle;
+                       }
+
+                       protected override bool ReleaseHandle ()
+                       {
+                               if (!dontFree)
+                                       mono_btls_x509_name_free (handle);
+                               return true;
+                       }
+               }
+
+               [DllImport (BTLS_DYLIB)]
+               extern static int mono_btls_x509_name_print_bio (IntPtr handle, IntPtr bio);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static int mono_btls_x509_name_print_string (IntPtr handle, IntPtr buffer, int size);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static int mono_btls_x509_name_get_raw_data (IntPtr handle, out IntPtr buffer, int use_canon_enc);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static long mono_btls_x509_name_hash (IntPtr handle);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static long mono_btls_x509_name_hash_old (IntPtr handle);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static int mono_btls_x509_name_get_entry_count (IntPtr handle);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static MonoBtlsX509NameEntryType mono_btls_x509_name_get_entry_type (IntPtr name, int index);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static int mono_btls_x509_name_get_entry_oid (IntPtr name, int index, IntPtr buffer, int size);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static int mono_btls_x509_name_get_entry_oid_data (IntPtr name, int index, out IntPtr data);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static int mono_btls_x509_name_get_entry_value (IntPtr name, int index, out int tag, out IntPtr str);
+
+               [DllImport (BTLS_DYLIB)]
+               extern unsafe static IntPtr mono_btls_x509_name_from_data (void* data, int len, int use_canon_enc);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static void mono_btls_x509_name_free (IntPtr handle);
+
+               new internal BoringX509NameHandle Handle {
+                       get { return (BoringX509NameHandle)base.Handle; }
+               }
+
+               internal MonoBtlsX509Name (BoringX509NameHandle handle)
+                       : base (handle)
+               {
+               }
+
+               public string GetString ()
+               {
+                       const int size = 4096;
+                       var data = Marshal.AllocHGlobal (size);
+                       try {
+                               var ret = mono_btls_x509_name_print_string (
+                                       Handle.DangerousGetHandle (), data, size);
+                               CheckError (ret);
+                               return Marshal.PtrToStringAnsi (data);
+                       } finally {
+                               Marshal.FreeHGlobal (data);
+                       }
+               }
+
+               public void PrintBio (MonoBtlsBio bio)
+               {
+                       var ret = mono_btls_x509_name_print_bio (
+                               Handle.DangerousGetHandle (),
+                               bio.Handle.DangerousGetHandle ());
+                       CheckError (ret);
+               }
+
+               public byte[] GetRawData (bool use_canon_enc)
+               {
+                       IntPtr data;
+                       var ret = mono_btls_x509_name_get_raw_data (
+                               Handle.DangerousGetHandle (),
+                               out data, use_canon_enc ? 1 : 0);
+                       CheckError (ret > 0);
+                       var buffer = new byte [ret];
+                       Marshal.Copy (data, buffer, 0, ret);
+                       FreeDataPtr (data);
+                       return buffer;
+               }
+
+               public long GetHash ()
+               {
+                       return mono_btls_x509_name_hash (Handle.DangerousGetHandle ());
+               }
+
+               public long GetHashOld ()
+               {
+                       return mono_btls_x509_name_hash_old (Handle.DangerousGetHandle ());
+               }
+
+               public int GetEntryCount ()
+               {
+                       return mono_btls_x509_name_get_entry_count (Handle.DangerousGetHandle ());
+               }
+
+               public MonoBtlsX509NameEntryType GetEntryType (int index)
+               {
+                       if (index >= GetEntryCount ())
+                               throw new ArgumentOutOfRangeException ();
+                       return mono_btls_x509_name_get_entry_type (
+                               Handle.DangerousGetHandle (), index);
+               }
+
+               public string GetEntryOid (int index)
+               {
+                       if (index >= GetEntryCount ())
+                               throw new ArgumentOutOfRangeException ();
+
+                       const int size = 4096;
+                       var data = Marshal.AllocHGlobal (size);
+                       try {
+                               var ret = mono_btls_x509_name_get_entry_oid (
+                                       Handle.DangerousGetHandle (),
+                                       index, data, size);
+                               CheckError (ret > 0);
+                               return Marshal.PtrToStringAnsi (data);
+                       } finally {
+                               Marshal.FreeHGlobal (data);
+                       }
+               }
+
+               public byte[] GetEntryOidData (int index)
+               {
+                       IntPtr data;
+                       var ret = mono_btls_x509_name_get_entry_oid_data (
+                               Handle.DangerousGetHandle (), index, out data);
+                       CheckError (ret > 0);
+
+                       var bytes = new byte[ret];
+                       Marshal.Copy (data, bytes, 0, ret);
+                       return bytes;
+               }
+
+               public unsafe string GetEntryValue (int index, out int tag)
+               {
+                       if (index >= GetEntryCount ())
+                               throw new ArgumentOutOfRangeException ();
+                       IntPtr data;
+                       var ret = mono_btls_x509_name_get_entry_value (
+                               Handle.DangerousGetHandle (), index, out tag, out data);
+                       if (ret <= 0)
+                               return null;
+                       try {
+                               return new UTF8Encoding ().GetString ((byte*)data, ret);
+                       } finally {
+                               if (data != IntPtr.Zero)
+                                       FreeDataPtr (data);
+                       }
+               }
+
+               public static unsafe MonoBtlsX509Name CreateFromData (byte[] data, bool use_canon_enc)
+               {
+                       fixed (void *ptr = data) {
+                               var handle = mono_btls_x509_name_from_data (ptr, data.Length, use_canon_enc ? 1 : 0);
+                               if (handle == IntPtr.Zero)
+                                       throw new MonoBtlsException ("mono_btls_x509_name_from_data() failed.");
+                               return new MonoBtlsX509Name (new BoringX509NameHandle (handle, false));
+                       }
+               }
+       }
+}
+#endif
diff --git a/mcs/class/System/Mono.Btls/MonoBtlsX509NameEntryType.cs b/mcs/class/System/Mono.Btls/MonoBtlsX509NameEntryType.cs
new file mode 100644 (file)
index 0000000..1a4cdae
--- /dev/null
@@ -0,0 +1,51 @@
+//
+// MonoBtlsX509NameEntryType.cs
+//
+// Author:
+//       Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
+//
+// 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.
+#if SECURITY_DEP && MONO_FEATURE_BTLS
+using System;
+namespace Mono.Btls
+{
+       enum MonoBtlsX509NameEntryType : int
+       {
+               Unknown = 0,
+               CountryName,
+               OrganizationName,
+               OrganizationalUnitName,
+               CommonName,
+               LocalityName,
+               StateOrProvinceName,
+               StreetAddress,
+               SerialNumber,
+               DomainComponent,
+               UserId,
+               Email,
+               DnQualifier,
+               Title,
+               Surname,
+               GivenName,
+               Initial
+       }
+}
+#endif
diff --git a/mcs/class/System/Mono.Btls/MonoBtlsX509Purpose.cs b/mcs/class/System/Mono.Btls/MonoBtlsX509Purpose.cs
new file mode 100644 (file)
index 0000000..b8b4163
--- /dev/null
@@ -0,0 +1,43 @@
+//
+// MonoBtlsX509Purpose.cs
+//
+// Author:
+//       Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
+//
+// 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.
+#if SECURITY_DEP && MONO_FEATURE_BTLS
+using System;
+namespace Mono.Btls
+{
+       enum MonoBtlsX509Purpose
+       {
+               SSL_CLIENT = 1,
+               SSL_SERVER = 2,
+               NS_SSL_SERVER = 3,
+               SMIME_SIGN = 4,
+               SMIME_ENCRYPT = 5,
+               CRL_SIGN = 6,
+               ANY = 7,
+               OCSP_HELPER = 8,
+               TIMESTAMP_SIGN = 9,
+       }
+}
+#endif
diff --git a/mcs/class/System/Mono.Btls/MonoBtlsX509Revoked.cs b/mcs/class/System/Mono.Btls/MonoBtlsX509Revoked.cs
new file mode 100644 (file)
index 0000000..1bb279a
--- /dev/null
@@ -0,0 +1,120 @@
+//
+// MonoBtlsX509Revoked.cs
+//
+// Author:
+//       Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
+//
+// 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.
+#if SECURITY_DEP && MONO_FEATURE_BTLS
+using System;
+using System.IO;
+using System.Text;
+using System.Threading;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Security.Cryptography.X509Certificates;
+using System.Security.Cryptography;
+
+namespace Mono.Btls
+{
+       class MonoBtlsX509Revoked : MonoBtlsObject
+       {
+               internal class BoringX509RevokedHandle : MonoBtlsHandle
+               {
+                       public BoringX509RevokedHandle (IntPtr handle)
+                               : base (handle, true)
+                       {
+                       }
+
+                       protected override bool ReleaseHandle ()
+                       {
+                               if (handle != IntPtr.Zero)
+                                       mono_btls_x509_revoked_free (handle);
+                               return true;
+                       }
+
+                       public IntPtr StealHandle ()
+                       {
+                               var retval = Interlocked.Exchange (ref handle, IntPtr.Zero);
+                               return retval;
+                       }
+               }
+
+               new internal BoringX509RevokedHandle Handle {
+                       get { return (BoringX509RevokedHandle)base.Handle; }
+               }
+
+               internal MonoBtlsX509Revoked (BoringX509RevokedHandle handle)
+                       : base (handle)
+               {
+               }
+
+               [DllImport (BTLS_DYLIB)]
+               extern static int mono_btls_x509_revoked_get_serial_number (IntPtr handle, IntPtr data, int size);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static long mono_btls_x509_revoked_get_revocation_date (IntPtr handle);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static int mono_btls_x509_revoked_get_reason (IntPtr handle);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static int mono_btls_x509_revoked_get_sequence (IntPtr handle);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static void mono_btls_x509_revoked_free (IntPtr handle);
+
+               public byte[] GetSerialNumber ()
+               {
+                       int size = 256;
+                       IntPtr data = Marshal.AllocHGlobal (size);
+                       try {
+                               var ret = mono_btls_x509_revoked_get_serial_number (
+                                       Handle.DangerousGetHandle (), data, size);
+                               CheckError (ret > 0);
+                               var buffer = new byte[ret];
+                               Marshal.Copy (data, buffer, 0, ret);
+                               return buffer;
+                       } finally {
+                               if (data != IntPtr.Zero)
+                                       Marshal.FreeHGlobal (data);
+                       }
+               }
+
+               public DateTime GetRevocationDate ()
+               {
+                       var ticks = mono_btls_x509_revoked_get_revocation_date (
+                               Handle.DangerousGetHandle ());
+                       return new DateTime (1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds (ticks);
+               }
+
+               public int GetReason ()
+               {
+                       return mono_btls_x509_revoked_get_reason (Handle.DangerousGetHandle ());
+               }
+
+               public int GetSequence ()
+               {
+                       return mono_btls_x509_revoked_get_sequence (Handle.DangerousGetHandle ());
+               }
+       }
+}
+#endif
diff --git a/mcs/class/System/Mono.Btls/MonoBtlsX509Store.cs b/mcs/class/System/Mono.Btls/MonoBtlsX509Store.cs
new file mode 100644 (file)
index 0000000..5379935
--- /dev/null
@@ -0,0 +1,230 @@
+//
+// MonoBtlsX509Store.cs
+//
+// Author:
+//       Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
+//
+// 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.
+#if SECURITY_DEP && MONO_FEATURE_BTLS
+using System;
+using System.IO;
+using System.Collections.Generic;
+using System.Runtime.InteropServices;
+using System.Runtime.CompilerServices;
+using System.Security.Cryptography.X509Certificates;
+
+namespace Mono.Btls
+{
+       class MonoBtlsX509Store : MonoBtlsObject
+       {
+               internal class BoringX509StoreHandle : MonoBtlsHandle
+               {
+                       public BoringX509StoreHandle (IntPtr handle)
+                               : base (handle, true)
+                       {
+                       }
+
+                       protected override bool ReleaseHandle ()
+                       {
+                               mono_btls_x509_store_free (handle);
+                               return true;
+                       }
+               }
+
+               new internal BoringX509StoreHandle Handle {
+                       get { return (BoringX509StoreHandle)base.Handle; }
+               }
+
+               [DllImport (BTLS_DYLIB)]
+               extern static IntPtr mono_btls_x509_store_new ();
+
+               [DllImport (BTLS_DYLIB)]
+               extern static IntPtr mono_btls_x509_store_from_ctx (IntPtr ctx);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static IntPtr mono_btls_x509_store_from_ssl_ctx (IntPtr handle);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static int mono_btls_x509_store_load_locations (IntPtr handle, IntPtr file, IntPtr path);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static int mono_btls_x509_store_set_default_paths (IntPtr handle);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static int mono_btls_x509_store_add_cert (IntPtr handle, IntPtr x509);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static int mono_btls_x509_store_get_count (IntPtr handle);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static void mono_btls_x509_store_free (IntPtr handle);
+
+               Dictionary<IntPtr,MonoBtlsX509Lookup> lookupHash;
+
+               public void LoadLocations (string file, string path)
+               {
+                       IntPtr filePtr = IntPtr.Zero;
+                       IntPtr pathPtr = IntPtr.Zero;
+                       try {
+                               if (file != null)
+                                       filePtr = Marshal.StringToHGlobalAnsi (file);
+                               if (path != null)
+                                       pathPtr = Marshal.StringToHGlobalAnsi (path);
+                               var ret = mono_btls_x509_store_load_locations (
+                                       Handle.DangerousGetHandle (), filePtr, pathPtr);
+                               CheckError (ret);
+                       } finally {
+                               if (filePtr != IntPtr.Zero)
+                                       Marshal.FreeHGlobal (filePtr);
+                               if (pathPtr != IntPtr.Zero)
+                                       Marshal.FreeHGlobal (pathPtr);
+                       }
+               }
+
+               public void SetDefaultPaths ()
+               {
+                       var ret = mono_btls_x509_store_set_default_paths (Handle.DangerousGetHandle ());
+                       CheckError (ret);
+               }
+
+               static BoringX509StoreHandle Create_internal ()
+               {
+                       var handle = mono_btls_x509_store_new ();
+                       if (handle == IntPtr.Zero)
+                               throw new MonoBtlsException ();
+                       return new BoringX509StoreHandle (handle);
+               }
+
+               static BoringX509StoreHandle Create_internal (IntPtr store_ctx)
+               {
+                       var handle = mono_btls_x509_store_from_ssl_ctx (store_ctx);
+                       if (handle == IntPtr.Zero)
+                               throw new MonoBtlsException ();
+                       return new BoringX509StoreHandle (handle);
+               }
+
+               static BoringX509StoreHandle Create_internal (MonoBtlsSslCtx.BoringSslCtxHandle ctx)
+               {
+                       var handle = mono_btls_x509_store_from_ssl_ctx (ctx.DangerousGetHandle ());
+                       if (handle == IntPtr.Zero)
+                               throw new MonoBtlsException ();
+                       return new BoringX509StoreHandle (handle);
+               }
+
+               internal MonoBtlsX509Store ()
+                       : base (Create_internal ())
+               {
+               }
+
+               internal MonoBtlsX509Store (IntPtr store_ctx)
+                       : base (Create_internal (store_ctx))
+               {
+               }
+
+               internal MonoBtlsX509Store (MonoBtlsSslCtx.BoringSslCtxHandle ctx)
+                       : base (Create_internal (ctx))
+               {
+               }
+
+               public void AddCertificate (MonoBtlsX509 x509)
+               {
+                       var ret = mono_btls_x509_store_add_cert (
+                               Handle.DangerousGetHandle (),
+                               x509.Handle.DangerousGetHandle ());
+                       CheckError (ret);
+               }
+
+               public int GetCount ()
+               {
+                       return mono_btls_x509_store_get_count (Handle.DangerousGetHandle ());
+               }
+
+               internal void AddTrustedRoots ()
+               {
+                       var systemRoot = MonoBtlsProvider.GetSystemStoreLocation ();
+                       LoadLocations (null, systemRoot);
+               }
+
+               public MonoBtlsX509Lookup AddLookup (MonoBtlsX509LookupType type)
+               {
+                       if (lookupHash == null)
+                               lookupHash = new Dictionary<IntPtr,MonoBtlsX509Lookup> ();
+
+                       /*
+                        * X509_STORE_add_lookup() returns the same 'X509_LOOKUP *' for each
+                        * unique 'X509_LOOKUP_METHOD *' (which is supposed to be a static struct)
+                        * and we want to use the same managed object for each unique 'X509_LOOKUP *'.
+                       */
+                       var lookup = new MonoBtlsX509Lookup (this, type);
+                       var nativeLookup = lookup.GetNativeLookup ();
+                       if (lookupHash.ContainsKey (nativeLookup)) {
+                               lookup.Dispose ();
+                               lookup = lookupHash [nativeLookup];
+                       } else {
+                               lookupHash.Add (nativeLookup, lookup);
+                       }
+
+                       return lookup;
+               }
+
+               public void AddDirectoryLookup (string dir, MonoBtlsX509FileType type)
+               {
+                       var lookup = AddLookup (MonoBtlsX509LookupType.HASH_DIR);
+                       lookup.AddDirectory (dir, type);
+               }
+
+               public void AddFileLookup (string file, MonoBtlsX509FileType type)
+               {
+                       var lookup = AddLookup (MonoBtlsX509LookupType.FILE);
+                       lookup.LoadFile (file, type);
+               }
+
+               public void AddCollection (X509CertificateCollection collection, MonoBtlsX509TrustKind trust)
+               {
+                       var monoLookup = new MonoBtlsX509LookupMonoCollection (collection, trust);
+                       var lookup = new MonoBtlsX509Lookup (this, MonoBtlsX509LookupType.MONO);
+                       lookup.AddMono (monoLookup);
+               }
+
+#if MONODROID
+               public void AddAndroidLookup ()
+               {
+                       var androidLookup = new MonoBtlsX509LookupAndroid ();
+                       var lookup = new MonoBtlsX509Lookup (this, MonoBtlsX509LookupType.MONO);
+                       lookup.AddMono (androidLookup);
+               }
+#endif
+
+               protected override void Close ()
+               {
+                       try {
+                               if (lookupHash != null) {
+                                       foreach (var lookup in lookupHash.Values)
+                                               lookup.Dispose ();
+                                       lookupHash = null;
+                               }
+                       } finally {
+                               base.Close ();
+                       }
+               }
+       }
+}
+#endif
diff --git a/mcs/class/System/Mono.Btls/MonoBtlsX509StoreCtx.cs b/mcs/class/System/Mono.Btls/MonoBtlsX509StoreCtx.cs
new file mode 100644 (file)
index 0000000..9b8e82b
--- /dev/null
@@ -0,0 +1,244 @@
+//
+// MonoBtlsX509StoreCtx.cs
+//
+// Author:
+//       Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
+//
+// 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.
+#if SECURITY_DEP && MONO_FEATURE_BTLS
+using System;
+using System.IO;
+using System.Runtime.InteropServices;
+using System.Runtime.CompilerServices;
+
+namespace Mono.Btls
+{
+       class MonoBtlsX509StoreCtx : MonoBtlsObject
+       {
+               internal class BoringX509StoreCtxHandle : MonoBtlsHandle
+               {
+                       bool dontFree;
+
+                       internal BoringX509StoreCtxHandle (IntPtr handle, bool ownsHandle = true)
+                               : base (handle, ownsHandle)
+                       {
+                               dontFree = !ownsHandle;
+                       }
+
+                       #if FIXME
+                       internal BoringX509StoreCtxHandle (IntPtr handle)
+                               : base ()
+                       {
+                               base.handle = handle;
+                               this.dontFree = true;
+                       }
+                       #endif
+
+                       protected override bool ReleaseHandle ()
+                       {
+                               if (!dontFree)
+                                       mono_btls_x509_store_ctx_free (handle);
+                               return true;
+                       }
+               }
+
+               int? verifyResult;
+
+               new internal BoringX509StoreCtxHandle Handle {
+                       get { return (BoringX509StoreCtxHandle)base.Handle; }
+               }
+
+               [DllImport (BTLS_DYLIB)]
+               extern static IntPtr mono_btls_x509_store_ctx_new ();
+
+               [DllImport (BTLS_DYLIB)]
+               extern static IntPtr mono_btls_x509_store_ctx_from_ptr (IntPtr ctx);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static MonoBtlsX509Error mono_btls_x509_store_ctx_get_error (IntPtr handle, out IntPtr error_string);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static int mono_btls_x509_store_ctx_get_error_depth (IntPtr handle);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static IntPtr mono_btls_x509_store_ctx_get_chain (IntPtr handle);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static int mono_btls_x509_store_ctx_init (IntPtr handle, IntPtr store, IntPtr chain);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static int mono_btls_x509_store_ctx_set_param (IntPtr handle, IntPtr param);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static int mono_btls_x509_store_ctx_verify_cert (IntPtr handle);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static IntPtr mono_btls_x509_store_ctx_get_by_subject (IntPtr handle, IntPtr name);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static IntPtr mono_btls_x509_store_ctx_get_current_cert (IntPtr handle);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static IntPtr mono_btls_x509_store_ctx_get_current_issuer (IntPtr handle);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static IntPtr mono_btls_x509_store_ctx_get_verify_param (IntPtr handle);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static IntPtr mono_btls_x509_store_ctx_get_untrusted (IntPtr handle);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static IntPtr mono_btls_x509_store_ctx_up_ref (IntPtr handle);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static void mono_btls_x509_store_ctx_free (IntPtr handle);
+
+               internal MonoBtlsX509StoreCtx ()
+                       : base (new BoringX509StoreCtxHandle (mono_btls_x509_store_ctx_new ()))
+               {
+               }
+
+               static BoringX509StoreCtxHandle Create_internal (IntPtr store_ctx)
+               {
+                       var handle = mono_btls_x509_store_ctx_from_ptr (store_ctx);
+                       if (handle == IntPtr.Zero)
+                               throw new MonoBtlsException ();
+                       return new BoringX509StoreCtxHandle (handle);
+               }
+
+               internal MonoBtlsX509StoreCtx (int preverify_ok, IntPtr store_ctx)
+                       : base (Create_internal (store_ctx))
+               {
+                       verifyResult = preverify_ok;
+               }
+
+               internal MonoBtlsX509StoreCtx (BoringX509StoreCtxHandle ptr, int? verifyResult)
+                       : base (ptr)
+               {
+                       this.verifyResult = verifyResult;
+               }
+
+               public MonoBtlsX509Error GetError ()
+               {
+                       IntPtr error_string_ptr;
+                       return mono_btls_x509_store_ctx_get_error (Handle.DangerousGetHandle (), out error_string_ptr);
+               }
+
+               public MonoBtlsX509Exception GetException ()
+               {
+                       IntPtr error_string_ptr;
+                       var error = mono_btls_x509_store_ctx_get_error (Handle.DangerousGetHandle (), out error_string_ptr);
+                       if (error == 0)
+                               return null;
+                       if (error_string_ptr != IntPtr.Zero) {
+                               var error_string = Marshal.PtrToStringAnsi (error_string_ptr);
+                               return new MonoBtlsX509Exception (error, error_string);
+                       }
+                       return new MonoBtlsX509Exception (error, "Unknown verify error.");
+               }
+
+               public MonoBtlsX509Chain GetChain ()
+               {
+                       var chain = mono_btls_x509_store_ctx_get_chain (Handle.DangerousGetHandle ());
+                       CheckError (chain != IntPtr.Zero);
+                       return new MonoBtlsX509Chain (new MonoBtlsX509Chain.BoringX509ChainHandle (chain));
+               }
+
+               public MonoBtlsX509Chain GetUntrusted ()
+               {
+                       var chain = mono_btls_x509_store_ctx_get_untrusted (Handle.DangerousGetHandle ());
+                       CheckError (chain != IntPtr.Zero);
+                       return new MonoBtlsX509Chain (new MonoBtlsX509Chain.BoringX509ChainHandle (chain));
+               }
+
+               public void Initialize (MonoBtlsX509Store store, MonoBtlsX509Chain chain)
+               {
+                       var ret = mono_btls_x509_store_ctx_init (
+                               Handle.DangerousGetHandle (),
+                               store.Handle.DangerousGetHandle (),
+                               chain.Handle.DangerousGetHandle ());
+                       CheckError (ret);
+               }
+
+               public void SetVerifyParam (MonoBtlsX509VerifyParam param)
+               {
+                       var ret = mono_btls_x509_store_ctx_set_param (
+                               Handle.DangerousGetHandle (),
+                               param.Handle.DangerousGetHandle ());
+                       CheckError (ret);
+               }
+
+               public int VerifyResult {
+                       get {
+                               if (verifyResult == null)
+                                       throw new InvalidOperationException ();
+                               return verifyResult.Value;
+                       }
+               }
+
+               public int Verify ()
+               {
+                       verifyResult = mono_btls_x509_store_ctx_verify_cert (Handle.DangerousGetHandle ());
+                       return verifyResult.Value;
+               }
+
+               public MonoBtlsX509 LookupBySubject (MonoBtlsX509Name name)
+               {
+                       var handle = mono_btls_x509_store_ctx_get_by_subject (
+                               Handle.DangerousGetHandle (), name.Handle.DangerousGetHandle ());
+                       if (handle == IntPtr.Zero)
+                               return null;
+                       return new MonoBtlsX509 (new MonoBtlsX509.BoringX509Handle (handle));
+               }
+
+               public MonoBtlsX509 GetCurrentCertificate ()
+               {
+                       var x509 = mono_btls_x509_store_ctx_get_current_cert (Handle.DangerousGetHandle ());
+                       if (x509 == IntPtr.Zero)
+                               return null;
+                       return new MonoBtlsX509 (new MonoBtlsX509.BoringX509Handle (x509));
+               }
+
+               public MonoBtlsX509 GetCurrentIssuer ()
+               {
+                       var x509 = mono_btls_x509_store_ctx_get_current_issuer (Handle.DangerousGetHandle ());
+                       if (x509 == IntPtr.Zero)
+                               return null;
+                       return new MonoBtlsX509 (new MonoBtlsX509.BoringX509Handle (x509));
+               }
+
+               public MonoBtlsX509VerifyParam GetVerifyParam ()
+               {
+                       var param = mono_btls_x509_store_ctx_get_verify_param (Handle.DangerousGetHandle ());
+                       if (param == IntPtr.Zero)
+                               return null;
+                       return new MonoBtlsX509VerifyParam (new MonoBtlsX509VerifyParam.BoringX509VerifyParamHandle (param));
+               }
+
+               public MonoBtlsX509StoreCtx Copy ()
+               {
+                       var copy = mono_btls_x509_store_ctx_up_ref (Handle.DangerousGetHandle ());
+                       CheckError (copy != IntPtr.Zero);
+                       return new MonoBtlsX509StoreCtx (new BoringX509StoreCtxHandle (copy), verifyResult);
+               }
+       }
+}
+#endif
diff --git a/mcs/class/System/Mono.Btls/MonoBtlsX509StoreManager.cs b/mcs/class/System/Mono.Btls/MonoBtlsX509StoreManager.cs
new file mode 100644 (file)
index 0000000..42fbdf7
--- /dev/null
@@ -0,0 +1,122 @@
+//
+// MonoBtlsX509StoreManager.cs
+//
+// Author:
+//       Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
+//
+// 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.
+#if SECURITY_DEP && MONO_FEATURE_BTLS
+#if MONO_SECURITY_ALIAS
+extern alias MonoSecurity;
+#endif
+
+using System;
+using System.IO;
+using System.Security.Cryptography.X509Certificates;
+
+#if MONO_SECURITY_ALIAS
+using MonoSecurity::Mono.Security.Interface;
+using MX = MonoSecurity::Mono.Security.X509;
+#else
+using Mono.Security.Interface;
+using MX = Mono.Security.X509;
+#endif
+
+namespace Mono.Btls
+{
+       static class MonoBtlsX509StoreManager
+       {
+               static bool initialized;
+#if !ANDROID
+               static string machineTrustedRootPath;
+               static string machineIntermediateCAPath;
+               static string machineUntrustedPath;
+               static string userTrustedRootPath;
+               static string userIntermediateCAPath;
+               static string userUntrustedPath;
+#endif
+
+               static void Initialize ()
+               {
+                       if (initialized)
+                               return;
+
+                       try {
+                               DoInitialize ();
+                       } catch (Exception ex) {
+                               Console.Error.WriteLine ("MonoBtlsX509StoreManager.Initialize() threw exception: {0}", ex);
+                       } finally {
+                               initialized = true;
+                       }
+               }
+
+               static void DoInitialize ()
+               {
+#if !ANDROID
+                       var userPath = MX.X509StoreManager.NewCurrentUserPath;
+                       userTrustedRootPath = Path.Combine (userPath, MX.X509Stores.Names.TrustedRoot);
+                       userIntermediateCAPath = Path.Combine (userPath, MX.X509Stores.Names.IntermediateCA);
+                       userUntrustedPath = Path.Combine (userPath, MX.X509Stores.Names.Untrusted);
+
+                       var machinePath = MX.X509StoreManager.NewLocalMachinePath;
+                       machineTrustedRootPath = Path.Combine (userPath, MX.X509Stores.Names.TrustedRoot);
+                       machineIntermediateCAPath = Path.Combine (userPath, MX.X509Stores.Names.IntermediateCA);
+                       machineUntrustedPath = Path.Combine (userPath, MX.X509Stores.Names.Untrusted);
+#endif
+               }
+
+               public static bool HasStore (MonoBtlsX509StoreType type)
+               {
+#if ANDROID
+                       return false;
+#else
+                       var path = GetStorePath (type);
+                       return path != null && Directory.Exists (path);
+#endif
+               }
+
+               public static string GetStorePath (MonoBtlsX509StoreType type)
+               {
+#if ANDROID
+                       throw new NotSupportedException ();
+#else
+                       Initialize ();
+                       switch (type) {
+                       case MonoBtlsX509StoreType.MachineTrustedRoots:
+                               return machineTrustedRootPath;
+                       case MonoBtlsX509StoreType.MachineIntermediateCA:
+                               return machineIntermediateCAPath;
+                       case MonoBtlsX509StoreType.MachineUntrusted:
+                               return machineUntrustedPath;
+                       case MonoBtlsX509StoreType.UserTrustedRoots:
+                               return userTrustedRootPath;
+                       case MonoBtlsX509StoreType.UserIntermediateCA:
+                               return userIntermediateCAPath;
+                       case MonoBtlsX509StoreType.UserUntrusted:
+                               return userUntrustedPath;
+                       default:
+                               throw new NotSupportedException ();
+                       }
+#endif
+               }
+       }
+}
+#endif
diff --git a/mcs/class/System/Mono.Btls/MonoBtlsX509StoreType.cs b/mcs/class/System/Mono.Btls/MonoBtlsX509StoreType.cs
new file mode 100644 (file)
index 0000000..b4ac593
--- /dev/null
@@ -0,0 +1,40 @@
+//
+// MonoBtlsX509StoreType.cs
+//
+// Author:
+//       Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
+//
+// 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.
+#if SECURITY_DEP && MONO_FEATURE_BTLS
+namespace Mono.Btls
+{
+       enum MonoBtlsX509StoreType
+       {
+               Custom,
+               MachineTrustedRoots,
+               MachineIntermediateCA,
+               MachineUntrusted,
+               UserTrustedRoots,
+               UserIntermediateCA,
+               UserUntrusted
+       }
+}
+#endif
diff --git a/mcs/class/System/Mono.Btls/MonoBtlsX509TrustKind.cs b/mcs/class/System/Mono.Btls/MonoBtlsX509TrustKind.cs
new file mode 100644 (file)
index 0000000..4d85588
--- /dev/null
@@ -0,0 +1,42 @@
+//
+// MonoBtlsX509TrustKind.cs
+//
+// Author:
+//       Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
+//
+// 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.
+#if SECURITY_DEP && MONO_FEATURE_BTLS
+using System;
+namespace Mono.Btls
+{
+       [Flags]
+       enum MonoBtlsX509TrustKind
+       {
+               DEFAULT         = 0,
+               TRUST_CLIENT    = 1,
+               TRUST_SERVER    = 2,
+               TRUST_ALL       = 4,
+               REJECT_CLIENT   = 32,
+               REJECT_SERVER   = 64,
+               REJECT_ALL      = 128
+       }
+}
+#endif
diff --git a/mcs/class/System/Mono.Btls/MonoBtlsX509VerifyFlags.cs b/mcs/class/System/Mono.Btls/MonoBtlsX509VerifyFlags.cs
new file mode 100644 (file)
index 0000000..493fc9b
--- /dev/null
@@ -0,0 +1,39 @@
+//
+// MonoBtlsX509VerifyFlags.cs
+//
+// Author:
+//       Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
+//
+// 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.
+#if SECURITY_DEP && MONO_FEATURE_BTLS
+using System;
+namespace Mono.Btls
+{
+       [Flags]
+       enum MonoBtlsX509VerifyFlags
+       {
+               DEFAULT         = 0,
+               CRL_CHECK       = 1,
+               CRL_CHECK_ALL   = 2,
+               X509_STRIC      = 4
+       }
+}
+#endif
diff --git a/mcs/class/System/Mono.Btls/MonoBtlsX509VerifyParam.cs b/mcs/class/System/Mono.Btls/MonoBtlsX509VerifyParam.cs
new file mode 100644 (file)
index 0000000..9029722
--- /dev/null
@@ -0,0 +1,277 @@
+//
+// MonoBtlsX509VerifyParam.cs
+//
+// Author:
+//       Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
+//
+// 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.
+#if SECURITY_DEP && MONO_FEATURE_BTLS
+using System;
+using System.IO;
+using System.Runtime.InteropServices;
+using System.Runtime.CompilerServices;
+
+namespace Mono.Btls
+{
+       class MonoBtlsX509VerifyParam : MonoBtlsObject
+       {
+               internal class BoringX509VerifyParamHandle : MonoBtlsHandle
+               {
+                       public BoringX509VerifyParamHandle (IntPtr handle)
+                               : base (handle, true)
+                       {
+                       }
+
+                       protected override bool ReleaseHandle ()
+                       {
+                               mono_btls_x509_verify_param_free (handle);
+                               return true;
+                       }
+               }
+
+               new internal BoringX509VerifyParamHandle Handle {
+                       get { return (BoringX509VerifyParamHandle)base.Handle; }
+               }
+
+               [DllImport (BTLS_DYLIB)]
+               extern static IntPtr mono_btls_x509_verify_param_new ();
+
+               [DllImport (BTLS_DYLIB)]
+               extern static IntPtr mono_btls_x509_verify_param_copy (IntPtr handle);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static IntPtr mono_btls_x509_verify_param_lookup (IntPtr name);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static int mono_btls_x509_verify_param_can_modify (IntPtr param);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static int mono_btls_x509_verify_param_set_name (IntPtr handle, IntPtr name);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static int mono_btls_x509_verify_param_set_host (IntPtr handle, IntPtr name, int namelen);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static int mono_btls_x509_verify_param_add_host (IntPtr handle, IntPtr name, int namelen);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static ulong mono_btls_x509_verify_param_get_flags (IntPtr handle);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static int mono_btls_x509_verify_param_set_flags (IntPtr handle, ulong flags);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static MonoBtlsX509VerifyFlags mono_btls_x509_verify_param_get_mono_flags (IntPtr handle);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static int mono_btls_x509_verify_param_set_mono_flags (IntPtr handle, MonoBtlsX509VerifyFlags flags);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static int mono_btls_x509_verify_param_set_purpose (IntPtr handle, MonoBtlsX509Purpose purpose);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static int mono_btls_x509_verify_param_get_depth (IntPtr handle);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static int mono_btls_x509_verify_param_set_depth (IntPtr handle, int depth);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static int mono_btls_x509_verify_param_set_time (IntPtr handle, long time);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static IntPtr mono_btls_x509_verify_param_get_peername (IntPtr handle);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static void mono_btls_x509_verify_param_free (IntPtr handle);
+
+               internal MonoBtlsX509VerifyParam ()
+                       : base (new BoringX509VerifyParamHandle (mono_btls_x509_verify_param_new ()))
+               {
+               }
+
+               internal MonoBtlsX509VerifyParam (BoringX509VerifyParamHandle handle)
+                       : base (handle)
+               {
+               }
+
+               public MonoBtlsX509VerifyParam Copy ()
+               {
+                       var copy = mono_btls_x509_verify_param_copy (Handle.DangerousGetHandle ());
+                       CheckError (copy != IntPtr.Zero);
+                       return new MonoBtlsX509VerifyParam (new BoringX509VerifyParamHandle (copy));
+               }
+
+               public static MonoBtlsX509VerifyParam GetSslClient ()
+               {
+                       return Lookup ("ssl_client", true);
+               }
+
+               public static MonoBtlsX509VerifyParam GetSslServer ()
+               {
+                       return Lookup ("ssl_server", true);
+               }
+
+               public static MonoBtlsX509VerifyParam Lookup (string name, bool fail = false)
+               {
+                       IntPtr namePtr = IntPtr.Zero;
+                       IntPtr handle = IntPtr.Zero;
+
+                       try {
+                               namePtr = Marshal.StringToHGlobalAnsi (name);
+                               handle = mono_btls_x509_verify_param_lookup (namePtr);
+                               if (handle == IntPtr.Zero) {
+                                       if (!fail)
+                                               return null;
+                                       throw new MonoBtlsException ("X509_VERIFY_PARAM_lookup() could not find '{0}'.", name);
+                               }
+
+                               return new MonoBtlsX509VerifyParam (new BoringX509VerifyParamHandle (handle));
+                       } finally {
+                               if (namePtr != IntPtr.Zero)
+                                       Marshal.FreeHGlobal (namePtr);
+                       }
+               }
+
+               public bool CanModify {
+                       get {
+                               return mono_btls_x509_verify_param_can_modify (Handle.DangerousGetHandle ()) != 0;
+                       }
+               }
+
+               void WantToModify ()
+               {
+                       if (!CanModify)
+                               throw new MonoBtlsException ("Attempting to modify read-only MonoBtlsX509VerifyParam instance.");
+               }
+
+               public void SetName (string name)
+               {
+                       WantToModify ();
+                       IntPtr namePtr = IntPtr.Zero;
+                       try {
+                               namePtr = Marshal.StringToHGlobalAnsi (name);
+                               var ret = mono_btls_x509_verify_param_set_name (
+                                       Handle.DangerousGetHandle (), namePtr);
+                               CheckError (ret);
+                       } finally {
+                               if (namePtr != IntPtr.Zero)
+                                       Marshal.FreeHGlobal (namePtr);
+                       }
+               }
+
+               public void SetHost (string name)
+               {
+                       WantToModify ();
+                       IntPtr namePtr = IntPtr.Zero;
+                       try {
+                               namePtr = Marshal.StringToHGlobalAnsi (name);
+                               var ret = mono_btls_x509_verify_param_set_host (
+                                       Handle.DangerousGetHandle (), namePtr, name.Length);
+                               CheckError (ret);
+                       } finally {
+                               if (namePtr != IntPtr.Zero)
+                                       Marshal.FreeHGlobal (namePtr);
+                       }
+               }
+
+               public void AddHost (string name)
+               {
+                       WantToModify ();
+                       IntPtr namePtr = IntPtr.Zero;
+                       try {
+                               namePtr = Marshal.StringToHGlobalAnsi (name);
+                               var ret = mono_btls_x509_verify_param_add_host (
+                                       Handle.DangerousGetHandle (), namePtr, name.Length);
+                               CheckError (ret);
+                       } finally {
+                               if (namePtr != IntPtr.Zero)
+                                       Marshal.FreeHGlobal (namePtr);
+                       }
+               }
+
+               public ulong GetFlags ()
+               {
+                       return mono_btls_x509_verify_param_get_flags (Handle.DangerousGetHandle ());
+               }
+
+               public void SetFlags (ulong flags)
+               {
+                       WantToModify ();
+                       var ret = mono_btls_x509_verify_param_set_flags (
+                               Handle.DangerousGetHandle (), flags);
+                       CheckError (ret);
+               }
+
+               public MonoBtlsX509VerifyFlags GetMonoFlags ()
+               {
+                       return mono_btls_x509_verify_param_get_mono_flags (
+                               Handle.DangerousGetHandle ());
+               }
+
+               public void SetMonoFlags (MonoBtlsX509VerifyFlags flags)
+               {
+                       WantToModify ();
+                       var ret = mono_btls_x509_verify_param_set_mono_flags (
+                               Handle.DangerousGetHandle (), flags);
+                       CheckError (ret);
+               }
+
+               public void SetPurpose (MonoBtlsX509Purpose purpose)
+               {
+                       WantToModify ();
+                       var ret = mono_btls_x509_verify_param_set_purpose (
+                               Handle.DangerousGetHandle (), purpose);
+                       CheckError (ret);
+               }
+
+               public int GetDepth ()
+               {
+                       return mono_btls_x509_verify_param_get_depth (Handle.DangerousGetHandle ());
+               }
+
+               public void SetDepth (int depth)
+               {
+                       WantToModify ();
+                       var ret = mono_btls_x509_verify_param_set_depth (
+                               Handle.DangerousGetHandle (), depth);
+                       CheckError (ret);
+               }
+
+               public void SetTime (DateTime time)
+               {
+                       WantToModify ();
+                       var epoch = new DateTime (1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
+                       var ticks = (long)time.Subtract (epoch).TotalSeconds;
+                       var ret = mono_btls_x509_verify_param_set_time (
+                               Handle.DangerousGetHandle (), ticks);
+                       CheckError (ret);
+               }
+
+               public string GetPeerName ()
+               {
+                       var peer = mono_btls_x509_verify_param_get_peername (Handle.DangerousGetHandle ());
+                       if (peer == IntPtr.Zero)
+                               return null;
+                       return Marshal.PtrToStringAnsi (peer);
+               }
+       }
+}
+#endif
diff --git a/mcs/class/System/Mono.Btls/X509CertificateImplBtls.cs b/mcs/class/System/Mono.Btls/X509CertificateImplBtls.cs
new file mode 100644 (file)
index 0000000..f780812
--- /dev/null
@@ -0,0 +1,495 @@
+//
+// X509CertificateImplBtls.cs
+//
+// Author:
+//       Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
+//
+// 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.
+#if SECURITY_DEP && MONO_FEATURE_BTLS
+#if MONO_SECURITY_ALIAS
+extern alias MonoSecurity;
+#endif
+
+#if MONO_SECURITY_ALIAS
+using MX = MonoSecurity::Mono.Security.X509;
+#else
+using MX = Mono.Security.X509;
+#endif
+
+using System;
+using System.Text;
+using System.Collections;
+using System.Security;
+using System.Security.Cryptography;
+using System.Security.Cryptography.X509Certificates;
+using Mono.Security.Cryptography;
+
+namespace Mono.Btls
+{
+       class X509CertificateImplBtls : X509Certificate2Impl
+       {
+               MonoBtlsX509 x509;
+               MonoBtlsKey privateKey;
+               X500DistinguishedName subjectName;
+               X500DistinguishedName issuerName;
+               X509CertificateImplCollection intermediateCerts;
+               PublicKey publicKey;
+               bool archived;
+               bool disallowFallback;
+
+               internal X509CertificateImplBtls (bool disallowFallback = false)
+               {
+                       this.disallowFallback = disallowFallback;
+               }
+
+               internal X509CertificateImplBtls (MonoBtlsX509 x509, bool disallowFallback = false)
+               {
+                       this.disallowFallback = disallowFallback;
+                       this.x509 = x509.Copy ();
+               }
+
+               X509CertificateImplBtls (X509CertificateImplBtls other)
+               {
+                       disallowFallback = other.disallowFallback;
+                       x509 = other.x509 != null ? other.x509.Copy () : null;
+                       privateKey = other.privateKey != null ? other.privateKey.Copy () : null;
+                       if (other.intermediateCerts != null)
+                               intermediateCerts = other.intermediateCerts.Clone ();
+               }
+
+               internal X509CertificateImplBtls (byte[] data, MonoBtlsX509Format format, bool disallowFallback = false)
+               {
+                       this.disallowFallback = disallowFallback;
+                       x509 = MonoBtlsX509.LoadFromData (data, format);
+               }
+
+               public override bool IsValid {
+                       get { return x509 != null && x509.IsValid; }
+               }
+
+               public override IntPtr Handle {
+                       get { return x509.Handle.DangerousGetHandle (); }
+               }
+
+               public override IntPtr GetNativeAppleCertificate ()
+               {
+                       return IntPtr.Zero;
+               }
+
+               internal MonoBtlsX509 X509 {
+                       get {
+                               ThrowIfContextInvalid ();
+                               return x509;
+                       }
+               }
+
+               internal MonoBtlsKey NativePrivateKey {
+                       get {
+                               ThrowIfContextInvalid ();
+                               return privateKey;
+                       }
+               }
+
+               public override X509CertificateImpl Clone ()
+               {
+                       ThrowIfContextInvalid ();
+                       return new X509CertificateImplBtls (this);
+               }
+
+               public override bool Equals (X509CertificateImpl other, out bool result)
+               {
+                       var otherBoringImpl = other as X509CertificateImplBtls;
+                       if (otherBoringImpl == null) {
+                               result = false;
+                               return false;
+                       }
+
+                       result = MonoBtlsX509.Compare (X509, otherBoringImpl.X509) == 0;
+                       return true;
+               }
+
+               protected override byte[] GetCertHash (bool lazy)
+               {
+                       return X509.GetCertHash ();
+               }
+
+               public override byte[] GetRawCertData ()
+               {
+                       return X509.GetRawData (MonoBtlsX509Format.DER);
+               }
+
+               public override string GetSubjectName (bool legacyV1Mode)
+               {
+                       if (legacyV1Mode)
+                               return SubjectName.Decode (X500DistinguishedNameFlags.None);
+                       return SubjectName.Name;
+               }
+
+               public override string GetIssuerName (bool legacyV1Mode)
+               {
+                       if (legacyV1Mode)
+                               return IssuerName.Decode (X500DistinguishedNameFlags.None);
+                       return IssuerName.Name;
+               }
+
+               public override DateTime GetValidFrom ()
+               {
+                       return X509.GetNotBefore ().ToLocalTime ();
+               }
+
+               public override DateTime GetValidUntil ()
+               {
+                       return X509.GetNotAfter ().ToLocalTime ();
+               }
+
+               public override byte[] GetPublicKey ()
+               {
+                       return X509.GetPublicKeyData ();
+               }
+
+               public override byte[] GetSerialNumber ()
+               {
+                       return X509.GetSerialNumber (true);
+               }
+
+               public override string GetKeyAlgorithm ()
+               {
+                       return PublicKey.Oid.Value;
+               }
+
+               public override byte[] GetKeyAlgorithmParameters ()
+               {
+                       return PublicKey.EncodedParameters.RawData;
+               }
+
+               public override byte[] Export (X509ContentType contentType, byte[] password)
+               {
+                       ThrowIfContextInvalid ();
+
+                       switch (contentType) {
+                       case X509ContentType.Cert:
+                               return GetRawCertData ();
+                       case X509ContentType.Pfx: // this includes Pkcs12
+                               // TODO
+                               throw new NotSupportedException ();
+                       case X509ContentType.SerializedCert:
+                               // TODO
+                               throw new NotSupportedException ();
+                       default:
+                               string msg = Locale.GetText ("This certificate format '{0}' cannot be exported.", contentType);
+                               throw new CryptographicException (msg);
+                       }
+               }
+
+               internal override X509CertificateImplCollection IntermediateCertificates {
+                       get { return intermediateCerts; }
+               }
+
+               public override string ToString (bool full)
+               {
+                       ThrowIfContextInvalid ();
+
+                       if (!full) {
+                               var summary = GetSubjectName (false);
+                               return string.Format ("[X509Certificate: {0}]", summary);
+                       }
+
+                       string nl = Environment.NewLine;
+                       StringBuilder sb = new StringBuilder ();
+                       sb.AppendFormat ("[Subject]{0}  {1}{0}{0}", nl, GetSubjectName (false));
+
+                       sb.AppendFormat ("[Issuer]{0}  {1}{0}{0}", nl, GetIssuerName (false));
+                       sb.AppendFormat ("[Not Before]{0}  {1}{0}{0}", nl, GetValidFrom ().ToLocalTime ());
+                       sb.AppendFormat ("[Not After]{0}  {1}{0}{0}", nl, GetValidUntil ().ToLocalTime ());
+                       sb.AppendFormat ("[Thumbprint]{0}  {1}{0}", nl, X509Helper.ToHexString (GetCertHash ()));
+
+                       sb.Append (nl);
+                       return sb.ToString ();
+               }
+
+               protected override void Dispose (bool disposing)
+               {
+                       if (x509 != null) {
+                               x509.Dispose ();
+                               x509 = null;
+                       }
+               }
+
+#region X509Certificate2Impl
+
+               X509Certificate2Impl fallback;
+
+               void MustFallback ()
+               {
+                       if (disallowFallback)
+                               throw new InvalidOperationException ();
+                       if (fallback != null)
+                               return;
+                       fallback = X509Helper2.Import (GetRawCertData (), null, X509KeyStorageFlags.DefaultKeySet, true);
+               }
+
+               internal override X509Certificate2Impl FallbackImpl {
+                       get {
+                               MustFallback ();
+                               return fallback;
+                       }
+               }
+
+               [MonoTODO]
+               public override bool Archived {
+                       get {
+                               ThrowIfContextInvalid ();
+                               return archived;
+                       }
+                       set {
+                               ThrowIfContextInvalid ();
+                               archived = value;
+                       }
+               }
+
+               public override X509ExtensionCollection Extensions {
+                       get { return FallbackImpl.Extensions; }
+               }
+
+               public override bool HasPrivateKey {
+                       get { return privateKey != null; }
+               }
+
+               public override X500DistinguishedName IssuerName {
+                       get {
+                               ThrowIfContextInvalid ();
+                               if (issuerName == null) {
+                                       using (var xname = x509.GetIssuerName ()) {
+                                               var encoding = xname.GetRawData (false);
+                                               var canonEncoding = xname.GetRawData (true);
+                                               var name = MonoBtlsUtils.FormatName (xname, true, ", ", true);
+                                               issuerName = new X500DistinguishedName (encoding, canonEncoding, name);
+                                       }
+                               }
+                               return issuerName;
+                       }
+               }
+
+               public override AsymmetricAlgorithm PrivateKey {
+                       get {
+                               if (privateKey == null || !privateKey.IsRsa)
+                                       return null;
+                               var bytes = privateKey.GetBytes (true);
+                               return PKCS8.PrivateKeyInfo.DecodeRSA (bytes);
+                       }
+                       set { FallbackImpl.PrivateKey = value; }
+               }
+
+               public override PublicKey PublicKey {
+                       get {
+                               ThrowIfContextInvalid ();
+                               if (publicKey == null) {
+                                       var keyAsn = X509.GetPublicKeyAsn1 ();
+                                       var keyParamAsn = X509.GetPublicKeyParameters ();
+                                       publicKey = new PublicKey (keyAsn.Oid, keyParamAsn, keyAsn);
+                               }
+                               return publicKey;
+                       }
+               }
+
+               public override Oid SignatureAlgorithm {
+                       get {
+                               ThrowIfContextInvalid ();
+                               return X509.GetSignatureAlgorithm ();
+                       }
+               }
+
+               public override X500DistinguishedName SubjectName {
+                       get {
+                               ThrowIfContextInvalid ();
+                               if (subjectName == null) {
+                                       using (var xname = x509.GetSubjectName ()) {
+                                               var encoding = xname.GetRawData (false);
+                                               var canonEncoding = xname.GetRawData (true);
+                                               var name = MonoBtlsUtils.FormatName (xname, true, ", ", true);
+                                               subjectName = new X500DistinguishedName (encoding, canonEncoding, name);
+                                       }
+                               }
+                               return subjectName;
+                       }
+               }
+
+               public override int Version {
+                       get { return X509.GetVersion (); }
+               }
+
+               public override string GetNameInfo (X509NameType nameType, bool forIssuer)
+               {
+                       return FallbackImpl.GetNameInfo (nameType, forIssuer);
+               }
+
+               public override void Import (byte[] data, string password, X509KeyStorageFlags keyStorageFlags)
+               {
+                       if (password == null) {
+                               try {
+                                       Import (data);
+                               } catch (Exception e) {
+                                       try {
+                                                ImportPkcs12 (data, null);
+                                       } catch {
+                                               string msg = Locale.GetText ("Unable to decode certificate.");
+                                               // inner exception is the original (not second) exception
+                                               throw new CryptographicException (msg, e);
+                                       }
+                               }
+                       } else {
+                               // try PKCS#12
+                               try {
+                                       ImportPkcs12 (data, password);
+                               } catch (Exception e) {
+                                       try {
+                                               // it's possible to supply a (unrequired/unusued) password
+                                               // fix bug #79028
+                                               Import (data);
+                                       } catch {
+                                               string msg = Locale.GetText ("Unable to decode certificate.");
+                                               // inner exception is the original (not second) exception
+                                               throw new CryptographicException (msg, e);
+                                       }
+                               }
+                       }
+               }
+
+               void Import (byte[] data)
+               {
+                       // Does it look like PEM?
+                       if ((data.Length > 0) && (data [0] != 0x30))
+                               x509 = MonoBtlsX509.LoadFromData (data, MonoBtlsX509Format.PEM);
+                       else
+                               x509 = MonoBtlsX509.LoadFromData (data, MonoBtlsX509Format.DER);
+               }
+
+               void ImportPkcs12 (byte[] data, string password)
+               {
+                       using (var pkcs12 = new MonoBtlsPkcs12 ()) {
+                               if (string.IsNullOrEmpty (password)) {
+                                       try {
+                                               // Support both unencrypted PKCS#12..
+                                               pkcs12.Import (data, null);
+                                       } catch {
+                                               // ..and PKCS#12 encrypted with an empty password
+                                               pkcs12.Import (data, string.Empty);
+                                       }
+                               } else {
+                                       pkcs12.Import (data, password);
+                               }
+
+                               x509 = pkcs12.GetCertificate (0);
+                               if (pkcs12.HasPrivateKey)
+                                       privateKey = pkcs12.GetPrivateKey ();
+                               if (pkcs12.Count > 1) {
+                                       intermediateCerts = new X509CertificateImplCollection ();
+                                       for (int i = 0; i < pkcs12.Count; i++) {
+                                               using (var ic = pkcs12.GetCertificate (i)) {
+                                                       if (MonoBtlsX509.Compare (ic, x509) == 0)
+                                                               continue;
+                                                       var impl = new X509CertificateImplBtls (ic, true);
+                                                       intermediateCerts.Add (impl, true);
+                                               }
+                                       }
+                               }
+                       }
+               }
+
+               public override byte[] Export (X509ContentType contentType, string password)
+               {
+                       ThrowIfContextInvalid ();
+
+                       switch (contentType) {
+                       case X509ContentType.Cert:
+                               return GetRawCertData ();
+                       case X509ContentType.Pfx: // this includes Pkcs12
+                               return ExportPkcs12 (password);
+                       case X509ContentType.SerializedCert:
+                               // TODO
+                               throw new NotSupportedException ();
+                       default:
+                               string msg = Locale.GetText ("This certificate format '{0}' cannot be exported.", contentType);
+                               throw new CryptographicException (msg);
+                       }
+               }
+
+               byte[] ExportPkcs12 (string password)
+               {
+                       var pfx = new MX.PKCS12 ();
+                       try {
+                               var attrs = new Hashtable ();
+                               var localKeyId = new ArrayList ();
+                               localKeyId.Add (new byte[] { 1, 0, 0, 0 });
+                               attrs.Add (MX.PKCS9.localKeyId, localKeyId);
+                               if (password != null)
+                                       pfx.Password = password;
+                               pfx.AddCertificate (new MX.X509Certificate (GetRawCertData ()), attrs);
+                               if (IntermediateCertificates != null) {
+                                       for (int i = 0; i < IntermediateCertificates.Count; i++)
+                                               pfx.AddCertificate (new MX.X509Certificate (IntermediateCertificates [i].GetRawCertData ()));
+                               }
+                               var privateKey = PrivateKey;
+                               if (privateKey != null)
+                                       pfx.AddPkcs8ShroudedKeyBag (privateKey, attrs);
+                               return pfx.GetBytes ();
+                       } finally {
+                               pfx.Password = null;
+                       }
+               }
+
+               public override bool Verify (X509Certificate2 thisCertificate)
+               {
+                       using (var chain = new MonoBtlsX509Chain ()) {
+                               chain.AddCertificate (x509.Copy ());
+                               if (intermediateCerts != null) {
+                                       for (int i = 0; i < intermediateCerts.Count; i++) {
+                                               var intermediate = (X509CertificateImplBtls)intermediateCerts [i];
+                                               chain.AddCertificate (intermediate.x509.Copy ());
+                                       }
+                               }
+                               return MonoBtlsProvider.ValidateCertificate (chain, null);
+                       }
+               }
+
+               public override void Reset ()
+               {
+                       if (x509 != null) {
+                               x509.Dispose ();
+                               x509 = null;
+                       }
+                       if (privateKey != null) {
+                               privateKey = null;
+                               privateKey = null;
+                       }
+                       subjectName = null;
+                       issuerName = null;
+                       archived = false;
+                       publicKey = null;
+                       intermediateCerts = null;
+                       if (fallback != null)
+                               fallback.Reset ();
+               }
+
+#endregion
+       }
+}
+#endif
diff --git a/mcs/class/System/Mono.Btls/X509ChainImplBtls.cs b/mcs/class/System/Mono.Btls/X509ChainImplBtls.cs
new file mode 100644 (file)
index 0000000..1359668
--- /dev/null
@@ -0,0 +1,178 @@
+//
+// X509ChainImplBtls.cs
+//
+// Author:
+//       Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)
+//
+// 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.
+#if SECURITY_DEP && MONO_FEATURE_BTLS
+using System;
+using System.Text;
+using System.Security;
+using System.Security.Cryptography;
+using System.Security.Cryptography.X509Certificates;
+using MX = Mono.Security.X509;
+
+namespace Mono.Btls
+{
+       class X509ChainImplBtls : X509ChainImpl
+       {
+               MonoBtlsX509StoreCtx storeCtx;
+               MonoBtlsX509Chain chain;
+               MonoBtlsX509Chain untrustedChain;
+               X509ChainElementCollection elements;
+               X509Certificate2Collection untrusted;
+               X509Certificate2[] certificates;
+               X509ChainPolicy policy;
+
+               internal X509ChainImplBtls (MonoBtlsX509Chain chain)
+               {
+                       this.chain = chain.Copy ();
+                       policy = new X509ChainPolicy ();
+               }
+
+               internal X509ChainImplBtls (MonoBtlsX509StoreCtx storeCtx)
+               {
+                       this.storeCtx = storeCtx.Copy ();
+                       this.chain = storeCtx.GetChain ();
+
+                       policy = new X509ChainPolicy ();
+
+                       untrustedChain = storeCtx.GetUntrusted ();
+
+                       if (untrustedChain != null) {
+                               untrusted = new X509Certificate2Collection ();
+                               policy.ExtraStore = untrusted;
+                               for (int i = 0; i < untrustedChain.Count; i++) {
+                                       var cert = untrustedChain.GetCertificate (i);
+                                       using (var impl = new X509CertificateImplBtls (cert))
+                                               untrusted.Add (new X509Certificate2 (impl));
+                               }
+                       }
+               }
+
+               internal X509ChainImplBtls ()
+               {
+                       chain = new MonoBtlsX509Chain ();
+                       elements = new X509ChainElementCollection ();
+                       policy = new X509ChainPolicy ();
+               }
+
+               public override bool IsValid {
+                       get { return chain != null && chain.IsValid; }
+               }
+
+               public override IntPtr Handle {
+                       get { return chain.Handle.DangerousGetHandle (); }
+               }
+
+               internal MonoBtlsX509Chain Chain {
+                       get {
+                               ThrowIfContextInvalid ();
+                               return chain;
+                       }
+               }
+
+               internal MonoBtlsX509StoreCtx StoreCtx {
+                       get {
+                               ThrowIfContextInvalid ();
+                               return storeCtx;
+                       }
+               }
+
+               public override X509ChainElementCollection ChainElements {
+                       get {
+                               ThrowIfContextInvalid ();
+                               if (elements != null)
+                                       return elements;
+
+                               elements = new X509ChainElementCollection ();
+                               certificates = new X509Certificate2 [chain.Count];
+
+                               for (int i = 0; i < certificates.Length; i++) {
+                                       var cert = chain.GetCertificate (i);
+                                       using (var impl = new X509CertificateImplBtls (cert))
+                                               certificates [i] = new X509Certificate2 (impl);
+                                       elements.Add (certificates [i]);
+                               }
+
+                               return elements;
+                       }
+               }
+
+               public override X509ChainPolicy ChainPolicy {
+                       get { return policy; }
+                       set { policy = value; }
+               }
+
+               public override X509ChainStatus[] ChainStatus {
+                       get { throw new NotImplementedException (); }
+               }
+
+               public override bool Build (X509Certificate2 certificate)
+               {
+                       return false;
+               }
+
+               public override void Reset ()
+               {
+                       if (certificates != null) {
+                               foreach (var certificate in certificates)
+                                       certificate.Dispose ();
+                               certificates = null;
+                       }
+                       if (elements != null) {
+                               elements.Clear ();
+                               elements = null;
+                       }
+               }
+
+               protected override void Dispose (bool disposing)
+               {
+                       if (disposing) {
+                               if (chain != null) {
+                                       chain.Dispose ();
+                                       chain = null;
+                               }
+                               if (storeCtx != null) {
+                                       storeCtx.Dispose ();
+                                       storeCtx = null;
+                               }
+                               if (untrustedChain != null) {
+                                       untrustedChain.Dispose ();
+                                       untrustedChain = null;
+                               }
+                               if (untrusted != null) {
+                                       foreach (var cert in untrusted)
+                                               cert.Dispose ();
+                                       untrusted = null;
+                               }
+                               if (certificates != null) {
+                                       foreach (var cert in certificates)
+                                               cert.Dispose ();
+                                       certificates = null;
+                               }
+                       }
+                       base.Dispose (disposing);
+               }
+       }
+}
+#endif
index 7827d97600b108629470fa47c64858aabfae5d79..5f90ffe2b82241f4390b9c112c0c36c0e0abaeb9 100644 (file)
@@ -99,7 +99,8 @@ namespace Mono.Net.Security
                Complete,
                WantRead,
                WantWrite,
-               ReadDone
+               ReadDone,
+               FinishWrite
        }
 
        class AsyncProtocolRequest
@@ -160,9 +161,16 @@ namespace Mono.Net.Security
                        Debug ("ResetRead: {0} {1}", oldStatus, Status);
                }
 
+               internal void ResetWrite ()
+               {
+                       var oldStatus = (AsyncOperationStatus)Interlocked.CompareExchange (ref Status, (int)AsyncOperationStatus.Complete, (int)AsyncOperationStatus.WantWrite);
+                       Debug ("ResetWrite: {0} {1}", oldStatus, Status);
+               }
+
                internal void RequestWrite ()
                {
                        var oldStatus = (AsyncOperationStatus)Interlocked.CompareExchange (ref Status, (int)AsyncOperationStatus.WantWrite, (int)AsyncOperationStatus.Running);
+                       Debug ("RequestWrite: {0} {1}", oldStatus, Status);
                        if (oldStatus == AsyncOperationStatus.Running)
                                return;
                        else if (oldStatus != AsyncOperationStatus.WantRead && oldStatus != AsyncOperationStatus.WantWrite)
@@ -209,7 +217,19 @@ namespace Mono.Net.Security
 
                                status = ProcessOperation (status);
 
-                               var oldStatus = (AsyncOperationStatus)Interlocked.CompareExchange (ref Status, (int)status, (int)AsyncOperationStatus.Running);
+                               Debug ("ProcessOperation done: {0}", status);
+
+                               AsyncOperationStatus oldStatus;
+                               if (status == AsyncOperationStatus.Complete) {
+                                       oldStatus = (AsyncOperationStatus)Interlocked.CompareExchange (ref Status, (int)AsyncOperationStatus.FinishWrite, (int)AsyncOperationStatus.WantWrite);
+                                       if (oldStatus == AsyncOperationStatus.WantWrite) {
+                                               // We are done, but still need to flush the write queue.
+                                               status = AsyncOperationStatus.FinishWrite;
+                                               continue;
+                                       }
+                               }
+
+                               oldStatus = (AsyncOperationStatus)Interlocked.CompareExchange (ref Status, (int)status, (int)AsyncOperationStatus.Running);
                                Debug ("ProcessOperation done: {0} -> {1}", oldStatus, status);
 
                                if (oldStatus != AsyncOperationStatus.Running) {
@@ -243,7 +263,9 @@ namespace Mono.Net.Security
                                else
                                        return AsyncOperationStatus.WantRead;
                        } else if (status == AsyncOperationStatus.WantWrite) {
+                               Debug ("ProcessOperation - want write");
                                Parent.InnerWrite ();
+                               Debug ("ProcessOperation - want write done");
                                return AsyncOperationStatus.Continue;
                        } else if (status == AsyncOperationStatus.Initialize || status == AsyncOperationStatus.Continue) {
                                Debug ("ProcessOperation - continue");
@@ -255,6 +277,11 @@ namespace Mono.Net.Security
                                status = Operation (this, status);
                                Debug ("ProcessOperation - read done: {0}", status);
                                return status;
+                       } else if (status == AsyncOperationStatus.FinishWrite) {
+                               Debug ("ProcessOperation - finish write");
+                               Parent.InnerWrite ();
+                               Debug ("ProcessOperation - finish write done");
+                               return AsyncOperationStatus.Complete;
                        }
 
                        throw new InvalidOperationException ();
index 5d2812d2738e4c51c72af55564a3e3c95356e0c4..324192d6af182a898272432a394351099def6971 100644 (file)
@@ -44,8 +44,6 @@ using Mono.Security.Interface;
 using MSX = Mono.Security.X509;
 using Mono.Security.X509.Extensions;
 #endif
-using XX509CertificateCollection = System.Security.Cryptography.X509Certificates.X509CertificateCollection;
-using XX509Chain = System.Security.Cryptography.X509Certificates.X509Chain;
 
 using System;
 using System.Net;
@@ -77,7 +75,9 @@ namespace Mono.Net.Security
                readonly MonoTlsStream tlsStream;
                readonly HttpWebRequest request;
 
-               internal static ICertificateValidator GetDefaultValidator (MonoTlsProvider provider, MonoTlsSettings settings)
+#pragma warning disable 618
+
+               internal static ICertificateValidator GetInternalValidator (MonoTlsProvider provider, MonoTlsSettings settings)
                {
                        if (settings == null)
                                return new ChainValidationHelper (provider, null, false, null, null);
@@ -86,6 +86,16 @@ namespace Mono.Net.Security
                        return new ChainValidationHelper (provider, settings, false, null, null);
                }
 
+               internal static ICertificateValidator GetDefaultValidator (MonoTlsSettings settings)
+               {
+                       var provider = MonoTlsProviderFactory.GetProvider ();
+                       if (settings == null)
+                               return new ChainValidationHelper (provider, null, false, null, null);
+                       if (settings.CertificateValidator != null)
+                               throw new NotSupportedException ();
+                       return new ChainValidationHelper (provider, settings, false, null, null);
+               }
+
 #region SslStream support
 
                /*
@@ -138,6 +148,8 @@ namespace Mono.Net.Security
                                settings = MonoTlsSettings.CopyDefaultSettings ();
                        if (cloneSettings)
                                settings = settings.CloneWithValidator (this);
+                       if (provider == null)
+                               provider = MonoTlsProviderFactory.GetProvider ();
 
                        this.provider = provider;
                        this.settings = settings;
@@ -172,7 +184,9 @@ namespace Mono.Net.Security
                                certValidationCallback = ServicePointManager.ServerCertValidationCallback;
                }
 
-               static X509Certificate DefaultSelectionCallback (string targetHost, XX509CertificateCollection localCertificates, X509Certificate remoteCertificate, string[] acceptableIssuers)
+#pragma warning restore 618
+
+               static X509Certificate DefaultSelectionCallback (string targetHost, X509CertificateCollection localCertificates, X509Certificate remoteCertificate, string[] acceptableIssuers)
                {
                        X509Certificate clientCertificate;
                        if (localCertificates == null || localCertificates.Count == 0)
@@ -195,7 +209,7 @@ namespace Mono.Net.Security
                }
 
                public bool SelectClientCertificate (
-                       string targetHost, XX509CertificateCollection localCertificates, X509Certificate remoteCertificate,
+                       string targetHost, X509CertificateCollection localCertificates, X509Certificate remoteCertificate,
                        string[] acceptableIssuers, out X509Certificate clientCertificate)
                {
                        if (certSelectionCallback == null) {
@@ -207,7 +221,7 @@ namespace Mono.Net.Security
                }
 
                internal X509Certificate SelectClientCertificate (
-                       string targetHost, XX509CertificateCollection localCertificates, X509Certificate remoteCertificate,
+                       string targetHost, X509CertificateCollection localCertificates, X509Certificate remoteCertificate,
                        string[] acceptableIssuers)
                {
                        if (certSelectionCallback == null)
@@ -217,7 +231,7 @@ namespace Mono.Net.Security
 
                internal bool ValidateClientCertificate (X509Certificate certificate, MonoSslPolicyErrors errors)
                {
-                       var certs = new XX509CertificateCollection ();
+                       var certs = new X509CertificateCollection ();
                        certs.Add (new X509Certificate2 (certificate.GetRawCertData ()));
 
                        var result = ValidateChain (string.Empty, true, certificate, null, certs, (SslPolicyErrors)errors);
@@ -227,7 +241,7 @@ namespace Mono.Net.Security
                        return result.Trusted && !result.UserDenied;
                }
 
-               public ValidationResult ValidateCertificate (string host, bool serverMode, XX509CertificateCollection certs)
+               public ValidationResult ValidateCertificate (string host, bool serverMode, X509CertificateCollection certs)
                {
                        try {
                                X509Certificate leaf;
@@ -246,10 +260,9 @@ namespace Mono.Net.Security
                        }
                }
 
-               public ValidationResult ValidateCertificate (string host, bool serverMode, X509Certificate leaf, XX509Chain xchain)
+               public ValidationResult ValidateCertificate (string host, bool serverMode, X509Certificate leaf, X509Chain chain)
                {
                        try {
-                               var chain = xchain;
                                var result = ValidateChain (host, serverMode, leaf, chain, null, 0);
                                if (tlsStream != null)
                                        tlsStream.CertificateValidationFailed = result == null || !result.Trusted || result.UserDenied;
@@ -262,7 +275,7 @@ namespace Mono.Net.Security
                }
 
                ValidationResult ValidateChain (string host, bool server, X509Certificate leaf,
-                                               X509Chain chain, XX509CertificateCollection certs,
+                                               X509Chain chain, X509CertificateCollection certs,
                                                SslPolicyErrors errors)
                {
                        var oldChain = chain;
@@ -281,7 +294,7 @@ namespace Mono.Net.Security
                }
 
                ValidationResult ValidateChain (string host, bool server, X509Certificate leaf,
-                                               ref X509Chain chain, XX509CertificateCollection certs,
+                                               ref X509Chain chain, X509CertificateCollection certs,
                                                SslPolicyErrors errors)
                {
                        // user_denied is true if the user callback is called and returns false
@@ -305,6 +318,13 @@ namespace Mono.Net.Security
                                return new ValidationResult (result, user_denied, 0, (MonoSslPolicyErrors)errors);
                        }
 
+                       // Ignore port number when validating certificates.
+                       if (!string.IsNullOrEmpty (host)) {
+                               var pos = host.IndexOf (':');
+                               if (pos > 0)
+                                       host = host.Substring (0, pos);
+                       }
+
                        ICertificatePolicy policy = ServicePointManager.GetLegacyCertificatePolicy ();
 
                        int status11 = 0; // Error code passed to the obsolete ICertificatePolicy callback
@@ -315,28 +335,19 @@ namespace Mono.Net.Security
                                        wantsChain = true;
                        }
 
-                       bool providerValidated = false;
-                       if (provider != null && provider.HasCustomSystemCertificateValidator) {
-                               var xerrors = (MonoSslPolicyErrors)errors;
-                               var xchain = chain;
-                               providerValidated = provider.InvokeSystemCertificateValidator (this, host, server, certs, wantsChain, ref xchain, out result, ref xerrors, ref status11);
-                               chain = xchain;
-                               errors = (SslPolicyErrors)xerrors;
-                       } else if (wantsChain) {
-                               chain = SystemCertificateValidator.CreateX509Chain (certs);
-                       }
+                       var xerrors = (MonoSslPolicyErrors)errors;
+                       result = provider.ValidateCertificate (this, host, server, certs, wantsChain, ref chain, ref xerrors, ref status11);
+                       errors = (SslPolicyErrors)xerrors;
 
-                       if (!providerValidated)
-                               result = SystemCertificateValidator.Evaluate (settings, host, certs, chain, ref errors, ref status11);
+                       if (status11 == 0 && errors != 0) {
+                               // TRUST_E_FAIL
+                               status11 = unchecked ((int)0x800B010B);
+                       }
 
                        if (policy != null && (!(policy is DefaultCertificatePolicy) || certValidationCallback == null)) {
                                ServicePoint sp = null;
                                if (request != null)
                                        sp = request.ServicePointNoLock;
-                               if (status11 == 0 && errors != 0) {
-                                       // TRUST_E_FAIL
-                                       status11 = unchecked ((int)0x800B010B);
-                               }
 
                                // pre 2.0 callback
                                result = policy.CheckValidationResult (sp, leaf, request, status11);
@@ -353,9 +364,8 @@ namespace Mono.Net.Security
                        return new ValidationResult (result, user_denied, status11, (MonoSslPolicyErrors)errors);
                }
 
-               public bool InvokeSystemValidator (string targetHost, bool serverMode, XX509CertificateCollection certificates, XX509Chain xchain, ref MonoSslPolicyErrors xerrors, ref int status11)
+               bool InvokeSystemValidator (string targetHost, bool serverMode, X509CertificateCollection certificates, X509Chain chain, ref MonoSslPolicyErrors xerrors, ref int status11)
                {
-                       X509Chain chain = xchain;
                        var errors = (SslPolicyErrors)xerrors;
                        var result = SystemCertificateValidator.Evaluate (settings, targetHost, certificates, chain, ref errors, ref status11);
                        xerrors = (MonoSslPolicyErrors)errors;
index 50b4cd9c8c460de1aee7dd57382fe1eb0b204326..942b5065ce90cf35c4fec30c7d5371f13b73e794 100644 (file)
@@ -34,7 +34,6 @@ using MonoSecurity::Mono.Security.Interface;
 #else
 using Mono.Security.Interface;
 #endif
-using XX509CertificateCollection = System.Security.Cryptography.X509Certificates.X509CertificateCollection;
 #endif
 
 using System;
@@ -70,12 +69,6 @@ namespace Mono.Net.Security
                IMonoSslStream CreateSslStream (
                        Stream innerStream, bool leaveInnerStreamOpen,
                        MonoTlsSettings settings);
-
-               IMonoTlsContext CreateTlsContext (
-                       string hostname, bool serverMode, TlsProtocols protocolFlags,
-                       X509Certificate serverCertificate, XX509CertificateCollection clientCertificates,
-                       bool remoteCertRequired, bool checkCertName, bool checkCertRevocationStatus,
-                       MonoEncryptionPolicy encryptionPolicy, MonoTlsSettings settings);
 #endif
        }
 }
index 1a6672f6c5c36f634b575715a611d14148e86c0a..1ca30e6c96daf0e2b1a8c457dab8464d83a2141e 100644 (file)
@@ -91,7 +91,7 @@ namespace Mono.Net.Security.Private
                        : base (innerStream, leaveInnerStreamOpen)
                {
                        this.provider = provider;
-                       certificateValidator = ChainValidationHelper.GetDefaultValidator (provider, settings);
+                       certificateValidator = ChainValidationHelper.GetInternalValidator (provider, settings);
                }
                #endregion // Constructors
 
@@ -316,12 +316,14 @@ namespace Mono.Net.Security.Private
 */
                X509Certificate OnCertificateSelection (X509CertificateCollection clientCerts, X509Certificate serverCert, string targetHost, X509CertificateCollection serverRequestedCerts)
                {
+#pragma warning disable 618
                        string [] acceptableIssuers = new string [serverRequestedCerts != null ? serverRequestedCerts.Count : 0];
                        for (int i = 0; i < acceptableIssuers.Length; i++)
                                acceptableIssuers [i] = serverRequestedCerts [i].GetIssuerName ();
                        X509Certificate clientCertificate;
                        certificateValidator.SelectClientCertificate (targetHost, clientCerts, serverCert, acceptableIssuers, out clientCertificate);
                        return clientCertificate;
+#pragma warning restore 618
                }
 
                public virtual IAsyncResult BeginAuthenticateAsClient (string targetHost, AsyncCallback asyncCallback, object asyncState)
diff --git a/mcs/class/System/Mono.Net.Security/LegacyTlsProvider.cs b/mcs/class/System/Mono.Net.Security/LegacyTlsProvider.cs
new file mode 100644 (file)
index 0000000..7048f44
--- /dev/null
@@ -0,0 +1,100 @@
+//
+// LegacyTlsProvider.cs
+//
+// Author:
+//       Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2015 Xamarin, Inc.
+//
+// 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.
+#if SECURITY_DEP
+#if MONO_SECURITY_ALIAS
+extern alias MonoSecurity;
+#endif
+
+#if MONO_SECURITY_ALIAS
+using MSI = MonoSecurity::Mono.Security.Interface;
+#else
+using MSI = Mono.Security.Interface;
+#endif
+
+using System;
+using System.IO;
+using System.Net;
+using System.Net.Security;
+using System.Security.Cryptography.X509Certificates;
+using System.Security.Authentication;
+
+namespace Mono.Net.Security
+{
+       /*
+        * Strictly private - do not use outside the Mono.Net.Security directory.
+        */
+       class LegacyTlsProvider : MSI.MonoTlsProvider
+       {
+               static readonly Guid id = new Guid ("809e77d5-56cc-4da8-b9f0-45e65ba9cceb");
+
+               public override Guid ID {
+                       get { return id; }
+               }
+
+               public override string Name {
+                       get { return "legacy"; }
+               }
+
+               public override bool SupportsSslStream {
+                       get { return true; }
+               }
+
+               public override bool SupportsConnectionInfo {
+                       get { return false; }
+               }
+
+               public override bool SupportsMonoExtensions {
+                       get { return false; }
+               }
+
+               public override SslProtocols SupportedProtocols {
+                       get { return SslProtocols.Tls; }
+               }
+
+               public override MSI.IMonoSslStream CreateSslStream (
+                       Stream innerStream, bool leaveInnerStreamOpen,
+                       MSI.MonoTlsSettings settings = null)
+               {
+                       var impl = new Private.LegacySslStream (innerStream, leaveInnerStreamOpen, this, settings);
+                       return new Private.MonoSslStreamImpl (impl);
+               }
+
+               internal override bool ValidateCertificate (
+                       MSI.ICertificateValidator2 validator, string targetHost, bool serverMode,
+                       X509CertificateCollection certificates, bool wantsChain, ref X509Chain chain,
+                       ref MSI.MonoSslPolicyErrors errors, ref int status11)
+               {
+                       if (wantsChain)
+                               chain = SystemCertificateValidator.CreateX509Chain (certificates);
+                       var xerrors = (SslPolicyErrors)errors;
+                       var result = SystemCertificateValidator.Evaluate (validator.Settings, targetHost, certificates, chain, ref xerrors, ref status11);
+                       errors = (MSI.MonoSslPolicyErrors)xerrors;
+                       return result;
+               }
+       }
+}
+#endif
+
index 8701ffe92e691624893f3f2643f2d22635bae41a..cf1082618e625432d5df952fbbe10d769f8591b5 100644 (file)
@@ -660,6 +660,7 @@ namespace Mono.Net.Security
                        if (wantMore || writeBuffer.Size > 0)
                                return AsyncOperationStatus.WantWrite;
 
+                       asyncRequest.ResetWrite ();
                        asyncRequest.UserResult = asyncRequest.CurrentSize;
                        return AsyncOperationStatus.Complete;
                }
index 677a5107697810aca010c8c16aff84d06ba8229d..79f0468d4619aee415b238d9171366fe801abb8e 100644 (file)
@@ -35,6 +35,7 @@ namespace Mono.Net.Security
                MobileAuthenticatedStream parent;
                bool serverMode;
                string targetHost;
+               string serverName;
                SslProtocols enabledProtocols;
                X509Certificate serverCertificate;
                X509CertificateCollection clientCertificates;
@@ -54,7 +55,14 @@ namespace Mono.Net.Security
                        this.clientCertificates = clientCertificates;
                        this.askForClientCert = askForClientCert;
 
-                       certificateValidator = CertificateValidationHelper.GetDefaultValidator (
+                       serverName = targetHost;
+                       if (!string.IsNullOrEmpty (serverName)) {
+                               var pos = serverName.IndexOf (':');
+                               if (pos > 0)
+                                       serverName = serverName.Substring (0, pos);
+                       }
+
+                       certificateValidator = CertificateValidationHelper.GetInternalValidator (
                                parent.Settings, parent.Provider);
                }
 
@@ -92,6 +100,10 @@ namespace Mono.Net.Security
                        get { return targetHost; }
                }
 
+               protected string ServerName {
+                       get { return serverName; }
+               }
+
                protected bool AskForClientCertificate {
                        get { return askForClientCert; }
                }
@@ -159,30 +171,35 @@ namespace Mono.Net.Security
 
                public abstract void Close ();
 
-               protected ValidationResult ValidateCertificate (X509Certificate leaf, X509Chain chain)
+               protected bool ValidateCertificate (X509Certificate leaf, X509Chain chain)
+               {
+                       var result = certificateValidator.ValidateCertificate (TargetHost, IsServer, leaf, chain);
+                       return result != null && result.Trusted && !result.UserDenied;
+               }
+
+               protected bool ValidateCertificate (X509CertificateCollection certificates)
                {
-                       return certificateValidator.ValidateCertificate (
-                               targetHost, serverMode, leaf, chain);
+                       var result = certificateValidator.ValidateCertificate (TargetHost, IsServer, certificates);
+                       return result != null && result.Trusted && !result.UserDenied;
                }
 
-               protected X509Certificate SelectClientCertificate (string[] acceptableIssuers)
-                {
-                        X509Certificate certificate;
-                        var selected = certificateValidator.SelectClientCertificate (
-                               targetHost, clientCertificates, serverCertificate,
-                               null, out certificate);
-                        if (selected)
-                                return certificate;
+               protected X509Certificate SelectClientCertificate (X509Certificate serverCertificate, string[] acceptableIssuers)
+               {
+                       X509Certificate certificate;
+                       var selected = certificateValidator.SelectClientCertificate (
+                               TargetHost, ClientCertificates, serverCertificate, acceptableIssuers, out certificate);
+                       if (selected)
+                               return certificate;
 
-                        if (clientCertificates == null || clientCertificates.Count == 0)
-                                return null;
+                       if (clientCertificates == null || clientCertificates.Count == 0)
+                               return null;
 
-                        if (clientCertificates.Count == 1)
-                                return clientCertificates [0];
+                       if (clientCertificates.Count == 1)
+                               return clientCertificates [0];
 
-                        // FIXME: select one.
-                        throw new NotImplementedException ();
-                }
+                       // FIXME: select onne.
+                       throw new NotImplementedException ();
+               }
 
                public void Dispose ()
                {
diff --git a/mcs/class/System/Mono.Net.Security/MonoLegacyTlsProvider.cs b/mcs/class/System/Mono.Net.Security/MonoLegacyTlsProvider.cs
deleted file mode 100644 (file)
index 9a97195..0000000
+++ /dev/null
@@ -1,106 +0,0 @@
-//
-// MonoLegacyTlsProvider.cs
-//
-// Author:
-//       Martin Baulig <martin.baulig@xamarin.com>
-//
-// Copyright (c) 2015 Xamarin, Inc.
-//
-// 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.
-#if SECURITY_DEP
-#if MONO_SECURITY_ALIAS
-extern alias MonoSecurity;
-#endif
-
-using XHttpWebRequest = System.Net.HttpWebRequest;
-using XSslProtocols = System.Security.Authentication.SslProtocols;
-using XX509CertificateCollection = System.Security.Cryptography.X509Certificates.X509CertificateCollection;
-
-#if MONO_SECURITY_ALIAS
-using MonoSecurity::Mono.Security.Interface;
-#else
-using Mono.Security.Interface;
-#endif
-
-using System;
-using System.IO;
-using System.Net;
-using System.Net.Security;
-using System.Security.Cryptography.X509Certificates;
-
-namespace Mono.Net.Security.Private
-{
-       /*
-        * Strictly private - do not use outside the Mono.Net.Security directory.
-        */
-       class MonoLegacyTlsProvider : MonoTlsProviderImpl
-       {
-               static readonly Guid id = new Guid ("809e77d5-56cc-4da8-b9f0-45e65ba9cceb");
-
-               public override Guid ID {
-                       get { return id; }
-               }
-
-               public override string Name {
-                       get { return "legacy"; }
-               }
-
-               public MonoTlsProvider Provider {
-                       get { return this; }
-               }
-
-               public override bool SupportsSslStream {
-                       get { return true; }
-               }
-
-               public override bool SupportsConnectionInfo {
-                       get { return false; }
-               }
-
-               public override bool SupportsMonoExtensions {
-                       get { return false; }
-               }
-
-               internal override bool SupportsTlsContext {
-                       get { return false; }
-               }
-
-               public override XSslProtocols SupportedProtocols {
-                       get { return XSslProtocols.Ssl3 | XSslProtocols.Tls; }
-               }
-
-               protected override IMonoSslStream CreateSslStreamImpl (
-                       Stream innerStream, bool leaveInnerStreamOpen,
-                       MonoTlsSettings settings)
-               {
-                       return new LegacySslStream (innerStream, leaveInnerStreamOpen, this, settings);
-               }
-
-               protected override IMonoTlsContext CreateTlsContextImpl (
-                       string hostname, bool serverMode, TlsProtocols protocolFlags,
-                       X509Certificate serverCertificate, X509CertificateCollection clientCertificates,
-                       bool remoteCertRequired, MonoEncryptionPolicy encryptionPolicy,
-                       MonoTlsSettings settings)
-               {
-                       throw new NotSupportedException ();
-               }
-       }
-}
-#endif
-
index 72390bcdd11b175f47a4611393f3669cf5d21be1..f9bd47396e6328a2a272c22832a6dcb873b16423 100644 (file)
@@ -2,7 +2,7 @@
 #if SECURITY_DEP
 using System;
 using MSI = Mono.Security.Interface;
-#if HAVE_BTLS
+#if MONO_FEATURE_BTLS
 using Mono.Btls;
 #endif
 
@@ -18,14 +18,12 @@ namespace Mono.Net.Security
                        case null:
                        case "default":
                        case "legacy":
-                               return new Private.MonoLegacyTlsProvider ();
+                               return new LegacyTlsProvider ();
+#if MONO_FEATURE_BTLS
                        case "btls":
-#if HAVE_BTLS
-                               if (!MonoBtlsProvider.IsSupported ())
+                               if (!IsBtlsSupported ())
                                        throw new NotSupportedException ("BTLS in not supported!");
                                return new MonoBtlsProvider ();
-#else
-                               throw new NotSupportedException ("BTLS in not supported!");
 #endif
                        default:
                                throw new NotSupportedException (string.Format ("Invalid TLS Provider: `{0}'.", provider));
index e53b6eba4c8ee1c9e383102d0a4f548ee79ed983..071535a5c44ca31c5d8ac4fdb84d7ffdac657c3c 100644 (file)
@@ -39,6 +39,7 @@ using System.Security.Cryptography.X509Certificates;
 using System;
 using System.Net;
 using System.Collections.Generic;
+using System.Runtime.CompilerServices;
 
 #if !MOBILE
 using System.Reflection;
@@ -64,74 +65,61 @@ namespace Mono.Net.Security
 
                internal static IMonoTlsProvider GetProviderInternal ()
                {
+                       #if SECURITY_DEP
                        lock (locker) {
-                               if (currentProvider != null)
-                                       return currentProvider;
-
-                               try {
-                                       defaultProvider = GetDefaultProviderInternal ();
-                               } catch (Exception ex) {
-                                       throw new NotSupportedException ("TLS Support not available.", ex);
-                               }
-
-                               if (defaultProvider == null)
-                                       throw new NotSupportedException ("TLS Support not available.");
-
-                               currentProvider = defaultProvider;
-                               return currentProvider;
+                               InitializeInternal ();
+                               return defaultProvider;
                        }
+                       #else
+                       throw new NotSupportedException ("TLS Support not available.");
+                       #endif
                }
 
-               internal static IMonoTlsProvider GetDefaultProviderInternal ()
+#if SECURITY_DEP
+               internal static void InitializeInternal ()
                {
                        lock (locker) {
-                               if (defaultProvider != null)
-                                       return defaultProvider;
+                               if (initialized)
+                                       return;
 
+                               MSI.MonoTlsProvider provider;
                                try {
-                                       defaultProvider = CreateDefaultProvider ();
+                                       provider = CreateDefaultProviderImpl ();
                                } catch (Exception ex) {
                                        throw new NotSupportedException ("TLS Support not available.", ex);
                                }
 
-                               if (defaultProvider == null)
+                               if (provider == null)
                                        throw new NotSupportedException ("TLS Support not available.");
 
-                               return defaultProvider;
+                               defaultProvider = new Private.MonoTlsProviderWrapper (provider);
+                               initialized = true;
                        }
                }
 
-               static IMonoTlsProvider CreateDefaultProvider ()
+               internal static void InitializeInternal (string provider) 
                {
-#if SECURITY_DEP
-                       MSI.MonoTlsProvider provider = null;
-#if MONO_FEATURE_NEW_SYSTEM_SOURCE
-                       /*
-                        * This is a hack, which is used in the Mono.Security.Providers.NewSystemSource
-                        * assembly, which will provide a "fake" System.dll.  Use the public Mono.Security
-                        * API to get the "real" System.dll's provider via reflection, then wrap it with
-                        * the "fake" version's perceived view.
-                        *
-                        * NewSystemSource needs to compile MonoTlsProviderFactory.cs, IMonoTlsProvider.cs,
-                        * MonoTlsProviderWrapper.cs and CallbackHelpers.cs from this directory and only these.
-                        */
-                       provider = MSI.MonoTlsProviderFactory.GetProvider ();
-#else
-                       provider = CreateDefaultProviderImpl ();
-#endif
-                       if (provider != null)
-                               return new Private.MonoTlsProviderWrapper (provider);
-#endif
-                       return null;
+                       lock (locker) {
+                               if (initialized)
+                                       throw new NotSupportedException ("TLS Subsystem already initialized.");
+
+                               var msiProvider = LookupProvider (provider, true);
+                               defaultProvider = new Private.MonoTlsProviderWrapper (msiProvider);
+                               initialized = true;
+                       }
                }
 
+               [MethodImpl (MethodImplOptions.InternalCall)]
+               internal extern static bool IsBtlsSupported ();
+#endif
+
                static object locker = new object ();
+               static bool initialized;
                static IMonoTlsProvider defaultProvider;
-               static IMonoTlsProvider currentProvider;
 
                #endregion
 
-#if SECURITY_DEP && !MONO_FEATURE_NEW_SYSTEM_SOURCE
+#if SECURITY_DEP
 
                static Dictionary<string,string> providerRegistration;
 
@@ -171,13 +159,10 @@ namespace Mono.Net.Security
                                if (providerRegistration != null)
                                        return;
                                providerRegistration = new Dictionary<string,string> ();
-                               providerRegistration.Add ("legacy", "Mono.Net.Security.Private.MonoLegacyTlsProvider");
-                               providerRegistration.Add ("newtls", "Mono.Security.Providers.NewTls.NewTlsProvider, Mono.Security.Providers.NewTls, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756");
-                               providerRegistration.Add ("oldtls", "Mono.Security.Providers.OldTls.OldTlsProvider, Mono.Security.Providers.OldTls, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756");
-#if HAVE_BTLS
-                               if (Mono.Btls.MonoBtlsProvider.IsSupported ())
+                               providerRegistration.Add ("legacy", "Mono.Net.Security.LegacyTlsProvider");
+                               providerRegistration.Add ("default", "Mono.Net.Security.LegacyTlsProvider");
+                               if (IsBtlsSupported ())
                                        providerRegistration.Add ("btls", "Mono.Btls.MonoBtlsProvider");
-#endif
                                X509Helper2.Initialize ();
                        }
                }
@@ -186,11 +171,8 @@ namespace Mono.Net.Security
                static MSI.MonoTlsProvider TryDynamicLoad ()
                {
                        var variable = Environment.GetEnvironmentVariable ("MONO_TLS_PROVIDER");
-                       if (variable == null)
-                               return null;
-
-                       if (string.Equals (variable, "default", StringComparison.OrdinalIgnoreCase))
-                               return null;
+                       if (string.IsNullOrEmpty (variable))
+                               variable = "default";
 
                        return LookupProvider (variable, true);
                }
@@ -201,7 +183,7 @@ namespace Mono.Net.Security
                        if (provider != null)
                                return provider;
 
-                       return new Private.MonoLegacyTlsProvider ();
+                       return new LegacyTlsProvider ();
                }
 #endif
 
@@ -222,13 +204,9 @@ namespace Mono.Net.Security
                        return provider.Provider;
                }
 
-               internal static MSI.MonoTlsProvider GetDefaultProvider ()
+               internal static bool IsProviderSupported (string name)
                {
-                       var provider = GetDefaultProviderInternal ();
-                       if (provider == null)
-                               throw new NotSupportedException ("No TLS Provider available.");
-
-                       return provider.Provider;
+                       return LookupProvider (name, false) != null;
                }
 
                internal static MSI.MonoTlsProvider GetProvider (string name)
@@ -236,20 +214,30 @@ namespace Mono.Net.Security
                        return LookupProvider (name, false);
                }
 
-               internal static bool HasProvider {
+               internal static bool IsInitialized {
                        get {
                                lock (locker) {
-                                       return currentProvider != null;
+                                       return initialized;
                                }
                        }
                }
 
-               internal static void SetDefaultProvider (string name)
+               internal static void Initialize ()
                {
-                       lock (locker) {
-                               var provider = LookupProvider (name, true);
-                               currentProvider = new Private.MonoTlsProviderWrapper (provider);
-                       }
+                       #if SECURITY_DEP
+                       InitializeInternal ();
+                       #else
+                       throw new NotSupportedException ("TLS Support not available.");
+                       #endif
+               }
+
+               internal static void Initialize (string provider)
+               {
+                       #if SECURITY_DEP
+                       InitializeInternal (provider);
+                       #else
+                       throw new NotSupportedException ("TLS Support not available.");
+                       #endif
                }
 
                internal static HttpWebRequest CreateHttpsRequest (Uri requestUri, MSI.MonoTlsProvider provider, MSI.MonoTlsSettings settings)
diff --git a/mcs/class/System/Mono.Net.Security/MonoTlsProviderImpl.cs b/mcs/class/System/Mono.Net.Security/MonoTlsProviderImpl.cs
deleted file mode 100644 (file)
index 94f86ca..0000000
+++ /dev/null
@@ -1,108 +0,0 @@
-//
-// MonoTlsProviderImpl.cs
-//
-// Author:
-//       Martin Baulig <martin.baulig@xamarin.com>
-//
-// Copyright (c) 2015 Xamarin, Inc.
-//
-// 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.
-
-#if SECURITY_DEP
-
-#if MONO_SECURITY_ALIAS
-extern alias MonoSecurity;
-#endif
-
-#if MONO_SECURITY_ALIAS
-using MSI = MonoSecurity::Mono.Security.Interface;
-#else
-using MSI = Mono.Security.Interface;
-#endif
-
-using System;
-using System.IO;
-using System.Net;
-using System.Net.Security;
-using System.Security.Cryptography.X509Certificates;
-
-namespace Mono.Net.Security.Private
-{
-       /*
-        * Strictly private - do not use outside the Mono.Net.Security directory.
-        */
-       abstract class MonoTlsProviderImpl : MSI.MonoTlsProvider, IMonoTlsProvider
-       {
-               MSI.MonoTlsProvider IMonoTlsProvider.Provider {
-                       get { return this; }
-               }
-
-               IMonoSslStream IMonoTlsProvider.CreateSslStream (
-                       Stream innerStream, bool leaveInnerStreamOpen,
-                       MSI.MonoTlsSettings settings)
-               {
-                       return CreateSslStreamImpl (innerStream, leaveInnerStreamOpen, settings);
-               }
-
-               protected abstract IMonoSslStream CreateSslStreamImpl (
-                       Stream innerStream, bool leaveInnerStreamOpen,
-                       MSI.MonoTlsSettings settings);
-
-               public override MSI.IMonoSslStream CreateSslStream (
-                       Stream innerStream, bool leaveInnerStreamOpen,
-                       MSI.MonoTlsSettings settings = null)
-               {
-                       var sslStream = CreateSslStreamImpl (innerStream, leaveInnerStreamOpen, settings);
-                       return new MonoSslStreamImpl (sslStream);
-               }
-
-               MSI.IMonoTlsContext IMonoTlsProvider.CreateTlsContext (
-                       string hostname, bool serverMode, MSI.TlsProtocols protocolFlags,
-                       X509Certificate serverCertificate, X509CertificateCollection clientCertificates,
-                       bool remoteCertRequired, bool checkCertName, bool checkCertRevocationStatus,
-                       MSI.MonoEncryptionPolicy encryptionPolicy, MSI.MonoTlsSettings settings)
-               {
-                       return CreateTlsContextImpl (
-                               hostname, serverMode, protocolFlags,
-                               serverCertificate, clientCertificates,
-                               remoteCertRequired, encryptionPolicy, settings);
-               }
-
-               protected abstract MSI.IMonoTlsContext CreateTlsContextImpl (
-                       string hostname, bool serverMode, MSI.TlsProtocols protocolFlags,
-                       X509Certificate serverCertificate, X509CertificateCollection clientCertificates,
-                       bool remoteCertRequired, MSI.MonoEncryptionPolicy encryptionPolicy,
-                       MSI.MonoTlsSettings settings);
-
-               internal override MSI.IMonoTlsContext CreateTlsContext (
-                       string hostname, bool serverMode, MSI.TlsProtocols protocolFlags,
-                       X509Certificate serverCertificate, X509CertificateCollection clientCertificates,
-                       bool remoteCertRequired, MSI.MonoEncryptionPolicy encryptionPolicy,
-                       MSI.MonoTlsSettings settings)
-               {
-                       return CreateTlsContextImpl (
-                               hostname, serverMode, (MSI.TlsProtocols)protocolFlags,
-                               serverCertificate, clientCertificates,
-                               remoteCertRequired, (MSI.MonoEncryptionPolicy)encryptionPolicy,
-                               settings);
-               }
-       }
-}
-
-#endif
index 15283200590899b85f606eb3a2acfc9a08c6a9bb..0a81f4ff932ca159d11aa89a01ca09e9bbfd5240 100644 (file)
@@ -73,19 +73,6 @@ namespace Mono.Net.Security.Private
                                return monoSslStreamImpl.Impl;
                        return new MonoSslStreamWrapper (sslStream);
                }
-
-               public MSI.IMonoTlsContext CreateTlsContext (
-                       string hostname, bool serverMode, MSI.TlsProtocols protocolFlags,
-                       X509Certificate serverCertificate, X509CertificateCollection clientCertificates,
-                       bool remoteCertRequired, bool checkCertName, bool checkCertRevocationStatus,
-                       MSI.MonoEncryptionPolicy encryptionPolicy, MSI.MonoTlsSettings settings)
-               {
-                       return provider.CreateTlsContext (
-                               hostname, serverMode, protocolFlags,
-                               serverCertificate, clientCertificates,
-                               remoteCertRequired, (MSI.MonoEncryptionPolicy)encryptionPolicy,
-                               settings);
-               }
        }
 }
 
index 79e4fbf68451cdcdd881891c2a7a223fcfe0f0ed..6e0e2a9b1f0740cfe7ebbcb7b0aaa98b56191efd 100644 (file)
@@ -34,7 +34,6 @@ using MonoSecurity::Mono.Security.Interface;
 #else
 using Mono.Security.Interface;
 #endif
-using XX509CertificateCollection = System.Security.Cryptography.X509Certificates.X509CertificateCollection;
 #endif
 
 using System;
@@ -76,7 +75,7 @@ namespace Mono.Net.Security
                }
 
 #if SECURITY_DEP
-               readonly ChainValidationHelper validationHelper;
+//             readonly ChainValidationHelper validationHelper;
                readonly MonoTlsSettings settings;
 
                public MonoTlsStream (HttpWebRequest request, NetworkStream networkStream)
@@ -88,7 +87,7 @@ namespace Mono.Net.Security
                        provider = request.TlsProvider ?? MonoTlsProviderFactory.GetProviderInternal ();
                        status = WebExceptionStatus.SecureChannelFailure;
 
-                       validationHelper = ChainValidationHelper.Create (provider.Provider, ref settings, this);
+                       /*validationHelper =*/ ChainValidationHelper.Create (provider.Provider, ref settings, this);
                }
 
                internal Stream CreateStream (byte[] buffer)
@@ -102,7 +101,7 @@ namespace Mono.Net.Security
                                        ServicePointManager.CheckCertificateRevocationList);
 
                                status = WebExceptionStatus.Success;
-                       } catch (Exception ex) {
+                       } catch (Exception) {
                                status = WebExceptionStatus.SecureChannelFailure;
                                throw;
                        } finally {
index 6de1cd2599345f6e857e342f6cb88f008ce8bdf8..2787775d30204014f088f82f644ced144f584b02 100644 (file)
@@ -47,47 +47,56 @@ namespace Mono.Net.Security
        //
        internal static class NoReflectionHelper
        {
-               internal static object GetDefaultCertificateValidator (object provider, object settings)
+               internal static object GetInternalValidator (object provider, object settings)
                {
                        #if SECURITY_DEP
-                       return ChainValidationHelper.GetDefaultValidator ((MSI.MonoTlsProvider)provider, (MSI.MonoTlsSettings)settings);
+                       return ChainValidationHelper.GetInternalValidator ((MSI.MonoTlsProvider)provider, (MSI.MonoTlsSettings)settings);
                        #else
                        throw new NotSupportedException ();
                        #endif
                }
 
-               internal static object GetProvider ()
+               internal static object GetDefaultValidator (object settings)
                {
                        #if SECURITY_DEP
-                       return MonoTlsProviderFactory.GetProvider ();
+                       return ChainValidationHelper.GetDefaultValidator ((MSI.MonoTlsSettings)settings);
                        #else
                        throw new NotSupportedException ();
                        #endif
                }
 
-               internal static object GetDefaultProvider ()
+               internal static object GetProvider ()
                {
                        #if SECURITY_DEP
-                       return MonoTlsProviderFactory.GetDefaultProvider ();
+                       return MonoTlsProviderFactory.GetProvider ();
                        #else
                        throw new NotSupportedException ();
                        #endif
                }
 
-               internal static bool HasProvider {
+               internal static bool IsInitialized {
                        get {
                                #if SECURITY_DEP
-                               return MonoTlsProviderFactory.HasProvider;
+                               return MonoTlsProviderFactory.IsInitialized;
                                #else
                                throw new NotSupportedException ();
                                #endif
                        }
                }
 
-               internal static void SetDefaultProvider (string name)
+               internal static void Initialize ()
+               {
+                       #if SECURITY_DEP
+                       MonoTlsProviderFactory.Initialize ();
+                       #else
+                       throw new NotSupportedException ();
+                       #endif
+               }
+
+               internal static void Initialize (string provider)
                {
                        #if SECURITY_DEP
-                       MonoTlsProviderFactory.SetDefaultProvider (name);
+                       MonoTlsProviderFactory.Initialize (provider);
                        #else
                        throw new NotSupportedException ();
                        #endif
@@ -120,6 +129,15 @@ namespace Mono.Net.Security
                        #endif
                }
 
+               internal static bool IsProviderSupported (string name)
+               {
+                       #if SECURITY_DEP
+                       return MonoTlsProviderFactory.IsProviderSupported (name);
+                       #else
+                       throw new NotSupportedException ();
+                       #endif
+               }
+
                internal static object GetProvider (string name)
                {
                        #if SECURITY_DEP
index e900c22bfeaab4f99b6b5b94728eb66d166b1a8a..42c17de3ce66ec827f7aeea29b5a481438054ebe 100644 (file)
@@ -13,8 +13,6 @@ using Mono.Security.Interface;
 using MSX = Mono.Security.X509;
 using Mono.Security.X509.Extensions;
 #endif
-using XX509CertificateCollection = System.Security.Cryptography.X509Certificates.X509CertificateCollection;
-using XX509Chain = System.Security.Cryptography.X509Certificates.X509Chain;
 
 using System;
 using System.Net;
@@ -62,7 +60,7 @@ namespace Mono.Net.Security
 #endif
                }
 
-               public static X509Chain CreateX509Chain (XX509CertificateCollection certs)
+               public static X509Chain CreateX509Chain (X509CertificateCollection certs)
                {
                        var chain = new X509Chain ();
                        chain.ChainPolicy = new X509ChainPolicy ((X509CertificateCollection)(object)certs);
@@ -74,7 +72,7 @@ namespace Mono.Net.Security
                        return chain;
                }
 
-               static bool BuildX509Chain (XX509CertificateCollection certs, X509Chain chain, ref SslPolicyErrors errors, ref int status11)
+               static bool BuildX509Chain (X509CertificateCollection certs, X509Chain chain, ref SslPolicyErrors errors, ref int status11)
                {
 #if MOBILE
                        return false;
@@ -106,7 +104,7 @@ namespace Mono.Net.Security
 #endif
                }
 
-               static bool CheckUsage (XX509CertificateCollection certs, string host, ref SslPolicyErrors errors, ref int status11)
+               static bool CheckUsage (X509CertificateCollection certs, string host, ref SslPolicyErrors errors, ref int status11)
                {
 #if !MONOTOUCH
                        var leaf = certs[0] as X509Certificate2;
@@ -130,7 +128,7 @@ namespace Mono.Net.Security
                        return true;
                }
 
-               static bool EvaluateSystem (XX509CertificateCollection certs, XX509CertificateCollection anchors, string host, X509Chain chain, ref SslPolicyErrors errors, ref int status11)
+               static bool EvaluateSystem (X509CertificateCollection certs, X509CertificateCollection anchors, string host, X509Chain chain, ref SslPolicyErrors errors, ref int status11)
                {
                        var leaf = certs [0];
                        bool result;
@@ -191,7 +189,7 @@ namespace Mono.Net.Security
                }
 
                public static bool Evaluate (
-                       MonoTlsSettings settings, string host, XX509CertificateCollection certs,
+                       MonoTlsSettings settings, string host, X509CertificateCollection certs,
                        X509Chain chain, ref SslPolicyErrors errors, ref int status11)
                {
                        if (!CheckUsage (certs, host, ref errors, ref status11))
index 4e4d2859b032021c4fe0bbaf2b0dc9f7fb081b2d..f3b840e8f7f56533be087a32001bfdabaacd9a82 100644 (file)
@@ -1,7 +1,9 @@
 using System.Collections;
 using System.Collections.Generic;
 using System.Text.RegularExpressions;
+#if !MONOTOUCH_WATCH
 using Mono.Net;
+#endif
 
 namespace System.Net
 {
index 28e1c47e7d5801e8d0e81f3d2ad4db6c755c625d..9a8d89fab44999c3f6cbb4198abefb16585afccc 100644 (file)
@@ -27,8 +27,6 @@ namespace System.Security.Cryptography {
                                return "md2RSA";
                        case "1.2.840.113549.1.1.3":
                                return "md4RSA";
-                               return "md4RSA";
-                               return "md4RSA";
                        case "1.3.14.3.2.27":
                                return "dsaSHA1";
                        case "2.16.840.1.101.2.1.1.19":
index b7f3043a5941e184860fa86382ff491aed9709e0..8d92f001d56d241281f3bd1f1be02508be82bf4b 100644 (file)
@@ -2,7 +2,7 @@ using System.Collections;
 
 namespace System.Net
 {
-       static class UnsafeNclNativeMethods
+       static partial class UnsafeNclNativeMethods
        {
                internal static unsafe class HttpApi 
                {
diff --git a/mcs/class/System/ReferenceSources/Internal.cs b/mcs/class/System/ReferenceSources/Internal.cs
deleted file mode 100644 (file)
index 6c50450..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-//
-// Internal.cs
-//
-// Author:
-//       Martin Baulig <martin.baulig@xamarin.com>
-//
-// Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)
-//
-// 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.Runtime.InteropServices;
-using System.Security.Cryptography.X509Certificates;
-
-namespace System.Net.Security
-{
-       //From Schannel.h
-       [Flags]
-       internal enum SchProtocols
-       {
-               Zero = 0,
-               PctClient = 0x00000002,
-               PctServer = 0x00000001,
-               Pct = (PctClient | PctServer),
-               Ssl2Client = 0x00000008,
-               Ssl2Server = 0x00000004,
-               Ssl2 = (Ssl2Client | Ssl2Server),
-               Ssl3Client = 0x00000020,
-               Ssl3Server = 0x00000010,
-               Ssl3 = (Ssl3Client | Ssl3Server),
-               Tls10Client = 0x00000080,
-               Tls10Server = 0x00000040,
-               Tls10 = (Tls10Client | Tls10Server),
-               Tls11Client = 0x00000200,
-               Tls11Server = 0x00000100,
-               Tls11 = (Tls11Client | Tls11Server),
-               Tls12Client = 0x00000800,
-               Tls12Server = 0x00000400,
-               Tls12 = (Tls12Client | Tls12Server),
-               Ssl3Tls = (Ssl3 | Tls10),
-               UniClient = unchecked((int)0x80000000),
-               UniServer = 0x40000000,
-               Unified = (UniClient | UniServer),
-               ClientMask = (PctClient | Ssl2Client | Ssl3Client | Tls10Client | Tls11Client | Tls12Client | UniClient),
-               ServerMask = (PctServer | Ssl2Server | Ssl3Server | Tls10Server | Tls11Server | Tls12Server | UniServer)
-       }
-
-       //From Schannel.h
-       [StructLayout (LayoutKind.Sequential)]
-       internal class SslConnectionInfo
-       {
-               public readonly int Protocol;
-               public readonly int DataCipherAlg;
-               public readonly int DataKeySize;
-               public readonly int DataHashAlg;
-               public readonly int DataHashKeySize;
-               public readonly int KeyExchangeAlg;
-               public readonly int KeyExchKeySize;
-
-               internal SslConnectionInfo (int protocol)
-               {
-                       Protocol = protocol;
-               }
-       }
-}
index b5b773e28c4f186888e9a03b710e7524d4c66c23..8eb5e066d02487b08f300b15d1d6b1a7ccee2ad7 100644 (file)
@@ -1,21 +1,23 @@
-#if !MONO_FEATURE_NEW_TLS
 using System.Diagnostics;
 
 namespace System.Net {
-       class Logging {
-               internal static bool On {
+       static class Logging
+       {
+               internal static readonly bool On = false;
+
+               internal static TraceSource Web {
                        get {
-                               return false;
+                               return null;
                        }
                }
 
-               internal static TraceSource Web {
+               internal static TraceSource HttpListener {
                        get {
                                return null;
                        }
                }
 
-               internal static TraceSource HttpListener {
+               internal static TraceSource Sockets {
                        get {
                                return null;
                        }
@@ -29,6 +31,10 @@ namespace System.Net {
                internal static void Enter(TraceSource traceSource, string msg) {
                }
 
+               [Conditional ("TRACE")]
+               internal static void Enter(TraceSource traceSource, string msg, string parameters) {
+               }
+
                [Conditional ("TRACE")]
                internal static void Exception(TraceSource traceSource, object obj, string method, Exception e) {
                }
@@ -41,6 +47,10 @@ namespace System.Net {
                internal static void Exit(TraceSource traceSource, string msg) {
                }
 
+               [Conditional ("TRACE")]
+               internal static void Exit(TraceSource traceSource, string msg, string parameters) {
+               }
+
                [Conditional ("TRACE")]
                internal static void PrintInfo(TraceSource traceSource, object obj, string method, string msg) {
                }
@@ -75,4 +85,3 @@ namespace System.Net {
 
 #endif
 }
-#endif
diff --git a/mcs/class/System/ReferenceSources/SSPIConfiguration.cs b/mcs/class/System/ReferenceSources/SSPIConfiguration.cs
deleted file mode 100644 (file)
index 3ab4138..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-//
-// SSPIConfiguration.cs
-//
-// Author:
-//       Martin Baulig <martin.baulig@xamarin.com>
-//
-// Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)
-//
-// 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.
-
-#if MONO_FEATURE_NEW_TLS && SECURITY_DEP
-#if MONO_SECURITY_ALIAS
-extern alias MonoSecurity;
-using MonoSecurity::Mono.Security.Interface;
-#else
-using Mono.Security.Interface;
-#endif
-using Mono.Net.Security;
-
-namespace System.Net.Security
-{
-       internal interface SSPIConfiguration
-       {
-               IMonoTlsProvider Provider {
-                       get;
-               }
-
-               MonoTlsSettings Settings {
-                       get;
-               }
-
-               IMonoTlsEventSink EventSink {
-                       get;
-               }
-       }
-}
-#endif
diff --git a/mcs/class/System/ReferenceSources/SSPISafeHandles.cs b/mcs/class/System/ReferenceSources/SSPISafeHandles.cs
deleted file mode 100644 (file)
index a12e395..0000000
+++ /dev/null
@@ -1,209 +0,0 @@
-//
-// SafeHandles.cs
-//
-// Author:
-//       Martin Baulig <martin.baulig@xamarin.com>
-//
-// Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)
-//
-// 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.
-#if MONO_FEATURE_NEW_TLS && SECURITY_DEP
-#if MONO_SECURITY_ALIAS
-extern alias MonoSecurity;
-using IMonoTlsContext = MonoSecurity::Mono.Security.Interface.IMonoTlsContext;
-#else
-using IMonoTlsContext = Mono.Security.Interface.IMonoTlsContext;
-#endif
-
-using System.Runtime.InteropServices;
-using System.Security.Cryptography.X509Certificates;
-
-namespace System.Net.Security
-{
-       class DummySafeHandle : SafeHandle
-       {
-               protected DummySafeHandle ()
-                       : base ((IntPtr)(-1), true)
-               {
-               }
-
-               protected override bool ReleaseHandle ()
-               {
-                       return true;
-               }
-
-               public override bool IsInvalid {
-                       get { return handle == (IntPtr)(-1); }
-               }
-       }
-
-       class SafeFreeCertContext : DummySafeHandle
-       {
-       }
-
-       class SafeFreeCredentials : DummySafeHandle
-       {
-               SecureCredential credential;
-
-               public X509Certificate2 Certificate {
-                       get {
-                               if (IsInvalid)
-                                       throw new ObjectDisposedException ("Certificate");
-                               return credential.certificate;
-                       }
-               }
-
-               public SafeFreeCredentials (SecureCredential credential)
-               {
-                       this.credential = credential;
-                       bool success = true;
-                       DangerousAddRef (ref success);
-               }
-
-               public override bool IsInvalid {
-                       get {
-                               return credential.certificate == null;
-                       }
-               }
-
-               protected override bool ReleaseHandle ()
-               {
-                       credential.Clear ();
-                       return base.ReleaseHandle ();
-               }
-       }
-
-       class SafeDeleteContext : DummySafeHandle
-       {
-               IMonoTlsContext context;
-
-               public IMonoTlsContext Context {
-                       get {
-                               if (IsInvalid)
-                                       throw new ObjectDisposedException ("TlsContext");
-                               return context;
-                       }
-               }
-
-               public SafeDeleteContext (IMonoTlsContext context)
-               {
-                       this.context = context;
-               }
-
-               public override bool IsInvalid {
-                       get {
-                               return context == null || !context.IsValid;
-                       }
-               }
-
-               protected override bool ReleaseHandle ()
-               {
-                       context.Dispose ();
-                       context = null;
-                       return base.ReleaseHandle ();
-               }
-       }
-
-       struct SecureCredential
-       {
-               public const int CurrentVersion = 0x4;
-
-               [Flags]
-               public enum Flags
-               {
-                       Zero = 0,
-                       NoSystemMapper = 0x02,
-                       NoNameCheck = 0x04,
-                       ValidateManual = 0x08,
-                       NoDefaultCred = 0x10,
-                       ValidateAuto = 0x20,
-                       SendAuxRecord = 0x00200000,
-                       UseStrongCrypto = 0x00400000
-               }
-
-               int version;
-               internal X509Certificate2 certificate;
-               SchProtocols protocols;
-               EncryptionPolicy policy;
-
-               public SecureCredential (int version, X509Certificate2 certificate, SecureCredential.Flags flags, SchProtocols protocols, EncryptionPolicy policy)
-               {
-                       this.version = version;
-                       this.certificate = certificate;
-                       this.protocols = protocols;
-                       this.policy = policy;
-               }
-
-               public void Clear ()
-               {
-                       certificate = null;
-               }
-       }
-
-       internal class SafeCredentialReference : DummySafeHandle
-       {
-               //
-               // Static cache will return the target handle if found the reference in the table.
-               //
-               internal SafeFreeCredentials _Target;
-
-               //
-               //
-               internal static SafeCredentialReference CreateReference (SafeFreeCredentials target)
-               {
-                       SafeCredentialReference result = new SafeCredentialReference (target);
-                       if (result.IsInvalid)
-                               return null;
-
-                       return result;
-               }
-
-               private SafeCredentialReference (SafeFreeCredentials target)
-                       : base ()
-               {
-                       // Bumps up the refcount on Target to signify that target handle is statically cached so
-                       // its dispose should be postponed
-                       bool b = false;
-                       try {
-                               target.DangerousAddRef (ref b);
-                       } catch {
-                               if (b) {
-                                       target.DangerousRelease ();
-                                       b = false;
-                               }
-                       } finally {
-                               if (b) {
-                                       _Target = target;
-                                       SetHandle (new IntPtr (0));   // make this handle valid
-                               }
-                       }
-               }
-
-               override protected bool ReleaseHandle ()
-               {
-                       SafeFreeCredentials target = _Target;
-                       if (target != null)
-                               target.DangerousRelease ();
-                       _Target = null;
-                       return true;
-               }
-       }
-
-}
-#endif
diff --git a/mcs/class/System/ReferenceSources/SSPIWrapper.cs b/mcs/class/System/ReferenceSources/SSPIWrapper.cs
deleted file mode 100644 (file)
index a0cb8d5..0000000
+++ /dev/null
@@ -1,303 +0,0 @@
-//
-// SSPIWrapper.cs
-//
-// Author:
-//       Martin Baulig <martin.baulig@xamarin.com>
-//
-// Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)
-//
-// 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.
-
-#if MONO_FEATURE_NEW_TLS && SECURITY_DEP
-#if MONO_SECURITY_ALIAS
-extern alias MonoSecurity;
-#endif
-
-#if MONO_SECURITY_ALIAS
-using MX = MonoSecurity::Mono.Security.X509;
-using MonoSecurity::Mono.Security.Interface;
-#else
-using MX = Mono.Security.X509;
-using Mono.Security.Interface;
-#endif
-
-using System.Runtime.InteropServices;
-using System.Security.Authentication.ExtendedProtection;
-using System.Security.Cryptography.X509Certificates;
-using MNS = Mono.Net.Security;
-
-namespace System.Net.Security
-{
-       internal class SSPIInterface
-       {
-               public IMonoTlsContext Context {
-                       get;
-                       private set;
-               }
-
-               public IMonoTlsEventSink EventSink {
-                       get;
-                       private set;
-               }
-
-               public SSPIInterface (IMonoTlsContext context, IMonoTlsEventSink eventSink)
-               {
-                       Context = context;
-                       EventSink = eventSink;
-               }
-       }
-
-       internal static class GlobalSSPI
-       {
-               internal static SSPIInterface Create (string hostname, bool serverMode, SchProtocols protocolFlags, X509Certificate serverCertificate, X509CertificateCollection clientCertificates,
-                                                          bool remoteCertRequired, bool checkCertName, bool checkCertRevocationStatus, EncryptionPolicy encryptionPolicy,
-                                                          LocalCertSelectionCallback certSelectionDelegate, RemoteCertValidationCallback remoteValidationCallback, SSPIConfiguration userConfig)
-               {
-                       if (userConfig.Settings != null && remoteValidationCallback != null)
-                               throw new InvalidOperationException ();
-                       var context = userConfig.Provider.CreateTlsContext (
-                               hostname, serverMode, (TlsProtocols)protocolFlags, serverCertificate, clientCertificates,
-                               remoteCertRequired, checkCertName, checkCertRevocationStatus,
-                               (MonoEncryptionPolicy)encryptionPolicy, userConfig.Settings);
-                       return new SSPIInterface (context, userConfig.EventSink);
-               }
-       }
-
-       /*
-        * SSPIWrapper _is a _class that provides a managed implementation of the equivalent
-        * _class _in Microsofts .NET Framework.   
-        * 
-        * The SSPIWrapper class is used by the TLS/SSL stack to implement both the 
-        * protocol handshake as well as the encryption and decryption of messages.
-        * 
-        * Microsoft's implementation of this class is merely a P/Invoke wrapper
-        * around the native SSPI APIs on Windows.   This implementation instead, 
-        * provides a managed implementation that uses the cross platform Mono.Security 
-        * to provide the equivalent functionality.
-        * 
-        * Ideally, this should be abstracted with a different name, and decouple
-        * the naming from the SSPIWrapper name, but this allows Mono to reuse
-        * the .NET code with minimal changes.
-        * 
-        * The "internal" methods here are the API that is consumed by the class
-        * libraries.
-        */
-       internal static class SSPIWrapper
-       {
-               static void SetCredentials (SSPIInterface secModule, SafeFreeCredentials credentials)
-               {
-                       if (credentials != null && !credentials.IsInvalid) {
-                               if (!secModule.Context.HasCredentials && credentials.Certificate != null) {
-                                       var cert = new X509Certificate2 (credentials.Certificate.RawData);
-                                       secModule.Context.SetCertificate (cert, credentials.Certificate.PrivateKey);
-                               }
-                               bool success = true;
-                               credentials.DangerousAddRef (ref success);
-                       }
-               }
-
-               /*
-                * @safecontext is null on the first use, but it will become non-null for invocations 
-                * where the connection is being re-negotiated.
-                * 
-               */
-               internal static int AcceptSecurityContext (SSPIInterface secModule, ref SafeFreeCredentials credentials, ref SafeDeleteContext safeContext, ContextFlags inFlags, Endianness endianness, SecurityBuffer inputBuffer, SecurityBuffer outputBuffer, ref ContextFlags outFlags)
-               {
-                       if (endianness != Endianness.Native)
-                               throw new NotSupportedException ();
-
-                       if (safeContext == null) {
-                               if (credentials == null || credentials.IsInvalid)
-                                       return (int)SecurityStatus.CredentialsNeeded;
-
-                               secModule.Context.Initialize (secModule.EventSink);
-                               safeContext = new SafeDeleteContext (secModule.Context);
-                       }
-
-                       SetCredentials (secModule, credentials);
-
-                       var incoming = GetInputBuffer (inputBuffer);
-                       IBufferOffsetSize outgoing;
-
-                       var retval = (int)safeContext.Context.GenerateNextToken (incoming, out outgoing);
-                       UpdateOutput (outgoing, outputBuffer);
-                       return retval;
-               }
-
-               internal static int InitializeSecurityContext (SSPIInterface secModule, ref SafeFreeCredentials credentials, ref SafeDeleteContext safeContext, string targetName, ContextFlags inFlags, Endianness endianness, SecurityBuffer inputBuffer, SecurityBuffer outputBuffer, ref ContextFlags outFlags)
-               {
-                       if (inputBuffer != null)
-                               throw new InvalidOperationException ();
-
-                       if (safeContext == null) {
-                               secModule.Context.Initialize (secModule.EventSink);
-                               safeContext = new SafeDeleteContext (secModule.Context);
-                       }
-
-                       return InitializeSecurityContext (secModule, credentials, ref safeContext, targetName, inFlags, endianness, null, outputBuffer, ref outFlags);
-               }
-
-               internal static int InitializeSecurityContext (SSPIInterface secModule, SafeFreeCredentials credentials, ref SafeDeleteContext safeContext, string targetName, ContextFlags inFlags, Endianness endianness, SecurityBuffer[] inputBuffers, SecurityBuffer outputBuffer, ref ContextFlags outFlags)
-               {
-                       if (endianness != Endianness.Native)
-                               throw new NotSupportedException ();
-
-                       SetCredentials (secModule, credentials);
-
-                       SecurityBuffer inputBuffer = null;
-                       if (inputBuffers != null) {
-                               if (inputBuffers.Length != 2 || inputBuffers [1].type != BufferType.Empty)
-                                       throw new NotSupportedException ();
-                               inputBuffer = inputBuffers [0];
-                       }
-
-                       var incoming = GetInputBuffer (inputBuffer);
-                       IBufferOffsetSize outgoing = null;
-
-                       var retval = (int)safeContext.Context.GenerateNextToken (incoming, out outgoing);
-                       UpdateOutput (outgoing, outputBuffer);
-                       return retval;
-               }
-
-               internal static int EncryptMessage (SSPIInterface secModule, SafeDeleteContext safeContext, SecurityBuffer securityBuffer, uint sequenceNumber)
-               {
-                       var incoming = GetInputBuffer (securityBuffer);
-                       var retval = (int)safeContext.Context.EncryptMessage (ref incoming);
-                       UpdateOutput (incoming, securityBuffer);
-                       return retval;
-               }
-
-               internal static int DecryptMessage (SSPIInterface secModule, SafeDeleteContext safeContext, SecurityBuffer securityBuffer, uint sequenceNumber)
-               {
-                       var incoming = GetInputBuffer (securityBuffer);
-                       var retval = (int)safeContext.Context.DecryptMessage (ref incoming);
-                       UpdateOutput (incoming, securityBuffer);
-                       return retval;
-               }
-
-               internal static byte[] CreateShutdownMessage (SSPIInterface secModule, SafeDeleteContext safeContext)
-               {
-                       return safeContext.Context.CreateCloseNotify ();
-               }
-
-               internal static byte[] CreateHelloRequestMessage (SSPIInterface secModule, SafeDeleteContext safeContext)
-               {
-                       return safeContext.Context.CreateHelloRequest ();
-               }
-
-               internal static bool IsClosed (SSPIInterface secModule, SafeDeleteContext safeContext)
-               {
-                       return safeContext.Context.ReceivedCloseNotify;
-               }
-
-               internal static SafeFreeCredentials AcquireCredentialsHandle (SSPIInterface SecModule, string package, CredentialUse intent, SecureCredential scc)
-               {
-                       return new SafeFreeCredentials (scc);
-               }
-
-               public static ChannelBinding QueryContextChannelBinding (SSPIInterface SecModule, SafeDeleteContext securityContext, ContextAttribute contextAttribute)
-               {
-                       return null;
-               }
-
-               internal static X509Certificate2 GetRemoteCertificate (SafeDeleteContext safeContext, out X509Certificate2Collection remoteCertificateStore)
-               {
-                       X509CertificateCollection monoCollection;
-                       if (safeContext == null || safeContext.IsInvalid) {
-                               remoteCertificateStore = null;
-                               return null;
-                       }
-                       var monoCert = safeContext.Context.GetRemoteCertificate (out monoCollection);
-                       if (monoCert == null) {
-                               remoteCertificateStore = null;
-                               return null;
-                       }
-
-                       remoteCertificateStore = new X509Certificate2Collection ();
-                       foreach (var cert in monoCollection) {
-                               remoteCertificateStore.Add (cert);
-                       }
-                       return (X509Certificate2)monoCert;
-               }
-
-               internal static bool CheckRemoteCertificate (SafeDeleteContext safeContext)
-               {
-                       return safeContext.Context.VerifyRemoteCertificate ();
-               }
-
-               internal static MonoTlsConnectionInfo GetMonoConnectionInfo (SSPIInterface SecModule, SafeDeleteContext securityContext)
-               {
-                       return securityContext.Context.GetConnectionInfo ();
-               }
-
-               internal static SslConnectionInfo GetConnectionInfo (SSPIInterface SecModule, SafeDeleteContext securityContext)
-               {
-                       var info = securityContext.Context.GetConnectionInfo ();
-                       if (info == null)
-                               return null;
-
-                       return new SslConnectionInfo ((int)info.ProtocolVersion);
-               }
-
-               class InputBuffer : IBufferOffsetSize
-               {
-                       public byte[] Buffer {
-                               get;
-                               private set;
-                       }
-
-                       public int Offset {
-                               get;
-                               private set;
-                       }
-
-                       public int Size {
-                               get;
-                               private set;
-                       }
-
-                       public InputBuffer (byte[] buffer, int offset, int size)
-                       {
-                               Buffer = buffer;
-                               Offset = offset;
-                               Size = size;
-                       }
-               }
-
-               static IBufferOffsetSize GetInputBuffer (SecurityBuffer incoming)
-               {
-                       return incoming != null ? new InputBuffer (incoming.token, incoming.offset, incoming.size) : null;
-               }
-
-               static void UpdateOutput (IBufferOffsetSize buffer, SecurityBuffer outputBuffer)
-               {
-                       if (buffer != null) {
-                               outputBuffer.token = buffer.Buffer;
-                               outputBuffer.offset = buffer.Offset;
-                               outputBuffer.size = buffer.Size;
-                               outputBuffer.type = BufferType.Token;
-                       } else {
-                               outputBuffer.token = null;
-                               outputBuffer.size = outputBuffer.offset = 0;
-                               outputBuffer.type = BufferType.Empty;
-                       }
-               }
-       }
-}
-#endif
diff --git a/mcs/class/System/ReferenceSources/SecureStringHelper.cs b/mcs/class/System/ReferenceSources/SecureStringHelper.cs
new file mode 100644 (file)
index 0000000..31372e2
--- /dev/null
@@ -0,0 +1,47 @@
+using System.Security;
+using System.Runtime.InteropServices;
+
+namespace System.Net
+{
+       static partial class UnsafeNclNativeMethods
+       {
+        internal unsafe static class SecureStringHelper
+        {
+            internal static string CreateString(SecureString secureString)
+            {
+                string plainString;
+                IntPtr bstr = IntPtr.Zero;
+
+                if (secureString == null || secureString.Length == 0)
+                    return String.Empty;
+
+                try
+                {
+                    bstr = Marshal.SecureStringToBSTR(secureString);
+                    plainString = Marshal.PtrToStringBSTR(bstr);
+                }
+                finally
+                {
+                    if (bstr != IntPtr.Zero)
+                        Marshal.ZeroFreeBSTR(bstr);
+                }
+                return plainString;
+            }
+
+            internal static SecureString CreateSecureString(string plainString)
+            {
+                SecureString secureString;
+
+                if (plainString == null || plainString.Length == 0)
+                    return new SecureString();
+
+                fixed (char* pch = plainString)
+                {
+                    secureString = new SecureString(pch, plainString.Length);
+                }
+
+                return secureString;
+            }
+        }
+    }
+}
\ No newline at end of file
index afe34459bbb58f8ae30911fd6b10b158757feed1..e7719c1afaadb5c134af12056a6613077c4fd021 100644 (file)
@@ -1,4 +1,5 @@
 using System.Net.Security;
+using System.Net.Sockets;
 
 namespace System.Net.Configuration {
        sealed class SettingsSectionInternal
@@ -16,8 +17,8 @@ namespace System.Net.Configuration {
                internal UnicodeDecodingConformance WebUtilityUnicodeDecodingConformance = UnicodeDecodingConformance.Auto;
 #endif
 
-               internal bool HttpListenerUnescapeRequestUrl = true;
-
+               internal readonly bool HttpListenerUnescapeRequestUrl = true;
+               internal readonly IPProtectionLevel IPProtectionLevel = IPProtectionLevel.Unspecified;
 
                internal bool UseNagleAlgorithm { get; set; }
                internal bool Expect100Continue { get; set; }
@@ -26,5 +27,20 @@ namespace System.Net.Configuration {
                internal bool EnableDnsRoundRobin { get; set; }
                internal bool CheckCertificateRevocationList { get; set; }
                internal EncryptionPolicy EncryptionPolicy { get; private set; }
+
+               internal bool Ipv6Enabled {
+                       get {
+#if CONFIGURATION_DEP && !MOBILE
+                               try {
+                                       var config = (SettingsSection) System.Configuration.ConfigurationManager.GetSection ("system.net/settings");
+                                       if (config != null)
+                                               return config.Ipv6.Enabled;
+                               } catch {
+                               }
+#endif
+
+                               return true;
+                       }
+               }
        }
 }
index 8c1d12b8aaaeea6744f18260c9f1db19986b9c64..b5fa6ee09e5f1dee58880f9f7a7a837a06aa7261 100644 (file)
@@ -37,10 +37,10 @@ namespace System.Net.Sockets
                // this version does not throw.
                internal void InternalShutdown (SocketShutdown how)
                {
-                       if (!is_connected || is_disposed)
+                       if (!is_connected || CleanedUp)
                                return;
                        int error;
-                       Shutdown_internal (safe_handle, how, out error);
+                       Shutdown_internal (m_Handle, how, out error);
                }
 
                internal IAsyncResult UnsafeBeginConnect (EndPoint remoteEP, AsyncCallback callback, object state)
@@ -86,7 +86,7 @@ namespace System.Net.Sockets
 
                internal void SetSocketOption (SocketOptionLevel optionLevel, SocketOptionName optionName, int optionValue, bool silent)
                {
-                       if (is_disposed && is_closed) {
+                       if (CleanedUp && is_closed) {
                                if (silent)
                                        return;
                                throw new ObjectDisposedException (GetType ().ToString ());
@@ -94,7 +94,7 @@ namespace System.Net.Sockets
 
                        int error;
 
-                       SetSocketOption_internal (safe_handle, optionLevel, optionName, null,
+                       SetSocketOption_internal (m_Handle, optionLevel, optionName, null,
                                null, optionValue, out error);
 
                        if (!silent && error != 0)
diff --git a/mcs/class/System/ReferenceSources/SslStream.cs b/mcs/class/System/ReferenceSources/SslStream.cs
deleted file mode 100644 (file)
index fea8922..0000000
+++ /dev/null
@@ -1,141 +0,0 @@
-//
-// Mono-specific additions to Microsoft's SslStream.cs
-//
-#if MONO_FEATURE_NEW_TLS && SECURITY_DEP
-#if MONO_SECURITY_ALIAS
-extern alias MonoSecurity;
-using MonoSecurity::Mono.Security.Interface;
-#else
-using Mono.Security.Interface;
-#endif
-using System.Threading;
-using System.Security.Cryptography.X509Certificates;
-using MNS = Mono.Net.Security;
-
-namespace System.Net.Security
-{
-       using System.Net.Sockets;
-       using System.IO;
-
-       partial class SslStream : IMonoTlsEventSink
-       {
-               #if SECURITY_DEP
-               SSPIConfiguration _Configuration;
-
-               internal SslStream (Stream innerStream, bool leaveInnerStreamOpen, EncryptionPolicy encryptionPolicy, MonoTlsProvider provider, MonoTlsSettings settings)
-                       : base (innerStream, leaveInnerStreamOpen)
-               {
-                       if (encryptionPolicy != EncryptionPolicy.RequireEncryption && encryptionPolicy != EncryptionPolicy.AllowNoEncryption && encryptionPolicy != EncryptionPolicy.NoEncryption)
-                               throw new ArgumentException (SR.GetString (SR.net_invalid_enum, "EncryptionPolicy"), "encryptionPolicy");
-
-                       var validationHelper = MNS.ChainValidationHelper.CloneWithCallbackWrapper (provider, ref settings, myUserCertValidationCallbackWrapper);
-
-                       LocalCertSelectionCallback selectionCallback = null;
-                       if (validationHelper.HasCertificateSelectionCallback)
-                               selectionCallback = validationHelper.SelectClientCertificate;
-
-                       var internalProvider = new MNS.Private.MonoTlsProviderWrapper (provider);
-                       _Configuration = new MyConfiguration (internalProvider, settings, this);
-                       _SslState = new SslState (innerStream, null, selectionCallback, encryptionPolicy, _Configuration);
-               }
-
-               /*
-                * Mono-specific version of 'userCertValidationCallbackWrapper'; we're called from ChainValidationHelper.ValidateChain() here.
-                *
-                * Since we're built without the PrebuiltSystem alias, we can't use 'SslPolicyErrors' here.  This prevents us from creating a subclass of 'ChainValidationHelper'
-                * as well as providing a custom 'ServerCertValidationCallback'.
-                */
-               bool myUserCertValidationCallbackWrapper (ServerCertValidationCallback callback, X509Certificate certificate, X509Chain chain, MonoSslPolicyErrors sslPolicyErrors)
-               {
-                       m_RemoteCertificateOrBytes = certificate == null ? null : certificate.GetRawCertData ();
-                       if (callback == null) {
-                               if (!_SslState.RemoteCertRequired)
-                                       sslPolicyErrors &= ~MonoSslPolicyErrors.RemoteCertificateNotAvailable;
-
-                               return (sslPolicyErrors == MonoSslPolicyErrors.None);
-                       }
-
-                       return MNS.ChainValidationHelper.InvokeCallback (callback, this, certificate, chain, sslPolicyErrors);
-               }
-
-               class MyConfiguration : SSPIConfiguration
-               {
-                       MNS.IMonoTlsProvider provider;
-                       MonoTlsSettings settings;
-                       IMonoTlsEventSink eventSink;
-
-                       public MyConfiguration (MNS.IMonoTlsProvider provider, MonoTlsSettings settings, IMonoTlsEventSink eventSink)
-                       {
-                               this.provider = provider;
-                               this.settings = settings;
-                               this.eventSink = eventSink;
-                       }
-
-                       public MNS.IMonoTlsProvider Provider {
-                               get { return provider; }
-                       }
-
-                       public MonoTlsSettings Settings {
-                               get { return settings; }
-                       }
-
-                       public IMonoTlsEventSink EventSink {
-                               get { return eventSink; }
-                       }
-               }
-               #endif
-
-               internal bool IsClosed {
-                       get { return _SslState.IsClosed; }
-               }
-
-               internal Exception LastError {
-                       get { return lastError; }
-               }
-
-               #region IMonoTlsEventSink
-
-               Exception lastError;
-
-               void IMonoTlsEventSink.Error (Exception exception)
-               {
-                       Interlocked.CompareExchange<Exception> (ref lastError, exception, null);
-               }
-
-               void IMonoTlsEventSink.ReceivedCloseNotify ()
-               {
-               }
-
-               #endregion
-
-               internal IAsyncResult BeginShutdown (AsyncCallback asyncCallback, object asyncState)
-               {
-                       return _SslState.BeginShutdown (asyncCallback, asyncState);
-               }
-
-               internal void EndShutdown (IAsyncResult asyncResult)
-               {
-                       _SslState.EndShutdown (asyncResult);
-               }
-
-               internal IAsyncResult BeginRenegotiate (AsyncCallback asyncCallback, object asyncState)
-               {
-                       return _SslState.BeginRenegotiate (asyncCallback, asyncState);
-               }
-
-               internal void EndRenegotiate (IAsyncResult asyncResult)
-               {
-                       _SslState.EndRenegotiate (asyncResult);
-               }
-
-               internal X509Certificate InternalLocalCertificate {
-                       get { return _SslState.InternalLocalCertificate; }
-               }
-
-               internal MonoTlsConnectionInfo GetMonoConnectionInfo ()
-               {
-                       return _SslState.GetMonoConnectionInfo ();
-               }
-       }
-}
-#endif
diff --git a/mcs/class/System/ReferenceSources/_SecureChannel.cs b/mcs/class/System/ReferenceSources/_SecureChannel.cs
deleted file mode 100644 (file)
index f920353..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-//
-// Mono-specific additions to Microsoft's _SecureChannel.cs
-//
-#if MONO_FEATURE_NEW_TLS && SECURITY_DEP
-#if MONO_SECURITY_ALIAS
-extern alias MonoSecurity;
-using MonoSecurity::Mono.Security.Interface;
-#else
-using Mono.Security.Interface;
-#endif
-namespace System.Net.Security
-{
-       partial class SecureChannel
-       {
-               internal MonoTlsConnectionInfo GetMonoConnectionInfo ()
-               {
-                       return SSPIWrapper.GetMonoConnectionInfo (m_SecModule, m_SecurityContext);
-               }
-
-               internal ProtocolToken CreateShutdownMessage ()
-               {
-                       var buffer = SSPIWrapper.CreateShutdownMessage (m_SecModule, m_SecurityContext);
-                       return new ProtocolToken (buffer, SecurityStatus.ContinueNeeded);
-               }
-
-               internal ProtocolToken CreateHelloRequestMessage ()
-               {
-                       var buffer = SSPIWrapper.CreateHelloRequestMessage (m_SecModule, m_SecurityContext);
-                       return new ProtocolToken (buffer, SecurityStatus.ContinueNeeded);
-               }
-
-               internal bool IsClosed {
-                       get {
-                               if (m_SecModule == null || m_SecurityContext == null || m_SecurityContext.IsClosed)
-                                       return true;
-                               return SSPIWrapper.IsClosed (m_SecModule, m_SecurityContext);
-                       }
-               }
-       }
-}
-#endif
diff --git a/mcs/class/System/ReferenceSources/_SslState.cs b/mcs/class/System/ReferenceSources/_SslState.cs
deleted file mode 100644 (file)
index 8d5ae3f..0000000
+++ /dev/null
@@ -1,141 +0,0 @@
-//
-// Mono-specific additions to Microsoft's _SslState.cs
-//
-#if MONO_FEATURE_NEW_TLS && SECURITY_DEP
-#if MONO_SECURITY_ALIAS
-extern alias MonoSecurity;
-using MonoSecurity::Mono.Security.Interface;
-#else
-using Mono.Security.Interface;
-#endif
-namespace System.Net.Security
-{
-       using System.IO;
-       using System.Threading;
-       using System.Net.Sockets;
-
-       partial class SslState
-       {
-               int _SentShutdown;
-
-               internal MonoTlsConnectionInfo GetMonoConnectionInfo ()
-               {
-                       return Context.GetMonoConnectionInfo ();
-               }
-
-               internal bool IsClosed {
-                       get { return Context.IsClosed; }
-               }
-
-               internal ProtocolToken CreateShutdownMessage ()
-               {
-                       return Context.CreateShutdownMessage ();
-               }
-
-               internal ProtocolToken CreateHelloRequestMessage ()
-               {
-                       return Context.CreateHelloRequestMessage ();
-               }
-
-               internal IAsyncResult BeginShutdown (AsyncCallback asyncCallback, object asyncState)
-               {
-                       var shutdownResult = new ShutdownAsyncResult (this, asyncState, asyncCallback);
-
-                       if (Interlocked.CompareExchange (ref _SentShutdown, 1, 0) == 1) {
-                               shutdownResult.InvokeCallback ();
-                               return shutdownResult;
-                       }
-
-                       try
-                       {
-                               CheckThrow (false);
-                               shutdownResult.SentShutdown = true;
-                               SecureStream.BeginShutdown (shutdownResult);
-                               return shutdownResult;
-                       } catch (Exception e) {
-                               if (e is IOException)
-                                       throw;
-                               throw new IOException (SR.GetString (SR.mono_net_io_shutdown), e);
-                       }
-               }
-
-               internal void EndShutdown (IAsyncResult asyncResult)
-               {
-                       if (asyncResult == null)
-                               throw new ArgumentNullException ("asyncResult");
-
-                       var shutdownResult = asyncResult as ShutdownAsyncResult;
-                       if (shutdownResult == null)
-                               throw new ArgumentException (SR.GetString (SR.net_io_async_result, asyncResult.GetType ().FullName), "asyncResult");
-
-                       if (shutdownResult.SentShutdown)
-                               SecureStream.EndShutdown (shutdownResult);
-               }
-
-               internal IAsyncResult BeginRenegotiate (AsyncCallback asyncCallback, object asyncState)
-               {
-                       var lazyResult = new LazyAsyncResult (this, asyncState, asyncCallback);
-
-                       if (Interlocked.Exchange (ref _NestedAuth, 1) == 1)
-                               throw new InvalidOperationException (SR.GetString (SR.net_io_invalidnestedcall, "BeginRenegotiate", "renegotiate"));
-                       if (Interlocked.CompareExchange (ref _PendingReHandshake, 1, 0) == 1)
-                               throw new InvalidOperationException (SR.GetString (SR.net_io_invalidnestedcall, "BeginRenegotiate", "renegotiate"));
-
-                       try {
-                               CheckThrow (false);
-                               SecureStream.BeginRenegotiate (lazyResult);
-                               return lazyResult;
-                       } catch (Exception e) {
-                               _NestedAuth = 0;
-                               if (e is IOException)
-                                       throw;
-                               throw new IOException (SR.GetString (SR.mono_net_io_renegotiate), e);
-                       }
-               }
-
-               internal void EndRenegotiate (IAsyncResult result)
-               {
-                       if (result == null)
-                               throw new ArgumentNullException ("asyncResult");
-
-                       LazyAsyncResult lazyResult = result as LazyAsyncResult;
-                       if (lazyResult == null)
-                               throw new ArgumentException (SR.GetString (SR.net_io_async_result, result.GetType ().FullName), "asyncResult");
-
-                       if (Interlocked.Exchange (ref _NestedAuth, 0) == 0)
-                               throw new InvalidOperationException (SR.GetString (SR.net_io_invalidendcall, "EndRenegotiate"));
-
-                       SecureStream.EndRenegotiate (lazyResult);
-               }
-
-               internal bool CheckEnqueueHandshakeWrite (byte[] buffer, AsyncProtocolRequest asyncRequest)
-               {
-                       return CheckEnqueueHandshake (buffer, asyncRequest);
-               }
-
-               internal void StartReHandshake (AsyncProtocolRequest asyncRequest)
-               {
-                       if (IsServer) {
-                               byte[] buffer = null;
-                               if (CheckEnqueueHandshakeRead (ref buffer, asyncRequest))
-                                       return;
-
-                               StartReceiveBlob (buffer, asyncRequest);
-                               return;
-                       }
-
-                       ForceAuthentication (false, null, asyncRequest);
-               }
-
-               class ShutdownAsyncResult : LazyAsyncResult
-               {
-                       public bool SentShutdown;
-
-                       internal ShutdownAsyncResult (SslState instance, object userState, AsyncCallback callback)
-                               : base (instance, userState, callback)
-                       {
-                       }
-               }
-       }
-}
-#endif
diff --git a/mcs/class/System/ReferenceSources/_SslStream.cs b/mcs/class/System/ReferenceSources/_SslStream.cs
deleted file mode 100644 (file)
index 591b74a..0000000
+++ /dev/null
@@ -1,230 +0,0 @@
-//
-// Mono-specific additions to Microsoft's _SslStream.cs
-//
-#if MONO_FEATURE_NEW_TLS && SECURITY_DEP
-namespace System.Net.Security
-{
-       using System.IO;
-       using System.Threading;
-       using System.Net.Sockets;
-
-       partial class _SslStream
-       {
-               static readonly AsyncCallback _HandshakeWriteCallback = new AsyncCallback (HandshakeWriteCallback);
-               static readonly HandshakeProtocolCallback _ResumeHandshakeWriteCallback = new HandshakeProtocolCallback (ResumeHandshakeWriteCallback);
-
-               internal void BeginShutdown (LazyAsyncResult lazyResult)
-               {
-                       HandshakeProtocolRequest asyncRequest = new HandshakeProtocolRequest (lazyResult);
-
-                       if (Interlocked.Exchange (ref _NestedWrite, 1) == 1)
-                               throw new NotSupportedException (SR.GetString (SR.net_io_invalidnestedcall, (asyncRequest != null ? "BeginShutdown" : "Shutdown"), "shutdown"));
-
-                       bool failed = false;
-                       try
-                       {
-                               ProtocolToken message = _SslState.CreateShutdownMessage ();
-                               asyncRequest.SetNextRequest (HandshakeProtocolState.Shutdown, message, _ResumeHandshakeWriteCallback);
-
-                               StartHandshakeWrite (asyncRequest);
-                       } catch (Exception e) {
-                               _SslState.FinishWrite ();
-                               failed = true;
-                               throw;
-                       } finally {
-                               if (failed)
-                                       _NestedWrite = 0;
-                       }
-               }
-
-               internal void EndShutdown (LazyAsyncResult lazyResult)
-               {
-                       if (Interlocked.Exchange (ref _NestedWrite, 0) == 0)
-                               throw new InvalidOperationException (SR.GetString (SR.net_io_invalidendcall, "EndShutdown"));
-
-                       // No "artificial" timeouts implemented so far, InnerStream controls timeout.
-                       lazyResult.InternalWaitForCompletion ();
-
-                       if (lazyResult.Result is Exception) {
-                               if (lazyResult.Result is IOException)
-                                       throw (Exception)lazyResult.Result;
-                               throw new IOException (SR.GetString (SR.mono_net_io_shutdown), (Exception)lazyResult.Result);
-                       }
-               }
-
-               internal void BeginRenegotiate (LazyAsyncResult lazyResult)
-               {
-                       HandshakeProtocolRequest asyncRequest = new HandshakeProtocolRequest (lazyResult);
-
-                       if (Interlocked.Exchange (ref _NestedWrite, 1) == 1)
-                               throw new NotSupportedException (SR.GetString (SR.net_io_invalidnestedcall, (asyncRequest != null ? "BeginRenegotiate" : "Renegotiate"), "renegotiate"));
-
-                       bool failed = false;
-                       try
-                       {
-                               if (_SslState.IsServer) {
-                                       ProtocolToken message = _SslState.CreateHelloRequestMessage ();
-                                       asyncRequest.SetNextRequest (HandshakeProtocolState.SendHelloRequest, message, _ResumeHandshakeWriteCallback);
-                               } else {
-                                       asyncRequest.SetNextRequest (HandshakeProtocolState.ClientRenegotiation, null, _ResumeHandshakeWriteCallback);
-                               }
-
-                               StartHandshakeWrite (asyncRequest);
-                       } catch (Exception e) {
-                               _SslState.FinishWrite ();
-                               failed = true;
-                               throw;
-                       } finally {
-                               if (failed)
-                                       _NestedWrite = 0;
-                       }
-               }
-
-               internal void EndRenegotiate (LazyAsyncResult lazyResult)
-               {
-                       if (Interlocked.Exchange (ref _NestedWrite, 0) == 0)
-                               throw new InvalidOperationException (SR.GetString (SR.net_io_invalidendcall, "EndRenegotiate"));
-
-                       // No "artificial" timeouts implemented so far, InnerStream controls timeout.
-                       lazyResult.InternalWaitForCompletion();
-
-                       if (lazyResult.Result is Exception) {
-                               if (lazyResult.Result is IOException)
-                                       throw (Exception)lazyResult.Result;
-                               throw new IOException (SR.GetString (SR.mono_net_io_renegotiate), (Exception)lazyResult.Result);
-                       }
-               }
-
-               void StartHandshakeWrite (HandshakeProtocolRequest asyncRequest)
-               {
-                       byte[] buffer = null;
-                       if (asyncRequest.Message != null) {
-                               buffer = asyncRequest.Message.Payload;
-                               if (buffer.Length != asyncRequest.Message.Size) {
-                                       buffer = new byte [asyncRequest.Message.Size];
-                                       Buffer.BlockCopy (asyncRequest.Message.Payload, 0, buffer, 0, buffer.Length);
-                               }
-                       }
-
-                       switch (asyncRequest.State) {
-                       case HandshakeProtocolState.ClientRenegotiation:
-                       case HandshakeProtocolState.ServerRenegotiation:
-                               _SslState.StartReHandshake (asyncRequest);
-                               return;
-
-                       case HandshakeProtocolState.SendHelloRequest:
-                               if (_SslState.CheckEnqueueHandshakeWrite (buffer, asyncRequest)) {
-                                       // operation is async and has been queued, return.
-                                       return;
-                               }
-                               break;
-
-                       case HandshakeProtocolState.Shutdown:
-                               if (_SslState.CheckEnqueueWrite (asyncRequest)) {
-                                       // operation is async and has been queued, return.
-                                       return;
-                               }
-                               break;
-
-                       default:
-                               throw new InvalidOperationException ();
-                       }
-
-                       if (_SslState.LastPayload != null)
-                               throw new InvalidOperationException ();
-
-                       // prepare for the next request
-                       IAsyncResult ar = ((NetworkStream)_SslState.InnerStream).BeginWrite (buffer, 0, buffer.Length, _HandshakeWriteCallback, asyncRequest);
-                       if (!ar.CompletedSynchronously)
-                               return;
-
-                       HandshakeWriteCallback (asyncRequest, ar);
-               }
-
-               static void HandshakeWriteCallback (IAsyncResult transportResult)
-               {
-                       if (transportResult.CompletedSynchronously)
-                               return;
-
-                       HandshakeProtocolRequest asyncRequest = (HandshakeProtocolRequest)transportResult.AsyncState;
-
-                       SslState sslState = (SslState)asyncRequest.AsyncObject;
-                       sslState.SecureStream.HandshakeWriteCallback (asyncRequest, transportResult);
-               }
-
-               void HandshakeWriteCallback (HandshakeProtocolRequest asyncRequest, IAsyncResult transportResult)
-               {
-                       try {
-                               _SslState.InnerStream.EndWrite (transportResult);
-                       } catch (Exception e) {
-                               _SslState.FinishWrite ();
-                               if (!asyncRequest.IsUserCompleted) {
-                                       asyncRequest.CompleteWithError (e);
-                                       return;
-                               }
-                               throw;
-                       }
-
-                       if (asyncRequest.State == HandshakeProtocolState.SendHelloRequest) {
-                               asyncRequest.SetNextRequest (HandshakeProtocolState.ServerRenegotiation, null, _ResumeHandshakeWriteCallback);
-                               StartHandshakeWrite (asyncRequest);
-                               return;
-                       }
-
-                       try {
-                               _SslState.FinishWrite ();
-                               asyncRequest.CompleteUser ();
-                       } catch (Exception e) {
-                               if (!asyncRequest.IsUserCompleted) {
-                                       asyncRequest.CompleteWithError (e);
-                                       return;
-                               }
-                               throw;
-                       }
-               }
-
-               static void ResumeHandshakeWriteCallback (HandshakeProtocolRequest asyncRequest)
-               {
-                       try {
-                               ((_SslStream)asyncRequest.AsyncObject).StartHandshakeWrite (asyncRequest);
-                       } catch (Exception e) {
-                               if (asyncRequest.IsUserCompleted) {
-                                       // This will throw on a worker thread.
-                                       throw;
-                               }
-                               ((_SslStream)asyncRequest.AsyncObject)._SslState.FinishWrite ();
-                               asyncRequest.CompleteWithError (e);
-                       }
-               }
-
-               delegate void HandshakeProtocolCallback (HandshakeProtocolRequest asyncRequest);
-
-               enum HandshakeProtocolState {
-                       None,
-                       Shutdown,
-                       SendHelloRequest,
-                       ServerRenegotiation,
-                       ClientRenegotiation
-               }
-
-               class HandshakeProtocolRequest : AsyncProtocolRequest
-               {
-                       public ProtocolToken Message;
-                       public HandshakeProtocolState State;
-
-                       public HandshakeProtocolRequest (LazyAsyncResult userAsyncResult)
-                               : base (userAsyncResult)
-                       {
-                               State = HandshakeProtocolState.None;
-                       }
-
-                       public void SetNextRequest (HandshakeProtocolState state, ProtocolToken message, HandshakeProtocolCallback callback)
-                       {
-                               State = state;
-                               Message = message;
-                               SetNextRequest (null, 0, 0, (r) => callback ((HandshakeProtocolRequest)r));
-                       }
-               }
-       }
-}
-#endif
index e748039ef2bb842653822fea1bbc110e9e04ed75..40c5df098af3cfbd73a090ecac7874bb2683afb5 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -7,7 +8,7 @@
     <SchemaVersion>2.0</SchemaVersion>\r
     <ProjectGuid>{483DB7F6-9145-4AE2-B9B2-2B5EE6FDEFB4}</ProjectGuid>\r
     <OutputType>Library</OutputType>\r
-    <NoWarn>1699,618</NoWarn>\r
+    <NoWarn>1699</NoWarn>\r
     <OutputPath>./../../class/lib/net_4_x/bare</OutputPath>\r
     <IntermediateOutputPath>obj-bare</IntermediateOutputPath>\r
     <GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>\r
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
     <DebugSymbols>true</DebugSymbols>\r
     <DebugType>full</DebugType>\r
-    <NoWarn>1699,618</NoWarn>\r
+    <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;CONFIGURATION_2_0;FEATURE_PAL;SYSTEM_NAMESPACE;MONO;PLATFORM_UNIX;MONO_FEATURE_PROCESS_START;MONO_FEATURE_THREAD_ABORT;MONO_FEATURE_THREAD_SUSPEND_RESUME;MONO_FEATURE_MULTIPLE_APPDOMAINS</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;CONFIGURATION_2_0;FEATURE_PAL;SYSTEM_NAMESPACE;MONO;PLATFORM_UNIX;MONO_FEATURE_PROCESS_START;MONO_FEATURE_THREAD_ABORT;MONO_FEATURE_THREAD_SUSPEND_RESUME;MONO_FEATURE_MULTIPLE_APPDOMAINS;MONO_FEATURE_BTLS</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">\r
     <DebugType>pdbonly</DebugType>\r
-    <NoWarn>1699,618</NoWarn>\r
+    <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;CONFIGURATION_2_0;FEATURE_PAL;SYSTEM_NAMESPACE;MONO;PLATFORM_UNIX;MONO_FEATURE_PROCESS_START;MONO_FEATURE_THREAD_ABORT;MONO_FEATURE_THREAD_SUSPEND_RESUME;MONO_FEATURE_MULTIPLE_APPDOMAINS</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;CONFIGURATION_2_0;FEATURE_PAL;SYSTEM_NAMESPACE;MONO;PLATFORM_UNIX;MONO_FEATURE_PROCESS_START;MONO_FEATURE_THREAD_ABORT;MONO_FEATURE_THREAD_SUSPEND_RESUME;MONO_FEATURE_MULTIPLE_APPDOMAINS;MONO_FEATURE_BTLS</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
     <Compile Include="..\referencesource\System\net\System\Net\_ProxyChain.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\_ScatterGatherBuffers.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\_Semaphore.cs" />\r
+    <Compile Include="..\referencesource\System\net\System\Net\_ServiceNameStore.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\_TimerThread.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\_WebProxyDataBuilder.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\AuthenticationScheme.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\mail\TransferEncoding.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\mail\WriteStateInfoBase.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\NetworkAccess.cs" />\r
+    <Compile Include="..\referencesource\System\net\System\Net\NetworkCredential.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\NetworkInformation\DuplicateAddressDetectionState.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\NetworkInformation\GatewayIPAddressInformation.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\NetworkInformation\GatewayIPAddressInformationCollection.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\NetworkInformation\SystemIPAddressInformation.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\NetworkInformation\SystemMulticastIPAddressInformation.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\NetworkInformation\SystemTcpConnection.cs" />\r
-    <Compile Include="..\referencesource\System\net\System\Net\NetworkInformation\SystemUnicastIPAddressInformation.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\NetworkInformation\TcpConnection.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\NetworkInformation\TcpState.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\NetworkInformation\TcpStatistics.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\ServicePointManager.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\SocketAddress.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\SocketException.cs" />\r
+    <Compile Include="..\referencesource\System\net\System\Net\Sockets\_MultipleConnectAsync.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\Sockets\AddressFamily.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\Sockets\IOControlCode.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\Sockets\IPPacketInformation.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\Sockets\ProtocolFamily.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\Sockets\ProtocolType.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\Sockets\SelectMode.cs" />\r
+    <Compile Include="..\referencesource\System\net\System\Net\Sockets\Socket.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\Sockets\SocketErrors.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\Sockets\SocketFlags.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\Sockets\SocketInformation.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\Sockets\SocketOptionName.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\Sockets\SocketShutdown.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\Sockets\SocketType.cs" />\r
+    <Compile Include="..\referencesource\System\net\System\Net\Sockets\TCPClient.cs" />\r
+    <Compile Include="..\referencesource\System\net\System\Net\Sockets\TCPListener.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\Sockets\TransmitFileFlags.cs" />\r
+    <Compile Include="..\referencesource\System\net\System\Net\Sockets\UDPClient.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\Sockets\UdpReceiveResult.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\TransportContext.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\TransportType.cs" />\r
     <Compile Include="..\referencesource\System\regex\system\text\regularexpressions\RegexRunnerFactory.cs" />\r
     <Compile Include="..\referencesource\System\regex\system\text\regularexpressions\RegexTree.cs" />\r
     <Compile Include="..\referencesource\System\regex\system\text\regularexpressions\RegexWriter.cs" />\r
+    <Compile Include="..\referencesource\System\security\system\security\Authentication\ExtendedProtection\ServiceNameCollection.cs" />\r
     <Compile Include="..\referencesource\System\security\system\security\Authentication\ExtendedProtection\TokenBinding.cs" />\r
     <Compile Include="..\referencesource\System\security\system\security\cryptography\oid.cs" />\r
     <Compile Include="..\referencesource\System\security\system\security\cryptography\x509\x509utils.cs" />\r
     <Compile Include="..\referencesource\System\security\system\security\permissions\typedescriptorpermission.cs" />\r
     <Compile Include="..\referencesource\System\services\monitoring\system\diagnosticts\AsyncStreamReader.cs" />\r
     <Compile Include="..\referencesource\System\services\monitoring\system\diagnosticts\Process.cs" />\r
+    <Compile Include="..\referencesource\System\services\monitoring\system\diagnosticts\ProcessModuleCollection.cs" />\r
     <Compile Include="..\referencesource\System\services\monitoring\system\diagnosticts\ProcessStartInfo.cs" />\r
+    <Compile Include="..\referencesource\System\services\monitoring\system\diagnosticts\ProcessThreadCollection.cs" />\r
     <Compile Include="..\referencesource\System\services\monitoring\system\diagnosticts\processwaithandle.cs" />\r
     <Compile Include="..\referencesource\System\services\timers\system\timers\ElapsedEventHandler.cs" />\r
     <Compile Include="..\referencesource\System\services\timers\system\timers\Timer.cs" />\r
     <Compile Include="..\referencesource\System\services\timers\system\timers\TimersDescriptionAttribute.cs" />\r
     <Compile Include="..\referencesource\System\sys\system\collections\concurrent\BlockingCollection.cs" />\r
     <Compile Include="..\referencesource\System\sys\system\collections\concurrent\ConcurrentBag.cs" />\r
+    <Compile Include="..\referencesource\System\sys\system\Diagnostics\CodeAnalysis\ExcludeFromCodeCoverageAttribute.cs" />\r
     <Compile Include="..\referencesource\System\sys\system\IO\ports\InternalResources.cs" />\r
     <Compile Include="..\referencesource\System\sys\system\runtime\interopservices\DefaultParameterValueAttribute.cs" />\r
     <Compile Include="..\referencesource\System\sys\system\runtime\interopservices\handlecollector.cs" />\r
     <Compile Include="Microsoft.VisualBasic\VBCodeCompiler.cs" />\r
     <Compile Include="Microsoft.VisualBasic\VBCodeGenerator.cs" />\r
     <Compile Include="Microsoft.VisualBasic\VBCodeProvider.cs" />\r
+    <Compile Include="Microsoft.Win32.SafeHandles\SafeX509ChainHandle.cs" />\r
     <Compile Include="Microsoft.Win32\IntranetZoneCredentialPolicy.cs" />\r
     <Compile Include="Microsoft.Win32\PowerModeChangedEventArgs.cs" />\r
     <Compile Include="Microsoft.Win32\PowerModeChangedEventHandler.cs" />\r
     <Compile Include="Microsoft.Win32\UserPreferenceChangedEventHandler.cs" />\r
     <Compile Include="Microsoft.Win32\UserPreferenceChangingEventArgs.cs" />\r
     <Compile Include="Microsoft.Win32\UserPreferenceChangingEventHandler.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsBio.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsContext.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsError.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsException.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsKey.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsObject.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsPkcs12.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsProvider.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsSsl.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsSslCtx.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsSslError.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsStream.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsUtils.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsX509.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsX509Chain.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsX509Crl.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsX509Error.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsX509Exception.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsX509FileType.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsX509Format.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsX509Lookup.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsX509LookupMono.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsX509LookupMonoCollection.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsX509LookupType.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsX509Name.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsX509NameEntryType.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsX509Purpose.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsX509Revoked.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsX509Store.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsX509StoreCtx.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsX509StoreManager.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsX509StoreType.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsX509TrustKind.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsX509VerifyFlags.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsX509VerifyParam.cs" />\r
+    <Compile Include="Mono.Btls\X509CertificateImplBtls.cs" />\r
+    <Compile Include="Mono.Btls\X509ChainImplBtls.cs" />\r
     <Compile Include="Mono.Http\NtlmClient.cs" />\r
     <Compile Include="Mono.Net.Dns\DnsClass.cs" />\r
     <Compile Include="Mono.Net.Dns\DnsHeader.cs" />\r
     <Compile Include="Mono.Net.Dns\ResolverError.cs" />\r
     <Compile Include="Mono.Net.Dns\SimpleResolver.cs" />\r
     <Compile Include="Mono.Net.Dns\SimpleResolverEventArgs.cs" />\r
+    <Compile Include="Mono.Net.Security\AsyncProtocolRequest.cs" />\r
     <Compile Include="Mono.Net.Security\CallbackHelpers.cs" />\r
     <Compile Include="Mono.Net.Security\ChainValidationHelper.cs" />\r
     <Compile Include="Mono.Net.Security\IMonoSslStream.cs" />\r
     <Compile Include="Mono.Net.Security\IMonoTlsProvider.cs" />\r
     <Compile Include="Mono.Net.Security\LegacySslStream.cs" />\r
-    <Compile Include="Mono.Net.Security\MonoDefaultTlsProvider.cs" />\r
+    <Compile Include="Mono.Net.Security\LegacyTlsProvider.cs" />\r
+    <Compile Include="Mono.Net.Security\MobileAuthenticatedStream.cs" />\r
+    <Compile Include="Mono.Net.Security\MobileTlsContext.cs" />\r
     <Compile Include="Mono.Net.Security\MonoSslStreamImpl.cs" />\r
     <Compile Include="Mono.Net.Security\MonoSslStreamWrapper.cs" />\r
     <Compile Include="Mono.Net.Security\MonoTlsProviderFactory.cs" />\r
-    <Compile Include="Mono.Net.Security\MonoTlsProviderImpl.cs" />\r
     <Compile Include="Mono.Net.Security\MonoTlsProviderWrapper.cs" />\r
     <Compile Include="Mono.Net.Security\MonoTlsStream.cs" />\r
     <Compile Include="Mono.Net.Security\NoReflectionHelper.cs" />\r
     <Compile Include="Mono.Net.Security\SystemCertificateValidator.cs" />\r
-    <Compile Include="ReferenceSources\_SecureChannel.cs" />\r
-    <Compile Include="ReferenceSources\_SslState.cs" />\r
-    <Compile Include="ReferenceSources\_SslStream.cs" />\r
     <Compile Include="ReferenceSources\AssertWrapper.cs" />\r
     <Compile Include="ReferenceSources\AutoWebProxyScriptEngine.cs" />\r
     <Compile Include="ReferenceSources\BinaryCompatibility.cs" />\r
     <Compile Include="ReferenceSources\EnvironmentHelpers.cs" />\r
     <Compile Include="ReferenceSources\HttpApi.cs" />\r
     <Compile Include="ReferenceSources\HttpSysSettings.cs" />\r
-    <Compile Include="ReferenceSources\Internal.cs" />\r
+    <Compile Include="ReferenceSources\LocalAppContextSwitches.cs" />\r
     <Compile Include="ReferenceSources\Logging.cs" />\r
     <Compile Include="ReferenceSources\NativeMethods.cs" />\r
     <Compile Include="ReferenceSources\RequestCacheProtocol.cs" />\r
+    <Compile Include="ReferenceSources\SecureStringHelper.cs" />\r
     <Compile Include="ReferenceSources\SettingsSectionInternal.cs" />\r
     <Compile Include="ReferenceSources\Socket.cs" />\r
     <Compile Include="ReferenceSources\SR.cs" />\r
     <Compile Include="ReferenceSources\SR2.cs" />\r
     <Compile Include="ReferenceSources\SRCategoryAttribute.cs" />\r
-    <Compile Include="ReferenceSources\SslStream.cs" />\r
-    <Compile Include="ReferenceSources\SSPIConfiguration.cs" />\r
-    <Compile Include="ReferenceSources\SSPISafeHandles.cs" />\r
-    <Compile Include="ReferenceSources\SSPIWrapper.cs" />\r
     <Compile Include="ReferenceSources\Win32Exception.cs" />\r
     <Compile Include="System.CodeDom.Compiler\CodeCompiler.cs" />\r
     <Compile Include="System.CodeDom.Compiler\CodeDomConfigurationHandler.cs" />\r
     <Compile Include="System.Configuration\UriSection.cs" />\r
     <Compile Include="System.Configuration\UserScopedSettingAttribute.cs" />\r
     <Compile Include="System.Configuration\UserSettingsGroup.cs" />\r
-    <Compile Include="System.Diagnostics.CodeAnalysis\ExcludeFromCodeCoverageAttribute.cs" />\r
     <Compile Include="System.Diagnostics\AlphabeticalEnumConverter.cs" />\r
     <Compile Include="System.Diagnostics\CounterCreationData.cs" />\r
     <Compile Include="System.Diagnostics\CounterCreationDataCollection.cs" />\r
     <Compile Include="System.Diagnostics\PerformanceCounterType.cs" />\r
     <Compile Include="System.Diagnostics\Process.cs" />\r
     <Compile Include="System.Diagnostics\ProcessModule.cs" />\r
-    <Compile Include="System.Diagnostics\ProcessModuleCollection.cs" />\r
     <Compile Include="System.Diagnostics\ProcessPriorityClass.cs" />\r
     <Compile Include="System.Diagnostics\ProcessStartInfo.cs" />\r
     <Compile Include="System.Diagnostics\ProcessThread.cs" />\r
-    <Compile Include="System.Diagnostics\ProcessThreadCollection.cs" />\r
     <Compile Include="System.Diagnostics\ProcessWindowStyle.cs" />\r
     <Compile Include="System.Diagnostics\Stopwatch.cs" />\r
     <Compile Include="System.Diagnostics\ThreadPriorityLevel.cs" />\r
     <Compile Include="System.Net.Security\SslPolicyErrors.cs" />\r
     <Compile Include="System.Net.Security\SslStream.cs" />\r
     <Compile Include="System.Net.Sockets\SafeSocketHandle.cs" />\r
-    <Compile Include="System.Net.Sockets\SendPacketsElement.cs" />\r
     <Compile Include="System.Net.Sockets\Socket.cs" />\r
     <Compile Include="System.Net.Sockets\SocketAsyncEventArgs.cs" />\r
-    <Compile Include="System.Net.Sockets\SocketAsyncOperation.cs" />\r
     <Compile Include="System.Net.Sockets\SocketAsyncResult.cs" />\r
     <Compile Include="System.Net.Sockets\SocketOperation.cs" />\r
-    <Compile Include="System.Net.Sockets\TcpClient.cs" />\r
-    <Compile Include="System.Net.Sockets\TcpListener.cs" />\r
-    <Compile Include="System.Net.Sockets\UdpClient.cs" />\r
+    <Compile Include="System.Net.Sockets\SocketReceiveFromResult.cs" />\r
+    <Compile Include="System.Net.Sockets\SocketReceiveMessageFromResult.cs" />\r
+    <Compile Include="System.Net.Sockets\SocketTaskExtensions.cs" />\r
     <Compile Include="System.Net.WebSockets\ClientWebSocket.cs" />\r
     <Compile Include="System.Net.WebSockets\ClientWebSocketOptions.cs" />\r
     <Compile Include="System.Net.WebSockets\HttpListenerWebSocketContext.cs" />\r
     <Compile Include="System.Net\HttpListenerPrefixCollection.cs" />\r
     <Compile Include="System.Net\HttpListenerRequest.cs" />\r
     <Compile Include="System.Net\HttpListenerResponse.cs" />\r
+    <Compile Include="System.Net\HttpListenerResponseHelper.cs" />\r
     <Compile Include="System.Net\HttpListenerTimeoutManager.cs" />\r
     <Compile Include="System.Net\HttpRequestCreator.cs" />\r
     <Compile Include="System.Net\HttpStreamAsyncResult.cs" />\r
     <Compile Include="System.Net\MacProxy.cs" />\r
     <Compile Include="System.Net\MonoHttpDate.cs" />\r
     <Compile Include="System.Net\NetConfig.cs" />\r
-    <Compile Include="System.Net\NetworkCredential.cs" />\r
     <Compile Include="System.Net\NtlmClient.cs" />\r
     <Compile Include="System.Net\RequestStream.cs" />\r
     <Compile Include="System.Net\ResponseStream.cs" />\r
     <Compile Include="System.Security.Authentication.ExtendedProtection\ExtendedProtectionPolicyTypeConverter.cs" />\r
     <Compile Include="System.Security.Authentication.ExtendedProtection\PolicyEnforcement.cs" />\r
     <Compile Include="System.Security.Authentication.ExtendedProtection\ProtectionScenario.cs" />\r
-    <Compile Include="System.Security.Authentication.ExtendedProtection\ServiceNameCollection.cs" />\r
     <Compile Include="System.Security.Authentication\AuthenticationException.cs" />\r
     <Compile Include="System.Security.Authentication\CipherAlgorithmType.cs" />\r
     <Compile Include="System.Security.Authentication\ExchangeAlgorithmType.cs" />\r
     <Compile Include="System.Security.Cryptography.X509Certificates\X509Certificate2Impl.cs" />\r
     <Compile Include="System.Security.Cryptography.X509Certificates\X509Certificate2ImplMono.cs" />\r
     <Compile Include="System.Security.Cryptography.X509Certificates\X509CertificateCollection.cs" />\r
+    <Compile Include="System.Security.Cryptography.X509Certificates\X509CertificateImplCollection.cs" />\r
     <Compile Include="System.Security.Cryptography.X509Certificates\X509Chain.cs" />\r
     <Compile Include="System.Security.Cryptography.X509Certificates\X509ChainElement.cs" />\r
     <Compile Include="System.Security.Cryptography.X509Certificates\X509ChainElementCollection.cs" />\r
     <Compile Include="System.Web\AspNetHostingPermissionLevel.cs" />\r
     <Compile Include="System.Windows.Input\ICommand.cs" />\r
     <Compile Include="System\IOSelector.cs" />\r
+    <Compile Include="System\MonoToolsLocator.cs" />\r
     <Compile Include="System\Platform.cs" />\r
     <Compile Include="System\SRDescriptionAttribute.cs" />\r
     <Compile Include="System\UriTypeConverter.cs" />\r  </ItemGroup>\r
index fbd51bbfd99f4a6fd2f5a0ffd49d191a29b2e70d..c02b60fcc01de334d5140209855d985ac79eec67 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -7,7 +8,7 @@
     <SchemaVersion>2.0</SchemaVersion>\r
     <ProjectGuid>{2762E921-91A8-4C87-91E9-BA628013F753}</ProjectGuid>\r
     <OutputType>Library</OutputType>\r
-    <NoWarn>1699,618</NoWarn>\r
+    <NoWarn>1699</NoWarn>\r
     <OutputPath>./../../class/lib/net_4_x</OutputPath>\r
     <IntermediateOutputPath>obj-net_4_x</IntermediateOutputPath>\r
     <GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>\r
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
     <DebugSymbols>true</DebugSymbols>\r
     <DebugType>full</DebugType>\r
-    <NoWarn>1699,618</NoWarn>\r
+    <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;CONFIGURATION_2_0;FEATURE_PAL;SYSTEM_NAMESPACE;MONO;PLATFORM_UNIX;MONO_FEATURE_PROCESS_START;MONO_FEATURE_THREAD_ABORT;MONO_FEATURE_THREAD_SUSPEND_RESUME;MONO_FEATURE_MULTIPLE_APPDOMAINS;SECURITY_DEP;XML_DEP;MONO_SECURITY_ALIAS;CONFIGURATION_DEP</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;CONFIGURATION_2_0;FEATURE_PAL;SYSTEM_NAMESPACE;MONO;PLATFORM_UNIX;MONO_FEATURE_PROCESS_START;MONO_FEATURE_THREAD_ABORT;MONO_FEATURE_THREAD_SUSPEND_RESUME;MONO_FEATURE_MULTIPLE_APPDOMAINS;MONO_FEATURE_BTLS;SECURITY_DEP;XML_DEP;MONO_SECURITY_ALIAS;CONFIGURATION_DEP</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">\r
     <DebugType>pdbonly</DebugType>\r
-    <NoWarn>1699,618</NoWarn>\r
+    <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;CONFIGURATION_2_0;FEATURE_PAL;SYSTEM_NAMESPACE;MONO;PLATFORM_UNIX;MONO_FEATURE_PROCESS_START;MONO_FEATURE_THREAD_ABORT;MONO_FEATURE_THREAD_SUSPEND_RESUME;MONO_FEATURE_MULTIPLE_APPDOMAINS;SECURITY_DEP;XML_DEP;MONO_SECURITY_ALIAS;CONFIGURATION_DEP</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;CONFIGURATION_2_0;FEATURE_PAL;SYSTEM_NAMESPACE;MONO;PLATFORM_UNIX;MONO_FEATURE_PROCESS_START;MONO_FEATURE_THREAD_ABORT;MONO_FEATURE_THREAD_SUSPEND_RESUME;MONO_FEATURE_MULTIPLE_APPDOMAINS;MONO_FEATURE_BTLS;SECURITY_DEP;XML_DEP;MONO_SECURITY_ALIAS;CONFIGURATION_DEP</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
     <Compile Include="..\referencesource\System\net\System\Net\_ProxyChain.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\_ScatterGatherBuffers.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\_Semaphore.cs" />\r
+    <Compile Include="..\referencesource\System\net\System\Net\_ServiceNameStore.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\_TimerThread.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\_WebProxyDataBuilder.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\AuthenticationScheme.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\mail\TransferEncoding.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\mail\WriteStateInfoBase.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\NetworkAccess.cs" />\r
+    <Compile Include="..\referencesource\System\net\System\Net\NetworkCredential.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\NetworkInformation\DuplicateAddressDetectionState.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\NetworkInformation\GatewayIPAddressInformation.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\NetworkInformation\GatewayIPAddressInformationCollection.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\NetworkInformation\SystemIPAddressInformation.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\NetworkInformation\SystemMulticastIPAddressInformation.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\NetworkInformation\SystemTcpConnection.cs" />\r
-    <Compile Include="..\referencesource\System\net\System\Net\NetworkInformation\SystemUnicastIPAddressInformation.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\NetworkInformation\TcpConnection.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\NetworkInformation\TcpState.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\NetworkInformation\TcpStatistics.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\ServicePointManager.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\SocketAddress.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\SocketException.cs" />\r
+    <Compile Include="..\referencesource\System\net\System\Net\Sockets\_MultipleConnectAsync.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\Sockets\AddressFamily.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\Sockets\IOControlCode.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\Sockets\IPPacketInformation.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\Sockets\ProtocolFamily.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\Sockets\ProtocolType.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\Sockets\SelectMode.cs" />\r
+    <Compile Include="..\referencesource\System\net\System\Net\Sockets\Socket.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\Sockets\SocketErrors.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\Sockets\SocketFlags.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\Sockets\SocketInformation.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\Sockets\SocketOptionName.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\Sockets\SocketShutdown.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\Sockets\SocketType.cs" />\r
+    <Compile Include="..\referencesource\System\net\System\Net\Sockets\TCPClient.cs" />\r
+    <Compile Include="..\referencesource\System\net\System\Net\Sockets\TCPListener.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\Sockets\TransmitFileFlags.cs" />\r
+    <Compile Include="..\referencesource\System\net\System\Net\Sockets\UDPClient.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\Sockets\UdpReceiveResult.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\TransportContext.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\TransportType.cs" />\r
     <Compile Include="..\referencesource\System\regex\system\text\regularexpressions\RegexRunnerFactory.cs" />\r
     <Compile Include="..\referencesource\System\regex\system\text\regularexpressions\RegexTree.cs" />\r
     <Compile Include="..\referencesource\System\regex\system\text\regularexpressions\RegexWriter.cs" />\r
+    <Compile Include="..\referencesource\System\security\system\security\Authentication\ExtendedProtection\ServiceNameCollection.cs" />\r
     <Compile Include="..\referencesource\System\security\system\security\Authentication\ExtendedProtection\TokenBinding.cs" />\r
     <Compile Include="..\referencesource\System\security\system\security\cryptography\oid.cs" />\r
     <Compile Include="..\referencesource\System\security\system\security\cryptography\x509\x509utils.cs" />\r
     <Compile Include="..\referencesource\System\security\system\security\permissions\typedescriptorpermission.cs" />\r
     <Compile Include="..\referencesource\System\services\monitoring\system\diagnosticts\AsyncStreamReader.cs" />\r
     <Compile Include="..\referencesource\System\services\monitoring\system\diagnosticts\Process.cs" />\r
+    <Compile Include="..\referencesource\System\services\monitoring\system\diagnosticts\ProcessModuleCollection.cs" />\r
     <Compile Include="..\referencesource\System\services\monitoring\system\diagnosticts\ProcessStartInfo.cs" />\r
+    <Compile Include="..\referencesource\System\services\monitoring\system\diagnosticts\ProcessThreadCollection.cs" />\r
     <Compile Include="..\referencesource\System\services\monitoring\system\diagnosticts\processwaithandle.cs" />\r
     <Compile Include="..\referencesource\System\services\timers\system\timers\ElapsedEventHandler.cs" />\r
     <Compile Include="..\referencesource\System\services\timers\system\timers\Timer.cs" />\r
     <Compile Include="..\referencesource\System\services\timers\system\timers\TimersDescriptionAttribute.cs" />\r
     <Compile Include="..\referencesource\System\sys\system\collections\concurrent\BlockingCollection.cs" />\r
     <Compile Include="..\referencesource\System\sys\system\collections\concurrent\ConcurrentBag.cs" />\r
+    <Compile Include="..\referencesource\System\sys\system\Diagnostics\CodeAnalysis\ExcludeFromCodeCoverageAttribute.cs" />\r
     <Compile Include="..\referencesource\System\sys\system\IO\ports\InternalResources.cs" />\r
     <Compile Include="..\referencesource\System\sys\system\runtime\interopservices\DefaultParameterValueAttribute.cs" />\r
     <Compile Include="..\referencesource\System\sys\system\runtime\interopservices\handlecollector.cs" />\r
     <Compile Include="Microsoft.VisualBasic\VBCodeCompiler.cs" />\r
     <Compile Include="Microsoft.VisualBasic\VBCodeGenerator.cs" />\r
     <Compile Include="Microsoft.VisualBasic\VBCodeProvider.cs" />\r
+    <Compile Include="Microsoft.Win32.SafeHandles\SafeX509ChainHandle.cs" />\r
     <Compile Include="Microsoft.Win32\IntranetZoneCredentialPolicy.cs" />\r
     <Compile Include="Microsoft.Win32\PowerModeChangedEventArgs.cs" />\r
     <Compile Include="Microsoft.Win32\PowerModeChangedEventHandler.cs" />\r
     <Compile Include="Microsoft.Win32\UserPreferenceChangedEventHandler.cs" />\r
     <Compile Include="Microsoft.Win32\UserPreferenceChangingEventArgs.cs" />\r
     <Compile Include="Microsoft.Win32\UserPreferenceChangingEventHandler.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsBio.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsContext.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsError.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsException.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsKey.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsObject.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsPkcs12.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsProvider.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsSsl.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsSslCtx.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsSslError.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsStream.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsUtils.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsX509.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsX509Chain.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsX509Crl.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsX509Error.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsX509Exception.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsX509FileType.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsX509Format.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsX509Lookup.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsX509LookupMono.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsX509LookupMonoCollection.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsX509LookupType.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsX509Name.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsX509NameEntryType.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsX509Purpose.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsX509Revoked.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsX509Store.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsX509StoreCtx.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsX509StoreManager.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsX509StoreType.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsX509TrustKind.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsX509VerifyFlags.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsX509VerifyParam.cs" />\r
+    <Compile Include="Mono.Btls\X509CertificateImplBtls.cs" />\r
+    <Compile Include="Mono.Btls\X509ChainImplBtls.cs" />\r
     <Compile Include="Mono.Http\NtlmClient.cs" />\r
     <Compile Include="Mono.Net.Dns\DnsClass.cs" />\r
     <Compile Include="Mono.Net.Dns\DnsHeader.cs" />\r
     <Compile Include="Mono.Net.Dns\ResolverError.cs" />\r
     <Compile Include="Mono.Net.Dns\SimpleResolver.cs" />\r
     <Compile Include="Mono.Net.Dns\SimpleResolverEventArgs.cs" />\r
+    <Compile Include="Mono.Net.Security\AsyncProtocolRequest.cs" />\r
     <Compile Include="Mono.Net.Security\CallbackHelpers.cs" />\r
     <Compile Include="Mono.Net.Security\ChainValidationHelper.cs" />\r
     <Compile Include="Mono.Net.Security\IMonoSslStream.cs" />\r
     <Compile Include="Mono.Net.Security\IMonoTlsProvider.cs" />\r
     <Compile Include="Mono.Net.Security\LegacySslStream.cs" />\r
-    <Compile Include="Mono.Net.Security\MonoDefaultTlsProvider.cs" />\r
+    <Compile Include="Mono.Net.Security\LegacyTlsProvider.cs" />\r
+    <Compile Include="Mono.Net.Security\MobileAuthenticatedStream.cs" />\r
+    <Compile Include="Mono.Net.Security\MobileTlsContext.cs" />\r
     <Compile Include="Mono.Net.Security\MonoSslStreamImpl.cs" />\r
     <Compile Include="Mono.Net.Security\MonoSslStreamWrapper.cs" />\r
     <Compile Include="Mono.Net.Security\MonoTlsProviderFactory.cs" />\r
-    <Compile Include="Mono.Net.Security\MonoTlsProviderImpl.cs" />\r
     <Compile Include="Mono.Net.Security\MonoTlsProviderWrapper.cs" />\r
     <Compile Include="Mono.Net.Security\MonoTlsStream.cs" />\r
     <Compile Include="Mono.Net.Security\NoReflectionHelper.cs" />\r
     <Compile Include="Mono.Net.Security\SystemCertificateValidator.cs" />\r
-    <Compile Include="ReferenceSources\_SecureChannel.cs" />\r
-    <Compile Include="ReferenceSources\_SslState.cs" />\r
-    <Compile Include="ReferenceSources\_SslStream.cs" />\r
     <Compile Include="ReferenceSources\AssertWrapper.cs" />\r
     <Compile Include="ReferenceSources\AutoWebProxyScriptEngine.cs" />\r
     <Compile Include="ReferenceSources\BinaryCompatibility.cs" />\r
     <Compile Include="ReferenceSources\EnvironmentHelpers.cs" />\r
     <Compile Include="ReferenceSources\HttpApi.cs" />\r
     <Compile Include="ReferenceSources\HttpSysSettings.cs" />\r
-    <Compile Include="ReferenceSources\Internal.cs" />\r
+    <Compile Include="ReferenceSources\LocalAppContextSwitches.cs" />\r
     <Compile Include="ReferenceSources\Logging.cs" />\r
     <Compile Include="ReferenceSources\NativeMethods.cs" />\r
     <Compile Include="ReferenceSources\RequestCacheProtocol.cs" />\r
+    <Compile Include="ReferenceSources\SecureStringHelper.cs" />\r
     <Compile Include="ReferenceSources\SettingsSectionInternal.cs" />\r
     <Compile Include="ReferenceSources\Socket.cs" />\r
     <Compile Include="ReferenceSources\SR.cs" />\r
     <Compile Include="ReferenceSources\SR2.cs" />\r
     <Compile Include="ReferenceSources\SRCategoryAttribute.cs" />\r
-    <Compile Include="ReferenceSources\SslStream.cs" />\r
-    <Compile Include="ReferenceSources\SSPIConfiguration.cs" />\r
-    <Compile Include="ReferenceSources\SSPISafeHandles.cs" />\r
-    <Compile Include="ReferenceSources\SSPIWrapper.cs" />\r
     <Compile Include="ReferenceSources\Win32Exception.cs" />\r
     <Compile Include="System.CodeDom.Compiler\CodeCompiler.cs" />\r
     <Compile Include="System.CodeDom.Compiler\CodeDomConfigurationHandler.cs" />\r
     <Compile Include="System.Configuration\UriSection.cs" />\r
     <Compile Include="System.Configuration\UserScopedSettingAttribute.cs" />\r
     <Compile Include="System.Configuration\UserSettingsGroup.cs" />\r
-    <Compile Include="System.Diagnostics.CodeAnalysis\ExcludeFromCodeCoverageAttribute.cs" />\r
     <Compile Include="System.Diagnostics\AlphabeticalEnumConverter.cs" />\r
     <Compile Include="System.Diagnostics\CounterCreationData.cs" />\r
     <Compile Include="System.Diagnostics\CounterCreationDataCollection.cs" />\r
     <Compile Include="System.Diagnostics\PerformanceCounterType.cs" />\r
     <Compile Include="System.Diagnostics\Process.cs" />\r
     <Compile Include="System.Diagnostics\ProcessModule.cs" />\r
-    <Compile Include="System.Diagnostics\ProcessModuleCollection.cs" />\r
     <Compile Include="System.Diagnostics\ProcessPriorityClass.cs" />\r
     <Compile Include="System.Diagnostics\ProcessStartInfo.cs" />\r
     <Compile Include="System.Diagnostics\ProcessThread.cs" />\r
-    <Compile Include="System.Diagnostics\ProcessThreadCollection.cs" />\r
     <Compile Include="System.Diagnostics\ProcessWindowStyle.cs" />\r
     <Compile Include="System.Diagnostics\Stopwatch.cs" />\r
     <Compile Include="System.Diagnostics\ThreadPriorityLevel.cs" />\r
     <Compile Include="System.Net.Security\SslPolicyErrors.cs" />\r
     <Compile Include="System.Net.Security\SslStream.cs" />\r
     <Compile Include="System.Net.Sockets\SafeSocketHandle.cs" />\r
-    <Compile Include="System.Net.Sockets\SendPacketsElement.cs" />\r
     <Compile Include="System.Net.Sockets\Socket.cs" />\r
     <Compile Include="System.Net.Sockets\SocketAsyncEventArgs.cs" />\r
-    <Compile Include="System.Net.Sockets\SocketAsyncOperation.cs" />\r
     <Compile Include="System.Net.Sockets\SocketAsyncResult.cs" />\r
     <Compile Include="System.Net.Sockets\SocketOperation.cs" />\r
-    <Compile Include="System.Net.Sockets\TcpClient.cs" />\r
-    <Compile Include="System.Net.Sockets\TcpListener.cs" />\r
-    <Compile Include="System.Net.Sockets\UdpClient.cs" />\r
+    <Compile Include="System.Net.Sockets\SocketReceiveFromResult.cs" />\r
+    <Compile Include="System.Net.Sockets\SocketReceiveMessageFromResult.cs" />\r
+    <Compile Include="System.Net.Sockets\SocketTaskExtensions.cs" />\r
     <Compile Include="System.Net.WebSockets\ClientWebSocket.cs" />\r
     <Compile Include="System.Net.WebSockets\ClientWebSocketOptions.cs" />\r
     <Compile Include="System.Net.WebSockets\HttpListenerWebSocketContext.cs" />\r
     <Compile Include="System.Net\HttpListenerPrefixCollection.cs" />\r
     <Compile Include="System.Net\HttpListenerRequest.cs" />\r
     <Compile Include="System.Net\HttpListenerResponse.cs" />\r
+    <Compile Include="System.Net\HttpListenerResponseHelper.cs" />\r
     <Compile Include="System.Net\HttpListenerTimeoutManager.cs" />\r
     <Compile Include="System.Net\HttpRequestCreator.cs" />\r
     <Compile Include="System.Net\HttpStreamAsyncResult.cs" />\r
     <Compile Include="System.Net\MacProxy.cs" />\r
     <Compile Include="System.Net\MonoHttpDate.cs" />\r
     <Compile Include="System.Net\NetConfig.cs" />\r
-    <Compile Include="System.Net\NetworkCredential.cs" />\r
     <Compile Include="System.Net\NtlmClient.cs" />\r
     <Compile Include="System.Net\RequestStream.cs" />\r
     <Compile Include="System.Net\ResponseStream.cs" />\r
     <Compile Include="System.Security.Authentication.ExtendedProtection\ExtendedProtectionPolicyTypeConverter.cs" />\r
     <Compile Include="System.Security.Authentication.ExtendedProtection\PolicyEnforcement.cs" />\r
     <Compile Include="System.Security.Authentication.ExtendedProtection\ProtectionScenario.cs" />\r
-    <Compile Include="System.Security.Authentication.ExtendedProtection\ServiceNameCollection.cs" />\r
     <Compile Include="System.Security.Authentication\AuthenticationException.cs" />\r
     <Compile Include="System.Security.Authentication\CipherAlgorithmType.cs" />\r
     <Compile Include="System.Security.Authentication\ExchangeAlgorithmType.cs" />\r
     <Compile Include="System.Security.Cryptography.X509Certificates\X509Certificate2Impl.cs" />\r
     <Compile Include="System.Security.Cryptography.X509Certificates\X509Certificate2ImplMono.cs" />\r
     <Compile Include="System.Security.Cryptography.X509Certificates\X509CertificateCollection.cs" />\r
+    <Compile Include="System.Security.Cryptography.X509Certificates\X509CertificateImplCollection.cs" />\r
     <Compile Include="System.Security.Cryptography.X509Certificates\X509Chain.cs" />\r
     <Compile Include="System.Security.Cryptography.X509Certificates\X509ChainElement.cs" />\r
     <Compile Include="System.Security.Cryptography.X509Certificates\X509ChainElementCollection.cs" />\r
     <Compile Include="System.Web\AspNetHostingPermissionLevel.cs" />\r
     <Compile Include="System.Windows.Input\ICommand.cs" />\r
     <Compile Include="System\IOSelector.cs" />\r
+    <Compile Include="System\MonoToolsLocator.cs" />\r
     <Compile Include="System\Platform.cs" />\r
     <Compile Include="System\SRDescriptionAttribute.cs" />\r
     <Compile Include="System\UriTypeConverter.cs" />\r  </ItemGroup>\r
index 16f5809c7082d25214ec7087fe319d915e2bc3f0..dcaca1cff413a3bd8d0a1959922589674bc64634 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -7,7 +8,7 @@
     <SchemaVersion>2.0</SchemaVersion>\r
     <ProjectGuid>{19954F80-065E-4D46-8FEF-62BA4D6CFDAD}</ProjectGuid>\r
     <OutputType>Library</OutputType>\r
-    <NoWarn>1699,618</NoWarn>\r
+    <NoWarn>1699</NoWarn>\r
     <OutputPath>./../../class/lib/net_4_x/secxml</OutputPath>\r
     <IntermediateOutputPath>obj-secxml</IntermediateOutputPath>\r
     <GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>\r
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
     <DebugSymbols>true</DebugSymbols>\r
     <DebugType>full</DebugType>\r
-    <NoWarn>1699,618</NoWarn>\r
+    <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;CONFIGURATION_2_0;FEATURE_PAL;SYSTEM_NAMESPACE;MONO;PLATFORM_UNIX;MONO_FEATURE_PROCESS_START;MONO_FEATURE_THREAD_ABORT;MONO_FEATURE_THREAD_SUSPEND_RESUME;MONO_FEATURE_MULTIPLE_APPDOMAINS;SECURITY_DEP;XML_DEP;MONO_SECURITY_ALIAS</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;CONFIGURATION_2_0;FEATURE_PAL;SYSTEM_NAMESPACE;MONO;PLATFORM_UNIX;MONO_FEATURE_PROCESS_START;MONO_FEATURE_THREAD_ABORT;MONO_FEATURE_THREAD_SUSPEND_RESUME;MONO_FEATURE_MULTIPLE_APPDOMAINS;MONO_FEATURE_BTLS;SECURITY_DEP;XML_DEP;MONO_SECURITY_ALIAS</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">\r
     <DebugType>pdbonly</DebugType>\r
-    <NoWarn>1699,618</NoWarn>\r
+    <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;CONFIGURATION_2_0;FEATURE_PAL;SYSTEM_NAMESPACE;MONO;PLATFORM_UNIX;MONO_FEATURE_PROCESS_START;MONO_FEATURE_THREAD_ABORT;MONO_FEATURE_THREAD_SUSPEND_RESUME;MONO_FEATURE_MULTIPLE_APPDOMAINS;SECURITY_DEP;XML_DEP;MONO_SECURITY_ALIAS</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;CONFIGURATION_2_0;FEATURE_PAL;SYSTEM_NAMESPACE;MONO;PLATFORM_UNIX;MONO_FEATURE_PROCESS_START;MONO_FEATURE_THREAD_ABORT;MONO_FEATURE_THREAD_SUSPEND_RESUME;MONO_FEATURE_MULTIPLE_APPDOMAINS;MONO_FEATURE_BTLS;SECURITY_DEP;XML_DEP;MONO_SECURITY_ALIAS</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
     <Compile Include="..\referencesource\System\net\System\Net\_ProxyChain.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\_ScatterGatherBuffers.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\_Semaphore.cs" />\r
+    <Compile Include="..\referencesource\System\net\System\Net\_ServiceNameStore.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\_TimerThread.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\_WebProxyDataBuilder.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\AuthenticationScheme.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\mail\TransferEncoding.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\mail\WriteStateInfoBase.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\NetworkAccess.cs" />\r
+    <Compile Include="..\referencesource\System\net\System\Net\NetworkCredential.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\NetworkInformation\DuplicateAddressDetectionState.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\NetworkInformation\GatewayIPAddressInformation.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\NetworkInformation\GatewayIPAddressInformationCollection.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\NetworkInformation\SystemIPAddressInformation.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\NetworkInformation\SystemMulticastIPAddressInformation.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\NetworkInformation\SystemTcpConnection.cs" />\r
-    <Compile Include="..\referencesource\System\net\System\Net\NetworkInformation\SystemUnicastIPAddressInformation.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\NetworkInformation\TcpConnection.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\NetworkInformation\TcpState.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\NetworkInformation\TcpStatistics.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\ServicePointManager.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\SocketAddress.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\SocketException.cs" />\r
+    <Compile Include="..\referencesource\System\net\System\Net\Sockets\_MultipleConnectAsync.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\Sockets\AddressFamily.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\Sockets\IOControlCode.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\Sockets\IPPacketInformation.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\Sockets\ProtocolFamily.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\Sockets\ProtocolType.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\Sockets\SelectMode.cs" />\r
+    <Compile Include="..\referencesource\System\net\System\Net\Sockets\Socket.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\Sockets\SocketErrors.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\Sockets\SocketFlags.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\Sockets\SocketInformation.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\Sockets\SocketOptionName.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\Sockets\SocketShutdown.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\Sockets\SocketType.cs" />\r
+    <Compile Include="..\referencesource\System\net\System\Net\Sockets\TCPClient.cs" />\r
+    <Compile Include="..\referencesource\System\net\System\Net\Sockets\TCPListener.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\Sockets\TransmitFileFlags.cs" />\r
+    <Compile Include="..\referencesource\System\net\System\Net\Sockets\UDPClient.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\Sockets\UdpReceiveResult.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\TransportContext.cs" />\r
     <Compile Include="..\referencesource\System\net\System\Net\TransportType.cs" />\r
     <Compile Include="..\referencesource\System\regex\system\text\regularexpressions\RegexRunnerFactory.cs" />\r
     <Compile Include="..\referencesource\System\regex\system\text\regularexpressions\RegexTree.cs" />\r
     <Compile Include="..\referencesource\System\regex\system\text\regularexpressions\RegexWriter.cs" />\r
+    <Compile Include="..\referencesource\System\security\system\security\Authentication\ExtendedProtection\ServiceNameCollection.cs" />\r
     <Compile Include="..\referencesource\System\security\system\security\Authentication\ExtendedProtection\TokenBinding.cs" />\r
     <Compile Include="..\referencesource\System\security\system\security\cryptography\oid.cs" />\r
     <Compile Include="..\referencesource\System\security\system\security\cryptography\x509\x509utils.cs" />\r
     <Compile Include="..\referencesource\System\security\system\security\permissions\typedescriptorpermission.cs" />\r
     <Compile Include="..\referencesource\System\services\monitoring\system\diagnosticts\AsyncStreamReader.cs" />\r
     <Compile Include="..\referencesource\System\services\monitoring\system\diagnosticts\Process.cs" />\r
+    <Compile Include="..\referencesource\System\services\monitoring\system\diagnosticts\ProcessModuleCollection.cs" />\r
     <Compile Include="..\referencesource\System\services\monitoring\system\diagnosticts\ProcessStartInfo.cs" />\r
+    <Compile Include="..\referencesource\System\services\monitoring\system\diagnosticts\ProcessThreadCollection.cs" />\r
     <Compile Include="..\referencesource\System\services\monitoring\system\diagnosticts\processwaithandle.cs" />\r
     <Compile Include="..\referencesource\System\services\timers\system\timers\ElapsedEventHandler.cs" />\r
     <Compile Include="..\referencesource\System\services\timers\system\timers\Timer.cs" />\r
     <Compile Include="..\referencesource\System\services\timers\system\timers\TimersDescriptionAttribute.cs" />\r
     <Compile Include="..\referencesource\System\sys\system\collections\concurrent\BlockingCollection.cs" />\r
     <Compile Include="..\referencesource\System\sys\system\collections\concurrent\ConcurrentBag.cs" />\r
+    <Compile Include="..\referencesource\System\sys\system\Diagnostics\CodeAnalysis\ExcludeFromCodeCoverageAttribute.cs" />\r
     <Compile Include="..\referencesource\System\sys\system\IO\ports\InternalResources.cs" />\r
     <Compile Include="..\referencesource\System\sys\system\runtime\interopservices\DefaultParameterValueAttribute.cs" />\r
     <Compile Include="..\referencesource\System\sys\system\runtime\interopservices\handlecollector.cs" />\r
     <Compile Include="Microsoft.VisualBasic\VBCodeCompiler.cs" />\r
     <Compile Include="Microsoft.VisualBasic\VBCodeGenerator.cs" />\r
     <Compile Include="Microsoft.VisualBasic\VBCodeProvider.cs" />\r
+    <Compile Include="Microsoft.Win32.SafeHandles\SafeX509ChainHandle.cs" />\r
     <Compile Include="Microsoft.Win32\IntranetZoneCredentialPolicy.cs" />\r
     <Compile Include="Microsoft.Win32\PowerModeChangedEventArgs.cs" />\r
     <Compile Include="Microsoft.Win32\PowerModeChangedEventHandler.cs" />\r
     <Compile Include="Microsoft.Win32\UserPreferenceChangedEventHandler.cs" />\r
     <Compile Include="Microsoft.Win32\UserPreferenceChangingEventArgs.cs" />\r
     <Compile Include="Microsoft.Win32\UserPreferenceChangingEventHandler.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsBio.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsContext.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsError.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsException.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsKey.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsObject.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsPkcs12.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsProvider.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsSsl.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsSslCtx.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsSslError.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsStream.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsUtils.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsX509.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsX509Chain.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsX509Crl.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsX509Error.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsX509Exception.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsX509FileType.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsX509Format.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsX509Lookup.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsX509LookupMono.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsX509LookupMonoCollection.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsX509LookupType.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsX509Name.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsX509NameEntryType.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsX509Purpose.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsX509Revoked.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsX509Store.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsX509StoreCtx.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsX509StoreManager.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsX509StoreType.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsX509TrustKind.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsX509VerifyFlags.cs" />\r
+    <Compile Include="Mono.Btls\MonoBtlsX509VerifyParam.cs" />\r
+    <Compile Include="Mono.Btls\X509CertificateImplBtls.cs" />\r
+    <Compile Include="Mono.Btls\X509ChainImplBtls.cs" />\r
     <Compile Include="Mono.Http\NtlmClient.cs" />\r
     <Compile Include="Mono.Net.Dns\DnsClass.cs" />\r
     <Compile Include="Mono.Net.Dns\DnsHeader.cs" />\r
     <Compile Include="Mono.Net.Dns\ResolverError.cs" />\r
     <Compile Include="Mono.Net.Dns\SimpleResolver.cs" />\r
     <Compile Include="Mono.Net.Dns\SimpleResolverEventArgs.cs" />\r
+    <Compile Include="Mono.Net.Security\AsyncProtocolRequest.cs" />\r
     <Compile Include="Mono.Net.Security\CallbackHelpers.cs" />\r
     <Compile Include="Mono.Net.Security\ChainValidationHelper.cs" />\r
     <Compile Include="Mono.Net.Security\IMonoSslStream.cs" />\r
     <Compile Include="Mono.Net.Security\IMonoTlsProvider.cs" />\r
     <Compile Include="Mono.Net.Security\LegacySslStream.cs" />\r
-    <Compile Include="Mono.Net.Security\MonoDefaultTlsProvider.cs" />\r
+    <Compile Include="Mono.Net.Security\LegacyTlsProvider.cs" />\r
+    <Compile Include="Mono.Net.Security\MobileAuthenticatedStream.cs" />\r
+    <Compile Include="Mono.Net.Security\MobileTlsContext.cs" />\r
     <Compile Include="Mono.Net.Security\MonoSslStreamImpl.cs" />\r
     <Compile Include="Mono.Net.Security\MonoSslStreamWrapper.cs" />\r
     <Compile Include="Mono.Net.Security\MonoTlsProviderFactory.cs" />\r
-    <Compile Include="Mono.Net.Security\MonoTlsProviderImpl.cs" />\r
     <Compile Include="Mono.Net.Security\MonoTlsProviderWrapper.cs" />\r
     <Compile Include="Mono.Net.Security\MonoTlsStream.cs" />\r
     <Compile Include="Mono.Net.Security\NoReflectionHelper.cs" />\r
     <Compile Include="Mono.Net.Security\SystemCertificateValidator.cs" />\r
-    <Compile Include="ReferenceSources\_SecureChannel.cs" />\r
-    <Compile Include="ReferenceSources\_SslState.cs" />\r
-    <Compile Include="ReferenceSources\_SslStream.cs" />\r
     <Compile Include="ReferenceSources\AssertWrapper.cs" />\r
     <Compile Include="ReferenceSources\AutoWebProxyScriptEngine.cs" />\r
     <Compile Include="ReferenceSources\BinaryCompatibility.cs" />\r
     <Compile Include="ReferenceSources\EnvironmentHelpers.cs" />\r
     <Compile Include="ReferenceSources\HttpApi.cs" />\r
     <Compile Include="ReferenceSources\HttpSysSettings.cs" />\r
-    <Compile Include="ReferenceSources\Internal.cs" />\r
+    <Compile Include="ReferenceSources\LocalAppContextSwitches.cs" />\r
     <Compile Include="ReferenceSources\Logging.cs" />\r
     <Compile Include="ReferenceSources\NativeMethods.cs" />\r
     <Compile Include="ReferenceSources\RequestCacheProtocol.cs" />\r
+    <Compile Include="ReferenceSources\SecureStringHelper.cs" />\r
     <Compile Include="ReferenceSources\SettingsSectionInternal.cs" />\r
     <Compile Include="ReferenceSources\Socket.cs" />\r
     <Compile Include="ReferenceSources\SR.cs" />\r
     <Compile Include="ReferenceSources\SR2.cs" />\r
     <Compile Include="ReferenceSources\SRCategoryAttribute.cs" />\r
-    <Compile Include="ReferenceSources\SslStream.cs" />\r
-    <Compile Include="ReferenceSources\SSPIConfiguration.cs" />\r
-    <Compile Include="ReferenceSources\SSPISafeHandles.cs" />\r
-    <Compile Include="ReferenceSources\SSPIWrapper.cs" />\r
     <Compile Include="ReferenceSources\Win32Exception.cs" />\r
     <Compile Include="System.CodeDom.Compiler\CodeCompiler.cs" />\r
     <Compile Include="System.CodeDom.Compiler\CodeDomConfigurationHandler.cs" />\r
     <Compile Include="System.Configuration\UriSection.cs" />\r
     <Compile Include="System.Configuration\UserScopedSettingAttribute.cs" />\r
     <Compile Include="System.Configuration\UserSettingsGroup.cs" />\r
-    <Compile Include="System.Diagnostics.CodeAnalysis\ExcludeFromCodeCoverageAttribute.cs" />\r
     <Compile Include="System.Diagnostics\AlphabeticalEnumConverter.cs" />\r
     <Compile Include="System.Diagnostics\CounterCreationData.cs" />\r
     <Compile Include="System.Diagnostics\CounterCreationDataCollection.cs" />\r
     <Compile Include="System.Diagnostics\PerformanceCounterType.cs" />\r
     <Compile Include="System.Diagnostics\Process.cs" />\r
     <Compile Include="System.Diagnostics\ProcessModule.cs" />\r
-    <Compile Include="System.Diagnostics\ProcessModuleCollection.cs" />\r
     <Compile Include="System.Diagnostics\ProcessPriorityClass.cs" />\r
     <Compile Include="System.Diagnostics\ProcessStartInfo.cs" />\r
     <Compile Include="System.Diagnostics\ProcessThread.cs" />\r
-    <Compile Include="System.Diagnostics\ProcessThreadCollection.cs" />\r
     <Compile Include="System.Diagnostics\ProcessWindowStyle.cs" />\r
     <Compile Include="System.Diagnostics\Stopwatch.cs" />\r
     <Compile Include="System.Diagnostics\ThreadPriorityLevel.cs" />\r
     <Compile Include="System.Net.Security\SslPolicyErrors.cs" />\r
     <Compile Include="System.Net.Security\SslStream.cs" />\r
     <Compile Include="System.Net.Sockets\SafeSocketHandle.cs" />\r
-    <Compile Include="System.Net.Sockets\SendPacketsElement.cs" />\r
     <Compile Include="System.Net.Sockets\Socket.cs" />\r
     <Compile Include="System.Net.Sockets\SocketAsyncEventArgs.cs" />\r
-    <Compile Include="System.Net.Sockets\SocketAsyncOperation.cs" />\r
     <Compile Include="System.Net.Sockets\SocketAsyncResult.cs" />\r
     <Compile Include="System.Net.Sockets\SocketOperation.cs" />\r
-    <Compile Include="System.Net.Sockets\TcpClient.cs" />\r
-    <Compile Include="System.Net.Sockets\TcpListener.cs" />\r
-    <Compile Include="System.Net.Sockets\UdpClient.cs" />\r
+    <Compile Include="System.Net.Sockets\SocketReceiveFromResult.cs" />\r
+    <Compile Include="System.Net.Sockets\SocketReceiveMessageFromResult.cs" />\r
+    <Compile Include="System.Net.Sockets\SocketTaskExtensions.cs" />\r
     <Compile Include="System.Net.WebSockets\ClientWebSocket.cs" />\r
     <Compile Include="System.Net.WebSockets\ClientWebSocketOptions.cs" />\r
     <Compile Include="System.Net.WebSockets\HttpListenerWebSocketContext.cs" />\r
     <Compile Include="System.Net\HttpListenerPrefixCollection.cs" />\r
     <Compile Include="System.Net\HttpListenerRequest.cs" />\r
     <Compile Include="System.Net\HttpListenerResponse.cs" />\r
+    <Compile Include="System.Net\HttpListenerResponseHelper.cs" />\r
     <Compile Include="System.Net\HttpListenerTimeoutManager.cs" />\r
     <Compile Include="System.Net\HttpRequestCreator.cs" />\r
     <Compile Include="System.Net\HttpStreamAsyncResult.cs" />\r
     <Compile Include="System.Net\MacProxy.cs" />\r
     <Compile Include="System.Net\MonoHttpDate.cs" />\r
     <Compile Include="System.Net\NetConfig.cs" />\r
-    <Compile Include="System.Net\NetworkCredential.cs" />\r
     <Compile Include="System.Net\NtlmClient.cs" />\r
     <Compile Include="System.Net\RequestStream.cs" />\r
     <Compile Include="System.Net\ResponseStream.cs" />\r
     <Compile Include="System.Security.Authentication.ExtendedProtection\ExtendedProtectionPolicyTypeConverter.cs" />\r
     <Compile Include="System.Security.Authentication.ExtendedProtection\PolicyEnforcement.cs" />\r
     <Compile Include="System.Security.Authentication.ExtendedProtection\ProtectionScenario.cs" />\r
-    <Compile Include="System.Security.Authentication.ExtendedProtection\ServiceNameCollection.cs" />\r
     <Compile Include="System.Security.Authentication\AuthenticationException.cs" />\r
     <Compile Include="System.Security.Authentication\CipherAlgorithmType.cs" />\r
     <Compile Include="System.Security.Authentication\ExchangeAlgorithmType.cs" />\r
     <Compile Include="System.Security.Cryptography.X509Certificates\X509Certificate2Impl.cs" />\r
     <Compile Include="System.Security.Cryptography.X509Certificates\X509Certificate2ImplMono.cs" />\r
     <Compile Include="System.Security.Cryptography.X509Certificates\X509CertificateCollection.cs" />\r
+    <Compile Include="System.Security.Cryptography.X509Certificates\X509CertificateImplCollection.cs" />\r
     <Compile Include="System.Security.Cryptography.X509Certificates\X509Chain.cs" />\r
     <Compile Include="System.Security.Cryptography.X509Certificates\X509ChainElement.cs" />\r
     <Compile Include="System.Security.Cryptography.X509Certificates\X509ChainElementCollection.cs" />\r
     <Compile Include="System.Web\AspNetHostingPermissionLevel.cs" />\r
     <Compile Include="System.Windows.Input\ICommand.cs" />\r
     <Compile Include="System\IOSelector.cs" />\r
+    <Compile Include="System\MonoToolsLocator.cs" />\r
     <Compile Include="System\Platform.cs" />\r
     <Compile Include="System\SRDescriptionAttribute.cs" />\r
     <Compile Include="System\UriTypeConverter.cs" />\r  </ItemGroup>\r
index b24eda319cfeab888dc038a778aa6d7d2ec47c07..192f1c070739da293c929c92976b268f2e2f7a8c 100644 (file)
@@ -37,6 +37,8 @@ using System.IO;
 using System.Runtime.InteropServices;
 using System.Security.Permissions;
 
+#pragma warning disable 618
+
 namespace System.CodeDom.Compiler {
 
        [ComVisible (true)]
@@ -314,3 +316,5 @@ namespace System.CodeDom.Compiler {
                }               
        }
 }
+
+#pragma warning restore 618
\ No newline at end of file
index 80c30eece70d9d13e40ed5d50ffb86c729d42938..2f679cb6895010260c4996643d1da974189921ed 100644 (file)
@@ -103,11 +103,13 @@ namespace System.CodeDom.Compiler {
                                                }
                                        }
 
+#if FEATURE_MONO_CAS
                                        // and you must have discovery access to the combined path
                                        // note: the cache behaviour is tested in the CAS tests
                                        if (SecurityManager.SecurityEnabled) {
                                                new FileIOPermission (FileIOPermissionAccess.PathDiscovery, basepath).Demand ();
                                        }
+#endif
                                }
 
                                return(basepath);
index 7a0bd6ef5dff7a556ba5159e668a4887b9b1acb6..304238e63d589bfa889a0ebf06f25e432ab49023 100644 (file)
@@ -31,6 +31,8 @@
 using System.Reflection;
 using System.Collections.Specialized;
 
+#pragma warning disable 618
+
 namespace System.Configuration
 {
        public class AppSettingsReader
index 89adbe2589101044f97e5213389bd42f7dd8bb65..fd9bb69de96581ab123a4b99819b0d4bbf4bffd1 100644 (file)
@@ -34,6 +34,8 @@ using System.Collections.Specialized;
 using System.Xml;
 #endif
 
+#pragma warning disable 618
+
 namespace System.Configuration
 {
        class ConfigHelper
index 1ab98591990dbc8668c681db8452119b74526f55..c6ec61f1af60067e9072385ad0d2f13720d2f9a7 100644 (file)
@@ -37,6 +37,8 @@ using System.Security.Permissions;
 #if (XML_DEP)
 using System.Xml;
 
+#pragma warning disable 618
+
 namespace System.Configuration
 {
        [PermissionSet (SecurityAction.LinkDemand, Unrestricted = true)]
index 9b2f8e9986b8768ff7ae95a95620bbb19cb9d7a1..8a038c81aa62ecee7ab1d79e8db136561da1886c 100644 (file)
@@ -43,6 +43,8 @@ using System.Xml;
 using System.Xml.XPath;
 #endif
 
+#pragma warning disable 618
+
 namespace System.Configuration
 {
        public sealed class ConfigurationSettings
index efa336e927c8ee4f3ba5a20f26045ba53fe8ba00..301c65d87b5cdce21a45a07671e2353392bfa6a2 100644 (file)
@@ -37,6 +37,8 @@ using System.Xml;
 using XmlNode = System.Object;
 #endif
 
+#pragma warning disable 618
+
 namespace System.Configuration
 {
        public class NameValueFileSectionHandler : IConfigurationSectionHandler
index 346b5b5f3a1fe5f91f77e8ac753035bb1e59903a..9c66654b3da57cc359f6a4def3d0fa09a075708b 100644 (file)
@@ -36,6 +36,8 @@ using System.Xml;
 using XmlNode = System.Object;
 #endif
 
+#pragma warning disable 618
+
 namespace System.Configuration
 {
        /// <summary>
diff --git a/mcs/class/System/System.Diagnostics.CodeAnalysis/ExcludeFromCodeCoverageAttribute.cs b/mcs/class/System/System.Diagnostics.CodeAnalysis/ExcludeFromCodeCoverageAttribute.cs
deleted file mode 100644 (file)
index 38371ca..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-//
-// ExcludeFromCodeCoverageAttribute.cs
-//
-// Authors:
-//  Jb Evain  <jbevain@novell.com>
-//
-// Copyright (C) 2010 Novell, Inc (http://www.novell.com)
-//
-// 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;
-
-
-namespace System.Diagnostics.CodeAnalysis {
-
-       [AttributeUsage (AttributeTargets.Class
-               | AttributeTargets.Struct
-               | AttributeTargets.Constructor
-               | AttributeTargets.Method
-               | AttributeTargets.Property
-               | AttributeTargets.Event,
-               AllowMultiple = false,
-               Inherited = false)]
-       public sealed class ExcludeFromCodeCoverageAttribute : Attribute
-       {
-               public ExcludeFromCodeCoverageAttribute ()
-               {
-               }
-       }
-}
-
index cecf7de61f45b6d20b1ff3c631e1e1c2d38a5403..e1940f910f25823b68a4bff1dc65ecb3e7da20d1 100644 (file)
@@ -32,7 +32,6 @@
 //
 
 using System;
-using System.Diagnostics;
 using System.Collections;
 using System.ComponentModel;
 using System.ComponentModel.Design;
@@ -40,6 +39,8 @@ using System.Globalization;
 using System.IO;
 using System.Runtime.InteropServices;
 
+#pragma warning disable 618
+
 namespace System.Diagnostics 
 {
        [DefaultEvent ("EntryWritten")]
index cf38a5e11252ecba08357e7b974b6f286c3dd668..e59d0a89fa07b595c48d7e460ca4e9166d33fc75 100644 (file)
@@ -144,7 +144,7 @@ namespace System.Diagnostics {
 
                public string FileName {
                        get {
-#if !NET_2_1
+#if !MOBILE
                                if (SecurityManager.SecurityEnabled) {
                                        new FileIOPermission (FileIOPermissionAccess.PathDiscovery, filename).Demand ();
                                }
@@ -278,7 +278,7 @@ namespace System.Diagnostics {
                
                public static FileVersionInfo GetVersionInfo (string fileName)
                {
-#if !NET_2_1
+#if !MOBILE
                        if (SecurityManager.SecurityEnabled) {
                                new FileIOPermission (FileIOPermissionAccess.Read, fileName).Demand ();
                        }
@@ -293,7 +293,7 @@ namespace System.Diagnostics {
                        return fvi;
                }
 
-               // use our own AppendFormat because NET_2_1 have only this overload
+               // use our own AppendFormat because MOBILE have only this overload
                static void AppendFormat (StringBuilder sb, string format, params object [] args)
                {
                        sb.AppendFormat (format, args);
index f76f0950f459bbf951ebbf0ebba82e30b0f097bf..4261b3bc491040c8aee0446fe9f8fa71be8313ae 100644 (file)
@@ -159,7 +159,7 @@ namespace System.Diagnostics {
                }
 
                // may throw ArgumentNullException
-               [DefaultValue (""), ReadOnly (true), RecommendedAsConfigurable (true)]
+               [DefaultValue (""), ReadOnly (true), SettingsBindable (true)]
                [TypeConverter ("System.Diagnostics.Design.CategoryValueConverter, " + Consts.AssemblySystem_Design)]
                [SRDescription ("The category name for this performance counter.")]
                public string CategoryName {
@@ -181,7 +181,7 @@ namespace System.Diagnostics {
                }
 
                // may throw ArgumentNullException
-               [DefaultValue (""), ReadOnly (true), RecommendedAsConfigurable (true)]
+               [DefaultValue (""), ReadOnly (true), SettingsBindable (true)]
                [TypeConverter ("System.Diagnostics.Design.CounterNameConverter, " + Consts.AssemblySystem_Design)]
                [SRDescription ("The name of this performance counter.")]
                public string CounterName 
@@ -212,7 +212,7 @@ namespace System.Diagnostics {
                        set { lifetime = value; }
                }
 
-               [DefaultValue (""), ReadOnly (true), RecommendedAsConfigurable (true)]
+               [DefaultValue (""), ReadOnly (true), SettingsBindable (true)]
                [TypeConverter ("System.Diagnostics.Design.InstanceNameConverter, " + Consts.AssemblySystem_Design)]
                [SRDescription ("The instance name for this performance counter.")]
                public string InstanceName {
@@ -227,7 +227,7 @@ namespace System.Diagnostics {
 
                // may throw ArgumentException if machine name format is wrong
                [MonoTODO("What's the machine name format?")]
-               [DefaultValue ("."), Browsable (false), RecommendedAsConfigurable (true)]
+               [DefaultValue ("."), Browsable (false), SettingsBindable (true)]
                [SRDescription ("The machine where this performance counter resides.")]
                public string MachineName {
                        get {return machineName;}
index 455d60b0d22802e0a7fba89a3671ec0977ca516b..74f1990f516f3ffd90536cfd6e6e85792e949b7d 100644 (file)
@@ -469,16 +469,6 @@ namespace System.Diagnostics
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
                private extern static IntPtr GetProcess_internal(int pid);
 
-               public static Process GetProcessById(int processId)
-               {
-                       IntPtr proc = GetProcess_internal(processId);
-                       
-                       if (proc == IntPtr.Zero)
-                               throw new ArgumentException ("Can't find process with ID " + processId.ToString ());
-
-                       return (new Process (new SafeProcessHandle (proc, false), processId));
-               }
-
                [MonoTODO ("There is no support for retrieving process information from a remote machine")]
                public static Process GetProcessById(int processId, string machineName) {
                        if (machineName == null)
@@ -487,34 +477,17 @@ namespace System.Diagnostics
                        if (!IsLocalMachine (machineName))
                                throw new NotImplementedException ();
 
-                       return GetProcessById (processId);
+                       IntPtr proc = GetProcess_internal(processId);
+
+                       if (proc == IntPtr.Zero)
+                               throw new ArgumentException ("Can't find process with ID " + processId.ToString ());
+
+                       return (new Process (new SafeProcessHandle (proc, false), processId));
                }
 
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
                private extern static int[] GetProcesses_internal();
 
-               public static Process[] GetProcesses ()
-               {
-                       int [] pids = GetProcesses_internal ();
-                       if (pids == null)
-                               return new Process [0];
-
-                       var proclist = new List<Process> (pids.Length);
-                       for (int i = 0; i < pids.Length; i++) {
-                               try {
-                                       proclist.Add (GetProcessById (pids [i]));
-                               } catch (SystemException) {
-                                       /* The process might exit
-                                        * between
-                                        * GetProcesses_internal and
-                                        * GetProcessById
-                                        */
-                               }
-                       }
-
-                       return proclist.ToArray ();
-               }
-
                [MonoTODO ("There is no support for retrieving process information from a remote machine")]
                public static Process[] GetProcesses(string machineName) {
                        if (machineName == null)
@@ -523,21 +496,14 @@ namespace System.Diagnostics
                        if (!IsLocalMachine (machineName))
                                throw new NotImplementedException ();
 
-                       return GetProcesses ();
-               }
-
-               public static Process[] GetProcessesByName(string processName)
-               {
                        int [] pids = GetProcesses_internal ();
                        if (pids == null)
                                return new Process [0];
-                       
+
                        var proclist = new List<Process> (pids.Length);
                        for (int i = 0; i < pids.Length; i++) {
                                try {
-                                       Process p = GetProcessById (pids [i]);
-                                       if (String.Compare (processName, p.ProcessName, true) == 0)
-                                               proclist.Add (p);
+                                       proclist.Add (GetProcessById (pids [i]));
                                } catch (SystemException) {
                                        /* The process might exit
                                         * between
@@ -550,11 +516,6 @@ namespace System.Diagnostics
                        return proclist.ToArray ();
                }
 
-               [MonoTODO]
-               public static Process[] GetProcessesByName(string processName, string machineName) {
-                       throw new NotImplementedException();
-               }
-
                private static bool IsLocalMachine (string machineName)
                {
                        if (machineName == "." || machineName.Length == 0)
diff --git a/mcs/class/System/System.Diagnostics/ProcessModuleCollection.cs b/mcs/class/System/System.Diagnostics/ProcessModuleCollection.cs
deleted file mode 100644 (file)
index bd1ea61..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-//
-// System.Diagnostics.ProcessModuleCollection.cs
-//
-// Authors:
-//   Dick Porter (dick@ximian.com)
-//   Andreas Nahr (ClassDevelopment@A-SoftTech.com)
-//
-// (C) 2002 Ximian, Inc.  http://www.ximian.com
-//
-
-//
-// 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.Collections;
-
-namespace System.Diagnostics 
-{
-#if NET_2_1
-       public class ProcessModuleCollectionBase : System.Collections.Generic.List<ProcessModule>
-       {
-               protected ProcessModuleCollectionBase InnerList {
-                       get { return this; }
-               }
-
-               public System.Collections.IEnumerator GetEnumerator ()
-               {
-                       return ((System.Collections.IEnumerable)InnerList).GetEnumerator ();
-               }
-       }
-#endif
-
-       public class ProcessModuleCollection :
-#if !NET_2_1   
-               ReadOnlyCollectionBase
-#else
-               ProcessModuleCollectionBase
-#endif
-       {
-               protected ProcessModuleCollection() 
-               {
-               }
-
-               public ProcessModuleCollection(ProcessModule[] processModules) 
-               {
-                       InnerList.AddRange (processModules);
-               }
-               
-               public ProcessModule this[int index] {
-                       get {
-                               return (ProcessModule)InnerList[index];
-                       }
-               }
-
-               public bool Contains(ProcessModule module) 
-               {
-                       return InnerList.Contains (module);
-               }
-
-               public void CopyTo(ProcessModule[] array, int index) 
-               {
-                       InnerList.CopyTo (array, index);
-               }
-
-               public int IndexOf(ProcessModule module) 
-               {
-                       return InnerList.IndexOf (module);
-               }
-       }
-}
diff --git a/mcs/class/System/System.Diagnostics/ProcessThreadCollection.cs b/mcs/class/System/System.Diagnostics/ProcessThreadCollection.cs
deleted file mode 100644 (file)
index b2fbdbf..0000000
+++ /dev/null
@@ -1,113 +0,0 @@
-//
-// System.Diagnostics.ProcessThreadCollection.cs
-//
-// Authors:
-//   Dick Porter (dick@ximian.com)
-//   Andreas Nahr (ClassDevelopment@A-SoftTech.com)
-//
-// (C) 2002 Ximian, Inc.  http://www.ximian.com
-//
-
-//
-// 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.Collections;
-
-namespace System.Diagnostics 
-{
-#if NET_2_1
-       public class ProcessThreadCollectionBase : System.Collections.Generic.List<ProcessThread>
-       {
-               protected ProcessThreadCollectionBase InnerList {
-                       get { return this; }
-               }
-
-               public new int Add (ProcessThread thread)
-               {
-                       base.Add (thread);
-                       return Count - 1;
-               }
-
-               public System.Collections.IEnumerator GetEnumerator ()
-               {
-                       return ((System.Collections.IEnumerable)InnerList).GetEnumerator ();
-               }
-       }
-#endif
-
-       public class ProcessThreadCollection :
-#if !NET_2_1
-               ReadOnlyCollectionBase
-#else
-               ProcessThreadCollectionBase
-#endif
-       {
-               protected ProcessThreadCollection() 
-               {
-               }
-
-               internal static ProcessThreadCollection GetEmpty ()
-               {
-                       return new ProcessThreadCollection ();
-               }
-               
-               public ProcessThreadCollection(ProcessThread[] processThreads) 
-               {
-                       InnerList.AddRange (processThreads);
-               }
-
-               public ProcessThread this[int index] {
-                       get {
-                               return (ProcessThread)InnerList[index];
-                       }
-               }
-
-               public int Add(ProcessThread thread) 
-               {
-                       return InnerList.Add (thread);
-               }
-
-               public bool Contains(ProcessThread thread) 
-               {
-                       return InnerList.Contains (thread);
-               }
-
-               public void CopyTo(ProcessThread[] array, int index) 
-               {
-                       InnerList.CopyTo (array, index);
-               }
-
-               public int IndexOf(ProcessThread thread) 
-               {
-                       return InnerList.IndexOf (thread);
-               }
-
-               public void Insert(int index, ProcessThread thread) 
-               {
-                       InnerList.Insert (index, thread);
-               }
-
-               public void Remove(ProcessThread thread) 
-               {
-                       InnerList.Remove (thread);
-               }
-       }
-}
index 4002c3b7cdc4850dbe9490d4831005ed7024fc27..d3fd1d5770922196e794f133f9a1a420f5f1d495 100644 (file)
@@ -7,7 +7,6 @@
 // Copyright (C) 2006 Novell, Inc (http://www.novell.com)
 //
 //
-// 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,
@@ -48,7 +47,7 @@ namespace System.Diagnostics
                private IntPtr _readHandle;
                private Thread _notifyThread;
                private int _lastEntryWritten;
-               private bool _notifying;
+               private Object _eventLock = new object();
 
                public Win32EventLog (EventLog coreEventLog)
                        : base (coreEventLog)
@@ -68,9 +67,11 @@ namespace System.Diagnostics
 
                public override void Close ()
                {
-                       if (_readHandle != IntPtr.Zero) {
-                               CloseEventLog (_readHandle);
-                               _readHandle = IntPtr.Zero;
+                       lock (_eventLock) {
+                               if (_readHandle != IntPtr.Zero) {
+                                       CloseEventLog (_readHandle);
+                                       _readHandle = IntPtr.Zero;
+                               }
                        }
                }
 
@@ -703,45 +704,56 @@ namespace System.Diagnostics
 
                public override void DisableNotification ()
                {
-                       if (_notifyResetEvent != null) {
-                               _notifyResetEvent.Close ();
-                               _notifyResetEvent = null;
-                       }
-
-                       if (_notifyThread != null) {
-                               if (_notifyThread.ThreadState == System.Threading.ThreadState.Running)
-                                       _notifyThread.Abort ();
+                       lock (_eventLock) {
+                               if (_notifyResetEvent != null) {
+                                       _notifyResetEvent.Close ();
+                                       _notifyResetEvent = null;
+                               }
                                _notifyThread = null;
                        }
                }
 
                public override void EnableNotification ()
                {
-                       _notifyResetEvent = new ManualResetEvent (false);
-                       _lastEntryWritten = OldestEventLogEntry + EntryCount;
-                       if (PInvoke.NotifyChangeEventLog (ReadHandle, _notifyResetEvent.Handle) == 0)
-                               throw new InvalidOperationException (string.Format (
-                                       CultureInfo.InvariantCulture, "Unable to receive notifications"
-                                       + " for log '{0}' on computer '{1}'.", CoreEventLog.GetLogName (),
-                                       CoreEventLog.MachineName), new Win32Exception ());
-                       _notifyThread = new Thread (new ThreadStart (NotifyEventThread));
-                       _notifyThread.IsBackground = true;
-                       _notifyThread.Start ();
+                       lock (_eventLock) {
+                               if (_notifyResetEvent != null)
+                                       return;
+
+                               _notifyResetEvent = new ManualResetEvent (false);
+                               _lastEntryWritten = OldestEventLogEntry + EntryCount;
+                               if (PInvoke.NotifyChangeEventLog (ReadHandle, _notifyResetEvent.Handle) == 0)
+                                       throw new InvalidOperationException (string.Format (
+                                               CultureInfo.InvariantCulture, "Unable to receive notifications"
+                                               + " for log '{0}' on computer '{1}'.", CoreEventLog.GetLogName (),
+                                               CoreEventLog.MachineName), new Win32Exception ());
+                               _notifyThread = new Thread (() => NotifyEventThread(_notifyResetEvent));
+                               _notifyThread.IsBackground = true;
+                               _notifyThread.Start ();
+                       }
                }
 
-               private void NotifyEventThread ()
+               private void NotifyEventThread (ManualResetEvent resetEvent)
                {
                        while (true) {
-                               _notifyResetEvent.WaitOne ();
-                               lock (this) {
-                                       // after a clear, we something get notified
-                                       // twice for the same entry
-                                       if (_notifying)
-                                               return;
-                                       _notifying = true;
+                               try {
+                                       resetEvent.WaitOne ();
+                               } catch (ObjectDisposedException) {
+                                       // Notifications have been disabled and event 
+                                       // has been closed but not yet nulled. End thread.
+                                       break;
                                }
 
-                               try {
+                               lock (_eventLock) {
+                                       if (resetEvent != _notifyResetEvent) {
+                                               // A new thread has started with another reset event instance
+                                               // or DisableNotifications has been called, setting
+                                               // _notifyResetEvent to null. In both cases end this thread.
+                                               break;
+                                       }
+
+                                       if (_readHandle == IntPtr.Zero)
+                                               break;
+
                                        int oldest_entry = OldestEventLogEntry;
                                        if (_lastEntryWritten < oldest_entry)
                                                _lastEntryWritten = oldest_entry;
@@ -752,9 +764,6 @@ namespace System.Diagnostics
                                                CoreEventLog.OnEntryWritten (entry);
                                        }
                                        _lastEntryWritten = last_entry;
-                               } finally {
-                                       lock (this)
-                                               _notifying = false;
                                }
                        }
                }
index efed94f85503853ebcb46d07f6d5655dda3ffd95..705cd5d0206658a1bb3b900c3e98e4951560ecd5 100644 (file)
@@ -52,13 +52,13 @@ namespace System.IO.Compression
                bool disposed;
                DeflateStreamNative native;
 
-               public DeflateStream (Stream compressedStream, CompressionMode mode) :
-                       this (compressedStream, mode, false, false)
+               public DeflateStream (Stream stream, CompressionMode mode) :
+                       this (stream, mode, false, false)
                {
                }
 
-               public DeflateStream (Stream compressedStream, CompressionMode mode, bool leaveOpen) :
-                       this (compressedStream, mode, leaveOpen, false)
+               public DeflateStream (Stream stream, CompressionMode mode, bool leaveOpen) :
+                       this (stream, mode, leaveOpen, false)
                {
                }
 
@@ -124,23 +124,23 @@ namespace System.IO.Compression
                        }
                }
 
-               public override int Read (byte[] dest, int dest_offset, int count)
+               public override int Read (byte[] array, int offset, int count)
                {
                        if (disposed)
                                throw new ObjectDisposedException (GetType ().FullName);
-                       if (dest == null)
+                       if (array == null)
                                throw new ArgumentNullException ("Destination array is null.");
                        if (!CanRead)
                                throw new InvalidOperationException ("Stream does not support reading.");
-                       int len = dest.Length;
-                       if (dest_offset < 0 || count < 0)
+                       int len = array.Length;
+                       if (offset < 0 || count < 0)
                                throw new ArgumentException ("Dest or count is negative.");
-                       if (dest_offset > len)
+                       if (offset > len)
                                throw new ArgumentException ("destination offset is beyond array size");
-                       if ((dest_offset + count) > len)
+                       if ((offset + count) > len)
                                throw new ArgumentException ("Reading would overrun buffer");
 
-                       return ReadInternal (dest, dest_offset, count);
+                       return ReadInternal (array, offset, count);
                }
 
                unsafe void WriteInternal (byte[] array, int offset, int count)
@@ -154,16 +154,16 @@ namespace System.IO.Compression
                        }
                }
 
-               public override void Write (byte[] src, int src_offset, int count)
+               public override void Write (byte[] array, int offset, int count)
                {
                        if (disposed)
                                throw new ObjectDisposedException (GetType ().FullName);
 
-                       if (src == null)
-                               throw new ArgumentNullException ("src");
+                       if (array == null)
+                               throw new ArgumentNullException ("array");
 
-                       if (src_offset < 0)
-                               throw new ArgumentOutOfRangeException ("src_offset");
+                       if (offset < 0)
+                               throw new ArgumentOutOfRangeException ("offset");
 
                        if (count < 0)
                                throw new ArgumentOutOfRangeException ("count");
@@ -171,10 +171,10 @@ namespace System.IO.Compression
                        if (!CanWrite)
                                throw new NotSupportedException ("Stream does not support writing");
 
-                       if (src_offset > src.Length - count)
+                       if (offset > array.Length - count)
                                throw new ArgumentException ("Buffer too small. count/offset wrong.");
 
-                       WriteInternal (src, src_offset, count);
+                       WriteInternal (array, offset, count);
                }
 
                public override void Flush ()
index 88f774ad099edd5bf6a599438616d72972063f2b..edd8e93a893b77b53c1bdf9403113fe13edfa310 100644 (file)
@@ -70,21 +70,21 @@ namespace System.IO.Compression {
                        base.Dispose (disposing);
                }
 
-               public override int Read (byte[] dest, int dest_offset, int count)
+               public override int Read (byte[] array, int offset, int count)
                {
                        if (deflateStream == null)
                                throw new ObjectDisposedException (GetType ().FullName);
 
-                       return deflateStream.Read(dest, dest_offset, count);
+                       return deflateStream.Read(array, offset, count);
                }
 
 
-               public override void Write (byte[] src, int src_offset, int count)
+               public override void Write (byte[] array, int offset, int count)
                {
                        if (deflateStream == null)
                                throw new ObjectDisposedException (GetType ().FullName);
 
-                       deflateStream.Write (src, src_offset, count);
+                       deflateStream.Write (array, offset, count);
                }
 
                public override void Flush()
index 43d3c2f362e1f681a13c46a53265585006de6e6a..53e31d61f7ea7d7891f431b4800e42ffe8b09d29 100644 (file)
@@ -224,7 +224,7 @@ namespace System.IO {
 
                [DefaultValue("*.*")]
                [IODescription("File name filter pattern")]
-               [RecommendedAsConfigurable(true)]
+               [SettingsBindable(true)]
                [TypeConverter ("System.Diagnostics.Design.StringValueConverter, " + Consts.AssemblySystem_Design)]
                public string Filter {
                        get { return filter; }
@@ -293,7 +293,7 @@ namespace System.IO {
 
                [DefaultValue("")]
                [IODescription("The directory to monitor")]
-               [RecommendedAsConfigurable(true)]
+               [SettingsBindable(true)]
                [TypeConverter ("System.Diagnostics.Design.StringValueConverter, " + Consts.AssemblySystem_Design)]
                [Editor ("System.Diagnostics.Design.FSWPathEditor, " + Consts.AssemblySystem_Design, "System.Drawing.Design.UITypeEditor, " + Consts.AssemblySystem_Drawing)]
                public string Path {
index 3b274e0599e3bb53e849adfb400d0b3904118e18..e1031141a9fad2beb01ac72d286f28feade96d83 100644 (file)
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+using System.ComponentModel;
+
+#pragma warning disable 67
+
 namespace System.IO
 {
-    public class FileSystemWatcher : IDisposable
+    public class FileSystemWatcher : Component, IDisposable, ISupportInitialize
     {
         public FileSystemWatcher () { throw new NotImplementedException (); }
         public FileSystemWatcher (string path) { throw new NotImplementedException (); }
@@ -39,11 +43,15 @@ namespace System.IO
         public int InternalBufferSize { get { throw new NotImplementedException (); } set { } }
         public NotifyFilters NotifyFilter { get { throw new NotImplementedException (); } set { } }
         public string Path { get { throw new NotImplementedException (); } set { } }
+        public override ISite Site { get { throw new NotImplementedException (); } set { } }
+        public ISynchronizeInvoke SynchronizingObject { get { throw new NotImplementedException (); } set { } }
         public event FileSystemEventHandler Changed;
         public event FileSystemEventHandler Created;
         public event FileSystemEventHandler Deleted;
         public event ErrorEventHandler Error;
         public event RenamedEventHandler Renamed;
+        public void BeginInit() { throw new NotImplementedException (); }
+        public void EndInit() { throw new NotImplementedException (); }
         protected void OnChanged (FileSystemEventArgs e) { throw new NotImplementedException (); }
         protected void OnCreated (FileSystemEventArgs e) { throw new NotImplementedException (); }
         protected void OnDeleted (System.IO.FileSystemEventArgs e) { throw new NotImplementedException (); }
@@ -51,13 +59,6 @@ namespace System.IO
         protected void OnRenamed (RenamedEventArgs e) { throw new NotImplementedException (); }
         public WaitForChangedResult WaitForChanged (WatcherChangeTypes changeType) { throw new NotImplementedException (); }
         public WaitForChangedResult WaitForChanged (WatcherChangeTypes changeType, int timeout) { throw new NotImplementedException (); }
-
-        public virtual void Dispose ()
-        {
-        }
-
-        protected virtual void Dispose (bool disposing)
-        {
-        }
+        protected override void Dispose (bool disposing) { throw new NotImplementedException (); }
     }
 }
\ No newline at end of file
index 42a0d5afb7583832643a0cadd4e791a2d6f0c458..36a1db9d29b399399e103b3c3bd6909bcb4da2e3 100644 (file)
@@ -36,6 +36,8 @@ using System.Xml;
 using XmlNode = System.Object;
 #endif
 
+#pragma warning disable 618
+
 namespace System.Net.Configuration
 {
        class ConnectionManagementData
index 594803e2c2dc0314087b3dbec5c55e6ccd4f14c0..1bdf52da949c9952bb88fe1b193d263341de7a29 100644 (file)
@@ -64,9 +64,9 @@ namespace System.Net.Configuration
                                        continue;
                                }
 
-                               string prefix = HandlersUtil.ExtractAttributeValue ("prefix", child);
+                               //string prefix = HandlersUtil.ExtractAttributeValue ("prefix", child);
                                if (name == "add") {
-                                       string type = HandlersUtil.ExtractAttributeValue ("type", child, false);
+                                       //string type = HandlersUtil.ExtractAttributeValue ("type", child, false);
                                        if (child.Attributes != null && child.Attributes.Count != 0)
                                                HandlersUtil.ThrowException ("Unrecognized attribute", child);
 
index 3b978ac32fa813a2f5359fbcd6aab3ffd6d5a8c5..b5a58d86b8160caadfdf41d028408ffe441e0983 100644 (file)
@@ -153,6 +153,11 @@ namespace System.Net.Mail {
                        set { bodyEncoding = value; }
                }
 
+               public TransferEncoding BodyTransferEncoding {
+                       get { return GuessTransferEncoding (BodyEncoding); }
+                       set { throw new NotImplementedException (); }
+               }
+
                public MailAddressCollection CC {
                        get { return cc; }
                }
@@ -255,7 +260,7 @@ namespace System.Net.Mail {
                        if (Encoding.ASCII.Equals (enc))
                                return TransferEncoding.SevenBit;
                        else if (Encoding.UTF8.CodePage == enc.CodePage ||
-#if !NET_2_1
+#if !MOBILE
                            Encoding.Unicode.CodePage == enc.CodePage || Encoding.UTF32.CodePage == enc.CodePage
 #else
                            Encoding.Unicode.CodePage == enc.CodePage
diff --git a/mcs/class/System/System.Net.Mail/SmtpClient.platformnotsupported.cs b/mcs/class/System/System.Net.Mail/SmtpClient.platformnotsupported.cs
new file mode 100644 (file)
index 0000000..92ef97d
--- /dev/null
@@ -0,0 +1,167 @@
+//
+// System.Net.Mail.SmtpClient.cs
+//
+// Author:
+//     Rolf Bjarne Kvinge <rolf@xamarin.com>
+//
+// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com)
+//
+// 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.ComponentModel;
+using System.Security.Cryptography.X509Certificates;
+using System.Threading.Tasks;
+
+namespace System.Net.Mail {
+       public class SmtpClient
+               : IDisposable
+       {
+               const string EXCEPTION_MESSAGE = "System.Net.Mail.SmtpClient is not supported on the current platform.";
+
+               public SmtpClient ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public SmtpClient (string host)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public SmtpClient (string host, int port)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+#if SECURITY_DEP
+               [MonoTODO("Client certificates not used")]
+               public X509CertificateCollection ClientCertificates {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+#endif
+
+               public string TargetName { get; set; }
+
+               public ICredentialsByHost Credentials {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public SmtpDeliveryMethod DeliveryMethod {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public bool EnableSsl {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public string Host {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public string PickupDirectoryLocation {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public int Port {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+               
+               public SmtpDeliveryFormat DeliveryFormat {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+               
+               public ServicePoint ServicePoint {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public int Timeout {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public bool UseDefaultCredentials {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+#pragma warning disable 0067 // The event `System.Net.Mail.SmtpClient.SendCompleted' is never used
+               public event SendCompletedEventHandler SendCompleted;
+#pragma warning restore 0067
+
+               public void Dispose ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               protected virtual void Dispose (bool disposing)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               protected void OnSendCompleted (AsyncCompletedEventArgs e)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public void Send (MailMessage message)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public void Send (string from, string to, string subject, string body)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public Task SendMailAsync (MailMessage message)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public Task SendMailAsync (string from, string recipients, string subject, string body)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public void SendAsync (MailMessage message, object userToken)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public void SendAsync (string from, string to, string subject, string body, object userToken)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public void SendAsyncCancel ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+       }
+}
+
index 2b39ff8311c427735dc99ddcab36b62839b8590b..e07ff90804ecae13d0afac89c5e9a2082d280110 100644 (file)
@@ -39,8 +39,6 @@ namespace System.Net.NetworkInformation {
        {
                public static readonly Win32IPAddressCollection Empty = new Win32IPAddressCollection (IntPtr.Zero);
 
-               bool is_readonly;
-
                // for static methods
                Win32IPAddressCollection ()
                {
@@ -50,7 +48,6 @@ namespace System.Net.NetworkInformation {
                {
                        foreach (IntPtr head in heads)
                                AddSubsequentlyString (head);
-                       is_readonly = true;
                }
 
                public Win32IPAddressCollection (params Win32_IP_ADDR_STRING [] al)
@@ -58,10 +55,9 @@ namespace System.Net.NetworkInformation {
                        foreach (Win32_IP_ADDR_STRING a in al) {
                                if (String.IsNullOrEmpty (a.IpAddress))
                                        continue;
-                               Add (IPAddress.Parse (a.IpAddress));
+                               InternalAdd (IPAddress.Parse (a.IpAddress));
                                AddSubsequentlyString (a.Next);
                        }
-                       is_readonly = true;
                }
 
                public static Win32IPAddressCollection FromAnycast (IntPtr ptr)
@@ -70,9 +66,8 @@ namespace System.Net.NetworkInformation {
                        Win32_IP_ADAPTER_ANYCAST_ADDRESS a;
                        for (IntPtr p = ptr; p != IntPtr.Zero; p = a.Next) {
                                a = (Win32_IP_ADAPTER_ANYCAST_ADDRESS) Marshal.PtrToStructure (p, typeof (Win32_IP_ADAPTER_ANYCAST_ADDRESS));
-                               c.Add (a.Address.GetIPAddress ());
+                               c.InternalAdd (a.Address.GetIPAddress ());
                        }
-                       c.is_readonly = true;
                        return c;
                }
 
@@ -84,9 +79,8 @@ namespace System.Net.NetworkInformation {
                                a = (Win32_IP_ADAPTER_DNS_SERVER_ADDRESS) Marshal.PtrToStructure (p, typeof (Win32_IP_ADAPTER_DNS_SERVER_ADDRESS));
 // FIXME: It somehow fails here. Looks like there is something wrong.
 //if (a.Address.Sockaddr == IntPtr.Zero) throw new Exception ("pointer " + p + " a.length " + a.Address.SockaddrLength);
-                               c.Add (a.Address.GetIPAddress ());
+                               c.InternalAdd (a.Address.GetIPAddress ());
                        }
-                       c.is_readonly = true;
                        return c;
                }
 
@@ -95,13 +89,9 @@ namespace System.Net.NetworkInformation {
                        Win32_IP_ADDR_STRING a;
                        for (IntPtr p = head; p != IntPtr.Zero; p = a.Next) {
                                a = (Win32_IP_ADDR_STRING) Marshal.PtrToStructure (p, typeof (Win32_IP_ADDR_STRING));
-                               Add (IPAddress.Parse (a.IpAddress));
+                               InternalAdd (IPAddress.Parse (a.IpAddress));
                        }
                }
-
-               public override bool IsReadOnly {
-                       get { return is_readonly; }
-               }
        }
 #endif
 }
index be2d13b71c02383937747b08837e1de486198005..6b5e60cdcff8abc84a7baa53eb32ef01b88254c7 100644 (file)
@@ -487,7 +487,7 @@ namespace System.Net.NetworkInformation {
 
                public override IcmpV4Statistics GetIcmpV4Statistics ()
                {
-                       if (!Socket.SupportsIPv4)
+                       if (!Socket.OSSupportsIPv4)
                                throw new NetworkInformationException ();
                        Win32_MIBICMPINFO stats;
                        GetIcmpStatistics (out stats, AF_INET);
@@ -505,7 +505,7 @@ namespace System.Net.NetworkInformation {
 
                public override IPGlobalStatistics GetIPv4GlobalStatistics ()
                {
-                       if (!Socket.SupportsIPv4)
+                       if (!Socket.OSSupportsIPv4)
                                throw new NetworkInformationException ();
                        Win32_MIB_IPSTATS stats;
                        GetIpStatisticsEx (out stats, AF_INET);
@@ -523,7 +523,7 @@ namespace System.Net.NetworkInformation {
 
                public override TcpStatistics GetTcpIPv4Statistics ()
                {
-                       if (!Socket.SupportsIPv4)
+                       if (!Socket.OSSupportsIPv4)
                                throw new NetworkInformationException ();
                        Win32_MIB_TCPSTATS stats;
                        GetTcpStatisticsEx (out stats, AF_INET);
@@ -541,7 +541,7 @@ namespace System.Net.NetworkInformation {
 
                public override UdpStatistics GetUdpIPv4Statistics ()
                {
-                       if (!Socket.SupportsIPv4)
+                       if (!Socket.OSSupportsIPv4)
                                throw new NetworkInformationException ();
                        Win32_MIB_UDPSTATS stats;
                        GetUdpStatisticsEx (out stats, AF_INET);
index 9a8560a92b58275149f51640218549c4c1a15652..af9fbec33bef62230039b5cefe5983203eb9ca64 100644 (file)
@@ -406,17 +406,17 @@ namespace System.Net.NetworkInformation {
                        get {
                                Win32_IP_ADAPTER_INFO ai = Win32NetworkInterface2.GetAdapterInfoByIndex (mib4.Index);
                                // FIXME: should ipv6 DhcpServer be considered?
-                               return ai != null ? Win32FromUnicast ((int) ai.Index, addr.FirstUnicastAddress) : new UnicastIPAddressInformationCollection ();
+                               return ai != null ? Win32FromUnicast (addr.FirstUnicastAddress) : new UnicastIPAddressInformationCollection ();
                        }
                }
 
-               static UnicastIPAddressInformationCollection Win32FromUnicast (int ifIndex, IntPtr ptr)
+               static UnicastIPAddressInformationCollection Win32FromUnicast (IntPtr ptr)
                {
                        UnicastIPAddressInformationCollection c = new UnicastIPAddressInformationCollection ();
                        Win32_IP_ADAPTER_UNICAST_ADDRESS a;
                        for (IntPtr p = ptr; p != IntPtr.Zero; p = a.Next) {
                                a = (Win32_IP_ADAPTER_UNICAST_ADDRESS) Marshal.PtrToStructure (p, typeof (Win32_IP_ADAPTER_UNICAST_ADDRESS));
-                               c.InternalAdd (new Win32UnicastIPAddressInformation (ifIndex, a));
+                               c.InternalAdd (new Win32UnicastIPAddressInformation (a));
                        }
                        return c;
                }
index ece698af2b45ee2714a2c52e822ce4a09c90083d..3f872e731c6a6f5fea677b5090f1e25112219f53 100644 (file)
@@ -438,9 +438,14 @@ namespace System.Net.NetworkInformation {
 #if !MOBILE
                class Win32NetworkInterfaceAPI : NetworkInterfaceFactory
                {
-                       [DllImport ("iphlpapi.dll", SetLastError = true)]
+                       private const string IPHLPAPI = "iphlpapi.dll";
+
+                       [DllImport (IPHLPAPI, SetLastError = true)]
                        static extern int GetAdaptersAddresses (uint family, uint flags, IntPtr reserved, byte [] info, ref int size);
 
+                       [DllImport (IPHLPAPI)]
+                       static extern uint GetBestInterfaceEx (byte[] ipAddress, out int index);
+
                        unsafe static Win32_IP_ADAPTER_ADDRESSES [] GetAdaptersAddresses ()
                        {
                                byte [] bytes = null;
@@ -473,9 +478,20 @@ namespace System.Net.NetworkInformation {
                                return ret;
                        }
 
+                       private static int GetBestInterfaceForAddress (IPAddress addr) {
+                               int index;
+                               SocketAddress address = new SocketAddress (addr);
+                               int error = (int) GetBestInterfaceEx (address.m_Buffer, out index);
+                               if (error != 0) {
+                                       throw new NetworkInformationException (error);
+                               }
+
+                               return index;
+                       }
+
                        public override int GetLoopbackInterfaceIndex ()
                        {
-                               throw new NotImplementedException ();
+                               return GetBestInterfaceForAddress (IPAddress.Loopback);
                        }
 
                        public override IPAddress GetNetMask (IPAddress address)
@@ -494,7 +510,6 @@ namespace System.Net.NetworkInformation {
 #if MONOTOUCH || XAMMAC
                        return new MacOsNetworkInterfaceAPI ();
 #else
-                       Version windowsVer51 = new Version (5, 1);
                        bool runningOnUnix = (Environment.OSVersion.Platform == PlatformID.Unix);
 
                        if (runningOnUnix) {
@@ -505,6 +520,7 @@ namespace System.Net.NetworkInformation {
                        }
 
 #if !MOBILE
+                       Version windowsVer51 = new Version (5, 1);
                        if (Environment.OSVersion.Version >= windowsVer51)
                                return new Win32NetworkInterfaceAPI ();
 #endif
@@ -615,6 +631,19 @@ namespace System.Net.NetworkInformation {
                string               iface_operstate_path;
                string               iface_flags_path;          
 
+#if MONODROID
+               [DllImport ("__Internal")]
+               static extern int _monodroid_get_android_api_level ();
+
+               [DllImport ("__Internal")]
+               static extern bool _monodroid_get_network_interface_up_state (string ifname, ref bool is_up);
+
+               [DllImport ("__Internal")]
+               static extern bool _monodroid_get_network_interface_supports_multicast (string ifname, ref bool supports_multicast);
+
+               bool android_use_java_api;
+#endif
+
                internal string IfacePath {
                        get { return iface_path; }
                }
@@ -625,6 +654,9 @@ namespace System.Net.NetworkInformation {
                        iface_path = "/sys/class/net/" + name + "/";
                        iface_operstate_path = iface_path + "operstate";
                        iface_flags_path = iface_path + "flags";
+#if MONODROID
+                       android_use_java_api = _monodroid_get_android_api_level () >= 24;
+#endif
                }
 
                public override IPInterfaceProperties GetIPProperties ()
@@ -643,6 +675,23 @@ namespace System.Net.NetworkInformation {
 
                public override OperationalStatus OperationalStatus {
                        get {
+#if MONODROID
+                               if (android_use_java_api) {
+                                       // Starting from API 24 (Android 7 "Nougat") Android restricts access to many
+                                       // files in the /sys filesystem (see https://code.google.com/p/android/issues/detail?id=205565
+                                       // for more information) and therefore we are forced to call into Java API in
+                                       // order to get the information. Alas, what we can obtain in this way is quite
+                                       // limited. In the case of OperationalStatus we can only determine whether the
+                                       // interface is up or down. There is a way to get more detailed information but
+                                       // it requires an instance of the Android Context class which is not available
+                                       // to us here.
+                                       bool is_up = false;
+                                       if (_monodroid_get_network_interface_up_state (Name, ref is_up))
+                                               return is_up ? OperationalStatus.Up : OperationalStatus.Down;
+                                       else
+                                               return OperationalStatus.Unknown;
+                               }
+#endif
                                if (!Directory.Exists (iface_path))
                                        return OperationalStatus.Unknown;
                                
@@ -679,6 +728,17 @@ namespace System.Net.NetworkInformation {
 
                public override bool SupportsMulticast {
                        get {
+#if MONODROID
+                               if (android_use_java_api) {
+                                       // Starting from API 24 (Android 7 "Nougat") Android restricts access to many
+                                       // files in the /sys filesystem (see https://code.google.com/p/android/issues/detail?id=205565
+                                       // for more information) and therefore we are forced to call into Java API in
+                                       // order to get the information.
+                                       bool supports_multicast = false;
+                                       _monodroid_get_network_interface_supports_multicast (Name, ref supports_multicast);
+                                       return supports_multicast;
+                               }
+#endif
                                if (!Directory.Exists (iface_path))
                                        return false;
                                
index 72645bcd3a712796e6c935af1280e12d887907b9..c69388a58076e36d35a638b0dd911fcf785f9a46 100644 (file)
@@ -209,9 +209,12 @@ namespace System.Net.NetworkInformation {
 
                static IPAddress GetNonLoopbackIP ()
                {
+#pragma warning disable 618
                        foreach (IPAddress addr in Dns.GetHostByName (Dns.GetHostName ()).AddressList)
                                if (!IPAddress.IsLoopback (addr))
                                        return addr;
+#pragma warning restore 618
+
                        throw new InvalidOperationException ("Could not resolve non-loopback IP address for localhost");
                }
 
@@ -262,12 +265,12 @@ namespace System.Net.NetworkInformation {
                                bytes = new byte [100];
                                do {
                                        EndPoint endpoint = client;
-                                       int error = 0;
-                                       int rc = s.ReceiveFrom_nochecks_exc (bytes, 0, 100, SocketFlags.None,
-                                                       ref endpoint, false, out error);
+                                       SocketError error = 0;
+                                       int rc = s.ReceiveFrom (bytes, 0, 100, SocketFlags.None,
+                                                       ref endpoint, out error);
 
-                                       if (error != 0) {
-                                               if (error == (int) SocketError.TimedOut) {
+                                       if (error != SocketError.Success) {
+                                               if (error == SocketError.TimedOut) {
                                                        return new PingReply (null, new byte [0], options, 0, IPStatus.TimedOut);
                                                }
                                                throw new NotSupportedException (String.Format ("Unexpected socket error during ping request: {0}", error));
index 439cab07cf091c553d92b9ba5565fdd1d81bb0dc..17710c420fd9c5188fef8dfcef54222bf74c250c 100644 (file)
 using System;
 using System.Runtime.InteropServices;
 using System.Net.Sockets;
+using System.Diagnostics.Contracts;
 
 namespace System.Net.NetworkInformation {
 #if !MOBILE
        class Win32UnicastIPAddressInformation : UnicastIPAddressInformation 
        {
-               int if_index;
                Win32_IP_ADAPTER_UNICAST_ADDRESS info;
+               IPAddress ipv4Mask;
 
-               public Win32UnicastIPAddressInformation (int ifIndex, Win32_IP_ADAPTER_UNICAST_ADDRESS info)
+               public Win32UnicastIPAddressInformation (Win32_IP_ADAPTER_UNICAST_ADDRESS info)
                {
-                       this.if_index = ifIndex;
                        this.info = info;
+                       IPAddress ipAddress = info.Address.GetIPAddress ();
+                       // IPv6 returns 0.0.0.0 for consistancy with XP
+                       if (ipAddress.AddressFamily == AddressFamily.InterNetwork) {
+                               ipv4Mask = PrefixLengthToSubnetMask (info.OnLinkPrefixLength, ipAddress.AddressFamily);
+                       }
                }
 
                public override IPAddress Address {
@@ -74,27 +79,15 @@ namespace System.Net.NetworkInformation {
                        get { return info.DadState; }
                }
 
-               public override IPAddress IPv4Mask {
+               public override IPAddress IPv4Mask{
                        get {
-                               Win32_IP_ADAPTER_INFO ai = Win32NetworkInterface2.GetAdapterInfoByIndex (if_index);
-                               if (ai == null)
-                                       throw new Exception ("huh? " + if_index);
-                               if (this.Address == null)
-                                       return null;
-                               string expected = this.Address.ToString ();
-                               unsafe {
-                                       Win32_IP_ADDR_STRING p = ai.IpAddressList;
-                                       while (true) {
-                                               if (p.IpAddress == expected)
-                                                       return IPAddress.Parse (p.IpMask);
-                                               if (p.Next == IntPtr.Zero)
-                                                       break;
-                                               p = (Win32_IP_ADDR_STRING) Marshal.PtrToStructure (p.Next, typeof (Win32_IP_ADDR_STRING));
-                                       }
-
-                                       // Or whatever it should be...
-                                       return null;
+                               // The IPv6 equivilant was never available on XP, and we've kept this behavior for legacy reasons.
+                               // For IPv6 use PrefixLength instead.
+                               if (Address.AddressFamily != AddressFamily.InterNetwork) {
+                                       return IPAddress.Any;
                                }
+
+                               return ipv4Mask;
                        }
                }
 
@@ -105,6 +98,28 @@ namespace System.Net.NetworkInformation {
                public override SuffixOrigin SuffixOrigin {
                        get { return info.SuffixOrigin; }
                }
+
+               // Convert a CIDR prefix length to a subnet mask "255.255.255.0" format
+               private static IPAddress PrefixLengthToSubnetMask (byte prefixLength, AddressFamily family) {
+                       Contract.Requires ((0 <= prefixLength) && (prefixLength <= 126));
+                       Contract.Requires ((family == AddressFamily.InterNetwork) || (family == AddressFamily.InterNetworkV6));
+
+                       byte[] addressBytes;
+                       if (family == AddressFamily.InterNetwork) {
+                               addressBytes = new byte [4];
+                       } else { // v6
+                               addressBytes = new byte [16];
+                       }
+
+                       Contract.Assert (prefixLength < (addressBytes.Length * 8));
+
+                       // Enable bits one at a time from left/high to right/low
+                       for (int bit = 0; bit < prefixLength; bit++) {
+                               addressBytes [bit / 8] |= (byte) (0x80 >> (bit % 8));
+                       }
+
+                       return new IPAddress (addressBytes);
+               }
        }
 #endif
 
index f9cb48fc731b07da8b83cabcb4cbc23210ccf733..d58a0e261fc7121c38abf31ba0a3f1847e4a4883 100644 (file)
@@ -25,7 +25,6 @@
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
-#if !MONO_FEATURE_NEW_TLS
 namespace System.Net.Security
 {
        public enum EncryptionPolicy
@@ -35,4 +34,3 @@ namespace System.Net.Security
                NoEncryption
        }
 }
-#endif
index 9b77646d7b1502b669d501fcd04bd3e9197c687c..f71585c0f00590751d0cf31b4dcc030cec20e7d7 100644 (file)
@@ -28,7 +28,7 @@
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
-#if SECURITY_DEP && !MONO_FEATURE_NEW_TLS
+#if SECURITY_DEP
 
 using System.Security.Cryptography.X509Certificates;
 
index ad9e3526ff740c4e1a682f38592ab6529ddcf54d..0ee2c7b8258f7f4fc72038ca3c99e8d243507aee 100644 (file)
@@ -148,6 +148,12 @@ namespace System.Net.Security
                        throw new NotImplementedException ();
                }
 
+               [MonoTODO]
+               public virtual IAsyncResult BeginAuthenticateAsClient (NetworkCredential credential, ChannelBinding binding, string targetName, AsyncCallback asyncCallback, object asyncState)
+               {
+                       throw new NotImplementedException ();
+               }
+
                [MonoTODO]
                public virtual IAsyncResult BeginAuthenticateAsClient (NetworkCredential credential, string targetName, AsyncCallback asyncCallback, object asyncState)
                {
@@ -160,6 +166,12 @@ namespace System.Net.Security
                        throw new NotImplementedException ();
                }
 
+               [MonoTODO]
+               public virtual IAsyncResult BeginAuthenticateAsClient (NetworkCredential credential, ChannelBinding binding, string targetName, ProtectionLevel requiredProtectionLevel, TokenImpersonationLevel allowedImpersonationLevel, AsyncCallback asyncCallback, object asyncState)
+               {
+                       throw new NotImplementedException ();
+               }
+
                [MonoTODO]
                public override IAsyncResult BeginRead (byte[] buffer, int offset, int count, AsyncCallback asyncCallback, object asyncState)
                {
@@ -172,12 +184,24 @@ namespace System.Net.Security
                        throw new NotImplementedException ();
                }
 
+               [MonoTODO]
+               public virtual IAsyncResult BeginAuthenticateAsServer (NetworkCredential credential, ExtendedProtectionPolicy policy, ProtectionLevel requiredProtectionLevel, TokenImpersonationLevel requiredImpersonationLevel, AsyncCallback asyncCallback, object asyncState)
+               {
+                       throw new NotImplementedException ();
+               }
+
                [MonoTODO]
                public virtual IAsyncResult BeginAuthenticateAsServer (NetworkCredential credential, ProtectionLevel requiredProtectionLevel, TokenImpersonationLevel requiredImpersonationLevel, AsyncCallback asyncCallback, object asyncState)
                {
                        throw new NotImplementedException ();
                }
 
+               [MonoTODO]
+               public virtual IAsyncResult BeginAuthenticateAsServer (ExtendedProtectionPolicy policy, AsyncCallback asyncCallback, object asyncState)
+               {
+                       throw new NotImplementedException ();
+               }
+
                [MonoTODO]
                public override IAsyncResult BeginWrite (byte[] buffer, int offset, int count, AsyncCallback asyncCallback, object asyncState)
                {
@@ -196,6 +220,18 @@ namespace System.Net.Security
                        throw new NotImplementedException ();
                }
 
+               [MonoTODO]
+               public virtual void AuthenticateAsClient (NetworkCredential credential, ChannelBinding binding, string targetName)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public virtual void AuthenticateAsClient (NetworkCredential credential, ChannelBinding binding, string targetName, ProtectionLevel requiredProtectionLevel, TokenImpersonationLevel allowedImpersonationLevel)
+               {
+                       throw new NotImplementedException ();
+               }
+
                [MonoTODO]
                public virtual void AuthenticateAsClient (NetworkCredential credential, string targetName, ProtectionLevel requiredProtectionLevel, TokenImpersonationLevel allowedImpersonationLevel)
                {
@@ -208,6 +244,18 @@ namespace System.Net.Security
                        throw new NotImplementedException ();
                }
 
+               [MonoTODO]
+               public virtual void AuthenticateAsServer (ExtendedProtectionPolicy policy)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public virtual void AuthenticateAsServer (NetworkCredential credential, ExtendedProtectionPolicy policy, ProtectionLevel requiredProtectionLevel, TokenImpersonationLevel requiredImpersonationLevel)
+               {
+                       throw new NotImplementedException ();
+               }
+
                [MonoTODO]
                public virtual void AuthenticateAsServer (NetworkCredential credential, ProtectionLevel requiredProtectionLevel, TokenImpersonationLevel requiredImpersonationLevel)
                {
index 9238428b1f3841de180dc5f09f3944336a9d82d1..3db9e6b4ad47c8e51a1db1dbfa77934a2e3a8339 100644 (file)
@@ -28,8 +28,6 @@
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
-#if !MONO_FEATURE_NEW_TLS
-
 using System.Security.Cryptography.X509Certificates;
 
 namespace System.Net.Security 
@@ -40,4 +38,3 @@ namespace System.Net.Security
                X509Chain chain,
                SslPolicyErrors sslPolicyErrors);
 }
-#endif
index 5a88d88e8bfdaea77a4023501075882b706e0e50..0da167c71b87cbef0408fe84de46667b1f328d0b 100644 (file)
@@ -25,7 +25,6 @@
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
-#if !MONO_FEATURE_NEW_TLS
 namespace System.Net.Security 
 {
        [Flags]
@@ -37,4 +36,3 @@ namespace System.Net.Security
                RemoteCertificateChainErrors = 4,
        }
 }
-#endif
index 3e7320e3cd160e259773efe54cece0fe38250afa..701eaaad7616c9d654f109aab64485f554384be0 100644 (file)
@@ -24,7 +24,6 @@
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
 
-#if !MONO_FEATURE_NEW_TLS
 #if SECURITY_DEP
 
 #if MONO_SECURITY_ALIAS
@@ -95,7 +94,9 @@ namespace System.Net.Security
 
                static MonoTlsProvider GetProvider ()
                {
+#pragma warning disable 612
                        return MonoTlsProviderFactory.GetDefaultProvider ();
+#pragma warning restore 612
                }
 
                public SslStream (Stream innerStream)
@@ -410,5 +411,3 @@ namespace System.Net.Security
        }
 }
 #endif
-
-#endif
diff --git a/mcs/class/System/System.Net.Security/SslStream.platformnotsupported.cs b/mcs/class/System/System.Net.Security/SslStream.platformnotsupported.cs
new file mode 100644 (file)
index 0000000..1d3f040
--- /dev/null
@@ -0,0 +1,287 @@
+//
+// SslStream.cs
+//
+// Author:
+//       Rolf Bjarne Kvinge <rolf@xamarin.com>
+//
+// Copyright (c) 2016 Xamarin, Inc.
+//
+// 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.IO;
+using System.Security.Authentication;
+using System.Security.Cryptography.X509Certificates;
+using System.Threading.Tasks;
+
+namespace System.Net.Security
+{
+       public class SslStream : AuthenticatedStream
+       {
+               const string EXCEPTION_MESSAGE = "System.Net.Security.SslStream is not supported on the current platform.";
+
+               public SslStream (Stream innerStream)
+                       : this (innerStream, false, null, null)
+               {
+               }
+
+               public SslStream (Stream innerStream, bool leaveInnerStreamOpen)
+                       : this (innerStream, leaveInnerStreamOpen, null, null)
+               {
+               }
+
+               public SslStream (Stream innerStream, bool leaveInnerStreamOpen, RemoteCertificateValidationCallback userCertificateValidationCallback)
+                       : this (innerStream, leaveInnerStreamOpen, userCertificateValidationCallback, null)
+               {
+               }
+
+               public SslStream (Stream innerStream, bool leaveInnerStreamOpen, RemoteCertificateValidationCallback userCertificateValidationCallback, LocalCertificateSelectionCallback userCertificateSelectionCallback)
+                       : base (innerStream, leaveInnerStreamOpen)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public SslStream (Stream innerStream, bool leaveInnerStreamOpen, RemoteCertificateValidationCallback userCertificateValidationCallback, LocalCertificateSelectionCallback userCertificateSelectionCallback, EncryptionPolicy encryptionPolicy)
+                       : this (innerStream, leaveInnerStreamOpen, userCertificateValidationCallback, userCertificateSelectionCallback)
+               {
+               }
+
+               public virtual void AuthenticateAsClient (string targetHost)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public virtual void AuthenticateAsClient (string targetHost, X509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public virtual IAsyncResult BeginAuthenticateAsClient (string targetHost, AsyncCallback asyncCallback, object asyncState)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public virtual IAsyncResult BeginAuthenticateAsClient (string targetHost, X509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, bool checkCertificateRevocation, AsyncCallback asyncCallback, object asyncState)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public virtual void EndAuthenticateAsClient (IAsyncResult asyncResult)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public virtual void AuthenticateAsServer (X509Certificate serverCertificate)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public virtual void AuthenticateAsServer (X509Certificate serverCertificate, bool clientCertificateRequired, SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public virtual IAsyncResult BeginAuthenticateAsServer (X509Certificate serverCertificate, AsyncCallback asyncCallback, object asyncState)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public virtual IAsyncResult BeginAuthenticateAsServer (X509Certificate serverCertificate, bool clientCertificateRequired, SslProtocols enabledSslProtocols, bool checkCertificateRevocation, AsyncCallback asyncCallback, object asyncState)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public virtual void EndAuthenticateAsServer (IAsyncResult asyncResult)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public TransportContext TransportContext {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public virtual Task AuthenticateAsClientAsync (string targetHost)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public virtual Task AuthenticateAsClientAsync (string targetHost, X509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public virtual Task AuthenticateAsServerAsync (X509Certificate serverCertificate)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public virtual Task AuthenticateAsServerAsync (X509Certificate serverCertificate, bool clientCertificateRequired, SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override bool IsAuthenticated {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override bool IsMutuallyAuthenticated {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override bool IsEncrypted {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override bool IsSigned {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override bool IsServer {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public virtual SslProtocols SslProtocol {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public virtual bool CheckCertRevocationStatus {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public virtual X509Certificate LocalCertificate {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public virtual X509Certificate RemoteCertificate {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public virtual CipherAlgorithmType CipherAlgorithm {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public virtual int CipherStrength {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public virtual HashAlgorithmType HashAlgorithm {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public virtual int HashStrength {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public virtual ExchangeAlgorithmType KeyExchangeAlgorithm {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public virtual int KeyExchangeStrength {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override bool CanSeek {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override bool CanRead {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override bool CanTimeout {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override bool CanWrite {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override int ReadTimeout {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override int WriteTimeout {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override long Length {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override long Position {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override void SetLength (long value)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override long Seek (long offset, SeekOrigin origin)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override void Flush ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               protected override void Dispose (bool disposing)
+               {
+               }
+
+               public override int Read (byte[] buffer, int offset, int count)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public void Write (byte[] buffer)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override void Write (byte[] buffer, int offset, int count)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override IAsyncResult BeginRead (byte[] buffer, int offset, int count, AsyncCallback asyncCallback, object asyncState)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override int EndRead (IAsyncResult asyncResult)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override IAsyncResult BeginWrite (byte[] buffer, int offset, int count, AsyncCallback asyncCallback, object asyncState)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override void EndWrite (IAsyncResult asyncResult)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+       }
+}
diff --git a/mcs/class/System/System.Net.Sockets/SendPacketsElement.cs b/mcs/class/System/System.Net.Sockets/SendPacketsElement.cs
deleted file mode 100644 (file)
index 983faa9..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-// System.Net.Sockets.SocketAsyncEventArgs.cs
-//
-// Authors:
-//     Marek Habersack (mhabersack@novell.com)
-//
-// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
-//
-
-//
-// 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;
-
-namespace System.Net.Sockets
-{
-       public class SendPacketsElement
-       {
-               public byte[] Buffer { get; private set; }
-               public int Count { get; private set; }
-               public bool EndOfPacket { get; private set; }
-               public string FilePath { get; private set; }
-               public int Offset { get; private set; }
-
-               public SendPacketsElement (byte[] buffer) : this (buffer, 0, buffer != null ? buffer.Length : 0)
-               {
-               }
-
-               public SendPacketsElement (byte[] buffer, int offset, int count) : this (buffer, offset, count, false)
-               {
-               }
-
-               public SendPacketsElement (byte[] buffer, int offset, int count, bool endOfPacket)
-               {
-                       if (buffer == null)
-                               throw new ArgumentNullException ("buffer");
-
-                       int buflen = buffer.Length;
-                       if (offset < 0 || offset >= buflen)
-                               throw new ArgumentOutOfRangeException ("offset");
-
-                       if (count < 0 || offset + count >= buflen)
-                               throw new ArgumentOutOfRangeException ("count");
-
-                       Buffer = buffer;
-                       Offset = offset;
-                       Count = count;
-                       EndOfPacket = endOfPacket;
-                       FilePath = null;
-               }
-               
-               public SendPacketsElement (string filepath) : this (filepath, 0, 0, false)
-               {
-               }
-
-               public SendPacketsElement (string filepath, int offset, int count) : this (filepath, offset, count, false)
-               {
-               }
-
-               // LAME SPEC: only ArgumentNullException for filepath is thrown
-               public SendPacketsElement (string filepath, int offset, int count, bool endOfPacket)
-               {
-                       if (filepath == null)
-                               throw new ArgumentNullException ("filepath");
-
-                       Buffer = null;
-                       Offset = offset;
-                       Count = count;
-                       EndOfPacket = endOfPacket;
-                       FilePath = filepath;
-               }
-       }
-}
index f894f490612fc2b6ff9f185bd113be8941234c9b..752dcd08d8b5621fe15229aa4f13617c83bb2ea9 100644 (file)
@@ -55,27 +55,20 @@ namespace System.Net.Sockets
                const string TIMEOUT_EXCEPTION_MSG = "A connection attempt failed because the connected party did not properly respond" +
                        "after a period of time, or established connection failed because connected host has failed to respond";
 
-               /*
-                *      These two fields are looked up by name by the runtime, don't change
-                *  their name without also updating the runtime code.
-                */
-               static int ipv4_supported = -1;
-               static int ipv6_supported = -1;
-
                /* true if we called Close_internal */
                bool is_closed;
 
                bool is_listening;
-               bool use_overlapped_io;
+               bool useOverlappedIO;
 
                int linger_timeout;
 
-               AddressFamily address_family;
-               SocketType socket_type;
-               ProtocolType protocol_type;
+               AddressFamily addressFamily;
+               SocketType socketType;
+               ProtocolType protocolType;
 
-               /* the field "safe_handle" is looked up by name by the runtime */
-               internal SafeSocketHandle safe_handle;
+               /* the field "m_Handle" is looked up by name by the runtime */
+               internal SafeSocketHandle m_Handle;
 
                /*
                 * This EndPoint is used when creating new endpoints. Because
@@ -86,8 +79,8 @@ namespace System.Net.Sockets
                 */
                internal EndPoint seed_endpoint = null;
 
-               internal Queue<KeyValuePair<IntPtr, IOSelectorJob>> readQ = new Queue<KeyValuePair<IntPtr, IOSelectorJob>> (2);
-               internal Queue<KeyValuePair<IntPtr, IOSelectorJob>> writeQ = new Queue<KeyValuePair<IntPtr, IOSelectorJob>> (2);
+               internal SemaphoreSlim ReadSem = new SemaphoreSlim (1, 1);
+               internal SemaphoreSlim WriteSem = new SemaphoreSlim (1, 1);
 
                internal bool is_blocking = true;
                internal bool is_bound;
@@ -95,171 +88,60 @@ namespace System.Net.Sockets
                /* When true, the socket was connected at the time of the last IO operation */
                internal bool is_connected;
 
-               internal bool is_disposed;
+               int m_IntCleanedUp;
                internal bool connect_in_progress;
 
 #region Constructors
 
-               static Socket ()
-               {
-                       if (ipv4_supported == -1) {
-                               try {
-                                       Socket tmp = new Socket (AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
-                                       tmp.Close();
-
-                                       ipv4_supported = 1;
-                               } catch {
-                                       ipv4_supported = 0;
-                               }
-                       }
-
-                       if (ipv6_supported == -1) {
-                               // We need to put a try/catch around ConfigurationManager methods as will always throw an exception 
-                               // when run in a mono embedded application.  This occurs as embedded applications do not have a setup
-                               // for application config.  The exception is not thrown when called from a normal .NET application. 
-                               //
-                               // We, then, need to guard calls to the ConfigurationManager.  If the config is not found or throws an
-                               // exception, will fall through to the existing Socket / API directly below in the code.
-                               //
-                               // Also note that catching ConfigurationErrorsException specifically would require library dependency
-                               // System.Configuration, and wanted to avoid that.
-#if !NET_2_1
-#if CONFIGURATION_DEP
-                               try {
-                                       SettingsSection config;
-                                       config = (SettingsSection) System.Configuration.ConfigurationManager.GetSection ("system.net/settings");
-                                       if (config != null)
-                                               ipv6_supported = config.Ipv6.Enabled ? -1 : 0;
-                               } catch {
-                                       ipv6_supported = -1;
-                               }
-#else
-                               try {
-                                       NetConfig config = System.Configuration.ConfigurationSettings.GetConfig("system.net/settings") as NetConfig;
-                                       if (config != null)
-                                               ipv6_supported = config.ipv6Enabled ? -1 : 0;
-                               } catch {
-                                       ipv6_supported = -1;
-                               }
-#endif
-#endif
-                               if (ipv6_supported != 0) {
-                                       try {
-                                               Socket tmp = new Socket(AddressFamily.InterNetworkV6, SocketType.Stream, ProtocolType.Tcp);
-                                               tmp.Close();
-
-                                               ipv6_supported = 1;
-                                       } catch {
-                                               ipv6_supported = 0;
-                                       }
-                               }
-                       }
-               }
-
-               //
-               // This constructor is used by servers that want to listen for instance on both
-               // ipv4 and ipv6.   Mono has historically done that if you use InterNetworkV6 (at
-               // least on Unix), because that is the default behavior unless the IPV6_V6ONLY
-               // option is explicitly set by using setsockopt (sock, IPPROTO_IPV6, IPV6_ONLY)
-               //
-               public Socket (SocketType socketType, ProtocolType protocolType)
-                       : this (AddressFamily.InterNetworkV6, socketType, protocolType)
-               {
-                       DualMode = true;
-               }
-               
-               public Socket(AddressFamily addressFamily, SocketType socketType, ProtocolType protocolType)
-               {
-#if NET_2_1 && !MOBILE
-                       switch (addressFamily) {
-                       case AddressFamily.InterNetwork:    // ok
-                       case AddressFamily.InterNetworkV6:  // ok
-                       case AddressFamily.Unknown:         // SocketException will be thrown later (with right error #)
-                               break;
-                       // case AddressFamily.Unspecified:
-                       default:
-                               throw new ArgumentException ("addressFamily");
-                       }
-
-                       switch (socketType) {
-                       case SocketType.Stream:             // ok
-                       case SocketType.Unknown:            // SocketException will be thrown later (with right error #)
-                               break;
-                       default:
-                               throw new ArgumentException ("socketType");
-                       }
-
-                       switch (protocolType) {
-                       case ProtocolType.Tcp:              // ok
-                       case ProtocolType.Unspecified:      // ok
-                       case ProtocolType.Unknown:          // SocketException will be thrown later (with right error #)
-                               break;
-                       default:
-                               throw new ArgumentException ("protocolType");
-                       }
-#endif
-                       this.address_family = addressFamily;
-                       this.socket_type = socketType;
-                       this.protocol_type = protocolType;
-
-                       int error;
-                       this.safe_handle = new SafeSocketHandle (Socket_internal (addressFamily, socketType, protocolType, out error), true);
-
-                       if (error != 0)
-                               throw new SocketException (error);
-
-#if !NET_2_1 || MOBILE
-                       SocketDefaults ();
-#endif
-               }
 
-#if !MOBILE
                public Socket (SocketInformation socketInformation)
                {
                        this.is_listening      = (socketInformation.Options & SocketInformationOptions.Listening) != 0;
                        this.is_connected      = (socketInformation.Options & SocketInformationOptions.Connected) != 0;
                        this.is_blocking       = (socketInformation.Options & SocketInformationOptions.NonBlocking) == 0;
-                       this.use_overlapped_io = (socketInformation.Options & SocketInformationOptions.UseOnlyOverlappedIO) != 0;
+                       this.useOverlappedIO = (socketInformation.Options & SocketInformationOptions.UseOnlyOverlappedIO) != 0;
 
                        var result = Mono.DataConverter.Unpack ("iiiil", socketInformation.ProtocolInformation, 0);
 
-                       this.address_family = (AddressFamily) (int) result [0];
-                       this.socket_type = (SocketType) (int) result [1];
-                       this.protocol_type = (ProtocolType) (int) result [2];
+                       this.addressFamily = (AddressFamily) (int) result [0];
+                       this.socketType = (SocketType) (int) result [1];
+                       this.protocolType = (ProtocolType) (int) result [2];
                        this.is_bound = (ProtocolType) (int) result [3] != 0;
-                       this.safe_handle = new SafeSocketHandle ((IntPtr) (long) result [4], true);
+                       this.m_Handle = new SafeSocketHandle ((IntPtr) (long) result [4], true);
+
+                       InitializeSockets ();
 
                        SocketDefaults ();
                }
-#endif
 
                /* private constructor used by Accept, which already has a socket handle to use */
                internal Socket(AddressFamily family, SocketType type, ProtocolType proto, SafeSocketHandle safe_handle)
                {
-                       this.address_family = family;
-                       this.socket_type = type;
-                       this.protocol_type = proto;
+                       this.addressFamily = family;
+                       this.socketType = type;
+                       this.protocolType = proto;
                        
-                       this.safe_handle = safe_handle;
+                       this.m_Handle = safe_handle;
                        this.is_connected = true;
-               }
 
-               ~Socket ()
-               {
-                       Dispose (false);
+                       InitializeSockets ();   
                }
 
                void SocketDefaults ()
                {
                        try {
                                /* Need to test IPv6 further */
-                               if (address_family == AddressFamily.InterNetwork
-                                       // || address_family == AddressFamily.InterNetworkV6
+                               if (addressFamily == AddressFamily.InterNetwork
+                                       // || addressFamily == AddressFamily.InterNetworkV6
                                ) {
                                        /* This is the default, but it probably has nasty side
                                         * effects on Linux, as the socket option is kludged by
                                         * turning on or off PMTU discovery... */
                                        this.DontFragment = false;
+                                       if (protocolType == ProtocolType.Tcp)
+                                               this.NoDelay = false;
+                               } else if (addressFamily == AddressFamily.InterNetworkV6) {
+                                       this.DualMode = true;
                                }
 
                                /* Microsoft sets these to 8192, but we are going to keep them
@@ -279,60 +161,12 @@ namespace System.Net.Sockets
 
 #region Properties
 
-               [ObsoleteAttribute ("Use OSSupportsIPv4 instead")]
-               public static bool SupportsIPv4 {
-                       get { return ipv4_supported == 1; }
-               }
-
-               [ObsoleteAttribute ("Use OSSupportsIPv6 instead")]
-               public static bool SupportsIPv6 {
-                       get { return ipv6_supported == 1; }
-               }
-
-#if NET_2_1
-               public static bool OSSupportsIPv4 {
-                       get { return ipv4_supported == 1; }
-               }
-#else
-               public static bool OSSupportsIPv4 {
-                       get {
-                               NetworkInterface[] nics = NetworkInterface.GetAllNetworkInterfaces ();
-
-                               foreach (NetworkInterface adapter in nics) {
-                                       if (adapter.Supports (NetworkInterfaceComponent.IPv4))
-                                               return true;
-                               }
-
-                               return false;
-                       }
-               }
-#endif
-
-#if NET_2_1
-               public static bool OSSupportsIPv6 {
-                       get { return ipv6_supported == 1; }
-               }
-#else
-               public static bool OSSupportsIPv6 {
-                       get {
-                               NetworkInterface[] nics = NetworkInterface.GetAllNetworkInterfaces ();
-
-                               foreach (NetworkInterface adapter in nics) {
-                                       if (adapter.Supports (NetworkInterfaceComponent.IPv6))
-                                               return true;
-                               }
-
-                               return false;
-                       }
-               }
-#endif
-
                public int Available {
                        get {
                                ThrowIfDisposedAndClosed ();
 
                                int ret, error;
-                               ret = Available_internal (safe_handle, out error);
+                               ret = Available_internal (m_Handle, out error);
 
                                if (error != 0)
                                        throw new SocketException (error);
@@ -357,40 +191,12 @@ namespace System.Net.Sockets
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
                extern static int Available_internal (IntPtr socket, out int error);
 
-               public bool DontFragment {
-                       get {
-                               ThrowIfDisposedAndClosed ();
-
-                               switch (address_family) {
-                               case AddressFamily.InterNetwork:
-                                       return ((int) GetSocketOption (SocketOptionLevel.IP, SocketOptionName.DontFragment)) != 0;
-                               case AddressFamily.InterNetworkV6:
-                                       return ((int) GetSocketOption (SocketOptionLevel.IPv6, SocketOptionName.DontFragment)) != 0;
-                               default:
-                                       throw new NotSupportedException ("This property is only valid for InterNetwork and InterNetworkV6 sockets");
-                               }
-                       }
-                       set {
-                               ThrowIfDisposedAndClosed ();
-
-                               switch (address_family) {
-                               case AddressFamily.InterNetwork:
-                                       SetSocketOption (SocketOptionLevel.IP, SocketOptionName.DontFragment, value ? 1 : 0);
-                                       break;
-                               case AddressFamily.InterNetworkV6:
-                                       SetSocketOption (SocketOptionLevel.IPv6, SocketOptionName.DontFragment, value ? 1 : 0);
-                                       break;
-                               default:
-                                       throw new NotSupportedException ("This property is only valid for InterNetwork and InterNetworkV6 sockets");
-                               }
-                       }
-               }
-
+               // FIXME: import from referencesource
                public bool EnableBroadcast {
                        get {
                                ThrowIfDisposedAndClosed ();
 
-                               if (protocol_type != ProtocolType.Udp)
+                               if (protocolType != ProtocolType.Udp)
                                        throw new SocketException ((int) SocketError.ProtocolOption);
 
                                return ((int) GetSocketOption (SocketOptionLevel.Socket, SocketOptionName.Broadcast)) != 0;
@@ -398,47 +204,20 @@ namespace System.Net.Sockets
                        set {
                                ThrowIfDisposedAndClosed ();
 
-                               if (protocol_type != ProtocolType.Udp)
+                               if (protocolType != ProtocolType.Udp)
                                        throw new SocketException ((int) SocketError.ProtocolOption);
 
                                SetSocketOption (SocketOptionLevel.Socket, SocketOptionName.Broadcast, value ? 1 : 0);
                        }
                }
 
-               public bool ExclusiveAddressUse {
-                       get {
-                               ThrowIfDisposedAndClosed ();
-
-                               return ((int) GetSocketOption (SocketOptionLevel.Socket, SocketOptionName.ExclusiveAddressUse)) != 0;
-                       }
-                       set {
-                               ThrowIfDisposedAndClosed ();
-
-                               if (is_bound)
-                                       throw new InvalidOperationException ("Bind has already been called for this socket");
-
-                               SetSocketOption (SocketOptionLevel.Socket, SocketOptionName.ExclusiveAddressUse, value ? 1 : 0);
-                       }
-               }
-
                public bool IsBound {
                        get {
                                return is_bound;
                        }
                }
 
-               public LingerOption LingerState {
-                       get {
-                               ThrowIfDisposedAndClosed ();
-
-                               return (LingerOption) GetSocketOption (SocketOptionLevel.Socket, SocketOptionName.Linger);
-                       }
-                       set {
-                               ThrowIfDisposedAndClosed ();
-                               SetSocketOption (SocketOptionLevel.Socket, SocketOptionName.Linger, value);
-                       }
-               }
-
+               // FIXME: import from referencesource
                public bool MulticastLoopback {
                        get {
                                ThrowIfDisposedAndClosed ();
@@ -448,10 +227,10 @@ namespace System.Net.Sockets
                                 * "Setting this property on a Transmission Control Protocol (TCP)
                                 * socket will have no effect." but the MS runtime throws the
                                 * exception...) */
-                               if (protocol_type == ProtocolType.Tcp)
+                               if (protocolType == ProtocolType.Tcp)
                                        throw new SocketException ((int)SocketError.ProtocolOption);
 
-                               switch (address_family) {
+                               switch (addressFamily) {
                                case AddressFamily.InterNetwork:
                                        return ((int) GetSocketOption (SocketOptionLevel.IP, SocketOptionName.MulticastLoopback)) != 0;
                                case AddressFamily.InterNetworkV6:
@@ -468,10 +247,10 @@ namespace System.Net.Sockets
                                 * "Setting this property on a Transmission Control Protocol (TCP)
                                 * socket will have no effect." but the MS runtime throws the
                                 * exception...) */
-                               if (protocol_type == ProtocolType.Tcp)
+                               if (protocolType == ProtocolType.Tcp)
                                        throw new SocketException ((int)SocketError.ProtocolOption);
 
-                               switch (address_family) {
+                               switch (addressFamily) {
                                case AddressFamily.InterNetwork:
                                        SetSocketOption (SocketOptionLevel.IP, SocketOptionName.MulticastLoopback, value ? 1 : 0);
                                        break;
@@ -484,37 +263,6 @@ namespace System.Net.Sockets
                        }
                }
 
-               public bool DualMode {
-                       get {
-                               if (AddressFamily != AddressFamily.InterNetworkV6) 
-                                       throw new NotSupportedException("This protocol version is not supported");
-
-                               return ((int)GetSocketOption(SocketOptionLevel.IPv6, SocketOptionName.IPv6Only) == 0);
-                       }
-                       set {
-                               if (AddressFamily != AddressFamily.InterNetworkV6) 
-                                       throw new NotSupportedException("This protocol version is not supported");
-
-                               SetSocketOption(SocketOptionLevel.IPv6, SocketOptionName.IPv6Only, value ? 0 : 1);
-                       }
-               }
-
-               private bool IsDualMode {
-                       get {
-                               return AddressFamily == AddressFamily.InterNetworkV6 && DualMode;
-                       }
-               }
-
-               [MonoTODO ("This doesn't do anything on Mono yet")]
-               public bool UseOnlyOverlappedIO {
-                       get { return use_overlapped_io; }
-                       set { use_overlapped_io = value; }
-               }
-
-               public IntPtr Handle {
-                       get { return safe_handle.DangerousGetHandle (); }
-               }
-
                // Wish:  support non-IP endpoints.
                public EndPoint LocalEndPoint {
                        get {
@@ -526,7 +274,7 @@ namespace System.Net.Sockets
                                        return null;
 
                                int error;
-                               SocketAddress sa = LocalEndPoint_internal (safe_handle, (int) address_family, out error);
+                               SocketAddress sa = LocalEndPoint_internal (m_Handle, (int) addressFamily, out error);
 
                                if (error != 0)
                                        throw new SocketException (error);
@@ -551,61 +299,13 @@ namespace System.Net.Sockets
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
                extern static SocketAddress LocalEndPoint_internal (IntPtr socket, int family, out int error);
 
-               public SocketType SocketType {
-                       get { return socket_type; }
-               }
-
-               public int SendTimeout {
-                       get {
-                               ThrowIfDisposedAndClosed ();
-
-                               return (int) GetSocketOption (SocketOptionLevel.Socket, SocketOptionName.SendTimeout);
-                       }
-                       set {
-                               ThrowIfDisposedAndClosed ();
-
-                               if (value < -1)
-                                       throw new ArgumentOutOfRangeException ("value", "The value specified for a set operation is less than -1");
-
-                               /* According to the MSDN docs we should adjust values between 1 and
-                                * 499 to 500, but the MS runtime doesn't do this. */
-                               if (value == -1)
-                                       value = 0;
-
-                               SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.SendTimeout, value);
-                       }
-               }
-
-               public int ReceiveTimeout {
-                       get {
-                               ThrowIfDisposedAndClosed ();
-
-                               return (int) GetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReceiveTimeout);
-                       }
-                       set {
-                               ThrowIfDisposedAndClosed ();
-
-                               if (value < -1)
-                                       throw new ArgumentOutOfRangeException ("value", "The value specified for a set operation is less than -1");
-
-                               if (value == -1)
-                                       value = 0;
-
-                               SetSocketOption (SocketOptionLevel.Socket, SocketOptionName.ReceiveTimeout, value);
-                       }
-               }
-
-               public AddressFamily AddressFamily {
-                       get { return address_family; }
-               }
-
                public bool Blocking {
                        get { return is_blocking; }
                        set {
                                ThrowIfDisposedAndClosed ();
 
                                int error;
-                               Blocking_internal (safe_handle, value, out error);
+                               Blocking_internal (m_Handle, value, out error);
 
                                if (error != 0)
                                        throw new SocketException (error);
@@ -634,10 +334,7 @@ namespace System.Net.Sockets
                        internal set { is_connected = value; }
                }
 
-               public ProtocolType ProtocolType {
-                       get { return protocol_type; }
-               }
-
+               // FIXME: import from referencesource
                public bool NoDelay {
                        get {
                                ThrowIfDisposedAndClosed ();
@@ -649,75 +346,10 @@ namespace System.Net.Sockets
                        set {
                                ThrowIfDisposedAndClosed ();
                                ThrowIfUdp ();
-
                                SetSocketOption (SocketOptionLevel.Tcp, SocketOptionName.NoDelay, value ? 1 : 0);
                        }
                }
 
-               public int ReceiveBufferSize {
-                       get {
-                               ThrowIfDisposedAndClosed ();
-
-                               return (int) GetSocketOption (SocketOptionLevel.Socket, SocketOptionName.ReceiveBuffer);
-                       }
-                       set {
-                               ThrowIfDisposedAndClosed ();
-
-                               if (value < 0)
-                                       throw new ArgumentOutOfRangeException ("value", "The value specified for a set operation is less than zero");
-
-                               SetSocketOption (SocketOptionLevel.Socket, SocketOptionName.ReceiveBuffer, value);
-                       }
-               }
-
-               public int SendBufferSize {
-                       get {
-                               ThrowIfDisposedAndClosed ();
-
-                               return (int) GetSocketOption (SocketOptionLevel.Socket, SocketOptionName.SendBuffer);
-                       }
-                       set {
-                               ThrowIfDisposedAndClosed ();
-
-                               if (value < 0)
-                                       throw new ArgumentOutOfRangeException ("value", "The value specified for a set operation is less than zero");
-
-                               SetSocketOption (SocketOptionLevel.Socket, SocketOptionName.SendBuffer, value);
-                       }
-               }
-
-               public short Ttl {
-                       get {
-                               ThrowIfDisposedAndClosed ();
-
-                               switch (address_family) {
-                               case AddressFamily.InterNetwork:
-                                       return (short) (int) GetSocketOption (SocketOptionLevel.IP, SocketOptionName.IpTimeToLive);
-                               case AddressFamily.InterNetworkV6:
-                                       return (short) (int) GetSocketOption (SocketOptionLevel.IPv6, SocketOptionName.HopLimit);
-                               default:
-                                       throw new NotSupportedException ("This property is only valid for InterNetwork and InterNetworkV6 sockets");
-                               }
-                       }
-                       set {
-                               ThrowIfDisposedAndClosed ();
-
-                               if (value < 0 || value > 255)
-                                       throw new ArgumentOutOfRangeException ("value", "The value specified for a set operation is less than zero or greater than 255.");
-
-                               switch (address_family) {
-                               case AddressFamily.InterNetwork:
-                                       SetSocketOption (SocketOptionLevel.IP, SocketOptionName.IpTimeToLive, value);
-                                       break;
-                               case AddressFamily.InterNetworkV6:
-                                       SetSocketOption (SocketOptionLevel.IPv6, SocketOptionName.HopLimit, value);
-                                       break;
-                               default:
-                                       throw new NotSupportedException ("This property is only valid for InterNetwork and InterNetworkV6 sockets");
-                               }
-                       }
-               }
-
                public EndPoint RemoteEndPoint {
                        get {
                                ThrowIfDisposedAndClosed ();
@@ -728,7 +360,7 @@ namespace System.Net.Sockets
                                        return null;
 
                                int error;
-                               SocketAddress sa = RemoteEndPoint_internal (safe_handle, (int) address_family, out error);
+                               SocketAddress sa = RemoteEndPoint_internal (m_Handle, (int) addressFamily, out error);
 
                                if (error != 0)
                                        throw new SocketException (error);
@@ -841,7 +473,7 @@ namespace System.Net.Sockets
 
 #region Poll
 
-               public bool Poll (int time_us, SelectMode mode)
+               public bool Poll (int microSeconds, SelectMode mode)
                {
                        ThrowIfDisposedAndClosed ();
 
@@ -849,7 +481,7 @@ namespace System.Net.Sockets
                                throw new NotSupportedException ("'mode' parameter is not valid.");
 
                        int error;
-                       bool result = Poll_internal (safe_handle, mode, time_us, out error);
+                       bool result = Poll_internal (m_Handle, mode, microSeconds, out error);
 
                        if (error != 0)
                                throw new SocketException (error);
@@ -888,7 +520,7 @@ namespace System.Net.Sockets
                        ThrowIfDisposedAndClosed ();
 
                        int error = 0;
-                       SafeSocketHandle safe_handle = Accept_internal (this.safe_handle, out error, is_blocking);
+                       SafeSocketHandle safe_handle = Accept_internal (this.m_Handle, out error, is_blocking);
 
                        if (error != 0) {
                                if (is_closed)
@@ -909,7 +541,7 @@ namespace System.Net.Sockets
                        ThrowIfDisposedAndClosed ();
 
                        int error = 0;
-                       SafeSocketHandle safe_handle = Accept_internal (this.safe_handle, out error, is_blocking);
+                       SafeSocketHandle safe_handle = Accept_internal (this.m_Handle, out error, is_blocking);
 
                        if (error != 0) {
                                if (is_closed)
@@ -917,10 +549,10 @@ namespace System.Net.Sockets
                                throw new SocketException (error);
                        }
 
-                       acceptSocket.address_family = this.AddressFamily;
-                       acceptSocket.socket_type = this.SocketType;
-                       acceptSocket.protocol_type = this.ProtocolType;
-                       acceptSocket.safe_handle = safe_handle;
+                       acceptSocket.addressFamily = this.AddressFamily;
+                       acceptSocket.socketType = this.SocketType;
+                       acceptSocket.protocolType = this.ProtocolType;
+                       acceptSocket.m_Handle = safe_handle;
                        acceptSocket.is_connected = true;
                        acceptSocket.seed_endpoint = this.seed_endpoint;
                        acceptSocket.Blocking = this.Blocking;
@@ -951,7 +583,7 @@ namespace System.Net.Sockets
 
                        InitSocketAsyncEventArgs (e, AcceptAsyncCallback, e, SocketOperation.Accept);
 
-                       QueueIOSelectorJob (readQ, e.socket_async_result.Handle, new IOSelectorJob (IOOperation.Read, BeginAcceptCallback, e.socket_async_result));
+                       QueueIOSelectorJob (ReadSem, e.socket_async_result.Handle, new IOSelectorJob (IOOperation.Read, BeginAcceptCallback, e.socket_async_result));
 
                        return true;
                }
@@ -984,7 +616,7 @@ namespace System.Net.Sockets
 
                        SocketAsyncResult sockares = new SocketAsyncResult (this, callback, state, SocketOperation.Accept);
 
-                       QueueIOSelectorJob (readQ, sockares.Handle, new IOSelectorJob (IOOperation.Read, BeginAcceptCallback, sockares));
+                       QueueIOSelectorJob (ReadSem, sockares.Handle, new IOSelectorJob (IOOperation.Read, BeginAcceptCallback, sockares));
 
                        return sockares;
                }
@@ -1007,25 +639,6 @@ namespace System.Net.Sockets
                        sockares.Complete (acc_socket);
                });
 
-               public IAsyncResult BeginAccept (int receiveSize, AsyncCallback callback, object state)
-               {
-                       ThrowIfDisposedAndClosed ();
-
-                       if (receiveSize < 0)
-                               throw new ArgumentOutOfRangeException ("receiveSize", "receiveSize is less than zero");
-
-                       SocketAsyncResult sockares = new SocketAsyncResult (this, callback, state, SocketOperation.AcceptReceive) {
-                               Buffer = new byte [receiveSize],
-                               Offset = 0,
-                               Size = receiveSize,
-                               SockFlags = SocketFlags.None,
-                       };
-
-                       QueueIOSelectorJob (readQ, sockares.Handle, new IOSelectorJob (IOOperation.Read, BeginAcceptReceiveCallback, sockares));
-
-                       return sockares;
-               }
-
                public IAsyncResult BeginAccept (Socket acceptSocket, int receiveSize, AsyncCallback callback, object state)
                {
                        ThrowIfDisposedAndClosed ();
@@ -1056,7 +669,7 @@ namespace System.Net.Sockets
                                AcceptSocket = acceptSocket,
                        };
 
-                       QueueIOSelectorJob (readQ, sockares.Handle, new IOSelectorJob (IOOperation.Read, BeginAcceptReceiveCallback, sockares));
+                       QueueIOSelectorJob (ReadSem, sockares.Handle, new IOSelectorJob (IOOperation.Read, BeginAcceptReceiveCallback, sockares));
 
                        return sockares;
                }
@@ -1082,7 +695,7 @@ namespace System.Net.Sockets
                        if (sockares.Size > 0) {
                                try {
                                        SocketError error;
-                                       total = acc_socket.Receive_nochecks (sockares.Buffer, sockares.Offset, sockares.Size, sockares.SockFlags, out error);
+                                       total = acc_socket.Receive (sockares.Buffer, sockares.Offset, sockares.Size, sockares.SockFlags, out error);
                                        if (error != 0) {
                                                sockares.Complete (new SocketException ((int) error));
                                                return;
@@ -1103,12 +716,6 @@ namespace System.Net.Sockets
                        return EndAccept (out buffer, out bytes, result);
                }
 
-               public Socket EndAccept (out byte[] buffer, IAsyncResult asyncResult)
-               {
-                       int bytes;
-                       return EndAccept (out buffer, out bytes, asyncResult);
-               }
-
                public Socket EndAccept (out byte[] buffer, out int bytesTransferred, IAsyncResult asyncResult)
                {
                        ThrowIfDisposedAndClosed ();
@@ -1145,27 +752,31 @@ namespace System.Net.Sockets
 
 #region Bind
 
-               public void Bind (EndPoint local_end)
+               public void Bind (EndPoint localEP)
                {
+#if FEATURE_NO_BSD_SOCKETS
+                       throw new PlatformNotSupportedException ("System.Net.Sockets.Socket:Bind is not supported on this platform.");
+#else
                        ThrowIfDisposedAndClosed ();
 
-                       if (local_end == null)
-                               throw new ArgumentNullException("local_end");
+                       if (localEP == null)
+                               throw new ArgumentNullException("localEP");
                                
-                       var ipEndPoint = local_end as IPEndPoint;
+                       var ipEndPoint = localEP as IPEndPoint;
                        if (ipEndPoint != null) {
-                               local_end = RemapIPEndPoint (ipEndPoint);       
+                               localEP = RemapIPEndPoint (ipEndPoint); 
                        }
                        
                        int error;
-                       Bind_internal (safe_handle, local_end.Serialize(), out error);
+                       Bind_internal (m_Handle, localEP.Serialize(), out error);
 
                        if (error != 0)
                                throw new SocketException (error);
                        if (error == 0)
                                is_bound = true;
 
-                       seed_endpoint = local_end;
+                       seed_endpoint = localEP;
+#endif // FEATURE_NO_BSD_SOCKETS
                }
 
                private static void Bind_internal (SafeSocketHandle safeHandle, SocketAddress sa, out int error)
@@ -1196,7 +807,7 @@ namespace System.Net.Sockets
                                throw new SocketException ((int) SocketError.InvalidArgument);
 
                        int error;
-                       Listen_internal(safe_handle, backlog, out error);
+                       Listen_internal(m_Handle, backlog, out error);
 
                        if (error != 0)
                                throw new SocketException (error);
@@ -1233,51 +844,6 @@ namespace System.Net.Sockets
                        Connect (Dns.GetHostAddresses (host), port);
                }
 
-               public void Connect (IPAddress[] addresses, int port)
-               {
-                       ThrowIfDisposedAndClosed ();
-
-                       if (addresses == null)
-                               throw new ArgumentNullException ("addresses");
-                       if (this.AddressFamily != AddressFamily.InterNetwork && this.AddressFamily != AddressFamily.InterNetworkV6)
-                               throw new NotSupportedException ("This method is only valid for addresses in the InterNetwork or InterNetworkV6 families");
-                       if (is_listening)
-                               throw new InvalidOperationException ();
-
-                       // FIXME: do non-blocking sockets Poll here?
-                       int error = 0;
-                       foreach (IPAddress address in addresses) {
-                               IPEndPoint iep = new IPEndPoint (address, port);
-                               
-                               iep = RemapIPEndPoint (iep);
-
-                               Connect_internal (safe_handle, iep.Serialize (), out error);
-                               if (error == 0) {
-                                       is_connected = true;
-                                       is_bound = true;
-                                       seed_endpoint = iep;
-                                       return;
-                               }
-                               if (error != (int)SocketError.InProgress && error != (int)SocketError.WouldBlock)
-                                       continue;
-
-                               if (!is_blocking) {
-                                       Poll (-1, SelectMode.SelectWrite);
-                                       error = (int)GetSocketOption (SocketOptionLevel.Socket, SocketOptionName.Error);
-                                       if (error == 0) {
-                                               is_connected = true;
-                                               is_bound = true;
-                                               seed_endpoint = iep;
-                                               return;
-                                       }
-                               }
-                       }
-
-                       if (error != 0)
-                               throw new SocketException (error);
-               }
-
-
                public void Connect (EndPoint remoteEP)
                {
                        ThrowIfDisposedAndClosed ();
@@ -1287,7 +853,7 @@ namespace System.Net.Sockets
 
                        IPEndPoint ep = remoteEP as IPEndPoint;
                        /* Dgram uses Any to 'disconnect' */
-                       if (ep != null && socket_type != SocketType.Dgram) {
+                       if (ep != null && socketType != SocketType.Dgram) {
                                if (ep.Address.Equals (IPAddress.Any) || ep.Address.Equals (IPAddress.IPv6Any))
                                        throw new SocketException ((int) SocketError.AddressNotAvailable);
                        }
@@ -1302,7 +868,7 @@ namespace System.Net.Sockets
                        SocketAddress serial = remoteEP.Serialize ();
 
                        int error = 0;
-                       Connect_internal (safe_handle, serial, out error);
+                       Connect_internal (m_Handle, serial, out error, is_blocking);
 
                        if (error == 0 || error == 10035)
                                seed_endpoint = remoteEP; // Keep the ep around for non-blocking sockets
@@ -1313,7 +879,7 @@ namespace System.Net.Sockets
                                throw new SocketException (error);
                        }
 
-                       is_connected = !(socket_type == SocketType.Dgram && ep != null && (ep.Address.Equals (IPAddress.Any) || ep.Address.Equals (IPAddress.IPv6Any)));
+                       is_connected = !(socketType == SocketType.Dgram && ep != null && (ep.Address.Equals (IPAddress.Any) || ep.Address.Equals (IPAddress.IPv6Any)));
                        is_bound = true;
                }
 
@@ -1356,12 +922,6 @@ namespace System.Net.Sockets
                        return true;
                }
 
-               public static bool ConnectAsync (SocketType socketType, ProtocolType protocolType, SocketAsyncEventArgs e)
-               {
-                       var sock = new Socket (e.RemoteEndPoint.AddressFamily, socketType, protocolType);
-                       return sock.ConnectAsync (e);
-               }
-
                public static void CancelConnectAsync (SocketAsyncEventArgs e)
                {
                        if (e == null)
@@ -1388,29 +948,13 @@ namespace System.Net.Sockets
                        }
                });
 
-               public IAsyncResult BeginConnect (IPAddress address, int port, AsyncCallback callback, object state)
-               {
-                       ThrowIfDisposedAndClosed ();
-
-                       if (address == null)
-                               throw new ArgumentNullException ("address");
-                       if (address.ToString ().Length == 0)
-                               throw new ArgumentException ("The length of the IP address is zero");
-                       if (port <= 0 || port > 65535)
-                               throw new ArgumentOutOfRangeException ("port", "Must be > 0 and < 65536");
-                       if (is_listening)
-                               throw new InvalidOperationException ();
-
-                       return BeginConnect (new IPEndPoint (address, port), callback, state);
-               }
-
                public IAsyncResult BeginConnect (string host, int port, AsyncCallback callback, object state)
                {
                        ThrowIfDisposedAndClosed ();
 
                        if (host == null)
                                throw new ArgumentNullException ("host");
-                       if (address_family != AddressFamily.InterNetwork && address_family != AddressFamily.InterNetworkV6)
+                       if (addressFamily != AddressFamily.InterNetwork && addressFamily != AddressFamily.InterNetworkV6)
                                throw new NotSupportedException ("This method is valid only for sockets in the InterNetwork and InterNetworkV6 families");
                        if (port <= 0 || port > 65535)
                                throw new ArgumentOutOfRangeException ("port", "Must be > 0 and < 65536");
@@ -1426,6 +970,8 @@ namespace System.Net.Sockets
 
                        if (end_point == null)
                                throw new ArgumentNullException ("end_point");
+                       if (is_listening)
+                               throw new InvalidOperationException ();
 
                        SocketAsyncResult sockares = new SocketAsyncResult (this, callback, state, SocketOperation.Connect) {
                                EndPoint = end_point,
@@ -1449,8 +995,8 @@ namespace System.Net.Sockets
                                // Calling connect() again will reset the connection attempt and cause
                                // an error. Better to just close the socket and move on.
                                connect_in_progress = false;
-                               safe_handle.Dispose ();
-                               safe_handle = new SafeSocketHandle (Socket_internal (address_family, socket_type, protocol_type, out error), true);
+                               m_Handle.Dispose ();
+                               m_Handle = new SafeSocketHandle (Socket_internal (addressFamily, socketType, protocolType, out error), true);
                                if (error != 0)
                                        throw new SocketException (error);
                        }
@@ -1458,7 +1004,7 @@ namespace System.Net.Sockets
                        bool blk = is_blocking;
                        if (blk)
                                Blocking = false;
-                       Connect_internal (safe_handle, end_point.Serialize (), out error);
+                       Connect_internal (m_Handle, end_point.Serialize (), out error, false);
                        if (blk)
                                Blocking = true;
 
@@ -1608,11 +1154,11 @@ namespace System.Net.Sockets
                        sockares.CheckIfThrowDelayedException();
                }
 
-               static void Connect_internal (SafeSocketHandle safeHandle, SocketAddress sa, out int error)
+               static void Connect_internal (SafeSocketHandle safeHandle, SocketAddress sa, out int error, bool blocking)
                {
                        try {
                                safeHandle.RegisterForBlockingSyscall ();
-                               Connect_internal (safeHandle.DangerousGetHandle (), sa, out error);
+                               Connect_internal (safeHandle.DangerousGetHandle (), sa, out error, blocking);
                        } finally {
                                safeHandle.UnRegisterForBlockingSyscall ();
                        }
@@ -1620,7 +1166,7 @@ namespace System.Net.Sockets
 
                /* Connects to the remote address */
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
-               extern static void Connect_internal(IntPtr sock, SocketAddress sa, out int error);
+               extern static void Connect_internal(IntPtr sock, SocketAddress sa, out int error, bool blocking);
 
                /* Returns :
                 *  - false when it is ok to use RemoteEndPoint
@@ -1653,7 +1199,7 @@ namespace System.Net.Sockets
                        ThrowIfDisposedAndClosed ();
 
                        int error = 0;
-                       Disconnect_internal (safe_handle, reuseSocket, out error);
+                       Disconnect_internal (m_Handle, reuseSocket, out error);
 
                        if (error != 0) {
                                if (error == 50) {
@@ -1757,97 +1303,26 @@ namespace System.Net.Sockets
 
 #region Receive
 
-               public int Receive (byte [] buffer)
-               {
-                       return Receive (buffer, SocketFlags.None);
-               }
-
-               public int Receive (byte [] buffer, SocketFlags flags)
-               {
-                       ThrowIfDisposedAndClosed ();
-                       ThrowIfBufferNull (buffer);
-                       ThrowIfBufferOutOfRange (buffer, 0, buffer.Length);
-
-                       SocketError error;
-                       int ret = Receive_nochecks (buffer, 0, buffer.Length, flags, out error);
-
-                       if (error != SocketError.Success) {
-                               if (error == SocketError.WouldBlock && is_blocking) // This might happen when ReceiveTimeout is set
-                                       throw new SocketException ((int) error, TIMEOUT_EXCEPTION_MSG);
-                               throw new SocketException ((int) error);
-                       }
-
-                       return ret;
-               }
-
-               public int Receive (byte [] buffer, int size, SocketFlags flags)
-               {
-                       ThrowIfDisposedAndClosed ();
-                       ThrowIfBufferNull (buffer);
-                       ThrowIfBufferOutOfRange (buffer, 0, size);
-
-                       SocketError error;
-                       int ret = Receive_nochecks (buffer, 0, size, flags, out error);
-
-                       if (error != SocketError.Success) {
-                               if (error == SocketError.WouldBlock && is_blocking) // This might happen when ReceiveTimeout is set
-                                       throw new SocketException ((int) error, TIMEOUT_EXCEPTION_MSG);
-                               throw new SocketException ((int) error);
-                       }
-
-                       return ret;
-               }
-
-               public int Receive (byte [] buffer, int offset, int size, SocketFlags flags)
+               public int Receive (byte [] buffer, int offset, int size, SocketFlags socketFlags, out SocketError errorCode)
                {
                        ThrowIfDisposedAndClosed ();
                        ThrowIfBufferNull (buffer);
                        ThrowIfBufferOutOfRange (buffer, offset, size);
 
-                       SocketError error;
-                       int ret = Receive_nochecks (buffer, offset, size, flags, out error);
+                       int nativeError;
+                       int ret = Receive_internal (m_Handle, buffer, offset, size, socketFlags, out nativeError, is_blocking);
 
-                       if (error != SocketError.Success) {
-                               if (error == SocketError.WouldBlock && is_blocking) // This might happen when ReceiveTimeout is set
-                                       throw new SocketException ((int) error, TIMEOUT_EXCEPTION_MSG);
-                               throw new SocketException ((int) error);
+                       errorCode = (SocketError) nativeError;
+                       if (errorCode != SocketError.Success && errorCode != SocketError.WouldBlock && errorCode != SocketError.InProgress) {
+                               is_connected = false;
+                               is_bound = false;
+                       } else {
+                               is_connected = true;
                        }
 
                        return ret;
                }
 
-               public int Receive (byte [] buffer, int offset, int size, SocketFlags flags, out SocketError error)
-               {
-                       ThrowIfDisposedAndClosed ();
-                       ThrowIfBufferNull (buffer);
-                       ThrowIfBufferOutOfRange (buffer, offset, size);
-
-                       return Receive_nochecks (buffer, offset, size, flags, out error);
-               }
-
-               public int Receive (IList<ArraySegment<byte>> buffers)
-               {
-                       SocketError error;
-                       int ret = Receive (buffers, SocketFlags.None, out error);
-
-                       if (error != SocketError.Success)
-                               throw new SocketException ((int) error);
-
-                       return ret;
-               }
-
-               [CLSCompliant (false)]
-               public int Receive (IList<ArraySegment<byte>> buffers, SocketFlags socketFlags)
-               {
-                       SocketError error;
-                       int ret = Receive (buffers, socketFlags, out error);
-
-                       if (error != SocketError.Success)
-                               throw new SocketException ((int) error);
-
-                       return(ret);
-               }
-
                [CLSCompliant (false)]
                public int Receive (IList<ArraySegment<byte>> buffers, SocketFlags socketFlags, out SocketError errorCode)
                {
@@ -1878,7 +1353,7 @@ namespace System.Net.Sockets
                        }
 
                        try {
-                               ret = Receive_internal (safe_handle, bufarray, socketFlags, out nativeError);
+                               ret = Receive_internal (m_Handle, bufarray, socketFlags, out nativeError, is_blocking);
                        } finally {
                                for (int i = 0; i < numsegments; i++) {
                                        if (gch[i].IsAllocated)
@@ -1908,7 +1383,7 @@ namespace System.Net.Sockets
 
                                e.socket_async_result.Buffers = e.BufferList;
 
-                               QueueIOSelectorJob (readQ, e.socket_async_result.Handle, new IOSelectorJob (IOOperation.Read, BeginReceiveGenericCallback, e.socket_async_result));
+                               QueueIOSelectorJob (ReadSem, e.socket_async_result.Handle, new IOSelectorJob (IOOperation.Read, BeginReceiveGenericCallback, e.socket_async_result));
                        } else {
                                InitSocketAsyncEventArgs (e, ReceiveAsyncCallback, e, SocketOperation.Receive);
 
@@ -1916,7 +1391,7 @@ namespace System.Net.Sockets
                                e.socket_async_result.Offset = e.Offset;
                                e.socket_async_result.Size = e.Count;
 
-                               QueueIOSelectorJob (readQ, e.socket_async_result.Handle, new IOSelectorJob (IOOperation.Read, BeginReceiveCallback, e.socket_async_result));
+                               QueueIOSelectorJob (ReadSem, e.socket_async_result.Handle, new IOSelectorJob (IOOperation.Read, BeginReceiveCallback, e.socket_async_result));
                        }
 
                        return true;
@@ -1939,39 +1414,35 @@ namespace System.Net.Sockets
                        }
                });
 
-               public IAsyncResult BeginReceive (byte[] buffer, int offset, int size, SocketFlags socket_flags, AsyncCallback callback, object state)
+               public IAsyncResult BeginReceive (byte[] buffer, int offset, int size, SocketFlags socketFlags, out SocketError errorCode, AsyncCallback callback, object state)
                {
                        ThrowIfDisposedAndClosed ();
                        ThrowIfBufferNull (buffer);
                        ThrowIfBufferOutOfRange (buffer, offset, size);
 
+                       /* As far as I can tell from the docs and from experimentation, a pointer to the
+                        * SocketError parameter is not supposed to be saved for the async parts.  And as we don't
+                        * set any socket errors in the setup code, we just have to set it to Success. */
+                       errorCode = SocketError.Success;
+
                        SocketAsyncResult sockares = new SocketAsyncResult (this, callback, state, SocketOperation.Receive) {
                                Buffer = buffer,
                                Offset = offset,
                                Size = size,
-                               SockFlags = socket_flags,
+                               SockFlags = socketFlags,
                        };
 
-                       QueueIOSelectorJob (readQ, sockares.Handle, new IOSelectorJob (IOOperation.Read, BeginReceiveCallback, sockares));
+                       QueueIOSelectorJob (ReadSem, sockares.Handle, new IOSelectorJob (IOOperation.Read, BeginReceiveCallback, sockares));
 
                        return sockares;
                }
 
-               public IAsyncResult BeginReceive (byte[] buffer, int offset, int size, SocketFlags flags, out SocketError error, AsyncCallback callback, object state)
-               {
-                       /* As far as I can tell from the docs and from experimentation, a pointer to the
-                        * SocketError parameter is not supposed to be saved for the async parts.  And as we don't
-                        * set any socket errors in the setup code, we just have to set it to Success. */
-                       error = SocketError.Success;
-                       return BeginReceive (buffer, offset, size, flags, callback, state);
-               }
-
                static IOAsyncCallback BeginReceiveCallback = new IOAsyncCallback (ares => {
                        SocketAsyncResult sockares = (SocketAsyncResult) ares;
                        int total = 0;
 
                        try {
-                               total = Receive_internal (sockares.socket.safe_handle, sockares.Buffer, sockares.Offset, sockares.Size, sockares.SockFlags, out sockares.error);
+                               total = Receive_internal (sockares.socket.m_Handle, sockares.Buffer, sockares.Offset, sockares.Size, sockares.SockFlags, out sockares.error, sockares.socket.is_blocking);
                        } catch (Exception e) {
                                sockares.Complete (e);
                                return;
@@ -1981,31 +1452,26 @@ namespace System.Net.Sockets
                });
 
                [CLSCompliant (false)]
-               public IAsyncResult BeginReceive (IList<ArraySegment<byte>> buffers, SocketFlags socketFlags, AsyncCallback callback, object state)
+               public IAsyncResult BeginReceive (IList<ArraySegment<byte>> buffers, SocketFlags socketFlags, out SocketError errorCode, AsyncCallback callback, object state)
                {
                        ThrowIfDisposedAndClosed ();
 
                        if (buffers == null)
                                throw new ArgumentNullException ("buffers");
 
+                       /* I assume the same SocketError semantics as above */
+                       errorCode = SocketError.Success;
+
                        SocketAsyncResult sockares = new SocketAsyncResult (this, callback, state, SocketOperation.ReceiveGeneric) {
                                Buffers = buffers,
                                SockFlags = socketFlags,
                        };
 
-                       QueueIOSelectorJob (readQ, sockares.Handle, new IOSelectorJob (IOOperation.Read, BeginReceiveGenericCallback, sockares));
+                       QueueIOSelectorJob (ReadSem, sockares.Handle, new IOSelectorJob (IOOperation.Read, BeginReceiveGenericCallback, sockares));
 
                        return sockares;
                }
 
-               [CLSCompliant (false)]
-               public IAsyncResult BeginReceive (IList<ArraySegment<byte>> buffers, SocketFlags socketFlags, out SocketError errorCode, AsyncCallback callback, object state)
-               {
-                       /* I assume the same SocketError semantics as above */
-                       errorCode = SocketError.Success;
-                       return BeginReceive (buffers, socketFlags, callback, state);
-               }
-
                static IOAsyncCallback BeginReceiveGenericCallback = new IOAsyncCallback (ares => {
                        SocketAsyncResult sockares = (SocketAsyncResult) ares;
                        int total = 0;
@@ -2020,20 +1486,6 @@ namespace System.Net.Sockets
                        sockares.Complete (total);
                });
 
-               public int EndReceive (IAsyncResult result)
-               {
-                       SocketError error;
-                       int bytesReceived = EndReceive (result, out error);
-
-                       if (error != SocketError.Success) {
-                               if (error != SocketError.WouldBlock && error != SocketError.InProgress)
-                                       is_connected = false;
-                               throw new SocketException ((int)error);
-                       }
-
-                       return bytesReceived;
-               }
-
                public int EndReceive (IAsyncResult asyncResult, out SocketError errorCode)
                {
                        ThrowIfDisposedAndClosed ();
@@ -2043,96 +1495,98 @@ namespace System.Net.Sockets
                        if (!sockares.IsCompleted)
                                sockares.AsyncWaitHandle.WaitOne ();
 
+                       errorCode = sockares.ErrorCode;
+
+                       if (errorCode != SocketError.Success && errorCode != SocketError.WouldBlock && errorCode != SocketError.InProgress)
+                               is_connected = false;
+
                        // If no socket error occurred, call CheckIfThrowDelayedException in case there are other
                        // kinds of exceptions that should be thrown.
-                       if ((errorCode = sockares.ErrorCode) == SocketError.Success)
+                       if (errorCode == SocketError.Success)
                                sockares.CheckIfThrowDelayedException();
 
                        return sockares.Total;
                }
 
-               int Receive_nochecks (byte [] buf, int offset, int size, SocketFlags flags, out SocketError error)
-               {
-                       int nativeError;
-                       int ret = Receive_internal (safe_handle, buf, offset, size, flags, out nativeError);
-
-                       error = (SocketError) nativeError;
-                       if (error != SocketError.Success && error != SocketError.WouldBlock && error != SocketError.InProgress) {
-                               is_connected = false;
-                               is_bound = false;
-                       } else {
-                               is_connected = true;
-                       }
-
-                       return ret;
-               }
-
-               static int Receive_internal (SafeSocketHandle safeHandle, WSABUF[] bufarray, SocketFlags flags, out int error)
+               static int Receive_internal (SafeSocketHandle safeHandle, WSABUF[] bufarray, SocketFlags flags, out int error, bool blocking)
                {
                        try {
                                safeHandle.RegisterForBlockingSyscall ();
-                               return Receive_internal (safeHandle.DangerousGetHandle (), bufarray, flags, out error);
+                               return Receive_internal (safeHandle.DangerousGetHandle (), bufarray, flags, out error, blocking);
                        } finally {
                                safeHandle.UnRegisterForBlockingSyscall ();
                        }
                }
 
                [MethodImplAttribute (MethodImplOptions.InternalCall)]
-               extern static int Receive_internal (IntPtr sock, WSABUF[] bufarray, SocketFlags flags, out int error);
+               extern static int Receive_internal (IntPtr sock, WSABUF[] bufarray, SocketFlags flags, out int error, bool blocking);
 
-               static int Receive_internal (SafeSocketHandle safeHandle, byte[] buffer, int offset, int count, SocketFlags flags, out int error)
+               static int Receive_internal (SafeSocketHandle safeHandle, byte[] buffer, int offset, int count, SocketFlags flags, out int error, bool blocking)
                {
                        try {
                                safeHandle.RegisterForBlockingSyscall ();
-                               return Receive_internal (safeHandle.DangerousGetHandle (), buffer, offset, count, flags, out error);
+                               return Receive_internal (safeHandle.DangerousGetHandle (), buffer, offset, count, flags, out error, blocking);
                        } finally {
                                safeHandle.UnRegisterForBlockingSyscall ();
                        }
                }
 
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
-               extern static int Receive_internal(IntPtr sock, byte[] buffer, int offset, int count, SocketFlags flags, out int error);
+               extern static int Receive_internal(IntPtr sock, byte[] buffer, int offset, int count, SocketFlags flags, out int error, bool blocking);
 
 #endregion
 
 #region ReceiveFrom
 
-               public int ReceiveFrom (byte [] buffer, ref EndPoint remoteEP)
+               public int ReceiveFrom (byte [] buffer, int offset, int size, SocketFlags socketFlags, ref EndPoint remoteEP)
                {
                        ThrowIfDisposedAndClosed ();
                        ThrowIfBufferNull (buffer);
+                       ThrowIfBufferOutOfRange (buffer, offset, size);
 
-                       return ReceiveFrom (buffer, 0, buffer.Length, SocketFlags.None, ref remoteEP);
-               }
+                       if (remoteEP == null)
+                               throw new ArgumentNullException ("remoteEP");
 
-               public int ReceiveFrom (byte [] buffer, SocketFlags flags, ref EndPoint remoteEP)
-               {
-                       ThrowIfDisposedAndClosed ();
-                       ThrowIfBufferNull (buffer);
+                       SocketError errorCode;
+                       int ret = ReceiveFrom (buffer, offset, size, socketFlags, ref remoteEP, out errorCode);
 
-                       return ReceiveFrom (buffer, 0, buffer.Length, flags, ref remoteEP);
+                       if (errorCode != SocketError.Success)
+                               throw new SocketException (errorCode);
+
+                       return ret;
                }
 
-               public int ReceiveFrom (byte [] buffer, int size, SocketFlags flags, ref EndPoint remoteEP)
+               internal int ReceiveFrom (byte [] buffer, int offset, int size, SocketFlags socketFlags, ref EndPoint remoteEP, out SocketError errorCode)
                {
-                       ThrowIfDisposedAndClosed ();
-                       ThrowIfBufferNull (buffer);
-                       ThrowIfBufferOutOfRange (buffer, 0, size);
+                       SocketAddress sockaddr = remoteEP.Serialize();
+
+                       int nativeError;
+                       int cnt = ReceiveFrom_internal (m_Handle, buffer, offset, size, socketFlags, ref sockaddr, out nativeError, is_blocking);
+
+                       errorCode = (SocketError) nativeError;
+                       if (errorCode != SocketError.Success) {
+                               if (errorCode != SocketError.WouldBlock && errorCode != SocketError.InProgress) {
+                                       is_connected = false;
+                               } else if (errorCode == SocketError.WouldBlock && is_blocking) { // This might happen when ReceiveTimeout is set
+                                       errorCode = SocketError.TimedOut;
+                               }
+
+                               return 0;
+                       }
 
-                       return ReceiveFrom (buffer, 0, size, flags, ref remoteEP);
-               }
+                       is_connected = true;
+                       is_bound = true;
 
-               public int ReceiveFrom (byte [] buffer, int offset, int size, SocketFlags flags, ref EndPoint remoteEP)
-               {
-                       ThrowIfDisposedAndClosed ();
-                       ThrowIfBufferNull (buffer);
-                       ThrowIfBufferOutOfRange (buffer, offset, size);
+                       /* If sockaddr is null then we're a connection oriented protocol and should ignore the
+                        * remoteEP parameter (see MSDN documentation for Socket.ReceiveFrom(...) ) */
+                       if (sockaddr != null) {
+                               /* Stupidly, EndPoint.Create() is an instance method */
+                               remoteEP = remoteEP.Create (sockaddr);
+                       }
 
-                       if (remoteEP == null)
-                               throw new ArgumentNullException ("remoteEP");
+                       seed_endpoint = remoteEP;
 
-                       int error;
-                       return ReceiveFrom_nochecks_exc (buffer, offset, size, flags, ref remoteEP, true, out error);
+                       return cnt;
                }
 
                public bool ReceiveFromAsync (SocketAsyncEventArgs e)
@@ -2153,7 +1607,7 @@ namespace System.Net.Sockets
                        e.socket_async_result.EndPoint = e.RemoteEndPoint;
                        e.socket_async_result.SockFlags = e.SocketFlags;
 
-                       QueueIOSelectorJob (readQ, e.socket_async_result.Handle, new IOSelectorJob (IOOperation.Read, BeginReceiveFromCallback, e.socket_async_result));
+                       QueueIOSelectorJob (ReadSem, e.socket_async_result.Handle, new IOSelectorJob (IOOperation.Read, BeginReceiveFromCallback, e.socket_async_result));
 
                        return true;
                }
@@ -2192,7 +1646,7 @@ namespace System.Net.Sockets
                                EndPoint = remote_end,
                        };
 
-                       QueueIOSelectorJob (readQ, sockares.Handle, new IOSelectorJob (IOOperation.Read, BeginReceiveFromCallback, sockares));
+                       QueueIOSelectorJob (ReadSem, sockares.Handle, new IOSelectorJob (IOOperation.Read, BeginReceiveFromCallback, sockares));
 
                        return sockares;
                }
@@ -2202,8 +1656,13 @@ namespace System.Net.Sockets
                        int total = 0;
 
                        try {
-                               int error;
-                               total = sockares.socket.ReceiveFrom_nochecks_exc (sockares.Buffer, sockares.Offset, sockares.Size, sockares.SockFlags, ref sockares.EndPoint, true, out error);
+                               SocketError errorCode;
+                               total = sockares.socket.ReceiveFrom (sockares.Buffer, sockares.Offset, sockares.Size, sockares.SockFlags, ref sockares.EndPoint, out errorCode);
+
+                               if (errorCode != SocketError.Success) {
+                                       sockares.Complete (new SocketException (errorCode));
+                                       return;
+                               }
                        } catch (Exception e) {
                                sockares.Complete (e);
                                return;
@@ -2231,56 +1690,20 @@ namespace System.Net.Sockets
                        return sockares.Total;
                }
 
-               internal int ReceiveFrom_nochecks_exc (byte [] buf, int offset, int size, SocketFlags flags, ref EndPoint remote_end, bool throwOnError, out int error)
-               {
-                       SocketAddress sockaddr = remote_end.Serialize();
-
-                       int cnt = ReceiveFrom_internal (safe_handle, buf, offset, size, flags, ref sockaddr, out error);
-
-                       SocketError err = (SocketError) error;
-                       if (err != 0) {
-                               if (err != SocketError.WouldBlock && err != SocketError.InProgress) {
-                                       is_connected = false;
-                               } else if (err == SocketError.WouldBlock && is_blocking) { // This might happen when ReceiveTimeout is set
-                                       if (throwOnError)       
-                                               throw new SocketException ((int) SocketError.TimedOut, TIMEOUT_EXCEPTION_MSG);
-                                       error = (int) SocketError.TimedOut;
-                                       return 0;
-                               }
-
-                               if (throwOnError)
-                                       throw new SocketException (error);
-
-                               return 0;
-                       }
-
-                       is_connected = true;
-                       is_bound = true;
-
-                       /* If sockaddr is null then we're a connection oriented protocol and should ignore the
-                        * remote_end parameter (see MSDN documentation for Socket.ReceiveFrom(...) ) */
-                       if (sockaddr != null) {
-                               /* Stupidly, EndPoint.Create() is an instance method */
-                               remote_end = remote_end.Create (sockaddr);
-                       }
-
-                       seed_endpoint = remote_end;
 
-                       return cnt;
-               }
 
-               static int ReceiveFrom_internal (SafeSocketHandle safeHandle, byte[] buffer, int offset, int count, SocketFlags flags, ref SocketAddress sockaddr, out int error)
+               static int ReceiveFrom_internal (SafeSocketHandle safeHandle, byte[] buffer, int offset, int count, SocketFlags flags, ref SocketAddress sockaddr, out int error, bool blocking)
                {
                        try {
                                safeHandle.RegisterForBlockingSyscall ();
-                               return ReceiveFrom_internal (safeHandle.DangerousGetHandle (), buffer, offset, count, flags, ref sockaddr, out error);
+                               return ReceiveFrom_internal (safeHandle.DangerousGetHandle (), buffer, offset, count, flags, ref sockaddr, out error, blocking);
                        } finally {
                                safeHandle.UnRegisterForBlockingSyscall ();
                        }
                }
 
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
-               extern static int ReceiveFrom_internal(IntPtr sock, byte[] buffer, int offset, int count, SocketFlags flags, ref SocketAddress sockaddr, out int error);
+               extern static int ReceiveFrom_internal(IntPtr sock, byte[] buffer, int offset, int count, SocketFlags flags, ref SocketAddress sockaddr, out int error, bool blocking);
 
 #endregion
 
@@ -2331,7 +1754,7 @@ namespace System.Net.Sockets
                        if (endPoint == null)
                                throw new ArgumentNullException ("endPoint");
 
-                       SocketAsyncResult sockares = ValidateEndIAsyncResult (asyncResult, "EndReceiveMessageFrom", "asyncResult");
+                       /*SocketAsyncResult sockares =*/ ValidateEndIAsyncResult (asyncResult, "EndReceiveMessageFrom", "asyncResult");
 
                        throw new NotImplementedException ();
                }
@@ -2340,97 +1763,33 @@ namespace System.Net.Sockets
 
 #region Send
 
-               public int Send (byte [] buffer)
-               {
-                       ThrowIfDisposedAndClosed ();
-                       ThrowIfBufferNull (buffer);
-                       ThrowIfBufferOutOfRange (buffer, 0, buffer.Length);
-
-                       SocketError error;
-                       int ret = Send_nochecks (buffer, 0, buffer.Length, SocketFlags.None, out error);
-
-                       if (error != SocketError.Success)
-                               throw new SocketException ((int) error);
-
-                       return ret;
-               }
-
-               public int Send (byte [] buffer, SocketFlags flags)
-               {
-                       ThrowIfDisposedAndClosed ();
-                       ThrowIfBufferNull (buffer);
-                       ThrowIfBufferOutOfRange (buffer, 0, buffer.Length);
-
-                       SocketError error;
-                       int ret = Send_nochecks (buffer, 0, buffer.Length, flags, out error);
-
-                       if (error != SocketError.Success)
-                               throw new SocketException ((int) error);
-
-                       return ret;
-               }
-
-               public int Send (byte [] buffer, int size, SocketFlags flags)
-               {
-                       ThrowIfDisposedAndClosed ();
-                       ThrowIfBufferNull (buffer);
-                       ThrowIfBufferOutOfRange (buffer, 0, size);
-
-                       SocketError error;
-                       int ret = Send_nochecks (buffer, 0, size, flags, out error);
-
-                       if (error != SocketError.Success)
-                               throw new SocketException ((int) error);
-
-                       return ret;
-               }
-
-               public int Send (byte [] buffer, int offset, int size, SocketFlags flags)
-               {
-                       ThrowIfDisposedAndClosed ();
-                       ThrowIfBufferNull (buffer);
-                       ThrowIfBufferOutOfRange (buffer, offset, size);
-
-                       SocketError error;
-                       int ret = Send_nochecks (buffer, offset, size, flags, out error);
-
-                       if (error != SocketError.Success)
-                               throw new SocketException ((int) error);
-
-                       return ret;
-               }
-
-               public int Send (byte [] buffer, int offset, int size, SocketFlags flags, out SocketError error)
+               public int Send (byte [] buffer, int offset, int size, SocketFlags socketFlags, out SocketError errorCode)
                {
                        ThrowIfDisposedAndClosed ();
                        ThrowIfBufferNull (buffer);
                        ThrowIfBufferOutOfRange (buffer, offset, size);
 
-                       return Send_nochecks (buffer, offset, size, flags, out error);
-               }
-
-               public
-               int Send (IList<ArraySegment<byte>> buffers)
-               {
-                       SocketError error;
-                       int ret = Send (buffers, SocketFlags.None, out error);
-
-                       if (error != SocketError.Success)
-                               throw new SocketException ((int) error);
-
-                       return ret;
-               }
-
-               public
-               int Send (IList<ArraySegment<byte>> buffers, SocketFlags socketFlags)
-               {
-                       SocketError error;
-                       int ret = Send (buffers, socketFlags, out error);
+                       if (size == 0) {
+                               errorCode = SocketError.Success;
+                               return 0;
+                       }
 
-                       if (error != SocketError.Success)
-                               throw new SocketException ((int) error);
+                       int nativeError;
+                       int sent = 0;
+                       do {
+                               sent += Send_internal (
+m_Handle, buffer, offset + sent, size - sent, socketFlags, out nativeError, is_blocking);
+                               errorCode = (SocketError)nativeError;
+                               if (errorCode != SocketError.Success && errorCode != SocketError.WouldBlock && errorCode != SocketError.InProgress) {
+                                       is_connected = false;
+                                       is_bound = false;
+                                       break;
+                               } else {
+                                       is_connected = true;
+                               }
+                       } while (sent < size);
 
-                       return ret;
+                       return sent;
                }
 
                [CLSCompliant (false)]
@@ -2462,7 +1821,7 @@ namespace System.Net.Sockets
                        }
 
                        try {
-                               ret = Send_internal (safe_handle, bufarray, socketFlags, out nativeError);
+                               ret = Send_internal (m_Handle, bufarray, socketFlags, out nativeError, is_blocking);
                        } finally {
                                for(int i = 0; i < numsegments; i++) {
                                        if (gch[i].IsAllocated) {
@@ -2476,28 +1835,6 @@ namespace System.Net.Sockets
                        return ret;
                }
 
-               int Send_nochecks (byte [] buf, int offset, int size, SocketFlags flags, out SocketError error)
-               {
-                       if (size == 0) {
-                               error = SocketError.Success;
-                               return 0;
-                       }
-
-                       int nativeError;
-                       int ret = Send_internal (safe_handle, buf, offset, size, flags, out nativeError);
-
-                       error = (SocketError)nativeError;
-
-                       if (error != SocketError.Success && error != SocketError.WouldBlock && error != SocketError.InProgress) {
-                               is_connected = false;
-                               is_bound = false;
-                       } else {
-                               is_connected = true;
-                       }
-
-                       return ret;
-               }
-
                public bool SendAsync (SocketAsyncEventArgs e)
                {
                        // NO check is made whether e != null in MS.NET (NRE is thrown in such case)
@@ -2512,7 +1849,7 @@ namespace System.Net.Sockets
 
                                e.socket_async_result.Buffers = e.BufferList;
 
-                               QueueIOSelectorJob (writeQ, e.socket_async_result.Handle, new IOSelectorJob (IOOperation.Write, BeginSendGenericCallback, e.socket_async_result));
+                               QueueIOSelectorJob (WriteSem, e.socket_async_result.Handle, new IOSelectorJob (IOOperation.Write, BeginSendGenericCallback, e.socket_async_result));
                        } else {
                                InitSocketAsyncEventArgs (e, SendAsyncCallback, e, SocketOperation.Send);
 
@@ -2520,7 +1857,7 @@ namespace System.Net.Sockets
                                e.socket_async_result.Offset = e.Offset;
                                e.socket_async_result.Size = e.Count;
 
-                               QueueIOSelectorJob (writeQ, e.socket_async_result.Handle, new IOSelectorJob (IOOperation.Write, s => BeginSendCallback ((SocketAsyncResult) s, 0), e.socket_async_result));
+                               QueueIOSelectorJob (WriteSem, e.socket_async_result.Handle, new IOSelectorJob (IOOperation.Write, s => BeginSendCallback ((SocketAsyncResult) s, 0), e.socket_async_result));
                        }
 
                        return true;
@@ -2545,32 +1882,25 @@ namespace System.Net.Sockets
 
                public IAsyncResult BeginSend (byte[] buffer, int offset, int size, SocketFlags socketFlags, out SocketError errorCode, AsyncCallback callback, object state)
                {
+                       ThrowIfDisposedAndClosed ();
+                       ThrowIfBufferNull (buffer);
+                       ThrowIfBufferOutOfRange (buffer, offset, size);
+
                        if (!is_connected) {
                                errorCode = SocketError.NotConnected;
-                               throw new SocketException ((int) errorCode);
+                               return null;
                        }
 
                        errorCode = SocketError.Success;
-                       return BeginSend (buffer, offset, size, socketFlags, callback, state);
-               }
-
-               public IAsyncResult BeginSend (byte[] buffer, int offset, int size, SocketFlags socket_flags, AsyncCallback callback, object state)
-               {
-                       ThrowIfDisposedAndClosed ();
-                       ThrowIfBufferNull (buffer);
-                       ThrowIfBufferOutOfRange (buffer, offset, size);
-
-                       if (!is_connected)
-                               throw new SocketException ((int)SocketError.NotConnected);
 
                        SocketAsyncResult sockares = new SocketAsyncResult (this, callback, state, SocketOperation.Send) {
                                Buffer = buffer,
                                Offset = offset,
                                Size = size,
-                               SockFlags = socket_flags,
+                               SockFlags = socketFlags,
                        };
 
-                       QueueIOSelectorJob (writeQ, sockares.Handle, new IOSelectorJob (IOOperation.Write, s => BeginSendCallback ((SocketAsyncResult) s, 0), sockares));
+                       QueueIOSelectorJob (WriteSem, sockares.Handle, new IOSelectorJob (IOOperation.Write, s => BeginSendCallback ((SocketAsyncResult) s, 0), sockares));
 
                        return sockares;
                }
@@ -2580,7 +1910,7 @@ namespace System.Net.Sockets
                        int total = 0;
 
                        try {
-                               total = Socket.Send_internal (sockares.socket.safe_handle, sockares.Buffer, sockares.Offset, sockares.Size, sockares.SockFlags, out sockares.error);
+                               total = Socket.Send_internal (sockares.socket.m_Handle, sockares.Buffer, sockares.Offset, sockares.Size, sockares.SockFlags, out sockares.error, false);
                        } catch (Exception e) {
                                sockares.Complete (e);
                                return;
@@ -2591,7 +1921,7 @@ namespace System.Net.Sockets
                                sockares.Offset += total;
                                sockares.Size -= total;
 
-                               if (sockares.socket.is_disposed) {
+                               if (sockares.socket.CleanedUp) {
                                        sockares.Complete (total);
                                        return;
                                }
@@ -2607,37 +1937,31 @@ namespace System.Net.Sockets
                        sockares.Complete (total);
                }
 
-               public IAsyncResult BeginSend (IList<ArraySegment<byte>> buffers, SocketFlags socketFlags, AsyncCallback callback, object state)
+               [CLSCompliant (false)]
+               public IAsyncResult BeginSend (IList<ArraySegment<byte>> buffers, SocketFlags socketFlags, out SocketError errorCode, AsyncCallback callback, object state)
                {
                        ThrowIfDisposedAndClosed ();
 
                        if (buffers == null)
                                throw new ArgumentNullException ("buffers");
-                       if (!is_connected)
-                               throw new SocketException ((int)SocketError.NotConnected);
+
+                       if (!is_connected) {
+                               errorCode = SocketError.NotConnected;
+                               return null;
+                       }
+
+                       errorCode = SocketError.Success;
 
                        SocketAsyncResult sockares = new SocketAsyncResult (this, callback, state, SocketOperation.SendGeneric) {
                                Buffers = buffers,
                                SockFlags = socketFlags,
                        };
 
-                       QueueIOSelectorJob (writeQ, sockares.Handle, new IOSelectorJob (IOOperation.Write, BeginSendGenericCallback, sockares));
+                       QueueIOSelectorJob (WriteSem, sockares.Handle, new IOSelectorJob (IOOperation.Write, BeginSendGenericCallback, sockares));
 
                        return sockares;
                }
 
-               [CLSCompliant (false)]
-               public IAsyncResult BeginSend (IList<ArraySegment<byte>> buffers, SocketFlags socketFlags, out SocketError errorCode, AsyncCallback callback, object state)
-               {
-                       if (!is_connected) {
-                               errorCode = SocketError.NotConnected;
-                               throw new SocketException ((int)errorCode);
-                       }
-
-                       errorCode = SocketError.Success;
-                       return BeginSend (buffers, socketFlags, callback, state);
-               }
-
                static IOAsyncCallback BeginSendGenericCallback = new IOAsyncCallback (ares => {
                        SocketAsyncResult sockares = (SocketAsyncResult) ares;
                        int total = 0;
@@ -2652,20 +1976,6 @@ namespace System.Net.Sockets
                        sockares.Complete (total);
                });
 
-               public int EndSend (IAsyncResult result)
-               {
-                       SocketError error;
-                       int bytesSent = EndSend (result, out error);
-
-                       if (error != SocketError.Success) {
-                               if (error != SocketError.WouldBlock && error != SocketError.InProgress)
-                                       is_connected = false;
-                               throw new SocketException ((int)error);
-                       }
-
-                       return bytesSent;
-               }
-
                public int EndSend (IAsyncResult asyncResult, out SocketError errorCode)
                {
                        ThrowIfDisposedAndClosed ();
@@ -2675,77 +1985,73 @@ namespace System.Net.Sockets
                        if (!sockares.IsCompleted)
                                sockares.AsyncWaitHandle.WaitOne ();
 
+                       errorCode = sockares.ErrorCode;
+
+                       if (errorCode != SocketError.Success && errorCode != SocketError.WouldBlock && errorCode != SocketError.InProgress)
+                               is_connected = false;
+
                        /* If no socket error occurred, call CheckIfThrowDelayedException in
                         * case there are other kinds of exceptions that should be thrown.*/
-                       if ((errorCode = sockares.ErrorCode) == SocketError.Success)
+                       if (errorCode == SocketError.Success)
                                sockares.CheckIfThrowDelayedException ();
 
                        return sockares.Total;
                }
 
-               static int Send_internal (SafeSocketHandle safeHandle, WSABUF[] bufarray, SocketFlags flags, out int error)
+               static int Send_internal (SafeSocketHandle safeHandle, WSABUF[] bufarray, SocketFlags flags, out int error, bool blocking)
                {
-                       bool release = false;
                        try {
-                               safeHandle.DangerousAddRef (ref release);
-                               return Send_internal (safeHandle.DangerousGetHandle (), bufarray, flags, out error);
+                               safeHandle.RegisterForBlockingSyscall ();
+                               return Send_internal (safeHandle.DangerousGetHandle (), bufarray, flags, out error, blocking);
                        } finally {
-                               if (release)
-                                       safeHandle.DangerousRelease ();
+                               safeHandle.UnRegisterForBlockingSyscall ();
                        }
                }
 
                [MethodImplAttribute (MethodImplOptions.InternalCall)]
-               extern static int Send_internal (IntPtr sock, WSABUF[] bufarray, SocketFlags flags, out int error);
+               extern static int Send_internal (IntPtr sock, WSABUF[] bufarray, SocketFlags flags, out int error, bool blocking);
 
-               static int Send_internal (SafeSocketHandle safeHandle, byte[] buf, int offset, int count, SocketFlags flags, out int error)
+               static int Send_internal (SafeSocketHandle safeHandle, byte[] buf, int offset, int count, SocketFlags flags, out int error, bool blocking)
                {
                        try {
                                safeHandle.RegisterForBlockingSyscall ();
-                               return Send_internal (safeHandle.DangerousGetHandle (), buf, offset, count, flags, out error);
+                               return Send_internal (safeHandle.DangerousGetHandle (), buf, offset, count, flags, out error, blocking);
                        } finally {
                                safeHandle.UnRegisterForBlockingSyscall ();
                        }
                }
 
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
-               extern static int Send_internal(IntPtr sock, byte[] buf, int offset, int count, SocketFlags flags, out int error);
+               extern static int Send_internal(IntPtr sock, byte[] buf, int offset, int count, SocketFlags flags, out int error, bool blocking);
 
 #endregion
 
 #region SendTo
 
-               public int SendTo (byte [] buffer, EndPoint remote_end)
-               {
-                       ThrowIfDisposedAndClosed ();
-                       ThrowIfBufferNull (buffer);
-
-                       return SendTo (buffer, 0, buffer.Length, SocketFlags.None, remote_end);
-               }
-
-               public int SendTo (byte [] buffer, SocketFlags flags, EndPoint remote_end)
+               public int SendTo (byte [] buffer, int offset, int size, SocketFlags socketFlags, EndPoint remoteEP)
                {
                        ThrowIfDisposedAndClosed ();
                        ThrowIfBufferNull (buffer);
+                       ThrowIfBufferOutOfRange (buffer, offset, size);
 
-                       return SendTo (buffer, 0, buffer.Length, flags, remote_end);
-               }
+                       if (remoteEP == null)
+                               throw new ArgumentNullException("remoteEP");
 
-               public int SendTo (byte [] buffer, int size, SocketFlags flags, EndPoint remote_end)
-               {
-                       return SendTo (buffer, 0, size, flags, remote_end);
-               }
+                       int error;
+                       int ret = SendTo_internal (m_Handle, buffer, offset, size, socketFlags, remoteEP.Serialize (), out error, is_blocking);
 
-               public int SendTo (byte [] buffer, int offset, int size, SocketFlags flags, EndPoint remote_end)
-               {
-                       ThrowIfDisposedAndClosed ();
-                       ThrowIfBufferNull (buffer);
-                       ThrowIfBufferOutOfRange (buffer, offset, size);
+                       SocketError err = (SocketError) error;
+                       if (err != 0) {
+                               if (err != SocketError.WouldBlock && err != SocketError.InProgress)
+                                       is_connected = false;
+                               throw new SocketException (error);
+                       }
 
-                       if (remote_end == null)
-                               throw new ArgumentNullException("remote_end");
+                       is_connected = true;
+                       is_bound = true;
+                       seed_endpoint = remoteEP;
 
-                       return SendTo_nochecks (buffer, offset, size, flags, remote_end);
+                       return ret;
                }
 
                public bool SendToAsync (SocketAsyncEventArgs e)
@@ -2767,7 +2073,7 @@ namespace System.Net.Sockets
                        e.socket_async_result.SockFlags = e.SocketFlags;
                        e.socket_async_result.EndPoint = e.RemoteEndPoint;
 
-                       QueueIOSelectorJob (writeQ, e.socket_async_result.Handle, new IOSelectorJob (IOOperation.Write, s => BeginSendToCallback ((SocketAsyncResult) s, 0), e.socket_async_result));
+                       QueueIOSelectorJob (WriteSem, e.socket_async_result.Handle, new IOSelectorJob (IOOperation.Write, s => BeginSendToCallback ((SocketAsyncResult) s, 0), e.socket_async_result));
 
                        return true;
                }
@@ -2803,7 +2109,7 @@ namespace System.Net.Sockets
                                EndPoint = remote_end,
                        };
 
-                       QueueIOSelectorJob (writeQ, sockares.Handle, new IOSelectorJob (IOOperation.Write, s => BeginSendToCallback ((SocketAsyncResult) s, 0), sockares));
+                       QueueIOSelectorJob (WriteSem, sockares.Handle, new IOSelectorJob (IOOperation.Write, s => BeginSendToCallback ((SocketAsyncResult) s, 0), sockares));
 
                        return sockares;
                }
@@ -2812,7 +2118,7 @@ namespace System.Net.Sockets
                {
                        int total = 0;
                        try {
-                               total = sockares.socket.SendTo_nochecks (sockares.Buffer, sockares.Offset, sockares.Size, sockares.SockFlags, sockares.EndPoint);
+                               total = sockares.socket.SendTo (sockares.Buffer, sockares.Offset, sockares.Size, sockares.SockFlags, sockares.EndPoint);
 
                                if (sockares.error == 0) {
                                        sent_so_far += total;
@@ -2848,54 +2154,23 @@ namespace System.Net.Sockets
                        return sockares.Total;
                }
 
-               int SendTo_nochecks (byte [] buffer, int offset, int size, SocketFlags flags, EndPoint remote_end)
-               {
-                       int error;
-                       int ret = SendTo_internal (safe_handle, buffer, offset, size, flags, remote_end.Serialize (), out error);
-
-                       SocketError err = (SocketError) error;
-                       if (err != 0) {
-                               if (err != SocketError.WouldBlock && err != SocketError.InProgress)
-                                       is_connected = false;
-                               throw new SocketException (error);
-                       }
-
-                       is_connected = true;
-                       is_bound = true;
-                       seed_endpoint = remote_end;
-
-                       return ret;
-               }
-
-               static int SendTo_internal (SafeSocketHandle safeHandle, byte[] buffer, int offset, int count, SocketFlags flags, SocketAddress sa, out int error)
+               static int SendTo_internal (SafeSocketHandle safeHandle, byte[] buffer, int offset, int count, SocketFlags flags, SocketAddress sa, out int error, bool blocking)
                {
                        try {
                                safeHandle.RegisterForBlockingSyscall ();
-                               return SendTo_internal (safeHandle.DangerousGetHandle (), buffer, offset, count, flags, sa, out error);
+                               return SendTo_internal (safeHandle.DangerousGetHandle (), buffer, offset, count, flags, sa, out error, blocking);
                        } finally {
                                safeHandle.UnRegisterForBlockingSyscall ();
                        }
                }
 
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
-               extern static int SendTo_internal (IntPtr sock, byte[] buffer, int offset, int count, SocketFlags flags, SocketAddress sa, out int error);
+               extern static int SendTo_internal (IntPtr sock, byte[] buffer, int offset, int count, SocketFlags flags, SocketAddress sa, out int error, bool blocking);
 
 #endregion
 
 #region SendFile
 
-               public void SendFile (string fileName)
-               {
-                       ThrowIfDisposedAndClosed ();
-
-                       if (!is_connected)
-                               throw new NotSupportedException ();
-                       if (!is_blocking)
-                               throw new InvalidOperationException ();
-
-                       SendFile (fileName, null, null, 0);
-               }
-
                public void SendFile (string fileName, byte[] preBuffer, byte[] postBuffer, TransmitFileOptions flags)
                {
                        ThrowIfDisposedAndClosed ();
@@ -2905,26 +2180,15 @@ namespace System.Net.Sockets
                        if (!is_blocking)
                                throw new InvalidOperationException ();
 
-                       if (!SendFile_internal (safe_handle, fileName, preBuffer, postBuffer, flags)) {
-                               SocketException exc = new SocketException ();
+                       int error = 0;
+                       if (!SendFile_internal (m_Handle, fileName, preBuffer, postBuffer, flags, out error, is_blocking) || error != 0) {
+                               SocketException exc = new SocketException (error);
                                if (exc.ErrorCode == 2 || exc.ErrorCode == 3)
                                        throw new FileNotFoundException ();
                                throw exc;
                        }
                }
 
-               public IAsyncResult BeginSendFile (string fileName, AsyncCallback callback, object state)
-               {
-                       ThrowIfDisposedAndClosed ();
-
-                       if (!is_connected)
-                               throw new NotSupportedException ();
-                       if (!File.Exists (fileName))
-                               throw new FileNotFoundException ();
-
-                       return BeginSendFile (fileName, null, null, 0, callback, state);
-               }
-
                public IAsyncResult BeginSendFile (string fileName, byte[] preBuffer, byte[] postBuffer, TransmitFileOptions flags, AsyncCallback callback, object state)
                {
                        ThrowIfDisposedAndClosed ();
@@ -2953,18 +2217,18 @@ namespace System.Net.Sockets
                        ares.Delegate.EndInvoke (ares.Original);
                }
 
-               static bool SendFile_internal (SafeSocketHandle safeHandle, string filename, byte [] pre_buffer, byte [] post_buffer, TransmitFileOptions flags)
+               static bool SendFile_internal (SafeSocketHandle safeHandle, string filename, byte [] pre_buffer, byte [] post_buffer, TransmitFileOptions flags, out int error, bool blocking)
                {
                        try {
                                safeHandle.RegisterForBlockingSyscall ();
-                               return SendFile_internal (safeHandle.DangerousGetHandle (), filename, pre_buffer, post_buffer, flags);
+                               return SendFile_internal (safeHandle.DangerousGetHandle (), filename, pre_buffer, post_buffer, flags, out error, blocking);
                        } finally {
                                safeHandle.UnRegisterForBlockingSyscall ();
                        }
                }
 
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
-               extern static bool SendFile_internal (IntPtr sock, string filename, byte [] pre_buffer, byte [] post_buffer, TransmitFileOptions flags);
+               extern static bool SendFile_internal (IntPtr sock, string filename, byte [] pre_buffer, byte [] post_buffer, TransmitFileOptions flags, out int error, bool blocking);
 
                delegate void SendFileHandler (string fileName, byte [] preBuffer, byte [] postBuffer, TransmitFileOptions flags);
 
@@ -3021,7 +2285,6 @@ namespace System.Net.Sockets
 
 #region DuplicateAndClose
 
-#if !MOBILE
                [MonoLimitation ("We do not support passing sockets across processes, we merely allow this API to pass the socket across AppDomains")]
                public SocketInformation DuplicateAndClose (int targetProcessId)
                {
@@ -3030,14 +2293,13 @@ namespace System.Net.Sockets
                                (is_listening      ? SocketInformationOptions.Listening : 0) |
                                (is_connected      ? SocketInformationOptions.Connected : 0) |
                                (is_blocking       ? 0 : SocketInformationOptions.NonBlocking) |
-                               (use_overlapped_io ? SocketInformationOptions.UseOnlyOverlappedIO : 0);
+                               (useOverlappedIO ? SocketInformationOptions.UseOnlyOverlappedIO : 0);
 
-                       si.ProtocolInformation = Mono.DataConverter.Pack ("iiiil", (int)address_family, (int)socket_type, (int)protocol_type, is_bound ? 1 : 0, (long)Handle);
-                       safe_handle = null;
+                       si.ProtocolInformation = Mono.DataConverter.Pack ("iiiil", (int)addressFamily, (int)socketType, (int)protocolType, is_bound ? 1 : 0, (long)Handle);
+                       m_Handle = null;
 
                        return si;
                }
-#endif
 
 #endregion
 
@@ -3051,19 +2313,19 @@ namespace System.Net.Sockets
                                throw new SocketException ((int) SocketError.Fault, "Error trying to dereference an invalid pointer");
 
                        int error;
-                       GetSocketOption_arr_internal (safe_handle, optionLevel, optionName, ref optionValue, out error);
+                       GetSocketOption_arr_internal (m_Handle, optionLevel, optionName, ref optionValue, out error);
 
                        if (error != 0)
                                throw new SocketException (error);
                }
 
-               public byte [] GetSocketOption (SocketOptionLevel optionLevel, SocketOptionName optionName, int length)
+               public byte [] GetSocketOption (SocketOptionLevel optionLevel, SocketOptionName optionName, int optionLength)
                {
                        ThrowIfDisposedAndClosed ();
 
                        int error;
-                       byte[] byte_val = new byte [length];
-                       GetSocketOption_arr_internal (safe_handle, optionLevel, optionName, ref byte_val, out error);
+                       byte[] byte_val = new byte [optionLength];
+                       GetSocketOption_arr_internal (m_Handle, optionLevel, optionName, ref byte_val, out error);
 
                        if (error != 0)
                                throw new SocketException (error);
@@ -3077,7 +2339,7 @@ namespace System.Net.Sockets
 
                        int error;
                        object obj_val;
-                       GetSocketOption_obj_internal (safe_handle, optionLevel, optionName, out obj_val, out error);
+                       GetSocketOption_obj_internal (m_Handle, optionLevel, optionName, out obj_val, out error);
 
                        if (error != 0)
                                throw new SocketException (error);
@@ -3135,7 +2397,7 @@ namespace System.Net.Sockets
                                throw new SocketException ((int) SocketError.Fault, "Error trying to dereference an invalid pointer");
 
                        int error;
-                       SetSocketOption_internal (safe_handle, optionLevel, optionName, null, optionValue, 0, out error);
+                       SetSocketOption_internal (m_Handle, optionLevel, optionName, null, optionValue, 0, out error);
 
                        if (error != 0) {
                                if (error == (int) SocketError.InvalidArgument)
@@ -3158,17 +2420,17 @@ namespace System.Net.Sockets
                                LingerOption linger = optionValue as LingerOption;
                                if (linger == null)
                                        throw new ArgumentException ("A 'LingerOption' value must be specified.", "optionValue");
-                               SetSocketOption_internal (safe_handle, optionLevel, optionName, linger, null, 0, out error);
+                               SetSocketOption_internal (m_Handle, optionLevel, optionName, linger, null, 0, out error);
                        } else if (optionLevel == SocketOptionLevel.IP && (optionName == SocketOptionName.AddMembership || optionName == SocketOptionName.DropMembership)) {
                                MulticastOption multicast = optionValue as MulticastOption;
                                if (multicast == null)
                                        throw new ArgumentException ("A 'MulticastOption' value must be specified.", "optionValue");
-                               SetSocketOption_internal (safe_handle, optionLevel, optionName, multicast, null, 0, out error);
+                               SetSocketOption_internal (m_Handle, optionLevel, optionName, multicast, null, 0, out error);
                        } else if (optionLevel == SocketOptionLevel.IPv6 && (optionName == SocketOptionName.AddMembership || optionName == SocketOptionName.DropMembership)) {
                                IPv6MulticastOption multicast = optionValue as IPv6MulticastOption;
                                if (multicast == null)
                                        throw new ArgumentException ("A 'IPv6MulticastOption' value must be specified.", "optionValue");
-                               SetSocketOption_internal (safe_handle, optionLevel, optionName, multicast, null, 0, out error);
+                               SetSocketOption_internal (m_Handle, optionLevel, optionName, multicast, null, 0, out error);
                        } else {
                                throw new ArgumentException ("Invalid value specified.", "optionValue");
                        }
@@ -3191,11 +2453,8 @@ namespace System.Net.Sockets
                {
                        ThrowIfDisposedAndClosed ();
 
-                       if (optionLevel == SocketOptionLevel.Socket && optionName == SocketOptionName.ReuseAddress && optionValue != 0 && !SupportsPortReuse (protocol_type))
-                               throw new SocketException ((int) SocketError.OperationNotSupported, "Operating system sockets do not support ReuseAddress.\nIf your socket is not intended to bind to the same address and port multiple times remove this option, otherwise you should ignore this exception inside a try catch and check that ReuseAddress is true before binding to the same address and port multiple times.");
-
                        int error;
-                       SetSocketOption_internal (safe_handle, optionLevel, optionName, null, null, optionValue, out error);
+                       SetSocketOption_internal (m_Handle, optionLevel, optionName, null, null, optionValue, out error);
 
                        if (error != 0) {
                                if (error == (int) SocketError.InvalidArgument)
@@ -3223,13 +2482,13 @@ namespace System.Net.Sockets
 
 #region IOControl
 
-               public int IOControl (int ioctl_code, byte [] in_value, byte [] out_value)
+               public int IOControl (int ioControlCode, byte [] optionInValue, byte [] optionOutValue)
                {
-                       if (is_disposed)
+                       if (CleanedUp)
                                throw new ObjectDisposedException (GetType ().ToString ());
 
                        int error;
-                       int result = IOControl_internal (safe_handle, ioctl_code, in_value, out_value, out error);
+                       int result = IOControl_internal (m_Handle, ioControlCode, optionInValue, optionOutValue, out error);
 
                        if (error != 0)
                                throw new SocketException (error);
@@ -3239,11 +2498,6 @@ namespace System.Net.Sockets
                        return result;
                }
 
-               public int IOControl (IOControlCode ioControlCode, byte[] optionInValue, byte[] optionOutValue)
-               {
-                       return IOControl ((int) ioControlCode, optionInValue, optionOutValue);
-               }
-
                static int IOControl_internal (SafeSocketHandle safeHandle, int ioctl_code, byte [] input, byte [] output, out int error)
                {
                        bool release = false;
@@ -3293,7 +2547,7 @@ namespace System.Net.Sockets
                                throw new SocketException (10057); // Not connected
 
                        int error;
-                       Shutdown_internal (safe_handle, how, out error);
+                       Shutdown_internal (m_Handle, how, out error);
 
                        if (error != 0)
                                throw new SocketException (error);
@@ -3320,30 +2574,24 @@ namespace System.Net.Sockets
 
                protected virtual void Dispose (bool disposing)
                {
-                       if (is_disposed)
+                       if (CleanedUp)
                                return;
 
-                       is_disposed = true;
+                       m_IntCleanedUp = 1;
                        bool was_connected = is_connected;
                        is_connected = false;
 
-                       if (safe_handle != null) {
+                       if (m_Handle != null) {
                                is_closed = true;
                                IntPtr x = Handle;
 
                                if (was_connected)
                                        Linger (x);
 
-                               safe_handle.Dispose ();
+                               m_Handle.Dispose ();
                        }
                }
 
-               public void Dispose ()
-               {
-                       Dispose (true);
-                       GC.SuppressFinalize (this);
-               }
-
                void Linger (IntPtr handle)
                {
                        if (!is_connected || linger_timeout <= 0)
@@ -3378,13 +2626,13 @@ namespace System.Net.Sockets
 
                void ThrowIfDisposedAndClosed (Socket socket)
                {
-                       if (socket.is_disposed && socket.is_closed)
+                       if (socket.CleanedUp && socket.is_closed)
                                throw new ObjectDisposedException (socket.GetType ().ToString ());
                }
 
                void ThrowIfDisposedAndClosed ()
                {
-                       if (is_disposed && is_closed)
+                       if (CleanedUp && is_closed)
                                throw new ObjectDisposedException (GetType ().ToString ());
                }
 
@@ -3408,10 +2656,8 @@ namespace System.Net.Sockets
 
                void ThrowIfUdp ()
                {
-#if !NET_2_1 || MOBILE
-                       if (protocol_type == ProtocolType.Udp)
+                       if (protocolType == ProtocolType.Udp)
                                throw new SocketException ((int)SocketError.ProtocolOption);
-#endif
                }
 
                SocketAsyncResult ValidateEndIAsyncResult (IAsyncResult ares, string methodName, string argName)
@@ -3428,16 +2674,16 @@ namespace System.Net.Sockets
                        return sockares;
                }
 
-               void QueueIOSelectorJob (Queue<KeyValuePair<IntPtr, IOSelectorJob>> queue, IntPtr handle, IOSelectorJob job)
+               void QueueIOSelectorJob (SemaphoreSlim sem, IntPtr handle, IOSelectorJob job)
                {
-                       int count;
-                       lock (queue) {
-                               queue.Enqueue (new KeyValuePair<IntPtr, IOSelectorJob> (handle, job));
-                               count = queue.Count;
-                       }
+                       sem.WaitAsync ().ContinueWith (t => {
+                               if (CleanedUp) {
+                                       job.MarkDisposed ();
+                                       return;
+                               }
 
-                       if (count == 1)
                                IOSelector.Add (handle, job);
+                       });
                }
 
                void InitSocketAsyncEventArgs (SocketAsyncEventArgs e, AsyncCallback callback, object state, SocketOperation operation)
@@ -3495,6 +2741,41 @@ namespace System.Net.Sockets
 
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
                internal static extern bool SupportsPortReuse (ProtocolType proto);
+
+               internal static int FamilyHint {
+                       get {
+                               // Returns one of
+                               //      MONO_HINT_UNSPECIFIED           = 0,
+                               //      MONO_HINT_IPV4                          = 1,
+                               //      MONO_HINT_IPV6                          = 2,
+
+                               int hint = 0;
+                               if (OSSupportsIPv4) {
+                                       hint = 1;
+                               }
+
+                               if (OSSupportsIPv6) {
+                                       hint = hint == 0 ? 2 : 0;
+                               }
+
+                               return hint;
+                       }
+               }
+
+               static bool IsProtocolSupported (NetworkInterfaceComponent networkInterface)
+               {
+#if MOBILE
+                       return true;
+#else
+                       var nics = NetworkInterface.GetAllNetworkInterfaces ();
+                       foreach (var adapter in nics) {
+                               if (adapter.Supports (networkInterface))
+                                       return true;
+                       }
+
+                       return false;
+#endif
+               }
        }
 }
 
index 98622cb981a30a8f29324b26b932fdb9c1cd3c40..419035efe15fe3ad31aac61aa2ba427ccc397620 100644 (file)
@@ -61,13 +61,13 @@ namespace System.Net.Sockets
                        private set;
                }
 
-               IList <ArraySegment <byte>> _bufferList;
+               internal IList<ArraySegment<byte>> m_BufferList;
                public IList<ArraySegment<byte>> BufferList {
-                       get { return _bufferList; }
+                       get { return m_BufferList; }
                        set {
                                if (Buffer != null && value != null)
                                        throw new ArgumentException ("Buffer and BufferList properties cannot both be non-null.");
-                               _bufferList = value;
+                               m_BufferList = value;
                        }
                }
 
@@ -111,12 +111,10 @@ namespace System.Net.Sockets
                        set;
                }
 
-#if !NET_2_1
                public TransmitFileOptions SendPacketsFlags {
                        get;
                        set;
                }
-#endif
 
                [MonoTODO ("unused property")]
                public int SendPacketsSendSize {
@@ -179,13 +177,6 @@ namespace System.Net.Sockets
 
                        if (disposing && in_progress != 0)
                                return;
-
-                       AcceptSocket = null;
-                       Buffer = null;
-                       BufferList = null;
-                       RemoteEndPoint = null;
-                       UserToken = null;
-                       SendPacketsElements = null;
                }
 
                public void Dispose ()
@@ -243,5 +234,43 @@ namespace System.Net.Sockets
 
                        Buffer = buffer;
                }
+
+               internal void StartOperationCommon (Socket socket)
+               {
+                       current_socket = socket;
+               }
+
+               internal void StartOperationWrapperConnect (MultipleConnectAsync args)
+               {
+                       SetLastOperation (SocketAsyncOperation.Connect);
+
+                       //m_MultipleConnect = args;
+               }
+
+               internal void FinishConnectByNameSyncFailure (Exception exception, int bytesTransferred, SocketFlags flags)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               internal void FinishOperationAsyncFailure (Exception exception, int bytesTransferred, SocketFlags flags)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               internal void FinishWrapperConnectSuccess (Socket connectSocket, int bytesTransferred, SocketFlags flags)
+               {
+                       SetResults(SocketError.Success, bytesTransferred, flags);
+                       current_socket = connectSocket;
+
+                       Complete ();
+                       OnCompleted (this);
+               }
+
+               internal void SetResults (SocketError socketError, int bytesTransferred, SocketFlags flags)
+               {
+                       SocketError = socketError;
+                       BytesTransferred = bytesTransferred;
+                       SocketFlags = flags;
+               }
        }
 }
diff --git a/mcs/class/System/System.Net.Sockets/SocketAsyncOperation.cs b/mcs/class/System/System.Net.Sockets/SocketAsyncOperation.cs
deleted file mode 100644 (file)
index 87d6de5..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-// System.Net.Sockets.SocketAsyncOperation.cs
-//
-// Authors:
-//     Marek Habersack (mhabersack@novell.com)
-//
-// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
-//
-
-//
-// 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.
-//
-namespace System.Net.Sockets
-{
-       public enum SocketAsyncOperation
-       {
-               None,
-               Accept,
-               Connect,
-               Disconnect,
-               Receive,
-               ReceiveFrom,
-               ReceiveMessageFrom,
-               Send,
-               SendPackets,
-               SendTo
-       }
-}
index 980ad06e5b2f909333222afba5fea6ea9da6ead2..c63b1781660d77a48c9dd8b8f77dc1aae07f7a8a 100644 (file)
@@ -140,7 +140,7 @@ namespace System.Net.Sockets
 
                public void Complete ()
                {
-                       if (operation != SocketOperation.Receive && socket.is_disposed)
+                       if (operation != SocketOperation.Receive && socket.CleanedUp)
                                DelayedException = new ObjectDisposedException (socket.GetType ().ToString ());
 
                        IsCompleted = true;
@@ -150,42 +150,20 @@ namespace System.Net.Sockets
                                ThreadPool.UnsafeQueueUserWorkItem (_ => callback (this), null);
                        }
 
-                       Queue<KeyValuePair<IntPtr, IOSelectorJob>> queue = null;
                        switch (operation) {
                        case SocketOperation.Receive:
                        case SocketOperation.ReceiveFrom:
                        case SocketOperation.ReceiveGeneric:
                        case SocketOperation.Accept:
-                               queue = socket.readQ;
+                               socket.ReadSem.Release ();
                                break;
                        case SocketOperation.Send:
                        case SocketOperation.SendTo:
                        case SocketOperation.SendGeneric:
-                               queue = socket.writeQ;
+                               socket.WriteSem.Release ();
                                break;
                        }
 
-                       if (queue != null) {
-                               lock (queue) {
-                                       /* queue.Count will only be 0 if the socket is closed while receive/send/accept
-                                        * operation(s) are pending and at least one call to this method is waiting
-                                        * on the lock while another one calls CompleteAllOnDispose() */
-                                       if (queue.Count > 0)
-                                               queue.Dequeue (); /* remove ourselves */
-                                       if (queue.Count > 0) {
-                                               if (!socket.is_disposed) {
-                                                       IOSelector.Add (queue.Peek ().Key, queue.Peek ().Value);
-                                               } else {
-                                                       /* CompleteAllOnDispose */
-                                                       KeyValuePair<IntPtr, IOSelectorJob> [] jobs = queue.ToArray ();
-                                                       for (int i = 0; i < jobs.Length; i++)
-                                                               ThreadPool.QueueUserWorkItem (j => ((IOSelectorJob) j).MarkDisposed (), jobs [i].Value);
-                                                       queue.Clear ();
-                                               }
-                                       }
-                               }
-                       }
-
                        // IMPORTANT: 'callback', if any is scheduled from unmanaged code
                }
 
diff --git a/mcs/class/System/System.Net.Sockets/SocketReceiveFromResult.cs b/mcs/class/System/System.Net.Sockets/SocketReceiveFromResult.cs
new file mode 100644 (file)
index 0000000..6059483
--- /dev/null
@@ -0,0 +1,40 @@
+//
+// SocketReceiveFromResult.cs
+//
+// Authors:
+//     Marek Safar  <marek.safar@gmail.com>
+//
+// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com)
+//
+// 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.
+//
+
+#if NETSTANDARD
+
+namespace System.Net.Sockets
+{
+       public struct SocketReceiveFromResult
+       {
+               public int ReceivedBytes;
+               public EndPoint RemoteEndPoint;
+       }
+}
+
+#endif
diff --git a/mcs/class/System/System.Net.Sockets/SocketReceiveMessageFromResult.cs b/mcs/class/System/System.Net.Sockets/SocketReceiveMessageFromResult.cs
new file mode 100644 (file)
index 0000000..f06b339
--- /dev/null
@@ -0,0 +1,42 @@
+//
+// SocketReceiveMessageFromResult.cs
+//
+// Authors:
+//     Marek Safar  <marek.safar@gmail.com>
+//
+// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com)
+//
+// 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.
+//
+
+#if NETSTANDARD
+
+namespace System.Net.Sockets
+{
+       public struct SocketReceiveMessageFromResult
+       {
+               public int ReceivedBytes;
+               public SocketFlags SocketFlags;
+               public EndPoint RemoteEndPoint;
+               public IPPacketInformation PacketInformation;
+       }
+}
+
+#endif
diff --git a/mcs/class/System/System.Net.Sockets/SocketTaskExtensions.cs b/mcs/class/System/System.Net.Sockets/SocketTaskExtensions.cs
new file mode 100644 (file)
index 0000000..33bb55a
--- /dev/null
@@ -0,0 +1,254 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+#if NETSTANDARD
+
+using System.Collections.Generic;
+using System.Threading.Tasks;
+
+namespace System.Net.Sockets
+{
+    public static class SocketTaskExtensions
+    {
+        public static Task<Socket> AcceptAsync(this Socket socket)
+        {
+            return Task<Socket>.Factory.FromAsync(
+                (callback, state) => ((Socket)state).BeginAccept(callback, state),
+                asyncResult => ((Socket)asyncResult.AsyncState).EndAccept(asyncResult),
+                state: socket);
+        }
+
+        public static Task<Socket> AcceptAsync(this Socket socket, Socket acceptSocket)
+        {
+            const int ReceiveSize = 0;
+            return Task<Socket>.Factory.FromAsync(
+                (socketForAccept, receiveSize, callback, state) => ((Socket)state).BeginAccept(socketForAccept, receiveSize, callback, state),
+                asyncResult => ((Socket)asyncResult.AsyncState).EndAccept(asyncResult),
+                acceptSocket,
+                ReceiveSize,
+                state: socket);
+        }
+
+        public static Task ConnectAsync(this Socket socket, EndPoint remoteEP)
+        {
+            return Task.Factory.FromAsync(
+                (targetEndPoint, callback, state) => ((Socket)state).BeginConnect(targetEndPoint, callback, state),
+                asyncResult => ((Socket)asyncResult.AsyncState).EndConnect(asyncResult),
+                remoteEP,
+                state: socket);
+        }
+
+        public static Task ConnectAsync(this Socket socket, IPAddress address, int port)
+        {
+            return Task.Factory.FromAsync(
+                (targetAddress, targetPort, callback, state) => ((Socket)state).BeginConnect(targetAddress, targetPort, callback, state),
+                asyncResult => ((Socket)asyncResult.AsyncState).EndConnect(asyncResult),
+                address,
+                port,
+                state: socket);
+        }
+
+        public static Task ConnectAsync(this Socket socket, IPAddress[] addresses, int port)
+        {
+            return Task.Factory.FromAsync(
+                (targetAddresses, targetPort, callback, state) => ((Socket)state).BeginConnect(targetAddresses, targetPort, callback, state),
+                asyncResult => ((Socket)asyncResult.AsyncState).EndConnect(asyncResult),
+                addresses,
+                port,
+                state: socket);
+        }
+
+        public static Task ConnectAsync(this Socket socket, string host, int port)
+        {
+            return Task.Factory.FromAsync(
+                (targetHost, targetPort, callback, state) => ((Socket)state).BeginConnect(targetHost, targetPort, callback, state),
+                asyncResult => ((Socket)asyncResult.AsyncState).EndConnect(asyncResult),
+                host,
+                port,
+                state: socket);
+        }
+
+        public static Task<int> ReceiveAsync(this Socket socket, ArraySegment<byte> buffer, SocketFlags socketFlags)
+        {
+            return Task<int>.Factory.FromAsync(
+                (targetBuffer, flags, callback, state) => ((Socket)state).BeginReceive(
+                                                              targetBuffer.Array,
+                                                              targetBuffer.Offset,
+                                                              targetBuffer.Count,
+                                                              flags,
+                                                              callback,
+                                                              state),
+                asyncResult => ((Socket)asyncResult.AsyncState).EndReceive(asyncResult),
+                buffer,
+                socketFlags,
+                state: socket);
+        }
+
+        public static Task<int> ReceiveAsync(
+            this Socket socket,
+            IList<ArraySegment<byte>> buffers,
+            SocketFlags socketFlags)
+        {
+            return Task<int>.Factory.FromAsync(
+                (targetBuffers, flags, callback, state) => ((Socket)state).BeginReceive(targetBuffers, flags, callback, state),
+                asyncResult => ((Socket)asyncResult.AsyncState).EndReceive(asyncResult),
+                buffers,
+                socketFlags,
+                state: socket);
+        }
+
+        public static Task<SocketReceiveFromResult> ReceiveFromAsync(
+            this Socket socket,
+            ArraySegment<byte> buffer,
+            SocketFlags socketFlags,
+            EndPoint remoteEndPoint)
+        {
+            object[] packedArguments = new object[] { socket, remoteEndPoint };
+
+            return Task<SocketReceiveFromResult>.Factory.FromAsync(
+                (targetBuffer, flags, callback, state) =>
+                {
+                    var arguments = (object[])state;
+                    var s = (Socket)arguments[0];
+                    var e = (EndPoint)arguments[1];
+
+                    IAsyncResult result = s.BeginReceiveFrom(
+                        targetBuffer.Array,
+                        targetBuffer.Offset,
+                        targetBuffer.Count,
+                        flags,
+                        ref e,
+                        callback,
+                        state);
+
+                    arguments[1] = e;
+                    return result;
+                },
+                asyncResult =>
+                {
+                    var arguments = (object[])asyncResult.AsyncState;
+                    var s = (Socket)arguments[0];
+                    var e = (EndPoint)arguments[1];
+
+                    int bytesReceived = s.EndReceiveFrom(asyncResult, ref e);
+
+                    return new SocketReceiveFromResult()
+                    {
+                        ReceivedBytes = bytesReceived,
+                        RemoteEndPoint = e
+                    };
+                },
+                buffer,
+                socketFlags,
+                state: packedArguments);
+        }
+
+        public static Task<SocketReceiveMessageFromResult> ReceiveMessageFromAsync(
+            this Socket socket,
+            ArraySegment<byte> buffer,
+            SocketFlags socketFlags,
+            EndPoint remoteEndPoint)
+        {
+            object[] packedArguments = new object[] { socket, socketFlags, remoteEndPoint };
+
+            return Task<SocketReceiveMessageFromResult>.Factory.FromAsync(
+                (targetBuffer, callback, state) =>
+                {
+                    var arguments = (object[])state;
+                    var s = (Socket)arguments[0];
+                    var f = (SocketFlags)arguments[1];
+                    var e = (EndPoint)arguments[2];
+
+                    IAsyncResult result = s.BeginReceiveMessageFrom(
+                        targetBuffer.Array,
+                        targetBuffer.Offset,
+                        targetBuffer.Count,
+                        f,
+                        ref e,
+                        callback,
+                        state);
+
+                    arguments[2] = e;
+                    return result;
+                },
+                asyncResult =>
+                {
+                    var arguments = (object[])asyncResult.AsyncState;
+                    var s = (Socket)arguments[0];
+                    var f = (SocketFlags)arguments[1];
+                    var e = (EndPoint)arguments[2];
+                    IPPacketInformation ipPacket;
+
+                    int bytesReceived = s.EndReceiveMessageFrom(
+                        asyncResult,
+                        ref f,
+                        ref e,
+                        out ipPacket);
+
+                    return new SocketReceiveMessageFromResult()
+                    {
+                        PacketInformation = ipPacket,
+                        ReceivedBytes = bytesReceived,
+                        RemoteEndPoint = e,
+                        SocketFlags = f
+                    };
+                },
+                buffer,
+                state: packedArguments);
+        }
+
+        public static Task<int> SendAsync(this Socket socket, ArraySegment<byte> buffer, SocketFlags socketFlags)
+        {
+            return Task<int>.Factory.FromAsync(
+                (targetBuffer, flags, callback, state) => ((Socket)state).BeginSend(
+                                                              targetBuffer.Array,
+                                                              targetBuffer.Offset,
+                                                              targetBuffer.Count,
+                                                              flags,
+                                                              callback,
+                                                              state),
+                asyncResult => ((Socket)asyncResult.AsyncState).EndSend(asyncResult),
+                buffer,
+                socketFlags,
+                state: socket);
+        }
+
+        public static Task<int> SendAsync(
+            this Socket socket,
+            IList<ArraySegment<byte>> buffers,
+            SocketFlags socketFlags)
+        {
+            return Task<int>.Factory.FromAsync(
+                (targetBuffers, flags, callback, state) => ((Socket)state).BeginSend(targetBuffers, flags, callback, state),
+                asyncResult => ((Socket)asyncResult.AsyncState).EndSend(asyncResult),
+                buffers,
+                socketFlags,
+                state: socket);
+        }
+
+        public static Task<int> SendToAsync(
+            this Socket socket,
+            ArraySegment<byte> buffer,
+            SocketFlags socketFlags,
+            EndPoint remoteEP)
+        {
+            return Task<int>.Factory.FromAsync(
+                (targetBuffer, flags, endPoint, callback, state) => ((Socket)state).BeginSendTo(
+                                                                        targetBuffer.Array,
+                                                                        targetBuffer.Offset,
+                                                                        targetBuffer.Count,
+                                                                        flags,
+                                                                        endPoint,
+                                                                        callback,
+                                                                        state),
+                asyncResult => ((Socket)asyncResult.AsyncState).EndSendTo(asyncResult),
+                buffer,
+                socketFlags,
+                remoteEP,
+                state: socket);
+        }
+    }
+}
+
+#endif
diff --git a/mcs/class/System/System.Net.Sockets/TcpClient.cs b/mcs/class/System/System.Net.Sockets/TcpClient.cs
deleted file mode 100644 (file)
index bbdb034..0000000
+++ /dev/null
@@ -1,450 +0,0 @@
-// TcpClient.cs
-//
-// Author:
-//     Phillip Pearson (pp@myelin.co.nz)
-//     Gonzalo Paniagua Javier (gonzalo@novell.com)
-//     Sridhar Kulkarni (sridharkulkarni@gmail.com)
-//     Marek Safar (marek.safar@gmail.com)
-//
-// Copyright (C) 2001, Phillip Pearson http://www.myelin.co.nz
-// Copyright (c) 2006 Novell, Inc. (http://www.novell.com)
-// Copyright 2011 Xamarin Inc.
-//
-
-//
-// 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.Net;
-using System.Threading.Tasks;
-
-namespace System.Net.Sockets
-{
-       public class TcpClient : IDisposable {
-               enum Properties : uint {
-                       LingerState = 1,
-                       NoDelay = 2,
-                       ReceiveBufferSize = 4,
-                       ReceiveTimeout = 8,
-                       SendBufferSize = 16,
-                       SendTimeout = 32
-               }
-
-               // private data
-               NetworkStream stream;
-               bool active;
-               Socket client;
-               bool disposed;
-               Properties values;
-               int recv_timeout, send_timeout;
-               int recv_buffer_size, send_buffer_size;
-               LingerOption linger_state;
-               bool no_delay;
-               
-               private void Init (AddressFamily family)
-               {
-                       active = false;
-
-                       if(client != null) {
-                               client.Close();
-                               client = null;
-                       }
-
-                       client = new Socket(family, SocketType.Stream, ProtocolType.Tcp);
-               }
-
-               public TcpClient ()
-               {
-                       Init(AddressFamily.InterNetwork);
-                       client.Bind(new IPEndPoint(IPAddress.Any, 0));
-               }
-
-               internal TcpClient (Socket s)
-               {
-                       client = s;
-               }
-       
-               public TcpClient (AddressFamily family)
-               {
-                       if (family != AddressFamily.InterNetwork &&
-                           family != AddressFamily.InterNetworkV6) {
-                               throw new ArgumentException ("Family must be InterNetwork or InterNetworkV6", "family");
-                       }
-                       
-                       Init (family);
-                       IPAddress any = IPAddress.Any;
-                       if (family == AddressFamily.InterNetworkV6)
-                               any = IPAddress.IPv6Any;
-                       client.Bind (new IPEndPoint (any, 0));
-               }
-
-               public TcpClient (IPEndPoint localEP)
-               {
-                       Init (localEP.AddressFamily);
-                       client.Bind (localEP);
-               }
-               
-               public TcpClient (string hostname, int port)
-               {
-                       Connect(hostname, port);
-               }
-                               
-               protected bool Active {
-                       get { return active; }
-                       set { active = value; }
-               }
-               
-               public Socket Client {
-                       get { return client; }
-                       set {
-                               client = value;
-                               stream = null;
-                       }
-               }
-
-               public int Available {
-                       get { return client.Available; }
-               }
-
-               public bool Connected {
-                       get { return client.Connected; }
-               }
-
-               public bool ExclusiveAddressUse {
-                       get {
-                               return(client.ExclusiveAddressUse);
-                       }
-                       set {
-                               client.ExclusiveAddressUse = value;
-                       }
-               }
-
-               public LingerOption LingerState {
-                       get {
-                               if ((values & Properties.LingerState) != 0)
-                                       return linger_state;
-
-                               return (LingerOption) client.GetSocketOption (SocketOptionLevel.Socket,
-                                                                       SocketOptionName.Linger);
-                       }
-                       set {
-                               if (!client.Connected) {
-                                       linger_state = value;
-                                       values |= Properties.LingerState;
-                                       return;
-                               }
-                               client.SetSocketOption(
-                                       SocketOptionLevel.Socket,
-                                       SocketOptionName.Linger, value);
-                       }
-               }
-                               
-               public bool NoDelay {
-                       get {
-                               if ((values & Properties.NoDelay) != 0)
-                                       return no_delay;
-
-                               return (bool)client.GetSocketOption(
-                                       SocketOptionLevel.Tcp,
-                                       SocketOptionName.NoDelay);
-                       }
-                       set {
-                               if (!client.Connected) {
-                                       no_delay = value;
-                                       values |= Properties.NoDelay;
-                                       return;
-                               }
-                               client.SetSocketOption(
-                                       SocketOptionLevel.Tcp,
-                                       SocketOptionName.NoDelay, value ? 1 : 0);
-                       }
-               }
-                               
-               public int ReceiveBufferSize {
-                       get {
-                               if ((values & Properties.ReceiveBufferSize) != 0)
-                                       return recv_buffer_size;
-
-                               return (int)client.GetSocketOption(
-                                       SocketOptionLevel.Socket,
-                                       SocketOptionName.ReceiveBuffer);
-                       }
-                       set {
-                               if (!client.Connected) {
-                                       recv_buffer_size = value;
-                                       values |= Properties.ReceiveBufferSize;
-                                       return;
-                               }
-                               client.SetSocketOption(
-                                       SocketOptionLevel.Socket,
-                                       SocketOptionName.ReceiveBuffer, value);
-                       }
-               }
-                       
-               public int ReceiveTimeout {
-                       get {
-                               if ((values & Properties.ReceiveTimeout) != 0)
-                                       return recv_timeout;
-
-                               return (int)client.GetSocketOption(
-                                       SocketOptionLevel.Socket,
-                                       SocketOptionName.ReceiveTimeout);
-                       }
-                       set {
-                               if (!client.Connected) {
-                                       recv_timeout = value;
-                                       values |= Properties.ReceiveTimeout;
-                                       return;
-                               }
-                               client.SetSocketOption(
-                                       SocketOptionLevel.Socket,
-                                       SocketOptionName.ReceiveTimeout, value);
-                       }
-               }
-               
-               public int SendBufferSize {
-                       get {
-                               if ((values & Properties.SendBufferSize) != 0)
-                                       return send_buffer_size;
-
-                               return (int)client.GetSocketOption(
-                                       SocketOptionLevel.Socket,
-                                       SocketOptionName.SendBuffer);
-                       }
-                       set {
-                               if (!client.Connected) {
-                                       send_buffer_size = value;
-                                       values |= Properties.SendBufferSize;
-                                       return;
-                               }
-                               client.SetSocketOption(
-                                       SocketOptionLevel.Socket,
-                                       SocketOptionName.SendBuffer, value);
-                       }
-               }
-               
-               public int SendTimeout {
-                       get {
-                               if ((values & Properties.SendTimeout) != 0)
-                                       return send_timeout;
-
-                               return (int)client.GetSocketOption(
-                                       SocketOptionLevel.Socket,
-                                       SocketOptionName.SendTimeout);
-                       }
-                       set {
-                               if (!client.Connected) {
-                                       send_timeout = value;
-                                       values |= Properties.SendTimeout;
-                                       return;
-                               }
-                               client.SetSocketOption(
-                                       SocketOptionLevel.Socket,
-                                       SocketOptionName.SendTimeout, value);
-                       }
-               }
-               
-               
-               // methods
-               
-               public void Close ()
-               {
-                       Dispose ();
-               }
-
-               public void Connect (IPEndPoint remoteEP)
-               {
-                       try {
-                               client.Connect (remoteEP);
-                               active = true;
-                       } finally {
-                               CheckDisposed ();
-                       }
-               }
-               
-               public void Connect (IPAddress address, int port)
-               {
-                       Connect(new IPEndPoint(address, port));
-               }
-
-               void SetOptions ()
-               {
-                       Properties props = values;
-                       values = 0;
-
-                       if ((props & Properties.LingerState) != 0)
-                               LingerState = linger_state;
-                       if ((props & Properties.NoDelay) != 0)
-                               NoDelay = no_delay;
-                       if ((props & Properties.ReceiveBufferSize) != 0)
-                               ReceiveBufferSize = recv_buffer_size;
-                       if ((props & Properties.ReceiveTimeout) != 0)
-                               ReceiveTimeout = recv_timeout;
-                       if ((props & Properties.SendBufferSize) != 0)
-                               SendBufferSize = send_buffer_size;
-                       if ((props & Properties.SendTimeout) != 0)
-                               SendTimeout = send_timeout;
-               }
-
-               public void Connect (string hostname, int port)
-               {
-                       IPAddress [] addresses = Dns.GetHostAddresses (hostname);
-                       Connect (addresses, port);
-               }
-
-               public void Connect (IPAddress[] ipAddresses, int port)
-               {
-                       CheckDisposed ();
-                       
-                       if (ipAddresses == null) {
-                               throw new ArgumentNullException ("ipAddresses");
-                       }
-                       
-                       for(int i = 0; i < ipAddresses.Length; i++) {
-                               try {
-                                       IPAddress address = ipAddresses[i];
-
-                                       if (address.Equals (IPAddress.Any) ||
-                                           address.Equals (IPAddress.IPv6Any)) {
-                                               throw new SocketException ((int)SocketError.AddressNotAvailable);
-                                       }
-
-                                       Init (address.AddressFamily);
-                                       
-                                       if (address.AddressFamily == AddressFamily.InterNetwork) {
-                                               client.Bind (new IPEndPoint (IPAddress.Any, 0));
-                                       } else if (address.AddressFamily == AddressFamily.InterNetworkV6) {
-                                               client.Bind (new IPEndPoint (IPAddress.IPv6Any, 0));
-                                       } else {
-                                               throw new NotSupportedException ("This method is only valid for sockets in the InterNetwork and InterNetworkV6 families");
-                                       }
-
-                                       Connect (new IPEndPoint (address, port));
-                                       
-                                       if (values != 0) {
-                                               SetOptions ();
-                                       }
-                                       
-                                       break;
-                               } catch (Exception e) {
-                                       /* Reinitialise the socket so
-                                        * other properties still work
-                                        * (see no-arg constructor)
-                                        */
-                                       Init (AddressFamily.InterNetwork);
-
-                                       /* This is the last known
-                                        * address, so re-throw the
-                                        * exception
-                                        */
-                                       if (i == ipAddresses.Length - 1) {
-                                               throw e;
-                                       }
-                               }
-                       }
-               }
-               
-               public void EndConnect (IAsyncResult asyncResult)
-               {
-                       client.EndConnect (asyncResult);
-               }
-               
-               public IAsyncResult BeginConnect (IPAddress address, int port, AsyncCallback requestCallback, object state)
-               {
-                       return client.BeginConnect (address, port, requestCallback, state);
-               }
-               
-               public IAsyncResult BeginConnect (IPAddress[] addresses, int port, AsyncCallback requestCallback, object state)
-               {
-                       return client.BeginConnect (addresses, port, requestCallback, state);
-               }
-               
-               public IAsyncResult BeginConnect (string host, int port, AsyncCallback requestCallback, object state)
-               {
-                       return client.BeginConnect (host, port, requestCallback, state);
-               }
-               
-               public void Dispose ()
-               {
-                       Dispose (true);
-                       GC.SuppressFinalize (this);
-               }
-
-               protected virtual void Dispose (bool disposing)
-               {
-                       if (disposed)
-                               return;
-                       disposed = true;
-
-                       if (disposing) {
-                               // release managed resources
-                               NetworkStream s = stream;
-                               stream = null;
-                               if (s != null) {
-                                       // This closes the socket as well, as the NetworkStream
-                                       // owns the socket.
-                                       s.Close();
-                                       active = false;
-                                       s = null;
-                               } else if (client != null){
-                                       client.Close ();
-                                       client = null;
-                               }
-                       }
-               }
-               
-               ~TcpClient ()
-               {
-                       Dispose (false);
-               }
-               
-               public NetworkStream GetStream()
-               {
-                       try {
-                               if (stream == null)
-                                       stream = new NetworkStream (client, true);
-                               return stream;
-                       }
-                       finally { CheckDisposed (); }
-               }
-
-               public Task ConnectAsync (IPAddress address, int port)
-               {
-                       return Task.Factory.FromAsync (BeginConnect, EndConnect, address, port, null);
-               }
-
-               public Task ConnectAsync (IPAddress[] addresses, int port)
-               {
-                       return Task.Factory.FromAsync (BeginConnect, EndConnect, addresses, port, null);
-               }
-
-               public Task ConnectAsync (string host, int port)
-               {
-                       return Task.Factory.FromAsync (BeginConnect, EndConnect, host, port, null);
-               }
-               private void CheckDisposed ()
-               {
-                       if (disposed)
-                               throw new ObjectDisposedException (GetType().FullName);
-               }
-       }
-}
-
diff --git a/mcs/class/System/System.Net.Sockets/TcpClient.platformnotsupported.cs b/mcs/class/System/System.Net.Sockets/TcpClient.platformnotsupported.cs
new file mode 100644 (file)
index 0000000..dd69a39
--- /dev/null
@@ -0,0 +1,191 @@
+//
+// System.Net.Sockets.TcpClient.cs
+//
+// Author:
+//     Rolf Bjarne Kvinge <rolf@xamarin.com>
+//
+// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com)
+//
+// 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.Net;
+using System.Threading.Tasks;
+
+namespace System.Net.Sockets
+{
+       public class TcpClient : IDisposable
+       {
+               const string EXCEPTION_MESSAGE = "System.Net.Sockets.TcpClient is not supported on the current platform.";
+
+               public TcpClient ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public TcpClient (AddressFamily family)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public TcpClient (IPEndPoint localEP)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public TcpClient (string hostname, int port)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               protected bool Active {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public Socket Client {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public int Available {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public bool Connected {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public bool ExclusiveAddressUse {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public LingerOption LingerState {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public bool NoDelay {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public int ReceiveBufferSize {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public int ReceiveTimeout {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public int SendBufferSize {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public int SendTimeout {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public void Close ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public void Connect (IPEndPoint remoteEP)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public void Connect (IPAddress address, int port)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public void Connect (string hostname, int port)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public void Connect (IPAddress[] ipAddresses, int port)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public void EndConnect (IAsyncResult asyncResult)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public IAsyncResult BeginConnect (IPAddress address, int port, AsyncCallback requestCallback, object state)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public IAsyncResult BeginConnect (IPAddress[] addresses, int port, AsyncCallback requestCallback, object state)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public IAsyncResult BeginConnect (string host, int port, AsyncCallback requestCallback, object state)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public void Dispose ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               protected virtual void Dispose (bool disposing)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               ~TcpClient ()
+               {
+               }
+
+               public NetworkStream GetStream()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public Task ConnectAsync (IPAddress address, int port)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public Task ConnectAsync (IPAddress[] addresses, int port)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public Task ConnectAsync (string host, int port)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+       }
+}
diff --git a/mcs/class/System/System.Net.Sockets/TcpListener.cs b/mcs/class/System/System.Net.Sockets/TcpListener.cs
deleted file mode 100644 (file)
index 8ab582e..0000000
+++ /dev/null
@@ -1,313 +0,0 @@
-// TcpListener.cs
-//
-// Authors:
-//    Phillip Pearson (pp@myelin.co.nz)
-//    Gonzalo Paniagua Javier (gonzalo@ximian.com)
-//       Patrik Torstensson
-//    Sridhar Kulkarni (sridharkulkarni@gmail.com)
-//    Marek Safar (marek.safar@gmail.com)
-
-//
-// Copyright (C) 2001, Phillip Pearson http://www.myelin.co.nz
-//
-// (c) 2003 Ximian, Inc. (http://www.ximian.com)
-// (c) 2004-2006 Novell, Inc.
-// Copyright 2011 Xamarin Inc.
-//
-
-//
-// 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.Net;
-using System.Threading.Tasks;
-
-namespace System.Net.Sockets
-{
-       /// <remarks>
-       /// A slightly more abstracted way to listen for incoming
-       /// network connections than a Socket.
-       /// </remarks>
-       public class TcpListener
-       {
-               // private data
-               
-               bool active;
-               Socket server;
-               EndPoint savedEP;
-               
-               // constructor
-
-               /// <summary>
-               /// Some code that is shared between the constructors.
-               /// </summary>
-               private void Init (AddressFamily family, EndPoint ep)
-               {
-                       active = false;
-                       server = new Socket(family, SocketType.Stream, ProtocolType.Tcp);
-                       savedEP = ep;
-               }
-               
-               /// <summary>
-               /// Constructs a new TcpListener to listen on a specified port
-               /// </summary>
-               /// <param name="port">The port to listen on, e.g. 80 if you 
-               /// are a web server</param>
-               [Obsolete ("Use TcpListener (IPAddress address, int port) instead")]
-               public TcpListener (int port)
-               {
-                       if (port < 0 || port > 65535)
-                               throw new ArgumentOutOfRangeException ("port");
-
-                       Init (AddressFamily.InterNetwork, new IPEndPoint (IPAddress.Any, port));
-               }
-
-               /// <summary>
-               /// Constructs a new TcpListener with a specified local endpoint
-               /// </summary>
-               /// <param name="local_end_point">The endpoint</param>
-               public TcpListener (IPEndPoint localEP)
-               {
-                       if (localEP == null)
-                               throw new ArgumentNullException ("localEP");
-
-                       Init (localEP.AddressFamily, localEP);
-               }
-               
-               /// <summary>
-               /// Constructs a new TcpListener, listening on a specified port
-               /// and IP (for use on a multi-homed machine)
-               /// </summary>
-               /// <param name="listen_ip">The IP to listen on</param>
-               /// <param name="port">The port to listen on</param>
-               public TcpListener (IPAddress localaddr, int port)
-               {
-                       if (localaddr == null)
-                               throw new ArgumentNullException ("localaddr");
-
-                       if (port < 0 || port > 65535)
-                               throw new ArgumentOutOfRangeException ("port");
-
-                       Init (localaddr.AddressFamily, new IPEndPoint (localaddr, port));
-               }
-
-
-               // properties
-
-               /// <summary>
-               /// A flag that is 'true' if the TcpListener is listening,
-               /// or 'false' if it is not listening
-               /// </summary>
-               protected bool Active
-               {
-                       get { return active; }
-               }
-
-               /// <summary>
-               /// The local end point
-               /// </summary>
-               public EndPoint LocalEndpoint
-               {
-                       get { 
-                               if (active)
-                                       return server.LocalEndPoint;
-
-                               return savedEP; 
-                       }
-               }
-               
-               /// <summary>
-               /// The listening socket
-               /// </summary>
-               public Socket Server
-               {
-                       get { return server; }
-               }
-
-               /// <summary>
-               /// Specifies whether the TcpListener allows only one
-               /// underlying socket to listen to a specific port
-               /// </summary>
-               public bool ExclusiveAddressUse
-               {
-                       get {
-                               if (server == null) {
-                                       throw new ObjectDisposedException (GetType ().ToString ());
-                               }
-                               if (active) {
-                                       throw new InvalidOperationException ("The TcpListener has been started");
-                               }
-
-                               return(server.ExclusiveAddressUse);
-                       }
-                       set {
-                               if (server == null) {
-                                       throw new ObjectDisposedException (GetType ().ToString ());
-                               }
-                               if (active) {
-                                       throw new InvalidOperationException ("The TcpListener has been started");
-                               }
-
-                               server.ExclusiveAddressUse = value;
-                       }
-               }
-               
-               // methods
-
-               /// <summary>
-               /// Accepts a pending connection
-               /// </summary>
-               /// <returns>A Socket object for the new connection</returns>
-               public Socket AcceptSocket ()
-               {
-                       if (!active)
-                               throw new InvalidOperationException ("Socket is not listening");
-
-                       return server.Accept();
-               }
-               
-               /// <summary>
-               /// Accepts a pending connection
-               /// </summary>
-               /// <returns>A TcpClient
-               /// object made from the new socket.</returns>
-               public TcpClient AcceptTcpClient ()
-               {
-                       if (!active)
-                               throw new InvalidOperationException ("Socket is not listening");
-
-                       Socket clientSocket = server.Accept ();
-
-                       TcpClient client = new TcpClient(clientSocket);
-                       
-                       return client;
-               }
-               
-               /// <summary>
-               /// Destructor - stops the listener listening
-               /// </summary>
-               ~TcpListener ()
-               {
-                       if (active)
-                               Stop();
-               }
-       
-               /// <returns>
-               /// Returns 'true' if there is a connection waiting to be accepted
-               /// with AcceptSocket() or AcceptTcpClient().
-               /// </returns>
-               public bool Pending ()
-               {
-                       if (!active)
-                               throw new InvalidOperationException ("Socket is not listening");
-
-                       return server.Poll(0, SelectMode.SelectRead);
-               }
-               
-               /// <summary>
-               /// Tells the TcpListener to start listening.
-               /// </summary>
-               public void Start ()
-               {
-                       // MS: sets Listen to Int32.MaxValue
-                       this.Start (5);
-                       // According to the man page some BSD and BSD-derived
-                       // systems limit the backlog to 5.  This should really be
-                       // configurable though
-               }
-
-               /// <summary>
-               /// Tells the TcpListener to start listening for max number
-               /// of pending connections.
-               /// </summary>
-
-               public void Start (int backlog)
-               {
-                       if (active) {
-                               return;
-                       }
-                       if (server == null) {
-                               throw new InvalidOperationException ("Invalid server socket");
-                       }
-                       
-                       server.Bind (savedEP);
-                       server.Listen (backlog);
-                       active = true;
-               }
-
-               public IAsyncResult BeginAcceptSocket (AsyncCallback callback,
-                                                      object state)
-               {
-                       if (server == null) {
-                               throw new ObjectDisposedException (GetType ().ToString ());
-                       }
-                       
-                       return(server.BeginAccept (callback, state));
-               }
-               
-               public IAsyncResult BeginAcceptTcpClient (AsyncCallback callback, object state)
-               {
-                       if (server == null) {
-                               throw new ObjectDisposedException (GetType ().ToString ());
-                       }
-                       
-                       return(server.BeginAccept (callback, state));
-               }
-               
-               public Socket EndAcceptSocket (IAsyncResult asyncResult) 
-               {
-                       return(server.EndAccept (asyncResult));
-               }
-               
-               public TcpClient EndAcceptTcpClient (IAsyncResult asyncResult)
-               {
-                       Socket clientSocket = server.EndAccept (asyncResult);
-                       TcpClient client = new TcpClient (clientSocket);
-                       
-                       return(client);
-               }
-               
-               /// <summary>
-               /// Tells the TcpListener to stop listening and dispose
-               /// of all managed resources.
-               /// </summary>
-               public void Stop ()
-               {
-                       if (active) 
-                       {
-                               server.Close ();
-                               server = null;
-                       }
-
-                       Init (AddressFamily.InterNetwork, savedEP);
-               }
-
-               public Task<Socket> AcceptSocketAsync ()
-               {
-                       return Task<Socket>.Factory.FromAsync (BeginAcceptSocket, EndAcceptSocket, null);
-               }
-
-               public Task<TcpClient> AcceptTcpClientAsync ()
-               {
-                       return Task<TcpClient>.Factory.FromAsync (BeginAcceptTcpClient, EndAcceptTcpClient, null);
-               }
-       }
-}
diff --git a/mcs/class/System/System.Net.Sockets/TcpListener.platformnotsupported.cs b/mcs/class/System/System.Net.Sockets/TcpListener.platformnotsupported.cs
new file mode 100644 (file)
index 0000000..76941fc
--- /dev/null
@@ -0,0 +1,145 @@
+//
+// System.Net.Sockets.TcpListener.cs
+//
+// Author:
+//     Rolf Bjarne Kvinge <rolf@xamarin.com>
+//
+// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com)
+//
+// 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.Net;
+using System.Threading.Tasks;
+
+namespace System.Net.Sockets
+{
+       public class TcpListener
+       {
+               const string EXCEPTION_MESSAGE = "System.Net.Sockets.TcpListener is not supported on the current platform.";
+
+               public TcpListener (int port)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public TcpListener (IPEndPoint localEP)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public TcpListener (IPAddress localaddr, int port)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               protected bool Active {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public EndPoint LocalEndpoint {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public Socket Server {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public bool ExclusiveAddressUse {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public Socket AcceptSocket ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public TcpClient AcceptTcpClient ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public void AllowNatTraversal (bool allowed)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public static TcpListener Create (int port)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               ~TcpListener ()
+               {
+               }
+
+               public bool Pending ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public void Start ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public void Start (int backlog)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public IAsyncResult BeginAcceptSocket (AsyncCallback callback, object state)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public IAsyncResult BeginAcceptTcpClient (AsyncCallback callback, object state)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public Socket EndAcceptSocket (IAsyncResult asyncResult)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public TcpClient EndAcceptTcpClient (IAsyncResult asyncResult)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public void Stop ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public Task<Socket> AcceptSocketAsync ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public Task<TcpClient> AcceptTcpClientAsync ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+       }
+}
diff --git a/mcs/class/System/System.Net.Sockets/UdpClient.cs b/mcs/class/System/System.Net.Sockets/UdpClient.cs
deleted file mode 100644 (file)
index ad3c411..0000000
+++ /dev/null
@@ -1,634 +0,0 @@
-//
-// System.Net.Sockets.UdpClient.cs
-//
-// Author:
-//    Gonzalo Paniagua Javier <gonzalo@ximian.com>
-//    Sridhar Kulkarni (sridharkulkarni@gmail.com)
-//    Marek Safar (marek.safar@gmail.com)
-//
-// Copyright (C) Ximian, Inc. http://www.ximian.com
-// Copyright 2011 Xamarin Inc.
-//
-
-//
-// 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.Net;
-using System.Threading.Tasks;
-
-namespace System.Net.Sockets
-{
-       public class UdpClient : IDisposable
-       {
-               private bool disposed = false;
-               private bool active = false;
-               private Socket socket;
-               private AddressFamily family = AddressFamily.InterNetwork;
-               private byte[] recvbuffer;
-       
-               public UdpClient () : this(AddressFamily.InterNetwork)
-               {
-               }
-
-               public UdpClient(AddressFamily family)
-               {
-                       if(family != AddressFamily.InterNetwork && family != AddressFamily.InterNetworkV6)
-                               throw new ArgumentException ("Family must be InterNetwork or InterNetworkV6", "family");
-
-                       this.family = family;
-                       InitSocket (null);
-               }
-
-               public UdpClient (int port)
-               {
-                       if (port < IPEndPoint.MinPort || port > IPEndPoint.MaxPort)
-                               throw new ArgumentOutOfRangeException ("port");
-
-                       this.family = AddressFamily.InterNetwork;
-
-                       IPEndPoint localEP = new IPEndPoint (IPAddress.Any, port);
-                       InitSocket (localEP);
-               }
-
-               public UdpClient (IPEndPoint localEP)
-               {
-                       if (localEP == null)
-                               throw new ArgumentNullException ("localEP");
-
-                       this.family = localEP.AddressFamily;
-
-                       InitSocket (localEP);
-               }
-
-               public UdpClient (int port, AddressFamily family)
-               {
-                       if (family != AddressFamily.InterNetwork && family != AddressFamily.InterNetworkV6)
-                               throw new ArgumentException ("Family must be InterNetwork or InterNetworkV6", "family");
-
-                       if (port < IPEndPoint.MinPort ||
-                           port > IPEndPoint.MaxPort) {
-                               throw new ArgumentOutOfRangeException ("port");
-                       }
-
-                       this.family = family;
-
-                       IPEndPoint localEP;
-
-                       if (family == AddressFamily.InterNetwork)
-                               localEP = new IPEndPoint (IPAddress.Any, port);
-                       else
-                               localEP = new IPEndPoint (IPAddress.IPv6Any, port);
-                       InitSocket (localEP);
-               }
-
-               public UdpClient (string hostname, int port)
-               {
-                       if (hostname == null)
-                               throw new ArgumentNullException ("hostname");
-
-                       if (port < IPEndPoint.MinPort || port > IPEndPoint.MaxPort)
-                               throw new ArgumentOutOfRangeException ("port");
-
-                       InitSocket (null);
-                       Connect (hostname, port);
-               }
-
-               private void InitSocket (EndPoint localEP)
-               {
-                       if(socket != null) {
-                               socket.Close();
-                               socket = null;
-                       }
-
-                       socket = new Socket (family, SocketType.Dgram, ProtocolType.Udp);
-
-                       if (localEP != null)
-                               socket.Bind (localEP);
-               }
-
-               public void Close ()
-               {
-                       Dispose ();
-               }
-#region Connect
-
-               void DoConnect (IPEndPoint endPoint)
-               {
-                       /* Catch EACCES and turn on SO_BROADCAST then,
-                        * as UDP sockets don't have it set by default
-                        */
-                       try {
-                               socket.Connect (endPoint);
-                       } catch (SocketException ex) {
-                               if (ex.ErrorCode == (int)SocketError.AccessDenied) {
-                                       socket.SetSocketOption (SocketOptionLevel.Socket, SocketOptionName.Broadcast, 1);
-                                       
-                                       socket.Connect (endPoint);
-                               } else {
-                                       throw;
-                               }
-                       }
-               }
-               
-               public void Connect (IPEndPoint endPoint)
-               {
-                       CheckDisposed ();
-                       if (endPoint == null)
-                               throw new ArgumentNullException ("endPoint");
-
-                       DoConnect (endPoint);
-                       active = true;
-               }
-
-               public void Connect (IPAddress addr, int port)
-               {
-                       if (addr == null)
-                               throw new ArgumentNullException ("addr");
-
-                       if (port < IPEndPoint.MinPort || port > IPEndPoint.MaxPort)
-                               throw new ArgumentOutOfRangeException ("port");
-
-
-                       Connect (new IPEndPoint (addr, port));
-               }
-
-               public void Connect (string hostname, int port)
-               {
-                       if (port < IPEndPoint.MinPort || port > IPEndPoint.MaxPort)
-                               throw new ArgumentOutOfRangeException ("port");
-
-                       IPAddress[] addresses = Dns.GetHostAddresses (hostname);
-                       for(int i=0; i<addresses.Length; i++) {
-                               try {
-                                       this.family = addresses[i].AddressFamily;
-                                       Connect (new IPEndPoint (addresses[i], port));
-                                       break;
-                               } catch(Exception e) {
-                                       if(i == addresses.Length - 1){
-                                               if(socket != null) {
-                                                       socket.Close();
-                                                       socket = null;
-                                               }
-                                               /// This is the last entry, re-throw the exception
-                                               throw e;
-                                       }
-                               }
-                       }
-               }
-#endregion
-               #region Multicast methods
-               public void DropMulticastGroup (IPAddress multicastAddr)
-               {
-                       CheckDisposed ();
-                       if (multicastAddr == null)
-                               throw new ArgumentNullException ("multicastAddr");
-
-                       if(family == AddressFamily.InterNetwork)
-                               socket.SetSocketOption (SocketOptionLevel.IP, SocketOptionName.DropMembership,
-                                       new MulticastOption (multicastAddr));
-                       else
-                               socket.SetSocketOption (SocketOptionLevel.IPv6, SocketOptionName.DropMembership,
-                                       new IPv6MulticastOption (multicastAddr));
-               }
-
-               public void DropMulticastGroup (IPAddress multicastAddr,
-                                               int ifindex)
-               {
-                       CheckDisposed ();
-
-                       /* LAMESPEC: exceptions haven't been specified
-                        * for this overload.
-                        */
-                       if (multicastAddr == null) {
-                               throw new ArgumentNullException ("multicastAddr");
-                       }
-
-                       /* Does this overload only apply to IPv6?
-                        * Only the IPv6MulticastOption has an
-                        * ifindex-using constructor.  The MS docs
-                        * don't say.
-                        */
-                       if (family == AddressFamily.InterNetworkV6) {
-                               socket.SetSocketOption (SocketOptionLevel.IPv6, SocketOptionName.DropMembership, new IPv6MulticastOption (multicastAddr, ifindex));
-                       }
-               }
-               
-               public void JoinMulticastGroup (IPAddress multicastAddr)
-               {
-                       CheckDisposed ();
-
-                       if (multicastAddr == null)
-                               throw new ArgumentNullException ("multicastAddr");
-
-                       if(family == AddressFamily.InterNetwork)
-                               socket.SetSocketOption (SocketOptionLevel.IP, SocketOptionName.AddMembership,
-                                       new MulticastOption (multicastAddr));
-                       else
-                               socket.SetSocketOption (SocketOptionLevel.IPv6, SocketOptionName.AddMembership,
-                                       new IPv6MulticastOption (multicastAddr));
-               }
-
-               public void JoinMulticastGroup (int ifindex,
-                                               IPAddress multicastAddr)
-               {
-                       CheckDisposed ();
-
-                       if (multicastAddr == null)
-                               throw new ArgumentNullException ("multicastAddr");
-
-                       if (family == AddressFamily.InterNetworkV6)
-                               socket.SetSocketOption (SocketOptionLevel.IPv6, SocketOptionName.AddMembership, new IPv6MulticastOption (multicastAddr, ifindex));
-                       else
-                               throw new SocketException ((int) SocketError.OperationNotSupported);
-               }
-
-               public void JoinMulticastGroup (IPAddress multicastAddr, int timeToLive)
-               {
-                       CheckDisposed ();
-                       if (multicastAddr == null)
-                               throw new ArgumentNullException ("multicastAddr");
-                       if (timeToLive < 0 || timeToLive > 255)
-                               throw new ArgumentOutOfRangeException ("timeToLive");
-
-                       JoinMulticastGroup (multicastAddr);
-                       if(family == AddressFamily.InterNetwork)
-                               socket.SetSocketOption (SocketOptionLevel.IP, SocketOptionName.MulticastTimeToLive,
-                                       timeToLive);
-                       else
-                               socket.SetSocketOption (SocketOptionLevel.IPv6, SocketOptionName.MulticastTimeToLive,
-                                       timeToLive);
-               }
-
-               public void JoinMulticastGroup (IPAddress multicastAddr,
-                                               IPAddress localAddress)
-               {
-                       CheckDisposed ();
-
-                       if (family == AddressFamily.InterNetwork)
-                               socket.SetSocketOption (SocketOptionLevel.IP, SocketOptionName.AddMembership, new MulticastOption (multicastAddr, localAddress));
-                       else
-                               throw new SocketException ((int) SocketError.OperationNotSupported);
-               }
-
-               #endregion
-               #region Data I/O
-               public byte [] Receive (ref IPEndPoint remoteEP)
-               {
-                       CheckDisposed ();
-
-                       byte [] recBuffer = new byte [65536]; // Max. size
-                       EndPoint endPoint = (EndPoint) remoteEP;
-                       int dataRead = socket.ReceiveFrom (recBuffer, ref endPoint);
-                       if (dataRead < recBuffer.Length)
-                               recBuffer = CutArray (recBuffer, dataRead);
-
-                       remoteEP = (IPEndPoint) endPoint;
-                       return recBuffer;
-               }
-
-               int DoSend (byte[] dgram, int bytes, IPEndPoint endPoint)
-               {
-                       /* Catch EACCES and turn on SO_BROADCAST then,
-                        * as UDP sockets don't have it set by default
-                        */
-                       try {
-                               if (endPoint == null) {
-                                       return(socket.Send (dgram, 0, bytes,
-                                                           SocketFlags.None));
-                               } else {
-                                       return(socket.SendTo (dgram, 0, bytes,
-                                                             SocketFlags.None,
-                                                             endPoint));
-                               }
-                       } catch (SocketException ex) {
-                               if (ex.ErrorCode == (int)SocketError.AccessDenied) {
-                                       socket.SetSocketOption (SocketOptionLevel.Socket, SocketOptionName.Broadcast, 1);
-                                       if (endPoint == null) {
-                                               return(socket.Send (dgram, 0, bytes, SocketFlags.None));
-                                       } else {
-                                               return(socket.SendTo (dgram, 0, bytes, SocketFlags.None, endPoint));
-                                       }
-                               } else {
-                                       throw;
-                               }
-                       }
-               }
-               
-               public int Send (byte [] dgram, int bytes)
-               {
-                       CheckDisposed ();
-                       if (dgram == null)
-                               throw new ArgumentNullException ("dgram");
-
-                       if (!active)
-                               throw new InvalidOperationException ("Operation not allowed on " + 
-                                                                    "non-connected sockets.");
-
-                       return(DoSend (dgram, bytes, null));
-               }
-
-               public int Send (byte [] dgram, int bytes, IPEndPoint endPoint)
-               {
-                       CheckDisposed ();
-                       if (dgram == null)
-                               throw new ArgumentNullException ("dgram is null");
-                       
-                       if (active) {
-                               if (endPoint != null)
-                                       throw new InvalidOperationException ("Cannot send packets to an " +
-                                                                            "arbitrary host while connected.");
-
-                               return(DoSend (dgram, bytes, null));
-                       }
-
-                       return(DoSend (dgram, bytes, endPoint));
-               }
-
-               public int Send (byte [] dgram, int bytes, string hostname, int port)
-               {
-                       return Send (dgram, bytes, 
-                                    new IPEndPoint (Dns.GetHostAddresses (hostname) [0], port));
-               }
-
-               private byte [] CutArray (byte [] orig, int length)
-               {
-                       byte [] newArray = new byte [length];
-                       Buffer.BlockCopy (orig, 0, newArray, 0, length);
-
-                       return newArray;
-               }
-#endregion
-
-               IAsyncResult DoBeginSend (byte[] datagram, int bytes,
-                                         IPEndPoint endPoint,
-                                         AsyncCallback requestCallback,
-                                         object state)
-               {
-                       /* Catch EACCES and turn on SO_BROADCAST then,
-                        * as UDP sockets don't have it set by default
-                        */
-                       try {
-                               if (endPoint == null) {
-                                       return(socket.BeginSend (datagram, 0, bytes, SocketFlags.None, requestCallback, state));
-                               } else {
-                                       return(socket.BeginSendTo (datagram, 0, bytes, SocketFlags.None, endPoint, requestCallback, state));
-                               }
-                       } catch (SocketException ex) {
-                               if (ex.ErrorCode == (int)SocketError.AccessDenied) {
-                                       socket.SetSocketOption (SocketOptionLevel.Socket, SocketOptionName.Broadcast, 1);
-                                       if (endPoint == null) {
-                                               return(socket.BeginSend (datagram, 0, bytes, SocketFlags.None, requestCallback, state));
-                                       } else {
-                                               return(socket.BeginSendTo (datagram, 0, bytes, SocketFlags.None, endPoint, requestCallback, state));
-                                       }
-                               } else {
-                                       throw;
-                               }
-                       }
-               }
-               
-               public IAsyncResult BeginSend (byte[] datagram, int bytes,
-                                              AsyncCallback requestCallback,
-                                              object state)
-               {
-                       return(BeginSend (datagram, bytes, null,
-                                         requestCallback, state));
-               }
-               
-               public IAsyncResult BeginSend (byte[] datagram, int bytes,
-                                              IPEndPoint endPoint,
-                                              AsyncCallback requestCallback,
-                                              object state)
-               {
-                       CheckDisposed ();
-
-                       if (datagram == null) {
-                               throw new ArgumentNullException ("datagram");
-                       }
-                       
-                       return(DoBeginSend (datagram, bytes, endPoint,
-                                           requestCallback, state));
-               }
-               
-               public IAsyncResult BeginSend (byte[] datagram, int bytes,
-                                              string hostname, int port,
-                                              AsyncCallback requestCallback,
-                                              object state)
-               {
-                       return(BeginSend (datagram, bytes, new IPEndPoint (Dns.GetHostAddresses (hostname) [0], port), requestCallback, state));
-               }
-               
-               public int EndSend (IAsyncResult asyncResult)
-               {
-                       CheckDisposed ();
-                       
-                       if (asyncResult == null) {
-                               throw new ArgumentNullException ("asyncResult is a null reference");
-                       }
-                       
-                       return(socket.EndSend (asyncResult));
-               }
-
-               public IAsyncResult BeginReceive (AsyncCallback requestCallback, object state)
-               {
-                       CheckDisposed ();
-
-                       recvbuffer = new byte[8192];
-                       
-                       EndPoint ep;
-                       
-                       if (family == AddressFamily.InterNetwork) {
-                               ep = new IPEndPoint (IPAddress.Any, 0);
-                       } else {
-                               ep = new IPEndPoint (IPAddress.IPv6Any, 0);
-                       }
-                       
-                       return(socket.BeginReceiveFrom (recvbuffer, 0, 8192,
-                                                       SocketFlags.None,
-                                                       ref ep,
-                                                       requestCallback, state));
-               }
-               
-               public byte[] EndReceive (IAsyncResult asyncResult, ref IPEndPoint remoteEP)
-               {
-                       CheckDisposed ();
-                       
-                       if (asyncResult == null) {
-                               throw new ArgumentNullException ("asyncResult is a null reference");
-                       }
-                       
-                       EndPoint ep;
-                       
-                       if (family == AddressFamily.InterNetwork) {
-                               ep = new IPEndPoint (IPAddress.Any, 0);
-                       } else {
-                               ep = new IPEndPoint (IPAddress.IPv6Any, 0);
-                       }
-                       
-                       int bytes = socket.EndReceiveFrom (asyncResult,
-                                                          ref ep);
-                       remoteEP = (IPEndPoint)ep;
-
-                       /* Need to copy into a new array here, because
-                        * otherwise the returned array length is not
-                        * 'bytes'
-                        */
-                       byte[] buf = new byte[bytes];
-                       Array.Copy (recvbuffer, buf, bytes);
-                       
-                       return(buf);
-               }
-                               
-#region Properties
-               protected bool Active {
-                       get { return active; }
-                       set { active = value; }
-               }
-
-               public Socket Client {
-                       get { return socket; }
-                       set { socket = value; }
-               }
-
-               public int Available
-               {
-                       get {
-                               return(socket.Available);
-                       }
-               }
-               
-               public bool DontFragment
-               {
-                       get {
-                               return(socket.DontFragment);
-                       }
-                       set {
-                               socket.DontFragment = value;
-                       }
-               }
-
-               public bool EnableBroadcast
-               {
-                       get {
-                               return(socket.EnableBroadcast);
-                       }
-                       set {
-                               socket.EnableBroadcast = value;
-                       }
-               }
-               
-               public bool ExclusiveAddressUse
-               {
-                       get {
-                               return(socket.ExclusiveAddressUse);
-                       }
-                       set {
-                               socket.ExclusiveAddressUse = value;
-                       }
-               }
-               
-               public bool MulticastLoopback
-               {
-                       get {
-                               return(socket.MulticastLoopback);
-                       }
-                       set {
-                               socket.MulticastLoopback = value;
-                       }
-               }
-               
-               public short Ttl
-               {
-                       get {
-                               return(socket.Ttl);
-                       }
-                       set {
-                               socket.Ttl = value;
-                       }
-               }
-
-#endregion
-#region Disposing
-               public void Dispose ()
-               {
-                       Dispose (true);
-                       GC.SuppressFinalize (this);
-               }
-
-               protected virtual void Dispose (bool disposing)
-               {
-                       if (disposed)
-                               return;
-                       disposed = true;
-
-                       if (disposing){
-                               if (socket != null)
-                                       socket.Close ();
-
-                               socket = null;
-                       }
-               }
-               
-               ~UdpClient ()
-               {
-                       Dispose (false);
-               }
-               
-               private void CheckDisposed ()
-               {
-                       if (disposed)
-                               throw new ObjectDisposedException (GetType().FullName);
-               }               
-#endregion
-
-               
-               public Task<UdpReceiveResult> ReceiveAsync ()
-               {
-                       return Task<UdpReceiveResult>.Factory.FromAsync (BeginReceive, r => {
-                               IPEndPoint remoteEndPoint = null;
-                               return new UdpReceiveResult (EndReceive (r, ref remoteEndPoint), remoteEndPoint);
-                       }, null);
-               }
-
-               public Task<int> SendAsync (byte[] datagram, int bytes)
-               {
-                       return Task<int>.Factory.FromAsync (BeginSend, EndSend, datagram, bytes, null);
-               }
-
-               public Task<int> SendAsync (byte[] datagram, int bytes, IPEndPoint endPoint)
-               {
-                       return Task<int>.Factory.FromAsync (BeginSend, EndSend, datagram, bytes, endPoint, null);
-               }
-
-               public Task<int> SendAsync (byte[] datagram, int bytes, string hostname, int port)
-               {
-                       var t = Tuple.Create (datagram, bytes, hostname, port, this);
-
-                       return Task<int>.Factory.FromAsync ((callback, state) => {
-                               var d = (Tuple<byte[], int, string, int, UdpClient>) state;
-                               return d.Item5.BeginSend (d.Item1, d.Item2, d.Item3, d.Item4, callback, null);
-                       }, EndSend, t);
-               }
-       }
-}
-
diff --git a/mcs/class/System/System.Net.Sockets/UdpClient.platformnotsupported.cs b/mcs/class/System/System.Net.Sockets/UdpClient.platformnotsupported.cs
new file mode 100644 (file)
index 0000000..7a5e2dd
--- /dev/null
@@ -0,0 +1,246 @@
+//
+// System.Net.Sockets.UdpClient.cs
+//
+// Author:
+//     Rolf Bjarne Kvinge <rolf@xamarin.com>
+//
+// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com)
+//
+// 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.Threading.Tasks;
+
+namespace System.Net.Sockets
+{
+       public class UdpClient : IDisposable
+       {
+               const string EXCEPTION_MESSAGE = "System.Net.Sockets.UdpClient is not supported on the current platform.";
+
+               public UdpClient ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public UdpClient(AddressFamily family)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public UdpClient (int port)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public UdpClient (IPEndPoint localEP)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public UdpClient (int port, AddressFamily family)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public UdpClient (string hostname, int port)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public void Close ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public void Connect (IPEndPoint endPoint)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public void Connect (IPAddress addr, int port)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public void Connect (string hostname, int port)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public void DropMulticastGroup (IPAddress multicastAddr)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public void DropMulticastGroup (IPAddress multicastAddr, int ifindex)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public void JoinMulticastGroup (IPAddress multicastAddr)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public void JoinMulticastGroup (int ifindex, IPAddress multicastAddr)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public void JoinMulticastGroup (IPAddress multicastAddr, int timeToLive)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public void JoinMulticastGroup (IPAddress multicastAddr, IPAddress localAddress)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public byte [] Receive (ref IPEndPoint remoteEP)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public int Send (byte [] dgram, int bytes)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public int Send (byte [] dgram, int bytes, IPEndPoint endPoint)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public int Send (byte [] dgram, int bytes, string hostname, int port)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public IAsyncResult BeginSend (byte[] datagram, int bytes, AsyncCallback requestCallback, object state)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public IAsyncResult BeginSend (byte[] datagram, int bytes, IPEndPoint endPoint, AsyncCallback requestCallback, object state)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public IAsyncResult BeginSend (byte[] datagram, int bytes, string hostname, int port, AsyncCallback requestCallback, object state)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public int EndSend (IAsyncResult asyncResult)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public IAsyncResult BeginReceive (AsyncCallback requestCallback, object state)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public byte[] EndReceive (IAsyncResult asyncResult, ref IPEndPoint remoteEP)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               protected bool Active {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public Socket Client {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public int Available {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public bool DontFragment {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public bool EnableBroadcast {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public bool ExclusiveAddressUse {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public bool MulticastLoopback {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public short Ttl {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public void AllowNatTraversal (bool allowed)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public void Dispose ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               protected virtual void Dispose (bool disposing)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               ~UdpClient ()
+               {
+               }
+
+               public Task<UdpReceiveResult> ReceiveAsync ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public Task<int> SendAsync (byte[] datagram, int bytes)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public Task<int> SendAsync (byte[] datagram, int bytes, IPEndPoint endPoint)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public Task<int> SendAsync (byte[] datagram, int bytes, string hostname, int port)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+       }
+}
diff --git a/mcs/class/System/System.Net.WebSockets/ClientWebSocket.platformnotsupported.cs b/mcs/class/System/System.Net.WebSockets/ClientWebSocket.platformnotsupported.cs
new file mode 100644 (file)
index 0000000..324ae42
--- /dev/null
@@ -0,0 +1,98 @@
+//
+// ClientWebSocket.cs
+//
+// Author:
+//     Rolf Bjarne Kvinge <rolf@xamarin.com>
+//
+// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com)
+//
+// 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.Threading;
+using System.Threading.Tasks;
+
+namespace System.Net.WebSockets
+{
+       public class ClientWebSocket : WebSocket, IDisposable
+       {
+               const string EXCEPTION_MESSAGE = "System.Net.WebSockets.ClientWebSocket is not supported on the current platform.";
+
+               public ClientWebSocket ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override void Dispose ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override void Abort ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public ClientWebSocketOptions Options {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override WebSocketState State {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override WebSocketCloseStatus? CloseStatus {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override string CloseStatusDescription {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override string SubProtocol {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public Task ConnectAsync (Uri uri, CancellationToken cancellationToken)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override Task SendAsync (ArraySegment<byte> buffer, WebSocketMessageType messageType, bool endOfMessage, CancellationToken cancellationToken)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override Task<WebSocketReceiveResult> ReceiveAsync (ArraySegment<byte> buffer, CancellationToken cancellationToken)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override Task CloseAsync (WebSocketCloseStatus closeStatus, string statusDescription, CancellationToken cancellationToken)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override Task CloseOutputAsync (WebSocketCloseStatus closeStatus, string statusDescription, CancellationToken cancellationToken)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+       }
+}
index e987c5bd55f0c67461c3e0c6570d0b21efff6599..98200b45b4a01ad613756f7d16839f978ce1e08f 100644 (file)
@@ -51,7 +51,7 @@ namespace System.Net
                                        return;
                                
                                modules = new ArrayList ();
-#if NET_2_1
+#if MOBILE
                                modules.Add (new NtlmClient ());
                                modules.Add (new DigestClient ());
                                modules.Add (new BasicClient ());
@@ -106,6 +106,13 @@ namespace System.Net
                        }
                }
 
+               [MonoTODO]
+               internal static bool OSSupportsExtendedProtection {
+                       get {
+                               return false;
+                       }
+               }
+
                internal static void Clear ()
                {
                        EnsureModules ();
diff --git a/mcs/class/System/System.Net/AuthenticationManager.platformnotsupported.cs b/mcs/class/System/System.Net/AuthenticationManager.platformnotsupported.cs
new file mode 100644 (file)
index 0000000..1572ce7
--- /dev/null
@@ -0,0 +1,77 @@
+//
+// AuthenticationManager.cs
+//
+// Author:
+//       Rolf Bjarne Kvinge <rolf@xamarin.com>
+//
+// Copyright (c) 2016 Xamarin, Inc.
+//
+// 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.Collections;
+using System.Collections.Specialized;
+
+namespace System.Net
+{
+       public class AuthenticationManager {
+               const string EXCEPTION_MESSAGE = "System.Net.AuthenticationManager is not supported on the current platform.";
+
+               private AuthenticationManager ()
+               {
+               }
+
+               public static ICredentialPolicy CredentialPolicy {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public static StringDictionary CustomTargetNameDictionary {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public static IEnumerator RegisteredModules {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public static Authorization Authenticate (string challenge, WebRequest request, ICredentials credentials)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public static Authorization PreAuthenticate (WebRequest request, ICredentials credentials)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public static void Register (IAuthenticationModule authenticationModule)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public static void Unregister (IAuthenticationModule authenticationModule)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public static void Unregister (string authenticationScheme)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+       }
+}
index 9045052ccf7a35a917619dcc0ee4d1fdd6cb5aa8..dac834884441e8ccd8764f846dcea5289ebd073b 100644 (file)
@@ -130,6 +130,9 @@ namespace System.Net {
                [Obsolete ("Use BeginGetHostEntry instead")]
                public static IAsyncResult BeginGetHostByName (string hostName, AsyncCallback requestCallback, object stateObject)
                {
+#if FEATURE_NO_BSD_SOCKETS
+                       throw new PlatformNotSupportedException ("System.Net.Dns:BeginGetHostByName is not supported on this platform.");
+#else
                        if (hostName == null)
                                throw new ArgumentNullException ("hostName");
 
@@ -140,11 +143,15 @@ namespace System.Net {
 
                        GetHostByNameCallback c = new GetHostByNameCallback (GetHostByName);
                        return c.BeginInvoke (hostName, requestCallback, stateObject);
+#endif // FEATURE_NO_BSD_SOCKETS
                }
 
                [Obsolete ("Use BeginGetHostEntry instead")]
                public static IAsyncResult BeginResolve (string hostName, AsyncCallback requestCallback, object stateObject)
                {
+#if FEATURE_NO_BSD_SOCKETS
+                       throw new PlatformNotSupportedException ("System.Net.Dns:BeginResolve is not supported on this platform.");
+#else
                        if (hostName == null)
                                throw new ArgumentNullException ("hostName");
 
@@ -155,6 +162,7 @@ namespace System.Net {
 
                        ResolveCallback c = new ResolveCallback (Resolve);
                        return c.BeginInvoke (hostName, requestCallback, stateObject);
+#endif // FEATURE_NO_BSD_SOCKETS
                }
 
                public static IAsyncResult BeginGetHostAddresses (string hostNameOrAddress, AsyncCallback requestCallback, object state)
@@ -178,6 +186,9 @@ namespace System.Net {
 
                public static IAsyncResult BeginGetHostEntry (string hostNameOrAddress, AsyncCallback requestCallback, object stateObject)
                {
+#if FEATURE_NO_BSD_SOCKETS
+                       throw new PlatformNotSupportedException ("System.Net.Dns:GetHostEntry is not supported on this platform.");
+#else
                        if (hostNameOrAddress == null)
                                throw new ArgumentNullException ("hostName");
                        if (hostNameOrAddress == "0.0.0.0" || hostNameOrAddress == "::0")
@@ -193,10 +204,14 @@ namespace System.Net {
 
                        GetHostEntryNameCallback c = new GetHostEntryNameCallback (GetHostEntry);
                        return c.BeginInvoke (hostNameOrAddress, requestCallback, stateObject);
+#endif // FEATURE_NO_BSD_SOCKETS
                }
 
                public static IAsyncResult BeginGetHostEntry (IPAddress address, AsyncCallback requestCallback, object stateObject)
                {
+#if FEATURE_NO_BSD_SOCKETS
+                       throw new PlatformNotSupportedException ("System.Net.Dns:BeginGetHostEntry is not supported on this platform.");
+#else
                        if (address == null)
                                throw new ArgumentNullException ("address");
 
@@ -207,6 +222,7 @@ namespace System.Net {
 
                        GetHostEntryIPCallback c = new GetHostEntryIPCallback (GetHostEntry);
                        return c.BeginInvoke (address, requestCallback, stateObject);
+#endif // FEATURE_NO_BSD_SOCKETS
                }
 
                [Obsolete ("Use EndGetHostEntry instead")]
@@ -279,10 +295,10 @@ namespace System.Net {
 
 
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
-               private extern static bool GetHostByName_internal(string host, out string h_name, out string[] h_aliases, out string[] h_addr_list);
+               private extern static bool GetHostByName_internal(string host, out string h_name, out string[] h_aliases, out string[] h_addr_list, int hint);
 
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
-               private extern static bool GetHostByAddr_internal(string addr, out string h_name, out string[] h_aliases, out string[] h_addr_list);
+               private extern static bool GetHostByAddr_internal(string addr, out string h_name, out string[] h_aliases, out string[] h_addr_list, int hint);
 
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
                private extern static bool GetHostName_internal(out string h_name);
@@ -356,7 +372,7 @@ namespace System.Net {
 
                        string h_name;
                        string[] h_aliases, h_addrlist;
-                       bool ret = GetHostByAddr_internal(address, out h_name, out h_aliases, out h_addrlist);
+                       bool ret = GetHostByAddr_internal(address, out h_name, out h_aliases, out h_addrlist, Socket.FamilyHint);
                        if (!ret)
                                Error_11001 (address);
                        return (hostent_to_IPHostEntry (address, h_name, h_aliases, h_addrlist));
@@ -409,12 +425,16 @@ namespace System.Net {
                [Obsolete ("Use GetHostEntry instead")]
                public static IPHostEntry GetHostByName (string hostName)
                {
+#if FEATURE_NO_BSD_SOCKETS
+                       if (!string.IsNullOrEmpty (hostName))
+                               throw new PlatformNotSupportedException ("System.Net.Dns:GetHostByName is not supported on this platform.");
+#endif // FEATURE_NO_BSD_SOCKETS
                        if (hostName == null)
                                throw new ArgumentNullException ("hostName");
                        string h_name;
                        string[] h_aliases, h_addrlist;
 
-                       bool ret = GetHostByName_internal(hostName, out h_name, out h_aliases, out h_addrlist);
+                       bool ret = GetHostByName_internal(hostName, out h_name, out h_aliases, out h_addrlist, Socket.FamilyHint);
                        if (ret == false)
                                Error_11001 (hostName);
 
@@ -436,6 +456,9 @@ namespace System.Net {
                [Obsolete ("Use GetHostEntry instead")]
                public static IPHostEntry Resolve(string hostName) 
                {
+#if FEATURE_NO_BSD_SOCKETS
+                       throw new PlatformNotSupportedException ("System.Net.Dns:Resolve is not supported on this platform.");
+#else
                        if (hostName == null)
                                throw new ArgumentNullException ("hostName");
 
@@ -450,6 +473,7 @@ namespace System.Net {
                                ret =  GetHostByName(hostName);
 
                        return ret;
+#endif // FEATURE_NO_BSD_SOCKETS
                }
 
                public static Task<IPAddress[]> GetHostAddressesAsync (string hostNameOrAddress)
diff --git a/mcs/class/System/System.Net/FtpRequestCreator.platformnotsupported.cs b/mcs/class/System/System.Net/FtpRequestCreator.platformnotsupported.cs
new file mode 100644 (file)
index 0000000..ae365c2
--- /dev/null
@@ -0,0 +1,39 @@
+//
+// System.Net.FtpbRequestCreator.cs
+//
+// Authors:
+//     Rolf Bjarne Kvinge <rolf@xamarin.com>
+//
+// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com)
+//
+// 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.
+//
+
+namespace System.Net
+{
+       class FtpRequestCreator : IWebRequestCreate
+       {
+               internal const string EXCEPTION_MESSAGE = "System.Net.FtpRequestCreator is not supported on the current platform.";
+               public WebRequest Create (Uri uri)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+       }
+}
index 1fbf80dc7ce4473a80518b3a7d07a146a956a538..c0ea1b551195e55dd06e5919c44646ee5548dc8e 100644 (file)
@@ -17,6 +17,7 @@ using MSI = Mono.Security.Interface;
 #endif
 
 using System;
+using System.Globalization;
 using System.IO;
 using System.Net.Sockets;
 using System.Text;
@@ -42,6 +43,7 @@ namespace System.Net
                NetworkCredential credentials;
                IPHostEntry hostEntry;
                IPEndPoint localEndPoint;
+               IPEndPoint remoteEndPoint;
                IWebProxy proxy;
                int timeout = 100000;
                int rwTimeout = 300000;
@@ -65,7 +67,9 @@ namespace System.Net
                const string PasswordCommand = "PASS";
                const string TypeCommand = "TYPE";
                const string PassiveCommand = "PASV";
+               const string ExtendedPassiveCommand = "EPSV";
                const string PortCommand = "PORT";
+               const string ExtendedPortCommand = "EPRT";
                const string AbortCommand = "ABOR";
                const string AuthCommand = "AUTH";
                const string RestCommand = "REST";
@@ -185,7 +189,7 @@ namespace System.Net
                        }
                }
 
-#if !NET_2_1
+#if !MOBILE
                [MonoTODO]
                public static new RequestCachePolicy DefaultCachePolicy
                {
@@ -401,6 +405,7 @@ namespace System.Net
                                                State = RequestState.Scheduled;
 
                                        Thread thread = new Thread (ProcessRequest);
+                                       thread.IsBackground = true;
                                        thread.Start ();
                                }
                        }
@@ -452,6 +457,7 @@ namespace System.Net
 
                        asyncResult = new FtpAsyncResult (callback, state);
                        Thread thread = new Thread (ProcessRequest);
+                       thread.IsBackground = true;
                        thread.Start ();
 
                        return asyncResult;
@@ -775,14 +781,14 @@ namespace System.Net
                        foreach (IPAddress address in hostEntry.AddressList) {
                                sock = new Socket (address.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
 
-                               IPEndPoint remote = new IPEndPoint (address, requestUri.Port);
+                               remoteEndPoint = new IPEndPoint (address, requestUri.Port);
 
-                               if (!ServicePoint.CallEndPointDelegate (sock, remote)) {
+                               if (!ServicePoint.CallEndPointDelegate (sock, remoteEndPoint)) {
                                        sock.Close ();
                                        sock = null;
                                } else {
                                        try {
-                                               sock.Connect (remote);
+                                               sock.Connect (remoteEndPoint);
                                                localEndPoint = (IPEndPoint) sock.LocalEndPoint;
                                                break;
                                        } catch (SocketException exc) {
@@ -837,52 +843,19 @@ namespace System.Net
                }
 
                // Probably we could do better having here a regex
-               Socket SetupPassiveConnection (string statusDescription)
+               Socket SetupPassiveConnection (string statusDescription, bool ipv6)
                {
                        // Current response string
                        string response = statusDescription;
                        if (response.Length < 4)
                                throw new WebException ("Cannot open passive data connection");
-                       
-                       // Look for first digit after code
-                       int i;
-                       for (i = 3; i < response.Length && !Char.IsDigit (response [i]); i++)
-                               ;
-                       if (i >= response.Length)
-                               throw new WebException ("Cannot open passive data connection");
-
-                       // Get six elements
-                       string [] digits = response.Substring (i).Split (new char [] {','}, 6);
-                       if (digits.Length != 6)
-                               throw new WebException ("Cannot open passive data connection");
-
-                       // Clean non-digits at the end of last element
-                       int j;
-                       for (j = digits [5].Length - 1; j >= 0 && !Char.IsDigit (digits [5][j]); j--)
-                               ;
-                       if (j < 0)
-                               throw new WebException ("Cannot open passive data connection");
-                       
-                       digits [5] = digits [5].Substring (0, j + 1);
-
-                       IPAddress ip;
-                       try {
-                               ip = IPAddress.Parse (String.Join (".", digits, 0, 4));
-                       } catch (FormatException) {
-                               throw new WebException ("Cannot open passive data connection");
-                       }
 
-                       // Get the port
-                       int p1, p2, port;
-                       if (!Int32.TryParse (digits [4], out p1) || !Int32.TryParse (digits [5], out p2))
-                               throw new WebException ("Cannot open passive data connection");
+                       int port = ipv6 ? GetPortV6 (response) : GetPortV4 (response);
 
-                       port = (p1 << 8) + p2; // p1 * 256 + p2
-                       //port = p1 * 256 + p2;
                        if (port < IPEndPoint.MinPort || port > IPEndPoint.MaxPort)
                                throw new WebException ("Cannot open passive data connection");
 
-                       IPEndPoint ep = new IPEndPoint (ip, port);
+                       IPEndPoint ep = new IPEndPoint (remoteEndPoint.Address, port);
                        Socket sock = new Socket (ep.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
                        try {
                                sock.Connect (ep);
@@ -894,6 +867,87 @@ namespace System.Net
                        return sock;
                }
 
+               // GetPortV4, GetPortV6, FormatAddress and FormatAddressV6 are copied from referencesource
+               // TODO: replace FtpWebRequest completely.
+               private int GetPortV4(string responseString)
+               {
+                       string [] parsedList = responseString.Split(new char [] {' ', '(', ',', ')'});
+
+                       // We need at least the status code and the port
+                       if (parsedList.Length <= 7) {
+                               throw new FormatException(SR.GetString(SR.net_ftp_response_invalid_format, responseString));
+                       }
+
+                       int index = parsedList.Length-1;
+                       // skip the last non-number token (e.g. terminating '.')
+#if MONO
+                       // the MS code expects \r\n here in parsedList[index],
+                       // but we're stripping the EOL off earlier so the array contains
+                       // an empty string here which would make Char.IsNumber throw
+                       // TODO: this can be removed once we switch FtpWebRequest to referencesource
+                       if (parsedList[index] == "" || !Char.IsNumber(parsedList[index], 0))
+#else
+                       if (!Char.IsNumber(parsedList[index], 0))
+#endif
+                               index--;
+
+                       int port = Convert.ToByte(parsedList[index--], NumberFormatInfo.InvariantInfo);
+                       port = port |
+                               (Convert.ToByte(parsedList[index--], NumberFormatInfo.InvariantInfo) << 8);
+
+                       return port;
+               }
+
+               private int GetPortV6(string responseString)
+               {
+                       int pos1 = responseString.LastIndexOf("(");
+                       int pos2 = responseString.LastIndexOf(")");
+                       if (pos1 == -1 || pos2 <= pos1) 
+                               throw new FormatException(SR.GetString(SR.net_ftp_response_invalid_format, responseString));
+
+                       // addressInfo will contain a string of format "|||<tcp-port>|"
+                       string addressInfo = responseString.Substring(pos1+1, pos2-pos1-1);
+
+                       // Although RFC2428 recommends using "|" as the delimiter,
+                       // It allows ASCII characters in range 33-126 inclusive.
+                       // We should consider allowing the full range.
+
+                       string [] parsedList = addressInfo.Split(new char [] {'|'});
+                       if (parsedList.Length < 4)
+                               throw new FormatException(SR.GetString(SR.net_ftp_response_invalid_format, responseString));
+                       
+                       return Convert.ToInt32(parsedList[3], NumberFormatInfo.InvariantInfo);
+               }
+
+               private String FormatAddress(IPAddress address, int Port )
+               {
+                       byte [] localAddressInBytes = address.GetAddressBytes();
+
+                       // produces a string in FTP IPAddress/Port encoding (a1, a2, a3, a4, p1, p2), for sending as a parameter
+                       // to the port command.
+                       StringBuilder sb = new StringBuilder(32);
+                       foreach (byte element in localAddressInBytes) {
+                               sb.Append(element);
+                               sb.Append(',');
+                       }
+                       sb.Append(Port / 256 );
+                       sb.Append(',');
+                       sb.Append(Port % 256 );
+                       return sb.ToString();
+               }
+
+               private string FormatAddressV6(IPAddress address, int port) {
+                       StringBuilder sb = new StringBuilder(43); // based on max size of IPv6 address + port + seperators
+                       String addressString = address.ToString();
+                       sb.Append("|2|");
+                       sb.Append(addressString);
+                       sb.Append('|');
+                       sb.Append(port.ToString(NumberFormatInfo.InvariantInfo));
+                       sb.Append('|');
+                       return sb.ToString();
+               }
+               //
+
                Exception CreateExceptionFromResponse (FtpStatus status)
                {
                        FtpWebResponse ftpResponse = new FtpWebResponse (this, requestUri, method, status);
@@ -932,18 +986,19 @@ namespace System.Net
                Socket InitDataConnection ()
                {
                        FtpStatus status;
-                       
+                       bool ipv6 = remoteEndPoint.AddressFamily == AddressFamily.InterNetworkV6;
+
                        if (usePassive) {
-                               status = SendCommand (PassiveCommand);
-                               if (status.StatusCode != FtpStatusCode.EnteringPassive) {
+                               status = SendCommand (ipv6 ? ExtendedPassiveCommand : PassiveCommand);
+                               if (status.StatusCode != (ipv6 ? (FtpStatusCode)229 : FtpStatusCode.EnteringPassive)) { // FtpStatusCode doesn't contain code 229 for EPSV so we need to cast...
                                        throw CreateExceptionFromResponse (status);
                                }
                                
-                               return SetupPassiveConnection (status.StatusDescription);
+                               return SetupPassiveConnection (status.StatusDescription, ipv6);
                        }
 
                        // Open a socket to listen the server's connection
-                       Socket sock = new Socket (AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
+                       Socket sock = new Socket (remoteEndPoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
                        try {
                                sock.Bind (new IPEndPoint (localEndPoint.Address, 0));
                                sock.Listen (1); // We only expect a connection from server
@@ -955,12 +1010,10 @@ namespace System.Net
                        }
 
                        IPEndPoint ep = (IPEndPoint) sock.LocalEndPoint;
-                       string ipString = ep.Address.ToString ().Replace ('.', ',');
-                       int h1 = ep.Port >> 8; // ep.Port / 256
-                       int h2 = ep.Port % 256;
 
-                       string portParam = ipString + "," + h1 + "," + h2;
-                       status = SendCommand (PortCommand, portParam);
+                       var portParam = ipv6 ? FormatAddressV6 (ep.Address, ep.Port) : FormatAddress (ep.Address, ep.Port);
+
+                       status = SendCommand (ipv6 ? ExtendedPortCommand : PortCommand, portParam);
                        
                        if (status.StatusCode != FtpStatusCode.CommandOK) {
                                sock.Close ();
diff --git a/mcs/class/System/System.Net/FtpWebRequest.platformnotsupported.cs b/mcs/class/System/System.Net/FtpWebRequest.platformnotsupported.cs
new file mode 100644 (file)
index 0000000..2bb79d7
--- /dev/null
@@ -0,0 +1,182 @@
+//
+// System.Net.FtpWebRequest.cs
+//
+// Author:
+//     Rolf Bjarne Kvinge <rolf@xamarin.com>
+//
+// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com)
+//
+// 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.IO;
+using System.Security.Cryptography.X509Certificates;
+
+namespace System.Net
+{
+       public sealed class FtpWebRequest : WebRequest
+       {
+               const string EXCEPTION_MESSAGE = "System.Net.FtpWebRequest is not supported on the current platform.";
+
+               FtpWebRequest ()
+               {
+               }
+
+               public X509CertificateCollection ClientCertificates {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override string ConnectionGroupName {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override string ContentType {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override long ContentLength {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public long ContentOffset {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override ICredentials Credentials {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+#if !MOBILE
+               public static new RequestCachePolicy DefaultCachePolicy {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+#endif
+
+               public bool EnableSsl {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override WebHeaderCollection Headers {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public bool KeepAlive {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override string Method {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override bool PreAuthenticate {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override IWebProxy Proxy {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public int ReadWriteTimeout {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public string RenameTo {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override Uri RequestUri {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public ServicePoint ServicePoint {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public bool UsePassive {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override bool UseDefaultCredentials {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public bool UseBinary {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override int Timeout {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override void Abort ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override IAsyncResult BeginGetResponse (AsyncCallback callback, object state)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override WebResponse EndGetResponse (IAsyncResult asyncResult)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override WebResponse GetResponse ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override IAsyncResult BeginGetRequestStream (AsyncCallback callback, object state)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override Stream EndGetRequestStream (IAsyncResult asyncResult)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override Stream GetRequestStream ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+       }
+}
diff --git a/mcs/class/System/System.Net/FtpWebResponse.platformnotsupported.cs b/mcs/class/System/System.Net/FtpWebResponse.platformnotsupported.cs
new file mode 100644 (file)
index 0000000..cd4fa71
--- /dev/null
@@ -0,0 +1,91 @@
+//
+// System.Net.FtpWebResponse.cs
+//
+// Author:
+//     Rolf Bjarne Kvinge <rolf@xamarin.com>
+//
+// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com)
+//
+// 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.IO;
+
+namespace System.Net
+{
+       public class FtpWebResponse : WebResponse
+       {
+               const string EXCEPTION_MESSAGE = "System.Net.FtpWebResponse is not supported on the current platform.";
+
+               FtpWebResponse ()
+               {
+               }
+
+               public override long ContentLength {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override WebHeaderCollection Headers {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override Uri ResponseUri {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public DateTime LastModified {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public string BannerMessage {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public string WelcomeMessage {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public string ExitMessage {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public FtpStatusCode StatusCode {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override bool SupportsHeaders {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public string StatusDescription {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override void Close ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override Stream GetResponseStream ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+       }
+}
index 29afc0fd84b78ceca4e33b0dfe9efa2b4f9767fd..716229d8b565b0bcc0a00b3894274f2565c3282e 100644 (file)
@@ -42,6 +42,7 @@ using System.IO;
 using System.Collections;
 using System.Threading;
 using System.Threading.Tasks;
+using System.Security.Authentication.ExtendedProtection;
 using System.Security.Cryptography;
 using System.Security.Cryptography.X509Certificates;
 
@@ -69,6 +70,12 @@ namespace System.Net {
                ArrayList wait_queue; // List<ListenerAsyncResult> wait_queue;
                Hashtable connections;
 
+               ServiceNameStore defaultServiceNames;
+               ExtendedProtectionPolicy extendedProtectionPolicy;
+               ExtendedProtectionSelector extendedProtectionSelectorDelegate;
+
+               public delegate ExtendedProtectionPolicy ExtendedProtectionSelector (HttpListenerRequest request);
+
                public HttpListener ()
                {
                        prefixes = new HttpListenerPrefixCollection (this);
@@ -77,6 +84,8 @@ namespace System.Net {
                        ctx_queue = new ArrayList ();
                        wait_queue = new ArrayList ();
                        auth_schemes = AuthenticationSchemes.Anonymous;
+                       defaultServiceNames = new ServiceNameStore ();
+                       extendedProtectionPolicy = new ExtendedProtectionPolicy (PolicyEnforcement.Never);
                }
 
                internal HttpListener (X509Certificate certificate, IMonoTlsProvider tlsProvider, MSI.MonoTlsSettings tlsSettings)
@@ -146,6 +155,21 @@ namespace System.Net {
                        }
                }
 
+               public ExtendedProtectionSelector ExtendedProtectionSelectorDelegate
+               {
+                       get { return extendedProtectionSelectorDelegate; }
+                       set {
+                               CheckDisposed();
+                               if (value == null)
+                                       throw new ArgumentNullException ();
+
+                               if (!AuthenticationManager.OSSupportsExtendedProtection)
+                                       throw new PlatformNotSupportedException (SR.GetString (SR.security_ExtendedProtection_NoOSSupport));
+
+                               extendedProtectionSelectorDelegate = value;
+                       }
+               }
+
                public bool IgnoreWriteExceptions {
                        get { return ignore_write_exceptions; }
                        set {
@@ -169,6 +193,42 @@ namespace System.Net {
                        }
                }
 
+               [MonoTODO]
+               public HttpListenerTimeoutManager TimeoutManager {
+                       get {
+                               throw new NotImplementedException ();
+                       }
+               }
+
+               [MonoTODO ("not used anywhere in the implementation")]
+               public ExtendedProtectionPolicy ExtendedProtectionPolicy
+               {
+                       get {
+                               return extendedProtectionPolicy;
+                       }
+                       set {
+                               CheckDisposed ();
+
+                               if (value == null)
+                                       throw new ArgumentNullException ("value");
+
+                               if (!AuthenticationManager.OSSupportsExtendedProtection && value.PolicyEnforcement == PolicyEnforcement.Always)
+                                       throw new PlatformNotSupportedException (SR.GetString(SR.security_ExtendedProtection_NoOSSupport));
+
+                               if (value.CustomChannelBinding != null)
+                                       throw new ArgumentException (SR.GetString (SR.net_listener_cannot_set_custom_cbt), "CustomChannelBinding");
+                               extendedProtectionPolicy = value;
+                       }
+               }
+
+               public ServiceNameCollection DefaultServiceNames
+               {
+                       get {
+                               return defaultServiceNames.ServiceNames;
+                       }
+               }
+
                // TODO: use this
                public string Realm {
                        get { return realm; }
diff --git a/mcs/class/System/System.Net/HttpListener.platformnotsupported.cs b/mcs/class/System/System.Net/HttpListener.platformnotsupported.cs
new file mode 100644 (file)
index 0000000..88ae1d3
--- /dev/null
@@ -0,0 +1,147 @@
+//
+// System.Net.HttpListener
+//
+// Author:
+//     Rolf Bjarne Kvinge <rolf@xamarin.com>
+//
+// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com)
+//
+// 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.Security.Authentication.ExtendedProtection;
+using System.Threading.Tasks;
+
+namespace System.Net {
+       public sealed class HttpListener : IDisposable
+       {
+               internal const string EXCEPTION_MESSAGE = "System.Net.HttpListener is not supported on the current platform.";
+
+               public delegate ExtendedProtectionPolicy ExtendedProtectionSelector (HttpListenerRequest request);
+
+               public HttpListener ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public AuthenticationSchemes AuthenticationSchemes {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public AuthenticationSchemeSelector AuthenticationSchemeSelectorDelegate {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public bool IgnoreWriteExceptions {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public bool IsListening {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public static bool IsSupported {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public HttpListenerPrefixCollection Prefixes {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public string Realm {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public bool UnsafeConnectionNtlmAuthentication {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public HttpListenerTimeoutManager TimeoutManager {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public ExtendedProtectionPolicy ExtendedProtectionPolicy
+               {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public ExtendedProtectionSelector ExtendedProtectionSelectorDelegate
+               {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public ServiceNameCollection DefaultServiceNames
+               {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public void Abort ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public void Close ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public IAsyncResult BeginGetContext (AsyncCallback callback, Object state)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public HttpListenerContext EndGetContext (IAsyncResult asyncResult)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public HttpListenerContext GetContext ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public void Start ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public void Stop ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               void IDisposable.Dispose ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public Task<HttpListenerContext> GetContextAsync ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+       }
+}
index d495e4af581e281bb88a1eceb6f4c6f4f8d1309a..5a3a2f0f445be565d7b01433dce630f5c6d7cccb 100644 (file)
@@ -137,16 +137,25 @@ namespace System.Net {
                        } 
                }
 
+               [MonoTODO]
                public Task<HttpListenerWebSocketContext> AcceptWebSocketAsync (string subProtocol)
                {
                        throw new NotImplementedException ();
                }
 
+               [MonoTODO]
+               public Task<HttpListenerWebSocketContext> AcceptWebSocketAsync (string subProtocol, TimeSpan keepAliveInterval)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
                public Task<HttpListenerWebSocketContext> AcceptWebSocketAsync (string subProtocol, int receiveBufferSize, TimeSpan keepAliveInterval)
                {
                        throw new NotImplementedException ();
                }
 
+               [MonoTODO]
                public Task<HttpListenerWebSocketContext> AcceptWebSocketAsync (string subProtocol, int receiveBufferSize, TimeSpan keepAliveInterval, ArraySegment<byte> internalBuffer)
                {
                        throw new NotImplementedException ();
diff --git a/mcs/class/System/System.Net/HttpListenerContext.platformnotsupported.cs b/mcs/class/System/System.Net/HttpListenerContext.platformnotsupported.cs
new file mode 100644 (file)
index 0000000..275d6d4
--- /dev/null
@@ -0,0 +1,73 @@
+//
+// System.Net.HttpListenerContext
+//
+// Author:
+//     Rolf Bjarne Kvinge <rolf@xamarin.com>
+//
+// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com)
+//
+// 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.Security.Principal;
+using System.Threading.Tasks;
+using System.Net.WebSockets;
+
+namespace System.Net {
+       public sealed class HttpListenerContext {
+               const string EXCEPTION_MESSAGE = "System.Net.HttpListenerContext is not supported on the current platform.";
+
+               HttpListenerContext ()
+               {
+               }
+
+               public HttpListenerRequest Request {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public HttpListenerResponse Response {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public IPrincipal User {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public Task<HttpListenerWebSocketContext> AcceptWebSocketAsync (string subProtocol)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public Task<HttpListenerWebSocketContext> AcceptWebSocketAsync (string subProtocol, TimeSpan keepAliveInterval)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public Task<HttpListenerWebSocketContext> AcceptWebSocketAsync (string subProtocol, int receiveBufferSize, TimeSpan keepAliveInterval)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public Task<HttpListenerWebSocketContext> AcceptWebSocketAsync (string subProtocol, int receiveBufferSize, TimeSpan keepAliveInterval, ArraySegment<byte> internalBuffer)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+       }
+}
diff --git a/mcs/class/System/System.Net/HttpListenerPrefixCollection.platformnotsupported.cs b/mcs/class/System/System.Net/HttpListenerPrefixCollection.platformnotsupported.cs
new file mode 100644 (file)
index 0000000..e3566c2
--- /dev/null
@@ -0,0 +1,93 @@
+//
+// System.Net.HttpListenerPrefixCollection.cs
+//
+// Author:
+//     Rolf Bjarne Kvinge <rolf@xamarin.com>
+//
+// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com)
+//
+// 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.Collections;
+using System.Collections.Generic;
+
+namespace System.Net {
+       public class HttpListenerPrefixCollection : ICollection<string>, IEnumerable<string>, IEnumerable
+       {
+               const string EXCEPTION_MESSAGE = "System.Net.HttpListenerPrefixCollection is not supported on the current platform.";
+
+               HttpListenerPrefixCollection ()
+               {
+               }
+
+               public int Count {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public bool IsReadOnly {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public bool IsSynchronized {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public void Add (string uriPrefix)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public void Clear ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public bool Contains (string uriPrefix)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public void CopyTo (string [] array, int offset)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public void CopyTo (Array array, int offset)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public IEnumerator<string> GetEnumerator ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               IEnumerator IEnumerable.GetEnumerator ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public bool Remove (string uriPrefix)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+       }
+}
index a9c5bb9ee32bb7e7a7208fb5ff68081f11a143de..a12aa233b71643e260d48e1ed79834390f9d6de0 100644 (file)
@@ -370,7 +370,7 @@ namespace System.Net {
                                                return false;
                                        if (InputStream.EndRead (ares) <= 0)
                                                return true;
-                               } catch (ObjectDisposedException e) {
+                               } catch (ObjectDisposedException) {
                                        input_stream = null;
                                        return true;
                                } catch {
diff --git a/mcs/class/System/System.Net/HttpListenerRequest.platformnotsupported.cs b/mcs/class/System/System.Net/HttpListenerRequest.platformnotsupported.cs
new file mode 100644 (file)
index 0000000..32560d9
--- /dev/null
@@ -0,0 +1,180 @@
+//
+// System.Net.HttpListenerRequest
+//
+// Author:
+//     Rolf Bjarne Kvinge <rolf@xamarin.com>
+//
+// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com)
+//
+// 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.Collections.Specialized;
+using System.IO;
+using System.Security.Cryptography.X509Certificates;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace System.Net {
+       public sealed class HttpListenerRequest
+       {
+               const string EXCEPTION_MESSAGE = "System.Net.HttpListenerRequest is not supported on the current platform.";
+
+               HttpListenerRequest ()
+               {
+               }
+
+               public string [] AcceptTypes {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public int ClientCertificateError {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public Encoding ContentEncoding {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public long ContentLength64 {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public string ContentType {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public CookieCollection Cookies {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public bool HasEntityBody {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public NameValueCollection Headers {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public string HttpMethod {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public Stream InputStream {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public bool IsAuthenticated {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public bool IsLocal {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public bool IsSecureConnection {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public bool KeepAlive {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public IPEndPoint LocalEndPoint {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public Version ProtocolVersion {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public NameValueCollection QueryString {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public string RawUrl {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public IPEndPoint RemoteEndPoint {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public Guid RequestTraceIdentifier {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public Uri Url {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public Uri UrlReferrer {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public string UserAgent {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public string UserHostAddress {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public string UserHostName {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public string [] UserLanguages {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public IAsyncResult BeginGetClientCertificate (AsyncCallback requestCallback, object state)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public X509Certificate2 EndGetClientCertificate (IAsyncResult asyncResult)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public X509Certificate2 GetClientCertificate ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public string ServiceName {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public TransportContext TransportContext {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public bool IsWebSocketRequest {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public Task<X509Certificate2> GetClientCertificateAsync ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+       }
+}
index 329c4a2c19adba4900f992d213bca4ee7d55c2af..73aa6396b5343e27c1ae1808bc72a7c6470053a5 100644 (file)
@@ -427,10 +427,10 @@ namespace System.Net {
 
                        StreamWriter writer = new StreamWriter (ms, encoding, 256);
                        writer.Write ("HTTP/{0} {1} {2}\r\n", version, status_code, status_description);
-                       string headers_str = headers.ToString ();
+                       string headers_str = FormatHeaders (headers);
                        writer.Write (headers_str);
                        writer.Flush ();
-                       int preamble = (encoding.CodePage == 65001) ? 3 : encoding.GetPreamble ().Length;
+                       int preamble = encoding.GetPreamble ().Length;
                        if (output_stream == null)
                                output_stream = context.Connection.GetResponseStream ();
 
@@ -439,6 +439,24 @@ namespace System.Net {
                        HeadersSent = true;
                }
 
+               static string FormatHeaders (WebHeaderCollection headers)
+               {
+                       var sb = new StringBuilder();
+
+                       for (int i = 0; i < headers.Count ; i++) {
+                               string key = headers.GetKey (i);
+                               if (WebHeaderCollection.AllowMultiValues (key)) {
+                                       foreach (string v in headers.GetValues (i)) {
+                                               sb.Append (key).Append (": ").Append (v).Append ("\r\n");
+                                       }
+                               } else {
+                                       sb.Append (key).Append (": ").Append (headers.Get (i)).Append ("\r\n");
+                               }
+                       }
+
+                       return sb.Append("\r\n").ToString();
+               }
+
                static string CookieToClientString (Cookie cookie)
                {
                        if (cookie.Name.Length == 0)
@@ -499,64 +517,6 @@ namespace System.Net {
                        cookies.Add (cookie);
                }
        }
-
-       // do not inline into HttpListenerResponse as this recursively brings everything that's 
-       // reachable by IDisposable.Dispose (and that's quite a lot in this case). 
-       static class HttpListenerResponseHelper {
-
-               internal static string GetStatusDescription (int code)
-               {
-                       switch (code){
-                       case 100: return "Continue";
-                       case 101: return "Switching Protocols";
-                       case 102: return "Processing";
-                       case 200: return "OK";
-                       case 201: return "Created";
-                       case 202: return "Accepted";
-                       case 203: return "Non-Authoritative Information";
-                       case 204: return "No Content";
-                       case 205: return "Reset Content";
-                       case 206: return "Partial Content";
-                       case 207: return "Multi-Status";
-                       case 300: return "Multiple Choices";
-                       case 301: return "Moved Permanently";
-                       case 302: return "Found";
-                       case 303: return "See Other";
-                       case 304: return "Not Modified";
-                       case 305: return "Use Proxy";
-                       case 307: return "Temporary Redirect";
-                       case 400: return "Bad Request";
-                       case 401: return "Unauthorized";
-                       case 402: return "Payment Required";
-                       case 403: return "Forbidden";
-                       case 404: return "Not Found";
-                       case 405: return "Method Not Allowed";
-                       case 406: return "Not Acceptable";
-                       case 407: return "Proxy Authentication Required";
-                       case 408: return "Request Timeout";
-                       case 409: return "Conflict";
-                       case 410: return "Gone";
-                       case 411: return "Length Required";
-                       case 412: return "Precondition Failed";
-                       case 413: return "Request Entity Too Large";
-                       case 414: return "Request-Uri Too Long";
-                       case 415: return "Unsupported Media Type";
-                       case 416: return "Requested Range Not Satisfiable";
-                       case 417: return "Expectation Failed";
-                       case 422: return "Unprocessable Entity";
-                       case 423: return "Locked";
-                       case 424: return "Failed Dependency";
-                       case 500: return "Internal Server Error";
-                       case 501: return "Not Implemented";
-                       case 502: return "Bad Gateway";
-                       case 503: return "Service Unavailable";
-                       case 504: return "Gateway Timeout";
-                       case 505: return "Http Version Not Supported";
-                       case 507: return "Insufficient Storage";
-                       }
-                       return "";
-               }
-       }
 }
 #endif
 
diff --git a/mcs/class/System/System.Net/HttpListenerResponse.platformnotsupported.cs b/mcs/class/System/System.Net/HttpListenerResponse.platformnotsupported.cs
new file mode 100644 (file)
index 0000000..97661d6
--- /dev/null
@@ -0,0 +1,150 @@
+//
+// System.Net.HttpListenerResponse
+//
+// Author:
+//     Rolf Bjarne Kvinge <rolf@xamarin.com>
+//
+// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com)
+//
+// 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.IO;
+using System.Text;
+
+namespace System.Net {
+       public sealed class HttpListenerResponse : IDisposable
+       {
+               const string EXCEPTION_MESSAGE = "System.Net.HttpListenerResponse is not supported on the current platform.";
+
+               HttpListenerResponse ()
+               {
+               }
+
+               public Encoding ContentEncoding {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public long ContentLength64 {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public string ContentType {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public CookieCollection Cookies {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public WebHeaderCollection Headers {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public bool KeepAlive {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public Stream OutputStream {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public Version ProtocolVersion {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public string RedirectLocation {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public bool SendChunked {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public int StatusCode {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public string StatusDescription {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               void IDisposable.Dispose ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public void Abort ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public void AddHeader (string name, string value)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public void AppendCookie (Cookie cookie)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public void AppendHeader (string name, string value)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public void Close ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public void Close (byte [] responseEntity, bool willBlock)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public void CopyFrom (HttpListenerResponse templateResponse)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public void Redirect (string url)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public void SetCookie (Cookie cookie)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+       }
+}
diff --git a/mcs/class/System/System.Net/HttpListenerResponseHelper.cs b/mcs/class/System/System.Net/HttpListenerResponseHelper.cs
new file mode 100644 (file)
index 0000000..7fc3c11
--- /dev/null
@@ -0,0 +1,88 @@
+//
+// System.Net.HttpListenerResponseHelper
+//
+// Author:
+//     Gonzalo Paniagua Javier (gonzalo@novell.com)
+//
+// Copyright (c) 2005 Novell, Inc. (http://www.novell.com)
+// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com)
+//
+// 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.
+//
+
+namespace System.Net {
+       // do not inline into HttpListenerResponse as this recursively brings everything that's
+       // reachable by IDisposable.Dispose (and that's quite a lot in this case).
+       static class HttpListenerResponseHelper {
+
+               internal static string GetStatusDescription (int code)
+               {
+                       switch (code){
+                       case 100: return "Continue";
+                       case 101: return "Switching Protocols";
+                       case 102: return "Processing";
+                       case 200: return "OK";
+                       case 201: return "Created";
+                       case 202: return "Accepted";
+                       case 203: return "Non-Authoritative Information";
+                       case 204: return "No Content";
+                       case 205: return "Reset Content";
+                       case 206: return "Partial Content";
+                       case 207: return "Multi-Status";
+                       case 300: return "Multiple Choices";
+                       case 301: return "Moved Permanently";
+                       case 302: return "Found";
+                       case 303: return "See Other";
+                       case 304: return "Not Modified";
+                       case 305: return "Use Proxy";
+                       case 307: return "Temporary Redirect";
+                       case 400: return "Bad Request";
+                       case 401: return "Unauthorized";
+                       case 402: return "Payment Required";
+                       case 403: return "Forbidden";
+                       case 404: return "Not Found";
+                       case 405: return "Method Not Allowed";
+                       case 406: return "Not Acceptable";
+                       case 407: return "Proxy Authentication Required";
+                       case 408: return "Request Timeout";
+                       case 409: return "Conflict";
+                       case 410: return "Gone";
+                       case 411: return "Length Required";
+                       case 412: return "Precondition Failed";
+                       case 413: return "Request Entity Too Large";
+                       case 414: return "Request-Uri Too Long";
+                       case 415: return "Unsupported Media Type";
+                       case 416: return "Requested Range Not Satisfiable";
+                       case 417: return "Expectation Failed";
+                       case 422: return "Unprocessable Entity";
+                       case 423: return "Locked";
+                       case 424: return "Failed Dependency";
+                       case 500: return "Internal Server Error";
+                       case 501: return "Not Implemented";
+                       case 502: return "Bad Gateway";
+                       case 503: return "Service Unavailable";
+                       case 504: return "Gateway Timeout";
+                       case 505: return "Http Version Not Supported";
+                       case 507: return "Insufficient Storage";
+                       }
+                       return "";
+               }
+       }
+}
index d7e008baa0303d99aeb1635e613cb7c990a2b054..34673579632d3810fa69491483a2ac33e83155f1 100644 (file)
@@ -30,6 +30,46 @@ namespace System.Net
 {
        public class HttpListenerTimeoutManager
        {
+               [MonoTODO]
+               public TimeSpan EntityBody
+               {
+                       get { throw new NotImplementedException (); }
+                       set { throw new NotImplementedException (); }
+               }
 
+               [MonoTODO]
+               public TimeSpan DrainEntityBody
+               {
+                       get { throw new NotImplementedException (); }
+                       set { throw new NotImplementedException (); }
+               }
+
+               [MonoTODO]
+               public TimeSpan RequestQueue
+               {
+                       get { throw new NotImplementedException (); }
+                       set { throw new NotImplementedException (); }
+               }
+
+               [MonoTODO]
+               public TimeSpan IdleConnection
+               {
+                       get { throw new NotImplementedException (); }
+                       set { throw new NotImplementedException (); }
+               }
+
+               [MonoTODO]
+               public TimeSpan HeaderWait
+               {
+                       get { throw new NotImplementedException (); }
+                       set { throw new NotImplementedException (); }
+               }
+
+               [MonoTODO]
+               public long MinSendBytesPerSecond
+               {
+                       get { throw new NotImplementedException (); }
+                       set { throw new NotImplementedException (); }
+               }
        }
 }
\ No newline at end of file
index 63d0eb39238c4bdf2d5eaf16eb69adef7c2562e0..a57c579250ed33e6f27cb11ad04469840f3a06b3 100644 (file)
@@ -133,7 +133,7 @@ namespace System.Net
                static HttpWebRequest ()
                {
                        defaultMaxResponseHeadersLength = 64 * 1024;
-#if !NET_2_1
+#if !MOBILE
                        NetConfig config = ConfigurationSettings.GetConfig ("system.net/settings") as NetConfig;
                        if (config != null) {
                                int x = config.MaxResponseHeadersLength;
@@ -145,7 +145,7 @@ namespace System.Net
 #endif
                }
 
-#if NET_2_1
+#if MOBILE
                public
 #else
                internal
@@ -226,12 +226,12 @@ namespace System.Net
                        internal set { actualUri = value; } // Used by Ftp+proxy
                }
                
-               public bool AllowAutoRedirect {
+               public virtual bool AllowAutoRedirect {
                        get { return allowAutoRedirect; }
                        set { this.allowAutoRedirect = value; }
                }
                
-               public bool AllowWriteStreamBuffering {
+               public virtual bool AllowWriteStreamBuffering {
                        get { return allowBuffering; }
                        set { allowBuffering = value; }
                }
@@ -382,7 +382,7 @@ namespace System.Net
                                SetSpecialHeaders(headerName, HttpProtocolUtils.date2string(dateTime));
                }
 
-#if !NET_2_1
+#if !MOBILE
                [MonoTODO]
                public static new RequestCachePolicy DefaultCachePolicy
                {
@@ -450,7 +450,7 @@ namespace System.Net
                                        newWebHeaders.Add(headerName,webHeaders[headerName]);
                                }
 
-                               webHeaders = newWebHeaders;
+                               this.webHeaders = newWebHeaders;
                        }
                }
                
@@ -918,6 +918,12 @@ namespace System.Net
                        return EndGetRequestStream (asyncResult);
                }
 
+               [MonoTODO]
+               public Stream GetRequestStream (out TransportContext context)
+               {
+                       throw new NotImplementedException ();
+               }
+
                bool CheckIfForceWrite (SimpleAsyncResult result)
                {
                        if (writeStream == null || writeStream.RequestWritten || !InternalAllowBuffering)
@@ -963,7 +969,7 @@ namespace System.Net
                        initialMethod = method;
 
                        SimpleAsyncResult.RunWithLock (locker, CheckIfForceWrite, inner => {
-                               var synch = inner.CompletedSynchronously;
+                               var synch = inner.CompletedSynchronouslyPeek;
 
                                if (inner.GotException) {
                                        aread.SetCompleted (synch, inner.Exception);
@@ -1314,8 +1320,11 @@ namespace System.Net
                                        msg = "Error: " + status;
                                        wex = new WebException (msg, status);
                                } else {
-                                       msg = String.Format ("Error: {0} ({1})", status, exc.Message);
-                                       wex = new WebException (msg, status, WebExceptionInternalStatus.RequestFatal, exc);
+                                       wex = exc as WebException;
+                                       if (wex == null) {
+                                               msg = String.Format ("Error: {0} ({1})", status, exc.Message);
+                                               wex = new WebException (msg, status, WebExceptionInternalStatus.RequestFatal, exc);
+                                       }
                                }
                                r.SetCompleted (false, wex);
                                r.DoCallback ();
@@ -1374,7 +1383,7 @@ namespace System.Net
                                        }
 
                                        if (asyncWrite != null) {
-                                               asyncWrite.SetCompleted (inner.CompletedSynchronously, writeStream);
+                                               asyncWrite.SetCompleted (inner.CompletedSynchronouslyPeek, writeStream);
                                                asyncWrite.DoCallback ();
                                                asyncWrite = null;
                                        }
diff --git a/mcs/class/System/System.Net/HttpWebRequest.platformnotsupported.cs b/mcs/class/System/System.Net/HttpWebRequest.platformnotsupported.cs
new file mode 100644 (file)
index 0000000..590c82b
--- /dev/null
@@ -0,0 +1,427 @@
+//
+// System.Net.HttpWebRequest
+//
+// Author:
+//     Rolf Bjarne Kvinge <rolf@xamarin.com>
+//
+// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com)
+//
+// 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.IO;
+using System.Net.Security;
+using System.Runtime.Serialization;
+using System.Security.Cryptography.X509Certificates;
+
+namespace System.Net
+{
+       [Serializable]
+       public class HttpWebRequest : WebRequest, ISerializable
+       {
+               internal const string EXCEPTION_MESSAGE = "System.Net.HttpWebRequest is not supported on the current platform.";
+
+#if MOBILE
+               public
+#else
+               internal
+#endif
+               HttpWebRequest (Uri uri)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               internal HttpWebRequest (Uri uri, object /* IMonoTlsProvider */ tlsProvider, object /* MonoTlsSettings */ settings = null)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               protected HttpWebRequest (SerializationInfo serializationInfo, StreamingContext streamingContext)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public string Accept {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public Uri Address {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public virtual bool AllowAutoRedirect {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public virtual bool AllowWriteStreamBuffering {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public virtual bool AllowReadStreamBuffering {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public DecompressionMethods AutomaticDecompression {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               internal bool InternalAllowBuffering {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public X509CertificateCollection ClientCertificates {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public string Connection {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override string ConnectionGroupName {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override long ContentLength {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               internal long InternalContentLength {
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override string ContentType {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public HttpContinueDelegate ContinueDelegate {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public virtual CookieContainer CookieContainer {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override ICredentials Credentials {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public DateTime Date {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+#if !MOBILE
+               public static new RequestCachePolicy DefaultCachePolicy {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+#endif
+
+               public static int DefaultMaximumErrorResponseLength {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public string Expect {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public virtual bool HaveResponse {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override WebHeaderCollection Headers {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public string Host {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public DateTime IfModifiedSince {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public bool KeepAlive {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public int MaximumAutomaticRedirections {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public int MaximumResponseHeadersLength {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public static int DefaultMaximumResponseHeadersLength {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public int ReadWriteTimeout {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public int ContinueTimeout {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public string MediaType {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override string Method {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public bool Pipelined {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override bool PreAuthenticate {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public Version ProtocolVersion {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override IWebProxy Proxy {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public string Referer {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override Uri RequestUri {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public bool SendChunked {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public ServicePoint ServicePoint {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               internal ServicePoint ServicePointNoLock {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public virtual bool SupportsCookieContainer {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override int Timeout {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public string TransferEncoding {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override bool UseDefaultCredentials {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public string UserAgent {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public bool UnsafeAuthenticatedConnectionSharing {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               internal bool ExpectContinue {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               internal ServerCertValidationCallback ServerCertValidationCallback {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               internal Uri AuthUri {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public RemoteCertificateValidationCallback ServerCertificateValidationCallback {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public void AddRange (int range)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public void AddRange (int from, int to)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public void AddRange (string rangeSpecifier, int range)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public void AddRange (string rangeSpecifier, int from, int to)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public void AddRange (long range)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public void AddRange (long from, long to)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public void AddRange (string rangeSpecifier, long range)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public void AddRange (string rangeSpecifier, long from, long to)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override IAsyncResult BeginGetRequestStream (AsyncCallback callback, object state)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override Stream EndGetRequestStream (IAsyncResult asyncResult)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override Stream GetRequestStream()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public System.IO.Stream GetRequestStream (out TransportContext context)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override IAsyncResult BeginGetResponse (AsyncCallback callback, object state)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override WebResponse EndGetResponse (IAsyncResult asyncResult)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public Stream EndGetRequestStream (IAsyncResult asyncResult, out TransportContext transportContext)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override WebResponse GetResponse()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               internal bool FinishedReading {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               internal bool Aborted {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override void Abort ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               void ISerializable.GetObjectData (SerializationInfo serializationInfo, StreamingContext streamingContext)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               protected override void GetObjectData (SerializationInfo serializationInfo, StreamingContext streamingContext)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               internal void DoContinueDelegate (int statusCode, WebHeaderCollection headers)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               internal void SetWriteStreamError (WebExceptionStatus status, Exception exc)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               internal byte[] GetRequestHeaders ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+       }
+}
index 6a73ae0f167c2b5217a06293eb2f90d54b370e5b..5402d58f522a0f413aac15f2dc281e19a66d4827 100644 (file)
@@ -106,7 +106,7 @@ namespace System.Net
                        version = (Version) info.GetValue ("version", typeof (Version));
                        statusCode = (HttpStatusCode) info.GetValue ("statusCode", typeof (HttpStatusCode));
                }
-               
+
                // Properties
                
                public string CharacterSet {
@@ -225,7 +225,7 @@ namespace System.Net
                public string Server {
                        get {
                                CheckDisposed ();
-                               return webHeaders ["Server"]
+                               return webHeaders ["Server"] ?? "";
                        }
                }
                
diff --git a/mcs/class/System/System.Net/HttpWebResponse.platformnotsupported.cs b/mcs/class/System/System.Net/HttpWebResponse.platformnotsupported.cs
new file mode 100644 (file)
index 0000000..300d5d4
--- /dev/null
@@ -0,0 +1,147 @@
+//
+// System.Net.HttpWebResponse
+//
+// Author:
+//     Rolf Bjarne Kvinge <rolf@xamarin.com>
+//
+// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com)
+//
+// 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.IO;
+using System.Runtime.Serialization;
+
+namespace System.Net
+{
+       [Serializable]
+       public class HttpWebResponse : WebResponse, ISerializable, IDisposable
+       {
+               const string EXCEPTION_MESSAGE = "System.Net.HttpWebResponse is not supported on the current platform.";
+
+               [Obsolete ("Serialization is obsoleted for this type", false)]
+               protected HttpWebResponse (SerializationInfo serializationInfo, StreamingContext streamingContext)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public string CharacterSet {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public string ContentEncoding {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override long ContentLength {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override string ContentType {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public virtual CookieCollection Cookies {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override WebHeaderCollection Headers {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               [MonoTODO]
+               public override bool IsMutuallyAuthenticated {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public DateTime LastModified {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public virtual string Method {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public Version ProtocolVersion {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override Uri ResponseUri {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public string Server {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public virtual HttpStatusCode StatusCode {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public virtual string StatusDescription {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public override bool SupportsHeaders {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public string GetResponseHeader (string headerName)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               internal void ReadAll ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override Stream GetResponseStream ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               void ISerializable.GetObjectData (SerializationInfo serializationInfo, StreamingContext streamingContext)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               protected override void GetObjectData (SerializationInfo serializationInfo, StreamingContext streamingContext)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public override void Close ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               void IDisposable.Dispose ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               protected override void Dispose (bool disposing)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+       }
+}
diff --git a/mcs/class/System/System.Net/NetworkCredential.cs b/mcs/class/System/System.Net/NetworkCredential.cs
deleted file mode 100644 (file)
index faba55d..0000000
+++ /dev/null
@@ -1,112 +0,0 @@
-//
-// System.Net.NetworkCredential.cs
-//
-// Authors: Duncan Mak (duncan@ximian.com)
-//          Rolf Bjarne KVinge (rolf@xamarin.com)
-//          Marek Safar (marek.safar@gmail.com)
-//
-// (C) Ximian, Inc.
-// Copyright (C) 2010 Novell, Inc (http://www.novell.com)
-// Copyright (C) 2011, 2014 Xamarin Inc (http://www.xamarin.com)
-//
-// 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.Security;
-
-namespace System.Net
-{
-       public class NetworkCredential : ICredentials
-                                       , ICredentialsByHost
-       {
-               // Fields
-               string userName;
-               string password;
-               string domain;
-               
-               SecureString securePassword;
-
-               // Constructors
-               public NetworkCredential ()
-               {
-               }
-
-               public NetworkCredential (string userName, string password)
-               {
-                       this.userName = userName;
-                       this.password = password;
-               }
-
-               public NetworkCredential (string userName, string password, string domain)
-                       : this (userName, password)
-               {
-                       this.domain = domain;
-               }
-
-               public NetworkCredential (string userName, SecureString password)
-               {
-                       this.userName = userName;
-                       SecurePassword = password;
-               }
-
-               public NetworkCredential (string userName, SecureString password, string domain)
-                       : this (userName, password)
-               {
-                       this.domain = domain;
-               }
-               // Properties
-
-               public string Domain {
-                       get { return domain ?? String.Empty; }
-                       set { domain = value; }
-               }
-
-               public string UserName {
-                       get { return userName ?? String.Empty; }
-                       set { userName = value; }                       
-               }
-
-               public string Password {
-                       get { return password ?? String.Empty; }
-                       set { password = value; }
-               }
-
-               public SecureString SecurePassword {
-                       get { return securePassword; }
-                       set {
-                               if (value == null) {
-                                       securePassword = new SecureString ();
-                               } else {
-                                       securePassword = value;
-                               }
-                       }
-               }
-
-               public NetworkCredential GetCredential (Uri uri, string authType)
-               {
-                       return this;
-               }
-
-               public NetworkCredential GetCredential (string host, int port, string authenticationType)
-               {
-                       return this;
-               }
-       }
-}
index 6a47f40ae2a3cf823bfda8923e86cb2a7334e2f1..03993e989590fdf086917fa523d314b1dfa6d68d 100644 (file)
@@ -97,7 +97,7 @@ namespace System.Net {
                                                        InternalWrite (bytes, 0, bytes.Length);
                                                        trailer_sent = true;
                                                }
-                                       } catch (IOException ex) {
+                                       } catch (IOException) {
                                                // Ignore error due to connection reset by peer
                                        }
                                }
diff --git a/mcs/class/System/System.Net/ServicePoint.platformnotsupported.cs b/mcs/class/System/System.Net/ServicePoint.platformnotsupported.cs
new file mode 100644 (file)
index 0000000..d744a55
--- /dev/null
@@ -0,0 +1,127 @@
+//
+// ServicePoint.cs
+//
+// Author:
+//       Rolf Bjarne Kvinge <rolf@xamarin.com>
+//
+// Copyright (c) 2016 Xamarin, Inc.
+//
+// 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.Net.Sockets;
+using System.Security.Cryptography.X509Certificates;
+
+namespace System.Net
+{
+       public class ServicePoint
+       {
+               const string EXCEPTION_MESSAGE = "System.Net.ServicePoint is not supported on the current platform.";
+
+               ServicePoint () {}
+
+               public Uri Address {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               static Exception GetMustImplement ()
+               {
+                       return new NotImplementedException ();
+               }
+
+               public BindIPEndPoint BindIPEndPointDelegate
+               {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public int ConnectionLeaseTimeout {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public int ConnectionLimit {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public string ConnectionName {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public int CurrentConnections {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public DateTime IdleSince {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public int MaxIdleTime {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public virtual Version ProtocolVersion {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public int ReceiveBufferSize {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public bool SupportsPipelining {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public bool Expect100Continue {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public bool UseNagleAlgorithm {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public void SetTcpKeepAlive (bool enabled, int keepAliveTime, int keepAliveInterval)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public bool CloseConnectionGroup (string connectionGroupName)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public  X509Certificate Certificate {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public  X509Certificate ClientCertificate {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               // For reference source
+               internal Socket GetConnection(PooledStream PooledStream, object owner, bool async, out IPAddress address, ref Socket abortSocket, ref Socket abortSocket6)
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+}
index 32a0148b8ea749a5796ce9d2083ca021d73f9bbf..56d682bd402541a3c79e35f0bcc17c1922525f86 100644 (file)
@@ -132,20 +132,20 @@ namespace System.Net
                // Fields
                
                public const int DefaultNonPersistentConnectionLimit = 4;
-#if MONOTOUCH
+#if MOBILE
                public const int DefaultPersistentConnectionLimit = 10;
 #else
                public const int DefaultPersistentConnectionLimit = 2;
 #endif
 
-#if !NET_2_1
+#if !MOBILE
                const string configKey = "system.net/connectionManagement";
                static ConnectionManagementData manager;
 #endif
                
                static ServicePointManager ()
                {
-#if !NET_2_1
+#if !MOBILE
 #if CONFIGURATION_DEP
                        object cfg = ConfigurationManager.GetSection (configKey);
                        ConnectionManagementSection s = cfg as ConnectionManagementSection;
@@ -158,7 +158,10 @@ namespace System.Net
                                return;
                        }
 #endif
+
+#pragma warning disable 618
                        manager = (ConnectionManagementData) ConfigurationSettings.GetConfig (configKey);
+#pragma warning restore 618
                        if (manager != null) {
                                defaultConnectionLimit = (int) manager.GetMaxConnections ("*");                         
                        }
@@ -200,7 +203,7 @@ namespace System.Net
                                        throw new ArgumentOutOfRangeException ("value");
 
                                defaultConnectionLimit = value; 
-#if !NET_2_1
+#if !MOBILE
                 if (manager != null)
                                        manager.Add ("*", defaultConnectionLimit);
 #endif
@@ -256,6 +259,12 @@ namespace System.Net
                        }
                }
 
+               [MonoTODO]
+               public static bool ReusePort {
+                       get { return false; }
+                       set { throw new NotImplementedException (); }
+               }
+
                public static SecurityProtocolType SecurityProtocol {
                        get { return _securityProtocol; }
                        set { _securityProtocol = value; }
@@ -280,6 +289,13 @@ namespace System.Net
                        }
                }
 
+               [MonoTODO ("Always returns EncryptionPolicy.RequireEncryption.")]
+               public static EncryptionPolicy EncryptionPolicy {
+                       get {
+                               return EncryptionPolicy.RequireEncryption;
+                       }
+               }
+
                public static bool Expect100Continue {
                        get { return expectContinue; }
                        set { expectContinue = value; }
@@ -356,7 +372,7 @@ namespace System.Net
                                        throw new InvalidOperationException ("maximum number of service points reached");
 
                                int limit;
-#if NET_2_1
+#if MOBILE
                                limit = defaultConnectionLimit;
 #else
                                string addr = address.ToString ();
diff --git a/mcs/class/System/System.Net/ServicePointManager.platformnotsupported.cs b/mcs/class/System/System.Net/ServicePointManager.platformnotsupported.cs
new file mode 100644 (file)
index 0000000..49c02e5
--- /dev/null
@@ -0,0 +1,129 @@
+//
+// ServicePointManager.cs
+//
+// Author:
+//       Rolf Bjarne Kvinge <rolf@xamarin.com>
+//
+// Copyright (c) 2016 Xamarin, Inc.
+//
+// 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.Net.Security;
+
+namespace System.Net
+{
+       public partial class ServicePointManager {
+               const string EXCEPTION_MESSAGE = "System.Net.ServicePointManager is not supported on the current platform.";
+
+               public const int DefaultNonPersistentConnectionLimit = 4;
+#if MOBILE
+               public const int DefaultPersistentConnectionLimit = 10;
+#else
+               public const int DefaultPersistentConnectionLimit = 2;
+#endif
+
+               private ServicePointManager ()
+               {
+               }
+
+               public static ICertificatePolicy CertificatePolicy {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public static bool CheckCertificateRevocationList {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public static int DefaultConnectionLimit {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public static int DnsRefreshTimeout {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public static bool EnableDnsRoundRobin {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public static int MaxServicePointIdleTime {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public static int MaxServicePoints {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public static bool ReusePort {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public static SecurityProtocolType SecurityProtocol {
+                       get;
+                       set;
+               } = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
+
+               public static RemoteCertificateValidationCallback ServerCertificateValidationCallback {
+                       get;
+                       set;
+               }
+
+               public static EncryptionPolicy EncryptionPolicy {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public static bool Expect100Continue {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public static bool UseNagleAlgorithm {
+                       get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+                       set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+               }
+
+               public static void SetTcpKeepAlive (bool enabled, int keepAliveTime, int keepAliveInterval)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public static ServicePoint FindServicePoint (Uri address)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public static ServicePoint FindServicePoint (string uriString, IWebProxy proxy)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
+               public static ServicePoint FindServicePoint (Uri address, IWebProxy proxy)
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+       }
+}
index 04ffdaf55ce70a60c98bc578b128978027a03581..6a2107c97735732d329d72fc383e00cc209510b2 100644 (file)
@@ -81,14 +81,14 @@ namespace System.Net
                                return running;
                        }, inner => {
                                if (inner.GotException) {
-                                       if (inner.CompletedSynchronously)
+                                       if (inner.synch)
                                                Monitor.Exit (locker);
                                        callback (inner);
                                        return;
                                }
 
                                try {
-                                       if (!inner.CompletedSynchronously)
+                                       if (!inner.synch)
                                                Monitor.Enter (locker);
 
                                        callback (inner);
@@ -186,8 +186,30 @@ namespace System.Net
                        }
                }
 
+               bool? user_read_synch;
+
                public bool CompletedSynchronously {
-                       get { return synch; }
+                       get {
+                               //
+                               // CompletedSynchronously (for System.Net networking stack) means "was the operation completed before the first time
+                               // that somebody asked if it was completed synchronously"? They do this because some of their asynchronous operations
+                               // (particularly those in the Socket class) will avoid the cost of capturing and transferring the ExecutionContext
+                               // to the callback thread by checking CompletedSynchronously, and calling the callback from within BeginXxx instead of
+                               // on the completion port thread if the native winsock call completes quickly.
+                               //
+                               // TODO: racy
+                               if (user_read_synch != null)
+                                       return user_read_synch.Value;
+
+                               user_read_synch = synch;
+                               return user_read_synch.Value;
+                       }
+               }
+
+               internal bool CompletedSynchronouslyPeek {
+                       get {
+                               return synch;
+                       }
                }
 
                public bool IsCompleted {
index 5178569f3c253e058238876545bddbc2d00b75dc..0a36e21004943427b937884ef9993d703c7a2c9c 100644 (file)
@@ -83,7 +83,6 @@ namespace System.Net
                HttpWebRequest connect_request;
 
                Exception connect_exception;
-               static object classLock = new object ();
                MonoTlsStream tlsStream;
 
 #if MONOTOUCH && !MONOTOUCH_TV && !MONOTOUCH_WATCH
@@ -257,14 +256,16 @@ namespace System.Net
                                        connect_request.Credentials = creds;
                                }
 
-                               for (int i = 0; i < challenge.Length; i++) {
-                                       var auth = AuthenticationManager.Authenticate (challenge [i], connect_request, creds);
-                                       if (auth == null)
-                                               continue;
-                                       ntlm = (auth.ModuleAuthenticationType == "NTLM");
-                                       sb.Append ("\r\nProxy-Authorization: ");
-                                       sb.Append (auth.Message);
-                                       break;
+                               if (creds != null) {
+                                       for (int i = 0; i < challenge.Length; i++) {
+                                               var auth = AuthenticationManager.Authenticate (challenge [i], connect_request, creds);
+                                               if (auth == null)
+                                                       continue;
+                                               ntlm = (auth.ModuleAuthenticationType == "NTLM");
+                                               sb.Append ("\r\nProxy-Authorization: ");
+                                               sb.Append (auth.Message);
+                                               break;
+                                       }
                                }
                        }
 
@@ -292,11 +293,14 @@ namespace System.Net
                                }
 
                                Data.StatusCode = status;
-                               Data.Challenge = result.GetValues ("Proxy-Authentic");
+                               Data.Challenge = result.GetValues ("Proxy-Authenticate");
+                               Data.Headers = result;
                                return false;
-                       } else if (status != 200) {
-                               string msg = String.Format ("The remote server returned a {0} status code.", status);
-                               HandleError (WebExceptionStatus.SecureChannelFailure, null, msg);
+                       }
+
+                       if (status != 200) {
+                               Data.StatusCode = status;
+                               Data.Headers = result;
                                return false;
                        }
 
@@ -368,6 +372,9 @@ namespace System.Net
                                        }
 
                                        status = (int)UInt32.Parse (parts [1]);
+                                       if (parts.Length >= 3)
+                                               Data.StatusDescription = String.Join (" ", parts, 2, parts.Length - 2);
+
                                        gotStatus = true;
                                }
                        }
@@ -670,7 +677,7 @@ namespace System.Net
                                                var value = s.Substring (pos_s + 1).Trim ();
 
                                                var h = data.Headers;
-                                               if (h.AllowMultiValues (header)) {
+                                               if (WebHeaderCollection.AllowMultiValues (header)) {
                                                        h.AddInternal (header, value);
                                                } else  {
                                                        h.SetInternal (header, value);
@@ -736,6 +743,15 @@ namespace System.Net
                                        goto retry;
 
                                Exception cnc_exc = connect_exception;
+                               if (cnc_exc == null && (Data.StatusCode == 401 || Data.StatusCode == 407)) {
+                                       st = WebExceptionStatus.ProtocolError;
+                                       if (Data.Headers == null)
+                                               Data.Headers = new WebHeaderCollection ();
+
+                                       var webResponse = new HttpWebResponse (sPoint.Address, "CONNECT", Data, null);
+                                       cnc_exc = new WebException (Data.StatusCode == 407 ? "(407) Proxy Authentication Required" : "(401) Unauthorized", null, st, webResponse);
+                               }
+                       
                                connect_exception = null;
                                request.SetWriteStreamError (st, cnc_exc);
                                Close (true);
index 9f8ed04955b1036095f1b64d5c87482c010e7958..e01d5306adb07fd60c06664de78c6f186bab8ccd 100644 (file)
@@ -719,12 +719,12 @@ namespace System.Net
 
                        SetHeadersAsync (true, inner => {
                                if (inner.GotException) {
-                                       result.SetCompleted (inner.CompletedSynchronously, inner.Exception);
+                                       result.SetCompleted (inner.CompletedSynchronouslyPeek, inner.Exception);
                                        return;
                                }
 
                                if (cnc.Data.StatusCode != 0 && cnc.Data.StatusCode != 100) {
-                                       result.SetCompleted (inner.CompletedSynchronously);
+                                       result.SetCompleted (inner.CompletedSynchronouslyPeek);
                                        return;
                                }
 
@@ -735,7 +735,7 @@ namespace System.Net
 
                                if (length == 0) {
                                        complete_request_written = true;
-                                       result.SetCompleted (inner.CompletedSynchronously);
+                                       result.SetCompleted (inner.CompletedSynchronouslyPeek);
                                        return;
                                }
 
index 97b7b1c70c78e41f3e330d57ccee2a304d288278..c9754ea29997238d897cbc86e023eda7b1852677 100644 (file)
@@ -34,16 +34,16 @@ namespace System.Security.AccessControl {
        public sealed class SemaphoreAccessRule : AccessRule
        {
                public SemaphoreAccessRule (IdentityReference identity,
-                                           SemaphoreRights semaphoreRights,
+                                           SemaphoreRights eventRights,
                                            AccessControlType type)
-                       : base (identity, (int)semaphoreRights, false, InheritanceFlags.None, PropagationFlags.None, type)
+                       : base (identity, (int)eventRights, false, InheritanceFlags.None, PropagationFlags.None, type)
                {
                }
 
                public SemaphoreAccessRule (string identity,
-                                           SemaphoreRights semaphoreRights,
+                                           SemaphoreRights eventRights,
                                            AccessControlType type)
-                       : this (new NTAccount (identity), semaphoreRights, type)
+                       : this (new NTAccount (identity), eventRights, type)
                {
                }
                
index 5680f0f7ed812f36303b1a560f9266acdda8ec09..acc495ce45d1508752dcdf4a1700a2c322c40131 100644 (file)
@@ -35,9 +35,9 @@ namespace System.Security.AccessControl {
                : AuditRule
        {
                public SemaphoreAuditRule (IdentityReference identity,
-                                          SemaphoreRights semaphoreRights,
+                                          SemaphoreRights eventRights,
                                           AuditFlags flags)
-                       : base (identity, (int)semaphoreRights, false, InheritanceFlags.None, PropagationFlags.None, flags)
+                       : base (identity, (int)eventRights, false, InheritanceFlags.None, PropagationFlags.None, flags)
                {
                }
                
index ac6db80037dfe506d1b2da49ad07c8196424eb33..2d7dd557095b3061703d872fd14f33aeff1e6d2f 100644 (file)
@@ -133,7 +133,7 @@ namespace System.Security.AccessControl
                        SetAuditRule((AuditRule)rule);
                }
                
-               internal new void Persist (SafeHandle handle)
+               internal void Persist (SafeHandle handle)
                {
                        WriteLock();
                        try {
diff --git a/mcs/class/System/System.Security.Authentication.ExtendedProtection/ServiceNameCollection.cs b/mcs/class/System/System.Security.Authentication.ExtendedProtection/ServiceNameCollection.cs
deleted file mode 100644 (file)
index 3fa9b3f..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-//
-// ServiceNameCollection.cs
-//
-// Authors:
-//      Atsushi Enomoto  <atsushi@ximian.com>
-//
-
-//
-// Copyright (C) 2010 Novell, Inc (http://novell.com)
-//
-// 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;
-
-namespace System.Security.Authentication.ExtendedProtection
-{
-       [MonoTODO]
-       [Serializable]
-       public class ServiceNameCollection : ReadOnlyCollectionBase
-       {
-               public ServiceNameCollection (ICollection items)
-               {
-                       throw new NotImplementedException ();
-               }
-
-               public ServiceNameCollection Merge (IEnumerable serviceNames)
-               {
-                       throw new NotImplementedException ();
-               }
-               
-               public ServiceNameCollection Merge (string serviceName)
-               {
-                       throw new NotImplementedException ();
-               }
-
-               public bool Contains (string searchServiceName)
-               {
-                       throw new NotImplementedException ();
-               }
-       }
-}
-
index 98f5dfc4ab5ff882f16b55cab3d03f937dde8611..6f5cf7042b012493e7030fb6188bc69bf1f6cbee 100644 (file)
 //
 #if SECURITY_DEP
 
-using XX509CertificateCollection = System.Security.Cryptography.X509Certificates.X509CertificateCollection;
-
 using System;
 using System.Runtime.InteropServices;
+using System.Security.Cryptography.X509Certificates;
 
 namespace System.Security.Cryptography.X509Certificates {
 
@@ -107,7 +106,7 @@ namespace System.Security.Cryptography.X509Certificates {
                        return handle;
                }
                
-               public static SecTrustResult TrustEvaluateSsl (XX509CertificateCollection certificates, XX509CertificateCollection anchors, string host)
+               public static SecTrustResult TrustEvaluateSsl (X509CertificateCollection certificates, X509CertificateCollection anchors, string host)
                {
                        if (certificates == null)
                                return SecTrustResult.Deny;
@@ -119,7 +118,7 @@ namespace System.Security.Cryptography.X509Certificates {
                        }
                }
 
-               static SecTrustResult _TrustEvaluateSsl (XX509CertificateCollection certificates, XX509CertificateCollection anchors, string hostName)
+               static SecTrustResult _TrustEvaluateSsl (X509CertificateCollection certificates, X509CertificateCollection anchors, string hostName)
                {
                        int certCount = certificates.Count;
                        int anchorCount = anchors != null ? anchors.Count : 0;
@@ -147,7 +146,7 @@ namespace System.Security.Cryptography.X509Certificates {
 
                                certArray = FromIntPtrs (secCerts);
 
-                               if (!string.IsNullOrEmpty (hostName))
+                               if (hostName != null)
                                        host = CFStringCreateWithCharacters (IntPtr.Zero, hostName, (IntPtr) hostName.Length);
                                sslsecpolicy = SecPolicyCreateSSL (true, host);
 
index 795f0d04b21acfabb51a09db288cfa3ccfecd274..78a87057ce7e65b89198e52ddbd940bd4c514246 100644 (file)
@@ -124,7 +124,6 @@ namespace System.Security.Cryptography.X509Certificates {
                }
 
                internal X500DistinguishedName (byte[] encoded, byte[] canonEncoding, string name)
-                       : this (encoded)
                {
                        this.canonEncoding = canonEncoding;
                        this.name = name;
@@ -234,7 +233,7 @@ namespace System.Security.Cryptography.X509Certificates {
                                if (name1.canonEncoding.Length != name2.canonEncoding.Length)
                                        return false;
                                for (int i = 0; i < name1.canonEncoding.Length; i++) {
-                                       if (name1.canonEncoding[i] != name2.canonEncoding[2])
+                                       if (name1.canonEncoding[i] != name2.canonEncoding[i])
                                                return false;
                                }
                                return true;
index 29decab439faa252aeb371c167e754684e7f9ec9..ef10413f59722853150a79935cca076d7e1fbcae 100644 (file)
@@ -45,6 +45,7 @@ using MX = Mono.Security.X509;
 using System.IO;
 using System.Text;
 using System.Collections;
+using System.Runtime.Serialization;
 
 namespace System.Security.Cryptography.X509Certificates {
 
@@ -134,6 +135,10 @@ namespace System.Security.Cryptography.X509Certificates {
                {
                }
 
+               protected X509Certificate2 (SerializationInfo info, StreamingContext context) : base (info, context)
+               {
+               }
+
                internal X509Certificate2 (X509Certificate2Impl impl)
                        : base (impl)
                {
@@ -394,13 +399,10 @@ namespace System.Security.Cryptography.X509Certificates {
                // internal stuff because X509Certificate2 isn't complete enough
                // (maybe X509Certificate3 will be better?)
 
-               [Obsolete ("KILL")]
+               [MonoTODO ("See comment in X509Helper2.GetMonoCertificate().")]
                internal MX.X509Certificate MonoCertificate {
                        get {
-                               var monoImpl = Impl as X509Certificate2ImplMono;
-                               if (monoImpl == null)
-                                       throw new NotSupportedException ();
-                               return monoImpl.MonoCertificate;
+                               return X509Helper2.GetMonoCertificate (this);
                        }
                }
 
index 234d0907f2dbcaedf74a722b331e2083aaebf8af..38797d55fcee583b75ca47f09158b8dea078a3dd 100644 (file)
@@ -71,6 +71,10 @@ namespace System.Security.Cryptography.X509Certificates
                        get;
                }
 
+               internal abstract X509Certificate2Impl FallbackImpl {
+                       get;
+               }
+
                public abstract string GetNameInfo (X509NameType nameType, bool forIssuer);
 
                public abstract void Import (byte[] rawData, string password, X509KeyStorageFlags keyStorageFlags);
index cdc14c49eb13e2d2479c961ce8e9a4a4243ce484..ff2449906de7c2f8a45bb405397aed669f6e557e 100644 (file)
@@ -52,7 +52,6 @@ namespace System.Security.Cryptography.X509Certificates
        {
                bool _archived;
                X509ExtensionCollection _extensions;
-               string _serial;
                PublicKey _publicKey;
                X500DistinguishedName issuer_name;
                X500DistinguishedName subject_name;
@@ -483,6 +482,7 @@ namespace System.Security.Cryptography.X509Certificates
                [MonoTODO ("missing KeyStorageFlags support")]
                public override void Import (byte[] rawData, string password, X509KeyStorageFlags keyStorageFlags)
                {
+                       Reset ();
                        MX.X509Certificate cert = null;
                        if (password == null) {
                                try {
@@ -558,7 +558,6 @@ namespace System.Security.Cryptography.X509Certificates
                        _cert = null;
                        _archived = false;
                        _extensions = null;
-                       _serial = null;
                        _publicKey = null;
                        issuer_name = null;
                        subject_name = null;
@@ -718,6 +717,10 @@ namespace System.Security.Cryptography.X509Certificates
                internal MX.X509Certificate MonoCertificate {
                        get { return _cert; }
                }
+
+               internal override X509Certificate2Impl FallbackImpl {
+                       get { return this; }
+               }
        }
 }
 
index 0ea1c8e9b06ab45d4c27b716de5b7fcdea4c1e4b..a3323c8ef0c4b7d15a57dc0220289d54a6c58296 100644 (file)
@@ -47,8 +47,6 @@ namespace System.Security.Cryptography.X509Certificates {
 
                X509ChainImpl impl;
 
-               static X509ChainStatus[] Empty = new X509ChainStatus [0];
-
                internal X509ChainImpl Impl {
                        get {
                                X509Helper2.ThrowIfContextInvalid (impl);
index 1dc234575b86a3cb6806c7b471f8d0ba8ec9f694..2fcdd982f33366e8b1b163a1aa178947232fbd74 100644 (file)
@@ -91,6 +91,9 @@ namespace System.Security.Cryptography.X509Certificates {
                                }
                                return store2;
                        }
+                       internal set {
+                               store2 = value;
+                       }
                }
 
                public X509RevocationFlag RevocationFlag {
index 2a9163a346f89ae143e7477b9215c67659f5e875..7d0b3d1487cda4b4b5a74edbc957997fa56556f1 100644 (file)
@@ -33,14 +33,57 @@ extern alias MonoSecurity;
 
 #if MONO_SECURITY_ALIAS
 using MonoSecurity::Mono.Security.Interface;
+using MX = MonoSecurity::Mono.Security.X509;
 #else
+#if MONO_FEATURE_BTLS
 using Mono.Security.Interface;
 #endif
+using MX = Mono.Security.X509;
+#endif
+
+#if MONO_FEATURE_BTLS
+using Mono.Btls;
+#endif
+#endif
+
+using System.IO;
+using System.Text;
 
 namespace System.Security.Cryptography.X509Certificates
 {
        internal static class X509Helper2
        {
+               internal static long GetSubjectNameHash (X509Certificate certificate)
+               {
+                       return GetSubjectNameHash (certificate.Impl);
+               }
+
+               internal static long GetSubjectNameHash (X509CertificateImpl impl)
+               {
+#if SECURITY_DEP
+                       using (var x509 = GetNativeInstance (impl))
+                               return GetSubjectNameHash (x509);
+#else
+                       throw new NotSupportedException ();
+#endif
+               }
+
+               internal static void ExportAsPEM (X509Certificate certificate, Stream stream, bool includeHumanReadableForm)
+               {
+                       ExportAsPEM (certificate.Impl, stream, includeHumanReadableForm);
+               }
+
+               internal static void ExportAsPEM (X509CertificateImpl impl, Stream stream, bool includeHumanReadableForm)
+               {
+#if SECURITY_DEP
+                       using (var x509 = GetNativeInstance (impl))
+                               ExportAsPEM (x509, stream, includeHumanReadableForm);
+#else
+                       throw new NotSupportedException ();
+#endif
+               }
+
+#if SECURITY_DEP
                internal static void Initialize ()
                {
                        X509Helper.InstallNativeHelper (new MyNativeHelper ());
@@ -51,32 +94,90 @@ namespace System.Security.Cryptography.X509Certificates
                        X509Helper.ThrowIfContextInvalid (impl);
                }
 
-               internal static X509Certificate2Impl Import (byte[] rawData, string password, X509KeyStorageFlags keyStorageFlags)
+#if !MONO_FEATURE_BTLS
+               static X509Certificate GetNativeInstance (X509CertificateImpl impl)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+#else
+               static MonoBtlsX509 GetNativeInstance (X509CertificateImpl impl)
                {
-                       var provider = MonoTlsProviderFactory.GetProvider ();
-                       if (provider.HasNativeCertificates) {
-                               var impl = provider.GetNativeCertificate (rawData, password, keyStorageFlags);
-                               return impl;
-                       } else {
-                               var impl = new X509Certificate2ImplMono ();
-                               impl.Import (rawData, password, keyStorageFlags);
-                               return impl;
+                       ThrowIfContextInvalid (impl);
+                       var btlsImpl = impl as X509CertificateImplBtls;
+                       if (btlsImpl != null)
+                               return btlsImpl.X509.Copy ();
+                       else
+                               return MonoBtlsX509.LoadFromData (impl.GetRawCertData (), MonoBtlsX509Format.DER);
+               }
+
+               internal static long GetSubjectNameHash (MonoBtlsX509 x509)
+               {
+                       using (var subject = x509.GetSubjectName ())
+                               return subject.GetHash ();
+               }
+
+               internal static void ExportAsPEM (MonoBtlsX509 x509, Stream stream, bool includeHumanReadableForm)
+               {
+                       using (var bio = MonoBtlsBio.CreateMonoStream (stream)) {
+                               x509.ExportAsPEM (bio, includeHumanReadableForm);
+                       }
+               }
+#endif // !MONO_FEATURE_BTLS
+
+               internal static X509Certificate2Impl Import (byte[] rawData, string password, X509KeyStorageFlags keyStorageFlags, bool disableProvider = false)
+               {
+#if MONO_FEATURE_BTLS
+                       if (!disableProvider) {
+                               var provider = MonoTlsProviderFactory.GetProvider ();
+                               if (provider.HasNativeCertificates) {
+                                       var impl = provider.GetNativeCertificate (rawData, password, keyStorageFlags);
+                                       return impl;
+                               }
                        }
+#endif // MONO_FEATURE_BTLS
+                       var impl2 = new X509Certificate2ImplMono ();
+                       impl2.Import (rawData, password, keyStorageFlags);
+                       return impl2;
                }
 
-               internal static X509Certificate2Impl Import (X509Certificate cert)
+               internal static X509Certificate2Impl Import (X509Certificate cert, bool disableProvider = false)
                {
-                       var provider = MonoTlsProviderFactory.GetProvider ();
-                       if (provider.HasNativeCertificates) {
-                               var impl = provider.GetNativeCertificate (cert);
-                               return impl;
+#if MONO_FEATURE_BTLS
+                       if (!disableProvider) {
+                               var provider = MonoTlsProviderFactory.GetProvider ();
+                               if (provider.HasNativeCertificates) {
+                                       var impl = provider.GetNativeCertificate (cert);
+                                       return impl;
+                               }
                        }
+#endif // MONO_FEATURE_BTLS
                        var impl2 = cert.Impl as X509Certificate2Impl;
                        if (impl2 != null)
                                return (X509Certificate2Impl)impl2.Clone ();
                        return Import (cert.GetRawCertData (), null, X509KeyStorageFlags.DefaultKeySet);
                }
 
+               /*
+                * This is used by X509ChainImplMono
+                * 
+                * Some of the missing APIs such as X509v3 extensions can be added to the native
+                * BTLS implementation.
+                * 
+                * We should also consider replacing X509ChainImplMono with a new X509ChainImplBtls
+                * at some point.
+                */
+               [MonoTODO ("Investigate replacement; see comments in source.")]
+               internal static MX.X509Certificate GetMonoCertificate (X509Certificate2 certificate)
+               {
+                       var impl2 = certificate.Impl as X509Certificate2Impl;
+                       if (impl2 == null)
+                               impl2 = Import (certificate, true);
+                       var fallbackImpl = impl2.FallbackImpl as X509Certificate2ImplMono;
+                       if (fallbackImpl == null)
+                               throw new NotSupportedException ();
+                       return fallbackImpl.MonoCertificate;
+               }
+
                internal static X509ChainImpl CreateChainImpl (bool useMachineContext)
                {
                        return new X509ChainImplMono (useMachineContext);
@@ -111,6 +212,6 @@ namespace System.Security.Cryptography.X509Certificates
                                return X509Helper2.Import (cert);
                        }
                }
+#endif
        }
 }
-#endif
index 15de9f7b3cce674e63d8f7dd3a41c22ae2bbe0a0..192c9bd4d7516a27092e22ed6959429e07f826aa 100644 (file)
@@ -94,14 +94,14 @@ namespace System.Security.Cryptography.X509Certificates {
 
                // methods
 
-               public override void CopyFrom (AsnEncodedData encodedData)
+               public override void CopyFrom (AsnEncodedData asnEncodedData)
                {
-                       if (encodedData == null)
-                               throw new ArgumentNullException ("encodedData");
+                       if (asnEncodedData == null)
+                               throw new ArgumentNullException ("asnEncodedData");
 
-                       X509Extension ex = (encodedData as X509Extension);
+                       X509Extension ex = (asnEncodedData as X509Extension);
                        if (ex == null)
-                               throw new ArgumentException (Locale.GetText ("Wrong type."), "encodedData");
+                               throw new ArgumentException (Locale.GetText ("Wrong type."), "asnEncodedData");
 
                        if (ex._oid == null)
                                _oid = new Oid (oid, friendlyName);
index 89e7afb963c119867ef2340516653ac879ac7855..bf24e85f8c6ce674e451b0680a5ea6fc56b294d1 100644 (file)
@@ -159,14 +159,14 @@ namespace System.Security.Cryptography.X509Certificates {
 
                // methods
 
-               public override void CopyFrom (AsnEncodedData encodedData)
+               public override void CopyFrom (AsnEncodedData asnEncodedData)
                {
-                       if (encodedData == null)
-                               throw new ArgumentNullException ("encodedData");
+                       if (asnEncodedData == null)
+                               throw new ArgumentNullException ("asnEncodedData");
 
-                       X509Extension ex = (encodedData as X509Extension);
+                       X509Extension ex = (asnEncodedData as X509Extension);
                        if (ex == null)
-                               throw new ArgumentException (Locale.GetText ("Wrong type."), "encodedData");
+                               throw new ArgumentException (Locale.GetText ("Wrong type."), "asnEncodedData");
 
                        if (ex._oid == null)
                                _oid = new Oid (oid, friendlyName);
index abb1faf58183a6b9e62820befc3bc07cf497b3aa..d404a646402a9b9cc3738de38e4b90cc26c518c8 100644 (file)
@@ -148,11 +148,9 @@ System.Diagnostics/PerformanceCounterPermissionEntryCollection.cs
 System.Diagnostics/PerformanceCounterPermissionEntry.cs
 System.Diagnostics/PerformanceCounterType.cs
 System.Diagnostics/Process.cs
-System.Diagnostics/ProcessModuleCollection.cs
 System.Diagnostics/ProcessModule.cs
 System.Diagnostics/ProcessPriorityClass.cs
 System.Diagnostics/ProcessStartInfo.cs
-System.Diagnostics/ProcessThreadCollection.cs
 System.Diagnostics/ProcessThread.cs
 System.Diagnostics/ProcessWindowStyle.cs
 System.Diagnostics/Stopwatch.cs
@@ -162,8 +160,8 @@ System.Diagnostics/ThreadWaitReason.cs
 System.Diagnostics/TraceImpl.cs
 System.Diagnostics/TraceSourceInfo.cs
 System.Diagnostics/Win32EventLog.cs
-System.Diagnostics.CodeAnalysis/ExcludeFromCodeCoverageAttribute.cs
 System/Platform.cs
+System/MonoToolsLocator.cs
 System.IO.Compression/CompressionLevel.cs
 System.IO.Compression/CompressionMode.cs
 System.IO.Compression/DeflateStream.cs
@@ -271,6 +269,7 @@ System.Net/HttpListener.cs
 System.Net/HttpListenerPrefixCollection.cs
 System.Net/HttpListenerRequest.cs
 System.Net/HttpListenerResponse.cs
+System.Net/HttpListenerResponseHelper.cs
 System.Net/HttpListenerTimeoutManager.cs
 System.Net/HttpRequestCreator.cs
 System.Net/HttpStreamAsyncResult.cs
@@ -338,7 +337,6 @@ System.Net.Mail/SmtpStatusCode.cs
 System.Net/MacProxy.cs
 System.Net/MonoHttpDate.cs
 System.Net/NetConfig.cs
-System.Net/NetworkCredential.cs
 System.Net.NetworkInformation/IcmpV4Statistics.cs
 System.Net.NetworkInformation/IcmpV6Statistics.cs
 System.Net.NetworkInformation/IPAddressCollection.cs
@@ -376,35 +374,14 @@ System.Net/ServicePointManager.extra.cs
 System.Net/SimpleAsyncResult.cs
 System.Net/SocketPermissionAttribute.cs
 System.Net/SocketPermission.cs
-../referencesource/System/net/System/Net/Sockets/AddressFamily.cs
-../referencesource/System/net/System/Net/Sockets/IOControlCode.cs
-../referencesource/System/net/System/Net/Sockets/IPPacketInformation.cs
-../referencesource/System/net/System/Net/Sockets/LingerOption.cs
-../referencesource/System/net/System/Net/Sockets/MulticastOption.cs
-../referencesource/System/net/System/Net/Sockets/ProtocolFamily.cs
-../referencesource/System/net/System/Net/Sockets/ProtocolType.cs
 System.Net.Sockets/SafeSocketHandle.cs
-../referencesource/System/net/System/Net/Sockets/SelectMode.cs
-System.Net.Sockets/SendPacketsElement.cs
 System.Net.Sockets/Socket.cs
 System.Net.Sockets/SocketAsyncEventArgs.cs
-System.Net.Sockets/SocketAsyncOperation.cs
 System.Net.Sockets/SocketAsyncResult.cs
-../referencesource/System/net/System/Net/Sockets/SocketErrors.cs
-../referencesource/System/net/System/Net/SocketException.cs
-../referencesource/System/net/System/Net/Sockets/SocketFlags.cs
-../referencesource/System/net/System/Net/Sockets/SocketInformation.cs
-../referencesource/System/net/System/Net/Sockets/SocketInformationOptions.cs
 System.Net.Sockets/SocketOperation.cs
-../referencesource/System/net/System/Net/Sockets/SocketOptionLevel.cs
-../referencesource/System/net/System/Net/Sockets/SocketOptionName.cs
-../referencesource/System/net/System/Net/Sockets/SocketShutdown.cs
-../referencesource/System/net/System/Net/Sockets/SocketType.cs
-System.Net.Sockets/TcpClient.cs
-System.Net.Sockets/TcpListener.cs
-../referencesource/System/net/System/Net/Sockets/TransmitFileFlags.cs
-System.Net.Sockets/UdpClient.cs
-../referencesource/System/net/System/Net/Sockets/UdpReceiveResult.cs
+System.Net.Sockets/SocketReceiveFromResult.cs
+System.Net.Sockets/SocketReceiveMessageFromResult.cs
+System.Net.Sockets/SocketTaskExtensions.cs
 System.Net/WebAsyncResult.cs
 System.Net/WebConnection.cs
 System.Net/WebConnectionData.cs
@@ -437,7 +414,6 @@ System.Security.Authentication.ExtendedProtection/ExtendedProtectionPolicy.cs
 System.Security.Authentication.ExtendedProtection/ExtendedProtectionPolicyTypeConverter.cs
 System.Security.Authentication.ExtendedProtection/PolicyEnforcement.cs
 System.Security.Authentication.ExtendedProtection/ProtectionScenario.cs
-System.Security.Authentication.ExtendedProtection/ServiceNameCollection.cs
 System.Security.Authentication.ExtendedProtection.Configuration/ConfigUtil.cs
 System.Security.Authentication.ExtendedProtection.Configuration/ExtendedProtectionPolicyElement.cs
 System.Security.Authentication.ExtendedProtection.Configuration/ServiceNameElement.cs
@@ -539,6 +515,44 @@ System.Windows.Input/ICommand.cs
 
 System/IOSelector.cs
 
+Mono.Btls/MonoBtlsBio.cs
+Mono.Btls/MonoBtlsContext.cs
+Mono.Btls/MonoBtlsError.cs
+Mono.Btls/MonoBtlsException.cs
+Mono.Btls/MonoBtlsKey.cs
+Mono.Btls/MonoBtlsObject.cs
+Mono.Btls/MonoBtlsPkcs12.cs
+Mono.Btls/MonoBtlsProvider.cs
+Mono.Btls/MonoBtlsSsl.cs
+Mono.Btls/MonoBtlsSslCtx.cs
+Mono.Btls/MonoBtlsSslError.cs
+Mono.Btls/MonoBtlsStream.cs
+Mono.Btls/MonoBtlsUtils.cs
+Mono.Btls/MonoBtlsX509.cs
+Mono.Btls/MonoBtlsX509Chain.cs
+Mono.Btls/MonoBtlsX509Crl.cs
+Mono.Btls/MonoBtlsX509Error.cs
+Mono.Btls/MonoBtlsX509Exception.cs
+Mono.Btls/MonoBtlsX509FileType.cs
+Mono.Btls/MonoBtlsX509Format.cs
+Mono.Btls/MonoBtlsX509Lookup.cs
+Mono.Btls/MonoBtlsX509LookupMonoCollection.cs
+Mono.Btls/MonoBtlsX509LookupMono.cs
+Mono.Btls/MonoBtlsX509LookupType.cs
+Mono.Btls/MonoBtlsX509Name.cs
+Mono.Btls/MonoBtlsX509NameEntryType.cs
+Mono.Btls/MonoBtlsX509Purpose.cs
+Mono.Btls/MonoBtlsX509Revoked.cs
+Mono.Btls/MonoBtlsX509Store.cs
+Mono.Btls/MonoBtlsX509StoreCtx.cs
+Mono.Btls/MonoBtlsX509StoreManager.cs
+Mono.Btls/MonoBtlsX509StoreType.cs
+Mono.Btls/MonoBtlsX509TrustKind.cs
+Mono.Btls/MonoBtlsX509VerifyFlags.cs
+Mono.Btls/MonoBtlsX509VerifyParam.cs
+Mono.Btls/X509CertificateImplBtls.cs
+Mono.Btls/X509ChainImplBtls.cs
+
 Mono.Net.Security/AsyncProtocolRequest.cs
 Mono.Net.Security/CallbackHelpers.cs
 Mono.Net.Security/ChainValidationHelper.cs
@@ -547,11 +561,10 @@ Mono.Net.Security/IMonoSslStream.cs
 Mono.Net.Security/LegacySslStream.cs
 Mono.Net.Security/MobileAuthenticatedStream.cs
 Mono.Net.Security/MobileTlsContext.cs
-Mono.Net.Security/MonoLegacyTlsProvider.cs
+Mono.Net.Security/LegacyTlsProvider.cs
 Mono.Net.Security/MonoSslStreamImpl.cs
 Mono.Net.Security/MonoSslStreamWrapper.cs
 Mono.Net.Security/MonoTlsProviderFactory.cs
-Mono.Net.Security/MonoTlsProviderImpl.cs
 Mono.Net.Security/MonoTlsProviderWrapper.cs
 Mono.Net.Security/MonoTlsStream.cs
 Mono.Net.Security/NoReflectionHelper.cs
@@ -563,7 +576,6 @@ ReferenceSources/BinaryCompatibility.cs
 ReferenceSources/ConfigurationManagerInternalFactory.cs
 ReferenceSources/CAPI.cs
 ReferenceSources/EnvironmentHelpers.cs
-ReferenceSources/Internal.cs
 ReferenceSources/HttpApi.cs
 ReferenceSources/HttpSysSettings.cs
 ReferenceSources/LocalAppContextSwitches.cs
@@ -571,20 +583,13 @@ ReferenceSources/Logging.cs
 ReferenceSources/NativeMethods.cs
 ReferenceSources/RequestCacheProtocol.cs
 ReferenceSources/SettingsSectionInternal.cs
+ReferenceSources/SecureStringHelper.cs
 ReferenceSources/Socket.cs
 ReferenceSources/SR.cs
 ReferenceSources/SR2.cs
 ReferenceSources/SRCategoryAttribute.cs
 ReferenceSources/Win32Exception.cs
 
-ReferenceSources/SSPIConfiguration.cs
-ReferenceSources/SSPISafeHandles.cs
-ReferenceSources/SSPIWrapper.cs
-ReferenceSources/SslStream.cs
-ReferenceSources/_SecureChannel.cs
-ReferenceSources/_SslState.cs
-ReferenceSources/_SslStream.cs
-
 ../referencesource/System/misc/PrivilegedConfigurationManager.cs
 ../referencesource/System/regex/system/text/regularexpressions/Regex.cs
 ../referencesource/System/regex/system/text/regularexpressions/RegexBoyerMoore.cs
@@ -982,6 +987,7 @@ ReferenceSources/_SslStream.cs
 ../referencesource/System/net/System/Net/_ProxyChain.cs
 ../referencesource/System/net/System/Net/_ScatterGatherBuffers.cs
 ../referencesource/System/net/System/Net/_Semaphore.cs
+../referencesource/System/net/System/Net/_ServiceNameStore.cs
 ../referencesource/System/net/System/Net/_TimerThread.cs
 ../referencesource/System/net/System/Net/_WebProxyDataBuilder.cs
 ../referencesource/System/net/System/Net/AuthenticationScheme.cs
@@ -1017,6 +1023,7 @@ ReferenceSources/_SslStream.cs
 ../referencesource/System/net/System/Net/IWebProxyFinder.cs
 ../referencesource/System/net/System/Net/IWebRequestCreate.cs
 ../referencesource/System/net/System/Net/NetworkAccess.cs
+../referencesource/System/net/System/Net/NetworkCredential.cs
 ../referencesource/System/net/System/Net/ProtocolViolationException.cs
 ../referencesource/System/net/System/Net/TransportContext.cs
 ../referencesource/System/net/System/Net/TransportType.cs
@@ -1024,6 +1031,7 @@ ReferenceSources/_SslStream.cs
 ../referencesource/System/net/System/Net/UnicodeEncodingConformance.cs
 ../referencesource/System/net/System/Net/ServicePointManager.cs
 ../referencesource/System/net/System/Net/SocketAddress.cs
+../referencesource/System/net/System/Net/SocketException.cs
 ../referencesource/System/net/System/Net/webclient.cs
 ../referencesource/System/net/System/Net/WebException.cs
 ../referencesource/System/net/System/Net/WebExceptionStatus.cs
@@ -1043,8 +1051,31 @@ ReferenceSources/_SslStream.cs
 
 ../referencesource/System/net/System/Net/Configuration/DefaultProxySection.cs
 
+../referencesource/System/net/System/Net/Sockets/_MultipleConnectAsync.cs
+../referencesource/System/net/System/Net/Sockets/AddressFamily.cs
+../referencesource/System/net/System/Net/Sockets/IOControlCode.cs
+../referencesource/System/net/System/Net/Sockets/IPPacketInformation.cs
 ../referencesource/System/net/System/Net/Sockets/IPProtectionLevel.cs
+../referencesource/System/net/System/Net/Sockets/LingerOption.cs
+../referencesource/System/net/System/Net/Sockets/MulticastOption.cs
 ../referencesource/System/net/System/Net/Sockets/NetworkStream.cs
+../referencesource/System/net/System/Net/Sockets/ProtocolFamily.cs
+../referencesource/System/net/System/Net/Sockets/ProtocolType.cs
+../referencesource/System/net/System/Net/Sockets/SelectMode.cs
+../referencesource/System/net/System/Net/Sockets/Socket.cs
+../referencesource/System/net/System/Net/Sockets/SocketErrors.cs
+../referencesource/System/net/System/Net/Sockets/SocketFlags.cs
+../referencesource/System/net/System/Net/Sockets/SocketInformation.cs
+../referencesource/System/net/System/Net/Sockets/SocketInformationOptions.cs
+../referencesource/System/net/System/Net/Sockets/SocketOptionLevel.cs
+../referencesource/System/net/System/Net/Sockets/SocketOptionName.cs
+../referencesource/System/net/System/Net/Sockets/SocketShutdown.cs
+../referencesource/System/net/System/Net/Sockets/SocketType.cs
+../referencesource/System/net/System/Net/Sockets/TCPClient.cs
+../referencesource/System/net/System/Net/Sockets/TCPListener.cs
+../referencesource/System/net/System/Net/Sockets/TransmitFileFlags.cs
+../referencesource/System/net/System/Net/Sockets/UdpReceiveResult.cs
+../referencesource/System/net/System/Net/Sockets/UDPClient.cs
 
 ../referencesource/System/net/System/Net/NetworkInformation/DuplicateAddressDetectionState.cs
 ../referencesource/System/net/System/Net/NetworkInformation/GatewayIPAddressInformation.cs
@@ -1078,7 +1109,6 @@ ReferenceSources/_SslStream.cs
 ../referencesource/System/net/System/Net/NetworkInformation/SystemGatewayIPAddressInformation.cs
 ../referencesource/System/net/System/Net/NetworkInformation/SystemIPAddressInformation.cs
 ../referencesource/System/net/System/Net/NetworkInformation/SystemMulticastIPAddressInformation.cs
-../referencesource/System/net/System/Net/NetworkInformation/SystemUnicastIPAddressInformation.cs
 ../referencesource/System/net/System/Net/NetworkInformation/SystemTcpConnection.cs
 ../referencesource/System/net/System/Net/NetworkInformation/TcpConnection.cs
 ../referencesource/System/net/System/Net/NetworkInformation/TcpState.cs
@@ -1092,6 +1122,8 @@ ReferenceSources/_SslStream.cs
 
 ../referencesource/System/sys/system/IO/ports/InternalResources.cs
 
+../referencesource/System/sys/system/Diagnostics/CodeAnalysis/ExcludeFromCodeCoverageAttribute.cs
+
 ../referencesource/System/sys/system/runtime/interopservices/DefaultParameterValueAttribute.cs
 ../referencesource/System/sys/system/runtime/interopservices/handlecollector.cs
 
@@ -1103,6 +1135,7 @@ ReferenceSources/_SslStream.cs
 ../referencesource/System/sys/system/windows/markup/ValueSerializerAttribute.cs
 
 ../referencesource/System/security/system/security/Authentication/ExtendedProtection/TokenBinding.cs
+../referencesource/System/security/system/security/Authentication/ExtendedProtection/ServiceNameCollection.cs
 
 ../referencesource/System/security/system/security/cryptography/oid.cs
 
@@ -1110,6 +1143,9 @@ ReferenceSources/_SslStream.cs
 
 ../referencesource/System/security/system/security/permissions/typedescriptorpermission.cs
 
+../referencesource/System/services/monitoring/system/diagnosticts/ProcessModuleCollection.cs
+../referencesource/System/services/monitoring/system/diagnosticts/ProcessThreadCollection.cs
+
 ../referencesource/System/services/timers/system/timers/ElapsedEventHandler.cs
 ../referencesource/System/services/timers/system/timers/Timer.cs
 ../referencesource/System/services/timers/system/timers/TimersDescriptionAttribute.cs
index 1f010668d722f454e024aecb54db05e68905f3a6..dc4f4aaa54ec0200a97c579834cc1af691bc7012 100644 (file)
@@ -33,6 +33,9 @@ using System.Net.Security;
 using System.Security.Cryptography.X509Certificates;
 #if SECURITY_DEP
 using MSX = Mono.Security.X509;
+#if MONO_FEATURE_BTLS
+using Mono.Btls;
+#endif
 #endif
 
 namespace System {
@@ -43,6 +46,7 @@ namespace System {
                
 #if SECURITY_DEP
                static readonly Converter<List <byte[]>, bool> trustEvaluateSsl;
+               static readonly Func<long, bool, byte[]> certStoreLookup;
 #endif  // SECURITY_DEP
                static readonly Func<IWebProxy> getDefaultProxy;
                static readonly GetInterfaceAddressesDelegate getInterfaceAddresses;
@@ -58,6 +62,14 @@ namespace System {
                                                        "TrustEvaluateSsl",
                                                        ignoreCase:false,
                                                        throwOnBindFailure:true);
+#if MONO_FEATURE_BTLS
+                       certStoreLookup = (Func<long, bool, byte[]>)
+                               Delegate.CreateDelegate (typeof (Func<long, bool, byte[]>),
+                                                       t,
+                                                       "CertStoreLookup",
+                                                       ignoreCase:false,
+                                                       throwOnBindFailure:true);
+#endif  // MONO_FEATURE_BTLS
 #endif  // SECURITY_DEP
                        getDefaultProxy = (Func<IWebProxy>)Delegate.CreateDelegate (
                                typeof (Func<IWebProxy>), t, "GetDefaultProxy",
@@ -83,6 +95,26 @@ namespace System {
                                certsRawData.Add (cert.GetRawCertData ());
                        return trustEvaluateSsl (certsRawData);
                }
+
+#if MONO_FEATURE_BTLS
+               internal static MonoBtlsX509 CertStoreLookup (MonoBtlsX509Name name)
+               {
+                       var hash = name.GetHash ();
+                       var hashOld = name.GetHashOld ();
+                       var result = certStoreLookup (hash, false);
+                       if (result == null)
+                               result = certStoreLookup (hashOld, false);
+                       if (result == null)
+                               result = certStoreLookup (hash, true);
+                       if (result == null)
+                               result = certStoreLookup (hashOld, true);
+
+                       if (result == null)
+                               return null;
+
+                       return MonoBtlsX509.LoadFromData (result, MonoBtlsX509Format.DER);
+               }
+#endif  // MONO_FEATURE_BTLS
 #endif  // SECURITY_DEP
 
                internal static IWebProxy GetDefaultProxy ()
diff --git a/mcs/class/System/System/MonoToolsLocator.cs b/mcs/class/System/System/MonoToolsLocator.cs
new file mode 100755 (executable)
index 0000000..5443395
--- /dev/null
@@ -0,0 +1,96 @@
+#if !MOBILE
+
+using System.Diagnostics;
+using System.IO;
+using System.Reflection;
+using System.Runtime.InteropServices;
+using System.Text;
+
+namespace System {
+
+       static class MonoToolsLocator
+       {
+               public static readonly string Mono;
+               public static readonly string CSharpCompiler;
+               public static readonly string VBCompiler;
+               public static readonly string AssemblyLinker;
+
+               // TODO: Should be lazy
+               static MonoToolsLocator ()
+               {
+                       var gac = typeof (Environment).GetProperty ("GacPath", BindingFlags.Static | BindingFlags.NonPublic);
+                       var getGacMethod = gac.GetGetMethod (true);
+                       var GacPath = Path.GetDirectoryName ((string) getGacMethod.Invoke (null, null));
+
+                       if (Path.DirectorySeparatorChar == '\\') {
+                               StringBuilder moduleName = new StringBuilder (1024);
+                               GetModuleFileName (IntPtr.Zero, moduleName, moduleName.Capacity);
+                               string processExe = moduleName.ToString ();
+                               string fileName = Path.GetFileName (processExe);
+                               if (fileName.StartsWith ("mono") && fileName.EndsWith (".exe"))
+                                       Mono = processExe;
+
+                               if (!File.Exists (Mono))
+                                       Mono = Path.Combine (
+                                               Path.GetDirectoryName (
+                                                       Path.GetDirectoryName (GacPath)),
+                                               "bin\\mono.exe");
+
+                               if (!File.Exists (Mono))
+                                       Mono = Path.Combine (
+                                               Path.GetDirectoryName (
+                                                       Path.GetDirectoryName (
+                                                               Path.GetDirectoryName (GacPath))),
+                                               "mono\\mini\\mono.exe");
+
+                               //if (!File.Exists (Mono))
+                               //      throw new FileNotFoundException ("Windows mono path not found: " + Mono);
+
+                               CSharpCompiler = Path.Combine (GacPath, "4.5\\mcs.exe");
+                               if (!File.Exists (CSharpCompiler))
+                                       CSharpCompiler = Path.Combine (Path.GetDirectoryName (GacPath), "lib\\build\\mcs.exe");
+
+                               //if (!File.Exists (CSharpCompiler))
+                               //      throw new FileNotFoundException ("C# compiler not found at " + CSharpCompiler);
+
+                               VBCompiler = Path.Combine (GacPath,  "4.5\\vbnc.exe");
+                               AssemblyLinker = Path.Combine (GacPath, "4.5\\al.exe");
+
+                               if (!File.Exists (AssemblyLinker)) {
+                                       AssemblyLinker = Path.Combine (Path.GetDirectoryName (GacPath), "lib\\net_4_x\\al.exe");
+                               //      if (!File.Exists (AssemblyLinker))
+                               //              throw new FileNotFoundException ("Windows al path not found: " + AssemblyLinker);
+                               }
+                       } else {
+                               Mono = Path.Combine (GacPath, "bin", "mono");
+                               if (!File.Exists (Mono))
+                                       Mono = "mono";
+
+                               var mscorlibPath = new Uri (typeof (object).Assembly.CodeBase).LocalPath;
+                               CSharpCompiler = Path.GetFullPath (Path.Combine (mscorlibPath, "..", "..", "..", "..", "bin", "mcs"));
+                               if (!File.Exists (CSharpCompiler))
+                                       CSharpCompiler = "mcs";
+
+                               VBCompiler = Path.GetFullPath (Path.Combine (mscorlibPath, "..", "..", "..", "..", "bin", "vbnc"));
+                               if (!File.Exists (VBCompiler))
+                                       VBCompiler = "vbnc";
+
+                               AssemblyLinker = Path.GetFullPath (Path.Combine (mscorlibPath, "..", "..", "..", "..", "bin", "al"));
+                               if (!File.Exists (AssemblyLinker))
+                                       AssemblyLinker = "al";
+                       }
+               }
+
+               // Due to an issue with shadow copying  and app domains in mono, we cannot currently use 
+               // Process.GetCurrentProcess ().MainModule.FileName (which would give the same result)
+               // when running in an AppDomain (eg System.Web hosts).
+               //
+               // Using native Windows API to get current process filename. This will only
+               // be called when running on Windows. 
+               [DllImport ("kernel32.dll")]
+               static extern uint GetModuleFileName ([In] IntPtr hModule, [Out] StringBuilder lpFilename, [In] int nSize);
+
+       }
+}
+
+#endif
index 2d7f9cf1415e0f2a7077ae75aa4e4ebd443a31ce..ea2fe62b6bfad1a2e875e4e96bb72a2d80cd471b 100644 (file)
@@ -27,7 +27,7 @@
 //
 
 using System.ComponentModel;
-#if !NET_2_1
+#if !MOBILE
 using System.ComponentModel.Design.Serialization;
 #endif
 using System.Globalization;
@@ -49,7 +49,7 @@ namespace System {
                                return true;
                        if (type == typeof (Uri))
                                return true;
-#if NET_2_1
+#if MOBILE
                        return false;
 #else
                        return (type == typeof (InstanceDescriptor));
@@ -75,7 +75,7 @@ namespace System {
                public override object ConvertFrom (ITypeDescriptorContext context, CultureInfo culture, object value)
                {
                        if (value == null) {
-#if NET_2_1
+#if MOBILE
                                throw new NotSupportedException (Locale.GetText ("Cannot convert from value."));
 #else
                                throw new ArgumentNullException ("value");
@@ -90,14 +90,14 @@ namespace System {
 
                        string s = (value as string);
                        if (s != null) {
-#if NET_2_1
+#if MOBILE
                                if (s == "")
                                        return null;
 #endif
                                return new Uri (s, UriKind.RelativeOrAbsolute);
                        }
 
-#if !NET_2_1
+#if !MOBILE
                        InstanceDescriptor id = (value as InstanceDescriptor);
                        if (id != null) {
                                return id.Invoke ();
@@ -117,7 +117,7 @@ namespace System {
                                        return uri.ToString ();
                                if (destinationType == typeof (Uri))
                                        return uri;
-#if !NET_2_1
+#if !MOBILE
                                if (destinationType == typeof (InstanceDescriptor)) {
                                        ConstructorInfo ci = typeof (Uri).GetConstructor (new Type [2] { typeof (string), typeof (UriKind) });
                                        return new InstanceDescriptor (ci , new object [] { uri.ToString (), uri.IsAbsoluteUri ? UriKind.Absolute : UriKind.Relative });
@@ -127,14 +127,14 @@ namespace System {
 #endif
                        }
 
-#if NET_2_1
+#if MOBILE
                        throw new NotSupportedException (Locale.GetText ("Cannot convert to destination type."));
 #else
                        return base.ConvertTo (context, culture, value, destinationType);
 #endif
                }
 
-#if !NET_2_1
+#if !MOBILE
                public override bool IsValid (ITypeDescriptorContext context, object value)
                {
                        if (value == null)
index 6ec32758faf518b7194ff3462876a81e2fc0610b..24351699070af87a50754ae78540b810f07e5f66 100644 (file)
@@ -1,3 +1,4 @@
+../../test-helpers/NunitHelpers.cs
 Microsoft.CSharp/CodeGeneratorFromCompileUnitTest.cs
 Microsoft.CSharp/CodeGeneratorFromExpressionTest.cs
 Microsoft.CSharp/CodeGeneratorFromNamespaceTest.cs
index c6ccdf0a26ab1e81b475f0a646aaf63296196b3e..823204cf4867366cebc2cd86bffcdeb601dfa29c 100644 (file)
@@ -53,7 +53,7 @@ namespace MonoTests.System.CodeDom.Compiler
                        int importPosition = result.IndexOf (IMPORT);
                        int attributePosition = result.IndexOf (ATTRIBUTE);
 
-                       Assert.Greater (attributePosition, importPosition, "Actual order: " + result);
+                       AssertHelper.Greater (attributePosition, importPosition, "Actual order: " + result);
                }
 
                [Test]
index b6baac08e8546b092a48cb849ec3fc9debb3a37b..6586c4c092f9c554eae94a7f1bb7a62ba03bb79c 100644 (file)
@@ -38,9 +38,6 @@ using System.Text;
 using System.Runtime.Serialization;
 using System.Runtime.Serialization.Formatters.Binary;
 using NUnit.Framework;
-#if !MOBILE
-using NUnit.Framework.SyntaxHelpers;
-#endif
 
 namespace MonoTests.System.Collections.Generic
 {
index 1d5e4e6dbdf62e370245a6e3cfbecacad5b41460..b9261cbe862d40e8baecf0b43b0c70094dd1be1e 100644 (file)
@@ -47,7 +47,7 @@ namespace MonoTests.System.ComponentModel {
                    Assert.AreEqual(CM.CategoryAttribute.Key.Category, "Key", "#9");
                    Assert.AreEqual(CM.CategoryAttribute.Layout.Category, "Layout", "#10");
                    Assert.AreEqual(CM.CategoryAttribute.Mouse.Category, "Mouse", "#11");
-#if NET_2_1
+#if MOBILE
                    Assert.AreEqual(CM.CategoryAttribute.Default.Category, "Default", "#12");
                    Assert.AreEqual(CM.CategoryAttribute.DragDrop.Category, "DragDrop", "#13");
                    Assert.AreEqual(CM.CategoryAttribute.WindowStyle.Category, "WindowStyle", "#14");
index 706bfcdac0c6fa51f6b9a8017e213e59719b12e1..6e63058fed7d5ff90caac0148dcdd7a0b2c8652e 100644 (file)
@@ -165,7 +165,7 @@ namespace MonoTests.System.Diagnostics
                                        Assert.AreEqual (0, entry.EventID, "#D8");
                                        Assert.AreEqual (entry.EventID, entry.InstanceId, "#D9");
                                        Assert.IsNotNull (entry.MachineName, "#D10");
-                                       Assert.AreEqual (Environment.MachineName, entry.MachineName, "#D11");
+                                       Assert.AreEqual (Environment.MachineName.ToUpper(), entry.MachineName.ToUpper(), "#D11");
                                        Assert.IsNotNull (entry.ReplacementStrings, "#D12");
                                        Assert.AreEqual (1, entry.ReplacementStrings.Length, "#D13");
                                        Assert.AreEqual ("Clear3", entry.ReplacementStrings [0], "#D14");
@@ -184,7 +184,7 @@ namespace MonoTests.System.Diagnostics
                                        Assert.AreEqual (0, entry.EventID, "#E8");
                                        Assert.AreEqual (entry.EventID, entry.InstanceId, "#E9");
                                        Assert.IsNotNull (entry.MachineName, "#E10");
-                                       Assert.AreEqual (Environment.MachineName, entry.MachineName, "#E11");
+                                       Assert.AreEqual (Environment.MachineName.ToUpper(), entry.MachineName.ToUpper(), "#E11");
                                        Assert.IsNotNull (entry.ReplacementStrings, "#E12");
                                        Assert.AreEqual (1, entry.ReplacementStrings.Length, "#E13");
                                        Assert.AreEqual ("Clear4", entry.ReplacementStrings [0], "#E14");
@@ -3488,7 +3488,7 @@ namespace MonoTests.System.Diagnostics
                                        Assert.AreEqual (0, entry.EventID, "#B8");
                                        Assert.AreEqual (entry.EventID, entry.InstanceId, "#B9");
                                        Assert.IsNotNull (entry.MachineName, "#B10");
-                                       Assert.AreEqual (Environment.MachineName, entry.MachineName, "#B11");
+                                       Assert.AreEqual (Environment.MachineName.ToUpper(), entry.MachineName.ToUpper(), "#B11");
                                        Assert.IsNotNull (entry.ReplacementStrings, "#B12");
                                        Assert.AreEqual (1, entry.ReplacementStrings.Length, "#B13");
                                        Assert.AreEqual ("WriteEntry1a", entry.ReplacementStrings[0], "#B14");
@@ -3509,7 +3509,7 @@ namespace MonoTests.System.Diagnostics
                                        Assert.AreEqual (0, entry.EventID, "#C8");
                                        Assert.AreEqual (entry.EventID, entry.InstanceId, "#C9");
                                        Assert.IsNotNull (entry.MachineName, "#C10");
-                                       Assert.AreEqual (Environment.MachineName, entry.MachineName, "#C11");
+                                       Assert.AreEqual (Environment.MachineName.ToUpper(), entry.MachineName.ToUpper(), "#C11");
                                        Assert.IsNotNull (entry.ReplacementStrings, "#C12");
                                        Assert.AreEqual (1, entry.ReplacementStrings.Length, "#C13");
                                        Assert.AreEqual ("WriteEntry1b" + Environment.NewLine + "ok", entry.ReplacementStrings [0], "#C14");
@@ -3634,7 +3634,7 @@ namespace MonoTests.System.Diagnostics
                                        Assert.AreEqual (0, entry.EventID, "#B8");
                                        Assert.AreEqual (entry.EventID, entry.InstanceId, "#B9");
                                        Assert.IsNotNull (entry.MachineName, "#B10");
-                                       Assert.AreEqual (Environment.MachineName, entry.MachineName, "#B11");
+                                       Assert.AreEqual (Environment.MachineName.ToUpper(), entry.MachineName.ToUpper(), "#B11");
                                        Assert.IsNotNull (entry.ReplacementStrings, "#B12");
                                        Assert.AreEqual (1, entry.ReplacementStrings.Length, "#B13");
                                        Assert.AreEqual (string.Empty, entry.ReplacementStrings [0], "#B14");
@@ -3683,7 +3683,7 @@ namespace MonoTests.System.Diagnostics
                                        Assert.AreEqual (0, entry.EventID, "#B8");
                                        Assert.AreEqual (entry.EventID, entry.InstanceId, "#B9");
                                        Assert.IsNotNull (entry.MachineName, "#B10");
-                                       Assert.AreEqual (Environment.MachineName, entry.MachineName, "#B11");
+                                       Assert.AreEqual (Environment.MachineName.ToUpper(), entry.MachineName.ToUpper(), "#B11");
                                        Assert.IsNotNull (entry.ReplacementStrings, "#B12");
                                        Assert.AreEqual (1, entry.ReplacementStrings.Length, "#B13");
                                        Assert.AreEqual (string.Empty, entry.ReplacementStrings [0], "#B14");
@@ -3735,7 +3735,7 @@ namespace MonoTests.System.Diagnostics
                                        Assert.AreEqual (0, entry.EventID, "#B8");
                                        Assert.AreEqual (entry.EventID, entry.InstanceId, "#B9");
                                        Assert.IsNotNull (entry.MachineName, "#B10");
-                                       Assert.AreEqual (Environment.MachineName, entry.MachineName, "#B11");
+                                       Assert.AreEqual (Environment.MachineName.ToUpper(), entry.MachineName.ToUpper(), "#B11");
                                        Assert.IsNotNull (entry.ReplacementStrings, "#B12");
                                        Assert.AreEqual (1, entry.ReplacementStrings.Length, "#B13");
                                        Assert.AreEqual ("WriteEntry1", entry.ReplacementStrings[0], "#B14");
@@ -3793,7 +3793,7 @@ namespace MonoTests.System.Diagnostics
                                        Assert.AreEqual (0, entry.EventID, "#B8");
                                        Assert.AreEqual (entry.EventID, entry.InstanceId, "#B9");
                                        Assert.IsNotNull (entry.MachineName, "#B10");
-                                       Assert.AreEqual (Environment.MachineName, entry.MachineName, "#B11");
+                                       Assert.AreEqual (Environment.MachineName.ToUpper(), entry.MachineName.ToUpper(), "#B11");
                                        Assert.IsNotNull (entry.ReplacementStrings, "#B12");
                                        Assert.AreEqual (1, entry.ReplacementStrings.Length, "#B13");
                                        Assert.AreEqual ("WriteEntry2a", entry.ReplacementStrings [0], "#B14");
@@ -3814,7 +3814,7 @@ namespace MonoTests.System.Diagnostics
                                        Assert.AreEqual (0, entry.EventID, "#C8");
                                        Assert.AreEqual (entry.EventID, entry.InstanceId, "#C9");
                                        Assert.IsNotNull (entry.MachineName, "#C10");
-                                       Assert.AreEqual (Environment.MachineName, entry.MachineName, "#C11");
+                                       Assert.AreEqual (Environment.MachineName.ToUpper(), entry.MachineName.ToUpper(), "#C11");
                                        Assert.IsNotNull (entry.ReplacementStrings, "#C12");
                                        Assert.AreEqual (1, entry.ReplacementStrings.Length, "#C13");
                                        Assert.AreEqual ("WriteEntry2b" + Environment.NewLine + "ok", entry.ReplacementStrings [0], "#C14");
@@ -3952,7 +3952,7 @@ namespace MonoTests.System.Diagnostics
                                        Assert.AreEqual (0, entry.EventID, "#B8");
                                        Assert.AreEqual (entry.EventID, entry.InstanceId, "#B9");
                                        Assert.IsNotNull (entry.MachineName, "#B10");
-                                       Assert.AreEqual (Environment.MachineName, entry.MachineName, "#B11");
+                                       Assert.AreEqual (Environment.MachineName.ToUpper(), entry.MachineName.ToUpper(), "#B11");
                                        Assert.IsNotNull (entry.ReplacementStrings, "#B12");
                                        Assert.AreEqual (1, entry.ReplacementStrings.Length, "#B13");
                                        Assert.AreEqual (string.Empty, entry.ReplacementStrings [0], "#B14");
@@ -4001,7 +4001,7 @@ namespace MonoTests.System.Diagnostics
                                        Assert.AreEqual (0, entry.EventID, "#B8");
                                        Assert.AreEqual (entry.EventID, entry.InstanceId, "#B9");
                                        Assert.IsNotNull (entry.MachineName, "#B10");
-                                       Assert.AreEqual (Environment.MachineName, entry.MachineName, "#B11");
+                                       Assert.AreEqual (Environment.MachineName.ToUpper(), entry.MachineName.ToUpper(), "#B11");
                                        Assert.IsNotNull (entry.ReplacementStrings, "#B12");
                                        Assert.AreEqual (1, entry.ReplacementStrings.Length, "#B13");
                                        Assert.AreEqual (string.Empty, entry.ReplacementStrings [0], "#B14");
@@ -4053,7 +4053,7 @@ namespace MonoTests.System.Diagnostics
                                        Assert.AreEqual (0, entry.EventID, "#B8");
                                        Assert.AreEqual (entry.EventID, entry.InstanceId, "#B9");
                                        Assert.IsNotNull (entry.MachineName, "#B10");
-                                       Assert.AreEqual (Environment.MachineName, entry.MachineName, "#B11");
+                                       Assert.AreEqual (Environment.MachineName.ToUpper(), entry.MachineName.ToUpper(), "#B11");
                                        Assert.IsNotNull (entry.ReplacementStrings, "#B12");
                                        Assert.AreEqual (1, entry.ReplacementStrings.Length, "#B13");
                                        Assert.AreEqual ("WriteEntry1", entry.ReplacementStrings [0], "#B14");
@@ -4119,7 +4119,7 @@ namespace MonoTests.System.Diagnostics
                                        Assert.AreEqual (0, entry.EventID, "#B8");
                                        Assert.AreEqual (entry.EventID, entry.InstanceId, "#B9");
                                        Assert.IsNotNull (entry.MachineName, "#B10");
-                                       Assert.AreEqual (Environment.MachineName, entry.MachineName, "#B11");
+                                       Assert.AreEqual (Environment.MachineName.ToUpper(), entry.MachineName.ToUpper(), "#B11");
                                        Assert.IsNotNull (entry.ReplacementStrings, "#B12");
                                        Assert.AreEqual (1, entry.ReplacementStrings.Length, "#B13");
                                        Assert.AreEqual ("WriteEntry3a", entry.ReplacementStrings [0], "#B14");
@@ -4141,7 +4141,7 @@ namespace MonoTests.System.Diagnostics
                                        Assert.AreEqual (0, entry.EventID, "#C8");
                                        Assert.AreEqual (entry.EventID, entry.InstanceId, "#C9");
                                        Assert.IsNotNull (entry.MachineName, "#C10");
-                                       Assert.AreEqual (Environment.MachineName, entry.MachineName, "#C11");
+                                       Assert.AreEqual (Environment.MachineName.ToUpper(), entry.MachineName.ToUpper(), "#C11");
                                        Assert.IsNotNull (entry.ReplacementStrings, "#C12");
                                        Assert.AreEqual (1, entry.ReplacementStrings.Length, "#C13");
                                        Assert.AreEqual ("WriteEntry3b" + Environment.NewLine + "ok", entry.ReplacementStrings [0], "#C14");
@@ -4184,7 +4184,7 @@ namespace MonoTests.System.Diagnostics
                                        Assert.AreEqual (0, entry.EventID, "#A8");
                                        Assert.AreEqual (entry.EventID, entry.InstanceId, "#A9");
                                        Assert.IsNotNull (entry.MachineName, "#A10");
-                                       Assert.AreEqual (Environment.MachineName, entry.MachineName, "#A11");
+                                       Assert.AreEqual (Environment.MachineName.ToUpper(), entry.MachineName.ToUpper(), "#A11");
                                        Assert.IsNotNull (entry.ReplacementStrings, "#A12");
                                        Assert.AreEqual (1, entry.ReplacementStrings.Length, "#A13");
                                        Assert.AreEqual (string.Empty, entry.ReplacementStrings [0], "#A14");
@@ -4227,7 +4227,7 @@ namespace MonoTests.System.Diagnostics
                                        Assert.AreEqual (0, entry.EventID, "#A8");
                                        Assert.AreEqual (entry.EventID, entry.InstanceId, "#A9");
                                        Assert.IsNotNull (entry.MachineName, "#A10");
-                                       Assert.AreEqual (Environment.MachineName, entry.MachineName, "#A11");
+                                       Assert.AreEqual (Environment.MachineName.ToUpper(), entry.MachineName.ToUpper(), "#A11");
                                        Assert.IsNotNull (entry.ReplacementStrings, "#A12");
                                        Assert.AreEqual (1, entry.ReplacementStrings.Length, "#A13");
                                        Assert.AreEqual (string.Empty, entry.ReplacementStrings [0], "#A14");
@@ -4276,7 +4276,7 @@ namespace MonoTests.System.Diagnostics
                                        Assert.AreEqual (0, entry.EventID, "#B8");
                                        Assert.AreEqual (entry.EventID, entry.InstanceId, "#B9");
                                        Assert.IsNotNull (entry.MachineName, "#B10");
-                                       Assert.AreEqual (Environment.MachineName, entry.MachineName, "#B11");
+                                       Assert.AreEqual (Environment.MachineName.ToUpper(), entry.MachineName.ToUpper(), "#B11");
                                        Assert.IsNotNull (entry.ReplacementStrings, "#B12");
                                        Assert.AreEqual (1, entry.ReplacementStrings.Length, "#B13");
                                        Assert.AreEqual ("test", entry.ReplacementStrings [0], "#B14");
@@ -4344,7 +4344,7 @@ namespace MonoTests.System.Diagnostics
                                        Assert.AreEqual (56, entry.EventID, "#B8");
                                        Assert.AreEqual (entry.EventID, entry.InstanceId, "#B9");
                                        Assert.IsNotNull (entry.MachineName, "#B10");
-                                       Assert.AreEqual (Environment.MachineName, entry.MachineName, "#B11");
+                                       Assert.AreEqual (Environment.MachineName.ToUpper(), entry.MachineName.ToUpper(), "#B11");
                                        Assert.IsNotNull (entry.ReplacementStrings, "#B12");
                                        Assert.AreEqual (1, entry.ReplacementStrings.Length, "#B13");
                                        Assert.AreEqual ("WriteEntry1", entry.ReplacementStrings [0], "#B14");
@@ -4365,7 +4365,7 @@ namespace MonoTests.System.Diagnostics
                                        Assert.AreEqual (0, entry.EventID, "#C8");
                                        Assert.AreEqual (entry.EventID, entry.InstanceId, "#C9");
                                        Assert.IsNotNull (entry.MachineName, "#C10");
-                                       Assert.AreEqual (Environment.MachineName, entry.MachineName, "#C11");
+                                       Assert.AreEqual (Environment.MachineName.ToUpper(), entry.MachineName.ToUpper(), "#C11");
                                        Assert.IsNotNull (entry.ReplacementStrings, "#C12");
                                        Assert.AreEqual (1, entry.ReplacementStrings.Length, "#C13");
                                        Assert.AreEqual ("WriteEntry2", entry.ReplacementStrings [0], "#C14");
@@ -4386,7 +4386,7 @@ namespace MonoTests.System.Diagnostics
                                        Assert.AreEqual (ushort.MaxValue, entry.EventID, "#D8");
                                        Assert.AreEqual (entry.EventID, entry.InstanceId, "#D9");
                                        Assert.IsNotNull (entry.MachineName, "#D10");
-                                       Assert.AreEqual (Environment.MachineName, entry.MachineName, "#D11");
+                                       Assert.AreEqual (Environment.MachineName.ToUpper(), entry.MachineName.ToUpper(), "#D11");
                                        Assert.IsNotNull (entry.ReplacementStrings, "#D12");
                                        Assert.AreEqual (1, entry.ReplacementStrings.Length, "#D13");
                                        Assert.AreEqual ("WriteEntry2", entry.ReplacementStrings [0], "#D14");
@@ -4600,7 +4600,7 @@ namespace MonoTests.System.Diagnostics
                                        Assert.AreEqual (888, entry.EventID, "#B8");
                                        Assert.AreEqual (entry.EventID, entry.InstanceId, "#B9");
                                        Assert.IsNotNull (entry.MachineName, "#B10");
-                                       Assert.AreEqual (Environment.MachineName, entry.MachineName, "#B11");
+                                       Assert.AreEqual (Environment.MachineName.ToUpper(), entry.MachineName.ToUpper(), "#B11");
                                        Assert.IsNotNull (entry.ReplacementStrings, "#B12");
                                        Assert.AreEqual (1, entry.ReplacementStrings.Length, "#B13");
                                        Assert.AreEqual (string.Empty, entry.ReplacementStrings [0], "#B14");
@@ -4649,7 +4649,7 @@ namespace MonoTests.System.Diagnostics
                                        Assert.AreEqual (343, entry.EventID, "#B8");
                                        Assert.AreEqual (entry.EventID, entry.InstanceId, "#B9");
                                        Assert.IsNotNull (entry.MachineName, "#B10");
-                                       Assert.AreEqual (Environment.MachineName, entry.MachineName, "#B11");
+                                       Assert.AreEqual (Environment.MachineName.ToUpper(), entry.MachineName.ToUpper(), "#B11");
                                        Assert.IsNotNull (entry.ReplacementStrings, "#B12");
                                        Assert.AreEqual (1, entry.ReplacementStrings.Length, "#B13");
                                        Assert.AreEqual (string.Empty, entry.ReplacementStrings [0], "#B14");
@@ -4706,7 +4706,7 @@ namespace MonoTests.System.Diagnostics
                                        Assert.AreEqual (2, entry.EventID, "#B8");
                                        Assert.AreEqual (entry.EventID, entry.InstanceId, "#B9");
                                        Assert.IsNotNull (entry.MachineName, "#B10");
-                                       Assert.AreEqual (Environment.MachineName, entry.MachineName, "#B11");
+                                       Assert.AreEqual (Environment.MachineName.ToUpper(), entry.MachineName.ToUpper(), "#B11");
                                        Assert.IsNotNull (entry.ReplacementStrings, "#B12");
                                        Assert.AreEqual (1, entry.ReplacementStrings.Length, "#B13");
                                        Assert.AreEqual ("WriteEntry1", entry.ReplacementStrings [0], "#B14");
@@ -4773,7 +4773,7 @@ namespace MonoTests.System.Diagnostics
                                        Assert.AreEqual (0, entry.EventID, "#B8");
                                        Assert.AreEqual (entry.EventID, entry.InstanceId, "#B9");
                                        Assert.IsNotNull (entry.MachineName, "#B10");
-                                       Assert.AreEqual (Environment.MachineName, entry.MachineName, "#B11");
+                                       Assert.AreEqual (Environment.MachineName.ToUpper(), entry.MachineName.ToUpper(), "#B11");
                                        Assert.IsNotNull (entry.ReplacementStrings, "#B12");
                                        Assert.AreEqual (1, entry.ReplacementStrings.Length, "#B13");
                                        Assert.AreEqual ("WriteEntry3a", entry.ReplacementStrings [0], "#B14");
@@ -4795,7 +4795,7 @@ namespace MonoTests.System.Diagnostics
                                        Assert.AreEqual (0, entry.EventID, "#C8");
                                        Assert.AreEqual (entry.EventID, entry.InstanceId, "#C9");
                                        Assert.IsNotNull (entry.MachineName, "#C10");
-                                       Assert.AreEqual (Environment.MachineName, entry.MachineName, "#C11");
+                                       Assert.AreEqual (Environment.MachineName.ToUpper(), entry.MachineName.ToUpper(), "#C11");
                                        Assert.IsNotNull (entry.ReplacementStrings, "#C12");
                                        Assert.AreEqual (1, entry.ReplacementStrings.Length, "#C13");
                                        Assert.AreEqual ("WriteEntry3b" + Environment.NewLine + "ok", entry.ReplacementStrings [0], "#C14");
@@ -4838,7 +4838,7 @@ namespace MonoTests.System.Diagnostics
                                        Assert.AreEqual (0, entry.EventID, "#A8");
                                        Assert.AreEqual (entry.EventID, entry.InstanceId, "#A9");
                                        Assert.IsNotNull (entry.MachineName, "#A10");
-                                       Assert.AreEqual (Environment.MachineName, entry.MachineName, "#A11");
+                                       Assert.AreEqual (Environment.MachineName.ToUpper(), entry.MachineName.ToUpper(), "#A11");
                                        Assert.IsNotNull (entry.ReplacementStrings, "#A12");
                                        Assert.AreEqual (1, entry.ReplacementStrings.Length, "#A13");
                                        Assert.AreEqual (string.Empty, entry.ReplacementStrings [0], "#A14");
@@ -4881,7 +4881,7 @@ namespace MonoTests.System.Diagnostics
                                        Assert.AreEqual (0, entry.EventID, "#A8");
                                        Assert.AreEqual (entry.EventID, entry.InstanceId, "#A9");
                                        Assert.IsNotNull (entry.MachineName, "#A10");
-                                       Assert.AreEqual (Environment.MachineName, entry.MachineName, "#A11");
+                                       Assert.AreEqual (Environment.MachineName.ToUpper(), entry.MachineName.ToUpper(), "#A11");
                                        Assert.IsNotNull (entry.ReplacementStrings, "#A12");
                                        Assert.AreEqual (1, entry.ReplacementStrings.Length, "#A13");
                                        Assert.AreEqual (string.Empty, entry.ReplacementStrings [0], "#A14");
@@ -4930,7 +4930,7 @@ namespace MonoTests.System.Diagnostics
                                        Assert.AreEqual (0, entry.EventID, "#B8");
                                        Assert.AreEqual (entry.EventID, entry.InstanceId, "#B9");
                                        Assert.IsNotNull (entry.MachineName, "#B10");
-                                       Assert.AreEqual (Environment.MachineName, entry.MachineName, "#B11");
+                                       Assert.AreEqual (Environment.MachineName.ToUpper(), entry.MachineName.ToUpper(), "#B11");
                                        Assert.IsNotNull (entry.ReplacementStrings, "#B12");
                                        Assert.AreEqual (1, entry.ReplacementStrings.Length, "#B13");
                                        Assert.AreEqual ("test", entry.ReplacementStrings [0], "#B14");
@@ -5006,7 +5006,7 @@ namespace MonoTests.System.Diagnostics
                                        Assert.AreEqual (56, entry.EventID, "#B8");
                                        Assert.AreEqual (entry.EventID, entry.InstanceId, "#B9");
                                        Assert.IsNotNull (entry.MachineName, "#B10");
-                                       Assert.AreEqual (Environment.MachineName, entry.MachineName, "#B11");
+                                       Assert.AreEqual (Environment.MachineName.ToUpper(), entry.MachineName.ToUpper(), "#B11");
                                        Assert.IsNotNull (entry.ReplacementStrings, "#B12");
                                        Assert.AreEqual (1, entry.ReplacementStrings.Length, "#B13");
                                        Assert.AreEqual ("WriteEntry6a", entry.ReplacementStrings [0], "#B14");
@@ -5028,7 +5028,7 @@ namespace MonoTests.System.Diagnostics
                                        Assert.AreEqual (0, entry.EventID, "#C8");
                                        Assert.AreEqual (entry.EventID, entry.InstanceId, "#C9");
                                        Assert.IsNotNull (entry.MachineName, "#C10");
-                                       Assert.AreEqual (Environment.MachineName, entry.MachineName, "#C11");
+                                       Assert.AreEqual (Environment.MachineName.ToUpper(), entry.MachineName.ToUpper(), "#C11");
                                        Assert.IsNotNull (entry.ReplacementStrings, "#C12");
                                        Assert.AreEqual (1, entry.ReplacementStrings.Length, "#C13");
                                        Assert.AreEqual ("WriteEntry6b" + Environment.NewLine + "ok", entry.ReplacementStrings [0], "#C14");
@@ -5050,7 +5050,7 @@ namespace MonoTests.System.Diagnostics
                                        Assert.AreEqual (ushort.MaxValue, entry.EventID, "#D8");
                                        Assert.AreEqual (entry.EventID, entry.InstanceId, "#D9");
                                        Assert.IsNotNull (entry.MachineName, "#D10");
-                                       Assert.AreEqual (Environment.MachineName, entry.MachineName, "#D11");
+                                       Assert.AreEqual (Environment.MachineName.ToUpper(), entry.MachineName.ToUpper(), "#D11");
                                        Assert.IsNotNull (entry.ReplacementStrings, "#D12");
                                        Assert.AreEqual (1, entry.ReplacementStrings.Length, "#D13");
                                        Assert.AreEqual ("WriteEntry6c", entry.ReplacementStrings [0], "#D14");
@@ -5264,7 +5264,7 @@ namespace MonoTests.System.Diagnostics
                                        Assert.AreEqual (888, entry.EventID, "#B8");
                                        Assert.AreEqual (entry.EventID, entry.InstanceId, "#B9");
                                        Assert.IsNotNull (entry.MachineName, "#B10");
-                                       Assert.AreEqual (Environment.MachineName, entry.MachineName, "#B11");
+                                       Assert.AreEqual (Environment.MachineName.ToUpper(), entry.MachineName.ToUpper(), "#B11");
                                        Assert.IsNotNull (entry.ReplacementStrings, "#B12");
                                        Assert.AreEqual (1, entry.ReplacementStrings.Length, "#B13");
                                        Assert.AreEqual (string.Empty, entry.ReplacementStrings [0], "#B14");
@@ -5313,7 +5313,7 @@ namespace MonoTests.System.Diagnostics
                                        Assert.AreEqual (343, entry.EventID, "#B8");
                                        Assert.AreEqual (entry.EventID, entry.InstanceId, "#B9");
                                        Assert.IsNotNull (entry.MachineName, "#B10");
-                                       Assert.AreEqual (Environment.MachineName, entry.MachineName, "#B11");
+                                       Assert.AreEqual (Environment.MachineName.ToUpper(), entry.MachineName.ToUpper(), "#B11");
                                        Assert.IsNotNull (entry.ReplacementStrings, "#B12");
                                        Assert.AreEqual (1, entry.ReplacementStrings.Length, "#B13");
                                        Assert.AreEqual (string.Empty, entry.ReplacementStrings [0], "#B14");
@@ -5365,7 +5365,7 @@ namespace MonoTests.System.Diagnostics
                                        Assert.AreEqual (2, entry.EventID, "#B8");
                                        Assert.AreEqual (entry.EventID, entry.InstanceId, "#B9");
                                        Assert.IsNotNull (entry.MachineName, "#B10");
-                                       Assert.AreEqual (Environment.MachineName, entry.MachineName, "#B11");
+                                       Assert.AreEqual (Environment.MachineName.ToUpper(), entry.MachineName.ToUpper(), "#B11");
                                        Assert.IsNotNull (entry.ReplacementStrings, "#B12");
                                        Assert.AreEqual (1, entry.ReplacementStrings.Length, "#B13");
                                        Assert.AreEqual ("WriteEntry1", entry.ReplacementStrings [0], "#B14");
@@ -5432,7 +5432,7 @@ namespace MonoTests.System.Diagnostics
                                        Assert.AreEqual (54, entry.EventID, "#B8");
                                        Assert.AreEqual (entry.EventID, entry.InstanceId, "#B9");
                                        Assert.IsNotNull (entry.MachineName, "#B10");
-                                       Assert.AreEqual (Environment.MachineName, entry.MachineName, "#B11");
+                                       Assert.AreEqual (Environment.MachineName.ToUpper(), entry.MachineName.ToUpper(), "#B11");
                                        Assert.IsNotNull (entry.ReplacementStrings, "#B12");
                                        Assert.AreEqual (1, entry.ReplacementStrings.Length, "#B13");
                                        Assert.AreEqual ("WriteEntry7a", entry.ReplacementStrings [0], "#B14");
@@ -5454,7 +5454,7 @@ namespace MonoTests.System.Diagnostics
                                        Assert.AreEqual (0, entry.EventID, "#C8");
                                        Assert.AreEqual (entry.EventID, entry.InstanceId, "#C9");
                                        Assert.IsNotNull (entry.MachineName, "#C10");
-                                       Assert.AreEqual (Environment.MachineName, entry.MachineName, "#C11");
+                                       Assert.AreEqual (Environment.MachineName.ToUpper(), entry.MachineName.ToUpper(), "#C11");
                                        Assert.IsNotNull (entry.ReplacementStrings, "#C12");
                                        Assert.AreEqual (1, entry.ReplacementStrings.Length, "#C13");
                                        Assert.AreEqual ("WriteEntry7b" + Environment.NewLine + "ok", entry.ReplacementStrings [0], "#C14");
@@ -5477,7 +5477,7 @@ namespace MonoTests.System.Diagnostics
                                        Assert.AreEqual (ushort.MaxValue, entry.EventID, "#D8");
                                        Assert.AreEqual (entry.EventID, entry.InstanceId, "#D9");
                                        Assert.IsNotNull (entry.MachineName, "#D10");
-                                       Assert.AreEqual (Environment.MachineName, entry.MachineName, "#D11");
+                                       Assert.AreEqual (Environment.MachineName.ToUpper(), entry.MachineName.ToUpper(), "#D11");
                                        Assert.IsNotNull (entry.ReplacementStrings, "#D12");
                                        Assert.AreEqual (1, entry.ReplacementStrings.Length, "#D13");
                                        Assert.AreEqual ("WriteEntry7c" + Environment.NewLine + "ok", entry.ReplacementStrings [0], "#D14");
@@ -5585,7 +5585,7 @@ namespace MonoTests.System.Diagnostics
                                        Assert.AreEqual (56, entry.EventID, "#A8");
                                        Assert.AreEqual (entry.EventID, entry.InstanceId, "#A9");
                                        Assert.IsNotNull (entry.MachineName, "#A10");
-                                       Assert.AreEqual (Environment.MachineName, entry.MachineName, "#A11");
+                                       Assert.AreEqual (Environment.MachineName.ToUpper(), entry.MachineName.ToUpper(), "#A11");
                                        Assert.IsNotNull (entry.ReplacementStrings, "#A12");
                                        Assert.AreEqual (1, entry.ReplacementStrings.Length, "#A13");
                                        Assert.AreEqual (string.Empty, entry.ReplacementStrings [0], "#A14");
@@ -5629,7 +5629,7 @@ namespace MonoTests.System.Diagnostics
                                        Assert.AreEqual (76, entry.EventID, "#A8");
                                        Assert.AreEqual (entry.EventID, entry.InstanceId, "#A9");
                                        Assert.IsNotNull (entry.MachineName, "#A10");
-                                       Assert.AreEqual (Environment.MachineName, entry.MachineName, "#A11");
+                                       Assert.AreEqual (Environment.MachineName.ToUpper(), entry.MachineName.ToUpper(), "#A11");
                                        Assert.IsNotNull (entry.ReplacementStrings, "#A12");
                                        Assert.AreEqual (1, entry.ReplacementStrings.Length, "#A13");
                                        Assert.AreEqual (string.Empty, entry.ReplacementStrings [0], "#A14");
@@ -5679,7 +5679,7 @@ namespace MonoTests.System.Diagnostics
                                        Assert.AreEqual (89, entry.EventID, "#B8");
                                        Assert.AreEqual (entry.EventID, entry.InstanceId, "#B9");
                                        Assert.IsNotNull (entry.MachineName, "#B10");
-                                       Assert.AreEqual (Environment.MachineName, entry.MachineName, "#B11");
+                                       Assert.AreEqual (Environment.MachineName.ToUpper(), entry.MachineName.ToUpper(), "#B11");
                                        Assert.IsNotNull (entry.ReplacementStrings, "#B12");
                                        Assert.AreEqual (1, entry.ReplacementStrings.Length, "#B13");
                                        Assert.AreEqual ("test", entry.ReplacementStrings [0], "#B14");
@@ -5757,7 +5757,7 @@ namespace MonoTests.System.Diagnostics
                                        Assert.AreEqual (56, entry.EventID, "#B8");
                                        Assert.AreEqual (entry.EventID, entry.InstanceId, "#B9");
                                        Assert.IsNotNull (entry.MachineName, "#B10");
-                                       Assert.AreEqual (Environment.MachineName, entry.MachineName, "#B11");
+                                       Assert.AreEqual (Environment.MachineName.ToUpper(), entry.MachineName.ToUpper(), "#B11");
                                        Assert.IsNotNull (entry.ReplacementStrings, "#B12");
                                        Assert.AreEqual (1, entry.ReplacementStrings.Length, "#B13");
                                        Assert.AreEqual ("WriteEntry8a", entry.ReplacementStrings [0], "#B14");
@@ -5779,7 +5779,7 @@ namespace MonoTests.System.Diagnostics
                                        Assert.AreEqual (0, entry.EventID, "#C8");
                                        Assert.AreEqual (entry.EventID, entry.InstanceId, "#C9");
                                        Assert.IsNotNull (entry.MachineName, "#C10");
-                                       Assert.AreEqual (Environment.MachineName, entry.MachineName, "#C11");
+                                       Assert.AreEqual (Environment.MachineName.ToUpper(), entry.MachineName.ToUpper(), "#C11");
                                        Assert.IsNotNull (entry.ReplacementStrings, "#C12");
                                        Assert.AreEqual (1, entry.ReplacementStrings.Length, "#C13");
                                        Assert.AreEqual ("WriteEntry8b" + Environment.NewLine + "ok", entry.ReplacementStrings [0], "#C14");
@@ -5801,7 +5801,7 @@ namespace MonoTests.System.Diagnostics
                                        Assert.AreEqual (ushort.MaxValue, entry.EventID, "#D8");
                                        Assert.AreEqual (entry.EventID, entry.InstanceId, "#D9");
                                        Assert.IsNotNull (entry.MachineName, "#D10");
-                                       Assert.AreEqual (Environment.MachineName, entry.MachineName, "#D11");
+                                       Assert.AreEqual (Environment.MachineName.ToUpper(), entry.MachineName.ToUpper(), "#D11");
                                        Assert.IsNotNull (entry.ReplacementStrings, "#D12");
                                        Assert.AreEqual (1, entry.ReplacementStrings.Length, "#D13");
                                        Assert.AreEqual ("WriteEntry8c", entry.ReplacementStrings [0], "#D14");
@@ -6017,7 +6017,7 @@ namespace MonoTests.System.Diagnostics
                                        Assert.AreEqual (888, entry.EventID, "#B8");
                                        Assert.AreEqual (entry.EventID, entry.InstanceId, "#B9");
                                        Assert.IsNotNull (entry.MachineName, "#B10");
-                                       Assert.AreEqual (Environment.MachineName, entry.MachineName, "#B11");
+                                       Assert.AreEqual (Environment.MachineName.ToUpper(), entry.MachineName.ToUpper(), "#B11");
                                        Assert.IsNotNull (entry.ReplacementStrings, "#B12");
                                        Assert.AreEqual (1, entry.ReplacementStrings.Length, "#B13");
                                        Assert.AreEqual (string.Empty, entry.ReplacementStrings [0], "#B14");
@@ -6066,7 +6066,7 @@ namespace MonoTests.System.Diagnostics
                                        Assert.AreEqual (343, entry.EventID, "#B8");
                                        Assert.AreEqual (entry.EventID, entry.InstanceId, "#B9");
                                        Assert.IsNotNull (entry.MachineName, "#B10");
-                                       Assert.AreEqual (Environment.MachineName, entry.MachineName, "#B11");
+                                       Assert.AreEqual (Environment.MachineName.ToUpper(), entry.MachineName.ToUpper(), "#B11");
                                        Assert.IsNotNull (entry.ReplacementStrings, "#B12");
                                        Assert.AreEqual (1, entry.ReplacementStrings.Length, "#B13");
                                        Assert.AreEqual (string.Empty, entry.ReplacementStrings [0], "#B14");
@@ -6118,7 +6118,7 @@ namespace MonoTests.System.Diagnostics
                                        Assert.AreEqual (2, entry.EventID, "#B8");
                                        Assert.AreEqual (entry.EventID, entry.InstanceId, "#B9");
                                        Assert.IsNotNull (entry.MachineName, "#B10");
-                                       Assert.AreEqual (Environment.MachineName, entry.MachineName, "#B11");
+                                       Assert.AreEqual (Environment.MachineName.ToUpper(), entry.MachineName.ToUpper(), "#B11");
                                        Assert.IsNotNull (entry.ReplacementStrings, "#B12");
                                        Assert.AreEqual (1, entry.ReplacementStrings.Length, "#B13");
                                        Assert.AreEqual ("WriteEntry1", entry.ReplacementStrings [0], "#B14");
@@ -6185,7 +6185,7 @@ namespace MonoTests.System.Diagnostics
                                        Assert.AreEqual (54, entry.EventID, "#B8");
                                        Assert.AreEqual (entry.EventID, entry.InstanceId, "#B9");
                                        Assert.IsNotNull (entry.MachineName, "#B10");
-                                       Assert.AreEqual (Environment.MachineName, entry.MachineName, "#B11");
+                                       Assert.AreEqual (Environment.MachineName.ToUpper(), entry.MachineName.ToUpper(), "#B11");
                                        Assert.IsNotNull (entry.ReplacementStrings, "#B12");
                                        Assert.AreEqual (1, entry.ReplacementStrings.Length, "#B13");
                                        Assert.AreEqual ("WriteEntry9a", entry.ReplacementStrings [0], "#B14");
@@ -6208,7 +6208,7 @@ namespace MonoTests.System.Diagnostics
                                        Assert.AreEqual (0, entry.EventID, "#C8");
                                        Assert.AreEqual (entry.EventID, entry.InstanceId, "#C9");
                                        Assert.IsNotNull (entry.MachineName, "#C10");
-                                       Assert.AreEqual (Environment.MachineName, entry.MachineName, "#C11");
+                                       Assert.AreEqual (Environment.MachineName.ToUpper(), entry.MachineName.ToUpper(), "#C11");
                                        Assert.IsNotNull (entry.ReplacementStrings, "#C12");
                                        Assert.AreEqual (1, entry.ReplacementStrings.Length, "#C13");
                                        Assert.AreEqual ("WriteEntry9b" + Environment.NewLine + "ok", entry.ReplacementStrings [0], "#C14");
@@ -6231,7 +6231,7 @@ namespace MonoTests.System.Diagnostics
                                        Assert.AreEqual (ushort.MaxValue, entry.EventID, "#D8");
                                        Assert.AreEqual (entry.EventID, entry.InstanceId, "#D9");
                                        Assert.IsNotNull (entry.MachineName, "#D10");
-                                       Assert.AreEqual (Environment.MachineName, entry.MachineName, "#D11");
+                                       Assert.AreEqual (Environment.MachineName.ToUpper(), entry.MachineName.ToUpper(), "#D11");
                                        Assert.IsNotNull (entry.ReplacementStrings, "#D12");
                                        Assert.AreEqual (1, entry.ReplacementStrings.Length, "#D13");
                                        Assert.AreEqual ("WriteEntry9c" + Environment.NewLine + "ok", entry.ReplacementStrings [0], "#D14");
@@ -6339,7 +6339,7 @@ namespace MonoTests.System.Diagnostics
                                        Assert.AreEqual (56, entry.EventID, "#A8");
                                        Assert.AreEqual (entry.EventID, entry.InstanceId, "#A9");
                                        Assert.IsNotNull (entry.MachineName, "#A10");
-                                       Assert.AreEqual (Environment.MachineName, entry.MachineName, "#A11");
+                                       Assert.AreEqual (Environment.MachineName.ToUpper(), entry.MachineName.ToUpper(), "#A11");
                                        Assert.IsNotNull (entry.ReplacementStrings, "#A12");
                                        Assert.AreEqual (1, entry.ReplacementStrings.Length, "#A13");
                                        Assert.AreEqual (string.Empty, entry.ReplacementStrings [0], "#A14");
@@ -6383,7 +6383,7 @@ namespace MonoTests.System.Diagnostics
                                        Assert.AreEqual (76, entry.EventID, "#A8");
                                        Assert.AreEqual (entry.EventID, entry.InstanceId, "#A9");
                                        Assert.IsNotNull (entry.MachineName, "#A10");
-                                       Assert.AreEqual (Environment.MachineName, entry.MachineName, "#A11");
+                                       Assert.AreEqual (Environment.MachineName.ToUpper(), entry.MachineName.ToUpper(), "#A11");
                                        Assert.IsNotNull (entry.ReplacementStrings, "#A12");
                                        Assert.AreEqual (1, entry.ReplacementStrings.Length, "#A13");
                                        Assert.AreEqual (string.Empty, entry.ReplacementStrings [0], "#A14");
@@ -6433,7 +6433,7 @@ namespace MonoTests.System.Diagnostics
                                        Assert.AreEqual (89, entry.EventID, "#B8");
                                        Assert.AreEqual (entry.EventID, entry.InstanceId, "#B9");
                                        Assert.IsNotNull (entry.MachineName, "#B10");
-                                       Assert.AreEqual (Environment.MachineName, entry.MachineName, "#B11");
+                                       Assert.AreEqual (Environment.MachineName.ToUpper(), entry.MachineName.ToUpper(), "#B11");
                                        Assert.IsNotNull (entry.ReplacementStrings, "#B12");
                                        Assert.AreEqual (1, entry.ReplacementStrings.Length, "#B13");
                                        Assert.AreEqual ("test", entry.ReplacementStrings [0], "#B14");
@@ -6513,7 +6513,7 @@ namespace MonoTests.System.Diagnostics
                                        Assert.AreEqual (54, entry.EventID, "#B8");
                                        Assert.AreEqual (entry.EventID, entry.InstanceId, "#B9");
                                        Assert.IsNotNull (entry.MachineName, "#B10");
-                                       Assert.AreEqual (Environment.MachineName, entry.MachineName, "#B11");
+                                       Assert.AreEqual (Environment.MachineName.ToUpper(), entry.MachineName.ToUpper(), "#B11");
                                        Assert.IsNotNull (entry.ReplacementStrings, "#B12");
                                        Assert.AreEqual (1, entry.ReplacementStrings.Length, "#B13");
                                        Assert.AreEqual ("WriteEntry9a", entry.ReplacementStrings [0], "#B14");
@@ -6536,7 +6536,7 @@ namespace MonoTests.System.Diagnostics
                                        Assert.AreEqual (0, entry.EventID, "#C8");
                                        Assert.AreEqual (entry.EventID, entry.InstanceId, "#C9");
                                        Assert.IsNotNull (entry.MachineName, "#C10");
-                                       Assert.AreEqual (Environment.MachineName, entry.MachineName, "#C11");
+                                       Assert.AreEqual (Environment.MachineName.ToUpper(), entry.MachineName.ToUpper(), "#C11");
                                        Assert.IsNotNull (entry.ReplacementStrings, "#C12");
                                        Assert.AreEqual (1, entry.ReplacementStrings.Length, "#C13");
                                        Assert.AreEqual ("WriteEntry9b" + Environment.NewLine + "ok", entry.ReplacementStrings [0], "#C14");
@@ -6559,7 +6559,7 @@ namespace MonoTests.System.Diagnostics
                                        Assert.AreEqual (ushort.MaxValue, entry.EventID, "#D8");
                                        Assert.AreEqual (entry.EventID, entry.InstanceId, "#D9");
                                        Assert.IsNotNull (entry.MachineName, "#D10");
-                                       Assert.AreEqual (Environment.MachineName, entry.MachineName, "#D11");
+                                       Assert.AreEqual (Environment.MachineName.ToUpper(), entry.MachineName.ToUpper(), "#D11");
                                        Assert.IsNotNull (entry.ReplacementStrings, "#D12");
                                        Assert.AreEqual (1, entry.ReplacementStrings.Length, "#D13");
                                        Assert.AreEqual ("WriteEntry9c" + Environment.NewLine + "ok", entry.ReplacementStrings [0], "#D14");
@@ -6667,7 +6667,7 @@ namespace MonoTests.System.Diagnostics
                                        Assert.AreEqual (56, entry.EventID, "#A8");
                                        Assert.AreEqual (entry.EventID, entry.InstanceId, "#A9");
                                        Assert.IsNotNull (entry.MachineName, "#A10");
-                                       Assert.AreEqual (Environment.MachineName, entry.MachineName, "#A11");
+                                       Assert.AreEqual (Environment.MachineName.ToUpper(), entry.MachineName.ToUpper(), "#A11");
                                        Assert.IsNotNull (entry.ReplacementStrings, "#A12");
                                        Assert.AreEqual (1, entry.ReplacementStrings.Length, "#A13");
                                        Assert.AreEqual (string.Empty, entry.ReplacementStrings [0], "#A14");
@@ -6711,7 +6711,7 @@ namespace MonoTests.System.Diagnostics
                                        Assert.AreEqual (76, entry.EventID, "#A8");
                                        Assert.AreEqual (entry.EventID, entry.InstanceId, "#A9");
                                        Assert.IsNotNull (entry.MachineName, "#A10");
-                                       Assert.AreEqual (Environment.MachineName, entry.MachineName, "#A11");
+                                       Assert.AreEqual (Environment.MachineName.ToUpper(), entry.MachineName.ToUpper(), "#A11");
                                        Assert.IsNotNull (entry.ReplacementStrings, "#A12");
                                        Assert.AreEqual (1, entry.ReplacementStrings.Length, "#A13");
                                        Assert.AreEqual (string.Empty, entry.ReplacementStrings [0], "#A14");
@@ -6761,7 +6761,7 @@ namespace MonoTests.System.Diagnostics
                                        Assert.AreEqual (89, entry.EventID, "#B8");
                                        Assert.AreEqual (entry.EventID, entry.InstanceId, "#B9");
                                        Assert.IsNotNull (entry.MachineName, "#B10");
-                                       Assert.AreEqual (Environment.MachineName, entry.MachineName, "#B11");
+                                       Assert.AreEqual (Environment.MachineName.ToUpper(), entry.MachineName.ToUpper(), "#B11");
                                        Assert.IsNotNull (entry.ReplacementStrings, "#B12");
                                        Assert.AreEqual (1, entry.ReplacementStrings.Length, "#B13");
                                        Assert.AreEqual ("test", entry.ReplacementStrings [0], "#B14");
@@ -6839,7 +6839,7 @@ namespace MonoTests.System.Diagnostics
                                        Assert.AreEqual (5, entry.EventID, "#B8");
                                        Assert.AreEqual (entry.EventID, entry.InstanceId, "#B9");
                                        Assert.IsNotNull (entry.MachineName, "#B10");
-                                       Assert.AreEqual (Environment.MachineName, entry.MachineName, "#B11");
+                                       Assert.AreEqual (Environment.MachineName.ToUpper(), entry.MachineName.ToUpper(), "#B11");
                                        Assert.IsNotNull (entry.ReplacementStrings, "#B12");
                                        Assert.AreEqual (4, entry.ReplacementStrings.Length, "#B13");
                                        Assert.AreEqual ("5", entry.ReplacementStrings [0], "#B14");
@@ -6863,7 +6863,7 @@ namespace MonoTests.System.Diagnostics
                                        Assert.AreEqual (5, entry.EventID, "#C8");
                                        Assert.AreEqual (entry.EventID, entry.InstanceId, "#C9");
                                        Assert.IsNotNull (entry.MachineName, "#C10");
-                                       Assert.AreEqual (Environment.MachineName, entry.MachineName, "#C11");
+                                       Assert.AreEqual (Environment.MachineName.ToUpper(), entry.MachineName.ToUpper(), "#C11");
                                        Assert.IsNotNull (entry.ReplacementStrings, "#C12");
                                        Assert.AreEqual (0, entry.ReplacementStrings.Length, "#C13");
                                        Assert.IsNotNull (entry.Source, "#C14");
@@ -6937,7 +6937,7 @@ namespace MonoTests.System.Diagnostics
                                        Assert.AreEqual (5, entry.EventID, "#B8");
                                        Assert.AreEqual (entry.EventID, entry.InstanceId, "#B9");
                                        Assert.IsNotNull (entry.MachineName, "#B10");
-                                       Assert.AreEqual (Environment.MachineName, entry.MachineName, "#B11");
+                                       Assert.AreEqual (Environment.MachineName.ToUpper(), entry.MachineName.ToUpper(), "#B11");
                                        Assert.IsNotNull (entry.ReplacementStrings, "#B12");
                                        Assert.AreEqual (2, entry.ReplacementStrings.Length, "#B13");
                                        Assert.AreEqual ("replace1", entry.ReplacementStrings[0], "#B14");
@@ -6987,7 +6987,7 @@ namespace MonoTests.System.Diagnostics
                                        Assert.AreEqual (5, entry.EventID, "#B8");
                                        Assert.AreEqual (entry.EventID, entry.InstanceId, "#B9");
                                        Assert.IsNotNull (entry.MachineName, "#B10");
-                                       Assert.AreEqual (Environment.MachineName, entry.MachineName, "#B11");
+                                       Assert.AreEqual (Environment.MachineName.ToUpper(), entry.MachineName.ToUpper(), "#B11");
                                        Assert.IsNotNull (entry.ReplacementStrings, "#B12");
                                        Assert.AreEqual (1, entry.ReplacementStrings.Length, "#B13");
                                        Assert.AreEqual (string.Empty, entry.ReplacementStrings [0], "#B14");
@@ -7037,7 +7037,7 @@ namespace MonoTests.System.Diagnostics
                                        Assert.AreEqual (5, entry.EventID, "#B8");
                                        Assert.AreEqual (entry.EventID, entry.InstanceId, "#B9");
                                        Assert.IsNotNull (entry.MachineName, "#B10");
-                                       Assert.AreEqual (Environment.MachineName, entry.MachineName, "#B11");
+                                       Assert.AreEqual (Environment.MachineName.ToUpper(), entry.MachineName.ToUpper(), "#B11");
                                        Assert.IsNotNull (entry.ReplacementStrings, "#B12");
                                        Assert.AreEqual (4, entry.ReplacementStrings.Length, "#B13");
                                        Assert.AreEqual ("5", entry.ReplacementStrings [0], "#B14");
@@ -7061,7 +7061,7 @@ namespace MonoTests.System.Diagnostics
                                        Assert.AreEqual (5, entry.EventID, "#C8");
                                        Assert.AreEqual (entry.EventID, entry.InstanceId, "#C9");
                                        Assert.IsNotNull (entry.MachineName, "#C10");
-                                       Assert.AreEqual (Environment.MachineName, entry.MachineName, "#C11");
+                                       Assert.AreEqual (Environment.MachineName.ToUpper(), entry.MachineName.ToUpper(), "#C11");
                                        Assert.IsNotNull (entry.ReplacementStrings, "#C12");
                                        Assert.AreEqual (0, entry.ReplacementStrings.Length, "#C13");
                                        Assert.IsNotNull (entry.Source, "#C14");
@@ -7109,7 +7109,7 @@ namespace MonoTests.System.Diagnostics
                                        Assert.AreEqual (5, entry.EventID, "#B8");
                                        Assert.AreEqual (entry.EventID, entry.InstanceId, "#B9");
                                        Assert.IsNotNull (entry.MachineName, "#B10");
-                                       Assert.AreEqual (Environment.MachineName, entry.MachineName, "#B11");
+                                       Assert.AreEqual (Environment.MachineName.ToUpper(), entry.MachineName.ToUpper(), "#B11");
                                        Assert.IsNotNull (entry.ReplacementStrings, "#B12");
                                        Assert.AreEqual (3, entry.ReplacementStrings.Length, "#B13");
                                        Assert.AreEqual ("replace1", entry.ReplacementStrings [0], "#B14");
@@ -7189,7 +7189,7 @@ namespace MonoTests.System.Diagnostics
                                        Assert.AreEqual (5, entry.EventID, "#B8");
                                        Assert.AreEqual (entry.EventID, entry.InstanceId, "#B9");
                                        Assert.IsNotNull (entry.MachineName, "#B10");
-                                       Assert.AreEqual (Environment.MachineName, entry.MachineName, "#B11");
+                                       Assert.AreEqual (Environment.MachineName.ToUpper(), entry.MachineName.ToUpper(), "#B11");
                                        Assert.IsNotNull (entry.ReplacementStrings, "#B12");
                                        Assert.AreEqual (2, entry.ReplacementStrings.Length, "#B13");
                                        Assert.AreEqual ("replace1", entry.ReplacementStrings [0], "#B14");
@@ -7240,7 +7240,7 @@ namespace MonoTests.System.Diagnostics
                                        Assert.AreEqual (5, entry.EventID, "#B8");
                                        Assert.AreEqual (entry.EventID, entry.InstanceId, "#B9");
                                        Assert.IsNotNull (entry.MachineName, "#B10");
-                                       Assert.AreEqual (Environment.MachineName, entry.MachineName, "#B11");
+                                       Assert.AreEqual (Environment.MachineName.ToUpper(), entry.MachineName.ToUpper(), "#B11");
                                        Assert.IsNotNull (entry.ReplacementStrings, "#B12");
                                        Assert.AreEqual (1, entry.ReplacementStrings.Length, "#B13");
                                        Assert.IsNotNull (entry.Source, "#B14");
@@ -7289,7 +7289,7 @@ namespace MonoTests.System.Diagnostics
                                        Assert.AreEqual (5, entry.EventID, "#B8");
                                        Assert.AreEqual (entry.EventID, entry.InstanceId, "#B9");
                                        Assert.IsNotNull (entry.MachineName, "#B10");
-                                       Assert.AreEqual (Environment.MachineName, entry.MachineName, "#B11");
+                                       Assert.AreEqual (Environment.MachineName.ToUpper(), entry.MachineName.ToUpper(), "#B11");
                                        Assert.IsNotNull (entry.ReplacementStrings, "#B12");
                                        Assert.AreEqual (4, entry.ReplacementStrings.Length, "#B13");
                                        Assert.AreEqual ("5", entry.ReplacementStrings [0], "#B14");
@@ -7313,7 +7313,7 @@ namespace MonoTests.System.Diagnostics
                                        Assert.AreEqual (5, entry.EventID, "#C8");
                                        Assert.AreEqual (entry.EventID, entry.InstanceId, "#C9");
                                        Assert.IsNotNull (entry.MachineName, "#C10");
-                                       Assert.AreEqual (Environment.MachineName, entry.MachineName, "#C11");
+                                       Assert.AreEqual (Environment.MachineName.ToUpper(), entry.MachineName.ToUpper(), "#C11");
                                        Assert.IsNotNull (entry.ReplacementStrings, "#C12");
                                        Assert.AreEqual (0, entry.ReplacementStrings.Length, "#C13");
                                        Assert.IsNotNull (entry.Source, "#C14");
@@ -7379,7 +7379,7 @@ namespace MonoTests.System.Diagnostics
                                        Assert.AreEqual (666, entry.EventID, "#B8");
                                        Assert.AreEqual (entry.EventID, entry.InstanceId, "#B9");
                                        Assert.IsNotNull (entry.MachineName, "#B10");
-                                       Assert.AreEqual (Environment.MachineName, entry.MachineName, "#B11");
+                                       Assert.AreEqual (Environment.MachineName.ToUpper(), entry.MachineName.ToUpper(), "#B11");
                                        Assert.IsNotNull (entry.ReplacementStrings, "#B12");
                                        Assert.AreEqual (2, entry.ReplacementStrings.Length, "#B13");
                                        Assert.AreEqual ("replace1", entry.ReplacementStrings [0], "#B14");
@@ -7434,7 +7434,7 @@ namespace MonoTests.System.Diagnostics
                                        Assert.AreEqual (5, entry.EventID, "#B8");
                                        Assert.AreEqual (entry.EventID, entry.InstanceId, "#B9");
                                        Assert.IsNotNull (entry.MachineName, "#B10");
-                                       Assert.AreEqual (Environment.MachineName, entry.MachineName, "#B11");
+                                       Assert.AreEqual (Environment.MachineName.ToUpper(), entry.MachineName.ToUpper(), "#B11");
                                        Assert.IsNotNull (entry.ReplacementStrings, "#B12");
                                        Assert.AreEqual (1, entry.ReplacementStrings.Length, "#B13");
                                        Assert.AreEqual (string.Empty, entry.ReplacementStrings [0], "#B14");
@@ -7485,7 +7485,7 @@ namespace MonoTests.System.Diagnostics
                                        Assert.AreEqual (5, entry.EventID, "#B8");
                                        Assert.AreEqual (entry.EventID, entry.InstanceId, "#B9");
                                        Assert.IsNotNull (entry.MachineName, "#B10");
-                                       Assert.AreEqual (Environment.MachineName, entry.MachineName, "#B11");
+                                       Assert.AreEqual (Environment.MachineName.ToUpper(), entry.MachineName.ToUpper(), "#B11");
                                        Assert.IsNotNull (entry.ReplacementStrings, "#B12");
                                        Assert.AreEqual (4, entry.ReplacementStrings.Length, "#B13");
                                        Assert.AreEqual ("5", entry.ReplacementStrings [0], "#B14");
@@ -7509,7 +7509,7 @@ namespace MonoTests.System.Diagnostics
                                        Assert.AreEqual (5, entry.EventID, "#C8");
                                        Assert.AreEqual (entry.EventID, entry.InstanceId, "#C9");
                                        Assert.IsNotNull (entry.MachineName, "#C10");
-                                       Assert.AreEqual (Environment.MachineName, entry.MachineName, "#C11");
+                                       Assert.AreEqual (Environment.MachineName.ToUpper(), entry.MachineName.ToUpper(), "#C11");
                                        Assert.IsNotNull (entry.ReplacementStrings, "#C12");
                                        Assert.AreEqual (0, entry.ReplacementStrings.Length, "#C13");
                                        Assert.IsNotNull (entry.Source, "#C14");
@@ -7557,7 +7557,7 @@ namespace MonoTests.System.Diagnostics
                                        Assert.AreEqual (5, entry.EventID, "#B8");
                                        Assert.AreEqual (entry.EventID, entry.InstanceId, "#B9");
                                        Assert.IsNotNull (entry.MachineName, "#B10");
-                                       Assert.AreEqual (Environment.MachineName, entry.MachineName, "#B11");
+                                       Assert.AreEqual (Environment.MachineName.ToUpper(), entry.MachineName.ToUpper(), "#B11");
                                        Assert.IsNotNull (entry.ReplacementStrings, "#B12");
                                        Assert.AreEqual (3, entry.ReplacementStrings.Length, "#B13");
                                        Assert.AreEqual ("replace1", entry.ReplacementStrings [0], "#B14");
@@ -7627,7 +7627,7 @@ namespace MonoTests.System.Diagnostics
                                        Assert.AreEqual (666, entry.EventID, "#B8");
                                        Assert.AreEqual (entry.EventID, entry.InstanceId, "#B9");
                                        Assert.IsNotNull (entry.MachineName, "#B10");
-                                       Assert.AreEqual (Environment.MachineName, entry.MachineName, "#B11");
+                                       Assert.AreEqual (Environment.MachineName.ToUpper(), entry.MachineName.ToUpper(), "#B11");
                                        Assert.IsNotNull (entry.ReplacementStrings, "#B12");
                                        Assert.AreEqual (2, entry.ReplacementStrings.Length, "#B13");
                                        Assert.AreEqual ("replace1", entry.ReplacementStrings [0], "#B14");
@@ -7683,7 +7683,7 @@ namespace MonoTests.System.Diagnostics
                                        Assert.AreEqual (5, entry.EventID, "#B8");
                                        Assert.AreEqual (entry.EventID, entry.InstanceId, "#B9");
                                        Assert.IsNotNull (entry.MachineName, "#B10");
-                                       Assert.AreEqual (Environment.MachineName, entry.MachineName, "#B11");
+                                       Assert.AreEqual (Environment.MachineName.ToUpper(), entry.MachineName.ToUpper(), "#B11");
                                        Assert.IsNotNull (entry.ReplacementStrings, "#B12");
                                        Assert.AreEqual (1, entry.ReplacementStrings.Length, "#B13");
                                        Assert.AreEqual (string.Empty, entry.ReplacementStrings [0], "#B14");
index 277604287550fde13168d44d19ec29833961db90..20a93a732b6f1d1c3dc00368a5e0e0bc846db7c9 100644 (file)
@@ -284,7 +284,9 @@ namespace MonoTests.System.Diagnostics
                                Assert.AreEqual (-2147467259, ex.ErrorCode, "#3");
                                Assert.IsNull (ex.InnerException, "#4");
                                Assert.IsNotNull (ex.Message, "#5");
-                               Assert.AreEqual (2, ex.NativeErrorCode, "#6");
+                               // TODO: On windows we get ACCESS_DENIED (5) instead of FILE_NOT_FOUND (2) and .NET
+                               // gives ERROR_INVALID_PARAMETER (87). See https://bugzilla.xamarin.com/show_bug.cgi?id=44514
+                               Assert.IsTrue (ex.NativeErrorCode == 2 || ex.NativeErrorCode == 5 || ex.NativeErrorCode == 87, "#6");
                        }
                }
 
@@ -440,7 +442,9 @@ namespace MonoTests.System.Diagnostics
                                Assert.AreEqual (-2147467259, ex.ErrorCode, "#3");
                                Assert.IsNull (ex.InnerException, "#4");
                                Assert.IsNotNull (ex.Message, "#5");
-                               Assert.AreEqual (2, ex.NativeErrorCode, "#6");
+                               // TODO: On windows we get ACCESS_DENIED (5) instead of FILE_NOT_FOUND (2) and .NET
+                               // gives ERROR_INVALID_PARAMETER (87). See https://bugzilla.xamarin.com/show_bug.cgi?id=44514
+                               Assert.IsTrue (ex.NativeErrorCode == 2 || ex.NativeErrorCode == 5 || ex.NativeErrorCode == 87, "#6");
                        }
                }
 
@@ -892,8 +896,11 @@ namespace MonoTests.System.Diagnostics
                                path = "/bin/cat";
 #endif
                                return new ProcessStartInfo (path);
-                       } else
-                               return new ProcessStartInfo ("type");
+                       } else {
+                               var psi = new ProcessStartInfo ("findstr");
+                               psi.Arguments = "\"^\"";
+                               return psi;
+                       }
                }
 #endif // MONO_FEATURE_PROCESS_START
 
@@ -1018,7 +1025,7 @@ namespace MonoTests.System.Diagnostics
 
                                StringBuilder sb = new StringBuilder ();
                                sb.AppendFormat ("Could not found: {0} {1}\n", name.Name, name.Version);
-                               sb.AppendLine ("Looked in assemblies:");
+                               sb.AppendLine ("Looked in modules:");
 
                                foreach (var o in modules) {
                                        var m = (ProcessModule) o;
index 820e84d2a89326a2ffe8a5de07f2403b4f0e7d37..07195bb9246a85a71c758c528406365828b7e7f8 100644 (file)
@@ -53,7 +53,7 @@ namespace MonoTests.System.Diagnostics
                public void ConstructorNullName ()
                {
                        SourceSwitch s = new SourceSwitch (null);
-                       Assert.IsEmpty (s.DisplayName);
+                       AssertHelper.IsEmpty (s.DisplayName);
                }
 
                [Test]
index 9d97fc8b53c615a8589e7fbea1a8cdc0d030038e..d8821a00c2ddbb42d380e3c49437300be24eac11 100644 (file)
@@ -190,8 +190,8 @@ namespace MonoTests.System.Diagnostics {
                public void NullSwitchHasEmptyDisplayNameAndDescription ()
                {
                        var s = new TestNullSwitch ();
-                       Assert.IsEmpty (s.DisplayName);
-                       Assert.IsEmpty (s.Description);
+                       AssertHelper.IsEmpty (s.DisplayName);
+                       AssertHelper.IsEmpty (s.Description);
                }
        }
 }
index 2ae31073e578abcc8593f01c833c7911ee7a5b2e..1aa78a9d99368a75faa4bee76c1c0eecb03e35f8 100644 (file)
@@ -343,7 +343,6 @@ namespace MonoTests.System.IO.Compression
                        return new MemoryStream (Encoding.UTF8.GetBytes (s));
                }
 
-#if NET_4_5
                [Test]
                public void CheckNet45Overloads () // Xambug #21982
                {
@@ -361,7 +360,6 @@ namespace MonoTests.System.IO.Compression
                        decompressing.Close();
                        backing.Close();
                }
-#endif 
 
                [Test]
                [ExpectedException (typeof (ArgumentException))]
@@ -412,6 +410,46 @@ namespace MonoTests.System.IO.Compression
                        using (var unZippedStream = new StreamReader (gZipStream, Encoding.UTF8)) {
                                unZipped = unZippedStream.ReadToEnd ();
                        }
+
+                       Assert.AreEqual(1877, unZipped.Length);
+               }
+
+               [Test]
+               public void Bug44994_Inflate()
+               {
+                       var base64String = @"7cWxCQAgDACwpeBjgqsgXiHU0fd9QzBLErX1EQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADepcxcuU/atm3btm3btm3btm3btm3btm3btm3btm3btm3btm3btm3btm3btm3btm3btm3btm3btm3btm3btm3btm3btm3btm3btm3btm3btm3btm3btm3btm3btm3btm37zy8=";
+
+                       byte[] byteArray = Convert.FromBase64String(base64String);
+                       string unZipped = null;
+
+                       using (var zippedMemoryStream = new MemoryStream(byteArray))
+                       using (var gZipStream = new DeflateStream(zippedMemoryStream, CompressionMode.Decompress))
+                       using (var unzippedMemStream = new MemoryStream())
+                       using (var unZippedStream = new StreamReader(gZipStream, Encoding.UTF8))
+                       {
+                               unZipped = unZippedStream.ReadToEnd();
+                       }
+
+                       Assert.AreEqual(81942, unZipped.Length);
+               }
+
+               [Test]
+               [Category ("MobileNotWorking")]
+               public void Bug44994_InflateByteByByte()
+               {
+                       int byteCount = 0;
+                       using (var fileStream = File.OpenRead(Path.Combine("Test", "compressed.bin")))
+                       {
+                               using (var deflateStream = new DeflateStream(fileStream, CompressionMode.Decompress, false))
+                               {
+                                       while (deflateStream.ReadByte() != -1)
+                                       {
+                                               byteCount++;
+                                       }
+                               }
+                       }
+
+                       Assert.AreEqual(125387, byteCount);
                }
        }
 }
index a72ffc6ee05be349d7ef0ef6a5e06e2dfe08a483..47a740ca14ace19a3450a045a7720c6cabe83cf7 100644 (file)
@@ -303,7 +303,6 @@ namespace MonoTests.System.IO.Compression
                        return new MemoryStream (Encoding.UTF8.GetBytes (s));
                }
 
-#if NET_4_5
                [Test]
                public void CheckNet45Overloads () // Xambug #21982
                {
@@ -321,7 +320,6 @@ namespace MonoTests.System.IO.Compression
                        decompressing.Close();
                        backing.Close();
                }
-#endif
        }
 }
 
index 909beb4988c8873dc7a6cd85d2b383443f1b290a..d3a39e413151fd52b8ed138b38e504c54e79c758 100644 (file)
@@ -16,16 +16,15 @@ using System.Threading;
 namespace MonoTests.System.Net.Mail
 {
        [TestFixture]
-       [Category ("RequiresBSDSockets")]
        public class SmtpClientTest
        {
-               SmtpClient smtp;
+               SmtpClient _smtp;
+               SmtpClient smtp { get { return _smtp ?? (_smtp = new SmtpClient ()); } }
                string tempFolder;
                
                [SetUp]
                public void GetReady ()
                {
-                       smtp = new SmtpClient ();
                        tempFolder = Path.Combine (Path.GetTempPath (), this.GetType ().FullName);
                        if (Directory.Exists (tempFolder))
                                Directory.Delete (tempFolder, true);
@@ -35,17 +34,24 @@ namespace MonoTests.System.Net.Mail
                [TearDown]
                public void TearDown ()
                {
+                       _smtp = null;
                        if (Directory.Exists (tempFolder))
                                Directory.Delete (tempFolder, true);
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Credentials_Default ()
                {
                        Assert.IsNull (smtp.Credentials);
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void DeliveryMethod ()
                {
                        Assert.AreEqual (SmtpDeliveryMethod.Network, smtp.DeliveryMethod, "#1");
@@ -61,6 +67,9 @@ namespace MonoTests.System.Net.Mail
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void EnableSsl ()
                {
                        Assert.IsFalse (smtp.EnableSsl, "#1");
@@ -71,6 +80,9 @@ namespace MonoTests.System.Net.Mail
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Host ()
                {
                        smtp.Host = "127.0.0.1";
@@ -87,6 +99,9 @@ namespace MonoTests.System.Net.Mail
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Host_Value_Null ()
                {
                        try {
@@ -101,6 +116,9 @@ namespace MonoTests.System.Net.Mail
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Host_Value_Empty ()
                {
                        try {
@@ -116,6 +134,9 @@ namespace MonoTests.System.Net.Mail
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void PickupDirectoryLocation ()
                {
                        Assert.IsNull (smtp.PickupDirectoryLocation, "#1");
@@ -132,6 +153,9 @@ namespace MonoTests.System.Net.Mail
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Port ()
                {
                        Assert.AreEqual (25, smtp.Port, "#1");
@@ -142,6 +166,9 @@ namespace MonoTests.System.Net.Mail
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Port_Value_Invalid ()
                {
                        // zero
@@ -168,6 +195,9 @@ namespace MonoTests.System.Net.Mail
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Send_Message_Null ()
                {
                        try {
@@ -182,6 +212,9 @@ namespace MonoTests.System.Net.Mail
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Send_Network_Host_Null ()
                {
                        try {
@@ -197,6 +230,9 @@ namespace MonoTests.System.Net.Mail
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Send_Network_Host_Whitespace ()
                {
                        smtp.Host = " \r\n ";
@@ -213,6 +249,9 @@ namespace MonoTests.System.Net.Mail
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Send_SpecifiedPickupDirectory ()
                {
                        smtp.DeliveryMethod = SmtpDeliveryMethod.SpecifiedPickupDirectory;
@@ -226,6 +265,9 @@ namespace MonoTests.System.Net.Mail
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Send_SpecifiedPickupDirectory_PickupDirectoryLocation_DirectoryNotFound ()
                {
                        Directory.Delete (tempFolder);
@@ -253,6 +295,9 @@ namespace MonoTests.System.Net.Mail
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Send_SpecifiedPickupDirectory_PickupDirectoryLocation_Empty ()
                {
                        smtp.DeliveryMethod = SmtpDeliveryMethod.SpecifiedPickupDirectory;
@@ -272,6 +317,9 @@ namespace MonoTests.System.Net.Mail
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Send_SpecifiedPickupDirectory_PickupDirectoryLocation_IllegalChars ()
                {
                        smtp.DeliveryMethod = SmtpDeliveryMethod.SpecifiedPickupDirectory;
@@ -297,6 +345,9 @@ namespace MonoTests.System.Net.Mail
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Send_SpecifiedPickupDirectory_PickupDirectoryLocation_NotAbsolute ()
                {
                        smtp.DeliveryMethod = SmtpDeliveryMethod.SpecifiedPickupDirectory;
@@ -316,6 +367,9 @@ namespace MonoTests.System.Net.Mail
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Send_SpecifiedPickupDirectory_PickupDirectoryLocation_Null ()
                {
                        smtp.DeliveryMethod = SmtpDeliveryMethod.SpecifiedPickupDirectory;
@@ -334,6 +388,9 @@ namespace MonoTests.System.Net.Mail
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Timeout ()
                {
                        Assert.AreEqual (100000, smtp.Timeout, "#1");
@@ -344,19 +401,29 @@ namespace MonoTests.System.Net.Mail
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
                [ExpectedException (typeof (ArgumentOutOfRangeException))]
+#endif
                public void Timeout_Value_Negative ()
                {
                        smtp.Timeout = -1;
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void UseDefaultCredentials_Default ()
                {
                        Assert.IsFalse (smtp.UseDefaultCredentials);
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Deliver ()
                {
                        var server = new SmtpServer ();
@@ -373,6 +440,9 @@ namespace MonoTests.System.Net.Mail
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Deliver_Envelope ()
                {
                        var server = new SmtpServer ();
@@ -391,6 +461,9 @@ namespace MonoTests.System.Net.Mail
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Deliver_Async ()
                {
                        // SmtpClient uses BackgroundWorker and listens for the RunWorkerCompleted
index 7fe74638571ee72021ae1421ccbd981111299a5d..51752302b206e18dfc35f35ec0c21011494c8bb0 100644 (file)
@@ -113,6 +113,9 @@ namespace MonoTests.System.Net.NetworkInformation
                [Test]
                public void DnsEnabled ()
                {
+                       if (Environment.OSVersion.Platform == PlatformID.Win32NT)
+                               Assert.Ignore ("IsDnsEnabled is not nessasarily enabled for all interfaces on windows.");
+
                        NetworkInterface[] adapters = NetworkInterface.GetAllNetworkInterfaces ();
                        foreach (NetworkInterface adapter in adapters)
                        {
index e5c70feab2c16b07d69d2a241697eea1f0d06220..e3542c34f37428c53bfd338e59b298a0909ff60a 100644 (file)
@@ -45,7 +45,6 @@ namespace MonoTests.System.Net.Security
 {
 
 [TestFixture]
-[Category ("RequiresBSDSockets")]
 public class SslStreamTest {
 
        byte[] m_serverCertRaw = { 48, 130, 5, 165, 2, 1, 3, 48, 130, 5, 95, 6, 9, 42, 134, 72, 134, 247, 13, 1, 7, 1, 160, 130, 5, 80, 4, 130, 5, 76, 48, 130, 5, 72, 48, 130, 2, 87, 6, 9, 42, 134, 72, 134, 247, 13, 1, 7, 6, 160, 130, 2, 72, 48, 130, 2, 68, 2, 1, 0, 48, 130, 2, 61, 6, 9, 42, 134, 72, 134, 247, 13, 1, 7, 1, 48, 28, 6, 10, 42, 134, 72, 134, 247, 13, 1, 12, 1, 3, 48, 14, 4, 8, 211, 176, 234, 3, 252, 26, 32, 15, 2, 2, 7, 208, 128, 130, 2, 16, 183, 149, 35, 180, 127, 95, 163, 122, 138, 244, 29, 177, 220, 173, 46, 73, 208, 217, 211, 190, 164, 183, 21, 110, 33, 122, 98, 163, 251, 16, 23, 106, 154, 14, 52, 177, 3, 12, 248, 226, 48, 123, 211, 6, 216, 6, 192, 175, 203, 142, 141, 143, 252, 178, 7, 162, 81, 232, 159, 42, 56, 177, 191, 53, 7, 146, 189, 236, 75, 140, 210, 143, 11, 103, 64, 58, 10, 73, 123, 39, 97, 119, 166, 114, 123, 65, 68, 214, 42, 17, 156, 122, 8, 58, 184, 134, 255, 48, 64, 20, 229, 247, 196, 12, 130, 56, 176, 69, 179, 254, 216, 45, 25, 244, 240, 116, 88, 137, 66, 13, 18, 202, 199, 59, 200, 245, 19, 175, 232, 217, 211, 12, 191, 222, 26, 162, 253, 73, 201, 48, 61, 3, 248, 117, 16, 71, 233, 183, 90, 110, 91, 116, 56, 133, 223, 148, 19, 78, 140, 123, 159, 203, 78, 15, 172, 39, 190, 39, 71, 180, 155, 48, 156, 116, 212, 52, 1, 231, 201, 196, 73, 87, 68, 104, 208, 40, 104, 32, 218, 235, 245, 84, 136, 168, 51, 9, 93, 126, 46, 80, 180, 240, 144, 79, 88, 87, 159, 24, 108, 186, 9, 20, 48, 100, 148, 250, 4, 163, 115, 131, 44, 13, 38, 222, 117, 196, 196, 128, 114, 149, 97, 93, 37, 191, 3, 192, 231, 88, 80, 218, 147, 8, 192, 165, 27, 206, 56, 42, 157, 230, 223, 130, 253, 169, 182, 245, 192, 181, 18, 212, 133, 168, 73, 92, 66, 197, 117, 245, 107, 127, 23, 146, 249, 41, 66, 219, 210, 207, 221, 205, 205, 15, 110, 92, 12, 207, 76, 239, 4, 13, 129, 127, 170, 205, 253, 148, 208, 24, 129, 24, 210, 220, 85, 45, 179, 137, 66, 134, 142, 22, 112, 48, 160, 236, 232, 38, 83, 101, 55, 51, 18, 110, 99, 69, 41, 173, 107, 233, 11, 199, 23, 61, 135, 222, 94, 74, 29, 219, 80, 128, 167, 186, 254, 235, 42, 96, 134, 5, 13, 90, 59, 231, 137, 195, 207, 28, 165, 12, 218, 5, 72, 102, 61, 135, 198, 73, 250, 97, 89, 214, 179, 244, 194, 23, 142, 157, 4, 243, 90, 69, 54, 10, 139, 76, 95, 40, 225, 219, 59, 15, 54, 182, 206, 142, 228, 248, 79, 156, 129, 246, 63, 6, 6, 236, 44, 67, 116, 213, 170, 47, 193, 186, 139, 25, 80, 166, 57, 99, 231, 156, 191, 117, 65, 76, 7, 243, 244, 127, 225, 210, 190, 164, 141, 46, 36, 99, 111, 203, 133, 127, 80, 28, 61, 160, 36, 132, 182, 16, 41, 39, 185, 232, 123, 32, 57, 189, 100, 152, 38, 205, 5, 189, 240, 65, 3, 191, 73, 85, 12, 209, 180, 1, 194, 70, 124, 57, 71, 48, 230, 235, 122, 175, 157, 35, 233, 83, 40, 20, 169, 224, 14, 11, 216, 48, 194, 105, 25, 187, 210, 182, 6, 184, 73, 95, 85, 210, 227, 113, 58, 10, 186, 175, 254, 25, 102, 39, 3, 2, 200, 194, 197, 200, 224, 77, 164, 8, 36, 114, 48, 130, 2, 233, 6, 9, 42, 134, 72, 134, 247, 13, 1, 7, 1, 160, 130, 2, 218, 4, 130, 2, 214, 48, 130, 2, 210, 48, 130, 2, 206, 6, 11, 42, 134, 72, 134, 247, 13, 1, 12, 10, 1, 2, 160, 130, 2, 166, 48, 130, 2, 162, 48, 28, 6, 10, 42, 134, 72, 134, 247, 13, 1, 12, 1, 3, 48, 14, 4, 8, 178, 13, 52, 135, 85, 49, 79, 105, 2, 2, 7, 208, 4, 130, 2, 128, 21, 84, 227, 109, 230, 144, 140, 170, 117, 250, 179, 207, 129, 100, 126, 126, 29, 231, 94, 140, 45, 26, 168, 45, 240, 4, 170, 73, 98, 115, 109, 96, 177, 206, 6, 80, 170, 22, 237, 144, 58, 95, 59, 26, 85, 135, 178, 69, 184, 44, 122, 81, 213, 135, 149, 198, 246, 83, 68, 129, 2, 186, 118, 33, 44, 214, 227, 240, 220, 51, 175, 220, 220, 180, 113, 216, 101, 138, 81, 54, 38, 0, 216, 30, 29, 187, 213, 230, 12, 181, 130, 21, 241, 98, 120, 41, 150, 176, 69, 37, 169, 249, 123, 212, 254, 135, 154, 214, 127, 39, 105, 149, 180, 218, 41, 207, 75, 70, 105, 169, 185, 169, 132, 173, 188, 82, 251, 71, 234, 136, 5, 254, 110, 223, 34, 4, 145, 7, 19, 51, 123, 140, 75, 226, 0, 21, 220, 228, 223, 218, 8, 169, 210, 194, 139, 93, 218, 55, 40, 174, 50, 238, 38, 166, 222, 103, 0, 209, 88, 131, 51, 222, 154, 217, 18, 172, 73, 17, 133, 54, 173, 208, 118, 104, 167, 113, 153, 223, 251, 154, 120, 176, 18, 127, 51, 206, 164, 77, 86, 9, 82, 212, 86, 162, 206, 230, 79, 217, 178, 42, 217, 162, 152, 188, 217, 59, 212, 117, 200, 135, 75, 74, 43, 1, 42, 79, 180, 164, 250, 122, 103, 103, 157, 11, 14, 33, 48, 8, 108, 155, 46, 124, 223, 204, 169, 124, 104, 11, 246, 213, 226, 16, 125, 17, 228, 15, 178, 141, 79, 78, 115, 76, 131, 122, 166, 124, 154, 1, 174, 178, 176, 213, 208, 188, 71, 118, 220, 168, 64, 218, 176, 134, 38, 229, 14, 109, 162, 125, 16, 57, 249, 201, 180, 17, 182, 143, 184, 12, 248, 113, 65, 70, 109, 79, 249, 34, 170, 35, 228, 219, 121, 202, 228, 121, 127, 255, 22, 173, 202, 171, 33, 232, 4, 240, 142, 216, 80, 56, 177, 83, 93, 123, 217, 213, 157, 99, 34, 194, 61, 228, 239, 194, 20, 27, 9, 53, 132, 79, 19, 97, 107, 31, 51, 39, 176, 223, 90, 88, 67, 138, 194, 169, 176, 144, 202, 119, 146, 74, 27, 118, 63, 129, 230, 101, 104, 75, 116, 49, 223, 254, 225, 70, 206, 183, 11, 134, 148, 10, 55, 57, 50, 178, 144, 164, 139, 233, 169, 109, 186, 211, 95, 123, 75, 111, 192, 187, 127, 240, 45, 226, 194, 240, 128, 10, 79, 178, 192, 66, 21, 197, 24, 171, 141, 255, 185, 230, 84, 206, 151, 9, 93, 115, 162, 12, 115, 129, 218, 103, 219, 183, 142, 123, 3, 110, 139, 208, 4, 146, 76, 99, 246, 240, 32, 169, 148, 16, 146, 172, 230, 36, 56, 145, 23, 94, 209, 92, 38, 244, 127, 70, 121, 253, 66, 55, 36, 140, 98, 105, 233, 112, 24, 23, 230, 112, 62, 244, 12, 48, 30, 51, 0, 18, 244, 139, 66, 245, 234, 203, 195, 52, 119, 255, 84, 82, 204, 100, 176, 167, 24, 224, 8, 127, 214, 148, 115, 242, 56, 190, 72, 221, 68, 252, 36, 74, 254, 57, 52, 96, 20, 173, 32, 236, 87, 15, 16, 76, 9, 48, 3, 61, 2, 137, 137, 9, 68, 213, 99, 163, 63, 201, 83, 241, 98, 7, 117, 108, 4, 123, 170, 18, 10, 19, 198, 31, 170, 15, 247, 216, 145, 172, 239, 137, 181, 80, 160, 24, 11, 35, 131, 58, 218, 22, 250, 215, 52, 160, 246, 197, 183, 92, 137, 0, 245, 63, 49, 183, 246, 195, 58, 63, 4, 75, 10, 92, 131, 181, 59, 78, 247, 44, 150, 49, 49, 107, 211, 62, 71, 62, 222, 159, 161, 118, 236, 55, 219, 49, 0, 3, 82, 236, 96, 20, 83, 39, 245, 208, 240, 245, 174, 218, 49, 21, 48, 19, 6, 9, 42, 134, 72, 134, 247, 13, 1, 9, 21, 49, 6, 4, 4, 1, 0, 0, 0, 48, 61, 48, 33, 48, 9, 6, 5, 43, 14, 3, 2, 26, 5, 0, 4, 20, 30, 154, 48, 126, 198, 239, 114, 62, 12, 58, 129, 172, 67, 156, 76, 214, 62, 205, 89, 28, 4, 20, 135, 177, 105, 83, 79, 93, 181, 149, 169, 49, 112, 201, 70, 212, 153, 79, 198, 163, 137, 90, 2, 2, 7, 208 };
@@ -60,6 +59,9 @@ public class SslStreamTest {
        }
 
        [Test] //bug https://bugzilla.novell.com/show_bug.cgi?id=457120
+#if FEATURE_NO_BSD_SOCKETS
+       [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
        public void AuthenticateClientAndServer_ClientSendsNoData ()
        {
                AuthenticateClientAndServer (true, true);
index e51f2d9b7d526e14185622f3337904180ebd89a9..0af239d238ccd494056a4fb8476cd8d1e356f1c4 100644 (file)
@@ -16,12 +16,16 @@ using NUnit.Framework;
 namespace MonoTests.System.Net.Sockets
 {
        [TestFixture]
-       [Category ("RequiresBSDSockets")]
        public class NetworkStreamTest
        {
                [Test]
                // See bug #371923
+
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
                [ExpectedException(typeof(IOException))]
+#endif
                public void NetworkStreamConnection ()
                {
                        IPEndPoint ipe = new IPEndPoint(Dns.GetHostEntry ("www.google.com").AddressList [0], 80);
@@ -31,6 +35,9 @@ namespace MonoTests.System.Net.Sockets
                }
                
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void ReadTimeout ()
                {
                        Socket sock = new Socket (AddressFamily.InterNetwork,
index 28bc6bb81745f29059c186633126c3addaabfa9a..fff160c768c6e5dac98c6c2986e6c83140d74d95 100644 (file)
@@ -1,3 +1,4 @@
+using System;
 using System.Threading;
 using System.Net;
 using System.Net.Sockets;
@@ -6,10 +7,12 @@ using NUnit.Framework;
 namespace MonoTests.System.Net.Sockets
 {
        [TestFixture]
-       [Category ("RequiresBSDSockets")]
        public class SocketAcceptAsyncTest
        {
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void AcceptAsyncShouldUseAcceptSocketFromEventArgs()
                {
                        var readyEvent = new ManualResetEvent(false);
@@ -19,27 +22,40 @@ namespace MonoTests.System.Net.Sockets
                        var serverSocket = new Socket(
                                        AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
                        Socket acceptedSocket = null;
-
+                       Exception ex = null;
                        ThreadPool.QueueUserWorkItem(_ =>
                        {
-                               listenSocket.Bind(new IPEndPoint(IPAddress.Loopback, 0));
-                               listenSocket.Listen(1);
-
-                               var asyncEventArgs = new SocketAsyncEventArgs {AcceptSocket = serverSocket};
-                               asyncEventArgs.Completed += (s, e) =>
-                               {
-                                       acceptedSocket = e.AcceptSocket;
-                                       mainEvent.Set();
-                               };
+                               SocketAsyncEventArgs asyncEventArgs;
+                               try {
+                                       listenSocket.Bind(new IPEndPoint(IPAddress.Loopback, 0));
+                                       listenSocket.Listen(1);
 
-                               readyEvent.Set();
+                                       asyncEventArgs = new SocketAsyncEventArgs {AcceptSocket = serverSocket};
+                                       asyncEventArgs.Completed += (s, e) =>
+                                       {
+                                               acceptedSocket = e.AcceptSocket;
+                                               mainEvent.Set();
+                                       };
 
-                               if (listenSocket.AcceptAsync(asyncEventArgs))
+                               } catch (Exception e) {
+                                       ex = e;
                                        return;
-                               acceptedSocket = asyncEventArgs.AcceptSocket;
-                               mainEvent.Set();
+                               } finally {
+                                       readyEvent.Set();
+                               }
+
+                               try {
+                                       if (listenSocket.AcceptAsync(asyncEventArgs))
+                                               return;
+                                       acceptedSocket = asyncEventArgs.AcceptSocket;
+                                       mainEvent.Set();
+                               } catch (Exception e) {
+                                       ex = e;
+                               }
                        });
                        Assert.IsTrue(readyEvent.WaitOne(1500));
+                       if (ex != null)
+                               throw ex;
 
                        var clientSocket = new Socket(
                                AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
@@ -47,7 +63,7 @@ namespace MonoTests.System.Net.Sockets
                        clientSocket.NoDelay = true;
 
                        Assert.IsTrue(mainEvent.WaitOne(1500));
-                       Assert.AreEqual(serverSocket, acceptedSocket);
+                       Assert.AreEqual(serverSocket, acceptedSocket, "x");
                        mainEvent.Reset();
 
                        if (acceptedSocket != null)
index f0c29764ae9ec6f78d5dae84a80e76e902e4cf70..935aa77bcdf7e46f7d4ca959825931f219cebf6b 100644 (file)
@@ -247,6 +247,25 @@ namespace MonoTests.System.Net.Sockets {
                        SocketAsyncEventArgsPoker saea = new SocketAsyncEventArgsPoker ();
                        saea.OnCompleted_ (null);
                }
+
+               [Test]
+               public void TransparentDispose ()
+               {
+                       var buffer = new byte[5];
+                       var elements = new SendPacketsElement[2];
+                       var utoken = new object();
+
+                       var saea = new SocketAsyncEventArgs();
+                       saea.SetBuffer(buffer, 0, 3);
+                       saea.SendPacketsElements = elements;
+                       saea.UserToken = utoken;
+
+                       saea.Dispose();
+
+                       Assert.AreEqual (buffer, saea.Buffer);
+                       Assert.AreEqual (elements, saea.SendPacketsElements);
+                       Assert.AreEqual (utoken, saea.UserToken);
+               }
        }
 }
 
index d286668707e437635c1bc4e3920b45b4d2fa7072..df31233d68fbd429825cac9d877e9029fb7c9e57 100644 (file)
@@ -8,7 +8,6 @@ using NUnit.Framework;
 namespace MonoTests.System.Net.Sockets
 {
        [TestFixture]
-       [Category ("RequiresBSDSockets")]
        public class SocketAsyncTest
        {
                Socket serverSocket;
@@ -17,8 +16,7 @@ namespace MonoTests.System.Net.Sockets
                ManualResetEvent mainEvent;
                Exception error;
 
-               [TestFixtureSetUp]
-               public void SetUp ()
+               void SetUp ()
                {
                        readyEvent = new ManualResetEvent (false);
                        mainEvent = new ManualResetEvent (false);
@@ -26,6 +24,9 @@ namespace MonoTests.System.Net.Sockets
                        ThreadPool.QueueUserWorkItem (_ => DoWork ());
                        readyEvent.WaitOne ();
 
+                       if (error != null)
+                               throw error;
+
                        clientSocket = new Socket (
                                AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
                        clientSocket.Connect (serverSocket.LocalEndPoint);
@@ -43,18 +44,22 @@ namespace MonoTests.System.Net.Sockets
 
                void DoWork ()
                {
-                       serverSocket = new Socket (
-                               AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
-                       serverSocket.Bind (new IPEndPoint (IPAddress.Loopback, 0));
-                       serverSocket.Listen (1);
-
-                       var async = new SocketAsyncEventArgs ();
-                       async.Completed += (s,e) => OnAccepted (e);
-
-                       readyEvent.Set ();
-
-                       if (!serverSocket.AcceptAsync (async))
-                               OnAccepted (async);
+                       try {
+                               serverSocket = new Socket (
+                                       AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
+                               serverSocket.Bind (new IPEndPoint (IPAddress.Loopback, 0));
+                               serverSocket.Listen (1);
+
+                               var async = new SocketAsyncEventArgs ();
+                               async.Completed += (s,e) => OnAccepted (e);
+
+                               if (!serverSocket.AcceptAsync (async))
+                                       OnAccepted (async);
+                       } catch (Exception e) {
+                               error = e;
+                       } finally {
+                               readyEvent.Set ();
+                       }
                }
 
                void OnAccepted (SocketAsyncEventArgs e)
@@ -93,8 +98,12 @@ namespace MonoTests.System.Net.Sockets
 
                [Test]
                [Category("Test")]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void SendAsync ()
                {
+                       SetUp ();
                        var buffer = new byte [] { 0x12, 0x34, 0x56, 0x78 };
                        var m = new ManualResetEvent (false);
                        var e = new SocketAsyncEventArgs ();
index 9551c1e6027131d4217bd59a13d986438873d5e2..14ec2700869c289ee1159851c5402e07138b70a5 100755 (executable)
@@ -28,7 +28,6 @@ using MonoTests.Helpers;
 namespace MonoTests.System.Net.Sockets
 {
        [TestFixture]
-       [Category ("RequiresBSDSockets")]
        public class SocketTest
        {
                // note: also used in SocketCas tests
@@ -36,6 +35,9 @@ namespace MonoTests.System.Net.Sockets
                public const int BogusPort = 23483;
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void ConnectIPAddressAny ()
                {
                        IPEndPoint ep = new IPEndPoint (IPAddress.Any, NetworkHelpers.FindFreePort ());
@@ -86,6 +88,9 @@ namespace MonoTests.System.Net.Sockets
 
                [Test]
                [Category ("InetAccess")]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void BogusEndConnect ()
                {
                        IPAddress ipOne = IPAddress.Parse (BogusAddress);
@@ -156,6 +161,9 @@ namespace MonoTests.System.Net.Sockets
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void AcceptBlockingStatus()
                {
                        bool block;
@@ -200,6 +208,9 @@ namespace MonoTests.System.Net.Sockets
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void ConnectFailAsync ()
                {
                        Socket sock = new Socket (AddressFamily.InterNetwork,
@@ -222,6 +233,9 @@ namespace MonoTests.System.Net.Sockets
                }
                
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void SetSocketOptionBoolean ()
                {
                        IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, NetworkHelpers.FindFreePort ());
@@ -233,6 +247,9 @@ namespace MonoTests.System.Net.Sockets
                        }
                }
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void TestSelect1 ()
                {
                        Socket srv = CreateServer (NetworkHelpers.FindFreePort ());
@@ -370,7 +387,11 @@ namespace MonoTests.System.Net.Sockets
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
                [ExpectedException (typeof (ObjectDisposedException))]
+#endif
                public void Disposed19 ()
                {
                        Socket s = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
@@ -381,7 +402,11 @@ namespace MonoTests.System.Net.Sockets
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
                [ExpectedException (typeof (ObjectDisposedException))]
+#endif
                public void Disposed20 ()
                {
                        Socket s = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
@@ -392,7 +417,11 @@ namespace MonoTests.System.Net.Sockets
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
                [ExpectedException (typeof (ObjectDisposedException))]
+#endif
                public void Disposed21 ()
                {
                        Socket s = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
@@ -403,7 +432,11 @@ namespace MonoTests.System.Net.Sockets
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
                [ExpectedException (typeof (ObjectDisposedException))]
+#endif
                public void Disposed22 ()
                {
                        Socket s = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
@@ -424,6 +457,9 @@ namespace MonoTests.System.Net.Sockets
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void GetHashCodeTest ()
                {
                        Socket server = new Socket (AddressFamily.InterNetwork,
@@ -459,6 +495,7 @@ namespace MonoTests.System.Net.Sockets
                }
 
                [Test]
+               [Category ("RequiresBSDSockets")] // This verifies particular error codes, which we don't care about when nothing's working anyway.
                public void SocketErrorTest ()
                {
                        Socket sock = new Socket (AddressFamily.InterNetwork,
@@ -700,6 +737,9 @@ namespace MonoTests.System.Net.Sockets
                }
                
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void IsBoundTcp ()
                {
                        Socket sock = new Socket (AddressFamily.InterNetwork,
@@ -732,6 +772,9 @@ namespace MonoTests.System.Net.Sockets
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void IsBoundUdp ()
                {
                        Socket sock = new Socket (AddressFamily.InterNetwork,
@@ -1207,9 +1250,9 @@ namespace MonoTests.System.Net.Sockets
                        Socket sock = new Socket (AddressFamily.InterNetwork,
                                                  SocketType.Stream,
                                                  ProtocolType.Tcp);
-                       
+
                        Assert.AreEqual (false, sock.NoDelay, "NoDelayDefaultTcp");
-                       
+
                        sock.Close ();
                }
 
@@ -1304,7 +1347,11 @@ namespace MonoTests.System.Net.Sockets
                }
                
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
                [ExpectedException (typeof(InvalidOperationException))]
+#endif
                public void BeginAcceptNotListening ()
                {
                        Socket sock = new Socket (AddressFamily.InterNetwork,
@@ -1319,6 +1366,9 @@ namespace MonoTests.System.Net.Sockets
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void BeginAccept ()
                {
                        Socket sock = new Socket (AddressFamily.InterNetwork,
@@ -1386,6 +1436,9 @@ namespace MonoTests.System.Net.Sockets
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void BeginAcceptData ()
                {
                        Socket sock = new Socket (AddressFamily.InterNetwork,
@@ -1450,6 +1503,9 @@ namespace MonoTests.System.Net.Sockets
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void BeginAcceptSocketUdp ()
                {
                        Socket sock = new Socket (AddressFamily.InterNetwork,
@@ -1477,6 +1533,9 @@ namespace MonoTests.System.Net.Sockets
                }
                
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void BeginAcceptSocketBound ()
                {
                        Socket sock = new Socket (AddressFamily.InterNetwork,
@@ -1508,6 +1567,9 @@ namespace MonoTests.System.Net.Sockets
                }
                
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void BeginAcceptSocket ()
                {
                        Socket sock = new Socket (AddressFamily.InterNetwork,
@@ -1589,6 +1651,9 @@ namespace MonoTests.System.Net.Sockets
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void BeginAcceptSocketAccClosed ()
                {
                        Socket sock = new Socket (AddressFamily.InterNetwork,
@@ -1638,6 +1703,9 @@ namespace MonoTests.System.Net.Sockets
                }
                
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void BeginConnectAddressPort ()
                {
                        Socket sock = new Socket (AddressFamily.InterNetwork,
@@ -1687,6 +1755,9 @@ namespace MonoTests.System.Net.Sockets
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void BeginConnectAddressPortListen ()
                {
                        Socket sock = new Socket (AddressFamily.InterNetwork,
@@ -1781,6 +1852,9 @@ namespace MonoTests.System.Net.Sockets
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void BeginConnectMultiple2 ()
                {
                        Socket sock = new Socket (AddressFamily.InterNetwork,
@@ -1853,6 +1927,9 @@ namespace MonoTests.System.Net.Sockets
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void BeginConnectMultipleListen ()
                {
                        Socket sock = new Socket (AddressFamily.InterNetwork,
@@ -1917,6 +1994,9 @@ namespace MonoTests.System.Net.Sockets
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void BeginConnectHostPortListen ()
                {
                        Socket sock = new Socket (AddressFamily.InterNetwork,
@@ -1984,6 +2064,9 @@ namespace MonoTests.System.Net.Sockets
                
                [Test]
                [Category ("NotDotNet")] // "Needs XP or later"
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void BeginDisconnect ()
                {
                        Socket sock = new Socket (AddressFamily.InterNetwork,
@@ -2080,6 +2163,9 @@ namespace MonoTests.System.Net.Sockets
                }
                
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void BindTwice ()
                {
                        Socket sock = new Socket (AddressFamily.InterNetwork,
@@ -2103,6 +2189,9 @@ namespace MonoTests.System.Net.Sockets
                }
                
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Close ()
                {
                        Socket sock = new Socket (AddressFamily.InterNetwork,
@@ -2131,6 +2220,9 @@ namespace MonoTests.System.Net.Sockets
                }
                
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void ConnectAddressPort ()
                {
                        Socket sock = new Socket (AddressFamily.InterNetwork,
@@ -2171,6 +2263,9 @@ namespace MonoTests.System.Net.Sockets
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void ConnectAddressPortListen ()
                {
                        Socket sock = new Socket (AddressFamily.InterNetwork,
@@ -2257,6 +2352,9 @@ namespace MonoTests.System.Net.Sockets
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void ConnectMultiple2 ()
                {
                        Socket sock = new Socket (AddressFamily.InterNetwork,
@@ -2314,6 +2412,9 @@ namespace MonoTests.System.Net.Sockets
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void ConnectMultipleListen ()
                {
                        Socket sock = new Socket (AddressFamily.InterNetwork,
@@ -2376,6 +2477,9 @@ namespace MonoTests.System.Net.Sockets
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void ConnectHostPortListen ()
                {
                        Socket sock = new Socket (AddressFamily.InterNetwork,
@@ -2414,7 +2518,11 @@ namespace MonoTests.System.Net.Sockets
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
                [ExpectedException (typeof(ObjectDisposedException))]
+#endif
                public void ConnectHostPortClosed ()
                {
                        Socket sock = new Socket (AddressFamily.InterNetwork,
@@ -2428,6 +2536,9 @@ namespace MonoTests.System.Net.Sockets
                
                [Test]
                [Category ("NotDotNet")] // "Needs XP or later"
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Disconnect ()
                {
                        Socket sock = new Socket (AddressFamily.InterNetwork,
@@ -2485,6 +2596,9 @@ namespace MonoTests.System.Net.Sockets
                }
                
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void ReceiveGeneric ()
                {
                        int i;
@@ -2542,6 +2656,9 @@ namespace MonoTests.System.Net.Sockets
                }
                
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void SendGeneric ()
                {
                        int i;
@@ -2599,6 +2716,78 @@ namespace MonoTests.System.Net.Sockets
                        listensock.Close ();
                }
 
+               [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (AggregateException))] // Something catches the PlatformNotSupportedException and re-throws an AggregateException    
+#endif
+               public void ConcurrentExceedSocketLimit ()
+               {
+                       var tasks = new Task[4];
+                       for (int i = 0; i < 4; i++) {
+                               tasks[i] = Task.Factory.StartNew (() => SendGenericExceedBuffer ());
+                       }
+                       Task.WaitAll (tasks);
+               }
+
+               [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
+               public void SendGenericExceedBuffer ()
+               {
+                       // Create a buffer larger than the default max.
+                       const int BUFFER_SIZE = 65 * 1024;
+                       int i;
+
+                       IPEndPoint endpoint = new IPEndPoint(IPAddress.Loopback, NetworkHelpers.FindFreePort ());
+
+                       Socket listensock = new Socket (AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
+                       listensock.Bind (endpoint);
+                       listensock.Listen (1);
+
+                       Socket sendsock = new Socket (AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
+                       sendsock.Connect (endpoint);
+
+                       Socket clientsock = listensock.Accept ();
+
+                       byte[] sendbuf = new byte[BUFFER_SIZE];
+
+                       for (i = 0; i < BUFFER_SIZE; i++) {
+                               sendbuf[i] = (byte)i;
+                       }
+
+                       Task sendTask = Task.Factory.StartNew(() => {
+                               int sent = sendsock.Send (sendbuf);
+
+                               Assert.AreEqual (BUFFER_SIZE, sent, "#1");
+                       });
+
+                       byte[] recvbuf = new byte[BUFFER_SIZE];
+
+                       Task recvTask = Task.Factory.StartNew(() => {
+                               int totalReceived = 0;
+                               byte[] buffer = new byte[256];
+                               while (totalReceived < sendbuf.Length) {
+                                       int recvd = clientsock.Receive (buffer, 0, buffer.Length, SocketFlags.None);
+                                       Array.Copy (buffer, 0, recvbuf, totalReceived, recvd);
+                                       totalReceived += recvd;
+                               }
+
+                               Assert.AreEqual (BUFFER_SIZE, totalReceived, "#2");
+                       });
+
+                       Assert.IsTrue (Task.WaitAll (new []{sendTask, recvTask}, 20 * 1000), "#2a");
+
+                       for (i = 0; i < BUFFER_SIZE; i++) {
+                               Assert.AreEqual (recvbuf[i], sendbuf[i],
+                                                "#3/" + i.ToString());
+                       }
+
+                       sendsock.Close ();
+                       clientsock.Close ();
+                       listensock.Close ();
+               }
+
                [Test]
                public void ListenNotBound ()
                {
@@ -2634,6 +2823,9 @@ namespace MonoTests.System.Net.Sockets
                }
                
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void CloseWhileReceiving ()
                {
                        CWRSocket = new Socket (AddressFamily.InterNetwork,
@@ -3003,6 +3195,9 @@ namespace MonoTests.System.Net.Sockets
                }
 
                [Test] // ReceiveFrom (Byte [], ref EndPoint)
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void ReceiveFrom1_Buffer_Null ()
                {
                        Socket s = new Socket (AddressFamily.InterNetwork, SocketType.Stream,
@@ -3044,6 +3239,9 @@ namespace MonoTests.System.Net.Sockets
                }
 
                [Test] // ReceiveFrom (Byte [], ref EndPoint)
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void ReceiveFrom1_Socket_Closed ()
                {
                        Socket s = new Socket (AddressFamily.InterNetwork, SocketType.Stream,
@@ -3064,6 +3262,9 @@ namespace MonoTests.System.Net.Sockets
                }
 
                [Test] // ReceiveFrom (Byte [], SocketFlags, ref EndPoint)
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void ReceiveFrom2_Buffer_Null ()
                {
                        Socket s = new Socket (AddressFamily.InterNetwork, SocketType.Stream,
@@ -3105,6 +3306,9 @@ namespace MonoTests.System.Net.Sockets
                }
 
                [Test] // ReceiveFrom (Byte [], SocketFlags, ref EndPoint)
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void ReceiveFrom2_Socket_Closed ()
                {
                        Socket s = new Socket (AddressFamily.InterNetwork, SocketType.Stream,
@@ -3125,6 +3329,9 @@ namespace MonoTests.System.Net.Sockets
                }
 
                [Test] // ReceiveFrom (Byte [], Int32, SocketFlags, ref EndPoint)
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void ReceiveFrom3_Buffer_Null ()
                {
                        Socket s = new Socket (AddressFamily.InterNetwork, SocketType.Stream,
@@ -3167,6 +3374,9 @@ namespace MonoTests.System.Net.Sockets
                }
 
                [Test] // ReceiveFrom (Byte [], Int32, SocketFlags, ref EndPoint)
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void ReceiveFrom3_Size_OutOfRange ()
                {
                        Socket s;
@@ -3208,6 +3418,9 @@ namespace MonoTests.System.Net.Sockets
                }
 
                [Test] // ReceiveFrom (Byte [], Int32, SocketFlags, ref EndPoint)
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void ReceiveFrom3_Socket_Closed ()
                {
                        Socket s = new Socket (AddressFamily.InterNetwork, SocketType.Stream,
@@ -3229,6 +3442,9 @@ namespace MonoTests.System.Net.Sockets
                }
 
                [Test] // ReceiveFrom (Byte [], Int32, Int32, SocketFlags, EndPoint)
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void ReceiveFrom4_Buffer_Null ()
                {
                        Socket s = new Socket (AddressFamily.InterNetwork, SocketType.Stream,
@@ -3248,6 +3464,9 @@ namespace MonoTests.System.Net.Sockets
                }
 
                [Test] // ReceiveFrom (Byte [], Int32, Int32, SocketFlags, EndPoint)
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void ReceiveFrom4_Offset_OutOfRange ()
                {
                        Socket s;
@@ -3311,6 +3530,9 @@ namespace MonoTests.System.Net.Sockets
                }
 
                [Test] // ReceiveFrom (Byte [], Int32, Int32, SocketFlags, EndPoint)
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void ReceiveFrom4_Size_OutOfRange ()
                {
                        Socket s;
@@ -3369,6 +3591,9 @@ namespace MonoTests.System.Net.Sockets
                }
 
                [Test] // ReceiveFrom (Byte [], Int32, Int32, SocketFlags, ref EndPoint)
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void ReceiveFrom4_Socket_Closed ()
                {
                        Socket s = new Socket (AddressFamily.InterNetwork, SocketType.Stream,
@@ -3391,6 +3616,9 @@ namespace MonoTests.System.Net.Sockets
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void ReceiveRemoteClosed ()
                {
                        var port = NetworkHelpers.FindFreePort ();
@@ -3418,6 +3646,9 @@ namespace MonoTests.System.Net.Sockets
                //
                // Test case for bug #471580
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void UdpDoubleBind ()
                {
                        using (Socket s = new Socket (AddressFamily.InterNetwork,
@@ -3451,6 +3682,9 @@ namespace MonoTests.System.Net.Sockets
 
                // Test case for bug #31557
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void TcpDoubleBind ()
                {
                        using (Socket s = new Socket (AddressFamily.InterNetwork,
@@ -3689,6 +3923,9 @@ namespace MonoTests.System.Net.Sockets
                }
 
                [Test] // SetSocketOption (SocketOptionLevel, SocketOptionName, Object)
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void SetSocketOption3_AddMembershipIPv4_IPv6MulticastOption ()
                {
                        IPAddress mcast_addr = IPAddress.Parse ("239.255.255.250");
@@ -3711,6 +3948,9 @@ namespace MonoTests.System.Net.Sockets
                }
 
                [Test] // SetSocketOption (SocketOptionLevel, SocketOptionName, Object)
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void SetSocketOption3_AddMembershipIPv4_MulticastOption ()
                {
                        IPAddress mcast_addr = IPAddress.Parse ("239.255.255.250");
@@ -3747,6 +3987,9 @@ namespace MonoTests.System.Net.Sockets
                }
 
                [Test] // SetSocketOption (SocketOptionLevel, SocketOptionName, Object)
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void SetSocketOption3_AddMembershipIPv6_IPv6MulticastOption ()
                {
                        if (!Socket.OSSupportsIPv6)
@@ -3762,6 +4005,9 @@ namespace MonoTests.System.Net.Sockets
                }
 
                [Test] // SetSocketOption (SocketOptionLevel, SocketOptionName, Object)
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void SetSocketOption3_AddMembershipIPv6_MulticastOption ()
                {
                        if (!Socket.OSSupportsIPv6)
@@ -3916,6 +4162,9 @@ namespace MonoTests.System.Net.Sockets
                }
 
                [Test] // SetSocketOption (SocketOptionLevel, SocketOptionName, Object)
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void SetSocketOption3_DropMembershipIPv4_IPv6MulticastOption ()
                {
                        IPAddress mcast_addr = IPAddress.Parse ("239.255.255.250");
@@ -3940,6 +4189,9 @@ namespace MonoTests.System.Net.Sockets
                }
 
                [Test] // SetSocketOption (SocketOptionLevel, SocketOptionName, Object)
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void SetSocketOption3_DropMembershipIPv4_MulticastOption ()
                {
                        IPAddress mcast_addr = IPAddress.Parse ("239.255.255.250");
@@ -3980,6 +4232,9 @@ namespace MonoTests.System.Net.Sockets
                }
 
                [Test] // SetSocketOption (SocketOptionLevel, SocketOptionName, Object)
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void SetSocketOption3_DropMembershipIPv6_IPv6MulticastOption ()
                {
                        if (!Socket.OSSupportsIPv6)
@@ -3998,6 +4253,9 @@ namespace MonoTests.System.Net.Sockets
                }
 
                [Test] // SetSocketOption (SocketOptionLevel, SocketOptionName, Object)
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void SetSocketOption3_DropMembershipIPv6_MulticastOption ()
                {
                        if (!Socket.OSSupportsIPv6)
@@ -4084,6 +4342,7 @@ namespace MonoTests.System.Net.Sockets
                }
 
                [Test]
+               [Category ("RequiresBSDSockets")] // on watchOS device this happens: System.Net.Sockets.SocketException : The requested address is not valid in this context. This situation is too complex to detect and throw a PlatformNotSupportedException, so just ignore it.
                public void SetSocketOption_MulticastInterfaceIndex_Any ()
                {
                        IPAddress ip = IPAddress.Parse ("239.255.255.250");
@@ -4096,6 +4355,7 @@ namespace MonoTests.System.Net.Sockets
                }
 
                [Test]
+               [Category ("RequiresBSDSockets")] // on watchOS device this happens: System.Net.Sockets.SocketException : The requested address is not valid in this context. This situation is too complex to detect and throw a PlatformNotSupportedException, so just ignore it.
                public void SetSocketOption_MulticastInterfaceIndex_Loopback ()
                {
                        IPAddress ip = IPAddress.Parse ("239.255.255.250");
@@ -4132,6 +4392,9 @@ namespace MonoTests.System.Net.Sockets
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Shutdown_NoConnect ()
                {
                        Socket s = new Socket (AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
@@ -4228,6 +4491,9 @@ namespace MonoTests.System.Net.Sockets
                }
                
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void SendAsyncFile ()
                {
                        Socket serverSocket = new Socket (AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
@@ -4286,56 +4552,98 @@ namespace MonoTests.System.Net.Sockets
                }
                
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void ConnectToIPV4EndPointUsingDualModelSocket () {
-                       using (var server = new Socket (SocketType.Stream, ProtocolType.Tcp))
-                       using (var client = new Socket (SocketType.Stream, ProtocolType.Tcp)) {
+                       /*
+                        * IPv6 DualMode sockets are defaults in Mono. Explicitly specify that
+                        * anyways in this test to make it more interoparable with .NET where
+                        * IPv6 and DualMode needs to be specified.
+                        */
+                       using (var server = new Socket (AddressFamily.InterNetworkV6, SocketType.Stream, ProtocolType.Tcp)) {
+
                                var host = new IPEndPoint (IPAddress.Loopback, NetworkHelpers.FindFreePort ());
-                                       
+
+                               server.DualMode = true;
                                server.Bind (host);
-                               server.Listen (0);
+                               /*
+                                * Nothing to Accept the connect - we need a backlog to make sure we don't get 
+                                Connection refused.
+                                */
+                               server.Listen (3);
                                
                                var ep = server.LocalEndPoint as IPEndPoint;
-                               
+                               var client = new Socket (AddressFamily.InterNetworkV6, SocketType.Stream, ProtocolType.Tcp);
+                               client.DualMode = true;
                                client.Connect (ep);
-                               client.Disconnect (true);
-                               
+                               client.Disconnect (false);
+                               client.Close ();
+
+                               client = new Socket (AddressFamily.InterNetworkV6, SocketType.Stream, ProtocolType.Tcp);
+                               client.DualMode = true;
                                client.Connect (IPAddress.Loopback, ep.Port);
-                               client.Disconnect (true);
-                               
-                               client.Connect (new [] {IPAddress.Loopback}, ep.Port);
-                               client.Disconnect (true);
+                               client.Disconnect (false);
+                               client.Close ();
+
+                               client = new Socket (AddressFamily.InterNetworkV6, SocketType.Stream, ProtocolType.Tcp);
+                               client.DualMode = true;
+                               client.Connect (new [] { IPAddress.Loopback }, ep.Port);
+                               client.Disconnect (false);
+                               client.Close ();
                        }
                }
                
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void BeginConnectToIPV4EndPointUsingDualModelSocket () {
-                       using (var server = new Socket (SocketType.Stream, ProtocolType.Tcp))
-                       using (var client = new Socket (SocketType.Stream, ProtocolType.Tcp)) {
+                       /*
+                        * IPv6 DualMode sockets are defaults in Mono. Explicitly specify that
+                        * anyways in this test to make it more interoparable with .NET where
+                        * IPv6 and DualMode needs to be specified.
+                        */
+                       using (var server = new Socket (AddressFamily.InterNetworkV6, SocketType.Stream, ProtocolType.Tcp))
+                       {
                                var host = new IPEndPoint (IPAddress.Loopback, NetworkHelpers.FindFreePort ());
-                                       
+
+                               server.DualMode = true;
                                server.Bind (host);
-                               server.Listen (0);
+                               server.Listen (10);
                                
                                var ep = server.LocalEndPoint as IPEndPoint;
-                               
+
                                BCCalledBack.Reset ();
+                               var client = new Socket (AddressFamily.InterNetworkV6, SocketType.Stream, ProtocolType.Tcp);
+                               client.DualMode = true;
                                var ar1 = client.BeginConnect (ep, BCCallback, client);
                                Assert.IsTrue (BCCalledBack.WaitOne (10000), "#1");
-                               client.Disconnect (true);
-                               
+                               client.Disconnect (false);
+                               client.Close ();
+
                                BCCalledBack.Reset ();
+                               client = new Socket (AddressFamily.InterNetworkV6, SocketType.Stream, ProtocolType.Tcp);
+                               client.DualMode = true;
                                var ar2 = client.BeginConnect (IPAddress.Loopback, ep.Port, BCCallback, client);
                                Assert.IsTrue (BCCalledBack.WaitOne (10000), "#2");
-                               client.Disconnect (true);
-                               
+                               client.Disconnect (false);
+                               client.Close ();
+
                                BCCalledBack.Reset ();
+                               client = new Socket (AddressFamily.InterNetworkV6, SocketType.Stream, ProtocolType.Tcp);
+                               client.DualMode = true;
                                var ar3 = client.BeginConnect (new [] {IPAddress.Loopback}, ep.Port, BCCallback, client);
                                Assert.IsTrue (BCCalledBack.WaitOne (10000), "#2");
-                               client.Disconnect (true);
+                               client.Disconnect (false);
+                               client.Close();
                        }
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void UdpMulticasTimeToLive ()
                {
                        /* see https://bugzilla.xamarin.com/show_bug.cgi?id=36941 */
index 4d3b8325048d9038ebfcaf8210960ebc71562f1a..5db3aadbc877713b962285ddcde3e66e83293cde 100644 (file)
@@ -21,7 +21,6 @@ namespace MonoTests.System.Net.Sockets
        /// Tests System.Net.Sockets.TcpClient
        /// </summary>
        [TestFixture]
-       [Category ("RequiresBSDSockets")]
        public class TcpClientTest
        {
                
@@ -30,6 +29,9 @@ namespace MonoTests.System.Net.Sockets
                /// (from System.Net.Sockets)
                /// </summary>
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void TcpClient()
                {
                        // set up a listening Socket
@@ -77,6 +79,9 @@ namespace MonoTests.System.Net.Sockets
                }
 
                [Test] // bug #81105
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void CloseTest ()
                {
                        var port = NetworkHelpers.FindFreePort ();
@@ -140,7 +145,11 @@ namespace MonoTests.System.Net.Sockets
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
                [ExpectedException (typeof(ArgumentNullException))]
+#endif
                public void ConnectMultiNull ()
                {
                        TcpClient client = new TcpClient ();
@@ -150,6 +159,9 @@ namespace MonoTests.System.Net.Sockets
                }
                
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void ConnectMultiAny ()
                {
                        TcpClient client = new TcpClient ();
@@ -168,6 +180,9 @@ namespace MonoTests.System.Net.Sockets
                }
                
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void ConnectMultiRefused ()
                {
                        TcpClient client = new TcpClient ();
index 1e211cf524920b999f0f090353814030a6dff829..15b48e5fe2b772768700e8b8ee669c5b16c5f97e 100644 (file)
@@ -20,10 +20,12 @@ using MonoTests.Helpers;
 namespace MonoTests.System.Net.Sockets
 {
        [TestFixture]
-       [Category ("RequiresBSDSockets")]
        public class TcpListenerTest
        {
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void TcpListener ()
                {
                        var port = NetworkHelpers.FindFreePort ();
@@ -75,6 +77,9 @@ namespace MonoTests.System.Net.Sockets
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void CtorInt1 ()
                {
                        int nex = 0;
@@ -87,21 +92,33 @@ namespace MonoTests.System.Net.Sockets
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
                [ExpectedException (typeof (ArgumentNullException))]
+#endif
                public void CtorIPEndPoint ()
                {
                        new TcpListener (null);
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
                [ExpectedException (typeof (ArgumentNullException))]
+#endif
                public void CtorIPAddressInt1 ()
                {
                        new TcpListener (null, 100000);
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
                [ExpectedException (typeof (ArgumentOutOfRangeException))]
+#endif
                public void CtorIPAddressInt2 ()
                {
                        new TcpListener (IPAddress.Any, 100000);
@@ -125,6 +142,9 @@ namespace MonoTests.System.Net.Sockets
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void PreStartStatus ()
                {
                        MyListener listener = new MyListener ();
@@ -152,6 +172,9 @@ namespace MonoTests.System.Net.Sockets
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void PostStartStatus ()
                {
                        MyListener listener = new MyListener ();
@@ -173,6 +196,9 @@ namespace MonoTests.System.Net.Sockets
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void StartListenMoreThan5 ()
                {
                        var port = NetworkHelpers.FindFreePort ();
@@ -193,5 +219,27 @@ namespace MonoTests.System.Net.Sockets
                        listen.Start (65536);
                        listen.Stop ();
                }
+
+               [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
+               public void EndAcceptTcpClient ()
+               {
+                       var port = NetworkHelpers.FindFreePort ();
+
+                       var listenerSocket = new TcpListener (IPAddress.Any, port);
+                       listenerSocket.Start ();
+                       listenerSocket.BeginAcceptTcpClient (new AsyncCallback (l => {
+                               listenerSocket.EndAcceptTcpClient (l);
+                       }), null);
+
+
+                       using (var outClient = new TcpClient ("localhost", port)) {
+                               using (var stream = outClient.GetStream ()) {
+                                       stream.WriteByte (3);
+                               }
+                       }
+               }
        }
 }
index 66b15308d1f84cb08efaae91d0bbe5b8e3acc62d..33dc4464c86d89bbb0cfedb032c25c3ebf2e7b85 100644 (file)
@@ -15,9 +15,11 @@ using NUnit.Framework;
 
 namespace MonoTests.System.Net.Sockets {
        [TestFixture]
-       [Category ("RequiresBSDSockets")]
        public class UdpClientTest {
                [Test] // .ctor ()
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Constructor1 ()
                {
                        MyUdpClient client;
@@ -43,6 +45,9 @@ namespace MonoTests.System.Net.Sockets {
                }
 
                [Test] // .ctor (AddressFamily)
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Constructor2 ()
                {
                        MyUdpClient client;
@@ -88,6 +93,9 @@ namespace MonoTests.System.Net.Sockets {
                }
 
                [Test] // .ctor (AddressFamily)
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Constructor2_Family_Invalid ()
                {
                        try {
@@ -114,6 +122,9 @@ namespace MonoTests.System.Net.Sockets {
                }
 
                [Test] // .ctor (Int32)
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Constructor3 ()
                {
                        Socket s;
@@ -163,6 +174,9 @@ namespace MonoTests.System.Net.Sockets {
                }
 
                [Test] // .ctor (Int32)
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Constructor3_Port_OutOfRange ()
                {
                        try {
@@ -189,6 +203,9 @@ namespace MonoTests.System.Net.Sockets {
                }
 
                [Test] // .ctor (IPEndPoint)
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Constructor4 ()
                {
                        Socket s;
@@ -221,6 +238,9 @@ namespace MonoTests.System.Net.Sockets {
                }
 
                [Test] // .ctor (IPEndPoint)
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Constructor4_LocalEP_Null ()
                {
                        try {
@@ -235,6 +255,9 @@ namespace MonoTests.System.Net.Sockets {
                }
 
                [Test] // .ctor (Int32, AddressFamily)
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Constructor5 ()
                {
                        Socket s;
@@ -288,6 +311,9 @@ namespace MonoTests.System.Net.Sockets {
                }
 
                [Test] // .ctor (Int32, AddressFamily)
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Constructor5_Family_Invalid ()
                {
                        try {
@@ -318,6 +344,9 @@ namespace MonoTests.System.Net.Sockets {
                }
 
                [Test] // .ctor (Int32, AddressFamily)
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Constructor5_Port_OutOfRange ()
                {
                        try {
@@ -344,6 +373,9 @@ namespace MonoTests.System.Net.Sockets {
                }
 
                [Test] // .ctor (String, Int32)
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Constructor6 ()
                {
                        Socket s;
@@ -394,6 +426,9 @@ namespace MonoTests.System.Net.Sockets {
                }
 
                [Test] // .ctor (String, Int32)
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Constructor6_HostName_Null ()
                {
                        try {
@@ -408,6 +443,9 @@ namespace MonoTests.System.Net.Sockets {
                }
 
                [Test] // .ctor (String, Int32)
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Constructor6_Port_OutOfRange ()
                {
                        try {
@@ -434,6 +472,9 @@ namespace MonoTests.System.Net.Sockets {
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void UdpClientBroadcastTest () 
                {
                        UdpClient client = new UdpClient ();
@@ -447,6 +488,9 @@ namespace MonoTests.System.Net.Sockets {
                }
 
                [Test] // JoinMulticastGroup (IPAddress)
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void JoinMulticastGroup1_IPv4 ()
                {
                        IPAddress mcast_addr = IPAddress.Parse ("224.0.0.23");
@@ -457,6 +501,9 @@ namespace MonoTests.System.Net.Sockets {
                }
 
                [Test] // JoinMulticastGroup (IPAddress)
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void JoinMulticastGroup1_IPv6 ()
                {
                        if (!Socket.OSSupportsIPv6)
@@ -470,6 +517,9 @@ namespace MonoTests.System.Net.Sockets {
                }
 
                [Test] // JoinMulticastGroup (IPAddress)
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void JoinMulticastGroup1_MulticastAddr_Null ()
                {
                        using (UdpClient client = new UdpClient (new IPEndPoint (IPAddress.Loopback, 1234))) {
@@ -486,6 +536,9 @@ namespace MonoTests.System.Net.Sockets {
                }
 
                [Test] // JoinMulticastGroup (IPAddress)
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void JoinMulticastGroup1_Socket_Closed ()
                {
                        IPAddress mcast_addr = null;
@@ -505,29 +558,22 @@ namespace MonoTests.System.Net.Sockets {
                }
 
                [Test] // JoinMulticastGroup (IPAddress)
-               [Category ("NotWorking")]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void JoinMulticastGroup1_Socket_NotBound ()
                {
                        IPAddress mcast_addr = IPAddress.Parse ("224.0.0.23");
 
-                       UdpClient client = new UdpClient (AddressFamily.InterNetwork);
-                       try {
+                       using (UdpClient client = new UdpClient (AddressFamily.InterNetwork)) {
                                client.JoinMulticastGroup (mcast_addr);
-                               Assert.Fail ("#1");
-                       } catch (SocketException ex) {
-                               // An invalid argument was supplied
-                               Assert.AreEqual (typeof (SocketException), ex.GetType (), "#2");
-                               Assert.AreEqual (10022, ex.ErrorCode, "#3");
-                               Assert.IsNull (ex.InnerException, "#4");
-                               Assert.IsNotNull (ex.Message, "#5");
-                               Assert.AreEqual (10022, ex.NativeErrorCode, "#6");
-                               Assert.AreEqual (SocketError.InvalidArgument, ex.SocketErrorCode, "#7");
-                       } finally {
-                               client.Close ();
                        }
                }
 
                [Test] // JoinMulticastGroup (In32, IPAddress)
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void JoinMulticastGroup2_IPv4 ()
                {
                        IPAddress mcast_addr = IPAddress.Parse ("224.0.0.23");
@@ -550,6 +596,9 @@ namespace MonoTests.System.Net.Sockets {
                }
 
                [Test] // JoinMulticastGroup (In32, IPAddress)
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void JoinMulticastGroup2_IPv6 ()
                {
                        if (!Socket.OSSupportsIPv6)
@@ -563,6 +612,9 @@ namespace MonoTests.System.Net.Sockets {
                }
 
                [Test] // JoinMulticastGroup (Int32, IPAddress)
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void JoinMulticastGroup2_MulticastAddr_Null ()
                {
                        using (UdpClient client = new UdpClient (new IPEndPoint (IPAddress.Loopback, 1234))) {
@@ -579,6 +631,9 @@ namespace MonoTests.System.Net.Sockets {
                }
 
                [Test] // JoinMulticastGroup (Int32, IPAddress)
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void JoinMulticastGroup2_Socket_Closed ()
                {
                        if (!Socket.OSSupportsIPv6)
@@ -601,29 +656,22 @@ namespace MonoTests.System.Net.Sockets {
                }
 
                [Test] // JoinMulticastGroup (Int32, IPAddress)
-               [Category ("NotWorking")]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void JoinMulticastGroup2_Socket_NotBound ()
                {
                        IPAddress mcast_addr = IPAddress.Parse ("ff02::1");
 
-                       UdpClient client = new UdpClient (AddressFamily.InterNetworkV6);
-                       try {
+                       using (UdpClient client = new UdpClient (AddressFamily.InterNetworkV6)) {
                                client.JoinMulticastGroup (0, mcast_addr);
-                               Assert.Fail ("#1");
-                       } catch (SocketException ex) {
-                               // An invalid argument was supplied
-                               Assert.AreEqual (typeof (SocketException), ex.GetType (), "#2");
-                               Assert.AreEqual (10022, ex.ErrorCode, "#3");
-                               Assert.IsNull (ex.InnerException, "#4");
-                               Assert.IsNotNull (ex.Message, "#5");
-                               Assert.AreEqual (10022, ex.NativeErrorCode, "#6");
-                               Assert.AreEqual (SocketError.InvalidArgument, ex.SocketErrorCode, "#7");
-                       } finally {
-                               client.Close ();
                        }
                }
 
                [Test] // JoinMulticastGroup (IPAddress, Int32)
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void JoinMulticastGroup3_IPv4 ()
                {
                        IPAddress mcast_addr = IPAddress.Parse ("224.0.0.23");
@@ -638,6 +686,9 @@ namespace MonoTests.System.Net.Sockets {
                }
 
                [Test] // JoinMulticastGroup (IPAddress, Int32)
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void JoinMulticastGroup3_IPv6 ()
                {
                        if (!Socket.OSSupportsIPv6)
@@ -655,6 +706,9 @@ namespace MonoTests.System.Net.Sockets {
                }
 
                [Test] // JoinMulticastGroup (IPAddress, Int32)
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void JoinMulticastGroup3_MulticastAddr_Null ()
                {
                        using (UdpClient client = new UdpClient (new IPEndPoint (IPAddress.Loopback, 1234))) {
@@ -671,6 +725,9 @@ namespace MonoTests.System.Net.Sockets {
                }
 
                [Test] // JoinMulticastGroup (IPAddress, Int32)
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void JoinMulticastGroup3_Socket_Closed ()
                {
                        IPAddress mcast_addr = null;
@@ -690,29 +747,22 @@ namespace MonoTests.System.Net.Sockets {
                }
 
                [Test] // JoinMulticastGroup (IPAddress, Int32)
-               [Category ("NotWorking")]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void JoinMulticastGroup3_Socket_NotBound ()
                {
                        IPAddress mcast_addr = IPAddress.Parse ("224.0.0.23");
 
-                       UdpClient client = new UdpClient (AddressFamily.InterNetwork);
-                       try {
+                       using (UdpClient client = new UdpClient (AddressFamily.InterNetwork)) {
                                client.JoinMulticastGroup (mcast_addr, 5);
-                               Assert.Fail ("#1");
-                       } catch (SocketException ex) {
-                               // An invalid argument was supplied
-                               Assert.AreEqual (typeof (SocketException), ex.GetType (), "#2");
-                               Assert.AreEqual (10022, ex.ErrorCode, "#3");
-                               Assert.IsNull (ex.InnerException, "#4");
-                               Assert.IsNotNull (ex.Message, "#5");
-                               Assert.AreEqual (10022, ex.NativeErrorCode, "#6");
-                               Assert.AreEqual (SocketError.InvalidArgument, ex.SocketErrorCode, "#7");
-                       } finally {
-                               client.Close ();
                        }
                }
 
                [Test] // JoinMulticastGroup (IPAddress, IPAddress)
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void JoinMulticastGroup4_IPv4 ()
                {
                        IPAddress mcast_addr = IPAddress.Parse ("224.0.0.23");
@@ -724,6 +774,9 @@ namespace MonoTests.System.Net.Sockets {
                }
 
                [Test] // JoinMulticastGroup (IPAddress, IPAddress)
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void JoinMulticastGroup4_IPv6 ()
                {
                        if (!Socket.OSSupportsIPv6)
@@ -750,6 +803,9 @@ namespace MonoTests.System.Net.Sockets {
                }
 
                [Test] // JoinMulticastGroup (IPAddress, IPAddress)
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void JoinMulticastGroup4_LocalAddress_Null ()
                {
                        IPAddress mcast_addr = IPAddress.Parse ("224.0.0.23");
@@ -768,6 +824,9 @@ namespace MonoTests.System.Net.Sockets {
                }
 
                [Test] // JoinMulticastGroup (IPAddress, IPAddress)
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void JoinMulticastGroup4_MulticastAddr_Null ()
                {
                        using (UdpClient client = new UdpClient (new IPEndPoint (IPAddress.Loopback, 1234))) {
@@ -784,6 +843,9 @@ namespace MonoTests.System.Net.Sockets {
                }
 
                [Test] // JoinMulticastGroup (IPAddress, IPAddress)
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void JoinMulticastGroup4_Socket_Closed ()
                {
                        IPAddress mcast_addr = null;
@@ -804,30 +866,23 @@ namespace MonoTests.System.Net.Sockets {
                }
 
                [Test] // JoinMulticastGroup (IPAddress, IPAddress)
-               [Category ("NotWorking")]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void JoinMulticastGroup4_Socket_NotBound ()
                {
                        IPAddress mcast_addr = IPAddress.Parse ("224.0.0.23");
                        IPAddress local_addr = Dns.GetHostEntry (string.Empty).AddressList [0];
 
-                       UdpClient client = new UdpClient (AddressFamily.InterNetwork);
-                       try {
+                       using (UdpClient client = new UdpClient (AddressFamily.InterNetwork)) {
                                client.JoinMulticastGroup (mcast_addr, local_addr);
-                               Assert.Fail ("#1");
-                       } catch (SocketException ex) {
-                               // An invalid argument was supplied
-                               Assert.AreEqual (typeof (SocketException), ex.GetType (), "#2");
-                               Assert.AreEqual (10022, ex.ErrorCode, "#3");
-                               Assert.IsNull (ex.InnerException, "#4");
-                               Assert.IsNotNull (ex.Message, "#5");
-                               Assert.AreEqual (10022, ex.NativeErrorCode, "#6");
-                               Assert.AreEqual (SocketError.InvalidArgument, ex.SocketErrorCode, "#7");
-                       } finally {
-                               client.Close ();
                        }
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void CloseInReceive ()
                {
                        UdpClient client = null;
@@ -868,6 +923,9 @@ namespace MonoTests.System.Net.Sockets {
 
                // Test for bug 324033
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void JoinMulticastGroupWithLocal ()
                {
                        UdpClient client = new UdpClient (9001);
@@ -882,7 +940,11 @@ namespace MonoTests.System.Net.Sockets {
                }
                
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
                [ExpectedException (typeof(ArgumentNullException))]
+#endif
                public void BeginSendNull ()
                {
                        UdpClient client = new UdpClient ();
@@ -905,6 +967,9 @@ namespace MonoTests.System.Net.Sockets {
                }
                
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void BeginSend ()
                {
                        UdpClient client = new UdpClient ();
@@ -959,6 +1024,9 @@ namespace MonoTests.System.Net.Sockets {
                }
                
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void BeginReceive ()
                {
                        UdpClient client = new UdpClient (1237);
@@ -984,6 +1052,9 @@ namespace MonoTests.System.Net.Sockets {
                }
                
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Available ()
                {
                        using (UdpClient client = new UdpClient (1238)) {
@@ -1018,6 +1089,9 @@ namespace MonoTests.System.Net.Sockets {
                }
                
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void EnableBroadcastDefault ()
                {
                        UdpClient client = new UdpClient ();
@@ -1057,6 +1131,9 @@ namespace MonoTests.System.Net.Sockets {
                }
                
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void MulticastLoopbackDefault ()
                {
                        UdpClient client = new UdpClient ();
@@ -1067,6 +1144,9 @@ namespace MonoTests.System.Net.Sockets {
                }
 
                [Test] // #6057
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void ReceiveIPv6 ()
                {
                        if (!Socket.OSSupportsIPv6)
index 0638cb720b3a57d67b0879d93f72fce0a3bda685..e3dd58188c17358fe03c97bac68aaed04f105ef7 100644 (file)
@@ -1,4 +1,3 @@
-#if NET_4_5
 using System;
 using System.Net;
 using System.Threading;
@@ -19,31 +18,33 @@ namespace MonoTests.System.Net.WebSockets
        {
                const string EchoServerUrl = "ws://corefx-net.cloudapp.net/WebSocket/EchoWebSocket.ashx";
                int Port = NetworkHelpers.FindFreePort ();
-               HttpListener listener;
-               ClientWebSocket socket;
-               MethodInfo headerSetMethod;
-
-               [SetUp]
-               public void Setup ()
-               {
-                       listener = new HttpListener ();
-                       listener.Prefixes.Add ("http://localhost:" + Port + "/");
-                       listener.Start ();
-                       socket = new ClientWebSocket ();
+               HttpListener _listener;
+               HttpListener listener {
+                       get {
+                               if (_listener != null)
+                                       return _listener;
+                               var tmp = new HttpListener ();
+                               tmp.Prefixes.Add ("http://localhost:" + Port + "/");
+                               tmp.Start ();
+                               return _listener = tmp;
+                       }
                }
+               ClientWebSocket _socket;
+               ClientWebSocket socket { get { return _socket ?? (_socket = new ClientWebSocket ()); } }
+               MethodInfo headerSetMethod;
 
                [TearDown]
                public void Teardown ()
                {
-                       if (listener != null) {
-                               listener.Stop ();
-                               listener = null;
+                       if (_listener != null) {
+                               _listener.Stop ();
+                               _listener = null;
                        }
-                       if (socket != null) {
-                               if (socket.State == WebSocketState.Open)
-                                       socket.CloseAsync (WebSocketCloseStatus.NormalClosure, string.Empty, CancellationToken.None).Wait (2000);
-                               socket.Dispose ();
-                               socket = null;
+                       if (_socket != null) {
+                               if (_socket.State == WebSocketState.Open)
+                                       _socket.CloseAsync (WebSocketCloseStatus.NormalClosure, string.Empty, CancellationToken.None).Wait (2000);
+                               _socket.Dispose ();
+                               _socket = null;
                        }
                }
 
@@ -297,4 +298,3 @@ namespace MonoTests.System.Net.WebSockets
        }
 }
 
-#endif
index 37c40d7445e070cd8d5021dc238253b6bdac5db5..f3c4eceea74abb0622b2945ecb3f6325a0bae2ce 100644 (file)
@@ -9,7 +9,6 @@ using NUnit.Framework;
 namespace MonoTests.System.Net
 {
        [TestFixture]
-       [Category ("RequiresBSDSockets")]
        public class CookieParserTest
        {
                public const string A = "Foo=Bar, expires=World; expires=Sat, 11-Oct-14 22:45:19 GMT, A=B";
@@ -72,6 +71,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void TestExpires ()
                {
                        var cookies = DoRequest (A);
@@ -82,6 +84,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void TestInvalidCookie ()
                {
                        var cookies = DoRequest (B);
@@ -92,6 +97,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void TestLocalCulture ()
                {
                        var old = Thread.CurrentThread.CurrentCulture;
@@ -109,6 +117,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void TestMultiple ()
                {
                        var cookies = DoRequest (D);
@@ -119,6 +130,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void TestMultiple2 ()
                {
                        var cookies = DoRequest (E);
@@ -128,6 +142,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void TestQuotation ()
                {
                        var cookies = DoRequest (F);
@@ -140,6 +157,7 @@ namespace MonoTests.System.Net
                {
                        Socket socket;
                        string[] headers;
+                       Exception ex;
 
                        public Listener (params string[] headers)
                        {
@@ -155,17 +173,28 @@ namespace MonoTests.System.Net
                                socket.Bind (new IPEndPoint (IPAddress.Loopback, 0));
                                socket.Listen (1);
                                socket.BeginAccept ((result) => {
-                                       var accepted = socket.EndAccept (result);
-                                       HandleRequest (accepted);
+                                       try {
+                                               var accepted = socket.EndAccept (result);
+                                               HandleRequest (accepted);
+                                       } catch (Exception e) {
+                                               ex = e;
+                                       }
                                }, null);
                        }
 
+                       void ThrowIfException ()
+                       {
+                               if (ex != null)
+                                       throw ex;
+                       }
+
                        public void Dispose ()
                        {
                                if (socket != null) {
                                        socket.Close ();
                                        socket = null;
                                }
+                               ThrowIfException ();
                        }
 
                        void HandleRequest (Socket accepted)
@@ -183,11 +212,17 @@ namespace MonoTests.System.Net
                        }
 
                        public EndPoint EndPoint {
-                               get { return socket.LocalEndPoint; }
+                               get {
+                                       ThrowIfException ();
+                                       return socket.LocalEndPoint;
+                               }
                        }
 
                        public string URI {
-                               get { return string.Format ("http://{0}/", EndPoint); }
+                               get {
+                                       ThrowIfException ();
+                                       return string.Format ("http://{0}/", EndPoint);
+                               }
                        }
                }
        }
index dcc82f61678777cc202e1b94417d4b7a82c0d114..fef014541882d3011f1d7bbcd4ea466b8161c2f3 100644 (file)
@@ -19,7 +19,6 @@ using NUnit.Framework;
 namespace MonoTests.System.Net\r
 {\r
        [TestFixture]\r
-       [Category ("RequiresBSDSockets")]\r
        public class DnsTest\r
        {\r
                private String site1Name = "google-public-dns-a.google.com",\r
@@ -30,30 +29,48 @@ namespace MonoTests.System.Net
                private uint site1IP = 134744072, site2IP = 134743044; // Big-Endian\r
 \r
                [Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
                public void AsyncGetHostByName ()\r
                {\r
-                       IAsyncResult r;\r
-                       r = Dns.BeginGetHostByName (site1Name, new AsyncCallback (GetHostByNameCallback), null);\r
-\r
                        IAsyncResult async = Dns.BeginGetHostByName (site1Name, null, null);\r
                        IPHostEntry entry = Dns.EndGetHostByName (async);\r
                        SubTestValidIPHostEntry (entry);\r
                        Assert.IsTrue (entry.HostName == "google-public-dns-a.google.com");\r
                }\r
 \r
-               void GetHostByNameCallback (IAsyncResult ar)\r
-               {\r
-                       IPHostEntry h;\r
-                       h = Dns.EndGetHostByName (ar);\r
-                       SubTestValidIPHostEntry (h);\r
+               [Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
+               public void AsyncGetHostByNameCallback ()\r
+               {\r
+                       var evt = new ManualResetEvent (false);\r
+                       Exception ex = null;\r
+                       Dns.BeginGetHostByName (site1Name, new AsyncCallback ((IAsyncResult ar) =>\r
+                       {\r
+                               try {\r
+                                       IPHostEntry h;\r
+                                       h = Dns.EndGetHostByName (ar);\r
+                                       SubTestValidIPHostEntry (h);\r
+                               } catch (Exception e) {\r
+                                       ex = e;\r
+                               } finally {\r
+                                       evt.Set ();\r
+                               }\r
+                       }), null);\r
+\r
+                       Assert.IsTrue (evt.WaitOne (TimeSpan.FromSeconds (60)), "Wait");\r
+                       Assert.IsNull (ex, "Exception");\r
                }\r
 \r
                [Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
                public void AsyncResolve ()\r
                {\r
-                       IAsyncResult r;\r
-                       r = Dns.BeginResolve (site1Name, new AsyncCallback (ResolveCallback), null);\r
-\r
                        IAsyncResult async = Dns.BeginResolve (site1Dot, null, null);\r
                        IPHostEntry entry = Dns.EndResolve (async);\r
                        SubTestValidIPHostEntry (entry);\r
@@ -61,10 +78,28 @@ namespace MonoTests.System.Net
                        Assert.AreEqual (site1Dot, ip.ToString ());\r
                }\r
 \r
-               void ResolveCallback (IAsyncResult ar)\r
-               {\r
-                       IPHostEntry h = Dns.EndResolve (ar);\r
-                       SubTestValidIPHostEntry (h);\r
+               [Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
+               public void AsyncResolveCallback ()\r
+               {\r
+                       var evt = new ManualResetEvent (false);\r
+                       Exception ex = null;\r
+                       Dns.BeginResolve (site1Name, new AsyncCallback ((IAsyncResult ar) =>\r
+                       {\r
+                               try {\r
+                                       IPHostEntry h = Dns.EndResolve (ar);\r
+                                       SubTestValidIPHostEntry (h);\r
+                               } catch (Exception e) {\r
+                                       ex = e;\r
+                               } finally {\r
+                                       evt.Set ();\r
+                               }\r
+                       }), null);\r
+\r
+                       Assert.IsTrue (evt.WaitOne (TimeSpan.FromSeconds (60)), "Wait");\r
+                       Assert.IsNull (ex, "Exception");\r
                }\r
 \r
                [Test]\r
@@ -73,7 +108,7 @@ namespace MonoTests.System.Net
                        try {\r
                                Dns.BeginGetHostAddresses (\r
                                        (string) null,\r
-                                       new AsyncCallback (GetHostAddressesCallback),\r
+                                       new AsyncCallback (ShouldntBeCalled),\r
                                        null);\r
                                Assert.Fail ("#1");\r
                        } catch (ArgumentNullException ex) {\r
@@ -91,7 +126,7 @@ namespace MonoTests.System.Net
                        try {\r
                                Dns.BeginGetHostAddresses (\r
                                        "0.0.0.0",\r
-                                       new AsyncCallback (GetHostAddressesCallback),\r
+                                       new AsyncCallback (ShouldntBeCalled),\r
                                        null);\r
                                Assert.Fail ("#A1");\r
                        } catch (ArgumentException ex) {\r
@@ -108,7 +143,7 @@ namespace MonoTests.System.Net
                        try {\r
                                Dns.BeginGetHostAddresses (\r
                                        "::0",\r
-                                       new AsyncCallback (GetHostAddressesCallback),\r
+                                       new AsyncCallback (ShouldntBeCalled),\r
                                        null);\r
                                Assert.Fail ("#B1");\r
                        } catch (ArgumentException ex) {\r
@@ -122,10 +157,9 @@ namespace MonoTests.System.Net
                        }\r
                }\r
 \r
-               void GetHostAddressesCallback (IAsyncResult ar)\r
+               void ShouldntBeCalled (IAsyncResult ar)\r
                {\r
-                       IPAddress [] addresses = Dns.EndGetHostAddresses (ar);\r
-                       Assert.IsNotNull (addresses);\r
+                       Assert.Fail ("Should not be called");\r
                }\r
 \r
                [Test]\r
@@ -182,6 +216,9 @@ namespace MonoTests.System.Net
                }\r
 \r
                [Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
                public void GetHostByName ()\r
                {\r
                        SubTestGetHostByName (site1Name, site1Dot);\r
@@ -313,11 +350,14 @@ namespace MonoTests.System.Net
                }\r
 \r
                [Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
                public void BeginResolve_HostName_Null ()\r
                {\r
                        try {\r
                                Dns.BeginResolve ((string) null,\r
-                                       new AsyncCallback (ResolveCallback),\r
+                                       new AsyncCallback (ShouldntBeCalled),\r
                                        null);\r
                                Assert.Fail ("#1");\r
                        } catch (ArgumentNullException ex) {\r
@@ -329,6 +369,9 @@ namespace MonoTests.System.Net
                }\r
 \r
                [Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
                public void Resolve ()\r
                {\r
                        SubTestResolve (site1Name);\r
@@ -344,6 +387,9 @@ namespace MonoTests.System.Net
                }\r
 \r
                [Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
                public void Resolve_HostName_Null ()\r
                {\r
                        try {\r
@@ -358,12 +404,15 @@ namespace MonoTests.System.Net
                }\r
 \r
                [Test] // BeginGetHostEntry (IPAddress, AsyncCallback, Object)\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
                public void BeginGetHostEntry1_Address_Null ()\r
                {\r
                        try {\r
                                Dns.BeginGetHostEntry (\r
                                        (IPAddress) null,\r
-                                       new AsyncCallback (GetHostAddressesCallback),\r
+                                       new AsyncCallback (ShouldntBeCalled),\r
                                        null);\r
                                Assert.Fail ("#1");\r
                        } catch (ArgumentNullException ex) {\r
@@ -375,12 +424,15 @@ namespace MonoTests.System.Net
                }\r
 \r
                [Test] // BeginGetHostEntry (String, AsyncCallback, Object)\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
                public void BeginGetHostEntry2_HostNameOrAddress_Null ()\r
                {\r
                        try {\r
                                Dns.BeginGetHostEntry (\r
                                        (string) null,\r
-                                       new AsyncCallback (GetHostAddressesCallback),\r
+                                       new AsyncCallback (ShouldntBeCalled),\r
                                        null);\r
                                Assert.Fail ("#1");\r
                        } catch (ArgumentNullException ex) {\r
@@ -392,6 +444,9 @@ namespace MonoTests.System.Net
                }\r
 \r
                [Test] // BeginGetHostEntry (String, AsyncCallback, Object)\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
                public void BeginGetHostEntry2_HostNameOrAddress_UnspecifiedAddress ()\r
                {\r
                        // IPv4\r
@@ -450,6 +505,9 @@ namespace MonoTests.System.Net
                }\r
 \r
                [Test] // GetHostEntry (String)\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
                public void GetHostEntry2 ()\r
                {\r
                        Dns.GetHostEntry (site1Name); // hostname\r
index 5f4166eecf855549bfd4ea8a51d9ffa556b14cb1..6793d2a48fdeffefa3c47d532c664f915bcc4330 100644 (file)
@@ -25,7 +25,6 @@ using NUnit.Framework;
 namespace MonoTests.System.Net
 {
        [TestFixture]
-       [Category ("RequiresBSDSockets")]
        public class FileWebRequestTest
        {
                private string _tempDirectory;
index 93697cd29294145f8c1466224e44eacb5b210667..771d5d1fb6ae4cf35c3e05db8b41a44cb6175435 100644 (file)
@@ -19,10 +19,12 @@ using System.Threading;
 namespace MonoTests.System.Net 
 {
        [TestFixture]
-       [Category ("RequiresBSDSockets")]
        public class FtpWebRequestTest
        {
-               FtpWebRequest defaultRequest;
+               FtpWebRequest _defaultRequest;
+               FtpWebRequest defaultRequest {
+                       get { return _defaultRequest ?? (_defaultRequest = (FtpWebRequest) WebRequest.Create ("ftp://www.contoso.com")); }
+               }
                
                private string _tempDirectory;
                private string _tempFile;
@@ -49,25 +51,31 @@ namespace MonoTests.System.Net
                                Directory.Delete (_tempDirectory, true);
                }
 
-               [TestFixtureSetUp]
-               public void Init ()
-               {
-                       defaultRequest = (FtpWebRequest) WebRequest.Create ("ftp://www.contoso.com");
-               }
-               
                [Test]
                public void ContentLength ()
                {
                        try {
                                long l = defaultRequest.ContentLength;
+#if FEATURE_NO_BSD_SOCKETS
+                               Assert.Fail ("#1a");
+                       } catch (PlatformNotSupportedException) {
+                               // OK.
+#else
                        } catch (NotSupportedException) {
                                Assert.Fail ("#1"); // Not overriden
+#endif
                        }
 
                        try {
                                defaultRequest.ContentLength = 2;
+#if FEATURE_NO_BSD_SOCKETS
+                               Assert.Fail ("#2a");
+                       } catch (PlatformNotSupportedException) {
+                               // OK.
+#else
                        } catch (NotSupportedException) {
                                Assert.Fail ("#2"); // Not overriden
+#endif
                        }
                }
 
@@ -88,6 +96,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void ContentOffset ()
                {
                        try {
@@ -98,6 +109,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Credentials ()
                {
                        try {
@@ -109,6 +123,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Method ()
                {
                        try {
@@ -146,6 +163,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void ReadWriteTimeout ()
                {
                        try {
@@ -156,6 +176,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Timeout ()
                {
                        try {
@@ -166,6 +189,9 @@ namespace MonoTests.System.Net
                }
                
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void DefaultValues ()
                {
                        FtpWebRequest request = (FtpWebRequest) WebRequest.Create ("ftp://www.contoso.com");
@@ -183,6 +209,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void RenameTo ()
                {
                        try {
@@ -199,11 +228,31 @@ namespace MonoTests.System.Net
                }
 
                [Test]
-               public void UploadFile1 ()
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
+               public void UploadFile1_v4 ()
+               {
+                       UploadFile1 (false);
+               }
+
+               [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
+               public void UploadFile1_v6 ()
+               {
+                       if (!Socket.OSSupportsIPv6)
+                               Assert.Ignore ("IPv6 not supported.");
+
+                       UploadFile1 (true);
+               }
+
+               void UploadFile1 (bool ipv6)
                {
-                       ServerPut sp = new ServerPut ();
+                       ServerPut sp = new ServerPut (ipv6);
                        sp.Start ();
-                       string uri = String.Format ("ftp://{0}:{1}/uploads/file.txt", sp.IPAddress, sp.Port);
+                       string uri = String.Format ("ftp://{0}:{1}/uploads/file.txt", EncloseIPv6 (sp.IPAddress), sp.Port);
                        try {
                                FtpWebRequest ftp = (FtpWebRequest) WebRequest.Create (uri);
                                ftp.KeepAlive = false;
@@ -229,15 +278,35 @@ namespace MonoTests.System.Net
                }
 
                [Test]
-               public void UploadFile_WebClient ()
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
+               public void UploadFile_WebClient_v4 ()
+               {
+                       UploadFile_WebClient (false);
+               }
+
+               [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
+               public void UploadFile_WebClient_v6 ()
+               {
+                       if (!Socket.OSSupportsIPv6)
+                               Assert.Ignore ("IPv6 not supported.");
+
+                       UploadFile_WebClient (true);
+               }
+
+               public void UploadFile_WebClient (bool ipv6)
                {
-                       ServerPut sp = new ServerPut ();
+                       ServerPut sp = new ServerPut (ipv6);
                        File.WriteAllText (_tempFile, "0123456789");
                        sp.Start ();
 
                        using (WebClient m_WebClient = new WebClient())
                        {
-                               string uri = String.Format ("ftp://{0}:{1}/uploads/file.txt", sp.IPAddress, sp.Port);
+                               string uri = String.Format ("ftp://{0}:{1}/uploads/file.txt", EncloseIPv6 (sp.IPAddress), sp.Port);
                                
                                m_WebClient.UploadFile(uri, _tempFile);
                        }
@@ -247,15 +316,30 @@ namespace MonoTests.System.Net
                }
 
                [Test]
-               public void DownloadFile1 ()
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
+               public void DownloadFile1_v4 ()
                {
-                       DownloadFile (new ServerDownload ());
+                       DownloadFile (new ServerDownload (false));
+               }
+
+               [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
+               public void DownloadFile1_v6 ()
+               {
+                       if (!Socket.OSSupportsIPv6)
+                               Assert.Ignore ("IPv6 not supported.");
+
+                       DownloadFile (new ServerDownload (true));
                }
 
                void DownloadFile (ServerDownload sp)
                {
                        sp.Start ();
-                       string uri = String.Format ("ftp://{0}:{1}/file.txt", sp.IPAddress, sp.Port);
+                       string uri = String.Format ("ftp://{0}:{1}/file.txt", EncloseIPv6 (sp.IPAddress), sp.Port);
                        try {
                                FtpWebRequest ftp = (FtpWebRequest) WebRequest.Create (uri);
                                ftp.KeepAlive = false;
@@ -279,19 +363,53 @@ namespace MonoTests.System.Net
                }
 
                [Test]
-               public void DownloadFile2 ()
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
+               public void DownloadFile2_v4 ()
+               {
+                       // Some embedded FTP servers in Industrial Automation Hardware report
+                       // the PWD using backslashes, but allow forward slashes for CWD.
+                       DownloadFile (new ServerDownload (@"\Users\someuser", "/Users/someuser/", false));
+               }
+
+               [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
+               public void DownloadFile2_v6 ()
                {
                        // Some embedded FTP servers in Industrial Automation Hardware report
                        // the PWD using backslashes, but allow forward slashes for CWD.
-                       DownloadFile (new ServerDownload (@"\Users\someuser", "/Users/someuser/"));
+                       DownloadFile (new ServerDownload (@"\Users\someuser", "/Users/someuser/", true));
                }
 
                [Test]
-               public void DeleteFile1 ()
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
+               public void DeleteFile1_v4 ()
+               {
+                       DeleteFile1 (false);
+               }
+
+               [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
+               public void DeleteFile1_v6 ()
+               {
+                       if (!Socket.OSSupportsIPv6)
+                               Assert.Ignore ("IPv6 not supported.");
+
+                       DeleteFile1 (true);
+               }
+
+               void DeleteFile1 (bool ipv6)
                {
-                       ServerDeleteFile sp = new ServerDeleteFile ();
+                       ServerDeleteFile sp = new ServerDeleteFile (ipv6);
                        sp.Start ();
-                       string uri = String.Format ("ftp://{0}:{1}/file.txt", sp.IPAddress, sp.Port);
+                       string uri = String.Format ("ftp://{0}:{1}/file.txt", EncloseIPv6 (sp.IPAddress), sp.Port);
                        try {
                                FtpWebRequest ftp = (FtpWebRequest) WebRequest.Create (uri);
                                Console.WriteLine (ftp.RequestUri);
@@ -313,11 +431,31 @@ namespace MonoTests.System.Net
                }
 
                [Test]
-               public void ListDirectory1 ()
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
+               public void ListDirectory1_v4 ()
+               {
+                       ListDirectory1 (false);
+               }
+
+               [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
+               public void ListDirectory1_v6 ()
+               {
+                       if (!Socket.OSSupportsIPv6)
+                               Assert.Ignore ("IPv6 not supported.");
+
+                       ListDirectory1 (true);
+               }
+
+               void ListDirectory1 (bool ipv6)
                {
-                       ServerListDirectory sp = new ServerListDirectory ();
+                       ServerListDirectory sp = new ServerListDirectory (ipv6);
                        sp.Start ();
-                       string uri = String.Format ("ftp://{0}:{1}/somedir/", sp.IPAddress, sp.Port);
+                       string uri = String.Format ("ftp://{0}:{1}/somedir/", EncloseIPv6 (sp.IPAddress), sp.Port);
                        try {
                                FtpWebRequest ftp = (FtpWebRequest) WebRequest.Create (uri);
                                Console.WriteLine (ftp.RequestUri);
@@ -340,7 +478,20 @@ namespace MonoTests.System.Net
                        }
                }
 
+               string EncloseIPv6 (IPAddress address)
+               {
+                       if (address.AddressFamily == AddressFamily.InterNetwork)
+                               return address.ToString ();
+                       
+                       return String.Format ("[{0}]", address.ToString ());
+               }
+
                class ServerListDirectory : FtpServer {
+                       public ServerListDirectory (bool ipv6)
+                               : base (ipv6)
+                       {
+                       }
+
                        protected override void Run ()
                        {
                                Socket client = control.Accept ();
@@ -358,24 +509,12 @@ namespace MonoTests.System.Net
                                }
 
                                string str = reader.ReadLine ();
-                               if (str != "PASV") {
-                                       Where = "PASV";
+                               string resp = FormatPassiveResponse (str);
+                               if (resp == null) {
                                        client.Close ();
                                        return;
                                }
-
-                               IPEndPoint end_data = (IPEndPoint) data.LocalEndPoint;
-                               byte [] addr_bytes = end_data.Address.GetAddressBytes ();
-                               byte [] port = new byte [2];
-                               port[0] = (byte) ((end_data.Port >> 8) & 255);
-                               port[1] = (byte) (end_data.Port & 255);
-                               StringBuilder sb = new StringBuilder ("227 Passive (");
-                               foreach (byte b in addr_bytes) {
-                                       sb.AppendFormat ("{0},", b);    
-                               }
-                               sb.AppendFormat ("{0},", port [0]);     
-                               sb.AppendFormat ("{0})", port [1]);     
-                               writer.WriteLine (sb.ToString ());
+                               writer.WriteLine (resp);
                                writer.Flush ();
 
                                str = reader.ReadLine ();
@@ -402,6 +541,11 @@ namespace MonoTests.System.Net
                }
 
                class ServerDeleteFile : FtpServer {
+                       public ServerDeleteFile (bool ipv6)
+                               : base (ipv6)
+                       {
+                       }
+
                        protected override void Run ()
                        {
                                Socket client = control.Accept ();
@@ -438,12 +582,13 @@ namespace MonoTests.System.Net
 
                        string Pwd, Cwd;
 
-                       public ServerDownload ()
-                               : this (null, null)
+                       public ServerDownload (bool ipv6)
+                               : this (null, null, ipv6)
                        {
                        }
 
-                       public ServerDownload (string pwd, string cwd)
+                       public ServerDownload (string pwd, string cwd, bool ipv6)
+                               : base (ipv6)
                        {
                                Pwd = pwd ?? "/home/someuser";
                                Cwd = cwd ?? "/home/someuser/";
@@ -466,24 +611,12 @@ namespace MonoTests.System.Net
                                }
 
                                string str = reader.ReadLine ();
-                               if (str != "PASV") {
-                                       Where = "PASV";
+                               string resp = FormatPassiveResponse (str);
+                               if (resp == null) {
                                        client.Close ();
                                        return;
                                }
-
-                               IPEndPoint end_data = (IPEndPoint) data.LocalEndPoint;
-                               byte [] addr_bytes = end_data.Address.GetAddressBytes ();
-                               byte [] port = new byte [2];
-                               port[0] = (byte) ((end_data.Port >> 8) & 255);
-                               port[1] = (byte) (end_data.Port & 255);
-                               StringBuilder sb = new StringBuilder ("227 Passive (");
-                               foreach (byte b in addr_bytes) {
-                                       sb.AppendFormat ("{0},", b);    
-                               }
-                               sb.AppendFormat ("{0},", port [0]);     
-                               sb.AppendFormat ("{0})", port [1]);     
-                               writer.WriteLine (sb.ToString ());
+                               writer.WriteLine (resp);
                                writer.Flush ();
 
                                str = reader.ReadLine ();
@@ -512,6 +645,11 @@ namespace MonoTests.System.Net
                class ServerPut : FtpServer {
                        public List<byte> result = new List<byte> ();
                        
+                       public ServerPut (bool ipv6)
+                               : base (ipv6)
+                       {
+                       }
+
                        protected override void Run ()
                        {
                                Socket client = control.Accept ();
@@ -529,24 +667,12 @@ namespace MonoTests.System.Net
                                }
 
                                string str = reader.ReadLine ();
-                               if (str != "PASV") {
-                                       Where = "PASV";
+                               string resp = FormatPassiveResponse (str);
+                               if (resp == null) {
                                        client.Close ();
                                        return;
                                }
-
-                               IPEndPoint end_data = (IPEndPoint) data.LocalEndPoint;
-                               byte [] addr_bytes = end_data.Address.GetAddressBytes ();
-                               byte [] port = new byte [2];
-                               port[0] = (byte) ((end_data.Port >> 8) & 255);
-                               port[1] = (byte) (end_data.Port & 255);
-                               StringBuilder sb = new StringBuilder ("227 Passive (");
-                               foreach (byte b in addr_bytes) {
-                                       sb.AppendFormat ("{0},", b);    
-                               }
-                               sb.AppendFormat ("{0},", port [0]);     
-                               sb.AppendFormat ("{0})", port [1]);     
-                               writer.WriteLine (sb.ToString ());
+                               writer.WriteLine (resp);
                                writer.Flush ();
 
                                str = reader.ReadLine ();
@@ -580,16 +706,18 @@ namespace MonoTests.System.Net
                        protected Socket control;
                        protected Socket data;
                        protected ManualResetEvent evt;
+                       protected bool ipv6;
                        public string Where = "";
 
-                       public FtpServer ()
+                       public FtpServer (bool ipv6)
                        {
-                               control = new Socket (AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
-                               control.Bind (new IPEndPoint (IPAddress.Loopback, 0));
+                               control = new Socket (ipv6 ? AddressFamily.InterNetworkV6 : AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
+                               control.Bind (new IPEndPoint (ipv6 ? IPAddress.IPv6Loopback : IPAddress.Loopback, 0));
                                control.Listen (1);
-                               data = new Socket (AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
-                               data.Bind (new IPEndPoint (IPAddress.Loopback, 0));
+                               data = new Socket (ipv6 ? AddressFamily.InterNetworkV6 : AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
+                               data.Bind (new IPEndPoint (ipv6 ? IPAddress.IPv6Loopback : IPAddress.Loopback, 0));
                                data.Listen (1);
+                               this.ipv6 = ipv6;
                        }
 
                        public void Start ()
@@ -673,7 +801,39 @@ namespace MonoTests.System.Net
                                writer.Flush ();
                                return true;
                        }
-                       
+
+                       protected string FormatPassiveResponse (string request)
+                       {
+                               if (ipv6) {
+                                       if (request != "EPSV") {
+                                               Where = "EPSV";
+                                               return null;
+                                       }
+
+                                       IPEndPoint end_data = (IPEndPoint) data.LocalEndPoint;
+                                       return String.Format ("229 Extended Passive (|||{0}|)", end_data.Port);
+                               }
+                               else {
+                                       if (request != "PASV") {
+                                               Where = "PASV";
+                                               return null;
+                                       }
+
+                                       IPEndPoint end_data = (IPEndPoint) data.LocalEndPoint;
+                                       byte [] addr_bytes = end_data.Address.GetAddressBytes ();
+                                       byte [] port = new byte [2];
+                                       port[0] = (byte) ((end_data.Port >> 8) & 255);
+                                       port[1] = (byte) (end_data.Port & 255);
+                                       StringBuilder sb = new StringBuilder ("227 Passive (");
+                                       foreach (byte b in addr_bytes) {
+                                               sb.AppendFormat ("{0},", b);    
+                                       }
+                                       sb.AppendFormat ("{0},", port [0]);     
+                                       sb.AppendFormat ("{0})", port [1]);     
+                                       return sb.ToString ();
+                               }
+                       }
+
                        public IPAddress IPAddress {
                                get { return ((IPEndPoint) control.LocalEndPoint).Address; }
                        }
index b0cedc555a4e8b34674790e2d6744c1a0e269b53..51e2990c0d18129f63dc2a748c8aa79707e1f4fa 100644 (file)
@@ -47,7 +47,6 @@ using MonoTests.Helpers;
 namespace MonoTests.System.Net {
        
        [TestFixture]
-       [Category ("RequiresBSDSockets")]
        public class HttpListener2Test {
                
                private HttpListener _listener = null;
@@ -147,6 +146,9 @@ namespace MonoTests.System.Net {
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Test1 ()
                {
                        var port = NetworkHelpers.FindFreePort ();
@@ -159,6 +161,9 @@ namespace MonoTests.System.Net {
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Test2 ()
                {
                        var port = NetworkHelpers.FindFreePort ();
@@ -171,6 +176,9 @@ namespace MonoTests.System.Net {
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Test3 ()
                {
                        StringBuilder bad = new StringBuilder ();
@@ -210,6 +218,9 @@ namespace MonoTests.System.Net {
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Test4 ()
                {
                        var port = NetworkHelpers.FindFreePort ();
@@ -222,6 +233,9 @@ namespace MonoTests.System.Net {
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Test5 ()
                {
                        var port = NetworkHelpers.FindFreePort ();
@@ -234,6 +248,9 @@ namespace MonoTests.System.Net {
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Test6 ()
                {
                        var port = NetworkHelpers.FindFreePort ();
@@ -247,6 +264,9 @@ namespace MonoTests.System.Net {
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Test7 ()
                {
                        var port = NetworkHelpers.FindFreePort ();
@@ -263,6 +283,9 @@ namespace MonoTests.System.Net {
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Test8 ()
                {
                        var port = NetworkHelpers.FindFreePort ();
@@ -280,6 +303,9 @@ namespace MonoTests.System.Net {
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Test9 ()
                {
                        var port = NetworkHelpers.FindFreePort ();
@@ -295,6 +321,9 @@ namespace MonoTests.System.Net {
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Test10 ()
                {
                        var port = NetworkHelpers.FindFreePort ();
@@ -311,6 +340,9 @@ namespace MonoTests.System.Net {
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Test11 ()
                {
                        var port = NetworkHelpers.FindFreePort ();
@@ -325,6 +357,9 @@ namespace MonoTests.System.Net {
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Test12 ()
                {
                        var port = NetworkHelpers.FindFreePort ();
@@ -339,6 +374,9 @@ namespace MonoTests.System.Net {
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Test13 ()
                {
                        var port = NetworkHelpers.FindFreePort ();
@@ -356,6 +394,9 @@ namespace MonoTests.System.Net {
                ManualResetEvent test_evt;
                bool test14_error;
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Test14 ()
                {
                        var port = NetworkHelpers.FindFreePort ();
@@ -392,6 +433,9 @@ namespace MonoTests.System.Net {
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Test15 ()
                {
                        var port = NetworkHelpers.FindFreePort ();
@@ -414,6 +458,9 @@ namespace MonoTests.System.Net {
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Test16 ()
                {
                        var port = NetworkHelpers.FindFreePort ();
@@ -438,6 +485,9 @@ namespace MonoTests.System.Net {
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Test17 ()
                {
                        var port = NetworkHelpers.FindFreePort ();
@@ -454,6 +504,9 @@ namespace MonoTests.System.Net {
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Test_MultipleClosesOnOuputStreamAllowed ()
                {
                        var port = NetworkHelpers.FindFreePort ();
@@ -484,6 +537,9 @@ namespace MonoTests.System.Net {
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void ReceiveCookiesFromClient ()
                {
                        sendCookiePort = NetworkHelpers.FindFreePort ();                        
@@ -530,6 +586,9 @@ namespace MonoTests.System.Net {
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void SendCookiestoClient ()
                {
                        receiveCookiePort = NetworkHelpers.FindFreePort ();
@@ -581,6 +640,9 @@ namespace MonoTests.System.Net {
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void MultiResponses ()
                {
                        echoServerPort = NetworkHelpers.FindFreePort ();
@@ -646,9 +708,11 @@ namespace MonoTests.System.Net {
        }
 
        [TestFixture]
-       [Category ("RequiresBSDSockets")]
        public class HttpListenerBugs {
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void TestNonChunkedAsync ()
                {
                        var port = NetworkHelpers.FindFreePort ();
@@ -703,6 +767,9 @@ namespace MonoTests.System.Net {
                // a documented pattern to close the connection
                // 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Test_MultipleConnections ()
                {
                        var port = NetworkHelpers.FindFreePort ();                      
@@ -733,6 +800,9 @@ namespace MonoTests.System.Net {
                // Test case for bug 341443, an pretty old bug, filed on November of 2007.
                //
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Test_HostInUri ()
                {
                        var wait = new ManualResetEvent (false);
@@ -762,6 +832,9 @@ namespace MonoTests.System.Net {
                }
 
                [Test] // bug #513849
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void ClosePort ()
                {
                        var port = NetworkHelpers.FindFreePort ();
@@ -785,6 +858,9 @@ namespace MonoTests.System.Net {
                // does not also listen to another interface.
                //
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void BindToSingleInterface ()
                {
                        IPAddress [] machineAddress = null;
@@ -811,6 +887,9 @@ namespace MonoTests.System.Net {
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void BindToAllInterfaces ()
                {
                        var h = new HttpListener ();
@@ -823,6 +902,9 @@ namespace MonoTests.System.Net {
 
                // Test case for bug #31209
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Test_EmptyLineAtStart ()
                {
                        var port = NetworkHelpers.FindFreePort ();
index 21589dc6c30914ebe227c22b04a99143a720457e..b09a8180eafd6593fa30a07a9878138a93727de6 100644 (file)
@@ -36,6 +36,9 @@ namespace MonoTests.System.Net {
        public class HttpListenerPrefixCollectionTest {
                // NL -> Not listening -> tests when listener.IsListening == false
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void NL_DefaultProperties ()
                {
                        HttpListener listener = new HttpListener ();
@@ -46,6 +49,9 @@ namespace MonoTests.System.Net {
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void DefaultProperties ()
                {
                        HttpListener listener = new HttpListener ();
@@ -57,7 +63,9 @@ namespace MonoTests.System.Net {
                }
 
                [Test]
-               [Category ("RequiresBSDSockets")]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void AddOne ()
                {
                        HttpListener listener = new HttpListener ();
@@ -71,7 +79,9 @@ namespace MonoTests.System.Net {
                }
 
                [Test]
-               [Category ("RequiresBSDSockets")]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Duplicate ()
                {
                        HttpListener listener = new HttpListener ();
@@ -86,6 +96,9 @@ namespace MonoTests.System.Net {
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void EndsWithSlash ()
                {
                        HttpListener listener = new HttpListener ();
@@ -93,6 +106,9 @@ namespace MonoTests.System.Net {
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void DifferentPath ()
                {
                        HttpListener listener = new HttpListener ();
@@ -102,6 +118,9 @@ namespace MonoTests.System.Net {
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void NL_Clear ()
                {
                        HttpListener listener = new HttpListener ();
@@ -110,6 +129,9 @@ namespace MonoTests.System.Net {
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void NL_Remove ()
                {
                        HttpListener listener = new HttpListener ();
@@ -118,6 +140,9 @@ namespace MonoTests.System.Net {
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void NL_RemoveBadUri ()
                {
                        HttpListener listener = new HttpListener ();
@@ -126,7 +151,11 @@ namespace MonoTests.System.Net {
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
                [ExpectedException (typeof (ArgumentException))]
+#endif
                public void NL_AddBadUri ()
                {
                        HttpListener listener = new HttpListener ();
@@ -135,7 +164,11 @@ namespace MonoTests.System.Net {
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
                [ExpectedException (typeof (ArgumentException))]
+#endif
                public void NoHostInUrl ()
                {
                        HttpListener listener = new HttpListener ();
@@ -143,6 +176,9 @@ namespace MonoTests.System.Net {
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void MultipleSlashes ()
                {
                        // this one throws on Start(), not when adding it.
@@ -156,6 +192,9 @@ namespace MonoTests.System.Net {
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void PercentSign ()
                {
                        HttpListener listener = new HttpListener ();
@@ -169,6 +208,9 @@ namespace MonoTests.System.Net {
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Disposed1 ()
                {
                        HttpListener listener = new HttpListener ();
@@ -180,7 +222,11 @@ namespace MonoTests.System.Net {
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
                [ExpectedException (typeof (ObjectDisposedException))]
+#endif
                public void Disposed2 ()
                {
                        HttpListener listener = new HttpListener ();
@@ -190,7 +236,11 @@ namespace MonoTests.System.Net {
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
                [ExpectedException (typeof (ObjectDisposedException))]
+#endif
                public void Disposed3 ()
                {
                        HttpListener listener = new HttpListener ();
@@ -200,7 +250,11 @@ namespace MonoTests.System.Net {
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
                [ExpectedException (typeof (ObjectDisposedException))]
+#endif
                public void Disposed4 ()
                {
                        HttpListener listener = new HttpListener ();
@@ -210,7 +264,11 @@ namespace MonoTests.System.Net {
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
                [ExpectedException (typeof (ObjectDisposedException))]
+#endif
                public void Disposed5 ()
                {
                        HttpListener listener = new HttpListener ();
@@ -221,6 +279,9 @@ namespace MonoTests.System.Net {
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Disposed6 ()
                {
                        HttpListener listener = new HttpListener ();
@@ -234,6 +295,9 @@ namespace MonoTests.System.Net {
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Disposed7 ()
                {
                        HttpListener listener = new HttpListener ();
index c9227fd5b39dc09c6ce53f618c084c05d56b6b7f..d782103f33e33709321e1c7f2211d2b4fccf8a90 100644 (file)
@@ -42,7 +42,6 @@ using MonoTests.Helpers;
 namespace MonoTests.System.Net
 {
        [TestFixture]
-       [Category ("RequiresBSDSockets")]
        public class HttpListenerRequestTest
        {
                [Test]
@@ -151,6 +150,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void HttpMethod ()
                {
                        var port = NetworkHelpers.FindFreePort ();
@@ -165,6 +167,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void HttpBasicAuthScheme ()
                {
                        var port = NetworkHelpers.FindFreePort ();                      
@@ -180,6 +185,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void HttpRequestUriIsNotDecoded ()
                {
                        var port = NetworkHelpers.FindFreePort ();
@@ -194,6 +202,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void HttpRequestIsLocal ()
                {
                        var port = NetworkHelpers.FindFreePort ();
@@ -221,6 +232,9 @@ namespace MonoTests.System.Net
                }
 
                [Test] // #29927
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void HttpRequestUriUnescape ()
                {
                        var prefix = "http://localhost:" + NetworkHelpers.FindFreePort () + "/";
index 8620d1ce32a9b34bd6b98f40ea9ac0805791250a..09d3cb0f3f291b649f7d12290719817cc4d51028 100644 (file)
@@ -37,17 +37,23 @@ using MonoTests.Helpers;
 
 namespace MonoTests.System.Net {
        [TestFixture]
-       [Category ("RequiresBSDSockets")]
        public class HttpListenerTest {
 
-               int port;
+               int? _port;
+               int port {
+                       get { return _port ?? (_port = NetworkHelpers.FindFreePort ()).Value; }
+               }
 
-               [SetUp]
-               public void SetUp () {
-                       port = NetworkHelpers.FindFreePort ();
+               [TearDown]
+               public void Teardown ()
+               {
+                       _port = null;
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void DefaultProperties ()
                {
                        HttpListener listener = new HttpListener ();
@@ -61,6 +67,9 @@ namespace MonoTests.System.Net {
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Start1 ()
                {
                        HttpListener listener = new HttpListener ();
@@ -68,6 +77,9 @@ namespace MonoTests.System.Net {
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Stop1 ()
                {
                        HttpListener listener = new HttpListener ();
@@ -75,7 +87,11 @@ namespace MonoTests.System.Net {
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
                [ExpectedException (typeof (InvalidOperationException))]
+#endif
                public void GetContext1 ()
                {
                        HttpListener listener = new HttpListener ();
@@ -84,7 +100,11 @@ namespace MonoTests.System.Net {
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
                [ExpectedException (typeof (InvalidOperationException))]
+#endif
                public void GetContext2 ()
                {
                        HttpListener listener = new HttpListener ();
@@ -94,7 +114,11 @@ namespace MonoTests.System.Net {
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
                [ExpectedException (typeof (InvalidOperationException))]
+#endif
                public void BeginGetContext1 ()
                {
                        HttpListener listener = new HttpListener ();
@@ -103,6 +127,9 @@ namespace MonoTests.System.Net {
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void BeginGetContext2 ()
                {
                        HttpListener listener = new HttpListener ();
@@ -135,6 +162,9 @@ namespace MonoTests.System.Net {
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void DefaultHttpPort ()
                {
                        if (!CanOpenPort (80))
@@ -148,6 +178,9 @@ namespace MonoTests.System.Net {
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void DefaultHttpsPort ()
                {
                        if (!CanOpenPort (443))
@@ -161,6 +194,9 @@ namespace MonoTests.System.Net {
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void TwoListeners_SameAddress ()
                {
                        if (!CanOpenPort (port))
@@ -174,7 +210,11 @@ namespace MonoTests.System.Net {
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
                [ExpectedException (typeof (HttpListenerException))]
+#endif
                public void TwoListeners_SameURL ()
                {
                        if (!CanOpenPort (port))
@@ -188,7 +228,11 @@ namespace MonoTests.System.Net {
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
                [ExpectedException (typeof (HttpListenerException))]
+#endif
                public void MultipleSlashes ()
                {
                        if (!CanOpenPort (port))
@@ -200,7 +244,11 @@ namespace MonoTests.System.Net {
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
                [ExpectedException (typeof (HttpListenerException))]
+#endif
                public void PercentSign ()
                {
                        if (!CanOpenPort (port))
@@ -212,6 +260,9 @@ namespace MonoTests.System.Net {
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void CloseBeforeStart ()
                {
                        HttpListener listener = new HttpListener ();
@@ -219,6 +270,9 @@ namespace MonoTests.System.Net {
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void CloseTwice ()
                {
                        if (!CanOpenPort (port))
@@ -231,6 +285,9 @@ namespace MonoTests.System.Net {
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void StartStopStart ()
                {
                        if (!CanOpenPort (port))
@@ -244,6 +301,9 @@ namespace MonoTests.System.Net {
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void StartStopDispose ()
                {
                        if (!CanOpenPort (port))
@@ -256,6 +316,9 @@ namespace MonoTests.System.Net {
                }
                
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void AbortBeforeStart ()
                {
                        HttpListener listener = new HttpListener ();
@@ -263,6 +326,9 @@ namespace MonoTests.System.Net {
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void AbortTwice ()
                {
                        if (!CanOpenPort (port))
@@ -275,6 +341,9 @@ namespace MonoTests.System.Net {
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void PropertiesWhenClosed1 ()
                {
                        HttpListener listener = new HttpListener ();
@@ -288,7 +357,11 @@ namespace MonoTests.System.Net {
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
                [ExpectedException (typeof (ObjectDisposedException))]
+#endif
                public void PropertiesWhenClosed2 ()
                {
                        HttpListener listener = new HttpListener ();
@@ -297,7 +370,11 @@ namespace MonoTests.System.Net {
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
                [ExpectedException (typeof (ObjectDisposedException))]
+#endif
                public void PropertiesWhenClosedSet1 ()
                {
                        HttpListener listener = new HttpListener ();
@@ -306,7 +383,11 @@ namespace MonoTests.System.Net {
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
                [ExpectedException (typeof (ObjectDisposedException))]
+#endif
                public void PropertiesWhenClosedSet2 ()
                {
                        HttpListener listener = new HttpListener ();
@@ -315,7 +396,11 @@ namespace MonoTests.System.Net {
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
                [ExpectedException (typeof (ObjectDisposedException))]
+#endif
                public void PropertiesWhenClosedSet3 ()
                {
                        HttpListener listener = new HttpListener ();
@@ -324,7 +409,11 @@ namespace MonoTests.System.Net {
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
                [ExpectedException (typeof (ObjectDisposedException))]
+#endif
                public void PropertiesWhenClosedSet4 ()
                {
                        HttpListener listener = new HttpListener ();
@@ -333,7 +422,11 @@ namespace MonoTests.System.Net {
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
                [ExpectedException (typeof (ObjectDisposedException))]
+#endif
                public void PropertiesWhenClosedSet5 ()
                {
                        HttpListener listener = new HttpListener ();
@@ -342,6 +435,9 @@ namespace MonoTests.System.Net {
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void PropertiesWhenClosed3 ()
                {
                        HttpListener listener = new HttpListener ();
@@ -350,6 +446,9 @@ namespace MonoTests.System.Net {
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void CloseWhileBegin ()
                {
                        HttpListener listener = new HttpListener ();
@@ -366,6 +465,9 @@ namespace MonoTests.System.Net {
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void AbortWhileBegin ()
                {
                        HttpListener listener = new HttpListener ();
@@ -382,7 +484,11 @@ namespace MonoTests.System.Net {
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
                [ExpectedException (typeof (HttpListenerException))]
+#endif
                public void CloseWhileGet ()
                {
                        // "System.Net.HttpListener Exception : The I/O operation has been aborted
@@ -399,7 +505,11 @@ namespace MonoTests.System.Net {
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
                [ExpectedException (typeof (HttpListenerException))]
+#endif
                public void AbortWhileGet ()
                {
                        // "System.Net.HttpListener Exception : The I/O operation has been aborted
@@ -479,6 +589,9 @@ namespace MonoTests.System.Net {
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void ConnectionReuse ()
                {
                        var uri = "http://localhost:" + NetworkHelpers.FindFreePort () + "/";
@@ -534,8 +647,41 @@ namespace MonoTests.System.Net {
 
                        return clientEndPoint;
                }
+
+               [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
+               public void UserHeaderWithDoubleMultiValue ()
+               {
+                       string uri = "http://localhost:" + NetworkHelpers.FindFreePort () + "/";
+
+                       var l = new HttpListener ();
+                       l.Prefixes.Add (uri);
+                       l.Start ();
+                       l.BeginGetContext (ar => {
+                               var ctx = l.EndGetContext (ar);
+
+                               var response = ctx.Response;
+                               response.Headers.Add ("X-Custom-Header", "A");
+                               response.Headers.Add ("X-Custom-Header", "B");
+
+                               response.Close ();
+                       }, null);
+
+                       HttpWebRequest wr = HttpWebRequest.CreateHttp (uri);
+                       var resp = wr.GetResponse ();
+                       var vls = resp.Headers.GetValues ("X-Custom-Header");
+
+                       Assert.AreEqual (2, vls.Length);
+
+                       l.Close ();
+               }
                
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void HttpClientIsDisconnectedCheckForWriteException()
                {
                        string uri = "http://localhost:" + NetworkHelpers.FindFreePort () + "/";
index b7097b5db56a7e930149f96f641b3df8997559a1..a597b4cd0a240dd08b9f9f2e1722d4a28bcc6754 100644 (file)
@@ -36,7 +36,6 @@ using MonoTests.Helpers;
 namespace MonoTests.System.Net
 {
        [TestFixture]
-       [Category ("RequiresBSDSockets")]
        public class HttpWebRequestTest
        {
                private Random rand = new Random ();
@@ -45,11 +44,16 @@ namespace MonoTests.System.Net
                [TestFixtureSetUp]
                public void Setup ()
                {
+#if !FEATURE_NO_BSD_SOCKETS
                                ServicePointManager.Expect100Continue = false;
+#endif
                                rand.NextBytes (data64KB);
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Proxy_Null ()
                {
                        HttpWebRequest req = (HttpWebRequest) WebRequest.Create ("http://www.google.com");
@@ -60,6 +64,9 @@ namespace MonoTests.System.Net
 
                [Test]
                [Category("InetAccess")]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Sync ()
                {
                        HttpWebRequest req = (HttpWebRequest) WebRequest.Create ("http://www.google.com");
@@ -81,6 +88,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void AddRange ()
                {
                        HttpWebRequest req = (HttpWebRequest) WebRequest.Create ("http://www.google.com");
@@ -96,6 +106,9 @@ namespace MonoTests.System.Net
                }
 
                [Test] // bug #471782
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void CloseRequestStreamAfterReadingResponse ()
                {
                        IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
@@ -182,6 +195,9 @@ namespace MonoTests.System.Net
                }
 #endif
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Missing_ContentEncoding ()
                {
                        ServicePointManager.CertificatePolicy = new AcceptAllPolicy ();
@@ -204,6 +220,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void BadServer_ChunkedClose ()
                {
                        // The server will send a chunked response without a 'last-chunked' mark
@@ -269,6 +288,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void BeginGetRequestStream_Body_NotAllowed ()
                {
                        IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
@@ -306,6 +328,9 @@ namespace MonoTests.System.Net
                }
 
                [Test] // bug #465613
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void BeginGetRequestStream_NoBuffering ()
                {
                        IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
@@ -455,6 +480,9 @@ namespace MonoTests.System.Net
                }
 
                [Test] // bug #511851
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void BeginGetRequestStream_Request_Aborted ()
                {
                        IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
@@ -480,6 +508,9 @@ namespace MonoTests.System.Net
                }
 
                [Test] // bug #511851
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void BeginGetResponse_Request_Aborted ()
                {
                        IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
@@ -505,6 +536,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void EndGetRequestStream_AsyncResult_Null ()
                {
                        IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
@@ -583,6 +617,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void EndGetResponse_AsyncResult_Null ()
                {
                        IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
@@ -614,6 +651,9 @@ namespace MonoTests.System.Net
                }
 
                [Test] // bug #429200
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void GetRequestStream ()
                {
                        IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
@@ -636,6 +676,9 @@ namespace MonoTests.System.Net
                }
 
                [Test] // bug #511851
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void GetRequestStream_Request_Aborted ()
                {
                        IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
@@ -931,6 +974,9 @@ namespace MonoTests.System.Net
                }
 
                [Test] // bug #511851
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void GetResponse_Request_Aborted ()
                {
                        IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
@@ -987,6 +1033,9 @@ namespace MonoTests.System.Net
                }
 
                [Test] // bug #324300
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void AllowAutoRedirect ()
                {
                        IPEndPoint localEP = NetworkHelpers.LocalEphemeralEndPoint ();
@@ -1033,6 +1082,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void PostAndRedirect_NoCL ()
                {
                        IPEndPoint localEP = NetworkHelpers.LocalEphemeralEndPoint ();
@@ -1061,6 +1113,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void PostAndRedirect_CL ()
                {
                        IPEndPoint localEP = NetworkHelpers.LocalEphemeralEndPoint ();
@@ -1089,6 +1144,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void PostAnd401 ()
                {
                        IPEndPoint localEP = NetworkHelpers.LocalEphemeralEndPoint ();
@@ -1250,6 +1308,9 @@ namespace MonoTests.System.Net
                }
 
                [Test] // bug #513087
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void NonStandardVerb ()
                {
                        IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
@@ -1361,11 +1422,11 @@ namespace MonoTests.System.Net
 
                        internal void LaunchWebRequest ()
                        {
-                               var req = (HttpWebRequest) WebRequest.Create (url_to_test);
-                               req.Timeout = TimeOutInMilliSeconds;
-
-                               Start = DateTime.Now;
                                try {
+                                       var req = (HttpWebRequest) WebRequest.Create (url_to_test);
+                                       req.Timeout = TimeOutInMilliSeconds;
+
+                                       Start = DateTime.Now;
                                        using (var resp = (HttpWebResponse) req.GetResponse ())
                                        {
                                                var sr = new StreamReader (resp.GetResponseStream (), Encoding.UTF8);
@@ -1416,6 +1477,9 @@ namespace MonoTests.System.Net
                }
 
                [Test] // 1st possible case of https://bugzilla.novell.com/show_bug.cgi?id=MONO74177
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void TestTimeoutPropertyWithServerThatExistsAndRespondsButTooLate ()
                {
                        var ep = NetworkHelpers.LocalEphemeralEndPoint ();
@@ -1428,6 +1492,7 @@ namespace MonoTests.System.Net
                }
 
                [Test] // 2nd possible case of https://bugzilla.novell.com/show_bug.cgi?id=MONO74177
+               [Category ("RequiresBSDSockets")] // Requires some test refactoring to assert that a PlatformNotSupportedException is thrown, so don't bother (there's plenty of other tests asserting the PlatformNotSupported exceptions).
                public void TestTimeoutWithEndpointThatDoesntExistThrowsConnectFailureBeforeTimeout ()
                {
                        string url = "http://127.0.0.1:8271/"; // some endpoint that is unlikely to exist
@@ -1682,6 +1747,9 @@ namespace MonoTests.System.Net
                        return Encoding.UTF8.GetBytes (sw.ToString ());
                }
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void NtlmAuthentication ()
                {
                        NtlmServer server = new NtlmServer ();
@@ -1824,6 +1892,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void BeginGetRequestStream ()
                {
                        this.DoRequest (
@@ -1842,6 +1913,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void BeginGetRequestStreamNoClose ()
                {
                        this.DoRequest (
@@ -1859,6 +1933,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void BeginGetRequestStreamCancelIfNotAllBytesWritten ()
                {
                        this.DoRequest (
@@ -1883,6 +1960,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void GetRequestStream2 ()
                {
                        this.DoRequest (
@@ -1899,6 +1979,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void GetRequestStreamNotAllBytesWritten ()
                {
                        this.DoRequest (
@@ -1914,6 +1997,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void GetRequestStreamTimeout ()
                {
                        this.DoRequest (
@@ -1929,6 +2015,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void BeginWrite ()
                {
                        byte[] received = new byte[data64KB.Length];
@@ -1961,6 +2050,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void BeginWriteAfterAbort ()
                {
                        byte [] received = new byte [data64KB.Length];
@@ -1988,6 +2080,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void PrematureStreamCloseAborts ()
                {
                        byte [] received = new byte [data64KB.Length];
@@ -2015,6 +2110,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Write ()
                {
                        byte [] received = new byte [data64KB.Length];
@@ -2086,6 +2184,9 @@ namespace MonoTests.System.Net
                **/
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Read ()
                {
                        byte [] received = new byte [data64KB.Length];
@@ -2113,6 +2214,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void ReadTimeout2 ()
                {
                        byte [] received = new byte [data64KB.Length];
@@ -2142,6 +2246,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void ReadServerAborted ()
                {
                        byte [] received = new byte [data64KB.Length];
@@ -2166,6 +2273,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void BeginGetResponse2 ()
                {
                        byte [] received = new byte [data64KB.Length];
@@ -2196,6 +2306,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void BeginGetResponseAborts ()
                {
                        ManualResetEvent aborted = new ManualResetEvent(false);
@@ -2226,6 +2339,9 @@ namespace MonoTests.System.Net
                }
                
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void TestLargeDataReading ()
                {
                        int near2GBStartPosition = rand.Next (int.MaxValue - 500, int.MaxValue);
@@ -2323,7 +2439,11 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
                [ExpectedException (typeof (ArgumentNullException))]
+#endif
                public void NullHost ()
                {
                        HttpWebRequest req = (HttpWebRequest) WebRequest.Create ("http://go-mono.com");
@@ -2331,6 +2451,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void NoHost ()
                {
                        HttpWebRequest req = (HttpWebRequest) WebRequest.Create ("http://go-mono.com");
@@ -2338,7 +2461,11 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
                [ExpectedException (typeof (ArgumentException))]
+#endif
                public void EmptyHost ()
                {
                        HttpWebRequest req = (HttpWebRequest) WebRequest.Create ("http://go-mono.com");
@@ -2346,6 +2473,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void HostAndPort ()
                {
                        HttpWebRequest req = (HttpWebRequest) WebRequest.Create ("http://go-mono.com:80");
@@ -2355,6 +2485,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void PortRange ()
                {
                        for (int i = 0; i < 65536; i++) {
@@ -2367,7 +2500,11 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
                [ExpectedException (typeof (ArgumentException))]
+#endif
                public void PortBelow ()
                {
                        HttpWebRequest req = (HttpWebRequest) WebRequest.Create ("http://go-mono.com");
@@ -2375,7 +2512,11 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
                [ExpectedException (typeof (ArgumentException))]
+#endif
                public void PortAbove ()
                {
                        HttpWebRequest req = (HttpWebRequest) WebRequest.Create ("http://go-mono.com");
@@ -2383,7 +2524,11 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
                [ExpectedException (typeof (ArgumentException))]
+#endif
                public void HostTooLong ()
                {
                        HttpWebRequest req = (HttpWebRequest) WebRequest.Create ("http://go-mono.com");
@@ -2403,6 +2548,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void NoDate ()
                {
                        HttpWebRequest req = (HttpWebRequest) WebRequest.Create ("http://go-mono.com");
@@ -2410,6 +2558,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void UtcDate ()
                {
                        HttpWebRequest req = (HttpWebRequest) WebRequest.Create ("http://go-mono.com");
@@ -2419,6 +2570,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void AddAndRemoveDate ()
                {
                        // Neil Armstrong set his foot on Moon
@@ -2452,6 +2606,9 @@ namespace MonoTests.System.Net
                }
                
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                // Bug #12393
                public void TestIPv6Host ()
                {
@@ -2482,8 +2639,10 @@ namespace MonoTests.System.Net
                        }
                }
 
-#if NET_4_5
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void AllowReadStreamBuffering ()
                {
                        var hr = WebRequest.CreateHttp ("http://www.google.com");
@@ -2494,7 +2653,6 @@ namespace MonoTests.System.Net
                        } catch (InvalidOperationException) {
                        }
                }
-#endif
 
                class ListenerScope : IDisposable {
                        EventWaitHandle completed;
@@ -2682,6 +2840,9 @@ namespace MonoTests.System.Net
 #endif
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void CookieContainerTest ()
                {
                        IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
@@ -2763,10 +2924,12 @@ namespace MonoTests.System.Net
        }
 
        [TestFixture]
-       [Category ("RequiresBSDSockets")]
        public class HttpRequestStreamTest
        {
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void BeginRead ()
                {
                        IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
@@ -2822,6 +2985,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void CanRead ()
                {
                        IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
@@ -2844,6 +3010,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void CanSeek ()
                {
                        IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
@@ -2866,6 +3035,9 @@ namespace MonoTests.System.Net
                }
 
                [Test] // bug #324182
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void CanTimeout ()
                {
                        IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
@@ -2888,6 +3060,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void CanWrite ()
                {
                        IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
@@ -2910,6 +3085,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Read ()
                {
                        IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
@@ -2937,6 +3115,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void ReadByte ()
                {
                        IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
@@ -2963,6 +3144,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void ReadTimeout ()
                {
                        IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
@@ -2985,6 +3169,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Seek ()
                {
                        IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
@@ -3011,6 +3198,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Write_Buffer_Null ()
                {
                        IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
@@ -3037,6 +3227,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Write_Count_Negative ()
                {
                        IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
@@ -3065,6 +3258,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Write_Count_Overflow ()
                {
                        IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
@@ -3093,6 +3289,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Write_Offset_Negative ()
                {
                        IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
@@ -3121,6 +3320,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Write_Offset_Overflow ()
                {
                        IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
@@ -3149,6 +3351,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Write_Request_Aborted ()
                {
                        IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
@@ -3204,6 +3409,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void WriteByte_Request_Aborted ()
                {
                        IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
@@ -3231,6 +3439,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void WriteTimeout ()
                {
                        IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
@@ -3253,6 +3464,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                // Bug6737
                // This test is supposed to fail prior to .NET 4.0
                public void Post_EmptyRequestStream ()
index 10d7d807444ce7527e56c73b601788be68f08664..b2c8e90488c059be03460d907142b53827d3a03f 100644 (file)
@@ -21,10 +21,12 @@ using NUnit.Framework;
 namespace MonoTests.System.Net
 {
        [TestFixture]
-       [Category ("RequiresBSDSockets")]
        public class HttpWebResponseTest
        {
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void CharacterSet_Disposed ()
                {
                        IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
@@ -53,6 +55,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Close_Disposed ()
                {
                        IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
@@ -72,6 +77,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void ContentEncoding_Disposed ()
                {
                        IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
@@ -100,6 +108,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void ContentLength_Disposed ()
                {
                        IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
@@ -120,6 +131,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void ContentType_Disposed ()
                {
                        IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
@@ -148,6 +162,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Cookies_Disposed ()
                {
                        IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
@@ -186,6 +203,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void GetResponseHeader_Disposed ()
                {
                        IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
@@ -214,6 +234,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void GetResponseStream_Disposed ()
                {
                        IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
@@ -242,6 +265,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Headers_Disposed ()
                {
                        IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
@@ -269,6 +295,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void LastModified_Disposed ()
                {
                        IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
@@ -297,6 +326,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Method_Disposed ()
                {
                        IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
@@ -325,6 +357,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void ProtocolVersion_Disposed ()
                {
                        IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
@@ -353,6 +388,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void ResponseUri_Disposed ()
                {
                        IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
@@ -381,6 +419,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Server_Disposed ()
                {
                        IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
@@ -409,6 +450,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void StatusCode_Disposed ()
                {
                        IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
@@ -429,6 +473,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void StatusDescription_Disposed ()
                {
                        IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
@@ -477,10 +524,12 @@ namespace MonoTests.System.Net
        }
 
        [TestFixture]
-       [Category ("RequiresBSDSockets")]
        public class HttpResponseStreamTest
        {
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void BeginRead_Buffer_Null ()
                {
                        IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
@@ -530,6 +579,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void BeginWrite ()
                {
                        IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
@@ -590,6 +642,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void CanSeek ()
                {
                        IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
@@ -617,6 +672,9 @@ namespace MonoTests.System.Net
                }
 
                [Test] // bug #324182
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void CanTimeout ()
                {
                        IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
@@ -644,6 +702,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void CanWrite ()
                {
                        IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
@@ -671,6 +732,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Read ()
                {
                        IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
@@ -708,6 +772,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Read_Buffer_Null ()
                {
                        IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
@@ -757,6 +824,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Read_Count_Negative ()
                {
                        IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
@@ -807,6 +877,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Read_Count_Overflow ()
                {
                        IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
@@ -857,6 +930,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Read_Offset_Negative ()
                {
                        IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
@@ -907,6 +983,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Read_Offset_Overflow ()
                {
                        IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
@@ -1021,6 +1100,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void ReadTimeout ()
                {
                        IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
@@ -1048,6 +1130,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void Write ()
                {
                        IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
@@ -1080,6 +1165,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void WriteTimeout ()
                {
                        IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
index dbe3255cd6893121155b8f82242724cb8090805f..e5c46f8f901638ac860e8c8824a69e9327f8253e 100644 (file)
@@ -28,6 +28,7 @@
 
 using System;
 using System.Net;
+using System.Security;
 
 using NUnit.Framework;
 
@@ -99,6 +100,21 @@ namespace MonoTests.System.Net {
                        nc = new NetworkCredential ("user", "********", "dom");
                        CheckCustom (nc);
                }
+
+               [Test]
+               public void DecipherSecureString ()
+               {
+                       // many code snippets suggest using the following to get the decrypted string from a SecureString
+                       var ss = new SecureString ();
+                       ss.AppendChar('h');
+                       ss.AppendChar('e');
+                       ss.AppendChar('l');
+                       ss.AppendChar('l');
+                       ss.AppendChar('o');
+                       string plain = new NetworkCredential (string.Empty, ss).Password;
+                       Assert.AreEqual ("hello", plain);
+               }
        }
 }
 
index 6f763923cbfd927440b42f597b707778c5809f0a..c252d21b189bcd75d3c8b9cb2e94f621208fc838 100644 (file)
@@ -29,8 +29,10 @@ public class ServicePointManagerTest
        [SetUp]\r
         public void GetReady () \r
        {\r
+#if !FEATURE_NO_BSD_SOCKETS\r
                maxIdle = ServicePointManager.MaxServicePointIdleTime;\r
                ServicePointManager.MaxServicePointIdleTime = 10;\r
+#endif\r
                googleUri = new Uri ("http://www.google.com");\r
                yahooUri = new Uri ("http://www.yahoo.com");\r
                apacheUri = new Uri ("http://www.apache.org");\r
@@ -39,7 +41,9 @@ public class ServicePointManagerTest
        [TearDown]\r
        public void Finish ()\r
        {\r
+#if !FEATURE_NO_BSD_SOCKETS\r
                ServicePointManager.MaxServicePointIdleTime = maxIdle;\r
+#endif\r
        }\r
 \r
         [Test, ExpectedException (typeof (InvalidOperationException))]\r
@@ -82,12 +86,15 @@ public class ServicePointManagerTest
        }\r
        \r
         [Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+       [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
        public void FindServicePoint ()\r
        {\r
                ServicePointManager.MaxServicePoints = 0;\r
                ServicePoint sp = ServicePointManager.FindServicePoint (googleUri, new WebProxy (apacheUri));\r
                Assert.AreEqual (apacheUri, sp.Address, "#1");\r
-#if NET_2_1 && !MONODROID\r
+#if MOBILE\r
                Assert.AreEqual (10, sp.ConnectionLimit, "#2");\r
 #else\r
                Assert.AreEqual (2, sp.ConnectionLimit, "#2");\r
index 346f35bdeacd358202f49bad9a130cef91bd0066..6171a2fd25587d85a535b496111aa114628536e0 100644 (file)
@@ -13,7 +13,7 @@ using System;
 using System.Collections;\r
 using System.IO;\r
 using System.Net;\r
-using System.Reflection;
+using System.Reflection;\r
 using System.Threading;\r
 \r
 namespace MonoTests.System.Net\r
@@ -23,6 +23,8 @@ namespace MonoTests.System.Net
 public class ServicePointTest\r
 {\r
        static private int max;\r
+\r
+#if !FEATURE_NO_BSD_SOCKETS\r
        [SetUp]\r
        public void SaveMax () {\r
                max = ServicePointManager.MaxServicePoints;\r
@@ -33,6 +35,7 @@ public class ServicePointTest
        public void RestoreMax () {\r
                ServicePointManager.MaxServicePoints = max;\r
        }\r
+#endif\r
 \r
         [Test]\r
                [Category ("InetAccess")]\r
@@ -54,13 +57,13 @@ public class ServicePointTest
                HttpWebRequest req = (HttpWebRequest) WebRequest.Create ("http://www.google.com");\r
                HttpWebResponse res = (HttpWebResponse) req.GetResponse ();                     \r
                \r
-#if FOUND_SOME_OTHER_URL
-               // URL is no longer found, disabled the test until a more reliable URL is found :P
+#if FOUND_SOME_OTHER_URL\r
+               // URL is no longer found, disabled the test until a more reliable URL is found :P\r
                //WriteServicePoint ("google after getting a response", google);\r
                ServicePoint google2 = ServicePointManager.FindServicePoint (new Uri ("http://www.google.com/dilbert.html"));\r
                Assert.AreEqual (google, google2, "#equals");\r
                res.Close ();\r
-#endif
+#endif\r
                \r
                // in both instances property CurrentConnections is 0 according to ms.net.\r
                // let's see what it says when we do async operations...\r
@@ -87,8 +90,8 @@ public class ServicePointTest
                //Console.WriteLine ("ContentLength: " + res2.ContentLength);\r
                res2.Close ();\r
                \r
-               ServicePoint sp2;
-#if FOUND_SOME_OTHER_URL
+               ServicePoint sp2;\r
+#if FOUND_SOME_OTHER_URL\r
                // unless of course some buffering is taking place.. let's check\r
                Uri uri2 = new Uri ("http://freedesktop.org/Software/pkgconfig/releases/pkgconfig-0.15.0.tar.gz");\r
                sp2 = ServicePointManager.FindServicePoint (uri2);\r
@@ -102,7 +105,7 @@ public class ServicePointTest
                // and so it shows\r
                //Console.WriteLine ("ContentLength: " + res2.ContentLength);\r
                res2.Close ();\r
-#endif
+#endif\r
                \r
                \r
                // what's the limit of the cache?\r
@@ -154,7 +157,7 @@ public class ServicePointTest
 \r
        [Test]\r
        [Category ("InetAccess")]\r
-       [Category ("AndroidNotWorking")] // #A1 fails
+       [Category ("AndroidNotWorking")] // #A1 fails\r
        public void EndPointBind ()\r
        {\r
                Uri uri = new Uri ("http://www.go-mono.com/");\r
@@ -189,6 +192,10 @@ public class ServicePointTest
        }\r
 \r
        [Test] //Covers #19823\r
+#if FEATURE_NO_BSD_SOCKETS\r
+       // This test uses HttpWebRequest\r
+       [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
        public void CloseConnectionGroupConcurency ()\r
        {\r
                // Try with multiple service points\r
@@ -206,36 +213,37 @@ public class ServicePointTest
                }\r
        }\r
 \r
-
-       [Test]
-       public void DnsRefreshTimeout ()
-       {
-               const int dnsRefreshTimeout = 2000;
-
-               ServicePoint sp;
-               IPHostEntry host0, host1, host2;
-               Uri uri;
-               PropertyInfo hostEntryProperty;
-
-               ServicePointManager.DnsRefreshTimeout = dnsRefreshTimeout;
-
-               uri = new Uri ("http://localhost/");
-               sp = ServicePointManager.FindServicePoint (uri);
-
-               hostEntryProperty = typeof (ServicePoint).GetProperty ("HostEntry", BindingFlags.NonPublic | BindingFlags.Instance);
-
-               host0 = hostEntryProperty.GetValue (sp, null) as IPHostEntry;
-               host1 = hostEntryProperty.GetValue (sp, null) as IPHostEntry;
-
-               Assert.AreSame (host0, host1, "HostEntry should result in the same IPHostEntry object.");
-
-               Thread.Sleep (dnsRefreshTimeout * 2);
-               host2 = hostEntryProperty.GetValue (sp, null) as IPHostEntry;
-
-               Assert.AreNotSame(host0, host2, "HostEntry should result in a new IPHostEntry " +
-                               "object when DnsRefreshTimeout is reached.");
-       }
-
+\r
+       [Test]\r
+       [Category ("RequiresBSDSockets")] // Tests internals, so it doesn't make sense to assert that PlatformNotSupportedExceptions are thrown.\r
+       public void DnsRefreshTimeout ()\r
+       {\r
+               const int dnsRefreshTimeout = 2000;\r
+\r
+               ServicePoint sp;\r
+               IPHostEntry host0, host1, host2;\r
+               Uri uri;\r
+               PropertyInfo hostEntryProperty;\r
+\r
+               ServicePointManager.DnsRefreshTimeout = dnsRefreshTimeout;\r
+\r
+               uri = new Uri ("http://localhost/");\r
+               sp = ServicePointManager.FindServicePoint (uri);\r
+\r
+               hostEntryProperty = typeof (ServicePoint).GetProperty ("HostEntry", BindingFlags.NonPublic | BindingFlags.Instance);\r
+\r
+               host0 = hostEntryProperty.GetValue (sp, null) as IPHostEntry;\r
+               host1 = hostEntryProperty.GetValue (sp, null) as IPHostEntry;\r
+\r
+               Assert.AreSame (host0, host1, "HostEntry should result in the same IPHostEntry object.");\r
+\r
+               Thread.Sleep (dnsRefreshTimeout * 2);\r
+               host2 = hostEntryProperty.GetValue (sp, null) as IPHostEntry;\r
+\r
+               Assert.AreNotSame(host0, host2, "HostEntry should result in a new IPHostEntry " +\r
+                               "object when DnsRefreshTimeout is reached.");\r
+       }\r
+\r
 // Debug code not used now, but could be useful later\r
 /*\r
        private void WriteServicePoint (string label, ServicePoint sp)\r
index 9eb5877052ea3430303a703c1219ad5f73f81d1e..d1f3180a2262510893243deb3f543919d6fe35b0 100644 (file)
@@ -21,7 +21,6 @@ using MonoTests.Helpers;
 namespace MonoTests.System.Net
 {
        [TestFixture]
-       [Category ("RequiresBSDSockets")]
        public class WebClientTest
        {
                private string _tempFolder;
@@ -439,6 +438,17 @@ namespace MonoTests.System.Net
                        }
                }
 
+               [Test]
+               public void OpenReadTaskAsyncOnFile ()
+               {
+                       var tmp = Path.GetTempFileName ();
+                       string url = "file://" + tmp;
+
+                       var client = new WebClient ();
+                       var task = client.OpenReadTaskAsync (url);
+                       Assert.IsTrue (task.Wait (2000));
+               }
+
                [Test] // OpenWrite (string)
                public void OpenWrite1_Address_Null ()
                {
@@ -1419,6 +1429,9 @@ namespace MonoTests.System.Net
 
                [Test]
                [Category ("AndroidNotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void UploadValues1 ()
                {
                        IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
@@ -1669,6 +1682,10 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               // We throw a PlatformNotSupportedException deeper, which is caught and re-thrown as WebException
+               [ExpectedException (typeof (WebException))]
+#endif
                public void GetWebRequestOverriding ()
                {
                        GetWebRequestOverridingTestClass testObject = new GetWebRequestOverridingTestClass ();
@@ -1772,6 +1789,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void DefaultProxy ()
                {
                        WebClient wc = new WebClient ();
@@ -1781,9 +1801,11 @@ namespace MonoTests.System.Net
                        Assert.AreSame (wc.Proxy, WebRequest.DefaultWebProxy);
                }
                 
-#if NET_4_5
                [Test]
                [Category ("AndroidNotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void UploadStringAsyncCancelEvent ()
                {
                        UploadAsyncCancelEventTest (9301, (webClient, uri, cancelEvent) =>
@@ -1801,6 +1823,9 @@ namespace MonoTests.System.Net
 
                [Test]
                [Category ("AndroidNotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void UploadDataAsyncCancelEvent ()
                {
                        UploadAsyncCancelEventTest (9302, (webClient, uri, cancelEvent) =>
@@ -1817,6 +1842,9 @@ namespace MonoTests.System.Net
                
                [Test]
                [Category ("AndroidNotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void UploadValuesAsyncCancelEvent ()
                {
                        UploadAsyncCancelEventTest (9303, (webClient, uri, cancelEvent) =>
@@ -1833,6 +1861,9 @@ namespace MonoTests.System.Net
 
                [Test]
                [Category ("AndroidNotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void UploadFileAsyncCancelEvent ()
                {
                        UploadAsyncCancelEventTest (9304,(webClient, uri, cancelEvent) =>
@@ -1852,6 +1883,9 @@ namespace MonoTests.System.Net
 
                [Test]
                [Category ("AndroidNotWorking")] // Test suite hangs if the tests runs as part of the entire BCL suite. Works when only this fixture is ran
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void UploadFileAsyncContentType ()
                {
                        var port = NetworkHelpers.FindFreePort ();
@@ -1873,7 +1907,6 @@ namespace MonoTests.System.Net
                        }
                        listener.Close ();
                }
-#endif
 
                public void UploadAsyncCancelEventTest (int port, Action<WebClient, Uri, EventWaitHandle> uploadAction)
                {
index aabaceb9f4a73cd4ce970c74d02e27f938686035..0b404581899f7cdd81bb2421c0ac1f5e537a022d 100644 (file)
@@ -26,7 +26,6 @@
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
-#if NET_4_5
 using System;
 using System.IO;
 using System.Collections.Generic;
@@ -276,4 +275,3 @@ namespace MonoTests.System.Net
                }
        }
 }
-#endif
index 1e21e43dc211db035e6e52457c7bb46e0e1e1a5a..c2bdeba6ab2575f999a524d17b242c27e93e2cfd 100644 (file)
@@ -124,6 +124,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void AddRestricted ()
                {
                        col = CreateRestrictedHeaders ();
@@ -236,6 +239,9 @@ namespace MonoTests.System.Net
                }
 
                [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
                public void RemoveRestricted ()
                {
                        col = CreateRestrictedHeaders ();
index 34ce1a370a1d4ed737bfe721ce2d4e03104c27b0..074c97d6982dcc787a0b3d64df4676c298bd9141 100644 (file)
 //\r
 \r
 using NUnit.Framework;\r
-using MonoTests.Helpers;
+using MonoTests.Helpers;\r
 using System;\r
 using System.Net;\r
-using System.Threading;
+using System.Threading;\r
 using System.Collections;\r
 using System.Runtime.Serialization;\r
 using Socks = System.Net.Sockets;\r
@@ -193,6 +193,9 @@ namespace MonoTests.System.Net {
                }\r
 \r
        [Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+       [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
        public void All ()\r
        {\r
                WebRequest req = WebRequest.Create ("http://www.contoso.com");\r
@@ -264,6 +267,9 @@ namespace MonoTests.System.Net {
        }\r
 \r
        [Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+       [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
        public void DefaultWebProxy ()\r
        {\r
                WebProxy proxy = new WebProxy ("proxy.intern.com", 83);\r
@@ -318,14 +324,18 @@ namespace MonoTests.System.Net {
        }\r
 \r
        [Test] //BNC#323452\r
-       // Throws exception with Status == Timeout. The same code behaves as the test expects when run from a regular app.
-       // Might be an issue with the test suite. To investigate.
-       [Category("AndroidNotWorking")] 
+       // Throws exception with Status == Timeout. The same code behaves as the test expects when run from a regular app.\r
+       // Might be an issue with the test suite. To investigate.\r
+       [Category("AndroidNotWorking")] \r
        public void TestFailedConnection ()\r
        {\r
                try {\r
                        WebRequest.Create ("http://127.0.0.1:0/non-existant.txt").GetResponse ();\r
                        Assert.Fail ("Should have raised an exception");\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               } catch (PlatformNotSupportedException) {\r
+                       // Expected\r
+#endif\r
                } catch (Exception e) {\r
                        Assert.IsTrue (e is WebException, "Got " + e.GetType ().Name + ": " + e.Message);\r
                        //#if NET_2_0 e.Message == "Unable to connect to the remote server"\r
@@ -342,7 +352,7 @@ namespace MonoTests.System.Net {
        }\r
 \r
        [Test] //BNC#323452\r
-       [Category ("AndroidNotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran
+       [Category ("AndroidNotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran\r
        public void TestFailedResolution ()\r
        {\r
                try {\r
@@ -359,6 +369,10 @@ namespace MonoTests.System.Net {
                                Assert.Ignore ("Misbehaving DNS server.");\r
 \r
                        Assert.Fail ("Should have raised an exception");\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               } catch (PlatformNotSupportedException) {\r
+                       // Expected\r
+#endif\r
                } catch (Exception e) {\r
                        Assert.IsTrue (e is WebException);\r
                        //#if NET_2_0 e.Message == "The underlying connection was closed: The remote name could not be resolved."\r
@@ -412,53 +426,55 @@ namespace MonoTests.System.Net {
        {\r
                internal TestWebRequest3 () { }\r
        }\r
-
-       [Test] // Covers #41477
-       [Category ("RequiresBSDSockets")]
-       public void TestReceiveCancelation ()
-       {
-               var uri = "http://localhost:" + NetworkHelpers.FindFreePort () + "/";
-
-               HttpListener listener = new HttpListener ();
-               listener.Prefixes.Add (uri);
-               listener.Start ();
-
-               try {
-                       for (var i = 0; i < 10; i++) {
-                               var request = WebRequest.CreateHttp (uri);
-                               request.Method = "GET";
-
-                               var tokenSource = new CancellationTokenSource ();
-                               tokenSource.Token.Register(() => request.Abort ());
-
-                               var responseTask = request.GetResponseAsync ();
-
-                               var context = listener.GetContext ();
-                               byte[] outBuffer = new byte[8 * 1024];
-                               context.Response.OutputStream.WriteAsync (outBuffer, 0, outBuffer.Length);
-
-                               Assert.IsTrue (responseTask.Wait (1000), "Timeout #1");
-
-                               WebResponse response = responseTask.Result;
-                               var stream = response.GetResponseStream ();
-
-                               byte[] buffer = new byte[8 * 1024];
-                               var taskRead = stream.ReadAsync (buffer, 0, buffer.Length, tokenSource.Token);
-
-                               tokenSource.Cancel ();
-
-                               Assert.IsTrue (taskRead.Wait (1000), "Timeout #2");
-
-                               var byteRead = taskRead.Result;
-                       }
-               } catch (AggregateException ex) {
-                       var webEx = ex.InnerException as WebException;
-                       Assert.IsNotNull(webEx, "Inner exception is not a WebException");
-                       Assert.AreEqual (webEx.Status, WebExceptionStatus.RequestCanceled);
-               }
-
-               listener.Close ();
-       }
+\r
+       [Test] // Covers #41477\r
+#if FEATURE_NO_BSD_SOCKETS\r
+       [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
+       public void TestReceiveCancelation ()\r
+       {\r
+               var uri = "http://localhost:" + NetworkHelpers.FindFreePort () + "/";\r
+\r
+               HttpListener listener = new HttpListener ();\r
+               listener.Prefixes.Add (uri);\r
+               listener.Start ();\r
+\r
+               try {\r
+                       for (var i = 0; i < 10; i++) {\r
+                               var request = WebRequest.CreateHttp (uri);\r
+                               request.Method = "GET";\r
+\r
+                               var tokenSource = new CancellationTokenSource ();\r
+                               tokenSource.Token.Register(() => request.Abort ());\r
+\r
+                               var responseTask = request.GetResponseAsync ();\r
+\r
+                               var context = listener.GetContext ();\r
+                               byte[] outBuffer = new byte[8 * 1024];\r
+                               context.Response.OutputStream.WriteAsync (outBuffer, 0, outBuffer.Length);\r
+\r
+                               Assert.IsTrue (responseTask.Wait (1000), "Timeout #1");\r
+\r
+                               WebResponse response = responseTask.Result;\r
+                               var stream = response.GetResponseStream ();\r
+\r
+                               byte[] buffer = new byte[8 * 1024];\r
+                               var taskRead = stream.ReadAsync (buffer, 0, buffer.Length, tokenSource.Token);\r
+\r
+                               tokenSource.Cancel ();\r
+\r
+                               Assert.IsTrue (taskRead.Wait (1000), "Timeout #2");\r
+\r
+                               var byteRead = taskRead.Result;\r
+                       }\r
+               } catch (AggregateException ex) {\r
+                       var webEx = ex.InnerException as WebException;\r
+                       Assert.IsNotNull(webEx, "Inner exception is not a WebException");\r
+                       Assert.AreEqual (webEx.Status, WebExceptionStatus.RequestCanceled);\r
+               }\r
+\r
+               listener.Close ();\r
+       }\r
 }\r
 \r
 }\r
index 5da8a5d59c78e11bb00c93fe1c1041235e7a9efb..5f6daa28b60f1eadacf6cea0aaf73bc77ebe5cfa 100644 (file)
@@ -37,6 +37,7 @@ using System.IO;
 using System.Security.Cryptography;
 using System.Security.Cryptography.X509Certificates;
 using System.Text;
+using System.Reflection;
 
 namespace MonoTests.System.Security.Cryptography.X509Certificates {
 
@@ -64,7 +65,7 @@ namespace MonoTests.System.Security.Cryptography.X509Certificates {
                public void FixtureSetUp ()
                {
                        base_dir = String.Format ("{0}{1}Test{1}System.Security.Cryptography.X509Certificates{1}pkits{1}certs",
-                               Directory.GetCurrentDirectory (), Path.DirectorySeparatorChar);
+                               Path.GetDirectoryName (Assembly.GetExecutingAssembly ().Location), Path.DirectorySeparatorChar);
                        if (!Directory.Exists (base_dir))
                                Assert.Ignore ("PKITS tests data not found under '{0}'.", new object[] { base_dir });
 
@@ -75,7 +76,8 @@ namespace MonoTests.System.Security.Cryptography.X509Certificates {
                [TestFixtureTearDown]
                public void FixtureTearDown ()
                {
-                       cache.Clear ();
+                       if (cache != null)
+                               cache.Clear ();
                        // clean-up, as best as possible, the stores
                }
 
index 7d9d24052f3c985d4df6f82244ac578051a3e92b..308c3bdf39a36e865b54fcf35ee2ad3ab3ae9340 100644 (file)
@@ -62,11 +62,7 @@ namespace MonoTests.System {
                public void Setup()
                {
                        StringTester.CreateMode = createMode;
-#if NET_4_5
                        StringTester.Location = location + "NET_4_5";
-#else
-                       StringTester.Location = location + "NET_4_0";
-#endif
                }
 
                [TearDown]
index 32c3fb0459e10829d7a0b9419f3eb99dfc72cd72..b6bc2b8f15bd52ebac2bd624c2dfc05d7d04623a 100644 (file)
@@ -836,11 +836,7 @@ namespace MonoTests.System
                {
                        Uri u = new Uri("http://localhost/index.asp#main#start", false);
 
-#if NET_4_5
                                Assert.AreEqual (u.Fragment, "#main#start", "#1");
-#else
-                               Assert.AreEqual (u.Fragment, "#main%23start", "#1");
-#endif
 
                        u = new Uri("http://localhost/index.asp#main#start", true);
                        Assert.AreEqual (u.Fragment, "#main#start", "#2");
@@ -849,11 +845,7 @@ namespace MonoTests.System
 
                        Uri b = new Uri ("http://www.gnome.org");
                        Uri n = new Uri (b, "blah#main#start");
-#if NET_4_5
                                Assert.AreEqual (n.Fragment, "#main#start", "#3");
-#else
-                               Assert.AreEqual (n.Fragment, "#main%23start", "#3");
-#endif
 
                        n = new Uri (b, "blah#main#start", true);
                        Assert.AreEqual (n.Fragment, "#main#start", "#4");
@@ -1071,13 +1063,8 @@ namespace MonoTests.System
                        Uri ftp = new Uri ("FTP://[::ffFF:169.32.14.5]/");
                        Assert.AreEqual ("ftp", ftp.Scheme, "#7");
 
-#if NET_4_5
                        Assert.AreEqual ("[::ffff:169.32.14.5]", ftp.Host, "#8");
                        Assert.AreEqual ("ftp://[::ffff:169.32.14.5]/", ftp.ToString (), "#9");
-#else
-                       Assert.AreEqual ("[0000:0000:0000:0000:0000:FFFF:A920:0E05]", ftp.Host, "#8");
-                       Assert.AreEqual ("ftp://[0000:0000:0000:0000:0000:FFFF:A920:0E05]/", ftp.ToString (), "#9");
-#endif
                }
 
                [Test]
@@ -1484,15 +1471,9 @@ namespace MonoTests.System
                        for (int i = 0; i < 128; i++)
                                sb.Append ((char) i);
 
-#if NET_4_5
                        Assert.AreEqual (
                                "%00%01%02%03%04%05%06%07%08%09%0A%0B%0C%0D%0E%0F%10%11%12%13%14%15%16%17%18%19%1A%1B%1C%1D%1E%1F%20%21%22%23%24%25%26%27%28%29%2A%2B%2C-.%2F0123456789%3A%3B%3C%3D%3E%3F%40ABCDEFGHIJKLMNOPQRSTUVWXYZ%5B%5C%5D%5E_%60abcdefghijklmnopqrstuvwxyz%7B%7C%7D~%7F",
                                Uri.EscapeDataString (sb.ToString ()));
-#else
-                       Assert.AreEqual (
-                               "%00%01%02%03%04%05%06%07%08%09%0A%0B%0C%0D%0E%0F%10%11%12%13%14%15%16%17%18%19%1A%1B%1C%1D%1E%1F%20!%22%23%24%25%26'()*%2B%2C-.%2F0123456789%3A%3B%3C%3D%3E%3F%40ABCDEFGHIJKLMNOPQRSTUVWXYZ%5B%5C%5D%5E_%60abcdefghijklmnopqrstuvwxyz%7B%7C%7D~%7F",
-                               Uri.EscapeDataString (sb.ToString ()));
-#endif
 
                        Assert.AreEqual ("%C3%A1", Uri.EscapeDataString ("á"));
                }
@@ -1503,15 +1484,9 @@ namespace MonoTests.System
                        for (int i = 0; i < 128; i++)
                                sb.Append ((char) i);
 
-#if NET_4_5
                        Assert.AreEqual (
                                "%00%01%02%03%04%05%06%07%08%09%0A%0B%0C%0D%0E%0F%10%11%12%13%14%15%16%17%18%19%1A%1B%1C%1D%1E%1F%20!%22#$%25&'()*+,-./0123456789:;%3C=%3E?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[%5C]%5E_%60abcdefghijklmnopqrstuvwxyz%7B%7C%7D~%7F",
                                Uri.EscapeUriString (sb.ToString ()));
-#else
-                       Assert.AreEqual (
-                               "%00%01%02%03%04%05%06%07%08%09%0A%0B%0C%0D%0E%0F%10%11%12%13%14%15%16%17%18%19%1A%1B%1C%1D%1E%1F%20!%22#$%25&'()*+,-./0123456789:;%3C=%3E?@ABCDEFGHIJKLMNOPQRSTUVWXYZ%5B%5C%5D%5E_%60abcdefghijklmnopqrstuvwxyz%7B%7C%7D~%7F",
-                               Uri.EscapeUriString (sb.ToString ()));
-#endif
 
                        Assert.AreEqual ("%C3%A1", Uri.EscapeDataString ("á"));
                }
@@ -1703,6 +1678,9 @@ namespace MonoTests.System
                [Category ("NotDotNet")]
                public void UnixAbsoluteFilePath_WithSpecialChars1 ()
                {
+                       if (isWin32)
+                               Assert.Ignore ();
+
                        Uri unixuri = new Uri ("/home/user/a@b");
                        Assert.AreEqual ("file", unixuri.Scheme, "UnixAbsoluteFilePath_WithSpecialChars #1");
                }
@@ -1711,6 +1689,9 @@ namespace MonoTests.System
                [Category ("NotDotNet")]
                public void UnixAbsoluteFilePath_WithSpecialChars2 ()
                {
+                       if (isWin32)
+                               Assert.Ignore ();
+
                        Uri unixuri = new Uri ("/home/user/a:b");
                        Assert.AreEqual ("file", unixuri.Scheme, "UnixAbsoluteFilePath_WithSpecialChars #2");
                }
@@ -1719,6 +1700,9 @@ namespace MonoTests.System
                [Category ("NotDotNet")]
                public void UnixAbsolutePath_ReplaceRelative ()
                {
+                       if (isWin32)
+                               Assert.Ignore ();
+
                        var u1 = new Uri ("/Users/demo/Projects/file.xml");
                        var u2 = new Uri (u1, "b.jpg");
 
@@ -1909,6 +1893,11 @@ namespace MonoTests.System
                [Test]
                public void DotNetRelativeOrAbsoluteTest ()
                {
+                       // On windows the path /foo is parsed as BadFormat and checking
+                       // if this is relative or absolute doesn't make sense.
+                       if (isWin32)
+                               Assert.Ignore();
+
                        FieldInfo useDotNetRelativeOrAbsoluteField = null;
                        bool useDotNetRelativeOrAbsoluteOld = false;
 
@@ -2068,9 +2057,12 @@ namespace MonoTests.System
                [Test]
                public void ImplicitUnixFileWithUnicode ()
                {
-                       string value = "/Library/Frameworks/System.Runtim…ee";
+                       if (isWin32)
+                               Assert.Ignore ();
+
                        Uri uri;
-                       Assert.IsTrue (Uri.TryCreate (value, UriKind.Absolute, out uri));
+                       Assert.IsTrue (Uri.TryCreate ("/Library/Frameworks/System.Runtim…ee", UriKind.Absolute, out uri), "#1");
+                       Assert.IsTrue (Uri.TryCreate (" /A/…", UriKind.Absolute, out uri), "#2");
                }
 
                [Test]
index 9b2e93b730cdb572d1d230c1da5f8566e66c9087..a39ac73d0afa0949dcd04172bdeae22851faef21 100644 (file)
@@ -312,6 +312,8 @@ namespace MonoTests.System
                        Assert.IsFalse (Uri.IsWellFormedUriString (null, UriKind.Absolute), "null");
                        Assert.IsFalse (Uri.IsWellFormedUriString ("data", UriKind.Absolute), "data");
                        Assert.IsTrue (Uri.IsWellFormedUriString ("http://www.go-mono.com/Main_Page#1", UriKind.Absolute), "http/hex");
+                       Assert.IsTrue (Uri.IsWellFormedUriString ("test", UriKind.RelativeOrAbsolute), "rel1");
+                       Assert.IsTrue (Uri.IsWellFormedUriString ("/test", UriKind.RelativeOrAbsolute), "rel2");
                }
 
                [Test]
diff --git a/mcs/class/System/Test/compressed.bin b/mcs/class/System/Test/compressed.bin
new file mode 100644 (file)
index 0000000..3098195
Binary files /dev/null and b/mcs/class/System/Test/compressed.bin differ
index d2eea338663d07b6fc49eef39b266b3e0be4246e..69d28f6df916b6ce4641fa4756b97aa24a7ca615 100644 (file)
@@ -1,5 +1,3 @@
-<?xml version="1.0" encoding="utf-8"?>
-<configuration>
   <system.diagnostics>
     <switches>
       <!-- Boolean switches: any non-zero value is true -->
@@ -22,5 +20,4 @@
       <add name="trace-negative" value="-1"/>
     </switches>
   </system.diagnostics>
-</configuration>
 
diff --git a/mcs/class/System/Test/test-config-file-net-2.0 b/mcs/class/System/Test/test-config-file-net-2.0
deleted file mode 100644 (file)
index 0394048..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<configuration>
-  <system.diagnostics>
-    <sources>
-      <source name="source1" switchName="switch" switchType="System.Diagnostics.SourceSwitch">
-        <!--
-        <listeners>
-          <add name="console" type="System.Diagnostics.ConsoleTraceListener"/>
-        </listeners>
-          -->
-      </source>
-    </sources>
-    <switches>
-      <!-- Boolean switches: any non-zero value is true -->
-      <add name="bool-true" value="1"/>
-      <add name="bool-true-2" value="4"/>
-      <add name="bool-true-3" value="-2"/>
-      <add name="bool-false" value="0"/>
-
-      <!-- trace switches: -->
-      <add name="trace-off" value="0"/>
-      <add name="trace-error" value="1"/>
-      <add name="trace-warning" value="2"/>
-      <add name="trace-info" value="3"/>
-      <add name="trace-verbose" value="4"/>
-
-      <!-- custom switches: -->
-      <add name="custom-switch" value="42"/>
-
-      <!-- this causes problems on .NET -->
-      <add name="trace-negative" value="-1"/>
-    </switches>
-  </system.diagnostics>
-</configuration>
-
index 1b4c33d5db27c04d48f883f9bcd5f22366b42b37..1351778bb8643b61e65d07e951802ead59e45c29 100644 (file)
@@ -11,11 +11,9 @@ System.Diagnostics/FileVersionInfo.cs
 System.Diagnostics/MonitoringDescriptionAttribute.cs
 System.Diagnostics/Process.cs
 System.Diagnostics/ProcessModule.cs
-System.Diagnostics/ProcessModuleCollection.cs
 System.Diagnostics/ProcessPriorityClass.cs
 System.Diagnostics/ProcessStartInfo.cs
 System.Diagnostics/ProcessThread.cs
-System.Diagnostics/ProcessThreadCollection.cs
 System.Diagnostics/ProcessWindowStyle.cs
 System.Diagnostics/Stopwatch.cs
 System.Diagnostics/ThreadPriorityLevel.cs
@@ -28,6 +26,7 @@ System.IO.Compression/DeflateStream.cs
 System.IO.Compression/GZipStream.cs
 System.IO/InternalBufferOverflowException.cs
 System.IO/InvalidDataException.cs
+System.IO/IODescriptionAttribute.cs
 System.IO/ErrorEventArgs.cs
 System.IO/ErrorEventHandler.cs
 System.IO/FileSystemEventArgs.cs
@@ -119,35 +118,14 @@ System.Net.Security/SslPolicyErrors.cs
 System.Net.Security/SslStream.cs
 System.Net/SocketPermissionAttribute.cs
 System.Net/SocketPermission.cs
-../referencesource/System/net/System/Net/Sockets/AddressFamily.cs
-../referencesource/System/net/System/Net/Sockets/IOControlCode.cs
-../referencesource/System/net/System/Net/Sockets/IPPacketInformation.cs
-../referencesource/System/net/System/Net/Sockets/LingerOption.cs
-../referencesource/System/net/System/Net/Sockets/MulticastOption.cs
-../referencesource/System/net/System/Net/Sockets/ProtocolFamily.cs
-../referencesource/System/net/System/Net/Sockets/ProtocolType.cs
 System.Net.Sockets/SafeSocketHandle.cs
-../referencesource/System/net/System/Net/Sockets/SelectMode.cs
-System.Net.Sockets/SendPacketsElement.cs
 System.Net.Sockets/Socket.cs
 System.Net.Sockets/SocketAsyncEventArgs.cs
-System.Net.Sockets/SocketAsyncOperation.cs
 System.Net.Sockets/SocketAsyncResult.cs
-../referencesource/System/net/System/Net/Sockets/SocketErrors.cs
-../referencesource/System/net/System/Net/SocketException.cs
-../referencesource/System/net/System/Net/Sockets/SocketFlags.cs
-../referencesource/System/net/System/Net/Sockets/SocketInformation.cs
-../referencesource/System/net/System/Net/Sockets/SocketInformationOptions.cs
 System.Net.Sockets/SocketOperation.cs
-../referencesource/System/net/System/Net/Sockets/SocketOptionLevel.cs
-../referencesource/System/net/System/Net/Sockets/SocketOptionName.cs
-../referencesource/System/net/System/Net/Sockets/SocketShutdown.cs
-../referencesource/System/net/System/Net/Sockets/SocketType.cs
-System.Net.Sockets/TcpClient.cs
-System.Net.Sockets/TcpListener.cs
-../referencesource/System/net/System/Net/Sockets/TransmitFileFlags.cs
-System.Net.Sockets/UdpClient.cs
-../referencesource/System/net/System/Net/Sockets/UdpReceiveResult.cs
+System.Net.Sockets/SocketReceiveFromResult.cs
+System.Net.Sockets/SocketReceiveMessageFromResult.cs
+System.Net.Sockets/SocketTaskExtensions.cs
 System.Net/AuthenticationManager.cs
 System.Net/BasicClient.cs
 System.Net/BindIPEndPoint.cs
@@ -173,6 +151,7 @@ System.Net/HttpListenerContext.cs
 System.Net/HttpListenerPrefixCollection.cs
 System.Net/HttpListenerRequest.cs
 System.Net/HttpListenerResponse.cs
+System.Net/HttpListenerResponseHelper.cs
 System.Net/HttpListenerTimeoutManager.cs
 System.Net/HttpRequestCreator.cs
 System.Net/HttpStreamAsyncResult.cs
@@ -187,7 +166,6 @@ System.Net/ListenerPrefix.cs
 System.Net/MacProxy.cs
 System.Net/MonoHttpDate.cs
 System.Net/NetConfig.cs
-System.Net/NetworkCredential.cs
 System.Net/NtlmClient.cs
 System.Net/RequestStream.cs
 System.Net/ResponseStream.cs
@@ -227,7 +205,6 @@ System.Security.Authentication.ExtendedProtection/ExtendedProtectionPolicy.cs
 System.Security.Authentication.ExtendedProtection/ExtendedProtectionPolicyTypeConverter.cs
 System.Security.Authentication.ExtendedProtection/PolicyEnforcement.cs
 System.Security.Authentication.ExtendedProtection/ProtectionScenario.cs
-System.Security.Authentication.ExtendedProtection/ServiceNameCollection.cs
 System.Security.Authentication.ExtendedProtection.Configuration/ConfigUtil.cs
 System.Security.Authentication.ExtendedProtection.Configuration/ExtendedProtectionPolicyElement.cs
 System.Security.Authentication.ExtendedProtection.Configuration/ServiceNameElement.cs
@@ -293,28 +270,65 @@ Mono.Net.Security/IMonoSslStream.cs
 Mono.Net.Security/LegacySslStream.cs
 Mono.Net.Security/MobileAuthenticatedStream.cs
 Mono.Net.Security/MobileTlsContext.cs
-Mono.Net.Security/MonoLegacyTlsProvider.cs
+Mono.Net.Security/LegacyTlsProvider.cs
 Mono.Net.Security/MonoSslStreamImpl.cs
 Mono.Net.Security/MonoSslStreamWrapper.cs
 Mono.Net.Security/MonoTlsProviderFactory.cs
-Mono.Net.Security/MonoTlsProviderImpl.cs
 Mono.Net.Security/MonoTlsProviderWrapper.cs
 Mono.Net.Security/MonoTlsStream.cs
 Mono.Net.Security/NoReflectionHelper.cs
 Mono.Net.Security/SystemCertificateValidator.cs
 
+Mono.Btls/MonoBtlsBio.cs
+Mono.Btls/MonoBtlsContext.cs
+Mono.Btls/MonoBtlsError.cs
+Mono.Btls/MonoBtlsException.cs
+Mono.Btls/MonoBtlsKey.cs
+Mono.Btls/MonoBtlsObject.cs
+Mono.Btls/MonoBtlsPkcs12.cs
+Mono.Btls/MonoBtlsProvider.cs
+Mono.Btls/MonoBtlsSsl.cs
+Mono.Btls/MonoBtlsSslCtx.cs
+Mono.Btls/MonoBtlsSslError.cs
+Mono.Btls/MonoBtlsStream.cs
+Mono.Btls/MonoBtlsUtils.cs
+Mono.Btls/MonoBtlsX509.cs
+Mono.Btls/MonoBtlsX509Chain.cs
+Mono.Btls/MonoBtlsX509Crl.cs
+Mono.Btls/MonoBtlsX509Error.cs
+Mono.Btls/MonoBtlsX509Exception.cs
+Mono.Btls/MonoBtlsX509FileType.cs
+Mono.Btls/MonoBtlsX509Format.cs
+Mono.Btls/MonoBtlsX509Lookup.cs
+Mono.Btls/MonoBtlsX509LookupMonoCollection.cs
+Mono.Btls/MonoBtlsX509LookupMono.cs
+Mono.Btls/MonoBtlsX509LookupType.cs
+Mono.Btls/MonoBtlsX509Name.cs
+Mono.Btls/MonoBtlsX509NameEntryType.cs
+Mono.Btls/MonoBtlsX509Purpose.cs
+Mono.Btls/MonoBtlsX509Revoked.cs
+Mono.Btls/MonoBtlsX509Store.cs
+Mono.Btls/MonoBtlsX509StoreCtx.cs
+Mono.Btls/MonoBtlsX509StoreManager.cs
+Mono.Btls/MonoBtlsX509StoreType.cs
+Mono.Btls/MonoBtlsX509TrustKind.cs
+Mono.Btls/MonoBtlsX509VerifyFlags.cs
+Mono.Btls/MonoBtlsX509VerifyParam.cs
+Mono.Btls/X509CertificateImplBtls.cs
+Mono.Btls/X509ChainImplBtls.cs
+
 ReferenceSources/AutoWebProxyScriptEngine.cs
 ReferenceSources/AssertWrapper.cs
 ReferenceSources/CAPI.cs
 ReferenceSources/EnvironmentHelpers.cs
 ReferenceSources/HttpApi.cs
-ReferenceSources/Internal.cs
 ReferenceSources/LocalAppContextSwitches.cs
 ReferenceSources/HttpSysSettings.cs
 ReferenceSources/Logging.cs
 ReferenceSources/NativeMethods.cs
 ReferenceSources/RequestCacheProtocol.cs
 ReferenceSources/SettingsSectionInternal.cs
+ReferenceSources/SecureStringHelper.cs
 ReferenceSources/Socket.cs
 ReferenceSources/SR.cs
 ReferenceSources/SRCategoryAttribute.cs
@@ -706,6 +720,7 @@ ReferenceSources/Win32Exception.cs
 ../referencesource/System/net/System/Net/_ProxyChain.cs
 ../referencesource/System/net/System/Net/_ScatterGatherBuffers.cs
 ../referencesource/System/net/System/Net/_Semaphore.cs
+../referencesource/System/net/System/Net/_ServiceNameStore.cs
 ../referencesource/System/net/System/Net/_TimerThread.cs
 ../referencesource/System/net/System/Net/_WebProxyDataBuilder.cs
 ../referencesource/System/net/System/Net/AuthenticationScheme.cs
@@ -741,6 +756,7 @@ ReferenceSources/Win32Exception.cs
 ../referencesource/System/net/System/Net/IWebProxyFinder.cs
 ../referencesource/System/net/System/Net/IWebRequestCreate.cs
 ../referencesource/System/net/System/Net/NetworkAccess.cs
+../referencesource/System/net/System/Net/NetworkCredential.cs
 ../referencesource/System/net/System/Net/ProtocolViolationException.cs
 ../referencesource/System/net/System/Net/TransportContext.cs
 ../referencesource/System/net/System/Net/TransportType.cs
@@ -748,6 +764,7 @@ ReferenceSources/Win32Exception.cs
 ../referencesource/System/net/System/Net/UnicodeEncodingConformance.cs
 ../referencesource/System/net/System/Net/ServicePointManager.cs
 ../referencesource/System/net/System/Net/SocketAddress.cs
+../referencesource/System/net/System/Net/SocketException.cs
 ../referencesource/System/net/System/Net/webclient.cs
 ../referencesource/System/net/System/Net/WebException.cs
 ../referencesource/System/net/System/Net/WebExceptionStatus.cs
@@ -767,8 +784,31 @@ ReferenceSources/Win32Exception.cs
 
 ../referencesource/System/net/System/Net/Configuration/DefaultProxySection.cs
 
+../referencesource/System/net/System/Net/Sockets/_MultipleConnectAsync.cs
+../referencesource/System/net/System/Net/Sockets/AddressFamily.cs
+../referencesource/System/net/System/Net/Sockets/IOControlCode.cs
+../referencesource/System/net/System/Net/Sockets/IPPacketInformation.cs
 ../referencesource/System/net/System/Net/Sockets/IPProtectionLevel.cs
+../referencesource/System/net/System/Net/Sockets/LingerOption.cs
+../referencesource/System/net/System/Net/Sockets/MulticastOption.cs
 ../referencesource/System/net/System/Net/Sockets/NetworkStream.cs
+../referencesource/System/net/System/Net/Sockets/ProtocolFamily.cs
+../referencesource/System/net/System/Net/Sockets/ProtocolType.cs
+../referencesource/System/net/System/Net/Sockets/SelectMode.cs
+../referencesource/System/net/System/Net/Sockets/Socket.cs
+../referencesource/System/net/System/Net/Sockets/SocketErrors.cs
+../referencesource/System/net/System/Net/Sockets/SocketFlags.cs
+../referencesource/System/net/System/Net/Sockets/SocketInformation.cs
+../referencesource/System/net/System/Net/Sockets/SocketInformationOptions.cs
+../referencesource/System/net/System/Net/Sockets/SocketOptionLevel.cs
+../referencesource/System/net/System/Net/Sockets/SocketOptionName.cs
+../referencesource/System/net/System/Net/Sockets/SocketShutdown.cs
+../referencesource/System/net/System/Net/Sockets/SocketType.cs
+../referencesource/System/net/System/Net/Sockets/TCPClient.cs
+../referencesource/System/net/System/Net/Sockets/TCPListener.cs
+../referencesource/System/net/System/Net/Sockets/TransmitFileFlags.cs
+../referencesource/System/net/System/Net/Sockets/UdpReceiveResult.cs
+../referencesource/System/net/System/Net/Sockets/UDPClient.cs
 
 ../referencesource/System/net/System/Net/NetworkInformation/DuplicateAddressDetectionState.cs
 ../referencesource/System/net/System/Net/NetworkInformation/GatewayIPAddressInformation.cs
@@ -802,7 +842,6 @@ ReferenceSources/Win32Exception.cs
 ../referencesource/System/net/System/Net/NetworkInformation/SystemGatewayIPAddressInformation.cs
 ../referencesource/System/net/System/Net/NetworkInformation/SystemIPAddressInformation.cs
 ../referencesource/System/net/System/Net/NetworkInformation/SystemMulticastIPAddressInformation.cs
-../referencesource/System/net/System/Net/NetworkInformation/SystemUnicastIPAddressInformation.cs
 ../referencesource/System/net/System/Net/NetworkInformation/SystemTcpConnection.cs
 ../referencesource/System/net/System/Net/NetworkInformation/TcpConnection.cs
 ../referencesource/System/net/System/Net/NetworkInformation/TcpState.cs
@@ -814,6 +853,8 @@ ReferenceSources/Win32Exception.cs
 ../referencesource/System/net/System/Net/NetworkInformation/nodetype.cs
 ../referencesource/System/net/System/Net/NetworkInformation/pingexception.cs
 
+../referencesource/System/sys/system/Diagnostics/CodeAnalysis/ExcludeFromCodeCoverageAttribute.cs
+
 ../referencesource/System/sys/system/IO/ports/InternalResources.cs
 
 ../referencesource/System/sys/system/runtime/interopservices/DefaultParameterValueAttribute.cs
@@ -824,7 +865,10 @@ ReferenceSources/Win32Exception.cs
 ../referencesource/System/sys/system/threading/Barrier.cs
 ../referencesource/System/sys/system/threading/semaphore.cs
 
+../referencesource/System/sys/system/windows/markup/ValueSerializerAttribute.cs
+
 ../referencesource/System/security/system/security/Authentication/ExtendedProtection/TokenBinding.cs
+../referencesource/System/security/system/security/Authentication/ExtendedProtection/ServiceNameCollection.cs
 
 ../referencesource/System/security/system/security/cryptography/oid.cs
 
@@ -832,6 +876,9 @@ ReferenceSources/Win32Exception.cs
 
 ../referencesource/System/security/system/security/permissions/typedescriptorpermission.cs
 
+../referencesource/System/services/monitoring/system/diagnosticts/ProcessModuleCollection.cs
+../referencesource/System/services/monitoring/system/diagnosticts/ProcessThreadCollection.cs
+
 ../referencesource/System/services/timers/system/timers/ElapsedEventHandler.cs
 ../referencesource/System/services/timers/system/timers/Timer.cs
 ../referencesource/System/services/timers/system/timers/TimersDescriptionAttribute.cs
@@ -934,7 +981,6 @@ ReferenceSources/Win32Exception.cs
 ../Mono.Security/Mono.Security.Interface/HashAlgorithmType.cs
 ../Mono.Security/Mono.Security.Interface/IBufferOffsetSize.cs
 ../Mono.Security/Mono.Security.Interface/IMonoTlsEventSink.cs
-../Mono.Security/Mono.Security.Interface/IMonoTlsContext.cs
 ../Mono.Security/Mono.Security.Interface/IMonoSslStream.cs
 ../Mono.Security/Mono.Security.Interface/MonoTlsConnectionInfo.cs
 ../Mono.Security/Mono.Security.Interface/MonoTlsProvider.cs
index 686004bd3b16c16676290b8c5bec21daaa5b0827..c2950c536caf33f5d6f337df9463118118f248e8 100644 (file)
@@ -1,3 +1,4 @@
 #include mobile_System.dll.sources
 System/AndroidPlatform.cs
 Mono.Net.Security/MonoTlsProviderFactory.Droid.cs
+Mono.Btls/MonoBtlsX509LookupAndroid.cs
diff --git a/mcs/class/System/monotouch_watch_System.dll.exclude.sources b/mcs/class/System/monotouch_watch_System.dll.exclude.sources
new file mode 100644 (file)
index 0000000..8d7969b
--- /dev/null
@@ -0,0 +1,147 @@
+../Mono.Security/Mono.Security.Authenticode/PrivateKey.cs
+../Mono.Security/Mono.Security.Cryptography/MD5SHA1.cs
+../Mono.Security/Mono.Security.Cryptography/TlsHMAC.cs
+../Mono.Security/Mono.Security.Interface/Alert.cs
+../Mono.Security/Mono.Security.Interface/CertificateValidationHelper.cs
+../Mono.Security/Mono.Security.Interface/CipherAlgorithmType.cs
+../Mono.Security/Mono.Security.Interface/CipherSuiteCode.cs
+../Mono.Security/Mono.Security.Interface/ExchangeAlgorithmType.cs
+../Mono.Security/Mono.Security.Interface/HashAlgorithmType.cs
+../Mono.Security/Mono.Security.Interface/IBufferOffsetSize.cs
+../Mono.Security/Mono.Security.Interface/IMonoSslStream.cs
+../Mono.Security/Mono.Security.Interface/IMonoTlsContext.cs
+../Mono.Security/Mono.Security.Interface/IMonoTlsEventSink.cs
+../Mono.Security/Mono.Security.Interface/MonoTlsConnectionInfo.cs
+../Mono.Security/Mono.Security.Interface/MonoTlsProvider.cs
+../Mono.Security/Mono.Security.Interface/MonoTlsProviderFactory.Apple.cs
+../Mono.Security/Mono.Security.Interface/MonoTlsProviderFactory.cs
+../Mono.Security/Mono.Security.Interface/MonoTlsSettings.cs
+../Mono.Security/Mono.Security.Interface/TlsException.cs
+../Mono.Security/Mono.Security.Interface/TlsProtocolCode.cs
+../Mono.Security/Mono.Security.Interface/TlsProtocols.cs
+../Mono.Security/Mono.Security.Protocol.Ntlm/ChallengeResponse.cs
+../Mono.Security/Mono.Security.Protocol.Ntlm/ChallengeResponse2.cs
+../Mono.Security/Mono.Security.Protocol.Ntlm/MessageBase.cs
+../Mono.Security/Mono.Security.Protocol.Ntlm/NtlmAuthLevel.cs
+../Mono.Security/Mono.Security.Protocol.Ntlm/NtlmFlags.cs
+../Mono.Security/Mono.Security.Protocol.Ntlm/NtlmSettings.cs
+../Mono.Security/Mono.Security.Protocol.Ntlm/Type1Message.cs
+../Mono.Security/Mono.Security.Protocol.Ntlm/Type2Message.cs
+../Mono.Security/Mono.Security.Protocol.Ntlm/Type3Message.cs
+../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsClientCertificate.cs
+../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsClientCertificateVerify.cs
+../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsClientFinished.cs
+../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsClientHello.cs
+../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsClientKeyExchange.cs
+../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsServerCertificate.cs
+../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsServerCertificateRequest.cs
+../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsServerFinished.cs
+../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsServerHello.cs
+../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsServerHelloDone.cs
+../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsServerKeyExchange.cs
+../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsClientCertificate.cs
+../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsClientCertificateVerify.cs
+../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsClientFinished.cs
+../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsClientHello.cs
+../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsClientKeyExchange.cs
+../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsServerCertificate.cs
+../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsServerCertificateRequest.cs
+../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsServerFinished.cs
+../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsServerHello.cs
+../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsServerHelloDone.cs
+../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsServerKeyExchange.cs
+../Mono.Security/Mono.Security.Protocol.Tls.Handshake/ClientCertificateType.cs
+../Mono.Security/Mono.Security.Protocol.Tls.Handshake/HandshakeMessage.cs
+../Mono.Security/Mono.Security.Protocol.Tls.Handshake/HandshakeType.cs
+../Mono.Security/Mono.Security.Protocol.Tls/Alert.cs
+../Mono.Security/Mono.Security.Protocol.Tls/CipherAlgorithmType.cs
+../Mono.Security/Mono.Security.Protocol.Tls/CipherSuite.cs
+../Mono.Security/Mono.Security.Protocol.Tls/CipherSuiteCollection.cs
+../Mono.Security/Mono.Security.Protocol.Tls/CipherSuiteFactory.cs
+../Mono.Security/Mono.Security.Protocol.Tls/ClientContext.cs
+../Mono.Security/Mono.Security.Protocol.Tls/ClientRecordProtocol.cs
+../Mono.Security/Mono.Security.Protocol.Tls/ClientSessionCache.cs
+../Mono.Security/Mono.Security.Protocol.Tls/ContentType.cs
+../Mono.Security/Mono.Security.Protocol.Tls/Context.cs
+../Mono.Security/Mono.Security.Protocol.Tls/DebugHelper.cs
+../Mono.Security/Mono.Security.Protocol.Tls/ExchangeAlgorithmType.cs
+../Mono.Security/Mono.Security.Protocol.Tls/HandshakeState.cs
+../Mono.Security/Mono.Security.Protocol.Tls/HashAlgorithmType.cs
+../Mono.Security/Mono.Security.Protocol.Tls/HttpsClientStream.cs
+../Mono.Security/Mono.Security.Protocol.Tls/RecordProtocol.cs
+../Mono.Security/Mono.Security.Protocol.Tls/RSASslSignatureDeformatter.cs
+../Mono.Security/Mono.Security.Protocol.Tls/RSASslSignatureFormatter.cs
+../Mono.Security/Mono.Security.Protocol.Tls/SecurityCompressionType.cs
+../Mono.Security/Mono.Security.Protocol.Tls/SecurityParameters.cs
+../Mono.Security/Mono.Security.Protocol.Tls/SecurityProtocolType.cs
+../Mono.Security/Mono.Security.Protocol.Tls/ServerContext.cs
+../Mono.Security/Mono.Security.Protocol.Tls/ServerRecordProtocol.cs
+../Mono.Security/Mono.Security.Protocol.Tls/SslCipherSuite.cs
+../Mono.Security/Mono.Security.Protocol.Tls/SslClientStream.cs
+../Mono.Security/Mono.Security.Protocol.Tls/SslHandshakeHash.cs
+../Mono.Security/Mono.Security.Protocol.Tls/SslServerStream.cs
+../Mono.Security/Mono.Security.Protocol.Tls/SslStreamBase.cs
+../Mono.Security/Mono.Security.Protocol.Tls/TlsCipherSuite.cs
+../Mono.Security/Mono.Security.Protocol.Tls/TlsClientSettings.cs
+../Mono.Security/Mono.Security.Protocol.Tls/TlsException.cs
+../Mono.Security/Mono.Security.Protocol.Tls/TlsServerSettings.cs
+../Mono.Security/Mono.Security.Protocol.Tls/TlsStream.cs
+Mono.Http/NtlmClient.cs
+Mono.Net.Security/AsyncProtocolRequest.cs
+Mono.Net.Security/CallbackHelpers.cs
+Mono.Net.Security/ChainValidationHelper.cs
+Mono.Net.Security/IMonoSslStream.cs
+Mono.Net.Security/IMonoTlsProvider.cs
+Mono.Net.Security/LegacySslStream.cs
+Mono.Net.Security/LegacySslStream.cs
+Mono.Net.Security/LegacyTlsProvider.cs
+Mono.Net.Security/LegacyTlsProvider.cs
+Mono.Net.Security/MobileAuthenticatedStream.cs
+Mono.Net.Security/MobileTlsContext.cs
+Mono.Net.Security/MonoSslStreamImpl.cs
+Mono.Net.Security/MonoSslStreamWrapper.cs
+Mono.Net.Security/MonoTlsProviderFactory.Apple.cs
+Mono.Net.Security/MonoTlsProviderFactory.cs
+Mono.Net.Security/MonoTlsProviderImpl.cs
+Mono.Net.Security/MonoTlsProviderWrapper.cs
+Mono.Net.Security/MonoTlsStream.cs
+Mono.Net.Security/NoReflectionHelper.cs
+Mono.Net.Security/SystemCertificateValidator.cs
+System.Net/MacProxy.cs
+System.Net.Mail/SmtpClient.cs
+System.Net.Security/SslStream.cs
+System.Net.Sockets/TcpClient.cs
+System.Net.Sockets/TcpListener.cs
+System.Net.WebSockets/ClientWebSocket.cs
+System.Net/AuthenticationManager.cs
+System.Net/ChunkedInputStream.cs
+System.Net/EndPointListener.cs
+System.Net/EndPointManager.cs
+System.Net/FtpAsyncResult.cs
+System.Net/FtpDataStream.cs
+System.Net/FtpRequestCreator.cs
+System.Net/FtpRequestCreator.cs
+System.Net/FtpStatus.cs
+System.Net/FtpWebRequest.cs
+System.Net/FtpWebResponse.cs
+System.Net/HttpConnection.cs
+System.Net/HttpListener.cs
+System.Net/HttpListenerContext.cs
+System.Net/HttpListenerPrefixCollection.cs
+System.Net/HttpListenerRequest.cs
+System.Net/HttpListenerResponse.cs
+System.Net/HttpWebRequest.cs
+System.Net/HttpWebResponse.cs
+System.Net/IWebConnectionState.cs
+System.Net/ListenerAsyncResult.cs
+System.Net/NtlmClient.cs
+System.Net/ResponseStream.cs
+System.Net/ServicePoint.cs
+System.Net/ServicePointManager.cs
+System.Net/WebConnection.cs
+System.Net/WebConnectionData.cs
+System.Net/WebConnectionGroup.cs
+System.Net/WebConnectionStream.cs
+../referencesource/System/net/System/Net/Sockets/TCPClient.cs
+../referencesource/System/net/System/Net/Sockets/TCPListener.cs
+../referencesource/System/net/System/Net/Sockets/UDPClient.cs
index 7c0bd5983a519e8499a57c6c30b9be525658c105..f7e73d81e36ecfd3775457593b9630c74bd0083d 100644 (file)
@@ -1 +1,20 @@
 #include monotouch_System.dll.sources
+System.Net.Mail/SmtpClient.platformnotsupported.cs
+System.Net.Security/SslStream.platformnotsupported.cs
+System.Net.Sockets/TcpClient.platformnotsupported.cs
+System.Net.Sockets/TcpListener.platformnotsupported.cs
+System.Net.Sockets/UdpClient.platformnotsupported.cs
+System.Net.WebSockets/ClientWebSocket.platformnotsupported.cs
+System.Net/AuthenticationManager.platformnotsupported.cs
+System.Net/FtpRequestCreator.platformnotsupported.cs
+System.Net/FtpWebRequest.platformnotsupported.cs
+System.Net/FtpWebResponse.platformnotsupported.cs
+System.Net/HttpListener.platformnotsupported.cs
+System.Net/HttpListenerContext.platformnotsupported.cs
+System.Net/HttpListenerPrefixCollection.platformnotsupported.cs
+System.Net/HttpListenerRequest.platformnotsupported.cs
+System.Net/HttpListenerResponse.platformnotsupported.cs
+System.Net/HttpWebRequest.platformnotsupported.cs
+System.Net/HttpWebResponse.platformnotsupported.cs
+System.Net/ServicePoint.platformnotsupported.cs
+System.Net/ServicePointManager.platformnotsupported.cs
diff --git a/mcs/class/System/monotouch_watch_runtime_System.dll.exclude.sources b/mcs/class/System/monotouch_watch_runtime_System.dll.exclude.sources
new file mode 100644 (file)
index 0000000..8869410
--- /dev/null
@@ -0,0 +1 @@
+#include monotouch_watch_System.dll.exclude.sources
index 7c0bd5983a519e8499a57c6c30b9be525658c105..c8c328c5ce6605a85a7e34f0db5e1f2c7335d9bb 100644 (file)
@@ -1 +1 @@
-#include monotouch_System.dll.sources
+#include monotouch_watch_System.dll.sources
index cff36539f3bee4d78e7a34495ad889df5509b2bd..22edb63a4c4e85b59fdae28b2bff4daa4e858c72 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index ed37cbc38ad5a2b1f4ca4ae9b79219d53b750ec1..3f87398b1606e3e6b69664f2f85440cef7d6da84 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 927528aa2960f68f2974b8f22c8f14feb23731c5..0d885863e40dca27d28abfe999b709dd9758961a 100644 (file)
@@ -1,3 +1,4 @@
+../../test-helpers/NunitHelpers.cs
 WebMatrix.Data/ConnectionEventArgsTests.cs
 WebMatrix.Data/DynamicRecordTests.cs
 ../WebMatrix.Data/DynamicRecord.cs
old mode 100644 (file)
new mode 100755 (executable)
index e4b4ae1..002d592
@@ -404,7 +404,12 @@ namespace System.IO.Packaging {
                                throw new FileFormatException ("Stream length cannot be zero with FileMode.Open");
 
                        Stream s = File.Open (path, packageMode, packageAccess, packageShare);
-                       return Open (s, packageMode, packageAccess, true);
+                       try {
+                               return Open (s, packageMode, packageAccess, true);
+                       } catch {
+                               s.Close  ();
+                               throw;
+                       }
                }
 
                static Package OpenCore (Stream stream, FileMode packageMode, FileAccess packageAccess, bool ownsStream)
index e83008d4452c91ba8e6e4ffe00dc566eaba6f6e5..6fddadb2f9167de43dcc81e91ce1875d9548c3f6 100644 (file)
@@ -259,6 +259,7 @@ namespace MonoTests.System.Windows {
                }
 
                [Test]
+               [SetCulture ("en-us")]
                public void ToStringTest ()
                {
                        Rect r = new Rect (1.0, 2.5, 3, 4);
index 5ac7164723c0f5473c203026edc0d7e2748e3e89..ed09cea235c246e046c531991e357ce1276e2505 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
     <Compile Include="System.Windows\WeakEventManager.cs" />\r
     <Compile Include="ZipSharp\IOFunctions.cs" />\r
     <Compile Include="ZipSharp\NativeUnzip.cs" />\r
+    <Compile Include="ZipSharp\NativeVersion.cs" />\r
     <Compile Include="ZipSharp\NativeZip.cs" />\r
     <Compile Include="ZipSharp\UnzipArchive.cs" />\r
     <Compile Include="ZipSharp\UnzipFileInfo.cs" />\r
index f0a6e5c2ab68e58364251c20accbd8f2784cb8ca..c36c7ce5608ab796e4a659abf9e57fae4d39ae48 100644 (file)
@@ -181,6 +181,7 @@ System.Windows.Threading/DispatcherUnhandledExceptionEventArgs.cs
 System.Windows.Threading/DispatcherUnhandledExceptionEventHandler.cs
 System.Windows.Threading/DispatcherUnhandledExceptionFilterEventArgs.cs
 System.Windows.Threading/DispatcherUnhandledExceptionFilterEventHandler.cs
+ZipSharp/NativeVersion.cs
 ZipSharp/IOFunctions.cs
 ZipSharp/ZipArchive.cs
 ZipSharp/UnzipArchive.cs
index 64a199a988f901a3ee633c09c67cb3375e7ac439..620b1628eb850d629601e5a21e78704235dde29f 100644 (file)
@@ -1,3 +1,4 @@
+../../test-helpers/NunitHelpers.cs
 System.Collections.ObjectModel/ObservableCollectionTest.cs
 System.Collections.ObjectModel/ReadOnlyObservableCollectionTest.cs
 System.Collections.Specialized/NotifyCollectionChangedEventArgsTest.cs
index 04e6a3e9ca79e7919b62d2e245dc17959a5f1be2..d339f84425e9fdd4e006e4c9384664170a678629 100644 (file)
@@ -21,16 +21,28 @@ namespace zipsharp
        internal delegate IntPtr OpenFileFunc (IntPtr opaque, string filename, int mode);
 
        [UnmanagedFunctionPointerAttribute (CallingConvention.Cdecl)]
-       internal delegate /* ulong */ IntPtr ReadFileFunc (IntPtr opaque, IntPtr stream, IntPtr buffer, /* ulong */ IntPtr size);
+       internal delegate /* uLong */ uint ReadFileFunc32 (IntPtr opaque, IntPtr stream, IntPtr buffer, /* uLong */ uint size);
 
        [UnmanagedFunctionPointerAttribute (CallingConvention.Cdecl)]
-       internal delegate /* ulong */ IntPtr WriteFileFunc (IntPtr opaque, IntPtr stream, IntPtr buffer, /* ulong */ IntPtr size);
+       internal delegate /* uLong */ uint WriteFileFunc32 (IntPtr opaque, IntPtr stream, IntPtr buffer, /* uLong */ uint size);
 
        [UnmanagedFunctionPointerAttribute (CallingConvention.Cdecl)]
-       internal delegate /* long */ IntPtr TellFileFunc (IntPtr opaque, IntPtr stream);
+       internal delegate /* long */ int TellFileFunc32 (IntPtr opaque, IntPtr stream);
 
        [UnmanagedFunctionPointerAttribute (CallingConvention.Cdecl)]
-       internal delegate /* long */ IntPtr SeekFileFunc (IntPtr opaque, IntPtr stream, /* ulong */ IntPtr offset, int origin);
+       internal delegate /* long */ int SeekFileFunc32 (IntPtr opaque, IntPtr stream, /* uLong */ uint offset, int origin);
+
+       [UnmanagedFunctionPointerAttribute (CallingConvention.Cdecl)]
+       internal delegate /* uLong */ ulong ReadFileFunc64 (IntPtr opaque, IntPtr stream, IntPtr buffer, /* uLong */ ulong size);
+
+       [UnmanagedFunctionPointerAttribute (CallingConvention.Cdecl)]
+       internal delegate /* uLong */ ulong WriteFileFunc64 (IntPtr opaque, IntPtr stream, IntPtr buffer, /* uLong */ ulong size);
+
+       [UnmanagedFunctionPointerAttribute (CallingConvention.Cdecl)]
+       internal delegate /* long */ long TellFileFunc64 (IntPtr opaque, IntPtr stream);
+
+       [UnmanagedFunctionPointerAttribute (CallingConvention.Cdecl)]
+       internal delegate /* long */ long SeekFileFunc64 (IntPtr opaque, IntPtr stream, /* uLong */ ulong offset, int origin);
 
        [UnmanagedFunctionPointerAttribute (CallingConvention.Cdecl)]
        internal delegate int CloseFileFunc (IntPtr opaque, IntPtr stream);
@@ -39,13 +51,26 @@ namespace zipsharp
        internal delegate int TestErrorFileFunc (IntPtr opaque, IntPtr stream);
 
        [StructLayout (LayoutKind.Sequential)]
-       internal struct ZlibFileFuncDef
+       internal struct ZlibFileFuncDef32
+       {
+               [MarshalAs (UnmanagedType.FunctionPtr)] public OpenFileFunc      zopen_file;
+               [MarshalAs (UnmanagedType.FunctionPtr)] public ReadFileFunc32    zread_file;
+               [MarshalAs (UnmanagedType.FunctionPtr)] public WriteFileFunc32   zwrite_file;
+               [MarshalAs (UnmanagedType.FunctionPtr)] public TellFileFunc32    ztell_file;
+               [MarshalAs (UnmanagedType.FunctionPtr)] public SeekFileFunc32    zseek_file;
+               [MarshalAs (UnmanagedType.FunctionPtr)] public CloseFileFunc     zclose_file;
+               [MarshalAs (UnmanagedType.FunctionPtr)] public TestErrorFileFunc zerror_file;
+               public IntPtr            opaque;
+       }
+
+       [StructLayout (LayoutKind.Sequential)]
+       internal struct ZlibFileFuncDef64
        {
                [MarshalAs (UnmanagedType.FunctionPtr)] public OpenFileFunc      zopen_file;
-               [MarshalAs (UnmanagedType.FunctionPtr)] public ReadFileFunc      zread_file;
-               [MarshalAs (UnmanagedType.FunctionPtr)] public WriteFileFunc     zwrite_file;
-               [MarshalAs (UnmanagedType.FunctionPtr)] public TellFileFunc      ztell_file;
-               [MarshalAs (UnmanagedType.FunctionPtr)] public SeekFileFunc      zseek_file;
+               [MarshalAs (UnmanagedType.FunctionPtr)] public ReadFileFunc64    zread_file;
+               [MarshalAs (UnmanagedType.FunctionPtr)] public WriteFileFunc64   zwrite_file;
+               [MarshalAs (UnmanagedType.FunctionPtr)] public TellFileFunc64    ztell_file;
+               [MarshalAs (UnmanagedType.FunctionPtr)] public SeekFileFunc64    zseek_file;
                [MarshalAs (UnmanagedType.FunctionPtr)] public CloseFileFunc     zclose_file;
                [MarshalAs (UnmanagedType.FunctionPtr)] public TestErrorFileFunc zerror_file;
                public IntPtr            opaque;
index 3b3c3dc5d87dcf92a442a238a6dd325c1de151fe..673a2c921ebe3f240d4e0110c503983553c10d34 100644 (file)
@@ -65,43 +65,58 @@ namespace zipsharp
                        return unztell(handle).ToInt64 ();
                }
 
-               public static long CurrentFileLength (UnzipHandle handle)
+               public static long CurrentFileLength32 (UnzipHandle handle)
                {
-                       UnzipFileInfo info;
-                       int result = unzGetCurrentFileInfo (handle, out info, null, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, null,  IntPtr.Zero);
-                       
-                       if (result != 0)
-                               return -1;
-                       else
-                               return (long)info.UncompressedSize;
+                       UnzipFileInfo32 info;
+                       int result = unzGetCurrentFileInfo_32 (handle, out info, null, 0, IntPtr.Zero, 0, null,  0);
+                       return result != 0 ? -1 : (long) info.uncompressed_size;
                }
-               
-               static string GetCurrentFileName (UnzipHandle handle)
+
+               public static long CurrentFileLength64 (UnzipHandle handle)
                {
-                       UnzipFileInfo info;
-                       int result = unzGetCurrentFileInfo (handle, out info, null, IntPtr.Zero, IntPtr.Zero, new IntPtr (0), null,  IntPtr.Zero);
+                       UnzipFileInfo64 info;
+                       int result = unzGetCurrentFileInfo_64 (handle, out info, null, 0, IntPtr.Zero, 0, null,  0);
+                       return result != 0 ? -1 : (long) info.uncompressed_size;
+               }
 
-                       if (result != 0)
+               static string GetCurrentFileName32 (UnzipHandle handle)
+               {
+                       UnzipFileInfo32 info;
+                       if (unzGetCurrentFileInfo_32 (handle, out info, null, 0, IntPtr.Zero, 0, null, 0) != 0)
                                return null;
-                       
-                       StringBuilder sbName = new StringBuilder ((int)info.SizeFilename+1); // +1 to account for extra \0 at the end
-                       result = unzGetCurrentFileInfo (handle, out info, sbName, new IntPtr (sbName.Capacity), IntPtr.Zero, new IntPtr (0), null,  IntPtr.Zero);
-                       
-                       if (result != 0)
+                       var sbName = new StringBuilder ((int) info.size_filename + 1); // +1 to account for extra \0 at the end
+                       if (unzGetCurrentFileInfo_32 (handle, out info, sbName, (uint) sbName.Capacity, IntPtr.Zero, 0, null, 0) != 0)
                                return null;
-                       else
-                               return sbName.ToString ();
+                       return sbName.ToString ();
                }
 
-               public static string[] GetFiles (UnzipHandle handle)
+               static string GetCurrentFileName64 (UnzipHandle handle)
                {
-                       List<string> files = new List<string> ();
+                       UnzipFileInfo64 info;
+                       if (unzGetCurrentFileInfo_64 (handle, out info, null, 0, IntPtr.Zero, 0, null, 0) != 0)
+                               return null;
+                       var sbName = new StringBuilder ((int) info.size_filename + 1); // +1 to account for extra \0 at the end
+                       if (unzGetCurrentFileInfo_64 (handle, out info, sbName, (uint) sbName.Capacity, IntPtr.Zero, 0, null, 0) != 0)
+                               return null;
+                       return sbName.ToString ();
+               }
 
-                       GoToFirstFile (handle);
+               public static string[] GetFiles32 (UnzipHandle handle)
+               {
+                       return GetFiles (handle, GetCurrentFileName32);
+               }
+
+               public static string[] GetFiles64 (UnzipHandle handle)
+               {
+                       return GetFiles (handle, GetCurrentFileName64);
+               }
 
+               private static string[] GetFiles (UnzipHandle handle, Func<UnzipHandle, string> getCurrentFileName)
+               {
+                       GoToFirstFile (handle);
+                       var files = new List<string> ();
                        string name;
-                       while ((name = GetCurrentFileName(handle)) != null)
-                       {
+                       while ((name = getCurrentFileName (handle)) != null) {
                                files.Add (name);
                                if (!NativeUnzip.GoToNextFile (handle))
                                        break;
@@ -121,9 +136,17 @@ namespace zipsharp
                        return unzGoToNextFile(handle) == 0;
                }
                
-               public static UnzipHandle OpenArchive (ZlibFileFuncDef fileFuncs)
+               public static UnzipHandle OpenArchive32 (ZlibFileFuncDef32 fileFuncs)
+               {
+                       UnzipHandle handle = unzOpen2_32 ("", ref fileFuncs);
+                       if (handle.IsInvalid)
+                               throw new Exception ("Could not open unzip archive");
+                       return handle;
+               }
+
+               public static UnzipHandle OpenArchive64 (ZlibFileFuncDef64 fileFuncs)
                {
-                       UnzipHandle handle = unzOpen2 ("", ref fileFuncs);
+                       UnzipHandle handle = unzOpen2_64 ("", ref fileFuncs);
                        if (handle.IsInvalid)
                                throw new Exception ("Could not open unzip archive");
                        return handle;
@@ -160,9 +183,13 @@ namespace zipsharp
                [DllImport ("MonoPosixHelper", CallingConvention=CallingConvention.Cdecl)]
                static extern int unzGoToFirstFile (UnzipHandle handle);
 
-               [DllImport ("MonoPosixHelper", CallingConvention=CallingConvention.Cdecl)]
-               static extern UnzipHandle unzOpen2 (string path,
-                                                           ref ZlibFileFuncDef pzlib_filefunc_def);
+               [DllImport ("MonoPosixHelper", EntryPoint="unzOpen2", CallingConvention=CallingConvention.Cdecl)]
+               static extern UnzipHandle unzOpen2_32 (string path,
+                                                      ref ZlibFileFuncDef32 pzlib_filefunc_def);
+
+               [DllImport ("MonoPosixHelper", EntryPoint="unzOpen2", CallingConvention=CallingConvention.Cdecl)]
+               static extern UnzipHandle unzOpen2_64 (string path,
+                                                      ref ZlibFileFuncDef64 pzlib_filefunc_def);
 
                [DllImport ("MonoPosixHelper", CallingConvention=CallingConvention.Cdecl)]
                static extern int unzGoToNextFile (UnzipHandle handle);
@@ -178,15 +205,25 @@ namespace zipsharp
                                                       out int level,
                                                       int raw);
 
-               [DllImport ("MonoPosixHelper", CallingConvention=CallingConvention.Cdecl)]
-               static extern int unzGetCurrentFileInfo (UnzipHandle handle,
-                                                                out UnzipFileInfo pfile_info,
-                                                                StringBuilder szFileName,
-                                                                IntPtr fileNameBufferSize,   // uLong
-                                                                IntPtr extraField,           // void *
-                                                                IntPtr extraFieldBufferSize, // uLong
-                                                                StringBuilder szComment,
-                                                                IntPtr commentBufferSize);   // uLong
+               [DllImport ("MonoPosixHelper", EntryPoint="unzGetCurrentFileInfo", CallingConvention=CallingConvention.Cdecl)]
+               static extern int unzGetCurrentFileInfo_32 (UnzipHandle handle,
+                                                           out UnzipFileInfo32 pfile_info,
+                                                           StringBuilder szFileName,
+                                                           uint fileNameBufferSize,   // uLong
+                                                           IntPtr extraField,         // void *
+                                                           uint extraFieldBufferSize, // uLong
+                                                           StringBuilder szComment,
+                                                           uint commentBufferSize);   // uLong
+
+               [DllImport ("MonoPosixHelper", EntryPoint="unzGetCurrentFileInfo", CallingConvention=CallingConvention.Cdecl)]
+               static extern int unzGetCurrentFileInfo_64 (UnzipHandle handle,
+                                                           out UnzipFileInfo64 pfile_info,
+                                                           StringBuilder szFileName,
+                                                           ulong fileNameBufferSize,   // uLong
+                                                           IntPtr extraField,          // void *
+                                                           ulong extraFieldBufferSize, // uLong
+                                                           StringBuilder szComment,
+                                                           ulong commentBufferSize);   // uLong
 
                [DllImport ("MonoPosixHelper", CallingConvention=CallingConvention.Cdecl)]
                static unsafe extern int unzReadCurrentFile (UnzipHandle handle,
diff --git a/mcs/class/WindowsBase/ZipSharp/NativeVersion.cs b/mcs/class/WindowsBase/ZipSharp/NativeVersion.cs
new file mode 100755 (executable)
index 0000000..ce7112e
--- /dev/null
@@ -0,0 +1,20 @@
+using System;
+
+namespace zipsharp {
+       static class NativeVersion {
+
+               /// <summary>
+               /// ZipSharp code needs different code paths
+               /// depending on the size of the C long type on the underlying platform. On
+               /// gcc/clang the C long type follows the bitness of the targeted architecture,
+               /// it's 32-bit on 32-bit systems and 64-bit on 64-bit systems. With the VS
+               /// compiler however, the C long type is always 32-bit regardless of the
+               /// target architecture. zlib and minizip uses C long in a number of 
+               /// different function signatures and structs. 
+               /// 
+               /// This field is used to easily determine if the 32 bit version of 
+               /// functions and structs should be used when interacting with zlib.
+               /// </summary>
+               public static readonly bool Use32Bit = IntPtr.Size == 4 || Environment.OSVersion.Platform != PlatformID.Unix;
+       }
+}
index 225fc1acaba49b94a58b6999f54388d202c154e1..b556a9052e661d40251b895a24648346f7413466 100644 (file)
@@ -31,24 +31,44 @@ namespace zipsharp
                        zipCloseFileInZip (handle);
                }
 
-               public static ZipHandle OpenArchive (ZlibFileFuncDef funcDef, Append append)
+               public static ZipHandle OpenArchive32 (ZlibFileFuncDef32 funcDef, Append append)
                {
-                       ZipHandle h = zipOpen2 ("", (int) append, IntPtr.Zero, ref funcDef);
+                       ZipHandle h = zipOpen2_32 ("", (int) append, IntPtr.Zero, ref funcDef);
                        if (h.IsInvalid)
                                throw new Exception ("Could not open the zip archive");
                        return h;
                }
-               
-               public static int OpenFile (ZipHandle handle, string filename)
+
+               public static ZipHandle OpenArchive64 (ZlibFileFuncDef64 funcDef, Append append)
+               {
+                       ZipHandle h = zipOpen2_64 ("", (int) append, IntPtr.Zero, ref funcDef);
+                       if (h.IsInvalid)
+                               throw new Exception ("Could not open the zip archive");
+                       return h;
+               }
+
+               public static int OpenFile32 (ZipHandle handle, string filename)
+               {
+                       return OpenFile32 (handle, filename, DEFAULT_COMPRESSION);
+               }
+
+               public static int OpenFile32 (ZipHandle handle, string filename, int compressionLevel)
+               {
+                       ZipFileInfo32 fileInfo = new ZipFileInfo32 (DateTime.Now);
+                       int method = compressionLevel == 0 ? 0 : Z_DEFLATED;
+                       return zipOpenNewFileInZip_32 (handle, filename, ref fileInfo, IntPtr.Zero, 0, IntPtr.Zero, 0, "", method, compressionLevel);
+               }
+
+               public static int OpenFile64 (ZipHandle handle, string filename)
                {
-                       return OpenFile (handle, filename, DEFAULT_COMPRESSION);
+                       return OpenFile64 (handle, filename, DEFAULT_COMPRESSION);
                }
 
-               public static int OpenFile (ZipHandle handle, string filename, int compressionLevel)
+               public static int OpenFile64 (ZipHandle handle, string filename, int compressionLevel)
                {
-                       ZipFileInfo fileInfo = new ZipFileInfo (DateTime.Now);
+                       ZipFileInfo64 fileInfo = new ZipFileInfo64 (DateTime.Now);
                        int method = compressionLevel == 0 ? 0 : Z_DEFLATED;
-                       return zipOpenNewFileInZip (handle, filename, ref fileInfo, IntPtr.Zero, 0, IntPtr.Zero, 0, "", method, compressionLevel);
+                       return zipOpenNewFileInZip_64 (handle, filename, ref fileInfo, IntPtr.Zero, 0, IntPtr.Zero, 0, "", method, compressionLevel);
                }
 
                public static unsafe void Write (ZipHandle handle, byte[] buffer, int offset, uint count)
@@ -65,26 +85,43 @@ namespace zipsharp
                [DllImport ("MonoPosixHelper")]
                static extern int zipCloseFileInZip (ZipHandle handle);
 
-               [DllImport ("MonoPosixHelper")]
-               static extern ZipHandle zipOpen2 (string pathname,
-                                                 int append,
-                                                 IntPtr globalcomment, // zipcharpc*
-                                                 ref ZlibFileFuncDef pzlib_filefunc_def); // zlib_filefunc_def*
+               [DllImport ("MonoPosixHelper", EntryPoint = "zipOpen2")]
+               static extern ZipHandle zipOpen2_32 (string pathname,
+                                                    int append,
+                                                    IntPtr globalcomment, // zipcharpc*
+                                                    ref ZlibFileFuncDef32 pzlib_filefunc_def); // zlib_filefunc_def*
+
+               [DllImport ("MonoPosixHelper", EntryPoint = "zipOpen2")]
+               static extern ZipHandle zipOpen2_64 (string pathname,
+                                                    int append,
+                                                    IntPtr globalcomment, // zipcharpc*
+                                                    ref ZlibFileFuncDef64 pzlib_filefunc_def); // zlib_filefunc_def*
 
-               
                [DllImport ("MonoPosixHelper")]
                static extern int zipClose (ZipHandle handle, string globalComment);
 
-               [DllImport ("MonoPosixHelper")]
-               static extern int zipOpenNewFileInZip (ZipHandle handle,
-                                                      string filename,
-                                                      ref ZipFileInfo zipfi,
-                                                      IntPtr extrafield_local,
-                                                      uint size_extrafield_local,
-                                                      IntPtr extrafield_global,
-                                                      uint size_extrafield_global,
-                                                      string comment,
-                                                      int method,
-                                                      int level);
+               [DllImport ("MonoPosixHelper", EntryPoint = "zipOpenNewFileInZip")]
+               static extern int zipOpenNewFileInZip_32 (ZipHandle handle,
+                                                         string filename,
+                                                         ref ZipFileInfo32 zipfi,
+                                                         IntPtr extrafield_local,
+                                                         uint size_extrafield_local,
+                                                         IntPtr extrafield_global,
+                                                         uint size_extrafield_global,
+                                                         string comment,
+                                                         int method,
+                                                         int level);
+
+               [DllImport ("MonoPosixHelper", EntryPoint = "zipOpenNewFileInZip")]
+               static extern int zipOpenNewFileInZip_64 (ZipHandle handle,
+                                                         string filename,
+                                                         ref ZipFileInfo64 zipfi,
+                                                         IntPtr extrafield_local,
+                                                         uint size_extrafield_local,
+                                                         IntPtr extrafield_global,
+                                                         uint size_extrafield_global,
+                                                         string comment,
+                                                         int method,
+                                                         int level);
        }
 }
index d3be55886bf8cb9ed2b646c8911db857cfb740a3..59a5935c1128bb07ad734a9d339ce6348763ff25 100644 (file)
@@ -38,7 +38,7 @@ namespace zipsharp
                string[] Files {
                        get {
                                if (files == null)
-                                       files = NativeUnzip.GetFiles (Handle);
+                                       files = NativeVersion.Use32Bit ? NativeUnzip.GetFiles32 (Handle) : NativeUnzip.GetFiles64 (Handle);
                                return files;
                        }
                }
@@ -66,7 +66,7 @@ namespace zipsharp
                public UnzipArchive (Stream stream, bool ownsStream)
                {
                        Stream = new ZipStream (stream, ownsStream);
-                       Handle = NativeUnzip.OpenArchive (Stream.IOFunctions);
+                       Handle = NativeVersion.Use32Bit ? NativeUnzip.OpenArchive32 (Stream.IOFunctions32) : NativeUnzip.OpenArchive64 (Stream.IOFunctions64);
                }
 
                public void Dispose ()
index 9316c0a1773d617a8c26b266ddec0dd51d764723..d69241d7fa50ef1dab26f4597b4a10b614a3672e 100644 (file)
@@ -10,103 +10,46 @@ using System.Runtime.InteropServices;
 namespace zipsharp
 {
        [StructLayout (LayoutKind.Sequential)]
-       struct UnzipFileInfo
+       struct UnzipFileInfo32
        {
-           IntPtr version;              /* version made by                 2 bytes */
-           IntPtr version_needed;       /* version needed to extract       2 bytes */
-           IntPtr flag;                 /* general purpose bit flag        2 bytes */
-           IntPtr compression_method;   /* compression method              2 bytes */
-           IntPtr dosDate;              /* last mod file date in Dos fmt   4 bytes */
-           IntPtr crc;                  /* crc-32                          4 bytes */
-           IntPtr compressed_size;      /* compressed size                 4 bytes */
-           IntPtr uncompressed_size;    /* uncompressed size               4 bytes */
-           IntPtr size_filename;        /* filename length                 2 bytes */
-           IntPtr size_file_extra;      /* extra field length              2 bytes */
-           IntPtr size_file_comment;    /* file comment length             2 bytes */
+               public uint version;              /* version made by                 2 bytes */
+               public uint version_needed;       /* version needed to extract       2 bytes */
+               public uint flag;                 /* general purpose bit flag        2 bytes */
+               public uint compression_method;   /* compression method              2 bytes */
+               public uint dosDate;              /* last mod file date in Dos fmt   4 bytes */
+               public uint crc;                  /* crc-32                          4 bytes */
+               public uint compressed_size;      /* compressed size                 4 bytes */
+               public uint uncompressed_size;    /* uncompressed size               4 bytes */
+               public uint size_filename;        /* filename length                 2 bytes */
+               public uint size_file_extra;      /* extra field length              2 bytes */
+               public uint size_file_comment;    /* file comment length             2 bytes */
        
-           IntPtr disk_num_start;       /* disk number start               2 bytes */
-           IntPtr internal_fa;          /* internal file attributes        2 bytes */
-           IntPtr external_fa;          /* external file attributes        4 bytes */
+               public uint disk_num_start;       /* disk number start               2 bytes */
+               public uint internal_fa;          /* internal file attributes        2 bytes */
+               public uint external_fa;          /* external file attributes        4 bytes */
        
            ZipTime tmu_date;
-           
-           public ulong VersionNeeded {
-               get { return (ulong)version_needed.ToInt64 (); }
-               set { version_needed = new IntPtr ((int)value); }
-           }
-           
-           public ulong Version {
-               get { return (ulong)version.ToInt64 (); }
-               set { version = new IntPtr ((int)value); }
-           }
-           
-           public ulong UncompressedSize {
-               get { return (ulong)uncompressed_size.ToInt64 (); }
-                       set { uncompressed_size = new IntPtr ((int)value); }
-           }
-           
-           public ZipTime TmuDate {
-               get { return tmu_date; }
-               set { tmu_date = value; }
-           }
-           
-           public ulong SizeFilename {
-               get { return (ulong)size_filename.ToInt64 (); }
-               set { size_filename = new IntPtr ((int)value); }
-           }
-           
-           public ulong SizeFileExtra {
-               get { return (ulong)size_file_extra.ToInt64 (); }
-               set { size_file_extra = new IntPtr ((int)value); }
-           }
-           
-           public ulong SizeFileComment {
-               get {
-                       return (ulong)size_file_comment.ToInt64 ();
-               }
-               set {
-                       size_file_comment = new IntPtr ((int)value);
-               }
-           }
-           
-           public ulong InternalFa {
-               get { return (ulong)internal_fa.ToInt64 (); }
-               set { internal_fa = new IntPtr ((int)value); }
-           }
-           
-           public ulong Flag {
-               get { return (ulong)flag.ToInt64 (); }
-               set { flag = new IntPtr ((int)value); }
-           }
-           
-           public ulong ExternalFa {
-               get { return (ulong)external_fa.ToInt64 (); }
-               set { external_fa = new IntPtr ((int)value); }
-           }
-           
-           public ulong DosDate {
-               get { return (ulong)dosDate.ToInt64 (); }
-               set { dosDate = new IntPtr ((int)value); }
-           }
-           
-           public ulong DiskNumStart {
-               get { return (ulong)disk_num_start.ToInt64 (); }
-               set { disk_num_start = new IntPtr ((int)value); }
-           }
-           
-           public ulong Crc {
-               get { return (ulong)crc.ToInt64 (); }
-               set { crc = new IntPtr ((int)value); }
-           }
-           
-           public ulong CompressionMethod {
-               get { return (ulong)compression_method.ToInt64 (); }
-               set { compression_method = new IntPtr ((int)value); }
-           }
-           
-           public ulong CompressedSize {
-               get { return (ulong)compressed_size.ToInt64 (); }
-               set { compressed_size = new IntPtr ((int)value); }
-           }
+       }
+
+       [StructLayout (LayoutKind.Sequential)]
+       struct UnzipFileInfo64
+       {
+               public ulong version;              /* version made by                 2 bytes */
+               public ulong version_needed;       /* version needed to extract       2 bytes */
+               public ulong flag;                 /* general purpose bit flag        2 bytes */
+               public ulong compression_method;   /* compression method              2 bytes */
+               public ulong dosDate;              /* last mod file date in Dos fmt   4 bytes */
+               public ulong crc;                  /* crc-32                          4 bytes */
+               public ulong compressed_size;      /* compressed size                 4 bytes */
+               public ulong uncompressed_size;    /* uncompressed size               4 bytes */
+               public ulong size_filename;        /* filename length                 2 bytes */
+               public ulong size_file_extra;      /* extra field length              2 bytes */
+               public ulong size_file_comment;    /* file comment length             2 bytes */
+
+               public ulong disk_num_start;       /* disk number start               2 bytes */
+               public ulong internal_fa;          /* internal file attributes        2 bytes */
+               public ulong external_fa;          /* external file attributes        4 bytes */
+
+               ZipTime tmu_date;
        }
 }
index 39c793e8e0b2146ab808b62350689aa6453e9377..71cc129006d23f0581d3aae3a3e0c933d1d6e325 100644 (file)
@@ -70,7 +70,7 @@ namespace zipsharp
                        Archive = archive;
                        Archive.FileActive = true;
                        CompressionLevel = compressionLevel;
-                       length = NativeUnzip.CurrentFileLength (Archive.Handle);
+                       length = NativeVersion.Use32Bit ? NativeUnzip.CurrentFileLength32 (Archive.Handle) : NativeUnzip.CurrentFileLength64 (Archive.Handle);
                }
 
                public override void Close()
index 8f60aab4e9eedc97a8f48be7ffadc1e8e50e56b4..598d163991c8821d2540e28ee9b65d9f4c2565a6 100644 (file)
@@ -31,7 +31,7 @@ namespace zipsharp
                public ZipArchive (Stream stream, Append append, bool ownsStream)
                {
                        Stream = new ZipStream (stream, ownsStream);
-                       Handle = NativeZip.OpenArchive (Stream.IOFunctions, append);
+                       Handle = NativeVersion.Use32Bit ? NativeZip.OpenArchive32 (Stream.IOFunctions32, append) : NativeZip.OpenArchive64 (Stream.IOFunctions64, append);
                }
 
                
@@ -61,8 +61,11 @@ namespace zipsharp
                {
                        if (FileActive)
                                throw new InvalidOperationException ("A file is already open");
-                       
-                       NativeZip.OpenFile (Handle, filename, ConvertCompression (option));
+
+                       if (NativeVersion.Use32Bit)
+                               NativeZip.OpenFile32 (Handle, filename, ConvertCompression (option));
+                       else
+                               NativeZip.OpenFile64 (Handle, filename, ConvertCompression (option));
                        return new ZipWriteStream (this);
                }
 
index 2a81a73959bba6ddcf3595874bb9651989261160..0c3f0eeb7f98fefaa786a2c47db873fe1392acd9 100644 (file)
@@ -10,40 +10,36 @@ using System.Runtime.InteropServices;
 namespace zipsharp
 {
        [StructLayoutAttribute (LayoutKind.Sequential)]
-       struct ZipFileInfo
+       struct ZipFileInfo32
        {
                ZipTime date;
-               IntPtr dosDate;
-               IntPtr internalFileAttributes;
-               IntPtr externalFileAttributes;
+               uint dosDate;
+               uint internalFileAttributes;
+               uint externalFileAttributes;
 
-               public DateTime FileTime
+               public ZipFileInfo32 (DateTime fileTime)
                {
-                       get { return date.Date; }
+                       date = new ZipTime (fileTime);
+                       dosDate = 0;
+                       internalFileAttributes = 0;
+                       externalFileAttributes = 0;
                }
+       }
 
-               public long DosDate
-               {
-                       get { return dosDate.ToInt64 (); }
-               }
-               
-               internal long InternalFileAttributes
-               {
-                       get { return internalFileAttributes.ToInt64 (); }
-               }
+       [StructLayoutAttribute (LayoutKind.Sequential)]
+       struct ZipFileInfo64
+       {
+               ZipTime date;
+               ulong dosDate;
+               ulong internalFileAttributes;
+               ulong externalFileAttributes;
 
-               internal long ExternalFileAttributes
-               {
-                       get { return externalFileAttributes.ToInt64 (); }
-               }
-               
-               public ZipFileInfo (DateTime fileTime)
+               public ZipFileInfo64 (DateTime fileTime)
                {
                        date = new ZipTime (fileTime);
-                       dosDate = IntPtr.Zero;
-                       internalFileAttributes = IntPtr.Zero;
-                       externalFileAttributes = IntPtr.Zero;
+                       dosDate = 0;
+                       internalFileAttributes = 0;
+                       externalFileAttributes = 0;
                }
-
        }
 }
index 51d15c56c12dfa67691c08f2019edcedbd9c4851..f0007dfb8a244c059a0f511be0fb900b6fdda0cf 100644 (file)
@@ -40,7 +40,11 @@ namespace zipsharp
                        get; set;
                }
 
-               public ZlibFileFuncDef IOFunctions {
+               public ZlibFileFuncDef32 IOFunctions32 {
+                       get; set;
+               }
+
+               public ZlibFileFuncDef64 IOFunctions64 {
                        get; set;
                }
 
@@ -67,18 +71,27 @@ namespace zipsharp
                        DataStream = dataStream;
                        OwnsStream = ownsStream;
                        
-                       ZlibFileFuncDef f = new ZlibFileFuncDef();
-                       
-                       f.opaque = IntPtr.Zero;
-                       f.zclose_file = CloseFile_Native;
-                       f.zerror_file = TestError_Native;
-                       f.zopen_file = OpenFile_Native;
-                       f.zread_file = ReadFile_Native;
-                       f.zseek_file = SeekFile_Native;
-                       f.ztell_file = TellFile_Native;
-                       f.zwrite_file = WriteFile_Native;
-
-                       IOFunctions = f;
+                       ZlibFileFuncDef32 f32 = new ZlibFileFuncDef32 ();
+                       f32.opaque = IntPtr.Zero;
+                       f32.zclose_file = CloseFile_Native;
+                       f32.zerror_file = TestError_Native;
+                       f32.zopen_file = OpenFile_Native;
+                       f32.zread_file = ReadFile_Native32;
+                       f32.zseek_file = SeekFile_Native32;
+                       f32.ztell_file = TellFile_Native32;
+                       f32.zwrite_file = WriteFile_Native32;
+                       IOFunctions32 = f32;
+
+                       ZlibFileFuncDef64 f64 = new ZlibFileFuncDef64 ();
+                       f64.opaque = IntPtr.Zero;
+                       f64.zclose_file = CloseFile_Native;
+                       f64.zerror_file = TestError_Native;
+                       f64.zopen_file = OpenFile_Native;
+                       f64.zread_file = ReadFile_Native64;
+                       f64.zseek_file = SeekFile_Native64;
+                       f64.ztell_file = TellFile_Native64;
+                       f64.zwrite_file = WriteFile_Native64;
+                       IOFunctions64 = f64;
                }
 
                protected override void Dispose(bool disposing)
@@ -130,9 +143,14 @@ namespace zipsharp
                        return new IntPtr (1);
                }
 
-               unsafe IntPtr ReadFile_Native (IntPtr opaque, IntPtr stream, IntPtr buffer, IntPtr size)
+               unsafe uint ReadFile_Native32 (IntPtr opaque, IntPtr stream, IntPtr buffer, uint size)
                {
-                       int count = size.ToInt32 ();
+                       return (uint) ReadFile_Native64 (opaque, stream, buffer, size);
+               }
+
+               unsafe ulong ReadFile_Native64 (IntPtr opaque, IntPtr stream, IntPtr buffer, ulong size)
+               {
+                       int count = (int) size;
                        byte[] b = new byte[count];
                        int read;
                        
@@ -145,10 +163,15 @@ namespace zipsharp
                                read = -1;
                        }
 
-                       return new IntPtr (read);
+                       return (ulong) read;
                }
 
-               IntPtr SeekFile_Native (IntPtr opaque, IntPtr stream, IntPtr offset, int origin)
+               int SeekFile_Native32 (IntPtr opaque, IntPtr stream, uint offset, int origin)
+               {
+                       return (int) SeekFile_Native64 (opaque, stream, offset, origin);
+               }
+
+               long SeekFile_Native64 (IntPtr opaque, IntPtr stream, ulong offset, int origin)
                {
                        SeekOrigin seek;
                        if (origin == ZipStream.ZLIB_FILEFUNC_SEEK_CUR)
@@ -158,21 +181,21 @@ namespace zipsharp
                        else if (origin == ZLIB_FILEFUNC_SEEK_SET)
                                seek = SeekOrigin.Begin;
                        else
-                               return new IntPtr (-1);
+                               return -1;
 
-                       Seek (offset.ToInt64 (), seek);
+                       Seek ((long) offset, seek);
                        
-                       return new IntPtr (0);
+                       return 0;
                }
 
-               IntPtr TellFile_Native (IntPtr opaque, IntPtr stream)
+               int TellFile_Native32 (IntPtr opaque, IntPtr stream)
                {
-                       if (IntPtr.Size == 4)
-                               return new IntPtr ((int)Position);
-                       else if (IntPtr.Size == 8)
-                               return new IntPtr (Position);
-                       else
-                               return new IntPtr (-1);
+                       return (int) TellFile_Native64 (opaque, stream);
+               }
+
+               long TellFile_Native64 (IntPtr opaque, IntPtr stream)
+               {
+                       return Position;
                }
 
                int TestError_Native (IntPtr opaque, IntPtr stream)
@@ -181,9 +204,14 @@ namespace zipsharp
                        return 0;
                }
 
-               unsafe IntPtr WriteFile_Native (IntPtr opaque, IntPtr stream, IntPtr buffer, /* ulong */ IntPtr size)
+               unsafe uint WriteFile_Native32 (IntPtr opaque, IntPtr stream, IntPtr buffer, /* ulong */ uint size)
+               {
+                       return (uint) WriteFile_Native64 (opaque, stream, buffer, size);
+               }
+
+               unsafe ulong WriteFile_Native64 (IntPtr opaque, IntPtr stream, IntPtr buffer, /* ulong */ ulong size)
                {
-                       int count = size.ToInt32 ();
+                       int count = (int) size;
                        byte[] b = new byte[count];
 
                        byte* ptrBuffer = (byte*) buffer.ToPointer ();
@@ -196,7 +224,7 @@ namespace zipsharp
                                
                        }
 
-                       return new IntPtr (count);
+                       return (ulong) count;
                }
        }
 }
index 3f22e653c194bb21bb73162180d68468beb1be8e..f01e0b18164ae532270648e0c0d9ca2a3144a347 100644 (file)
@@ -28,7 +28,6 @@ LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)
 ifndef SKIP_AOT
 
 ifdef PLATFORM_AOT_SUFFIX
-Q_AOT=$(if $(V),,@echo "AOT     [$(PROFILE)] $(notdir $(@))";)
 $(mcs_aot_image): $(mcs_exe) $(mscorlib_dll) $(runtime_dep)
        $(Q_AOT) MONO_PATH='$(the_libdir)' > $(PROFILE)_aot.log 2>&1 $(RUNTIME) --aot=bind-to-runtime-version,outfile=$(mcs_aot_image) --debug $(mcs_exe) || cat $(PROFILE)_aot.log || (cat $(PROFILE)_aot.log; exit 1)
 
index 3c68cceb82bd865d74cc309f0221d75921bfc667..6dc94160d19aa713ed172469e82102f8c9396bbd 100644 (file)
@@ -59,7 +59,7 @@ using System.Runtime.InteropServices;
 [assembly: CLSCompliant (true)]
 
 [assembly: AssemblyDelaySign (true)]
-#if NET_2_1
+#if MOBILE
        [assembly: AssemblyKeyFile ("../silverlight.pub")]
 #else
        [assembly: AssemblyKeyFile ("../ecma.pub")]
@@ -83,6 +83,7 @@ using System.Runtime.InteropServices;
 [assembly: InternalsVisibleTo ("Xamarin.TVOS, PublicKey=0024000004800000940000000602000000240000525341310004000011000000438ac2a5acfbf16cbd2b2b47a62762f273df9cb2795ceccdf77d10bf508e69e7a362ea7a45455bbf3ac955e1f2e2814f144e5d817efc4c6502cc012df310783348304e3ae38573c6d658c234025821fda87a0be8a0d504df564e2c93b2b878925f42503e9d54dfef9f9586d9e6f38a305769587b1de01f6c0410328b2c9733db")]
 #elif MONOTOUCH_WATCH
 [assembly: InternalsVisibleTo ("Xamarin.WatchOS, PublicKey=0024000004800000940000000602000000240000525341310004000011000000438ac2a5acfbf16cbd2b2b47a62762f273df9cb2795ceccdf77d10bf508e69e7a362ea7a45455bbf3ac955e1f2e2814f144e5d817efc4c6502cc012df310783348304e3ae38573c6d658c234025821fda87a0be8a0d504df564e2c93b2b878925f42503e9d54dfef9f9586d9e6f38a305769587b1de01f6c0410328b2c9733db")]
+[assembly: InternalsVisibleTo ("System.Security, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")]
 #else
 [assembly: InternalsVisibleTo ("monotouch, PublicKey=0024000004800000940000000602000000240000525341310004000011000000438ac2a5acfbf16cbd2b2b47a62762f273df9cb2795ceccdf77d10bf508e69e7a362ea7a45455bbf3ac955e1f2e2814f144e5d817efc4c6502cc012df310783348304e3ae38573c6d658c234025821fda87a0be8a0d504df564e2c93b2b878925f42503e9d54dfef9f9586d9e6f38a305769587b1de01f6c0410328b2c9733db")]
 [assembly: InternalsVisibleTo ("Xamarin.iOS, PublicKey=0024000004800000940000000602000000240000525341310004000011000000438ac2a5acfbf16cbd2b2b47a62762f273df9cb2795ceccdf77d10bf508e69e7a362ea7a45455bbf3ac955e1f2e2814f144e5d817efc4c6502cc012df310783348304e3ae38573c6d658c234025821fda87a0be8a0d504df564e2c93b2b878925f42503e9d54dfef9f9586d9e6f38a305769587b1de01f6c0410328b2c9733db")]
@@ -94,5 +95,4 @@ using System.Runtime.InteropServices;
 [assembly: InternalsVisibleTo ("Xamarin.Mac, PublicKey=0024000004800000940000000602000000240000525341310004000011000000438ac2a5acfbf16cbd2b2b47a62762f273df9cb2795ceccdf77d10bf508e69e7a362ea7a45455bbf3ac955e1f2e2814f144e5d817efc4c6502cc012df310783348304e3ae38573c6d658c234025821fda87a0be8a0d504df564e2c93b2b878925f42503e9d54dfef9f9586d9e6f38a305769587b1de01f6c0410328b2c9733db")]
 #endif
 
-[assembly: InternalsVisibleTo ("Xamarin.BoringTls, PublicKey=002400000480000094000000060200000024000052534131000400001100000099dd12eda85767ae6f06023ee28e711c7e5a212462095c83868c29db75eddf6d8e296e03824c14fedd5f55553fed0b6173be3cc985a4b7f9fb7c83ccff8ba3938563b3d1f45a81122f12a1bcb73edcaad61a8456c7595a6da5184b4dd9d10f011b949ef1391fccfeab1ba62aa51c267ef8bd57ef1b6ba5a4c515d0badb81a78f")]
 [assembly: Guid ("BED7F4EA-1A96-11D2-8F08-00A0C9A6186D")]
index a112faf5570d99236ce2888b1c778a061d6dc4cf..a35fe1dc666eb5bcfb05e1e1fca35b2a7c611c7c 100644 (file)
@@ -39,6 +39,18 @@ namespace System.Security.Cryptography {
                {
                }
                
+               public RNGCryptoServiceProvider (byte[] rgb)
+               {
+               }
+
+               public RNGCryptoServiceProvider (CspParameters cspParams)
+               {
+               }
+
+               public RNGCryptoServiceProvider (string str) 
+               {
+               }
+
                ~RNGCryptoServiceProvider () 
                {
                }
diff --git a/mcs/class/corlib/Documentation/s b/mcs/class/corlib/Documentation/s
deleted file mode 100644 (file)
index aa4de65..0000000
+++ /dev/null
@@ -1,1374 +0,0 @@
-?      s
-?      en/System.Collections.Concurrent
-?      en/ns-System.Threading.Tasks.xml
-?      en/ns-System.Collections.Concurrent.xml
-?      en/ns-System.Diagnostics.Contracts.xml
-?      en/System.Threading.Tasks
-?      en/ns-.xml
-?      en/System.Diagnostics.Contracts.Internal
-?      en/ns-System.Diagnostics.Contracts.Internal.xml
-?      en/System.Diagnostics.Contracts
-M      en/System.Runtime.InteropServices.Expando/IExpando.xml
-?      en/System.Runtime.Versioning/TargetFrameworkAttribute.xml
-M      en/System.Runtime.Versioning/ResourceScope.xml
-M      en/System.Runtime.Versioning/VersioningHelper.xml
-M      en/System.Runtime.Versioning/ResourceExposureAttribute.xml
-M      en/System.Runtime.Versioning/ResourceConsumptionAttribute.xml
-?      en/System.Threading/CountdownEvent.xml
-?      en/System.Threading/CancellationTokenRegistration.xml
-?      en/System.Threading/SpinWait.xml
-?      en/System.Threading/ThreadLocal`1.xml
-?      en/System.Threading/SemaphoreSlim.xml
-?      en/System.Threading/SpinLock.xml
-?      en/System.Threading/LazyInitializer.xml
-?      en/System.Threading/SemaphoreFullException.xml
-?      en/System.Threading/LazyThreadSafetyMode.xml
-?      en/System.Threading/CancellationToken.xml
-?      en/System.Threading/LockRecursionException.xml
-?      en/System.Threading/ManualResetEventSlim.xml
-?      en/System.Threading/CancellationTokenSource.xml
-M      en/System.Threading/WaitHandle.xml
-M      en/System.Threading/WaitCallback.xml
-M      en/System.Threading/EventWaitHandle.xml
-M      en/System.Threading/LockCookie.xml
-M      en/System.Threading/SynchronizationLockException.xml
-M      en/System.Threading/EventResetMode.xml
-M      en/System.Threading/RegisteredWaitHandle.xml
-M      en/System.Threading/ThreadPool.xml
-M      en/System.Threading/Overlapped.xml
-M      en/System.Threading/HostExecutionContextManager.xml
-M      en/System.Threading/ParameterizedThreadStart.xml
-M      en/System.Threading/ThreadStartException.xml
-M      en/System.Threading/SynchronizationContext.xml
-M      en/System.Threading/AsyncFlowControl.xml
-M      en/System.Threading/HostExecutionContext.xml
-M      en/System.Threading/Thread.xml
-M      en/System.Threading/ExecutionContext.xml
-M      en/System.Threading/ThreadState.xml
-M      en/System.Threading/ThreadPriority.xml
-M      en/System.Threading/ThreadInterruptedException.xml
-M      en/System.Threading/IOCompletionCallback.xml
-M      en/System.Threading/Timer.xml
-M      en/System.Threading/ManualResetEvent.xml
-M      en/System.Threading/WaitOrTimerCallback.xml
-M      en/System.Threading/ThreadStart.xml
-M      en/System.Threading/Timeout.xml
-M      en/System.Threading/Monitor.xml
-M      en/System.Threading/ThreadStateException.xml
-M      en/System.Threading/CompressedStack.xml
-M      en/System.Threading/ApartmentState.xml
-M      en/System.Threading/TimerCallback.xml
-M      en/System.Threading/ContextCallback.xml
-M      en/System.Threading/Mutex.xml
-M      en/System.Threading/Interlocked.xml
-M      en/System.Threading/WaitHandleCannotBeOpenedException.xml
-M      en/System.Threading/ReaderWriterLock.xml
-M      en/System.Threading/NativeOverlapped.xml
-M      en/System.Threading/SendOrPostCallback.xml
-M      en/System.Threading/AbandonedMutexException.xml
-M      en/System.Threading/AutoResetEvent.xml
-M      en/System.Threading/ThreadAbortException.xml
-M      en/System.Runtime.Serialization.Formatters.Binary/BinaryFormatter.xml
-?      en/System.Security/SecurityContextSource.xml
-?      en/System.Security/SecurityRulesAttribute.xml
-?      en/System.Security/SecurityRuleSet.xml
-?      en/System.Security/SecurityState.xml
-M      en/System.Security/SecurityElement.xml
-M      en/System.Security/IEvidenceFactory.xml
-M      en/System.Security/SecurityException.xml
-M      en/System.Security/XmlSyntaxException.xml
-M      en/System.Security/PolicyLevelType.xml
-M      en/System.Security/UnverifiableCodeAttribute.xml
-M      en/System.Security/IStackWalk.xml
-M      en/System.Security/ISecurityPolicyEncodable.xml
-M      en/System.Security/HostSecurityManager.xml
-M      en/System.Security/IPermission.xml
-M      en/System.Security/VerificationException.xml
-M      en/System.Security/SecurityManager.xml
-M      en/System.Security/HostProtectionException.xml
-M      en/System.Security/SecurityZone.xml
-M      en/System.Security/PermissionSet.xml
-M      en/System.Security/CodeAccessPermission.xml
-M      en/System.Security/AllowPartiallyTrustedCallersAttribute.xml
-M      en/System.Security/SecuritySafeCriticalAttribute.xml
-M      en/System.Security/SecurityCriticalAttribute.xml
-M      en/System.Security/NamedPermissionSet.xml
-M      en/System.Security/SuppressUnmanagedCodeSecurityAttribute.xml
-M      en/System.Security/SecurityContext.xml
-M      en/System.Security/HostSecurityManagerOptions.xml
-M      en/System.Security/SecurityCriticalScope.xml
-M      en/System.Security/SecureString.xml
-M      en/System.Security/ISecurityEncodable.xml
-M      en/System.Security/SecurityTransparentAttribute.xml
-M      en/System.Security/SecurityTreatAsSafeAttribute.xml
-?      en/System.Security.AccessControl/ObjectSecurity`1.xml
-M      en/System.Security.AccessControl/ObjectAccessRule.xml
-M      en/System.Security.AccessControl/RegistryAccessRule.xml
-M      en/System.Security.AccessControl/MutexRights.xml
-M      en/System.Security.AccessControl/CustomAce.xml
-M      en/System.Security.AccessControl/DirectoryObjectSecurity.xml
-M      en/System.Security.AccessControl/GenericAce.xml
-M      en/System.Security.AccessControl/RegistryRights.xml
-M      en/System.Security.AccessControl/MutexSecurity.xml
-M      en/System.Security.AccessControl/AceQualifier.xml
-M      en/System.Security.AccessControl/AceEnumerator.xml
-M      en/System.Security.AccessControl/GenericAcl.xml
-M      en/System.Security.AccessControl/EventWaitHandleAccessRule.xml
-M      en/System.Security.AccessControl/ObjectSecurity.xml
-M      en/System.Security.AccessControl/FileSystemAccessRule.xml
-M      en/System.Security.AccessControl/RegistrySecurity.xml
-M      en/System.Security.AccessControl/EventWaitHandleRights.xml
-M      en/System.Security.AccessControl/SystemAcl.xml
-M      en/System.Security.AccessControl/AuthorizationRuleCollection.xml
-M      en/System.Security.AccessControl/AccessControlType.xml
-M      en/System.Security.AccessControl/FileSystemRights.xml
-M      en/System.Security.AccessControl/SecurityInfos.xml
-M      en/System.Security.AccessControl/CommonObjectSecurity.xml
-M      en/System.Security.AccessControl/RawAcl.xml
-M      en/System.Security.AccessControl/AccessControlSections.xml
-M      en/System.Security.AccessControl/EventWaitHandleSecurity.xml
-M      en/System.Security.AccessControl/FileSystemSecurity.xml
-M      en/System.Security.AccessControl/CommonSecurityDescriptor.xml
-M      en/System.Security.AccessControl/CryptoKeySecurity.xml
-M      en/System.Security.AccessControl/PrivilegeNotHeldException.xml
-M      en/System.Security.AccessControl/AccessControlActions.xml
-M      en/System.Security.AccessControl/RegistryAuditRule.xml
-M      en/System.Security.AccessControl/AuthorizationRule.xml
-M      en/System.Security.AccessControl/AccessControlModification.xml
-M      en/System.Security.AccessControl/ResourceType.xml
-M      en/System.Security.AccessControl/AccessRule.xml
-M      en/System.Security.AccessControl/DirectorySecurity.xml
-M      en/System.Security.AccessControl/CompoundAceType.xml
-M      en/System.Security.AccessControl/DiscretionaryAcl.xml
-M      en/System.Security.AccessControl/CommonAce.xml
-M      en/System.Security.AccessControl/FileSystemAuditRule.xml
-M      en/System.Security.AccessControl/AceFlags.xml
-M      en/System.Security.AccessControl/CommonAcl.xml
-M      en/System.Security.AccessControl/ObjectAce.xml
-M      en/System.Security.AccessControl/AuditFlags.xml
-M      en/System.Security.AccessControl/ObjectAceFlags.xml
-M      en/System.Security.AccessControl/CompoundAce.xml
-M      en/System.Security.AccessControl/CryptoKeyAccessRule.xml
-M      en/System.Security.AccessControl/KnownAce.xml
-M      en/System.Security.AccessControl/InheritanceFlags.xml
-M      en/System.Security.AccessControl/CryptoKeyAuditRule.xml
-M      en/System.Security.AccessControl/CryptoKeyRights.xml
-M      en/System.Security.AccessControl/QualifiedAce.xml
-M      en/System.Security.AccessControl/RawSecurityDescriptor.xml
-M      en/System.Security.AccessControl/MutexAuditRule.xml
-M      en/System.Security.AccessControl/ObjectAuditRule.xml
-M      en/System.Security.AccessControl/AceType.xml
-M      en/System.Security.AccessControl/ControlFlags.xml
-M      en/System.Security.AccessControl/AuditRule.xml
-M      en/System.Security.AccessControl/PropagationFlags.xml
-M      en/System.Security.AccessControl/EventWaitHandleAuditRule.xml
-M      en/System.Security.AccessControl/GenericSecurityDescriptor.xml
-M      en/System.Security.AccessControl/NativeObjectSecurity.xml
-M      en/System.Security.AccessControl/FileSecurity.xml
-M      en/System.Security.AccessControl/MutexAccessRule.xml
-M      en/System.Security.Permissions/PublisherIdentityPermission.xml
-M      en/System.Security.Permissions/SecurityPermission.xml
-M      en/System.Security.Permissions/KeyContainerPermissionFlags.xml
-M      en/System.Security.Permissions/RegistryPermission.xml
-M      en/System.Security.Permissions/StrongNameIdentityPermissionAttribute.xml
-M      en/System.Security.Permissions/IsolatedStoragePermissionAttribute.xml
-M      en/System.Security.Permissions/IsolatedStorageFilePermissionAttribute.xml
-M      en/System.Security.Permissions/PermissionState.xml
-M      en/System.Security.Permissions/IsolatedStorageContainment.xml
-M      en/System.Security.Permissions/PrincipalPermission.xml
-M      en/System.Security.Permissions/FileDialogPermissionAttribute.xml
-M      en/System.Security.Permissions/HostProtectionResource.xml
-M      en/System.Security.Permissions/ReflectionPermissionFlag.xml
-M      en/System.Security.Permissions/ZoneIdentityPermission.xml
-M      en/System.Security.Permissions/EnvironmentPermissionAccess.xml
-M      en/System.Security.Permissions/EnvironmentPermissionAttribute.xml
-M      en/System.Security.Permissions/GacIdentityPermissionAttribute.xml
-M      en/System.Security.Permissions/FileIOPermissionAccess.xml
-M      en/System.Security.Permissions/PublisherIdentityPermissionAttribute.xml
-M      en/System.Security.Permissions/KeyContainerPermission.xml
-M      en/System.Security.Permissions/SecurityPermissionAttribute.xml
-M      en/System.Security.Permissions/SecurityAction.xml
-M      en/System.Security.Permissions/CodeAccessSecurityAttribute.xml
-M      en/System.Security.Permissions/UrlIdentityPermissionAttribute.xml
-M      en/System.Security.Permissions/SecurityPermissionFlag.xml
-M      en/System.Security.Permissions/SiteIdentityPermissionAttribute.xml
-M      en/System.Security.Permissions/EnvironmentPermission.xml
-M      en/System.Security.Permissions/GacIdentityPermission.xml
-M      en/System.Security.Permissions/PrincipalPermissionAttribute.xml
-M      en/System.Security.Permissions/UIPermissionWindow.xml
-M      en/System.Security.Permissions/FileIOPermission.xml
-M      en/System.Security.Permissions/ZoneIdentityPermissionAttribute.xml
-M      en/System.Security.Permissions/KeyContainerPermissionAccessEntryCollection.xml
-M      en/System.Security.Permissions/StrongNamePublicKeyBlob.xml
-M      en/System.Security.Permissions/UrlIdentityPermission.xml
-M      en/System.Security.Permissions/UIPermission.xml
-M      en/System.Security.Permissions/ReflectionPermissionAttribute.xml
-M      en/System.Security.Permissions/SiteIdentityPermission.xml
-M      en/System.Security.Permissions/PermissionSetAttribute.xml
-M      en/System.Security.Permissions/KeyContainerPermissionAttribute.xml
-M      en/System.Security.Permissions/FileDialogPermissionAccess.xml
-M      en/System.Security.Permissions/SecurityAttribute.xml
-M      en/System.Security.Permissions/IUnrestrictedPermission.xml
-M      en/System.Security.Permissions/StrongNameIdentityPermission.xml
-M      en/System.Security.Permissions/IsolatedStoragePermission.xml
-M      en/System.Security.Permissions/IsolatedStorageFilePermission.xml
-M      en/System.Security.Permissions/ReflectionPermission.xml
-M      en/System.Security.Permissions/RegistryPermissionAccess.xml
-M      en/System.Security.Permissions/FileIOPermissionAttribute.xml
-M      en/System.Security.Permissions/RegistryPermissionAttribute.xml
-M      en/System.Security.Permissions/UIPermissionClipboard.xml
-M      en/System.Security.Permissions/KeyContainerPermissionAccessEntry.xml
-M      en/System.Security.Permissions/FileDialogPermission.xml
-M      en/System.Security.Permissions/HostProtectionAttribute.xml
-M      en/System.Security.Permissions/KeyContainerPermissionAccessEntryEnumerator.xml
-M      en/System.Security.Permissions/UIPermissionAttribute.xml
-M      en/System.Runtime.Remoting.Messaging/CallContext.xml
-M      en/System.Runtime.Remoting.Messaging/IRemotingFormatter.xml
-M      en/System.Runtime.Remoting.Messaging/RemotingSurrogateSelector.xml
-M      en/System.Runtime.Remoting.Messaging/InternalMessageWrapper.xml
-M      en/System.Runtime.Remoting.Messaging/IMessageSink.xml
-M      en/System.Runtime.Remoting.Messaging/IMessageCtrl.xml
-M      en/System.Runtime.Remoting.Messaging/MethodCallMessageWrapper.xml
-M      en/System.Runtime.Remoting.Messaging/ReturnMessage.xml
-M      en/System.Runtime.Remoting.Messaging/HeaderHandler.xml
-M      en/System.Runtime.Remoting.Messaging/ConstructionCall.xml
-M      en/System.Runtime.Remoting.Messaging/MessageSurrogateFilter.xml
-M      en/System.Runtime.Remoting.Messaging/MethodReturnMessageWrapper.xml
-M      en/System.Runtime.Remoting.Messaging/OneWayAttribute.xml
-M      en/System.Runtime.Remoting.Messaging/Header.xml
-M      en/System.Runtime.Remoting.Messaging/IMethodCallMessage.xml
-M      en/System.Runtime.Remoting.Messaging/IMessage.xml
-M      en/System.Runtime.Remoting.Messaging/IMethodReturnMessage.xml
-M      en/System.Runtime.Remoting.Messaging/IMethodMessage.xml
-M      en/System.Runtime.Remoting.Messaging/MethodResponse.xml
-M      en/System.Runtime.Remoting.Messaging/ILogicalThreadAffinative.xml
-M      en/System.Runtime.Remoting.Messaging/ConstructionResponse.xml
-M      en/System.Runtime.Remoting.Messaging/LogicalCallContext.xml
-M      en/System.Runtime.Remoting.Messaging/AsyncResult.xml
-M      en/System.Runtime.Remoting.Messaging/MethodCall.xml
-M      en/System.Security.Principal/TokenImpersonationLevel.xml
-M      en/System.Security.Principal/IdentityNotMappedException.xml
-M      en/System.Security.Principal/WellKnownSidType.xml
-M      en/System.Security.Principal/IdentityReferenceCollection.xml
-M      en/System.Security.Principal/GenericIdentity.xml
-M      en/System.Security.Principal/IPrincipal.xml
-M      en/System.Security.Principal/WindowsPrincipal.xml
-M      en/System.Security.Principal/NTAccount.xml
-M      en/System.Security.Principal/PrincipalPolicy.xml
-M      en/System.Security.Principal/IIdentity.xml
-M      en/System.Security.Principal/WindowsBuiltInRole.xml
-M      en/System.Security.Principal/WindowsIdentity.xml
-M      en/System.Security.Principal/WindowsImpersonationContext.xml
-M      en/System.Security.Principal/IdentityReference.xml
-M      en/System.Security.Principal/WindowsAccountType.xml
-M      en/System.Security.Principal/SecurityIdentifier.xml
-M      en/System.Security.Principal/TokenAccessLevels.xml
-M      en/System.Security.Principal/GenericPrincipal.xml
-M      en/System.Diagnostics.SymbolStore/ISymbolBinder1.xml
-M      en/System.Diagnostics.SymbolStore/ISymbolVariable.xml
-M      en/System.Diagnostics.SymbolStore/SymAddressKind.xml
-M      en/System.Diagnostics.SymbolStore/SymLanguageVendor.xml
-M      en/System.Diagnostics.SymbolStore/ISymbolNamespace.xml
-M      en/System.Diagnostics.SymbolStore/ISymbolReader.xml
-M      en/System.Diagnostics.SymbolStore/ISymbolBinder.xml
-M      en/System.Diagnostics.SymbolStore/SymbolToken.xml
-M      en/System.Diagnostics.SymbolStore/ISymbolScope.xml
-M      en/System.Diagnostics.SymbolStore/SymDocumentType.xml
-M      en/System.Diagnostics.SymbolStore/ISymbolDocumentWriter.xml
-M      en/System.Diagnostics.SymbolStore/ISymbolWriter.xml
-M      en/System.Diagnostics.SymbolStore/ISymbolDocument.xml
-M      en/System.Diagnostics.SymbolStore/SymLanguageType.xml
-M      en/System.Diagnostics.SymbolStore/ISymbolMethod.xml
-M      en/System.Runtime.Hosting/ApplicationActivator.xml
-M      en/System.Runtime.Hosting/ActivationArguments.xml
-M      en/System.Configuration.Assemblies/AssemblyHash.xml
-M      en/System.Configuration.Assemblies/AssemblyHashAlgorithm.xml
-M      en/System.Configuration.Assemblies/AssemblyVersionCompatibility.xml
-?      en/Microsoft.Win32.SafeHandles/SafeRegistryHandle.xml
-M      en/Microsoft.Win32.SafeHandles/CriticalHandleMinusOneIsInvalid.xml
-M      en/Microsoft.Win32.SafeHandles/CriticalHandleZeroOrMinusOneIsInvalid.xml
-M      en/Microsoft.Win32.SafeHandles/SafeFileHandle.xml
-M      en/Microsoft.Win32.SafeHandles/SafeHandleMinusOneIsInvalid.xml
-M      en/Microsoft.Win32.SafeHandles/SafeHandleZeroOrMinusOneIsInvalid.xml
-M      en/Microsoft.Win32.SafeHandles/SafeWaitHandle.xml
-?      en/System.Runtime.Serialization/SafeSerializationEventArgs.xml
-?      en/System.Runtime.Serialization/ISafeSerializationData.xml
-M      en/System.Runtime.Serialization/ISerializationSurrogate.xml
-M      en/System.Runtime.Serialization/StreamingContextStates.xml
-M      en/System.Runtime.Serialization/OnDeserializedAttribute.xml
-M      en/System.Runtime.Serialization/ISurrogateSelector.xml
-M      en/System.Runtime.Serialization/SerializationInfo.xml
-M      en/System.Runtime.Serialization/ObjectIDGenerator.xml
-M      en/System.Runtime.Serialization/FormatterConverter.xml
-M      en/System.Runtime.Serialization/SerializationInfoEnumerator.xml
-M      en/System.Runtime.Serialization/SerializationException.xml
-M      en/System.Runtime.Serialization/IObjectReference.xml
-M      en/System.Runtime.Serialization/StreamingContext.xml
-M      en/System.Runtime.Serialization/SerializationEntry.xml
-M      en/System.Runtime.Serialization/SerializationObjectManager.xml
-M      en/System.Runtime.Serialization/OnSerializingAttribute.xml
-M      en/System.Runtime.Serialization/ObjectManager.xml
-M      en/System.Runtime.Serialization/SerializationBinder.xml
-M      en/System.Runtime.Serialization/Formatter.xml
-M      en/System.Runtime.Serialization/IFormatterConverter.xml
-M      en/System.Runtime.Serialization/FormatterServices.xml
-M      en/System.Runtime.Serialization/OnDeserializingAttribute.xml
-M      en/System.Runtime.Serialization/OnSerializedAttribute.xml
-M      en/System.Runtime.Serialization/IFormatter.xml
-M      en/System.Runtime.Serialization/IDeserializationCallback.xml
-M      en/System.Runtime.Serialization/SurrogateSelector.xml
-M      en/System.Runtime.Serialization/OptionalFieldAttribute.xml
-M      en/System.Runtime.Serialization/ISerializable.xml
-?      en/System/Lazy`1.xml
-?      en/System/Action`3.xml
-?      en/System/Action`5.xml
-?      en/System/Action`7.xml
-?      en/System/Environment+SpecialFolderOption.xml
-?      en/System/TypeAccessException.xml
-?      en/System/Func`1.xml
-?      en/System/Func`3.xml
-?      en/System/Func`5.xml
-?      en/System/Func`7.xml
-?      en/System/Func`9.xml
-?      en/System/Tuple`1.xml
-?      en/System/TimeZoneInfo+TransitionTime.xml
-?      en/System/Tuple`3.xml
-?      en/System/IObservable`1.xml
-?      en/System/Tuple`5.xml
-?      en/System/InsufficientExecutionStackException.xml
-?      en/System/Tuple`7.xml
-?      en/System/TimeZoneInfo+AdjustmentRule.xml
-?      en/System/Action.xml
-?      en/System/Action`2.xml
-?      en/System/Action`4.xml
-?      en/System/Action`6.xml
-?      en/System/Action`8.xml
-?      en/System/IObserver`1.xml
-?      en/System/TimeZoneNotFoundException.xml
-?      en/System/Func`2.xml
-?      en/System/Func`4.xml
-?      en/System/Func`6.xml
-?      en/System/Func`8.xml
-?      en/System/Tuple.xml
-?      en/System/GCNotificationStatus.xml
-?      en/System/TimeZoneInfo.xml
-?      en/System/Tuple`2.xml
-?      en/System/Tuple`4.xml
-?      en/System/Tuple`6.xml
-?      en/System/InvalidTimeZoneException.xml
-?      en/System/Tuple`8.xml
-?      en/System/AggregateException.xml
-M      en/System/UnhandledExceptionEventHandler.xml
-M      en/System/ApplicationException.xml
-M      en/System/UInt32.xml
-M      en/System/InvalidOperationException.xml
-M      en/System/ConsoleKeyInfo.xml
-M      en/System/Activator.xml
-M      en/System/Action`1.xml
-M      en/System/Int32.xml
-M      en/System/TypeLoadException.xml
-M      en/System/LoaderOptimizationAttribute.xml
-M      en/System/ConsoleColor.xml
-M      en/System/Void.xml
-M      en/System/Environment.xml
-M      en/System/NullReferenceException.xml
-M      en/System/Double.xml
-M      en/System/AttributeUsageAttribute.xml
-M      en/System/TypeCode.xml
-M      en/System/Char.xml
-M      en/System/IComparable.xml
-M      en/System/MissingMemberException.xml
-M      en/System/IndexOutOfRangeException.xml
-M      en/System/Convert.xml
-M      en/System/Random.xml
-M      en/System/TimeSpan.xml
-M      en/System/BadImageFormatException.xml
-M      en/System/Predicate`1.xml
-M      en/System/ArrayTypeMismatchException.xml
-M      en/System/Version.xml
-M      en/System/MissingMethodException.xml
-M      en/System/TimeZone.xml
-M      en/System/Comparison`1.xml
-M      en/System/MTAThreadAttribute.xml
-M      en/System/AttributeTargets.xml
-M      en/System/InsufficientMemoryException.xml
-M      en/System/StringComparer.xml
-M      en/System/ContextBoundObject.xml
-M      en/System/DateTimeOffset.xml
-M      en/System/OutOfMemoryException.xml
-M      en/System/TimeoutException.xml
-M      en/System/ActivationContext.xml
-M      en/System/TypeInitializationException.xml
-M      en/System/MulticastNotSupportedException.xml
-M      en/System/ObjectDisposedException.xml
-M      en/System/OverflowException.xml
-M      en/System/ParamArrayAttribute.xml
-M      en/System/IServiceProvider.xml
-M      en/System/IAsyncResult.xml
-M      en/System/ResolveEventArgs.xml
-M      en/System/IAppDomainSetup.xml
-M      en/System/RuntimeFieldHandle.xml
-M      en/System/SystemException.xml
-M      en/System/ConsoleModifiers.xml
-M      en/System/_AppDomain.xml
-M      en/System/ExecutionEngineException.xml
-M      en/System/ArithmeticException.xml
-M      en/System/RankException.xml
-M      en/System/Environment+SpecialFolder.xml
-M      en/System/ConsoleSpecialKey.xml
-M      en/System/EventHandler.xml
-M      en/System/Boolean.xml
-M      en/System/InvalidCastException.xml
-M      en/System/Guid.xml
-M      en/System/PlatformNotSupportedException.xml
-M      en/System/MissingFieldException.xml
-M      en/System/OperatingSystem.xml
-M      en/System/AssemblyLoadEventArgs.xml
-M      en/System/ObsoleteAttribute.xml
-M      en/System/MulticastDelegate.xml
-M      en/System/EventHandler`1.xml
-M      en/System/RuntimeMethodHandle.xml
-M      en/System/PlatformID.xml
-M      en/System/AppDomainUnloadedException.xml
-M      en/System/Byte.xml
-M      en/System/Enum.xml
-M      en/System/UIntPtr.xml
-M      en/System/BitConverter.xml
-M      en/System/CrossAppDomainDelegate.xml
-M      en/System/FlagsAttribute.xml
-M      en/System/DBNull.xml
-M      en/System/ArraySegment`1.xml
-M      en/System/ArgIterator.xml
-M      en/System/FieldAccessException.xml
-M      en/System/Math.xml
-M      en/System/NonSerializedAttribute.xml
-M      en/System/SerializableAttribute.xml
-M      en/System/DateTime.xml
-M      en/System/Exception.xml
-M      en/System/OperationCanceledException.xml
-M      en/System/ThreadStaticAttribute.xml
-M      en/System/DllNotFoundException.xml
-M      en/System/AppDomain.xml
-M      en/System/StackOverflowException.xml
-M      en/System/GCCollectionMode.xml
-M      en/System/ActivationContext+ContextForm.xml
-M      en/System/Delegate.xml
-M      en/System/ApplicationId.xml
-M      en/System/EnvironmentVariableTarget.xml
-M      en/System/Single.xml
-M      en/System/UnauthorizedAccessException.xml
-M      en/System/NotSupportedException.xml
-M      en/System/InvalidProgramException.xml
-M      en/System/ICloneable.xml
-M      en/System/StringSplitOptions.xml
-M      en/System/ModuleHandle.xml
-M      en/System/RuntimeTypeHandle.xml
-M      en/System/StringComparison.xml
-M      en/System/Console.xml
-M      en/System/DateTimeKind.xml
-M      en/System/NotImplementedException.xml
-M      en/System/MarshalByRefObject.xml
-M      en/System/WeakReference.xml
-M      en/System/ConsoleCancelEventHandler.xml
-M      en/System/ContextMarshalException.xml
-M      en/System/CLSCompliantAttribute.xml
-M      en/System/TypeUnloadedException.xml
-M      en/System/Array.xml
-M      en/System/DayOfWeek.xml
-M      en/System/ValueType.xml
-M      en/System/Nullable`1.xml
-M      en/System/ResolveEventHandler.xml
-M      en/System/ContextStaticAttribute.xml
-M      en/System/MethodAccessException.xml
-M      en/System/Type.xml
-M      en/System/IConvertible.xml
-M      en/System/SByte.xml
-M      en/System/UInt16.xml
-M      en/System/NotFiniteNumberException.xml
-M      en/System/MidpointRounding.xml
-M      en/System/GC.xml
-M      en/System/AppDomainSetup.xml
-M      en/System/AsyncCallback.xml
-M      en/System/ArgumentOutOfRangeException.xml
-M      en/System/ArgumentNullException.xml
-M      en/System/IEquatable`1.xml
-M      en/System/IDisposable.xml
-M      en/System/UnhandledExceptionEventArgs.xml
-M      en/System/Int16.xml
-M      en/System/ArgumentException.xml
-M      en/System/LocalDataStoreSlot.xml
-M      en/System/Attribute.xml
-M      en/System/AppDomainManager.xml
-M      en/System/AccessViolationException.xml
-M      en/System/ICustomFormatter.xml
-M      en/System/IFormattable.xml
-M      en/System/Buffer.xml
-M      en/System/ConsoleKey.xml
-M      en/System/IFormatProvider.xml
-M      en/System/AppDomainInitializer.xml
-M      en/System/LoaderOptimization.xml
-M      en/System/ApplicationIdentity.xml
-M      en/System/AssemblyLoadEventHandler.xml
-M      en/System/CharEnumerator.xml
-M      en/System/IntPtr.xml
-M      en/System/DataMisalignedException.xml
-M      en/System/AppDomainManagerInitializationOptions.xml
-M      en/System/ConsoleCancelEventArgs.xml
-M      en/System/Converter`2.xml
-M      en/System/UInt64.xml
-M      en/System/Base64FormattingOptions.xml
-M      en/System/CannotUnloadAppDomainException.xml
-M      en/System/Nullable.xml
-M      en/System/EventArgs.xml
-M      en/System/Decimal.xml
-M      en/System/IComparable`1.xml
-M      en/System/RuntimeArgumentHandle.xml
-M      en/System/STAThreadAttribute.xml
-M      en/System/Int64.xml
-M      en/System/TypedReference.xml
-M      en/System/DuplicateWaitObjectException.xml
-M      en/System/Object.xml
-M      en/System/String.xml
-M      en/System/FormatException.xml
-M      en/System/EntryPointNotFoundException.xml
-M      en/System/MemberAccessException.xml
-M      en/System/DivideByZeroException.xml
-?      en/System.Runtime.InteropServices/SafeBuffer.xml
-?      en/System.Runtime.InteropServices/AllowReversePInvokeCallsAttribute.xml
-M      en/System.Runtime.InteropServices/ExporterEventKind.xml
-M      en/System.Runtime.InteropServices/SafeArrayTypeMismatchException.xml
-M      en/System.Runtime.InteropServices/TypeLibTypeFlags.xml
-M      en/System.Runtime.InteropServices/UCOMIEnumString.xml
-M      en/System.Runtime.InteropServices/InAttribute.xml
-M      en/System.Runtime.InteropServices/_EventInfo.xml
-M      en/System.Runtime.InteropServices/_PropertyInfo.xml
-M      en/System.Runtime.InteropServices/FUNCKIND.xml
-M      en/System.Runtime.InteropServices/BINDPTR.xml
-M      en/System.Runtime.InteropServices/UCOMIEnumConnections.xml
-M      en/System.Runtime.InteropServices/ComCompatibleVersionAttribute.xml
-M      en/System.Runtime.InteropServices/ITypeLibConverter.xml
-M      en/System.Runtime.InteropServices/_ILGenerator.xml
-M      en/System.Runtime.InteropServices/FieldOffsetAttribute.xml
-M      en/System.Runtime.InteropServices/TYPEDESC.xml
-M      en/System.Runtime.InteropServices/_Type.xml
-M      en/System.Runtime.InteropServices/ITypeLibImporterNotifySink.xml
-M      en/System.Runtime.InteropServices/DefaultCharSetAttribute.xml
-M      en/System.Runtime.InteropServices/ICustomMarshaler.xml
-M      en/System.Runtime.InteropServices/_MemberInfo.xml
-M      en/System.Runtime.InteropServices/ComDefaultInterfaceAttribute.xml
-M      en/System.Runtime.InteropServices/HandleRef.xml
-M      en/System.Runtime.InteropServices/ITypeLibExporterNotifySink.xml
-M      en/System.Runtime.InteropServices/UnmanagedFunctionPointerAttribute.xml
-M      en/System.Runtime.InteropServices/CurrencyWrapper.xml
-M      en/System.Runtime.InteropServices/TypeLibVarFlags.xml
-M      en/System.Runtime.InteropServices/TYPEFLAGS.xml
-M      en/System.Runtime.InteropServices/SafeArrayRankMismatchException.xml
-M      en/System.Runtime.InteropServices/UnknownWrapper.xml
-M      en/System.Runtime.InteropServices/_ConstructorInfo.xml
-M      en/System.Runtime.InteropServices/ComInterfaceType.xml
-M      en/System.Runtime.InteropServices/CALLCONV.xml
-M      en/System.Runtime.InteropServices/TypeLibVersionAttribute.xml
-M      en/System.Runtime.InteropServices/LCIDConversionAttribute.xml
-M      en/System.Runtime.InteropServices/AutomationProxyAttribute.xml
-M      en/System.Runtime.InteropServices/GCHandleType.xml
-M      en/System.Runtime.InteropServices/OptionalAttribute.xml
-M      en/System.Runtime.InteropServices/VarEnum.xml
-M      en/System.Runtime.InteropServices/UCOMIEnumConnectionPoints.xml
-M      en/System.Runtime.InteropServices/IMPLTYPEFLAGS.xml
-M      en/System.Runtime.InteropServices/PreserveSigAttribute.xml
-M      en/System.Runtime.InteropServices/LayoutKind.xml
-M      en/System.Runtime.InteropServices/CONNECTDATA.xml
-M      en/System.Runtime.InteropServices/ObjectCreationDelegate.xml
-M      en/System.Runtime.InteropServices/ITypeLibExporterNameProvider.xml
-M      en/System.Runtime.InteropServices/ComSourceInterfacesAttribute.xml
-M      en/System.Runtime.InteropServices/AssemblyRegistrationFlags.xml
-M      en/System.Runtime.InteropServices/UCOMIBindCtx.xml
-M      en/System.Runtime.InteropServices/SafeHandle.xml
-M      en/System.Runtime.InteropServices/PARAMFLAG.xml
-M      en/System.Runtime.InteropServices/UCOMITypeComp.xml
-M      en/System.Runtime.InteropServices/_Exception.xml
-M      en/System.Runtime.InteropServices/_FieldInfo.xml
-M      en/System.Runtime.InteropServices/TypeLibConverter.xml
-M      en/System.Runtime.InteropServices/ELEMDESC+DESCUNION.xml
-M      en/System.Runtime.InteropServices/_CustomAttributeBuilder.xml
-M      en/System.Runtime.InteropServices/ClassInterfaceAttribute.xml
-M      en/System.Runtime.InteropServices/ComRegisterFunctionAttribute.xml
-M      en/System.Runtime.InteropServices/RegistrationServices.xml
-M      en/System.Runtime.InteropServices/ArrayWithOffset.xml
-M      en/System.Runtime.InteropServices/ICustomAdapter.xml
-M      en/System.Runtime.InteropServices/InterfaceTypeAttribute.xml
-M      en/System.Runtime.InteropServices/DllImportAttribute.xml
-M      en/System.Runtime.InteropServices/OutAttribute.xml
-M      en/System.Runtime.InteropServices/InvalidComObjectException.xml
-M      en/System.Runtime.InteropServices/_ConstructorBuilder.xml
-M      en/System.Runtime.InteropServices/_ParameterInfo.xml
-M      en/System.Runtime.InteropServices/COMException.xml
-M      en/System.Runtime.InteropServices/DispIdAttribute.xml
-M      en/System.Runtime.InteropServices/DispatchWrapper.xml
-M      en/System.Runtime.InteropServices/ExternalException.xml
-M      en/System.Runtime.InteropServices/INVOKEKIND.xml
-M      en/System.Runtime.InteropServices/IDLFLAG.xml
-M      en/System.Runtime.InteropServices/MarshalDirectiveException.xml
-M      en/System.Runtime.InteropServices/StructLayoutAttribute.xml
-M      en/System.Runtime.InteropServices/_Thread.xml
-M      en/System.Runtime.InteropServices/RuntimeEnvironment.xml
-M      en/System.Runtime.InteropServices/ComConversionLossAttribute.xml
-M      en/System.Runtime.InteropServices/UCOMIRunningObjectTable.xml
-M      en/System.Runtime.InteropServices/CallingConvention.xml
-M      en/System.Runtime.InteropServices/_AssemblyName.xml
-M      en/System.Runtime.InteropServices/ComUnregisterFunctionAttribute.xml
-M      en/System.Runtime.InteropServices/EXCEPINFO.xml
-M      en/System.Runtime.InteropServices/SYSKIND.xml
-M      en/System.Runtime.InteropServices/_AssemblyBuilder.xml
-M      en/System.Runtime.InteropServices/UCOMIPersistFile.xml
-M      en/System.Runtime.InteropServices/_TypeBuilder.xml
-M      en/System.Runtime.InteropServices/UCOMIStream.xml
-M      en/System.Runtime.InteropServices/STATSTG.xml
-M      en/System.Runtime.InteropServices/FUNCDESC.xml
-M      en/System.Runtime.InteropServices/_MethodInfo.xml
-M      en/System.Runtime.InteropServices/FILETIME.xml
-M      en/System.Runtime.InteropServices/PARAMDESC.xml
-M      en/System.Runtime.InteropServices/MarshalAsAttribute.xml
-M      en/System.Runtime.InteropServices/_Attribute.xml
-M      en/System.Runtime.InteropServices/DISPPARAMS.xml
-M      en/System.Runtime.InteropServices/UCOMITypeLib.xml
-M      en/System.Runtime.InteropServices/TypeLibVarAttribute.xml
-M      en/System.Runtime.InteropServices/VARFLAGS.xml
-M      en/System.Runtime.InteropServices/VariantWrapper.xml
-M      en/System.Runtime.InteropServices/TypeLibFuncAttribute.xml
-M      en/System.Runtime.InteropServices/ComAliasNameAttribute.xml
-M      en/System.Runtime.InteropServices/TypeLibExporterFlags.xml
-M      en/System.Runtime.InteropServices/ComVisibleAttribute.xml
-M      en/System.Runtime.InteropServices/BIND_OPTS.xml
-M      en/System.Runtime.InteropServices/TYPEKIND.xml
-M      en/System.Runtime.InteropServices/SetWin32ContextInIDispatchAttribute.xml
-M      en/System.Runtime.InteropServices/IRegistrationServices.xml
-M      en/System.Runtime.InteropServices/VARDESC.xml
-M      en/System.Runtime.InteropServices/_ModuleBuilder.xml
-M      en/System.Runtime.InteropServices/ComImportAttribute.xml
-M      en/System.Runtime.InteropServices/TypeLibFuncFlags.xml
-M      en/System.Runtime.InteropServices/UnmanagedType.xml
-M      en/System.Runtime.InteropServices/TYPELIBATTR.xml
-M      en/System.Runtime.InteropServices/IDLDESC.xml
-M      en/System.Runtime.InteropServices/ProgIdAttribute.xml
-M      en/System.Runtime.InteropServices/PrimaryInteropAssemblyAttribute.xml
-M      en/System.Runtime.InteropServices/ComMemberType.xml
-M      en/System.Runtime.InteropServices/VARDESC+DESCUNION.xml
-M      en/System.Runtime.InteropServices/_MethodBase.xml
-M      en/System.Runtime.InteropServices/CoClassAttribute.xml
-M      en/System.Runtime.InteropServices/ICustomFactory.xml
-M      en/System.Runtime.InteropServices/IDispatchImplAttribute.xml
-M      en/System.Runtime.InteropServices/ExtensibleClassFactory.xml
-M      en/System.Runtime.InteropServices/ELEMDESC.xml
-M      en/System.Runtime.InteropServices/LIBFLAGS.xml
-M      en/System.Runtime.InteropServices/ImportedFromTypeLibAttribute.xml
-M      en/System.Runtime.InteropServices/_Module.xml
-M      en/System.Runtime.InteropServices/UCOMIEnumVARIANT.xml
-M      en/System.Runtime.InteropServices/_ParameterBuilder.xml
-M      en/System.Runtime.InteropServices/Marshal.xml
-M      en/System.Runtime.InteropServices/_EventBuilder.xml
-M      en/System.Runtime.InteropServices/_FieldBuilder.xml
-M      en/System.Runtime.InteropServices/ErrorWrapper.xml
-M      en/System.Runtime.InteropServices/_Activator.xml
-M      en/System.Runtime.InteropServices/RegistrationConnectionType.xml
-M      en/System.Runtime.InteropServices/IDispatchImplType.xml
-M      en/System.Runtime.InteropServices/SEHException.xml
-M      en/System.Runtime.InteropServices/_LocalBuilder.xml
-M      en/System.Runtime.InteropServices/RegistrationClassContext.xml
-M      en/System.Runtime.InteropServices/GCHandle.xml
-M      en/System.Runtime.InteropServices/UCOMIConnectionPoint.xml
-M      en/System.Runtime.InteropServices/CriticalHandle.xml
-M      en/System.Runtime.InteropServices/FUNCFLAGS.xml
-M      en/System.Runtime.InteropServices/ImporterEventKind.xml
-M      en/System.Runtime.InteropServices/_EnumBuilder.xml
-M      en/System.Runtime.InteropServices/TypeLibImportClassAttribute.xml
-M      en/System.Runtime.InteropServices/_Assembly.xml
-M      en/System.Runtime.InteropServices/DESCKIND.xml
-M      en/System.Runtime.InteropServices/ComEventInterfaceAttribute.xml
-M      en/System.Runtime.InteropServices/_MethodRental.xml
-M      en/System.Runtime.InteropServices/UCOMIEnumMoniker.xml
-M      en/System.Runtime.InteropServices/_MethodBuilder.xml
-M      en/System.Runtime.InteropServices/ClassInterfaceType.xml
-M      en/System.Runtime.InteropServices/CharSet.xml
-M      en/System.Runtime.InteropServices/UCOMITypeInfo.xml
-M      en/System.Runtime.InteropServices/_PropertyBuilder.xml
-M      en/System.Runtime.InteropServices/InvalidOleVariantTypeException.xml
-M      en/System.Runtime.InteropServices/TypeLibTypeAttribute.xml
-M      en/System.Runtime.InteropServices/BestFitMappingAttribute.xml
-M      en/System.Runtime.InteropServices/_SignatureHelper.xml
-M      en/System.Runtime.InteropServices/UCOMIMoniker.xml
-M      en/System.Runtime.InteropServices/TypeLibImporterFlags.xml
-M      en/System.Runtime.InteropServices/UCOMIConnectionPointContainer.xml
-M      en/System.Runtime.InteropServices/BStrWrapper.xml
-M      en/System.Runtime.InteropServices/TYPEATTR.xml
-M      en/System.Runtime.InteropServices/GuidAttribute.xml
-M      en/System.Runtime.Remoting.Activation/ActivatorLevel.xml
-M      en/System.Runtime.Remoting.Activation/IConstructionCallMessage.xml
-M      en/System.Runtime.Remoting.Activation/IActivator.xml
-M      en/System.Runtime.Remoting.Activation/UrlAttribute.xml
-M      en/System.Runtime.Remoting.Activation/IConstructionReturnMessage.xml
-M      en/System.Resources/ResourceManager.xml
-M      en/System.Resources/IResourceReader.xml
-M      en/System.Resources/ResourceSet.xml
-M      en/System.Resources/ResourceWriter.xml
-M      en/System.Resources/UltimateResourceFallbackLocation.xml
-M      en/System.Resources/MissingManifestResourceException.xml
-M      en/System.Resources/ResourceReader.xml
-M      en/System.Resources/IResourceWriter.xml
-M      en/System.Resources/NeutralResourcesLanguageAttribute.xml
-M      en/System.Resources/SatelliteContractVersionAttribute.xml
-M      en/System.Resources/MissingSatelliteAssemblyException.xml
-M      en/System.Runtime.Remoting.Contexts/IContributeClientContextSink.xml
-M      en/System.Runtime.Remoting.Contexts/IContextAttribute.xml
-M      en/System.Runtime.Remoting.Contexts/IContributeDynamicSink.xml
-M      en/System.Runtime.Remoting.Contexts/Context.xml
-M      en/System.Runtime.Remoting.Contexts/SynchronizationAttribute.xml
-M      en/System.Runtime.Remoting.Contexts/IDynamicMessageSink.xml
-M      en/System.Runtime.Remoting.Contexts/ContextProperty.xml
-M      en/System.Runtime.Remoting.Contexts/CrossContextDelegate.xml
-M      en/System.Runtime.Remoting.Contexts/IContributeEnvoySink.xml
-M      en/System.Runtime.Remoting.Contexts/IContextProperty.xml
-M      en/System.Runtime.Remoting.Contexts/IDynamicProperty.xml
-M      en/System.Runtime.Remoting.Contexts/IContributeObjectSink.xml
-M      en/System.Runtime.Remoting.Contexts/ContextAttribute.xml
-M      en/System.Runtime.Remoting.Contexts/IContributeServerContextSink.xml
-M      en/System.Runtime.Remoting.Contexts/IContextPropertyActivator.xml
-?      en/System.Collections/StructuralComparisons.xml
-?      en/System.Collections/IStructuralEquatable.xml
-?      en/System.Collections/IStructuralComparable.xml
-M      en/System.Collections/IDictionaryEnumerator.xml
-M      en/System.Collections/IComparer.xml
-M      en/System.Collections/IList.xml
-M      en/System.Collections/Queue.xml
-M      en/System.Collections/ReadOnlyCollectionBase.xml
-M      en/System.Collections/CaseInsensitiveComparer.xml
-M      en/System.Collections/CollectionBase.xml
-M      en/System.Collections/DictionaryEntry.xml
-M      en/System.Collections/IEnumerable.xml
-M      en/System.Collections/IEnumerator.xml
-M      en/System.Collections/Hashtable.xml
-M      en/System.Collections/SortedList.xml
-M      en/System.Collections/IEqualityComparer.xml
-M      en/System.Collections/DictionaryBase.xml
-M      en/System.Collections/IHashCodeProvider.xml
-M      en/System.Collections/ICollection.xml
-M      en/System.Collections/Stack.xml
-M      en/System.Collections/CaseInsensitiveHashCodeProvider.xml
-M      en/System.Collections/Comparer.xml
-M      en/System.Collections/ArrayList.xml
-M      en/System.Collections/BitArray.xml
-M      en/System.Collections/IDictionary.xml
-M      en/System.Runtime.ConstrainedExecution/Consistency.xml
-M      en/System.Runtime.ConstrainedExecution/CriticalFinalizerObject.xml
-M      en/System.Runtime.ConstrainedExecution/Cer.xml
-M      en/System.Runtime.ConstrainedExecution/PrePrepareMethodAttribute.xml
-M      en/System.Runtime.ConstrainedExecution/ReliabilityContractAttribute.xml
-M      en/System.Diagnostics.CodeAnalysis/SuppressMessageAttribute.xml
-M      en/System.Reflection.Emit/TypeToken.xml
-M      en/System.Reflection.Emit/MethodRental.xml
-M      en/System.Reflection.Emit/AssemblyBuilder.xml
-M      en/System.Reflection.Emit/TypeBuilder.xml
-M      en/System.Reflection.Emit/OperandType.xml
-M      en/System.Reflection.Emit/OpCodes.xml
-M      en/System.Reflection.Emit/ConstructorBuilder.xml
-M      en/System.Reflection.Emit/PackingSize.xml
-M      en/System.Reflection.Emit/StringToken.xml
-M      en/System.Reflection.Emit/OpCode.xml
-M      en/System.Reflection.Emit/StackBehaviour.xml
-M      en/System.Reflection.Emit/EnumBuilder.xml
-M      en/System.Reflection.Emit/ILGenerator.xml
-M      en/System.Reflection.Emit/ParameterToken.xml
-M      en/System.Reflection.Emit/MethodToken.xml
-M      en/System.Reflection.Emit/EventToken.xml
-M      en/System.Reflection.Emit/FieldToken.xml
-M      en/System.Reflection.Emit/PropertyToken.xml
-M      en/System.Reflection.Emit/DynamicILInfo.xml
-M      en/System.Reflection.Emit/DynamicMethod.xml
-M      en/System.Reflection.Emit/GenericTypeParameterBuilder.xml
-M      en/System.Reflection.Emit/ParameterBuilder.xml
-M      en/System.Reflection.Emit/MethodBuilder.xml
-M      en/System.Reflection.Emit/EventBuilder.xml
-M      en/System.Reflection.Emit/FieldBuilder.xml
-M      en/System.Reflection.Emit/PropertyBuilder.xml
-M      en/System.Reflection.Emit/ModuleBuilder.xml
-M      en/System.Reflection.Emit/PEFileKinds.xml
-M      en/System.Reflection.Emit/SignatureHelper.xml
-M      en/System.Reflection.Emit/LocalBuilder.xml
-M      en/System.Reflection.Emit/SignatureToken.xml
-M      en/System.Reflection.Emit/CustomAttributeBuilder.xml
-M      en/System.Reflection.Emit/UnmanagedMarshal.xml
-M      en/System.Reflection.Emit/AssemblyBuilderAccess.xml
-M      en/System.Reflection.Emit/FlowControl.xml
-M      en/System.Reflection.Emit/OpCodeType.xml
-M      en/System.Reflection.Emit/Label.xml
-M      en/System.Collections.Generic/IEqualityComparer`1.xml
-M      en/System.Collections.Generic/KeyValuePair`2.xml
-M      en/System.Collections.Generic/KeyNotFoundException.xml
-M      en/System.Collections.Generic/ICollection`1.xml
-M      en/System.Collections.Generic/Dictionary`2.xml
-M      en/System.Collections.Generic/Dictionary`2+KeyCollection.xml
-M      en/System.Collections.Generic/Dictionary`2+ValueCollection+Enumerator.xml
-M      en/System.Collections.Generic/Comparer`1.xml
-M      en/System.Collections.Generic/List`1.xml
-M      en/System.Collections.Generic/IDictionary`2.xml
-M      en/System.Collections.Generic/IComparer`1.xml
-M      en/System.Collections.Generic/Dictionary`2+KeyCollection+Enumerator.xml
-M      en/System.Collections.Generic/Dictionary`2+Enumerator.xml
-M      en/System.Collections.Generic/IList`1.xml
-M      en/System.Collections.Generic/EqualityComparer`1.xml
-M      en/System.Collections.Generic/IEnumerable`1.xml
-M      en/System.Collections.Generic/List`1+Enumerator.xml
-M      en/System.Collections.Generic/IEnumerator`1.xml
-M      en/System.Collections.Generic/Dictionary`2+ValueCollection.xml
-M      en/System.Deployment.Internal/InternalActivationContextHelper.xml
-M      en/System.Deployment.Internal/InternalApplicationIdentityHelper.xml
-?      en/System.Globalization/TimeSpanStyles.xml
-?      en/System.Globalization/CultureNotFoundException.xml
-M      en/System.Globalization/JapaneseCalendar.xml
-M      en/System.Globalization/DateTimeFormatInfo.xml
-M      en/System.Globalization/CalendarAlgorithmType.xml
-M      en/System.Globalization/DaylightTime.xml
-M      en/System.Globalization/UnicodeCategory.xml
-M      en/System.Globalization/IdnMapping.xml
-M      en/System.Globalization/HijriCalendar.xml
-M      en/System.Globalization/CultureInfo.xml
-M      en/System.Globalization/TextElementEnumerator.xml
-M      en/System.Globalization/KoreanLunisolarCalendar.xml
-M      en/System.Globalization/DigitShapes.xml
-M      en/System.Globalization/TaiwanLunisolarCalendar.xml
-M      en/System.Globalization/GregorianCalendar.xml
-M      en/System.Globalization/KoreanCalendar.xml
-M      en/System.Globalization/JapaneseLunisolarCalendar.xml
-M      en/System.Globalization/TaiwanCalendar.xml
-M      en/System.Globalization/CalendarWeekRule.xml
-M      en/System.Globalization/UmAlQuraCalendar.xml
-M      en/System.Globalization/StringInfo.xml
-M      en/System.Globalization/PersianCalendar.xml
-M      en/System.Globalization/EastAsianLunisolarCalendar.xml
-M      en/System.Globalization/NumberStyles.xml
-M      en/System.Globalization/GregorianCalendarTypes.xml
-M      en/System.Globalization/RegionInfo.xml
-M      en/System.Globalization/SortKey.xml
-M      en/System.Globalization/CharUnicodeInfo.xml
-M      en/System.Globalization/DateTimeStyles.xml
-M      en/System.Globalization/TextInfo.xml
-M      en/System.Globalization/ChineseLunisolarCalendar.xml
-M      en/System.Globalization/CompareInfo.xml
-M      en/System.Globalization/CompareOptions.xml
-M      en/System.Globalization/HebrewCalendar.xml
-M      en/System.Globalization/ThaiBuddhistCalendar.xml
-M      en/System.Globalization/CultureTypes.xml
-M      en/System.Globalization/Calendar.xml
-M      en/System.Globalization/JulianCalendar.xml
-M      en/System.Globalization/NumberFormatInfo.xml
-M      en/System.Runtime.Remoting.Channels/IClientChannelSinkProvider.xml
-M      en/System.Runtime.Remoting.Channels/IChannel.xml
-M      en/System.Runtime.Remoting.Channels/ClientChannelSinkStack.xml
-M      en/System.Runtime.Remoting.Channels/IChannelSender.xml
-M      en/System.Runtime.Remoting.Channels/IServerChannelSinkStack.xml
-M      en/System.Runtime.Remoting.Channels/IChannelReceiverHook.xml
-M      en/System.Runtime.Remoting.Channels/TransportHeaders.xml
-M      en/System.Runtime.Remoting.Channels/IChannelDataStore.xml
-M      en/System.Runtime.Remoting.Channels/IClientChannelSinkStack.xml
-M      en/System.Runtime.Remoting.Channels/IServerChannelSink.xml
-M      en/System.Runtime.Remoting.Channels/IClientFormatterSink.xml
-M      en/System.Runtime.Remoting.Channels/ITransportHeaders.xml
-M      en/System.Runtime.Remoting.Channels/BaseChannelSinkWithProperties.xml
-M      en/System.Runtime.Remoting.Channels/IChannelSinkBase.xml
-M      en/System.Runtime.Remoting.Channels/IServerResponseChannelSinkStack.xml
-M      en/System.Runtime.Remoting.Channels/BaseChannelObjectWithProperties.xml
-M      en/System.Runtime.Remoting.Channels/IServerFormatterSinkProvider.xml
-M      en/System.Runtime.Remoting.Channels/ServerProcessing.xml
-M      en/System.Runtime.Remoting.Channels/IClientChannelSink.xml
-M      en/System.Runtime.Remoting.Channels/IChannelReceiver.xml
-M      en/System.Runtime.Remoting.Channels/ISecurableChannel.xml
-M      en/System.Runtime.Remoting.Channels/IServerChannelSinkProvider.xml
-M      en/System.Runtime.Remoting.Channels/SinkProviderData.xml
-M      en/System.Runtime.Remoting.Channels/IClientResponseChannelSinkStack.xml
-M      en/System.Runtime.Remoting.Channels/ServerChannelSinkStack.xml
-M      en/System.Runtime.Remoting.Channels/IClientFormatterSinkProvider.xml
-M      en/System.Runtime.Remoting.Channels/ChannelServices.xml
-M      en/System.Runtime.Remoting.Channels/BaseChannelWithProperties.xml
-M      en/System.Runtime.Remoting.Channels/ChannelDataStore.xml
-M      en/System.Collections.ObjectModel/ReadOnlyCollection`1.xml
-M      en/System.Collections.ObjectModel/Collection`1.xml
-M      en/System.Collections.ObjectModel/KeyedCollection`2.xml
-M      en/System.Diagnostics/StackFrame.xml
-M      en/System.Diagnostics/DebuggableAttribute+DebuggingModes.xml
-M      en/System.Diagnostics/Debugger.xml
-M      en/System.Diagnostics/DebuggerHiddenAttribute.xml
-M      en/System.Diagnostics/StackTrace.xml
-M      en/System.Diagnostics/DebuggerBrowsableState.xml
-M      en/System.Diagnostics/DebuggerVisualizerAttribute.xml
-M      en/System.Diagnostics/ConditionalAttribute.xml
-M      en/System.Diagnostics/DebuggerDisplayAttribute.xml
-M      en/System.Diagnostics/DebuggableAttribute.xml
-M      en/System.Diagnostics/DebuggerStepThroughAttribute.xml
-M      en/System.Diagnostics/DebuggerBrowsableAttribute.xml
-M      en/System.Diagnostics/DebuggerTypeProxyAttribute.xml
-M      en/System.Diagnostics/DebuggerNonUserCodeAttribute.xml
-M      en/System.Diagnostics/DebuggerStepperBoundaryAttribute.xml
-M      en/System.Runtime.InteropServices.ComTypes/IMPLTYPEFLAGS.xml
-M      en/System.Runtime.InteropServices.ComTypes/EXCEPINFO.xml
-M      en/System.Runtime.InteropServices.ComTypes/ELEMDESC.xml
-M      en/System.Runtime.InteropServices.ComTypes/CONNECTDATA.xml
-M      en/System.Runtime.InteropServices.ComTypes/LIBFLAGS.xml
-M      en/System.Runtime.InteropServices.ComTypes/SYSKIND.xml
-M      en/System.Runtime.InteropServices.ComTypes/IConnectionPointContainer.xml
-M      en/System.Runtime.InteropServices.ComTypes/ITypeInfo2.xml
-M      en/System.Runtime.InteropServices.ComTypes/IRunningObjectTable.xml
-M      en/System.Runtime.InteropServices.ComTypes/STATSTG.xml
-M      en/System.Runtime.InteropServices.ComTypes/IEnumConnectionPoints.xml
-M      en/System.Runtime.InteropServices.ComTypes/FUNCDESC.xml
-M      en/System.Runtime.InteropServices.ComTypes/PARAMFLAG.xml
-M      en/System.Runtime.InteropServices.ComTypes/FILETIME.xml
-M      en/System.Runtime.InteropServices.ComTypes/PARAMDESC.xml
-M      en/System.Runtime.InteropServices.ComTypes/FUNCKIND.xml
-M      en/System.Runtime.InteropServices.ComTypes/IPersistFile.xml
-M      en/System.Runtime.InteropServices.ComTypes/IEnumVARIANT.xml
-M      en/System.Runtime.InteropServices.ComTypes/BINDPTR.xml
-M      en/System.Runtime.InteropServices.ComTypes/DISPPARAMS.xml
-M      en/System.Runtime.InteropServices.ComTypes/ITypeLib2.xml
-M      en/System.Runtime.InteropServices.ComTypes/IStream.xml
-M      en/System.Runtime.InteropServices.ComTypes/IEnumString.xml
-M      en/System.Runtime.InteropServices.ComTypes/ELEMDESC+DESCUNION.xml
-M      en/System.Runtime.InteropServices.ComTypes/IBindCtx.xml
-M      en/System.Runtime.InteropServices.ComTypes/VARFLAGS.xml
-M      en/System.Runtime.InteropServices.ComTypes/FUNCFLAGS.xml
-M      en/System.Runtime.InteropServices.ComTypes/ITypeComp.xml
-M      en/System.Runtime.InteropServices.ComTypes/IEnumConnections.xml
-M      en/System.Runtime.InteropServices.ComTypes/TYPEDESC.xml
-M      en/System.Runtime.InteropServices.ComTypes/BIND_OPTS.xml
-M      en/System.Runtime.InteropServices.ComTypes/ITypeLib.xml
-M      en/System.Runtime.InteropServices.ComTypes/IConnectionPoint.xml
-M      en/System.Runtime.InteropServices.ComTypes/DESCKIND.xml
-M      en/System.Runtime.InteropServices.ComTypes/TYPEKIND.xml
-M      en/System.Runtime.InteropServices.ComTypes/VARDESC.xml
-M      en/System.Runtime.InteropServices.ComTypes/TYPEFLAGS.xml
-M      en/System.Runtime.InteropServices.ComTypes/VARKIND.xml
-M      en/System.Runtime.InteropServices.ComTypes/INVOKEKIND.xml
-M      en/System.Runtime.InteropServices.ComTypes/CALLCONV.xml
-M      en/System.Runtime.InteropServices.ComTypes/IEnumMoniker.xml
-M      en/System.Runtime.InteropServices.ComTypes/IDLFLAG.xml
-M      en/System.Runtime.InteropServices.ComTypes/TYPELIBATTR.xml
-M      en/System.Runtime.InteropServices.ComTypes/ITypeInfo.xml
-M      en/System.Runtime.InteropServices.ComTypes/IDLDESC.xml
-M      en/System.Runtime.InteropServices.ComTypes/VARDESC+DESCUNION.xml
-M      en/System.Runtime.InteropServices.ComTypes/TYPEATTR.xml
-M      en/System.Runtime.InteropServices.ComTypes/IMoniker.xml
-M      en/index.xml
-M      en/System.Text/DecoderFallback.xml
-M      en/System.Text/Encoding.xml
-M      en/System.Text/EncoderFallbackBuffer.xml
-M      en/System.Text/UTF7Encoding.xml
-M      en/System.Text/UTF8Encoding.xml
-M      en/System.Text/UnicodeEncoding.xml
-M      en/System.Text/DecoderExceptionFallbackBuffer.xml
-M      en/System.Text/EncoderFallback.xml
-M      en/System.Text/DecoderReplacementFallbackBuffer.xml
-M      en/System.Text/ASCIIEncoding.xml
-M      en/System.Text/EncodingInfo.xml
-M      en/System.Text/DecoderFallbackException.xml
-M      en/System.Text/DecoderExceptionFallback.xml
-M      en/System.Text/DecoderReplacementFallback.xml
-M      en/System.Text/Decoder.xml
-M      en/System.Text/EncoderExceptionFallbackBuffer.xml
-M      en/System.Text/EncoderReplacementFallbackBuffer.xml
-M      en/System.Text/NormalizationForm.xml
-M      en/System.Text/UTF32Encoding.xml
-M      en/System.Text/StringBuilder.xml
-M      en/System.Text/EncoderFallbackException.xml
-M      en/System.Text/EncoderExceptionFallback.xml
-M      en/System.Text/EncoderReplacementFallback.xml
-M      en/System.Text/Encoder.xml
-M      en/System.Text/DecoderFallbackBuffer.xml
-M      en/System.Runtime.Remoting.Metadata/SoapAttribute.xml
-M      en/System.Runtime.Remoting.Metadata/SoapMethodAttribute.xml
-M      en/System.Runtime.Remoting.Metadata/SoapParameterAttribute.xml
-M      en/System.Runtime.Remoting.Metadata/SoapTypeAttribute.xml
-M      en/System.Runtime.Remoting.Metadata/XmlFieldOrderOption.xml
-M      en/System.Runtime.Remoting.Metadata/SoapFieldAttribute.xml
-M      en/System.Runtime.Remoting.Metadata/SoapOption.xml
-M      en/System.Security.Cryptography.X509Certificates/X509KeyStorageFlags.xml
-M      en/System.Security.Cryptography.X509Certificates/X509ContentType.xml
-M      en/System.Security.Cryptography.X509Certificates/X509Certificate.xml
-M      en/System.Runtime.Remoting.Proxies/ProxyAttribute.xml
-M      en/System.Runtime.Remoting.Proxies/RealProxy.xml
-?      en/System.IO.IsolatedStorage/IsolatedStorageSecurityState.xml
-?      en/System.IO.IsolatedStorage/IsolatedStorageSecurityOptions.xml
-M      en/System.IO.IsolatedStorage/IsolatedStorageScope.xml
-M      en/System.IO.IsolatedStorage/IsolatedStorageFileStream.xml
-M      en/System.IO.IsolatedStorage/IsolatedStorageException.xml
-M      en/System.IO.IsolatedStorage/IsolatedStorage.xml
-M      en/System.IO.IsolatedStorage/IsolatedStorageFile.xml
-M      en/System.IO.IsolatedStorage/INormalizeForIsolatedStorage.xml
-?      en/System.Runtime.CompilerServices/ConditionalWeakTable`2.xml
-?      en/System.Runtime.CompilerServices/ReferenceAssemblyAttribute.xml
-?      en/System.Runtime.CompilerServices/TypeForwardedFromAttribute.xml
-?      en/System.Runtime.CompilerServices/ConditionalWeakTable`2+CreateValueCallback.xml
-M      en/System.Runtime.CompilerServices/DiscardableAttribute.xml
-M      en/System.Runtime.CompilerServices/IsConst.xml
-M      en/System.Runtime.CompilerServices/IndexerNameAttribute.xml
-M      en/System.Runtime.CompilerServices/RuntimeWrappedException.xml
-M      en/System.Runtime.CompilerServices/MethodImplAttribute.xml
-M      en/System.Runtime.CompilerServices/CompilationRelaxations.xml
-M      en/System.Runtime.CompilerServices/DateTimeConstantAttribute.xml
-M      en/System.Runtime.CompilerServices/IsLong.xml
-M      en/System.Runtime.CompilerServices/LoadHint.xml
-M      en/System.Runtime.CompilerServices/IsByValue.xml
-M      en/System.Runtime.CompilerServices/NativeCppClassAttribute.xml
-M      en/System.Runtime.CompilerServices/InternalsVisibleToAttribute.xml
-M      en/System.Runtime.CompilerServices/IUnknownConstantAttribute.xml
-M      en/System.Runtime.CompilerServices/TypeForwardedToAttribute.xml
-M      en/System.Runtime.CompilerServices/IsImplicitlyDereferenced.xml
-M      en/System.Runtime.CompilerServices/DefaultDependencyAttribute.xml
-M      en/System.Runtime.CompilerServices/CallConvStdcall.xml
-M      en/System.Runtime.CompilerServices/CompilerGlobalScopeAttribute.xml
-M      en/System.Runtime.CompilerServices/ScopelessEnumAttribute.xml
-M      en/System.Runtime.CompilerServices/CallConvFastcall.xml
-M      en/System.Runtime.CompilerServices/RuntimeHelpers+TryCode.xml
-M      en/System.Runtime.CompilerServices/CompilationRelaxationsAttribute.xml
-M      en/System.Runtime.CompilerServices/IsExplicitlyDereferenced.xml
-M      en/System.Runtime.CompilerServices/MethodImplOptions.xml
-M      en/System.Runtime.CompilerServices/CompilerMarshalOverride.xml
-M      en/System.Runtime.CompilerServices/IsCopyConstructed.xml
-M      en/System.Runtime.CompilerServices/RuntimeHelpers+CleanupCode.xml
-M      en/System.Runtime.CompilerServices/StringFreezingAttribute.xml
-M      en/System.Runtime.CompilerServices/CallConvThiscall.xml
-M      en/System.Runtime.CompilerServices/FixedAddressValueTypeAttribute.xml
-M      en/System.Runtime.CompilerServices/IsUdtReturn.xml
-M      en/System.Runtime.CompilerServices/RequiredAttributeAttribute.xml
-M      en/System.Runtime.CompilerServices/CallConvCdecl.xml
-M      en/System.Runtime.CompilerServices/DecimalConstantAttribute.xml
-M      en/System.Runtime.CompilerServices/IsBoxed.xml
-M      en/System.Runtime.CompilerServices/IsSignUnspecifiedByte.xml
-M      en/System.Runtime.CompilerServices/HasCopySemanticsAttribute.xml
-M      en/System.Runtime.CompilerServices/RuntimeCompatibilityAttribute.xml
-M      en/System.Runtime.CompilerServices/DependencyAttribute.xml
-M      en/System.Runtime.CompilerServices/SuppressIldasmAttribute.xml
-M      en/System.Runtime.CompilerServices/AccessedThroughPropertyAttribute.xml
-M      en/System.Runtime.CompilerServices/UnsafeValueTypeAttribute.xml
-M      en/System.Runtime.CompilerServices/IsJitIntrinsic.xml
-M      en/System.Runtime.CompilerServices/SpecialNameAttribute.xml
-M      en/System.Runtime.CompilerServices/IDispatchConstantAttribute.xml
-M      en/System.Runtime.CompilerServices/RuntimeHelpers.xml
-M      en/System.Runtime.CompilerServices/CustomConstantAttribute.xml
-M      en/System.Runtime.CompilerServices/IsPinned.xml
-M      en/System.Runtime.CompilerServices/IsVolatile.xml
-M      en/System.Runtime.CompilerServices/FixedBufferAttribute.xml
-M      en/System.Runtime.CompilerServices/CompilerGeneratedAttribute.xml
-M      en/System.Runtime.CompilerServices/MethodCodeType.xml
-?      en/System.Security.Cryptography/Aes.xml
-M      en/System.Security.Cryptography/MD5CryptoServiceProvider.xml
-M      en/System.Security.Cryptography/RIPEMD160Managed.xml
-M      en/System.Security.Cryptography/RC2.xml
-M      en/System.Security.Cryptography/TripleDESCryptoServiceProvider.xml
-M      en/System.Security.Cryptography/RSAOAEPKeyExchangeFormatter.xml
-M      en/System.Security.Cryptography/CryptographicException.xml
-M      en/System.Security.Cryptography/HMACSHA384.xml
-M      en/System.Security.Cryptography/KeySizes.xml
-M      en/System.Security.Cryptography/DSA.xml
-M      en/System.Security.Cryptography/PasswordDeriveBytes.xml
-M      en/System.Security.Cryptography/MaskGenerationMethod.xml
-M      en/System.Security.Cryptography/KeyedHashAlgorithm.xml
-M      en/System.Security.Cryptography/RSA.xml
-M      en/System.Security.Cryptography/ICryptoTransform.xml
-M      en/System.Security.Cryptography/HMACSHA1.xml
-M      en/System.Security.Cryptography/AsymmetricKeyExchangeDeformatter.xml
-M      en/System.Security.Cryptography/Rijndael.xml
-M      en/System.Security.Cryptography/SHA1CryptoServiceProvider.xml
-M      en/System.Security.Cryptography/HashAlgorithm.xml
-M      en/System.Security.Cryptography/TripleDES.xml
-M      en/System.Security.Cryptography/HMACSHA512.xml
-M      en/System.Security.Cryptography/SHA1.xml
-M      en/System.Security.Cryptography/RandomNumberGenerator.xml
-M      en/System.Security.Cryptography/RSAPKCS1KeyExchangeDeformatter.xml
-M      en/System.Security.Cryptography/RSAOAEPKeyExchangeDeformatter.xml
-M      en/System.Security.Cryptography/CryptographicUnexpectedOperationException.xml
-M      en/System.Security.Cryptography/FromBase64Transform.xml
-M      en/System.Security.Cryptography/SignatureDescription.xml
-M      en/System.Security.Cryptography/CryptoAPITransform.xml
-M      en/System.Security.Cryptography/RIPEMD160.xml
-M      en/System.Security.Cryptography/DESCryptoServiceProvider.xml
-M      en/System.Security.Cryptography/SHA256.xml
-M      en/System.Security.Cryptography/PKCS1MaskGenerationMethod.xml
-M      en/System.Security.Cryptography/Rfc2898DeriveBytes.xml
-M      en/System.Security.Cryptography/CspKeyContainerInfo.xml
-M      en/System.Security.Cryptography/AsymmetricKeyExchangeFormatter.xml
-M      en/System.Security.Cryptography/HMACMD5.xml
-M      en/System.Security.Cryptography/SHA512Managed.xml
-M      en/System.Security.Cryptography/RSACryptoServiceProvider.xml
-M      en/System.Security.Cryptography/RNGCryptoServiceProvider.xml
-M      en/System.Security.Cryptography/RC2CryptoServiceProvider.xml
-M      en/System.Security.Cryptography/SymmetricAlgorithm.xml
-M      en/System.Security.Cryptography/RSAPKCS1KeyExchangeFormatter.xml
-M      en/System.Security.Cryptography/SHA384Managed.xml
-M      en/System.Security.Cryptography/DSAParameters.xml
-M      en/System.Security.Cryptography/CryptoStream.xml
-M      en/System.Security.Cryptography/AsymmetricSignatureDeformatter.xml
-M      en/System.Security.Cryptography/HMACRIPEMD160.xml
-M      en/System.Security.Cryptography/RijndaelManagedTransform.xml
-M      en/System.Security.Cryptography/KeyNumber.xml
-M      en/System.Security.Cryptography/RijndaelManaged.xml
-M      en/System.Security.Cryptography/RSAPKCS1SignatureDeformatter.xml
-M      en/System.Security.Cryptography/HMAC.xml
-M      en/System.Security.Cryptography/RSAParameters.xml
-M      en/System.Security.Cryptography/CspParameters.xml
-M      en/System.Security.Cryptography/FromBase64TransformMode.xml
-M      en/System.Security.Cryptography/SHA1Managed.xml
-M      en/System.Security.Cryptography/SHA384.xml
-M      en/System.Security.Cryptography/PaddingMode.xml
-M      en/System.Security.Cryptography/DES.xml
-M      en/System.Security.Cryptography/CipherMode.xml
-M      en/System.Security.Cryptography/AsymmetricSignatureFormatter.xml
-M      en/System.Security.Cryptography/ToBase64Transform.xml
-M      en/System.Security.Cryptography/AsymmetricAlgorithm.xml
-M      en/System.Security.Cryptography/MD5.xml
-M      en/System.Security.Cryptography/DeriveBytes.xml
-M      en/System.Security.Cryptography/SHA256Managed.xml
-M      en/System.Security.Cryptography/DSASignatureDeformatter.xml
-M      en/System.Security.Cryptography/RSAPKCS1SignatureFormatter.xml
-M      en/System.Security.Cryptography/CryptoStreamMode.xml
-M      en/System.Security.Cryptography/HMACSHA256.xml
-M      en/System.Security.Cryptography/ICspAsymmetricAlgorithm.xml
-M      en/System.Security.Cryptography/SHA512.xml
-M      en/System.Security.Cryptography/DSACryptoServiceProvider.xml
-M      en/System.Security.Cryptography/CryptoConfig.xml
-M      en/System.Security.Cryptography/MACTripleDES.xml
-M      en/System.Security.Cryptography/CspProviderFlags.xml
-M      en/System.Security.Cryptography/DSASignatureFormatter.xml
-M      en/System.Runtime.Remoting.Metadata.W3cXsd2001/SoapYear.xml
-M      en/System.Runtime.Remoting.Metadata.W3cXsd2001/SoapQName.xml
-M      en/System.Runtime.Remoting.Metadata.W3cXsd2001/SoapNcName.xml
-M      en/System.Runtime.Remoting.Metadata.W3cXsd2001/ISoapXsd.xml
-M      en/System.Runtime.Remoting.Metadata.W3cXsd2001/SoapAnyUri.xml
-M      en/System.Runtime.Remoting.Metadata.W3cXsd2001/SoapNmtoken.xml
-M      en/System.Runtime.Remoting.Metadata.W3cXsd2001/SoapEntity.xml
-M      en/System.Runtime.Remoting.Metadata.W3cXsd2001/SoapDay.xml
-M      en/System.Runtime.Remoting.Metadata.W3cXsd2001/SoapToken.xml
-M      en/System.Runtime.Remoting.Metadata.W3cXsd2001/SoapNegativeInteger.xml
-M      en/System.Runtime.Remoting.Metadata.W3cXsd2001/SoapName.xml
-M      en/System.Runtime.Remoting.Metadata.W3cXsd2001/SoapMonthDay.xml
-M      en/System.Runtime.Remoting.Metadata.W3cXsd2001/SoapLanguage.xml
-M      en/System.Runtime.Remoting.Metadata.W3cXsd2001/SoapDuration.xml
-M      en/System.Runtime.Remoting.Metadata.W3cXsd2001/SoapIdref.xml
-M      en/System.Runtime.Remoting.Metadata.W3cXsd2001/SoapBase64Binary.xml
-M      en/System.Runtime.Remoting.Metadata.W3cXsd2001/SoapNonNegativeInteger.xml
-M      en/System.Runtime.Remoting.Metadata.W3cXsd2001/SoapNotation.xml
-M      en/System.Runtime.Remoting.Metadata.W3cXsd2001/SoapDateTime.xml
-M      en/System.Runtime.Remoting.Metadata.W3cXsd2001/SoapInteger.xml
-M      en/System.Runtime.Remoting.Metadata.W3cXsd2001/SoapNmtokens.xml
-M      en/System.Runtime.Remoting.Metadata.W3cXsd2001/SoapTime.xml
-M      en/System.Runtime.Remoting.Metadata.W3cXsd2001/SoapYearMonth.xml
-M      en/System.Runtime.Remoting.Metadata.W3cXsd2001/SoapIdrefs.xml
-M      en/System.Runtime.Remoting.Metadata.W3cXsd2001/SoapDate.xml
-M      en/System.Runtime.Remoting.Metadata.W3cXsd2001/SoapPositiveInteger.xml
-M      en/System.Runtime.Remoting.Metadata.W3cXsd2001/SoapEntities.xml
-M      en/System.Runtime.Remoting.Metadata.W3cXsd2001/SoapMonth.xml
-M      en/System.Runtime.Remoting.Metadata.W3cXsd2001/SoapHexBinary.xml
-M      en/System.Runtime.Remoting.Metadata.W3cXsd2001/SoapNonPositiveInteger.xml
-M      en/System.Runtime.Remoting.Metadata.W3cXsd2001/SoapNormalizedString.xml
-M      en/System.Runtime.Remoting.Metadata.W3cXsd2001/SoapId.xml
-M      en/System.Runtime.Remoting.Lifetime/ClientSponsor.xml
-M      en/System.Runtime.Remoting.Lifetime/ILease.xml
-M      en/System.Runtime.Remoting.Lifetime/LifetimeServices.xml
-M      en/System.Runtime.Remoting.Lifetime/LeaseState.xml
-M      en/System.Runtime.Remoting.Lifetime/ISponsor.xml
-M      en/System.Security.Policy/PublisherMembershipCondition.xml
-M      en/System.Security.Policy/ApplicationTrustCollection.xml
-M      en/System.Security.Policy/Evidence.xml
-M      en/System.Security.Policy/Hash.xml
-M      en/System.Security.Policy/PolicyStatement.xml
-M      en/System.Security.Policy/UrlMembershipCondition.xml
-M      en/System.Security.Policy/ApplicationSecurityManager.xml
-M      en/System.Security.Policy/ApplicationVersionMatch.xml
-M      en/System.Security.Policy/SiteMembershipCondition.xml
-M      en/System.Security.Policy/CodeGroup.xml
-M      en/System.Security.Policy/FileCodeGroup.xml
-M      en/System.Security.Policy/ApplicationDirectory.xml
-M      en/System.Security.Policy/ZoneMembershipCondition.xml
-M      en/System.Security.Policy/UnionCodeGroup.xml
-M      en/System.Security.Policy/Url.xml
-M      en/System.Security.Policy/Site.xml
-M      en/System.Security.Policy/ApplicationTrust.xml
-M      en/System.Security.Policy/HashMembershipCondition.xml
-M      en/System.Security.Policy/CodeConnectAccess.xml
-M      en/System.Security.Policy/ApplicationSecurityInfo.xml
-M      en/System.Security.Policy/ApplicationTrustEnumerator.xml
-M      en/System.Security.Policy/PolicyStatementAttribute.xml
-M      en/System.Security.Policy/IApplicationTrustManager.xml
-M      en/System.Security.Policy/IMembershipCondition.xml
-M      en/System.Security.Policy/FirstMatchCodeGroup.xml
-M      en/System.Security.Policy/StrongName.xml
-M      en/System.Security.Policy/PolicyException.xml
-M      en/System.Security.Policy/TrustManagerUIContext.xml
-M      en/System.Security.Policy/TrustManagerContext.xml
-M      en/System.Security.Policy/PolicyLevel.xml
-M      en/System.Security.Policy/GacInstalled.xml
-M      en/System.Security.Policy/AllMembershipCondition.xml
-M      en/System.Security.Policy/Publisher.xml
-M      en/System.Security.Policy/NetCodeGroup.xml
-M      en/System.Security.Policy/StrongNameMembershipCondition.xml
-M      en/System.Security.Policy/IIdentityPermissionFactory.xml
-M      en/System.Security.Policy/PermissionRequestEvidence.xml
-M      en/System.Security.Policy/ApplicationDirectoryMembershipCondition.xml
-M      en/System.Security.Policy/Zone.xml
-M      en/System.Security.Policy/GacMembershipCondition.xml
-M      en/System.Runtime.Remoting/ObjectHandle.xml
-M      en/System.Runtime.Remoting/ServerException.xml
-M      en/System.Runtime.Remoting/InternalRemotingServices.xml
-M      en/System.Runtime.Remoting/IEnvoyInfo.xml
-M      en/System.Runtime.Remoting/WellKnownServiceTypeEntry.xml
-M      en/System.Runtime.Remoting/ActivatedClientTypeEntry.xml
-M      en/System.Runtime.Remoting/RemotingServices.xml
-M      en/System.Runtime.Remoting/IObjectHandle.xml
-M      en/System.Runtime.Remoting/IChannelInfo.xml
-M      en/System.Runtime.Remoting/CustomErrorsModes.xml
-M      en/System.Runtime.Remoting/RemotingException.xml
-M      en/System.Runtime.Remoting/TypeEntry.xml
-M      en/System.Runtime.Remoting/WellKnownClientTypeEntry.xml
-M      en/System.Runtime.Remoting/SoapServices.xml
-M      en/System.Runtime.Remoting/ObjRef.xml
-M      en/System.Runtime.Remoting/ActivatedServiceTypeEntry.xml
-M      en/System.Runtime.Remoting/RemotingTimeoutException.xml
-M      en/System.Runtime.Remoting/IRemotingTypeInfo.xml
-M      en/System.Runtime.Remoting/RemotingConfiguration.xml
-M      en/System.Runtime.Remoting/WellKnownObjectMode.xml
-?      en/System.IO/UnmanagedMemoryAccessor.xml
-M      en/System.IO/DirectoryInfo.xml
-M      en/System.IO/MemoryStream.xml
-M      en/System.IO/FileMode.xml
-M      en/System.IO/DriveInfo.xml
-M      en/System.IO/IOException.xml
-M      en/System.IO/FileAttributes.xml
-M      en/System.IO/StringReader.xml
-M      en/System.IO/Stream.xml
-M      en/System.IO/FileStream.xml
-M      en/System.IO/FileInfo.xml
-M      en/System.IO/SearchOption.xml
-M      en/System.IO/DirectoryNotFoundException.xml
-M      en/System.IO/FileAccess.xml
-M      en/System.IO/FileShare.xml
-M      en/System.IO/StringWriter.xml
-M      en/System.IO/Directory.xml
-M      en/System.IO/BinaryReader.xml
-M      en/System.IO/TextReader.xml
-M      en/System.IO/StreamReader.xml
-M      en/System.IO/File.xml
-M      en/System.IO/BinaryWriter.xml
-M      en/System.IO/TextWriter.xml
-M      en/System.IO/EndOfStreamException.xml
-M      en/System.IO/StreamWriter.xml
-M      en/System.IO/FileOptions.xml
-M      en/System.IO/Path.xml
-M      en/System.IO/BufferedStream.xml
-M      en/System.IO/FileLoadException.xml
-M      en/System.IO/SeekOrigin.xml
-M      en/System.IO/FileSystemInfo.xml
-M      en/System.IO/UnmanagedMemoryStream.xml
-M      en/System.IO/DriveNotFoundException.xml
-M      en/System.IO/FileNotFoundException.xml
-M      en/System.IO/DriveType.xml
-M      en/System.IO/PathTooLongException.xml
-?      en/System.Runtime/AssemblyTargetedPatchBandAttribute.xml
-?      en/System.Runtime/TargetedPatchingOptOutAttribute.xml
-M      en/System.Runtime/GCSettings.xml
-M      en/System.Runtime/GCLatencyMode.xml
-M      en/System.Runtime/MemoryFailPoint.xml
-?      en/Microsoft.Win32/RegistryView.xml
-?      en/Microsoft.Win32/RegistryOptions.xml
-M      en/Microsoft.Win32/RegistryKey.xml
-M      en/Microsoft.Win32/RegistryValueOptions.xml
-M      en/Microsoft.Win32/RegistryHive.xml
-M      en/Microsoft.Win32/Registry.xml
-M      en/Microsoft.Win32/RegistryKeyPermissionCheck.xml
-M      en/Microsoft.Win32/RegistryValueKind.xml
-M      en/System.Runtime.Serialization.Formatters/ISoapMessage.xml
-M      en/System.Runtime.Serialization.Formatters/ServerFault.xml
-M      en/System.Runtime.Serialization.Formatters/InternalST.xml
-M      en/System.Runtime.Serialization.Formatters/FormatterAssemblyStyle.xml
-M      en/System.Runtime.Serialization.Formatters/FormatterTypeStyle.xml
-M      en/System.Runtime.Serialization.Formatters/SoapMessage.xml
-M      en/System.Runtime.Serialization.Formatters/IFieldInfo.xml
-M      en/System.Runtime.Serialization.Formatters/InternalRM.xml
-M      en/System.Runtime.Serialization.Formatters/SoapFault.xml
-M      en/System.Runtime.Serialization.Formatters/TypeFilterLevel.xml
-M      en/System.Runtime.Remoting.Services/EnterpriseServicesHelper.xml
-M      en/System.Runtime.Remoting.Services/TrackingServices.xml
-M      en/System.Runtime.Remoting.Services/ITrackingHandler.xml
-M      en/System.Reflection/Pointer.xml
-M      en/System.Reflection/MemberInfo.xml
-M      en/System.Reflection/TypeFilter.xml
-M      en/System.Reflection/EventAttributes.xml
-M      en/System.Reflection/IReflect.xml
-M      en/System.Reflection/FieldInfo.xml
-M      en/System.Reflection/CallingConventions.xml
-M      en/System.Reflection/ObfuscationAttribute.xml
-M      en/System.Reflection/AssemblyTitleAttribute.xml
-M      en/System.Reflection/MethodImplAttributes.xml
-M      en/System.Reflection/MethodBase.xml
-M      en/System.Reflection/AssemblyKeyFileAttribute.xml
-M      en/System.Reflection/MemberFilter.xml
-M      en/System.Reflection/AssemblyName.xml
-M      en/System.Reflection/AssemblyFlagsAttribute.xml
-M      en/System.Reflection/GenericParameterAttributes.xml
-M      en/System.Reflection/Module.xml
-M      en/System.Reflection/ParameterAttributes.xml
-M      en/System.Reflection/AssemblyAlgorithmIdAttribute.xml
-M      en/System.Reflection/BindingFlags.xml
-M      en/System.Reflection/TypeAttributes.xml
-M      en/System.Reflection/PropertyAttributes.xml
-M      en/System.Reflection/ParameterInfo.xml
-M      en/System.Reflection/AssemblyCopyrightAttribute.xml
-M      en/System.Reflection/ResourceAttributes.xml
-M      en/System.Reflection/TargetInvocationException.xml
-M      en/System.Reflection/DefaultMemberAttribute.xml
-M      en/System.Reflection/PropertyInfo.xml
-M      en/System.Reflection/ConstructorInfo.xml
-M      en/System.Reflection/PortableExecutableKinds.xml
-M      en/System.Reflection/AssemblyDelaySignAttribute.xml
-M      en/System.Reflection/AssemblyCultureAttribute.xml
-M      en/System.Reflection/Missing.xml
-M      en/System.Reflection/ReflectionTypeLoadException.xml
-M      en/System.Reflection/LocalVariableInfo.xml
-M      en/System.Reflection/InterfaceMapping.xml
-M      en/System.Reflection/ResourceLocation.xml
-M      en/System.Reflection/AssemblyDefaultAliasAttribute.xml
-M      en/System.Reflection/ModuleResolveEventHandler.xml
-M      en/System.Reflection/CustomAttributeFormatException.xml
-M      en/System.Reflection/AmbiguousMatchException.xml
-M      en/System.Reflection/CustomAttributeData.xml
-M      en/System.Reflection/FieldAttributes.xml
-M      en/System.Reflection/AssemblyCompanyAttribute.xml
-M      en/System.Reflection/AssemblyInformationalVersionAttribute.xml
-M      en/System.Reflection/EventInfo.xml
-M      en/System.Reflection/AssemblyNameFlags.xml
-M      en/System.Reflection/MethodBody.xml
-M      en/System.Reflection/InvalidFilterCriteriaException.xml
-M      en/System.Reflection/AssemblyTrademarkAttribute.xml
-M      en/System.Reflection/ObfuscateAssemblyAttribute.xml
-M      en/System.Reflection/StrongNameKeyPair.xml
-M      en/System.Reflection/Binder.xml
-M      en/System.Reflection/AssemblyProductAttribute.xml
-M      en/System.Reflection/CustomAttributeTypedArgument.xml
-M      en/System.Reflection/TypeDelegator.xml
-M      en/System.Reflection/ExceptionHandlingClauseOptions.xml
-M      en/System.Reflection/AssemblyKeyNameAttribute.xml
-M      en/System.Reflection/TargetParameterCountException.xml
-M      en/System.Reflection/ProcessorArchitecture.xml
-M      en/System.Reflection/ICustomAttributeProvider.xml
-M      en/System.Reflection/AssemblyNameProxy.xml
-M      en/System.Reflection/MethodAttributes.xml
-M      en/System.Reflection/ManifestResourceInfo.xml
-M      en/System.Reflection/AssemblyConfigurationAttribute.xml
-M      en/System.Reflection/MethodInfo.xml
-M      en/System.Reflection/MemberTypes.xml
-M      en/System.Reflection/ParameterModifier.xml
-M      en/System.Reflection/ExceptionHandlingClause.xml
-M      en/System.Reflection/TargetException.xml
-M      en/System.Reflection/CustomAttributeNamedArgument.xml
-M      en/System.Reflection/ImageFileMachine.xml
-M      en/System.Reflection/AssemblyDescriptionAttribute.xml
-M      en/System.Reflection/AssemblyFileVersionAttribute.xml
-M      en/System.Reflection/AssemblyVersionAttribute.xml
-M      en/System.Reflection/Assembly.xml
index 1cd1a7af0261df8aa8ad6fc4284617cadd8294a9..c05eb88982187a2070f9c67e3eec257a9d60caf9 100644 (file)
@@ -35,7 +35,7 @@ RESOURCE_FILES = \
        resources/collation.cjkKO.bin \
        resources/collation.cjkKOlv2.bin
 
-REFERENCE_SOURCES_FLAGS = -d:FEATURE_PAL,GENERICS_WORK,FEATURE_LIST_PREDICATES,FEATURE_SERIALIZATION,FEATURE_ASCII,FEATURE_LATIN1,FEATURE_UTF7,FEATURE_UTF32,MONO_HYBRID_ENCODING_SUPPORT,FEATURE_ASYNC_IO,NEW_EXPERIMENTAL_ASYNC_IO,FEATURE_UTF32,FEATURE_EXCEPTIONDISPATCHINFO,FEATURE_CORRUPTING_EXCEPTIONS,FEATURE_EXCEPTION_NOTIFICATIONS,FEATURE_STRONGNAME_MIGRATION,FEATURE_USE_LCID,FEATURE_FUSION,FEATURE_CRYPTO,FEATURE_X509_SECURESTRINGS,FEATURE_SYNCHRONIZATIONCONTEXT,FEATURE_SYNCHRONIZATIONCONTEXT_WAIT
+REFERENCE_SOURCES_FLAGS = -d:FEATURE_PAL,GENERICS_WORK,FEATURE_LIST_PREDICATES,FEATURE_SERIALIZATION,FEATURE_ASCII,FEATURE_LATIN1,FEATURE_UTF7,FEATURE_UTF32,MONO_HYBRID_ENCODING_SUPPORT,FEATURE_ASYNC_IO,NEW_EXPERIMENTAL_ASYNC_IO,FEATURE_UTF32,FEATURE_EXCEPTIONDISPATCHINFO,FEATURE_CORRUPTING_EXCEPTIONS,FEATURE_EXCEPTION_NOTIFICATIONS,FEATURE_STRONGNAME_MIGRATION,FEATURE_USE_LCID,FEATURE_FUSION,FEATURE_CRYPTO,FEATURE_X509_SECURESTRINGS,FEATURE_SYNCHRONIZATIONCONTEXT,FEATURE_SYNCHRONIZATIONCONTEXT_WAIT,HAS_CORLIB_CONTRACTS
 
 ifndef MOBILE_PROFILE
 REFERENCE_SOURCES_FLAGS += -d:FEATURE_MACL
@@ -203,7 +203,7 @@ tzi.exe:System/AndroidPlatform.cs $(wildcard System/TimeZone*.cs) ../../build/co
        trap "rm -f $(TMP_FILE1) $(TMP_FILE2)" EXIT INT QUIT TERM && \
        sed 's/Environment\.GetResourceString/string.Format/g' ../referencesource/mscorlib/system/timezoneinfo.cs > $(TMP_FILE1) && \
        sed 's/StringBuilder\.DefaultCapacity/100/g' ../referencesource/mscorlib/system/text/stringbuildercache.cs > $(TMP_FILE2) && \
-       $(MCS) /debug+ /out:$@ -unsafe -nowarn:612,618 -d:INSIDE_CORLIB,MONO_CULTURE_DATA -d:LIBC $(REFERENCE_SOURCES_FLAGS) "/d:SELF_TEST;NET_1_1;NET_2_0;NET_2_1;NET_3_5;NET_4_0;NET_4_5;MONO;DISABLE_CAS_USE;MOBILE;MOBILE_DYNAMIC;MONODROID;ANDROID" $^ $(TMP_FILE1) $(TMP_FILE2)
+       $(MCS) /debug+ /out:$@ -unsafe -nowarn:612,618 -d:INSIDE_CORLIB,MONO_CULTURE_DATA -d:LIBC $(REFERENCE_SOURCES_FLAGS) "/d:SELF_TEST;NET_1_1;NET_2_0;MOBILE;NET_3_5;NET_4_0;NET_4_5;MONO;DISABLE_CAS_USE;MOBILE;MOBILE_DYNAMIC;MONODROID;ANDROID" $^ $(TMP_FILE1) $(TMP_FILE2)
 
 android-pull-tzdb:
        mkdir -p android/tzdb/usr/share/zoneinfo
index b4ad9f294c3ea0f3f63c816d4339e96998fdec4a..b7eeefe229f9a9f7b76dfda14e5c97ab362e54be 100644 (file)
@@ -30,7 +30,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if !NET_2_1
+#if !MOBILE
 
 using System;
 using System.Text;
@@ -67,5 +67,5 @@ namespace Microsoft.Win32 {
        }
 }
 
-#endif // NET_2_1
+#endif // MOBILE
 
index 7994839edac8fde0f9224b6126003b1d4cd92bd1..a89a865de927950b2484432ef232d3b29034027c 100644 (file)
@@ -27,7 +27,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if !NET_2_1
+#if !MOBILE
 namespace Microsoft.Win32
 {
        public enum RegistryKeyPermissionCheck
index 757dc5eb2138566f88b5fcda188556348eee4fcd..30a035593a8b4f458c2e3a7adea3d6600ca873ce 100644 (file)
@@ -37,7 +37,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if !NET_2_1
+#if !MOBILE
 
 using System;
 using System.Collections;
@@ -1029,5 +1029,5 @@ namespace Microsoft.Win32 {
        }
 }
 
-#endif // NET_2_1
+#endif // MOBILE
 
index c5335ffd0e951c7110b139209055c0581dd99eb0..220967e09e4b157c1bd72f731002968cff817139 100644 (file)
@@ -33,7 +33,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if !NET_2_1
+#if !MOBILE
 
 using System;
 using System.Collections;
@@ -241,48 +241,66 @@ namespace Microsoft.Win32
                public void SetValue (RegistryKey rkey, string name, object value, RegistryValueKind valueKind)
                {
                        Type type = value.GetType ();
-                       int result;
                        IntPtr handle = GetHandle (rkey);
 
-                       if (valueKind == RegistryValueKind.QWord && type == typeof (long)) {
-                               long rawValue = (long)value;
-                               result = RegSetValueEx (handle, name, IntPtr.Zero, RegistryValueKind.QWord, ref rawValue, Int64ByteSize); 
-                       } else if (valueKind == RegistryValueKind.DWord && type == typeof (int)) {
-                               int rawValue = (int)value;
-                               result = RegSetValueEx (handle, name, IntPtr.Zero, RegistryValueKind.DWord, ref rawValue, Int32ByteSize); 
-                       } else if (valueKind == RegistryValueKind.Binary && type == typeof (byte[])) {
-                               byte[] rawValue = (byte[]) value;
-                               result = RegSetValueEx (handle, name, IntPtr.Zero, RegistryValueKind.Binary, rawValue, rawValue.Length);
-                       } else if (valueKind == RegistryValueKind.MultiString && type == typeof (string[])) {
-                               string[] vals = (string[]) value;
-                               StringBuilder fullStringValue = new StringBuilder ();
-                               foreach (string v in vals)
-                               {
-                                       fullStringValue.Append (v);
-                                       fullStringValue.Append ('\0');
+                       switch (valueKind) {
+                       case RegistryValueKind.QWord:
+                               try {
+                                       long rawValue = Convert.ToInt64 (value);
+                                       CheckResult (RegSetValueEx (handle, name, IntPtr.Zero, RegistryValueKind.QWord, ref rawValue, Int64ByteSize));
+                                       return;
+                               } catch (OverflowException) {
                                }
-                               fullStringValue.Append ('\0');
+                               break;
+                       case RegistryValueKind.DWord:
+                               try {
+                                       int rawValue = Convert.ToInt32 (value);
+                                       CheckResult (RegSetValueEx (handle, name, IntPtr.Zero, RegistryValueKind.DWord, ref rawValue, Int32ByteSize));
+                                       return;
+                               } catch (OverflowException) {
+                               }
+                               break;
+                       case RegistryValueKind.Binary:
+                               if (type == typeof (byte[])) {
+                                       byte[] rawValue = (byte[]) value;
+                                       CheckResult (RegSetValueEx (handle, name, IntPtr.Zero, RegistryValueKind.Binary, rawValue, rawValue.Length));
+                                       return;
+                               }
+                               break;
+                       case RegistryValueKind.MultiString:
+                               if (type == typeof (string[])) {
+                                       string[] vals = (string[]) value;
+                                       StringBuilder fullStringValue = new StringBuilder ();
+                                       foreach (string v in vals)
+                                       {
+                                               fullStringValue.Append (v);
+                                               fullStringValue.Append ('\0');
+                                       }
+                                       fullStringValue.Append ('\0');
 
-                               byte[] rawValue = Encoding.Unicode.GetBytes (fullStringValue.ToString ());
+                                       byte[] rawValue = Encoding.Unicode.GetBytes (fullStringValue.ToString ());
                        
-                               result = RegSetValueEx (handle, name, IntPtr.Zero, RegistryValueKind.MultiString, rawValue, rawValue.Length); 
-                       } else if ((valueKind == RegistryValueKind.String || valueKind == RegistryValueKind.ExpandString) &&
-                                  type == typeof (string)){
-                               string rawValue = String.Format ("{0}{1}", value, '\0');
-                               result = RegSetValueEx (handle, name, IntPtr.Zero, valueKind, rawValue,
-                                                       rawValue.Length * NativeBytesPerCharacter);
-                               
-                       } else if (type.IsArray) {
-                               throw new ArgumentException ("Only string and byte arrays can written as registry values");
-                       } else {
-                               throw new ArgumentException ("Type does not match the valueKind");
+                                       CheckResult (RegSetValueEx (handle, name, IntPtr.Zero, RegistryValueKind.MultiString, rawValue, rawValue.Length));
+                                       return;
+                               }
+                               break;
+                       case RegistryValueKind.String:
+                       case RegistryValueKind.ExpandString:
+                               if (type == typeof (string)) {
+                                       string rawValue = String.Format ("{0}{1}", value, '\0');
+                                       CheckResult (RegSetValueEx (handle, name, IntPtr.Zero, valueKind, rawValue,
+                                                               rawValue.Length * NativeBytesPerCharacter));
+                                       return;
+                               }
+                               break;
+                       default:
+                               if (type.IsArray) {
+                                       throw new ArgumentException ("Only string and byte arrays can written as registry values");
+                               }
+                               break;
                        }
 
-                       // handle the result codes
-                       if (result != Win32ResultCode.Success)
-                       {
-                               GenerateException (result);
-                       }
+                       throw new ArgumentException ("Type does not match the valueKind");
                }
        
                public void SetValue (RegistryKey rkey, string name, object value)
@@ -318,9 +336,6 @@ namespace Microsoft.Win32
                                                        rawValue.Length * NativeBytesPerCharacter);
                        }
 
-                       if (result == Win32ResultCode.MarkedForDeletion)
-                               throw RegistryKey.CreateMarkedForDeletionException ();
-
                        // handle the result codes
                        if (result != Win32ResultCode.Success)
                        {
@@ -356,9 +371,6 @@ namespace Microsoft.Win32
                                int result = RegEnumKey (handle, index, stringBuffer,
                                        stringBuffer.Capacity);
 
-                               if (result == Win32ResultCode.MarkedForDeletion)
-                                       throw RegistryKey.CreateMarkedForDeletionException ();
-
                                if (result == Win32ResultCode.Success)
                                        continue;
                                
@@ -386,9 +398,6 @@ namespace Microsoft.Win32
                                                       IntPtr.Zero, ref type, 
                                                       IntPtr.Zero, IntPtr.Zero);
 
-                               if (result == Win32ResultCode.MarkedForDeletion)
-                                       throw RegistryKey.CreateMarkedForDeletionException ();
-
                                if (result == Win32ResultCode.Success || result == Win32ResultCode.MoreData)
                                        continue;
                                
@@ -470,9 +479,6 @@ namespace Microsoft.Win32
                                RegOptionsNonVolatile,
                                OpenRegKeyRead | OpenRegKeyWrite, IntPtr.Zero, out subKeyHandle, out disposition);
 
-                       if (result == Win32ResultCode.MarkedForDeletion)
-                               throw RegistryKey.CreateMarkedForDeletionException ();
-
                        if (result != Win32ResultCode.Success) {
                                GenerateException (result);
                        }
@@ -490,9 +496,6 @@ namespace Microsoft.Win32
                                options == RegistryOptions.Volatile ? RegOptionsVolatile : RegOptionsNonVolatile,
                                OpenRegKeyRead | OpenRegKeyWrite, IntPtr.Zero, out subKeyHandle, out disposition);
 
-                       if (result == Win32ResultCode.MarkedForDeletion)
-                               throw RegistryKey.CreateMarkedForDeletionException ();
-
                        if (result != Win32ResultCode.Success)
                                GenerateException (result);
                        
@@ -580,15 +583,19 @@ namespace Microsoft.Win32
                                if (result == Win32ResultCode.NoMoreEntries)
                                        break;
 
-                               if (result == Win32ResultCode.MarkedForDeletion)
-                                       throw RegistryKey.CreateMarkedForDeletionException ();
-
                                GenerateException (result);
                        }
 
                        return values.ToArray ();
                }
 
+               private void CheckResult (int result)
+               {
+                       if (result != Win32ResultCode.Success) {
+                               GenerateException (result);
+                       }
+               }
+
                /// <summary>
                /// convert a win32 error code into an appropriate exception.
                /// </summary>
@@ -604,6 +611,10 @@ namespace Microsoft.Win32
                                        throw new IOException ("The network path was not found.");
                                case Win32ResultCode.InvalidHandle:
                                        throw new IOException ("Invalid handle.");
+                               case Win32ResultCode.MarkedForDeletion:
+                                       throw RegistryKey.CreateMarkedForDeletionException ();
+                               case Win32ResultCode.ChildMustBeVolatile:
+                                       throw new IOException ("Cannot create a stable subkey under a volatile parent key.");
                                default:
                                        // unidentified system exception
                                        throw new SystemException ();
@@ -626,5 +637,5 @@ namespace Microsoft.Win32
        }
 }
 
-#endif // NET_2_1
+#endif // MOBILE
 
index 1d0cbdaa8598b3fc0113fa868725955a03d86d38..4e8e85d0e85e8e77c050218454b158f705730613 100644 (file)
@@ -30,7 +30,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if !NET_2_1
+#if !MOBILE
 
 using System;
 using System.Runtime.InteropServices;
@@ -58,8 +58,9 @@ namespace Microsoft.Win32
                public const int NetworkPathNotFound = 53;
                public const int NoMoreEntries = 259;
                public const int MarkedForDeletion = 1018;
+               public const int ChildMustBeVolatile = 1021;
        }
 }
 
-#endif // NET_2_1
+#endif // MOBILE
 
index 104516c3e934b25c896330bf7df3f381d7eaafca..9be2deb9e2e84f2db87abe40b6968dd4eaf685d3 100644 (file)
@@ -1015,7 +1015,7 @@ namespace Mono.Security {
                        }
                        
                        // 5 path
-                       pos = uriString.IndexOfAny (new char[] {'/'});
+                       pos = uriString.IndexOfAny (new char[] {'/', '\\'});
                        if (unixAbsPath)
                                pos = -1;
                        if (pos == -1) {
@@ -1042,6 +1042,8 @@ namespace Mono.Security {
                        pos = uriString.LastIndexOf (":");
                        if (unixAbsPath)
                                pos = -1;
+                       if (pos == 1 && scheme == Uri.UriSchemeFile && Char.IsLetter (uriString [0]))
+                               pos = -1;
                        if (pos != -1 && pos != (uriString.Length - 1)) {
                                string portStr = uriString.Remove (0, pos + 1);
                                if (portStr.Length > 1 && portStr [portStr.Length - 1] != ']') {
index 7a5f9887c6334fff01b0f7f9835659b44fac9be3..12148ed85d84c200f318fe12be0d087504dfff80 100644 (file)
@@ -31,7 +31,7 @@ using System.Runtime.CompilerServices;
 
 namespace Mono {
 
-#if MOBILE
+#if MOBILE || XAMMAC_4_5
        public
 #endif
        static class Runtime
@@ -40,16 +40,31 @@ namespace Mono {
                [MethodImplAttribute (MethodImplOptions.InternalCall)]
                private static extern void mono_runtime_install_handlers ();
 
-               static internal void InstallSignalHandlers ()
+#if MOBILE || XAMMAC_4_5
+               public
+#else
+               internal
+#endif
+               static void InstallSignalHandlers ()
                {
                        mono_runtime_install_handlers ();
                }
 
+#if MOBILE || XAMMAC_4_5
+               [MethodImplAttribute (MethodImplOptions.InternalCall)]
+               static extern void mono_runtime_cleanup_handlers ();
+
+               public static void RemoveSignalHandlers ()
+               {
+                       mono_runtime_cleanup_handlers ();
+               }
+#endif
+
                // Should not be removed intended for external use
                // Safe to be called using reflection
                // Format is undefined only for use as a string for reporting
                [MethodImplAttribute (MethodImplOptions.InternalCall)]
-#if MOBILE
+#if MOBILE || XAMMAC_4_5
                public
 #else
                internal
index 6225954fb7011b60ec882c966f4199b7a9021874..f70ee556ac6adb177de9fa5cc15cc469928fefca 100644 (file)
@@ -12,6 +12,8 @@
 using System;
 using System.Runtime.InteropServices;
 
+#pragma warning disable 169
+
 namespace Mono {
        //
        // Managed representations of mono runtime types
index 55d45d833e3f6a5c74d371e8e118d0e5861f7edd..8874423d8492c49421debe9a2795fd721964f6a8 100644 (file)
@@ -2,5 +2,6 @@ namespace System {
        static class AppContextSwitches {
                public static readonly bool ThrowExceptionIfDisposedCancellationTokenSource = true;
                public static readonly bool SetActorAsReferenceWhenCopyingClaimsIdentity = false;
+               public static readonly bool NoAsyncCurrentCulture = false;
        }
 }
\ No newline at end of file
diff --git a/mcs/class/corlib/ReferenceSources/BinaryCompatibility.cs b/mcs/class/corlib/ReferenceSources/BinaryCompatibility.cs
new file mode 100644 (file)
index 0000000..7735119
--- /dev/null
@@ -0,0 +1,8 @@
+namespace System.Runtime.Versioning
+{
+       static class BinaryCompatibility
+       {
+               public static readonly bool TargetsAtLeast_Desktop_V4_5 = true;
+               public static readonly bool TargetsAtLeast_Desktop_V4_5_1 = true;
+       }
+}
\ No newline at end of file
index ba5dba8e652eb1008f7f6b1745c06f540135ff1f..24ee1ee00f249ad9e06c1520a66961ab55447a02 100644 (file)
@@ -30,7 +30,7 @@ namespace System
 {
        static class CompatibilitySwitches
        {
-               public const bool IsAppEarlierThanSilverlight4 = false;
-               public const bool IsAppEarlierThanWindowsPhone8 = false;
+               public static readonly bool IsAppEarlierThanSilverlight4 = false;
+               public static readonly bool IsAppEarlierThanWindowsPhone8 = false;
        }
 }
\ No newline at end of file
index 8a49451936e5fd80e95e17913a2a3025084c5f7d..d0b1473c7cd6d77edfae7bebbae07c837c7f9b7a 100644 (file)
@@ -140,15 +140,15 @@ namespace System
 
                internal Object CreateInstanceSlow(bool publicOnly, bool skipCheckThis, bool fillCache, ref StackCrawlMark stackMark)
                {
-                       bool bNeedSecurityCheck = true;
-                       bool bCanBeCached = false;
-                       bool bSecurityCheckOff = false;
+                       //bool bNeedSecurityCheck = true;
+                       //bool bCanBeCached = false;
+                       //bool bSecurityCheckOff = false;
 
                        if (!skipCheckThis)
                                CreateInstanceCheckThis();
 
-                       if (!fillCache)
-                               bSecurityCheckOff = true;
+                       //if (!fillCache)
+                       //      bSecurityCheckOff = true;
 
                        return CreateInstanceMono (!publicOnly);
                }
diff --git a/mcs/class/corlib/ReferenceSources/SharedStatics.cs b/mcs/class/corlib/ReferenceSources/SharedStatics.cs
deleted file mode 100644 (file)
index 01252cc..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-using System.Threading;
-using StringMaker = System.Security.Util.Tokenizer.StringMaker;
-
-namespace System
-{
-       static class SharedStatics
-       {
-               static StringMaker shared;
-               static public StringMaker GetSharedStringMaker ()
-               {
-                       if (shared == null)
-                               Interlocked.CompareExchange (ref shared, new StringMaker (), null);
-
-                       return shared;
-               }
-
-               static public void ReleaseSharedStringMaker (ref StringMaker maker)
-               {
-
-               }
-       }
-}
\ No newline at end of file
index 78cd58f81a89c863c60a9a9e4088d312b35c0828..40707aa77901e4ef83744e4a1f0a980daf7ee26f 100644 (file)
@@ -345,15 +345,13 @@ namespace System
 
                unsafe String ReplaceInternal (char oldChar, char newChar)
                {
-#if !BOOTSTRAP_BASIC                   
                        if (this.m_stringLength == 0 || oldChar == newChar)
                                return this;
-#endif
+
                        int start_pos = IndexOfUnchecked (oldChar, 0, this.m_stringLength);
-#if !BOOTSTRAP_BASIC
                        if (start_pos == -1)
                                return this;
-#endif
+
                        if (start_pos < 4)
                                start_pos = 0;
 
@@ -391,11 +389,8 @@ namespace System
                                throw new ArgumentException ("oldValue is the empty string.");
 
                        if (this.Length == 0)
-#if BOOTSTRAP_BASIC
-                               throw new NotImplementedException ("BOOTSTRAP_BASIC");
-#else
                                return this;
-#endif
+
                        if (newValue == null)
                                newValue = Empty;
 
@@ -405,11 +400,7 @@ namespace System
                private unsafe String ReplaceUnchecked (String oldValue, String newValue)
                {
                        if (oldValue.m_stringLength > m_stringLength)
-#if BOOTSTRAP_BASIC
-                               throw new NotImplementedException ("BOOTSTRAP_BASIC");
-#else
                                return this;
-#endif
 
                        if (oldValue.m_stringLength == 1 && newValue.m_stringLength == 1) {
                                return Replace (oldValue[0], newValue[0]);
@@ -434,11 +425,8 @@ namespace System
                                        i = found + oldValue.m_stringLength;
                                }
                                if (count == 0)
-#if BOOTSTRAP_BASIC
-                               throw new NotImplementedException ("BOOTSTRAP_BASIC");
-#else
-                               return this;
-#endif
+                                       return this;
+
                                int nlen = 0;
                                checked {
                                        try {
@@ -488,11 +476,8 @@ namespace System
                        if (totalWidth < 0)
                                throw new ArgumentOutOfRangeException ("totalWidth", "Non-negative number required");
                        if (totalWidth <= m_stringLength)
-#if BOOTSTRAP_BASIC
-                               throw new NotImplementedException ("BOOTSTRAP_BASIC");
-#else                  
                                return this;
-#endif
+
                        string result = FastAllocateString (totalWidth);
 
                        fixed (char *dest = result, src = &m_firstChar) {
@@ -518,11 +503,7 @@ namespace System
 
                internal bool StartsWithOrdinalUnchecked (String value)
                {
-#if BOOTSTRAP_BASIC
-                       throw new NotImplementedException ("BOOTSTRAP_BASIC");
-#else
                        return m_stringLength >= value.m_stringLength && CompareOrdinalUnchecked (this, 0, value.m_stringLength, value, 0, value.m_stringLength) == 0;
-#endif
                }
 
                internal unsafe bool IsAscii ()
index 370beffb237d13dfced0cf1337e278e0f83fee6c..a77d734c36617eaf2c41cc9d6b87cfe5f286118b 100644 (file)
@@ -102,6 +102,12 @@ namespace System
                        return UnderlyingSystemType;
                }
 
+               // Called from the runtime to return the corresponding finished Type object
+               internal virtual Type RuntimeResolve ()
+               {
+                       throw new NotImplementedException ();
+               }
+
                internal virtual bool IsUserType {
                        get {
                                return true;
diff --git a/mcs/class/corlib/ReferenceSources/TypeBuilderInstantiation.cs b/mcs/class/corlib/ReferenceSources/TypeBuilderInstantiation.cs
deleted file mode 100644 (file)
index 9e82664..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-namespace System.Reflection.Emit
-{
-       abstract class TypeBuilderInstantiation : TypeInfo
-       {
-               internal static Type MakeGenericType (Type type, Type[] typeArguments)
-               {
-#if FULL_AOT_RUNTIME
-                       throw new NotSupportedException ("User types are not supported under full aot");
-#else
-                       return new MonoGenericClass (type, typeArguments);
-#endif
-               }
-       }
-}
\ No newline at end of file
diff --git a/mcs/class/corlib/System.Diagnostics.Tracing/EventCounter.cs b/mcs/class/corlib/System.Diagnostics.Tracing/EventCounter.cs
new file mode 100644 (file)
index 0000000..4cb3625
--- /dev/null
@@ -0,0 +1,45 @@
+//
+// EventCounter.cs
+//
+// Authors:
+//     Marek Safar  <marek.safar@gmail.com>
+//
+// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com)
+//
+// 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.
+//
+
+#if NETSTANDARD
+
+namespace System.Diagnostics.Tracing
+{
+       public class EventCounter
+       {
+               public EventCounter (string name, EventSource eventSource)
+               {
+               }
+
+               public void WriteMetric (float value)
+               {
+               }
+       }
+}
+
+#endif
index 312f0ccb166d6de88051a04b5670d7e828f0bb51..bb1b719404a992efd5277abda3f6909cdecc3ede 100644 (file)
@@ -151,6 +151,7 @@ namespace System.Diagnostics.Tracing
                {
                }
 
+               [CLSCompliant (false)]
                public void Write<T> (string eventName, ref EventSourceOptions options, ref T data)
                {
                }
@@ -256,6 +257,7 @@ namespace System.Diagnostics.Tracing
                        WriteEvent (eventId, new object[] { arg1, arg2, arg3 } );
                }
 
+               [CLSCompliant (false)]
                protected unsafe void WriteEventCore (int eventId, int eventDataCount, EventData* data)
                {
                }
@@ -264,6 +266,7 @@ namespace System.Diagnostics.Tracing
                {
                }
 
+               [CLSCompliant (false)]
                protected unsafe void WriteEventWithRelatedActivityIdCore (int eventId, Guid* relatedActivityId, int eventDataCount, EventSource.EventData* data)
                {
                }
diff --git a/mcs/class/corlib/System.Diagnostics.Tracing/EventSourceException.cs b/mcs/class/corlib/System.Diagnostics.Tracing/EventSourceException.cs
deleted file mode 100644 (file)
index 3602e29..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-//
-// EventSourceException.cs
-//
-// Authors:
-//     Alexander Köplinger <alexander.koeplinger@xamarin.com>
-//
-// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com)
-//
-// 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;
-
-namespace System.Diagnostics.Tracing
-{
-       public class EventSourceException : Exception
-       {
-               [MonoTODO]
-               public EventSourceException ()
-               {
-               }
-
-               [MonoTODO]
-               public EventSourceException (string message)
-               {
-               }
-
-               [MonoTODO]
-               public EventSourceException (string message, Exception innerException)
-               {
-               }
-       }
-}
index e51e9dbfc2833eecfc922a3e1f117753a5be742b..7de9ccce096a1f6fe2a526a743c5d9c777bfc9d7 100644 (file)
@@ -134,7 +134,7 @@ namespace System.Diagnostics {
                 
                 public virtual string GetFileName()
                 {
-#if !NET_2_1
+#if !MOBILE
                        if (SecurityManager.SecurityEnabled && (fileName != null) && (fileName.Length > 0)) {
                                string fn = Path.GetFullPath (fileName);
                                new FileIOPermission (FileIOPermissionAccess.PathDiscovery, fn).Demand ();
index ccf9f835734b97315cba343aebb816fa5fbb89f4..b528e4cdadcb5ff7e2aef43c0490a14e9fa7b16b 100644 (file)
@@ -59,9 +59,9 @@ namespace System.Diagnostics {
 
                private StackFrame[] frames;
                readonly StackTrace[] captured_traces;
+#pragma warning disable 414            
                private bool debug_info;
-
-               private static Dictionary<string, Func<StackTrace, string>> metadataHandlers;
+#pragma warning restore
 
                [MethodImplAttribute (MethodImplOptions.NoInlining)]
                public StackTrace ()
@@ -198,7 +198,6 @@ namespace System.Diagnostics {
 
                bool AddFrames (StringBuilder sb)
                {
-                       bool printOffset;
                        string debugInfo, indentation;
                        string unknown = Locale.GetText ("<unknown method>");
 
@@ -251,7 +250,7 @@ namespace System.Diagnostics {
                        return i != 0;
                }
 
-               public static void GetFullNameForStackTrace (StringBuilder sb, MethodBase mi)
+               internal void GetFullNameForStackTrace (StringBuilder sb, MethodBase mi)
                {
                        var declaringType = mi.DeclaringType;
                        if (declaringType.IsGenericType && !declaringType.IsGenericTypeDefinition)
index 8b4a3504d3ad2c16973c0b1c33babe286981b7ba..63c0c015978b1c58d7cc38e2ad58f74ab5318958 100644 (file)
@@ -116,6 +116,9 @@ namespace System.Globalization
                const int CalendarTypeBits = 8;
 
                const string MSG_READONLY = "This instance is read only";
+
+               static volatile CultureInfo s_DefaultThreadCurrentUICulture;
+               static volatile CultureInfo s_DefaultThreadCurrentCulture;
                
                public static CultureInfo InvariantCulture {
                        get {
@@ -127,22 +130,18 @@ namespace System.Globalization
                        get {
                                return Thread.CurrentThread.CurrentCulture;
                        }
-#if NETSTANDARD
                        set {
-                               throw new NotImplementedException ();
+                               Thread.CurrentThread.CurrentCulture = value;
                        }
-#endif
                }
 
                public static CultureInfo CurrentUICulture { 
                        get {
                                return Thread.CurrentThread.CurrentUICulture;
                        }
-#if NETSTANDARD
                        set {
-                               throw new NotImplementedException ();
+                               Thread.CurrentThread.CurrentUICulture = value;
                        }
-#endif
                }
 
                internal static CultureInfo ConstructCurrentCulture ()
@@ -181,7 +180,6 @@ namespace System.Globalization
                        get { return territory; }
                }
 
-#if !NET_2_1
                // FIXME: It is implemented, but would be hell slow.
                [ComVisible (false)]
                public CultureTypes CultureTypes {
@@ -267,7 +265,6 @@ namespace System.Globalization
                                }
                        }
                }
-#endif
 
                public virtual int LCID {
                        get {
@@ -515,7 +512,7 @@ namespace System.Globalization
                        }
                }
 
-               internal void CheckNeutral ()
+               void CheckNeutral ()
                {
                }
 
@@ -1074,19 +1071,19 @@ namespace System.Globalization
                
                public static CultureInfo DefaultThreadCurrentCulture {
                        get {
-                               return Thread.default_culture;
+                               return s_DefaultThreadCurrentCulture;
                        }
                        set {
-                               Thread.default_culture = value;
+                               s_DefaultThreadCurrentCulture = value;
                        }
                }
                
                public static CultureInfo DefaultThreadCurrentUICulture {
                        get {
-                               return Thread.default_ui_culture;
+                               return s_DefaultThreadCurrentUICulture;
                        }
                        set {
-                               Thread.default_ui_culture = value;
+                               s_DefaultThreadCurrentUICulture = value;
                        }
                }
 
@@ -1096,6 +1093,19 @@ namespace System.Globalization
                        }
                }
 
+               internal static CultureInfo UserDefaultUICulture {
+                       get {
+                               return ConstructCurrentUICulture ();
+                       }
+               }
+
+               internal static CultureInfo UserDefaultCulture {
+                       get {
+                               return ConstructCurrentCulture ();
+                       }
+               }
+
+
 #region reference sources
                // TODO:
                internal static readonly bool IsTaiwanSku;
@@ -1148,6 +1158,19 @@ namespace System.Globalization
             return true;
         }
 
+        internal static bool VerifyCultureName(CultureInfo culture, bool throwException) {
+            Contract.Assert(culture!=null, "[CultureInfo.VerifyCultureName]culture!=null");
+
+            //If we have an instance of one of our CultureInfos, the user can't have changed the
+            //name and we know that all names are valid in files.
+            if (!culture.m_isInherited) {
+                return true;
+            }
+
+            return VerifyCultureName(culture.Name, throwException);
+
+        }
+
 #endregion
        }
 }
index ed773f6ca6a4505c369c790a608b55bcfb0617af..522f305e427fa8c6dfb7d64fa1fd8c747eaae44b 100644 (file)
@@ -86,7 +86,7 @@ namespace System.IO
 
                static DirectoryInfo CreateDirectoriesInternal (string path)
                {
-#if !NET_2_1
+#if !MOBILE
                        if (SecurityManager.SecurityEnabled) {
                                new FileIOPermission (FileIOPermissionAccess.Read | FileIOPermissionAccess.Write, path).Demand ();
                        }
@@ -232,7 +232,7 @@ namespace System.IO
                        SecurityManager.EnsureElevatedPermissions (); // this is a no-op outside moonlight
 
                        string result = InsecureGetCurrentDirectory();
-#if !NET_2_1
+#if !MOBILE
                        if ((result != null) && (result.Length > 0) && SecurityManager.SecurityEnabled) {
                                new FileIOPermission (FileIOPermissionAccess.PathDiscovery, result).Demand ();
                        }
index d25432dcacdf559da372f14a60dde2ff5ca36fbb..205fadc0026b852b25a17c83bdd4cf76aaff0239 100644 (file)
@@ -427,20 +427,20 @@ namespace System.IO {
                static internal IEnumerable<FileSystemInfo> EnumerateFileSystemInfos (string full, string searchPattern, SearchOption searchOption)
                {
                        string path_with_pattern = Path.Combine (full, searchPattern);
-                       IntPtr handle;
+                       IntPtr handle = IntPtr.Zero;
                        MonoIOError error;
                        FileAttributes rattr;
                        bool subdirs = searchOption == SearchOption.AllDirectories;
 
                        Path.Validate (full);
                        
-                       string s = MonoIO.FindFirst (full, path_with_pattern, out rattr, out error, out handle);
-                       if (s == null)
-                               yield break;
-                       if (error != 0)
-                               throw MonoIO.GetException (Path.GetDirectoryName (path_with_pattern), (MonoIOError) error);
-
                        try {
+                               string s = MonoIO.FindFirst (full, path_with_pattern, out rattr, out error, out handle);
+                               if (s == null)
+                                       yield break;
+                               if (error != 0)
+                                       throw MonoIO.GetException (Path.GetDirectoryName (path_with_pattern), (MonoIOError) error);
+
                                do {
                                        if (((rattr & FileAttributes.ReparsePoint) == 0)){
                                                if ((rattr & FileAttributes.Directory) != 0)
@@ -455,7 +455,8 @@ namespace System.IO {
 
                                } while ((s = MonoIO.FindNext (handle, out rattr, out error)) != null);
                        } finally {
-                               MonoIO.FindClose (handle);
+                               if (handle != IntPtr.Zero)
+                                       MonoIO.FindClose (handle);
                        }
                }
                
index 92389257c5c788f84d7050c696d81075ff9109ee..d3eebc441064065b3045fd0dfc83525f28864ae3 100644 (file)
@@ -38,10 +38,7 @@ using System.Diagnostics;
 using System.Security;
 using System.Text;
 using System.Runtime.InteropServices;
-
-#if !NET_2_1
 using System.Security.AccessControl;
-#endif
 
 namespace System.IO
 {
@@ -147,7 +144,6 @@ namespace System.IO
                                FileShare.None, bufferSize, options);
                }
 
-#if !NET_2_1
                [MonoLimitation ("FileOptions and FileSecurity are ignored")]
                public static FileStream Create (string path, int bufferSize,
                                                 FileOptions options,
@@ -156,7 +152,6 @@ namespace System.IO
                        return new FileStream (path, FileMode.Create, FileAccess.ReadWrite,
                                FileShare.None, bufferSize, options);
                }
-#endif
 
                public static StreamWriter CreateText (string path)
                {
@@ -201,7 +196,6 @@ namespace System.IO
                        return MonoIO.ExistsFile (path, out error);
                }
 
-#if !NET_2_1
                public static FileSecurity GetAccessControl (string path)
                {
                        // AccessControlSections.Audit requires special permissions.
@@ -215,7 +209,6 @@ namespace System.IO
                {
                        return new FileSecurity (path, includeSections);
                }
-#endif
 
                public static FileAttributes GetAttributes (string path)
                {
@@ -434,7 +427,6 @@ namespace System.IO
                        }
                }
 
-#if !NET_2_1
                public static void SetAccessControl (string path,
                                                     FileSecurity fileSecurity)
                {
@@ -443,7 +435,6 @@ namespace System.IO
 
                        fileSecurity.PersistModifications (path);
                }
-#endif
 
                public static void SetAttributes (string path,
                                                  FileAttributes fileAttributes)
index 0e20810547c0d9e635daa6c428388aed0d86b138..db13468d36fcfaa9a4f0d82164ae8a33ccfeb2cf 100644 (file)
@@ -37,17 +37,11 @@ using System.Runtime.CompilerServices;
 using System.Runtime.InteropServices;
 using System.Runtime.Remoting.Messaging;
 using System.Security;
+using System.Security.AccessControl;
 using System.Security.Permissions;
 using System.Threading;
-using Microsoft.Win32.SafeHandles;
-
-#if NET_2_1
-using System.IO.IsolatedStorage;
-#else
-using System.Security.AccessControl;
-#endif
-
 using System.Threading.Tasks;
+using Microsoft.Win32.SafeHandles;
 
 namespace System.IO
 {
@@ -129,7 +123,6 @@ namespace System.IO
                        Init (handle, access, false, bufferSize, isAsync, false);
                }
 
-#if !MOBILE
                [MonoLimitation ("This ignores the rights parameter")]
                public FileStream (string path, FileMode mode,
                                   FileSystemRights rights, FileShare share,
@@ -146,7 +139,6 @@ namespace System.IO
                        : this (path, mode, (mode == FileMode.Append ? FileAccess.Write : FileAccess.ReadWrite), share, bufferSize, false, options)
                {
                }
-#endif
 
                internal FileStream (string path, FileMode mode, FileAccess access, FileShare share, int bufferSize, FileOptions options, string msgPath, bool bFromProxy, bool useLongPath = false, bool checkHost = false)
                        : this (path, mode, access, share, bufferSize, false, options)
@@ -176,7 +168,7 @@ namespace System.IO
                                throw new ArgumentOutOfRangeException ("bufferSize", "Positive number required.");
 
                        if (mode < FileMode.CreateNew || mode > FileMode.Append) {
-#if NET_2_1
+#if MOBILE
                                if (anonymous)
                                        throw new ArgumentException ("mode", "Enum value was out of legal range.");
                                else
@@ -942,7 +934,6 @@ namespace System.IO
                                throw exc;
                }
 
-#if !NET_2_1
                public FileSecurity GetAccessControl ()
                {
                        if (safeHandle.IsClosed)
@@ -964,7 +955,6 @@ namespace System.IO
                                
                        fileSecurity.PersistModifications (SafeFileHandle);
                }
-#endif
 
                public override Task FlushAsync (CancellationToken cancellationToken)
                {
index 994358c86bec2aff6ec7373da50dcd0ee17d515a..35a81c5e44984e708ae919fbd399daa9f5512fcb 100644 (file)
@@ -36,7 +36,7 @@ using System.Runtime.CompilerServices;
 using System.Runtime.InteropServices;
 using System.Threading;
 using Microsoft.Win32.SafeHandles;
-#if NET_2_1
+#if MOBILE
 using System.IO.IsolatedStorage;
 #endif
 
@@ -108,7 +108,7 @@ namespace System.IO
                                return new IOException (message, unchecked((int)0x80070000) | (int)error);
                        case MonoIOError.ERROR_INVALID_DRIVE:
                                message = String.Format ("Could not find the drive  '{0}'. The drive might not be ready or might not be mapped.", path);
-#if !NET_2_1
+#if !MOBILE
                                return new DriveNotFoundException (message);
 #else
                                return new IOException (message, unchecked((int)0x80070000) | (int)error);
@@ -155,6 +155,10 @@ namespace System.IO
                        case MonoIOError.ERROR_NOT_SAME_DEVICE:
                                message = "Source and destination are not on the same device";
                                return new IOException (message, unchecked((int)0x80070000) | (int)error);
+
+                       case MonoIOError.ERROR_DIRECTORY:
+                               message = "The directory name is invalid";
+                               return new IOException (message, unchecked((int)0x80070000) | (int)error);
                                
                        default:
                                message = String.Format ("Win32 IO returned {0}. Path: {1}", error, path);
index 63756d190102372893732fd9e10aed7dabbf6526..2a78687ef36d21f80290a1816a747ef91eac5773 100644 (file)
@@ -217,8 +217,8 @@ namespace System.IO
                WAIT_TIMEOUT = 258,\r
                ERROR_NO_MORE_ITEMS = 259,\r
                ERROR_CANNOT_COPY = 266,\r
-               ERROR_DIRECTORY = 267,\r
-               ERROR_EAS_DIDNT_FIT = 275,\r
+       */      ERROR_DIRECTORY = 267,\r
+       /*      ERROR_EAS_DIDNT_FIT = 275,\r
                ERROR_EA_FILE_CORRUPT = 276,\r
                ERROR_EA_TABLE_FULL = 277,\r
                ERROR_INVALID_EA_HANDLE = 278,\r
index d0512f24695a2a5dbe3111080092742268f8da45..5d63f271e607243398a6934082db61d9c17df0f8 100644 (file)
@@ -140,6 +140,7 @@ namespace System.IO {
                {
                        int l = s.Length;
                        int sub = 0;
+                       int alt = 0;
                        int start = 0;
 
                        // Host prefix?
@@ -158,6 +159,8 @@ namespace System.IO {
                                
                                if (c != DirectorySeparatorChar && c != AltDirectorySeparatorChar)
                                        continue;
+                               if (DirectorySeparatorChar != AltDirectorySeparatorChar && c == AltDirectorySeparatorChar)
+                                       alt++;
                                if (i+1 == l)
                                        sub++;
                                else {
@@ -167,7 +170,7 @@ namespace System.IO {
                                }
                        }
 
-                       if (sub == 0)
+                       if (sub == 0 && alt == 0)
                                return s;
 
                        char [] copy = new char [l-sub];
@@ -281,7 +284,7 @@ namespace System.IO {
 
                        SecurityManager.EnsureElevatedPermissions (); // this is a no-op outside moonlight
 
-#if !NET_2_1
+#if !MOBILE
                        if (SecurityManager.SecurityEnabled) {
                                new FileIOPermission (FileIOPermissionAccess.PathDiscovery, fullpath).Demand ();
                        }
@@ -729,6 +732,7 @@ namespace System.IO {
                        else {
                                string ret = String.Join (DirectorySeparatorStr, dirs, 0, target);
                                if (Environment.IsRunningOnWindows) {
+#if !MOBILE                                    
                                        // append leading '\' of the UNC path that was lost in STEP 3.
                                        if (isUnc)
                                                ret = Path.DirectorySeparatorStr + ret;
@@ -754,6 +758,7 @@ namespace System.IO {
                                                else
                                                        return current + ret;
                                        }
+#endif
                                } else {
                                        if (root != "" && ret.Length > 0 && ret [0] != '/')
                                                ret = root + ret;
@@ -873,11 +878,13 @@ namespace System.IO {
                                throw new ArgumentException (Locale.GetText ("Path is empty"));
                        if (path.IndexOfAny (Path.InvalidPathChars) != -1)
                                throw new ArgumentException (Locale.GetText ("Path contains invalid chars"));
+#if !MOBILE                            
                        if (Environment.IsRunningOnWindows) {
                                int idx = path.IndexOf (':');
                                if (idx >= 0 && idx != 1)
                                        throw new ArgumentException (parameterName);
                        }
+#endif
                }
 
                internal static string DirectorySeparatorCharAsString {
@@ -885,5 +892,7 @@ namespace System.IO {
                                return DirectorySeparatorStr;
                        }
                }
+
+               internal const int MAX_PATH = 260;  // From WinDef.h
        }
 }
index 0a189e1faa7e70b7a2db00d32532f5ee80005c82..ed524bb7c1878e5d63985411be8a9bf3a9dfbe9b 100644 (file)
@@ -384,7 +384,7 @@ namespace System.Reflection.Emit
 
                internal void AddPermissionRequests (PermissionSet required, PermissionSet optional, PermissionSet refused)
                {
-#if !NET_2_1
+#if !MOBILE
                        if (created)
                                throw new InvalidOperationException ("Assembly was already saved.");
 
@@ -466,6 +466,11 @@ namespace System.Reflection.Emit
                        return new AssemblyBuilder (name, null, access, false);
                }
 
+               public static AssemblyBuilder DefineDynamicAssembly (AssemblyName name, AssemblyBuilderAccess access, IEnumerable<CustomAttributeBuilder> assemblyAttributes)
+               {
+                       throw new NotImplementedException ();
+               }
+
                public ModuleBuilder DefineDynamicModule (string name)
                {
                        return DefineDynamicModule (name, name, false, true);
@@ -1041,7 +1046,7 @@ namespace System.Reflection.Emit
                /*Warning, @typeArguments must be a mscorlib internal array. So make a copy before passing it in*/
                internal Type MakeGenericType (Type gtd, Type[] typeArguments)
                {
-                       return new MonoGenericClass (gtd, typeArguments);
+                       return new TypeBuilderInstantiation (gtd, typeArguments);
                }
 
                void _AssemblyBuilder.GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
diff --git a/mcs/class/corlib/System.Reflection.Emit/AssemblyBuilder.pns.cs b/mcs/class/corlib/System.Reflection.Emit/AssemblyBuilder.pns.cs
new file mode 100644 (file)
index 0000000..e10784c
--- /dev/null
@@ -0,0 +1,69 @@
+//
+// AssemblyBuilder.pns.cs
+//
+// Authors:
+//   Marek Safar (marek.safar@gmail.com)
+//
+// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com)
+//
+// 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.
+//
+
+#if FULL_AOT_RUNTIME
+
+namespace System.Reflection.Emit
+{
+       public class AssemblyBuilder : Assembly
+       {
+               public static AssemblyBuilder DefineDynamicAssembly (AssemblyName name, AssemblyBuilderAccess access)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public static AssemblyBuilder DefineDynamicAssembly (AssemblyName name, AssemblyBuilderAccess access, System.Collections.Generic.IEnumerable<CustomAttributeBuilder> assemblyAttributes)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public ModuleBuilder DefineDynamicModule (string name)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public ModuleBuilder GetDynamicModule (string name)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public void SetCustomAttribute (CustomAttributeBuilder customBuilder)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+
+               public void SetCustomAttribute (ConstructorInfo con, byte[] binaryAttribute)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+       }
+}
+
+#endif
\ No newline at end of file
index 3d1bdf152830e8d3618747e975b890c27de06c04..d9d588bdac8cb05966ca4f8046433022ba109ae3 100644 (file)
@@ -28,7 +28,6 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if !FULL_AOT_RUNTIME || IOS_REFLECTION
 using System.Runtime.InteropServices;
 
 namespace System.Reflection.Emit
@@ -44,4 +43,3 @@ namespace System.Reflection.Emit
                RunAndCollect = 9
   }
 }
-#endif
index d74a09a1cede25bf4933c69f466f1cdf9a1b2c97..55a392d38442814419e937fdb4088f2f3bd8b526 100644 (file)
@@ -145,7 +145,11 @@ namespace System.Reflection.Emit {
                internal override Type GetParameterType (int pos) {
                        return parameters [pos];
                }
-               
+
+               internal MethodBase RuntimeResolve () {
+                       return type.RuntimeResolve ().GetConstructor (this);
+               }
+
                public override Object Invoke (Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
                {
                        throw not_supported ();
@@ -201,7 +205,7 @@ namespace System.Reflection.Emit {
 
                public void AddDeclarativeSecurity (SecurityAction action, PermissionSet pset)
                {
-#if !NET_2_1
+#if !MOBILE
                        if (pset == null)
                                throw new ArgumentNullException ("pset");
                        if ((action == SecurityAction.RequestMinimum) ||
@@ -360,6 +364,23 @@ namespace System.Reflection.Emit {
                        if (ilgen != null)
                                ilgen.label_fixup (this);
                }
+
+               internal void ResolveUserTypes () {
+                       TypeBuilder.ResolveUserTypes (parameters);
+                       if (paramModReq != null) {
+                               foreach (var types in paramModReq)
+                                       TypeBuilder.ResolveUserTypes (types);
+                       }
+                       if (paramModOpt != null) {
+                               foreach (var types in paramModOpt)
+                                       TypeBuilder.ResolveUserTypes (types);
+                       }
+               }
+
+               internal void FixupTokens (Dictionary<int, int> token_map, Dictionary<int, MemberInfo> member_map) {
+                       if (ilgen != null)
+                               ilgen.FixupTokens (token_map, member_map);
+               }
                
                internal void GenerateDebugInfo (ISymbolWriter symbolWriter)
                {
diff --git a/mcs/class/corlib/System.Reflection.Emit/ConstructorBuilder.pns.cs b/mcs/class/corlib/System.Reflection.Emit/ConstructorBuilder.pns.cs
new file mode 100644 (file)
index 0000000..2432a64
--- /dev/null
@@ -0,0 +1,92 @@
+//
+// ConstructorBuilder.pns.cs
+//
+// Authors:
+//   Marek Safar (marek.safar@gmail.com)
+//
+// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com)
+//
+// 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.
+//
+
+#if FULL_AOT_RUNTIME
+
+namespace System.Reflection.Emit
+{
+       public abstract class ConstructorBuilder : ConstructorInfo
+       {
+               public bool InitLocals { get; set; }
+
+               public override MethodAttributes Attributes { 
+                       get {
+                               throw new PlatformNotSupportedException ();
+                       }
+               }
+
+               public override Type DeclaringType {
+                       get {
+                               throw new PlatformNotSupportedException ();
+                       }
+               }
+
+               public override string Name {
+                       get {
+                               throw new PlatformNotSupportedException ();
+                       }
+               }
+
+               public ParameterBuilder DefineParameter (int iSequence, ParameterAttributes attributes, string strParamName)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public ILGenerator GetILGenerator ()
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public ILGenerator GetILGenerator (int streamSize)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public override ParameterInfo[] GetParameters ()
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public void SetCustomAttribute (CustomAttributeBuilder customBuilder)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public void SetCustomAttribute (ConstructorInfo con, byte[] binaryAttribute)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public void SetImplementationFlags (MethodImplAttributes attributes)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+       }
+}
+
+#endif
\ No newline at end of file
index 149e5dbd6633d1a5d6940d761cfcc18be4a8e37f..643e7272a3a9be6666a2dd3366095b1dd968c8d5 100644 (file)
@@ -42,11 +42,11 @@ namespace System.Reflection.Emit
        internal class ConstructorOnTypeBuilderInst : ConstructorInfo
        {
                #region Keep in sync with object-internals.h
-               MonoGenericClass instantiation;
-               ConstructorInfo cb;
+               internal TypeBuilderInstantiation instantiation;
+               internal ConstructorInfo cb;
                #endregion
 
-               public ConstructorOnTypeBuilderInst (MonoGenericClass instantiation, ConstructorInfo cb)
+               public ConstructorOnTypeBuilderInst (TypeBuilderInstantiation instantiation, ConstructorInfo cb)
                {
                        this.instantiation = instantiation;
                        this.cb = cb;
@@ -134,6 +134,25 @@ namespace System.Reflection.Emit
                        return res;
                }
 
+               internal override Type[] GetParameterTypes () {
+                       if (cb is ConstructorBuilder) {
+                               return (cb as ConstructorBuilder).parameters;
+                       } else {
+                               ParameterInfo[] parms = cb.GetParameters ();
+                               var res = new Type [parms.Length];
+                               for (int i = 0; i < parms.Length; i++) {
+                                       res [i] = parms [i].ParameterType;
+                               }
+                               return res;
+                       }
+               }
+
+               // Called from the runtime to return the corresponding finished ConstructorInfo object
+               internal ConstructorInfo RuntimeResolve () {
+                       var type = instantiation.InternalResolve ();
+                       return type.GetConstructor (cb);
+               }
+
                public override int MetadataToken {
                        get {
                                return base.MetadataToken;
diff --git a/mcs/class/corlib/System.Reflection.Emit/CustomAttributeBuilder.pns.cs b/mcs/class/corlib/System.Reflection.Emit/CustomAttributeBuilder.pns.cs
new file mode 100644 (file)
index 0000000..fe74950
--- /dev/null
@@ -0,0 +1,57 @@
+//
+// CustomAttributeBuilder.pns.cs
+//
+// Authors:
+//   Marek Safar (marek.safar@gmail.com)
+//
+// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com)
+//
+// 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.
+//
+
+#if FULL_AOT_RUNTIME
+
+namespace System.Reflection.Emit
+{
+       public class CustomAttributeBuilder
+       {
+               public CustomAttributeBuilder (ConstructorInfo con, object[] constructorArgs)
+               {
+                       throw new PlatformNotSupportedException ();                     
+               }
+
+               public CustomAttributeBuilder (ConstructorInfo con, object[] constructorArgs, FieldInfo[] namedFields, object[] fieldValues)
+               {
+                       throw new PlatformNotSupportedException ();                     
+               }
+
+               public CustomAttributeBuilder (ConstructorInfo con, object[] constructorArgs, PropertyInfo[] namedProperties, object[] propertyValues)
+               {
+                       throw new PlatformNotSupportedException ();                     
+               }
+
+               public CustomAttributeBuilder (ConstructorInfo con, object[] constructorArgs, PropertyInfo[] namedProperties, object[] propertyValues, FieldInfo[] namedFields, object[] fieldValues)
+               {
+                       throw new PlatformNotSupportedException ();                     
+               }
+       }
+}
+
+#endif
\ No newline at end of file
index b7ce6e0410a767355c9db8fcf9c9f0387ffd5f50..0e426991c6ec3392ece4fe91fb7342a7baa5fa61 100644 (file)
@@ -45,9 +45,6 @@ namespace System.Reflection.Emit
        {
                internal Type m_baseType;
 
-               [MethodImplAttribute(MethodImplOptions.InternalCall)]
-               static extern void create_unmanaged_type (Type type);
-
                internal SymbolType (Type elementType)
                {
                        this.m_baseType = elementType;
@@ -121,7 +118,6 @@ namespace System.Reflection.Emit
        
                public override Type UnderlyingSystemType {
                        get {
-                               create_unmanaged_type (this);
                                return this;
                        }
                }
@@ -131,6 +127,11 @@ namespace System.Reflection.Emit
                                return m_baseType.IsUserType;
                        }
                }
+
+               // Called from the runtime to return the corresponding finished Type object
+               internal override Type RuntimeResolve () {
+                       return InternalResolve ();
+               }
        }
 
        [StructLayout (LayoutKind.Sequential)]
@@ -150,9 +151,17 @@ namespace System.Reflection.Emit
 
                internal override Type InternalResolve ()
                {
-                       Type et = m_baseType.InternalResolve (); 
+                       Type et = m_baseType.InternalResolve ();
+                       if (rank == 0)
+                               return et.MakeArrayType ();
+                       return et.MakeArrayType (rank);
+               }
+
+               internal override Type RuntimeResolve ()
+               {
+                       Type et = m_baseType.RuntimeResolve ();
                        if (rank == 0)
-                               return et.MakeArrayType ();                     
+                               return et.MakeArrayType ();
                        return et.MakeArrayType (rank);
                }
 
index b5baac27ea0c69e17c2a6b18738bdd4e13b87e08..cba66c11840021f0404590a53fd2c5c2d81c6164 100644 (file)
@@ -162,6 +162,11 @@ namespace System.Reflection.Emit {
                        return res;
                }
 
+               public TypeInfo CreateTypeInfo()
+               {
+                       return _tb.CreateTypeInfo ();
+               }
+
                public override Type GetEnumUnderlyingType ()
                {
                        return _underlyingType;
diff --git a/mcs/class/corlib/System.Reflection.Emit/EnumBuilder.pns.cs b/mcs/class/corlib/System.Reflection.Emit/EnumBuilder.pns.cs
new file mode 100644 (file)
index 0000000..e518bc4
--- /dev/null
@@ -0,0 +1,117 @@
+//
+// EnumBuilder.pns.cs
+//
+// Authors:
+//   Marek Safar (marek.safar@gmail.com)
+//
+// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com)
+//
+// 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.
+//
+
+#if FULL_AOT_RUNTIME
+
+namespace System.Reflection.Emit
+{
+       public abstract class EnumBuilder : TypeInfo
+       {
+               public FieldBuilder UnderlyingField {
+                       get {
+                               throw new PlatformNotSupportedException ();
+                       }
+               }
+
+               public override Assembly Assembly {
+                       get {
+                               throw new PlatformNotSupportedException ();
+                       }
+               }
+
+               public override string AssemblyQualifiedName {
+                       get {
+                               throw new PlatformNotSupportedException ();
+                       }
+               }
+
+               public override Type BaseType {
+                       get {
+                               throw new PlatformNotSupportedException ();
+                       }
+               }
+
+               public override string FullName {
+                       get {
+                               throw new PlatformNotSupportedException ();
+                       }
+               }
+
+               public override Guid GUID {
+                       get {
+                               throw new PlatformNotSupportedException ();
+                       }
+               }
+
+               public override Module Module {
+                       get {
+                               throw new PlatformNotSupportedException ();
+                       }
+               }
+
+               public override string Name {
+                       get {
+                               throw new PlatformNotSupportedException ();
+                       }
+               }
+               
+               public override string Namespace {
+                       get {
+                               throw new PlatformNotSupportedException ();
+                       }
+               }
+
+               public TypeInfo CreateTypeInfo ()
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public FieldBuilder DefineLiteral (string literalName, object literalValue)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public override System.Type GetElementType ()
+               {
+                       throw new PlatformNotSupportedException ();
+               }               
+
+               public void SetCustomAttribute (CustomAttributeBuilder customBuilder)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public void SetCustomAttribute (ConstructorInfo con, byte[] binaryAttribute)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+               
+       }
+}
+
+#endif
\ No newline at end of file
diff --git a/mcs/class/corlib/System.Reflection.Emit/EventBuilder.pns.cs b/mcs/class/corlib/System.Reflection.Emit/EventBuilder.pns.cs
new file mode 100644 (file)
index 0000000..159585c
--- /dev/null
@@ -0,0 +1,67 @@
+//
+// EventBuilder.pns.cs
+//
+// Authors:
+//   Marek Safar (marek.safar@gmail.com)
+//
+// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com)
+//
+// 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.
+//
+
+#if FULL_AOT_RUNTIME
+
+namespace System.Reflection.Emit
+{
+       public class EventBuilder
+       {               
+               public void AddOtherMethod (MethodBuilder mdBuilder)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public void SetAddOnMethod (MethodBuilder mdBuilder)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public void SetCustomAttribute (CustomAttributeBuilder customBuilder)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public void SetCustomAttribute (ConstructorInfo con, byte[] binaryAttribute)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public void SetRaiseMethod (MethodBuilder mdBuilder)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public void SetRemoveOnMethod (MethodBuilder mdBuilder)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+       }
+}
+
+#endif
\ No newline at end of file
index 2e4367ab96573525b9f8da270f134b7d83b8d06a..f54340ebf04df4013daf953c1ee1e3f5e31bc4ec 100644 (file)
@@ -42,17 +42,17 @@ namespace System.Reflection.Emit
        [StructLayout (LayoutKind.Sequential)]
        internal class EventOnTypeBuilderInst : EventInfo
        {
-               MonoGenericClass instantiation;
+               TypeBuilderInstantiation instantiation;
                EventBuilder event_builder;
                EventInfo event_info;
 
-               internal EventOnTypeBuilderInst (MonoGenericClass instantiation, EventBuilder evt)
+               internal EventOnTypeBuilderInst (TypeBuilderInstantiation instantiation, EventBuilder evt)
                {
                        this.instantiation = instantiation;
                        this.event_builder = evt;
                }
 
-               internal EventOnTypeBuilderInst (MonoGenericClass instantiation, EventInfo evt)
+               internal EventOnTypeBuilderInst (TypeBuilderInstantiation instantiation, EventInfo evt)
                {
                        this.instantiation = instantiation;
                        this.event_info = evt;
index 053d8c831e4d05ea750b5b98b6324e0bb84d254f..f8522ebe862a6dee35fac7668cf2d959260eb50d 100644 (file)
@@ -220,6 +220,18 @@ namespace System.Reflection.Emit {
                                throw new InvalidOperationException ("Unable to change after type has been created.");
                }
 
+               internal void ResolveUserTypes () {
+                       type = TypeBuilder.ResolveUserType (type);
+                       TypeBuilder.ResolveUserTypes (modReq);
+                       TypeBuilder.ResolveUserTypes (modOpt);
+                       if (marshal_info != null)
+                               marshal_info.marshaltyperef = TypeBuilder.ResolveUserType (marshal_info.marshaltyperef);
+               }
+
+               internal FieldInfo RuntimeResolve () {
+                       return typeb.CreateType ().GetField (this);
+               }
+
                public override Module Module {
                        get {
                                return base.Module;
diff --git a/mcs/class/corlib/System.Reflection.Emit/FieldBuilder.pns.cs b/mcs/class/corlib/System.Reflection.Emit/FieldBuilder.pns.cs
new file mode 100644 (file)
index 0000000..c25a5e3
--- /dev/null
@@ -0,0 +1,86 @@
+//
+// FieldBuilder.pns.cs
+//
+// Authors:
+//   Marek Safar (marek.safar@gmail.com)
+//
+// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com)
+//
+// 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.
+//
+
+#if FULL_AOT_RUNTIME
+
+namespace System.Reflection.Emit
+{
+       public abstract class FieldBuilder : FieldInfo
+       {
+               public override FieldAttributes Attributes {
+                       get {
+                               throw new PlatformNotSupportedException ();
+                       }
+               }
+
+               public override Type DeclaringType {
+                       get {
+                               throw new PlatformNotSupportedException ();
+                       }
+               }
+
+               public override Type FieldType {
+                       get {
+                               throw new PlatformNotSupportedException ();
+                       }
+               }
+
+               public override string Name {
+                       get {
+                               throw new PlatformNotSupportedException ();
+                       }
+               }
+
+               public override object GetValue (object obj)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public void SetConstant (object defaultValue)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public void SetCustomAttribute (CustomAttributeBuilder customBuilder)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public void SetCustomAttribute (ConstructorInfo con, byte[] binaryAttribute)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public void SetOffset (int iOffset)
+               {
+                       throw new PlatformNotSupportedException ();
+               }               
+       }
+}
+
+#endif
\ No newline at end of file
index ca3d43d85f94e49655d5a260e903cf04fd51b103..9de89b1e2b85d311ea49b1256755585b5f4f9895 100644 (file)
@@ -42,11 +42,11 @@ namespace System.Reflection.Emit
        internal class FieldOnTypeBuilderInst : FieldInfo
        {
                #region Keep in sync with object-internals.h
-               internal MonoGenericClass instantiation;
+               internal TypeBuilderInstantiation instantiation;
                internal FieldInfo fb;
                #endregion
 
-               public FieldOnTypeBuilderInst (MonoGenericClass instantiation, FieldInfo fb) {
+               public FieldOnTypeBuilderInst (TypeBuilderInstantiation instantiation, FieldInfo fb) {
                        this.instantiation = instantiation;
                        this.fb = fb;
                }
@@ -127,6 +127,12 @@ namespace System.Reflection.Emit
                public override void SetValue (object obj, object value, BindingFlags invokeAttr, Binder binder, CultureInfo culture) {
                        throw new NotSupportedException ();
                }
+
+               // Called from the runtime to return the corresponding finished FieldInfo object
+               internal FieldInfo RuntimeResolve () {
+                       var type = instantiation.RuntimeResolve ();
+                       return type.GetField (fb);
+               }
        }
 }
 #endif
index 037d36fdc3ee1fb6c06641a3a8a8ae38a895132d..30b6aac80e572f9402afd9b4403a9cf03e23c95b 100644 (file)
@@ -82,17 +82,21 @@ namespace System.Reflection.Emit
                        this.mbuilder = mbuilder;
                        this.name = name;
                        this.index = index;
-
-                       initialize ();
                }
 
                internal override Type InternalResolve ()
                {
-                       return tbuilder.InternalResolve ().GetGenericArguments () [index]; 
+                       if (mbuilder != null)
+                               return MethodBase.GetMethodFromHandle (mbuilder.MethodHandleInternal).GetGenericArguments () [index];
+                       return tbuilder.InternalResolve ().GetGenericArguments () [index];
                }
 
-               [MethodImplAttribute(MethodImplOptions.InternalCall)]
-               private extern void initialize ();
+               internal override Type RuntimeResolve ()
+               {
+                       if (mbuilder != null)
+                               return MethodBase.GetMethodFromHandle (mbuilder.MethodHandleInternal, mbuilder.TypeBuilder.RuntimeResolve ().TypeHandle).GetGenericArguments () [index];
+                       return tbuilder.RuntimeResolve ().GetGenericArguments () [index];
+               }
 
                [ComVisible (true)]
                public override bool IsSubclassOf (Type c)
diff --git a/mcs/class/corlib/System.Reflection.Emit/GenericTypeParameterBuilder.pns.cs b/mcs/class/corlib/System.Reflection.Emit/GenericTypeParameterBuilder.pns.cs
new file mode 100644 (file)
index 0000000..7729596
--- /dev/null
@@ -0,0 +1,115 @@
+//
+// GenericTypeParameterBuilder.pns.cs
+//
+// Authors:
+//   Marek Safar (marek.safar@gmail.com)
+//
+// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com)
+//
+// 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.
+//
+
+#if FULL_AOT_RUNTIME
+
+namespace System.Reflection.Emit
+{
+       public abstract class GenericTypeParameterBuilder : TypeInfo
+       {
+               public override Assembly Assembly {
+                       get {
+                               throw new PlatformNotSupportedException ();
+                       }
+               }
+
+               public override string AssemblyQualifiedName {
+                       get {
+                               throw new PlatformNotSupportedException ();
+                       }
+               }
+
+               public override Type BaseType {
+                       get {
+                               throw new PlatformNotSupportedException ();
+                       }
+               }
+
+               public override string FullName {
+                       get {
+                               throw new PlatformNotSupportedException ();
+                       }
+               }
+
+               public override Guid GUID {
+                       get {
+                               throw new PlatformNotSupportedException ();
+                       }
+               }
+
+               public override Module Module {
+                       get {
+                               throw new PlatformNotSupportedException ();
+                       }
+               }
+
+               public override string Name {
+                       get {
+                               throw new PlatformNotSupportedException ();
+                       }
+               }
+
+               public override string Namespace {
+                       get {
+                               throw new PlatformNotSupportedException ();
+                       }
+               }
+
+               public override Type GetElementType ()
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public void SetBaseTypeConstraint (Type baseTypeConstraint)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public void SetCustomAttribute (CustomAttributeBuilder customBuilder)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public void SetCustomAttribute (ConstructorInfo con, byte[] binaryAttribute)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public void SetGenericParameterAttributes (GenericParameterAttributes genericParameterAttributes)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public void SetInterfaceConstraints (Type[] interfaceConstraints)
+               {
+                       throw new PlatformNotSupportedException ();
+               }       
+       }
+}
+
+#endif
\ No newline at end of file
index ac4fda04472f0572052c8433509685a8e063af93..bf879e8e942f79961b352b37de60b39592e47a5f 100644 (file)
@@ -521,7 +521,7 @@ namespace System.Reflection.Emit {
                        int token = token_gen.GetToken (con, true);
                        make_room (6);
                        ll_emit (opcode);
-                       if (con.DeclaringType.Module == module)
+                       if (con.DeclaringType.Module == module || (con is ConstructorOnTypeBuilderInst) || (con is ConstructorBuilder))
                                add_token_fixup (con);
                        emit_int (token);
                        
@@ -554,7 +554,7 @@ namespace System.Reflection.Emit {
                        int token = token_gen.GetToken (field, true);
                        make_room (6);
                        ll_emit (opcode);
-                       if (field.DeclaringType.Module == module)
+                       if (field.DeclaringType.Module == module || (field is FieldOnTypeBuilderInst) || (field is FieldBuilder))
                                add_token_fixup (field);
                        emit_int (token);
                }
@@ -737,7 +737,7 @@ namespace System.Reflection.Emit {
                        Type declaringType = meth.DeclaringType;
                        // Might be a DynamicMethod with no declaring type
                        if (declaringType != null) {
-                               if (declaringType.Module == module)
+                               if (declaringType.Module == module || meth is MethodOnTypeBuilderInst || meth is MethodBuilder)
                                        add_token_fixup (meth);
                        }
                        emit_int (token);
@@ -755,7 +755,7 @@ namespace System.Reflection.Emit {
                        // Might be a DynamicMethod with no declaring type
                        Type declaringType = method.DeclaringType;
                        if (declaringType != null) {
-                               if (declaringType.Module == module)
+                               if (declaringType.Module == module || method is MethodBuilder)
                                        add_token_fixup (method);
                        }
                        emit_int (token);
@@ -813,7 +813,10 @@ namespace System.Reflection.Emit {
 
                        make_room (6);
                        ll_emit (opcode);
-                       emit_int (token_gen.GetToken (cls, opcode != OpCodes.Ldtoken));
+                       int token = token_gen.GetToken (cls, opcode != OpCodes.Ldtoken);
+                       if (cls is TypeBuilderInstantiation || cls is SymbolType || cls is TypeBuilder || cls is GenericTypeParameterBuilder)
+                               add_token_fixup (cls);
+                       emit_int (token);
                }
 
                [MonoLimitation ("vararg methods are not supported")]
@@ -1007,6 +1010,21 @@ namespace System.Reflection.Emit {
                        }
                }
 
+               internal void FixupTokens (Dictionary<int, int> token_map, Dictionary<int, MemberInfo> member_map) {
+                       for (int i = 0; i < num_token_fixups; ++i) {
+                               int pos = token_fixups [i].code_pos;
+                               int old_token = code [pos] | (code [pos + 1] << 8) | (code [pos + 2] << 16) | (code [pos + 3] << 24);
+                               int new_token;
+                               if (token_map.TryGetValue (old_token, out new_token)) {
+                                       token_fixups [i].member = member_map [old_token];
+                                       int old_cl = code_len;
+                                       code_len = pos;
+                                       emit_int (new_token);
+                                       code_len = old_cl;
+                               }
+                       }
+               }
+
                // Used by MethodBuilder.SetMethodBody
                internal void SetExceptionHandlers (ILExceptionInfo[] exHandlers) {
                        this.ex_handlers = exHandlers;
diff --git a/mcs/class/corlib/System.Reflection.Emit/ILGenerator.pns.cs b/mcs/class/corlib/System.Reflection.Emit/ILGenerator.pns.cs
new file mode 100644 (file)
index 0000000..3be336f
--- /dev/null
@@ -0,0 +1,229 @@
+//
+// ILGenerator.pns.cs
+//
+// Authors:
+//   Marek Safar (marek.safar@gmail.com)
+//
+// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com)
+//
+// 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.
+//
+
+#if FULL_AOT_RUNTIME
+
+namespace System.Reflection.Emit
+{
+       public class ILGenerator
+       {
+               ILGenerator ()
+               {
+               }
+
+               public int ILOffset {
+                       get     {
+                               throw new PlatformNotSupportedException ();
+                       }
+               }
+
+               public virtual void BeginCatchBlock (Type exceptionType)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public virtual void BeginExceptFilterBlock ()
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public virtual Label BeginExceptionBlock ()
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public virtual void BeginFaultBlock ()
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public virtual void BeginFinallyBlock ()
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public virtual void BeginScope ()
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public virtual LocalBuilder DeclareLocal (Type localType)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public virtual LocalBuilder DeclareLocal (Type localType, bool pinned)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public virtual Label DefineLabel ()
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public virtual void Emit (OpCode opcode)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public virtual void Emit (OpCode opcode, byte arg)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public virtual void Emit (OpCode opcode, double arg)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public virtual void Emit (OpCode opcode, short arg)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public virtual void Emit (OpCode opcode, int arg)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public virtual void Emit (OpCode opcode, long arg)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public virtual void Emit (OpCode opcode, ConstructorInfo con)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public virtual void Emit (OpCode opcode, Label label)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public virtual void Emit (OpCode opcode, Label[] labels)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public virtual void Emit (OpCode opcode, LocalBuilder local)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public virtual void Emit (OpCode opcode, SignatureHelper signature)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public virtual void Emit (OpCode opcode, FieldInfo field)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public virtual void Emit (OpCode opcode, MethodInfo meth)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               [CLSCompliant (false)]
+               public void Emit (OpCode opcode, sbyte arg)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public virtual void Emit (OpCode opcode, float arg)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public virtual void Emit (OpCode opcode, string str)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public virtual void Emit (OpCode opcode, Type cls)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public virtual void EmitCall (OpCode opcode, MethodInfo methodInfo, Type[] optionalParameterTypes)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public virtual void EmitCalli (OpCode opcode, CallingConventions callingConvention, Type returnType, Type[] parameterTypes, Type[] optionalParameterTypes)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public virtual void EmitWriteLine (LocalBuilder localBuilder)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public virtual void EmitWriteLine (FieldInfo fld)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public virtual void EmitWriteLine (string value)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public virtual void EndExceptionBlock ()
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public virtual void EndScope ()
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public virtual void MarkLabel (Label loc)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public virtual void ThrowException (Type excType)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public virtual void UsingNamespace (string usingNamespace)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+       }
+}
+
+#endif
\ No newline at end of file
index 427b93d98dbb2fe9b63cfc439e1df18e5b749a18..4834aa2cf2d837e8352424331589e1a66f5f7af9 100644 (file)
@@ -30,7 +30,6 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if !FULL_AOT_RUNTIME || IOS_REFLECTION
 using System.Runtime.InteropServices;
 
 namespace System.Reflection.Emit {
@@ -73,4 +72,3 @@ namespace System.Reflection.Emit {
                }
        }
 }
-#endif
index 98c9addf5042a6b7e3e1c3de26954577bbfcc4b8..0c56edfb369ebfe7f56973b0d55eee044d7b76ad 100644 (file)
 // (C) 2001, 2002 Ximian, Inc.  http://www.ximian.com
 //
 
-#if !FULL_AOT_RUNTIME
 using System;
 using System.Reflection;
-using System.Reflection.Emit;
 using System.Globalization;
 using System.Runtime.CompilerServices;
 using System.Runtime.InteropServices;
@@ -44,10 +42,16 @@ using System.Diagnostics.SymbolStore;
 
 namespace System.Reflection.Emit {
        [ComVisible (true)]
+#if !FULL_AOT_RUNTIME
        [ComDefaultInterface (typeof (_LocalBuilder))]
+#endif
        [ClassInterface (ClassInterfaceType.None)]
        [StructLayout (LayoutKind.Sequential)]
-       public sealed class LocalBuilder : LocalVariableInfo, _LocalBuilder {
+       public sealed class LocalBuilder : LocalVariableInfo
+#if !FULL_AOT_RUNTIME
+               , _LocalBuilder
+#endif
+       {
 
                // Some fields are already defined in LocalVariableInfo
                #region Sync with reflection.h
@@ -108,7 +112,7 @@ namespace System.Reflection.Emit {
                internal int EndOffset {
                        get { return endOffset; }
                }
-
+#if !FULL_AOT_RUNTIME
                void _LocalBuilder.GetIDsOfNames ([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
                {
                        throw new NotImplementedException ();
@@ -128,6 +132,6 @@ namespace System.Reflection.Emit {
                {
                        throw new NotImplementedException ();
                }
+#endif
        }
 }
-#endif
index 3772d98b82c90381dc2b8da1dba39a4308e8063e..8748f20aba2b1e998f751affb651e45a133172e3 100644 (file)
@@ -138,6 +138,12 @@ namespace System.Reflection.Emit
                        }
                }
 
+               internal RuntimeMethodHandle MethodHandleInternal {
+                       get {
+                               return mhandle;
+                       }
+               }
+
                public override Type ReturnType {
                        get { return rtype; }
                }
@@ -248,6 +254,10 @@ namespace System.Reflection.Emit
                        return parameters [pos];
                }
 
+               internal MethodBase RuntimeResolve () {
+                       return type.RuntimeResolve ().GetMethod (this);
+               }
+
                public Module GetModule ()
                {
                        return type.Module;
@@ -364,7 +374,27 @@ namespace System.Reflection.Emit
                        if (ilgen != null)
                                ilgen.label_fixup (this);
                }
-               
+
+               internal void ResolveUserTypes () {
+                       rtype = TypeBuilder.ResolveUserType (rtype);
+                       TypeBuilder.ResolveUserTypes (parameters);
+                       TypeBuilder.ResolveUserTypes (returnModReq);
+                       TypeBuilder.ResolveUserTypes (returnModOpt);
+                       if (paramModReq != null) {
+                               foreach (var types in paramModReq)
+                                       TypeBuilder.ResolveUserTypes (types);
+                       }
+                       if (paramModOpt != null) {
+                               foreach (var types in paramModOpt)
+                                       TypeBuilder.ResolveUserTypes (types);
+                       }
+               }
+
+               internal void FixupTokens (Dictionary<int, int> token_map, Dictionary<int, MemberInfo> member_map) {
+                       if (ilgen != null)
+                               ilgen.FixupTokens (token_map, member_map);
+               }
+
                internal void GenerateDebugInfo (ISymbolWriter symbolWriter)
                {
                        if (ilgen != null && ilgen.HasDebugInfo) {
@@ -478,7 +508,7 @@ namespace System.Reflection.Emit
 
                public void AddDeclarativeSecurity (SecurityAction action, PermissionSet pset)
                {
-#if !NET_2_1
+#if !MOBILE
                        if (pset == null)
                                throw new ArgumentNullException ("pset");
                        if ((action == SecurityAction.RequestMinimum) ||
diff --git a/mcs/class/corlib/System.Reflection.Emit/MethodBuilder.pns.cs b/mcs/class/corlib/System.Reflection.Emit/MethodBuilder.pns.cs
new file mode 100644 (file)
index 0000000..49ef26b
--- /dev/null
@@ -0,0 +1,112 @@
+//
+// MethodBuilder.pns.cs
+//
+// Authors:
+//   Marek Safar (marek.safar@gmail.com)
+//
+// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com)
+//
+// 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.
+//
+
+#if FULL_AOT_RUNTIME
+
+namespace System.Reflection.Emit
+{
+       public abstract class MethodBuilder : MethodInfo
+       {
+               public bool InitLocals { get; set; }
+
+               public override MethodAttributes Attributes {
+                       get {
+                               throw new PlatformNotSupportedException ();
+                       }
+               }
+
+               public override Type DeclaringType {
+                       get {
+                               throw new PlatformNotSupportedException ();
+                       }
+               }
+
+               public override string Name {
+                       get {
+                               throw new PlatformNotSupportedException ();
+                       }
+               }
+
+               public GenericTypeParameterBuilder[] DefineGenericParameters (string[] names)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public ParameterBuilder DefineParameter (int position, ParameterAttributes attributes, string strParamName)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public ILGenerator GetILGenerator ()
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public ILGenerator GetILGenerator (int size)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public override System.Reflection.ParameterInfo[] GetParameters ()
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public void SetCustomAttribute (CustomAttributeBuilder customBuilder)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public void SetCustomAttribute (ConstructorInfo con, byte[] binaryAttribute)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public void SetImplementationFlags (MethodImplAttributes attributes)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public void SetParameters (Type[] parameterTypes)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public void SetReturnType (Type returnType)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public void SetSignature (Type returnType, Type[] returnTypeRequiredCustomModifiers, Type[] returnTypeOptionalCustomModifiers, Type[] parameterTypes, Type[][] parameterTypeRequiredCustomModifiers, Type[][] parameterTypeOptionalCustomModifiers)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+       }
+}
+
+#endif
\ No newline at end of file
index 9bc0b8a5994500a625b81919aa59c85cb18192a9..22c89ea9d0bf26717a90afce4b335e13fa97da78 100644 (file)
@@ -50,7 +50,7 @@ namespace System.Reflection.Emit
                #endregion
                MethodInfo generic_method_definition;
 
-               public MethodOnTypeBuilderInst (MonoGenericClass instantiation, MethodInfo base_method)
+               public MethodOnTypeBuilderInst (TypeBuilderInstantiation instantiation, MethodInfo base_method)
                {
                        this.instantiation = instantiation;
                        this.base_method = base_method;
@@ -100,6 +100,19 @@ namespace System.Reflection.Emit
                        return instantiation.GetGenericArguments ();
                }
 
+               // Called from the runtime to return the corresponding finished MethodInfo object
+               internal MethodInfo RuntimeResolve () {
+                       var type = instantiation.InternalResolve ();
+                       var m = type.GetMethod (base_method);
+                       if (method_arguments != null) {
+                               var args = new Type [method_arguments.Length];
+                               for (int i = 0; i < method_arguments.Length; ++i)
+                                       args [i] = method_arguments [i].InternalResolve ();
+                               m = m.MakeGenericMethod (args);
+                       }
+                       return m;
+               }
+
                //
                // MemberInfo members
                //
index d6c39114f16ef3da670dd957008a1c592b08af79..b055797bd86763c3e82bc201c6c4d380e9884875 100644 (file)
@@ -348,9 +348,6 @@ namespace System.Reflection.Emit {
                        return null;
                }
 
-               [MethodImplAttribute(MethodImplOptions.InternalCall)]
-               private static extern Type create_modified_type (TypeBuilder tb, string modifiers);
-
                private TypeBuilder GetMaybeNested (TypeBuilder t, IEnumerable<TypeName> nested) {
                        TypeBuilder result = t;
 
@@ -392,8 +389,27 @@ namespace System.Reflection.Emit {
                        if ((result == null) && throwOnError)
                                throw new TypeLoadException (className);
                        if (result != null && (ts.HasModifiers || ts.IsByRef)) {
-                               string modifiers = ts.ModifierString ();
-                               Type mt = create_modified_type (result, modifiers);
+                               Type mt = result;
+                               if (result is TypeBuilder) {
+                                       var tb = result as TypeBuilder;
+                                       if (tb.is_created)
+                                               mt = tb.CreateType ();
+                               }
+                               foreach (var mod in ts.Modifiers) {
+                                       if (mod is PointerSpec)
+                                               mt = mt.MakePointerType ();
+                                       else if (mod is ArraySpec) {
+                                               var spec = mod as ArraySpec;
+                                               if (spec.IsBound)
+                                                       return null;
+                                               if (spec.Rank == 1)
+                                                       mt = mt.MakeArrayType ();
+                                               else
+                                                       mt = mt.MakeArrayType (spec.Rank);
+                                       }
+                               }
+                               if (ts.IsByRef)
+                                       mt = mt.MakeByRefType ();
                                result = mt as TypeBuilder;
                                if (result == null)
                                        return mt;
@@ -665,15 +681,90 @@ namespace System.Reflection.Emit {
                        return result;
                }
 
+               static int typeref_tokengen =  0x01ffffff;
+               static int typedef_tokengen =  0x02ffffff;
+               static int typespec_tokengen =  0x1bffffff;
+               static int memberref_tokengen =  0x0affffff;
+               static int methoddef_tokengen =  0x06ffffff;
+               Dictionary<MemberInfo, int> inst_tokens = new Dictionary<MemberInfo, int> ();
+               Dictionary<MemberInfo, int> inst_tokens_open = new Dictionary<MemberInfo, int> ();
+
+               //
+               // Assign a pseudo token to the various TypeBuilderInst objects, so the runtime
+               // doesn't have to deal with them.
+               // For Save assemblies, the tokens will be fixed up later during Save ().
+               // For Run assemblies, the tokens will not be fixed up, so the runtime will
+               // still encounter these objects, it will resolve them by calling their
+               // RuntimeResolve () methods.
+               //
+               int GetPseudoToken (MemberInfo member, bool create_open_instance) {
+                       int token;
+
+                       if (create_open_instance) {
+                               if (inst_tokens_open.TryGetValue (member, out token))
+                                       return token;
+                       } else {
+                               if (inst_tokens.TryGetValue (member, out token))
+                                       return token;
+                       }
+                       // Count backwards to avoid collisions with the tokens
+                       // allocated by the runtime
+                       if (member is TypeBuilderInstantiation || member is SymbolType)
+                               token = typespec_tokengen --;
+                       else if (member is FieldOnTypeBuilderInst)
+                               token = memberref_tokengen --;
+                       else if (member is ConstructorOnTypeBuilderInst)
+                               token = memberref_tokengen --;
+                       else if (member is MethodOnTypeBuilderInst)
+                               token = memberref_tokengen --;
+                       else if (member is FieldBuilder)
+                               token = memberref_tokengen --;
+                       else if (member is TypeBuilder) {
+                               if (create_open_instance && (member as TypeBuilder).ContainsGenericParameters)
+                                       token = typespec_tokengen --;
+                               else if (member.Module == this)
+                                       token = typedef_tokengen --;
+                               else
+                                       token = typeref_tokengen --;
+                       } else if (member is ConstructorBuilder) {
+                               if (member.Module == this && !(member as ConstructorBuilder).TypeBuilder.ContainsGenericParameters)
+                                       token = methoddef_tokengen --;
+                               else
+                                       token = memberref_tokengen --;
+                       } else if (member is MethodBuilder) {
+                               var mb = member as MethodBuilder;
+                               if (member.Module == this && !mb.TypeBuilder.ContainsGenericParameters && !mb.IsGenericMethodDefinition)
+                                       token = methoddef_tokengen --;
+                               else
+                                       token = memberref_tokengen --;
+                       } else if (member is GenericTypeParameterBuilder) {
+                               token = typespec_tokengen --;
+                       } else
+                               throw new NotImplementedException ();
+                       if (create_open_instance)
+                               inst_tokens_open [member] = token;
+                       else
+                               inst_tokens [member] = token;
+                       RegisterToken (member, token);
+                       return token;
+               }
+
                internal int GetToken (MemberInfo member) {
+                       if (member is ConstructorBuilder || member is MethodBuilder)
+                               return GetPseudoToken (member, false);
                        return getToken (this, member, true);
                }
 
                internal int GetToken (MemberInfo member, bool create_open_instance) {
+                       if (member is TypeBuilderInstantiation || member is FieldOnTypeBuilderInst || member is ConstructorOnTypeBuilderInst || member is MethodOnTypeBuilderInst || member is SymbolType || member is FieldBuilder || member is TypeBuilder || member is ConstructorBuilder || member is MethodBuilder || member is GenericTypeParameterBuilder)
+                               return GetPseudoToken (member, create_open_instance);
                        return getToken (this, member, create_open_instance);
                }
 
                internal int GetToken (MethodBase method, IEnumerable<Type> opt_param_types) {
+                       if (method is ConstructorBuilder || method is MethodBuilder)
+                               return GetPseudoToken (method, false);
+
                        if (opt_param_types == null)
                                return getToken (this, method, true);
 
@@ -682,6 +773,8 @@ namespace System.Reflection.Emit {
                }
                
                internal int GetToken (MethodBase method, Type[] opt_param_types) {
+                       if (method is ConstructorBuilder || method is MethodBuilder)
+                               return GetPseudoToken (method, false);
                        return getMethodToken (this, method, opt_param_types);
                }
 
@@ -708,12 +801,88 @@ namespace System.Reflection.Emit {
                        return token_gen;
                }
 
+               // Called from the runtime to return the corresponding finished reflection object
+               internal static object RuntimeResolve (object obj) {
+                       if (obj is MethodBuilder)
+                               return (obj as MethodBuilder).RuntimeResolve ();
+                       if (obj is ConstructorBuilder)
+                               return (obj as ConstructorBuilder).RuntimeResolve ();
+                       if (obj is FieldBuilder)
+                               return (obj as FieldBuilder).RuntimeResolve ();
+                       if (obj is GenericTypeParameterBuilder)
+                               return (obj as GenericTypeParameterBuilder).RuntimeResolve ();
+                       if (obj is FieldOnTypeBuilderInst)
+                               return (obj as FieldOnTypeBuilderInst).RuntimeResolve ();
+                       if (obj is MethodOnTypeBuilderInst)
+                               return (obj as MethodOnTypeBuilderInst).RuntimeResolve ();
+                       if (obj is ConstructorOnTypeBuilderInst)
+                               return (obj as ConstructorOnTypeBuilderInst).RuntimeResolve ();
+                       if (obj is Type)
+                               return (obj as Type).RuntimeResolve ();
+                       throw new NotImplementedException (obj.GetType ().FullName);
+               }
+
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
                private static extern void build_metadata (ModuleBuilder mb);
 
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
                private extern void WriteToFile (IntPtr handle);
 
+               void FixupTokens (Dictionary<int, int> token_map, Dictionary<int, MemberInfo> member_map, Dictionary<MemberInfo, int> inst_tokens,
+                                                 bool open) {
+                       foreach (var v in inst_tokens) {
+                               var member = v.Key;
+                               var old_token = v.Value;
+                               MemberInfo finished = null;
+
+                               // Construct the concrete reflection object corresponding to the
+                               // TypeBuilderInst object, and request a token for it instead.
+                               if (member is TypeBuilderInstantiation || member is SymbolType) {
+                                       finished = (member as Type).RuntimeResolve ();
+                               } else if (member is FieldOnTypeBuilderInst) {
+                                       finished = (member as FieldOnTypeBuilderInst).RuntimeResolve ();
+                               } else if (member is ConstructorOnTypeBuilderInst) {
+                                       finished = (member as ConstructorOnTypeBuilderInst).RuntimeResolve ();
+                               } else if (member is MethodOnTypeBuilderInst) {
+                                       finished = (member as MethodOnTypeBuilderInst).RuntimeResolve ();
+                               } else if (member is FieldBuilder) {
+                                       finished = (member as FieldBuilder).RuntimeResolve ();
+                               } else if (member is TypeBuilder) {
+                                       finished = (member as TypeBuilder).RuntimeResolve ();
+                               } else if (member is ConstructorBuilder) {
+                                       finished = (member as ConstructorBuilder).RuntimeResolve ();
+                               } else if (member is MethodBuilder) {
+                                       finished = (member as MethodBuilder).RuntimeResolve ();
+                               } else if (member is GenericTypeParameterBuilder) {
+                                       finished = (member as GenericTypeParameterBuilder).RuntimeResolve ();
+                               } else {
+                                       throw new NotImplementedException ();
+                               }
+
+                               int new_token = GetToken (finished, open);
+                               token_map [old_token] = new_token;
+                               member_map [old_token] = finished;
+                               // Replace the token mapping in the runtime so it points to the new object
+                               RegisterToken (finished, old_token);
+                       }
+               }
+
+               //
+               // Fixup the pseudo tokens assigned to the various SRE objects
+               //
+               void FixupTokens () {
+                       var token_map = new Dictionary<int, int> ();
+                       var member_map = new Dictionary<int, MemberInfo> ();
+                       FixupTokens (token_map, member_map, inst_tokens, false);
+                       FixupTokens (token_map, member_map, inst_tokens_open, true);
+
+                       // Replace the tokens in the IL stream
+                       if (types != null) {
+                               for (int i = 0; i < num_types; ++i)
+                                       types [i].FixupTokens (token_map, member_map);
+                       }
+               }
+
                internal void Save ()
                {
                        if (transient && !is_main)
@@ -725,6 +894,8 @@ namespace System.Reflection.Emit {
                                                throw new NotSupportedException ("Type '" + types [i].FullName + "' was not completed.");
                        }
 
+                       FixupTokens ();
+
                        if ((global_type != null) && (global_type_created == null))
                                global_type_created = global_type.CreateType ();
 
diff --git a/mcs/class/corlib/System.Reflection.Emit/ModuleBuilder.pns.cs b/mcs/class/corlib/System.Reflection.Emit/ModuleBuilder.pns.cs
new file mode 100644 (file)
index 0000000..88d741d
--- /dev/null
@@ -0,0 +1,122 @@
+//
+// ModuleBuilder.pns.cs
+//
+// Authors:
+//   Marek Safar (marek.safar@gmail.com)
+//
+// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com)
+//
+// 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.
+//
+
+#if FULL_AOT_RUNTIME
+
+namespace System.Reflection.Emit
+{
+       public abstract class ModuleBuilder : Module
+       {
+               public void CreateGlobalFunctions ()
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public EnumBuilder DefineEnum (string name, TypeAttributes visibility, Type underlyingType)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public MethodBuilder DefineGlobalMethod (string name, MethodAttributes attributes, Type returnType, Type[] parameterTypes)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public MethodBuilder DefineGlobalMethod (string name, MethodAttributes attributes, CallingConventions callingConvention, Type returnType, Type[] parameterTypes)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public MethodBuilder DefineGlobalMethod (string name, MethodAttributes attributes, CallingConventions callingConvention, Type returnType, Type[] requiredReturnTypeCustomModifiers, Type[] optionalReturnTypeCustomModifiers, Type[] parameterTypes, Type[][] requiredParameterTypeCustomModifiers, Type[][] optionalParameterTypeCustomModifiers)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public FieldBuilder DefineInitializedData (string name, byte[] data, FieldAttributes attributes)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public TypeBuilder DefineType (string name)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public TypeBuilder DefineType (string name, TypeAttributes attr)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public TypeBuilder DefineType (string name, TypeAttributes attr, Type parent)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public TypeBuilder DefineType (string name, TypeAttributes attr, Type parent, int typesize)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public TypeBuilder DefineType (string name, TypeAttributes attr, Type parent, PackingSize packsize)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public TypeBuilder DefineType (string name, TypeAttributes attr, Type parent, Type[] interfaces)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public TypeBuilder DefineType (string name, TypeAttributes attr, Type parent, PackingSize packingSize, int typesize)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public FieldBuilder DefineUninitializedData (string name, int size, FieldAttributes attributes)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public MethodInfo GetArrayMethod (Type arrayClass, string methodName, CallingConventions callingConvention, Type returnType, Type[] parameterTypes)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public void SetCustomAttribute (CustomAttributeBuilder customBuilder)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public void SetCustomAttribute (ConstructorInfo con, byte[] binaryAttribute)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+       }
+}
+
+#endif
\ No newline at end of file
diff --git a/mcs/class/corlib/System.Reflection.Emit/ParameterBuilder.pns.cs b/mcs/class/corlib/System.Reflection.Emit/ParameterBuilder.pns.cs
new file mode 100644 (file)
index 0000000..d9b1bab
--- /dev/null
@@ -0,0 +1,92 @@
+//
+// ParameterBuilder.cs
+//
+// Authors:
+//   Marek Safar (marek.safar@gmail.com)
+//
+// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com)
+//
+// 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.
+//
+
+#if FULL_AOT_RUNTIME
+
+namespace System.Reflection.Emit
+{
+       public class ParameterBuilder
+       {
+               ParameterBuilder ()
+               {
+               }
+
+               public int Attributes {
+                       get {
+                               throw new PlatformNotSupportedException ();
+                       }
+               }
+
+               public bool IsIn {
+                       get {
+                               throw new PlatformNotSupportedException ();
+                       }
+               }
+
+               public bool IsOptional {
+                       get {
+                               throw new PlatformNotSupportedException ();
+                       }
+               }
+
+               public bool IsOut {
+                       get {
+                               throw new PlatformNotSupportedException ();
+                       }
+               }
+
+               public string Name {
+                       get {
+                               throw new PlatformNotSupportedException ();
+                       }
+               }
+
+               public int Position {
+                       get {
+                               throw new PlatformNotSupportedException ();
+                       }
+               }
+
+               public virtual void SetConstant (object defaultValue)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public void SetCustomAttribute (CustomAttributeBuilder customBuilder)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public void SetCustomAttribute (ConstructorInfo con, byte[] binaryAttribute)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+       }
+}
+
+#endif
\ No newline at end of file
diff --git a/mcs/class/corlib/System.Reflection.Emit/PropertyBuilder.pns.cs b/mcs/class/corlib/System.Reflection.Emit/PropertyBuilder.pns.cs
new file mode 100644 (file)
index 0000000..f0e709d
--- /dev/null
@@ -0,0 +1,108 @@
+//
+// PropertyBuilder.pns.cs
+//
+// Authors:
+//   Marek Safar (marek.safar@gmail.com)
+//
+// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com)
+//
+// 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.
+//
+
+#if FULL_AOT_RUNTIME
+
+namespace System.Reflection.Emit
+{
+       public abstract class PropertyBuilder : PropertyInfo
+       {
+               public override PropertyAttributes Attributes {
+                       get {
+                               throw new PlatformNotSupportedException ();
+                       }
+               }
+
+               public override bool CanRead {
+                       get {
+                               throw new PlatformNotSupportedException ();
+                       }
+               }
+
+               public override bool CanWrite {
+                       get {
+                               throw new PlatformNotSupportedException ();
+                       }
+               }
+
+               public override Type DeclaringType {
+                       get {
+                               throw new PlatformNotSupportedException ();
+                       }
+               }
+
+               public override string Name {
+                       get {
+                               throw new PlatformNotSupportedException ();
+                       }
+               }
+               
+               public override Type PropertyType {
+                       get {
+                               throw new PlatformNotSupportedException ();
+                       }
+               }
+
+               public void AddOtherMethod (MethodBuilder mdBuilder)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public void SetConstant (object defaultValue)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public void SetCustomAttribute (CustomAttributeBuilder customBuilder)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public void SetCustomAttribute (ConstructorInfo con, byte[] binaryAttribute)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public void SetGetMethod (MethodBuilder mdBuilder)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public void SetSetMethod (MethodBuilder mdBuilder)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public override ParameterInfo[] GetIndexParameters ()
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+       }
+}
+
+#endif
\ No newline at end of file
index 1035f494c86223a3bcc547243d9ea635be84dd9c..8b21446c4ef5416f3bd1421a6e59160c001a4cea 100644 (file)
@@ -41,10 +41,10 @@ namespace System.Reflection.Emit
        [StructLayout (LayoutKind.Sequential)]
        internal class PropertyOnTypeBuilderInst : PropertyInfo
        {
-               MonoGenericClass instantiation;
+               TypeBuilderInstantiation instantiation;
                PropertyInfo prop;
 
-               internal PropertyOnTypeBuilderInst (MonoGenericClass instantiation, PropertyInfo prop)
+               internal PropertyOnTypeBuilderInst (TypeBuilderInstantiation instantiation, PropertyInfo prop)
                {
                        this.instantiation = instantiation;
                        this.prop = prop;
index 924eb674e154ef2c487f892e5d54a897fa502f3c..f921be221809245bf20484a0e5adc47f2fa47786 100644 (file)
@@ -361,6 +361,8 @@ namespace System.Reflection.Emit {
 
                public byte[] GetSignature ()
                {
+                       TypeBuilder.ResolveUserTypes (arguments);
+
                        switch (type) {
                        case SignatureHelperType.HELPER_LOCAL:
                                return get_signature_local ();
diff --git a/mcs/class/corlib/System.Reflection.Emit/SignatureHelper.pns.cs b/mcs/class/corlib/System.Reflection.Emit/SignatureHelper.pns.cs
new file mode 100644 (file)
index 0000000..7aa0a27
--- /dev/null
@@ -0,0 +1,116 @@
+//
+// SignatureHelper.pns.cs
+//
+// Authors:
+//   Marek Safar (marek.safar@gmail.com)
+//
+// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com)
+//
+// 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.
+//
+
+#if FULL_AOT_RUNTIME
+
+namespace System.Reflection.Emit
+{
+       public class SignatureHelper
+       {
+               SignatureHelper ()
+               {                       
+               }
+               
+               public void AddArgument (Type clsArgument)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public void AddArgument (Type argument, bool pinned)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public void AddArgument (Type argument, Type[] requiredCustomModifiers, Type[] optionalCustomModifiers)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public void AddArguments (Type[] arguments, Type[][] requiredCustomModifiers, Type[][] optionalCustomModifiers)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public void AddSentinel ()
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public static SignatureHelper GetFieldSigHelper (Module mod)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public static SignatureHelper GetLocalVarSigHelper ()
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public static SignatureHelper GetLocalVarSigHelper (Module mod)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public static SignatureHelper GetMethodSigHelper (CallingConventions callingConvention, Type returnType)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public static SignatureHelper GetMethodSigHelper (Module mod, CallingConventions callingConvention, Type returnType)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public static SignatureHelper GetMethodSigHelper (Module mod, Type returnType, Type[] parameterTypes)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public static SignatureHelper GetPropertySigHelper (Module mod, Type returnType, Type[] parameterTypes)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public static SignatureHelper GetPropertySigHelper (Module mod, Type returnType, Type[] requiredReturnTypeCustomModifiers, Type[] optionalReturnTypeCustomModifiers, Type[] parameterTypes, Type[][] requiredParameterTypeCustomModifiers, Type[][] optionalParameterTypeCustomModifiers)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public static SignatureHelper GetPropertySigHelper (Module mod, CallingConventions callingConvention, Type returnType, Type[] requiredReturnTypeCustomModifiers, Type[] optionalReturnTypeCustomModifiers, Type[] parameterTypes, Type[][] requiredParameterTypeCustomModifiers, Type[][] optionalParameterTypeCustomModifiers)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public byte[] GetSignature ()
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+       }
+}
+
+#endif
\ No newline at end of file
index 7216a169e468ac070f1c2a18e5090181bd3e3665..30ae09cdf16be9181dcdc2efc3335c966cb0739d 100644 (file)
@@ -40,6 +40,7 @@ using System.Runtime.CompilerServices;
 using System.Runtime.InteropServices;
 using System.Globalization;
 using System.Collections;
+using System.Collections.Generic;
 using System.Security;
 using System.Security.Permissions;
 using System.Diagnostics.SymbolStore;
@@ -91,21 +92,6 @@ namespace System.Reflection.Emit
                {
                        return attrs;
                }
-               
-               [MethodImplAttribute(MethodImplOptions.InternalCall)]
-               private extern void setup_internal_class (TypeBuilder tb);
-               
-               [MethodImplAttribute(MethodImplOptions.InternalCall)]
-               private extern void create_internal_class (TypeBuilder tb);
-               
-               [MethodImplAttribute(MethodImplOptions.InternalCall)]
-               private extern void setup_generic_class ();
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)]
-               private extern void create_generic_class ();
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)]
-               private extern EventInfo get_event_info (EventBuilder eb);
 
                internal TypeBuilder (ModuleBuilder mb, TypeAttributes attr, int table_idx)
                {
@@ -117,13 +103,12 @@ namespace System.Reflection.Emit
                        this.nspace = String.Empty;
                        this.fullname = TypeIdentifiers.WithoutEscape(this.tname);
                        pmodule = mb;
-                       setup_internal_class (this);
                }
 
                internal TypeBuilder (ModuleBuilder mb, string name, TypeAttributes attr, Type parent, Type[] interfaces, PackingSize packing_size, int type_size, Type nesting_type)
                {
                        int sep_index;
-                       this.parent = parent;
+                       this.parent = ResolveUserType (parent);
                        this.attrs = attr;
                        this.class_size = type_size;
                        this.packing_size = packing_size;
@@ -153,7 +138,6 @@ namespace System.Reflection.Emit
 
                        // skip .<Module> ?
                        table_idx = mb.get_next_table_index (this, 0x02, true);
-                       setup_internal_class (this);
                        fullname = GetFullName ();
                }
 
@@ -259,7 +243,7 @@ namespace System.Reflection.Emit
 
                public void AddDeclarativeSecurity (SecurityAction action, PermissionSet pset)
                {
-#if !NET_2_1
+#if !MOBILE
                        if (pset == null)
                                throw new ArgumentNullException ("pset");
                        if ((action == SecurityAction.RequestMinimum) ||
@@ -672,7 +656,6 @@ namespace System.Reflection.Emit
                                fields = new FieldBuilder [1];
                                fields [0] = res;
                                num_fields ++;
-                               create_internal_class (this);
                        }
 
                        if (IsEnum) {
@@ -728,7 +711,7 @@ namespace System.Reflection.Emit
                }
 
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
-               private extern TypeInfo create_runtime_class (TypeBuilder tb);
+               private extern TypeInfo create_runtime_class ();
 
                private bool is_nested_in (Type t)
                {
@@ -771,8 +754,6 @@ namespace System.Reflection.Emit
                                SetParent (pmodule.assemblyb.corlib_object_type);
                        }
 
-                       create_generic_class ();
-
                        // Fire TypeResolve events for fields whose type is an unfinished
                        // value type.
                        if (fields != null) {
@@ -832,12 +813,69 @@ namespace System.Reflection.Emit
                                        ctor.fixup ();
                        }
 
-                       created = create_runtime_class (this);
+                       ResolveUserTypes ();
+
+                       created = create_runtime_class ();
                        if (created != null)
                                return created;
                        return this;
                }
 
+               void ResolveUserTypes () {
+                       parent = ResolveUserType (parent);
+                       ResolveUserTypes (interfaces);
+                       if (fields != null) {
+                               foreach (var fb in fields) {
+                                       if (fb != null)
+                                               fb.ResolveUserTypes ();
+                               }
+                       }
+                       if (methods != null) {
+                               foreach (var mb in methods) {
+                                       if (mb != null)
+                                               mb.ResolveUserTypes ();
+                               }
+                       }
+                       if (ctors != null) {
+                               foreach (var cb in ctors) {
+                                       if (cb != null)
+                                               cb.ResolveUserTypes ();
+                               }
+                       }
+               }
+
+               static internal void ResolveUserTypes (Type[] types) {
+                       if (types != null)
+                               for (int i = 0; i < types.Length; ++i)
+                                       types [i] = ResolveUserType (types [i]);
+               }
+
+               static internal Type ResolveUserType (Type t) {
+                       if (t != null && ((t.GetType ().Assembly != typeof (int).Assembly) || (t is TypeDelegator))) {
+                               t = t.UnderlyingSystemType;
+                               if (t != null && ((t.GetType ().Assembly != typeof (int).Assembly) || (t is TypeDelegator)))
+                                       throw new NotSupportedException ("User defined subclasses of System.Type are not yet supported.");
+                               return t;
+                       } else {
+                               return t;
+                       }
+               }
+
+               internal void FixupTokens (Dictionary<int, int> token_map, Dictionary<int, MemberInfo> member_map) {
+                       if (methods != null) {
+                               for (int i = 0; i < num_methods; ++i)
+                                       methods[i].FixupTokens (token_map, member_map);
+                       }
+                       if (ctors != null) {
+                               foreach (var cb in ctors)
+                                       cb.FixupTokens (token_map, member_map);
+                       }
+                       if (subtypes != null) {
+                               foreach (var tb in subtypes)
+                                       tb.FixupTokens (token_map, member_map);
+                       }
+               }
+
                internal void GenerateDebugInfo (ISymbolWriter symbolWriter)
                {
                        symbolWriter.OpenNamespace (this.Namespace);
@@ -933,53 +971,6 @@ namespace System.Reflection.Emit
                        throw new NotSupportedException ();
                }
 
-               // This is only used from MonoGenericInst.initialize().
-               internal EventInfo[] GetEvents_internal (BindingFlags bindingAttr)
-               {
-                       if (events == null)
-                               return new EventInfo [0];
-                       ArrayList l = new ArrayList ();
-                       bool match;
-                       MethodAttributes mattrs;
-                       MethodInfo accessor;
-
-                       foreach (EventBuilder eb in events) {
-                               if (eb == null)
-                                       continue;
-                               EventInfo c = get_event_info (eb);
-                               match = false;
-                               accessor = c.GetAddMethod (true);
-                               if (accessor == null)
-                                       accessor = c.GetRemoveMethod (true);
-                               if (accessor == null)
-                                       continue;
-                               mattrs = accessor.Attributes;
-                               if ((mattrs & MethodAttributes.MemberAccessMask) == MethodAttributes.Public) {
-                                       if ((bindingAttr & BindingFlags.Public) != 0)
-                                               match = true;
-                               } else {
-                                       if ((bindingAttr & BindingFlags.NonPublic) != 0)
-                                               match = true;
-                               }
-                               if (!match)
-                                       continue;
-                               match = false;
-                               if ((mattrs & MethodAttributes.Static) != 0) {
-                                       if ((bindingAttr & BindingFlags.Static) != 0)
-                                               match = true;
-                               } else {
-                                       if ((bindingAttr & BindingFlags.Instance) != 0)
-                                               match = true;
-                               }
-                               if (!match)
-                                       continue;
-                               l.Add (c);
-                       }
-                       EventInfo[] result = new EventInfo [l.Count];
-                       l.CopyTo (result);
-                       return result;
-               }
-
                public override FieldInfo GetField (string name, BindingFlags bindingAttr)
                {
                        if (created != null)
@@ -1606,9 +1597,7 @@ namespace System.Reflection.Emit
                        } else {
                                this.parent = parent;
                        }
-
-                       // will just set the parent-related bits if called a second time
-                       setup_internal_class (this);
+                       this.parent = ResolveUserType (this.parent);
                }
 
                internal int get_next_table_index (object obj, int table, bool inc) {
@@ -1630,6 +1619,12 @@ namespace System.Reflection.Emit
                        return created;
                }
 
+               internal override Type RuntimeResolve ()
+               {
+                       check_created ();
+                       return created;
+               }
+
                internal bool is_created {
                        get {
                                return createTypeCalled;
@@ -1728,9 +1723,10 @@ namespace System.Reflection.Emit
                        }
                }
 
-               public extern override bool IsGenericParameter {
-                       [MethodImplAttribute(MethodImplOptions.InternalCall)]
-                       get;
+               public override bool IsGenericParameter {
+                       get {
+                               return false;
+                       }
                }
 
                public override GenericParameterAttributes GenericParameterAttributes {
@@ -1767,8 +1763,6 @@ namespace System.Reflection.Emit
                        if (names.Length == 0)
                                throw new ArgumentException ("names");
 
-                       setup_generic_class ();
-
                        generic_params = new GenericTypeParameterBuilder [names.Length];
                        for (int i = 0; i < names.Length; i++) {
                                string item = names [i];
@@ -1809,7 +1803,7 @@ namespace System.Reflection.Emit
 
                static bool IsValidGetMethodType (Type type)
                {
-                       if (type is TypeBuilder || type is MonoGenericClass)
+                       if (type is TypeBuilder || type is TypeBuilderInstantiation)
                                return true;
                        /*GetMethod() must work with TypeBuilders after CreateType() was called.*/
                        if (type.Module is ModuleBuilder)
diff --git a/mcs/class/corlib/System.Reflection.Emit/TypeBuilder.pns.cs b/mcs/class/corlib/System.Reflection.Emit/TypeBuilder.pns.cs
new file mode 100644 (file)
index 0000000..ba97e01
--- /dev/null
@@ -0,0 +1,284 @@
+//
+// TypeBuilder.pns.cs
+//
+// Authors:
+//   Marek Safar (marek.safar@gmail.com)
+//
+// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com)
+//
+// 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.
+//
+
+#if FULL_AOT_RUNTIME
+
+namespace System.Reflection.Emit
+{
+       public abstract class TypeBuilder : TypeInfo
+       {
+               public const int UnspecifiedTypeSize = 0;
+
+               public PackingSize PackingSize {
+                       get {
+                               throw new PlatformNotSupportedException ();
+                       }
+               }
+
+               public int Size {
+                       get {
+                               throw new PlatformNotSupportedException ();
+                       }
+               }
+
+               public override Assembly Assembly {
+                       get {
+                               throw new PlatformNotSupportedException ();
+                       }
+               }
+
+               public override string AssemblyQualifiedName {
+                       get {
+                               throw new PlatformNotSupportedException ();
+                       }
+               }
+
+               public override Type BaseType {
+                       get {
+                               throw new PlatformNotSupportedException ();
+                       }
+               }
+
+               public override string FullName {
+                       get {
+                               throw new PlatformNotSupportedException ();
+                       }
+               }
+
+               public override Guid GUID {
+                       get {
+                               throw new PlatformNotSupportedException ();
+                       }
+               }
+
+               public override Module Module {
+                       get {
+                               throw new PlatformNotSupportedException ();
+                       }
+               }
+
+               public override string Name {
+                       get {
+                               throw new PlatformNotSupportedException ();
+                       }
+               }
+
+               public override string Namespace {
+                       get {
+                               throw new PlatformNotSupportedException ();
+                       }
+               }
+
+               public void AddInterfaceImplementation (Type interfaceType)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public TypeInfo CreateTypeInfo ()
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public ConstructorBuilder DefineConstructor (MethodAttributes attributes, CallingConventions callingConvention, Type[] parameterTypes)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public ConstructorBuilder DefineConstructor (MethodAttributes attributes, CallingConventions callingConvention, Type[] parameterTypes, Type[][] requiredCustomModifiers, Type[][] optionalCustomModifiers)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public ConstructorBuilder DefineDefaultConstructor (MethodAttributes attributes)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public EventBuilder DefineEvent (string name, EventAttributes attributes, Type eventtype)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public FieldBuilder DefineField (string fieldName, Type type, FieldAttributes attributes)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public FieldBuilder DefineField (string fieldName, Type type, Type[] requiredCustomModifiers, Type[] optionalCustomModifiers, FieldAttributes attributes)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public GenericTypeParameterBuilder[] DefineGenericParameters (string[] names)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public FieldBuilder DefineInitializedData (string name, byte[] data, FieldAttributes attributes)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public MethodBuilder DefineMethod (string name, MethodAttributes attributes)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public MethodBuilder DefineMethod (string name, MethodAttributes attributes, CallingConventions callingConvention)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public MethodBuilder DefineMethod (string name, MethodAttributes attributes, Type returnType, Type[] parameterTypes)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public MethodBuilder DefineMethod (string name, MethodAttributes attributes, CallingConventions callingConvention, Type returnType, Type[] parameterTypes)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public MethodBuilder DefineMethod (string name, MethodAttributes attributes, CallingConventions callingConvention, Type returnType, Type[] returnTypeRequiredCustomModifiers, Type[] returnTypeOptionalCustomModifiers, Type[] parameterTypes, Type[][] parameterTypeRequiredCustomModifiers, Type[][] parameterTypeOptionalCustomModifiers)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public void DefineMethodOverride (MethodInfo methodInfoBody, MethodInfo methodInfoDeclaration)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public TypeBuilder DefineNestedType (string name)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public TypeBuilder DefineNestedType (string name, TypeAttributes attr)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public TypeBuilder DefineNestedType (string name, TypeAttributes attr, Type parent)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public TypeBuilder DefineNestedType (string name, TypeAttributes attr, Type parent, int typeSize)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public TypeBuilder DefineNestedType (string name, TypeAttributes attr, Type parent, PackingSize packSize)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public TypeBuilder DefineNestedType (string name, TypeAttributes attr, Type parent, Type[] interfaces)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public TypeBuilder DefineNestedType (string name, TypeAttributes attr, Type parent, PackingSize packSize, int typeSize)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public PropertyBuilder DefineProperty (string name, PropertyAttributes attributes, Type returnType, Type[] parameterTypes)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public PropertyBuilder DefineProperty (string name, PropertyAttributes attributes, CallingConventions callingConvention, Type returnType, Type[] parameterTypes)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public PropertyBuilder DefineProperty (string name, PropertyAttributes attributes, Type returnType, Type[] returnTypeRequiredCustomModifiers, Type[] returnTypeOptionalCustomModifiers, Type[] parameterTypes, Type[][] parameterTypeRequiredCustomModifiers, Type[][] parameterTypeOptionalCustomModifiers)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public PropertyBuilder DefineProperty (string name, PropertyAttributes attributes, CallingConventions callingConvention, Type returnType, Type[] returnTypeRequiredCustomModifiers, Type[] returnTypeOptionalCustomModifiers, Type[] parameterTypes, Type[][] parameterTypeRequiredCustomModifiers, Type[][] parameterTypeOptionalCustomModifiers)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public ConstructorBuilder DefineTypeInitializer ()
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public FieldBuilder DefineUninitializedData (string name, int size, FieldAttributes attributes)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public static ConstructorInfo GetConstructor (Type type, ConstructorInfo constructor)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public static FieldInfo GetField (Type type, FieldInfo field)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public static MethodInfo GetMethod (Type type, MethodInfo method)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public bool IsCreated ()
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public void SetCustomAttribute (CustomAttributeBuilder customBuilder)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public void SetCustomAttribute (ConstructorInfo con, byte[] binaryAttribute)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public void SetParent (Type parent)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public override Type GetElementType ()
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+       }
+}
+
+#endif
\ No newline at end of file
diff --git a/mcs/class/corlib/System.Reflection.Emit/TypeBuilderInstantiation.cs b/mcs/class/corlib/System.Reflection.Emit/TypeBuilderInstantiation.cs
new file mode 100644 (file)
index 0000000..c6870f9
--- /dev/null
@@ -0,0 +1,506 @@
+//
+// System.Reflection.Emit.TypeBuilderInstantiation
+//
+// Sean MacIsaac (macisaac@ximian.com)
+// Paolo Molaro (lupus@ximian.com)
+// Patrik Torstensson (patrik.torstensson@labs2.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+// 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.
+//
+
+#if !FULL_AOT_RUNTIME
+using System.Reflection;
+using System.Reflection.Emit;
+using System.Collections;
+using System.Runtime.CompilerServices;
+using System.Globalization;
+using System.Runtime.Serialization;
+using System.Text;
+using System.Runtime.InteropServices;
+
+namespace System.Reflection.Emit
+{
+       /*
+        * TypeBuilderInstantiation represents an instantiation of a generic TypeBuilder.
+        */
+       [StructLayout (LayoutKind.Sequential)]
+       sealed class TypeBuilderInstantiation :
+               TypeInfo
+       {
+               #region Keep in sync with object-internals.h
+#pragma warning disable 649
+               internal Type generic_type;
+               Type[] type_arguments;
+#pragma warning restore 649
+               #endregion
+
+               Hashtable fields, ctors, methods;
+
+               internal TypeBuilderInstantiation ()
+               {
+                       // this should not be used
+                       throw new InvalidOperationException ();
+               }
+
+               internal TypeBuilderInstantiation (Type tb, Type[] args)
+               {
+                       this.generic_type = tb;
+                       this.type_arguments = args;
+               }
+
+               internal override Type InternalResolve ()
+               {
+                       Type gtd = generic_type.InternalResolve ();
+                       Type[] args = new Type [type_arguments.Length];
+                       for (int i = 0; i < type_arguments.Length; ++i)
+                               args [i] = type_arguments [i].InternalResolve ();
+                       return gtd.MakeGenericType (args);
+               }
+
+               // Called from the runtime to return the corresponding finished Type object
+               internal override Type RuntimeResolve ()
+               {
+                       if (generic_type is TypeBuilder && !(generic_type as TypeBuilder).IsCreated ())
+                               AppDomain.CurrentDomain.DoTypeResolve (generic_type);
+                       for (int i = 0; i < type_arguments.Length; ++i) {
+                               var t = type_arguments [i];
+                               if (t is TypeBuilder && !(t as TypeBuilder).IsCreated ())
+                                       AppDomain.CurrentDomain.DoTypeResolve (t);
+                       }
+                       return InternalResolve ();
+               }
+
+               internal bool IsCreated {
+                       get {
+                               TypeBuilder tb = generic_type as TypeBuilder;
+                               return tb != null ? tb.is_created : true;
+                       }
+               }
+
+               private const BindingFlags flags = BindingFlags.Public | BindingFlags.NonPublic |
+               BindingFlags.Static | BindingFlags.Instance | BindingFlags.DeclaredOnly;
+
+               Type GetParentType ()
+               {
+                       return InflateType (generic_type.BaseType);             
+               }
+
+               internal Type InflateType (Type type)
+               {
+                       return InflateType (type, type_arguments, null);
+               }
+
+               internal Type InflateType (Type type, Type[] method_args)
+               {
+                       return InflateType (type, type_arguments, method_args);
+               }
+
+               internal static Type InflateType (Type type, Type[] type_args, Type[] method_args)
+               {
+                       if (type == null)
+                               return null;
+                       if (!type.IsGenericParameter && !type.ContainsGenericParameters)
+                               return type;
+                       if (type.IsGenericParameter) {
+                               if (type.DeclaringMethod == null)
+                                       return type_args == null ? type : type_args [type.GenericParameterPosition];
+                               return method_args == null ? type : method_args [type.GenericParameterPosition];
+                       }
+                       if (type.IsPointer)
+                               return InflateType (type.GetElementType (), type_args, method_args).MakePointerType ();
+                       if (type.IsByRef)
+                               return InflateType (type.GetElementType (), type_args, method_args).MakeByRefType ();
+                       if (type.IsArray) {
+                               if (type.GetArrayRank () > 1)
+                                       return InflateType (type.GetElementType (), type_args, method_args).MakeArrayType (type.GetArrayRank ());
+                               
+                               if (type.ToString ().EndsWith ("[*]", StringComparison.Ordinal)) /*FIXME, the reflection API doesn't offer a way around this*/
+                                       return InflateType (type.GetElementType (), type_args, method_args).MakeArrayType (1);
+                               return InflateType (type.GetElementType (), type_args, method_args).MakeArrayType ();
+                       }
+
+                       Type[] args = type.GetGenericArguments ();
+                       for (int i = 0; i < args.Length; ++i)
+                               args [i] = InflateType (args [i], type_args, method_args);
+
+                       Type gtd = type.IsGenericTypeDefinition ? type : type.GetGenericTypeDefinition ();
+                       return gtd.MakeGenericType (args);
+               }
+               
+               public override Type BaseType {
+                       get { return generic_type.BaseType; }
+               }
+
+               public override Type[] GetInterfaces ()
+               {
+                       throw new NotSupportedException ();
+               }
+
+               protected override bool IsValueTypeImpl ()
+               {
+                       return generic_type.IsValueType;
+               }
+
+               internal override MethodInfo GetMethod (MethodInfo fromNoninstanciated)
+               {
+                       if (methods == null)
+                               methods = new Hashtable ();
+                       if (!methods.ContainsKey (fromNoninstanciated))
+                               methods [fromNoninstanciated] = new MethodOnTypeBuilderInst (this, fromNoninstanciated);
+                       return (MethodInfo)methods [fromNoninstanciated];
+               }
+
+               internal override ConstructorInfo GetConstructor (ConstructorInfo fromNoninstanciated)
+               {
+                       if (ctors == null)
+                               ctors = new Hashtable ();
+                       if (!ctors.ContainsKey (fromNoninstanciated))
+                               ctors [fromNoninstanciated] = new ConstructorOnTypeBuilderInst (this, fromNoninstanciated);
+                       return (ConstructorInfo)ctors [fromNoninstanciated];
+               }
+
+               internal override FieldInfo GetField (FieldInfo fromNoninstanciated)
+               {
+                       if (fields == null)
+                               fields = new Hashtable ();
+                       if (!fields.ContainsKey (fromNoninstanciated))
+                               fields [fromNoninstanciated] = new FieldOnTypeBuilderInst (this, fromNoninstanciated);
+                       return (FieldInfo)fields [fromNoninstanciated];
+               }
+               
+               public override MethodInfo[] GetMethods (BindingFlags bf)
+               {
+                       throw new NotSupportedException ();
+               }
+
+               public override ConstructorInfo[] GetConstructors (BindingFlags bf)
+               {
+                       throw new NotSupportedException ();
+               }
+
+               public override FieldInfo[] GetFields (BindingFlags bf)
+               {
+                       throw new NotSupportedException ();
+               }
+
+               public override PropertyInfo[] GetProperties (BindingFlags bf)
+               {
+                       throw new NotSupportedException ();
+               }
+
+               public override EventInfo[] GetEvents (BindingFlags bf)
+               {
+                       throw new NotSupportedException ();
+               }
+
+               public override Type[] GetNestedTypes (BindingFlags bf)
+               {
+                       throw new NotSupportedException ();
+               }
+
+               public override bool IsAssignableFrom (Type c)
+               {
+                       throw new NotSupportedException ();
+               }
+
+               public override Type UnderlyingSystemType {
+                       get { return this; }
+               }
+
+               public override Assembly Assembly {
+                       get { return generic_type.Assembly; }
+               }
+
+               public override Module Module {
+                       get { return generic_type.Module; }
+               }
+
+               public override string Name {
+                       get { return generic_type.Name; }
+               }
+
+               public override string Namespace {
+                       get { return generic_type.Namespace; }
+               }
+
+               public override string FullName {
+                       get { return format_name (true, false); }
+               }
+
+               public override string AssemblyQualifiedName {
+                       get { return format_name (true, true); }
+               }
+
+               public override Guid GUID {
+                       get { throw new NotSupportedException (); }
+               }
+
+               string format_name (bool full_name, bool assembly_qualified)
+               {
+                       StringBuilder sb = new StringBuilder (generic_type.FullName);
+
+                       sb.Append ("[");
+                       for (int i = 0; i < type_arguments.Length; ++i) {
+                               if (i > 0)
+                                       sb.Append (",");
+                               
+                               string name;
+                               if (full_name) {
+                                       string assemblyName = type_arguments [i].Assembly.FullName;
+                                       name = type_arguments [i].FullName;
+                                       if (name != null && assemblyName != null)
+                                               name = name + ", " + assemblyName;
+                               } else {
+                                       name = type_arguments [i].ToString ();
+                               }
+                               if (name == null) {
+                                       return null;
+                               }
+                               if (full_name)
+                                       sb.Append ("[");
+                               sb.Append (name);
+                               if (full_name)
+                                       sb.Append ("]");
+                       }
+                       sb.Append ("]");
+                       if (assembly_qualified) {
+                               sb.Append (", ");
+                               sb.Append (generic_type.Assembly.FullName);
+                       }
+                       return sb.ToString ();
+               }
+
+               public override string ToString ()
+               {
+                       return format_name (false, false);
+               }
+
+               public override Type GetGenericTypeDefinition ()
+               {
+                       return generic_type;
+               }
+
+               public override Type[] GetGenericArguments ()
+               {
+                       Type[] ret = new Type [type_arguments.Length];
+                       type_arguments.CopyTo (ret, 0);
+                       return ret;
+               }
+
+               public override bool ContainsGenericParameters {
+                       get {
+                               foreach (Type t in type_arguments) {
+                                       if (t.ContainsGenericParameters)
+                                               return true;
+                               }
+                               return false;
+                       }
+               }
+
+               public override bool IsGenericTypeDefinition {
+                       get { return false; }
+               }
+
+               public override bool IsGenericType {
+                       get { return true; }
+               }
+
+               public override Type DeclaringType {
+                       get { return generic_type.DeclaringType; }
+               }
+
+               public override RuntimeTypeHandle TypeHandle {
+                       get {
+                               throw new NotSupportedException ();
+                       }
+               }
+
+               public override Type MakeArrayType ()
+               {
+                       return new ArrayType (this, 0);
+               }
+
+               public override Type MakeArrayType (int rank)
+               {
+                       if (rank < 1)
+                               throw new IndexOutOfRangeException ();
+                       return new ArrayType (this, rank);
+               }
+
+               public override Type MakeByRefType ()
+               {
+                       return new ByRefType (this);
+               }
+
+               public override Type MakePointerType ()
+               {
+                       return new PointerType (this);
+               }
+
+               public override Type GetElementType ()
+               {
+                       throw new NotSupportedException ();
+               }
+
+               protected override bool HasElementTypeImpl ()
+               {
+                       return false;
+               }
+
+               protected override bool IsCOMObjectImpl ()
+               {
+                       return false;
+               }
+
+               protected override bool IsPrimitiveImpl ()
+               {
+                       return false;
+               }
+
+               protected override bool IsArrayImpl ()
+               {
+                       return false;
+               }
+
+               protected override bool IsByRefImpl ()
+               {
+                       return false;
+               }
+
+               protected override bool IsPointerImpl ()
+               {
+                       return false;
+               }
+
+               protected override TypeAttributes GetAttributeFlagsImpl ()
+               {
+                       return generic_type.Attributes; 
+               }
+
+               //stuff that throws
+               public override Type GetInterface (string name, bool ignoreCase)
+               {
+                       throw new NotSupportedException ();
+               }
+
+               public override EventInfo GetEvent (string name, BindingFlags bindingAttr)
+               {
+                       throw new NotSupportedException ();
+               }
+
+               public override FieldInfo GetField( string name, BindingFlags bindingAttr)
+               {
+                       throw new NotSupportedException ();
+               }
+
+               public override MemberInfo[] GetMembers (BindingFlags bindingAttr)
+               {
+                       throw new NotSupportedException ();
+               }
+
+               public override Type GetNestedType (string name, BindingFlags bindingAttr)
+               {
+                       throw new NotSupportedException ();
+               }
+
+               public override object InvokeMember (string name, BindingFlags invokeAttr,
+                                                    Binder binder, object target, object[] args,
+                                                    ParameterModifier[] modifiers,
+                                                    CultureInfo culture, string[] namedParameters)
+               {
+                       throw new NotSupportedException ();
+               }
+
+               protected override MethodInfo GetMethodImpl (string name, BindingFlags bindingAttr, Binder binder,
+                                                            CallingConventions callConvention, Type[] types,
+                                                            ParameterModifier[] modifiers)
+               {
+                       throw new NotSupportedException ();
+               }
+
+               protected override PropertyInfo GetPropertyImpl (string name, BindingFlags bindingAttr, Binder binder,
+                                                                Type returnType, Type[] types, ParameterModifier[] modifiers)
+               {
+                       throw new NotSupportedException ();
+               }
+
+               protected override ConstructorInfo GetConstructorImpl (BindingFlags bindingAttr,
+                                                                      Binder binder,
+                                                                      CallingConventions callConvention,
+                                                                      Type[] types,
+                                                                      ParameterModifier[] modifiers)
+               {
+                       throw new NotSupportedException ();
+               }
+
+               //MemberInfo
+               public override bool IsDefined (Type attributeType, bool inherit)
+               {
+                       throw new NotSupportedException ();
+               }
+
+               public override object [] GetCustomAttributes (bool inherit)
+               {
+                       if (IsCreated)
+                               return generic_type.GetCustomAttributes (inherit);
+                       throw new NotSupportedException ();
+               }
+
+               public override object [] GetCustomAttributes (Type attributeType, bool inherit)
+               {
+                       if (IsCreated)
+                               return generic_type.GetCustomAttributes (attributeType, inherit);
+                       throw new NotSupportedException ();
+               }
+
+               internal override bool IsUserType {
+                       get {
+                               foreach (var t in type_arguments) {
+                                       if (t.IsUserType)
+                                               return true;
+                               }
+                               return false;
+                       }
+               }
+
+               internal static Type MakeGenericType (Type type, Type[] typeArguments)
+               {
+                       return new TypeBuilderInstantiation (type, typeArguments);
+               }
+       }
+}
+#else
+namespace System.Reflection.Emit
+{
+       abstract class TypeBuilderInstantiation : TypeInfo
+       {
+               internal static Type MakeGenericType (Type type, Type[] typeArguments)
+               {
+                       throw new NotSupportedException ("User types are not supported under full aot");
+               }
+       }
+}
+#endif
index 45b9a2caef31e8cfe4281e8147c7015b83a59ccf..8772be59dac4a7cca6138ddeecc2f503c143d030 100644 (file)
@@ -50,7 +50,7 @@ namespace System.Reflection.Emit {
                string guid;
                string mcookie;
                string marshaltype;
-               Type marshaltyperef;
+               internal Type marshaltyperef;
                private int param_num;
                private bool has_size;
 #pragma warning restore 169, 414
index 174d5da5813c72bd9f6b960af06813128db67a7d..4f8948cc265081e49b9f9717e04267ab0aabe4db 100644 (file)
@@ -53,17 +53,22 @@ namespace System.Reflection {
        [ClassInterface(ClassInterfaceType.None)]
        [StructLayout (LayoutKind.Sequential)]
 #if MOBILE
-       public partial class Assembly : ICustomAttributeProvider {
+       public partial class Assembly : ICustomAttributeProvider, ISerializable
 #else
-       public abstract class Assembly : ICustomAttributeProvider, _Assembly, IEvidenceFactory, ISerializable {
+       public abstract class Assembly : ICustomAttributeProvider, _Assembly, IEvidenceFactory, ISerializable
 #endif
-               internal class ResolveEventHolder {
+       {
+               internal class ResolveEventHolder {     
+#pragma warning disable 67
                        public event ModuleResolveEventHandler ModuleResolve;
+#pragma warning restore
                }
 
                internal class UnmanagedMemoryStreamForModule : UnmanagedMemoryStream
                {
+#pragma warning disable 414
                        Module module;
+#pragma warning restore
 
                        public unsafe UnmanagedMemoryStreamForModule (byte* pointer, long length, Module module)
                                : base (pointer, length)
@@ -115,7 +120,7 @@ namespace System.Reflection {
                // We can't store the event directly in this class, since the
                // compiler would silently insert the fields before _mono_assembly
                //
-               public event ModuleResolveEventHandler ModuleResolve {
+               public virtual event ModuleResolveEventHandler ModuleResolve {
                        [SecurityPermission (SecurityAction.LinkDemand, ControlAppDomain = true)]
                        add {
                                resolve_event_holder.ModuleResolve += value;
@@ -145,7 +150,7 @@ namespace System.Reflection {
                private string GetCodeBase (bool escaped)
                {
                        string cb = get_code_base (escaped);
-#if !NET_2_1
+#if !MOBILE
                        if (SecurityManager.SecurityEnabled) {
                                // we cannot divulge local file informations
                                if (String.Compare ("FILE://", 0, cb, 0, 7, true, CultureInfo.InvariantCulture) == 0) {
@@ -215,7 +220,7 @@ namespace System.Reflection {
                                        return String.Empty;
 
                                string loc = get_location ();
-#if !NET_2_1
+#if !MOBILE
                                if ((loc != String.Empty) && SecurityManager.SecurityEnabled) {
                                        // we cannot divulge local file informations
                                        new FileIOPermission (FileIOPermissionAccess.PathDiscovery, loc).Demand ();
@@ -505,10 +510,14 @@ namespace System.Reflection {
                        // Try the assembly directory
                        string location = Path.GetDirectoryName (Location);
                        string fullName = Path.Combine (location, Path.Combine (culture.Name, an.Name + ".dll"));
-                       if (!throwOnFileNotFound && !File.Exists (fullName))
-                               return null;
 
-                       return (RuntimeAssembly)LoadFrom (fullName);
+                       try {
+                               return (RuntimeAssembly)LoadFrom (fullName);
+                       } catch {
+                               if (!throwOnFileNotFound && !File.Exists (fullName))
+                                       return null;
+                               throw;
+                       }
                }
 
 #if !MOBILE
@@ -531,7 +540,7 @@ namespace System.Reflection {
                public static Assembly LoadFrom (String assemblyFile, Evidence securityEvidence)
                {
                        Assembly a = LoadFrom (assemblyFile, false);
-#if !NET_2_1
+#if !MOBILE
                        if ((a != null) && (securityEvidence != null)) {
                                // merge evidence (i.e. replace defaults with provided evidences)
                                a.Evidence.Merge (securityEvidence);
@@ -803,7 +812,7 @@ namespace System.Reflection {
                        return other._mono_assembly == _mono_assembly;
                }
 
-#if !NET_2_1
+#if !MOBILE
                // Code Access Security
 
                internal void Resolve () 
@@ -888,13 +897,12 @@ namespace System.Reflection {
                public virtual PermissionSet PermissionSet {
                        get { return this.GrantedPermissionSet; }
                }
-               
+#endif
+
                public virtual SecurityRuleSet SecurityRuleSet {
                        get { throw CreateNIE (); }
                }
 
-#endif
-
                static Exception CreateNIE ()
                {
                        return new NotImplementedException ("Derived classes must implement it");
index 7ce7241cc98c8851f6893ca193722e3c679c5f90..86241d82d2b223c5e2d93fd4047ce7e753ec3e8a 100644 (file)
@@ -446,11 +446,9 @@ namespace System.Reflection {
                        get {
                                return (cultureinfo == null)? null : cultureinfo.Name;
                        }
-#if NETSTANDARD
                        set {
                                throw new NotImplementedException ();
                        }
-#endif
                }
 
                [ComVisibleAttribute(false)]
index 9668f1f56c2b85e6bd47899349e8a2b6323fdb79..28a727924cda0a7cd70aec8bc9310166dfc8fb8e 100644 (file)
@@ -253,7 +253,7 @@ namespace System.Reflection {
                        }
 
                        addHandlerType = addHandlerDelegateType.MakeGenericType (typeVector);
-#if NET_2_1
+#if MOBILE
                        // with Silverlight a coreclr failure (e.g. Transparent caller creating a delegate on a Critical method)
                        // would normally throw an ArgumentException, so we set throwOnBindFailure to false and check for a null
                        // delegate that we can transform into a MethodAccessException
diff --git a/mcs/class/corlib/System.Reflection/MonoGenericClass.cs b/mcs/class/corlib/System.Reflection/MonoGenericClass.cs
deleted file mode 100644 (file)
index 51a1a50..0000000
+++ /dev/null
@@ -1,519 +0,0 @@
-//
-// System.Reflection.MonoGenericClass
-//
-// Sean MacIsaac (macisaac@ximian.com)
-// Paolo Molaro (lupus@ximian.com)
-// Patrik Torstensson (patrik.torstensson@labs2.com)
-//
-// (C) 2001 Ximian, Inc.
-//
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// 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.
-//
-
-#if !FULL_AOT_RUNTIME
-using System.Reflection;
-using System.Reflection.Emit;
-using System.Collections;
-using System.Runtime.CompilerServices;
-using System.Globalization;
-using System.Runtime.Serialization;
-using System.Text;
-using System.Runtime.InteropServices;
-
-namespace System.Reflection
-{
-       /*
-        * MonoGenericClass represents an instantiation of a generic TypeBuilder. MS
-        * calls this class TypeBuilderInstantiation (a much better name). MS returns 
-        * NotImplementedException for many of the methods but we can't do that as gmcs
-        * depends on them.
-        */
-       [StructLayout (LayoutKind.Sequential)]
-       sealed class MonoGenericClass :
-               TypeInfo
-       {
-               #region Keep in sync with object-internals.h
-#pragma warning disable 649
-               internal Type generic_type;
-               Type[] type_arguments;
-               bool initialized;
-#pragma warning restore 649
-               #endregion
-
-               Hashtable fields, ctors, methods;
-
-               internal MonoGenericClass ()
-               {
-                       // this should not be used
-                       throw new InvalidOperationException ();
-               }
-
-               internal MonoGenericClass (Type tb, Type[] args)
-               {
-                       this.generic_type = tb;
-                       this.type_arguments = args;
-                       /*
-                       This is a temporary hack until we can fix the rest of the runtime
-                       to properly handle this class to be a complete UT.
-
-                       We must not regisrer this with the runtime after the type is created
-                       otherwise created_type.MakeGenericType will return an instance of MonoGenericClass,
-                       which is very very broken.
-                       */
-                       if (tb is TypeBuilder && !(tb as TypeBuilder).is_created)
-                               register_with_runtime (this);
-                       
-               }
-
-               internal override Type InternalResolve ()
-               {
-                       Type gtd = generic_type.InternalResolve ();
-                       Type[] args = new Type [type_arguments.Length];
-                       for (int i = 0; i < type_arguments.Length; ++i)
-                               args [i] = type_arguments [i].InternalResolve ();
-                       return gtd.MakeGenericType (args);
-               }
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)]
-               extern void initialize (FieldInfo[] fields);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)]
-               internal static extern void register_with_runtime (Type type);
-
-               internal bool IsCreated {
-                       get {
-                               TypeBuilder tb = generic_type as TypeBuilder;
-                               return tb != null ? tb.is_created : true;
-                       }
-               }
-
-               private const BindingFlags flags = BindingFlags.Public | BindingFlags.NonPublic |
-               BindingFlags.Static | BindingFlags.Instance | BindingFlags.DeclaredOnly;
-
-               void initialize ()
-               {
-                       if (initialized)
-                               return;
-
-                       MonoGenericClass parent = GetParentType () as MonoGenericClass;
-                       if (parent != null)
-                               parent.initialize ();
-                               
-                       initialize (generic_type.GetFields (flags));
-
-                       initialized = true;
-               }
-
-               Type GetParentType ()
-               {
-                       return InflateType (generic_type.BaseType);             
-               }
-
-               internal Type InflateType (Type type)
-               {
-                       return InflateType (type, type_arguments, null);
-               }
-
-               internal Type InflateType (Type type, Type[] method_args)
-               {
-                       return InflateType (type, type_arguments, method_args);
-               }
-
-               internal static Type InflateType (Type type, Type[] type_args, Type[] method_args)
-               {
-                       if (type == null)
-                               return null;
-                       if (!type.IsGenericParameter && !type.ContainsGenericParameters)
-                               return type;
-                       if (type.IsGenericParameter) {
-                               if (type.DeclaringMethod == null)
-                                       return type_args == null ? type : type_args [type.GenericParameterPosition];
-                               return method_args == null ? type : method_args [type.GenericParameterPosition];
-                       }
-                       if (type.IsPointer)
-                               return InflateType (type.GetElementType (), type_args, method_args).MakePointerType ();
-                       if (type.IsByRef)
-                               return InflateType (type.GetElementType (), type_args, method_args).MakeByRefType ();
-                       if (type.IsArray) {
-                               if (type.GetArrayRank () > 1)
-                                       return InflateType (type.GetElementType (), type_args, method_args).MakeArrayType (type.GetArrayRank ());
-                               
-                               if (type.ToString ().EndsWith ("[*]", StringComparison.Ordinal)) /*FIXME, the reflection API doesn't offer a way around this*/
-                                       return InflateType (type.GetElementType (), type_args, method_args).MakeArrayType (1);
-                               return InflateType (type.GetElementType (), type_args, method_args).MakeArrayType ();
-                       }
-
-                       Type[] args = type.GetGenericArguments ();
-                       for (int i = 0; i < args.Length; ++i)
-                               args [i] = InflateType (args [i], type_args, method_args);
-
-                       Type gtd = type.IsGenericTypeDefinition ? type : type.GetGenericTypeDefinition ();
-                       return gtd.MakeGenericType (args);
-               }
-               
-               public override Type BaseType {
-                       get { return generic_type.BaseType; }
-               }
-
-               public override Type[] GetInterfaces ()
-               {
-                       throw new NotSupportedException ();
-               }
-
-               protected override bool IsValueTypeImpl ()
-               {
-                       return generic_type.IsValueType;
-               }
-
-               internal override MethodInfo GetMethod (MethodInfo fromNoninstanciated)
-               {
-                       initialize ();
-
-                       if (methods == null)
-                               methods = new Hashtable ();
-                       if (!methods.ContainsKey (fromNoninstanciated))
-                               methods [fromNoninstanciated] = new MethodOnTypeBuilderInst (this, fromNoninstanciated);
-                       return (MethodInfo)methods [fromNoninstanciated];
-               }
-
-               internal override ConstructorInfo GetConstructor (ConstructorInfo fromNoninstanciated)
-               {
-                       initialize ();
-
-                       if (ctors == null)
-                               ctors = new Hashtable ();
-                       if (!ctors.ContainsKey (fromNoninstanciated))
-                               ctors [fromNoninstanciated] = new ConstructorOnTypeBuilderInst (this, fromNoninstanciated);
-                       return (ConstructorInfo)ctors [fromNoninstanciated];
-               }
-
-               internal override FieldInfo GetField (FieldInfo fromNoninstanciated)
-               {
-                       initialize ();
-                       if (fields == null)
-                               fields = new Hashtable ();
-                       if (!fields.ContainsKey (fromNoninstanciated))
-                               fields [fromNoninstanciated] = new FieldOnTypeBuilderInst (this, fromNoninstanciated);
-                       return (FieldInfo)fields [fromNoninstanciated];
-               }
-               
-               public override MethodInfo[] GetMethods (BindingFlags bf)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public override ConstructorInfo[] GetConstructors (BindingFlags bf)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public override FieldInfo[] GetFields (BindingFlags bf)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public override PropertyInfo[] GetProperties (BindingFlags bf)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public override EventInfo[] GetEvents (BindingFlags bf)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public override Type[] GetNestedTypes (BindingFlags bf)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public override bool IsAssignableFrom (Type c)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public override Type UnderlyingSystemType {
-                       get { return this; }
-               }
-
-               public override Assembly Assembly {
-                       get { return generic_type.Assembly; }
-               }
-
-               public override Module Module {
-                       get { return generic_type.Module; }
-               }
-
-               public override string Name {
-                       get { return generic_type.Name; }
-               }
-
-               public override string Namespace {
-                       get { return generic_type.Namespace; }
-               }
-
-               public override string FullName {
-                       get { return format_name (true, false); }
-               }
-
-               public override string AssemblyQualifiedName {
-                       get { return format_name (true, true); }
-               }
-
-               public override Guid GUID {
-                       get { throw new NotSupportedException (); }
-               }
-
-               string format_name (bool full_name, bool assembly_qualified)
-               {
-                       StringBuilder sb = new StringBuilder (generic_type.FullName);
-
-                       sb.Append ("[");
-                       for (int i = 0; i < type_arguments.Length; ++i) {
-                               if (i > 0)
-                                       sb.Append (",");
-                               
-                               string name;
-                               if (full_name) {
-                                       string assemblyName = type_arguments [i].Assembly.FullName;
-                                       name = type_arguments [i].FullName;
-                                       if (name != null && assemblyName != null)
-                                               name = name + ", " + assemblyName;
-                               } else {
-                                       name = type_arguments [i].ToString ();
-                               }
-                               if (name == null) {
-                                       return null;
-                               }
-                               if (full_name)
-                                       sb.Append ("[");
-                               sb.Append (name);
-                               if (full_name)
-                                       sb.Append ("]");
-                       }
-                       sb.Append ("]");
-                       if (assembly_qualified) {
-                               sb.Append (", ");
-                               sb.Append (generic_type.Assembly.FullName);
-                       }
-                       return sb.ToString ();
-               }
-
-               public override string ToString ()
-               {
-                       return format_name (false, false);
-               }
-
-               public override Type GetGenericTypeDefinition ()
-               {
-                       return generic_type;
-               }
-
-               public override Type[] GetGenericArguments ()
-               {
-                       Type[] ret = new Type [type_arguments.Length];
-                       type_arguments.CopyTo (ret, 0);
-                       return ret;
-               }
-
-               public override bool ContainsGenericParameters {
-                       get {
-                               foreach (Type t in type_arguments) {
-                                       if (t.ContainsGenericParameters)
-                                               return true;
-                               }
-                               return false;
-                       }
-               }
-
-               public override bool IsGenericTypeDefinition {
-                       get { return false; }
-               }
-
-               public override bool IsGenericType {
-                       get { return true; }
-               }
-
-               public override Type DeclaringType {
-                       get { return generic_type.DeclaringType; }
-               }
-
-               public override RuntimeTypeHandle TypeHandle {
-                       get {
-                               throw new NotSupportedException ();
-                       }
-               }
-
-               public override Type MakeArrayType ()
-               {
-                       return new ArrayType (this, 0);
-               }
-
-               public override Type MakeArrayType (int rank)
-               {
-                       if (rank < 1)
-                               throw new IndexOutOfRangeException ();
-                       return new ArrayType (this, rank);
-               }
-
-               public override Type MakeByRefType ()
-               {
-                       return new ByRefType (this);
-               }
-
-               public override Type MakePointerType ()
-               {
-                       return new PointerType (this);
-               }
-
-               public override Type GetElementType ()
-               {
-                       throw new NotSupportedException ();
-               }
-
-               protected override bool HasElementTypeImpl ()
-               {
-                       return false;
-               }
-
-               protected override bool IsCOMObjectImpl ()
-               {
-                       return false;
-               }
-
-               protected override bool IsPrimitiveImpl ()
-               {
-                       return false;
-               }
-
-               protected override bool IsArrayImpl ()
-               {
-                       return false;
-               }
-
-               protected override bool IsByRefImpl ()
-               {
-                       return false;
-               }
-
-               protected override bool IsPointerImpl ()
-               {
-                       return false;
-               }
-
-               protected override TypeAttributes GetAttributeFlagsImpl ()
-               {
-                       return generic_type.Attributes; 
-               }
-
-               //stuff that throws
-               public override Type GetInterface (string name, bool ignoreCase)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public override EventInfo GetEvent (string name, BindingFlags bindingAttr)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public override FieldInfo GetField( string name, BindingFlags bindingAttr)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public override MemberInfo[] GetMembers (BindingFlags bindingAttr)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public override Type GetNestedType (string name, BindingFlags bindingAttr)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public override object InvokeMember (string name, BindingFlags invokeAttr,
-                                                    Binder binder, object target, object[] args,
-                                                    ParameterModifier[] modifiers,
-                                                    CultureInfo culture, string[] namedParameters)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               protected override MethodInfo GetMethodImpl (string name, BindingFlags bindingAttr, Binder binder,
-                                                            CallingConventions callConvention, Type[] types,
-                                                            ParameterModifier[] modifiers)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               protected override PropertyInfo GetPropertyImpl (string name, BindingFlags bindingAttr, Binder binder,
-                                                                Type returnType, Type[] types, ParameterModifier[] modifiers)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               protected override ConstructorInfo GetConstructorImpl (BindingFlags bindingAttr,
-                                                                      Binder binder,
-                                                                      CallingConventions callConvention,
-                                                                      Type[] types,
-                                                                      ParameterModifier[] modifiers)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               //MemberInfo
-               public override bool IsDefined (Type attributeType, bool inherit)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public override object [] GetCustomAttributes (bool inherit)
-               {
-                       if (IsCreated)
-                               return generic_type.GetCustomAttributes (inherit);
-                       throw new NotSupportedException ();
-               }
-
-               public override object [] GetCustomAttributes (Type attributeType, bool inherit)
-               {
-                       if (IsCreated)
-                               return generic_type.GetCustomAttributes (attributeType, inherit);
-                       throw new NotSupportedException ();
-               }
-
-               internal override bool IsUserType {
-                       get {
-                               foreach (var t in type_arguments) {
-                                       if (t.IsUserType)
-                                               return true;
-                               }
-                               return false;
-                       }
-               }
-
-       }
-}
-
-#endif
diff --git a/mcs/class/corlib/System.Reflection/MonoGenericMethod.cs b/mcs/class/corlib/System.Reflection/MonoGenericMethod.cs
deleted file mode 100644 (file)
index 48ef423..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-//
-// System.Reflection.MonoGenericMethod
-//
-// Martin Baulig (martin@ximian.com)
-//
-// (C) 2004 Novell, Inc.
-//
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// 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.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-namespace System.Reflection
-{
-       [Serializable]
-       [StructLayout (LayoutKind.Sequential)]
-       internal class MonoGenericMethod : MonoMethod
-       {
-               internal MonoGenericMethod ()
-               {
-                       // this should not be used
-                       throw new InvalidOperationException ();
-               }
-
-       }
-
-       [Serializable]
-       [StructLayout (LayoutKind.Sequential)]
-       internal class MonoGenericCMethod : MonoCMethod
-       {
-               internal MonoGenericCMethod ()
-               {
-                       // this should not be used
-                       throw new InvalidOperationException ();
-               }
-       }
-}
index c93233dfffb57af19d0eaa9cc7092a2125e01739..9e5197df13c168d2f9ac1e5cdc407832e1d45766 100644 (file)
@@ -305,7 +305,7 @@ namespace System.Reflection {
                                o = InternalInvoke (obj, parameters, out exc);
                        } catch (ThreadAbortException) {
                                throw;
-#if NET_2_1
+#if MOBILE
                        } catch (MethodAccessException) {
                                throw;
 #endif
@@ -659,7 +659,7 @@ namespace System.Reflection {
 
                        try {
                                o = InternalInvoke (obj, parameters, out exc);
-#if NET_2_1
+#if MOBILE
                        } catch (MethodAccessException) {
                                throw;
 #endif
index 6edaf0de37ca8173818d8258f5c5cd4f6d95792d..25bde841e99c53deb4a93a7c51a9aa1713970930 100644 (file)
@@ -90,7 +90,7 @@ namespace System.Reflection {
                public override
                string FullyQualifiedName {
                        get {
-#if !NET_2_1
+#if !MOBILE
                                if (SecurityManager.SecurityEnabled) {
                                        new FileIOPermission (FileIOPermissionAccess.PathDiscovery, fqname).Demand ();
                                }
@@ -283,7 +283,7 @@ namespace System.Reflection {
                        UnitySerializationHolder.GetUnitySerializationInfo (info, UnitySerializationHolder.ModuleUnity, this.ScopeName, this.GetRuntimeAssembly ());
                }
 
-#if !NET_2_1
+#if !MOBILE
 
                public
                override
index 87310b19e2fa8d22835a84f4e05b3d75e0d9b932..16f44ec583b4ef4b0ac57ca9d9134b74e4f95ac4 100644 (file)
@@ -359,7 +359,7 @@ namespace System.Reflection {
                        }
 
                        getterType = getterDelegateType.MakeGenericType (typeVector);
-#if NET_2_1
+#if MOBILE
                        // with Silverlight a coreclr failure (e.g. Transparent caller creating a delegate on a Critical method)
                        // would normally throw an ArgumentException, so we set throwOnBindFailure to false and check for a null
                        // delegate that we can transform into a MethodAccessException
index aff2ae187e6e69546a111e67f70b70a279f0ced9..bfa10d8b9cfbd1b2baab220cfe315d219c3e67da 100644 (file)
@@ -121,7 +121,7 @@ public class StrongNameKeyPair : ISerializable, IDeserializationCallback
                                _keyPairArray = null;
                        }
                }
-#if !NET_2_1
+#if !MOBILE
                else if (_keyPairContainer != null) {
                        CspParameters csp = new CspParameters ();
                        csp.KeyContainerName = _keyPairContainer;
diff --git a/mcs/class/corlib/System.Reflection/TargetException.cs b/mcs/class/corlib/System.Reflection/TargetException.cs
deleted file mode 100644 (file)
index bd5e901..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-//
-// System.Reflection.TargetException.cs
-//
-// Author: Duncan Mak (duncan@ximian.com)
-//
-// (C) Ximian, Inc. http://www.ximian.com
-//
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// 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.Globalization;
-using System.Runtime.Serialization;
-using System.Runtime.InteropServices;
-
-namespace System.Reflection
-{
-       [ComVisible (true)]
-       [Serializable]
-#if NET_2_1
-       public class TargetException : Exception {
-#else
-       public class TargetException : ApplicationException {
-#endif
-               public TargetException ()
-                       : base (Locale.GetText ("Unable to invoke an invalid target."))
-               {
-               }
-
-               public TargetException (string message)
-                       : base (message)
-               {
-               }
-
-               public TargetException (string message, Exception inner)
-                       : base (message, inner)
-               {
-               }
-
-               protected TargetException (SerializationInfo info, StreamingContext context)
-                       : base (info, context)
-               {
-               }
-       }
-}
diff --git a/mcs/class/corlib/System.Reflection/TargetInvocationException.cs b/mcs/class/corlib/System.Reflection/TargetInvocationException.cs
deleted file mode 100644 (file)
index 345368f..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-//
-// System.Reflection.TargetInvocationException
-//
-// Sean MacIsaac (macisaac@ximian.com)
-// Duncan Mak  (duncan@ximian.com)
-//
-// (C) 2001 Ximian, Inc.
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// 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.Runtime.Serialization;
-using System.Runtime.InteropServices;
-
-namespace System.Reflection
-{
-       [ComVisible (true)]
-       [Serializable]
-#if NET_2_1
-       public sealed class TargetInvocationException : Exception {
-#else
-       public sealed class TargetInvocationException : ApplicationException {
-#endif
-               public TargetInvocationException (Exception inner)
-                       : base ("Exception has been thrown by the target of an invocation.", inner)
-               {                       
-               }
-
-               public TargetInvocationException (string message, Exception inner)
-                       : base (message, inner)
-               {
-               }               
-
-               internal TargetInvocationException (SerializationInfo info, StreamingContext sc)
-                       : base (info, sc)
-               {
-               }
-       }       
-}
diff --git a/mcs/class/corlib/System.Reflection/TargetParameterCountException.cs b/mcs/class/corlib/System.Reflection/TargetParameterCountException.cs
deleted file mode 100644 (file)
index deb5344..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-//
-// System.Reflection.TargetParameterCountException.cs
-//
-// Author: Duncan Mak (duncan@ximian.com)
-//
-// (C) Ximian, Inc. http://www.ximian.com
-//
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// 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.Runtime.Serialization;
-using System.Globalization;
-using System.Runtime.InteropServices;
-
-namespace System.Reflection
-{
-       [ComVisible (true)]
-       [Serializable]
-#if NET_2_1
-       public sealed class TargetParameterCountException : Exception {
-#else
-       public sealed class TargetParameterCountException : ApplicationException {
-#endif
-               public TargetParameterCountException ()
-                       : base (Locale.GetText ("Number of parameter does not match expected count."))
-               {
-               }
-
-               public TargetParameterCountException (string message)
-                       : base (message)
-               {
-               }
-
-               public TargetParameterCountException (string message, Exception inner)
-                       : base (message, inner)
-               {
-               }
-
-               internal TargetParameterCountException (SerializationInfo info,
-                                                      StreamingContext context)
-                       : base (info, context)
-               {
-               }
-       }
-}
index a55f093678f618f00cb384f8fbd809f16264a1cd..8574472acb11f694c3b854866c76ed54070c7f2a 100644 (file)
@@ -1,10 +1,12 @@
-//
+//
 // ConditionalWeakTable.cs
 //
 // Author:
 //   Rodrigo Kumpera (rkumpera@novell.com)
+//   Tautvydas Žilys <zilys@unity3d.com>
 //
 // Copyright (C) 2010 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2016 Unity Technologies (https://unity3d.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
@@ -223,25 +225,94 @@ namespace System.Runtime.CompilerServices
 
                        return res;
                }
-               
+
+               //--------------------------------------------------------------------------------------------
+               // Find a key that equals (value equality) with the given key - don't use in perf critical path
+               // Note that it calls out to Object.Equals which may calls the override version of Equals
+               // and that may take locks and leads to deadlock
+               // Currently it is only used by WinRT event code and you should only use this function
+               // if you know for sure that either you won't run into dead locks or you need to live with the
+               // possiblity
+               //--------------------------------------------------------------------------------------------
+               [System.Security.SecuritySafeCritical]
+               [FriendAccessAllowed]
+               internal TKey FindEquivalentKeyUnsafe(TKey key, out TValue value)
+               {
+                       lock (_lock)
+                       {
+                               for (int i = 0; i < data.Length; ++i)
+                               {
+                                       var item = data[i];
+                                       if (Object.Equals(item.key, key))
+                                       {
+                                               value = (TValue)item.value;
+                                               return (TKey)item.key;
+                                       }
+                               }
+                       }
+
+                       value = default(TValue);
+                       return null;
+               }
+
+               //--------------------------------------------------------------------------------------------
+               // Clear all the key/value pairs
+               //--------------------------------------------------------------------------------------------
+               [System.Security.SecuritySafeCritical]
+               internal void Clear()
+               {
+                       lock (_lock)
+                       {
+                               for (int i = 0; i < data.Length; i++)
+                               {
+                                       data[i].key = GC.EPHEMERON_TOMBSTONE;
+                                       data[i].value = null;
+                               }
+
+                               size = 0;
+                       }
+               }
+
                // extracted from ../../../../external/referencesource/mscorlib/system/runtime/compilerservices/
                internal ICollection<TKey> Keys
                {
                        [System.Security.SecuritySafeCritical]
                        get
                        {
+                               var tombstone = GC.EPHEMERON_TOMBSTONE;
                                List<TKey> list = new List<TKey>(data.Length);
                                lock (_lock)
                                {
                                        for (int i = 0; i < data.Length; ++i)
                                        {
                                                TKey key = (TKey) data [i].key;
-                                               if (key != null)
+                                               if (key != null && key != tombstone)
                                                        list.Add (key);
                                        }
                                }
                                return list;
                        }
                }
+
+               internal ICollection<TValue> Values
+               {
+                       [System.Security.SecuritySafeCritical]
+                       get
+                       {
+                               var tombstone = GC.EPHEMERON_TOMBSTONE;
+                               List<TValue> list = new List<TValue>(data.Length);
+                               lock (_lock)
+                               {
+                                       for (int i = 0; i < data.Length; ++i)
+                                       {
+                                               var item = data[i];
+                                               if (item.key != null && item.key != tombstone)
+                                                       list.Add((TValue)item.value);
+                                       }
+                               }
+
+                               return list;
+                       }
+               }
        }
 }
diff --git a/mcs/class/corlib/System.Runtime.InteropServices.WindowsRuntime/DefaultInterfaceAttribute.cs b/mcs/class/corlib/System.Runtime.InteropServices.WindowsRuntime/DefaultInterfaceAttribute.cs
deleted file mode 100644 (file)
index 44c7662..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-//
-// DefaultInterfaceAttribute.cs
-//
-// Author:
-//       Martin Baulig <martin.baulig@xamarin.com>
-//
-// Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)
-//
-// 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.Runtime.CompilerServices;
-
-namespace System.Runtime.InteropServices.WindowsRuntime
-{
-       [AttributeUsageAttribute(AttributeTargets.Class|AttributeTargets.Interface, AllowMultiple = false, Inherited = false)]
-       public sealed class DefaultInterfaceAttribute : Attribute
-       {
-               public Type DefaultInterface {
-                       get;
-                       private set;
-               }
-
-               public DefaultInterfaceAttribute (Type defaultInterface)
-               {
-                       DefaultInterface = defaultInterface;
-               }
-       }
-}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices.WindowsRuntime/EventRegistrationToken.cs b/mcs/class/corlib/System.Runtime.InteropServices.WindowsRuntime/EventRegistrationToken.cs
deleted file mode 100644 (file)
index e3479eb..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-//
-// EventRegistrationToken.cs
-//
-// Author:
-//       Martin Baulig <martin.baulig@xamarin.com>
-//
-// Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)
-//
-// 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.Runtime.CompilerServices;
-
-namespace System.Runtime.InteropServices.WindowsRuntime
-{
-       public struct EventRegistrationToken
-       {
-#pragma warning disable 0649
-               long value;
-#pragma warning restore 0649
-
-               public static bool operator == (EventRegistrationToken left, EventRegistrationToken right)
-               {
-                       return left.value == right.value;
-               }
-
-               public static bool operator != (EventRegistrationToken left, EventRegistrationToken right)
-               {
-                       return left.value != right.value;
-               }
-
-               public override bool Equals (object obj)
-               {
-                       return ((EventRegistrationToken)obj).value == value;
-               }
-
-               public override int GetHashCode ()
-               {
-                       return unchecked ((int)value);
-               }
-       }
-}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices.WindowsRuntime/EventRegistrationTokenTable.cs b/mcs/class/corlib/System.Runtime.InteropServices.WindowsRuntime/EventRegistrationTokenTable.cs
deleted file mode 100644 (file)
index 0f09681..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-//
-// EventRegistrationTokenTable.cs
-//
-// Author:
-//       Martin Baulig <martin.baulig@xamarin.com>
-//
-// Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)
-//
-// 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.Runtime.CompilerServices;
-
-namespace System.Runtime.InteropServices.WindowsRuntime
-{
-       [MonoTODO]
-       public sealed class EventRegistrationTokenTable<T>
-               where T : class
-       {
-               public EventRegistrationTokenTable ()
-               {
-                       throw new NotImplementedException ();
-               }
-
-               public T InvocationList {
-                       get { throw new NotImplementedException (); }
-                       set { throw new NotImplementedException (); }
-               }
-
-               public EventRegistrationToken AddEventHandler (T handler)
-               {
-                       throw new NotImplementedException ();
-               }
-
-               public static EventRegistrationTokenTable<T> GetOrCreateEventRegistrationTokenTable(ref EventRegistrationTokenTable<T> refEventTable)
-               {
-                       throw new NotImplementedException ();
-               }
-
-               public void RemoveEventHandler (T handler)
-               {
-                       throw new NotImplementedException ();
-               }
-
-               public void RemoveEventHandler (EventRegistrationToken token)
-               {
-                       throw new NotImplementedException ();
-               }
-       }
-}
-
diff --git a/mcs/class/corlib/System.Runtime.InteropServices.WindowsRuntime/IActivationFactory.cs b/mcs/class/corlib/System.Runtime.InteropServices.WindowsRuntime/IActivationFactory.cs
deleted file mode 100644 (file)
index 7c516aa..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-//
-// IActivationFactory.cs
-//
-// Author:
-//       Martin Baulig <martin.baulig@xamarin.com>
-//
-// Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)
-//
-// 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.Runtime.CompilerServices;
-
-namespace System.Runtime.InteropServices.WindowsRuntime
-{
-       [Guid("00000035-0000-0000-C000-000000000046")]
-       public interface IActivationFactory
-       {
-               object ActivateInstance ();
-       }
-}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices.WindowsRuntime/InterfaceImplementedInVersionAttribute.cs b/mcs/class/corlib/System.Runtime.InteropServices.WindowsRuntime/InterfaceImplementedInVersionAttribute.cs
deleted file mode 100644 (file)
index c489221..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-//
-// InterfaceImplementedInVersionAttribute.cs
-//
-// Author:
-//       Martin Baulig <martin.baulig@xamarin.com>
-//
-// Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)
-//
-// 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.Runtime.CompilerServices;
-
-namespace System.Runtime.InteropServices.WindowsRuntime
-{
-       [AttributeUsageAttribute(AttributeTargets.Class|AttributeTargets.Interface, AllowMultiple = true, Inherited = false)]
-       public sealed class InterfaceImplementedInVersionAttribute : Attribute
-       {
-               public InterfaceImplementedInVersionAttribute (Type interfaceType, byte majorVersion, byte minorVersion,
-                       byte buildVersion, byte revisionVersion)
-               {
-                       InterfaceType = interfaceType;
-                       MajorVersion = majorVersion;
-                       MinorVersion = minorVersion;
-                       BuildVersion = buildVersion;
-                       RevisionVersion = revisionVersion;
-               }
-
-               public byte BuildVersion {
-                       get;
-                       private set;
-               }
-
-               public Type InterfaceType {
-                       get;
-                       private set;
-               }
-
-               public byte MajorVersion {
-                       get;
-                       private set;
-               }
-
-               public byte MinorVersion {
-                       get;
-                       private set;
-               }
-       
-               public byte RevisionVersion {
-                       get;
-                       private set;
-               }
-       }
-}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices.WindowsRuntime/ReadOnlyArrayAttribute.cs b/mcs/class/corlib/System.Runtime.InteropServices.WindowsRuntime/ReadOnlyArrayAttribute.cs
deleted file mode 100644 (file)
index 9aa41a0..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-//
-// ReadOnlyArrayAttribute.cs
-//
-// Author:
-//       Martin Baulig <martin.baulig@xamarin.com>
-//
-// Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)
-//
-// 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.Runtime.CompilerServices;
-
-namespace System.Runtime.InteropServices.WindowsRuntime
-{
-       [AttributeUsageAttribute(AttributeTargets.Parameter, Inherited = false, AllowMultiple = false)]
-       public sealed class ReadOnlyArrayAttribute : Attribute
-       {
-       }
-}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices.WindowsRuntime/ReturnValueNameAttribute.cs b/mcs/class/corlib/System.Runtime.InteropServices.WindowsRuntime/ReturnValueNameAttribute.cs
deleted file mode 100644 (file)
index 8fd0173..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-//
-// ReturnValueNameAttribute.cs
-//
-// Author:
-//       Martin Baulig <martin.baulig@xamarin.com>
-//
-// Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)
-//
-// 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.Runtime.CompilerServices;
-
-namespace System.Runtime.InteropServices.WindowsRuntime
-{
-       [AttributeUsageAttribute(AttributeTargets.Delegate|AttributeTargets.ReturnValue, AllowMultiple = false, Inherited = false)]
-       public sealed class ReturnValueNameAttribute : Attribute
-       {
-               public ReturnValueNameAttribute (string name)
-               {
-                       Name = name;
-               }
-
-               public string Name {
-                       get;
-                       private set;
-               }
-       }
-}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices.WindowsRuntime/UnsafeNativeMethods.cs b/mcs/class/corlib/System.Runtime.InteropServices.WindowsRuntime/UnsafeNativeMethods.cs
new file mode 100644 (file)
index 0000000..a7101cf
--- /dev/null
@@ -0,0 +1,51 @@
+//
+// UnsafeNativeMethods.cs
+//
+// Author:
+//   Tautvydas Žilys <zilys@unity3d.com>
+//
+// Copyright (c) 2016 Unity Technologies (https://www.unity3d.com)
+//
+// 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.Runtime.CompilerServices;
+
+namespace System.Runtime.InteropServices.WindowsRuntime
+{
+       internal unsafe static class UnsafeNativeMethods
+       {
+               [MethodImplAttribute(MethodImplOptions.InternalCall)]
+               public static extern int WindowsCreateString(string sourceString, int length, IntPtr* hstring);
+               
+               [MethodImplAttribute(MethodImplOptions.InternalCall)]
+               public static extern int WindowsDeleteString(IntPtr hstring);
+               
+               [MethodImplAttribute(MethodImplOptions.InternalCall)]
+               public static extern char* WindowsGetStringRawBuffer(IntPtr hstring, uint* length);
+               
+               [MethodImplAttribute(MethodImplOptions.InternalCall)]
+               public static extern bool RoOriginateLanguageException(int error, string message, IntPtr languageException);
+               
+               [MethodImplAttribute(MethodImplOptions.InternalCall)]
+               public static extern void RoReportUnhandledError(IRestrictedErrorInfo error);
+               
+               [MethodImplAttribute(MethodImplOptions.InternalCall)]
+               public static extern IRestrictedErrorInfo GetRestrictedErrorInfo();
+       }
+}
\ No newline at end of file
diff --git a/mcs/class/corlib/System.Runtime.InteropServices.WindowsRuntime/WindowsRuntimeMarshal.cs b/mcs/class/corlib/System.Runtime.InteropServices.WindowsRuntime/WindowsRuntimeMarshal.cs
deleted file mode 100644 (file)
index eb324b5..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-//
-// WindowsRuntimeMarshal.cs
-//
-// Author:
-//       Martin Baulig <martin.baulig@xamarin.com>
-//
-// Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)
-//
-// 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.Runtime.CompilerServices;
-
-namespace System.Runtime.InteropServices.WindowsRuntime
-{
-       [MonoTODO]
-       public static class WindowsRuntimeMarshal
-       {
-               public static void AddEventHandler<T> ( Func<T, EventRegistrationToken> addMethod, Action<EventRegistrationToken> removeMethod, T handler)
-               {
-                       throw new NotImplementedException ();
-               }
-
-               public static void FreeHString (IntPtr ptr)
-               {
-                       throw new NotImplementedException ();
-               }
-
-               public static IActivationFactory GetActivationFactory (Type type)
-               {
-                       throw new NotImplementedException ();
-               }
-
-               public static string PtrToStringHString (IntPtr ptr)
-               {
-                       throw new NotImplementedException ();
-               }
-
-               public static void RemoveAllEventHandlers(Action<EventRegistrationToken> removeMethod)
-               {
-                       throw new NotImplementedException ();
-               }
-
-               public static void RemoveEventHandler<T> (Action<EventRegistrationToken> removeMethod, T handler)
-               {
-                       throw new NotImplementedException ();
-               }
-
-               public static IntPtr StringToHString (string s)
-               {
-                       throw new NotImplementedException ();
-               }
-
-               internal static bool ReportUnhandledError (Exception e)
-               {
-                       return false;
-               }
-       }
-}
-
diff --git a/mcs/class/corlib/System.Runtime.InteropServices.WindowsRuntime/WriteOnlyArrayAttribute.cs b/mcs/class/corlib/System.Runtime.InteropServices.WindowsRuntime/WriteOnlyArrayAttribute.cs
deleted file mode 100644 (file)
index bfb3c06..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-//
-// WriteOnlyArrayAttribute.cs
-//
-// Author:
-//       Martin Baulig <martin.baulig@xamarin.com>
-//
-// Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)
-//
-// 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.Runtime.CompilerServices;
-
-namespace System.Runtime.InteropServices.WindowsRuntime
-{
-       [AttributeUsageAttribute(AttributeTargets.Parameter, Inherited = false, AllowMultiple = false)]
-       public sealed class WriteOnlyArrayAttribute : Attribute
-       {
-       }
-}
index d1958f33eb26c47bb90f110544c0a88326d30685..1516216ddc202f9758f32eb7f794620576b18332 100644 (file)
@@ -37,10 +37,11 @@ using System;
 using System.Security;
 using System.Reflection;
 using System.Threading;
+using System.Runtime.InteropServices.ComTypes;
+using System.Text;
 
 using System.Runtime.ConstrainedExecution;
 #if !FULL_AOT_RUNTIME
-using System.Runtime.InteropServices.ComTypes;
 using Mono.Interop;
 #endif
 
@@ -74,8 +75,18 @@ namespace System.Runtime.InteropServices
                        return false;
                }
 
+               [MonoTODO]
+               public static void CleanupUnusedObjectsInCurrentContext ()
+               {
+                       if (Environment.IsRunningOnWindows)
+                               throw new PlatformNotSupportedException ();
+               }
+
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
                public extern static IntPtr AllocCoTaskMem (int cb);
+               
+               [MethodImplAttribute(MethodImplOptions.InternalCall)]
+               internal extern static IntPtr AllocCoTaskMemSize (UIntPtr sizet);
 
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
                [ReliabilityContractAttribute (Consistency.WillNotCorruptState, Cer.MayFail)]
@@ -197,9 +208,11 @@ namespace System.Runtime.InteropServices
                        return CreateAggregatedObject (pOuter, (object)o);
                }
 
-#if !FULL_AOT_RUNTIME
                public static object CreateWrapperOfType (object o, Type t)
                {
+#if FULL_AOT_RUNTIME
+                       throw new PlatformNotSupportedException ();
+#else
                        __ComObject co = o as __ComObject;
                        if (co == null)
                                throw new ArgumentException ("o must derive from __ComObject", "o");
@@ -213,12 +226,12 @@ namespace System.Runtime.InteropServices
                        }
 
                        return ComInteropProxy.GetProxy (co.IUnknown, t).GetTransparentProxy ();
+#endif
                }
 
                public static TWrapper CreateWrapperOfType<T, TWrapper> (T o) {
                        return (TWrapper)CreateWrapperOfType ((object)o, typeof (TWrapper));
                }
-#endif
 
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
                [ComVisible (true)]
@@ -276,6 +289,12 @@ namespace System.Runtime.InteropServices
                        FreeCoTaskMem (s);
                }
 
+               public static void ZeroFreeCoTaskMemUTF8 (IntPtr s)
+               {
+                       ClearAnsi (s);
+                       FreeCoTaskMem (s);
+               }
+               
                public static void ZeroFreeGlobalAllocAnsi (IntPtr s)
                {
                        ClearAnsi (s);
@@ -335,15 +354,16 @@ namespace System.Runtime.InteropServices
                                return GetCCW (o, T);
                }
 #endif
+#endif // !FULL_AOT_RUNTIME
 
                public static IntPtr GetComInterfaceForObject (object o, Type T)
                {
-#if !MOBILE
+#if MOBILE
+                       throw new PlatformNotSupportedException ();
+#else
                        IntPtr pItf = GetComInterfaceForObjectInternal (o, T);
                        AddRef (pItf);
                        return pItf;
-#else
-                       throw new NotImplementedException ();
 #endif
                }
 
@@ -357,6 +377,7 @@ namespace System.Runtime.InteropServices
                        return GetComInterfaceForObject ((object)o, typeof (T));
                }
 
+#if !FULL_AOT_RUNTIME
                [MonoTODO]
                public static IntPtr GetComInterfaceForObjectInContext (object o, Type t)
                {
@@ -395,12 +416,6 @@ namespace System.Runtime.InteropServices
                        throw new NotImplementedException ();
                }
 
-               [MonoTODO]
-               public static int GetExceptionCode()
-               {
-                       throw new NotImplementedException ();
-               }
-
                [MonoTODO]
                [ComVisible (true)]
                public static IntPtr GetExceptionPointers()
@@ -417,26 +432,35 @@ namespace System.Runtime.InteropServices
                }
 #endif // !FULL_AOT_RUNTIME
 
-#if !FULL_AOT_RUNTIME
+               public static int GetExceptionCode ()
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
                public static int GetHRForException (Exception e)
                {
+                       if (e == null) return 0;
+
 #if FEATURE_COMINTEROP
                        var errorInfo = new ManagedErrorInfo(e);
                        SetErrorInfo (0, errorInfo);
+#endif
 
                        return e._HResult;
-#else                  
-                       return -1;
-#endif
                }
 
                [MonoTODO]
                [ReliabilityContract (Consistency.WillNotCorruptState, Cer.Success)]
                public static int GetHRForLastWin32Error()
                {
+#if FULL_AOT_RUNTIME
+                       throw new PlatformNotSupportedException ();
+#else
                        throw new NotImplementedException ();
+#endif
                }
 
+#if !FULL_AOT_RUNTIME
                [MethodImplAttribute (MethodImplOptions.InternalCall)]
                private extern static IntPtr GetIDispatchForObjectInternal (object o);
 
@@ -460,17 +484,6 @@ namespace System.Runtime.InteropServices
                        throw new NotImplementedException ();
                }
 
-               [MethodImplAttribute (MethodImplOptions.InternalCall)]
-               private extern static IntPtr GetIUnknownForObjectInternal (object o);
-
-               public static IntPtr GetIUnknownForObject (object o)
-               {
-                       IntPtr pUnk = GetIUnknownForObjectInternal (o);
-                       // Internal method does not AddRef
-                       AddRef (pUnk);
-                       return pUnk;
-               }
-
                [MonoTODO]
                public static IntPtr GetIUnknownForObjectInContext (object o)
                {
@@ -490,25 +503,48 @@ namespace System.Runtime.InteropServices
                        throw new NotImplementedException ();
                }
 
+               [MethodImplAttribute (MethodImplOptions.InternalCall)]
+               private extern static IntPtr GetIUnknownForObjectInternal (object o);
+
+#endif // !FULL_AOT_RUNTIME
+
+               public static IntPtr GetIUnknownForObject (object o)
+               {
+#if FULL_AOT_RUNTIME
+                       throw new PlatformNotSupportedException ();
+#else
+                       IntPtr pUnk = GetIUnknownForObjectInternal (o);
+                       // Internal method does not AddRef
+                       AddRef (pUnk);
+                       return pUnk;
+#endif
+               }
+
                public static void GetNativeVariantForObject (object obj, IntPtr pDstNativeVariant)
                {
+#if FULL_AOT_RUNTIME
+                       throw new PlatformNotSupportedException ();
+#else
                        Variant vt = new Variant();
                        vt.SetValue(obj);
                        Marshal.StructureToPtr(vt, pDstNativeVariant, false);
+#endif
                }
 
                public static void GetNativeVariantForObject<T> (T obj, IntPtr pDstNativeVariant) {
                        GetNativeVariantForObject ((object)obj, pDstNativeVariant);
                }
 
-#if !MOBILE
+#if !MOBILE && !FULL_AOT_RUNTIME
                [MethodImplAttribute (MethodImplOptions.InternalCall)]
                private static extern object GetObjectForCCW (IntPtr pUnk);
 #endif
 
                public static object GetObjectForIUnknown (IntPtr pUnk)
                {
-#if !MOBILE
+#if MOBILE || FULL_AOT_RUNTIME
+                       throw new PlatformNotSupportedException ();
+#else
                        object obj = GetObjectForCCW (pUnk);
                        // was not a CCW
                        if (obj == null) {
@@ -516,24 +552,34 @@ namespace System.Runtime.InteropServices
                                obj = proxy.GetTransparentProxy ();
                        }
                        return obj;
-#else
-                       throw new NotImplementedException ();
 #endif
                }
 
                public static object GetObjectForNativeVariant (IntPtr pSrcNativeVariant)
                {
+#if FULL_AOT_RUNTIME
+                       throw new PlatformNotSupportedException ();
+#else
                        Variant vt = (Variant)Marshal.PtrToStructure(pSrcNativeVariant, typeof(Variant));
                        return vt.GetValue();
+#endif
                }
 
-               public static T GetObjectForNativeVariant<T> (IntPtr pSrcNativeVariant) {
+               public static T GetObjectForNativeVariant<T> (IntPtr pSrcNativeVariant)
+               {
+#if FULL_AOT_RUNTIME
+                       throw new PlatformNotSupportedException ();
+#else
                        Variant vt = (Variant)Marshal.PtrToStructure(pSrcNativeVariant, typeof(Variant));
                        return (T)vt.GetValue();
+#endif
                }
 
                public static object[] GetObjectsForNativeVariants (IntPtr aSrcNativeVariant, int cVars)
                {
+#if FULL_AOT_RUNTIME
+                       throw new PlatformNotSupportedException ();
+#else
                        if (cVars < 0)
                                throw new ArgumentOutOfRangeException ("cVars", "cVars cannot be a negative number.");
                        object[] objects = new object[cVars];
@@ -541,9 +587,14 @@ namespace System.Runtime.InteropServices
                                objects[i] = GetObjectForNativeVariant ((IntPtr)(aSrcNativeVariant.ToInt64 () +
                                        i * SizeOf (typeof(Variant))));
                        return objects;
+#endif
                }
 
-               public static T[] GetObjectsForNativeVariants<T> (IntPtr aSrcNativeVariant, int cVars) {
+               public static T[] GetObjectsForNativeVariants<T> (IntPtr aSrcNativeVariant, int cVars)
+               {
+#if FULL_AOT_RUNTIME
+                       throw new PlatformNotSupportedException ();
+#else
                        if (cVars < 0)
                                throw new ArgumentOutOfRangeException ("cVars", "cVars cannot be a negative number.");
                        T[] objects = new T[cVars];
@@ -551,14 +602,20 @@ namespace System.Runtime.InteropServices
                                objects[i] = GetObjectForNativeVariant<T> ((IntPtr)(aSrcNativeVariant.ToInt64 () +
                                        i * SizeOf (typeof(Variant))));
                        return objects;
+#endif
                }
 
                [MonoTODO]
                public static int GetStartComSlot (Type t)
                {
+#if FULL_AOT_RUNTIME
+                       throw new PlatformNotSupportedException ();
+#else
                        throw new NotImplementedException ();
+#endif
                }
 
+#if !FULL_AOT_RUNTIME
                [MonoTODO]
                [Obsolete ("This method has been deprecated")]
                public static Thread GetThreadFromFiberCookie (int cookie)
@@ -585,12 +642,6 @@ namespace System.Runtime.InteropServices
                        throw new NotImplementedException ();
                }
 
-               public static Type GetTypeFromCLSID (Guid clsid)
-               {
-                       throw new NotImplementedException ();                   
-               }
-
-#if !FULL_AOT_RUNTIME
                [Obsolete]
                [MonoTODO]
                public static string GetTypeInfoName (UCOMITypeInfo pTI)
@@ -598,11 +649,6 @@ namespace System.Runtime.InteropServices
                        throw new NotImplementedException ();
                }
 
-               public static string GetTypeInfoName (ITypeInfo typeInfo)
-               {
-                       throw new NotImplementedException ();
-               }
-
                [Obsolete]
                [MonoTODO]
                public static Guid GetTypeLibGuid (UCOMITypeLib pTLB)
@@ -654,12 +700,6 @@ namespace System.Runtime.InteropServices
                        throw new NotImplementedException ();
                }
 
-               public static object GetUniqueObjectForIUnknown (IntPtr unknown)
-               {
-                       throw new NotImplementedException ();
-               }
-#endif
-
                [MonoTODO]
                [Obsolete ("This method has been deprecated")]
                public static IntPtr GetUnmanagedThunkForManagedMethodPtr (IntPtr pfnMethodToWrap, IntPtr pbSignature, int cbSignature)
@@ -667,16 +707,6 @@ namespace System.Runtime.InteropServices
                        throw new NotImplementedException ();
                }
 
-#if !MOBILE
-               [MethodImplAttribute (MethodImplOptions.InternalCall)]
-               public extern static bool IsComObject (object o);
-#else
-               public static bool IsComObject (object o)
-               {
-                       throw new NotImplementedException ();
-               }
-#endif         
-
                [MonoTODO]
                public static bool IsTypeVisibleFromCom (Type t)
                {
@@ -688,6 +718,31 @@ namespace System.Runtime.InteropServices
                {
                        throw new NotImplementedException ();
                }
+#endif // !FULL_AOT_RUNTIME
+
+               public static Type GetTypeFromCLSID (Guid clsid)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public static string GetTypeInfoName (ITypeInfo typeInfo)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public static object GetUniqueObjectForIUnknown (IntPtr unknown)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+#if !MOBILE
+               [MethodImplAttribute (MethodImplOptions.InternalCall)]
+               public extern static bool IsComObject (object o);
+#else
+               public static bool IsComObject (object o)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
 #endif
 
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
@@ -713,6 +768,16 @@ namespace System.Runtime.InteropServices
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
                public extern static string PtrToStringAnsi (IntPtr ptr, int len);
 
+               public static string PtrToStringUTF8 (IntPtr ptr)
+               {
+                       return PtrToStringAnsi (ptr);
+               }
+               
+               public static string PtrToStringUTF8 (IntPtr ptr, int byteLen)
+               {
+                       return PtrToStringAnsi (ptr, byteLen);
+               }
+               
                public static string PtrToStringAuto (IntPtr ptr)
                {
                        return SystemDefaultCharSize == 2
@@ -731,15 +796,8 @@ namespace System.Runtime.InteropServices
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
                public extern static string PtrToStringUni (IntPtr ptr, int len);
 
-#if !MOBILE
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
                public extern static string PtrToStringBSTR (IntPtr ptr);
-#else
-               public static string PtrToStringBSTR (IntPtr ptr)
-               {
-                       throw new NotImplementedException ();
-               }
-#endif
                
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
                [ComVisible (true)]
@@ -950,16 +1008,22 @@ namespace System.Runtime.InteropServices
 #if !FULL_AOT_RUNTIME
                [MethodImplAttribute (MethodImplOptions.InternalCall)]
                private extern static int ReleaseComObjectInternal (object co);
+#endif
 
                public static int ReleaseComObject (object o)
                {
+#if FULL_AOT_RUNTIME
+                       throw new PlatformNotSupportedException ();
+#else
                        if (o == null)
                                throw new ArgumentException ("Value cannot be null.", "o");
                        if (!IsComObject (o))
                                throw new ArgumentException ("Value must be a Com object.", "o");
                        return ReleaseComObjectInternal (o);
+#endif
                }
 
+#if !FULL_AOT_RUNTIME
                [Obsolete]
                [MonoTODO]
                public static void ReleaseThreadCache()
@@ -1009,23 +1073,9 @@ namespace System.Runtime.InteropServices
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
                public extern static IntPtr StringToBSTR (string s);
 
-               //
-               // I believe this is wrong, because in Mono and in P/Invoke
-               // we treat "Ansi" conversions as UTF-8 conversions, while
-               // this one does not do this
-               //
                public static IntPtr StringToCoTaskMemAnsi (string s)
                {
-                       int length = s.Length + 1;
-                       IntPtr ctm = AllocCoTaskMem (length);
-
-                       byte[] asBytes = new byte[length];
-                       for (int i = 0; i < s.Length; i++)
-                               asBytes[i] = (byte)s[i];
-                       asBytes[s.Length] = 0;
-
-                       copy_to_unmanaged (asBytes, 0, ctm, length);
-                       return ctm;
+                       return StringToAllocatedMemoryUTF8 (s);
                }
 
                public static IntPtr StringToCoTaskMemAuto (string s)
@@ -1050,6 +1100,29 @@ namespace System.Runtime.InteropServices
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
                public extern static IntPtr StringToHGlobalAnsi (string s);
 
+               unsafe public static IntPtr StringToAllocatedMemoryUTF8(String s)
+               {
+                       const int MAX_UTF8_CHAR_SIZE = 3;
+                       if (s == null)
+                               return IntPtr.Zero;
+
+                       int nb = (s.Length + 1) * MAX_UTF8_CHAR_SIZE;
+
+                       // Overflow checking
+                       if (nb < s.Length)
+                               throw new ArgumentOutOfRangeException("s");
+                       
+                       IntPtr pMem = AllocCoTaskMemSize(new UIntPtr((uint)nb +1));
+                       
+                       if (pMem == IntPtr.Zero)
+                               throw new OutOfMemoryException();
+
+                       byte* pbMem = (byte*)pMem;
+                       int nbWritten = s.GetBytesFromEncoding(pbMem, nb, Encoding.UTF8);
+                       pbMem[nbWritten] = 0;
+                       return pMem;
+               }
+               
                public static IntPtr StringToHGlobalAuto (string s)
                {
                        return SystemDefaultCharSize == 2
@@ -1382,10 +1455,10 @@ namespace System.Runtime.InteropServices
                        const int COR_E_TARGET = unchecked ((int)0x80131603L);
                        const int COR_E_TARGETINVOCATION = unchecked ((int)0x80131604L);
                        const int COR_E_TARGETPARAMCOUNT = unchecked ((int)0x8002000EL);
-                       const int COR_E_THREADABORTED = unchecked ((int)0x80131530L);
+                       //const int COR_E_THREADABORTED = unchecked ((int)0x80131530L);
                        const int COR_E_THREADINTERRUPTED = unchecked ((int)0x80131519L);
                        const int COR_E_THREADSTATE = unchecked ((int)0x80131520L);
-                       const int COR_E_THREADSTOP = unchecked ((int)0x80131521L);
+                       //const int COR_E_THREADSTOP = unchecked ((int)0x80131521L);
                        const int COR_E_TYPEINITIALIZATION = unchecked ((int)0x80131534L);
                        const int COR_E_VERIFICATION = unchecked ((int)0x8013150DL);
                        //const int COR_E_WEAKREFERENCE = unchecked ((int)?);
@@ -1630,13 +1703,11 @@ namespace System.Runtime.InteropServices
 #endif
                }
 
-#if !FULL_AOT_RUNTIME
                public static int FinalReleaseComObject (object o)
                {
                        while (ReleaseComObject (o) != 0);
                        return 0;
                }
-#endif
 
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
                private static extern Delegate GetDelegateForFunctionPointerInternal (IntPtr ptr, Type t);
@@ -1680,5 +1751,31 @@ namespace System.Runtime.InteropServices
                internal static void SetLastWin32Error (int error)
                {
                }
+
+               // Copied from referencesource/mscorlib/system/runtime/interopservices/marshal.cs
+               //====================================================================
+               // return the raw IUnknown* for a COM Object not related to current 
+               // context
+               // Does not call AddRef
+               //====================================================================
+               [MethodImplAttribute(MethodImplOptions.InternalCall)]
+               internal static extern IntPtr /* IUnknown* */ GetRawIUnknownForComObjectNoAddRef(Object o);
+               
+               // Copied from referencesource/mscorlib/system/runtime/interopservices/marshal.cs
+               //====================================================================
+               // Converts the CLR exception to an HRESULT. This function also sets
+               // up an IErrorInfo for the exception.
+               // This function is only used in WinRT and converts ObjectDisposedException
+               // to RO_E_CLOSED
+               //====================================================================
+               [MethodImplAttribute(MethodImplOptions.InternalCall)]
+               internal static extern int GetHRForException_WinRT(Exception e);
+
+               // Copied from referencesource/mscorlib/system/runtime/interopservices/marshal.cs
+               //========================================================================
+               // Create activation factory and wraps it with a unique RCW
+               //========================================================================
+               [MethodImplAttribute(MethodImplOptions.InternalCall)]
+               internal static extern object GetNativeActivationFactory(Type type);
        }
 }
index b5b59a1ae81ffb3f37822fd47ba5619f08d7469a..a01d526ff2588d5e1d32eea908836061f47b91c2 100644 (file)
@@ -122,7 +122,7 @@ namespace System.Runtime.InteropServices
                                        old_state = _state;
 
                                        if ((old_state & (int) State.Closed) != 0)
-                                               throw new ObjectDisposedException ("handle");
+                                               throw new ObjectDisposedException (null, "Safe handle has been closed");
 
                                        new_state = old_state + RefCount_One;
                                } while (Interlocked.CompareExchange (ref _state, new_state, old_state) != old_state);
@@ -198,7 +198,7 @@ namespace System.Runtime.InteropServices
                                         * hitting zero though -- that can happen if SetHandleAsInvalid is
                                         * used). */
                                        if ((old_state & RefCount_Mask) == 0)
-                                               throw new ObjectDisposedException ("handle");
+                                               throw new ObjectDisposedException (null, "Safe handle has been closed");
 
                                        if ((old_state & RefCount_Mask) != RefCount_One)
                                                perform_release = false;
index a30e29ce22d696bd8a3b810212421137de6da3de..c8b640e10b5e5a8f046eb8d07de6358ad3c695d2 100644 (file)
@@ -87,7 +87,7 @@ namespace System.Runtime.InteropServices
 
                string Location { get; }
 
-#if !NET_2_1
+#if !MOBILE
                Evidence Evidence { get; }
 #endif
 
@@ -129,7 +129,7 @@ namespace System.Runtime.InteropServices
 
                AssemblyName[] GetReferencedAssemblies ();
 
-#if !NET_2_1
+#if !MOBILE
                bool GlobalAssemblyCache { get; }
 #endif
 
index 1839144bcbcbec96b07322b7330268ff29a1a466..3297ac2342a84dd961e621ae968f04260d124739 100644 (file)
@@ -100,8 +100,10 @@ namespace System.Runtime.Loader
                {               
                }
 
+#pragma warning disable 67
                public event Func<AssemblyLoadContext, System.Reflection.AssemblyName, System.Reflection.Assembly> Resolving;
                public event Action<AssemblyLoadContext> Unloading;
+#pragma warning restore
        }
 }
 
index 71f1269b285b728341cc1338cb8efbd054abfa67..57094710db84265a20122e2a1ca2e628833ce974 100644 (file)
@@ -213,7 +213,7 @@ namespace System.Runtime.Remoting.Activation
 
                        if (type.IsContextful)
                                return RemotingServices.CreateClientProxyForContextBound (type, null);
-#if !NET_2_1
+#if !MOBILE
                        if (type.IsCOMObject) {
                                return RemotingServices.CreateClientProxyForComInterop (type);
                        }
index 0b267eed10646f58dc1e530c79fba21f2bb65464..b0eef4e4c0e4a72bd38995c925c2c1baf9038df2 100644 (file)
@@ -437,7 +437,9 @@ namespace System.Runtime.Remoting.Messaging {
        internal class CADMethodReturnMessage : CADMessageBase {
                object _returnValue;
                CADArgHolder _exception = null;
+#pragma warning disable 414
                Type [] _sig;
+#pragma warning restore
 
                static internal CADMethodReturnMessage Create (IMessage callMsg) {
                        IMethodReturnMessage msg = callMsg as IMethodReturnMessage;
index 33fef7a0a8d2c26525bdb5146ef1093305ae47d7..eb45ced8220104fedb88ee88eb5f57c6af55be7f 100644 (file)
@@ -106,7 +106,12 @@ namespace System.Runtime.Remoting
                {
                        lock (channelTemplates) {
                                if (!defaultConfigRead) {
-                                       ReadConfigFile (Environment.GetMachineConfigPath ());
+                                       var bundled = Environment.GetBundledMachineConfig ();
+                                       if (bundled != null)
+                                               ReadConfigString (bundled);
+
+                                       if (File.Exists (Environment.GetMachineConfigPath ()))
+                                               ReadConfigFile (Environment.GetMachineConfigPath ());
                                        defaultConfigRead = true;
                                }
 
@@ -121,6 +126,22 @@ namespace System.Runtime.Remoting
                        Configure (filename, false);
                }
 
+               private static void ReadConfigString (string filename)
+               {
+                       try
+                       {
+                               SmallXmlParser parser = new SmallXmlParser ();
+                               using (TextReader rreader = new StringReader (filename)) {
+                                       ConfigHandler handler = new ConfigHandler (false);
+                                       parser.Parse (rreader, handler);
+                               }
+                       }
+                       catch (Exception ex)
+                       {
+                               throw new RemotingException ("Configuration string could not be loaded: " + ex.Message, ex);
+                       }
+               }
+
                private static void ReadConfigFile (string filename)
                {
                        try
index 1b35fe1ee90b75337e05ce72f68a2e9017a9bc7f..815c1ba7e73727e93d0d58ca15d81976c08fe14d 100644 (file)
@@ -581,7 +581,7 @@ namespace System.Runtime.Remoting
                        RemotingProxy proxy = new RemotingProxy (type, ChannelServices.CrossContextUrl, activationAttributes);
                        return proxy.GetTransparentProxy();
                }
-#if !NET_2_1
+#if !MOBILE
                internal static object CreateClientProxyForComInterop (Type type)
                {
                        Mono.Interop.ComInteropProxy proxy = Mono.Interop.ComInteropProxy.CreateProxy (type);
@@ -808,45 +808,15 @@ namespace System.Runtime.Remoting
                [SecurityPermission (SecurityAction.Assert, SerializationFormatter = true)] // FIXME: to be reviewed
                internal static byte[] SerializeExceptionData (Exception ex)
                {
+                       byte[] result = null;
                        try {
-                               int retry = 4;
-                               
-                               do {
-                                       try {
-                                               MemoryStream ms = new MemoryStream ();
-                                               _serializationFormatter.Serialize (ms, ex);
-                                               return ms.ToArray ();
-                                       }
-                                       catch (Exception e) {
-                                               if (e is ThreadAbortException) {
-#if MONO_FEATURE_THREAD_ABORT
-                                                       Thread.ResetAbort ();
-#endif
-                                                       retry = 5;
-                                                       ex = e;
-                                               }
-                                               else if (retry == 2) {
-                                                       ex = new Exception ();
-                                                       ex.SetMessage (e.Message);
-                                                       ex.SetStackTrace (e.StackTrace);
-                                               }
-                                               else
-                                                       ex = e;
-                                       }
-                                       retry--;
-                               }
-                               while (retry > 0);
-                               
-                               return null;
-                       }
-                       catch (Exception tex)
-                       {
-                               byte[] data = SerializeExceptionData (tex);
-#if MONO_FEATURE_THREAD_ABORT
-                               Thread.ResetAbort ();
-#endif
-                               return data;
+                               /* empty - we're only interested in the protected block */
+                       } finally {
+                               MemoryStream ms = new MemoryStream ();
+                               _serializationFormatter.Serialize (ms, ex);
+                               result = ms.ToArray ();
                        }
+                       return result;
                }
                
                internal static object GetDomainProxy(AppDomain domain) 
index 2bb0fd9f6c344df832f76bb55180ca188e775921..7c9f393da25234ef2bc178b23a75810937a30436 100644 (file)
@@ -35,6 +35,7 @@ namespace System.Runtime
                Batch = 0,
                Interactive = 1,
                LowLatency = 2,
-               SustainedLowLatency = 3
+               SustainedLowLatency = 3,
+               NoGCRegion = 4
        }
 }
index 8cfd398094e6fea6a08e2edd79805da54b96a29b..ac20b894ef3ea3928492ef0c4923b6ea1898c7b2 100644 (file)
@@ -127,6 +127,11 @@ namespace System.Security.AccessControl
                {
                        SetAuditRule((AuditRule)rule);
                }
+
+               internal void Persist (SafeHandle handle)
+               {
+                       PersistModifications (handle);
+               }
        }
 }
 
index 7e83a6cacf0a297bccf6973c93a0762b405fe84f..db43c8b549001e029973a5926fd63929792a1cd4 100644 (file)
@@ -38,7 +38,9 @@ namespace System.Security.AccessControl
        public abstract class NativeObjectSecurity : CommonObjectSecurity
        {
                ExceptionFromErrorCode exception_from_error_code;
+#if !MOBILE
                ResourceType resource_type;
+#endif
                
                protected internal delegate Exception ExceptionFromErrorCode (int errorCode,
                                                                              string name, SafeHandle handle,
@@ -47,7 +49,9 @@ namespace System.Security.AccessControl
                internal NativeObjectSecurity (CommonSecurityDescriptor securityDescriptor, ResourceType resourceType)
                        : base (securityDescriptor)
                {
+#if !MOBILE                    
                        resource_type = resourceType;
+#endif
                }
 
                protected NativeObjectSecurity (bool isContainer,
@@ -63,7 +67,9 @@ namespace System.Security.AccessControl
                        : base (isContainer)
                {
                        exception_from_error_code = exceptionFromErrorCode;
+#if !MOBILE                    
                        resource_type = resourceType;
+#endif
                }
                
                protected NativeObjectSecurity (bool isContainer,
@@ -129,7 +135,7 @@ namespace System.Security.AccessControl
                {
                        Persist (name, includeSections, null);
                }
-               
+       
                internal void PersistModifications (SafeHandle handle)
                {
                        WriteLock();
@@ -411,12 +417,14 @@ namespace System.Security.AccessControl
                [return: MarshalAs (UnmanagedType.Bool)]
                static extern bool IsValidSecurityDescriptor (IntPtr descriptor);
                
+               /*
                struct SecurityDescriptor
                {
                        public byte Revision, Size;
                        public ushort ControlFlags;
                        public IntPtr Owner, Group, Sacl, Dacl;
                }
+               */
                #endregion
 #endif
        }
index 135b270e508bb123f5f1226ee18710b2942347ca..46398d8561d24d2eac78765831a8b4189a1322df 100644 (file)
@@ -48,7 +48,7 @@ namespace System.Security.Cryptography.X509Certificates {
        // and/or Authenticode certs. However this class works with older
        // X509v1 certificates and non-authenticode (code signing) certs.
        [Serializable]
-#if NET_2_1
+#if MOBILE
        public partial class X509Certificate {
 #else
        public partial class X509Certificate : IDeserializationCallback, ISerializable {
index 42fca5acade25e2980a400e91e84ff259bcd6fd9..3467dc8038eb325fe643405daef226e1695b2cbb 100644 (file)
@@ -37,7 +37,7 @@ namespace System.Security.Cryptography.X509Certificates {
        enum X509ContentType {
                Unknown,
                Cert,
-               // not supported by Silverlight 2.0 (NET_2_1)
+               // not supported by Silverlight 2.0 (MOBILE)
                SerializedCert,
                Pfx,
                SerializedStore,
index c12fa6229cf4f8ffe84d07dc5e6d309aea9a676f..8bdd3db4daa29b51bf198b0379ff2b5df3b68e8d 100644 (file)
@@ -32,7 +32,7 @@ using System;
 using System.Text;
 using System.Threading;
 using System.Runtime.InteropServices;
-#if !NET_2_1
+#if !MOBILE
 using System.Security.Permissions;
 #endif
 using MX = Mono.Security.X509;
@@ -49,7 +49,7 @@ namespace System.Security.Cryptography.X509Certificates
                                Interlocked.CompareExchange (ref nativeHelper, helper, null);
                }
 
-#if !NET_2_1
+#if !MOBILE
                // typedef struct _CERT_CONTEXT {
                //      DWORD                   dwCertEncodingType;
                //      BYTE                    *pbCertEncoded;
index ce375c2aeacecde9a7cf1cb2878da7bb7a067072..9d4c28641500136922a4455dfc6cb1979c7cf0a7 100644 (file)
@@ -35,7 +35,7 @@ namespace System.Security.Cryptography.X509Certificates {
        [ComVisible (true)]
        public enum X509KeyStorageFlags {
                DefaultKeySet = 0,
-               // not supported by Silverlight 2.0 (NET_2_1)
+               // not supported by Silverlight 2.0 (MOBILE)
                UserKeySet = 1,
                MachineKeySet = 2,
                Exportable = 4,
diff --git a/mcs/class/corlib/System.Security.Cryptography/CryptoConfig.common.cs b/mcs/class/corlib/System.Security.Cryptography/CryptoConfig.common.cs
new file mode 100644 (file)
index 0000000..f4a9d9c
--- /dev/null
@@ -0,0 +1,134 @@
+//
+// CryptoConfig.cs: Handles cryptographic implementations and OIDs mappings.
+//
+// Author:
+//     Sebastien Pouliot (sebastien@ximian.com)
+//     Tim Coleman (tim@timcoleman.com)
+//
+// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
+// Copyright (C) Tim Coleman, 2004
+// Copyright (C) 2004-2007, 2009 Novell, Inc (http://www.novell.com)
+//
+// 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.
+//
+
+namespace System.Security.Cryptography {
+
+       public partial class CryptoConfig {
+
+               public static byte[] EncodeOID (string str)
+               {
+                       if (str == null)
+                               throw new ArgumentNullException ("str");
+                       char[] delim = { '.' };
+                       string[] parts = str.Split (delim);
+                       // according to X.208 n is always at least 2
+                       if (parts.Length < 2) {
+                               throw new CryptographicUnexpectedOperationException (
+                                       Locale.GetText ("OID must have at least two parts"));
+                       }
+
+                       // we're sure that the encoded OID is shorter than its string representation
+                       byte[] oid = new byte [str.Length];
+                       // now encoding value
+                       try {
+                               byte part0 = Convert.ToByte (parts [0]);
+                               // OID[0] > 2 is invalid but "supported" in MS BCL
+                               // uncomment next line to trap this error
+                               // if (part0 > 2) throw new CryptographicUnexpectedOperationException ();
+                               byte part1 = Convert.ToByte (parts [1]);
+                               // OID[1] >= 40 is illegal for OID[0] < 2 because of the % 40
+                               // however the syntax is "supported" in MS BCL
+                               // uncomment next 2 lines to trap this error
+                               //if ((part0 < 2) && (part1 >= 40))
+                               //      throw new CryptographicUnexpectedOperationException ();
+                               oid[2] = Convert.ToByte (part0 * 40 + part1);
+                       }
+                       catch {
+                               throw new CryptographicUnexpectedOperationException (
+                                       Locale.GetText ("Invalid OID"));
+                       }
+                       int j = 3;
+                       for (int i = 2; i < parts.Length; i++) {
+                               long x = Convert.ToInt64 (parts [i]);
+                               if (x > 0x7F) {
+                                       byte[] num = EncodeLongNumber (x);
+                                       Buffer.BlockCopy (num, 0, oid, j, num.Length);
+                                       j += num.Length;
+                               }
+                               else
+                                       oid[j++] = Convert.ToByte (x);
+                       }
+
+                       int k = 2;
+                       // copy the exact number of byte required
+                       byte[] oid2 = new byte [j];
+                       oid2[0] = 0x06; // always - this tag means OID
+                       // Length (of value)
+                       if (j > 0x7F) {
+                               // for compatibility with MS BCL
+                               throw new CryptographicUnexpectedOperationException (
+                                       Locale.GetText ("OID > 127 bytes"));
+                               // comment exception and uncomment next 3 lines to remove restriction
+                               //byte[] num = EncodeLongNumber (j);
+                               //Buffer.BlockCopy (num, 0, oid, j, num.Length);
+                               //k = num.Length + 1;
+                       }
+                       else
+                               oid2 [1] = Convert.ToByte (j - 2); 
+
+                       Buffer.BlockCopy (oid, k, oid2, k, j - k);
+                       return oid2;
+               }
+
+               // encode (7bits array) number greater than 127
+               private static byte[] EncodeLongNumber (long x)
+               {
+                       // for MS BCL compatibility
+                       // comment next two lines to remove restriction
+                       if ((x > Int32.MaxValue) || (x < Int32.MinValue))
+                               throw new OverflowException (Locale.GetText ("Part of OID doesn't fit in Int32"));
+
+                       long y = x;
+                       // number of bytes required to encode this number
+                       int n = 1;
+                       while (y > 0x7F) {
+                               y = y >> 7;
+                               n++;
+                       }
+                       byte[] num = new byte [n];
+                       // encode all bytes 
+                       for (int i = 0; i < n; i++) {
+                               y = x >> (7 * i);
+                               y = y & 0x7F;
+                               if (i != 0)
+                                       y += 0x80;
+                               num[n-i-1] = Convert.ToByte (y);
+                       }
+                       return num;
+               }
+
+               [MonoLimitation ("nothing is FIPS certified so it never make sense to restrict to this (empty) subset")]
+               public static bool AllowOnlyFipsAlgorithms {
+                       get { return false; }
+               }
+       }
+}
+
index 369455581dac5ea9c2f0c06cf4d1582d643f6b25..4f20771c40a57681fa235dfebf59e9bc541910aa 100644 (file)
@@ -73,7 +73,10 @@ public partial class CryptoConfig {
        static Type defaultMAC3DES = typeof (MACTripleDES);
        // LAMESPEC: undocumented classes (also undocumented in CryptoConfig ;-)
        static Type defaultDSASigDesc = typeof (DSASignatureDescription);
-       static Type defaultRSASigDesc = typeof (RSAPKCS1SHA1SignatureDescription);
+       static Type defaultRSAPKCS1SHA1SigDesc = typeof (RSAPKCS1SHA1SignatureDescription);
+       static Type defaultRSAPKCS1SHA256SigDesc = typeof (RSAPKCS1SHA256SignatureDescription);
+       static Type defaultRSAPKCS1SHA384SigDesc = typeof (RSAPKCS1SHA384SignatureDescription);
+       static Type defaultRSAPKCS1SHA512SigDesc = typeof (RSAPKCS1SHA512SignatureDescription);
        static Type defaultRIPEMD160 = typeof (RIPEMD160Managed);
        static Type defaultHMACMD5 = typeof (HMACMD5);
        static Type defaultHMACRIPEMD160 = typeof (HMACRIPEMD160);
@@ -185,6 +188,9 @@ public partial class CryptoConfig {
        // LAMESPEC: undocumented URLs in CryptoConfig
        private const string urlDSASHA1 = urlXmlDsig + "dsa-sha1";                      // no space
        private const string urlRSASHA1 = urlXmlDsig + "rsa-sha1";                      // no space
+       private const string urlRSASHA256 = "http://www.w3.org/2001/04/xmldsig-more#rsa-sha256";                        // no space
+       private const string urlRSASHA384 = "http://www.w3.org/2001/04/xmldsig-more#rsa-sha384";                        // no space
+       private const string urlRSASHA512 = "http://www.w3.org/2001/04/xmldsig-more#rsa-sha512";                        // no space
        private const string urlSHA1 = urlXmlDsig + "sha1";                             // no space
        private const string urlC14N = "http://www.w3.org/TR/2001/REC-xml-c14n-20010315"; 
        private const string urlC14NWithComments = "http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments";
@@ -196,6 +202,7 @@ public partial class CryptoConfig {
        private const string urlExcC14NWithComments = "http://www.w3.org/2001/10/xml-exc-c14n#WithComments";
        private const string urlExcC14N = "http://www.w3.org/2001/10/xml-exc-c14n#";
        private const string urlSHA256 = "http://www.w3.org/2001/04/xmlenc#sha256";
+       private const string urlSHA384 = "http://www.w3.org/2001/04/xmldsig-more#sha384";
        private const string urlSHA512 = "http://www.w3.org/2001/04/xmlenc#sha512";
        private const string urlHMACSHA256 = "http://www.w3.org/2001/04/xmldsig-more#hmac-sha256";
        private const string urlHMACSHA384 = "http://www.w3.org/2001/04/xmldsig-more#hmac-sha384";
@@ -360,7 +367,10 @@ public partial class CryptoConfig {
                // add some of the XMLDSIG urls into machine.config (and they make a LOT
                // of sense for implementing XMLDSIG in System.Security.Cryptography.Xml)
                algorithms.Add (urlDSASHA1, defaultDSASigDesc); 
-               algorithms.Add (urlRSASHA1, defaultRSASigDesc);
+               algorithms.Add (urlRSASHA1, defaultRSAPKCS1SHA1SigDesc);
+               algorithms.Add (urlRSASHA256, defaultRSAPKCS1SHA256SigDesc);
+               algorithms.Add (urlRSASHA384, defaultRSAPKCS1SHA384SigDesc);
+               algorithms.Add (urlRSASHA512, defaultRSAPKCS1SHA512SigDesc);
                algorithms.Add (urlSHA1, defaultSHA1);
                unresolved_algorithms.Add (urlC14N, defaultC14N);
                unresolved_algorithms.Add (urlC14NWithComments, defaultC14NWithComments);
@@ -372,7 +382,7 @@ public partial class CryptoConfig {
                unresolved_algorithms.Add (urlExcC14NWithComments, defaultExcC14NWithComments);
                unresolved_algorithms.Add (urlXmlDecryption, defaultXmlDecryption);
                algorithms.Add (urlSHA256, defaultSHA256);
-               // xmlenc does not include a definition for SHA384
+               algorithms.Add (urlSHA384, defaultSHA384);
                algorithms.Add (urlSHA512, defaultSHA512);
                algorithms.Add (urlHMACSHA256, defaultHMACSHA256);
                algorithms.Add (urlHMACSHA384, defaultHMACSHA384);
@@ -406,6 +416,15 @@ public partial class CryptoConfig {
                unresolved_algorithms.Add (nameECDsa_2, defaultECDsa);
                unresolved_algorithms.Add (nameECDsa_3, defaultECDsa);
 
+#if MONODROID
+               algorithms.Add (nameSHA1Cng, defaultSHA1);
+               algorithms.Add (nameSHA256Cng, defaultSHA256);
+               algorithms.Add (nameSHA256Provider, defaultSHA256);
+               algorithms.Add (nameSHA384Cng, defaultSHA384);
+               algorithms.Add (nameSHA384Provider, defaultSHA384);
+               algorithms.Add (nameSHA512Cng, defaultSHA512);
+               algorithms.Add (nameSHA512Provider, defaultSHA512);
+#else
                unresolved_algorithms.Add (nameSHA1Cng, defaultSHA1Cng);
                unresolved_algorithms.Add (nameSHA256Cng, defaultSHA256Cng);
                unresolved_algorithms.Add (nameSHA256Provider, defaultSHA256Provider);
@@ -413,6 +432,7 @@ public partial class CryptoConfig {
                unresolved_algorithms.Add (nameSHA384Provider, defaultSHA384Provider);
                unresolved_algorithms.Add (nameSHA512Cng, defaultSHA512Cng);
                unresolved_algorithms.Add (nameSHA512Provider, defaultSHA512Provider);
+#endif
                Dictionary<string,string> oid = new Dictionary<string, string> (StringComparer.OrdinalIgnoreCase);
 
                // comments here are to match with MS implementation (but not with doc)
@@ -430,14 +450,20 @@ public partial class CryptoConfig {
                oid.Add (nameSHA256, oidSHA256);
                oid.Add (nameSHA256a, oidSHA256);
                oid.Add (nameSHA256c, oidSHA256);
+               oid.Add (nameSHA256Cng, oidSHA256);
+               oid.Add (nameSHA256Provider, oidSHA256);
 
                oid.Add (nameSHA384, oidSHA384);
                oid.Add (nameSHA384a, oidSHA384);
                oid.Add (nameSHA384c, oidSHA384);
+               oid.Add (nameSHA384Cng, oidSHA384);
+               oid.Add (nameSHA384Provider, oidSHA384);
 
                oid.Add (nameSHA512, oidSHA512);
                oid.Add (nameSHA512a, oidSHA512);
                oid.Add (nameSHA512c, oidSHA512);
+               oid.Add (nameSHA512Cng, oidSHA512);
+               oid.Add (nameSHA512Provider, oidSHA512);
 
                oid.Add (nameRIPEMD160, oidRIPEMD160);
                oid.Add (nameRIPEMD160a, oidRIPEMD160);
index 9282679690814c32a72134538a7fba718d95e254..9ae2a61b75ad539b714e6c40a1042d8c1f02c56b 100755 (executable)
@@ -44,6 +44,16 @@ namespace System.Security.Cryptography {
        [ComVisible (true)]
        public partial class CryptoConfig {
 
+               public static void AddAlgorithm (Type algorithm, params string[] names)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public static void AddOID (string oid, params string[] names)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
                // try to avoid hitting the CreateFromName overloads to help the linker
 
                public static object CreateFromName (string name)
@@ -133,9 +143,19 @@ namespace System.Security.Cryptography {
                        case "system.security.cryptography.rsapkcs1sha1signaturedescription":
                        case "http://www.w3.org/2000/09/xmldsig#rsa-sha1":
                                return new RSAPKCS1SHA1SignatureDescription ();
+                       case "system.security.cryptography.rsapkcs1sha256signaturedescription":
+                       case "http://www.w3.org/2001/04/xmldsig-more#rsa-sha256":
+                               return new RSAPKCS1SHA256SignatureDescription ();
+                       case "system.security.cryptography.rsapkcs1sha384signaturedescription":
+                       case "http://www.w3.org/2001/04/xmldsig-more#rsa-sha384":
+                               return new RSAPKCS1SHA384SignatureDescription ();
+                       case "system.security.cryptography.rsapkcs1sha512signaturedescription":
+                       case "http://www.w3.org/2001/04/xmldsig-more#rsa-sha512":
+                               return new RSAPKCS1SHA512SignatureDescription ();
                        case "system.security.cryptography.hashalgorithm":
                        case "system.security.cryptography.sha1":
                        case "system.security.cryptography.sha1cryptoserviceprovider":
+                       case "system.security.cryptography.sha1cng":
                        case "sha1":
                        case "sha":
                        case "http://www.w3.org/2000/09/xmldsig#sha1":
@@ -144,17 +164,24 @@ namespace System.Security.Cryptography {
                                return new SHA1Managed ();
                        case "system.security.cryptography.sha256managed":
                        case "system.security.cryptography.sha256":
+                       case "system.security.cryptography.sha256cryptoserviceprovider":
+                       case "system.security.cryptography.sha256cng":
                        case "sha256":
                        case "sha-256":
                        case "http://www.w3.org/2001/04/xmlenc#sha256":
                                return new SHA256Managed ();
                        case "system.security.cryptography.sha384managed":
                        case "system.security.cryptography.sha384":
+                       case "system.security.cryptography.sha384cryptoserviceprovider":
+                       case "system.security.cryptography.sha384cng":
                        case "sha384":
                        case "sha-384":
+                       case "http://www.w3.org/2001/04/xmldsig-more#sha384":
                                return new SHA384Managed ();
                        case "system.security.cryptography.sha512managed":
                        case "system.security.cryptography.sha512":
+                       case "system.security.cryptography.sha512cryptoserviceprovider":
+                       case "system.security.cryptography.sha512cng":
                        case "sha512":
                        case "sha-512":
                        case "http://www.w3.org/2001/04/xmlenc#sha512":
@@ -201,6 +228,7 @@ namespace System.Security.Cryptography {
 
                        switch (name.ToLowerInvariant ()) {
                        case "system.security.cryptography.sha1cryptoserviceprovider":
+                       case "system.security.cryptography.sha1cng":
                        case "system.security.cryptography.sha1managed":
                        case "system.security.cryptography.sha1":
                        case "sha1":
@@ -209,14 +237,20 @@ namespace System.Security.Cryptography {
                        case "system.security.cryptography.md5":
                        case "md5":
                                return "1.2.840.113549.2.5";
+                       case "system.security.cryptography.sha256cryptoserviceprovider":
+                       case "system.security.cryptography.sha256cng":
                        case "system.security.cryptography.sha256managed":
                        case "system.security.cryptography.sha256":
                        case "sha256":
                                return "2.16.840.1.101.3.4.2.1";
+                       case "system.security.cryptography.sha384cryptoserviceprovider":
+                       case "system.security.cryptography.sha384cng":
                        case "system.security.cryptography.sha384managed":
                        case "system.security.cryptography.sha384":
                        case "sha384":
                                return "2.16.840.1.101.3.4.2.2";
+                       case "system.security.cryptography.sha512cryptoserviceprovider":
+                       case "system.security.cryptography.sha512cng":
                        case "system.security.cryptography.sha512managed":
                        case "system.security.cryptography.sha512":
                        case "sha512":
diff --git a/mcs/class/corlib/System.Security.Cryptography/CryptoConfig_2_1.cs b/mcs/class/corlib/System.Security.Cryptography/CryptoConfig_2_1.cs
deleted file mode 100644 (file)
index f4a9d9c..0000000
+++ /dev/null
@@ -1,134 +0,0 @@
-//
-// CryptoConfig.cs: Handles cryptographic implementations and OIDs mappings.
-//
-// Author:
-//     Sebastien Pouliot (sebastien@ximian.com)
-//     Tim Coleman (tim@timcoleman.com)
-//
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-// Copyright (C) Tim Coleman, 2004
-// Copyright (C) 2004-2007, 2009 Novell, Inc (http://www.novell.com)
-//
-// 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.
-//
-
-namespace System.Security.Cryptography {
-
-       public partial class CryptoConfig {
-
-               public static byte[] EncodeOID (string str)
-               {
-                       if (str == null)
-                               throw new ArgumentNullException ("str");
-                       char[] delim = { '.' };
-                       string[] parts = str.Split (delim);
-                       // according to X.208 n is always at least 2
-                       if (parts.Length < 2) {
-                               throw new CryptographicUnexpectedOperationException (
-                                       Locale.GetText ("OID must have at least two parts"));
-                       }
-
-                       // we're sure that the encoded OID is shorter than its string representation
-                       byte[] oid = new byte [str.Length];
-                       // now encoding value
-                       try {
-                               byte part0 = Convert.ToByte (parts [0]);
-                               // OID[0] > 2 is invalid but "supported" in MS BCL
-                               // uncomment next line to trap this error
-                               // if (part0 > 2) throw new CryptographicUnexpectedOperationException ();
-                               byte part1 = Convert.ToByte (parts [1]);
-                               // OID[1] >= 40 is illegal for OID[0] < 2 because of the % 40
-                               // however the syntax is "supported" in MS BCL
-                               // uncomment next 2 lines to trap this error
-                               //if ((part0 < 2) && (part1 >= 40))
-                               //      throw new CryptographicUnexpectedOperationException ();
-                               oid[2] = Convert.ToByte (part0 * 40 + part1);
-                       }
-                       catch {
-                               throw new CryptographicUnexpectedOperationException (
-                                       Locale.GetText ("Invalid OID"));
-                       }
-                       int j = 3;
-                       for (int i = 2; i < parts.Length; i++) {
-                               long x = Convert.ToInt64 (parts [i]);
-                               if (x > 0x7F) {
-                                       byte[] num = EncodeLongNumber (x);
-                                       Buffer.BlockCopy (num, 0, oid, j, num.Length);
-                                       j += num.Length;
-                               }
-                               else
-                                       oid[j++] = Convert.ToByte (x);
-                       }
-
-                       int k = 2;
-                       // copy the exact number of byte required
-                       byte[] oid2 = new byte [j];
-                       oid2[0] = 0x06; // always - this tag means OID
-                       // Length (of value)
-                       if (j > 0x7F) {
-                               // for compatibility with MS BCL
-                               throw new CryptographicUnexpectedOperationException (
-                                       Locale.GetText ("OID > 127 bytes"));
-                               // comment exception and uncomment next 3 lines to remove restriction
-                               //byte[] num = EncodeLongNumber (j);
-                               //Buffer.BlockCopy (num, 0, oid, j, num.Length);
-                               //k = num.Length + 1;
-                       }
-                       else
-                               oid2 [1] = Convert.ToByte (j - 2); 
-
-                       Buffer.BlockCopy (oid, k, oid2, k, j - k);
-                       return oid2;
-               }
-
-               // encode (7bits array) number greater than 127
-               private static byte[] EncodeLongNumber (long x)
-               {
-                       // for MS BCL compatibility
-                       // comment next two lines to remove restriction
-                       if ((x > Int32.MaxValue) || (x < Int32.MinValue))
-                               throw new OverflowException (Locale.GetText ("Part of OID doesn't fit in Int32"));
-
-                       long y = x;
-                       // number of bytes required to encode this number
-                       int n = 1;
-                       while (y > 0x7F) {
-                               y = y >> 7;
-                               n++;
-                       }
-                       byte[] num = new byte [n];
-                       // encode all bytes 
-                       for (int i = 0; i < n; i++) {
-                               y = x >> (7 * i);
-                               y = y & 0x7F;
-                               if (i != 0)
-                                       y += 0x80;
-                               num[n-i-1] = Convert.ToByte (y);
-                       }
-                       return num;
-               }
-
-               [MonoLimitation ("nothing is FIPS certified so it never make sense to restrict to this (empty) subset")]
-               public static bool AllowOnlyFipsAlgorithms {
-                       get { return false; }
-               }
-       }
-}
-
diff --git a/mcs/class/corlib/System.Security.Cryptography/IncrementalHash.cs b/mcs/class/corlib/System.Security.Cryptography/IncrementalHash.cs
new file mode 100644 (file)
index 0000000..14c895e
--- /dev/null
@@ -0,0 +1,46 @@
+//
+// IncrementalHash.cs
+//
+// Authors:
+//     Marek Safar  <marek.safar@gmail.com>
+//
+// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com)
+//
+// 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.
+//
+
+#if NETSTANDARD
+
+namespace System.Security.Cryptography
+{
+    public sealed class IncrementalHash : IDisposable
+    {
+        private IncrementalHash () { }
+        public HashAlgorithmName AlgorithmName { get { throw new NotImplementedException (); } }
+        public void AppendData (byte[] data) { }
+        public void AppendData (byte[] data, int offset, int count) { }
+        public static IncrementalHash CreateHash (HashAlgorithmName hashAlgorithm) { throw new NotImplementedException (); }
+        public static IncrementalHash CreateHMAC (HashAlgorithmName hashAlgorithm, byte[] key) { throw new NotImplementedException (); }
+        public void Dispose () { }
+        public byte[] GetHashAndReset () { throw new NotImplementedException (); }
+    }
+}
+
+#endif
\ No newline at end of file
index 29e40efbadfdddbc2247ca6b0c066162ea00881f..7abdbecd11a782671b3976c02e15089365142756 100644 (file)
@@ -40,7 +40,7 @@ using System.Text;
 
 namespace System.Security.Cryptography {
        
-#if !NET_2_1
+#if !MOBILE
        [ComVisible (true)]
 #endif
        public sealed class RNGCryptoServiceProvider : RandomNumberGenerator {
@@ -58,7 +58,7 @@ namespace System.Security.Cryptography {
                        _handle = RngInitialize (null);
                        Check ();
                }
-#if !NET_2_1
+
                public RNGCryptoServiceProvider (byte[] rgb)
                {
                        _handle = RngInitialize (rgb);
@@ -81,7 +81,7 @@ namespace System.Security.Cryptography {
                                _handle = RngInitialize (Encoding.UTF8.GetBytes (str));
                        Check ();
                }
-#endif
+
                private void Check () 
                {
                        if (_handle == IntPtr.Zero) {
index 5714862cbde0d9bf3f13786374eed5cf4479fb8a..05f56decf4a2b7b088d9bbf561f87581ba0852e4 100644 (file)
@@ -31,7 +31,7 @@ using System.Runtime.InteropServices;
 
 namespace System.Security.Permissions {
 
-#if NET_2_1 && !MONOTOUCH
+#if MOBILE && !MONOTOUCH
        [Obsolete ("CAS support is not available with Silverlight applications.")]
 #endif
        [ComVisible (true)]
index 3e1c714e375329743cc18ee74609ca001eb415e2..d943508a991271a38b1e2f9c130ac3e724b1def9 100644 (file)
@@ -71,7 +71,7 @@ namespace System.Security.Permissions {
                // Methods
                public override IPermission CreatePermission ()
                {
-#if NET_2_1
+#if MOBILE
                        return null;
 #else
                        EnvironmentPermission perm = null;
index 5f7fbff2d8633920d2992246abc814cf2e67a99b..3a3250d47dda2ac67d4feece85abca97820b81ae 100644 (file)
@@ -120,7 +120,7 @@ namespace System.Security.Permissions {
                // Methods
                public override IPermission CreatePermission ()
                {
-#if NET_2_1
+#if MOBILE
                        return null;
 #else
                        FileIOPermission perm = null;
index dd7aa04d3d88e7ab9107582bd63762c3ece01a9e..3afcb62ede468df1c48b3f7999f35164aecb2e4d 100644 (file)
@@ -175,7 +175,7 @@ namespace System.Security.Permissions {
 
                public override IPermission CreatePermission ()
                {
-#if NET_2_1
+#if MOBILE
                        return null;
 #else
                        // looks like permission is internal
index 3e8381721bbd402d34e6a8be541733dbaa13473b..aa6999b8a22bf846f82f02587a9dad3748f64ee7 100644 (file)
@@ -90,7 +90,7 @@ namespace System.Security.Permissions {
 
                private PermissionSet CreateFromXml (string xml) 
                {
-#if !NET_2_1
+#if !MOBILE
                        SecurityParser sp = new SecurityParser ();
                        try {
                                sp.LoadXml (xml);
@@ -125,7 +125,7 @@ namespace System.Security.Permissions {
                public PermissionSet CreatePermissionSet ()
                {
                        PermissionSet pset = null;
-#if !NET_2_1
+#if !MOBILE
                        if (this.Unrestricted)
                                pset = new PermissionSet (PermissionState.Unrestricted);
                        else {
index 68d85e81064b0ee0abef7798e76020fef7442b58..8680139527940bf7daa4cf0c78c393e2d766946e 100644 (file)
@@ -113,7 +113,7 @@ namespace System.Security.Permissions {
                // Methods
                public override IPermission CreatePermission ()
                {
-#if NET_2_1
+#if MOBILE
                        return null;
 #else
                        ReflectionPermission perm = null;
index 94d14df749a69d1c3990f8234e6e341ed6be6e43..2af0d262aea3286c97cc624ef91fff9bc6e4618f 100644 (file)
@@ -35,7 +35,7 @@ using System.Runtime.InteropServices;
 
 namespace System.Security.Permissions {
 
-#if NET_2_1 && !MONOTOUCH
+#if MOBILE && !MONOTOUCH
        [Obsolete ("CAS support is not available with Silverlight applications.")]
 #endif
        [ComVisible (true)]
index f871175e42343fac9e03d12149d9de093440a049..276a9144396b86ff38158bf5f8ece168d019d0ee 100644 (file)
@@ -31,7 +31,7 @@ using System.Runtime.InteropServices;
 
 namespace System.Security.Permissions {
 
-#if NET_2_1 && !MONOTOUCH
+#if MOBILE && !MONOTOUCH
        [Obsolete ("CAS support is not available with Silverlight applications.")]
 #endif
        [ComVisible (true)]
index cf37722731b90a1ab9e544a9127439ba5ba5a9f5..3cdc150e8d958689be9c9718a16db687a98b43b0 100644 (file)
@@ -31,7 +31,7 @@ using System.Runtime.InteropServices;
 
 namespace System.Security.Permissions {
 
-#if NET_2_1 && !MONOTOUCH
+#if MOBILE && !MONOTOUCH
        [Obsolete ("CAS support is not available with Silverlight applications.")]
 #endif
        [ComVisible (true)]
@@ -251,7 +251,7 @@ namespace System.Security.Permissions {
 
                public override IPermission CreatePermission ()
                {
-#if NET_2_1
+#if MOBILE
                        return null;
 #else
                        SecurityPermission perm = null;
index 9e5517bd40662763d02a2f7f7de91cca26b98687..f5c246e6b0214b97cd40092938b0fc5cb1b9cff8 100644 (file)
@@ -34,7 +34,7 @@ using System.Runtime.InteropServices;
 
 namespace System.Security.Permissions {
 
-#if NET_2_1 && !MONOTOUCH
+#if MOBILE && !MONOTOUCH
        [Obsolete ("CAS support is not available with Silverlight applications.")]
 #endif
        [ComVisible (true)]
index c710c3d764b805782da7e24dddb91b68836c207b..52a120d4909c23905247a6c79b14a4199a599666 100644 (file)
@@ -70,7 +70,7 @@ namespace System.Security.Permissions {
                // Methods
                public override IPermission CreatePermission ()
                {
-#if NET_2_1
+#if MOBILE
                        return null;
 #else
                        if (this.Unrestricted)
index 307c9d788a3c33f9ca99e9c659bc89795bf4e314..66e6bec14e5e541dcb6e19990c29a57d1e2ae923 100644 (file)
@@ -225,7 +225,7 @@ namespace System.Security.Policy {
                // "possible" presence of an Authenticode signature
                [MethodImplAttribute (MethodImplOptions.InternalCall)]
                static extern bool IsAuthenticodePresent (Assembly a);
-#if NET_2_1
+#if MOBILE
                static internal Evidence GetDefaultHostEvidence (Assembly a)
                {
                        return new Evidence ();
@@ -287,7 +287,7 @@ namespace System.Security.Policy {
                        return e;
                }
 
-#endif // NET_2_1
+#endif // MOBILE
 
                private class EvidenceEnumerator : IEnumerator {
                        
index 470b408613938d28c198385407238e60c8460fb1..43ef36220211882427986118fd6d483177064364 100644 (file)
@@ -31,7 +31,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if NET_2_1
+#if MOBILE
 
 namespace System.Security.Policy {
 
index b65d55460d4fde6b99f69ec029a2da815ff45ea5..64826f938eb50a5a2568a0628d311a5b17f0ddcb 100644 (file)
@@ -83,7 +83,13 @@ namespace System.Security.Policy {
                        if (url.Length == 0)
                                return new Zone (z);
 
-                       Uri uri = new Uri (url);
+                       Uri uri = null;
+                       try {
+                               uri = new Uri (url);
+                       }
+                       catch {
+                               return new Zone (z);
+                       }
                        // TODO: apply zone configuration
                        // this is the only way to use the Trusted and Untrusted zones
 
index 54cc0c1b3607e186cd7fa80511c13b32f6fb082f..ce855e490521ca652be5b91b18338e50a8e354a5 100644 (file)
@@ -227,8 +227,10 @@ namespace System.Security {
                // - SecurityManager.InternalDemand (declarative)
                internal void CasOnlyDemand (int skip)
                {
+#if !MONO
                        Assembly current = null;
                        AppDomain domain = null;
+#endif
 
                        if (_ignored == null) {
                                // special case when directly called from CodeAccessPermission.Demand
index 376e69998c984c4b1a6e297a1c70596066fd9d9c..c933e5e46b807b6f39a34618a1f85f230fb112f8 100644 (file)
@@ -29,7 +29,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if !NET_2_1
+#if !MOBILE
 
 using System.Collections;
 using System.Diagnostics;
index f64237aaf6a7ef85e98ee51b2fd4a52174c3039c..0d87d5624e976237fd27f47acfba26b4c8a591d2 100644 (file)
@@ -157,7 +157,11 @@ internal class Latin1Encoding : Encoding
                                        buffer = EncoderFallback.CreateFallbackBuffer ();
                                if (Char.IsSurrogate (ch) && count > 1 &&
                                    Char.IsSurrogate (chars [charIndex]))
-                                       buffer.Fallback (ch, chars [charIndex], charIndex++ - 1);
+                               {
+                                       buffer.Fallback (ch, chars [charIndex], charIndex - 1);
+                                       charIndex++;
+                                       count--;
+                               }
                                else
                                        buffer.Fallback (ch, charIndex - 1);
                                if (fallback_chars == null || fallback_chars.Length < buffer.Remaining)
diff --git a/mcs/class/corlib/System.Threading/EventWaitHandle.cs b/mcs/class/corlib/System.Threading/EventWaitHandle.cs
deleted file mode 100644 (file)
index fba21dc..0000000
+++ /dev/null
@@ -1,235 +0,0 @@
-//
-// System.Threading.EventWaitHandle.cs
-//
-// Author:
-//     Dick Porter (dick@ximian.com)
-//
-// (C) Ximian, Inc.    (http://www.ximian.com)
-// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
-//
-// 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.IO;
-using System.Runtime.InteropServices;
-using System.Security.AccessControl;
-
-namespace System.Threading
-{
-       [ComVisible (true)]
-       public class EventWaitHandle : WaitHandle
-       {
-               private EventWaitHandle (IntPtr handle)
-               {
-                       Handle = handle;
-               }
-
-               static bool IsManualReset (EventResetMode mode)
-               {
-                       if ((mode < EventResetMode.AutoReset) || (mode > EventResetMode.ManualReset))
-                               throw new ArgumentException ("mode");
-                       return (mode == EventResetMode.ManualReset);
-               }
-               
-               public EventWaitHandle (bool initialState, EventResetMode mode)
-               {
-                       bool created;
-                       bool manual = IsManualReset (mode);
-                       Handle = NativeEventCalls.CreateEvent_internal (manual, initialState, null, out created);
-               }
-               
-#if !MOBILE
-               
-               public EventWaitHandle (bool initialState, EventResetMode mode,
-                                       string name)
-               {
-                       bool created;
-                       bool manual = IsManualReset (mode);
-                       Handle = NativeEventCalls.CreateEvent_internal (manual, initialState, name, out created);
-               }
-               
-               public EventWaitHandle (bool initialState, EventResetMode mode,
-                                       string name, out bool createdNew)
-               {
-                       bool manual = IsManualReset (mode);
-                       Handle = NativeEventCalls.CreateEvent_internal (manual, initialState, name, out createdNew);
-               }
-
-
-               [MonoTODO ("Use access control in CreateEvent_internal")]
-               public EventWaitHandle (bool initialState, EventResetMode mode,
-                                       string name, out bool createdNew,
-                                       EventWaitHandleSecurity eventSecurity)
-               {
-                       bool manual = IsManualReset (mode);
-                       Handle = NativeEventCalls.CreateEvent_internal (manual, initialState, name, out createdNew);
-               }
-               
-               public EventWaitHandleSecurity GetAccessControl ()
-               {
-                       return new EventWaitHandleSecurity (SafeWaitHandle,
-                                                           AccessControlSections.Owner |
-                                                           AccessControlSections.Group |
-                                                           AccessControlSections.Access);
-
-               }
-
-               public static EventWaitHandle OpenExisting (string name)
-               {
-                       return(OpenExisting (name, EventWaitHandleRights.Synchronize | EventWaitHandleRights.Modify));
-               }
-
-               public static EventWaitHandle OpenExisting (string name, EventWaitHandleRights rights)
-               {
-                       if (name == null) {
-                               throw new ArgumentNullException ("name");
-                       }
-                       if ((name.Length == 0) ||
-                           (name.Length > 260)) {
-                               throw new ArgumentException ("name", Locale.GetText ("Invalid length [1-260]."));
-                       }
-                       
-                       MonoIOError error;
-                       IntPtr handle = NativeEventCalls.OpenEvent_internal (name, rights, out error);
-                       if (handle == (IntPtr)null) {
-                               if (error == MonoIOError.ERROR_FILE_NOT_FOUND) {
-                                       throw new WaitHandleCannotBeOpenedException (Locale.GetText ("Named Event handle does not exist: ") + name);
-                               } else if (error == MonoIOError.ERROR_ACCESS_DENIED) {
-                                       throw new UnauthorizedAccessException ();
-                               } else {
-                                       throw new IOException (Locale.GetText ("Win32 IO error: ") + error.ToString ());
-                               }
-                       }
-                       
-                       return(new EventWaitHandle (handle));
-               }
-
-               public static bool TryOpenExisting (string name, out EventWaitHandle result)
-               {
-                       return TryOpenExisting (
-                               name, EventWaitHandleRights.Synchronize | EventWaitHandleRights.Modify, out result);
-               }
-
-               public static bool TryOpenExisting (string name, EventWaitHandleRights rights,
-                                                   out EventWaitHandle result)
-               {
-                       if (name == null) {
-                               throw new ArgumentNullException ("name");
-                       }
-                       if ((name.Length == 0) || (name.Length > 260)) {
-                               throw new ArgumentException ("name", Locale.GetText ("Invalid length [1-260]."));
-                       }
-                       
-                       MonoIOError error;
-                       IntPtr handle = NativeEventCalls.OpenEvent_internal (name, rights, out error);
-                       if (handle == (IntPtr)null) {
-                               result = null;
-                               return false;
-                       }
-
-                       result = new EventWaitHandle (handle);
-                       return true;
-               }
-#else
-               public EventWaitHandle (bool initialState, EventResetMode mode, string name)
-               {
-                       throw new NotSupportedException ();
-               }
-               
-               public EventWaitHandle (bool initialState, EventResetMode mode,
-                                       string name, out bool createdNew)
-               {
-                       throw new NotSupportedException ();
-               }
-               
-               
-               public EventWaitHandle (bool initialState, EventResetMode mode,
-                                       string name, out bool createdNew,
-                                       EventWaitHandleSecurity eventSecurity)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public static EventWaitHandle OpenExisting (string name)
-               {
-                       throw new NotSupportedException (); 
-               }
-
-               public static EventWaitHandle OpenExisting (string name, EventWaitHandleRights rights)
-               {
-                       throw new NotSupportedException (); 
-               }
-
-               public static bool TryOpenExisting (string name, out EventWaitHandle result)
-               {
-                       throw new NotSupportedException (); 
-               }
-
-               public static bool TryOpenExisting (string name, EventWaitHandleRights rights,
-                                                   out EventWaitHandle result)
-               {
-                       throw new NotSupportedException (); 
-               }
-#endif
-
-               public bool Reset ()
-               {
-                       /* This needs locking since another thread could dispose the handle */
-                       lock (this) {
-                               CheckDisposed ();
-                       
-                               return NativeEventCalls.ResetEvent (SafeWaitHandle);
-                       }
-               }
-               
-               public bool Set ()
-               {
-                       lock (this) {
-                               CheckDisposed ();
-                       
-                               return NativeEventCalls.SetEvent (SafeWaitHandle);
-                       }
-               }
-
-               internal void CheckDisposed ()
-               {
-                       if (disposed)
-                               throw new ObjectDisposedException (GetType ().FullName);
-               }
-
-               bool disposed;
-               protected override void Dispose(bool explicitDisposing)
-               {
-                       base.Dispose (explicitDisposing);
-                       disposed = true;
-               }
-
-#if !NET_2_1
-               public void SetAccessControl (EventWaitHandleSecurity eventSecurity)
-               {
-                       if (null == eventSecurity)
-                               throw new ArgumentNullException ("eventSecurity");
-                               
-                       eventSecurity.PersistModifications (SafeWaitHandle);
-
-               }
-#endif
-       }
-}
index 6216e3101370d363c805382bdd6d67a27cc84b42..9c88bce4d94c2f7bd4255047e6d6c21660f59e2a 100644 (file)
@@ -206,7 +206,7 @@ namespace System.Threading
                        }
                }
 
-#if !NET_2_1
+#if !MOBILE
                public void SetAccessControl (MutexSecurity mutexSecurity)
                {
                        if (null == mutexSecurity)
index b0320579bfa227ec3a8058fe50ab22774d6fbf6d..fc5a9f59babe887360a7eccdc6eadb088e285946 100644 (file)
@@ -45,7 +45,7 @@ namespace System.Threading
        internal static class NativeEventCalls
        {
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
-               public static extern IntPtr CreateEvent_internal(bool manual,bool initial,string name, out bool created);
+               public static extern IntPtr CreateEvent_internal (bool manual, bool initial, string name, out int errorCode);
 
                public static bool SetEvent (SafeWaitHandle handle)
                {
@@ -82,7 +82,7 @@ namespace System.Threading
 
 #if !MOBILE
                [MethodImplAttribute (MethodImplOptions.InternalCall)]
-               public static extern IntPtr OpenEvent_internal (string name, EventWaitHandleRights rights, out MonoIOError error);
+               public static extern IntPtr OpenEvent_internal (string name, EventWaitHandleRights rights, out int errorCode);
 #endif
        }
 }
index d46999b767b535c04572e9cf6008f2d6fcdee221..4bce5168e7dea5288ecff37ad405bab3e929c66b 100644 (file)
@@ -49,7 +49,8 @@ namespace System.Threading {
                #region Sync with metadata/object-internals.h
                int lock_thread_id;
                // stores a thread handle
-               internal IntPtr system_thread_handle;
+               IntPtr handle;
+               IntPtr native_handle; // used only on Win32
 
                /* Note this is an opaque object (an array), not a CultureInfo */
                private object cached_culture_info;
@@ -65,7 +66,6 @@ namespace System.Threading {
                /* start_notify is used by the runtime to signal that Start()
                 * is ok to return
                 */
-               private IntPtr start_notify;
                private IntPtr stack_ptr;
                private UIntPtr static_data; /* GC-tracked */
                private IntPtr runtime_thread_info;
@@ -90,22 +90,33 @@ namespace System.Threading {
                private IntPtr interrupt_on_stop;
                private IntPtr flags;
                private IntPtr thread_pinning_ref;
+               private IntPtr abort_protected_block_count;
+               private int priority = (int) ThreadPriority.Normal;
+               private IntPtr owned_mutex;
+               private IntPtr suspended_event;
+               private int self_suspended;
                /* 
                 * These fields are used to avoid having to increment corlib versions
                 * when a new field is added to the unmanaged MonoThread structure.
                 */
                private IntPtr unused1;
                private IntPtr unused2;
+
+               /* This is used only to check that we are in sync between the representation
+                * of MonoInternalThread in native and InternalThread in managed
+                *
+                * DO NOT RENAME! DO NOT ADD FIELDS AFTER! */
+               private IntPtr last;
                #endregion
 #pragma warning restore 169, 414, 649
 
                // Closes the system thread handle
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
-               private extern void Thread_free_internal(IntPtr handle);
+               private extern void Thread_free_internal();
 
                [ReliabilityContract (Consistency.WillNotCorruptState, Cer.Success)]
                ~InternalThread() {
-                       Thread_free_internal(system_thread_handle);
+                       Thread_free_internal();
                }
        }
 
@@ -116,16 +127,11 @@ namespace System.Threading {
                private InternalThread internal_thread;
                object m_ThreadStartArg;
                object pending_exception;
-               int priority = (int) ThreadPriority.Normal;
                #endregion
 #pragma warning restore 414
 
                IPrincipal principal;
                int principal_version;
-               bool current_culture_set;
-               bool current_ui_culture_set;
-               CultureInfo current_culture;
-               CultureInfo current_ui_culture;
 
                // the name of current_thread is
                // important because they are used by the runtime.
@@ -133,9 +139,6 @@ namespace System.Threading {
                [ThreadStatic]
                static Thread current_thread;
 
-               static internal CultureInfo default_culture;
-               static internal CultureInfo default_ui_culture;
-
                // can be both a ThreadStart and a ParameterizedThreadStart
                private MulticastDelegate m_Delegate;
 
@@ -340,54 +343,6 @@ namespace System.Threading {
                        }
                }
 
-               //[MethodImplAttribute (MethodImplOptions.InternalCall)]
-               //private static extern int current_lcid ();
-
-               public CultureInfo CurrentCulture {
-                       get {
-                               CultureInfo culture = current_culture;
-                               if (current_culture_set && culture != null)
-                                       return culture;
-
-                               if (default_culture != null)
-                                       return default_culture;
-
-                               current_culture = culture = CultureInfo.ConstructCurrentCulture ();
-                               return culture;
-                       }
-                       
-                       [SecurityPermission (SecurityAction.Demand, ControlThread=true)]
-                       set {
-                               if (value == null)
-                                       throw new ArgumentNullException ("value");
-
-                               value.CheckNeutral ();
-                               current_culture = value;
-                               current_culture_set = true;
-                       }
-               }
-
-               public CultureInfo CurrentUICulture {
-                       get {
-                               CultureInfo culture = current_ui_culture;
-                               if (current_ui_culture_set && culture != null)
-                                       return culture;
-
-                               if (default_ui_culture != null)
-                                       return default_ui_culture;
-
-                               current_ui_culture = culture = CultureInfo.ConstructCurrentUICulture ();
-                               return culture;
-                       }
-                       
-                       set {
-                               if (value == null)
-                                       throw new ArgumentNullException ("value");
-                               current_ui_culture = value;
-                               current_ui_culture_set = true;
-                       }
-               }
-
                public bool IsThreadPoolThread {
                        get {
                                return IsThreadPoolThreadInternal;
@@ -508,6 +463,12 @@ namespace System.Threading {
                {
                        throw new PlatformNotSupportedException ("Thread.ResetAbort is not supported on the current platform.");
                }
+
+               internal object AbortReason {
+                       get {
+                               throw new PlatformNotSupportedException ("Thread.ResetAbort is not supported on the current platform.");
+                       }
+               }
 #endif // MONO_FEATURE_THREAD_ABORT
 
                [MethodImplAttribute (MethodImplOptions.InternalCall)]
@@ -723,11 +684,6 @@ namespace System.Threading {
                        return ManagedThreadId;
                }
 
-               internal CultureInfo GetCurrentUICultureNoAppX ()
-               {
-                       return CultureInfo.CurrentUICulture;
-               }
-
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
                internal static extern void GetStackTraces (out Thread[] threads, out object[] stack_frames);
 
@@ -757,5 +713,10 @@ namespace System.Threading {
                        throw new PlatformNotSupportedException ("Thread.Resume is not supported on the current platform.");
                }
 #endif
+
+               public void DisableComObjectEagerCleanup ()
+               {
+                       throw new PlatformNotSupportedException ();
+               }
        }
 }
index 13cc078e575b0b757017347382bd9d393214a78d..ea12a7f34681a93c7def93d8e8678882349c7ccc 100644 (file)
@@ -116,7 +116,7 @@ namespace System {
                [MethodImplAttribute (MethodImplOptions.InternalCall)]
                private extern AppDomainSetup getSetup ();
 
-#if NET_2_1
+#if MOBILE
                internal
 #endif
                AppDomainSetup SetupInformationNoCopy {
@@ -130,7 +130,7 @@ namespace System {
                        }
                }
 
-#if !NET_2_1
+#if !MOBILE
                [MonoTODO]
                public ApplicationTrust ApplicationTrust {
                        get { throw new NotImplementedException (); }
@@ -139,7 +139,7 @@ namespace System {
                public string BaseDirectory {
                        get {
                                string path = SetupInformationNoCopy.ApplicationBase;
-#if !NET_2_1
+#if !MOBILE
                                if (SecurityManager.SecurityEnabled && (path != null) && (path.Length > 0)) {
                                        // we cannot divulge local file informations
                                        new FileIOPermission (FileIOPermissionAccess.PathDiscovery, path).Demand ();
@@ -152,7 +152,7 @@ namespace System {
                public string RelativeSearchPath {
                        get {
                                string path = SetupInformationNoCopy.PrivateBinPath;
-#if !NET_2_1
+#if !MOBILE
                                if (SecurityManager.SecurityEnabled && (path != null) && (path.Length > 0)) {
                                        // we cannot divulge local file informations
                                        new FileIOPermission (FileIOPermissionAccess.PathDiscovery, path).Demand ();
@@ -169,7 +169,7 @@ namespace System {
                                        return null;
 
                                string path = Path.Combine (setup.DynamicBase, setup.ApplicationName);
-#if !NET_2_1
+#if !MOBILE
                                if (SecurityManager.SecurityEnabled && (path != null) && (path.Length > 0)) {
                                        // we cannot divulge local file informations
                                        new FileIOPermission (FileIOPermissionAccess.PathDiscovery, path).Demand ();
@@ -311,7 +311,7 @@ namespace System {
                        SetupInformationNoCopy.ShadowCopyDirectories = String.Empty;
                }
 
-#if !NET_2_1
+#if !MOBILE
                public ObjectHandle CreateComInstanceFrom (string assemblyName, string typeName)
                {
                        return Activator.CreateComInstanceFrom (assemblyName, typeName);
@@ -1027,7 +1027,7 @@ namespace System {
                        } else if (info.ConfigurationFile == null)
                                info.ConfigurationFile = "[I don't have a config file]";
 
-#if !NET_2_1
+#if !MOBILE
                        if (info.AppDomainInitializer != null) {
                                if (!info.AppDomainInitializer.Method.IsStatic)
                                        throw new ArgumentException ("Non-static methods cannot be invoked as an appdomain initializer");
@@ -1047,7 +1047,7 @@ namespace System {
                        else
                                ad._evidence = new Evidence (securityInfo);     // copy
 
-#if !NET_2_1
+#if !MOBILE
                        if (info.AppDomainInitializer != null) {
                                Loader loader = new Loader (
                                        info.AppDomainInitializer.Method.DeclaringType.Assembly.Location);
@@ -1082,7 +1082,7 @@ namespace System {
                }
 #endif // MONO_FEATURE_MULTIPLE_APPDOMAINS
 
-#if !NET_2_1
+#if !MOBILE
                [Serializable]
                class Loader {
 
@@ -1133,7 +1133,7 @@ namespace System {
                }
 #endif // MONO_FEATURE_MULTIPLE_APPDOMAINS
                
-#if !NET_2_1
+#if !MOBILE
 #if MONO_FEATURE_MULTIPLE_APPDOMAINS
                public static AppDomain CreateDomain (string friendlyName, Evidence securityInfo, AppDomainSetup info,
                                                      PermissionSet grantSet, params StrongName [] fullTrustAssemblies)
@@ -1217,14 +1217,16 @@ namespace System {
                        SetData (name, data);
                }
 
-#if !NET_2_1
                [Obsolete ("Use AppDomainSetup.DynamicBase")]
                [SecurityPermission (SecurityAction.LinkDemand, ControlAppDomain = true)]
                public void SetDynamicBase (string path)
                {
+#if MOBILE
+                       throw new PlatformNotSupportedException ();
+#else
                        SetupInformationNoCopy.DynamicBase = path;
+#endif // MOBILE
                }
-#endif // !NET_2_1
 
                [Obsolete ("AppDomain.GetCurrentThreadId has been deprecated"
                        + " because it does not provide a stable Id when managed"
@@ -1286,14 +1288,11 @@ namespace System {
                private Assembly DoAssemblyResolve (string name, Assembly requestingAssembly, bool refonly)
                {
                        ResolveEventHandler del;
-#if !NET_2_1
                        if (refonly)
                                del = ReflectionOnlyAssemblyResolve;
                        else
                                del = AssemblyResolve;
-#else
-                       del = AssemblyResolve;
-#endif
+
                        if (del == null)
                                return null;
                        
@@ -1490,9 +1489,7 @@ namespace System {
                }
 #endif // MONO_FEATURE_MULTIPLE_APPDOMAINS
 
-#if !MOBILE
                public event ResolveEventHandler ReflectionOnlyAssemblyResolve;
-#endif
 
         #pragma warning disable 649
 #if MOBILE
index cc45ffd33dec20d26d79f32370a71229609cfe71..f71ed54da603271305ef4abd880cd06687a396b8 100644 (file)
@@ -26,7 +26,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if NET_2_1
+#if MOBILE
 
 using System.Runtime.InteropServices;
 using System.Security;
index b3e2d510138af5bcc9b4fafc390304de7cd1a159..ded3fb527c1a0825806bfa3e3b40cf2f139b9190 100644 (file)
@@ -36,6 +36,7 @@ using System.IO;
 using System.Runtime.CompilerServices;
 using System.Runtime.InteropServices;
 using System.Security;
+using System.Security.Permissions;
 using System.Runtime.Serialization.Formatters.Binary;
 
 using System.Runtime.Hosting;
@@ -47,7 +48,7 @@ namespace System
        [ClassInterface (ClassInterfaceType.None)]
        [ComVisible (true)]
        [StructLayout (LayoutKind.Sequential)]
-#if NET_2_1
+#if MOBILE
        public sealed class AppDomainSetup
 #else
        public sealed class AppDomainSetup : IAppDomainSetup
@@ -139,12 +140,27 @@ namespace System
                                appBase = appBase.Substring (7);
                                if (Path.DirectorySeparatorChar != '/')
                                        appBase = appBase.Replace ('/', Path.DirectorySeparatorChar);
-                               if (Environment.IsRunningOnWindows) {
-                                       // Under Windows prepend "//" to indicate it's a local file
-                                       appBase = "//" + appBase;
+                       }
+                       appBase = Path.GetFullPath (appBase);
+
+                       if (Path.DirectorySeparatorChar != '/') {
+                               bool isExtendedPath = appBase.StartsWith (@"\\?\", StringComparison.Ordinal);
+                               if (appBase.IndexOf (':', isExtendedPath ? 6 : 2) != -1) {
+                                       throw new NotSupportedException ("The given path's format is not supported.");
                                }
-                       } else {
-                               appBase = Path.GetFullPath (appBase);
+                       }
+
+                       // validate the path
+                       string dir = Path.GetDirectoryName (appBase);
+                       if ((dir != null) && (dir.LastIndexOfAny (Path.GetInvalidPathChars ()) >= 0)) {
+                               string msg = String.Format (Locale.GetText ("Invalid path characters in path: '{0}'"), appBase);
+                               throw new ArgumentException (msg, "appBase");
+                       }
+
+                       string fname = Path.GetFileName (appBase);
+                       if ((fname != null) && (fname.LastIndexOfAny (Path.GetInvalidFileNameChars ()) >= 0)) {
+                               string msg = String.Format (Locale.GetText ("Invalid filename characters in path: '{0}'"), appBase);
+                               throw new ArgumentException (msg, "appBase");
                        }
 
                        return appBase;
index 730b67a73f19a1ea1f2a8255611067cb0d114c6a..8e51aed83619d3337586e23874856c2d5120f3af 100644 (file)
@@ -29,7 +29,7 @@
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
-#if !NET_2_1
+#if !MOBILE
 using System.Text;
 using System.Runtime.InteropServices;
 
index 5eaa353dc6c71bdb1c1e06b5ee60e8b07a4046d8..ff6fc63a25acd9653c5e9e4873f574adc2fda50a 100644 (file)
@@ -31,7 +31,7 @@
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
-#if !NET_2_1
+#if !MOBILE
 using System;
 using System.Text;
 
index 2e7c4f4531cb5242216108d55f3cecb01860ffef..c8afcf1ec60567a07a651d173cb5374147adde2e 100644 (file)
@@ -41,7 +41,7 @@ namespace System
 {
        public static partial class Console
        {
-#if !NET_2_1
+#if !MOBILE
                private class WindowsConsole
                {
                        public static bool ctrlHandlerAdded = false;
@@ -97,13 +97,10 @@ namespace System
                static Console ()
                {
                        if (Environment.IsRunningOnWindows) {
+#if !MOBILE                            
                                //
                                // On Windows, follow the Windows tradition
                                //
-#if NET_2_1
-                               // should never happen since Moonlight does not run on windows
-                               inputEncoding = outputEncoding = Encoding.Default;
-#else                  
                                try {
                                        inputEncoding = Encoding.GetEncoding (WindowsConsole.GetInputCodePage ());
                                        outputEncoding = Encoding.GetEncoding (WindowsConsole.GetOutputCodePage ());
@@ -134,7 +131,7 @@ namespace System
 
                static void SetupStreams (Encoding inputEncoding, Encoding outputEncoding)
                {
-#if !NET_2_1
+#if !MOBILE
                        if (!Environment.IsRunningOnWindows && ConsoleDriver.IsConsole) {
                                stdin = new CStreamReader (OpenStandardInput (0), inputEncoding);
                                stdout = TextWriter.Synchronized (new CStreamWriter (OpenStandardOutput (0), outputEncoding, true) { AutoFlush = true });
@@ -488,7 +485,7 @@ namespace System
                        stdout.WriteLine (String.Format (format, args));
                }
 
-#if !NET_2_1
+#if !MOBILE
                public static int Read ()
                {
                        if ((stdin is CStreamReader) && ConsoleDriver.IsConsole) {
@@ -539,7 +536,7 @@ namespace System
                        }
                }
 
-#if !NET_2_1
+#if !MOBILE
                public static ConsoleColor BackgroundColor {
                        get { return ConsoleDriver.BackgroundColor; }
                        set { ConsoleDriver.BackgroundColor = value; }
index cf1faa8da1028708951c04e175ad55a97b9343e2..07354a9aeb697ee3e92323a30b84434892f2f95e 100644 (file)
@@ -27,7 +27,7 @@
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
-#if !NET_2_1
+#if !MOBILE
 using System.IO;
 using System.Runtime.CompilerServices;
 
index b6a2d92eef7f8644942936af9c06aa92437233f3..c8b87782310327f36d1ffe0fbca382f0431c1987 100644 (file)
@@ -57,7 +57,7 @@ namespace System {
                 * of icalls, do not require an increment.
                 */
 #pragma warning disable 169
-               private const int mono_corlib_version = 152;
+               private const int mono_corlib_version = 163;
 #pragma warning restore 169
 
                [ComVisible (true)]
@@ -322,7 +322,7 @@ namespace System {
                                return trace.ToString ();
                        }
                }
-#if !NET_2_1
+
                /// <summary>
                /// Get a fully qualified path to the system directory
                /// </summary>
@@ -331,7 +331,7 @@ namespace System {
                                return GetFolderPath (SpecialFolder.System);
                        }
                }
-#endif
+
                /// <summary>
                /// Get the number of milliseconds that have elapsed since the system was booted
                /// </summary>
@@ -472,7 +472,15 @@ namespace System {
                public extern static string[] GetCommandLineArgs ();
 
                [MethodImplAttribute (MethodImplOptions.InternalCall)]
-               internal extern static string internalGetEnvironmentVariable (string variable);
+               internal extern static string internalGetEnvironmentVariable_native (IntPtr variable);
+
+               internal static string internalGetEnvironmentVariable (string variable) {
+                       if (variable == null)
+                               return null;
+                       using (var h = Mono.RuntimeMarshal.MarshalString (variable)) {
+                               return internalGetEnvironmentVariable_native (h.Value);
+                       }
+               }
 
                /// <summary>
                /// Return a string containing the value of the environment
@@ -480,7 +488,7 @@ namespace System {
                /// </summary>
                public static string GetEnvironmentVariable (string variable)
                {
-#if !NET_2_1
+#if !MOBILE
                        if (SecurityManager.SecurityEnabled) {
                                new EnvironmentPermission (EnvironmentPermissionAccess.Read, variable).Demand ();
                        }
@@ -503,7 +511,7 @@ namespace System {
                /// <summary>
                /// Return a set of all environment variables and their values
                /// </summary>
-#if !NET_2_1
+#if !MOBILE
                public static IDictionary GetEnvironmentVariables ()
                {
                        StringBuilder sb = null;
@@ -565,7 +573,7 @@ namespace System {
                        else
                                dir = UnixGetFolderPath (folder, option);
 
-#if !NET_2_1
+#if !MOBILE
                        if ((dir != null) && (dir.Length > 0) && SecurityManager.SecurityEnabled) {
                                new FileIOPermission (FileIOPermissionAccess.PathDiscovery, dir).Demand ();
                        }
@@ -862,6 +870,22 @@ namespace System {
                        }
                }
 #else
+               public static string GetEnvironmentVariable (string variable, EnvironmentVariableTarget target)
+               {
+                       if (target == EnvironmentVariableTarget.Process)
+                               return GetEnvironmentVariable (variable);
+
+                       return null;
+               }
+
+               public static IDictionary GetEnvironmentVariables (EnvironmentVariableTarget target)
+               {
+                       if (target == EnvironmentVariableTarget.Process)
+                               return GetEnvironmentVariables ();
+
+                       return (IDictionary)new Hashtable ();
+               }
+
                public static void SetEnvironmentVariable (string variable, string value)
                {
                        if (variable == null)
@@ -875,6 +899,14 @@ namespace System {
 
                        InternalSetEnvironmentVariable (variable, value);
                }
+
+               public static void SetEnvironmentVariable (string variable, string value, EnvironmentVariableTarget target)
+               {
+                       if (target == EnvironmentVariableTarget.Process)
+                               SetEnvironmentVariable (variable, value);
+
+                       // other targets ignored
+               }
 #endif
                [MethodImplAttribute (MethodImplOptions.InternalCall)]
                internal static extern void InternalSetEnvironmentVariable (string variable, string value);
@@ -893,7 +925,9 @@ namespace System {
                [SecurityCritical]
                public static void FailFast (string message, Exception exception)
                {
-                       throw new NotImplementedException ();
+#pragma warning disable 618
+                       throw new ExecutionEngineException (message, exception);
+#pragma warning restore
                }
 
                [MethodImplAttribute (MethodImplOptions.InternalCall)]
@@ -927,7 +961,7 @@ namespace System {
                }
 #endif
 
-#if !NET_2_1
+#if !MOBILE
                //
                // Used by gacutil.exe
                //
@@ -962,6 +996,14 @@ namespace System {
                [MethodImplAttribute (MethodImplOptions.InternalCall)]
                internal extern static int GetPageSize ();
 
+               [MethodImplAttribute(MethodImplOptions.InternalCall)]
+               extern private static string get_bundled_machine_config ();
+
+               internal static string GetBundledMachineConfig ()
+               {
+                       return get_bundled_machine_config ();
+               }
+
                static internal bool IsUnix {
                        get {
                                int platform = (int) Environment.Platform;
@@ -998,6 +1040,15 @@ namespace System {
                        // Do not include a trailing newline for backwards compatibility
                        return st.ToString( System.Diagnostics.StackTrace.TraceFormat.Normal );
                }
+
+               // Copied from referencesource Environment
+               internal static bool IsWinRTSupported
+               {
+                       get
+                       {
+                               return true;
+                       }
+               }
        }
 }
 
diff --git a/mcs/class/corlib/System/GC.cs b/mcs/class/corlib/System/GC.cs
deleted file mode 100644 (file)
index a673419..0000000
+++ /dev/null
@@ -1,159 +0,0 @@
-//
-// System.GC.cs
-//
-// Author:
-//   Paolo Molaro (lupus@ximian.com)
-//
-// (C) 2001 Ximian, Inc.  http://www.ximian.com
-//
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// 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.Runtime.CompilerServices;
-using System.Runtime.ConstrainedExecution;
-using System.Security.Permissions;
-
-namespace System
-{
-       public static class GC
-       {
-
-               public extern static int MaxGeneration {
-                       [MethodImplAttribute(MethodImplOptions.InternalCall)]
-                       get;
-               }
-
-               [MethodImplAttribute (MethodImplOptions.InternalCall)]
-               extern static void InternalCollect (int generation);
-               
-               public static void Collect () {
-                       InternalCollect (MaxGeneration);
-               }
-
-               public static void Collect (int generation) {
-                       if (generation < 0)
-                               throw new ArgumentOutOfRangeException ("generation");
-                       InternalCollect (generation);
-               }
-
-               [MonoDocumentationNote ("mode parameter ignored")]
-               public static void Collect (int generation, GCCollectionMode mode) {
-                       Collect (generation);
-               }
-
-               [MonoDocumentationNote ("mode and blocking parameters ignored")]
-               public static void Collect (int generation, GCCollectionMode mode, bool blocking) {
-                       Collect (generation);
-               }
-
-               [MethodImplAttribute (MethodImplOptions.InternalCall)]
-               public extern static int GetGeneration (object obj);
-
-               public static int GetGeneration (WeakReference wo) {
-                       object obj = wo.Target;
-                       if (obj == null)
-                               throw new ArgumentException ();
-                       return GetGeneration (obj);
-               }
-
-               [MethodImplAttribute (MethodImplOptions.InternalCall)]
-               public extern static long GetTotalMemory (bool forceFullCollection);
-
-               /* this icall has weird semantics check the docs... */
-               [ReliabilityContract (Consistency.WillNotCorruptState, Cer.Success)]
-               [MethodImplAttribute (MethodImplOptions.InternalCall)]
-               public extern static void KeepAlive (object obj);
-               
-               [MethodImplAttribute (MethodImplOptions.InternalCall)]
-               public extern static void ReRegisterForFinalize (object obj);
-
-               [ReliabilityContractAttribute (Consistency.WillNotCorruptState, Cer.Success)]
-               [MethodImplAttribute (MethodImplOptions.InternalCall)]
-               public extern static void SuppressFinalize (object obj);
-
-               [MethodImplAttribute (MethodImplOptions.InternalCall)]
-               public extern static void WaitForPendingFinalizers ();
-
-               [ReliabilityContractAttribute (Consistency.WillNotCorruptState, Cer.Success)]
-               [MethodImplAttribute (MethodImplOptions.InternalCall)]
-               public extern static int CollectionCount (int generation);
-
-               [MethodImplAttribute (MethodImplOptions.InternalCall)]
-               private extern static void RecordPressure (long bytesAllocated);
-
-               public static void AddMemoryPressure (long bytesAllocated) {
-                       RecordPressure (bytesAllocated);
-               }
-
-               public static void RemoveMemoryPressure (long bytesAllocated) {
-                       RecordPressure (-bytesAllocated);
-               }
-
-               [PermissionSetAttribute (SecurityAction.LinkDemand, Name = "FullTrust")]
-               [MonoTODO]
-               public static GCNotificationStatus WaitForFullGCApproach () {
-                       throw new NotImplementedException ();
-               }
-
-               [PermissionSetAttribute (SecurityAction.LinkDemand, Name = "FullTrust")]
-               [MonoTODO]
-               public static GCNotificationStatus WaitForFullGCApproach (int millisecondsTimeout) {
-                       throw new NotImplementedException ();
-               }
-
-               [PermissionSetAttribute (SecurityAction.LinkDemand, Name = "FullTrust")]
-               [MonoTODO]
-               public static GCNotificationStatus WaitForFullGCComplete () {
-                       throw new NotImplementedException ();
-               }
-
-               [PermissionSetAttribute (SecurityAction.LinkDemand, Name = "FullTrust")]
-               [MonoTODO]
-               public static GCNotificationStatus WaitForFullGCComplete (int millisecondsTimeout) {
-                       throw new NotImplementedException ();
-               }
-
-               [PermissionSetAttribute (SecurityAction.LinkDemand, Name = "FullTrust")]
-               public static void RegisterForFullGCNotification (int maxGenerationThreshold, int largeObjectHeapThreshold) {
-                       if (maxGenerationThreshold < 1 || maxGenerationThreshold > 99)
-                               throw new ArgumentOutOfRangeException ("maxGenerationThreshold", maxGenerationThreshold, "maxGenerationThreshold must be between 1 and 99 inclusive");
-                       if (largeObjectHeapThreshold < 1 || largeObjectHeapThreshold > 99)
-                               throw new ArgumentOutOfRangeException ("largeObjectHeapThreshold", largeObjectHeapThreshold, "largeObjectHeapThreshold must be between 1 and 99 inclusive");
-                       throw new NotImplementedException ();
-               }
-
-               [PermissionSetAttribute (SecurityAction.LinkDemand, Name = "FullTrust")]
-               public static void CancelFullGCNotification () {
-                       throw new NotImplementedException ();
-               }
-
-               [MethodImplAttribute (MethodImplOptions.InternalCall)]
-               internal extern static void register_ephemeron_array (Ephemeron[] array);
-
-               [MethodImplAttribute (MethodImplOptions.InternalCall)]
-               extern static object get_ephemeron_tombstone ();
-
-               internal static readonly object EPHEMERON_TOMBSTONE = get_ephemeron_tombstone ();
-       }
-}
diff --git a/mcs/class/corlib/System/GCCollectionMode.cs b/mcs/class/corlib/System/GCCollectionMode.cs
deleted file mode 100644 (file)
index 0134db6..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-//
-// System.GCCollectionMode.cs
-//
-
-//
-// Copyright (C) 2007 Novell, Inc (http://www.novell.com)
-//
-// 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.
-//
-
-// Net 3.5 type
-
-namespace System
-{
-       [Serializable]
-       public enum GCCollectionMode {
-               Default = 0,
-               Forced = 1,
-               Optimized = 2
-       }
-}
diff --git a/mcs/class/corlib/System/GCNotificationStatus.cs b/mcs/class/corlib/System/GCNotificationStatus.cs
deleted file mode 100644 (file)
index d48dab5..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-//
-// System.GCNotificationStatus.cs
-//
-// Authors:
-//   Gonzalo Paniagua (gonzalo@ximian.com)
-//
-// Copyright (C) 2009 Novell, Inc (http://www.novell.com)
-//
-// 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.Collections.Generic;
-using System.Runtime.ConstrainedExecution;
-
-namespace System {
-       public enum GCNotificationStatus {
-               Succeeded,
-               Failed,
-               Canceled,
-               Timeout,
-               NotApplicable
-       }
-}
index ecec3b508b2c32b309de3bfa33770b20c04d9d07..09cba85976a2f4357ac85b3ea1aef9c13e367e2f 100644 (file)
@@ -26,7 +26,7 @@
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
-#if !NET_2_1
+#if !MOBILE
 using System.Runtime.InteropServices;
 using System.Text;
 namespace System {
index 11f6c67dbd4e4d73c69b0a3b4a007025069ea7bd..32c4aa0885b2caa2676ba3e51639571992187c09 100644 (file)
@@ -41,7 +41,7 @@ namespace System
        [ComVisible (true)]
        public static class Nullable {
 
-#if NET_2_1
+#if MOBILE
                [ComVisible (false)]
 #endif
                public static int Compare<T> (T? n1, T? n2) where T: struct
@@ -56,7 +56,7 @@ namespace System
                        return n2.has_value ? -1 : 0;
                }
 
-#if NET_2_1
+#if MOBILE
                [ComVisible (false)]
 #endif
                public static bool Equals<T> (T? n1, T? n2) where T: struct
index 5ab662ab0618133752ae4d0f439c447c3e6df049..d849b03f8d66dbb4a2106a95baaa950e044ef286 100644 (file)
@@ -33,7 +33,7 @@
 // https://github.com/dotnet/corefx
 // src/System.Console/src/System/ConsolePal.Unix.cs
 //
-#if !NET_2_1
+#if !MOBILE
 
 //
 // Defining this writes the output to console.log
@@ -1556,22 +1556,52 @@ namespace System {
                                case 'O':                                         // logical
                                        int second = stack.Pop().Int32; // it's a stack... the second value was pushed last
                                        int first = stack.Pop().Int32;
-                                       char c = format[pos];
-                                       stack.Push(
-                                               c == '+' ? (first + second) :
-                                               c == '-' ? (first - second) :
-                                               c == '*' ? (first * second) :
-                                               c == '/' ? (first / second) :
-                                               c == 'm' ? (first % second) :
-                                               c == '^' ? (first ^ second) :
-                                               c == '&' ? (first & second) :
-                                               c == '|' ? (first | second) :
-                                               c == '=' ? AsInt(first == second) :
-                                               c == '>' ? AsInt(first > second) :
-                                               c == '<' ? AsInt(first < second) :
-                                               c == 'A' ? AsInt(AsBool(first) && AsBool(second)) :
-                                               c == 'O' ? AsInt(AsBool(first) || AsBool(second)) :
-                                               0); // not possible; we just validated above
+                                       int res;
+                                       switch (format[pos]) {
+                                       case '+':
+                                               res = first + second;
+                                               break;
+                                       case '-':
+                                               res = first - second;
+                                               break;
+                                       case '*':
+                                               res = first * second;
+                                               break;
+                                       case '/':
+                                               res = first / second;
+                                               break;
+                                       case 'm':
+                                               res = first % second;
+                                               break;
+                                       case '^':
+                                               res = first ^ second;
+                                               break;
+                                       case '&':
+                                               res = first & second;
+                                               break;
+                                       case '|':
+                                               res = first | second;
+                                               break;
+                                       case '=':
+                                               res = AsInt(first == second);
+                                               break;
+                                       case '>':
+                                               res = AsInt(first > second);
+                                               break;
+                                       case '<':
+                                               res = AsInt(first < second);
+                                               break;
+                                       case 'A':
+                                               res = AsInt(AsBool(first) && AsBool(second));
+                                               break;
+                                       case 'O':
+                                               res = AsInt(AsBool(first) || AsBool(second));
+                                               break;
+                                       default:
+                                               res = 0;
+                                               break;
+                                       }
+                                       stack.Push(res);
                                        break;
 
                                        // Unary operations
index fb547d4f58cbf65f9414805e79faae68a93221f3..b0b89f225c0292ece8e53139f5ca74ddfe440bc8 100644 (file)
@@ -27,7 +27,7 @@
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
-#if !NET_2_1
+#if !MOBILE
 
 // These values are taken from 'man 5 terminfo' and /usr/include/term.h.
 // They are the indexes for the numeric capabilities in a terminfo file.
index 6424d4fb79a74e81837f8e64d441f228384725a6..1a1ec6a94221672c8e17acfaa6be01890f7394df 100644 (file)
@@ -27,7 +27,7 @@
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
-#if !NET_2_1
+#if !MOBILE
 using System.IO;
 using System.Text;
 namespace System {
index 4baa2793d81fce6f1d92583ef50e4f054bf602f7..d795ef91adcdf1654a15229df81c8536f864e726 100644 (file)
@@ -27,7 +27,7 @@
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
-#if !NET_2_1
+#if !MOBILE
 
 // These values are taken from 'man 5 terminfo' and /usr/include/term.h.
 // They are the indexes for the string capabilities in a terminfo file.
index 45475e910b5caebc26b28d8ce92b16e5b026b2ef..fa9f73a4dc68eea801f8bd30ccb0a5cee801e8b6 100644 (file)
@@ -553,11 +553,10 @@ namespace System {
                                        return sign * (hour * 60) * 60;
                        }
 
-                       static TimeZoneInfo defaultZone;
                        internal static TimeZoneInfo Local {
                                get {
                                        var id  = GetDefaultTimeZoneName ();
-                                       return defaultZone = GetTimeZone (id, id);
+                                       return GetTimeZone (id, id);
                                }
                        }
                        
index ff76486877cfb2427ccf2b5f9069985552b4c3d2..f8e54b7fb85cbcd14606b9bc3db77ce7ddbfed80 100644 (file)
@@ -105,10 +105,10 @@ namespace System
 
                        try {
                                ret = readlink (path, buf, buf.Length);
-                       } catch (DllNotFoundException e) {
+                       } catch (DllNotFoundException) {
                                readlinkNotFound = true;
                                return null;
-                       } catch (EntryPointNotFoundException e) {
+                       } catch (EntryPointNotFoundException) {
                                readlinkNotFound = true;
                                return null;
                        }
@@ -273,7 +273,7 @@ namespace System
 #endif
                private AdjustmentRule [] adjustmentRules;
 
-#if !NET_2_1 || MOBILE_STATIC
+#if !MOBILE || MOBILE_STATIC
                /// <summary>
                /// Determine whether windows of not (taken Stephane Delcroix's code)
                /// </summary>
@@ -412,7 +412,14 @@ namespace System
 
                public static DateTime ConvertTimeBySystemTimeZoneId (DateTime dateTime, string sourceTimeZoneId, string destinationTimeZoneId)
                {
-                       return ConvertTime (dateTime, FindSystemTimeZoneById (sourceTimeZoneId), FindSystemTimeZoneById (destinationTimeZoneId));
+                       TimeZoneInfo source_tz;
+                       if (dateTime.Kind == DateTimeKind.Utc && sourceTimeZoneId == TimeZoneInfo.Utc.Id) {
+                               source_tz = Utc;
+                       } else {
+                               source_tz = FindSystemTimeZoneById (sourceTimeZoneId);
+                       }
+
+                       return ConvertTime (dateTime, source_tz, FindSystemTimeZoneById (destinationTimeZoneId));
                }
 
                public static DateTimeOffset ConvertTimeBySystemTimeZoneId (DateTimeOffset dateTimeOffset, string destinationTimeZoneId)
@@ -531,7 +538,7 @@ namespace System
                        //FIXME: this method should check for cached values in systemTimeZones
                        if (id == null)
                                throw new ArgumentNullException ("id");
-#if !NET_2_1
+#if !MOBILE
                        if (TimeZoneKey != null)
                        {
                                if (id == "Coordinated Universal Time")
@@ -561,7 +568,7 @@ namespace System
                }
 #endif
 
-#if !NET_2_1
+#if !MOBILE
                private static TimeZoneInfo FromRegistryKey (string id, RegistryKey key)
                {
                        byte [] reg_tzi = (byte []) key.GetValue ("TZI");
@@ -804,9 +811,16 @@ namespace System
                                        return tz.BaseUtcOffset;
                        }
 
-                       if (tzRule != null && tz.IsInDST (tzRule, stdUtcDateTime) && tz.IsInDST (tzRule, dstUtcDateTime)) {
+                       if (tzRule != null && tz.IsInDST (tzRule, stdUtcDateTime)) {
+                               // Replicate what .NET does when given a time which falls into the hour which is lost when
+                               // DST starts. isDST should always be true but the offset should be BaseUtcOffset without the
+                               // DST delta while in that hour.
                                isDST = true;
-                               return tz.BaseUtcOffset + tzRule.DaylightDelta;
+                               if (tz.IsInDST (tzRule, dstUtcDateTime)) {
+                                       return tz.BaseUtcOffset + tzRule.DaylightDelta;
+                               } else {
+                                       return tz.BaseUtcOffset;
+                               }
                        }
 
                        return tz.BaseUtcOffset;
@@ -951,12 +965,17 @@ namespace System
                        } else {
                                AdjustmentRule first = null, last = null;
 
+                               // Rule start/end dates are either very specific or very broad depending on the platform
+                               //   2015-10-04..2016-04-03 - Rule for a time zone in southern hemisphere on non-Windows platforms
+                               //   2016-03-27..2016-10-03 - Rule for a time zone in northern hemisphere on non-Windows platforms
+                               //   0001-01-01..9999-12-31 - Rule for a time zone on Windows
+
                                foreach (var rule in GetAdjustmentRules ()) {
-                                       if (rule.DateStart.Year != year && rule.DateEnd.Year != year)
+                                       if (rule.DateStart.Year > year || rule.DateEnd.Year < year)
                                                continue;
-                                       if (rule.DateStart.Year == year)
+                                       if (rule.DateStart.Year <= year && (first == null || rule.DateStart.Year > first.DateStart.Year))
                                                first = rule;
-                                       if (rule.DateEnd.Year == year)
+                                       if (rule.DateEnd.Year >= year && (last == null || rule.DateEnd.Year < last.DateEnd.Year))
                                                last = rule;
                                }
 
@@ -1165,16 +1184,27 @@ namespace System
                                        return false;
                        }
 
+                       var inDelta = false;
                        for (var i =  transitions.Count - 1; i >= 0; i--) {
                                var pair = transitions [i];
                                DateTime ttime = pair.Key;
                                TimeType ttype = pair.Value;
 
-                               if (ttime > date)
+                               var delta =  new TimeSpan (0, 0, ttype.Offset) - BaseUtcOffset;
+
+                               if ((ttime + delta) > date) {
+                                       inDelta = ttime <= date;
                                        continue;
+                               }
 
                                offset =  new TimeSpan (0, 0, ttype.Offset);
-                               isDst = ttype.IsDst;
+                               if (inDelta) {
+                                       // Replicate what .NET does when given a time which falls into the hour which is lost when
+                                       // DST starts. isDST should be true but the offset should be the non-DST offset.
+                                       isDst = transitions [i - 1].Value.IsDst;
+                               } else {
+                                       isDst = ttype.IsDst;
+                               }
 
                                return true;
                        }
index 3cf08ae352089a434b6c8ac006bf6ab5e9c6e1a3..f233bec088e123de8984765477eac5827e41380f 100644 (file)
@@ -70,6 +70,18 @@ namespace System {
                {
                        return Append (new Text.StringBuilder ()).ToString ();
                }
+
+               public int Rank {
+                       get {
+                               return dimensions;
+                       }
+               }
+
+               public bool IsBound {
+                       get {
+                               return bound;
+                       }
+               }
        }
 
        internal class PointerSpec : ModifierSpec
index 7ba2a7abd4c24423c204ddc4c898fa2a7afeee7f..cfbb19afb347b281de4426a9e4fc3772eb0a4746 100644 (file)
@@ -54,7 +54,7 @@ namespace System
                }
 
                //Constructors
-#if NET_2_1
+#if MOBILE
                protected WeakReference ()
                {
                }
index 2e8b643e3341b2beff1ed608ac3de5e292f6ede4..10ba8db45e5afdda5b1afc90d3892f5a6e649e0b 100755 (executable)
@@ -26,7 +26,7 @@
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
-#if !NET_2_1
+#if !MOBILE
 using System.Runtime.InteropServices;
 using System.Text;
 namespace System {
index 37c71de14bf3ce011d94bf4a11eab28e13c212ac..8cadc0f33135cecaff2bd5fb550d34d4ea0ebdcd 100644 (file)
@@ -159,7 +159,7 @@ namespace System
                [method: SecurityPermission (SecurityAction.LinkDemand, ControlAppDomain = true)]
                event UnhandledExceptionEventHandler UnhandledException;
 
-#if !NET_2_1
+#if !MOBILE
                void GetIDsOfNames ([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId);
 
                void GetTypeInfo (uint iTInfo, uint lcid, IntPtr ppTInfo);
index 7479bc775b28da65130781710df3ce18d64e9e33..7054084409dab3c72f7be13a1ddc4df6b7c49d9f 100755 (executable)
@@ -679,6 +679,7 @@ namespace MonoTests.Microsoft.Win32
                                        subkey.Close ();
                                if (key != null)
                                        key.Close ();
+                               Registry.CurrentUser.DeleteSubKeyTree (subKeyName, false);
                        }
                }
 
@@ -699,6 +700,7 @@ namespace MonoTests.Microsoft.Win32
                                        subkey.Close ();
                                if (key != null)
                                        key.Close ();
+                               Registry.CurrentUser.DeleteSubKeyTree (subKeyName, false);
                        }
                }
 
@@ -708,14 +710,15 @@ namespace MonoTests.Microsoft.Win32
                        RegistryKey key = null;
                        RegistryKey key2 = null;
                        RegistryKey subkey = null;
-                       string subKeyName = "VolatileKey";
+                       string subKeyNameVolatile = "VolatileKey";
+                       string subKeyNameNonVolatile = "NonVolatileKey";
 
                        try {
                                // 
                                // Create a volatile key and try to open it as a normal one
                                //
-                               key = Registry.CurrentUser.CreateSubKey (subKeyName, RegistryKeyPermissionCheck.Default, RegistryOptions.Volatile);
-                               key2 = Registry.CurrentUser.CreateSubKey (subKeyName, RegistryKeyPermissionCheck.Default, RegistryOptions.None);
+                               key = Registry.CurrentUser.CreateSubKey (subKeyNameVolatile, RegistryKeyPermissionCheck.Default, RegistryOptions.Volatile);
+                               key2 = Registry.CurrentUser.CreateSubKey (subKeyNameVolatile, RegistryKeyPermissionCheck.Default, RegistryOptions.None);
                                Assert.AreEqual (key.Name, key2.Name, "A0");
 
                                subkey = key2.CreateSubKey ("Child", RegistryKeyPermissionCheck.Default, RegistryOptions.Volatile);
@@ -729,10 +732,9 @@ namespace MonoTests.Microsoft.Win32
                                // 
                                // Create a non-volatile key and try to open it as a volatile one
                                //
-                               subKeyName = "NonVolatileKey";
-                               key2 = Registry.CurrentUser.CreateSubKey (subKeyName, RegistryKeyPermissionCheck.Default, RegistryOptions.None);
+                               key2 = Registry.CurrentUser.CreateSubKey (subKeyNameNonVolatile, RegistryKeyPermissionCheck.Default, RegistryOptions.None);
                                key2.SetValue ("Name", "Mono");
-                               key = Registry.CurrentUser.CreateSubKey (subKeyName, RegistryKeyPermissionCheck.Default, RegistryOptions.Volatile);
+                               key = Registry.CurrentUser.CreateSubKey (subKeyNameNonVolatile, RegistryKeyPermissionCheck.Default, RegistryOptions.Volatile);
                                Assert.AreEqual (key.Name, key2.Name, "B0");
                                Assert.AreEqual ("Mono", key.GetValue ("Name"), "#B1");
                                Assert.AreEqual ("Mono", key2.GetValue ("Name"), "#B2");
@@ -746,7 +748,7 @@ namespace MonoTests.Microsoft.Win32
                                //
                                key.Close ();
                                key2.Close ();
-                               key = Registry.CurrentUser.CreateSubKey (subKeyName, RegistryKeyPermissionCheck.Default, RegistryOptions.Volatile);
+                               key = Registry.CurrentUser.CreateSubKey (subKeyNameNonVolatile, RegistryKeyPermissionCheck.Default, RegistryOptions.Volatile);
                                Assert.AreEqual ("Mono", key.GetValue ("Name"), "#C0");
                                Assert.AreEqual (true, key.OpenSubKey ("Child") != null, "#C1");
                        } finally {
@@ -756,6 +758,8 @@ namespace MonoTests.Microsoft.Win32
                                        key.Close ();
                                if (key2 != null)
                                        key2.Close ();
+                               Registry.CurrentUser.DeleteSubKeyTree (subKeyNameVolatile, false);
+                               Registry.CurrentUser.DeleteSubKeyTree (subKeyNameNonVolatile, false);
                        }
                }
 
index f02a6a7db40e47092dc2b446e020f1dc3992c20f..4ac94d59e1f5ca9594b4cc959290a306015c8506 100644 (file)
@@ -4,10 +4,6 @@ using System.Text;
 using NUnit.Framework;
 using Mono;
 
-#if !MOBILE
-using NUnit.Framework.SyntaxHelpers;
-#endif
-
 namespace MonoTests.Mono {
 
        [TestFixture]
index 70c250d015da682354eb25b303d108380f06759e..75b2de89aac8ac5b700f448ecc8bc970d3bfea0c 100644 (file)
@@ -32,9 +32,6 @@ using System.Collections.Concurrent;
 
 using NUnit;
 using NUnit.Framework;
-#if !MOBILE
-using NUnit.Framework.SyntaxHelpers;
-#endif
 
 namespace MonoTests.System.Collections.Concurrent
 {
index 9cd2d1e11136e2e8cb6841595af01cb0ba7f71e9..4bf774937d5221a767dc1194876eb9e059c817b8 100644 (file)
@@ -30,9 +30,6 @@ using System.Collections.Generic;
 using System.Collections.Concurrent;
 
 using NUnit.Framework;
-#if !MOBILE
-using NUnit.Framework.SyntaxHelpers;
-#endif
 
 namespace MonoTests.System.Collections.Concurrent
 {
index b5d78b7571eb7790a9669ef86e28fd90d39d942e..d347fb619657593e29a14d7aba9cd91ccd61aa8e 100644 (file)
@@ -53,7 +53,6 @@ namespace MonoTests.System.Collections.Generic
                        }
                }
 
-#if NET_4_5
                [Test]
                public void Create ()
                {
@@ -70,7 +69,6 @@ namespace MonoTests.System.Collections.Generic
                        } catch (ArgumentNullException) {
                        }
                }
-#endif
 
                [Test]
                public void DefaultComparer_UserComparable ()
index 364a8b3f955944c029f0cfa67784d550a1643701..b2a720650f5f748208d1780beb7f1f1280fb6667 100644 (file)
@@ -12,6 +12,7 @@ using System.Globalization;
 using System.IO;
 using System.Runtime.Serialization.Formatters.Binary;
 using System.Threading;
+using System.Threading.Tasks;
 
 using NUnit.Framework;
 
@@ -623,7 +624,6 @@ namespace MonoTests.System.Globalization
                        Assert.IsFalse (zh2.Equals (zh1), "#2");
                }
 
-#if NET_4_5
                CountdownEvent barrier = new CountdownEvent (3);
                AutoResetEvent[] evt = new AutoResetEvent [] { new AutoResetEvent (false), new AutoResetEvent (false), new AutoResetEvent (false), new AutoResetEvent (false)};
 
@@ -728,21 +728,42 @@ namespace MonoTests.System.Globalization
                }
 
                [Test]
-               public void DefaultThreadCurrentCultureAndNumberFormaters () {
+               public void DefaultThreadCurrentCultureIsIgnoredWhenCultureFlowsToThread ()
+               {
                        string us_str = null;
                        string br_str = null;
+
                        var thread = new Thread (() => {
                                CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("en-US");
                                us_str = 100000.ToString ("C");
                                CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("pt-BR");
                                br_str = 100000.ToString ("C");
                        });
+
+                       var expected = 100000.ToString ("C");
+
                        thread.Start ();
-                       thread.Join ();
+                       Assert.IsTrue (thread.Join (5000), "#0");
                        CultureInfo.DefaultThreadCurrentCulture = null;
-                       Assert.AreEqual ("$100,000.00", us_str, "#1");
-                       Assert.AreEqual ("R$ 100.000,00", br_str, "#2");
+                       Assert.AreEqual (expected, us_str, "#1");
+                       Assert.AreEqual (expected, br_str, "#2");
+               }
+
+               [Test]
+               public void FlowCultureInfoFromParentThreadSinceNet46 ()
+               {
+                       if (SynchronizationContext.Current != null) {
+                               Assert.Ignore ();
+                               return;
+                       }
+
+                       Func<Task> f = async () => {
+                               Thread.CurrentThread.CurrentUICulture = new CultureInfo ("pt-BR");
+                               await Task.Yield ();
+                               Assert.AreEqual ("pt-BR", Thread.CurrentThread.CurrentUICulture.Name);
+                       };
+
+                       Assert.IsTrue (f ().Wait (5 * 1000), "#1");
                }
-#endif
        }
 }
index 3ec70c82c26faa1c54f5880b590887d24e4726ca..a343cbe58b51a0360024b6b1f9ef8e64b7d768da 100644 (file)
@@ -68,8 +68,9 @@ namespace MonoTests.System.IO.IsolatedStorageTest {
                public void Constructor_StringMode ()
                {
                        string test = "string-filemode";
-                       IsolatedStorageFileStream isfs = new IsolatedStorageFileStream (test, FileMode.Create);
-                       CheckCommonDetails (test, isfs, true, true);
+                       using (var isfs = new IsolatedStorageFileStream (test, FileMode.Create)) {
+                               CheckCommonDetails (test, isfs, true, true);
+                       }
                }
 
                [Test]
@@ -83,8 +84,9 @@ namespace MonoTests.System.IO.IsolatedStorageTest {
                public void Constructor_StringModeAccess ()
                {
                        string test = "string-filemode-fileaccess";
-                       IsolatedStorageFileStream isfs = new IsolatedStorageFileStream (test, FileMode.Create, FileAccess.ReadWrite);
-                       CheckCommonDetails (test, isfs, true, true);
+                       using (var isfs = new IsolatedStorageFileStream (test, FileMode.Create, FileAccess.ReadWrite)) {
+                               CheckCommonDetails (test, isfs, true, true);
+                       }
                }
 
                [Test]
@@ -98,22 +100,24 @@ namespace MonoTests.System.IO.IsolatedStorageTest {
                public void Constructor_StringModeAccessShare ()
                {
                        string test = "string-filemode-fileaccess-fileshare";
-                       IsolatedStorageFileStream isfs = new IsolatedStorageFileStream (test, FileMode.Create, FileAccess.Write, FileShare.Read);
-                       CheckCommonDetails (test, isfs, false, true);
+                       using (var isfs = new IsolatedStorageFileStream (test, FileMode.Create, FileAccess.Write, FileShare.Read)) {
+                               CheckCommonDetails (test, isfs, false, true);
+                       }
                }
 
                [Test]
                [ExpectedException (typeof (IsolatedStorageException))]
                public void Handle ()
                {
-                       IsolatedStorageFileStream isfs = new IsolatedStorageFileStream ("handle", FileMode.Create);
-                       IntPtr p = isfs.Handle;
+                       using (var isfs = new IsolatedStorageFileStream ("handle", FileMode.Create)) {
+                               IntPtr p = isfs.Handle;
+                       }
                }
 
                [Test]
                public void RootPath ()
                {
-                       new IsolatedStorageFileStream ("/rootpath", FileMode.Create);
+                       new IsolatedStorageFileStream ("/rootpath", FileMode.Create).Close ();
                }
 
                [Test]
index 66eb27ed32407833e14b69f9fc6cb357b4f3d7ab..474a3bba20c312e1d321d279cbce27bf2a997e15 100644 (file)
@@ -124,7 +124,7 @@ namespace MonoTests.System.IO.IsolatedStorageTest {
                        IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForAssembly ();
                        Assert.AreEqual (Int64.MaxValue, isf.MaximumSize, "MaximumSize");
                        Assert.AreEqual (IsolatedStorageScope.User | IsolatedStorageScope.Assembly, isf.Scope, "Scope");
-#if !NET_2_1
+#if !MOBILE
                        Assert.IsTrue ((isf.AssemblyIdentity is Url), "AssemblyIdentity");
                        // note: mono transforms the CodeBase into uppercase
                        // for net 1.1 which uses file:// and not file:///
@@ -157,7 +157,7 @@ namespace MonoTests.System.IO.IsolatedStorageTest {
                        IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForDomain ();
                        Assert.AreEqual (Int64.MaxValue, isf.MaximumSize, "MaximumSize");
                        Assert.AreEqual (IsolatedStorageScope.User | IsolatedStorageScope.Domain | IsolatedStorageScope.Assembly, isf.Scope, "Scope");
-#if !NET_2_1
+#if !MOBILE
                        Assert.IsTrue ((isf.AssemblyIdentity is Url), "AssemblyIdentity");
                        // note: mono transforms the CodeBase into uppercase
                        // for net 1.1 which uses file:// and not file:///
@@ -198,7 +198,7 @@ namespace MonoTests.System.IO.IsolatedStorageTest {
                {
                        IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication ();
                        Assert.AreEqual (Int64.MaxValue, isf.MaximumSize, "MaximumSize");
-#if !NET_2_1
+#if !MOBILE
                        Assert.AreEqual (IsolatedStorageScope.User | IsolatedStorageScope.Assembly, isf.Scope, "Scope");
                        Assert.IsTrue ((isf.AssemblyIdentity is Url), "AssemblyIdentity");
                        Assert.IsTrue ((isf.AssemblyIdentity.ToString ().IndexOf (Assembly.GetExecutingAssembly ().CodeBase) > 0), "Url");
@@ -206,7 +206,7 @@ namespace MonoTests.System.IO.IsolatedStorageTest {
                        Assert.IsTrue ((isf.CurrentSize >= 0), "CurrentSize");
                }
                
-#if !NET_2_1
+#if !MOBILE
                [Test]
                [ExpectedException (typeof (IsolatedStorageException))]
                public void GetUserStoreForApplication_AssemblyIdentity ()
@@ -238,7 +238,7 @@ namespace MonoTests.System.IO.IsolatedStorageTest {
                        IsolatedStorageScope scope = IsolatedStorageScope.User | IsolatedStorageScope.Domain | IsolatedStorageScope.Assembly;
                        IsolatedStorageFile isf = IsolatedStorageFile.GetStore (scope, typeof (Zone), typeof (Zone));
                        Assert.AreEqual (Int64.MaxValue, isf.MaximumSize, "MaximumSize");
-#if !NET_2_1
+#if !MOBILE
                        Assert.AreEqual (IsolatedStorageScope.User | IsolatedStorageScope.Domain | IsolatedStorageScope.Assembly, isf.Scope, "Scope");
                        Assert.IsTrue ((isf.AssemblyIdentity is Zone), "AssemblyIdentity");
                        Assert.IsTrue ((isf.AssemblyIdentity.ToString ().IndexOf ("MyComputer") > 0), "Zone - Assembly");
@@ -265,7 +265,7 @@ namespace MonoTests.System.IO.IsolatedStorageTest {
                        IsolatedStorageFile isf = IsolatedStorageFile.GetStore (scope, typeof (StrongName), typeof (Url));
                        Assert.AreEqual (Int64.MaxValue, isf.MaximumSize, "MaximumSize");
                        Assert.AreEqual (scope, isf.Scope, "Scope");
-#if !NET_2_1
+#if !MOBILE
                        Assert.IsTrue ((isf.AssemblyIdentity is Url), "AssemblyIdentity");
                        // note: mono transforms the CodeBase into uppercase
                        // for net 1.1 which uses file:// and not file:///
@@ -361,7 +361,7 @@ namespace MonoTests.System.IO.IsolatedStorageTest {
 
                        // Maximum size for Internet isn't (by default) Int64.MaxValue
                        Assert.AreEqual (scope, isf.Scope, "Scope");
-#if !NET_2_1
+#if !MOBILE
                        Assert.IsTrue ((isf.AssemblyIdentity is Zone), "AssemblyIdentity");
                        Assert.IsTrue ((isf.AssemblyIdentity.ToString ().IndexOf ("Intranet") > 0), "Zone - Assembly");
                        Assert.IsTrue ((isf.DomainIdentity is Zone), "DomainIdentity");
@@ -577,7 +577,7 @@ namespace MonoTests.System.IO.IsolatedStorageTest {
                {
                        IsolatedStorageScope scope = IsolatedStorageScope.User | IsolatedStorageScope.Roaming | IsolatedStorageScope.Assembly | IsolatedStorageScope.Domain;
                        IsolatedStorageFile isf = IsolatedStorageFile.GetStore (scope, null, null);
-#if !NET_2_1
+#if !MOBILE
                        Assert.AreEqual (typeof (Url), isf.AssemblyIdentity.GetType (), "AssemblyIdentity");
                        Assert.AreEqual (typeof (Url), isf.DomainIdentity.GetType (), "DomainIdentity");
 #endif
index d6aacac5dc8ba3815d2c0c3e72b7200bf3249b69..34a431aabd715880e7c6962ead01cbeb150e68d2 100644 (file)
@@ -168,6 +168,8 @@ namespace MonoTests.System.IO
                                        info = new DirectoryInfo ("/test/");
                                        Assert.AreEqual ("test", info.Name, "#4");
                                } else {
+                                       Directory.SetCurrentDirectory (@"C:\");
+
                                        info = new DirectoryInfo (@"c:");
                                        Assert.AreEqual (@"C:\", info.Name, "#4");
 
@@ -217,6 +219,8 @@ namespace MonoTests.System.IO
                                        Assert.IsNotNull (info.Parent, "#7a");
                                        Assert.AreEqual ("/", info.Parent.FullName, "#7b");
                                } else {
+                                       Directory.SetCurrentDirectory (@"C:\");
+
                                        info = new DirectoryInfo (@"c:");
                                        Assert.IsNull (info.Parent, "#4");
 
@@ -418,6 +422,8 @@ namespace MonoTests.System.IO
                                di = new DirectoryInfo ("/test/");
                                Assert.AreEqual ("/test/", di.FullName, "#D4");
                        } else {
+                               Directory.SetCurrentDirectory (@"C:\");
+
                                di = new DirectoryInfo (@"c:");
                                Assert.AreEqual (@"C:\", di.FullName, "#D1");
 
index 50755fa0dc5bf4ac8b4ee615910d3872d75d1dd4..e4000ea33d81b2877940c9a4dcd3007d63dca7a9 100644 (file)
@@ -758,9 +758,9 @@ namespace MonoTests.System.IO
                                try {
                                        info.MoveTo (destFile);
                                        Assert.Fail ("#1");
-                               } catch (FileNotFoundException ex) {
+                               } catch (DirectoryNotFoundException ex) {
                                        // Could not find a part of the path
-                                       Assert.AreEqual (typeof (FileNotFoundException), ex.GetType (), "#2");
+                                       Assert.AreEqual (typeof (DirectoryNotFoundException), ex.GetType (), "#2");
                                        Assert.IsNull (ex.InnerException, "#3");
                                        Assert.IsNotNull (ex.Message, "#4");
                                }
index bd114bb5fb49b2ab7ba6c7c5cbbe4a20a9792f58..3800701e3282ef5dba0429be9c8dbacce7d9932d 100644 (file)
@@ -17,7 +17,7 @@ namespace MonoTests.System.IO
        [TestFixture]
        public class FileStreamWithClosedSafeHandleTests
        {
-#if !NET_2_1
+#if !MOBILE
                private FileStream GetFileStreamWithClosedHandle ()
                {
                        var fs1 = new FileStream ("test2", FileMode.OpenOrCreate);
index 008930061e45c2c6edc9b06b9cce89f4c976a6e7..b07955903f41a1946e709d8568c1fa42c8c02529 100644 (file)
@@ -25,10 +25,6 @@ namespace MonoTests.System.IO
        {
                string TempFolder = Path.Combine (Path.GetTempPath (), "MonoTests.System.IO.Tests");
                static readonly char DSC = Path.DirectorySeparatorChar;
-               static bool MacOSX = false;
-
-               [DllImport ("libc")]
-               static extern int uname (IntPtr buf);
 
                [TearDown]
                public void TearDown ()
@@ -44,13 +40,6 @@ namespace MonoTests.System.IO
                                Directory.Delete (TempFolder, true);
 
                        Directory.CreateDirectory (TempFolder);
-#if !MOBILE                    
-                       // from XplatUI.cs
-                       IntPtr buf = Marshal.AllocHGlobal (8192);
-                       if (uname (buf) == 0)
-                               MacOSX = Marshal.PtrToStringAnsi (buf) == "Darwin";
-                       Marshal.FreeHGlobal (buf);
-#endif
                }
 
                public void TestCtr ()
index f552e933a65290eca43c3c6cd3ffa9df00148d7d..b7c472b4fdd8308a3f13fede8ce20f664ca38f6e 100644 (file)
@@ -17,9 +17,7 @@ using System.IO;
 using System.Runtime.Serialization.Formatters.Binary;
 using System.Text;
 using System.Threading;
-#if NET_4_5
 using System.Threading.Tasks;
-#endif
 
 using NUnit.Framework;
 
@@ -1119,7 +1117,6 @@ namespace MonoTests.System.IO
                        Assert.IsTrue (ms.DisposedCalled, "After");
                }
 
-#if NET_4_5
                [Test]
                public void ReadAsync ()
                {
@@ -1323,6 +1320,5 @@ namespace MonoTests.System.IO
                                return true;
                        }
                }
-#endif
        }
 }
index c3ab9935350c9b1f3071960bda46d06d97b74d81..7b83492b998c541237412e89f84535c6f479001b 100644 (file)
@@ -37,6 +37,7 @@ namespace MonoTests.System.IO
                static string path3;
                static OsType OS;
                static char DSC = Path.DirectorySeparatorChar;
+               static char ADSC = Path.AltDirectorySeparatorChar;
 
                [SetUp]
                public void SetUp ()
@@ -359,6 +360,12 @@ namespace MonoTests.System.IO
                        }
                }
 
+               [Test]
+               public void GetDirectoryName_Replaces_AltDirectorySeparatorChar ()
+               {
+                       Assert.AreEqual ($"foo{DSC}bar", Path.GetDirectoryName ($"foo{ADSC}bar{ADSC}dingus"), "#1");
+               }
+
                [Test]
                public void GetExtension ()
                {
index 54e5e04243583a489dff3547f3eb5d601d8d08fa..eb29cfa9e4b5f26aef1d9cc09feb0159f0396ba7 100644 (file)
@@ -9,9 +9,7 @@
 using System;
 using System.IO;
 using System.Text;
-#if NET_4_5
 using System.Threading.Tasks;
-#endif
 
 using NUnit.Framework;
 
@@ -845,7 +843,6 @@ public class StreamReaderTest
                Assert.AreEqual (0, StreamReader.Null.ReadBlock (buffer, 0, buffer.Length));
        }
 
-#if NET_4_5
        [Test]
        public void ReadLineAsync ()
        {
@@ -866,7 +863,6 @@ public class StreamReaderTest
                Assert.IsTrue (result.Wait (3000), "#1");
                Assert.AreEqual ("ab" + Environment.NewLine, result.Result);
        }
-#endif
 }
 
 class MyStream : Stream {
index e22a13736fd5c021a20570dea5c1ee1ab9a29486..a7ad4ea65e45d0a83d65324cf3895bd1209a6fa0 100644 (file)
@@ -120,7 +120,6 @@ namespace MonoTests.System.IO
                        Assert.IsFalse (s.CanRead, "#1");
                }
 
-#if NET_4_5
                [Test]
                public void CopyAsync ()
                {
@@ -211,6 +210,5 @@ namespace MonoTests.System.IO
                        } catch (AggregateException) {
                        }
                }
-#endif
        }
 }
index 661cffc18c61370723ed9b5137ce483534128833..a0afe231788c15e8fe1d95f9dbdf8e0681e60223 100644 (file)
@@ -1051,7 +1051,6 @@ namespace MonoTests.System.IO
                Assert.AreEqual (5, ms.Position, "#2");
        }
 
-#if NET_4_5
        [Test]
        public void FlushAsync ()
        {
@@ -1098,7 +1097,6 @@ namespace MonoTests.System.IO
                Assert.IsTrue (t.Wait (1000), "#5");
        }
 
-#endif
 
        // TODO - Write - test errors, functionality tested in TestFlush.
 }
index 0a06a7e4231420b0ba2c62fc047fa93ace9770f8..f59f39301876c5dcbbd4f9164c122c672937704e 100644 (file)
@@ -99,6 +99,12 @@ public class AssemblyBuilderTest
                return mb;
        }
 
+       [Test]
+       public void DefaultCtor ()
+       {
+               Assert.IsNotNull (ab.Evidence, "#1");
+       }
+
        [Test]
        [Category ("NotWorking")]
        public void ManifestModule ()
index c14a6c388f2d7ead77af118aa26a8f0c12cde2dd..e40d8ef72dcd064899c268727ee80461d2d0055f 100644 (file)
@@ -656,7 +656,7 @@ namespace MonoTests.System.Reflection.Emit
                                Assert.AreEqual ("FOO", ((ObsoleteAttribute) attrs [0]).Message, "#B3");
                        }
                }
-#if !NET_2_1
+#if !MOBILE
                [Test]
                [ExpectedException (typeof (InvalidOperationException))]
                public void TestAddDeclarativeSecurityAlreadyCreated ()
index 7f381d63c86c36a38acf4145d9ea0d0956d1f2fd..8e67c976f1e3bb267cc8781bbd720bd0561e2b2b 100644 (file)
@@ -506,6 +506,8 @@ namespace MonoTests.System.Reflection.Emit
                }
 
                [Test]
+               // The token is not guaranteed to be 0x0a000001
+               [Category ("NotWorking")]
                public void ResolveFieldMemberRefWithGenericArguments ()
                {
                        var assembly = genAssembly ();
@@ -533,6 +535,8 @@ namespace MonoTests.System.Reflection.Emit
                }
 
                [Test]
+               // The token is not guaranteed to be 0x0a000002
+               [Category ("NotWorking")]
                public void ResolveMethodMemberRefWithGenericArguments ()
                {
                        var assembly = genAssembly ();
@@ -566,6 +570,8 @@ namespace MonoTests.System.Reflection.Emit
                }
 
                [Test]
+               // The token is not guaranteed to be 0x2b000001
+               [Category("NotWorking")]
                public void ResolveMethodSpecWithGenericArguments ()
                {
                        var assembly = genAssembly ();
@@ -794,5 +800,18 @@ namespace MonoTests.System.Reflection.Emit
                        // ArgumentNullException should not occur.
                        module.GetConstructorToken (method, null);
                }
+
+               [Test]
+               public void GetType ()
+               {
+                       AssemblyBuilder ab = genAssembly ();
+                       ModuleBuilder module = ab.DefineDynamicModule ("foo.dll", "foo.dll");
+                       TypeBuilder tb = module.DefineType ("t1", TypeAttributes.Public);
+
+                       Assert.AreEqual ("t1[]", module.GetType ("t1[]").FullName);
+                       Assert.AreEqual ("t1*", module.GetType ("t1*").FullName);
+                       Assert.AreEqual ("t1&", module.GetType ("t1&").FullName);
+                       Assert.AreEqual ("t1[]&", module.GetType ("t1[]&").FullName);
+               }
        }
 }
index d3115c76913f1792f567eb5069b74d9e4fa77897..ac3b1f149fa3d8e587cb8cf5a691fcc62eef46a5 100644 (file)
@@ -112,7 +112,7 @@ namespace MonoTests.System.Reflection.Emit
                                Thread.GetDomain ().DefineDynamicAssembly (
                                        assemblyName, AssemblyBuilderAccess.RunAndSave, Path.GetTempPath ());
 
-                       module = assembly.DefineDynamicModule ("module1");
+                       module = assembly.DefineDynamicModule (ASSEMBLY_NAME, ASSEMBLY_NAME + ".dll");
                }
 
                static int typeIndexer = 0;
@@ -1827,6 +1827,23 @@ namespace MonoTests.System.Reflection.Emit
                        // TODO:
                }
 
+               [Test]
+               public void NestedTypeSave () {
+                       var tb = module.DefineType (genTypeName ());
+
+                       var tbuilder = tb.DefineNestedType ("Test.CodeGen", TypeAttributes.Public | TypeAttributes.Class);
+                       var entryp = tbuilder.DefineMethod("Main", MethodAttributes.Public | MethodAttributes.Static, typeof (void), null);
+                       var ilg = entryp.GetILGenerator (128);
+                       ilg.Emit (OpCodes.Ldtoken, tb);
+                       ilg.Emit (OpCodes.Pop);
+                       ilg.Emit (OpCodes.Ret);
+
+                       tbuilder.CreateType ();
+                       tb.CreateType ();
+
+                       assembly.Save (ASSEMBLY_NAME + ".dll");
+               }
+
                [Test]
                public void DefinePInvokeMethod_Name_NullChar ()
                {
@@ -9094,6 +9111,8 @@ namespace MonoTests.System.Reflection.Emit
 
 
                [Test]
+               // Casts don't work with unfinished types
+               [Category ("NotWorking")]
                [Category ("NotDotNet")]
                public void IsAssignableFrom_NotCreated_Array ()
                {
@@ -9746,6 +9765,33 @@ namespace MonoTests.System.Reflection.Emit
                        //Console.WriteLine (res[0]);
                }
 
+               [Test]
+               public void FieldWithInitializedDataWorksWithCompilerRuntimeHelpers2 ()
+               {
+                       TypeBuilder tb = module.DefineType ("Type1", TypeAttributes.Public);
+                       var garg = tb.DefineGenericParameters ("T") [0];
+                       FieldBuilder fb = tb.DefineInitializedData ("Foo", new byte [] {1,2,3,4}, FieldAttributes.Static|FieldAttributes.Public);
+                       tb.CreateType ();
+
+                       assembly = Thread.GetDomain ().DefineDynamicAssembly (new AssemblyName (ASSEMBLY_NAME+"2"), AssemblyBuilderAccess.RunAndSave, Path.GetTempPath ());
+                       module = assembly.DefineDynamicModule ("Instance.exe");
+
+                       TypeBuilder tb2 = module.DefineType ("Type2", TypeAttributes.Public);
+                       MethodBuilder mb = tb2.DefineMethod ("Test", MethodAttributes.Public | MethodAttributes.Static, typeof (object), new Type [0]);
+                       ILGenerator il = mb.GetILGenerator ();
+
+                       il.Emit (OpCodes.Ldc_I4_1);
+                       il.Emit (OpCodes.Newarr, typeof (int));
+                       il.Emit (OpCodes.Dup);
+                       il.Emit (OpCodes.Ldtoken, fb);
+                       il.Emit (OpCodes.Call, typeof (RuntimeHelpers).GetMethod ("InitializeArray"));
+                       il.Emit (OpCodes.Ret);
+
+                       Type t = tb2.CreateType ();
+                       int[] res = (int[])t.GetMethod ("Test").Invoke (null, new object[0]);
+                       //Console.WriteLine (res[0]);
+               }
+
                public interface IDelegateFactory
                {
                        Delegate Create (Delegate del);
index 4d8f1bf0ddace880834887a756e0b5f4aea2b91a..b707567f1de9e8bae42dce2492e7df4b572f5908 100644 (file)
@@ -1152,10 +1152,8 @@ public class AssemblyNameTest {
                Assert.IsNull (an.GetPublicKey (), "GetPublicKey");
                Assert.IsNull (an.GetPublicKeyToken (), "GetPublicKeyToken");
                Assert.AreEqual ("TestAssembly", an.ToString (), "ToString");
-#if NET_4_5
                Assert.IsNull (an.CultureName, "CultureName");
                Assert.AreEqual (AssemblyContentType.Default, an.ContentType, "ContentType");
-#endif
        }
 
        [Test] // ctor (String)
index bc3416441cfad03b93e428301df40573aaff264e..e82d81fba6185798f6112b86a0afa64a57a67b96 100644 (file)
@@ -55,14 +55,27 @@ namespace MonoTests.System.Reflection
        [TestFixture]
        public class AssemblyTest
        {
-               static string TempFolder = Path.Combine (Path.GetTempPath (),
+               static string BaseTempFolder = Path.Combine (Path.GetTempPath (),
                        "MonoTests.System.Reflection.AssemblyTest");
+               static string TempFolder;
+
+               [TestFixtureSetUp]
+               public void FixtureSetUp ()
+               {
+                       try {
+                               // Try to cleanup from any previous NUnit run.
+                               Directory.Delete (BaseTempFolder, true);
+                       } catch (Exception) {
+                       }
+               }
 
                [SetUp]
                public void SetUp ()
                {
-                       while (Directory.Exists (TempFolder))
-                               TempFolder = Path.Combine (TempFolder, "2");
+                       int i = 0;
+                       do {
+                               TempFolder = Path.Combine (BaseTempFolder, (++i).ToString());
+                       } while (Directory.Exists (TempFolder));
                        Directory.CreateDirectory (TempFolder);
                }
 
@@ -70,8 +83,8 @@ namespace MonoTests.System.Reflection
                public void TearDown ()
                {
                        try {
-                               // This throws an exception under MS.NET, since the directory contains loaded
-                               // assemblies.
+                               // This throws an exception under MS.NET and Mono on Windows,
+                               // since the directory contains loaded assemblies.
                                Directory.Delete (TempFolder, true);
                        } catch (Exception) {
                        }
@@ -410,22 +423,21 @@ namespace MonoTests.System.Reflection
                [Test] // bug #78517
                public void LoadFrom_Empty_Assembly ()
                {
-                       string tempFile = Path.GetTempFileName ();
+                       string tempFile = Path.Combine (TempFolder, Path.GetRandomFileName ());
+                       File.CreateText (tempFile).Close ();
 
                        try {
                                Assembly.LoadFrom (tempFile);
                                Assert.Fail ("#1");
                        } catch (BadImageFormatException ex) {
                                Assert.IsNull (ex.InnerException, "#2");
-                       } finally {
-                               File.Delete (tempFile);
                        }
                }
 
                [Test] // bug #78517
                public void LoadFrom_Invalid_Assembly ()
                {
-                       string tempFile = Path.GetTempFileName ();
+                       string tempFile = Path.Combine (TempFolder, Path.GetRandomFileName ());
                        using (StreamWriter sw = File.CreateText (tempFile)) {
                                sw.WriteLine ("foo");
                                sw.Close ();
@@ -436,24 +448,19 @@ namespace MonoTests.System.Reflection
                                Assert.Fail ("#1");
                        } catch (BadImageFormatException ex) {
                                Assert.IsNull (ex.InnerException, "#2");
-                       } finally {
-                               File.Delete (tempFile);
                        }
                }
 
                [Test]
                public void LoadFrom_NonExisting_Assembly ()
                {
-                       string tempFile = Path.GetTempFileName ();
-                       File.Delete (tempFile);
+                       string tempFile = Path.Combine (TempFolder, Path.GetRandomFileName ());
 
                        try {
                                Assembly.LoadFrom (tempFile);
                                Assert.Fail ("#1");
                        } catch (FileNotFoundException ex) {
                                Assert.IsNull (ex.InnerException, "#2");
-                       } finally {
-                               File.Delete (tempFile);
                        }
                }
 
@@ -520,28 +527,24 @@ namespace MonoTests.System.Reflection
                [Test]
                public void Location_Empty() {
                        string assemblyFileName = Path.Combine (
-                               Path.GetTempPath (), "AssemblyLocation.dll");
-
-                       try {
-                               AssemblyName assemblyName = new AssemblyName ();
-                               assemblyName.Name = "AssemblyLocation";
-
-                               AssemblyBuilder ab = AppDomain.CurrentDomain
-                                       .DefineDynamicAssembly (assemblyName,
-                                       AssemblyBuilderAccess.Save,
-                                       Path.GetTempPath (),
-                                       AppDomain.CurrentDomain.Evidence);
-                               ab.Save (Path.GetFileName (assemblyFileName));
-
-                               using (FileStream fs = File.OpenRead (assemblyFileName)) {
-                                       byte[] buffer = new byte[fs.Length];
-                                       fs.Read (buffer, 0, buffer.Length);
-                                       Assembly assembly = Assembly.Load (buffer);
-                                       Assert.AreEqual (string.Empty, assembly.Location);
-                                       fs.Close ();
-                               }
-                       } finally {
-                               File.Delete (assemblyFileName);
+                               TempFolder, "AssemblyLocation.dll");
+
+                       AssemblyName assemblyName = new AssemblyName ();
+                       assemblyName.Name = "AssemblyLocation";
+
+                       AssemblyBuilder ab = AppDomain.CurrentDomain
+                               .DefineDynamicAssembly (assemblyName,
+                               AssemblyBuilderAccess.Save,
+                               TempFolder,
+                               AppDomain.CurrentDomain.Evidence);
+                       ab.Save (Path.GetFileName (assemblyFileName));
+
+                       using (FileStream fs = File.OpenRead (assemblyFileName)) {
+                               byte[] buffer = new byte[fs.Length];
+                               fs.Read (buffer, 0, buffer.Length);
+                               Assembly assembly = Assembly.Load (buffer);
+                               Assert.AreEqual (string.Empty, assembly.Location);
+                               fs.Close ();
                        }
                }
 
@@ -549,56 +552,52 @@ namespace MonoTests.System.Reflection
                public void SateliteAssemblyForInMemoryAssembly ()
                {
                        string assemblyFileName = Path.Combine (
-                               Path.GetTempPath (), "AssemblyLocation1.dll");
+                               TempFolder, "AssemblyLocation1.dll");
 
-                       try {
-                               AssemblyName assemblyName = new AssemblyName ();
-                               assemblyName.Name = "AssemblyLocation1";
-
-                               AssemblyBuilder ab = AppDomain.CurrentDomain
-                                       .DefineDynamicAssembly (assemblyName,
-                                               AssemblyBuilderAccess.Save,
-                                               Path.GetTempPath ());
+                       AssemblyName assemblyName = new AssemblyName ();
+                       assemblyName.Name = "AssemblyLocation1";
 
-                               ModuleBuilder moduleBuilder = ab.DefineDynamicModule (assemblyName.Name, assemblyName.Name + ".dll");
-                               TypeBuilder typeBuilder = moduleBuilder.DefineType ("Program", TypeAttributes.Public);
+                       AssemblyBuilder ab = AppDomain.CurrentDomain
+                               .DefineDynamicAssembly (assemblyName,
+                                       AssemblyBuilderAccess.Save,
+                                       TempFolder);
 
-                               MethodBuilder methodBuilder = typeBuilder.DefineMethod ("TestCall", MethodAttributes.Public | MethodAttributes.Static, typeof(void), Type.EmptyTypes);
-                               ILGenerator gen = methodBuilder.GetILGenerator ();
+                       ModuleBuilder moduleBuilder = ab.DefineDynamicModule (assemblyName.Name, assemblyName.Name + ".dll");
+                       TypeBuilder typeBuilder = moduleBuilder.DefineType ("Program", TypeAttributes.Public);
 
-                               //
-                               //      var resourceManager = new ResourceManager (typeof (Program));
-                               //      resourceManager.GetString ("test");
-                               //
-                               gen.Emit (OpCodes.Ldtoken, typeBuilder);
-                               gen.Emit (OpCodes.Call, typeof(Type).GetMethod ("GetTypeFromHandle"));
-                               gen.Emit (OpCodes.Newobj, typeof(ResourceManager).GetConstructor (new Type[] { typeof(Type) }));
-                               gen.Emit (OpCodes.Ldstr, "test");
-                               gen.Emit (OpCodes.Callvirt, typeof(ResourceManager).GetMethod ("GetString", new Type[] { typeof(string) }));
-                               gen.Emit (OpCodes.Pop);
-                               gen.Emit (OpCodes.Ret);
+                       MethodBuilder methodBuilder = typeBuilder.DefineMethod ("TestCall", MethodAttributes.Public | MethodAttributes.Static, typeof(void), Type.EmptyTypes);
+                       ILGenerator gen = methodBuilder.GetILGenerator ();
 
-                               typeBuilder.CreateType ();
+                       //
+                       //      var resourceManager = new ResourceManager (typeof (Program));
+                       //      resourceManager.GetString ("test");
+                       //
+                       gen.Emit (OpCodes.Ldtoken, typeBuilder);
+                       gen.Emit (OpCodes.Call, typeof(Type).GetMethod ("GetTypeFromHandle"));
+                       gen.Emit (OpCodes.Newobj, typeof(ResourceManager).GetConstructor (new Type[] { typeof(Type) }));
+                       gen.Emit (OpCodes.Ldstr, "test");
+                       gen.Emit (OpCodes.Callvirt, typeof(ResourceManager).GetMethod ("GetString", new Type[] { typeof(string) }));
+                       gen.Emit (OpCodes.Pop);
+                       gen.Emit (OpCodes.Ret);
 
-                               ab.Save (Path.GetFileName (assemblyFileName));
+                       typeBuilder.CreateType ();
 
-                               using (FileStream fs = File.OpenRead (assemblyFileName)) {
-                                       byte[] buffer = new byte[fs.Length];
-                                       fs.Read (buffer, 0, buffer.Length);
-                                       Assembly assembly = Assembly.Load (buffer);
+                       ab.Save (Path.GetFileName (assemblyFileName));
 
-                                       var mm = assembly.GetType ("Program").GetMethod ("TestCall");
-                                       try {
-                                               mm.Invoke (null, null);
-                                               Assert.Fail ();
-                                       } catch (TargetInvocationException e) {
-                                               Assert.IsTrue (e.InnerException is MissingManifestResourceException);
-                                       }
+                       using (FileStream fs = File.OpenRead (assemblyFileName)) {
+                               byte[] buffer = new byte[fs.Length];
+                               fs.Read (buffer, 0, buffer.Length);
+                               Assembly assembly = Assembly.Load (buffer);
 
-                                       fs.Close ();
+                               var mm = assembly.GetType ("Program").GetMethod ("TestCall");
+                               try {
+                                       mm.Invoke (null, null);
+                                       Assert.Fail ();
+                               } catch (TargetInvocationException e) {
+                                       Assert.IsTrue (e.InnerException is MissingManifestResourceException);
                                }
-                       } finally {
-                               File.Delete (assemblyFileName);
+
+                               fs.Close ();
                        }
                }
 
@@ -607,19 +606,15 @@ namespace MonoTests.System.Reflection
                public void bug78464 ()
                {
                        string assemblyFileName = Path.Combine (
-                               Path.GetTempPath (), "bug78464.dll");
+                               TempFolder, "bug78464.dll");
 
+                       // execute test in separate appdomain to allow assembly to be unloaded
+                       AppDomain testDomain = CreateTestDomain (AppDomain.CurrentDomain.BaseDirectory, false);
+                       CrossDomainTester crossDomainTester = CreateCrossDomainTester (testDomain);
                        try {
-                               // execute test in separate appdomain to allow assembly to be unloaded
-                               AppDomain testDomain = CreateTestDomain (AppDomain.CurrentDomain.BaseDirectory, false);
-                               CrossDomainTester crossDomainTester = CreateCrossDomainTester (testDomain);
-                               try {
-                                       crossDomainTester.bug78464 (assemblyFileName);
-                               } finally {
-                                       AppDomain.Unload (testDomain);
-                               }
+                               crossDomainTester.bug78464 (assemblyFileName);
                        } finally {
-                               File.Delete (assemblyFileName);
+                               AppDomain.Unload (testDomain);
                        }
                }
 
@@ -628,36 +623,32 @@ namespace MonoTests.System.Reflection
                public void bug78465 ()
                {
                        string assemblyFileName = Path.Combine (
-                               Path.GetTempPath (), "bug78465.dll");
+                               TempFolder, "bug78465.dll");
+
+                       AssemblyName assemblyName = new AssemblyName ();
+                       assemblyName.Name = "bug78465";
+
+                       AssemblyBuilder ab = AppDomain.CurrentDomain
+                               .DefineDynamicAssembly (assemblyName,
+                               AssemblyBuilderAccess.Save,
+                               Path.GetDirectoryName (assemblyFileName),
+                               AppDomain.CurrentDomain.Evidence);
+                       ab.Save (Path.GetFileName (assemblyFileName));
+
+                       using (FileStream fs = File.OpenRead (assemblyFileName)) {
+                               byte[] buffer = new byte[fs.Length];
+                               fs.Read (buffer, 0, buffer.Length);
+                               Assembly assembly = Assembly.Load (buffer);
+                               Assert.AreEqual (string.Empty, assembly.Location, "#1");
+                               fs.Close ();
+                       }
 
+                       AppDomain testDomain = CreateTestDomain (AppDomain.CurrentDomain.BaseDirectory, false);
+                       CrossDomainTester crossDomainTester = CreateCrossDomainTester (testDomain);
                        try {
-                               AssemblyName assemblyName = new AssemblyName ();
-                               assemblyName.Name = "bug78465";
-
-                               AssemblyBuilder ab = AppDomain.CurrentDomain
-                                       .DefineDynamicAssembly (assemblyName,
-                                       AssemblyBuilderAccess.Save,
-                                       Path.GetDirectoryName (assemblyFileName),
-                                       AppDomain.CurrentDomain.Evidence);
-                               ab.Save (Path.GetFileName (assemblyFileName));
-
-                               using (FileStream fs = File.OpenRead (assemblyFileName)) {
-                                       byte[] buffer = new byte[fs.Length];
-                                       fs.Read (buffer, 0, buffer.Length);
-                                       Assembly assembly = Assembly.Load (buffer);
-                                       Assert.AreEqual (string.Empty, assembly.Location, "#1");
-                                       fs.Close ();
-                               }
-
-                               AppDomain testDomain = CreateTestDomain (AppDomain.CurrentDomain.BaseDirectory, false);
-                               CrossDomainTester crossDomainTester = CreateCrossDomainTester (testDomain);
-                               try {
-                                       crossDomainTester.bug78465 (assemblyFileName);
-                               } finally {
-                                       AppDomain.Unload (testDomain);
-                               }
+                               crossDomainTester.bug78465 (assemblyFileName);
                        } finally {
-                               File.Delete (assemblyFileName);
+                               AppDomain.Unload (testDomain);
                        }
                }
 
@@ -665,9 +656,9 @@ namespace MonoTests.System.Reflection
                [Category("MobileNotWorking")]
                public void bug78468 ()
                {
-                       string assemblyFileNameA = Path.Combine (Path.GetTempPath (),
+                       string assemblyFileNameA = Path.Combine (TempFolder,
                                "bug78468a.dll");
-                       string resourceFileName = Path.Combine (Path.GetTempPath (),
+                       string resourceFileName = Path.Combine (TempFolder,
                                "readme.txt");
 
                        using (StreamWriter sw = File.CreateText (resourceFileName)) {
@@ -675,62 +666,56 @@ namespace MonoTests.System.Reflection
                                sw.Close ();
                        }
 
-                       try {
-                               AssemblyName assemblyName = new AssemblyName ();
-                               assemblyName.Name = "bug78468a";
+                       AssemblyName assemblyName = new AssemblyName ();
+                       assemblyName.Name = "bug78468a";
 
-                               AssemblyBuilder ab = AppDomain.CurrentDomain
-                                       .DefineDynamicAssembly (assemblyName,
-                                       AssemblyBuilderAccess.Save,
-                                       Path.GetTempPath (),
-                                       AppDomain.CurrentDomain.Evidence);
-                               ab.AddResourceFile ("read", "readme.txt");
-                               ab.Save (Path.GetFileName (assemblyFileNameA));
+                       AssemblyBuilder ab = AppDomain.CurrentDomain
+                               .DefineDynamicAssembly (assemblyName,
+                               AssemblyBuilderAccess.Save,
+                               TempFolder,
+                               AppDomain.CurrentDomain.Evidence);
+                       ab.AddResourceFile ("read", "readme.txt");
+                       ab.Save (Path.GetFileName (assemblyFileNameA));
 
-                               Assembly assembly;
+                       Assembly assembly;
 
-                               using (FileStream fs = File.OpenRead (assemblyFileNameA)) {
-                                       byte[] buffer = new byte[fs.Length];
-                                       fs.Read (buffer, 0, buffer.Length);
-                                       assembly = Assembly.Load (buffer);
-                                       fs.Close ();
-                               }
+                       using (FileStream fs = File.OpenRead (assemblyFileNameA)) {
+                               byte[] buffer = new byte[fs.Length];
+                               fs.Read (buffer, 0, buffer.Length);
+                               assembly = Assembly.Load (buffer);
+                               fs.Close ();
+                       }
 
-                               Assert.AreEqual (string.Empty, assembly.Location, "#A1");
-                               string[] resNames = assembly.GetManifestResourceNames ();
-                               Assert.IsNotNull (resNames, "#A2");
-                               Assert.AreEqual (1, resNames.Length, "#A3");
-                               Assert.AreEqual ("read", resNames[0], "#A4");
-                               ManifestResourceInfo resInfo = assembly.GetManifestResourceInfo ("read");
-                               Assert.IsNotNull (resInfo, "#A5");
-                               Assert.AreEqual ("readme.txt", resInfo.FileName, "#A6");
-                               Assert.IsNull (resInfo.ReferencedAssembly, "#A7");
-                               Assert.AreEqual ((ResourceLocation) 0, resInfo.ResourceLocation, "#A8");
-                               try {
-                                       assembly.GetManifestResourceStream ("read");
-                                       Assert.Fail ("#A9");
-                               } catch (FileNotFoundException) {
-                               }
-                               try {
-                                       assembly.GetFile ("readme.txt");
-                                       Assert.Fail ("#A10");
-                               } catch (FileNotFoundException) {
-                               }
+                       Assert.AreEqual (string.Empty, assembly.Location, "#A1");
+                       string[] resNames = assembly.GetManifestResourceNames ();
+                       Assert.IsNotNull (resNames, "#A2");
+                       Assert.AreEqual (1, resNames.Length, "#A3");
+                       Assert.AreEqual ("read", resNames[0], "#A4");
+                       ManifestResourceInfo resInfo = assembly.GetManifestResourceInfo ("read");
+                       Assert.IsNotNull (resInfo, "#A5");
+                       Assert.AreEqual ("readme.txt", resInfo.FileName, "#A6");
+                       Assert.IsNull (resInfo.ReferencedAssembly, "#A7");
+                       Assert.AreEqual ((ResourceLocation) 0, resInfo.ResourceLocation, "#A8");
+                       try {
+                               assembly.GetManifestResourceStream ("read");
+                               Assert.Fail ("#A9");
+                       } catch (FileNotFoundException) {
+                       }
+                       try {
+                               assembly.GetFile ("readme.txt");
+                               Assert.Fail ("#A10");
+                       } catch (FileNotFoundException) {
+                       }
 
-                               string assemblyFileNameB = Path.Combine (Path.GetTempPath (),
-                                       "bug78468b.dll");
+                       string assemblyFileNameB = Path.Combine (TempFolder,
+                               "bug78468b.dll");
 
-                               AppDomain testDomain = CreateTestDomain (AppDomain.CurrentDomain.BaseDirectory, false);
-                               CrossDomainTester crossDomainTester = CreateCrossDomainTester (testDomain);
-                               try {
-                                       crossDomainTester.bug78468 (assemblyFileNameB);
-                               } finally {
-                                       AppDomain.Unload (testDomain);
-                                       File.Delete (assemblyFileNameB);
-                               }
+                       AppDomain testDomain = CreateTestDomain (AppDomain.CurrentDomain.BaseDirectory, false);
+                       CrossDomainTester crossDomainTester = CreateCrossDomainTester (testDomain);
+                       try {
+                               crossDomainTester.bug78468 (assemblyFileNameB);
                        } finally {
-                               File.Delete (assemblyFileNameA);
-                               File.Delete (resourceFileName);
+                               AppDomain.Unload (testDomain);
                        }
                }
 
@@ -768,8 +753,7 @@ namespace MonoTests.System.Reflection
                [Category ("NotWorking")] // patch for bug #79720 must be committed first
                public void Load_Culture ()
                {
-                       string tempDir = Path.Combine (Path.GetTempPath (),
-                               "MonoTests.System.Reflection.AssemblyTest");
+                       string tempDir = TempFolder;
                        string cultureTempDir = Path.Combine (tempDir, "nl-BE");
                        if (!Directory.Exists (cultureTempDir))
                                Directory.CreateDirectory (cultureTempDir);
@@ -866,8 +850,6 @@ namespace MonoTests.System.Reflection
                                Assert.IsTrue (cdt.AssertFileNotFoundException (aname), "#D3");
                        } finally {
                                AppDomain.Unload (ad);
-                               if (Directory.Exists (tempDir))
-                                       Directory.Delete (tempDir, true);
                        }
                }
 
@@ -875,8 +857,7 @@ namespace MonoTests.System.Reflection
                [Category ("NotWorking")] // in non-default domain, MS throws FileNotFoundException
                public void Load_Culture_Mismatch ()
                {
-                       string tempDir = Path.Combine (Path.GetTempPath (),
-                               "MonoTests.System.Reflection.AssemblyTest");
+                       string tempDir = TempFolder;
                        string cultureTempDir = Path.Combine (tempDir, "en-US");
                        if (!Directory.Exists (cultureTempDir))
                                Directory.CreateDirectory (cultureTempDir);
@@ -910,8 +891,6 @@ namespace MonoTests.System.Reflection
                                Assert.IsTrue (cdt.AssertFileNotFoundException (aname), "#B1");
                        } finally {
                                AppDomain.Unload (ad);
-                               if (Directory.Exists (tempDir))
-                                       Directory.Delete (tempDir, true);
                        }
                }
 
@@ -920,10 +899,7 @@ namespace MonoTests.System.Reflection
                [Category("MobileNotWorking")]
                public void Load_PartialVersion ()
                {
-                       string tempDir = Path.Combine (Path.GetTempPath (),
-                               "MonoTests.System.Reflection.AssemblyTest");
-                       if (!Directory.Exists (tempDir))
-                               Directory.CreateDirectory (tempDir);
+                       string tempDir = TempFolder;
 
                        AppDomain ad = CreateTestDomain (tempDir, true);
                        try {
@@ -953,8 +929,6 @@ namespace MonoTests.System.Reflection
                                Assert.IsTrue (cdt.AssertLoad (aname.FullName), "#C2");
                        } finally {
                                AppDomain.Unload (ad);
-                               if (Directory.Exists (tempDir))
-                                       Directory.Delete (tempDir, true);
                        }
                }
 
@@ -1128,22 +1102,7 @@ namespace MonoTests.System.Reflection
                [Test]
                public void bug79872 ()
                {
-                       Random rnd = new Random ();
-                       string outdir;
-                       int tries = 0;
-
-               retry:
-                       outdir = Path.Combine (Path.GetTempPath (), "bug79872-" + rnd.Next (10000, 99999));
-                       if (Directory.Exists (outdir)) {
-                               try {
-                                       Directory.Delete (outdir, true);
-                               } catch {
-                                       if (++tries <= 100)
-                                               goto retry;
-                               }
-                       }
-
-                       Directory.CreateDirectory (outdir);
+                       string outdir = TempFolder;
 
                        AssemblyName an = new AssemblyName ();
                        an.Name = "bug79872";
@@ -1175,8 +1134,6 @@ namespace MonoTests.System.Reflection
                                // swallow the rest
                        }
                        Assert.IsTrue (ok, "Complain on loading a .NET metadata file without an assembly manifest");
-
-                       Directory.Delete (outdir, true);
                }
 #endif
 
@@ -1320,7 +1277,6 @@ namespace MonoTests.System.Reflection
                        Assert.AreEqual (GetType().Assembly, a);
                }
 
-#if NET_4_5
                [Test]
                public void DefinedTypes_Equality ()
                {
@@ -1329,7 +1285,6 @@ namespace MonoTests.System.Reflection
 
                        Assert.AreSame (x1, x2, "#1");
                }
-#endif
 
                class MyAssembly : Assembly { }
 
index f16d9a2a0f22a6ca28ef676adbd626e68253139b..a2d0f7cfac42b34be0fc3dad3f25bcb4a54afd87 100644 (file)
@@ -26,7 +26,6 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if NET_4_5
 
 using System;
 using System.Reflection;
@@ -54,4 +53,3 @@ namespace MonoTests.System.Reflection
        }
 }
 
-#endif
\ No newline at end of file
index c93fecfa422ab43ebde24a1972bcf2900ddff0cd..d40ff368bc2c5faf56451a4e83e2f434a8ea49fd 100644 (file)
@@ -24,13 +24,26 @@ namespace MonoTests.System.Reflection
 [TestFixture]
 public class ModuleTest
 {
-       static string TempFolder = Path.Combine (Path.GetTempPath (), "MonoTests.System.Reflection.ModuleTest");
+       static string BaseTempFolder = Path.Combine (Path.GetTempPath (), "MonoTests.System.Reflection.ModuleTest");
+       static string TempFolder;
+
+       [TestFixtureSetUp]
+       public void FixtureSetUp ()
+       {
+               try {
+                       // Try to cleanup from any previous NUnit run.
+                       Directory.Delete (BaseTempFolder, true);
+               } catch (Exception) {
+               }
+       }
 
        [SetUp]
        public void SetUp ()
        {
-               while (Directory.Exists (TempFolder))
-                       TempFolder = Path.Combine (TempFolder, "2");
+               int i = 0;
+               do {
+                       TempFolder = Path.Combine (BaseTempFolder, (++i).ToString());
+               } while (Directory.Exists (TempFolder));
                Directory.CreateDirectory (TempFolder);
        }
 
@@ -38,8 +51,8 @@ public class ModuleTest
        public void TearDown ()
        {
                try {
-                       // This throws an exception under MS.NET, since the directory contains loaded
-                       // assemblies.
+                       // This throws an exception under MS.NET and Mono on Windows,
+                       // since the directory contains loaded assemblies.
                        Directory.Delete (TempFolder, true);
                } catch (Exception) {
                }
index d31b99fa495dd97b6ef27e31fc328755c75d8f14..c6451207442ccb028504d0bdd2655942b5f15b61 100644 (file)
@@ -71,7 +71,7 @@ namespace MonoTests.System.Reflection.Emit
 #if !MOBILE
                        Assert.AreEqual ("foo.type[[System.Double, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]", inst.FullName, "#3");
                        Assert.AreEqual ("foo.type[[System.Double, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], MonoTests.System.Reflection.Emit.MonoGenericClassTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", inst.AssemblyQualifiedName, "#4");
-#elif NET_2_1 || MOBILE
+#elif MOBILE || MOBILE
                        Assert.AreEqual ("foo.type[[System.Double, mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.String, mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]", inst.FullName, "#3");
                        Assert.AreEqual ("foo.type[[System.Double, mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.String, mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], MonoTests.System.Reflection.Emit.MonoGenericClassTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", inst.AssemblyQualifiedName, "#4");
                        Assert.AreEqual ("foo.type[System.Double,System.String]", inst.ToString (), "#5");
index 8d5fc3a921211c34cea0968954eb6806540a495c..fb2706d575b9753db0bc5597138d7baa07c910fb 100644 (file)
@@ -73,7 +73,7 @@ namespace MonoTests.System.Reflection
                        }
                }
 
-#if !NET_2_1
+#if !MOBILE
                public enum ParamEnum {
                        None = 0,
                        Foo = 1,
@@ -97,14 +97,12 @@ namespace MonoTests.System.Reflection
                        Assert.AreEqual (ParamEnum.Foo, info [5].DefaultValue, "#2");
                }
 
-#if NET_4_5
                [Test]
                public void HasDefaultValueEnum () {
                        ParameterInfo[] info = typeof (ParameterInfoTest).GetMethod ("paramMethod").GetParameters ();
 
                        Assert.IsTrue (info [5].HasDefaultValue);
                }
-#endif
 
                public static void Sample2 ([DecimalConstantAttribute(2,2,2,2,2)] decimal a, [DateTimeConstantAttribute(123456)] DateTime b) {}
 
@@ -125,7 +123,6 @@ namespace MonoTests.System.Reflection
                        Assert.AreEqual (pi [1].DefaultValue.GetType (), typeof (Missing), "#2");
                }
 
-#if NET_4_5
                [Test]
                public void TestHasDefaultValues ()
                {
@@ -135,7 +132,6 @@ namespace MonoTests.System.Reflection
                        Assert.IsFalse (pi [1].HasDefaultValue, "#2");
                        Assert.IsTrue (pi [2].HasDefaultValue, "#3");
                }
-#endif
 
                public void Sample (int a, [Optional] int b, object c = null)
                {
@@ -252,13 +248,11 @@ namespace MonoTests.System.Reflection
                        Assert.AreEqual (decimal.MaxValue, info [0].DefaultValue);
                }
 
-#if NET_4_5
                [Test]
                public void HasDefaultValueDecimal () {
                        var info = typeof (ParameterInfoTest).GetMethod ("TestC").GetParameters ();
                        Assert.IsTrue (info [0].HasDefaultValue);
                }
-#endif
 
                class TestParamAttribute : Attribute
                {
@@ -344,13 +338,11 @@ namespace MonoTests.System.Reflection
                        Assert.AreEqual (0, p.GetCustomAttributes (typeof (FlagsAttribute), false).Length, "#3");
                        Assert.AreEqual (0, p.GetOptionalCustomModifiers ().Length, "#4");
                        Assert.AreEqual (0, p.GetRequiredCustomModifiers ().Length, "#5");
-#if NET_4_5
                        try {
                                var ign = p.HasDefaultValue;
                                Assert.Fail ("#6");
                        } catch (NotImplementedException) {
                        }
-#endif
                        Assert.IsFalse (p.IsIn, "#7");
 #if FEATURE_USE_LCID
                        Assert.IsFalse (p.IsLcid, "#8");
@@ -358,13 +350,11 @@ namespace MonoTests.System.Reflection
                        Assert.IsFalse (p.IsOptional, "#9");
                        Assert.IsFalse (p.IsOut, "#10");
                        Assert.IsFalse (p.IsRetval, "#10");
-#if NET_4_5
                        try {
                                var ign = p.CustomAttributes;
                                Assert.Fail ("#11");
                        } catch (NotImplementedException) {
                        }
-#endif
                        try {
                                p.GetCustomAttributesData ();
                                Assert.Fail ("#12");
@@ -446,9 +436,7 @@ namespace MonoTests.System.Reflection
                        Assert.IsFalse (p2.IsIn, "#1");
                        p2.MyAttrsImpl = ParameterAttributes.In;
                        Assert.IsTrue (p2.IsIn, "#2");
-#if NET_4_5
                        Assert.AreEqual (p2.myList, p2.CustomAttributes, "#3");
-#endif
                }
        }
 }
index 2fe870111ca33ce341b403cb3b48534ec9033fdf..4c4388ec8b3e17bb2eef08f784b9d42e2f934610 100644 (file)
@@ -391,7 +391,12 @@ namespace MonoTests.System.Reflection
                        var p = t.GetProperty ("Prop");
                        Assert.AreEqual ("test", p.GetConstantValue (), "#1");
 
-                       File.Delete (Path.Combine (Path.GetTempPath (), an));
+                       try {
+                               // This throws an exception under MS.NET and Mono on Windows,
+                               // open files cannot be deleted. That's fine.
+                               File.Delete (Path.Combine (Path.GetTempPath (), an));
+                       } catch (Exception) {
+                       }
 
                        var pa = typeof (TestE).GetProperty ("PropE");
                        try {
index 88690944df3851ad2a9d846b0fbbae50723d8eb5..55f00dd8bede15797ed25b02495180e54f79ccfb 100644 (file)
@@ -28,15 +28,9 @@ namespace MonoTests.System.Resources
                [TestFixtureSetUp]
                public void FixtureSetUp ()
                {
-                       char ds = Path.DirectorySeparatorChar;
-                       if (ds == '/') {
-                               string base_path = Path.Combine (Directory.GetCurrentDirectory (), Path.Combine ("Test", "resources"));
-                               m_ResourceFile = Path.Combine (base_path, "MyResources.resources");
-                               m_BadResourceFile = Path.Combine (base_path, "Empty.resources");
-                       } else {
-                               m_ResourceFile = Path.Combine ("Test", Path.Combine ("resources", "MyResources.resources"));
-                               m_BadResourceFile = "resources" + ds + "Empty.resources";
-                       }
+                       string base_path = Path.Combine (Directory.GetCurrentDirectory (), Path.Combine ("Test", "resources"));
+                       m_ResourceFile = Path.Combine (base_path, "MyResources.resources");
+                       m_BadResourceFile = Path.Combine (base_path, "Empty.resources");
                }
 
                [SetUp]
index 5edb1274e33022cf25d0c464da4e3ad918d8689c..c442b3c7b890ee3eb27420618a8462692df7627a 100644 (file)
@@ -26,7 +26,6 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if NET_4_5
 
 using System;
 using System.Threading;
@@ -117,4 +116,3 @@ namespace MonoTests.System.Runtime.CompilerServices
        }
 }
 
-#endif
\ No newline at end of file
index 9234e9fc300cdbbb00d6ce0d774e4e8abcf08ab5..108680d10ad19f025c0b803d5cccceca134fac2c 100644 (file)
@@ -7,6 +7,7 @@
 
 using System;
 using System.Runtime.CompilerServices;
+using System.Threading;
 
 using NUnit.Framework;
 
@@ -45,6 +46,7 @@ namespace MonoTests.System.Runtime.CompilerServices {
                        }
                }
 
+               [Test]
                public void TestOffsetToStringData () 
                {
                        Assert.AreEqual (
@@ -52,6 +54,7 @@ namespace MonoTests.System.Runtime.CompilerServices {
                                                  RuntimeHelpers.OffsetToStringData, "OffsetToStringData is not constant");
                }
 
+               [Test]
                public void TestGetObjectValue ()
                {
                        FooStruct s1;
@@ -75,6 +78,7 @@ namespace MonoTests.System.Runtime.CompilerServices {
                        Assert.AreEqual (s2.j, "FOO");
                }
 
+               [Test]
                public void TestRunClassConstructor ()
                {
                        RuntimeHelpers.RunClassConstructor (typeof(FooClass).TypeHandle);
@@ -169,6 +173,7 @@ namespace MonoTests.System.Runtime.CompilerServices {
                        RuntimeHelpers.InitializeArray (new Fielder ().array, rfh);
                }
 
+               [Test]
                public void TestGetHashCode ()
                {
                        Assert.AreEqual (0, RuntimeHelpers.GetHashCode (null));
@@ -177,6 +182,7 @@ namespace MonoTests.System.Runtime.CompilerServices {
                        Assert.IsTrue (5 != RuntimeHelpers.GetHashCode (new FooClass ()));
                }                       
 
+               [Test]
                public void TestEquals ()
                {
                        Assert.IsTrue (RuntimeHelpers.Equals (null, null));
@@ -197,5 +203,21 @@ namespace MonoTests.System.Runtime.CompilerServices {
                        Assert.IsTrue (RuntimeHelpers.Equals (o1, o3));
                        Assert.IsTrue (!RuntimeHelpers.Equals (o1, o4));
                }
+
+               [Test]
+               public void TestEnsureSufficientExecutionStack ()
+               {
+                       var t = new Thread (() => {
+                               unsafe {
+                                       var s = stackalloc byte [1024];
+                               }
+
+                               RuntimeHelpers.EnsureSufficientExecutionStack ();
+                       });
+
+
+                       t.Start ();
+                       t.Join ();
+               }
        }
 }
index 57b1d2c27642c1dafc45d854a7ccf92f086f1cee..6a6ecc0b36d66e4bb24febc722b64536c5935179 100644 (file)
@@ -26,7 +26,6 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if NET_4_5
 
 using System;
 using System.Threading;
@@ -248,8 +247,8 @@ namespace MonoTests.System.Runtime.CompilerServices
                        return res.Result;
                }
 
-#if !MOBILE_STATIC
                [Test]
+               [Ignore ("Incompatible with nunitlite")]
                public void FinishedTaskOnCompleted ()
                {
                        var mres = new ManualResetEvent (false);
@@ -269,12 +268,10 @@ namespace MonoTests.System.Runtime.CompilerServices
 
                        mres.Set ();
                        // this will only terminate correctly if the test was not executed from the main thread
-                       // e.g. Touch.Unit defaults to run tests on the main thread and this will return false
+                       // e.g. nunitlite/Touch.Unit defaults to run tests on the main thread and this will return false
                        Assert.AreEqual (Thread.CurrentThread.IsBackground, mres2.WaitOne (2000), "#2");;
                }
 
-#endif
-
                [Test]
                public void CompletionOnSameCustomSynchronizationContext ()
                {
@@ -396,4 +393,3 @@ namespace MonoTests.System.Runtime.CompilerServices
        }
 }
 
-#endif
index 31242816cd8b55d9d5da0746dcdabb52d4b5bdf7..867a06cabc57031a5ac00b9017a0f23d4d6605ab 100644 (file)
@@ -26,7 +26,6 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if NET_4_5
 
 using System;
 using System.Threading;
@@ -173,4 +172,3 @@ namespace MonoTests.System.Runtime.CompilerServices
        }
 }
 
-#endif
\ No newline at end of file
index cc53f6a8d99a221337ae91ef80686c61ed619ceb..fbb1d821157a422ff8a4d63a007eadb5f45a24e7 100644 (file)
@@ -26,7 +26,6 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if NET_4_5
 
 using System;
 using System.Collections.Generic;
@@ -183,4 +182,3 @@ namespace MonoTests.System.Runtime.CompilerServices
        }
 }
 
-#endif
\ No newline at end of file
index 4c38e08ed56fe67b422dce6c7714467301f738c9..51f1797a2b814a7dc77ce0fbb4574cdc0ddf91c8 100644 (file)
@@ -155,6 +155,54 @@ namespace MonoTests.System.Runtime.InteropServices
                        }
                }
 
+               readonly String[] TestStrings = new String[] {
+                       "", //Empty String
+                       "Test String",
+                       "A", //Single character string
+                       "This is a very long string as it repeats itself. " +
+                       "This is a very long string as it repeats itself. " +
+                       "This is a very long string as it repeats itself. " +
+                       "This is a very long string as it repeats itself. " +
+                       "This is a very long string as it repeats itself. " +
+                       "This is a very long string as it repeats itself. " +
+                       "This is a very long string as it repeats itself. " +
+                       "This is a very long string as it repeats itself. " +
+                       "This is a very long string as it repeats itself. " +
+                       "This is a very long string as it repeats itself. " +
+                       "This is a very long string as it repeats itself. " +
+                       "This is a very long string as it repeats itself. " +
+                       "This is a very long string as it repeats itself.",
+                       "This \n is \n a \n multiline \n string",
+                       "This \0 is \0 a \0 string \0 with \0 nulls",
+                       "\0string",
+                       "string\0",
+                       "\0\0\0\0\0\0\0\0"
+               };
+
+               [Test]
+               public unsafe void PtrToStringUTF8_Test ()
+               {
+                       int i = 0; 
+                       foreach (String srcString in TestStrings)
+                       {
+                               i++;
+                               // we assume string null terminated
+                               if (srcString.Contains("\0"))
+                                       continue;
+
+                               IntPtr ptrString = Marshal.StringToAllocatedMemoryUTF8(srcString);
+                               string retString = Marshal.PtrToStringUTF8(ptrString);
+
+                               Assert.AreEqual (srcString, retString, "#" + i);
+                               if (srcString.Length > 0)
+                               {
+                                       string retString2 = Marshal.PtrToStringUTF8(ptrString, srcString.Length - 1);
+                                       Assert.AreEqual (srcString.Substring(0, srcString.Length - 1), retString2, "#s" + i);
+                               }
+                               Marshal.FreeHGlobal(ptrString);
+                       }                       
+               }
+               
                [Test]
                public unsafe void UnsafeAddrOfPinnedArrayElement ()
                {
@@ -208,8 +256,8 @@ namespace MonoTests.System.Runtime.InteropServices
                [Test]
                public void GetHINSTANCE ()
                {
-                       if (RunningOnUnix)
-                               Assert.Ignore ("GetHINSTANCE only applies to Windows.");
+                       if (RunningOnMono)
+                               Assert.Ignore ("GetHINSTANCE only applies to .NET on Windows.");
 
                        Assembly a;
                        IntPtr hinstance;
@@ -260,6 +308,15 @@ namespace MonoTests.System.Runtime.InteropServices
                        }
                }
 #endif
+
+               [Test]
+               public void GetHRForException ()
+               {
+                       Assert.AreEqual (0, Marshal.GetHRForException (null));
+                       Assert.IsTrue (Marshal.GetHRForException (new Exception ()) < 0);
+                       Assert.AreEqual (12345, Marshal.GetHRForException (new IOException ("test message", 12345)));
+               }
+
                [Test] // bug #319009
                public void StringToHGlobalUni ()
                {
@@ -298,9 +355,7 @@ namespace MonoTests.System.Runtime.InteropServices
                                Assert.AreEqual (0x1234, Marshal.ReadInt16 (ptr));
                                Assert.AreEqual (0x1234, Marshal.ReadInt16 (ptr, 0));
                                Assert.AreEqual (0x4567, Marshal.ReadInt16 (ptr, 2));
-#if NET_4_5
                                Assert.AreEqual (0x4567, Marshal.ReadInt16 ((ptr + 5)));
-#endif
                                Assert.AreEqual (0x4567, Marshal.ReadInt16 (ptr, 5));
                        } finally {
                                Marshal.FreeHGlobal (ptr);
@@ -318,9 +373,7 @@ namespace MonoTests.System.Runtime.InteropServices
                                Assert.AreEqual (0x12345678, Marshal.ReadInt32 (ptr));
                                Assert.AreEqual (0x12345678, Marshal.ReadInt32 (ptr, 0));
                                Assert.AreEqual (0x77654321, Marshal.ReadInt32 (ptr, 4));
-#if NET_4_5
                                Assert.AreEqual (0x77654321, Marshal.ReadInt32 ((ptr + 10)));
-#endif
                                Assert.AreEqual (0x77654321, Marshal.ReadInt32 (ptr, 10));
                        } finally {
                                Marshal.FreeHGlobal (ptr);
@@ -363,7 +416,6 @@ namespace MonoTests.System.Runtime.InteropServices
                }
 
                [Test]
-               [Category ("MobileNotWorking")]
                public void BSTR_Roundtrip ()
                {
                        string s = "mono";
@@ -373,7 +425,6 @@ namespace MonoTests.System.Runtime.InteropServices
                }
 
                [Test]
-               [Category ("MobileNotWorking")]
                public void StringToBSTRWithNullValues ()
                {
                        int size = 128;
@@ -671,7 +722,7 @@ namespace MonoTests.System.Runtime.InteropServices
                        }
                }
 
-#if !NET_2_1
+#if !MOBILE
                [Test]
                public void TestGetComSlotForMethodInfo ()
                {
@@ -798,10 +849,9 @@ namespace MonoTests.System.Runtime.InteropServices
                        ex = Marshal.GetExceptionForHR (E_INVALIDARG);
                        Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "E_INVALIDARG");
                }
-               bool RunningOnUnix {
+               bool RunningOnMono {
                        get {
-                               int p = (int) Environment.OSVersion.Platform;
-                               return ((p == 4) || (p == 128) || (p == 6));
+                               return (Type.GetType ("System.MonoType", false) != null);
                        }
                }
 
@@ -818,8 +868,155 @@ namespace MonoTests.System.Runtime.InteropServices
                        int nSize
                );
 #endif
+
+#if !MOBILE_STATIC
+               [StructLayout( LayoutKind.Sequential, Pack = 1 )]
+               public class FourByteStruct
+               {
+                       public UInt16 value1;
+                       public UInt16 value2;
+               }
+
+               [StructLayout( LayoutKind.Sequential, Pack = 1 )]
+               public class ByteArrayFourByteStruct : FourByteStruct
+               {
+                       [MarshalAs( UnmanagedType.ByValArray, SizeConst = 5 )]
+                       public byte[] array;
+               }
+
+               [StructLayout( LayoutKind.Sequential, Pack = 1 )]
+               public class SingleByteStruct
+               {
+                       public byte value1;
+               }
+
+               [StructLayout( LayoutKind.Sequential, Pack = 1 )]
+               public class ByteArraySingleByteStruct : SingleByteStruct
+               {
+                       [MarshalAs( UnmanagedType.ByValArray, SizeConst = 5 )]
+                       public byte[] array1;
+                       public byte value2;
+               }
+
+               [StructLayout( LayoutKind.Sequential, Pack = 1 )]
+               public class ByteArraySingleByteChildStruct : ByteArraySingleByteStruct
+               {
+                       [MarshalAs( UnmanagedType.ByValArray, SizeConst = 5 )]
+                       public byte[] array2;
+               }
+
+               [Test]
+               public void CheckByteArrayFourByteStruct()
+               {
+                       ByteArrayFourByteStruct myStruct = new ByteArrayFourByteStruct
+                       { value1 = 42, value2 = 53, array = Encoding.UTF8.GetBytes( "Hello" ) };
+
+                       byte[] buffer = Serialize (myStruct);
+
+                       UInt16 value1 = BitConverter.ToUInt16 (buffer, 0);
+                       UInt16 value2 = BitConverter.ToUInt16 (buffer, 2);
+                       string array = Encoding.UTF8.GetString (buffer, 4, 5);
+
+                       Assert.AreEqual((UInt16)42, value1);
+                       Assert.AreEqual((UInt16)53, value2);
+                       Assert.AreEqual ("Hello", array);
+               }
+
+               [Test]
+               public void CheckByteArraySingleByteChildStruct()
+               {
+                       ByteArraySingleByteChildStruct myStruct = new ByteArraySingleByteChildStruct
+                       { value1 = 42, array1 = Encoding.UTF8.GetBytes( "Hello" ), value2 = 53,  array2 = Encoding.UTF8.GetBytes( "World" ) };
+
+                       byte[] array = Serialize (myStruct);
+
+                       byte value1 = array [0];
+                       string array1 = Encoding.UTF8.GetString (array, 1, 5);
+                       byte value2 = array [6];
+                       string array2 = Encoding.UTF8.GetString (array, 7, 5);
+
+                       Assert.AreEqual((byte)42, value1);
+                       Assert.AreEqual ("Hello", array1);
+                       Assert.AreEqual((byte)53, value2);
+                       Assert.AreEqual ("World", array2);
+               }
+
+               [StructLayout(LayoutKind.Sequential, Pack = 1)]
+               public struct FiveByteStruct
+               {
+                       public uint uIntField;
+                       public byte byteField;
+               };
+
+               [StructLayout(LayoutKind.Sequential, Pack = 1)]
+               public class Base
+               {
+                       public ushort firstUShortField;
+                       public ushort secondUShortField;
+               }
+
+               [StructLayout(LayoutKind.Sequential, Pack = 1)]
+               public class Derived : Base
+               {
+                       [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
+                       public FiveByteStruct[] arrayField;
+               }
+
+               [Test]
+               public void CheckPtrToStructureWithFixedArrayAndBaseClassFields()
+               {
+                       const int arraySize = 6;
+                       var derived = new Derived
+                       {
+                               arrayField = new FiveByteStruct[arraySize],
+                               firstUShortField = 42,
+                               secondUShortField = 43
+                       };
+
+                       for (var i = 0; i < arraySize; ++i)
+                       {
+                               derived.arrayField[i].byteField = (byte)i;
+                               derived.arrayField[i].uIntField = (uint)i * 10;
+                       }
+
+                       var array = Serialize(derived);
+                       var deserializedDerived = Deserialize<Derived>(array);
+
+                       Assert.AreEqual(derived.firstUShortField, deserializedDerived.firstUShortField, "The firstUShortField differs, which is not expected.");
+                       Assert.AreEqual(derived.secondUShortField, deserializedDerived.secondUShortField, "The secondUShortField differs, which is not expected.");
+
+                       for (var i = 0; i < arraySize; ++i)
+                       {
+                               Assert.AreEqual(derived.arrayField[i].byteField, deserializedDerived.arrayField[i].byteField, string.Format("The byteField at index {0} differs, which is not expected.", i));
+                               Assert.AreEqual(derived.arrayField[i].uIntField, deserializedDerived.arrayField[i].uIntField, string.Format("The uIntField at index {0} differs, which is not expected.", i));
+                       }
+               }
+
+               public static byte[] Serialize( object obj )
+               {
+                       int nTypeSize = Marshal.SizeOf( obj );
+                       byte[] arrBuffer = new byte[nTypeSize];
+
+                       GCHandle hGCHandle = GCHandle.Alloc( arrBuffer, GCHandleType.Pinned );
+                       IntPtr pBuffer = hGCHandle.AddrOfPinnedObject();
+                       Marshal.StructureToPtr( obj, pBuffer, false );
+                       hGCHandle.Free();
+
+                       return arrBuffer;
+               }
+
+               public static T Deserialize<T>(byte[] buffer)
+               {
+                       var handle = GCHandle.Alloc(buffer, GCHandleType.Pinned);
+                       var pBuffer = handle.AddrOfPinnedObject();
+                       var objResult = (T)Marshal.PtrToStructure(pBuffer, typeof(T));
+                       handle.Free();
+
+                       return objResult;
+               }
+#endif
        }
-#if !NET_2_1
+#if !MOBILE
        [ComImport()]
        [Guid("AAAAAAAA-AAAA-AAAA-AAAA-AAAAAAAAAAAA")]
        interface ITestDefault
index 660a556c18483017f7403ba25ed57b4aa0ab7a5a..832ac6fc1cc4c09cc745fee989c1ec1af40e4a4a 100644 (file)
@@ -58,7 +58,7 @@ namespace MonoTests.System.Runtime.InteropServices {
 
                [Test]
 #if MOBILE
-               [Ignore ("There's no GAC for the NET_2_1 based profiles (Moonlight, MonoTouch and Mono for Android")]
+               [Ignore ("There's no GAC for the MOBILE based profiles (Moonlight, MonoTouch and Mono for Android")]
 #endif
                public void FromGlobalAccessCache ()
                {
index 0e5487efdd22228ca182d2520ef3fb1f0b203802..0723d17161109a03f0d53cf8cc7b7ff7a4527f79 100644 (file)
@@ -98,6 +98,13 @@ namespace MonoTests.System.Security.AccessControl
                                security = File.GetAccessControl (path);
                                security.SetOwner (new SecurityIdentifier ("WD"));
                                File.SetAccessControl (path, security);
+                               // If we don't get an InvalidOperationException it could be that we are running
+                               // with administrator privileges. Don't fail the test if that is the case.
+                               WindowsIdentity identity = WindowsIdentity.GetCurrent ();
+                               WindowsPrincipal principal = new WindowsPrincipal (identity);
+                               if (principal.IsInRole (WindowsBuiltInRole.Administrator)) {
+                                       Assert.Ignore ("Running as Administrator");
+                               }
                        } finally {
                                File.Delete (path);
                        }
index bf93320e26b9e8abf86b0adc6626960ea76ebcbf..7a0e837cacfc57b227f0c351720ca13007dae4b6 100644 (file)
@@ -9,7 +9,6 @@ using System;
 using System.Security.AccessControl;
 using System.Security.Principal;
 using NUnit.Framework;
-using NUnit.Framework.SyntaxHelpers;
 
 namespace MonoTests.System.Security.AccessControl {
 
index 0456cbcdd1707db16c627b196432b2626e4802a3..7eb43817eb311f11680feeb44dce84573d5a9608 100644 (file)
@@ -2,7 +2,6 @@
 // ClaimsIdentityTest.cs - NUnit Test Cases for System.Security.Claims.ClaimsIdentity
 //
 
-#if NET_4_5
 
 using NUnit.Framework;
 using System;
@@ -561,4 +560,3 @@ namespace MonoTests.System.Security.Claims
        }
 }
 
-#endif
index 3d5660d256e1ac98a409781f6f12770c5c7699d3..35734b76b028457a567bbb64116eb04f65203060 100644 (file)
@@ -3,7 +3,6 @@
 // ClaimsPrincipalTest.cs - NUnit Test Cases for System.Security.Claims.ClaimsPrincipal
 //
 
-#if NET_4_5
 
 using NUnit.Framework;
 using System;
@@ -253,4 +252,3 @@ namespace MonoTests.System.Security.Claims
        }
 }
 
-#endif
index 328bbb54a50487b7c5d48879374476d27d145da3..efbc57018e6b942dc8260569805bb702abc1e0dd 100644 (file)
@@ -104,8 +104,8 @@ namespace MonoTests.System.Security.Cryptography.X509Certificates {
                }
 
                [Test]
-#if NET_2_1
-               [Ignore ("This constructor always throw a NotSupportedException under NET_2_1 and is useless without CryptoAPI (i.e. outside Windows)")]
+#if MOBILE
+               [Ignore ("This constructor always throw a NotSupportedException under MOBILE and is useless without CryptoAPI (i.e. outside Windows)")]
 #endif
                public void ConstructorIntPtr ()
                {
index e141fa9e90fb9b5788968347ff2f740d3c00cf85..a3e95c65a66d4e3fc2e40682e22b6f013a271f41 100644 (file)
@@ -137,7 +137,7 @@ public class CryptoConfigTest {
        // additional names (URL) used for XMLDSIG (System.Security.Cryptography.Xml)
        // URL taken from http://www.w3.org/TR/2002/REC-xmldsig-core-20020212/
        [Test]
-#if NET_2_1
+#if MOBILE
        [Ignore ("System.Security.dll is not part of Moonlight, MonoTouch and Mono for Android")]
 #endif
        public void CreateFromURL () 
@@ -145,6 +145,9 @@ public class CryptoConfigTest {
                // URL used in SignatureMethod element
                CreateFromName ("http://www.w3.org/2000/09/xmldsig#dsa-sha1", "System.Security.Cryptography.DSASignatureDescription");
                CreateFromName ("http://www.w3.org/2000/09/xmldsig#rsa-sha1", "System.Security.Cryptography.RSAPKCS1SHA1SignatureDescription");
+               CreateFromName ("http://www.w3.org/2001/04/xmldsig-more#rsa-sha256", "System.Security.Cryptography.RSAPKCS1SHA256SignatureDescription");
+               CreateFromName ("http://www.w3.org/2001/04/xmldsig-more#rsa-sha384", "System.Security.Cryptography.RSAPKCS1SHA384SignatureDescription");
+               CreateFromName ("http://www.w3.org/2001/04/xmldsig-more#rsa-sha512", "System.Security.Cryptography.RSAPKCS1SHA512SignatureDescription");
                CreateFromName ("http://www.w3.org/2000/09/xmldsig#hmac-sha1", null);
                // URL used in DigestMethod element 
                CreateFromName ("http://www.w3.org/2000/09/xmldsig#sha1", "System.Security.Cryptography.SHA1CryptoServiceProvider");
@@ -303,17 +306,24 @@ public class CryptoConfigTest {
                MapNameToOID ("System.Security.Cryptography.SHA1", "1.3.14.3.2.26");
 //             MapNameToOID ("System.Security.Cryptography.HashAlgorithm", "1.3.14.3.2.26");
                MapNameToOID ("System.Security.Cryptography.SHA1CryptoServiceProvider", "1.3.14.3.2.26");
+               MapNameToOID ("System.Security.Cryptography.SHA1Cng", "1.3.14.3.2.26");
                MapNameToOID ("System.Security.Cryptography.SHA1Managed", "1.3.14.3.2.26");
                MapNameToOID ("MD5", "1.2.840.113549.2.5");
                MapNameToOID ("System.Security.Cryptography.MD5", "1.2.840.113549.2.5");
                MapNameToOID ("System.Security.Cryptography.MD5CryptoServiceProvider", "1.2.840.113549.2.5");
                MapNameToOID ("SHA256", "2.16.840.1.101.3.4.2.1");
+               MapNameToOID ("System.Security.Cryptography.SHA256CryptoServiceProvider", "2.16.840.1.101.3.4.2.1");
+               MapNameToOID ("System.Security.Cryptography.SHA256Cng", "2.16.840.1.101.3.4.2.1");
                MapNameToOID ("System.Security.Cryptography.SHA256", "2.16.840.1.101.3.4.2.1");
                MapNameToOID ("System.Security.Cryptography.SHA256Managed", "2.16.840.1.101.3.4.2.1");
                MapNameToOID ("SHA384", "2.16.840.1.101.3.4.2.2");
+               MapNameToOID ("System.Security.Cryptography.SHA384CryptoServiceProvider", "2.16.840.1.101.3.4.2.2");
+               MapNameToOID ("System.Security.Cryptography.SHA384Cng", "2.16.840.1.101.3.4.2.2");
                MapNameToOID ("System.Security.Cryptography.SHA384", "2.16.840.1.101.3.4.2.2");
                MapNameToOID ("System.Security.Cryptography.SHA384Managed", "2.16.840.1.101.3.4.2.2");
                MapNameToOID ("SHA512", "2.16.840.1.101.3.4.2.3");
+               MapNameToOID ("System.Security.Cryptography.SHA512CryptoServiceProvider", "2.16.840.1.101.3.4.2.3");
+               MapNameToOID ("System.Security.Cryptography.SHA512Cng", "2.16.840.1.101.3.4.2.3");
                MapNameToOID ("System.Security.Cryptography.SHA512", "2.16.840.1.101.3.4.2.3");
                MapNameToOID ("System.Security.Cryptography.SHA512Managed", "2.16.840.1.101.3.4.2.3");
                MapNameToOID ("RIPEMD160", "1.3.36.3.2.1");
index 7f3320e9c92023d5a019523ce8e54ae32deede79..7f3790421f6231ac5bab86dc652848c912fd4508 100644 (file)
@@ -324,7 +324,7 @@ namespace MonoTests.System.Security.Cryptography {
                        }
                }
                
-#if !NET_2_1
+#if !MOBILE
                [Test]
                [ExpectedException (typeof (NotSupportedException))]
                public void Read_Disposed_Break () 
index a609ce74e2d66c52a0e9328db266a4dc05877678..e56a20c75cd3ce2c0797c843aad267d91a7354f0 100644 (file)
@@ -857,7 +857,7 @@ public class DSACryptoServiceProviderTest {
                }
        }
                
-#if !NET_2_1
+#if !MOBILE
        [Test]
        [Category ("NotWorking")]
        public void CspKeyContainerInfo_NewKeypair ()
index cb689ea25edaf9eeffdd1f75d5ea31937fc2478b..f5ba3ecf91bdd2f8b1c972464f9692561e4e2e12 100644 (file)
@@ -345,7 +345,7 @@ public class HashAlgorithmTest {
        public virtual bool ManagedHashImplementation {
                get { return false; }
        }
-#if !NET_2_1
+#if !MOBILE
        [Test]
        [Category ("NotWorking")] // Mono nevers throws an exception (and we're all managed ;-)
        public void TransformFinalBlock_Twice ()
@@ -424,7 +424,7 @@ public class HashAlgorithmTest {
        {
                Assert.AreEqual (HashBuffer (false), HashBuffer (true), "Intersect");
        }
-#if !NET_2_1
+#if !MOBILE
        [Test]
        [ExpectedException (typeof (NullReferenceException))]
        [Category ("NotWorking")] // initialization problem ? fx2.0 only ?
index 31401da3fec0a4538a95676837cf7134ccd10d17..375512ecd526f1abbf737a692054e419b760031d 100644 (file)
@@ -79,7 +79,7 @@ public class PasswordDeriveBytesTest {
                PasswordDeriveBytes pdb = new PasswordDeriveBytes (pwd, salt, new CspParameters ());
        }
 
-#if !NET_2_1
+#if !MOBILE
        [Test]
        [Category ("NotWorking")] // CspParameters aren't supported by Mono (requires CryptoAPI)
        public void Ctor_PasswordSaltNullCspParameters ()
@@ -100,7 +100,7 @@ public class PasswordDeriveBytesTest {
                Assert.AreEqual (ssalt, BitConverter.ToString (pdb.Salt), "Salt");
        }
 
-#if !NET_2_1
+#if !MOBILE
        [Test]
        [Category ("NotWorking")] // CspParameters aren't supported by Mono (requires CryptoAPI)
        public void Ctor_PasswordSaltCspParameters ()
@@ -176,7 +176,7 @@ public class PasswordDeriveBytesTest {
                PasswordDeriveBytes pdb = new PasswordDeriveBytes (pwd, salt, "SHA1", 1, new CspParameters ());
        }
 
-#if !NET_2_1
+#if !MOBILE
        [Test]
        [Category ("NotWorking")] // CspParameters aren't supported by Mono (requires CryptoAPI)
        public void Ctor_PasswordSaltNullHashIterationCspParameters ()
@@ -209,7 +209,7 @@ public class PasswordDeriveBytesTest {
                PasswordDeriveBytes pdb = new PasswordDeriveBytes ("s3kr3t", salt, "SHA1", 0, new CspParameters ());
        }
                
-#if !NET_2_1
+#if !MOBILE
        [Test]
        [Category ("NotWorking")] // CspParameters aren't supported by Mono (requires CryptoAPI)
        public void Ctor_PasswordSaltHashIterationMaxValueCspParameters ()
@@ -230,7 +230,7 @@ public class PasswordDeriveBytesTest {
                Assert.AreEqual (ssalt, BitConverter.ToString (pdb.Salt), "Salt");
        }
 
-#if !NET_2_1
+#if !MOBILE
        [Test]
        [Category ("NotWorking")] // CspParameters aren't supported by Mono (requires CryptoAPI)
        public void Ctor_PasswordSaltHashIterationCspParameters ()
@@ -669,7 +669,7 @@ public class PasswordDeriveBytesTest {
                pd.CryptDeriveKey ("AlgName", "MD5", -256, new byte [8]);
        }
                
-#if !NET_2_1
+#if !MOBILE
        [Test]
        [Category ("NotWorking")] // bug #79499
        public void LongMultipleGetBytes ()
index 6f351c4edd0c804aaa675032c5e949a3ff8e04d8..2ebcad4a366e34c9cf6071ad40c321b9438589de 100644 (file)
@@ -25,7 +25,7 @@ namespace MonoTests.System.Security.Cryptography {
                {
                        _algo = new RNGCryptoServiceProvider ();
                }
-#if !NET_2_1
+#if !MOBILE
                [Test]
                public void ConstructorByteArray () 
                {
index 8a20b9add458b2d2ed9ff7c097f7a140479c7215..6e44e3235b24061c7626bc48311a4cacbf686184 100644 (file)
@@ -420,7 +420,7 @@ public class RSACryptoServiceProviderTest {
                rsa.VerifyHash (hash, "1.3.14.3.2.26", null);
        }
 
-#if !NET_2_1
+#if !MOBILE
        [Test]
        [Category ("NotWorking")]
        public void ImportDisposed ()
@@ -1161,7 +1161,7 @@ public class RSACryptoServiceProviderTest {
                Assert.IsNotNull (r.Decrypt (bytes, true));
        }
 
-#if !NET_2_1
+#if !MOBILE
        [Test]
        [Category ("NotWorking")]
        public void CspKeyContainerInfo_NewKeypair ()
index b7bf46057a067543d842d0f505357f19943b3ae7..5a200bbfa363da987c836c038333ef5c6aa8ed1a 100644 (file)
@@ -277,7 +277,7 @@ namespace MonoTests.System.Security.Cryptography {
                        CreateEncryptor_IV (size);
                }
 
-#if !NET_2_1
+#if !MOBILE
                [Test]
                [ExpectedException (typeof (CryptographicException))]
                // Rijndael is the only implementation that has
@@ -324,7 +324,7 @@ namespace MonoTests.System.Security.Cryptography {
                        int size = (aes.BlockSize >> 3);
                        CreateDecryptor_IV (size);
                }
-#if !NET_2_1
+#if !MOBILE
                [Test]
                [ExpectedException (typeof (CryptographicException))]
                // Rijndael is the only implementation that has
index c27a58f99cf7844a701f649d671d7cb79f33ae0c..46fbe94a6d7dab11e3430fbd531b4bfe69f75dd4 100644 (file)
@@ -307,17 +307,33 @@ public class SignatureDescriptionTest {
        }
 
        [Test]
-       public void RSASignatureDescription () 
+       public void RSASignatureDescription ()
+       {
+// TODO: this would be cleaner with NUnit TestCase'es but they're NUnit 2.5+ :(
+#if FULL_AOT_RUNTIME || MONOTOUCH || MONODROID
+               RSASignatureDescriptionCore ("http://www.w3.org/2000/09/xmldsig#rsa-sha1", "System.Security.Cryptography.SHA1Cng", "System.Security.Cryptography.SHA1CryptoServiceProvider");
+               RSASignatureDescriptionCore ("http://www.w3.org/2001/04/xmldsig-more#rsa-sha256", "System.Security.Cryptography.SHA256Cng", "System.Security.Cryptography.SHA256Managed");
+               RSASignatureDescriptionCore ("http://www.w3.org/2001/04/xmldsig-more#rsa-sha384", "System.Security.Cryptography.SHA384Cng", "System.Security.Cryptography.SHA384Managed");
+               RSASignatureDescriptionCore ("http://www.w3.org/2001/04/xmldsig-more#rsa-sha512", "System.Security.Cryptography.SHA512Cng", "System.Security.Cryptography.SHA512Managed");
+#else
+               RSASignatureDescriptionCore ("http://www.w3.org/2000/09/xmldsig#rsa-sha1", "System.Security.Cryptography.SHA1Cng", "System.Security.Cryptography.SHA1Cng");
+               RSASignatureDescriptionCore ("http://www.w3.org/2001/04/xmldsig-more#rsa-sha256", "System.Security.Cryptography.SHA256Cng", "System.Security.Cryptography.SHA256Cng");
+               RSASignatureDescriptionCore ("http://www.w3.org/2001/04/xmldsig-more#rsa-sha384", "System.Security.Cryptography.SHA384Cng", "System.Security.Cryptography.SHA384Cng");
+               RSASignatureDescriptionCore ("http://www.w3.org/2001/04/xmldsig-more#rsa-sha512", "System.Security.Cryptography.SHA512Cng", "System.Security.Cryptography.SHA512Cng");
+#endif
+       }
+
+       void RSASignatureDescriptionCore (string name, string expectedDigestAlgorithm, string expectedSelectedDigestAlgorithm) 
        {
                // internal class - we cannot create one without CryptoConfig
-               SignatureDescription sd = (SignatureDescription) CryptoConfig.CreateFromName ("http://www.w3.org/2000/09/xmldsig#rsa-sha1");
-               Assert.AreEqual ("System.Security.Cryptography.SHA1Cng", sd.DigestAlgorithm);
+               SignatureDescription sd = (SignatureDescription) CryptoConfig.CreateFromName (name);
+               Assert.AreEqual (expectedDigestAlgorithm, sd.DigestAlgorithm);
                Assert.AreEqual ("System.Security.Cryptography.RSAPKCS1SignatureDeformatter", sd.DeformatterAlgorithm);
                Assert.AreEqual ("System.Security.Cryptography.RSAPKCS1SignatureFormatter", sd.FormatterAlgorithm);
                Assert.AreEqual ("System.Security.Cryptography.RSA", sd.KeyAlgorithm);
 
                HashAlgorithm hash = sd.CreateDigest();
-               Assert.AreEqual ("System.Security.Cryptography.SHA1Cng", hash.ToString ());
+               Assert.AreEqual (expectedSelectedDigestAlgorithm, hash.ToString ());
 
                Assert.AreEqual ("System.Security.Cryptography.RSA", sd.KeyAlgorithm);
 
@@ -329,4 +345,4 @@ public class SignatureDescriptionTest {
        }
 }
 
-}
\ No newline at end of file
+}
index 00aa374348db05be7dae57d541cf5275cc326c31..f75b723ff45947e8b9fab4c54e1c47e48f539c18 100644 (file)
@@ -229,7 +229,7 @@ namespace MonoTests.System.Security.Policy {
                        "http://*.go-mono.com",
                        "http://www.go-mono.com:8080/index.html",
                        "mono://unknown/protocol",
-                       Path.DirectorySeparatorChar + "mono" + Path.DirectorySeparatorChar + "index.html",
+                       "/mono/index.html",
                };
 
                [Test]
index 80336afc641eaa54b6ee8215900fae3cef9ce28d..a420ffb56003f56efb12101fbc053e660eb54427 100644 (file)
@@ -27,8 +27,8 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-// NET_2_1 profile lacks some (of the few) CAS features required to execute those tests
-#if !NET_2_1
+// MOBILE profile lacks some (of the few) CAS features required to execute those tests
+#if !MOBILE
 
 using NUnit.Framework;
 using System;
index 16fca588d1e4a395222bdd3c7e335fba2b898143..ea6380d0977fc398fd018736c7ce5ec3fa2a386d 100644 (file)
@@ -10,10 +10,6 @@ using System.Text;
 using NUnit.Framework;
 using NUnit.Framework.Constraints;
 
-#if !MOBILE
-using NUnit.Framework.SyntaxHelpers;
-#endif
-
 namespace MonoTests.System.Text
 {
        [TestFixture]
@@ -119,6 +115,40 @@ namespace MonoTests.System.Text
                                Assert.AreEqual (testchars [i], (char) bytes [i]);
                }
 
+               [Test] // Test GetBytes(string)
+               public void TestGetBytes7 ()
+               {
+                       var latin1_encoding = Encoding.GetEncoding ("latin1");
+
+                       var expected = new byte [] { 0x3F, 0x20, 0x3F, 0x20, 0x3F };
+                       var actual = latin1_encoding.GetBytes("\u24c8 \u2075 \u221e"); // normal replacement
+                       Assert.AreEqual (expected, actual, "#1");
+
+                       expected = new byte [] { 0x3F, 0x3F };
+                       actual = latin1_encoding.GetBytes("\ud83d\ude0a"); // surrogate pair replacement
+                       Assert.AreEqual (expected, actual, "#2");
+
+                       expected = new byte [] { 0x3F, 0x3F, 0x20 };
+                       actual = latin1_encoding.GetBytes("\ud83d\ude0a "); // surrogate pair replacement
+                       Assert.AreEqual (expected, actual, "#3");
+
+                       expected = new byte [] { 0x20, 0x20, 0x3F, 0x3F, 0x20, 0x20 };
+                       actual = latin1_encoding.GetBytes("  \ud83d\ude0a  "); // surrogate pair replacement
+                       Assert.AreEqual (expected, actual, "#4");
+
+                       expected = new byte [] { 0x20, 0x20, 0x3F, 0x3F, 0x20, 0x20 };
+                       actual = latin1_encoding.GetBytes("  \ud834\udd1e  "); // surrogate pair replacement
+                       Assert.AreEqual (expected, actual, "#5");
+
+                       expected = new byte [] { 0x41, 0x42, 0x43, 0x00, 0x41, 0x42, 0x43 };
+                       actual = latin1_encoding.GetBytes("ABC\0ABC"); // embedded zero byte not replaced
+                       Assert.AreEqual (expected, actual, "#6");
+
+                       expected = new byte [] { 0x20, 0x20, 0x3F, 0x20, 0x20 };
+                       actual = latin1_encoding.GetBytes("  \ud834  "); // invalid surrogate pair replacement
+                       Assert.AreEqual (expected, actual, "#7");
+               }
+
                [Test] // Test GetChars(byte[])
                public void TestGetChars1 () 
                {
@@ -212,6 +242,15 @@ namespace MonoTests.System.Text
                        Assert.AreEqual (string.Empty, encoding.GetString (new byte [0], 0, 0), "#2");
                }
 
+               [Test]
+               [ExpectedException (typeof (EncoderFallbackException))]
+               public void EncoderFallback ()
+               {
+                       Encoding e = Encoding.ASCII.Clone () as Encoding;
+                       e.EncoderFallback = new EncoderExceptionFallback ();
+                       e.GetBytes ("\u24c8");
+               }
+
                [Test]
                [ExpectedException (typeof (DecoderFallbackException))]
                public void DecoderFallback ()
diff --git a/mcs/class/corlib/Test/System.Text/Latin1EncodingTest.cs b/mcs/class/corlib/Test/System.Text/Latin1EncodingTest.cs
new file mode 100644 (file)
index 0000000..c96da97
--- /dev/null
@@ -0,0 +1,346 @@
+//
+// Latin1EncodingTest.cs
+//
+// Author:
+//     Alexander Köplinger (alexander.koeplinger@xamarin.com)
+//
+// Copyright (C) 2016 Xamarin, Inc.
+//
+// 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.Text;
+
+using NUnit.Framework;
+using NUnit.Framework.Constraints;
+
+namespace MonoTests.System.Text
+{
+       [TestFixture]
+       public class Latin1EncodingTest
+       {
+               private char[] testchars;
+               private byte[] testbytes;
+
+               [SetUp]
+               public void SetUp ()
+               {
+                       testchars = new char[4];
+                       testchars[0] = 'T';
+                       testchars[1] = 'e';
+                       testchars[2] = 's';
+                       testchars[3] = 't';
+                       testbytes = new byte[4];
+                       testbytes[0] = (byte) 'T';
+                       testbytes[1] = (byte) 'e';
+                       testbytes[2] = (byte) 's';
+                       testbytes[3] = (byte) 't';
+               }
+
+               [Test]
+               public void IsBrowserDisplay ()
+               {
+                       Assert.IsTrue (Encoding.GetEncoding ("latin1").IsBrowserDisplay);
+               }
+
+               [Test]
+               public void IsBrowserSave ()
+               {
+                       Assert.IsTrue (Encoding.GetEncoding ("latin1").IsBrowserSave);
+               }
+
+               [Test]
+               public void IsMailNewsDisplay ()
+               {
+                       Assert.IsTrue (Encoding.GetEncoding ("latin1").IsMailNewsDisplay);
+               }
+
+               [Test]
+               public void IsMailNewsSave ()
+               {
+                       Assert.IsTrue (Encoding.GetEncoding ("latin1").IsMailNewsSave);
+               }
+
+               [Test] // Test GetBytes(char[])
+               public void TestGetBytes1 () 
+               {
+                       Encoding latin1_encoding = Encoding.GetEncoding ("latin1");
+                       byte[] bytes = latin1_encoding.GetBytes(testchars);
+                       for (int i = 0; i < testchars.Length; i++)
+                               Assert.AreEqual (testchars[i], (char) bytes[i]);
+               }
+
+               [Test] // Test GetBytes(char[], int, int)
+               public void TestGetBytes2 () 
+               {
+                       Encoding latin1_encoding = Encoding.GetEncoding ("latin1");
+                       byte[] bytes = latin1_encoding.GetBytes(testchars, 1, 1);
+                       Assert.AreEqual (1, bytes.Length, "#1");
+                       Assert.AreEqual (testchars [1], (char) bytes [0], "#2");
+               }
+
+               [Test] // Test non-Latin1 char in char[]
+               public void TestGetBytes3 () 
+               {
+                       Encoding latin1_encoding = Encoding.GetEncoding ("latin1");
+                       testchars[2] = (char) 0x100;
+                       byte[] bytes = latin1_encoding.GetBytes(testchars);
+                       Assert.AreEqual ('T', (char) bytes [0], "#1");
+                       Assert.AreEqual ('e', (char) bytes [1], "#2");
+                       Assert.AreEqual ('?', (char) bytes [2], "#3");
+                       Assert.AreEqual ('t', (char) bytes [3], "#4");
+               }
+
+               [Test] // Test GetBytes(char[], int, int, byte[], int)
+               public void TestGetBytes4 () 
+               {
+                       Encoding latin1_encoding = Encoding.GetEncoding ("latin1");
+                       byte[] bytes = new Byte[1];
+                       int cnt = latin1_encoding.GetBytes(testchars, 1, 1, bytes, 0);
+                       Assert.AreEqual (1, cnt, "#1");
+                       Assert.AreEqual (testchars [1], (char) bytes [0], "#2");
+               }
+
+               [Test] // Test GetBytes(string, int, int, byte[], int)
+               public void TestGetBytes5 () 
+               {
+                       Encoding latin1_encoding = Encoding.GetEncoding ("latin1");
+                       byte[] bytes = new Byte[1];
+                       int cnt = latin1_encoding.GetBytes("Test", 1, 1, bytes, 0);
+                       Assert.AreEqual ('e', (char) bytes [0], "#1");
+               }
+
+               [Test] // Test GetBytes(string)
+               public void TestGetBytes6 () 
+               {
+                       Encoding latin1_encoding = Encoding.GetEncoding ("latin1");
+                       byte[] bytes = latin1_encoding.GetBytes("Test");
+                       for (int i = 0; i < testchars.Length; i++)
+                               Assert.AreEqual (testchars [i], (char) bytes [i]);
+               }
+
+               [Test] // Test GetBytes(string)
+               public void TestGetBytes7 ()
+               {
+                       var latin1_encoding = Encoding.GetEncoding ("latin1");
+
+                       var expected = new byte [] { 0x3F, 0x20, 0x3F, 0x20, 0x3F };
+                       var actual = latin1_encoding.GetBytes("\u24c8 \u2075 \u221e"); // normal replacement
+                       Assert.AreEqual (expected, actual, "#1");
+
+                       expected = new byte [] { 0x3F, 0x3F };
+                       actual = latin1_encoding.GetBytes("\ud83d\ude0a"); // surrogate pair replacement
+                       Assert.AreEqual (expected, actual, "#2");
+
+                       expected = new byte [] { 0x3F, 0x3F, 0x20 };
+                       actual = latin1_encoding.GetBytes("\ud83d\ude0a "); // surrogate pair replacement
+                       Assert.AreEqual (expected, actual, "#3");
+
+                       expected = new byte [] { 0x20, 0x20, 0x3F, 0x3F, 0x20, 0x20 };
+                       actual = latin1_encoding.GetBytes("  \ud83d\ude0a  "); // surrogate pair replacement
+                       Assert.AreEqual (expected, actual, "#4");
+
+                       expected = new byte [] { 0x20, 0x20, 0x3F, 0x3F, 0x20, 0x20 };
+                       actual = latin1_encoding.GetBytes("  \ud834\udd1e  "); // surrogate pair replacement
+                       Assert.AreEqual (expected, actual, "#5");
+
+                       expected = new byte [] { 0x41, 0x42, 0x43, 0x00, 0x41, 0x42, 0x43 };
+                       actual = latin1_encoding.GetBytes("ABC\0ABC"); // embedded zero byte not replaced
+                       Assert.AreEqual (expected, actual, "#6");
+
+                       expected = new byte [] { 0x20, 0x20, 0x3F, 0x20, 0x20 };
+                       actual = latin1_encoding.GetBytes("  \ud834  "); // invalid surrogate pair replacement
+                       Assert.AreEqual (expected, actual, "#7");
+               }
+
+               [Test] // Test GetChars(byte[])
+               public void TestGetChars1 () 
+               {
+                       Encoding latin1_encoding = Encoding.GetEncoding ("latin1");
+                       char[] chars = latin1_encoding.GetChars(testbytes);
+                       for (int i = 0; i < testbytes.Length; i++)
+                               Assert.AreEqual (testbytes[i], (byte) chars[i]);
+               }
+
+               [Test] // Test GetChars(byte[], int, int)
+               public void TestGetChars2 () 
+               {
+                       Encoding latin1_encoding = Encoding.GetEncoding ("latin1");
+                       char[] chars = latin1_encoding.GetChars(testbytes, 1, 1);
+                       Assert.AreEqual (1, chars.Length, "#1");
+                       Assert.AreEqual (testbytes [1], (byte) chars [0], "#2");
+               }
+
+               [Test] // Test GetChars(byte[], int, int, char[], int)
+               public void TestGetChars4 () 
+               {
+                       Encoding latin1_encoding = Encoding.GetEncoding ("latin1");
+                       char[] chars = new char[1];
+                       int cnt = latin1_encoding.GetChars(testbytes, 1, 1, chars, 0);
+                       Assert.AreEqual (1, cnt, "#1");
+                       Assert.AreEqual (testbytes [1], (byte) chars [0], "#2");
+               }
+
+               [Test] // Test GetString(char[])
+               public void TestGetString1 () 
+               {
+                       Encoding latin1_encoding = Encoding.GetEncoding ("latin1");
+                       string str = latin1_encoding.GetString(testbytes);
+                       Assert.AreEqual ("Test", str);
+               }
+
+               [Test] // Test GetString(char[], int, int)
+               public void TestGetString2 () 
+               {
+                       Encoding latin1_encoding = Encoding.GetEncoding ("latin1");
+                       string str = latin1_encoding.GetString(testbytes, 1, 2);
+                       Assert.AreEqual ("es", str);
+               }
+
+               [Test] // Test Decoder
+               public void TestDecoder ()
+               {
+                       Encoding latin1_encoding = Encoding.GetEncoding ("latin1");
+                       char[] chars = new char[1];
+                       int cnt = latin1_encoding.GetDecoder().GetChars(testbytes, 1, 1, chars, 0);
+                       Assert.AreEqual (1, cnt, "#1");
+                       Assert.AreEqual (testbytes [1], (byte) chars [0], "#2");
+               }
+
+               [Test] // Test Decoder
+               public void TestEncoder ()
+               {
+                       Encoding latin1_encoding = Encoding.GetEncoding ("latin1");
+                       byte[] bytes = new Byte[1];
+                       int cnt = latin1_encoding.GetEncoder().GetBytes(testchars, 1, 1, bytes, 0, false);
+                       Assert.AreEqual (1, cnt, "#1");
+                       Assert.AreEqual (testchars [1], (char) bytes [0], "#2");
+               }
+
+               [Test]
+               public void TestZero ()
+               {
+                       Encoding encoding = Encoding.GetEncoding ("latin1");
+                       Assert.AreEqual (string.Empty, encoding.GetString (new byte [0]), "#1");
+                       Assert.AreEqual (string.Empty, encoding.GetString (new byte [0], 0, 0), "#2");
+               }
+
+               [Test]
+               [ExpectedException (typeof (EncoderFallbackException))]
+               public void EncoderFallback ()
+               {
+                       Encoding e = Encoding.GetEncoding ("latin1").Clone () as Encoding;
+                       e.EncoderFallback = new EncoderExceptionFallback ();
+                       e.GetBytes ("\u24c8");
+               }
+
+               [Test]
+       //      [ExpectedException (typeof (ArgumentException))]
+               public void DecoderFallback2 ()
+               {
+                       var bytes = new byte[] {
+                               0x30, 0xa0, 0x31, 0xa8
+                       };
+                       var enc = (Encoding)Encoding.GetEncoding ("latin1").Clone ();
+                       enc.DecoderFallback = new TestFallbackDecoder ();
+                       
+                       var chars = new char [7];
+                       var ret = enc.GetChars (bytes, 0, bytes.Length, chars, 0);
+                       Console.WriteLine (ret);
+                       
+                       for (int i = 0; i < chars.Length; i++) {
+                               Console.Write ("{0:x2} ", (int)chars [i]);
+                       }
+                       Console.WriteLine ();
+               }
+               
+               [Test]
+               public void DecoderFallback3 ()
+               {
+                       var bytes = new byte[] {
+                               0x30, 0xa0, 0x31, 0xa8
+                       };
+                       var enc = (Encoding)Encoding.GetEncoding ("latin1").Clone ();
+                       enc.DecoderFallback = new TestFallbackDecoder ();
+                       
+                       var chars = new char[] { '9', '8', '7', '6', '5' };
+                       var ret = enc.GetChars (bytes, 0, bytes.Length, chars, 0);
+                       
+                       Assert.That (ret, Is.EqualTo (4), "ret");
+                       Assert.That (chars [0], Is.EqualTo ('0'), "chars[0]");
+                       Assert.That (chars [1], Is.EqualTo ((char)0xA0), "chars[1]");
+                       Assert.That (chars [2], Is.EqualTo ('1'), "chars[2]");
+                       Assert.That (chars [3], Is.EqualTo ((char)0xA8), "chars[3]");
+                       Assert.That (chars [4], Is.EqualTo ('5'), "chars[4]");
+               }
+               
+               class TestFallbackDecoder : DecoderFallback {
+                       const int count = 2;
+                       
+                       public override int MaxCharCount {
+                               get { return count; }
+                       }
+                       
+                       public override DecoderFallbackBuffer CreateFallbackBuffer ()
+                       {
+                               return new Buffer ();
+                       }
+                       
+                       class Buffer : DecoderFallbackBuffer {
+                               char[] queue;
+                               int index;
+                               
+                               public override int Remaining {
+                                       get {
+                                               return queue.Length - index;
+                                       }
+                               }
+                               
+                               public override char GetNextChar ()
+                               {
+                                       return index < queue.Length ? queue [index++] : '\0';
+                               }
+                               
+                               public override bool Fallback (byte[] bytes, int unused)
+                               {
+                                       queue = new char[bytes.Length * count];
+                                       index = 0;
+                                       for (int i = 0; i < bytes.Length; i++) {
+                                               for (int j = 0; j < count; j++)
+                                                       queue [index++] = (char)(bytes [i]+j);
+                                       }
+                                       return true;
+                               }
+                               
+                               public override bool MovePrevious ()
+                               {
+                                       throw new NotImplementedException ();
+                               }
+                               
+                               public override void Reset ()
+                               {
+                                       base.Reset ();
+                               }
+                       }
+               }
+
+       }
+}
index 474abcd2208084f4ab516897df9e560c0d1d667a..12de999dc5b6372937898c66fdfa1c8d7805b088 100644 (file)
@@ -11,6 +11,7 @@
 
 using NUnit.Framework;
 using System;
+using System.Reflection;
 using System.IO;
 using System.Text;
 
@@ -1042,7 +1043,7 @@ namespace MonoTests.System.Text
                [Category ("MobileNotWorking")]
                public void Bug415628 ()
                {
-                       using (var f = File.Open ("Test/resources/415628.bin", FileMode.Open)) {
+                       using (var f = File.Open (Path.Combine (Path.GetDirectoryName (Assembly.GetExecutingAssembly ().Location), "Test/resources/415628.bin"), FileMode.Open)) {
                                BinaryReader br = new BinaryReader (f);
                                byte [] buf = br.ReadBytes (8000);
                                Encoding.UTF8.GetString(buf);
index a02ffe96986af87a5e7c90d811c9f4f2d5b5fe40..264095d8b31bafd1cb5add47ca69b91397fe7d04 100644 (file)
@@ -24,7 +24,6 @@
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
 
-#if NET_4_5
 
 using System;
 using System.Threading;
@@ -176,4 +175,3 @@ namespace MonoTests.System.Threading.Tasks
        }
 }
 
-#endif
\ No newline at end of file
index 903a6946a08163a08687381b77d54f21000ed0d7..94f191a121a4ea80b70c6ae0cf7877824992eb7c 100644 (file)
@@ -30,9 +30,6 @@ using System.Threading;
 using System.Threading.Tasks;
 
 using NUnit.Framework;
-#if !MOBILE
-using NUnit.Framework.SyntaxHelpers;
-#endif
 
 namespace MonoTests.System.Threading.Tasks
 {
index 94d36a131e5ab550770551e7dc0f2d2cffd3163b..1af618d3336965aa43958c7f0370abdf5412cc0e 100644 (file)
@@ -35,9 +35,6 @@ using System.Threading.Tasks;
 using System.Collections.Generic;
 
 using NUnit.Framework;
-#if !MOBILE
-using NUnit.Framework.SyntaxHelpers;
-#endif
 
 namespace MonoTests.System.Threading.Tasks
 {
index 0ca7f49f474c9c6fb8407df5eb41a663090a62c3..803b10c15eb9d4384b89465ad77d1d190bde275e 100644 (file)
@@ -32,9 +32,6 @@ using System.Threading;
 using System.Threading.Tasks;
 
 using NUnit.Framework;
-#if !MOBILE
-using NUnit.Framework.SyntaxHelpers;
-#endif
 
 namespace MonoTests.System.Threading.Tasks
 {
index e8130bc06fd5cf8bac6fc0e3dd06b7d81e841f9e..001f4d454cd80c1b8a9e9c8ea2c921c2bc620e52 100644 (file)
@@ -29,9 +29,6 @@ using System.Threading.Tasks;
 using System.Collections.Generic;
 
 using NUnit.Framework;
-#if !MOBILE
-using NUnit.Framework.SyntaxHelpers;
-#endif
 
 namespace MonoTests.System.Threading.Tasks
 {
index e0b127a0bc708543bfa39f3f3f6d7aa59c6e93ac..07bd1fe0b56adeee0f7b15ad2b3221e9b307954d 100644 (file)
@@ -34,10 +34,6 @@ using System.Threading.Tasks;
 using System.Collections.Generic;
 using NUnit.Framework;
 
-#if !MOBILE
-using NUnit.Framework.SyntaxHelpers;
-#endif
-
 namespace MonoTests.System.Threading.Tasks
 {
        [TestFixture]
@@ -409,7 +405,6 @@ namespace MonoTests.System.Threading.Tasks
                        Assert.IsTrue (tasks[1].IsCanceled, "#4");
                }
 
-#if NET_4_5            
                [Test]
                public void WaitAll_CancelledAndTimeout ()
                {
@@ -418,7 +413,6 @@ namespace MonoTests.System.Threading.Tasks
                        var t2 = Task.Delay (3000);
                        Assert.IsFalse (Task.WaitAll (new[] { t1, t2 }, 10));
                }
-#endif
 
                [Test]
                public void WaitAllExceptionThenCancelled ()
@@ -1057,24 +1051,21 @@ namespace MonoTests.System.Threading.Tasks
                        var token = source.Token;
                        var evt = new ManualResetEventSlim ();
                        bool result = false;
-                       bool thrown = false;
 
-                       var task = Task.Factory.StartNew (() => evt.Wait (100));
+                       var task = Task.Factory.StartNew (() => { Assert.IsTrue (evt.Wait (2000), "#1"); });
                        var cont = task.ContinueWith (t => result = true, token, TaskContinuationOptions.ExecuteSynchronously, TaskScheduler.Default);
 
                        source.Cancel();
                        evt.Set ();
-                       task.Wait (100);
+                       Assert.IsTrue (task.Wait (2000), "#2");
                        try {
-                               cont.Wait (100);
-                       } catch (Exception ex) {
-                               thrown = true;
+                               Assert.IsFalse (cont.Wait (4000), "#3");
+                       } catch (AggregateException ex) {
                        }
 
-                       Assert.IsTrue (task.IsCompleted);
-                       Assert.IsTrue (cont.IsCanceled);
-                       Assert.IsFalse (result);
-                       Assert.IsTrue (thrown);
+                       Assert.IsTrue (task.IsCompleted, "#4");
+                       Assert.IsTrue (cont.IsCanceled, "#5");
+                       Assert.IsFalse (result, "#6");
                }
 
                [Test]
@@ -1219,7 +1210,6 @@ namespace MonoTests.System.Threading.Tasks
                        }
                }
 
-#if NET_4_5
                [Test]
                public void ContinuationOnBrokenScheduler ()
                {
@@ -2114,6 +2104,5 @@ namespace MonoTests.System.Threading.Tasks
                        }
                }
                
-#endif
        }
 }
index 3a80f5ae0d294e288b2c4785045290fb9bc149bc..f5b4dd9a3ba1d029449ab8125eaf508c6710cca2 100644 (file)
@@ -38,7 +38,6 @@ namespace MonoTests.System.Threading
        [TestFixture]
        public class CancellationTokenSourceTest
        {
-#if NET_4_5
 
                [Test]
                public void Ctor_Invalid ()
@@ -100,7 +99,6 @@ namespace MonoTests.System.Threading
                        Assert.AreEqual (0, called, "#1");
                }
 
-#endif
 
                [Test]
                public void Token ()
@@ -345,13 +343,11 @@ namespace MonoTests.System.Threading
                        } catch (ObjectDisposedException) {
                        }
 
-#if NET_4_5
                        try {
                                cts.CancelAfter (1);
                                Assert.Fail ("#6");
                        } catch (ObjectDisposedException) {
                        }
-#endif
                }
 
                [Test]
@@ -478,7 +474,6 @@ namespace MonoTests.System.Threading
                        }
                }
 
-#if NET_4_5
                [Test]
                public void DisposeRace ()
                {
@@ -490,7 +485,6 @@ namespace MonoTests.System.Threading
                                c1.Dispose ();
                        }
                }
-#endif
        }
 }
 
index c0e50b9cb89eac2814730d6ad97bcb0e61b3d79c..005a9d86887a3e97952f5ac36f4d7557d8c10883 100644 (file)
@@ -43,6 +43,18 @@ namespace MonoTests.System.Threading {
                {
                        new EventWaitHandle (true, (EventResetMode) Int32.MinValue);
                }
+
+               [Test]
+               public void Disposed_Set ()
+               {
+                       var ewh = new EventWaitHandle (false, EventResetMode.ManualReset);
+                       ewh.Dispose();
+                       try {
+                               ewh.Set();
+                               Assert.Fail ();
+                       } catch (ObjectDisposedException) {
+                       }
+               }
        }
 }
 
index 5149ece6900f034409ae09a0ef9558d292894388..ee3e58860494f861de1c6acc820572100cd83c4c 100644 (file)
@@ -20,6 +20,7 @@ namespace MonoTests.System.Threading
                {\r
                        public int id;\r
                        public Mutex mut;\r
+                       public bool abandoned_exception;\r
                        public ConcClass(int id,Mutex mut)\r
                        {\r
                                this.id = id;\r
@@ -63,7 +64,12 @@ namespace MonoTests.System.Threading
 \r
                        public void WaitAndForget()\r
                        {\r
-                               this.Wait();\r
+                               try {\r
+                                       this.Wait();\r
+                               } catch (AbandonedMutexException) {\r
+                                       this.abandoned_exception = true;\r
+                               }\r
+\r
                                this.marker = id;\r
                        }\r
                        public void WaitAndWait()\r
@@ -137,7 +143,7 @@ namespace MonoTests.System.Threading
                }\r
 \r
                [Test]\r
-               public void TestWaitAndFoget1()\r
+               public void TestWaitAndForget1()\r
                {\r
                        Mutex Sem = new Mutex(false);\r
                        ConcClassLoop class1 = new ConcClassLoop(1,Sem);\r
@@ -148,9 +154,11 @@ namespace MonoTests.System.Threading
                        try {\r
                                thread1.Start();\r
                                TestUtil.WaitForNotAlive (thread1, "t1");\r
+                               Assert.IsFalse (class1.abandoned_exception, "e1");\r
        \r
                                thread2.Start();\r
                                TestUtil.WaitForNotAlive (thread2, "t2");\r
+                               Assert.IsTrue (class2.abandoned_exception, "e2");\r
                        \r
                                Assert.AreEqual (class2.id, class2.marker);\r
                        } finally {\r
index 8c063dccdc879ca860f78b88fe19806d97ff35bf..b65d150bb581ffb8625456b9525fcab3a28d67c1 100644 (file)
@@ -29,9 +29,6 @@ using System.Threading;
 
 using NUnit;
 using NUnit.Framework;
-#if !MOBILE
-using NUnit.Framework.SyntaxHelpers;
-#endif
 
 namespace MonoTests.System.Threading
 {
index a869f7191f7daf9d8ba55795b459e8f909b117a2..4c6694f1e17f137b4112f86e51c0081a24041b53 100644 (file)
@@ -94,25 +94,6 @@ namespace MonoTests.System.Threading
                //TimeSpan MaxValue = TimeSpan.FromMilliseconds ((long) Int32.MaxValue);
                TimeSpan TooLarge = TimeSpan.FromMilliseconds ((long) Int32.MaxValue + 1);
 
-               static bool is_win32;
-               static bool is_mono;
-
-               static ThreadTest ()
-               {
-                       switch (Environment.OSVersion.Platform) {
-                       case PlatformID.Win32NT:
-                       case PlatformID.Win32S:
-                       case PlatformID.Win32Windows:
-                       case PlatformID.WinCE:
-                               is_win32 = true;
-                               break;
-                       }
-
-                       // check a class in mscorlib to determine if we're running on Mono
-                       if (Type.GetType ("Mono.Runtime", false) != null)
-                               is_mono = true;
-               }
-
                //Some Classes to test as threads
                private class C1Test
                {
@@ -327,8 +308,6 @@ namespace MonoTests.System.Threading
                [Category ("NotDotNet")] // it hangs.
                public void TestStart()
                {
-                       if (is_win32 && is_mono)
-                               Assert.Fail ("This test fails on Win32. The test should be fixed.");
                {
                        C1Test test1 = new C1Test();
                        Thread TestThread = new Thread(new ThreadStart(test1.TestMethod));
@@ -370,9 +349,6 @@ namespace MonoTests.System.Threading
                [Test]
                public void TestApartmentState ()
                {
-                       if (is_win32 && is_mono)
-                               Assert.Fail ("This test fails on mono on win32. Our runtime should be fixed.");
-
                        C2Test test1 = new C2Test();
                        Thread TestThread = new Thread(new ThreadStart(test1.TestMethod));
                        Assert.AreEqual (ApartmentState.Unknown, TestThread.ApartmentState, "#1");
@@ -390,9 +366,6 @@ namespace MonoTests.System.Threading
                [Category ("NotWorking")] // setting the priority of a Thread before it is started isn't implemented in Mono yet
                public void TestPriority1()
                {
-                       if (is_win32 && is_mono)
-                               Assert.Fail ("This test fails on mono on Win32. Our runtime should be fixed.");
-
                        C2Test test1 = new C2Test();
                        Thread TestThread = new Thread(new ThreadStart(test1.TestMethod));
                        try {
@@ -487,9 +460,6 @@ namespace MonoTests.System.Threading
                [Test]
                public void TestIsBackground1 ()
                {
-                       if (is_win32 && is_mono)
-                               Assert.Fail ("This test fails on mono on Win32. Our runtime should be fixed.");
-
                        C2Test test1 = new C2Test();
                        Thread TestThread = new Thread(new ThreadStart(test1.TestMethod));
                        try {
@@ -534,9 +504,6 @@ namespace MonoTests.System.Threading
                [Test]
                public void TestName()
                {
-                       if (is_win32 && is_mono)
-                               Assert.Fail ("This test fails on mono on Win32. Our runtime should be fixed.");
-
                        C2Test test1 = new C2Test();
                        Thread TestThread = new Thread(new ThreadStart(test1.TestMethod));
                        try {
@@ -696,9 +663,6 @@ namespace MonoTests.System.Threading
                [Test]
                public void TestThreadState ()
                {
-                       if (is_win32 && is_mono)
-                               Assert.Fail ("This test fails on mono on Win32. Our runtime should be fixed.");
-
                        //TODO: Test The rest of the possible transitions
                        C2Test test1 = new C2Test();
                        Thread TestThread = new Thread(new ThreadStart(test1.TestMethod));
@@ -830,9 +794,6 @@ namespace MonoTests.System.Threading
                [Category("NotDotNet")] // On MS, ThreadStateException is thrown on Abort: "Thread is suspended; attempting to abort"
                public void TestSuspendAbort ()
                {
-                       if (is_win32 && is_mono)
-                               Assert.Fail ("This test fails on Win32. The test should be fixed.");
-
                        Thread t = new Thread (new ThreadStart (DoCount));
                        t.IsBackground = true;
                        t.Start ();
@@ -898,7 +859,6 @@ namespace MonoTests.System.Threading
                }
                
                [Test]
-               [Category ("NotDotNet")] // it crashes nunit.
                public void Test_InterruptCurrentThread ()
                {
                        ManualResetEvent mre = new ManualResetEvent (false);
@@ -937,6 +897,7 @@ namespace MonoTests.System.Threading
 
 #if MONO_FEATURE_MULTIPLE_APPDOMAINS
                [Test]
+               [Category ("NotDotNet")]
                public void CurrentThread_Domains ()
                {
                        AppDomain ad = AppDomain.CreateDomain ("foo");
index 3743ea2b3072db737686c848c994d29e323b68e6..c3b37a99407bccce894b569ccb9265cb19a9579f 100644 (file)
@@ -26,7 +26,6 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if NET_4_5
 
 using System;
 using System.Threading;
@@ -146,5 +145,4 @@ namespace MonoTests.System.Threading
        }
 }
 
-#endif
 
index 2fc0a6dd01d6963dfb8ae777ca494622d2dcee12..593edcf65c69780f331dae72e4e353651dbf87a2 100644 (file)
@@ -28,6 +28,7 @@
 
 
 using System;
+using System.Collections.Generic;
 using System.Threading;
 
 using NUnit.Framework;
@@ -395,6 +396,148 @@ namespace MonoTests.System.Threading {
                        }
                }
 
+               [Test]
+               public void WaitOneWithAbandonedMutex ()
+               {
+                       using (var m = new Mutex (false)) {
+                               var thread1 = new Thread (() => {
+                                       m.WaitOne ();
+                               });
+                               thread1.Start ();
+                               thread1.Join (1000);
+                               try {
+                                       m.WaitOne ();
+                                       Assert.Fail ("Expected AbandonedMutexException");
+                               } catch (AbandonedMutexException) {
+                               }
+                               // Current thread should own the Mutex now
+                               var signalled = false;
+                               var thread2 = new Thread (() => {
+                                       signalled = m.WaitOne (100);
+                               });
+                               thread2.Start ();
+                               thread2.Join (1000);
+                               Assert.IsFalse (signalled);
+
+                               // Since this thread owns the Mutex releasing it shouldn't fail
+                               m.ReleaseMutex ();
+                               // The Mutex should now be unowned
+                               try {
+                                       m.ReleaseMutex ();
+                                       Assert.Fail ("Expected ApplicationException");
+                               } catch (ApplicationException) {
+                               }
+                       }
+               }
+
+               [Test]
+               public void WaitOneWithAbandonedMutexAndMultipleThreads ()
+               {
+                       using (var m = new Mutex (true)) {
+                               var nonAbandoned = 0;
+                               var abandoned = 0;
+                               var n = 0;
+                               var threads = new List<Thread> ();
+                               for (int i = 0; i < 50; i++) {
+                                       var thread = new Thread (() => {
+                                               try {
+                                                       m.WaitOne ();
+                                                       nonAbandoned++;
+                                               } catch (AbandonedMutexException) {
+                                                       abandoned++;
+                                               }
+                                               if (((n++) % 5) != 0)
+                                                       m.ReleaseMutex ();
+                                       });
+                                       thread.Start ();
+                                       threads.Add (thread);
+                               }
+                               m.ReleaseMutex ();
+                               foreach (var thread in threads) {
+                                       if (!thread.Join (1000)) {
+                                               Assert.Fail ("Timed out");
+                                       }
+                               }
+                               Assert.AreEqual (40, nonAbandoned);
+                               Assert.AreEqual (10, abandoned);
+                       }
+               }
+
+               [Test]
+               public void WaitAnyWithSecondMutexAbandoned ()
+               {
+                       using (var m1 = new Mutex (false)) {
+                               using (var m2 = new Mutex (false)) {
+                                       var mainProceed = false;
+                                       var thread2Proceed = false;
+                                       var thread1 = new Thread (() => {
+                                               m2.WaitOne ();
+                                       });
+                                       var thread2 = new Thread (() => {
+                                               m1.WaitOne ();
+                                               mainProceed = true;
+                                               while (!thread2Proceed) {
+                                                       Thread.Sleep (10);
+                                               }
+                                               m1.ReleaseMutex ();
+                                       });
+                                       thread1.Start ();
+                                       thread1.Join (1000);
+                                       thread2.Start ();
+                                       while (!mainProceed) {
+                                               Thread.Sleep (10);
+                                       }
+                                       try {
+                                               WaitHandle.WaitAny (new WaitHandle [] { m1, m2 });
+                                               Assert.Fail ("Expected AbandonedMutexException");
+                                       } catch (AbandonedMutexException e) {
+                                               Assert.AreEqual (1, e.MutexIndex);
+                                               Assert.AreEqual (m2, e.Mutex);
+                                       } finally {
+                                               thread2Proceed = true;
+                                               thread2.Join (1000);
+                                       }
+
+                                       // Current thread should own the second Mutex now
+                                       var signalled = -1;
+                                       var thread3 = new Thread (() => {
+                                               signalled = WaitHandle.WaitAny (new WaitHandle [] { m1, m2 }, 0);
+                                       });
+                                       thread3.Start ();
+                                       thread3.Join (1000);
+                                       Assert.AreEqual (0, signalled);
+
+                                       // Since this thread owns the second Mutex releasing it shouldn't fail
+                                       m2.ReleaseMutex ();
+                                       // Second Mutex should now be unowned
+                                       try {
+                                               m2.ReleaseMutex ();
+                                               Assert.Fail ("Expected ApplicationException");
+                                       } catch (ApplicationException) {
+                                       }
+                                       // .NET allows the first Mutex which is now abandoned to be released multiple times by this thread
+                                       m1.ReleaseMutex ();
+                                       m1.ReleaseMutex ();
+                               }
+                       }
+               }
+
+               [Test]
+               [ExpectedException (typeof (AbandonedMutexException))]
+               public void WaitAllWithOneAbandonedMutex ()
+               {
+                       using (var m1 = new Mutex (false)) {
+                               using (var m2 = new Mutex (false)) {
+                                       var thread = new Thread (() => {
+                                               m1.WaitOne ();
+                                       });
+                                       thread.Start ();
+                                       thread.Join (1000);
+                                       WaitHandle.WaitAll (new WaitHandle [] { m1, m2 });
+                               }
+                       }
+               }
+
 #if MONO_FEATURE_THREAD_SUSPEND_RESUME
                [Test]
                public void WaitOneWithTimeoutAndSpuriousWake ()
index 121d1c45f10a88ceae0f80fdbbfe3575d7f7cb70..387d0318a3f45cc6eb627e3241dd6ad2bd40704a 100644 (file)
@@ -23,8 +23,12 @@ namespace MonoTests.System
 
                private bool RunningOnWindows {
                        get {
-                               int os = (int)Environment.OSVersion.Platform;
-                               return (os != 4);
+                               return Path.DirectorySeparatorChar == '\\';
+                       }
+               }
+               private bool RunningOnMono {
+                       get {
+                               return (Type.GetType ("System.MonoType", false) != null);
                        }
                }
 
@@ -72,22 +76,18 @@ namespace MonoTests.System
                [Test]
                public void ApplicationBase1 ()
                {
-                       string expected_path = tmpPath.Replace(@"\", @"/");
+                       string expected_path = tmpPath;
                        AppDomainSetup setup = new AppDomainSetup ();
-                       string fileUri = "file://" + expected_path;
+                       string fileUri = "file://" + tmpPath.Replace(@"\", @"/");
                        setup.ApplicationBase = fileUri;
-                       // with MS 1.1 SP1 the expected_path starts with "//" but this make
-                       // sense only under Windows (i.e. reversed \\ for local files)
-                       if (RunningOnWindows)
-                               expected_path = "//" + expected_path;
                        try {
-                               // under 2.0 the NotSupportedException is throw when getting 
+                               // under .NET the NotSupportedException is throw when getting 
                                // (and not setting) the ApplicationBase property
                                Assert.AreEqual (expected_path, setup.ApplicationBase);
                        }
                        catch (NotSupportedException) {
-                               // however the path is invalid only on Windows
-                               if (!RunningOnWindows)
+                               // however the path is invalid only on .NET
+                               if (RunningOnMono)
                                        throw;
                        }
                }
@@ -114,16 +114,17 @@ namespace MonoTests.System
                {
                        AppDomainSetup setup = new AppDomainSetup ();
                        setup.ApplicationBase = "lala:la";
-                       try {
-                               // under 2.0 the NotSupportedException is throw when getting 
-                               // (and not setting) the ApplicationBase property
+                       if (!RunningOnWindows) {
                                Assert.AreEqual (Path.GetFullPath ("lala:la"), setup.ApplicationBase);
-                       }
-                       catch (NotSupportedException) {
-                               // however the path is invalid only on Windows
-                               // (same exceptions as Path.GetFullPath)
-                               if (!RunningOnWindows)
-                                       throw;
+                       } else {
+                               // On Windows we expect a NotSupportedException to be thrown because
+                               // of the illegal character (:) in the path
+                               try {
+                                       Assert.Fail ("NotSupportedException expected but setup.ApplicationBase returned:" + setup.ApplicationBase);
+                               }
+                               catch (NotSupportedException) {
+                                       // Expected
+                               }
                        }
                }
 
@@ -133,16 +134,18 @@ namespace MonoTests.System
                        // This is failing because of (probably) a windows-ism, so don't worry
                        AppDomainSetup setup = new AppDomainSetup ();
                        setup.ApplicationBase = "file:///lala:la";
-                       try {
-                               // under 2.0 the NotSupportedException is throw when getting 
-                               // (and not setting) the ApplicationBase property
-                               Assert.AreEqual ("/lala:la", setup.ApplicationBase);
-                       }
-                       catch (NotSupportedException) {
-                               // however the path is invalid only on Windows
-                               // (same exceptions as Path.GetFullPath)
-                               if (!RunningOnWindows)
-                                       throw;
+                       string expected = "/lala:la";
+                       if (!RunningOnWindows) {
+                               Assert.AreEqual (expected, setup.ApplicationBase);
+                       } else {
+                               // On Windows we expect a NotSupportedException to be thrown because
+                               // of the illegal character (:) in the path
+                               try {
+                                       Assert.Fail ("NotSupportedException expected but setup.ApplicationBase returned:" + setup.ApplicationBase);
+                               }
+                               catch (NotSupportedException) {
+                                       // Expected
+                               }
                        }
                }
 
@@ -153,19 +156,45 @@ namespace MonoTests.System
                        setup.ApplicationBase = "la?lala";
                        // paths containing "?" are *always* bad on Windows
                        // but are legal for linux so we return a full path
-                       if (RunningOnWindows) {
+                       if (!RunningOnWindows) {
+                               Assert.AreEqual (Path.GetFullPath ("la?lala"), setup.ApplicationBase);
+                       } else {
+                               // On Windows we expect a ArgumentException to be thrown because
+                               // of the illegal character (?) in the path
                                try {
-                                       // ArgumentException is throw when getting 
-                                       // (and not setting) the ApplicationBase property
-                                       Assert.Fail ("setup.ApplicationBase returned :" + setup.ApplicationBase);
+                                       Assert.Fail ("ArgumentException expected but setup.ApplicationBase returned:" + setup.ApplicationBase);
                                }
                                catch (ArgumentException) {
+                                       // Expected
+                               }
+                       }
+               }
+
+               [Test]
+               public void ApplicationBase7 ()
+               {
+                       if (RunningOnWindows) {
+                               // Extended paths are Windows only
+                               AppDomainSetup setup = new AppDomainSetup ();
+                               string expected = @"\\?\" + curDir;
+                               setup.ApplicationBase = expected;
+                               Assert.AreEqual (expected, setup.ApplicationBase);
+                       }
+               }
+
+               [Test]
+               public void ApplicationBase8 ()
+               {
+                       if (RunningOnWindows) {
+                               // Extended paths are Windows only
+                               AppDomainSetup setup = new AppDomainSetup ();
+                               setup.ApplicationBase = @"\\?\C:\lala:la";
+                               try {
+                                       Assert.Fail ("NotSupportedException expected but setup.ApplicationBase returned:" + setup.ApplicationBase);
                                }
-                               catch (Exception e) {
-                                       Assert.Fail ("Unexpected exception: " + e.ToString ());
+                               catch (NotSupportedException) {
+                                       // Expected
                                }
-                       } else {
-                               Assert.AreEqual (Path.GetFullPath ("la?lala"), setup.ApplicationBase);
                        }
                }
 
index 28588f8e008664c9ee0dc501fa0ae6e27db06dec..7fa93e8fcf1d628928fea25b2df5360d21751f54 100644 (file)
@@ -156,7 +156,6 @@ namespace MonoTests.System
                        Assert.AreEqual (myArrSeg_1 != myArrSeg_2, true);
                }
 
-#if NET_4_5
                [Test]
                public void IList_NotSupported ()
                {
@@ -278,6 +277,5 @@ namespace MonoTests.System
                        IList<byte> seg = new ArraySegment<byte> (arr);
                        seg[4] = 3;
                }
-#endif
        }
 }
index d609c188831a013943cb6c55945524a421bc1a12..dd66b8c7a2c2868e3b8b9441626c7e7c397f0f85 100644 (file)
@@ -903,7 +903,13 @@ namespace MonoTests.System
                        Assert.AreEqual (1, res.Length, "#1");
                }
 
-               abstract class Abs
+               abstract class Root
+               {
+                       [MyAttribute]
+                       public abstract void Foo ();
+               }
+
+               abstract class Abs : Root
                {
                        public abstract string Name { get; set; }
                }
@@ -915,6 +921,8 @@ namespace MonoTests.System
                                get { return ""; }
                                set {}
                        }
+
+                       public override void Foo () { }
                }
                
                class Sub: Base
@@ -1032,6 +1040,27 @@ namespace MonoTests.System
                        a.GetHashCode ();
                }
 
+
+               [Test]
+               public void DerivedClassOverrideHasInhertedAttributeFromAbstractRoot ()
+               {
+                       // regression test for #44010
+                       // we have
+                       // abstract class Root {
+                       //   [MyAttribute]
+                       //   public abstract void Foo ();
+                       // }
+                       // abstract class Abs : Root { }
+                       // class Base : Abs {
+                       //   public override void  Foo () { }
+                       // }
+                       // note that Abs does not itself override Foo.
+                       var bt = typeof(Base);
+                       var m = bt.GetMethod ("Foo");
+                       var attribute = Attribute.GetCustomAttribute (m, typeof (MyAttribute), true);
+                       Assert.IsNotNull (attribute);
+               }
+
                class ArrayAttribute : Attribute
                {
 #pragma warning disable 414
index 1d9f1a10bc689454df138a2256dc41e9c338aaa8..93676f9dd091647595efdf15b49b50b16660ac50 100644 (file)
@@ -332,7 +332,6 @@ public class ConsoleTest
 
 #if !MOBILE
 
-#if NET_4_5
        [Test]
        public void RedirectedTest ()
        {
@@ -343,7 +342,6 @@ public class ConsoleTest
                Console.SetError (TextWriter.Null);
                Assert.IsFalse (Console.IsErrorRedirected);
        }
-#endif
 
        // Bug 678357
        [Test]
index a22b17ebb5b8d377d9314fbe848cc6434640dd2b..ae383e310dd76adc68a779e9969f1df4c7e0ffe5 100644 (file)
@@ -2646,7 +2646,7 @@ namespace MonoTests.System
                }
 
                [Test]
-               [Culture ("en-us")]
+               [SetCulture ("en-us")]
                public void ToUniversalTime_TimeZoneOffsetShouldNotOverflow ()
                {
                        var m = DateTime.MaxValue;
@@ -2662,7 +2662,7 @@ namespace MonoTests.System
                        res = m.ToUniversalTime ();
 
                        // It does not matter which time zone but we should never overflow or have DateTime.MinValue
-                       Assert.AreEqual (0, res.Year, "#10");
+                       Assert.AreEqual (1, res.Year, "#10");
                        Assert.AreEqual (1, res.Month, "#11");
                        Assert.AreEqual (1, res.Day, "#12");
                        Assert.AreEqual (DateTimeKind.Utc, res.Kind, "#13");
index 3ef265c7b4d82ac2d24fd7207a5d1b2141fcc518..261e9b5692537a0593711614e27b619b917e3637 100644 (file)
@@ -496,7 +496,7 @@ namespace MonoTests.System
                }
                
                [Test]
-               [Culture ("en")]
+               [SetCulture ("en")]
                public void TestParse()
                {
                    // Boolean Decimal.TryParse(String, NumberStyles, IFormatProvider, Decimal)
@@ -810,7 +810,7 @@ namespace MonoTests.System
                }
                
                [Test]
-               [Culture ("en")]
+               [SetCulture ("en")]
                public void TestToString()
                {
                    // String Decimal.ToString()
@@ -865,7 +865,7 @@ namespace MonoTests.System
                }
                
                [Test]
-               [Culture ("en")]
+               [SetCulture ("en")]
                public void TestNumberBufferLimit()
                {
                    Decimal dE = 1234567890123456789012345.6785m;
index e1d95dc93f00f563a4a7415708b3714d5a107a4f..ba664353ab9e0056492a1ae525057969609af25e 100644 (file)
@@ -1445,6 +1445,18 @@ namespace MonoTests.System
                        var del = Delegate.Remove (del1, del2);
                }
 
+               [Test]
+               [ExpectedException (typeof (ArgumentException))]
+               public void CreateDelegateThrowsAnArgumentExceptionWhenCalledWithAnOpenGeneric()
+               {
+                       var m = GetType().GetMethod("AnyGenericMethod");
+                       Delegate.CreateDelegate(typeof(Action), this, m);
+               }
+
+               public void AnyGenericMethod<T>()
+               {
+               }
+
                static bool Int32D2 (int x, int y)
                {
                        return (x & y) == y; 
index 30fe1dce81793175172850c761f64df3b888b4b9..81b2a5fdb2a45300da291b23c2e54d7a5714d113 100644 (file)
@@ -147,6 +147,7 @@ namespace MonoTests.System
                }
 
                [Test]
+               [SetCulture ("en-US")]
                public void Parse ()
                {
                        int i = 0;
index fed370974e584b8d5c33dd49eca0a75dc87de8e6..fb547931b237c3b77677c76f7cfa0e0dfc0332b5 100644 (file)
@@ -138,7 +138,7 @@ namespace MonoTests.System
                        Assert.IsFalse (d.IsSynchronized, "IsSynchronized");
                }
 
-#if !NET_2_1
+#if !MOBILE
                [Test] // bug #333740
                public void GetEnvironmentVariables_NewlySet ()
                {
@@ -165,7 +165,7 @@ namespace MonoTests.System
 #endif
                }
 
-#if !NET_2_1
+#if !MOBILE
                [Test]
                [ExpectedException (typeof (ArgumentException))]
                public void GetEnvironmentVariable_Target_Invalid ()
diff --git a/mcs/class/corlib/Test/System/GCTest.cs b/mcs/class/corlib/Test/System/GCTest.cs
new file mode 100644 (file)
index 0000000..6ce65b4
--- /dev/null
@@ -0,0 +1,72 @@
+//
+// GCTest.cs - NUnit Test Cases for GC
+//
+// Authors:
+//     Marek Safar  <marek.safar@gmail.com>
+//
+// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com)
+//
+// 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.Threading.Tasks;
+
+using NUnit.Framework;
+
+namespace MonoTests.System {
+
+       [TestFixture]
+       public class GCTest {
+
+               class MyFinalizeObject
+               {
+                       public volatile static int finalized;
+
+                       ~MyFinalizeObject ()
+                       {
+                               if (finalized++ == 0) {
+                                       GC.ReRegisterForFinalize (this);
+                               }
+                       }
+               }
+
+               static void Run_ReRegisterForFinalizeTest ()
+               {
+                       var m = new WeakReference<MyFinalizeObject> (new MyFinalizeObject ());
+                       m.SetTarget (null);
+               }
+
+               [Test]
+               public void ReRegisterForFinalizeTest ()
+               {
+                       Run_ReRegisterForFinalizeTest ();
+                       var t = Task.Factory.StartNew (() => {
+                               do {
+                                       GC.Collect ();
+                                       GC.WaitForPendingFinalizers ();
+                                       Task.Yield ();
+                               } while (MyFinalizeObject.finalized != 2);
+                       });
+
+                       Assert.IsTrue (t.Wait (5000));
+               }
+       }
+}
\ No newline at end of file
index bf3beb47200ad653a5b441ec06d6a6eca21142d9..c4d0bd82fc9f6df28b133379d2db582b68de251d 100644 (file)
@@ -15,10 +15,6 @@ using System.Threading;
 
 using NUnit.Framework;
 
-#if !MOBILE
-using NUnit.Framework.SyntaxHelpers;
-#endif
-
 namespace MonoTests.System
 {
        [TestFixture]
index 62ae67cfc814755576e69e8a862864bc5bc71e36..ed45adfb13775ec29015ce83e62cfed9d4503b36 100644 (file)
@@ -82,8 +82,6 @@ namespace MonoTests.System
                        [Test]
                        public void DeltaNotInSeconds ()
                        {
-                               if (Environment.OSVersion.Platform != PlatformID.Unix)
-                                       throw new ArgumentOutOfRangeException ();;
                                DateTime dateStart = new DateTime (2007,01,01);
                                DateTime dateEnd = new DateTime (2008,01,01);
                                TimeZoneInfo.TransitionTime daylightTransitionStart = TimeZoneInfo.TransitionTime.CreateFixedDateRule (new DateTime (1,1,1,2,0,0), 03, 11);
index 55a6ea2ecfe4c6d11c609802597b1c11d7f5d63b..27c167f04862d3d763272eb03a92d4e8c2bf5fa8 100644 (file)
@@ -43,6 +43,39 @@ namespace MonoTests.System
                static FieldInfo cachedDataField;
                static object localFieldObj;
 
+               public static string MapTimeZoneId (string id)
+               {
+                       if (Environment.OSVersion.Platform == PlatformID.Unix)
+                               return id;
+                       else {
+                               switch (id) {
+                               case "Pacific/Auckland":
+                                       return "New Zealand Standard Time";
+                               case "Europe/Athens":
+                                       return "GTB Standard Time";
+                               case "US/Eastern":
+                                       return "Eastern Standard Time";
+                               case "US/Pacific":
+                                       return "Pacific Standard Time";
+                               case "Australia/Sydney":
+                               case "Australia/Melbourne":
+                                       return "AUS Eastern Standard Time";
+                               case "Europe/Brussels":
+                                       return "Romance Standard Time";
+                               case "Africa/Kinshasa":
+                                       return "W. Central Africa Standard Time";
+                               case "Europe/Rome":
+                               case "Europe/Vatican":
+                                       return "W. Europe Standard Time";
+                               case "Canada/Eastern":
+                                       return "Eastern Standard Time";
+                               default:
+                                       Assert.Fail ($"No mapping defined for zone id '{id}'");
+                                       return null;
+                               }
+                       }
+               }
+
                public static void SetLocal (TimeZoneInfo val)
                {
                        if (localField == null) {
@@ -70,8 +103,6 @@ namespace MonoTests.System
                        [Test]
                        public void GetLocal ()
                        {
-                               if (Environment.OSVersion.Platform != PlatformID.Unix)
-                                       Assert.Ignore ("Not running on Unix.");
                                TimeZoneInfo local = TimeZoneInfo.Local;
                                Assert.IsNotNull (local);
                                Assert.IsTrue (true);
@@ -262,8 +293,6 @@ namespace MonoTests.System
                        [Test]
                        public void DSTInLondon ()
                        {
-                               if (Environment.OSVersion.Platform != PlatformID.Unix)
-                                       Assert.Ignore ("Not running on Unix.");
                                DateTime june01 = new DateTime (2007, 06, 01);
                                DateTime xmas = new DateTime (2007, 12, 25);
                                Assert.IsTrue (london.IsDaylightSavingTime (june01), "June 01 is DST in London");
@@ -273,8 +302,6 @@ namespace MonoTests.System
                        [Test]
                        public void DSTTransisions ()
                        {
-                               if (Environment.OSVersion.Platform != PlatformID.Unix)
-                                       Assert.Ignore ("Not running on Unix.");
                                DateTime beforeDST = new DateTime (2007, 03, 25, 0, 59, 59, DateTimeKind.Unspecified);
                                DateTime startDST = new DateTime (2007, 03, 25, 2, 0, 0, DateTimeKind.Unspecified);
                                DateTime endDST = new DateTime (2007, 10, 28, 1, 59, 59, DateTimeKind.Unspecified);
@@ -315,12 +342,7 @@ namespace MonoTests.System
                        [Test (Description="Description xambug #17155")]
                        public void AdjustmentRuleAfterNewYears ()
                        {
-                               TimeZoneInfo tz;
-                               if (Environment.OSVersion.Platform == PlatformID.Unix)
-                                       tz = TimeZoneInfo.FindSystemTimeZoneById ("Pacific/Auckland"); // *nix
-                               else
-                                       tz = TimeZoneInfo.FindSystemTimeZoneById ("New Zealand Standard Time"); // Windows
-
+                               TimeZoneInfo tz = TimeZoneInfo.FindSystemTimeZoneById (MapTimeZoneId ("Pacific/Auckland"));
                                // DST start: 9/29/2013 2:00:00 AM
                                // DST end: 4/6/2014 3:00:00 AM
                                DateTime dt = new DateTime (2014, 1, 9, 23, 0, 0, DateTimeKind.Utc);
@@ -354,16 +376,87 @@ namespace MonoTests.System
                        [Test] //Covers #25050
                        public void TestAthensDST ()
                        {
-                               TimeZoneInfo tzi = TimeZoneInfo.FindSystemTimeZoneById ("Europe/Athens");
+                               TimeZoneInfo tzi = TimeZoneInfo.FindSystemTimeZoneById (MapTimeZoneId ("Europe/Athens"));
                                var date = new DateTime (2014, 3, 30 , 2, 0, 0);
                                Assert.IsFalse (tzi.IsDaylightSavingTime (date));
                                Assert.AreEqual (new TimeSpan (2,0,0), tzi.GetUtcOffset (date));
                        }
 
+                       [Test]
+                       public void TestAthensDST_InDSTDelta ()
+                       {
+                               // In .NET GetUtcOffset() returns the BaseUtcOffset for times within the hour
+                               // lost when DST starts but IsDaylightSavingTime() returns true.
+
+                               TimeZoneInfo tzi = TimeZoneInfo.FindSystemTimeZoneById (MapTimeZoneId ("Europe/Athens"));
+
+                               var date = new DateTime (2014, 3, 30 , 3, 0, 0);
+                               Assert.IsTrue (tzi.IsDaylightSavingTime (date));
+                               Assert.AreEqual (new TimeSpan (2, 0, 0), tzi.GetUtcOffset (date));
+                               Assert.IsTrue (tzi.IsDaylightSavingTime (new DateTimeOffset (date, tzi.GetUtcOffset (date))));
+
+                               date = new DateTime (2014, 3, 30 , 3, 1, 0);
+                               Assert.IsTrue (tzi.IsDaylightSavingTime (date));
+                               Assert.AreEqual (new TimeSpan (2, 0, 0), tzi.GetUtcOffset (date));
+                               Assert.IsTrue (tzi.IsDaylightSavingTime (new DateTimeOffset (date, tzi.GetUtcOffset (date))));
+
+                               date = new DateTime (2014, 3, 30 , 3, 59, 0);
+                               Assert.IsTrue (tzi.IsDaylightSavingTime (date));
+                               Assert.AreEqual (new TimeSpan (2, 0, 0), tzi.GetUtcOffset (date));
+                               Assert.IsTrue (tzi.IsDaylightSavingTime (new DateTimeOffset (date, tzi.GetUtcOffset (date))));
+
+                               date = new DateTime (2014, 3, 30 , 4, 0, 0);
+                               Assert.IsTrue (tzi.IsDaylightSavingTime (date));
+                               Assert.AreEqual (new TimeSpan (3, 0, 0), tzi.GetUtcOffset (date));
+                               Assert.IsTrue (tzi.IsDaylightSavingTime (new DateTimeOffset (date, tzi.GetUtcOffset (date))));
+                       }
+
+                       [Test]
+                       public void TestAthensDST_InDSTDelta_NoTransitions ()
+                       {
+                               if (Environment.OSVersion.Platform != PlatformID.Unix)
+                                       Assert.Ignore ("TimeZoneInfo on Mono on Windows and .NET has no transitions");
+
+                               // Repeat the previous test but this time force using AdjustmentRules by nulling out TimeZoneInfo.transitions
+
+                               TimeZoneInfo tzi = TimeZoneInfo.FindSystemTimeZoneById ("Europe/Athens");
+
+                               var transitionsField = typeof (TimeZoneInfo).GetField ("transitions", BindingFlags.Instance | BindingFlags.NonPublic);
+                               var transitions = transitionsField.GetValue (tzi);
+                               Assert.IsNotNull (transitions, "Expected Athens TimeZoneInfo.transitions to be non-null");
+                               transitionsField.SetValue (tzi, null);
+
+                               try {
+
+                                       var date = new DateTime (2014, 3, 30 , 3, 0, 0);
+                                       Assert.IsTrue (tzi.IsDaylightSavingTime (date));
+                                       Assert.AreEqual (new TimeSpan (2, 0, 0), tzi.GetUtcOffset (date));
+                                       Assert.IsTrue (tzi.IsDaylightSavingTime (new DateTimeOffset (date, tzi.GetUtcOffset (date))));
+
+                                       date = new DateTime (2014, 3, 30 , 3, 1, 0);
+                                       Assert.IsTrue (tzi.IsDaylightSavingTime (date));
+                                       Assert.AreEqual (new TimeSpan (2, 0, 0), tzi.GetUtcOffset (date));
+                                       Assert.IsTrue (tzi.IsDaylightSavingTime (new DateTimeOffset (date, tzi.GetUtcOffset (date))));
+
+                                       date = new DateTime (2014, 3, 30 , 3, 59, 0);
+                                       Assert.IsTrue (tzi.IsDaylightSavingTime (date));
+                                       Assert.AreEqual (new TimeSpan (2, 0, 0), tzi.GetUtcOffset (date));
+                                       Assert.IsTrue (tzi.IsDaylightSavingTime (new DateTimeOffset (date, tzi.GetUtcOffset (date))));
+
+                                       date = new DateTime (2014, 3, 30 , 4, 0, 0);
+                                       Assert.IsTrue (tzi.IsDaylightSavingTime (date));
+                                       Assert.AreEqual (new TimeSpan (3, 0, 0), tzi.GetUtcOffset (date));
+                                       Assert.IsTrue (tzi.IsDaylightSavingTime (new DateTimeOffset (date, tzi.GetUtcOffset (date))));
+
+                               } finally {
+                                       transitionsField.SetValue (tzi, transitions);
+                               }
+                       }
+
                        [Test] //Covers #41349
                        public void TestIsDST_DateTimeOffset ()
                        {
-                               TimeZoneInfo tzi = TimeZoneInfo.FindSystemTimeZoneById ("Europe/Athens");
+                               TimeZoneInfo tzi = TimeZoneInfo.FindSystemTimeZoneById (MapTimeZoneId ("Europe/Athens"));
                                var date = new DateTime (2014, 3, 30 , 2, 0, 0);
                                var offset = tzi.GetUtcOffset (date);
                                var dateOffset = new DateTimeOffset (date, offset);
@@ -415,8 +508,6 @@ namespace MonoTests.System
                        [ExpectedException (typeof (ArgumentException))]
                        public void ConvertFromUtc_KindIsLocalException ()
                        {
-                               if (Environment.OSVersion.Platform != PlatformID.Unix)
-                                       throw new ArgumentException ();
                                TimeZoneInfo.ConvertTimeFromUtc (new DateTime (2007, 5, 3, 11, 8, 0, DateTimeKind.Local), TimeZoneInfo.Local);  
                        }
                
@@ -438,8 +529,6 @@ namespace MonoTests.System
                        [Test]
                        public void ConvertFromUTC_ConvertInWinter ()
                        {
-                               if (Environment.OSVersion.Platform != PlatformID.Unix)
-                                       Assert.Ignore ("Not running on Unix.");
                                DateTime utc = new DateTime (2007, 12, 25, 12, 0, 0);
                                DateTime converted = TimeZoneInfo.ConvertTimeFromUtc (utc, london);
                                Assert.AreEqual (utc, converted);
@@ -448,8 +537,6 @@ namespace MonoTests.System
                        [Test]
                        public void ConvertFromUtc_ConvertInSummer ()
                        {
-                               if (Environment.OSVersion.Platform != PlatformID.Unix)
-                                       Assert.Ignore ("Not running on Unix.");
                                DateTime utc = new DateTime (2007, 06, 01, 12, 0, 0);
                                DateTime converted = TimeZoneInfo.ConvertTimeFromUtc (utc, london);
                                Assert.AreEqual (utc + new TimeSpan (1,0,0), converted);
@@ -475,8 +562,6 @@ namespace MonoTests.System
                        [ExpectedException (typeof (ArgumentException))]
                        public void ConvertToUTC_KindIsLocalButSourceIsNot ()
                        {
-                               if (Environment.OSVersion.Platform != PlatformID.Unix)
-                                       throw new ArgumentException ();
                                TimeZoneInfo.ConvertTimeToUtc (new DateTime (2007, 5, 3, 12, 8, 0, DateTimeKind.Local), london);        
                        }
                
@@ -507,8 +592,6 @@ namespace MonoTests.System
                        [Test]
                        public void ConvertFromToUtc ()
                        {
-                               if (Environment.OSVersion.Platform != PlatformID.Unix)
-                                       Assert.Ignore ("Not running on Unix.");
                                DateTime utc = DateTime.UtcNow;
                                Assert.AreEqual (utc.Kind, DateTimeKind.Utc);
                                DateTime converted = TimeZoneInfo.ConvertTimeFromUtc (utc, london);
@@ -557,10 +640,7 @@ namespace MonoTests.System
                        [Test]
                        public void ConvertToTimeZone ()
                        {
-                               if (Environment.OSVersion.Platform != PlatformID.Unix)
-                                       Assert.Ignore ("Not running on Unix.");
-
-                               TimeZoneInfo.ConvertTime (DateTime.Now, TimeZoneInfo.FindSystemTimeZoneById("Pacific/Auckland"));
+                               TimeZoneInfo.ConvertTime (DateTime.Now, TimeZoneInfo.FindSystemTimeZoneById (MapTimeZoneId ("Pacific/Auckland")));
                        }
 
                        [Test]
@@ -607,11 +687,7 @@ namespace MonoTests.System
                        [Test (Description="Fix for xambug https://bugzilla.xamarin.com/show_bug.cgi?id=17155")]
                        public void ConvertTime_AdjustmentRuleAfterNewYears ()
                        {
-                               TimeZoneInfo tz;
-                               if (Environment.OSVersion.Platform == PlatformID.Unix)
-                                       tz = TimeZoneInfo.FindSystemTimeZoneById ("Pacific/Auckland"); // *nix
-                               else
-                                       tz = TimeZoneInfo.FindSystemTimeZoneById ("New Zealand Standard Time"); // Windows
+                               TimeZoneInfo tz = TimeZoneInfo.FindSystemTimeZoneById (MapTimeZoneId ("Pacific/Auckland"));
 
                                // DST start: 9/29/2013 2:00:00 AM
                                // DST end: 4/6/2014 3:00:00 AM
@@ -650,19 +726,8 @@ namespace MonoTests.System
                        [Test (Description="Fix the bug https://bugzilla.xamarin.com/show_bug.cgi?id=1849")]
                        public void ConvertTime_AjustmentConvertTimeWithSourceTimeZone () {
                                
-                               TimeZoneInfo easternTimeZone;
-                               TimeZoneInfo pacificTimeZone;
-
-                               if (Environment.OSVersion.Platform == PlatformID.Unix) {
-                                       // *nix
-                                       easternTimeZone = TimeZoneInfo.FindSystemTimeZoneById ("US/Eastern");
-                                       pacificTimeZone = TimeZoneInfo.FindSystemTimeZoneById ("US/Pacific");   
-                               }
-                               else {
-                                       // Windows
-                                       easternTimeZone = TimeZoneInfo.FindSystemTimeZoneById ("Eastern Standard Time");
-                                       pacificTimeZone = TimeZoneInfo.FindSystemTimeZoneById ("Pacific Standard Time");
-                               }
+                               TimeZoneInfo easternTimeZone = TimeZoneInfo.FindSystemTimeZoneById (MapTimeZoneId ("US/Eastern"));
+                               TimeZoneInfo pacificTimeZone = TimeZoneInfo.FindSystemTimeZoneById (MapTimeZoneId ("US/Pacific"));
 
                                DateTime lastMidnight = new DateTime (new DateTime (2012, 06, 13).Ticks, DateTimeKind.Unspecified);
                                DateTime lastMidnightAsEST = TimeZoneInfo.ConvertTime (lastMidnight, pacificTimeZone, easternTimeZone);
@@ -674,6 +739,14 @@ namespace MonoTests.System
                                Assert.AreEqual (expectedDate, lastMidnightAsEST);
                                Assert.AreEqual (lastMidnight, lastMidnightAsPST);
                        }
+
+                       [Test]
+                       public void ConvertTimeBySystemTimeZoneId_UtcId ()
+                       {
+                               DateTime localTime = TimeZoneInfo.ConvertTime (DateTime.UtcNow, TimeZoneInfo.Utc, TimeZoneInfo.Local);
+
+                               TimeZoneInfo.ConvertTimeBySystemTimeZoneId (DateTime.UtcNow, TimeZoneInfo.Utc.Id, TimeZoneInfo.Local.Id);
+                       }
                }
                
                [TestFixture]
@@ -727,8 +800,6 @@ namespace MonoTests.System
                        [Test]
                        public void AmbiguousDates ()
                        {
-                               if (Environment.OSVersion.Platform != PlatformID.Unix)
-                                       Assert.Ignore ("Not running on Unix.");
                                Assert.IsFalse (london.IsAmbiguousTime (new DateTime (2007, 10, 28, 1, 0, 0)));
                                Assert.IsTrue (london.IsAmbiguousTime (new DateTime (2007, 10, 28, 1, 0, 1)));
                                Assert.IsTrue (london.IsAmbiguousTime (new DateTime (2007, 10, 28, 2, 0, 0)));
@@ -738,8 +809,6 @@ namespace MonoTests.System
                        [Test]
                        public void AmbiguousUTCDates ()
                        {
-                               if (Environment.OSVersion.Platform != PlatformID.Unix)
-                                       Assert.Ignore ("Not running on Unix.");
                                Assert.IsFalse (london.IsAmbiguousTime (new DateTime (2007, 10, 28, 0, 0, 0, DateTimeKind.Utc)));
                                Assert.IsTrue (london.IsAmbiguousTime (new DateTime (2007, 10, 28, 0, 0, 1, DateTimeKind.Utc)));
                                Assert.IsTrue (london.IsAmbiguousTime (new DateTime (2007, 10, 28, 0, 59, 59, DateTimeKind.Utc)));
@@ -769,8 +838,6 @@ namespace MonoTests.System
                        [Test]
                        public void NotEmpty ()
                        {
-                               if (Environment.OSVersion.Platform != PlatformID.Unix)
-                                       Assert.Ignore ("Not running on Unix.");
                                global::System.Collections.ObjectModel.ReadOnlyCollection<TimeZoneInfo> systemTZ = TimeZoneInfo.GetSystemTimeZones ();
                                Assert.IsNotNull(systemTZ, "SystemTZ is null");
                                Assert.IsFalse (systemTZ.Count == 0, "SystemTZ is empty");
@@ -779,11 +846,9 @@ namespace MonoTests.System
                        [Test]
                        public void ContainsBrussels ()
                        {
-                               if (Environment.OSVersion.Platform != PlatformID.Unix)
-                                       Assert.Ignore ("Not running on Unix.");
                                global::System.Collections.ObjectModel.ReadOnlyCollection<TimeZoneInfo> systemTZ = TimeZoneInfo.GetSystemTimeZones ();
                                foreach (TimeZoneInfo tz in systemTZ) {
-                                       if (tz.Id == "Europe/Brussels")
+                                       if (tz.Id == MapTimeZoneId ("Europe/Brussels"))
                                                return;
                                }
                                Assert.Fail ("Europe/Brussels not found in SystemTZ");
@@ -824,72 +889,56 @@ namespace MonoTests.System
                        [ExpectedException (typeof (TimeZoneNotFoundException))]
                        public void NonSystemTimezone ()
                        {
-                               if (Environment.OSVersion.Platform != PlatformID.Unix)
-                                       throw new TimeZoneNotFoundException ();
                                TimeZoneInfo.FindSystemTimeZoneById ("Neverland/The_Lagoon");
                        }
                
                        [Test]
                        public void FindBrusselsTZ ()
                        {
-                               if (Environment.OSVersion.Platform != PlatformID.Unix)
-                                       Assert.Ignore ("Not running on Unix.");
-                               TimeZoneInfo brussels = TimeZoneInfo.FindSystemTimeZoneById ("Europe/Brussels");
+                               TimeZoneInfo brussels = TimeZoneInfo.FindSystemTimeZoneById (MapTimeZoneId ("Europe/Brussels"));
                                Assert.IsNotNull (brussels);
                        }
                
                        [Test]
                        public void OffsetIsCorrectInKinshasa ()
                        {
-                               if (Environment.OSVersion.Platform != PlatformID.Unix)
-                                       Assert.Ignore ("Not running on Unix.");
-                               TimeZoneInfo kin = TimeZoneInfo.FindSystemTimeZoneById ("Africa/Kinshasa");
+                               TimeZoneInfo kin = TimeZoneInfo.FindSystemTimeZoneById (MapTimeZoneId ("Africa/Kinshasa"));
                                Assert.AreEqual (new TimeSpan (1,0,0), kin.BaseUtcOffset, "BaseUtcOffset in Kinshasa is not +1h");
                        }
                
                        [Test]
                        public void OffsetIsCorrectInBrussels ()
                        {
-                               if (Environment.OSVersion.Platform != PlatformID.Unix)
-                                       Assert.Ignore ("Not running on Unix.");
-                               TimeZoneInfo brussels = TimeZoneInfo.FindSystemTimeZoneById ("Europe/Brussels");
+                               TimeZoneInfo brussels = TimeZoneInfo.FindSystemTimeZoneById (MapTimeZoneId ("Europe/Brussels"));
                                Assert.AreEqual (new TimeSpan (1,0,0), brussels.BaseUtcOffset, "BaseUtcOffset for Brussels is not +1h");
                        }
                
                        [Test]
                        public void NoDSTInKinshasa ()
                        {
-                               if (Environment.OSVersion.Platform != PlatformID.Unix)
-                                       Assert.Ignore ("Not running on Unix.");
-                               TimeZoneInfo kin = TimeZoneInfo.FindSystemTimeZoneById ("Africa/Kinshasa");
+                               TimeZoneInfo kin = TimeZoneInfo.FindSystemTimeZoneById (MapTimeZoneId ("Africa/Kinshasa"));
                                Assert.IsFalse (kin.SupportsDaylightSavingTime);
                        }
                
                        [Test]
                        public void BrusselsSupportsDST ()
                        {
-                               if (Environment.OSVersion.Platform != PlatformID.Unix)
-                                       Assert.Ignore ("Not running on Unix.");
-                               TimeZoneInfo brussels = TimeZoneInfo.FindSystemTimeZoneById ("Europe/Brussels");
+                               TimeZoneInfo brussels = TimeZoneInfo.FindSystemTimeZoneById (MapTimeZoneId ("Europe/Brussels"));
                                Assert.IsTrue (brussels.SupportsDaylightSavingTime);
                        }
                
                        [Test]
                        public void MelbourneSupportsDST ()
                        {
-                               if (Environment.OSVersion.Platform != PlatformID.Unix)
-                                       Assert.Ignore ("Not running on Unix.");
-                               TimeZoneInfo melbourne = TimeZoneInfo.FindSystemTimeZoneById ("Australia/Melbourne");
+                               TimeZoneInfo melbourne = TimeZoneInfo.FindSystemTimeZoneById (MapTimeZoneId ("Australia/Melbourne"));
                                Assert.IsTrue (melbourne.SupportsDaylightSavingTime);
                        }
                
                        [Test]
                        public void RomeAndVaticanSharesTime ()
                        {
-                               if (Environment.OSVersion.Platform != PlatformID.Unix)
-                                       Assert.Ignore ("Not running on Unix.");
-                               TimeZoneInfo rome = TimeZoneInfo.FindSystemTimeZoneById ("Europe/Rome");
-                               TimeZoneInfo vatican = TimeZoneInfo.FindSystemTimeZoneById ("Europe/Vatican");
+                               TimeZoneInfo rome = TimeZoneInfo.FindSystemTimeZoneById (MapTimeZoneId ("Europe/Rome"));
+                               TimeZoneInfo vatican = TimeZoneInfo.FindSystemTimeZoneById (MapTimeZoneId ("Europe/Vatican"));
                                Assert.IsTrue (rome.HasSameRules (vatican));
                        }
 
@@ -959,9 +1008,7 @@ namespace MonoTests.System
                        [ExpectedException (typeof(ArgumentException))]
                        public void DateIsNotAmbiguous ()
                        {
-                               if (Environment.OSVersion.Platform != PlatformID.Unix)
-                                       throw new ArgumentException ();
-                               TimeZoneInfo brussels = TimeZoneInfo.FindSystemTimeZoneById ("Europe/Brussels");
+                               TimeZoneInfo brussels = TimeZoneInfo.FindSystemTimeZoneById (MapTimeZoneId ("Europe/Brussels"));
                                DateTime date = new DateTime (2007, 05, 11, 11, 40, 00);
                                brussels.GetAmbiguousTimeOffsets (date);
                        }
@@ -969,9 +1016,7 @@ namespace MonoTests.System
                        [Test]
                        public void AmbiguousOffsets ()
                        {
-                               if (Environment.OSVersion.Platform != PlatformID.Unix)
-                                       Assert.Ignore ("Not running on Unix.");
-                               TimeZoneInfo brussels = TimeZoneInfo.FindSystemTimeZoneById ("Europe/Brussels");
+                               TimeZoneInfo brussels = TimeZoneInfo.FindSystemTimeZoneById (MapTimeZoneId ("Europe/Brussels"));
                                DateTime date = new DateTime (2007, 10, 28, 2, 30, 00);
                                Assert.IsTrue (brussels.IsAmbiguousTime (date));
                                Assert.AreEqual (2, brussels.GetAmbiguousTimeOffsets (date).Length);
@@ -1206,11 +1251,7 @@ namespace MonoTests.System
                        [Test]
                        public void TestSydneyDaylightChanges ()
                        {
-                               TimeZoneInfo tz;
-                               if (Environment.OSVersion.Platform == PlatformID.Unix)
-                                       tz = TimeZoneInfo.FindSystemTimeZoneById ("Australia/Sydney");
-                               else
-                                       tz = TimeZoneInfo.FindSystemTimeZoneById ("W. Australia Standard Time");
+                               TimeZoneInfo tz = TimeZoneInfo.FindSystemTimeZoneById (MapTimeZoneId ("Australia/Sydney"));
 
                                var changes = (DaylightTime) getChanges.Invoke (tz, new object [] {2014});
 
@@ -1219,6 +1260,18 @@ namespace MonoTests.System
                                Assert.AreEqual (new DateTime (2014, 4, 6, 3, 0, 0), changes.End);
                        }
 
+                       [Test]
+                       public void TestAthensDaylightChanges ()
+                       {
+                               TimeZoneInfo tz = TimeZoneInfo.FindSystemTimeZoneById (MapTimeZoneId ("Europe/Athens"));
+
+                               var changes = (DaylightTime) getChanges.Invoke (tz, new object [] {2014});
+
+                               Assert.AreEqual (new TimeSpan (1, 0, 0), changes.Delta);
+                               Assert.AreEqual (new DateTime (2014, 3, 30, 3, 0, 0), changes.Start);
+                               Assert.AreEqual (new DateTime (2014, 10, 26, 4, 0, 0), changes.End);
+                       }
+
                        [Test]
                        public void AllTimeZonesDaylightChanges ()
                        {
index 409e62066b5f4a5a9cbd133ddff09a8a535fe598..d93258fbe1562310156d9ef0bfb2ecf62760b9e6 100644 (file)
@@ -23,8 +23,8 @@ public class TimeZoneTest {
 
        private void CET (TimeZone t1) 
        {
-               Assert.AreEqual("CET", t1.StandardName, "A01");
-               Assert.AreEqual("CEST", t1.DaylightName, "A02");
+               Assert.IsTrue("CET" == t1.StandardName || "W. Europe Standard Time" == t1.StandardName, "A01");
+               Assert.IsTrue("CEST" == t1.DaylightName || "W. Europe Daylight Time" == t1.DaylightName, "A02");
        
                DaylightTime d1 = t1.GetDaylightChanges (2002);
                Assert.AreEqual("03/31/2002 02:00:00", d1.Start.ToString ("G", CultureInfo.InvariantCulture), "A03");
@@ -55,9 +55,8 @@ public class TimeZoneTest {
 
        private void EST (TimeZone t1) 
        {
-               // It could be EST though...
-               //Assert.AreEqual("Eastern Standard Time", t1.StandardName, "B01");
-               //Assert.AreEqual("Eastern Daylight Time", t1.DaylightName, "B02");
+               Assert.IsTrue("EST" == t1.StandardName || "Eastern Standard Time" == t1.StandardName, "B01");
+               Assert.IsTrue("EDT" == t1.DaylightName || "Eastern Daylight Time" == t1.DaylightName, "B02");
 
                DaylightTime d1 = t1.GetDaylightChanges (2002);
                Assert.AreEqual("04/07/2002 02:00:00", d1.Start.ToString ("G", CultureInfo.InvariantCulture), "B03");
@@ -174,6 +173,7 @@ public class TimeZoneTest {
        {
                TimeZone t1 = TimeZone.CurrentTimeZone;
                switch (t1.StandardName) {
+                       case "W. Europe Standard Time":
                        case "CET":
                                CET (t1);
                                break;
@@ -320,9 +320,9 @@ public class TimeZoneTest {
                [Test]
                public void FindSystemTimeZoneById ()
                {
-                       TimeZoneInfo tzi = TimeZoneInfo.FindSystemTimeZoneById ("Canada/Eastern");
-                       Assert.AreEqual ("EDT", tzi.DaylightName, "DaylightName");
-                       Assert.AreEqual ("EST", tzi.StandardName, "StandardName");
+                       TimeZoneInfo tzi = TimeZoneInfo.FindSystemTimeZoneById (TimeZoneInfoTest.MapTimeZoneId ("Canada/Eastern"));
+                       Assert.IsTrue ("EDT" == tzi.DaylightName || "Eastern Daylight Time" == tzi.DaylightName, "DaylightName");
+                       Assert.IsTrue ("EST" == tzi.StandardName || "Eastern Standard Time" == tzi.StandardName, "StandardName");
                        Assert.IsTrue (tzi.SupportsDaylightSavingTime, "SupportsDaylightSavingTime");
                }
 
index 1e38f069af2b809045fa4e4cb2b686d035553a3f..4ea4f283bce97cc8e8add2ab8e81dd1891542daf 100644 (file)
@@ -266,6 +266,7 @@ namespace MonoTests.System
 #endif
                const string ASSEMBLY_NAME = "MonoTests.System.TypeTest";
                static int typeIndexer = 0;
+               static bool isMono = Type.GetType ("Mono.Runtime", false) != null;
 
                [SetUp]
                public void SetUp ()
@@ -1834,8 +1835,8 @@ namespace MonoTests.System
 
                        Assert.AreEqual (t1.FullName, "System.__ComObject");
 
-                       if (Environment.OSVersion.Platform == PlatformID.Win32Windows ||
-                               Environment.OSVersion.Platform == PlatformID.Win32NT)
+                       if (!isMono && (Environment.OSVersion.Platform == PlatformID.Win32Windows ||
+                               Environment.OSVersion.Platform == PlatformID.Win32NT))
                                Activator.CreateInstance(t1);
 
                        Assert.AreEqual (t2.FullName, "System.__ComObject");
@@ -3057,9 +3058,15 @@ namespace MonoTests.System
                public void MakeArrayTypeTest ()
                {
                        // This should not crash:
-                       typeof (void).MakeArrayType ();
+                       Type t = typeof (void).MakeArrayType ();
                }
                
+               [Test]
+               [ExpectedException (typeof (InvalidProgramException))]
+               public void MakeArrayTypedReferenceInstanceTest ()
+               {
+                       object o = Array.CreateInstance (typeof (global::System.TypedReference), 1);
+               }
 
                [ComVisible (true)]
                public class ComFoo<T> {
@@ -4190,6 +4197,17 @@ namespace MonoTests.System
                        MustTLE (string.Format ("{0}ZZZZ,{1}", typeof (MyRealEnum).FullName, aqn));
                }
 
+               [Test]
+               public void GetTypeExceptionMsg () {
+                       string typeName = "system.int32, foo";
+                       try {
+                               Type.GetType(typeName, true, false);
+                       } catch (TypeLoadException ex) {
+                               Assert.IsTrue (ex.Message.Contains ("system.int32"));
+                               Assert.IsTrue (ex.Message.Contains ("foo"));
+                       }
+               }
+
                delegate void MyAction<in T>(T ag);
 
                [Test] //bug #668506
@@ -4317,6 +4335,24 @@ namespace MonoTests.System
                }
 #endif
 
+
+               [Test]
+               public void GetTypeBadArity()
+               {
+                       // Regression test for #46250
+                       try {
+                               Type.GetType ("System.Collections.Generic.Dictionary`2[System.String]", true);
+                               Assert.Fail ("Did not throw an exception (#1)");
+                       } catch (ArgumentException) {
+                       }
+
+                       try {
+                               Type.GetType ("System.Collections.Generic.Dictionary`2[System.String,System.Int32,System.Int64]", true);
+                               Assert.Fail ("Did not throw an exception (#2)");
+                       } catch (ArgumentException) {
+                       }
+               }
+
                public abstract class Stream : IDisposable
                {
                        public void Dispose ()
index 717a99b6e1cba9263ce50e2ee00abdde649a65d3..b94afe1013da0b7ef3ceb012df27cb8d1875932d 100644 (file)
@@ -124,7 +124,6 @@ namespace MonoTests.System {
                        Assert.IsFalse (Foo.failed);
                }
 
-#if NET_4_5
                [Test]
                public void WeakReferenceT_TryGetTarget_NullTarget ()
                {
@@ -132,7 +131,6 @@ namespace MonoTests.System {
                        object obj;
                        Assert.IsFalse (r.TryGetTarget (out obj), "#1");
                }
-#endif
        }
 }
 
diff --git a/mcs/class/corlib/coreclr/AsyncLocal.cs b/mcs/class/corlib/coreclr/AsyncLocal.cs
deleted file mode 100644 (file)
index 5b7b61f..0000000
+++ /dev/null
@@ -1,123 +0,0 @@
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-
-using System;
-using System.Collections.Generic;
-using System.Diagnostics.Contracts;
-using System.Security;
-
-namespace System.Threading
-{
-    //
-    // AsyncLocal<T> represents "ambient" data that is local to a given asynchronous control flow, such as an
-    // async method.  For example, say you want to associate a culture with a given async flow:
-    //
-    // static AsyncLocal<Culture> s_currentCulture = new AsyncLocal<Culture>();
-    //
-    // static async Task SomeOperationAsync(Culture culture)
-    // {
-    //    s_currentCulture.Value = culture;
-    //
-    //    await FooAsync();
-    // }
-    //
-    // static async Task FooAsync()
-    // {
-    //    PrintStringWithCulture(s_currentCulture.Value);
-    // }
-    //
-    // AsyncLocal<T> also provides optional notifications when the value associated with the current thread
-    // changes, either because it was explicitly changed by setting the Value property, or implicitly changed
-    // when the thread encountered an "await" or other context transition.  For example, we might want our
-    // current culture to be communicated to the OS as well:
-    //
-    // static AsyncLocal<Culture> s_currentCulture = new AsyncLocal<Culture>(
-    //   args =>
-    //   {
-    //      NativeMethods.SetThreadCulture(args.CurrentValue.LCID);
-    //   });
-    //
-    public sealed class AsyncLocal<T> : IAsyncLocal
-    {
-        [SecurityCritical] // critical because this action will terminate the process if it throws.
-        private readonly Action<AsyncLocalValueChangedArgs<T>> m_valueChangedHandler;
-
-        //
-        // Constructs an AsyncLocal<T> that does not receive change notifications.
-        //
-        public AsyncLocal() 
-        {
-        }
-
-        //
-        // Constructs an AsyncLocal<T> with a delegate that is called whenever the current value changes
-        // on any thread.
-        //
-        [SecurityCritical]
-        public AsyncLocal(Action<AsyncLocalValueChangedArgs<T>> valueChangedHandler) 
-        {
-            m_valueChangedHandler = valueChangedHandler;
-        }
-
-        public T Value
-        {
-            [SecuritySafeCritical]
-            get 
-            { 
-#if MONO
-                throw new NotImplementedException ();
-#else                
-                object obj = ExecutionContext.GetLocalValue(this);
-                return (obj == null) ? default(T) : (T)obj;
-#endif                
-            }
-            [SecuritySafeCritical]
-            set 
-            {
-#if MONO
-                throw new NotImplementedException ();
-#else                
-                ExecutionContext.SetLocalValue(this, value, m_valueChangedHandler != null); 
-#endif
-            }
-        }
-
-        [SecurityCritical]
-        void IAsyncLocal.OnValueChanged(object previousValueObj, object currentValueObj, bool contextChanged)
-        {
-            Contract.Assert(m_valueChangedHandler != null);
-            T previousValue = previousValueObj == null ? default(T) : (T)previousValueObj;
-            T currentValue = currentValueObj == null ? default(T) : (T)currentValueObj;
-            m_valueChangedHandler(new AsyncLocalValueChangedArgs<T>(previousValue, currentValue, contextChanged));
-        }
-    }
-
-    //
-    // Interface to allow non-generic code in ExecutionContext to call into the generic AsyncLocal<T> type.
-    //
-    internal interface IAsyncLocal
-    {
-        [SecurityCritical]
-        void OnValueChanged(object previousValue, object currentValue, bool contextChanged);
-    }
-
-    public struct AsyncLocalValueChangedArgs<T>
-    {
-        public T PreviousValue { get; private set; }
-        public T CurrentValue { get; private set; }
-        
-        //
-        // If the value changed because we changed to a different ExecutionContext, this is true.  If it changed
-        // because someone set the Value property, this is false.
-        //
-        public bool ThreadContextChanged { get; private set; }
-
-        internal AsyncLocalValueChangedArgs(T previousValue, T currentValue, bool contextChanged)
-            : this()
-        {
-            PreviousValue = previousValue;
-            CurrentValue = currentValue;
-            ThreadContextChanged = contextChanged;
-        }
-    }
-}
\ No newline at end of file
diff --git a/mcs/class/corlib/coreclr/DisablePrivateReflectionAttribute.cs b/mcs/class/corlib/coreclr/DisablePrivateReflectionAttribute.cs
deleted file mode 100644 (file)
index c510478..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-
-namespace System.Runtime.CompilerServices
-{
-    using System;
-
-    [AttributeUsage(AttributeTargets.Assembly, AllowMultiple=false, Inherited=false)]
-    public sealed class DisablePrivateReflectionAttribute : Attribute
-    {
-        public DisablePrivateReflectionAttribute() {}
-    }
-}
-
diff --git a/mcs/class/corlib/coreclr/EncodingProvider.cs b/mcs/class/corlib/coreclr/EncodingProvider.cs
deleted file mode 100644 (file)
index 82024ce..0000000
+++ /dev/null
@@ -1,136 +0,0 @@
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-
-namespace System.Text
-{
-    using System;
-    using System.Collections;
-    using System.Collections.Generic;
-
-    [System.Runtime.InteropServices.ComVisible(true)]
-    public abstract class EncodingProvider
-    {
-        public EncodingProvider() { }
-        public abstract Encoding GetEncoding(string name);
-        public abstract Encoding GetEncoding(int codepage);
-
-        // GetEncoding should return either valid encoding or null. shouldn't throw any exception except on null name
-        public virtual Encoding GetEncoding(string name, EncoderFallback encoderFallback, DecoderFallback decoderFallback)
-        {
-            Encoding enc = GetEncoding(name);
-            if (enc != null)
-            {
-                enc = (Encoding)GetEncoding(name).Clone();
-                enc.EncoderFallback = encoderFallback;
-                enc.DecoderFallback = decoderFallback;
-            }
-
-            return enc;
-        }
-
-        public virtual Encoding GetEncoding(int codepage, EncoderFallback encoderFallback, DecoderFallback decoderFallback)
-        {
-            Encoding enc = GetEncoding(codepage);
-            if (enc != null)
-            {
-                enc = (Encoding)GetEncoding(codepage).Clone();
-                enc.EncoderFallback = encoderFallback;
-                enc.DecoderFallback = decoderFallback;
-            }
-
-            return enc;
-        }
-
-        internal static void AddProvider(EncodingProvider provider)
-        {
-            if (provider == null)
-                throw new ArgumentNullException("provider");
-
-            lock (s_InternalSyncObject)
-            {
-                if (s_providers == null)
-                {
-                    s_providers = new EncodingProvider[1] { provider };
-                    return;
-                }
-
-                if (Array.IndexOf(s_providers, provider) >= 0)
-                {
-                    return;
-                }
-
-                var providers = new EncodingProvider[s_providers.Length + 1];
-                Array.Copy(s_providers, providers, s_providers.Length);
-                providers[providers.Length - 1] = provider;
-                s_providers = providers;
-            }
-        }
-
-        internal static Encoding GetEncodingFromProvider(int codepage)
-        {
-            if (s_providers == null)
-                return null;
-
-            var providers = s_providers;
-            foreach (EncodingProvider provider in providers)
-            {
-                Encoding enc = provider.GetEncoding(codepage);
-                if (enc != null)
-                    return enc;
-            }
-
-            return null;
-        }
-
-        internal static Encoding GetEncodingFromProvider(string encodingName)
-        {
-            if (s_providers == null)
-                return null;
-
-            var providers = s_providers;
-            foreach (EncodingProvider provider in providers)
-            {
-                Encoding enc = provider.GetEncoding(encodingName);
-                if (enc != null)
-                    return enc;
-            }
-
-            return null;
-        }
-
-        internal static Encoding GetEncodingFromProvider(int codepage, EncoderFallback enc, DecoderFallback dec)
-        {
-            if (s_providers == null)
-                return null;
-
-            var providers = s_providers;
-            foreach (EncodingProvider provider in providers)
-            {
-                Encoding encing = provider.GetEncoding(codepage, enc, dec);
-                if (encing != null)
-                    return encing;
-            }
-
-            return null;
-        }
-
-        internal static Encoding GetEncodingFromProvider(string encodingName, EncoderFallback enc, DecoderFallback dec)
-        {
-            if (s_providers == null)
-                return null;
-
-            var providers = s_providers;
-            foreach (EncodingProvider provider in providers)
-            {
-                Encoding encoding = provider.GetEncoding(encodingName, enc, dec);
-                if (encoding != null)
-                    return encoding;
-            }
-
-            return null;
-        }
-
-        private static Object s_InternalSyncObject = new Object();
-        private static volatile EncodingProvider[] s_providers;
-    }
-}
diff --git a/mcs/class/corlib/coreclr/FormattableString.cs b/mcs/class/corlib/coreclr/FormattableString.cs
deleted file mode 100644 (file)
index 420421b..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-// Copyright (c) Microsoft. All rights reserved. 
-// Licensed under the MIT license. See LICENSE file in the project root for full license information. 
-
-/*============================================================
-**
-** Class:  FormattableString
-**
-**
-** Purpose: implementation of the FormattableString
-** class.
-**
-===========================================================*/
-namespace System
-{
-    /// <summary>
-    /// A composite format string along with the arguments to be formatted. An instance of this
-    /// type may result from the use of the C# or VB language primitive "interpolated string".
-    /// </summary>
-    public abstract class FormattableString : IFormattable
-    {
-        /// <summary>
-        /// The composite format string.
-        /// </summary>
-        public abstract string Format { get; }
-
-        /// <summary>
-        /// Returns an object array that contains zero or more objects to format. Clients should not
-        /// mutate the contents of the array.
-        /// </summary>
-        public abstract object[] GetArguments();
-
-        /// <summary>
-        /// The number of arguments to be formatted.
-        /// </summary>
-        public abstract int ArgumentCount { get; }
-
-        /// <summary>
-        /// Returns one argument to be formatted from argument position <paramref name="index"/>.
-        /// </summary>
-        public abstract object GetArgument(int index);
-
-        /// <summary>
-        /// Format to a string using the given culture.
-        /// </summary>
-        public abstract string ToString(IFormatProvider formatProvider);
-
-        string IFormattable.ToString(string ignored, IFormatProvider formatProvider)
-        {
-            return ToString(formatProvider);
-        }
-
-        /// <summary>
-        /// Format the given object in the invariant culture. This static method may be
-        /// imported in C# by
-        /// <code>
-        /// using static System.FormattableString;
-        /// </code>.
-        /// Within the scope
-        /// of that import directive an interpolated string may be formatted in the
-        /// invariant culture by writing, for example,
-        /// <code>
-        /// Invariant($"{{ lat = {latitude}; lon = {longitude} }}")
-        /// </code>
-        /// </summary>
-        public static string Invariant(FormattableString formattable)
-        {
-            if (formattable == null)
-            {
-                throw new ArgumentNullException("formattable");
-            }
-
-            return formattable.ToString(Globalization.CultureInfo.InvariantCulture);
-        }
-
-        public override string ToString()
-        {
-            return ToString(Globalization.CultureInfo.CurrentCulture);
-        }
-    }
-}
diff --git a/mcs/class/corlib/coreclr/FormattableStringFactory.cs b/mcs/class/corlib/coreclr/FormattableStringFactory.cs
deleted file mode 100644 (file)
index 990204c..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright (c) Microsoft. All rights reserved. 
-// Licensed under the MIT license. See LICENSE file in the project root for full license information. 
-
-/*============================================================
-**
-** Class:  FormattableStringFactory
-**
-**
-** Purpose: implementation of the FormattableStringFactory
-** class.
-**
-===========================================================*/
-namespace System.Runtime.CompilerServices
-{
-    /// <summary>
-    /// A factory type used by compilers to create instances of the type <see cref="FormattableString"/>.
-    /// </summary>
-    public static class FormattableStringFactory
-    {
-        /// <summary>
-        /// Create a <see cref="FormattableString"/> from a composite format string and object
-        /// array containing zero or more objects to format.
-        /// </summary>
-        public static FormattableString Create(string format, params object[] arguments)
-        {
-            if (format == null)
-            {
-                throw new ArgumentNullException("format");
-            }
-
-            if (arguments == null)
-            {
-                throw new ArgumentNullException("arguments");
-            }
-
-            return new ConcreteFormattableString(format, arguments);
-        }
-
-        private sealed class ConcreteFormattableString : FormattableString
-        {
-            private readonly string _format;
-            private readonly object[] _arguments;
-
-            internal ConcreteFormattableString(string format, object[] arguments)
-            {
-                _format = format;
-                _arguments = arguments;
-            }
-
-            public override string Format { get { return _format; } }
-            public override object[] GetArguments() { return _arguments; }
-            public override int ArgumentCount { get { return _arguments.Length; } }
-            public override object GetArgument(int index) { return _arguments[index]; }
-            public override string ToString(IFormatProvider formatProvider) { return string.Format(formatProvider, _format, _arguments); }
-        }
-    }
-}
diff --git a/mcs/class/corlib/coreclr/WaitHandleExtensions.cs b/mcs/class/corlib/coreclr/WaitHandleExtensions.cs
deleted file mode 100644 (file)
index 93dbc6f..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-
-//
-
-using Microsoft.Win32.SafeHandles;
-using System.Security;
-
-namespace System.Threading
-{
-    public static class WaitHandleExtensions
-    {
-        /// <summary>
-        /// Gets the native operating system handle.
-        /// </summary>
-        /// <param name="waitHandle">The <see cref="System.Threading.WaitHandle"/> to operate on.</param>
-        /// <returns>A <see cref="System.Runtime.InteropServices.SafeHandle"/> representing the native operating system handle.</returns>
-        [SecurityCritical]
-        public static SafeWaitHandle GetSafeWaitHandle(this WaitHandle waitHandle)
-        {
-            if (waitHandle == null)
-            {
-                throw new ArgumentNullException("waitHandle");
-            }
-
-            return waitHandle.SafeWaitHandle;
-        }
-
-        /// <summary>
-        /// Sets the native operating system handle
-        /// </summary>
-        /// <param name="waitHandle">The <see cref="System.Threading.WaitHandle"/> to operate on.</param>
-        /// <param name="value">A <see cref="System.Runtime.InteropServices.SafeHandle"/> representing the native operating system handle.</param>
-        [SecurityCritical]
-        public static void SetSafeWaitHandle(this WaitHandle waitHandle, SafeWaitHandle value)
-        {
-            if (waitHandle == null)
-            {
-                throw new ArgumentNullException("waitHandle");
-            }
-
-            waitHandle.SafeWaitHandle = value;
-        }
-    }
-}
\ No newline at end of file
diff --git a/mcs/class/corlib/corefx/SR.cs b/mcs/class/corlib/corefx/SR.cs
new file mode 100644 (file)
index 0000000..7330ff6
--- /dev/null
@@ -0,0 +1,7 @@
+// TODO: Should be auto-generated from resources.resx
+
+static class SR
+{
+       public const string ArgumentException_ValueTupleIncorrectType = "The parameter should be a ValueTuple type of appropriate arity.";
+       public const string ArgumentException_ValueTupleLastArgumentNotAValueTuple = "The TRest type argument of ValueTuple`8 must be a ValueTuple.";
+}
\ No newline at end of file
index 95f0db7329cb36a446b037c41d2f4f6a1347bf06..760f646ebdf3ee6fd8029f16d9c5a18d5a52cc91 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>612,618,1635,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;INSIDE_CORLIB;MONO_CULTURE_DATA;LIBC;FEATURE_PAL;GENERICS_WORK;FEATURE_LIST_PREDICATES;FEATURE_SERIALIZATION;FEATURE_ASCII;FEATURE_LATIN1;FEATURE_UTF7;FEATURE_UTF32;MONO_HYBRID_ENCODING_SUPPORT;FEATURE_ASYNC_IO;NEW_EXPERIMENTAL_ASYNC_IO;FEATURE_UTF32;FEATURE_EXCEPTIONDISPATCHINFO;FEATURE_CORRUPTING_EXCEPTIONS;FEATURE_EXCEPTION_NOTIFICATIONS;FEATURE_STRONGNAME_MIGRATION;FEATURE_USE_LCID;FEATURE_FUSION;FEATURE_CRYPTO;FEATURE_X509_SECURESTRINGS;FEATURE_SYNCHRONIZATIONCONTEXT;FEATURE_SYNCHRONIZATIONCONTEXT_WAIT;FEATURE_MACL;FEATURE_REMOTING;MONO_COM;FEATURE_COMINTEROP;FEATURE_ROLE_BASED_SECURITY;MONO_FEATURE_THREAD_ABORT;MONO_FEATURE_THREAD_SUSPEND_RESUME;MONO_FEATURE_MULTIPLE_APPDOMAINS;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;FEATURE_PAL;GENERICS_WORK;FEATURE_LIST_PREDICATES;FEATURE_SERIALIZATION;FEATURE_ASCII;FEATURE_LATIN1;FEATURE_UTF7;FEATURE_UTF32;MONO_HYBRID_ENCODING_SUPPORT;FEATURE_ASYNC_IO;NEW_EXPERIMENTAL_ASYNC_IO;FEATURE_UTF32;FEATURE_EXCEPTIONDISPATCHINFO;FEATURE_CORRUPTING_EXCEPTIONS;FEATURE_EXCEPTION_NOTIFICATIONS;FEATURE_STRONGNAME_MIGRATION;FEATURE_USE_LCID;FEATURE_FUSION;FEATURE_CRYPTO;FEATURE_X509_SECURESTRINGS;FEATURE_SYNCHRONIZATIONCONTEXT;FEATURE_SYNCHRONIZATIONCONTEXT_WAIT;FEATURE_MACL;FEATURE_REMOTING;MONO_COM;FEATURE_COMINTEROP;FEATURE_ROLE_BASED_SECURITY;MONO_FEATURE_THREAD_ABORT;MONO_FEATURE_THREAD_SUSPEND_RESUME;MONO_FEATURE_MULTIPLE_APPDOMAINS</DefineConstants>\r
+    <DefineConstants>TRACE;INSIDE_CORLIB;MONO_CULTURE_DATA;LIBC;FEATURE_PAL;GENERICS_WORK;FEATURE_LIST_PREDICATES;FEATURE_SERIALIZATION;FEATURE_ASCII;FEATURE_LATIN1;FEATURE_UTF7;FEATURE_UTF32;MONO_HYBRID_ENCODING_SUPPORT;FEATURE_ASYNC_IO;NEW_EXPERIMENTAL_ASYNC_IO;FEATURE_UTF32;FEATURE_EXCEPTIONDISPATCHINFO;FEATURE_CORRUPTING_EXCEPTIONS;FEATURE_EXCEPTION_NOTIFICATIONS;FEATURE_STRONGNAME_MIGRATION;FEATURE_USE_LCID;FEATURE_FUSION;FEATURE_CRYPTO;FEATURE_X509_SECURESTRINGS;FEATURE_SYNCHRONIZATIONCONTEXT;FEATURE_SYNCHRONIZATIONCONTEXT_WAIT;HAS_CORLIB_CONTRACTS;FEATURE_MACL;FEATURE_REMOTING;MONO_COM;FEATURE_COMINTEROP;FEATURE_ROLE_BASED_SECURITY;MONO_FEATURE_THREAD_ABORT;MONO_FEATURE_THREAD_SUSPEND_RESUME;MONO_FEATURE_MULTIPLE_APPDOMAINS;NET_4_0;NET_4_5;NET_4_6;MONO;FEATURE_PAL;GENERICS_WORK;FEATURE_LIST_PREDICATES;FEATURE_SERIALIZATION;FEATURE_ASCII;FEATURE_LATIN1;FEATURE_UTF7;FEATURE_UTF32;MONO_HYBRID_ENCODING_SUPPORT;FEATURE_ASYNC_IO;NEW_EXPERIMENTAL_ASYNC_IO;FEATURE_UTF32;FEATURE_EXCEPTIONDISPATCHINFO;FEATURE_CORRUPTING_EXCEPTIONS;FEATURE_EXCEPTION_NOTIFICATIONS;FEATURE_STRONGNAME_MIGRATION;FEATURE_USE_LCID;FEATURE_FUSION;FEATURE_CRYPTO;FEATURE_X509_SECURESTRINGS;FEATURE_SYNCHRONIZATIONCONTEXT;FEATURE_SYNCHRONIZATIONCONTEXT_WAIT;HAS_CORLIB_CONTRACTS;FEATURE_MACL;FEATURE_REMOTING;MONO_COM;FEATURE_COMINTEROP;FEATURE_ROLE_BASED_SECURITY;MONO_FEATURE_THREAD_ABORT;MONO_FEATURE_THREAD_SUSPEND_RESUME;MONO_FEATURE_MULTIPLE_APPDOMAINS</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>612,618,1635,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>INSIDE_CORLIB;MONO_CULTURE_DATA;LIBC;FEATURE_PAL;GENERICS_WORK;FEATURE_LIST_PREDICATES;FEATURE_SERIALIZATION;FEATURE_ASCII;FEATURE_LATIN1;FEATURE_UTF7;FEATURE_UTF32;MONO_HYBRID_ENCODING_SUPPORT;FEATURE_ASYNC_IO;NEW_EXPERIMENTAL_ASYNC_IO;FEATURE_UTF32;FEATURE_EXCEPTIONDISPATCHINFO;FEATURE_CORRUPTING_EXCEPTIONS;FEATURE_EXCEPTION_NOTIFICATIONS;FEATURE_STRONGNAME_MIGRATION;FEATURE_USE_LCID;FEATURE_FUSION;FEATURE_CRYPTO;FEATURE_X509_SECURESTRINGS;FEATURE_SYNCHRONIZATIONCONTEXT;FEATURE_SYNCHRONIZATIONCONTEXT_WAIT;FEATURE_MACL;FEATURE_REMOTING;MONO_COM;FEATURE_COMINTEROP;FEATURE_ROLE_BASED_SECURITY;MONO_FEATURE_THREAD_ABORT;MONO_FEATURE_THREAD_SUSPEND_RESUME;MONO_FEATURE_MULTIPLE_APPDOMAINS;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;FEATURE_PAL;GENERICS_WORK;FEATURE_LIST_PREDICATES;FEATURE_SERIALIZATION;FEATURE_ASCII;FEATURE_LATIN1;FEATURE_UTF7;FEATURE_UTF32;MONO_HYBRID_ENCODING_SUPPORT;FEATURE_ASYNC_IO;NEW_EXPERIMENTAL_ASYNC_IO;FEATURE_UTF32;FEATURE_EXCEPTIONDISPATCHINFO;FEATURE_CORRUPTING_EXCEPTIONS;FEATURE_EXCEPTION_NOTIFICATIONS;FEATURE_STRONGNAME_MIGRATION;FEATURE_USE_LCID;FEATURE_FUSION;FEATURE_CRYPTO;FEATURE_X509_SECURESTRINGS;FEATURE_SYNCHRONIZATIONCONTEXT;FEATURE_SYNCHRONIZATIONCONTEXT_WAIT;FEATURE_MACL;FEATURE_REMOTING;MONO_COM;FEATURE_COMINTEROP;FEATURE_ROLE_BASED_SECURITY;MONO_FEATURE_THREAD_ABORT;MONO_FEATURE_THREAD_SUSPEND_RESUME;MONO_FEATURE_MULTIPLE_APPDOMAINS</DefineConstants>\r
+    <DefineConstants>INSIDE_CORLIB;MONO_CULTURE_DATA;LIBC;FEATURE_PAL;GENERICS_WORK;FEATURE_LIST_PREDICATES;FEATURE_SERIALIZATION;FEATURE_ASCII;FEATURE_LATIN1;FEATURE_UTF7;FEATURE_UTF32;MONO_HYBRID_ENCODING_SUPPORT;FEATURE_ASYNC_IO;NEW_EXPERIMENTAL_ASYNC_IO;FEATURE_UTF32;FEATURE_EXCEPTIONDISPATCHINFO;FEATURE_CORRUPTING_EXCEPTIONS;FEATURE_EXCEPTION_NOTIFICATIONS;FEATURE_STRONGNAME_MIGRATION;FEATURE_USE_LCID;FEATURE_FUSION;FEATURE_CRYPTO;FEATURE_X509_SECURESTRINGS;FEATURE_SYNCHRONIZATIONCONTEXT;FEATURE_SYNCHRONIZATIONCONTEXT_WAIT;HAS_CORLIB_CONTRACTS;FEATURE_MACL;FEATURE_REMOTING;MONO_COM;FEATURE_COMINTEROP;FEATURE_ROLE_BASED_SECURITY;MONO_FEATURE_THREAD_ABORT;MONO_FEATURE_THREAD_SUSPEND_RESUME;MONO_FEATURE_MULTIPLE_APPDOMAINS;NET_4_0;NET_4_5;NET_4_6;MONO;FEATURE_PAL;GENERICS_WORK;FEATURE_LIST_PREDICATES;FEATURE_SERIALIZATION;FEATURE_ASCII;FEATURE_LATIN1;FEATURE_UTF7;FEATURE_UTF32;MONO_HYBRID_ENCODING_SUPPORT;FEATURE_ASYNC_IO;NEW_EXPERIMENTAL_ASYNC_IO;FEATURE_UTF32;FEATURE_EXCEPTIONDISPATCHINFO;FEATURE_CORRUPTING_EXCEPTIONS;FEATURE_EXCEPTION_NOTIFICATIONS;FEATURE_STRONGNAME_MIGRATION;FEATURE_USE_LCID;FEATURE_FUSION;FEATURE_CRYPTO;FEATURE_X509_SECURESTRINGS;FEATURE_SYNCHRONIZATIONCONTEXT;FEATURE_SYNCHRONIZATIONCONTEXT_WAIT;HAS_CORLIB_CONTRACTS;FEATURE_MACL;FEATURE_REMOTING;MONO_COM;FEATURE_COMINTEROP;FEATURE_ROLE_BASED_SECURITY;MONO_FEATURE_THREAD_ABORT;MONO_FEATURE_THREAD_SUSPEND_RESUME;MONO_FEATURE_MULTIPLE_APPDOMAINS</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
   </PropertyGroup>\r
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />\r
   <ItemGroup>\r
+    <Compile Include="..\..\..\external\corefx\src\Common\src\System\Numerics\Hashing\HashHelpers.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.ValueTuple\src\System\Runtime\CompilerServices\TupleElementNamesAttribute.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.ValueTuple\src\System\ValueTuple\TupleExtensions.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.ValueTuple\src\System\ValueTuple\ValueTuple.cs" />\r
     <Compile Include="..\..\build\common\AssemblyRef.cs" />\r
     <Compile Include="..\..\build\common\Consts.cs" />\r
     <Compile Include="..\..\build\common\Locale.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\diagnostics\contracts\contractsbcl.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\diagnostics\debuggerattributes.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\diagnostics\eventing\eventactivityoptions.cs" />\r
+    <Compile Include="..\referencesource\mscorlib\system\diagnostics\eventing\eventsourceexception.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\diagnostics\eventing\TraceLogging\EventSourceOptions.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\diagnostics\eventing\TraceLogging\TraceLoggingEventTraits.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\diagnostics\eventing\winmeta.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\fieldaccessexception.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\flagsattribute.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\formatexception.cs" />\r
+    <Compile Include="..\referencesource\mscorlib\system\FormattableString.cs" />\r
+    <Compile Include="..\referencesource\mscorlib\system\gc.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\globalization\bidicategory.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\globalization\calendar.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\globalization\calendaralgorithmtype.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\reflection\reflectioncontext.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\reflection\resourceattributes.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\reflection\RuntimeReflectionExtensions.cs" />\r
+    <Compile Include="..\referencesource\mscorlib\system\reflection\targetexception.cs" />\r
+    <Compile Include="..\referencesource\mscorlib\system\reflection\targetinvocationexception.cs" />\r
+    <Compile Include="..\referencesource\mscorlib\system\reflection\targetparametercountexception.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\reflection\typeattributes.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\reflection\typedelegator.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\reflection\typefilter.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\runtime\compilerservices\datetimeconstantattribute.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\runtime\compilerservices\decimalconstantattribute.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\runtime\compilerservices\decoratednameattribute.cs" />\r
+    <Compile Include="..\referencesource\mscorlib\system\runtime\compilerservices\disableprivatereflectionattribute.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\runtime\compilerservices\discardableattribute.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\runtime\compilerservices\extensionattribute.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\runtime\compilerservices\fixedaddressvaluetypeattribute.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\runtime\compilerservices\fixedbufferattribute.cs" />\r
+    <Compile Include="..\referencesource\mscorlib\system\runtime\compilerservices\FormattableStringFactory.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\runtime\compilerservices\hascopysemanticsattribute.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\runtime\compilerservices\IAsyncStateMachine.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\runtime\compilerservices\idispatchconstantattribute.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\runtime\interopservices\ucomienumconnections.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\runtime\interopservices\unknownwrapper.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\runtime\interopservices\variantWrapper.cs" />\r
+    <Compile Include="..\referencesource\mscorlib\system\runtime\interopservices\windowsruntime\attributes.cs" />\r
+    <Compile Include="..\referencesource\mscorlib\system\runtime\interopservices\windowsruntime\eventregistrationtoken.cs" />\r
+    <Compile Include="..\referencesource\mscorlib\system\runtime\interopservices\windowsruntime\eventregistrationtokentable.cs" />\r
+    <Compile Include="..\referencesource\mscorlib\system\runtime\interopservices\windowsruntime\iactivationfactory.cs" />\r
+    <Compile Include="..\referencesource\mscorlib\system\runtime\interopservices\windowsruntime\irestrictederrorinfo.cs" />\r
+    <Compile Include="..\referencesource\mscorlib\system\runtime\interopservices\windowsruntime\windowsruntimemarshal.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\runtime\NgenServicingAttributes.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\runtime\remoting\callcontext.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\runtime\serialization\deserializationeventhandler.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\runtime\serialization\streamingcontext.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\runtime\serialization\surrogateselector.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\runtime\serialization\valuetypefixupinfo.cs" />\r
-    <Compile Include="..\referencesource\mscorlib\system\runtime\versioning\binarycompatibility.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\runtime\versioning\componentguaranteesattribute.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\runtime\versioning\multitargetinghelpers.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\runtime\versioning\NonVersionableAttribute.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\security\cryptography\ripemd160.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\security\cryptography\ripemd160managed.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\security\cryptography\rsa.cs" />\r
+    <Compile Include="..\referencesource\mscorlib\system\security\cryptography\rsacryptoserviceprovider.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\security\cryptography\RSAEncryptionPadding.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\security\cryptography\RSAEncryptionPaddingMode.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\security\cryptography\rsaoaepkeyexchangedeformatter.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\security\cryptography\utils.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\security\cryptography\x509certificates\x509utils.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\security\principal\genericidentity.cs" />\r
+    <Compile Include="..\referencesource\mscorlib\system\security\safesecurityhandles.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\security\securitycontext.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\security\securitydocument.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\security\util\hex.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\security\util\parser.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\security\util\tokenizer.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\serializableattribute.cs" />\r
+    <Compile Include="..\referencesource\mscorlib\system\sharedstatics.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\single.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\stackoverflowexception.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\string.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\text\encoderreplacementfallback.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\text\encoding.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\text\encodinginfo.cs" />\r
+    <Compile Include="..\referencesource\mscorlib\system\text\encodingprovider.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\text\mlangcodepageencoding.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\text\stringbuilder.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\text\stringbuildercache.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\threadattributes.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\threading\abandonedmutexexception.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\threading\apartmentstate.cs" />\r
+    <Compile Include="..\referencesource\mscorlib\system\threading\asynclocal.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\threading\autoresetevent.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\threading\CancellationToken.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\threading\CancellationTokenRegistration.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\threading\CancellationTokenSource.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\threading\CountdownEvent.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\threading\eventresetmode.cs" />\r
+    <Compile Include="..\referencesource\mscorlib\system\threading\eventwaithandle.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\threading\executioncontext.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\threading\LazyInitializer.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\threading\lockrecursionexception.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\threading\timeout.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\threading\waithandle.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\threading\waithandlecannotbeopenedexception.cs" />\r
+    <Compile Include="..\referencesource\mscorlib\system\threading\waithandleExtensions.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\threadstaticattribute.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\throwhelper.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\timeoutexception.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\unsafecharbuffer.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\version.cs" />\r
     <Compile Include="Assembly\AssemblyInfo.cs" />\r
-    <Compile Include="coreclr\AsyncLocal.cs" />\r
-    <Compile Include="coreclr\DisablePrivateReflectionAttribute.cs" />\r
-    <Compile Include="coreclr\EncodingProvider.cs" />\r
-    <Compile Include="coreclr\FormattableString.cs" />\r
-    <Compile Include="coreclr\FormattableStringFactory.cs" />\r
-    <Compile Include="coreclr\WaitHandleExtensions.cs" />\r
+    <Compile Include="corefx\SR.cs" />\r
     <Compile Include="Microsoft.Win32\IRegistryApi.cs" />\r
     <Compile Include="Microsoft.Win32\Registry.cs" />\r
     <Compile Include="Microsoft.Win32\RegistryHive.cs" />\r
     <Compile Include="Mono.Xml\SmallXmlParser.cs" />\r
     <Compile Include="Mono\DataConverter.cs" />\r
     <Compile Include="Mono\Runtime.cs" />\r
+    <Compile Include="Mono\RuntimeHandles.cs" />\r
+    <Compile Include="Mono\RuntimeMarshal.cs" />\r
+    <Compile Include="Mono\RuntimeStructs.cs" />\r
+    <Compile Include="Mono\SafeGPtrArrayHandle.cs" />\r
+    <Compile Include="Mono\SafeStringMarshal.cs" />\r
     <Compile Include="ReferenceSources\__ConsoleStream.cs" />\r
     <Compile Include="ReferenceSources\AppContextSwitches.cs" />\r
     <Compile Include="ReferenceSources\AppDomain.cs" />\r
     <Compile Include="ReferenceSources\Array.cs" />\r
     <Compile Include="ReferenceSources\BCLDebug.cs" />\r
+    <Compile Include="ReferenceSources\BinaryCompatibility.cs" />\r
     <Compile Include="ReferenceSources\Buffer.cs" />\r
     <Compile Include="ReferenceSources\CalendarData.cs" />\r
     <Compile Include="ReferenceSources\CLRConfig.cs" />\r
     <Compile Include="ReferenceSources\MethodBase.cs" />\r
     <Compile Include="ReferenceSources\NativeMethods.cs" />\r
     <Compile Include="ReferenceSources\ParseNumbers.cs" />\r
+    <Compile Include="ReferenceSources\PathInternal.cs" />\r
     <Compile Include="ReferenceSources\RemotingFieldCachedData.cs" />\r
     <Compile Include="ReferenceSources\RuntimeHandles.cs" />\r
     <Compile Include="ReferenceSources\RuntimeType.cs" />\r
     <Compile Include="ReferenceSources\SecurityContext.cs" />\r
-    <Compile Include="ReferenceSources\SharedStatics.cs" />\r
     <Compile Include="ReferenceSources\String.cs" />\r
     <Compile Include="ReferenceSources\TextInfo.cs" />\r
     <Compile Include="ReferenceSources\Type.cs" />\r
-    <Compile Include="ReferenceSources\TypeBuilderInstantiation.cs" />\r
     <Compile Include="ReferenceSources\TypeNameParser.cs" />\r
     <Compile Include="ReferenceSources\win32native.cs" />\r
     <Compile Include="System.Configuration.Assemblies\AssemblyHash.cs" />\r
     <Compile Include="System.Diagnostics.Tracing\EventAttribute.cs" />\r
     <Compile Include="System.Diagnostics.Tracing\EventCommand.cs" />\r
     <Compile Include="System.Diagnostics.Tracing\EventCommandEventArgs.cs" />\r
+    <Compile Include="System.Diagnostics.Tracing\EventCounter.cs" />\r
+    <Compile Include="System.Diagnostics.Tracing\EventDataAttribute.cs" />\r
+    <Compile Include="System.Diagnostics.Tracing\EventFieldAttribute.cs" />\r
+    <Compile Include="System.Diagnostics.Tracing\EventFieldFormat.cs" />\r
+    <Compile Include="System.Diagnostics.Tracing\EventFieldTags.cs" />\r
+    <Compile Include="System.Diagnostics.Tracing\EventIgnoreAttribute.cs" />\r
     <Compile Include="System.Diagnostics.Tracing\EventListener.cs" />\r
+    <Compile Include="System.Diagnostics.Tracing\EventManifestOptions.cs" />\r
     <Compile Include="System.Diagnostics.Tracing\EventSource.cs" />\r
     <Compile Include="System.Diagnostics.Tracing\EventSourceAttribute.cs" />\r
     <Compile Include="System.Diagnostics.Tracing\EventSourceSettings.cs" />\r
     <Compile Include="System.IO\UnexceptionalStreamReader.cs" />\r
     <Compile Include="System.IO\UnexceptionalStreamWriter.cs" />\r
     <Compile Include="System.Reflection.Emit\AssemblyBuilder.cs" />\r
+    <Compile Include="System.Reflection.Emit\AssemblyBuilder.pns.cs" />\r
     <Compile Include="System.Reflection.Emit\AssemblyBuilderAccess.cs" />\r
     <Compile Include="System.Reflection.Emit\ConstructorBuilder.cs" />\r
+    <Compile Include="System.Reflection.Emit\ConstructorBuilder.pns.cs" />\r
     <Compile Include="System.Reflection.Emit\ConstructorOnTypeBuilderInst.cs" />\r
     <Compile Include="System.Reflection.Emit\CustomAttributeBuilder.cs" />\r
+    <Compile Include="System.Reflection.Emit\CustomAttributeBuilder.pns.cs" />\r
     <Compile Include="System.Reflection.Emit\DerivedTypes.cs" />\r
     <Compile Include="System.Reflection.Emit\DynamicILInfo.cs" />\r
     <Compile Include="System.Reflection.Emit\DynamicMethod.cs" />\r
     <Compile Include="System.Reflection.Emit\EnumBuilder.cs" />\r
+    <Compile Include="System.Reflection.Emit\EnumBuilder.pns.cs" />\r
     <Compile Include="System.Reflection.Emit\EventBuilder.cs" />\r
+    <Compile Include="System.Reflection.Emit\EventBuilder.pns.cs" />\r
     <Compile Include="System.Reflection.Emit\EventOnTypeBuilderInst.cs" />\r
     <Compile Include="System.Reflection.Emit\EventToken.cs" />\r
     <Compile Include="System.Reflection.Emit\FieldBuilder.cs" />\r
+    <Compile Include="System.Reflection.Emit\FieldBuilder.pns.cs" />\r
     <Compile Include="System.Reflection.Emit\FieldOnTypeBuilderInst.cs" />\r
     <Compile Include="System.Reflection.Emit\FieldToken.cs" />\r
     <Compile Include="System.Reflection.Emit\FlowControl.cs" />\r
     <Compile Include="System.Reflection.Emit\GenericTypeParameterBuilder.cs" />\r
+    <Compile Include="System.Reflection.Emit\GenericTypeParameterBuilder.pns.cs" />\r
     <Compile Include="System.Reflection.Emit\ILGenerator.cs" />\r
+    <Compile Include="System.Reflection.Emit\ILGenerator.pns.cs" />\r
     <Compile Include="System.Reflection.Emit\Label.cs" />\r
     <Compile Include="System.Reflection.Emit\LocalBuilder.cs" />\r
     <Compile Include="System.Reflection.Emit\MethodBuilder.cs" />\r
+    <Compile Include="System.Reflection.Emit\MethodBuilder.pns.cs" />\r
     <Compile Include="System.Reflection.Emit\MethodOnTypeBuilderInst.cs" />\r
     <Compile Include="System.Reflection.Emit\MethodRental.cs" />\r
     <Compile Include="System.Reflection.Emit\MethodToken.cs" />\r
     <Compile Include="System.Reflection.Emit\ModuleBuilder.cs" />\r
+    <Compile Include="System.Reflection.Emit\ModuleBuilder.pns.cs" />\r
     <Compile Include="System.Reflection.Emit\MonoArrayMethod.cs" />\r
     <Compile Include="System.Reflection.Emit\OpCode.cs" />\r
     <Compile Include="System.Reflection.Emit\OpCodeNames.cs" />\r
     <Compile Include="System.Reflection.Emit\OperandType.cs" />\r
     <Compile Include="System.Reflection.Emit\PackingSize.cs" />\r
     <Compile Include="System.Reflection.Emit\ParameterBuilder.cs" />\r
+    <Compile Include="System.Reflection.Emit\ParameterBuilder.pns.cs" />\r
     <Compile Include="System.Reflection.Emit\ParameterToken.cs" />\r
     <Compile Include="System.Reflection.Emit\PEFileKinds.cs" />\r
     <Compile Include="System.Reflection.Emit\PropertyBuilder.cs" />\r
+    <Compile Include="System.Reflection.Emit\PropertyBuilder.pns.cs" />\r
     <Compile Include="System.Reflection.Emit\PropertyOnTypeBuilderInst.cs" />\r
     <Compile Include="System.Reflection.Emit\PropertyToken.cs" />\r
     <Compile Include="System.Reflection.Emit\SignatureHelper.cs" />\r
+    <Compile Include="System.Reflection.Emit\SignatureHelper.pns.cs" />\r
     <Compile Include="System.Reflection.Emit\SignatureToken.cs" />\r
     <Compile Include="System.Reflection.Emit\StackBehaviour.cs" />\r
     <Compile Include="System.Reflection.Emit\StringToken.cs" />\r
     <Compile Include="System.Reflection.Emit\TypeBuilder.cs" />\r
+    <Compile Include="System.Reflection.Emit\TypeBuilder.pns.cs" />\r
+    <Compile Include="System.Reflection.Emit\TypeBuilderInstantiation.cs" />\r
     <Compile Include="System.Reflection.Emit\TypeToken.cs" />\r
     <Compile Include="System.Reflection.Emit\UnmanagedMarshal.cs" />\r
+    <Compile Include="System.Reflection.Metadata\AssemblyExtensions.cs" />\r
     <Compile Include="System.Reflection\Assembly.cs" />\r
     <Compile Include="System.Reflection\AssemblyName.cs" />\r
     <Compile Include="System.Reflection\ConstructorInfo.cs" />\r
     <Compile Include="System.Reflection\MonoAssembly.cs" />\r
     <Compile Include="System.Reflection\MonoEvent.cs" />\r
     <Compile Include="System.Reflection\MonoField.cs" />\r
-    <Compile Include="System.Reflection\MonoGenericClass.cs" />\r
-    <Compile Include="System.Reflection\MonoGenericMethod.cs" />\r
     <Compile Include="System.Reflection\MonoMethod.cs" />\r
     <Compile Include="System.Reflection\MonoModule.cs" />\r
     <Compile Include="System.Reflection\MonoParameterInfo.cs" />\r
     <Compile Include="System.Reflection\PropertyInfo.cs" />\r
     <Compile Include="System.Reflection\ReflectionTypeLoadException.cs" />\r
     <Compile Include="System.Reflection\StrongNameKeyPair.cs" />\r
-    <Compile Include="System.Reflection\TargetException.cs" />\r
-    <Compile Include="System.Reflection\TargetInvocationException.cs" />\r
-    <Compile Include="System.Reflection\TargetParameterCountException.cs" />\r
     <Compile Include="System.Resources\Win32Resources.cs" />\r
     <Compile Include="System.Runtime.CompilerServices\ConditionalWeakTable.cs" />\r
     <Compile Include="System.Runtime.CompilerServices\RuntimeHelpers.cs" />\r
     <Compile Include="System.Runtime.Hosting\ActivationArguments.cs" />\r
     <Compile Include="System.Runtime.Hosting\ApplicationActivator.cs" />\r
-    <Compile Include="System.Runtime.InteropServices.WindowsRuntime\DefaultInterfaceAttribute.cs" />\r
     <Compile Include="System.Runtime.InteropServices.WindowsRuntime\DesignerNamespaceResolveEventArgs.cs" />\r
-    <Compile Include="System.Runtime.InteropServices.WindowsRuntime\EventRegistrationToken.cs" />\r
-    <Compile Include="System.Runtime.InteropServices.WindowsRuntime\EventRegistrationTokenTable.cs" />\r
-    <Compile Include="System.Runtime.InteropServices.WindowsRuntime\IActivationFactory.cs" />\r
-    <Compile Include="System.Runtime.InteropServices.WindowsRuntime\InterfaceImplementedInVersionAttribute.cs" />\r
     <Compile Include="System.Runtime.InteropServices.WindowsRuntime\NamespaceResolveEventArgs.cs" />\r
-    <Compile Include="System.Runtime.InteropServices.WindowsRuntime\ReadOnlyArrayAttribute.cs" />\r
-    <Compile Include="System.Runtime.InteropServices.WindowsRuntime\ReturnValueNameAttribute.cs" />\r
-    <Compile Include="System.Runtime.InteropServices.WindowsRuntime\WindowsRuntimeMarshal.cs" />\r
+    <Compile Include="System.Runtime.InteropServices.WindowsRuntime\UnsafeNativeMethods.cs" />\r
     <Compile Include="System.Runtime.InteropServices.WindowsRuntime\WindowsRuntimeMetadata.cs" />\r
-    <Compile Include="System.Runtime.InteropServices.WindowsRuntime\WriteOnlyArrayAttribute.cs" />\r
     <Compile Include="System.Runtime.InteropServices\_Activator.cs" />\r
     <Compile Include="System.Runtime.InteropServices\_Assembly.cs" />\r
     <Compile Include="System.Runtime.InteropServices\_AssemblyBuilder.cs" />\r
     <Compile Include="System.Runtime.InteropServices\BIND_OPTS.cs" />\r
     <Compile Include="System.Runtime.InteropServices\BINDPTR.cs" />\r
     <Compile Include="System.Runtime.InteropServices\CALLCONV.cs" />\r
+    <Compile Include="System.Runtime.InteropServices\ComAwareEventInfo.cs" />\r
+    <Compile Include="System.Runtime.InteropServices\ComEventsHelper.cs" />\r
+    <Compile Include="System.Runtime.InteropServices\CustomQueryInterfaceMode.cs" />\r
     <Compile Include="System.Runtime.InteropServices\DESCKIND.cs" />\r
     <Compile Include="System.Runtime.InteropServices\DISPPARAMS.cs" />\r
     <Compile Include="System.Runtime.InteropServices\ELEMDESC.cs" />\r
     <Compile Include="System.Runtime.InteropServices\UCOMITypeLib.cs" />\r
     <Compile Include="System.Runtime.InteropServices\VARDESC.cs" />\r
     <Compile Include="System.Runtime.InteropServices\VARFLAGS.cs" />\r
+    <Compile Include="System.Runtime.Loader\AssemblyLoadContext.cs" />\r
     <Compile Include="System.Runtime.Remoting.Activation\ActivationServices.cs" />\r
     <Compile Include="System.Runtime.Remoting.Activation\ActivatorLevel.cs" />\r
     <Compile Include="System.Runtime.Remoting.Activation\AppDomainLevelActivator.cs" />\r
     <Compile Include="System.Security.Cryptography.X509Certificates\X509Helper.cs" />\r
     <Compile Include="System.Security.Cryptography.X509Certificates\X509KeyStorageFlags.cs" />\r
     <Compile Include="System.Security.Cryptography\CryptoAPITransform.cs" />\r
+    <Compile Include="System.Security.Cryptography\CryptoConfig.common.cs" />\r
     <Compile Include="System.Security.Cryptography\CryptoConfig.cs" />\r
     <Compile Include="System.Security.Cryptography\CryptoConfig.fullaot.cs" />\r
-    <Compile Include="System.Security.Cryptography\CryptoConfig_2_1.cs" />\r
     <Compile Include="System.Security.Cryptography\CspKeyContainerInfo.cs" />\r
     <Compile Include="System.Security.Cryptography\DESCryptoServiceProvider.cs" />\r
     <Compile Include="System.Security.Cryptography\DSACryptoServiceProvider.cs" />\r
     <Compile Include="System.Security.Cryptography\ICspAsymmetricAlgorithm.cs" />\r
+    <Compile Include="System.Security.Cryptography\IncrementalHash.cs" />\r
     <Compile Include="System.Security.Cryptography\KeyNumber.cs" />\r
     <Compile Include="System.Security.Cryptography\MD5CryptoServiceProvider.cs" />\r
     <Compile Include="System.Security.Cryptography\RC2CryptoServiceProvider.cs" />\r
     <Compile Include="System.Security\PermissionBuilder.cs" />\r
     <Compile Include="System.Security\PermissionSet.cs" />\r
     <Compile Include="System.Security\PolicyLevelType.cs" />\r
-    <Compile Include="System.Security\SafeAccessTokenHandle.cs" />\r
     <Compile Include="System.Security\SecureString.cs" />\r
     <Compile Include="System.Security\SecurityElement.cs" />\r
     <Compile Include="System.Security\SecurityException.cs" />\r
     <Compile Include="System.Text\NormalizationForm.cs" />\r
     <Compile Include="System.Threading.Tasks\DecoupledTask.cs" />\r
     <Compile Include="System.Threading\CompressedStack.cs" />\r
-    <Compile Include="System.Threading\EventWaitHandle.cs" />\r
     <Compile Include="System.Threading\HostExecutionContext.cs" />\r
     <Compile Include="System.Threading\HostExecutionContextManager.cs" />\r
     <Compile Include="System.Threading\Interlocked.cs" />\r
     <Compile Include="System\EmptyArray.cs" />\r
     <Compile Include="System\Environment.cs" />\r
     <Compile Include="System\EnvironmentVariableTarget.cs" />\r
-    <Compile Include="System\GC.cs" />\r
-    <Compile Include="System\GCCollectionMode.cs" />\r
-    <Compile Include="System\GCNotificationStatus.cs" />\r
     <Compile Include="System\Guid.cs" />\r
     <Compile Include="System\IConsoleDriver.cs" />\r
     <Compile Include="System\IntPtr.cs" />\r
index 9ef22797a960de09c6ac8e1a3998cebcebdf8dbd..371d01ba4c1628b3105cd3c053802e0a6dab3a84 100644 (file)
@@ -105,9 +105,6 @@ System/DomainManagerInitializationFlags.cs
 System/EmptyArray.cs
 System/Environment.cs
 System/EnvironmentVariableTarget.cs
-System/GC.cs
-System/GCCollectionMode.cs
-System/GCNotificationStatus.cs
 System/Guid.cs
 System/IConsoleDriver.cs
 System/IntPtr.cs
@@ -167,6 +164,7 @@ System.Diagnostics/StackFrame.cs
 System.Diagnostics/StackTrace.cs
 System.Diagnostics.Tracing/EventAttribute.cs
 System.Diagnostics.Tracing/EventCommand.cs
+System.Diagnostics.Tracing/EventCounter.cs
 System.Diagnostics.Tracing/EventSource.cs
 System.Diagnostics.Tracing/EventSourceAttribute.cs
 System.Diagnostics.Tracing/EventSourceSettings.cs
@@ -180,7 +178,6 @@ System.Diagnostics.Tracing/EventFieldFormat.cs
 System.Diagnostics.Tracing/EventFieldTags.cs
 System.Diagnostics.Tracing/EventIgnoreAttribute.cs
 System.Diagnostics.Tracing/EventManifestOptions.cs
-System.Diagnostics.Tracing/EventSourceException.cs
 System.Diagnostics.SymbolStore/ISymbolBinder.cs
 System.Diagnostics.SymbolStore/ISymbolBinder1.cs
 System.Diagnostics.SymbolStore/ISymbolDocument.cs
@@ -249,8 +246,6 @@ System.Reflection/MethodBody.cs
 System.Reflection/Module.cs
 System.Reflection/ModuleResolveEventHandler.cs
 System.Reflection/MonoAssembly.cs
-System.Reflection/MonoGenericClass.cs
-System.Reflection/MonoGenericMethod.cs
 System.Reflection/MonoEvent.cs
 System.Reflection/MonoField.cs
 System.Reflection/MonoMethod.cs
@@ -262,9 +257,6 @@ System.Reflection/PortableExecutableKinds.cs
 System.Reflection/PropertyInfo.cs
 System.Reflection/ReflectionTypeLoadException.cs
 System.Reflection/StrongNameKeyPair.cs
-System.Reflection/TargetException.cs
-System.Reflection/TargetInvocationException.cs
-System.Reflection/TargetParameterCountException.cs
 System.Reflection.Emit/AssemblyBuilder.cs
 System.Reflection.Emit/AssemblyBuilderAccess.cs
 System.Reflection.Emit/ConstructorBuilder.cs
@@ -308,8 +300,23 @@ System.Reflection.Emit/SignatureToken.cs
 System.Reflection.Emit/StackBehaviour.cs
 System.Reflection.Emit/StringToken.cs
 System.Reflection.Emit/TypeBuilder.cs
+System.Reflection.Emit/TypeBuilderInstantiation.cs
 System.Reflection.Emit/TypeToken.cs
 System.Reflection.Emit/UnmanagedMarshal.cs
+System.Reflection.Emit/AssemblyBuilder.pns.cs
+System.Reflection.Emit/ConstructorBuilder.pns.cs
+System.Reflection.Emit/CustomAttributeBuilder.pns.cs
+System.Reflection.Emit/EnumBuilder.pns.cs
+System.Reflection.Emit/EventBuilder.pns.cs
+System.Reflection.Emit/FieldBuilder.pns.cs
+System.Reflection.Emit/GenericTypeParameterBuilder.pns.cs
+System.Reflection.Emit/ILGenerator.pns.cs
+System.Reflection.Emit/MethodBuilder.pns.cs
+System.Reflection.Emit/ModuleBuilder.pns.cs
+System.Reflection.Emit/ParameterBuilder.pns.cs
+System.Reflection.Emit/PropertyBuilder.pns.cs
+System.Reflection.Emit/SignatureHelper.pns.cs
+System.Reflection.Emit/TypeBuilder.pns.cs
 System.Reflection.Metadata/AssemblyExtensions.cs
 System.Resources/Win32Resources.cs
 System.Runtime/GCLargeObjectHeapCompactionMode.cs
@@ -417,18 +424,10 @@ System.Runtime.InteropServices/CustomQueryInterfaceMode.cs
 System.Runtime.InteropServices/ComAwareEventInfo.cs
 System.Runtime.InteropServices/ComEventsHelper.cs
 
-System.Runtime.InteropServices.WindowsRuntime/DefaultInterfaceAttribute.cs
 System.Runtime.InteropServices.WindowsRuntime/DesignerNamespaceResolveEventArgs.cs
-System.Runtime.InteropServices.WindowsRuntime/EventRegistrationToken.cs
-System.Runtime.InteropServices.WindowsRuntime/EventRegistrationTokenTable.cs
-System.Runtime.InteropServices.WindowsRuntime/IActivationFactory.cs
-System.Runtime.InteropServices.WindowsRuntime/InterfaceImplementedInVersionAttribute.cs
 System.Runtime.InteropServices.WindowsRuntime/NamespaceResolveEventArgs.cs
-System.Runtime.InteropServices.WindowsRuntime/ReadOnlyArrayAttribute.cs
-System.Runtime.InteropServices.WindowsRuntime/ReturnValueNameAttribute.cs
-System.Runtime.InteropServices.WindowsRuntime/WindowsRuntimeMarshal.cs
+System.Runtime.InteropServices.WindowsRuntime/UnsafeNativeMethods.cs
 System.Runtime.InteropServices.WindowsRuntime/WindowsRuntimeMetadata.cs
-System.Runtime.InteropServices.WindowsRuntime/WriteOnlyArrayAttribute.cs
 System.Runtime.Remoting/ActivatedClientTypeEntry.cs
 System.Runtime.Remoting/ActivatedServiceTypeEntry.cs
 System.Runtime.Remoting/CustomErrorsModes.cs
@@ -700,12 +699,13 @@ System.Security.AccessControl/SecurityInfos.cs
 System.Security.AccessControl/SystemAcl.cs
 System.Security.Cryptography/CryptoAPITransform.cs
 System.Security.Cryptography/CryptoConfig.cs
-System.Security.Cryptography/CryptoConfig_2_1.cs
+System.Security.Cryptography/CryptoConfig.common.cs
 System.Security.Cryptography/CryptoConfig.fullaot.cs
 System.Security.Cryptography/CspKeyContainerInfo.cs
 System.Security.Cryptography/DESCryptoServiceProvider.cs
 System.Security.Cryptography/DSACryptoServiceProvider.cs
 System.Security.Cryptography/ICspAsymmetricAlgorithm.cs
+System.Security.Cryptography/IncrementalHash.cs
 System.Security.Cryptography/KeyNumber.cs
 System.Security.Cryptography/MD5CryptoServiceProvider.cs
 System.Security.Cryptography/RC2CryptoServiceProvider.cs
@@ -849,7 +849,6 @@ System.Text/EncodingHelper.cs
 System.Text/NormalizationForm.cs
 System.Text/Latin1Encoding.cs
 System.Threading/CompressedStack.cs
-System.Threading/EventWaitHandle.cs
 System.Threading/HostExecutionContext.cs
 System.Threading/HostExecutionContextManager.cs
 System.Threading/Interlocked.cs
@@ -894,13 +893,14 @@ ReferenceSources/MethodBase.cs
 ReferenceSources/NativeMethods.cs
 ReferenceSources/RuntimeHandles.cs
 ReferenceSources/CompareInfo.cs
-ReferenceSources/TypeBuilderInstantiation.cs
 ReferenceSources/Buffer.cs
 ReferenceSources/TextInfo.cs
 ReferenceSources/win32native.cs
-ReferenceSources/SharedStatics.cs
 ReferenceSources/SecurityContext.cs
 ReferenceSources/PathInternal.cs
+ReferenceSources/BinaryCompatibility.cs
+ReferenceSources/String.cs
+ReferenceSources/Type.cs
 
 ../referencesource/mscorlib/system/__filters.cs
 ../referencesource/mscorlib/system/__hresults.cs
@@ -965,6 +965,8 @@ ReferenceSources/PathInternal.cs
 ../referencesource/mscorlib/system/fieldaccessexception.cs
 ../referencesource/mscorlib/system/flagsattribute.cs
 ../referencesource/mscorlib/system/formatexception.cs
+../referencesource/mscorlib/system/FormattableString.cs
+../referencesource/mscorlib/system/gc.cs
 ../referencesource/mscorlib/system/guid.cs
 ../referencesource/mscorlib/system/iappdomain.cs
 ../referencesource/mscorlib/system/iappdomainsetup.cs
@@ -1021,6 +1023,7 @@ ReferenceSources/PathInternal.cs
 ../referencesource/mscorlib/system/rttype.cs
 ../referencesource/mscorlib/system/sbyte.cs
 ../referencesource/mscorlib/system/serializableattribute.cs
+../referencesource/mscorlib/system/sharedstatics.cs
 ../referencesource/mscorlib/system/stackoverflowexception.cs
 ../referencesource/mscorlib/system/single.cs
 ../referencesource/mscorlib/system/string.cs
@@ -1125,6 +1128,7 @@ ReferenceSources/PathInternal.cs
 ../referencesource/mscorlib/system/diagnostics/contracts/contractsbcl.cs
 
 ../referencesource/mscorlib/system/diagnostics/eventing/eventactivityoptions.cs
+../referencesource/mscorlib/system/diagnostics/eventing/eventsourceexception.cs
 ../referencesource/mscorlib/system/diagnostics/eventing/winmeta.cs
 
 ../referencesource/mscorlib/system/diagnostics/eventing/TraceLogging/EventSourceOptions.cs
@@ -1242,6 +1246,9 @@ ReferenceSources/PathInternal.cs
 ../referencesource/mscorlib/system/reflection/reflectioncontext.cs
 ../referencesource/mscorlib/system/reflection/resourceattributes.cs
 ../referencesource/mscorlib/system/reflection/RuntimeReflectionExtensions.cs
+../referencesource/mscorlib/system/reflection/targetexception.cs
+../referencesource/mscorlib/system/reflection/targetinvocationexception.cs
+../referencesource/mscorlib/system/reflection/targetparametercountexception.cs
 ../referencesource/mscorlib/system/reflection/typeattributes.cs
 ../referencesource/mscorlib/system/reflection/typedelegator.cs
 ../referencesource/mscorlib/system/reflection/typefilter.cs
@@ -1333,6 +1340,13 @@ ReferenceSources/PathInternal.cs
 
 ../referencesource/mscorlib/system/runtime/interopservices/expando/iexpando.cs
 
+../referencesource/mscorlib/system/runtime/interopservices/windowsruntime/attributes.cs
+../referencesource/mscorlib/system/runtime/interopservices/windowsruntime/eventregistrationtoken.cs
+../referencesource/mscorlib/system/runtime/interopservices/windowsruntime/eventregistrationtokentable.cs
+../referencesource/mscorlib/system/runtime/interopservices/windowsruntime/iactivationfactory.cs
+../referencesource/mscorlib/system/runtime/interopservices/windowsruntime/irestrictederrorinfo.cs
+../referencesource/mscorlib/system/runtime/interopservices/windowsruntime/windowsruntimemarshal.cs
+
 ../referencesource/mscorlib//system/runtime/reliability/criticalfinalizerobject.cs
 ../referencesource/mscorlib//system/runtime/reliability/prepreparemethodattribute.cs
 ../referencesource/mscorlib//system/runtime/reliability/reliabilitycontractattribute.cs
@@ -1354,12 +1368,15 @@ ReferenceSources/PathInternal.cs
 ../referencesource/mscorlib/system/runtime/compilerservices/datetimeconstantattribute.cs
 ../referencesource/mscorlib/system/runtime/compilerservices/decimalconstantattribute.cs
 ../referencesource/mscorlib/system/runtime/compilerservices/decoratednameattribute.cs
+../referencesource/mscorlib/system/runtime/compilerservices/disableprivatereflectionattribute.cs
 ../referencesource/mscorlib/system/runtime/compilerservices/discardableattribute.cs
 ../referencesource/mscorlib/system/runtime/compilerservices/extensionattribute.cs
 ../referencesource/mscorlib/system/runtime/compilerservices/fixedaddressvaluetypeattribute.cs
 ../referencesource/mscorlib/system/runtime/compilerservices/fixedbufferattribute.cs
+../referencesource/mscorlib/system/runtime/compilerservices/FormattableStringFactory.cs
 ../referencesource/mscorlib/system/runtime/compilerservices/hascopysemanticsattribute.cs
 ../referencesource/mscorlib/system/runtime/compilerservices/IAsyncStateMachine.cs
+../referencesource/mscorlib/system/runtime/compilerservices/idispatchconstantattribute.cs
 ../referencesource/mscorlib/system/runtime/compilerservices/indexernameattribute.cs
 ../referencesource/mscorlib/system/runtime/compilerservices/INotifyCompletion.cs
 ../referencesource/mscorlib/system/runtime/compilerservices/internalsvisibletoattribute.cs
@@ -1496,6 +1513,7 @@ ReferenceSources/PathInternal.cs
 ../referencesource/mscorlib/system/text/encoderreplacementfallback.cs
 ../referencesource/mscorlib/system/text/encoding.cs
 ../referencesource/mscorlib/system/text/encodinginfo.cs
+../referencesource/mscorlib/system/text/encodingprovider.cs
 ../referencesource/mscorlib/system/text/mlangcodepageencoding.cs
 ../referencesource/mscorlib/system/text/surrogateencoder.cs
 ../referencesource/mscorlib/system/text/unicodeencoding.cs
@@ -1554,7 +1572,6 @@ ReferenceSources/PathInternal.cs
 ../referencesource/mscorlib/system/runtime/serialization/formatters/soapfault.cs
 ../referencesource/mscorlib/system/runtime/serialization/formatters/soapmessage.cs
 
-../referencesource/mscorlib/system/runtime/versioning/binarycompatibility.cs
 ../referencesource/mscorlib/system/runtime/versioning/componentguaranteesattribute.cs
 ../referencesource/mscorlib/system/runtime/versioning/multitargetinghelpers.cs
 ../referencesource/mscorlib/system/runtime/versioning/NonVersionableAttribute.cs
@@ -1564,12 +1581,14 @@ ReferenceSources/PathInternal.cs
 
 ../referencesource/mscorlib/system/threading/abandonedmutexexception.cs
 ../referencesource/mscorlib/system/threading/apartmentstate.cs
+../referencesource/mscorlib/system/threading/asynclocal.cs
 ../referencesource/mscorlib/system/threading/autoresetevent.cs
 ../referencesource/mscorlib/system/threading/CancellationToken.cs
 ../referencesource/mscorlib/system/threading/CancellationTokenRegistration.cs
 ../referencesource/mscorlib/system/threading/CancellationTokenSource.cs
 ../referencesource/mscorlib/system/threading/CountdownEvent.cs
 ../referencesource/mscorlib/system/threading/eventresetmode.cs
+../referencesource/mscorlib/system/threading/eventwaithandle.cs
 ../referencesource/mscorlib/system/threading/executioncontext.cs
 ../referencesource/mscorlib/system/threading/LazyInitializer.cs
 ../referencesource/mscorlib/system/threading/lockrecursionexception.cs
@@ -1597,6 +1616,7 @@ ReferenceSources/PathInternal.cs
 ../referencesource/mscorlib/system/threading/waithandlecannotbeopenedexception.cs
 ../referencesource/mscorlib/system/threading/threadpool.cs
 ../referencesource/mscorlib/system/threading/waithandle.cs
+../referencesource/mscorlib/system/threading/waithandleExtensions.cs
 
 ../referencesource/mscorlib/system/threading/Tasks/AsyncCausalityTracer.cs
 ../referencesource/mscorlib/system/threading/Tasks/BeginEndAwaitableAdapter.cs
@@ -1623,12 +1643,10 @@ ReferenceSources/PathInternal.cs
 ../referencesource/mscorlib/microsoft/win32/safehandles/safewaithandle.cs
 ../referencesource/mscorlib/microsoft/win32/safehandles/win32safehandles.cs
 
-ReferenceSources/String.cs
-ReferenceSources/Type.cs
+corefx/SR.cs
+
+../../../external/corefx/src/Common/src/System/Numerics/Hashing/HashHelpers.cs
 
-coreclr/AsyncLocal.cs
-coreclr/DisablePrivateReflectionAttribute.cs
-coreclr/EncodingProvider.cs
-coreclr/FormattableString.cs
-coreclr/FormattableStringFactory.cs
-coreclr/WaitHandleExtensions.cs
+../../../external/corefx/src/System.ValueTuple/src/System/ValueTuple/ValueTuple.cs
+../../../external/corefx/src/System.ValueTuple/src/System/ValueTuple/TupleExtensions.cs
+../../../external/corefx/src/System.ValueTuple/src/System/Runtime/CompilerServices/TupleElementNamesAttribute.cs
index cfd6b74ae03874680cbda5a79f32ae2f9999953c..4e444a37efa54a3462c548504d90a02f096fddb2 100644 (file)
@@ -1,3 +1,4 @@
+../../test-helpers/NunitHelpers.cs
 Microsoft.Win32/RegistryKeyTest.cs
 Mono/DataConvertTest.cs
 ../Mono/DataConverter.cs
@@ -22,6 +23,7 @@ System/CharCategoryTest.cs
 System/CharEnumeratorTest.cs
 System/CharTest.cs
 System/DelegateTest.cs
+System/GCTest.cs
 System/ModuleHandleTest.cs
 System/NullableTest.cs
 System/ObsoleteAttributeTest.cs
@@ -405,6 +407,7 @@ System.Text/EncoderTest.cs
 System.Text/EncodingTest.cs
 System.Text/EncodingTester.cs
 System.Text/EncodingInfoTest.cs
+System.Text/Latin1EncodingTest.cs
 System.Text/StringBuilderTest.cs
 System.Text/TestEncoding.cs
 System.Text/UnicodeEncodingTest.cs
index 6acc765c090d0c5e18bf7673c56328dbb30053a8..9d688d51c5ccacc0ab774d9ee3c2cb383ac0f397 100644 (file)
@@ -1,15 +1 @@
-#include corlib.dll.sources
-CommonCrypto/CommonCrypto.cs
-CommonCrypto/CryptorTransform.cs
-CommonCrypto/FastCryptorTransform.cs
-CommonCrypto/CorlibExtras.cs
-CommonCrypto/RijndaelManaged.cs
-CommonCrypto/SecRandom.cs
-CommonCrypto/RC4CommonCrypto.cs
-System/Environment.iOS.cs
-System/Guid.MonoTouch.cs
-System/NotSupportedException.iOS.cs
-CoreFoundation/CFHelpers.cs
-System.Security.Cryptography.X509Certificates/X509CertificateImplApple.cs
-System.Security.Cryptography.X509Certificates/X509Helper.Apple.cs
-System.Text/EncodingHelper.MonoTouch.cs
+#include monotouch_corlib.dll.sources
index 6acc765c090d0c5e18bf7673c56328dbb30053a8..9d688d51c5ccacc0ab774d9ee3c2cb383ac0f397 100644 (file)
@@ -1,15 +1 @@
-#include corlib.dll.sources
-CommonCrypto/CommonCrypto.cs
-CommonCrypto/CryptorTransform.cs
-CommonCrypto/FastCryptorTransform.cs
-CommonCrypto/CorlibExtras.cs
-CommonCrypto/RijndaelManaged.cs
-CommonCrypto/SecRandom.cs
-CommonCrypto/RC4CommonCrypto.cs
-System/Environment.iOS.cs
-System/Guid.MonoTouch.cs
-System/NotSupportedException.iOS.cs
-CoreFoundation/CFHelpers.cs
-System.Security.Cryptography.X509Certificates/X509CertificateImplApple.cs
-System.Security.Cryptography.X509Certificates/X509Helper.Apple.cs
-System.Text/EncodingHelper.MonoTouch.cs
+#include monotouch_corlib.dll.sources
index 6acc765c090d0c5e18bf7673c56328dbb30053a8..9d688d51c5ccacc0ab774d9ee3c2cb383ac0f397 100644 (file)
@@ -1,15 +1 @@
-#include corlib.dll.sources
-CommonCrypto/CommonCrypto.cs
-CommonCrypto/CryptorTransform.cs
-CommonCrypto/FastCryptorTransform.cs
-CommonCrypto/CorlibExtras.cs
-CommonCrypto/RijndaelManaged.cs
-CommonCrypto/SecRandom.cs
-CommonCrypto/RC4CommonCrypto.cs
-System/Environment.iOS.cs
-System/Guid.MonoTouch.cs
-System/NotSupportedException.iOS.cs
-CoreFoundation/CFHelpers.cs
-System.Security.Cryptography.X509Certificates/X509CertificateImplApple.cs
-System.Security.Cryptography.X509Certificates/X509Helper.Apple.cs
-System.Text/EncodingHelper.MonoTouch.cs
+#include monotouch_corlib.dll.sources
index 6acc765c090d0c5e18bf7673c56328dbb30053a8..9d688d51c5ccacc0ab774d9ee3c2cb383ac0f397 100644 (file)
@@ -1,15 +1 @@
-#include corlib.dll.sources
-CommonCrypto/CommonCrypto.cs
-CommonCrypto/CryptorTransform.cs
-CommonCrypto/FastCryptorTransform.cs
-CommonCrypto/CorlibExtras.cs
-CommonCrypto/RijndaelManaged.cs
-CommonCrypto/SecRandom.cs
-CommonCrypto/RC4CommonCrypto.cs
-System/Environment.iOS.cs
-System/Guid.MonoTouch.cs
-System/NotSupportedException.iOS.cs
-CoreFoundation/CFHelpers.cs
-System.Security.Cryptography.X509Certificates/X509CertificateImplApple.cs
-System.Security.Cryptography.X509Certificates/X509Helper.Apple.cs
-System.Text/EncodingHelper.MonoTouch.cs
+#include monotouch_corlib.dll.sources
index 6acc765c090d0c5e18bf7673c56328dbb30053a8..9d688d51c5ccacc0ab774d9ee3c2cb383ac0f397 100644 (file)
@@ -1,15 +1 @@
-#include corlib.dll.sources
-CommonCrypto/CommonCrypto.cs
-CommonCrypto/CryptorTransform.cs
-CommonCrypto/FastCryptorTransform.cs
-CommonCrypto/CorlibExtras.cs
-CommonCrypto/RijndaelManaged.cs
-CommonCrypto/SecRandom.cs
-CommonCrypto/RC4CommonCrypto.cs
-System/Environment.iOS.cs
-System/Guid.MonoTouch.cs
-System/NotSupportedException.iOS.cs
-CoreFoundation/CFHelpers.cs
-System.Security.Cryptography.X509Certificates/X509CertificateImplApple.cs
-System.Security.Cryptography.X509Certificates/X509Helper.Apple.cs
-System.Text/EncodingHelper.MonoTouch.cs
+#include monotouch_corlib.dll.sources
diff --git a/mcs/class/corlib/net_4_x_corlib.dll.sources b/mcs/class/corlib/net_4_x_corlib.dll.sources
deleted file mode 100644 (file)
index 2ea5c40..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-#include corlib.dll.sources
-../referencesource/mscorlib/system/runtime/compilerservices/idispatchconstantattribute.cs
index 71341f5bc2dc3d83de248228b9d237b2d0d70b16..7da7303d755466e2c3bcdb87b7800fe0e914594a 100644 (file)
@@ -501,6 +501,44 @@ namespace System.Dynamic {
                         binder.ReturnType
                     );
 
+#if MONO // referencesource version
+                    Expression condition;
+                    // If the return type can not be assigned null then just check for type assignablity otherwise allow null.
+                    if (binder.ReturnType.IsValueType && Nullable.GetUnderlyingType(binder.ReturnType) == null) {
+                        condition = Expression.TypeIs(resultMO.Expression, binder.ReturnType);
+                    }
+                    else {
+                        condition = Expression.OrElse(
+                                        Expression.Equal(resultMO.Expression, Expression.Constant(null)),
+                                        Expression.TypeIs(resultMO.Expression, binder.ReturnType));
+                    }
+
+                    var checkedConvert = Expression.Condition(
+                        condition,
+                        convert,
+                        Expression.Throw(
+                            Expression.New(typeof(InvalidCastException).GetConstructor(new Type[]{typeof(string)}),
+                                Expression.Call(
+                                    typeof(string).GetMethod("Format", new Type[] {typeof(string), typeof(object[])}),
+                                    Expression.Constant(convertFailed),
+                                    Expression.NewArrayInit(typeof(object),
+                                        Expression.Condition(
+                                            Expression.Equal(resultMO.Expression, Expression.Constant(null)),
+                                            Expression.Constant("null"),
+                                            Expression.Call(
+                                                resultMO.Expression,
+                                                typeof(object).GetMethod("GetType")
+                                            ),
+                                            typeof(object)
+                                        )
+                                    )
+                                )
+                            ),
+                            binder.ReturnType
+                        ),
+                        binder.ReturnType
+                    );
+#else
                     var checkedConvert = Expression.Condition(
                         Expression.TypeIs(resultMO.Expression, binder.ReturnType),
                         convert,
@@ -524,6 +562,7 @@ namespace System.Dynamic {
                         ),
                         binder.ReturnType
                     );
+#endif
 
                     resultMO = new DynamicMetaObject(checkedConvert, resultMO.Restrictions);
                 }
index 329928fd80ca3f0ddcb6cb1fc9d799903b80b468..b87eecde4e0d3524529469383fca3cdb6e696a69 100644 (file)
@@ -48,6 +48,10 @@ namespace System.Runtime.CompilerServices {
         public static DebugInfoGenerator CreatePdbGenerator() {
             return new SymbolDocumentGenerator();
         }
+#else
+        public static DebugInfoGenerator CreatePdbGenerator() {
+            throw new PlatformNotSupportedException();
+        }
 #endif
         /// <summary>
         /// Marks a sequence point.
index a2e5ca0a4c157c1d6e97c17d340b90375fbbaef3..3489ee15514ca283e2c358fbbfa84cdeaf144b88 100644 (file)
@@ -29,7 +29,9 @@ namespace System.Linq.Expressions.Compiler {
         private const MethodAttributes CtorAttributes = MethodAttributes.RTSpecialName | MethodAttributes.HideBySig | MethodAttributes.Public;
         private const MethodImplAttributes ImplAttributes = MethodImplAttributes.Runtime | MethodImplAttributes.Managed;
         private const MethodAttributes InvokeAttributes = MethodAttributes.Public | MethodAttributes.HideBySig | MethodAttributes.NewSlot | MethodAttributes.Virtual;
+#if FEATURE_REFEMIT
         private static readonly Type[] _DelegateCtorSignature = new Type[] { typeof(object), typeof(IntPtr) };
+#endif
 
         private static Type MakeNewCustomDelegate(Type[] types) {
 #if FEATURE_REFEMIT
diff --git a/mcs/class/legacy/Mono.Cecil/Mono.Cecil-net_4_x.csproj b/mcs/class/legacy/Mono.Cecil/Mono.Cecil-net_4_x.csproj
new file mode 100644 (file)
index 0000000..b00c041
--- /dev/null
@@ -0,0 +1,219 @@
+<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
+  <PropertyGroup>\r
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>\r
+    <ProductVersion>9.0.30729</ProductVersion>\r
+    <SchemaVersion>2.0</SchemaVersion>\r
+    <ProjectGuid>{6DE38817-EC25-433A-AE58-0D30C5E6C460}</ProjectGuid>\r
+    <OutputType>Library</OutputType>\r
+    <NoWarn>1699,1699</NoWarn>\r
+    <OutputPath>./../../../class/lib/net_4_x/legacy</OutputPath>\r
+    <IntermediateOutputPath>obj-legacy</IntermediateOutputPath>\r
+    <GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>\r
+    <NoStdLib>True</NoStdLib>\r
+    \r
+    <NoConfig>True</NoConfig>\r
+    \r
+    <AppDesignerFolder>Properties</AppDesignerFolder>\r
+    <RootNamespace>\r
+    </RootNamespace>\r
+    <AssemblyName>Mono.Cecil</AssemblyName>\r
+    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
+    <FileAlignment>512</FileAlignment>\r
+  </PropertyGroup>\r
+    <PropertyGroup>\r
+    <SignAssembly>true</SignAssembly>\r
+  </PropertyGroup>\r
+  <PropertyGroup>\r
+    <AssemblyOriginatorKeyFile>../../mono.snk</AssemblyOriginatorKeyFile>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
+    <DebugSymbols>true</DebugSymbols>\r
+    <DebugType>full</DebugType>\r
+    <NoWarn>1699,1699</NoWarn>\r
+    <Optimize>false</Optimize>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;NET_3_5;NET_4_0;NET_4_5;NET_4_6;MONO;NET_3_5</DefineConstants>\r
+    <ErrorReport>prompt</ErrorReport>\r
+    <WarningLevel>4</WarningLevel>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">\r
+    <DebugType>pdbonly</DebugType>\r
+    <NoWarn>1699,1699</NoWarn>\r
+    <Optimize>true</Optimize>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;NET_3_5;NET_4_0;NET_4_5;NET_4_6;MONO;NET_3_5</DefineConstants>\r
+    <ErrorReport>prompt</ErrorReport>\r
+    <WarningLevel>4</WarningLevel>\r
+  </PropertyGroup>\r
+  <!-- Set AddAdditionalExplicitAssemblyReferences to false, otherwise if targetting .NET4.0, \r
+  Microsoft.NETFramework.props will force a dependency on the assembly System.Core. This\r
+  is a problem to compile the Mono mscorlib.dll -->\r
+  <PropertyGroup>\r
+    <AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>\r
+  </PropertyGroup>\r
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />\r
+  <ItemGroup>\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil.Cil\Code.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil.Cil\CodeReader.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil.Cil\CodeWriter.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil.Cil\Document.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil.Cil\ExceptionHandler.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil.Cil\ILProcessor.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil.Cil\Instruction.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil.Cil\MethodBody.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil.Cil\OpCode.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil.Cil\OpCodes.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil.Cil\SequencePoint.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil.Cil\Symbols.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil.Cil\VariableDefinition.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil.Cil\VariableReference.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil.Metadata\BlobHeap.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil.Metadata\Buffers.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil.Metadata\CodedIndex.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil.Metadata\ElementType.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil.Metadata\GuidHeap.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil.Metadata\Heap.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil.Metadata\MetadataToken.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil.Metadata\Row.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil.Metadata\StringHeap.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil.Metadata\TableHeap.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil.Metadata\TokenType.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil.Metadata\UserStringHeap.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil.Metadata\Utilities.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil.PE\BinaryStreamReader.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil.PE\BinaryStreamWriter.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil.PE\ByteBuffer.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil.PE\ByteBufferEqualityComparer.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil.PE\DataDirectory.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil.PE\Image.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil.PE\ImageReader.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil.PE\ImageWriter.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil.PE\Section.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil.PE\TextMap.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\ArrayType.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\AssemblyDefinition.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\AssemblyFlags.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\AssemblyHashAlgorithm.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\AssemblyInfo.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\AssemblyLinkedResource.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\AssemblyNameDefinition.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\AssemblyNameReference.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\AssemblyReader.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\AssemblyWriter.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\BaseAssemblyResolver.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\CallSite.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\CustomAttribute.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\DefaultAssemblyResolver.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\EmbeddedResource.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\EventAttributes.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\EventDefinition.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\EventReference.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\ExportedType.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\FieldAttributes.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\FieldDefinition.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\FieldReference.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\FileAttributes.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\FunctionPointerType.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\GenericInstanceMethod.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\GenericInstanceType.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\GenericParameter.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\GenericParameterAttributes.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\IConstantProvider.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\ICustomAttributeProvider.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\IGenericInstance.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\IGenericParameterProvider.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\IMarshalInfoProvider.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\IMemberDefinition.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\IMetadataScope.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\IMetadataTokenProvider.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\IMethodSignature.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\Import.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\LinkedResource.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\ManifestResourceAttributes.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\MarshalInfo.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\MemberDefinitionCollection.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\MemberReference.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\MetadataResolver.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\MetadataSystem.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\MethodAttributes.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\MethodCallingConvention.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\MethodDefinition.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\MethodImplAttributes.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\MethodReference.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\MethodReturnType.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\MethodSemanticsAttributes.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\MethodSpecification.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\Modifiers.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\ModuleDefinition.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\ModuleKind.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\ModuleReference.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\NativeType.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\ParameterAttributes.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\ParameterDefinition.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\ParameterDefinitionCollection.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\ParameterReference.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\PinnedType.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\PInvokeAttributes.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\PInvokeInfo.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\PointerType.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\PropertyAttributes.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\PropertyDefinition.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\PropertyReference.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\ReferenceType.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\Resource.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\SecurityDeclaration.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\SentinelType.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\TargetRuntime.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\TypeAttributes.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\TypeDefinition.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\TypeDefinitionCollection.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\TypeParser.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\TypeReference.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\TypeSpecification.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\TypeSystem.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Cecil\VariantType.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Collections.Generic\Collection.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Collections.Generic\ReadOnlyCollection.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Security.Cryptography\CryptoConvert.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono.Security.Cryptography\CryptoService.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono\Actions.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono\Empty.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\Mono\Funcs.cs" />\r
+    <Compile Include="..\..\..\..\external\cecil-legacy\System.Runtime.CompilerServices\ExtensionAttribute.cs" />\r  </ItemGroup>\r
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \r
+       Other similar extension points exist, see Microsoft.Common.targets.\r
+  <Target Name="BeforeBuild">\r
+  </Target>\r
+  <Target Name="AfterBuild">\r
+  </Target>\r
+  -->\r
+  <PropertyGroup>\r
+    <PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
+
+    </PreBuildEvent>\r
+    <PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">\r
+\r
+    </PreBuildEvent>\r
+    <PostBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
+
+    </PostBuildEvent>\r
+    <PostBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">\r
+\r
+    </PostBuildEvent>\r
+  </PropertyGroup>\r
+  <ItemGroup>\r
+    <ProjectReference Include="../../corlib/corlib-net_4_x.csproj">\r
+      <Project>{2CA6026B-2DC8-4C4C-A12C-1E8234049DB7}</Project>\r
+      <Name>corlib-net_4_x</Name>\r
+    </ProjectReference>\r
+    <ProjectReference Include="../../System.Core/System.Core-net_4_x.csproj">\r
+      <Project>{359142A1-D80F-401E-AA64-7167C9317649}</Project>\r
+      <Name>System.Core-net_4_x</Name>\r
+    </ProjectReference>\r
+  </ItemGroup>\r
+  <ItemGroup>\r
+    <Folder Include="Properties\" />\r
+  </ItemGroup>\r
+</Project>\r
+
index 9af81920a16b972c3d4f02f72597a4ba1d85e24d..fa3ffe15ac50e4eeb370f879d42c8af6ccfa69d8 100644 (file)
@@ -47,7 +47,7 @@ namespace MonoTests.Monodoc.Generators
                {
                        var xml = rootTree.RenderUrl ("T:System.String", generator);
                        Assert.IsNotNull (xml);
-                       Assert.IsNotEmpty (xml);
+                       AssertHelper.IsNotEmpty (xml);
                        AssertValidXml (xml);
                        AssertEcmaFullTypeName (xml, "System.String");
                }
@@ -57,7 +57,7 @@ namespace MonoTests.Monodoc.Generators
                {
                        var xml = rootTree.RenderUrl ("T:System.Int32", generator);
                        Assert.IsNotNull (xml);
-                       Assert.IsNotEmpty (xml);
+                       AssertHelper.IsNotEmpty (xml);
                        AssertValidXml (xml);
                        AssertEcmaFullTypeName (xml, "System.Int32");
                }
index 867c9b793898dfb675e3aa05f15da5df70e6ec4c..29da7513704aead3d9f0d098a5b02d737c99e847 100644 (file)
@@ -85,7 +85,7 @@ namespace MonoTests.Monodoc
 
                        // HACK: in reality we have currently 4 known issues which are due to duplicated namespaces across
                        // doc sources, something that was never supported and that we need to improve/fix at some stage
-                       Assert.LessOrEqual (4, errorCount, errorCount + " / " + testCount.ToString ());
+                       AssertHelper.LessOrEqual (4, errorCount, errorCount + " / " + testCount.ToString ());
                }
 
                IEnumerable<Node> GetLeaves (Node node)
index 29ac108da8d5f2db0e007e42b6c721f3116f97fa..fc6bf8da18afd209240b12ab87373ec2b2c57ef5 100644 (file)
@@ -17,7 +17,7 @@ namespace MonoTests.Monodoc
                {
                        // the docPath variable is the only one we know for sure should exist
                        Assert.IsNotNull (Config.Get ("docPath"));
-                       Assert.IsNotEmpty (Config.Get ("docPath"));
+                       AssertHelper.IsNotEmpty (Config.Get ("docPath"));
                }
        }
 }
index 114d68896c5a6de9edfadb80ac938174fc1c6f42..a356d2789c0cf2f2550e61f1de38a102d2d61205 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>618,612,672,809,1699,169,164,162,168,219,618,612</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;LEGACY_MODE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;LEGACY_MODE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>618,612,672,809,1699,169,164,162,168,219,618,612</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>LEGACY_MODE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>LEGACY_MODE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index b806b8fb6e970302dd755c331a070e831781639a..a3f19b731a01371628deab21a6efcb1866c0df76 100644 (file)
@@ -1,3 +1,4 @@
+../../test-helpers/NunitHelpers.cs
 Monodoc/HelpSourceTests.cs
 Monodoc/EcmaDocTests.cs
 Monodoc/TreeTest.cs
index c2d07020d5896115448953dc25dcf7c133519f18..8dec8d4d72c2ee37bd13c0bf764bacb4f8de8118 100644 (file)
@@ -189,7 +189,9 @@ namespace System.Linq.Parallel
 
             private QueryOperatorEnumerator<Pair<TInputOutput, NoKeyMemoizationRequired>, TLeftKey> m_leftSource; // Left data source.
             private QueryOperatorEnumerator<Pair<TInputOutput, NoKeyMemoizationRequired>, TRightKey> m_rightSource; // Right data source.
+#if !MONO
             private readonly int m_partitionIndex; // The current partition.
+#endif
             private Set<TInputOutput> m_hashLookup; // The hash lookup, used to produce the union.
             private CancellationToken m_cancellationToken;
             private Shared<int> m_outputLoopCount;
@@ -210,7 +212,9 @@ namespace System.Linq.Parallel
 
                 m_leftSource = leftSource;
                 m_rightSource = rightSource;
+#if !MONO
                 m_partitionIndex = partitionIndex;
+#endif
                 m_comparer = comparer;
                 m_cancellationToken = cancellationToken;
             }
index 33baf3f8056e37c2b090c14ede08fa5fb4759382..08ae2840d333c766b2f91da8b331feeb1323f8f7 100644 (file)
@@ -23,8 +23,10 @@ namespace System.Linq.Parallel
     /// <typeparam name="TSource"></typeparam>
     internal sealed class OrderingQueryOperator<TSource> : QueryOperator<TSource>
     {
+#if !MONO
         // Turns on order (AsOrdered) or turns off order (AsUnordered)
         private bool m_orderOn;
+#endif
         private QueryOperator<TSource> m_child;
         private OrdinalIndexState m_ordinalIndexState;
 
@@ -33,7 +35,9 @@ namespace System.Linq.Parallel
         {
             m_child = child;
             m_ordinalIndexState = m_child.OrdinalIndexState;
+#if !MONO
             m_orderOn = orderOn;
+#endif
         }
 
         internal override QueryResults<TSource> Open(QuerySettings settings, bool preferStriping)
index d55436affb55dc0108c0df5b39eb618478784ce4..6f8c4a521f50cbfef3b9221022c8b7808fc710cd 100644 (file)
@@ -233,7 +233,9 @@ namespace System.Linq.Parallel
 
         class ConcatQueryOperatorResults : BinaryQueryOperatorResults
         {
+#if !MONO
             ConcatQueryOperator<TSource> m_concatOp; // Operator that generated the results
+#endif
             int m_leftChildCount; // The number of elements in the left child result set
             int m_rightChildCount; // The number of elements in the right child result set
 
@@ -260,7 +262,9 @@ namespace System.Linq.Parallel
                 bool preferStriping)
                 : base(leftChildQueryResults, rightChildQueryResults, concatOp, settings, preferStriping)
             {
+#if !MONO
                 m_concatOp = concatOp;
+#endif
                 Contract.Assert(leftChildQueryResults.IsIndexible && rightChildQueryResults.IsIndexible);
 
                 m_leftChildCount = leftChildQueryResults.ElementsCount;
index b73b8bd0829bd908ac8dfd0b5f6d3d59345d1804..02d220bce7815a333d8856b8580432f6272762cd 100644 (file)
@@ -150,7 +150,9 @@ namespace System.Linq.Parallel
         protected QueryResults<TInputOutput> m_childQueryResults; // Results of the child query
         private SortQueryOperator<TInputOutput, TSortKey> m_op; // Operator that generated these results
         private QuerySettings m_settings; // Settings collected from the query
+#if !MONO
         private bool m_preferStriping; // If the results are indexible, should we use striping when partitioning them
+#endif
 
         internal SortQueryOperatorResults(
             QueryResults<TInputOutput> childQueryResults, SortQueryOperator<TInputOutput, TSortKey> op,
@@ -159,7 +161,9 @@ namespace System.Linq.Parallel
             m_childQueryResults = childQueryResults;
             m_op = op;
             m_settings = settings;
+#if !MONO
             m_preferStriping = preferStriping;
+#endif
         }
 
         internal override bool IsIndexible
index f1e99baedb4ce522c751ad8098306333091d47c1..598d1e13aa3edbf10c8865de6a9a52dc678f1c76 100644 (file)
@@ -25,7 +25,9 @@ namespace System.Linq.Parallel
     class OrderPreservingPipeliningSpoolingTask<TOutput, TKey> : SpoolingTaskBase
     {
         private readonly QueryTaskGroupState m_taskGroupState; // State shared among tasks.
+#if !MONO
         private readonly TaskScheduler m_taskScheduler; // The task manager to execute the query.
+#endif
         private readonly QueryOperatorEnumerator<TOutput, TKey> m_partition; // The source partition.
         private readonly bool[] m_consumerWaiting; // Whether a consumer is waiting on a particular producer
         private readonly bool[] m_producerWaiting; // Whether a particular producer is waiting on the consumer
@@ -83,7 +85,9 @@ namespace System.Linq.Parallel
             m_partitionIndex = partitionIndex;
             m_buffers = buffers;
             m_bufferLock = bufferLock;
+#if !MONO
             m_taskScheduler = taskScheduler;
+#endif
             m_autoBuffered = autoBuffered;
         }
 
index fb355997295e4dd81c1b737c9e92cfe08bf2e2a2..5007e479c7408a2113cb2c72b317c21657e92d15 100644 (file)
@@ -70,11 +70,15 @@ namespace System.Linq.Parallel
             Contract.Assert(sharedkeys != null);
             Contract.Assert(sharedValues != null);
             Contract.Assert(sharedBarriers != null);
+#if !MONO
             Contract.Assert(groupState.CancellationState.MergedCancellationToken != null);
+#endif
             Contract.Assert(sharedIndices.Length <= sharedkeys.Length);
             Contract.Assert(sharedIndices.Length == sharedValues.Length);
             Contract.Assert(sharedIndices.Length == sharedBarriers.GetLength(1));
+#if !MONO            
             Contract.Assert(groupState.CancellationState.MergedCancellationToken != null);
+#endif
 
             m_source = source;
             m_partitionCount = partitionCount;
index c26925aae8d8822feed0d0973f7da72d685d745d..365a490d06d1eec87ccc94e0e0145bd367b23ca1 100644 (file)
@@ -101,7 +101,9 @@ namespace System.Linq {
         object IQueryProvider.Execute(Expression expression){
             if (expression == null)
                 throw Error.ArgumentNull("expression");
+#if !MONO
             Type execType = typeof(EnumerableExecutor<>).MakeGenericType(expression.Type);
+#endif
             return EnumerableExecutor.Create(expression).ExecuteBoxed();
         }
 
@@ -194,7 +196,9 @@ namespace System.Linq {
 
             // check for args changed
             if (obj != m.Object || args != m.Arguments) {
+#if !MONO
                 Expression[] argArray = args.ToArray();
+#endif
                 Type[] typeArgs = (m.Method.IsGenericMethod) ? m.Method.GetGenericArguments() : null;
 
                 if ((m.Method.IsStatic || m.Method.DeclaringType.IsAssignableFrom(obj.Type)) 
index 19db1acb0a4349d5cb97d4570cb503ae31171d69..aeff48d0040ee4f94ed3c598c732c98e7f01ce2d 100644 (file)
@@ -155,9 +155,7 @@ namespace System.Threading
             lockID = Interlocked.Increment(ref s_nextLockID);
         }
 
-#if NET_4_5
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
-#endif
         private static bool IsRWEntryEmpty(ReaderWriterCount rwc)
         {
             if (rwc.lockID == 0)
@@ -181,9 +179,7 @@ namespace System.Threading
         /// entry for this thread, but doesn't want to add one if an existing one
         /// could not be found.
         /// </summary>
-#if NET_4_5
                [MethodImpl(MethodImplOptions.AggressiveInlining)]
-#endif
         private ReaderWriterCount GetThreadRWCount(bool dontAllocate)
         {
                        ReaderWriterCount rwc = t_rwc;
@@ -1117,9 +1113,7 @@ namespace System.Threading
             return owners & READER_MASK;
         }
 
-#if NET_4_5
                [MethodImpl(MethodImplOptions.AggressiveInlining)]
-#endif
         private void EnterMyLock()
         {
             if (Interlocked.CompareExchange(ref myLock, 1, 0) != 0)
index d603b38fdcb1197ccaefe0df9449a6646e0e5779..a86c03ff01e8cfc78fb5c08150c498456faf873f 100644 (file)
@@ -40,6 +40,7 @@ namespace System.Data.Sql {
 
         override public DataTable GetDataSources() {
 #if MONO
+            timeoutTime = 0;
             throw new NotImplementedException ();
 #else
             (new NamedPermissionSet("FullTrust")).Demand(); // SQLBUDT 244304
index c36cb152e95807dc20cc19a6a001a1b7c2cc8802..bf5a3cb3e525bf43470435effd249ac53d7dc5e7 100644 (file)
@@ -67,7 +67,6 @@ namespace System.Runtime.Serialization
                         nodes[i].WriteTo(xmlWriter);
         }
 
-#if !MOBILE
         internal static string AddDefaultSchemaMethodName = "AddDefaultSchema";
         public static void AddDefaultSchema(XmlSchemaSet schemas, XmlQualifiedName typeQName)
         {
@@ -77,6 +76,5 @@ namespace System.Runtime.Serialization
                 throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("typeQName");
             SchemaExporter.AddDefaultXmlType(schemas, typeQName.Name, typeQName.Namespace);
         }
-#endif
     }
 }
index 9feea179f30dba470524c8f8a4c5e69ea385fac5..d1b0ab5f9ebfd615bf7497c17a6fe2dc50c09f72 100644 (file)
@@ -31,7 +31,9 @@ namespace System.CodeDom {
         private CodeNamespaceImportCollection imports = new CodeNamespaceImportCollection();
         private CodeCommentStatementCollection comments = new CodeCommentStatementCollection();
         private CodeTypeDeclarationCollection classes = new CodeTypeDeclarationCollection();
+#if CODEDOM_NESTED_NAMESPACES
         private CodeNamespaceCollection namespaces = new CodeNamespaceCollection();
+#endif
         
         private int  populated = 0x0;
         private const int ImportsCollection = 0x1;
index 28d511744cc529a7ce58dcd005affdd709863c8f..38ccf72ec0efd622c8ddb04f9d6f9bf6d7dae25a 100644 (file)
@@ -27,7 +27,9 @@ namespace System.CodeDom {
     public class CodePropertyReferenceExpression : CodeExpression {
         private CodeExpression targetObject;
         private string propertyName;
+#if !MONO
         private CodeExpressionCollection parameters = new CodeExpressionCollection();
+#endif
 
         /// <devdoc>
         ///    <para>
index 96ec1aa520a7c723dec25a3cfec0622a4fe1ca0d..82bfe6c56ae9d6e0857deca6701a76f49326824f 100644 (file)
@@ -98,11 +98,15 @@ namespace System.ComponentModel {
         }
 
         private class LicFileLicense : License {
+#if !MONO
             private LicFileLicenseProvider owner;
+#endif
             private string key;
 
             public LicFileLicense(LicFileLicenseProvider owner, string key) {
+#if !MONO
                 this.owner = owner;
+#endif
                 this.key = key;
             }
             public override string LicenseKey { 
index cfdaabbfc31b6a1cebc722cc91676164afa19480..ce8d0cd7dfdb4d866312365a2dad2c2f79c20bc8 100644 (file)
@@ -67,9 +67,10 @@ namespace System.ComponentModel {
     /// </devdoc>
     [HostProtection(SharedState = true)]
     internal sealed class ReflectEventDescriptor : EventDescriptor {
-
+#if !MONO
         private static readonly Type[] argsNone = new Type[0];
         private static readonly object  noDefault = new object();
+#endif
 
         private Type type;           // the delegate type for the event
         private readonly Type componentClass; // the class of the component this info is for
index 401c21e4d6697f3c41556dd58df794435d5c3d73..94424b88b02e177303499237b0c0f28e7a7894e7 100644 (file)
@@ -64,7 +64,9 @@ namespace System.ComponentModel {
         
         private static TraceSwitch PropDescCreateSwitch = new TraceSwitch("PropDescCreate", "ReflectPropertyDescriptor: Dump errors when creating property info");
         private static TraceSwitch PropDescUsageSwitch  = new TraceSwitch("PropDescUsage", "ReflectPropertyDescriptor: Debug propertydescriptor usage");
+#if !MONO
         private static TraceSwitch PropDescSwitch       = new TraceSwitch("PropDesc", "ReflectPropertyDescriptor: Debug property descriptor");
+#endif
         
         private static readonly int BitDefaultValueQueried      = BitVector32.CreateMask();
         private static readonly int BitGetQueried               = BitVector32.CreateMask(BitDefaultValueQueried);
index 246b3aee430291b32e13ec4c5882d268e17ce5b4..3bcd73437916cca6106e50c327e3fb4d4b83005a 100644 (file)
@@ -28,8 +28,10 @@ namespace System.ComponentModel {
 
         private const string s_UseCompatibleTypeConverterBehavior = "UseCompatibleTypeConverterBehavior";
         private static volatile bool useCompatibleTypeConversion = false;
+#if !MONO
         private static volatile bool firstLoadAppSetting = true;
         private static object loadAppSettingLock = new Object();
+#endif
 
         private static bool UseCompatibleTypeConversion {
             get {
index cf77c9972b2967219bba6e0992252ca86961ca7c..17c7e0f4077176e2fa91f6be683afadc8abb0796 100644 (file)
@@ -2348,11 +2348,11 @@ namespace System.ComponentModel
             {
                 TypeDescriptionNode head = (TypeDescriptionNode)_providerTable[key];
                 TypeDescriptionNode target = head;
-                TypeDescriptionNode prev = null;
+//                TypeDescriptionNode prev = null;
 
                 while(target != null && target.Provider != provider)
                 {
-                    prev = target;
+//                    prev = target;
                     target = target.Next;
                 }
 
index c400a3e411cdb36b18b7ec5dae2ca8191195b43c..1a4cd98d9610c35ddffd981e873d86431f1cc08d 100644 (file)
@@ -18,8 +18,10 @@ namespace System.Diagnostics {
         [ThreadStatic]
         static int indentLevel;
         static volatile int indentSize;
+#if CONFIGURATION_DEP
         static volatile bool settingsInitialized;
         static volatile bool defaultInitialized;
+#endif
 
 
         // this is internal so TraceSource can use it.  We want to lock on the same object because both TraceInternal and 
@@ -303,7 +305,9 @@ namespace System.Diagnostics {
         // in the System.Diagnostics.Trace class
         static internal void Refresh() {
             lock (critSec) {
+#if CONFIGURATION_DEP
                 settingsInitialized = false;
+#endif
                 listeners = null;
             }
             InitializeSettings();
index e3273c4c9c95a17746b5cae33d505851391c123c..dce8967231569d9d14eec974bc8db728257042b2 100644 (file)
@@ -183,8 +183,8 @@ namespace System.Net {
                 // call !
                 //
                 SocketException e = null;
-                long   scope = 0;
 #if !MONO
+                long   scope = 0;
                 if(Socket.OSSupportsIPv6)
                 {
                     byte[] bytes = new byte[IPv6AddressBytes];
index 05732c28d3646eba263c003145863812cd75f45d..bcd27d93699729e0b16b473c2ae353aa9e4ed5af 100644 (file)
@@ -953,7 +953,7 @@ namespace System.Net {
         // There are threading tricks a malicious app can use to create an ArraySegment with mismatched 
         // array/offset/count.  Copy locally and make sure they're valid before using them.
         internal static void ValidateSegment(ArraySegment<byte> segment) {
-            if (segment == null || segment.Array == null) {
+            if (/*segment == null ||*/ segment.Array == null) {
                 throw new ArgumentNullException("segment");
             }
             // Length zero is explicitly allowed
index 06aa93aa15b3494ee32297ef1ffb5ccae85d37d3..3f9b4d7c8c8e538011a29f93c04cee1b8d247adc 100644 (file)
@@ -4,6 +4,10 @@
 // </copyright>
 //------------------------------------------------------------------------------
 
+#if MONO
+#undef FEATURE_PAL
+#endif
+
 namespace System.Net {
 
     using System.IO;
@@ -22,9 +26,11 @@ namespace System.Net {
     /// </devdoc>
     public class NetworkCredential : ICredentials,ICredentialsByHost {
 
+#if FEATURE_MONO_CAS
         private static volatile EnvironmentPermission m_environmentUserNamePermission;
         private static volatile EnvironmentPermission m_environmentDomainNamePermission;
         private static readonly object lockingObject = new object();
+#endif
         private string m_domain;
         private string m_userName;
 #if !FEATURE_PAL
@@ -85,6 +91,7 @@ namespace System.Net {
         }
 #endif //!FEATURE_PAL        
 
+#if FEATURE_MONO_CAS
         void InitializePart1() {
             if (m_environmentUserNamePermission == null) {
                 lock(lockingObject) {
@@ -95,7 +102,7 @@ namespace System.Net {
                 }
             }
         }
-
+#endif
 
         /// <devdoc>
         ///    <para>
@@ -104,8 +111,10 @@ namespace System.Net {
         /// </devdoc>
         public string UserName {
             get {
+#if FEATURE_MONO_CAS
                 InitializePart1();
                 m_environmentUserNamePermission.Demand();
+#endif
                 return InternalGetUserName();
             }
             set {
@@ -124,7 +133,9 @@ namespace System.Net {
         /// </devdoc>
         public string Password {
             get {
+#if FEATURE_MONO_CAS
                 ExceptionHelper.UnmanagedPermission.Demand();
+#endif
                 return InternalGetPassword();
             }
             set {
@@ -151,7 +162,9 @@ namespace System.Net {
         /// </devdoc>
         public SecureString SecurePassword {
             get {
+#if FEATURE_MONO_CAS
                 ExceptionHelper.UnmanagedPermission.Demand();
+#endif
                 return InternalGetSecurePassword().Copy();
             }
             set {
@@ -171,8 +184,10 @@ namespace System.Net {
         /// </devdoc>
         public string Domain {
             get {
+#if FEATURE_MONO_CAS
                 InitializePart1();
                 m_environmentDomainNamePermission.Demand();
+#endif
                 return InternalGetDomain();
             }
             set {
index 1d92faa541f6a2d6c5a5700a11dc0113895d3e89..ee56c48eabc29f3a64539b00758f7abba3abc914 100644 (file)
@@ -4,6 +4,10 @@
 // </copyright>
 //------------------------------------------------------------------------------
 
+#if MONO
+#undef FEATURE_PAL
+#endif
+
 namespace System.Net.Sockets {
     using System.Collections;
     using System.Collections.Generic;
@@ -24,9 +28,9 @@ namespace System.Net.Sockets {
     ///    interface.</para>
     /// </devdoc>
 
-
-    public class Socket : IDisposable
+    public partial class Socket : IDisposable
     {
+#if !MONO
         internal const int DefaultCloseTimeout = -1; // don't change for default, otherwise breaking change
 
         // AcceptQueue - queued list of accept requests for BeginAccept or async Result for Begin Connect
@@ -81,12 +85,12 @@ namespace System.Net.Sockets {
         //
         // Overlapped constants.
         //
-#if !FEATURE_PAL || CORIOLIS
+#if !(FEATURE_PAL && !MONO) || CORIOLIS
         internal static volatile bool UseOverlappedIO;
 #else
         // Disable the I/O completion port for Rotor
         internal static volatile bool UseOverlappedIO = true;
-#endif // !FEATURE_PAL || CORIOLIS
+#endif // !(FEATURE_PAL && !MONO) || CORIOLIS
         private bool useOverlappedIO;
 
         // Bool marked true if the native socket m_Handle was bound to the ThreadPool
@@ -104,18 +108,23 @@ namespace System.Net.Sockets {
         private SocketAddress   m_PermittedRemoteAddress;
 
         private DynamicWinsockMethods m_DynamicWinsockMethods;
+#endif // !MONO
 
         private static object s_InternalSyncObject;
+#if !MONO
         private int m_CloseTimeout = Socket.DefaultCloseTimeout;
         private int m_IntCleanedUp;                 // 0 if not completed >0 otherwise.
         private const int microcnv = 1000000;
         private readonly static int protocolInformationSize = Marshal.SizeOf(typeof(UnsafeNclNativeMethods.OSSOCK.WSAPROTOCOL_INFO));
+#endif // !MONO
 
         internal static volatile bool s_SupportsIPv4;
         internal static volatile bool s_SupportsIPv6;
         internal static volatile bool s_OSSupportsIPv6;
         internal static volatile bool s_Initialized;
+#if !MONO
         private static volatile WaitOrTimerCallback s_RegisteredWaitCallback;
+#endif
         private static volatile bool s_LoggingEnabled;
 #if !FEATURE_PAL // perfcounter
         internal static volatile bool s_PerfCountersEnabled;
@@ -140,10 +149,16 @@ namespace System.Net.Sockets {
             s_LoggingEnabled = Logging.On;
             if(s_LoggingEnabled)Logging.Enter(Logging.Sockets, this, "Socket", addressFamily);
             InitializeSockets();
+
+#if MONO
+            int error;
+            m_Handle = new SafeSocketHandle (Socket_internal (addressFamily, socketType, protocolType, out error), true);
+#else
             m_Handle = SafeCloseSocket.CreateWSASocket(
                     addressFamily,
                     socketType,
                     protocolType);
+#endif
 
             if (m_Handle.IsInvalid) {
                 //
@@ -161,10 +176,14 @@ namespace System.Net.Sockets {
                 SetIPProtectionLevel(defaultProtectionLevel);
             }
 
+#if MONO
+            SocketDefaults ();
+#endif
+
             if(s_LoggingEnabled)Logging.Exit(Logging.Sockets, this, "Socket", null);
         }
 
-
+#if !MONO
         public Socket(SocketInformation socketInformation) {
             s_LoggingEnabled = Logging.On;
             if(s_LoggingEnabled)Logging.Enter(Logging.Sockets, this, "Socket", addressFamily);
@@ -282,7 +301,7 @@ namespace System.Net.Sockets {
             protocolType = Sockets.ProtocolType.Unknown;
             if(s_LoggingEnabled)Logging.Exit(Logging.Sockets, this, "Socket", null);
         }
-
+#endif
 
 
 //************* properties *************************
@@ -333,7 +352,7 @@ namespace System.Net.Sockets {
             }
         }
 
-
+#if !MONO
         /// <devdoc>
         ///    <para>
         ///       Gets the amount of data pending in the network's input buffer that can be
@@ -475,6 +494,7 @@ namespace System.Net.Sockets {
                 return m_RemoteEndPoint;
             }
         }
+#endif // !MONO
 
         /// <devdoc>
         ///    <para>
@@ -484,10 +504,13 @@ namespace System.Net.Sockets {
         /// </devdoc>
         public IntPtr Handle {
             get {
+#if !MONO
                 ExceptionHelper.UnmanagedPermission.Demand();
+#endif
                 return m_Handle.DangerousGetHandle();
             }
         }
+#if !MONO
         internal SafeCloseSocket SafeHandle {
             get {
                 return m_Handle;
@@ -534,6 +557,7 @@ namespace System.Net.Sockets {
                 willBlock = current;
             }
         }
+#endif // !MONO
 
         public bool UseOnlyOverlappedIO{
             get {
@@ -544,16 +568,17 @@ namespace System.Net.Sockets {
 
             }
             set {
-
+#if !MONO
                 if (m_BoundToThreadPool) {
                     throw new InvalidOperationException(SR.GetString(SR.net_io_completionportwasbound));
                 }
+#endif
 
                 useOverlappedIO = value;
             }
         }
 
-
+#if !MONO
         /// <devdoc>
         ///    <para>
         ///       Gets the connection state of the Socket. This property will return the latest
@@ -577,6 +602,7 @@ namespace System.Net.Sockets {
                 return m_IsConnected;
             }
         }
+#endif // !MONO
 
         /// <devdoc>
         ///    <para>
@@ -611,13 +637,13 @@ namespace System.Net.Sockets {
             }
         }
 
-
+#if !MONO
         public bool IsBound{
             get{
                 return (m_RightEndPoint != null);
             }
         }
-
+#endif // !MONO
 
         public bool ExclusiveAddressUse{
             get {
@@ -707,6 +733,7 @@ namespace System.Net.Sockets {
             }
         }
 
+#if !MONO
         public bool NoDelay {
             get {
                 return (int)GetSocketOption(SocketOptionLevel.Tcp, SocketOptionName.NoDelay) != 0 ? true : false;
@@ -715,6 +742,7 @@ namespace System.Net.Sockets {
                 SetSocketOption(SocketOptionLevel.Tcp, SocketOptionName.NoDelay, value ? 1 : 0);
             }
         }
+#endif // !MONO
 
         public short Ttl{
             get {
@@ -769,6 +797,7 @@ namespace System.Net.Sockets {
             }
         }
 
+#if !MONO
         public bool MulticastLoopback{
             get {
                 if (addressFamily == AddressFamily.InterNetwork) {
@@ -796,7 +825,6 @@ namespace System.Net.Sockets {
             }
         }
 
-
         public bool EnableBroadcast{
             get {
                 return (int)GetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Broadcast) != 0 ? true : false;
@@ -805,7 +833,8 @@ namespace System.Net.Sockets {
                 SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Broadcast, value ? 1 : 0);
             }
         }
-                
+#endif // !MONO
+
         public bool DualMode {
             get {
                 if (AddressFamily != AddressFamily.InterNetworkV6) {
@@ -837,7 +866,7 @@ namespace System.Net.Sockets {
 
 
 
-
+#if !MONO
         /// <devdoc>
         ///    <para>Associates a socket with an end point.</para>
         /// </devdoc>
@@ -1079,6 +1108,7 @@ namespace System.Net.Sockets {
             Connect(addresses,port);
             if(s_LoggingEnabled)Logging.Exit(Logging.Sockets, this, "Connect", null);
         }
+#endif // !MONO
 
         public void Connect(IPAddress[] addresses, int port){
             if(s_LoggingEnabled)Logging.Enter(Logging.Sockets, this, "Connect", addresses);
@@ -1127,7 +1157,7 @@ namespace System.Net.Sockets {
             if(s_LoggingEnabled)Logging.Exit(Logging.Sockets, this, "Connect", null);
         }
 
-
+#if !MONO
         /// <devdoc>
         ///    <para>
         ///       Forces a socket connection to close.
@@ -1258,7 +1288,7 @@ namespace System.Net.Sockets {
             }
             return socket;
         }
-
+#endif // !MONO
 
         /// <devdoc>
         ///    <para>Sends a data buffer to a connected socket.</para>
@@ -1300,7 +1330,7 @@ namespace System.Net.Sockets {
             return bytesTransferred;
         }
 
-
+#if !MONO
         public int Send(IList<ArraySegment<byte>> buffers, SocketFlags socketFlags, out SocketError errorCode) {
             if(s_LoggingEnabled)Logging.Enter(Logging.Sockets, this, "Send", "");
             if (CleanedUp) {
@@ -1392,8 +1422,7 @@ namespace System.Net.Sockets {
             if(s_LoggingEnabled)Logging.Exit(Logging.Sockets, this, "Send", bytesTransferred);
             return bytesTransferred;
         }
-
-
+#endif // !MONO
 
         /// <devdoc>
         ///    <para>Sends a file to
@@ -1406,8 +1435,7 @@ namespace System.Net.Sockets {
             SendFile(fileName,null,null,TransmitFileOptions.UseDefaultWorkerThread);
         }
 
-
-
+#if !MONO
         /// <devdoc>
         ///    <para>Sends a file to
         ///       a connected socket.</para>
@@ -1492,6 +1520,7 @@ namespace System.Net.Sockets {
             if(s_LoggingEnabled)Logging.Exit(Logging.Sockets, this, "SendFile", errorCode);
             return;
         }
+#endif // !MONO
 #endif // !FEATURE_PAL
 
 
@@ -1511,8 +1540,7 @@ namespace System.Net.Sockets {
             return bytesTransferred;
         }
 
-
-
+#if !MONO
         public int Send(byte[] buffer, int offset, int size, SocketFlags socketFlags, out SocketError errorCode) {
             if(s_LoggingEnabled)Logging.Enter(Logging.Sockets, this, "Send", "");
 
@@ -1688,6 +1716,7 @@ namespace System.Net.Sockets {
             if(s_LoggingEnabled)Logging.Exit(Logging.Sockets, this, "SendTo", bytesTransferred);
             return bytesTransferred;
         }
+#endif // !MONO
 
         /// <devdoc>
         ///    <para>Sends data to a specific end point, starting at the indicated location in the data.</para>
@@ -1695,12 +1724,14 @@ namespace System.Net.Sockets {
         public int SendTo(byte[] buffer, int size, SocketFlags socketFlags, EndPoint remoteEP) {
             return SendTo(buffer, 0, size, socketFlags, remoteEP);
         }
+
         /// <devdoc>
         ///    <para>[To be supplied.]</para>
         /// </devdoc>
         public int SendTo(byte[] buffer, SocketFlags socketFlags, EndPoint remoteEP) {
             return SendTo(buffer, 0, buffer!=null ? buffer.Length : 0, socketFlags, remoteEP);
         }
+
         /// <devdoc>
         ///    <para>[To be supplied.]</para>
         /// </devdoc>
@@ -1742,7 +1773,7 @@ namespace System.Net.Sockets {
             return bytesTransferred;
         }
 
-
+#if !MONO
         public int Receive(byte[] buffer, int offset, int size, SocketFlags socketFlags, out SocketError errorCode) {
             if(s_LoggingEnabled)Logging.Enter(Logging.Sockets, this, "Receive", "");
             if (CleanedUp) {
@@ -1820,7 +1851,7 @@ namespace System.Net.Sockets {
 
             return bytesTransferred;
         }
-
+#endif // !MONO
 
         public int Receive(IList<ArraySegment<byte>> buffers) {
             return Receive(buffers,SocketFlags.None);
@@ -1836,6 +1867,7 @@ namespace System.Net.Sockets {
             return bytesTransferred;
         }
 
+#if !MONO
         public int Receive(IList<ArraySegment<byte>> buffers, SocketFlags socketFlags, out SocketError errorCode) {
             if(s_LoggingEnabled)Logging.Enter(Logging.Sockets, this, "Receive", "");
             if (CleanedUp) {
@@ -2153,8 +2185,7 @@ namespace System.Net.Sockets {
             if(s_LoggingEnabled)Logging.Exit(Logging.Sockets, this, "ReceiveFrom", bytesTransferred);
             return bytesTransferred;
         }
-
-
+#endif // !MONO
 
         /// <devdoc>
         ///    <para>Receives a datagram and stores the source end point.</para>
@@ -2175,6 +2206,7 @@ namespace System.Net.Sockets {
             return ReceiveFrom(buffer, 0, buffer!=null ? buffer.Length : 0, SocketFlags.None, ref remoteEP);
         }
 
+#if !MONO
         // UE
         /// <devdoc>
         ///    <para>[To be supplied.]</para>
@@ -2220,6 +2252,7 @@ namespace System.Net.Sockets {
 
             return realOptionLength;
         }
+#endif // !MONO
 
         // UE
         /// <devdoc>
@@ -2229,6 +2262,7 @@ namespace System.Net.Sockets {
             return IOControl(unchecked((int)ioControlCode),optionInValue,optionOutValue);
         }
 
+#if !MONO
         internal int IOControl(        IOControlCode ioControlCode, 
                                                                        IntPtr optionInValue, 
                                                                        int inValueSize,
@@ -2273,6 +2307,7 @@ namespace System.Net.Sockets {
 
             return realOptionLength;
         }
+#endif // !MONO
 
         public void SetIPProtectionLevel(IPProtectionLevel level) {
             if (level == IPProtectionLevel.Unspecified) {
@@ -2290,6 +2325,7 @@ namespace System.Net.Sockets {
             }
         }
 
+#if !MONO
         /// <devdoc>
         ///    <para>
         ///       Sets the specified option to the specified value.
@@ -2660,6 +2696,7 @@ namespace System.Net.Sockets {
             SelectFileDescriptor(checkWrite, writefileDescriptorSet);
             SelectFileDescriptor(checkError, errfileDescriptorSet);
         }
+#endif // !MONO
 
 #if !FEATURE_PAL
         /// <devdoc>
@@ -2678,7 +2715,7 @@ namespace System.Net.Sockets {
         }
 #endif
 
-
+#if !MONO
         //
         // Async Winsock Support, the following functions use either
         //   the Async Winsock support to do overlapped I/O WSASend/WSARecv
@@ -3100,6 +3137,7 @@ namespace System.Net.Sockets {
             if(s_LoggingEnabled)Logging.Exit(Logging.Sockets, this, "BeginConnect", result);
             return result;
         }
+#endif // !MONO
 
         [HostProtection(ExternalThreading=true)]
         public IAsyncResult BeginConnect(IPAddress address, int port, AsyncCallback requestCallback, object state){
@@ -3124,6 +3162,7 @@ namespace System.Net.Sockets {
             return result;
         }
 
+#if !MONO
         [HostProtection(ExternalThreading=true)]
         public IAsyncResult BeginConnect(IPAddress[] addresses, int port, AsyncCallback requestCallback, object state)
         {
@@ -3193,7 +3232,7 @@ namespace System.Net.Sockets {
 
             GlobalLog.Print("Socket#" + ValidationHelper.HashString(this) + "::DoBeginDisconnect() ");
 
-#if FEATURE_PAL
+#if FEATURE_PAL && !MONO
             throw new PlatformNotSupportedException(SR.GetString(SR.WinXPRequired));
 #endif
 
@@ -3242,9 +3281,9 @@ namespace System.Net.Sockets {
                  throw new ObjectDisposedException(this.GetType().FullName);
              }
 
-#if FEATURE_PAL
+#if FEATURE_PAL && !MONO
             throw new PlatformNotSupportedException(SR.GetString(SR.WinXPRequired));
-#endif // FEATURE_PAL
+#endif // FEATURE_PAL && !MONO
 
 
              GlobalLog.Print("Socket#" + ValidationHelper.HashString(this) + "::Disconnect() ");
@@ -3370,9 +3409,9 @@ namespace System.Net.Sockets {
                throw new ObjectDisposedException(this.GetType().FullName);
              }
 
-#if FEATURE_PAL
+#if FEATURE_PAL && !MONO
             throw new PlatformNotSupportedException(SR.GetString(SR.WinNTRequired));
-#endif // FEATURE_PAL
+#endif // FEATURE_PAL && !MONO
 
              if (asyncResult==null) {
                throw new ArgumentNullException("asyncResult");
@@ -3412,7 +3451,7 @@ namespace System.Net.Sockets {
              if(s_LoggingEnabled)Logging.Exit(Logging.Sockets, this, "EndDisconnect", null);
              return;
         }
-
+#endif // !MONO
 
         /*++
 
@@ -3451,6 +3490,7 @@ namespace System.Net.Sockets {
             return result;
         }
 
+#if !MONO
         [HostProtection(ExternalThreading=true)]
         public IAsyncResult BeginSend(byte[] buffer, int offset, int size, SocketFlags socketFlags, out SocketError errorCode, AsyncCallback callback, object state)
         {
@@ -3620,9 +3660,9 @@ namespace System.Net.Sockets {
                 throw new ObjectDisposedException(this.GetType().FullName);
             }
 
-#if FEATURE_PAL
+#if FEATURE_PAL && !MONO
             throw new PlatformNotSupportedException(SR.GetString(SR.WinNTRequired));
-#endif // FEATURE_PAL
+#endif // FEATURE_PAL && !MONO
 
 
             if (!Connected) {
@@ -3698,7 +3738,7 @@ namespace System.Net.Sockets {
         }
 
 #endif // !FEATURE_PAL
-
+#endif // !MONO
 
         /// <devdoc>
         ///    <para>[To be supplied.]</para>
@@ -3714,7 +3754,7 @@ namespace System.Net.Sockets {
             return result;
         }
 
-
+#if !MONO
         [HostProtection(ExternalThreading=true)]
         public IAsyncResult BeginSend(IList<ArraySegment<byte>> buffers, SocketFlags socketFlags, out SocketError errorCode, AsyncCallback callback, object state)
         {
@@ -3804,7 +3844,7 @@ namespace System.Net.Sockets {
             }
             return errorCode;
         }
-
+#endif // !MONO
 
         /*++
 
@@ -3836,7 +3876,7 @@ namespace System.Net.Sockets {
             return bytesTransferred;
         }
 
-
+#if !MONO
         public int EndSend(IAsyncResult asyncResult, out SocketError errorCode) {
             if(s_LoggingEnabled)Logging.Enter(Logging.Sockets, this, "EndSend", asyncResult);
             if (CleanedUp) {
@@ -3904,9 +3944,9 @@ namespace System.Net.Sockets {
                 throw new ObjectDisposedException(this.GetType().FullName);
             }
 
-#if FEATURE_PAL
+#if FEATURE_PAL && !MONO
             throw new PlatformNotSupportedException(SR.GetString(SR.WinNTRequired));
-#endif // FEATURE_PAL
+#endif // FEATURE_PAL && !MONO
             //
             // parameter validation
             //
@@ -4160,7 +4200,7 @@ namespace System.Net.Sockets {
             if(s_LoggingEnabled)Logging.Exit(Logging.Sockets, this, "EndSendTo", bytesTransferred);
             return bytesTransferred;
         }
-
+#endif // !MONO
 
         /*++
 
@@ -4206,6 +4246,7 @@ namespace System.Net.Sockets {
         }
 
 
+#if !MONO
         [HostProtection(ExternalThreading=true)]
         public IAsyncResult BeginReceive(byte[] buffer, int offset, int size, SocketFlags socketFlags, out SocketError errorCode, AsyncCallback callback, object state)
         {
@@ -4329,7 +4370,7 @@ namespace System.Net.Sockets {
 
             return errorCode;
         }
-
+#endif // !MONO
 
         [HostProtection(ExternalThreading=true)]
         public IAsyncResult BeginReceive(IList<ArraySegment<byte>> buffers, SocketFlags socketFlags, AsyncCallback callback, object state)
@@ -4342,7 +4383,7 @@ namespace System.Net.Sockets {
             return result;
         }
 
-
+#if !MONO
         [HostProtection(ExternalThreading=true)]
         public IAsyncResult BeginReceive(IList<ArraySegment<byte>> buffers, SocketFlags socketFlags, out SocketError errorCode, AsyncCallback callback, object state)
         {
@@ -4451,6 +4492,8 @@ namespace System.Net.Sockets {
         private int m_LastReceiveTick;
 #endif
 
+#endif // !MONO
+
         /*++
 
         Routine Description:
@@ -4481,7 +4524,7 @@ namespace System.Net.Sockets {
             return bytesTransferred;
         }
 
-
+#if !MONO
         public int EndReceive(IAsyncResult asyncResult, out SocketError errorCode) {
             if(s_LoggingEnabled)Logging.Enter(Logging.Sockets, this, "EndReceive", asyncResult);
             if (CleanedUp) {
@@ -5342,8 +5385,10 @@ namespace System.Net.Sockets {
                 }
             }
         }
+#endif // !MONO
 
 #if !FEATURE_PAL
+#if !MONO
         private bool CanUseAcceptEx
         {
             get
@@ -5352,6 +5397,7 @@ namespace System.Net.Sockets {
                     (Thread.CurrentThread.IsThreadPoolThread || SettingsSectionInternal.Section.AlwaysUseCompletionPortsForAccept || m_IsDisconnected);
             }
         }
+#endif // !MONO
 
         /// <devdoc>
         ///    <para>[To be supplied.]</para>
@@ -5363,6 +5409,7 @@ namespace System.Net.Sockets {
 
         ///  This is the true async version that uses AcceptEx
 
+#if !MONO
         /// <devdoc>
         ///    <para>[To be supplied.]</para>
         /// </devdoc>
@@ -5461,10 +5508,9 @@ namespace System.Net.Sockets {
                 throw socketException;
             }
         }
-
+#endif // !MONO
 #endif // !FEATURE_PAL
 
-
         /*++
 
         Routine Description:
@@ -5483,6 +5529,7 @@ namespace System.Net.Sockets {
 
         --*/
 
+#if !MONO
         /// <devdoc>
         ///    <para>[To be supplied.]</para>
         /// </devdoc>
@@ -5552,9 +5599,9 @@ namespace System.Net.Sockets {
             }
             return acceptedSocket;
         }
+#endif // !MONO
 
 #if !FEATURE_PAL
-
         /// <devdoc>
         ///    <para>[To be supplied.]</para>
         /// </devdoc>
@@ -5569,6 +5616,7 @@ namespace System.Net.Sockets {
             return socket;
         }
 
+#if !MONO
         /// <devdoc>
         ///    <para>[To be supplied.]</para>
         /// </devdoc>
@@ -5635,13 +5683,13 @@ namespace System.Net.Sockets {
             }
             return socket;
         }
-
+#endif // !MONO
 #endif // !FEATURE_PAL
 
 
 
 
-
+#if !MONO
         /// <devdoc>
         ///    <para>
         ///       Disables sends and receives on a socket.
@@ -5682,7 +5730,7 @@ namespace System.Net.Sockets {
             InternalSetBlocking(willBlockInternal);
             if(s_LoggingEnabled)Logging.Exit(Logging.Sockets, this, "Shutdown", "");
         }
-
+#endif
 
 
 //************* internal and private properties *************************
@@ -5697,6 +5745,7 @@ namespace System.Net.Sockets {
             }
         }
 
+#if !MONO
         private CacheSet Caches
         {
             get
@@ -5821,6 +5870,7 @@ namespace System.Net.Sockets {
                 Interlocked.CompareExchange(ref m_AcceptQueueOrConnectResult, new Queue(16), null);
             return (Queue)m_AcceptQueueOrConnectResult;
         }
+#endif // !MONO
 
         internal bool CleanedUp {
             get {
@@ -5828,6 +5878,7 @@ namespace System.Net.Sockets {
             }
         }
 
+#if !MONO
         internal TransportType Transport {
             get {
                 return
@@ -5968,13 +6019,14 @@ namespace System.Net.Sockets {
 
             return socketAddress;
         }
-
+#endif
 
         internal static void InitializeSockets() {
             if (!s_Initialized) {
                 lock(InternalSyncObject){
                     if (!s_Initialized) {
 
+#if !MONO
                         WSAData wsaData = new WSAData();
 
                         SocketError errorCode =
@@ -5989,6 +6041,7 @@ namespace System.Net.Sockets {
                             // WSAStartup does not set LastWin32Error
                             throw new SocketException(errorCode);
                         }
+#endif
 
 #if !FEATURE_PAL
                         //
@@ -6009,6 +6062,10 @@ namespace System.Net.Sockets {
                         bool   ipv4      = true; 
                         bool   ipv6      = true; 
 
+#if MONO
+                        ipv4 = IsProtocolSupported (System.Net.NetworkInformation.NetworkInterfaceComponent.IPv4);
+                        ipv6 = IsProtocolSupported (System.Net.NetworkInformation.NetworkInterfaceComponent.IPv6);
+#else
                         SafeCloseSocket.InnerSafeCloseSocket socketV4 = 
                                                              UnsafeNclNativeMethods.OSSOCK.WSASocket(
                                                                     AddressFamily.InterNetwork, 
@@ -6042,7 +6099,7 @@ namespace System.Net.Sockets {
                         socketV6.Close();
 
                         // <
-
+#endif // MONO
 
 
 #if COMNET_DISABLEIPV6
@@ -6076,16 +6133,19 @@ namespace System.Net.Sockets {
 
                         // Cache some settings locally.
 
+#if !MONO
 #if !FEATURE_PAL // perfcounter
                         s_PerfCountersEnabled = NetworkingPerfCounters.Instance.Enabled;
 #endif
+#endif
+
                         s_Initialized = true;
                     }
                 }
             }
         }
 
-
+#if !MONO
         internal void InternalConnect(EndPoint remoteEP)
         {
             EndPoint endPointSnapshot = remoteEP;
@@ -6330,6 +6390,7 @@ namespace System.Net.Sockets {
                 m_AsyncEvent.Close();
             }
         }
+#endif // !MONO
 
         public void Dispose() {
             Dispose(true);
@@ -6340,6 +6401,7 @@ namespace System.Net.Sockets {
             Dispose(false);
         }
 
+#if !MONO
         // this version does not throw.
         internal void InternalShutdown(SocketShutdown how) {
             GlobalLog.Print("Socket#" + ValidationHelper.HashString(this) + "::InternalShutdown() how:" + how.ToString());
@@ -7781,6 +7843,7 @@ namespace System.Net.Sockets {
             return retval;
         }
 
+#endif // MONO
         public static bool ConnectAsync(SocketType socketType, ProtocolType protocolType, SocketAsyncEventArgs e) {
 
             bool retval;
@@ -7823,6 +7886,7 @@ namespace System.Net.Sockets {
             return retval;
         }
 
+#if !MONO
         public static void CancelConnectAsync(SocketAsyncEventArgs e) {
 
             if (e == null) {
@@ -8350,10 +8414,10 @@ namespace System.Net.Sockets {
 
             return retval;
         }
-
+#endif // !MONO
     }  // end of class Socket
 
-
+#if !MONO
     internal class ConnectAsyncResult:ContextAwareResult{
         private EndPoint m_EndPoint;
         internal ConnectAsyncResult(object myObject, EndPoint endPoint, object myState, AsyncCallback myCallBack):base(myObject, myState, myCallBack) {
@@ -8368,7 +8432,7 @@ namespace System.Net.Sockets {
         internal AcceptAsyncResult(object myObject, object myState, AsyncCallback myCallBack):base(myObject, myState, myCallBack) {
         }
     }
-
+#endif
 
     public enum SocketAsyncOperation {
         None = 0,
@@ -8389,7 +8453,11 @@ namespace System.Net.Sockets {
         internal byte [] m_Buffer;
         internal int m_Offset;
         internal int m_Count;
+#if MONO
+        bool m_endOfPacket;
+#else
         internal UnsafeNclNativeMethods.OSSOCK.TransmitPacketsElementFlags m_Flags;
+#endif
 
         // hide default constructor
         private SendPacketsElement() {}
@@ -8415,8 +8483,13 @@ namespace System.Net.Sockets {
             }
             Contract.EndContractBlock();
 
+#if MONO
+            Initialize(filepath, null, offset, count, /*UnsafeNclNativeMethods.OSSOCK.TransmitPacketsElementFlags.File,*/
+                endOfPacket);
+#else
             Initialize(filepath, null, offset, count, UnsafeNclNativeMethods.OSSOCK.TransmitPacketsElementFlags.File,
                 endOfPacket);
+#endif
         }
 
         // constructors for buffer elements
@@ -8438,21 +8511,30 @@ namespace System.Net.Sockets {
             }
             Contract.EndContractBlock();
 
+#if MONO
+            Initialize(null, buffer, offset, count, /*UnsafeNclNativeMethods.OSSOCK.TransmitPacketsElementFlags.Memory,*/
+                endOfPacket);
+#else
             Initialize(null, buffer, offset, count, UnsafeNclNativeMethods.OSSOCK.TransmitPacketsElementFlags.Memory, 
                 endOfPacket);
+#endif
         }
 
         private void Initialize(string filePath, byte[] buffer, int offset, int count, 
-            UnsafeNclNativeMethods.OSSOCK.TransmitPacketsElementFlags flags, bool endOfPacket) {
+            /*UnsafeNclNativeMethods.OSSOCK.TransmitPacketsElementFlags flags,*/ bool endOfPacket) {
 
             m_FilePath = filePath;
             m_Buffer = buffer;
             m_Offset = offset;
             m_Count = count;
+#if MONO
+            m_endOfPacket = endOfPacket;
+#else
             m_Flags = flags;
             if (endOfPacket) {
                 m_Flags |= UnsafeNclNativeMethods.OSSOCK.TransmitPacketsElementFlags.EndOfPacket;
             }
+#endif
         }
 
         // Filename property
@@ -8477,7 +8559,13 @@ namespace System.Net.Sockets {
 
         // EndOfPacket property
         public bool EndOfPacket {
-            get { return (m_Flags & UnsafeNclNativeMethods.OSSOCK.TransmitPacketsElementFlags.EndOfPacket) != 0; }
+            get {
+#if MONO
+                return m_endOfPacket;
+#else
+                return (m_Flags & UnsafeNclNativeMethods.OSSOCK.TransmitPacketsElementFlags.EndOfPacket) != 0;
+#endif
+             }
         }
     }
 
@@ -8492,6 +8580,7 @@ namespace System.Net.Sockets {
     }
     #endregion        
 
+#if !MONO
     public class SocketAsyncEventArgs : EventArgs, IDisposable {
 
         // Struct sizes needed for some custom marshalling.
@@ -10234,5 +10323,6 @@ namespace System.Net.Sockets {
         }
     }
 #endif // SOCKETTHREADPOOL
+#endif // !MONO
 
 }
index cf5ae7d3e836d489f3e1b0a4093530d14bbd6968..43a0479d2d401b20072382de536a106789e19737 100644 (file)
@@ -285,8 +285,13 @@ namespace System.Net.Sockets {
                 throw new ArgumentNullException("asyncResult");
             }
 
+#if MONO
+            var sar = asyncResult as SocketAsyncResult;
+            Socket asyncSocket = sar == null ? null : sar.socket;
+#else
             LazyAsyncResult lazyResult = asyncResult as LazyAsyncResult;
             Socket asyncSocket = lazyResult == null ? null : lazyResult.AsyncObject as Socket;
+#endif
             if (asyncSocket == null)
             {
                 throw new ArgumentException(SR.GetString(SR.net_io_invalidasyncresult), "asyncResult");
@@ -318,8 +323,13 @@ namespace System.Net.Sockets {
                 throw new ArgumentNullException("asyncResult");
             }
 
+#if MONO
+            var sar = asyncResult as SocketAsyncResult;
+            Socket asyncSocket = sar == null ? null : sar.socket;
+#else
             LazyAsyncResult lazyResult = asyncResult as LazyAsyncResult;
             Socket asyncSocket = lazyResult == null ? null : lazyResult.AsyncObject as Socket;
+#endif
             if (asyncSocket == null)
             {
                 throw new ArgumentException(SR.GetString(SR.net_io_invalidasyncresult), "asyncResult");
index 42743232cf72ab204be6f1ea18589b80d6eb29e1..49e6c040ee7e8e9ba4ea1fda118f3390c05e7d82 100644 (file)
@@ -247,7 +247,7 @@ namespace System.Net {
         private WebHeaderCollectionType m_Type;
 
 #if MONO
-        internal bool AllowMultiValues (string name)
+        internal static bool AllowMultiValues (string name)
         {
             var hinfo = HInfo[name];
             // Is common header which supports multi value or it's unknown header
index a9be75be0a64be172631a8208a3654087be8cb87..9f1444146c15c608265776922dd3d83da803f650 100644 (file)
@@ -1209,7 +1209,6 @@ namespace System.Net {
             }
         }
 
-#if !MONO
         //
         internal void SetupCacheProtocol(Uri uri)
         {
@@ -1224,6 +1223,7 @@ namespace System.Net {
             }
         }
 
+#if !MONO
         delegate void DelEtwFireBeginWRGet(object id, string uri, bool success, bool synchronous);
         delegate void DelEtwFireEndWRGet(object id, bool success, bool synchronous);
         delegate void DelEtwFireEndWRespGet(object id, bool success, bool synchronous, int statusCode);
index 2a315eaf42426b0beae95ed064b64a4e4168d184..501fc3493562b8bdc73c722de30153dc2038161e 100644 (file)
@@ -146,7 +146,9 @@ namespace System.Net {
             }
             public object OwningObject;
             public GeneralAsyncDelegate AsyncCallback;
+#if !MONO
             public bool Completed;
+#endif
             public ConnectionPool Pool;
             public int CreationTimeout;
         }
@@ -811,7 +813,9 @@ namespace System.Net {
     /// </devdoc>
     sealed internal class InterlockedStack {
         private readonly Stack _stack = new Stack();
+#if !MONO
         private int _count;
+#endif
 
 #if DEBUG
         private readonly Hashtable doublepush = new Hashtable();
@@ -832,7 +836,9 @@ namespace System.Net {
 #if DEBUG
                 GlobalLog.Assert(_count+1 == _stack.Count, "push count mishandle");
 #endif
+#if !MONO
                 _count = _stack.Count;
+#endif
             }
         }
 
@@ -845,7 +851,9 @@ namespace System.Net {
                     GlobalLog.Assert(_count-1 == _stack.Count, "pop count mishandle");
                     doublepush.Remove(pooledStream);
 #endif
+#if !MONO
                     _count = _stack.Count;
+#endif
                 }
                 return pooledStream;
             }
index fec514b0dbc2bbdd1316a3f5521eb7ce3b01649a..a97f9ae48b1d21ff3d3c2b138bcb76b004c2d4bd 100644 (file)
@@ -379,7 +379,9 @@ namespace System.Net {
             DateTime tempUsed;
 
             CookieCollection lruCc = null;
+#if !MONO
             string   lruDomain =  null;
+#endif
             string   tempDomain = null;
 
             PathList pathList;
@@ -415,7 +417,9 @@ namespace System.Net {
                             // we also find the least used cookie collection in ENTIRE container
                             // we count the collection as LRU only if it holds 1+ elements
                             if (cc.Count > 0 && (tempUsed = cc.TimeStamp(CookieCollection.Stamp.Check)) < oldUsed) {
+#if !MONO
                                 lruDomain = tempDomain;
+#endif
                                 lruCc = cc;
                                 oldUsed = tempUsed;
                             }
index 0db05f3620e2fc500dfb3c0db05801c66b6bf99c..db9d4cf6b280b082969542c428c3dbdffdc58587 100644 (file)
@@ -18,8 +18,10 @@ namespace System.Net {
 
         private static WaitCallback s_GetRequestStreamCallback = new WaitCallback(GetRequestStreamCallback);
         private static WaitCallback s_GetResponseCallback = new WaitCallback(GetResponseCallback);
+#if !MONO
         private static ContextCallback s_WrappedGetRequestStreamCallback = new ContextCallback(GetRequestStreamCallback);
         private static ContextCallback s_WrappedResponseCallback = new ContextCallback(GetResponseCallback);
+#endif
 
     // fields
 
@@ -214,7 +216,9 @@ namespace System.Net {
         public override IAsyncResult BeginGetRequestStream(AsyncCallback callback, object state)
         {
             GlobalLog.Enter("FileWebRequest::BeginGetRequestStream");
+#if !MONO
             bool success = true;
+#endif
             try {
                 if (Aborted)
                     throw ExceptionHelper.RequestAbortedException;
@@ -242,7 +246,9 @@ namespace System.Net {
                 m_ReadAResult = new LazyAsyncResult(this, state, callback);
                 ThreadPool.QueueUserWorkItem(s_GetRequestStreamCallback, m_ReadAResult);
             } catch (Exception exception) {
+#if !MONO
                 success = false; 
+#endif
                 if(Logging.On)Logging.Exception(Logging.Web, this, "BeginGetRequestStream", exception);
                 throw;
             } finally {
@@ -261,7 +267,9 @@ namespace System.Net {
         public override IAsyncResult BeginGetResponse(AsyncCallback callback, object state)
         {
             GlobalLog.Enter("FileWebRequest::BeginGetResponse");
+#if !MONO
             bool success = true;
+#endif
 
             try {
                 if (Aborted)
@@ -278,7 +286,9 @@ namespace System.Net {
                 m_WriteAResult = new LazyAsyncResult(this,state,callback);
                 ThreadPool.QueueUserWorkItem(s_GetResponseCallback,m_WriteAResult);
             } catch (Exception exception) {
+#if !MONO
                 success = false;
+#endif
                 if(Logging.On)Logging.Exception(Logging.Web, this, "BeginGetResponse", exception);
                 throw;
             } finally {
@@ -302,7 +312,9 @@ namespace System.Net {
             GlobalLog.Enter("FileWebRequest::EndGetRequestStream");
 
             Stream stream;
+#if !MONO
             bool success = false;
+#endif
             try {
                 LazyAsyncResult  ar = asyncResult as LazyAsyncResult;
                 if (asyncResult == null || ar == null) {
@@ -317,7 +329,9 @@ namespace System.Net {
                 }
                 stream = (Stream) result;
                 m_writePending = false;
+#if !MONO
                 success = true;
+#endif
             } catch (Exception exception) {
                 if(Logging.On)Logging.Exception(Logging.Web, this, "EndGetRequestStream", exception);
                 throw;
@@ -338,7 +352,9 @@ namespace System.Net {
             GlobalLog.Enter("FileWebRequest::EndGetResponse");
 
             WebResponse response;
+#if !MONO
             bool success = false;
+#endif
             try {
                 LazyAsyncResult  ar = asyncResult as LazyAsyncResult;
                 if (asyncResult == null || ar == null) {
@@ -354,7 +370,9 @@ namespace System.Net {
                 }
                 response = (WebResponse) result;
                 m_readPending = false;
+#if !MONO
                 success = true;
+#endif
             } catch (Exception exception) {
                 if(Logging.On)Logging.Exception(Logging.Web, this, "EndGetResponse", exception);
                 throw;
index 8fa1b7eea41403f232d32a996504bfe9d9531882..5ae0b4b7f8e32be831ab846e40b66e43067b3611 100644 (file)
@@ -30,7 +30,7 @@ namespace System.Net.Mime
 
         //used when the length of the header name itself is known (i.e. Subject : )
         internal static string EncodeHeaderValue(string value, Encoding encoding, bool base64Encoding, int headerLength) {
-            StringBuilder newString = new StringBuilder();
+//            StringBuilder newString = new StringBuilder();
             
             //no need to encode if it's pure ascii
             if (IsAscii(value, false)) {
index 80acb75ad34e7d3d5b2b24817a568c07b451b34f..9b21455fab7d4b5d905b6167de2b163b44537069 100644 (file)
@@ -1092,7 +1092,11 @@ namespace System.Net {
 
             internal long ContentLength;
             internal long Length;
+#if MONO
+            const int Offset = 0;
+#else
             internal int  Offset;
+#endif
 
 
             internal ProgressData Progress;
@@ -1365,8 +1369,10 @@ namespace System.Net {
                 WebClient = webClient;
             }
 
+#if !MONO
             internal long Length;
             internal int  Offset;
+#endif
 
             internal ProgressData Progress;
 
@@ -1800,12 +1806,19 @@ namespace System.Net {
         }
         private void OpenReadAsyncCallback(IAsyncResult result) {
 #if MONO
-            var lazyAsyncResult = (WebAsyncResult) result;
+            // It can be removed when we are full referencesource
+            AsyncOperation asyncOp = (AsyncOperation) result.AsyncState;
+            WebRequest request;
+            if (result is WebAsyncResult) {
+                request = (WebRequest) ((WebAsyncResult) result).AsyncObject;
+            } else {
+                request = (WebRequest) ((LazyAsyncResult) result).AsyncObject;
+            }
 #else
             LazyAsyncResult lazyAsyncResult = (LazyAsyncResult) result;
-#endif
             AsyncOperation asyncOp = (AsyncOperation) lazyAsyncResult.AsyncState;
             WebRequest request = (WebRequest) lazyAsyncResult.AsyncObject;
+#endif
             Stream stream = null;
             Exception exception = null;
             try {
index fe5858875faa8c20236f15eb604adbe491b20c26..15840cd7022b9729306b19eac0cf0382fbe0f29a 100644 (file)
@@ -504,7 +504,9 @@ namespace System.Net {
 #if MONO
         public static IWebProxy CreateDefaultProxy ()
         {
-#if MONOTOUCH
+#if FEATURE_NO_BSD_SOCKETS
+            throw new PlatformNotSupportedException ();
+#elif MONOTOUCH
             return Mono.Net.CFNetwork.GetDefaultProxy ();
 #elif MONODROID
             // Return the system web proxy.  This only works for ICS+.
index 8a69ca2fae89fc321d3019b5ab1a74177f28d8e7..a757b5244fb635e73f03d69133896c9f4306f88c 100644 (file)
@@ -2320,7 +2320,7 @@ namespace System {
             // plus it will set idx value for next steps
             if ((cF & Flags.ImplicitFile) != 0) {
                 idx = (ushort)0;
-                while (IsLWS(m_String[idx])) {
+                while (idx < info.Offset.End && IsLWS(m_String[idx])) {
                     ++idx;
                     ++info.Offset.Scheme;
                 }
index 9f55631246f21d5a8d9579df9422dc10efdc4183..1a587adf4e833b9fe51d569212471200a7005722 100644 (file)
@@ -443,6 +443,11 @@ namespace System {
         {
             Uri result;
 
+#if MONO
+            if (uriKind == UriKind.RelativeOrAbsolute)
+                uriKind = DotNetRelativeOrAbsolute;
+#endif
+
             if (!Uri.TryCreate(uriString, uriKind, out result))
                 return false;
 
index 7b9b1e1911554202ca41795357d004fc2f7dfe04..8d93ee8c2d0e56ccd2e5054bdf12f1ca0b8c67f8 100644 (file)
@@ -473,6 +473,7 @@ namespace System.Text.RegularExpressions {
         }
 
 #if NETSTANDARD
+        [CLSCompliant (false)]
         protected IDictionary Caps
         {
             get
@@ -500,6 +501,7 @@ namespace System.Text.RegularExpressions {
             }
         }
 
+        [CLSCompliant (false)]
         protected IDictionary CapNames
         {
             get
@@ -1398,7 +1400,7 @@ namespace System.Text.RegularExpressions {
             return newcached;
         }
 
-#if !(SILVERLIGHT||FULL_AOT_RUNTIME)
+#if !SILVERLIGHT
         /*
          * True if the O option was set
          */
@@ -1406,9 +1408,17 @@ namespace System.Text.RegularExpressions {
         /// <devdoc>
         /// </devdoc>
         protected bool UseOptionC() {
-               /* Mono: Set to false until we investigate  https://bugzilla.xamarin.com/show_bug.cgi?id=25671 */
-           return false;
+#if FULL_AOT_RUNTIME
+            return false;
+#else
+
+#if MONO
+            /* Mono: Set to false until we investigate  https://bugzilla.xamarin.com/show_bug.cgi?id=25671 */
+            return false;
+#else
             return(roptions & RegexOptions.Compiled) != 0;
+#endif
+#endif
         }
 #endif
 
index 6f191129671672f5a0d3c58901385525b798814c..6d603688023c9cc7d06bcf48021419eb519cb3c3 100644 (file)
@@ -3033,7 +3033,9 @@ namespace System.Text.RegularExpressions {
 
     internal class RegexTypeCompiler : RegexCompiler {
         private static int _typeCount = 0;
+#if !MONO
         private static LocalDataStoreSlot _moduleSlot = Thread.AllocateDataSlot();
+#endif
 
         private  AssemblyBuilder _assembly;
         private  ModuleBuilder  _module;
index 8cf2d64a9db72d7fbd5253643d7d9e9cb7a25b28..d9c27a4ffec108c1cefd334bc83cec6e89e708ec 100644 (file)
@@ -567,11 +567,11 @@ namespace System.Text.RegularExpressions {
                     // This is code for Posix style properties - [:Ll:] or [:IsTibetan:].
                     // It currently doesn't do anything other than skip the whole thing!
                     if (CharsRight() > 0 && RightChar() == ':' && !inRange) {
-                        String name;
+//                        String name;
                         int savePos = Textpos();
 
                         MoveRight();
-                        name = ScanCapname();
+/*                        name = */ ScanCapname();
                         if (CharsRight() < 2 || MoveRightGetChar() != ':' || MoveRightGetChar() != ']')
                             Textto(savePos);
                         // else lookup name (nyi)
index f5fabc69b61c62caeab800216bb48ca02982fb76..7be029f7e81e27c00a6f6cb479eab8e084d77c7f 100644 (file)
@@ -41,8 +41,10 @@ namespace System.Diagnostics {
         // a user's char[] directly, instead of our internal char[].
         private int _maxCharsPerBuffer;
 
+#pragma warning disable 414
         // Store a backpointer to the process class, to check for user callbacks
         private Process process;
+#pragma warning restore
 
         // Delegate to call user function.
         private UserCallBack userCallBack;
@@ -57,6 +59,11 @@ namespace System.Diagnostics {
         // Cache the last position scanned in sb when searching for lines.
         private int currentLinePos;
                
+#if MONO
+               //users to coordinate between Dispose and BeginReadLine
+               private object syncObject = new Object ();
+#endif
+
         internal AsyncStreamReader(Process process, Stream stream, UserCallBack callback, Encoding encoding) 
             : this(process, stream, callback, encoding, DefaultBufferSize) {
         }
@@ -104,6 +111,9 @@ namespace System.Diagnostics {
 
         protected virtual void Dispose(bool disposing)
         {
+#if MONO
+            lock (syncObject) {
+#endif
             if (disposing) {
                 if (stream != null)
                     stream.Close();
@@ -120,6 +130,9 @@ namespace System.Diagnostics {
                 eofEvent.Close();
                 eofEvent = null;
             }
+#if MONO
+            }
+#endif
         }
         
         public virtual Encoding CurrentEncoding {
@@ -155,6 +168,12 @@ namespace System.Diagnostics {
             int byteLen;
             
             try {
+#if MONO
+                var stream = this.stream;
+                if (stream == null)
+                byteLen = 0;
+                else
+#endif
                 byteLen = stream.EndRead(ar);
             }
             catch (IOException ) {
@@ -171,6 +190,9 @@ namespace System.Diagnostics {
                 byteLen = 0; // Treat this as EOF
             }
                 
+#if MONO
+retry_dispose:
+#endif
             if (byteLen == 0) { 
                 // We're at EOF, we won't call this function again from here on.
                 lock(messageQueue) {
@@ -186,13 +208,45 @@ namespace System.Diagnostics {
                     FlushMessageQueue();
                 }
                 finally {
+#if MONO
+                    lock (syncObject) {
+                        if (eofEvent != null) {
+                            try {
+                                eofEvent.Set ();
+                            } catch (System.ObjectDisposedException) {
+                                // This races with Dispose, it's safe to ignore the error as it comes from a SafeHandle doing its job
+                            }
+                        }
+                    }
+#else
                     eofEvent.Set();
+#endif
                 }
             } else {
+#if MONO
+                lock (syncObject) {
+                    if (decoder == null) { //we got disposed after the EndRead, retry as Diposed
+                        byteLen = 0;
+                        goto retry_dispose;
+                    }
+#endif
                 int charLen = decoder.GetChars(byteBuffer, 0, byteLen, charBuffer, 0);
                 sb.Append(charBuffer, 0, charLen);
+#if MONO
+                }
+#endif
                 GetLinesFromStringBuilder();
+#if MONO
+                lock (syncObject) {
+                    if (stream == null) { //we got disposed after the EndRead, retry as Diposed
+                        byteLen = 0;
+                        goto retry_dispose;
+                    }
+#endif
                 stream.BeginRead(byteBuffer, 0 , byteBuffer.Length,  new AsyncCallback(ReadBuffer), null);
+#if MONO
+                }
+#endif
             }
         }
         
index cbd2456ab966dcad784e6055e16ea4b2a7964721..7c5307fa15513fe46d8c285a36e66b61d73225d7 100644 (file)
@@ -66,16 +66,20 @@ namespace System.Diagnostics {
         ProcessModuleCollection modules;
 #endif // !FEATURE_PAL        
 
+#if !MONO
         bool haveMainWindow;
         IntPtr mainWindowHandle;  // no need to use SafeHandle for window        
         string mainWindowTitle;
+#endif
         
         bool haveWorkingSetLimits;
         IntPtr minWorkingSet;
         IntPtr maxWorkingSet;
-        
+
+#if !MONO
         bool haveProcessorAffinity;
         IntPtr processorAffinity;
+#endif
 
         bool havePriorityClass;
         ProcessPriorityClass priorityClass;
@@ -91,12 +95,14 @@ namespace System.Diagnostics {
                
         DateTime exitTime;
         bool haveExitTime;
-        
+
+#if !MONO
         bool responding;
         bool haveResponding;
         
         bool priorityBoostEnabled;
         bool havePriorityBoostEnabled;
+#endif
         
         bool raisedOnExited;
         RegisteredWaitHandle registeredWaitHandle;
@@ -108,7 +114,9 @@ namespace System.Diagnostics {
         OperatingSystem operatingSystem;
         bool disposed;
         
+#if !MONO
         static object s_CreateProcessLock = new object();
+#endif
         
         // This enum defines the operation mode for redirected process stream.
         // We don't support switching between synchronous mode and asynchronous mode.
@@ -122,6 +130,9 @@ namespace System.Diagnostics {
         StreamReadMode outputStreamReadMode;
         StreamReadMode errorStreamReadMode;
         
+#if MONO
+        StreamReadMode inputStreamReadMode;
+#endif
        
         // Support for asynchrously reading streams
         [Browsable(true), MonitoringDescription(SR.ProcessAssociated)]
@@ -136,8 +147,9 @@ namespace System.Diagnostics {
         internal bool pendingOutputRead;
         internal bool pendingErrorRead;
 
-
+#if !MONO
         private static SafeFileHandle InvalidPipeHandle = new SafeFileHandle(IntPtr.Zero, false);
+#endif
 #if DEBUG
         internal static TraceSwitch processTracing = new TraceSwitch("processTracing", "Controls debug output from Process component");
 #else
@@ -1183,6 +1195,9 @@ namespace System.Diagnostics {
                     throw new InvalidOperationException(SR.GetString(SR.CantGetStandardIn));
                 }
 
+#if MONO
+                inputStreamReadMode = StreamReadMode.syncMode;
+#endif
                 return standardInput;
             }
         }
@@ -1346,6 +1361,40 @@ namespace System.Diagnostics {
                 machineName = ".";
                 raisedOnExited = false;
 
+#if MONO
+                //Call close on streams if the user never saw them.
+                //A stream in the undefined mode was never fetched by the user.
+                //A stream in the async mode is wrapped on a AsyncStreamReader and we should dispose that instead.
+                //  no way for users to get a hand on a AsyncStreamReader.
+                var tmpIn = standardInput;
+                standardInput = null;
+                if (inputStreamReadMode == StreamReadMode.undefined && tmpIn != null)
+                    tmpIn.Close ();
+
+                var tmpOut = standardOutput;
+                standardOutput = null;
+                if (outputStreamReadMode == StreamReadMode.undefined && tmpOut != null)
+                    tmpOut.Close ();
+
+                tmpOut = standardError;
+                standardError = null;
+                if (errorStreamReadMode == StreamReadMode.undefined && tmpOut != null)
+                    tmpOut.Close ();
+
+                var tmpAsync = output;
+                output = null;
+                if (outputStreamReadMode == StreamReadMode.asyncMode && tmpAsync != null) {
+                    tmpAsync.CancelOperation ();
+                    tmpAsync.Close ();
+                }
+
+                tmpAsync = error;
+                error = null;
+                if (errorStreamReadMode == StreamReadMode.asyncMode && tmpAsync != null) {
+                    tmpAsync.CancelOperation ();
+                    tmpAsync.Close ();
+                }
+#else
                 //Don't call close on the Readers and writers
                 //since they might be referenced by somebody else while the 
                 //process is still alive but this method called.
@@ -1356,6 +1405,7 @@ namespace System.Diagnostics {
                 output = null;
                 error = null;
        
+#endif
 
                 Refresh();
             }
@@ -1568,6 +1618,7 @@ namespace System.Diagnostics {
             
             return new Process(machineName, ProcessManager.IsRemoteMachine(machineName), processId, null);
         }
+#endif
 
         /// <devdoc>
         ///    <para>
@@ -1633,6 +1684,7 @@ namespace System.Diagnostics {
             return GetProcesses(".");
         }
 
+#if !MONO
         /// <devdoc>
         ///    <para>
         ///       Creates a new <see cref='System.Diagnostics.Process'/>
@@ -1824,16 +1876,24 @@ namespace System.Diagnostics {
             threads = null;
             modules = null;
 #endif // !FEATURE_PAL            
+#if !MONO
             mainWindowTitle = null;
+#endif
             exited = false;
             signaled = false;
+#if !MONO
             haveMainWindow = false;
+#endif
             haveWorkingSetLimits = false;
+#if !MONO
             haveProcessorAffinity = false;
+#endif
             havePriorityClass = false;
             haveExitTime = false;
+#if !MONO
             haveResponding = false;
             havePriorityBoostEnabled = false;
+#endif
         }
 
         /// <devdoc>
index ef960754ba860b5776c94f68ad708ae04079cfed..85d996b827a588a47f18ea4782bcb9f4981d4419 100644 (file)
@@ -53,6 +53,270 @@ namespace System.Diagnostics {
         public void CopyTo(ProcessModule[] array, int index) {
             InnerList.CopyTo(array, index);
         }
+
+#if MOBILE
+        [Obsolete ("This API is no longer available", true)]
+        public int Capacity {
+            get {
+                throw new NotSupportedException ();
+            }
+            set {
+                throw new NotSupportedException ();
+            }
+        }
+
+        [Obsolete ("This API is no longer available", true)]
+        public void Add (ProcessModule item)
+        {
+            throw new NotSupportedException ();
+        }
+
+        [Obsolete ("This API is no longer available", true)]
+        public void AddRange (System.Collections.Generic.IEnumerable<ProcessModule> collection)
+        {
+            throw new NotSupportedException ();
+        }
+
+        [Obsolete ("This API is no longer available", true)]
+        public System.Collections.ObjectModel.ReadOnlyCollection<ProcessModule> AsReadOnly()
+        {
+            throw new NotSupportedException ();
+        }
+
+        [Obsolete ("This API is no longer available", true)]
+        public int BinarySearch(int index, int count, ProcessModule item, System.Collections.Generic.IComparer<ProcessModule> comparer)
+        {
+            throw new NotSupportedException ();
+        }
+
+        [Obsolete ("This API is no longer available", true)]
+        public int BinarySearch(ProcessModule item)
+        {
+            throw new NotSupportedException ();
+        }
+
+        [Obsolete ("This API is no longer available", true)]
+        public int BinarySearch(ProcessModule item, System.Collections.Generic.IComparer<ProcessModule> comparer)
+        {
+            throw new NotSupportedException ();
+        }
+
+        [Obsolete ("This API is no longer available", true)]
+        public void Clear()
+        {
+            throw new NotSupportedException ();
+        }
+
+        [Obsolete ("This API is no longer available", true)]
+        public System.Collections.Generic.List<TOutput> ConvertAll<TOutput>(Converter<ProcessModule,TOutput> converter)
+        {
+            throw new NotSupportedException ();
+        }
+
+        [Obsolete ("This API is no longer available", true)]
+        public void CopyTo(ProcessModule[] array)
+        {
+            throw new NotSupportedException ();
+        }
+
+        [Obsolete ("This API is no longer available", true)]
+        public void CopyTo(int index, ProcessModule[] array, int arrayIndex, int count)
+        {
+            throw new NotSupportedException ();
+        }
+
+        [Obsolete ("This API is no longer available", true)]
+        public bool Exists(Predicate<ProcessModule> match)
+        {
+            throw new NotSupportedException ();
+        }
+
+        [Obsolete ("This API is no longer available", true)]
+        public ProcessModule Find(Predicate<ProcessModule> match)
+        {
+            throw new NotSupportedException ();
+        }
+
+        [Obsolete ("This API is no longer available", true)]
+        public System.Collections.Generic.List<ProcessModule> FindAll(Predicate<ProcessModule> match)
+        {
+            throw new NotSupportedException ();
+        }
+
+        [Obsolete ("This API is no longer available", true)]
+        public int FindIndex(Predicate<ProcessModule> match)
+        {
+            throw new NotSupportedException ();
+        }
+
+        [Obsolete ("This API is no longer available", true)]
+        public int FindIndex(int startIndex, Predicate<ProcessModule> match)
+        {
+            throw new NotSupportedException ();
+        }
+
+        [Obsolete ("This API is no longer available", true)]
+        public int FindIndex(int startIndex, int count, Predicate<ProcessModule> match)
+        {
+            throw new NotSupportedException ();
+        }
+
+        [Obsolete ("This API is no longer available", true)]
+        public ProcessModule FindLast(Predicate<ProcessModule> match)
+        {
+            throw new NotSupportedException ();
+        }
+
+        [Obsolete ("This API is no longer available", true)]
+        public int FindLastIndex(Predicate<ProcessModule> match)
+        {
+            throw new NotSupportedException ();
+        }
+
+        [Obsolete ("This API is no longer available", true)]
+        public int FindLastIndex(int startIndex, Predicate<ProcessModule> match)
+        {
+            throw new NotSupportedException ();
+        }
+
+        [Obsolete ("This API is no longer available", true)]
+        public int FindLastIndex(int startIndex, int count, Predicate<ProcessModule> match)
+        {
+            throw new NotSupportedException ();
+        }
+
+        [Obsolete ("This API is no longer available", true)]
+        public void ForEach(Action<ProcessModule> action)
+        {
+            throw new NotSupportedException ();
+        }
+
+        [Obsolete ("This API is no longer available", true)]
+        public System.Collections.Generic.List<ProcessModule> GetRange(int index, int count)
+        {
+            throw new NotSupportedException ();
+        }
+
+        [Obsolete ("This API is no longer available", true)]
+        public int IndexOf(ProcessModule item, int index)
+        {
+            throw new NotSupportedException ();
+        }
+
+        [Obsolete ("This API is no longer available", true)]
+        public int IndexOf(ProcessModule item, int index, int count)
+        {
+            throw new NotSupportedException ();
+        }
+
+        [Obsolete ("This API is no longer available", true)]
+        public void Insert(int index, ProcessModule item)
+        {
+            throw new NotSupportedException ();
+        }
+
+        [Obsolete ("This API is no longer available", true)]
+        public void InsertRange(int index, System.Collections.Generic.IEnumerable<ProcessModule> collection)
+        {
+            throw new NotSupportedException ();
+        }
+
+        [Obsolete ("This API is no longer available", true)]
+        public int LastIndexOf(ProcessModule item)
+        {
+            throw new NotSupportedException ();
+        }
+
+        [Obsolete ("This API is no longer available", true)]
+        public int LastIndexOf(ProcessModule item, int index)
+        {
+            throw new NotSupportedException ();
+        }
+
+        [Obsolete ("This API is no longer available", true)]
+        public int LastIndexOf(ProcessModule item, int index, int count)
+        {
+            throw new NotSupportedException ();
+        }
+
+        [Obsolete ("This API is no longer available", true)]
+        public bool Remove(ProcessModule item)
+        {
+            throw new NotSupportedException ();
+        }
+
+        [Obsolete ("This API is no longer available", true)]
+        public int RemoveAll(Predicate<ProcessModule> match)
+        {
+            throw new NotSupportedException ();
+        }
+
+        [Obsolete ("This API is no longer available", true)]
+        public void RemoveAt(int index)
+        {
+            throw new NotSupportedException ();
+        }
+
+        [Obsolete ("This API is no longer available", true)]
+        public void RemoveRange(int index, int count)
+        {
+            throw new NotSupportedException ();
+        }
+
+        [Obsolete ("This API is no longer available", true)]
+        public void Reverse()
+        {
+            throw new NotSupportedException ();
+        }
+
+        [Obsolete ("This API is no longer available", true)]
+        public void Reverse(int index, int count)
+        {
+            throw new NotSupportedException ();
+        }
+
+        [Obsolete ("This API is no longer available", true)]
+        public void Sort()
+        {
+            throw new NotSupportedException ();
+        }
+
+        [Obsolete ("This API is no longer available", true)]
+        public void Sort(System.Collections.Generic.IComparer<ProcessModule> comparer)
+        {
+            throw new NotSupportedException ();
+        }
+
+        [Obsolete ("This API is no longer available", true)]
+        public void Sort(int index, int count, System.Collections.Generic.IComparer<ProcessModule> comparer)
+        {
+            throw new NotSupportedException ();
+        }
+
+        [Obsolete ("This API is no longer available", true)]
+        public void Sort(Comparison<ProcessModule> comparison)
+        {
+            throw new NotSupportedException ();
+        }
+
+        [Obsolete ("This API is no longer available", true)]
+        public ProcessModule[] ToArray()
+        {
+            throw new NotSupportedException ();
+        }
+
+        [Obsolete ("This API is no longer available", true)]
+        public void TrimExcess()
+        {
+            throw new NotSupportedException ();
+        }
+
+        [Obsolete ("This API is no longer available", true)]
+        public bool TrueForAll(Predicate<ProcessModule> match)
+        {
+            throw new NotSupportedException ();
+        }
+#endif
     }
 }
 
index 127c1d4319a7ea32bd83a47eb3d1d3ac0f3e45ea..94fa2f43bbd193043baafbb83bffb528e9ca27ba 100644 (file)
@@ -77,6 +77,252 @@ namespace System.Diagnostics {
         public void CopyTo(ProcessThread[] array, int index) {
             InnerList.CopyTo(array, index);
         }
+
+#if MOBILE
+        [Obsolete ("This API is no longer available", true)]
+        public int Capacity {
+            get {
+                throw new NotSupportedException ();
+            }
+            set {
+                throw new NotSupportedException ();
+            }
+        }
+
+        [Obsolete ("This API is no longer available", true)]
+        public void AddRange (System.Collections.Generic.IEnumerable<ProcessThread> collection)
+        {
+            throw new NotSupportedException ();
+        }
+
+        [Obsolete ("This API is no longer available", true)]
+        public System.Collections.ObjectModel.ReadOnlyCollection<ProcessThread> AsReadOnly()
+        {
+            throw new NotSupportedException ();
+        }
+
+        [Obsolete ("This API is no longer available", true)]
+        public int BinarySearch(int index, int count, ProcessThread item, System.Collections.Generic.IComparer<ProcessThread> comparer)
+        {
+            throw new NotSupportedException ();
+        }
+
+        [Obsolete ("This API is no longer available", true)]
+        public int BinarySearch(ProcessThread item)
+        {
+            throw new NotSupportedException ();
+        }
+
+        [Obsolete ("This API is no longer available", true)]
+        public int BinarySearch(ProcessThread item, System.Collections.Generic.IComparer<ProcessThread> comparer)
+        {
+            throw new NotSupportedException ();
+        }
+
+        [Obsolete ("This API is no longer available", true)]
+        public void Clear()
+        {
+            throw new NotSupportedException ();
+        }
+
+        [Obsolete ("This API is no longer available", true)]
+        public System.Collections.Generic.List<TOutput> ConvertAll<TOutput>(Converter<ProcessThread,TOutput> converter)
+        {
+            throw new NotSupportedException ();
+        }
+
+        [Obsolete ("This API is no longer available", true)]
+        public void CopyTo(ProcessThread[] array)
+        {
+            throw new NotSupportedException ();
+        }
+
+        [Obsolete ("This API is no longer available", true)]
+        public void CopyTo(int index, ProcessThread[] array, int arrayIndex, int count)
+        {
+            throw new NotSupportedException ();
+        }
+
+        [Obsolete ("This API is no longer available", true)]
+        public bool Exists(Predicate<ProcessThread> match)
+        {
+            throw new NotSupportedException ();
+        }
+
+        [Obsolete ("This API is no longer available", true)]
+        public ProcessThread Find(Predicate<ProcessThread> match)
+        {
+            throw new NotSupportedException ();
+        }
+
+        [Obsolete ("This API is no longer available", true)]
+        public System.Collections.Generic.List<ProcessThread> FindAll(Predicate<ProcessThread> match)
+        {
+            throw new NotSupportedException ();
+        }
+
+        [Obsolete ("This API is no longer available", true)]
+        public int FindIndex(Predicate<ProcessThread> match)
+        {
+            throw new NotSupportedException ();
+        }
+
+        [Obsolete ("This API is no longer available", true)]
+        public int FindIndex(int startIndex, Predicate<ProcessThread> match)
+        {
+            throw new NotSupportedException ();
+        }
+
+        [Obsolete ("This API is no longer available", true)]
+        public int FindIndex(int startIndex, int count, Predicate<ProcessThread> match)
+        {
+            throw new NotSupportedException ();
+        }
+
+        [Obsolete ("This API is no longer available", true)]
+        public ProcessThread FindLast(Predicate<ProcessThread> match)
+        {
+            throw new NotSupportedException ();
+        }
+
+        [Obsolete ("This API is no longer available", true)]
+        public int FindLastIndex(Predicate<ProcessThread> match)
+        {
+            throw new NotSupportedException ();
+        }
+
+        [Obsolete ("This API is no longer available", true)]
+        public int FindLastIndex(int startIndex, Predicate<ProcessThread> match)
+        {
+            throw new NotSupportedException ();
+        }
+
+        [Obsolete ("This API is no longer available", true)]
+        public int FindLastIndex(int startIndex, int count, Predicate<ProcessThread> match)
+        {
+            throw new NotSupportedException ();
+        }
+
+        [Obsolete ("This API is no longer available", true)]
+        public void ForEach(Action<ProcessThread> action)
+        {
+            throw new NotSupportedException ();
+        }
+
+        [Obsolete ("This API is no longer available", true)]
+        public System.Collections.Generic.List<ProcessThread> GetRange(int index, int count)
+        {
+            throw new NotSupportedException ();
+        }
+
+        [Obsolete ("This API is no longer available", true)]
+        public int IndexOf(ProcessThread item, int index)
+        {
+            throw new NotSupportedException ();
+        }
+
+        [Obsolete ("This API is no longer available", true)]
+        public int IndexOf(ProcessThread item, int index, int count)
+        {
+            throw new NotSupportedException ();
+        }
+
+        [Obsolete ("This API is no longer available", true)]
+        public void InsertRange(int index, System.Collections.Generic.IEnumerable<ProcessThread> collection)
+        {
+            throw new NotSupportedException ();
+        }
+
+        [Obsolete ("This API is no longer available", true)]
+        public int LastIndexOf(ProcessThread item)
+        {
+            throw new NotSupportedException ();
+        }
+
+        [Obsolete ("This API is no longer available", true)]
+        public int LastIndexOf(ProcessThread item, int index)
+        {
+            throw new NotSupportedException ();
+        }
+
+        [Obsolete ("This API is no longer available", true)]
+        public int LastIndexOf(ProcessThread item, int index, int count)
+        {
+            throw new NotSupportedException ();
+        }
+
+        [Obsolete ("This API is no longer available", true)]
+        public int RemoveAll(Predicate<ProcessThread> match)
+        {
+            throw new NotSupportedException ();
+        }
+
+        [Obsolete ("This API is no longer available", true)]
+        public void RemoveAt(int index)
+        {
+            throw new NotSupportedException ();
+        }
+
+        [Obsolete ("This API is no longer available", true)]
+        public void RemoveRange(int index, int count)
+        {
+            throw new NotSupportedException ();
+        }
+
+        [Obsolete ("This API is no longer available", true)]
+        public void Reverse()
+        {
+            throw new NotSupportedException ();
+        }
+
+        [Obsolete ("This API is no longer available", true)]
+        public void Reverse(int index, int count)
+        {
+            throw new NotSupportedException ();
+        }
+
+        [Obsolete ("This API is no longer available", true)]
+        public void Sort()
+        {
+            throw new NotSupportedException ();
+        }
+
+        [Obsolete ("This API is no longer available", true)]
+        public void Sort(System.Collections.Generic.IComparer<ProcessThread> comparer)
+        {
+            throw new NotSupportedException ();
+        }
+
+        [Obsolete ("This API is no longer available", true)]
+        public void Sort(int index, int count, System.Collections.Generic.IComparer<ProcessThread> comparer)
+        {
+            throw new NotSupportedException ();
+        }
+
+        [Obsolete ("This API is no longer available", true)]
+        public void Sort(Comparison<ProcessThread> comparison)
+        {
+            throw new NotSupportedException ();
+        }
+
+        [Obsolete ("This API is no longer available", true)]
+        public ProcessThread[] ToArray()
+        {
+            throw new NotSupportedException ();
+        }
+
+        [Obsolete ("This API is no longer available", true)]
+        public void TrimExcess()
+        {
+            throw new NotSupportedException ();
+        }
+
+        [Obsolete ("This API is no longer available", true)]
+        public bool TrueForAll(Predicate<ProcessThread> match)
+        {
+            throw new NotSupportedException ();
+        }
+#endif
         
     }
 }
index 973773d29467b190eb5bc811cf07ab5f8f843ee4..5a68cc4744f5d95dba788357ea89a9043a963fab 100644 (file)
@@ -78,6 +78,7 @@ namespace System.IO.Ports
         }
 #endif
 
+#if !MONO
 #if FEATURE_NETCORE
         [SecuritySafeCritical]
 #endif
@@ -95,6 +96,7 @@ namespace System.IO.Ports
             int errorCode = Marshal.GetLastWin32Error();
             WinIOError(errorCode, str);
         }
+#endif
         
         // After calling GetLastWin32Error(), it clears the last error field,
         // so you must save the HResult and pass it to this method.  This method
index 360a55fa534abd5beff1d34fff8ac7d2a233e1c9..2ec06ebb237033e4279c08170534ccad8381eac1 100644 (file)
@@ -87,7 +87,11 @@ namespace System.Threading
                 if(null != name && 0 != name.Length && NativeMethods.ERROR_INVALID_HANDLE == errorCode)
                     throw new WaitHandleCannotBeOpenedException(SR.GetString(SR.WaitHandleCannotBeOpenedException_InvalidHandle,name));
                
+#if MONO
+                InternalResources.WinIOError(errorCode, "");
+#else
                 InternalResources.WinIOError();
+#endif
             }
             this.SafeWaitHandle = myHandle;
         }
@@ -161,7 +165,12 @@ namespace System.Threading
             {
                 if(null != name && 0 != name.Length && NativeMethods.ERROR_INVALID_HANDLE == errorCode)
                     throw new WaitHandleCannotBeOpenedException(SR.GetString(SR.WaitHandleCannotBeOpenedException_InvalidHandle,name));
+
+#if MONO
+                InternalResources.WinIOError(errorCode, "");
+#else
                 InternalResources.WinIOError();
+#endif
             }
             createdNew = errorCode != NativeMethods.ERROR_ALREADY_EXISTS;
             this.SafeWaitHandle = myHandle;
@@ -242,6 +251,9 @@ namespace System.Threading
 #endif
 
         // This exists in WaitHandle, but is oddly ifdefed for some reason...
+#if MONO
+        new
+#endif
         private enum OpenExistingResult
         {
             Success,
@@ -310,7 +322,11 @@ namespace System.Threading
                 if (null != name && 0 != name.Length && NativeMethods.ERROR_INVALID_HANDLE == errorCode)
                     return OpenExistingResult.NameInvalid;
                 //this is for passed through NativeMethods Errors
+#if MONO
+                InternalResources.WinIOError(errorCode, "");
+#else
                 InternalResources.WinIOError();
+#endif
             }
             result = new Semaphore(myHandle);
             return OpenExistingResult.Success;
@@ -349,7 +365,7 @@ namespace System.Threading
             //Non-Zero return 
 
 #if MONO
-            if (!ReleaseSemaphore_internal(Handle, releaseCount, out previousCount))
+            if (!ReleaseSemaphore_internal(SafeWaitHandle.DangerousGetHandle(), releaseCount, out previousCount))
 #else
             if (!SafeNativeMethods.ReleaseSemaphore(SafeWaitHandle, releaseCount, out previousCount))
 #endif
index 2a0102e8c57e11c654e1996120fd29cb04c76fdb..37f19b3aa8e1d599f442232477d4cc73f86437be 100644 (file)
@@ -26,7 +26,9 @@ namespace System.Windows.Markup
     /// attached property.
     /// </summary>
     [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Property | AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
+#if !MOBILE
     [TypeForwardedFrom("WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")]
+#endif
     public sealed class ValueSerializerAttribute : Attribute
     {
         /// <summary>
index 1f90f34978a6b874579766d3f57d652cd191885e..6050d716ac1b6f0d5d7ae341bd679b88dd2fce82 100644 (file)
@@ -27,11 +27,12 @@ namespace System {
         , IComparable<Boolean>,  IEquatable<Boolean>
 #endif
     {
-    
+#pragma warning disable 649    
       //
       // Member Variables
       //
       private bool m_value;
+#pragma warning disable
 
       // The true value. 
       // 
index a5bb9e9c06df9057b61c7715ceade349c4481be1..c1a043d04b09ab8f2bd994096ab494bd266ef807 100644 (file)
@@ -910,7 +910,9 @@ namespace System.Collections.Generic {
             Contract.EndContractBlock();
     
             if (count > 0) {
+#if !MONO                
                 int i = _size;
+#endif
                 _size -= count;
                 if (index < _size) {
                     Array.Copy(_items, index + count, _items, index, _size - index);
index b0290241aa4f877917c8b3bb88c20e8ec9aaba3f..f7298b8d117d32e6ffc08d38a4682c28d71efcd4 100644 (file)
@@ -20,7 +20,7 @@ namespace System {
     using System.Security.Permissions;
     [Serializable]
     [System.Runtime.InteropServices.ComVisible(true)]
-#if FEATURE_REMOTING
+#if FEATURE_REMOTING || MONO
     public abstract class ContextBoundObject : MarshalByRefObject {
 #else // FEATURE_REMOTING
     public abstract class ContextBoundObject {
index ce8bafab2deef044445d927a8898f6424e28abe6..4767195da3cf472f95631b2e33ccce96be7ddf11 100644 (file)
@@ -2445,9 +2445,8 @@ namespace System {
             Byte[] decodedBytes = new Byte[resultLength];
 
             // Convert Base64 chars into bytes:
-            Int32 actualResultLength;
             fixed (Byte* decodedBytesPtr = decodedBytes)
-                actualResultLength = FromBase64_Decode(inputPtr, inputLength, decodedBytesPtr, resultLength);
+                FromBase64_Decode(inputPtr, inputLength, decodedBytesPtr, resultLength);
 
             // Note that actualResultLength can differ from resultLength if the caller is modifying the array
             // as it is being converted. Silently ignore the failure.
index a4d5858e9ecddca1d47d729104352d351ceff953..dcc15f55ededabd0d03d75d548d3c77511076a8f 100644 (file)
@@ -65,6 +65,28 @@ namespace System {
 
     public static class GC 
     {
+#if MONO
+        [MethodImplAttribute (MethodImplOptions.InternalCall)]
+        extern static int GetCollectionCount (int generation);
+
+        [MethodImplAttribute (MethodImplOptions.InternalCall)]
+        extern static int GetMaxGeneration ();
+
+        [MethodImplAttribute (MethodImplOptions.InternalCall)]
+        extern static void InternalCollect (int generation);
+
+        [MethodImplAttribute (MethodImplOptions.InternalCall)]
+        extern static void RecordPressure (long bytesAllocated);
+
+        // TODO: Move following to ConditionalWeakTable
+        [MethodImplAttribute (MethodImplOptions.InternalCall)]
+        internal extern static void register_ephemeron_array (Ephemeron[] array);
+
+        [MethodImplAttribute (MethodImplOptions.InternalCall)]
+        extern static object get_ephemeron_tombstone ();
+
+        internal static readonly object EPHEMERON_TOMBSTONE = get_ephemeron_tombstone ();
+#else
         [System.Security.SecurityCritical]  // auto-generated
         [ResourceExposure(ResourceScope.None)]
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
@@ -139,6 +161,7 @@ namespace System {
         [ResourceExposure(ResourceScope.None)]
         [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode), SuppressUnmanagedCodeSecurity]
         private static extern void _RemoveMemoryPressure(UInt64 bytesAllocated);
+#endif
         
         [System.Security.SecurityCritical]  // auto-generated_required
         public static void AddMemoryPressure (long bytesAllocated) {
@@ -153,7 +176,11 @@ namespace System {
             }
             Contract.EndContractBlock();
 
+#if MONO
+            RecordPressure (bytesAllocated);
+#else
             _AddMemoryPressure((ulong)bytesAllocated);
+#endif
         }
 
         [System.Security.SecurityCritical]  // auto-generated_required
@@ -169,7 +196,11 @@ namespace System {
             }
             Contract.EndContractBlock();
 
+#if MONO
+            RecordPressure (-bytesAllocated);
+#else
             _RemoveMemoryPressure((ulong) bytesAllocated);
+#endif
         }
 
 
@@ -198,8 +229,12 @@ namespace System {
         //
         [System.Security.SecuritySafeCritical]  // auto-generated
         public static void Collect() {
+#if MONO
+            InternalCollect (MaxGeneration);
+#else
             //-1 says to GC all generations.
             _Collect(-1, (int)InternalGCCollectionMode.Blocking);
+#endif
         }
 
         [System.Security.SecuritySafeCritical]  // auto-generated
@@ -248,7 +283,11 @@ namespace System {
                 iInternalModes |= (int)InternalGCCollectionMode.NonBlocking;
             }
 
+#if MONO
+            InternalCollect (generation);
+#else
             _Collect(generation, iInternalModes);
+#endif
         }
 
         [System.Security.SecuritySafeCritical]  // auto-generated
@@ -260,9 +299,15 @@ namespace System {
                 throw new ArgumentOutOfRangeException("generation", Environment.GetResourceString("ArgumentOutOfRange_GenericPositive"));
             }
             Contract.EndContractBlock();
+
+#if MONO
+            return GetCollectionCount(generation);
+#else
             return _CollectionCount(generation, 0);
+#endif
         }
 
+#if !MONO
         // pass in true to get the BGC or FGC count.
         [System.Security.SecuritySafeCritical]  // auto-generated
         [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
@@ -275,6 +320,7 @@ namespace System {
             Contract.EndContractBlock();
             return _CollectionCount(generation, (getSpecialGCCount ? 1 : 0));
         }
+#endif
         
         // This method DOES NOT DO ANYTHING in and of itself.  It's used to 
         // prevent a finalizable object from losing any outstanding references 
@@ -318,9 +364,16 @@ namespace System {
         //
         [System.Security.SecuritySafeCritical]  // auto-generated
         public static int GetGeneration(WeakReference wo) {
+#if MONO
+            object obj = wo.Target;
+            if (obj == null)
+                throw new ArgumentException ();
+            return GetGeneration (obj);
+#else
             int result = GetGenerationWR(wo.m_handle);
             KeepAlive(wo);
             return result;
+#endif
         }
     
         // Returns the maximum GC generation.  Currently assumes only 1 heap.
@@ -330,17 +383,23 @@ namespace System {
             get { return GetMaxGeneration(); }
         }
 
+#if MONO
+        [MethodImplAttribute (MethodImplOptions.InternalCall)]
+        public extern static void WaitForPendingFinalizers ();
+#else
         [System.Security.SecurityCritical]  // auto-generated
         [ResourceExposure(ResourceScope.None)]
         [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)]
         [SuppressUnmanagedCodeSecurity]
         private static extern void _WaitForPendingFinalizers();
 
+
         [System.Security.SecuritySafeCritical]  // auto-generated
         public static void WaitForPendingFinalizers() {
             // QCalls can not be exposed from mscorlib directly, need to wrap it.
             _WaitForPendingFinalizers();
         }
+#endif
     
         // Indicates that the system should not call the Finalize() method on
         // an object that would normally require this call.
@@ -380,6 +439,31 @@ namespace System {
         // the GC heap.  This does not return the total size of the GC heap, but
         // only the live objects in the GC heap.
         //
+#if MONO
+        [MethodImplAttribute (MethodImplOptions.InternalCall)]
+        public extern static long GetTotalMemory (bool forceFullCollection);
+
+        static bool _RegisterForFullGCNotification(int maxGenerationPercentage, int largeObjectHeapPercentage)
+        {
+            throw new NotImplementedException ();
+        }
+
+        static bool _CancelFullGCNotification ()
+        {
+            throw new NotImplementedException ();
+        }
+
+        static int _WaitForFullGCApproach (int millisecondsTimeout)
+        {
+            throw new NotImplementedException ();
+        }
+
+        static int _WaitForFullGCComplete (int millisecondsTimeout)
+        {
+            throw new NotImplementedException ();
+        }
+
+#else 
         [System.Security.SecuritySafeCritical]  // auto-generated
         public static long GetTotalMemory(bool forceFullCollection) {
             long size = GetTotalMemory();
@@ -416,6 +500,7 @@ namespace System {
 
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
         private static extern int _WaitForFullGCComplete(int millisecondsTimeout);
+#endif
 
         [SecurityCritical]
         public static void RegisterForFullGCNotification(int maxGenerationThreshold, int largeObjectHeapThreshold)
@@ -503,6 +588,9 @@ namespace System {
         [SecurityCritical]
         static bool StartNoGCRegionWorker(long totalSize, bool hasLohSize, long lohSize, bool disallowFullBlockingGC)
         {
+#if MONO
+            throw new NotImplementedException ();
+#else
             StartNoGCRegionStatus status = (StartNoGCRegionStatus)_StartNoGCRegion(totalSize, hasLohSize, lohSize, disallowFullBlockingGC);
             if (status == StartNoGCRegionStatus.AmountTooLarge)
                 throw new ArgumentOutOfRangeException("totalSize", 
@@ -512,6 +600,7 @@ namespace System {
             else if (status == StartNoGCRegionStatus.NotEnoughMemory)
                 return false;
             return true;
+#endif
         }
 
         [SecurityCritical]
@@ -541,6 +630,9 @@ namespace System {
         [SecurityCritical]
         static EndNoGCRegionStatus EndNoGCRegionWorker()
         {
+#if MONO
+            throw new NotImplementedException ();
+#else
             EndNoGCRegionStatus status = (EndNoGCRegionStatus)_EndNoGCRegion();
             if (status == EndNoGCRegionStatus.NotInProgress)
                 throw new InvalidOperationException("NoGCRegion mode must be set");
@@ -550,6 +642,7 @@ namespace System {
                 throw new InvalidOperationException("Allocated memory exceeds specified memory for NoGCRegion mode");
 
             return EndNoGCRegionStatus.Succeeded;
+#endif
         }
 
         [SecurityCritical]
index c8e2ce17d893a329aa26dfa2e106735ede65d767..77d17717ffdf52f9a1d9ce97e34fad32b141b0ff 100644 (file)
@@ -46,7 +46,9 @@ namespace System.Globalization {
         internal const int UNICODE_CATEGORY_OFFSET = 0;
         internal const int BIDI_CATEGORY_OFFSET = 1;
 
+#pragma warning disable 414
         static bool s_initialized = InitTable();
+#pragma warning restore
 
         // The native pointer to the 12:4:4 index table of the Unicode cateogry data.
         [SecurityCritical]
index 29c4cd43def3f451254fadfe32bc9b4d7cbb1dc4..4bfcfea188124d36797966b59cecc4d6dfd0a893 100644 (file)
@@ -103,11 +103,13 @@ namespace System.Globalization {
         [NonSerialized] 
         private String m_sortName; // The name that defines our behavior
 
+#if !MONO
         [NonSerialized]
         private IntPtr m_dataHandle;
 
         [NonSerialized]
         private IntPtr m_handleOrigin;
+#endif
 
         ////////////////////////////////////////////////////////////////////////
         //
@@ -258,8 +260,10 @@ namespace System.Globalization {
         // the following fields are defined to keep the compatibility with Whidbey.
         // don't change/remove the names/types of these fields.
 #if FEATURE_USE_LCID || MONO
+#pragma warning disable 169
                 [OptionalField(VersionAdded = 1)]
                 private int win32LCID;             // mapped sort culture id of this instance
+#pragma warning restore
                 private int culture;               // the culture ID used to create this instance.
 #endif
         [OnDeserializing]
@@ -1143,12 +1147,17 @@ namespace System.Globalization {
             {
                 throw new ArgumentException(Environment.GetResourceString("Argument_InvalidFlag"), "options");
             }
+
+#if !MONO            
             byte[] keyData = null;
+#endif
             // The OS doesn't have quite the same behavior so we have to test for empty inputs
             if (String.IsNullOrEmpty(source))
             {
+#if !MONO                
                 // Empty strings get an empty sort key
                 keyData = EmptyArray<Byte>.Value;
+#endif
                 // Fake value to test though so we can verify our flags
                 source = "\x0000";
             }
@@ -1348,8 +1357,9 @@ namespace System.Globalization {
         {
             return NativeInternalInitSortHandle(localeName, out handleOrigin);
         }
+#endif
 
-#if !FEATURE_CORECLR
+#if !FEATURE_CORECLR || MONO
         private const int SORT_VERSION_WHIDBEY = 0x00001000;
         private const int SORT_VERSION_V4 = 0x00060101;
 
@@ -1366,7 +1376,11 @@ namespace System.Globalization {
             [System.Security.SecuritySafeCritical]
             get
             {
+#if MONO
+                return SORT_VERSION_V4;
+#else
                 return InternalGetSortVersion();
+#endif
             }
         }
 
@@ -1380,16 +1394,21 @@ namespace System.Globalization {
             {
                 if(m_SortVersion == null) 
                 {
+#if MONO
+                    m_SortVersion = new SortVersion(SORT_VERSION_V4, new Guid("00000001-57ee-1e5c-00b4-d0000bb1e11e")); // Guid returned by corefx and .NET 4.6
+#else
                     Win32Native.NlsVersionInfoEx v = new Win32Native.NlsVersionInfoEx();
                     v.dwNLSVersionInfoSize = Marshal.SizeOf(typeof(Win32Native.NlsVersionInfoEx));
                     InternalGetNlsVersionEx(m_dataHandle, m_handleOrigin, m_sortName, ref v);
                     m_SortVersion = new SortVersion(v.dwNLSVersion, (v.dwEffectiveId != 0) ? v.dwEffectiveId : LCID, v.guidCustomVersion);
+#endif
                 }
 
                 return m_SortVersion;
             }
         }
-        
+
+#if !MONO
         [System.Security.SecurityCritical]
         [ResourceExposure(ResourceScope.None)]
         [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)]
@@ -1403,7 +1422,6 @@ namespace System.Globalization {
         [SuppressUnmanagedCodeSecurity]
         private static extern uint InternalGetSortVersion();
 
-#endif
         [System.Security.SecurityCritical]
         [ResourceExposure(ResourceScope.None)]
         [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)]
@@ -1447,6 +1465,8 @@ namespace System.Globalization {
         [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)]
         [SuppressUnmanagedCodeSecurity]
         private static extern int InternalGetSortKey(IntPtr handle, IntPtr handleOrigin, String localeName, int flags, String source, int sourceCount, byte[] target, int targetCount);
+#endif
+
 #endif
     }
 }
index cc6bc05d4d040352118265e0dea3270c9253a790..7c03df01a4c5f9072065355c954d3e1ae956b871 100644 (file)
@@ -398,6 +398,7 @@ namespace System.Globalization {
         [OptionalField(VersionAdded = 1)]
         private bool   m_useUserOverride;
 #if !FEATURE_CORECLR
+#pragma warning disable 169
         [OptionalField(VersionAdded = 1)]
         private bool bUseCalendarInfo;
         [OptionalField(VersionAdded = 1)]
@@ -406,6 +407,7 @@ namespace System.Globalization {
         internal bool m_isDefaultCalendar;                // NEVER USED, DO NOT USE THIS! (Serialized in Whidbey)
         [OptionalField(VersionAdded = 2)]
         private static volatile Hashtable s_calendarNativeNames;   // NEVER USED, DO NOT USE THIS! (Serialized in Whidbey)
+#pragma warning restore
 #endif // !FEATURE_CORECLR
 
         // This was synthesized by Whidbey so we knew what words might appear in the middle of a date string
@@ -1515,10 +1517,11 @@ namespace System.Globalization {
                 ClearTokenHashTable();
             }
         }
-
+#if !MONO
         // Whitespaces that we allow in the month names.
         // U+00a0 is non-breaking space.
         static char[] MonthSpaces = {' ', '\u00a0'};
+#endif
 
         internal bool HasSpacesInMonthNames {
             get {
index da422367d637dc6a26c15d3e0a8941355ac41088..991ac5117029a5071717bee473bbd049bed9c4e9 100644 (file)
@@ -4001,8 +4001,10 @@ new DS[] { DS.ERROR, DS.TX_NNN,  DS.TX_NNN,  DS.TX_NNN,  DS.ERROR,   DS.ERROR,
             parseInfo.fAllowInnerWhite = ((styles & DateTimeStyles.AllowInnerWhite) != 0);
             parseInfo.fAllowTrailingWhite = ((styles & DateTimeStyles.AllowTrailingWhite) != 0);
 
+#if !MONO
             // We need the original values of the following two below.
             String originalFormat = formatParam;
+#endif
 
             if (formatParam.Length == 1) {
                 if (((result.flags & ParseFlags.CaptureOffset) != 0) && formatParam[0] == 'U') {
index 911106e2022ccdab471cef916f02829a62370063..de0dc9b78b8374eae639732a62e331c55558e586 100644 (file)
@@ -164,10 +164,13 @@ namespace System.Globalization {
         [System.Security.SecuritySafeCritical]  // auto-generated
         private static EraInfo[] GetErasFromRegistry()
         {
+#if MONO
+            return null;
+#else
             // Look in the registry key and see if we can find any ranges
             int iFoundEras = 0;
             EraInfo[] registryEraRanges = null;
-#if !MONO            
+           
             try
             {
                 // Need to access registry
@@ -249,9 +252,10 @@ namespace System.Globalization {
                     registryEraRanges[i].maxEraYear = registryEraRanges[i-1].yearOffset + 1 - registryEraRanges[i].yearOffset;
                 }
             }
-#endif
+
             // Return our ranges
             return registryEraRanges;
+#endif            
         }
 
         //
index 577047c3f87ca0565f40c270fad581880d565eb9..b9069bba54a5b6f507238c76ba76b445d72da845 100644 (file)
@@ -30,7 +30,9 @@ namespace System.Globalization {
             m_NlsVersion = nlsVersion;
 
             if(customVersion == Guid.Empty) {
+#if !MONO                
                 byte[] b = BitConverter.GetBytes(effectiveId);
+#endif
                 byte b1 = (byte) ((uint) effectiveId >> 24);
                 byte b2 = (byte) ((effectiveId  & 0x00FF0000) >> 16);
                 byte b3 = (byte) ((effectiveId  & 0x0000FF00) >> 8);
index 3357589278655c7731f6f5c03311a88d15a26e31..bccfd3b510df28bd6b1779fbad2d36c9357d98de 100644 (file)
@@ -421,7 +421,7 @@ namespace System.IO {
             // put in InternalReadChars.   
             int charsRead = 0;
             int numBytes = 0;
-            long posSav = posSav = 0;
+            long posSav = 0;
             
             if (m_stream.CanSeek)
                 posSav = m_stream.Position;
index 2402d9d2bdec1d287f5612c413bc2c3f101c9b46..cb2f144af24ceedf715ef302761a5fc7db00ae61 100644 (file)
@@ -17,7 +17,7 @@
 ===========================================================*/
 
 using System;
-#if FEATURE_MACL
+#if FEATURE_MACL || MONO
 using System.Security.AccessControl;
 #endif
 using System.Security.Permissions;
@@ -226,7 +226,7 @@ namespace System.IO {
             }
         }
 
-#if FEATURE_MACL
+#if FEATURE_MACL || MONO
         [ResourceExposure(ResourceScope.None)]
         [ResourceConsumption(ResourceScope.Machine, ResourceScope.Machine)]
         public FileSecurity GetAccessControl()
index cf65efb2cf0e341e6f15f35d0b2f6dd804f88afd..2db4c807d8797f45a97f136996d363d3b6b47ef1 100644 (file)
@@ -34,7 +34,7 @@ namespace System.IO {
     [FileIOPermissionAttribute(SecurityAction.InheritanceDemand,Unrestricted=true)]
 #endif
     [ComVisible(true)]
-#if FEATURE_REMOTING        
+#if FEATURE_REMOTING || MONO
     public abstract class FileSystemInfo : MarshalByRefObject, ISerializable {
 #else // FEATURE_REMOTING
     public abstract class FileSystemInfo : ISerializable {   
@@ -97,7 +97,9 @@ namespace System.IO {
             [System.Security.SecuritySafeCritical]
             get 
             {
+#pragma warning disable 219
                 String demandDir;
+#pragma warning restore
                 if (this is DirectoryInfo)
                     demandDir = Directory.GetDemandDir(FullPath, true);
                 else
@@ -119,7 +121,9 @@ namespace System.IO {
             [System.Security.SecurityCritical]
             get
             {
+#pragma warning disable 219
                 String demandDir;
+#pragma warning restore
                 if (this is DirectoryInfo)
                     demandDir = Directory.GetDemandDir(FullPath, true);
                 else
index 699d4f7e76b50809826b31b0757c44337dbd318e..795ccabed01d42bd111e061f15b870270ec5352b 100644 (file)
@@ -32,8 +32,10 @@ namespace System.IO {
         // This information isn't guaranteed to be correct, but is our second 
         // best effort at a file or directory involved, after the exception 
         // message.
+#pragma warning disable 414
         [NonSerialized]
         private String _maybeFullPath;  // For debuggers on partial trust code
+#pragma warning restore
 
         public IOException() 
             : base(Environment.GetResourceString("Arg_IOException")) {
index 007745c7ab57d6979632e580b69c75f901908af5..fa022e96e5d8fc29a94d34b28c2212e6eadd28f1 100644 (file)
@@ -39,7 +39,7 @@ namespace System.IO {
 #if CONTRACTS_FULL
     [ContractClass(typeof(StreamContract))]
 #endif
-#if FEATURE_REMOTING
+#if FEATURE_REMOTING || MONO
     public abstract class Stream : MarshalByRefObject, IDisposable {
 #else // FEATURE_REMOTING
     public abstract class Stream : IDisposable {
index f18a310acd80224e8e540dd7ca13ce167ad5fbf9..64f0dfcd349f7fcace0bfcd2fc6e6256883076d1 100644 (file)
@@ -240,9 +240,11 @@ namespace System.IO
                 // write any buffered data to those streams even during finalization, which 
                 // is generally the right thing to do.
                 if (stream != null) {
+#pragma warning disable 184
                     // Note: flush on the underlying stream can throw (ex., low disk space)
                     if (disposing || (LeaveOpen && stream is __ConsoleStream))
                     {
+#pragma warning restore
 #if FEATURE_ASYNC_IO
                         CheckAsyncTaskInProgress();
 #endif
index 5f8e7b98a7d8240203fc1deb2db8526bd4299c58..9023902cbfc3403426645684534b05089e24115c 100644 (file)
@@ -39,7 +39,7 @@ namespace System.IO {
     // There are methods on the Stream class for reading bytes. 
     [Serializable]
     [ComVisible(true)]
-#if FEATURE_REMOTING
+#if FEATURE_REMOTING || MONO
     public abstract class TextReader : MarshalByRefObject, IDisposable {
 #else // FEATURE_REMOTING
     public abstract class TextReader : IDisposable {
index 2afe3a6cbfae4d9751a6ceb27ad2343f4fb54259..3f484ffaddb1d5ebea09a176058b4b04274ff4f4 100644 (file)
@@ -39,7 +39,7 @@ namespace System.IO {
     // There are methods on the Stream class for writing bytes. 
     [Serializable]
     [ComVisible(true)]
-#if FEATURE_REMOTING
+#if FEATURE_REMOTING || MONO
     public abstract class TextWriter : MarshalByRefObject, IDisposable {
 #else // FEATURE_REMOTING
     public abstract class TextWriter : IDisposable {
index 6c65371dcd94feb4678c3f02a6b70b1148e720d1..df2870092b06d52b6e8283bfb1319c195fc2bdd0 100644 (file)
@@ -563,8 +563,9 @@ namespace System.Resources {
             // Jun 08: for cases other than ACCESS_DENIED, we'll assert instead of throw to give release builds more opportunity to fallback.
             // 
 
-
+#pragma warning disable 168
             catch (FileLoadException fle)
+#pragma warning restore
             {
 #if !MONO                
                 // Ignore cases where the loader gets an access
index 2a66d2394195194499a05d015fcc2ea52fceddfc..3e10b394fb9cda09834a5413fef128e7aa16d9ed 100644 (file)
@@ -202,10 +202,12 @@ namespace System.Resources {
 
         private bool UseManifest;  // Use Assembly manifest, or grovel disk.
 
+#pragma warning disable 414
         // unused! But need to keep for serialization
         [OptionalField(VersionAdded = 1)]
         private bool UseSatelliteAssem;  // Are all the .resources files in the 
                   // main assembly, or in satellite assemblies for each culture?
+#pragma warning restore
 #if RESOURCE_SATELLITE_CONFIG
         private static volatile Hashtable _installedSatelliteInfo;  // Give the user the option  
                // to prevent certain satellite assembly probes via a config file.
@@ -269,8 +271,9 @@ namespace System.Resources {
         // My private debugging aid.  Set to 5 or 6 for verbose output.  Set to 3
         // for summary level information.
         internal static readonly int DEBUG = 0; //Making this const causes C# to consider all of the code that it guards unreachable.
-        
+#if FEATURE_APPX        
         private static volatile bool s_IsAppXModel;
+#endif
         
         [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable
         private void Init()
index b1b8e3e48f4f9b142298c47a377a88da38130a6c..d5d396481fa7330478470230d46e206b923708f2 100644 (file)
@@ -4619,15 +4619,14 @@ namespace System
                     #region Non-TransparentProxy case
                     if (name == null)
                         throw new ArgumentNullException("name");
-
+#if MONO
+                    throw new NotImplementedException ();
+#else
                     bool[] isByRef = modifiers == null ? null : modifiers[0].IsByRefArray;
                     
                     // pass LCID_ENGLISH_US if no explicit culture is specified to match the behavior of VB
                     int lcid = (culture == null ? 0x0409 : culture.LCID);
 
-#if MONO
-                    throw new NotImplementedException ();
-#else
                     return InvokeDispMethod(name, bindingFlags, target, providedArgs, isByRef, lcid, namedParams);
 #endif
                     #endregion
@@ -4660,7 +4659,9 @@ namespace System
             if (binder == null)
                 binder = DefaultBinder;
 
+#if !MONO
             bool bDefaultBinder = (binder == DefaultBinder);
+#endif
             #endregion
             
             #region Delegate to Activator.CreateInstance
index 747c0245e5b75f786e5bd49121d664942ada174e..db143c04f522a1c5a65815c32d05261e8f0e995a 100644 (file)
@@ -13,8 +13,9 @@ namespace System.Runtime.CompilerServices
     [AttributeUsage(AttributeTargets.Struct | AttributeTargets.Class | AttributeTargets.Interface, AllowMultiple = true, Inherited = false)]
     internal sealed class TypeDependencyAttribute: Attribute    
     {
-
+#pragma warning disable 414
         private string typeName;
+#pragma warning restore
 
         public TypeDependencyAttribute (string typeName)        
         {
index dbb3f686c2fe185a215c610b8a0519e8c2c7fd09..2947f3877803657845293d4a296a558361472507 100644 (file)
@@ -32,11 +32,15 @@ namespace System.Runtime.ExceptionServices {
     {
         // Private members that will hold the relevant details.
         private Exception m_Exception;
+#if !MONO
         private string m_remoteStackTrace;
+#endif
         private object m_stackTrace;
+#if !MONO
         private object m_dynamicMethods;
         private UIntPtr m_IPForWatsonBuckets;
         private Object m_WatsonBuckets;
+#endif
         
         private ExceptionDispatchInfo(Exception exception)
         {
@@ -66,6 +70,7 @@ namespace System.Runtime.ExceptionServices {
 #endif
         }
 
+#if !MONO
         internal UIntPtr IPForWatsonBuckets
         {
             get
@@ -81,6 +86,7 @@ namespace System.Runtime.ExceptionServices {
                 return m_WatsonBuckets;   
             }
         }
+#endif
         
         internal object BinaryStackTraceArray
         {
@@ -90,6 +96,7 @@ namespace System.Runtime.ExceptionServices {
             }
         }
 
+#if !MONO
         internal object DynamicMethodArray
         {
             get
@@ -105,6 +112,7 @@ namespace System.Runtime.ExceptionServices {
                 return m_remoteStackTrace;
             }
         }
+#endif
 
         // This static method is used to create an instance of ExceptionDispatchInfo for
         // the specified exception object and save all the required details that maybe
index 756ff5d87c3c2ea70a8aa02a36da17e76e6eff18..83a6c0b161dc06d981fb41e8c181b99d62e96dfb 100644 (file)
@@ -522,6 +522,9 @@ namespace System.Runtime.InteropServices{
         
         [System.Runtime.InteropServices.ComVisible(false)]
         HString          = 0x2f,        // Windows Runtime HSTRING
+
+       [System.Runtime.InteropServices.ComVisible(false)]
+        LPUTF8Str        = 0x30,        // UTF8 string
     }
 
 #if !MONO
@@ -645,10 +648,7 @@ namespace System.Runtime.InteropServices{
 #endif
     [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, Inherited = false)]
     [System.Runtime.InteropServices.ComVisible(true)]
-#if !MONOTOUCH
-    public
-#endif
-    sealed class ComImportAttribute : Attribute
+    public sealed class ComImportAttribute : Attribute
     {
         internal static Attribute GetCustomAttribute(RuntimeType type)
         {
index 50740031b6196b51f4c4a4759f13bea1b1674cd7..9d0439d95cff13db05c1c63d0580266f59f70d10 100644 (file)
@@ -12,7 +12,7 @@
 **
 **
 =============================================================================*/
-#if !FULL_AOT_RUNTIME
+
 namespace System.Runtime.InteropServices {
    
     using System;
@@ -31,11 +31,15 @@ namespace System.Runtime.InteropServices {
         {
             if (obj != null)
             {
+#if FULL_AOT_RUNTIME
+                throw new PlatformNotSupportedException ();
+#else
                 // Make sure this guy has an IDispatch
                 IntPtr pdisp = Marshal.GetIDispatchForObject(obj);
 
                 // If we got here without throwing an exception, the QI for IDispatch succeeded.
                 Marshal.Release(pdisp);
+#endif
             }
             m_WrappedObject = obj;
         }
@@ -51,4 +55,3 @@ namespace System.Runtime.InteropServices {
         private Object m_WrappedObject;
     }
 }
-#endif
\ No newline at end of file
index 0cf3823868c81c51fd13aeeb4f37ca1b889574ca..694412fd471faf0fd6eb03a415363e7e944e1393 100644 (file)
@@ -12,7 +12,7 @@
 **
 **
 =============================================================================*/
-#if !FULL_AOT_RUNTIME
+
 namespace System.Runtime.InteropServices {
    
     using System;
@@ -54,4 +54,3 @@ namespace System.Runtime.InteropServices {
         private int m_ErrorCode;
     }
 }
-#endif
\ No newline at end of file
index b74e4d606b57f0e28c77d31cb059015706e0da26..dd983a383ef6c34e6c4701fd694e9f9ea6dffe6a 100644 (file)
@@ -151,7 +151,13 @@ namespace System.Runtime.InteropServices {
             }
         }
 
-#if FEATURE_COMINTEROP && !MONO
+#if FEATURE_COMINTEROP || MONO
+#if MONO
+        private static IntPtr GetRuntimeInterfaceImpl(Guid clsid, Guid riid)
+        {
+            throw new NotSupportedException();
+        }
+#else
         [System.Security.SecurityCritical]
         [ResourceExposure(ResourceScope.Process)]
         [ResourceConsumption(ResourceScope.Process)]
@@ -160,6 +166,7 @@ namespace System.Runtime.InteropServices {
         private static extern IntPtr GetRuntimeInterfaceImpl(
             [In, MarshalAs(UnmanagedType.LPStruct)] Guid clsid,
             [In, MarshalAs(UnmanagedType.LPStruct)] Guid riid);
+#endif
 
         //
         // This function does the equivalent of calling GetInterface(clsid, riid) on the
index aacf09fdbb1dc4c4c5641f2798a1d2c64c7abf08..79d8a97c4db22670dbac130fce3cbd8a7e12efd9 100644 (file)
@@ -1278,11 +1278,13 @@ namespace System.Runtime.InteropServices.WindowsRuntime
             if (type == null)
                 throw new ArgumentNullException("type");
 
+#if FEATURE_COMINTEROP || MONO_COM
             if (type.IsWindowsRuntimeObject && type.IsImport)
             {
                 return (IActivationFactory)Marshal.GetNativeActivationFactory(type);
             }
             else
+#endif
             {
 #if FEATURE_COMINTEROP_WINRT_MANAGED_ACTIVATION
                 return GetManagedActivationFactory(type);
index 396fe83d836a11f80f04a19e8cb743dc868d9523..852942e1bf743018df1c930f2981aa81dde27c87 100644 (file)
@@ -639,15 +639,23 @@ namespace System.Runtime.Serialization.Formatters.Binary{
 
     internal sealed class BinaryMethodCall
     {
+#if FEATURE_REMOTING
         String uri;
+#endif
         String methodName;
         String typeName;
+#if FEATURE_REMOTING
         Type[] instArgs;
+#endif
         Object[] args;
+#if FEATURE_REMOTING
         Object methodSignature;
+#endif
         Object callContext;
+#if FEATURE_REMOTING
         String scallContext;
         Object properties;
+#endif
         Type[] argTypes;
         bool bArgsPrimitive = true;
         MessageEnum messageEnum;
@@ -657,14 +665,22 @@ namespace System.Runtime.Serialization.Formatters.Binary{
         // if not the args are written out as a separate array
         internal Object[] WriteArray(String uri, String methodName, String typeName, Type[] instArgs, Object[] args, Object methodSignature, Object callContext, Object[] properties)
         {
+#if FEATURE_REMOTING            
             this.uri = uri;
+#endif
             this.methodName = methodName;
             this.typeName = typeName;
+#if FEATURE_REMOTING            
             this.instArgs = instArgs;
+#endif
             this.args = args;
+#if FEATURE_REMOTING            
             this.methodSignature = methodSignature;
+#endif
             this.callContext = callContext;
+#if FEATURE_REMOTING            
             this.properties = properties;
+#endif
 
             int arraySize = 0;
             if (args == null || args.Length == 0)
@@ -878,8 +894,10 @@ namespace System.Runtime.Serialization.Formatters.Binary{
                 {
                     if (callContext is String)
                         BinaryUtil.NVTraceI("callContext", (String)callContext);   
+#if FEATURE_REMOTING                        
                     else
                         BinaryUtil.NVTraceI("callContext", scallContext);   
+#endif
                 }
 
                 if (IOUtil.FlagTest(messageEnum, MessageEnum.ArgsInline))
@@ -900,10 +918,14 @@ namespace System.Runtime.Serialization.Formatters.Binary{
     {
         Object returnValue;
         Object[] args;
+#if FEATURE_REMOTING        
         Exception exception;
+#endif
         Object callContext;
+#if FEATURE_REMOTING
         String scallContext;
         Object properties;
+#endif
         Type[] argTypes;
         bool bArgsPrimitive = true;
         MessageEnum messageEnum;
@@ -928,9 +950,13 @@ namespace System.Runtime.Serialization.Formatters.Binary{
 
             this.returnValue = returnValue;
             this.args = args;
+#if FEATURE_REMOTING            
             this.exception = exception;
+#endif
             this.callContext = callContext;
+#if FEATURE_REMOTING
             this.properties = properties;
+#endif
 
             int arraySize = 0;
             if (args == null || args.Length == 0)
@@ -1159,8 +1185,10 @@ namespace System.Runtime.Serialization.Formatters.Binary{
                 {
                     if (callContext is String)
                         BinaryUtil.NVTraceI("callContext", (String)callContext);   
+#if FEATURE_REMOTING                        
                     else
                         BinaryUtil.NVTraceI("callContext", scallContext);   
+#endif
                 }
 
                 if (IOUtil.FlagTest(messageEnum, MessageEnum.ArgsInline))
index 0e7bfafaf9e7bec12929f3349b607f1211c53ddc..b82294c787ba14115fb78a1ba897b19c3dd738a2 100644 (file)
@@ -34,7 +34,7 @@ namespace System.Runtime.Serialization.Formatters.Binary {
     
     [System.Runtime.InteropServices.ComVisible(true)]
     sealed public class BinaryFormatter :
-#if !FEATURE_REMOTING
+#if !FEATURE_REMOTING && !MONO
         IFormatter
 #else
         IRemotingFormatter 
index 28ef1f0810dac5a3ba328cc20085414c4e2d8dcf..2ae5aebb362803db1cd28bfb11606296a3ae4e4b 100644 (file)
@@ -319,7 +319,9 @@ namespace System.Runtime.Serialization.Formatters.Binary {
         }
 
         internal BinaryObjectString binaryObjectString;
+#if !MONO
         internal BinaryCrossAppDomainString binaryCrossAppDomainString;
+#endif
 
         internal void WriteObjectString(int objectId, String value)
         {
@@ -397,7 +399,9 @@ namespace System.Runtime.Serialization.Formatters.Binary {
         private void WriteArrayAsBytes(Array array, int typeLength)
         {
             InternalWriteItemNull();
+#if !MONO
             int byteLength = array.Length*typeLength;
+#endif
             int arrayOffset = 0;
             if (byteBuffer == null)
                 byteBuffer = new byte[chunkSize];
@@ -689,7 +693,9 @@ if (!BitConverter.IsLittleEndian) {
 
 
         internal BinaryAssembly binaryAssembly;
+#if !MONO        
         internal BinaryCrossAppDomainAssembly crossAppDomainAssembly;
+#endif
 
         internal void WriteAssembly(Type type, String assemblyString, int assemId, bool isNew)
         {
index 53c04ba771b242ac86b05659a736cb4264efd257..c62b865c9cdd51c32c7b6df831786144c0974036 100644 (file)
@@ -15,7 +15,9 @@ namespace System.Runtime.Serialization.Formatters.Binary
     [Serializable]
     internal sealed class BinaryMethodCallMessage
     {
+#pragma warning disable 414
         Object[] _inargs = null;
+#pragma warning restore
         String _methodName = null;
         String _typeName = null;
         Object _methodSignature = null;
@@ -100,7 +102,9 @@ namespace System.Runtime.Serialization.Formatters.Binary
     [Serializable]
     internal class BinaryMethodReturnMessage
     {
+#pragma warning disable 414
         Object[] _outargs = null;
+#pragma warning restore
         Exception _exception = null;
         Object _returnValue = null;
 
index fd5131e8e061f7980638fe85c32d454853210bfb..0205e307d156e8142e6fe431fbf3333a03b8ef4a 100644 (file)
@@ -50,7 +50,9 @@ namespace System.Runtime.Serialization.Formatters.Binary {
         internal Object m_topObject;
         internal Header[] headers;
         internal HeaderHandler handler;
+#pragma warning disable 649
         internal SerObjectInfoInit serObjectInfoInit;
+#pragma warning restore
         internal IFormatterConverter m_formatterConverter;
 
         // Stack of Object ParseRecords
@@ -669,7 +671,9 @@ namespace System.Runtime.Serialization.Formatters.Binary {
         {
             SerTrace.Log( this, "ParseArray Entry");
 
+#if !MONO
             long genId = pr.PRobjectId;
+#endif
 
             if (pr.PRarrayTypeEnum == InternalArrayTypeE.Base64)
             {
@@ -1055,9 +1059,11 @@ namespace System.Runtime.Serialization.Formatters.Binary {
 
 
             ParseRecord objectPr = (ParseRecord)stack.Peek();
+#if !MONO
             String objName = null;
             if (objectPr != null)
                 objName = objectPr.PRname;
+#endif
 
 #if _DEBUG                        
             SerTrace.Log( this, "ParseMember ",objectPr.PRobjectId," ",pr.PRname);
@@ -1523,7 +1529,9 @@ namespace System.Runtime.Serialization.Formatters.Binary {
                     TypeInformation typeInfo = BinaryFormatter.GetTypeInformation(resolvedType);
                     if (typeInfo.HasTypeForwardedFrom)
                     {
+#pragma warning disable 219
                         Assembly typeFowardedFromAssembly = null;
+#pragma warning restore
                         try
                         {
                             // if this Assembly.Load failed, we still want to throw security exception
index 569c1a38bdc5080a6f234a09f8806e3e2c0b91b9..3da9e497a834f502438bcd52aad12c6aabaf9ad2 100644 (file)
@@ -354,8 +354,8 @@ namespace System.Runtime.Serialization.Formatters.Binary
         {
             for (int i=0; i<Count(); i++)
             {
+#if _DEBUG
                 Object obj = objects[i];
-#if _DEBUG                
                 SerTrace.Log(this, "Stack Dump ",stackId," "+((obj is ITrace)?((ITrace)obj).Trace():""));
 #endif
             }
index 8d53544a067c3226d3e56523efd38af48e0eeb47..8810cb8b1cab31e61b9b3beb2e252ea30f0e25e3 100644 (file)
@@ -44,7 +44,9 @@ namespace System.Runtime.Serialization {
         internal long               m_fixupCount;
         internal ISurrogateSelector m_selector;
         internal StreamingContext   m_context;
+#if !FEATURE_PAL        
         bool m_isCrossAppDomain;
+#endif
     
         [System.Security.SecuritySafeCritical]  // auto-generated
         public ObjectManager(ISurrogateSelector selector, StreamingContext context) : this(selector, context, true, false) {
@@ -60,7 +62,9 @@ namespace System.Runtime.Serialization {
             m_objects = new ObjectHolder[DefaultInitialSize];
             m_selector = selector;
             m_context = context;
+#if !FEATURE_PAL            
             m_isCrossAppDomain = isCrossAppDomain;
+#endif
         }
 
     
@@ -341,7 +345,9 @@ namespace System.Runtime.Serialization {
             int[] arrayIndex = null;
             ValueTypeFixupInfo currFixup=null;
             Object fixupObj=holder.ObjectValue;
+#if false
             ObjectHolder originalHolder = holder;
+#endif
 
             Contract.Assert(holder!=null, "[TypedReferenceBuilder.ctor]holder!=null");
             Contract.Assert(holder.RequiresValueTypeFixup, "[TypedReferenceBuilder.ctor]holder.RequiresValueTypeFixup");
index 194fc21f3b95696eb5f2dcbd68edb4d55d85b52b..1974926ac9a286bdcca8885e4c8f99a729823996 100644 (file)
@@ -36,7 +36,9 @@ using System.Diagnostics.Contracts;
             // Traverse the hierarchy to find all methods with the particular attribute
             while (baseType != null && baseType != typeof(Object))
             {
+#if !MONO
                 RuntimeType rt = (RuntimeType)baseType;
+#endif
                 // Get all methods which are declared on this type, instance and public or nonpublic
                 MethodInfo[] mis = baseType.GetMethods(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
 #if _DEBUG                
@@ -97,7 +99,9 @@ using System.Diagnostics.Contracts;
             // Invoke all OnSerializingMethods
             if (m_OnSerializingMethods != null)
             {
+#if !MONO
                 Object[] p = new Object[] {context};
+#endif
                 SerializationEventHandler handler = null;
                 foreach(MethodInfo m in m_OnSerializingMethods)
                 {
@@ -116,7 +120,9 @@ using System.Diagnostics.Contracts;
             // Invoke all OnDeserializingMethods
             if (m_OnDeserializingMethods != null)
             {
+#if !MONO
                 Object[] p = new Object[] {context};
+#endif
                 SerializationEventHandler handler = null;
                 foreach(MethodInfo m in m_OnDeserializingMethods)
                 {
@@ -135,7 +141,9 @@ using System.Diagnostics.Contracts;
             // Invoke all OnDeserializingMethods
             if (m_OnDeserializedMethods != null)
             {
+#if !MONO
                 Object[] p = new Object[] {context};
+#endif
                 SerializationEventHandler handler = null;
                 foreach(MethodInfo m in m_OnDeserializedMethods)
                 {
index cd8b165baaf1c6e2c0781e66122bb49a56f82f80..090998e0a51b276b05e83722d12818ab5f4f451a 100644 (file)
@@ -86,12 +86,12 @@ namespace System.Security
     {
 #pragma warning disable 618    // We still use SecurityCriticalScope for v2 compat
 
-#if !FEATURE_CORECLR && !MOBILE
+#if !FEATURE_CORECLR
          private SecurityCriticalScope  _val;
 #endif // FEATURE_CORECLR
         public SecurityCriticalAttribute () {}
 
-#if !FEATURE_CORECLR && !MOBILE
+#if !FEATURE_CORECLR
         public SecurityCriticalAttribute(SecurityCriticalScope scope)
         {
             _val = scope;
index 5f3a25e79b72ee61df57ce06bf256a9e1dfc6ccb..68af0d6ef3f5691f82ce935adaa299861bfd3e8d 100644 (file)
@@ -1310,7 +1310,7 @@ namespace System.Security.Claims
                 switch (enumerator.Name)
                 {
                     case VersionKey:
-                        string version = info.GetString(VersionKey);
+                        info.GetString(VersionKey);
                         break;
 
                     case AuthenticationTypeKey:
index ba6b40ec0ef3f36d54b45b18e4d03bf402a13774..cb23f7bd7a91ad6dd1b17d35d2b6468ca46425c7 100644 (file)
@@ -31,8 +31,9 @@ namespace System.Security.Cryptography {
         private string          _hashName;
         private byte[]          _password;
         private HashAlgorithm   _hash;
+#if !MONO        
         private CspParameters   _cspParams;
-#if !MONO
+
         [System.Security.SecurityCritical] // auto-generated
         private SafeProvHandle _safeProvHandle = null;
         private SafeProvHandle ProvHandle {
@@ -83,7 +84,9 @@ namespace System.Security.Cryptography {
             this.Salt = salt;
             this.HashName = hashName;
             _password = password;
+#if !MONO
             _cspParams = cspParams;
+#endif
         }
 
         //
index c97acf8e60bef4fd1ebc624a257471ef823acc8d..89877e0add7f11bfb3a72d4148a5df8f9e96a7f6 100644 (file)
@@ -70,6 +70,9 @@ namespace System.Security.Cryptography {
         [System.Security.SecuritySafeCritical]  // auto-generated
         public override ICryptoTransform CreateEncryptor (byte[] rgbKey, byte[] rgbIV) {
 #if MONO
+            if (m_use40bitSalt)
+                throw new NotImplementedException ("UseSalt=true is not implemented on Mono yet");
+
             return new RC2Transform (this, true, rgbKey, rgbIV);
 #else
             return _NewEncryptor(rgbKey, ModeValue, rgbIV, EffectiveKeySizeValue, 
@@ -80,6 +83,9 @@ namespace System.Security.Cryptography {
         [System.Security.SecuritySafeCritical]  // auto-generated
         public override ICryptoTransform CreateDecryptor (byte[] rgbKey, byte[] rgbIV) {
 #if MONO
+            if (m_use40bitSalt)
+                throw new NotImplementedException ("UseSalt=true is not implemented on Mono yet");
+
             return new RC2Transform (this, false, rgbKey, rgbIV);
 #else
             return _NewEncryptor(rgbKey, ModeValue, rgbIV, EffectiveKeySizeValue,
index 84d4a66edc37b5983b897a663213d58342c98c0e..63bbb53d3b13d3a79dcc27a74c3f003d6b71b568 100644 (file)
@@ -30,7 +30,9 @@ namespace System.Security.Cryptography {
         private byte[] m_salt;
         private HMACSHA1 m_hmacsha1;  // The pseudo-random generator function used in PBKDF2
         private byte[] m_password;
+#if !MONO
         private CspParameters m_cspParams = new CspParameters();
+#endif
 
         private uint m_iterations;
         private uint m_block;
@@ -207,13 +209,15 @@ namespace System.Security.Cryptography {
             m_block++;
             return ret;
         }
-#if !MONO
         [System.Security.SecuritySafeCritical]  // auto-generated
         public byte[] CryptDeriveKey(string algname, string alghashname, int keySize, byte[] rgbIV)
         {
             if (keySize < 0)
                 throw new CryptographicException(Environment.GetResourceString("Cryptography_InvalidKeySize"));
 
+#if MONO
+            throw new NotSupportedException ("CspParameters are not supported by Mono");
+#else
             int algidhash = X509Utils.NameOrOidToAlgId(alghashname, OidGroup.HashAlgorithm);
             if (algidhash == 0)
                 throw new CryptographicException(Environment.GetResourceString("Cryptography_PasswordDerivedBytes_InvalidAlgorithm"));
@@ -231,8 +235,10 @@ namespace System.Security.Cryptography {
                       m_password, m_password.Length, keySize << 16, rgbIV, rgbIV.Length,
                       JitHelpers.GetObjectHandleOnStack(ref key));
             return key;
+#endif
         }
 
+#if !MONO
         [System.Security.SecurityCritical] // auto-generated
         private SafeProvHandle _safeProvHandle = null;
         private SafeProvHandle ProvHandle
index 0954818455914214f4a21c807ed7d00eea61d89b..1cab13c87b3b5c4b686b075db25c5ffdf710fd7a 100644 (file)
@@ -24,6 +24,7 @@ namespace System.Security.Cryptography {
     using System.Security.Permissions;
     using System.Diagnostics.Contracts;
 
+#if !MONO
     // Object layout of the RSAParameters structure
     internal class RSACspObject {
         internal byte[] Exponent;
@@ -35,6 +36,7 @@ namespace System.Security.Cryptography {
         internal byte[] InverseQ;
         internal byte[] D;
     }
+#endif
 
     [System.Runtime.InteropServices.ComVisible(true)]
     public sealed partial class RSACryptoServiceProvider : RSA
@@ -526,7 +528,8 @@ namespace System.Security.Cryptography {
             Contract.Assert(!String.IsNullOrEmpty(hashAlgorithm.Name));
 
 #if MONO
-            throw new NotImplementedException ();
+            var hash = HashAlgorithm.Create (hashAlgorithm.Name);
+            return hash.ComputeHash (data, offset, count);
 #else
             using (SafeHashHandle hashHandle = Utils.CreateHash(Utils.StaticProvHandle, GetAlgorithmId(hashAlgorithm))) {
                 Utils.HashData(hashHandle, data, offset, count);
@@ -542,7 +545,8 @@ namespace System.Security.Cryptography {
             Contract.Assert(!String.IsNullOrEmpty(hashAlgorithm.Name));
 
 #if MONO
-            throw new NotImplementedException ();
+            var hash = HashAlgorithm.Create (hashAlgorithm.Name);
+            return hash.ComputeHash (data);
 #else
             using (SafeHashHandle hashHandle = Utils.CreateHash(Utils.StaticProvHandle, GetAlgorithmId(hashAlgorithm))) {
                 // Read the data 4KB at a time, providing similar read characteristics to a standard HashAlgorithm
index 87f99a67da32e48e877ea0dd67b3c9870853210a..d455031e761f11b233eb55b65ffbbc57c7164458 100644 (file)
@@ -28,6 +28,15 @@ namespace System {
 
     internal sealed class SharedStatics
     {
+#if MONO
+        // TODO: We are using only GetSharedStringMaker for now which is
+        // ok to be AppDomain static
+        static readonly SharedStatics _sharedStatics = new SharedStatics();
+
+        private SharedStatics()
+        {
+        }
+#else
         // this is declared static but is actually forced to be the same object 
         // for each AppDomain at AppDomain create time.
         private static SharedStatics _sharedStatics;
@@ -38,6 +47,7 @@ namespace System {
         {
             BCLDebug.Assert(false, "SharedStatics..ctor() is never called.");
         }
+#endif
 
         private volatile String _Remoting_Identity_IDGuid;
         public static String Remoting_Identity_IDGuid 
index 3f96ac1c00e42170e0153dea36793ab74d142992..e8fe32e54d119a9dffc79131c9a1106c06ab56e2 100644 (file)
@@ -1392,6 +1392,16 @@ namespace System {
 
             return s;
         }
+
+        unsafe internal int GetBytesFromEncoding(byte* pbNativeBuffer, int cbNativeBuffer,Encoding encoding)
+        {
+            // encoding == Encoding.UTF8
+            fixed (char* pwzChar = &this.m_firstChar)
+            {
+                return encoding.GetBytes(pwzChar, m_stringLength, pbNativeBuffer, cbNativeBuffer);
+            }
+        }
+
 #if !MONO
         [System.Security.SecuritySafeCritical]  // auto-generated
         unsafe internal int ConvertToAnsi(byte *pbNativeBuffer, int cbNativeBuffer, bool fBestFit, bool fThrowOnUnmappableChar)
index 46c377bdebae60fc7e70105d0cbd79f6cd76186b..c0fcae0e3d635a505539edb83a72d10b26e88ec5 100644 (file)
@@ -1338,8 +1338,10 @@ namespace System.Text {
             }
 
             while (true) {
+#if !MONO                
                 int p = pos;
                 int i = pos;
+#endif
                 while (pos < len) {
                     ch = format[pos];
 
@@ -1406,8 +1408,10 @@ namespace System.Text {
                 StringBuilder fmt = null;
                 if (ch == ':') {
                     pos++;
+#if !MONO
                     p = pos;
                     i = pos;
+#endif
                     while (true) {
                         if (pos == len) FormatError();
                         ch = format[pos];
@@ -1559,7 +1563,9 @@ namespace System.Text {
             if (newValue == null)
                 newValue = "";
 
+#if !MONO
             int deltaLength = newValue.Length - oldValue.Length;
+#endif
 
             int[] replacements = null;          // A list of replacement positions in a chunk to apply
             int replacementsCount = 0;
@@ -1597,7 +1603,9 @@ namespace System.Text {
                 {
                     // Replacing mutates the blocks, so we need to convert to logical index and back afterward. 
                     int index = indexInChunk + chunk.m_ChunkOffset;
+#if !MONO                    
                     int indexBeforeAdjustment = index;
+#endif
 
                     // See if we accumulated any replacements, if so apply them 
                     ReplaceAllInChunk(replacements, replacementsCount, chunk, oldValue.Length, newValue);
index 1a293330ac96feba2b9e58a6246db499fa2765db..3f2e5f608113287f596a479ec589ad0970155459 100644 (file)
@@ -1080,7 +1080,9 @@ namespace System.Threading
     /// <typeparam name="T">The kind of elements contained within.</typeparam>
     internal class SparselyPopulatedArray<T> where T : class
     {
+#if DEBUG        
         private readonly SparselyPopulatedArrayFragment<T> m_head;
+#endif
         private volatile SparselyPopulatedArrayFragment<T> m_tail;
 
         /// <summary>
@@ -1089,7 +1091,10 @@ namespace System.Threading
         /// <param name="initialSize">How many array slots to pre-allocate.</param>
         internal SparselyPopulatedArray(int initialSize)
         {
-            m_head = m_tail = new SparselyPopulatedArrayFragment<T>(initialSize);
+#if DEBUG            
+            m_head = 
+#endif
+            m_tail = new SparselyPopulatedArrayFragment<T>(initialSize);
         }
 
 #if DEBUG
index 4168909f0dd17449e19e6aed3039bce3e82ce073..21ec1d7b8346d780a4a059738ca4bb8f908e7f5c 100644 (file)
@@ -858,7 +858,7 @@ namespace System.Threading.Tasks
                 else
                 {
                     //This is the original 4.0 behaviour
-                    var asyncResult = beginMethod(iar =>
+                    beginMethod(iar =>
                     {
                         FromAsyncCoreLogic(iar, endFunction, endAction, promise, requiresSynchronization: true);
                     }, state);
@@ -995,7 +995,7 @@ namespace System.Threading.Tasks
                 else
                 {
                     //quirk for previous versions
-                    var asyncResult = beginMethod(arg1, iar =>
+                    beginMethod(arg1, iar =>
                     {
                         FromAsyncCoreLogic(iar, endFunction, endAction, promise, requiresSynchronization: true);
                     }, state);
@@ -1141,7 +1141,7 @@ namespace System.Threading.Tasks
                 else
                 {
                     //quirk for previous versions
-                    var asyncResult = beginMethod(arg1, arg2, iar =>
+                    beginMethod(arg1, arg2, iar =>
                     {
                         FromAsyncCoreLogic(iar, endFunction, endAction, promise, requiresSynchronization: true);
                     }, state);
@@ -1294,7 +1294,7 @@ namespace System.Threading.Tasks
                 else
                 {
                     //quirk for previous versions
-                    var asyncResult = beginMethod(arg1, arg2, arg3, iar =>
+                    beginMethod(arg1, arg2, arg3, iar =>
                     {
                         FromAsyncCoreLogic(iar, endFunction, endAction, promise, requiresSynchronization: true);
                     }, state);
index 2b64b423d8e28a317807644569681db96f0c3521..89ae7f7d20e98d27c2f40234107dd5d469f715c5 100644 (file)
@@ -122,8 +122,10 @@ namespace System.Threading.Tasks
             get { return m_cancellationToken; }
             set
             {
+#if !MONO                
                 if (value == null)
                     throw new ArgumentNullException("CancellationToken");
+#endif
                 m_cancellationToken = value;
             }
         }
@@ -245,10 +247,11 @@ namespace System.Threading.Tasks
                 }
             }
 
+#if !MONO
             // ETW event for Parallel Invoke Begin
             int forkJoinContextID = 0;
             Task callerTask = null;
-#if !MONO            
+           
             if (TplEtwProvider.Log.IsEnabled())
             {
                 forkJoinContextID = Interlocked.Increment(ref s_forkJoinContextID);
@@ -1095,10 +1098,11 @@ namespace System.Threading.Tasks
                 }, null);
             }
 
+#if !MONO
             // ETW event for Parallel For begin
             int forkJoinContextID = 0;
             Task callingTask = null;
-#if !MONO            
+            
             if (TplEtwProvider.Log.IsEnabled())
             {
                 forkJoinContextID = Interlocked.Increment(ref s_forkJoinContextID);
@@ -1418,10 +1422,11 @@ namespace System.Threading.Tasks
                 }, null);
             }
 
+#if !MONO
             // ETW event for Parallel For begin
             Task callerTask = null;
             int forkJoinContextID = 0;
-#if !MONO
+
             if (TplEtwProvider.Log.IsEnabled())
             {
                 forkJoinContextID = Interlocked.Increment(ref s_forkJoinContextID);
index 2ae0c8790457fb7f593ef9bdd4cc5f7bc0968664..d37a6e7c1b5c8162cb77167ebc2e76d7d8840bed 100644 (file)
@@ -412,7 +412,9 @@ namespace System.Threading.Tasks
     /// </summary>
     internal class ParallelLoopStateFlags
     {
+#pragma warning disable 649        
         internal static int PLS_NONE;
+#pragma warning restore
         internal static int PLS_EXCEPTIONAL = 1;
         internal static int PLS_BROKEN = 2;
         internal static int PLS_STOPPED = 4;
@@ -439,7 +441,9 @@ namespace System.Threading.Tasks
             {
                 oldState = m_LoopStateFlags;
                 if ((oldState & illegalStates) != 0) return false;
+#pragma warning disable 420
                 if (Interlocked.CompareExchange(ref m_LoopStateFlags, oldState | newState, oldState) == oldState)
+#pragma warning restore
                 {
                     return true;
                 }
index 522db85b2f0833793dbe86928b6b0c5769c3196c..6b11de5616f16f1cd2dddb2d6a42ef84945bad69 100644 (file)
@@ -550,7 +550,9 @@ namespace System.Threading.Tasks
         /// <summary>The action to invoke.</summary>
         protected readonly Action m_action;
 
+#if !MONO
         protected int m_continuationId;
+#endif
 
         /// <summary>Initializes the continuation.</summary>
         /// <param name="action">The action to invoke. Must not be null.</param>
index 08426b232735ae20e30bc235cfb014d7bee30992..2d602aac3439ccaa5b53eef75cbb317ae4008821 100644 (file)
@@ -16,6 +16,7 @@
 =============================================================================*/
 
 
+#if !MOBILE
 #if !FEATURE_MACL
 namespace System.Security.AccessControl
 {
@@ -27,6 +28,7 @@ namespace System.Security.AccessControl
     }
 }
 #endif
+#endif
 
 namespace System.Threading
 {
@@ -63,13 +65,24 @@ namespace System.Threading
             Contract.EndContractBlock();
             
             SafeWaitHandle _handle = null;
+#if MONO
+            int errorCode;
+#endif
             switch(mode)
             {
                 case EventResetMode.ManualReset:
+#if MONO
+                    _handle = new SafeWaitHandle (NativeEventCalls.CreateEvent_internal (true, initialState, name, out errorCode), true);
+#else
                     _handle = Win32Native.CreateEvent(null, true, initialState, name);
+#endif
                     break;
                 case EventResetMode.AutoReset:
+#if MONO
+                    _handle = new SafeWaitHandle (NativeEventCalls.CreateEvent_internal (false, initialState, name, out errorCode), true);
+#else
                     _handle = Win32Native.CreateEvent(null, false, initialState, name);
+#endif
                     break;
 
                 default:
@@ -78,7 +91,9 @@ namespace System.Threading
                 
             if (_handle.IsInvalid)
             {
+#if !MONO
                 int errorCode = Marshal.GetLastWin32Error();
+#endif
             
                 _handle.SetHandleAsInvalid();
                 if(null != name && 0 != name.Length && Win32Native.ERROR_INVALID_HANDLE == errorCode)
@@ -107,7 +122,9 @@ namespace System.Threading
                 throw new ArgumentException(Environment.GetResourceString("Argument_WaitHandleNameTooLong",name));
             }
             Contract.EndContractBlock();
+#if !MONO
             Win32Native.SECURITY_ATTRIBUTES secAttrs = null;
+
 #if FEATURE_MACL
             // For ACL's, get the security descriptor from the EventWaitHandleSecurity.
             if (eventSecurity != null) {
@@ -119,6 +136,7 @@ namespace System.Threading
                 Buffer.Memcpy(pSecDescriptor, 0, sd, 0, sd.Length);
                 secAttrs.pSecurityDescriptor = pSecDescriptor;
             }
+#endif
 #endif
 
             SafeWaitHandle _handle = null;
@@ -136,8 +154,13 @@ namespace System.Threading
                     throw new ArgumentException(Environment.GetResourceString("Argument_InvalidFlag",name));
             };
 
+#if MONO
+            int errorCode;
+            _handle = new SafeWaitHandle (NativeEventCalls.CreateEvent_internal (isManualReset, initialState, name, out errorCode), true);
+#else
             _handle = Win32Native.CreateEvent(secAttrs, isManualReset, initialState, name);
             int errorCode = Marshal.GetLastWin32Error();
+#endif
 
             if (_handle.IsInvalid)
             {
@@ -239,15 +262,26 @@ namespace System.Threading
 
             result = null;
 
+#if MOBILE
+            throw new NotSupportedException ();
+#else
+
+#if MONO
+            int errorCode;
+            var myHandle = new SafeWaitHandle (NativeEventCalls.OpenEvent_internal (name, rights, out errorCode), true);
+#else
 #if FEATURE_MACL
             SafeWaitHandle myHandle = Win32Native.OpenEvent((int) rights, false, name);
 #else
             SafeWaitHandle myHandle = Win32Native.OpenEvent(Win32Native.EVENT_MODIFY_STATE | Win32Native.SYNCHRONIZE, false, name);
+#endif
 #endif
             
             if (myHandle.IsInvalid)
             {
+#if !MONO
                 int errorCode = Marshal.GetLastWin32Error();
+#endif
 
                 if(Win32Native.ERROR_FILE_NOT_FOUND == errorCode || Win32Native.ERROR_INVALID_NAME == errorCode)
                     return OpenExistingResult.NameNotFound;
@@ -260,33 +294,52 @@ namespace System.Threading
             }
             result = new EventWaitHandle(myHandle);
             return OpenExistingResult.Success;
+#endif
         }
         [System.Security.SecuritySafeCritical]  // auto-generated
         public bool Reset()
         {
+#if MONO
+            var res = NativeEventCalls.ResetEvent(safeWaitHandle);
+#else
             bool res = Win32Native.ResetEvent(safeWaitHandle);
+#endif
             if (!res)
+#if MONO
+                throw new IOException ();
+#else
                 __Error.WinIOError();
+#endif
             return res;
         }
         [System.Security.SecuritySafeCritical]  // auto-generated
         public bool Set()
         {
+#if MONO
+            var res = NativeEventCalls.SetEvent(safeWaitHandle);
+#else
             bool res = Win32Native.SetEvent(safeWaitHandle);
+#endif
 
             if (!res)
+#if MONO
+                throw new IOException ();
+#else
                 __Error.WinIOError();
+#endif
 
             return res;
         }
 
-#if FEATURE_MACL
+#if FEATURE_MACL || MOBILE
         [System.Security.SecuritySafeCritical]  // auto-generated
         public EventWaitHandleSecurity GetAccessControl()
         {
             return new EventWaitHandleSecurity(safeWaitHandle, AccessControlSections.Access | AccessControlSections.Owner | AccessControlSections.Group);
         }
+#endif
 
+#if FEATURE_MACL
         [System.Security.SecuritySafeCritical]  // auto-generated
         public void SetAccessControl(EventWaitHandleSecurity eventSecurity)
         {
index b477f7bb686d3aa8758503ff45f1bce268e22855..d85cf9fb97643751787b80da2b208e0e89641c5c 100644 (file)
@@ -1081,7 +1081,6 @@ namespace System.Threading {
 
             dls.Store.SetData(slot, data);
         }
-#if !MONO
 
         // #threadCultureInfo
         //
@@ -1337,12 +1336,23 @@ namespace System.Threading {
         }
 
 #if! FEATURE_LEAK_CULTURE_INFO
+
+#if MONO
+        static void nativeInitCultureAccessors()
+        {
+            m_CurrentCulture = CultureInfo.ConstructCurrentCulture ();
+            m_CurrentUICulture = CultureInfo.ConstructCurrentUICulture ();
+        }
+#else
         [System.Security.SecurityCritical]  // auto-generated
         [ResourceExposure(ResourceScope.None)]
         [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)]
         [SuppressUnmanagedCodeSecurity]
         private static extern void nativeInitCultureAccessors();
 #endif
+#endif
+
+#if !MONO
 
         /*=============================================================*/
 
index 60046c7dba2ff68d34dbc612b28405e125b430b3..3063b06aed614150203337276bab3c04169751b2 100644 (file)
@@ -39,12 +39,11 @@ namespace System.Threading
             : base(info, context) 
         {
         }
-#if !MOBILE
+
         public Object ExceptionState 
         {
             [System.Security.SecuritySafeCritical]  // auto-generated
             get {return Thread.CurrentThread.AbortReason;}
         }
-#endif
     }
 }
index 13e1e31a9767216974fb004458de09cd2d167fff..79ca731df46141499b85b059d03ae3ea729145e3 100644 (file)
@@ -579,7 +579,9 @@ namespace System.Threading
         // The head and tail of the queue.  We enqueue to the head, and dequeue from the tail.
         internal volatile QueueSegment queueHead;
         internal volatile QueueSegment queueTail;
+#if !MONO        
         internal bool loggingEnabled;
+#endif
 
         internal static SparseArray<WorkStealingQueue> allThreadQueues = new SparseArray<WorkStealingQueue>(16); //
 
index 8aad5bb3a61236af796230cbec40949294609e96..80bef5ab852b2b77947bdeca47d7f8ce38d1b0f0 100644 (file)
@@ -22,7 +22,9 @@ namespace System {
     public struct TypedReference
     {
 #if MONO
+#pragma warning disable 169
         RuntimeTypeHandle type;
+#pragma warning restore
 #endif
         private IntPtr Value;
         private IntPtr Type;
diff --git a/mcs/class/test-helpers/NunitHelpers.cs b/mcs/class/test-helpers/NunitHelpers.cs
new file mode 100644 (file)
index 0000000..f16683e
--- /dev/null
@@ -0,0 +1,112 @@
+using System.IO;
+using System.Collections;
+using NUnit.Framework.Constraints;
+
+namespace NUnit.Framework
+{
+       static class CollectionAssert
+       {
+               public static void DoesNotContain (IEnumerable collection, object val)
+               {
+                        Assert.That(collection, Has.No.Member(val));
+               }
+
+               public static void Contains (IEnumerable collection, object val)
+               {
+                        Assert.That(collection, Has.Member(val));
+               }
+
+               public static void AreEqual (IEnumerable expected, IEnumerable actual, string message = null, params object[] args) 
+               {
+                       Assert.That(actual, Is.EqualTo(expected), message, args);
+               }
+
+               public static void AreEquivalent (IEnumerable expected, IEnumerable actual, string message = null, params object[] args) 
+               {
+                       Assert.That(actual, Is.EquivalentTo(expected), message, args);
+               }
+
+               public static void IsEmpty(IEnumerable collection, string message = null, params object[] args)
+               {
+                       Assert.That(collection, new EmptyCollectionConstraint(), message, args);
+               }
+       }
+
+       static class FileAssert
+       {
+               public static void AreEqual(Stream expected, Stream actual, string message, params object[] args)
+               {
+                       Assert.That(actual, Is.EqualTo(expected), message, args);
+               }
+
+               public static void AreEqual(string expected, string actual, string message, params object[] args)
+               {
+                       using (FileStream exStream = File.OpenRead(expected))
+                       using (FileStream acStream = File.OpenRead(actual))
+                       {
+                               AreEqual(exStream, acStream, message, args);
+                       }
+               }
+       }
+
+       static class StringAssert
+       {
+               public static void Contains(string expected, string actual, string message = null, params object[] args)
+               {
+                       Assert.That(actual, Is.StringContaining (expected), message, args);
+               }
+
+               public static void StartsWith(string expected, string actual, string message = null, params object[] args)
+               {
+                       Assert.IsTrue (actual.StartsWith (expected), message, args);
+               }
+       }
+
+       static class AssertHelper
+       {
+               public static void IsEmpty (string aString, string message = null, params object[] args )
+               {
+                       Assert.That(aString, Is.Empty, message, args);
+               }
+
+               public static void IsNotEmpty (string aString, string message = null, params object[] args )
+               {
+                       Assert.That(aString, Is.Not.Empty, message, args);
+               }
+
+               public static void Less(int arg1, int arg2, string message = null, params object[] args) 
+               {
+                       Assert.That(arg1, Is.LessThan(arg2), message, args);
+               }
+
+               public static void Greater(int arg1, int arg2, string message = null, params object[] args) 
+               {
+                       Assert.That(arg1, Is.GreaterThan(arg2), message, args);
+               }
+
+               public static void Greater(double arg1, double arg2, string message = null, params object[] args) 
+               {
+                       Assert.That(arg1, Is.GreaterThan(arg2), message, args);
+               }
+
+               public static void GreaterOrEqual(int arg1, int arg2, string message = null, params object[] args)
+               {
+                       Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2), message, args);
+               }
+
+               public static void GreaterOrEqual(long arg1, long arg2, string message = null, params object[] args)
+               {
+                       Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2), message, args);
+               }
+
+               public static void LessOrEqual (int arg1, int arg2, string message = null, params object[] args)
+               {
+                       Assert.That(arg1, Is.LessThanOrEqualTo(arg2), message, args);
+               }
+
+               public static void IsNotInstanceOfType(System.Type expected, object actual, string message, params object[] args )
+               {
+                       Assert.IsFalse (actual.GetType ().IsInstanceOfType (expected), message, args);
+               }
+       }
+}
index 118d89410e2efbb38ce56371da9b5012593e7e5a..74e77b0edf0f66df063ca925485701b4a139b671 100644 (file)
@@ -91,8 +91,11 @@ namespace MonoTests.Helpers
                                        listenSocket = tcpListener.AcceptSocket ();
                                        listenSocket.Send (requestHandler (listenSocket));
                                        try {
-                                               listenSocket.Shutdown (SocketShutdown.Receive);
+                                               // On Windows a Receive() is needed here before Shutdown() to consume the data some tests send.
+                                               listenSocket.ReceiveTimeout = 10 * 1000;
+                                               listenSocket.Receive (new byte [0]);
                                                listenSocket.Shutdown (SocketShutdown.Send);
+                                               listenSocket.Shutdown (SocketShutdown.Receive);
                                        } catch {
                                        }
                                } catch (SocketException ex) {
diff --git a/mcs/errors/cs0029-37.cs b/mcs/errors/cs0029-37.cs
new file mode 100644 (file)
index 0000000..80f8e8c
--- /dev/null
@@ -0,0 +1,24 @@
+// CS0029: Cannot implicitly convert type `string' to `int'
+// Line: 8
+
+class A<T> where T : CB, IA
+{
+       void Foo (T t)
+       {
+               t.Prop = "3";
+       }
+}
+
+class CB : CA
+{
+}
+
+class CA
+{
+       public int Prop { get; set; }
+}
+
+interface IA
+{
+       string Prop { get; set; }
+}
\ No newline at end of file
diff --git a/mcs/errors/cs0031-9.cs b/mcs/errors/cs0031-9.cs
new file mode 100644 (file)
index 0000000..ec2b3b9
--- /dev/null
@@ -0,0 +1,7 @@
+// CS0031: Constant value `1.42' cannot be converted to a `int'
+// Line: 6
+
+class X
+{
+       const int val = 1.42f;
+}
\ No newline at end of file
diff --git a/mcs/errors/cs0122-39.cs b/mcs/errors/cs0122-39.cs
new file mode 100644 (file)
index 0000000..f7da1f9
--- /dev/null
@@ -0,0 +1,15 @@
+// CS0122: `A.Y' is inaccessible due to its protection level
+// Line: 8
+
+public class Test
+{
+       public static void Main ()
+       {
+               var x = nameof (A.Y);
+       }
+}
+        
+public class A
+{
+       private int Y { get; set; }
+}
\ No newline at end of file
diff --git a/mcs/errors/cs0177-15.cs b/mcs/errors/cs0177-15.cs
new file mode 100644 (file)
index 0000000..310f405
--- /dev/null
@@ -0,0 +1,21 @@
+// CS0177: The out parameter `x' must be assigned to before control leaves the current method
+// Line: 6
+
+public class GotoWithOut
+{
+       public static void Test (bool cond, out int x)
+       {
+               if (cond)
+               {
+                       goto Label2;
+               }
+               else
+               {
+                       goto Label;
+               }
+               Label:
+               x = 0;
+               Label2:
+               return;
+       }
+}
\ No newline at end of file
diff --git a/mcs/errors/cs0219-7.cs b/mcs/errors/cs0219-7.cs
new file mode 100644 (file)
index 0000000..ca40a59
--- /dev/null
@@ -0,0 +1,11 @@
+// CS0219: The constant `C' is never used
+// Line: 9
+// Compiler options: -warn:3 -warnaserror
+
+class C
+{
+       public static void Main ()
+       {
+               const int C = 1;
+       }
+}
\ No newline at end of file
diff --git a/mcs/errors/cs0246-36.cs b/mcs/errors/cs0246-36.cs
new file mode 100644 (file)
index 0000000..2bd3567
--- /dev/null
@@ -0,0 +1,9 @@
+// CS0246: The type or namespace name `Foo' could not be found. Are you missing an assembly reference?
+// Line: 8
+
+class Crashy
+{
+       void Call (System.Action<object> action) { }
+
+       public void DoCrash () => Call (f => f as Foo);
+}
diff --git a/mcs/errors/cs0619-59.cs b/mcs/errors/cs0619-59.cs
new file mode 100644 (file)
index 0000000..b703b0e
--- /dev/null
@@ -0,0 +1,18 @@
+// CS0619: `A.X' is obsolete: `'
+// Line: 10
+
+using System;
+
+public class Test
+{
+       public static void Main()
+       {
+               var m = nameof (A.X);
+       }
+}
+        
+public class A
+{
+       [Obsolete ("", true)]
+       public int X;
+}
diff --git a/mcs/errors/cs1070-3.cs b/mcs/errors/cs1070-3.cs
new file mode 100644 (file)
index 0000000..18811dc
--- /dev/null
@@ -0,0 +1,11 @@
+// CS1070: The type `C' has been forwarded to an assembly that is not referenced. Consider adding a reference to assembly `CS1070-lib-missing, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'
+// Line: 5
+// Compiler options: -r:CS1070-lib.dll
+
+public class D
+{
+       static void Main ()
+       {
+               new C ();
+       }
+}
\ No newline at end of file
diff --git a/mcs/errors/cs1501-19.cs b/mcs/errors/cs1501-19.cs
new file mode 100644 (file)
index 0000000..68095c1
--- /dev/null
@@ -0,0 +1,26 @@
+// CS1501: No overload for method `Call' takes `0' arguments
+// Line: 8
+
+class A<T> where T : CB, IA
+{
+       void Foo (T t)
+       {
+               t.Call ();
+       }
+}
+
+class CB : CA
+{
+}
+
+class CA
+{
+       public void Call (int arg)
+       {
+       }
+}
+
+interface IA
+{
+       void Call (bool arg, int arg2);
+}
diff --git a/mcs/errors/cs1691-2.cs b/mcs/errors/cs1691-2.cs
deleted file mode 100644 (file)
index 8c09699..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-// CS1691: `2' is not a valid warning number
-// Line: 0
-// Compiler options: -warnaserror -warnaserror:1691,2
-
diff --git a/mcs/errors/cs1691-3.cs b/mcs/errors/cs1691-3.cs
deleted file mode 100644 (file)
index c423ebf..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-// CS1691: `20' is not a valid warning number
-// Line: 0
-// Compiler options:  -warnaserror -warnaserror-:20
-
diff --git a/mcs/errors/cs1691-4.cs b/mcs/errors/cs1691-4.cs
deleted file mode 100644 (file)
index cd9ce64..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-// CS1691: `20' is not a valid warning number
-// Line: 0
-// Compiler options: -warnaserror -nowarn:20
-
diff --git a/mcs/errors/cs1691.cs b/mcs/errors/cs1691.cs
deleted file mode 100644 (file)
index bd3e169..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-// CS1691: `1' is not a valid warning number
-// Line: 5
-// Compiler options: -warnaserror
-
-#pragma warning disable 1
-
diff --git a/mcs/errors/cs1744-3.cs b/mcs/errors/cs1744-3.cs
new file mode 100644 (file)
index 0000000..b899816
--- /dev/null
@@ -0,0 +1,18 @@
+// CS1744: Named argument `p1' cannot be used for a parameter which has positional argument specified
+// Line: 8
+
+internal class Program
+{
+       public static void Main ()
+       {
+               Method (1, 2, p1: 3);
+       }
+       
+       static void Method (int p1, int paramNamed, int p2)
+       {
+       }
+       
+       static void Method (int p1, int p2, object paramNamed)
+       {
+       }
+}
diff --git a/mcs/errors/cs1904.cs b/mcs/errors/cs1904.cs
deleted file mode 100644 (file)
index 4417537..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-// CS1904: `4013' is not a valid warning number
-// Line: 0
-// Compiler options: -nowarn:4014,4013
-
-class ClassMain {
-        public static void Main () {}
-}
-
diff --git a/mcs/errors/cs8101.cs b/mcs/errors/cs8101.cs
new file mode 100644 (file)
index 0000000..eea62fd
--- /dev/null
@@ -0,0 +1,7 @@
+// CS8101: The pathmap option was incorrectly formatted
+// Line: 0
+// Compiler options: -pathmap:a=
+
+class X
+{
+}
\ No newline at end of file
index cf8834c52c7388a4c1206e7cbc210442c2126415..1b1d6536e8eb3e843512750a0d7c378f8db812a3 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 63ddee82bfa286db0e183495ef80d6a93e4d5b90..fea30ff25c6d0e4846b95d8fedb86605285138c2 100644 (file)
@@ -3276,13 +3276,13 @@ exptype_head            : D_CLASS K_EXTERN expt_attr comp_name
 expt_attr              : { $$ = 0; } /* EMPTY */\r
                        | expt_attr K_PRIVATE                   { $$ = (TypeAttr)$1 | TypeAttr.Private; }\r
                        | expt_attr K_PUBLIC                    { $$ = (TypeAttr)$1 | TypeAttr.Public; }\r
+                       | expt_attr K_FORWARDER                 { $$ = (TypeAttr)$1 | TypeAttr.Forwarder; }\r
                        | expt_attr K_NESTED K_PUBLIC           { $$ = (TypeAttr)$1 | TypeAttr.NestedPublic; }\r
                        | expt_attr K_NESTED K_PRIVATE          { $$ = (TypeAttr)$1 | TypeAttr.NestedPrivate; }\r
                        | expt_attr K_NESTED K_FAMILY           { $$ = (TypeAttr)$1 | TypeAttr.NestedFamily; }\r
                        | expt_attr K_NESTED K_ASSEMBLY         { $$ = (TypeAttr)$1 | TypeAttr.NestedAssembly;}\r
                        | expt_attr K_NESTED K_FAMANDASSEM      { $$ = (TypeAttr)$1 | TypeAttr.NestedFamAndAssem; }\r
                        | expt_attr K_NESTED K_FAMORASSEM       { $$ = (TypeAttr)$1 | TypeAttr.NestedFamOrAssem; }\r
-                       | K_FORWARDER                           { $$ = TypeAttr.Forwarder; }\r
                        ;\r
 \r
 exptype_decls          : /* EMPTY */\r
index 01285712a2b3787590464510bc71d67f99167ed0..9c4b6a172a0175c6521e885fff4f1dc42dca5d1f 100644 (file)
@@ -68,10 +68,10 @@ btest: mcs2.exe mcs3.exe
        ls -l mcs2.exe mcs3.exe
 
 mcs2.exe: $(PROGRAM)
-       $(TIME) $(RUNTIME) $(RUNTIME_FLAGS) $(PROGRAM) $(USE_MCS_FLAGS) -target:exe -out:$@ $(BUILT_SOURCES) @$(response)
+       $(TIME) $(RUNTIME) $(RUNTIME_FLAGS) $(PROGRAM) $(USE_MCS_FLAGS) $(MCS_REFERENCES) -target:exe -out:$@ $(BUILT_SOURCES) $(EXTRA_SOURCES) @$(response)
 
 mcs3.exe: mcs2.exe
-       $(TIME) $(RUNTIME) $(RUNTIME_FLAGS) ./mcs2.exe $(USE_MCS_FLAGS) -target:exe -out:$@ $(BUILT_SOURCES) @$(response)
+       $(TIME) $(RUNTIME) $(RUNTIME_FLAGS) ./mcs2.exe $(USE_MCS_FLAGS) $(MCS_REFERENCES) -target:exe -out:$@ $(BUILT_SOURCES) $(EXTRA_SOURCES) @$(response)
 
 wc:
        wc -l $(BUILT_SOURCES) `cat $(sourcefile)`
index 80481ed2091f6ba2cf1deb7c25e4c5514ce9e529..d27fe806048797af33538b202c262e0e040dff4e 100644 (file)
@@ -1595,6 +1595,15 @@ namespace Mono.CSharp {
                        if (res && errors != ec.Report.Errors)
                                return null;
 
+                       if (block.IsAsync && block.Original.ParametersBlock.HasCapturedThis && ec.CurrentAnonymousMethod != null && ec.CurrentAnonymousMethod.block.IsAsync) {
+                               //
+                               // We'll do ldftn to load the fabricated m_X method but
+                               // because we are inside struct the method can be hoisted
+                               // anywhere in the parent scope
+                               //
+                               ec.CurrentBlock.ParametersBlock.HasReferenceToStoreyForInstanceLambdas = true;
+                       }
+
                        return res ? this : null;
                }
 
@@ -1798,6 +1807,8 @@ namespace Mono.CSharp {
                                                        parent = storey = sm;
                                                }
                                        }
+                               } else if (src_block.ParametersBlock.HasReferenceToStoreyForInstanceLambdas) {
+                                       src_block.ParametersBlock.StateMachine.AddParentStoreyReference (ec, storey);
                                }
 
                                modifiers = storey != null ? Modifiers.INTERNAL : Modifiers.PRIVATE;
index 85dff2b3c84fcb71651275ea08fb316c379f9d64..318d040985aad465932a8ea66ed1cc53f92dc3dc 100644 (file)
@@ -45,18 +45,16 @@ namespace Mono.CSharp
                bool IsFriendAssemblyTo (IAssemblyDefinition assembly);
        }
 
-       public class AssemblyReferenceErrorInfo
+       public class AssemblyReferenceMessageInfo
        {
-               public AssemblyReferenceErrorInfo (AssemblyName dependencyName, string location, string message)
+               public AssemblyReferenceMessageInfo (AssemblyName dependencyName, Action<Report> reportMessage)
                {
                        this.DependencyName = dependencyName;
-                       this.RequestingAssemblyLocation = location;
-                       this.Message = message;
+                       this.ReportMessage = reportMessage;
                }
 
                public AssemblyName DependencyName { get; private set; }
-               public string RequestingAssemblyLocation { get; private set; }
-               public string Message { get; private set; }
+               public Action<Report> ReportMessage { get; private set; }
        }
                 
        public abstract class AssemblyDefinition : IAssemblyDefinition
@@ -456,8 +454,7 @@ namespace Mono.CSharp
                                                // due to type-forwarding
                                                //
                                                if (references.Any (l => l.Name == r.DependencyName.Name)) {
-                                                       Report.SymbolRelatedToPreviousError (r.RequestingAssemblyLocation);
-                                                       Report.Error (1705, r.Message);
+                                                       r.ReportMessage (Report);
                                                }
                                        }
                                }
@@ -592,7 +589,7 @@ namespace Mono.CSharp
                        return public_key_token;
                }
 
-               protected virtual List<AssemblyReferenceErrorInfo> GetNotUnifiedReferences (AssemblyName assemblyName)
+               protected virtual List<AssemblyReferenceMessageInfo> GetNotUnifiedReferences (AssemblyName assemblyName)
                {
                        return null;
                }
index 37039f81ef460cb3d6cae1f631522ea664e5c1c8..e5d0b1f173584fe1676d1379efa1df8a35346731 100644 (file)
@@ -22,7 +22,7 @@ using System.Text;
 using System.Diagnostics;
 using Mono.CompilerServices.SymbolWriter;
 
-#if NET_2_1
+#if MOBILE
 using XmlElement = System.Object;
 #endif
 
@@ -297,6 +297,10 @@ namespace Mono.CSharp
                                                throw new InternalErrorException (tc, e);
                                        }
                                }
+
+                               if (PartialContainer != null && PartialContainer != this) {
+                                       containers = null;
+                               }
                        }
 
                        return true;
@@ -1661,6 +1665,8 @@ namespace Mono.CSharp
 
                public override void ExpandBaseInterfaces ()
                {
+                       DoResolveTypeParameters ();
+
                        if (!IsPartialPart)
                                DoExpandBaseInterfaces ();
 
@@ -1766,8 +1772,6 @@ namespace Mono.CSharp
                protected override void DoDefineContainer ()
                {
                        DefineBaseTypes ();
-
-                       DoResolveTypeParameters ();
                }
 
                //
index a0ae78cdf518e42737b571c830e08a99adf00747..c16a0aa1c970df6a48d579c56ce5f32731e29ba6 100644 (file)
@@ -478,7 +478,7 @@ namespace Mono.CSharp {
                        catch
                        {
                                ec.Report.Error (31, loc, "Constant value `{0}' cannot be converted to a `{1}'",
-                                       GetValue ().ToString (), target.GetSignatureForError ());
+                                       GetValueAsLiteral (), target.GetSignatureForError ());
                        }
                }
 
@@ -1697,7 +1697,7 @@ namespace Mono.CSharp {
 
                public override string GetValueAsLiteral ()
                {
-                       return Value.ToString ();
+                       return Value.ToString (CultureInfo.InvariantCulture);
                }
 
                public override long GetValueAsLong ()
@@ -1820,7 +1820,7 @@ namespace Mono.CSharp {
 
                public override string GetValueAsLiteral ()
                {
-                       return Value.ToString ();
+                       return Value.ToString (CultureInfo.InvariantCulture);
                }
 
                public override long GetValueAsLong ()
@@ -2021,7 +2021,7 @@ namespace Mono.CSharp {
 
                public override string GetValueAsLiteral ()
                {
-                       return Value.ToString () + "M";
+                       return Value.ToString (CultureInfo.InvariantCulture) + "M";
                }
 
                public override long GetValueAsLong ()
@@ -2149,11 +2149,6 @@ namespace Mono.CSharp {
                        this.name = name;
                }
 
-               static void Error_MethodGroupWithTypeArguments (ResolveContext rc, Location loc)
-               {
-                       rc.Report.Error (8084, loc, "An argument to nameof operator cannot be method group with type arguments");
-               }
-
                protected override Expression DoResolve (ResolveContext rc)
                {
                        throw new NotSupportedException ();
@@ -2169,9 +2164,9 @@ namespace Mono.CSharp {
                                        rc.Report.FeatureIsNotAvailable (rc.Module.Compiler, Location, "nameof operator");
 
                                var res = sn.LookupNameExpression (rc, MemberLookupRestrictions.IgnoreAmbiguity | MemberLookupRestrictions.NameOfExcluded);
-                               if (sn.HasTypeArguments && res is MethodGroupExpr) {
-                                       Error_MethodGroupWithTypeArguments (rc, expr.Location);
-                               }
+                               var me = res as MemberExpr;
+                               if (me != null)
+                                       me.ResolveNameOf (rc, sn);
 
                                return true;
                        }
@@ -2197,20 +2192,9 @@ namespace Mono.CSharp {
                                        return false;
                                }
 
-                               var mg = res as MethodGroupExpr;
-                               if (mg != null) {
-                                       var emg = res as ExtensionMethodGroupExpr;
-                                       if (emg != null && !emg.ResolveNameOf (rc, ma)) {
-                                               return true;
-                                       }
-
-                                       if (!mg.HasAccessibleCandidate (rc)) {
-                                               ErrorIsInaccesible (rc, ma.GetSignatureForError (), loc);
-                                       }
-
-                                       if (ma.HasTypeArguments) {
-                                               Error_MethodGroupWithTypeArguments (rc, ma.Location);
-                                       }
+                               var me = res as MemberExpr;
+                               if (me != null) {
+                                       me.ResolveNameOf (rc, ma);
                                }
 
                                //
index b2399c8bd89d45c71aee3882c56bb09c8fddd2e1..ddcb149f942a7c818e78b848558ae693882132d1 100644 (file)
@@ -526,6 +526,19 @@ namespace Mono.CSharp
                        return da;
                }
 
+               public Dictionary<Statement, List<DefiniteAssignmentBitSet>> CopyLabelStack ()
+               {
+                       if (LabelStack == null)
+                               return null;
+
+                       var dest = new Dictionary<Statement, List<DefiniteAssignmentBitSet>> ();
+                       foreach (var entry in LabelStack) {
+                               dest.Add (entry.Key, new List<DefiniteAssignmentBitSet> (entry.Value));
+                       }
+
+                       return dest;
+               }
+
                public bool IsDefinitelyAssigned (VariableInfo variable)
                {
                        return variable.IsAssigned (DefiniteAssignment);
@@ -536,6 +549,11 @@ namespace Mono.CSharp
                        return variable.IsStructFieldAssigned (DefiniteAssignment, name);
                }
 
+               public void SetLabelStack (Dictionary<Statement, List<DefiniteAssignmentBitSet>> labelStack)
+               {
+                       LabelStack = labelStack;
+               }
+
                public void SetVariableAssigned (VariableInfo variable, bool generatedAssignment = false)
                {
                        variable.SetAssigned (DefiniteAssignment, generatedAssignment);
@@ -656,13 +674,13 @@ namespace Mono.CSharp
                        if (all_source_files == null) {
                                all_source_files = new Dictionary<string, SourceFile> ();
                                foreach (var source in SourceFiles)
-                                       all_source_files[source.FullPathName] = source;
+                                       all_source_files[source.OriginalFullPathName] = source;
                        }
 
                        string path;
                        if (!Path.IsPathRooted (name)) {
                                var loc = comp_unit.SourceFile;
-                               string root = Path.GetDirectoryName (loc.FullPathName);
+                               string root = Path.GetDirectoryName (loc.OriginalFullPathName);
                                path = Path.GetFullPath (Path.Combine (root, name));
                                var dir = Path.GetDirectoryName (loc.Name);
                                if (!string.IsNullOrEmpty (dir))
index cd7ce1ac68fe34b998cd241d6f2d6783873866ea..e6a95fe8163a3590acb9f23602cc10d4cdec63dd 100644 (file)
@@ -2465,6 +2465,12 @@ namespace Mono.CSharp
                                case '\"':
                                        ++str_quote;
                                        break;
+                               case '\\':
+                                       // Skip escaped " character
+                                       c = reader.Read ();
+                                       if (c == -1)
+                                               res = false;
+                                       break;
                                case -1:
                                        res = false;
                                        break;
@@ -2547,7 +2553,7 @@ namespace Mono.CSharp
                                                id_builder [pos] = (char)c;
 
                                                if (c >= '0' && c <= '9') {
-                                                       if (pos == 6 && id_builder [0] == 'C' && id_builder [1] == 'S') {
+                                                       if (pos == 5 && id_builder [0] == 'C' && id_builder [1] == 'S') {
                                                                // Recognize CSXXXX as C# XXXX warning
                                                                number = 0;
                                                                int pow = 1000;
@@ -2562,6 +2568,9 @@ namespace Mono.CSharp
                                                                        pow /= 10;
                                                                }
                                                        }
+                                               } else if (c == '\n' || c == UnicodeLS || c == UnicodePS) {
+                                                       advance_line ();
+                                                       break;
                                                } else if ((c < 'a' || c > 'z') && (c < 'A' || c > 'Z') && c != '_') {
                                                        break;
                                                }
@@ -2587,9 +2596,6 @@ namespace Mono.CSharp
                                while (c == ' ' || c == '\t')
                                        c = get_char ();
 
-                               if (c == '\n' || c == UnicodeLS || c == UnicodePS)
-                                       advance_line ();
-
                                return number;
                        }
 
index 3f88a5935c00d273a3ed3f2fc5995b4cc456f7d0..340eb488ab08c6a37f1d52cae579f9e7edb38643 100644 (file)
@@ -18,7 +18,7 @@ using System.Diagnostics;
 using System.Text;
 using Mono.CompilerServices.SymbolWriter;
 
-#if NET_2_1
+#if MOBILE
 using XmlElement = System.Object;
 #else
 using System.Xml;
index 848dfc47fa41c706dab80e91ab18b6056ac0b977..ae60ff4031b669964a8da0ac3ac3d503cec9bf55 100644 (file)
@@ -11,7 +11,7 @@
 //
 //
 
-#if BOOTSTRAP_WITH_OLDLIB || NET_2_1
+#if BOOTSTRAP_WITH_OLDLIB || MOBILE
 
 using XmlElement = System.Object;
 
index 42eba97ee475763eb15186ea8a25bbe36fc1fca9..8475a9e489428c0d98d91267b7b40954a54be3c2 100644 (file)
@@ -841,22 +841,29 @@ namespace Mono.CSharp {
                public static Expression MemberLookup (IMemberContext rc, bool errorMode, TypeSpec queried_type, string name, int arity, MemberLookupRestrictions restrictions, Location loc)
                {
                        var members = MemberCache.FindMembers (queried_type, name, false);
-                       if (members == null)
-                               return null;
 
-                       Expression expr;
-                       do {
-                               expr = MemberLookupToExpression (rc, members, errorMode, queried_type, name, arity, restrictions, loc);
-                               if (expr != null)
-                                       return expr;
+                       if (members != null) {
+                               Expression expr;
+                               do {
+                                       expr = MemberLookupToExpression (rc, members, errorMode, queried_type, name, arity, restrictions, loc);
+                                       if (expr != null)
+                                               return expr;
 
-                               if (members [0].DeclaringType.BaseType == null)
-                                       members = null;
-                               else
-                                       members = MemberCache.FindMembers (members [0].DeclaringType.BaseType, name, false);
-                       } while (members != null);
+                                       if (members [0].DeclaringType.BaseType == null)
+                                               members = null;
+                                       else
+                                               members = MemberCache.FindMembers (members [0].DeclaringType.BaseType, name, false);
+                               } while (members != null);
+                       }
 
-                       return expr;
+                       var tps = queried_type as TypeParameterSpec;
+                       if (tps != null) {
+                               members = MemberCache.FindInterfaceMembers (tps, name);
+                               if (members != null)
+                                       return MemberLookupToExpression (rc, members, errorMode, queried_type, name, arity, restrictions, loc);
+                       }
+
+                       return null;
                }
 
                public static Expression MemberLookupToExpression (IMemberContext rc, IList<MemberSpec> members, bool errorMode, TypeSpec queried_type, string name, int arity, MemberLookupRestrictions restrictions, Location loc)
@@ -901,15 +908,6 @@ namespace Mono.CSharp {
 
                                if ((restrictions & MemberLookupRestrictions.InvocableOnly) != 0) {
                                        if (member is MethodSpec) {
-                                               //
-                                               // Interface members that are hidden by class members are removed from the set. This
-                                               // step only has an effect if T is a type parameter and T has both an effective base 
-                                               // class other than object and a non-empty effective interface set
-                                               //
-                                               var tps = queried_type as TypeParameterSpec;
-                                               if (tps != null && tps.HasTypeConstraint)
-                                                       members = RemoveHiddenTypeParameterMethods (members);
-
                                                return new MethodGroupExpr (members, queried_type, loc);
                                        }
 
@@ -959,57 +957,6 @@ namespace Mono.CSharp {
                        return null;
                }
 
-               static IList<MemberSpec> RemoveHiddenTypeParameterMethods (IList<MemberSpec> members)
-               {
-                       if (members.Count < 2)
-                               return members;
-
-                       //
-                       // If M is a method, then all non-method members declared in an interface declaration
-                       // are removed from the set, and all methods with the same signature as M declared in
-                       // an interface declaration are removed from the set
-                       //
-
-                       bool copied = false;
-                       for (int i = 0; i < members.Count; ++i) {
-                               var method = members[i] as MethodSpec;
-                               if (method == null) {
-                                       if (!copied) {
-                                               copied = true;
-                                               members = new List<MemberSpec> (members);
-                                       } 
-                                       
-                                       members.RemoveAt (i--);
-                                       continue;
-                               }
-
-                               if (!method.DeclaringType.IsInterface)
-                                       continue;
-
-                               for (int ii = 0; ii < members.Count; ++ii) {
-                                       var candidate = members[ii] as MethodSpec;
-                                       if (candidate == null || !candidate.DeclaringType.IsClass)
-                                               continue;
-
-                                       if (!TypeSpecComparer.Override.IsEqual (candidate.Parameters, method.Parameters))
-                                               continue;
-
-                                       if (!AParametersCollection.HasSameParameterDefaults (candidate.Parameters, method.Parameters))
-                                               continue;
-
-                                       if (!copied) {
-                                               copied = true;
-                                               members = new List<MemberSpec> (members);
-                                       }
-
-                                       members.RemoveAt (i--);
-                                       break;
-                               }
-                       }
-
-                       return members;
-               }
-
                protected static void Error_NamedArgument (NamedArgument na, Report Report)
                {
                        Report.Error (1742, na.Location, "An element access expression cannot use named argument");
@@ -3701,6 +3648,11 @@ namespace Mono.CSharp {
                        return this;
                }
 
+               public virtual void ResolveNameOf (ResolveContext rc, ATypeNameExpression expr)
+               {
+
+               }
+
                protected void EmitInstance (EmitContext ec, bool prepare_for_load)
                {
                        var inst = new InstanceEmitter (InstanceExpression, TypeSpec.IsValueType (InstanceExpression.Type));
@@ -3776,7 +3728,7 @@ namespace Mono.CSharp {
                // For extension methodgroup we are not looking for base members but parent
                // namespace extension methods
                //
-               public override IList<MemberSpec> GetBaseMembers (TypeSpec baseType)
+               public override IList<MemberSpec> GetBaseMembers (TypeSpec type)
                {
                        // TODO: candidates are null only when doing error reporting, that's
                        // incorrect. We have to discover same extension methods in error mode
@@ -3805,27 +3757,9 @@ namespace Mono.CSharp {
                                Convert.ImplicitBoxingConversion (null, argType, extensionType) != null;
                }
 
-               public bool ResolveNameOf (ResolveContext rc, MemberAccess ma)
+               public override void ResolveNameOf (ResolveContext rc, ATypeNameExpression expr)
                {
-                       rc.Report.Error (8093, ma.Location, "An argument to nameof operator cannot be extension method group");
-
-                       // Not included in C#6
-                       /*
-                       ExtensionExpression = ExtensionExpression.Resolve (rc);
-                       if (ExtensionExpression == null)
-                               return false;
-
-                       var argType = ExtensionExpression.Type;
-                       foreach (MethodSpec candidate in Candidates) {
-                               if (ExtensionMethodGroupExpr.IsExtensionTypeCompatible (argType, candidate.Parameters.ExtensionMethodType))
-                                       return true;
-                       }
-
-                       // TODO: Scan full hierarchy
-
-                       ma.Error_TypeDoesNotContainDefinition (rc, argType, ma.Name);
-                       */
-                       return false;
+                       rc.Report.Error (8093, expr.Location, "An argument to nameof operator cannot be extension method group");
                }
 
                public override MethodGroupExpr LookupExtensionMethod (ResolveContext rc)
@@ -4226,6 +4160,17 @@ namespace Mono.CSharp {
                        return base.ResolveMemberAccess (ec, left, original);
                }
 
+               public override void ResolveNameOf (ResolveContext rc, ATypeNameExpression expr)
+               {
+                       if (!HasAccessibleCandidate (rc)) {
+                               ErrorIsInaccesible (rc, expr.GetSignatureForError (), loc);
+                       }
+
+                       if (expr.HasTypeArguments) {
+                               rc.Report.Error (8084, expr.Location, "An argument to nameof operator cannot be method group with type arguments");
+                       }
+               }
+
                public override void SetTypeArguments (ResolveContext ec, TypeArguments ta)
                {
                        type_arguments = ta;
@@ -4233,9 +4178,19 @@ namespace Mono.CSharp {
 
                #region IBaseMembersProvider Members
 
-               public virtual IList<MemberSpec> GetBaseMembers (TypeSpec baseType)
+               public virtual IList<MemberSpec> GetBaseMembers (TypeSpec type)
                {
-                       return baseType == null ? null : MemberCache.FindMembers (baseType, Methods [0].Name, false);
+                       var baseType = type.BaseType;
+                       
+                       IList<MemberSpec> members = baseType == null ? null : MemberCache.FindMembers (baseType, Methods [0].Name, false);
+
+                       if (members == null && !type.IsInterface) {
+                               var tps = queried_type as TypeParameterSpec;
+                               if (tps != null)
+                                       members = MemberCache.FindInterfaceMembers (tps, Methods [0].Name);
+                       }
+
+                       return members;
                }
 
                public IParametersMember GetOverrideMemberParameters (MemberSpec member)
@@ -4826,12 +4781,18 @@ namespace Mono.CSharp {
 
                                //
                                // A candidate with no default parameters is still better when there
-                               // is no better expression conversion
+                               // is no better expression conversion and does not have more parameters
                                //
                                if (candidate_pd.Count < best_pd.Count) {
-                                       if (!candidate_params && !candidate_pd.FixedParameters [j - j].HasDefaultValue) {
+                                       if (candidate_params)
+                                               return false;
+                                       
+                                       if (!candidate_pd.FixedParameters [j - 1].HasDefaultValue)
                                                return true;
-                                       }
+
+                                       if (best_pd.FixedParameters [j].HasDefaultValue)
+                                               return true;
+                                       
                                } else if (candidate_pd.Count == best_pd.Count) {
                                        if (candidate_params)
                                                return false;
@@ -5095,7 +5056,7 @@ namespace Mono.CSharp {
 
                                                                // The slot has been taken by positional argument
                                                                if (temp != null && !(temp is NamedArgument))
-                                                                       break;
+                                                                       return NamedArgumentsMismatch - i - 1;
                                                        }
 
                                                        if (!arg_moved) {
@@ -5267,7 +5228,7 @@ namespace Mono.CSharp {
                                                if ((fp.ModFlags & Parameter.Modifier.CallerLineNumber) != 0) {
                                                        e = new IntLiteral (ec.BuiltinTypes, loc.Row, loc);
                                                } else if ((fp.ModFlags & Parameter.Modifier.CallerFilePath) != 0) {
-                                                       e = new StringLiteral (ec.BuiltinTypes, loc.NameFullPath, loc);
+                                                       e = new StringLiteral (ec.BuiltinTypes, loc.SourceFile.GetFullPathName (ec.Module.Compiler.Settings.PathMap), loc);
                                                } else if (ec.MemberContext.CurrentMemberDefinition != null) {
                                                        e = new StringLiteral (ec.BuiltinTypes, ec.MemberContext.CurrentMemberDefinition.GetCallerMemberName (), loc);
                                                }
@@ -5632,7 +5593,7 @@ namespace Mono.CSharp {
                                                // Restore expanded arguments
                                                candidate_args = args;
                                        }
-                               } while (best_candidate_rate != 0 && (type_members = base_provider.GetBaseMembers (type_members[0].DeclaringType.BaseType)) != null);
+                               } while (best_candidate_rate != 0 && (type_members = base_provider.GetBaseMembers (type_members[0].DeclaringType)) != null);
 
                                //
                                // We've found exact match
@@ -6196,6 +6157,11 @@ namespace Mono.CSharp {
                        return constant.GetSignatureForError ();
                }
 
+               public override void ResolveNameOf (ResolveContext rc, ATypeNameExpression expr)
+               {
+                       constant.CheckObsoleteness (rc, expr.Location);
+               }
+
                public override void SetTypeArguments (ResolveContext ec, TypeArguments ta)
                {
                        Error_TypeArgumentsCannotBeUsed (ec, "constant", GetSignatureForError (), loc);
@@ -6425,6 +6391,11 @@ namespace Mono.CSharp {
                        return this;
                }
 
+               public override void ResolveNameOf (ResolveContext rc, ATypeNameExpression expr)
+               {
+                       spec.CheckObsoleteness (rc, expr.Location);
+               }
+
                public void SetFieldAssigned (FlowAnalysisContext fc)
                {
                        if (!IsInstance)
@@ -7195,6 +7166,14 @@ namespace Mono.CSharp {
                        return true;
                }
 
+               public override void ResolveNameOf (ResolveContext rc, ATypeNameExpression expr)
+               {
+                       if (!best_candidate.IsAccessible (rc))
+                               ErrorIsInaccesible (rc, best_candidate.GetSignatureForError (), expr.Location);
+
+                       best_candidate.CheckObsoleteness (rc, expr.Location);
+               }
+
                public void SetBackingFieldAssigned (FlowAnalysisContext fc)
                {
                        if (backing_field != null) {
@@ -7616,6 +7595,11 @@ namespace Mono.CSharp {
                        return TypeManager.CSharpSignature (spec);
                }
 
+               public override void ResolveNameOf (ResolveContext rc, ATypeNameExpression expr)
+               {
+                       spec.CheckObsoleteness (rc, expr.Location);
+               }
+
                public override void SetTypeArguments (ResolveContext ec, TypeArguments ta)
                {
                        Error_TypeArgumentsCannotBeUsed (ec, "event", GetSignatureForError (), loc);
index 62c02b1fd5602de8f4a01d5096f183472d3d2b9a..d4e83a506a0fcfbf1d1b00d8522173ca92f15462 100644 (file)
@@ -1134,7 +1134,7 @@ namespace Mono.CSharp
                        QuitRequested = true;
                }
 
-#if !NET_2_1
+#if !MOBILE
                /// <summary>
                ///   Describes an object or a type.
                /// </summary>
index 02ae36b34c16802d921a2476f4a1ab3d750052c3..2968ee08584f544f7869efba43e4007b9f259888 100644 (file)
@@ -2362,6 +2362,11 @@ namespace Mono.CSharp
                        eclass = ExprClass.Value;
                        TypeSpec etype = expr.Type;
 
+                       if (type == null) {
+                               type = InternalType.ErrorType;
+                               return this;
+                       }
+
                        if (!TypeSpec.IsReferenceType (type) && !type.IsNullableType) {
                                if (TypeManager.IsGenericParameter (type)) {
                                        ec.Report.Error (413, loc,
@@ -3105,9 +3110,9 @@ namespace Mono.CSharp
                        public override Expression ConvertResult (ResolveContext ec, Binary b)
                        {
                                if (left != null) {
-                                       b.left = EmptyCast.Create (b.left, left);
+                                       b.left = Convert.UserDefinedConversion (ec, b.left, left, Convert.UserConversionRestriction.ImplicitOnly, b.loc) ?? EmptyCast.Create (b.left, left);
                                } else if (right != null) {
-                                       b.right = EmptyCast.Create (b.right, right);
+                                       b.right = Convert.UserDefinedConversion (ec, b.right, right, Convert.UserConversionRestriction.ImplicitOnly, b.loc) ?? EmptyCast.Create (b.right, right);
                                }
 
                                TypeSpec r_type = ReturnType;
@@ -10947,9 +10952,18 @@ namespace Mono.CSharp
 
                #region IBaseMembersProvider Members
 
-               IList<MemberSpec> OverloadResolver.IBaseMembersProvider.GetBaseMembers (TypeSpec baseType)
+               IList<MemberSpec> OverloadResolver.IBaseMembersProvider.GetBaseMembers (TypeSpec type)
                {
-                       return baseType == null ? null : MemberCache.FindMembers (baseType, MemberCache.IndexerNameAlias, false);
+                       var baseType = type.BaseType;
+                       var members = baseType == null ? null : MemberCache.FindMembers (baseType, MemberCache.IndexerNameAlias, false);
+
+                       if (members == null && !type.IsInterface) {
+                               var tps = queried_type as TypeParameterSpec;
+                               if (tps != null)
+                                       members = MemberCache.FindInterfaceMembers (tps, MemberCache.IndexerNameAlias);
+                       }
+
+                       return members;
                }
 
                IParametersMember OverloadResolver.IBaseMembersProvider.GetOverrideMemberParameters (MemberSpec member)
@@ -12348,6 +12362,7 @@ namespace Mono.CSharp
                        int errors = ec.Report.Errors;
                        type.CreateContainer ();
                        type.DefineContainer ();
+                       type.ExpandBaseInterfaces ();
                        type.Define ();
                        if ((ec.Report.Errors - errors) == 0) {
                                parent.Module.AddAnonymousType (type);
index b34f2dc1ec56dfbadb8ff468da7940d1f49b3ca4..fdf5b81f92c38a4ef8dba73e5c202a990383eec3 100644 (file)
@@ -773,6 +773,7 @@ namespace Mono.CSharp {
                TypeSpec[] targs;
                TypeSpec[] ifaces_defined;
                TypeSpec effective_base;
+               MemberCache interface_cache;
 
                //
                // Creates type owned type parameter
@@ -882,6 +883,12 @@ namespace Mono.CSharp {
                        }
                }
 
+               public MemberCache InterfaceCache {
+                       get {
+                               return interface_cache;
+                       }
+               }
+
                //
                // Unexpanded interfaces list
                //
@@ -1351,13 +1358,27 @@ namespace Mono.CSharp {
                        // For a type parameter the membercache is the union of the sets of members of the types
                        // specified as a primary constraint or secondary constraint
                        //
+                       bool has_user_base_type = false;
                        if (BaseType.BuiltinType != BuiltinTypeSpec.Type.Object && BaseType.BuiltinType != BuiltinTypeSpec.Type.ValueType) {
                                cache.AddBaseType (BaseType);
+                               has_user_base_type = true;
                        }
 
                        if (InterfacesDefined != null) {
+                               var icache = cache;
+                               if (has_user_base_type) {
+                                       //
+                                       // type-parameter lookup rules are more complicated that other types lookup rules.
+                                       // Effective base class and its base types member have priority over interface
+                                       // constraints which means we cannot lookup interface members before class members
+                                       // hence we setup secondary cache for such cases.
+                                       //
+                                       interface_cache = new MemberCache ();
+                                       icache = interface_cache;
+                               }
+
                                foreach (var iface_type in InterfacesDefined) {
-                                       cache.AddInterface (iface_type);
+                                       icache.AddInterface (iface_type);
                                }
                        }
 
@@ -1370,8 +1391,14 @@ namespace Mono.CSharp {
                                        var ifaces = tps == null ? ta.Interfaces : tps.InterfacesDefined;
 
                                        if (ifaces != null) {
+                                               var icache = cache;
+                                               if (has_user_base_type) {
+                                                       interface_cache = new MemberCache ();
+                                                       icache = interface_cache;
+                                               }
+
                                                foreach (var iface_type in ifaces) {
-                                                       cache.AddInterface (iface_type);
+                                                       icache.AddInterface (iface_type);
                                                }
                                        }
                                }
@@ -3132,7 +3159,7 @@ namespace Mono.CSharp {
                                        var ga_u = u.TypeArguments;
                                        var ga_v = v.TypeArguments;
 
-                                       if (u.TypeArguments.Length != u.TypeArguments.Length)
+                                       if (u.TypeArguments.Length != v.TypeArguments.Length)
                                                return 0;
 
                                        int score = 0;
index f4b9930f3999e8c3395d53a4319744d1130492c0..14824d136b63f814975bdcedd6be3580593ce98e 100644 (file)
@@ -220,7 +220,7 @@ namespace Mono.CSharp
                        return Builder.__AddModule (moduleFile);
                }
 
-               protected override List<AssemblyReferenceErrorInfo> GetNotUnifiedReferences (AssemblyName assemblyName)
+               protected override List<AssemblyReferenceMessageInfo> GetNotUnifiedReferences (AssemblyName assemblyName)
                {
                        return loader.GetNotUnifiedReferences (assemblyName);
                }
@@ -238,7 +238,7 @@ namespace Mono.CSharp
                Assembly corlib;
                readonly List<Tuple<AssemblyName, string, Assembly>> loaded_names;
                static readonly Dictionary<string, string[]> sdk_directory;
-               Dictionary<AssemblyName, List<AssemblyReferenceErrorInfo>> resolved_version_mismatches;
+               Dictionary<AssemblyName, List<AssemblyReferenceMessageInfo>> resolved_version_mismatches;
                static readonly TypeName objectTypeName = new TypeName ("System", "Object");
 
                static StaticLoader ()
@@ -356,42 +356,36 @@ namespace Mono.CSharp
                        }
 
                        if (version_mismatch != null) {
-                               if (version_mismatch is AssemblyBuilder)
+                               if (is_fx_assembly || version_mismatch is AssemblyBuilder)
                                        return version_mismatch;
 
                                var ref_an = new AssemblyName (refname);
                                var v1 = ref_an.Version;
                                var v2 = version_mismatch.GetName ().Version;
+                               AssemblyReferenceMessageInfo messageInfo;
 
                                if (v1 > v2) {
-                                       if (resolved_version_mismatches == null)
-                                               resolved_version_mismatches = new Dictionary<AssemblyName, List<AssemblyReferenceErrorInfo>> ();
-
-                                       var an = args.RequestingAssembly.GetName ();
-                                       List<AssemblyReferenceErrorInfo> names;
-                                       if (!resolved_version_mismatches.TryGetValue (an, out names)) {
-                                               names = new List<AssemblyReferenceErrorInfo> ();
-                                               resolved_version_mismatches.Add (an, names);
-                                       }
-
-                                       names.Add (new AssemblyReferenceErrorInfo (ref_an, args.RequestingAssembly.Location,
-                                               string.Format ("Assembly `{0}' depends on `{1}' which has a higher version number than referenced assembly `{2}'",
-                                                          args.RequestingAssembly.FullName, refname, version_mismatch.GetName ().FullName)));
-
-                                       return version_mismatch;
+                                       messageInfo = new AssemblyReferenceMessageInfo (ref_an, report => {
+                                               report.SymbolRelatedToPreviousError (args.RequestingAssembly.Location);
+                                               report.Error (1705, string.Format ("Assembly `{0}' depends on `{1}' which has a higher version number than referenced assembly `{2}'",
+                                                                                                                  args.RequestingAssembly.FullName, refname, version_mismatch.GetName ().FullName));
+                                       });
+
+                               } else {
+                                       messageInfo = new AssemblyReferenceMessageInfo (ref_an, report => {
+                                               if (v1.Major != v2.Major || v1.Minor != v2.Minor) {
+                                                       report.Warning (1701, 2,
+                                                               "Assuming assembly reference `{0}' matches assembly `{1}'. You may need to supply runtime policy",
+                                                               refname, version_mismatch.GetName ().FullName);
+                                               } else {
+                                                       report.Warning (1702, 3,
+                                                               "Assuming assembly reference `{0}' matches assembly `{1}'. You may need to supply runtime policy",
+                                                               refname, version_mismatch.GetName ().FullName);
+                                               }
+                                       });
                                }
 
-                               if (!is_fx_assembly) {
-                                       if (v1.Major != v2.Major || v1.Minor != v2.Minor) {
-                                               compiler.Report.Warning (1701, 2,
-                                                       "Assuming assembly reference `{0}' matches assembly `{1}'. You may need to supply runtime policy",
-                                                       refname, version_mismatch.GetName ().FullName);
-                                       } else {
-                                               compiler.Report.Warning (1702, 3,
-                                                       "Assuming assembly reference `{0}' matches assembly `{1}'. You may need to supply runtime policy",
-                                                       refname, version_mismatch.GetName ().FullName);
-                                       }
-                               }
+                               AddReferenceVersionMismatch (args.RequestingAssembly.GetName (), messageInfo);
 
                                return version_mismatch;
                        }
@@ -409,6 +403,20 @@ namespace Mono.CSharp
                        return domain.CreateMissingAssembly (args.Name);
                }
 
+               void AddReferenceVersionMismatch (AssemblyName an, AssemblyReferenceMessageInfo errorInfo)
+               {
+                       if (resolved_version_mismatches == null)
+                               resolved_version_mismatches = new Dictionary<AssemblyName, List<AssemblyReferenceMessageInfo>> ();
+
+                       List<AssemblyReferenceMessageInfo> names;
+                       if (!resolved_version_mismatches.TryGetValue (an, out names)) {
+                               names = new List<AssemblyReferenceMessageInfo> ();
+                               resolved_version_mismatches.Add (an, names);
+                       }
+
+                       names.Add (errorInfo);
+               }
+
                public void Dispose ()
                {
                        domain.Dispose ();
@@ -433,9 +441,9 @@ namespace Mono.CSharp
                        return default_references.ToArray ();
                }
 
-               public List<AssemblyReferenceErrorInfo> GetNotUnifiedReferences (AssemblyName assemblyName)
+               public List<AssemblyReferenceMessageInfo> GetNotUnifiedReferences (AssemblyName assemblyName)
                {
-                       List<AssemblyReferenceErrorInfo> list = null;
+                       List<AssemblyReferenceMessageInfo> list = null;
                        if (resolved_version_mismatches != null)
                                resolved_version_mismatches.TryGetValue (assemblyName, out list);
 
index 60073b9f4c1338929c6098c9a28f861d36534132..9518427e1a17c1fe1499516410ea4c9fde28a893 100644 (file)
@@ -142,6 +142,7 @@ namespace Mono.CSharp
                        compiled_types = new Dictionary<MetaType, TypeSpec> (40, ReferenceEquality<MetaType>.Default);
                        assembly_2_definition = new Dictionary<Assembly, IAssemblyDefinition> (ReferenceEquality<Assembly>.Default);
                        IgnorePrivateMembers = true;
+                       IgnoreCompilerGeneratedField = true;
                }
 
                #region Properties
@@ -154,6 +155,8 @@ namespace Mono.CSharp
 
                public bool IgnorePrivateMembers { get; set; }
 
+               public bool IgnoreCompilerGeneratedField { get; set; }
+
                #endregion
 
                public abstract void AddCompiledType (TypeBuilder builder, TypeSpec spec);
@@ -179,8 +182,10 @@ namespace Mono.CSharp
                                        break;
                                default:
                                        // Ignore private fields (even for error reporting) to not require extra dependencies
-                                       if ((IgnorePrivateMembers && !declaringType.IsStruct) ||
-                                               HasAttribute (CustomAttributeData.GetCustomAttributes (fi), "CompilerGeneratedAttribute", CompilerServicesNamespace))
+                                       if (IgnorePrivateMembers && !declaringType.IsStruct)
+                                               return null;
+
+                                       if (IgnoreCompilerGeneratedField && HasAttribute (CustomAttributeData.GetCustomAttributes (fi), "CompilerGeneratedAttribute", CompilerServicesNamespace))
                                                return null;
 
                                        mod = Modifiers.PRIVATE;
index 47919ec8ce2b5fda133bddbb93509096ba9ef671..0b6fc1abf7722452569bed9c6c1ae75ac2815296 100644 (file)
@@ -254,7 +254,7 @@ namespace Mono.CSharp
                        // Special format which encodes original variable name and
                        // it's scope to support lifted variables debugging. This
                        // is same what csc does and allows to correctly set fields
-                       // scope information (like ambiguity, our of scope, etc).
+                       // scope information (like ambiguity, out of scope, etc).
                        //
                        var id = rc.CurrentBlock.Explicit.GetDebugSymbolScopeIndex ();
                        return "<" + local_info.Name + ">__" + id;
@@ -1067,6 +1067,7 @@ namespace Mono.CSharp
 
                        method.Block = new ToplevelBlock (method.Compiler, method.ParameterInfo, loc,
                                ToplevelBlock.Flags.CompilerGenerated | ToplevelBlock.Flags.NoFlowAnalysis);
+
                        method.Block.AddStatement (new TryFinallyBlockProxyStatement (this, block));
 
                        // Cannot it add to storey because it'd be emitted before nested
index 79cee3cbf7db1dc87fb77e5acfa57ccfa3259f10..658f3b765fa4f48f4e9e1bce1787cca9a387e215 100644 (file)
@@ -15,6 +15,7 @@ using System.Collections.Generic;
 using Mono.CompilerServices.SymbolWriter;
 using System.Diagnostics;
 using System.Linq;
+using System.IO;
 
 namespace Mono.CSharp
 {
@@ -55,7 +56,7 @@ namespace Mono.CSharp
                static readonly byte[] MD5Algorith = { 96, 166, 110, 64, 207, 100, 130, 76, 182, 240, 66, 212, 129, 114, 167, 153 };
 
                public readonly string Name;
-               public readonly string FullPathName;
+               public readonly string OriginalFullPathName;
                public readonly int Index;
                public bool AutoGenerated;
 
@@ -67,7 +68,7 @@ namespace Mono.CSharp
                {
                        this.Index = index;
                        this.Name = name;
-                       this.FullPathName = path;
+                       this.OriginalFullPathName = path;
                }
 
                public byte[] Checksum {
@@ -99,21 +100,43 @@ namespace Mono.CSharp
                        this.checksum = checksum;
                }
 
-               public SourceFileEntry CreateSymbolInfo (MonoSymbolFile symwriter)
+               public SourceFileEntry CreateSymbolInfo (MonoSymbolFile symwriter, List<KeyValuePair<string, string>> pathMap)
                {
                        if (hidden_lines != null)
                                hidden_lines.Sort ();
 
-                       file = new SourceFileEntry (symwriter, FullPathName, algGuid, checksum);
+                       file = new SourceFileEntry (symwriter, GetFullPathName (pathMap), OriginalFullPathName, algGuid, checksum);
                        if (AutoGenerated)
                                file.SetAutoGenerated ();
 
                        return file;
                }
 
+               public string GetFullPathName (List<KeyValuePair<string, string>> pathMap)
+               {
+                       var path = OriginalFullPathName;
+                       if (pathMap != null) {
+                               foreach (var map in pathMap) {
+                                       var prefix = map.Key;
+                                       if (path.Length <= prefix.Length)
+                                               continue;
+
+                                       if (path [prefix.Length] != Path.DirectorySeparatorChar)
+                                               continue;
+
+                                       if (!path.StartsWith (prefix, StringComparison.Ordinal))
+                                               continue;
+
+                                       path = map.Value + path.Substring (prefix.Length);
+                               }
+                       }
+
+                       return path;
+               }
+
                public bool Equals (SourceFile other)
                {
-                       return FullPathName == other.FullPathName;
+                       return OriginalFullPathName == other.OriginalFullPathName;
                }
 
                public bool IsHiddenLocation (Location loc)
@@ -142,7 +165,7 @@ namespace Mono.CSharp
 
                public override string ToString ()
                {
-                       return String.Format ("SourceFile ({0}:{1}:{2})", Name, FullPathName, Index);
+                       return String.Format ("SourceFile ({0}:{1}:{2})", Name, OriginalFullPathName, Index);
                }
        }
 
@@ -326,10 +349,10 @@ namespace Mono.CSharp
                public string NameFullPath {
                        get {
                                int index = File;
-                               if (token == 0 || index <= 0)
+                               if (index <= 0)
                                        return null;
 
-                               return source_list[index - 1].FullPathName;
+                               return source_list[index - 1].OriginalFullPathName;
                        }
                }
 
@@ -369,18 +392,6 @@ if (checkpoints.Length <= CheckpointIndex) throw new Exception (String.Format ("
                        }
                }
 
-               // The ISymbolDocumentWriter interface is used by the symbol writer to
-               // describe a single source file - for each source file there's exactly
-               // one corresponding ISymbolDocumentWriter instance.
-               //
-               // This class has an internal hash table mapping source document names
-               // to such ISymbolDocumentWriter instances - so there's exactly one
-               // instance per document.
-               //
-               // This property returns the ISymbolDocumentWriter instance which belongs
-               // to the location's source file.
-               //
-               // If we don't have a symbol writer, this property is always null.
                public SourceFile SourceFile {
                        get {
                                int index = File;
index 46bedb4861240da0ed221219b55b8388781c1602..e55c24010023a99993a9405eab3a4f41de5663d9 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;STATIC;NO_SYMBOL_WRITER;NO_AUTHENTICODE;MONO_FEATURE_THREAD_ABORT;MONO_FEATURE_PROCESS_START;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;STATIC;NO_SYMBOL_WRITER;NO_AUTHENTICODE;MONO_FEATURE_THREAD_ABORT;MONO_FEATURE_PROCESS_START;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>STATIC;NO_SYMBOL_WRITER;NO_AUTHENTICODE;MONO_FEATURE_THREAD_ABORT;MONO_FEATURE_PROCESS_START;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>STATIC;NO_SYMBOL_WRITER;NO_AUTHENTICODE;MONO_FEATURE_THREAD_ABORT;MONO_FEATURE_PROCESS_START;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 8ada0a97071a327cd2c8433a09eb654d904633bd..d3b0f86d8164bd2338d66fe6ca7a8df689bf07cc 100644 (file)
@@ -406,8 +406,13 @@ namespace Mono.CSharp {
 
                public static MemberSpec FindMember (TypeSpec container, MemberFilter filter, BindingRestriction restrictions)
                {
+                       if (filter.Kind == MemberKind.Method && container.Kind == MemberKind.TypeParameter && filter.Parameters == null)
+                               throw new NotSupportedException ("type parameters methods cannot be lookup up due to two stage setup");
+
+                       IList<MemberSpec> applicable;
+                       var top_container = container;
+
                        do {
-                               IList<MemberSpec> applicable;
                                if (container.MemberCache.member_hash.TryGetValue (filter.Name, out applicable)) {
                                        // Start from the end because interface members are in reverse order
                                        for (int i = applicable.Count - 1; i >= 0; i--) {
@@ -438,6 +443,26 @@ namespace Mono.CSharp {
                                container = container.BaseType;
                        } while (container != null);
 
+                       var tps = top_container as TypeParameterSpec;
+                       if (tps != null && tps.InterfaceCache != null) {
+                               if (tps.InterfaceCache.member_hash.TryGetValue (filter.Name, out applicable)) {
+                                       for (int i = applicable.Count - 1; i >= 0; i--) {
+                                               var entry = applicable [i];
+
+                                               if ((restrictions & BindingRestriction.NoAccessors) != 0 && entry.IsAccessor)
+                                                       continue;
+
+                                               if ((restrictions & BindingRestriction.OverrideOnly) != 0 && (entry.Modifiers & Modifiers.OVERRIDE) == 0)
+                                                       continue;
+
+                                               if (!filter.Equals (entry))
+                                                       continue;
+
+                                               return entry;
+                                       }
+                               }
+                       }
+
                        return null;
                }
 
@@ -450,9 +475,9 @@ namespace Mono.CSharp {
                //
                public static IList<MemberSpec> FindMembers (TypeSpec container, string name, bool declaredOnlyClass)
                {
-                       IList<MemberSpec> applicable;
-
                        do {
+                               IList<MemberSpec> applicable;
+                               
                                if (container.MemberCache.member_hash.TryGetValue (name, out applicable) || declaredOnlyClass)
                                        return applicable;
 
@@ -462,6 +487,17 @@ namespace Mono.CSharp {
                        return null;
                }
 
+               public static IList<MemberSpec> FindInterfaceMembers (TypeParameterSpec typeParameter, string name)
+               {
+                       if (typeParameter.InterfaceCache != null) {
+                               IList<MemberSpec> applicable;
+                               typeParameter.InterfaceCache.member_hash.TryGetValue (name, out applicable);
+                               return applicable;
+                       }
+
+                       return null;
+               }
+
                //
                // Finds the nested type in container
                //
@@ -988,6 +1024,7 @@ namespace Mono.CSharp {
                                                                                shared_list = false;
                                                                                prev = new List<MemberSpec> (found.Count + 1);
                                                                                prev.AddRange (found);
+                                                                               found = prev;
                                                                        } else {
                                                                                prev = (List<MemberSpec>) found;
                                                                        }
index e6213c7e43e3228c2bad5d7548640d2ecbd54599..3adb36f327ccf0fb5cec0338e347f2be68c23687 100644 (file)
@@ -21,7 +21,7 @@ using System.Linq;
 using Mono.CompilerServices.SymbolWriter;
 using System.Runtime.CompilerServices;
 
-#if NET_2_1
+#if MOBILE
 using XmlElement = System.Object;
 #else
 using System.Xml;
index b5379056ee7f9ae38bc0166c9c8f191465762f2f..5384ee1368607a30ea61290b5f19610aa15349e0 100644 (file)
@@ -624,8 +624,8 @@ namespace Mono.CSharp {
                        if (include_files == null)
                                include_files = new Dictionary<string, SourceFile> ();
 
-                       if (!include_files.ContainsKey (file.FullPathName))
-                               include_files.Add (file.FullPathName, file);
+                       if (!include_files.ContainsKey (file.OriginalFullPathName))
+                               include_files.Add (file.OriginalFullPathName, file);
                }
 
                public void AddDefine (string value)
@@ -648,7 +648,7 @@ namespace Mono.CSharp {
                {
                        var sw = Module.DeclaringAssembly.SymbolWriter;
                        if (sw != null) {
-                               CreateUnitSymbolInfo (sw);
+                               CreateUnitSymbolInfo (sw, Compiler.Settings.PathMap);
                        }
 
                        base.PrepareEmit ();
@@ -657,14 +657,14 @@ namespace Mono.CSharp {
                //
                // Creates symbol file index in debug symbol file
                //
-               void CreateUnitSymbolInfo (MonoSymbolFile symwriter)
+               void CreateUnitSymbolInfo (MonoSymbolFile symwriter, List<KeyValuePair<string, string>> pathMap)
                {
-                       var si = file.CreateSymbolInfo (symwriter);
+                       var si = file.CreateSymbolInfo (symwriter, pathMap);
                        comp_unit = new CompileUnitEntry (symwriter, si);
 
                        if (include_files != null) {
                                foreach (SourceFile include in include_files.Values) {
-                                       si = include.CreateSymbolInfo (symwriter);
+                                       si = include.CreateSymbolInfo (symwriter, pathMap);
                                        comp_unit.AddFile (si);
                                }
                        }
index 94e9b6baf043f36d20efd23bba912a6238f3b16f..6b1990e1f0983d87bd8b91d0f60dee7efe51129c 100644 (file)
@@ -17,7 +17,7 @@ using System.Collections.Generic;
 using System.Text;
 using Mono.CompilerServices.SymbolWriter;
 
-#if NET_2_1
+#if MOBILE
 using XmlElement = System.Object;
 #endif
 
@@ -1210,12 +1210,11 @@ namespace Mono.CSharp
 
                        backing_field = new Field (Parent,
                                new TypeExpression (MemberType, Location),
-                               Modifiers.BACKING_FIELD | Modifiers.COMPILER_GENERATED | Modifiers.PRIVATE | (ModFlags & (Modifiers.STATIC | Modifiers.UNSAFE)),
+                               Modifiers.BACKING_FIELD | Modifiers.COMPILER_GENERATED | Modifiers.DEBUGGER_HIDDEN | Modifiers.PRIVATE | (ModFlags & (Modifiers.STATIC | Modifiers.UNSAFE)),
                                MemberName, null);
 
                        Parent.PartialContainer.Members.Add (backing_field);
                        backing_field.Initializer = Initializer;
-                       backing_field.ModFlags &= ~Modifiers.COMPILER_GENERATED;
 
                        // Call define because we passed fields definition
                        backing_field.Define ();
index 1210ae4221a40a47fb53c67390239a86931dc280..c7bcb479dbc3b17931b12cf3a08d66220617d8ce 100644 (file)
@@ -418,7 +418,7 @@ namespace Mono.CSharp
 
                        default_references.Add ("System");
                        default_references.Add ("System.Xml");
-#if NET_2_1
+#if MOBILE
                        default_references.Add ("System.Net");
                        default_references.Add ("System.Windows");
                        default_references.Add ("System.Windows.Browser");
index 74bbb46c640cf42053a1d096fd4472a61804934b..afa4f75bd84865f72666678e53685c0c31df5462 100644 (file)
@@ -61,12 +61,10 @@ namespace Mono.CSharp {
                        8009, 8094
                };
 
-               static HashSet<int> AllWarningsHashSet;
-
                public Report (CompilerContext context, ReportPrinter printer)
                {
                        if (context == null)
-                               throw new ArgumentNullException ("settings");
+                               throw new ArgumentNullException ("context");
                        if (printer == null)
                                throw new ArgumentNullException ("printer");
 
@@ -175,18 +173,6 @@ namespace Mono.CSharp {
                        extra_information.Add (msg);
                }
 
-               public bool CheckWarningCode (int code, Location loc)
-               {
-                       if (AllWarningsHashSet == null)
-                               AllWarningsHashSet = new HashSet<int> (AllWarnings);
-
-                       if (AllWarningsHashSet.Contains (code))
-                               return true;
-
-                       Warning (1691, 1, loc, "`{0}' is not a valid warning number", code);
-                       return false;
-               }
-
                public void ExtraInformation (Location loc, string msg)
                {
                        extra_information.Add (String.Format ("{0} {1}", loc, msg));
@@ -1109,8 +1095,7 @@ namespace Mono.CSharp {
 
                public void WarningDisable (Location location, int code, Report Report)
                {
-                       if (Report.CheckWarningCode (code, location))
-                               regions.Add (new Disable (location.Row, code));
+                       regions.Add (new Disable (location.Row, code));
                }
 
                public void WarningEnable (int line)
@@ -1120,9 +1105,6 @@ namespace Mono.CSharp {
 
                public void WarningEnable (Location location, int code, CompilerContext context)
                {
-                       if (!context.Report.CheckWarningCode (code, location))
-                               return;
-
                        if (context.Settings.IsWarningDisabledGlobally (code))
                                context.Report.Warning (1635, 1, location, "Cannot restore warning `CS{0:0000}' because it was disabled globally", code);
 
index 0c199017af9b1d4e3e19624afb3563ee9b7705ca..1393bcd58f35bc0459f771ca8be3d0c9b3f6bb5a 100644 (file)
@@ -87,6 +87,8 @@ namespace Mono.CSharp {
                //
                public List<Tuple<string, string>> AssemblyReferencesAliases;
 
+               public List<KeyValuePair<string, string>> PathMap;
+
                //
                // Modules to be embedded
                //
@@ -581,7 +583,6 @@ namespace Mono.CSharp {
 
                public bool ProcessWarningsList (string text, Action<int> action)
                {
-                       bool valid = true;
                        foreach (string wid in text.Split (numeric_value_separator, StringSplitOptions.RemoveEmptyEntries)) {
                                var warning = wid;
                                if (warning.Length == 6 && warning [0] == 'C' && warning [1] == 'S')
@@ -592,15 +593,10 @@ namespace Mono.CSharp {
                                        continue;
                                }
 
-                               if (report.CheckWarningCode (id, Location.Null)) {
-                                       action (id);
-                               } else {
-                                       report.Error (1904, "`{0}' is not a valid warning number", wid);
-                                       valid = false;
-                               }
+                               action (id);
                        }
 
-                       return valid;
+                       return true;
                }
 
                void Error_RequiresArgument (string option)
@@ -1210,11 +1206,38 @@ namespace Mono.CSharp {
                                settings.RuntimeMetadataVersion = value;
                                return ParseResult.Success;
 
+                       case "/pathmap":
+                               if (value.Length == 0) {
+                                       return ParseResult.Success;
+                               }
+
+                               foreach (var pair in value.Split (',')) {
+                                       var kv = pair.Split ('=');
+                                       if (kv.Length != 2) {
+                                               report.Error (8101, "The pathmap option was incorrectly formatted");
+                                               return ParseResult.Error;
+                                       }
+
+                                       if (settings.PathMap == null)
+                                               settings.PathMap = new List<KeyValuePair<string, string>> ();
+
+                                       var key = kv [0].TrimEnd (Path.DirectorySeparatorChar);
+                                       var path = kv [1].TrimEnd (Path.DirectorySeparatorChar);
+                                       if (key.Length == 0 || path.Length == 0)
+                                               report.Error (8101, "The pathmap option was incorrectly formatted");
+
+                                       settings.PathMap.Add (new KeyValuePair<string, string> (key, path));
+                               }
+
+                               return ParseResult.Success;
+
                        // csc options that we don't support
                        case "/analyzer":
                        case "/appconfig":
                        case "/baseaddress":
                        case "/deterministic":
+                       case "/deterministic+":
+                       case "/deterministic-":
                        case "/errorendlocation":
                        case "/errorlog":
                        case "/features":
@@ -1224,10 +1247,11 @@ namespace Mono.CSharp {
                        case "/link":
                        case "/moduleassemblyname":
                        case "/nowin32manifest":
-                       case "/pathmap":
                        case "/pdb":
                        case "/preferreduilang":
                        case "/publicsign":
+                       case "/publicsign+":
+                       case "/publicsign-":
                        case "/reportanalyzer":
                        case "/ruleset":
                        case "/sqmsessionguid":
@@ -1593,7 +1617,7 @@ namespace Mono.CSharp {
                                "   -help                Lists all compiler options (short: -?)\n" +
                                "   -keycontainer:NAME   The key pair container used to sign the output assembly\n" +
                                "   -keyfile:FILE        The key file used to strongname the ouput assembly\n" +
-                               "   -langversion:TEXT    Specifies language version: ISO-1, ISO-2, 3, 4, 5, Default or Experimental\n" +
+                               "   -langversion:TEXT    Specifies language version: ISO-1, ISO-2, 3, 4, 5, 6, Default or Experimental\n" +
                                "   -lib:PATH1[,PATHn]   Specifies the location of referenced assemblies\n" +
                                "   -main:CLASS          Specifies the class with the Main method (short: -m)\n" +
                                "   -noconfig            Disables implicitly referenced assemblies\n" +
@@ -1601,6 +1625,7 @@ namespace Mono.CSharp {
                                "   -nowarn:W1[,Wn]      Suppress one or more compiler warnings\n" +
                                "   -optimize[+|-]       Enables advanced compiler optimizations (short: -o)\n" +
                                "   -out:FILE            Specifies output assembly name\n" +
+                               "   -pathmap:K=V[,Kn=Vn] Sets a mapping for source path names used in generated output\n" +
                                "   -pkg:P1[,Pn]         References packages P1..Pn\n" +
                                "   -platform:ARCH       Specifies the target platform of the output assembly\n" +
                                "                        ARCH can be one of: anycpu, anycpu32bitpreferred, arm,\n" +
index ad08d02b5db754d3948bdb8ad9c4b690011c1aff..fbb060f52960da9af8218171c9cf6991e8b102cc 100644 (file)
@@ -270,10 +270,14 @@ namespace Mono.CSharp {
                        var da_false = new DefiniteAssignmentBitSet (fc.DefiniteAssignmentOnFalse);
 
                        fc.DefiniteAssignment = fc.DefiniteAssignmentOnTrue;
+                       var labels = fc.CopyLabelStack ();
 
                        var res = TrueStatement.FlowAnalysis (fc);
 
+                       fc.SetLabelStack (labels);
+
                        if (FalseStatement == null) {
+
                                var c = expr as Constant;
                                if (c != null && !c.IsDefaultValue)
                                        return true_returns;
@@ -288,14 +292,20 @@ namespace Mono.CSharp {
 
                        if (true_returns) {
                                fc.DefiniteAssignment = da_false;
-                               return FalseStatement.FlowAnalysis (fc);
+
+                               res = FalseStatement.FlowAnalysis (fc);
+                               fc.SetLabelStack (labels);
+                               return res;
                        }
 
                        var da_true = fc.DefiniteAssignment;
 
                        fc.DefiniteAssignment = da_false;
+
                        res &= FalseStatement.FlowAnalysis (fc);
 
+                       fc.SetLabelStack (labels);
+
                        if (!TrueStatement.IsUnreachable) {
                                if (false_returns || FalseStatement.IsUnreachable)
                                        fc.DefiniteAssignment = da_true;
@@ -2280,6 +2290,9 @@ namespace Mono.CSharp {
 
                public override void Emit (EmitContext ec)
                {
+                       if (!Variable.IsUsed)
+                               ec.Report.Warning (219, 3, loc, "The constant `{0}' is never used", Variable.Name);
+                       
                        // Nothing to emit, not even sequence point
                }
 
@@ -2438,6 +2451,12 @@ namespace Mono.CSharp {
                        }
                }
 
+               public bool IsUsed {
+                       get {
+                               return (flags & Flags.Used) != 0;
+                       }
+               }
+
                public bool IsFixed {
                        get {
                                return (flags & Flags.FixedVariable) != 0;
@@ -2527,8 +2546,10 @@ namespace Mono.CSharp {
 
                public Expression CreateReferenceExpression (ResolveContext rc, Location loc)
                {
-                       if (IsConstant && const_value != null)
+                       if (IsConstant && const_value != null) {
+                               SetIsUsed ();
                                return Constant.CreateConstantFromValue (Type, const_value.GetValue (), loc);
+                       }
 
                        return new LocalVariableReference (this, loc);
                }
@@ -2657,6 +2678,7 @@ namespace Mono.CSharp {
                        AwaitBlock = 1 << 13,
                        FinallyBlock = 1 << 14,
                        CatchBlock = 1 << 15,
+                       HasReferenceToStoreyForInstanceLambdas = 1 << 16,
                        Iterator = 1 << 20,
                        NoFlowAnalysis = 1 << 21,
                        InitializationEmitted = 1 << 22
@@ -3223,9 +3245,10 @@ namespace Mono.CSharp {
 
                public override void Emit (EmitContext ec)
                {
-                       if (Parent != null) {
-                               // TODO: It's needed only when scope has variable (normal or lifted)
-                               ec.BeginScope (GetDebugSymbolScopeIndex ());
+                       // TODO: It's needed only when scope has variable (normal or lifted)
+                       var scopeIndex = GetDebugSymbolScopeIndex ();
+                       if (scopeIndex > 0) {
+                               ec.BeginScope (scopeIndex);
                        }
 
                        EmitScopeInitialization (ec);
@@ -3236,7 +3259,7 @@ namespace Mono.CSharp {
 
                        DoEmit (ec);
 
-                       if (Parent != null)
+                       if (scopeIndex > 0)
                                ec.EndScope ();
 
                        if (ec.EmitAccurateDebugInfo && HasReachableClosingBrace && !(this is ParametersBlock) &&
@@ -3257,6 +3280,7 @@ namespace Mono.CSharp {
                        //
                        storey.CreateContainer ();
                        storey.DefineContainer ();
+                       storey.ExpandBaseInterfaces ();
 
                        if (Original.Explicit.HasCapturedThis && Original.ParametersBlock.TopBlock.ThisReferencesFromChildrenBlock != null) {
 
@@ -3281,7 +3305,7 @@ namespace Mono.CSharp {
                                                        break;
                                        }
                                }
-                               
+
                                //
                                // We are the first storey on path and 'this' has to be hoisted
                                //
@@ -3349,7 +3373,7 @@ namespace Mono.CSharp {
 
                                                                //
                                                                // If we are state machine with no parent. We can hook into parent without additional
-                                                               // reference and capture this directly
+                                                               // reference and capture this directly
                                                                //
                                                                ExplicitBlock parent_storey_block = pb;
                                                                while (parent_storey_block.Parent != null) {
@@ -3428,7 +3452,12 @@ namespace Mono.CSharp {
                        storey.Parent.PartialContainer.AddCompilerGeneratedClass (storey);
                }
 
-               public int GetDebugSymbolScopeIndex ()
+               public void DisableDebugScopeIndex ()
+               {
+                       debug_scope_index = -1;
+               }
+
+               public virtual int GetDebugSymbolScopeIndex ()
                {
                        if (debug_scope_index == 0)
                                debug_scope_index = ++ParametersBlock.debug_scope_index;
@@ -3666,6 +3695,15 @@ namespace Mono.CSharp {
 
                #region Properties
 
+               public bool HasReferenceToStoreyForInstanceLambdas {
+                       get {
+                               return (flags & Flags.HasReferenceToStoreyForInstanceLambdas) != 0;
+                       }
+                       set {
+                               flags = value ? flags | Flags.HasReferenceToStoreyForInstanceLambdas : flags & ~Flags.HasReferenceToStoreyForInstanceLambdas;
+                       }
+               }
+
                public bool IsAsync {
                        get {
                                return (flags & Flags.HasAsyncModifier) != 0;
@@ -3827,6 +3865,11 @@ namespace Mono.CSharp {
                        return res;
                }
 
+               public override int GetDebugSymbolScopeIndex ()
+               {
+                       return 0;
+               }
+
                public LabeledStatement GetLabel (string name, Block block)
                {
                        //
@@ -6002,7 +6045,7 @@ namespace Mono.CSharp {
                                ec.EmitInt (first_resume_pc);
                                ec.Emit (OpCodes.Sub);
 
-                               var labels = new Label[resume_points.Count - System.Math.Max (first_catch_resume_pc, 0)];
+                               var labels = new Label [first_catch_resume_pc > 0 ? first_catch_resume_pc : resume_points.Count];
                                for (int i = 0; i < labels.Length; ++i)
                                        labels[i] = resume_points[i].PrepareForEmit (ec);
                                ec.Emit (OpCodes.Switch, labels);
@@ -8306,15 +8349,14 @@ namespace Mono.CSharp {
                        ec.LoopBegin = ec.DefineLabel ();
                        ec.LoopEnd = ec.DefineLabel ();
 
-                       if (!(Statement is Block))
-                               ec.BeginCompilerScope (variable.Block.Explicit.GetDebugSymbolScopeIndex ());
+                       ec.BeginCompilerScope (variable.Block.Explicit.GetDebugSymbolScopeIndex ());
+                       body.Explicit.DisableDebugScopeIndex ();
 
                        variable.CreateBuilder (ec);
 
                        Statement.Emit (ec);
 
-                       if (!(Statement is Block))
-                               ec.EndScope ();
+                       ec.EndScope ();
 
                        ec.LoopBegin = old_begin;
                        ec.LoopEnd = old_end;
index fb02370dbb32cd2317827d323637b370d01e0048..696bde556c820ad00f9d206bac897e80c10ee470 100644 (file)
@@ -109,7 +109,6 @@ namespace Mono.CSharp
                                        var imported = MemberDefinition as ImportedTypeDefinition;
                                        if (imported != null && Kind != MemberKind.MissingType)
                                                imported.DefineInterfaces (this);
-
                                }
 
                                return ifaces;
@@ -1603,6 +1602,12 @@ namespace Mono.CSharp
 
                public TypeSpec Element { get; private set; }
 
+               public override IList<TypeSpec> Interfaces {
+                       set {
+                               throw new NotSupportedException ();
+                       }
+               }
+
                bool ITypeDefinition.IsComImport {
                        get {
                                return false;
@@ -1777,13 +1782,19 @@ namespace Mono.CSharp
                readonly int rank;
                readonly ModuleContainer module;
 
-               private ArrayContainer (ModuleContainer module, TypeSpec element, int rank)
+               ArrayContainer (ModuleContainer module, TypeSpec element, int rank)
                        : base (MemberKind.ArrayType, element, null)
                {
                        this.module = module;
                        this.rank = rank;
                }
 
+               public override IList<TypeSpec> Interfaces {
+                       get {
+                               return BaseType.Interfaces;
+                       }
+               }
+
                public int Rank {
                        get {
                                return rank;
@@ -1926,7 +1937,6 @@ namespace Mono.CSharp
                        if (!module.ArrayTypesCache.TryGetValue (key, out ac)) {
                                ac = new ArrayContainer (module, element, rank);
                                ac.BaseType = module.Compiler.BuiltinTypes.Array;
-                               ac.Interfaces = ac.BaseType.Interfaces;
 
                                module.ArrayTypesCache.Add (key, ac);
                        }
@@ -1942,11 +1952,17 @@ namespace Mono.CSharp
 
        class ReferenceContainer : ElementTypeSpec
        {
-               private ReferenceContainer (TypeSpec element)
+               ReferenceContainer (TypeSpec element)
                        : base (MemberKind.Class, element, null)        // TODO: Kind.Class is most likely wrong
                {
                }
 
+               public override IList<TypeSpec> Interfaces {
+                       get {
+                               return null;
+                       }
+               }
+
                public override MetaType GetMetaInfo ()
                {
                        if (info == null) {
@@ -1977,6 +1993,12 @@ namespace Mono.CSharp
                        state &= ~StateFlags.CLSCompliant_Undetected;
                }
 
+               public override IList<TypeSpec> Interfaces {
+                       get {
+                               return null;
+                       }
+               }
+
                public override MetaType GetMetaInfo ()
                {
                        if (info == null) {
index 23eed1ddb29e9f237ace718da60a5a71f6db7c75..03a62053464fb317d4772e9908df2ffc10af643a 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;MONO;StronglyNamedAssembly;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;MONO;StronglyNamedAssembly;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>MONO;StronglyNamedAssembly;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>MONO;StronglyNamedAssembly;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 4c55206a32b037e0e3f1e0da3e5e4b813702e430..ff2129e0ca0e6d86b79e6bf697e2e02ed95d3de8 100644 (file)
@@ -19,6 +19,9 @@ namespace NUnit.ConsoleRunner
                [STAThread]\r
                public static int Main(string[] args)\r
                {\r
+                       Console.ForegroundColor = ConsoleColor.Red;\r
+                       Console.WriteLine ("Note: nunit-console shipped with Mono is deprecated, please use the NUnit NuGet package or some other form of acquiring NUnit.");\r
+                       Console.ResetColor ();\r
                        return Runner.Main( args );\r
                }\r
        }\r
index 83cb5607a2e41b979e4c805593641f4627d2554b..abcc7acfceda781eec1ef3239f282df650a3f0e6 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index ed6ee53d3849be09e094d8c8987e8eb0c8c562b1..62491e1b318175b53b13240c44cfe7f21dc64b21 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;MONO;StronglyNamedAssembly;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;MONO;StronglyNamedAssembly;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>MONO;StronglyNamedAssembly;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>MONO;StronglyNamedAssembly;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index e6b70afdcba4369a7a4ecdb09baea2eb89a16d2d..4b503806ab9d1f13d969cb6faff3b19adb692225 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;StronglyNamedAssembly;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;StronglyNamedAssembly;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>StronglyNamedAssembly;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>StronglyNamedAssembly;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 93d549db2a077a0030573e6f8cf9f82419d68074..b6d6ae1754761bbefbb7f757402d411a83cc3599 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;StronglyNamedAssembly;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;StronglyNamedAssembly;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>StronglyNamedAssembly;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>StronglyNamedAssembly;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index c7352101e5e015f53e45d6a9c4cbc9ed08e20c03..01d141732770fd48e1a7fe5aebe5fbcd2c0b86e8 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;StronglyNamedAssembly</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;StronglyNamedAssembly</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;StronglyNamedAssembly</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;StronglyNamedAssembly</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index dc02b28ebcb10437a80bcda33a0ca7f9a55aeec7..f6fa9cfe62a2855abcd745def43477328c416000 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;StronglyNamedAssembly</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;StronglyNamedAssembly</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;StronglyNamedAssembly</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;StronglyNamedAssembly</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index fae60ac6a975c31f1e5b200ff265de11e6803773..2ed6ce9136e5ef5b0812babcb91580876c531b2b 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;StronglyNamedAssembly</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;StronglyNamedAssembly</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;StronglyNamedAssembly</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;StronglyNamedAssembly</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 06794aa8b128d0533ecc6aedff760cf286f00f61..9fb55fb9d965b19a5f6b84321738cbd96ff886f9 100644 (file)
@@ -14,6 +14,7 @@ namespace NUnit.Framework
        /// {}\r
        /// </example>\r
        [AttributeUsage(AttributeTargets.Class, AllowMultiple=false, Inherited=true)]\r
+       [Obsolete ("The NUnit framework shipped with Mono is deprecated and will be removed in a future release. It was based on NUnit 2.4 which is long outdated. Please move to the NUnit NuGet package or some other form of acquiring NUnit.", true)]\r
        public class TestFixtureAttribute : Attribute\r
        {\r
                private string description;\r
index a032cb9bf230fadf6355f10ee48e6ac07f57003e..48413a8456eee84db44476dded2a8db5206ff909 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;StronglyNamedAssembly;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;StronglyNamedAssembly;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>StronglyNamedAssembly;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>StronglyNamedAssembly;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
diff --git a/mcs/tests/dtest-065.cs b/mcs/tests/dtest-065.cs
new file mode 100644 (file)
index 0000000..fb51a71
--- /dev/null
@@ -0,0 +1,28 @@
+using System.Dynamic;
+
+public class TestConvert : DynamicObject
+{
+       public override bool TryConvert (ConvertBinder binder, out object result)
+       {
+               result = null;
+               return true;
+       }
+}
+
+public class Test : DynamicObject
+{
+       public override bool TryInvokeMember (InvokeMemberBinder binder, object [] args, out object result)
+       {
+               result = new TestConvert ();
+               return true;
+       }
+}
+
+public class XX
+{
+       public static void Main ()
+       {
+               dynamic t = new Test ();
+               string result = t.SomeMethod ();
+       }
+}
\ No newline at end of file
diff --git a/mcs/tests/gtest-638.cs b/mcs/tests/gtest-638.cs
new file mode 100644 (file)
index 0000000..cadf272
--- /dev/null
@@ -0,0 +1,17 @@
+class X<T1, T2, U>
+       where T1 : class, T2
+       where T2 : class
+       where U : A, T1
+{
+}
+
+class A
+{
+}
+
+class F
+{
+       public static void Main ()
+       {
+       }
+}
\ No newline at end of file
diff --git a/mcs/tests/gtest-639.cs b/mcs/tests/gtest-639.cs
new file mode 100644 (file)
index 0000000..afc0b20
--- /dev/null
@@ -0,0 +1,47 @@
+class A<T> where T : CB, IA
+{
+       void Foo (T t)
+       {
+               t.Prop = 3;
+               long l = t.Prop2;
+               t["1"] = "2";
+       }
+}
+
+class A2<T, U> 
+       where T : CB, U
+       where U : IA
+{
+       void Foo (T t)
+       {
+               t.Prop = 3;
+               long l = t.Prop2;
+               t["1"] = "2";
+       }
+}
+
+class CB : CA
+{
+}
+
+class CA
+{
+       public int Prop { get; set; }
+
+       public string this [byte b] { get { return ""; } }
+}
+
+interface IA
+{
+       string Prop { get; set; }
+       long Prop2 { get; }
+
+       string this [string b] { get; set; }
+}
+
+class X
+{
+       public static void Main ()
+       {
+       }
+}
\ No newline at end of file
diff --git a/mcs/tests/gtest-640.cs b/mcs/tests/gtest-640.cs
new file mode 100644 (file)
index 0000000..2aeebb4
--- /dev/null
@@ -0,0 +1,39 @@
+using System;
+
+public struct Test
+{
+       public static Test op_Addition<T>(Test p1, T p2)
+       {
+               throw new ApplicationException ();
+       }
+
+       public static int op_Addition<T>(T p1, int p2)
+       {
+               throw new ApplicationException ();
+       }
+
+       public static Test operator +(Test p1, Test p2)
+       {
+               throw new ApplicationException ();
+       }
+
+       public static long operator +(Test p1, int p2)
+       {
+               return 4;
+       }
+}
+
+public class Program
+{
+       public static int Main ()
+       {
+               var t = new Test ();
+
+               int p2 = 20;
+               var res = t + p2;
+               if (res != 4)
+                       return 1;
+
+               return 0;
+       }
+}
\ No newline at end of file
diff --git a/mcs/tests/gtest-optional-40.cs b/mcs/tests/gtest-optional-40.cs
new file mode 100644 (file)
index 0000000..e554fa7
--- /dev/null
@@ -0,0 +1,19 @@
+using System;
+
+internal class Program
+{
+       public static void Main ()
+       {
+               AttributeOrDefault ("firstItem", null); 
+       }
+       
+       public static string AttributeOrDefault (string attribute, string defaultValue = null)
+       {
+               return "";
+       }
+
+       public static string AttributeOrDefault (string attribute, bool? klass, string defaultValue = null)
+       {
+               throw new ApplicationException ();
+       }
+}
diff --git a/mcs/tests/test-16628-lib.il b/mcs/tests/test-16628-lib.il
new file mode 100644 (file)
index 0000000..ca46405
--- /dev/null
@@ -0,0 +1,33 @@
+.assembly bz16628.typeforwarder2 {}
+.assembly extern mscorlib {}
+.assembly extern bz16628.typeforwardee2 {}
+
+.class extern public forwarder NSwForwardee2.Foo_SPECIAL{
+       .assembly extern bz16628.typeforwardee2
+}
+
+.class public auto ansi beforefieldinit NSwForwardee2.Bar_SPECIAL
+       extends [mscorlib]System.Object
+{
+  .field public static int32 A
+  .method public hidebysig specialname rtspecialname 
+          instance void  .ctor() cil managed
+  {
+    // Code size       7 (0x7)
+    .maxstack  8
+    IL_0000:  ldarg.0
+    IL_0001:  call       instance void [mscorlib]System.Object::.ctor()
+    IL_0006:  ret
+  } // end of method Foo::.ctor
+
+  .method private hidebysig specialname rtspecialname static 
+          void  .cctor() cil managed
+  {
+    // Code size       8 (0x8)
+    .maxstack  8
+    IL_0000:  ldc.i4.s   320
+    IL_0002:  stsfld     int32 NSwForwardee2.Bar_SPECIAL::A
+    IL_0007:  ret
+  } // end of method Foo::.cctor
+} 
+
index 1971d2f4e4812fa82feb8fbed1c666537ce0a723..36453ea86b397061250c48d9d7b086bc1dca1d8d 100644 (file)
@@ -1,5 +1,6 @@
 using System;
 using System.Reflection;
+using System.Runtime.CompilerServices;
 
 [assembly: Test]
 
@@ -130,7 +131,8 @@ public class ClassMain
                Assert (ei.GetRemoveMethod ().GetCustomAttributes (true), false, 44);
                Assert (ei.GetRemoveMethod ().ReturnTypeCustomAttributes.GetCustomAttributes (true), false, 45);
                FieldInfo fi = typeof(Test_3).GetField ("e_1", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
-               Assert (fi.GetCustomAttributes (true), true, 46);
+               Assert (fi.GetCustomAttributes (typeof (CompilerGeneratedAttribute), true), true, 46);
+               Assert (fi.GetCustomAttributes (typeof (TestAttribute), true), true, 47);
 
                ei = typeof(Test_3).GetEvent ("e_2");
                Assert (ei.GetCustomAttributes (true), false, 51);
@@ -139,7 +141,8 @@ public class ClassMain
                Assert (ei.GetRemoveMethod ().GetCustomAttributes (true), true, 54);
                Assert (ei.GetRemoveMethod ().ReturnTypeCustomAttributes.GetCustomAttributes (true), false, 55);
                fi = typeof(Test_3).GetField ("e_2", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
-               Assert (fi.GetCustomAttributes (true), false, 56);
+               Assert (fi.GetCustomAttributes (typeof (CompilerGeneratedAttribute), true), true, 56);
+               Assert (fi.GetCustomAttributes (typeof (TestAttribute), true), false, 57);
 
                ei = typeof(Test_4).GetEvent ("e_2");
                Assert (ei.GetCustomAttributes (true), false, 71);
@@ -148,7 +151,8 @@ public class ClassMain
                Assert (ei.GetRemoveMethod ().GetCustomAttributes (true), false, 74);
                Assert (ei.GetRemoveMethod ().ReturnTypeCustomAttributes.GetCustomAttributes (true), true, 75);
                fi = typeof(Test_3).GetField ("e_2", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
-               Assert (fi.GetCustomAttributes (true), false, 76);
+               Assert (fi.GetCustomAttributes (typeof (CompilerGeneratedAttribute), true), true, 76);
+               Assert (fi.GetCustomAttributes (typeof (TestAttribute), true), false, 77);
 
                ei = typeof(Test_4).GetEvent ("e_3");
                Assert (ei.GetCustomAttributes (true), false, 81);
@@ -159,7 +163,8 @@ public class ClassMain
                Assert (ei.GetRemoveMethod ().ReturnTypeCustomAttributes.GetCustomAttributes (true), false, 86);
                Assert (ei.GetRemoveMethod ().GetParameters ()[0].GetCustomAttributes (true), true, 87);
                fi = typeof(Test_3).GetField ("e_2", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
-               Assert (fi.GetCustomAttributes (true), false, 88);
+               Assert (fi.GetCustomAttributes (typeof (CompilerGeneratedAttribute), true), true, 86);
+               Assert (fi.GetCustomAttributes (typeof (TestAttribute), true), false, 87);
 
                return failed ? 1 : 0;
        }
index fdc40f6ce394563e14c554452a0e0d066e858d47..c27379dfd3bcb876c5cd0ac280832d094cb4a4bf 100644 (file)
@@ -11,4 +11,12 @@ public class Test
        }
 #pragma warning restore CS1685
 #pragma warning restore public, 1701
+
+       public static void TestCS ()
+       {
+               return;
+#pragma warning disable CS0162
+               return;
+#pragma warning restore
+       }
 }
\ No newline at end of file
diff --git a/mcs/tests/test-940.cs b/mcs/tests/test-940.cs
new file mode 100644 (file)
index 0000000..d7c68f0
--- /dev/null
@@ -0,0 +1,31 @@
+// Compiler options: -unsafe
+
+using System;
+
+struct nint
+{
+       public static nint operator * (nint a, nint b)
+       {
+               return a;
+       }
+
+       public static implicit operator long (nint v)
+       {
+               return 0;
+       }
+}
+
+class X
+{
+       public static void Main ()
+       {
+               nint width;
+               nint bytesPerRow;
+
+               unsafe {
+                       var da = (uint*)0;
+                       var dp1 = da + width * bytesPerRow;
+                       var dp2 = width * bytesPerRow + da;
+               }
+       }
+}
\ No newline at end of file
diff --git a/mcs/tests/test-941.cs b/mcs/tests/test-941.cs
new file mode 100644 (file)
index 0000000..f5d90c0
--- /dev/null
@@ -0,0 +1,30 @@
+public class GotoCodeFlowBug
+{
+       public static void Test (bool cond, out int x)
+       {
+               if (cond)
+               {
+                       goto Label;
+               }
+               Label:
+               x = 0;
+       }
+
+       public static void Test2 (bool cond, out int x)
+       {
+               if (cond)
+               {
+                       goto Label;
+               }
+               else
+               {
+                       goto Label;
+               }
+               Label:
+               x = 0;
+       }
+
+       public static void Main ()
+       {
+       }
+}
\ No newline at end of file
diff --git a/mcs/tests/test-async-88.cs b/mcs/tests/test-async-88.cs
new file mode 100644 (file)
index 0000000..813d51d
--- /dev/null
@@ -0,0 +1,28 @@
+using System;
+using System.Threading.Tasks;
+
+public class Test
+{
+       static async Task<string> AsyncWithDeepTry ()
+       {
+               try {
+                       await Task.Yield ();
+
+                       try {
+                               await Task.Yield ();
+                       } catch {
+                       }
+               } catch {
+                       await Task.Yield ();
+               } finally {
+               }
+
+               return null;
+       }
+
+
+       static void Main ()
+       {
+               AsyncWithDeepTry ().Wait ();
+       }
+}
diff --git a/mcs/tests/test-async-89.cs b/mcs/tests/test-async-89.cs
new file mode 100644 (file)
index 0000000..5a69685
--- /dev/null
@@ -0,0 +1,51 @@
+using System;
+using System.Threading.Tasks;
+
+class X
+{
+       public static void Main ()
+       {
+               new X ().Test ();
+       }
+
+       void Test ()
+       {
+               object v1 = null;
+
+               Action a = () =>
+               {
+                       if (v1 == null)
+                       {
+                               object v2 = null;
+
+                               Action a2 = () =>
+                               {
+                                       Console.WriteLine (v2);
+                               };
+                               
+                               Action a3 = async () =>
+                               {
+                                       // This scope needs to access to Scope which can do ldftn on instance method
+                                       {
+                                       Func<Task> a4 = async () =>
+                                       {
+                                               await Foo ();
+                                       };
+                                       }
+
+                                       await Task.Yield ();
+                               };
+
+                               a3 ();
+                       }
+               };
+
+               a ();
+       }
+
+       async Task Foo ()
+       {
+               await Task.FromResult (1);
+       }
+
+}
\ No newline at end of file
index db740c2456f8f89c415ad5d6ed13f835ade27ad1..d14a377f00fc9f23f40ad4633e7bc5617f6201d7 100644 (file)
       </locals>
       <scopes>
         <entry index="0" start="0x1" end="0x1e" />
-        <entry index="1" start="0xb" end="0x11" />
-        <entry index="2" start="0xf" end="0x10" />
+        <entry index="1" start="0xf" end="0x10" />
       </scopes>
     </method>
     <method token="0x6000019">
       </locals>
       <scopes>
         <entry index="0" start="0x1" end="0x37" />
-        <entry index="1" start="0xe" end="0x18" />
-        <entry index="2" start="0x16" end="0x17" />
+        <entry index="1" start="0x16" end="0x17" />
       </scopes>
     </method>
     <method token="0x600001a">
       </locals>
       <scopes>
         <entry index="0" start="0x1" end="0x3c" />
-        <entry index="1" start="0xf" end="0x18" />
-        <entry index="2" start="0x16" end="0x17" />
+        <entry index="1" start="0x16" end="0x17" />
       </scopes>
     </method>
     <method token="0x600001b">
       </locals>
       <scopes>
         <entry index="0" start="0x1" end="0x4d" />
-        <entry index="1" start="0x24" end="0x31" />
-        <entry index="2" start="0x2f" end="0x30" />
+        <entry index="1" start="0x2f" end="0x30" />
       </scopes>
     </method>
   </methods>
index 3958eb589f82a1a044189259b56b365b575b8d74..41445be8cee95dca28411f414d9893332c8fae87 100644 (file)
@@ -83,7 +83,8 @@
       </sequencepoints>
       <locals />
       <scopes>
-        <entry index="0" start="0x0" end="0xb" />
+        <entry index="0" start="0x0" end="0x0" />
+        <entry index="1" start="0x0" end="0xb" />
       </scopes>
     </method>
   </methods>
index 1038be00dde8b9d78e423fe0197ab430a7661d3e..c823a34e298adbe4cf07c325c957aa767c639503 100644 (file)
@@ -28,9 +28,7 @@
       </locals>
       <scopes>
         <entry index="0" start="0x1" end="0x1c" />
-        <entry index="1" start="0xb" end="0xf" />
-        <entry index="2" start="0x1c" end="0x3f" />
-        <entry index="3" start="0x28" end="0x2e" />
+        <entry index="1" start="0x1c" end="0x3f" />
       </scopes>
     </method>
     <method token="0x6000003">
index 461f6573e595c09f20e31b96fea3787550c331a1..34ed22655308b7fe7348feac6132a032a4b21206 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <symbols>
   <files>
-    <file id="1" name="test-debug-30.cs" checksum="d3addfa69f16faf00991ef839451a975" />
+    <file id="1" name="test-debug-30.cs" checksum="5303b32b0208123737567d53022ae3d5" />
   </files>
   <methods>
     <method token="0x6000001">
       <locals />
       <scopes />
     </method>
+    <method token="0x6000004">
+      <sequencepoints>
+        <entry il="0x0" row="23" col="2" file_ref="1" hidden="false" />
+        <entry il="0x1" row="24" col="3" file_ref="1" hidden="false" />
+        <entry il="0x6" row="25" col="2" file_ref="1" hidden="false" />
+      </sequencepoints>
+      <locals />
+      <scopes />
+    </method>
   </methods>
 </symbols>
\ No newline at end of file
index 78f0cdfe3c74a9e6b6631ef20e0e6e0616c577e7..a72f014101ee2392d3d532080ee712a51d06158c 100644 (file)
@@ -15,4 +15,12 @@ class PragmaNewLinesParsing
        {
                return;
        }
+
+#pragma warning disable 618
+#pragma warning restore 618
+
+       void OneMore ()
+       {
+               return;
+       }
 }
\ No newline at end of file
diff --git a/mcs/tests/test-debug-31-ref.xml b/mcs/tests/test-debug-31-ref.xml
new file mode 100644 (file)
index 0000000..1a77894
--- /dev/null
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="utf-8"?>
+<symbols>
+  <files>
+    <file id="1" name="test-debug-31.cs" checksum="e1579371d047d82b8d90c0dc26393808" />
+  </files>
+  <methods>
+    <method token="0x6000001">
+      <sequencepoints />
+      <locals />
+      <scopes />
+    </method>
+    <method token="0x6000002">
+      <sequencepoints>
+        <entry il="0x0" row="8" col="3" file_ref="1" hidden="false" />
+        <entry il="0x1" row="9" col="4" file_ref="1" hidden="false" />
+        <entry il="0x20" row="11" col="4" file_ref="1" hidden="false" />
+        <entry il="0x21" row="11" col="25" file_ref="1" hidden="false" />
+        <entry il="0x2a" row="11" col="13" file_ref="1" hidden="false" />
+        <entry il="0x2e" row="12" col="4" file_ref="1" hidden="false" />
+        <entry il="0x2f" row="13" col="5" file_ref="1" hidden="false" />
+        <entry il="0x30" row="13" col="13" file_ref="1" hidden="false" />
+        <entry il="0x35" row="14" col="4" file_ref="1" hidden="false" />
+        <entry il="0x36" row="11" col="25" file_ref="1" hidden="false" />
+        <entry il="0x43" row="16" col="4" file_ref="1" hidden="false" />
+        <entry il="0x44" row="16" col="26" file_ref="1" hidden="false" />
+        <entry il="0x4f" row="16" col="13" file_ref="1" hidden="false" />
+        <entry il="0x56" row="16" col="33" file_ref="1" hidden="false" />
+        <entry il="0x57" row="17" col="5" file_ref="1" hidden="false" />
+        <entry il="0x59" row="17" col="13" file_ref="1" hidden="false" />
+        <entry il="0x5e" row="18" col="4" file_ref="1" hidden="false" />
+        <entry il="0x5f" row="16" col="26" file_ref="1" hidden="false" />
+        <entry il="0x70" row="20" col="4" file_ref="1" hidden="false" />
+        <entry il="0x71" row="20" col="26" file_ref="1" hidden="false" />
+        <entry il="0x7c" row="20" col="13" file_ref="1" hidden="false" />
+        <entry il="0x83" row="20" col="33" file_ref="1" hidden="false" />
+        <entry il="0x84" row="21" col="5" file_ref="1" hidden="false" />
+        <entry il="0x86" row="21" col="13" file_ref="1" hidden="false" />
+        <entry il="0x8b" row="22" col="4" file_ref="1" hidden="false" />
+        <entry il="0x8c" row="20" col="26" file_ref="1" hidden="false" />
+        <entry il="0x9d" row="23" col="3" file_ref="1" hidden="false" />
+      </sequencepoints>
+      <locals>
+        <entry name="array" il_index="0" scope_ref="0" />
+        <entry name="item" il_index="1" scope_ref="1" />
+        <entry name="item1" il_index="4" scope_ref="3" />
+        <entry name="item2" il_index="7" scope_ref="5" />
+      </locals>
+      <scopes>
+        <entry index="0" start="0x20" end="0x43" />
+        <entry index="1" start="0x2e" end="0x35" />
+        <entry index="2" start="0x43" end="0x70" />
+        <entry index="3" start="0x56" end="0x5e" />
+        <entry index="4" start="0x70" end="0x9d" />
+        <entry index="5" start="0x83" end="0x8b" />
+      </scopes>
+    </method>
+  </methods>
+</symbols>
\ No newline at end of file
diff --git a/mcs/tests/test-debug-31.cs b/mcs/tests/test-debug-31.cs
new file mode 100644 (file)
index 0000000..5a3d55d
--- /dev/null
@@ -0,0 +1,25 @@
+using System;
+
+namespace cp534534
+{
+       class MainClass
+       {
+               public static void Main ()
+               {
+                       var array = new string[] { "a", "b", "c" };
+                       
+                       foreach (var item in array)
+                       {
+                               Console.WriteLine (item);
+                       }
+
+                       foreach (var item1 in array) {
+                               Console.WriteLine (item1);
+                       }
+
+                       foreach (var item2 in array) {
+                               Console.WriteLine (item2);
+                       }
+               }
+       }
+}
\ No newline at end of file
diff --git a/mcs/tests/test-debug-32-ref.xml b/mcs/tests/test-debug-32-ref.xml
new file mode 100644 (file)
index 0000000..acabcfb
--- /dev/null
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="utf-8"?>
+<symbols>
+  <files>
+    <file id="1" name="test-debug-32.cs" checksum="71a5517624c6bd01871fcb9ae65242b7" />
+  </files>
+  <methods>
+    <method token="0x6000001">
+      <sequencepoints />
+      <locals />
+      <scopes />
+    </method>
+    <method token="0x6000002">
+      <sequencepoints />
+      <locals />
+      <scopes />
+    </method>
+    <method token="0x6000003">
+      <sequencepoints>
+        <entry il="0x0" row="19" col="2" file_ref="1" hidden="false" />
+        <entry il="0x1" row="20" col="2" file_ref="1" hidden="false" />
+      </sequencepoints>
+      <locals />
+      <scopes />
+    </method>
+    <method token="0x6000004">
+      <sequencepoints />
+      <locals />
+      <scopes />
+    </method>
+    <method token="0x6000005">
+      <sequencepoints>
+        <entry il="0x27" row="6" col="2" file_ref="1" hidden="false" />
+        <entry il="0x28" row="7" col="3" file_ref="1" hidden="false" />
+        <entry il="0x43" row="9" col="3" file_ref="1" hidden="false" />
+        <entry il="0x4a" row="10" col="3" file_ref="1" hidden="false" />
+        <entry il="0x59" row="10" col="7" file_ref="1" hidden="false" />
+        <entry il="0x5a" row="11" col="4" file_ref="1" hidden="false" />
+        <entry il="0x7c" row="12" col="3" file_ref="1" hidden="false" />
+        <entry il="0x8d" row="16" col="2" file_ref="1" hidden="false" />
+      </sequencepoints>
+      <locals />
+      <scopes>
+        <entry index="0" start="0x59" end="0x7c" />
+      </scopes>
+    </method>
+    <method token="0x6000006">
+      <sequencepoints />
+      <locals />
+      <scopes />
+    </method>
+    <method token="0x6000007">
+      <sequencepoints />
+      <locals />
+      <scopes />
+    </method>
+    <method token="0x6000008">
+      <sequencepoints />
+      <locals />
+      <scopes />
+    </method>
+    <method token="0x6000009">
+      <sequencepoints />
+      <locals />
+      <scopes />
+    </method>
+    <method token="0x600000a">
+      <sequencepoints />
+      <locals />
+      <scopes />
+    </method>
+    <method token="0x600000b">
+      <sequencepoints />
+      <locals />
+      <scopes />
+    </method>
+    <method token="0x600000c">
+      <sequencepoints>
+        <entry il="0x0" row="12" col="13" file_ref="1" hidden="false" />
+        <entry il="0x1" row="13" col="4" file_ref="1" hidden="false" />
+        <entry il="0xd" row="13" col="16" file_ref="1" hidden="false" />
+        <entry il="0xe" row="14" col="4" file_ref="1" hidden="false" />
+        <entry il="0xf" row="15" col="3" file_ref="1" hidden="false" />
+      </sequencepoints>
+      <locals />
+      <scopes>
+        <entry index="0" start="0x0" end="0x0" />
+        <entry index="1" start="0x0" end="0xf" />
+        <entry index="2" start="0xd" end="0xe" />
+      </scopes>
+    </method>
+  </methods>
+</symbols>
\ No newline at end of file
diff --git a/mcs/tests/test-debug-32.cs b/mcs/tests/test-debug-32.cs
new file mode 100644 (file)
index 0000000..ba52a10
--- /dev/null
@@ -0,0 +1,21 @@
+using System.Collections.Generic;
+
+class X
+{
+       internal static IEnumerable<int> EnumerateKind ()
+       {
+               yield return 1;
+
+               int h = 3;
+               try {
+                       yield return h;
+               } finally {
+                       if (h != 1) {
+                       }
+               }
+       }
+
+       public static void Main ()
+       {
+       }
+}
\ No newline at end of file
index 3dd99f5f2797f7c0db8b3b033fa08dedab20f9ca..4cf2e64196bd6b4a50cd1036eb0f2225dd3a5036 100644 (file)
@@ -13,6 +13,13 @@ public class ParserTest
                Console.WriteLine($"This should work but the compiler explodes if the string is too long!");            
        }
 
+       void Test3 ()
+       {
+               string field = "";
+               var l1 = $"\"{field.Replace("\"", "gg")}\"";
+               var l2 = $@"""{field.Replace("\"", "gg")}""";
+       }
+
        public static void Main()
        {
        }
diff --git a/mcs/tests/test-named-10.cs b/mcs/tests/test-named-10.cs
new file mode 100644 (file)
index 0000000..6434c83
--- /dev/null
@@ -0,0 +1,18 @@
+using System;
+
+internal class Program
+{
+       public static void Main ()
+       {
+               Method (1, 2, paramNamed: 3);
+       }
+       
+       static void Method (int p1, int paramNamed, int p2)
+       {
+               throw new ApplicationException ();
+       }
+       
+       static void Method (int p1, int p2, object paramNamed)
+       {
+       }
+}
diff --git a/mcs/tests/test-partial-35.cs b/mcs/tests/test-partial-35.cs
new file mode 100644 (file)
index 0000000..ba51245
--- /dev/null
@@ -0,0 +1,19 @@
+partial class A
+{
+}
+
+partial class A
+{
+       enum E
+       {
+               None = 0,
+               All = 1
+       }
+}
+
+class X
+{
+       public static void Main ()
+       {
+       }
+}
\ No newline at end of file
index 0964285cc654069417501810315bf9f5012be27d..ddb13732d045f93741bf1e5899a1ef29903e6590 100644 (file)
       </method>
     </type>
   </test>
+  <test name="dtest-065.cs">
+    <type name="TestConvert">
+      <method name="Boolean TryConvert(System.Dynamic.ConvertBinder, System.Object ByRef)" attrs="198">
+        <size>13</size>
+      </method>
+      <method name="Void .ctor()" attrs="6278">
+        <size>7</size>
+      </method>
+    </type>
+    <type name="Test">
+      <method name="Boolean TryInvokeMember(System.Dynamic.InvokeMemberBinder, System.Object[], System.Object ByRef)" attrs="198">
+        <size>17</size>
+      </method>
+      <method name="Void .ctor()" attrs="6278">
+        <size>7</size>
+      </method>
+    </type>
+    <type name="XX">
+      <method name="Void Main()" attrs="150">
+        <size>154</size>
+      </method>
+      <method name="Void .ctor()" attrs="6278">
+        <size>7</size>
+      </method>
+    </type>
+  </test>
   <test name="dtest-anontype-01.cs">
     <type name="C">
       <method name="Void Main()" attrs="150">
       </method>
     </type>
   </test>
+  <test name="gtest-638.cs">
+    <type name="X`3[T1,T2,U]">
+      <method name="Void .ctor()" attrs="6278">
+        <size>7</size>
+      </method>
+    </type>
+    <type name="A">
+      <method name="Void .ctor()" attrs="6278">
+        <size>7</size>
+      </method>
+    </type>
+    <type name="F">
+      <method name="Void Main()" attrs="150">
+        <size>2</size>
+      </method>
+      <method name="Void .ctor()" attrs="6278">
+        <size>7</size>
+      </method>
+    </type>
+  </test>
+  <test name="gtest-639.cs">
+    <type name="A`1[T]">
+      <method name="Void Foo(T)" attrs="129">
+        <size>53</size>
+      </method>
+      <method name="Void .ctor()" attrs="6278">
+        <size>7</size>
+      </method>
+    </type>
+    <type name="CB">
+      <method name="Void .ctor()" attrs="6278">
+        <size>7</size>
+      </method>
+    </type>
+    <type name="CA">
+      <method name="Int32 get_Prop()" attrs="2182">
+        <size>14</size>
+      </method>
+      <method name="Void set_Prop(Int32)" attrs="2182">
+        <size>8</size>
+      </method>
+      <method name="System.String get_Item(Byte)" attrs="2182">
+        <size>14</size>
+      </method>
+      <method name="Void .ctor()" attrs="6278">
+        <size>7</size>
+      </method>
+    </type>
+    <type name="X">
+      <method name="Void Main()" attrs="150">
+        <size>2</size>
+      </method>
+      <method name="Void .ctor()" attrs="6278">
+        <size>7</size>
+      </method>
+    </type>
+    <type name="A2`2[T,U]">
+      <method name="Void Foo(T)" attrs="129">
+        <size>53</size>
+      </method>
+      <method name="Void .ctor()" attrs="6278">
+        <size>7</size>
+      </method>
+    </type>
+  </test>
+  <test name="gtest-640.cs">
+    <type name="Test">
+      <method name="Test op_Addition[T](Test, T)" attrs="150">
+        <size>7</size>
+      </method>
+      <method name="Int32 op_Addition[T](T, Int32)" attrs="150">
+        <size>7</size>
+      </method>
+      <method name="Test op_Addition(Test, Test)" attrs="2198">
+        <size>7</size>
+      </method>
+      <method name="Int64 op_Addition(Test, Int32)" attrs="2198">
+        <size>11</size>
+      </method>
+    </type>
+    <type name="Program">
+      <method name="Int32 Main()" attrs="150">
+        <size>44</size>
+      </method>
+      <method name="Void .ctor()" attrs="6278">
+        <size>7</size>
+      </method>
+    </type>
+  </test>
   <test name="gtest-anontype-01.cs">
     <type name="Test">
       <method name="Int32 Main()" attrs="150">
       </method>
     </type>
   </test>
+  <test name="gtest-optional-40.cs">
+    <type name="Program">
+      <method name="Void Main()" attrs="150">
+        <size>14</size>
+      </method>
+      <method name="System.String AttributeOrDefault(System.String, System.String)" attrs="150">
+        <size>14</size>
+      </method>
+      <method name="System.String AttributeOrDefault(System.String, System.Nullable`1[System.Boolean], System.String)" attrs="150">
+        <size>7</size>
+      </method>
+      <method name="Void .ctor()" attrs="6278">
+        <size>7</size>
+      </method>
+    </type>
+  </test>
   <test name="gtest-partial-01.cs">
     <type name="B`1[U]">
       <method name="Void .ctor()" attrs="6278">
         <size>80</size>
       </method>
       <method name="Int32 Main()" attrs="150">
-        <size>1169</size>
+        <size>1309</size>
       </method>
       <method name="Void .ctor()" attrs="6278">
         <size>7</size>
       <method name="Void .ctor()" attrs="6278">
         <size>7</size>
       </method>
+      <method name="Void TestCS()" attrs="150">
+        <size>7</size>
+      </method>
     </type>
   </test>
   <test name="test-909.cs">
       </method>
     </type>
   </test>
+  <test name="test-940.cs">
+    <type name="nint">
+      <method name="nint op_Multiply(nint, nint)" attrs="2198">
+        <size>10</size>
+      </method>
+      <method name="Int64 op_Implicit(nint)" attrs="2198">
+        <size>11</size>
+      </method>
+    </type>
+    <type name="X">
+      <method name="Void Main()" attrs="150">
+        <size>46</size>
+      </method>
+      <method name="Void .ctor()" attrs="6278">
+        <size>7</size>
+      </method>
+    </type>
+  </test>
+  <test name="test-941.cs">
+    <type name="GotoCodeFlowBug">
+      <method name="Void Test(Boolean, Int32 ByRef)" attrs="150">
+        <size>17</size>
+      </method>
+      <method name="Void Test2(Boolean, Int32 ByRef)" attrs="150">
+        <size>23</size>
+      </method>
+      <method name="Void Main()" attrs="150">
+        <size>2</size>
+      </method>
+      <method name="Void .ctor()" attrs="6278">
+        <size>7</size>
+      </method>
+    </type>
+  </test>
   <test name="test-95.cs">
     <type name="X">
       <method name="Int32 Main()" attrs="150">
       </method>
     </type>
   </test>
+  <test name="test-async-88.cs">
+    <type name="Test">
+      <method name="System.Threading.Tasks.Task`1[System.String] AsyncWithDeepTry()" attrs="145">
+        <size>33</size>
+      </method>
+      <method name="Void Main()" attrs="145">
+        <size>12</size>
+      </method>
+      <method name="Void .ctor()" attrs="6278">
+        <size>7</size>
+      </method>
+    </type>
+    <type name="Test+&lt;AsyncWithDeepTry&gt;c__async0">
+      <method name="Void MoveNext()" attrs="486">
+        <size>460</size>
+      </method>
+      <method name="Void SetStateMachine(System.Runtime.CompilerServices.IAsyncStateMachine)" attrs="486">
+        <size>13</size>
+      </method>
+    </type>
+  </test>
+  <test name="test-async-89.cs">
+    <type name="X">
+      <method name="Void Main()" attrs="150">
+        <size>12</size>
+      </method>
+      <method name="Void Test()" attrs="129">
+        <size>41</size>
+      </method>
+      <method name="System.Threading.Tasks.Task Foo()" attrs="129">
+        <size>33</size>
+      </method>
+      <method name="Void .ctor()" attrs="6278">
+        <size>7</size>
+      </method>
+    </type>
+    <type name="X+&lt;Test&gt;c__AnonStorey1">
+      <method name="Void &lt;&gt;m__0()" attrs="131">
+        <size>67</size>
+      </method>
+      <method name="Void .ctor()" attrs="6278">
+        <size>7</size>
+      </method>
+    </type>
+    <type name="X+&lt;Foo&gt;c__async0">
+      <method name="Void MoveNext()" attrs="486">
+        <size>158</size>
+      </method>
+      <method name="Void SetStateMachine(System.Runtime.CompilerServices.IAsyncStateMachine)" attrs="486">
+        <size>13</size>
+      </method>
+    </type>
+    <type name="X+&lt;Test&gt;c__AnonStorey1+&lt;Test&gt;c__AnonStorey2">
+      <method name="Void &lt;&gt;m__0()" attrs="131">
+        <size>13</size>
+      </method>
+      <method name="Void &lt;&gt;m__1()" attrs="131">
+        <size>48</size>
+      </method>
+      <method name="System.Threading.Tasks.Task &lt;&gt;m__2()" attrs="131">
+        <size>46</size>
+      </method>
+      <method name="Void .ctor()" attrs="6278">
+        <size>7</size>
+      </method>
+    </type>
+    <type name="X+&lt;Test&gt;c__AnonStorey1+&lt;Test&gt;c__AnonStorey2+&lt;Test&gt;c__async3">
+      <method name="Void MoveNext()" attrs="486">
+        <size>179</size>
+      </method>
+      <method name="Void SetStateMachine(System.Runtime.CompilerServices.IAsyncStateMachine)" attrs="486">
+        <size>13</size>
+      </method>
+    </type>
+    <type name="X+&lt;Test&gt;c__AnonStorey1+&lt;Test&gt;c__AnonStorey2+&lt;Test&gt;c__async4">
+      <method name="Void MoveNext()" attrs="486">
+        <size>167</size>
+      </method>
+      <method name="Void SetStateMachine(System.Runtime.CompilerServices.IAsyncStateMachine)" attrs="486">
+        <size>13</size>
+      </method>
+    </type>
+  </test>
   <test name="test-cls-00.cs">
     <type name="CLSCLass_6">
       <method name="Void add_Disposed(Delegate)" attrs="2182">
       <method name="Void .ctor()" attrs="6278">
         <size>7</size>
       </method>
+      <method name="Void OneMore()" attrs="129">
+        <size>7</size>
+      </method>
+    </type>
+  </test>
+  <test name="test-debug-31.cs">
+    <type name="cp534534.MainClass">
+      <method name="Void Main()" attrs="150">
+        <size>158</size>
+      </method>
+      <method name="Void .ctor()" attrs="6278">
+        <size>7</size>
+      </method>
+    </type>
+  </test>
+  <test name="test-debug-32.cs">
+    <type name="X">
+      <method name="System.Collections.Generic.IEnumerable`1[System.Int32] EnumerateKind()" attrs="147">
+        <size>23</size>
+      </method>
+      <method name="Void Main()" attrs="150">
+        <size>2</size>
+      </method>
+      <method name="Void .ctor()" attrs="6278">
+        <size>7</size>
+      </method>
+    </type>
+    <type name="X+&lt;EnumerateKind&gt;c__Iterator0">
+      <method name="Boolean MoveNext()" attrs="486">
+        <size>152</size>
+      </method>
+      <method name="Int32 System.Collections.Generic.IEnumerator&lt;int&gt;.get_Current()" attrs="2529">
+        <size>14</size>
+      </method>
+      <method name="System.Object System.Collections.IEnumerator.get_Current()" attrs="2529">
+        <size>19</size>
+      </method>
+      <method name="Void Dispose()" attrs="486">
+        <size>57</size>
+      </method>
+      <method name="Void Reset()" attrs="486">
+        <size>6</size>
+      </method>
+      <method name="System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">
+        <size>14</size>
+      </method>
+      <method name="System.Collections.Generic.IEnumerator`1[System.Int32] System.Collections.Generic.IEnumerable&lt;int&gt;.GetEnumerator()" attrs="481">
+        <size>26</size>
+      </method>
+      <method name="Void &lt;&gt;__Finally0()" attrs="129">
+        <size>17</size>
+      </method>
+      <method name="Void .ctor()" attrs="6278">
+        <size>7</size>
+      </method>
     </type>
   </test>
   <test name="test-decl-expr-01.cs">
       <method name="Void Test2()" attrs="129">
         <size>12</size>
       </method>
+      <method name="Void Test3()" attrs="129">
+        <size>62</size>
+      </method>
     </type>
   </test>
   <test name="test-interpolation-06.cs">
       </method>
     </type>
   </test>
+  <test name="test-named-10.cs">
+    <type name="Program">
+      <method name="Void Main()" attrs="150">
+        <size>15</size>
+      </method>
+      <method name="Void Method(Int32, Int32, Int32)" attrs="145">
+        <size>7</size>
+      </method>
+      <method name="Void Method(Int32, Int32, System.Object)" attrs="145">
+        <size>2</size>
+      </method>
+      <method name="Void .ctor()" attrs="6278">
+        <size>7</size>
+      </method>
+    </type>
+  </test>
   <test name="test-nameof-01.cs">
     <type name="X">
       <method name="Int32 Main()" attrs="150">
       </method>
     </type>
   </test>
+  <test name="test-partial-35.cs">
+    <type name="A">
+      <method name="Void .ctor()" attrs="6278">
+        <size>7</size>
+      </method>
+    </type>
+    <type name="X">
+      <method name="Void Main()" attrs="150">
+        <size>2</size>
+      </method>
+      <method name="Void .ctor()" attrs="6278">
+        <size>7</size>
+      </method>
+    </type>
+  </test>
   <test name="test-pattern-01.cs">
     <type name="TypePattern">
       <method name="Int32 Main()" attrs="150">
index 693318cbea7e07fdb27df8413379a15d159e7ac0..60600a30a325741f01915bcfef2b9706338f0267 100644 (file)
@@ -3,7 +3,6 @@ thisdir = tools
 net_4_5_dirs := \
        al              \
        linker          \
-       tuner           \
        culevel         \
        genxs           \
        mkbundle        \
@@ -47,7 +46,8 @@ net_4_5_dirs := \
        mdbrebase       \
        ikdasm          \
        mono-symbolicate        \
-       linker-analyzer
+       linker-analyzer \
+       btls
 
 build_SUBDIRS = gacutil security culevel cil-stringreplacer commoncryptogenerator
 net_4_5_SUBDIRS = gacutil
index bdc741144ea595cb7d7bcbeb8b509e5a3e225148..3670d2f2eb94c6562db2a34b84eb5653165e4c07 100644 (file)
@@ -13,14 +13,13 @@ using System.Globalization;
 using System.IO;
 using System.Collections;
 using System.Collections.Generic;
-using System.Reflection;
-using System.Reflection.Emit;
 using System.Security.Cryptography;
 using System.Text;
 using System.Configuration.Assemblies;
 
+using IKVM.Reflection;
+using IKVM.Reflection.Emit;
 using Mono.Security.Cryptography;
-using IKR = IKVM.Reflection;
 
 namespace Mono.AssemblyLinker
 {
@@ -49,6 +48,15 @@ namespace Mono.AssemblyLinker
                No
        }
 
+       public enum Platform {
+               AnyCPU,
+               AnyCPU32Preferred,
+               Arm,
+               X86,
+               X64,
+               IA64
+       }
+
        public class AssemblyLinker {
 
                ArrayList inputFiles = new ArrayList ();
@@ -59,24 +67,35 @@ namespace Mono.AssemblyLinker
                string entryPoint;
                string win32IconFile;
                string win32ResFile;
+               string title;
+               string description;
+               string company;
+               string product;
+               string copyright;
+               string trademark;
                string templateFile;
                bool isTemplateFile = false;
                Target target = Target.Dll;
+               Platform platform = Platform.AnyCPU;
                DelaySign delaysign = DelaySign.NotSet;
                string keyfile;
                string keyname;
                string culture;
+               Universe universe;
 
                public static int Main (String[] args) {
                        return new AssemblyLinker ().DynMain (args);
                }
 
                private int DynMain (String[] args) {
-                       ParseArgs (args);
+                       using (universe = new Universe (UniverseOptions.MetadataOnly)) {
+                               universe.LoadFile (typeof (object).Assembly.Location);
+                               ParseArgs (args);
 
-                       DoIt ();
+                               DoIt ();
 
-                       return 0;
+                               return 0;
+                       }
                }
 
                private void ParseArgs (string[] args) 
@@ -211,7 +230,7 @@ namespace Mono.AssemblyLinker
                                        if (realArg.StartsWith ("0x"))
                                                realArg = realArg.Substring (2);
                                        uint val = Convert.ToUInt32 (realArg, 16);
-                                       AddCattr (typeof (AssemblyAlgorithmIdAttribute), typeof (uint), val);
+                                       AddCattr (typeof (System.Reflection.AssemblyAlgorithmIdAttribute), typeof (uint), val);
                                } catch (Exception) {
                                        ReportInvalidArgument (opt, arg);
                                }
@@ -233,21 +252,21 @@ namespace Mono.AssemblyLinker
                        case "company":
                                if (arg == null)
                                        ReportMissingText (opt);
-                               AddCattr (typeof (AssemblyCompanyAttribute), arg);
+                               company = arg;
                                return true;
 
                        case "config":
                        case "configuration":
                                if (arg == null)
                                        ReportMissingText (opt);
-                               AddCattr (typeof (AssemblyConfigurationAttribute), arg);
+                               AddCattr (typeof (System.Reflection.AssemblyConfigurationAttribute), arg);
                                return true;
 
                        case "copy":
                        case "copyright":
                                if (arg == null)
                                        ReportMissingText (opt);
-                               AddCattr (typeof (AssemblyCopyrightAttribute), arg);
+                               copyright = arg;
                                return true;
 
                        case "c":
@@ -273,7 +292,7 @@ namespace Mono.AssemblyLinker
                        case "description":
                                if (arg == null)
                                        ReportMissingText (opt);
-                               AddCattr (typeof (AssemblyDescriptionAttribute), arg);
+                               description = arg;
                                return true;
 
                        case "e":
@@ -292,7 +311,7 @@ namespace Mono.AssemblyLinker
                                if (arg == null)
                                        ReportMissingText (opt);
 
-                               AddCattr (typeof (AssemblyFileVersionAttribute), arg);
+                               AddCattr (typeof (System.Reflection.AssemblyFileVersionAttribute), arg);
                                return true;
 
                        case "flags":
@@ -303,7 +322,7 @@ namespace Mono.AssemblyLinker
                                        if (realArg.StartsWith ("0x"))
                                                realArg = realArg.Substring (2);
                                        uint val = Convert.ToUInt32 (realArg, 16);
-                                       AddCattr (typeof (AssemblyFlagsAttribute), typeof (uint), val);
+                                       AddCattr (typeof (System.Reflection.AssemblyFlagsAttribute), typeof (uint), val);
                                } catch (Exception) {
                                        ReportInvalidArgument (opt, arg);
                                }
@@ -342,18 +361,46 @@ namespace Mono.AssemblyLinker
                                outFile = arg;
                                return true;
 
+               case "platform":
+                       if (arg == null)
+                               ReportMissingText (opt);
+                       switch (arg.ToLowerInvariant ()) {
+                               case "arm":
+                                       platform = Platform.Arm;
+                                       break;
+                               case "anycpu":
+                                       platform = Platform.AnyCPU;
+                                       break;
+                               case "x86":
+                                       platform = Platform.X86;
+                                       break;
+                               case "x64":
+                                       platform = Platform.X64;
+                                       break;
+                               case "itanium":
+                                       platform = Platform.IA64;
+                                       break;
+                               case "anycpu32bitpreferred":
+                                       platform = Platform.AnyCPU32Preferred;
+                                       break;
+                               default:
+                                       ReportInvalidArgument (opt, arg);
+                                       break;
+                               }
+                               return true;
+
                        case "prod":
                        case "product":
                                if (arg == null)
                                        ReportMissingText (opt);
-                               AddCattr (typeof (AssemblyProductAttribute), arg);
+                               product = arg;
                                return true;
 
                        case "productv":
                        case "productversion":
                                if (arg == null)
                                        ReportMissingText (opt);
-                               AddCattr (typeof (AssemblyInformationalVersionAttribute), arg);
+                               AddCattr (typeof (System.Reflection.AssemblyInformationalVersionAttribute), arg);
                                return true;
 
                        case "t":
@@ -388,14 +435,14 @@ namespace Mono.AssemblyLinker
                        case "title":
                                if (arg == null)
                                        ReportMissingText (opt);
-                               AddCattr (typeof (AssemblyTitleAttribute), arg);
+                               title = arg;
                                return true;
 
                        case "trade":
                        case "trademark":
                                if (arg == null)
                                        ReportMissingText (opt);
-                               AddCattr (typeof (AssemblyTrademarkAttribute), arg);
+                               trademark = arg;
                                return true;
 
                        case "v":
@@ -405,7 +452,7 @@ namespace Mono.AssemblyLinker
                                        Version ();
                                        break;
                                }
-                               AddCattr (typeof (AssemblyVersionAttribute), arg);
+                               AddCattr (typeof (System.Reflection.AssemblyVersionAttribute), arg);
                                return true;
 
                        case "win32icon":
@@ -461,11 +508,14 @@ namespace Mono.AssemblyLinker
                        return command.ToLower ();
                }
 
-               private void AddCattr (Type attrType, Type arg, object value) {
-                       cattrs.Add (new CustomAttributeBuilder (attrType.GetConstructor (new Type [] { arg }), new object [] { value }));
+               private void AddCattr (System.Type attrType, System.Type arg, object value) {
+                       var importedAttrType = universe.Import(attrType);
+                       var importedArg = universe.Import(arg);
+
+                       cattrs.Add (new CustomAttributeBuilder (importedAttrType.GetConstructor (new [] { importedArg }), new [] { value }));
                }
 
-               private void AddCattr (Type attrType, object value) {
+               private void AddCattr (System.Type attrType, object value) {
                        AddCattr (attrType, typeof (string), value);
                }
 
@@ -596,12 +646,25 @@ namespace Mono.AssemblyLinker
                        if (isTemplateFile)
                                aname = ReadCustomAttributesFromTemplateFile (templateFile, aname);
 
+                       if (!String.IsNullOrEmpty (title))
+                               AddCattr (typeof (System.Reflection.AssemblyTitleAttribute), title);
+                       if (!String.IsNullOrEmpty (description))
+                               AddCattr (typeof (System.Reflection.AssemblyDescriptionAttribute), description);
+                       if (!String.IsNullOrEmpty (company))
+                               AddCattr (typeof (System.Reflection.AssemblyCompanyAttribute), company);
+                       if (!String.IsNullOrEmpty (product))
+                               AddCattr (typeof (System.Reflection.AssemblyProductAttribute), product);
+                       if (!String.IsNullOrEmpty (copyright))
+                               AddCattr (typeof (System.Reflection.AssemblyCopyrightAttribute), copyright);
+                       if (!String.IsNullOrEmpty (trademark))
+                               AddCattr (typeof (System.Reflection.AssemblyTrademarkAttribute), trademark);
+
                        SetKeyPair (aname);
 
                        if (fileName != outFile)
-                               ab = AppDomain.CurrentDomain.DefineDynamicAssembly (aname, AssemblyBuilderAccess.Save, Path.GetDirectoryName (outFile));
+                               ab = universe.DefineDynamicAssembly (aname, AssemblyBuilderAccess.Save, Path.GetDirectoryName (outFile));
                        else
-                               ab = AppDomain.CurrentDomain.DefineDynamicAssembly (aname, AssemblyBuilderAccess.Save);
+                               ab = universe.DefineDynamicAssembly (aname, AssemblyBuilderAccess.Save);
 
                        foreach (CustomAttributeBuilder cb in cattrs)
                                ab.SetCustomAttribute (cb);
@@ -611,10 +674,6 @@ namespace Mono.AssemblyLinker
                         */
 
                        foreach (ModuleInfo mod in inputFiles) {
-                               MethodInfo mi = typeof (AssemblyBuilder).GetMethod ("AddModule", BindingFlags.Instance|BindingFlags.Public|BindingFlags.NonPublic);
-                               if (mi == null)
-                                       Report (0, "Cannot add modules on this runtime: try the Mono runtime instead.");
-
                                if (mod.target != null) {
                                        File.Copy (mod.fileName, mod.target, true);
                                        mod.fileName = mod.target;
@@ -631,7 +690,7 @@ namespace Mono.AssemblyLinker
                                if (isAssembly)
                                        ReportWarning (1020, "Ignoring included assembly '" + mod.fileName + "'");
                                else
-                                       mi.Invoke (ab, new object [] { mod.fileName });
+                               ab.__AddModule (universe.OpenRawModule(mod.fileName));
                        }
 
                        /*
@@ -645,7 +704,7 @@ namespace Mono.AssemblyLinker
                                MethodInfo mainMethodInfo = null;
 
                                try {
-                                       Type mainType = ab.GetType (mainClass);
+                                       IKVM.Reflection.Type mainType = ab.GetType (mainClass);
                                        if (mainType != null)
                                                mainMethodInfo = mainType.GetMethod (mainMethod);
                                }
@@ -666,10 +725,7 @@ namespace Mono.AssemblyLinker
 
                        if (win32IconFile != null) {
                                try {
-                                       MethodInfo mi = typeof (AssemblyBuilder).GetMethod ("DefineIconResource", BindingFlags.Instance|BindingFlags.Public|BindingFlags.NonPublic);
-                                       if (mi == null)
-                                               Report (0, "Cannot embed win32 icons on this runtime: try the Mono runtime instead.");
-                                       mi.Invoke (ab, new object [] {  win32IconFile });
+                                       ab.__DefineIconResource (File.ReadAllBytes (win32IconFile));
                                }
                                catch (Exception ex) {
                                        Report (1031, "Error reading icon '" + win32IconFile + "' --" + ex);
@@ -685,6 +741,8 @@ namespace Mono.AssemblyLinker
                                }
                        }
 
+                       ModuleBuilder mainModule = null;
+
                        foreach (ResourceInfo res in resources) {
                                if (res.name == null)
                                        res.name = Path.GetFileName (res.fileName);
@@ -694,11 +752,13 @@ namespace Mono.AssemblyLinker
                                                Report (1046, String.Format ("Resource identifier '{0}' has already been used in this assembly", res.name));
 
                                if (res.isEmbedded) {
-                                       MethodInfo mi = typeof (AssemblyBuilder).GetMethod ("EmbedResourceFile", BindingFlags.Instance|BindingFlags.Public|BindingFlags.NonPublic,
-                                               null, CallingConventions.Any, new Type [] { typeof (string), typeof (string) }, null);
-                                       if (mi == null)
-                                               Report (0, "Cannot embed resources on this runtime: try the Mono runtime instead.");
-                                       mi.Invoke (ab, new object [] { res.name, res.fileName });
+                                       if (mainModule == null) {
+                                               mainModule = ab.DefineDynamicModule (fileName, fileName, false);
+                                       }
+
+                                       Stream stream = new MemoryStream (File.ReadAllBytes (res.fileName));
+
+                                       mainModule.DefineManifestResource (res.name, stream, res.isPrivate ? ResourceAttributes.Private : ResourceAttributes.Public);
                                }
                                else {
                                        if (res.target != null) {
@@ -721,8 +781,36 @@ namespace Mono.AssemblyLinker
                                }
                        }
 
+                       PortableExecutableKinds pekind = PortableExecutableKinds.ILOnly;
+                       ImageFileMachine machine;
+
+                       switch (platform) {
+                       case Platform.X86:
+                               pekind |= PortableExecutableKinds.Required32Bit;
+                               machine = ImageFileMachine.I386;
+                               break;
+                       case Platform.X64:
+                               pekind |= PortableExecutableKinds.PE32Plus;
+                               machine = ImageFileMachine.AMD64;
+                               break;
+                       case Platform.IA64:
+                               machine = ImageFileMachine.IA64;
+                               break;
+                       case Platform.AnyCPU32Preferred:
+                               pekind |= PortableExecutableKinds.Preferred32Bit;
+                               machine = ImageFileMachine.I386;
+                               break;
+                       case Platform.Arm:
+                               machine = ImageFileMachine.ARM;
+                               break;
+                       case Platform.AnyCPU:
+                       default:
+                               machine = ImageFileMachine.I386;
+                               break;
+                       }
+
                        try {
-                               ab.Save (fileName);
+                               ab.Save (fileName, pekind, machine);
                        }
                        catch (Exception ex) {
                                Report (1019, "Metadata failure creating assembly -- " + ex);
@@ -733,17 +821,14 @@ namespace Mono.AssemblyLinker
                {
                        // LAMESPEC: according to MSDN, the template assembly must have a
                        // strong name but this is not enforced
-                       const IKR.UniverseOptions options = IKR.UniverseOptions.MetadataOnly;
-
-                       var universe = new IKR.Universe (options);
                        var asm = universe.LoadFile (templateFile);
 
                        // Create missing assemblies, we don't want to load them!
                        // Code taken from ikdasm
                        var names = new HashSet<string> ();
-                       IKR.AssemblyName[] assembly_refs = asm.ManifestModule.__GetReferencedAssemblies ();
+                       AssemblyName[] assembly_refs = asm.ManifestModule.__GetReferencedAssemblies ();
 
-                       var resolved_assemblies = new IKR.Assembly [assembly_refs.Length];
+                       var resolved_assemblies = new Assembly [assembly_refs.Length];
                        for (int i = 0; i < resolved_assemblies.Length; i++) {
                                string name = assembly_refs [i].Name;
 
@@ -798,6 +883,85 @@ namespace Mono.AssemblyLinker
                                                        keyname = key_name_value;
                                        }
                                        break;
+
+                                       case "System.Reflection.AssemblyTitleAttribute": {
+                                               if (title != null)
+                                                       // ignore if specified on command line
+                                                       continue;
+
+                                               // AssemblyTitleAttribute .ctor(string title)
+                                               string title_value = (string) attr_data.ConstructorArguments [0].Value;
+
+                                               if (!String.IsNullOrEmpty (title_value))
+                                                       title = title_value;
+                                       }
+                                       break;
+
+                                       case "System.Reflection.AssemblyDescriptionAttribute": {
+                                               if (description != null)
+                                                       // ignore if specified on command line
+                                                       continue;
+
+                                               // AssemblyDescriptionAttribute .ctor(string description)
+                                               string description_value = (string) attr_data.ConstructorArguments [0].Value;
+
+                                               if (!String.IsNullOrEmpty (description_value))
+                                                       description = description_value;
+                                       }
+                                       break;
+
+                                       case "System.Reflection.AssemblyProductAttribute": {
+                                               if (product != null)
+                                                       // ignore if specified on command line
+                                                       continue;
+
+                                               // AssemblyProductAttribute .ctor(string product)
+                                               string product_value = (string) attr_data.ConstructorArguments [0].Value;
+
+                                               if (!String.IsNullOrEmpty (product_value))
+                                                       product = product_value;
+                                       }
+                                       break;
+
+                                       case "System.Reflection.AssemblyCompanyAttribute": {
+                                               if (company != null)
+                                                       // ignore if specified on command line
+                                                       continue;
+
+                                               // AssemblyCompanyAttribute .ctor(string company)
+                                               string company_value = (string) attr_data.ConstructorArguments [0].Value;
+
+                                               if (!String.IsNullOrEmpty (company_value))
+                                                       company = company_value;
+
+                                       }
+                                       break;
+
+                                       case "System.Reflection.AssemblyCopyrightAttribute": {
+                                               if (copyright != null)
+                                                       // ignore if specified on command line
+                                                       continue;
+
+                                               // AssemblyCopyrightAttribute .ctor(string copyright)
+                                               string copyright_value = (string) attr_data.ConstructorArguments [0].Value;
+
+                                               if (!String.IsNullOrEmpty (copyright_value))
+                                                       copyright = copyright_value;
+                                       }
+                                       break;
+
+                                       case "System.Reflection.AssemblyTrademarkAttribute": {
+                                               if (trademark != null)
+                                                       // ignore if specified on command line
+                                                       continue;
+
+                                               // AssemblyTrademarkAttribute .ctor(string trademark)
+                                               string trademark_value = (string) attr_data.ConstructorArguments [0].Value;
+
+                                               if (!String.IsNullOrEmpty (trademark_value))
+                                                       trademark = trademark_value;
+                                       }
+                                       break;
                                }
                        }
 
@@ -877,6 +1041,9 @@ namespace Mono.AssemblyLinker
                        "  /main:<method>            Specifies the method name of the entry point",
                        "  /nologo                   Suppress the startup banner and copyright message",
                        "  /out:<filename>           Output file name for the assembly manifest",
+                       "  /platform:<text>          Limit which platforms this code can run on; must be",
+                       "                            one of x86, Itanium, x64, arm, anycpu32bitpreferred,",
+                       "                            or anycpu (the default)",
                        "  /prod[uct]:<text>         Product name",
                        "  /productv[ersion]:<text>  Product version",
                        "  /t[arget]:lib[rary]       Create a library",
index 2657ba32963f0bd34039d77c93976da8c731b50f..20582303172ab9a33103073d73b7832fb85e6127 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 40cc077a60fe2237de9af9afc8975635a5f449a8..a9b1e46cba089a277538dad6b3961e245ec14c4f 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
diff --git a/mcs/tools/btls/AssemblyInfo.cs b/mcs/tools/btls/AssemblyInfo.cs
new file mode 100644 (file)
index 0000000..06f8d61
--- /dev/null
@@ -0,0 +1,26 @@
+using System;
+using System.Diagnostics;
+using System.Reflection;
+using System.Resources;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+[assembly: AssemblyTitle ("btls-cert-sync")]
+[assembly: AssemblyDescription ("btls-cert-sync")]
+[assembly: AssemblyDefaultAlias ("btls-cert-sync")]
+
+[assembly: AssemblyCompany (Consts.MonoCompany)]
+[assembly: AssemblyProduct (Consts.MonoProduct)]
+[assembly: AssemblyCopyright (Consts.MonoCopyright)]
+[assembly: AssemblyVersion (Consts.FxVersion)]
+[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
+[assembly: SatelliteContractVersion (Consts.FxVersion)]
+[assembly: AssemblyInformationalVersion (Consts.FxFileVersion)]
+
+[assembly: CLSCompliant (true)]
+[assembly: NeutralResourcesLanguage ("en-US")]
+
+[assembly: ComVisible (false)]
+
+[assembly: AssemblyDelaySign (true)]
+[assembly: AssemblyKeyFile ("../../class/mono.pub")]
diff --git a/mcs/tools/btls/Makefile b/mcs/tools/btls/Makefile
new file mode 100644 (file)
index 0000000..b551fa7
--- /dev/null
@@ -0,0 +1,17 @@
+thisdir = tools/btls
+SUBDIRS = 
+include ../../build/rules.make
+
+LOCAL_MCS_FLAGS =
+LIB_REFS = System Mono.Security Mono.Btls.Interface
+PROGRAM = btls-cert-sync.exe
+
+ifndef HAVE_BTLS
+PROGRAM_NAME = dummy-btls-cert-sync.exe
+NO_INSTALL = yes
+NO_SIGN_ASSEMBLY = yes
+NO_TEST = yes
+NO_BUILD = yes
+endif
+
+include ../../build/executable.make
diff --git a/mcs/tools/btls/btls-cert-sync-net_4_x.csproj b/mcs/tools/btls/btls-cert-sync-net_4_x.csproj
new file mode 100644 (file)
index 0000000..9075734
--- /dev/null
@@ -0,0 +1,99 @@
+<?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
+  <PropertyGroup>\r
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>\r
+    <ProductVersion>9.0.30729</ProductVersion>\r
+    <SchemaVersion>2.0</SchemaVersion>\r
+    <ProjectGuid>{2323EB4F-0DBA-47C7-B4AA-AD38CCD16BF8}</ProjectGuid>\r
+    <OutputType>Exe</OutputType>\r
+    <NoWarn>1699</NoWarn>\r
+    <OutputPath>./../../class/lib/net_4_x</OutputPath>\r
+    <IntermediateOutputPath>obj-net_4_x</IntermediateOutputPath>\r
+    <GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>\r
+    <NoStdLib>True</NoStdLib>\r
+    \r
+    <NoConfig>True</NoConfig>\r
+    \r
+    <AppDesignerFolder>Properties</AppDesignerFolder>\r
+    <RootNamespace>\r
+    </RootNamespace>\r
+    <AssemblyName>btls-cert-sync</AssemblyName>\r
+    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
+    <FileAlignment>512</FileAlignment>\r
+  </PropertyGroup>\r
+  \r
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
+    <DebugSymbols>true</DebugSymbols>\r
+    <DebugType>full</DebugType>\r
+    <NoWarn>1699</NoWarn>\r
+    <Optimize>false</Optimize>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
+    <ErrorReport>prompt</ErrorReport>\r
+    <WarningLevel>4</WarningLevel>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">\r
+    <DebugType>pdbonly</DebugType>\r
+    <NoWarn>1699</NoWarn>\r
+    <Optimize>true</Optimize>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
+    <ErrorReport>prompt</ErrorReport>\r
+    <WarningLevel>4</WarningLevel>\r
+  </PropertyGroup>\r
+  <!-- Set AddAdditionalExplicitAssemblyReferences to false, otherwise if targetting .NET4.0, \r
+  Microsoft.NETFramework.props will force a dependency on the assembly System.Core. This\r
+  is a problem to compile the Mono mscorlib.dll -->\r
+  <PropertyGroup>\r
+    <AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>\r
+  </PropertyGroup>\r
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />\r
+  <ItemGroup>\r
+    <Compile Include="..\..\build\common\Consts.cs" />\r
+    <Compile Include="..\..\build\common\SR.cs" />\r
+    <Compile Include="AssemblyInfo.cs" />\r
+    <Compile Include="btls-cert-sync.cs" />\r  </ItemGroup>\r
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \r
+       Other similar extension points exist, see Microsoft.Common.targets.\r
+  <Target Name="BeforeBuild">\r
+  </Target>\r
+  <Target Name="AfterBuild">\r
+  </Target>\r
+  -->\r
+  <PropertyGroup>\r
+    <PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
+
+    </PreBuildEvent>\r
+    <PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">\r
+\r
+    </PreBuildEvent>\r
+    <PostBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
+
+    </PostBuildEvent>\r
+    <PostBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">\r
+\r
+    </PostBuildEvent>\r
+  </PropertyGroup>\r
+  <ItemGroup>\r
+    <ProjectReference Include="../../class/corlib/corlib-net_4_x.csproj">\r
+      <Project>{2CA6026B-2DC8-4C4C-A12C-1E8234049DB7}</Project>\r
+      <Name>corlib-net_4_x</Name>\r
+    </ProjectReference>\r
+    <ProjectReference Include="../../class/System/System-net_4_x.csproj">\r
+      <Project>{2762E921-91A8-4C87-91E9-BA628013F753}</Project>\r
+      <Name>System-net_4_x</Name>\r
+    </ProjectReference>\r
+    <ProjectReference Include="../../class/Mono.Security/Mono.Security-net_4_x.csproj">\r
+      <Project>{42D59DE7-586F-4ACF-BDD5-E7869E39E3EF}</Project>\r
+      <Name>Mono.Security-net_4_x</Name>\r
+    </ProjectReference>\r
+    <ProjectReference Include="../../class/Mono.Btls.Interface/Mono.Btls.Interface-net_4_x.csproj">\r
+      <Project>{BF32D586-8FBB-4A2A-A734-AA17CDAB283F}</Project>\r
+      <Name>Mono.Btls.Interface-net_4_x</Name>\r
+    </ProjectReference>\r
+  </ItemGroup>\r
+  <ItemGroup>\r
+    <Folder Include="Properties\" />\r
+  </ItemGroup>\r
+</Project>\r
+
diff --git a/mcs/tools/btls/btls-cert-sync.cs b/mcs/tools/btls/btls-cert-sync.cs
new file mode 100644 (file)
index 0000000..fcdc708
--- /dev/null
@@ -0,0 +1,61 @@
+using System;
+using System.IO;
+using System.Text;
+using System.Security.Cryptography.X509Certificates;
+using MNS = Mono.Net.Security;
+
+namespace Mono.Btls
+{
+       static class BtlsCertSync
+       {
+               static void Main (string[] args)
+               {
+                       if (!MNS.MonoTlsProviderFactory.IsBtlsSupported ()) {
+                               Console.Error.WriteLine ("BTLS is not supported in this runtime!");
+                               Environment.Exit (255);
+                       }
+
+                       var configPath = Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData);
+                       configPath = Path.Combine (configPath, ".mono");
+
+                       var oldStorePath = Path.Combine (configPath, "certs", "Trust");
+                       var newStorePath = MonoBtlsX509StoreManager.GetStorePath (MonoBtlsX509StoreType.UserTrustedRoots);
+
+                       if (!Directory.Exists (oldStorePath)) {
+                               Console.WriteLine ("Old trust store {0} does not exist.");
+                               Environment.Exit (255);
+                       }
+
+                       if (Directory.Exists (newStorePath))
+                               Directory.Delete (newStorePath, true);
+                       Directory.CreateDirectory (newStorePath);
+
+                       var oldfiles = Directory.GetFiles (oldStorePath, "*.cer");
+                       Console.WriteLine ("Found {0} files in the old store.", oldfiles.Length);
+
+                       foreach (var file in oldfiles) {
+                               Console.WriteLine ("Converting {0}.", file);
+                               var data = File.ReadAllBytes (file);
+                               using (var x509 = MonoBtlsX509.LoadFromData (data, MonoBtlsX509Format.DER)) {
+                                       ConvertToNewFormat (newStorePath, x509);
+                               }
+                       }
+               }
+
+               static void ConvertToNewFormat (string root, MonoBtlsX509 x509)
+               {
+                       long hash = x509.GetSubjectNameHash ();
+
+                       string newName;
+                       int index = 0;
+                       do {
+                               newName = Path.Combine (root, string.Format ("{0:x8}.{1}", hash, index++));
+                       } while (File.Exists (newName));
+                       Console.WriteLine ("  new name: {0}", newName);
+
+                       using (var stream = new FileStream (newName, FileMode.Create))
+                       using (var bio = MonoBtlsBio.CreateMonoStream (stream))
+                                x509.ExportAsPEM (bio, true);
+               }
+       }
+}
diff --git a/mcs/tools/btls/btls-cert-sync.exe.sources b/mcs/tools/btls/btls-cert-sync.exe.sources
new file mode 100644 (file)
index 0000000..706d78f
--- /dev/null
@@ -0,0 +1,4 @@
+../../build/common/SR.cs
+../../build/common/Consts.cs
+AssemblyInfo.cs
+btls-cert-sync.cs
index ef7c94e26a1775d6b45fec208903de06233f35a6..b5f730ceb01065cf768ed4b3b3d65bd56b88c3a4 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 69b39b8665abe053fd1ce5a29c940a3e20918f0b..ae7efa8697c9b0dc85142bc7b6d8bdbbb2a28baa 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index fcac823667655241540db30c26a85efff866f638..96bbd89f8589480f3f36898d94cb989c1c0e8db4 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -80,8 +81,8 @@
       <Project>{2762E921-91A8-4C87-91E9-BA628013F753}</Project>\r
       <Name>System-net_4_x</Name>\r
     </ProjectReference>\r
-    <ProjectReference Include="../../class/Mono.Cecil/Mono.Cecil-net_4_x.csproj">\r
-      <Project>{2C0D558F-0B38-4691-967E-A910A1B995C1}</Project>\r
+    <ProjectReference Include="../../class/legacy/Mono.Cecil/Mono.Cecil-net_4_x.csproj">\r
+      <Project>{6DE38817-EC25-433A-AE58-0D30C5E6C460}</Project>\r
       <Name>Mono.Cecil-net_4_x</Name>\r
     </ProjectReference>\r
   </ItemGroup>\r
index 7a24a4cd46a1863b4142b92f75ab495efdde10d2..524b7cec7ad3ec4bfaf0b4d86af141f1d4e388f7 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index f177c17ef3a5215b60d576381f6959ff3602b474..b9262adae0c7c88c205d58cfc235ed3d615723f7 100644 (file)
@@ -14,7 +14,7 @@ namespace Xamarin {
 
        public static class CommonCryptor {
                
-               static public void Generate (string namespaceName, string typeName, string baseTypeName, string ccAlgorithmName, string feedbackSize = "8", string ctorInitializers = null)
+               static public void Generate (string namespaceName, string typeName, string baseTypeName, string ccAlgorithmName, string feedbackSize = "8", string ctorInitializers = null, string decryptorInitializers = null, string encryptorInitializers = null, string properties = null)
                {
                        string template = @"// Generated file to bind CommonCrypto cipher algorithms - DO NOT EDIT
 //
@@ -38,7 +38,9 @@ namespace %NAMESPACE% {
                        FeedbackSizeValue = %FEEDBACKSIZE%;
                        %CTOR_INIT%
                }
-               
+
+               %PROPERTIES%
+
                public override void GenerateIV ()
                {
                        IVValue = KeyBuilder.IV (BlockSizeValue >> 3);
@@ -51,6 +53,8 @@ namespace %NAMESPACE% {
                
                public override ICryptoTransform CreateDecryptor (byte[] rgbKey, byte[] rgbIV) 
                {
+                       %CREATEDECRYPTOR_INIT%
+
                        IntPtr decryptor = IntPtr.Zero;
                        switch (Mode) {
                        case CipherMode.CBC:
@@ -74,6 +78,8 @@ namespace %NAMESPACE% {
                
                public override ICryptoTransform CreateEncryptor (byte[] rgbKey, byte[] rgbIV) 
                {
+                       %CREATEENCRYPTOR_INIT%
+                       
                        IntPtr encryptor = IntPtr.Zero;
                        switch (Mode) {
                        case CipherMode.CBC:
@@ -98,6 +104,9 @@ namespace %NAMESPACE% {
                        
                        File.WriteAllText (typeName + ".g.cs", template.Replace ("%NAMESPACE%", namespaceName).
                                Replace ("%TYPE%", typeName).Replace ("%BASE%", baseTypeName).Replace("%FEEDBACKSIZE%", feedbackSize).Replace ("%CTOR_INIT%", ctorInitializers).
+                               Replace ("%CREATEDECRYPTOR_INIT%", decryptorInitializers).
+                               Replace ("%CREATEENCRYPTOR_INIT%", encryptorInitializers).
+                               Replace ("%PROPERTIES%", properties).
                                Replace ("%CCALGORITHM%", ccAlgorithmName.ToString ()));
                }
        }
index f33343cf5e6ebf08b04253e00df407d6df093393..0ade887e5b1e6d2f582e4dcffa79ec5cea9e6d21 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index a7d13c8cb80c9738d0cd90f07c07eb333f031e62..4fb846fe8f74fa1a879236ddd0c660d9dd84f117 100644 (file)
@@ -42,7 +42,13 @@ namespace Xamarin {
                        // mscorlib replacements
                        CommonCryptor.Generate ("System.Security.Cryptography", "DESCryptoServiceProvider", "DES", "DES");
                        CommonCryptor.Generate ("System.Security.Cryptography", "TripleDESCryptoServiceProvider", "TripleDES", "TripleDES");
-                       CommonCryptor.Generate ("System.Security.Cryptography", "RC2CryptoServiceProvider", "RC2", "RC2", ctorInitializers: "LegalKeySizesValue = new[] { new KeySizes(40, 128, 8) };");
+
+                       const string checkUseSalt = "if (UseSalt) throw new NotImplementedException (\"UseSalt=true is not implemented on Mono yet\");";
+                       CommonCryptor.Generate ("System.Security.Cryptography", "RC2CryptoServiceProvider", "RC2", "RC2",
+                               ctorInitializers: "LegalKeySizesValue = new[] { new KeySizes(40, 128, 8) };",
+                               decryptorInitializers: checkUseSalt,
+                               encryptorInitializers: checkUseSalt,
+                               properties: "public bool UseSalt { get; set; }");
                        // Rijndael supports block sizes that are not available in AES - as such it does not use the same generated code
                        // but has it's own version, using AES (128 bits block size) and falling back to managed (192/256 bits block size)
 
index 22ebee6b91de23e5fedadfe4aca0d5bd1b3f156b..e7ad8f6d4c71a961d1c2fcb02cfd7efe5989bd7b 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index ec7e9dfc25a13881ee7e8ae8e0dec25750fc879e..265f702ab654b6e0ec0041bc3d53a8a0de9c2096 100644 (file)
@@ -91,7 +91,7 @@ namespace TestRunner {
                }
        }
 
-#if !NET_2_1
+#if !MOBILE
        class ProcessTester: ITester
        {
                ProcessStartInfo pi;
@@ -734,7 +734,7 @@ namespace TestRunner {
                bool update_verif_file;
                Hashtable verif_data;
 
-#if !NET_2_1
+#if !MOBILE
                ProcessStartInfo pi;
 #endif
                readonly string mono;
@@ -756,7 +756,7 @@ namespace TestRunner {
                        files_folder = Directory.GetCurrentDirectory ();
                        this.verif_file = verif_file;
 
-#if !NET_2_1
+#if !MOBILE
                        pi = new ProcessStartInfo ();
                        pi.CreateNoWindow = true;
                        pi.WindowStyle = ProcessWindowStyle.Hidden;
@@ -965,7 +965,7 @@ namespace TestRunner {
                        string filename = test.FileName;
 
                        AppDomain domain = null;
-#if !NET_2_1
+#if !MOBILE
                        if (safe_execution) {
                                // Create a new AppDomain, with the current directory as the base.
                                AppDomainSetup setupInfo = new AppDomainSetup ();
@@ -977,7 +977,7 @@ namespace TestRunner {
                        try {
                                DomainTester tester;
                                try {
-#if !NET_2_1
+#if !MOBILE
                                        if (domain != null)
                                                tester = (DomainTester) domain.CreateInstanceAndUnwrap (typeof (PositiveChecker).Assembly.FullName, typeof (DomainTester).FullName);
                                        else
@@ -998,7 +998,7 @@ namespace TestRunner {
                                if (doc_output != null) {
                                        string ref_file = filename.Replace (".cs", "-ref.xml");
                                        try {
-#if !NET_2_1
+#if !MOBILE
                                                new XmlComparer ("doc").Compare (ref_file, doc_output);
 #endif
                                        } catch (Exception e) {
index bd9ade36038e4d8f92bcdab088cb89a7dea1599b..ddcb6a70c08ddec225a9e55e1317f4e2b47bafcd 100644 (file)
@@ -24,9 +24,9 @@
 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\r
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\r
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
-//
+//\r
 \r
-#if !NET_2_1\r
+#if !MOBILE\r
 \r
 using System;\r
 using System.Collections;\r
@@ -137,4 +137,4 @@ public class XmlComparer
        }\r
 }\r
 \r
-#endif
+#endif\r
index 5fcf051eccfd77fdf17f66ecda420adea0893e56..2fe5b02961889c70e20ae3870e33f0dce1555732 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -79,8 +80,8 @@
       <Project>{2CA6026B-2DC8-4C4C-A12C-1E8234049DB7}</Project>\r
       <Name>corlib-net_4_x</Name>\r
     </ProjectReference>\r
-    <ProjectReference Include="../../class/Mono.Cecil/Mono.Cecil-net_4_x.csproj">\r
-      <Project>{2C0D558F-0B38-4691-967E-A910A1B995C1}</Project>\r
+    <ProjectReference Include="../../class/legacy/Mono.Cecil/Mono.Cecil-net_4_x.csproj">\r
+      <Project>{6DE38817-EC25-433A-AE58-0D30C5E6C460}</Project>\r
       <Name>Mono.Cecil-net_4_x</Name>\r
     </ProjectReference>\r
     <ProjectReference Include="../../class/System.XML/System.Xml-net_4_x.csproj">\r
index 0e665fe7f5b0149ad30c17a21bec4e1ce8d54405..cf6b17771074300da5e30245ccf685e92d93488a 100644 (file)
@@ -1089,9 +1089,12 @@ namespace CorCompare
                        if (!(memberDefenition is MethodDefinition))
                                return;
 
-                       MethodDefinition mbase = (MethodDefinition) memberDefenition;
+                       MethodDefinition mbase = (MethodDefinition)memberDefenition;
+
+                       ParameterData parms = new ParameterData (writer, mbase.Parameters) {
+                               HasExtensionParameter = mbase.CustomAttributes.Any (l => l.AttributeType.FullName == "System.Runtime.CompilerServices.ExtensionAttribute")
+                       };
 
-                       ParameterData parms = new ParameterData (writer, mbase.Parameters);
                        parms.DoOutput ();
 
                        MemberData.OutputGenericParameters (writer, mbase);
@@ -1137,8 +1140,11 @@ namespace CorCompare
                        this.parameters = parameters;
                }
 
+               public bool HasExtensionParameter { get; set; }
+
                public override void DoOutput ()
                {
+                       bool first = true;
                        writer.WriteStartElement ("parameters");
                        foreach (ParameterDefinition parameter in parameters) {
                                writer.WriteStartElement ("parameter");
@@ -1146,13 +1152,17 @@ namespace CorCompare
                                AddAttribute ("position", parameter.Method.Parameters.IndexOf(parameter).ToString(CultureInfo.InvariantCulture));
                                AddAttribute ("attrib", ((int) parameter.Attributes).ToString());
 
-                               string direction = "in";
+                               string direction = first && HasExtensionParameter ? "this" : "in";
+                               first = false;
 
-                               if (parameter.ParameterType is ByReferenceType)
+                               var pt = parameter.ParameterType;
+                               var brt = pt as ByReferenceType;
+                               if (brt != null) {
                                        direction = parameter.IsOut ? "out" : "ref";
+                                       pt = brt.ElementType;
+                               }
 
-                               TypeReference t = parameter.ParameterType;
-                               AddAttribute ("type", Utils.CleanupTypeName (t));
+                               AddAttribute ("type", Utils.CleanupTypeName (pt));
 
                                if (parameter.IsOptional) {
                                        AddAttribute ("optional", "true");
@@ -1531,13 +1541,15 @@ namespace CorCompare
 
                                ParameterDefinition info = infos [i];
 
+                               string modifier = string.Empty;
                                if (info.ParameterType.IsByReference) {
-                                       string modifier;
-                                       if ((info.Attributes & (ParameterAttributes.Out | ParameterAttributes.In)) == ParameterAttributes.Out)
+                                       if ((info.Attributes & ParameterAttributes.In) != 0)
+                                               modifier = "in";
+                                       else if ((info.Attributes & ParameterAttributes.Out) != 0)
                                                modifier = "out";
-                                       else
-                                               modifier = "ref";
+                               }
 
+                               if (modifier.Length > 0) {
                                        signature.Append (modifier);
                                        signature.Append (" ");
                                }
index bb93b0e0619a7043094c3271509202193411337d..eacdad812b89f09c4cb9371f32d2469e08689cc3 100644 (file)
@@ -33,9 +33,6 @@
     <Reference Include="System" />\r
     <Reference Include="System.Core" />\r
     <Reference Include="System.Xml" />\r
-    <Reference Include="Mono.Cecil">\r
-      <HintPath>..\..\class\lib\net_4_x\Mono.Cecil.dll</HintPath>\r
-    </Reference>\r
   </ItemGroup>\r
   <ItemGroup>\r
     <Compile Include="AssemblyResolver.cs" />\r
     <Compile Include="..\..\class\Mono.Options\Mono.Options\Options.cs">\r
       <Link>Options.cs</Link>\r
     </Compile>\r
+\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil.Cil\*.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil.Metadata\*.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil.PE\*.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\ArrayType.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\AssemblyDefinition.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\AssemblyFlags.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\AssemblyHashAlgorithm.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\AssemblyLinkedResource.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\AssemblyNameDefinition.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\AssemblyNameReference.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\AssemblyReader.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\AssemblyWriter.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\BaseAssemblyResolver.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\CallSite.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\CustomAttribute.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\DefaultAssemblyResolver.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\EmbeddedResource.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\EventAttributes.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\EventDefinition.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\EventReference.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\ExportedType.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\FieldAttributes.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\FieldDefinition.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\FieldReference.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\FileAttributes.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\FunctionPointerType.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\GenericInstanceMethod.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\GenericInstanceType.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\GenericParameter.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\GenericParameterAttributes.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\IConstantProvider.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\ICustomAttributeProvider.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\IGenericInstance.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\IGenericParameterProvider.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\IMarshalInfoProvider.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\IMemberDefinition.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\IMetadataScope.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\IMetadataTokenProvider.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\IMethodSignature.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\Import.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\LinkedResource.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\ManifestResourceAttributes.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\MarshalInfo.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\MemberDefinitionCollection.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\MemberReference.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\MetadataResolver.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\MetadataSystem.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\MethodAttributes.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\MethodCallingConvention.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\MethodDefinition.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\MethodImplAttributes.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\MethodReference.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\MethodReturnType.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\MethodSemanticsAttributes.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\MethodSpecification.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\Modifiers.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\ModuleDefinition.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\ModuleKind.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\ModuleReference.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\NativeType.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\ParameterAttributes.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\ParameterDefinition.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\ParameterDefinitionCollection.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\ParameterReference.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\PinnedType.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\PInvokeAttributes.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\PInvokeInfo.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\PointerType.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\PropertyAttributes.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\PropertyDefinition.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\PropertyReference.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\ReferenceType.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\Resource.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\SecurityDeclaration.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\SentinelType.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\TargetRuntime.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\Treatments.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\TypeAttributes.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\TypeDefinition.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\TypeDefinitionCollection.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\TypeParser.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\TypeReference.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\TypeSpecification.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\TypeSystem.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\VariantType.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\WindowsRuntimeProjections.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Collections.Generic\*.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Security.Cryptography\*.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono\*.cs" />    \r
   </ItemGroup>\r
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />\r
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \r
index 1da92c6446f91a190544a38785d58861cbee36a1..e29fe61a1756bcb8d68764e76ab6a2b77097ed7d 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>3021,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>3021,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 75b22b934c83c16f46c9d255ce384d5ab8b53368..567c766e6cb5092bce1e1803a64f8e78e1647eb7 100644 (file)
@@ -55,7 +55,7 @@ namespace Mono {
                        var startup_files = new string [settings.SourceFiles.Count];
                        int i = 0;
                        foreach (var source in settings.SourceFiles)
-                               startup_files [i++] = source.FullPathName;
+                               startup_files [i++] = source.OriginalFullPathName;
                        settings.SourceFiles.Clear ();
 
                        TextWriter agent_stderr = null;
index c28f23987fcefec757b937845481b8ebe524463c..9049faba66a9d15d36cf21b130d19182afc24623 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 28c7350a7c95ef0f55ade2a1a785e2cfc2a900cd..a1907c4617c665f14fd61cff44839ebc5bf7526d 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 4d15a18b0e9200cfd4431aba39e22241984a82ce..2d254d6f33d60c7c8b1b35ddaec5f32c731df857 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 01da80aef2a12309fc8c123653817e9414e96448..c5d2c39107df69e30b7f88fbaac04d9d1f559bef 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index f98314ecec7afb9db0957bb70edde80431c647b9..ff66d61364ca057147d7539772b5b7286c5628ea 100644 (file)
@@ -2,8 +2,8 @@ thisdir = tools/gacutil
 SUBDIRS = 
 include ../../build/rules.make
 
-LIB_REFS = Mono.Security
-LOCAL_MCS_FLAGS = -unsafe
+LIB_REFS = System Mono.Security System.Security
+LOCAL_MCS_FLAGS = -unsafe -define:NO_SYMBOL_WRITER
 
 PROGRAM = gacutil.exe
 
index 13f686e22c64ec5dadc09c136838db3ed7c74a43..47c4ac8df96bd44da12af6c98d5309da235cbc89 100644 (file)
@@ -14,7 +14,6 @@ using System;
 using System.IO;
 using System.Diagnostics;
 using System.Text;
-using System.Reflection;
 using System.Collections;
 using System.Globalization;
 using System.Runtime.InteropServices;
@@ -23,6 +22,8 @@ using System.Security.Cryptography;
 using Mono.Security;
 using Mono.Security.Cryptography;
 
+using IKVM.Reflection;
+
 namespace Mono.Tools {
 
        public class Driver {
@@ -48,6 +49,7 @@ namespace Mono.Tools {
 
                private static bool silent;
                static bool in_bootstrap;
+               private static Universe _universe;
 
                public static int Main (string [] args)
                {
@@ -244,7 +246,7 @@ namespace Mono.Tools {
                        AssemblyName an = null;
 
                        try {
-                               assembly = Assembly.LoadFrom (name);
+                               assembly = ReflectionOnlyLoadFrom (name);
                        } catch {
                                WriteLine (string.Format (failure_msg, name) + "The file specified is not a valid assembly.");
                                return false;
@@ -744,12 +746,27 @@ namespace Mono.Tools {
                        }
                }
 
+               private static Universe GetUniverse () {
+                       if (_universe == null) {
+                               _universe = new Universe (UniverseOptions.MetadataOnly);
+                       }
+                       return _universe;
+               }
+
+               private static Assembly ReflectionOnlyLoadFrom (string fileName)
+               {
+                       return GetUniverse ().LoadFile (fileName);
+               }
+               private static AssemblyName GetCorlibName ()
+               {
+                       return GetUniverse ().Mscorlib.GetName ();
+               }
+
                private static bool CheckReferencedAssemblies (AssemblyName an)
                {
-                       AppDomain d = null;
                        try {
-                               Assembly a = Assembly.LoadFrom (an.CodeBase);
-                               AssemblyName corlib = typeof (object).Assembly.GetName ();
+                               Assembly a = ReflectionOnlyLoadFrom (an.CodeBase);
+                               AssemblyName corlib = GetCorlibName ();
 
                                foreach (AssemblyName ref_an in a.GetReferencedAssemblies ()) {
                                        if (ref_an.Name == corlib.Name) // Just do a string compare so we can install on diff versions
@@ -763,12 +780,6 @@ namespace Mono.Tools {
                        } catch (Exception e) {
                                WriteLine (e.ToString ()); // This should be removed pre beta3
                                return false;
-                       } finally {
-                               if (d != null) {
-                                       try {
-                                               AppDomain.Unload (d);
-                                       } catch { }
-                               }
                        }
 
                        return true;
@@ -800,8 +811,8 @@ namespace Mono.Tools {
 
                static bool LoadConfig (bool quiet)
                {
-                       MethodInfo config = typeof (System.Environment).GetMethod ("GetMachineConfigPath",
-                               BindingFlags.Static | BindingFlags.NonPublic);
+                       System.Reflection.MethodInfo config = typeof (System.Environment).GetMethod ("GetMachineConfigPath",
+                               System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic);
 
                        if (config != null) {
                                string path = (string) config.Invoke (null, null);
@@ -832,7 +843,7 @@ namespace Mono.Tools {
 
                        // Note: MustVerify is based on the original token (by design). Public key
                        // remapping won't affect if the assembly is verified or not.
-                       if (StrongNameManager.MustVerify (an)) {
+                       if (StrongNameManager.MustVerify (new System.Reflection.AssemblyName (an.FullName))) {
                                RSA rsa = CryptoConvert.FromCapiPublicKeyBlob (publicKey, 12);
                                StrongName sn = new StrongName (rsa);
                                if (sn.Verify (assemblyFile)) {
@@ -899,20 +910,20 @@ namespace Mono.Tools {
                public static extern int symlink (string oldpath, string newpath);
 
                private static string GetGacDir () {
-                       PropertyInfo gac = typeof (System.Environment).GetProperty ("GacPath",
-                                       BindingFlags.Static|BindingFlags.NonPublic);
+                       System.Reflection.PropertyInfo gac = typeof (System.Environment).GetProperty ("GacPath",
+                                       System.Reflection.BindingFlags.Static|System.Reflection.BindingFlags.NonPublic);
                        if (gac == null) {
                                WriteLine ("ERROR: Mono runtime not detected, please use " +
                                                "the mono runtime for gacutil.exe");
                                Environment.Exit (1);
                        }
-                       MethodInfo get_gac = gac.GetGetMethod (true);
+                       System.Reflection.MethodInfo get_gac = gac.GetGetMethod (true);
                        return (string) get_gac.Invoke (null, null);
                }
 
                private static string GetLibDir () {
-                       MethodInfo libdir = typeof (System.Environment).GetMethod ("internalGetGacPath",
-                                       BindingFlags.Static|BindingFlags.NonPublic);
+                       System.Reflection.MethodInfo libdir = typeof (System.Environment).GetMethod ("internalGetGacPath",
+                                       System.Reflection.BindingFlags.Static|System.Reflection.BindingFlags.NonPublic);
                        if (libdir == null) {
                                WriteLine ("ERROR: Mono runtime not detected, please use " +
                                                "the mono runtime for gacutil.exe");
index fb1472e31a3e280e4fd0c6ad4daeff130b542f04..314a5481ddbd2cb62b4cc212a4a900ea111574f2 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NO_SYMBOL_WRITER;NET_4_0;NET_4_5;NET_4_6;MONO;NO_SYMBOL_WRITER;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NO_SYMBOL_WRITER;NET_4_0;NET_4_5;NET_4_6;MONO;NO_SYMBOL_WRITER;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
   </PropertyGroup>\r
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />\r
   <ItemGroup>\r
+    <Compile Include="..\..\..\external\ikvm\reflect\*.cs" />\r
+    <Compile Include="..\..\..\external\ikvm\reflect\Emit\*.cs" />\r
+    <Compile Include="..\..\..\external\ikvm\reflect\Impl\ITypeOwner.cs" />\r
+    <Compile Include="..\..\..\external\ikvm\reflect\Impl\SymbolSupport.cs" />\r
+    <Compile Include="..\..\..\external\ikvm\reflect\Metadata\*.cs" />\r
+    <Compile Include="..\..\..\external\ikvm\reflect\Reader\*.cs" />\r
+    <Compile Include="..\..\..\external\ikvm\reflect\Writer\*.cs" />\r
     <Compile Include="..\security\StrongNameManager.cs" />\r
     <Compile Include="driver.cs" />\r  </ItemGroup>\r
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \r
       <Project>{2CA6026B-2DC8-4C4C-A12C-1E8234049DB7}</Project>\r
       <Name>corlib-net_4_x</Name>\r
     </ProjectReference>\r
+    <ProjectReference Include="../../class/System/System-net_4_x.csproj">\r
+      <Project>{2762E921-91A8-4C87-91E9-BA628013F753}</Project>\r
+      <Name>System-net_4_x</Name>\r
+    </ProjectReference>\r
     <ProjectReference Include="../../class/Mono.Security/Mono.Security-net_4_x.csproj">\r
       <Project>{42D59DE7-586F-4ACF-BDD5-E7869E39E3EF}</Project>\r
       <Name>Mono.Security-net_4_x</Name>\r
     </ProjectReference>\r
+    <ProjectReference Include="../../class/System.Security/System.Security-net_4_x.csproj">\r
+      <Project>{3ED36717-A9D1-4289-8949-9B7F39766DEB}</Project>\r
+      <Name>System.Security-net_4_x</Name>\r
+    </ProjectReference>\r
   </ItemGroup>\r
   <ItemGroup>\r
     <Folder Include="Properties\" />\r
index 911afaf9d8219cd369a76a6269e559c1429cd238..4772378b43cb3ad9898901b636de031cacd48cbc 100644 (file)
@@ -1,2 +1,9 @@
 driver.cs
 ../security/StrongNameManager.cs
+../../../external/ikvm/reflect/*.cs
+../../../external/ikvm/reflect/Metadata/*.cs
+../../../external/ikvm/reflect/Emit/*.cs
+../../../external/ikvm/reflect/Reader/*.cs
+../../../external/ikvm/reflect/Writer/*.cs
+../../../external/ikvm/reflect/Impl/ITypeOwner.cs
+../../../external/ikvm/reflect/Impl/SymbolSupport.cs
index 508aee2f63b8809b1a3c395b65e24bdff7352d26..7cb491a46954009798da0eb0699efe2b8db70511 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 7c3ce2b390a7111af0811ec2649f88d0bdaacc23..698e8cd2321e545a18f5f283bd6f05d23ea0aa41 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index f8aa6becff009e0dcfece71045761a8231257b6a..766f8249bfb759af45e977d5c2057bf66870c644 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NO_SYMBOL_WRITER;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NO_SYMBOL_WRITER;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NO_SYMBOL_WRITER;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NO_SYMBOL_WRITER;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 2dfe29a9fa23cf5c6f99f7ddfc90143b2f319f12..522a2afcf0aa47801f947533da531a492ce902d1 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 01cd3e394e3ef1f9be3fe5423bc3377b20729234..4fa01f15b4cb3953bdc9c76bb1502072850ad517 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 2c8b983ec80361220d93fd99f10066c3bc2a28fe..938623a3fda720afd039d3bef14589dd0f5831d7 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index c417ab01240d00cfaf6f12f99339d9df3647f10f..7c539e9ef51b320292ed9fa39f90944676ef90d4 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
diff --git a/mcs/tools/linker/AUTHORS b/mcs/tools/linker/AUTHORS
deleted file mode 100644 (file)
index 4af5896..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Jb Evain <jbevain@novell.com>
index 64434b063c8ddcbbfd0ad8d9373f4ba73081fd97..31764d0efac7e6113a3689c233918c2aed052786 100644 (file)
                <type fullname="System.Reflection.MonoEventInfo" preserve="fields" />
                <type fullname="System.Reflection.MonoField" preserve="fields" />
                <type fullname="System.Reflection.MonoGenericClass" preserve="fields" />
-               <type fullname="System.Reflection.MonoGenericMethod" preserve="fields" />
-               <type fullname="System.Reflection.MonoGenericCMethod" preserve="fields" />
                <type fullname="System.Reflection.MonoMethod" preserve="fields" />
                <type fullname="System.Reflection.MonoMethodInfo" preserve="fields" />
                <type fullname="System.Reflection.MonoPropertyInfo" preserve="fields" />
                <type fullname="System.Reflection.Emit.MethodBuilder" preserve="fields" />
                <type fullname="System.Reflection.Emit.ModuleBuilder" preserve="fields">
                        <method name="Mono_GetGuid" />
+                       <method name="RuntimeResolve" />
                </type>
                <type fullname="System.Reflection.Emit.MonoResource" preserve="fields" />
                <type fullname="System.Reflection.Emit.MonoWin32Resource" preserve="fields" />
 
                 <!-- by convention (and see #34671) -->
                 <type fullname="Mono.Runtime" />
+
+               <type fullname="Mono.RuntimeStructs/HandleStackMark" />
+               <type fullname="Mono.RuntimeStructs/MonoError" />
        </assembly>
 </linker>
diff --git a/mcs/tools/linker/MIT.X11 b/mcs/tools/linker/MIT.X11
deleted file mode 100644 (file)
index d2d78ee..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-Copyright (c) 2007 Novell, Inc and the individuals listed on the
-ChangeLog entries.
-
-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.
diff --git a/mcs/tools/linker/Mono.Linker.Steps/BaseStep.cs b/mcs/tools/linker/Mono.Linker.Steps/BaseStep.cs
deleted file mode 100644 (file)
index 13cf468..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-//
-// BaseStep.cs
-//
-// Author:
-//   Jb Evain (jbevain@novell.com)
-//
-// (C) 2007 Novell, Inc.
-//
-// 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 Mono.Cecil;
-
-namespace Mono.Linker.Steps {
-
-       public abstract class BaseStep : IStep {
-
-               private LinkContext _context;
-
-               public LinkContext Context {
-                       get { return _context; }
-               }
-
-               public AnnotationStore Annotations {
-                       get { return _context.Annotations; }
-               }
-
-               public void Process (LinkContext context)
-               {
-                       _context = context;
-
-                       if (!ConditionToProcess ())
-                               return;
-
-                       Process ();
-
-                       foreach (AssemblyDefinition assembly in context.GetAssemblies ())
-                               ProcessAssembly (assembly);
-
-                       EndProcess ();
-               }
-
-               protected virtual bool ConditionToProcess ()
-               {
-                       return true;
-               }
-
-               protected virtual void Process ()
-               {
-               }
-
-               protected virtual void EndProcess ()
-               {
-               }
-
-               protected virtual void ProcessAssembly (AssemblyDefinition assembly)
-               {
-               }
-       }
-}
diff --git a/mcs/tools/linker/Mono.Linker.Steps/BlacklistStep.cs b/mcs/tools/linker/Mono.Linker.Steps/BlacklistStep.cs
deleted file mode 100644 (file)
index 6c6344b..0000000
+++ /dev/null
@@ -1,132 +0,0 @@
-//
-// Blacklist.cs
-//
-// Author:
-//   Jb Evain (jb@nurv.fr)
-//
-// (C) 2007 Novell Inc.
-//
-// 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.Linq;
-using System.IO;
-using System.Reflection;
-using System.Xml;
-using System.Xml.XPath;
-
-using Mono.Cecil;
-
-namespace Mono.Linker.Steps {
-
-       public class BlacklistStep : BaseStep {
-
-               protected override bool ConditionToProcess()
-               {
-                       return Context.CoreAction == AssemblyAction.Link;
-               }
-
-               protected override void Process ()
-               {
-                       foreach (string name in Assembly.GetExecutingAssembly ().GetManifestResourceNames ()) {
-                               if (!name.EndsWith (".xml", StringComparison.OrdinalIgnoreCase) || !IsReferenced (GetAssemblyName (name)))
-                                       continue;
-
-                               try {
-                                       if (Context.LogInternalExceptions)
-                                               Console.WriteLine ("Processing resource linker descriptor: {0}", name);
-                                       Context.Pipeline.AddStepAfter (typeof (TypeMapStep), GetResolveStep (name));
-                               } catch (XmlException ex) {
-                                       /* This could happen if some broken XML file is included. */
-                                       if (Context.LogInternalExceptions)
-                                               Console.WriteLine ("Error processing {0}: {1}", name, ex);
-                               }
-                       }
-
-                       foreach (var asm in Context.GetAssemblies ()) {
-                               foreach (var rsc in asm.Modules
-                                                                       .SelectMany (mod => mod.Resources)
-                                                                       .Where (res => res.ResourceType == ResourceType.Embedded)
-                                                                       .Where (res => res.Name.EndsWith (".xml", StringComparison.OrdinalIgnoreCase))
-                                                                       .Where (res => IsReferenced (GetAssemblyName (res.Name)))
-                                                                       .Cast<EmbeddedResource> ()) {
-                                       try {
-                                               if (Context.LogInternalExceptions)
-                                                       Console.WriteLine ("Processing embedded resource linker descriptor: {0}", rsc.Name);
-
-                                               Context.Pipeline.AddStepAfter (typeof (TypeMapStep), GetExternalResolveStep (rsc, asm));
-                                       } catch (XmlException ex) {
-                                               /* This could happen if some broken XML file is embedded. */
-                                               if (Context.LogInternalExceptions)
-                                                       Console.WriteLine ("Error processing {0}: {1}", rsc.Name, ex);
-                                       }
-                               }
-                       }
-               }
-
-               static string GetAssemblyName (string descriptor)
-               {
-                       int pos = descriptor.LastIndexOf ('.');
-                       if (pos == -1)
-                               return descriptor;
-
-                       return descriptor.Substring (0, pos);
-               }
-
-               bool IsReferenced (string name)
-               {
-                       foreach (AssemblyDefinition assembly in Context.GetAssemblies ())
-                               if (assembly.Name.Name == name)
-                                       return true;
-
-                       return false;
-               }
-
-               static ResolveFromXmlStep GetExternalResolveStep (EmbeddedResource resource, AssemblyDefinition assembly)
-               {
-                       return new ResolveFromXmlStep (GetExternalDescriptor (resource), "resource " + resource.Name + " in " + assembly.FullName);
-               }
-
-               static ResolveFromXmlStep GetResolveStep (string descriptor)
-               {
-                       return new ResolveFromXmlStep (GetDescriptor (descriptor), "descriptor " + descriptor + " from " + Assembly.GetExecutingAssembly ().FullName);
-               }
-
-               static XPathDocument GetExternalDescriptor (EmbeddedResource resource)
-               {
-                       using (var sr = new StreamReader (resource.GetResourceStream ())) {
-                               return new XPathDocument (new StringReader (sr.ReadToEnd ()));
-                       }
-               }
-
-               static XPathDocument GetDescriptor (string descriptor)
-               {
-                       using (StreamReader sr = new StreamReader (GetResource (descriptor))) {
-                               return new XPathDocument (new StringReader (sr.ReadToEnd ()));
-                       }
-               }
-
-               static Stream GetResource (string descriptor)
-               {
-                       return Assembly.GetExecutingAssembly ().GetManifestResourceStream (descriptor);
-               }
-       }
-}
diff --git a/mcs/tools/linker/Mono.Linker.Steps/CleanStep.cs b/mcs/tools/linker/Mono.Linker.Steps/CleanStep.cs
deleted file mode 100644 (file)
index ccc34cb..0000000
+++ /dev/null
@@ -1,108 +0,0 @@
-//
-// CleanStep.cs
-//
-// Author:
-//   Jb Evain (jbevain@gmail.com)
-//
-// (C) 2006 Jb Evain
-//
-// 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.Collections;
-
-using Mono.Cecil;
-
-namespace Mono.Linker.Steps {
-
-       public class CleanStep : BaseStep {
-
-               protected override void ProcessAssembly (AssemblyDefinition assembly)
-               {
-                       if (Annotations.GetAction (assembly) == AssemblyAction.Link)
-                               CleanAssembly (assembly);
-               }
-
-               static void CleanAssembly (AssemblyDefinition asm)
-               {
-                       foreach (TypeDefinition type in asm.MainModule.Types)
-                               CleanType (type);
-               }
-
-               static void CleanType (TypeDefinition type)
-               {
-                       if (type.HasProperties)
-                               CleanProperties (type);
-                       if (type.HasEvents)
-                               CleanEvents (type);
-
-                       if (type.HasNestedTypes)
-                               foreach (var nested in type.NestedTypes)
-                                       CleanType (nested);
-               }
-
-               static MethodDefinition CheckMethod (TypeDefinition type, MethodDefinition method)
-               {
-                       if (method == null)
-                               return null;
-
-                       return type.Methods.Contains (method) ? method : null;
-               }
-
-               static void CleanEvents (TypeDefinition type)
-               {
-                       var events = type.Events;
-
-                       for (int i = 0; i < events.Count; i++) {
-                               var evt = events [i];
-                               evt.AddMethod = CheckMethod (type, evt.AddMethod);
-                               evt.InvokeMethod = CheckMethod (type, evt.InvokeMethod);
-                               evt.RemoveMethod = CheckMethod (type, evt.RemoveMethod);
-
-                               if (!IsEventUsed (evt))
-                                       events.RemoveAt (i--);
-                       }
-               }
-
-               static bool IsEventUsed (EventDefinition evt)
-               {
-                       return evt.AddMethod != null || evt.InvokeMethod != null || evt.RemoveMethod != null;
-               }
-
-               static void CleanProperties (TypeDefinition type)
-               {
-                       var properties = type.Properties;
-
-                       for (int i = 0; i < properties.Count; i++) {
-                               var prop = properties [i];
-                               prop.GetMethod = CheckMethod (type, prop.GetMethod);
-                               prop.SetMethod = CheckMethod (type, prop.SetMethod);
-
-                               if (!IsPropertyUsed (prop))
-                                       properties.RemoveAt (i--);
-                       }
-               }
-
-               static bool IsPropertyUsed (PropertyDefinition prop)
-               {
-                       return prop.GetMethod != null || prop.SetMethod != null;
-               }
-       }
-}
diff --git a/mcs/tools/linker/Mono.Linker.Steps/IStep.cs b/mcs/tools/linker/Mono.Linker.Steps/IStep.cs
deleted file mode 100644 (file)
index c01ef1e..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-//
-// IStep.cs
-//
-// Author:
-//   Jb Evain (jbevain@gmail.com)
-//
-// (C) 2006 Jb Evain
-//
-// 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.
-//
-
-namespace Mono.Linker.Steps {
-
-       public interface IStep {
-               void Process (LinkContext context);
-       }
-}
diff --git a/mcs/tools/linker/Mono.Linker.Steps/LoadI18nAssemblies.cs b/mcs/tools/linker/Mono.Linker.Steps/LoadI18nAssemblies.cs
deleted file mode 100644 (file)
index 45ac924..0000000
+++ /dev/null
@@ -1,102 +0,0 @@
-//
-// LoadI18nAssemblies.cs
-//
-// Author:
-//   Jb Evain (jbevain@novell.com)
-//
-// (C) 2007 Novell, Inc.
-//
-// 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 Mono.Cecil;
-
-namespace Mono.Linker.Steps {
-
-       public class LoadI18nAssemblies : BaseStep {
-
-               static readonly byte [] _pktoken = new byte [] {0x07, 0x38, 0xeb, 0x9f, 0x13, 0x2e, 0xd7, 0x56};
-
-               I18nAssemblies _assemblies;
-
-               public LoadI18nAssemblies (I18nAssemblies assemblies)
-               {
-                       _assemblies = assemblies;
-               }
-
-               protected override bool ConditionToProcess ()
-               {
-                       return _assemblies != I18nAssemblies.None &&
-                               Type.GetType ("System.MonoType") != null;
-               }
-
-               protected override void Process()
-               {
-                       LoadAssembly (GetAssemblyName (I18nAssemblies.Base));
-
-                       LoadI18nAssembly (I18nAssemblies.CJK);
-                       LoadI18nAssembly (I18nAssemblies.MidEast);
-                       LoadI18nAssembly (I18nAssemblies.Other);
-                       LoadI18nAssembly (I18nAssemblies.Rare);
-                       LoadI18nAssembly (I18nAssemblies.West);
-               }
-
-               bool ShouldCopyAssembly (I18nAssemblies current)
-               {
-                       return (current & _assemblies) != 0;
-               }
-
-               void LoadI18nAssembly (I18nAssemblies asm)
-               {
-                       if (!ShouldCopyAssembly (asm))
-                               return;
-
-                       AssemblyNameReference name = GetAssemblyName (asm);
-                       LoadAssembly (name);
-               }
-
-               void LoadAssembly (AssemblyNameReference name)
-               {
-                       AssemblyDefinition assembly = Context.Resolve (name);
-                       ResolveFromAssemblyStep.ProcessLibrary (Context, assembly);
-               }
-
-               AssemblyNameReference GetAssemblyName (I18nAssemblies assembly)
-               {
-                       AssemblyNameReference name = new AssemblyNameReference ("I18N", GetCorlibVersion ());
-                       if (assembly != I18nAssemblies.Base)
-                               name.Name += "." + assembly;
-
-                       name.PublicKeyToken = _pktoken;
-                       return name;
-               }
-
-               Version GetCorlibVersion ()
-               {
-                       foreach (AssemblyDefinition assembly in Context.GetAssemblies ())
-                               if (assembly.Name.Name == "mscorlib")
-                                       return assembly.Name.Version;
-
-                       return new Version ();
-               }
-       }
-}
diff --git a/mcs/tools/linker/Mono.Linker.Steps/LoadReferencesStep.cs b/mcs/tools/linker/Mono.Linker.Steps/LoadReferencesStep.cs
deleted file mode 100644 (file)
index a55fd1d..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-//
-// LoadReferencesStep.cs
-//
-// Author:
-//   Jb Evain (jbevain@novell.com)
-//
-// (C) 2007 Novell, Inc.
-//
-// 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.Collections;
-
-using Mono.Cecil;
-
-namespace Mono.Linker.Steps {
-
-       public class LoadReferencesStep : BaseStep {
-
-               IDictionary _references = new Hashtable ();
-
-               protected override void ProcessAssembly (AssemblyDefinition assembly)
-               {
-                       ProcessReferences (assembly);
-               }
-
-               void ProcessReferences (AssemblyDefinition assembly)
-               {
-                       if (_references.Contains (assembly.Name))
-                               return;
-
-                       _references.Add (assembly.Name, assembly);
-
-                       foreach (AssemblyNameReference reference in assembly.MainModule.AssemblyReferences)
-                               ProcessReferences (Context.Resolve (reference));
-               }
-       }
-}
diff --git a/mcs/tools/linker/Mono.Linker.Steps/MarkStep.cs b/mcs/tools/linker/Mono.Linker.Steps/MarkStep.cs
deleted file mode 100644 (file)
index 0c39910..0000000
+++ /dev/null
@@ -1,1152 +0,0 @@
-//
-// MarkStep.cs
-//
-// Author:
-//   Jb Evain (jbevain@gmail.com)
-//
-// (C) 2006 Jb Evain
-// (C) 2007 Novell, Inc.
-//
-// 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;
-using System.Linq;
-
-using Mono.Cecil;
-using Mono.Cecil.Cil;
-
-namespace Mono.Linker.Steps {
-
-       public class MarkStep : IStep {
-
-               protected LinkContext _context;
-               protected Queue _methods;
-               protected ArrayList _virtual_methods;
-
-               public AnnotationStore Annotations {
-                       get { return _context.Annotations; }
-               }
-
-               public MarkStep ()
-               {
-                       _methods = new Queue ();
-                       _virtual_methods = new ArrayList ();
-               }
-
-               public virtual void Process (LinkContext context)
-               {
-                       _context = context;
-
-                       Initialize ();
-                       Process ();
-               }
-
-               void Initialize ()
-               {
-                       foreach (AssemblyDefinition assembly in _context.GetAssemblies ())
-                               InitializeAssembly (assembly);
-               }
-
-               protected virtual void InitializeAssembly (AssemblyDefinition assembly)
-               {
-                       MarkAssembly (assembly);
-                       foreach (TypeDefinition type in assembly.MainModule.Types) {
-                               if (!Annotations.IsMarked (type))
-                                       continue;
-
-                               InitializeType (type);
-                       }
-               }
-
-               void InitializeType (TypeDefinition type)
-               {
-                       MarkType (type);
-
-                       if (type.HasFields)
-                               InitializeFields (type);
-                       if (type.HasMethods)
-                               InitializeMethods (type.Methods);
-
-                       if (type.HasNestedTypes) {
-                               foreach (var nested in type.NestedTypes) {
-                                       if (Annotations.IsMarked (nested))
-                                               InitializeType (nested);
-                               }
-                       }
-               }
-
-               void InitializeFields (TypeDefinition type)
-               {
-                       foreach (FieldDefinition field in type.Fields)
-                               if (Annotations.IsMarked (field))
-                                       MarkField (field);
-               }
-
-               void InitializeMethods (ICollection methods)
-               {
-                       foreach (MethodDefinition method in methods)
-                               if (Annotations.IsMarked (method))
-                                       EnqueueMethod (method);
-               }
-
-               void Process ()
-               {
-                       if (QueueIsEmpty ())
-                               throw new InvalidOperationException ("No entry methods");
-
-                       while (!QueueIsEmpty ()) {
-                               ProcessQueue ();
-                               ProcessVirtualMethods ();
-                       }
-               }
-
-               void ProcessQueue ()
-               {
-                       while (!QueueIsEmpty ()) {
-                               MethodDefinition method = (MethodDefinition) _methods.Dequeue ();
-                               Annotations.Push (method);
-                               ProcessMethod (method);
-                               Annotations.Pop ();
-                       }
-               }
-
-               bool QueueIsEmpty ()
-               {
-                       return _methods.Count == 0;
-               }
-
-               protected virtual void EnqueueMethod (MethodDefinition method)
-               {
-                       _methods.Enqueue (method);
-               }
-
-               void ProcessVirtualMethods ()
-               {
-                       foreach (MethodDefinition method in _virtual_methods) {
-                               Annotations.Push (method);
-                               ProcessVirtualMethod (method);
-                               Annotations.Pop ();
-                       }
-               }
-
-               void ProcessVirtualMethod (MethodDefinition method)
-               {
-                       IList overrides = Annotations.GetOverrides (method);
-                       if (overrides == null)
-                               return;
-
-                       foreach (MethodDefinition @override in overrides)
-                               ProcessOverride (@override);
-               }
-
-               void ProcessOverride (MethodDefinition method)
-               {
-                       if (!Annotations.IsMarked (method.DeclaringType))
-                               return;
-
-                       if (Annotations.IsProcessed (method))
-                               return;
-
-                       if (Annotations.IsMarked (method))
-                               return;
-
-                       MarkMethod (method);
-                       ProcessVirtualMethod (method);
-               }
-
-               void MarkMarshalSpec (IMarshalInfoProvider spec)
-               {
-                       if (!spec.HasMarshalInfo)
-                               return;
-
-                       var marshaler = spec.MarshalInfo as CustomMarshalInfo;
-                       if (marshaler == null)
-                               return;
-
-                       MarkType (marshaler.ManagedType);
-               }
-
-               void MarkCustomAttributes (ICustomAttributeProvider provider)
-               {
-                       if (!provider.HasCustomAttributes)
-                               return;
-
-                       foreach (CustomAttribute ca in provider.CustomAttributes)
-                               MarkCustomAttribute (ca);
-               }
-
-               protected virtual void MarkCustomAttribute (CustomAttribute ca)
-               {
-                       Annotations.Push (ca);
-                       MarkMethod (ca.Constructor);
-
-                       MarkCustomAttributeArguments (ca);
-
-                       TypeReference constructor_type = ca.Constructor.DeclaringType;
-                       TypeDefinition type = constructor_type.Resolve ();
-                       if (type == null) {
-                               Annotations.Pop ();
-                               throw new ResolutionException (constructor_type);
-                       }
-
-                       MarkCustomAttributeProperties (ca, type);
-                       MarkCustomAttributeFields (ca, type);
-                       Annotations.Pop ();
-               }
-
-               protected void MarkSecurityDeclarations (ISecurityDeclarationProvider provider)
-               {
-                       // most security declarations are removed (if linked) but user code might still have some
-                       // and if the attribtues references types then they need to be marked too
-                       if ((provider == null) || !provider.HasSecurityDeclarations)
-                               return;
-
-                       foreach (var sd in provider.SecurityDeclarations)
-                               MarkSecurityDeclaration (sd);
-               }
-
-               protected virtual void MarkSecurityDeclaration (SecurityDeclaration sd)
-               {
-                       if (!sd.HasSecurityAttributes)
-                               return;
-                       
-                       foreach (var sa in sd.SecurityAttributes)
-                               MarkSecurityAttribute (sa);
-               }
-
-               protected virtual void MarkSecurityAttribute (SecurityAttribute sa)
-               {
-                       TypeReference security_type = sa.AttributeType;
-                       TypeDefinition type = security_type.Resolve ();
-                       if (type == null)
-                               throw new ResolutionException (security_type);
-                       
-                       MarkType (security_type);
-                       MarkSecurityAttributeProperties (sa, type);
-                       MarkSecurityAttributeFields (sa, type);
-               }
-
-               protected void MarkSecurityAttributeProperties (SecurityAttribute sa, TypeDefinition attribute)
-               {
-                       if (!sa.HasProperties)
-                               return;
-
-                       foreach (var named_argument in sa.Properties)
-                               MarkCustomAttributeProperty (named_argument, attribute);
-               }
-
-               protected void MarkSecurityAttributeFields (SecurityAttribute sa, TypeDefinition attribute)
-               {
-                       if (!sa.HasFields)
-                               return;
-
-                       foreach (var named_argument in sa.Fields)
-                               MarkCustomAttributeField (named_argument, attribute);
-               }
-
-               protected void MarkCustomAttributeProperties (CustomAttribute ca, TypeDefinition attribute)
-               {
-                       if (!ca.HasProperties)
-                               return;
-
-                       foreach (var named_argument in ca.Properties)
-                               MarkCustomAttributeProperty (named_argument, attribute);
-               }
-
-               protected void MarkCustomAttributeProperty (CustomAttributeNamedArgument namedArgument, TypeDefinition attribute)
-               {
-                       PropertyDefinition property = GetProperty (attribute, namedArgument.Name);
-                       Annotations.Push (property);
-                       if (property != null)
-                               MarkMethod (property.SetMethod);
-
-                       MarkIfType (namedArgument.Argument);
-                       Annotations.Pop ();
-               }
-
-               PropertyDefinition GetProperty (TypeDefinition type, string propertyname)
-               {
-                       while (type != null) {
-                               PropertyDefinition property = type.Properties.FirstOrDefault (p => p.Name == propertyname);
-                               if (property != null)
-                                       return property;
-
-                               type = type.BaseType != null ? ResolveTypeDefinition (type.BaseType) : null;
-                       }
-
-                       return null;
-               }
-
-               protected void MarkCustomAttributeFields (CustomAttribute ca, TypeDefinition attribute)
-               {
-                       if (!ca.HasFields)
-                               return;
-
-                       foreach (var named_argument in ca.Fields)
-                               MarkCustomAttributeField (named_argument, attribute);
-               }
-
-               protected void MarkCustomAttributeField (CustomAttributeNamedArgument namedArgument, TypeDefinition attribute)
-               {
-                       FieldDefinition field = GetField (attribute, namedArgument.Name);
-                       if (field != null)
-                               MarkField (field);
-
-                       MarkIfType (namedArgument.Argument);
-               }
-
-               FieldDefinition GetField (TypeDefinition type, string fieldname)
-               {
-                       while (type != null) {
-                               FieldDefinition field = type.Fields.FirstOrDefault (f => f.Name == fieldname);
-                               if (field != null)
-                                       return field;
-
-                               type = type.BaseType != null ? ResolveTypeDefinition (type.BaseType) : null;
-                       }
-
-                       return null;
-               }
-
-               void MarkCustomAttributeArguments (CustomAttribute ca)
-               {
-                       if (!ca.HasConstructorArguments)
-                               return;
-
-                       foreach (var argument in ca.ConstructorArguments)
-                               MarkIfType (argument);
-               }
-
-               void MarkIfType (CustomAttributeArgument argument)
-               {
-                       var at = argument.Type;
-                       if (at.IsArray) {
-                               var et = at.GetElementType ();
-                               if (et.Namespace != "System" || et.Name != "Type")
-                                       return;
-
-                               MarkType (et);
-                               if (argument.Value == null)
-                                       return;
-
-                               foreach (var cac in (CustomAttributeArgument[]) argument.Value)
-                                       MarkWithResolvedScope ((TypeReference) cac.Value);
-                       } else if (at.Namespace == "System" && at.Name == "Type") {
-                               MarkType (argument.Type);
-                               MarkWithResolvedScope ((TypeReference) argument.Value);
-                       }
-               }
-
-               // custom attributes encoding means it's possible to have a scope that will point into a PCL facade
-               // even if we (just before saving) will resolve all type references (bug #26752)
-               void MarkWithResolvedScope (TypeReference type)
-               {
-                       if (type == null)
-                               return;
-
-                       // a GenericInstanceType can could contains generic arguments with scope that
-                       // needs to be updated out of the PCL facade (bug #28823)
-                       var git = (type as GenericInstanceType);
-                       if ((git != null) && git.HasGenericArguments) {
-                               foreach (var ga in git.GenericArguments)
-                                       MarkWithResolvedScope (ga);
-                       }
-                       // we cannot set the Scope of a TypeSpecification but it's element type can be set
-                       // e.g. System.String[] -> System.String
-                       var ts = (type as TypeSpecification);
-                       if (ts != null) {
-                               MarkWithResolvedScope (ts.GetElementType ());
-                               return;
-                       }
-
-                       var td = type.Resolve ();
-                       if (td != null)
-                               type.Scope = td.Scope;
-                       MarkType (type);
-               }
-
-               protected bool CheckProcessed (IMetadataTokenProvider provider)
-               {
-                       if (Annotations.IsProcessed (provider))
-                               return true;
-
-                       Annotations.Processed (provider);
-                       return false;
-               }
-
-               protected void MarkAssembly (AssemblyDefinition assembly)
-               {
-                       if (CheckProcessed (assembly))
-                               return;
-
-                       ProcessModule (assembly);
-
-                       MarkCustomAttributes (assembly);
-                       MarkSecurityDeclarations (assembly);
-
-                       foreach (ModuleDefinition module in assembly.Modules)
-                               MarkCustomAttributes (module);
-               }
-
-               void ProcessModule (AssemblyDefinition assembly)
-               {
-                       // Pre-mark <Module> if there is any methods as they need to be executed 
-                       // at assembly load time
-                       foreach (TypeDefinition type in assembly.MainModule.Types)
-                       {
-                               if (type.Name == "<Module>" && type.HasMethods)
-                               {
-                                       MarkType (type);
-                                       break;
-                               }
-                       }
-               }
-
-               protected void MarkField (FieldReference reference)
-               {
-//                     if (IgnoreScope (reference.DeclaringType.Scope))
-//                             return;
-
-                       if (reference.DeclaringType is GenericInstanceType)
-                               MarkType (reference.DeclaringType);
-
-                       FieldDefinition field = ResolveFieldDefinition (reference);
-
-                       if (field == null)
-                               throw new ResolutionException (reference);
-
-                       if (CheckProcessed (field))
-                               return;
-
-                       MarkType (field.DeclaringType);
-                       MarkType (field.FieldType);
-                       MarkCustomAttributes (field);
-                       MarkMarshalSpec (field);
-
-                       Annotations.Mark (field);
-               }
-
-               protected virtual bool IgnoreScope (IMetadataScope scope)
-               {
-                       AssemblyDefinition assembly = ResolveAssembly (scope);
-                       return Annotations.GetAction (assembly) != AssemblyAction.Link;
-               }
-
-               FieldDefinition ResolveFieldDefinition (FieldReference field)
-               {
-                       FieldDefinition fd = field as FieldDefinition;
-                       if (fd == null)
-                               fd = field.Resolve ();
-
-                       return fd;
-               }
-
-               void MarkScope (IMetadataScope scope)
-               {
-                       var provider = scope as IMetadataTokenProvider;
-                       if (provider == null)
-                               return;
-
-                       Annotations.Mark (provider);
-               }
-
-               protected virtual void MarkSerializable (TypeDefinition type)
-               {
-                       MarkDefaultConstructor (type);
-                       MarkMethodsIf (type.Methods, IsSpecialSerializationConstructorPredicate);
-               }
-
-               protected virtual TypeDefinition MarkType (TypeReference reference)
-               {
-                       if (reference == null)
-                               return null;
-
-                       reference = GetOriginalType (reference);
-
-                       if (reference is GenericParameter)
-                               return null;
-
-//                     if (IgnoreScope (reference.Scope))
-//                             return;
-
-                       TypeDefinition type = ResolveTypeDefinition (reference);
-
-                       if (type == null)
-                               throw new ResolutionException (reference);
-
-                       if (CheckProcessed (type))
-                               return null;
-
-                       Annotations.Push (type);
-
-                       MarkScope (type.Scope);
-                       MarkType (type.BaseType);
-                       MarkType (type.DeclaringType);
-                       MarkCustomAttributes (type);
-                       MarkSecurityDeclarations (type);
-
-                       if (IsMulticastDelegate (type)) {
-                               MarkMethodCollection (type.Methods);
-                       }
-
-                       if (IsSerializable (type))
-                               MarkSerializable (type);
-
-                       MarkTypeSpecialCustomAttributes (type);
-
-                       MarkGenericParameterProvider (type);
-
-                       // keep fields for value-types and for classes with LayoutKind.Sequential or Explicit
-                       if (type.IsValueType || !type.IsAutoLayout)
-                               MarkFields (type, type.IsEnum);
-
-                       if (type.HasInterfaces) {
-                               foreach (var iface in type.Interfaces)
-                                       MarkType (iface.InterfaceType);
-                       }
-
-                       if (type.HasMethods) {
-                               MarkMethodsIf (type.Methods, IsVirtualAndHasPreservedParent);
-                               MarkMethodsIf (type.Methods, IsStaticConstructorPredicate);
-                               MarkMethodsIf (type.Methods, HasSerializationAttribute);
-                       }
-
-                       DoAdditionalTypeProcessing (type);
-
-                       Annotations.Pop ();
-
-                       Annotations.Mark (type);
-
-                       ApplyPreserveInfo (type);
-
-                       return type;
-               }
-
-               // Allow subclassers to mark additional things when marking a method
-               protected virtual void DoAdditionalTypeProcessing (TypeDefinition method)
-               {
-               }
-
-               void MarkTypeSpecialCustomAttributes (TypeDefinition type)
-               {
-                       if (!type.HasCustomAttributes)
-                               return;
-
-                       foreach (CustomAttribute attribute in type.CustomAttributes) {
-                               switch (attribute.Constructor.DeclaringType.FullName) {
-                               case "System.Xml.Serialization.XmlSchemaProviderAttribute":
-                                       MarkXmlSchemaProvider (type, attribute);
-                                       break;
-                               }
-                       }
-               }
-
-               void MarkMethodSpecialCustomAttributes (MethodDefinition method)
-               {
-                       if (!method.HasCustomAttributes)
-                               return;
-
-                       foreach (CustomAttribute attribute in method.CustomAttributes) {
-                               switch (attribute.Constructor.DeclaringType.FullName) {
-                               case "System.Web.Services.Protocols.SoapHeaderAttribute":
-                                       MarkSoapHeader (method, attribute);
-                                       break;
-                               }
-                       }
-               }
-
-               void MarkXmlSchemaProvider (TypeDefinition type, CustomAttribute attribute)
-               {
-                       string method_name;
-                       if (!TryGetStringArgument (attribute, out method_name))
-                               return;
-
-                       MarkNamedMethod (type, method_name);
-               }
-
-               static bool TryGetStringArgument (CustomAttribute attribute, out string argument)
-               {
-                       argument = null;
-
-                       if (attribute.ConstructorArguments.Count < 1)
-                               return false;
-
-                       argument = attribute.ConstructorArguments [0].Value as string;
-
-                       return argument != null;
-               }
-
-               protected int MarkNamedMethod (TypeDefinition type, string method_name)
-               {
-                       if (!type.HasMethods)
-                               return 0;
-
-                       int count = 0;
-                       foreach (MethodDefinition method in type.Methods) {
-                               if (method.Name != method_name)
-                                       continue;
-
-                               MarkMethod (method);
-                               count++;
-                       }
-
-                       return count;
-               }
-
-               void MarkSoapHeader (MethodDefinition method, CustomAttribute attribute)
-               {
-                       string member_name;
-                       if (!TryGetStringArgument (attribute, out member_name))
-                               return;
-
-                       MarkNamedField (method.DeclaringType, member_name);
-                       MarkNamedProperty (method.DeclaringType, member_name);
-               }
-
-               void MarkNamedField (TypeDefinition type, string field_name)
-               {
-                       if (!type.HasFields)
-                               return;
-
-                       foreach (FieldDefinition field in type.Fields) {
-                               if (field.Name != field_name)
-                                       continue;
-
-                               MarkField (field);
-                       }
-               }
-
-               void MarkNamedProperty (TypeDefinition type, string property_name)
-               {
-                       if (!type.HasProperties)
-                               return;
-
-                       foreach (PropertyDefinition property in type.Properties) {
-                               if (property.Name != property_name)
-                                       continue;
-
-                               Annotations.Push (property);
-                               MarkMethod (property.GetMethod);
-                               MarkMethod (property.SetMethod);
-                               Annotations.Pop ();
-                       }
-               }
-
-               void MarkGenericParameterProvider (IGenericParameterProvider provider)
-               {
-                       if (!provider.HasGenericParameters)
-                               return;
-
-                       foreach (GenericParameter parameter in provider.GenericParameters)
-                               MarkGenericParameter (parameter);
-               }
-
-               void MarkGenericParameter (GenericParameter parameter)
-               {
-                       MarkCustomAttributes (parameter);
-                       foreach (TypeReference constraint in parameter.Constraints)
-                               MarkType (constraint);
-               }
-
-               bool IsVirtualAndHasPreservedParent (MethodDefinition method)
-               {
-                       if (!method.IsVirtual)
-                               return false;
-
-                       var base_list = Annotations.GetBaseMethods (method);
-                       if (base_list == null)
-                               return false;
-
-                       foreach (MethodDefinition @base in base_list) {
-                               if (IgnoreScope (@base.DeclaringType.Scope))
-                                       return true;
-
-                               if (IsVirtualAndHasPreservedParent (@base))
-                                       return true;
-                       }
-
-                       return false;
-               }
-
-               static MethodPredicate IsSpecialSerializationConstructorPredicate = new MethodPredicate (IsSpecialSerializationConstructor);
-
-               static bool IsSpecialSerializationConstructor (MethodDefinition method)
-               {
-                       if (!IsConstructor (method))
-                               return false;
-
-                       var parameters = method.Parameters;
-                       if (parameters.Count != 2)
-                               return false;
-
-                       return parameters [0].ParameterType.Name == "SerializationInfo" &&
-                               parameters [1].ParameterType.Name == "StreamingContext";
-               }
-
-               delegate bool MethodPredicate (MethodDefinition method);
-
-               void MarkMethodsIf (ICollection methods, MethodPredicate predicate)
-               {
-                       foreach (MethodDefinition method in methods)
-                               if (predicate (method)) {
-                                       Annotations.Push (predicate);
-                                       MarkMethod (method);
-                                       Annotations.Pop ();
-                               }
-               }
-
-               static MethodPredicate IsDefaultConstructorPredicate = new MethodPredicate (IsDefaultConstructor);
-
-               static bool IsDefaultConstructor (MethodDefinition method)
-               {
-                       return IsConstructor (method) && !method.HasParameters;
-               }
-
-               static bool IsConstructor (MethodDefinition method)
-               {
-                       return method.IsConstructor && !method.IsStatic;
-               }
-
-               protected void MarkDefaultConstructor (TypeDefinition type)
-               {
-                       if ((type == null) || !type.HasMethods)
-                               return;
-
-                       MarkMethodsIf (type.Methods, IsDefaultConstructorPredicate);
-               }
-
-               static MethodPredicate IsStaticConstructorPredicate = new MethodPredicate (IsStaticConstructor);
-
-               static bool IsStaticConstructor (MethodDefinition method)
-               {
-                       return method.IsConstructor && method.IsStatic;
-               }
-
-               static bool HasSerializationAttribute (MethodDefinition method)
-               {
-                       if (!method.HasCustomAttributes)
-                               return false;
-                       foreach (var ca in method.CustomAttributes) {
-                               var cat = ca.AttributeType;
-                               if (cat.Namespace != "System.Runtime.Serialization")
-                                       continue;
-                               switch (cat.Name) {
-                               case "OnDeserializedAttribute":
-                               case "OnDeserializingAttribute":
-                               case "OnSerializedAttribute":
-                               case "OnSerializingAttribute":
-                                       return true;
-                               }
-                       }
-                       return false;
-               }
-
-               static bool IsSerializable (TypeDefinition td)
-               {
-                       return (td.Attributes & TypeAttributes.Serializable) != 0;
-               }
-
-               static bool IsMulticastDelegate (TypeDefinition td)
-               {
-                       return td.BaseType != null && td.BaseType.FullName == "System.MulticastDelegate";
-               }
-
-               protected TypeDefinition ResolveTypeDefinition (TypeReference type)
-               {
-                       TypeDefinition td = type as TypeDefinition;
-                       if (td == null)
-                               td = type.Resolve ();
-
-                       return td;
-               }
-
-               protected TypeReference GetOriginalType (TypeReference type)
-               {
-                       while (type is TypeSpecification) {
-                               GenericInstanceType git = type as GenericInstanceType;
-                               if (git != null)
-                                       MarkGenericArguments (git);
-
-                               var mod = type as IModifierType;
-                               if (mod != null)
-                                       MarkModifierType (mod);
-
-                               type = ((TypeSpecification) type).ElementType;
-                       }
-
-                       return type;
-               }
-
-               void MarkModifierType (IModifierType mod)
-               {
-                       MarkType (mod.ModifierType);
-               }
-
-               void MarkGenericArguments (IGenericInstance instance)
-               {
-                       foreach (TypeReference argument in instance.GenericArguments)
-                               MarkType (argument);
-
-                       MarkGenericArgumentConstructors (instance);
-               }
-
-               void MarkGenericArgumentConstructors (IGenericInstance instance)
-               {
-                       var arguments = instance.GenericArguments;
-
-                       var generic_element = GetGenericProviderFromInstance (instance);
-                       if (generic_element == null)
-                               return;
-
-                       var parameters = generic_element.GenericParameters;
-
-                       if (arguments.Count != parameters.Count)
-                               return;
-
-                       for (int i = 0; i < arguments.Count; i++) {
-                               var argument = arguments [i];
-                               var parameter = parameters [i];
-
-                               if (!parameter.HasDefaultConstructorConstraint)
-                                       continue;
-
-                               var argument_definition = ResolveTypeDefinition (argument);
-                               if (argument_definition == null)
-                                       continue;
-
-                               MarkMethodsIf (argument_definition.Methods, ctor => !ctor.IsStatic && !ctor.HasParameters);
-                       }
-               }
-
-               IGenericParameterProvider GetGenericProviderFromInstance (IGenericInstance instance)
-               {
-                       var method = instance as GenericInstanceMethod;
-                       if (method != null)
-                               return ResolveMethodDefinition (method.ElementMethod);
-
-                       var type = instance as GenericInstanceType;
-                       if (type != null)
-                               return ResolveTypeDefinition (type.ElementType);
-
-                       return null;
-               }
-
-               void ApplyPreserveInfo (TypeDefinition type)
-               {
-                       ApplyPreserveMethods (type);
-
-                       if (!Annotations.IsPreserved (type))
-                               return;
-
-                       switch (Annotations.GetPreserve (type)) {
-                       case TypePreserve.All:
-                               MarkFields (type, true);
-                               MarkMethods (type);
-                               break;
-                       case TypePreserve.Fields:
-                               MarkFields (type, true);
-                               break;
-                       case TypePreserve.Methods:
-                               MarkMethods (type);
-                               break;
-                       }
-               }
-
-               void ApplyPreserveMethods (TypeDefinition type)
-               {
-                       var list = Annotations.GetPreservedMethods (type);
-                       if (list == null)
-                               return;
-
-                       MarkMethodCollection (list);
-               }
-
-               void ApplyPreserveMethods (MethodDefinition method)
-               {
-                       var list = Annotations.GetPreservedMethods (method);
-                       if (list == null)
-                               return;
-
-                       MarkMethodCollection (list);
-               }
-
-               protected void MarkFields (TypeDefinition type, bool includeStatic)
-               {
-                       if (!type.HasFields)
-                               return;
-
-                       foreach (FieldDefinition field in type.Fields) {
-                               if (!includeStatic && field.IsStatic)
-                                       continue;
-                               MarkField (field);
-                       }
-               }
-
-               protected virtual void MarkMethods (TypeDefinition type)
-               {
-                       if (type.HasMethods)
-                               MarkMethodCollection (type.Methods);
-               }
-
-               void MarkMethodCollection (IEnumerable methods)
-               {
-                       foreach (MethodDefinition method in methods)
-                               MarkMethod (method);
-               }
-
-               protected virtual MethodDefinition MarkMethod (MethodReference reference)
-               {
-                       reference = GetOriginalMethod (reference);
-
-                       if (reference.DeclaringType is ArrayType)
-                               return null;
-
-                       Annotations.Push (reference);
-                       if (reference.DeclaringType is GenericInstanceType)
-                               MarkType (reference.DeclaringType);
-
-//                     if (IgnoreScope (reference.DeclaringType.Scope))
-//                             return;
-
-                       MethodDefinition method = ResolveMethodDefinition (reference);
-
-                       if (method == null) {
-                               Annotations.Pop ();
-                               throw new ResolutionException (reference);
-                       }
-
-                       if (Annotations.GetAction (method) == MethodAction.Nothing)
-                               Annotations.SetAction (method, MethodAction.Parse);
-
-                       EnqueueMethod (method);
-
-                       Annotations.Pop ();
-                       Annotations.AddDependency (method);
-
-                       return method;
-               }
-
-               AssemblyDefinition ResolveAssembly (IMetadataScope scope)
-               {
-                       AssemblyDefinition assembly = _context.Resolve (scope);
-                       MarkAssembly (assembly);
-                       return assembly;
-               }
-
-               protected MethodReference GetOriginalMethod (MethodReference method)
-               {
-                       while (method is MethodSpecification) {
-                               GenericInstanceMethod gim = method as GenericInstanceMethod;
-                               if (gim != null)
-                                       MarkGenericArguments (gim);
-
-                               method = ((MethodSpecification) method).ElementMethod;
-                       }
-
-                       return method;
-               }
-
-               MethodDefinition ResolveMethodDefinition (MethodReference method)
-               {
-                       MethodDefinition md = method as MethodDefinition;
-                       if (md == null)
-                               md = method.Resolve ();
-
-                       return md;
-               }
-
-               protected virtual void ProcessMethod (MethodDefinition method)
-               {
-                       if (CheckProcessed (method))
-                               return;
-
-                       Annotations.Push (method);
-                       MarkType (method.DeclaringType);
-                       MarkCustomAttributes (method);
-                       MarkSecurityDeclarations (method);
-
-                       MarkGenericParameterProvider (method);
-
-                       if (IsPropertyMethod (method))
-                               MarkProperty (GetProperty (method));
-                       else if (IsEventMethod (method))
-                               MarkEvent (GetEvent (method));
-
-                       if (method.HasParameters) {
-                               foreach (ParameterDefinition pd in method.Parameters) {
-                                       MarkType (pd.ParameterType);
-                                       MarkCustomAttributes (pd);
-                                       MarkMarshalSpec (pd);
-                               }
-                       }
-
-                       if (method.HasOverrides) {
-                               foreach (MethodReference ov in method.Overrides)
-                                       MarkMethod (ov);
-                       }
-
-                       MarkMethodSpecialCustomAttributes (method);
-
-                       if (method.IsVirtual)
-                               _virtual_methods.Add (method);
-
-                       MarkBaseMethods (method);
-
-                       MarkType (method.ReturnType);
-                       MarkCustomAttributes (method.MethodReturnType);
-                       MarkMarshalSpec (method.MethodReturnType);
-
-                       if (ShouldParseMethodBody (method))
-                               MarkMethodBody (method.Body);
-
-                       DoAdditionalMethodProcessing (method);
-
-                       Annotations.Mark (method);
-
-                       ApplyPreserveMethods (method);
-                       Annotations.Pop ();
-               }
-
-               // Allow subclassers to mark additional things when marking a method
-               protected virtual void DoAdditionalMethodProcessing (MethodDefinition method)
-               {
-               }
-
-               void MarkBaseMethods (MethodDefinition method)
-               {
-                       IList base_methods = Annotations.GetBaseMethods (method);
-                       if (base_methods == null)
-                               return;
-
-                       foreach (MethodDefinition base_method in base_methods) {
-                               if (base_method.DeclaringType.IsInterface && !method.DeclaringType.IsInterface)
-                                       continue;
-
-                               MarkMethod (base_method);
-                               MarkBaseMethods (base_method);
-                       }
-               }
-
-               bool ShouldParseMethodBody (MethodDefinition method)
-               {
-                       if (!method.HasBody)
-                               return false;
-
-                       AssemblyDefinition assembly = ResolveAssembly (method.DeclaringType.Scope);
-                       return (Annotations.GetAction (method) == MethodAction.ForceParse ||
-                               (Annotations.GetAction (assembly) == AssemblyAction.Link && Annotations.GetAction (method) == MethodAction.Parse));
-               }
-
-               static internal bool IsPropertyMethod (MethodDefinition md)
-               {
-                       return (md.SemanticsAttributes & MethodSemanticsAttributes.Getter) != 0 ||
-                               (md.SemanticsAttributes & MethodSemanticsAttributes.Setter) != 0;
-               }
-
-               static bool IsEventMethod (MethodDefinition md)
-               {
-                       return (md.SemanticsAttributes & MethodSemanticsAttributes.AddOn) != 0 ||
-                               (md.SemanticsAttributes & MethodSemanticsAttributes.Fire) != 0 ||
-                               (md.SemanticsAttributes & MethodSemanticsAttributes.RemoveOn) != 0;
-               }
-
-               static internal PropertyDefinition GetProperty (MethodDefinition md)
-               {
-                       TypeDefinition declaringType = (TypeDefinition) md.DeclaringType;
-                       foreach (PropertyDefinition prop in declaringType.Properties)
-                               if (prop.GetMethod == md || prop.SetMethod == md)
-                                       return prop;
-
-                       return null;
-               }
-
-               static EventDefinition GetEvent (MethodDefinition md)
-               {
-                       TypeDefinition declaringType = (TypeDefinition) md.DeclaringType;
-                       foreach (EventDefinition evt in declaringType.Events)
-                               if (evt.AddMethod == md || evt.InvokeMethod == md || evt.RemoveMethod == md)
-                                       return evt;
-
-                       return null;
-               }
-
-               protected void MarkProperty (PropertyDefinition prop)
-               {
-                       MarkCustomAttributes (prop);
-               }
-
-               protected void MarkEvent (EventDefinition evt)
-               {
-                       MarkCustomAttributes (evt);
-                       MarkMethodIfNotNull (evt.AddMethod);
-                       MarkMethodIfNotNull (evt.InvokeMethod);
-                       MarkMethodIfNotNull (evt.RemoveMethod);
-               }
-
-               void MarkMethodIfNotNull (MethodReference method)
-               {
-                       if (method == null)
-                               return;
-
-                       MarkMethod (method);
-               }
-
-               protected virtual void MarkMethodBody (MethodBody body)
-               {
-                       foreach (VariableDefinition var in body.Variables)
-                               MarkType (var.VariableType);
-
-                       foreach (ExceptionHandler eh in body.ExceptionHandlers)
-                               if (eh.HandlerType == ExceptionHandlerType.Catch)
-                                       MarkType (eh.CatchType);
-
-                       foreach (Instruction instruction in body.Instructions)
-                               MarkInstruction (instruction);
-               }
-
-               protected virtual void MarkInstruction (Instruction instruction)
-               {
-                       switch (instruction.OpCode.OperandType) {
-                       case OperandType.InlineField:
-                               MarkField ((FieldReference) instruction.Operand);
-                               break;
-                       case OperandType.InlineMethod:
-                               MarkMethod ((MethodReference) instruction.Operand);
-                               break;
-                       case OperandType.InlineTok:
-                               object token = instruction.Operand;
-                               if (token is TypeReference)
-                                       MarkType ((TypeReference) token);
-                               else if (token is MethodReference)
-                                       MarkMethod ((MethodReference) token);
-                               else
-                                       MarkField ((FieldReference) token);
-                               break;
-                       case OperandType.InlineType:
-                               MarkType ((TypeReference) instruction.Operand);
-                               break;
-                       default:
-                               break;
-                       }
-               }
-       }
-}
diff --git a/mcs/tools/linker/Mono.Linker.Steps/OutputStep.cs b/mcs/tools/linker/Mono.Linker.Steps/OutputStep.cs
deleted file mode 100644 (file)
index 0260c89..0000000
+++ /dev/null
@@ -1,159 +0,0 @@
-//
-// OutputStep.cs
-//
-// Author:
-//   Jb Evain (jbevain@gmail.com)
-//
-// (C) 2006 Jb Evain
-//
-// 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.IO;
-
-using Mono.Cecil;
-using Mono.Cecil.Cil;
-
-namespace Mono.Linker.Steps {
-
-       public class OutputStep : BaseStep {
-
-               protected override void Process ()
-               {
-                       CheckOutputDirectory ();
-                       Annotations.SaveDependencies ();
-               }
-
-               void CheckOutputDirectory ()
-               {
-                       if (Directory.Exists (Context.OutputDirectory))
-                               return;
-
-                       Directory.CreateDirectory (Context.OutputDirectory);
-               }
-
-               protected override void ProcessAssembly (AssemblyDefinition assembly)
-               {
-                       OutputAssembly (assembly);
-               }
-
-               void OutputAssembly (AssemblyDefinition assembly)
-               {
-                       string directory = Context.OutputDirectory;
-
-                       CopyConfigFileIfNeeded (assembly, directory);
-
-                       switch (Annotations.GetAction (assembly)) {
-                       case AssemblyAction.Save:
-                       case AssemblyAction.Link:
-                               Context.Annotations.AddDependency (assembly);
-                               assembly.Write (GetAssemblyFileName (assembly, directory), SaveSymbols (assembly));
-                               break;
-                       case AssemblyAction.Copy:
-                               Context.Annotations.AddDependency (assembly);
-                               CloseSymbols (assembly);
-                               CopyAssembly (GetOriginalAssemblyFileInfo (assembly), directory, Context.LinkSymbols);
-                               break;
-                       case AssemblyAction.Delete:
-                               CloseSymbols (assembly);
-                               var target = GetAssemblyFileName (assembly, directory);
-                               if (File.Exists (target)) {
-                                       File.Delete (target);
-                                       File.Delete (target + ".mdb");
-                                       File.Delete (GetConfigFile (target));
-                               }
-                               break;
-                       default:
-                               CloseSymbols (assembly);
-                               break;
-                       }
-               }
-
-               void CloseSymbols (AssemblyDefinition assembly)
-               {
-                       Annotations.CloseSymbolReader (assembly);
-               }
-
-               WriterParameters SaveSymbols (AssemblyDefinition assembly)
-               {
-                       var parameters = new WriterParameters ();
-                       if (!Context.LinkSymbols)
-                               return parameters;
-
-                       if (!assembly.MainModule.HasSymbols)
-                               return parameters;
-
-                       if (Context.SymbolWriterProvider != null)
-                               parameters.SymbolWriterProvider = Context.SymbolWriterProvider;
-                       else
-                               parameters.WriteSymbols = true;
-                       return parameters;
-               }
-
-               static void CopyConfigFileIfNeeded (AssemblyDefinition assembly, string directory)
-               {
-                       string config = GetConfigFile (GetOriginalAssemblyFileInfo (assembly).FullName);
-                       if (!File.Exists (config))
-                               return;
-
-                       string target = Path.GetFullPath (GetConfigFile (GetAssemblyFileName (assembly, directory)));
-
-                       if (config == target)
-                               return;
-
-                       File.Copy (config, GetConfigFile (GetAssemblyFileName (assembly, directory)), true);
-               }
-
-               static string GetConfigFile (string assembly)
-               {
-                       return assembly + ".config";
-               }
-
-               static FileInfo GetOriginalAssemblyFileInfo (AssemblyDefinition assembly)
-               {
-                       return new FileInfo (assembly.MainModule.FullyQualifiedName);
-               }
-
-               static void CopyAssembly (FileInfo fi, string directory, bool symbols)
-               {
-                       string target = Path.GetFullPath (Path.Combine (directory, fi.Name));
-                       string source = fi.FullName;
-                       if (source == target)
-                               return;
-
-                       File.Copy (source, target, true);
-
-                       if (!symbols)
-                               return;
-
-                       source += ".mdb";
-                       if (!File.Exists (source))
-                               return;
-                       File.Copy (source, target + ".mdb", true);
-               }
-
-               static string GetAssemblyFileName (AssemblyDefinition assembly, string directory)
-               {
-                       string file = assembly.Name.Name + (assembly.MainModule.Kind == ModuleKind.Dll ? ".dll" : ".exe");
-                       return Path.Combine (directory, file);
-               }
-       }
-}
diff --git a/mcs/tools/linker/Mono.Linker.Steps/RegenerateGuidStep.cs b/mcs/tools/linker/Mono.Linker.Steps/RegenerateGuidStep.cs
deleted file mode 100644 (file)
index 6b2558e..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-//
-// CleanStep.cs
-//
-// Author:
-//   Jb Evain (jbevain@gmail.com)
-//
-// (C) 2008 Novell, Inc. (http://www.novell.com)
-//
-// 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 Mono.Cecil;
-
-namespace Mono.Linker.Steps {
-
-       public class RegenerateGuidStep : BaseStep {
-
-               protected override void ProcessAssembly (AssemblyDefinition assembly)
-               {
-                       if (Annotations.GetAction (assembly) == AssemblyAction.Link)
-                               RegenerateGuid (assembly);
-               }
-
-               static void RegenerateGuid (AssemblyDefinition asm)
-               {
-                       asm.MainModule.Mvid = Guid.NewGuid ();
-               }
-       }
-}
diff --git a/mcs/tools/linker/Mono.Linker.Steps/ResolveFromAssemblyStep.cs b/mcs/tools/linker/Mono.Linker.Steps/ResolveFromAssemblyStep.cs
deleted file mode 100644 (file)
index 6219bc9..0000000
+++ /dev/null
@@ -1,137 +0,0 @@
-//
-// ResolveFromAssemblyStep.cs
-//
-// Author:
-//   Jb Evain (jbevain@gmail.com)
-//
-// (C) 2006 Jb Evain
-//
-// 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.Collections;
-using Mono.Cecil;
-
-namespace Mono.Linker.Steps {
-
-       public class ResolveFromAssemblyStep : ResolveStep {
-
-               AssemblyDefinition _assembly;
-               string _file;
-
-               public ResolveFromAssemblyStep (string assembly)
-               {
-                       _file = assembly;
-               }
-
-               public ResolveFromAssemblyStep (AssemblyDefinition assembly)
-               {
-                       _assembly = assembly;
-               }
-
-               protected override void Process ()
-               {
-                       if (_assembly != null)
-                               Context.Resolver.CacheAssembly (_assembly);
-
-                       AssemblyDefinition assembly = _assembly ?? Context.Resolve (_file);
-
-                       switch (assembly.MainModule.Kind) {
-                       case ModuleKind.Dll:
-                               ProcessLibrary (Context, assembly);
-                               break;
-                       default:
-                               ProcessExecutable (assembly);
-                               break;
-                       }
-               }
-
-               static void SetAction (LinkContext context, AssemblyDefinition assembly, AssemblyAction action)
-               {
-                       TryReadSymbols (context, assembly);
-
-                       context.Annotations.SetAction (assembly, action);
-               }
-
-               static void TryReadSymbols (LinkContext context, AssemblyDefinition assembly)
-               {
-                       context.SafeReadSymbols (assembly);
-               }
-
-               public static void ProcessLibrary (LinkContext context, AssemblyDefinition assembly)
-               {
-                       SetAction (context, assembly, AssemblyAction.Copy);
-
-                       context.Annotations.Push (assembly);
-
-                       foreach (TypeDefinition type in assembly.MainModule.Types)
-                               MarkType (context, type);
-
-                       context.Annotations.Pop ();
-               }
-
-               static void MarkType (LinkContext context, TypeDefinition type)
-               {
-                       context.Annotations.Mark (type);
-
-                       context.Annotations.Push (type);
-
-                       if (type.HasFields)
-                               MarkFields (context, type.Fields);
-                       if (type.HasMethods)
-                               MarkMethods (context, type.Methods);
-                       if (type.HasNestedTypes)
-                               foreach (var nested in type.NestedTypes)
-                                       MarkType (context, nested);
-
-                       context.Annotations.Pop ();
-               }
-
-               void ProcessExecutable (AssemblyDefinition assembly)
-               {
-                       SetAction (Context, assembly, AssemblyAction.Link);
-
-                       Annotations.Push (assembly);
-
-                       Annotations.Mark (assembly.EntryPoint.DeclaringType);
-                       MarkMethod (Context, assembly.EntryPoint, MethodAction.Parse);
-
-                       Annotations.Pop ();
-               }
-
-               static void MarkFields (LinkContext context, ICollection fields)
-               {
-                       foreach (FieldDefinition field in fields)
-                               context.Annotations.Mark (field);
-               }
-
-               static void MarkMethods (LinkContext context, ICollection methods)
-               {
-                       foreach (MethodDefinition method in methods)
-                               MarkMethod (context, method, MethodAction.ForceParse);
-               }
-
-               static void MarkMethod (LinkContext context, MethodDefinition method, MethodAction action)
-               {
-                       context.Annotations.Mark (method);
-                       context.Annotations.SetAction (method, action);
-               }
-       }
-}
diff --git a/mcs/tools/linker/Mono.Linker.Steps/ResolveFromXApiStep.cs b/mcs/tools/linker/Mono.Linker.Steps/ResolveFromXApiStep.cs
deleted file mode 100644 (file)
index c4ce86d..0000000
+++ /dev/null
@@ -1,139 +0,0 @@
-//
-// ResolveFromXApiStep.cs
-//
-// Author:
-//   Jb Evain (jbevain@novell.com)
-//
-// (C) 2007 Novell, Inc.
-//
-// 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.Xml.XPath;
-
-using Mono.Linker;
-
-using Mono.Cecil;
-
-namespace Mono.Linker.Steps {
-
-       public class ResolveFromXApiStep : ResolveStep, IXApiVisitor {
-
-               static readonly string _name = "name";
-               static readonly string _ns = string.Empty;
-
-               XPathDocument _document;
-
-               public ResolveFromXApiStep (XPathDocument document)
-               {
-                       _document = document;
-               }
-
-               protected override void Process ()
-               {
-                       XApiReader reader = new XApiReader (_document, this);
-                       reader.Process (Context);
-               }
-
-               public void OnAssembly (XPathNavigator nav, AssemblyDefinition assembly)
-               {
-               }
-
-               public void OnAttribute (XPathNavigator nav)
-               {
-                       string name = GetName (nav);
-
-                       TypeDefinition type = Context.GetType (name);
-                       if (type != null)
-                               MarkType (type);
-               }
-
-               public void OnClass (XPathNavigator nav, TypeDefinition type)
-               {
-                       MarkType (type);
-               }
-
-               public void OnInterface (XPathNavigator nav, TypeDefinition type)
-               {
-                       MarkType (type);
-               }
-
-               public void OnField (XPathNavigator nav, FieldDefinition field)
-               {
-                       MarkField (field);
-               }
-
-               public void OnMethod (XPathNavigator nav, MethodDefinition method)
-               {
-                       MarkMethod (method);
-               }
-
-               public void OnConstructor (XPathNavigator nav, MethodDefinition method)
-               {
-                       MarkMethod (method);
-               }
-
-               public void OnProperty (XPathNavigator nav, PropertyDefinition property)
-               {
-               }
-
-               public void OnEvent (XPathNavigator nav, EventDefinition evt)
-               {
-                       if (evt.AddMethod != null)
-                               MarkMethod (evt.AddMethod);
-                       if (evt.InvokeMethod != null)
-                               MarkMethod (evt.InvokeMethod);
-                       if (evt.RemoveMethod != null)
-                               MarkMethod (evt.RemoveMethod);
-               }
-
-               static string GetName (XPathNavigator nav)
-               {
-                       return GetAttribute (nav, _name);
-               }
-
-               static string GetAttribute (XPathNavigator nav, string attribute)
-               {
-                       return nav.GetAttribute (attribute, _ns);
-               }
-
-               void MarkType (TypeDefinition type)
-               {
-                       InternalMark (type);
-               }
-
-               void MarkField (FieldDefinition field)
-               {
-                       InternalMark (field);
-               }
-
-               void InternalMark (IMetadataTokenProvider provider)
-               {
-                       Annotations.Mark (provider);
-                       Annotations.SetPublic (provider);
-               }
-
-               void MarkMethod (MethodDefinition method)
-               {
-                       InternalMark (method);
-                       Annotations.SetAction (method, MethodAction.Parse);
-               }
-       }
-}
diff --git a/mcs/tools/linker/Mono.Linker.Steps/ResolveFromXmlStep.cs b/mcs/tools/linker/Mono.Linker.Steps/ResolveFromXmlStep.cs
deleted file mode 100644 (file)
index 5e9f681..0000000
+++ /dev/null
@@ -1,395 +0,0 @@
-//
-// ResolveFromXmlStep.cs
-//
-// Author:
-//   Jb Evain (jbevain@gmail.com)
-//
-// (C) 2006 Jb Evain
-// (C) 2007 Novell, Inc.
-// Copyright 2013 Xamarin Inc.
-//
-// 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 SR = System.Reflection;
-using System.Text;
-using System.Text.RegularExpressions;
-using System.Xml.XPath;
-
-using Mono.Cecil;
-
-namespace Mono.Linker.Steps {
-
-       public class XmlResolutionException : Exception {
-               public XmlResolutionException (string message, Exception innerException)
-                       : base (message, innerException)
-               {
-               }
-       }
-
-       public class ResolveFromXmlStep : ResolveStep {
-
-               static readonly string _signature = "signature";
-               static readonly string _fullname = "fullname";
-               static readonly string _required = "required";
-               static readonly string _preserve = "preserve";
-               static readonly string _ns = string.Empty;
-
-               XPathDocument _document;
-               string _xmlDocumentLocation;
-
-               public ResolveFromXmlStep (XPathDocument document, string xmlDocumentLocation = "<unspecified>")
-               {
-                       _document = document;
-                       _xmlDocumentLocation = xmlDocumentLocation;
-               }
-
-               protected override void Process ()
-               {
-                       XPathNavigator nav = _document.CreateNavigator ();
-                       nav.MoveToFirstChild ();
-
-                       // This step can be created with XML files that aren't necessarily
-                       // linker descriptor files. So bail if we don't have a <linker> element.
-                       if (nav.LocalName != "linker")
-                               return;
-
-                       try {
-                               ProcessAssemblies (Context, nav.SelectChildren ("assembly", _ns));
-                       } catch (Exception ex) {
-                               throw new XmlResolutionException (string.Format ("Failed to process XML description: {0}", _xmlDocumentLocation), ex);
-                       }
-               }
-
-               void ProcessAssemblies (LinkContext context, XPathNodeIterator iterator)
-               {
-                       while (iterator.MoveNext ()) {
-                               AssemblyDefinition assembly = GetAssembly (context, GetFullName (iterator.Current));
-                               ProcessTypes (assembly, iterator.Current.SelectChildren ("type", _ns));
-                               ProcessNamespaces (assembly, iterator.Current.SelectChildren ("namespace", _ns));
-                       }
-               }
-
-               void ProcessNamespaces (AssemblyDefinition assembly, XPathNodeIterator iterator)
-               {
-                       while (iterator.MoveNext ()) {
-                               string fullname = GetFullName (iterator.Current);
-                               foreach (TypeDefinition type in assembly.MainModule.Types) {
-                                       if (type.Namespace != fullname)
-                                               continue;
-
-                                       MarkAndPreserveAll (type);
-                               }
-                       }
-               }
-
-               void MarkAndPreserveAll (TypeDefinition type)
-               {
-                       Annotations.Mark (type);
-                       Annotations.SetPreserve (type, TypePreserve.All);
-
-                       if (!type.HasNestedTypes)
-                               return;
-
-                       foreach (TypeDefinition nested in type.NestedTypes)
-                               MarkAndPreserveAll (nested);
-               }
-
-               void ProcessTypes (AssemblyDefinition assembly, XPathNodeIterator iterator)
-               {
-                       while (iterator.MoveNext ()) {
-                               XPathNavigator nav = iterator.Current;
-                               string fullname = GetFullName (nav);
-
-                               if (IsTypePattern (fullname)) {
-                                       ProcessTypePattern (fullname, assembly, nav);
-                                       continue;
-                               }
-
-                               TypeDefinition type = assembly.MainModule.GetType (fullname);
-                               if (type == null)
-                                       continue;
-
-                               ProcessType (type, nav);
-                       }
-               }
-
-               static bool IsTypePattern (string fullname)
-               {
-                       return fullname.IndexOf ("*") != -1;
-               }
-
-               static Regex CreateRegexFromPattern (string pattern)
-               {
-                       return new Regex (pattern.Replace(".", @"\.").Replace("*", "(.*)"));
-               }
-
-               void MatchType (TypeDefinition type, Regex regex, XPathNavigator nav)
-               {
-                       if (regex.Match (type.FullName).Success)
-                               ProcessType (type, nav);
-
-                       if (!type.HasNestedTypes)
-                               return;
-
-                       foreach (var nt in type.NestedTypes)
-                               MatchType (nt, regex, nav);
-               }
-
-               void ProcessTypePattern (string fullname, AssemblyDefinition assembly, XPathNavigator nav)
-               {
-                       Regex regex = CreateRegexFromPattern (fullname);
-
-                       foreach (TypeDefinition type in assembly.MainModule.Types) {
-                               MatchType (type, regex, nav);
-                       }
-               }
-
-               void ProcessType (TypeDefinition type, XPathNavigator nav)
-               {
-                       TypePreserve preserve = GetTypePreserve (nav);
-
-                       if (!IsRequired (nav)) {
-                               Annotations.SetPreserve (type, preserve);
-                               return;
-                       }
-
-                       Annotations.Mark (type);
-
-                       switch (preserve) {
-                       case TypePreserve.Nothing:
-                               if (!nav.HasChildren)
-                                       Annotations.SetPreserve (type, TypePreserve.All);
-                               break;
-                       default:
-                               Annotations.SetPreserve (type, preserve);
-                               break;
-                       }
-
-                       if (nav.HasChildren) {
-                               MarkSelectedFields (nav, type);
-                               MarkSelectedMethods (nav, type);
-                       }
-               }
-
-               void MarkSelectedFields (XPathNavigator nav, TypeDefinition type)
-               {
-                       XPathNodeIterator fields = nav.SelectChildren ("field", _ns);
-                       if (fields.Count == 0)
-                               return;
-
-                       ProcessFields (type, fields);
-               }
-
-               void MarkSelectedMethods (XPathNavigator nav, TypeDefinition type)
-               {
-                       XPathNodeIterator methods = nav.SelectChildren ("method", _ns);
-                       if (methods.Count == 0)
-                               return;
-
-                       ProcessMethods (type, methods);
-               }
-
-               static TypePreserve GetTypePreserve (XPathNavigator nav)
-               {
-                       string attribute = GetAttribute (nav, _preserve);
-                       if (attribute == null || attribute.Length == 0)
-                               return TypePreserve.Nothing;
-
-                       try {
-                               return (TypePreserve) Enum.Parse (typeof (TypePreserve), attribute, true);
-                       } catch {
-                               return TypePreserve.Nothing;
-                       }
-               }
-
-               void ProcessFields (TypeDefinition type, XPathNodeIterator iterator)
-               {
-                       while (iterator.MoveNext ()) {
-                               string value = GetSignature (iterator.Current);
-                               if (!String.IsNullOrEmpty (value))
-                                       ProcessFieldSignature (type, value);
-
-                               value = GetAttribute (iterator.Current, "name");
-                               if (!String.IsNullOrEmpty (value))
-                                       ProcessFieldName (type, value);
-                       }
-               }
-
-               void ProcessFieldSignature (TypeDefinition type, string signature)
-               {
-                       FieldDefinition field = GetField (type, signature);
-                       MarkField (type, field, signature);
-               }
-
-               void MarkField (TypeDefinition type, FieldDefinition field, string signature)
-               {
-                       if (field != null)
-                               Annotations.Mark (field);
-                       else
-                               AddUnresolveMarker (string.Format ("T: {0}; F: {1}", type, signature));
-               }
-
-               void ProcessFieldName (TypeDefinition type, string name)
-               {
-                       if (!type.HasFields)
-                               return;
-
-                       foreach (FieldDefinition field in type.Fields)
-                               if (field.Name == name)
-                                       MarkField (type, field, name);
-               }
-
-               static FieldDefinition GetField (TypeDefinition type, string signature)
-               {
-                       if (!type.HasFields)
-                               return null;
-
-                       foreach (FieldDefinition field in type.Fields)
-                               if (signature == GetFieldSignature (field))
-                                       return field;
-
-                       return null;
-               }
-
-               static string GetFieldSignature (FieldDefinition field)
-               {
-                       return field.FieldType.FullName + " " + field.Name;
-               }
-
-               void ProcessMethods (TypeDefinition type, XPathNodeIterator iterator)
-               {
-                       while (iterator.MoveNext()) {
-                               string value = GetSignature (iterator.Current);
-                               if (!String.IsNullOrEmpty (value))
-                                       ProcessMethodSignature (type, value);
-
-                               value = GetAttribute (iterator.Current, "name");
-                               if (!String.IsNullOrEmpty (value))
-                                       ProcessMethodName (type, value);
-                       }
-               }
-
-               void ProcessMethodSignature (TypeDefinition type, string signature)
-               {
-                       MethodDefinition meth = GetMethod (type, signature);
-                       MarkMethod (type, meth, signature);
-               }
-
-               void MarkMethod (TypeDefinition type, MethodDefinition method, string signature)
-               {
-                       if (method != null) {
-                               Annotations.Mark (method);
-                               Annotations.SetAction (method, MethodAction.Parse);
-                       } else
-                               AddUnresolveMarker (string.Format ("T: {0}; M: {1}", type, signature));
-               }
-
-               void ProcessMethodName (TypeDefinition type, string name)
-               {
-                       if (!type.HasMethods)
-                               return;
-
-                       foreach (MethodDefinition method in type.Methods)
-                               if (name == method.Name)
-                                       MarkMethod (type, method, name);
-               }
-
-               static MethodDefinition GetMethod (TypeDefinition type, string signature)
-               {
-                       if (type.HasMethods)
-                               foreach (MethodDefinition meth in type.Methods)
-                                       if (signature == GetMethodSignature (meth))
-                                               return meth;
-
-                       return null;
-               }
-
-               static string GetMethodSignature (MethodDefinition meth)
-               {
-                       StringBuilder sb = new StringBuilder ();
-                       sb.Append (meth.ReturnType.FullName);
-                       sb.Append (" ");
-                       sb.Append (meth.Name);
-                       sb.Append ("(");
-                       if (meth.HasParameters) {
-                               for (int i = 0; i < meth.Parameters.Count; i++) {
-                                       if (i > 0)
-                                               sb.Append (",");
-
-                                       sb.Append (meth.Parameters [i].ParameterType.FullName);
-                               }
-                       }
-                       sb.Append (")");
-                       return sb.ToString ();
-               }
-
-               static AssemblyDefinition GetAssembly (LinkContext context, string assemblyName)
-               {
-                       AssemblyNameReference reference = AssemblyNameReference.Parse (assemblyName);
-                       AssemblyDefinition assembly;
-
-                       assembly = context.Resolve (reference);
-
-                       ProcessReferences (assembly, context);
-                       return assembly;
-               }
-
-               static void ProcessReferences (AssemblyDefinition assembly, LinkContext context)
-               {
-                       foreach (AssemblyNameReference name in assembly.MainModule.AssemblyReferences)
-                               context.Resolve (name);
-               }
-
-               static bool IsRequired (XPathNavigator nav)
-               {
-                       string attribute = GetAttribute (nav, _required);
-                       if (attribute == null || attribute.Length == 0)
-                               return true;
-
-                       return TryParseBool (attribute);
-               }
-
-               static bool TryParseBool (string s)
-               {
-                       try {
-                               return bool.Parse (s);
-                       } catch {
-                               return false;
-                       }
-               }
-
-               static string GetSignature (XPathNavigator nav)
-               {
-                       return GetAttribute (nav, _signature);
-               }
-
-               static string GetFullName (XPathNavigator nav)
-               {
-                       return GetAttribute (nav, _fullname);
-               }
-
-               static string GetAttribute (XPathNavigator nav, string attribute)
-               {
-                       return nav.GetAttribute (attribute, _ns);
-               }
-       }
-}
diff --git a/mcs/tools/linker/Mono.Linker.Steps/ResolveStep.cs b/mcs/tools/linker/Mono.Linker.Steps/ResolveStep.cs
deleted file mode 100644 (file)
index b17bf5c..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-//
-// ResolveStep.cs
-//
-// Author:
-//   Jb Evain (jbevain@gmail.com)
-//
-// (C) 2006 Jb Evain
-//
-// 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.
-//
-
-namespace Mono.Linker.Steps {
-
-       using System.Collections;
-
-       public abstract class ResolveStep : BaseStep {
-
-               ArrayList _unResolved;
-
-               internal ResolveStep ()
-               {
-                       _unResolved = new ArrayList ();
-               }
-
-               public bool AllMarkerResolved
-               {
-                       get { return _unResolved.Count == 0; }
-               }
-
-               public string [] GetUnresolvedMarkers ()
-               {
-                       return _unResolved.ToArray (typeof (string)) as string [];
-               }
-
-               protected void AddUnresolveMarker (string signature)
-               {
-                       _unResolved.Add (signature);
-               }
-       }
-}
diff --git a/mcs/tools/linker/Mono.Linker.Steps/SweepStep.cs b/mcs/tools/linker/Mono.Linker.Steps/SweepStep.cs
deleted file mode 100644 (file)
index e463ff9..0000000
+++ /dev/null
@@ -1,228 +0,0 @@
-//
-// SweepStep.cs
-//
-// Author:
-//   Jb Evain (jbevain@gmail.com)
-//
-// (C) 2006 Jb Evain
-// (C) 2007 Novell, Inc.
-//
-// 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.Collections;
-using System.Collections.Generic;
-using Mono.Cecil;
-using Mono.Collections.Generic;
-
-namespace Mono.Linker.Steps {
-
-       public class SweepStep : BaseStep {
-
-               AssemblyDefinition [] assemblies;
-               HashSet<AssemblyDefinition> resolvedTypeReferences;
-
-               protected override void Process ()
-               {
-                       assemblies = Context.GetAssemblies ();
-                       foreach (var assembly in assemblies) {
-                               SweepAssembly (assembly);
-                               if (Annotations.GetAction (assembly) == AssemblyAction.Copy) {
-                                       // Copy assemblies can still contain Type references with
-                                       // type forwarders from Delete assemblies
-                                       // thus try to resolve all the type references and see
-                                       // if some changed the scope. if yes change the action to Save
-                                       if (ResolveAllTypeReferences (assembly))
-                                               Annotations.SetAction (assembly, AssemblyAction.Save);
-                               }
-                       }
-               }
-
-               void SweepAssembly (AssemblyDefinition assembly)
-               {
-                       if (Annotations.GetAction (assembly) != AssemblyAction.Link)
-                               return;
-
-                       if (!IsMarkedAssembly (assembly)) {
-                               RemoveAssembly (assembly);
-                               return;
-                       }
-
-                       var types = new List<TypeDefinition> ();
-
-                       foreach (TypeDefinition type in assembly.MainModule.Types) {
-                               if (Annotations.IsMarked (type)) {
-                                       SweepType (type);
-                                       types.Add (type);
-                                       continue;
-                               }
-
-                               if (type.Name == "<Module>")
-                                       types.Add (type);
-                       }
-
-                       assembly.MainModule.Types.Clear ();
-                       foreach (TypeDefinition type in types)
-                               assembly.MainModule.Types.Add (type);
-               }
-
-               bool IsMarkedAssembly (AssemblyDefinition assembly)
-               {
-                       return Annotations.IsMarked (assembly.MainModule);
-               }
-
-               void RemoveAssembly (AssemblyDefinition assembly)
-               {
-                       Annotations.SetAction (assembly, AssemblyAction.Delete);
-
-                       SweepReferences (assembly);
-               }
-
-               void SweepReferences (AssemblyDefinition target)
-               {
-                       foreach (var assembly in assemblies)
-                               SweepReferences (assembly, target);
-               }
-
-               void SweepReferences (AssemblyDefinition assembly, AssemblyDefinition target)
-               {
-                       if (assembly == target)
-                               return;
-
-                       var references = assembly.MainModule.AssemblyReferences;
-                       for (int i = 0; i < references.Count; i++) {
-                               var reference = references [i];
-                               var r = Context.Resolver.Resolve (reference);
-                               if (!AreSameReference (r.Name, target.Name))
-                                       continue;
-
-                               references.RemoveAt (i);
-                               // Removing the reference does not mean it will be saved back to disk!
-                               // That depends on the AssemblyAction set for the `assembly`
-                               switch (Annotations.GetAction (assembly)) {
-                               case AssemblyAction.Copy:
-                                       // Copy means even if "unlinked" we still want that assembly to be saved back 
-                                       // to disk (OutputStep) without the (removed) reference
-                                       Annotations.SetAction (assembly, AssemblyAction.Save);
-                                       ResolveAllTypeReferences (assembly);
-                                       break;
-
-                               case AssemblyAction.Save:
-                               case AssemblyAction.Link:
-                                       ResolveAllTypeReferences (assembly);
-                                       break;
-                               }
-                               return;
-                       }
-               }
-
-               bool ResolveAllTypeReferences (AssemblyDefinition assembly)
-               {
-                       if (resolvedTypeReferences == null)
-                               resolvedTypeReferences = new HashSet<AssemblyDefinition> ();
-                       if (resolvedTypeReferences.Contains (assembly))
-                               return false;
-                       resolvedTypeReferences.Add (assembly);
-
-                       var hash = new Dictionary<TypeReference,IMetadataScope> ();
-                       bool changes = false;
-
-                       foreach (TypeReference tr in assembly.MainModule.GetTypeReferences ()) {
-                               if (hash.ContainsKey (tr))
-                                       continue;
-                               var td = tr.Resolve ();
-                               IMetadataScope scope = tr.Scope;
-                               // at this stage reference might include things that can't be resolved
-                               // and if it is (resolved) it needs to be kept only if marked (#16213)
-                               if ((td != null) && Annotations.IsMarked (td)) {
-                                       scope = assembly.MainModule.Import (td).Scope;
-                                       if (tr.Scope != scope)
-                                               changes = true;
-                                       hash.Add (tr, scope);
-                               }
-                       }
-                       if (assembly.MainModule.HasExportedTypes) {
-                               foreach (var et in assembly.MainModule.ExportedTypes) {
-                                       var td = et.Resolve ();
-                                       IMetadataScope scope = et.Scope;
-                                       if ((td != null) && Annotations.IsMarked (td)) {
-                                               scope = assembly.MainModule.Import (td).Scope;
-                                               hash.Add (td, scope);
-                                       }
-                               }
-                       }
-
-                       // Resolve everything first before updating scopes.
-                       // If we set the scope to null, then calling Resolve() on any of its
-                       // nested types would crash.
-
-                       foreach (var e in hash) {
-                               e.Key.Scope = e.Value;
-                       }
-
-                       return changes;
-               }
-
-               void SweepType (TypeDefinition type)
-               {
-                       if (type.HasFields)
-                               SweepCollection (type.Fields);
-
-                       if (type.HasMethods)
-                               SweepCollection (type.Methods);
-
-                       if (type.HasNestedTypes)
-                               SweepNestedTypes (type);
-               }
-
-               void SweepNestedTypes (TypeDefinition type)
-               {
-                       for (int i = 0; i < type.NestedTypes.Count; i++) {
-                               var nested = type.NestedTypes [i];
-                               if (Annotations.IsMarked (nested)) {
-                                       SweepType (nested);
-                               } else {
-                                       type.NestedTypes.RemoveAt (i--);
-                               }
-                       }
-               }
-
-               void SweepCollection (IList list)
-               {
-                       for (int i = 0; i < list.Count; i++)
-                               if (!Annotations.IsMarked ((IMetadataTokenProvider) list [i]))
-                                       list.RemoveAt (i--);
-               }
-
-               static bool AreSameReference (AssemblyNameReference a, AssemblyNameReference b)
-               {
-                       if (a == b)
-                               return true;
-
-                       if (a.Name != b.Name)
-                               return false;
-
-                       if (a.Version > b.Version)
-                               return false;
-
-                       return true;
-               }
-       }
-}
diff --git a/mcs/tools/linker/Mono.Linker.Steps/TypeMapStep.cs b/mcs/tools/linker/Mono.Linker.Steps/TypeMapStep.cs
deleted file mode 100644 (file)
index 3fe12ae..0000000
+++ /dev/null
@@ -1,307 +0,0 @@
-//
-// TypeMapStep.cs
-//
-// Author:
-//   Jb Evain (jbevain@novell.com)
-//
-// (C) 2009 Novell, Inc.
-//
-// 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;
-using System.Collections.Generic;
-
-using Mono.Cecil;
-
-namespace Mono.Linker.Steps {
-
-       public class TypeMapStep : BaseStep {
-
-               protected override void ProcessAssembly (AssemblyDefinition assembly)
-               {
-                       foreach (TypeDefinition type in assembly.MainModule.Types)
-                               MapType (type);
-               }
-
-               protected virtual void MapType (TypeDefinition type)
-               {
-                       MapVirtualMethods (type);
-                       MapInterfaceMethodsInTypeHierarchy (type);
-
-                       if (!type.HasNestedTypes)
-                               return;
-
-                       foreach (var nested in type.NestedTypes)
-                               MapType (nested);
-               }
-
-               void MapInterfaceMethodsInTypeHierarchy (TypeDefinition type)
-               {
-                       if (!type.HasInterfaces)
-                               return;
-
-                       foreach (var @interface in type.Interfaces) {
-                               var iface = @interface.InterfaceType.Resolve ();
-                               if (iface == null || !iface.HasMethods)
-                                       continue;
-
-                               foreach (MethodDefinition method in iface.Methods) {
-                                       if (TryMatchMethod (type, method) != null)
-                                               continue;
-
-                                       var @base = GetBaseMethodInTypeHierarchy (type, method);
-                                       if (@base == null)
-                                               continue;
-
-                                       Annotations.AddPreservedMethod (type, @base);
-                               }
-                       }
-               }
-
-               void MapVirtualMethods (TypeDefinition type)
-               {
-                       if (!type.HasMethods)
-                               return;
-
-                       foreach (MethodDefinition method in type.Methods) {
-                               if (!method.IsVirtual)
-                                       continue;
-
-                               MapVirtualMethod (method);
-
-                               if (method.HasOverrides)
-                                       MapOverrides (method);
-                       }
-               }
-
-               void MapVirtualMethod (MethodDefinition method)
-               {
-                       MapVirtualBaseMethod (method);
-                       MapVirtualInterfaceMethod (method);
-               }
-
-               void MapVirtualBaseMethod (MethodDefinition method)
-               {
-                       MethodDefinition @base = GetBaseMethodInTypeHierarchy (method);
-                       if (@base == null)
-                               return;
-
-                       AnnotateMethods (@base, method);
-               }
-
-               void MapVirtualInterfaceMethod (MethodDefinition method)
-               {
-                       foreach (MethodDefinition @base in GetBaseMethodsInInterfaceHierarchy (method))
-                               AnnotateMethods (@base, method);
-               }
-
-               void MapOverrides (MethodDefinition method)
-               {
-                       foreach (MethodReference override_ref in method.Overrides) {
-                               MethodDefinition @override = override_ref.Resolve ();
-                               if (@override == null)
-                                       continue;
-
-                               AnnotateMethods (@override, method);
-                       }
-               }
-
-               void AnnotateMethods (MethodDefinition @base, MethodDefinition @override)
-               {
-                       Annotations.AddBaseMethod (@override, @base);
-                       Annotations.AddOverride (@base, @override);
-               }
-
-               static MethodDefinition GetBaseMethodInTypeHierarchy (MethodDefinition method)
-               {
-                       return GetBaseMethodInTypeHierarchy (method.DeclaringType, method);
-               }
-
-               static MethodDefinition GetBaseMethodInTypeHierarchy (TypeDefinition type, MethodDefinition method)
-               {
-                       TypeDefinition @base = GetBaseType (type);
-                       while (@base != null) {
-                               MethodDefinition base_method = TryMatchMethod (@base, method);
-                               if (base_method != null)
-                                       return base_method;
-
-                               @base = GetBaseType (@base);
-                       }
-
-                       return null;
-               }
-
-               static IEnumerable<MethodDefinition> GetBaseMethodsInInterfaceHierarchy (MethodDefinition method)
-               {
-                       return GetBaseMethodsInInterfaceHierarchy (method.DeclaringType, method);
-               }
-
-               static IEnumerable<MethodDefinition> GetBaseMethodsInInterfaceHierarchy (TypeDefinition type, MethodDefinition method)
-               {
-                       if (!type.HasInterfaces)
-                               yield break;
-
-                       foreach (var interface_ref in type.Interfaces) {
-                               TypeDefinition @interface = interface_ref.InterfaceType.Resolve ();
-                               if (@interface == null)
-                                       continue;
-
-                               MethodDefinition base_method = TryMatchMethod (@interface, method);
-                               if (base_method != null)
-                                       yield return base_method;
-
-                               foreach (MethodDefinition @base in GetBaseMethodsInInterfaceHierarchy (@interface, method))
-                                       yield return @base;
-                       }
-               }
-
-               static MethodDefinition TryMatchMethod (TypeDefinition type, MethodDefinition method)
-               {
-                       if (!type.HasMethods)
-                               return null;
-
-                       Dictionary<string,string> gp = null;
-                       foreach (MethodDefinition candidate in type.Methods) {
-                               if (MethodMatch (candidate, method, ref gp))
-                                       return candidate;
-                               if (gp != null)
-                                       gp.Clear ();
-                       }
-
-                       return null;
-               }
-
-               static bool MethodMatch (MethodDefinition candidate, MethodDefinition method, ref Dictionary<string,string> genericParameters)
-               {
-                       if (!candidate.IsVirtual)
-                               return false;
-
-                       if (candidate.HasParameters != method.HasParameters)
-                               return false;
-
-                       if (candidate.Name != method.Name)
-                               return false;
-
-                       if (candidate.HasGenericParameters != method.HasGenericParameters)
-                               return false;
-
-                       // we need to track what the generic parameter represent - as we cannot allow it to
-                       // differ between the return type or any parameter
-                       if (!TypeMatch (candidate.ReturnType, method.ReturnType, ref genericParameters))
-                               return false;
-
-                       if (!candidate.HasParameters)
-                               return true;
-
-                       var cp = candidate.Parameters;
-                       var mp = method.Parameters;
-                       if (cp.Count != mp.Count)
-                               return false;
-
-                       for (int i = 0; i < cp.Count; i++) {
-                               if (!TypeMatch (cp [i].ParameterType, mp [i].ParameterType, ref genericParameters))
-                                       return false;
-                       }
-
-                       return true;
-               }
-
-               static bool TypeMatch (IModifierType a, IModifierType b, ref Dictionary<string,string> gp)
-               {
-                       if (!TypeMatch (a.ModifierType, b.ModifierType, ref gp))
-                               return false;
-
-                       return TypeMatch (a.ElementType, b.ElementType, ref gp);
-               }
-
-               static bool TypeMatch (TypeSpecification a, TypeSpecification b, ref Dictionary<string,string> gp)
-               {
-                       var gita = a as GenericInstanceType;
-                       if (gita != null)
-                               return TypeMatch (gita, (GenericInstanceType) b, ref gp);
-
-                       var mta = a as IModifierType;
-                       if (mta != null)
-                               return TypeMatch (mta, (IModifierType) b, ref gp);
-
-                       return TypeMatch (a.ElementType, b.ElementType, ref gp);
-               }
-
-               static bool TypeMatch (GenericInstanceType a, GenericInstanceType b, ref Dictionary<string,string> gp)
-               {
-                       if (!TypeMatch (a.ElementType, b.ElementType, ref gp))
-                               return false;
-
-                       if (a.HasGenericArguments != b.HasGenericArguments)
-                               return false;
-
-                       if (!a.HasGenericArguments)
-                               return true;
-
-                       var gaa = a.GenericArguments;
-                       var gab = b.GenericArguments;
-                       if (gaa.Count != gab.Count)
-                               return false;
-
-                       for (int i = 0; i < gaa.Count; i++) {
-                               if (!TypeMatch (gaa [i], gab [i], ref gp))
-                                       return false;
-                       }
-
-                       return true;
-               }
-
-               static bool TypeMatch (TypeReference a, TypeReference b, ref Dictionary<string,string> gp)
-               {
-                       var gpa = a as GenericParameter;
-                       if (gpa != null) {
-                               if (gp == null)
-                                       gp = new Dictionary<string, string> ();
-                               string match;
-                               if (!gp.TryGetValue (gpa.FullName, out match)) {
-                                       // first use, we assume it will always be used this way
-                                       gp.Add (gpa.FullName, b.ToString ());
-                                       return true;
-                               }
-                               // re-use, it should match the previous usage
-                               return match == b.ToString ();
-                       }
-
-                       if (a is TypeSpecification || b is TypeSpecification) {
-                               if (a.GetType () != b.GetType ())
-                                       return false;
-
-                               return TypeMatch ((TypeSpecification) a, (TypeSpecification) b, ref gp);
-                       }
-
-                       return a.FullName == b.FullName;
-               }
-
-               static TypeDefinition GetBaseType (TypeDefinition type)
-               {
-                       if (type == null || type.BaseType == null)
-                               return null;
-
-                       return type.BaseType.Resolve ();
-               }
-       }
-}
diff --git a/mcs/tools/linker/Mono.Linker.csproj b/mcs/tools/linker/Mono.Linker.csproj
deleted file mode 100644 (file)
index 98f0737..0000000
+++ /dev/null
@@ -1,103 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <PropertyGroup>
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
-    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <ProductVersion>8.0.50727</ProductVersion>
-    <SchemaVersion>2.0</SchemaVersion>
-    <ProjectGuid>{DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}</ProjectGuid>
-    <OutputType>Exe</OutputType>
-    <AppDesignerFolder>Properties</AppDesignerFolder>
-    <RootNamespace>Mono.Linker</RootNamespace>
-    <AssemblyName>monolinker</AssemblyName>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
-    <DebugSymbols>True</DebugSymbols>
-    <DebugType>full</DebugType>
-    <Optimize>False</Optimize>
-    <OutputPath>bin\Debug\</OutputPath>
-    <DefineConstants>DEBUG;TRACE</DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
-    <DebugType>pdbonly</DebugType>
-    <Optimize>True</Optimize>
-    <OutputPath>bin\Release\</OutputPath>
-    <DefineConstants>TRACE</DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-  </PropertyGroup>
-  <Import Project="$(MSBuildBinPath)\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.
-  <Target Name="BeforeBuild">
-  </Target>
-  <Target Name="AfterBuild">
-  </Target>
-  -->
-  <ItemGroup>
-    <Reference Include="System" />
-    <Reference Include="System.Core" />
-    <Reference Include="System.Xml" />
-  </ItemGroup>
-  <ItemGroup>
-    <Compile Include="Mono.Linker.Steps\BaseStep.cs" />
-    <Compile Include="Mono.Linker.Steps\BlacklistStep.cs" />
-    <Compile Include="Mono.Linker.Steps\CleanStep.cs" />
-    <Compile Include="Mono.Linker.Steps\RegenerateGuidStep.cs" />
-    <Compile Include="Mono.Linker.Steps\LoadI18nAssemblies.cs" />
-    <Compile Include="Mono.Linker\IXApiVisitor.cs" />
-    <Compile Include="Mono.Linker\I18nAssemblies.cs" />
-    <Compile Include="Mono.Linker.Steps\IStep.cs" />
-    <Compile Include="Mono.Linker.Steps\LoadReferencesStep.cs" />
-    <Compile Include="Mono.Linker.Steps\MarkStep.cs" />
-    <Compile Include="Mono.Linker.Steps\OutputStep.cs" />
-    <Compile Include="Mono.Linker.Steps\ResolveFromXApiStep.cs" />
-    <Compile Include="Mono.Linker.Steps\ResolveFromAssemblyStep.cs" />
-    <Compile Include="Mono.Linker.Steps\ResolveFromXmlStep.cs" />
-    <Compile Include="Mono.Linker.Steps\ResolveStep.cs" />
-    <Compile Include="Mono.Linker.Steps\SweepStep.cs" />
-    <Compile Include="Mono.Linker\Annotations.cs" />
-    <Compile Include="Mono.Linker\AssemblyAction.cs" />
-    <Compile Include="Mono.Linker\AssemblyInfo.cs" />
-    <Compile Include="Mono.Linker\AssemblyResolver.cs" />
-    <Compile Include="Mono.Linker\Driver.cs" />
-    <Compile Include="Mono.Linker\LinkContext.cs" />
-    <Compile Include="Mono.Linker\MethodAction.cs" />
-    <Compile Include="Mono.Linker\Pipeline.cs" />
-    <Compile Include="Mono.Linker\TypePreserve.cs" />
-    <Compile Include="Mono.Linker\XApiReader.cs" />
-    <Compile Include="Mono.Linker.Steps\TypeMapStep.cs" />
-  </ItemGroup>
-  <ItemGroup>
-    <EmbeddedResource Include="Descriptors\mscorlib.xml">
-      <LogicalName>mscorlib.xml</LogicalName>
-    </EmbeddedResource>
-    <EmbeddedResource Include="Descriptors\System.Web.xml">
-      <LogicalName>System.web.xml</LogicalName>
-    </EmbeddedResource>
-    <EmbeddedResource Include="Descriptors\System.xml">
-      <LogicalName>System.xml</LogicalName>
-    </EmbeddedResource>
-    <EmbeddedResource Include="Descriptors\Mono.Posix.xml">
-      <LogicalName>Mono.Posix.xml</LogicalName>
-    </EmbeddedResource>
-    <EmbeddedResource Include="Descriptors\System.Drawing.xml">
-      <LogicalName>System.Drawing.xml</LogicalName>
-    </EmbeddedResource>
-    <EmbeddedResource Include="Descriptors\System.Core.xml">
-      <LogicalName>System.Core.xml</LogicalName>
-    </EmbeddedResource>
-  </ItemGroup>
-  <ItemGroup>
-    <None Include="Makefile" />
-    <None Include="README" />
-  </ItemGroup>
-  <ItemGroup>
-    <ProjectReference Include="..\..\..\external\cecil\Mono.Cecil.csproj">
-      <Project>{D68133BD-1E63-496E-9EDE-4FBDBF77B486}</Project>
-      <Name>Mono.Cecil</Name>
-    </ProjectReference>
-  </ItemGroup>
-</Project>
\ No newline at end of file
diff --git a/mcs/tools/linker/Mono.Linker/Annotations.cs b/mcs/tools/linker/Mono.Linker/Annotations.cs
deleted file mode 100644 (file)
index 72c59ba..0000000
+++ /dev/null
@@ -1,329 +0,0 @@
-//
-// Annotations.cs
-//
-// Author:
-//   Jb Evain (jbevain@novell.com)
-//
-// (C) 2007 Novell, Inc.
-//
-// 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;
-using System.Collections.Generic;
-using System.IO;
-using System.IO.Compression;
-
-using Mono.Cecil;
-using Mono.Cecil.Cil;
-
-namespace Mono.Linker {
-
-       public class AnnotationStore {
-
-               readonly Dictionary<AssemblyDefinition, AssemblyAction> assembly_actions = new Dictionary<AssemblyDefinition, AssemblyAction> ();
-               readonly Dictionary<MethodDefinition, MethodAction> method_actions = new Dictionary<MethodDefinition, MethodAction> ();
-               readonly HashSet<IMetadataTokenProvider> marked = new HashSet<IMetadataTokenProvider> ();
-               readonly HashSet<IMetadataTokenProvider> processed = new HashSet<IMetadataTokenProvider> ();
-               readonly Dictionary<TypeDefinition, TypePreserve> preserved_types = new Dictionary<TypeDefinition, TypePreserve> ();
-               readonly Dictionary<IMemberDefinition, List<MethodDefinition>> preserved_methods = new Dictionary<IMemberDefinition, List<MethodDefinition>> ();
-               readonly HashSet<IMetadataTokenProvider> public_api = new HashSet<IMetadataTokenProvider> ();
-               readonly Dictionary<MethodDefinition, List<MethodDefinition>> override_methods = new Dictionary<MethodDefinition, List<MethodDefinition>> ();
-               readonly Dictionary<MethodDefinition, List<MethodDefinition>> base_methods = new Dictionary<MethodDefinition, List<MethodDefinition>> ();
-               readonly Dictionary<AssemblyDefinition, ISymbolReader> symbol_readers = new Dictionary<AssemblyDefinition, ISymbolReader> ();
-
-               readonly Dictionary<object, Dictionary<IMetadataTokenProvider, object>> custom_annotations = new Dictionary<object, Dictionary<IMetadataTokenProvider, object>> ();
-
-               Stack<object> dependency_stack;
-               System.Xml.XmlWriter writer;
-               GZipStream zipStream;
-
-               public void PrepareDependenciesDump ()
-               {
-                       PrepareDependenciesDump ("linker-dependencies.xml.gz");
-               }
-
-               public void PrepareDependenciesDump (string filename)
-               {
-                       dependency_stack = new Stack<object> ();
-                       System.Xml.XmlWriterSettings settings = new System.Xml.XmlWriterSettings();
-                       settings.Indent = true;
-                       settings.IndentChars = "\t";
-                       var depsFile = File.OpenWrite (filename);
-                       zipStream = new GZipStream (depsFile, CompressionMode.Compress);
-
-                       writer = System.Xml.XmlWriter.Create (zipStream, settings);
-                       writer.WriteStartDocument ();
-                       writer.WriteStartElement ("dependencies");
-                       writer.WriteStartAttribute ("version");
-                       writer.WriteString ("1.0");
-                       writer.WriteEndAttribute ();
-               }
-
-               public AssemblyAction GetAction (AssemblyDefinition assembly)
-               {
-                       AssemblyAction action;
-                       if (assembly_actions.TryGetValue (assembly, out action))
-                               return action;
-
-                       throw new NotSupportedException ();
-               }
-
-               public MethodAction GetAction (MethodDefinition method)
-               {
-                       MethodAction action;
-                       if (method_actions.TryGetValue (method, out action))
-                               return action;
-
-                       return MethodAction.Nothing;
-               }
-
-               public void SetAction (AssemblyDefinition assembly, AssemblyAction action)
-               {
-                       assembly_actions [assembly] = action;
-               }
-
-               public bool HasAction (AssemblyDefinition assembly)
-               {
-                       return assembly_actions.ContainsKey (assembly);
-               }
-
-               public void SetAction (MethodDefinition method, MethodAction action)
-               {
-                       method_actions [method] = action;
-               }
-
-               public void Mark (IMetadataTokenProvider provider)
-               {
-                       marked.Add (provider);
-                       AddDependency (provider);
-               }
-
-               public bool IsMarked (IMetadataTokenProvider provider)
-               {
-                       return marked.Contains (provider);
-               }
-
-               public void Processed (IMetadataTokenProvider provider)
-               {
-                       processed.Add (provider);
-               }
-
-               public bool IsProcessed (IMetadataTokenProvider provider)
-               {
-                       return processed.Contains (provider);
-               }
-
-               public bool IsPreserved (TypeDefinition type)
-               {
-                       return preserved_types.ContainsKey (type);
-               }
-
-               public void SetPreserve (TypeDefinition type, TypePreserve preserve)
-               {
-                       preserved_types [type] = preserve;
-               }
-
-               public TypePreserve GetPreserve (TypeDefinition type)
-               {
-                       TypePreserve preserve;
-                       if (preserved_types.TryGetValue (type, out preserve))
-                               return preserve;
-
-                       throw new NotSupportedException ();
-               }
-
-               public void SetPublic (IMetadataTokenProvider provider)
-               {
-                       public_api.Add (provider);
-               }
-
-               public bool IsPublic (IMetadataTokenProvider provider)
-               {
-                       return public_api.Contains (provider);
-               }
-
-               public void AddOverride (MethodDefinition @base, MethodDefinition @override)
-               {
-                       var methods = GetOverrides (@base);
-                       if (methods == null) {
-                               methods = new List<MethodDefinition> ();
-                               override_methods [@base] = methods;
-                       }
-
-                       methods.Add (@override);
-               }
-
-               public List<MethodDefinition> GetOverrides (MethodDefinition method)
-               {
-                       List<MethodDefinition> overrides;
-                       if (override_methods.TryGetValue (method, out overrides))
-                               return overrides;
-
-                       return null;
-               }
-
-               public void AddBaseMethod (MethodDefinition method, MethodDefinition @base)
-               {
-                       var methods = GetBaseMethods (method);
-                       if (methods == null) {
-                               methods = new List<MethodDefinition> ();
-                               base_methods [method] = methods;
-                       }
-
-                       methods.Add (@base);
-               }
-
-               public List<MethodDefinition> GetBaseMethods (MethodDefinition method)
-               {
-                       List<MethodDefinition> bases;
-                       if (base_methods.TryGetValue (method, out bases))
-                               return bases;
-
-                       return null;
-               }
-
-               public List<MethodDefinition> GetPreservedMethods (TypeDefinition type)
-               {
-                       return GetPreservedMethods (type as IMemberDefinition);
-               }
-
-               public void AddPreservedMethod (TypeDefinition type, MethodDefinition method)
-               {
-                       AddPreservedMethod (type as IMemberDefinition, method);
-               }
-
-               public List<MethodDefinition> GetPreservedMethods (MethodDefinition method)
-               {
-                       return GetPreservedMethods (method as IMemberDefinition);
-               }
-
-               public void AddPreservedMethod (MethodDefinition key, MethodDefinition method)
-               {
-                       AddPreservedMethod (key as IMemberDefinition, method);
-               }
-
-               List<MethodDefinition> GetPreservedMethods (IMemberDefinition definition)
-               {
-                       List<MethodDefinition> preserved;
-                       if (preserved_methods.TryGetValue (definition, out preserved))
-                               return preserved;
-
-                       return null;
-               }
-
-               void AddPreservedMethod (IMemberDefinition definition, MethodDefinition method)
-               {
-                       var methods = GetPreservedMethods (definition);
-                       if (methods == null) {
-                               methods = new List<MethodDefinition> ();
-                               preserved_methods [definition] = methods;
-                       }
-
-                       methods.Add (method);
-               }
-
-               public void AddSymbolReader (AssemblyDefinition assembly, ISymbolReader symbolReader)
-               {
-                       symbol_readers [assembly] = symbolReader;
-               }
-
-               public void CloseSymbolReader (AssemblyDefinition assembly)
-               {
-                       ISymbolReader symbolReader;
-                       if (!symbol_readers.TryGetValue (assembly, out symbolReader))
-                               return;
-
-                       symbol_readers.Remove (assembly);
-                       symbolReader.Dispose ();
-               }
-
-               public Dictionary<IMetadataTokenProvider, object> GetCustomAnnotations (object key)
-               {
-                       Dictionary<IMetadataTokenProvider, object> slots;
-                       if (custom_annotations.TryGetValue (key, out slots))
-                               return slots;
-
-                       slots = new Dictionary<IMetadataTokenProvider, object> ();
-                       custom_annotations.Add (key, slots);
-                       return slots;
-               }
-
-               public void AddDependency (object o)
-               {
-                       if (writer == null)
-                               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 ();
-               }
-
-               public void Push (object o)
-               {
-                       if (writer == null)
-                               return;
-
-                       if (dependency_stack.Count > 0)
-                               AddDependency (o);
-                       dependency_stack.Push (o);
-               }
-
-               public void Pop ()
-               {
-                       if (writer == null)
-                               return;
-
-                       dependency_stack.Pop ();
-               }
-
-               string TokenString (object o)
-               {
-                       if (o == null)
-                               return "N:null";
-
-                       if (o is IMetadataTokenProvider)
-                               return (o as IMetadataTokenProvider).MetadataToken.TokenType + ":" + o;
-
-                       return "Other:" + o;
-               }
-
-               public void SaveDependencies ()
-               {
-                       if (writer == null)
-                               return;
-
-                       writer.WriteEndElement ();
-                       writer.WriteEndDocument ();
-                       writer.Flush ();
-                       writer.Close ();
-                       zipStream.Close ();
-
-                       writer.Dispose ();
-                       zipStream.Dispose ();
-                       writer = null;
-                       zipStream = null;
-                       dependency_stack = null;
-               }
-       }
-}
diff --git a/mcs/tools/linker/Mono.Linker/AssemblyAction.cs b/mcs/tools/linker/Mono.Linker/AssemblyAction.cs
deleted file mode 100644 (file)
index 14282b3..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-//
-// AssemblyAction.cs
-//
-// Author:
-//   Jb Evain (jbevain@gmail.com)
-//
-// (C) 2006 Jb Evain
-//
-// 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.
-//
-
-namespace Mono.Linker {
-
-       public enum AssemblyAction {
-               // Ignore the assembly
-               Skip,
-               // Copy the existing files, assembly and symbols, into the output destination. E.g. .dll and .mdb
-               // The linker still analyze the assemblies (to know what they require) but does not modify them
-               Copy,
-               // Link the assembly
-               Link,
-               // Remove the assembly from the output
-               Delete,
-               // Save the assembly/symbols in memory without linking it. 
-               // E.g. useful to remove unneeded assembly references (as done in SweepStep), 
-               //  resolving [TypeForwardedTo] attributes (like PCL) to their final location
-               Save
-       }
-}
diff --git a/mcs/tools/linker/Mono.Linker/AssemblyInfo.cs b/mcs/tools/linker/Mono.Linker/AssemblyInfo.cs
deleted file mode 100644 (file)
index 348e29b..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-//
-// AssemblyInfo.cs
-//
-// Author:
-//   Jb Evain (jbevain@gmail.com)
-//
-// (C) 2006 Jb Evain
-//
-// 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.Reflection;
-using System.Runtime.InteropServices;
-
-[assembly: AssemblyTitle ("Mono.Linker")]
-[assembly: AssemblyDescription ("Mono CIL Linker")]
-[assembly: AssemblyConfiguration ("")]
-[assembly: AssemblyProduct ("")]
-[assembly: AssemblyCopyright ("(C) 2006, Jb Evain")]
-[assembly: AssemblyCulture ("")]
-
-[assembly: CLSCompliant (false)]
-[assembly: ComVisible (false)]
-
-[assembly: AssemblyVersion ("0.2.0.0")]
diff --git a/mcs/tools/linker/Mono.Linker/AssemblyResolver.cs b/mcs/tools/linker/Mono.Linker/AssemblyResolver.cs
deleted file mode 100644 (file)
index 23aca21..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-//
-// AssemblyResolver.cs
-//
-// Author:
-//   Jb Evain (jbevain@novell.com)
-//
-// (C) 2007 Novell, Inc.
-//
-// 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;
-using System.IO;
-using Mono.Cecil;
-
-namespace Mono.Linker {
-
-       public class AssemblyResolver : BaseAssemblyResolver {
-
-               IDictionary _assemblies;
-
-               public IDictionary AssemblyCache {
-                       get { return _assemblies; }
-               }
-
-               public AssemblyResolver ()
-                       : this (new Hashtable ())
-               {
-               }
-
-               public AssemblyResolver (IDictionary assembly_cache)
-               {
-                       _assemblies = assembly_cache;
-               }
-
-               public override AssemblyDefinition Resolve (AssemblyNameReference name, ReaderParameters parameters)
-               {
-                       AssemblyDefinition asm = (AssemblyDefinition) _assemblies [name.Name];
-                       if (asm == null) {
-                               asm = base.Resolve (name, parameters);
-                               _assemblies [name.Name] = asm;
-                       }
-
-                       return asm;
-               }
-
-               public void CacheAssembly (AssemblyDefinition assembly)
-               {
-                       _assemblies [assembly.Name.Name] = assembly;
-                       base.AddSearchDirectory (Path.GetDirectoryName (assembly.MainModule.FullyQualifiedName));
-               }
-       }
-}
diff --git a/mcs/tools/linker/Mono.Linker/Driver.cs b/mcs/tools/linker/Mono.Linker/Driver.cs
deleted file mode 100644 (file)
index 7d1963c..0000000
+++ /dev/null
@@ -1,322 +0,0 @@
-//
-// Driver.cs
-//
-// Author:
-//   Jb Evain (jbevain@gmail.com)
-//
-// (C) 2006 Jb Evain
-//
-// 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;
-using System.IO;
-using SR = System.Reflection;
-using System.Xml.XPath;
-
-using Mono.Linker.Steps;
-
-namespace Mono.Linker {
-
-       public class Driver {
-
-               static readonly string _linker = "Mono CIL Linker";
-
-               public static int Main (string [] args)
-               {
-                       if (args.Length == 0)
-                               Usage ("No parameters specified");
-
-                       try {
-
-                               Driver driver = new Driver (args);
-                               driver.Run ();
-
-                       } catch (Exception e) {
-                               Console.WriteLine ("Fatal error in {0}", _linker);
-                               Console.WriteLine (e);
-                               return 1;
-                       }
-
-                       return 0;
-               }
-
-               Queue _queue;
-
-               public Driver (string [] args)
-               {
-                       _queue = new Queue (args);
-               }
-
-               bool HaveMoreTokens ()
-               {
-                       return _queue.Count > 0;
-               }
-
-               void Run ()
-               {
-                       Pipeline p = GetStandardPipeline ();
-                       LinkContext context = GetDefaultContext (p);
-                       I18nAssemblies assemblies = I18nAssemblies.All;
-                       ArrayList custom_steps = new ArrayList ();
-
-                       bool resolver = false;
-                       while (HaveMoreTokens ()) {
-                               string token = GetParam ();
-                               if (token.Length < 2)
-                                       Usage ("Option is too short");
-
-                               if (! (token [0] == '-' || token [1] == '/'))
-                                       Usage ("Expecting an option, got instead: " + token);
-
-                               if (token [0] == '-' && token [1] == '-') {
-
-                                       if (token.Length < 3)
-                                               Usage ("Option is too short");
-
-                                       switch (token [2]) {
-                                       case 'v':
-                                               Version ();
-                                               break;
-                                       case 'a':
-                                               About ();
-                                               break;
-                                       default:
-                                               Usage (null);
-                                               break;
-                                       }
-                               }
-
-                               switch (token [1]) {
-                               case 'd': {
-                                       DirectoryInfo info = new DirectoryInfo (GetParam ());
-                                       context.Resolver.AddSearchDirectory (info.FullName);
-                                       break;
-                               }
-                               case 'o':
-                                       context.OutputDirectory = GetParam ();
-                                       break;
-                               case 'c':
-                                       context.CoreAction = ParseAssemblyAction (GetParam ());
-                                       break;
-                               case 'p':
-                                       AssemblyAction action = ParseAssemblyAction (GetParam ());
-                                       context.Actions [GetParam ()] = action;
-                                       break;
-                               case 's':
-                                       custom_steps.Add (GetParam ());
-                                       break;
-                               case 'x':
-                                       foreach (string file in GetFiles (GetParam ()))
-                                               p.PrependStep (new ResolveFromXmlStep (new XPathDocument (file)));
-                                       resolver = true;
-                                       break;
-                               case 'a':
-                                       foreach (string file in GetFiles (GetParam ()))
-                                               p.PrependStep (new ResolveFromAssemblyStep (file));
-                                       resolver = true;
-                                       break;
-                               case 'i':
-                                       foreach (string file in GetFiles (GetParam ()))
-                                               p.PrependStep (new ResolveFromXApiStep (new XPathDocument (file)));
-                                       resolver = true;
-                                       break;
-                               case 'l':
-                                       assemblies = ParseI18n (GetParam ());
-                                       break;
-                               case 'm':
-                                       context.SetParameter (GetParam (), GetParam ());
-                                       break;
-                               case 'b':
-                                       context.LinkSymbols = bool.Parse (GetParam ());
-                                       break;
-                               case 'g':
-                                       if (!bool.Parse (GetParam ()))
-                                               p.RemoveStep (typeof (RegenerateGuidStep));
-                                       break;
-                               default:
-                                       Usage ("Unknown option: `" + token [1] + "'");
-                                       break;
-                               }
-                       }
-
-                       if (!resolver)
-                               Usage ("No resolver was created (use -x, -a or -i)");
-
-                       foreach (string custom_step in custom_steps)
-                               AddCustomStep (p, custom_step);
-
-                       p.AddStepAfter (typeof (LoadReferencesStep), new LoadI18nAssemblies (assemblies));
-
-                       p.Process (context);
-               }
-
-               static void AddCustomStep (Pipeline pipeline, string arg)
-               {
-                       int pos = arg.IndexOf (":");
-                       if (pos == -1) {
-                               pipeline.AppendStep (ResolveStep (arg));
-                               return;
-                       }
-
-                       string [] parts = arg.Split (':');
-                       if (parts.Length != 2)
-                               Usage ("Step is specified as TYPE:STEP");
-
-                       if (parts [0].IndexOf (",") > -1)
-                               pipeline.AddStepBefore (FindStep (pipeline, parts [1]), ResolveStep (parts [0]));
-                       else if (parts [1].IndexOf (",") > -1)
-                               pipeline.AddStepAfter (FindStep (pipeline, parts [0]), ResolveStep (parts [1]));
-                       else
-                               Usage ("No comma separator in TYPE or STEP");
-               }
-
-               static Type FindStep (Pipeline pipeline, string name)
-               {
-                       foreach (IStep step in pipeline.GetSteps ()) {
-                               Type t = step.GetType ();
-                               if (t.Name == name)
-                                       return t;
-                       }
-
-                       return null;
-               }
-
-               static IStep ResolveStep (string type)
-               {
-                       Type step = Type.GetType (type, false);
-                       if (step == null)
-                               Usage (String.Format ("Step type '{0}' not found.", type));
-                       if (!typeof (IStep).IsAssignableFrom (step))
-                               Usage (String.Format ("Step type '{0}' does not implement IStep interface.", type));
-                       return (IStep) Activator.CreateInstance (step);
-               }
-
-               static string [] GetFiles (string param)
-               {
-                       if (param.Length < 1 || param [0] != '@')
-                               return new string [] {param};
-
-                       string file = param.Substring (1);
-                       return ReadLines (file);
-               }
-
-               static string [] ReadLines (string file)
-               {
-                       ArrayList lines = new ArrayList ();
-                       using (StreamReader reader = new StreamReader (file)) {
-                               string line;
-                               while ((line = reader.ReadLine ()) != null)
-                                       lines.Add (line);
-                       }
-                       return (string []) lines.ToArray (typeof (string));
-               }
-
-               static I18nAssemblies ParseI18n (string str)
-               {
-                       I18nAssemblies assemblies = I18nAssemblies.None;
-                       string [] parts = str.Split (',');
-                       foreach (string part in parts)
-                               assemblies |= (I18nAssemblies) Enum.Parse (typeof (I18nAssemblies), part.Trim (), true);
-
-                       return assemblies;
-               }
-
-               static AssemblyAction ParseAssemblyAction (string s)
-               {
-                       return (AssemblyAction) Enum.Parse (typeof (AssemblyAction), s, true);
-               }
-
-               string GetParam ()
-               {
-                       if (_queue.Count == 0)
-                               Usage ("Expecting a parameter");
-
-                       return (string) _queue.Dequeue ();
-               }
-
-               static LinkContext GetDefaultContext (Pipeline pipeline)
-               {
-                       LinkContext context = new LinkContext (pipeline);
-                       context.CoreAction = AssemblyAction.Skip;
-                       context.OutputDirectory = "output";
-                       return context;
-               }
-
-               static void Usage (string msg)
-               {
-                       Console.WriteLine (_linker);
-                       if (msg != null)
-                               Console.WriteLine ("Error: " + msg);
-                       Console.WriteLine ("monolinker [options] -x|-a|-i file");
-
-                       Console.WriteLine ("   --about     About the {0}", _linker);
-                       Console.WriteLine ("   --version   Print the version number of the {0}", _linker);
-                       Console.WriteLine ("   -out        Specify the output directory, default to `output'");
-                       Console.WriteLine ("   -c          Action on the core assemblies, skip, copy or link, default to skip");
-                       Console.WriteLine ("   -p          Action per assembly");
-                       Console.WriteLine ("   -s          Add a new step to the pipeline.");
-                       Console.WriteLine ("   -d          Add a directory where the linker will look for assemblies");
-                       Console.WriteLine ("   -b          Generate debug symbols for each linked module (true or false)");
-                       Console.WriteLine ("   -g          Generate a new unique guid for each linked module (true or false)");
-                       Console.WriteLine ("   -l          List of i18n assemblies to copy to the output directory");
-                       Console.WriteLine ("                 separated with a comma: none,all,cjk,mideast,other,rare,west");
-                       Console.WriteLine ("                 default is all");
-                       Console.WriteLine ("   -x          Link from an XML descriptor");
-                       Console.WriteLine ("   -a          Link from a list of assemblies");
-                       Console.WriteLine ("   -i          Link from an mono-api-info descriptor");
-                       Console.WriteLine ("");
-
-                       Environment.Exit (1);
-               }
-
-               static void Version ()
-               {
-                       Console.WriteLine ("{0} Version {1}",
-                               _linker,
-                           System.Reflection.Assembly.GetExecutingAssembly ().GetName ().Version);
-
-                       Environment.Exit(1);
-               }
-
-               static void About ()
-               {
-                       Console.WriteLine ("For more information, visit the project Web site");
-                       Console.WriteLine ("   http://www.mono-project.com/");
-
-                       Environment.Exit(1);
-               }
-
-               static Pipeline GetStandardPipeline ()
-               {
-                       Pipeline p = new Pipeline ();
-                       p.AppendStep (new LoadReferencesStep ());
-                       p.AppendStep (new BlacklistStep ());
-                       p.AppendStep (new TypeMapStep ());
-                       p.AppendStep (new MarkStep ());
-                       p.AppendStep (new SweepStep ());
-                       p.AppendStep (new CleanStep ());
-                       p.AppendStep (new RegenerateGuidStep ());
-                       p.AppendStep (new OutputStep ());
-                       return p;
-               }
-       }
-}
diff --git a/mcs/tools/linker/Mono.Linker/I18nAssemblies.cs b/mcs/tools/linker/Mono.Linker/I18nAssemblies.cs
deleted file mode 100644 (file)
index a14c58f..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-//
-// I18nAssemblies.cs
-//
-// Author:
-//   Jb Evain (jbevain@novell.com)
-//
-// (C) 2007 Novell, Inc.
-//
-// 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;
-
-namespace Mono.Linker {
-
-       [Flags]
-       public enum I18nAssemblies {
-
-               None = 0,
-
-               CJK = 1,
-               MidEast = 2,
-               Other = 4,
-               Rare = 8,
-               West = 16,
-
-               All = CJK | MidEast | Other | Rare | West,
-               Base
-       }
-}
diff --git a/mcs/tools/linker/Mono.Linker/IXApiVisitor.cs b/mcs/tools/linker/Mono.Linker/IXApiVisitor.cs
deleted file mode 100644 (file)
index 204d699..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-//
-// XApiVisitor.cs
-//
-// Author:
-//   Jb Evain (jbevain@novell.com)
-//
-// (C) 2007 Novell, Inc.
-//
-// 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.Xml.XPath;
-
-using Mono.Cecil;
-
-namespace Mono.Linker {
-
-       public interface IXApiVisitor {
-
-               void OnAssembly (XPathNavigator nav, AssemblyDefinition assembly);
-               void OnAttribute (XPathNavigator nav);
-               void OnClass (XPathNavigator nav, TypeDefinition type);
-               void OnInterface (XPathNavigator nav, TypeDefinition type);
-               void OnField (XPathNavigator nav, FieldDefinition field);
-               void OnMethod (XPathNavigator nav, MethodDefinition method);
-               void OnConstructor (XPathNavigator nav, MethodDefinition method);
-               void OnProperty (XPathNavigator nav, PropertyDefinition property);
-               void OnEvent (XPathNavigator nav, EventDefinition evt);
-       }
-}
diff --git a/mcs/tools/linker/Mono.Linker/LinkContext.cs b/mcs/tools/linker/Mono.Linker/LinkContext.cs
deleted file mode 100644 (file)
index 417206c..0000000
+++ /dev/null
@@ -1,260 +0,0 @@
-//
-// LinkContext.cs
-//
-// Author:
-//   Jb Evain (jbevain@gmail.com)
-//
-// (C) 2006 Jb Evain
-//
-// 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;
-using System.IO;
-
-using Mono.Cecil;
-using Mono.Cecil.Cil;
-
-namespace Mono.Linker {
-
-       public class LinkContext {
-
-               Pipeline _pipeline;
-               AssemblyAction _coreAction;
-               Hashtable _actions;
-               string _outputDirectory;
-               Hashtable _parameters;
-               bool _linkSymbols;
-
-               AssemblyResolver _resolver;
-
-               ReaderParameters _readerParameters;
-               ISymbolReaderProvider _symbolReaderProvider;
-               ISymbolWriterProvider _symbolWriterProvider;
-
-               AnnotationStore _annotations;
-
-               public Pipeline Pipeline {
-                       get { return _pipeline; }
-               }
-
-               public AnnotationStore Annotations {
-                       get { return _annotations; }
-               }
-
-               public string OutputDirectory {
-                       get { return _outputDirectory; }
-                       set { _outputDirectory = value; }
-               }
-
-               public AssemblyAction CoreAction {
-                       get { return _coreAction; }
-                       set { _coreAction = value; }
-               }
-
-               public bool LinkSymbols {
-                       get { return _linkSymbols; }
-                       set { _linkSymbols = value; }
-               }
-
-               public IDictionary Actions {
-                       get { return _actions; }
-               }
-
-               public AssemblyResolver Resolver {
-                       get { return _resolver; }
-               }
-
-               public ISymbolReaderProvider SymbolReaderProvider {
-                       get { return _symbolReaderProvider; }
-                       set { _symbolReaderProvider = value; }
-               }
-
-               public ISymbolWriterProvider SymbolWriterProvider {
-                       get { return _symbolWriterProvider; }
-                       set { _symbolWriterProvider = value; }
-               }
-
-               public bool LogInternalExceptions { get; set; } = false;
-
-               public LinkContext (Pipeline pipeline)
-                       : this (pipeline, new AssemblyResolver ())
-               {
-               }
-
-               public LinkContext (Pipeline pipeline, AssemblyResolver resolver)
-               {
-                       _pipeline = pipeline;
-                       _resolver = resolver;
-                       _actions = new Hashtable ();
-                       _parameters = new Hashtable ();
-                       _annotations = new AnnotationStore ();
-                       _readerParameters = new ReaderParameters {
-                               AssemblyResolver = _resolver,
-                       };
-               }
-
-               public TypeDefinition GetType (string fullName)
-               {
-                       int pos = fullName.IndexOf (",");
-                       fullName = fullName.Replace ("+", "/");
-                       if (pos == -1) {
-                               foreach (AssemblyDefinition asm in GetAssemblies ()) {
-                                       var type = asm.MainModule.GetType (fullName);
-                                       if (type != null)
-                                               return type;
-                               }
-
-                               return null;
-                       }
-
-                       string asmname = fullName.Substring (pos + 1);
-                       fullName = fullName.Substring (0, pos);
-                       AssemblyDefinition assembly = Resolve (AssemblyNameReference.Parse (asmname));
-                       return assembly.MainModule.GetType (fullName);
-               }
-
-               public AssemblyDefinition Resolve (string name)
-               {
-                       if (File.Exists (name)) {
-                               AssemblyDefinition assembly = AssemblyDefinition.ReadAssembly (name, _readerParameters);
-                               _resolver.CacheAssembly (assembly);
-                               return assembly;
-                       }
-
-                       return Resolve (new AssemblyNameReference (name, new Version ()));
-               }
-
-               public AssemblyDefinition Resolve (IMetadataScope scope)
-               {
-                       AssemblyNameReference reference = GetReference (scope);
-                       try {
-                               AssemblyDefinition assembly = _resolver.Resolve (reference, _readerParameters);
-
-                               if (SeenFirstTime (assembly)) {
-                                       SafeReadSymbols (assembly);
-                                       SetAction (assembly);
-                               }
-
-                               return assembly;
-                       }
-                       catch {
-                               throw new AssemblyResolutionException (reference);
-                       }
-               }
-
-               bool SeenFirstTime (AssemblyDefinition assembly)
-               {
-                       return !_annotations.HasAction (assembly);
-               }
-
-               public void SafeReadSymbols (AssemblyDefinition assembly)
-               {
-                       if (!_linkSymbols)
-                               return;
-
-                       if (assembly.MainModule.HasSymbols)
-                               return;
-
-                       try {
-                               if (_symbolReaderProvider != null) {
-                                       var symbolReader = _symbolReaderProvider.GetSymbolReader (
-                                               assembly.MainModule,
-                                               assembly.MainModule.FullyQualifiedName);
-
-                                       _annotations.AddSymbolReader (assembly, symbolReader);
-                                       assembly.MainModule.ReadSymbols (symbolReader);
-                               } else
-                                       assembly.MainModule.ReadSymbols ();
-                       } catch {}
-               }
-
-               static AssemblyNameReference GetReference (IMetadataScope scope)
-               {
-                       AssemblyNameReference reference;
-                       if (scope is ModuleDefinition) {
-                               AssemblyDefinition asm = ((ModuleDefinition) scope).Assembly;
-                               reference = asm.Name;
-                       } else
-                               reference = (AssemblyNameReference) scope;
-
-                       return reference;
-               }
-
-               void SetAction (AssemblyDefinition assembly)
-               {
-                       AssemblyAction action = AssemblyAction.Link;
-
-                       AssemblyNameDefinition name = assembly.Name;
-
-                       if (_actions.Contains (name.Name))
-                               action = (AssemblyAction) _actions [name.Name];
-                       else if (IsCore (name))
-                               action = _coreAction;
-
-                       _annotations.SetAction (assembly, action);
-               }
-
-               static bool IsCore (AssemblyNameReference name)
-               {
-                       switch (name.Name) {
-                       case "mscorlib":
-                       case "Accessibility":
-                       case "Mono.Security":
-                               // WPF
-                       case "PresentationFramework":
-                       case "PresentationCore":
-                       case "WindowsBase":
-                       case "UIAutomationProvider":
-                       case "UIAutomationTypes":
-                       case "PresentationUI":
-                       case "ReachFramework":
-                               return true;
-                       default:
-                               return name.Name.StartsWith ("System")
-                                       || name.Name.StartsWith ("Microsoft");
-                       }
-               }
-
-               public AssemblyDefinition [] GetAssemblies ()
-               {
-                       IDictionary cache = _resolver.AssemblyCache;
-                       AssemblyDefinition [] asms = new AssemblyDefinition [cache.Count];
-                       cache.Values.CopyTo (asms, 0);
-                       return asms;
-               }
-
-               public void SetParameter (string key, string value)
-               {
-                       _parameters [key] = value;
-               }
-
-               public bool HasParameter (string key)
-               {
-                       return _parameters.Contains (key);
-               }
-
-               public string GetParameter (string key)
-               {
-                       return (string) _parameters [key];
-               }
-       }
-}
diff --git a/mcs/tools/linker/Mono.Linker/MethodAction.cs b/mcs/tools/linker/Mono.Linker/MethodAction.cs
deleted file mode 100644 (file)
index f51587e..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-//
-// MethodAction.cs
-//
-// Author:
-//   Jb Evain (jbevain@gmail.com)
-//
-// (C) 2006 Jb Evain
-//
-// 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.
-//
-
-namespace Mono.Linker {
-
-       public enum MethodAction {
-               Nothing,
-               Parse,
-               ForceParse
-       }
-}
diff --git a/mcs/tools/linker/Mono.Linker/Pipeline.cs b/mcs/tools/linker/Mono.Linker/Pipeline.cs
deleted file mode 100644 (file)
index 7ae07d2..0000000
+++ /dev/null
@@ -1,138 +0,0 @@
-//
-// Pipeline.cs
-//
-// Author:
-//   Jb Evain (jbevain@gmail.com)
-//
-// (C) 2006 Jb Evain
-//
-// 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;
-using System.Diagnostics;
-
-using Mono.Linker.Steps;
-
-namespace Mono.Linker {
-
-       public class Pipeline {
-
-               ArrayList _steps;
-
-               public Pipeline ()
-               {
-                       _steps = new ArrayList();
-               }
-
-               public void PrependStep (IStep step)
-               {
-                       _steps.Insert (0, step);
-               }
-
-               public void AppendStep (IStep step)
-               {
-                       _steps.Add (step);
-               }
-
-               public void AddStepBefore (Type target, IStep step)
-               {
-                       for (int i = 0; i < _steps.Count; i++) {
-                               if (target.IsInstanceOfType (_steps [i])) {
-                                       _steps.Insert (i, step);
-                                       return;
-                               }
-                       }
-                       string msg = String.Format ("Step {0} could not be inserted before (not found) {1}", step, target);
-                       throw new InvalidOperationException (msg);
-               }
-
-               public void ReplaceStep (Type target, IStep step)
-               {
-                       AddStepBefore (target, step);
-                       RemoveStep (target);
-               }
-
-               public void AddStepAfter (Type target, IStep step)
-               {
-                       for (int i = 0; i < _steps.Count; i++) {
-                               if (target.IsInstanceOfType (_steps [i])) {
-                                       if (i == _steps.Count - 1)
-                                               _steps.Add (step);
-                                       else
-                                               _steps.Insert (i + 1, step);
-                                       return;
-                               }
-                       }
-                       string msg = String.Format ("Step {0} could not be inserted after (not found) {1}", step, target);
-                       throw new InvalidOperationException (msg);
-               }
-
-               public void AddStepAfter (IStep target, IStep step)
-               {
-                       for (int i = 0; i < _steps.Count; i++) {
-                               if (_steps [i] == target) {
-                                       if (i == _steps.Count - 1)
-                                               _steps.Add (step);
-                                       else
-                                               _steps.Insert (i + 1, step);
-                                       return;
-                               }
-                       }
-               }
-
-               public void RemoveStep (Type target)
-               {
-                       for (int i = 0; i < _steps.Count; i++) {
-                               if (_steps [i].GetType () != target)
-                                       continue;
-
-                               _steps.RemoveAt (i);
-                               break;
-                       }
-               }
-
-               public void Process (LinkContext context)
-               {
-                       while (_steps.Count > 0) {
-                               IStep step = (IStep) _steps [0];
-                               context.Annotations.Push (step);
-                               step.Process (context);
-                               context.Annotations.Pop ();
-                               _steps.Remove (step);
-                       }
-               }
-
-               public IStep [] GetSteps ()
-               {
-                       return (IStep []) _steps.ToArray (typeof (IStep));
-               }
-
-               public bool ContainsStep (Type type)
-               {
-                       foreach (IStep step in _steps)
-                               if (step.GetType () == type)
-                                       return true;
-
-                       return false;
-               }
-       }
-}
diff --git a/mcs/tools/linker/Mono.Linker/TypePreserve.cs b/mcs/tools/linker/Mono.Linker/TypePreserve.cs
deleted file mode 100644 (file)
index 08e7b96..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-//
-// TypePreserve.cs
-//
-// Author:
-//   Jb Evain (jb@nurv.fr)
-//
-// (C) 2007 Novell, Inc.
-//
-// 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.
-//
-
-namespace Mono.Linker {
-
-       public enum TypePreserve {
-               Nothing,
-               All,
-               Fields,
-               Methods,
-       }
-}
diff --git a/mcs/tools/linker/Mono.Linker/XApiReader.cs b/mcs/tools/linker/Mono.Linker/XApiReader.cs
deleted file mode 100644 (file)
index bb16e21..0000000
+++ /dev/null
@@ -1,383 +0,0 @@
-//
-// XApiReader.cs
-//
-// Author:
-//   Jb Evain (jbevain@novell.com)
-//
-// (C) 2007 Novell, Inc.
-//
-// 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;
-using System.Linq;
-using System.Text;
-using System.Xml.XPath;
-
-using Mono.Cecil;
-
-namespace Mono.Linker {
-
-       public class XApiReader {
-
-               static readonly string _name = "name";
-               static readonly string _ns = string.Empty;
-
-               LinkContext _context;
-               XPathDocument _document;
-               IXApiVisitor _visitor;
-
-               AssemblyDefinition _assembly;
-               string _namespace;
-               Stack _types = new Stack ();
-               StringBuilder _signature;
-
-               public XApiReader (XPathDocument document, IXApiVisitor visitor)
-               {
-                       _document = document;
-                       _visitor = visitor;
-               }
-
-               public void Process (LinkContext context)
-               {
-                       _context = context;
-                       ProcessAssemblies (_document.CreateNavigator ());
-               }
-
-               void OnAssembly (XPathNavigator nav)
-               {
-                       _assembly = GetAssembly (nav);
-
-                       _visitor.OnAssembly (nav, _assembly);
-
-                       ProcessAttributes (nav);
-                       ProcessNamespaces (nav);
-               }
-
-               AssemblyDefinition GetAssembly (XPathNavigator nav)
-               {
-                       AssemblyNameReference name = new AssemblyNameReference (
-                               GetName (nav),
-                               new Version (GetAttribute (nav, "version")));
-
-                       AssemblyDefinition assembly = _context.Resolve (name);
-                       ProcessReferences (assembly);
-                       return assembly;
-               }
-
-               void ProcessReferences (AssemblyDefinition assembly)
-               {
-                       foreach (AssemblyNameReference name in assembly.MainModule.AssemblyReferences)
-                               _context.Resolve (name);
-               }
-
-               void OnAttribute (XPathNavigator nav)
-               {
-                       _visitor.OnAttribute (nav);
-               }
-
-               void PushType (TypeDefinition type)
-               {
-                       _types.Push (type);
-               }
-
-               TypeDefinition PeekType ()
-               {
-                       return (TypeDefinition) _types.Peek ();
-               }
-
-               TypeDefinition PopType ()
-               {
-                       return (TypeDefinition) _types.Pop ();
-               }
-
-               void OnNamespace (XPathNavigator nav)
-               {
-                       _namespace = GetName (nav);
-
-                       ProcessClasses (nav);
-               }
-
-               void OnClass (XPathNavigator nav)
-               {
-                       string name = GetClassName (nav);
-
-                       TypeDefinition type = _assembly.MainModule.GetType (name);
-                       if (type == null)
-                               return;
-
-                       _visitor.OnClass (nav, type);
-
-                       PushType (type);
-
-                       ProcessAttributes (nav);
-                       ProcessInterfaces (nav);
-                       ProcessFields (nav);
-                       ProcessMethods (nav);
-                       ProcessConstructors (nav);
-                       ProcessProperties (nav);
-                       ProcessEvents (nav);
-                       ProcessClasses (nav);
-
-                       PopType ();
-               }
-
-               string GetClassName (XPathNavigator nav)
-               {
-                       if (IsNestedClass ())
-                               return PeekType ().FullName + "/" + GetName (nav);
-
-                       return _namespace + "." + GetName (nav);
-               }
-
-               bool IsNestedClass ()
-               {
-                       return _types.Count > 0;
-               }
-
-               void OnField (XPathNavigator nav)
-               {
-                       TypeDefinition declaring = PeekType ();
-
-                       FieldDefinition field = declaring.Fields.FirstOrDefault (f => f.Name == GetName (nav));
-                       if (field != null)
-                               _visitor.OnField (nav, field);
-
-                       ProcessAttributes (nav);
-               }
-
-               void OnInterface (XPathNavigator nav)
-               {
-                       string name = GetName (nav);
-
-                       TypeDefinition type = _context.GetType (GetTypeName (name));
-                       if (type != null)
-                               _visitor.OnInterface (nav, type);
-               }
-
-               void OnMethod (XPathNavigator nav)
-               {
-                       InitMethodSignature (nav);
-
-                       ProcessParameters (nav);
-
-                       string signature = GetMethodSignature ();
-
-                       MethodDefinition method = GetMethod (signature);
-                       if (method != null)
-                               _visitor.OnMethod (nav, method);
-
-                       ProcessAttributes (nav);
-               }
-
-               MethodDefinition GetMethod (string signature)
-               {
-                       return GetMethod (PeekType ().Methods, signature);
-               }
-
-               static MethodDefinition GetMethod (ICollection methods, string signature)
-               {
-                       foreach (MethodDefinition method in methods)
-                               if (signature == GetSignature (method))
-                                       return method;
-
-                       return null;
-               }
-
-               static string GetSignature (MethodDefinition method)
-               {
-                       return method.ToString ().Replace ("<", "[").Replace (">", "]");
-               }
-
-               string GetMethodSignature ()
-               {
-                       _signature.Append (")");
-                       return _signature.ToString ();
-               }
-
-               void InitMethodSignature (XPathNavigator nav)
-               {
-                       _signature = new StringBuilder ();
-
-                       string returntype = GetAttribute (nav, "returntype");
-                       if (returntype == null || returntype.Length == 0)
-                               returntype = "System.Void";
-
-                       _signature.Append (NormalizeTypeName (returntype));
-                       _signature.Append (" ");
-                       _signature.Append (PeekType ().FullName);
-                       _signature.Append ("::");
-
-                       string name = GetName (nav);
-                       _signature.Append (GetMethodName (name));
-
-                       _signature.Append ("(");
-               }
-
-               static string GetMethodName (string name)
-               {
-                       return GetStringBefore (name, "(");
-               }
-
-               static string NormalizeTypeName (string name)
-               {
-                       return name.Replace ("+", "/").Replace ("<", "[").Replace (">", "]");
-               }
-
-               static string GetTypeName (string name)
-               {
-                       return GetStringBefore (NormalizeTypeName (name), "[");
-               }
-
-               static string GetStringBefore (string str, string marker)
-               {
-                       int pos = str.IndexOf (marker);
-                       if (pos == -1)
-                               return str;
-
-                       return str.Substring (0, pos);
-               }
-
-               void OnParameter (XPathNavigator nav)
-               {
-                       string type = GetAttribute (nav, "type");
-                       int pos = int.Parse (GetAttribute (nav, "position"));
-
-                       if (pos > 0)
-                               _signature.Append (",");
-                       _signature.Append (NormalizeTypeName (type));
-               }
-
-               void OnConstructor (XPathNavigator nav)
-               {
-                       InitMethodSignature (nav);
-
-                       ProcessParameters (nav);
-
-                       string signature = GetMethodSignature ();
-
-                       MethodDefinition ctor = GetMethod (signature);
-                       if (ctor != null)
-                               _visitor.OnConstructor (nav, ctor);
-
-                       ProcessAttributes (nav);
-               }
-
-               void OnProperty (XPathNavigator nav)
-               {
-                       string name = GetName (nav);
-                       TypeDefinition type = PeekType ();
-
-                       var property = type.Properties.FirstOrDefault (p => p.Name == name);
-                       if (property != null)
-                               _visitor.OnProperty (nav, property);
-
-                       ProcessAttributes (nav);
-                       ProcessMethods (nav);
-               }
-
-               void OnEvent (XPathNavigator nav)
-               {
-                       string name = GetName (nav);
-                       TypeDefinition type = PeekType ();
-
-                       EventDefinition evt = type.Events.FirstOrDefault (e => e.Name == name);
-                       if (evt != null)
-                               _visitor.OnEvent (nav, evt);
-
-                       ProcessAttributes (nav);
-               }
-
-               void ProcessAssemblies (XPathNavigator nav)
-               {
-                       ProcessChildren (nav, "assemblies//assembly", new OnChildren (OnAssembly));
-               }
-
-               void ProcessAttributes (XPathNavigator nav)
-               {
-                       ProcessChildren (nav, "attributes//attribute", new OnChildren (OnAttribute));
-               }
-
-               void ProcessNamespaces (XPathNavigator nav)
-               {
-                       ProcessChildren (nav, "namespaces//namespace", new OnChildren (OnNamespace));
-               }
-
-               void ProcessClasses (XPathNavigator nav)
-               {
-                       ProcessChildren (nav, "classes//class", new OnChildren (OnClass));
-               }
-
-               void ProcessInterfaces (XPathNavigator nav)
-               {
-                       ProcessChildren (nav, "intefaces//interface", new OnChildren (OnInterface));
-               }
-
-               void ProcessFields (XPathNavigator nav)
-               {
-                       ProcessChildren (nav, "fields//field", new OnChildren (OnField));
-               }
-
-               void ProcessMethods (XPathNavigator nav)
-               {
-                       ProcessChildren (nav, "methods//method", new OnChildren (OnMethod));
-               }
-
-               void ProcessConstructors (XPathNavigator nav)
-               {
-                       ProcessChildren (nav, "constructors//constructor", new OnChildren (OnConstructor));
-               }
-
-               void ProcessParameters (XPathNavigator nav)
-               {
-                       ProcessChildren (nav, "parameters//parameter", new OnChildren (OnParameter));
-               }
-
-               void ProcessProperties (XPathNavigator nav)
-               {
-                       ProcessChildren (nav, "properties//property", new OnChildren (OnProperty));
-               }
-
-               void ProcessEvents (XPathNavigator nav)
-               {
-                       ProcessChildren (nav, "events//event", new OnChildren (OnEvent));
-               }
-
-               static void ProcessChildren (XPathNavigator nav, string children, OnChildren action)
-               {
-                       XPathNodeIterator iterator = nav.Select (children);
-                       while (iterator.MoveNext ())
-                               action (iterator.Current);
-               }
-
-               delegate void OnChildren (XPathNavigator nav);
-
-               static string GetName (XPathNavigator nav)
-               {
-                       return GetAttribute (nav, _name);
-               }
-
-               static string GetAttribute (XPathNavigator nav, string attribute)
-               {
-                       return nav.GetAttribute (attribute, _ns);
-               }
-       }
-}
diff --git a/mcs/tools/linker/README b/mcs/tools/linker/README
deleted file mode 100644 (file)
index 749b775..0000000
+++ /dev/null
@@ -1,304 +0,0 @@
-monolinker
-====
-
-monolinker is the Mono CIL Linker.
-
-The linker is a tool one can use to only ship the minimal possible set of
-functions that a set of programs might require to run as opposed to the full
-libraries.
-
-* How does the linker work?
-
-The linker analyses the intermediate code (CIL) produced by every compiler
-targeting the Mono platform like mcs, gmcs, vbnc, booc or others. It will walk
-through all the code that it is given to it, and basically, perform a mark and
-sweep operations on all the code that it is referenced, to only keep what is
-necessary for the source program to run.
-
-* Usage
-
-1) Linking from a source assembly
-
-The command:
-
-monolinker -a Program.exe
-
-will use the assembly Program.exe as a source. That means that the linker will
-walk through all the methods of Program.exe to generate only what is necessary
-for this assembly to run.
-
-2) Linking from an xml descriptor
-
-The command:
-
-monolinker -x desc.xml
-
-will use the XML descriptor as a source. That means that the linker will
-use this file to decide what to link in a set of assemblies. The format of the
-descriptors is described further on in this document.
-
-3) Linking from an api info file
-
-The command:
-
-monolinker -i assembly.info
-
-will use a file produced by mono-api-info as a source. The linker will use
-this file to link only what is necessary to match the public API defined in
-the info file.
-
-4) Actions on the assemblies
-
-You can specify what the linker should do exactly per assembly.
-
-The linker can do 3 things:
-
-       - skip them, and do nothing with them,
-       - copy them to the output directory,
-       - link them, to reduce their size.
-
-You can specify an action per assembly like this:
-
-monolinker -p link Foo
-
-or
-
-monolinker -p skip System.Windows.Forms
-
-Or you can specify what to do for the core assemblies.
-
-Core assemblies are the assemblies that belongs to the base class library,
-like mscorlib.dll, System.dll or System.Windows.Forms.dll.
-
-You can specify what action to do on the core assemblies with the option:
-
--c skip|copy|link
-
-5) The output directory
-
-By default, the linker will create an `output' directory in the current
-directory where it will emit the linked files, to avoid erasing source
-assemblies. You can specify the output directory with the option:
-
--o output_directory
-
-If you specify the directory `.', please ensure that you won't write over
-important assemblies of yours.
-
-* Syntax of a xml descriptor
-
-Here is an example that shows all the possibilities of this format:
-
----
-<linker>
-       <assembly fullname="Library">
-               <type fullname="Foo" />
-               <type fullname="Bar" preserve="nothing" required="false" />
-               <type fullname="Baz" preserve="fields" required="false" />
-               <type fullname="Gazonk">
-                       <method signature="System.Void .ctor(System.String)" />
-                       <field signature="System.String _blah" />
-               </type>
-       </assembly>
-</linker>
----
-
-In this example, the linker will link the types Foo, Bar, Baz and Gazonk.
-
-The fullname attribute specifies the fullname of the type in the format
-specified by ECMA-335. This is in Mono and certain cases not the same
-as the one reported by Type.FullName (nested classes e.g.).
-
-The preserve attribute ensures that all the fields of the type Baz will be
-always be linked, not matter if they are used or not, but that neither the
-fields or the methods of Bar will be linked if they are not used. Not
-specifying a preserve attribute implies that we are preserving everything in
-the specified type.
-
-The required attribute specifies that if the type is not marked, during the
-mark operation, it will not be linked.
-
-The type Gazonk will be linked, as well as its constructor taking a string as a
-parameter, and it's _blah field.
-
-You can have multiple assembly nodes.
-
-6) The i18n Assemblies
-
-Mono have a few assemblies which contains everything region specific:
-
-    I18N.CJK.dll
-    I18N.MidEast.dll
-    I18N.Other.dll
-    I18N.Rare.dll
-    I18N.West.dll
-
-By default, they will all be copied to the output directory. But you can
-specify which one you want using the command:
-
-monolinker -l choice
-
-Where choice can either be: none, all, cjk, mideast, other, rare or west. You can
-combine the values with a comma.
-
-Example:
-
-monolinker -a assembly -l mideast,cjk
-
-7) Specifying directories where the linker should look for assemblies
-
-By default, the linker will first look for assemblies in the directories `.'
-and `bin'. You can specify
-
-Example:
-
-monoliner -d ../../libs -a program.exe
-
-8) Adding custom steps to the linker.
-
-You can write custom steps for the linker and tell the linker to use them.
-Let's take a simple example:
-
-using System;
-
-using Mono.Linker;
-using Mono.Linker.Steps;
-
-namespace Foo {
-
-       public class FooStep : IStep {
-
-               public void Process (LinkContext context)
-               {
-                       foreach (IStep step in context.Pipeline.GetSteps ()) {
-                               Console.WriteLine (step.GetType ().Name);
-                       }
-               }
-       }
-}
-
-
-That is compiled against the linker to a Foo.dll assembly.
-
-You can ask the linker to add it at the end of the pipeline:
-
-monolinker -s Foo.FooStep,Foo -a program.exe
-
-Or you can ask the linker to add it after a specific step:
-
-monolinker -s MarkStep:Foo.FooStep,Foo -a program.exe
-
-Or before a specific step:
-
-monolinker -s Foo.FooStep,Foo:MarkStep
-
-* Inside the linker
-
-The linker is a quite small piece of code, and it pretty simple to address.
-Its only dependency is Mono.Cecil, that is used to read, modify and write back
-the assemblies.
-
-Everything is located in the namespace Mono.Linker, or in sub namespaces.
-Being a command line utility, its entry point function is in the class Driver.
-
-This class is in charge of analyzing the command line, and to instantiate two
-important objects, a LinkContext, and a Pipeline.
-
-The LinkContext contains all the informations that will be used during the
-linking process, such as the assemblies involved, the output directory and
-probably other useful stuff.
-
-The Pipeline is simply a queue of actions (steps), to be applied to the current
-context. The whole process of linking is split into those differents steps
-that are all located in the Mono.Linker.Steps namespace.
-
-Here are the current steps that are implemented, in the order they are used:
-
-1) ResolveFromAssembly or ResolveFromXml
-
-Those steps are used to initialize the context, and pre-mark the root code
-that will be used as a source for the linker.
-
-Resolving from an assembly or resolving from a xml descriptor is a decision
-taken in the command line parsing.
-
-2) LoadReferences
-
-This step will load all the references of all the assemblies involved in the
-current context.
-
-3) Blacklist
-
-This step is used if and only if you have specified that the core should be
-linked. It will load a bunch of resources from the assemblies, that are
-actually a few XML descriptors, that will ensure that some types and methods
-that are used from inside the runtime are properly linked and not removed.
-
-It is doing so by inserting a ResolveFromXml step per blacklist in the
-pipeline.
-
-4) Mark
-
-This is the most complex step. The linker will get from the context the list
-of types, fields and methods that have been pre-marked in the resolve steps,
-and walk through all of them. For every method, it will analyse the CIL stream,
-to find references to other fields, types, or methods.
-
-When it encounters such a reference, it will resolve the original definition of
-this reference, and add this to the queue of items to be processed. For
-instance, if have in a source assembly a call to Console.WriteLine, the linker
-will resolve the appropriate method WriteLine in the Console type from the
-mscorlib assembly, and add it to the queue. When this WriteLine method will be
-dequeued, and processed, the linker will go through everything that is used in
-it, and add it to the queue, if they have not been processed already.
-
-To know if something have been marked to be linked, or processed, the linker
-is using a functionality of Cecil called annotations. Almost everything in
-Cecil can be annotated. Concretely, it means that almost everything own an
-Hashtable in which you can add what you want, using the keys and the values you
-want.
-
-So the linker will annotate assemblies, types, methods and fields to know
-what should be linked or not, and what have been processed, and how it should
-process them.
-
-This is really useful as we don't have to recreate a full hierarchy of classes
-to encapsulate the different Cecil types to add the few informations we want.
-
-5) Sweep
-
-This simple step will walk through all the elements of an assembly, and based
-on their annotations, remove them or keep them.
-
-6) Clean
-
-This step will clean parts of the assemblies, like properties. If a proprety
-used to have a getter and a setter, and that after the mark & sweep steps,
-only the getter is linked, it will update the property to reflect that.
-
-There is a few things to keep clean like properties has we've seen, events,
-nested classes, and probably a few others.
-
-7) Output
-
-For each assembly in the context, this step will act on the action associated
-to the assembly. If the assembly is marked as skip, it won't do anything,
-if it's marked as copy, it will copy the assembly to the output directory,
-and if it's link, it will save the modified assembly to the output directory.
-
-* Reporting a bug
-
-If you face a bug in the linker, please report it to:
-
-http://bugzilla.ximian.com
-
-Product: Mono tools, Component: linker.
-
-* Mailing lists
-
-You can ask questions about the linker of the cecil Google Group:
-
-http://groups.google.com/group/mono-cecil
-
---
-Jb Evain <jbevain@novell.com>
diff --git a/mcs/tools/linker/Tests/Libs/nunit-console-runner.dll b/mcs/tools/linker/Tests/Libs/nunit-console-runner.dll
deleted file mode 100755 (executable)
index f112e23..0000000
Binary files a/mcs/tools/linker/Tests/Libs/nunit-console-runner.dll and /dev/null differ
diff --git a/mcs/tools/linker/Tests/Libs/nunit-console.exe b/mcs/tools/linker/Tests/Libs/nunit-console.exe
deleted file mode 100755 (executable)
index 32ca802..0000000
Binary files a/mcs/tools/linker/Tests/Libs/nunit-console.exe and /dev/null differ
diff --git a/mcs/tools/linker/Tests/Libs/nunit-console.exe.config b/mcs/tools/linker/Tests/Libs/nunit-console.exe.config
deleted file mode 100755 (executable)
index 4926127..0000000
+++ /dev/null
@@ -1,97 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<configuration>
-    <!--
-     Application settings for NUnit-console.exe. Do NOT put settings
-        for use by your tests here.
-       -->
-  <appSettings>
-
-       <!--
-        Specify the location to be used by .NET for the cache
-       -->
-    <add key="shadowfiles.path" value="%temp%\nunit20\ShadowCopyCache" />
-
-  </appSettings>
-
-    <!--
-     The startup section may be used to specify the runtime versions
-     supported in the order that they will be used if more than one
-     is present. As supplied, this section is commented out, which
-     causes nunit-console to use the version of the framework with
-     which it was built.
-
-        Since .NET 1.0 does not recognize the <supportedRuntime> elements,
-        a <requiredRuntime> element is used in case it is the only version
-        of the framework that is installed.
-    -->
-    <!--
-  <startup>
-         <supportedRuntime version="v2.0.50727" />
-         <supportedRuntime version="v2.0.50215" />
-         <supportedRuntime version="v2.0.40607" />
-         <supportedRuntime version="v1.1.4322" />
-         <supportedRuntime version="v1.0.3705" />
-
-         <requiredRuntime version="v1.0.3705" />
-  </startup>
-  -->
-
-   <!--
-    The following <runtime> section allows running nunit under
-    .NET 1.0 by redirecting assemblies. The appliesTo attribute
-    causes the section to be ignored except under .NET 1.0version 1
-    on a machine with only the .NET version 1.0 runtime installed.
-    If application and its tests were built for .NET 1.1 you will
-    also need to redirect system assemblies in the test config file.
-   -->
-
- <runtime>
-
-    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"
-                       appliesTo="v1.0.3705">
-
-      <dependentAssembly>
-        <assemblyIdentity name="System"
-                          publicKeyToken="b77a5c561934e089"
-                          culture="neutral"/>
-        <bindingRedirect  oldVersion="1.0.5000.0"
-                          newVersion="1.0.3300.0"/>
-      </dependentAssembly>
-
-      <dependentAssembly>
-        <assemblyIdentity name="System.Data"
-                          publicKeyToken="b77a5c561934e089"
-                          culture="neutral"/>
-        <bindingRedirect  oldVersion="1.0.5000.0"
-                          newVersion="1.0.3300.0"/>
-      </dependentAssembly>
-
-      <dependentAssembly>
-        <assemblyIdentity name="System.Drawing"
-                          publicKeyToken="b03f5f7f11d50a3a"
-                          culture="neutral"/>
-        <bindingRedirect  oldVersion="1.0.5000.0"
-                          newVersion="1.0.3300.0"/>
-      </dependentAssembly>
-
-      <dependentAssembly>
-        <assemblyIdentity name="System.Windows.Forms"
-                          publicKeyToken="b77a5c561934e089"
-                          culture="neutral"/>
-        <bindingRedirect  oldVersion="1.0.5000.0"
-                          newVersion="1.0.3300.0"/>
-      </dependentAssembly>
-
-      <dependentAssembly>
-        <assemblyIdentity name="System.Xml"
-                          publicKeyToken="b77a5c561934e089"
-                          culture="neutral"/>
-        <bindingRedirect  oldVersion="1.0.5000.0"
-                          newVersion="1.0.3300.0"/>
-      </dependentAssembly>
-
-    </assemblyBinding>
-
-  </runtime>
-
-</configuration>
\ No newline at end of file
diff --git a/mcs/tools/linker/Tests/Libs/nunit.core.dll b/mcs/tools/linker/Tests/Libs/nunit.core.dll
deleted file mode 100755 (executable)
index df7f905..0000000
Binary files a/mcs/tools/linker/Tests/Libs/nunit.core.dll and /dev/null differ
diff --git a/mcs/tools/linker/Tests/Libs/nunit.framework.dll b/mcs/tools/linker/Tests/Libs/nunit.framework.dll
deleted file mode 100755 (executable)
index 5316687..0000000
Binary files a/mcs/tools/linker/Tests/Libs/nunit.framework.dll and /dev/null differ
diff --git a/mcs/tools/linker/Tests/Libs/nunit.util.dll b/mcs/tools/linker/Tests/Libs/nunit.util.dll
deleted file mode 100755 (executable)
index e9e479e..0000000
Binary files a/mcs/tools/linker/Tests/Libs/nunit.util.dll and /dev/null differ
diff --git a/mcs/tools/linker/Tests/Makefile b/mcs/tools/linker/Tests/Makefile
deleted file mode 100644 (file)
index 8b87256..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-MCS = mcs
-
-all: Mono.Linker.Tests.dll
-
-Mono.Cecil.dll:
-       cp ../Mono.Cecil.dll .
-
-monolinker.exe:
-       cp ../monolinker.exe .
-
-Mono.Linker.Tests.dll.sources:
-       find Mono.Linker.Tests -name "*.cs" > Mono.Linker.Tests.dll.sources
-
-Mono.Linker.Tests.dll: Mono.Cecil.dll monolinker.exe Mono.Linker.Tests.dll.sources
-       $(MCS) /target:library /out:Mono.Linker.Tests.dll /r:nunit.framework.dll /r:Mono.Cecil.dll /r:monolinker.exe @Mono.Linker.Tests.dll.sources
-
-clean:
-       rm -rf Mono.Cecil.dll monolinker.exe Mono.Linker.Tests.dll.sources Mono.Linker.Tests.dll
-
-run-test: all
-       nunit-console Mono.Linker.Tests.dll
diff --git a/mcs/tools/linker/Tests/Mono.Linker.Tests.csproj b/mcs/tools/linker/Tests/Mono.Linker.Tests.csproj
deleted file mode 100644 (file)
index a83021f..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <PropertyGroup>
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
-    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <ProductVersion>8.0.50727</ProductVersion>
-    <SchemaVersion>2.0</SchemaVersion>
-    <ProjectGuid>{400A1561-B6B6-482D-9E4C-3DDAEDE5BD07}</ProjectGuid>
-    <OutputType>Library</OutputType>
-    <AppDesignerFolder>Properties</AppDesignerFolder>
-    <RootNamespace>Mono.Linker.Tests</RootNamespace>
-    <AssemblyName>Mono.Linker.Tests</AssemblyName>
-    <StartupObject>
-    </StartupObject>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
-    <DebugSymbols>true</DebugSymbols>
-    <DebugType>full</DebugType>
-    <Optimize>false</Optimize>
-    <OutputPath>bin\Debug\</OutputPath>
-    <DefineConstants>DEBUG;TRACE</DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
-    <DebugType>pdbonly</DebugType>
-    <Optimize>true</Optimize>
-    <OutputPath>bin\Release\</OutputPath>
-    <DefineConstants>TRACE</DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-  </PropertyGroup>
-  <Import Project="$(MSBuildBinPath)\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.
-  <Target Name="BeforeBuild">
-  </Target>
-  <Target Name="AfterBuild">
-  </Target>
-  -->
-  <ItemGroup>
-    <Reference Include="nunit.framework, Version=2.2.8.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
-      <SpecificVersion>False</SpecificVersion>
-      <HintPath>Libs\nunit.framework.dll</HintPath>
-    </Reference>
-    <Reference Include="System" />
-    <Reference Include="System.Xml" />
-  </ItemGroup>
-  <ItemGroup>
-    <ProjectReference Include="..\..\..\class\Mono.Cecil\Mono.Cecil.csproj">
-      <Project>{D8F63DFF-5230-43E4-9AB2-DA6E721A1FAE}</Project>
-      <Name>Mono.Cecil</Name>
-    </ProjectReference>
-    <ProjectReference Include="..\Mono.Linker.csproj">
-      <Project>{DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}</Project>
-      <Name>Mono.Linker</Name>
-    </ProjectReference>
-  </ItemGroup>
-  <ItemGroup>
-    <Compile Include="Mono.Linker.Tests\AbstractLinkingTestFixture.cs" />
-    <Compile Include="Mono.Linker.Tests\AbstractTestFixture.cs" />
-    <Compile Include="Mono.Linker.Tests\AssemblyLinkingTestFixture.cs" />
-    <Compile Include="Mono.Linker.Tests\AssemblyInfo.cs" />
-    <Compile Include="Mono.Linker.Tests\IntegrationTestFixture.cs" />
-    <Compile Include="Mono.Linker.Tests\XmlLinkingTestFixture.cs" />
-  </ItemGroup>
-  <ItemGroup>
-    <Folder Include="Properties\" />
-  </ItemGroup>
-</Project>
\ No newline at end of file
diff --git a/mcs/tools/linker/Tests/Mono.Linker.Tests/AbstractLinkingTestFixture.cs b/mcs/tools/linker/Tests/Mono.Linker.Tests/AbstractLinkingTestFixture.cs
deleted file mode 100644 (file)
index 58dc1a5..0000000
+++ /dev/null
@@ -1,163 +0,0 @@
-//
-// AbstractLinkingTestFixture.cs
-//
-// Author:
-//   Jb Evain (jbevain@gmail.com)
-//
-// (C) 2006 Jb Evain
-//
-// 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.IO;
-using Mono.Cecil;
-using Mono.Linker.Steps;
-using NUnit.Framework;
-
-namespace Mono.Linker.Tests {
-
-       public abstract class AbstractLinkingTestFixture : AbstractTestFixture {
-
-               [SetUp]
-               public override void SetUp ()
-               {
-                       base.SetUp ();
-
-                       TestCasesRoot = "Linker";
-               }
-
-               [TearDown]
-               public override void TearDown ()
-               {
-                       base.TearDown ();
-
-                       string output = GetOutputPath ();
-                       if (Directory.Exists (output))
-                               Directory.Delete (output, true);
-               }
-
-               protected override Pipeline GetPipeline ()
-               {
-                       Pipeline p = new Pipeline ();
-                       p.AppendStep (new LoadReferencesStep ());
-                       p.AppendStep (new BlacklistStep ());
-                       p.AppendStep (new TypeMapStep ());
-                       p.AppendStep (new MarkStep ());
-                       p.AppendStep (new SweepStep ());
-                       p.AppendStep (new CleanStep ());
-                       p.AppendStep (new OutputStep ());
-                       return p;
-               }
-
-               protected override void RunTest (string testCase)
-               {
-                       base.RunTest (testCase);
-
-                       Prepare ();
-               }
-
-               void Prepare ()
-               {
-                       Context = GetContext ();
-                       string output = GetOutputPath ();
-                       if (Directory.Exists (output))
-                               Directory.Delete (output, true);
-                       Directory.CreateDirectory (output);
-               }
-
-               protected override void Run ()
-               {
-                       base.Run ();
-                       Compare ();
-               }
-
-               void Compare ()
-               {
-                       foreach (AssemblyDefinition assembly in Context.GetAssemblies ()) {
-                               if (Annotations.GetAction (assembly) != AssemblyAction.Link)
-                                       continue;
-
-                               string fileName = GetAssemblyFileName (assembly);
-
-                               CompareAssemblies (
-                                       AssemblyFactory.GetAssembly (
-                                               Path.Combine (GetTestCasePath (), fileName)),
-                                       AssemblyFactory.GetAssembly (
-                                               Path.Combine (GetOutputPath (), fileName)));
-                       }
-               }
-
-               static void CompareAssemblies (AssemblyDefinition original, AssemblyDefinition linked)
-               {
-                       foreach (TypeDefinition originalType in original.MainModule.Types) {
-                               TypeDefinition linkedType = linked.MainModule.Types [originalType.FullName];
-                               if (NotLinked (originalType)) {
-                                       Assert.IsNull (linkedType, string.Format ("Type `{0}' should not have been linked", originalType));
-                                       continue;
-                               }
-
-                               Assert.IsNotNull (linkedType, string.Format ("Type `{0}' should have been linked", originalType));
-                               CompareTypes (originalType, linkedType);
-                       }
-               }
-
-               static void CompareTypes (TypeDefinition type, TypeDefinition linkedType)
-               {
-                       foreach (FieldDefinition originalField in type.Fields) {
-                               FieldDefinition linkedField = linkedType.Fields.GetField (originalField.Name);// TODO: also get with the type!
-                               if (NotLinked (originalField)) {
-                                       Assert.IsNull (linkedField, string.Format ("Field `{0}' should not have been linked", originalField));
-                                       continue;
-                               }
-
-                               Assert.IsNotNull (linkedField, string.Format ("Field `{0}' should have been linked", originalField));
-                       }
-
-                       foreach (MethodDefinition originalCtor in type.Constructors) {
-                               MethodDefinition linkedCtor = linkedType.Constructors.GetConstructor (originalCtor.IsStatic, originalCtor.Parameters);
-                               if (NotLinked (originalCtor)) {
-                                       Assert.IsNull (linkedCtor, string.Format ("Constructor `{0}' should not have been linked", originalCtor));
-                                       continue;
-                               }
-
-                               Assert.IsNotNull (linkedCtor, string.Format ("Constructor `{0}' should have been linked", originalCtor));
-                       }
-
-                       foreach (MethodDefinition originalMethod in type.Methods) {
-                               MethodDefinition linkedMethod = linkedType.Methods.GetMethod (originalMethod.Name, originalMethod.Parameters);
-                               if (NotLinked (originalMethod)) {
-                                       Assert.IsNull (linkedMethod, string.Format ("Method `{0}' should not have been linked", originalMethod));
-                                       continue;
-                               }
-
-                               Assert.IsNotNull (linkedMethod, string.Format ("Method `{0}' should have been linked", originalMethod));
-                       }
-               }
-
-               static bool NotLinked(ICustomAttributeProvider provider)
-               {
-                       foreach (CustomAttribute ca in provider.CustomAttributes)
-                               if (ca.Constructor.DeclaringType.Name == "NotLinkedAttribute")
-                                       return true;
-
-                       return false;
-               }
-       }
-}
diff --git a/mcs/tools/linker/Tests/Mono.Linker.Tests/AbstractTestFixture.cs b/mcs/tools/linker/Tests/Mono.Linker.Tests/AbstractTestFixture.cs
deleted file mode 100644 (file)
index f4ac2d5..0000000
+++ /dev/null
@@ -1,134 +0,0 @@
-//
-// AbstractTestFixture.cs
-//
-// Author:
-//   Jb Evain (jbevain@gmail.com)
-//
-// (C) 2006 Jb Evain
-//
-// 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.
-//
-
-namespace Mono.Linker.Tests {
-
-       using System;
-       using System.IO;
-
-       using Mono.Cecil;
-
-       using NUnit.Framework;
-
-       public abstract class AbstractTestFixture {
-
-               string _testCasesRoot;
-               string _testCase;
-               LinkContext _context;
-               Pipeline _pipeline;
-
-               protected LinkContext Context {
-                       get { return _context; }
-                       set { _context = value; }
-               }
-
-               protected Pipeline Pipeline {
-                       get { return _pipeline; }
-                       set { _pipeline = value; }
-               }
-
-               public string TestCasesRoot {
-                       get { return _testCasesRoot; }
-                       set { _testCasesRoot = value; }
-               }
-
-               public string TestCase {
-                       get { return _testCase; }
-                       set { _testCase = value; }
-               }
-
-               [SetUp]
-               public virtual void SetUp ()
-               {
-                       _pipeline = GetPipeline ();
-               }
-
-               [TearDown]
-               public virtual void TearDown ()
-               {
-               }
-
-               protected virtual Pipeline GetPipeline ()
-               {
-                       return new Pipeline ();
-               }
-
-               protected virtual LinkContext GetContext ()
-               {
-                       LinkContext context = new LinkContext (_pipeline);
-                       context.OutputDirectory = GetOutputPath ();
-                       context.CoreAction = AssemblyAction.Copy;
-                       return context;
-               }
-
-               protected string GetOutputPath ()
-               {
-                       return Path.Combine (
-                               Path.GetTempPath (),
-                               _testCase);
-               }
-
-               protected string GetTestCasePath ()
-               {
-                       return Path.Combine (
-                               Path.Combine (
-#if DEBUG
-                                       Path.Combine (Environment.CurrentDirectory,
-                                               Path.Combine ("..", "..")),
-#else
-                                       Environment.CurrentDirectory,
-#endif
-                                       "TestCases"),
-                               Path.Combine (
-                                       _testCasesRoot,
-                                       _testCase));
-               }
-
-               protected virtual void RunTest (string testCase)
-               {
-                       _testCase = testCase;
-                       _context = GetContext ();
-               }
-
-               protected virtual void Run ()
-               {
-                       string cd = Environment.CurrentDirectory;
-                       Environment.CurrentDirectory = GetTestCasePath ();
-                       try {
-                               _pipeline.Process (_context);
-                       } finally {
-                               Environment.CurrentDirectory = cd;
-                       }
-               }
-
-               protected static string GetAssemblyFileName (AssemblyDefinition asm)
-               {
-                       return asm.Name.Name + (asm.Kind == AssemblyKind.Dll ? ".dll" : ".exe");
-               }
-       }
-}
diff --git a/mcs/tools/linker/Tests/Mono.Linker.Tests/AssemblyInfo.cs b/mcs/tools/linker/Tests/Mono.Linker.Tests/AssemblyInfo.cs
deleted file mode 100644 (file)
index 0c169fd..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-//
-// AssemblyInfo.cs
-//
-// Author:
-//   Jb Evain (jbevain@gmail.com)
-//
-// (C) 2006 Jb Evain
-//
-// 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.Reflection;
-using System.Runtime.InteropServices;
-
-[assembly: AssemblyTitle ("Mono.Linker.Tests")]
-[assembly: AssemblyDescription ("NUnit tests for Mono's CIL Linker")]
-[assembly: AssemblyConfiguration ("")]
-[assembly: AssemblyProduct ("")]
-[assembly: AssemblyCopyright ("(C) 2006, Jb Evain")]
-[assembly: AssemblyCulture ("")]
-
-[assembly: CLSCompliant (false)]
-[assembly: ComVisible (false)]
-
diff --git a/mcs/tools/linker/Tests/Mono.Linker.Tests/AssemblyLinkingTestFixture.cs b/mcs/tools/linker/Tests/Mono.Linker.Tests/AssemblyLinkingTestFixture.cs
deleted file mode 100644 (file)
index 4810cd1..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-//
-// AssemblyLinkingTestFixture.cs
-//
-// Author:
-//   Jb Evain (jbevain@gmail.com)
-//
-// (C) 2006 Jb Evain
-//
-// 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.IO;
-
-using Mono.Linker.Steps;
-using NUnit.Framework;
-
-namespace Mono.Linker.Tests {
-
-       [TestFixture]
-       public class AssemblyLinkingTestFixture : AbstractLinkingTestFixture {
-
-               [Test]
-               public void TestSimple ()
-               {
-                       RunTest ("Simple");
-               }
-
-               [Test]
-               public void TestVirtualCall ()
-               {
-                       RunTest ("VirtualCall");
-               }
-
-               [Test]
-               public void TestMultipleReferences ()
-               {
-                       RunTest ("MultipleReferences");
-               }
-
-               protected override void RunTest (string testCase)
-               {
-                       base.RunTest (testCase);
-                       Pipeline.PrependStep (
-                               new ResolveFromAssemblyStep (
-                                       Path.Combine (GetTestCasePath (), "Program.exe")));
-
-                       Run ();
-               }
-       }
-}
diff --git a/mcs/tools/linker/Tests/Mono.Linker.Tests/IntegrationTestFixture.cs b/mcs/tools/linker/Tests/Mono.Linker.Tests/IntegrationTestFixture.cs
deleted file mode 100644 (file)
index f455f65..0000000
+++ /dev/null
@@ -1,123 +0,0 @@
-//
-// IntegrationTestFixture.cs
-//
-// Author:
-//   Jb Evain (jbevain@novell.com)
-//
-// (C) 2007 Novell, Inc.
-//
-// 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.Diagnostics;
-using System.IO;
-using Mono.Linker.Steps;
-using NUnit.Framework;
-
-namespace Mono.Linker.Tests {
-
-       [TestFixture]
-       public class IntegrationTestFixture : AbstractTestFixture {
-
-               [SetUp]
-               public override void SetUp ()
-               {
-                       base.SetUp ();
-
-                       TestCasesRoot = "Integration";
-               }
-
-               [Test]
-               public void TestHelloWorld ()
-               {
-                       RunTest ("HelloWorld");
-               }
-
-               [Test]
-               public void TestCrypto ()
-               {
-                       RunTest ("Crypto");
-               }
-
-               protected override LinkContext GetContext()
-               {
-                       LinkContext context = base.GetContext ();
-                       context.CoreAction = AssemblyAction.Link;
-                       return context;
-               }
-
-               protected override Pipeline GetPipeline ()
-               {
-                       Pipeline p = new Pipeline ();
-                       p.AppendStep (new LoadReferencesStep ());
-                       p.AppendStep (new BlacklistStep ());
-                       p.AppendStep (new TypeMapStep ());
-                       p.AppendStep (new MarkStep ());
-                       p.AppendStep (new SweepStep ());
-                       p.AppendStep (new CleanStep ());
-                       p.AppendStep (new OutputStep ());
-                       return p;
-               }
-
-               protected override void RunTest (string testCase)
-               {
-                       if (!OnMono ())
-                               Assert.Ignore ("Integration tests are only runnable on Mono");
-
-                       base.RunTest (testCase);
-                       string test = Path.Combine (GetTestCasePath (), "Test.exe");
-
-                       string original = Execute (GetTestCasePath (), "Test.exe");
-
-                       Pipeline.PrependStep (
-                               new ResolveFromAssemblyStep (
-                                       test));
-
-                       Run ();
-
-                       string linked = Execute (Context.OutputDirectory, "Test.exe");
-
-                       Assert.AreEqual (original, linked);
-               }
-
-               static bool OnMono ()
-               {
-                       return Type.GetType ("System.MonoType") != null;
-               }
-
-               static string Execute (string directory, string file)
-               {
-                       Process p = new Process ();
-                       p.StartInfo.EnvironmentVariables ["MONO_PATH"] = directory;
-                       p.StartInfo.CreateNoWindow = true;
-                       p.StartInfo.WorkingDirectory = directory;
-                       p.StartInfo.FileName = "mono";
-                       p.StartInfo.Arguments = file;
-                       p.StartInfo.RedirectStandardOutput = true;
-                       p.StartInfo.UseShellExecute = false;
-
-                       p.Start ();
-                       p.WaitForExit ();
-
-                       return p.StandardOutput.ReadToEnd ();
-               }
-       }
-}
diff --git a/mcs/tools/linker/Tests/Mono.Linker.Tests/XmlLinkingTestFixture.cs b/mcs/tools/linker/Tests/Mono.Linker.Tests/XmlLinkingTestFixture.cs
deleted file mode 100644 (file)
index 1e89290..0000000
+++ /dev/null
@@ -1,99 +0,0 @@
-//
-// XmlLinkingTestFixture.cs
-//
-// Author:
-//   Jb Evain (jbevain@gmail.com)
-//
-// (C) 2006 Jb Evain
-//
-// 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.IO;
-using System.Xml.XPath;
-
-using Mono.Linker.Steps;
-using NUnit.Framework;
-
-
-namespace Mono.Linker.Tests {
-
-       [TestFixture]
-       public class XmlLinkingTestFixture : AbstractLinkingTestFixture {
-
-               [Test]
-               public void TestSimpleXml ()
-               {
-                       RunTest ("SimpleXml");
-               }
-
-               [Test]
-               public void TestInterface ()
-               {
-                       RunTest ("Interface");
-               }
-
-               [Test]
-               public void TestReferenceInVirtualMethod ()
-               {
-                       RunTest ("ReferenceInVirtualMethod");
-               }
-
-               [Test]
-               public void TestGenerics ()
-               {
-                       RunTest ("Generics");
-               }
-
-               [Test]
-               public void TestNestedNested ()
-               {
-                       RunTest ("NestedNested");
-               }
-
-               [Test]
-               public void TestPreserveFieldsRequired ()
-               {
-                       RunTest ("PreserveFieldsRequired");
-               }
-
-               [Test]
-               public void TestReferenceInAttributes ()
-               {
-                       RunTest ("ReferenceInAttributes");
-               }
-
-               [Test]
-               public void TestXmlPattern ()
-               {
-                       RunTest ("XmlPattern");
-               }
-
-               protected override void RunTest (string testCase)
-               {
-                       base.RunTest (testCase);
-                       Pipeline.PrependStep (
-                               new ResolveFromXmlStep (
-                                       new XPathDocument (Path.Combine (GetTestCasePath (), "desc.xml"))));
-
-                       Run ();
-               }
-       }
-}
diff --git a/mcs/tools/linker/Tests/TestCases/Integration/Crypto/Test.cs b/mcs/tools/linker/Tests/TestCases/Integration/Crypto/Test.cs
deleted file mode 100644 (file)
index 8c38f92..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-using System;
-using System.Security.Cryptography;
-using System.Text;
-
-class Test {
-
-       static void Main ()
-       {
-               byte [] foo = Encoding.UTF8.GetBytes ("foobared");
-
-               HashAlgorithm ha = MD5.Create ();
-               byte [] hash = ha.ComputeHash (foo);
-
-               Console.WriteLine (Encoding.UTF8.GetString (hash));
-       }
-}
diff --git a/mcs/tools/linker/Tests/TestCases/Integration/Crypto/Test.exe b/mcs/tools/linker/Tests/TestCases/Integration/Crypto/Test.exe
deleted file mode 100755 (executable)
index 2decc49..0000000
Binary files a/mcs/tools/linker/Tests/TestCases/Integration/Crypto/Test.exe and /dev/null differ
diff --git a/mcs/tools/linker/Tests/TestCases/Integration/HelloWorld/Test.cs b/mcs/tools/linker/Tests/TestCases/Integration/HelloWorld/Test.cs
deleted file mode 100644 (file)
index 4a65b44..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-using System;
-
-class Test {
-
-       static void Main ()
-       {
-               Console.WriteLine ("Hello world!");
-       }
-}
diff --git a/mcs/tools/linker/Tests/TestCases/Integration/HelloWorld/Test.exe b/mcs/tools/linker/Tests/TestCases/Integration/HelloWorld/Test.exe
deleted file mode 100755 (executable)
index 2f4f4c9..0000000
Binary files a/mcs/tools/linker/Tests/TestCases/Integration/HelloWorld/Test.exe and /dev/null differ
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/Generics/Library.cs b/mcs/tools/linker/Tests/TestCases/Linker/Generics/Library.cs
deleted file mode 100644 (file)
index 75fe1ed..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-using System;
-
-public class Foo {
-
-       void Bar ()
-       {
-               int i = 42;
-               string s = "hey";
-
-               Baz<int> bi = new Baz<int> (i);
-               bi.Gazonk ();
-               bi.Bat<string>(i, s);
-
-               Baz<string> bs = new Baz<string> (s);
-               bs.Gazonk ();
-               bs.Bat<int>(s, i);
-               bs.BiroBiro ();
-
-               bs.Blam<Bang> ();
-       }
-}
-
-public class Baz<T> {
-
-       T _t;
-
-       public Baz (T t)
-       {
-               _t = t;
-       }
-
-       public void Gazonk ()
-       {
-               Console.WriteLine (_t);
-       }
-
-       public void Bat<M> (T t, M m)
-       {
-               Console.WriteLine ("{0}{1}", t, m);
-       }
-
-       public void Blam<M> ()
-       {
-       }
-
-       public T [] BiroBiro ()
-       {
-               return new T [0];
-       }
-}
-
-class Bang {
-
-       [NotLinked] public Bang ()
-       {
-       }
-}
-
-[NotLinked, AttributeUsage (AttributeTargets.All)]
-public class NotLinkedAttribute : Attribute {
-}
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/Generics/Library.dll b/mcs/tools/linker/Tests/TestCases/Linker/Generics/Library.dll
deleted file mode 100644 (file)
index fe5cab1..0000000
Binary files a/mcs/tools/linker/Tests/TestCases/Linker/Generics/Library.dll and /dev/null differ
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/Generics/Makefile b/mcs/tools/linker/Tests/TestCases/Linker/Generics/Makefile
deleted file mode 100644 (file)
index 2e5bf5b..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-include ../../config.make
-
-all:
-       MCS /t:library Library.cs
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/Generics/desc.xml b/mcs/tools/linker/Tests/TestCases/Linker/Generics/desc.xml
deleted file mode 100644 (file)
index 0dd61b9..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-<linker>
-       <assembly fullname="Library">
-               <type fullname="Foo" />
-       </assembly>
-</linker>
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/Interface/Library.cs b/mcs/tools/linker/Tests/TestCases/Linker/Interface/Library.cs
deleted file mode 100644 (file)
index 7aa9394..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-using System;
-
-public class Foo : IFoo {
-
-       public void Gazonk ()
-       {
-       }
-}
-
-public interface IFoo : IBar {
-}
-
-public interface IBar {
-
-       void Gazonk ();
-}
-
-[NotLinked] public class Baz : IBaz {
-}
-
-[NotLinked] public interface IBaz {
-}
-
-[NotLinked, AttributeUsage (AttributeTargets.All)]
-public class NotLinkedAttribute : Attribute {
-}
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/Interface/Library.dll b/mcs/tools/linker/Tests/TestCases/Linker/Interface/Library.dll
deleted file mode 100644 (file)
index 2ae8b92..0000000
Binary files a/mcs/tools/linker/Tests/TestCases/Linker/Interface/Library.dll and /dev/null differ
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/Interface/Makefile b/mcs/tools/linker/Tests/TestCases/Linker/Interface/Makefile
deleted file mode 100644 (file)
index 2e5bf5b..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-include ../../config.make
-
-all:
-       MCS /t:library Library.cs
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/Interface/desc.xml b/mcs/tools/linker/Tests/TestCases/Linker/Interface/desc.xml
deleted file mode 100644 (file)
index 0dd61b9..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-<linker>
-       <assembly fullname="Library">
-               <type fullname="Foo" />
-       </assembly>
-</linker>
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/MultipleReferences/Bar.cs b/mcs/tools/linker/Tests/TestCases/Linker/MultipleReferences/Bar.cs
deleted file mode 100644 (file)
index c2f0df4..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-using System;
-
-public class Bar {
-
-       string bang = "bang !";
-
-       public Bar ()
-       {
-       }
-
-       public void Bang ()
-       {
-               Console.WriteLine (bang);
-       }
-}
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/MultipleReferences/Bar.dll b/mcs/tools/linker/Tests/TestCases/Linker/MultipleReferences/Bar.dll
deleted file mode 100644 (file)
index 159106d..0000000
Binary files a/mcs/tools/linker/Tests/TestCases/Linker/MultipleReferences/Bar.dll and /dev/null differ
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/MultipleReferences/Baz.cs b/mcs/tools/linker/Tests/TestCases/Linker/MultipleReferences/Baz.cs
deleted file mode 100644 (file)
index ab5241c..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-using System;
-
-public class Baz {
-
-       public void Chain (Foo f)
-       {
-               f.b.Bang ();
-       }
-
-       [NotLinked] public void Lurman ()
-       {
-       }
-}
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/MultipleReferences/Baz.dll b/mcs/tools/linker/Tests/TestCases/Linker/MultipleReferences/Baz.dll
deleted file mode 100644 (file)
index 977b20f..0000000
Binary files a/mcs/tools/linker/Tests/TestCases/Linker/MultipleReferences/Baz.dll and /dev/null differ
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/MultipleReferences/Foo.cs b/mcs/tools/linker/Tests/TestCases/Linker/MultipleReferences/Foo.cs
deleted file mode 100644 (file)
index 746a2b2..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-using System;
-
-public class Foo {
-
-       public Bar b;
-
-       public Foo (Bar b)
-       {
-               this.b = b;
-       }
-
-       public void UseBar ()
-       {
-               b.Bang ();
-       }
-
-       [NotLinked] public void Blam ()
-       {
-       }
-}
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/MultipleReferences/Foo.dll b/mcs/tools/linker/Tests/TestCases/Linker/MultipleReferences/Foo.dll
deleted file mode 100644 (file)
index 54e10fe..0000000
Binary files a/mcs/tools/linker/Tests/TestCases/Linker/MultipleReferences/Foo.dll and /dev/null differ
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/MultipleReferences/Makefile b/mcs/tools/linker/Tests/TestCases/Linker/MultipleReferences/Makefile
deleted file mode 100644 (file)
index 9f56e6e..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-include ../../config.make
-
-all:
-       MCS /t:library NotLinkedAttribute.cs
-       MCS /t:library Bar.cs
-       MCS /t:library /r:Bar.dll /r:NotLinkedAttribute.dll Foo.cs
-       MCS /t:library /r:Foo.dll /r:Bar.dll /r:NotLinkedAttribute.dll Baz.cs
-       MCS /t:library /r:Foo.dll /r:Bar.dll /r:NotLinkedAttribute.dll Baz.cs
-       MCS /r:Foo.dll /r:Bar.dll /r:Baz.dll /r:NotLinkedAttribute Program.cs
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/MultipleReferences/NotLinkedAttribute.cs b/mcs/tools/linker/Tests/TestCases/Linker/MultipleReferences/NotLinkedAttribute.cs
deleted file mode 100644 (file)
index 5290344..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-using System;
-
-[NotLinked, AttributeUsage (AttributeTargets.All)]
-public class NotLinkedAttribute : Attribute {
-}
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/MultipleReferences/NotLinkedAttribute.dll b/mcs/tools/linker/Tests/TestCases/Linker/MultipleReferences/NotLinkedAttribute.dll
deleted file mode 100644 (file)
index 06929d0..0000000
Binary files a/mcs/tools/linker/Tests/TestCases/Linker/MultipleReferences/NotLinkedAttribute.dll and /dev/null differ
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/MultipleReferences/Program.cs b/mcs/tools/linker/Tests/TestCases/Linker/MultipleReferences/Program.cs
deleted file mode 100644 (file)
index 4e1debd..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-using System;
-
-public class Program {
-
-       public static int Main ()
-       {
-               Program p = new Program ();
-               p.Run ();
-
-               return 0;
-       }
-
-       void Run ()
-       {
-               Foo f = new Foo (new Bar ());
-               f.UseBar ();
-
-               Baz b = new Baz ();
-               b.Chain (f);
-       }
-}
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/MultipleReferences/Program.exe b/mcs/tools/linker/Tests/TestCases/Linker/MultipleReferences/Program.exe
deleted file mode 100644 (file)
index c8e7597..0000000
Binary files a/mcs/tools/linker/Tests/TestCases/Linker/MultipleReferences/Program.exe and /dev/null differ
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/NestedNested/Library.cs b/mcs/tools/linker/Tests/TestCases/Linker/NestedNested/Library.cs
deleted file mode 100644 (file)
index 1391162..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-using System;
-
-public class Foo {
-}
-
-[NotLinked] public class Bar {
-
-       [NotLinked] public class Baz {
-
-               [NotLinked] public class Gazonk {
-               }
-       }
-}
-
-[NotLinked, AttributeUsage (AttributeTargets.All)]
-public class NotLinkedAttribute : Attribute {
-}
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/NestedNested/Library.dll b/mcs/tools/linker/Tests/TestCases/Linker/NestedNested/Library.dll
deleted file mode 100644 (file)
index 49151f1..0000000
Binary files a/mcs/tools/linker/Tests/TestCases/Linker/NestedNested/Library.dll and /dev/null differ
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/NestedNested/Makefile b/mcs/tools/linker/Tests/TestCases/Linker/NestedNested/Makefile
deleted file mode 100644 (file)
index 2e5bf5b..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-include ../../config.make
-
-all:
-       MCS /t:library Library.cs
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/NestedNested/desc.xml b/mcs/tools/linker/Tests/TestCases/Linker/NestedNested/desc.xml
deleted file mode 100644 (file)
index 0dd61b9..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-<linker>
-       <assembly fullname="Library">
-               <type fullname="Foo" />
-       </assembly>
-</linker>
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/PreserveFieldsRequired/Library.cs b/mcs/tools/linker/Tests/TestCases/Linker/PreserveFieldsRequired/Library.cs
deleted file mode 100644 (file)
index 63a5ee7..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-using System;
-
-public class Foo {
-
-       public Foo ()
-       {
-               new NotRequiredButUsedNotPreserved ();
-               new NotRequiredButUsedAndFieldsPreserved ();
-       }
-}
-
-public class NotRequiredButUsedNotPreserved {
-
-       [NotLinked] public int foo;
-       [NotLinked] public int bar;
-}
-
-public class NotRequiredButUsedAndFieldsPreserved {
-
-       public int foo;
-       public int bar;
-
-       [NotLinked] public int FooBar ()
-       {
-               return foo + bar;
-       }
-}
-
-[NotLinked] public class NotRequiredAndNotUsed {
-}
-
-[NotLinked, AttributeUsage (AttributeTargets.All)]
-public class NotLinkedAttribute : Attribute {
-}
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/PreserveFieldsRequired/Library.dll b/mcs/tools/linker/Tests/TestCases/Linker/PreserveFieldsRequired/Library.dll
deleted file mode 100755 (executable)
index 941d6c3..0000000
Binary files a/mcs/tools/linker/Tests/TestCases/Linker/PreserveFieldsRequired/Library.dll and /dev/null differ
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/PreserveFieldsRequired/Makefile b/mcs/tools/linker/Tests/TestCases/Linker/PreserveFieldsRequired/Makefile
deleted file mode 100644 (file)
index 2e5bf5b..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-include ../../config.make
-
-all:
-       MCS /t:library Library.cs
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/PreserveFieldsRequired/desc.xml b/mcs/tools/linker/Tests/TestCases/Linker/PreserveFieldsRequired/desc.xml
deleted file mode 100644 (file)
index 979d4e0..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-<linker>
-       <assembly fullname="Library">
-               <type fullname="Foo" />
-               <type fullname="NotRequiredButUsedNotPreserved" preserve="nothing" required="false" />
-               <type fullname="NotRequiredButUsedAndFieldsPreserved" preserve="fields" required="false" />
-       </assembly>
-</linker>
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/ReferenceInAttributes/LibLib.cs b/mcs/tools/linker/Tests/TestCases/Linker/ReferenceInAttributes/LibLib.cs
deleted file mode 100644 (file)
index 6ca5a7f..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-using System;
-
-namespace LibLib {
-
-       public class LibLibAttribute : Attribute {
-
-               public Type LibLibType {
-                       [NotLinked] get { return null; }
-                       set {}
-               }
-       }
-
-       public class BilBil {
-
-               [NotLinked] public BilBil ()
-               {
-               }
-       }
-}
-
-[NotLinked, AttributeUsage (AttributeTargets.All)]
-class NotLinkedAttribute : Attribute {
-}
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/ReferenceInAttributes/LibLib.dll b/mcs/tools/linker/Tests/TestCases/Linker/ReferenceInAttributes/LibLib.dll
deleted file mode 100755 (executable)
index 2f1e457..0000000
Binary files a/mcs/tools/linker/Tests/TestCases/Linker/ReferenceInAttributes/LibLib.dll and /dev/null differ
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/ReferenceInAttributes/Library.cs b/mcs/tools/linker/Tests/TestCases/Linker/ReferenceInAttributes/Library.cs
deleted file mode 100644 (file)
index cb3903f..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-using System;
-using LibLib;
-
-public class BarAttribute : Attribute {
-
-       public BarAttribute ()
-       {
-       }
-
-       public BarAttribute (Type type)
-       {
-       }
-
-       public Type FieldType;
-
-       public Type PropertyType {
-               [NotLinked] get { return null; }
-               set {}
-       }
-}
-
-[Bar (typeof (Guy_A))]
-public class Foo {
-
-       [Bar (FieldType = typeof (Guy_B))]
-       public Foo a;
-
-       [Bar (PropertyType = typeof (Guy_C))]
-       public Foo b;
-
-       [LibLib (LibLibType = typeof (BilBil))]
-       public Foo c;
-
-       [LibLib (LibLibType = typeof (Guy_D))]
-       public Foo d;
-}
-
-public class Guy_A {
-
-       [NotLinked] public Guy_A ()
-       {
-       }
-}
-
-public class Guy_B {
-
-       [NotLinked] public Guy_B ()
-       {
-       }
-}
-
-public class Guy_C {
-
-       [NotLinked] public Guy_C ()
-       {
-       }
-}
-
-public class Guy_D {
-
-       [NotLinked] public Guy_D ()
-       {
-       }
-}
-
-[NotLinked] public class Baz {
-}
-
-[NotLinked, AttributeUsage (AttributeTargets.All)]
-class NotLinkedAttribute : Attribute {
-}
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/ReferenceInAttributes/Library.dll b/mcs/tools/linker/Tests/TestCases/Linker/ReferenceInAttributes/Library.dll
deleted file mode 100755 (executable)
index 7c5b997..0000000
Binary files a/mcs/tools/linker/Tests/TestCases/Linker/ReferenceInAttributes/Library.dll and /dev/null differ
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/ReferenceInAttributes/desc.xml b/mcs/tools/linker/Tests/TestCases/Linker/ReferenceInAttributes/desc.xml
deleted file mode 100644 (file)
index 0dd61b9..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-<linker>
-       <assembly fullname="Library">
-               <type fullname="Foo" />
-       </assembly>
-</linker>
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/ReferenceInVirtualMethod/Library.cs b/mcs/tools/linker/Tests/TestCases/Linker/ReferenceInVirtualMethod/Library.cs
deleted file mode 100644 (file)
index 8b840b4..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-
-using System;
-
-public class Foo {
-
-       public void Do ()
-       {
-               Bar b = new Baz ();
-               b.Bang ();
-       }
-}
-
-public class Bar {
-
-       public virtual void Bang ()
-       {
-       }
-}
-
-public class Baz : Bar {
-
-       private string _hey;
-
-       public string Hey {
-               [NotLinked] get { return _hey; }
-               [NotLinked] set { _hey = value; }
-       }
-
-       public override void Bang ()
-       {
-               Console.WriteLine (_hey);
-       }
-}
-
-[NotLinked] public class NotLinkedAttribute : Attribute {}
\ No newline at end of file
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/ReferenceInVirtualMethod/Library.dll b/mcs/tools/linker/Tests/TestCases/Linker/ReferenceInVirtualMethod/Library.dll
deleted file mode 100644 (file)
index b56fa60..0000000
Binary files a/mcs/tools/linker/Tests/TestCases/Linker/ReferenceInVirtualMethod/Library.dll and /dev/null differ
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/ReferenceInVirtualMethod/Makefile b/mcs/tools/linker/Tests/TestCases/Linker/ReferenceInVirtualMethod/Makefile
deleted file mode 100644 (file)
index 2e5bf5b..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-include ../../config.make
-
-all:
-       MCS /t:library Library.cs
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/ReferenceInVirtualMethod/desc.xml b/mcs/tools/linker/Tests/TestCases/Linker/ReferenceInVirtualMethod/desc.xml
deleted file mode 100644 (file)
index 0dd61b9..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-<linker>
-       <assembly fullname="Library">
-               <type fullname="Foo" />
-       </assembly>
-</linker>
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/Simple/Library.cs b/mcs/tools/linker/Tests/TestCases/Linker/Simple/Library.cs
deleted file mode 100644 (file)
index 538205a..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-using System;
-
-public class Library {
-
-       private int _pouet;
-       [NotLinked] private int _hey;
-
-       public Library ()
-       {
-               _pouet = 1;
-       }
-
-       [NotLinked] public Library (int pouet)
-       {
-               _pouet = pouet;
-       }
-
-       public int Hello ()
-       {
-               Console.WriteLine ("Hello");
-               return _pouet;
-       }
-
-       [NotLinked] public void Hey (int hey)
-       {
-               _hey = hey;
-               Console.WriteLine (_hey);
-       }
-}
-
-
-[NotLinked] public class Toy {
-}
-
-[NotLinked, AttributeUsage (AttributeTargets.All)]
-public class NotLinkedAttribute : Attribute {
-}
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/Simple/Library.dll b/mcs/tools/linker/Tests/TestCases/Linker/Simple/Library.dll
deleted file mode 100644 (file)
index 5225e88..0000000
Binary files a/mcs/tools/linker/Tests/TestCases/Linker/Simple/Library.dll and /dev/null differ
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/Simple/Makefile b/mcs/tools/linker/Tests/TestCases/Linker/Simple/Makefile
deleted file mode 100644 (file)
index 356b529..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-include ../../config.make
-
-all:
-       MCS /t:library Library.cs
-       MCS /r:Library.dll Program.cs
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/Simple/Program.cs b/mcs/tools/linker/Tests/TestCases/Linker/Simple/Program.cs
deleted file mode 100644 (file)
index 6d3adb7..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-using System;
-
-public class Program {
-
-       public static int Main ()
-       {
-               Program p = new Program ();
-               return p.Run ();
-       }
-
-       int Run ()
-       {
-               Library lib = new Library ();
-               return lib.Hello ();
-       }
-}
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/Simple/Program.exe b/mcs/tools/linker/Tests/TestCases/Linker/Simple/Program.exe
deleted file mode 100644 (file)
index 1605ce0..0000000
Binary files a/mcs/tools/linker/Tests/TestCases/Linker/Simple/Program.exe and /dev/null differ
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/SimpleXml/Library.cs b/mcs/tools/linker/Tests/TestCases/Linker/SimpleXml/Library.cs
deleted file mode 100644 (file)
index 4e81b42..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-using System;
-
-public class Foo {
-
-       int _baz;
-       [NotLinked] int _shebang;
-
-       public Foo ()
-       {
-               _baz = 42;
-       }
-
-       public int Baz ()
-       {
-               return _baz;
-       }
-
-       [NotLinked] public int Shebang (int bang)
-       {
-               return _shebang = bang * 2;
-       }
-}
-
-public class Bar {
-
-       int _truc;
-
-       public Bar ()
-       {
-               _truc = 12;
-       }
-
-       public int Truc ()
-       {
-               return _truc;
-       }
-}
-
-[NotLinked] public class Gazonk {
-}
-
-[NotLinked, AttributeUsage (AttributeTargets.All)]
-public class NotLinkedAttribute : Attribute {
-}
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/SimpleXml/Library.dll b/mcs/tools/linker/Tests/TestCases/Linker/SimpleXml/Library.dll
deleted file mode 100644 (file)
index c37c059..0000000
Binary files a/mcs/tools/linker/Tests/TestCases/Linker/SimpleXml/Library.dll and /dev/null differ
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/SimpleXml/Makefile b/mcs/tools/linker/Tests/TestCases/Linker/SimpleXml/Makefile
deleted file mode 100644 (file)
index 2e5bf5b..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-include ../../config.make
-
-all:
-       MCS /t:library Library.cs
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/SimpleXml/desc.xml b/mcs/tools/linker/Tests/TestCases/Linker/SimpleXml/desc.xml
deleted file mode 100644 (file)
index 2a20ed3..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-<linker>
-       <assembly fullname="Library">
-               <type fullname="Foo">
-                       <field signature="System.Int32 _baz" />
-                       <method signature="System.Void .ctor()" />
-                       <method signature="System.Int32 Baz()" />
-               </type>
-               <type fullname="Bar" />
-       </assembly>
-</linker>
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/VirtualCall/Library.cs b/mcs/tools/linker/Tests/TestCases/Linker/VirtualCall/Library.cs
deleted file mode 100644 (file)
index b9c3f02..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-using System;
-
-public class Library {
-
-       public Library ()
-       {
-       }
-
-       public int Shebang ()
-       {
-               return Bang ();
-       }
-
-       protected virtual int Bang ()
-       {
-               return 1;
-       }
-}
-
-
-public class PowerFulLibrary : Library {
-
-       protected override int Bang ()
-       {
-               return 0;
-       }
-}
-
-[NotLinked, AttributeUsage (AttributeTargets.All)]
-public class NotLinkedAttribute : Attribute {
-}
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/VirtualCall/Library.dll b/mcs/tools/linker/Tests/TestCases/Linker/VirtualCall/Library.dll
deleted file mode 100644 (file)
index 0f2ff3f..0000000
Binary files a/mcs/tools/linker/Tests/TestCases/Linker/VirtualCall/Library.dll and /dev/null differ
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/VirtualCall/Makefile b/mcs/tools/linker/Tests/TestCases/Linker/VirtualCall/Makefile
deleted file mode 100644 (file)
index 356b529..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-include ../../config.make
-
-all:
-       MCS /t:library Library.cs
-       MCS /r:Library.dll Program.cs
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/VirtualCall/Program.cs b/mcs/tools/linker/Tests/TestCases/Linker/VirtualCall/Program.cs
deleted file mode 100644 (file)
index 1d4a64d..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-using System;
-
-public class Program {
-
-       public static int Main ()
-       {
-               Program p = new Program ();
-               return p.Run ();
-       }
-
-       int Run ()
-       {
-               Library lib = new PowerFulLibrary ();
-               return lib.Shebang ();
-       }
-}
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/VirtualCall/Program.exe b/mcs/tools/linker/Tests/TestCases/Linker/VirtualCall/Program.exe
deleted file mode 100644 (file)
index f5a9bec..0000000
Binary files a/mcs/tools/linker/Tests/TestCases/Linker/VirtualCall/Program.exe and /dev/null differ
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/XmlPattern/Library.cs b/mcs/tools/linker/Tests/TestCases/Linker/XmlPattern/Library.cs
deleted file mode 100755 (executable)
index 7f14865..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-using System;
-
-namespace Foo {
-
-       [NotLinked] public class BarBar {
-       }
-
-       public class FooBaz {
-
-               public FooBaz ()
-               {
-               }
-
-               [NotLinked] public void BarBaz ()
-               {
-               }
-       }
-
-       public class TrucBaz {
-
-               public TrucBaz ()
-               {
-               }
-       }
-
-       public class BazBaz {
-
-               public BazBaz ()
-               {
-               }
-       }
-}
-
-[NotLinked, AttributeUsage (AttributeTargets.All)]
-public class NotLinkedAttribute : Attribute {
-}
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/XmlPattern/Library.dll b/mcs/tools/linker/Tests/TestCases/Linker/XmlPattern/Library.dll
deleted file mode 100755 (executable)
index 80e7ef3..0000000
Binary files a/mcs/tools/linker/Tests/TestCases/Linker/XmlPattern/Library.dll and /dev/null differ
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/XmlPattern/Makefile b/mcs/tools/linker/Tests/TestCases/Linker/XmlPattern/Makefile
deleted file mode 100755 (executable)
index 2e5bf5b..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-include ../../config.make
-
-all:
-       MCS /t:library Library.cs
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/XmlPattern/desc.xml b/mcs/tools/linker/Tests/TestCases/Linker/XmlPattern/desc.xml
deleted file mode 100755 (executable)
index c8e1e23..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-<linker>
-       <assembly fullname="Library">
-               <type fullname="Foo.*Baz">
-                       <method signature="System.Void .ctor()" />
-               </type>
-       </assembly>
-</linker>
diff --git a/mcs/tools/linker/Tests/TestCases/config.make b/mcs/tools/linker/Tests/TestCases/config.make
deleted file mode 100644 (file)
index 8323eb2..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-
-MCS = mcs
-
diff --git a/mcs/tools/linker/configure b/mcs/tools/linker/configure
deleted file mode 100755 (executable)
index 2598cb6..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/sh
-VERSION=0.1
-prefix=/usr/local
-while test x$1 != x; do
-        case $1 in
-                --prefix=*)
-                        prefix=`echo $1 | sed 's/--prefix=//'`
-                        ;;
-                --prefix)
-                        echo --prefix needs an argument: --prefix=directory >&2
-                        ;;
-                *)
-                        echo Unknown argument $1 >&2
-        esac
-        shift
-done
-
-echo "prefix=$prefix" > config.make
-echo "RUNTIME=mono" >> config.make
-echo "ASSEMBLY_VERSION=$VERSION.0.0" >> config.make
-echo "VERSION=$VERSION" >> config.make
-
-echo "monolinker has been configure to be installed in $prefix"
index cfff038a83180de83a050e8ef3cf71352ff92d37..fa7f88b573b1afcc9abc69d5a1a7b54e081999db 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
   </PropertyGroup>\r
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />\r
   <ItemGroup>\r
-    <Compile Include=".\Mono.Linker.Steps\BaseStep.cs" />\r
-    <Compile Include=".\Mono.Linker.Steps\BlacklistStep.cs" />\r
-    <Compile Include=".\Mono.Linker.Steps\CleanStep.cs" />\r
-    <Compile Include=".\Mono.Linker.Steps\IStep.cs" />\r
-    <Compile Include=".\Mono.Linker.Steps\LoadI18nAssemblies.cs" />\r
-    <Compile Include=".\Mono.Linker.Steps\LoadReferencesStep.cs" />\r
-    <Compile Include=".\Mono.Linker.Steps\MarkStep.cs" />\r
-    <Compile Include=".\Mono.Linker.Steps\OutputStep.cs" />\r
-    <Compile Include=".\Mono.Linker.Steps\RegenerateGuidStep.cs" />\r
-    <Compile Include=".\Mono.Linker.Steps\ResolveFromAssemblyStep.cs" />\r
-    <Compile Include=".\Mono.Linker.Steps\ResolveFromXApiStep.cs" />\r
-    <Compile Include=".\Mono.Linker.Steps\ResolveFromXmlStep.cs" />\r
-    <Compile Include=".\Mono.Linker.Steps\ResolveStep.cs" />\r
-    <Compile Include=".\Mono.Linker.Steps\SweepStep.cs" />\r
-    <Compile Include=".\Mono.Linker.Steps\TypeMapStep.cs" />\r
-    <Compile Include=".\Mono.Linker\Annotations.cs" />\r
-    <Compile Include=".\Mono.Linker\AssemblyAction.cs" />\r
-    <Compile Include=".\Mono.Linker\AssemblyInfo.cs" />\r
-    <Compile Include=".\Mono.Linker\AssemblyResolver.cs" />\r
-    <Compile Include=".\Mono.Linker\Driver.cs" />\r
-    <Compile Include=".\Mono.Linker\I18nAssemblies.cs" />\r
-    <Compile Include=".\Mono.Linker\IXApiVisitor.cs" />\r
-    <Compile Include=".\Mono.Linker\LinkContext.cs" />\r
-    <Compile Include=".\Mono.Linker\MethodAction.cs" />\r
-    <Compile Include=".\Mono.Linker\Pipeline.cs" />\r
-    <Compile Include=".\Mono.Linker\TypePreserve.cs" />\r
-    <Compile Include=".\Mono.Linker\XApiReader.cs" />\r  </ItemGroup>\r
+    <Compile Include="..\..\..\external\linker\linker\Mono.Linker.Steps\BaseStep.cs" />\r
+    <Compile Include="..\..\..\external\linker\linker\Mono.Linker.Steps\BlacklistStep.cs" />\r
+    <Compile Include="..\..\..\external\linker\linker\Mono.Linker.Steps\CleanStep.cs" />\r
+    <Compile Include="..\..\..\external\linker\linker\Mono.Linker.Steps\IStep.cs" />\r
+    <Compile Include="..\..\..\external\linker\linker\Mono.Linker.Steps\LoadI18nAssemblies.cs" />\r
+    <Compile Include="..\..\..\external\linker\linker\Mono.Linker.Steps\LoadReferencesStep.cs" />\r
+    <Compile Include="..\..\..\external\linker\linker\Mono.Linker.Steps\MarkStep.cs" />\r
+    <Compile Include="..\..\..\external\linker\linker\Mono.Linker.Steps\OutputStep.cs" />\r
+    <Compile Include="..\..\..\external\linker\linker\Mono.Linker.Steps\RegenerateGuidStep.cs" />\r
+    <Compile Include="..\..\..\external\linker\linker\Mono.Linker.Steps\ResolveFromAssemblyStep.cs" />\r
+    <Compile Include="..\..\..\external\linker\linker\Mono.Linker.Steps\ResolveFromXApiStep.cs" />\r
+    <Compile Include="..\..\..\external\linker\linker\Mono.Linker.Steps\ResolveFromXmlStep.cs" />\r
+    <Compile Include="..\..\..\external\linker\linker\Mono.Linker.Steps\ResolveStep.cs" />\r
+    <Compile Include="..\..\..\external\linker\linker\Mono.Linker.Steps\SweepStep.cs" />\r
+    <Compile Include="..\..\..\external\linker\linker\Mono.Linker.Steps\TypeMapStep.cs" />\r
+    <Compile Include="..\..\..\external\linker\linker\Mono.Linker\Annotations.cs" />\r
+    <Compile Include="..\..\..\external\linker\linker\Mono.Linker\AssemblyAction.cs" />\r
+    <Compile Include="..\..\..\external\linker\linker\Mono.Linker\AssemblyInfo.cs" />\r
+    <Compile Include="..\..\..\external\linker\linker\Mono.Linker\AssemblyResolver.cs" />\r
+    <Compile Include="..\..\..\external\linker\linker\Mono.Linker\Driver.cs" />\r
+    <Compile Include="..\..\..\external\linker\linker\Mono.Linker\I18nAssemblies.cs" />\r
+    <Compile Include="..\..\..\external\linker\linker\Mono.Linker\IXApiVisitor.cs" />\r
+    <Compile Include="..\..\..\external\linker\linker\Mono.Linker\LinkContext.cs" />\r
+    <Compile Include="..\..\..\external\linker\linker\Mono.Linker\MethodAction.cs" />\r
+    <Compile Include="..\..\..\external\linker\linker\Mono.Linker\Pipeline.cs" />\r
+    <Compile Include="..\..\..\external\linker\linker\Mono.Linker\TypePreserve.cs" />\r
+    <Compile Include="..\..\..\external\linker\linker\Mono.Linker\XApiReader.cs" />\r  </ItemGroup>\r
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \r
        Other similar extension points exist, see Microsoft.Common.targets.\r
   <Target Name="BeforeBuild">\r
       <Project>{87FD2F0F-5222-4AE6-BD63-2D4975E11E5B}</Project>\r
       <Name>System.Xml-net_4_x</Name>\r
     </ProjectReference>\r
-    <ProjectReference Include="../../class/Mono.Cecil/Mono.Cecil-net_4_x.csproj">\r
-      <Project>{2C0D558F-0B38-4691-967E-A910A1B995C1}</Project>\r
+    <ProjectReference Include="../../class/legacy/Mono.Cecil/Mono.Cecil-net_4_x.csproj">\r
+      <Project>{6DE38817-EC25-433A-AE58-0D30C5E6C460}</Project>\r
       <Name>Mono.Cecil-net_4_x</Name>\r
     </ProjectReference>\r
   </ItemGroup>\r
index 90b8ae0f7de28eb9055f40cbc8ac28d12ca99567..66410e5fe69bddfb2af8f759616b3291a8797308 100644 (file)
@@ -1,27 +1,27 @@
-./Mono.Linker/Pipeline.cs
-./Mono.Linker/AssemblyInfo.cs
-./Mono.Linker/AssemblyResolver.cs
-./Mono.Linker/TypePreserve.cs
-./Mono.Linker/Annotations.cs
-./Mono.Linker/LinkContext.cs
-./Mono.Linker/AssemblyAction.cs
-./Mono.Linker/Driver.cs
-./Mono.Linker/I18nAssemblies.cs
-./Mono.Linker/MethodAction.cs
-./Mono.Linker/XApiReader.cs
-./Mono.Linker/IXApiVisitor.cs
-./Mono.Linker.Steps/BaseStep.cs
-./Mono.Linker.Steps/LoadReferencesStep.cs
-./Mono.Linker.Steps/LoadI18nAssemblies.cs
-./Mono.Linker.Steps/ResolveFromXmlStep.cs
-./Mono.Linker.Steps/SweepStep.cs
-./Mono.Linker.Steps/RegenerateGuidStep.cs
-./Mono.Linker.Steps/ResolveFromXApiStep.cs
-./Mono.Linker.Steps/ResolveFromAssemblyStep.cs
-./Mono.Linker.Steps/ResolveStep.cs
-./Mono.Linker.Steps/CleanStep.cs
-./Mono.Linker.Steps/MarkStep.cs
-./Mono.Linker.Steps/BlacklistStep.cs
-./Mono.Linker.Steps/OutputStep.cs
-./Mono.Linker.Steps/TypeMapStep.cs
-./Mono.Linker.Steps/IStep.cs
+../../../external/linker/linker/Mono.Linker/Pipeline.cs
+../../../external/linker/linker/Mono.Linker/AssemblyInfo.cs
+../../../external/linker/linker/Mono.Linker/AssemblyResolver.cs
+../../../external/linker/linker/Mono.Linker/TypePreserve.cs
+../../../external/linker/linker/Mono.Linker/Annotations.cs
+../../../external/linker/linker/Mono.Linker/LinkContext.cs
+../../../external/linker/linker/Mono.Linker/AssemblyAction.cs
+../../../external/linker/linker/Mono.Linker/Driver.cs
+../../../external/linker/linker/Mono.Linker/I18nAssemblies.cs
+../../../external/linker/linker/Mono.Linker/MethodAction.cs
+../../../external/linker/linker/Mono.Linker/XApiReader.cs
+../../../external/linker/linker/Mono.Linker/IXApiVisitor.cs
+../../../external/linker/linker/Mono.Linker.Steps/BaseStep.cs
+../../../external/linker/linker/Mono.Linker.Steps/LoadReferencesStep.cs
+../../../external/linker/linker/Mono.Linker.Steps/LoadI18nAssemblies.cs
+../../../external/linker/linker/Mono.Linker.Steps/ResolveFromXmlStep.cs
+../../../external/linker/linker/Mono.Linker.Steps/SweepStep.cs
+../../../external/linker/linker/Mono.Linker.Steps/RegenerateGuidStep.cs
+../../../external/linker/linker/Mono.Linker.Steps/ResolveFromXApiStep.cs
+../../../external/linker/linker/Mono.Linker.Steps/ResolveFromAssemblyStep.cs
+../../../external/linker/linker/Mono.Linker.Steps/ResolveStep.cs
+../../../external/linker/linker/Mono.Linker.Steps/CleanStep.cs
+../../../external/linker/linker/Mono.Linker.Steps/MarkStep.cs
+../../../external/linker/linker/Mono.Linker.Steps/BlacklistStep.cs
+../../../external/linker/linker/Mono.Linker.Steps/OutputStep.cs
+../../../external/linker/linker/Mono.Linker.Steps/TypeMapStep.cs
+../../../external/linker/linker/Mono.Linker.Steps/IStep.cs
diff --git a/mcs/tools/linker/monolinker.in b/mcs/tools/linker/monolinker.in
deleted file mode 100644 (file)
index 55e24cb..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh
-mono $MONO_EXTRA_ARGS @prefix@/lib/mink/mink.exe "$@"
diff --git a/mcs/tools/linker/profiler/Makefile b/mcs/tools/linker/profiler/Makefile
deleted file mode 100644 (file)
index 6a9702b..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-SRC = link.c
-OBJ = libmono-profiler-link.so
-
-all:
-       gcc -g -Wall -shared -o $(OBJ) $(SRC) `pkg-config --cflags --libs mono`
-
-clean:
-       rm -f $(OBJ)
diff --git a/mcs/tools/linker/profiler/link.c b/mcs/tools/linker/profiler/link.c
deleted file mode 100644 (file)
index f81e251..0000000
+++ /dev/null
@@ -1,362 +0,0 @@
-/*
- * link.c: a profiler to help the static linker
- *
- * Authors:
- *   Jb Evain (jbevain@novell.com)
- *
- * (C) 2007 Novell, Inc. http://www.novell.com
- *
- */
-#include <glib.h>
-#include <string.h>
-#include <mono/metadata/assembly.h>
-#include <mono/metadata/class.h>
-#include <mono/metadata/image.h>
-#include <mono/metadata/metadata.h>
-#include <mono/metadata/profiler.h>
-
-struct _MonoProfiler {
-       const char *output_file;
-       GHashTable *images;
-};
-
-typedef struct _LinkedImage {
-       MonoImage *image;
-       GHashTable *types;
-} LinkedImage;
-
-typedef struct _LinkedType {
-       MonoClass *klass;
-       GHashTable *methods;
-} LinkedType;
-
-typedef struct _LinkedMethod {
-       MonoMethod *method;
-} LinkedMethod;
-
-static void
-link_append_class_name (GString *res, MonoClass *klass, gboolean include_namespace)
-{
-       if (!klass) {
-               g_string_append (res, "**unknown**");
-               return;
-       }
-
-       if (mono_class_get_nesting_type (klass)) {
-               link_append_class_name (res, mono_class_get_nesting_type (klass), include_namespace);
-               g_string_append_c (res, '/');
-       }
-
-       if (include_namespace && *(mono_class_get_namespace (klass)))
-               g_string_sprintfa (res, "%s.", mono_class_get_namespace (klass));
-
-       g_string_sprintfa (res, "%s", mono_class_get_name (klass));
-}
-
-static MonoType *
-link_get_element_type (MonoType *type)
-{
-       return mono_class_get_type (mono_class_get_element_class (mono_class_from_mono_type (type)));
-}
-
-static void
-link_type_get_desc (GString *res, MonoType *type, gboolean include_namespace) {
-       switch (mono_type_get_type (type)) {
-       case MONO_TYPE_VOID:
-               g_string_append (res, "System.Void"); break;
-       case MONO_TYPE_CHAR:
-               g_string_append (res, "System.Char"); break;
-       case MONO_TYPE_BOOLEAN:
-               g_string_append (res, "System.Boolean"); break;
-       case MONO_TYPE_U1:
-               g_string_append (res, "System.Byte"); break;
-       case MONO_TYPE_I1:
-               g_string_append (res, "System.SByte"); break;
-       case MONO_TYPE_U2:
-               g_string_append (res, "System.UInt16"); break;
-       case MONO_TYPE_I2:
-               g_string_append (res, "System.Int16"); break;
-       case MONO_TYPE_U4:
-               g_string_append (res, "System.UInt32"); break;
-       case MONO_TYPE_I4:
-               g_string_append (res, "System.Int32"); break;
-       case MONO_TYPE_U8:
-               g_string_append (res, "System.UInt64"); break;
-       case MONO_TYPE_I8:
-               g_string_append (res, "System.Int64"); break;
-       case MONO_TYPE_FNPTR:
-               g_string_append (res, "*()"); break;
-       case MONO_TYPE_U:
-               g_string_append (res, "System.UIntPtr"); break;
-       case MONO_TYPE_I:
-               g_string_append (res, "System.IntPtr"); break;
-       case MONO_TYPE_R4:
-               g_string_append (res, "System.Single"); break;
-       case MONO_TYPE_R8:
-               g_string_append (res, "System.Double"); break;
-       case MONO_TYPE_STRING:
-               g_string_append (res, "System.String"); break;
-       case MONO_TYPE_OBJECT:
-               g_string_append (res, "System.Object"); break;
-       case MONO_TYPE_PTR:
-               link_type_get_desc (res, mono_type_get_ptr_type (type), include_namespace);
-               g_string_append_c (res, '*');
-               break;
-       case MONO_TYPE_ARRAY: {
-               MonoClass *eklass = mono_class_get_element_class (mono_class_from_mono_type (type));
-               link_type_get_desc (res, mono_class_get_type (eklass), include_namespace);
-               g_string_sprintfa (res, "[%d]", mono_class_get_rank (eklass));
-               break;
-       }
-       case MONO_TYPE_SZARRAY:
-               link_type_get_desc (res, link_get_element_type (type), include_namespace);
-               g_string_append (res, "[]");
-               break;
-       case MONO_TYPE_CLASS:
-       case MONO_TYPE_VALUETYPE:
-               link_append_class_name (res, mono_type_get_class (type), include_namespace);
-               break;
-       case MONO_TYPE_GENERICINST:
-               //link_type_get_desc (res, &type->data.generic_class->container_class->byval_arg, include_namespace);  /* ? */
-               break;
-       case MONO_TYPE_VAR:
-       case MONO_TYPE_MVAR:
-               //g_string_append (res, type->data.generic_param->name);  /* ? */
-               break;
-       default:
-               break;
-       }
-       if (mono_type_is_byref (type))
-               g_string_append (res, "&amp;");
-}
-
-static char *
-link_type_full_name (MonoType *type)
-{
-       GString *str;
-       char *res;
-
-       str = g_string_new ("");
-       link_type_get_desc (str, type, TRUE);
-
-       res = g_strdup (str->str);
-       g_string_free (str, TRUE);
-       return res;
-}
-
-static char *
-link_class_full_name (MonoClass *klass)
-{
-       return link_type_full_name (mono_class_get_type (klass));
-}
-
-static char *
-link_signature_get_desc (MonoMethodSignature *sig, gboolean include_namespace)
-{
-       int i;
-       char *result;
-       GString *res = g_string_new ("");
-
-       for (i = 0; i < sig->param_count; ++i) {
-               if (i > 0)
-                       g_string_append_c (res, ',');
-               link_type_get_desc (res, sig->params [i], include_namespace);
-       }
-       result = res->str;
-       g_string_free (res, FALSE);
-       return result;
-}
-
-static char *
-link_method_signature (MonoMethod *method)
-{
-       MonoMethodSignature *sig;
-       char *res;
-
-       sig = mono_method_signature (method);
-       char *tmpsig = link_signature_get_desc (sig, TRUE);
-       res = g_strdup_printf ("%s %s(%s)",
-               link_type_full_name (mono_signature_get_return_type (sig)),
-               mono_method_get_name (method), tmpsig);
-       g_free (tmpsig);
-
-       return res;
-}
-
-static char *
-link_image_fullname (MonoImage *image)
-{
-       MonoAssemblyName *name;
-       char *res;
-
-       name = g_new0 (MonoAssemblyName, 1);
-       mono_assembly_fill_assembly_name (image, name);
-       res = mono_stringify_assembly_name (name);
-       g_free (name);
-       return res;
-}
-
-static LinkedType *
-link_get_linked_type (LinkedImage *limage, MonoClass *klass)
-{
-       LinkedType *ltype;
-
-       ltype = (LinkedType *) g_hash_table_lookup (limage->types, klass);
-
-       if (ltype)
-               return ltype;
-
-       ltype = g_new0 (LinkedType, 1);
-       ltype->klass = klass;
-       ltype->methods = g_hash_table_new (NULL, NULL);
-       g_hash_table_insert (limage->types, klass, ltype);
-       return ltype;
-}
-
-static LinkedImage *
-link_get_linked_image (MonoProfiler *prof, MonoImage *image)
-{
-       LinkedImage *limage;
-
-       limage = (LinkedImage *) g_hash_table_lookup (prof->images, image);
-
-       if (limage)
-               return limage;
-
-       limage = g_new0 (LinkedImage, 1);
-       limage->image = image;
-       limage->types = g_hash_table_new (NULL, NULL);
-       g_hash_table_insert (prof->images, image, limage);
-       return limage;
-}
-
-static void
-link_method_leave (MonoProfiler *prof, MonoMethod *method)
-{
-       MonoClass *klass;
-       MonoImage *image;
-
-       LinkedType *ltype;
-       LinkedImage *limage;
-       LinkedMethod *lmethod;
-
-       klass = mono_method_get_class (method);
-       image = mono_class_get_image (klass);
-
-       limage = link_get_linked_image (prof, image);
-       ltype = link_get_linked_type (limage, klass);
-
-       lmethod = (LinkedMethod *) g_hash_table_lookup (ltype->methods, method);
-       if (lmethod)
-               return;
-
-       lmethod = g_new0 (LinkedMethod, 1);
-       lmethod->method = method;
-       g_hash_table_insert (ltype->methods, method, lmethod);
-}
-
-static void
-link_free_member (gpointer key, gpointer value, gpointer data)
-{
-       g_free (value);
-}
-
-static void
-link_free_type (gpointer key, gpointer value, gpointer data)
-{
-       LinkedType *type = (LinkedType *) value;
-
-       g_hash_table_foreach (type->methods, link_free_member, NULL);
-       g_free (type);
-}
-
-static void
-link_free_image (gpointer key, gpointer value, gpointer data)
-{
-       LinkedImage *image = (LinkedImage *) value;
-
-       g_hash_table_foreach (image->types, link_free_type, NULL);
-       g_free (image);
-}
-
-static void
-link_print_method (gpointer key, gpointer value, gpointer data)
-{
-       LinkedMethod *lmethod = (LinkedMethod *) value;
-       FILE *output = (FILE *) data;
-       char *signature;
-
-       signature = link_method_signature (lmethod->method);
-       fprintf (output, "\t\t\t<method signature=\"%s\" />\n", signature);
-       g_free (signature);
-}
-
-static void
-link_print_type (gpointer key, gpointer value, gpointer data)
-{
-       LinkedType *ltype = (LinkedType *) value;
-       FILE *output = (FILE *) data;
-       char *fullname;
-
-       fullname = link_class_full_name (ltype->klass);
-       fprintf (output, "\t\t<type fullname=\"%s\">\n", fullname);
-       g_free (fullname);
-
-       g_hash_table_foreach (ltype->methods, link_print_method, output);
-       fprintf (output, "\t\t</type>\n");
-}
-
-static void
-link_print_image (gpointer key, gpointer value, gpointer data)
-{
-       LinkedImage *limage = (LinkedImage *) value;
-       FILE *output = (FILE *) data;
-       char *fullname;
-
-       fullname = link_image_fullname (limage->image);
-       fprintf (output, "\t<assembly fullname=\"%s\">\n", fullname);
-       g_free (fullname);
-       g_hash_table_foreach (limage->types, link_print_type, output);
-       fprintf (output, "\t</assembly>\n");
-}
-
-static void
-link_print_tree (MonoProfiler *prof)
-{
-       FILE *output;
-
-       output = fopen (prof->output_file, "w");
-       fprintf (output, "<linker>\n");
-       g_hash_table_foreach (prof->images, link_print_image, output);
-       fprintf (output, "</linker>\n");
-       fclose (output);
-}
-
-static void
-link_shutdown (MonoProfiler *prof)
-{
-       link_print_tree (prof);
-       g_hash_table_foreach (prof->images, link_free_image, NULL);
-       g_free (prof);
-}
-
-void
-mono_profiler_startup (const char *desc)
-{
-       MonoProfiler *prof;
-
-       prof = g_new0 (MonoProfiler, 1);
-
-       if (strncmp ("link:", desc, 5) == 0 && desc [5])
-               prof->output_file = g_strdup (desc + 5);
-       else
-               prof->output_file = "link.xml";
-
-       prof->images = g_hash_table_new (NULL, NULL);
-
-       mono_profiler_install (prof, link_shutdown);
-
-       mono_profiler_install_enter_leave (NULL, link_method_leave);
-
-       mono_profiler_set_events (MONO_PROFILE_ENTER_LEAVE);
-}
diff --git a/mcs/tools/linker/standalone.make b/mcs/tools/linker/standalone.make
deleted file mode 100644 (file)
index f444215..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-
-MCS = mcs
-KEY_FILE = ../../class/mono.snk
-MONO.CECIL.DLL = Mono.Cecil.dll
-MCS_FLAGS = -debug -keyfile:$(KEY_FILE) -r:$(MONO.CECIL.DLL) -resource:Descriptors/mscorlib.xml -resource:Descriptors/System.xml -resource:Descriptors/System.Web.xml -resource:Descriptors/Mono.Posix.xml -resource:Descriptors/System.Drawing.xml
-LINKER = monolinker.exe
-
-all: config.make monolinker.exe monolinker
-
-monolinker: monolinker.in Makefile
-       sed "s,@prefix@,$(prefix)," < monolinker.in > monolinker
-       chmod +x monolinker
-
-monolinker.exe: Mono.Cecil.dll
-       $(MCS) $(MCS_FLAGS) @$(LINKER).sources /out:$(LINKER)
-
-Mono.Cecil.dll:
-       if pkg-config --atleast-version=0.5 mono-cecil; then \
-               cp `pkg-config --variable=Libraries mono-cecil` .; \
-       else \
-               echo You must install Mono.Cecil first; \
-               exit 1; \
-       fi
-
-clean:
-       rm -f $(LINKER) $(MONO.CECIL.DLL) monolinker
-
-install: all
-       mkdir -p $(prefix)/bin
-       mkdir -p $(prefix)/lib/monolinker
-       cp $(LINKER) $(MONO.CECIL.DLL) $(prefix)/lib/monolinker
-       cp monolinker $(prefix)/bin
-       cp man/monolinker.1 $(prefix)/share/man/man1
-
-config.make:
-       echo You must run configure first
-       exit 1
-
-include config.make
-
-run-test: all
-       cd ./Tests; \
-       make clean run-test; \
-       cd ..;
index 7d1897587fe4b05a0060720fa1fd32666d7ed0fd..14185713d52b8f96a57ddb6cd5453886e122e0b8 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index b7d609413570369bb804b5d8fa7a9a1dde28f182..a2ba4eb94c9fd23a7fbf679dc11c6bc1787c9215 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 31f5f4795db9f1253db4ca688d58a0fdec746ba6..f0a8a6d0141db3858a44eac384ca7b38b9be6fbd 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index f7074361022d4314aa934b4e5954245d5adacf89..17ed9971f2f90fb1e8cc11851737175932c2d788 100644 (file)
@@ -70,6 +70,13 @@ MONO = \
        MONO_PATH="$(topdir)/class/lib/$(PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" \
        $(RUNTIME) $(RUNTIME_FLAGS)
 
+DIFF = diff -rup
+DIFF_QUIET = diff --brief
+ifeq ($(PLATFORM), win32)
+DIFF = diff -rupZ
+DIFF_QUIET = diff --brief -Z
+endif
+
 dist-local: dist-default dist-tests
 
 dist-tests:
@@ -160,7 +167,7 @@ check-monodocer-addNonGeneric: $(PROGRAM)
        $(MONO) $(PROGRAM) update --exceptions=all -o Test/en.actual Test/DocTest-addNonGeneric-v2.dll
        $(MONO) $(PROGRAM) update --exceptions=all -o Test/en.actual Test/DocTest-addNonGeneric-v2.dll
        $(MONO) $(PROGRAM) update --exceptions=all -o Test/en.actual Test/DocTest-addNonGeneric-v2.dll
-       diff -rup Test/en.expected-addNonGeneric Test/en.actual
+       $(DIFF) Test/en.expected-addNonGeneric Test/en.actual
 
 check-monodocer-dropns-classic: $(PROGRAM)
        # tests the simplest --dropns case, a single class where the root namespace was dropped.
@@ -168,7 +175,7 @@ check-monodocer-dropns-classic: $(PROGRAM)
        $(MAKE) Test/DocTest-DropNS-classic.dll
        $(MONO) $(PROGRAM) update --exceptions=all -o Test/en.actual Test/DocTest-DropNS-classic.dll --api-style=classic
        $(MAKE) update-monodocer-dropns-unified
-       diff -rup Test/en.expected-dropns-classic-v1 Test/en.actual
+       $(DIFF) Test/en.expected-dropns-classic-v1 Test/en.actual
 
 check-monodocer-dropns-multi: $(PROGRAM)
        -rm -Rf Test/en.actual
@@ -185,7 +192,7 @@ check-monodocer-dropns-multi: $(PROGRAM)
        $(MONO) $(PROGRAM) update --exceptions=all -o Test/en.actual $(MULTI-CLASSIC) --api-style=classic 
        $(MONO) $(PROGRAM) update --exceptions=all -o Test/en.actual $(MULTI-UNIFIED) --api-style=unified --dropns Test/DocTest-DropNS-unified.dll=MyFramework --dropns Test/DocTest-DropNS-unified-multitest.dll=MyFramework 
        
-       diff -rup Test/en.expected-dropns-multi Test/en.actual
+       $(DIFF) Test/en.expected-dropns-multi Test/en.actual
 
 
 check-monodocer-dropns-multi-withexisting: $(PROGRAM)
@@ -203,7 +210,7 @@ check-monodocer-dropns-multi-withexisting: $(PROGRAM)
        $(MONO) $(PROGRAM) update --exceptions=all -o Test/en.actual $(MULTI-CLASSIC) --api-style=classic 
        $(MONO) $(PROGRAM) update --exceptions=all -o Test/en.actual $(MULTI-UNIFIED) --api-style=unified --dropns Test/DocTest-DropNS-unified.dll=MyFramework --dropns Test/DocTest-DropNS-unified-multitest.dll=MyFramework 
        
-       diff -rup Test/en.expected-dropns-multi-withexisting Test/en.actual
+       $(DIFF) Test/en.expected-dropns-multi-withexisting Test/en.actual
 
 check-monodocer-dropns-delete: $(PROGRAM)
        -rm -Rf Test/en.actual
@@ -217,7 +224,7 @@ check-monodocer-dropns-delete: $(PROGRAM)
        $(MONO) $(PROGRAM) update --delete --exceptions=all -o Test/en.actual Test/DocTest-DropNS-classic-deletetest.dll --api-style=classic
        $(MAKE) Test/DocTest-DropNS-unified-deletetest-V2.dll
        $(MONO) $(PROGRAM) update --delete --exceptions=all -o Test/en.actual Test/DocTest-DropNS-unified-deletetest.dll --api-style=unified --dropns Test/DocTest-DropNS-unified-deletetest.dll=MyFramework
-       diff -rup Test/en.expected-dropns-delete Test/en.actual
+       $(DIFF) Test/en.expected-dropns-delete Test/en.actual
 
 check-monodocer-dropns-classic-withsecondary: $(PROGRAM)
        # tests case where a secondary assembly is included with a --dropns parameter
@@ -226,7 +233,7 @@ check-monodocer-dropns-classic-withsecondary: $(PROGRAM)
        $(MAKE) Test/DocTest-DropNS-classic-secondary.dll
        $(MONO) $(PROGRAM) update --exceptions=all -o Test/en.actual Test/DocTest-DropNS-classic.dll Test/DocTest-DropNS-classic-secondary.dll --api-style=classic
        $(MAKE) update-monodocer-dropns-unified-withsecondary
-       diff -rup Test/en.expected-dropns-classic-withsecondary Test/en.actual
+       $(DIFF) Test/en.expected-dropns-classic-withsecondary Test/en.actual
 
 update-monodocer-dropns-unified: $(PROGRAM)
        $(MAKE) Test/DocTest-DropNS-unified.dll
@@ -245,13 +252,13 @@ check-monodocer-internal-interface: $(PROGRAM)
        -rm -Rf Test/en.actual
        $(MAKE) Test/DocTest-InternalInterface.dll
        $(MONO) $(PROGRAM) update --exceptions=all -o Test/en.actual Test/DocTest-InternalInterface.dll
-       diff -rup Test/en.expected-internal-interface Test/en.actual
+       $(DIFF) Test/en.expected-internal-interface Test/en.actual
 
 check-monodocer-enumerations: $(PROGRAM)
        -rm -Rf Test/en.actual
        $(MAKE) Test/DocTest-enumerations.dll
        $(MONO) $(PROGRAM) update --exceptions=all -o Test/en.actual Test/DocTest-enumerations.dll
-       diff -rup Test/en.expected-enumerations Test/en.actual
+       $(DIFF) Test/en.expected-enumerations Test/en.actual
 
 check-monodocer-update: $(PROGRAM)
        find Test/en.expected -name \*.xml -exec rm "{}" \;
@@ -262,9 +269,9 @@ check-monodocer: $(PROGRAM)
        -rm -Rf Test/en.actual
        $(MAKE) Test/DocTest.dll-v1
        $(MONO) $(PROGRAM) update --debug --exceptions=all -o Test/en.actual Test/DocTest.dll
-       diff -rup Test/en.expected Test/en.actual
+       $(DIFF) Test/en.expected Test/en.actual
        $(MONO) $(PROGRAM) update --debug --exceptions=all -o Test/en.actual Test/DocTest.dll 
-       diff -rup Test/en.expected Test/en.actual
+       $(DIFF) Test/en.expected Test/en.actual
 
 check-monodocer-since-update: $(PROGRAM)
        find Test/en.expected.since -name \*.xml -exec rm "{}" \;
@@ -281,7 +288,7 @@ check-monodocer-since: $(PROGRAM)
        $(MAKE) Test/DocTest.dll-v2
        $(MONO) $(PROGRAM) --debug update --exceptions=all --since="Version 2.0" \
                -o Test/en.actual Test/DocTest.dll 
-       diff -rup Test/en.expected.since Test/en.actual
+       $(DIFF) Test/en.expected.since Test/en.actual
 
 check-monodocer-delete-update: $(PROGRAM)
        find Test/en.expected.delete -type f -exec rm "{}" \;
@@ -301,7 +308,7 @@ check-monodocer-delete: $(PROGRAM)
        $(MONO) $(PROGRAM) --debug update --exceptions=all -o Test/en.actual Test/DocTest.dll
        $(MAKE) Test/DocTest.dll-v1
        $(MONO) $(PROGRAM) --debug update -fno-assembly-versions --delete --exceptions=all -o Test/en.actual Test/DocTest.dll
-       diff -rup Test/en.expected.delete Test/en.actual
+       $(DIFF) Test/en.expected.delete Test/en.actual
 
 check-monodocer-importslashdoc-update: $(PROGRAM)
        find Test/en.expected.importslashdoc -name \*.xml -exec rm "{}" \;
@@ -314,7 +321,7 @@ check-monodocer-importslashdoc: $(PROGRAM)
        $(MAKE) Test/DocTest.dll-v1 TEST_CSCFLAGS=-doc:Test/DocTest.xml
        $(MONO) $(PROGRAM) --debug update --exceptions=all -i Test/DocTest.xml \
                -o Test/en.actual Test/DocTest.dll 
-       diff -rup Test/en.expected.importslashdoc Test/en.actual
+       $(DIFF) Test/en.expected.importslashdoc Test/en.actual
 
 check-monodocer-importecmadoc-update: $(PROGRAM)
        find Test/en.expected.importecmadoc -name \*.xml -exec rm "{}" \;
@@ -331,7 +338,7 @@ check-monodocer-importecmadoc: $(PROGRAM)
                '--type=System.Action`1' --type=System.AsyncCallback \
                --type=System.Environment --type=System.Array \
                -o Test/en.actual Test/DocTest.dll 
-       diff -rup Test/en.expected.importecmadoc Test/en.actual
+       $(DIFF) Test/en.expected.importecmadoc Test/en.actual
 
 check-mdoc-export-html-update: $(PROGRAM)
        find Test/html.expected -name \*.html -exec rm "{}" \;
@@ -342,7 +349,7 @@ check-mdoc-export-html: check-monodocer $(PROGRAM)
        rm -Rf Test/html.actual
        $(MONO) $(PROGRAM) export-html -o Test/html.actual \
                Test/en.expected.importslashdoc
-       diff -rup Test/html.expected Test/html.actual
+       $(DIFF) Test/html.expected Test/html.actual
 
 check-mdoc-export-html-with-version: $(PROGRAM)
        rm -Rf Test/html.actual.v0 Test/html.actual.since-with-v0 .v0.txt .v2.txt
@@ -352,12 +359,12 @@ check-mdoc-export-html-with-version: $(PROGRAM)
                Test/en.expected.since -with-version 0.0.0.0
        (cd Test/html.actual.v0            && find . -type f) | sort > .v0.txt
        (cd Test/html.actual.since-with-v0 && find . -type f) | sort > .v2.txt
-       diff -rup .v0.txt .v2.txt   # assert no types added
+       $(DIFF) .v0.txt .v2.txt   # assert no types added
 
 check-md-html-dir: $(PROGRAM)
        rm -Rf Test/html.actual
        $(MONO) $(PROGRAM) export-html -dest:Test/html.actual $(DIR) 
-       diff -rup Test/html.expected Test/html.actual
+       $(DIFF) Test/html.expected Test/html.actual
 
 check-mdoc-export-msxdoc-update:
        $(MONO) $(PROGRAM) export-msxdoc -o - Test/en.expected.importslashdoc \
@@ -365,7 +372,7 @@ check-mdoc-export-msxdoc-update:
 
 check-mdoc-export-msxdoc:
        $(MONO) $(PROGRAM) export-msxdoc -o - Test/en.expected.importslashdoc \
-               | diff --brief - Test/msxdoc-expected.importslashdoc.xml
+               | $(DIFF_QUIET) - Test/msxdoc-expected.importslashdoc.xml
 
 my_abs_top_srcdir = $(shell cd . && pwd)
 
@@ -383,13 +390,13 @@ check-mdoc-validate-update: $(PROGRAM)
 check-mdoc-validate: $(PROGRAM)
        $(MONO) $(PROGRAM) validate -f ecma Test/en.expected 2>&1 | \
                sed 's#file://$(my_abs_top_srcdir)/##g' | \
-               diff - Test/validate.check.monodocer
+               $(DIFF_QUIET) - Test/validate.check.monodocer
        $(MONO) $(PROGRAM) validate -f ecma Test/en.expected.importslashdoc 2>&1 | \
                sed 's#file://$(my_abs_top_srcdir)/##g' | \
-               diff --brief - Test/validate.check.monodocer.importslashdoc
+               $(DIFF_QUIET) - Test/validate.check.monodocer.importslashdoc
        $(MONO) $(PROGRAM) validate -f ecma Test/en.expected.since 2>&1 | \
                sed 's#file://$(my_abs_top_srcdir)/##g' | \
-               diff --brief - Test/validate.check.monodocer.since
+               $(DIFF_QUIET) - Test/validate.check.monodocer.since
 
 run-test-local: check-doc-tools
 
index 17a06f060891da064887df3eab273b3662e1a723..f6de433088c2ec6019c4fbfdd926ef503182cf7c 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
       <Project>{359142A1-D80F-401E-AA64-7167C9317649}</Project>\r
       <Name>System.Core-net_4_x</Name>\r
     </ProjectReference>\r
-    <ProjectReference Include="../../class/Mono.Cecil/Mono.Cecil-net_4_x.csproj">\r
-      <Project>{2C0D558F-0B38-4691-967E-A910A1B995C1}</Project>\r
+    <ProjectReference Include="../../class/legacy/Mono.Cecil/Mono.Cecil-net_4_x.csproj">\r
+      <Project>{6DE38817-EC25-433A-AE58-0D30C5E6C460}</Project>\r
       <Name>Mono.Cecil-net_4_x</Name>\r
     </ProjectReference>\r
     <ProjectReference Include="../../class/ICSharpCode.SharpZipLib/ICSharpCode.SharpZipLib-net_4_x.csproj">\r
index 05faf5e8c685e1ec0ce4d295e848619f974d28c8..64a1b9cbf928bc1824705bdebd3d95049321cb23 100644 (file)
@@ -11,10 +11,23 @@ RESOURCE_FILES = $(OTHER_RES)
 LOCAL_MCS_FLAGS= $(OTHER_RES:%=-resource:%)
 
 LOCAL_MCS_FLAGS += -d:STATIC,NO_SYMBOL_WRITER,NO_AUTHENTICODE
-LIB_REFS = System.Xml System System.Core
+LIB_REFS = System.Xml System System.Core System.IO.Compression.FileSystem
 
 EXTRA_DISTFILES = $(RESOURCE_FILES)
 
 include ../../build/executable.make
 
 mkbundle.exe: $(RESOURCE_FILES)
+
+test-simple: simple.exe
+       mono --debug $(the_lib) --simple simple.exe -o foo && ./foo
+       mono --debug $(the_lib) --cross default simple.exe -o foo && ./foo
+       mono --debug $(the_lib) --sdk `dirname \`which mono\``/.. simple.exe -o foo && ./foo
+       -rm DEMO.zip
+       mono-package-runtime `dirname \`which mono\``/.. DEMO
+       mkdir -p ~/.mono/targets/DEMO
+       unzip -d ~/.mono/targets/DEMO DEMO.zip
+       mono --debug $(the_lib) --cross DEMO simple.exe -o foo && ./foo
+
+simple.exe: Makefile
+       echo 'class X { static void Main () { System.Console.WriteLine ("OK");}}' > simple.cs && mcs simple.cs
index d8ea3865287329a901f2ff209de6d760d85386d8..1cdfb4653e647bcdeb145806c6a6e538483e2a92 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;STATIC;NO_SYMBOL_WRITER;NO_AUTHENTICODE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;STATIC;NO_SYMBOL_WRITER;NO_AUTHENTICODE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>STATIC;NO_SYMBOL_WRITER;NO_AUTHENTICODE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>STATIC;NO_SYMBOL_WRITER;NO_AUTHENTICODE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
       <Project>{359142A1-D80F-401E-AA64-7167C9317649}</Project>\r
       <Name>System.Core-net_4_x</Name>\r
     </ProjectReference>\r
+    <ProjectReference Include="../../class/System.IO.Compression.FileSystem/System.IO.Compression.FileSystem-net_4_x.csproj">\r
+      <Project>{9E61FF2E-493E-4CA0-BBDA-2EF96A4CB058}</Project>\r
+      <Name>System.IO.Compression.FileSystem-net_4_x</Name>\r
+    </ProjectReference>\r
   </ItemGroup>\r
   <ItemGroup>\r
     <Folder Include="Properties\" />\r
index 86a7132bbcbbda9dba00aa6085418e760a62a817..1ea1d7402455704a22e4b237c25c8fe15f3d3f9b 100755 (executable)
@@ -3,6 +3,16 @@
 //
 // Based on the `make-bundle' Perl script written by Paolo Molaro (lupus@debian.org)
 //
+// TODO:
+//   [x] Rename the paths for the zip file that is downloaded
+//   [x] Update documentation with new flag
+//   [x] Load internationalized assemblies
+//   [x] Dependencies - if System.dll -> include Mono.Security.* (not needed, automatic)
+//   [x] --list-targets should download from a different url
+//   [x] --fetch-target should unpack zip file
+//   [x] Update --cross to use not a runtime, but an SDK
+//   [x] Update --local-targets to show the downloaded SDKs
+//
 // Author:
 //   Miguel de Icaza
 //
@@ -23,7 +33,6 @@ using System.Runtime.InteropServices;
 using System.Text;
 using IKVM.Reflection;
 using System.Linq;
-using System.Diagnostics;
 using System.Net;
 using System.Threading.Tasks;
 
@@ -31,6 +40,7 @@ class MakeBundle {
        static string output = "a.out";
        static string object_out = null;
        static List<string> link_paths = new List<string> ();
+       static Dictionary<string,string> libraries = new Dictionary<string,string> ();
        static bool autodeps = false;
        static bool keeptemp = false;
        static bool compile_only = false;
@@ -46,12 +56,27 @@ class MakeBundle {
        static bool? use_dos2unix = null;
        static bool skip_scan;
        static string ctor_func;
-       static bool quiet;
+       static bool quiet = true;
        static string cross_target = null;
        static string fetch_target = null;
        static bool custom_mode = true;
        static string embedded_options = null;
        static string runtime = null;
+       static string sdk_path = null;
+       static string lib_path = null;
+       static Dictionary<string,string> environment = new Dictionary<string,string>();
+       static string [] i18n = new string [] {
+               "West",
+               ""
+       };
+       static string [] i18n_all = new string [] {
+               "CJK", 
+               "MidEast",
+               "Other",
+               "Rare",
+               "West",
+               ""
+       };
        static string target_server = "https://download.mono-project.com/runtimes/raw/";
        
        static int Main (string [] args)
@@ -61,7 +86,7 @@ class MakeBundle {
                link_paths.Add (".");
 
                DetectOS ();
-               
+
                for (int i = 0; i < top; i++){
                        switch (args [i]){
                        case "--help": case "-h": case "-?":
@@ -72,6 +97,24 @@ class MakeBundle {
                                custom_mode = false;
                                autodeps = true;
                                break;
+
+                       case "-v":
+                               quiet = false;
+                               break;
+                               
+                       case "--i18n":
+                               if (i+1 == top){
+                                       Help ();
+                                       return 1;
+                               }
+                               var iarg = args [++i];
+                               if (iarg == "all")
+                                       i18n = i18n_all;
+                               else if (iarg == "none")
+                                       i18n = new string [0];
+                               else
+                                       i18n = iarg.Split (',');
+                               break;
                                
                        case "--custom":
                                custom_mode = true;
@@ -90,11 +133,38 @@ class MakeBundle {
                                        Help (); 
                                        return 1;
                                }
+                               if (sdk_path != null || runtime != null)
+                                       Error ("You can not specify one of --runtime, --sdk or --cross");
                                custom_mode = false;
                                autodeps = true;
                                cross_target = args [++i];
                                break;
 
+                       case "--library":
+                               if (i+1 == top){
+                                       Help (); 
+                                       return 1;
+                               }
+                               if (custom_mode){
+                                       Console.Error.WriteLine ("--library can only be used with --simple/--runtime/--cross mode");
+                                       Help ();
+                                       return 1;
+                               }
+                               var lspec = args [++i];
+                               var p = lspec.IndexOf (",");
+                               string alias, path;
+                               if (p == -1){
+                                       alias = Path.GetFileName (lspec);
+                                       path = lspec;
+                               } else {
+                                       alias = lspec.Substring (0, p);
+                                       path = lspec.Substring (p+1);
+                               }
+                               if (!File.Exists (path))
+                                       Error ($"The specified library file {path} does not exist");
+                               libraries [alias] = path;
+                               break;
+
                        case "--fetch-target":
                                if (i+1 == top){
                                        Help (); 
@@ -104,10 +174,10 @@ class MakeBundle {
                                break;
 
                        case "--list-targets":
+                               CommandLocalTargets ();
                                var wc = new WebClient ();
-                               var s = wc.DownloadString (new Uri (target_server + "target-list.txt"));
-                               Console.WriteLine ("Cross-compilation targets available:\n" + s);
-                               
+                               var s = wc.DownloadString (new Uri (target_server + "target-sdks.txt"));
+                               Console.WriteLine ("Targets available for download with --fetch-target:\n" + s);
                                return 0;
                                
                        case "--target-server":
@@ -133,11 +203,26 @@ class MakeBundle {
                                }
                                embedded_options = args [++i];
                                break;
+                       case "--sdk":
+                               if (i + 1 == top) {
+                                       Help ();
+                                       return 1;
+                               }
+                               custom_mode = false;
+                               autodeps = true;
+                               sdk_path = args [++i];
+                               if (cross_target != null || runtime != null)
+                                       Error ("You can not specify one of --runtime, --sdk or --cross");
+                               break;
                        case "--runtime":
                                if (i+1 == top){
                                        Help (); 
                                        return 1;
                                }
+                               if (sdk_path != null || cross_target != null)
+                                       Error ("You can only specify one of --runtime, --sdk or --cross");
+                               custom_mode = false;
+                               autodeps = true;
                                runtime = args [++i];
                                break;
                        case "-oo":
@@ -223,7 +308,7 @@ class MakeBundle {
                                case "linux":
                                        break;
                                default:
-                                       Console.Error.WriteLine ("Invalid style '{0}' - only 'windows', 'mac' and 'linux' are supported for --style argument", style);
+                                       Error ("Invalid style '{0}' - only 'windows', 'mac' and 'linux' are supported for --style argument", style);
                                        return 1;
                                }
                                        
@@ -249,27 +334,58 @@ class MakeBundle {
                        case "--quiet":
                                quiet = true;
                                break;
+                       case "-e":
+                       case "--env":
+                               if (i+1 == top) {
+                                       Help ();
+                                       return 1;
+                               }
+                               var env = args [++i];
+                               p = env.IndexOf ('=');
+                               if (p == -1)
+                                       environment.Add (env, "");
+                               else
+                                       environment.Add (env.Substring (0, p), env.Substring (p+1));
+                               break;
                        default:
                                sources.Add (args [i]);
                                break;
                        }
 
                }
+               // Modern bundling starts here
+               if (!custom_mode){
+                       if (runtime != null){
+                               // Nothing to do here, the user has chosen to manually specify --runtime nad libraries
+                       } else if (sdk_path != null) {
+                               VerifySdk (sdk_path);
+                       } else if (cross_target == "default" || cross_target == null){
+                               sdk_path = Path.GetFullPath (Path.Combine (Process.GetCurrentProcess().MainModule.FileName, "..", ".."));
+                               VerifySdk (sdk_path);
+                       } else {
+                               sdk_path = Path.Combine (targets_dir, cross_target);
+                               Console.WriteLine ("From: " + sdk_path);
+                               VerifySdk (sdk_path);
+                       }
+               }
 
                if (fetch_target != null){
-                       var truntime = Path.Combine (targets_dir, fetch_target, "mono");
-                       Directory.CreateDirectory (Path.GetDirectoryName (truntime));
+                       var directory = Path.Combine (targets_dir, fetch_target);
+                       var zip_download = Path.Combine (directory, "sdk.zip");
+                       Directory.CreateDirectory (Path.GetDirectoryName (directory));
                        var wc = new WebClient ();
                        var uri = new Uri ($"{target_server}{fetch_target}");
                        try {
                                if (!quiet){
-                                       Console.WriteLine ($"Downloading runtime {uri} to {truntime}");
+                                       Console.WriteLine ($"Downloading runtime {uri} to {zip_download}");
                                }
                                
-                               wc.DownloadFile (uri, truntime);
+                               wc.DownloadFile (uri, zip_download);
+                               ZipFile.ExtractToDirectory(zip_download, directory);
+                               File.Delete (zip_download);
                        } catch {
                                Console.Error.WriteLine ($"Failure to download the specified runtime from {uri}");
-                               File.Delete (truntime);
+                               File.Delete (zip_download);
                                return 1;
                        }
                        return 0;
@@ -286,49 +402,41 @@ class MakeBundle {
                }
 
                List<string> assemblies = LoadAssemblies (sources);
+               LoadLocalizedAssemblies (assemblies);
                List<string> files = new List<string> ();
                foreach (string file in assemblies)
                        if (!QueueAssembly (files, file))
                                return 1;
-
                if (custom_mode)
                        GenerateBundles (files);
-               else {
-                       if (cross_target == "default")
-                               runtime = null;
-                       else {
-                               if (runtime == null){
-                                       if (cross_target == null){
-                                               Console.Error.WriteLine ("you should specify either a --runtime or a --cross compilation target");
-                                               Environment.Exit (1);
-                                       }
-                                       runtime = Path.Combine (targets_dir, cross_target, "mono");
-                                       if (!File.Exists (runtime)){
-                                               Console.Error.WriteLine ($"The runtime for the {cross_target} does not exist, use --fetch-target {cross_target} to download first");
-                                               return 1;
-                                       }
-                               } else {
-                                       if (!File.Exists (runtime)){
-                                               Console.Error.WriteLine ($"The Mono runtime specified with --runtime does not exist");
-                                               return 1;
-                                       }
-                               }
-                               
-                               Console.WriteLine ("Using runtime {0}", runtime);
-                       }
+               else 
                        GeneratePackage (files);
-               }
-               
+
+               Console.WriteLine ("Generated {0}", output);
+
                return 0;
        }
 
+       static void VerifySdk (string path)
+       {
+               if (!Directory.Exists (path))
+                       Error ($"The specified SDK path does not exist: {path}");
+               runtime = Path.Combine (sdk_path, "bin", "mono");
+               if (!File.Exists (runtime))
+                       Error ($"The SDK location does not contain a {path}/bin/mono runtime");
+               lib_path = Path.Combine (path, "lib", "mono", "4.5");
+               if (!Directory.Exists (lib_path))
+                       Error ($"The SDK location does not contain a {path}/lib/mono/4.5 directory");
+               link_paths.Add (lib_path);
+       }
+
        static string targets_dir = Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.Personal), ".mono", "targets");
        
        static void CommandLocalTargets ()
        {
                string [] targets;
 
-               Console.WriteLine ("Available targets:");
+               Console.WriteLine ("Available targets locally:");
                Console.WriteLine ("\tdefault\t- Current System Mono");
                try {
                        targets = Directory.GetDirectories (targets_dir);
@@ -336,7 +444,7 @@ class MakeBundle {
                        return;
                }
                foreach (var target in targets){
-                       var p = Path.Combine (target, "mono");
+                       var p = Path.Combine (target, "bin", "mono");
                        if (File.Exists (p))
                                Console.WriteLine ("\t{0}", Path.GetFileName (target));
                }
@@ -420,8 +528,9 @@ class MakeBundle {
                {
                        using (Stream fileStream = File.OpenRead (fname)){
                                var ret = fileStream.Length;
-                               
-                               Console.WriteLine ("At {0:x} with input {1}", package.Position, fileStream.Length);
+
+                               if (!quiet)
+                                       Console.WriteLine ("At {0:x} with input {1}", package.Position, fileStream.Length);
                                fileStream.CopyTo (package);
                                package.Position = package.Position + (align - (package.Position % align));
 
@@ -445,8 +554,30 @@ class MakeBundle {
                        package.Position = package.Position + (align - (package.Position % align));
                }
 
+               public void AddStringPair (string entry, string key, string value)
+               {
+                       var kbytes = Encoding.UTF8.GetBytes (key);
+                       var vbytes = Encoding.UTF8.GetBytes (value);
+
+                       Console.WriteLine ("ADDING {0} to {1}", key, value);
+                       if (kbytes.Length > 255){
+                               Console.WriteLine ("The key value can not exceed 255 characters: " + key);
+                               Environment.Exit (1);
+                       }
+                               
+                       locations [entry] = Tuple.Create (package.Position, kbytes.Length+vbytes.Length+3);
+                       package.WriteByte ((byte)kbytes.Length);
+                       package.Write (kbytes, 0, kbytes.Length);
+                       package.WriteByte (0);
+                       package.Write (vbytes, 0, vbytes.Length);
+                       package.WriteByte (0);
+                       package.Position = package.Position + (align - (package.Position % align));
+               }
+
                public void Dump ()
                {
+                       if (quiet)
+                               return;
                        foreach (var floc in locations.Keys){
                                Console.WriteLine ($"{floc} at {locations[floc]:x}");
                        }
@@ -485,7 +616,7 @@ class MakeBundle {
                        return true;
                
                if (!File.Exists (file)){
-                       Console.Error.WriteLine ("The file {0} does not exist", file);
+                       Error ("The file {0} does not exist", file);
                        return false;
                }
                maker.Add (code, file);
@@ -498,31 +629,36 @@ class MakeBundle {
                        if (IsUnix)
                                runtime = Process.GetCurrentProcess().MainModule.FileName;
                        else {
-                               Console.Error.WriteLine ("You must specify at least one runtime with --runtime or --cross");
+                               Error ("You must specify at least one runtime with --runtime or --cross");
                                Environment.Exit (1);
                        }
                }
                if (!File.Exists (runtime)){
-                       Console.Error.WriteLine ($"The specified runtime at {runtime} does not exist");
+                       Error ($"The specified runtime at {runtime} does not exist");
                        Environment.Exit (1);
                }
                
                if (ctor_func != null){
-                       Console.Error.WriteLine ("--static-ctor not supported with package bundling, you must use native compilation for this");
+                       Error ("--static-ctor not supported with package bundling, you must use native compilation for this");
                        return false;
                }
                
                var maker = new PackageMaker (output);
+               Console.WriteLine ("Using runtime: " + runtime);
                maker.AddFile (runtime);
                
                foreach (var url in files){
                        string fname = LocateFile (new Uri (url).LocalPath);
-                       string aname = Path.GetFileName (fname);
+                       string aname = MakeBundle.GetAssemblyName (fname);
 
                        maker.Add ("assembly:" + aname, fname);
-                       if (File.Exists (fname + ".config"))
+                       Console.WriteLine ("     Assembly: " + fname);
+                       if (File.Exists (fname + ".config")){
                                maker.Add ("config:" + aname, fname + ".config");
+                               Console.WriteLine ("       Config: " + runtime);
+                       }
                }
+               
                if (!MaybeAddFile (maker, "systemconfig:", config_file) || !MaybeAddFile (maker, "machineconfig:", machine_config_file))
                        return false;
 
@@ -530,6 +666,16 @@ class MakeBundle {
                        maker.Add ("config_dir:", config_dir);
                if (embedded_options != null)
                        maker.AddString ("options:", embedded_options);
+               if (environment.Count > 0){
+                       foreach (var key in environment.Keys)
+                               maker.AddStringPair ("env:" + key, key, environment [key]);
+               }
+               if (libraries.Count > 0){
+                       foreach (var alias_and_path in libraries){
+                               Console.WriteLine ("     Library:  " + alias_and_path.Value);
+                               maker.Add ("library:" + alias_and_path.Key, alias_and_path.Value);
+                       }
+               }
                maker.Dump ();
                maker.Close ();
                return true;
@@ -623,7 +769,7 @@ void          mono_register_config_for_assembly (const char* assembly_name, cons
                        var symbolEscapeRE = new System.Text.RegularExpressions.Regex ("[^\\w_]");
                        foreach (var url in files) {
                                string fname = LocateFile (new Uri (url).LocalPath);
-                               string aname = Path.GetFileName (fname);
+                               string aname = MakeBundle.GetAssemblyName (fname);
                                string encoded = symbolEscapeRE.Replace (aname, "_");
 
                                if (prog == null)
@@ -676,7 +822,7 @@ void          mono_register_config_for_assembly (const char* assembly_name, cons
                                try {
                                        conf = File.OpenRead (config_file);
                                } catch {
-                                       Error (String.Format ("Failure to open {0}", config_file));
+                                       Error ("Failure to open {0}", config_file);
                                        return;
                                }
                                if (!quiet)
@@ -695,7 +841,7 @@ void          mono_register_config_for_assembly (const char* assembly_name, cons
                                try {
                                        conf = File.OpenRead (machine_config_file);
                                } catch {
-                                       Error (String.Format ("Failure to open {0}", machine_config_file));
+                                       Error ("Failure to open {0}", machine_config_file);
                                        return;
                                }
                                if (!quiet)
@@ -782,7 +928,7 @@ void          mono_register_config_for_assembly (const char* assembly_name, cons
                                string monoPath = GetEnv("MONOPREFIX", @"C:\Program Files (x86)\Mono");
 
                                string[] includes = new string[] {winsdkPath + @"\Include\um", winsdkPath + @"\Include\shared", vsPath + @"\include", monoPath + @"\include\mono-2.0", "." };
-                               string[] libs = new string[] { winsdkPath + @"\Lib\winv6.3\um\x86" , vsPath + @"\lib" };
+                               // string[] libs = new string[] { winsdkPath + @"\Lib\winv6.3\um\x86" , vsPath + @"\lib" };
                                var linkLibraries = new string[] {  "kernel32.lib",
                                                                                                "version.lib",
                                                                                                "Ws2_32.lib",
@@ -903,10 +1049,10 @@ void          mono_register_config_for_assembly (const char* assembly_name, cons
        {
                List<string> assemblies = new List<string> ();
                bool error = false;
-               
+
                foreach (string name in sources){
                        try {
-                               Assembly a = LoadAssembly (name);
+                               Assembly a = LoadAssemblyFile (name);
 
                                if (a == null){
                                        error = true;
@@ -927,24 +1073,75 @@ void          mono_register_config_for_assembly (const char* assembly_name, cons
 
                if (error)
                        Environment.Exit (1);
-
+               
                return assemblies;
        }
+
+       static void LoadLocalizedAssemblies (List<string> assemblies)
+       {
+               var other = i18n.Select (x => "I18N." + x + (x.Length > 0 ? "." : "") + "dll");
+               bool error = false;
+
+               foreach (string name in other) {
+                       try {
+                               Assembly a = LoadAssembly (name);
+
+                               if (a == null) {
+                                       error = true;
+                                       continue;
+                               }
+
+                               assemblies.Add (a.CodeBase);
+                       } catch (Exception) {
+                               if (skip_scan) {
+                                       if (!quiet)
+                                               Console.WriteLine ("File will not be scanned: {0}", name);
+                                       assemblies.Add (new Uri (new FileInfo (name).FullName).ToString ());
+                               } else {
+                                       throw;
+                               }
+                       }
+               }
+
+               if (error)
+                       Environment.Exit (1);
+       }
+
        
        static readonly Universe universe = new Universe ();
        static readonly Dictionary<string, string> loaded_assemblies = new Dictionary<string, string> ();
-       
+
+       public static string GetAssemblyName (string path)
+       {
+               string name = Path.GetFileName (path);
+
+               // A bit of a hack to support satellite assemblies. They all share the same name but
+               // are placed in subdirectories named after the locale they implement. Also, all of
+               // them end in .resources.dll, therefore we can use that to detect the circumstances.
+               if (name.EndsWith (".resources.dll", StringComparison.OrdinalIgnoreCase)) {
+                       string dir = Path.GetDirectoryName (path);
+                       int idx = dir.LastIndexOf (Path.DirectorySeparatorChar);
+                       if (idx >= 0) {
+                               name = dir.Substring (idx + 1) + Path.DirectorySeparatorChar + name;
+                               Console.WriteLine ($"Storing satellite assembly '{path}' with name '{name}'");
+                       } else if (!quiet)
+                               Console.WriteLine ($"Warning: satellite assembly {path} doesn't have locale path prefix, name conflicts possible");
+               }
+
+               return name;
+       }
+
        static bool QueueAssembly (List<string> files, string codebase)
        {
-               // Console.WriteLine ("CODE BASE IS {0}", codebase);
+               //Console.WriteLine ("CODE BASE IS {0}", codebase);
                if (files.Contains (codebase))
                        return true;
 
                var path = new Uri(codebase).LocalPath;
-               var name = Path.GetFileName (path);
+               var name = GetAssemblyName (path);
                string found;
                if (loaded_assemblies.TryGetValue (name, out found)) {
-                       Error (string.Format ("Duplicate assembly name `{0}'. Both `{1}' and `{2}' use same assembly name.", name, path, found));
+                       Error ("Duplicate assembly name `{0}'. Both `{1}' and `{2}' use same assembly name.", name, path, found);
                        return false;
                }
 
@@ -957,7 +1154,7 @@ void          mono_register_config_for_assembly (const char* assembly_name, cons
                        Assembly a = universe.LoadFile (path);
 
                        foreach (AssemblyName an in a.GetReferencedAssemblies ()) {
-                               a = universe.Load (an.FullName);
+                               LoadAssembly (an.FullName);
                                if (!QueueAssembly (files, a.CodeBase))
                                        return false;
                        }
@@ -969,56 +1166,57 @@ void          mono_register_config_for_assembly (const char* assembly_name, cons
                return true;
        }
 
-       static Assembly LoadAssembly (string assembly)
+       //
+       // Loads an assembly from a specific path
+       //
+       static Assembly LoadAssemblyFile (string assembly)
        {
-               Assembly a;
+               Assembly a = null;
                
                try {
-                       char[] path_chars = { '/', '\\' };
-                       
-                       if (assembly.IndexOfAny (path_chars) != -1) {
-                               a = universe.LoadFile (assembly);
-                       } else {
-                               string ass = assembly;
-                               if (ass.EndsWith (".dll"))
-                                       ass = assembly.Substring (0, assembly.Length - 4);
-                               a = universe.Load (ass);
-                       }
-                       return a;
+                       a = universe.LoadFile (assembly);
                } catch (FileNotFoundException){
-                       string total_log = "";
-                       
-                       foreach (string dir in link_paths){
-                               string full_path = Path.Combine (dir, assembly);
-                               if (!assembly.EndsWith (".dll") && !assembly.EndsWith (".exe"))
-                                       full_path += ".dll";
-                               
-                               try {
-                                       a = universe.LoadFile (full_path);
-                                       return a;
-                               } catch (FileNotFoundException ff) {
-                                       total_log += ff.FusionLog;
-                                       continue;
-                               }
-                       }
-                       Error ("Cannot find assembly `" + assembly + "'" );
-                       if (!quiet)
-                               Console.WriteLine ("Log: \n" + total_log);
+                       Error ($"Cannot find assembly `{assembly}'");
                } catch (IKVM.Reflection.BadImageFormatException f) {
                        if (skip_scan)
                                throw;
-                       Error ("Cannot load assembly (bad file format) " + f.Message);
+                       Error ($"Cannot load assembly (bad file format) " + f.Message);
                } catch (FileLoadException f){
-                       Error ("Cannot load assembly " + f.Message);
+                       Error ($"Cannot load assembly " + f.Message);
                } catch (ArgumentNullException){
-                       Error("Cannot load assembly (null argument)");
+                       Error( $"Cannot load assembly (null argument)");
                }
-               return null;
+               return a;
        }
 
-       static void Error (string msg)
+       //
+       // Loads an assembly from any of the link directories provided
+       //
+       static Assembly LoadAssembly (string assembly)
+       {
+               string total_log = "";
+               foreach (string dir in link_paths){
+                       string full_path = Path.Combine (dir, assembly);
+                       if (!assembly.EndsWith (".dll") && !assembly.EndsWith (".exe"))
+                               full_path += ".dll";
+                       
+                       try {
+                               var a = universe.LoadFile (full_path);
+                               return a;
+                       } catch (FileNotFoundException ff) {
+                               total_log += ff.FusionLog;
+                               continue;
+                       }
+               }
+               if (!quiet)
+                       Console.WriteLine ("Log: \n" + total_log);
+               return null;
+       }
+       
+       static void Error (string msg, params object [] args)
        {
-               Console.Error.WriteLine ("ERROR: " + msg);
+               Console.Error.WriteLine ("ERROR: {0}", string.Format (msg, args));
+               throw new Exception ();
                Environment.Exit (1);
        }
 
@@ -1026,37 +1224,44 @@ void          mono_register_config_for_assembly (const char* assembly_name, cons
        {
                Console.WriteLine ("Usage is: mkbundle [options] assembly1 [assembly2...]\n\n" +
                                   "Options:\n" +
-                                  "    --config F          Bundle system config file `F'\n" +
-                                  "    --config-dir D      Set MONO_CFG_DIR to `D'\n" +
-                                  "    --deps              Turns on automatic dependency embedding (default on simple)\n" +
-                                  "    -L path             Adds `path' to the search path for assemblies\n" +
-                                  "    --machine-config F  Use the given file as the machine.config for the application.\n" +
-                                  "    -o out              Specifies output filename\n" +
-                                  "    --nodeps            Turns off automatic dependency embedding (default on custom)\n" +
-                                  "    --skip-scan         Skip scanning assemblies that could not be loaded (but still embed them).\n" +
+                                  "    --config F           Bundle system config file `F'\n" +
+                                  "    --config-dir D       Set MONO_CFG_DIR to `D'\n" +
+                                  "    --deps               Turns on automatic dependency embedding (default on simple)\n" +
+                                  "    -L path              Adds `path' to the search path for assemblies\n" +
+                                  "    --machine-config F   Use the given file as the machine.config for the application.\n" +
+                                  "    -o out               Specifies output filename\n" +
+                                  "    --nodeps             Turns off automatic dependency embedding (default on custom)\n" +
+                                  "    --skip-scan          Skip scanning assemblies that could not be loaded (but still embed them).\n" +
+                                  "    --i18n ENCODING      none, all or comma separated list of CJK, MidWest, Other, Rare, West.\n" +
+                                  "    -v                   Verbose output\n" + 
                                   "\n" + 
                                   "--simple   Simple mode does not require a C toolchain and can cross compile\n" + 
-                                  "    --cross TARGET      Generates a binary for the given TARGET\n"+
-                                  "    --local-targets     Lists locally available targets\n" +
-                                  "    --list-targets      Lists available targets on the remote server\n" +
-                                  "    --options OPTIONS   Embed the specified Mono command line options on target\n" +
-                                  "    --runtime RUNTIME   Manually specifies the Mono runtime to use\n" +
-                                  "    --target-server URL Specified a server to download targets from, default is " + target_server + "\n" +
+                                  "    --cross TARGET       Generates a binary for the given TARGET\n"+
+                                  "    --env KEY=VALUE      Hardcodes an environment variable for the target\n" +
+                                  "    --fetch-target NAME  Downloads the target SDK from the remote server\n" + 
+                                  "    --library [LIB,]PATH Bundles the specified dynamic library to be used at runtime\n" +
+                                  "                         LIB is optional shortname for file located at PATH\n" + 
+                                  "    --list-targets       Lists available targets on the remote server\n" +
+                                  "    --local-targets      Lists locally available targets\n" +
+                                  "    --options OPTIONS    Embed the specified Mono command line options on target\n" +
+                                  "    --runtime RUNTIME    Manually specifies the Mono runtime to use\n" +
+                                  "    --sdk PATH           Use a Mono SDK root location instead of a target\n" + 
+                                  "    --target-server URL  Specified a server to download targets from, default is " + target_server + "\n" +
                                   "\n" +
                                   "--custom   Builds a custom launcher, options for --custom\n" +
-                                  "    -c                  Produce stub only, do not compile\n" +
-                                  "    -oo obj             Specifies output filename for helper object file\n" +
+                                  "    -c                   Produce stub only, do not compile\n" +
+                                  "    -oo obj              Specifies output filename for helper object file\n" +
                                   "    --dos2unix[=true|false]\n" +
-                                  "                        When no value provided, or when `true` specified\n" +
-                                  "                        `dos2unix` will be invoked to convert paths on Windows.\n" +
-                                  "                        When `--dos2unix=false` used, dos2unix is NEVER used.\n" +
-                                  "    --keeptemp          Keeps the temporary files\n" +
-                                  "    --static            Statically link to mono libs\n" +
-                                  "    --nomain            Don't include a main() function, for libraries\n" +
-                                  "    --custom-main C     Link the specified compilation unit (.c or .obj) with entry point/init code\n" +
-                                  "    -z                  Compress the assemblies before embedding.\n" +
-                                  "    --static-ctor ctor  Add a constructor call to the supplied function.\n" +
-                                  "                        You need zlib development headers and libraries.\n");
+                                  "                         When no value provided, or when `true` specified\n" +
+                                  "                         `dos2unix` will be invoked to convert paths on Windows.\n" +
+                                  "                         When `--dos2unix=false` used, dos2unix is NEVER used.\n" +
+                                  "    --keeptemp           Keeps the temporary files\n" +
+                                  "    --static             Statically link to mono libs\n" +
+                                  "    --nomain             Don't include a main() function, for libraries\n" +
+                                  "    --custom-main C      Link the specified compilation unit (.c or .obj) with entry point/init code\n" +
+                                  "    -z                   Compress the assemblies before embedding.\n" +
+                                  "    --static-ctor ctor   Add a constructor call to the supplied function.\n" +
+                                  "                         You need zlib development headers and libraries.\n");
        }
 
        [DllImport ("libc")]
@@ -1171,7 +1376,7 @@ void          mono_register_config_for_assembly (const char* assembly_name, cons
                        p.WaitForExit ();
                        int ret = p.ExitCode;
                        if (ret != 0){
-                               Error (String.Format("[Fail] {0}", ret));
+                               Error ("[Fail] {0}", ret);
                        }
                }
        }
index ad6b3cdb6f7f042af085c6259ebd40c197137980..1a30e07048d93e1c9fee34c64a56f72a4e30219f 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index e1c55c1f0a52f1e9e7a30de32d7b01b8d08c199a..18aa8cf854f508eb4660b9887f68cf8a8f13e83b 100644 (file)
@@ -2,7 +2,7 @@ thisdir = tools/mono-api-html
 SUBDIRS =
 include ../../build/rules.make
 
-LIB_REFS = Mono.Cecil System.Xml System.Core System System.Xml.Linq
+LIB_REFS = System.Xml System.Core System System.Xml.Linq
 LOCAL_MCS_FLAGS =
 
 PROGRAM = mono-api-html.exe
index e99f07415765bc21b618798f6d7c132a22d0a1e1..2acb5ca3f5ac98c5c743ea4235ce938a46b4ecb9 100644 (file)
@@ -342,10 +342,19 @@ namespace Xamarin.ApiDiff {
                                if (i > 0)
                                        change.Append (", ");
 
+                               string mods_tgt = tgt [i].GetAttribute ("direction") ?? "";
+                               string mods_src = src [i].GetAttribute ("direction") ?? "";
+
+                               if (mods_tgt.Length > 0)
+                                       mods_tgt = mods_tgt + " ";
+
+                               if (mods_src.Length > 0)
+                                       mods_src = mods_src + " ";
+
                                if (i >= srcCount) {
-                                       change.AppendAdded (tgt [i].GetTypeName ("type") + " " + tgt [i].GetAttribute ("name"), true);
+                                       change.AppendAdded (mods_tgt + tgt [i].GetTypeName ("type") + " " + tgt [i].GetAttribute ("name"), true);
                                } else if (i >= tgtCount) {
-                                       change.AppendRemoved (src [i].GetTypeName ("type") + " " + src [i].GetAttribute ("name"), true);
+                                       change.AppendRemoved (mods_src + src [i].GetTypeName ("type") + " " + src [i].GetAttribute ("name"), true);
                                } else {
                                        var paramSourceType = src [i].GetTypeName ("type");
                                        var paramTargetType = tgt [i].GetTypeName ("type");
@@ -353,6 +362,12 @@ namespace Xamarin.ApiDiff {
                                        var paramSourceName = src [i].GetAttribute ("name");
                                        var paramTargetName = tgt [i].GetAttribute ("name");
 
+                                       if (mods_src != mods_tgt) {
+                                               change.AppendModified (mods_src, mods_tgt, true);
+                                       } else {
+                                               change.Append (mods_src);
+                                       }
+
                                        if (paramSourceType != paramTargetType) {
                                                change.AppendModified (paramSourceType, paramTargetType, true);
                                        } else {
@@ -360,7 +375,7 @@ namespace Xamarin.ApiDiff {
                                        }
                                        change.Append (" ");
                                        if (paramSourceName != paramTargetName) {
-                                               change.AppendModified (paramSourceName, paramTargetName, false);
+                                               change.AppendModified (paramSourceName, paramTargetName, true);
                                        } else {
                                                change.Append (paramSourceName);
                                        }
index 904e60cd013cd2e206b5ccb682ce0a64e63c3df7..09cc201b497b070e0c041748935a7735f6bc19af 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
       <Project>{2CA6026B-2DC8-4C4C-A12C-1E8234049DB7}</Project>\r
       <Name>corlib-net_4_x</Name>\r
     </ProjectReference>\r
-    <ProjectReference Include="../../class/Mono.Cecil/Mono.Cecil-net_4_x.csproj">\r
-      <Project>{2C0D558F-0B38-4691-967E-A910A1B995C1}</Project>\r
-      <Name>Mono.Cecil-net_4_x</Name>\r
-    </ProjectReference>\r
     <ProjectReference Include="../../class/System.XML/System.Xml-net_4_x.csproj">\r
       <Project>{87FD2F0F-5222-4AE6-BD63-2D4975E11E5B}</Project>\r
       <Name>System.Xml-net_4_x</Name>\r
index 30aa8d24d05f25349eee168088262798ed01b5ac..89596db0dae8d1d370fb7e92b7ea410dae5c629d 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 53a205e88542fdfec979d9744923fcccc960b7fc..4fdfba521c848a61aa91d7143f921b5eac4b0899 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 0969190f2e3e149e4e77fee92128084a5bd20ea2..95268e9c3b59222c789c351e4df8b856e3eee92d 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 7c9c21434c0c1521b12622537999ccd1bd938b38..d6ac11fff43bc95a3464b9b107d41fdc9e3bd9f7 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 884bea5a114ff7b5c0f82e9ff1f912cd0d0bce52..df2fb2702a3873ac3686354a19d5f0200f233e14 100644 (file)
@@ -5,9 +5,9 @@ include ../../build/rules.make
 PROGRAM = mono-symbolicate.exe
 
 LOCAL_MCS_FLAGS = \
-       /D:NO_AUTHENTICODE
+       /D:NO_AUTHENTICODE /D:CECIL
 
-LIB_REFS = Mono.Cecil Mono.Cecil.Mdb System.Xml System.Core System
+LIB_REFS = System.Xml System.Core System
 
 include ../../build/executable.make
 
@@ -26,7 +26,7 @@ SYMBOLICATE_EXPECTED_FILE = Test/symbolicate.expected
 CHECK_DIFF = @\
        $(MONO) $(TEST_EXE) > $(STACKTRACE_FILE); \
        $(MONO) $(LIB_PATH)/$(PROGRAM) $(MSYM_DIR) $(STACKTRACE_FILE) > $(SYMBOLICATE_RAW_FILE); \
-       sed "s/) .* in .*\/mcs\//) in mcs\//" $(SYMBOLICATE_RAW_FILE) | sed '/\[MVID\]/d' | sed '/\[AOTID\]/d' > $(SYMBOLICATE_RESULT_FILE); \
+       cat $(SYMBOLICATE_RAW_FILE) | tr '\\' '/' | sed "s/) .* in .*\/mcs\//) in mcs\//" | sed '/\[MVID\]/d' | sed '/\[AOTID\]/d' > $(SYMBOLICATE_RESULT_FILE); \
        DIFF=$$(diff -up $(SYMBOLICATE_EXPECTED_FILE) $(SYMBOLICATE_RESULT_FILE)); \
        if [ ! -z "$$DIFF" ]; then \
                echo "Symbolicate tests failed."; \
index 734aa3a166015a405e1b8bcaa34ccf285689642f..a204788306bb274ca648c24aca209d39d34fac60 100644 (file)
@@ -57,7 +57,7 @@ namespace Mono
                                return null;
                        }
 
-                       assemblyPath = (exeFiles.Length > 0)? exeFiles[0] : dllFiles[0];
+                       assemblyPath = exeFiles.Length > 0 ? exeFiles[0] : dllFiles[0];
 
                        var locProvider = new AssemblyLocationProvider (assemblyPath, logger);
 
@@ -97,10 +97,13 @@ namespace Mono
                                var dllFiles = Directory.GetFiles (dir, "*.dll");
                                var assemblies = exeFiles.Concat (dllFiles);
                                foreach (var assemblyPath in assemblies) {
-                                       var mdbPath = assemblyPath + ".mdb";
-                                       if (!File.Exists (mdbPath)) {
-                                               logger.LogWarning ("Directory {0} contains {1} but no mdb {2}.", dir, Path.GetFileName (assemblyPath), Path.GetFileName (mdbPath));
-                                               // assemblies without mdb files are useless
+
+                                       // TODO: Ignore embedded pdb
+                                       var symbolFile = GetSymbolFile (assemblyPath);
+
+                                       if (symbolFile == null) {
+                                               logger.LogWarning ("Directory {0} contains {1} but no debug symbols file was found.", dir, Path.GetFileName (assemblyPath));
+                                               // assemblies without debug symbols are useless
                                                continue;
                                        }
 
@@ -112,7 +115,7 @@ namespace Mono
                                        if (Directory.Exists (mvidDir)) {
                                                try {
                                                        Directory.Delete (mvidDir, true);
-                                               } catch (DirectoryNotFoundException e) {}
+                                               } catch (DirectoryNotFoundException) {}
                                        }
 
                                        Directory.CreateDirectory (mvidDir);
@@ -120,12 +123,26 @@ namespace Mono
                                        var mvidAssemblyPath = Path.Combine (mvidDir, Path.GetFileName (assemblyPath));
                                        File.Copy (assemblyPath, mvidAssemblyPath);
 
-                                       var mvidMdbPath = Path.Combine (mvidDir, Path.GetFileName (mdbPath));
-                                       File.Copy (mdbPath, mvidMdbPath);
+                                       var mvidDebugPath = Path.Combine (mvidDir, Path.GetFileName (symbolFile));
+                                       File.Copy (symbolFile, mvidDebugPath);
 
                                        // TODO create MVID dir for non main modules with links to main module MVID
                                }
                        }
                }
+
+               static string GetSymbolFile (string assembly)
+               {
+                       var pdbName = Path.ChangeExtension (assembly, "pdb");
+                       if (File.Exists (pdbName))
+                               return pdbName;
+                       
+                       var mdbName = assembly + ".mdb";
+
+                       if (File.Exists (mdbName))
+                               return mdbName;
+
+                       return null;
+               }
        }
 }
index b147f4866415d828e994703500372f05b750025a..a65ab75b17b9d2e021c606e9340354a89470d323 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NO_AUTHENTICODE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NO_AUTHENTICODE;CECIL;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NO_AUTHENTICODE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NO_AUTHENTICODE;CECIL;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
   </PropertyGroup>\r
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />\r
   <ItemGroup>\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil.Cil\*.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil.Metadata\*.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil.PE\*.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\ArrayType.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\AssemblyDefinition.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\AssemblyFlags.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\AssemblyHashAlgorithm.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\AssemblyLinkedResource.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\AssemblyNameDefinition.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\AssemblyNameReference.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\AssemblyReader.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\AssemblyWriter.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\BaseAssemblyResolver.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\CallSite.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\CustomAttribute.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\DefaultAssemblyResolver.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\EmbeddedResource.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\EventAttributes.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\EventDefinition.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\EventReference.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\ExportedType.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\FieldAttributes.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\FieldDefinition.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\FieldReference.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\FileAttributes.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\FunctionPointerType.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\GenericInstanceMethod.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\GenericInstanceType.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\GenericParameter.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\GenericParameterAttributes.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\IConstantProvider.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\ICustomAttributeProvider.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\IGenericInstance.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\IGenericParameterProvider.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\IMarshalInfoProvider.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\IMemberDefinition.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\IMetadataScope.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\IMetadataTokenProvider.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\IMethodSignature.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\Import.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\LinkedResource.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\ManifestResourceAttributes.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\MarshalInfo.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\MemberDefinitionCollection.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\MemberReference.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\MetadataResolver.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\MetadataSystem.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\MethodAttributes.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\MethodCallingConvention.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\MethodDefinition.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\MethodImplAttributes.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\MethodReference.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\MethodReturnType.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\MethodSemanticsAttributes.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\MethodSpecification.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\Modifiers.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\ModuleDefinition.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\ModuleKind.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\ModuleReference.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\NativeType.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\ParameterAttributes.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\ParameterDefinition.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\ParameterDefinitionCollection.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\ParameterReference.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\PinnedType.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\PInvokeAttributes.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\PInvokeInfo.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\PointerType.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\PropertyAttributes.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\PropertyDefinition.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\PropertyReference.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\ReferenceType.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\Resource.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\SecurityDeclaration.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\SentinelType.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\TargetRuntime.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\Treatments.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\TypeAttributes.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\TypeDefinition.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\TypeDefinitionCollection.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\TypeParser.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\TypeReference.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\TypeSpecification.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\TypeSystem.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\VariantType.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Cecil\WindowsRuntimeProjections.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Collections.Generic\*.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono.Security.Cryptography\*.cs" />\r
+    <Compile Include="..\..\..\external\cecil\Mono\*.cs" />\r
+    <Compile Include="..\..\..\external\cecil\symbols\mdb\Mono.Cecil.Mdb\MdbReader.cs" />\r
+    <Compile Include="..\..\..\external\cecil\symbols\mdb\Mono.Cecil.Mdb\MdbWriter.cs" />\r
+    <Compile Include="..\..\..\external\cecil\symbols\mdb\Mono.CompilerServices.SymbolWriter\*.cs" />\r
+    <Compile Include="..\..\..\external\cecil\symbols\pdb\Microsoft.Cci.Pdb\*.cs" />\r
+    <Compile Include="..\..\..\external\cecil\symbols\pdb\Mono.Cecil.Pdb\ISymUnmanagedDocumentWriter.cs" />\r
+    <Compile Include="..\..\..\external\cecil\symbols\pdb\Mono.Cecil.Pdb\ISymUnmanagedWriter2.cs" />\r
+    <Compile Include="..\..\..\external\cecil\symbols\pdb\Mono.Cecil.Pdb\ModuleMetadata.cs" />\r
+    <Compile Include="..\..\..\external\cecil\symbols\pdb\Mono.Cecil.Pdb\PdbHelper.cs" />\r
+    <Compile Include="..\..\..\external\cecil\symbols\pdb\Mono.Cecil.Pdb\PdbReader.cs" />\r
+    <Compile Include="..\..\..\external\cecil\symbols\pdb\Mono.Cecil.Pdb\PdbWriter.cs" />\r
+    <Compile Include="..\..\..\external\cecil\symbols\pdb\Mono.Cecil.Pdb\SymDocumentWriter.cs" />\r
+    <Compile Include="..\..\..\external\cecil\symbols\pdb\Mono.Cecil.Pdb\SymWriter.cs" />\r
+    <Compile Include="..\..\..\external\cecil\System.Security.Cryptography\*.cs" />\r
+    <Compile Include="..\..\class\Mono.Options\Mono.Options\Options.cs" />\r
     <Compile Include="LocationProvider.cs" />\r
+    <Compile Include="Logger.cs" />\r
     <Compile Include="SeqPointInfo.cs" />\r
-    <Compile Include="symbolicate.cs" />\r  </ItemGroup>\r
+    <Compile Include="StackFrameData.cs" />\r
+    <Compile Include="symbolicate.cs" />\r
+    <Compile Include="SymbolManager.cs" />\r  </ItemGroup>\r
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \r
        Other similar extension points exist, see Microsoft.Common.targets.\r
   <Target Name="BeforeBuild">\r
       <Project>{2CA6026B-2DC8-4C4C-A12C-1E8234049DB7}</Project>\r
       <Name>corlib-net_4_x</Name>\r
     </ProjectReference>\r
-    <ProjectReference Include="../../class/Mono.Cecil/Mono.Cecil-net_4_x.csproj">\r
-      <Project>{2C0D558F-0B38-4691-967E-A910A1B995C1}</Project>\r
-      <Name>Mono.Cecil-net_4_x</Name>\r
-    </ProjectReference>\r
-    <ProjectReference Include="../../class/Mono.Cecil.Mdb/Mono.Cecil.Mdb-net_4_x.csproj">\r
-      <Project>{CF14D34A-F69B-47FB-A99C-D25C77198F30}</Project>\r
-      <Name>Mono.Cecil.Mdb-net_4_x</Name>\r
-    </ProjectReference>\r
     <ProjectReference Include="../../class/System.XML/System.Xml-net_4_x.csproj">\r
       <Project>{87FD2F0F-5222-4AE6-BD63-2D4975E11E5B}</Project>\r
       <Name>System.Xml-net_4_x</Name>\r
index 6cb8042e9c528e3bbcb3dd6b6710452a9dce37df..da336168f902e41e14155acdcacc879b9043d180 100644 (file)
@@ -5,3 +5,106 @@ StackFrameData.cs
 SymbolManager.cs
 Logger.cs
 ../../class/Mono.Options/Mono.Options/Options.cs
+
+../../../external/cecil/Mono/*.cs
+../../../external/cecil/Mono.Cecil/ArrayType.cs
+../../../external/cecil/Mono.Cecil/AssemblyDefinition.cs
+../../../external/cecil/Mono.Cecil/AssemblyFlags.cs
+../../../external/cecil/Mono.Cecil/AssemblyHashAlgorithm.cs
+../../../external/cecil/Mono.Cecil/AssemblyLinkedResource.cs
+../../../external/cecil/Mono.Cecil/AssemblyNameDefinition.cs
+../../../external/cecil/Mono.Cecil/AssemblyNameReference.cs
+../../../external/cecil/Mono.Cecil/AssemblyReader.cs
+../../../external/cecil/Mono.Cecil/AssemblyWriter.cs
+../../../external/cecil/Mono.Cecil/BaseAssemblyResolver.cs
+../../../external/cecil/Mono.Cecil/CallSite.cs
+../../../external/cecil/Mono.Cecil/CustomAttribute.cs
+../../../external/cecil/Mono.Cecil/DefaultAssemblyResolver.cs
+../../../external/cecil/Mono.Cecil/EmbeddedResource.cs
+../../../external/cecil/Mono.Cecil/EventAttributes.cs
+../../../external/cecil/Mono.Cecil/EventDefinition.cs
+../../../external/cecil/Mono.Cecil/EventReference.cs
+../../../external/cecil/Mono.Cecil/ExportedType.cs
+../../../external/cecil/Mono.Cecil/FieldAttributes.cs
+../../../external/cecil/Mono.Cecil/FieldDefinition.cs
+../../../external/cecil/Mono.Cecil/FieldReference.cs
+../../../external/cecil/Mono.Cecil/FileAttributes.cs
+../../../external/cecil/Mono.Cecil/FunctionPointerType.cs
+../../../external/cecil/Mono.Cecil/GenericInstanceMethod.cs
+../../../external/cecil/Mono.Cecil/GenericInstanceType.cs
+../../../external/cecil/Mono.Cecil/GenericParameter.cs
+../../../external/cecil/Mono.Cecil/GenericParameterAttributes.cs
+../../../external/cecil/Mono.Cecil/IConstantProvider.cs
+../../../external/cecil/Mono.Cecil/ICustomAttributeProvider.cs
+../../../external/cecil/Mono.Cecil/IGenericInstance.cs
+../../../external/cecil/Mono.Cecil/IGenericParameterProvider.cs
+../../../external/cecil/Mono.Cecil/IMarshalInfoProvider.cs
+../../../external/cecil/Mono.Cecil/IMemberDefinition.cs
+../../../external/cecil/Mono.Cecil/IMetadataScope.cs
+../../../external/cecil/Mono.Cecil/IMetadataTokenProvider.cs
+../../../external/cecil/Mono.Cecil/IMethodSignature.cs
+../../../external/cecil/Mono.Cecil/Import.cs
+../../../external/cecil/Mono.Cecil/LinkedResource.cs
+../../../external/cecil/Mono.Cecil/ManifestResourceAttributes.cs
+../../../external/cecil/Mono.Cecil/MarshalInfo.cs
+../../../external/cecil/Mono.Cecil/MemberDefinitionCollection.cs
+../../../external/cecil/Mono.Cecil/MemberReference.cs
+../../../external/cecil/Mono.Cecil/MetadataResolver.cs
+../../../external/cecil/Mono.Cecil/MetadataSystem.cs
+../../../external/cecil/Mono.Cecil/MethodAttributes.cs
+../../../external/cecil/Mono.Cecil/MethodCallingConvention.cs
+../../../external/cecil/Mono.Cecil/MethodDefinition.cs
+../../../external/cecil/Mono.Cecil/MethodImplAttributes.cs
+../../../external/cecil/Mono.Cecil/MethodReference.cs
+../../../external/cecil/Mono.Cecil/MethodReturnType.cs
+../../../external/cecil/Mono.Cecil/MethodSemanticsAttributes.cs
+../../../external/cecil/Mono.Cecil/MethodSpecification.cs
+../../../external/cecil/Mono.Cecil/Modifiers.cs
+../../../external/cecil/Mono.Cecil/ModuleDefinition.cs
+../../../external/cecil/Mono.Cecil/ModuleKind.cs
+../../../external/cecil/Mono.Cecil/ModuleReference.cs
+../../../external/cecil/Mono.Cecil/NativeType.cs
+../../../external/cecil/Mono.Cecil/ParameterAttributes.cs
+../../../external/cecil/Mono.Cecil/ParameterDefinition.cs
+../../../external/cecil/Mono.Cecil/ParameterDefinitionCollection.cs
+../../../external/cecil/Mono.Cecil/ParameterReference.cs
+../../../external/cecil/Mono.Cecil/PinnedType.cs
+../../../external/cecil/Mono.Cecil/PInvokeAttributes.cs
+../../../external/cecil/Mono.Cecil/PInvokeInfo.cs
+../../../external/cecil/Mono.Cecil/PointerType.cs
+../../../external/cecil/Mono.Cecil/PropertyAttributes.cs
+../../../external/cecil/Mono.Cecil/PropertyDefinition.cs
+../../../external/cecil/Mono.Cecil/PropertyReference.cs
+../../../external/cecil/Mono.Cecil/ReferenceType.cs
+../../../external/cecil/Mono.Cecil/Resource.cs
+../../../external/cecil/Mono.Cecil/SecurityDeclaration.cs
+../../../external/cecil/Mono.Cecil/SentinelType.cs
+../../../external/cecil/Mono.Cecil/TargetRuntime.cs
+../../../external/cecil/Mono.Cecil/Treatments.cs
+../../../external/cecil/Mono.Cecil/TypeAttributes.cs
+../../../external/cecil/Mono.Cecil/TypeDefinition.cs
+../../../external/cecil/Mono.Cecil/TypeDefinitionCollection.cs
+../../../external/cecil/Mono.Cecil/TypeParser.cs
+../../../external/cecil/Mono.Cecil/TypeReference.cs
+../../../external/cecil/Mono.Cecil/TypeSpecification.cs
+../../../external/cecil/Mono.Cecil/TypeSystem.cs
+../../../external/cecil/Mono.Cecil/VariantType.cs
+../../../external/cecil/Mono.Cecil/WindowsRuntimeProjections.cs
+../../../external/cecil/Mono.Cecil.Cil/*.cs
+../../../external/cecil/Mono.Cecil.Metadata/*.cs
+../../../external/cecil/Mono.Cecil.PE/*.cs
+../../../external/cecil/Mono.Collections.Generic/*.cs
+../../../external/cecil/Mono.Security.Cryptography/*.cs
+../../../external/cecil/System.Security.Cryptography/*.cs
+../../../external/cecil/symbols/mdb/Mono.Cecil.Mdb/MdbReader.cs
+../../../external/cecil/symbols/mdb/Mono.Cecil.Mdb/MdbWriter.cs
+../../../external/cecil/symbols/mdb/Mono.CompilerServices.SymbolWriter/*.cs
+../../../external/cecil/symbols/pdb/Microsoft.Cci.Pdb/*.cs
+../../../external/cecil/symbols/pdb/Mono.Cecil.Pdb/ISymUnmanagedDocumentWriter.cs
+../../../external/cecil/symbols/pdb/Mono.Cecil.Pdb/ISymUnmanagedWriter2.cs
+../../../external/cecil/symbols/pdb/Mono.Cecil.Pdb/ModuleMetadata.cs
+../../../external/cecil/symbols/pdb/Mono.Cecil.Pdb/PdbHelper.cs
+../../../external/cecil/symbols/pdb/Mono.Cecil.Pdb/PdbReader.cs
+../../../external/cecil/symbols/pdb/Mono.Cecil.Pdb/PdbWriter.cs
+../../../external/cecil/symbols/pdb/Mono.Cecil.Pdb/SymDocumentWriter.cs
+../../../external/cecil/symbols/pdb/Mono.Cecil.Pdb/SymWriter.cs
index dcf29b0f693c1b319df59b4d8b0549003bae1251..d242cb0b9cafe27bf9a9bf00a0f986b20b22453a 100644 (file)
@@ -47,7 +47,6 @@
     <Compile Include="symbolicate.cs" />\r
     <Compile Include="Logger.cs" />\r
     <Compile Include="StackFrameData.cs" />\r
-    <Compile Include="StackTraceMetadata.cs" />\r
     <Compile Include="SymbolManager.cs" />\r
     <Compile Include="..\..\class\Mono.Options\Mono.Options\Options.cs">\r
       <Link>Options.cs</Link>\r
index 6aa1cc35a1226279787c4bf35fa2a93e9d5e2302..43a2039703cc7b84380e0f605241e81ab7367276 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index d5f58360be6ba77590a8d426cc0c61e728e66d78..d7bc84b9c55cd7e7b3baf44727aeb4d8beec9eec 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 35ca4e79637f49eeaacf88c7c9cc3ce0ebc4fef9..57dcb4efe27f7a66bad6a6e4cb2dafe0a9d4f535 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NO_AUTHENTICODE;STATIC;NO_SYMBOL_WRITER;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NO_AUTHENTICODE;STATIC;NO_SYMBOL_WRITER;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NO_AUTHENTICODE;STATIC;NO_SYMBOL_WRITER;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NO_AUTHENTICODE;STATIC;NO_SYMBOL_WRITER;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
diff --git a/mcs/tools/nunit-lite/NUnitLite/BabysitterSupport.cs b/mcs/tools/nunit-lite/NUnitLite/BabysitterSupport.cs
new file mode 100644 (file)
index 0000000..86c44d9
--- /dev/null
@@ -0,0 +1,113 @@
+//
+// BabysitterSupport.cs: Nunit extensions to support test harness used by Mono.
+//                       See scripts/babysitter in Mono repository.
+//
+// Author:
+//   Andi McClure (andi.mcclure@xamarin.com)
+//
+// Copyright (C) 2015 Xamarin, Inc (http://www.xamarin.com)
+//
+
+namespace Xamarin
+{
+       using System;
+       using System.IO;
+       using System.Collections.Generic;
+       using NUnit.Framework.Api;
+       using NUnit.Framework.Internal;
+       using NUnit.Framework.Internal.Filters;
+
+       public class BabysitterSupport
+       {
+               enum OverrideMode {None, Run, Exclude};
+               public static Dictionary<string, bool> OverrideTests = new Dictionary<string, bool>();
+               private static OverrideMode Override = OverrideMode.None;
+               private static string CurrentTestFile = null, RanTestFile = null, FailedTestFile = null;
+
+               private static void DeleteFile(string path)
+               {
+                       try {
+                               File.Delete(path);
+                       } catch (Exception) {}
+               }
+               private static void WriteFile(string path, string contents)
+               {
+                       DeleteFile(path);
+                       File.AppendAllText(path, contents);
+               }
+
+               // Environment variables are available from process start, so safe to do setup in a static constructor
+               static BabysitterSupport()
+               {
+                       string overrideModeString = Environment.GetEnvironmentVariable("MONO_BABYSITTER_NUNIT_RUN_MODE");
+                       string overrideTestString = Environment.GetEnvironmentVariable("MONO_BABYSITTER_NUNIT_RUN_TEST");
+                       if (overrideModeString == "RUN")
+                               Override = OverrideMode.Run;
+                       else if (overrideModeString == "EXCLUDE")
+                               Override = OverrideMode.Exclude;
+                       if (Override != OverrideMode.None)
+                       {
+                               string[] overrideTests = overrideTestString.Split(new char[] {';'}, StringSplitOptions.RemoveEmptyEntries);
+                               foreach (string s in overrideTests)
+                                       OverrideTests[s] = true;
+                       }
+
+                       CurrentTestFile = Environment.GetEnvironmentVariable("MONO_BABYSITTER_NUNIT_CURRENT_TEST_FILE");
+                       RanTestFile = Environment.GetEnvironmentVariable("MONO_BABYSITTER_NUNIT_RAN_TEST_FILE");
+                       FailedTestFile = Environment.GetEnvironmentVariable("MONO_BABYSITTER_NUNIT_FAILED_TEST_FILE");
+               }
+
+               // Entry points
+
+               public static void RecordEnterTest( string testName )
+               {
+                       if (CurrentTestFile != null)
+                               WriteFile(CurrentTestFile, testName);
+                       if (RanTestFile != null)
+                               File.AppendAllText(RanTestFile, testName + Environment.NewLine);
+               }
+
+               public static void RecordLeaveTest( string testName )
+               {
+                       if (CurrentTestFile != null)
+                               DeleteFile(CurrentTestFile);
+               }
+
+               public static void RecordFailedTest( string testName )
+               {
+                       if (FailedTestFile != null)
+                               File.AppendAllText(FailedTestFile, testName + Environment.NewLine);
+               }
+
+               public static ITestFilter AddBabysitterFilter(ITestFilter currentFilter)
+               {
+                       if (Override == OverrideMode.None)
+                               return currentFilter;
+                       return new AndFilter(currentFilter, new BabysitterFilter());
+               }
+
+               [Serializable]
+               private class BabysitterFilter : TestFilter
+               {
+                       public override bool Match(ITest test)
+                       {
+                               if (test.IsSuite) // A suite returning true will automatically run ALL contents, filters ignored
+                                       return false;
+                               bool inList = OverrideTests.ContainsKey(test.FullName);
+                               bool allow = true;
+                               switch (Override)
+                               {
+                                       case OverrideMode.None:
+                                               break;
+                                       case OverrideMode.Run:
+                                               allow = inList;
+                                               break;
+                                       case OverrideMode.Exclude:
+                                               allow = !inList;
+                                               break;
+                               }
+                               return allow;
+                       }
+               }
+       }
+}
\ No newline at end of file
index e205091b942ff3177cecef28d2d4a2e966125d4d..edf8c1283791bde051589c5199693cb6ad1014ba 100644 (file)
 ../../../../external/nunit-lite/NUnitLite-1.0.0/src/framework/TestCaseData.cs
 ../../../../external/nunit-lite/NUnitLite-1.0.0/src/framework/TestContext.cs
 ../../../../external/nunit-lite/NUnitLite-1.0.0/src/framework/Throws.cs
+BabysitterSupport.cs
diff --git a/mcs/tools/nunit-lite/nunit-lite-console/nunit-lite-console.exe.config b/mcs/tools/nunit-lite/nunit-lite-console/nunit-lite-console.exe.config
deleted file mode 100644 (file)
index 2ccc2b9..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>\r
-<configuration>\r
- <runtime>\r
- <!-- \r
-   This is necessary to prevent the runner from terminating on\r
-   any unhandled exceptions which occur. We account for unhandled exceptions on\r
-   other threads with an event handler, but would still be terminated using the\r
-   new behavior.\r
- -->\r
-   <legacyUnhandledExceptionPolicy enabled="1" />\r
-  </runtime>\r
-</configuration>\r
diff --git a/mcs/tools/nunit-lite/nunit-lite-console/nunit-lite-console.exe.config.tmpl b/mcs/tools/nunit-lite/nunit-lite-console/nunit-lite-console.exe.config.tmpl
new file mode 100644 (file)
index 0000000..bc218db
--- /dev/null
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="Windows-1252"?>\r
+<configuration>\r
+  <!-- __INSERT_CUSTOM_APP_CONFIG_GLOBAL__ -->\r
+  <runtime>\r
+    <!-- \r
+      This is necessary to prevent the runner from terminating on\r
+      any unhandled exceptions which occur. We account for unhandled exceptions on\r
+      other threads with an event handler, but would still be terminated using the\r
+      new behavior.\r
+    -->\r
+    <legacyUnhandledExceptionPolicy enabled="1" />\r
+    <!-- __INSERT_CUSTOM_APP_CONFIG_RUNTIME__ -->\r
+  </runtime>\r
+</configuration>\r
index 4228feb10cfc9dd4400cf2c0304ed7f8d6c455dd..230652e3f73f9a0ed1a98c157d7be923e712f9de 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 94a03d663e6e02df1c869f91a0869c4cbed95537..ccb79a7f770480121e6f5cf3f8aea456bcdfa09b 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
       <Project>{2CA6026B-2DC8-4C4C-A12C-1E8234049DB7}</Project>\r
       <Name>corlib-net_4_x</Name>\r
     </ProjectReference>\r
-    <ProjectReference Include="../../class/Mono.Cecil/Mono.Cecil-net_4_x.csproj">\r
-      <Project>{2C0D558F-0B38-4691-967E-A910A1B995C1}</Project>\r
+    <ProjectReference Include="../../class/legacy/Mono.Cecil/Mono.Cecil-net_4_x.csproj">\r
+      <Project>{6DE38817-EC25-433A-AE58-0D30C5E6C460}</Project>\r
       <Name>Mono.Cecil-net_4_x</Name>\r
     </ProjectReference>\r
     <ProjectReference Include="../../class/Mono.CompilerServices.SymbolWriter/Mono.CompilerServices.SymbolWriter-net_4_x.csproj">\r
index fef287ac0901dbf844782504e03650b799b5e022..8b4dd8efb27078fa2fab2aeb81976564d6aeb405 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699,1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699,1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index ac2c2ef82c72d87c20a4c9a4a86869f290bd53b1..56797562e50592fbcf07f610d2bc5b2eed162755 100644 (file)
@@ -50,6 +50,7 @@ namespace Mono.Tools
                static string inputFile;
                static bool quiet;
                static bool userStore;
+               static bool btlsStore = false;
 
                static X509Certificate DecodeCertificate (string s)
                {
@@ -116,14 +117,19 @@ namespace Mono.Tools
                                return 0;
                        }
                                
-                       X509Stores stores = userStore ? X509StoreManager.CurrentUser : X509StoreManager.LocalMachine;
-                       X509CertificateCollection trusted = stores.TrustedRoot.Certificates;
+                       X509Stores stores;
+                       if (userStore)
+                               stores = btlsStore ? X509StoreManager.NewCurrentUser : X509StoreManager.CurrentUser;
+                       else
+                               stores = btlsStore ? X509StoreManager.NewLocalMachine : X509StoreManager.LocalMachine;
+                       X509Store store = stores.TrustedRoot;
+                       X509CertificateCollection trusted = store.Certificates;
                        int additions = 0;
                        WriteLine ("I already trust {0}, your new list has {1}", trusted.Count, roots.Count);
                        foreach (X509Certificate root in roots) {
                                if (!trusted.Contains (root)) {
                                        try {
-                                               stores.TrustedRoot.Import (root);
+                                               store.Import (root);
                                                WriteLine ("Certificate added: {0}", root.SubjectName);
                                                additions++;
                                        } catch (Exception e) {
@@ -145,7 +151,7 @@ namespace Mono.Tools
                                WriteLine ("{0} previously trusted certificates were removed.", removed.Count);
 
                                foreach (X509Certificate old in removed) {
-                                       stores.TrustedRoot.Remove (old);
+                                       store.Remove (old);
                                        WriteLine ("Certificate removed: {0}", old.SubjectName);
                                }
                        }
@@ -173,6 +179,9 @@ namespace Mono.Tools
                                case "--user":
                                        userStore = true;
                                        break;
+                               case "--btls":
+                                       btlsStore = true;
+                                       break;
                                default:
                                        WriteLine ("Unknown option '{0}'.", args[i]);
                                        return false;
@@ -228,4 +237,4 @@ namespace Mono.Tools
                        }
                }
        }
-}
\ No newline at end of file
+}
index 90679a7418624d880f598b0c654a0da6304c0095..40119b2a80b32d822e804eec2982e575d8565c53 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 117a92802b906d3fab1af01815789b0619d9390e..cb8835b5442e815036b67b2cf73e917e37eb67c6 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 048153eee248817194fc46d37b367b48fd2a386d..d5422a51f85ae744b3a70e74fc2e5df372e32e42 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -33,7 +34,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;MONO_STRICT;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;MONO_STRICT;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -41,7 +42,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>MONO_STRICT;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>MONO_STRICT;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 88ad1f8d9b5cca744ae8ae233bec051b2a7d20fa..599e039ed97762509ff07b60ab89ee905de8b485 100644 (file)
@@ -1,4 +1,4 @@
-thisdir = tools/SqlSharp
+thisdir = tools/sqlsharp
 SUBDIRS = 
 include ../../build/rules.make
 
index 81e68230553252a3bfb7b98a1ac9bc6b3aa9ed0e..29204d9140ff870ba246931cb673387225bac341 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index ad7320b3108770e61cd4f605cd11d7d2c597f715..d20cf05b23a57896a86c6067dbc1b9fbdc4c6846 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
diff --git a/mcs/tools/tuner/Makefile b/mcs/tools/tuner/Makefile
deleted file mode 100644 (file)
index c364223..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-thisdir = tools/tuner
-SUBDIRS =
-DEP_DIRS = linker
-include ../../build/rules.make
-
-LOCAL_MCS_FLAGS = -r:$(topdir)/class/lib/$(PROFILE)/monolinker.exe
-LIB_REFS = System System.Core System.Xml Mono.Cecil
-
-LIBRARY = Mono.Tuner.dll
-
-NO_INSTALL = yes
-NO_TEST = yes
-NO_SIGN_ASSEMBLY = yes
-
-include ../../build/library.make
diff --git a/mcs/tools/tuner/Mono.Tuner-net_4_x.csproj b/mcs/tools/tuner/Mono.Tuner-net_4_x.csproj
deleted file mode 100644 (file)
index 0afcefa..0000000
+++ /dev/null
@@ -1,115 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>\r
-<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
-  <PropertyGroup>\r
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
-    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>\r
-    <ProductVersion>9.0.30729</ProductVersion>\r
-    <SchemaVersion>2.0</SchemaVersion>\r
-    <ProjectGuid>{8CCE7044-3466-4599-B09E-9F8E0C2F4614}</ProjectGuid>\r
-    <OutputType>Library</OutputType>\r
-    <NoWarn>1699</NoWarn>\r
-    <OutputPath>./../../class/lib/net_4_x</OutputPath>\r
-    <IntermediateOutputPath>obj-net_4_x</IntermediateOutputPath>\r
-    <GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>\r
-    <NoStdLib>True</NoStdLib>\r
-    \r
-    <NoConfig>True</NoConfig>\r
-    \r
-    <AppDesignerFolder>Properties</AppDesignerFolder>\r
-    <RootNamespace>\r
-    </RootNamespace>\r
-    <AssemblyName>Mono.Tuner</AssemblyName>\r
-    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
-    <FileAlignment>512</FileAlignment>\r
-  </PropertyGroup>\r
-  \r
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
-    <DebugSymbols>true</DebugSymbols>\r
-    <DebugType>full</DebugType>\r
-    <NoWarn>1699</NoWarn>\r
-    <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
-    <ErrorReport>prompt</ErrorReport>\r
-    <WarningLevel>4</WarningLevel>\r
-  </PropertyGroup>\r
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">\r
-    <DebugType>pdbonly</DebugType>\r
-    <NoWarn>1699</NoWarn>\r
-    <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
-    <ErrorReport>prompt</ErrorReport>\r
-    <WarningLevel>4</WarningLevel>\r
-  </PropertyGroup>\r
-  <!-- Set AddAdditionalExplicitAssemblyReferences to false, otherwise if targetting .NET4.0, \r
-  Microsoft.NETFramework.props will force a dependency on the assembly System.Core. This\r
-  is a problem to compile the Mono mscorlib.dll -->\r
-  <PropertyGroup>\r
-    <AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>\r
-  </PropertyGroup>\r
-  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />\r
-  <ItemGroup>\r
-    <Compile Include="Mono.Tuner\AdjustVisibility.cs" />\r
-    <Compile Include="Mono.Tuner\CheckVisibility.cs" />\r
-    <Compile Include="Mono.Tuner\FilterAttributes.cs" />\r
-    <Compile Include="Mono.Tuner\InjectSecurityAttributes.cs" />\r
-    <Compile Include="Mono.Tuner\MoonlightA11yApiMarker.cs" />\r
-    <Compile Include="Mono.Tuner\MoonlightA11yAssemblyStep.cs" />\r
-    <Compile Include="Mono.Tuner\MoonlightA11yDescriptorGenerator.cs" />\r
-    <Compile Include="Mono.Tuner\MoonlightA11yProcessor.cs" />\r
-    <Compile Include="Mono.Tuner\MoonlightA11yUsageInspectionStep.cs" />\r
-    <Compile Include="Mono.Tuner\MoonlightAssemblyStep.cs" />\r
-    <Compile Include="Mono.Tuner\PrintStatus.cs" />\r
-    <Compile Include="Mono.Tuner\RemoveSerialization.cs" />\r
-    <Compile Include="Mono.Tuner\TunerAnnotations.cs" />\r  </ItemGroup>\r
-  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \r
-       Other similar extension points exist, see Microsoft.Common.targets.\r
-  <Target Name="BeforeBuild">\r
-  </Target>\r
-  <Target Name="AfterBuild">\r
-  </Target>\r
-  -->\r
-  <PropertyGroup>\r
-    <PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
-
-    </PreBuildEvent>\r
-    <PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">\r
-\r
-    </PreBuildEvent>\r
-    <PostBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
-
-    </PostBuildEvent>\r
-    <PostBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">\r
-\r
-    </PostBuildEvent>\r
-  </PropertyGroup>\r
-  <ItemGroup>\r
-    <ProjectReference Include="../linker/monolinker-net_4_x.csproj">\r
-      <Project>{FA920637-C202-4E75-AC0F-1A8DBD631DF1}</Project>\r
-      <Name>monolinker-net_4_x</Name>\r
-    </ProjectReference>\r
-    <ProjectReference Include="../../class/corlib/corlib-net_4_x.csproj">\r
-      <Project>{2CA6026B-2DC8-4C4C-A12C-1E8234049DB7}</Project>\r
-      <Name>corlib-net_4_x</Name>\r
-    </ProjectReference>\r
-    <ProjectReference Include="../../class/System/System-net_4_x.csproj">\r
-      <Project>{2762E921-91A8-4C87-91E9-BA628013F753}</Project>\r
-      <Name>System-net_4_x</Name>\r
-    </ProjectReference>\r
-    <ProjectReference Include="../../class/System.Core/System.Core-net_4_x.csproj">\r
-      <Project>{359142A1-D80F-401E-AA64-7167C9317649}</Project>\r
-      <Name>System.Core-net_4_x</Name>\r
-    </ProjectReference>\r
-    <ProjectReference Include="../../class/System.XML/System.Xml-net_4_x.csproj">\r
-      <Project>{87FD2F0F-5222-4AE6-BD63-2D4975E11E5B}</Project>\r
-      <Name>System.Xml-net_4_x</Name>\r
-    </ProjectReference>\r
-    <ProjectReference Include="../../class/Mono.Cecil/Mono.Cecil-net_4_x.csproj">\r
-      <Project>{2C0D558F-0B38-4691-967E-A910A1B995C1}</Project>\r
-      <Name>Mono.Cecil-net_4_x</Name>\r
-    </ProjectReference>\r
-  </ItemGroup>\r
-  <ItemGroup>\r
-    <Folder Include="Properties\" />\r
-  </ItemGroup>\r
-</Project>\r
-
diff --git a/mcs/tools/tuner/Mono.Tuner.csproj b/mcs/tools/tuner/Mono.Tuner.csproj
deleted file mode 100644 (file)
index fd5e22d..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <PropertyGroup>
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
-    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <ProductVersion>8.0.50727</ProductVersion>
-    <SchemaVersion>2.0</SchemaVersion>
-    <ProjectGuid>{E97429BA-279A-4C1D-AE8A-8BD878C661D1}</ProjectGuid>
-    <OutputType>Library</OutputType>
-    <AppDesignerFolder>Properties</AppDesignerFolder>
-    <RootNamespace>Mono.Tuner</RootNamespace>
-    <AssemblyName>Mono.Tuner</AssemblyName>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
-    <DebugSymbols>True</DebugSymbols>
-    <DebugType>full</DebugType>
-    <Optimize>False</Optimize>
-    <OutputPath>bin\Debug\</OutputPath>
-    <DefineConstants>DEBUG;TRACE</DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
-    <DebugType>pdbonly</DebugType>
-    <Optimize>True</Optimize>
-    <OutputPath>bin\Release\</OutputPath>
-    <DefineConstants>TRACE</DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-  </PropertyGroup>
-  <ItemGroup>
-    <Reference Include="System" />
-    <Reference Include="System.Xml" />
-  </ItemGroup>
-  <ItemGroup>
-    <Compile Include="Mono.Tuner\AdjustVisibility.cs" />
-    <Compile Include="Mono.Tuner\CheckVisibility.cs" />
-    <Compile Include="Mono.Tuner\PrintStatus.cs" />
-    <Compile Include="Mono.Tuner\RemoveSerialization.cs" />
-    <Compile Include="Mono.Tuner\TunerAnnotations.cs" />
-    <Compile Include="Mono.Tuner\InjectSecurityAttributes.cs" />
-    <Compile Include="Mono.Tuner\MoonlightAssemblyStep.cs" />
-    <Compile Include="Mono.Tuner\FilterAttributes.cs" />
-    <Compile Include="Mono.Tuner\MoonlightA11yProcessor.cs" />
-    <Compile Include="Mono.Tuner\MoonlightA11yAssemblyStep.cs" />
-    <Compile Include="Mono.Tuner\MoonlightA11yUsageInspectionStep.cs" />
-    <Compile Include="Mono.Tuner\MoonlightA11yDescriptorGenerator.cs" />
-    <Compile Include="Mono.Tuner\MoonlightA11yApiMarker.cs" />
-  </ItemGroup>
-  <Import Project="$(MSBuildBinPath)\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.
-  <Target Name="BeforeBuild">
-  </Target>
-  <Target Name="AfterBuild">
-  </Target>
-  -->
-  <ItemGroup>
-    <None Include="Makefile" />
-  </ItemGroup>
-  <ItemGroup>
-    <ProjectReference Include="..\linker\Mono.Linker.csproj">
-      <Project>{DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}</Project>
-      <Name>Mono.Linker</Name>
-    </ProjectReference>
-    <ProjectReference Include="..\..\..\external\cecil\Mono.Cecil.csproj">
-      <Project>{D68133BD-1E63-496E-9EDE-4FBDBF77B486}</Project>
-      <Name>Mono.Cecil</Name>
-    </ProjectReference>
-  </ItemGroup>
-</Project>
\ No newline at end of file
diff --git a/mcs/tools/tuner/Mono.Tuner.dll.sources b/mcs/tools/tuner/Mono.Tuner.dll.sources
deleted file mode 100644 (file)
index cca968b..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-Mono.Tuner/TunerAnnotations.cs
-Mono.Tuner/PrintStatus.cs
-Mono.Tuner/RemoveSerialization.cs
-Mono.Tuner/AdjustVisibility.cs
-Mono.Tuner/CheckVisibility.cs
-Mono.Tuner/InjectSecurityAttributes.cs
-Mono.Tuner/MoonlightA11yApiMarker.cs
-Mono.Tuner/MoonlightA11yAssemblyStep.cs
-Mono.Tuner/MoonlightA11yDescriptorGenerator.cs
-Mono.Tuner/MoonlightA11yProcessor.cs
-Mono.Tuner/MoonlightA11yUsageInspectionStep.cs
-Mono.Tuner/MoonlightAssemblyStep.cs
-Mono.Tuner/FilterAttributes.cs
diff --git a/mcs/tools/tuner/Mono.Tuner/AdjustVisibility.cs b/mcs/tools/tuner/Mono.Tuner/AdjustVisibility.cs
deleted file mode 100644 (file)
index 6b684b6..0000000
+++ /dev/null
@@ -1,164 +0,0 @@
-//
-// AdjustVisibilityStep.cs
-//
-// Author:
-//   Jb Evain (jbevain@novell.com)
-//
-// (C) 2007 Novell, Inc.
-//
-// 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;
-using System.Collections.Generic;
-
-using Mono.Linker;
-using Mono.Linker.Steps;
-
-using Mono.Cecil;
-
-namespace Mono.Tuner {
-
-       public class AdjustVisibility : BaseStep {
-               protected override void ProcessAssembly (AssemblyDefinition assembly)
-               {
-                       if (Annotations.GetAction (assembly) != AssemblyAction.Link)
-                               return;
-
-                       ProcessTypes (assembly.MainModule.Types);
-               }
-
-               void ProcessTypes (ICollection types)
-               {
-                       foreach (TypeDefinition type in types)
-                               ProcessType (type);
-               }
-
-               void ProcessType (TypeDefinition type)
-               {
-                       if (!IsPublic (type))
-                               return;
-
-                       if (!IsMarkedAsPublic (type)) {
-                               SetInternalVisibility (type);
-                               return;
-                       }
-
-                       if (type.IsEnum)
-                               return;
-
-                       ProcessFields (type.Fields);
-                       ProcessMethods (type.Methods);
-               }
-
-               static bool IsPublic (TypeDefinition type)
-               {
-                       return type.DeclaringType == null ? type.IsPublic : type.IsNestedPublic;
-               }
-
-               void SetInternalVisibility (TypeDefinition type)
-               {
-                       type.Attributes &= ~TypeAttributes.VisibilityMask;
-                       if (type.DeclaringType == null)
-                               type.Attributes |= TypeAttributes.NotPublic;
-                       else
-                               type.Attributes |= TypeAttributes.NestedAssembly;
-
-                       MarkInternalized (type);
-               }
-
-               void ProcessMethods (ICollection methods)
-               {
-                       foreach (MethodDefinition method in methods)
-                               ProcessMethod (method);
-               }
-
-               void ProcessMethod (MethodDefinition method)
-               {
-                       if (IsMarkedAsPublic (method))
-                               return;
-
-                       if (method.IsPublic)
-                               SetInternalVisibility (method);
-                       else if (method.IsFamily || method.IsFamilyOrAssembly)
-                               SetProtectedAndInternalVisibility (method);
-               }
-
-               void SetInternalVisibility (MethodDefinition method)
-               {
-                       method.Attributes &= ~MethodAttributes.MemberAccessMask;
-                       method.Attributes |= MethodAttributes.Assembly;
-
-                       MarkInternalized (method);
-               }
-
-               void SetProtectedAndInternalVisibility (MethodDefinition method)
-               {
-                       method.Attributes &= ~MethodAttributes.MemberAccessMask;
-                       method.Attributes |= MethodAttributes.FamANDAssem;
-
-                       MarkInternalized (method);
-               }
-
-               bool IsMarkedAsPublic (IMetadataTokenProvider provider)
-               {
-                       return Annotations.IsPublic (provider);
-               }
-
-               void ProcessFields (IEnumerable<FieldDefinition> fields)
-               {
-                       foreach (FieldDefinition field in fields)
-                               ProcessField (field);
-               }
-
-               void ProcessField (FieldDefinition field)
-               {
-                       if (IsMarkedAsPublic (field))
-                               return;
-
-                       if (field.IsPublic)
-                               SetInternalVisibility (field);
-                       else if (field.IsFamily || field.IsFamilyOrAssembly)
-                               SetProtectedAndInternalVisibility (field);
-               }
-
-               void SetInternalVisibility (FieldDefinition field)
-               {
-                       field.Attributes &= ~FieldAttributes.FieldAccessMask;
-                       field.Attributes |= FieldAttributes.Assembly;
-
-                       MarkInternalized (field);
-               }
-
-               void SetProtectedAndInternalVisibility (FieldDefinition field)
-               {
-                       field.Attributes &= ~FieldAttributes.FieldAccessMask;
-                       field.Attributes |= FieldAttributes.FamANDAssem;
-
-                       MarkInternalized (field);
-               }
-
-               void MarkInternalized (IMetadataTokenProvider provider)
-               {
-                       TunerAnnotations.Internalized (Context, provider);
-               }
-       }
-}
diff --git a/mcs/tools/tuner/Mono.Tuner/ApplyPreserveAttributeBase.cs b/mcs/tools/tuner/Mono.Tuner/ApplyPreserveAttributeBase.cs
deleted file mode 100644 (file)
index 6a910a9..0000000
+++ /dev/null
@@ -1,164 +0,0 @@
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Linq;
-
-using Mono.Linker;
-using Mono.Linker.Steps;
-
-using Mono.Cecil;
-
-namespace Mono.Tuner {
-
-       public abstract class ApplyPreserveAttributeBase : BaseSubStep {
-
-               // set 'removeAttribute' to true if you want the preserved attribute to be removed from the final assembly
-               protected abstract bool IsPreservedAttribute (ICustomAttributeProvider provider, CustomAttribute attribute, out bool removeAttribute);
-
-               public override SubStepTargets Targets {
-                       get {
-                               return SubStepTargets.Type
-                                       | SubStepTargets.Field
-                                       | SubStepTargets.Method
-                                       | SubStepTargets.Property
-                                       | SubStepTargets.Event;
-                       }
-               }
-
-               public override bool IsActiveFor (AssemblyDefinition assembly)
-               {
-                       return !Profile.IsSdkAssembly (assembly) && Annotations.GetAction (assembly) == AssemblyAction.Link;
-               }
-
-               public override void ProcessType (TypeDefinition type)
-               {
-                       TryApplyPreserveAttribute (type);
-               }
-
-               public override void ProcessField (FieldDefinition field)
-               {
-                       foreach (var attribute in GetPreserveAttributes (field))
-                               Mark (field, attribute);
-               }
-
-               public override void ProcessMethod (MethodDefinition method)
-               {
-                       MarkMethodIfPreserved (method);
-               }
-
-               public override void ProcessProperty (PropertyDefinition property)
-               {
-                       foreach (var attribute in GetPreserveAttributes (property)) {
-                               MarkMethod (property.GetMethod, attribute);
-                               MarkMethod (property.SetMethod, attribute);
-                       }
-               }
-
-               public override void ProcessEvent (EventDefinition @event)
-               {
-                       foreach (var attribute in GetPreserveAttributes (@event)) {
-                               MarkMethod (@event.AddMethod, attribute);
-                               MarkMethod (@event.InvokeMethod, attribute);
-                               MarkMethod (@event.RemoveMethod, attribute);
-                       }
-               }
-
-               void MarkMethodIfPreserved (MethodDefinition method)
-               {
-                       foreach (var attribute in GetPreserveAttributes (method)) 
-                               MarkMethod (method, attribute);
-               }
-
-               void MarkMethod (MethodDefinition method, CustomAttribute preserve_attribute)
-               {
-                       if (method == null)
-                               return;
-
-                       Mark (method, preserve_attribute);
-                       Annotations.SetAction (method, MethodAction.Parse);
-               }
-
-               void Mark (IMetadataTokenProvider provider, CustomAttribute preserve_attribute)
-               {
-                       if (IsConditionalAttribute (preserve_attribute)) {
-                               PreserveConditional (provider);
-                               return;
-                       }
-
-                       PreserveUnconditional (provider);
-               }
-
-               void PreserveConditional (IMetadataTokenProvider provider)
-               {
-                       var method = provider as MethodDefinition;
-                       if (method == null) {
-                               // workaround to support (uncommon but valid) conditional fields form [Preserve]
-                               PreserveUnconditional (provider);
-                               return;
-                       }
-
-                       Annotations.AddPreservedMethod (method.DeclaringType, method);
-               }
-
-               static bool IsConditionalAttribute (CustomAttribute attribute)
-               {
-                       if (attribute == null)
-                               return false;
-
-                       foreach (var named_argument in attribute.Fields)
-                               if (named_argument.Name == "Conditional")
-                                       return (bool) named_argument.Argument.Value;
-
-                       return false;
-               }
-
-               void PreserveUnconditional (IMetadataTokenProvider provider)
-               {
-                       Annotations.Mark (provider);
-
-                       var member = provider as IMemberDefinition;
-                       if (member == null || member.DeclaringType == null)
-                               return;
-
-                       Mark (member.DeclaringType, null);
-               }
-
-               void TryApplyPreserveAttribute (TypeDefinition type)
-               {
-                       foreach (var attribute in GetPreserveAttributes (type)) {
-                               Annotations.Mark (type);
-
-                               if (!attribute.HasFields)
-                                       continue;
-                               foreach (var named_argument in attribute.Fields)
-                                       if (named_argument.Name == "AllMembers" && (bool)named_argument.Argument.Value)
-                                               Annotations.SetPreserve (type, TypePreserve.All);
-                       }
-               }
-
-               List<CustomAttribute> GetPreserveAttributes (ICustomAttributeProvider provider)
-               {
-                       List<CustomAttribute> attrs = new List<CustomAttribute> ();
-
-                       if (!provider.HasCustomAttributes)
-                               return attrs;
-
-                       var attributes = provider.CustomAttributes;
-
-                       for (int i = attributes.Count - 1; i >= 0; i--) {
-                               var attribute = attributes [i];
-
-                               bool remote_attribute;
-                               if (!IsPreservedAttribute (provider, attribute, out remote_attribute))
-                                       continue;
-
-                               attrs.Add (attribute);
-                               if (remote_attribute)
-                                       attributes.RemoveAt (i);
-                       }
-
-                       return attrs;
-               }
-       }
-}
diff --git a/mcs/tools/tuner/Mono.Tuner/CecilRocks.cs b/mcs/tools/tuner/Mono.Tuner/CecilRocks.cs
deleted file mode 100644 (file)
index 8d6389b..0000000
+++ /dev/null
@@ -1,519 +0,0 @@
-//
-// MethodBodyRocks.cs
-//
-// Author:
-//   Jb Evain (jbevain@gmail.com)
-//
-// Copyright (c) 2008 - 2011 Jb Evain
-//
-// 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.Linq;
-
-using Mono.Cecil;
-using Mono.Cecil.Cil;
-
-namespace Mono.Tuner {
-
-       public static class MethodBodyRocks {
-
-               public static IEnumerable<TypeDefinition> GetAllTypes (this ModuleDefinition self)
-               {
-                       return self.Types.SelectMany (t => t.GetAllTypes ());
-               }
-
-               static IEnumerable<TypeDefinition> GetAllTypes (this TypeDefinition self)
-               {
-                       yield return self;
-
-                       if (!self.HasNestedTypes)
-                               yield break;
-
-                       foreach (var type in self.NestedTypes.SelectMany (t => t.GetAllTypes ()))
-                               yield return type;
-               }
-
-               public static IEnumerable<MethodDefinition> GetMethods (this TypeDefinition self)
-               {
-                       return self.Methods.Where (m => !m.IsConstructor);
-               }
-
-               public static IEnumerable<MethodDefinition> GetConstructors (this TypeDefinition self)
-               {
-                       return self.Methods.Where (m => m.IsConstructor);
-               }
-
-               public static MethodDefinition GetTypeConstructor (this TypeDefinition self)
-               {
-                       return self.GetConstructors ().FirstOrDefault (c => c.IsStatic);
-               }
-
-               public static void SimplifyMacros (this MethodBody self)
-               {
-                       if (self == null)
-                               throw new ArgumentNullException ("self");
-
-                       foreach (var instruction in self.Instructions) {
-                               if (instruction.OpCode.OpCodeType != OpCodeType.Macro)
-                                       continue;
-
-                               switch (instruction.OpCode.Code) {
-                               case Code.Ldarg_0:
-                                       ExpandMacro (instruction, OpCodes.Ldarg, self.GetParameter (0));
-                                       break;
-                               case Code.Ldarg_1:
-                                       ExpandMacro (instruction, OpCodes.Ldarg, self.GetParameter (1));
-                                       break;
-                               case Code.Ldarg_2:
-                                       ExpandMacro (instruction, OpCodes.Ldarg, self.GetParameter (2));
-                                       break;
-                               case Code.Ldarg_3:
-                                       ExpandMacro (instruction, OpCodes.Ldarg, self.GetParameter (3));
-                                       break;
-                               case Code.Ldloc_0:
-                                       ExpandMacro (instruction, OpCodes.Ldloc, self.Variables [0]);
-                                       break;
-                               case Code.Ldloc_1:
-                                       ExpandMacro (instruction, OpCodes.Ldloc, self.Variables [1]);
-                                       break;
-                               case Code.Ldloc_2:
-                                       ExpandMacro (instruction, OpCodes.Ldloc, self.Variables [2]);
-                                       break;
-                               case Code.Ldloc_3:
-                                       ExpandMacro (instruction, OpCodes.Ldloc, self.Variables [3]);
-                                       break;
-                               case Code.Stloc_0:
-                                       ExpandMacro (instruction, OpCodes.Stloc, self.Variables [0]);
-                                       break;
-                               case Code.Stloc_1:
-                                       ExpandMacro (instruction, OpCodes.Stloc, self.Variables [1]);
-                                       break;
-                               case Code.Stloc_2:
-                                       ExpandMacro (instruction, OpCodes.Stloc, self.Variables [2]);
-                                       break;
-                               case Code.Stloc_3:
-                                       ExpandMacro (instruction, OpCodes.Stloc, self.Variables [3]);
-                                       break;
-                               case Code.Ldarg_S:
-                                       instruction.OpCode = OpCodes.Ldarg;
-                                       break;
-                               case Code.Ldarga_S:
-                                       instruction.OpCode = OpCodes.Ldarga;
-                                       break;
-                               case Code.Starg_S:
-                                       instruction.OpCode = OpCodes.Starg;
-                                       break;
-                               case Code.Ldloc_S:
-                                       instruction.OpCode = OpCodes.Ldloc;
-                                       break;
-                               case Code.Ldloca_S:
-                                       instruction.OpCode = OpCodes.Ldloca;
-                                       break;
-                               case Code.Stloc_S:
-                                       instruction.OpCode = OpCodes.Stloc;
-                                       break;
-                               case Code.Ldc_I4_M1:
-                                       ExpandMacro (instruction, OpCodes.Ldc_I4, -1);
-                                       break;
-                               case Code.Ldc_I4_0:
-                                       ExpandMacro (instruction, OpCodes.Ldc_I4, 0);
-                                       break;
-                               case Code.Ldc_I4_1:
-                                       ExpandMacro (instruction, OpCodes.Ldc_I4, 1);
-                                       break;
-                               case Code.Ldc_I4_2:
-                                       ExpandMacro (instruction, OpCodes.Ldc_I4, 2);
-                                       break;
-                               case Code.Ldc_I4_3:
-                                       ExpandMacro (instruction, OpCodes.Ldc_I4, 3);
-                                       break;
-                               case Code.Ldc_I4_4:
-                                       ExpandMacro (instruction, OpCodes.Ldc_I4, 4);
-                                       break;
-                               case Code.Ldc_I4_5:
-                                       ExpandMacro (instruction, OpCodes.Ldc_I4, 5);
-                                       break;
-                               case Code.Ldc_I4_6:
-                                       ExpandMacro (instruction, OpCodes.Ldc_I4, 6);
-                                       break;
-                               case Code.Ldc_I4_7:
-                                       ExpandMacro (instruction, OpCodes.Ldc_I4, 7);
-                                       break;
-                               case Code.Ldc_I4_8:
-                                       ExpandMacro (instruction, OpCodes.Ldc_I4, 8);
-                                       break;
-                               case Code.Ldc_I4_S:
-                                       ExpandMacro (instruction, OpCodes.Ldc_I4, (int) (sbyte) instruction.Operand);
-                                       break;
-                               case Code.Br_S:
-                                       instruction.OpCode = OpCodes.Br;
-                                       break;
-                               case Code.Brfalse_S:
-                                       instruction.OpCode = OpCodes.Brfalse;
-                                       break;
-                               case Code.Brtrue_S:
-                                       instruction.OpCode = OpCodes.Brtrue;
-                                       break;
-                               case Code.Beq_S:
-                                       instruction.OpCode = OpCodes.Beq;
-                                       break;
-                               case Code.Bge_S:
-                                       instruction.OpCode = OpCodes.Bge;
-                                       break;
-                               case Code.Bgt_S:
-                                       instruction.OpCode = OpCodes.Bgt;
-                                       break;
-                               case Code.Ble_S:
-                                       instruction.OpCode = OpCodes.Ble;
-                                       break;
-                               case Code.Blt_S:
-                                       instruction.OpCode = OpCodes.Blt;
-                                       break;
-                               case Code.Bne_Un_S:
-                                       instruction.OpCode = OpCodes.Bne_Un;
-                                       break;
-                               case Code.Bge_Un_S:
-                                       instruction.OpCode = OpCodes.Bge_Un;
-                                       break;
-                               case Code.Bgt_Un_S:
-                                       instruction.OpCode = OpCodes.Bgt_Un;
-                                       break;
-                               case Code.Ble_Un_S:
-                                       instruction.OpCode = OpCodes.Ble_Un;
-                                       break;
-                               case Code.Blt_Un_S:
-                                       instruction.OpCode = OpCodes.Blt_Un;
-                                       break;
-                               case Code.Leave_S:
-                                       instruction.OpCode = OpCodes.Leave;
-                                       break;
-                               }
-                       }
-               }
-
-               static void ExpandMacro (Instruction instruction, OpCode opcode, object operand)
-               {
-                       instruction.OpCode = opcode;
-                       instruction.Operand = operand;
-               }
-
-               static void MakeMacro (Instruction instruction, OpCode opcode)
-               {
-                       instruction.OpCode = opcode;
-                       instruction.Operand = null;
-               }
-
-               public static void OptimizeMacros (this MethodBody self)
-               {
-                       if (self == null)
-                               throw new ArgumentNullException ("self");
-
-                       var method = self.Method;
-
-                       foreach (var instruction in self.Instructions) {
-                               int index;
-                               switch (instruction.OpCode.Code) {
-                               case Code.Ldarg:
-                                       index = ((ParameterDefinition) instruction.Operand).Index;
-                                       if (index == -1 && instruction.Operand == self.ThisParameter)
-                                               index = 0;
-                                       else if (method.HasThis)
-                                               index++;
-
-                                       switch (index) {
-                                       case 0:
-                                               MakeMacro (instruction, OpCodes.Ldarg_0);
-                                               break;
-                                       case 1:
-                                               MakeMacro (instruction, OpCodes.Ldarg_1);
-                                               break;
-                                       case 2:
-                                               MakeMacro (instruction, OpCodes.Ldarg_2);
-                                               break;
-                                       case 3:
-                                               MakeMacro (instruction, OpCodes.Ldarg_3);
-                                               break;
-                                       default:
-                                               if (index < 256)
-                                                       ExpandMacro (instruction, OpCodes.Ldarg_S, instruction.Operand);
-                                               break;
-                                       }
-                                       break;
-                               case Code.Ldloc:
-                                       index = ((VariableDefinition) instruction.Operand).Index;
-                                       switch (index) {
-                                       case 0:
-                                               MakeMacro (instruction, OpCodes.Ldloc_0);
-                                               break;
-                                       case 1:
-                                               MakeMacro (instruction, OpCodes.Ldloc_1);
-                                               break;
-                                       case 2:
-                                               MakeMacro (instruction, OpCodes.Ldloc_2);
-                                               break;
-                                       case 3:
-                                               MakeMacro (instruction, OpCodes.Ldloc_3);
-                                               break;
-                                       default:
-                                               if (index < 256)
-                                                       ExpandMacro (instruction, OpCodes.Ldloc_S, instruction.Operand);
-                                               break;
-                                       }
-                                       break;
-                               case Code.Stloc:
-                                       index = ((VariableDefinition) instruction.Operand).Index;
-                                       switch (index) {
-                                       case 0:
-                                               MakeMacro (instruction, OpCodes.Stloc_0);
-                                               break;
-                                       case 1:
-                                               MakeMacro (instruction, OpCodes.Stloc_1);
-                                               break;
-                                       case 2:
-                                               MakeMacro (instruction, OpCodes.Stloc_2);
-                                               break;
-                                       case 3:
-                                               MakeMacro (instruction, OpCodes.Stloc_3);
-                                               break;
-                                       default:
-                                               if (index < 256)
-                                                       ExpandMacro (instruction, OpCodes.Stloc_S, instruction.Operand);
-                                               break;
-                                       }
-                                       break;
-                               case Code.Ldarga:
-                                       index = ((ParameterDefinition) instruction.Operand).Index;
-                                       if (index == -1 && instruction.Operand == self.ThisParameter)
-                                               index = 0;
-                                       else if (method.HasThis)
-                                               index++;
-                                       if (index < 256)
-                                               ExpandMacro (instruction, OpCodes.Ldarga_S, instruction.Operand);
-                                       break;
-                               case Code.Ldloca:
-                                       if (((VariableDefinition) instruction.Operand).Index < 256)
-                                               ExpandMacro (instruction, OpCodes.Ldloca_S, instruction.Operand);
-                                       break;
-                               case Code.Ldc_I4:
-                                       int i = (int) instruction.Operand;
-                                       switch (i) {
-                                       case -1:
-                                               MakeMacro (instruction, OpCodes.Ldc_I4_M1);
-                                               break;
-                                       case 0:
-                                               MakeMacro (instruction, OpCodes.Ldc_I4_0);
-                                               break;
-                                       case 1:
-                                               MakeMacro (instruction, OpCodes.Ldc_I4_1);
-                                               break;
-                                       case 2:
-                                               MakeMacro (instruction, OpCodes.Ldc_I4_2);
-                                               break;
-                                       case 3:
-                                               MakeMacro (instruction, OpCodes.Ldc_I4_3);
-                                               break;
-                                       case 4:
-                                               MakeMacro (instruction, OpCodes.Ldc_I4_4);
-                                               break;
-                                       case 5:
-                                               MakeMacro (instruction, OpCodes.Ldc_I4_5);
-                                               break;
-                                       case 6:
-                                               MakeMacro (instruction, OpCodes.Ldc_I4_6);
-                                               break;
-                                       case 7:
-                                               MakeMacro (instruction, OpCodes.Ldc_I4_7);
-                                               break;
-                                       case 8:
-                                               MakeMacro (instruction, OpCodes.Ldc_I4_8);
-                                               break;
-                                       default:
-                                               if (i >= -128 && i < 128)
-                                                       ExpandMacro (instruction, OpCodes.Ldc_I4_S, (sbyte) i);
-                                               break;
-                                       }
-                                       break;
-                               }
-                       }
-
-                       OptimizeBranches (self);
-               }
-
-               static void OptimizeBranches (MethodBody body)
-               {
-                       ComputeOffsets (body);
-
-                       foreach (var instruction in body.Instructions) {
-                               if (instruction.OpCode.OperandType != OperandType.InlineBrTarget)
-                                       continue;
-
-                               if (OptimizeBranch (instruction))
-                                       ComputeOffsets (body);
-                       }
-               }
-
-               static bool OptimizeBranch (Instruction instruction)
-               {
-                       var offset = ((Instruction) instruction.Operand).Offset - (instruction.Offset + instruction.OpCode.Size + 4);
-                       if (!(offset >= -128 && offset <= 127))
-                               return false;
-
-                       switch (instruction.OpCode.Code) {
-                       case Code.Br:
-                               instruction.OpCode = OpCodes.Br_S;
-                               break;
-                       case Code.Brfalse:
-                               instruction.OpCode = OpCodes.Brfalse_S;
-                               break;
-                       case Code.Brtrue:
-                               instruction.OpCode = OpCodes.Brtrue_S;
-                               break;
-                       case Code.Beq:
-                               instruction.OpCode = OpCodes.Beq_S;
-                               break;
-                       case Code.Bge:
-                               instruction.OpCode = OpCodes.Bge_S;
-                               break;
-                       case Code.Bgt:
-                               instruction.OpCode = OpCodes.Bgt_S;
-                               break;
-                       case Code.Ble:
-                               instruction.OpCode = OpCodes.Ble_S;
-                               break;
-                       case Code.Blt:
-                               instruction.OpCode = OpCodes.Blt_S;
-                               break;
-                       case Code.Bne_Un:
-                               instruction.OpCode = OpCodes.Bne_Un_S;
-                               break;
-                       case Code.Bge_Un:
-                               instruction.OpCode = OpCodes.Bge_Un_S;
-                               break;
-                       case Code.Bgt_Un:
-                               instruction.OpCode = OpCodes.Bgt_Un_S;
-                               break;
-                       case Code.Ble_Un:
-                               instruction.OpCode = OpCodes.Ble_Un_S;
-                               break;
-                       case Code.Blt_Un:
-                               instruction.OpCode = OpCodes.Blt_Un_S;
-                               break;
-                       case Code.Leave:
-                               instruction.OpCode = OpCodes.Leave_S;
-                               break;
-                       }
-
-                       return true;
-               }
-
-               static void ComputeOffsets (MethodBody body)
-               {
-                       var offset = 0;
-                       foreach (var instruction in body.Instructions) {
-                               instruction.Offset = offset;
-                               offset += instruction.GetSize ();
-                       }
-               }
-
-               public static ParameterDefinition GetParameter (this MethodBody self, int index)
-               {
-                       var method = self.Method;
-
-                       if (method.HasThis) {
-                               if (index == 0)
-                                       return self.ThisParameter;
-
-                               index--;
-                       }
-
-                       var parameters = method.Parameters;
-
-                       if (index < 0 || index >= parameters.Count)
-                               return null;
-
-                       return parameters [index];
-               }
-
-               public static bool Implements (this TypeReference self, string interfaceName)
-               {
-                       if (interfaceName == null)
-                               throw new ArgumentNullException ("interfaceName");
-                       if (self == null)
-                               return false;
-
-                       TypeDefinition type = self.Resolve ();
-                       if (type == null)
-                               return false;   // not enough information available
-
-                       // special case, check if we implement ourselves
-                       if (type.IsInterface && (type.FullName == interfaceName))
-                               return true;
-
-                       return Implements (type, interfaceName, (interfaceName.IndexOf ('`') >= 0));
-               }
-
-               public static bool Implements (TypeDefinition type, string interfaceName, bool generic)
-               {
-                       while (type != null) {
-                               // does the type implements it itself
-                               if (type.HasInterfaces) {
-                                       foreach (TypeReference iface in type.Interfaces) {
-                                               string fullname = (generic) ? iface.GetElementType ().FullName : iface.FullName;
-                                               if (fullname == interfaceName)
-                                                       return true;
-                                               //if not, then maybe one of its parent interfaces does
-                                               if (Implements (iface.Resolve (), interfaceName, generic))
-                                                       return true;
-                                       }
-                               }
-
-                               type = type.BaseType != null ? type.BaseType.Resolve () : null;
-                       }
-                       return false;
-               }
-
-               public static bool Inherits (this TypeReference self, string @namespace, string name)
-               {
-                       if (@namespace == null)
-                               throw new ArgumentNullException ("namespace");
-                       if (name == null)
-                               throw new ArgumentNullException ("name");
-                       if (self == null)
-                               return false;
-                       
-                       TypeReference current = self.Resolve ();
-                       while (current != null) {
-                               if (current.Is (@namespace, name))
-                                       return true;
-                               if (current.Is ("System", "Object"))
-                                       return false;
-                               
-                               TypeDefinition td = current.Resolve ();
-                               if (td == null)
-                                       return false;           // could not resolve type
-                               current = td.BaseType;
-                       }
-                       return false;
-               }
-       }
-}
diff --git a/mcs/tools/tuner/Mono.Tuner/CheckVisibility.cs b/mcs/tools/tuner/Mono.Tuner/CheckVisibility.cs
deleted file mode 100644 (file)
index df553db..0000000
+++ /dev/null
@@ -1,375 +0,0 @@
-//
-// CheckVisibility.cs
-//
-// Author:
-//   Jb Evain (jbevain@novell.com)
-//
-// (C) 2007 Novell, Inc.
-//
-// 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;
-using System.Text;
-
-using Mono.Linker;
-using Mono.Linker.Steps;
-
-using Mono.Cecil;
-using Mono.Cecil.Cil;
-
-namespace Mono.Tuner {
-
-       public class CheckVisibility : BaseStep {
-
-               bool throw_on_error;
-
-               protected override void Process ()
-               {
-                       throw_on_error = GetThrowOnVisibilityErrorParameter ();
-               }
-
-               bool GetThrowOnVisibilityErrorParameter ()
-               {
-                       try {
-                               return bool.Parse (Context.GetParameter ("throw_on_visibility_error"));
-                       } catch {
-                               return false;
-                       }
-               }
-
-               protected override void ProcessAssembly (AssemblyDefinition assembly)
-               {
-                       if (assembly.Name.Name == "mscorlib" || assembly.Name.Name == "smcs")
-                               return;
-
-                       if (Annotations.GetAction (assembly) != AssemblyAction.Link)
-                               return;
-
-                       Report ("in assembly {0}", assembly.Name);
-
-                       foreach (ModuleDefinition module in assembly.Modules)
-                               foreach (TypeDefinition type in module.Types)
-                                       CheckType (type);
-               }
-
-               void CheckType (TypeDefinition type)
-               {
-                       if (!IsVisibleFrom (type, type.BaseType)) {
-                               ReportError ("Base type `{0}` of type `{1}` is not visible",
-                                       type.BaseType, type);
-                       }
-
-                       CheckInterfaces (type);
-
-                       CheckFields (type);
-                       CheckMethods (type);
-               }
-
-               void CheckInterfaces (TypeDefinition type)
-               {
-                       foreach (var iface in type.Interfaces) {
-                               if (!IsVisibleFrom (type, iface.InterfaceType)) {
-                                       ReportError ("Interface `{0}` implemented by `{1}` is not visible",
-                                               iface, type);
-                               }
-                       }
-               }
-
-               static bool IsPublic (TypeDefinition type)
-               {
-                       return (type.DeclaringType == null && type.IsPublic) || type.IsNestedPublic;
-               }
-
-               static bool AreInDifferentAssemblies (TypeDefinition type, TypeDefinition target)
-               {
-                       if (type.Module.Assembly.Name.FullName == target.Module.Assembly.Name.FullName)
-                               return false;
-
-                       return !IsInternalVisibleTo (target.Module.Assembly, type.Module.Assembly);
-               }
-
-               static bool IsInternalVisibleTo (AssemblyDefinition assembly, AssemblyDefinition candidate)
-               {
-                       foreach (CustomAttribute attribute in assembly.CustomAttributes) {
-                               if (!IsInternalsVisibleToAttribute (attribute))
-                                       continue;
-
-                               if (attribute.ConstructorArguments.Count == 0)
-                                       continue;
-
-                               string signature = (string) attribute.ConstructorArguments [0].Value;
-
-                               if (InternalsVisibleToSignatureMatch (signature, candidate.Name))
-                                       return true;
-                       }
-
-                       return false;
-               }
-
-               static bool InternalsVisibleToSignatureMatch (string signature, AssemblyNameReference reference)
-               {
-                       int pos = signature.IndexOf (",");
-                       if (pos == -1)
-                               return signature == reference.Name;
-
-                       string assembly_name = signature.Substring (0, pos);
-
-                       pos = signature.IndexOf ("=");
-                       if (pos == -1)
-                               throw new ArgumentException ();
-
-                       string public_key = signature.Substring (pos + 1).ToLower ();
-
-                       return assembly_name == reference.Name && public_key == ToPublicKeyString (reference.PublicKey);
-               }
-
-               static string ToPublicKeyString (byte [] public_key)
-               {
-                       StringBuilder signature = new StringBuilder (public_key.Length);
-                       for (int i = 0; i < public_key.Length; i++)
-                               signature.Append (public_key [i].ToString ("x2"));
-
-                       return signature.ToString ();
-               }
-
-               static bool IsInternalsVisibleToAttribute (CustomAttribute attribute)
-               {
-                       return attribute.Constructor.DeclaringType.FullName == "System.Runtime.CompilerServices.InternalsVisibleToAttribute";
-               }
-
-               bool IsVisibleFrom (TypeDefinition type, TypeReference reference)
-               {
-                       if (reference == null)
-                               return true;
-
-                       if (reference is GenericParameter || reference.GetElementType () is GenericParameter)
-                               return true;
-
-                       TypeDefinition other = reference.Resolve ();
-                       if (other == null)
-                               return true;
-
-                       if (!AreInDifferentAssemblies (type, other))
-                               return true;
-
-                       if (IsPublic (other))
-                               return true;
-
-                       return false;
-               }
-
-               bool IsVisibleFrom (TypeDefinition type, MethodReference reference)
-               {
-                       if (reference == null)
-                               return true;
-
-                       MethodDefinition meth = reference.Resolve ();
-                       if (meth == null)
-                               return true;
-
-                       TypeDefinition dec = (TypeDefinition) meth.DeclaringType;
-                       if (!IsVisibleFrom (type, dec))
-                               return false;
-
-                       if (meth.IsPublic)
-                               return true;
-
-                       if (type == dec || IsNestedIn (type, dec))
-                               return true;
-
-                       if (meth.IsFamily && InHierarchy (type, dec))
-                               return true;
-
-                       if (meth.IsFamilyOrAssembly && (!AreInDifferentAssemblies (type, dec) || InHierarchy (type, dec)))
-                               return true;
-
-                       if (meth.IsFamilyAndAssembly && (!AreInDifferentAssemblies (type, dec) && InHierarchy (type, dec)))
-                               return true;
-
-                       if (!AreInDifferentAssemblies (type, dec) && meth.IsAssembly)
-                               return true;
-
-                       return false;
-               }
-
-               bool IsVisibleFrom (TypeDefinition type, FieldReference reference)
-               {
-                       if (reference == null)
-                               return true;
-
-                       FieldDefinition field = reference.Resolve ();
-                       if (field == null)
-                               return true;
-
-                       TypeDefinition dec = (TypeDefinition) field.DeclaringType;
-                       if (!IsVisibleFrom (type, dec))
-                               return false;
-
-                       if (field.IsPublic)
-                               return true;
-
-                       if (type == dec || IsNestedIn (type, dec))
-                               return true;
-
-                       if (field.IsFamily && InHierarchy (type, dec))
-                               return true;
-
-                       if (field.IsFamilyOrAssembly && (!AreInDifferentAssemblies (type, dec) || InHierarchy (type, dec)))
-                               return true;
-
-                       if (field.IsFamilyAndAssembly && (!AreInDifferentAssemblies (type, dec) && InHierarchy (type, dec)))
-                               return true;
-
-                       if (!AreInDifferentAssemblies (type, dec) && field.IsAssembly)
-                               return true;
-
-                       return false;
-               }
-
-               static bool IsNestedIn (TypeDefinition type, TypeDefinition other)
-               {
-                       TypeDefinition declaring = type.DeclaringType;
-
-                       if (declaring == null)
-                               return false;
-
-                       if (declaring == other)
-                               return true;
-
-                       if (declaring.DeclaringType == null)
-                               return false;
-
-                       return IsNestedIn (declaring, other);
-               }
-
-               static bool InHierarchy (TypeDefinition type, TypeDefinition other)
-               {
-                       if (type.BaseType == null)
-                               return false;
-
-                       TypeDefinition baseType = type.BaseType.Resolve ();
-
-                       if (baseType == other)
-                               return true;
-
-                       return InHierarchy (baseType, other);
-               }
-
-               static void Report (string pattern, params object [] parameters)
-               {
-                       Console.WriteLine ("[check] " + pattern, parameters);
-               }
-
-               void ReportError (string pattern, params object [] parameters)
-               {
-                       Report (pattern, parameters);
-
-                       if (throw_on_error)
-                               throw new VisibilityErrorException (string.Format (pattern, parameters));
-               }
-
-               void CheckFields (TypeDefinition type)
-               {
-                       foreach (FieldDefinition field in type.Fields) {
-                               if (!IsVisibleFrom (type, field.FieldType)) {
-                                       ReportError ("Field `{0}` of type `{1}` is not visible from `{2}`",
-                                               field.Name, field.FieldType, type);
-                               }
-                       }
-               }
-
-               void CheckMethods (TypeDefinition type)
-               {
-                       CheckMethods (type, type.Methods);
-               }
-
-               void CheckMethods (TypeDefinition type, ICollection methods)
-               {
-                       foreach (MethodDefinition method in methods) {
-                               if (!IsVisibleFrom (type, method.ReturnType)) {
-                                       ReportError ("Method return type `{0}` in method `{1}` is not visible",
-                                               method.ReturnType, method);
-                               }
-
-                               foreach (ParameterDefinition parameter in method.Parameters) {
-                                       if (!IsVisibleFrom (type, parameter.ParameterType)) {
-                                               ReportError ("Parameter `{0}` of type `{1}` in method `{2}` is not visible.",
-                                                       parameter.Index, parameter.ParameterType, method);
-                                       }
-                               }
-
-                               if (method.HasBody)
-                                       CheckBody (method);
-                       }
-               }
-
-               void CheckBody (MethodDefinition method)
-               {
-                       TypeDefinition type = (TypeDefinition) method.DeclaringType;
-
-                       foreach (VariableDefinition variable in method.Body.Variables) {
-                               if (!IsVisibleFrom ((TypeDefinition) method.DeclaringType, variable.VariableType)) {
-                                       ReportError ("Variable `{0}` of type `{1}` from method `{2}` is not visible",
-                                               variable.Index, variable.VariableType, method);
-                               }
-                       }
-
-                       foreach (Instruction instr in method.Body.Instructions) {
-                               switch (instr.OpCode.OperandType) {
-                               case OperandType.InlineType:
-                               case OperandType.InlineMethod:
-                               case OperandType.InlineField:
-                               case OperandType.InlineTok:
-                                       bool error = false;
-                                       TypeReference type_ref = instr.Operand as TypeReference;
-                                       if (type_ref != null)
-                                               error = !IsVisibleFrom (type, type_ref);
-
-                                       MethodReference meth_ref = instr.Operand as MethodReference;
-                                       if (meth_ref != null)
-                                               error = !IsVisibleFrom (type, meth_ref);
-
-                                       FieldReference field_ref = instr.Operand as FieldReference;
-                                       if (field_ref != null)
-                                               error = !IsVisibleFrom (type, field_ref);
-
-                                       if (error) {
-                                               ReportError ("Operand `{0}` of type {1} at offset 0x{2} in method `{3}` is not visible",
-                                                       instr.Operand, instr.OpCode.OperandType, instr.Offset.ToString ("x4"), method);
-                                       }
-
-                                       break;
-                               default:
-                                       continue;
-                               }
-                       }
-               }
-
-               class VisibilityErrorException : Exception {
-
-                       public VisibilityErrorException (string message)
-                               : base (message)
-                       {
-                       }
-               }
-       }
-}
diff --git a/mcs/tools/tuner/Mono.Tuner/CustomizeActions.cs b/mcs/tools/tuner/Mono.Tuner/CustomizeActions.cs
deleted file mode 100644 (file)
index 1bb6d6f..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-
-using Mono.Linker;
-using Mono.Linker.Steps;
-
-using Mono.Cecil;
-using Mono.Cecil.Cil;
-
-namespace Mono.Tuner {
-
-       public class CustomizeActions : BaseStep {
-
-               readonly bool link_sdk_only;
-               readonly HashSet<string> skipped_assemblies;
-
-               public CustomizeActions (bool link_sdk_only, IEnumerable<string> skipped_assemblies)
-               {
-                       this.link_sdk_only = link_sdk_only;
-                       this.skipped_assemblies = new HashSet<string> (skipped_assemblies);
-               }
-
-               protected override void ProcessAssembly (AssemblyDefinition assembly)
-               {
-                       if (!IsSkipped (assembly) && IsLinked (assembly)) {
-                               if (!Annotations.HasAction (assembly)) // stray assembly not picked up when resolving references
-                                       Annotations.SetAction (assembly, AssemblyAction.Link);
-                               return;
-                       }
-                       ProcessUserAssembly (assembly);
-               }
-
-               protected virtual bool IsPreservedAttribute (CustomAttribute attribute)
-               {
-                       // [assembly: Preserve (type)] does not preserve all the code in the assembly, in fact it might
-                       // not preserve anything in _this_ assembly, but something in a separate assembly (reference)
-                       if (attribute.HasConstructorArguments)
-                               return false;
-                       return (attribute.AttributeType.Name == "PreserveAttribute");
-               }
-
-               protected virtual bool IsLinkerSafeAttribute (CustomAttribute attribute)
-               {
-                       return (attribute.AttributeType.Name == "LinkerSafeAttribute");
-               }
-
-               const ModuleAttributes Supported = ModuleAttributes.ILOnly | ModuleAttributes.Required32Bit | 
-                       ModuleAttributes.Preferred32Bit | ModuleAttributes.StrongNameSigned;
-
-               protected virtual bool IsSkipped (AssemblyDefinition assembly)
-               {
-                       // Cecil can't save back mixed-mode assemblies - so we can't link them
-                       if ((assembly.MainModule.Attributes & ~Supported) != 0)
-                               return true;
-
-                       if (assembly.HasCustomAttributes) {
-                               foreach (var ca in assembly.CustomAttributes) {
-                                       if (IsPreservedAttribute (ca))
-                                               return true;
-                               }
-                       }
-                       return skipped_assemblies.Contains (assembly.Name.Name);
-               }
-
-               protected virtual bool IsLinked (AssemblyDefinition assembly)
-               {
-                       // LinkAll
-                       if (!link_sdk_only)
-                               return true;
-                       // Link SDK : applies to BCL/SDK and product assembly (e.g. monotouch.dll)
-                       if (Profile.IsSdkAssembly (assembly))
-                               return true;
-                       if (Profile.IsProductAssembly (assembly))
-                           return true;
-                       // the assembly can be marked with [LinkAssembly]
-                       if (assembly.HasCustomAttributes) {
-                               foreach (var ca in assembly.CustomAttributes) {
-                                       if (IsLinkerSafeAttribute (ca))
-                                               return true;
-                               }
-                       }
-                       return false;
-               }
-
-               protected void ProcessUserAssembly (AssemblyDefinition assembly)
-               {
-                       ResolveFromAssemblyStep.ProcessLibrary (Context, assembly);
-               }
-       }
-}
diff --git a/mcs/tools/tuner/Mono.Tuner/Dispatcher.cs b/mcs/tools/tuner/Mono.Tuner/Dispatcher.cs
deleted file mode 100644 (file)
index 9dcf5ee..0000000
+++ /dev/null
@@ -1,288 +0,0 @@
-using System;
-using System.Collections;
-using System.Collections.Generic;
-
-using Mono.Linker;
-using Mono.Linker.Steps;
-
-using Mono.Cecil;
-
-namespace Mono.Tuner {
-
-       [Flags]
-       public enum SubStepTargets {
-               None = 0,
-
-               Assembly = 1,
-               Type = 2,
-               Field = 4,
-               Method = 8,
-               Property = 16,
-               Event = 32,
-       }
-
-       public interface ISubStep {
-
-               SubStepTargets Targets { get; }
-
-               void Initialize (LinkContext context);
-               bool IsActiveFor (AssemblyDefinition assembly);
-
-               void ProcessAssembly (AssemblyDefinition assembly);
-               void ProcessType (TypeDefinition type);
-               void ProcessField (FieldDefinition field);
-               void ProcessMethod (MethodDefinition method);
-               void ProcessProperty (PropertyDefinition property);
-               void ProcessEvent (EventDefinition @event);
-       }
-
-       public abstract class BaseSubStep : ISubStep {
-
-               protected LinkContext context;
-
-               public AnnotationStore Annotations {
-                       get { return context.Annotations; }
-               }
-
-               public abstract SubStepTargets Targets { get; }
-
-               public virtual void Initialize (LinkContext context)
-               {
-                       this.context = context;
-               }
-
-               public virtual bool IsActiveFor (AssemblyDefinition assembly)
-               {
-                       return true;
-               }
-
-               public virtual void ProcessAssembly (AssemblyDefinition assembly)
-               {
-               }
-
-               public virtual void ProcessType (TypeDefinition type)
-               {
-               }
-
-               public virtual void ProcessField (FieldDefinition field)
-               {
-               }
-
-               public virtual void ProcessMethod (MethodDefinition method)
-               {
-               }
-
-               public virtual void ProcessProperty (PropertyDefinition property)
-               {
-               }
-
-               public virtual void ProcessEvent (EventDefinition @event)
-               {
-               }
-       }
-
-       public class SubStepDispatcher : IStep, IEnumerable<ISubStep> {
-
-               List<ISubStep> substeps = new List<ISubStep> ();
-
-               List<ISubStep> on_assemblies;
-               List<ISubStep> on_types;
-               List<ISubStep> on_fields;
-               List<ISubStep> on_methods;
-               List<ISubStep> on_properties;
-               List<ISubStep> on_events;
-
-               public void Add (ISubStep substep)
-               {
-                       substeps.Add (substep);
-               }
-
-               public void Process (LinkContext context)
-               {
-                       InitializeSubSteps (context);
-
-                       BrowseAssemblies (context.GetAssemblies ());
-               }
-
-               static bool HasSubSteps (List<ISubStep> substeps)
-               {
-                       return substeps != null && substeps.Count > 0;
-               }
-
-               void BrowseAssemblies (IEnumerable<AssemblyDefinition> assemblies)
-               {
-                       foreach (var assembly in assemblies) {
-                               CategorizeSubSteps (assembly);
-
-                               if (HasSubSteps (on_assemblies))
-                                       DispatchAssembly (assembly);
-
-                               if (!ShouldDispatchTypes ())
-                                       continue;
-
-                               BrowseTypes (assembly.MainModule.Types);
-                       }
-               }
-
-               bool ShouldDispatchTypes ()
-               {
-                       return HasSubSteps (on_types)
-                               || HasSubSteps (on_fields)
-                               || HasSubSteps (on_methods)
-                               || HasSubSteps (on_properties)
-                               || HasSubSteps (on_events);
-               }
-
-               void BrowseTypes (ICollection types)
-               {
-                       foreach (TypeDefinition type in types) {
-                               DispatchType (type);
-
-                               if (type.HasFields && HasSubSteps (on_fields))
-                                       BrowseFields (type.Fields);
-
-                               if (type.HasMethods && HasSubSteps (on_methods))
-                                       BrowseMethods (type.Methods);
-
-                               if (type.HasProperties && HasSubSteps (on_properties))
-                                       BrowseProperties (type.Properties);
-
-                               if (type.HasEvents && HasSubSteps (on_events))
-                                       BrowseEvents (type.Events);
-
-                               if (type.HasNestedTypes)
-                                       BrowseTypes (type.NestedTypes);
-                       }
-               }
-
-               void BrowseFields (ICollection fields)
-               {
-                       foreach (FieldDefinition field in fields)
-                               DispatchField (field);
-               }
-
-               void BrowseMethods (ICollection methods)
-               {
-                       foreach (MethodDefinition method in methods)
-                               DispatchMethod (method);
-               }
-
-               void BrowseProperties (ICollection properties)
-               {
-                       foreach (PropertyDefinition property in properties)
-                               DispatchProperty (property);
-               }
-
-               void BrowseEvents (ICollection events)
-               {
-                       foreach (EventDefinition @event in events)
-                               DispatchEvent (@event);
-               }
-
-               void DispatchAssembly (AssemblyDefinition assembly)
-               {
-                       foreach (var substep in on_assemblies) {
-                               var bs = substep as BaseSubStep;
-                               if (bs != null)
-                                       bs.Annotations.Push (substep);
-                               substep.ProcessAssembly (assembly);
-                               if (bs != null)
-                                       bs.Annotations.Pop ();
-                       }
-               }
-
-               void DispatchType (TypeDefinition type)
-               {
-                       foreach (var substep in on_types) {
-                               var bs = substep as BaseSubStep;
-                               if (bs != null)
-                                       bs.Annotations.Push (substep);
-                               substep.ProcessType (type);
-                               if (bs != null)
-                                       bs.Annotations.Pop ();
-                       }
-               }
-
-               void DispatchField (FieldDefinition field)
-               {
-                       foreach (var substep in on_fields)
-                               substep.ProcessField (field);
-               }
-
-               void DispatchMethod (MethodDefinition method)
-               {
-                       foreach (var substep in on_methods)
-                               substep.ProcessMethod (method);
-               }
-
-               void DispatchProperty (PropertyDefinition property)
-               {
-                       foreach (var substep in on_properties)
-                               substep.ProcessProperty (property);
-               }
-
-               void DispatchEvent (EventDefinition @event)
-               {
-                       foreach (var substep in on_events)
-                               substep.ProcessEvent (@event);
-               }
-
-               void InitializeSubSteps (LinkContext context)
-               {
-                       foreach (var substep in substeps)
-                               substep.Initialize (context);
-               }
-
-               void CategorizeSubSteps (AssemblyDefinition assembly)
-               {
-                       on_assemblies = null;
-                       on_types = null;
-                       on_fields = null;
-                       on_methods = null;
-                       on_properties = null;
-                       on_events = null;
-
-                       foreach (var substep in substeps)
-                               CategorizeSubStep (substep, assembly);
-               }
-
-               void CategorizeSubStep (ISubStep substep, AssemblyDefinition assembly)
-               {
-                       if (!substep.IsActiveFor (assembly))
-                               return;
-
-                       CategorizeTarget (substep, SubStepTargets.Assembly, ref on_assemblies);
-                       CategorizeTarget (substep, SubStepTargets.Type, ref on_types);
-                       CategorizeTarget (substep, SubStepTargets.Field, ref on_fields);
-                       CategorizeTarget (substep, SubStepTargets.Method, ref on_methods);
-                       CategorizeTarget (substep, SubStepTargets.Property, ref on_properties);
-                       CategorizeTarget (substep, SubStepTargets.Event, ref on_events);
-               }
-
-               static void CategorizeTarget (ISubStep substep, SubStepTargets target, ref List<ISubStep> list)
-               {
-                       if (!Targets (substep, target))
-                               return;
-
-                       if (list == null)
-                               list = new List<ISubStep> ();
-
-                       list.Add (substep);
-               }
-
-               static bool Targets (ISubStep substep, SubStepTargets target)
-               {
-                       return (substep.Targets & target) == target;
-               }
-
-               IEnumerator IEnumerable.GetEnumerator ()
-               {
-                       return GetEnumerator ();
-               }
-
-               public IEnumerator<ISubStep> GetEnumerator ()
-               {
-                       return substeps.GetEnumerator ();
-               }
-       }
-}
diff --git a/mcs/tools/tuner/Mono.Tuner/Extensions.cs b/mcs/tools/tuner/Mono.Tuner/Extensions.cs
deleted file mode 100644 (file)
index 3e3b312..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-using System;
-using System.Collections.Generic;
-
-using Mono.Cecil;
-
-using Mono.Linker;
-
-namespace Mono.Tuner {
-
-       public static partial class Extensions {
-
-               public static bool TryGetLinkedAssembly (this LinkContext context, string name, out AssemblyDefinition assembly)
-               {
-                       assembly = GetAssembly (context, name);
-                       if (assembly == null)
-                               return false;
-
-                       return context.Annotations.GetAction (assembly) == AssemblyAction.Link;
-               }
-
-               public static AssemblyDefinition GetAssembly (this LinkContext context, string assembly_name)
-               {
-                       foreach (var assembly in context.GetAssemblies ())
-                               if (assembly.Name.Name == assembly_name)
-                                       return assembly;
-
-                       return null;
-               }
-
-               // note: direct check, no inheritance
-               public static bool Is (this TypeReference type, string @namespace, string name)
-               {
-                       return ((type != null) && (type.Name == name) && (type.Namespace == @namespace));
-               }
-       }
-}
diff --git a/mcs/tools/tuner/Mono.Tuner/FilterAttributes.cs b/mcs/tools/tuner/Mono.Tuner/FilterAttributes.cs
deleted file mode 100644 (file)
index 19a334a..0000000
+++ /dev/null
@@ -1,157 +0,0 @@
-//
-// FilterAttributes.cs
-//
-// Author:
-//   Jb Evain (jbevain@novell.com)
-//
-// (C) 2009 Novell, Inc.
-//
-// 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;
-
-using Mono.Linker;
-using Mono.Linker.Steps;
-
-using Mono.Cecil;
-
-namespace Mono.Tuner {
-
-       public class FilterAttributes : BaseStep {
-
-               static Hashtable attributes = new Hashtable ();
-
-               static FilterAttributes ()
-               {
-                       FilterAttribute ("System.Runtime.InteropServices.ComVisibleAttribute");
-               }
-
-               static void FilterAttribute (string fullname)
-               {
-                       attributes.Add (fullname, null);
-               }
-
-               protected override void ProcessAssembly (AssemblyDefinition assembly)
-               {
-                       if (Annotations.GetAction (assembly) != AssemblyAction.Link)
-                               return;
-
-                       Filter (assembly);
-
-                       foreach (ModuleDefinition module in assembly.Modules)
-                               ProcessModule (module);
-               }
-
-               static void ProcessModule (ModuleDefinition module)
-               {
-                       Filter (module);
-
-                       foreach (TypeDefinition type in module.Types)
-                               ProcessType (type);
-               }
-
-               static void ProcessType (TypeDefinition type)
-               {
-                       if (type.HasFields)
-                               ProcessFields (type.Fields);
-
-                       if (type.HasMethods)
-                               ProcessMethods (type.Methods);
-
-                       if (type.HasEvents)
-                               ProcessEvents (type.Events);
-
-                       if (type.HasProperties)
-                               ProcessProperties (type.Properties);
-
-                       ProcessGenericParameters (type);
-               }
-
-               static void ProcessFields (ICollection fields)
-               {
-                       foreach (FieldDefinition field in fields)
-                               Filter (field);
-               }
-
-               static void ProcessMethods (ICollection methods)
-               {
-                       foreach (MethodDefinition method in methods)
-                               ProcessMethod (method);
-               }
-
-               static void ProcessMethod (MethodDefinition method)
-               {
-                       ProcessGenericParameters (method);
-
-                       Filter (method.MethodReturnType);
-
-                       if (method.HasParameters)
-                               ProcessParameters (method.Parameters);
-               }
-
-               static void ProcessParameters (ICollection parameters)
-               {
-                       foreach (ParameterDefinition parameter in parameters)
-                               Filter (parameter);
-               }
-
-               static void ProcessGenericParameters (IGenericParameterProvider provider)
-               {
-                       if (!provider.HasGenericParameters)
-                               return;
-
-                       foreach (GenericParameter parameter in provider.GenericParameters)
-                               Filter (parameter);
-               }
-
-               static void ProcessEvents (ICollection events)
-               {
-                       foreach (EventDefinition @event in events)
-                               Filter (@event);
-               }
-
-               static void ProcessProperties (ICollection properties)
-               {
-                       foreach (PropertyDefinition property in properties)
-                               Filter (property);
-               }
-
-               static void Filter (ICustomAttributeProvider provider)
-               {
-                       if (!provider.HasCustomAttributes)
-                               return;
-
-                       for (int i = 0; i < provider.CustomAttributes.Count; i++) {
-                               CustomAttribute attribute = provider.CustomAttributes [i];
-                               if (!IsFilteredAttribute (attribute))
-                                       continue;
-
-                               provider.CustomAttributes.RemoveAt (i--);
-                       }
-               }
-
-               static bool IsFilteredAttribute (CustomAttribute attribute)
-               {
-                       return attributes.Contains (attribute.Constructor.DeclaringType.FullName);
-               }
-       }
-}
diff --git a/mcs/tools/tuner/Mono.Tuner/FixModuleFlags.cs b/mcs/tools/tuner/Mono.Tuner/FixModuleFlags.cs
deleted file mode 100644 (file)
index 2bb01ab..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-using System;
-
-using Mono.Linker;
-using Mono.Linker.Steps;
-
-using Mono.Cecil;
-
-namespace Mono.Tuner {
-
-       public class FixModuleFlags : BaseStep {
-
-               protected override void ProcessAssembly (AssemblyDefinition assembly)
-               {
-                       if (Annotations.GetAction (assembly) != AssemblyAction.Link)
-                               return;
-
-                       assembly.MainModule.Attributes = ModuleAttributes.ILOnly;
-               }
-       }
-}
diff --git a/mcs/tools/tuner/Mono.Tuner/InjectSecurityAttributes.cs b/mcs/tools/tuner/Mono.Tuner/InjectSecurityAttributes.cs
deleted file mode 100644 (file)
index 9489876..0000000
+++ /dev/null
@@ -1,500 +0,0 @@
-//
-// InjectSecurityAttributes.cs
-//
-// Author:
-//   Jb Evain (jbevain@novell.com)
-//
-// (C) 2009 Novell, Inc.
-//
-// 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;
-using System.IO;
-using System.Linq;
-using System.Text;
-
-using Mono.Linker;
-using Mono.Linker.Steps;
-
-using Mono.Cecil;
-using Mono.Cecil.Cil;
-
-namespace Mono.Tuner {
-
-       public class InjectSecurityAttributes : BaseStep {
-
-               enum TargetKind {
-                       Type,
-                       Method,
-               }
-
-               protected enum AttributeType {
-                       Critical,
-                       SafeCritical,
-               }
-
-               const string _safe_critical = "System.Security.SecuritySafeCriticalAttribute";
-               const string _critical = "System.Security.SecurityCriticalAttribute";
-               const string _system_void = "System.Void";
-
-               const string sec_attr_folder = "secattrs";
-
-               protected AssemblyDefinition _assembly;
-
-               MethodDefinition _safe_critical_ctor;
-               MethodDefinition _critical_ctor;
-               TypeDefinition _void_type;
-
-               string data_folder;
-
-               protected override bool ConditionToProcess ()
-               {
-                       if (!Context.HasParameter (sec_attr_folder)) {
-                               Console.Error.WriteLine ("Warning: no secattrs folder specified.");
-                               return false;
-                       }
-
-                       data_folder = Context.GetParameter (sec_attr_folder);
-                       return true;
-               }
-
-               protected override void ProcessAssembly (AssemblyDefinition assembly)
-               {
-                       if (Annotations.GetAction (assembly) != AssemblyAction.Link)
-                               return;
-
-                       string secattr_file = Path.Combine (
-                               data_folder,
-                               assembly.Name.Name + ".secattr");
-
-                       if (!File.Exists (secattr_file)) {
-                               Console.Error.WriteLine ("Warning: file '{0}' not found, skipping.", secattr_file);
-                               return;
-                       }
-
-                       _assembly = assembly;
-
-                       // remove existing [SecurityCritical] and [SecuritySafeCritical]
-                       RemoveSecurityAttributes ();
-
-                       // add [SecurityCritical] and [SecuritySafeCritical] from the data file
-                       ProcessSecurityAttributeFile (secattr_file);
-               }
-
-               protected void RemoveSecurityAttributes ()
-               {
-                       foreach (TypeDefinition type in _assembly.MainModule.Types) {
-                               if (RemoveSecurityAttributes (type))
-                                       type.HasSecurity = false;
-
-                               if (type.HasMethods) {
-                                       foreach (MethodDefinition method in type.Methods) {
-                                               if (RemoveSecurityAttributes (method))
-                                                       method.HasSecurity = false;
-                                       }
-                               }
-                       }
-               }
-
-               static bool RemoveSecurityDeclarations (ISecurityDeclarationProvider provider)
-               {
-                       // also remove already existing CAS security declarations
-
-                       if (provider == null)
-                               return false;
-
-                       if (!provider.HasSecurityDeclarations)
-                               return false;
-
-                       provider.SecurityDeclarations.Clear ();
-                       return true;
-               }
-
-               static bool RemoveSecurityAttributes (ICustomAttributeProvider provider)
-               {
-                       bool result = RemoveSecurityDeclarations (provider as ISecurityDeclarationProvider);
-
-                       if (!provider.HasCustomAttributes)
-                               return result;
-
-                       var attributes = provider.CustomAttributes;
-                       for (int i = 0; i < attributes.Count; i++) {
-                               CustomAttribute attribute = attributes [i];
-                               switch (attribute.Constructor.DeclaringType.FullName) {
-                               case _safe_critical:
-                               case _critical:
-                                       attributes.RemoveAt (i--);
-                                       break;
-                               }
-                       }
-                       return result;
-               }
-
-               void ProcessSecurityAttributeFile (string file)
-               {
-                       using (StreamReader reader = File.OpenText (file)) {
-                               string line;
-                               while ((line = reader.ReadLine ()) != null)
-                                       ProcessLine (line);
-                       }
-               }
-
-               void ProcessLine (string line)
-               {
-                       if (line == null || line.Length < 6 || line [0] == '#')
-                               return;
-
-                       int sep = line.IndexOf (": ");
-                       if (sep == -1)
-                               return;
-
-                       string marker = line.Substring (0, sep);
-                       string target = line.Substring (sep + 2);
-
-                       ProcessSecurityAttributeEntry (
-                               DecomposeAttributeType (marker),
-                               DecomposeTargetKind (marker),
-                               target);
-               }
-
-               static AttributeType DecomposeAttributeType (string marker)
-               {
-                       if (marker.StartsWith ("SC"))
-                               return AttributeType.Critical;
-                       else if (marker.StartsWith ("SSC"))
-                               return AttributeType.SafeCritical;
-                       else
-                               throw new ArgumentException ();
-               }
-
-               static TargetKind DecomposeTargetKind (string marker)
-               {
-                       switch (marker [marker.Length - 1]) {
-                       case 'T':
-                               return TargetKind.Type;
-                       case 'M':
-                               return TargetKind.Method;
-                       default:
-                               throw new ArgumentException ();
-                       }
-               }
-
-               public static bool NeedsDefaultConstructor (TypeDefinition type)
-               {
-                       if (type.IsInterface)
-                               return false;
-
-                       TypeReference base_type = type.BaseType;
-                       if ((base_type == null) || (base_type.Namespace != "System"))
-                               return true;
-
-                       return ((base_type.Name != "Delegate") && (base_type.Name != "MulticastDelegate"));
-               }
-
-               void ProcessSecurityAttributeEntry (AttributeType type, TargetKind kind, string target)
-               {
-                       ICustomAttributeProvider provider = GetTarget (kind, target);
-                       if (provider == null) {
-                               Console.Error.WriteLine ("Warning: entry '{0}' could not be found", target);
-                               return;
-                       }
-
-                       // we need to be smarter when applying the attributes (mostly SC) to types
-                       if (kind == TargetKind.Type) {
-                               TypeDefinition td = (provider as TypeDefinition);
-                               // ensure [SecurityCritical] types (well most) have a default constructor
-                               if ((type == AttributeType.Critical) && NeedsDefaultConstructor (td)) {
-                                       if (GetDefaultConstructor (td) == null) {
-                                               // Console.Error.WriteLine ("Info: adding default ctor for '{0}'", td);
-                                               td.Methods.Add (CreateDefaultConstructor ());
-                                       }
-                               }
-
-                               // it's easier for some tools (e.g. less false positives in fxcop) 
-                               // and also quicker for the runtime (one less lookup) if all methods gets decorated
-                               foreach (MethodDefinition method in td.Methods) {
-                                       bool skip = false;
-
-                                       AttributeType mtype = type;
-                                       // there are cases where an SC cannot be applied to some methods
-                                       switch (method.Name) {
-                                       // e.g. everything we override from System.Object (which is transparent)
-                                       case "Equals":
-                                               skip = method.Parameters.Count == 1 && method.Parameters [0].ParameterType.FullName == "System.Object";
-                                               break;
-                                       case "Finalize":
-                                       case "GetHashCode":
-                                       case "ToString":
-                                               skip = !method.HasParameters;
-                                               break;
-                                       // e.g. some transparent interfaces, like IDisposable (implicit or explicit)
-                                       // downgrade some SC into SSC to respect the override/inheritance rules
-                                       case "System.IDisposable.Dispose":
-                                       case "Dispose":
-                                               skip = !method.HasParameters;
-                                               break;
-                                       }
-
-                                       if (skip)
-                                               continue;
-
-                                       switch (mtype) {
-                                       case AttributeType.Critical:
-                                               AddCriticalAttribute (method);
-                                               break;
-                                       case AttributeType.SafeCritical:
-                                               AddSafeCriticalAttribute (method);
-                                               break;
-                                       }
-                               }
-                       }
-
-                       switch (type) {
-                       case AttributeType.Critical:
-                               AddCriticalAttribute (provider);
-                               break;
-                       case AttributeType.SafeCritical:
-                               AddSafeCriticalAttribute (provider);
-                               break;
-                       }
-               }
-
-               protected void AddCriticalAttribute (ICustomAttributeProvider provider)
-               {
-                       // a [SecurityCritical] replaces a [SecuritySafeCritical]
-                       if (HasSecurityAttribute (provider, AttributeType.SafeCritical))
-                               RemoveSecurityAttributes (provider);
-
-                       AddSecurityAttribute (provider, AttributeType.Critical);
-               }
-
-               void AddSafeCriticalAttribute (ICustomAttributeProvider provider)
-               {
-                       // a [SecuritySafeCritical] is ignored if a [SecurityCritical] is present
-                       if (HasSecurityAttribute (provider, AttributeType.Critical))
-                               return;
-
-                       AddSecurityAttribute (provider, AttributeType.SafeCritical);
-               }
-
-               void AddSecurityAttribute (ICustomAttributeProvider provider, AttributeType type)
-               {
-                       if (HasSecurityAttribute (provider, type))
-                               return;
-
-                       var attributes = provider.CustomAttributes;
-                       switch (type) {
-                       case AttributeType.Critical:
-                               attributes.Add (CreateCriticalAttribute ());
-                               break;
-                       case AttributeType.SafeCritical:
-                               attributes.Add (CreateSafeCriticalAttribute ());
-                               break;
-                       }
-               }
-
-               protected static bool HasSecurityAttribute (ICustomAttributeProvider provider, AttributeType type)
-               {
-                       if (!provider.HasCustomAttributes)
-                               return false;
-
-                       foreach (CustomAttribute attribute in provider.CustomAttributes) {
-                               switch (attribute.Constructor.DeclaringType.Name) {
-                               case _critical:
-                                       if (type == AttributeType.Critical)
-                                               return true;
-
-                                       break;
-                               case _safe_critical:
-                                       if (type == AttributeType.SafeCritical)
-                                               return true;
-
-                                       break;
-                               }
-                       }
-
-                       return false;
-               }
-
-               ICustomAttributeProvider GetTarget (TargetKind kind, string target)
-               {
-                       switch (kind) {
-                       case TargetKind.Type:
-                               return GetType (target);
-                       case TargetKind.Method:
-                               return GetMethod (target);
-                       default:
-                               throw new ArgumentException ();
-                       }
-               }
-
-               TypeDefinition GetType (string fullname)
-               {
-                       return _assembly.MainModule.GetType (fullname);
-               }
-
-               MethodDefinition GetMethod (string signature)
-               {
-                       int pos = signature.IndexOf (" ");
-                       if (pos == -1)
-                               throw new ArgumentException ();
-
-                       string tmp = signature.Substring (pos + 1);
-
-                       pos = tmp.IndexOf ("::");
-                       if (pos == -1)
-                               throw new ArgumentException ();
-
-                       string type_name = tmp.Substring (0, pos);
-
-                       int parpos = tmp.IndexOf ("(");
-                       if (parpos == -1)
-                               throw new ArgumentException ();
-
-                       string method_name = tmp.Substring (pos + 2, parpos - pos - 2);
-
-                       TypeDefinition type = GetType (type_name);
-                       if (type == null)
-                               return null;
-
-                       return GetMethod (type.Methods, signature);
-               }
-
-               static MethodDefinition GetMethod (IEnumerable methods, string signature)
-               {
-                       foreach (MethodDefinition method in methods)
-                               if (GetFullName (method) == signature)
-                                       return method;
-
-                       return null;
-               }
-
-               static string GetFullName (MethodReference method)
-               {
-                       var sentinel = method.Parameters.FirstOrDefault (p => p.ParameterType.IsSentinel);
-                       var sentinel_pos = -1;
-                       if (sentinel != null)
-                               sentinel_pos = method.Parameters.IndexOf (sentinel);
-
-                       StringBuilder sb = new StringBuilder ();
-                       sb.Append (method.ReturnType.FullName);
-                       sb.Append (" ");
-                       sb.Append (method.DeclaringType.FullName);
-                       sb.Append ("::");
-                       sb.Append (method.Name);
-                       if (method.HasGenericParameters) {
-                               sb.Append ("<");
-                               for (int i = 0; i < method.GenericParameters.Count; i++ ) {
-                                       if (i > 0)
-                                               sb.Append (",");
-                                       sb.Append (method.GenericParameters [i].Name);
-                               }
-                               sb.Append (">");
-                       }
-                       sb.Append ("(");
-                       if (method.HasParameters) {
-                               for (int i = 0; i < method.Parameters.Count; i++) {
-                                       if (i > 0)
-                                               sb.Append (",");
-
-                                       if (i == sentinel_pos)
-                                               sb.Append ("...,");
-
-                                       sb.Append (method.Parameters [i].ParameterType.FullName);
-                               }
-                       }
-                       sb.Append (")");
-                       return sb.ToString ();
-               }
-
-               static MethodDefinition GetDefaultConstructor (TypeDefinition type)
-               {
-                       foreach (MethodDefinition ctor in type.Methods.Where (m => m.IsConstructor))
-                               if (!ctor.IsStatic && !ctor.HasParameters)
-                                       return ctor;
-
-                       return null;
-               }
-
-               MethodDefinition GetSafeCriticalCtor ()
-               {
-                       if (_safe_critical_ctor != null)
-                               return _safe_critical_ctor;
-
-                       TypeDefinition safe_critical_type = Context.GetType (_safe_critical);
-                       if (safe_critical_type == null)
-                               throw new InvalidOperationException (String.Format ("{0} type not found", _safe_critical));
-
-                       _safe_critical_ctor = GetDefaultConstructor (safe_critical_type);
-                       return _safe_critical_ctor;
-               }
-
-               MethodDefinition GetCriticalCtor ()
-               {
-                       if (_critical_ctor != null)
-                               return _critical_ctor;
-
-                       TypeDefinition critical_type = Context.GetType (_critical);
-                       if (critical_type == null)
-                               throw new InvalidOperationException (String.Format ("{0} type not found", _critical));
-
-                       _critical_ctor = GetDefaultConstructor (critical_type);
-                       return _critical_ctor;
-               }
-
-               TypeDefinition GetSystemVoid ()
-               {
-                       if (_void_type != null)
-                               return _void_type;
-
-                       _void_type = Context.GetType (_system_void);
-                       if (_void_type == null)
-                               throw new InvalidOperationException (String.Format ("{0} type not found", _system_void));
-
-                       return _void_type;
-               }
-
-               MethodReference Import (MethodDefinition method)
-               {
-                       return _assembly.MainModule.Import (method);
-               }
-
-               CustomAttribute CreateSafeCriticalAttribute ()
-               {
-                       return new CustomAttribute (Import (GetSafeCriticalCtor ()));
-               }
-
-               CustomAttribute CreateCriticalAttribute ()
-               {
-                       return new CustomAttribute (Import (GetCriticalCtor ()));
-               }
-
-               MethodDefinition CreateDefaultConstructor ()
-               {
-                       MethodDefinition method = new MethodDefinition (".ctor", 
-                               MethodAttributes.HideBySig | MethodAttributes.SpecialName | MethodAttributes.RTSpecialName, 
-                               GetSystemVoid ());
-                       method.Body.Instructions.Add (Instruction.Create (OpCodes.Ret));
-                       return method;
-               }
-       }
-}
diff --git a/mcs/tools/tuner/Mono.Tuner/MarkNSObjectsBase.cs b/mcs/tools/tuner/Mono.Tuner/MarkNSObjectsBase.cs
deleted file mode 100644 (file)
index 9d65be1..0000000
+++ /dev/null
@@ -1,149 +0,0 @@
-//
-// MarkNSObjectsBase.cs
-//
-// Authors:
-//     Jb Evain (jbevain@novell.com)
-//     Sebastien Pouliot  <sebastien@xamarin.com>
-//
-// (C) 2009 Novell, Inc.
-// Copyright (C) 2011 Xamarin, Inc.
-//
-// 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;
-using System.Collections.Generic;
-using System.Linq;
-
-using Mono.Linker;
-using Mono.Linker.Steps;
-
-using Mono.Tuner;
-
-using Mono.Cecil;
-
-namespace Mono.Tuner {
-
-       public abstract class MarkNSObjectsBase : BaseSubStep {
-
-               protected abstract string ExportAttribute { get; }
-
-               public override SubStepTargets Targets {
-                       get { return SubStepTargets.Type; }
-               }
-
-               public override void ProcessType (TypeDefinition type)
-               {
-                       if (!IsProductType (type)) {
-                               Annotations.Mark (type);
-                               Annotations.SetPreserve (type, TypePreserve.All);
-                       } else
-                               PreserveProductType (type);
-               }
-
-               void PreserveProductType (TypeDefinition type)
-               {
-                       PreserveIntPtrConstructor (type);
-                       PreserveExportedMethods (type);
-               }
-
-               void PreserveExportedMethods (TypeDefinition type)
-               {
-                       if (!type.HasMethods)
-                               return;
-
-                       foreach (var method in type.GetMethods ()) {
-                               if (!IsExportedMethod (method))
-                                       continue;
-
-                               if (!IsOverridenInUserCode (method))
-                                       continue;
-
-                               PreserveMethod (type, method);
-                       }
-               }
-
-               bool IsOverridenInUserCode (MethodDefinition method)
-               {
-                       if (!method.IsVirtual)
-                               return false;
-
-                       var overrides = Annotations.GetOverrides (method);
-                       if (overrides == null || overrides.Count == 0)
-                               return false;
-
-                       foreach (MethodDefinition @override in overrides)
-                               if (!IsProductMethod (@override))
-                                       return true;
-
-                       return false;
-               }
-
-               bool IsExportedMethod (MethodDefinition method)
-               {
-                       return HasExportAttribute (method);
-               }
-
-               bool HasExportAttribute (ICustomAttributeProvider provider)
-               {
-                       if (!provider.HasCustomAttributes)
-                               return false;
-
-                       foreach (CustomAttribute attribute in provider.CustomAttributes)
-                               if (attribute.AttributeType.FullName == ExportAttribute)
-                                       return true;
-
-                       return false;
-               }
-
-               void PreserveIntPtrConstructor (TypeDefinition type)
-               {
-                       if (!type.HasMethods)
-                               return;
-
-                       foreach (MethodDefinition constructor in type.GetConstructors ()) {
-                               if (!constructor.HasParameters)
-                                       continue;
-
-                               if (constructor.Parameters.Count != 1 || constructor.Parameters [0].ParameterType.FullName != "System.IntPtr")
-                                       continue;
-
-                               PreserveMethod (type, constructor);
-                               break; // only one .ctor can match this
-                       }
-               }
-
-               void PreserveMethod (TypeDefinition type, MethodDefinition method)
-               {
-                       Annotations.AddPreservedMethod (type, method);
-               }
-
-               static bool IsProductMethod (MethodDefinition method)
-               {
-                       return IsProductType (method.DeclaringType);
-               }
-
-               static bool IsProductType (TypeDefinition type)
-               {
-                       return Profile.IsProductAssembly (type.Module.Assembly);
-               }
-       }
-}
diff --git a/mcs/tools/tuner/Mono.Tuner/MoonlightA11yApiMarker.cs b/mcs/tools/tuner/Mono.Tuner/MoonlightA11yApiMarker.cs
deleted file mode 100644 (file)
index fcd61af..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-//
-// MoonlightA11yApiMarker.cs
-//
-// Author:
-//   Andrés G. Aragoneses (aaragoneses@novell.com)
-//
-// (C) 2009 Novell, Inc.
-//
-// 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;
-using System.Xml;
-
-using Mono.Linker;
-using Mono.Linker.Steps;
-
-using Mono.Cecil;
-
-namespace Mono.Tuner {
-
-       public class MoonlightA11yApiMarker : MarkStep {
-
-               bool IsA11yAssembly (AssemblyDefinition assembly)
-               {
-                       return assembly.ToString ().Contains ("DummyEntry") || assembly.ToString ().Contains ("MoonAtkBridge");
-               }
-
-               protected override void InitializeAssembly (AssemblyDefinition assembly)
-               {
-                       if (IsA11yAssembly (assembly))
-                               base.InitializeAssembly (assembly);
-               }
-
-               protected override void EnqueueMethod (MethodDefinition method)
-               {
-                       if (IsA11yAssembly (method.DeclaringType.Module.Assembly))
-                               base.EnqueueMethod (method);
-                       else
-                               Annotations.Mark (method);
-               }
-
-               protected override bool IgnoreScope (IMetadataScope scope)
-               {
-                       return false;
-               }
-
-               protected override TypeDefinition MarkType (TypeReference reference)
-               {
-                       if (reference == null)
-                               throw new ArgumentNullException ("reference");
-
-                       reference = GetOriginalType (reference);
-
-                       if (reference is GenericParameter)
-                               return null;
-
-                       TypeDefinition type = reference.Resolve ();
-
-                       if (type == null)
-                               throw new ResolutionException (reference);
-
-                       if (CheckProcessed (type))
-                               return type;
-
-                       Annotations.Mark (type);
-                       return type;
-               }
-       }
-}
diff --git a/mcs/tools/tuner/Mono.Tuner/MoonlightA11yAssemblyStep.cs b/mcs/tools/tuner/Mono.Tuner/MoonlightA11yAssemblyStep.cs
deleted file mode 100644 (file)
index 63a82b2..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-//
-// MoonlightA11yAssemblyStep.cs
-//
-// Author:
-//   Andrés G. Aragoneses (aaragoneses@novell.com)
-//
-// (C) 2009 Novell, Inc.
-//
-// 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;
-using System.IO;
-
-using Mono.Linker;
-using Mono.Linker.Steps;
-
-using Mono.Cecil;
-
-namespace Mono.Tuner {
-
-       public class MoonlightA11yAssemblyStep : MoonlightAssemblyStep {
-
-               protected override void CustomizePipeline (Pipeline pipeline)
-               {
-                       pipeline.RemoveStep (typeof (LoadI18nAssemblies));
-                       pipeline.RemoveStep (typeof (BlacklistStep));
-                       pipeline.RemoveStep (typeof (MarkStep));
-                       pipeline.RemoveStep (typeof (SweepStep));
-                       pipeline.RemoveStep (typeof (CleanStep));
-                       pipeline.RemoveStep (typeof (RegenerateGuidStep));
-                       pipeline.AddStepBefore (typeof (OutputStep), new MoonlightA11yProcessor ());
-               }
-
-       }
-}
diff --git a/mcs/tools/tuner/Mono.Tuner/MoonlightA11yDescriptorGenerator.cs b/mcs/tools/tuner/Mono.Tuner/MoonlightA11yDescriptorGenerator.cs
deleted file mode 100644 (file)
index 17db23b..0000000
+++ /dev/null
@@ -1,337 +0,0 @@
-//
-// MoonlightA11yDescriptorGenerator.cs
-//
-// Author:
-//   Andrés G. Aragoneses (aaragoneses@novell.com)
-//
-// (C) 2009 Novell, Inc.
-//
-// 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;
-using System.Collections.Generic;
-
-using System.IO;
-using System.Text.RegularExpressions;
-using System.Text;
-
-using System.Xml;
-using System.Xml.XPath;
-
-using Mono.Linker;
-using Mono.Linker.Steps;
-
-using Mono.Cecil;
-
-namespace Mono.Tuner {
-
-       public class MoonlightA11yDescriptorGenerator : BaseStep {
-
-               XmlTextWriter writer = null;
-               protected override void ProcessAssembly (AssemblyDefinition assembly)
-               {
-                       if (assembly.Name.Name == "MoonAtkBridge" || assembly.Name.Name == "System.Windows" ||
-                           assembly.Name.Name.Contains ("Dummy"))
-                               return;
-
-                       if (writer == null) {
-                               if (!Directory.Exists (Context.OutputDirectory))
-                                       Directory.CreateDirectory (Context.OutputDirectory);
-
-                               string file_name = "descriptors.xml";
-                               string file_path = Path.Combine (Context.OutputDirectory, file_name);
-                               if (File.Exists (file_path))
-                                       File.Delete (file_path);
-                               FileStream xml_file = new FileStream (file_path, FileMode.OpenOrCreate);
-                               Console.WriteLine ("Created file {0}", file_name);
-                               Console.Write ("Writing contents...");
-
-                               writer = new XmlTextWriter (xml_file, System.Text.Encoding.UTF8);
-                               writer.Formatting = Formatting.Indented;
-                               writer.WriteStartElement("linker");
-                       }
-
-                       SortedDictionary <TypeDefinition, IList> types = ScanAssembly (assembly);
-                       if (types != null && types.Count > 0) {
-                               writer.WriteStartElement("assembly");
-                               writer.WriteAttributeString ("fullname", assembly.Name.Name);
-
-                               foreach (TypeDefinition type in types.Keys) {
-                                       IList members = types [type];
-                                       if (members != null && members.Count > 0) {
-                                               writer.WriteStartElement("type");
-                                               writer.WriteAttributeString ("fullname", type.FullName);
-
-                                               foreach (IMetadataTokenProvider member in members) {
-                                                       MethodDefinition method = member as MethodDefinition;
-                                                       if (method != null) {
-                                                               writer.WriteStartElement("method");
-                                                               writer.WriteAttributeString ("signature",
-                                                                                            method.ReturnType.FullName + " " +
-                                                                                            method.Name + GetMethodParams (method));
-                                                               writer.WriteEndElement ();
-                                                               continue;
-                                                       }
-
-                                                       FieldDefinition field = member as FieldDefinition;
-                                                       if (field != null) {
-                                                               writer.WriteStartElement("field");
-                                                               writer.WriteAttributeString ("signature", field.DeclaringType.FullName + " " + field.Name);
-                                                               writer.WriteEndElement ();
-                                                       }
-                                               }
-                                               writer.WriteEndElement ();
-                                       }
-                               }
-
-                               writer.WriteEndElement ();
-                               Console.WriteLine ();
-                       }
-
-               }
-
-               protected override void EndProcess ()
-               {
-                       Console.WriteLine ();
-
-                       foreach (FileStream stream in streams)
-                               stream.Close ();
-
-                       if (writer != null) {
-                               writer.WriteEndElement ();
-                               writer.Close ();
-                               writer = null;
-                       }
-               }
-
-               //this is almost the ToString method of MethodDefinition...
-               private string GetMethodParams (MethodDefinition method)
-               {
-                       string @params = "(";
-                       if (method.HasParameters) {
-                               for (int i = 0; i < method.Parameters.Count; i++) {
-                                       if (i > 0)
-                                               @params += ",";
-
-                                       @params += method.Parameters [i].ParameterType.FullName;
-                               }
-                       }
-                       @params += ")";
-                       return @params;
-               }
-
-               SortedDictionary<TypeDefinition, IList> /*,List<IAnnotationProvider>>*/ ScanAssembly (AssemblyDefinition assembly)
-               {
-                       if (Annotations.GetAction (assembly) != AssemblyAction.Link)
-                               return null;
-
-                       SortedDictionary<TypeDefinition, IList> members_used = new SortedDictionary<TypeDefinition, IList> (new TypeComparer ());
-                       foreach (TypeDefinition type in assembly.MainModule.Types) {
-                               IList used_providers = FilterPublicMembers (ScanType (type));
-                               if (used_providers.Count > 0)
-                                       members_used [type] = used_providers;
-                               else if (IsInternal (type, true) &&
-                                        Annotations.IsMarked (type))
-                                       throw new NotSupportedException (String.Format ("The type {0} is used while its API is not", type.ToString ()));
-                       }
-                       return members_used;
-               }
-
-               IList ScanType (TypeDefinition type)
-               {
-                       return ExtractUsedProviders (type.Methods, type.Fields);
-               }
-
-               static IList FilterPublicMembers (IList members)
-               {
-                       IList new_list = new ArrayList ();
-                       foreach (MemberReference item in members)
-                               if (IsInternal (item, true))
-                                       new_list.Add (item);
-
-                       return new_list;
-               }
-
-               static string [] master_infos = Directory.GetFiles (Environment.CurrentDirectory, "*.info");
-
-               static string FindMasterInfoFile (string name)
-               {
-                       if (master_infos.Length == 0)
-                               throw new Exception ("No masterinfo files found in current directory");
-
-                       foreach (string file in master_infos) {
-                               if (file.EndsWith (name + ".info"))
-                                       return file;
-                       }
-
-                       return null;
-               }
-
-               const string xpath_init = "assemblies/assembly/namespaces/namespace[@name='{0}']/classes/class[@name='{1}']";
-
-               static string GetXPathSearchForType (TypeDefinition type)
-               {
-                       TypeDefinition parent_type = type;
-                       string xpath = String.Empty;
-                       while (parent_type.DeclaringType != null) {
-                               xpath = String.Format ("/classes/class[@name='{0}']", parent_type.Name) + xpath;
-                               parent_type = parent_type.DeclaringType;
-                       }
-                       return String.Format (xpath_init, parent_type.Namespace, parent_type.Name) + xpath;
-               }
-
-               static bool IsInternal (MemberReference member, bool master_info)
-               {
-                       TypeDefinition type = null;
-                       string master_info_file = null;
-
-                       if (member is TypeDefinition) {
-                               type = member as TypeDefinition;
-                               if (!master_info)
-                                       return (!type.IsNested && !type.IsPublic) ||
-                                              (type.IsNested && (!type.IsNestedPublic || IsInternal (type.DeclaringType, false)));
-
-                               master_info_file = FindMasterInfoFile (type.Module.Assembly.Name.Name);
-                               if (master_info_file == null)
-                                       return IsInternal (member, false);
-
-                               return !NodeExists (master_info_file, GetXPathSearchForType (type));
-                       }
-
-                       type = member.DeclaringType.Resolve ();
-
-                       if (IsInternal (type, master_info))
-                               return true;
-
-                       MethodDefinition method = member as MethodDefinition;
-                       FieldDefinition field = member as FieldDefinition;
-
-                       if (field == null && method == null)
-                               throw new System.NotSupportedException ("Members to scan should be methods or fields");
-
-                       if (!master_info) {
-
-                               if (method != null)
-                                       return !method.IsPublic;
-
-                               return !field.IsPublic;
-                       }
-
-                       master_info_file = FindMasterInfoFile (type.Module.Assembly.Name.Name);
-                       if (master_info_file == null)
-                               return IsInternal (member, false);
-
-                       string xpath_type = GetXPathSearchForType (type);
-                       string name;
-                       if (field != null)
-                               name = field.Name;
-                       else {
-                               name = method.ToString ();
-
-                               //lame, I know...
-                               name = WackyOutArgs (WackyCommas (name.Substring (name.IndexOf ("::") + 2)
-                                                   .Replace ("/", "+") // nested classes
-                                                   .Replace ('<', '[').Replace ('>', ']'))); //generic params
-                       }
-
-                       if (field != null || !IsPropertyMethod (method))
-                               return !NodeExists (master_info_file, xpath_type + String.Format ("/*/*[@name='{0}']", name));
-
-                       return !NodeExists (master_info_file, xpath_type + String.Format ("/properties/*/*/*[@name='{0}']", name));
-               }
-
-               //at some point I want to get rid of this method and ask cecil's maintainer to spew commas in a uniform way...
-               static string WackyCommas (string method)
-               {
-                       string outstring = String.Empty;
-                       bool square_bracket = false;
-                       foreach (char c in method) {
-                               if (c == '[')
-                                       square_bracket = true;
-                               else if (c == ']')
-                                       square_bracket = false;
-
-                               outstring = outstring + c;
-
-                               if (c == ',' && !square_bracket)
-                                       outstring = outstring + " ";
-                       }
-                       return outstring;
-               }
-
-               //ToString() spews & but not 'out' keyword
-               static string WackyOutArgs (string method)
-               {
-                       return Regex.Replace (method, @"\w+&", delegate (Match m) { return "out " + m.ToString (); });
-               }
-
-               //copied from MarkStep (violating DRY unless I can put this in a better place... Cecil?)
-               static bool IsPropertyMethod (MethodDefinition md)
-               {
-                       return (md.SemanticsAttributes & MethodSemanticsAttributes.Getter) != 0 ||
-                               (md.SemanticsAttributes & MethodSemanticsAttributes.Setter) != 0;
-               }
-
-               static Dictionary<string, XPathNavigator> navs = new Dictionary<string, XPathNavigator> ();
-               static List<FileStream> streams = new List<FileStream> ();
-
-               static bool NodeExists (string file, string xpath)
-               {
-                       Console.Write (".");
-                       //Console.WriteLine ("Looking for node {0} in file {1}", xpath, file.Substring (file.LastIndexOf ("/") + 1));
-
-                       XPathNavigator nav = null;
-                       if (!navs.TryGetValue (file, out nav)) {
-                               FileStream stream = new FileStream (file, FileMode.Open);
-                               XPathDocument document = new XPathDocument (stream);
-                               nav = document.CreateNavigator ();
-                               streams.Add (stream);
-                               navs [file] = nav;
-                       }
-                       return nav.SelectSingleNode (xpath) != null;
-               }
-
-               IList /*List<IAnnotationProvider>*/ ExtractUsedProviders (params IList[] members)
-               {
-                       IList used = new ArrayList ();
-                       if (members == null || members.Length == 0)
-                               return used;
-
-                       foreach (IList members_list in members)
-                               foreach (IMetadataTokenProvider provider in members_list)
-                                       if (Annotations.IsMarked (provider))
-                                               used.Add (provider);
-
-                       return used;
-               }
-
-               class TypeComparer : IComparer <TypeDefinition> {
-
-                       public int Compare (TypeDefinition x, TypeDefinition y)
-                       {
-                               return string.Compare (x.ToString (), y.ToString ());
-                       }
-
-               }
-
-       }
-}
diff --git a/mcs/tools/tuner/Mono.Tuner/MoonlightA11yProcessor.cs b/mcs/tools/tuner/Mono.Tuner/MoonlightA11yProcessor.cs
deleted file mode 100644 (file)
index 2971b11..0000000
+++ /dev/null
@@ -1,179 +0,0 @@
-//
-// MoonlightA11yProcessor.cs
-//
-// Author:
-//   Andrés G. Aragoneses (aaragoneses@novell.com)
-//
-// (C) 2009 Novell, Inc.
-//
-// 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.Linq;
-
-using Mono.Cecil;
-
-using Mono.Linker;
-
-namespace Mono.Tuner {
-
-       public class MoonlightA11yProcessor : InjectSecurityAttributes {
-
-               protected override bool ConditionToProcess ()
-               {
-                       return true;
-               }
-
-               protected override void ProcessAssembly (AssemblyDefinition assembly)
-               {
-                       if (Annotations.GetAction (assembly) != AssemblyAction.Link)
-                               return;
-
-                       _assembly = assembly;
-
-                       // remove existing [SecurityCritical] and [SecuritySafeCritical]
-                       RemoveSecurityAttributes ();
-
-                       // add [SecurityCritical]
-                       AddSecurityAttributes ();
-
-                       // convert all public members into internal
-                       MakeApiInternal ();
-               }
-
-               void MakeApiInternal ()
-               {
-                       foreach (TypeDefinition type in _assembly.MainModule.Types) {
-                               if (type.IsPublic)
-                                       type.IsPublic = false;
-
-                               if (type.HasMethods && !type.Name.EndsWith ("Adapter"))
-                                       foreach (MethodDefinition ctor in type.Methods.Where (m => m.IsConstructor))
-                                               if (ctor.IsPublic)
-                                                       ctor.IsAssembly = true;
-
-                               if (type.HasMethods)
-                                       foreach (MethodDefinition method in type.Methods.Where (m => !m.IsConstructor))
-                                               if (method.IsPublic)
-                                                       method.IsAssembly = true;
-                       }
-               }
-
-               void AddSecurityAttributes ()
-               {
-                       foreach (TypeDefinition type in _assembly.MainModule.Types) {
-                               AddCriticalAttribute (type);
-
-                               if (type.HasMethods)
-                                       foreach (MethodDefinition ctor in type.Methods.Where (m => m.IsConstructor))
-                                               AddCriticalAttribute (ctor);
-
-                               if (type.HasMethods)
-                                       foreach (MethodDefinition method in type.Methods.Where (m => !m.IsConstructor)) {
-                                               MethodDefinition parent = null;
-
-                                               //TODO: take in account generic params
-                                               if (!method.HasGenericParameters) {
-
-                                                       /*
-                                                        * we need to scan base methods because the CoreCLR complains about SC attribs added
-                                                        * to overriden methods whose base (virtual or interface) method is not marked as SC
-                                                        * with TypeLoadExceptions
-                                                        */
-                                                       parent = GetBaseMethod (type, method);
-                                               }
-
-                                               //if there's no base method
-                                               if (parent == null ||
-
-                                               //if it's our bridge assembly, we're sure it will (finally, at the end of the linking process) have the SC attrib
-                                                   _assembly.MainModule.Types.Contains (parent.DeclaringType) ||
-
-                                               //if the type is in the moonlight assemblies, check if it has the SC attrib
-                                                   HasSecurityAttribute (parent, AttributeType.Critical))
-
-                                                       AddCriticalAttribute (method);
-                               }
-
-                       }
-               }
-
-               MethodDefinition GetBaseMethod (TypeDefinition finalType, MethodDefinition final)
-               {
-                       // both GetOverridenMethod and GetInterfaceMethod return null if there is no base method
-                       return GetOverridenMethod (finalType, final) ?? GetInterfaceMethod (finalType, final);
-               }
-
-               //note: will not return abstract methods
-               MethodDefinition GetOverridenMethod (TypeDefinition finalType, MethodDefinition final)
-               {
-                       TypeReference baseType = finalType.BaseType;
-                       while (baseType != null && baseType.Resolve () != null) {
-                               foreach (MethodDefinition method in baseType.Resolve ().Methods) {
-                                       if (!method.IsVirtual || method.Name != final.Name)
-                                               continue;
-
-                                       //TODO: should we discard them?
-                                       if (method.IsAbstract)
-                                               continue;
-
-                                       if (HasSameSignature (method, final))
-                                               return method;
-                               }
-                               baseType = baseType.Resolve().BaseType;
-                       }
-                       return null;
-               }
-
-               MethodDefinition GetInterfaceMethod (TypeDefinition finalType, MethodDefinition final)
-               {
-                       TypeDefinition baseType = finalType;
-                       while (baseType != null) {
-                               if (baseType.HasInterfaces)
-                                       foreach (var @interface in baseType.Interfaces)
-                                               foreach (MethodDefinition method in @interface.InterfaceType.Resolve ().Methods)
-                                                       if (method.Name == final.Name && HasSameSignature (method, final))
-                                                               return method;
-
-                               baseType = baseType.BaseType == null ? null : baseType.BaseType.Resolve ();
-                       }
-                       return null;
-               }
-
-               bool HasSameSignature (MethodDefinition method1, MethodDefinition method2)
-               {
-                       if (method1.ReturnType.FullName != method2.ReturnType.FullName)
-                               return false;
-
-                       if (method1.Parameters.Count != method2.Parameters.Count)
-                               return false;
-
-                       for (int i = 0; i < method1.Parameters.Count; i++) {
-                               if (method1.Parameters [i].ParameterType.FullName !=
-                                   method2.Parameters [i].ParameterType.FullName)
-                                       return false;
-                       }
-
-                       return true;
-               }
-       }
-}
diff --git a/mcs/tools/tuner/Mono.Tuner/MoonlightA11yUsageInspectionStep.cs b/mcs/tools/tuner/Mono.Tuner/MoonlightA11yUsageInspectionStep.cs
deleted file mode 100644 (file)
index 27aa4a2..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-//
-// MoonlightA11yUsageInspectionStep.cs
-//
-// Author:
-//   Andrés G. Aragoneses (aaragoneses@novell.com)
-//
-// (C) 2009 Novell, Inc.
-//
-// 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;
-using System.IO;
-
-using Mono.Linker;
-using Mono.Linker.Steps;
-
-using Mono.Cecil;
-
-namespace Mono.Tuner {
-
-       public class MoonlightA11yUsageInspectionStep : MoonlightAssemblyStep {
-
-               protected override void CustomizePipeline (Pipeline pipeline)
-               {
-                       pipeline.ReplaceStep (typeof (MarkStep), new MoonlightA11yApiMarker ());
-                       pipeline.ReplaceStep (typeof (SweepStep), new MoonlightA11yDescriptorGenerator ());
-                       pipeline.RemoveStep (typeof (LoadI18nAssemblies));
-                       pipeline.RemoveStep (typeof (CleanStep));
-                       pipeline.RemoveStep (typeof (RegenerateGuidStep));
-                       pipeline.RemoveStep (typeof (OutputStep));
-               }
-       }
-}
diff --git a/mcs/tools/tuner/Mono.Tuner/MoonlightAssemblyStep.cs b/mcs/tools/tuner/Mono.Tuner/MoonlightAssemblyStep.cs
deleted file mode 100644 (file)
index fc98536..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-//
-// MoonlightAssemblyStep.cs
-//
-// Author:
-//   Jb Evain (jbevain@novell.com)
-//
-// (C) 2009 Novell, Inc.
-//
-// 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;
-using System.IO;
-
-using Mono.Linker;
-using Mono.Linker.Steps;
-
-using Mono.Cecil;
-
-namespace Mono.Tuner {
-
-       public class MoonlightAssemblyStep : IStep {
-
-               public void Process (LinkContext context)
-               {
-                       CustomizePipeline (context.Pipeline);
-                       ProcessAssemblies (context);
-               }
-
-               static void ProcessAssemblies (LinkContext context)
-               {
-                       foreach (AssemblyDefinition assembly in context.GetAssemblies ())
-                               context.Annotations.SetAction (assembly, AssemblyAction.Link);
-               }
-
-               protected virtual void CustomizePipeline (Pipeline pipeline)
-               {
-                       pipeline.RemoveStep (typeof (LoadI18nAssemblies));
-                       pipeline.RemoveStep (typeof (BlacklistStep));
-                       pipeline.RemoveStep (typeof (TypeMapStep));
-                       pipeline.RemoveStep (typeof (MarkStep));
-                       pipeline.RemoveStep (typeof (SweepStep));
-                       pipeline.RemoveStep (typeof (CleanStep));
-                       pipeline.RemoveStep (typeof (RegenerateGuidStep));
-                       pipeline.AddStepBefore (typeof (OutputStep), new InjectSecurityAttributes ());
-               }
-       }
-}
diff --git a/mcs/tools/tuner/Mono.Tuner/PreserveCrypto.cs b/mcs/tools/tuner/Mono.Tuner/PreserveCrypto.cs
deleted file mode 100644 (file)
index 18dbe7f..0000000
+++ /dev/null
@@ -1,122 +0,0 @@
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Linq;
-
-using Mono.Linker;
-using Mono.Linker.Steps;
-
-using Mono.Cecil;
-using Mono.Cecil.Cil;
-
-namespace Mono.Tuner {
-
-       public class PreserveCrypto : IStep {
-
-               AnnotationStore annotations;
-
-               public void Process (LinkContext context)
-               {
-                       annotations = context.Annotations;
-
-                       ProcessCorlib (context);
-                       ProcessSystemCore (context);
-               }
-
-               void ProcessCorlib (LinkContext context)
-               {
-                       AssemblyDefinition corlib;
-                       if (!context.TryGetLinkedAssembly ("mscorlib", out corlib))
-                               return;
-
-                       AddPreserveInfo (corlib, "DES", "DESCryptoServiceProvider");
-                       AddPreserveInfo (corlib, "DSA", "DSACryptoServiceProvider");
-                       AddPreserveInfo (corlib, "RandomNumberGenerator", "RNGCryptoServiceProvider");
-                       AddPreserveInfo (corlib, "SHA1", "SHA1CryptoServiceProvider");
-                       AddPreserveInfo (corlib, "SHA1", "SHA1Managed");
-                       AddPreserveInfo (corlib, "MD5", "MD5CryptoServiceProvider");
-                       AddPreserveInfo (corlib, "RC2", "RC2CryptoServiceProvider");
-                       AddPreserveInfo (corlib, "TripleDES", "TripleDESCryptoServiceProvider");
-
-                       AddPreserveInfo (corlib, "Rijndael", "RijndaelManaged");
-                       AddPreserveInfo (corlib, "RIPEMD160", "RIPEMD160Managed");
-                       AddPreserveInfo (corlib, "SHA256", "SHA256Managed");
-                       AddPreserveInfo (corlib, "SHA384", "SHA384Managed");
-                       AddPreserveInfo (corlib, "SHA512", "SHA512Managed");
-
-                       AddPreserveInfo (corlib, "HMAC", "HMACMD5");
-                       AddPreserveInfo (corlib, "HMAC", "HMACRIPEMD160");
-                       AddPreserveInfo (corlib, "HMAC", "HMACSHA1");
-                       AddPreserveInfo (corlib, "HMAC", "HMACSHA256");
-                       AddPreserveInfo (corlib, "HMAC", "HMACSHA384");
-                       AddPreserveInfo (corlib, "HMAC", "HMACSHA512");
-
-                       AddPreserveInfo (corlib, "HMACMD5", "MD5CryptoServiceProvider");
-                       AddPreserveInfo (corlib, "HMACRIPEMD160", "RIPEMD160Managed");
-                       AddPreserveInfo (corlib, "HMACSHA1", "SHA1CryptoServiceProvider");
-                       AddPreserveInfo (corlib, "HMACSHA1", "SHA1Managed");
-                       AddPreserveInfo (corlib, "HMACSHA256", "SHA256Managed");
-                       AddPreserveInfo (corlib, "HMACSHA384", "SHA384Managed");
-                       AddPreserveInfo (corlib, "HMACSHA512", "SHA512Managed");
-
-                       TryAddPreserveInfo (corlib, "Aes", "AesManaged");
-
-                       var corlibAes = GetCryptoType (corlib, "Aes");
-                       Preserve (corlibAes, GetCryptoType (corlib, "AesManaged"));
-
-                       AssemblyDefinition syscore;
-                       if (context.TryGetLinkedAssembly ("System.Core", out syscore))
-                               Preserve (corlibAes, GetCryptoType (syscore, "AesCryptoServiceProvider"));
-               }
-
-               void ProcessSystemCore (LinkContext context)
-               {
-                       AssemblyDefinition syscore;
-                       if (!context.TryGetLinkedAssembly ("System.Core", out syscore))
-                               return;
-
-                       // AddPreserveInfo (syscore, "Aes", "AesCryptoServiceProvider");
-                       TryAddPreserveInfo (syscore, "Aes", "AesManaged");
-               }
-
-               bool TryAddPreserveInfo (AssemblyDefinition assembly, string name, string type)
-               {
-                       var marker = GetCryptoType (assembly, name);
-                       if (marker == null)
-                               return false;
-
-                       var implementation = GetCryptoType (assembly, type);
-                       if (implementation == null)
-                               return false;
-
-                       Preserve (marker, implementation);
-                       return true;
-               }
-
-               void AddPreserveInfo (AssemblyDefinition assembly, string name, string type)
-               {
-                       var marker = GetCryptoType (assembly, name);
-                       if (marker == null)
-                               throw new ArgumentException (name);
-
-                       var implementation = GetCryptoType (assembly, type);
-                       if (implementation == null)
-                               throw new ArgumentException (type);
-
-                       Preserve (marker, implementation);
-               }
-
-               void Preserve (TypeDefinition marker, TypeDefinition implementation)
-               {
-                       if (marker == null || implementation == null)
-                               return;
-                       foreach (var constructor in implementation.GetConstructors ())
-                               annotations.AddPreservedMethod (marker, constructor);
-               }
-
-               TypeDefinition GetCryptoType (AssemblyDefinition assembly, string name)
-               {
-                       return assembly.MainModule.GetType ("System.Security.Cryptography." + name);
-               }
-       }
-}
diff --git a/mcs/tools/tuner/Mono.Tuner/PreserveHttps.cs b/mcs/tools/tuner/Mono.Tuner/PreserveHttps.cs
deleted file mode 100644 (file)
index c3c56c7..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-using System;
-using System.IO;
-using System.Xml.XPath;
-
-using Mono.Linker;
-using Mono.Linker.Steps;
-
-using Mono.Cecil;
-
-namespace Mono.Tuner {
-
-       public class PreserveHttps : BaseStep {
-
-               static string [] types = new [] {
-                       "System.Net.WebRequest",
-                       "System.Net.WebClient",
-                       "System.Net.Security.RemoteCertificateValidationCallback",
-                       "System.Web.Services.Protocols.WebClientProtocol",
-                       "System.Security.Cryptography.X509Certificates.X509Certificate",
-                       "System.ServiceModel.ClientBase`1",
-                       "System.Web.Services.WebServiceBindingAttribute",
-                       "System.Web.Services.Protocols.SoapHttpClientProtocol",
-                       "System.Xml.XmlDocument"
-               };
-
-               bool need_https;
-
-               protected override void ProcessAssembly (AssemblyDefinition assembly)
-               {
-                       if (need_https)
-                               return;
-
-                       if (Profile.IsSdkAssembly (assembly) || Profile.IsProductAssembly (assembly))
-                               return;
-
-                       if (HasNeededReference (assembly.MainModule))
-                               need_https = true;
-               }
-
-               static bool HasNeededReference (ModuleDefinition module)
-               {
-                       foreach (var type in types)
-                               if (module.HasTypeReference (type))
-                                       return true;
-
-                       return false;
-               }
-
-               protected override void EndProcess ()
-               {
-                       if (!need_https)
-                               return;
-
-                       var mono_security = Context.Resolve ("Mono.Security");
-                       if (mono_security == null)
-                               return;
-
-                       if (Annotations.GetAction (mono_security) != AssemblyAction.Link)
-                               return;
-
-                       var xml_preserve = CreatePreserveStep ();
-                       Context.Pipeline.AddStepAfter (typeof (PreserveHttps), xml_preserve);
-//                     Context.Pipeline.AddStepAfter (xml_preserve, new PreserveCrypto ());
-               }
-
-               static IStep CreatePreserveStep ()
-               {
-                       return new ResolveFromXmlStep (
-                               new XPathDocument (
-                                       new StringReader (descriptor)));
-               }
-
-               const string descriptor = @"<?xml version=""1.0"" encoding=""utf-8"" ?>
-<linker>
-       <assembly fullname=""Mono.Security"">
-               <type fullname=""Mono.Security.Protocol.Tls.HttpsClientStream"" />
-               <type fullname=""Mono.Security.Protocol.Tls.SslClientStream"" />
-               <type fullname=""Mono.Security.Protocol.Tls.SslStreamBase"" />
-       </assembly>
-</linker>
-";
-       }
-}
diff --git a/mcs/tools/tuner/Mono.Tuner/PreserveSoapHttpClients.cs b/mcs/tools/tuner/Mono.Tuner/PreserveSoapHttpClients.cs
deleted file mode 100644 (file)
index bdb04a9..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-using System;
-
-using Mono.Linker;
-
-using Mono.Cecil;
-
-namespace Mono.Tuner {
-
-       public class PreserveSoapHttpClients : BaseSubStep {
-
-               public override SubStepTargets Targets {
-                       get { return SubStepTargets.Type; }
-               }
-
-               public override bool IsActiveFor (AssemblyDefinition assembly)
-               {
-                       return Annotations.GetAction (assembly) == AssemblyAction.Link && !Profile.IsSdkAssembly (assembly);
-               }
-
-               public override void ProcessType (TypeDefinition type)
-               {
-                       if (IsWebServiceClient (type))
-                               PreserveClient (type);
-               }
-
-               void PreserveClient (TypeDefinition type)
-               {
-                       if (!type.HasMethods)
-                               return;
-
-                       foreach (MethodDefinition method in type.Methods) {
-                               string sync_method;
-                               if (!TryExtractSyncMethod (method, out sync_method))
-                                       continue;
-
-                               AddPreservedMethod (method, sync_method);
-                       }
-               }
-
-               void AddPreservedMethod (MethodDefinition target, string methodName)
-               {
-                       foreach (MethodDefinition method in target.DeclaringType.Methods)
-                               if (method.Name == methodName)
-                                       Annotations.AddPreservedMethod (target, method);
-               }
-
-               static bool TryExtractSyncMethod (MethodDefinition method, out string sync_method)
-               {
-                       if (TryExtractPrefixedMethodName ("Begin", method.Name, out sync_method))
-                               return true;
-
-                       if (TryExtractPrefixedMethodName ("End", method.Name, out sync_method))
-                               return true;
-
-                       if (TryExtractSuffixedMethodName ("Async", method.Name, out sync_method))
-                               return true;
-
-                       return false;
-               }
-
-               static bool TryExtractPrefixedMethodName (string prefix, string fullName, out string methodName)
-               {
-                       methodName = null;
-
-                       int pos = fullName.IndexOf (prefix, StringComparison.Ordinal);
-                       if (pos == -1)
-                               return false;
-
-                       methodName = fullName.Substring (prefix.Length);
-                       return true;
-               }
-
-               static bool TryExtractSuffixedMethodName (string suffix, string fullName, out string methodName)
-               {
-                       methodName = null;
-
-                       int pos = fullName.LastIndexOf (suffix, StringComparison.Ordinal);
-                       if (pos == -1)
-                               return false;
-
-                       methodName = fullName.Substring (0, pos);
-                       return true;
-               }
-
-               static bool IsWebServiceClient (TypeDefinition type)
-               {
-                       return type.Inherits ("System.Web.Services.Protocols", "SoapHttpClientProtocol");
-               }
-       }
-}
\ No newline at end of file
diff --git a/mcs/tools/tuner/Mono.Tuner/PrintStatus.cs b/mcs/tools/tuner/Mono.Tuner/PrintStatus.cs
deleted file mode 100644 (file)
index 374395b..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-//
-// PrintStatus.cs
-//
-// Author:
-//   Jb Evain (jbevain@novell.com)
-//
-// (C) 2007 Novell, Inc.
-//
-// 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;
-
-using Mono.Linker;
-using Mono.Linker.Steps;
-
-using Mono.Cecil;
-
-namespace Mono.Tuner {
-
-       public class PrintStatus : BaseStep {
-
-               static string display_internalized = "display_internalized";
-
-               protected override void ProcessAssembly (AssemblyDefinition assembly)
-               {
-                       if (Annotations.GetAction (assembly) != AssemblyAction.Link)
-                               return;
-
-                       Console.WriteLine ("Assembly `{0}' ({1}) tuned", assembly.Name, assembly.MainModule.FullyQualifiedName);
-
-                       if (!DisplayInternalized ())
-                               return;
-
-                       foreach (TypeDefinition type in assembly.MainModule.Types)
-                               ProcessType (type);
-               }
-
-               bool DisplayInternalized ()
-               {
-                       try {
-                               return bool.Parse (Context.GetParameter (display_internalized));
-                       } catch {
-                               return false;
-                       }
-               }
-
-               void ProcessType (TypeDefinition type)
-               {
-                       ProcessCollection (type.Fields);
-                       ProcessCollection (type.Methods);
-               }
-
-               void ProcessCollection (ICollection collection)
-               {
-                       foreach (IMetadataTokenProvider provider in collection)
-                               ProcessProvider (provider);
-               }
-
-               void ProcessProvider (IMetadataTokenProvider provider)
-               {
-                       if (!TunerAnnotations.IsInternalized (Context, provider))
-                               return;
-
-                       Console.WriteLine ("[internalized] {0}", provider);
-               }
-       }
-}
diff --git a/mcs/tools/tuner/Mono.Tuner/PrintTypeMap.cs b/mcs/tools/tuner/Mono.Tuner/PrintTypeMap.cs
deleted file mode 100644 (file)
index 8838b1a..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-//
-// PrintTypeMap.cs
-//
-// Author:
-//   Jb Evain (jbevain@novell.com)
-//
-// (C) 2009 Novell, Inc.
-//
-// 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;
-using System.Collections.Generic;
-
-using Mono.Linker;
-using Mono.Linker.Steps;
-
-using Mono.Cecil;
-
-namespace Mono.Tuner {
-
-       public class PrintTypeMap : BaseStep {
-
-               protected override void ProcessAssembly (AssemblyDefinition assembly)
-               {
-                       foreach (TypeDefinition type in assembly.MainModule.GetAllTypes ())
-                               PrintMap (type);
-               }
-
-               void PrintMap (TypeDefinition type)
-               {
-                       if (!type.HasMethods)
-                               return;
-
-                       Console.WriteLine ("Type {0} map", type);
-
-                       foreach (MethodDefinition method in type.Methods) {
-                               if (!method.IsVirtual)
-                                       continue;
-
-                               Console.WriteLine ("  Method {0} map", method);
-
-                               IEnumerable<MethodDefinition> overrides = Annotations.GetOverrides (method);
-                               foreach (var @override in overrides ?? new MethodDefinition [0])
-                                       Console.WriteLine ("    HasOverride {0}", @override);
-
-                               IEnumerable<MethodDefinition> bases = Annotations.GetBaseMethods (method);
-                               foreach (var @base in bases ?? new MethodDefinition [0])
-                                       Console.WriteLine ("    Base {0}", @base);
-                       }
-               }
-       }
-}
diff --git a/mcs/tools/tuner/Mono.Tuner/Profile.cs b/mcs/tools/tuner/Mono.Tuner/Profile.cs
deleted file mode 100644 (file)
index 54cfffa..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-using System;
-using System.Collections.Generic;
-
-using Mono.Cecil;
-
-namespace Mono.Tuner {
-
-       public abstract class Profile {
-
-               static Profile current;
-
-               public static Profile Current {
-                       get {
-                               if (current != null)
-                                       return current;
-
-                               current = CreateProfile ("MonoTouch");
-                               if (current != null)
-                                       return current;
-
-                               current = CreateProfile ("MonoDroid");
-                               if (current != null)
-                                       return current;
-
-                               current = CreateProfile ("MonoMac");
-                               if (current != null)
-                                       return current;
-
-                               throw new NotSupportedException ("No active profile");
-                       }
-                       set {
-                               current = value;
-                       }
-               }
-
-               static Profile CreateProfile (string name)
-               {
-                       var type = Type.GetType (string.Format ("{0}.Tuner.{0}Profile", name));
-                       if (type == null)
-                               return null;
-
-                       return (Profile) Activator.CreateInstance (type);
-               }
-
-               public static bool IsSdkAssembly (AssemblyDefinition assembly)
-               {
-                       return Current.IsSdk (assembly);
-               }
-
-               public static bool IsSdkAssembly (string assemblyName)
-               {
-                       return Current.IsSdk (assemblyName);
-               }
-
-               public static bool IsProductAssembly (AssemblyDefinition assembly)
-               {
-                       return Current.IsProduct (assembly);
-               }
-
-               public static bool IsProductAssembly (string assemblyName)
-               {
-                       return Current.IsProduct (assemblyName);
-               }
-
-               protected virtual bool IsSdk (AssemblyDefinition assembly)
-               {
-                       return IsSdk (assembly.Name.Name);
-               }
-               
-               protected virtual bool IsProduct (AssemblyDefinition assembly)
-               {
-                       return IsProduct (assembly.Name.Name);
-               }
-
-               protected abstract bool IsSdk (string assemblyName);
-               protected abstract bool IsProduct (string assemblyName);
-       }
-}
diff --git a/mcs/tools/tuner/Mono.Tuner/RemoveAttributesBase.cs b/mcs/tools/tuner/Mono.Tuner/RemoveAttributesBase.cs
deleted file mode 100644 (file)
index 6110180..0000000
+++ /dev/null
@@ -1,103 +0,0 @@
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Linq;
-
-using Mono.Linker;
-using Mono.Linker.Steps;
-
-using Mono.Tuner;
-
-using Mono.Cecil;
-
-namespace Mono.Tuner {
-
-       public abstract class RemoveAttributesBase : BaseSubStep {
-
-               public override SubStepTargets Targets {
-                       get {
-                               return SubStepTargets.Assembly
-                                       | SubStepTargets.Type
-                                       | SubStepTargets.Field
-                                       | SubStepTargets.Method
-                                       | SubStepTargets.Property
-                                       | SubStepTargets.Event;
-                       }
-               }
-
-               public override bool IsActiveFor (AssemblyDefinition assembly)
-               {
-                       return Annotations.GetAction (assembly) == AssemblyAction.Link;
-               }
-
-               public override void ProcessAssembly (AssemblyDefinition assembly)
-               {
-                       ProcessAttributeProvider (assembly);
-                       ProcessAttributeProvider (assembly.MainModule);
-               }
-
-               public override void ProcessType (TypeDefinition type)
-               {
-                       ProcessAttributeProvider (type);
-
-                       if (type.HasGenericParameters)
-                               ProcessAttributeProviderCollection (type.GenericParameters);
-               }
-
-               void ProcessAttributeProviderCollection (IList list)
-               {
-                       for (int i = 0; i < list.Count; i++)
-                               ProcessAttributeProvider ((ICustomAttributeProvider) list [i]);
-               }
-
-               public override void ProcessField (FieldDefinition field)
-               {
-                       ProcessAttributeProvider (field);
-               }
-
-               public override void ProcessMethod (MethodDefinition method)
-               {
-                       ProcessMethodAttributeProvider (method);
-               }
-
-               void ProcessMethodAttributeProvider (MethodDefinition method)
-               {
-                       ProcessAttributeProvider (method);
-                       ProcessAttributeProvider (method.MethodReturnType);
-
-                       if (method.HasParameters)
-                               ProcessAttributeProviderCollection (method.Parameters);
-
-                       if (method.HasGenericParameters)
-                               ProcessAttributeProviderCollection (method.GenericParameters);
-               }
-
-               public override void ProcessProperty (PropertyDefinition property)
-               {
-                       ProcessAttributeProvider (property);
-               }
-
-               public override void ProcessEvent (EventDefinition @event)
-               {
-                       ProcessAttributeProvider (@event);
-               }
-
-               void ProcessAttributeProvider (ICustomAttributeProvider provider)
-               {
-                       if (!provider.HasCustomAttributes)
-                               return;
-
-                       for (int i = 0; i < provider.CustomAttributes.Count; i++) {
-                               var attrib = provider.CustomAttributes [i];
-                               if (!IsRemovedAttribute (attrib))
-                                       continue;
-
-                               WillRemoveAttribute (provider, attrib);
-                               provider.CustomAttributes.RemoveAt (i--);
-                       }
-               }
-
-               protected abstract bool IsRemovedAttribute (CustomAttribute attribute);
-               protected virtual void WillRemoveAttribute (ICustomAttributeProvider provider, CustomAttribute attribute) { }
-       }
-}
diff --git a/mcs/tools/tuner/Mono.Tuner/RemoveResources.cs b/mcs/tools/tuner/Mono.Tuner/RemoveResources.cs
deleted file mode 100644 (file)
index 7edc44f..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-using System;
-
-using Mono.Linker;
-using Mono.Linker.Steps;
-
-using Mono.Cecil;
-
-namespace Mono.Tuner {
-
-       public class RemoveResources : IStep {
-
-               readonly I18nAssemblies assemblies;
-
-               public RemoveResources (I18nAssemblies assemblies)
-               {
-                       this.assemblies = assemblies;
-               }
-
-               public virtual void Process (LinkContext context)
-               {
-                       AssemblyDefinition assembly;
-                       if (!context.TryGetLinkedAssembly ("mscorlib", out assembly))
-                               return;
-
-                       // skip this if we're not linking mscorlib, e.g. --linkskip=mscorlib
-                       if (context.Annotations.GetAction (assembly) != AssemblyAction.Link)
-                               return;
-
-                       var resources = assembly.MainModule.Resources;
-
-                       for (int i = 0; i < resources.Count; i++) {
-                               var resource = resources [i] as EmbeddedResource;
-                               if (resource == null)
-                                       continue;
-
-                               switch (resource.Name) {
-                               case "collation.core.bin":
-                               case "collation.tailoring.bin":
-                                       continue;
-                               default:
-                                       if (!resource.Name.Contains ("cjk"))
-                                               continue;
-                                       if (IncludeCJK ())
-                                               continue;
-
-                                       resources.RemoveAt (i--);
-                                       break;
-                               }
-                       }
-               }
-
-               bool IncludeCJK ()
-               {
-                       return (assemblies & I18nAssemblies.CJK) != 0;
-               }
-       }
-}
diff --git a/mcs/tools/tuner/Mono.Tuner/RemoveSecurity.cs b/mcs/tools/tuner/Mono.Tuner/RemoveSecurity.cs
deleted file mode 100644 (file)
index 2704564..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-
-using Mono.Linker;
-using Mono.Linker.Steps;
-
-using Mono.Cecil;
-
-namespace Mono.Tuner {
-
-       public class RemoveSecurity : BaseSubStep {
-
-               public override SubStepTargets Targets {
-                       get {
-                               return SubStepTargets.Assembly
-                                       | SubStepTargets.Type
-                                       | SubStepTargets.Method;
-                       }
-               }
-
-               public override bool IsActiveFor (AssemblyDefinition assembly)
-               {
-                       return Annotations.GetAction (assembly) == AssemblyAction.Link;
-               }
-
-               public override void ProcessAssembly (AssemblyDefinition assembly)
-               {
-                       ProcessSecurityProvider (assembly);
-               }
-
-               public override void ProcessType (TypeDefinition type)
-               {
-                       ProcessSecurityProvider (type);
-               }
-
-               public override void ProcessMethod (MethodDefinition method)
-               {
-                       ProcessSecurityProvider (method);
-               }
-
-               static void ProcessSecurityProvider (ISecurityDeclarationProvider provider)
-               {
-                       if (!provider.HasSecurityDeclarations)
-                               return;
-
-                       provider.SecurityDeclarations.Clear ();
-               }
-       }
-}
diff --git a/mcs/tools/tuner/Mono.Tuner/RemoveSerialization.cs b/mcs/tools/tuner/Mono.Tuner/RemoveSerialization.cs
deleted file mode 100644 (file)
index d38aef1..0000000
+++ /dev/null
@@ -1,149 +0,0 @@
-//
-// RemoveSerialization.cs
-//
-// Author:
-//   Jb Evain (jbevain@novell.com)
-//
-// (C) 2007 Novell, Inc.
-//
-// 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;
-
-using Mono.Linker;
-using Mono.Linker.Steps;
-
-using Mono.Cecil;
-
-namespace Mono.Tuner {
-
-       public class RemoveSerialization : BaseStep {
-
-               static readonly string _Serialization = "System.Runtime.Serialization";
-               static readonly string _ISerializable = Concat (_Serialization, "ISerializable");
-               static readonly string _IDeserializationCallback = Concat (_Serialization, "IDeserializationCallback");
-               static readonly string _SerializationInfo = Concat (_Serialization, "SerializationInfo");
-               static readonly string _StreamingContext = Concat (_Serialization, "StreamingContext");
-
-               static readonly string _GetObjectData = "GetObjectData";
-               static readonly string _OnDeserialization = "OnDeserialization";
-
-               static string Concat (string lhs, string rhs)
-               {
-                       return string.Concat (lhs, ".", rhs);
-               }
-
-               protected override void ProcessAssembly (AssemblyDefinition assembly)
-               {
-                       if (assembly.Name.Name == "mscorlib")
-                               return;
-
-                       if (Annotations.GetAction (assembly) != AssemblyAction.Link)
-                               return;
-
-                       foreach (ModuleDefinition module in assembly.Modules)
-                               foreach (TypeDefinition type in module.Types)
-                                       ProcessType (type);
-               }
-
-               static void RemoveInterface (TypeDefinition type, string name)
-               {
-                       for (int i = 0; i < type.Interfaces.Count; i++) {
-                               TypeReference iface = type.Interfaces [i].InterfaceType;
-                               if (iface.FullName == name) {
-                                       type.Interfaces.RemoveAt (i);
-                                       return;
-                               }
-                       }
-               }
-
-               static void RemoveSerializableFlag (TypeDefinition type)
-               {
-                       type.Attributes &= ~TypeAttributes.Serializable;
-               }
-
-               static void ProcessType (TypeDefinition type)
-               {
-                       RemoveSerializableFlag (type);
-
-                       RemoveInterface (type, _ISerializable);
-                       RemoveMethod (type, ".ctor", _SerializationInfo, _StreamingContext);
-                       RemoveInterfaceMethod (type, _ISerializable, _GetObjectData, _SerializationInfo, _StreamingContext);
-
-                       RemoveInterface (type, _IDeserializationCallback);
-                       RemoveInterfaceMethod (type, _IDeserializationCallback, _OnDeserialization, "System.Object");
-
-                       RemoveField (type);
-               }
-
-               static void RemoveField (TypeDefinition type)
-               {
-                       for (int i = 0; i < type.Fields.Count; i++) {
-                               FieldDefinition field = type.Fields [i];
-                               if (field.FieldType.FullName == _SerializationInfo) {
-                                       type.Fields.RemoveAt (i);
-                                       break;
-                               }
-                       }
-               }
-
-               static bool ParametersMatch (IMethodSignature meth, string [] parameters)
-               {
-                       for (int i = 0; i < parameters.Length; i++) {
-                               ParameterDefinition param = meth.Parameters [i];
-                               if (param.ParameterType.FullName != parameters [i])
-                                       return false;
-                       }
-
-                       return true;
-               }
-
-               static void RemoveInterfaceMethod (TypeDefinition type, string iface, string method, params string [] parameters)
-               {
-                       RemoveMethod (type, method, parameters);
-                       RemoveMethod (type, Concat (iface, method), parameters);
-               }
-
-               static void RemoveMethod (TypeDefinition type, string name, params string [] parameters)
-               {
-                       RemoveMethod (type.Methods, name, parameters);
-               }
-
-               static void RemoveMethod (IList container, string name, params string [] parameters)
-               {
-                       for (int i = 0; i < container.Count; i++) {
-                               MethodDefinition method = (MethodDefinition) container [i];
-                               if (method.Name != name)
-                                       continue;
-
-                               if (method.Parameters.Count != parameters.Length)
-                                       continue;
-
-                               if (!ParametersMatch (method, parameters))
-                                       continue;
-
-                               container.RemoveAt (i);
-                               return;
-                       }
-               }
-       }
-}
diff --git a/mcs/tools/tuner/Mono.Tuner/TunerAnnotations.cs b/mcs/tools/tuner/Mono.Tuner/TunerAnnotations.cs
deleted file mode 100644 (file)
index 2107ac4..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-//
-// TunerAnnotations.cs
-//
-// Author:
-//   Jb Evain (jbevain@novell.com)
-//
-// (C) 2007 Novell, Inc.
-//
-// 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 Mono.Cecil;
-using Mono.Linker;
-
-namespace Mono.Tuner {
-
-       public class TunerAnnotations {
-
-               static readonly object _internalizedKey = new object ();
-
-               public static void Internalized (LinkContext context, IMetadataTokenProvider provider)
-               {
-                       var annotations = context.Annotations.GetCustomAnnotations (_internalizedKey);
-                       annotations [provider] = _internalizedKey;
-               }
-
-               public static bool IsInternalized (LinkContext context, IMetadataTokenProvider provider)
-               {
-                       var annotations = context.Annotations.GetCustomAnnotations (_internalizedKey);
-
-                       return annotations.ContainsKey (provider);
-               }
-
-               private TunerAnnotations ()
-               {
-               }
-       }
-}
diff --git a/mcs/tools/tuner/MonoMac.Tuner/ApplyPreserveAttribute.cs b/mcs/tools/tuner/MonoMac.Tuner/ApplyPreserveAttribute.cs
deleted file mode 100644 (file)
index d7c49b8..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Linq;
-
-using Mono.Linker;
-using Mono.Linker.Steps;
-
-using Mono.Tuner;
-
-using Mono.Cecil;
-
-namespace MonoMac.Tuner {
-
-       public class ApplyPreserveAttribute : ApplyPreserveAttributeBase {
-
-               protected override string PreserveAttribute {
-                       get { return "MonoMac.Foundation.PreserveAttribute"; }
-               }
-       }
-}
diff --git a/mcs/tools/tuner/MonoMac.Tuner/Extensions.cs b/mcs/tools/tuner/MonoMac.Tuner/Extensions.cs
deleted file mode 100644 (file)
index ec7fd1f..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-using System;
-using System.Collections.Generic;
-
-using Mono.Cecil;
-
-using Mono.Linker;
-
-using Mono.Tuner;
-
-namespace MonoMac.Tuner {
-
-       static class Extensions {
-
-               const string NSObject = "MonoMac.Foundation.NSObject";
-               const string INativeObject = "MonoMac.ObjCRuntime.INativeObject";
-
-               public static bool IsNSObject (this TypeDefinition type)
-               {
-                       return type.Inherits (NSObject);
-               }
-
-               public static bool IsNativeObject (this TypeDefinition type)
-               {
-                       return type.Implements (INativeObject);
-               }
-       }
-}
diff --git a/mcs/tools/tuner/MonoMac.Tuner/MarkNSObjects.cs b/mcs/tools/tuner/MonoMac.Tuner/MarkNSObjects.cs
deleted file mode 100644 (file)
index 163decc..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-//
-// MarkNSObjects.cs
-//
-// Authors:
-//     Jb Evain (jbevain@novell.com)
-//     Sebastien Pouliot  <sebastien@xamarin.com>
-//
-// (C) 2009 Novell, Inc.
-// Copyright (C) 2011 Xamarin, Inc.
-//
-// 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 Mono.Tuner;
-
-using Mono.Cecil;
-
-namespace MonoMac.Tuner {
-
-       public class MarkNSObjects : MarkNSObjectsBase {
-
-               protected override string ExportAttribute {
-                       get { return "MonoMac.Foundation.ExportAttribute"; }
-               }
-
-               public override void ProcessType (TypeDefinition type)
-               {
-                       if (!type.IsNSObject () || !type.IsNativeObject ())
-                               return;
-
-                       base.ProcessType (type);
-               }
-       }
-}
diff --git a/mcs/tools/tuner/MonoMac.Tuner/MethodMapInjection.cs b/mcs/tools/tuner/MonoMac.Tuner/MethodMapInjection.cs
deleted file mode 100644 (file)
index ebb2407..0000000
+++ /dev/null
@@ -1,382 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-
-using Mono.Linker;
-using Mono.Linker.Steps;
-
-using Mono.Tuner;
-
-using Mono.Cecil;
-using Mono.Cecil.Cil;
-
-namespace MonoMac.Tuner {
-
-       public class MethodMapInjection : BaseStep {
-
-               struct ExportedMethod {
-                       public readonly CustomAttribute attribute;
-                       public readonly MethodDefinition method;
-
-                       public ExportedMethod (CustomAttribute attribute, MethodDefinition method)
-                       {
-                               this.attribute = attribute;
-                               this.method = method;
-                       }
-               }
-
-               ModuleDefinition module;
-
-               bool imported;
-               TypeReference void_type;
-               TypeReference dictionary_intptr_methoddesc;
-               MethodReference dictionary_intptr_methoddesc_ctor;
-               MethodReference dictionary_intptr_methoddesc_set_item;
-               MethodReference methoddesc_ctor;
-               MethodReference selector_get_handle;
-               MethodReference methodbase_get_method_from_handle;
-               MethodReference class_register_methods;
-               MethodReference type_get_type_from_handle;
-               FieldReference selector_init;
-
-               protected override void ProcessAssembly (AssemblyDefinition assembly)
-               {
-                       if (Annotations.GetAction (assembly) != AssemblyAction.Link)
-                               return;
-
-                       module = assembly.MainModule;
-
-                       foreach (TypeDefinition type in module.GetAllTypes ()) {
-                               if (!type.IsNSObject ())
-                                       continue;
-
-                               ProcessNSObject (type);
-                       }
-
-                       imported = false;
-               }
-
-               void PrepareImports ()
-               {
-                       if (imported)
-                               return;
-
-                       var corlib = Context.GetAssembly ("mscorlib");
-
-                       void_type = Import (corlib, "System.Void");
-
-                       var monomac = Context.GetAssembly ("MonoMac");
-
-                       var dictionary = Import (corlib, "System.Collections.Generic.Dictionary`2");
-
-                       var intptr = Import (corlib, "System.IntPtr");
-                       var method_desc = Import (monomac, "MonoMac.ObjCRuntime.MethodDescription");
-
-                       var dic_i_md = new GenericInstanceType (dictionary);
-                       dic_i_md.GenericArguments.Add (intptr);
-                       dic_i_md.GenericArguments.Add (method_desc);
-                       dictionary_intptr_methoddesc = dic_i_md;
-
-                       dictionary_intptr_methoddesc_ctor = Import (".ctor", dic_i_md, false, void_type, Import (corlib, "System.Int32"));
-
-                       dictionary_intptr_methoddesc_set_item = Import ("set_Item", dic_i_md, false, void_type,
-                               dictionary.GenericParameters [0],
-                               dictionary.GenericParameters [1]);
-
-                       methoddesc_ctor = Import (".ctor", method_desc, false, void_type,
-                               Import (corlib, "System.Reflection.MethodBase"),
-                               Import (monomac, "MonoMac.ObjCRuntime.ArgumentSemantic"));
-
-                       var selector = Import (monomac, "MonoMac.ObjCRuntime.Selector");
-
-                       selector_get_handle = Import ("GetHandle", selector, true, intptr, Import (corlib, "System.String"));
-                       selector_init = new FieldReference ("Init", selector, intptr);
-
-                       var methodbase = Import (corlib, "System.Reflection.MethodBase");
-
-                       methodbase_get_method_from_handle = Import ("GetMethodFromHandle", methodbase, true, methodbase, Import (corlib, "System.RuntimeMethodHandle"));
-
-                       var type = Import (corlib, "System.Type");
-
-                       type_get_type_from_handle = Import ("GetTypeFromHandle", type, true, type, Import (corlib, "System.RuntimeTypeHandle"));
-
-                       var @class = Import (monomac, "MonoMac.ObjCRuntime.Class");
-
-                       class_register_methods = Import ("RegisterMethods", @class, true, void_type, type, dic_i_md);
-
-                       imported = true;
-               }
-
-               MethodReference Import (string name, TypeReference declaring_type, bool @static, TypeReference return_type, params TypeReference [] parameters_type)
-               {
-                       var reference = new MethodReference (name, return_type, declaring_type) {
-                               HasThis = !@static,
-                               ExplicitThis = false,
-                               CallingConvention = MethodCallingConvention.Default,
-                       };
-
-                       foreach (var parameter_type in parameters_type)
-                               reference.Parameters.Add (new ParameterDefinition (parameter_type));
-
-                       return reference;
-               }
-
-               TypeReference Import (TypeReference type)
-               {
-                       return module.Import (type);
-               }
-
-               TypeReference Import (AssemblyDefinition assembly, string type_name)
-               {
-                       return Import (assembly.MainModule.GetType (type_name));
-               }
-
-               void ProcessNSObject (TypeDefinition type)
-               {
-                       var exported = new List<ExportedMethod> ();
-
-                       if (type.HasMethods) {
-                               ProcessMethods (type, exported);
-                               ProcessConstructors (type, exported);
-                       }
-
-                       if (exported.Count == 0)
-                               return;
-
-                       InjectMethodMap (type, exported);
-               }
-
-               void InjectMethodMap (TypeDefinition type, List<ExportedMethod> exported_methods)
-               {
-                       PrepareImports ();
-
-                       var cctor = GetTypeConstructor (type);
-
-                       var selectors = MapSelectors (cctor);
-
-                       var map = new VariableDefinition (dictionary_intptr_methoddesc);
-                       map.Name = "$method_map";
-                       cctor.Body.Variables.Add (map);
-                       cctor.Body.SimplifyMacros ();
-
-                       var il = cctor.Body.GetILProcessor ();
-
-                       var instructions = new List<Instruction> {
-                               il.Create (OpCodes.Ldc_I4, exported_methods.Count),
-                               il.Create (OpCodes.Newobj, dictionary_intptr_methoddesc_ctor),
-                               il.Create (OpCodes.Stloc, map),
-                       };
-
-                       foreach (var exported in exported_methods) {
-
-                               instructions.Add (il.Create (OpCodes.Ldloc, map));
-
-                               if (!IsDefaultConstructor (exported)) {
-                                       var selector_name = GetSelectorName (exported);
-                                       FieldReference selector;
-
-                                       if (selectors != null && selectors.TryGetValue (selector_name, out selector)) {
-                                               instructions.Add (il.Create (OpCodes.Ldsfld, selector));
-                                       } else {
-                                               instructions.AddRange (new [] {
-                                                       il.Create (OpCodes.Ldstr, selector_name),
-                                                       il.Create (OpCodes.Call, selector_get_handle),
-                                               });
-                                       }
-                               } else
-                                       instructions.Add (il.Create (OpCodes.Ldsfld, selector_init));
-
-                               instructions.AddRange (new [] {
-                                       il.Create (OpCodes.Ldtoken, exported.method),
-                                       il.Create (OpCodes.Call, methodbase_get_method_from_handle),
-                                       il.Create (OpCodes.Ldc_I4, GetArgumentSemantic (exported)),
-                                       il.Create (OpCodes.Newobj, methoddesc_ctor),
-                                       il.Create (OpCodes.Callvirt, dictionary_intptr_methoddesc_set_item),
-                               });
-                       }
-
-                       instructions.AddRange (new [] {
-                               il.Create (OpCodes.Ldtoken, type),
-                               il.Create (OpCodes.Call, type_get_type_from_handle),
-                               il.Create (OpCodes.Ldloc, map),
-                               il.Create (OpCodes.Call, class_register_methods),
-                       });
-
-                       Append (il, instructions);
-
-                       cctor.Body.OptimizeMacros ();
-               }
-
-               static Dictionary<string, FieldReference> MapSelectors (MethodDefinition cctor)
-               {
-                       var instructions = cctor.Body.Instructions;
-                       Dictionary<string, FieldReference> selectors = null;
-
-                       for (int i = 0; i < instructions.Count; i++) {
-                               var instruction = instructions [i];
-
-                               FieldReference field;
-                               if (!IsCreateSelector (instruction, out field))
-                                       continue;
-
-                               if (selectors == null)
-                                       selectors = new Dictionary<string, FieldReference> ();
-
-                               selectors.Add ((string) instruction.Operand, field);
-                       }
-
-                       return selectors;
-               }
-
-               static bool IsCreateSelector (Instruction instruction, out FieldReference field)
-               {
-                       field = null;
-
-                       if (instruction.OpCode != OpCodes.Ldstr)
-                               return false;
-
-                       if (instruction.Next == null)
-                               return false;
-
-                       instruction = instruction.Next;
-
-                       if (instruction.OpCode != OpCodes.Call)
-                               return false;
-
-                       var method = (MethodReference) instruction.Operand;
-                       if (method.DeclaringType.Name != "Selector")
-                               return false;
-
-                       if (method.Name != "GetHandle" && method.Name != "sel_registerName")
-                               return false;
-
-                       if (instruction.Next == null)
-                               return false;
-
-                       instruction = instruction.Next;
-
-                       if (instruction.OpCode != OpCodes.Stsfld)
-                               return false;
-
-                       field = instruction.Operand as FieldReference;
-                       return true;
-               }
-
-               static bool IsDefaultConstructor (ExportedMethod exported)
-               {
-                       return exported.attribute == null && exported.method.IsConstructor && !exported.method.IsStatic;
-               }
-
-               static void Append (ILProcessor il, IEnumerable<Instruction> instructions)
-               {
-                       var method_instructions = il.Body.Instructions;
-                       var last = method_instructions [method_instructions.Count - 1];
-
-                       foreach (var instruction in instructions)
-                               il.InsertBefore (last, instruction);
-               }
-
-               static int GetArgumentSemantic (ExportedMethod exported)
-               {
-                       if (exported.attribute == null)
-                               return 0; // Assign
-
-                       var arguments = exported.attribute.ConstructorArguments;
-
-                       if (arguments.Count == 2)
-                               return (int) arguments [1].Value;
-
-                       if (arguments.Count == 1)
-                               return -1; // None
-
-                       return 0; // Assign
-               }
-
-               static string GetSelectorName (ExportedMethod exported)
-               {
-                       var arguments = exported.attribute.ConstructorArguments;
-
-                       if (arguments.Count == 0)
-                               return exported.method.Name;
-
-                       return (string) arguments [0].Value;
-               }
-
-               MethodDefinition GetTypeConstructor (TypeDefinition type)
-               {
-                       return type.GetTypeConstructor () ?? CreateTypeConstructor (type);
-               }
-
-               MethodDefinition CreateTypeConstructor (TypeDefinition type)
-               {
-                       var cctor = new MethodDefinition (".cctor", MethodAttributes.Private | MethodAttributes.Static | MethodAttributes.SpecialName | MethodAttributes.RTSpecialName, void_type);
-                       cctor.Body.GetILProcessor ().Emit (OpCodes.Ret);
-
-                       type.Methods.Add (cctor);
-
-                       return cctor;
-               }
-
-               void ProcessConstructors (TypeDefinition type, List<ExportedMethod> exported)
-               {
-                       foreach (MethodDefinition ctor in type.GetConstructors ()) {
-                               if (!ctor.HasParameters && !ctor.IsStatic) {
-                                       exported.Add (new ExportedMethod (null, ctor));
-                                       continue;
-                               }
-
-                               CustomAttribute export;
-                               if (!TryGetExportAttribute (ctor, out export))
-                                       continue;
-
-                               exported.Add (new ExportedMethod (export, ctor));
-                       }
-               }
-
-               static bool TryGetExportAttribute (MethodDefinition method, out CustomAttribute export)
-               {
-                       export = null;
-
-                       if (!method.HasCustomAttributes)
-                               return false;
-
-                       foreach (CustomAttribute attribute in method.CustomAttributes) {
-                               if (attribute.AttributeType.FullName != "MonoMac.Foundation.ExportAttribute")
-                                       continue;
-
-                               export = attribute;
-                               return true;
-                       }
-
-                       return false;
-               }
-
-               void ProcessMethods (TypeDefinition type, List<ExportedMethod> exported)
-               {
-                       foreach (MethodDefinition method in type.GetMethods ()) {
-                               CustomAttribute attribute;
-                               if (TryGetExportAttribute (method, out attribute)) {
-                                       exported.Add (new ExportedMethod (attribute, method));
-                                       continue;
-                               }
-
-                               if (!method.IsVirtual)
-                                       continue;
-
-                               var bases = Annotations.GetBaseMethods (method);
-                               if (bases == null)
-                                       continue;
-
-                               foreach (MethodDefinition @base in bases) {
-                                       if (@base.DeclaringType.IsInterface)
-                                               continue;
-
-                                       if (TryGetExportAttribute (@base, out attribute)) {
-                                               exported.Add (new ExportedMethod (attribute, method));
-                                               break;
-                                       }
-                               }
-                       }
-               }
-       }
-}
diff --git a/mcs/tools/tuner/MonoMac.Tuner/MonoMac.xml b/mcs/tools/tuner/MonoMac.Tuner/MonoMac.xml
deleted file mode 100644 (file)
index 9a078c8..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<linker>
-       <assembly fullname="MonoMac">
-               <namespace fullname="MonoMac.ObjCRuntime" />
-               <!--
-               <type fullname="MonoMac.ObjCRuntime.Runtime" />
-               <type fullname="MonoMac.ObjCRuntime.Class" />
-               <type fullname="MonoMac.ObjCRuntime.Selector" />
-               <type fullname="MonoMac.ObjCRuntime.NativeConstructorBuilder" />
-               <type fullname="MonoMac.ObjCRuntime.NativeImplementationBuilder" />
-               <type fullname="MonoMac.ObjCRuntime.NativeMethodBuilder" />
-               <type fullname="MonoMac.ObjCRuntime.INativeObject" />
-               -->
-               <type fullname="MonoMac.Foundation.NSObject" preserve="fields">
-                       <method name="NativeRelease" />
-                       <method name="NativeRetain" />
-                       <method name="Retain" />
-               </type>
-               <type fullname="MonoMac.Foundation.NSArray" preserve="fields">
-                       <method name="ArrayFromHandle" />
-                       <method name="StringArrayFromHandle" />
-                       <method name="FromNSObjects" />
-                       <method name="FromStrings" />
-               </type>
-               <type fullname="MonoMac.Foundation.ExportAttribute" />
-       </assembly>
-       <assembly fullname="mscorlib">
-               <type fullname="System.Runtime.Serialization.FormatterServices">
-                       <method name="GetUninitializedObject" />
-               </type>
-               <type fullname="System.Runtime.InteropServices.Marshal">
-                       <method name="StructureToPtr" />
-               </type>
-               <type fullname="System.Runtime.InteropServices.MarshalAsAttribute">
-                       <field name="MarshalTypeRef" />
-               </type>
-       </assembly>
-</linker>
diff --git a/mcs/tools/tuner/MonoMac.Tuner/MonoMacProfile.cs b/mcs/tools/tuner/MonoMac.Tuner/MonoMacProfile.cs
deleted file mode 100644 (file)
index 0692e48..0000000
+++ /dev/null
@@ -1,117 +0,0 @@
-using System;
-using System.Collections.Generic;
-
-using Mono.Tuner;
-
-using Mono.Cecil;
-
-namespace MonoMac.Tuner {
-
-       class MonoMacProfile : Profile {
-
-               static readonly HashSet<string> Sdk = new HashSet<string> {
-                       "mscorlib",
-                       "I18N.CJK",
-                       "I18N",
-                       "I18N.MidEast",
-                       "I18N.Other",
-                       "I18N.Rare",
-                       "I18N.West",
-                       "Microsoft.Build.Engine",
-                       "Microsoft.Build.Framework",
-                       "Microsoft.Build.Tasks.v4.0",
-                       "Microsoft.Build.Utilities.v4.0",
-                       "Microsoft.CSharp",
-                       "Microsoft.Web.Infrastructure",
-                       "Mono.C5",
-                       "Mono.Cairo",
-                       "Mono.CodeContracts",
-                       "Mono.CompilerServices.SymbolWriter",
-                       "Mono.Configuration.Crypto",
-                       "Mono.CSharp",
-                       "Mono.Data.Sqlite",
-                       "Mono.Data.Tds",
-                       "Mono.Debugger.Soft",
-                       "Mono.Http",
-                       "Mono.Management",
-                       "Mono.Messaging",
-                       "Mono.Messaging.RabbitMQ",
-                       "Mono.Options",
-                       "Mono.Parallel",
-                       "Mono.Posix",
-                       "Mono.Security",
-                       "Mono.Security.Win32",
-                       "Mono.Simd",
-                       "Mono.Tasklets",
-                       "Mono.Tuner",
-                       "Mono.WebBrowser",
-                       "Mono.Web",
-                       "Novell.Directory.Ldap",
-                       "Npgsql",
-                       "OpenSystem.C",
-                       "PEAPI",
-                       "System.ComponentModel.Composition",
-                       "System.ComponentModel.DataAnnotations",
-                       "System.Configuration",
-                       "System.Configuration.Install",
-                       "System.Core",
-                       "System.Data.DataSetExtensions",
-                       "System.Data",
-                       "System.Data.Linq",
-                       "System.Data.OracleClient",
-                       "System.Data.Services.Client",
-                       "System.Data.Services",
-                       "System.Design",
-                       "System.DirectoryServices",
-                       "System",
-                       "System.Drawing.Design",
-                       "System.Drawing",
-                       "System.Dynamic",
-                       "System.EnterpriseServices",
-                       "System.IdentityModel",
-                       "System.IdentityModel.Selectors",
-                       "System.Management",
-                       "System.Messaging",
-                       "System.Net",
-                       "System.Numerics",
-                       "System.Runtime.Caching",
-                       "System.Runtime.DurableInstancing",
-                       "System.Runtime.Remoting",
-                       "System.Runtime.Serialization",
-                       "System.Runtime.Serialization.Formatters.Soap",
-                       "System.Security",
-                       "System.ServiceModel.Discovery",
-                       "System.ServiceModel",
-                       "System.ServiceModel.Routing",
-                       "System.ServiceModel.Web",
-                       "System.ServiceProcess",
-                       "System.Transactions",
-                       "System.Web.Abstractions",
-                       "System.Web.ApplicationServices",
-                       "System.Web",
-                       "System.Web.DynamicData",
-                       "System.Web.Extensions.Design",
-                       "System.Web.Extensions",
-                       "System.Web.Routing",
-                       "System.Web.Services",
-                       "System.Windows.Forms.DataVisualization",
-                       "System.Windows.Forms",
-                       "System.Xaml",
-                       "System.Xml",
-                       "System.Xml.Linq",
-                       "WebMatrix.Data",
-                       "WindowsBase",
-                       "Microsoft.VisualBasic",
-               };
-
-               protected override bool IsSdk (AssemblyDefinition assembly)
-               {
-                       return Sdk.Contains (assembly.Name.Name);
-               }
-
-               protected override bool IsProduct (AssemblyDefinition assembly)
-               {
-                       return assembly.Name.Name == "MonoMac";
-               }
-       }
-}
diff --git a/mcs/tools/tuner/MonoMac.Tuner/RemoveSelectors.cs b/mcs/tools/tuner/MonoMac.Tuner/RemoveSelectors.cs
deleted file mode 100644 (file)
index 0c201ae..0000000
+++ /dev/null
@@ -1,189 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-
-using Mono.Linker;
-using Mono.Linker.Steps;
-
-using Mono.Cecil;
-using Mono.Cecil.Cil;
-
-using Mono.Tuner;
-
-namespace MonoMac.Tuner {
-
-       public class RemoveSelectors : IStep {
-
-               public void Process (LinkContext context)
-               {
-                       AssemblyDefinition monomac;
-                       if (!context.TryGetLinkedAssembly ("MonoMac", out monomac))
-                               return;
-
-                       foreach (TypeDefinition type in monomac.MainModule.Types) {
-                               if (!type.IsNSObject ())
-                                       continue;
-
-                               ProcessNSObject (type);
-                       }
-               }
-
-               static void ProcessNSObject (TypeDefinition type)
-               {
-                       var selectors = PopulateSelectors (type);
-                       if (selectors == null)
-                               return;
-
-                       foreach (var method in CollectMethods (type))
-                               CheckSelectorUsage (method, selectors);
-
-                       if (selectors.Count == 0)
-                               return;
-
-                       PatchStaticConstructor (type, selectors);
-                       RemoveUnusedSelectors (type, selectors);
-               }
-
-               static void CheckSelectorUsage (MethodDefinition method, HashSet<FieldDefinition> selectors)
-               {
-                       if (!method.HasBody)
-                               return;
-
-                       foreach (Instruction instruction in method.Body.Instructions) {
-                               switch (instruction.OpCode.OperandType) {
-                               case OperandType.InlineTok:
-                               case OperandType.InlineField:
-                                       var field = instruction.Operand as FieldDefinition;
-                                       if (field == null)
-                                               continue;
-
-                                       if (selectors.Contains (field))
-                                               selectors.Remove (field);
-
-                                       break;
-                               }
-                       }
-               }
-
-               static void PatchStaticConstructor (TypeDefinition type, HashSet<FieldDefinition> selectors)
-               {
-                       var cctor = type.GetTypeConstructor ();
-                       if (cctor == null || !cctor.HasBody)
-                               return;
-
-                       var instructions = cctor.Body.Instructions;
-
-                       for (int i = 0; i < instructions.Count; i++) {
-                               var instruction = instructions [i];
-                               if (!IsCreateSelector (instruction, selectors))
-                                       continue;
-
-                               instructions.RemoveAt (i--);
-                               instructions.RemoveAt (i--);
-                               instructions.RemoveAt (i--);
-                       }
-               }
-
-               static bool IsCreateSelector (Instruction instruction, HashSet<FieldDefinition> selectors)
-               {
-                       if (instruction.OpCode != OpCodes.Stsfld)
-                               return false;
-
-                       var field = instruction.Operand as FieldDefinition;
-                       if (field == null)
-                               return false;
-
-                       if (!selectors.Contains (field))
-                               return false;
-
-                       instruction = instruction.Previous;
-                       if (instruction == null)
-                               return false;
-
-                       if (instruction.OpCode != OpCodes.Call)
-                               return false;
-
-                       if (!IsRegisterSelector (instruction.Operand as MethodReference))
-                               return false;
-
-                       instruction = instruction.Previous;
-                       if (instruction == null)
-                               return false;
-
-                       if (instruction.OpCode != OpCodes.Ldstr)
-                               return false;
-
-                       return true;
-               }
-
-               static bool IsRegisterSelector (MethodReference method)
-               {
-                       if (method == null)
-                               return false;
-
-                       if (method.Name != "GetHandle" && method.Name != "sel_registerName")
-                               return false;
-
-                       if (method.DeclaringType.FullName != "MonoMac.ObjCRuntime.Selector")
-                               return false;
-
-                       return true;
-               }
-
-               static void RemoveUnusedSelectors (TypeDefinition type, HashSet<FieldDefinition> selectors)
-               {
-                       var fields = type.Fields;
-
-                       for (int i = 0; i < fields.Count; i++)
-                               if (selectors.Contains (fields [i]))
-                                       fields.RemoveAt (i--);
-               }
-
-               static HashSet<FieldDefinition> PopulateSelectors (TypeDefinition type)
-               {
-                       if (!type.HasFields)
-                               return null;
-
-                       HashSet<FieldDefinition> selectors = null;
-
-                       foreach (FieldDefinition field in type.Fields) {
-                               if (!IsSelector (field))
-                                       continue;
-
-                               if (selectors == null)
-                                       selectors = new HashSet<FieldDefinition> ();
-
-                               selectors.Add (field);
-                       }
-
-                       return selectors;
-               }
-
-               static bool IsSelector (FieldDefinition field)
-               {
-                       if (!field.IsStatic)
-                               return false;
-
-                       if (field.FieldType.FullName != "System.IntPtr")
-                               return false;
-
-                       if (!field.Name.StartsWith ("sel"))
-                               return false;
-
-                       return true;
-               }
-
-               static IEnumerable<MethodDefinition> CollectMethods (TypeDefinition type)
-               {
-                       if (!type.HasMethods)
-                               yield break;
-
-                       foreach (MethodDefinition method in type.Methods) {
-                               if (method.IsStatic && method.IsConstructor)
-                                       continue;
-
-                               yield return method;
-                       }
-               }
-       }
-}
index 72659db89401563655154dfe935af7591ab178d6..22f09af6eabfb7cdf0874a34a713bdb43c7171e6 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
@@ -28,7 +29,7 @@
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
@@ -36,7 +37,7 @@
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
+    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
index 9d6e914532dad6265dc577dd2bbe6c0e176d5895..ca06717b19b63e665d09a4bf6f15c48bc6b2a605 100644 (file)
@@ -131,6 +131,7 @@ install-pcl5-framework:
 EXTRA_DISTFILES = \
        data/xbuild.rsp \
        data/xbuild.exe.config.in \
+       data/xbuild.exe.config_test.in \
        data/Microsoft.Build.xsd \
        data/2.0/Microsoft.Common.tasks \
        data/3.5/Microsoft.Common.tasks \
index ffe1f63b83831bf76308f05d066a6bcd62b5828e..b28194f9a2f441490d755fa04051c20e84eac87b 100644 (file)
                <FileWrites Include="$(TargetFrameworkMonikerAssemblyAttributesPath)" />
        </ItemGroup>
 
-       <Target Name="GenerateTargetFrameworkMonikerAttribute"
+       <Target Name="_GenerateTargetFrameworkMonikerAttribute"
                DependsOnTargets="PrepareForBuild;GetReferenceAssemblyPaths"
                Inputs="$(MSBuildToolsPath)\Microsoft.Common.targets"
-               Outputs="$(TargetFrameworkMonikerAssemblyAttributesPath)"
-               Condition="'$(GenerateTargetFrameworkAttribute)' == 'true'">
+               Outputs="$(TargetFrameworkMonikerAssemblyAttributesPath)">
 
                <WriteLinesToFile
                        File="$(TargetFrameworkMonikerAssemblyAttributesPath)"
                        ContinueOnError="true"
                        Condition="'@(Compile)' != '' and '$(TargetFrameworkMonikerAssemblyAttributeText)' != ''"
                />
+       </Target>
+
+       <Target Name="GenerateTargetFrameworkMonikerAttribute"
+               DependsOnTargets="_GenerateTargetFrameworkMonikerAttribute"
+               Condition="'$(GenerateTargetFrameworkAttribute)' == 'true'">
 
                <ItemGroup Condition="'@(Compile)' != '' and '$(TargetFrameworkMonikerAssemblyAttributeText)' != ''">
                        <Compile Include="$(TargetFrameworkMonikerAssemblyAttributesPath)"/>
index 433cffe8e69a8bfb86808755e4bfa26911c7d77a..89afe6502c780f8661c658ba53f8843818a90537 100644 (file)
                <FileWrites Include="$(TargetFrameworkMonikerAssemblyAttributesPath)" />
        </ItemGroup>
 
-       <Target Name="GenerateTargetFrameworkMonikerAttribute"
+       <Target Name="_GenerateTargetFrameworkMonikerAttribute"
                DependsOnTargets="PrepareForBuild;GetReferenceAssemblyPaths"
                Inputs="$(MSBuildToolsPath)\Microsoft.Common.targets"
-               Outputs="$(TargetFrameworkMonikerAssemblyAttributesPath)"
-               Condition="'$(GenerateTargetFrameworkAttribute)' == 'true'">
+               Outputs="$(TargetFrameworkMonikerAssemblyAttributesPath)">
 
                <WriteLinesToFile
                        File="$(TargetFrameworkMonikerAssemblyAttributesPath)"
                        ContinueOnError="true"
                        Condition="'@(Compile)' != '' and '$(TargetFrameworkMonikerAssemblyAttributeText)' != ''"
                />
+       </Target>
+
+       <Target Name="GenerateTargetFrameworkMonikerAttribute"
+               DependsOnTargets="_GenerateTargetFrameworkMonikerAttribute"
+               Condition="'$(GenerateTargetFrameworkAttribute)' == 'true'">
 
                <ItemGroup Condition="'@(Compile)' != '' and '$(TargetFrameworkMonikerAssemblyAttributeText)' != ''">
                        <Compile Include="$(TargetFrameworkMonikerAssemblyAttributesPath)"/>
index 152dd2b985e906f5ed3e6ac13142dd6e90198390..ff82f8195fe89bb67b6a224cb89bea9ae8bd9112 100644 (file)
                <FileWrites Include="$(TargetFrameworkMonikerAssemblyAttributesPath)" />
        </ItemGroup>
 
-       <Target Name="GenerateTargetFrameworkMonikerAttribute"
+       <Target Name="_GenerateTargetFrameworkMonikerAttribute"
                DependsOnTargets="PrepareForBuild;GetReferenceAssemblyPaths"
                Inputs="$(MSBuildToolsPath)\Microsoft.Common.targets"
-               Outputs="$(TargetFrameworkMonikerAssemblyAttributesPath)"
-               Condition="'$(GenerateTargetFrameworkAttribute)' == 'true'">
+               Outputs="$(TargetFrameworkMonikerAssemblyAttributesPath)">
 
                <WriteLinesToFile
                        File="$(TargetFrameworkMonikerAssemblyAttributesPath)"
                        ContinueOnError="true"
                        Condition="'@(Compile)' != '' and '$(TargetFrameworkMonikerAssemblyAttributeText)' != ''"
                />
+       </Target>
+
+       <Target Name="GenerateTargetFrameworkMonikerAttribute"
+               DependsOnTargets="_GenerateTargetFrameworkMonikerAttribute"
+               Condition="'$(GenerateTargetFrameworkAttribute)' == 'true'">
 
                <ItemGroup Condition="'@(Compile)' != '' and '$(TargetFrameworkMonikerAssemblyAttributeText)' != ''">
                        <Compile Include="$(TargetFrameworkMonikerAssemblyAttributesPath)"/>
diff --git a/mcs/tools/xbuild/data/xbuild.exe.config_test.in b/mcs/tools/xbuild/data/xbuild.exe.config_test.in
new file mode 100644 (file)
index 0000000..a90dbf2
--- /dev/null
@@ -0,0 +1,11 @@
+       <generatePublisherEvidence enabled="false" />
+       <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
+               <dependentAssembly>
+                       <assemblyIdentity name="Microsoft.Build.Framework" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+                       <bindingRedirect oldVersion="0.0.0.0-100.0.0.0" newVersion="@ASM_VERSION@" />
+               </dependentAssembly>
+               <dependentAssembly>
+                       <assemblyIdentity name="Microsoft.Build.Engine" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+                       <bindingRedirect oldVersion="0.0.0.0-100.0.0.0" newVersion="@ASM_VERSION@" />
+               </dependentAssembly>
+       </assemblyBinding>
diff --git a/mcs/tools/xbuild/tests/Vbc/1.vbproj b/mcs/tools/xbuild/tests/Vbc/1.vbproj
new file mode 100644 (file)
index 0000000..c056fd1
--- /dev/null
@@ -0,0 +1,22 @@
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" >
+       
+       <ItemGroup>
+               <Input Include="test.vb" />
+               <Output Include="test.exe" />
+       </ItemGroup>
+       
+       <Target Name="Compile1" >
+               <Vbc
+                       Sources="@(Input)"
+                        OutputAssembly="@(Output)"
+               />
+       </Target>
+       
+       <Target Name="Clean" >
+               <Delete Files="@(Output)" />
+       </Target>
+       
+       <Target Name="Execute" >
+               <Exec Command="@(Output)" />
+       </Target>
+</Project>
diff --git a/mcs/tools/xbuild/tests/Vbc/2.vbproj b/mcs/tools/xbuild/tests/Vbc/2.vbproj
new file mode 100644 (file)
index 0000000..517036a
--- /dev/null
@@ -0,0 +1,13 @@
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTarget="Build">
+       
+       <ItemGroup>
+               <Input Include="test.vb" />
+               <Output Include="test.exe" />
+       </ItemGroup>
+       
+       <Target Name="Build" >
+               <Vbc
+                       Sources="@(Input)"
+               />
+       </Target>
+</Project>
diff --git a/mcs/tools/xbuild/tests/Vbc/test.vb b/mcs/tools/xbuild/tests/Vbc/test.vb
new file mode 100644 (file)
index 0000000..4f76bf6
--- /dev/null
@@ -0,0 +1,7 @@
+Imports System
+
+Public Module mainmod
+  Sub Main()
+    Console.WriteLine("Hello, world!")
+  End sub
+End Module
index 9dcf0987ec86b7daeadd7c92e899af2c823b82ea..4c503c060ac3b432270f45b7367477750751875d 100644 (file)
@@ -9,7 +9,7 @@ export XBUILD_FRAMEWORK_FOLDERS_PATH= $(topdir)/class/Microsoft.Build/xbuild-tes
 ifeq (4.0, $(FRAMEWORK_VERSION))
 NO_TEST=true
 else
-test-local: copy-targets $(test_lib).config
+test-local: copy-targets Test/test-config-file-$(PROFILE)
 clean-local: clean-targets clean-test-config
 endif
 
@@ -17,11 +17,11 @@ xbuild-net4-fail:
        @echo "The net_4_0 profile contains reference assemblies only and cannot be installed/tested as an xbuild toolset"
        @exit 1
 
-$(test_lib).config: $(XBUILD_DATA_DIR)/xbuild.exe.config.in
-       sed -e 's/@ASM_VERSION@/$(XBUILD_ASSEMBLY_VERSION)/g' $(XBUILD_DATA_DIR)/xbuild.exe.config.in > $(test_lib).config
+Test/test-config-file-$(PROFILE): $(XBUILD_DATA_DIR)/xbuild.exe.config_test.in
+       sed -e 's/@ASM_VERSION@/$(XBUILD_ASSEMBLY_VERSION)/g' $(XBUILD_DATA_DIR)/xbuild.exe.config_test.in > Test/test-config-file-$(PROFILE)
 
 clean-test-config:
-       rm -f $(test_lib).config
+       rm -f Test/test-config-file-$(PROFILE)
 
 copy-targets: copy-targets-$(XBUILD_VERSION)
 
index 7bf7b5c3dedfa0122abb5dba36dd6120370cb231..651271c25f895fe4a332287feba54f1eed76833f 100644 (file)
@@ -2,11 +2,15 @@ if SUPPORT_SGEN
 sgen_dirs = sgen
 endif
 
+if BTLS
+btls_dirs = btls
+endif
+
 if CROSS_COMPILING
-SUBDIRS = arch utils io-layer cil metadata $(sgen_dirs) mini dis profiler
+SUBDIRS = $(btls_dirs) arch utils io-layer cil metadata $(sgen_dirs) mini dis profiler
 else
 if INSTALL_MONOTOUCH
-SUBDIRS = arch utils io-layer metadata $(sgen_dirs) mini profiler
+SUBDIRS = $(btls_dirs) arch utils io-layer metadata $(sgen_dirs) mini profiler
 
 monotouch-do-build:
        @list='$(SUBDIRS)'; for subdir in $$list; do \
@@ -30,7 +34,7 @@ monotouch-do-clean:
          (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$target); \
     done;
 else
-SUBDIRS = arch utils io-layer cil metadata $(sgen_dirs) mini dis tests unit-tests benchmark profiler
+SUBDIRS = $(btls_dirs) arch utils io-layer cil metadata $(sgen_dirs) mini dis tests unit-tests benchmark profiler
 endif
 endif
-DIST_SUBDIRS = arch utils io-layer cil metadata $(sgen_dirs) mini dis tests unit-tests benchmark profiler
+DIST_SUBDIRS = btls arch utils io-layer cil metadata $(sgen_dirs) mini dis tests unit-tests benchmark profiler
diff --git a/mono/btls/.gitignore b/mono/btls/.gitignore
new file mode 100644 (file)
index 0000000..545f630
--- /dev/null
@@ -0,0 +1,6 @@
+Makefile
+Makefile.in
+build/
+martin-test
+build-shared/
+build-static/
diff --git a/mono/btls/CMakeLists.txt b/mono/btls/CMakeLists.txt
new file mode 100644 (file)
index 0000000..41ad491
--- /dev/null
@@ -0,0 +1,91 @@
+cmake_minimum_required (VERSION 2.8.10)
+
+project (mono-btls)
+
+if(POLICY CMP0026)
+cmake_policy(SET CMP0026 NEW)
+endif()
+if(POLICY CMP0042)
+cmake_policy(SET CMP0042 NEW)
+endif()
+
+enable_language(C)
+enable_language(CXX)
+
+# FIXME: cmake's asm detection is broken when using xcrun.
+set (CMAKE_ASM_COMPILER "${CMAKE_C_COMPILER}")
+set (CMAKE_ASM_COMPILER_ARG1 "${CMAKE_C_COMPILER_ARG1}")
+set (CMAKE_ASM_COMPILER_ID "${CMAKE_C_COMPILER_ID}")
+enable_language(ASM)
+
+if (NOT "${BTLS_ARCH}" STREQUAL "")
+       message (WARNING "SET ARCH: ${BTLS_ARCH}")
+       set (CMAKE_SYSTEM_PROCESSOR "${BTLS_ARCH}")
+endif ()
+if (BUILD_DYNAMIC_BTLS)
+set (C_CXX_FLAGS "-Wall -Wsign-compare -Wmissing-field-initializers -fPIC -ggdb -fvisibility=hidden")
+elseif (BUILD_SHARED_LIBS)
+set (C_CXX_FLAGS "-Wall -Wsign-compare -Wmissing-field-initializers -fPIC -ggdb -fvisibility=hidden")
+else ()
+set (C_CXX_FLAGS "-Wall -Wsign-compare -Wmissing-field-initializers -ggdb -fvisibility=hidden")
+endif()
+set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${C_CXX_FLAGS} ${BTLS_CFLAGS}")
+set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${C_CXX_FLAGS} ${BTLS_CFLAGS}")
+set (CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} ${BTLS_CFLAGS}")
+set (CMAKE_MACOSX_RPATH 1)
+set (MONO_BTLS 1)
+
+add_subdirectory (${BTLS_ROOT} boringssl)
+
+include_directories (
+       ${SRC_DIR}
+       ${BTLS_ROOT}/include
+)
+
+set (
+       MONO_BTLS_SOURCES
+
+       btls-bio.c
+       btls-bio.h
+       btls-error.c
+       btls-error.h
+       btls-key.c
+       btls-key.h
+       btls-pkcs12.c
+       btls-pkcs12.h
+       btls-ssl-ctx.c
+       btls-ssl-ctx.h
+       btls-ssl.c
+       btls-ssl.h
+       btls-time64.c
+       btls-util.c
+       btls-util.h
+       btls-x509-chain.c
+       btls-x509-chain.h
+       btls-x509-crl.c
+       btls-x509-crl.h
+       btls-x509-lookup.c
+       btls-x509-lookup.h
+       btls-x509-lookup-mono.c
+       btls-x509-lookup-mono.h
+       btls-x509-name.c
+       btls-x509-name.h
+       btls-x509-revoked.c
+       btls-x509-revoked.h
+       btls-x509-store-ctx.c
+       btls-x509-store-ctx.h
+       btls-x509-store.c
+       btls-x509-store.h
+       btls-x509-verify-param.c
+       btls-x509-verify-param.h
+       btls-x509.c
+       btls-x509.h
+
+       ${BORINGSSL_OBJECTS}
+)
+
+if (BUILD_SHARED_LIBS)
+       add_library (mono-btls-shared SHARED ${MONO_BTLS_SOURCES})
+else ()
+       add_library (mono-btls-static STATIC ${MONO_BTLS_SOURCES})
+endif ()
diff --git a/mono/btls/Makefile.am b/mono/btls/Makefile.am
new file mode 100644 (file)
index 0000000..38f879c
--- /dev/null
@@ -0,0 +1,66 @@
+EXTRA_DIST = \
+       btls-bio.c \
+       btls-bio.h \
+       btls-error.c \
+       btls-error.h \
+       btls-key.c \
+       btls-key.h \
+       btls-pkcs12.c \
+       btls-pkcs12.h \
+       btls-ssl.c \
+       btls-ssl-ctx.c \
+       btls-ssl-ctx.h \
+       btls-ssl.h \
+       btls-time64.c \
+       btls-util.c \
+       btls-util.h \
+       btls-x509.c \
+       btls-x509-chain.c \
+       btls-x509-chain.h \
+       btls-x509-crl.c \
+       btls-x509-crl.h \
+       btls-x509.h \
+       btls-x509-lookup.c \
+       btls-x509-lookup.h \
+       btls-x509-lookup-mono.c \
+       btls-x509-lookup-mono.h \
+       btls-x509-name.c \
+       btls-x509-name.h \
+       btls-x509-revoked.c \
+       btls-x509-revoked.h \
+       btls-x509-store.c \
+       btls-x509-store-ctx.c \
+       btls-x509-store-ctx.h \
+       btls-x509-store.h \
+       btls-x509-verify-param.c \
+       btls-x509-verify-param.h \
+       CMakeLists.txt
+
+CMAKE_VERBOSE=$(if $(V),VERBOSE=1,)
+
+CMAKE_ARGS = -D CMAKE_INSTALL_PREFIX:PATH=$(prefix) -D BTLS_ROOT:PATH=$(BTLS_ROOT) \
+       -D SRC_DIR:PATH=$(abs_top_srcdir)/mono/btls -D BTLS_CFLAGS:STRING="$(BTLS_CFLAGS)"
+
+all-local: build-shared/libmono-btls-shared$(libsuffix) build-static/libmono-btls-static.a
+
+build-shared/Makefile:
+       -mkdir -p build-shared
+       (cd build-shared && $(CMAKE) $(CMAKE_ARGS) $(BTLS_CMAKE_ARGS) -DBUILD_SHARED_LIBS=1 $(abs_top_srcdir)/mono/btls)
+
+build-shared/libmono-btls-shared$(libsuffix): build-shared/Makefile
+       $(MAKE) -C build-shared $(CMAKE_VERBOSE)
+
+build-static/Makefile:
+       -mkdir -p build-static
+       (cd build-static && $(CMAKE) $(CMAKE_ARGS) $(BTLS_CMAKE_ARGS) $(abs_top_srcdir)/mono/btls)
+
+build-static/libmono-btls-static.a: build-static/Makefile
+       $(MAKE) -C build-static $(CMAKE_VERBOSE)
+
+clean-local:
+       -rm -rf build-static
+       -rm -rf build-shared
+
+install-exec-local:
+       $(mkinstalldirs) "$(DESTDIR)$(libdir)"
+       $(install_sh) build-shared/libmono-btls-shared.* "$(DESTDIR)$(libdir)"
diff --git a/mono/btls/btls-bio.c b/mono/btls/btls-bio.c
new file mode 100644 (file)
index 0000000..a35582a
--- /dev/null
@@ -0,0 +1,206 @@
+//
+//  btls-bio.c
+//  MonoBtls
+//
+//  Created by Martin Baulig on 14/11/15.
+//  Copyright (c) 2015 Xamarin. All rights reserved.
+//
+
+#include <btls-ssl.h>
+#include <btls-bio.h>
+#include <errno.h>
+
+struct MonoBtlsBio {
+       const void *instance;
+       MonoBtlsReadFunc read_func;
+       MonoBtlsWriteFunc write_func;
+       MonoBtlsControlFunc control_func;
+};
+
+#if 0
+static void
+mono_debug (const char *message)
+{
+       BIO *bio_err;
+       bio_err = BIO_new_fp (stderr, BIO_NOCLOSE);
+       fprintf (stderr, "DEBUG: %s\n", message);
+       ERR_print_errors (bio_err);
+}
+#endif
+
+static int
+mono_read (BIO *bio, char *out, int outl)
+{
+       MonoBtlsBio *mono = (MonoBtlsBio *)bio->ptr;
+       int ret, wantMore;
+
+       if (!mono)
+               return -1;
+
+       ret = mono->read_func (mono->instance, out, outl, &wantMore);
+
+       if (ret < 0)
+               return -1;
+       if (ret > 0)
+               return ret;
+
+       if (wantMore) {
+               errno = EAGAIN;
+               BIO_set_retry_read (bio);
+               return -1;
+       }
+
+       return 0;
+}
+
+static int
+mono_write (BIO *bio, const char *in, int inl)
+{
+       MonoBtlsBio *mono = (MonoBtlsBio *)bio->ptr;
+
+       if (!mono)
+               return -1;
+
+       return mono->write_func (mono->instance, in, inl);
+}
+
+static int64_t
+mono_ctrl (BIO *bio, int cmd, int64_t num, void *ptr)
+{
+       MonoBtlsBio *mono = (MonoBtlsBio *)bio->ptr;
+
+       if (!mono)
+               return -1;
+
+       // fprintf (stderr, "mono_ctrl: %x - %lx - %p\n", cmd, num, ptr);
+       switch (cmd) {
+               case BIO_CTRL_FLUSH:
+                       return mono->control_func (mono->instance, MONO_BTLS_CONTROL_COMMAND_FLUSH, 0);
+               default:
+                       return -1;
+       }
+       return -1;
+}
+
+static int
+mono_new (BIO *bio)
+{
+       // mono_debug("mono_new!\n");
+       bio->init = 0;
+       bio->num = -1;
+       bio->flags = 0;
+       return 1;
+}
+
+static int
+mono_free (BIO *bio)
+{
+       // mono_debug ("mono_free!\n");
+       if (bio->ptr) {
+               MonoBtlsBio *mono = (MonoBtlsBio *)bio->ptr;
+
+               bio->ptr = NULL;
+               mono->instance = NULL;
+               mono->read_func = NULL;
+               mono->write_func = NULL;
+               mono->control_func = NULL;
+               free (mono);
+       }
+       return 1;
+}
+
+static const BIO_METHOD mono_method = {
+       BIO_TYPE_NONE, "mono", mono_write, mono_read,
+       NULL, NULL, mono_ctrl, mono_new, mono_free, NULL
+};
+
+MONO_API BIO *
+mono_btls_bio_mono_new (void)
+{
+       BIO *bio;
+       MonoBtlsBio *monoBio;
+
+       bio = BIO_new (&mono_method);
+       if (!bio)
+               return NULL;
+
+       monoBio = calloc (1, sizeof (MonoBtlsBio));
+       if (!monoBio) {
+               BIO_free (bio);
+               return NULL;
+       }
+
+       bio->ptr = monoBio;
+       bio->init = 0;
+
+       return bio;
+}
+
+MONO_API void
+mono_btls_bio_mono_initialize (BIO *bio, const void *instance,
+                             MonoBtlsReadFunc read_func, MonoBtlsWriteFunc write_func,
+                             MonoBtlsControlFunc control_func)
+{
+       MonoBtlsBio *monoBio = bio->ptr;
+
+       monoBio->instance = instance;
+       monoBio->read_func = read_func;
+       monoBio->write_func = write_func;
+       monoBio->control_func = control_func;
+
+       bio->init = 1;
+}
+
+MONO_API int
+mono_btls_bio_read (BIO *bio, void *data, int len)
+{
+       return BIO_read (bio, data, len);
+}
+
+MONO_API int
+mono_btls_bio_write (BIO *bio, const void *data, int len)
+{
+       return BIO_write (bio, data, len);
+}
+
+MONO_API int
+mono_btls_bio_flush (BIO *bio)
+{
+       return BIO_flush (bio);
+}
+
+MONO_API int
+mono_btls_bio_indent (BIO *bio, unsigned indent, unsigned max_indent)
+{
+       return BIO_indent (bio, indent, max_indent);
+}
+
+MONO_API int
+mono_btls_bio_hexdump (BIO *bio, const uint8_t *data, int len, unsigned indent)
+{
+       return BIO_hexdump (bio, data, len, indent);
+}
+
+MONO_API void
+mono_btls_bio_print_errors (BIO *bio)
+{
+       BIO_print_errors (bio);
+}
+
+MONO_API void
+mono_btls_bio_free (BIO *bio)
+{
+       BIO_free (bio);
+}
+
+MONO_API BIO *
+mono_btls_bio_mem_new (void)
+{
+       return BIO_new (BIO_s_mem ());
+}
+
+MONO_API int
+mono_btls_bio_mem_get_data (BIO *bio, void **data)
+{
+       return (int)BIO_get_mem_data (bio, (char**)data);
+}
diff --git a/mono/btls/btls-bio.h b/mono/btls/btls-bio.h
new file mode 100644 (file)
index 0000000..0795ef0
--- /dev/null
@@ -0,0 +1,58 @@
+//
+//  btls-bio.h
+//  MonoBtls
+//
+//  Created by Martin Baulig on 14/11/15.
+//  Copyright (c) 2015 Xamarin. All rights reserved.
+//
+
+#ifndef __btls__btls_bio__
+#define __btls__btls_bio__
+
+#include <stdio.h>
+#include <btls-ssl.h>
+
+typedef enum {
+       MONO_BTLS_CONTROL_COMMAND_FLUSH = 1
+} MonoBtlsControlCommand;
+
+typedef int (* MonoBtlsReadFunc) (const void *instance, const void *buf, int size, int *wantMore);
+typedef int (* MonoBtlsWriteFunc) (const void *instance, const void *buf, int size);
+typedef int64_t (* MonoBtlsControlFunc) (const void *instance, MonoBtlsControlCommand command, int64_t arg);
+
+BIO *
+mono_btls_bio_mono_new (void);
+
+void
+mono_btls_bio_mono_initialize (BIO *bio, const void *instance,
+                             MonoBtlsReadFunc read_func, MonoBtlsWriteFunc write_func,
+                             MonoBtlsControlFunc control_func);
+
+int
+mono_btls_bio_read (BIO *bio, void *data, int len);
+
+int
+mono_btls_bio_write (BIO *bio, const void *data, int len);
+
+int
+mono_btls_bio_flush (BIO *bio);
+
+int
+mono_btls_bio_indent (BIO *bio, unsigned indent, unsigned max_indent);
+
+int
+mono_btls_bio_hexdump (BIO *bio, const uint8_t *data, int len, unsigned indent);
+
+void
+mono_btls_bio_print_errors (BIO *bio);
+
+void
+mono_btls_bio_free (BIO *bio);
+
+BIO *
+mono_btls_bio_mem_new (void);
+
+int
+mono_btls_bio_mem_get_data (BIO *bio, void **data);
+
+#endif /* defined(__btls__btls_bio__) */
diff --git a/mono/btls/btls-error.c b/mono/btls/btls-error.c
new file mode 100644 (file)
index 0000000..7525216
--- /dev/null
@@ -0,0 +1,36 @@
+//
+//  btls-error.c
+//  MonoBtls
+//
+//  Created by Martin Baulig on 6/19/16.
+//  Copyright © 2016 Xamarin. All rights reserved.
+//
+
+#include <btls-error.h>
+#include <btls-util.h>
+#include <assert.h>
+
+MONO_API int
+mono_btls_error_peek_error (void)
+{
+       return ERR_peek_error ();
+}
+
+MONO_API int
+mono_btls_error_get_error (void)
+{
+       return ERR_get_error ();
+}
+
+MONO_API void
+mono_btls_error_clear_error (void)
+{
+       ERR_clear_error ();
+}
+
+MONO_API void
+mono_btls_error_get_error_string_n (int error, char *buf, int len)
+{
+       ERR_error_string_n (error, buf, len);
+}
+
diff --git a/mono/btls/btls-error.h b/mono/btls/btls-error.h
new file mode 100644 (file)
index 0000000..6f791c3
--- /dev/null
@@ -0,0 +1,29 @@
+//
+//  btls-util.h
+//  MonoBtls
+//
+//  Created by Martin Baulig on 3/23/16.
+//  Copyright © 2016 Xamarin. All rights reserved.
+//
+
+#ifndef __btls__btls_error__
+#define __btls__btls_error__
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <openssl/ssl.h>
+
+int
+mono_btls_error_peek_error (void);
+
+int
+mono_btls_error_get_error (void);
+
+void
+mono_btls_error_clear_error (void);
+
+void
+mono_btls_error_get_error_string_n (int error, char *buf, int len);
+
+#endif /* __btls__btls_error__ */
diff --git a/mono/btls/btls-key.c b/mono/btls/btls-key.c
new file mode 100644 (file)
index 0000000..65909a5
--- /dev/null
@@ -0,0 +1,62 @@
+//
+//  btls-key.c
+//  MonoBtls
+//
+//  Created by Martin Baulig on 3/7/16.
+//  Copyright © 2016 Xamarin. All rights reserved.
+//
+
+#include <btls-key.h>
+
+MONO_API void
+mono_btls_key_free (EVP_PKEY *pkey)
+{
+       EVP_PKEY_free (pkey);
+}
+
+MONO_API EVP_PKEY *
+mono_btls_key_up_ref (EVP_PKEY *pkey)
+{
+       return EVP_PKEY_up_ref (pkey);
+}
+
+MONO_API int
+mono_btls_key_get_bits (EVP_PKEY *pkey)
+{
+       return EVP_PKEY_bits (pkey);
+}
+
+MONO_API int
+mono_btls_key_is_rsa (EVP_PKEY *pkey)
+{
+       return pkey->type == EVP_PKEY_RSA;
+}
+
+MONO_API int
+mono_btls_key_get_bytes (EVP_PKEY *pkey, uint8_t **buffer, int *size, int include_private_bits)
+{
+       size_t len;
+       RSA *rsa;
+       int ret;
+
+       *size = 0;
+       *buffer = NULL;
+
+       if (pkey->type != EVP_PKEY_RSA)
+               return 0;
+
+       rsa = EVP_PKEY_get1_RSA (pkey);
+       if (!rsa)
+               return 0;
+
+       if (include_private_bits)
+               ret = RSA_private_key_to_bytes (buffer, &len, rsa);
+       else
+               ret = RSA_public_key_to_bytes (buffer, &len, rsa);
+
+       if (ret != 1)
+               return 0;
+
+       *size = (int)len;
+       return 1;
+}
diff --git a/mono/btls/btls-key.h b/mono/btls/btls-key.h
new file mode 100644 (file)
index 0000000..85ee5b2
--- /dev/null
@@ -0,0 +1,32 @@
+//
+//  btls-key.h
+//  MonoBtls
+//
+//  Created by Martin Baulig on 3/7/16.
+//  Copyright © 2016 Xamarin. All rights reserved.
+//
+
+#ifndef __btls__btls_key__
+#define __btls__btls_key__
+
+#include <stdio.h>
+#include <btls-ssl.h>
+#include <btls-x509.h>
+
+void
+mono_btls_key_free (EVP_PKEY *pkey);
+
+EVP_PKEY *
+mono_btls_key_up_ref (EVP_PKEY *pkey);
+
+int
+mono_btls_key_get_bits (EVP_PKEY *pkey);
+
+int
+mono_btls_key_is_rsa (EVP_PKEY *pkey);
+
+int
+mono_btls_key_get_bytes (EVP_PKEY *pkey, uint8_t **buffer, int *size, int include_private_bits);
+
+#endif /* __btls__btls_key__ */
+
diff --git a/mono/btls/btls-pkcs12.c b/mono/btls/btls-pkcs12.c
new file mode 100644 (file)
index 0000000..6e1a79e
--- /dev/null
@@ -0,0 +1,101 @@
+//
+//  btls-pkcs12.c
+//  MonoBtls
+//
+//  Created by Martin Baulig on 3/8/16.
+//  Copyright © 2016 Xamarin. All rights reserved.
+//
+
+#include <btls-pkcs12.h>
+#include <openssl/pkcs12.h>
+
+struct MonoBtlsPkcs12 {
+       STACK_OF(X509) *certs;
+       EVP_PKEY *private_key;
+       CRYPTO_refcount_t references;
+};
+
+MONO_API MonoBtlsPkcs12 *
+mono_btls_pkcs12_new (void)
+{
+       MonoBtlsPkcs12 *pkcs12 = (MonoBtlsPkcs12 *)OPENSSL_malloc (sizeof (MonoBtlsPkcs12));
+       if (pkcs12 == NULL)
+               return NULL;
+
+       memset (pkcs12, 0, sizeof(MonoBtlsPkcs12));
+       pkcs12->certs = sk_X509_new_null ();
+       pkcs12->references = 1;
+       return pkcs12;
+}
+
+MONO_API int
+mono_btls_pkcs12_get_count (MonoBtlsPkcs12 *pkcs12)
+{
+       return (int)sk_X509_num (pkcs12->certs);
+}
+
+MONO_API X509 *
+mono_btls_pkcs12_get_cert (MonoBtlsPkcs12 *pkcs12, int index)
+{
+       X509 *cert;
+
+       if ((size_t)index >= sk_X509_num (pkcs12->certs))
+               return NULL;
+       cert = sk_X509_value (pkcs12->certs, index);
+       if (cert)
+               X509_up_ref (cert);
+       return cert;
+}
+
+MONO_API STACK_OF(X509) *
+mono_btls_pkcs12_get_certs (MonoBtlsPkcs12 *pkcs12)
+{
+       return pkcs12->certs;
+}
+
+MONO_API int
+mono_btls_pkcs12_free (MonoBtlsPkcs12 *pkcs12)
+{
+       if (!CRYPTO_refcount_dec_and_test_zero (&pkcs12->references))
+               return 0;
+
+       sk_X509_pop_free (pkcs12->certs, X509_free);
+       OPENSSL_free (pkcs12);
+       return 1;
+}
+
+MONO_API MonoBtlsPkcs12 *
+mono_btls_pkcs12_up_ref (MonoBtlsPkcs12 *pkcs12)
+{
+       CRYPTO_refcount_inc (&pkcs12->references);
+       return pkcs12;
+}
+
+MONO_API void
+mono_btls_pkcs12_add_cert (MonoBtlsPkcs12 *pkcs12, X509 *x509)
+{
+       X509_up_ref (x509);
+       sk_X509_push (pkcs12->certs, x509);
+}
+
+MONO_API int
+mono_btls_pkcs12_import (MonoBtlsPkcs12 *pkcs12, const void *data, int len, const void *password)
+{
+       CBS cbs;
+       CBS_init (&cbs, data, len);
+       return PKCS12_get_key_and_certs (&pkcs12->private_key, pkcs12->certs, &cbs, password);
+}
+
+MONO_API int
+mono_btls_pkcs12_has_private_key (MonoBtlsPkcs12 *pkcs12)
+{
+       return pkcs12->private_key != NULL;
+}
+
+MONO_API EVP_PKEY *
+mono_btls_pkcs12_get_private_key (MonoBtlsPkcs12 *pkcs12)
+{
+       if (!pkcs12->private_key)
+               return NULL;
+       return EVP_PKEY_up_ref (pkcs12->private_key);
+}
diff --git a/mono/btls/btls-pkcs12.h b/mono/btls/btls-pkcs12.h
new file mode 100644 (file)
index 0000000..20c4fd9
--- /dev/null
@@ -0,0 +1,46 @@
+//
+//  btls-pkcs12.h
+//  MonoBtls
+//
+//  Created by Martin Baulig on 3/8/16.
+//  Copyright © 2016 Xamarin. All rights reserved.
+//
+
+#ifndef __btls__btls_pkcs12__
+#define __btls__btls_pkcs12__
+
+#include <stdio.h>
+#include <btls-ssl.h>
+#include <btls-x509.h>
+
+MonoBtlsPkcs12 *
+mono_btls_pkcs12_new (void);
+
+int
+mono_btls_pkcs12_get_count (MonoBtlsPkcs12 *pkcs12);
+
+X509 *
+mono_btls_pkcs12_get_cert (MonoBtlsPkcs12 *pkcs12, int index);
+
+STACK_OF(X509) *
+mono_btls_pkcs12_get_certs (MonoBtlsPkcs12 *pkcs12);
+
+int
+mono_btls_pkcs12_free (MonoBtlsPkcs12 *pkcs12);
+
+MonoBtlsPkcs12 *
+mono_btls_pkcs12_up_ref (MonoBtlsPkcs12 *pkcs12);
+
+void
+mono_btls_pkcs12_add_cert (MonoBtlsPkcs12 *pkcs12, X509 *x509);
+
+int
+mono_btls_pkcs12_import (MonoBtlsPkcs12 *pkcs12, const void *data, int len, const void *password);
+
+int
+mono_btls_pkcs12_has_private_key (MonoBtlsPkcs12 *pkcs12);
+
+EVP_PKEY *
+mono_btls_pkcs12_get_private_key (MonoBtlsPkcs12 *pkcs12);
+
+#endif /* __btls__btls_pkcs12__ */
diff --git a/mono/btls/btls-ssl-ctx.c b/mono/btls/btls-ssl-ctx.c
new file mode 100644 (file)
index 0000000..1f9d43c
--- /dev/null
@@ -0,0 +1,255 @@
+//
+//  btls-ssl-ctx.c
+//  MonoBtls
+//
+//  Created by Martin Baulig on 4/11/16.
+//  Copyright © 2016 Xamarin. All rights reserved.
+//
+
+#include <btls-ssl-ctx.h>
+#include <btls-x509-verify-param.h>
+
+struct MonoBtlsSslCtx {
+       CRYPTO_refcount_t references;
+       SSL_CTX *ctx;
+       BIO *bio;
+       BIO *debug_bio;
+       void *instance;
+       MonoBtlsVerifyFunc verify_func;
+       MonoBtlsSelectFunc select_func;
+};
+
+#define debug_print(ptr,message) \
+do { if (mono_btls_ssl_ctx_is_debug_enabled(ptr)) \
+mono_btls_ssl_ctx_debug_printf (ptr, "%s:%d:%s(): " message, __FILE__, __LINE__, \
+       __func__); } while (0)
+
+#define debug_printf(ptr,fmt, ...) \
+do { if (mono_btls_ssl_ctx_is_debug_enabled(ptr)) \
+mono_btls_ssl_ctx_debug_printf (ptr, "%s:%d:%s(): " fmt, __FILE__, __LINE__, \
+       __func__, __VA_ARGS__); } while (0)
+
+void ssl_cipher_preference_list_free (struct ssl_cipher_preference_list_st *cipher_list);
+
+MONO_API int
+mono_btls_ssl_ctx_is_debug_enabled (MonoBtlsSslCtx *ctx)
+{
+       return ctx->debug_bio != NULL;
+}
+
+MONO_API int
+mono_btls_ssl_ctx_debug_printf (MonoBtlsSslCtx *ctx, const char *format, ...)
+{
+       va_list args;
+       int ret;
+
+       if (!ctx->debug_bio)
+               return 0;
+
+       va_start (args, format);
+       ret = mono_btls_debug_printf (ctx->debug_bio, format, args);
+       va_end (args);
+       return ret;
+}
+
+MONO_API MonoBtlsSslCtx *
+mono_btls_ssl_ctx_new (void)
+{
+       MonoBtlsSslCtx *ctx;
+
+       ctx = OPENSSL_malloc (sizeof (MonoBtlsSslCtx));
+       if (!ctx)
+               return NULL;
+
+       memset (ctx, 0, sizeof (MonoBtlsSslCtx));
+       ctx->references = 1;
+       ctx->ctx = SSL_CTX_new (TLS_method ());
+       return ctx;
+}
+
+MONO_API MonoBtlsSslCtx *
+mono_btls_ssl_ctx_up_ref (MonoBtlsSslCtx *ctx)
+{
+       CRYPTO_refcount_inc (&ctx->references);
+       return ctx;
+}
+
+MONO_API int
+mono_btls_ssl_ctx_free (MonoBtlsSslCtx *ctx)
+{
+       if (!CRYPTO_refcount_dec_and_test_zero (&ctx->references))
+               return 0;
+       SSL_CTX_free (ctx->ctx);
+       ctx->instance = NULL;
+       OPENSSL_free (ctx);
+       return 1;
+}
+
+MONO_API SSL_CTX *
+mono_btls_ssl_ctx_get_ctx (MonoBtlsSslCtx *ctx)
+{
+       return ctx->ctx;
+}
+
+MONO_API void
+mono_btls_ssl_ctx_set_debug_bio (MonoBtlsSslCtx *ctx, BIO *debug_bio)
+{
+       if (debug_bio)
+               ctx->debug_bio = BIO_up_ref(debug_bio);
+       else
+               ctx->debug_bio = NULL;
+}
+
+MONO_API void
+mono_btls_ssl_ctx_initialize (MonoBtlsSslCtx *ctx, void *instance)
+{
+       ctx->instance = instance;
+}
+
+static int
+cert_verify_callback (X509_STORE_CTX *storeCtx, void *arg)
+{
+       MonoBtlsSslCtx *ptr = (MonoBtlsSslCtx*)arg;
+       int ret;
+
+       debug_printf (ptr, "cert_verify_callback(): %p\n", ptr->verify_func);
+       ret = X509_verify_cert (storeCtx);
+       debug_printf (ptr, "cert_verify_callback() #1: %d\n", ret);
+
+       if (ptr->verify_func)
+               ret = ptr->verify_func (ptr->instance, ret, storeCtx);
+
+       return ret;
+}
+
+MONO_API void
+mono_btls_ssl_ctx_set_cert_verify_callback (MonoBtlsSslCtx *ptr, MonoBtlsVerifyFunc func, int cert_required)
+{
+       int mode;
+
+       ptr->verify_func = func;
+       SSL_CTX_set_cert_verify_callback (ptr->ctx, cert_verify_callback, ptr);
+
+       mode = SSL_VERIFY_PEER;
+       if (cert_required)
+               mode |= SSL_VERIFY_FAIL_IF_NO_PEER_CERT;
+
+       SSL_CTX_set_verify (ptr->ctx, mode, NULL);
+}
+
+static int
+cert_select_callback (SSL *ssl, void *arg)
+{
+       MonoBtlsSslCtx *ptr = (MonoBtlsSslCtx*)arg;
+       int ret = 1;
+
+       debug_printf (ptr, "cert_select_callback(): %p\n", ptr->select_func);
+       if (ptr->select_func)
+               ret = ptr->select_func (ptr->instance);
+       debug_printf (ptr, "cert_select_callback() #1: %d\n", ret);
+
+       return ret;
+}
+
+MONO_API void
+mono_btls_ssl_ctx_set_cert_select_callback (MonoBtlsSslCtx *ptr, MonoBtlsSelectFunc func)
+{
+       ptr->select_func = func;
+       SSL_CTX_set_cert_cb (ptr->ctx, cert_select_callback, ptr);
+}
+
+MONO_API X509_STORE *
+mono_btls_ssl_ctx_peek_store (MonoBtlsSslCtx *ctx)
+{
+       return SSL_CTX_get_cert_store (ctx->ctx);
+}
+
+MONO_API void
+mono_btls_ssl_ctx_set_min_version (MonoBtlsSslCtx *ctx, int version)
+{
+       SSL_CTX_set_min_version (ctx->ctx, version);
+}
+
+MONO_API void
+mono_btls_ssl_ctx_set_max_version (MonoBtlsSslCtx *ctx, int version)
+{
+       SSL_CTX_set_max_version (ctx->ctx, version);
+}
+
+MONO_API int
+mono_btls_ssl_ctx_is_cipher_supported (MonoBtlsSslCtx *ctx, uint16_t value)
+{
+       const SSL_CIPHER *cipher;
+
+       cipher = SSL_get_cipher_by_value (value);
+       return cipher != NULL;
+}
+
+MONO_API int
+mono_btls_ssl_ctx_set_ciphers (MonoBtlsSslCtx *ctx, int count, const uint16_t *data,
+                                  int allow_unsupported)
+{
+       STACK_OF(SSL_CIPHER) *ciphers = NULL;
+       struct ssl_cipher_preference_list_st *pref_list = NULL;
+       uint8_t *in_group_flags = NULL;
+       int i;
+
+       ciphers = sk_SSL_CIPHER_new_null ();
+       if (!ciphers)
+               goto err;
+
+       for (i = 0; i < count; i++) {
+               const SSL_CIPHER *cipher = SSL_get_cipher_by_value (data [i]);
+               if (!cipher) {
+                       debug_printf (ctx, "mono_btls_ssl_ctx_set_ciphers(): unknown cipher %02x", data [i]);
+                       if (!allow_unsupported)
+                               goto err;
+                       continue;
+               }
+               if (!sk_SSL_CIPHER_push (ciphers, cipher))
+                        goto err;
+       }
+
+       pref_list = OPENSSL_malloc (sizeof (struct ssl_cipher_preference_list_st));
+       if (!pref_list)
+               goto err;
+
+       memset (pref_list, 0, sizeof (struct ssl_cipher_preference_list_st));
+       pref_list->ciphers = sk_SSL_CIPHER_dup (ciphers);
+       if (!pref_list->ciphers)
+               goto err;
+       pref_list->in_group_flags = OPENSSL_malloc (sk_SSL_CIPHER_num (ciphers));
+       if (!pref_list->in_group_flags)
+               goto err;
+
+       if (ctx->ctx->cipher_list)
+               ssl_cipher_preference_list_free (ctx->ctx->cipher_list);
+       if (ctx->ctx->cipher_list_by_id)
+               sk_SSL_CIPHER_free (ctx->ctx->cipher_list_by_id);
+       if (ctx->ctx->cipher_list_tls10) {
+               ssl_cipher_preference_list_free (ctx->ctx->cipher_list_tls10);
+               ctx->ctx->cipher_list_tls10 = NULL;
+       }
+       if (ctx->ctx->cipher_list_tls11) {
+               ssl_cipher_preference_list_free (ctx->ctx->cipher_list_tls11);
+               ctx->ctx->cipher_list_tls11 = NULL;
+       }
+
+       ctx->ctx->cipher_list = pref_list;
+       ctx->ctx->cipher_list_by_id = ciphers;
+
+       return (int)sk_SSL_CIPHER_num (ciphers);
+
+err:
+       sk_SSL_CIPHER_free (ciphers);
+       OPENSSL_free (pref_list);
+       OPENSSL_free (in_group_flags);
+       return 0;
+}
+
+MONO_API int
+mono_btls_ssl_ctx_set_verify_param (MonoBtlsSslCtx *ctx, const MonoBtlsX509VerifyParam *param)
+{
+       return SSL_CTX_set1_param (ctx->ctx, mono_btls_x509_verify_param_peek_param (param));
+}
+
diff --git a/mono/btls/btls-ssl-ctx.h b/mono/btls/btls-ssl-ctx.h
new file mode 100644 (file)
index 0000000..0954192
--- /dev/null
@@ -0,0 +1,84 @@
+//
+//  btls-ssl-ctx.h
+//  MonoBtls
+//
+//  Created by Martin Baulig on 4/11/16.
+//  Copyright © 2016 Xamarin. All rights reserved.
+//
+
+#ifndef __btls_ssl_ctx__btls_ssl_ctx__
+#define __btls_ssl_ctx__btls_ssl_ctx__
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <openssl/ssl.h>
+#include <btls-util.h>
+
+typedef struct MonoBtlsBio MonoBtlsBio;
+typedef struct MonoBtlsX509Chain MonoBtlsX509Chain;
+typedef struct MonoBtlsX509Crl MonoBtlsX509Crl;
+typedef struct MonoBtlsX509Lookup MonoBtlsX509Lookup;
+typedef struct MonoBtlsX509LookupMono MonoBtlsX509LookupMono;
+typedef struct MonoBtlsX509Name MonoBtlsX509Name;
+typedef struct MonoBtlsX509Store MonoBtlsX509Store;
+typedef struct MonoBtlsX509StoreCtx MonoBtlsX509StoreCtx;
+typedef struct MonoBtlsX509Revoked MonoBtlsX509Revoked;
+typedef struct MonoBtlsX509VerifyParam MonoBtlsX509VerifyParam;
+typedef struct MonoBtlsPkcs12 MonoBtlsPkcs12;
+typedef struct MonoBtlsSsl MonoBtlsSsl;
+typedef struct MonoBtlsSslCtx MonoBtlsSslCtx;
+
+typedef int (* MonoBtlsVerifyFunc) (void *instance, int preverify_ok, X509_STORE_CTX *ctx);
+typedef int (* MonoBtlsSelectFunc) (void *instance);
+
+MonoBtlsSslCtx *
+mono_btls_ssl_ctx_new (void);
+
+MonoBtlsSslCtx *
+mono_btls_ssl_ctx_up_ref (MonoBtlsSslCtx *ctx);
+
+int
+mono_btls_ssl_ctx_free (MonoBtlsSslCtx *ctx);
+
+void
+mono_btls_ssl_ctx_initialize (MonoBtlsSslCtx *ctx, void *instance);
+
+SSL_CTX *
+mono_btls_ssl_ctx_get_ctx (MonoBtlsSslCtx *ctx);
+
+int
+mono_btls_ssl_ctx_debug_printf (MonoBtlsSslCtx *ctx, const char *format, ...);
+
+int
+mono_btls_ssl_ctx_is_debug_enabled (MonoBtlsSslCtx *ctx);
+
+void
+mono_btls_ssl_ctx_set_cert_verify_callback (MonoBtlsSslCtx *ptr, MonoBtlsVerifyFunc func, int cert_required);
+
+void
+mono_btls_ssl_ctx_set_cert_select_callback (MonoBtlsSslCtx *ptr, MonoBtlsSelectFunc func);
+
+void
+mono_btls_ssl_ctx_set_debug_bio (MonoBtlsSslCtx *ctx, BIO *debug_bio);
+
+X509_STORE *
+mono_btls_ssl_ctx_peek_store (MonoBtlsSslCtx *ctx);
+
+void
+mono_btls_ssl_ctx_set_min_version (MonoBtlsSslCtx *ctx, int version);
+
+void
+mono_btls_ssl_ctx_set_max_version (MonoBtlsSslCtx *ctx, int version);
+
+int
+mono_btls_ssl_ctx_is_cipher_supported (MonoBtlsSslCtx *ctx, uint16_t value);
+
+int
+mono_btls_ssl_ctx_set_ciphers (MonoBtlsSslCtx *ctx, int count, const uint16_t *data,
+                                  int allow_unsupported);
+
+int
+mono_btls_ssl_ctx_set_verify_param (MonoBtlsSslCtx *ctx, const MonoBtlsX509VerifyParam *param);
+
+#endif /* __btls_ssl_ctx__btls_ssl_ctx__ */
diff --git a/mono/btls/btls-ssl.c b/mono/btls/btls-ssl.c
new file mode 100644 (file)
index 0000000..dda74ec
--- /dev/null
@@ -0,0 +1,215 @@
+//
+//  btls-ssl.c
+//  MonoBtls
+//
+//  Created by Martin Baulig on 14/11/15.
+//  Copyright (c) 2015 Xamarin. All rights reserved.
+//
+
+#include <btls-ssl.h>
+#include <btls-x509-verify-param.h>
+
+struct MonoBtlsSsl {
+       MonoBtlsSslCtx *ctx;
+       SSL *ssl;
+};
+
+#define debug_print(ptr,message) \
+do { if (mono_btls_ssl_ctx_is_debug_enabled(ptr->ctx)) \
+mono_btls_ssl_ctx_debug_printf (ptr->ctx, "%s:%d:%s(): " message, __FILE__, __LINE__, \
+__func__); } while (0)
+
+#define debug_printf(ptr,fmt, ...) \
+do { if (mono_btls_ssl_ctx_is_debug_enabled(ptr->ctx)) \
+mono_btls_ssl_ctx_debug_printf (ptr->ctx, "%s:%d:%s(): " fmt, __FILE__, __LINE__, \
+__func__, __VA_ARGS__); } while (0)
+
+STACK_OF(SSL_CIPHER) *ssl_bytes_to_cipher_list (SSL *s, const CBS *cbs);
+
+MONO_API MonoBtlsSsl *
+mono_btls_ssl_new (MonoBtlsSslCtx *ctx)
+{
+       MonoBtlsSsl *ptr;
+
+       ptr = calloc (1, sizeof (MonoBtlsSsl));
+
+       ptr->ctx = mono_btls_ssl_ctx_up_ref (ctx);
+       ptr->ssl = SSL_new (mono_btls_ssl_ctx_get_ctx (ptr->ctx));
+
+       SSL_set_options (ptr->ssl, SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3);
+
+       return ptr;
+}
+
+MONO_API void
+mono_btls_ssl_destroy (MonoBtlsSsl *ptr)
+{
+       mono_btls_ssl_close (ptr);
+       if (ptr->ssl) {
+               SSL_free (ptr->ssl);
+               ptr->ssl = NULL;
+       }
+       if (ptr->ctx) {
+               mono_btls_ssl_ctx_free (ptr->ctx);
+               ptr->ctx = NULL;
+       }
+       free (ptr);
+}
+
+MONO_API void
+mono_btls_ssl_close (MonoBtlsSsl *ptr)
+{
+       ;
+}
+
+MONO_API void
+mono_btls_ssl_set_bio (MonoBtlsSsl *ptr, BIO *bio)
+{
+       BIO_up_ref (bio);
+       SSL_set_bio (ptr->ssl, bio, bio);
+}
+
+MONO_API void
+mono_btls_ssl_print_errors_cb (ERR_print_errors_callback_t callback, void *ctx)
+{
+       ERR_print_errors_cb (callback, ctx);
+}
+
+MONO_API int
+mono_btls_ssl_use_certificate (MonoBtlsSsl *ptr, X509 *x509)
+{
+       return SSL_use_certificate (ptr->ssl, x509);
+}
+
+MONO_API int
+mono_btls_ssl_use_private_key (MonoBtlsSsl *ptr, EVP_PKEY *key)
+{
+       return SSL_use_PrivateKey (ptr->ssl, key);
+}
+
+MONO_API int
+mono_btls_ssl_add_chain_certificate (MonoBtlsSsl *ptr, X509 *x509)
+{
+       return SSL_add1_chain_cert (ptr->ssl, x509);
+}
+
+MONO_API int
+mono_btls_ssl_accept (MonoBtlsSsl *ptr)
+{
+       return SSL_accept (ptr->ssl);
+}
+
+MONO_API int
+mono_btls_ssl_connect (MonoBtlsSsl *ptr)
+{
+       return SSL_connect (ptr->ssl);
+}
+
+MONO_API int
+mono_btls_ssl_handshake (MonoBtlsSsl *ptr)
+{
+       return SSL_do_handshake (ptr->ssl);
+}
+
+MONO_API int
+mono_btls_ssl_read (MonoBtlsSsl *ptr, void *buf, int count)
+{
+       return SSL_read (ptr->ssl, buf, count);
+}
+
+MONO_API int
+mono_btls_ssl_write (MonoBtlsSsl *ptr, void *buf, int count)
+{
+       return SSL_write (ptr->ssl, buf, count);
+}
+
+MONO_API int
+mono_btls_ssl_get_version (MonoBtlsSsl *ptr)
+{
+       return SSL_version (ptr->ssl);
+}
+
+MONO_API void
+mono_btls_ssl_set_min_version (MonoBtlsSsl *ptr, int version)
+{
+       SSL_set_min_version (ptr->ssl, version);
+}
+
+MONO_API void
+mono_btls_ssl_set_max_version (MonoBtlsSsl *ptr, int version)
+{
+       SSL_set_max_version (ptr->ssl, version);
+}
+
+MONO_API int
+mono_btls_ssl_get_cipher (MonoBtlsSsl *ptr)
+{
+       const SSL_CIPHER *cipher;
+
+       cipher = SSL_get_current_cipher (ptr->ssl);
+       if (!cipher)
+               return 0;
+       return (uint16_t)SSL_CIPHER_get_id (cipher);
+}
+
+MONO_API int
+mono_btls_ssl_set_cipher_list (MonoBtlsSsl *ptr, const char *str)
+{
+       return SSL_set_cipher_list(ptr->ssl, str);
+}
+
+MONO_API int
+mono_btls_ssl_get_ciphers (MonoBtlsSsl *ptr, uint16_t **data)
+{
+       STACK_OF(SSL_CIPHER) *ciphers;
+       int count, i;
+
+       *data = NULL;
+
+       ciphers = SSL_get_ciphers (ptr->ssl);
+       if (!ciphers)
+               return 0;
+
+       count = (int)sk_SSL_CIPHER_num (ciphers);
+
+       *data = OPENSSL_malloc (2 * count);
+       if (!*data)
+               return 0;
+
+       for (i = 0; i < count; i++) {
+               const SSL_CIPHER *cipher = sk_SSL_CIPHER_value (ciphers, i);
+               (*data) [i] = (uint16_t) SSL_CIPHER_get_id (cipher);
+       }
+
+       return count;
+}
+
+MONO_API X509 *
+mono_btls_ssl_get_peer_certificate (MonoBtlsSsl *ptr)
+{
+       return SSL_get_peer_certificate (ptr->ssl);
+}
+
+MONO_API int
+mono_btls_ssl_get_error (MonoBtlsSsl *ptr, int ret_code)
+{
+       return SSL_get_error (ptr->ssl, ret_code);
+}
+
+MONO_API int
+mono_btls_ssl_set_verify_param (MonoBtlsSsl *ptr, const MonoBtlsX509VerifyParam *param)
+{
+       return SSL_set1_param (ptr->ssl, mono_btls_x509_verify_param_peek_param (param));
+}
+
+MONO_API int
+mono_btls_ssl_set_server_name (MonoBtlsSsl *ptr, const char *name)
+{
+       return SSL_set_tlsext_host_name (ptr->ssl, name);
+}
+
+MONO_API const char *
+mono_btls_ssl_get_server_name (MonoBtlsSsl *ptr)
+{
+       return SSL_get_servername (ptr->ssl, TLSEXT_NAMETYPE_host_name);
+}
diff --git a/mono/btls/btls-ssl.h b/mono/btls/btls-ssl.h
new file mode 100644 (file)
index 0000000..98b0173
--- /dev/null
@@ -0,0 +1,86 @@
+//
+//  btls-ssl.h
+//  MonoBtls
+//
+//  Created by Martin Baulig on 14/11/15.
+//  Copyright (c) 2015 Xamarin. All rights reserved.
+//
+
+#ifndef __btls__btls_ssl__
+#define __btls__btls_ssl__
+
+#include <btls-ssl-ctx.h>
+
+MonoBtlsSsl *
+mono_btls_ssl_new (MonoBtlsSslCtx *ctx);
+
+int
+mono_btls_ssl_use_certificate (MonoBtlsSsl *ptr, X509 *x509);
+
+int
+mono_btls_ssl_use_private_key (MonoBtlsSsl *ptr, EVP_PKEY *key);
+
+int
+mono_btls_ssl_add_chain_certificate (MonoBtlsSsl *ptr, X509 *x509);
+
+int
+mono_btls_ssl_accept (MonoBtlsSsl *ptr);
+
+int
+mono_btls_ssl_connect (MonoBtlsSsl *ptr);
+
+int
+mono_btls_ssl_handshake (MonoBtlsSsl *ptr);
+
+void
+mono_btls_ssl_print_errors_cb (ERR_print_errors_callback_t callback, void *ctx);
+
+void
+mono_btls_ssl_set_bio (MonoBtlsSsl *ptr, BIO *bio);
+
+int
+mono_btls_ssl_read (MonoBtlsSsl *ptr, void *buf, int count);
+
+int
+mono_btls_ssl_write (MonoBtlsSsl *ptr, void *buf, int count);
+
+int
+mono_btls_ssl_get_version (MonoBtlsSsl *ptr);
+
+void
+mono_btls_ssl_set_min_version (MonoBtlsSsl *ptr, int version);
+
+void
+mono_btls_ssl_set_max_version (MonoBtlsSsl *ptr, int version);
+
+int
+mono_btls_ssl_get_cipher (MonoBtlsSsl *ptr);
+
+int
+mono_btls_ssl_set_cipher_list (MonoBtlsSsl *ptr, const char *str);
+
+int
+mono_btls_ssl_get_ciphers (MonoBtlsSsl *ptr, uint16_t **data);
+
+X509 *
+mono_btls_ssl_get_peer_certificate (MonoBtlsSsl *ptr);
+
+void
+mono_btls_ssl_close (MonoBtlsSsl *ptr);
+
+int
+mono_btls_ssl_get_error (MonoBtlsSsl *ptr, int ret_code);
+
+int
+mono_btls_ssl_set_verify_param (MonoBtlsSsl *ptr, const MonoBtlsX509VerifyParam *param);
+
+int
+mono_btls_ssl_set_server_name (MonoBtlsSsl *ptr, const char *name);
+
+const char *
+mono_btls_ssl_get_server_name (MonoBtlsSsl *ptr);
+
+void
+mono_btls_ssl_destroy (MonoBtlsSsl *ptr);
+
+#endif /* defined(__btls__btls_ssl__) */
diff --git a/mono/btls/btls-time64.c b/mono/btls/btls-time64.c
new file mode 100644 (file)
index 0000000..5c67546
--- /dev/null
@@ -0,0 +1,158 @@
+/*
+
+Copyright (c) 2007-2008  Michael G Schwern
+
+This software originally derived from Paul Sheer's pivotal_gmtime_r.c.
+
+The MIT License:
+
+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.
+
+*/
+
+/* See http://code.google.com/p/y2038 for this code's origin */
+
+#include <assert.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <stdint.h>
+#include <string.h>
+#include <time.h>
+#include <errno.h>
+
+/* Spec says except for stftime() and the _r() functions, these
+   all return static memory.  Stabbings! */
+static struct tm   Static_Return_Date;
+static char        Static_Return_String[35];
+
+static const int days_in_month[2][12] = {
+    {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31},
+    {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31},
+};
+
+static const int julian_days_by_month[2][12] = {
+    {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334},
+    {0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335},
+};
+
+static char const wday_name[7][3] = {
+    "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
+};
+
+static char const mon_name[12][3] = {
+    "Jan", "Feb", "Mar", "Apr", "May", "Jun",
+    "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
+};
+
+static const int length_of_year[2] = { 365, 366 };
+
+/* Some numbers relating to the gregorian cycle */
+static const int64_t     years_in_gregorian_cycle   = 400;
+#define               days_in_gregorian_cycle      ((365 * 400) + 100 - 4 + 1)
+static const int64_t seconds_in_gregorian_cycle = days_in_gregorian_cycle * 60LL * 60LL * 24LL;
+
+/* Year range we can trust the time funcitons with */
+#define MAX_SAFE_YEAR 2037
+#define MIN_SAFE_YEAR 1971
+
+/* 28 year Julian calendar cycle */
+#define SOLAR_CYCLE_LENGTH 28
+
+/* Year cycle from MAX_SAFE_YEAR down. */
+static const int safe_years_high[SOLAR_CYCLE_LENGTH] = {
+    2016, 2017, 2018, 2019,
+    2020, 2021, 2022, 2023,
+    2024, 2025, 2026, 2027,
+    2028, 2029, 2030, 2031,
+    2032, 2033, 2034, 2035,
+    2036, 2037, 2010, 2011,
+    2012, 2013, 2014, 2015
+};
+
+/* Year cycle from MIN_SAFE_YEAR up */
+static const int safe_years_low[SOLAR_CYCLE_LENGTH] = {
+    1996, 1997, 1998, 1971,
+    1972, 1973, 1974, 1975,
+    1976, 1977, 1978, 1979,
+    1980, 1981, 1982, 1983,
+    1984, 1985, 1986, 1987,
+    1988, 1989, 1990, 1991,
+    1992, 1993, 1994, 1995,
+};
+
+/* Let's assume people are going to be looking for dates in the future.
+   Let's provide some cheats so you can skip ahead.
+   This has a 4x speed boost when near 2008.
+*/
+/* Number of days since epoch on Jan 1st, 2008 GMT */
+#define CHEAT_DAYS  (1199145600 / 24 / 60 / 60)
+#define CHEAT_YEARS 108
+
+#define IS_LEAP(n)      ((!(((n) + 1900) % 400) || (!(((n) + 1900) % 4) && (((n) + 1900) % 100))) != 0)
+#define WRAP(a,b,m)     ((a) = ((a) <  0  ) ? ((b)--, (a) + (m)) : (a))
+
+/* timegm() is not in the C or POSIX spec, but it is such a useful
+   extension I would be remiss in leaving it out.  Also I need it
+   for localtime64()
+*/
+int64_t btls_timegm64(const struct tm *date) {
+    int64_t days    = 0;
+    int64_t seconds = 0;
+    int64_t     year;
+    int64_t     orig_year = (int64_t)date->tm_year;
+    int      cycles  = 0;
+
+    if( orig_year > 100 ) {
+        cycles = (orig_year - 100) / 400;
+        orig_year -= cycles * 400;
+        days      += (int64_t)cycles * days_in_gregorian_cycle;
+    }
+    else if( orig_year < -300 ) {
+        cycles = (orig_year - 100) / 400;
+        orig_year -= cycles * 400;
+        days      += (int64_t)cycles * days_in_gregorian_cycle;
+    }
+
+    if( orig_year > 70 ) {
+        year = 70;
+        while( year < orig_year ) {
+            days += length_of_year[IS_LEAP(year)];
+            year++;
+        }
+    }
+    else if ( orig_year < 70 ) {
+        year = 69;
+        do {
+            days -= length_of_year[IS_LEAP(year)];
+            year--;
+        } while( year >= orig_year );
+    }
+
+
+    days += julian_days_by_month[IS_LEAP(orig_year)][date->tm_mon];
+    days += date->tm_mday - 1;
+
+    seconds = days * 60 * 60 * 24;
+
+    seconds += date->tm_hour * 60 * 60;
+    seconds += date->tm_min * 60;
+    seconds += date->tm_sec;
+
+    return(seconds);
+}
diff --git a/mono/btls/btls-util.c b/mono/btls/btls-util.c
new file mode 100644 (file)
index 0000000..7c7f4ca
--- /dev/null
@@ -0,0 +1,77 @@
+//
+//  btls-util.c
+//  MonoBtls
+//
+//  Created by Martin Baulig on 3/23/16.
+//  Copyright © 2016 Xamarin. All rights reserved.
+//
+
+#include <btls-util.h>
+#include <assert.h>
+// #include <time.h>
+
+extern int asn1_generalizedtime_to_tm (struct tm *tm, const ASN1_GENERALIZEDTIME *d);
+
+extern int64_t btls_timegm64 (const struct tm *date);
+
+
+MONO_API void
+mono_btls_free (void *data)
+{
+       OPENSSL_free (data);
+}
+
+int64_t
+mono_btls_util_asn1_time_to_ticks (ASN1_TIME *time)
+{
+       ASN1_GENERALIZEDTIME *gtime;
+       struct tm tm;
+       int64_t epoch;
+       int ret;
+       
+       memset (&tm, 0, sizeof (tm));
+
+       gtime = ASN1_TIME_to_generalizedtime (time, NULL);
+       ret = asn1_generalizedtime_to_tm (&tm, gtime);
+       ASN1_GENERALIZEDTIME_free (gtime);
+       epoch = btls_timegm64 (&tm);
+
+       return epoch;
+}
+
+// Copied from crypto/bio/printf.c, takes va_list
+int
+mono_btls_debug_printf (BIO *bio, const char *format, va_list args)
+{
+       char buf[256], *out, out_malloced = 0;
+       int out_len, ret;
+
+       out_len = vsnprintf (buf, sizeof(buf), format, args);
+       if (out_len < 0) {
+               return -1;
+       }
+
+       if ((size_t) out_len >= sizeof(buf)) {
+               const int requested_len = out_len;
+               /* The output was truncated. Note that vsnprintf's return value
+                * does not include a trailing NUL, but the buffer must be sized
+                * for it. */
+               out = OPENSSL_malloc (requested_len + 1);
+               out_malloced = 1;
+               if (out == NULL) {
+                       OPENSSL_PUT_ERROR(BIO, ERR_R_MALLOC_FAILURE);
+                       return -1;
+               }
+               out_len = vsnprintf (out, requested_len + 1, format, args);
+               assert(out_len == requested_len);
+       } else {
+               out = buf;
+       }
+
+       ret = BIO_write(bio, out, out_len);
+       if (out_malloced) {
+               OPENSSL_free(out);
+       }
+
+       return ret;
+}
diff --git a/mono/btls/btls-util.h b/mono/btls/btls-util.h
new file mode 100644 (file)
index 0000000..a1b1652
--- /dev/null
@@ -0,0 +1,45 @@
+//
+//  btls-util.h
+//  MonoBtls
+//
+//  Created by Martin Baulig on 3/23/16.
+//  Copyright © 2016 Xamarin. All rights reserved.
+//
+
+#ifndef __btls__btls_util__
+#define __btls__btls_util__
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <openssl/ssl.h>
+
+#ifndef MONO_API
+#if defined(_MSC_VER)
+
+#define MONO_API __declspec(dllexport)
+
+#else
+
+#ifdef __GNUC__
+#define MONO_API __attribute__ ((visibility ("default")))
+#else
+#define MONO_API
+#endif
+
+#endif
+#endif
+
+void
+mono_btls_free (void *data);
+
+int64_t
+mono_btls_util_asn1_time_to_ticks (ASN1_TIME *time);
+
+int
+mono_btls_debug_printf (BIO *bio, const char *format, va_list args);
+
+OPENSSL_EXPORT void CRYPTO_refcount_inc(CRYPTO_refcount_t *count);
+OPENSSL_EXPORT int CRYPTO_refcount_dec_and_test_zero(CRYPTO_refcount_t *count);
+
+#endif /* __btls__btls_util__ */
diff --git a/mono/btls/btls-x509-chain.c b/mono/btls/btls-x509-chain.c
new file mode 100644 (file)
index 0000000..5b7082d
--- /dev/null
@@ -0,0 +1,96 @@
+//
+//  btls-x509-chain.c
+//  MonoBtls
+//
+//  Created by Martin Baulig on 3/3/16.
+//  Copyright © 2016 Xamarin. All rights reserved.
+//
+
+#include <btls-x509-chain.h>
+
+struct MonoBtlsX509Chain {
+       STACK_OF(X509) *certs;
+       CRYPTO_refcount_t references;
+};
+
+MONO_API MonoBtlsX509Chain *
+mono_btls_x509_chain_new (void)
+{
+       MonoBtlsX509Chain *chain = (MonoBtlsX509Chain *)OPENSSL_malloc (sizeof (MonoBtlsX509Chain));
+       if (chain == NULL)
+               return NULL;
+
+       memset(chain, 0, sizeof(MonoBtlsX509Chain));
+       chain->certs = sk_X509_new_null ();
+       chain->references = 1;
+       return chain;
+}
+
+MONO_API MonoBtlsX509Chain *
+mono_btls_x509_chain_from_certs (STACK_OF(X509) *certs)
+{
+       MonoBtlsX509Chain *chain = (MonoBtlsX509Chain *)OPENSSL_malloc (sizeof (MonoBtlsX509Chain));
+       if (chain == NULL)
+               return NULL;
+
+       memset(chain, 0, sizeof(MonoBtlsX509Chain));
+       chain->certs = X509_chain_up_ref(certs);
+       chain->references = 1;
+       return chain;
+}
+
+MONO_API STACK_OF(X509) *
+mono_btls_x509_chain_peek_certs (MonoBtlsX509Chain *chain)
+{
+       return chain->certs;
+}
+
+MONO_API int
+mono_btls_x509_chain_get_count (MonoBtlsX509Chain *chain)
+{
+       return (int)sk_X509_num(chain->certs);
+}
+
+MONO_API X509 *
+mono_btls_x509_chain_get_cert (MonoBtlsX509Chain *chain, int index)
+{
+       X509 *cert;
+
+       if ((size_t)index >= sk_X509_num(chain->certs))
+               return NULL;
+       cert = sk_X509_value(chain->certs, index);
+       if (cert)
+               X509_up_ref(cert);
+       return cert;
+}
+
+MONO_API STACK_OF(X509) *
+mono_btls_x509_chain_get_certs (MonoBtlsX509Chain *chain)
+{
+       return chain->certs;
+}
+
+MONO_API int
+mono_btls_x509_chain_free (MonoBtlsX509Chain *chain)
+{
+       if (!CRYPTO_refcount_dec_and_test_zero(&chain->references))
+               return 0;
+
+       sk_X509_pop_free(chain->certs, X509_free);
+       OPENSSL_free (chain);
+       return 1;
+}
+
+MONO_API MonoBtlsX509Chain *
+mono_btls_x509_chain_up_ref (MonoBtlsX509Chain *chain)
+{
+       CRYPTO_refcount_inc(&chain->references);
+       return chain;
+}
+
+MONO_API void
+mono_btls_x509_chain_add_cert (MonoBtlsX509Chain *chain, X509 *x509)
+{
+       X509_up_ref(x509);
+       sk_X509_push(chain->certs, x509);
+}
diff --git a/mono/btls/btls-x509-chain.h b/mono/btls/btls-x509-chain.h
new file mode 100644 (file)
index 0000000..68ef577
--- /dev/null
@@ -0,0 +1,41 @@
+//
+//  btls-x509-chain.h
+//  MonoBtls
+//
+//  Created by Martin Baulig on 3/3/16.
+//  Copyright © 2016 Xamarin. All rights reserved.
+//
+
+#ifndef __btls__btls_x509_chain__
+#define __btls__btls_x509_chain__
+
+#include <stdio.h>
+#include <btls-ssl.h>
+#include <btls-x509.h>
+
+MonoBtlsX509Chain *
+mono_btls_x509_chain_new (void);
+
+MonoBtlsX509Chain *
+mono_btls_x509_chain_from_certs (STACK_OF(X509) *certs);
+
+STACK_OF(X509) *
+mono_btls_x509_chain_peek_certs (MonoBtlsX509Chain *chain);
+
+int
+mono_btls_x509_chain_get_count (MonoBtlsX509Chain *chain);
+
+X509 *
+mono_btls_x509_chain_get_cert (MonoBtlsX509Chain *chain, int index);
+
+MonoBtlsX509Chain *
+mono_btls_x509_chain_up_ref (MonoBtlsX509Chain *chain);
+
+int
+mono_btls_x509_chain_free (MonoBtlsX509Chain *chain);
+
+void
+mono_btls_x509_chain_add_cert (MonoBtlsX509Chain *chain, X509 *x509);
+
+#endif /* defined(__btls__btls_x509_chain__) */
+
diff --git a/mono/btls/btls-x509-crl.c b/mono/btls/btls-x509-crl.c
new file mode 100644 (file)
index 0000000..d496c07
--- /dev/null
@@ -0,0 +1,150 @@
+//
+//  btls-x509-crl.c
+//  MonoBtls
+//
+//  Created by Martin Baulig on 3/23/16.
+//  Copyright © 2016 Xamarin. All rights reserved.
+//
+
+#include <btls-x509-crl.h>
+#include <btls-x509-revoked.h>
+
+struct MonoBtlsX509Crl {
+       X509_CRL *crl;
+       CRYPTO_refcount_t references;
+};
+
+MONO_API MonoBtlsX509Crl *
+mono_btls_x509_crl_from_data (const void *buf, int len, MonoBtlsX509Format format)
+{
+       MonoBtlsX509Crl *crl;
+       BIO *bio;
+
+       crl = OPENSSL_malloc (sizeof (MonoBtlsX509Crl));
+       memset (crl, 0, sizeof(MonoBtlsX509Crl));
+       crl->references = 1;
+
+       bio = BIO_new_mem_buf ((void *)buf, len);
+       switch (format) {
+               case MONO_BTLS_X509_FORMAT_DER:
+                       crl->crl = d2i_X509_CRL_bio (bio, NULL);
+                       break;
+               case MONO_BTLS_X509_FORMAT_PEM:
+                       crl->crl = PEM_read_bio_X509_CRL (bio, NULL, NULL, NULL);
+                       break;
+       }
+       BIO_free (bio);
+
+       if (!crl->crl) {
+               OPENSSL_free (crl);
+               return NULL;
+       }
+
+       return crl;
+}
+
+MONO_API MonoBtlsX509Crl *
+mono_btls_x509_crl_ref (MonoBtlsX509Crl *crl)
+{
+       CRYPTO_refcount_inc (&crl->references);
+       return crl;
+}
+
+MONO_API int
+mono_btls_x509_crl_free (MonoBtlsX509Crl *crl)
+{
+       if (!CRYPTO_refcount_dec_and_test_zero (&crl->references))
+               return 0;
+
+       X509_CRL_free (crl->crl);
+       OPENSSL_free (crl);
+       return 1;
+}
+
+MONO_API MonoBtlsX509Revoked *
+mono_btls_x509_crl_get_by_cert (MonoBtlsX509Crl *crl, X509 *x509)
+{
+       X509_REVOKED *revoked;
+       int ret;
+
+       revoked = NULL;
+       ret = X509_CRL_get0_by_cert (crl->crl, &revoked, x509);
+       fprintf (stderr, "mono_btls_x509_crl_get_by_cert: %d - %p\n", ret, revoked);
+
+       if (!ret || !revoked)
+               return NULL;
+
+       return mono_btls_x509_revoked_new (crl, revoked);
+}
+
+MONO_API MonoBtlsX509Revoked *
+mono_btls_x509_crl_get_by_serial (MonoBtlsX509Crl *crl, void *serial, int len)
+{
+       ASN1_INTEGER si;
+       X509_REVOKED *revoked;
+       int ret;
+
+       si.type = V_ASN1_INTEGER;
+       si.length = len;
+       si.data = serial;
+
+       revoked = NULL;
+       ret = X509_CRL_get0_by_serial (crl->crl, &revoked, &si);
+       fprintf (stderr, "mono_btls_x509_crl_get_by_serial: %d - %p\n", ret, revoked);
+
+       if (!ret || !revoked)
+               return NULL;
+
+       return mono_btls_x509_revoked_new (crl, revoked);
+}
+
+MONO_API int
+mono_btls_x509_crl_get_revoked_count (MonoBtlsX509Crl *crl)
+{
+       STACK_OF(X509_REVOKED) *stack;
+
+       stack = X509_CRL_get_REVOKED (crl->crl);
+       return (int)sk_X509_REVOKED_num (stack);
+}
+
+MONO_API MonoBtlsX509Revoked *
+mono_btls_x509_crl_get_revoked (MonoBtlsX509Crl *crl, int index)
+{
+       STACK_OF(X509_REVOKED) *stack;
+       X509_REVOKED *revoked;
+
+       stack = X509_CRL_get_REVOKED (crl->crl);
+       if ((size_t)index >= sk_X509_REVOKED_num (stack))
+               return NULL;
+
+       revoked = sk_X509_REVOKED_value (stack, index);
+       if (!revoked)
+               return NULL;
+
+       return mono_btls_x509_revoked_new (crl, revoked);
+}
+
+MONO_API int64_t
+mono_btls_x509_crl_get_last_update (MonoBtlsX509Crl *crl)
+{
+       return mono_btls_util_asn1_time_to_ticks (X509_CRL_get_lastUpdate (crl->crl));
+}
+
+MONO_API int64_t
+mono_btls_x509_crl_get_next_update (MonoBtlsX509Crl *crl)
+{
+       return mono_btls_util_asn1_time_to_ticks (X509_CRL_get_nextUpdate (crl->crl));
+}
+
+MONO_API int64_t
+mono_btls_x509_crl_get_version (MonoBtlsX509Crl *crl)
+{
+       return X509_CRL_get_version (crl->crl);
+}
+
+MONO_API MonoBtlsX509Name *
+mono_btls_x509_crl_get_issuer (MonoBtlsX509Crl *crl)
+{
+       return mono_btls_x509_name_copy (X509_CRL_get_issuer (crl->crl));
+}
+
diff --git a/mono/btls/btls-x509-crl.h b/mono/btls/btls-x509-crl.h
new file mode 100644 (file)
index 0000000..625037d
--- /dev/null
@@ -0,0 +1,49 @@
+//
+//  btls-x509-crl.h
+//  MonoBtls
+//
+//  Created by Martin Baulig on 3/23/16.
+//  Copyright © 2016 Xamarin. All rights reserved.
+//
+
+#ifndef __btls__btls_x509_crl__
+#define __btls__btls_x509_crl__
+
+#include <stdio.h>
+#include <btls-ssl.h>
+#include <btls-x509.h>
+
+MonoBtlsX509Crl *
+mono_btls_x509_crl_from_data (const void *buf, int len, MonoBtlsX509Format format);
+
+MonoBtlsX509Crl *
+mono_btls_x509_crl_ref (MonoBtlsX509Crl *crl);
+
+int
+mono_btls_x509_crl_free (MonoBtlsX509Crl *crl);
+
+MonoBtlsX509Revoked *
+mono_btls_x509_crl_get_by_cert (MonoBtlsX509Crl *crl, X509 *x509);
+
+MonoBtlsX509Revoked *
+mono_btls_x509_crl_get_by_serial (MonoBtlsX509Crl *crl, void *serial, int len);
+
+int
+mono_btls_x509_crl_get_revoked_count (MonoBtlsX509Crl *crl);
+
+MonoBtlsX509Revoked *
+mono_btls_x509_crl_get_revoked (MonoBtlsX509Crl *crl, int index);
+
+int64_t
+mono_btls_x509_crl_get_last_update (MonoBtlsX509Crl *crl);
+
+int64_t
+mono_btls_x509_crl_get_next_update (MonoBtlsX509Crl *crl);
+
+int64_t
+mono_btls_x509_crl_get_version (MonoBtlsX509Crl *crl);
+
+MonoBtlsX509Name *
+mono_btls_x509_crl_get_issuer (MonoBtlsX509Crl *crl);
+
+#endif /* __btls__btls_x509_crl__ */
diff --git a/mono/btls/btls-x509-lookup-mono.c b/mono/btls/btls-x509-lookup-mono.c
new file mode 100644 (file)
index 0000000..6d9d69a
--- /dev/null
@@ -0,0 +1,228 @@
+//
+//  btls-x509-lookup-mono.c
+//  MonoBtls
+//
+//  Created by Martin Baulig on 3/6/16.
+//  Copyright © 2016 Xamarin. All rights reserved.
+//
+
+#include <btls-x509-lookup.h>
+#include <btls-x509-lookup-mono.h>
+#include <openssl/stack.h>
+
+// random high number
+#define MONO_BTLS_X509_L_MONO_ADD      36292
+
+typedef struct MonoLookupNode MonoLookupNode;
+struct MonoLookupNode {
+       MonoBtlsX509LookupMono *mono;
+       MonoLookupNode *next;
+};
+
+typedef struct {
+       MonoLookupNode *nodes;
+} MonoLookup;
+
+struct MonoBtlsX509LookupMono {
+       const void *instance;
+       MonoBtlsX509LookupMono_BySubject by_subject_func;
+       MonoLookup *lookup;
+};
+
+MONO_API MonoBtlsX509LookupMono *
+mono_btls_x509_lookup_mono_new (void)
+{
+       MonoBtlsX509LookupMono *mono;
+
+       mono = OPENSSL_malloc (sizeof (MonoBtlsX509LookupMono));
+       if (!mono)
+               return NULL;
+
+       memset (mono, 0, sizeof (MonoBtlsX509LookupMono));
+       return mono;
+}
+
+MONO_API void
+mono_btls_x509_lookup_mono_init (MonoBtlsX509LookupMono *mono, const void *instance,
+                                MonoBtlsX509LookupMono_BySubject by_subject_func)
+{
+       mono->instance = instance;
+       mono->by_subject_func = by_subject_func;
+}
+
+static int
+mono_lookup_install (MonoLookup *lookup, MonoBtlsX509LookupMono *mono)
+{
+       MonoLookupNode *node;
+
+       node = OPENSSL_malloc (sizeof (MonoLookupNode));
+       if (!node)
+               return 0;
+
+       memset (node, 0, sizeof (MonoLookupNode));
+       mono->lookup = lookup;
+       node->mono = mono;
+       node->next = lookup->nodes;
+       lookup->nodes = node;
+       return 1;
+}
+
+static int
+mono_lookup_uninstall (MonoBtlsX509LookupMono *mono)
+{
+       MonoLookupNode **ptr;
+
+       if (!mono->lookup)
+               return 0;
+
+       for (ptr = &mono->lookup->nodes; *ptr; ptr = &(*ptr)->next) {
+               if ((*ptr)->mono == mono) {
+                       *ptr = (*ptr)->next;
+                       return 1;
+               }
+       }
+
+       return 0;
+}
+
+MONO_API int
+mono_btls_x509_lookup_mono_free (MonoBtlsX509LookupMono *mono)
+{
+       mono->instance = NULL;
+       mono->by_subject_func = NULL;
+
+       if (mono->lookup) {
+               if (!mono_lookup_uninstall (mono))
+                       return 0;
+       }
+
+       mono->lookup = NULL;
+
+       OPENSSL_free (mono);
+       return 1;
+}
+
+static int
+mono_lookup_ctrl (X509_LOOKUP *ctx, int cmd, const char *argp, int64_t argl, char **ret)
+{
+       MonoLookup *lookup = (MonoLookup*)ctx->method_data;
+       MonoBtlsX509LookupMono *mono = (MonoBtlsX509LookupMono*)argp;
+
+       if (!lookup || cmd != MONO_BTLS_X509_L_MONO_ADD)
+               return 0;
+       if (!mono || mono->lookup)
+               return 0;
+
+       return mono_lookup_install (lookup, mono);
+}
+
+static int
+mono_lookup_new (X509_LOOKUP *ctx)
+{
+       MonoLookup *data;
+
+       data = OPENSSL_malloc (sizeof (MonoLookup));
+       if (!data)
+               return 0;
+
+       memset (data, 0, sizeof (MonoLookup));
+       ctx->method_data = (void *)data;
+       return 1;
+}
+
+static void
+mono_lookup_free (X509_LOOKUP *ctx)
+{
+       MonoLookup *lookup;
+       MonoLookupNode *ptr;
+
+       lookup = (MonoLookup *)ctx->method_data;
+       ctx->method_data = NULL;
+       if (!lookup)
+               return;
+
+       ptr = lookup->nodes;
+       lookup->nodes = NULL;
+
+       while (ptr) {
+               MonoLookupNode *node = ptr;
+               ptr = ptr->next;
+
+               if (node->mono)
+                       node->mono->lookup = NULL;
+               node->mono = NULL;
+               node->next = NULL;
+               OPENSSL_free (node);
+       }
+
+       OPENSSL_free (lookup);
+}
+
+static int
+mono_lookup_get_by_subject (X509_LOOKUP *ctx, int type, X509_NAME *name, X509_OBJECT *obj_ret)
+{
+       MonoLookup *lookup;
+       MonoBtlsX509Name *name_obj;
+       MonoLookupNode *node;
+       X509 *x509 = NULL;
+       int ret = 0;
+
+       lookup = (MonoLookup *)ctx->method_data;
+
+       if (!lookup || !lookup->nodes)
+               return 0;
+       if (type != X509_LU_X509)
+               return 0;
+
+       name_obj = mono_btls_x509_name_from_name (name);
+       x509 = NULL;
+
+       for (node = lookup->nodes; node; node = node->next) {
+               if (!node->mono || !node->mono->by_subject_func)
+                       continue;
+               ret = (* node->mono->by_subject_func) (node->mono->instance, name_obj, &x509);
+               if (ret)
+                       break;
+       }
+
+       mono_btls_x509_name_free (name_obj);
+
+       if (!ret) {
+               if (x509)
+                       X509_free(x509);
+               return 0;
+       }
+
+       obj_ret->type = X509_LU_X509;
+       obj_ret->data.x509 = x509;
+       return 1;
+}
+
+static X509_LOOKUP_METHOD mono_lookup_method = {
+       "Mono lookup method",
+       mono_lookup_new,                /* new */
+       mono_lookup_free,               /* free */
+       NULL,                           /* init */
+       NULL,                           /* shutdown */
+       mono_lookup_ctrl,               /* ctrl */
+       mono_lookup_get_by_subject,     /* get_by_subject */
+       NULL,                           /* get_by_issuer_serial */
+       NULL,                           /* get_by_fingerprint */
+       NULL,                           /* get_by_alias */
+};
+
+MONO_API X509_LOOKUP_METHOD *
+mono_btls_x509_lookup_mono_method (void)
+{
+       return &mono_lookup_method;
+}
+
+MONO_API int
+mono_btls_x509_lookup_add_mono (MonoBtlsX509Lookup *lookup, MonoBtlsX509LookupMono *mono)
+{
+       if (mono_btls_x509_lookup_get_type (lookup) != MONO_BTLS_X509_LOOKUP_TYPE_MONO)
+               return 0;
+       return X509_LOOKUP_ctrl (mono_btls_x509_lookup_peek_lookup (lookup),
+                                MONO_BTLS_X509_L_MONO_ADD,
+                                (void*)mono, 0, NULL);
+}
diff --git a/mono/btls/btls-x509-lookup-mono.h b/mono/btls/btls-x509-lookup-mono.h
new file mode 100644 (file)
index 0000000..06df552
--- /dev/null
@@ -0,0 +1,36 @@
+//
+//  btls-x509-lookup-mono.h
+//  MonoBtls
+//
+//  Created by Martin Baulig on 3/3/16.
+//  Copyright © 2016 Xamarin. All rights reserved.
+//
+
+#ifndef __btls__btls_x509_lookup_mono__
+#define __btls__btls_x509_lookup_mono__
+
+#include <stdio.h>
+#include <btls-ssl.h>
+#include <btls-x509.h>
+#include <btls-x509-store.h>
+
+typedef int (* MonoBtlsX509LookupMono_BySubject) (const void *instance, MonoBtlsX509Name *name, X509 **ret);
+
+MonoBtlsX509LookupMono *
+mono_btls_x509_lookup_mono_new (void);
+
+int
+mono_btls_x509_lookup_mono_free (MonoBtlsX509LookupMono *mono);
+
+void
+mono_btls_x509_lookup_mono_init (MonoBtlsX509LookupMono *mono, const void *instance,
+                                MonoBtlsX509LookupMono_BySubject by_subject_func);
+
+int
+mono_btls_x509_lookup_add_mono (MonoBtlsX509Lookup *lookup, MonoBtlsX509LookupMono *mono);
+
+X509_LOOKUP_METHOD *
+mono_btls_x509_lookup_mono_method (void);
+
+#endif /* defined(__btls__btls_x509_lookup_mono__) */
+
diff --git a/mono/btls/btls-x509-lookup.c b/mono/btls/btls-x509-lookup.c
new file mode 100644 (file)
index 0000000..567d19c
--- /dev/null
@@ -0,0 +1,160 @@
+//
+//  btls-x509-lookup.c
+//  MonoBtls
+//
+//  Created by Martin Baulig on 3/6/16.
+//  Copyright © 2016 Xamarin. All rights reserved.
+//
+
+#include <btls-x509-lookup.h>
+#include <btls-x509-lookup-mono.h>
+
+struct MonoBtlsX509Lookup {
+       MonoBtlsX509LookupType type;
+       X509_LOOKUP *lookup;
+       int owns_lookup;
+       MonoBtlsX509Store *store;
+       CRYPTO_refcount_t references;
+};
+
+static X509_LOOKUP_METHOD *
+get_lookup_method (MonoBtlsX509LookupType type)
+{
+       switch (type) {
+       case MONO_BTLS_X509_LOOKUP_TYPE_FILE:
+               return X509_LOOKUP_file ();
+       case MONO_BTLS_X509_LOOKUP_TYPE_HASH_DIR:
+               return X509_LOOKUP_hash_dir ();
+       case MONO_BTLS_X509_LOOKUP_TYPE_MONO:
+               return mono_btls_x509_lookup_mono_method ();
+       default:
+               return NULL;
+       }
+}
+
+MONO_API MonoBtlsX509Lookup *
+mono_btls_x509_lookup_new (MonoBtlsX509Store *store, MonoBtlsX509LookupType type)
+{
+       MonoBtlsX509Lookup *lookup;
+       X509_LOOKUP *store_lookup;
+       X509_LOOKUP_METHOD *method;
+
+       method = get_lookup_method (type);
+       if (!method)
+               return NULL;
+
+       lookup = OPENSSL_malloc (sizeof(MonoBtlsX509Lookup));
+       if (!lookup)
+               return NULL;
+
+       store_lookup = X509_STORE_add_lookup (mono_btls_x509_store_peek_store (store), method);
+       if (!store_lookup)
+               return NULL;
+
+       memset (lookup, 0, sizeof(MonoBtlsX509Lookup));
+       // The X509_STORE owns the X509_LOOKUP.
+       lookup->store = mono_btls_x509_store_up_ref (store);
+       lookup->lookup = store_lookup;
+       lookup->owns_lookup = 0;
+       lookup->references = 1;
+       lookup->type = type;
+       return lookup;
+}
+
+MONO_API int
+mono_btls_x509_lookup_load_file (MonoBtlsX509Lookup *lookup, const char *file, MonoBtlsX509FileType type)
+{
+       return X509_LOOKUP_load_file (lookup->lookup, file, type);
+}
+
+MONO_API int
+mono_btls_x509_lookup_add_dir (MonoBtlsX509Lookup *lookup, const char *dir, MonoBtlsX509FileType type)
+{
+       return X509_LOOKUP_add_dir (lookup->lookup, dir, type);
+}
+
+MONO_API MonoBtlsX509Lookup *
+mono_btls_x509_lookup_up_ref (MonoBtlsX509Lookup *lookup)
+{
+       CRYPTO_refcount_inc (&lookup->references);
+       return lookup;
+}
+
+MONO_API int
+mono_btls_x509_lookup_free (MonoBtlsX509Lookup *lookup)
+{
+       if (!CRYPTO_refcount_dec_and_test_zero (&lookup->references))
+               return 0;
+
+       if (lookup->store) {
+               mono_btls_x509_store_free (lookup->store);
+               lookup->store = NULL;
+       }
+
+       if (lookup->lookup) {
+               if (lookup->owns_lookup)
+                       X509_LOOKUP_free (lookup->lookup);
+               lookup->lookup = NULL;
+       }
+
+       OPENSSL_free (lookup);
+       return 1;
+}
+
+MONO_API int
+mono_btls_x509_lookup_init (MonoBtlsX509Lookup *lookup)
+{
+       return X509_LOOKUP_init (lookup->lookup);
+}
+
+MONO_API int
+mono_btls_x509_lookup_shutdown (MonoBtlsX509Lookup *lookup)
+{
+       return X509_LOOKUP_shutdown (lookup->lookup);
+}
+
+MONO_API MonoBtlsX509LookupType
+mono_btls_x509_lookup_get_type (MonoBtlsX509Lookup *lookup)
+{
+       return lookup->type;
+}
+
+MONO_API X509_LOOKUP *
+mono_btls_x509_lookup_peek_lookup (MonoBtlsX509Lookup *lookup)
+{
+       return lookup->lookup;
+}
+
+MONO_API X509 *
+mono_btls_x509_lookup_by_subject (MonoBtlsX509Lookup *lookup, MonoBtlsX509Name *name)
+{
+       X509_OBJECT obj;
+       X509 *x509;
+       int ret;
+
+       ret = X509_LOOKUP_by_subject (lookup->lookup, X509_LU_X509, mono_btls_x509_name_peek_name (name), &obj);
+       if (ret != X509_LU_X509) {
+               X509_OBJECT_free_contents (&obj);
+               return NULL;
+       }
+
+       x509 = X509_up_ref (obj.data.x509);
+       return x509;
+}
+
+MONO_API X509 *
+mono_btls_x509_lookup_by_fingerprint (MonoBtlsX509Lookup *lookup, unsigned char *bytes, int len)
+{
+       X509_OBJECT obj;
+       X509 *x509;
+       int ret;
+
+       ret = X509_LOOKUP_by_fingerprint (lookup->lookup, X509_LU_X509, bytes, len, &obj);
+       if (ret != X509_LU_X509) {
+               X509_OBJECT_free_contents (&obj);
+               return NULL;
+       }
+
+       x509 = X509_up_ref (obj.data.x509);
+       return x509;
+}
diff --git a/mono/btls/btls-x509-lookup.h b/mono/btls/btls-x509-lookup.h
new file mode 100644 (file)
index 0000000..df3d37f
--- /dev/null
@@ -0,0 +1,58 @@
+//
+//  btls-x509-lookup.h
+//  MonoBtls
+//
+//  Created by Martin Baulig on 3/3/16.
+//  Copyright © 2016 Xamarin. All rights reserved.
+//
+
+#ifndef __btls__btls_x509_lookup__
+#define __btls__btls_x509_lookup__
+
+#include <stdio.h>
+#include <btls-ssl.h>
+#include <btls-x509.h>
+#include <btls-x509-store.h>
+
+typedef enum {
+       MONO_BTLS_X509_LOOKUP_TYPE_UNKNOWN = 0,
+       MONO_BTLS_X509_LOOKUP_TYPE_FILE,
+       MONO_BTLS_X509_LOOKUP_TYPE_HASH_DIR,
+       MONO_BTLS_X509_LOOKUP_TYPE_MONO
+} MonoBtlsX509LookupType;
+
+MonoBtlsX509Lookup *
+mono_btls_x509_lookup_new (MonoBtlsX509Store *store, MonoBtlsX509LookupType type);
+
+int
+mono_btls_x509_lookup_load_file (MonoBtlsX509Lookup *lookup, const char *file, MonoBtlsX509FileType type);
+
+int
+mono_btls_x509_lookup_add_dir (MonoBtlsX509Lookup *lookup, const char *dir, MonoBtlsX509FileType type);
+
+MonoBtlsX509Lookup *
+mono_btls_x509_lookup_up_ref (MonoBtlsX509Lookup *lookup);
+
+int
+mono_btls_x509_lookup_free (MonoBtlsX509Lookup *lookup);
+
+int
+mono_btls_x509_lookup_init (MonoBtlsX509Lookup *lookup);
+
+MonoBtlsX509LookupType
+mono_btls_x509_lookup_get_type (MonoBtlsX509Lookup *lookup);
+
+X509_LOOKUP *
+mono_btls_x509_lookup_peek_lookup (MonoBtlsX509Lookup *lookup);
+
+int
+mono_btls_x509_lookup_shutdown (MonoBtlsX509Lookup *lookup);
+
+X509 *
+mono_btls_x509_lookup_by_subject (MonoBtlsX509Lookup *lookup, MonoBtlsX509Name *name);
+
+X509 *
+mono_btls_x509_lookup_by_fingerprint (MonoBtlsX509Lookup *lookup, unsigned char *bytes, int len);
+
+#endif /* defined(__btls__btls_x509_lookup__) */
+
diff --git a/mono/btls/btls-x509-name.c b/mono/btls/btls-x509-name.c
new file mode 100644 (file)
index 0000000..7f98758
--- /dev/null
@@ -0,0 +1,296 @@
+//
+//  btls-x509-name.c
+//  MonoBtls
+//
+//  Created by Martin Baulig on 3/5/16.
+//  Copyright © 2016 Xamarin. All rights reserved.
+//
+
+#include <btls-x509-name.h>
+
+struct MonoBtlsX509Name {
+       int owns;
+       X509_NAME *name;
+};
+
+MONO_API MonoBtlsX509Name *
+mono_btls_x509_name_from_name (X509_NAME *xn)
+{
+       MonoBtlsX509Name *name;
+
+       name = OPENSSL_malloc (sizeof (MonoBtlsX509Name));
+       if (!name)
+               return NULL;
+
+       memset(name, 0, sizeof(MonoBtlsX509Name));
+       name->name = xn;
+       return name;
+}
+
+MONO_API MonoBtlsX509Name *
+mono_btls_x509_name_copy (X509_NAME *xn)
+{
+       MonoBtlsX509Name *name;
+
+       name = OPENSSL_malloc (sizeof (MonoBtlsX509Name));
+       if (!name)
+               return NULL;
+
+       memset(name, 0, sizeof(MonoBtlsX509Name));
+       name->name = X509_NAME_dup(xn);
+       name->owns = 1;
+       return name;
+}
+
+MONO_API void
+mono_btls_x509_name_free (MonoBtlsX509Name *name)
+{
+       if (name->owns) {
+               if (name->name) {
+                       X509_NAME_free(name->name);
+                       name->name = NULL;
+               }
+       }
+       OPENSSL_free(name);
+}
+
+MONO_API X509_NAME *
+mono_btls_x509_name_peek_name (MonoBtlsX509Name *name)
+{
+       return name->name;
+}
+
+MONO_API int
+mono_btls_x509_name_print_bio (MonoBtlsX509Name *name, BIO *bio)
+{
+       return X509_NAME_print_ex (bio, name->name, 0, ASN1_STRFLGS_RFC2253 | XN_FLAG_FN_SN | XN_FLAG_SEP_CPLUS_SPC | XN_FLAG_DN_REV);
+}
+
+MONO_API int
+mono_btls_x509_name_get_raw_data (MonoBtlsX509Name *name, void **buffer, int use_canon_enc)
+{
+       int len;
+       void *ptr;
+
+       if (use_canon_enc) {
+               // make sure canon_enc is initialized.
+               i2d_X509_NAME (name->name, NULL);
+
+               len = name->name->canon_enclen;
+               ptr = name->name->canon_enc;
+       } else {
+               len = (int)name->name->bytes->length;
+               ptr = name->name->bytes->data;
+       }
+
+       *buffer = OPENSSL_malloc (len);
+       if (!*buffer)
+               return 0;
+
+       memcpy (*buffer, ptr, len);
+       return len;
+}
+
+MONO_API MonoBtlsX509Name *
+mono_btls_x509_name_from_data (const void *data, int len, int use_canon_enc)
+{
+       MonoBtlsX509Name *name;
+       uint8_t *buf;
+       const unsigned char *ptr;
+       X509_NAME *ret;
+
+       name = OPENSSL_malloc (sizeof (MonoBtlsX509Name));
+       if (!name)
+               return NULL;
+
+       memset (name, 0, sizeof(MonoBtlsX509Name));
+       name->owns = 1;
+
+       name->name = X509_NAME_new ();
+       if (!name->name) {
+               OPENSSL_free (name);
+               return NULL;
+       }
+
+       if (use_canon_enc) {
+               CBB cbb, contents;
+               size_t buf_len;
+
+               // re-add ASN1 SEQUENCE header.
+               CBB_init(&cbb, 0);
+               if (!CBB_add_asn1(&cbb, &contents, 0x30) ||
+                   !CBB_add_bytes(&contents, data, len) ||
+                   !CBB_finish(&cbb, &buf, &buf_len)) {
+                       CBB_cleanup (&cbb);
+                       mono_btls_x509_name_free (name);
+                       return NULL;
+               }
+
+               ptr = buf;
+               len = (int)buf_len;
+       } else {
+               ptr = data;
+               buf = NULL;
+       }
+
+       ret = d2i_X509_NAME (&name->name, &ptr, len);
+
+       if (buf)
+               OPENSSL_free (buf);
+
+       if (ret != name->name) {
+               mono_btls_x509_name_free (name);
+               return NULL;
+       }
+
+       return name;
+}
+
+MONO_API int
+mono_btls_x509_name_print_string (MonoBtlsX509Name *name, char *buffer, int size)
+{
+       *buffer = 0;
+       return X509_NAME_oneline (name->name, buffer, size) != NULL;
+}
+
+MONO_API int64_t
+mono_btls_x509_name_hash (MonoBtlsX509Name *name)
+{
+       return X509_NAME_hash (name->name);
+}
+
+MONO_API int64_t
+mono_btls_x509_name_hash_old (MonoBtlsX509Name *name)
+{
+       return X509_NAME_hash_old (name->name);
+}
+
+MONO_API int
+mono_btls_x509_name_get_entry_count (MonoBtlsX509Name *name)
+{
+       return X509_NAME_entry_count (name->name);
+}
+
+static MonoBtlsX509NameEntryType
+nid2mono (int nid)
+{
+       switch (nid) {
+       case NID_countryName:
+               return MONO_BTLS_X509_NAME_ENTRY_TYPE_COUNTRY_NAME;
+       case NID_organizationName:
+               return MONO_BTLS_X509_NAME_ENTRY_TYPE_ORGANIZATION_NAME;
+       case NID_organizationalUnitName:
+               return MONO_BTLS_X509_NAME_ENTRY_TYPE_ORGANIZATIONAL_UNIT_NAME;
+       case NID_commonName:
+               return MONO_BTLS_X509_NAME_ENTRY_TYPE_COMMON_NAME;
+       case NID_localityName:
+               return MONO_BTLS_X509_NAME_ENTRY_TYPE_LOCALITY_NAME;
+       case NID_stateOrProvinceName:
+               return MONO_BTLS_X509_NAME_ENTRY_TYPE_STATE_OR_PROVINCE_NAME;
+       case NID_streetAddress:
+               return MONO_BTLS_X509_NAME_ENTRY_TYPE_STREET_ADDRESS;
+       case NID_serialNumber:
+               return MONO_BTLS_X509_NAME_ENTRY_TYPE_SERIAL_NUMBER;
+       case NID_domainComponent:
+               return MONO_BTLS_X509_NAME_ENTRY_TYPE_DOMAIN_COMPONENT;
+       case NID_userId:
+               return MONO_BTLS_X509_NAME_ENTRY_TYPE_USER_ID;
+       case NID_dnQualifier:
+               return MONO_BTLS_X509_NAME_ENTRY_TYPE_DN_QUALIFIER;
+       case NID_title:
+               return MONO_BTLS_X509_NAME_ENTRY_TYPE_TITLE;
+       case NID_surname:
+               return MONO_BTLS_X509_NAME_ENTRY_TYPE_SURNAME;
+       case NID_givenName:
+               return MONO_BTLS_X509_NAME_ENTRY_TYPE_GIVEN_NAME;
+       case NID_initials:
+               return MONO_BTLS_X509_NAME_ENTRY_TYPE_INITIAL;
+       default:
+               return MONO_BTLS_X509_NAME_ENTRY_TYPE_UNKNOWN;
+       }
+}
+
+MONO_API MonoBtlsX509NameEntryType
+mono_btls_x509_name_get_entry_type (MonoBtlsX509Name *name, int index)
+{
+       X509_NAME_ENTRY *entry;
+       ASN1_OBJECT *obj;
+
+       if (index >= X509_NAME_entry_count (name->name))
+               return -1;
+
+       entry = X509_NAME_get_entry (name->name, index);
+       if (!entry)
+               return -1;
+
+       obj = X509_NAME_ENTRY_get_object (entry);
+       if (!obj)
+               return -1;
+
+       return nid2mono (OBJ_obj2nid (obj));
+}
+
+MONO_API int
+mono_btls_x509_name_get_entry_oid (MonoBtlsX509Name *name, int index, char *buffer, int size)
+{
+       X509_NAME_ENTRY *entry;
+       ASN1_OBJECT *obj;
+
+       if (index >= X509_NAME_entry_count (name->name))
+               return 0;
+
+       entry = X509_NAME_get_entry (name->name, index);
+       if (!entry)
+               return 0;
+
+       obj = X509_NAME_ENTRY_get_object (entry);
+       if (!obj)
+               return 0;
+
+       return OBJ_obj2txt (buffer, size, obj, 1);
+}
+
+MONO_API int
+mono_btls_x509_name_get_entry_oid_data (MonoBtlsX509Name *name, int index, const void **data)
+{
+       X509_NAME_ENTRY *entry;
+       ASN1_OBJECT *obj;
+
+       if (index >= X509_NAME_entry_count (name->name))
+               return -1;
+
+       entry = X509_NAME_get_entry (name->name, index);
+       if (!entry)
+               return -1;
+
+       obj = X509_NAME_ENTRY_get_object (entry);
+       if (!obj)
+               return -1;
+
+       *data = obj->data;
+       return obj->length;
+}
+
+MONO_API int
+mono_btls_x509_name_get_entry_value (MonoBtlsX509Name *name, int index, int *tag, unsigned char **str)
+{
+       X509_NAME_ENTRY *entry;
+       ASN1_STRING *data;
+
+       *str = NULL;
+       *tag = 0;
+
+       if (index >= X509_NAME_entry_count (name->name))
+               return 0;
+
+       entry = X509_NAME_get_entry (name->name, index);
+       if (!entry)
+               return 0;
+
+       data = X509_NAME_ENTRY_get_data (entry);
+       if (!data)
+               return 0;
+
+       *tag = data->type;
+       return ASN1_STRING_to_UTF8 (str, data);
+}
diff --git a/mono/btls/btls-x509-name.h b/mono/btls/btls-x509-name.h
new file mode 100644 (file)
index 0000000..9d43bc6
--- /dev/null
@@ -0,0 +1,80 @@
+//
+//  btls-x509-name.h
+//  MonoBtls
+//
+//  Created by Martin Baulig on 3/5/16.
+//  Copyright © 2016 Xamarin. All rights reserved.
+//
+
+#ifndef __btls__btls_x509_name__
+#define __btls__btls_x509_name__
+
+#include <stdio.h>
+#include <btls-ssl.h>
+
+typedef enum {
+       MONO_BTLS_X509_NAME_ENTRY_TYPE_UNKNOWN = 0,
+       MONO_BTLS_X509_NAME_ENTRY_TYPE_COUNTRY_NAME,
+       MONO_BTLS_X509_NAME_ENTRY_TYPE_ORGANIZATION_NAME,
+       MONO_BTLS_X509_NAME_ENTRY_TYPE_ORGANIZATIONAL_UNIT_NAME,
+       MONO_BTLS_X509_NAME_ENTRY_TYPE_COMMON_NAME,
+       MONO_BTLS_X509_NAME_ENTRY_TYPE_LOCALITY_NAME,
+       MONO_BTLS_X509_NAME_ENTRY_TYPE_STATE_OR_PROVINCE_NAME,
+       MONO_BTLS_X509_NAME_ENTRY_TYPE_STREET_ADDRESS,
+       MONO_BTLS_X509_NAME_ENTRY_TYPE_SERIAL_NUMBER,
+       MONO_BTLS_X509_NAME_ENTRY_TYPE_DOMAIN_COMPONENT,
+       MONO_BTLS_X509_NAME_ENTRY_TYPE_USER_ID,
+       MONO_BTLS_X509_NAME_ENTRY_TYPE_EMAIL,
+       MONO_BTLS_X509_NAME_ENTRY_TYPE_DN_QUALIFIER,
+       MONO_BTLS_X509_NAME_ENTRY_TYPE_TITLE,
+       MONO_BTLS_X509_NAME_ENTRY_TYPE_SURNAME,
+       MONO_BTLS_X509_NAME_ENTRY_TYPE_GIVEN_NAME,
+       MONO_BTLS_X509_NAME_ENTRY_TYPE_INITIAL
+} MonoBtlsX509NameEntryType;
+
+MonoBtlsX509Name *
+mono_btls_x509_name_from_name (X509_NAME *name);
+
+MonoBtlsX509Name *
+mono_btls_x509_name_copy (X509_NAME *xn);
+
+void
+mono_btls_x509_name_free (MonoBtlsX509Name *name);
+
+X509_NAME *
+mono_btls_x509_name_peek_name (MonoBtlsX509Name *name);
+
+MonoBtlsX509Name *
+mono_btls_x509_name_from_data (const void *data, int len, int use_canon_enc);
+
+int
+mono_btls_x509_name_print_bio (MonoBtlsX509Name *name, BIO *bio);
+
+int
+mono_btls_x509_name_print_string (MonoBtlsX509Name *name, char *buffer, int size);
+
+int
+mono_btls_x509_name_get_raw_data (MonoBtlsX509Name *name, void **buffer, int use_canon_enc);
+
+int64_t
+mono_btls_x509_name_hash (MonoBtlsX509Name *name);
+
+int64_t
+mono_btls_x509_name_hash_old (MonoBtlsX509Name *name);
+
+int
+mono_btls_x509_name_get_entry_count (MonoBtlsX509Name *name);
+
+MonoBtlsX509NameEntryType
+mono_btls_x509_name_get_entry_type (MonoBtlsX509Name *name, int index);
+
+int
+mono_btls_x509_name_get_entry_oid (MonoBtlsX509Name *name, int index, char *buffer, int size);
+
+int
+mono_btls_x509_name_get_entry_oid_data (MonoBtlsX509Name *name, int index, const void **data);
+
+int
+mono_btls_x509_name_get_entry_value (MonoBtlsX509Name *name, int index, int *tag, unsigned char **str);
+
+#endif /* __btls__btls_x509_name__ */
diff --git a/mono/btls/btls-x509-revoked.c b/mono/btls/btls-x509-revoked.c
new file mode 100644 (file)
index 0000000..bf9af79
--- /dev/null
@@ -0,0 +1,72 @@
+//
+//  btls-x509-revoked.c
+//  MonoBtls
+//
+//  Created by Martin Baulig on 3/23/16.
+//  Copyright © 2016 Xamarin. All rights reserved.
+//
+
+#include <btls-x509-revoked.h>
+
+struct MonoBtlsX509Revoked {
+       MonoBtlsX509Crl *owner;
+       X509_REVOKED *revoked;
+};
+
+MONO_API MonoBtlsX509Revoked *
+mono_btls_x509_revoked_new (MonoBtlsX509Crl *owner, X509_REVOKED *revoked)
+{
+       MonoBtlsX509Revoked *instance;
+
+       instance = OPENSSL_malloc (sizeof (MonoBtlsX509Revoked));
+       memset (instance, 0, sizeof (MonoBtlsX509Revoked));
+
+       instance->owner = mono_btls_x509_crl_ref (owner);
+       instance->revoked = revoked;
+       return instance;
+}
+
+MONO_API void
+mono_btls_x509_revoked_free (MonoBtlsX509Revoked *revoked)
+{
+       mono_btls_x509_crl_free (revoked->owner);
+       OPENSSL_free (revoked);
+}
+
+MONO_API int
+mono_btls_x509_revoked_get_serial_number (MonoBtlsX509Revoked *revoked, char *buffer, int size)
+{
+       ASN1_INTEGER *serial;
+
+       serial = revoked->revoked->serialNumber;
+       if (serial->length == 0 || serial->length+1 > size)
+               return 0;
+
+       memcpy (buffer, serial->data, serial->length);
+       return serial->length;
+}
+
+MONO_API int64_t
+mono_btls_x509_revoked_get_revocation_date (MonoBtlsX509Revoked *revoked)
+{
+       ASN1_TIME *date;
+
+       date = revoked->revoked->revocationDate;
+       if (!date)
+               return 0;
+
+       return mono_btls_util_asn1_time_to_ticks (date);
+}
+
+MONO_API int
+mono_btls_x509_revoked_get_reason (MonoBtlsX509Revoked *revoked)
+{
+       return revoked->revoked->reason;
+}
+
+MONO_API int
+mono_btls_x509_revoked_get_sequence (MonoBtlsX509Revoked *revoked)
+{
+       return revoked->revoked->sequence;
+}
+
diff --git a/mono/btls/btls-x509-revoked.h b/mono/btls/btls-x509-revoked.h
new file mode 100644 (file)
index 0000000..592fc93
--- /dev/null
@@ -0,0 +1,34 @@
+//
+//  btls-x509-revoked.h
+//  MonoBtls
+//
+//  Created by Martin Baulig on 3/23/16.
+//  Copyright © 2016 Xamarin. All rights reserved.
+//
+
+#ifndef __btls__btls_x509_revoked__
+#define __btls__btls_x509_revoked__
+
+#include <stdio.h>
+#include <btls-ssl.h>
+#include <btls-x509-crl.h>
+
+MonoBtlsX509Revoked *
+mono_btls_x509_revoked_new (MonoBtlsX509Crl *owner, X509_REVOKED *revoked);
+
+void
+mono_btls_x509_revoked_free (MonoBtlsX509Revoked *revoked);
+
+int
+mono_btls_x509_revoked_get_serial_number (MonoBtlsX509Revoked *revoked, char *buffer, int size);
+
+int64_t
+mono_btls_x509_revoked_get_revocation_date (MonoBtlsX509Revoked *revoked);
+
+int
+mono_btls_x509_revoked_get_reason (MonoBtlsX509Revoked *revoked);
+
+int
+mono_btls_x509_revoked_get_sequence (MonoBtlsX509Revoked *revoked);
+
+#endif /* __btls__btls_x509_revoked__ */
diff --git a/mono/btls/btls-x509-store-ctx.c b/mono/btls/btls-x509-store-ctx.c
new file mode 100644 (file)
index 0000000..8bbb732
--- /dev/null
@@ -0,0 +1,217 @@
+//
+//  btls-x509-store-ctx.c
+//  MonoBtls
+//
+//  Created by Martin Baulig on 3/5/16.
+//  Copyright © 2016 Xamarin. All rights reserved.
+//
+
+#include <btls-x509-store-ctx.h>
+
+struct MonoBtlsX509StoreCtx {
+       int owns;
+       X509_STORE_CTX *ctx;
+       CRYPTO_refcount_t references;
+       MonoBtlsX509Store *store;
+       MonoBtlsX509Chain *chain;
+};
+
+MONO_API MonoBtlsX509StoreCtx *
+mono_btls_x509_store_ctx_from_ptr (X509_STORE_CTX *ptr)
+{
+       MonoBtlsX509StoreCtx *ctx;
+
+       ctx = OPENSSL_malloc (sizeof(MonoBtlsX509StoreCtx));
+       if (!ctx)
+               return NULL;
+
+       memset (ctx, 0, sizeof (MonoBtlsX509StoreCtx));
+       ctx->ctx = ptr;
+       ctx->references = 1;
+       return ctx;
+}
+
+MONO_API MonoBtlsX509StoreCtx *
+mono_btls_x509_store_ctx_new (void)
+{
+       MonoBtlsX509StoreCtx *ctx;
+
+       ctx = OPENSSL_malloc (sizeof(MonoBtlsX509StoreCtx));
+       if (!ctx)
+               return NULL;
+
+       memset (ctx, 0, sizeof (MonoBtlsX509StoreCtx));
+       ctx->ctx = X509_STORE_CTX_new ();
+       ctx->references = 1;
+       ctx->owns = 1;
+       return ctx;
+}
+
+MONO_API MonoBtlsX509StoreCtx *
+mono_btls_x509_store_ctx_up_ref (MonoBtlsX509StoreCtx *ctx)
+{
+       CRYPTO_refcount_inc (&ctx->references);
+       return ctx;
+}
+
+MONO_API int
+mono_btls_x509_store_ctx_free (MonoBtlsX509StoreCtx *ctx)
+{
+       if (!CRYPTO_refcount_dec_and_test_zero (&ctx->references))
+               return 0;
+
+       if (ctx->owns) {
+               X509_STORE_CTX_cleanup (ctx->ctx);
+               X509_STORE_CTX_free (ctx->ctx);
+               ctx->owns = 0;
+       }
+       if (ctx->store) {
+               mono_btls_x509_store_free (ctx->store);
+               ctx->store = NULL;
+       }
+       if (ctx->chain) {
+               mono_btls_x509_chain_free (ctx->chain);
+               ctx->chain = NULL;
+       }
+       OPENSSL_free (ctx);
+       return 1;
+}
+
+MONO_API int
+mono_btls_x509_store_ctx_get_error (MonoBtlsX509StoreCtx *ctx, const char **error_string)
+{
+       int error;
+
+       error = X509_STORE_CTX_get_error (ctx->ctx);
+       if (error_string)
+               *error_string = X509_verify_cert_error_string (error);
+       return error;
+}
+
+MONO_API int
+mono_btls_x509_store_ctx_get_error_depth (MonoBtlsX509StoreCtx *ctx)
+{
+       return X509_STORE_CTX_get_error_depth (ctx->ctx);
+}
+
+MONO_API MonoBtlsX509Chain *
+mono_btls_x509_store_ctx_get_chain (MonoBtlsX509StoreCtx *ctx)
+{
+       STACK_OF(X509) *certs;
+
+       certs = X509_STORE_CTX_get_chain (ctx->ctx);
+       if (!certs)
+               return NULL;
+
+       return mono_btls_x509_chain_from_certs (certs);
+}
+
+MONO_API MonoBtlsX509Chain *
+mono_btls_x509_store_ctx_get_untrusted (MonoBtlsX509StoreCtx *ctx)
+{
+       STACK_OF(X509) *untrusted;
+
+       /*
+        * Unfortunately, there is no accessor function for this.
+        *
+        * This is the set of certificate that's passed in by
+        * X509_STORE_CTX_init() and X509_STORE_CTX_set_chain().
+        */
+       untrusted = ctx->ctx->untrusted;
+       if (!untrusted)
+               return NULL;
+
+       return mono_btls_x509_chain_from_certs (untrusted);
+}
+
+MONO_API int
+mono_btls_x509_store_ctx_init (MonoBtlsX509StoreCtx *ctx,
+                                  MonoBtlsX509Store *store, MonoBtlsX509Chain *chain)
+{
+       STACK_OF(X509) *certs;
+       X509 *leaf;
+       int ret;
+
+       if (ctx->store)
+               return 0;
+
+       certs = mono_btls_x509_chain_peek_certs (chain);
+       if (!certs || !sk_X509_num (certs))
+               return 0;
+
+       ctx->store = mono_btls_x509_store_up_ref(store);
+       ctx->chain = mono_btls_x509_chain_up_ref(chain);
+
+       leaf = sk_X509_value (certs, 0);
+       ret = X509_STORE_CTX_init (ctx->ctx, mono_btls_x509_store_peek_store (store), leaf, certs);
+       if (ret != 1)
+               return ret;
+
+       X509_STORE_CTX_set_app_data (ctx->ctx, ctx);
+       return 1;
+}
+
+MONO_API int
+mono_btls_x509_store_ctx_set_param (MonoBtlsX509StoreCtx *ctx, MonoBtlsX509VerifyParam *param)
+{
+       return X509_VERIFY_PARAM_set1 (X509_STORE_CTX_get0_param (ctx->ctx), mono_btls_x509_verify_param_peek_param (param));
+}
+
+MONO_API int
+mono_btls_x509_store_ctx_verify_cert (MonoBtlsX509StoreCtx *ctx)
+{
+       return X509_verify_cert (ctx->ctx);
+}
+
+MONO_API X509 *
+mono_btls_x509_store_ctx_get_by_subject (MonoBtlsX509StoreCtx *ctx, MonoBtlsX509Name *name)
+{
+       X509_OBJECT obj;
+       X509 *x509;
+       int ret;
+
+       ret = X509_STORE_get_by_subject (ctx->ctx, X509_LU_X509, mono_btls_x509_name_peek_name (name), &obj);
+       if (ret != X509_LU_X509) {
+               X509_OBJECT_free_contents (&obj);
+               return NULL;
+       }
+
+       x509 = X509_up_ref (obj.data.x509);
+       return x509;
+}
+
+MONO_API X509 *
+mono_btls_x509_store_ctx_get_current_cert (MonoBtlsX509StoreCtx *ctx)
+{
+       X509 *x509 = X509_STORE_CTX_get_current_cert (ctx->ctx);
+       if (!x509)
+               return NULL;
+       return X509_up_ref (x509);
+}
+
+MONO_API X509 *
+mono_btls_x509_store_ctx_get_current_issuer (MonoBtlsX509StoreCtx *ctx)
+{
+       X509 *x509 = X509_STORE_CTX_get0_current_issuer (ctx->ctx);
+       if (!x509)
+               return NULL;
+       return X509_up_ref (x509);
+}
+
+MONO_API MonoBtlsX509VerifyParam *
+mono_btls_x509_store_ctx_get_verify_param (MonoBtlsX509StoreCtx *ctx)
+{
+       X509_VERIFY_PARAM *param;
+
+       param = X509_STORE_CTX_get0_param (ctx->ctx);
+       if (!param)
+               return NULL;
+
+       return mono_btls_x509_verify_param_from_store_ctx (ctx, param);
+}
+
+MONO_API int
+mono_btls_x509_store_ctx_get_foo (MonoBtlsX509StoreCtx *ctx)
+{
+       return 0;
+}
diff --git a/mono/btls/btls-x509-store-ctx.h b/mono/btls/btls-x509-store-ctx.h
new file mode 100644 (file)
index 0000000..188092e
--- /dev/null
@@ -0,0 +1,66 @@
+//
+//  btls-x509-store-ctx.h
+//  MonoBtls
+//
+//  Created by Martin Baulig on 3/3/16.
+//  Copyright © 2016 Xamarin. All rights reserved.
+//
+
+#ifndef __btls__btls_x509_store_ctx__
+#define __btls__btls_x509_store_ctx__
+
+#include <stdio.h>
+#include <btls-ssl.h>
+#include <btls-x509-chain.h>
+#include <btls-x509-name.h>
+#include <btls-x509-store.h>
+#include <btls-x509-verify-param.h>
+
+MonoBtlsX509StoreCtx *
+mono_btls_x509_store_ctx_from_ptr (X509_STORE_CTX *ptr);
+
+MonoBtlsX509StoreCtx *
+mono_btls_x509_store_ctx_new (void);
+
+MonoBtlsX509StoreCtx *
+mono_btls_x509_store_ctx_up_ref (MonoBtlsX509StoreCtx *ctx);
+
+int
+mono_btls_x509_store_ctx_free (MonoBtlsX509StoreCtx *ctx);
+
+int
+mono_btls_x509_store_ctx_get_error (MonoBtlsX509StoreCtx *ctx, const char **error_string);
+
+int
+mono_btls_x509_store_ctx_get_error_depth (MonoBtlsX509StoreCtx *ctx);
+
+MonoBtlsX509Chain *
+mono_btls_x509_store_ctx_get_chain (MonoBtlsX509StoreCtx *ctx);
+
+X509 *
+mono_btls_x509_store_ctx_get_current_cert (MonoBtlsX509StoreCtx *ctx);
+
+X509 *
+mono_btls_x509_store_ctx_get_current_issuer (MonoBtlsX509StoreCtx *ctx);
+
+int
+mono_btls_x509_store_ctx_init (MonoBtlsX509StoreCtx *ctx,
+                                  MonoBtlsX509Store *store, MonoBtlsX509Chain *chain);
+
+int
+mono_btls_x509_store_ctx_set_param (MonoBtlsX509StoreCtx *ctx, MonoBtlsX509VerifyParam *param);
+
+X509 *
+mono_btls_x509_store_ctx_get_by_subject (MonoBtlsX509StoreCtx *ctx, MonoBtlsX509Name *name);
+
+int
+mono_btls_x509_store_ctx_verify_cert (MonoBtlsX509StoreCtx *ctx);
+
+MonoBtlsX509VerifyParam *
+mono_btls_x509_store_ctx_get_verify_param (MonoBtlsX509StoreCtx *ctx);
+
+MonoBtlsX509Chain *
+mono_btls_x509_store_ctx_get_untrusted (MonoBtlsX509StoreCtx *ctx);
+
+#endif /* defined(__btls__btls_x509_store_ctx__) */
+
diff --git a/mono/btls/btls-x509-store.c b/mono/btls/btls-x509-store.c
new file mode 100644 (file)
index 0000000..3534739
--- /dev/null
@@ -0,0 +1,110 @@
+//
+//  btls-x509-store.c
+//  MonoBtls
+//
+//  Created by Martin Baulig on 3/3/16.
+//  Copyright © 2016 Xamarin. All rights reserved.
+//
+
+#include <btls-x509-store.h>
+
+struct MonoBtlsX509Store {
+       X509_STORE *store;
+       CRYPTO_refcount_t references;
+};
+
+MONO_API MonoBtlsX509Store *
+mono_btls_x509_store_from_store (X509_STORE *ctx)
+{
+       MonoBtlsX509Store *store;
+
+       store = OPENSSL_malloc (sizeof(MonoBtlsX509Store));
+       if (!store)
+               return NULL;
+
+       memset (store, 0, sizeof(MonoBtlsX509Store));
+       store->store = ctx;
+       CRYPTO_refcount_inc (&store->store->references);
+       store->references = 1;
+       return store;
+}
+
+MONO_API MonoBtlsX509Store *
+mono_btls_x509_store_from_ctx (X509_STORE_CTX *ctx)
+{
+       return mono_btls_x509_store_from_store (ctx->ctx);
+}
+
+MONO_API MonoBtlsX509Store *
+mono_btls_x509_store_new (void)
+{
+       MonoBtlsX509Store *store;
+
+       store = OPENSSL_malloc (sizeof(MonoBtlsX509Store));
+       if (!store)
+               return NULL;
+
+       memset (store, 0, sizeof(MonoBtlsX509Store));
+       store->store = X509_STORE_new ();
+       store->references = 1;
+       return store;
+}
+
+MONO_API X509_STORE *
+mono_btls_x509_store_peek_store (MonoBtlsX509Store *store)
+{
+       return store->store;
+}
+
+MONO_API MonoBtlsX509Store *
+mono_btls_x509_store_from_ssl_ctx (MonoBtlsSslCtx *ctx)
+{
+       X509_STORE *store = mono_btls_ssl_ctx_peek_store (ctx);
+       return mono_btls_x509_store_from_store (store);
+}
+
+MONO_API int
+mono_btls_x509_store_free (MonoBtlsX509Store *store)
+{
+       if (!CRYPTO_refcount_dec_and_test_zero(&store->references))
+               return 0;
+
+       if (store->store) {
+               X509_STORE_free (store->store);
+               store->store = NULL;
+       }
+       OPENSSL_free (store);
+       return 1;
+}
+
+MONO_API MonoBtlsX509Store *
+mono_btls_x509_store_up_ref (MonoBtlsX509Store *store)
+{
+       CRYPTO_refcount_inc (&store->references);
+       return store;
+}
+
+MONO_API int
+mono_btls_x509_store_add_cert (MonoBtlsX509Store *store, X509 *cert)
+{
+       return X509_STORE_add_cert (store->store, cert);
+}
+
+MONO_API int
+mono_btls_x509_store_load_locations (MonoBtlsX509Store *store, const char *file, const char *path)
+{
+       return X509_STORE_load_locations (store->store, file, path);
+}
+
+MONO_API int
+mono_btls_x509_store_set_default_paths (MonoBtlsX509Store *store)
+{
+       return X509_STORE_set_default_paths (store->store);
+}
+
+MONO_API int
+mono_btls_x509_store_get_count (MonoBtlsX509Store *store)
+{
+       return (int)sk_X509_OBJECT_num (store->store->objs);
+}
+
diff --git a/mono/btls/btls-x509-store.h b/mono/btls/btls-x509-store.h
new file mode 100644 (file)
index 0000000..67ffe00
--- /dev/null
@@ -0,0 +1,46 @@
+//
+//  btls-x509-store.h
+//  MonoBtls
+//
+//  Created by Martin Baulig on 3/3/16.
+//  Copyright © 2016 Xamarin. All rights reserved.
+//
+
+#ifndef __btls__btls_x509_store__
+#define __btls__btls_x509_store__
+
+#include <stdio.h>
+#include <btls-ssl.h>
+
+MonoBtlsX509Store *
+mono_btls_x509_store_new (void);
+
+MonoBtlsX509Store *
+mono_btls_x509_store_from_ctx (X509_STORE_CTX *ctx);
+
+MonoBtlsX509Store *
+mono_btls_x509_store_from_ssl_ctx (MonoBtlsSslCtx *ctx);
+
+MonoBtlsX509Store *
+mono_btls_x509_store_up_ref (MonoBtlsX509Store *store);
+
+int
+mono_btls_x509_store_free (MonoBtlsX509Store *store);
+
+X509_STORE *
+mono_btls_x509_store_peek_store (MonoBtlsX509Store *store);
+
+int
+mono_btls_x509_store_add_cert (MonoBtlsX509Store *store, X509 *cert);
+
+int
+mono_btls_x509_store_load_locations (MonoBtlsX509Store *store, const char *file, const char *path);
+
+int
+mono_btls_x509_store_set_default_paths (MonoBtlsX509Store *store);
+
+int
+mono_btls_x509_store_get_count (MonoBtlsX509Store *store);
+
+#endif /* defined(__btls__btls_x509_store__) */
+
diff --git a/mono/btls/btls-x509-verify-param.c b/mono/btls/btls-x509-verify-param.c
new file mode 100644 (file)
index 0000000..24be3da
--- /dev/null
@@ -0,0 +1,221 @@
+//
+//  btls-x509-verify-param.c
+//  MonoBtls
+//
+//  Created by Martin Baulig on 3/5/16.
+//  Copyright © 2016 Xamarin. All rights reserved.
+//
+
+#include <btls-x509-verify-param.h>
+#include <btls-x509-store-ctx.h>
+
+struct MonoBtlsX509VerifyParam {
+       int owns;
+       MonoBtlsX509StoreCtx *owner;
+       X509_VERIFY_PARAM *param;
+};
+
+MONO_API MonoBtlsX509VerifyParam *
+mono_btls_x509_verify_param_new (void)
+{
+       MonoBtlsX509VerifyParam *param;
+
+       param = OPENSSL_malloc (sizeof(MonoBtlsX509VerifyParam));
+       if (!param)
+               return NULL;
+       memset (param, 0, sizeof (MonoBtlsX509VerifyParam));
+       param->param = X509_VERIFY_PARAM_new();
+       param->owns = 1;
+       return param;
+}
+
+MONO_API MonoBtlsX509VerifyParam *
+mono_btls_x509_verify_param_from_store_ctx (MonoBtlsX509StoreCtx *ctx, X509_VERIFY_PARAM *param)
+{
+       MonoBtlsX509VerifyParam *instance;
+
+       instance = OPENSSL_malloc (sizeof(MonoBtlsX509VerifyParam));
+       if (!instance)
+               return NULL;
+       memset (instance, 0, sizeof (MonoBtlsX509VerifyParam));
+       instance->param = param;
+       instance->owner = mono_btls_x509_store_ctx_up_ref (ctx);
+       return instance;
+}
+
+MONO_API MonoBtlsX509VerifyParam *
+mono_btls_x509_verify_param_copy (const MonoBtlsX509VerifyParam *from)
+{
+       MonoBtlsX509VerifyParam *param;
+
+       param = mono_btls_x509_verify_param_new ();
+       if (!param)
+               return NULL;
+
+       X509_VERIFY_PARAM_set1 (param->param, from->param);
+       return param;
+}
+
+MONO_API const X509_VERIFY_PARAM *
+mono_btls_x509_verify_param_peek_param (const MonoBtlsX509VerifyParam *param)
+{
+       return param->param;
+}
+
+MONO_API int
+mono_btls_x509_verify_param_can_modify (MonoBtlsX509VerifyParam *param)
+{
+       return param->owns;
+}
+
+MONO_API MonoBtlsX509VerifyParam *
+mono_btls_x509_verify_param_lookup (const char *name)
+{
+       MonoBtlsX509VerifyParam *param;
+       const X509_VERIFY_PARAM *p;
+
+       p = X509_VERIFY_PARAM_lookup(name);
+       if (!p)
+               return NULL;
+
+       param = OPENSSL_malloc (sizeof(MonoBtlsX509VerifyParam));
+       if (!param)
+               return NULL;
+       memset (param, 0, sizeof (MonoBtlsX509VerifyParam));
+       param->param = (X509_VERIFY_PARAM *)p;
+       return param;
+}
+
+MONO_API void
+mono_btls_x509_verify_param_free (MonoBtlsX509VerifyParam *param)
+{
+       if (param->owns) {
+               if (param->param) {
+                       X509_VERIFY_PARAM_free (param->param);
+                       param->param = NULL;
+               }
+       }
+       if (param->owner) {
+               mono_btls_x509_store_ctx_free (param->owner);
+               param->owner = NULL;
+       }
+       OPENSSL_free (param);
+}
+
+MONO_API int
+mono_btls_x509_verify_param_set_name (MonoBtlsX509VerifyParam *param, const char *name)
+{
+       if (!param->owns)
+               return -1;
+       return X509_VERIFY_PARAM_set1_name (param->param, name);
+}
+
+MONO_API int
+mono_btls_x509_verify_param_set_host (MonoBtlsX509VerifyParam *param, const char *host, int namelen)
+{
+       if (!param->owns)
+               return -1;
+       return X509_VERIFY_PARAM_set1_host (param->param, host, namelen);
+}
+
+MONO_API int
+mono_btls_x509_verify_param_add_host (MonoBtlsX509VerifyParam *param, const char *host, int namelen)
+{
+       if (!param->owns)
+               return -1;
+       return X509_VERIFY_PARAM_set1_host (param->param, host, namelen);
+}
+
+MONO_API uint64_t
+mono_btls_x509_verify_param_get_flags (MonoBtlsX509VerifyParam *param)
+{
+       return X509_VERIFY_PARAM_get_flags (param->param);
+}
+
+MONO_API int
+mono_btls_x509_verify_param_set_flags (MonoBtlsX509VerifyParam *param, uint64_t flags)
+{
+       if (!param->owns)
+               return -1;
+       return X509_VERIFY_PARAM_set_flags (param->param, flags);
+}
+
+MONO_API MonoBtlsX509VerifyFlags
+mono_btls_x509_verify_param_get_mono_flags (MonoBtlsX509VerifyParam *param)
+{
+       MonoBtlsX509VerifyFlags current;
+       uint64_t flags;
+
+       if (!param->owns)
+               return -1;
+
+       current = 0;
+       flags = X509_VERIFY_PARAM_get_flags (param->param);
+
+       if (flags & X509_V_FLAG_CRL_CHECK)
+               current |= MONO_BTLS_X509_VERIFY_FLAGS_CRL_CHECK;
+       if (flags & X509_V_FLAG_CRL_CHECK_ALL)
+               current |= MONO_BTLS_X509_VERIFY_FLAGS_CRL_CHECK_ALL;
+       if (flags & X509_V_FLAG_X509_STRICT)
+               current |= MONO_BTLS_X509_VERIFY_FLAGS_X509_STRICT;
+
+       return current;
+}
+
+MONO_API int
+mono_btls_x509_verify_param_set_mono_flags (MonoBtlsX509VerifyParam *param, MonoBtlsX509VerifyFlags flags)
+{
+       uint64_t current;
+
+       if (!param->owns)
+               return -1;
+
+       current = X509_VERIFY_PARAM_get_flags (param->param);
+       if (flags & MONO_BTLS_X509_VERIFY_FLAGS_CRL_CHECK)
+               current |= X509_V_FLAG_CRL_CHECK;
+       if (flags & MONO_BTLS_X509_VERIFY_FLAGS_CRL_CHECK_ALL)
+               current |= X509_V_FLAG_CRL_CHECK_ALL;
+       if (flags & MONO_BTLS_X509_VERIFY_FLAGS_X509_STRICT)
+               current |= X509_V_FLAG_X509_STRICT;
+
+       return X509_VERIFY_PARAM_set_flags (param->param, current);
+}
+
+MONO_API int
+mono_btls_x509_verify_param_set_purpose (MonoBtlsX509VerifyParam *param, MonoBtlsX509Purpose purpose)
+{
+       if (!param->owns)
+               return -1;
+       return X509_VERIFY_PARAM_set_purpose (param->param, purpose);
+}
+
+MONO_API int
+mono_btls_x509_verify_param_get_depth (MonoBtlsX509VerifyParam *param)
+{
+       return X509_VERIFY_PARAM_get_depth (param->param);
+}
+
+MONO_API int
+mono_btls_x509_verify_param_set_depth (MonoBtlsX509VerifyParam *param, int depth)
+{
+       if (!param->owns)
+               return -1;
+       X509_VERIFY_PARAM_set_depth (param->param, depth);
+       return 1;
+}
+
+MONO_API int
+mono_btls_x509_verify_param_set_time (MonoBtlsX509VerifyParam *param, int64_t time)
+{
+       if (!param->owns)
+               return -1;
+       X509_VERIFY_PARAM_set_time (param->param, time);
+       return 1;
+}
+
+MONO_API char *
+mono_btls_x509_verify_param_get_peername (MonoBtlsX509VerifyParam *param)
+{
+       char *peer = X509_VERIFY_PARAM_get0_peername (param->param);
+       return peer;
+}
diff --git a/mono/btls/btls-x509-verify-param.h b/mono/btls/btls-x509-verify-param.h
new file mode 100644 (file)
index 0000000..e85d547
--- /dev/null
@@ -0,0 +1,81 @@
+//
+//  btls-x509-verify-param.h
+//  MonoBtls
+//
+//  Created by Martin Baulig on 3/3/16.
+//  Copyright © 2016 Xamarin. All rights reserved.
+//
+
+#ifndef __btls__btls_x509_verify_param__
+#define __btls__btls_x509_verify_param__
+
+#include <stdio.h>
+#include <btls-ssl.h>
+#include <btls-x509.h>
+
+typedef enum {
+       MONO_BTLS_X509_VERIFY_FLAGS_DEFAULT             = 0,
+       MONO_BTLS_X509_VERIFY_FLAGS_CRL_CHECK   = 1,
+       MONO_BTLS_X509_VERIFY_FLAGS_CRL_CHECK_ALL       = 2,
+       MONO_BTLS_X509_VERIFY_FLAGS_X509_STRICT = 4
+} MonoBtlsX509VerifyFlags;
+
+MonoBtlsX509VerifyParam *
+mono_btls_x509_verify_param_new (void);
+
+MonoBtlsX509VerifyParam *
+mono_btls_x509_verify_param_from_store_ctx (MonoBtlsX509StoreCtx *ctx, X509_VERIFY_PARAM *param);
+
+MonoBtlsX509VerifyParam *
+mono_btls_x509_verify_param_copy (const MonoBtlsX509VerifyParam *from);
+
+void
+mono_btls_x509_verify_param_free (MonoBtlsX509VerifyParam *param);
+
+const X509_VERIFY_PARAM *
+mono_btls_x509_verify_param_peek_param (const MonoBtlsX509VerifyParam *param);
+
+int
+mono_btls_x509_verify_param_can_modify (MonoBtlsX509VerifyParam *param);
+
+MonoBtlsX509VerifyParam *
+mono_btls_x509_verify_param_lookup (const char *name);
+
+int
+mono_btls_x509_verify_param_set_name (MonoBtlsX509VerifyParam *param, const char *name);
+
+int
+mono_btls_x509_verify_param_set_host (MonoBtlsX509VerifyParam *param, const char *host, int namelen);
+
+int
+mono_btls_x509_verify_param_add_host (MonoBtlsX509VerifyParam *param, const char *host, int namelen);
+
+uint64_t
+mono_btls_x509_verify_param_get_flags (MonoBtlsX509VerifyParam *param);
+
+int
+mono_btls_x509_verify_param_set_flags (MonoBtlsX509VerifyParam *param, uint64_t flags);
+
+MonoBtlsX509VerifyFlags
+mono_btls_x509_verify_param_get_mono_flags (MonoBtlsX509VerifyParam *param);
+
+int
+mono_btls_x509_verify_param_set_mono_flags (MonoBtlsX509VerifyParam *param, MonoBtlsX509VerifyFlags flags);
+
+int
+mono_btls_x509_verify_param_set_purpose (MonoBtlsX509VerifyParam *param, MonoBtlsX509Purpose purpose);
+
+int
+mono_btls_x509_verify_param_get_depth (MonoBtlsX509VerifyParam *param);
+
+int
+mono_btls_x509_verify_param_set_depth (MonoBtlsX509VerifyParam *param, int depth);
+
+int
+mono_btls_x509_verify_param_set_time (MonoBtlsX509VerifyParam *param, int64_t time);
+
+char *
+mono_btls_x509_verify_param_get_peername (MonoBtlsX509VerifyParam *param);
+
+#endif /* defined(__btls__btls_x509_verify_param__) */
+
diff --git a/mono/btls/btls-x509.c b/mono/btls/btls-x509.c
new file mode 100644 (file)
index 0000000..473d94f
--- /dev/null
@@ -0,0 +1,441 @@
+//
+//  btls-x509.c
+//  MonoBtls
+//
+//  Created by Martin Baulig on 14/11/15.
+//  Copyright (c) 2015 Xamarin. All rights reserved.
+//
+
+#include <btls-x509.h>
+#include <openssl/x509v3.h>
+#include <openssl/pkcs12.h>
+
+MONO_API X509 *
+mono_btls_x509_from_data (const void *buf, int len, MonoBtlsX509Format format)
+{
+       BIO *bio;
+       X509 *cert = NULL;
+
+       bio = BIO_new_mem_buf ((void *)buf, len);
+       switch (format) {
+               case MONO_BTLS_X509_FORMAT_DER:
+                       cert = d2i_X509_bio (bio, NULL);
+                       break;
+               case MONO_BTLS_X509_FORMAT_PEM:
+                       cert = PEM_read_bio_X509 (bio, NULL, NULL, NULL);
+                       break;
+       }
+       BIO_free (bio);
+       return cert;
+}
+
+MONO_API X509 *
+mono_btls_x509_up_ref (X509 *x509)
+{
+       X509_up_ref (x509);
+       return x509;
+}
+
+MONO_API void
+mono_btls_x509_free (X509 *x509)
+{
+       X509_free (x509);
+}
+
+MONO_API X509 *
+mono_btls_x509_dup (X509 *x509)
+{
+       return X509_dup (x509);
+}
+
+MONO_API MonoBtlsX509Name *
+mono_btls_x509_get_subject_name (X509 *x509)
+{
+       return mono_btls_x509_name_copy (X509_get_subject_name (x509));
+}
+
+MONO_API MonoBtlsX509Name *
+mono_btls_x509_get_issuer_name (X509 *x509)
+{
+       return mono_btls_x509_name_copy (X509_get_issuer_name (x509));
+}
+
+MONO_API int
+mono_btls_x509_get_subject_name_string (X509 *name, char *buffer, int size)
+{
+       *buffer = 0;
+       return X509_NAME_oneline (X509_get_subject_name (name), buffer, size) != NULL;
+}
+
+MONO_API int
+mono_btls_x509_get_issuer_name_string (X509 *name, char *buffer, int size)
+{
+       *buffer = 0;
+       return X509_NAME_oneline (X509_get_issuer_name (name), buffer, size) != NULL;
+}
+
+MONO_API int
+mono_btls_x509_get_raw_data (X509 *x509, BIO *bio, MonoBtlsX509Format format)
+{
+       switch (format) {
+               case MONO_BTLS_X509_FORMAT_DER:
+                       return i2d_X509_bio (bio, x509);
+               case MONO_BTLS_X509_FORMAT_PEM:
+                       return PEM_write_bio_X509 (bio, x509);
+               default:
+                       return 0;
+       }
+}
+
+MONO_API int
+mono_btls_x509_cmp (const X509 *a, const X509 *b)
+{
+       return X509_cmp (a, b);
+}
+
+MONO_API int
+mono_btls_x509_get_hash (X509 *x509, const void **data)
+{
+       X509_check_purpose (x509, -1, 0);
+       *data = x509->sha1_hash;
+       return SHA_DIGEST_LENGTH;
+}
+
+MONO_API int64_t
+mono_btls_x509_get_not_before (X509 *x509)
+{
+       return mono_btls_util_asn1_time_to_ticks (X509_get_notBefore (x509));
+}
+
+MONO_API int64_t
+mono_btls_x509_get_not_after (X509 *x509)
+{
+       return mono_btls_util_asn1_time_to_ticks (X509_get_notAfter (x509));
+}
+
+MONO_API int
+mono_btls_x509_get_public_key (X509 *x509, BIO *bio)
+{
+       EVP_PKEY *pkey;
+       uint8_t *data = NULL;
+       int ret;
+
+       pkey = X509_get_pubkey (x509);
+       if (!pkey)
+               return -1;
+
+       ret = i2d_PublicKey (pkey, &data);
+
+       if (ret > 0 && data) {
+               ret = BIO_write (bio, data, ret);
+               OPENSSL_free (data);
+       }
+
+       EVP_PKEY_free (pkey);
+       return ret;
+}
+
+MONO_API int
+mono_btls_x509_get_serial_number (X509 *x509, char *buffer, int size, int mono_style)
+{
+       ASN1_INTEGER *serial;
+       unsigned char *temp, *p;
+       int len, idx;
+
+       serial = X509_get_serialNumber (x509);
+       if (serial->length == 0 || serial->length+1 > size)
+               return 0;
+
+       if (!mono_style) {
+               memcpy (buffer, serial->data, serial->length);
+               return serial->length;
+       }
+
+       temp = OPENSSL_malloc (serial->length + 1);
+       if (!temp)
+               return 0;
+
+       p = temp;
+       len = i2c_ASN1_INTEGER (serial, &p);
+
+       if (!len) {
+               OPENSSL_free (temp);
+               return 0;
+       }
+
+       for (idx = 0; idx < len; idx++) {
+               buffer [idx] = *(--p);
+       }
+       buffer [len] = 0;
+
+       OPENSSL_free (temp);
+       return len;
+}
+
+MONO_API int
+mono_btls_x509_get_public_key_algorithm (X509 *x509, char *buffer, int size)
+{
+       X509_PUBKEY *pkey;
+       ASN1_OBJECT *ppkalg;
+       int ret;
+
+       *buffer = 0;
+       pkey = X509_get_X509_PUBKEY (x509);
+       if (!pkey)
+               return 0;
+
+       ret = X509_PUBKEY_get0_param (&ppkalg, NULL, NULL, NULL, pkey);
+       if (!ret || !ppkalg)
+               return ret;
+
+       return OBJ_obj2txt (buffer, size, ppkalg, 1);
+}
+
+MONO_API int
+mono_btls_x509_get_version (X509 *x509)
+{
+       return (int)X509_get_version (x509) + 1;
+}
+
+MONO_API int
+mono_btls_x509_get_signature_algorithm (X509 *x509, char *buffer, int size)
+{
+       const ASN1_OBJECT *obj;
+       int nid;
+
+       *buffer = 0;
+
+       nid = X509_get_signature_nid (x509);
+
+       obj = OBJ_nid2obj (nid);
+       if (!obj)
+               return 0;
+
+       return OBJ_obj2txt (buffer, size, obj, 1);
+}
+
+MONO_API int
+mono_btls_x509_get_public_key_asn1 (X509 *x509, char *out_oid, int oid_len, uint8_t **buffer, int *size)
+{
+       X509_PUBKEY *pkey;
+       ASN1_OBJECT *ppkalg;
+       const unsigned char *pk;
+       int pk_len;
+       int ret;
+
+       if (out_oid)
+               *out_oid = 0;
+
+       pkey = X509_get_X509_PUBKEY (x509);
+       if (!pkey || !pkey->public_key)
+               return 0;
+
+       ret = X509_PUBKEY_get0_param (&ppkalg, &pk, &pk_len, NULL, pkey);
+       if (ret != 1 || !ppkalg || !pk)
+               return 0;
+
+       if (out_oid) {
+               OBJ_obj2txt (out_oid, oid_len, ppkalg, 1);
+       }
+
+       if (buffer) {
+               *size = pk_len;
+               *buffer = OPENSSL_malloc (pk_len);
+               if (!*buffer)
+                       return 0;
+
+               memcpy (*buffer, pk, pk_len);
+       }
+
+       return 1;
+
+}
+
+MONO_API int
+mono_btls_x509_get_public_key_parameters (X509 *x509, char *out_oid, int oid_len, uint8_t **buffer, int *size)
+{
+       X509_PUBKEY *pkey;
+       X509_ALGOR *algor;
+       ASN1_OBJECT *paobj;
+       int ptype;
+       void *pval;
+       int ret;
+
+       if (out_oid)
+               *out_oid = 0;
+
+       pkey = X509_get_X509_PUBKEY (x509);
+
+       ret = X509_PUBKEY_get0_param (NULL, NULL, NULL, &algor, pkey);
+       if (ret != 1 || !algor)
+               return 0;
+
+       X509_ALGOR_get0 (&paobj, &ptype, &pval, algor);
+
+       if (ptype != V_ASN1_NULL && ptype != V_ASN1_SEQUENCE)
+               return 0;
+
+       if (ptype == V_ASN1_NULL) {
+               uint8_t *ptr;
+
+               *size = 2;
+               *buffer = OPENSSL_malloc (2);
+               if (!*buffer)
+                       return 0;
+
+               ptr = *buffer;
+               *ptr++ = 0x05;
+               *ptr++ = 0x00;
+
+               if (out_oid)
+                       OBJ_obj2txt (out_oid, oid_len, paobj, 1);
+
+               return 1;
+       } else if (ptype == V_ASN1_SEQUENCE) {
+               ASN1_STRING *pstr = pval;
+
+               *size = pstr->length;
+               *buffer = OPENSSL_malloc (pstr->length);
+               if (!*buffer)
+                       return 0;
+
+               memcpy (*buffer, pstr->data, pstr->length);
+
+               if (out_oid)
+                       OBJ_obj2txt (out_oid, oid_len, paobj, 1);
+
+               return 1;
+       } else {
+               return 0;
+       }
+}
+
+MONO_API EVP_PKEY *
+mono_btls_x509_get_pubkey (X509 *x509)
+{
+       return X509_get_pubkey (x509);
+}
+
+MONO_API int
+mono_btls_x509_get_subject_key_identifier (X509 *x509, uint8_t **buffer, int *size)
+{
+       ASN1_OCTET_STRING *skid;
+
+       *size = 0;
+       *buffer = NULL;
+
+       if (X509_get_version (x509) != 2)
+               return 0;
+
+       skid = X509_get_ext_d2i (x509, NID_subject_key_identifier, NULL, NULL);
+       if (!skid)
+               return 0;
+
+       *size = skid->length;
+       *buffer = OPENSSL_malloc (*size);
+       if (!*buffer)
+               return 0;
+
+       memcpy (*buffer, skid->data, *size);
+       return 1;
+}
+
+MONO_API int
+mono_btls_x509_print (X509 *x509, BIO *bio)
+{
+       return X509_print_ex (bio, x509, XN_FLAG_COMPAT, X509_FLAG_COMPAT);
+}
+
+static int
+get_trust_nid (MonoBtlsX509Purpose purpose)
+{
+       switch (purpose) {
+               case MONO_BTLS_X509_PURPOSE_SSL_CLIENT:
+                       return NID_client_auth;
+               case MONO_BTLS_X509_PURPOSE_SSL_SERVER:
+                       return NID_server_auth;
+               default:
+                       return 0;
+       }
+}
+
+MONO_API int
+mono_btls_x509_add_trust_object (X509 *x509, MonoBtlsX509Purpose purpose)
+{
+       ASN1_OBJECT *trust;
+       int nid;
+
+       nid = get_trust_nid (purpose);
+       if (!nid)
+               return 0;
+
+       trust = ASN1_OBJECT_new ();
+       if (!trust)
+               return 0;
+
+       trust->nid = nid;
+       return X509_add1_trust_object (x509, trust);
+}
+
+MONO_API int
+mono_btls_x509_add_reject_object (X509 *x509, MonoBtlsX509Purpose purpose)
+{
+       ASN1_OBJECT *reject;
+       int nid;
+
+       nid = get_trust_nid (purpose);
+       if (!nid)
+               return 0;
+
+       reject = ASN1_OBJECT_new ();
+       if (!reject)
+               return 0;
+
+       reject->nid = nid;
+       return X509_add1_reject_object (x509, reject);
+}
+
+MONO_API int
+mono_btls_x509_add_explicit_trust (X509 *x509, MonoBtlsX509TrustKind kind)
+{
+       int ret = 0;
+
+       if ((kind & MONO_BTLS_X509_TRUST_KIND_REJECT_ALL) != 0)
+               kind |= MONO_BTLS_X509_TRUST_KIND_REJECT_CLIENT | MONO_BTLS_X509_TRUST_KIND_REJECT_SERVER;
+
+       if ((kind & MONO_BTLS_X509_TRUST_KIND_TRUST_ALL) != 0)
+               kind |= MONO_BTLS_X509_TRUST_KIND_TRUST_CLIENT | MONO_BTLS_X509_TRUST_KIND_TRUST_SERVER;
+
+
+       if ((kind & MONO_BTLS_X509_TRUST_KIND_REJECT_CLIENT) != 0) {
+               ret = mono_btls_x509_add_reject_object (x509, MONO_BTLS_X509_PURPOSE_SSL_CLIENT);
+               if (!ret)
+                       return ret;
+       }
+
+       if ((kind & MONO_BTLS_X509_TRUST_KIND_REJECT_SERVER) != 0) {
+               ret = mono_btls_x509_add_reject_object (x509, MONO_BTLS_X509_PURPOSE_SSL_SERVER);
+               if (!ret)
+                       return ret;
+       }
+
+       if (ret) {
+               // Ignore any MONO_BTLS_X509_TRUST_KIND_TRUST_* settings if we added
+               // any kind of MONO_BTLS_X509_TRUST_KIND_REJECT_* before.
+               return ret;
+       }
+
+       if ((kind & MONO_BTLS_X509_TRUST_KIND_TRUST_CLIENT) != 0) {
+               ret = mono_btls_x509_add_trust_object (x509, MONO_BTLS_X509_PURPOSE_SSL_CLIENT);
+               if (!ret)
+                       return ret;
+       }
+
+       if ((kind & MONO_BTLS_X509_TRUST_KIND_TRUST_SERVER) != 0) {
+               ret = mono_btls_x509_add_trust_object (x509, MONO_BTLS_X509_PURPOSE_SSL_SERVER);
+               if (!ret)
+                       return ret;
+       }
+
+       return ret;
+}
diff --git a/mono/btls/btls-x509.h b/mono/btls/btls-x509.h
new file mode 100644 (file)
index 0000000..d913743
--- /dev/null
@@ -0,0 +1,127 @@
+//
+//  btls-x509.h
+//  MonoBtls
+//
+//  Created by Martin Baulig on 14/11/15.
+//  Copyright (c) 2015 Xamarin. All rights reserved.
+//
+
+#ifndef __btls__btls_x509__
+#define __btls__btls_x509__
+
+#include <stdio.h>
+#include <btls-ssl.h>
+#include <btls-x509-name.h>
+
+typedef enum {
+       MONO_BTLS_X509_FORMAT_DER = 1,
+       MONO_BTLS_X509_FORMAT_PEM = 2
+} MonoBtlsX509Format;
+
+typedef enum {
+       MONO_BTLS_x509_FILE_TYPE_PEM = 1,               // X509_FILETYPE_PEM
+       MONO_BTLS_x509_FILE_TYPE_ASN1 = 2,              // X509_FILETYPE_ASN1
+       MONO_BTLS_x509_FILE_TYPE_DEFAULT = 3,   // X509_FILETYPE_DEFAULT
+} MonoBtlsX509FileType;
+
+typedef enum {
+       MONO_BTLS_X509_PURPOSE_SSL_CLIENT               = 1,
+       MONO_BTLS_X509_PURPOSE_SSL_SERVER               = 2,
+       MONO_BTLS_X509_PURPOSE_NS_SSL_SERVER    = 3,
+       MONO_BTLS_X509_PURPOSE_SMIME_SIGN               = 4,
+       MONO_BTLS_X509_PURPOSE_SMIME_ENCRYPT    = 5,
+       MONO_BTLS_X509_PURPOSE_CRL_SIGN         = 6,
+       MONO_BTLS_X509_PURPOSE_ANY                      = 7,
+       MONO_BTLS_X509_PURPOSE_OCSP_HELPER              = 8,
+       MONO_BTLS_X509_PURPOSE_TIMESTAMP_SIGN   = 9,
+} MonoBtlsX509Purpose;
+
+typedef enum {
+       MONO_BTLS_X509_TRUST_KIND_DEFAULT               = 0,
+       MONO_BTLS_X509_TRUST_KIND_TRUST_CLIENT  = 1,
+       MONO_BTLS_X509_TRUST_KIND_TRUST_SERVER  = 2,
+       MONO_BTLS_X509_TRUST_KIND_TRUST_ALL             = 4,
+       MONO_BTLS_X509_TRUST_KIND_REJECT_CLIENT = 32,
+       MONO_BTLS_X509_TRUST_KIND_REJECT_SERVER = 64,
+       MONO_BTLS_X509_TRUST_KIND_REJECT_ALL    = 128
+} MonoBtlsX509TrustKind;
+
+X509 *
+mono_btls_x509_from_data (const void *buf, int len, MonoBtlsX509Format format);
+
+X509 *
+mono_btls_x509_up_ref (X509 *x509);
+
+void
+mono_btls_x509_free (X509 *x509);
+
+X509 *
+mono_btls_x509_dup (X509 *x509);
+
+MonoBtlsX509Name *
+mono_btls_x509_get_subject_name (X509 *x509);
+
+MonoBtlsX509Name *
+mono_btls_x509_get_issuer_name (X509 *x509);
+
+int
+mono_btls_x509_get_subject_name_string (X509 *name, char *buffer, int size);
+
+int
+mono_btls_x509_get_issuer_name_string (X509 *name, char *buffer, int size);
+
+int
+mono_btls_x509_get_raw_data (X509 *x509, BIO *bio, MonoBtlsX509Format format);
+
+int
+mono_btls_x509_cmp (const X509 *a, const X509 *b);
+
+int
+mono_btls_x509_get_hash (X509 *x509, const void **data);
+
+int64_t
+mono_btls_x509_get_not_before (X509 *x509);
+
+int64_t
+mono_btls_x509_get_not_after (X509 *x509);
+
+int
+mono_btls_x509_get_public_key (X509 *x509, BIO *bio);
+
+int
+mono_btls_x509_get_public_key_parameters (X509 *x509, char *out_oid, int oid_len, uint8_t **buffer, int *size);
+
+int
+mono_btls_x509_get_serial_number (X509 *x509, char *buffer, int size, int mono_style);
+
+int
+mono_btls_x509_get_public_key_algorithm (X509 *x509, char *buffer, int size);
+
+int
+mono_btls_x509_get_version (X509 *x509);
+
+int
+mono_btls_x509_get_signature_algorithm (X509 *x509, char *buffer, int size);
+
+int
+mono_btls_x509_get_public_key_asn1 (X509 *x509, char *out_oid, int oid_len, uint8_t **buffer, int *size);
+
+EVP_PKEY *
+mono_btls_x509_get_pubkey (X509 *x509);
+
+int
+mono_btls_x509_get_subject_key_identifier (X509 *x509, uint8_t **buffer, int *size);
+
+int
+mono_btls_x509_print (X509 *x509, BIO *bio);
+
+int
+mono_btls_x509_add_trust_object (X509 *x509, MonoBtlsX509Purpose purpose);
+
+int
+mono_btls_x509_add_reject_object (X509 *x509, MonoBtlsX509Purpose purpose);
+
+int
+mono_btls_x509_add_explicit_trust (X509 *x509, MonoBtlsX509TrustKind kind);
+
+#endif /* defined(__btls__btls_x509__) */
diff --git a/mono/btls/create-object-library.sh b/mono/btls/create-object-library.sh
new file mode 100755 (executable)
index 0000000..8ceda08
--- /dev/null
@@ -0,0 +1,33 @@
+#!/bin/sh
+
+DIR=$1; shift
+FILELIST=$1; shift
+LOFILELIST=$1 ; shift
+TARGET=$1; shift
+STATIC=$1; shift
+AR=$1; shift
+RANLIB=$1; shift
+
+HEADER="# Generated by Martin's tool $0, not libtool"
+
+test -f $TARGET && exit 0
+
+rm -f $FILELIST
+rm -f $LOFILELIST
+
+while [ "$1" != "--" ]; do
+       file=$1; shift
+       filename=`basename $file`
+       LOFILE=$file.lo
+       echo "$HEADER" > $LOFILE
+       if [ "$STATIC" = "static" ]; then
+               echo "non_pic_object='$filename'" >> $LOFILE
+       else
+               echo "pic_object='$filename'" >> $LOFILE
+       fi
+       echo "$DIR/$file " >> $FILELIST
+       echo "$DIR/$LOFILE " >> $LOFILELIST
+done
+
+(cd $DIR && $AR cr $TARGET `cat $FILELIST` && $RANLIB $TARGET)
+
index f3724e4384debca76a5eae810a91e4dc8333e278..ca9c92e0ae60cdb0a808a654ade306a8d2565c70 100755 (executable)
@@ -1103,8 +1103,8 @@ dis_stringify_object_with_class (MonoImage *m, MonoClass *c, gboolean prefix, gb
 
        esname = get_escaped_class_name (c);
 
-       if (c->generic_class) {
-               MonoGenericClass *gclass = c->generic_class;
+       if (mono_class_is_ginst (c)) {
+               MonoGenericClass *gclass = mono_class_get_generic_class (c);
                MonoGenericInst *inst = gclass->context.class_inst;
                GString *str = g_string_new ("");
                int i;
@@ -1847,7 +1847,7 @@ get_memberref_container (MonoImage *m, guint32 mrp_token, MonoGenericContainer *
        case 4: /* TypeSpec */
                klass = mono_class_get_full (m, MONO_TOKEN_TYPE_SPEC | idx, (MonoGenericContext *) container);
                g_assert (klass);
-               return klass->generic_class ? klass->generic_class->container_class->generic_container : NULL;
+               return mono_class_is_ginst (klass) ? mono_class_get_generic_container (mono_class_get_generic_class (klass)->container_class) : NULL;
        }
        g_assert_not_reached ();
        return NULL;
@@ -3108,7 +3108,7 @@ get_method_override (MonoImage *m, guint32 token, MonoGenericContainer *containe
                        MonoMethod *mh = NULL;
                        mh = mono_get_method_checked (m, decl, NULL, (MonoGenericContext *) container, &error);
 
-                       if (mh && (mh->klass && (mh->klass->generic_class || mh->klass->generic_container))) {
+                       if (mh && (mh->klass && (mono_class_is_ginst (mh->klass) || mono_class_is_gtd (mh->klass)))) {
                                char *meth_str;
                                char *ret;
                                
index 1af061c383ad8b58abc1d42a636c8b4de55d26b1..53de00ae71577c4a902472c6a2448a648608bf62 100644 (file)
@@ -32,6 +32,7 @@
 #include <mono/metadata/assembly.h>
 #include <mono/metadata/appdomain.h>
 #include <mono/utils/bsearch.h>
+#include <mono/utils/mono-counters.h>
 
 static void     setup_filter          (MonoImage *image);
 static gboolean should_include_type   (int idx);
@@ -1963,9 +1964,16 @@ usage (void)
        exit (1);
 }
 
+static void
+thread_state_init (MonoThreadUnwindState *ctx)
+{
+}
+
 int
 main (int argc, char *argv [])
 {
+       MonoThreadInfoRuntimeCallbacks ticallbacks;
+
        GList *input_files = NULL, *l;
        int i, j;
 
@@ -2016,6 +2024,15 @@ main (int argc, char *argv [])
        if (input_files == NULL)
                usage ();
 
+       CHECKED_MONO_INIT ();
+       mono_counters_init ();
+       memset (&ticallbacks, 0, sizeof (ticallbacks));
+       ticallbacks.thread_state_init = thread_state_init;
+#ifndef HOST_WIN32
+       mono_w32handle_init ();
+#endif
+       mono_threads_runtime_init (&ticallbacks);
+
        mono_install_assembly_load_hook (monodis_assembly_load_hook, NULL);
        mono_install_assembly_search_hook (monodis_assembly_search_hook, NULL);
 
index 0eb885e055e4a843868fbcc00a1f0600a99827a1..934ed07b7293d62a3d769ac4e3146079a50aeb79 100644 (file)
@@ -11,20 +11,14 @@ AM_CPPFLAGS = \
 libwapiincludedir = $(includedir)/mono-$(API_VER)/mono/io-layer
 
 OTHER_H = \
-       access.h        \
-       context.h       \
        error.h         \
-       events.h        \
        io.h            \
        io-trace.h      \
        io-layer.h      \
        io-portability.h        \
        macros.h        \
        messages.h      \
-       mutexes.h       \
-       processes.h     \
        security.h      \
-       semaphores.h    \
        sockets.h       \
        status.h        \
        timefuncs.h     \
@@ -36,14 +30,8 @@ OTHER_H = \
        wapi-remap.h
 
 OTHER_SRC = \
-       access.h                \
-       context.c               \
-       context.h               \
        error.c                 \
        error.h                 \
-       events.c                \
-       events.h                \
-       event-private.h         \
        io.c                    \
        io.h                    \
        io-portability.c        \
@@ -54,20 +42,9 @@ OTHER_SRC = \
        macros.h                \
        messages.c              \
        messages.h              \
-       mutexes.c               \
-       mutexes.h               \
-       mutex-private.h         \
        posix.c                 \
-       processes.c             \
-       processes.h             \
-       process-private.h       \
        security.c              \
        security.h              \
-       semaphores.c            \
-       semaphores.h            \
-       semaphore-private.h     \
-       shared.c                \
-       shared.h                \
        sockets.c               \
        sockets.h               \
        socket-private.h        \
@@ -75,7 +52,6 @@ OTHER_SRC = \
        status.h                \
        timefuncs.c             \
        timefuncs.h             \
-       timefuncs-private.h     \
        types.h                 \
        uglify.h                \
        versioninfo.c           \
diff --git a/mono/io-layer/access.h b/mono/io-layer/access.h
deleted file mode 100644 (file)
index 2cb48b3..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * access.h:  Access control definitions
- *
- * Author:
- *     Dick Porter (dick@ximian.com)
- *
- * (C) 2002 Ximian, Inc.
- */
-
-#ifndef _WAPI_ACCESS_H_
-#define _WAPI_ACCESS_H_
-
-#include <glib.h>
-
-#include <mono/io-layer/wapi.h>
-
-#define SYNCHRONIZE                    0x00100000
-#define STANDARD_RIGHTS_REQUIRED       0x000f0000
-
-#endif /* _WAPI_ACCESS_H_ */
diff --git a/mono/io-layer/context.c b/mono/io-layer/context.c
deleted file mode 100644 (file)
index 75155a4..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * context.c:  Processor-specific register contexts
- *
- * Author:
- *     Dick Porter (dick@ximian.com)
- *
- * (C) 2002 Ximian, Inc.
- */
-
-#include <config.h>
-#include <glib.h>
-#include <pthread.h>
-
-#include "mono/io-layer/wapi.h"
-
-gboolean GetThreadContext(gpointer handle G_GNUC_UNUSED, WapiContext *context G_GNUC_UNUSED)
-{
-       return(FALSE);
-}
-
-
-
diff --git a/mono/io-layer/context.h b/mono/io-layer/context.h
deleted file mode 100644 (file)
index 2d0e814..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * context.h:  Processor-specific register contexts
- *
- * Author:
- *     Dick Porter (dick@ximian.com)
- *
- * (C) 2002 Ximian, Inc.
- */
-
-#ifndef _WAPI_CONTEXT_H_
-#define _WAPI_CONTEXT_H_
-
-#include <glib.h>
-
-#include "mono/io-layer/wapi.h"
-
-/* This part is x86-specific.  MSDN states that CONTEXT is defined
- * also for MIPS, Alpha and PPC processors.
- */
-
-#define SIZE_OF_80387_REGISTERS 80
-
-#define CONTEXT_i386 0x00010000
-#define CONTEXT_i486 0x00010000
-
-#define CONTEXT_CONTROL                        (CONTEXT_i386 | 0x00000001L)
-#define CONTEXT_INTEGER                        (CONTEXT_i386 | 0x00000002L)
-#define CONTEXT_SEGMENTS               (CONTEXT_i386 | 0x00000004L)
-#define CONTEXT_FLOATING_POINT         (CONTEXT_i386 | 0x00000008L)
-#define CONTEXT_DEBUG_REGISTERS                (CONTEXT_i386 | 0x00000010L)
-#define CONTEXT_EXTENDED_REGISTERS     (CONTEXT_i386 | 0x00000020L)
-
-#define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS)
-
-#define MAXIMUM_SUPPORTED_EXTENSION 512
-
-typedef struct 
-{
-       guint32 ControlWord;
-       guint32 StatusWord;
-       guint32 TagWord;
-       guint32 ErrorOffset;
-       guint32 ErrorSelector;
-       guint32 DataOffset;
-       guint32 DataSelector;
-       guint8 RegisterArea[SIZE_OF_80387_REGISTERS];
-       guint32 Cr0NpxState;
-} WapiFloatingSaveArea;
-
-typedef struct 
-{
-       guint32 ContextFlags;
-       guint32 Dr0;
-       guint32 Dr1;
-       guint32 Dr2;
-       guint32 Dr3;
-       guint32 Dr6;
-       guint32 Dr7;
-       
-       WapiFloatingSaveArea FloatSave;
-       
-       guint32 SegGs;
-       guint32 SegFs;
-       guint32 SegEs;
-       guint32 SegDs;
-       
-       guint32 Edi;
-       guint32 Esi;
-       guint32 Ebx;
-       guint32 Edx;
-       guint32 Ecx;
-       guint32 Eax;
-       
-       guint32 Ebp;
-       guint32 Eip;
-       guint32 SegCs;
-       guint32 EFlags;
-       guint32 Esp;
-       guint32 SegSs;
-       
-       guint8 ExtendedRegisters[MAXIMUM_SUPPORTED_EXTENSION];
-} WapiContext;
-
-G_BEGIN_DECLS
-
-extern gboolean GetThreadContext(gpointer handle, WapiContext *context);
-
-G_END_DECLS
-
-#endif /* _WAPI_COMPEX_H_ */
index db128be5c72a6c3948f3056f915c02284e5461ca..bc884c3d8d9f14f8f97385b51ff70fae3f3bc713 100644 (file)
 
 #include "mono/io-layer/wapi.h"
 #include "mono/io-layer/wapi-private.h"
-#include "mono/utils/mono-once.h"
+#include "mono/utils/mono-lazy-init.h"
 
 static pthread_key_t error_key;
-static mono_once_t error_key_once=MONO_ONCE_INIT;
+static mono_lazy_init_t error_key_once = MONO_LAZY_INIT_STATUS_NOT_INITIALIZED;
 
 static void error_init(void)
 {
@@ -28,7 +28,7 @@ static void error_init(void)
        g_assert (ret == 0);
 }
 
-void _wapi_error_cleanup (void)
+static void error_cleanup (void)
 {
        int ret;
 
@@ -36,6 +36,11 @@ void _wapi_error_cleanup (void)
        g_assert (ret == 0);
 }
 
+void _wapi_error_cleanup (void)
+{
+       mono_lazy_cleanup (&error_key_once, error_cleanup);
+}
+
 /**
  * GetLastError:
  *
@@ -51,7 +56,7 @@ guint32 GetLastError(void)
 
        if (_wapi_has_shut_down)
                return 0;
-       mono_once(&error_key_once, error_init);
+       mono_lazy_initialize(&error_key_once, error_init);
        errptr=pthread_getspecific(error_key);
        err=GPOINTER_TO_UINT(errptr);
        
@@ -71,7 +76,7 @@ void SetLastError(guint32 code)
        if (_wapi_has_shut_down)
                return;
        /* Set the thread-local error code */
-       mono_once(&error_key_once, error_init);
+       mono_lazy_initialize(&error_key_once, error_init);
        ret = pthread_setspecific(error_key, GUINT_TO_POINTER(code));
        g_assert (ret == 0);
 }
diff --git a/mono/io-layer/event-private.h b/mono/io-layer/event-private.h
deleted file mode 100644 (file)
index 07b35e0..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * event-private.h:  Private definitions for event handles
- *
- * Author:
- *     Dick Porter (dick@ximian.com)
- *
- * (C) 2002 Ximian, Inc.
- */
-
-#ifndef _WAPI_EVENT_PRIVATE_H_
-#define _WAPI_EVENT_PRIVATE_H_
-
-#include <config.h>
-#include <glib.h>
-#include <pthread.h>
-
-#include "wapi-private.h"
-
-struct _WapiHandle_event
-{
-       gboolean manual;
-       guint32 set_count;
-};
-
-struct _WapiHandle_namedevent
-{
-       struct _WapiHandle_event e;
-       WapiSharedNamespace sharedns;
-};
-
-void
-_wapi_event_init (void);
-
-#endif /* _WAPI_EVENT_PRIVATE_H_ */
diff --git a/mono/io-layer/events.c b/mono/io-layer/events.c
deleted file mode 100644 (file)
index 8e3fa4a..0000000
+++ /dev/null
@@ -1,516 +0,0 @@
-/*
- * events.c:  Event handles
- *
- * Author:
- *     Dick Porter (dick@ximian.com)
- *
- * (C) 2002 Ximian, Inc.
- */
-
-#include <config.h>
-#include <glib.h>
-#include <pthread.h>
-#include <string.h>
-
-#include <mono/io-layer/wapi.h>
-#include <mono/io-layer/wapi-private.h>
-#include <mono/io-layer/event-private.h>
-#include <mono/io-layer/io-trace.h>
-#include <mono/utils/mono-once.h>
-#include <mono/utils/mono-logger-internals.h>
-#include <mono/utils/w32handle.h>
-
-static void event_signal(gpointer handle);
-static gboolean event_own (gpointer handle);
-static void event_details (gpointer data);
-static const gchar* event_typename (void);
-static gsize event_typesize (void);
-
-static void namedevent_signal (gpointer handle);
-static gboolean namedevent_own (gpointer handle);
-static void namedevent_details (gpointer data);
-static const gchar* namedevent_typename (void);
-static gsize namedevent_typesize (void);
-
-static MonoW32HandleOps _wapi_event_ops = {
-       NULL,                   /* close */
-       event_signal,           /* signal */
-       event_own,              /* own */
-       NULL,                   /* is_owned */
-       NULL,                   /* special_wait */
-       NULL,                   /* prewait */
-       event_details,  /* details */
-       event_typename, /* typename */
-       event_typesize, /* typesize */
-};
-
-static MonoW32HandleOps _wapi_namedevent_ops = {
-       NULL,                   /* close */
-       namedevent_signal,      /* signal */
-       namedevent_own,         /* own */
-       NULL,                   /* is_owned */
-       NULL,                   /* special_wait */
-       NULL,                   /* prewait */
-       namedevent_details,     /* details */
-       namedevent_typename, /* typename */
-       namedevent_typesize, /* typesize */
-};
-
-void
-_wapi_event_init (void)
-{
-       mono_w32handle_register_ops (MONO_W32HANDLE_EVENT,      &_wapi_event_ops);
-       mono_w32handle_register_ops (MONO_W32HANDLE_NAMEDEVENT, &_wapi_namedevent_ops);
-
-       mono_w32handle_register_capabilities (MONO_W32HANDLE_EVENT,
-               (MonoW32HandleCapability)(MONO_W32HANDLE_CAP_WAIT | MONO_W32HANDLE_CAP_SIGNAL));
-       mono_w32handle_register_capabilities (MONO_W32HANDLE_NAMEDEVENT,
-               (MonoW32HandleCapability)(MONO_W32HANDLE_CAP_WAIT | MONO_W32HANDLE_CAP_SIGNAL));
-}
-
-static const char* event_handle_type_to_string (MonoW32HandleType type)
-{
-       switch (type) {
-       case MONO_W32HANDLE_EVENT: return "event";
-       case MONO_W32HANDLE_NAMEDEVENT: return "named event";
-       default:
-               g_assert_not_reached ();
-       }
-}
-
-static gboolean event_handle_own (gpointer handle, MonoW32HandleType type)
-{
-       struct _WapiHandle_event *event_handle;
-       gboolean ok;
-
-       ok = mono_w32handle_lookup (handle, type, (gpointer *)&event_handle);
-       if (!ok) {
-               g_warning ("%s: error looking up %s handle %p",
-                       __func__, event_handle_type_to_string (type), handle);
-               return FALSE;
-       }
-
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: owning %s handle %p",
-               __func__, event_handle_type_to_string (type), handle);
-
-       if (!event_handle->manual) {
-               g_assert (event_handle->set_count > 0);
-               event_handle->set_count --;
-
-               if (event_handle->set_count == 0)
-                       mono_w32handle_set_signal_state (handle, FALSE, FALSE);
-       }
-
-       return TRUE;
-}
-
-static void event_signal(gpointer handle)
-{
-       SetEvent(handle);
-}
-
-static gboolean event_own (gpointer handle)
-{
-       return event_handle_own (handle, MONO_W32HANDLE_EVENT);
-}
-
-static void namedevent_signal (gpointer handle)
-{
-       SetEvent (handle);
-}
-
-/* NB, always called with the shared handle lock held */
-static gboolean namedevent_own (gpointer handle)
-{
-       return event_handle_own (handle, MONO_W32HANDLE_NAMEDEVENT);
-}
-
-static void event_details (gpointer data)
-{
-       struct _WapiHandle_event *event = (struct _WapiHandle_event *)data;
-       g_print ("manual: %s, set_count: %d",
-               event->manual ? "TRUE" : "FALSE", event->set_count);
-}
-
-static void namedevent_details (gpointer data)
-{
-       struct _WapiHandle_namedevent *namedevent = (struct _WapiHandle_namedevent *)data;
-       g_print ("manual: %s, set_count: %d, name: \"%s\"",
-               namedevent->e.manual ? "TRUE" : "FALSE", namedevent->e.set_count, namedevent->sharedns.name);
-}
-
-static const gchar* event_typename (void)
-{
-       return "Event";
-}
-
-static gsize event_typesize (void)
-{
-       return sizeof (struct _WapiHandle_event);
-}
-
-static const gchar* namedevent_typename (void)
-{
-       return "N.Event";
-}
-
-static gsize namedevent_typesize (void)
-{
-       return sizeof (struct _WapiHandle_namedevent);
-}
-
-static gpointer event_handle_create (struct _WapiHandle_event *event_handle, MonoW32HandleType type, gboolean manual, gboolean initial)
-{
-       gpointer handle;
-       int thr_ret;
-
-       event_handle->manual = manual;
-       event_handle->set_count = (initial && !manual) ? 1 : 0;
-
-       handle = mono_w32handle_new (type, event_handle);
-       if (handle == INVALID_HANDLE_VALUE) {
-               g_warning ("%s: error creating %s handle",
-                       __func__, event_handle_type_to_string (type));
-               SetLastError (ERROR_GEN_FAILURE);
-               return NULL;
-       }
-
-       thr_ret = mono_w32handle_lock_handle (handle);
-       g_assert (thr_ret == 0);
-
-       if (initial)
-               mono_w32handle_set_signal_state (handle, TRUE, FALSE);
-
-       thr_ret = mono_w32handle_unlock_handle (handle);
-       g_assert (thr_ret == 0);
-
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: created %s handle %p",
-               __func__, event_handle_type_to_string (type), handle);
-
-       return handle;
-}
-
-static gpointer event_create (gboolean manual, gboolean initial)
-{
-       struct _WapiHandle_event event_handle;
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: creating %s handle",
-               __func__, event_handle_type_to_string (MONO_W32HANDLE_EVENT));
-       return event_handle_create (&event_handle, MONO_W32HANDLE_EVENT, manual, initial);
-}
-
-static gpointer namedevent_create (gboolean manual, gboolean initial, const gunichar2 *name G_GNUC_UNUSED)
-{
-       gpointer handle;
-       gchar *utf8_name;
-       int thr_ret;
-
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: creating %s handle",
-               __func__, event_handle_type_to_string (MONO_W32HANDLE_NAMEDEVENT));
-
-       /* w32 seems to guarantee that opening named objects can't race each other */
-       thr_ret = _wapi_namespace_lock ();
-       g_assert (thr_ret == 0);
-
-       utf8_name = g_utf16_to_utf8 (name, -1, NULL, NULL, NULL);
-
-       handle = _wapi_search_handle_namespace (MONO_W32HANDLE_NAMEDEVENT, utf8_name);
-       if (handle == INVALID_HANDLE_VALUE) {
-               /* The name has already been used for a different object. */
-               handle = NULL;
-               SetLastError (ERROR_INVALID_HANDLE);
-       } else if (handle) {
-               /* Not an error, but this is how the caller is informed that the event wasn't freshly created */
-               SetLastError (ERROR_ALREADY_EXISTS);
-
-               /* this is used as creating a new handle */
-               mono_w32handle_ref (handle);
-       } else {
-               /* A new named event */
-               struct _WapiHandle_namedevent namedevent_handle;
-
-               strncpy (&namedevent_handle.sharedns.name [0], utf8_name, MAX_PATH);
-               namedevent_handle.sharedns.name [MAX_PATH] = '\0';
-
-               handle = event_handle_create ((struct _WapiHandle_event*) &namedevent_handle, MONO_W32HANDLE_NAMEDEVENT, manual, initial);
-       }
-
-       g_free (utf8_name);
-
-       thr_ret = _wapi_namespace_unlock (NULL);
-       g_assert (thr_ret == 0);
-
-       return handle;
-}
-
-
-/**
- * CreateEvent:
- * @security: Ignored for now.
- * @manual: Specifies whether the new event handle has manual or auto
- * reset behaviour.
- * @initial: Specifies whether the new event handle is initially
- * signalled or not.
- * @name:Pointer to a string specifying the name of this name, or
- * %NULL.  Currently ignored.
- *
- * Creates a new event handle.
- *
- * An event handle is signalled with SetEvent().  If the new handle is
- * a manual reset event handle, it remains signalled until it is reset
- * with ResetEvent().  An auto reset event remains signalled until a
- * single thread has waited for it, at which time the event handle is
- * automatically reset to unsignalled.
- *
- * Return value: A new handle, or %NULL on error.
- */
-gpointer CreateEvent(WapiSecurityAttributes *security G_GNUC_UNUSED,
-                    gboolean manual, gboolean initial,
-                    const gunichar2 *name G_GNUC_UNUSED)
-{
-       /* Need to blow away any old errors here, because code tests
-        * for ERROR_ALREADY_EXISTS on success (!) to see if an event
-        * was freshly created
-        */
-       SetLastError (ERROR_SUCCESS);
-
-       return name ? namedevent_create (manual, initial, name) : event_create (manual, initial);
-}
-
-/**
- * PulseEvent:
- * @handle: The event handle.
- *
- * Sets the event handle @handle to the signalled state, and then
- * resets it to unsignalled after informing any waiting threads.
- *
- * If @handle is a manual reset event, all waiting threads that can be
- * released immediately are released.  @handle is then reset.  If
- * @handle is an auto reset event, one waiting thread is released even
- * if multiple threads are waiting.
- *
- * Return value: %TRUE on success, %FALSE otherwise.  (Currently only
- * ever returns %TRUE).
- */
-gboolean PulseEvent(gpointer handle)
-{
-       MonoW32HandleType type;
-       struct _WapiHandle_event *event_handle;
-       int thr_ret;
-
-       if (handle == NULL) {
-               SetLastError (ERROR_INVALID_HANDLE);
-               return(FALSE);
-       }
-
-       switch (type = mono_w32handle_get_type (handle)) {
-       case MONO_W32HANDLE_EVENT:
-       case MONO_W32HANDLE_NAMEDEVENT:
-               break;
-       default:
-               SetLastError (ERROR_INVALID_HANDLE);
-               return FALSE;
-       }
-
-       if (!mono_w32handle_lookup (handle, type, (gpointer *)&event_handle)) {
-               g_warning ("%s: error looking up %s handle %p",
-                       __func__, event_handle_type_to_string (type), handle);
-               return FALSE;
-       }
-
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: pulsing %s handle %p",
-               __func__, event_handle_type_to_string (type), handle);
-
-       thr_ret = mono_w32handle_lock_handle (handle);
-       g_assert (thr_ret == 0);
-
-       if (!event_handle->manual) {
-               event_handle->set_count = 1;
-               mono_w32handle_set_signal_state (handle, TRUE, FALSE);
-       } else {
-               mono_w32handle_set_signal_state (handle, TRUE, TRUE);
-
-               thr_ret = mono_w32handle_unlock_handle (handle);
-               g_assert (thr_ret == 0);
-
-               /* For a manual-reset event, we're about to try and get the handle
-                * lock again, so give other threads a chance */
-               sched_yield ();
-
-               /* Reset the handle signal state */
-
-               /* I'm not sure whether or not we need a barrier here to make sure
-                * that all threads waiting on the event have proceeded. Currently
-                * we rely on broadcasting a condition. */
-
-               thr_ret = mono_w32handle_lock_handle (handle);
-               g_assert (thr_ret == 0);
-
-               mono_w32handle_set_signal_state (handle, FALSE, FALSE);
-       }
-
-       thr_ret = mono_w32handle_unlock_handle (handle);
-       g_assert (thr_ret == 0);
-
-       return TRUE;
-}
-
-/**
- * ResetEvent:
- * @handle: The event handle.
- *
- * Resets the event handle @handle to the unsignalled state.
- *
- * Return value: %TRUE on success, %FALSE otherwise.  (Currently only
- * ever returns %TRUE).
- */
-gboolean ResetEvent(gpointer handle)
-{
-       MonoW32HandleType type;
-       struct _WapiHandle_event *event_handle;
-       int thr_ret;
-
-       SetLastError (ERROR_SUCCESS);
-       
-       if (handle == NULL) {
-               SetLastError (ERROR_INVALID_HANDLE);
-               return(FALSE);
-       }
-       
-       switch (type = mono_w32handle_get_type (handle)) {
-       case MONO_W32HANDLE_EVENT:
-       case MONO_W32HANDLE_NAMEDEVENT:
-               break;
-       default:
-               SetLastError (ERROR_INVALID_HANDLE);
-               return FALSE;
-       }
-
-       if (!mono_w32handle_lookup (handle, type, (gpointer *)&event_handle)) {
-               g_warning ("%s: error looking up %s handle %p",
-                       __func__, event_handle_type_to_string (type), handle);
-               return FALSE;
-       }
-
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: resetting %s handle %p",
-               __func__, event_handle_type_to_string (type), handle);
-
-       thr_ret = mono_w32handle_lock_handle (handle);
-       g_assert (thr_ret == 0);
-
-       if (!mono_w32handle_issignalled (handle)) {
-               MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: no need to reset %s handle %p",
-                       __func__, event_handle_type_to_string (type), handle);
-       } else {
-               MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: obtained write lock on %s handle %p",
-                       __func__, event_handle_type_to_string (type), handle);
-
-               mono_w32handle_set_signal_state (handle, FALSE, FALSE);
-       }
-
-       event_handle->set_count = 0;
-
-       thr_ret = mono_w32handle_unlock_handle (handle);
-       g_assert (thr_ret == 0);
-
-       return TRUE;
-}
-
-/**
- * SetEvent:
- * @handle: The event handle
- *
- * Sets the event handle @handle to the signalled state.
- *
- * If @handle is a manual reset event, it remains signalled until it
- * is reset with ResetEvent().  An auto reset event remains signalled
- * until a single thread has waited for it, at which time @handle is
- * automatically reset to unsignalled.
- *
- * Return value: %TRUE on success, %FALSE otherwise.  (Currently only
- * ever returns %TRUE).
- */
-gboolean SetEvent(gpointer handle)
-{
-       MonoW32HandleType type;
-       struct _WapiHandle_event *event_handle;
-       int thr_ret;
-       
-       if (handle == NULL) {
-               SetLastError (ERROR_INVALID_HANDLE);
-               return(FALSE);
-       }
-       
-       switch (type = mono_w32handle_get_type (handle)) {
-       case MONO_W32HANDLE_EVENT:
-       case MONO_W32HANDLE_NAMEDEVENT:
-               break;
-       default:
-               SetLastError (ERROR_INVALID_HANDLE);
-               return FALSE;
-       }
-
-       if (!mono_w32handle_lookup (handle, type, (gpointer *)&event_handle)) {
-               g_warning ("%s: error looking up %s handle %p",
-                       __func__, event_handle_type_to_string (type), handle);
-               return FALSE;
-       }
-
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: setting %s handle %p",
-               __func__, event_handle_type_to_string (type), handle);
-
-       thr_ret = mono_w32handle_lock_handle (handle);
-       g_assert (thr_ret == 0);
-
-       if (!event_handle->manual) {
-               event_handle->set_count = 1;
-               mono_w32handle_set_signal_state (handle, TRUE, FALSE);
-       } else {
-               mono_w32handle_set_signal_state (handle, TRUE, TRUE);
-       }
-
-       thr_ret = mono_w32handle_unlock_handle (handle);
-       g_assert (thr_ret == 0);
-
-       return TRUE;
-}
-
-gpointer OpenEvent (guint32 access G_GNUC_UNUSED, gboolean inherit G_GNUC_UNUSED, const gunichar2 *name)
-{
-       gpointer handle;
-       gchar *utf8_name;
-       int thr_ret;
-
-       /* w32 seems to guarantee that opening named objects can't
-        * race each other
-        */
-       thr_ret = _wapi_namespace_lock ();
-       g_assert (thr_ret == 0);
-
-       utf8_name = g_utf16_to_utf8 (name, -1, NULL, NULL, NULL);
-       
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Opening named event [%s]", __func__, utf8_name);
-       
-       handle = _wapi_search_handle_namespace (MONO_W32HANDLE_NAMEDEVENT,
-                                               utf8_name);
-       if (handle == INVALID_HANDLE_VALUE) {
-               /* The name has already been used for a different
-                * object.
-                */
-               SetLastError (ERROR_INVALID_HANDLE);
-               goto cleanup;
-       } else if (!handle) {
-               /* This name doesn't exist */
-               SetLastError (ERROR_FILE_NOT_FOUND);    /* yes, really */
-               goto cleanup;
-       }
-
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: returning named event handle %p", __func__, handle);
-
-cleanup:
-       g_free (utf8_name);
-
-       _wapi_namespace_unlock (NULL);
-       
-       return handle;
-
-}
diff --git a/mono/io-layer/events.h b/mono/io-layer/events.h
deleted file mode 100644 (file)
index 577f57b..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * events.h:  Event handles
- *
- * Author:
- *     Dick Porter (dick@ximian.com)
- *
- * (C) 2002 Ximian, Inc.
- */
-
-#ifndef _WAPI_EVENTS_H_
-#define _WAPI_EVENTS_H_
-
-#include <glib.h>
-
-G_BEGIN_DECLS
-
-extern gpointer CreateEvent (WapiSecurityAttributes *security, gboolean manual,
-                            gboolean initial, const gunichar2 *name);
-extern gboolean PulseEvent (gpointer handle);
-extern gboolean ResetEvent (gpointer handle);
-extern gboolean SetEvent (gpointer handle);
-extern gpointer OpenEvent (guint32 access, gboolean inherit,
-                          const gunichar2 *name);
-
-G_END_DECLS
-
-#endif /* _WAPI_EVENTS_H_ */
index a3cbe2abfee3419be56e504891aa2e749f9ed3cf..e9096e25580ee216938e36854d2668b6325b4a45 100755 (executable)
@@ -11,6 +11,9 @@
 #ifndef _MONO_IOLAYER_IOLAYER_H_
 #define _MONO_IOLAYER_IOLAYER_H_
 
+#include <config.h>
+#include <glib.h>
+
 #if defined(__WIN32__) || defined(_WIN32)
 /* Native win32 */
 #define __USE_W32_SOCKETS
@@ -25,8 +28,8 @@
 #include <ws2tcpip.h>
 #endif
 #include <psapi.h>
-#include <shlobj.h>
-/*
+
+ /*
  * Workaround for missing WSAPOLLFD typedef in mingw's winsock2.h that is required for mswsock.h below.
  * Remove once http://sourceforge.net/p/mingw/bugs/1980/ is fixed.
  */
@@ -37,7 +40,11 @@ typedef struct pollfd {
   short  revents;
 } WSAPOLLFD, *PWSAPOLLFD, *LPWSAPOLLFD;
 #endif
+
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
 #include <mswsock.h>
+#endif
+
 #else  /* EVERYONE ELSE */
 #include "mono/io-layer/wapi.h"
 #include "mono/io-layer/uglify.h"
index 3a275dc83513af2c1aedabb890fa8a763fc29d61..70a374557dd3a9a16f32956790699accd6efdfb7 100644 (file)
 #include <mono/io-layer/wapi.h>
 #include <mono/io-layer/wapi-private.h>
 #include <mono/io-layer/io-private.h>
-#include <mono/io-layer/timefuncs-private.h>
+#include <mono/io-layer/timefuncs.h>
 #include <mono/io-layer/io-portability.h>
 #include <mono/io-layer/io-trace.h>
 #include <mono/utils/strenc.h>
 #include <mono/utils/mono-once.h>
 #include <mono/utils/mono-logger-internals.h>
-#include <mono/utils/w32handle.h>
+#include <mono/metadata/w32handle.h>
 
 /*
  * If SHM is disabled, this will point to a hash of _WapiFileShare structures, otherwise
  * 4MB array.
  */
 static GHashTable *file_share_hash;
-static mono_mutex_t file_share_hash_mutex;
-
-#define file_share_hash_lock() mono_os_mutex_lock (&file_share_hash_mutex)
-#define file_share_hash_unlock() mono_os_mutex_unlock (&file_share_hash_mutex)
+static mono_mutex_t file_share_mutex;
 
 static void
 _wapi_handle_share_release (_WapiFileShare *share_info)
 {
-       int thr_ret;
+       /* Prevent new entries racing with us */
+       mono_os_mutex_lock (&file_share_mutex);
 
        g_assert (share_info->handle_refs > 0);
-       
-       /* Prevent new entries racing with us */
-       thr_ret = _wapi_shm_sem_lock (_WAPI_SHARED_SEM_FILESHARE);
-       g_assert(thr_ret == 0);
+       share_info->handle_refs -= 1;
 
-       if (InterlockedDecrement ((gint32 *)&share_info->handle_refs) == 0) {
-               file_share_hash_lock ();
+       if (share_info->handle_refs == 0)
                g_hash_table_remove (file_share_hash, share_info);
-               file_share_hash_unlock ();
-       }
 
-       thr_ret = _wapi_shm_sem_unlock (_WAPI_SHARED_SEM_FILESHARE);
-       g_assert (thr_ret == 0);
+       mono_os_mutex_unlock (&file_share_mutex);
 }
 
 static gint
@@ -101,12 +92,10 @@ _wapi_handle_get_or_set_share (guint64 device, guint64 inode, guint32 new_sharem
        guint32 *old_sharemode, guint32 *old_access, struct _WapiFileShare **share_info)
 {
        struct _WapiFileShare *file_share;
-       int thr_ret;
        gboolean exists = FALSE;
 
        /* Prevent new entries racing with us */
-       thr_ret = _wapi_shm_sem_lock (_WAPI_SHARED_SEM_FILESHARE);
-       g_assert (thr_ret == 0);
+       mono_os_mutex_lock (&file_share_mutex);
 
        _WapiFileShare tmp;
 
@@ -115,23 +104,21 @@ _wapi_handle_get_or_set_share (guint64 device, guint64 inode, guint32 new_sharem
         * info. This is needed even if SHM is disabled, to track sharing inside
         * the current process.
         */
-       if (!file_share_hash) {
+       if (!file_share_hash)
                file_share_hash = g_hash_table_new_full (wapi_share_info_hash, wapi_share_info_equal, NULL, g_free);
-               mono_os_mutex_init_recursive (&file_share_hash_mutex);
-       }
 
        tmp.device = device;
        tmp.inode = inode;
 
-       file_share_hash_lock ();
-
        file_share = (_WapiFileShare *)g_hash_table_lookup (file_share_hash, &tmp);
        if (file_share) {
                *old_sharemode = file_share->sharemode;
                *old_access = file_share->access;
                *share_info = file_share;
 
-               InterlockedIncrement ((gint32 *)&file_share->handle_refs);
+               g_assert (file_share->handle_refs > 0);
+               file_share->handle_refs += 1;
+
                exists = TRUE;
        } else {
                file_share = g_new0 (_WapiFileShare, 1);
@@ -147,10 +134,7 @@ _wapi_handle_get_or_set_share (guint64 device, guint64 inode, guint32 new_sharem
                g_hash_table_insert (file_share_hash, file_share, file_share);
        }
 
-       file_share_hash_unlock ();
-       
-       thr_ret = _wapi_shm_sem_unlock (_WAPI_SHARED_SEM_FILESHARE);
-       g_assert (thr_ret == 0);
+       mono_os_mutex_unlock (&file_share_mutex);
 
        return(exists);
 }
@@ -1780,7 +1764,12 @@ gpointer CreateFile(const gunichar2 *name, guint32 fileaccess,
        if (attrs & FILE_FLAG_RANDOM_ACCESS)
                posix_fadvise (fd, 0, 0, POSIX_FADV_RANDOM);
 #endif
-       
+
+#ifdef F_RDAHEAD
+       if (attrs & FILE_FLAG_SEQUENTIAL_SCAN)
+               fcntl(fd, F_RDAHEAD, 1);
+#endif
+
 #ifndef S_ISFIFO
 #define S_ISFIFO(m) ((m & S_IFIFO) != 0)
 #endif
@@ -1994,9 +1983,14 @@ gboolean MoveFile (const gunichar2 *name, const gunichar2 *dest_name)
                case EXDEV:
                        /* Ignore here, it is dealt with below */
                        break;
-                       
+
+               case ENOENT:
+                       /* We already know src exists. Must be dest that doesn't exist. */
+                       _wapi_set_last_path_error_from_errno (NULL, utf8_dest_name);
+                       break;
+
                default:
-                       _wapi_set_last_path_error_from_errno (NULL, utf8_name);
+                       _wapi_set_last_error_from_errno ();
                }
        }
        
@@ -2033,7 +2027,7 @@ write_file (int src_fd, int dest_fd, struct stat *st_src, gboolean report_errors
        MonoThreadInfo *info = mono_thread_info_current ();
 
        buf_size = buf_size < 8192 ? 8192 : (buf_size > 65536 ? 65536 : buf_size);
-       buf = (char *) malloc (buf_size);
+       buf = (char *) g_malloc (buf_size);
 
        for (;;) {
                remain = read (src_fd, buf, buf_size);
@@ -2044,7 +2038,7 @@ write_file (int src_fd, int dest_fd, struct stat *st_src, gboolean report_errors
                        if (report_errors)
                                _wapi_set_last_error_from_errno ();
 
-                       free (buf);
+                       g_free (buf);
                        return FALSE;
                }
                if (remain == 0) {
@@ -2060,7 +2054,7 @@ write_file (int src_fd, int dest_fd, struct stat *st_src, gboolean report_errors
                                if (report_errors)
                                        _wapi_set_last_error_from_errno ();
                                MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: write failed.", __func__);
-                               free (buf);
+                               g_free (buf);
                                return FALSE;
                        }
 
@@ -2069,7 +2063,7 @@ write_file (int src_fd, int dest_fd, struct stat *st_src, gboolean report_errors
                }
        }
 
-       free (buf);
+       g_free (buf);
        return TRUE ;
 }
 
@@ -2924,7 +2918,6 @@ gboolean FindNextFile (gpointer handle, WapiFindData *find_data)
        gunichar2 *utf16_basename;
        time_t create_time;
        glong bytes;
-       int thr_ret;
        gboolean ret = FALSE;
        
        ok=mono_w32handle_lookup (handle, MONO_W32HANDLE_FIND,
@@ -2936,8 +2929,7 @@ gboolean FindNextFile (gpointer handle, WapiFindData *find_data)
                return(FALSE);
        }
 
-       thr_ret = mono_w32handle_lock_handle (handle);
-       g_assert (thr_ret == 0);
+       mono_w32handle_lock_handle (handle);
        
 retry:
        if (find_handle->count >= find_handle->num) {
@@ -3043,8 +3035,7 @@ retry:
        g_free (utf16_basename);
 
 cleanup:
-       thr_ret = mono_w32handle_unlock_handle (handle);
-       g_assert (thr_ret == 0);
+       mono_w32handle_unlock_handle (handle);
        
        return(ret);
 }
@@ -3061,7 +3052,6 @@ gboolean FindClose (gpointer handle)
 {
        struct _WapiHandle_find *find_handle;
        gboolean ok;
-       int thr_ret;
 
        if (handle == NULL) {
                SetLastError (ERROR_INVALID_HANDLE);
@@ -3077,14 +3067,12 @@ gboolean FindClose (gpointer handle)
                return(FALSE);
        }
 
-       thr_ret = mono_w32handle_lock_handle (handle);
-       g_assert (thr_ret == 0);
+       mono_w32handle_lock_handle (handle);
        
        g_strfreev (find_handle->namelist);
        g_free (find_handle->dir_part);
 
-       thr_ret = mono_w32handle_unlock_handle (handle);
-       g_assert (thr_ret == 0);
+       mono_w32handle_unlock_handle (handle);
        
        mono_w32handle_unref (handle);
        
@@ -4430,6 +4418,7 @@ void
 _wapi_io_init (void)
 {
        mono_os_mutex_init (&stdhandle_mutex);
+       mono_os_mutex_init (&file_share_mutex);
 
        mono_w32handle_register_ops (MONO_W32HANDLE_FILE,    &_wapi_file_ops);
        mono_w32handle_register_ops (MONO_W32HANDLE_CONSOLE, &_wapi_console_ops);
@@ -4448,8 +4437,8 @@ _wapi_io_init (void)
 void
 _wapi_io_cleanup (void)
 {
-       if (file_share_hash) {
+       mono_os_mutex_destroy (&file_share_mutex);
+
+       if (file_share_hash)
                g_hash_table_destroy (file_share_hash);
-               mono_os_mutex_destroy (&file_share_hash_mutex);
-       }
 }
index 001df9bef7e9273d726f2999880915377f1cb9ef..86eb864365f043d173bf1e344414a56610491cdd 100644 (file)
@@ -18,7 +18,7 @@
 #include <mono/io-layer/io-private.h>
 #include <mono/io-layer/io-trace.h>
 #include <mono/utils/mono-logger-internals.h>
-#include <mono/utils/w32handle.h>
+#include <mono/metadata/w32handle.h>
 
 gboolean
 _wapi_lock_file_region (int fd, off_t offset, off_t length)
diff --git a/mono/io-layer/mutex-private.h b/mono/io-layer/mutex-private.h
deleted file mode 100644 (file)
index 50e5b14..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * mutex-private.h:  Private definitions for mutex handles
- *
- * Author:
- *     Dick Porter (dick@ximian.com)
- *
- * (C) 2002 Ximian, Inc.
- */
-
-#ifndef _WAPI_MUTEX_PRIVATE_H_
-#define _WAPI_MUTEX_PRIVATE_H_
-
-#include <config.h>
-#include <glib.h>
-#include <pthread.h>
-#include <sys/types.h>
-
-#include "wapi-private.h"
-
-struct _WapiHandle_mutex
-{
-       pthread_t tid;
-       guint32 recursion;
-};
-
-struct _WapiHandle_namedmutex 
-{
-       struct _WapiHandle_mutex m;
-       WapiSharedNamespace sharedns;
-};
-
-void
-_wapi_mutex_init (void);
-
-#endif /* _WAPI_MUTEX_PRIVATE_H_ */
diff --git a/mono/io-layer/mutexes.c b/mono/io-layer/mutexes.c
deleted file mode 100644 (file)
index dbfe8b1..0000000
+++ /dev/null
@@ -1,507 +0,0 @@
-/*
- * mutexes.c:  Mutex handles
- *
- * Author:
- *     Dick Porter (dick@ximian.com)
- *
- * (C) 2002-2006 Ximian, Inc.
- */
-
-#include <config.h>
-#include <glib.h>
-#include <pthread.h>
-#include <string.h>
-#include <unistd.h>
-
-#include <mono/io-layer/wapi.h>
-#include <mono/io-layer/wapi-private.h>
-#include <mono/io-layer/mutex-private.h>
-#include <mono/io-layer/io-trace.h>
-#include <mono/utils/mono-once.h>
-#include <mono/utils/mono-logger-internals.h>
-#include <mono/utils/w32handle.h>
-
-static void mutex_signal(gpointer handle);
-static gboolean mutex_own (gpointer handle);
-static gboolean mutex_is_owned (gpointer handle);
-static void mutex_prewait (gpointer handle);
-static void mutex_details (gpointer data);
-static const gchar* mutex_typename (void);
-static gsize mutex_typesize (void);
-
-static void namedmutex_signal (gpointer handle);
-static gboolean namedmutex_own (gpointer handle);
-static gboolean namedmutex_is_owned (gpointer handle);
-static void namedmutex_prewait (gpointer handle);
-static void namedmutex_details (gpointer data);
-static const gchar* namedmutex_typename (void);
-static gsize namedmutex_typesize (void);
-
-static MonoW32HandleOps _wapi_mutex_ops = {
-       NULL,                   /* close */
-       mutex_signal,           /* signal */
-       mutex_own,              /* own */
-       mutex_is_owned,         /* is_owned */
-       NULL,                   /* special_wait */
-       mutex_prewait,                  /* prewait */
-       mutex_details,  /* details */
-       mutex_typename, /* typename */
-       mutex_typesize, /* typesize */
-};
-
-static MonoW32HandleOps _wapi_namedmutex_ops = {
-       NULL,                   /* close */
-       namedmutex_signal,      /* signal */
-       namedmutex_own,         /* own */
-       namedmutex_is_owned,    /* is_owned */
-       NULL,                   /* special_wait */
-       namedmutex_prewait,     /* prewait */
-       namedmutex_details,     /* details */
-       namedmutex_typename,    /* typename */
-       namedmutex_typesize,    /* typesize */
-};
-
-void
-_wapi_mutex_init (void)
-{
-       mono_w32handle_register_ops (MONO_W32HANDLE_MUTEX,      &_wapi_mutex_ops);
-       mono_w32handle_register_ops (MONO_W32HANDLE_NAMEDMUTEX, &_wapi_namedmutex_ops);
-
-       mono_w32handle_register_capabilities (MONO_W32HANDLE_MUTEX,
-               (MonoW32HandleCapability)(MONO_W32HANDLE_CAP_WAIT | MONO_W32HANDLE_CAP_SIGNAL | MONO_W32HANDLE_CAP_OWN));
-       mono_w32handle_register_capabilities (MONO_W32HANDLE_NAMEDMUTEX,
-               (MonoW32HandleCapability)(MONO_W32HANDLE_CAP_WAIT | MONO_W32HANDLE_CAP_SIGNAL | MONO_W32HANDLE_CAP_OWN));
-}
-
-static const char* mutex_handle_type_to_string (MonoW32HandleType type)
-{
-       switch (type) {
-       case MONO_W32HANDLE_MUTEX: return "mutex";
-       case MONO_W32HANDLE_NAMEDMUTEX: return "named mutex";
-       default:
-               g_assert_not_reached ();
-       }
-}
-
-static gboolean
-mutex_handle_own (gpointer handle, MonoW32HandleType type)
-{
-       struct _WapiHandle_mutex *mutex_handle;
-
-       if (!mono_w32handle_lookup (handle, type, (gpointer *)&mutex_handle)) {
-               g_warning ("%s: error looking up %s handle %p", __func__, mutex_handle_type_to_string (type), handle);
-               return FALSE;
-       }
-
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: owning %s handle %p, tid %p, recursion %u",
-               __func__, mutex_handle_type_to_string (type), handle, (gpointer) mutex_handle->tid, mutex_handle->recursion);
-
-       mono_thread_info_own_mutex (mono_thread_info_current (), handle);
-
-       mutex_handle->tid = pthread_self ();
-       mutex_handle->recursion++;
-
-       mono_w32handle_set_signal_state (handle, FALSE, FALSE);
-
-       return TRUE;
-}
-
-static gboolean
-mutex_handle_is_owned (gpointer handle, MonoW32HandleType type)
-{
-       struct _WapiHandle_mutex *mutex_handle;
-
-       if (!mono_w32handle_lookup (handle, type, (gpointer *)&mutex_handle)) {
-               g_warning ("%s: error looking up %s handle %p", __func__, mutex_handle_type_to_string (type), handle);
-               return FALSE;
-       }
-
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: testing ownership %s handle %p",
-               __func__, mutex_handle_type_to_string (type), handle);
-
-       if (mutex_handle->recursion > 0 && pthread_equal (mutex_handle->tid, pthread_self ())) {
-               MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: %s handle %p owned by %p",
-                       __func__, mutex_handle_type_to_string (type), handle, (gpointer) pthread_self ());
-               return TRUE;
-       } else {
-               MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: %s handle %p not owned by %p, but locked %d times by %p",
-                       __func__, mutex_handle_type_to_string (type), handle, (gpointer) pthread_self (), mutex_handle->recursion, (gpointer) mutex_handle->tid);
-               return FALSE;
-       }
-}
-
-static void mutex_signal(gpointer handle)
-{
-       ReleaseMutex(handle);
-}
-
-static gboolean mutex_own (gpointer handle)
-{
-       return mutex_handle_own (handle, MONO_W32HANDLE_MUTEX);
-}
-
-static gboolean mutex_is_owned (gpointer handle)
-{
-       
-       return mutex_handle_is_owned (handle, MONO_W32HANDLE_MUTEX);
-}
-
-static void namedmutex_signal (gpointer handle)
-{
-       ReleaseMutex(handle);
-}
-
-/* NB, always called with the shared handle lock held */
-static gboolean namedmutex_own (gpointer handle)
-{
-       return mutex_handle_own (handle, MONO_W32HANDLE_NAMEDMUTEX);
-}
-
-static gboolean namedmutex_is_owned (gpointer handle)
-{
-       return mutex_handle_is_owned (handle, MONO_W32HANDLE_NAMEDMUTEX);
-}
-
-static void mutex_handle_prewait (gpointer handle, MonoW32HandleType type)
-{
-       /* If the mutex is not currently owned, do nothing and let the
-        * usual wait carry on.  If it is owned, check that the owner
-        * is still alive; if it isn't we override the previous owner
-        * and assume that process exited abnormally and failed to
-        * clean up.
-        */
-       struct _WapiHandle_mutex *mutex_handle;
-
-       if (!mono_w32handle_lookup (handle, type, (gpointer *)&mutex_handle)) {
-               g_warning ("%s: error looking up %s handle %p",
-                       __func__, mutex_handle_type_to_string (type), handle);
-               return;
-       }
-
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: pre-waiting %s handle %p, owned? %s",
-               __func__, mutex_handle_type_to_string (type), handle, mutex_handle->recursion != 0 ? "true" : "false");
-}
-
-/* The shared state is not locked when prewait methods are called */
-static void mutex_prewait (gpointer handle)
-{
-       mutex_handle_prewait (handle, MONO_W32HANDLE_MUTEX);
-}
-
-/* The shared state is not locked when prewait methods are called */
-static void namedmutex_prewait (gpointer handle)
-{
-       mutex_handle_prewait (handle, MONO_W32HANDLE_NAMEDMUTEX);
-}
-
-static void mutex_details (gpointer data)
-{
-       struct _WapiHandle_mutex *mut = (struct _WapiHandle_mutex *)data;
-       
-#ifdef PTHREAD_POINTER_ID
-       g_print ("own: %5p, count: %5u", mut->tid, mut->recursion);
-#else
-       g_print ("own: %5ld, count: %5u", mut->tid, mut->recursion);
-#endif
-}
-
-static void namedmutex_details (gpointer data)
-{
-       struct _WapiHandle_namedmutex *namedmut = (struct _WapiHandle_namedmutex *)data;
-       
-#ifdef PTHREAD_POINTER_ID
-       g_print ("own: %5p, count: %5u, name: \"%s\"",
-               namedmut->m.tid, namedmut->m.recursion, namedmut->sharedns.name);
-#else
-       g_print ("own: %5ld, count: %5u, name: \"%s\"",
-               namedmut->m.tid, namedmut->m.recursion, namedmut->sharedns.name);
-#endif
-}
-
-static const gchar* mutex_typename (void)
-{
-       return "Mutex";
-}
-
-static gsize mutex_typesize (void)
-{
-       return sizeof (struct _WapiHandle_mutex);
-}
-
-static const gchar* namedmutex_typename (void)
-{
-       return "N.Mutex";
-}
-
-static gsize namedmutex_typesize (void)
-{
-       return sizeof (struct _WapiHandle_namedmutex);
-}
-
-/* When a thread exits, any mutexes it still holds need to be signalled. */
-void wapi_mutex_abandon (gpointer handle, pid_t pid, pthread_t tid)
-{
-       MonoW32HandleType type;
-       struct _WapiHandle_mutex *mutex_handle;
-       int thr_ret;
-
-       switch (type = mono_w32handle_get_type (handle)) {
-       case MONO_W32HANDLE_MUTEX:
-       case MONO_W32HANDLE_NAMEDMUTEX:
-               break;
-       default:
-               g_assert_not_reached ();
-       }
-
-       if (!mono_w32handle_lookup (handle, type, (gpointer *)&mutex_handle)) {
-               g_warning ("%s: error looking up %s handle %p",
-                       __func__, mutex_handle_type_to_string (type), handle);
-               return;
-       }
-
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: abandon %s handle %p",
-               __func__, mutex_handle_type_to_string (type), handle);
-
-       thr_ret = mono_w32handle_lock_handle (handle);
-       g_assert (thr_ret == 0);
-
-       if (pthread_equal (mutex_handle->tid, tid)) {
-               mutex_handle->recursion = 0;
-               mutex_handle->tid = 0;
-
-               mono_w32handle_set_signal_state (handle, TRUE, FALSE);
-
-               MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: abandoned %s handle %p",
-                       __func__, mutex_handle_type_to_string (type), handle);
-       }
-
-       thr_ret = mono_w32handle_unlock_handle (handle);
-       g_assert (thr_ret == 0);
-}
-
-static gpointer mutex_handle_create (struct _WapiHandle_mutex *mutex_handle, MonoW32HandleType type, gboolean owned)
-{
-       gpointer handle;
-       int thr_ret;
-
-       mutex_handle->tid = 0;
-       mutex_handle->recursion = 0;
-
-       handle = mono_w32handle_new (type, mutex_handle);
-       if (handle == INVALID_HANDLE_VALUE) {
-               g_warning ("%s: error creating %s handle",
-                       __func__, mutex_handle_type_to_string (type));
-               SetLastError (ERROR_GEN_FAILURE);
-               return NULL;
-       }
-
-       thr_ret = mono_w32handle_lock_handle (handle);
-       g_assert (thr_ret == 0);
-
-       if (owned)
-               mutex_handle_own (handle, type);
-       else
-               mono_w32handle_set_signal_state (handle, TRUE, FALSE);
-
-       thr_ret = mono_w32handle_unlock_handle (handle);
-       g_assert (thr_ret == 0);
-
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: created %s handle %p",
-               __func__, mutex_handle_type_to_string (type), handle);
-
-       return handle;
-}
-
-static gpointer mutex_create (gboolean owned)
-{
-       struct _WapiHandle_mutex mutex_handle;
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: creating %s handle",
-               __func__, mutex_handle_type_to_string (MONO_W32HANDLE_MUTEX));
-       return mutex_handle_create (&mutex_handle, MONO_W32HANDLE_MUTEX, owned);
-}
-
-static gpointer namedmutex_create (gboolean owned, const gunichar2 *name)
-{
-       gpointer handle;
-       gchar *utf8_name;
-       int thr_ret;
-
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: creating %s handle",
-               __func__, mutex_handle_type_to_string (MONO_W32HANDLE_NAMEDMUTEX));
-
-       /* w32 seems to guarantee that opening named objects can't race each other */
-       thr_ret = _wapi_namespace_lock ();
-       g_assert (thr_ret == 0);
-
-       utf8_name = g_utf16_to_utf8 (name, -1, NULL, NULL, NULL);
-
-       handle = _wapi_search_handle_namespace (MONO_W32HANDLE_NAMEDMUTEX, utf8_name);
-       if (handle == INVALID_HANDLE_VALUE) {
-               /* The name has already been used for a different object. */
-               handle = NULL;
-               SetLastError (ERROR_INVALID_HANDLE);
-       } else if (handle) {
-               /* Not an error, but this is how the caller is informed that the mutex wasn't freshly created */
-               SetLastError (ERROR_ALREADY_EXISTS);
-
-               /* this is used as creating a new handle */
-               mono_w32handle_ref (handle);
-       } else {
-               /* A new named mutex */
-               struct _WapiHandle_namedmutex namedmutex_handle;
-
-               strncpy (&namedmutex_handle.sharedns.name [0], utf8_name, MAX_PATH);
-               namedmutex_handle.sharedns.name [MAX_PATH] = '\0';
-
-               handle = mutex_handle_create ((struct _WapiHandle_mutex*) &namedmutex_handle, MONO_W32HANDLE_NAMEDMUTEX, owned);
-       }
-
-       g_free (utf8_name);
-
-       thr_ret = _wapi_namespace_unlock (NULL);
-       g_assert (thr_ret == 0);
-
-       return handle;
-}
-
-/**
- * CreateMutex:
- * @security: Ignored for now.
- * @owned: If %TRUE, the mutex is created with the calling thread
- * already owning the mutex.
- * @name:Pointer to a string specifying the name of this mutex, or
- * %NULL.
- *
- * Creates a new mutex handle.  A mutex is signalled when no thread
- * owns it.  A thread acquires ownership of the mutex by waiting for
- * it with WaitForSingleObject() or WaitForMultipleObjects().  A
- * thread relinquishes ownership with ReleaseMutex().
- *
- * A thread that owns a mutex can specify the same mutex in repeated
- * wait function calls without blocking.  The thread must call
- * ReleaseMutex() an equal number of times to release the mutex.
- *
- * Return value: A new handle, or %NULL on error.
- */
-gpointer CreateMutex(WapiSecurityAttributes *security G_GNUC_UNUSED, gboolean owned, const gunichar2 *name)
-{
-       /* Need to blow away any old errors here, because code tests
-        * for ERROR_ALREADY_EXISTS on success (!) to see if a mutex
-        * was freshly created */
-       SetLastError (ERROR_SUCCESS);
-
-       return name ? namedmutex_create (owned, name) : mutex_create (owned);
-}
-
-/**
- * ReleaseMutex:
- * @handle: The mutex handle.
- *
- * Releases ownership if the mutex handle @handle.
- *
- * Return value: %TRUE on success, %FALSE otherwise.  This function
- * fails if the calling thread does not own the mutex @handle.
- */
-gboolean ReleaseMutex(gpointer handle)
-{
-       MonoW32HandleType type;
-       struct _WapiHandle_mutex *mutex_handle;
-       pthread_t tid;
-       int thr_ret;
-       gboolean ret;
-
-       if (handle == NULL) {
-               SetLastError (ERROR_INVALID_HANDLE);
-               return FALSE;
-       }
-
-       switch (type = mono_w32handle_get_type (handle)) {
-       case MONO_W32HANDLE_MUTEX:
-       case MONO_W32HANDLE_NAMEDMUTEX:
-               break;
-       default:
-               SetLastError (ERROR_INVALID_HANDLE);
-               return FALSE;
-       }
-
-       if (!mono_w32handle_lookup (handle, type, (gpointer *)&mutex_handle)) {
-               g_warning ("%s: error looking up %s handle %p",
-                       __func__, mutex_handle_type_to_string (type), handle);
-               return FALSE;
-       }
-
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: releasing %s handle %p",
-               __func__, mutex_handle_type_to_string (type), handle);
-
-       thr_ret = mono_w32handle_lock_handle (handle);
-       g_assert (thr_ret == 0);
-
-       tid = pthread_self ();
-
-       if (!pthread_equal (mutex_handle->tid, tid)) {
-               ret = FALSE;
-
-               MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: we don't own %s handle %p (owned by %ld, me %ld)",
-                       __func__, mutex_handle_type_to_string (type), handle, mutex_handle->tid, tid);
-       } else {
-               ret = TRUE;
-
-               /* OK, we own this mutex */
-               mutex_handle->recursion--;
-
-               if (mutex_handle->recursion == 0) {
-                       mono_thread_info_disown_mutex (mono_thread_info_current (), handle);
-
-                       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: unlocking %s handle %p",
-                               __func__, mutex_handle_type_to_string (type), handle);
-
-                       mutex_handle->tid = 0;
-                       mono_w32handle_set_signal_state (handle, TRUE, FALSE);
-               }
-       }
-
-       thr_ret = mono_w32handle_unlock_handle (handle);
-       g_assert (thr_ret == 0);
-
-       return ret;
-}
-
-gpointer OpenMutex (guint32 access G_GNUC_UNUSED, gboolean inherit G_GNUC_UNUSED, const gunichar2 *name)
-{
-       gpointer handle;
-       gchar *utf8_name;
-       int thr_ret;
-
-       /* w32 seems to guarantee that opening named objects can't
-        * race each other
-        */
-       thr_ret = _wapi_namespace_lock ();
-       g_assert (thr_ret == 0);
-
-       utf8_name = g_utf16_to_utf8 (name, -1, NULL, NULL, NULL);
-       
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Opening named mutex [%s]", __func__, utf8_name);
-       
-       handle = _wapi_search_handle_namespace (MONO_W32HANDLE_NAMEDMUTEX,
-                                               utf8_name);
-       if (handle == INVALID_HANDLE_VALUE) {
-               /* The name has already been used for a different
-                * object.
-                */
-               SetLastError (ERROR_INVALID_HANDLE);
-               goto cleanup;
-       } else if (!handle) {
-               /* This name doesn't exist */
-               SetLastError (ERROR_FILE_NOT_FOUND);    /* yes, really */
-               goto cleanup;
-       }
-
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: returning named mutex handle %p", __func__, handle);
-
-cleanup:
-       g_free (utf8_name);
-
-       _wapi_namespace_unlock (NULL);
-       
-       return handle;
-}
diff --git a/mono/io-layer/mutexes.h b/mono/io-layer/mutexes.h
deleted file mode 100644 (file)
index d1b7a68..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * mutexes.h: Mutex handles
- *
- * Author:
- *     Dick Porter (dick@ximian.com)
- *
- * (C) 2002 Ximian, Inc.
- */
-
-#ifndef _WAPI_MUTEXES_H_
-#define _WAPI_MUTEXES_H_
-
-#include <glib.h>
-
-#include <pthread.h>
-
-G_BEGIN_DECLS
-
-extern gpointer CreateMutex (WapiSecurityAttributes *security, gboolean owned,
-                            const gunichar2 *name);
-extern gboolean ReleaseMutex (gpointer handle);
-extern gpointer OpenMutex (guint32 access, gboolean inherit,
-                          const gunichar2 *name);
-
-void
-wapi_mutex_abandon (gpointer data, pid_t pid, pthread_t tid);
-
-G_END_DECLS
-
-#endif /* _WAPI_MUTEXES_H_ */
index fe350c8b8660e59da13d8a2646a62f49db2fb2d9..995795bb32614fa12c11936e497f01991ef1c231 100644 (file)
@@ -25,7 +25,7 @@
 #include <mono/io-layer/io-private.h>
 #include <mono/io-layer/io-trace.h>
 #include <mono/utils/mono-logger-internals.h>
-#include <mono/utils/w32handle.h>
+#include <mono/metadata/w32handle.h>
 
 static guint32
 convert_from_flags(int flags)
diff --git a/mono/io-layer/process-private.h b/mono/io-layer/process-private.h
deleted file mode 100644 (file)
index a17de8a..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * process-private.h: Private definitions for process handles
- *
- * Author:
- *     Dick Porter (dick@ximian.com)
- *
- * (C) 2002-2006 Novell, Inc.
- */
-
-#ifndef _WAPI_PROCESS_PRIVATE_H_
-#define _WAPI_PROCESS_PRIVATE_H_
-
-#include <config.h>
-#include <glib.h>
-
-#include <mono/utils/mono-os-semaphore.h>
-
-/* There doesn't seem to be a defined symbol for this */
-#define _WAPI_PROCESS_CURRENT (gpointer)0xFFFFFFFF
-
-/*
- * Handles > _WAPI_PROCESS_UNHANDLED are pseudo handles which represent processes
- * not started by the runtime.
- */
-/* This marks a system process that we don't have a handle on */
-/* FIXME: Cope with PIDs > sizeof guint */
-#define _WAPI_PROCESS_UNHANDLED (1 << (8*sizeof(pid_t)-1))
-#define _WAPI_PROCESS_UNHANDLED_PID_MASK (-1 & ~_WAPI_PROCESS_UNHANDLED)
-#define WAPI_IS_PSEUDO_PROCESS_HANDLE(handle) ((GPOINTER_TO_UINT(handle) & _WAPI_PROCESS_UNHANDLED) == _WAPI_PROCESS_UNHANDLED)
-#define WAPI_PID_TO_HANDLE(pid) GINT_TO_POINTER (_WAPI_PROCESS_UNHANDLED + (pid))
-#define WAPI_HANDLE_TO_PID(handle) (GPOINTER_TO_UINT ((handle)) - _WAPI_PROCESS_UNHANDLED)
-
-void _wapi_processes_init (void);
-extern gpointer _wapi_process_duplicate (void);
-extern void wapi_processes_cleanup (void);
-
-/*
- * MonoProcess describes processes we create.
- * It contains a semaphore that can be waited on in order to wait
- * for process termination. It's accessed in our SIGCHLD handler,
- * when status is updated (and pid cleared, to not clash with 
- * subsequent processes that may get executed).
- */
-struct MonoProcess {
-       pid_t pid; /* the pid of the process. This value is only valid until the process has exited. */
-       MonoSemType exit_sem; /* this semaphore will be released when the process exits */
-       int status; /* the exit status */
-       gint32 handle_count; /* the number of handles to this mono_process instance */
-       /* we keep a ref to the creating _WapiHandle_process handle until
-        * the process has exited, so that the information there isn't lost.
-        */
-       gpointer handle;
-       gboolean freeable;
-       struct MonoProcess *next;
-};
-
-typedef struct MonoProcess MonoProcess;
-
-/*
- * _WapiHandle_process is a structure containing all the required information
- * for process handling.
- */
-struct _WapiHandle_process
-{
-       pid_t id;
-       guint32 exitstatus;
-       gpointer main_thread;
-       WapiFileTime create_time;
-       WapiFileTime exit_time;
-       char *proc_name;
-       size_t min_working_set;
-       size_t max_working_set;
-       gboolean exited;
-       struct MonoProcess *mono_process;
-};
-
-typedef struct _WapiHandle_process WapiHandle_process;
-
-#endif /* _WAPI_PROCESS_PRIVATE_H_ */
diff --git a/mono/io-layer/processes.c b/mono/io-layer/processes.c
deleted file mode 100644 (file)
index 654c437..0000000
+++ /dev/null
@@ -1,2865 +0,0 @@
-/*
- * processes.c:  Process handles
- *
- * Author:
- *     Dick Porter (dick@ximian.com)
- *
- * (C) 2002-2011 Novell, Inc.
- * Copyright 2011 Xamarin Inc
- * Licensed under the MIT license. See LICENSE file in the project root for full license information.
- */
-
-#include <config.h>
-#include <glib.h>
-#include <stdio.h>
-#include <string.h>
-#include <pthread.h>
-#include <sched.h>
-#include <sys/time.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#ifdef HAVE_SIGNAL_H
-#include <signal.h>
-#endif
-#include <sys/time.h>
-#include <fcntl.h>
-#ifdef HAVE_SYS_PARAM_H
-#include <sys/param.h>
-#endif
-#include <ctype.h>
-
-#ifdef HAVE_SYS_WAIT_H
-#include <sys/wait.h>
-#endif
-#ifdef HAVE_SYS_RESOURCE_H
-#include <sys/resource.h>
-#endif
-
-#ifdef HAVE_SYS_MKDEV_H
-#include <sys/mkdev.h>
-#endif
-
-#ifdef HAVE_UTIME_H
-#include <utime.h>
-#endif
-
-/* sys/resource.h (for rusage) is required when using osx 10.3 (but not 10.4) */
-#ifdef __APPLE__
-#include <TargetConditionals.h>
-#include <sys/resource.h>
-#ifdef HAVE_LIBPROC_H
-/* proc_name */
-#include <libproc.h>
-#endif
-#endif
-
-#if defined(PLATFORM_MACOSX)
-#define USE_OSX_LOADER
-#endif
-
-#if ( defined(__OpenBSD__) || defined(__FreeBSD__) ) && defined(HAVE_LINK_H)
-#define USE_BSD_LOADER
-#endif
-
-#if defined(__HAIKU__)
-#define USE_HAIKU_LOADER
-#endif
-
-#if defined(USE_OSX_LOADER) || defined(USE_BSD_LOADER)
-#include <sys/proc.h>
-#include <sys/sysctl.h>
-#  if !defined(__OpenBSD__)
-#    include <sys/utsname.h>
-#  endif
-#  if defined(__FreeBSD__)
-#    include <sys/user.h>  /* struct kinfo_proc */
-#  endif
-#endif
-
-#ifdef PLATFORM_SOLARIS
-/* procfs.h cannot be included if this define is set, but it seems to work fine if it is undefined */
-#if _FILE_OFFSET_BITS == 64
-#undef _FILE_OFFSET_BITS
-#include <procfs.h>
-#define _FILE_OFFSET_BITS 64
-#else
-#include <procfs.h>
-#endif
-#endif
-
-#ifdef __HAIKU__
-#include <KernelKit.h>
-#endif
-
-#include <mono/io-layer/wapi.h>
-#include <mono/io-layer/wapi-private.h>
-#include <mono/io-layer/process-private.h>
-#include <mono/io-layer/io-trace.h>
-#include <mono/utils/strenc.h>
-#include <mono/utils/mono-path.h>
-#include <mono/io-layer/timefuncs-private.h>
-#include <mono/utils/mono-time.h>
-#include <mono/utils/mono-membar.h>
-#include <mono/utils/mono-os-mutex.h>
-#include <mono/utils/mono-signal-handler.h>
-#include <mono/utils/mono-proclib.h>
-#include <mono/utils/mono-once.h>
-#include <mono/utils/mono-logger-internals.h>
-#include <mono/utils/w32handle.h>
-
-#define STILL_ACTIVE STATUS_PENDING
-
-/* The process' environment strings */
-#if defined(__APPLE__)
-#if defined (TARGET_OSX)
-/* Apple defines this in crt_externs.h but doesn't provide that header for 
- * arm-apple-darwin9.  We'll manually define the symbol on Apple as it does
- * in fact exist on all implementations (so far) 
- */
-gchar ***_NSGetEnviron(void);
-#define environ (*_NSGetEnviron())
-#else
-static char *mono_environ[1] = { NULL };
-#define environ mono_environ
-#endif /* defined (TARGET_OSX) */
-#else
-extern char **environ;
-#endif
-
-static guint32 process_wait (gpointer handle, guint32 timeout, gboolean *alerted);
-static void process_close (gpointer handle, gpointer data);
-static void process_details (gpointer data);
-static const gchar* process_typename (void);
-static gsize process_typesize (void);
-static gboolean is_pid_valid (pid_t pid);
-
-#if !(defined(USE_OSX_LOADER) || defined(USE_BSD_LOADER) || defined(USE_HAIKU_LOADER))
-static FILE *
-open_process_map (int pid, const char *mode);
-#endif
-
-static MonoW32HandleOps _wapi_process_ops = {
-       process_close,          /* close_shared */
-       NULL,                           /* signal */
-       NULL,                           /* own */
-       NULL,                           /* is_owned */
-       process_wait,                   /* special_wait */
-       NULL,                           /* prewait */
-       process_details,        /* details */
-       process_typename,       /* typename */
-       process_typesize,       /* typesize */
-};
-
-#if HAVE_SIGACTION
-static struct sigaction previous_chld_sa;
-#endif
-static mono_once_t process_sig_chld_once = MONO_ONCE_INIT;
-static void process_add_sigchld_handler (void);
-
-/* The signal-safe logic to use mono_processes goes like this:
- * - The list must be safe to traverse for the signal handler at all times.
- *   It's safe to: prepend an entry (which is a single store to 'mono_processes'),
- *   unlink an entry (assuming the unlinked entry isn't freed and doesn't 
- *   change its 'next' pointer so that it can still be traversed).
- * When cleaning up we first unlink an entry, then we verify that
- * the read lock isn't locked. Then we can free the entry, since
- * we know that nobody is using the old version of the list (including
- * the unlinked entry).
- * We also need to lock when adding and cleaning up so that those two
- * operations don't mess with eachother. (This lock is not used in the
- * signal handler)
- */
-static struct MonoProcess *mono_processes = NULL;
-static volatile gint32 mono_processes_cleaning_up = 0;
-static mono_mutex_t mono_processes_mutex;
-static void mono_processes_cleanup (void);
-
-static gpointer current_process;
-static char *cli_launcher;
-
-static WapiHandle_process *
-lookup_process_handle (gpointer handle)
-{
-       WapiHandle_process *process_data;
-       gboolean ret;
-
-       ret = mono_w32handle_lookup (handle, MONO_W32HANDLE_PROCESS,
-                                                          (gpointer *)&process_data);
-       if (!ret)
-               return NULL;
-       return process_data;
-}
-
-/* Check if a pid is valid - i.e. if a process exists with this pid. */
-static gboolean
-is_pid_valid (pid_t pid)
-{
-       gboolean result = FALSE;
-
-#if defined(HOST_WATCHOS)
-       result = TRUE; // TODO: Rewrite using sysctl
-#elif defined(PLATFORM_MACOSX) || defined(__OpenBSD__) || defined(__FreeBSD__)
-       if (((kill(pid, 0) == 0) || (errno == EPERM)) && pid != 0)
-               result = TRUE;
-#elif defined(__HAIKU__)
-       team_info teamInfo;
-       if (get_team_info ((team_id)pid, &teamInfo) == B_OK)
-               result = TRUE;
-#else
-       char *dir = g_strdup_printf ("/proc/%d", pid);
-       if (!access (dir, F_OK))
-               result = TRUE;
-       g_free (dir);
-#endif
-       
-       return result;
-}
-
-static void
-process_set_defaults (WapiHandle_process *process_handle)
-{
-       /* These seem to be the defaults on w2k */
-       process_handle->min_working_set = 204800;
-       process_handle->max_working_set = 1413120;
-       
-       _wapi_time_t_to_filetime (time (NULL), &process_handle->create_time);
-}
-
-static int
-len16 (const gunichar2 *str)
-{
-       int len = 0;
-       
-       while (*str++ != 0)
-               len++;
-
-       return len;
-}
-
-static gunichar2 *
-utf16_concat (const gunichar2 *first, ...)
-{
-       va_list args;
-       int total = 0, i;
-       const gunichar2 *s;
-       gunichar2 *ret;
-
-       va_start (args, first);
-       total += len16 (first);
-        for (s = va_arg (args, gunichar2 *); s != NULL; s = va_arg(args, gunichar2 *)){
-               total += len16 (s);
-        }
-       va_end (args);
-
-       ret = g_new (gunichar2, total + 1);
-       if (ret == NULL)
-               return NULL;
-
-       ret [total] = 0;
-       i = 0;
-       for (s = first; *s != 0; s++)
-               ret [i++] = *s;
-       va_start (args, first);
-       for (s = va_arg (args, gunichar2 *); s != NULL; s = va_arg (args, gunichar2 *)){
-               const gunichar2 *p;
-               
-               for (p = s; *p != 0; p++)
-                       ret [i++] = *p;
-       }
-       va_end (args);
-       
-       return ret;
-}
-
-static const gunichar2 utf16_space_bytes [2] = { 0x20, 0 };
-static const gunichar2 *utf16_space = utf16_space_bytes; 
-static const gunichar2 utf16_quote_bytes [2] = { 0x22, 0 };
-static const gunichar2 *utf16_quote = utf16_quote_bytes;
-
-#ifdef DEBUG_ENABLED
-/* Useful in gdb */
-void
-print_utf16 (gunichar2 *str)
-{
-       char *res;
-
-       res = g_utf16_to_utf8 (str, -1, NULL, NULL, NULL);
-       g_print ("%s\n", res);
-       g_free (res);
-}
-#endif
-
-/* Implemented as just a wrapper around CreateProcess () */
-gboolean
-ShellExecuteEx (WapiShellExecuteInfo *sei)
-{
-       gboolean ret;
-       WapiProcessInformation process_info;
-       gunichar2 *args;
-       
-       if (sei == NULL) {
-               /* w2k just segfaults here, but we can do better than
-                * that
-                */
-               SetLastError (ERROR_INVALID_PARAMETER);
-               return FALSE;
-       }
-
-       if (sei->lpFile == NULL)
-               /* w2k returns TRUE for this, for some reason. */
-               return TRUE;
-       
-       /* Put both executable and parameters into the second argument
-        * to CreateProcess (), so it searches $PATH.  The conversion
-        * into and back out of utf8 is because there is no
-        * g_strdup_printf () equivalent for gunichar2 :-(
-        */
-       args = utf16_concat (utf16_quote, sei->lpFile, utf16_quote, sei->lpParameters == NULL ? NULL : utf16_space, sei->lpParameters, NULL);
-       if (args == NULL) {
-               SetLastError (ERROR_INVALID_DATA);
-               return FALSE;
-       }
-       ret = CreateProcess (NULL, args, NULL, NULL, TRUE,
-                            CREATE_UNICODE_ENVIRONMENT, NULL,
-                            sei->lpDirectory, NULL, &process_info);
-       g_free (args);
-
-       if (!ret && GetLastError () == ERROR_OUTOFMEMORY)
-               return ret;
-       
-       if (!ret) {
-               static char *handler;
-               static gunichar2 *handler_utf16;
-               
-               if (handler_utf16 == (gunichar2 *)-1)
-                       return FALSE;
-
-#ifdef PLATFORM_MACOSX
-               handler = g_strdup ("/usr/bin/open");
-#else
-               /*
-                * On Linux, try: xdg-open, the FreeDesktop standard way of doing it,
-                * if that fails, try to use gnome-open, then kfmclient
-                */
-               handler = g_find_program_in_path ("xdg-open");
-               if (handler == NULL){
-                       handler = g_find_program_in_path ("gnome-open");
-                       if (handler == NULL){
-                               handler = g_find_program_in_path ("kfmclient");
-                               if (handler == NULL){
-                                       handler_utf16 = (gunichar2 *) -1;
-                                       return FALSE;
-                               } else {
-                                       /* kfmclient needs exec argument */
-                                       char *old = handler;
-                                       handler = g_strconcat (old, " exec",
-                                                              NULL);
-                                       g_free (old);
-                               }
-                       }
-               }
-#endif
-               handler_utf16 = g_utf8_to_utf16 (handler, -1, NULL, NULL, NULL);
-               g_free (handler);
-
-               /* Put quotes around the filename, in case it's a url
-                * that contains #'s (CreateProcess() calls
-                * g_shell_parse_argv(), which deliberately throws
-                * away anything after an unquoted #).  Fixes bug
-                * 371567.
-                */
-               args = utf16_concat (handler_utf16, utf16_space, utf16_quote,
-                                    sei->lpFile, utf16_quote,
-                                    sei->lpParameters == NULL ? NULL : utf16_space,
-                                    sei->lpParameters, NULL);
-               if (args == NULL) {
-                       SetLastError (ERROR_INVALID_DATA);
-                       return FALSE;
-               }
-               ret = CreateProcess (NULL, args, NULL, NULL, TRUE,
-                                    CREATE_UNICODE_ENVIRONMENT, NULL,
-                                    sei->lpDirectory, NULL, &process_info);
-               g_free (args);
-               if (!ret) {
-                       if (GetLastError () != ERROR_OUTOFMEMORY)
-                               SetLastError (ERROR_INVALID_DATA);
-                       return FALSE;
-               }
-               /* Shell exec should not return a process handle when it spawned a GUI thing, like a browser. */
-               CloseHandle (process_info.hProcess);
-               process_info.hProcess = NULL;
-       }
-       
-       if (sei->fMask & SEE_MASK_NOCLOSEPROCESS)
-               sei->hProcess = process_info.hProcess;
-       else
-               CloseHandle (process_info.hProcess);
-       
-       return ret;
-}
-
-static gboolean
-is_managed_binary (const char *filename)
-{
-       int original_errno = errno;
-#if defined(HAVE_LARGE_FILE_SUPPORT) && defined(O_LARGEFILE)
-       int file = open (filename, O_RDONLY | O_LARGEFILE);
-#else
-       int file = open (filename, O_RDONLY);
-#endif
-       off_t new_offset;
-       unsigned char buffer[8];
-       off_t file_size, optional_header_offset;
-       off_t pe_header_offset;
-       gboolean managed = FALSE;
-       int num_read;
-       guint32 first_word, second_word;
-       
-       /* If we are unable to open the file, then we definitely
-        * can't say that it is managed. The child mono process
-        * probably wouldn't be able to open it anyway.
-        */
-       if (file < 0) {
-               errno = original_errno;
-               return FALSE;
-       }
-
-       /* Retrieve the length of the file for future sanity checks. */
-       file_size = lseek (file, 0, SEEK_END);
-       lseek (file, 0, SEEK_SET);
-
-       /* We know we need to read a header field at offset 60. */
-       if (file_size < 64)
-               goto leave;
-
-       num_read = read (file, buffer, 2);
-
-       if ((num_read != 2) || (buffer[0] != 'M') || (buffer[1] != 'Z'))
-               goto leave;
-
-       new_offset = lseek (file, 60, SEEK_SET);
-
-       if (new_offset != 60)
-               goto leave;
-       
-       num_read = read (file, buffer, 4);
-
-       if (num_read != 4)
-               goto leave;
-       pe_header_offset =  buffer[0]
-               | (buffer[1] <<  8)
-               | (buffer[2] << 16)
-               | (buffer[3] << 24);
-       
-       if (pe_header_offset + 24 > file_size)
-               goto leave;
-
-       new_offset = lseek (file, pe_header_offset, SEEK_SET);
-
-       if (new_offset != pe_header_offset)
-               goto leave;
-
-       num_read = read (file, buffer, 4);
-
-       if ((num_read != 4) || (buffer[0] != 'P') || (buffer[1] != 'E') || (buffer[2] != 0) || (buffer[3] != 0))
-               goto leave;
-
-       /*
-        * Verify that the header we want in the optional header data
-        * is present in this binary.
-        */
-       new_offset = lseek (file, pe_header_offset + 20, SEEK_SET);
-
-       if (new_offset != pe_header_offset + 20)
-               goto leave;
-
-       num_read = read (file, buffer, 2);
-
-       if ((num_read != 2) || ((buffer[0] | (buffer[1] << 8)) < 216))
-               goto leave;
-
-       /* Read the CLR header address and size fields. These will be
-        * zero if the binary is not managed.
-        */
-       optional_header_offset = pe_header_offset + 24;
-       new_offset = lseek (file, optional_header_offset + 208, SEEK_SET);
-
-       if (new_offset != optional_header_offset + 208)
-               goto leave;
-
-       num_read = read (file, buffer, 8);
-       
-       /* We are not concerned with endianness, only with
-        * whether it is zero or not.
-        */
-       first_word = *(guint32 *)&buffer[0];
-       second_word = *(guint32 *)&buffer[4];
-       
-       if ((num_read != 8) || (first_word == 0) || (second_word == 0))
-               goto leave;
-       
-       managed = TRUE;
-
-leave:
-       close (file);
-       errno = original_errno;
-       return managed;
-}
-
-gboolean
-CreateProcessWithLogonW (const gunichar2 *username,
-                                                const gunichar2 *domain,
-                                                const gunichar2 *password,
-                                                const guint32 logonFlags,
-                                                const gunichar2 *appname,
-                                                const gunichar2 *cmdline,
-                                                guint32 create_flags,
-                                                gpointer env,
-                                                const gunichar2 *cwd,
-                                                WapiStartupInfo *startup,
-                                                WapiProcessInformation *process_info)
-{
-       /* FIXME: use user information */
-       return CreateProcess (appname, cmdline, NULL, NULL, FALSE, create_flags, env, cwd, startup, process_info);
-}
-
-static gboolean
-is_readable_or_executable (const char *prog)
-{
-       struct stat buf;
-       int a = access (prog, R_OK);
-       int b = access (prog, X_OK);
-       if (a != 0 && b != 0)
-               return FALSE;
-       if (stat (prog, &buf))
-               return FALSE;
-       if (S_ISREG (buf.st_mode))
-               return TRUE;
-       return FALSE;
-}
-
-static gboolean
-is_executable (const char *prog)
-{
-       struct stat buf;
-       if (access (prog, X_OK) != 0)
-               return FALSE;
-       if (stat (prog, &buf))
-               return FALSE;
-       if (S_ISREG (buf.st_mode))
-               return TRUE;
-       return FALSE;
-}
-
-static void
-switch_dir_separators (char *path)
-{
-       size_t i, pathLength = strlen(path);
-       
-       /* Turn all the slashes round the right way, except for \' */
-       /* There are probably other characters that need to be excluded as well. */
-       for (i = 0; i < pathLength; i++) {
-               if (path[i] == '\\' && i < pathLength - 1 && path[i+1] != '\'' )
-                       path[i] = '/';
-       }
-}
-
-gboolean CreateProcess (const gunichar2 *appname, const gunichar2 *cmdline,
-                       WapiSecurityAttributes *process_attrs G_GNUC_UNUSED,
-                       WapiSecurityAttributes *thread_attrs G_GNUC_UNUSED,
-                       gboolean inherit_handles, guint32 create_flags,
-                       gpointer new_environ, const gunichar2 *cwd,
-                       WapiStartupInfo *startup,
-                       WapiProcessInformation *process_info)
-{
-#if defined (HAVE_FORK) && defined (HAVE_EXECVE)
-       char *cmd = NULL, *prog = NULL, *full_prog = NULL, *args = NULL, *args_after_prog = NULL;
-       char *dir = NULL, **env_strings = NULL, **argv = NULL;
-       guint32 i, env_count = 0;
-       gboolean ret = FALSE;
-       gpointer handle = NULL;
-       WapiHandle_process process_handle = {0}, *process_handle_data;
-       GError *gerr = NULL;
-       int in_fd, out_fd, err_fd;
-       pid_t pid = 0;
-       int startup_pipe [2] = {-1, -1};
-       int dummy;
-       struct MonoProcess *mono_process;
-       gboolean fork_failed = FALSE;
-
-       mono_once (&process_sig_chld_once, process_add_sigchld_handler);
-
-       /* appname and cmdline specify the executable and its args:
-        *
-        * If appname is not NULL, it is the name of the executable.
-        * Otherwise the executable is the first token in cmdline.
-        *
-        * Executable searching:
-        *
-        * If appname is not NULL, it can specify the full path and
-        * file name, or else a partial name and the current directory
-        * will be used.  There is no additional searching.
-        *
-        * If appname is NULL, the first whitespace-delimited token in
-        * cmdline is used.  If the name does not contain a full
-        * directory path, the search sequence is:
-        *
-        * 1) The directory containing the current process
-        * 2) The current working directory
-        * 3) The windows system directory  (Ignored)
-        * 4) The windows directory (Ignored)
-        * 5) $PATH
-        *
-        * Just to make things more interesting, tokens can contain
-        * white space if they are surrounded by quotation marks.  I'm
-        * beginning to understand just why windows apps are generally
-        * so crap, with an API like this :-(
-        */
-       if (appname != NULL) {
-               cmd = mono_unicode_to_external (appname);
-               if (cmd == NULL) {
-                       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: unicode conversion returned NULL",
-                                  __func__);
-
-                       SetLastError (ERROR_PATH_NOT_FOUND);
-                       goto free_strings;
-               }
-
-               switch_dir_separators(cmd);
-       }
-       
-       if (cmdline != NULL) {
-               args = mono_unicode_to_external (cmdline);
-               if (args == NULL) {
-                       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: unicode conversion returned NULL", __func__);
-
-                       SetLastError (ERROR_PATH_NOT_FOUND);
-                       goto free_strings;
-               }
-       }
-
-       if (cwd != NULL) {
-               dir = mono_unicode_to_external (cwd);
-               if (dir == NULL) {
-                       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: unicode conversion returned NULL", __func__);
-
-                       SetLastError (ERROR_PATH_NOT_FOUND);
-                       goto free_strings;
-               }
-
-               /* Turn all the slashes round the right way */
-               switch_dir_separators(dir);
-       }
-       
-
-       /* We can't put off locating the executable any longer :-( */
-       if (cmd != NULL) {
-               char *unquoted;
-               if (g_ascii_isalpha (cmd[0]) && (cmd[1] == ':')) {
-                       /* Strip off the drive letter.  I can't
-                        * believe that CP/M holdover is still
-                        * visible...
-                        */
-                       g_memmove (cmd, cmd+2, strlen (cmd)-2);
-                       cmd[strlen (cmd)-2] = '\0';
-               }
-
-               unquoted = g_shell_unquote (cmd, NULL);
-               if (unquoted[0] == '/') {
-                       /* Assume full path given */
-                       prog = g_strdup (unquoted);
-
-                       /* Executable existing ? */
-                       if (!is_readable_or_executable (prog)) {
-                               MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Couldn't find executable %s",
-                                          __func__, prog);
-                               g_free (unquoted);
-                               SetLastError (ERROR_FILE_NOT_FOUND);
-                               goto free_strings;
-                       }
-               } else {
-                       /* Search for file named by cmd in the current
-                        * directory
-                        */
-                       char *curdir = g_get_current_dir ();
-
-                       prog = g_strdup_printf ("%s/%s", curdir, unquoted);
-                       g_free (curdir);
-
-                       /* And make sure it's readable */
-                       if (!is_readable_or_executable (prog)) {
-                               MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Couldn't find executable %s",
-                                          __func__, prog);
-                               g_free (unquoted);
-                               SetLastError (ERROR_FILE_NOT_FOUND);
-                               goto free_strings;
-                       }
-               }
-               g_free (unquoted);
-
-               args_after_prog = args;
-       } else {
-               char *token = NULL;
-               char quote;
-               
-               /* Dig out the first token from args, taking quotation
-                * marks into account
-                */
-
-               /* First, strip off all leading whitespace */
-               args = g_strchug (args);
-               
-               /* args_after_prog points to the contents of args
-                * after token has been set (otherwise argv[0] is
-                * duplicated)
-                */
-               args_after_prog = args;
-
-               /* Assume the opening quote will always be the first
-                * character
-                */
-               if (args[0] == '\"' || args [0] == '\'') {
-                       quote = args [0];
-                       for (i = 1; args[i] != '\0' && args[i] != quote; i++);
-                       if (args [i + 1] == '\0' || g_ascii_isspace (args[i+1])) {
-                               /* We found the first token */
-                               token = g_strndup (args+1, i-1);
-                               args_after_prog = g_strchug (args + i + 1);
-                       } else {
-                               /* Quotation mark appeared in the
-                                * middle of the token.  Just give the
-                                * whole first token, quotes and all,
-                                * to exec.
-                                */
-                       }
-               }
-               
-               if (token == NULL) {
-                       /* No quote mark, or malformed */
-                       for (i = 0; args[i] != '\0'; i++) {
-                               if (g_ascii_isspace (args[i])) {
-                                       token = g_strndup (args, i);
-                                       args_after_prog = args + i + 1;
-                                       break;
-                               }
-                       }
-               }
-
-               if (token == NULL && args[0] != '\0') {
-                       /* Must be just one token in the string */
-                       token = g_strdup (args);
-                       args_after_prog = NULL;
-               }
-               
-               if (token == NULL) {
-                       /* Give up */
-                       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Couldn't find what to exec", __func__);
-
-                       SetLastError (ERROR_PATH_NOT_FOUND);
-                       goto free_strings;
-               }
-               
-               /* Turn all the slashes round the right way. Only for
-                * the prg. name
-                */
-               switch_dir_separators(token);
-
-               if (g_ascii_isalpha (token[0]) && (token[1] == ':')) {
-                       /* Strip off the drive letter.  I can't
-                        * believe that CP/M holdover is still
-                        * visible...
-                        */
-                       g_memmove (token, token+2, strlen (token)-2);
-                       token[strlen (token)-2] = '\0';
-               }
-
-               if (token[0] == '/') {
-                       /* Assume full path given */
-                       prog = g_strdup (token);
-                       
-                       /* Executable existing ? */
-                       if (!is_readable_or_executable (prog)) {
-                               MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Couldn't find executable %s",
-                                          __func__, token);
-                               g_free (token);
-                               SetLastError (ERROR_FILE_NOT_FOUND);
-                               goto free_strings;
-                       }
-               } else {
-                       char *curdir = g_get_current_dir ();
-
-                       /* FIXME: Need to record the directory
-                        * containing the current process, and check
-                        * that for the new executable as the first
-                        * place to look
-                        */
-
-                       prog = g_strdup_printf ("%s/%s", curdir, token);
-                       g_free (curdir);
-
-                       /* I assume X_OK is the criterion to use,
-                        * rather than F_OK
-                        *
-                        * X_OK is too strict *if* the target is a CLR binary
-                        */
-                       if (!is_readable_or_executable (prog)) {
-                               g_free (prog);
-                               prog = g_find_program_in_path (token);
-                               if (prog == NULL) {
-                                       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Couldn't find executable %s", __func__, token);
-
-                                       g_free (token);
-                                       SetLastError (ERROR_FILE_NOT_FOUND);
-                                       goto free_strings;
-                               }
-                       }
-               }
-
-               g_free (token);
-       }
-
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Exec prog [%s] args [%s]", __func__, prog,
-                  args_after_prog);
-       
-       /* Check for CLR binaries; if found, we will try to invoke
-        * them using the same mono binary that started us.
-        */
-       if (is_managed_binary (prog)) {
-               gunichar2 *newapp = NULL, *newcmd;
-               gsize bytes_ignored;
-
-               if (cli_launcher)
-                       newapp = mono_unicode_from_external (cli_launcher, &bytes_ignored);
-               else
-                       newapp = mono_unicode_from_external ("mono", &bytes_ignored);
-
-               if (newapp != NULL) {
-                       if (appname != NULL) {
-                               newcmd = utf16_concat (utf16_quote, newapp, utf16_quote, utf16_space,
-                                                      appname, utf16_space,
-                                                      cmdline, NULL);
-                       } else {
-                               newcmd = utf16_concat (utf16_quote, newapp, utf16_quote, utf16_space,
-                                                      cmdline, NULL);
-                       }
-                       
-                       g_free ((gunichar2 *)newapp);
-                       
-                       if (newcmd != NULL) {
-                               ret = CreateProcess (NULL, newcmd,
-                                                    process_attrs,
-                                                    thread_attrs,
-                                                    inherit_handles,
-                                                    create_flags, new_environ,
-                                                    cwd, startup,
-                                                    process_info);
-                               
-                               g_free ((gunichar2 *)newcmd);
-                               
-                               goto free_strings;
-                       }
-               }
-       } else {
-               if (!is_executable (prog)) {
-                       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Executable permisson not set on %s", __func__, prog);
-                       SetLastError (ERROR_ACCESS_DENIED);
-                       goto free_strings;
-               }
-       }
-
-       if (args_after_prog != NULL && *args_after_prog) {
-               char *qprog;
-
-               qprog = g_shell_quote (prog);
-               full_prog = g_strconcat (qprog, " ", args_after_prog, NULL);
-               g_free (qprog);
-       } else {
-               full_prog = g_shell_quote (prog);
-       }
-
-       ret = g_shell_parse_argv (full_prog, NULL, &argv, &gerr);
-       if (ret == FALSE) {
-               g_message ("CreateProcess: %s\n", gerr->message);
-               g_error_free (gerr);
-               gerr = NULL;
-               goto free_strings;
-       }
-
-       if (startup != NULL && startup->dwFlags & STARTF_USESTDHANDLES) {
-               in_fd = GPOINTER_TO_UINT (startup->hStdInput);
-               out_fd = GPOINTER_TO_UINT (startup->hStdOutput);
-               err_fd = GPOINTER_TO_UINT (startup->hStdError);
-       } else {
-               in_fd = GPOINTER_TO_UINT (GetStdHandle (STD_INPUT_HANDLE));
-               out_fd = GPOINTER_TO_UINT (GetStdHandle (STD_OUTPUT_HANDLE));
-               err_fd = GPOINTER_TO_UINT (GetStdHandle (STD_ERROR_HANDLE));
-       }
-       
-       process_handle.proc_name = g_strdup (prog);
-
-       process_set_defaults (&process_handle);
-       
-       handle = mono_w32handle_new (MONO_W32HANDLE_PROCESS, &process_handle);
-       if (handle == INVALID_HANDLE_VALUE) {
-               g_warning ("%s: error creating process handle", __func__);
-
-               ret = FALSE;
-               SetLastError (ERROR_OUTOFMEMORY);
-               goto free_strings;
-       }
-
-       /* new_environ is a block of NULL-terminated strings, which
-        * is itself NULL-terminated. Of course, passing an array of
-        * string pointers would have made things too easy :-(
-        *
-        * If new_environ is not NULL it specifies the entire set of
-        * environment variables in the new process.  Otherwise the
-        * new process inherits the same environment.
-        */
-       if (new_environ) {
-               gunichar2 *new_environp;
-
-               /* Count the number of strings */
-               for (new_environp = (gunichar2 *)new_environ; *new_environp;
-                    new_environp++) {
-                       env_count++;
-                       while (*new_environp) {
-                               new_environp++;
-                       }
-               }
-
-               /* +2: one for the process handle value, and the last
-                * one is NULL
-                */
-               env_strings = g_new0 (char *, env_count + 2);
-               
-               /* Copy each environ string into 'strings' turning it
-                * into utf8 (or the requested encoding) at the same
-                * time
-                */
-               env_count = 0;
-               for (new_environp = (gunichar2 *)new_environ; *new_environp;
-                    new_environp++) {
-                       env_strings[env_count] = mono_unicode_to_external (new_environp);
-                       env_count++;
-                       while (*new_environp) {
-                               new_environp++;
-                       }
-               }
-       } else {
-               for (i = 0; environ[i] != NULL; i++)
-                       env_count++;
-
-               /* +2: one for the process handle value, and the last
-                * one is NULL
-                */
-               env_strings = g_new0 (char *, env_count + 2);
-               
-               /* Copy each environ string into 'strings' turning it
-                * into utf8 (or the requested encoding) at the same
-                * time
-                */
-               env_count = 0;
-               for (i = 0; environ[i] != NULL; i++) {
-                       env_strings[env_count] = g_strdup (environ[i]);
-                       env_count++;
-               }
-       }
-
-       /* Create a pipe to make sure the child doesn't exit before 
-        * we can add the process to the linked list of mono_processes */
-       if (pipe (startup_pipe) == -1) {
-               /* Could not create the pipe to synchroniz process startup. We'll just not synchronize.
-                * This is just for a very hard to hit race condition in the first place */
-               startup_pipe [0] = startup_pipe [1] = -1;
-               MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: new process startup not synchronized. We may not notice if the newly created process exits immediately.", __func__);
-       }
-
-       switch (pid = fork ()) {
-       case -1: /* Error */ {
-               SetLastError (ERROR_OUTOFMEMORY);
-               ret = FALSE;
-               fork_failed = TRUE;
-               break;
-       }
-       case 0: /* Child */ {
-               if (startup_pipe [0] != -1) {
-                       /* Wait until the parent has updated it's internal data */
-                       ssize_t _i G_GNUC_UNUSED = read (startup_pipe [0], &dummy, 1);
-                       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: child: parent has completed its setup", __func__);
-                       close (startup_pipe [0]);
-                       close (startup_pipe [1]);
-               }
-               
-               /* should we detach from the process group? */
-
-               /* Connect stdin, stdout and stderr */
-               dup2 (in_fd, 0);
-               dup2 (out_fd, 1);
-               dup2 (err_fd, 2);
-
-               if (inherit_handles != TRUE) {
-                       /* FIXME: do something here */
-               }
-               
-               /* Close all file descriptors */
-               for (i = mono_w32handle_fd_reserve - 1; i > 2; i--)
-                       close (i);
-
-#ifdef DEBUG_ENABLED
-               MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: exec()ing [%s] in dir [%s]", __func__, cmd,
-                          dir == NULL?".":dir);
-               for (i = 0; argv[i] != NULL; i++)
-                       g_message ("arg %d: [%s]", i, argv[i]);
-               
-               for (i = 0; env_strings[i] != NULL; i++)
-                       g_message ("env %d: [%s]", i, env_strings[i]);
-#endif
-
-               /* set cwd */
-               if (dir != NULL && chdir (dir) == -1) {
-                       /* set error */
-                       _exit (-1);
-               }
-               
-               /* exec */
-               execve (argv[0], argv, env_strings);
-               
-               /* set error */
-               _exit (-1);
-
-               break;
-       }
-       default: /* Parent */ {
-               process_handle_data = lookup_process_handle (handle);
-               if (!process_handle_data) {
-                       g_warning ("%s: error looking up process handle %p", __func__, handle);
-                       mono_w32handle_unref (handle);
-               } else {
-                       process_handle_data->id = pid;
-
-                       /* Add our mono_process into the linked list of mono_processes */
-                       mono_process = (struct MonoProcess *) g_malloc0 (sizeof (struct MonoProcess));
-                       mono_process->pid = pid;
-                       mono_process->handle_count = 1;
-                       mono_os_sem_init (&mono_process->exit_sem, 0);
-
-                       /* Keep the process handle artificially alive until the process
-                        * exits so that the information in the handle isn't lost. */
-                       mono_w32handle_ref (handle);
-                       mono_process->handle = handle;
-
-                       process_handle_data->mono_process = mono_process;
-
-                       mono_os_mutex_lock (&mono_processes_mutex);
-                       mono_process->next = mono_processes;
-                       mono_processes = mono_process;
-                       mono_os_mutex_unlock (&mono_processes_mutex);
-
-                       if (process_info != NULL) {
-                               process_info->hProcess = handle;
-                               process_info->dwProcessId = pid;
-
-                               /* FIXME: we might need to handle the thread info some day */
-                               process_info->hThread = INVALID_HANDLE_VALUE;
-                               process_info->dwThreadId = 0;
-                       }
-               }
-
-               break;
-       }
-       }
-
-       if (fork_failed)
-               mono_w32handle_unref (handle);
-
-       if (startup_pipe [1] != -1) {
-               /* Write 1 byte, doesn't matter what */
-               ssize_t _i G_GNUC_UNUSED = write (startup_pipe [1], startup_pipe, 1);
-               close (startup_pipe [0]);
-               close (startup_pipe [1]);
-       }
-
-free_strings:
-       if (cmd)
-               g_free (cmd);
-       if (full_prog)
-               g_free (full_prog);
-       if (prog)
-               g_free (prog);
-       if (args)
-               g_free (args);
-       if (dir)
-               g_free (dir);
-       if (env_strings)
-               g_strfreev (env_strings);
-       if (argv)
-               g_strfreev (argv);
-       
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: returning handle %p for pid %d", __func__, handle, pid);
-
-       /* Check if something needs to be cleaned up. */
-       mono_processes_cleanup ();
-       
-       return ret;
-#else
-       SetLastError (ERROR_NOT_SUPPORTED);
-       return FALSE;
-#endif // defined (HAVE_FORK) && defined (HAVE_EXECVE)
-}
-               
-static void
-process_set_name (WapiHandle_process *process_handle)
-{
-       char *progname, *utf8_progname, *slash;
-       
-       progname = g_get_prgname ();
-       utf8_progname = mono_utf8_from_external (progname);
-
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: using [%s] as prog name", __func__, progname);
-
-       if (utf8_progname) {
-               slash = strrchr (utf8_progname, '/');
-               if (slash)
-                       process_handle->proc_name = g_strdup (slash+1);
-               else
-                       process_handle->proc_name = g_strdup (utf8_progname);
-               g_free (utf8_progname);
-       }
-}
-
-void
-_wapi_processes_init (void)
-{
-       pid_t pid = wapi_getpid ();
-       WapiHandle_process process_handle = {0};
-
-       mono_w32handle_register_ops (MONO_W32HANDLE_PROCESS, &_wapi_process_ops);
-
-       mono_w32handle_register_capabilities (MONO_W32HANDLE_PROCESS,
-               (MonoW32HandleCapability)(MONO_W32HANDLE_CAP_WAIT | MONO_W32HANDLE_CAP_SPECIAL_WAIT));
-       
-       process_handle.id = pid;
-
-       process_set_defaults (&process_handle);
-       process_set_name (&process_handle);
-
-       current_process = mono_w32handle_new (MONO_W32HANDLE_PROCESS,
-                                           &process_handle);
-       g_assert (current_process);
-
-       mono_os_mutex_init (&mono_processes_mutex);
-}
-
-gpointer
-_wapi_process_duplicate (void)
-{
-       mono_w32handle_ref (current_process);
-       
-       return current_process;
-}
-
-/* Returns a pseudo handle that doesn't need to be closed afterwards */
-gpointer
-GetCurrentProcess (void)
-{
-       return _WAPI_PROCESS_CURRENT;
-}
-
-guint32
-GetProcessId (gpointer handle)
-{
-       WapiHandle_process *process_handle;
-
-       if (WAPI_IS_PSEUDO_PROCESS_HANDLE (handle))
-               /* This is a pseudo handle */
-               return WAPI_HANDLE_TO_PID (handle);
-       
-       process_handle = lookup_process_handle (handle);
-       if (!process_handle) {
-               SetLastError (ERROR_INVALID_HANDLE);
-               return 0;
-       }
-       
-       return process_handle->id;
-}
-
-static gboolean
-process_open_compare (gpointer handle, gpointer user_data)
-{
-       pid_t wanted_pid;
-       WapiHandle_process *process_handle;
-       pid_t checking_pid;
-
-       g_assert (!WAPI_IS_PSEUDO_PROCESS_HANDLE (handle));
-       
-       process_handle = lookup_process_handle (handle);
-       g_assert (process_handle);
-       
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: looking at process %d", __func__, process_handle->id);
-
-       checking_pid = process_handle->id;
-
-       if (checking_pid == 0)
-               return FALSE;
-       
-       wanted_pid = GPOINTER_TO_UINT (user_data);
-
-       /* It's possible to have more than one process handle with the
-        * same pid, but only the one running process can be
-        * unsignalled
-        */
-       if (checking_pid == wanted_pid &&
-           !mono_w32handle_issignalled (handle)) {
-               /* If the handle is blown away in the window between
-                * returning TRUE here and mono_w32handle_search pinging
-                * the timestamp, the search will continue
-                */
-               return TRUE;
-       } else {
-               return FALSE;
-       }
-}
-
-gboolean
-CloseProcess (gpointer handle)
-{
-       if (WAPI_IS_PSEUDO_PROCESS_HANDLE (handle))
-               return TRUE;
-       return CloseHandle (handle);
-}
-
-/*
- * The caller owns the returned handle and must call CloseProcess () on it to clean it up.
- */
-gpointer
-OpenProcess (guint32 req_access G_GNUC_UNUSED, gboolean inherit G_GNUC_UNUSED, guint32 pid)
-{
-       /* Find the process handle that corresponds to pid */
-       gpointer handle = NULL;
-       
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: looking for process %d", __func__, pid);
-
-       handle = mono_w32handle_search (MONO_W32HANDLE_PROCESS,
-                                     process_open_compare,
-                                     GUINT_TO_POINTER (pid), NULL, TRUE);
-       if (handle == 0) {
-               if (is_pid_valid (pid)) {
-                       /* Return a pseudo handle for processes we
-                        * don't have handles for
-                        */
-                       return WAPI_PID_TO_HANDLE (pid);
-               } else {
-                       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Can't find pid %d", __func__, pid);
-
-                       SetLastError (ERROR_PROC_NOT_FOUND);
-       
-                       return NULL;
-               }
-       }
-
-       /* mono_w32handle_search () already added a ref */
-       return handle;
-}
-
-gboolean
-GetExitCodeProcess (gpointer process, guint32 *code)
-{
-       WapiHandle_process *process_handle;
-       guint32 pid = -1;
-       gboolean alerted;
-       
-       if (!code)
-               return FALSE;
-       
-       if (WAPI_IS_PSEUDO_PROCESS_HANDLE (process)) {
-               pid = WAPI_HANDLE_TO_PID (process);
-               /* This is a pseudo handle, so we don't know what the
-                * exit code was, but we can check whether it's alive or not
-                */
-               if (is_pid_valid (pid)) {
-                       *code = STILL_ACTIVE;
-                       return TRUE;
-               } else {
-                       *code = -1;
-                       return TRUE;
-               }
-       }
-
-       process_handle = lookup_process_handle (process);
-       if (!process_handle) {
-               MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Can't find process %p", __func__, process);
-               
-               return FALSE;
-       }
-
-       if (process_handle->id == wapi_getpid ()) {
-               *code = STILL_ACTIVE;
-               return TRUE;
-       }
-
-       /* A process handle is only signalled if the process has exited
-        * and has been waited for */
-
-       /* Make sure any process exit has been noticed, before
-        * checking if the process is signalled.  Fixes bug 325463.
-        */
-       process_wait (process, 0, &alerted);
-       
-       if (mono_w32handle_issignalled (process))
-               *code = process_handle->exitstatus;
-       else
-               *code = STILL_ACTIVE;
-       
-       return TRUE;
-}
-
-gboolean
-GetProcessTimes (gpointer process, WapiFileTime *create_time,
-                                WapiFileTime *exit_time, WapiFileTime *kernel_time,
-                                WapiFileTime *user_time)
-{
-       WapiHandle_process *process_handle;
-       gboolean ku_times_set = FALSE;
-       
-       if (create_time == NULL || exit_time == NULL || kernel_time == NULL ||
-               user_time == NULL)
-               /* Not sure if w32 allows NULLs here or not */
-               return FALSE;
-       
-       if (WAPI_IS_PSEUDO_PROCESS_HANDLE (process)) {
-               gpointer pid = GINT_TO_POINTER (WAPI_HANDLE_TO_PID(process));
-               gint64 start_ticks, user_ticks, kernel_ticks;
-
-               mono_process_get_times (pid, &start_ticks, &user_ticks, &kernel_ticks);
-
-               _wapi_guint64_to_filetime (start_ticks, create_time);
-               _wapi_guint64_to_filetime (user_ticks, kernel_time);
-               _wapi_guint64_to_filetime (kernel_ticks, user_time);
-
-               return TRUE;
-       }
-
-       process_handle = lookup_process_handle (process);
-       if (!process_handle) {
-               MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Can't find process %p", __func__, process);
-               
-               return FALSE;
-       }
-       
-       *create_time = process_handle->create_time;
-
-       /* A process handle is only signalled if the process has
-        * exited.  Otherwise exit_time isn't set
-        */
-       if (mono_w32handle_issignalled (process))
-               *exit_time = process_handle->exit_time;
-
-#ifdef HAVE_GETRUSAGE
-       if (process_handle->id == getpid ()) {
-               struct rusage time_data;
-               if (getrusage (RUSAGE_SELF, &time_data) == 0) {
-                       guint64 tick_val;
-                       ku_times_set = TRUE;
-                       tick_val = (guint64)time_data.ru_utime.tv_sec * 10000000 + (guint64)time_data.ru_utime.tv_usec * 10;
-                       _wapi_guint64_to_filetime (tick_val, user_time);
-                       tick_val = (guint64)time_data.ru_stime.tv_sec * 10000000 + (guint64)time_data.ru_stime.tv_usec * 10;
-                       _wapi_guint64_to_filetime (tick_val, kernel_time);
-               }
-       }
-#endif
-       if (!ku_times_set) {
-               memset (kernel_time, 0, sizeof (WapiFileTime));
-               memset (user_time, 0, sizeof (WapiFileTime));
-       }
-
-       return TRUE;
-}
-
-typedef struct
-{
-       gpointer address_start;
-       gpointer address_end;
-       char *perms;
-       gpointer address_offset;
-       guint64 device;
-       guint64 inode;
-       char *filename;
-} WapiProcModule;
-
-static void free_procmodule (WapiProcModule *mod)
-{
-       if (mod->perms != NULL) {
-               g_free (mod->perms);
-       }
-       if (mod->filename != NULL) {
-               g_free (mod->filename);
-       }
-       g_free (mod);
-}
-
-static gint find_procmodule (gconstpointer a, gconstpointer b)
-{
-       WapiProcModule *want = (WapiProcModule *)a;
-       WapiProcModule *compare = (WapiProcModule *)b;
-       
-       if ((want->device == compare->device) &&
-           (want->inode == compare->inode)) {
-               return(0);
-       } else {
-               return(1);
-       }
-}
-
-#if defined(USE_OSX_LOADER)
-#include <mach-o/dyld.h>
-#include <mach-o/getsect.h>
-
-static GSList *load_modules (void)
-{
-       GSList *ret = NULL;
-       WapiProcModule *mod;
-       uint32_t count = _dyld_image_count ();
-       int i = 0;
-
-       for (i = 0; i < count; i++) {
-#if SIZEOF_VOID_P == 8
-               const struct mach_header_64 *hdr;
-               const struct section_64 *sec;
-#else
-               const struct mach_header *hdr;
-               const struct section *sec;
-#endif
-               const char *name;
-
-               name = _dyld_get_image_name (i);
-#if SIZEOF_VOID_P == 8
-               hdr = (const struct mach_header_64*)_dyld_get_image_header (i);
-               sec = getsectbynamefromheader_64 (hdr, SEG_DATA, SECT_DATA);
-#else
-               hdr = _dyld_get_image_header (i);
-               sec = getsectbynamefromheader (hdr, SEG_DATA, SECT_DATA);
-#endif
-
-               /* Some dynlibs do not have data sections on osx (#533893) */
-               if (sec == 0) {
-                       continue;
-               }
-                       
-               mod = g_new0 (WapiProcModule, 1);
-               mod->address_start = GINT_TO_POINTER (sec->addr);
-               mod->address_end = GINT_TO_POINTER (sec->addr+sec->size);
-               mod->perms = g_strdup ("r--p");
-               mod->address_offset = 0;
-               mod->device = makedev (0, 0);
-               mod->inode = i;
-               mod->filename = g_strdup (name); 
-               
-               if (g_slist_find_custom (ret, mod, find_procmodule) == NULL) {
-                       ret = g_slist_prepend (ret, mod);
-               } else {
-                       free_procmodule (mod);
-               }
-       }
-
-       ret = g_slist_reverse (ret);
-       
-       return(ret);
-}
-#elif defined(USE_BSD_LOADER)
-#include <link.h>
-static int load_modules_callback (struct dl_phdr_info *info, size_t size, void *ptr)
-{
-       if (size < offsetof (struct dl_phdr_info, dlpi_phnum)
-           + sizeof (info->dlpi_phnum))
-               return (-1);
-
-       struct dl_phdr_info *cpy = calloc(1, sizeof(struct dl_phdr_info));
-       if (!cpy)
-               return (-1);
-
-       memcpy(cpy, info, sizeof(*info));
-
-       g_ptr_array_add ((GPtrArray *)ptr, cpy);
-
-       return (0);
-}
-
-static GSList *load_modules (void)
-{
-       GSList *ret = NULL;
-       WapiProcModule *mod;
-       GPtrArray *dlarray = g_ptr_array_new();
-       int i;
-
-       if (dl_iterate_phdr(load_modules_callback, dlarray) < 0)
-               return (ret);
-
-       for (i = 0; i < dlarray->len; i++) {
-               struct dl_phdr_info *info = g_ptr_array_index (dlarray, i);
-
-               mod = g_new0 (WapiProcModule, 1);
-               mod->address_start = (gpointer)(info->dlpi_addr + info->dlpi_phdr[0].p_vaddr);
-               mod->address_end = (gpointer)(info->dlpi_addr +
-                                       info->dlpi_phdr[info->dlpi_phnum - 1].p_vaddr);
-               mod->perms = g_strdup ("r--p");
-               mod->address_offset = 0;
-               mod->inode = i;
-               mod->filename = g_strdup (info->dlpi_name); 
-
-               MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: inode=%d, filename=%s, address_start=%p, address_end=%p", __func__,
-                                  mod->inode, mod->filename, mod->address_start, mod->address_end);
-
-               free(info);
-
-               if (g_slist_find_custom (ret, mod, find_procmodule) == NULL) {
-                       ret = g_slist_prepend (ret, mod);
-               } else {
-                       free_procmodule (mod);
-               }
-       }
-
-       g_ptr_array_free (dlarray, TRUE);
-
-       ret = g_slist_reverse (ret);
-
-       return(ret);
-}
-#elif defined(USE_HAIKU_LOADER)
-
-static GSList *load_modules (void)
-{
-       GSList *ret = NULL;
-       WapiProcModule *mod;
-       int32 cookie = 0;
-       image_info imageInfo;
-
-       while (get_next_image_info (B_CURRENT_TEAM, &cookie, &imageInfo) == B_OK) {
-               mod = g_new0 (WapiProcModule, 1);
-               mod->device = imageInfo.device;
-               mod->inode = imageInfo.node;
-               mod->filename = g_strdup (imageInfo.name);
-               mod->address_start = MIN (imageInfo.text, imageInfo.data);
-               mod->address_end = MAX ((uint8_t*)imageInfo.text + imageInfo.text_size,
-                       (uint8_t*)imageInfo.data + imageInfo.data_size);
-               mod->perms = g_strdup ("r--p");
-               mod->address_offset = 0;
-
-               if (g_slist_find_custom (ret, mod, find_procmodule) == NULL) {
-                       ret = g_slist_prepend (ret, mod);
-               } else {
-                       free_procmodule (mod);
-               }
-       }
-
-       ret = g_slist_reverse (ret);
-
-       return ret;
-}
-#else
-static GSList *load_modules (FILE *fp)
-{
-       GSList *ret = NULL;
-       WapiProcModule *mod;
-       char buf[MAXPATHLEN + 1], *p, *endp;
-       char *start_start, *end_start, *prot_start, *offset_start;
-       char *maj_dev_start, *min_dev_start, *inode_start, prot_buf[5];
-       gpointer address_start, address_end, address_offset;
-       guint32 maj_dev, min_dev;
-       guint64 inode;
-       guint64 device;
-       
-       while (fgets (buf, sizeof(buf), fp)) {
-               p = buf;
-               while (g_ascii_isspace (*p)) ++p;
-               start_start = p;
-               if (!g_ascii_isxdigit (*start_start)) {
-                       continue;
-               }
-               address_start = (gpointer)strtoul (start_start, &endp, 16);
-               p = endp;
-               if (*p != '-') {
-                       continue;
-               }
-               
-               ++p;
-               end_start = p;
-               if (!g_ascii_isxdigit (*end_start)) {
-                       continue;
-               }
-               address_end = (gpointer)strtoul (end_start, &endp, 16);
-               p = endp;
-               if (!g_ascii_isspace (*p)) {
-                       continue;
-               }
-               
-               while (g_ascii_isspace (*p)) ++p;
-               prot_start = p;
-               if (*prot_start != 'r' && *prot_start != '-') {
-                       continue;
-               }
-               memcpy (prot_buf, prot_start, 4);
-               prot_buf[4] = '\0';
-               while (!g_ascii_isspace (*p)) ++p;
-               
-               while (g_ascii_isspace (*p)) ++p;
-               offset_start = p;
-               if (!g_ascii_isxdigit (*offset_start)) {
-                       continue;
-               }
-               address_offset = (gpointer)strtoul (offset_start, &endp, 16);
-               p = endp;
-               if (!g_ascii_isspace (*p)) {
-                       continue;
-               }
-               
-               while(g_ascii_isspace (*p)) ++p;
-               maj_dev_start = p;
-               if (!g_ascii_isxdigit (*maj_dev_start)) {
-                       continue;
-               }
-               maj_dev = strtoul (maj_dev_start, &endp, 16);
-               p = endp;
-               if (*p != ':') {
-                       continue;
-               }
-               
-               ++p;
-               min_dev_start = p;
-               if (!g_ascii_isxdigit (*min_dev_start)) {
-                       continue;
-               }
-               min_dev = strtoul (min_dev_start, &endp, 16);
-               p = endp;
-               if (!g_ascii_isspace (*p)) {
-                       continue;
-               }
-               
-               while (g_ascii_isspace (*p)) ++p;
-               inode_start = p;
-               if (!g_ascii_isxdigit (*inode_start)) {
-                       continue;
-               }
-               inode = (guint64)strtol (inode_start, &endp, 10);
-               p = endp;
-               if (!g_ascii_isspace (*p)) {
-                       continue;
-               }
-
-               device = makedev ((int)maj_dev, (int)min_dev);
-               if ((device == 0) &&
-                   (inode == 0)) {
-                       continue;
-               }
-               
-               while(g_ascii_isspace (*p)) ++p;
-               /* p now points to the filename */
-
-               mod = g_new0 (WapiProcModule, 1);
-               mod->address_start = address_start;
-               mod->address_end = address_end;
-               mod->perms = g_strdup (prot_buf);
-               mod->address_offset = address_offset;
-               mod->device = device;
-               mod->inode = inode;
-               mod->filename = g_strdup (g_strstrip (p));
-               
-               if (g_slist_find_custom (ret, mod, find_procmodule) == NULL) {
-                       ret = g_slist_prepend (ret, mod);
-               } else {
-                       free_procmodule (mod);
-               }
-       }
-
-       ret = g_slist_reverse (ret);
-       
-       return(ret);
-}
-#endif
-
-static gboolean match_procname_to_modulename (char *procname, char *modulename)
-{
-       char* lastsep = NULL;
-       char* lastsep2 = NULL;
-       char* pname = NULL;
-       char* mname = NULL;
-       gboolean result = FALSE;
-
-       if (procname == NULL || modulename == NULL)
-               return (FALSE);
-
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: procname=\"%s\", modulename=\"%s\"", __func__, procname, modulename);
-       pname = mono_path_resolve_symlinks (procname);
-       mname = mono_path_resolve_symlinks (modulename);
-
-       if (!strcmp (pname, mname))
-               result = TRUE;
-
-       if (!result) {
-               lastsep = strrchr (mname, '/');
-               if (lastsep)
-                       if (!strcmp (lastsep+1, pname))
-                               result = TRUE;
-               if (!result) {
-                       lastsep2 = strrchr (pname, '/');
-                       if (lastsep2){
-                               if (lastsep) {
-                                       if (!strcmp (lastsep+1, lastsep2+1))
-                                               result = TRUE;
-                               } else {
-                                       if (!strcmp (mname, lastsep2+1))
-                                               result = TRUE;
-                               }
-                       }
-               }
-       }
-
-       g_free (pname);
-       g_free (mname);
-
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: result is %d", __func__, result);
-       return result;
-}
-
-#if !(defined(USE_OSX_LOADER) || defined(USE_BSD_LOADER) || defined(USE_HAIKU_LOADER))
-static FILE *
-open_process_map (int pid, const char *mode)
-{
-       FILE *fp = NULL;
-       const char *proc_path[] = {
-               "/proc/%d/maps",        /* GNU/Linux */
-               "/proc/%d/map",         /* FreeBSD */
-               NULL
-       };
-       int i;
-       char *filename;
-
-       for (i = 0; fp == NULL && proc_path [i]; i++) {
-               filename = g_strdup_printf (proc_path[i], pid);
-               fp = fopen (filename, mode);
-               g_free (filename);
-       }
-
-       return fp;
-}
-#endif
-
-static char *get_process_name_from_proc (pid_t pid);
-
-gboolean EnumProcessModules (gpointer process, gpointer *modules,
-                            guint32 size, guint32 *needed)
-{
-       WapiHandle_process *process_handle;
-#if !defined(USE_OSX_LOADER) && !defined(USE_BSD_LOADER)
-       FILE *fp;
-#endif
-       GSList *mods = NULL;
-       WapiProcModule *module;
-       guint32 count, avail = size / sizeof(gpointer);
-       int i;
-       pid_t pid;
-       char *proc_name = NULL;
-       
-       /* Store modules in an array of pointers (main module as
-        * modules[0]), using the load address for each module as a
-        * token.  (Use 'NULL' as an alternative for the main module
-        * so that the simple implementation can just return one item
-        * for now.)  Get the info from /proc/<pid>/maps on linux,
-        * /proc/<pid>/map on FreeBSD, other systems will have to
-        * implement /dev/kmem reading or whatever other horrid
-        * technique is needed.
-        */
-       if (size < sizeof(gpointer))
-               return FALSE;
-
-       if (WAPI_IS_PSEUDO_PROCESS_HANDLE (process)) {
-               pid = WAPI_HANDLE_TO_PID (process);
-               proc_name = get_process_name_from_proc (pid);
-       } else {
-               process_handle = lookup_process_handle (process);
-               if (!process_handle) {
-                       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Can't find process %p", __func__, process);
-               
-                       return FALSE;
-               }
-               pid = process_handle->id;
-               proc_name = g_strdup (process_handle->proc_name);
-       }
-       
-#if defined(USE_OSX_LOADER) || defined(USE_BSD_LOADER) || defined(USE_HAIKU_LOADER)
-       mods = load_modules ();
-       if (!proc_name) {
-               modules[0] = NULL;
-               *needed = sizeof(gpointer);
-               return TRUE;
-       }
-#else
-       fp = open_process_map (pid, "r");
-       if (!fp) {
-               /* No /proc/<pid>/maps so just return the main module
-                * shortcut for now
-                */
-               modules[0] = NULL;
-               *needed = sizeof(gpointer);
-               g_free (proc_name);
-               return TRUE;
-       }
-       mods = load_modules (fp);
-       fclose (fp);
-#endif
-       count = g_slist_length (mods);
-               
-       /* count + 1 to leave slot 0 for the main module */
-       *needed = sizeof(gpointer) * (count + 1);
-
-       /*
-        * Use the NULL shortcut, as the first line in
-        * /proc/<pid>/maps isn't the executable, and we need
-        * that first in the returned list. Check the module name 
-        * to see if it ends with the proc name and substitute 
-        * the first entry with it.  FIXME if this turns out to 
-        * be a problem.
-        */
-       modules[0] = NULL;
-       for (i = 0; i < (avail - 1) && i < count; i++) {
-               module = (WapiProcModule *)g_slist_nth_data (mods, i);
-               if (modules[0] != NULL)
-                       modules[i] = module->address_start;
-               else if (match_procname_to_modulename (proc_name, module->filename))
-                       modules[0] = module->address_start;
-               else
-                       modules[i + 1] = module->address_start;
-       }
-               
-       for (i = 0; i < count; i++) {
-               free_procmodule ((WapiProcModule *)g_slist_nth_data (mods, i));
-       }
-       g_slist_free (mods);
-       g_free (proc_name);
-       
-       return TRUE;
-}
-
-static char *
-get_process_name_from_proc (pid_t pid)
-{
-#if defined(USE_BSD_LOADER)
-       int mib [6];
-       size_t size;
-       struct kinfo_proc *pi;
-#elif defined(USE_OSX_LOADER)
-#if !(!defined (__mono_ppc__) && defined (TARGET_OSX))
-       size_t size;
-       struct kinfo_proc *pi;
-       int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, pid };
-#endif
-#else
-       FILE *fp;
-       char *filename = NULL;
-#endif
-       char buf[256];
-       char *ret = NULL;
-
-#if defined(PLATFORM_SOLARIS)
-       filename = g_strdup_printf ("/proc/%d/psinfo", pid);
-       if ((fp = fopen (filename, "r")) != NULL) {
-               struct psinfo info;
-               int nread;
-
-               nread = fread (&info, sizeof (info), 1, fp);
-               if (nread == 1) {
-                       ret = g_strdup (info.pr_fname);
-               }
-
-               fclose (fp);
-       }
-       g_free (filename);
-#elif defined(USE_OSX_LOADER)
-#if !defined (__mono_ppc__) && defined (TARGET_OSX)
-       /* No proc name on OSX < 10.5 nor ppc nor iOS */
-       memset (buf, '\0', sizeof(buf));
-       proc_name (pid, buf, sizeof(buf));
-
-       // Fixes proc_name triming values to 15 characters #32539
-       if (strlen (buf) >= MAXCOMLEN - 1) {
-               char path_buf [PROC_PIDPATHINFO_MAXSIZE];
-               char *name_buf;
-               int path_len;
-
-               memset (path_buf, '\0', sizeof(path_buf));
-               path_len = proc_pidpath (pid, path_buf, sizeof(path_buf));
-
-               if (path_len > 0 && path_len < sizeof(path_buf)) {
-                       name_buf = path_buf + path_len;
-                       for(;name_buf > path_buf; name_buf--) {
-                               if (name_buf [0] == '/') {
-                                       name_buf++;
-                                       break;
-                               }
-                       }
-
-                       if (memcmp (buf, name_buf, MAXCOMLEN - 1) == 0)
-                               ret = g_strdup (name_buf);
-               }
-       }
-
-       if (ret == NULL && strlen (buf) > 0)
-               ret = g_strdup (buf);
-#else
-       if (sysctl(mib, 4, NULL, &size, NULL, 0) < 0)
-               return(ret);
-
-       if ((pi = malloc(size)) == NULL)
-               return(ret);
-
-       if (sysctl (mib, 4, pi, &size, NULL, 0) < 0) {
-               if (errno == ENOMEM) {
-                       free(pi);
-                       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Didn't allocate enough memory for kproc info", __func__);
-               }
-               return(ret);
-       }
-
-       if (strlen (pi->kp_proc.p_comm) > 0)
-               ret = g_strdup (pi->kp_proc.p_comm);
-
-       free(pi);
-#endif
-#elif defined(USE_BSD_LOADER)
-#if defined(__FreeBSD__)
-       mib [0] = CTL_KERN;
-       mib [1] = KERN_PROC;
-       mib [2] = KERN_PROC_PID;
-       mib [3] = pid;
-       if (sysctl(mib, 4, NULL, &size, NULL, 0) < 0) {
-               MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: sysctl() failed: %d", __func__, errno);
-               return(ret);
-       }
-
-       if ((pi = malloc(size)) == NULL)
-               return(ret);
-
-       if (sysctl (mib, 4, pi, &size, NULL, 0) < 0) {
-               if (errno == ENOMEM) {
-                       free(pi);
-                       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Didn't allocate enough memory for kproc info", __func__);
-               }
-               return(ret);
-       }
-
-       if (strlen (pi->ki_comm) > 0)
-               ret = g_strdup (pi->ki_comm);
-       free(pi);
-#elif defined(__OpenBSD__)
-       mib [0] = CTL_KERN;
-       mib [1] = KERN_PROC;
-       mib [2] = KERN_PROC_PID;
-       mib [3] = pid;
-       mib [4] = sizeof(struct kinfo_proc);
-       mib [5] = 0;
-
-retry:
-       if (sysctl(mib, 6, NULL, &size, NULL, 0) < 0) {
-               MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: sysctl() failed: %d", __func__, errno);
-               return(ret);
-       }
-
-       if ((pi = malloc(size)) == NULL)
-               return(ret);
-
-       mib[5] = (int)(size / sizeof(struct kinfo_proc));
-
-       if ((sysctl (mib, 6, pi, &size, NULL, 0) < 0) ||
-               (size != sizeof (struct kinfo_proc))) {
-               if (errno == ENOMEM) {
-                       free(pi);
-                       goto retry;
-               }
-               return(ret);
-       }
-
-       if (strlen (pi->p_comm) > 0)
-               ret = g_strdup (pi->p_comm);
-
-       free(pi);
-#endif
-#elif defined(USE_HAIKU_LOADER)
-       image_info imageInfo;
-       int32 cookie = 0;
-
-       if (get_next_image_info ((team_id)pid, &cookie, &imageInfo) == B_OK) {
-               ret = g_strdup (imageInfo.name);
-       }
-#else
-       memset (buf, '\0', sizeof(buf));
-       filename = g_strdup_printf ("/proc/%d/exe", pid);
-       if (readlink (filename, buf, 255) > 0) {
-               ret = g_strdup (buf);
-       }
-       g_free (filename);
-
-       if (ret != NULL) {
-               return(ret);
-       }
-
-       filename = g_strdup_printf ("/proc/%d/cmdline", pid);
-       if ((fp = fopen (filename, "r")) != NULL) {
-               if (fgets (buf, 256, fp) != NULL) {
-                       ret = g_strdup (buf);
-               }
-               
-               fclose (fp);
-       }
-       g_free (filename);
-
-       if (ret != NULL) {
-               return(ret);
-       }
-       
-       filename = g_strdup_printf ("/proc/%d/stat", pid);
-       if ((fp = fopen (filename, "r")) != NULL) {
-               if (fgets (buf, 256, fp) != NULL) {
-                       char *start, *end;
-                       
-                       start = strchr (buf, '(');
-                       if (start != NULL) {
-                               end = strchr (start + 1, ')');
-                               
-                               if (end != NULL) {
-                                       ret = g_strndup (start + 1,
-                                                        end - start - 1);
-                               }
-                       }
-               }
-               
-               fclose (fp);
-       }
-       g_free (filename);
-#endif
-
-       return ret;
-}
-
-/*
- * wapi_process_get_path:
- *
- *   Return the full path of the executable of the process PID, or NULL if it cannot be determined.
- * Returns malloc-ed memory.
- */
-char*
-wapi_process_get_path (pid_t pid)
-{
-#if defined(PLATFORM_MACOSX) && !defined(__mono_ppc__) && defined(TARGET_OSX)
-       char buf [PROC_PIDPATHINFO_MAXSIZE];
-       int res;
-
-       res = proc_pidpath (pid, buf, sizeof (buf));
-       if (res <= 0)
-               return NULL;
-       if (buf [0] == '\0')
-               return NULL;
-       return g_strdup (buf);
-#else
-       return get_process_name_from_proc (pid);
-#endif
-}
-
-/*
- * wapi_process_set_cli_launcher:
- *
- *   Set the full path of the runtime executable used to launch managed exe's.
- */
-void
-wapi_process_set_cli_launcher (char *path)
-{
-       g_free (cli_launcher);
-       cli_launcher = path ? g_strdup (path) : NULL;
-}
-
-static guint32
-get_module_name (gpointer process, gpointer module,
-                                gunichar2 *basename, guint32 size,
-                                gboolean base)
-{
-       WapiHandle_process *process_handle;
-       pid_t pid;
-       gunichar2 *procname;
-       char *procname_ext = NULL;
-       glong len;
-       gsize bytes;
-#if !defined(USE_OSX_LOADER) && !defined(USE_BSD_LOADER)
-       FILE *fp;
-#endif
-       GSList *mods = NULL;
-       WapiProcModule *found_module;
-       guint32 count;
-       int i;
-       char *proc_name = NULL;
-       
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Getting module base name, process handle %p module %p",
-                  __func__, process, module);
-
-       size = size * sizeof (gunichar2); /* adjust for unicode characters */
-
-       if (basename == NULL || size == 0)
-               return 0;
-       
-       if (WAPI_IS_PSEUDO_PROCESS_HANDLE (process)) {
-               /* This is a pseudo handle */
-               pid = (pid_t)WAPI_HANDLE_TO_PID (process);
-               proc_name = get_process_name_from_proc (pid);
-       } else {
-               process_handle = lookup_process_handle (process);
-               if (!process_handle) {
-                       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Can't find process %p", __func__,
-                                  process);
-                       
-                       return 0;
-               }
-               pid = process_handle->id;
-               proc_name = g_strdup (process_handle->proc_name);
-       }
-
-       /* Look up the address in /proc/<pid>/maps */
-#if defined(USE_OSX_LOADER) || defined(USE_BSD_LOADER) || defined(USE_HAIKU_LOADER)
-       mods = load_modules ();
-#else
-       fp = open_process_map (pid, "r");
-       if (fp == NULL) {
-               if (errno == EACCES && module == NULL && base == TRUE) {
-                       procname_ext = get_process_name_from_proc (pid);
-               } else {
-                       /* No /proc/<pid>/maps, so just return failure
-                        * for now
-                        */
-                       g_free (proc_name);
-                       return 0;
-               }
-       } else {
-               mods = load_modules (fp);
-               fclose (fp);
-       }
-#endif
-       count = g_slist_length (mods);
-
-       /* If module != NULL compare the address.
-        * If module == NULL we are looking for the main module.
-        * The best we can do for now check it the module name end with the process name.
-        */
-       for (i = 0; i < count; i++) {
-               found_module = (WapiProcModule *)g_slist_nth_data (mods, i);
-               if (procname_ext == NULL &&
-                       ((module == NULL && match_procname_to_modulename (proc_name, found_module->filename)) ||
-                        (module != NULL && found_module->address_start == module))) {
-                       if (base)
-                               procname_ext = g_path_get_basename (found_module->filename);
-                       else
-                               procname_ext = g_strdup (found_module->filename);
-               }
-
-               free_procmodule (found_module);
-       }
-
-       if (procname_ext == NULL) {
-               /* If it's *still* null, we might have hit the
-                * case where reading /proc/$pid/maps gives an
-                * empty file for this user.
-                */
-               procname_ext = get_process_name_from_proc (pid);
-       }
-
-       g_slist_free (mods);
-       g_free (proc_name);
-
-       if (procname_ext) {
-               MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Process name is [%s]", __func__,
-                          procname_ext);
-
-               procname = mono_unicode_from_external (procname_ext, &bytes);
-               if (procname == NULL) {
-                       /* bugger */
-                       g_free (procname_ext);
-                       return 0;
-               }
-               
-               len = (bytes / 2);
-               
-               /* Add the terminator */
-               bytes += 2;
-               
-               if (size < bytes) {
-                       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Size %d smaller than needed (%ld); truncating", __func__, size, bytes);
-
-                       memcpy (basename, procname, size);
-               } else {
-                       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Size %d larger than needed (%ld)",
-                                  __func__, size, bytes);
-
-                       memcpy (basename, procname, bytes);
-               }
-               
-               g_free (procname);
-               g_free (procname_ext);
-               
-               return len;
-       }
-       
-       return 0;
-}
-
-static guint32
-get_module_filename (gpointer process, gpointer module,
-                                        gunichar2 *basename, guint32 size)
-{
-       int pid, len;
-       gsize bytes;
-       char *path;
-       gunichar2 *proc_path;
-       
-       size *= sizeof (gunichar2); /* adjust for unicode characters */
-
-       if (basename == NULL || size == 0)
-               return 0;
-
-       pid = GetProcessId (process);
-
-       path = wapi_process_get_path (pid);
-       if (path == NULL)
-               return 0;
-
-       proc_path = mono_unicode_from_external (path, &bytes);
-       g_free (path);
-
-       if (proc_path == NULL)
-               return 0;
-
-       len = (bytes / 2);
-       
-       /* Add the terminator */
-       bytes += 2;
-
-       if (size < bytes) {
-               MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Size %d smaller than needed (%ld); truncating", __func__, size, bytes);
-
-               memcpy (basename, proc_path, size);
-       } else {
-               MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Size %d larger than needed (%ld)",
-                          __func__, size, bytes);
-
-               memcpy (basename, proc_path, bytes);
-       }
-
-       g_free (proc_path);
-
-       return len;
-}
-
-guint32
-GetModuleBaseName (gpointer process, gpointer module,
-                                  gunichar2 *basename, guint32 size)
-{
-       return get_module_name (process, module, basename, size, TRUE);
-}
-
-guint32
-GetModuleFileNameEx (gpointer process, gpointer module,
-                                        gunichar2 *filename, guint32 size)
-{
-       return get_module_filename (process, module, filename, size);
-}
-
-gboolean
-GetModuleInformation (gpointer process, gpointer module,
-                                         WapiModuleInfo *modinfo, guint32 size)
-{
-       WapiHandle_process *process_handle;
-       pid_t pid;
-#if !defined(USE_OSX_LOADER) && !defined(USE_BSD_LOADER)
-       FILE *fp;
-#endif
-       GSList *mods = NULL;
-       WapiProcModule *found_module;
-       guint32 count;
-       int i;
-       gboolean ret = FALSE;
-       char *proc_name = NULL;
-       
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Getting module info, process handle %p module %p",
-                  __func__, process, module);
-
-       if (modinfo == NULL || size < sizeof (WapiModuleInfo))
-               return FALSE;
-       
-       if (WAPI_IS_PSEUDO_PROCESS_HANDLE (process)) {
-               pid = (pid_t)WAPI_HANDLE_TO_PID (process);
-               proc_name = get_process_name_from_proc (pid);
-       } else {
-               process_handle = lookup_process_handle (process);
-               if (!process_handle) {
-                       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Can't find process %p", __func__,
-                                  process);
-                       
-                       return FALSE;
-               }
-               pid = process_handle->id;
-               proc_name = g_strdup (process_handle->proc_name);
-       }
-
-#if defined(USE_OSX_LOADER) || defined(USE_BSD_LOADER) || defined(USE_HAIKU_LOADER)
-       mods = load_modules ();
-#else
-       /* Look up the address in /proc/<pid>/maps */
-       if ((fp = open_process_map (pid, "r")) == NULL) {
-               /* No /proc/<pid>/maps, so just return failure
-                * for now
-                */
-               g_free (proc_name);
-               return FALSE;
-       }
-       mods = load_modules (fp);
-       fclose (fp);
-#endif
-       count = g_slist_length (mods);
-
-       /* If module != NULL compare the address.
-        * If module == NULL we are looking for the main module.
-        * The best we can do for now check it the module name end with the process name.
-        */
-       for (i = 0; i < count; i++) {
-                       found_module = (WapiProcModule *)g_slist_nth_data (mods, i);
-                       if (ret == FALSE &&
-                               ((module == NULL && match_procname_to_modulename (proc_name, found_module->filename)) ||
-                                (module != NULL && found_module->address_start == module))) {
-                               modinfo->lpBaseOfDll = found_module->address_start;
-                               modinfo->SizeOfImage = (gsize)(found_module->address_end) - (gsize)(found_module->address_start);
-                               modinfo->EntryPoint = found_module->address_offset;
-                               ret = TRUE;
-                       }
-
-                       free_procmodule (found_module);
-       }
-
-       g_slist_free (mods);
-       g_free (proc_name);
-
-       return ret;
-}
-
-gboolean
-GetProcessWorkingSetSize (gpointer process, size_t *min, size_t *max)
-{
-       WapiHandle_process *process_handle;
-       
-       if (min == NULL || max == NULL)
-               /* Not sure if w32 allows NULLs here or not */
-               return FALSE;
-       
-       if (WAPI_IS_PSEUDO_PROCESS_HANDLE (process))
-               /* This is a pseudo handle, so just fail for now */
-               return FALSE;
-       
-       process_handle = lookup_process_handle (process);
-       if (!process_handle) {
-               MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Can't find process %p", __func__, process);
-               
-               return FALSE;
-       }
-
-       *min = process_handle->min_working_set;
-       *max = process_handle->max_working_set;
-       
-       return TRUE;
-}
-
-gboolean
-SetProcessWorkingSetSize (gpointer process, size_t min, size_t max)
-{
-       WapiHandle_process *process_handle;
-
-       if (WAPI_IS_PSEUDO_PROCESS_HANDLE (process))
-               /* This is a pseudo handle, so just fail for now
-                */
-               return FALSE;
-
-       process_handle = lookup_process_handle (process);
-       if (!process_handle) {
-               MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Can't find process %p", __func__, process);
-               
-               return FALSE;
-       }
-
-       process_handle->min_working_set = min;
-       process_handle->max_working_set = max;
-       
-       return TRUE;
-}
-
-
-gboolean
-TerminateProcess (gpointer process, gint32 exitCode)
-{
-#if defined(HAVE_KILL)
-       WapiHandle_process *process_handle;
-       int signo;
-       int ret;
-       pid_t pid;
-       
-       if (WAPI_IS_PSEUDO_PROCESS_HANDLE (process)) {
-               /* This is a pseudo handle */
-               pid = (pid_t)WAPI_HANDLE_TO_PID (process);
-       } else {
-               process_handle = lookup_process_handle (process);
-               if (!process_handle) {
-                       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Can't find process %p", __func__, process);
-                       SetLastError (ERROR_INVALID_HANDLE);
-                       return FALSE;
-               }
-               pid = process_handle->id;
-       }
-
-       signo = (exitCode == -1) ? SIGKILL : SIGTERM;
-       ret = kill (pid, signo);
-       if (ret == -1) {
-               switch (errno) {
-               case EINVAL:
-                       SetLastError (ERROR_INVALID_PARAMETER);
-                       break;
-               case EPERM:
-                       SetLastError (ERROR_ACCESS_DENIED);
-                       break;
-               case ESRCH:
-                       SetLastError (ERROR_PROC_NOT_FOUND);
-                       break;
-               default:
-                       SetLastError (ERROR_GEN_FAILURE);
-               }
-       }
-       
-       return (ret == 0);
-#else
-       g_error ("kill() is not supported by this platform");
-       return FALSE;
-#endif
-}
-
-guint32
-GetPriorityClass (gpointer process)
-{
-#ifdef HAVE_GETPRIORITY
-       WapiHandle_process *process_handle;
-       int ret;
-       pid_t pid;
-       
-       if (WAPI_IS_PSEUDO_PROCESS_HANDLE (process)) {
-               /* This is a pseudo handle */
-               pid = (pid_t)WAPI_HANDLE_TO_PID (process);
-       } else {
-               process_handle = lookup_process_handle (process);
-               if (!process_handle) {
-                       SetLastError (ERROR_INVALID_HANDLE);
-                       return FALSE;
-               }
-               pid = process_handle->id;
-       }
-
-       errno = 0;
-       ret = getpriority (PRIO_PROCESS, pid);
-       if (ret == -1 && errno != 0) {
-               switch (errno) {
-               case EPERM:
-               case EACCES:
-                       SetLastError (ERROR_ACCESS_DENIED);
-                       break;
-               case ESRCH:
-                       SetLastError (ERROR_PROC_NOT_FOUND);
-                       break;
-               default:
-                       SetLastError (ERROR_GEN_FAILURE);
-               }
-               return FALSE;
-       }
-
-       if (ret == 0)
-               return NORMAL_PRIORITY_CLASS;
-       else if (ret < -15)
-               return REALTIME_PRIORITY_CLASS;
-       else if (ret < -10)
-               return HIGH_PRIORITY_CLASS;
-       else if (ret < 0)
-               return ABOVE_NORMAL_PRIORITY_CLASS;
-       else if (ret > 10)
-               return IDLE_PRIORITY_CLASS;
-       else if (ret > 0)
-               return BELOW_NORMAL_PRIORITY_CLASS;
-
-       return NORMAL_PRIORITY_CLASS;
-#else
-       SetLastError (ERROR_NOT_SUPPORTED);
-       return 0;
-#endif
-}
-
-gboolean
-SetPriorityClass (gpointer process, guint32  priority_class)
-{
-#ifdef HAVE_SETPRIORITY
-       WapiHandle_process *process_handle;
-       int ret;
-       int prio;
-       pid_t pid;
-       
-       if (WAPI_IS_PSEUDO_PROCESS_HANDLE (process)) {
-               /* This is a pseudo handle */
-               pid = (pid_t)WAPI_HANDLE_TO_PID (process);
-       } else {
-               process_handle = lookup_process_handle (process);
-               if (!process_handle) {
-                       SetLastError (ERROR_INVALID_HANDLE);
-                       return FALSE;
-               }
-               pid = process_handle->id;
-       }
-
-       switch (priority_class) {
-       case IDLE_PRIORITY_CLASS:
-               prio = 19;
-               break;
-       case BELOW_NORMAL_PRIORITY_CLASS:
-               prio = 10;
-               break;
-       case NORMAL_PRIORITY_CLASS:
-               prio = 0;
-               break;
-       case ABOVE_NORMAL_PRIORITY_CLASS:
-               prio = -5;
-               break;
-       case HIGH_PRIORITY_CLASS:
-               prio = -11;
-               break;
-       case REALTIME_PRIORITY_CLASS:
-               prio = -20;
-               break;
-       default:
-               SetLastError (ERROR_INVALID_PARAMETER);
-               return FALSE;
-       }
-
-       ret = setpriority (PRIO_PROCESS, pid, prio);
-       if (ret == -1) {
-               switch (errno) {
-               case EPERM:
-               case EACCES:
-                       SetLastError (ERROR_ACCESS_DENIED);
-                       break;
-               case ESRCH:
-                       SetLastError (ERROR_PROC_NOT_FOUND);
-                       break;
-               default:
-                       SetLastError (ERROR_GEN_FAILURE);
-               }
-       }
-
-       return ret == 0;
-#else
-       SetLastError (ERROR_NOT_SUPPORTED);
-       return FALSE;
-#endif
-}
-
-static void
-mono_processes_cleanup (void)
-{
-       struct MonoProcess *mp;
-       struct MonoProcess *prev = NULL;
-       GSList *finished = NULL;
-       GSList *l;
-       gpointer unref_handle;
-
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s", __func__);
-
-       /* Ensure we're not in here in multiple threads at once, nor recursive. */
-       if (InterlockedCompareExchange (&mono_processes_cleaning_up, 1, 0) != 0)
-               return;
-
-       for (mp = mono_processes; mp; mp = mp->next) {
-               if (mp->pid == 0 && mp->handle) {
-                       /* This process has exited and we need to remove the artifical ref
-                        * on the handle */
-                       mono_os_mutex_lock (&mono_processes_mutex);
-                       unref_handle = mp->handle;
-                       mp->handle = NULL;
-                       mono_os_mutex_unlock (&mono_processes_mutex);
-                       if (unref_handle)
-                               mono_w32handle_unref (unref_handle);
-               }
-       }
-
-       /*
-        * Remove processes which exited from the mono_processes list.
-        * We need to synchronize with the sigchld handler here, which runs
-        * asynchronously. The handler requires that the mono_processes list
-        * remain valid.
-        */
-       mono_os_mutex_lock (&mono_processes_mutex);
-
-       mp = mono_processes;
-       while (mp) {
-               if (mp->handle_count == 0 && mp->freeable) {
-                       /*
-                        * Unlink the entry.
-                        * This code can run parallel with the sigchld handler, but the
-                        * modifications it makes are safe.
-                        */
-                       if (mp == mono_processes)
-                               mono_processes = mp->next;
-                       else
-                               prev->next = mp->next;
-                       finished = g_slist_prepend (finished, mp);
-
-                       mp = mp->next;
-               } else {
-                       prev = mp;
-                       mp = mp->next;
-               }
-       }
-
-       mono_memory_barrier ();
-
-       for (l = finished; l; l = l->next) {
-               /*
-                * All the entries in the finished list are unlinked from mono_processes, and
-                * they have the 'finished' flag set, which means the sigchld handler is done
-                * accessing them.
-                */
-               mp = (MonoProcess *)l->data;
-               mono_os_sem_destroy (&mp->exit_sem);
-               g_free (mp);
-       }
-       g_slist_free (finished);
-
-       mono_os_mutex_unlock (&mono_processes_mutex);
-
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s done", __func__);
-
-       InterlockedDecrement (&mono_processes_cleaning_up);
-}
-
-static void
-process_close (gpointer handle, gpointer data)
-{
-       WapiHandle_process *process_handle;
-
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s", __func__);
-
-       process_handle = (WapiHandle_process *) data;
-       g_free (process_handle->proc_name);
-       process_handle->proc_name = NULL;
-       if (process_handle->mono_process)
-               InterlockedDecrement (&process_handle->mono_process->handle_count);
-       mono_processes_cleanup ();
-}
-
-static void process_details (gpointer data)
-{
-       WapiHandle_process *process_handle = (WapiHandle_process *) data;
-       g_print ("id: %d, exited: %s, exitstatus: %d",
-               process_handle->id, process_handle->exited ? "true" : "false", process_handle->exitstatus);
-}
-
-static const gchar* process_typename (void)
-{
-       return "Process";
-}
-
-static gsize process_typesize (void)
-{
-       return sizeof (WapiHandle_process);
-}
-
-#if HAVE_SIGACTION
-MONO_SIGNAL_HANDLER_FUNC (static, mono_sigchld_signal_handler, (int _dummy, siginfo_t *info, void *context))
-{
-       int status;
-       int pid;
-       struct MonoProcess *p;
-
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "SIG CHILD handler for pid: %i\n", info->si_pid);
-
-       do {
-               do {
-                       pid = waitpid (-1, &status, WNOHANG);
-               } while (pid == -1 && errno == EINTR);
-
-               if (pid <= 0)
-                       break;
-
-               MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "child ended: %i", pid);
-
-               /*
-                * This can run concurrently with the code in the rest of this module.
-                */
-               for (p = mono_processes; p; p = p->next) {
-                       if (p->pid == pid) {
-                               break;
-                       }
-               }
-               if (p) {
-                       p->pid = 0; /* this pid doesn't exist anymore, clear it */
-                       p->status = status;
-                       mono_os_sem_post (&p->exit_sem);
-                       mono_memory_barrier ();
-                       /* Mark this as freeable, the pointer becomes invalid afterwards */
-                       p->freeable = TRUE;
-               }
-       } while (1);
-
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "SIG CHILD handler: done looping.");
-}
-
-#endif
-
-static void
-process_add_sigchld_handler (void)
-{
-#if HAVE_SIGACTION
-       struct sigaction sa;
-
-       sa.sa_sigaction = mono_sigchld_signal_handler;
-       sigemptyset (&sa.sa_mask);
-       sa.sa_flags = SA_NOCLDSTOP | SA_SIGINFO;
-       g_assert (sigaction (SIGCHLD, &sa, &previous_chld_sa) != -1);
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "Added SIGCHLD handler");
-#endif
-}
-
-static guint32
-process_wait (gpointer handle, guint32 timeout, gboolean *alerted)
-{
-       WapiHandle_process *process_handle;
-       pid_t pid G_GNUC_UNUSED, ret;
-       int status;
-       gint64 start, now;
-       struct MonoProcess *mp;
-
-       /* FIXME: We can now easily wait on processes that aren't our own children,
-        * but WaitFor*Object won't call us for pseudo handles. */
-       g_assert ((GPOINTER_TO_UINT (handle) & _WAPI_PROCESS_UNHANDLED) != _WAPI_PROCESS_UNHANDLED);
-
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s (%p, %u)", __func__, handle, timeout);
-
-       if (alerted)
-               *alerted = FALSE;
-
-       process_handle = lookup_process_handle (handle);
-       if (!process_handle) {
-               g_warning ("%s: error looking up process handle %p", __func__, handle);
-               return WAIT_FAILED;
-       }
-
-       if (process_handle->exited) {
-               /* We've already done this one */
-               MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s (%p, %u): Process already exited", __func__, handle, timeout);
-               return WAIT_OBJECT_0;
-       }
-
-       pid = process_handle->id;
-
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s (%p, %u): PID: %d", __func__, handle, timeout, pid);
-
-       /* We don't need to lock mono_processes here, the entry
-        * has a handle_count > 0 which means it will not be freed. */
-       mp = process_handle->mono_process;
-       if (!mp) {
-               pid_t res;
-
-               if (pid == mono_process_current_pid ()) {
-                       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s (%p, %u): waiting on current process", __func__, handle, timeout);
-                       return WAIT_TIMEOUT;
-               }
-
-               /* This path is used when calling Process.HasExited, so
-                * it is only used to poll the state of the process, not
-                * to actually wait on it to exit */
-               g_assert (timeout == 0);
-
-               MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s (%p, %u): waiting on non-child process", __func__, handle, timeout);
-
-               res = waitpid (pid, &status, WNOHANG);
-               if (res == 0) {
-                       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s (%p, %u): non-child process WAIT_TIMEOUT", __func__, handle, timeout);
-                       return WAIT_TIMEOUT;
-               }
-               if (res > 0) {
-                       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s (%p, %u): non-child process waited successfully", __func__, handle, timeout);
-                       return WAIT_OBJECT_0;
-               }
-
-               MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s (%p, %u): non-child process WAIT_FAILED, error : %s (%d))", __func__, handle, timeout, g_strerror (errno), errno);
-               return WAIT_FAILED;
-       }
-
-       start = mono_msec_ticks ();
-       now = start;
-
-       while (1) {
-               if (timeout != INFINITE) {
-                       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s (%p, %u): waiting on semaphore for %li ms...", 
-                                  __func__, handle, timeout, (timeout - (now - start)));
-                       ret = mono_os_sem_timedwait (&mp->exit_sem, (timeout - (now - start)), alerted ? MONO_SEM_FLAGS_ALERTABLE : MONO_SEM_FLAGS_NONE);
-               } else {
-                       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s (%p, %u): waiting on semaphore forever...", 
-                                  __func__, handle, timeout);
-                       ret = mono_os_sem_wait (&mp->exit_sem, alerted ? MONO_SEM_FLAGS_ALERTABLE : MONO_SEM_FLAGS_NONE);
-               }
-
-               if (ret == MONO_SEM_TIMEDWAIT_RET_SUCCESS) {
-                       /* Success, process has exited */
-                       mono_os_sem_post (&mp->exit_sem);
-                       break;
-               }
-
-               if (ret == MONO_SEM_TIMEDWAIT_RET_TIMEDOUT) {
-                       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s (%p, %u): WAIT_TIMEOUT (timeout = 0)", __func__, handle, timeout);
-                       return WAIT_TIMEOUT;
-               }
-
-               now = mono_msec_ticks ();
-               if (now - start >= timeout) {
-                       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s (%p, %u): WAIT_TIMEOUT", __func__, handle, timeout);
-                       return WAIT_TIMEOUT;
-               }
-               
-               if (alerted && ret == MONO_SEM_TIMEDWAIT_RET_ALERTED) {
-                       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s (%p, %u): WAIT_IO_COMPLETION", __func__, handle, timeout);
-                       *alerted = TRUE;
-                       return WAIT_IO_COMPLETION;
-               }
-       }
-
-       /* Process must have exited */
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s (%p, %u): Waited successfully", __func__, handle, timeout);
-
-       status = mp ? mp->status : 0;
-       if (WIFSIGNALED (status))
-               process_handle->exitstatus = 128 + WTERMSIG (status);
-       else
-               process_handle->exitstatus = WEXITSTATUS (status);
-       _wapi_time_t_to_filetime (time (NULL), &process_handle->exit_time);
-
-       process_handle->exited = TRUE;
-
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s (%p, %u): Setting pid %d signalled, exit status %d",
-                  __func__, handle, timeout, process_handle->id, process_handle->exitstatus);
-
-       mono_w32handle_set_signal_state (handle, TRUE, TRUE);
-
-       return WAIT_OBJECT_0;
-}
-
-void
-wapi_processes_cleanup (void)
-{
-       g_free (cli_launcher);
-}
diff --git a/mono/io-layer/processes.h b/mono/io-layer/processes.h
deleted file mode 100644 (file)
index 3193bc5..0000000
+++ /dev/null
@@ -1,225 +0,0 @@
-/*
- * processes.h:  Process handles
- *
- * Author:
- *     Dick Porter (dick@ximian.com)
- *
- * (C) 2002 Ximian, Inc.
- */
-
-#ifndef _WAPI_PROCESSES_H_
-#define _WAPI_PROCESSES_H_
-
-#include <sys/types.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#include <glib.h>
-
-#include <mono/io-layer/access.h>
-#include <mono/io-layer/versioninfo.h>
-
-G_BEGIN_DECLS
-
-typedef enum {
-       STARTF_USESHOWWINDOW=0x001,
-       STARTF_USESIZE=0x002,
-       STARTF_USEPOSITION=0x004,
-       STARTF_USECOUNTCHARS=0x008,
-       STARTF_USEFILLATTRIBUTE=0x010,
-       STARTF_RUNFULLSCREEN=0x020,
-       STARTF_FORCEONFEEDBACK=0x040,
-       STARTF_FORCEOFFFEEDBACK=0x080,
-       STARTF_USESTDHANDLES=0x100
-} WapiStartupFlags;
-
-
-typedef struct _WapiStartupInfo WapiStartupInfo;
-
-struct _WapiStartupInfo 
-{
-       guint32 cb;
-       guchar *lpReserved;
-       guchar *lpDesktop;
-       guchar *lpTitle;
-       guint32 dwX;
-       guint32 dwY;
-       guint32 dwXSize;
-       guint32 dwYSize;
-       guint32 dwXCountChars;
-       guint32 dwYCountChars;
-       guint32 dwFillAttribute;
-       WapiStartupFlags dwFlags;
-       guint16 wShowWindow;
-       guint16 cbReserved2;
-       guint8 *lpReserved2;
-       gpointer hStdInput;
-       gpointer hStdOutput;
-       gpointer hStdError;
-};
-
-typedef struct _WapiProcessInformation WapiProcessInformation;
-
-struct _WapiProcessInformation 
-{
-       gpointer hProcess;
-       gpointer hThread;
-       guint32 dwProcessId;
-       guint32 dwThreadId;
-};
-
-typedef enum {
-       SEE_MASK_CLASSNAME      = 0x01,
-       SEE_MASK_CLASSKEY       = 0x03,
-       SEE_MASK_IDLIST         = 0x04,
-       SEE_MASK_INVOKEIDLIST   = 0x0c,
-       SEE_MASK_ICON           = 0x10,
-       SEE_MASK_HOTKEY         = 0x20,
-       SEE_MASK_NOCLOSEPROCESS = 0x40,
-       SEE_MASK_CONNECTNETDRV  = 0x80,
-       SEE_MASK_FLAG_DDEWAIT   = 0x100,
-       SEE_MASK_DOENVSUBST     = 0x200,
-       SEE_MASK_FLAG_NO_UI     = 0x400,
-       SEE_MASK_NO_CONSOLE     = 0x8000,
-       SEE_MASK_UNICODE        = 0x10000,
-       SEE_MASK_HMONITOR       = 0x200000,
-       /*SEE_MASK_FLAG_LOG_USAGE,*/
-       /*SEE_MASK_NOZONECHECKS,*/
-} WapiShellExecuteInfoFlags;
-
-typedef enum {
-       SW_HIDE = 0,
-       SW_SHOWNORMAL = 1,
-       SW_SHOWMINIMIZED = 2,
-       SW_MAXIMIZE = 3,
-       SW_SHOWMAXIMIZED = 3,
-       SW_SHOWNOACTIVATE = 4,
-       SW_SHOW = 5,
-       SW_MINIMIZE = 6,
-       SW_SHOWMINNOACTIVE = 7,
-       SW_SHOWNA = 8,
-       SW_RESTORE = 9,
-       SW_SHOWDEFAULT = 10,
-} WapiShellExecuteShowFlags;
-
-typedef struct _WapiShellExecuteInfo WapiShellExecuteInfo;
-
-struct _WapiShellExecuteInfo
-{
-       guint32 cbSize;
-       gulong fMask;
-       gpointer hwnd;
-       const gunichar2 *lpVerb;
-       const gunichar2 *lpFile;
-       const gunichar2 *lpParameters;
-       const gunichar2 *lpDirectory;
-       gulong nShow;
-       gpointer hInstApp;
-       gpointer lpIDList;
-       const gunichar2 *lpClass;
-       gpointer hkeyClass;
-       guint32 dwHotKey;
-       union 
-       {
-               gpointer hIcon;
-               gpointer hMonitor;
-       } u;
-       gpointer hProcess;
-};
-
-       
-#define DEBUG_PROCESS 0x00000001
-#define DEBUG_ONLY_THIS_PROCESS 0x00000002
-#define CREATE_SUSPENDED 0x00000004
-#define DETACHED_PROCESS 0x00000008
-#define CREATE_NEW_CONSOLE 0x00000010
-#define NORMAL_PRIORITY_CLASS 0x00000020
-#define IDLE_PRIORITY_CLASS 0x00000040
-#define HIGH_PRIORITY_CLASS 0x00000080
-#define REALTIME_PRIORITY_CLASS 0x00000100
-#define CREATE_NEW_PROCESS_GROUP 0x00000200
-#define CREATE_UNICODE_ENVIRONMENT 0x00000400
-#define CREATE_SEPARATE_WOW_VDM 0x00000800
-#define CREATE_SHARED_WOW_VDM 0x00001000
-#define CREATE_FORCEDOS 0x00002000
-#define BELOW_NORMAL_PRIORITY_CLASS 0x00004000
-#define ABOVE_NORMAL_PRIORITY_CLASS 0x00008000
-#define CREATE_BREAKAWAY_FROM_JOB 0x01000000
-#define CREATE_WITH_USERPROFILE 0x02000000
-#define CREATE_DEFAULT_ERROR_MODE 0x04000000
-#define CREATE_NO_WINDOW 0x08000000
-
-#ifdef NEW_STUFF
-#define CREATE_PRESERVE_CODE_AUTHZ_LEVEL find out the value for this one...
-#endif
-
-#define        PROCESS_TERMINATE               0x0001
-#define        PROCESS_CREATE_THREAD           0x0002
-#define        PROCESS_SET_SESSIONID           0x0004
-#define        PROCESS_VM_OPERATION            0x0008
-#define        PROCESS_VM_READ                 0x0010
-#define        PROCESS_VM_WRITE                0x0020
-#define        PROCESS_DUP_HANDLE              0x0040
-#define        PROCESS_CREATE_PROCESS          0x0080
-#define        PROCESS_SET_QUOTA               0x0100
-#define        PROCESS_SET_INFORMATION         0x0200
-#define        PROCESS_QUERY_INFORMATION       0x0400
-#define        PROCESS_ALL_ACCESS              (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0xfff)
-
-extern gboolean ShellExecuteEx (WapiShellExecuteInfo *sei);
-extern gboolean CreateProcess (const gunichar2 *appname,
-                              const gunichar2 *cmdline,
-                              WapiSecurityAttributes *process_attrs,
-                              WapiSecurityAttributes *thread_attrs,
-                              gboolean inherit_handles, guint32 create_flags,
-                              gpointer environ, const gunichar2 *cwd,
-                              WapiStartupInfo *startup,
-                              WapiProcessInformation *process_info);
-extern gboolean CreateProcessWithLogonW (const gunichar2 *username,
-                                        const gunichar2 *domain,
-                                        const gunichar2 *password,
-                                        const guint32 logonFlags,
-                                        const gunichar2 *appname,
-                                        const gunichar2 *cmdline,
-                                        guint32 create_flags,
-                                        gpointer environ,
-                                        const gunichar2 *cwd,
-                                        WapiStartupInfo *startup,
-                                        WapiProcessInformation *process_info);
-#define LOGON_WITH_PROFILE 0x00000001
-#define LOGON_NETCREDENTIALS_ONLY 0x00000002
-
-extern gpointer GetCurrentProcess (void);
-extern guint32 GetProcessId (gpointer handle);
-extern gboolean CloseProcess (gpointer handle);
-extern gpointer OpenProcess (guint32 access, gboolean inherit, guint32 pid);
-extern gboolean GetExitCodeProcess (gpointer process, guint32 *code);
-extern gboolean GetProcessTimes (gpointer process, WapiFileTime *create_time,
-                                WapiFileTime *exit_time,
-                                WapiFileTime *kernel_time,
-                                WapiFileTime *user_time);
-extern gboolean EnumProcessModules (gpointer process, gpointer *modules,
-                                   guint32 size, guint32 *needed);
-extern guint32 GetModuleBaseName (gpointer process, gpointer module,
-                                 gunichar2 *basename, guint32 size);
-extern guint32 GetModuleFileNameEx (gpointer process, gpointer module,
-                                   gunichar2 *filename, guint32 size);
-extern gboolean GetModuleInformation (gpointer process, gpointer module,
-                                     WapiModuleInfo *modinfo, guint32 size);
-extern gboolean GetProcessWorkingSetSize (gpointer process, size_t *min,
-                                         size_t *max);
-extern gboolean SetProcessWorkingSetSize (gpointer process, size_t min,
-                                         size_t max);
-
-extern gboolean TerminateProcess (gpointer process, gint32 exitCode);
-
-extern guint32 GetPriorityClass (gpointer process);
-extern gboolean SetPriorityClass (gpointer process, guint32  priority_class);
-
-gchar* wapi_process_get_path (pid_t pid);
-
-void wapi_process_set_cli_launcher (char *path);
-
-G_END_DECLS
-
-#endif /* _WAPI_PROCESSES_H_ */
diff --git a/mono/io-layer/semaphore-private.h b/mono/io-layer/semaphore-private.h
deleted file mode 100644 (file)
index 3c27eef..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * semaphore-private.h:  Private definitions for semaphore handles
- *
- * Author:
- *     Dick Porter (dick@ximian.com)
- *
- * (C) 2002 Ximian, Inc.
- */
-
-#ifndef _WAPI_SEMAPHORE_PRIVATE_H_
-#define _WAPI_SEMAPHORE_PRIVATE_H_
-
-#include <config.h>
-#include <glib.h>
-
-#include "wapi-private.h"
-
-/* emulate sem_t, so that we can prod the internal state more easily */
-struct _WapiHandle_sem
-{
-       guint32 val;
-       gint32 max;
-};
-
-struct _WapiHandle_namedsem
-{
-       struct _WapiHandle_sem s;
-       WapiSharedNamespace sharedns;
-};
-
-void
-_wapi_semaphore_init (void);
-
-#endif /* _WAPI_SEMAPHORE_PRIVATE_H_ */
diff --git a/mono/io-layer/semaphores.c b/mono/io-layer/semaphores.c
deleted file mode 100644 (file)
index c473f4d..0000000
+++ /dev/null
@@ -1,399 +0,0 @@
-/*
- * semaphores.c:  Semaphore handles
- *
- * Author:
- *     Dick Porter (dick@ximian.com)
- *
- * (C) 2002 Ximian, Inc.
- */
-
-#include <config.h>
-#include <glib.h>
-#include <pthread.h>
-#ifdef HAVE_SEMAPHORE_H
-#include <semaphore.h>
-#endif
-#include <errno.h>
-#include <string.h>
-#include <sys/time.h>
-
-#include <mono/io-layer/wapi.h>
-#include <mono/io-layer/wapi-private.h>
-#include <mono/io-layer/semaphore-private.h>
-#include <mono/io-layer/io-trace.h>
-#include <mono/utils/mono-once.h>
-#include <mono/utils/mono-logger-internals.h>
-#include <mono/utils/w32handle.h>
-
-static void sema_signal(gpointer handle);
-static gboolean sema_own (gpointer handle);
-static void sema_details (gpointer data);
-static const gchar* sema_typename (void);
-static gsize sema_typesize (void);
-
-static void namedsema_signal (gpointer handle);
-static gboolean namedsema_own (gpointer handle);
-static void namedsema_details (gpointer data);
-static const gchar* namedsema_typename (void);
-static gsize namedsema_typesize (void);
-
-static MonoW32HandleOps _wapi_sem_ops = {
-       NULL,                   /* close */
-       sema_signal,            /* signal */
-       sema_own,               /* own */
-       NULL,                   /* is_owned */
-       NULL,                   /* special_wait */
-       NULL,                   /* prewait */
-       sema_details,   /* details */
-       sema_typename,  /* typename */
-       sema_typesize,  /* typesize */
-};
-
-static MonoW32HandleOps _wapi_namedsem_ops = {
-       NULL,                   /* close */
-       namedsema_signal,       /* signal */
-       namedsema_own,          /* own */
-       NULL,                   /* is_owned */
-       NULL,                   /* special_wait */
-       NULL,                   /* prewait */
-       namedsema_details,      /* details */
-       namedsema_typename,     /* typename */
-       namedsema_typesize,     /* typesize */
-};
-
-void
-_wapi_semaphore_init (void)
-{
-       mono_w32handle_register_ops (MONO_W32HANDLE_SEM,      &_wapi_sem_ops);
-       mono_w32handle_register_ops (MONO_W32HANDLE_NAMEDSEM, &_wapi_namedsem_ops);
-
-       mono_w32handle_register_capabilities (MONO_W32HANDLE_SEM,
-               (MonoW32HandleCapability)(MONO_W32HANDLE_CAP_WAIT | MONO_W32HANDLE_CAP_SIGNAL));
-       mono_w32handle_register_capabilities (MONO_W32HANDLE_NAMEDSEM,
-               (MonoW32HandleCapability)(MONO_W32HANDLE_CAP_WAIT | MONO_W32HANDLE_CAP_SIGNAL));
-}
-
-static const char* sem_handle_type_to_string (MonoW32HandleType type)
-{
-       switch (type) {
-       case MONO_W32HANDLE_SEM: return "sem";
-       case MONO_W32HANDLE_NAMEDSEM: return "named sem";
-       default:
-               g_assert_not_reached ();
-       }
-}
-
-static gboolean sem_handle_own (gpointer handle, MonoW32HandleType type)
-{
-       struct _WapiHandle_sem *sem_handle;
-
-       if (!mono_w32handle_lookup (handle, type, (gpointer *)&sem_handle)) {
-               g_warning ("%s: error looking up %s handle %p",
-                       __func__, sem_handle_type_to_string (type), handle);
-               return FALSE;
-       }
-
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: owning %s handle %p",
-               __func__, sem_handle_type_to_string (type), handle);
-
-       sem_handle->val--;
-
-       if (sem_handle->val == 0)
-               mono_w32handle_set_signal_state (handle, FALSE, FALSE);
-
-       return TRUE;
-}
-
-static void sema_signal(gpointer handle)
-{
-       ReleaseSemaphore(handle, 1, NULL);
-}
-
-static gboolean sema_own (gpointer handle)
-{
-       return sem_handle_own (handle, MONO_W32HANDLE_SEM);
-}
-
-static void namedsema_signal (gpointer handle)
-{
-       ReleaseSemaphore (handle, 1, NULL);
-}
-
-/* NB, always called with the shared handle lock held */
-static gboolean namedsema_own (gpointer handle)
-{
-       return sem_handle_own (handle, MONO_W32HANDLE_NAMEDSEM);
-}
-
-static void sema_details (gpointer data)
-{
-       struct _WapiHandle_sem *sem = (struct _WapiHandle_sem *)data;
-       g_print ("val: %5u, max: %5d", sem->val, sem->max);
-}
-
-static void namedsema_details (gpointer data)
-{
-       struct _WapiHandle_namedsem *namedsem = (struct _WapiHandle_namedsem *)data;
-       g_print ("val: %5u, max: %5d, name: \"%s\"", namedsem->s.val, namedsem->s.max, namedsem->sharedns.name);
-}
-
-static const gchar* sema_typename (void)
-{
-       return "Semaphore";
-}
-
-static gsize sema_typesize (void)
-{
-       return sizeof (struct _WapiHandle_sem);
-}
-
-static const gchar* namedsema_typename (void)
-{
-       return "N.Semaphore";
-}
-
-static gsize namedsema_typesize (void)
-{
-       return sizeof (struct _WapiHandle_namedsem);
-}
-
-static gpointer sem_handle_create (struct _WapiHandle_sem *sem_handle, MonoW32HandleType type, gint32 initial, gint32 max)
-{
-       gpointer handle;
-       int thr_ret;
-
-       sem_handle->val = initial;
-       sem_handle->max = max;
-
-       handle = mono_w32handle_new (type, sem_handle);
-       if (handle == INVALID_HANDLE_VALUE) {
-               g_warning ("%s: error creating %s handle",
-                       __func__, sem_handle_type_to_string (type));
-               SetLastError (ERROR_GEN_FAILURE);
-               return NULL;
-       }
-
-       thr_ret = mono_w32handle_lock_handle (handle);
-       g_assert (thr_ret == 0);
-
-       if (initial != 0)
-               mono_w32handle_set_signal_state (handle, TRUE, FALSE);
-
-       thr_ret = mono_w32handle_unlock_handle (handle);
-       g_assert (thr_ret == 0);
-
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: created %s handle %p",
-               __func__, sem_handle_type_to_string (type), handle);
-
-       return handle;
-}
-
-static gpointer sem_create (gint32 initial, gint32 max)
-{
-       struct _WapiHandle_sem sem_handle;
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: creating %s handle, initial %d max %d",
-               __func__, sem_handle_type_to_string (MONO_W32HANDLE_SEM), initial, max);
-       return sem_handle_create (&sem_handle, MONO_W32HANDLE_SEM, initial, max);
-}
-
-static gpointer namedsem_create (gint32 initial, gint32 max, const gunichar2 *name)
-{
-       gpointer handle;
-       gchar *utf8_name;
-       int thr_ret;
-
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: creating %s handle, initial %d max %d name \"%s\"",
-               __func__, sem_handle_type_to_string (MONO_W32HANDLE_NAMEDSEM), initial, max, name);
-
-       /* w32 seems to guarantee that opening named objects can't race each other */
-       thr_ret = _wapi_namespace_lock ();
-       g_assert (thr_ret == 0);
-
-       utf8_name = g_utf16_to_utf8 (name, -1, NULL, NULL, NULL);
-
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Creating named sem name [%s] initial %d max %d", __func__, utf8_name, initial, max);
-
-       handle = _wapi_search_handle_namespace (MONO_W32HANDLE_NAMEDSEM, utf8_name);
-       if (handle == INVALID_HANDLE_VALUE) {
-               /* The name has already been used for a different object. */
-               handle = NULL;
-               SetLastError (ERROR_INVALID_HANDLE);
-       } else if (handle) {
-               /* Not an error, but this is how the caller is informed that the semaphore wasn't freshly created */
-               SetLastError (ERROR_ALREADY_EXISTS);
-
-               /* this is used as creating a new handle */
-               mono_w32handle_ref (handle);
-       } else {
-               /* A new named semaphore */
-               struct _WapiHandle_namedsem namedsem_handle;
-
-               strncpy (&namedsem_handle.sharedns.name [0], utf8_name, MAX_PATH);
-               namedsem_handle.sharedns.name [MAX_PATH] = '\0';
-
-               handle = sem_handle_create ((struct _WapiHandle_sem*) &namedsem_handle, MONO_W32HANDLE_NAMEDSEM, initial, max);
-       }
-
-       g_free (utf8_name);
-
-       thr_ret = _wapi_namespace_unlock (NULL);
-       g_assert (thr_ret == 0);
-
-       return handle;
-}
-
-
-/**
- * CreateSemaphore:
- * @security: Ignored for now.
- * @initial: The initial count for the semaphore.  The value must be
- * greater than or equal to zero, and less than or equal to @max.
- * @max: The maximum count for this semaphore.  The value must be
- * greater than zero.
- * @name: Pointer to a string specifying the name of this semaphore,
- * or %NULL.  Currently ignored.
- *
- * Creates a new semaphore handle.  A semaphore is signalled when its
- * count is greater than zero, and unsignalled otherwise.  The count
- * is decreased by one whenever a wait function releases a thread that
- * was waiting for the semaphore.  The count is increased by calling
- * ReleaseSemaphore().
- *
- * Return value: a new handle, or NULL
- */
-gpointer CreateSemaphore(WapiSecurityAttributes *security G_GNUC_UNUSED, gint32 initial, gint32 max, const gunichar2 *name)
-{
-       if (max <= 0) {
-               MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: max <= 0", __func__);
-
-               SetLastError (ERROR_INVALID_PARAMETER);
-               return(NULL);
-       }
-       
-       if (initial > max || initial < 0) {
-               MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: initial>max or < 0", __func__);
-
-               SetLastError (ERROR_INVALID_PARAMETER);
-               return(NULL);
-       }
-
-       /* Need to blow away any old errors here, because code tests
-        * for ERROR_ALREADY_EXISTS on success (!) to see if a
-        * semaphore was freshly created
-        */
-       SetLastError (ERROR_SUCCESS);
-
-       return name ? namedsem_create (initial, max, name) : sem_create (initial, max);
-}
-
-/**
- * ReleaseSemaphore:
- * @handle: The semaphore handle to release.
- * @count: The amount by which the semaphore's count should be
- * increased.
- * @prevcount: Pointer to a location to store the previous count of
- * the semaphore, or %NULL.
- *
- * Increases the count of semaphore @handle by @count.
- *
- * Return value: %TRUE on success, %FALSE otherwise.
- */
-gboolean ReleaseSemaphore(gpointer handle, gint32 count, gint32 *prevcount)
-{
-       MonoW32HandleType type;
-       struct _WapiHandle_sem *sem_handle;
-       int thr_ret;
-       gboolean ret;
-
-       if (!handle) {
-               SetLastError (ERROR_INVALID_HANDLE);
-               return FALSE;
-       }
-
-       switch (type = mono_w32handle_get_type (handle)) {
-       case MONO_W32HANDLE_SEM:
-       case MONO_W32HANDLE_NAMEDSEM:
-               break;
-       default:
-               SetLastError (ERROR_INVALID_HANDLE);
-               return FALSE;
-       }
-
-       if (!mono_w32handle_lookup (handle, type, (gpointer *)&sem_handle)) {
-               g_warning ("%s: error looking up sem handle %p", __func__, handle);
-               return FALSE;
-       }
-
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: releasing %s handle %p",
-               __func__, sem_handle_type_to_string (type), handle);
-
-       thr_ret = mono_w32handle_lock_handle (handle);
-       g_assert (thr_ret == 0);
-
-       /* Do this before checking for count overflow, because overflowing
-        * max is a listed technique for finding the current value */
-       if (prevcount)
-               *prevcount = sem_handle->val;
-
-       /* No idea why max is signed, but thats the spec :-( */
-       if (sem_handle->val + count > (guint32)sem_handle->max) {
-               MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: %s handle %p val %d count %d max %d, max value would be exceeded",
-                       __func__, sem_handle_type_to_string (type), handle, sem_handle->val, count, sem_handle->max, count);
-
-               ret = FALSE;
-       } else {
-               MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: %s handle %p val %d count %d max %d",
-                       __func__, sem_handle_type_to_string (type), handle, sem_handle->val, count, sem_handle->max, count);
-
-               sem_handle->val += count;
-               mono_w32handle_set_signal_state (handle, TRUE, TRUE);
-
-               ret = TRUE;
-       }
-
-       thr_ret = mono_w32handle_unlock_handle (handle);
-       g_assert (thr_ret == 0);
-
-       return ret;
-}
-
-gpointer OpenSemaphore (guint32 access G_GNUC_UNUSED, gboolean inherit G_GNUC_UNUSED,
-                       const gunichar2 *name)
-{
-       gpointer handle;
-       gchar *utf8_name;
-       int thr_ret;
-
-       /* w32 seems to guarantee that opening named objects can't
-        * race each other
-        */
-       thr_ret = _wapi_namespace_lock ();
-       g_assert (thr_ret == 0);
-       
-       utf8_name = g_utf16_to_utf8 (name, -1, NULL, NULL, NULL);
-       
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Opening named sem [%s]", __func__, utf8_name);
-
-       handle = _wapi_search_handle_namespace (MONO_W32HANDLE_NAMEDSEM,
-                                               utf8_name);
-       if (handle == INVALID_HANDLE_VALUE) {
-               /* The name has already been used for a different
-                * object.
-                */
-               SetLastError (ERROR_INVALID_HANDLE);
-               goto cleanup;
-       } else if (!handle) {
-               /* This name doesn't exist */
-               SetLastError (ERROR_FILE_NOT_FOUND);    /* yes, really */
-               goto cleanup;
-       }
-
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: returning named sem handle %p", __func__, handle);
-
-cleanup:
-       g_free (utf8_name);
-       
-       _wapi_namespace_unlock (NULL);
-       
-       return handle;
-}
diff --git a/mono/io-layer/semaphores.h b/mono/io-layer/semaphores.h
deleted file mode 100644 (file)
index 1cdaee0..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * semaphores.h:  Semaphore handles
- *
- * Author:
- *     Dick Porter (dick@ximian.com)
- *
- * (C) 2002 Ximian, Inc.
- */
-
-#ifndef _WAPI_SEMAPHORES_H_
-#define _WAPI_SEMAPHORES_H_
-
-#include <glib.h>
-
-G_BEGIN_DECLS
-
-extern gpointer CreateSemaphore(WapiSecurityAttributes *security,
-                               gint32 initial, gint32 max,
-                               const gunichar2 *name);
-extern gboolean ReleaseSemaphore(gpointer handle, gint32 count,
-                                gint32 *prevcount);
-extern gpointer OpenSemaphore (guint32 access, gboolean inherit,
-                              const gunichar2 *name);
-
-G_END_DECLS
-#endif /* _WAPI_SEMAPHORES_H_ */
diff --git a/mono/io-layer/shared.c b/mono/io-layer/shared.c
deleted file mode 100644 (file)
index 8fb0e27..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * shared.c:  Shared memory handling, and daemon launching
- *
- * Author:
- *     Dick Porter (dick@ximian.com)
- *
- * (C) 2002-2006 Novell, Inc.
- */
-
-#include <config.h>
-#include <glib.h>
-
-#include <mono/io-layer/wapi-private.h>
-#include <mono/io-layer/shared.h>
-#include <mono/utils/mono-os-mutex.h>
-
-#define DEBUGLOG(...)
-//#define DEBUGLOG(...) g_message(__VA_ARGS__);
-
-static mono_mutex_t noshm_sems[_WAPI_SHARED_SEM_COUNT];
-
-void
-_wapi_shm_semaphores_init (void)
-{
-       int i;
-       for (i = 0; i < _WAPI_SHARED_SEM_COUNT; i++) 
-               mono_os_mutex_init (&noshm_sems [i]);
-}
-
-int
-_wapi_shm_sem_lock (int sem)
-{
-       DEBUGLOG ("%s: locking nosem %d", __func__, sem);
-       mono_os_mutex_lock (&noshm_sems[sem]);
-       return 0;
-}
-
-int
-_wapi_shm_sem_trylock (int sem)
-{
-       DEBUGLOG ("%s: trying to lock nosem %d", __func__, sem);
-       return mono_os_mutex_trylock (&noshm_sems[sem]);
-}
-
-int
-_wapi_shm_sem_unlock (int sem)
-{
-       DEBUGLOG ("%s: unlocking nosem %d", __func__, sem);
-       mono_os_mutex_unlock (&noshm_sems[sem]);
-       return 0;
-}
diff --git a/mono/io-layer/shared.h b/mono/io-layer/shared.h
deleted file mode 100644 (file)
index 204f506..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * shared.h:  Shared memory handle, and daemon launching
- *
- * Author:
- *     Dick Porter (dick@ximian.com)
- *
- * (C) 2002-2006 Novell, Inc.
- */
-
-#ifndef _WAPI_SHARED_H_
-#define _WAPI_SHARED_H_
-
-extern void _wapi_shm_semaphores_init (void);
-extern int _wapi_shm_sem_lock (int sem);
-extern int _wapi_shm_sem_trylock (int sem);
-extern int _wapi_shm_sem_unlock (int sem);
-
-#endif /* _WAPI_SHARED_H_ */
index 05012d26fbbb505967a484272cb4ed1c99f6bad7..d98ac677a2e22047432a89a717ad9b1a849f37ed 100644 (file)
@@ -44,7 +44,7 @@
 #include <mono/utils/mono-poll.h>
 #include <mono/utils/mono-once.h>
 #include <mono/utils/mono-logger-internals.h>
-#include <mono/utils/w32handle.h>
+#include <mono/metadata/w32handle.h>
 
 #include <netinet/in.h>
 #include <netinet/tcp.h>
@@ -130,7 +130,7 @@ static gboolean
 cleanup_close (gpointer handle, gpointer data, gpointer user_data)
 {
        if (mono_w32handle_get_type (handle) == MONO_W32HANDLE_SOCKET)
-               mono_w32handle_ops_close (handle, data);
+               mono_w32handle_force_close (handle, data);
 
        return FALSE;
 }
diff --git a/mono/io-layer/timefuncs-private.h b/mono/io-layer/timefuncs-private.h
deleted file mode 100644 (file)
index ff00879..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * timefuncs-private.h:  performance timer and other time private functions
- *
- * Author:
- *     Dick Porter (dick@ximian.com)
- *
- * (C) 2002 Ximian, Inc.
- */
-
-#ifndef _WAPI_TIMEFUNCS_PRIVATE_H_
-#define _WAPI_TIMEFUNCS_PRIVATE_H_
-
-#include <config.h>
-#include <glib.h>
-#include <sys/time.h>
-
-extern void _wapi_time_t_to_filetime (time_t timeval, WapiFileTime *filetime);
-extern void _wapi_guint64_to_filetime (guint64 ticks, WapiFileTime *filetime);
-
-#endif /* _WAPI_TIMEFUNCS_PRIVATE_H_ */
index 0528ae6946df59b7bd1f55f2e07b5062d2f3d8aa..7ec8e4a8ee72a8ae43922dd6cb794c5c2d2e41cf 100644 (file)
@@ -14,7 +14,7 @@
 #include <stdio.h>
 
 #include <mono/io-layer/wapi.h>
-#include <mono/io-layer/timefuncs-private.h>
+#include <mono/io-layer/timefuncs.h>
 #include "mono/utils/mono-time.h"
 
 #undef DEBUG
@@ -27,9 +27,3 @@ void _wapi_time_t_to_filetime (time_t timeval, WapiFileTime *filetime)
        filetime->dwLowDateTime = ticks & 0xFFFFFFFF;
        filetime->dwHighDateTime = ticks >> 32;
 }
-
-void _wapi_guint64_to_filetime (guint64 ticks, WapiFileTime *filetime)
-{
-       filetime->dwLowDateTime = ticks & 0xFFFFFFFF;
-       filetime->dwHighDateTime = ticks >> 32;
-}
index d24800229f22aef11724cd81700cf58fe1ed352b..2b43396931b0db51e8401ad0372c249efaf72e45 100644 (file)
@@ -12,6 +12,8 @@
 
 #include <glib.h>
 
+#include <sys/time.h>
+
 #include "mono/io-layer/wapi.h"
 
 G_BEGIN_DECLS
@@ -30,5 +32,7 @@ typedef struct
 #endif
 } WapiFileTime;
 
+extern void _wapi_time_t_to_filetime (time_t timeval, WapiFileTime *filetime);
+
 G_END_DECLS
 #endif /* _WAPI_TIME_H_ */
index 5176da07ea7f2aa98f284fbf665d6f7d1cd2d629..ff5a53c21bdeda2c285f75e1796d9b4ffdb4fab2 100644 (file)
@@ -62,17 +62,10 @@ typedef WapiLargeInteger LARGE_INTEGER;
 typedef WapiLargeInteger *PLARGE_INTEGER;
 typedef WapiULargeInteger ULARGE_INTEGER;
 typedef WapiULargeInteger *PULARGE_INTEGER;
-typedef WapiFloatingSaveArea FLOATING_SAVE_AREA;
-typedef WapiFloatingSaveArea *PFLOATING_SAVE_AREA;
-typedef WapiContext CONTEXT;
-typedef WapiContext *PCONTEXT;
 typedef WapiFindData WIN32_FIND_DATA;
 typedef WapiFindData *LPWIN32_FIND_DATA;
 typedef WapiFileAttributesData WIN32_FILE_ATTRIBUTE_DATA;
 typedef WapiGetFileExInfoLevels GET_FILEEX_INFO_LEVELS;
-typedef WapiStartupInfo STARTUPINFO;
-typedef WapiStartupInfo *LPSTARTUPINFO;
-typedef WapiProcessInformation PROCESS_INFORMATION;
 typedef WapiFixedFileInfo VS_FIXEDFILEINFO;
 typedef WapiModuleInfo MODULEINFO;
 typedef WapiModuleInfo *LPMODULEINFO;
@@ -102,8 +95,6 @@ typedef WapiImageResourceDirectoryEntry IMAGE_RESOURCE_DIRECTORY_ENTRY;
 typedef WapiImageResourceDirectoryEntry *PIMAGE_RESOURCE_DIRECTORY_ENTRY;
 typedef WapiImageResourceDataEntry IMAGE_RESOURCE_DATA_ENTRY;
 typedef WapiImageResourceDataEntry *PIMAGE_RESOURCE_DATA_ENTRY;
-typedef WapiShellExecuteInfo SHELLEXECUTEINFO;
-typedef WapiShellExecuteInfo *LPSHELLEXECUTEINFO;
 typedef WapiTransmitFileBuffers TRANSMIT_FILE_BUFFERS;
 typedef WapiTransmitFileBuffers *PTRANSMIT_FILE_BUFFERS;
 typedef WapiTransmitFileBuffers *LPTRANSMIT_FILE_BUFFERS;
index ddf8e11464ee31340eef33d1c840a7b97c6bb482..b7ff4684263846776bd3ff0f2ac346ed23cfcf8d 100644 (file)
 
 #include <mono/io-layer/wapi.h>
 #include <mono/io-layer/wapi-private.h>
-#include <mono/io-layer/io-trace.h>
-#include <mono/utils/mono-logger-internals.h>
-#include <mono/utils/mono-time.h>
-#include <mono/utils/w32handle.h>
-#include <mono/utils/mono-threads.h>
-
-static gboolean own_if_signalled(gpointer handle)
-{
-       gboolean ret = FALSE;
-
-       if (mono_w32handle_issignalled (handle)) {
-               mono_w32handle_ops_own (handle);
-               ret = TRUE;
-       }
-
-       return(ret);
-}
-
-static gboolean own_if_owned(gpointer handle)
-{
-       gboolean ret = FALSE;
-
-       if (mono_w32handle_ops_isowned (handle)) {
-               mono_w32handle_ops_own (handle);
-               ret = TRUE;
-       }
-
-       return(ret);
-}
+#include <mono/metadata/w32handle.h>
 
 /**
  * WaitForSingleObjectEx:
@@ -63,135 +35,23 @@ static gboolean own_if_owned(gpointer handle)
  * @handle's state is still not signalled.  %WAIT_FAILED - an error
  * occurred. %WAIT_IO_COMPLETION - the wait was ended by an APC.
  */
-guint32 WaitForSingleObjectEx(gpointer handle, guint32 timeout,
-                             gboolean alertable)
-{
-       guint32 ret, waited;
-       int thr_ret;
-       gboolean apc_pending = FALSE;
-       gint64 wait_start, timeout_in_ticks;
-
-       if ((GPOINTER_TO_UINT (handle) & _WAPI_PROCESS_UNHANDLED) == _WAPI_PROCESS_UNHANDLED) {
-               SetLastError (ERROR_INVALID_HANDLE);
-               return(WAIT_FAILED);
-       }
-       
-       if (mono_w32handle_test_capabilities (handle,
-                                           MONO_W32HANDLE_CAP_WAIT) == FALSE) {
-               MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: handle %p can't be waited for", __func__,
-                          handle);
-
-               return(WAIT_FAILED);
-       }
-
-       mono_w32handle_ops_prewait (handle);
-       
-       if (mono_w32handle_test_capabilities (handle, MONO_W32HANDLE_CAP_SPECIAL_WAIT) == TRUE) {
-               MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: handle %p has special wait", __func__, handle);
-
-               ret = mono_w32handle_ops_specialwait (handle, timeout, alertable ? &apc_pending : NULL);
-       
-               if (apc_pending)
-                       ret = WAIT_IO_COMPLETION;
-
-               return ret;
-       }
-       
-       
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: locking handle %p", __func__, handle);
-
-       thr_ret = mono_w32handle_lock_handle (handle);
-       g_assert (thr_ret == 0);
-
-       if (mono_w32handle_test_capabilities (handle,
-                                           MONO_W32HANDLE_CAP_OWN) == TRUE) {
-               if (own_if_owned (handle) == TRUE) {
-                       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: handle %p already owned", __func__,
-                                  handle);
-                       ret = WAIT_OBJECT_0;
-                       goto done;
-               }
-       }
-
-       if (own_if_signalled (handle) == TRUE) {
-               MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: handle %p already signalled", __func__,
-                          handle);
-
-               ret=WAIT_OBJECT_0;
-               goto done;
-       }
-
-       if (timeout == 0) {
-               ret = WAIT_TIMEOUT;
-               goto done;
-       }
-       
-       if (timeout != INFINITE) {
-               wait_start = mono_100ns_ticks ();
-               timeout_in_ticks = (gint64)timeout * 10 * 1000; //can't overflow as timeout is 32bits
-       }
-
-       do {
-               /* Check before waiting on the condition, just in case
-                */
-               mono_w32handle_ops_prewait (handle);
-
-               if (own_if_signalled (handle)) {
-                       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: handle %p signalled", __func__,
-                                  handle);
-
-                       ret = WAIT_OBJECT_0;
-                       goto done;
-               }
-
-               if (timeout == INFINITE) {
-                       waited = mono_w32handle_timedwait_signal_handle (handle, INFINITE, FALSE, alertable ? &apc_pending : NULL);
-               } else {
-                       gint64 elapsed = mono_100ns_ticks () - wait_start;
-                       if (elapsed >= timeout_in_ticks) {
-                               ret = WAIT_TIMEOUT;
-                               goto done;
-                       }
-
-                       waited = mono_w32handle_timedwait_signal_handle (handle, (timeout_in_ticks - elapsed) / 10 / 1000, FALSE, alertable ? &apc_pending : NULL);
-               }
-
-               if(waited==0 && !apc_pending) {
-                       /* Condition was signalled, so hopefully
-                        * handle is signalled now.  (It might not be
-                        * if someone else got in before us.)
-                        */
-                       if (own_if_signalled (handle)) {
-                               MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: handle %p signalled", __func__,
-                                          handle);
-
-                               ret=WAIT_OBJECT_0;
-                               goto done;
-                       }
-               
-                       /* Better luck next time */
-               }
-       } while(waited == 0 && !apc_pending);
-
-       /* Timeout or other error */
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: wait on handle %p error: %s", __func__, handle,
-                  strerror (waited));
-
-       ret = apc_pending ? WAIT_IO_COMPLETION : WAIT_TIMEOUT;
-
-done:
-
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: unlocking handle %p", __func__, handle);
-       
-       thr_ret = mono_w32handle_unlock_handle (handle);
-       g_assert (thr_ret == 0);
-
-       return(ret);
-}
-
-guint32 WaitForSingleObject(gpointer handle, guint32 timeout)
+guint32 WaitForSingleObjectEx(gpointer handle, guint32 timeout, gboolean alertable)
 {
-       return WaitForSingleObjectEx (handle, timeout, FALSE);
+       MonoW32HandleWaitRet ret;
+
+       ret = mono_w32handle_wait_one (handle, timeout, alertable);
+       if (ret == MONO_W32HANDLE_WAIT_RET_SUCCESS_0)
+               return WAIT_OBJECT_0;
+       else if (ret == MONO_W32HANDLE_WAIT_RET_ABANDONED_0)
+               return WAIT_ABANDONED_0;
+       else if (ret == MONO_W32HANDLE_WAIT_RET_ALERTED)
+               return WAIT_IO_COMPLETION;
+       else if (ret == MONO_W32HANDLE_WAIT_RET_TIMEOUT)
+               return WAIT_TIMEOUT;
+       else if (ret == MONO_W32HANDLE_WAIT_RET_FAILED)
+               return WAIT_FAILED;
+       else
+               g_error ("%s: unknown ret value %d", __func__, ret);
 }
 
 
@@ -233,149 +93,21 @@ guint32 WaitForSingleObject(gpointer handle, guint32 timeout)
 guint32 SignalObjectAndWait(gpointer signal_handle, gpointer wait,
                            guint32 timeout, gboolean alertable)
 {
-       guint32 ret = 0, waited;
-       int thr_ret;
-       gboolean apc_pending = FALSE;
-       gint64 wait_start, timeout_in_ticks;
-
-       if ((GPOINTER_TO_UINT (signal_handle) & _WAPI_PROCESS_UNHANDLED) == _WAPI_PROCESS_UNHANDLED) {
-               SetLastError (ERROR_INVALID_HANDLE);
-               return(WAIT_FAILED);
-       }
-
-       if ((GPOINTER_TO_UINT (wait) & _WAPI_PROCESS_UNHANDLED) == _WAPI_PROCESS_UNHANDLED) {
-               SetLastError (ERROR_INVALID_HANDLE);
-               return(WAIT_FAILED);
-       }
-       
-       if (mono_w32handle_test_capabilities (signal_handle,
-                                           MONO_W32HANDLE_CAP_SIGNAL)==FALSE) {
-               return(WAIT_FAILED);
-       }
-       
-       if (mono_w32handle_test_capabilities (wait,
-                                           MONO_W32HANDLE_CAP_WAIT)==FALSE) {
-               return(WAIT_FAILED);
-       }
-
-       mono_w32handle_ops_prewait (wait);
-       
-       if (mono_w32handle_test_capabilities (wait, MONO_W32HANDLE_CAP_SPECIAL_WAIT) == TRUE) {
-               g_warning ("%s: handle %p has special wait, implement me!!",
-                          __func__, wait);
-
-               return (WAIT_FAILED);
-       }
-
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: locking handle %p", __func__, wait);
-
-       thr_ret = mono_w32handle_lock_handle (wait);
-       g_assert (thr_ret == 0);
-
-       mono_w32handle_ops_signal (signal_handle);
-
-       if (mono_w32handle_test_capabilities (wait, MONO_W32HANDLE_CAP_OWN)==TRUE) {
-               if (own_if_owned (wait)) {
-                       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: handle %p already owned", __func__,
-                                  wait);
-                       ret = WAIT_OBJECT_0;
-                       goto done;
-               }
-       }
-
-       if (own_if_signalled (wait)) {
-               MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: handle %p already signalled", __func__, wait);
-
-               ret = WAIT_OBJECT_0;
-               goto done;
-       }
-
-       if (timeout != INFINITE) {
-               wait_start = mono_100ns_ticks ();
-               timeout_in_ticks = (gint64)timeout * 10 * 1000; //can't overflow as timeout is 32bits
-       }
-       do {
-               /* Check before waiting on the condition, just in case
-                */
-               mono_w32handle_ops_prewait (wait);
-       
-               if (own_if_signalled (wait)) {
-                       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: handle %p signalled", __func__, wait);
-
-                       ret = WAIT_OBJECT_0;
-                       goto done;
-               }
-
-               if (timeout == INFINITE) {
-                       waited = mono_w32handle_timedwait_signal_handle (wait, INFINITE, FALSE, alertable ? &apc_pending : NULL);
-               } else {
-                       gint64 elapsed = mono_100ns_ticks () - wait_start;
-                       if (elapsed >= timeout_in_ticks) {
-                               ret = WAIT_TIMEOUT;
-                               goto done;
-                       }
-
-                       waited = mono_w32handle_timedwait_signal_handle (wait, (timeout_in_ticks - elapsed) / 10 / 1000, FALSE, alertable ? &apc_pending : NULL);
-               }
-
-               if (waited==0 && !apc_pending) {
-                       /* Condition was signalled, so hopefully
-                        * handle is signalled now.  (It might not be
-                        * if someone else got in before us.)
-                        */
-                       if (own_if_signalled (wait)) {
-                               MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: handle %p signalled", __func__,
-                                          wait);
-
-                               ret = WAIT_OBJECT_0;
-                               goto done;
-                       }
-               
-                       /* Better luck next time */
-               }
-       } while(waited == 0 && !apc_pending);
-
-       /* Timeout or other error */
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: wait on handle %p error: %s", __func__, wait, strerror (ret));
-
-       ret = apc_pending ? WAIT_IO_COMPLETION : WAIT_TIMEOUT;
-
-done:
-
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: unlocking handle %p", __func__, wait);
-
-       thr_ret = mono_w32handle_unlock_handle (wait);
-       g_assert (thr_ret == 0);
-
-       return(ret);
-}
-
-static gboolean test_and_own (guint32 numobjects, gpointer *handles,
-                             gboolean waitall, guint32 *count,
-                             guint32 *lowest)
-{
-       gboolean done;
-       int i;
-       
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: locking handles", __func__);
-       
-       done = mono_w32handle_count_signalled_handles (numobjects, handles,
-                                                    waitall, count, lowest);
-       if (done == TRUE) {
-               if (waitall == TRUE) {
-                       for (i = 0; i < numobjects; i++) {
-                               own_if_signalled (handles[i]);
-                       }
-               } else {
-                       own_if_signalled (handles[*lowest]);
-               }
-       }
-       
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: unlocking handles", __func__);
-
-       mono_w32handle_unlock_handles (numobjects, handles);
-
-       return(done);
+       MonoW32HandleWaitRet ret;
+
+       ret = mono_w32handle_signal_and_wait (signal_handle, wait, timeout, alertable);
+       if (ret == MONO_W32HANDLE_WAIT_RET_SUCCESS_0)
+               return WAIT_OBJECT_0;
+       else if (ret == MONO_W32HANDLE_WAIT_RET_ABANDONED_0)
+               return WAIT_ABANDONED_0;
+       else if (ret == MONO_W32HANDLE_WAIT_RET_ALERTED)
+               return WAIT_IO_COMPLETION;
+       else if (ret == MONO_W32HANDLE_WAIT_RET_TIMEOUT)
+               return WAIT_TIMEOUT;
+       else if (ret == MONO_W32HANDLE_WAIT_RET_FAILED)
+               return WAIT_FAILED;
+       else
+               g_error ("%s: unknown ret value %d", __func__, ret);
 }
 
 /**
@@ -412,208 +144,20 @@ guint32 WaitForMultipleObjectsEx(guint32 numobjects, gpointer *handles,
                                 gboolean waitall, guint32 timeout,
                                 gboolean alertable)
 {
-       gboolean duplicate = FALSE, bogustype = FALSE, done;
-       guint32 count, lowest;
-       guint i;
-       guint32 ret;
-       int thr_ret;
-       guint32 retval;
-       gboolean poll;
-       gpointer sorted_handles [MAXIMUM_WAIT_OBJECTS];
-       gboolean apc_pending = FALSE;
-       gint64 wait_start, timeout_in_ticks;
-       
-       if (numobjects > MAXIMUM_WAIT_OBJECTS) {
-               MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Too many handles: %d", __func__, numobjects);
-
-               return(WAIT_FAILED);
-       }
-       
-       if (numobjects == 1) {
-               return WaitForSingleObjectEx (handles [0], timeout, alertable);
-       }
-
-       /* Check for duplicates */
-       for (i = 0; i < numobjects; i++) {
-               if ((GPOINTER_TO_UINT (handles[i]) & _WAPI_PROCESS_UNHANDLED) == _WAPI_PROCESS_UNHANDLED) {
-                       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Handle %d pseudo process", __func__,
-                                  i);
-
-                       bogustype = TRUE;
-                       break;
-               }
-
-               if (mono_w32handle_test_capabilities (handles[i], MONO_W32HANDLE_CAP_WAIT) == FALSE) {
-                       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Handle %p can't be waited for",
-                                  __func__, handles[i]);
-
-                       bogustype = TRUE;
-                       break;
-               }
-
-               sorted_handles [i] = handles [i];
-               mono_w32handle_ops_prewait (handles[i]);
-       }
-
-       qsort (sorted_handles, numobjects, sizeof (gpointer), g_direct_equal);
-       for (i = 1; i < numobjects; i++) {
-               if (sorted_handles [i - 1] == sorted_handles [i]) {
-                       duplicate = TRUE;
-                       break;
-               }
-       }
-
-       if (duplicate == TRUE) {
-               MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Returning due to duplicates", __func__);
-
-               return(WAIT_FAILED);
-       }
-
-       if (bogustype == TRUE) {
-               MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Returning due to bogus type", __func__);
-
-               return(WAIT_FAILED);
-       }
-
-       poll = FALSE;
-       for (i = 0; i < numobjects; ++i)
-               if (mono_w32handle_get_type (handles [i]) == MONO_W32HANDLE_PROCESS)
-                       /* Can't wait for a process handle + another handle without polling */
-                       poll = TRUE;
-
-       done = test_and_own (numobjects, handles, waitall, &count, &lowest);
-       if (done == TRUE) {
-               return(WAIT_OBJECT_0+lowest);
-       }
-       
-       if (timeout == 0) {
+       MonoW32HandleWaitRet ret;
+
+       ret = mono_w32handle_wait_multiple (handles, numobjects, waitall, timeout, alertable);
+       if (ret >= MONO_W32HANDLE_WAIT_RET_SUCCESS_0 && ret <= MONO_W32HANDLE_WAIT_RET_SUCCESS_0 + numobjects - 1)
+               return WAIT_OBJECT_0 + (ret - MONO_W32HANDLE_WAIT_RET_SUCCESS_0);
+       else if (ret >= MONO_W32HANDLE_WAIT_RET_ABANDONED_0 && ret <= MONO_W32HANDLE_WAIT_RET_ABANDONED_0 + numobjects - 1)
+               return WAIT_ABANDONED_0 + (ret - MONO_W32HANDLE_WAIT_RET_ABANDONED_0);
+       else if (ret == MONO_W32HANDLE_WAIT_RET_ALERTED)
+               return WAIT_IO_COMPLETION;
+       else if (ret == MONO_W32HANDLE_WAIT_RET_TIMEOUT)
                return WAIT_TIMEOUT;
-       }
-
-       if (timeout != INFINITE) {
-               wait_start = mono_100ns_ticks ();
-               timeout_in_ticks = (gint64)timeout * 10 * 1000; //can't overflow as timeout is 32bits
-       }
-
-       /* Have to wait for some or all handles to become signalled
-        */
-
-       for (i = 0; i < numobjects; i++) {
-               /* Add a reference, as we need to ensure the handle wont
-                * disappear from under us while we're waiting in the loop
-                * (not lock, as we don't want exclusive access here)
-                */
-               mono_w32handle_ref (handles[i]);
-       }
-
-       while(1) {
-               /* Prod all handles with prewait methods and
-                * special-wait handles that aren't already signalled
-                */
-               for (i = 0; i < numobjects; i++) {
-                       mono_w32handle_ops_prewait (handles[i]);
-               
-                       if (mono_w32handle_test_capabilities (handles[i], MONO_W32HANDLE_CAP_SPECIAL_WAIT) == TRUE && mono_w32handle_issignalled (handles[i]) == FALSE) {
-                               mono_w32handle_ops_specialwait (handles[i], 0, alertable ? &apc_pending : NULL);
-                       }
-               }
-               
-               MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: locking signal mutex", __func__);
-
-               thr_ret = mono_w32handle_lock_signal_mutex ();
-               g_assert (thr_ret == 0);
-
-               /* Check the signalled state of handles inside the critical section */
-               if (waitall) {
-                       done = TRUE;
-                       for (i = 0; i < numobjects; i++)
-                               if (!mono_w32handle_issignalled (handles [i]))
-                                       done = FALSE;
-               } else {
-                       done = FALSE;
-                       for (i = 0; i < numobjects; i++)
-                               if (mono_w32handle_issignalled (handles [i]))
-                                       done = TRUE;
-               }
-               
-               if (!done) {
-                       /* Enter the wait */
-                       if (timeout == INFINITE) {
-                               ret = mono_w32handle_timedwait_signal (INFINITE, poll, &apc_pending);
-                       } else {
-                               gint64 elapsed = mono_100ns_ticks () - wait_start;
-                               if (elapsed >= timeout_in_ticks) {
-                                       ret = WAIT_TIMEOUT;
-                               } else {
-                                       ret = mono_w32handle_timedwait_signal ((timeout_in_ticks - elapsed) / 10 / 1000, poll, &apc_pending);
-                               }
-                       }
-               } else {
-                       /* No need to wait */
-                       ret = 0;
-               }
-
-               MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: unlocking signal mutex", __func__);
-
-               thr_ret = mono_w32handle_unlock_signal_mutex ();
-               g_assert (thr_ret == 0);
-               
-               if (alertable && apc_pending) {
-                       retval = WAIT_IO_COMPLETION;
-                       break;
-               }
-       
-               /* Check if everything is signalled, as we can't
-                * guarantee to notice a shared signal even if the
-                * wait timed out
-                */
-               done = test_and_own (numobjects, handles, waitall,
-                                    &count, &lowest);
-               if (done == TRUE) {
-                       retval = WAIT_OBJECT_0+lowest;
-                       break;
-               } else if (ret != 0) {
-                       /* Didn't get all handles, and there was a timeout */
-                       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: wait returned error: %s", __func__,
-                                  strerror (ret));
-
-                       retval = WAIT_TIMEOUT;
-                       break;
-               }
-       }
-
-       for (i = 0; i < numobjects; i++) {
-               /* Unref everything we reffed above */
-               mono_w32handle_unref (handles[i]);
-       }
-
-       return retval;
-}
-
-guint32 WaitForMultipleObjects(guint32 numobjects, gpointer *handles,
-                              gboolean waitall, guint32 timeout)
-{
-       return WaitForMultipleObjectsEx(numobjects, handles, waitall, timeout, FALSE);
-}
-
-/**
- * WaitForInputIdle:
- * @handle: a handle to the process to wait for
- * @timeout: the maximum time in milliseconds to wait for
- *
- * This function returns when either @handle process is waiting
- * for input, or @timeout ms elapses.  If @timeout is zero, the
- * process state is tested and the function returns immediately.
- * If @timeout is %INFINITE, the function waits forever.
- *
- * Return value: 0 - @handle process is waiting for input.
- * %WAIT_TIMEOUT - The @timeout interval elapsed and
- * @handle process is not waiting for input.  %WAIT_FAILED - an error
- * occurred. 
- */
-guint32 WaitForInputIdle(gpointer handle, guint32 timeout)
-{
-       /*TODO: Not implemented*/
-       return WAIT_TIMEOUT;
+       else if (ret == MONO_W32HANDLE_WAIT_RET_FAILED)
+               return WAIT_FAILED;
+       else
+               g_error ("%s: unknown ret value %d", __func__, ret);
 }
 
index a4ff149147efe3ee4cd17e8f01125002ad10083b..cbbf5d68203b93857d3da19886db35de93ef873e 100644 (file)
 #define _WAPI_WAIT_H_
 
 #include "mono/io-layer/status.h"
+#include "mono/metadata/w32handle.h"
 
 G_BEGIN_DECLS
 
-#define MAXIMUM_WAIT_OBJECTS 64
-
 #define INFINITE               0xFFFFFFFF
 
 #define WAIT_FAILED            0xFFFFFFFF
@@ -27,16 +26,12 @@ G_BEGIN_DECLS
 #define WAIT_TIMEOUT           STATUS_TIMEOUT
 #define WAIT_IO_COMPLETION     STATUS_USER_APC
 
-extern guint32 WaitForSingleObject(gpointer handle, guint32 timeout);
 extern guint32 WaitForSingleObjectEx(gpointer handle, guint32 timeout, 
                                        gboolean alertable);
 extern guint32 SignalObjectAndWait(gpointer signal_handle, gpointer wait,
                                   guint32 timeout, gboolean alertable);
-extern guint32 WaitForMultipleObjects(guint32 numobjects, gpointer *handles,
-                                     gboolean waitall, guint32 timeout);
 extern guint32 WaitForMultipleObjectsEx(guint32 numobjects, gpointer *handles,
                                      gboolean waitall, guint32 timeout, gboolean alertable);
-extern guint32 WaitForInputIdle(gpointer handle, guint32 timeout);
 
 G_END_DECLS
 #endif /* _WAPI_WAIT_H_ */
index ee961002d9eec7152e3741e77299836cab989d14..9be764c15218771e3bb46150829b67b85286ca1d 100644 (file)
@@ -16,7 +16,6 @@
 
 #include <mono/io-layer/wapi.h>
 #include <mono/io-layer/io.h>
-#include <mono/io-layer/shared.h>
 
 #include <mono/utils/mono-os-mutex.h>
 
 
 extern gboolean _wapi_has_shut_down;
 
-typedef struct 
-{
-       gchar name[MAX_PATH + 1];
-} WapiSharedNamespace;
-
-#include <mono/io-layer/event-private.h>
 #include <mono/io-layer/io-private.h>
-#include <mono/io-layer/mutex-private.h>
-#include <mono/io-layer/semaphore-private.h>
 #include <mono/io-layer/socket-private.h>
-#include <mono/io-layer/process-private.h>
-#include <mono/utils/w32handle.h>
+#include <mono/metadata/w32handle.h>
 
 struct _WapiHandle_shared_ref
 {
@@ -46,13 +36,6 @@ struct _WapiHandle_shared_ref
        guint32 offset;
 };
 
-#define _WAPI_SHARED_SEM_NAMESPACE 0
-/*#define _WAPI_SHARED_SEM_COLLECTION 1*/
-#define _WAPI_SHARED_SEM_FILESHARE 2
-#define _WAPI_SHARED_SEM_PROCESS_COUNT_LOCK 6
-#define _WAPI_SHARED_SEM_PROCESS_COUNT 7
-#define _WAPI_SHARED_SEM_COUNT 8       /* Leave some future expansion space */
-
 struct _WapiFileShare
 {
 #ifdef WAPI_FILE_SHARE_PLATFORM_EXTRA_DATA
@@ -69,18 +52,4 @@ struct _WapiFileShare
 
 typedef struct _WapiFileShare _WapiFileShare;
 
-gpointer
-_wapi_search_handle_namespace (MonoW32HandleType type, gchar *utf8_name);
-
-static inline int _wapi_namespace_lock (void)
-{
-       return(_wapi_shm_sem_lock (_WAPI_SHARED_SEM_NAMESPACE));
-}
-
-/* This signature makes it easier to use in pthread cleanup handlers */
-static inline int _wapi_namespace_unlock (gpointer data G_GNUC_UNUSED)
-{
-       return(_wapi_shm_sem_unlock (_WAPI_SHARED_SEM_NAMESPACE));
-}
-
 #endif /* _WAPI_PRIVATE_H_ */
index b848a483c7030aad42af1650541355d16f260836..b19465c7c68e0a12ca403bf774ff8019513e2649 100644 (file)
 #define GetLastError wapi_GetLastError
 #define SetLastError wapi_SetLastError
 #define TransmitFile wapi_TransmitFile
-#define GetThreadContext wapi_GetThreadContext
-#define CreateEvent wapi_CreateEvent 
-#define PulseEvent wapi_PulseEvent 
-#define ResetEvent wapi_ResetEvent 
-#define SetEvent wapi_SetEvent 
-#define OpenEvent wapi_OpenEvent 
 #define CloseHandle wapi_CloseHandle 
 #define DuplicateHandle wapi_DuplicateHandle 
 #define CreateFile wapi_CreateFile
 #define UnlockFile wapi_UnlockFile 
 #define GetVolumeInformation wapi_GetVolumeInformation 
 #define FormatMessage wapi_FormatMessage 
-#define CreateMutex wapi_CreateMutex 
-#define ReleaseMutex wapi_ReleaseMutex 
-#define OpenMutex wapi_OpenMutex 
-#define ShellExecuteEx wapi_ShellExecuteEx 
-#define CreateProcess wapi_CreateProcess 
-#define CreateProcessWithLogonW wapi_CreateProcessWithLogonW 
-#define GetCurrentProcess wapi_GetCurrentProcess 
-#define GetProcessId wapi_GetProcessId 
-#define CloseProcess wapi_CloseProcess 
-#define OpenProcess wapi_OpenProcess 
-#define GetExitCodeProcess wapi_GetExitCodeProcess 
-#define GetProcessTimes wapi_GetProcessTimes 
-#define EnumProcessModules wapi_EnumProcessModules 
-#define GetModuleBaseName wapi_GetModuleBaseName 
-#define GetModuleFileNameEx wapi_GetModuleFileNameEx 
-#define GetModuleInformation wapi_GetModuleInformation 
-#define GetProcessWorkingSetSize wapi_GetProcessWorkingSetSize 
-#define SetProcessWorkingSetSize wapi_SetProcessWorkingSetSize 
-#define TerminateProcess wapi_TerminateProcess 
-#define GetPriorityClass wapi_GetPriorityClass 
-#define SetPriorityClass wapi_SetPriorityClass 
 #define ImpersonateLoggedOnUser wapi_ImpersonateLoggedOnUser 
 #define RevertToSelf wapi_RevertToSelf 
-#define CreateSemaphore wapi_CreateSemaphore
-#define ReleaseSemaphore wapi_ReleaseSemaphore
-#define OpenSemaphore wapi_OpenSemaphore 
 #define WSASetLastError wapi_WSASetLastError
 #define WSAGetLastError wapi_WSAGetLastError
 #define WSAIoctl wapi_WSAIoctl 
 #define GetFileVersionInfo wapi_GetFileVersionInfo 
 #define VerQueryValue wapi_VerQueryValue 
 #define VerLanguageName wapi_VerLanguageName 
-#define WaitForSingleObject wapi_WaitForSingleObject
 #define WaitForSingleObjectEx wapi_WaitForSingleObjectEx
 #define SignalObjectAndWait wapi_SignalObjectAndWait
-#define WaitForMultipleObjects wapi_WaitForMultipleObjects
 #define WaitForMultipleObjectsEx wapi_WaitForMultipleObjectsEx
-#define WaitForInputIdle wapi_WaitForInputIdle
 
 #endif /* __WAPI_REMAP_H__ */
index a9f93692400dbc03c96557e20ef08fc86a7aa793..f162b0bb45cad926593816f8e28366fcfd034dd7 100644 (file)
@@ -1,29 +1,19 @@
 
 #include "wapi.h"
 
-#include "event-private.h"
 #include "io-trace.h"
 #include "io.h"
-#include "mutex-private.h"
-#include "process-private.h"
-#include "semaphore-private.h"
-#include "shared.h"
 #include "socket-private.h"
 
 #include "mono/utils/mono-lazy-init.h"
-#include "mono/utils/w32handle.h"
+#include "mono/metadata/w32handle.h"
 
 gboolean _wapi_has_shut_down = FALSE;
 
 void
 wapi_init (void)
 {
-       _wapi_shm_semaphores_init ();
        _wapi_io_init ();
-       _wapi_processes_init ();
-       _wapi_semaphore_init ();
-       _wapi_mutex_init ();
-       _wapi_event_init ();
        _wapi_socket_init ();
 }
 
@@ -34,7 +24,6 @@ wapi_cleanup (void)
        _wapi_has_shut_down = TRUE;
 
        _wapi_error_cleanup ();
-       wapi_processes_cleanup ();
        _wapi_io_cleanup ();
 }
 
@@ -57,100 +46,13 @@ wapi_getpid (void)
        return _wapi_pid;
 }
 
-static gboolean
-_WAPI_SHARED_NAMESPACE (MonoW32HandleType type)
-{
-       switch (type) {
-       case MONO_W32HANDLE_NAMEDMUTEX:
-       case MONO_W32HANDLE_NAMEDSEM:
-       case MONO_W32HANDLE_NAMEDEVENT:
-               return TRUE;
-       default:
-               return FALSE;
-       }
-}
-
-typedef struct {
-       gpointer ret;
-       MonoW32HandleType type;
-       gchar *utf8_name;
-} _WapiSearchHandleNamespaceData;
-
-static gboolean mono_w32handle_search_namespace_callback (gpointer handle, gpointer data, gpointer user_data)
-{
-       _WapiSearchHandleNamespaceData *search_data;
-       MonoW32HandleType type;
-       WapiSharedNamespace *sharedns;
-
-       type = mono_w32handle_get_type (handle);
-       if (!_WAPI_SHARED_NAMESPACE (type))
-               return FALSE;
-
-       search_data = (_WapiSearchHandleNamespaceData*) user_data;
-
-       switch (type) {
-       case MONO_W32HANDLE_NAMEDMUTEX: sharedns = &((struct _WapiHandle_namedmutex*) data)->sharedns; break;
-       case MONO_W32HANDLE_NAMEDSEM:   sharedns = &((struct _WapiHandle_namedsem*)   data)->sharedns; break;
-       case MONO_W32HANDLE_NAMEDEVENT: sharedns = &((struct _WapiHandle_namedevent*) data)->sharedns; break;
-       default:
-               g_assert_not_reached ();
-       }
-
-       if (strcmp (sharedns->name, search_data->utf8_name) == 0) {
-               if (type != search_data->type) {
-                       /* Its the wrong type, so fail now */
-                       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: handle %p matches name but is wrong type: %s",
-                               __func__, handle, mono_w32handle_ops_typename (type));
-                       search_data->ret = INVALID_HANDLE_VALUE;
-               } else {
-                       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: handle %p matches name and type",
-                               __func__, handle);
-                       search_data->ret = handle;
-               }
-
-               return TRUE;
-       }
-
-       return FALSE;
-}
-
-/* Returns the offset of the metadata array, or INVALID_HANDLE_VALUE on error, or NULL for
- * not found
- */
-gpointer _wapi_search_handle_namespace (MonoW32HandleType type, gchar *utf8_name)
-{
-       _WapiSearchHandleNamespaceData search_data;
-
-       g_assert(_WAPI_SHARED_NAMESPACE(type));
-
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Lookup for handle named [%s] type %s",
-               __func__, utf8_name, mono_w32handle_ops_typename (type));
-
-       search_data.ret = NULL;
-       search_data.type = type;
-       search_data.utf8_name = utf8_name;
-       mono_w32handle_foreach (mono_w32handle_search_namespace_callback, &search_data);
-       return search_data.ret;
-}
-
 /* Lots more to implement here, but this is all we need at the moment */
 gboolean
 DuplicateHandle (gpointer srcprocess, gpointer src, gpointer targetprocess, gpointer *target,
        guint32 access G_GNUC_UNUSED, gboolean inherit G_GNUC_UNUSED, guint32 options G_GNUC_UNUSED)
 {
-       if (srcprocess != _WAPI_PROCESS_CURRENT || targetprocess != _WAPI_PROCESS_CURRENT) {
-               /* Duplicating other process's handles is not supported */
-               SetLastError (ERROR_INVALID_HANDLE);
-               return FALSE;
-       }
-
-       if (src == _WAPI_PROCESS_CURRENT) {
-               *target = _wapi_process_duplicate ();
-       } else {
-               mono_w32handle_ref (src);
-               *target = src;
-       }
-
+       mono_w32handle_ref (src);
+       *target = src;
        return TRUE;
 }
 
index 4e0a688063984ad671543a10f51a4bc2d27290c7..520bb2f7ac673d699b71b886f518492407c98036 100644 (file)
 #ifndef _WAPI_WAPI_H_
 #define _WAPI_WAPI_H_
 
+#include <sys/types.h>
+
 #include <mono/io-layer/wapi-remap.h>
 #include <mono/io-layer/types.h>
 #include <mono/io-layer/macros.h>
 #include <mono/io-layer/io.h>
-#include <mono/io-layer/access.h>
-#include <mono/io-layer/context.h>
 #include <mono/io-layer/error.h>
-#include <mono/io-layer/events.h>
 #include <mono/io-layer/messages.h>
-#include <mono/io-layer/mutexes.h>
-#include <mono/io-layer/processes.h>
 #include <mono/io-layer/security.h>
-#include <mono/io-layer/semaphores.h>
 #include <mono/io-layer/sockets.h>
 #include <mono/io-layer/status.h>
 #include <mono/io-layer/timefuncs.h>
index 88864821be44d394939dd5d19a9c87239eee38f7..013b778a86579d088ef71551af526cffb572b192 100644 (file)
@@ -267,11 +267,11 @@ globextend(const gchar *path, wapi_glob_t *pglob, size_t *limitp)
 
        newsize = sizeof(*pathv) * (2 + pglob->gl_pathc + pglob->gl_offs);
        /* FIXME: Can just use realloc(). */
-       pathv = (char **)(pglob->gl_pathv ? realloc((char *)pglob->gl_pathv, newsize) :
-           malloc(newsize));
+       pathv = (char **)(pglob->gl_pathv ? g_realloc ((char *)pglob->gl_pathv, newsize) :
+           g_malloc (newsize));
        if (pathv == NULL) {
                if (pglob->gl_pathv) {
-                       free(pglob->gl_pathv);
+                       g_free (pglob->gl_pathv);
                        pglob->gl_pathv = NULL;
                }
                return(WAPI_GLOB_NOSPACE);
@@ -291,7 +291,7 @@ globextend(const gchar *path, wapi_glob_t *pglob, size_t *limitp)
        *limitp += len;
        if ((copy = (char *)malloc(len)) != NULL) {
                if (g_Ctoc(path, copy, len)) {
-                       free(copy);
+                       g_free (copy);
                        return(WAPI_GLOB_NOSPACE);
                }
                pathv[pglob->gl_offs + pglob->gl_pathc++] = copy;
@@ -361,8 +361,8 @@ _wapi_globfree(wapi_glob_t *pglob)
                pp = pglob->gl_pathv + pglob->gl_offs;
                for (i = pglob->gl_pathc; i--; ++pp)
                        if (*pp)
-                               free(*pp);
-               free(pglob->gl_pathv);
+                               g_free (*pp);
+               g_free (pglob->gl_pathv);
                pglob->gl_pathv = NULL;
        }
 }
index 32f5628d5f75c2bd602e7255bebff10d6e3c79bb..bc369533a3f86bdc79f4d09e1c21cce51c292667 100644 (file)
@@ -1,6 +1,21 @@
 if HOST_WIN32
 win32_sources = \
-       console-win32.c
+       console-win32.c \
+       console-win32-internals.h \
+       file-io-windows.c \
+       file-io-windows-internals.h \
+       icall-windows.c \
+       icall-windows-internals.h \
+       marshal-windows.c \
+       marshal-windows-internals.h \
+       mono-security-windows.c \
+       mono-security-windows-internals.h \
+       w32mutex-win32.c \
+       w32semaphore-win32.c \
+       w32event-win32.c \
+       w32process-win32.c \
+       w32process-win32-internals.h \
+       socket-io-windows.c
 
 platform_sources = $(win32_sources)
 
@@ -23,7 +38,16 @@ else
 assembliesdir = $(exec_prefix)/lib
 confdir = $(sysconfdir)
 unix_sources = \
-       console-unix.c
+       console-unix.c \
+       w32mutex-unix.c \
+       w32semaphore-unix.c \
+       w32event-unix.c \
+       w32process-unix.c \
+       w32process-unix-internals.h \
+       w32process-unix-osx.c \
+       w32process-unix-bsd.c \
+       w32process-unix-haiku.c \
+       w32process-unix-default.c
 
 platform_sources = $(unix_sources)
 endif
@@ -82,7 +106,7 @@ mono-config-dirs.lo: Makefile
 libmonoruntime_config_la_SOURCES = \
        mono-config-dirs.h              \
        mono-config-dirs.c
-libmonoruntime_config_la_CPPFLAGS = $(AM_CPPFLAGS) -DMONO_BINDIR=\"$(bindir)/\" -DMONO_ASSEMBLIES=\"$(assembliesdir)\" -DMONO_CFG_DIR=\"$(confdir)\"
+libmonoruntime_config_la_CPPFLAGS = $(AM_CPPFLAGS) -DMONO_BINDIR=\"$(bindir)/\" -DMONO_ASSEMBLIES=\"$(assembliesdir)\" -DMONO_CFG_DIR=\"$(confdir)\" -DMONO_RELOC_LIBDIR=\"../$(reloc_libdir)\"
 
 CLEANFILES = mono-bundle.stamp
 
@@ -95,16 +119,20 @@ null_gc_sources = \
 common_sources = \
        $(platform_sources)     \
        assembly.c              \
+       assembly-internals.h    \
        attach.h                \
        attach.c                \
        cil-coff.h              \
        class.c                 \
        class-internals.h       \
+       class-inlines.h         \
+       class-accessors.c       \
        cominterop.c            \
        cominterop.h            \
        console-io.h            \
        coree.c                 \
        coree.h                 \
+       coree-internals.h \
        culture-info.h          \
        culture-info-tables.h   \
        debug-helpers.c         \
@@ -122,10 +150,12 @@ common_sources = \
        exception-internals.h   \
        file-io.c               \
        file-io.h               \
+       file-io-internals.h \
        filewatcher.c           \
        filewatcher.h           \
        gc-internals.h          \
        icall.c                 \
+       icall-internals.h \
        icall-def.h             \
        image.c                 \
        image-internals.h       \
@@ -137,6 +167,7 @@ common_sources = \
        lock-tracer.h           \
        marshal.c               \
        marshal.h               \
+       marshal-internals.h \
        mempool.c               \
        mempool.h               \
        mempool-internals.h     \
@@ -170,10 +201,13 @@ common_sources = \
        number-ms.h             \
        object-internals.h      \
        opcodes.c               \
+       property-bag.h  \
+       property-bag.c  \
        socket-io.c             \
        socket-io.h             \
-       process.c               \
-       process.h               \
+       w32process.c            \
+       w32process.h            \
+       w32process-internals.h          \
        profiler.c              \
        profiler-private.h      \
        rand.h                  \
@@ -201,6 +235,12 @@ common_sources = \
        verify.c                \
        verify-internals.h      \
        wrapper-types.h \
+       dynamic-image-internals.h       \
+       dynamic-stream.c        \
+       dynamic-stream-internals.h      \
+       reflection-cache.h      \
+       custom-attrs-internals.h        \
+       sre-internals.h \
        reflection-internals.h  \
        file-mmap-posix.c       \
        file-mmap-windows.c     \
@@ -211,8 +251,14 @@ common_sources = \
        seq-points-data.h       \
        seq-points-data.c       \
        handle.c        \
-       handle.h
-
+       handle.h        \
+       w32mutex.h      \
+       w32semaphore.h  \
+       w32event.h      \
+       w32handle-namespace.h   \
+       w32handle-namespace.c   \
+       w32handle.h     \
+       w32handle.c
 
 # These source files have compile time dependencies on GC code
 gc_dependent_sources = \
@@ -223,16 +269,18 @@ gc_dependent_sources = \
        monitor.c       \
        mono-hash.c     \
        object.c        \
+       dynamic-image.c \
+       sre.c   \
+       sre-encode.c    \
+       sre-save.c      \
+       custom-attrs.c  \
        reflection.c
 
+
 boehm_sources = \
        boehm-gc.c
 
 sgen_sources = \
-       sgen-os-posix.c         \
-       sgen-os-mach.c          \
-       sgen-os-win32.c         \
-       sgen-os-coop.c          \
        sgen-bridge.c           \
        sgen-bridge.h           \
        sgen-bridge-internals.h \
@@ -256,12 +304,12 @@ libmonoruntimesgen_la_LIBADD = libmonoruntime-config.la
 libmonoruntime_static_la_SOURCES = $(libmonoruntime_la_SOURCES)
 libmonoruntime_static_la_LDFLAGS = -static
 libmonoruntime_static_la_CFLAGS = $(BOEHM_DEFINES)
-libmonoruntime_static_la_LIBADD = $(bundle_obj) $(libmonoruntime_la_LIBADD)
+libmonoruntime_static_la_LIBADD = $(bundle_obj) libmonoruntime-config.la
 
 libmonoruntimesgen_static_la_SOURCES = $(libmonoruntimesgen_la_SOURCES)
 libmonoruntimesgen_static_la_LDFLAGS = -static
 libmonoruntimesgen_static_la_CFLAGS = $(SGEN_DEFINES)
-libmonoruntimesgen_static_la_LIBADD = $(libmonoruntimesgen_la_LIBADD)
+libmonoruntimesgen_static_la_LIBADD = libmonoruntime-config.la
 
 libmonoruntimeincludedir = $(includedir)/mono-$(API_VER)/mono/metadata
 
index ae391b08948e86b49aa92aac222083d8e0214175..e18c3febebd07edd09e3849f6e6e77856ca4315a 100644 (file)
@@ -58,6 +58,7 @@
 #include <mono/metadata/tokentype.h>
 #include <mono/metadata/profiler-private.h>
 #include <mono/metadata/reflection-internals.h>
+#include <mono/metadata/abi-details.h>
 #include <mono/utils/mono-uri.h>
 #include <mono/utils/mono-logger-internals.h>
 #include <mono/utils/mono-path.h>
@@ -67,7 +68,7 @@
 #include <mono/utils/atomic.h>
 #include <mono/utils/mono-memory-model.h>
 #include <mono/utils/mono-threads.h>
-#include <mono/utils/w32handle.h>
+#include <mono/metadata/w32handle.h>
 #ifdef HOST_WIN32
 #include <direct.h>
 #endif
@@ -83,7 +84,7 @@
  * Changes which are already detected at runtime, like the addition
  * of icalls, do not require an increment.
  */
-#define MONO_CORLIB_VERSION 152
+#define MONO_CORLIB_VERSION 163
 
 typedef struct
 {
@@ -343,8 +344,14 @@ mono_check_corlib_version (void)
        int version = mono_get_corlib_version ();
        if (version != MONO_CORLIB_VERSION)
                return g_strdup_printf ("expected corlib version %d, found %d.", MONO_CORLIB_VERSION, version);
-       else
-               return NULL;
+
+       /* Check that the managed and unmanaged layout of MonoInternalThread matches */
+       guint32 native_offset = (guint32) MONO_STRUCT_OFFSET (MonoInternalThread, last);
+       guint32 managed_offset = mono_field_get_offset (mono_class_get_field_from_name (mono_defaults.internal_thread_class, "last"));
+       if (native_offset != managed_offset)
+               return g_strdup_printf ("expected InternalThread.last field offset %u, found %u. See InternalThread.last comment", native_offset, managed_offset);
+
+       return NULL;
 }
 
 /**
@@ -1408,7 +1415,12 @@ shadow_copy_sibling (gchar *src, gint srclen, const char *extension, gchar *targ
        dest = g_utf8_to_utf16 (target, strlen (target), NULL, NULL, NULL);
        
        DeleteFile (dest);
+
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
        copy_result = CopyFile (orig, dest, FALSE);
+#else
+       copy_result = SUCCEEDED (CopyFile2 (orig, dest, NULL));
+#endif
 
        /* Fix for bug #556884 - make sure the files have the correct mode so that they can be
         * overwritten when updated in their original locations. */
@@ -1736,7 +1748,11 @@ mono_make_shadow_copy (const char *filename, MonoError *oerror)
                return (char *)filename;
        }
 
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
        copy_result = CopyFile (orig, dest, FALSE);
+#else
+       copy_result = SUCCEEDED (CopyFile2 (orig, dest, NULL));
+#endif
 
        /* Fix for bug #556884 - make sure the files have the correct mode so that they can be
         * overwritten when updated in their original locations. */
@@ -1942,37 +1958,37 @@ ves_icall_System_Reflection_Assembly_LoadFrom (MonoString *fname, MonoBoolean re
        MonoDomain *domain = mono_domain_get ();
        char *name, *filename;
        MonoImageOpenStatus status = MONO_IMAGE_OK;
-       MonoAssembly *ass;
+       MonoAssembly *ass = NULL;
+
+       name = NULL;
+       result = NULL;
+
+       mono_error_init (&error);
 
        if (fname == NULL) {
-               MonoException *exc = mono_get_exception_argument_null ("assemblyFile");
-               mono_set_pending_exception (exc);
-               return NULL;
+               mono_error_set_argument_null (&error, "assemblyFile", "");
+               goto leave;
        }
                
        name = filename = mono_string_to_utf8_checked (fname, &error);
-       if (mono_error_set_pending_exception (&error))
-               return NULL;
+       if (!is_ok (&error))
+               goto leave;
        
        ass = mono_assembly_open_full (filename, &status, refOnly);
        
        if (!ass) {
-               MonoException *exc;
-
                if (status == MONO_IMAGE_IMAGE_INVALID)
-                       exc = mono_get_exception_bad_image_format2 (NULL, fname);
+                       mono_error_set_bad_image_name (&error, name, "");
                else
-                       exc = mono_get_exception_file_not_found2 (NULL, fname);
-               g_free (name);
-               mono_set_pending_exception (exc);
-               return NULL;
+                       mono_error_set_exception_instance (&error, mono_get_exception_file_not_found2 (NULL, fname));
+               goto leave;
        }
 
-       g_free (name);
-
        result = mono_assembly_get_object_checked (domain, ass, &error);
-       if (!result)
-               mono_error_set_pending_exception (&error);
+
+leave:
+       mono_error_set_pending_exception (&error);
+       g_free (name);
        return result;
 }
 
@@ -2024,7 +2040,7 @@ ves_icall_System_AppDomain_LoadAssembly (MonoAppDomain *ad,  MonoString *assRef,
        MonoAssembly *ass;
        MonoAssemblyName aname;
        MonoReflectionAssembly *refass = NULL;
-       gchar *name;
+       gchar *name = NULL;
        gboolean parsed;
 
        g_assert (assRef);
@@ -2033,16 +2049,13 @@ ves_icall_System_AppDomain_LoadAssembly (MonoAppDomain *ad,  MonoString *assRef,
        if (mono_error_set_pending_exception (&error))
                return NULL;
        parsed = mono_assembly_name_parse (name, &aname);
-       g_free (name);
 
        if (!parsed) {
                /* This is a parse error... */
                if (!refOnly) {
                        refass = mono_try_assembly_resolve (domain, assRef, NULL, refOnly, &error);
-                       if (!mono_error_ok (&error)) {
-                               mono_error_set_pending_exception (&error);
-                               return NULL;
-                       }
+                       if (!is_ok (&error))
+                               goto leave;
                }
                return refass;
        }
@@ -2054,25 +2067,28 @@ ves_icall_System_AppDomain_LoadAssembly (MonoAppDomain *ad,  MonoString *assRef,
                /* MS.NET doesn't seem to call the assembly resolve handler for refonly assemblies */
                if (!refOnly) {
                        refass = mono_try_assembly_resolve (domain, assRef, NULL, refOnly, &error);
-                       if (!mono_error_ok (&error)) {
-                               mono_error_set_pending_exception (&error);
-                               return NULL;
-                       }
+                       if (!is_ok (&error))
+                               goto leave;
                }
                else
                        refass = NULL;
-               if (!refass) {
-                       return NULL;
-               }
+               if (!refass)
+                       goto leave;
+               ass = refass->assembly;
        }
 
-       if (refass == NULL)
+       g_assert (ass);
+       if (refass == NULL) {
                refass = mono_assembly_get_object_checked (domain, ass, &error);
+               if (!is_ok (&error))
+                       goto leave;
+       }
 
-       if (refass == NULL)
-               mono_error_set_pending_exception (&error);
-       else
-               MONO_OBJECT_SETREF (refass, evidence, evidence);
+       MONO_OBJECT_SETREF (refass, evidence, evidence);
+
+leave:
+       g_free (name);
+       mono_error_set_pending_exception (&error);
        return refass;
 }
 
@@ -2464,13 +2480,13 @@ mono_domain_unload (MonoDomain *domain)
        mono_domain_try_unload (domain, &exc);
 }
 
-static guint32
-guarded_wait (HANDLE handle, guint32 timeout, gboolean alertable)
+static MonoThreadInfoWaitRet
+guarded_wait (MonoThreadHandle *thread_handle, guint32 timeout, gboolean alertable)
 {
-       guint32 result;
+       MonoThreadInfoWaitRet result;
 
        MONO_ENTER_GC_SAFE;
-       result = WaitForSingleObjectEx (handle, timeout, alertable);
+       result = mono_thread_info_wait_one_handle (thread_handle, timeout, alertable);
        MONO_EXIT_GC_SAFE;
 
        return result;
@@ -2499,13 +2515,12 @@ void
 mono_domain_try_unload (MonoDomain *domain, MonoObject **exc)
 {
        MonoError error;
-       HANDLE thread_handle;
+       MonoThreadHandle *thread_handle;
        MonoAppDomainState prev_state;
        MonoMethod *method;
        unload_data *thread_data;
        MonoNativeThreadId tid;
        MonoDomain *caller_domain = mono_domain_get ();
-       MonoThreadParm tp;
 
        /* printf ("UNLOAD STARTING FOR %s (%p) IN THREAD 0x%x.\n", domain->friendly_name, domain, mono_native_thread_id_get ()); */
 
@@ -2562,25 +2577,22 @@ mono_domain_try_unload (MonoDomain *domain, MonoObject **exc)
         * First we create a separate thread for unloading, since
         * we might have to abort some threads, including the current one.
         */
-       tp.priority = MONO_THREAD_PRIORITY_NORMAL;
-       tp.stack_size = 0;
-       tp.creation_flags = CREATE_SUSPENDED;
-       thread_handle = mono_threads_create_thread (unload_thread_main, thread_data, &tp, &tid);
+       thread_handle = mono_threads_create_thread (unload_thread_main, thread_data, NULL, &tid);
        if (thread_handle == NULL)
                return;
-       mono_thread_info_resume (tid);
 
        /* Wait for the thread */       
-       while (!thread_data->done && guarded_wait (thread_handle, INFINITE, TRUE) == WAIT_IO_COMPLETION) {
+       while (!thread_data->done && guarded_wait (thread_handle, INFINITE, TRUE) == MONO_THREAD_INFO_WAIT_RET_ALERTED) {
                if (mono_thread_internal_has_appdomain_ref (mono_thread_internal_current (), domain) && (mono_thread_interruption_requested ())) {
                        /* The unload thread tries to abort us */
                        /* The icall wrapper will execute the abort */
-                       CloseHandle (thread_handle);
+                       mono_threads_close_thread_handle (thread_handle);
                        unload_data_unref (thread_data);
                        return;
                }
        }
-       CloseHandle (thread_handle);
+
+       mono_threads_close_thread_handle (thread_handle);
 
        if (thread_data->failure_reason) {
                /* Roll back the state change */
diff --git a/mono/metadata/assembly-internals.h b/mono/metadata/assembly-internals.h
new file mode 100644 (file)
index 0000000..5af7bd6
--- /dev/null
@@ -0,0 +1,12 @@
+/*
+ * Copyright 2015 Xamarin Inc
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
+ */
+#ifndef __MONO_METADATA_ASSEMBLY_INTERNALS_H__
+#define __MONO_METADATA_ASSEMBLY_INTERNALS_H__
+
+#include <mono/metadata/assembly.h>
+
+MONO_API MonoImage*    mono_assembly_load_module_checked (MonoAssembly *assembly, uint32_t idx, MonoError *error);
+
+#endif /* __MONO_METADATA_ASSEMBLY_INTERNALS_H__ */
index 4bad7dc5ed6d85719bd7426b3e906655c833c127..cae45aa64abde017a5223bcb5ecbc25dda2fa3da 100644 (file)
 #include <string.h>
 #include <stdlib.h>
 #include "assembly.h"
+#include "assembly-internals.h"
 #include "image.h"
+#include "image-internals.h"
 #include "object-internals.h"
 #include <mono/metadata/loader.h>
 #include <mono/metadata/tabledefs.h>
+#include <mono/metadata/custom-attrs-internals.h>
 #include <mono/metadata/metadata-internals.h>
 #include <mono/metadata/profiler-private.h>
 #include <mono/metadata/class-internals.h>
@@ -203,7 +206,6 @@ static GSList *loaded_assembly_bindings = NULL;
 
 /* Class lazy loading functions */
 static GENERATE_TRY_GET_CLASS_WITH_CACHE (internals_visible, System.Runtime.CompilerServices, InternalsVisibleToAttribute)
-
 static MonoAssembly*
 mono_assembly_invoke_search_hook_internal (MonoAssemblyName *aname, MonoAssembly *requesting, gboolean refonly, gboolean postload);
 static MonoAssembly*
@@ -211,6 +213,9 @@ mono_assembly_load_full_internal (MonoAssemblyName *aname, MonoAssembly *request
 static MonoBoolean
 mono_assembly_is_in_gac (const gchar *filanem);
 
+static MonoAssembly*
+prevent_reference_assembly_from_running (MonoAssembly* candidate, gboolean refonly);
+
 static gchar*
 encode_public_tok (const guchar *token, gint32 len)
 {
@@ -556,6 +561,21 @@ mono_assembly_getrootdir (void)
        return default_path [0];
 }
 
+/**
+ * mono_native_getrootdir:
+ * 
+ * Obtains the root directory used for looking up native libs (.so, .dylib).
+ *
+ * Returns: a string with the directory, this string should be freed by
+ * the caller.
+ */
+gchar *
+mono_native_getrootdir (void)
+{
+       gchar* fullpath = g_build_path (G_DIR_SEPARATOR_S, mono_assembly_getrootdir (), mono_config_get_reloc_lib_dir(), NULL);
+       return fullpath;
+}
+
 /**
  * mono_set_dirs:
  * @assembly_dir: the base directory for assemblies
@@ -1190,6 +1210,7 @@ mono_assembly_load_reference (MonoImage *image, int index)
                                   aname.major, aname.minor, aname.build, aname.revision,
                                   strlen ((char*)aname.public_key_token) == 0 ? "(none)" : (char*)aname.public_key_token, extra_msg);
                g_free (extra_msg);
+
        }
 
        mono_assemblies_lock ();
@@ -1544,8 +1565,9 @@ mono_assembly_open_from_bundle (const char *filename, MonoImageOpenStatus *statu
 {
        int i;
        char *name;
+       gchar *lowercase_filename;
        MonoImage *image = NULL;
-
+       gboolean is_satellite = FALSE;
        /*
         * we do a very simple search for bundled assemblies: it's not a general 
         * purpose assembly loading mechanism.
@@ -1554,11 +1576,13 @@ mono_assembly_open_from_bundle (const char *filename, MonoImageOpenStatus *statu
        if (!bundles)
                return NULL;
 
+       lowercase_filename = g_utf8_strdown (filename, -1);
+       is_satellite = g_str_has_suffix (lowercase_filename, ".resources.dll");
+       g_free (lowercase_filename);
        name = g_path_get_basename (filename);
-
        mono_assemblies_lock ();
        for (i = 0; !image && bundles [i]; ++i) {
-               if (strcmp (bundles [i]->name, name) == 0) {
+               if (strcmp (bundles [i]->name, is_satellite ? filename : name) == 0) {
                        image = mono_image_open_from_data_with_name ((char*)bundles [i]->data, bundles [i]->size, FALSE, status, refonly, name);
                        break;
                }
@@ -1566,7 +1590,7 @@ mono_assembly_open_from_bundle (const char *filename, MonoImageOpenStatus *statu
        mono_assemblies_unlock ();
        if (image) {
                mono_image_addref (image);
-               mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_ASSEMBLY, "Assembly Loader loaded assembly from bundle: '%s'.", name);
+               mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_ASSEMBLY, "Assembly Loader loaded assembly from bundle: '%s'.", is_satellite ? filename : name);
                g_free (name);
                return image;
        }
@@ -1743,7 +1767,7 @@ mono_assembly_load_friends (MonoAssembly* ass)
        if (ass->friend_assembly_names_inited)
                return;
 
-       attrs = mono_custom_attrs_from_assembly_checked (ass, &error);
+       attrs = mono_custom_attrs_from_assembly_checked (ass, FALSE, &error);
        mono_error_assert_ok (&error);
        if (!attrs) {
                mono_assemblies_lock ();
@@ -1803,6 +1827,50 @@ mono_assembly_load_friends (MonoAssembly* ass)
        mono_assemblies_unlock ();
 }
 
+struct HasReferenceAssemblyAttributeIterData {
+       gboolean has_attr;
+};
+
+static gboolean
+has_reference_assembly_attribute_iterator (MonoImage *image, guint32 typeref_scope_token, const char *nspace, const char *name, guint32 method_token, gpointer user_data)
+{
+       gboolean stop_scanning = FALSE;
+       struct HasReferenceAssemblyAttributeIterData *iter_data = (struct HasReferenceAssemblyAttributeIterData*)user_data;
+
+       if (!strcmp (name, "ReferenceAssemblyAttribute") && !strcmp (nspace, "System.Runtime.CompilerServices")) {
+               /* Note we don't check the assembly name, same as coreCLR. */
+               iter_data->has_attr = TRUE;
+               stop_scanning = TRUE;
+       }
+
+       return stop_scanning;
+}
+
+/**
+ * mono_assembly_has_reference_assembly_attribute:
+ * @assembly: a MonoAssembly
+ * @error: set on error.
+ *
+ * Returns TRUE if @assembly has the System.Runtime.CompilerServices.ReferenceAssemblyAttribute set.
+ * On error returns FALSE and sets @error.
+ */
+gboolean
+mono_assembly_has_reference_assembly_attribute (MonoAssembly *assembly, MonoError *error)
+{
+       mono_error_init (error);
+
+       /*
+        * This might be called during assembly loading, so do everything using the low-level
+        * metadata APIs.
+        */
+
+       struct HasReferenceAssemblyAttributeIterData iter_data = { FALSE };
+
+       mono_assembly_metadata_foreach_custom_attr (assembly, &has_reference_assembly_attribute_iterator, &iter_data);
+
+       return iter_data.has_attr;
+}
+
 /**
  * mono_assembly_open:
  * @filename: Opens the assembly pointed out by this name
@@ -1922,10 +1990,30 @@ mono_assembly_load_from_full (MonoImage *image, const char*fname,
                }
        }
 
+       /* We need to check for ReferenceAssmeblyAttribute before we
+        * mark the assembly as loaded and before we fire the load
+        * hook. Otherwise mono_domain_fire_assembly_load () in
+        * appdomain.c will cache a mapping from the assembly name to
+        * this image and we won't be able to look for a different
+        * candidate. */
+
+       if (!refonly) {
+               MonoError refasm_error;
+               if (mono_assembly_has_reference_assembly_attribute (ass, &refasm_error)) {
+                       mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_ASSEMBLY, "Image for assembly '%s' (%s) has ReferenceAssemblyAttribute, skipping", ass->aname.name, image->name);
+                       g_free (ass);
+                       g_free (base_dir);
+                       mono_image_close (image);
+                       *status = MONO_IMAGE_IMAGE_INVALID;
+                       return NULL;
+               }
+               mono_error_cleanup (&refasm_error);
+       }
+
        mono_assemblies_lock ();
 
        if (image->assembly) {
-               /* 
+               /*
                 * This means another thread has already loaded the assembly, but not yet
                 * called the load hooks so the search hook can't find the assembly.
                 */
@@ -1938,6 +2026,8 @@ mono_assembly_load_from_full (MonoImage *image, const char*fname,
                return ass2;
        }
 
+       mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_ASSEMBLY, "Prepared to set up assembly '%s' (%s)", ass->aname.name, image->name);
+
        image->assembly = ass;
 
        loaded_assemblies = g_list_prepend (loaded_assemblies, ass);
@@ -2306,11 +2396,11 @@ mono_assembly_name_parse_full (const char *name, MonoAssemblyName *aname, gboole
                        if (!g_ascii_strcasecmp (retargetable, "yes")) {
                                flags |= ASSEMBLYREF_RETARGETABLE_FLAG;
                        } else if (g_ascii_strcasecmp (retargetable, "no")) {
-                               free (retargetable_uq);
+                               g_free (retargetable_uq);
                                goto cleanup_and_fail;
                        }
 
-                       free (retargetable_uq);
+                       g_free (retargetable_uq);
                        tmp++;
                        continue;
                }
@@ -2330,11 +2420,11 @@ mono_assembly_name_parse_full (const char *name, MonoAssemblyName *aname, gboole
                        else if (!g_ascii_strcasecmp (procarch, "AMD64"))
                                arch = MONO_PROCESSOR_ARCHITECTURE_AMD64;
                        else {
-                               free (procarch_uq);
+                               g_free (procarch_uq);
                                goto cleanup_and_fail;
                        }
 
-                       free (procarch_uq);
+                       g_free (procarch_uq);
                        tmp++;
                        continue;
                }
@@ -2362,11 +2452,11 @@ mono_assembly_name_parse_full (const char *name, MonoAssemblyName *aname, gboole
                key_uq == NULL ? key : key_uq,
                flags, arch, aname, save_public_key);
 
-       free (dllname_uq);
-       free (version_uq);
-       free (culture_uq);
-       free (token_uq);
-       free (key_uq);
+       g_free (dllname_uq);
+       g_free (version_uq);
+       g_free (culture_uq);
+       g_free (token_uq);
+       g_free (key_uq);
 
        g_strfreev (parts);
        return res;
@@ -3141,6 +3231,19 @@ return_corlib_and_facades:
        return corlib;
 }
 
+static MonoAssembly*
+prevent_reference_assembly_from_running (MonoAssembly* candidate, gboolean refonly)
+{
+       MonoError refasm_error;
+       mono_error_init (&refasm_error);
+       if (candidate && !refonly && mono_assembly_has_reference_assembly_attribute (candidate, &refasm_error)) {
+               candidate = NULL;
+       }
+       mono_error_cleanup (&refasm_error);
+       return candidate;
+}
+
+
 MonoAssembly*
 mono_assembly_load_full_nosearch (MonoAssemblyName *aname, 
                                                                  const char       *basedir, 
@@ -3222,9 +3325,11 @@ mono_assembly_load_full_internal (MonoAssemblyName *aname, MonoAssembly *request
 {
        MonoAssembly *result = mono_assembly_load_full_nosearch (aname, basedir, status, refonly);
 
-       if (!result)
+       if (!result) {
                /* Try a postload search hook */
                result = mono_assembly_invoke_search_hook_internal (aname, requesting, refonly, TRUE);
+               result = prevent_reference_assembly_from_running (result, refonly);
+       }
        return result;
 }
 
@@ -3398,9 +3503,19 @@ mono_assembly_close (MonoAssembly *assembly)
 MonoImage*
 mono_assembly_load_module (MonoAssembly *assembly, guint32 idx)
 {
-       return mono_image_load_file_for_image (assembly->image, idx);
+       MonoError error;
+       MonoImage *result = mono_assembly_load_module_checked (assembly, idx, &error);
+       mono_error_assert_ok (&error);
+       return result;
 }
 
+MONO_API MonoImage*
+mono_assembly_load_module_checked (MonoAssembly *assembly, uint32_t idx, MonoError *error)
+{
+       return mono_image_load_file_for_image_checked (assembly->image, idx, error);
+}
+
+
 /**
  * mono_assembly_foreach:
  * @func: function to invoke for each assembly loaded
index bdf3d75f62cad49400ac2545f601d00fbfdef79f..0cde65a2b5b1d244f5ae0e5818ee303180332e75 100644 (file)
@@ -1,6 +1,7 @@
 #ifndef _MONONET_METADATA_ASSEMBLY_H_ 
 #define _MONONET_METADATA_ASSEMBLY_H_
 
+#include <mono/utils/mono-error.h>
 #include <mono/metadata/image.h>
 
 MONO_BEGIN_DECLS
@@ -32,11 +33,12 @@ MONO_API MonoAssembly* mono_assembly_loaded_full (MonoAssemblyName *aname, mono_
 MONO_API void          mono_assembly_get_assemblyref (MonoImage *image, int index, MonoAssemblyName *aname);
 MONO_API void          mono_assembly_load_reference (MonoImage *image, int index);
 MONO_API void          mono_assembly_load_references (MonoImage *image, MonoImageOpenStatus *status);
-MONO_API MonoImage*    mono_assembly_load_module (MonoAssembly *assembly, uint32_t idx);
+MONO_RT_EXTERNAL_ONLY MONO_API MonoImage*    mono_assembly_load_module (MonoAssembly *assembly, uint32_t idx);
 MONO_API void          mono_assembly_close      (MonoAssembly *assembly);
 MONO_API void          mono_assembly_setrootdir (const char *root_dir);
 MONO_API MONO_CONST_RETURN char *mono_assembly_getrootdir (void);
-MONO_API void        mono_assembly_foreach    (MonoFunc func, void* user_data);
+MONO_API char         *mono_native_getrootdir (void);
+MONO_API void         mono_assembly_foreach    (MonoFunc func, void* user_data);
 MONO_API void          mono_assembly_set_main   (MonoAssembly *assembly);
 MONO_API MonoAssembly *mono_assembly_get_main   (void);
 MONO_API MonoImage    *mono_assembly_get_image  (MonoAssembly *assembly);
index 4372397aa5740f6fae868ffabf4ce2ce6bea96de..2c4372ba4b493fed8b441d6704c31c88a713da4c 100644 (file)
@@ -94,7 +94,7 @@ static char *ipc_filename;
 
 static char *server_uri;
 
-static HANDLE receiver_thread_handle;
+static MonoThreadHandle *receiver_thread_handle;
 
 static gboolean stop_receiver_thread;
 
@@ -260,7 +260,7 @@ mono_attach_cleanup (void)
 
        /* Wait for the receiver thread to exit */
        if (receiver_thread_handle)
-               WaitForSingleObjectEx (receiver_thread_handle, 0, FALSE);
+               mono_thread_info_wait_one_handle (receiver_thread_handle, 0, FALSE);
 }
 
 static int
@@ -475,17 +475,12 @@ transport_send (int fd, guint8 *data, int len)
 static void
 transport_start_receive (void)
 {
-       MonoThreadParm tp;
-
        transport_connect ();
 
        if (!listen_fd)
                return;
 
-       tp.priority = MONO_THREAD_PRIORITY_NORMAL;
-       tp.stack_size = 0;
-       tp.creation_flags = 0;
-       receiver_thread_handle = mono_threads_create_thread (receiver_thread, NULL, &tp, NULL);
+       receiver_thread_handle = mono_threads_create_thread (receiver_thread, NULL, NULL, NULL);
        g_assert (receiver_thread_handle);
 }
 
index 41510b486e88139695f0f0109332effe0b59557f..aed903cc6a91b1f7db483af69afb4c1f19a47eae 100644 (file)
@@ -22,6 +22,7 @@
 #include <mono/metadata/metadata-internals.h>
 #include <mono/metadata/marshal.h>
 #include <mono/metadata/runtime.h>
+#include <mono/metadata/handle.h>
 #include <mono/metadata/sgen-toggleref.h>
 #include <mono/utils/atomic.h>
 #include <mono/utils/mono-logger-internals.h>
@@ -32,6 +33,7 @@
 #include <mono/utils/gc_wrapper.h>
 #include <mono/utils/mono-os-mutex.h>
 #include <mono/utils/mono-counters.h>
+#include <mono/utils/mono-compiler.h>
 
 #if HAVE_BOEHM_GC
 
@@ -57,6 +59,8 @@ boehm_thread_register (MonoThreadInfo* info, void *baseptr);
 static void
 boehm_thread_unregister (MonoThreadInfo *p);
 static void
+boehm_thread_detach (MonoThreadInfo *p);
+static void
 register_test_toggleref_callback (void);
 
 #define BOEHM_GC_BIT_FINALIZER_AWARE 1
@@ -96,6 +100,9 @@ mono_gc_warning (char *msg, GC_word arg)
        mono_trace (G_LOG_LEVEL_WARNING, MONO_TRACE_GC, msg, (unsigned long)arg);
 }
 
+static void on_gc_notification (GC_EventType event);
+static void on_gc_heap_resize (size_t new_size);
+
 void
 mono_gc_base_init (void)
 {
@@ -108,6 +115,10 @@ mono_gc_base_init (void)
 
        mono_counters_init ();
 
+#ifndef HOST_WIN32
+       mono_w32handle_init ();
+#endif
+
        /*
         * Handle the case when we are called from a thread different from the main thread,
         * confusing libgc.
@@ -235,6 +246,7 @@ mono_gc_base_init (void)
        memset (&cb, 0, sizeof (cb));
        cb.thread_register = boehm_thread_register;
        cb.thread_unregister = boehm_thread_unregister;
+       cb.thread_detach = boehm_thread_detach;
        cb.mono_method_is_critical = (gboolean (*)(void *))mono_runtime_is_critical_method;
 
        mono_threads_init (&cb, sizeof (MonoThreadInfo));
@@ -243,7 +255,8 @@ mono_gc_base_init (void)
 
        mono_thread_info_attach (&dummy);
 
-       mono_gc_enable_events ();
+       GC_set_on_collection_event (on_gc_notification);
+       GC_on_heap_resize = on_gc_heap_resize;
 
        MONO_GC_REGISTER_ROOT_FIXED (gc_handles [HANDLE_NORMAL].entries, MONO_ROOT_SOURCE_GC_HANDLE, "gc handles table");
        MONO_GC_REGISTER_ROOT_FIXED (gc_handles [HANDLE_PINNED].entries, MONO_ROOT_SOURCE_GC_HANDLE, "gc handles table");
@@ -388,6 +401,9 @@ boehm_thread_register (MonoThreadInfo* info, void *baseptr)
        res = GC_register_my_thread (&sb);
        if (res == GC_UNIMPLEMENTED)
            return NULL; /* Cannot happen with GC v7+. */
+
+       info->handle_stack = mono_handle_stack_alloc ();
+
        return info;
 }
 
@@ -402,6 +418,13 @@ boehm_thread_unregister (MonoThreadInfo *p)
                mono_threads_add_joinable_thread ((gpointer)tid);
 }
 
+static void
+boehm_thread_detach (MonoThreadInfo *p)
+{
+       if (mono_thread_internal_current_is_attached ())
+               mono_thread_detach_internal (mono_thread_internal_current ());
+}
+
 gboolean
 mono_object_is_alive (MonoObject* o)
 {
@@ -424,7 +447,6 @@ on_gc_notification (GC_EventType event)
        switch (e) {
        case MONO_GC_EVENT_PRE_STOP_WORLD:
                MONO_GC_WORLD_STOP_BEGIN ();
-               mono_thread_info_suspend_lock ();
                break;
 
        case MONO_GC_EVENT_POST_STOP_WORLD:
@@ -437,7 +459,6 @@ on_gc_notification (GC_EventType event)
 
        case MONO_GC_EVENT_POST_START_WORLD:
                MONO_GC_WORLD_RESTART_END (1);
-               mono_thread_info_suspend_unlock ();
                break;
 
        case MONO_GC_EVENT_START:
@@ -477,7 +498,21 @@ on_gc_notification (GC_EventType event)
        }
 
        mono_profiler_gc_event (e, 0);
+
+       switch (e) {
+       case MONO_GC_EVENT_PRE_STOP_WORLD:
+               mono_thread_info_suspend_lock ();
+               mono_profiler_gc_event (MONO_GC_EVENT_PRE_STOP_WORLD_LOCKED, 0);
+               break;
+       case MONO_GC_EVENT_POST_START_WORLD:
+               mono_thread_info_suspend_unlock ();
+               mono_profiler_gc_event (MONO_GC_EVENT_POST_START_WORLD_UNLOCKED, 0);
+               break;
+       default:
+               break;
+       }
 }
+
  
 static void
 on_gc_heap_resize (size_t new_size)
@@ -493,21 +528,6 @@ on_gc_heap_resize (size_t new_size)
        mono_profiler_gc_heap_resize (new_size);
 }
 
-void
-mono_gc_enable_events (void)
-{
-       GC_set_on_collection_event (on_gc_notification);
-       GC_on_heap_resize = on_gc_heap_resize;
-}
-
-static gboolean alloc_events = FALSE;
-
-void
-mono_gc_enable_alloc_events (void)
-{
-       alloc_events = TRUE;
-}
-
 int
 mono_gc_register_root (char *start, size_t size, void *descr, MonoGCRootSource source, const char *msg)
 {
@@ -649,7 +669,7 @@ mono_gc_alloc_obj (MonoVTable *vtable, size_t size)
                obj->vtable = vtable;
        }
 
-       if (G_UNLIKELY (alloc_events))
+       if (G_UNLIKELY (mono_profiler_events & MONO_PROFILE_ALLOCATIONS))
                mono_profiler_allocation (obj);
 
        return obj;
@@ -683,7 +703,7 @@ mono_gc_alloc_vector (MonoVTable *vtable, size_t size, uintptr_t max_length)
 
        obj->max_length = max_length;
 
-       if (G_UNLIKELY (alloc_events))
+       if (G_UNLIKELY (mono_profiler_events & MONO_PROFILE_ALLOCATIONS))
                mono_profiler_allocation (&obj->obj);
 
        return obj;
@@ -720,7 +740,7 @@ mono_gc_alloc_array (MonoVTable *vtable, size_t size, uintptr_t max_length, uint
        if (bounds_size)
                obj->bounds = (MonoArrayBounds *) ((char *) obj + size - bounds_size);
 
-       if (G_UNLIKELY (alloc_events))
+       if (G_UNLIKELY (mono_profiler_events & MONO_PROFILE_ALLOCATIONS))
                mono_profiler_allocation (&obj->obj);
 
        return obj;
@@ -738,7 +758,7 @@ mono_gc_alloc_string (MonoVTable *vtable, size_t size, gint32 len)
        obj->length = len;
        obj->chars [len] = 0;
 
-       if (G_UNLIKELY (alloc_events))
+       if (G_UNLIKELY (mono_profiler_events & MONO_PROFILE_ALLOCATIONS))
                mono_profiler_allocation (&obj->object);
 
        return obj;
@@ -769,7 +789,7 @@ mono_gc_invoke_finalizers (void)
        return 0;
 }
 
-gboolean
+MonoBoolean
 mono_gc_pending_finalizers (void)
 {
        return GC_should_invoke_finalizers ();
@@ -1096,7 +1116,7 @@ create_allocator (int atype, int tls_key, gboolean slowpath)
 static MonoMethod* alloc_method_cache [ATYPE_NUM];
 static MonoMethod* slowpath_alloc_method_cache [ATYPE_NUM];
 
-static G_GNUC_UNUSED gboolean
+gboolean
 mono_gc_is_critical_method (MonoMethod *method)
 {
        int i;
@@ -1215,7 +1235,7 @@ mono_gc_get_write_barrier (void)
 
 #else
 
-static G_GNUC_UNUSED gboolean
+gboolean
 mono_gc_is_critical_method (MonoMethod *method)
 {
        return FALSE;
@@ -1333,11 +1353,6 @@ mono_gc_get_nursery (int *shift_bits, size_t *size)
        return NULL;
 }
 
-void
-mono_gc_set_current_thread_appdomain (MonoDomain *domain)
-{
-}
-
 gboolean
 mono_gc_precise_stack_mark_enabled (void)
 {
@@ -1350,6 +1365,16 @@ mono_gc_get_logfile (void)
        return NULL;
 }
 
+void
+mono_gc_params_set (const char* options)
+{
+}
+
+void
+mono_gc_debug_set (const char* options)
+{
+}
+
 void
 mono_gc_conservatively_scan_area (void *start, void *end)
 {
@@ -1912,5 +1937,7 @@ mono_gchandle_free_domain (MonoDomain *domain)
        }
 
 }
+#else
 
+MONO_EMPTY_SOURCE_FILE (boehm_gc);
 #endif /* no Boehm GC */
diff --git a/mono/metadata/class-accessors.c b/mono/metadata/class-accessors.c
new file mode 100644 (file)
index 0000000..1ea2597
--- /dev/null
@@ -0,0 +1,285 @@
+/*
+ * Copyright 2016 Microsoft
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
+ */
+#include <mono/metadata/class-internals.h>
+#include <mono/metadata/tabledefs.h>
+
+
+enum InfrequentDataKind {
+       PROP_MARSHAL_INFO = 1, /* MonoMarshalType */
+       PROP_EXT = 2, /* MonoClassExt */
+       PROP_REF_INFO_HANDLE = 3, /* gchandle */
+};
+
+/* Accessors based on class kind*/
+
+/*
+* mono_class_get_generic_class:
+*
+*   Return the MonoGenericClass of @klass, which MUST be a generic instance.
+*/
+MonoGenericClass*
+mono_class_get_generic_class (MonoClass *klass)
+{
+       g_assert (mono_class_is_ginst (klass));
+       return ((MonoClassGenericInst*)klass)->generic_class;
+}
+
+/*
+* mono_class_try_get_generic_class:
+*
+*   Return the MonoGenericClass if @klass is a ginst, NULL otherwise
+*/
+MonoGenericClass*
+mono_class_try_get_generic_class (MonoClass *klass)
+{
+       if (mono_class_is_ginst (klass))
+               return ((MonoClassGenericInst*)klass)->generic_class;
+       return NULL;
+}
+
+/**
+ * mono_class_get_flags:
+ * @klass: the MonoClass to act on
+ *
+ * Return the TypeAttributes flags of @klass.
+ * See the TYPE_ATTRIBUTE_* definitions on tabledefs.h for the different values.
+ *
+ * Returns: The type flags
+ */
+guint32
+mono_class_get_flags (MonoClass *klass)
+{
+       switch (klass->class_kind) {
+       case MONO_CLASS_DEF:
+       case MONO_CLASS_GTD:
+               return ((MonoClassDef*)klass)->flags;
+       case MONO_CLASS_GINST:
+               return mono_class_get_flags (((MonoClassGenericInst*)klass)->generic_class->container_class);
+       case MONO_CLASS_GPARAM:
+               return TYPE_ATTRIBUTE_PUBLIC;
+       case MONO_CLASS_ARRAY:
+               /* all arrays are marked serializable and sealed, bug #42779 */
+               return TYPE_ATTRIBUTE_CLASS | TYPE_ATTRIBUTE_SERIALIZABLE | TYPE_ATTRIBUTE_SEALED | TYPE_ATTRIBUTE_PUBLIC;
+       case MONO_CLASS_POINTER:
+               return TYPE_ATTRIBUTE_CLASS | (mono_class_get_flags (klass->element_class) & TYPE_ATTRIBUTE_VISIBILITY_MASK);
+       }
+       g_assert_not_reached ();
+}
+
+void
+mono_class_set_flags (MonoClass *klass, guint32 flags)
+{
+       g_assert (klass->class_kind == MONO_CLASS_DEF || klass->class_kind == MONO_CLASS_GTD);
+       ((MonoClassDef*)klass)->flags = flags;
+}
+
+/*
+ * mono_class_get_generic_container:
+ *
+ *   Return the generic container of KLASS which should be a generic type definition.
+ */
+MonoGenericContainer*
+mono_class_get_generic_container (MonoClass *klass)
+{
+       g_assert (mono_class_is_gtd (klass));
+
+       return ((MonoClassGtd*)klass)->generic_container;
+}
+
+MonoGenericContainer*
+mono_class_try_get_generic_container (MonoClass *klass)
+{
+       if (mono_class_is_gtd (klass))
+               return ((MonoClassGtd*)klass)->generic_container;
+       return NULL;
+}
+
+
+void
+mono_class_set_generic_container (MonoClass *klass, MonoGenericContainer *container)
+{
+       g_assert (mono_class_is_gtd (klass));
+
+       ((MonoClassGtd*)klass)->generic_container = container;
+}
+
+/*
+ * mono_class_get_first_method_idx:
+ *
+ *   Return the table index of the first method for metadata classes.
+ */
+guint32
+mono_class_get_first_method_idx (MonoClass *klass)
+{
+       g_assert (mono_class_has_static_metadata (klass));
+
+       return ((MonoClassDef*)klass)->first_method_idx;
+}
+
+void
+mono_class_set_first_method_idx (MonoClass *klass, guint32 idx)
+{
+       g_assert (mono_class_has_static_metadata (klass));
+
+       ((MonoClassDef*)klass)->first_method_idx = idx;
+}
+
+guint32
+mono_class_get_first_field_idx (MonoClass *klass)
+{
+       if (mono_class_is_ginst (klass))
+               return mono_class_get_first_field_idx (mono_class_get_generic_class (klass)->container_class);
+
+       g_assert (mono_class_has_static_metadata (klass));
+
+       return ((MonoClassDef*)klass)->first_field_idx;
+}
+
+void
+mono_class_set_first_field_idx (MonoClass *klass, guint32 idx)
+{
+       g_assert (mono_class_has_static_metadata (klass));
+
+       ((MonoClassDef*)klass)->first_field_idx = idx;
+}
+
+guint32
+mono_class_get_method_count (MonoClass *klass)
+{
+       switch (klass->class_kind) {
+       case MONO_CLASS_DEF:
+       case MONO_CLASS_GTD:
+               return ((MonoClassDef*)klass)->method_count;
+       case MONO_CLASS_GINST:
+               return mono_class_get_method_count (((MonoClassGenericInst*)klass)->generic_class->container_class);
+       case MONO_CLASS_GPARAM:
+               return 0;
+       case MONO_CLASS_ARRAY:
+               return ((MonoClassArray*)klass)->method_count;
+       case MONO_CLASS_POINTER:
+               return 0;
+       default:
+               g_assert_not_reached ();
+               return 0;
+       }
+}
+
+void
+mono_class_set_method_count (MonoClass *klass, guint32 count)
+{
+       switch (klass->class_kind) {
+       case MONO_CLASS_DEF:
+       case MONO_CLASS_GTD:
+               ((MonoClassDef*)klass)->method_count = count;
+               break;
+       case MONO_CLASS_GINST:
+               break;
+       case MONO_CLASS_GPARAM:
+       case MONO_CLASS_POINTER:
+               g_assert (count == 0);
+               break;
+       case MONO_CLASS_ARRAY:
+               ((MonoClassArray*)klass)->method_count = count;
+               break;
+       default:
+               g_assert_not_reached ();
+               break;
+       }
+}
+
+guint32
+mono_class_get_field_count (MonoClass *klass)
+{
+       switch (klass->class_kind) {
+       case MONO_CLASS_DEF:
+       case MONO_CLASS_GTD:
+               return ((MonoClassDef*)klass)->field_count;
+       case MONO_CLASS_GINST:
+               return mono_class_get_field_count (((MonoClassGenericInst*)klass)->generic_class->container_class);
+       case MONO_CLASS_GPARAM:
+       case MONO_CLASS_ARRAY:
+       case MONO_CLASS_POINTER:
+               return 0;
+       default:
+               g_assert_not_reached ();
+               return 0;
+       }
+}
+
+void
+mono_class_set_field_count (MonoClass *klass, guint32 count)
+{
+       switch (klass->class_kind) {
+       case MONO_CLASS_DEF:
+       case MONO_CLASS_GTD:
+               ((MonoClassDef*)klass)->field_count = count;
+               break;
+       case MONO_CLASS_GINST:
+               break;
+       case MONO_CLASS_GPARAM:
+       case MONO_CLASS_ARRAY:
+       case MONO_CLASS_POINTER:
+               g_assert (count == 0);
+               break;
+       default:
+               g_assert_not_reached ();
+               break;
+       }
+}
+
+MonoMarshalType*
+mono_class_get_marshal_info (MonoClass *class)
+{
+       return mono_property_bag_get (&class->infrequent_data, PROP_MARSHAL_INFO);
+}
+
+void
+mono_class_set_marshal_info (MonoClass *class, MonoMarshalType *marshal_info)
+{
+       marshal_info->head.tag = PROP_MARSHAL_INFO;
+       mono_property_bag_add (&class->infrequent_data, marshal_info);
+}
+
+MonoClassExt*
+mono_class_get_ext (MonoClass *class)
+{
+       return mono_property_bag_get (&class->infrequent_data, PROP_EXT);
+}
+
+void
+mono_class_set_ext (MonoClass *class, MonoClassExt *ext)
+{
+       ext->head.tag = PROP_EXT;
+       mono_property_bag_add (&class->infrequent_data, ext);
+}
+
+typedef struct {
+       MonoPropertyBagItem head;
+       guint32 value;
+} Uint32Property;
+
+guint32
+mono_class_get_ref_info_handle (MonoClass *class)
+{
+       Uint32Property *prop = mono_property_bag_get (&class->infrequent_data, PROP_REF_INFO_HANDLE);
+       return prop ? prop->value : 0;
+}
+
+guint32
+mono_class_set_ref_info_handle (MonoClass *class, guint32 value)
+{
+       if (!value) {
+               Uint32Property *prop = mono_property_bag_get (&class->infrequent_data, PROP_REF_INFO_HANDLE);
+               if (prop)
+                       prop->value = 0;
+               return 0;
+       }
+
+       Uint32Property *prop = mono_class_alloc (class, sizeof (Uint32Property));
+       prop->head.tag = PROP_REF_INFO_HANDLE;
+       prop->value = value;
+       prop = mono_property_bag_add (&class->infrequent_data, prop);
+       return prop->value;
+}
diff --git a/mono/metadata/class-inlines.h b/mono/metadata/class-inlines.h
new file mode 100644 (file)
index 0000000..2e884ba
--- /dev/null
@@ -0,0 +1,95 @@
+/*
+ * Copyright 2016 Microsoft
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
+ */
+#ifndef __MONO_METADATA_CLASS_INLINES_H__
+#define __MONO_METADATA_CLASS_INLINES_H__
+
+#include <mono/metadata/class-internals.h>
+#include <mono/metadata/tabledefs.h>
+
+static inline gboolean
+mono_class_is_def (MonoClass *klass)
+{
+       return klass->class_kind == MONO_CLASS_DEF;
+}
+
+static inline gboolean
+mono_class_is_gtd (MonoClass *klass)
+{
+       return klass->class_kind == MONO_CLASS_GTD;
+}
+
+static inline gboolean
+mono_class_is_ginst (MonoClass *klass)
+{
+       return klass->class_kind == MONO_CLASS_GINST;
+}
+
+static inline gboolean
+mono_class_is_gparam (MonoClass *klass)
+{
+       return klass->class_kind == MONO_CLASS_GPARAM;
+}
+
+static inline gboolean
+mono_class_is_array (MonoClass *klass)
+{
+       return klass->class_kind == MONO_CLASS_ARRAY;
+}
+
+static inline gboolean
+mono_class_is_pointer (MonoClass *klass)
+{
+       return klass->class_kind == MONO_CLASS_POINTER;
+}
+
+static inline gboolean
+mono_class_is_abstract (MonoClass *klass)
+{
+       return mono_class_get_flags (klass) & TYPE_ATTRIBUTE_ABSTRACT;
+}
+
+static inline gboolean
+mono_class_is_interface (MonoClass *klass)
+{
+       return mono_class_get_flags (klass) & TYPE_ATTRIBUTE_INTERFACE;
+}
+
+static inline gboolean
+mono_class_is_sealed (MonoClass *klass)
+{
+       return mono_class_get_flags (klass) & TYPE_ATTRIBUTE_SEALED;
+}
+
+static inline gboolean
+mono_class_is_before_field_init (MonoClass *klass)
+{
+       return mono_class_get_flags (klass) & TYPE_ATTRIBUTE_BEFORE_FIELD_INIT;
+}
+
+static inline gboolean
+mono_class_is_auto_layout (MonoClass *klass)
+{
+       return (mono_class_get_flags (klass) & TYPE_ATTRIBUTE_LAYOUT_MASK) == TYPE_ATTRIBUTE_AUTO_LAYOUT;
+}
+
+static inline gboolean
+mono_class_is_explicit_layout (MonoClass *klass)
+{
+       return (mono_class_get_flags (klass) & TYPE_ATTRIBUTE_LAYOUT_MASK) == TYPE_ATTRIBUTE_EXPLICIT_LAYOUT;
+}
+
+static inline gboolean
+mono_class_is_public (MonoClass *klass)
+{
+       return mono_class_get_flags (klass) & TYPE_ATTRIBUTE_PUBLIC;
+}
+
+static inline gboolean
+mono_class_has_static_metadata (MonoClass *klass)
+{
+       return klass->type_token && !klass->image->dynamic && !mono_class_is_ginst (klass);
+}
+
+#endif
index f51c979a50fab8ab5d230010e483867b188a7ed5..40a8780dbbdd228d24efcaba92c53aa823c47779 100644 (file)
@@ -9,6 +9,7 @@
 #include <mono/metadata/object.h>
 #include <mono/metadata/mempool.h>
 #include <mono/metadata/metadata-internals.h>
+#include <mono/metadata/property-bag.h>
 #include <mono/io-layer/io-layer.h>
 #include "mono/utils/mono-compiler.h"
 #include "mono/utils/mono-error.h"
@@ -16,7 +17,7 @@
 
 #define MONO_CLASS_IS_ARRAY(c) ((c)->rank)
 
-#define MONO_CLASS_HAS_STATIC_METADATA(klass) ((klass)->type_token && !(klass)->image->dynamic && !(klass)->generic_class)
+#define MONO_CLASS_HAS_STATIC_METADATA(klass) ((klass)->type_token && !(klass)->image->dynamic && !mono_class_is_ginst (klass))
 
 #define MONO_DEFAULT_SUPERTABLE_SIZE 6
 
@@ -164,6 +165,8 @@ typedef struct {
 } MonoMarshalField;
 
 typedef struct {
+       MonoPropertyBagItem head;
+
        guint32 native_size, min_align;
        guint32 num_fields;
        MonoMethod *ptr_to_str;
@@ -194,7 +197,7 @@ struct _MonoEvent {
 };
 
 /* type of exception being "on hold" for later processing (see exception_type) */
-enum {
+typedef enum {
        MONO_EXCEPTION_NONE = 0,
        MONO_EXCEPTION_INVALID_PROGRAM = 3,
        MONO_EXCEPTION_UNVERIFIABLE_IL = 4,
@@ -211,7 +214,7 @@ enum {
        MONO_EXCEPTION_INLINE_FAILED = 15,
        MONO_EXCEPTION_MONO_ERROR = 16,
        /* add other exception type */
-};
+} MonoExceptionType;
 
 /* This struct collects the info needed for the runtime use of a class,
  * like the vtables for a domain, the GC descriptor, etc.
@@ -232,6 +235,8 @@ typedef struct {
  * be used for fields which are only used in like 5% of all classes.
  */
 typedef struct {
+       MonoPropertyBagItem head;
+
        struct {
 #if MONO_SMALL_CONFIG
                guint16 first, count;
@@ -256,6 +261,15 @@ typedef struct {
        GList      *nested_classes;
 } MonoClassExt;
 
+typedef enum {
+       MONO_CLASS_DEF = 1, /* non-generic type */
+       MONO_CLASS_GTD, /* generic type definition */
+       MONO_CLASS_GINST, /* generic instantiation */
+       MONO_CLASS_GPARAM, /* generic parameter */
+       MONO_CLASS_ARRAY, /* vector or array, bounded or not */
+       MONO_CLASS_POINTER, /* pointer of function pointer*/
+} MonoTypeKind;
+
 struct _MonoClass {
        /* element class for arrays and enum basetype for enums */
        MonoClass *element_class; 
@@ -272,8 +286,6 @@ struct _MonoClass {
        int        instance_size; /* object instance size */
 
        guint inited          : 1;
-       /* We use init_pending to detect cyclic calls to mono_class_init */
-       guint init_pending    : 1;
 
        /* A class contains static and non static data. Static data can be
         * of the same type as the class itselfs, but it does not influence
@@ -317,19 +329,12 @@ struct _MonoClass {
        guint nested_classes_inited : 1; /* Whenever nested_class is initialized */
 
        /* next byte*/
+       guint class_kind : 3; /* One of the values from MonoTypeKind */
        guint interfaces_inited : 1; /* interfaces is initialized */
        guint simd_type : 1; /* class is a simd intrinsic type */
-       guint is_generic : 1; /* class is a generic type definition */
-       guint is_inflated : 1; /* class is a generic instance */
        guint has_finalize_inited    : 1; /* has_finalize is initialized */
-       guint fields_inited : 1; /* fields is initialized */
-       guint setup_fields_called : 1; /* to prevent infinite loops in setup_fields */
-
-       guint8     exception_type;      /* MONO_EXCEPTION_* */
-
-       /* Additional information about the exception */
-       /* Stored as property MONO_CLASS_PROP_EXCEPTION_DATA */
-       //void       *exception_data;
+       guint fields_inited : 1; /* setup_fields () has finished */
+       guint has_failure : 1; /* See MONO_CLASS_PROP_EXCEPTION_DATA for a MonoErrorBoxed with the details */
 
        MonoClass  *parent;
        MonoClass  *nested_in;
@@ -342,8 +347,8 @@ struct _MonoClass {
        int        vtable_size; /* number of slots */
 
        guint16     interface_count;
-       guint16     interface_id;        /* unique inderface id (for interfaces) */
-       guint16     max_interface_id;
+       guint32     interface_id;        /* unique inderface id (for interfaces) */
+       guint32     max_interface_id;
        
        guint16     interface_offsets_count;
        MonoClass **interfaces_packed;
@@ -362,24 +367,6 @@ struct _MonoClass {
                int generic_param_token; /* for generic param types, both var and mvar */
        } sizes;
 
-       /*
-        * From the TypeDef table
-        */
-       guint32    flags;
-       struct {
-#if MONO_SMALL_CONFIG
-               guint16 first, count;
-#else
-               guint32 first, count;
-#endif
-       } field, method;
-
-       /* A GC handle pointing to the corresponding type builder/generic param builder */
-       guint32 ref_info_handle;
-
-       /* loaded on demand */
-       MonoMarshalType *marshal_info;
-
        /*
         * Field information: Type and location from object base
         */
@@ -391,23 +378,53 @@ struct _MonoClass {
        MonoType this_arg;
        MonoType byval_arg;
 
-       MonoGenericClass *generic_class;
-       MonoGenericContainer *generic_container;
-
        MonoGCDescriptor gc_descr;
 
        MonoClassRuntimeInfo *runtime_info;
 
-       /* next element in the class_cache hash list (in MonoImage) */
-       MonoClass *next_class_cache;
-
        /* Generic vtable. Initialized by a call to mono_class_setup_vtable () */
        MonoMethod **vtable;
 
-       /* Rarely used fields of classes */
-       MonoClassExt *ext;
+       /* Infrequently used items. See class-accessors.c: InfrequentDataKind for what goes into here. */
+       MonoPropertyBag infrequent_data;
 };
 
+typedef struct {
+       MonoClass class;
+       guint32 flags;
+       /*
+        * From the TypeDef table
+        */
+       guint32 first_method_idx;
+       guint32 first_field_idx;
+       guint32 method_count, field_count;
+       /* next element in the class_cache hash list (in MonoImage) */
+       MonoClass *next_class_cache;
+} MonoClassDef;
+
+typedef struct {
+       MonoClassDef class;
+       MonoGenericContainer *generic_container;
+} MonoClassGtd;
+
+typedef struct {
+       MonoClass class;
+       MonoGenericClass *generic_class;
+} MonoClassGenericInst;
+
+typedef struct {
+       MonoClass class;
+} MonoClassGenericParam;
+
+typedef struct {
+       MonoClass class;
+       guint32 method_count;
+} MonoClassArray;
+
+typedef struct {
+       MonoClass class;
+} MonoClassPointer;
+
 #ifdef COMPRESSED_INTERFACE_BITMAP
 int mono_compress_bitmap (uint8_t *dest, const uint8_t *bitmap, int size);
 int mono_class_interface_match (const uint8_t *bitmap, int id);
@@ -456,7 +473,7 @@ struct MonoVTable {
        MonoDomain *domain;  /* each object/vtable belongs to exactly one domain */
         gpointer    type; /* System.Type type for klass */
        guint8     *interface_bitmap;
-       guint16     max_interface_id;
+       guint32     max_interface_id;
        guint8      rank;
        guint remote          : 1; /* class is remotely activated */
        guint initialized     : 1; /* cctor has been run */
@@ -529,8 +546,9 @@ struct _MonoMethodInflated {
 struct _MonoGenericClass {
        MonoClass *container_class;     /* the generic type definition */
        MonoGenericContext context;     /* a context that contains the type instantiation doesn't contain any method instantiation */ /* FIXME: Only the class_inst member of "context" is ever used, so this field could be replaced with just a monogenericinst */
-       guint is_dynamic  : 1;          /* We're a MonoDynamicGenericClass */
+       guint is_dynamic  : 1;          /* Contains dynamic types */
        guint is_tb_open  : 1;          /* This is the fully open instantiation for a type_builder. Quite ugly, but it's temporary.*/
+       guint need_sync   : 1;      /* Only if dynamic. Need to be synchronized with its container class after its finished. */
        MonoClass *cached_class;        /* if present, the MonoClass corresponding to the instantiation.  */
 
        /* 
@@ -541,21 +559,6 @@ struct _MonoGenericClass {
        MonoImageSet *owner;
 };
 
-/*
- * This is used when instantiating a generic type definition which is
- * a TypeBuilder.
- */
-struct _MonoDynamicGenericClass {
-       MonoGenericClass generic_class;
-       int count_fields;
-       MonoClassField *fields;
-       guint initialized;
-       /* The non-inflated types of the fields */
-       MonoType **field_generic_types;
-       /* The managed objects representing the fields */
-       MonoObject **field_objects;
-};
-
 /*
  * A type parameter.
  */
@@ -726,7 +729,7 @@ void
 mono_class_setup_supertypes (MonoClass *klass);
 
 void
-mono_class_setup_fields_locking (MonoClass *klass);
+mono_class_setup_fields (MonoClass *klass);
 
 /* WARNING
  * Only call this function if you can ensure both @klass and @parent
@@ -785,7 +788,7 @@ typedef struct {
        size_t imt_slots_with_collisions;
        size_t imt_max_collisions_in_slot;
        size_t imt_method_count_when_max_collisions;
-       size_t imt_thunks_size;
+       size_t imt_trampolines_size;
        size_t jit_info_table_insert_count;
        size_t jit_info_table_remove_count;
        size_t jit_info_table_lookup_count;
@@ -930,7 +933,7 @@ void
 mono_classes_cleanup (void);
 
 void
-mono_class_layout_fields   (MonoClass *klass, int instance_size);
+mono_class_layout_fields (MonoClass *klass, int base_instance_size, int packing_size, gboolean sre);
 
 void
 mono_class_setup_interface_offsets (MonoClass *klass);
@@ -1272,10 +1275,7 @@ const char*
 mono_lookup_jit_icall_symbol (const char *name);
 
 gboolean
-mono_class_set_failure (MonoClass *klass, guint32 ex_type, void *ex_data);
-
-gpointer
-mono_class_get_exception_data (MonoClass *klass);
+mono_class_set_type_load_failure (MonoClass *klass, const char * fmt, ...) MONO_ATTR_FORMAT_PRINTF(2,3);
 
 MonoException*
 mono_class_get_exception_for_failure (MonoClass *klass);
@@ -1361,8 +1361,11 @@ mono_class_setup_interface_id (MonoClass *klass);
 MonoGenericContainer*
 mono_class_get_generic_container (MonoClass *klass);
 
-MonoGenericClass*
-mono_class_get_generic_class (MonoClass *klass);
+gpointer
+mono_class_alloc (MonoClass *klass, int size);
+
+gpointer
+mono_class_alloc0 (MonoClass *klass, int size);
 
 void
 mono_class_alloc_ext (MonoClass *klass);
@@ -1445,20 +1448,70 @@ MonoClass*
 mono_class_try_load_from_name (MonoImage *image, const char* name_space, const char *name);
 
 void
-mono_error_set_for_class_failure (MonoError *orerror, MonoClass *klass);
+mono_error_set_for_class_failure (MonoError *orerror, const MonoClass *klass);
 
-static inline guint8
-mono_class_get_failure (MonoClass *klass)
-{
-       g_assert (klass != NULL);
-       return klass->exception_type;
-}
+gboolean
+mono_class_has_failure (const MonoClass *klass);
 
-static inline gboolean
-mono_class_has_failure (MonoClass *klass)
-{
-       g_assert (klass != NULL);
-       return mono_class_get_failure (klass) != MONO_EXCEPTION_NONE;
-}
+/* Kind specific accessors */
+MonoGenericClass*
+mono_class_get_generic_class (MonoClass *klass);
+
+MonoGenericClass*
+mono_class_try_get_generic_class (MonoClass *klass);
+
+void
+mono_class_set_flags (MonoClass *klass, guint32 flags);
+
+MonoGenericContainer*
+mono_class_try_get_generic_container (MonoClass *klass);
+
+void
+mono_class_set_generic_container (MonoClass *klass, MonoGenericContainer *container);
+
+guint32
+mono_class_get_first_method_idx (MonoClass *klass);
+
+void
+mono_class_set_first_method_idx (MonoClass *klass, guint32 idx);
+
+guint32
+mono_class_get_first_field_idx (MonoClass *klass);
+
+void
+mono_class_set_first_field_idx (MonoClass *klass, guint32 idx);
+
+guint32
+mono_class_get_method_count (MonoClass *klass);
+
+void
+mono_class_set_method_count (MonoClass *klass, guint32 count);
+
+guint32
+mono_class_get_field_count (MonoClass *klass);
+
+void
+mono_class_set_field_count (MonoClass *klass, guint32 count);
+
+MonoMarshalType*
+mono_class_get_marshal_info (MonoClass *class);
+
+void
+mono_class_set_marshal_info (MonoClass *class, MonoMarshalType *marshal_info);
+
+MonoClassExt*
+mono_class_get_ext (MonoClass *class);
+
+void
+mono_class_set_ext (MonoClass *class, MonoClassExt *ext);
+
+guint32
+mono_class_get_ref_info_handle (MonoClass *class);
+
+guint32
+mono_class_set_ref_info_handle (MonoClass *class, guint32 value);
+
+/*Now that everything has been defined, let's include the inline functions */
+#include <mono/metadata/class-inlines.h>
 
 #endif /* __MONO_METADATA_CLASS_INTERNALS_H__ */
index a419af381492313e250c7887c0217c26ea071269..8aba20911a930693825d70d6919ca31115e9d988 100644 (file)
@@ -18,7 +18,9 @@
 #include <string.h>
 #include <stdlib.h>
 #include <mono/metadata/image.h>
+#include <mono/metadata/image-internals.h>
 #include <mono/metadata/assembly.h>
+#include <mono/metadata/assembly-internals.h>
 #include <mono/metadata/metadata.h>
 #include <mono/metadata/metadata-internals.h>
 #include <mono/metadata/profiler-private.h>
@@ -52,8 +54,9 @@ gboolean mono_print_vtable = FALSE;
 gboolean mono_align_small_structs = FALSE;
 
 /* Statistics */
-guint32 inflated_classes, inflated_classes_size, inflated_methods_size;
-guint32 classes_size, class_ext_size;
+guint32 inflated_classes_size, inflated_methods_size;
+guint32 classes_size, class_ext_size, class_ext_count;
+guint32 class_def_count, class_gtd_count, class_ginst_count, class_gparam_count, class_array_count, class_pointer_count;
 
 /* Low level lock which protects data structures in this module */
 static mono_mutex_t classes_mutex;
@@ -75,6 +78,10 @@ static guint32 mono_field_resolve_flags (MonoClassField *field);
 static void mono_class_setup_vtable_full (MonoClass *klass, GList *in_setup);
 static void mono_generic_class_setup_parent (MonoClass *klass, MonoClass *gklass);
 
+static gboolean mono_class_set_failure (MonoClass *klass, MonoErrorBoxed *boxed_error);
+static gpointer mono_class_get_exception_data (const MonoClass *klass);
+
+
 /*
 We use gclass recording to allow recursive system f types to be referenced by a parent.
 
@@ -102,6 +109,11 @@ static int record_gclass_instantiation;
 static GSList *gclass_recorded_list;
 typedef gboolean (*gclass_record_func) (MonoClass*, void*);
 
+/* This TLS variable points to a GSList of classes which have setup_fields () executing */
+static MonoNativeTlsKey setup_fields_tls_id;
+
+static MonoNativeTlsKey init_pending_tls_id;
+
 static inline void
 classes_lock (void)
 {
@@ -216,7 +228,7 @@ mono_class_from_typeref_checked (MonoImage *image, guint32 type_token, MonoError
                goto done;
 
        case MONO_RESOLUTION_SCOPE_MODULEREF:
-               module = mono_image_load_module (image, idx);
+               module = mono_image_load_module_checked (image, idx, error);
                if (module)
                        res = mono_class_from_name_checked (module, nspace, name, error);
                goto done;
@@ -233,9 +245,10 @@ mono_class_from_typeref_checked (MonoImage *image, guint32 type_token, MonoError
                enclosing = mono_class_from_typeref_checked (image, MONO_TOKEN_TYPE_REF | idx, error); 
                return_val_if_nok (error, NULL);
 
-               if (enclosing->nested_classes_inited && enclosing->ext) {
+               MonoClassExt *ext = mono_class_get_ext (enclosing);
+               if (enclosing->nested_classes_inited && ext) {
                        /* Micro-optimization: don't scan the metadata tables if enclosing is already inited */
-                       for (tmp = enclosing->ext->nested_classes; tmp; tmp = tmp->next) {
+                       for (tmp = ext->nested_classes; tmp; tmp = tmp->next) {
                                res = (MonoClass *)tmp->data;
                                if (strcmp (res->name, name) == 0)
                                        return res;
@@ -495,8 +508,8 @@ mono_type_get_name_recurse (MonoType *type, GString *str, gboolean is_recursed,
                }
                if (is_recursed)
                        break;
-               if (klass->generic_class) {
-                       MonoGenericClass *gclass = klass->generic_class;
+               if (mono_class_is_ginst (klass)) {
+                       MonoGenericClass *gclass = mono_class_get_generic_class (klass);
                        MonoGenericInst *inst = gclass->context.class_inst;
                        MonoTypeNameFormat nested_format;
                        int i;
@@ -525,7 +538,7 @@ mono_type_get_name_recurse (MonoType *type, GString *str, gboolean is_recursed,
                                g_string_append_c (str, '>');
                        else
                                g_string_append_c (str, ']');
-               } else if (klass->generic_container &&
+               } else if (mono_class_is_gtd (klass) &&
                           (format != MONO_TYPE_NAME_FORMAT_FULL_NAME) &&
                           (format != MONO_TYPE_NAME_FORMAT_ASSEMBLY_QUALIFIED)) {
                        int i;
@@ -534,10 +547,10 @@ mono_type_get_name_recurse (MonoType *type, GString *str, gboolean is_recursed,
                                g_string_append_c (str, '<');
                        else
                                g_string_append_c (str, '[');
-                       for (i = 0; i < klass->generic_container->type_argc; i++) {
+                       for (i = 0; i < mono_class_get_generic_container (klass)->type_argc; i++) {
                                if (i)
                                        g_string_append_c (str, ',');
-                               g_string_append (str, mono_generic_container_get_param_info (klass->generic_container, i)->name);
+                               g_string_append (str, mono_generic_container_get_param_info (mono_class_get_generic_container (klass), i)->name);
                        }
                        if (format == MONO_TYPE_NAME_FORMAT_IL) 
                                g_string_append_c (str, '>');
@@ -656,7 +669,7 @@ mono_class_is_open_constructed_type (MonoType *t)
                return t->data.generic_class->context.class_inst->is_open;
        case MONO_TYPE_CLASS:
        case MONO_TYPE_VALUETYPE:
-               return t->data.klass->generic_container != NULL;
+               return mono_class_is_gtd (t->data.klass);
        default:
                return FALSE;
        }
@@ -779,7 +792,7 @@ inflate_generic_type (MonoImage *image, MonoType *type, MonoGenericContext *cont
        case MONO_TYPE_CLASS:
        case MONO_TYPE_VALUETYPE: {
                MonoClass *klass = type->data.klass;
-               MonoGenericContainer *container = klass->generic_container;
+               MonoGenericContainer *container = mono_class_try_get_generic_container (klass);
                MonoGenericInst *inst;
                MonoGenericClass *gclass = NULL;
                MonoType *nt;
@@ -816,33 +829,8 @@ mono_generic_class_get_context (MonoGenericClass *gclass)
 MonoGenericContext *
 mono_class_get_context (MonoClass *klass)
 {
-       return klass->generic_class ? mono_generic_class_get_context (klass->generic_class) : NULL;
-}
-
-/*
- * mono_class_get_generic_container:
- *
- *   Return the generic container of KLASS which should be a generic type definition.
- */
-MonoGenericContainer*
-mono_class_get_generic_container (MonoClass *klass)
-{
-       g_assert (klass->is_generic);
-
-       return klass->generic_container;
-}
-
-/*
- * mono_class_get_generic_class:
- *
- *   Return the MonoGenericClass of KLASS, which should be a generic instance.
- */
-MonoGenericClass*
-mono_class_get_generic_class (MonoClass *klass)
-{
-       g_assert (klass->is_inflated);
-
-       return klass->generic_class;
+       MonoGenericClass *gklass = mono_class_try_get_generic_class (klass);
+       return gklass ? mono_generic_class_get_context (gklass) : NULL;
 }
 
 /*
@@ -1073,7 +1061,7 @@ mono_class_inflate_generic_method_full_checked (MonoMethod *method, MonoClass *k
         * 
         */
        if (!((method->is_generic && context->method_inst) || 
-               (method->klass->generic_container && context->class_inst)))
+               (mono_class_is_gtd (method->klass) && context->class_inst)))
                return method;
 
        iresult = g_new0 (MonoMethodInflated, 1);
@@ -1084,14 +1072,12 @@ mono_class_inflate_generic_method_full_checked (MonoMethod *method, MonoClass *k
                iresult->context.method_inst = mono_method_get_generic_container (method)->context.method_inst;
 
        if (!context->class_inst) {
-               g_assert (!iresult->declaring->klass->generic_class);
-               if (iresult->declaring->klass->generic_container)
-                       iresult->context.class_inst = iresult->declaring->klass->generic_container->context.class_inst;
-               else if (iresult->declaring->klass->generic_class)
-                       iresult->context.class_inst = iresult->declaring->klass->generic_class->context.class_inst;
+               g_assert (!mono_class_is_ginst (iresult->declaring->klass));
+               if (mono_class_is_gtd (iresult->declaring->klass))
+                       iresult->context.class_inst = mono_class_get_generic_container (iresult->declaring->klass)->context.class_inst;
        }
        /* This can happen with some callers like mono_object_get_virtual_method () */
-       if (!iresult->declaring->klass->generic_container && !iresult->declaring->klass->generic_class)
+       if (!mono_class_is_gtd (iresult->declaring->klass) && !mono_class_is_ginst (iresult->declaring->klass))
                iresult->context.class_inst = NULL;
 
        MonoImageSet *set = mono_metadata_get_image_set_for_method (iresult);
@@ -1130,6 +1116,15 @@ mono_class_inflate_generic_method_full_checked (MonoMethod *method, MonoClass *k
        result->sre_method = FALSE;
        result->signature = NULL;
 
+       if (method->wrapper_type) {
+               MonoMethodWrapper *mw = (MonoMethodWrapper*)method;
+               MonoMethodWrapper *resw = (MonoMethodWrapper*)result;
+               int len = GPOINTER_TO_INT (((void**)mw->method_data) [0]);
+
+               resw->method_data = (void **)g_malloc (sizeof (gpointer) * (len + 1));
+               memcpy (resw->method_data, mw->method_data, sizeof (gpointer) * (len + 1));
+       }
+
        if (iresult->context.method_inst) {
                /* Set the generic_container of the result to the generic_container of method */
                MonoGenericContainer *generic_container = mono_method_get_generic_container (method);
@@ -1140,12 +1135,13 @@ mono_class_inflate_generic_method_full_checked (MonoMethod *method, MonoClass *k
                }
        }
 
-       if (!klass_hint || !klass_hint->generic_class ||
-           klass_hint->generic_class->container_class != method->klass ||
-           klass_hint->generic_class->context.class_inst != context->class_inst)
-               klass_hint = NULL;
+       if (klass_hint) {
+               MonoGenericClass *gklass_hint = mono_class_try_get_generic_class (klass_hint);
+               if (gklass_hint && (gklass_hint->container_class != method->klass || gklass_hint->context.class_inst != context->class_inst))
+                       klass_hint = NULL;
+       }
 
-       if (method->klass->generic_container)
+       if (mono_class_is_gtd (method->klass))
                result->klass = klass_hint;
 
        if (!result->klass) {
@@ -1220,8 +1216,8 @@ mono_method_get_context_general (MonoMethod *method, gboolean uninflated)
                return NULL;
        if (method->is_generic)
                return &(mono_method_get_generic_container (method)->context);
-       if (method->klass->generic_container)
-               return &method->klass->generic_container->context;
+       if (mono_class_is_gtd (method->klass))
+               return &mono_class_get_generic_container (method->klass)->context;
        return NULL;
 }
 
@@ -1285,32 +1281,32 @@ mono_class_find_enum_basetype (MonoClass *klass, MonoError *error)
 {
        MonoGenericContainer *container = NULL;
        MonoImage *m = klass->image;
-       const int top = klass->field.count;
-       int i;
+       const int top = mono_class_get_field_count (klass);
+       int i, first_field_idx;
 
        g_assert (klass->enumtype);
 
        mono_error_init (error);
 
-       if (klass->generic_container)
-               container = klass->generic_container;
-       else if (klass->generic_class) {
-               MonoClass *gklass = klass->generic_class->container_class;
+       container = mono_class_try_get_generic_container (klass);
+       if (mono_class_is_ginst (klass)) {
+               MonoClass *gklass = mono_class_get_generic_class (klass)->container_class;
 
-               container = gklass->generic_container;
+               container = mono_class_get_generic_container (gklass);
                g_assert (container);
        }
 
        /*
         * Fetch all the field information.
         */
+       first_field_idx = mono_class_get_first_field_idx (klass);
        for (i = 0; i < top; i++){
                const char *sig;
                guint32 cols [MONO_FIELD_SIZE];
-               int idx = klass->field.first + i;
+               int idx = first_field_idx + i;
                MonoType *ftype;
 
-               /* klass->field.first and idx points into the fieldptr table */
+               /* first_field_idx and idx points into the fieldptr table */
                mono_metadata_decode_table_row (m, MONO_TABLE_FIELD, idx, cols, MONO_FIELD_SIZE);
 
                if (cols [MONO_FIELD_FLAGS] & FIELD_ATTRIBUTE_STATIC) //no need to decode static fields
@@ -1333,7 +1329,7 @@ mono_class_find_enum_basetype (MonoClass *klass, MonoError *error)
                if (!ftype)
                        goto fail;
 
-               if (klass->generic_class) {
+               if (mono_class_is_ginst (klass)) {
                        //FIXME do we leak here?
                        ftype = mono_class_inflate_generic_type_checked (ftype, mono_class_get_context (klass), error);
                        if (!mono_error_ok (error))
@@ -1350,7 +1346,7 @@ fail:
 }
 
 /*
- * Checks for MonoClass::exception_type without resolving all MonoType's into MonoClass'es
+ * Checks for MonoClass::has_failure without resolving all MonoType's into MonoClass'es
  */
 static gboolean
 mono_type_has_exceptions (MonoType *type)
@@ -1370,49 +1366,11 @@ mono_type_has_exceptions (MonoType *type)
 }
 
 void
-mono_error_set_for_class_failure (MonoError *oerror, MonoClass *klass)
+mono_error_set_for_class_failure (MonoError *oerror, const MonoClass *klass)
 {
-       gpointer exception_data = mono_class_get_exception_data (klass);
-
-       switch (mono_class_get_failure(klass)) {
-       case MONO_EXCEPTION_TYPE_LOAD: {
-               mono_error_set_type_load_class (oerror, klass, "Error Loading class");
-               return;
-       }
-       case MONO_EXCEPTION_MISSING_METHOD: {
-               char *class_name = (char *)exception_data;
-               char *member_name = class_name + strlen (class_name) + 1;
-
-               mono_error_set_method_load (oerror, klass, member_name, "Error Loading Method");
-               return;
-       }
-       case MONO_EXCEPTION_MISSING_FIELD: {
-               char *class_name = (char *)exception_data;
-               char *member_name = class_name + strlen (class_name) + 1;
-
-               mono_error_set_field_load (oerror, klass, member_name, "Error Loading Field");
-               return;
-       }
-       case MONO_EXCEPTION_FILE_NOT_FOUND: {
-               char *msg_format = (char *)exception_data;
-               char *assembly_name = msg_format + strlen (msg_format) + 1;
-               char *msg = g_strdup_printf (msg_format, assembly_name);
-
-               mono_error_set_assembly_load (oerror, assembly_name, msg);
-               return;
-       }
-       case MONO_EXCEPTION_BAD_IMAGE: {
-               mono_error_set_bad_image (oerror, NULL, (const char *)exception_data);
-               return;
-       }
-       case MONO_EXCEPTION_INVALID_PROGRAM: {
-               mono_error_set_invalid_program (oerror, (const char *)exception_data);
-               return;
-       }
-       default: {
-               g_assert_not_reached ();
-       }
-       }
+       g_assert (mono_class_has_failure (klass));
+       MonoErrorBoxed *box = (MonoErrorBoxed*)mono_class_get_exception_data (klass);
+       mono_error_set_from_boxed (oerror, box);
 }
 
 
@@ -1422,16 +1380,17 @@ mono_error_set_for_class_failure (MonoError *oerror, MonoClass *klass)
  *   Allocate memory for some data belonging to CLASS, either from its image's mempool,
  * or from the heap.
  */
-static gpointer
+gpointer
 mono_class_alloc (MonoClass *klass, int size)
 {
-       if (klass->generic_class)
-               return mono_image_set_alloc (klass->generic_class->owner, size);
+       MonoGenericClass *gklass = mono_class_try_get_generic_class (klass);
+       if (gklass)
+               return mono_image_set_alloc (gklass->owner, size);
        else
                return mono_image_alloc (klass->image, size);
 }
 
-static gpointer
+gpointer
 mono_class_alloc0 (MonoClass *klass, int size)
 {
        gpointer res;
@@ -1448,13 +1407,18 @@ mono_class_alloc0 (MonoClass *klass, int size)
  * mono_class_setup_basic_field_info:
  * @class: The class to initialize
  *
- * Initializes the klass->fields.
- * LOCKING: Assumes the loader lock is held.
+ * Initializes the following fields in MonoClass:
+ * * klass->fields (only field->parent and field->name)
+ * * klass->field.count
+ * * klass->first_field_idx
+ * LOCKING: Acquires the loader lock
  */
 static void
 mono_class_setup_basic_field_info (MonoClass *klass)
 {
+       MonoGenericClass *gklass;
        MonoClassField *field;
+       MonoClassField *fields;
        MonoClass *gtd;
        MonoImage *image;
        int i, top;
@@ -1462,11 +1426,12 @@ mono_class_setup_basic_field_info (MonoClass *klass)
        if (klass->fields)
                return;
 
-       gtd = klass->generic_class ? mono_class_get_generic_type_definition (klass) : NULL;
+       gklass = mono_class_try_get_generic_class (klass);
+       gtd = gklass ? mono_class_get_generic_type_definition (klass) : NULL;
        image = klass->image;
-       top = klass->field.count;
 
-       if (klass->generic_class && image_is_dynamic (klass->generic_class->container_class->image) && !klass->generic_class->container_class->wastypebuilder) {
+
+       if (gklass && image_is_dynamic (gklass->container_class->image) && !gklass->container_class->wastypebuilder) {
                /*
                 * This happens when a generic instance of an unfinished generic typebuilder
                 * is used as an element type for creating an array type. We can't initialize
@@ -1479,105 +1444,103 @@ mono_class_setup_basic_field_info (MonoClass *klass)
        if (gtd) {
                mono_class_setup_basic_field_info (gtd);
 
-               top = gtd->field.count;
-               klass->field.first = gtd->field.first;
-               klass->field.count = gtd->field.count;
+               mono_loader_lock ();
+               mono_class_set_field_count (klass, mono_class_get_field_count (gtd));
+               mono_loader_unlock ();
        }
 
-       klass->fields = (MonoClassField *)mono_class_alloc0 (klass, sizeof (MonoClassField) * top);
+       top = mono_class_get_field_count (klass);
+
+       fields = (MonoClassField *)mono_class_alloc0 (klass, sizeof (MonoClassField) * top);
 
        /*
         * Fetch all the field information.
         */
-       for (i = 0; i < top; i++){
-               field = &klass->fields [i];
+       int first_field_idx = mono_class_has_static_metadata (klass) ? mono_class_get_first_field_idx (klass) : 0;
+       for (i = 0; i < top; i++) {
+               field = &fields [i];
                field->parent = klass;
 
                if (gtd) {
                        field->name = mono_field_get_name (&gtd->fields [i]);
                } else {
-                       int idx = klass->field.first + i;
-                       /* klass->field.first and idx points into the fieldptr table */
+                       int idx = first_field_idx + i;
+                       /* first_field_idx and idx points into the fieldptr table */
                        guint32 name_idx = mono_metadata_decode_table_row_col (image, MONO_TABLE_FIELD, idx, MONO_FIELD_NAME);
                        /* The name is needed for fieldrefs */
                        field->name = mono_metadata_string_heap (image, name_idx);
                }
        }
+
+       mono_memory_barrier ();
+
+       mono_loader_lock ();
+       if (!klass->fields)
+               klass->fields = fields;
+       mono_loader_unlock ();
+}
+
+/**
+ * mono_class_set_failure_causedby_class:
+ * @klass: the class that is failing
+ * @caused_by: the class that caused the failure
+ * @msg: Why @klass is failing.
+ * 
+ * If @caused_by has a failure, sets a TypeLoadException failure on
+ * @klass with message "@msg, due to: {@caused_by message}".
+ *
+ * Returns: TRUE if a failiure was set, or FALSE if @caused_by doesn't have a failure.
+ */
+static gboolean
+mono_class_set_type_load_failure_causedby_class (MonoClass *klass, const MonoClass *caused_by, const gchar* msg)
+{
+       if (mono_class_has_failure (caused_by)) {
+               MonoError cause_error;
+               mono_error_init (&cause_error);
+               mono_error_set_for_class_failure (&cause_error, caused_by);
+               mono_class_set_type_load_failure (klass, "%s, due to: %s", msg, mono_error_get_message (&cause_error));
+               mono_error_cleanup (&cause_error);
+               return TRUE;
+       } else {
+               return FALSE;
+       }
 }
 
+
 /** 
  * mono_class_setup_fields:
- * @class: The class to initialize
+ * @klass: The class to initialize
+ *
+ * Initializes klass->fields, computes class layout and sizes.
+ * typebuilder_setup_fields () is the corresponding function for dynamic classes.
+ * Sets the following fields in @klass:
+ *  - all the fields initialized by mono_class_init_sizes ()
+ *  - element_class/cast_class (for enums)
+ *  - field->type/offset for all fields
+ *  - fields_inited
  *
- * Initializes the klass->fields.
- * LOCKING: Assumes the loader lock is held.
+ * LOCKING: Acquires the loader lock.
  */
-static void
+void
 mono_class_setup_fields (MonoClass *klass)
 {
        MonoError error;
        MonoImage *m = klass->image;
        int top;
-       guint32 layout = klass->flags & TYPE_ATTRIBUTE_LAYOUT_MASK;
-       int i, blittable = TRUE;
+       guint32 layout = mono_class_get_flags (klass) & TYPE_ATTRIBUTE_LAYOUT_MASK;
+       int i;
        guint32 real_size = 0;
        guint32 packing_size = 0;
        int instance_size;
        gboolean explicit_size;
        MonoClassField *field;
-       MonoGenericContainer *container = NULL;
-       MonoClass *gtd = klass->generic_class ? mono_class_get_generic_type_definition (klass) : NULL;
+       MonoGenericClass *gklass = mono_class_try_get_generic_class (klass);
+       MonoClass *gtd = gklass ? mono_class_get_generic_type_definition (klass) : NULL;
 
-       /*
-        * FIXME: We have a race condition here.  It's possible that this function returns
-        * to its caller with `instance_size` set to `0` instead of the actual size.  This
-        * is not a problem when the function is called recursively on the same class,
-        * because the size will be initialized by the outer invocation.  What follows is a
-        * description of how it can occur in other cases, too.  There it is a problem,
-        * because it can lead to the GC being asked to allocate an object of size `0`,
-        * which SGen chokes on.  The race condition is triggered infrequently by
-        * `tests/sgen-suspend.cs`.
-        *
-        * This function is called for a class whenever one of its subclasses is inited.
-        * For example, it's called for every subclass of Object.  What it does is this:
-        *
-        *     if (klass->setup_fields_called)
-        *         return;
-        *     ...
-        *     klass->instance_size = 0;
-        *     ...
-        *     klass->setup_fields_called = 1;
-        *     ... critical point
-        *     klass->instance_size = actual_instance_size;
-        *
-        * The last two steps are sometimes reversed, but that only changes the way in which
-        * the race condition works.
-        *
-        * Assume thread A goes through this function and makes it to the critical point.
-        * Now thread B runs the function and, since `setup_fields_called` is set, returns
-        * immediately, but `instance_size` is incorrect.
-        *
-        * The other case looks like this:
-        *
-        *     if (klass->setup_fields_called)
-        *         return;
-        *     ... critical point X
-        *     klass->instance_size = 0;
-        *     ... critical point Y
-        *     klass->instance_size = actual_instance_size;
-        *     ...
-        *     klass->setup_fields_called = 1;
-        *
-        * Assume thread A goes through the function and makes it to critical point X.  Now
-        * thread B runs through the whole of the function, returning, assuming
-        * `instance_size` is set.  At that point thread A gets to run and makes it to
-        * critical point Y, at which time `instance_size` is `0` again, invalidating thread
-        * B's assumption.
-        */
-       if (klass->setup_fields_called)
+       if (klass->fields_inited)
                return;
 
-       if (klass->generic_class && image_is_dynamic (klass->generic_class->container_class->image) && !klass->generic_class->container_class->wastypebuilder) {
+       if (gklass && image_is_dynamic (gklass->container_class->image) && !gklass->container_class->wastypebuilder) {
                /*
                 * This happens when a generic instance of an unfinished generic typebuilder
                 * is used as an element type for creating an array type. We can't initialize
@@ -1588,103 +1551,55 @@ mono_class_setup_fields (MonoClass *klass)
        }
 
        mono_class_setup_basic_field_info (klass);
-       top = klass->field.count;
+       top = mono_class_get_field_count (klass);
 
        if (gtd) {
                mono_class_setup_fields (gtd);
-               if (mono_class_has_failure (gtd)) {
-                       mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, NULL);
+               if (mono_class_set_type_load_failure_causedby_class (klass, gtd, "Generic type definition failed"))
                        return;
-               }
        }
 
        instance_size = 0;
-       if (!klass->rank)
-               klass->sizes.class_size = 0;
-
        if (klass->parent) {
                /* For generic instances, klass->parent might not have been initialized */
                mono_class_init (klass->parent);
-               if (!klass->parent->size_inited) {
-                       mono_class_setup_fields (klass->parent);
-                       if (mono_class_has_failure (klass->parent)) {
-                               mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, NULL);
-                               return;
-                       }
-               }
-               instance_size += klass->parent->instance_size;
-               klass->min_align = klass->parent->min_align;
-               /* we use |= since it may have been set already */
-               klass->has_references |= klass->parent->has_references;
-               blittable = klass->parent->blittable;
+               mono_class_setup_fields (klass->parent);
+               if (mono_class_set_type_load_failure_causedby_class (klass, klass->parent, "Could not set up parent class"))
+                       return;
+               instance_size = klass->parent->instance_size;
        } else {
                instance_size = sizeof (MonoObject);
-               klass->min_align = 1;
        }
 
-       /* We can't really enable 16 bytes alignment until the GC supports it.
-       The whole layout/instance size code must be reviewed because we do alignment calculation in terms of the
-       boxed instance, which leads to unexplainable holes at the beginning of an object embedding a simd type.
-       Bug #506144 is an example of this issue.
-
-        if (klass->simd_type)
-               klass->min_align = 16;
-        */
        /* Get the real size */
        explicit_size = mono_metadata_packing_from_typedef (klass->image, klass->type_token, &packing_size, &real_size);
+       if (explicit_size)
+               instance_size += real_size;
 
-       if (explicit_size) {
-               if ((packing_size & 0xffffff00) != 0) {
-                       char *err_msg = g_strdup_printf ("Could not load struct '%s' with packing size %d >= 256", klass->name, packing_size);
-                       mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, err_msg);
-                       return;
-               }
-               klass->packing_size = packing_size;
-               real_size += instance_size;
-       }
-
-       if (!top) {
-               if (explicit_size && real_size) {
-                       instance_size = MAX (real_size, instance_size);
-               }
-               klass->blittable = blittable;
-               if (!klass->instance_size)
-                       klass->instance_size = instance_size;
-               mono_memory_barrier ();
-               klass->size_inited = 1;
-               klass->fields_inited = 1;
-               klass->setup_fields_called = 1;
+       /*
+        * This function can recursively call itself.
+        * Prevent infinite recursion by using a list in TLS.
+        */
+       GSList *init_list = (GSList *)mono_native_tls_get_value (setup_fields_tls_id);
+       if (g_slist_find (init_list, klass))
                return;
-       }
-
-       if (layout == TYPE_ATTRIBUTE_AUTO_LAYOUT && !(mono_is_corlib_image (klass->image) && !strcmp (klass->name_space, "System") && !strcmp (klass->name, "ValueType")))
-               blittable = FALSE;
-
-       /* Prevent infinite loops if the class references itself */
-       klass->setup_fields_called = 1;
-
-       if (klass->generic_container) {
-               container = klass->generic_container;
-       } else if (gtd) {
-               container = gtd->generic_container;
-               g_assert (container);
-       }
+       init_list = g_slist_prepend (init_list, klass);
+       mono_native_tls_set_value (setup_fields_tls_id, init_list);
 
        /*
         * Fetch all the field information.
         */
-       for (i = 0; i < top; i++){
-               int idx = klass->field.first + i;
+       int first_field_idx = mono_class_has_static_metadata (klass) ? mono_class_get_first_field_idx (klass) : 0;
+       for (i = 0; i < top; i++) {
+               int idx = first_field_idx + i;
                field = &klass->fields [i];
 
-               field->parent = klass;
-
                if (!field->type) {
                        mono_field_resolve_type (field, &error);
                        if (!mono_error_ok (&error)) {
                                /*mono_field_resolve_type already failed class*/
                                mono_error_cleanup (&error);
-                               return;
+                               break;
                        }
                        if (!field->type)
                                g_error ("could not resolve %s:%s\n", mono_type_get_full_name(klass), field->name);
@@ -1693,58 +1608,29 @@ mono_class_setup_fields (MonoClass *klass)
 
                if (mono_field_is_deleted (field))
                        continue;
-               if (gtd) {
-                       MonoClassField *gfield = &gtd->fields [i];
-                       field->offset = gfield->offset;
-               } else {
-                       if (layout == TYPE_ATTRIBUTE_EXPLICIT_LAYOUT) {
-                               guint32 offset;
-                               mono_metadata_field_info (m, idx, &offset, NULL, NULL);
-                               field->offset = offset;
+               if (layout == TYPE_ATTRIBUTE_EXPLICIT_LAYOUT) {
+                       guint32 uoffset;
+                       mono_metadata_field_info (m, idx, &uoffset, NULL, NULL);
+                       int offset = uoffset;
 
-                               if (field->offset == (guint32)-1 && !(field->type->attrs & FIELD_ATTRIBUTE_STATIC)) {
-                                       mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, g_strdup_printf ("Missing field layout info for %s", field->name));
-                                       break;
-                               }
-                               if (field->offset < -1) { /*-1 is used to encode special static fields */
-                                       mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, g_strdup_printf ("Invalid negative field offset %d for %s", field->offset, field->name));
-                                       break;
-                               }
-                               if (klass->generic_container) {
-                                       mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, g_strdup_printf ("Generic class cannot have explicit layout."));
-                                       break;
-                               }
+                       if (offset == (guint32)-1 && !(field->type->attrs & FIELD_ATTRIBUTE_STATIC)) {
+                               mono_class_set_type_load_failure (klass, "Missing field layout info for %s", field->name);
+                               break;
                        }
-               }
-
-               /* Only do these checks if we still think this type is blittable */
-               if (blittable && !(field->type->attrs & FIELD_ATTRIBUTE_STATIC)) {
-                       if (field->type->byref || MONO_TYPE_IS_REFERENCE (field->type)) {
-                               blittable = FALSE;
-                       } else {
-                               MonoClass *field_class = mono_class_from_mono_type (field->type);
-                               if (field_class) {
-                                       mono_class_setup_fields (field_class);
-                                       if (mono_class_has_failure (field_class)) {
-                                               mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, NULL);
-                                               break;
-                                       }
-                               }
-                               if (!field_class || !field_class->blittable)
-                                       blittable = FALSE;
+                       if (offset < -1) { /*-1 is used to encode special static fields */
+                               mono_class_set_type_load_failure (klass, "Field '%s' has a negative offset %d", field->name, offset);
+                               break;
+                       }
+                       if (mono_class_is_gtd (klass)) {
+                               mono_class_set_type_load_failure (klass, "Generic class cannot have explicit layout.");
+                               break;
                        }
                }
-
-               if (klass->enumtype && !(field->type->attrs & FIELD_ATTRIBUTE_STATIC)) {
-                       klass->cast_class = klass->element_class = mono_class_from_mono_type (field->type);
-                       blittable = klass->element_class->blittable;
-               }
-
                if (mono_type_has_exceptions (field->type)) {
                        char *class_name = mono_type_get_full_name (klass);
                        char *type_name = mono_type_full_name (field->type);
 
-                       mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, NULL);
+                       mono_class_set_type_load_failure (klass, "");
                        g_warning ("Invalid type %s for instance field %s:%s", type_name, class_name, field->name);
                        g_free (class_name);
                        g_free (type_name);
@@ -1753,66 +1639,61 @@ mono_class_setup_fields (MonoClass *klass)
                /* The def_value of fields is compute lazily during vtable creation */
        }
 
-       if (klass == mono_defaults.string_class)
-               blittable = FALSE;
+       if (!mono_class_has_failure (klass))
+               mono_class_layout_fields (klass, instance_size, packing_size, FALSE);
 
-       klass->blittable = blittable;
+       init_list = g_slist_remove (init_list, klass);
+       mono_native_tls_set_value (setup_fields_tls_id, init_list);
+}
 
-       if (klass->enumtype && !mono_class_enum_basetype (klass)) {
-               mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, NULL);
-               return;
+static void
+init_sizes_with_info (MonoClass *klass, MonoCachedClassInfo *cached_info)
+{
+       if (cached_info) {
+               klass->instance_size = cached_info->instance_size;
+               klass->sizes.class_size = cached_info->class_size;
+               klass->packing_size = cached_info->packing_size;
+               klass->min_align = cached_info->min_align;
+               klass->blittable = cached_info->blittable;
+               klass->has_references = cached_info->has_references;
+               klass->has_static_refs = cached_info->has_static_refs;
+               klass->no_special_static_fields = cached_info->no_special_static_fields;
        }
-       if (explicit_size && real_size) {
-               instance_size = MAX (real_size, instance_size);
+       else {
+               if (!klass->size_inited)
+                       mono_class_setup_fields (klass);
        }
-
-       if (mono_class_has_failure (klass))
-               return;
-       mono_class_layout_fields (klass, instance_size);
-
-       /*valuetypes can't be neither bigger than 1Mb or empty. */
-       if (klass->valuetype && (klass->instance_size <= 0 || klass->instance_size > (0x100000 + sizeof (MonoObject))))
-               mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, NULL);
-
-       mono_memory_barrier ();
-       klass->fields_inited = 1;
 }
+/*
 
-/** 
- * mono_class_setup_fields_locking:
- * @class: The class to initialize
+ * mono_class_init_sizes:
+ *
+ *   Initializes the size related fields of @klass without loading all field data if possible.
+ * Sets the following fields in @klass:
+ * - instance_size
+ * - sizes.class_size
+ * - packing_size
+ * - min_align
+ * - blittable
+ * - has_references
+ * - has_static_refs
+ * - size_inited
+ * Can fail the class.
  *
- * Initializes the klass->fields array of fields.
- * Aquires the loader lock.
+ * LOCKING: Acquires the loader lock.
  */
-void
-mono_class_setup_fields_locking (MonoClass *klass)
+static void
+mono_class_init_sizes (MonoClass *klass)
 {
-       /* This can be checked without locks */
-       if (klass->fields_inited)
+       MonoCachedClassInfo cached_info;
+       gboolean has_cached_info;
+
+       if (klass->size_inited)
                return;
-       mono_loader_lock ();
-       mono_class_setup_fields (klass);
-       mono_loader_unlock ();
-}
 
-/*
- * mono_class_has_references:
- *
- *   Returns whenever @klass->has_references is set, initializing it if needed.
- * Aquires the loader lock.
- */
-static gboolean
-mono_class_has_references (MonoClass *klass)
-{
-       if (klass->init_pending) {
-               /* Be conservative */
-               return TRUE;
-       } else {
-               mono_class_init (klass);
+       has_cached_info = mono_class_get_cached_class_info (klass, &cached_info);
 
-               return klass->has_references;
-       }
+       init_sizes_with_info (klass, has_cached_info ? &cached_info : NULL);
 }
 
 /*
@@ -1832,16 +1713,29 @@ mono_type_get_basic_type_from_generic (MonoType *type)
        return type;
 }
 
+static gboolean
+class_has_references (MonoClass *klass)
+{
+       mono_class_init_sizes (klass);
+
+       /*
+        * has_references is not set if this is called recursively, but this is not a problem since this is only used
+        * during field layout, and instance fields are initialized before static fields, and instance fields can't
+        * embed themselves.
+        */
+       return klass->has_references;
+}
+
 static gboolean
 type_has_references (MonoClass *klass, MonoType *ftype)
 {
-       if (MONO_TYPE_IS_REFERENCE (ftype) || IS_GC_REFERENCE (klass, ftype) || ((MONO_TYPE_ISSTRUCT (ftype) && mono_class_has_references (mono_class_from_mono_type (ftype)))))
+       if (MONO_TYPE_IS_REFERENCE (ftype) || IS_GC_REFERENCE (klass, ftype) || ((MONO_TYPE_ISSTRUCT (ftype) && class_has_references (mono_class_from_mono_type (ftype)))))
                return TRUE;
        if (!ftype->byref && (ftype->type == MONO_TYPE_VAR || ftype->type == MONO_TYPE_MVAR)) {
                MonoGenericParam *gparam = ftype->data.generic_param;
 
                if (gparam->gshared_constraint)
-                       return mono_class_has_references (mono_class_from_mono_type (gparam->gshared_constraint));
+                       return class_has_references (mono_class_from_mono_type (gparam->gshared_constraint));
        }
        return FALSE;
 }
@@ -1849,28 +1743,60 @@ type_has_references (MonoClass *klass, MonoType *ftype)
 /*
  * mono_class_layout_fields:
  * @class: a class
- * @instance_size: base instance size
+ * @base_instance_size: base instance size
+ * @packing_size:
  *
- * Compute the placement of fields inside an object or struct, according to
- * the layout rules and set the following fields in @class:
- *  - has_references (if the class contains instance references firled or structs that contain references)
- *  - has_static_refs (same, but for static fields)
- *  - instance_size (size of the object in memory)
- *  - class_size (size needed for the static fields)
- *  - size_inited (flag set when the instance_size is set)
+ * This contains the common code for computing the layout of classes and sizes.
+ * This should only be called from mono_class_setup_fields () and
+ * typebuilder_setup_fields ().
  *
- * LOCKING: this is supposed to be called with the loader lock held.
+ * LOCKING: Acquires the loader lock
  */
 void
-mono_class_layout_fields (MonoClass *klass, int instance_size)
+mono_class_layout_fields (MonoClass *klass, int base_instance_size, int packing_size, gboolean sre)
 {
        int i;
-       const int top = klass->field.count;
-       guint32 layout = klass->flags & TYPE_ATTRIBUTE_LAYOUT_MASK;
+       const int top = mono_class_get_field_count (klass);
+       guint32 layout = mono_class_get_flags (klass) & TYPE_ATTRIBUTE_LAYOUT_MASK;
        guint32 pass, passes, real_size;
        gboolean gc_aware_layout = FALSE;
        gboolean has_static_fields = FALSE;
+       gboolean has_references = FALSE;
+       gboolean has_static_refs = FALSE;
        MonoClassField *field;
+       gboolean blittable;
+       int instance_size = base_instance_size;
+       int class_size, min_align;
+       int *field_offsets;
+       gboolean *fields_has_references;
+
+       /*
+        * We want to avoid doing complicated work inside locks, so we compute all the required
+        * information and write it to @klass inside a lock.
+        */
+       if (klass->fields_inited)
+               return;
+
+       if ((packing_size & 0xffffff00) != 0) {
+               mono_class_set_type_load_failure (klass, "Could not load struct '%s' with packing size %d >= 256", klass->name, packing_size);
+               return;
+       }
+
+       if (klass->parent) {
+               min_align = klass->parent->min_align;
+               /* we use | since it may have been set already */
+               has_references = klass->has_references | klass->parent->has_references;
+       } else {
+               min_align = 1;
+       }
+       /* We can't really enable 16 bytes alignment until the GC supports it.
+       The whole layout/instance size code must be reviewed because we do alignment calculation in terms of the
+       boxed instance, which leads to unexplainable holes at the beginning of an object embedding a simd type.
+       Bug #506144 is an example of this issue.
+
+        if (klass->simd_type)
+               min_align = 16;
+        */
 
        /*
         * When we do generic sharing we need to have layout
@@ -1879,6 +1805,21 @@ mono_class_layout_fields (MonoClass *klass, int instance_size)
         * container), so we don't return in that case anymore.
         */
 
+       if (klass->enumtype) {
+               for (i = 0; i < top; i++) {
+                       field = &klass->fields [i];
+                       if (!(field->type->attrs & FIELD_ATTRIBUTE_STATIC)) {
+                               klass->cast_class = klass->element_class = mono_class_from_mono_type (field->type);
+                               break;
+                       }
+               }
+
+               if (!mono_class_enum_basetype (klass)) {
+                       mono_class_set_type_load_failure (klass, "The enumeration's base type is invalid.");
+                       return;
+               }
+       }
+
        /*
         * Enable GC aware auto layout: in this mode, reference
         * fields are grouped together inside objects, increasing collector 
@@ -1894,59 +1835,74 @@ mono_class_layout_fields (MonoClass *klass, int instance_size)
                        gc_aware_layout = TRUE;
        }
 
-       /* Compute klass->has_references */
-       /* 
-        * Process non-static fields first, since static fields might recursively
-        * refer to the class itself.
-        */
+       /* Compute klass->blittable */
+       blittable = TRUE;
+       if (klass->parent)
+               blittable = klass->parent->blittable;
+       if (layout == TYPE_ATTRIBUTE_AUTO_LAYOUT && !(mono_is_corlib_image (klass->image) && !strcmp (klass->name_space, "System") && !strcmp (klass->name, "ValueType")) && top)
+               blittable = FALSE;
        for (i = 0; i < top; i++) {
-               MonoType *ftype;
-
                field = &klass->fields [i];
 
-               if (!(field->type->attrs & FIELD_ATTRIBUTE_STATIC)) {
-                       ftype = mono_type_get_underlying_type (field->type);
-                       ftype = mono_type_get_basic_type_from_generic (ftype);
-                       if (type_has_references (klass, ftype))
-                               klass->has_references = TRUE;
+               if (mono_field_is_deleted (field))
+                       continue;
+               if (field->type->attrs & FIELD_ATTRIBUTE_STATIC)
+                       continue;
+               if (blittable) {
+                       if (field->type->byref || MONO_TYPE_IS_REFERENCE (field->type)) {
+                               blittable = FALSE;
+                       } else {
+                               MonoClass *field_class = mono_class_from_mono_type (field->type);
+                               if (field_class) {
+                                       mono_class_setup_fields (field_class);
+                                       if (mono_class_has_failure (field_class)) {
+                                               MonoError field_error;
+                                               mono_error_init (&field_error);
+                                               mono_error_set_for_class_failure (&field_error, field_class);
+                                               mono_class_set_type_load_failure (klass, "Could not set up field '%s' due to: %s", field->name, mono_error_get_message (&field_error));
+                                               mono_error_cleanup (&field_error);
+                                               break;
+                                       }
+                               }
+                               if (!field_class || !field_class->blittable)
+                                       blittable = FALSE;
+                       }
                }
+               if (klass->enumtype)
+                       blittable = klass->element_class->blittable;
        }
+       if (mono_class_has_failure (klass))
+               return;
+       if (klass == mono_defaults.string_class)
+               blittable = FALSE;
 
+       /* Compute klass->has_references */
+       /* 
+        * Process non-static fields first, since static fields might recursively
+        * refer to the class itself.
+        */
        for (i = 0; i < top; i++) {
                MonoType *ftype;
 
                field = &klass->fields [i];
 
-               if (field->type->attrs & FIELD_ATTRIBUTE_STATIC) {
+               if (!(field->type->attrs & FIELD_ATTRIBUTE_STATIC)) {
                        ftype = mono_type_get_underlying_type (field->type);
                        ftype = mono_type_get_basic_type_from_generic (ftype);
                        if (type_has_references (klass, ftype))
-                               klass->has_static_refs = TRUE;
-               }
-       }
-
-       for (i = 0; i < top; i++) {
-               MonoType *ftype;
-
-               field = &klass->fields [i];
-
-               ftype = mono_type_get_underlying_type (field->type);
-               ftype = mono_type_get_basic_type_from_generic (ftype);
-               if (type_has_references (klass, ftype)) {
-                       if (field->type->attrs & FIELD_ATTRIBUTE_STATIC)
-                               klass->has_static_refs = TRUE;
-                       else
-                               klass->has_references = TRUE;
+                               has_references = TRUE;
                }
        }
 
        /*
         * Compute field layout and total size (not considering static fields)
         */
+       field_offsets = g_new0 (int, top);
+       fields_has_references = g_new0 (gboolean, top);
+       int first_field_idx = mono_class_has_static_metadata (klass) ? mono_class_get_first_field_idx (klass) : 0;
        switch (layout) {
        case TYPE_ATTRIBUTE_AUTO_LAYOUT:
        case TYPE_ATTRIBUTE_SEQUENTIAL_LAYOUT:
-
                if (gc_aware_layout)
                        passes = 2;
                else
@@ -1957,10 +1913,8 @@ mono_class_layout_fields (MonoClass *klass, int instance_size)
 
                if (klass->parent) {
                        mono_class_setup_fields (klass->parent);
-                       if (mono_class_has_failure (klass->parent)) {
-                               mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, NULL);
+                       if (mono_class_set_type_load_failure_causedby_class (klass, klass->parent, "Cannot initialize parent class"))
                                return;
-                       }
                        real_size = klass->parent->instance_size;
                } else {
                        real_size = sizeof (MonoObject);
@@ -1982,7 +1936,8 @@ mono_class_layout_fields (MonoClass *klass, int instance_size)
                                ftype = mono_type_get_underlying_type (field->type);
                                ftype = mono_type_get_basic_type_from_generic (ftype);
                                if (gc_aware_layout) {
-                                       if (type_has_references (klass, ftype)) {
+                                       fields_has_references [i] = type_has_references (klass, ftype);
+                                       if (fields_has_references [i]) {
                                                if (pass == 1)
                                                        continue;
                                        } else {
@@ -1991,7 +1946,7 @@ mono_class_layout_fields (MonoClass *klass, int instance_size)
                                        }
                                }
 
-                               if ((top == 1) && (klass->instance_size == sizeof (MonoObject)) &&
+                               if ((top == 1) && (instance_size == sizeof (MonoObject)) &&
                                        (strcmp (mono_field_get_name (field), "$PRIVATE$") == 0)) {
                                        /* This field is a hack inserted by MCS to empty structures */
                                        continue;
@@ -2000,29 +1955,32 @@ mono_class_layout_fields (MonoClass *klass, int instance_size)
                                size = mono_type_size (field->type, &align);
                        
                                /* FIXME (LAMESPEC): should we also change the min alignment according to pack? */
-                               align = klass->packing_size ? MIN (klass->packing_size, align): align;
+                               align = packing_size ? MIN (packing_size, align): align;
                                /* if the field has managed references, we need to force-align it
                                 * see bug #77788
                                 */
                                if (type_has_references (klass, ftype))
                                        align = MAX (align, sizeof (gpointer));
 
-                               klass->min_align = MAX (align, klass->min_align);
-                               field->offset = real_size;
+                               min_align = MAX (align, min_align);
+                               field_offsets [i] = real_size;
                                if (align) {
-                                       field->offset += align - 1;
-                                       field->offset &= ~(align - 1);
+                                       field_offsets [i] += align - 1;
+                                       field_offsets [i] &= ~(align - 1);
                                }
                                /*TypeBuilders produce all sort of weird things*/
-                               g_assert (image_is_dynamic (klass->image) || field->offset > 0);
-                               real_size = field->offset + size;
+                               g_assert (image_is_dynamic (klass->image) || field_offsets [i] > 0);
+                               real_size = field_offsets [i] + size;
                        }
 
+                       /* Make SIMD types as big as a SIMD register since they can be stored into using simd stores */
+                       if (klass->simd_type)
+                               real_size = MAX (real_size, sizeof (MonoObject) + 16);
                        instance_size = MAX (real_size, instance_size);
        
-                       if (instance_size & (klass->min_align - 1)) {
-                               instance_size += klass->min_align - 1;
-                               instance_size &= ~(klass->min_align - 1);
+                       if (instance_size & (min_align - 1)) {
+                               instance_size += min_align - 1;
+                               instance_size &= ~(min_align - 1);
                        }
                }
                break;
@@ -2047,28 +2005,30 @@ mono_class_layout_fields (MonoClass *klass, int instance_size)
                                continue;
 
                        size = mono_type_size (field->type, &align);
-                       align = klass->packing_size ? MIN (klass->packing_size, align): align;
-                       klass->min_align = MAX (align, klass->min_align);
+                       align = packing_size ? MIN (packing_size, align): align;
+                       min_align = MAX (align, min_align);
 
-                       /*
-                        * When we get here, field->offset is already set by the
-                        * loader (for either runtime fields or fields loaded from metadata).
-                        * The offset is from the start of the object: this works for both
-                        * classes and valuetypes.
-                        */
-                       field->offset += sizeof (MonoObject);
+                       if (sre) {
+                               /* Already set by typebuilder_setup_fields () */
+                               field_offsets [i] = field->offset + sizeof (MonoObject);
+                       } else {
+                               int idx = first_field_idx + i;
+                               guint32 offset;
+                               mono_metadata_field_info (klass->image, idx, &offset, NULL, NULL);
+                               field_offsets [i] = offset + sizeof (MonoObject);
+                       }
                        ftype = mono_type_get_underlying_type (field->type);
                        ftype = mono_type_get_basic_type_from_generic (ftype);
                        if (type_has_references (klass, ftype)) {
-                               if (field->offset % sizeof (gpointer)) {
-                                       mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, NULL);
+                               if (field_offsets [i] % sizeof (gpointer)) {
+                                       mono_class_set_type_load_failure (klass, "Reference typed field '%s' has explicit offset that is not pointer-size aligned.", field->name);
                                }
                        }
 
                        /*
                         * Calc max size.
                         */
-                       real_size = MAX (real_size, size + field->offset);
+                       real_size = MAX (real_size, size + field_offsets [i]);
                }
 
                if (klass->has_references) {
@@ -2086,7 +2046,7 @@ mono_class_layout_fields (MonoClass *klass, int instance_size)
                                        continue;
                                ftype = mono_type_get_underlying_type (field->type);
                                if (MONO_TYPE_IS_REFERENCE (ftype))
-                                       ref_bitmap [field->offset / sizeof (gpointer)] = 1;
+                                       ref_bitmap [field_offsets [i] / sizeof (gpointer)] = 1;
                        }
                        for (i = 0; i < top; i++) {
                                field = &klass->fields [i];
@@ -2098,9 +2058,8 @@ mono_class_layout_fields (MonoClass *klass, int instance_size)
 
                                // FIXME: Too much code does this
 #if 0
-                               if (!MONO_TYPE_IS_REFERENCE (field->type) && ref_bitmap [field->offset / sizeof (gpointer)]) {
-                                       char *err_msg = g_strdup_printf ("Could not load type '%s' because it contains an object field at offset %d that is incorrectly aligned or overlapped by a non-object field.", klass->name, field->offset);
-                                       mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, err_msg);
+                               if (!MONO_TYPE_IS_REFERENCE (field->type) && ref_bitmap [field_offsets [i] / sizeof (gpointer)]) {
+                                       mono_class_set_type_load_failure (klass, "Could not load type '%s' because it contains an object field at offset %d that is incorrectly aligned or overlapped by a non-object field.", klass->name, field_offsets [i]);
                                }
 #endif
                        }
@@ -2108,9 +2067,9 @@ mono_class_layout_fields (MonoClass *klass, int instance_size)
                }
 
                instance_size = MAX (real_size, instance_size);
-               if (instance_size & (klass->min_align - 1)) {
-                       instance_size += klass->min_align - 1;
-                       instance_size &= ~(klass->min_align - 1);
+               if (instance_size & (min_align - 1)) {
+                       instance_size += min_align - 1;
+                       instance_size &= ~(min_align - 1);
                }
                break;
        }
@@ -2125,25 +2084,58 @@ mono_class_layout_fields (MonoClass *klass, int instance_size)
                 * performance, and since the JIT memset/memcpy code assumes this and generates 
                 * unaligned accesses otherwise. See #78990 for a testcase.
                 */
-               if (mono_align_small_structs) {
+               if (mono_align_small_structs && top) {
                        if (instance_size <= sizeof (MonoObject) + sizeof (gpointer))
-                               klass->min_align = MAX (klass->min_align, instance_size - sizeof (MonoObject));
+                               min_align = MAX (min_align, instance_size - sizeof (MonoObject));
                }
        }
 
+       if (klass->byval_arg.type == MONO_TYPE_VAR || klass->byval_arg.type == MONO_TYPE_MVAR)
+               instance_size = sizeof (MonoObject) + mono_type_stack_size_internal (&klass->byval_arg, NULL, TRUE);
+       else if (klass->byval_arg.type == MONO_TYPE_PTR)
+               instance_size = sizeof (MonoObject) + sizeof (gpointer);
+
+       /* Publish the data */
+       mono_loader_lock ();
        if (klass->instance_size && !klass->image->dynamic) {
                /* Might be already set using cached info */
+               if (klass->instance_size != instance_size) {
+                       /* Emit info to help debugging */
+                       g_print ("%s\n", mono_class_full_name (klass));
+                       g_print ("%d %d %d %d\n", klass->instance_size, instance_size, klass->blittable, blittable);
+                       g_print ("%d %d %d %d\n", klass->has_references, has_references, klass->packing_size, packing_size);
+                       g_print ("%d %d\n", klass->min_align, min_align);
+                       for (i = 0; i < top; ++i) {
+                               field = &klass->fields [i];
+                               if (!(field->type->attrs & FIELD_ATTRIBUTE_STATIC))
+                                       printf ("  %s %d %d %d\n", klass->fields [i].name, klass->fields [i].offset, field_offsets [i], fields_has_references [i]);
+                       }
+               }
                g_assert (klass->instance_size == instance_size);
        } else {
                klass->instance_size = instance_size;
        }
+       klass->blittable = blittable;
+       klass->has_references = has_references;
+       klass->packing_size = packing_size;
+       klass->min_align = min_align;
+       for (i = 0; i < top; ++i) {
+               field = &klass->fields [i];
+               if (!(field->type->attrs & FIELD_ATTRIBUTE_STATIC))
+                       klass->fields [i].offset = field_offsets [i];
+       }
+
        mono_memory_barrier ();
        klass->size_inited = 1;
+       mono_loader_unlock ();
 
        /*
         * Compute static field layout and size
+        * Static fields can reference the class itself, so this has to be
+        * done after instance_size etc. are initialized.
         */
-       for (i = 0; i < top; i++){
+       class_size = 0;
+       for (i = 0; i < top; i++) {
                gint32 align;
                guint32 size;
 
@@ -2155,23 +2147,61 @@ mono_class_layout_fields (MonoClass *klass, int instance_size)
                        continue;
 
                if (mono_type_has_exceptions (field->type)) {
-                       mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, NULL);
+                       mono_class_set_type_load_failure (klass, "Field '%s' has an invalid type.", field->name);
                        break;
                }
 
                has_static_fields = TRUE;
 
                size = mono_type_size (field->type, &align);
-               field->offset = klass->sizes.class_size;
+               field_offsets [i] = class_size;
                /*align is always non-zero here*/
-               field->offset += align - 1;
-               field->offset &= ~(align - 1);
-               klass->sizes.class_size = field->offset + size;
+               field_offsets [i] += align - 1;
+               field_offsets [i] &= ~(align - 1);
+               class_size = field_offsets [i] + size;
        }
 
-       if (has_static_fields && klass->sizes.class_size == 0)
+       if (has_static_fields && class_size == 0)
                /* Simplify code which depends on class_size != 0 if the class has static fields */
-               klass->sizes.class_size = 8;
+               class_size = 8;
+
+       /* Compute klass->has_static_refs */
+       has_static_refs = FALSE;
+       for (i = 0; i < top; i++) {
+               MonoType *ftype;
+
+               field = &klass->fields [i];
+
+               if (field->type->attrs & FIELD_ATTRIBUTE_STATIC) {
+                       ftype = mono_type_get_underlying_type (field->type);
+                       ftype = mono_type_get_basic_type_from_generic (ftype);
+                       if (type_has_references (klass, ftype))
+                               has_static_refs = TRUE;
+               }
+       }
+
+       /*valuetypes can't be neither bigger than 1Mb or empty. */
+       if (klass->valuetype && (klass->instance_size <= 0 || klass->instance_size > (0x100000 + sizeof (MonoObject))))
+               mono_class_set_type_load_failure (klass, "Value type instance size (%d) cannot be zero, negative, or bigger than 1Mb", klass->instance_size);
+
+       /* Publish the data */
+       mono_loader_lock ();
+       if (!klass->rank)
+               klass->sizes.class_size = class_size;
+       klass->has_static_refs = has_static_refs;
+       for (i = 0; i < top; ++i) {
+               field = &klass->fields [i];
+
+               if (field->type->attrs & FIELD_ATTRIBUTE_STATIC)
+                       field->offset = field_offsets [i];
+       }
+
+       mono_memory_barrier ();
+       klass->fields_inited = 1;
+       mono_loader_unlock ();
+
+       g_free (field_offsets);
+       g_free (fields_has_references);
 }
 
 static MonoMethod*
@@ -2205,7 +2235,7 @@ create_array_method (MonoClass *klass, const char *name, MonoMethodSignature *si
  * Methods belonging to an interface are assigned a sequential slot starting
  * from 0.
  *
- * On failure this function sets klass->exception_type
+ * On failure this function sets klass->has_failure and stores a MonoErrorBoxed with details
  */
 void
 mono_class_setup_methods (MonoClass *klass)
@@ -2216,21 +2246,18 @@ mono_class_setup_methods (MonoClass *klass)
        if (klass->methods)
                return;
 
-       if (klass->generic_class) {
+       if (mono_class_is_ginst (klass)) {
                MonoError error;
-               MonoClass *gklass = klass->generic_class->container_class;
+               MonoClass *gklass = mono_class_get_generic_class (klass)->container_class;
 
                mono_class_init (gklass);
                if (!mono_class_has_failure (gklass))
                        mono_class_setup_methods (gklass);
-               if (mono_class_has_failure (gklass)) {
-                       /* FIXME make exception_data less opaque so it's possible to dup it here */
-                       mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, g_strdup ("Generic type definition failed to load"));
+               if (mono_class_set_type_load_failure_causedby_class (klass, gklass, "Generic type definition failed to load"))
                        return;
-               }
 
                /* The + 1 makes this always non-NULL to pass the check in mono_class_setup_methods () */
-               count = gklass->method.count;
+               count = mono_class_get_method_count (gklass);
                methods = (MonoMethod **)mono_class_alloc0 (klass, sizeof (MonoMethod*) * (count + 1));
 
                for (i = 0; i < count; i++) {
@@ -2238,7 +2265,7 @@ mono_class_setup_methods (MonoClass *klass)
                                gklass->methods [i], klass, mono_class_get_context (klass), &error);
                        if (!mono_error_ok (&error)) {
                                char *method = mono_method_full_name (gklass->methods [i], TRUE);
-                               mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, g_strdup_printf ("Could not inflate method %s due to %s", method, mono_error_get_message (&error)));
+                               mono_class_set_type_load_failure (klass, "Could not inflate method %s due to %s", method, mono_error_get_message (&error));
 
                                g_free (method);
                                mono_error_cleanup (&error);
@@ -2260,7 +2287,7 @@ mono_class_setup_methods (MonoClass *klass)
 
                if (klass->rank == 1 && klass->element_class->rank) {
                        jagged_ctor = TRUE;
-                       klass->method.count ++;
+                       count ++;
                }
 
                if (klass->interface_count) {
@@ -2335,19 +2362,23 @@ mono_class_setup_methods (MonoClass *klass)
 
                for (i = 0; i < klass->interface_count; i++)
                        setup_generic_array_ifaces (klass, klass->interfaces [i], methods, first_generic + i * count_generic);
-       } else {
+       } else if (mono_class_has_static_metadata (klass)) {
                MonoError error;
+               int first_idx = mono_class_get_first_method_idx (klass);
 
-               count = klass->method.count;
+               count = mono_class_get_method_count (klass);
                methods = (MonoMethod **)mono_class_alloc (klass, sizeof (MonoMethod*) * count);
                for (i = 0; i < count; ++i) {
-                       int idx = mono_metadata_translate_token_index (klass->image, MONO_TABLE_METHOD, klass->method.first + i + 1);
+                       int idx = mono_metadata_translate_token_index (klass->image, MONO_TABLE_METHOD, first_idx + i + 1);
                        methods [i] = mono_get_method_checked (klass->image, MONO_TOKEN_METHOD_DEF | idx, klass, NULL, &error);
                        if (!methods [i]) {
-                               mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, g_strdup_printf ("Could not load method %d due to %s", i, mono_error_get_message (&error)));
+                               mono_class_set_type_load_failure (klass, "Could not load method %d due to %s", i, mono_error_get_message (&error));
                                mono_error_cleanup (&error);
                        }
                }
+       } else {
+               methods = (MonoMethod **)mono_class_alloc (klass, sizeof (MonoMethod*) * 1);
+               count = 0;
        }
 
        if (MONO_CLASS_IS_INTERFACE (klass)) {
@@ -2362,7 +2393,7 @@ mono_class_setup_methods (MonoClass *klass)
        mono_image_lock (klass->image);
 
        if (!klass->methods) {
-               klass->method.count = count;
+               mono_class_set_method_count (klass, count);
 
                /* Needed because of the double-checking locking pattern */
                mono_memory_barrier ();
@@ -2384,13 +2415,14 @@ MonoMethod*
 mono_class_get_method_by_index (MonoClass *klass, int index)
 {
        MonoError error;
+
+       MonoGenericClass *gklass = mono_class_try_get_generic_class (klass);
        /* Avoid calling setup_methods () if possible */
-       if (klass->generic_class && !klass->methods) {
-               MonoClass *gklass = klass->generic_class->container_class;
+       if (gklass && !klass->methods) {
                MonoMethod *m;
 
                m = mono_class_inflate_generic_method_full_checked (
-                               gklass->methods [index], klass, mono_class_get_context (klass), &error);
+                               gklass->container_class->methods [index], klass, mono_class_get_context (klass), &error);
                g_assert (mono_error_ok (&error)); /* FIXME don't swallow the error */
                /*
                 * If setup_methods () is called later for this class, no duplicates are created,
@@ -2406,7 +2438,7 @@ mono_class_get_method_by_index (MonoClass *klass, int index)
                mono_class_setup_methods (klass);
                if (mono_class_has_failure (klass)) /*FIXME do proper error handling*/
                        return NULL;
-               g_assert (index >= 0 && index < klass->method.count);
+               g_assert (index >= 0 && index < mono_class_get_method_count (klass));
                return klass->methods [index];
        }
 }      
@@ -2420,15 +2452,16 @@ mono_class_get_method_by_index (MonoClass *klass, int index)
 MonoMethod*
 mono_class_get_inflated_method (MonoClass *klass, MonoMethod *method)
 {
-       MonoClass *gklass = klass->generic_class->container_class;
-       int i;
+       MonoClass *gklass = mono_class_get_generic_class (klass)->container_class;
+       int i, mcount;
 
        g_assert (method->klass == gklass);
 
        mono_class_setup_methods (gklass);
        g_assert (!mono_class_has_failure (gklass)); /*FIXME do proper error handling*/
 
-       for (i = 0; i < gklass->method.count; ++i) {
+       mcount = mono_class_get_method_count (gklass);
+       for (i = 0; i < mcount; ++i) {
                if (gklass->methods [i] == method) {
                        if (klass->methods) {
                                return klass->methods [i];
@@ -2465,9 +2498,9 @@ mono_class_get_vtable_entry (MonoClass *klass, int offset)
                        return klass->parent->vtable [offset];
        }
 
-       if (klass->generic_class) {
+       if (mono_class_is_ginst (klass)) {
                MonoError error;
-               MonoClass *gklass = klass->generic_class->container_class;
+               MonoClass *gklass = mono_class_get_generic_class (klass)->container_class;
                mono_class_setup_vtable (gklass);
                m = gklass->vtable [offset];
 
@@ -2513,26 +2546,26 @@ mono_class_setup_properties (MonoClass *klass)
        guint32 last;
        int first, count;
 
-       if (klass->ext && klass->ext->properties)
+       MonoClassExt *ext = mono_class_get_ext (klass);
+       if (ext && ext->properties)
                return;
 
-       if (klass->generic_class) {
-               MonoClass *gklass = klass->generic_class->container_class;
+       if (mono_class_is_ginst (klass)) {
+               MonoClass *gklass = mono_class_get_generic_class (klass)->container_class;
 
                mono_class_init (gklass);
                mono_class_setup_properties (gklass);
-               if (mono_class_has_failure (gklass)) {
-                       mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, g_strdup ("Generic type definition failed to load"));
+               if (mono_class_set_type_load_failure_causedby_class (klass, gklass, "Generic type definition failed to load"))
                        return;
-               }
 
-               properties = mono_class_new0 (klass, MonoProperty, gklass->ext->property.count + 1);
+               MonoClassExt *gext = mono_class_get_ext (gklass);
+               properties = mono_class_new0 (klass, MonoProperty, gext->property.count + 1);
 
-               for (i = 0; i < gklass->ext->property.count; i++) {
+               for (i = 0; i < gext->property.count; i++) {
                        MonoError error;
                        MonoProperty *prop = &properties [i];
 
-                       *prop = gklass->ext->properties [i];
+                       *prop = gext->properties [i];
 
                        if (prop->get)
                                prop->get = mono_class_inflate_generic_method_full_checked (
@@ -2545,8 +2578,8 @@ mono_class_setup_properties (MonoClass *klass)
                        prop->parent = klass;
                }
 
-               first = gklass->ext->property.first;
-               count = gklass->ext->property.count;
+               first = gext->property.first;
+               count = gext->property.count;
        } else {
                first = mono_metadata_properties_from_typedef (klass->image, mono_metadata_token_index (klass->type_token) - 1, &last);
                count = last - first;
@@ -2565,6 +2598,7 @@ mono_class_setup_properties (MonoClass *klass)
                        properties [i - first].name = mono_metadata_string_heap (klass->image, cols [MONO_PROPERTY_NAME]);
 
                        startm = mono_metadata_methods_from_property (klass->image, i, &endm);
+                       int first_idx = mono_class_get_first_method_idx (klass);
                        for (j = startm; j < endm; ++j) {
                                MonoMethod *method;
 
@@ -2576,7 +2610,7 @@ mono_class_setup_properties (MonoClass *klass)
                                        method = mono_get_method_checked (klass->image, MONO_TOKEN_METHOD_DEF | cols [MONO_METHOD_SEMA_METHOD], klass, NULL, &error);
                                        mono_error_cleanup (&error); /* FIXME don't swallow this error */
                                } else {
-                                       method = klass->methods [cols [MONO_METHOD_SEMA_METHOD] - 1 - klass->method.first];
+                                       method = klass->methods [cols [MONO_METHOD_SEMA_METHOD] - 1 - first_idx];
                                }
 
                                switch (cols [MONO_METHOD_SEMA_SEMANTICS]) {
@@ -2594,23 +2628,24 @@ mono_class_setup_properties (MonoClass *klass)
        }
 
        mono_class_alloc_ext (klass);
+       ext = mono_class_get_ext (klass);
 
        mono_image_lock (klass->image);
 
-       if (klass->ext->properties) {
+       if (ext->properties) {
                /* We leak 'properties' which was allocated from the image mempool */
                mono_image_unlock (klass->image);
                return;
        }
 
-       klass->ext->property.first = first;
-       klass->ext->property.count = count;
+       ext->property.first = first;
+       ext->property.count = count;
 
        /* Flush any pending writes as we do double checked locking on klass->ext->properties */
        mono_memory_barrier ();
 
        /* Leave this assignment as the last op in the function */
-       klass->ext->properties = properties;
+       ext->properties = properties;
 
        mono_image_unlock (klass->image);
 }
@@ -2646,21 +2681,21 @@ mono_class_setup_events (MonoClass *klass)
        guint32 last;
        MonoEvent *events;
 
-       if (klass->ext && klass->ext->events)
+       MonoClassExt *ext = mono_class_get_ext (klass);
+       if (ext && ext->events)
                return;
 
-       if (klass->generic_class) {
-               MonoClass *gklass = klass->generic_class->container_class;
+       if (mono_class_is_ginst (klass)) {
+               MonoClass *gklass = mono_class_get_generic_class (klass)->container_class;
                MonoGenericContext *context = NULL;
 
                mono_class_setup_events (gklass);
-               if (mono_class_has_failure (gklass)) {
-                       mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, g_strdup ("Generic type definition failed to load"));
+               if (mono_class_set_type_load_failure_causedby_class (klass, gklass, "Generic type definition failed to load"))
                        return;
-               }
 
-               first = gklass->ext->event.first;
-               count = gklass->ext->event.count;
+               MonoClassExt *gext = mono_class_get_ext (gklass);
+               first = gext->event.first;
+               count = gext->event.count;
 
                events = mono_class_new0 (klass, MonoEvent, count);
 
@@ -2670,7 +2705,7 @@ mono_class_setup_events (MonoClass *klass)
                for (i = 0; i < count; i++) {
                        MonoError error;
                        MonoEvent *event = &events [i];
-                       MonoEvent *gevent = &gklass->ext->events [i];
+                       MonoEvent *gevent = &gext->events [i];
 
                        mono_error_init (&error); //since we do conditional calls, we must ensure the default value is ok
 
@@ -2695,7 +2730,6 @@ mono_class_setup_events (MonoClass *klass)
                if (count) {
                        mono_class_setup_methods (klass);
                        if (mono_class_has_failure (klass)) {
-                               mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, g_strdup ("Generic type definition failed to load"));
                                return;
                        }
                }
@@ -2710,6 +2744,7 @@ mono_class_setup_events (MonoClass *klass)
                        event->name = mono_metadata_string_heap (klass->image, cols [MONO_EVENT_NAME]);
 
                        startm = mono_metadata_methods_from_event (klass->image, i, &endm);
+                       int first_idx = mono_class_get_first_method_idx (klass);
                        for (j = startm; j < endm; ++j) {
                                MonoMethod *method;
 
@@ -2721,7 +2756,7 @@ mono_class_setup_events (MonoClass *klass)
                                        method = mono_get_method_checked (klass->image, MONO_TOKEN_METHOD_DEF | cols [MONO_METHOD_SEMA_METHOD], klass, NULL, &error);
                                        mono_error_cleanup (&error); /* FIXME don't swallow this error */
                                } else {
-                                       method = klass->methods [cols [MONO_METHOD_SEMA_METHOD] - 1 - klass->method.first];
+                                       method = klass->methods [cols [MONO_METHOD_SEMA_METHOD] - 1 - first_idx];
                                }
 
                                switch (cols [MONO_METHOD_SEMA_SEMANTICS]) {
@@ -2759,22 +2794,23 @@ mono_class_setup_events (MonoClass *klass)
        }
 
        mono_class_alloc_ext (klass);
+       ext = mono_class_get_ext (klass);
 
        mono_image_lock (klass->image);
 
-       if (klass->ext->events) {
+       if (ext->events) {
                mono_image_unlock (klass->image);
                return;
        }
 
-       klass->ext->event.first = first;
-       klass->ext->event.count = count;
+       ext->event.first = first;
+       ext->event.count = count;
 
        /* Flush any pending writes as we do double checked locking on klass->ext.events */
        mono_memory_barrier ();
 
        /* Leave this assignment as the last op in the function */
-       klass->ext->events = events;
+       ext->events = events;
 
        mono_image_unlock (klass->image);
 }
@@ -2820,7 +2856,7 @@ mono_unload_interface_id (MonoClass *klass)
  * LOCKING: Acquires the classes lock.
  * Returns: The new ID.
  */
-static guint
+static guint32
 mono_get_unique_iid (MonoClass *klass)
 {
        int iid;
@@ -2843,7 +2879,7 @@ mono_get_unique_iid (MonoClass *klass)
        }
        mono_bitset_set (global_interface_bitset, iid);
        /* set the bit also in the per-image set */
-       if (!klass->generic_class) {
+       if (!mono_class_is_ginst (klass)) {
                if (klass->image->interface_bitset) {
                        if (iid >= mono_bitset_size (klass->image->interface_bitset)) {
                                MonoBitSet *new_set = mono_bitset_clone (klass->image->interface_bitset, iid + 1);
@@ -2862,8 +2898,9 @@ mono_get_unique_iid (MonoClass *klass)
        if (mono_print_vtable) {
                int generic_id;
                char *type_name = mono_type_full_name (&klass->byval_arg);
-               if (klass->generic_class && !klass->generic_class->context.class_inst->is_open) {
-                       generic_id = klass->generic_class->context.class_inst->id;
+               MonoGenericClass *gklass = mono_class_try_get_generic_class (klass);
+               if (gklass && !gklass->context.class_inst->is_open) {
+                       generic_id = gklass->context.class_inst->id;
                        g_assert (generic_id != 0);
                } else {
                        generic_id = 0;
@@ -2873,7 +2910,9 @@ mono_get_unique_iid (MonoClass *klass)
        }
 #endif
 
-       g_assert (iid <= 65535);
+       /* I've confirmed iids safe past 16 bits, however bitset code uses a signed int while testing.
+        * Once this changes, it should be safe for us to allow 2^32-1 interfaces, until then 2^31-2 is the max. */
+       g_assert (iid < INT_MAX);
        return iid;
 }
 
@@ -2987,7 +3026,7 @@ print_implemented_interfaces (MonoClass *klass) {
                printf ("  [%03d][UUID %03d][SLOT %03d][SIZE  %03d] interface %s.%s\n", i,
                                klass->interfaces_packed [i]->interface_id,
                                klass->interface_offsets_packed [i],
-                               klass->interfaces_packed [i]->method.count,
+                               mono_class_get_method_count (klass->interfaces_packed [i]),
                                klass->interfaces_packed [i]->name_space,
                                klass->interfaces_packed [i]->name );
        printf ("Interface flags: ");
@@ -3026,7 +3065,7 @@ print_implemented_interfaces (MonoClass *klass) {
                                printf ("  [%03d][UUID %03d][SLOT %03d][SIZE  %03d] interface %s.%s\n", i,
                                                ic->interface_id,
                                                mono_class_interface_offset (klass, ic),
-                                               ic->method.count,
+                                               mono_class_get_method_count (ic),
                                                ic->name_space,
                                                ic->name );
                        }
@@ -3076,6 +3115,12 @@ fill_valuetype_array_derived_types (MonoClass **valuetype_types, MonoClass *ecla
                valuetype_types [1] = mono_class_from_mono_type (mono_class_enum_basetype (eclass));
 }
 
+static GENERATE_GET_CLASS_WITH_CACHE (generic_icollection, System.Collections.Generic, ICollection`1)
+static GENERATE_GET_CLASS_WITH_CACHE (generic_ienumerable, System.Collections.Generic, IEnumerable`1)
+static GENERATE_GET_CLASS_WITH_CACHE (generic_ienumerator, System.Collections.Generic, IEnumerator`1)
+static GENERATE_GET_CLASS_WITH_CACHE (generic_ireadonlylist, System.Collections.Generic, IReadOnlyList`1)
+static GENERATE_GET_CLASS_WITH_CACHE (generic_ireadonlycollection, System.Collections.Generic, IReadOnlyCollection`1)
+
 /* this won't be needed once bug #325495 is completely fixed
  * though we'll need something similar to know which interfaces to allow
  * in arrays when they'll be lazyly created
@@ -3093,11 +3138,11 @@ static MonoClass**
 get_implicit_generic_array_interfaces (MonoClass *klass, int *num, int *is_enumerator)
 {
        MonoClass *eclass = klass->element_class;
-       static MonoClass* generic_icollection_class = NULL;
-       static MonoClass* generic_ienumerable_class = NULL;
-       static MonoClass* generic_ienumerator_class = NULL;
-       static MonoClass* generic_ireadonlylist_class = NULL;
-       static MonoClass* generic_ireadonlycollection_class = NULL;
+       MonoClass* generic_icollection_class;
+       MonoClass* generic_ienumerable_class;
+       MonoClass* generic_ienumerator_class;
+       MonoClass* generic_ireadonlylist_class;
+       MonoClass* generic_ireadonlycollection_class;
        MonoClass *valuetype_types[2] = { NULL, NULL };
        MonoClass **interfaces = NULL;
        int i, nifaces, interface_count, real_count, original_rank;
@@ -3113,11 +3158,12 @@ get_implicit_generic_array_interfaces (MonoClass *klass, int *num, int *is_enume
        eclass_is_valuetype = FALSE;
        original_rank = eclass->rank;
        if (klass->byval_arg.type != MONO_TYPE_SZARRAY) {
-               if (klass->generic_class && klass->nested_in == mono_defaults.array_class && strcmp (klass->name, "InternalEnumerator`1") == 0)  {
+               MonoGenericClass *gklass = mono_class_try_get_generic_class (klass);
+               if (gklass && klass->nested_in == mono_defaults.array_class && strcmp (klass->name, "InternalEnumerator`1") == 0)        {
                        /*
                         * For a Enumerator<T[]> we need to get the list of interfaces for T.
                         */
-                       eclass = mono_class_from_mono_type (klass->generic_class->context.class_inst->type_argv [0]);
+                       eclass = mono_class_from_mono_type (gklass->context.class_inst->type_argv [0]);
                        original_rank = eclass->rank;
                        if (!eclass->rank)
                                eclass = eclass->element_class;
@@ -3135,18 +3181,11 @@ get_implicit_generic_array_interfaces (MonoClass *klass, int *num, int *is_enume
         */
        all_interfaces = eclass->rank && eclass->element_class->rank? FALSE: TRUE;
 
-       if (!generic_icollection_class) {
-               generic_icollection_class = mono_class_load_from_name (mono_defaults.corlib,
-                       "System.Collections.Generic", "ICollection`1");
-               generic_ienumerable_class = mono_class_load_from_name (mono_defaults.corlib,
-                       "System.Collections.Generic", "IEnumerable`1");
-               generic_ienumerator_class = mono_class_load_from_name (mono_defaults.corlib,
-                       "System.Collections.Generic", "IEnumerator`1");
-               generic_ireadonlylist_class = mono_class_load_from_name (mono_defaults.corlib,
-                       "System.Collections.Generic", "IReadOnlyList`1");
-               generic_ireadonlycollection_class = mono_class_load_from_name (mono_defaults.corlib,
-                       "System.Collections.Generic", "IReadOnlyCollection`1");
-       }
+       generic_icollection_class = mono_class_get_generic_icollection_class ();
+       generic_ienumerable_class = mono_class_get_generic_ienumerable_class ();
+       generic_ienumerator_class = mono_class_get_generic_ienumerator_class ();
+       generic_ireadonlylist_class = mono_class_get_generic_ireadonlylist_class ();
+       generic_ireadonlycollection_class = mono_class_get_generic_ireadonlycollection_class ();
 
        mono_class_init (eclass);
 
@@ -3322,7 +3361,7 @@ find_array_interface (MonoClass *klass, const char *name)
 static int
 count_virtual_methods (MonoClass *klass)
 {
-       int i, count = 0;
+       int i, mcount, vcount = 0;
        guint32 flags;
        klass = mono_class_get_generic_type_definition (klass); /*We can find this information by looking at the GTD*/
 
@@ -3331,20 +3370,23 @@ count_virtual_methods (MonoClass *klass)
                if (mono_class_has_failure (klass))
                        return -1;
 
-               for (i = 0; i < klass->method.count; ++i) {
+               mcount = mono_class_get_method_count (klass);
+               for (i = 0; i < mcount; ++i) {
                        flags = klass->methods [i]->flags;
                        if (flags & METHOD_ATTRIBUTE_VIRTUAL)
-                               ++count;
+                               ++vcount;
                }
        } else {
-               for (i = 0; i < klass->method.count; ++i) {
-                       flags = mono_metadata_decode_table_row_col (klass->image, MONO_TABLE_METHOD, klass->method.first + i, MONO_METHOD_FLAGS);
+               int first_idx = mono_class_get_first_method_idx (klass);
+               mcount = mono_class_get_method_count (klass);
+               for (i = 0; i < mcount; ++i) {
+                       flags = mono_metadata_decode_table_row_col (klass->image, MONO_TABLE_METHOD, first_idx + i, MONO_METHOD_FLAGS);
 
                        if (flags & METHOD_ATTRIBUTE_VIRTUAL)
-                               ++count;
+                               ++vcount;
                }
        }
-       return count;
+       return vcount;
 }
 
 static int
@@ -3512,15 +3554,16 @@ mono_class_interface_match (const uint8_t *bitmap, int id)
 #endif
 
 /*
- * LOCKING: this is supposed to be called with the loader lock held.
- * Return -1 on failure and set exception_type
+ * Return -1 on failure and set klass->has_failure and store a MonoErrorBoxed with the details.
+ * LOCKING: Acquires the loader lock.
  */
 static int
 setup_interface_offsets (MonoClass *klass, int cur_slot, gboolean overwrite)
 {
        MonoError error;
        MonoClass *k, *ic;
-       int i, j, max_iid, num_ifaces;
+       int i, j, num_ifaces;
+       guint32 max_iid;
        MonoClass **interfaces_full = NULL;
        int *interface_offsets_full = NULL;
        GPtrArray *ifaces;
@@ -3530,6 +3573,8 @@ setup_interface_offsets (MonoClass *klass, int cur_slot, gboolean overwrite)
        int num_array_interfaces;
        int is_enumerator = FALSE;
 
+       mono_loader_lock ();
+
        mono_class_setup_supertypes (klass);
        /* 
         * get the implicit generic interfaces for either the arrays or for System.Array/InternalEnumerator<T>
@@ -3544,12 +3589,12 @@ setup_interface_offsets (MonoClass *klass, int cur_slot, gboolean overwrite)
        ifaces_array = g_new0 (GPtrArray *, klass->idepth);
        for (j = 0; j < klass->idepth; j++) {
                k = klass->supertypes [j];
+               g_assert (k);
                num_ifaces += k->interface_count;
                for (i = 0; i < k->interface_count; i++) {
                        ic = k->interfaces [i];
 
-                       if (!ic->inited)
-                               mono_class_init (ic);
+                       mono_class_init (ic);
 
                        if (max_iid < ic->interface_id)
                                max_iid = ic->interface_id;
@@ -3557,7 +3602,7 @@ setup_interface_offsets (MonoClass *klass, int cur_slot, gboolean overwrite)
                ifaces = mono_class_get_implemented_interfaces (k, &error);
                if (!mono_error_ok (&error)) {
                        char *name = mono_type_get_full_name (k);
-                       mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, g_strdup_printf ("Error getting the interfaces of %s due to %s", name, mono_error_get_message (&error)));
+                       mono_class_set_type_load_failure (klass, "Error getting the interfaces of %s due to %s", name, mono_error_get_message (&error));
                        g_free (name);
                        mono_error_cleanup (&error);
                        cur_slot = -1;
@@ -3586,14 +3631,13 @@ setup_interface_offsets (MonoClass *klass, int cur_slot, gboolean overwrite)
                if (max_iid < klass->interface_id)
                        max_iid = klass->interface_id;
        }
-       klass->max_interface_id = max_iid;
+
        /* compute vtable offset for interfaces */
        interfaces_full = (MonoClass **)g_malloc0 (sizeof (MonoClass*) * num_ifaces);
        interface_offsets_full = (int *)g_malloc (sizeof (int) * num_ifaces);
 
-       for (i = 0; i < num_ifaces; i++) {
+       for (i = 0; i < num_ifaces; i++)
                interface_offsets_full [i] = -1;
-       }
 
        /* skip the current class */
        for (j = 0; j < klass->idepth - 1; j++) {
@@ -3624,7 +3668,7 @@ setup_interface_offsets (MonoClass *klass, int cur_slot, gboolean overwrite)
                        count = count_virtual_methods (ic);
                        if (count == -1) {
                                char *name = mono_type_get_full_name (ic);
-                               mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, g_strdup_printf ("Error calculating interface offset of %s", name));
+                               mono_class_set_type_load_failure (klass, "Error calculating interface offset of %s", name);
                                g_free (name);
                                cur_slot = -1;
                                goto end;
@@ -3667,7 +3711,7 @@ setup_interface_offsets (MonoClass *klass, int cur_slot, gboolean overwrite)
                        for (i = 0; i < num_array_interfaces; ++i) {
                                int offset;
                                ic = array_interfaces [i];
-                               if (ic->generic_class->container_class == mono_defaults.generic_ilist_class)
+                               if (mono_class_get_generic_class (ic)->container_class == mono_defaults.generic_ilist_class)
                                        offset = ilist_offset;
                                else if (strcmp (ic->name, "ICollection`1") == 0)
                                        offset = icollection_offset;
@@ -3686,11 +3730,12 @@ setup_interface_offsets (MonoClass *klass, int cur_slot, gboolean overwrite)
        }
 
        for (interface_offsets_count = 0, i = 0; i < num_ifaces; i++) {
-               if (interface_offsets_full [i] != -1) {
+               if (interface_offsets_full [i] != -1)
                        interface_offsets_count ++;
-               }
        }
 
+       /* Publish the data */
+       klass->max_interface_id = max_iid;
        /*
         * We might get called multiple times:
         * - mono_class_init ()
@@ -3715,7 +3760,7 @@ setup_interface_offsets (MonoClass *klass, int cur_slot, gboolean overwrite)
                bitmap = (uint8_t *)mono_class_alloc0 (klass, bsize);
 #endif
                for (i = 0; i < interface_offsets_count; i++) {
-                       int id = interfaces_full [i]->interface_id;
+                       guint32 id = interfaces_full [i]->interface_id;
                        bitmap [id >> 3] |= (1 << (id & 7));
                        klass->interfaces_packed [i] = interfaces_full [i];
                        klass->interface_offsets_packed [i] = interface_offsets_full [i];
@@ -3731,8 +3776,9 @@ setup_interface_offsets (MonoClass *klass, int cur_slot, gboolean overwrite)
                klass->interface_bitmap = bitmap;
 #endif
        }
-
 end:
+       mono_loader_unlock ();
+
        g_free (interfaces_full);
        g_free (interface_offsets_full);
        g_free (array_interfaces);
@@ -3745,7 +3791,7 @@ end:
        
        //printf ("JUST DONE: ");
        //print_implemented_interfaces (klass);
+
        return cur_slot;
 }
 
@@ -3763,11 +3809,7 @@ end:
 void
 mono_class_setup_interface_offsets (MonoClass *klass)
 {
-       mono_loader_lock ();
-
        setup_interface_offsets (klass, 0, FALSE);
-
-       mono_loader_unlock ();
 }
 
 /*Checks if @klass has @parent as one of it's parents type gtd
@@ -3794,18 +3836,17 @@ mono_class_check_vtable_constraints (MonoClass *klass, GList *in_setup)
 {
        MonoGenericInst *ginst;
        int i;
-       if (!klass->generic_class) {
+
+       if (!mono_class_is_ginst (klass)) {
                mono_class_setup_vtable_full (klass, in_setup);
                return !mono_class_has_failure (klass);
        }
 
        mono_class_setup_vtable_full (mono_class_get_generic_type_definition (klass), in_setup);
-       if (mono_class_has_failure (klass->generic_class->container_class)) {
-               mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, g_strdup ("Failed to load generic definition vtable"));
+       if (mono_class_set_type_load_failure_causedby_class (klass, mono_class_get_generic_class (klass)->container_class, "Failed to load generic definition vtable"))
                return FALSE;
-       }
 
-       ginst = klass->generic_class->context.class_inst;
+       ginst = mono_class_get_generic_class (klass)->context.class_inst;
        for (i = 0; i < ginst->type_argc; ++i) {
                MonoClass *arg;
                if (ginst->type_argv [i]->type != MONO_TYPE_GENERICINST)
@@ -3815,7 +3856,7 @@ mono_class_check_vtable_constraints (MonoClass *klass, GList *in_setup)
                if (mono_class_has_gtd_parent (klass, arg) || mono_class_has_gtd_parent (arg, klass))
                        continue;
                if (!mono_class_check_vtable_constraints (arg, in_setup)) {
-                       mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, g_strdup_printf ("Failed to load generic parameter %d", i));
+                       mono_class_set_type_load_failure (klass, "Failed to load generic parameter %d", i);
                        return FALSE;
                }
        }
@@ -3830,7 +3871,8 @@ mono_class_check_vtable_constraints (MonoClass *klass, GList *in_setup)
  * - vtable
  * - vtable_size
  * Plus all the fields initialized by setup_interface_offsets ().
- * If there is an error during vtable construction, klass->exception_type is set.
+ * If there is an error during vtable construction, klass->has_failure
+ * is set and details are stored in a MonoErrorBoxed.
  *
  * LOCKING: Acquires the loader lock.
  */
@@ -3875,7 +3917,7 @@ mono_class_setup_vtable_full (MonoClass *klass, GList *in_setup)
        mono_stats.generic_vtable_count ++;
        in_setup = g_list_prepend (in_setup, klass);
 
-       if (klass->generic_class) {
+       if (mono_class_is_ginst (klass)) {
                if (!mono_class_check_vtable_constraints (klass, in_setup)) {
                        mono_loader_unlock ();
                        g_list_remove (in_setup, klass);
@@ -3883,9 +3925,9 @@ mono_class_setup_vtable_full (MonoClass *klass, GList *in_setup)
                }
 
                context = mono_class_get_context (klass);
-               type_token = klass->generic_class->container_class->type_token;
+               type_token = mono_class_get_generic_class (klass)->container_class->type_token;
        } else {
-               context = (MonoGenericContext *) klass->generic_container;
+               context = (MonoGenericContext *) mono_class_try_get_generic_container (klass); //FIXME is this a case of a try?
                type_token = klass->type_token;
        }
 
@@ -3898,7 +3940,7 @@ mono_class_setup_vtable_full (MonoClass *klass, GList *in_setup)
                if (!is_ok (&error)) {
                        mono_loader_unlock ();
                        g_list_remove (in_setup, klass);
-                       mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, g_strdup_printf("Could not load list of method overrides due to %s", mono_error_get_message (&error)));
+                       mono_class_set_type_load_failure (klass, "Could not load list of method overrides due to %s", mono_error_get_message (&error));
                        mono_error_cleanup (&error);
                        return;
                }
@@ -3911,7 +3953,7 @@ mono_class_setup_vtable_full (MonoClass *klass, GList *in_setup)
        if (ok)
                mono_class_setup_vtable_general (klass, overrides, onum, in_setup);
        else
-               mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, g_strdup ("Could not load list of method overrides"));
+               mono_class_set_type_load_failure (klass, "Could not load list of method overrides");
                
        g_free (overrides);
 
@@ -4027,7 +4069,7 @@ check_interface_method_override (MonoClass *klass, MonoMethod *im, MonoMethod *c
                cmsig = mono_method_signature (cm);
                imsig = mono_method_signature (im);
                if (!cmsig || !imsig) {
-                       mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, g_strdup ("Could not resolve the signature of a virtual method"));
+                       mono_class_set_type_load_failure (klass, "Could not resolve the signature of a virtual method");
                        return FALSE;
                }
 
@@ -4045,7 +4087,7 @@ check_interface_method_override (MonoClass *klass, MonoMethod *im, MonoMethod *c
                if (is_wcf_hack_disabled () && !mono_method_can_access_method_full (cm, im, NULL)) {
                        char *body_name = mono_method_full_name (cm, TRUE);
                        char *decl_name = mono_method_full_name (im, TRUE);
-                       mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, g_strdup_printf ("Method %s overrides method '%s' which is not accessible", body_name, decl_name));
+                       mono_class_set_type_load_failure (klass, "Method %s overrides method '%s' which is not accessible", body_name, decl_name);
                        g_free (body_name);
                        g_free (decl_name);
                        return FALSE;
@@ -4069,7 +4111,7 @@ check_interface_method_override (MonoClass *klass, MonoMethod *im, MonoMethod *c
                cmsig = mono_method_signature (cm);
                imsig = mono_method_signature (im);
                if (!cmsig || !imsig) {
-                       mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, g_strdup ("Could not resolve the signature of a virtual method"));
+                       mono_class_set_type_load_failure (klass, "Could not resolve the signature of a virtual method");
                        return FALSE;
                }
 
@@ -4126,7 +4168,7 @@ check_interface_method_override (MonoClass *klass, MonoMethod *im, MonoMethod *c
                if (is_wcf_hack_disabled () && !mono_method_can_access_method_full (cm, im, NULL)) {
                        char *body_name = mono_method_full_name (cm, TRUE);
                        char *decl_name = mono_method_full_name (im, TRUE);
-                       mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, g_strdup_printf ("Method %s overrides method '%s' which is not accessible", body_name, decl_name));
+                       mono_class_set_type_load_failure (klass, "Method %s overrides method '%s' which is not accessible", body_name, decl_name);
                        g_free (body_name);
                        g_free (decl_name);
                        return FALSE;
@@ -4204,7 +4246,7 @@ mono_method_try_get_vtable_index (MonoMethod *method)
 static void
 mono_class_verify_vtable (MonoClass *klass)
 {
-       int i;
+       int i, count;
        char *full_name = mono_type_full_name (&klass->byval_arg);
 
        printf ("*** Verifying VTable of class '%s' \n", full_name);
@@ -4214,7 +4256,8 @@ mono_class_verify_vtable (MonoClass *klass)
        if (!klass->methods)
                return;
 
-       for (i = 0; i < klass->method.count; ++i) {
+       count = mono_class_method_count (klass);
+       for (i = 0; i < count; ++i) {
                MonoMethod *cm = klass->methods [i];
                int slot;
 
@@ -4244,8 +4287,9 @@ mono_class_verify_vtable (MonoClass *klass)
 #endif
 
 static void
-print_unimplemented_interface_method_info (MonoClass *klass, MonoClass *ic, MonoMethod *im, int im_slot, MonoMethod **overrides, int onum) {
-       int index;
+print_unimplemented_interface_method_info (MonoClass *klass, MonoClass *ic, MonoMethod *im, int im_slot, MonoMethod **overrides, int onum)
+{
+       int index, mcount;
        char *method_signature;
        char *type_name;
        
@@ -4266,7 +4310,8 @@ print_unimplemented_interface_method_info (MonoClass *klass, MonoClass *ic, Mono
                g_free (name);
                return;
        }
-       for (index = 0; index < klass->method.count; ++index) {
+       mcount = mono_class_get_method_count (klass);
+       for (index = 0; index < mcount; ++index) {
                MonoMethod *cm = klass->methods [index];
                method_signature = mono_signature_get_desc (mono_method_signature (cm), TRUE);
 
@@ -4293,28 +4338,28 @@ verify_class_overrides (MonoClass *klass, MonoMethod **overrides, int onum)
                MonoMethod *body = overrides [i * 2 + 1];
 
                if (mono_class_get_generic_type_definition (body->klass) != mono_class_get_generic_type_definition (klass)) {
-                       mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, g_strdup ("Method belongs to a different class than the declared one"));
+                       mono_class_set_type_load_failure (klass, "Method belongs to a different class than the declared one");
                        return FALSE;
                }
 
                if (!(body->flags & METHOD_ATTRIBUTE_VIRTUAL) || (body->flags & METHOD_ATTRIBUTE_STATIC)) {
                        if (body->flags & METHOD_ATTRIBUTE_STATIC)
-                               mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, g_strdup ("Method must not be static to override a base type"));
+                               mono_class_set_type_load_failure (klass, "Method must not be static to override a base type");
                        else
-                               mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, g_strdup ("Method must be virtual to override a base type"));
+                               mono_class_set_type_load_failure (klass, "Method must be virtual to override a base type");
                        return FALSE;
                }
 
                if (!(decl->flags & METHOD_ATTRIBUTE_VIRTUAL) || (decl->flags & METHOD_ATTRIBUTE_STATIC)) {
                        if (body->flags & METHOD_ATTRIBUTE_STATIC)
-                               mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, g_strdup ("Cannot override a static method in a base type"));
+                               mono_class_set_type_load_failure (klass, "Cannot override a static method in a base type");
                        else
-                               mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, g_strdup ("Cannot override a non virtual method in a base type"));
+                               mono_class_set_type_load_failure (klass, "Cannot override a non virtual method in a base type");
                        return FALSE;
                }
 
                if (!mono_class_is_assignable_from_slow (decl->klass, klass)) {
-                       mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, g_strdup ("Method overrides a class or interface that is not extended or implemented by this type"));
+                       mono_class_set_type_load_failure (klass, "Method overrides a class or interface that is not extended or implemented by this type");
                        return FALSE;
                }
 
@@ -4324,7 +4369,7 @@ verify_class_overrides (MonoClass *klass, MonoMethod **overrides, int onum)
                if (is_wcf_hack_disabled () && !mono_method_can_access_method_full (body, decl, NULL)) {
                        char *body_name = mono_method_full_name (body, TRUE);
                        char *decl_name = mono_method_full_name (decl, TRUE);
-                       mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, g_strdup_printf ("Method %s overrides method '%s' which is not accessible", body_name, decl_name));
+                       mono_class_set_type_load_failure (klass, "Method %s overrides method '%s' which is not accessible", body_name, decl_name);
                        g_free (body_name);
                        g_free (decl_name);
                        return FALSE;
@@ -4348,7 +4393,8 @@ mono_class_setup_vtable_general (MonoClass *klass, MonoMethod **overrides, int o
        MonoError error;
        MonoClass *k, *ic;
        MonoMethod **vtable;
-       int i, max_vtsize = 0, max_iid, cur_slot = 0;
+       int i, max_vtsize = 0, cur_slot = 0;
+       guint32 max_iid;
        GPtrArray *ifaces = NULL;
        GHashTable *override_map = NULL;
        MonoMethod *cm;
@@ -4367,14 +4413,14 @@ mono_class_setup_vtable_general (MonoClass *klass, MonoMethod **overrides, int o
        ifaces = mono_class_get_implemented_interfaces (klass, &error);
        if (!mono_error_ok (&error)) {
                char *name = mono_type_get_full_name (klass);
-               mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, g_strdup_printf ("Could not resolve %s interfaces due to %s", name, mono_error_get_message (&error)));
+               mono_class_set_type_load_failure (klass, "Could not resolve %s interfaces due to %s", name, mono_error_get_message (&error));
                g_free (name);
                mono_error_cleanup (&error);
                return;
        } else if (ifaces) {
                for (i = 0; i < ifaces->len; i++) {
                        MonoClass *ic = (MonoClass *)g_ptr_array_index (ifaces, i);
-                       max_vtsize += ic->method.count;
+                       max_vtsize += mono_class_get_method_count (ic);
                }
                g_ptr_array_free (ifaces, TRUE);
                ifaces = NULL;
@@ -4384,18 +4430,14 @@ mono_class_setup_vtable_general (MonoClass *klass, MonoMethod **overrides, int o
                mono_class_init (klass->parent);
                mono_class_setup_vtable_full (klass->parent, in_setup);
 
-               if (mono_class_has_failure (klass->parent)) {
-                       char *name = mono_type_get_full_name (klass->parent);
-                       mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, g_strdup_printf ("Parent %s failed to load", name));
-                       g_free (name);
+               if (mono_class_set_type_load_failure_causedby_class (klass, klass->parent, "Parent class failed to load"))
                        return;
-               }
 
                max_vtsize += klass->parent->vtable_size;
                cur_slot = klass->parent->vtable_size;
        }
 
-       max_vtsize += klass->method.count;
+       max_vtsize += mono_class_get_method_count (klass);
 
        /*Array have a slot for stelemref*/
        if (mono_class_need_stelemref_method (klass)) {
@@ -4417,16 +4459,14 @@ mono_class_setup_vtable_general (MonoClass *klass, MonoMethod **overrides, int o
        DEBUG_INTERFACE_VTABLE (first_non_interface_slot = cur_slot);
 
        /* Optimized version for generic instances */
-       if (klass->generic_class) {
+       if (mono_class_is_ginst (klass)) {
                MonoError error;
-               MonoClass *gklass = klass->generic_class->container_class;
+               MonoClass *gklass = mono_class_get_generic_class (klass)->container_class;
                MonoMethod **tmp;
 
                mono_class_setup_vtable_full (gklass, in_setup);
-               if (mono_class_has_failure (gklass)) {
-                       mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, NULL);
+               if (mono_class_set_type_load_failure_causedby_class (klass, gklass, "Could not load generic definition"))
                        return;
-               }
 
                tmp = (MonoMethod **)mono_class_alloc0 (klass, sizeof (gpointer) * gklass->vtable_size);
                klass->vtable_size = gklass->vtable_size;
@@ -4434,9 +4474,7 @@ mono_class_setup_vtable_general (MonoClass *klass, MonoMethod **overrides, int o
                        if (gklass->vtable [i]) {
                                MonoMethod *inflated = mono_class_inflate_generic_method_full_checked (gklass->vtable [i], klass, mono_class_get_context (klass), &error);
                                if (!mono_error_ok (&error)) {
-                                       char *err_msg = g_strdup_printf ("Could not inflate method due to %s", mono_error_get_message (&error));
-                                       mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, err_msg);
-                                       g_free (err_msg);
+                                       mono_class_set_type_load_failure (klass, "Could not inflate method due to %s", mono_error_get_message (&error));
                                        mono_error_cleanup (&error);
                                        return;
                                }
@@ -4448,7 +4486,8 @@ mono_class_setup_vtable_general (MonoClass *klass, MonoMethod **overrides, int o
 
                /* Have to set method->slot for abstract virtual methods */
                if (klass->methods && gklass->methods) {
-                       for (i = 0; i < klass->method.count; ++i)
+                       int mcount = mono_class_get_method_count (klass);
+                       for (i = 0; i < mcount; ++i)
                                if (klass->methods [i]->slot == -1)
                                        klass->methods [i]->slot = gklass->methods [i]->slot;
                }
@@ -4479,7 +4518,8 @@ mono_class_setup_vtable_general (MonoClass *klass, MonoMethod **overrides, int o
                                
                                mono_class_setup_methods (parent_interface); /*FIXME Just kill this whole chunk of dead code*/
                                TRACE_INTERFACE_VTABLE (printf ("    +++ Inheriting interface %s.%s\n", parent_interface->name_space, parent_interface->name));
-                               for (j = 0; j < parent_interface->method.count && !mono_class_has_failure (klass); j++) {
+                               int mcount = mono_class_get_method_count (parent_interface);
+                               for (j = 0; j < mcount && !mono_class_has_failure (klass); j++) {
                                        vtable [interface_offset + j] = parent->vtable [parent_interface_offset + j];
                                        TRACE_INTERFACE_VTABLE (printf ("    --- Inheriting: [%03d][(%03d)+(%03d)] => [%03d][(%03d)+(%03d)]\n",
                                                        parent_interface_offset + j, parent_interface_offset, j,
@@ -4509,7 +4549,7 @@ mono_class_setup_vtable_general (MonoClass *klass, MonoMethod **overrides, int o
                        int dslot;
                        dslot = mono_method_get_vtable_slot (decl);
                        if (dslot == -1) {
-                               mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, NULL);
+                               mono_class_set_type_load_failure (klass, "");
                                return;
                        }
 
@@ -4574,7 +4614,8 @@ mono_class_setup_vtable_general (MonoClass *klass, MonoMethod **overrides, int o
                }
                
                // Loop on all interface methods...
-               for (im_index = 0; im_index < ic->method.count; im_index++) {
+               int mcount = mono_class_get_method_count (ic);
+               for (im_index = 0; im_index < mcount; im_index++) {
                        MonoMethod *im = ic->methods [im_index];
                        int im_slot = ic_offset + im->slot;
                        MonoMethod *override_im = (override_map != NULL) ? (MonoMethod *)g_hash_table_lookup (override_map, im) : NULL;
@@ -4640,7 +4681,7 @@ mono_class_setup_vtable_general (MonoClass *klass, MonoMethod **overrides, int o
        // it can happen (for injected generic array interfaces) that the same slot is
        // processed multiple times (those interfaces have overlapping slots), and it
        // will not always be the first pass the one that fills the slot.
-       if (! (klass->flags & TYPE_ATTRIBUTE_ABSTRACT)) {
+       if (!mono_class_is_abstract (klass)) {
                for (i = 0; i < klass->interface_offsets_count; i++) {
                        int ic_offset;
                        int im_index;
@@ -4648,7 +4689,8 @@ mono_class_setup_vtable_general (MonoClass *klass, MonoMethod **overrides, int o
                        ic = klass->interfaces_packed [i];
                        ic_offset = mono_class_interface_offset (klass, ic);
                        
-                       for (im_index = 0; im_index < ic->method.count; im_index++) {
+                       int mcount = mono_class_get_method_count (ic);
+                       for (im_index = 0; im_index < mcount; im_index++) {
                                MonoMethod *im = ic->methods [im_index];
                                int im_slot = ic_offset + im->slot;
                                
@@ -4686,7 +4728,8 @@ mono_class_setup_vtable_general (MonoClass *klass, MonoMethod **overrides, int o
                                        m1sig = mono_method_signature (m1);
 
                                        if (!cmsig || !m1sig) {
-                                               mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, NULL);
+                                               /* FIXME proper error message */
+                                               mono_class_set_type_load_failure (klass, "");
                                                return;
                                        }
 
@@ -4703,7 +4746,7 @@ mono_class_setup_vtable_general (MonoClass *klass, MonoMethod **overrides, int o
                                                if (is_wcf_hack_disabled () && !mono_method_can_access_method_full (cm, m1, NULL)) {
                                                        char *body_name = mono_method_full_name (cm, TRUE);
                                                        char *decl_name = mono_method_full_name (m1, TRUE);
-                                                       mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, g_strdup_printf ("Method %s overrides method '%s' which is not accessible", body_name, decl_name));
+                                                       mono_class_set_type_load_failure (klass, "Method %s overrides method '%s' which is not accessible", body_name, decl_name);
                                                        g_free (body_name);
                                                        g_free (decl_name);
                                                        goto fail;
@@ -4783,12 +4826,12 @@ mono_class_setup_vtable_general (MonoClass *klass, MonoMethod **overrides, int o
        virt_methods = NULL;
 
        /* Ensure that all vtable slots are filled with concrete instance methods */
-       if (!(klass->flags & TYPE_ATTRIBUTE_ABSTRACT)) {
+       if (!mono_class_is_abstract (klass)) {
                for (i = 0; i < cur_slot; ++i) {
                        if (vtable [i] == NULL || (vtable [i]->flags & (METHOD_ATTRIBUTE_ABSTRACT | METHOD_ATTRIBUTE_STATIC))) {
                                char *type_name = mono_type_get_full_name (klass);
                                char *method_name = vtable [i] ? mono_method_full_name (vtable [i], TRUE) : g_strdup ("none");
-                               mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, g_strdup_printf ("Type %s has invalid vtable method slot %d with method %s", type_name, i, method_name));
+                               mono_class_set_type_load_failure (klass, "Type %s has invalid vtable method slot %d with method %s", type_name, i, method_name);
                                g_free (type_name);
                                g_free (method_name);
                                return;
@@ -4796,8 +4839,8 @@ mono_class_setup_vtable_general (MonoClass *klass, MonoMethod **overrides, int o
                }
        }
 
-       if (klass->generic_class) {
-               MonoClass *gklass = klass->generic_class->container_class;
+       if (mono_class_is_ginst (klass)) {
+               MonoClass *gklass = mono_class_get_generic_class (klass)->container_class;
 
                mono_class_init (gklass);
 
@@ -4872,7 +4915,7 @@ mono_class_setup_vtable_general (MonoClass *klass, MonoMethod **overrides, int o
 fail:
        {
        char *name = mono_type_get_full_name (klass);
-       mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, g_strdup_printf ("VTable setup of type %s failed", name));
+       mono_class_set_type_load_failure (klass, "VTable setup of type %s failed", name);
        g_free (name);
        if (override_map)
                g_hash_table_destroy (override_map);
@@ -4898,23 +4941,24 @@ mono_method_get_vtable_slot (MonoMethod *method)
                        return -1;
                if (method->slot == -1) {
                        MonoClass *gklass;
-                       int i;
+                       int i, mcount;
 
-                       if (!method->klass->generic_class) {
+                       if (!mono_class_is_ginst (method->klass)) {
                                g_assert (method->is_inflated);
                                return mono_method_get_vtable_slot (((MonoMethodInflated*)method)->declaring);
                        }
 
                        /* This can happen for abstract methods of generic instances due to the shortcut code in mono_class_setup_vtable_general (). */
-                       g_assert (method->klass->generic_class);
-                       gklass = method->klass->generic_class->container_class;
+                       g_assert (mono_class_is_ginst (method->klass));
+                       gklass = mono_class_get_generic_class (method->klass)->container_class;
                        mono_class_setup_methods (method->klass);
                        g_assert (method->klass->methods);
-                       for (i = 0; i < method->klass->method.count; ++i) {
+                       mcount = mono_class_get_method_count (method->klass);
+                       for (i = 0; i < mcount; ++i) {
                                if (method->klass->methods [i] == method)
                                        break;
                        }
-                       g_assert (i < method->klass->method.count);
+                       g_assert (i < mcount);
                        g_assert (gklass->methods);
                        method->slot = gklass->methods [i]->slot;
                }
@@ -4985,13 +5029,14 @@ static GenericArrayMethodInfo *generic_array_method_info = NULL;
 static int
 generic_array_methods (MonoClass *klass)
 {
-       int i, count_generic = 0;
+       int i, count_generic = 0, mcount;
        GList *list = NULL, *tmp;
        if (generic_array_method_num)
                return generic_array_method_num;
        mono_class_setup_methods (klass->parent); /*This is setting up System.Array*/
        g_assert (!mono_class_has_failure (klass->parent)); /*So hitting this assert is a huge problem*/
-       for (i = 0; i < klass->parent->method.count; i++) {
+       mcount = mono_class_get_method_count (klass->parent);
+       for (i = 0; i < mcount; i++) {
                MonoMethod *m = klass->parent->methods [i];
                if (!strncmp (m->name, "InternalArray__", 15)) {
                        count_generic++;
@@ -5048,7 +5093,7 @@ setup_generic_array_ifaces (MonoClass *klass, MonoClass *iface, MonoMethod **met
        int i;
 
        tmp_context.class_inst = NULL;
-       tmp_context.method_inst = iface->generic_class->context.class_inst;
+       tmp_context.method_inst = mono_class_get_generic_class (iface)->context.class_inst;
        //g_print ("setting up array interface: %s\n", mono_type_get_name_full (&iface->byval_arg, 0));
 
        for (i = 0; i < generic_array_method_num; i++) {
@@ -5078,21 +5123,30 @@ concat_two_strings_with_zero (MonoImage *image, const char *s1, const char *s2)
 
 /**
  * mono_class_init:
- * @class: the class to initialize
+ * @klass: the class to initialize
  *
  *   Compute the instance_size, class_size and other infos that cannot be 
  * computed at mono_class_get() time. Also compute vtable_size if possible. 
  * Returns TRUE on success or FALSE if there was a problem in loading
- * the type (incorrect assemblies, missing assemblies, methods, etc). 
+ * the type (incorrect assemblies, missing assemblies, methods, etc).
+ * Initializes the following fields in @klass:
+ * - all the fields initialized by mono_class_init_sizes ()
+ * - has_cctor
+ * - ghcimpl
+ * - inited
  *
  * LOCKING: Acquires the loader lock.
  */
 gboolean
 mono_class_init (MonoClass *klass)
 {
-       int i;
+       int i, vtable_size = 0, array_method_count = 0;
        MonoCachedClassInfo cached_info;
        gboolean has_cached_info;
+       gboolean locked = FALSE;
+       gboolean ghcimpl = FALSE;
+       gboolean has_cctor = FALSE;
+       int first_iface_slot = 0;
        
        g_assert (klass);
 
@@ -5102,59 +5156,45 @@ mono_class_init (MonoClass *klass)
 
        /*g_print ("Init class %s\n", mono_type_get_full_name (klass));*/
 
-       /* We do everything inside the lock to prevent races */
-       mono_loader_lock ();
-
-       if (klass->inited || mono_class_has_failure (klass)) {
-               mono_loader_unlock ();
-               /* Somebody might have gotten in before us */
-               return !mono_class_has_failure (klass);
-       }
-
-       if (klass->init_pending) {
-               mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, g_strdup ("Recursive type definition detected"));
+       /*
+        * This function can recursively call itself.
+        */
+       GSList *init_list = (GSList *)mono_native_tls_get_value (init_pending_tls_id);
+       if (g_slist_find (init_list, klass)) {
+               mono_class_set_type_load_failure (klass, "Recursive type definition detected");
                goto leave;
        }
+       init_list = g_slist_prepend (init_list, klass);
+       mono_native_tls_set_value (init_pending_tls_id, init_list);
 
-       klass->init_pending = 1;
+       /*
+        * We want to avoid doing complicated work inside locks, so we compute all the required
+        * information and write it to @klass inside a lock.
+        */
 
        if (mono_verifier_is_enabled_for_class (klass) && !mono_verifier_verify_class (klass)) {
-               mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, concat_two_strings_with_zero (klass->image, klass->name, klass->image->assembly_name));
+               mono_class_set_type_load_failure (klass, "%s", concat_two_strings_with_zero (klass->image, klass->name, klass->image->assembly_name));
                goto leave;
        }
 
-
        if (klass->byval_arg.type == MONO_TYPE_ARRAY || klass->byval_arg.type == MONO_TYPE_SZARRAY) {
                MonoClass *element_class = klass->element_class;
                if (!element_class->inited) 
                        mono_class_init (element_class);
-               if (mono_class_has_failure (element_class)) {
-                       mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, NULL);
+               if (mono_class_set_type_load_failure_causedby_class (klass, element_class, "Could not load array element class"))
                        goto leave;
-               }
        }
 
        mono_stats.initialized_class_count++;
 
-       if (klass->generic_class && !klass->generic_class->is_dynamic) {
-               MonoClass *gklass = klass->generic_class->container_class;
-
-               mono_stats.generic_class_count++;
-
-               klass->method = gklass->method;
-               klass->field = gklass->field;
+       if (mono_class_is_ginst (klass) && !mono_class_get_generic_class (klass)->is_dynamic) {
+               MonoClass *gklass = mono_class_get_generic_class (klass)->container_class;
 
                mono_class_init (gklass);
-               // FIXME: Why is this needed ?
-               if (!mono_class_has_failure (gklass))
-                       mono_class_setup_methods (gklass);
-               if (mono_class_has_failure (gklass)) {
-                       mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, g_strdup_printf ("Generic Type Defintion failed to init"));
+               if (mono_class_set_type_load_failure_causedby_class (klass, gklass, "Generic Type Definition failed to init"))
                        goto leave;
-               }
 
-               if (MONO_CLASS_IS_INTERFACE (klass))
-                       klass->interface_id = mono_get_unique_iid (klass);
+               mono_class_setup_interface_id (klass);
        }
 
        if (klass->parent && !klass->parent->inited)
@@ -5162,38 +5202,10 @@ mono_class_init (MonoClass *klass)
 
        has_cached_info = mono_class_get_cached_class_info (klass, &cached_info);
 
-       if (klass->generic_class || image_is_dynamic (klass->image) || !klass->type_token || (has_cached_info && !cached_info.has_nested_classes))
-               klass->nested_classes_inited = TRUE;
-
-       /*
-        * Computes the size used by the fields, and their locations
-        */
-       if (has_cached_info) {
-               klass->instance_size = cached_info.instance_size;
-               klass->sizes.class_size = cached_info.class_size;
-               klass->packing_size = cached_info.packing_size;
-               klass->min_align = cached_info.min_align;
-               klass->blittable = cached_info.blittable;
-               klass->has_references = cached_info.has_references;
-               klass->has_static_refs = cached_info.has_static_refs;
-               klass->no_special_static_fields = cached_info.no_special_static_fields;
-       }
-       else
-               if (!klass->size_inited){
-                       mono_class_setup_fields (klass);
-                       if (mono_class_has_failure (klass))
-                               goto leave;
-               }
-                               
-       /* Initialize arrays */
-       if (klass->rank) {
-               klass->method.count = 3 + (klass->rank > 1? 2: 1);
-
-               if (klass->interface_count) {
-                       int count_generic = generic_array_methods (klass);
-                       klass->method.count += klass->interface_count * count_generic;
-               }
-       }
+       /* Compute instance size etc. */
+       init_sizes_with_info (klass, has_cached_info ? &cached_info : NULL);
+       if (mono_class_has_failure (klass))
+               goto leave;
 
        mono_class_setup_supertypes (klass);
 
@@ -5207,11 +5219,9 @@ mono_class_init (MonoClass *klass)
         */
        if (has_cached_info) {
                /* AOT case */
-               klass->vtable_size = cached_info.vtable_size;
-               klass->has_finalize = cached_info.has_finalize;
-               klass->has_finalize_inited = TRUE;
-               klass->ghcimpl = cached_info.ghcimpl;
-               klass->has_cctor = cached_info.has_cctor;
+               vtable_size = cached_info.vtable_size;
+               ghcimpl = cached_info.ghcimpl;
+               has_cctor = cached_info.has_cctor;
        } else if (klass->rank == 1 && klass->byval_arg.type == MONO_TYPE_SZARRAY) {
                /* SZARRAY can have 2 vtable layouts, with and without the stelemref method.
                 * The first slot if for array with.
@@ -5224,23 +5234,22 @@ mono_class_init (MonoClass *klass)
                if (!szarray_vtable_size [slot]) {
                        mono_class_setup_vtable (klass);
                        szarray_vtable_size [slot] = klass->vtable_size;
+                       vtable_size = klass->vtable_size;
                } else {
-                       klass->vtable_size = szarray_vtable_size[slot];
+                       vtable_size = szarray_vtable_size[slot];
                }
-       } else if (klass->generic_class && !MONO_CLASS_IS_INTERFACE (klass)) {
-               MonoClass *gklass = klass->generic_class->container_class;
+       } else if (mono_class_is_ginst (klass) && !MONO_CLASS_IS_INTERFACE (klass)) {
+               MonoClass *gklass = mono_class_get_generic_class (klass)->container_class;
 
                /* Generic instance case */
-               klass->ghcimpl = gklass->ghcimpl;
-               klass->has_cctor = gklass->has_cctor;
+               ghcimpl = gklass->ghcimpl;
+               has_cctor = gklass->has_cctor;
 
                mono_class_setup_vtable (gklass);
-               if (mono_class_has_failure (gklass)) {
-                       mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, NULL);
+               if (mono_class_set_type_load_failure_causedby_class (klass, gklass, "Generic type definition failed to init"))
                        goto leave;
-               }
 
-               klass->vtable_size = gklass->vtable_size;
+               vtable_size = gklass->vtable_size;
        } else {
                /* General case */
 
@@ -5260,21 +5269,28 @@ mono_class_init (MonoClass *klass)
                if (!MONO_CLASS_IS_INTERFACE (klass) || klass->image != mono_defaults.corlib) {
                        MonoMethod *cmethod = NULL;
 
-                       if (klass->type_token && !image_is_dynamic(klass->image)) {
+                       if (mono_class_is_ginst (klass)) {
+                               MonoClass *gklass = mono_class_get_generic_class (klass)->container_class;
+
+                               /* Generic instance case */
+                               ghcimpl = gklass->ghcimpl;
+                               has_cctor = gklass->has_cctor;
+                       } else if (klass->type_token && !image_is_dynamic(klass->image)) {
                                cmethod = find_method_in_metadata (klass, ".cctor", 0, METHOD_ATTRIBUTE_SPECIAL_NAME);
                                /* The find_method function ignores the 'flags' argument */
                                if (cmethod && (cmethod->flags & METHOD_ATTRIBUTE_SPECIAL_NAME))
-                                       klass->has_cctor = 1;
+                                       has_cctor = 1;
                        } else {
                                mono_class_setup_methods (klass);
                                if (mono_class_has_failure (klass))
                                        goto leave;
 
-                               for (i = 0; i < klass->method.count; ++i) {
+                               int mcount = mono_class_get_method_count (klass);
+                               for (i = 0; i < mcount; ++i) {
                                        MonoMethod *method = klass->methods [i];
                                        if ((method->flags & METHOD_ATTRIBUTE_SPECIAL_NAME) && 
                                                (strcmp (".cctor", method->name) == 0)) {
-                                               klass->has_cctor = 1;
+                                               has_cctor = 1;
                                                break;
                                        }
                                }
@@ -5282,45 +5298,79 @@ mono_class_init (MonoClass *klass)
                }
        }
 
-       if (klass->parent) {
-               int first_iface_slot;
-               /* This will compute klass->parent->vtable_size for some classes */
-               mono_class_init (klass->parent);
-               if (mono_class_has_failure (klass->parent)) {
-                       mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, NULL);
-                       goto leave;
+       if (klass->rank) {
+               array_method_count = 3 + (klass->rank > 1? 2: 1);
+
+               if (klass->interface_count) {
+                       int count_generic = generic_array_methods (klass);
+                       array_method_count += klass->interface_count * count_generic;
                }
-               if (!klass->parent->vtable_size) {
-                       /* FIXME: Get rid of this somehow */
+       }
+
+       if (klass->parent) {
+               if (!klass->parent->vtable_size)
                        mono_class_setup_vtable (klass->parent);
-                       if (mono_class_has_failure (klass->parent)) {
-                               mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, NULL);
-                               goto leave;
-                       }
-               }
+               if (mono_class_set_type_load_failure_causedby_class (klass, klass->parent, "Parent class vtable failed to initialize"))
+                       goto leave;
+               g_assert (klass->parent->vtable_size);
                first_iface_slot = klass->parent->vtable_size;
                if (mono_class_need_stelemref_method (klass))
                        ++first_iface_slot;
-               setup_interface_offsets (klass, first_iface_slot, TRUE);
-       } else {
-               setup_interface_offsets (klass, 0, TRUE);
        }
 
+       /*
+        * Do the actual changes to @klass inside the loader lock
+        */
+       mono_loader_lock ();
+       locked = TRUE;
+
+       if (klass->inited || mono_class_has_failure (klass)) {
+               mono_loader_unlock ();
+               /* Somebody might have gotten in before us */
+               return !mono_class_has_failure (klass);
+       }
+
+       mono_stats.initialized_class_count++;
+
+       if (mono_class_is_ginst (klass) && !mono_class_get_generic_class (klass)->is_dynamic)
+               mono_stats.generic_class_count++;
+
+       if (mono_class_is_ginst (klass) || image_is_dynamic (klass->image) || !klass->type_token || (has_cached_info && !cached_info.has_nested_classes))
+               klass->nested_classes_inited = TRUE;
+       klass->ghcimpl = ghcimpl;
+       klass->has_cctor = has_cctor;
+       if (vtable_size)
+               klass->vtable_size = vtable_size;
+       if (has_cached_info) {
+               klass->has_finalize = cached_info.has_finalize;
+               klass->has_finalize_inited = TRUE;
+       }
+       if (klass->rank)
+               mono_class_set_method_count (klass, array_method_count);
+
+       mono_loader_unlock ();
+       locked = FALSE;
+
+       setup_interface_offsets (klass, first_iface_slot, TRUE);
+
        if (mono_security_core_clr_enabled ())
                mono_security_core_clr_check_inheritance (klass);
 
-       if (klass->generic_class && !mono_verifier_class_is_valid_generic_instantiation (klass))
-               mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, g_strdup ("Invalid generic instantiation"));
+       if (mono_class_is_ginst (klass) && !mono_verifier_class_is_valid_generic_instantiation (klass))
+               mono_class_set_type_load_failure (klass, "Invalid generic instantiation");
 
        goto leave;
 
  leave:
+       init_list = g_slist_remove (init_list, klass);
+       mono_native_tls_set_value (init_pending_tls_id, init_list);
+
        /* Because of the double-checking locking pattern */
        mono_memory_barrier ();
        klass->inited = 1;
-       klass->init_pending = 0;
 
-       mono_loader_unlock ();
+       if (locked)
+               mono_loader_unlock ();
 
        return !mono_class_has_failure (klass);
 }
@@ -5344,8 +5394,8 @@ mono_class_has_finalizer (MonoClass *klass)
                MonoMethod *cmethod = NULL;
 
                if (klass->rank == 1 && klass->byval_arg.type == MONO_TYPE_SZARRAY) {
-               } else if (klass->generic_class) {
-                       MonoClass *gklass = klass->generic_class->container_class;
+               } else if (mono_class_is_ginst (klass)) {
+                       MonoClass *gklass = mono_class_get_generic_class (klass)->container_class;
 
                        has_finalize = mono_class_has_finalizer (gklass);
                } else if (klass->parent && klass->parent->has_finalize) {
@@ -5393,11 +5443,7 @@ mono_class_has_finalizer (MonoClass *klass)
 gboolean
 mono_is_corlib_image (MonoImage *image)
 {
-       /* FIXME: allow the dynamic case for our compilers and with full trust */
-       if (image_is_dynamic (image))
-               return image->assembly && !strcmp (image->assembly->aname.name, "mscorlib");
-       else
-               return image == mono_defaults.corlib;
+       return image == mono_defaults.corlib;
 }
 
 /*
@@ -5526,7 +5572,6 @@ mono_class_setup_mono_type (MonoClass *klass)
 
        if (MONO_CLASS_IS_INTERFACE (klass))
                klass->interface_id = mono_get_unique_iid (klass);
-
 }
 
 #ifndef DISABLE_COM
@@ -5546,7 +5591,7 @@ init_com_from_comimport (MonoClass *klass)
                        /* but it can not be made available for application (i.e. user code) since all COM calls
                         * are considered native calls. In this case we fail with a TypeLoadException (just like
                         * Silverlight 2 does */
-                       mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, NULL);
+                       mono_class_set_type_load_failure (klass, "");
                        return;
                }
        }
@@ -5590,12 +5635,13 @@ mono_class_setup_parent (MonoClass *klass, MonoClass *parent)
                if (!parent) {
                        /* set the parent to something useful and safe, but mark the type as broken */
                        parent = mono_defaults.object_class;
-                       mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, NULL);
+                       mono_class_set_type_load_failure (klass, "");
+                       g_assert (parent);
                }
 
                klass->parent = parent;
 
-               if (parent->generic_class && !parent->name) {
+               if (mono_class_is_ginst (parent) && !parent->name) {
                        /*
                         * If the parent is a generic instance, we may get
                         * called before it is fully initialized, especially
@@ -5655,12 +5701,12 @@ mono_class_setup_parent (MonoClass *klass, MonoClass *parent)
  *  - supertypes: array of classes: each element has a class in the hierarchy
  *    starting from @class up to System.Object
  * 
- * LOCKING: This function is atomic, in case of contention we waste memory.
+ * LOCKING: Acquires the loader lock.
  */
 void
 mono_class_setup_supertypes (MonoClass *klass)
 {
-       int ms;
+       int ms, idepth;
        MonoClass **supertypes;
 
        mono_atomic_load_acquire (supertypes, MonoClass **, &klass->supertypes);
@@ -5670,15 +5716,15 @@ mono_class_setup_supertypes (MonoClass *klass)
        if (klass->parent && !klass->parent->supertypes)
                mono_class_setup_supertypes (klass->parent);
        if (klass->parent)
-               klass->idepth = klass->parent->idepth + 1;
+               idepth = klass->parent->idepth + 1;
        else
-               klass->idepth = 1;
+               idepth = 1;
 
-       ms = MAX (MONO_DEFAULT_SUPERTABLE_SIZE, klass->idepth);
+       ms = MAX (MONO_DEFAULT_SUPERTABLE_SIZE, idepth);
        supertypes = (MonoClass **)mono_class_alloc0 (klass, sizeof (MonoClass *) * ms);
 
        if (klass->parent) {
-               CHECKED_METADATA_WRITE_PTR ( supertypes [klass->idepth - 1] , klass );
+               CHECKED_METADATA_WRITE_PTR ( supertypes [idepth - 1] , klass );
 
                int supertype_idx;
                for (supertype_idx = 0; supertype_idx < klass->parent->idepth; supertype_idx++)
@@ -5687,7 +5733,14 @@ mono_class_setup_supertypes (MonoClass *klass)
                CHECKED_METADATA_WRITE_PTR ( supertypes [0] , klass );
        }
 
-       CHECKED_METADATA_WRITE_PTR_ATOMIC ( klass->supertypes , supertypes );
+       mono_memory_barrier ();
+
+       mono_loader_lock ();
+       klass->idepth = idepth;
+       /* Needed so idepth is visible before supertypes is set */
+       mono_memory_barrier ();
+       klass->supertypes = supertypes;
+       mono_loader_unlock ();
 }
 
 static gboolean
@@ -5695,7 +5748,7 @@ fix_gclass_incomplete_instantiation (MonoClass *gclass, void *user_data)
 {
        MonoClass *gtd = (MonoClass*)user_data;
        /* Only try to fix generic instances of @gtd */
-       if (gclass->generic_class->container_class != gtd)
+       if (mono_class_get_generic_class (gclass)->container_class != gtd)
                return FALSE;
 
        /* Check if the generic instance has no parent. */
@@ -5708,8 +5761,8 @@ fix_gclass_incomplete_instantiation (MonoClass *gclass, void *user_data)
 static void
 mono_class_set_failure_and_error (MonoClass *klass, MonoError *error, const char *msg)
 {
-       mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, g_strdup (msg));
-       mono_error_set_type_load_class (error, klass, msg);
+       mono_class_set_type_load_failure (klass, "%s", msg);
+       mono_error_set_type_load_class (error, klass, "%s", msg);
 }
 
 /**
@@ -5757,7 +5810,17 @@ mono_class_create_from_typedef (MonoImage *image, guint32 type_token, MonoError
        name = mono_metadata_string_heap (image, cols [MONO_TYPEDEF_NAME]);
        nspace = mono_metadata_string_heap (image, cols [MONO_TYPEDEF_NAMESPACE]);
 
-       klass = (MonoClass *)mono_image_alloc0 (image, sizeof (MonoClass));
+       if (mono_metadata_has_generic_params (image, type_token)) {
+               klass = mono_image_alloc0 (image, sizeof (MonoClassGtd));
+               klass->class_kind = MONO_CLASS_GTD;
+               classes_size += sizeof (MonoClassGtd);
+               ++class_gtd_count;
+       } else {
+               klass = mono_image_alloc0 (image, sizeof (MonoClassDef));
+               klass->class_kind = MONO_CLASS_DEF;
+               classes_size += sizeof (MonoClassDef);
+               ++class_def_count;
+       }
 
        klass->name = name;
        klass->name_space = nspace;
@@ -5766,25 +5829,21 @@ mono_class_create_from_typedef (MonoImage *image, guint32 type_token, MonoError
 
        klass->image = image;
        klass->type_token = type_token;
-       klass->flags = cols [MONO_TYPEDEF_FLAGS];
+       mono_class_set_flags (klass, cols [MONO_TYPEDEF_FLAGS]);
 
        mono_internal_hash_table_insert (&image->class_cache, GUINT_TO_POINTER (type_token), klass);
 
-       classes_size += sizeof (MonoClass);
-
        /*
         * Check whether we're a generic type definition.
         */
-       klass->generic_container = mono_metadata_load_generic_params (image, klass->type_token, NULL);
-       if (klass->generic_container) {
-               klass->is_generic = 1;
-               klass->generic_container->owner.klass = klass;
-               klass->generic_container->is_anonymous = FALSE; // Owner class is now known, container is no longer anonymous
-               context = &klass->generic_container->context;
-       }
-
-       if (klass->generic_container)
+       if (mono_class_is_gtd (klass)) {
+               MonoGenericContainer *generic_container = mono_metadata_load_generic_params (image, klass->type_token, NULL);
+               generic_container->owner.klass = klass;
+               generic_container->is_anonymous = FALSE; // Owner class is now known, container is no longer anonymous
+               context = &generic_container->context;
+               mono_class_set_generic_container (klass, generic_container);
                enable_gclass_recording ();
+       }
 
        if (cols [MONO_TYPEDEF_EXTENDS]) {
                MonoClass *tmp;
@@ -5803,7 +5862,7 @@ mono_class_create_from_typedef (MonoImage *image, guint32 type_token, MonoError
                        parent = mono_class_inflate_generic_class_checked (parent, context, error);
 
                if (parent == NULL) {
-                       mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, g_strdup (mono_error_get_message (error)));
+                       mono_class_set_type_load_failure (klass, "%s", mono_error_get_message (error));
                        goto parent_failure;
                }
 
@@ -5812,7 +5871,7 @@ mono_class_create_from_typedef (MonoImage *image, guint32 type_token, MonoError
                                mono_class_set_failure_and_error (klass, error, "Cycle found while resolving parent");
                                goto parent_failure;
                        }
-                       if (klass->generic_container && tmp->generic_class && tmp->generic_class->container_class == klass) {
+                       if (mono_class_is_gtd (klass) && mono_class_is_ginst (tmp) && mono_class_get_generic_class (tmp)->container_class == klass) {
                                mono_class_set_failure_and_error (klass, error, "Parent extends generic instance of this type");
                                goto parent_failure;
                        }
@@ -5824,7 +5883,7 @@ mono_class_create_from_typedef (MonoImage *image, guint32 type_token, MonoError
        /* uses ->valuetype, which is initialized by mono_class_setup_parent above */
        mono_class_setup_mono_type (klass);
 
-       if (klass->generic_container)
+       if (mono_class_is_gtd (klass))
                disable_gclass_recording (fix_gclass_incomplete_instantiation, klass);
 
        /* 
@@ -5835,18 +5894,18 @@ mono_class_create_from_typedef (MonoImage *image, guint32 type_token, MonoError
                klass->nested_in = mono_class_create_from_typedef (image, nesting_tokeen, error);
                if (!mono_error_ok (error)) {
                        /*FIXME implement a mono_class_set_failure_from_mono_error */
-                       mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, g_strdup (mono_error_get_message (error)));
+                       mono_class_set_type_load_failure (klass, "%s",  mono_error_get_message (error));
                        mono_loader_unlock ();
                        mono_profiler_class_loaded (klass, MONO_PROFILE_FAILED);
                        return NULL;
                }
        }
 
-       if ((klass->flags & TYPE_ATTRIBUTE_STRING_FORMAT_MASK) == TYPE_ATTRIBUTE_UNICODE_CLASS)
+       if ((mono_class_get_flags (klass) & TYPE_ATTRIBUTE_STRING_FORMAT_MASK) == TYPE_ATTRIBUTE_UNICODE_CLASS)
                klass->unicode = 1;
 
 #ifdef HOST_WIN32
-       if ((klass->flags & TYPE_ATTRIBUTE_STRING_FORMAT_MASK) == TYPE_ATTRIBUTE_AUTO_CLASS)
+       if ((mono_class_get_flags (klass) & TYPE_ATTRIBUTE_STRING_FORMAT_MASK) == TYPE_ATTRIBUTE_AUTO_CLASS)
                klass->unicode = 1;
 #endif
 
@@ -5856,12 +5915,15 @@ mono_class_create_from_typedef (MonoImage *image, guint32 type_token, MonoError
                if (!mono_metadata_interfaces_from_typedef_full (
                            image, type_token, &interfaces, &icount, FALSE, context, error)){
 
-                       mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, g_strdup (mono_error_get_message (error)));
+                       mono_class_set_type_load_failure (klass, "%s", mono_error_get_message (error));
                        mono_loader_unlock ();
                        mono_profiler_class_loaded (klass, MONO_PROFILE_FAILED);
                        return NULL;
                }
 
+               /* This is required now that it is possible for more than 2^16 interfaces to exist. */
+               g_assert(icount <= 65535);
+
                klass->interfaces = interfaces;
                klass->interface_count = icount;
                klass->interfaces_inited = 1;
@@ -5872,8 +5934,10 @@ mono_class_create_from_typedef (MonoImage *image, guint32 type_token, MonoError
        /*
         * Compute the field and method lists
         */
-       klass->field.first  = cols [MONO_TYPEDEF_FIELD_LIST] - 1;
-       klass->method.first = cols [MONO_TYPEDEF_METHOD_LIST] - 1;
+       int first_field_idx = cols [MONO_TYPEDEF_FIELD_LIST] - 1;
+       mono_class_set_first_field_idx (klass, first_field_idx);
+       int first_method_idx = cols [MONO_TYPEDEF_METHOD_LIST] - 1;
+       mono_class_set_first_method_idx (klass, first_method_idx);
 
        if (tt->rows > tidx){           
                mono_metadata_decode_row (tt, tidx, cols_next, MONO_TYPEDEF_SIZE);
@@ -5886,19 +5950,14 @@ mono_class_create_from_typedef (MonoImage *image, guint32 type_token, MonoError
 
        if (cols [MONO_TYPEDEF_FIELD_LIST] && 
            cols [MONO_TYPEDEF_FIELD_LIST] <= image->tables [MONO_TABLE_FIELD].rows)
-               klass->field.count = field_last - klass->field.first;
-       else
-               klass->field.count = 0;
-
+               mono_class_set_field_count (klass, field_last - first_field_idx);
        if (cols [MONO_TYPEDEF_METHOD_LIST] <= image->tables [MONO_TABLE_METHOD].rows)
-               klass->method.count = method_last - klass->method.first;
-       else
-               klass->method.count = 0;
+               mono_class_set_method_count (klass, method_last - first_method_idx);
 
        /* reserve space to store vector pointer in arrays */
        if (mono_is_corlib_image (image) && !strcmp (nspace, "System") && !strcmp (name, "Array")) {
                klass->instance_size += 2 * sizeof (gpointer);
-               g_assert (klass->field.count == 0);
+               g_assert (mono_class_get_field_count (klass) == 0);
        }
 
        if (klass->enumtype) {
@@ -5906,7 +5965,7 @@ mono_class_create_from_typedef (MonoImage *image, guint32 type_token, MonoError
                if (!enum_basetype) {
                        /*set it to a default value as the whole runtime can't handle this to be null*/
                        klass->cast_class = klass->element_class = mono_defaults.int32_class;
-                       mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, g_strdup (mono_error_get_message (error)));
+                       mono_class_set_type_load_failure (klass, "%s", mono_error_get_message (error));
                        mono_loader_unlock ();
                        mono_profiler_class_loaded (klass, MONO_PROFILE_FAILED);
                        return NULL;
@@ -5919,8 +5978,8 @@ mono_class_create_from_typedef (MonoImage *image, guint32 type_token, MonoError
         * We must do this after the class has been constructed to make certain recursive scenarios
         * work.
         */
-       if (klass->generic_container && !mono_metadata_load_generic_param_constraints_checked (image, type_token, klass->generic_container, error)) {
-               mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, g_strdup_printf ("Could not load generic parameter constrains due to %s", mono_error_get_message (error)));
+       if (mono_class_is_gtd (klass) && !mono_metadata_load_generic_param_constraints_checked (image, type_token, mono_class_get_generic_container (klass), error)) {
+               mono_class_set_type_load_failure (klass, "Could not load generic parameter constrains due to %s", mono_error_get_message (error));
                mono_loader_unlock ();
                mono_profiler_class_loaded (klass, MONO_PROFILE_FAILED);
                return NULL;
@@ -5929,6 +5988,12 @@ mono_class_create_from_typedef (MonoImage *image, guint32 type_token, MonoError
        if (klass->image->assembly_name && !strcmp (klass->image->assembly_name, "Mono.Simd") && !strcmp (nspace, "Mono.Simd")) {
                if (!strncmp (name, "Vector", 6))
                        klass->simd_type = !strcmp (name + 6, "2d") || !strcmp (name + 6, "2ul") || !strcmp (name + 6, "2l") || !strcmp (name + 6, "4f") || !strcmp (name + 6, "4ui") || !strcmp (name + 6, "4i") || !strcmp (name + 6, "8s") || !strcmp (name + 6, "8us") || !strcmp (name + 6, "16b") || !strcmp (name + 6, "16sb");
+       } else if (klass->image->assembly_name && !strcmp (klass->image->assembly_name, "System.Numerics") && !strcmp (nspace, "System.Numerics")) {
+               if (!strcmp (name, "Vector2") || !strcmp (name, "Vector3") || !strcmp (name, "Vector4"))
+                       klass->simd_type = 1;
+       } else if (klass->image->assembly_name && !strcmp (klass->image->assembly_name, "System.Numerics.Vectors") && !strcmp (nspace, "System.Numerics")) {
+               if (!strcmp (name, "Vector`1"))
+                       klass->simd_type = 1;
        }
 
        mono_loader_unlock ();
@@ -5948,8 +6013,8 @@ parent_failure:
 gboolean
 mono_class_is_nullable (MonoClass *klass)
 {
-       return klass->generic_class != NULL &&
-               klass->generic_class->container_class == mono_defaults.generic_nullable_class;
+       MonoGenericClass *gklass = mono_class_try_get_generic_class (klass);
+       return gklass && gklass->container_class == mono_defaults.generic_nullable_class;
 }
 
 
@@ -5958,7 +6023,7 @@ MonoClass*
 mono_class_get_nullable_param (MonoClass *klass)
 {
        g_assert (mono_class_is_nullable (klass));
-       return mono_class_from_mono_type (klass->generic_class->context.class_inst->type_argv [0]);
+       return mono_class_from_mono_type (mono_class_get_generic_class (klass)->context.class_inst->type_argv [0]);
 }
 
 static void
@@ -5966,13 +6031,13 @@ mono_generic_class_setup_parent (MonoClass *klass, MonoClass *gtd)
 {
        if (gtd->parent) {
                MonoError error;
-               MonoGenericClass *gclass = klass->generic_class;
+               MonoGenericClass *gclass = mono_class_get_generic_class (klass);
 
                klass->parent = mono_class_inflate_generic_class_checked (gtd->parent, mono_generic_class_get_context (gclass), &error);
                if (!mono_error_ok (&error)) {
                        /*Set parent to something safe as the runtime doesn't handle well this kind of failure.*/
                        klass->parent = mono_defaults.object_class;
-                       mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, NULL);
+                       mono_class_set_type_load_failure (klass, "Parent is a generic type instantiation that failed due to: %s", mono_error_get_message (&error));
                        mono_error_cleanup (&error);
                }
        }
@@ -6004,7 +6069,7 @@ mono_generic_class_get_class (MonoGenericClass *gclass)
                return gclass->cached_class;
        }
 
-       klass = (MonoClass *)mono_image_set_alloc0 (gclass->owner, sizeof (MonoClass));
+       klass = (MonoClass *)mono_image_set_alloc0 (gclass->owner, sizeof (MonoClassGenericInst));
 
        gklass = gclass->container_class;
 
@@ -6022,12 +6087,11 @@ mono_generic_class_get_class (MonoGenericClass *gclass)
        mono_profiler_class_event (klass, MONO_PROFILE_START_LOAD);
        
        klass->image = gklass->image;
-       klass->flags = gklass->flags;
        klass->type_token = gklass->type_token;
-       klass->field.count = gklass->field.count;
 
-       klass->is_inflated = 1;
-       klass->generic_class = gclass;
+       klass->class_kind = MONO_CLASS_GINST;
+       //FIXME add setter
+       ((MonoClassGenericInst*)klass)->generic_class = gclass;
 
        klass->byval_arg.type = MONO_TYPE_GENERICINST;
        klass->this_arg.type = klass->byval_arg.type;
@@ -6035,6 +6099,7 @@ mono_generic_class_get_class (MonoGenericClass *gclass)
        klass->this_arg.byref = TRUE;
        klass->enumtype = gklass->enumtype;
        klass->valuetype = gklass->valuetype;
+       klass->simd_type = gklass->simd_type;
 
        klass->cast_class = klass->element_class = klass;
 
@@ -6077,8 +6142,8 @@ mono_generic_class_get_class (MonoGenericClass *gclass)
 
        mono_profiler_class_loaded (klass, MONO_PROFILE_OK);
 
-       inflated_classes ++;
-       inflated_classes_size += sizeof (MonoClass);
+       ++class_ginst_count;
+       inflated_classes_size += sizeof (MonoClassGenericInst);
        
        mono_loader_unlock ();
 
@@ -6139,8 +6204,10 @@ make_generic_param_class (MonoGenericParam *param, MonoGenericParamInfo *pinfo)
        gboolean is_mvar = container->is_method;
        gboolean is_anonymous = container->is_anonymous;
 
-       klass = (MonoClass *)mono_image_alloc0 (image, sizeof (MonoClass));
-       classes_size += sizeof (MonoClass);
+       klass = (MonoClass *)mono_image_alloc0 (image, sizeof (MonoClassGenericParam));
+       klass->class_kind = MONO_CLASS_GPARAM;
+       classes_size += sizeof (MonoClassGenericParam);
+       ++class_gparam_count;
 
        if (pinfo) {
                CHECKED_METADATA_WRITE_PTR_EXEMPT ( klass->name , pinfo->name );
@@ -6190,7 +6257,6 @@ make_generic_param_class (MonoGenericParam *param, MonoGenericParamInfo *pinfo)
        klass->inited = TRUE;
        CHECKED_METADATA_WRITE_PTR_LOCAL ( klass->cast_class ,    klass );
        CHECKED_METADATA_WRITE_PTR_LOCAL ( klass->element_class , klass );
-       klass->flags = TYPE_ATTRIBUTE_PUBLIC;
 
        klass->byval_arg.type = is_mvar ? MONO_TYPE_MVAR : MONO_TYPE_VAR;
        klass->this_arg.type = klass->byval_arg.type;
@@ -6210,14 +6276,13 @@ make_generic_param_class (MonoGenericParam *param, MonoGenericParamInfo *pinfo)
        klass->instance_size = sizeof (MonoObject) + mono_type_stack_size_internal (&klass->byval_arg, NULL, TRUE);
        mono_memory_barrier ();
        klass->size_inited = 1;
-       klass->setup_fields_called = 1;
 
        mono_class_setup_supertypes (klass);
 
        if (count - pos > 0) {
                mono_class_setup_vtable (klass->parent);
                if (mono_class_has_failure (klass->parent))
-                       mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, g_strdup ("Failed to setup parent interfaces"));
+                       mono_class_set_type_load_failure (klass, "Failed to setup parent interfaces");
                else
                        setup_interface_offsets (klass, klass->parent->vtable_size, TRUE);
        }
@@ -6417,23 +6482,23 @@ mono_ptr_class_get (MonoType *type)
        }
        mono_image_unlock (image);
        
-       result = (MonoClass *)mono_image_alloc0 (image, sizeof (MonoClass));
+       result = (MonoClass *)mono_image_alloc0 (image, sizeof (MonoClassPointer));
 
-       classes_size += sizeof (MonoClass);
+       classes_size += sizeof (MonoClassPointer);
+       ++class_pointer_count;
 
        result->parent = NULL; /* no parent for PTR types */
        result->name_space = el_class->name_space;
        name = g_strdup_printf ("%s*", el_class->name);
        result->name = mono_image_strdup (image, name);
+       result->class_kind = MONO_CLASS_POINTER;
        g_free (name);
 
        mono_profiler_class_event (result, MONO_PROFILE_START_LOAD);
 
        result->image = el_class->image;
        result->inited = TRUE;
-       result->flags = TYPE_ATTRIBUTE_CLASS | (el_class->flags & TYPE_ATTRIBUTE_VISIBILITY_MASK);
-       /* Can pointers get boxed? */
-       result->instance_size = sizeof (gpointer);
+       result->instance_size = sizeof (MonoObject) + sizeof (gpointer);
        result->cast_class = result->element_class = el_class;
        result->blittable = TRUE;
 
@@ -6482,17 +6547,19 @@ mono_fnptr_class_get (MonoMethodSignature *sig)
        }
        result = g_new0 (MonoClass, 1);
 
+       classes_size += sizeof (MonoClassPointer);
+       ++class_pointer_count;
+
        result->parent = NULL; /* no parent for PTR types */
        result->name_space = "System";
        result->name = "MonoFNPtrFakeClass";
+       result->class_kind = MONO_CLASS_POINTER;
 
        mono_profiler_class_event (result, MONO_PROFILE_START_LOAD);
 
        result->image = mono_defaults.corlib; /* need to fix... */
        result->inited = TRUE;
-       result->flags = TYPE_ATTRIBUTE_CLASS; /* | (el_class->flags & TYPE_ATTRIBUTE_VISIBILITY_MASK); */
-       /* Can pointers get boxed? */
-       result->instance_size = sizeof (gpointer);
+       result->instance_size = sizeof (MonoObject) + sizeof (gpointer);
        result->cast_class = result->element_class = result;
        result->blittable = TRUE;
 
@@ -6653,7 +6720,6 @@ mono_bounded_array_class_get (MonoClass *eclass, guint32 rank, gboolean bounded)
        GSList *list, *rootlist = NULL;
        int nsize;
        char *name;
-       gboolean corlib_type = FALSE;
 
        g_assert (rank <= 255);
 
@@ -6695,20 +6761,16 @@ mono_bounded_array_class_get (MonoClass *eclass, guint32 rank, gboolean bounded)
                }
        }
 
-       /* for the building corlib use System.Array from it */
-       if (image->assembly && assembly_is_dynamic (image->assembly) && image->assembly_name && strcmp (image->assembly_name, "mscorlib") == 0) {
-               parent = mono_class_load_from_name (image, "System", "Array");
-               corlib_type = TRUE;
-       } else {
-               parent = mono_defaults.array_class;
-               if (!parent->inited)
-                       mono_class_init (parent);
-       }
+       parent = mono_defaults.array_class;
+       if (!parent->inited)
+               mono_class_init (parent);
 
-       klass = (MonoClass *)mono_image_alloc0 (image, sizeof (MonoClass));
+       klass = (MonoClass *)mono_image_alloc0 (image, sizeof (MonoClassArray));
 
        klass->image = image;
        klass->name_space = eclass->name_space;
+       klass->class_kind = MONO_CLASS_ARRAY;
+
        nsize = strlen (eclass->name);
        name = (char *)g_malloc (nsize + 2 + rank + 1);
        memcpy (name, eclass->name, nsize);
@@ -6724,21 +6786,25 @@ mono_bounded_array_class_get (MonoClass *eclass, guint32 rank, gboolean bounded)
 
        mono_profiler_class_event (klass, MONO_PROFILE_START_LOAD);
 
-       classes_size += sizeof (MonoClass);
+       classes_size += sizeof (MonoClassArray);
+       ++class_array_count;
 
        klass->type_token = 0;
-       /* all arrays are marked serializable and sealed, bug #42779 */
-       klass->flags = TYPE_ATTRIBUTE_CLASS | TYPE_ATTRIBUTE_SERIALIZABLE | TYPE_ATTRIBUTE_SEALED | TYPE_ATTRIBUTE_PUBLIC;
        klass->parent = parent;
        klass->instance_size = mono_class_instance_size (klass->parent);
 
        if (eclass->byval_arg.type == MONO_TYPE_TYPEDBYREF || eclass->byval_arg.type == MONO_TYPE_VOID) {
                /*Arrays of those two types are invalid.*/
-               mono_class_set_failure (klass, MONO_EXCEPTION_INVALID_PROGRAM, NULL);
+               MonoError prepared_error;
+               mono_error_init (&prepared_error);
+               mono_error_set_invalid_program (&prepared_error, "Arrays of void or System.TypedReference types are invalid.");
+               mono_class_set_failure (klass, mono_error_box (&prepared_error, klass->image));
+               mono_error_cleanup (&prepared_error);
        } else if (eclass->enumtype && !mono_class_enum_basetype (eclass)) {
-               if (!eclass->ref_info_handle || eclass->wastypebuilder) {
+               guint32 ref_info_handle = mono_class_get_ref_info_handle (eclass);
+               if (!ref_info_handle || eclass->wastypebuilder) {
                        g_warning ("Only incomplete TypeBuilder objects are allowed to be an enum without base_type");
-                       g_assert (eclass->ref_info_handle && !eclass->wastypebuilder);
+                       g_assert (ref_info_handle && !eclass->wastypebuilder);
                }
                /* element_size -1 is ok as this is not an instantitable type*/
                klass->sizes.element_size = -1;
@@ -6747,12 +6813,12 @@ mono_bounded_array_class_get (MonoClass *eclass, guint32 rank, gboolean bounded)
 
        mono_class_setup_supertypes (klass);
 
-       if (eclass->generic_class)
+       if (mono_class_is_ginst (eclass))
                mono_class_init (eclass);
        if (!eclass->size_inited)
                mono_class_setup_fields (eclass);
-       if (mono_class_has_failure (eclass)) /*FIXME we fail the array type, but we have to let other fields be set.*/
-               mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, NULL);
+       mono_class_set_type_load_failure_causedby_class (klass, eclass, "Could not load array element type");
+       /*FIXME we fail the array type, but we have to let other fields be set.*/
 
        klass->has_references = MONO_TYPE_IS_REFERENCE (&eclass->byval_arg) || eclass->has_references? TRUE: FALSE;
 
@@ -6803,11 +6869,9 @@ mono_bounded_array_class_get (MonoClass *eclass, guint32 rank, gboolean bounded)
        }
        klass->this_arg = klass->byval_arg;
        klass->this_arg.byref = 1;
-       if (corlib_type) {
-               klass->inited = 1;
-       }
 
-       klass->generic_container = eclass->generic_container;
+       //WTF was this? it's wrong
+       // klass->generic_container = eclass->generic_container;
 
        if (rank == 1 && !bounded) {
                MonoClass *prev_class;
@@ -6869,7 +6933,7 @@ mono_class_instance_size (MonoClass *klass)
  *
  * Use to get the computed minimum alignment requirements for the specified class.
  *
- * Returns: minimm alignment requirements 
+ * Returns: minimum alignment requirements
  */
 gint32
 mono_class_min_align (MonoClass *klass)
@@ -6890,7 +6954,7 @@ mono_class_min_align (MonoClass *klass)
  * Returns: the size of a value of kind @klass
  */
 gint32
-mono_class_value_size      (MonoClass *klass, guint32 *align)
+mono_class_value_size (MonoClass *klass, guint32 *align)
 {
        gint32 size;
 
@@ -6920,7 +6984,7 @@ mono_class_data_size (MonoClass *klass)
                mono_class_init (klass);
        /* This can happen with dynamically created types */
        if (!klass->fields_inited)
-               mono_class_setup_fields_locking (klass);
+               mono_class_setup_fields (klass);
 
        /* in arrays, sizes.class_size is unioned with element_size
         * and arrays have no static fields
@@ -6938,28 +7002,30 @@ mono_class_data_size (MonoClass *klass)
 static MonoClassField *
 mono_class_get_field_idx (MonoClass *klass, int idx)
 {
-       mono_class_setup_fields_locking (klass);
+       mono_class_setup_fields (klass);
        if (mono_class_has_failure (klass))
                return NULL;
 
        while (klass) {
+               int first_field_idx = mono_class_get_first_field_idx (klass);
+               int fcount = mono_class_get_field_count (klass);
                if (klass->image->uncompressed_metadata) {
                        /* 
-                        * klass->field.first points to the FieldPtr table, while idx points into the
+                        * first_field_idx points to the FieldPtr table, while idx points into the
                         * Field table, so we have to do a search.
                         */
                        /*FIXME this is broken for types with multiple fields with the same name.*/
                        const char *name = mono_metadata_string_heap (klass->image, mono_metadata_decode_row_col (&klass->image->tables [MONO_TABLE_FIELD], idx, MONO_FIELD_NAME));
                        int i;
 
-                       for (i = 0; i < klass->field.count; ++i)
+                       for (i = 0; i < fcount; ++i)
                                if (mono_field_get_name (&klass->fields [i]) == name)
                                        return &klass->fields [i];
                        g_assert_not_reached ();
                } else {                        
-                       if (klass->field.count) {
-                               if ((idx >= klass->field.first) && (idx < klass->field.first + klass->field.count)){
-                                       return &klass->fields [idx - klass->field.first];
+                       if (fcount) {
+                               if ((idx >= first_field_idx) && (idx < first_field_idx + fcount)){
+                                       return &klass->fields [idx - first_field_idx];
                                }
                        }
                }
@@ -7020,12 +7086,13 @@ mono_class_get_field_from_name_full (MonoClass *klass, const char *name, MonoTyp
 {
        int i;
 
-       mono_class_setup_fields_locking (klass);
+       mono_class_setup_fields (klass);
        if (mono_class_has_failure (klass))
                return NULL;
 
        while (klass) {
-               for (i = 0; i < klass->field.count; ++i) {
+               int fcount = mono_class_get_field_count (klass);
+               for (i = 0; i < fcount; ++i) {
                        MonoClassField *field = &klass->fields [i];
 
                        if (strcmp (name, mono_field_get_name (field)) != 0)
@@ -7058,14 +7125,16 @@ mono_class_get_field_token (MonoClassField *field)
        MonoClass *klass = field->parent;
        int i;
 
-       mono_class_setup_fields_locking (klass);
+       mono_class_setup_fields (klass);
 
        while (klass) {
                if (!klass->fields)
                        return 0;
-               for (i = 0; i < klass->field.count; ++i) {
+               int first_field_idx = mono_class_get_first_field_idx (klass);
+               int fcount = mono_class_get_field_count (klass);
+               for (i = 0; i < fcount; ++i) {
                        if (&klass->fields [i] == field) {
-                               int idx = klass->field.first + i + 1;
+                               int idx = first_field_idx + i + 1;
 
                                if (klass->image->uncompressed_metadata)
                                        idx = mono_metadata_translate_token_index (klass->image, MONO_TABLE_FIELD, idx);
@@ -7083,8 +7152,7 @@ static int
 mono_field_get_index (MonoClassField *field)
 {
        int index = field - field->parent->fields;
-
-       g_assert (index >= 0 && index < field->parent->field.count);
+       g_assert (index >= 0 && index < mono_class_get_field_count (field->parent));
 
        return index;
 }
@@ -7104,23 +7172,25 @@ mono_class_get_field_default_value (MonoClassField *field, MonoTypeEnum *def_typ
 
        g_assert (field->type->attrs & FIELD_ATTRIBUTE_HAS_DEFAULT);
 
-       if (!klass->ext || !klass->ext->field_def_values) {
+       MonoClassExt *ext = mono_class_get_ext (klass);
+       if (!ext || !ext->field_def_values) {
                MonoFieldDefaultValue *def_values;
 
                mono_class_alloc_ext (klass);
+               ext = mono_class_get_ext (klass);
 
-               def_values = (MonoFieldDefaultValue *)mono_class_alloc0 (klass, sizeof (MonoFieldDefaultValue) * klass->field.count);
+               def_values = (MonoFieldDefaultValue *)mono_class_alloc0 (klass, sizeof (MonoFieldDefaultValue) * mono_class_get_field_count (klass));
 
                mono_image_lock (klass->image);
                mono_memory_barrier ();
-               if (!klass->ext->field_def_values)
-                       klass->ext->field_def_values = def_values;
+               if (!ext->field_def_values)
+                       ext->field_def_values = def_values;
                mono_image_unlock (klass->image);
        }
 
        field_index = mono_field_get_index (field);
                
-       if (!klass->ext->field_def_values [field_index].data) {
+       if (!ext->field_def_values [field_index].data) {
                cindex = mono_metadata_get_constant_index (field->parent->image, mono_class_get_field_token (field), 0);
                if (!cindex)
                        return NULL;
@@ -7128,20 +7198,21 @@ mono_class_get_field_default_value (MonoClassField *field, MonoTypeEnum *def_typ
                g_assert (!(field->type->attrs & FIELD_ATTRIBUTE_HAS_FIELD_RVA));
 
                mono_metadata_decode_row (&field->parent->image->tables [MONO_TABLE_CONSTANT], cindex - 1, constant_cols, MONO_CONSTANT_SIZE);
-               klass->ext->field_def_values [field_index].def_type = (MonoTypeEnum)constant_cols [MONO_CONSTANT_TYPE];
-               klass->ext->field_def_values [field_index].data = (const char *)mono_metadata_blob_heap (field->parent->image, constant_cols [MONO_CONSTANT_VALUE]);
+               ext->field_def_values [field_index].def_type = (MonoTypeEnum)constant_cols [MONO_CONSTANT_TYPE];
+               ext->field_def_values [field_index].data = (const char *)mono_metadata_blob_heap (field->parent->image, constant_cols [MONO_CONSTANT_VALUE]);
        }
 
-       *def_type = klass->ext->field_def_values [field_index].def_type;
-       return klass->ext->field_def_values [field_index].data;
+       *def_type = ext->field_def_values [field_index].def_type;
+       return ext->field_def_values [field_index].data;
 }
 
 static int
 mono_property_get_index (MonoProperty *prop)
 {
-       int index = prop - prop->parent->ext->properties;
+       MonoClassExt *ext = mono_class_get_ext (prop->parent);
+       int index = prop - ext->properties;
 
-       g_assert (index >= 0 && index < prop->parent->ext->property.count);
+       g_assert (index >= 0 && index < ext->property.count);
 
        return index;
 }
@@ -7166,10 +7237,11 @@ mono_class_get_property_default_value (MonoProperty *property, MonoTypeEnum *def
         */
 
        if (image_is_dynamic (klass->image)) {
+               MonoClassExt *ext = mono_class_get_ext (klass);
                int prop_index = mono_property_get_index (property);
-               if (klass->ext->prop_def_values && klass->ext->prop_def_values [prop_index].data) {
-                       *def_type = klass->ext->prop_def_values [prop_index].def_type;
-                       return klass->ext->prop_def_values [prop_index].data;
+               if (ext->prop_def_values && ext->prop_def_values [prop_index].data) {
+                       *def_type = ext->prop_def_values [prop_index].def_type;
+                       return ext->prop_def_values [prop_index].data;
                }
                return NULL;
        }
@@ -7189,10 +7261,11 @@ mono_class_get_event_token (MonoEvent *event)
        int i;
 
        while (klass) {
-               if (klass->ext) {
-                       for (i = 0; i < klass->ext->event.count; ++i) {
-                               if (&klass->ext->events [i] == event)
-                                       return mono_metadata_make_token (MONO_TABLE_EVENT, klass->ext->event.first + i + 1);
+               MonoClassExt *ext = mono_class_get_ext (klass);
+               if (ext) {
+                       for (i = 0; i < ext->event.count; ++i) {
+                               if (&ext->events [i] == event)
+                                       return mono_metadata_make_token (MONO_TABLE_EVENT, ext->event.first + i + 1);
                        }
                }
                klass = klass->parent;
@@ -7240,9 +7313,10 @@ mono_class_get_property_token (MonoProperty *prop)
                MonoProperty* p;
                int i = 0;
                gpointer iter = NULL;
+               MonoClassExt *ext = mono_class_get_ext (klass);
                while ((p = mono_class_get_properties (klass, &iter))) {
-                       if (&klass->ext->properties [i] == prop)
-                               return mono_metadata_make_token (MONO_TABLE_PROPERTY, klass->ext->property.first + i + 1);
+                       if (&ext->properties [i] == prop)
+                               return mono_metadata_make_token (MONO_TABLE_PROPERTY, ext->property.first + i + 1);
                        
                        i ++;
                }
@@ -7813,7 +7887,7 @@ search_modules (MonoImage *image, const char *name_space, const char *name, Mono
                if (cols [MONO_FILE_FLAGS] == FILE_CONTAINS_NO_METADATA)
                        continue;
 
-               file_image = mono_image_load_file_for_image (image, i + 1);
+               file_image = mono_image_load_file_for_image_checked (image, i + 1, error);
                if (file_image) {
                        klass = mono_class_from_name_checked (file_image, name_space, name, error);
                        if (klass || !is_ok (error))
@@ -7909,7 +7983,7 @@ mono_class_from_name_checked_aux (MonoImage *image, const char* name_space, cons
 
                impl = cols [MONO_EXP_TYPE_IMPLEMENTATION];
                if ((impl & MONO_IMPLEMENTATION_MASK) == MONO_IMPLEMENTATION_FILE) {
-                       loaded_image = mono_assembly_load_module (image->assembly, impl >> MONO_IMPLEMENTATION_BITS);
+                       loaded_image = mono_assembly_load_module_checked (image->assembly, impl >> MONO_IMPLEMENTATION_BITS, error);
                        if (!loaded_image)
                                return NULL;
                        klass = mono_class_from_name_checked_aux (loaded_image, name_space, name, visited_images, error);
@@ -8109,10 +8183,10 @@ mono_class_has_variant_generic_params (MonoClass *klass)
        int i;
        MonoGenericContainer *container;
 
-       if (!klass->generic_class)
+       if (!mono_class_is_ginst (klass))
                return FALSE;
 
-       container = klass->generic_class->container_class->generic_container;
+       container = mono_class_get_generic_container (mono_class_get_generic_class (klass)->container_class);
 
        for (i = 0; i < container->type_argc; ++i)
                if (mono_generic_container_get_param_info (container, i)->flags & (MONO_GEN_PARAM_VARIANT|MONO_GEN_PARAM_COVARIANT))
@@ -8156,7 +8230,7 @@ mono_class_is_variant_compatible (MonoClass *klass, MonoClass *oklass, gboolean
        int j;
        MonoType **klass_argv, **oklass_argv;
        MonoClass *klass_gtd = mono_class_get_generic_type_definition (klass);
-       MonoGenericContainer *container = klass_gtd->generic_container;
+       MonoGenericContainer *container = mono_class_get_generic_container (klass_gtd);
 
        if (klass == oklass)
                return TRUE;
@@ -8165,8 +8239,8 @@ mono_class_is_variant_compatible (MonoClass *klass, MonoClass *oklass, gboolean
        if (mono_class_get_generic_type_definition (oklass) != klass_gtd || oklass == klass_gtd)
                return FALSE;
 
-       klass_argv = &klass->generic_class->context.class_inst->type_argv [0];
-       oklass_argv = &oklass->generic_class->context.class_inst->type_argv [0];
+       klass_argv = &mono_class_get_generic_class (klass)->context.class_inst->type_argv [0];
+       oklass_argv = &mono_class_get_generic_class (oklass)->context.class_inst->type_argv [0];
 
        for (j = 0; j < container->type_argc; ++j) {
                MonoClass *param1_class = mono_class_from_mono_type (klass_argv [j]);
@@ -8339,7 +8413,7 @@ mono_class_is_assignable_from (MonoClass *klass, MonoClass *oklass)
                }
 
                /* interface_offsets might not be set for dynamic classes */
-               if (oklass->ref_info_handle && !oklass->interface_bitmap) {
+               if (mono_class_get_ref_info_handle (oklass) && !oklass->interface_bitmap) {
                        /* 
                         * oklass might be a generic type parameter but they have 
                         * interface_offsets set.
@@ -8421,14 +8495,14 @@ mono_class_is_variant_compatible_slow (MonoClass *klass, MonoClass *oklass)
        int j;
        MonoType **klass_argv, **oklass_argv;
        MonoClass *klass_gtd = mono_class_get_generic_type_definition (klass);
-       MonoGenericContainer *container = klass_gtd->generic_container;
+       MonoGenericContainer *container = mono_class_get_generic_container (klass_gtd);
 
        /*Viable candidates are instances of the same generic interface*/
        if (mono_class_get_generic_type_definition (oklass) != klass_gtd || oklass == klass_gtd)
                return FALSE;
 
-       klass_argv = &klass->generic_class->context.class_inst->type_argv [0];
-       oklass_argv = &oklass->generic_class->context.class_inst->type_argv [0];
+       klass_argv = &mono_class_get_generic_class (klass)->context.class_inst->type_argv [0];
+       oklass_argv = &mono_class_get_generic_class (oklass)->context.class_inst->type_argv [0];
 
        for (j = 0; j < container->type_argc; ++j) {
                MonoClass *param1_class = mono_class_from_mono_type (klass_argv [j]);
@@ -8605,8 +8679,8 @@ mono_class_get_cctor (MonoClass *klass)
                return result;
        }
 
-       if (klass->generic_class && !klass->methods)
-               return mono_class_get_inflated_method (klass, mono_class_get_cctor (klass->generic_class->container_class));
+       if (mono_class_is_ginst (klass) && !klass->methods)
+               return mono_class_get_inflated_method (klass, mono_class_get_cctor (mono_class_get_generic_class (klass)->container_class));
 
        return mono_class_get_method_from_name_flags (klass, ".cctor", -1, METHOD_ATTRIBUTE_SPECIAL_NAME);
 }
@@ -8987,22 +9061,6 @@ mono_class_get_rank (MonoClass *klass)
        return klass->rank;
 }
 
-/**
- * mono_class_get_flags:
- * @klass: the MonoClass to act on
- *
- * The type flags from the TypeDef table from the metadata.
- * see the TYPE_ATTRIBUTE_* definitions on tabledefs.h for the
- * different values.
- *
- * Returns: The flags from the TypeDef table.
- */
-guint32
-mono_class_get_flags (MonoClass *klass)
-{
-       return klass->flags;
-}
-
 /**
  * mono_class_get_name
  * @klass: the MonoClass to act on
@@ -9076,7 +9134,7 @@ mono_class_get_byref_type (MonoClass *klass)
 int
 mono_class_num_fields (MonoClass *klass)
 {
-       return klass->field.count;
+       return mono_class_get_field_count (klass);
 }
 
 /**
@@ -9088,7 +9146,7 @@ mono_class_num_fields (MonoClass *klass)
 int
 mono_class_num_methods (MonoClass *klass)
 {
-       return klass->method.count;
+       return mono_class_get_method_count (klass);
 }
 
 /**
@@ -9102,7 +9160,7 @@ mono_class_num_properties (MonoClass *klass)
 {
        mono_class_setup_properties (klass);
 
-       return klass->ext->property.count;
+       return mono_class_get_ext (klass)->property.count;
 }
 
 /**
@@ -9116,7 +9174,7 @@ mono_class_num_events (MonoClass *klass)
 {
        mono_class_setup_events (klass);
 
-       return klass->ext->event.count;
+       return mono_class_get_ext (klass)->event.count;
 }
 
 /**
@@ -9138,11 +9196,11 @@ mono_class_get_fields (MonoClass* klass, gpointer *iter)
        if (!iter)
                return NULL;
        if (!*iter) {
-               mono_class_setup_fields_locking (klass);
+               mono_class_setup_fields (klass);
                if (mono_class_has_failure (klass))
                        return NULL;
                /* start from the first */
-               if (klass->field.count) {
+               if (mono_class_get_field_count (klass)) {
                        *iter = &klass->fields [0];
                        return &klass->fields [0];
                } else {
@@ -9152,7 +9210,7 @@ mono_class_get_fields (MonoClass* klass, gpointer *iter)
        }
        field = (MonoClassField *)*iter;
        field++;
-       if (field < &klass->fields [klass->field.count]) {
+       if (field < &klass->fields [mono_class_get_field_count (klass)]) {
                *iter = field;
                return field;
        }
@@ -9187,7 +9245,7 @@ mono_class_get_methods (MonoClass* klass, gpointer *iter)
                if (!klass->methods)
                        return NULL;
                /* start from the first */
-               if (klass->method.count) {
+               if (mono_class_get_method_count (klass)) {
                        *iter = &klass->methods [0];
                        return klass->methods [0];
                } else {
@@ -9197,7 +9255,7 @@ mono_class_get_methods (MonoClass* klass, gpointer *iter)
        }
        method = (MonoMethod **)*iter;
        method++;
-       if (method < &klass->methods [klass->method.count]) {
+       if (method < &klass->methods [mono_class_get_method_count (klass)]) {
                *iter = method;
                return *method;
        }
@@ -9232,12 +9290,13 @@ mono_class_get_virtual_methods (MonoClass* klass, gpointer *iter)
                        method = (MonoMethod **)*iter;
                        method++;
                }
-               while (method < &klass->methods [klass->method.count]) {
+               int mcount = mono_class_get_method_count (klass);
+               while (method < &klass->methods [mcount]) {
                        if (*method && ((*method)->flags & METHOD_ATTRIBUTE_VIRTUAL))
                                break;
                        method ++;
                }
-               if (method < &klass->methods [klass->method.count]) {
+               if (method < &klass->methods [mcount]) {
                        *iter = method;
                        return *method;
                } else {
@@ -9254,19 +9313,21 @@ mono_class_get_virtual_methods (MonoClass* klass, gpointer *iter)
                        start_index = GPOINTER_TO_UINT (*iter);
                }
 
-               for (i = start_index; i < klass->method.count; ++i) {
+               int first_idx = mono_class_get_first_method_idx (klass);
+               int mcount = mono_class_get_method_count (klass);
+               for (i = start_index; i < mcount; ++i) {
                        guint32 flags;
 
-                       /* klass->method.first points into the methodptr table */
-                       flags = mono_metadata_decode_table_row_col (klass->image, MONO_TABLE_METHOD, klass->method.first + i, MONO_METHOD_FLAGS);
+                       /* first_idx points into the methodptr table */
+                       flags = mono_metadata_decode_table_row_col (klass->image, MONO_TABLE_METHOD, first_idx + i, MONO_METHOD_FLAGS);
 
                        if (flags & METHOD_ATTRIBUTE_VIRTUAL)
                                break;
                }
 
-               if (i < klass->method.count) {
+               if (i < mcount) {
                        MonoError error;
-                       res = mono_get_method_checked (klass->image, MONO_TOKEN_METHOD_DEF | (klass->method.first + i + 1), klass, NULL, &error);
+                       res = mono_get_method_checked (klass->image, MONO_TOKEN_METHOD_DEF | (first_idx + i + 1), klass, NULL, &error);
                        mono_error_cleanup (&error); /* FIXME don't swallow the error */
 
                        /* Add 1 here so the if (*iter) check fails */
@@ -9298,9 +9359,10 @@ mono_class_get_properties (MonoClass* klass, gpointer *iter)
                return NULL;
        if (!*iter) {
                mono_class_setup_properties (klass);
+               MonoClassExt *ext = mono_class_get_ext (klass);
                /* start from the first */
-               if (klass->ext->property.count) {
-                       *iter = &klass->ext->properties [0];
+               if (ext->property.count) {
+                       *iter = &ext->properties [0];
                        return (MonoProperty *)*iter;
                } else {
                        /* no fields */
@@ -9309,7 +9371,8 @@ mono_class_get_properties (MonoClass* klass, gpointer *iter)
        }
        property = (MonoProperty *)*iter;
        property++;
-       if (property < &klass->ext->properties [klass->ext->property.count]) {
+       MonoClassExt *ext = mono_class_get_ext (klass);
+       if (property < &ext->properties [ext->property.count]) {
                *iter = property;
                return (MonoProperty *)*iter;
        }
@@ -9336,9 +9399,10 @@ mono_class_get_events (MonoClass* klass, gpointer *iter)
                return NULL;
        if (!*iter) {
                mono_class_setup_events (klass);
+               MonoClassExt *ext = mono_class_get_ext (klass);
                /* start from the first */
-               if (klass->ext->event.count) {
-                       *iter = &klass->ext->events [0];
+               if (ext->event.count) {
+                       *iter = &ext->events [0];
                        return (MonoEvent *)*iter;
                } else {
                        /* no fields */
@@ -9347,7 +9411,8 @@ mono_class_get_events (MonoClass* klass, gpointer *iter)
        }
        event = (MonoEvent *)*iter;
        event++;
-       if (event < &klass->ext->events [klass->ext->event.count]) {
+       MonoClassExt *ext = mono_class_get_ext (klass);
+       if (event < &ext->events [ext->event.count]) {
                *iter = event;
                return (MonoEvent *)*iter;
        }
@@ -9445,7 +9510,7 @@ setup_nested_types (MonoClass *klass)
 
        mono_memory_barrier ();
        if (!klass->nested_classes_inited) {
-               klass->ext->nested_classes = nested_classes;
+               mono_class_get_ext (klass)->nested_classes = nested_classes;
                mono_memory_barrier ();
                klass->nested_classes_inited = TRUE;
        }
@@ -9477,10 +9542,11 @@ mono_class_get_nested_types (MonoClass* klass, gpointer *iter)
                setup_nested_types (klass);
 
        if (!*iter) {
+               MonoClassExt *ext = mono_class_get_ext (klass);
                /* start from the first */
-               if (klass->ext && klass->ext->nested_classes) {
-                       *iter = klass->ext->nested_classes;
-                       return (MonoClass *)klass->ext->nested_classes->data;
+               if (ext && ext->nested_classes) {
+                       *iter = ext->nested_classes;
+                       return (MonoClass *)ext->nested_classes->data;
                } else {
                        /* no nested types */
                        return NULL;
@@ -9619,27 +9685,30 @@ mono_field_get_rva (MonoClassField *field)
 
        g_assert (field->type->attrs & FIELD_ATTRIBUTE_HAS_FIELD_RVA);
 
-       if (!klass->ext || !klass->ext->field_def_values) {
+       MonoClassExt *ext = mono_class_get_ext (klass);
+       if (!ext || !ext->field_def_values) {
                mono_class_alloc_ext (klass);
+               ext = mono_class_get_ext (klass);
 
-               field_def_values = (MonoFieldDefaultValue *)mono_class_alloc0 (klass, sizeof (MonoFieldDefaultValue) * klass->field.count);
+               field_def_values = (MonoFieldDefaultValue *)mono_class_alloc0 (klass, sizeof (MonoFieldDefaultValue) * mono_class_get_field_count (klass));
 
                mono_image_lock (klass->image);
-               if (!klass->ext->field_def_values)
-                       klass->ext->field_def_values = field_def_values;
+               if (!ext->field_def_values)
+                       ext->field_def_values = field_def_values;
                mono_image_unlock (klass->image);
        }
 
        field_index = mono_field_get_index (field);
                
-       if (!klass->ext->field_def_values [field_index].data && !image_is_dynamic (klass->image)) {
-               mono_metadata_field_info (field->parent->image, klass->field.first + field_index, NULL, &rva, NULL);
+       if (!ext->field_def_values [field_index].data && !image_is_dynamic (klass->image)) {
+               int first_field_idx = mono_class_get_first_field_idx (klass);
+               mono_metadata_field_info (field->parent->image, first_field_idx + field_index, NULL, &rva, NULL);
                if (!rva)
                        g_warning ("field %s in %s should have RVA data, but hasn't", mono_field_get_name (field), field->parent->name);
-               klass->ext->field_def_values [field_index].data = mono_image_rva_map (field->parent->image, rva);
+               ext->field_def_values [field_index].data = mono_image_rva_map (field->parent->image, rva);
        }
 
-       return klass->ext->field_def_values [field_index].data;
+       return ext->field_def_values [field_index].data;
 }
 
 /**
@@ -9823,17 +9892,19 @@ find_method_in_metadata (MonoClass *klass, const char *name, int param_count, in
        int i;
 
        /* Search directly in the metadata to avoid calling setup_methods () */
-       for (i = 0; i < klass->method.count; ++i) {
+       int first_idx = mono_class_get_first_method_idx (klass);
+       int mcount = mono_class_get_method_count (klass);
+       for (i = 0; i < mcount; ++i) {
                MonoError error;
                guint32 cols [MONO_METHOD_SIZE];
                MonoMethod *method;
                MonoMethodSignature *sig;
 
-               /* klass->method.first points into the methodptr table */
-               mono_metadata_decode_table_row (klass->image, MONO_TABLE_METHOD, klass->method.first + i, cols, MONO_METHOD_SIZE);
+               /* first_idx points into the methodptr table */
+               mono_metadata_decode_table_row (klass->image, MONO_TABLE_METHOD, first_idx + i, cols, MONO_METHOD_SIZE);
 
                if (!strcmp (mono_metadata_string_heap (klass->image, cols [MONO_METHOD_NAME]), name)) {
-                       method = mono_get_method_checked (klass->image, MONO_TOKEN_METHOD_DEF | (klass->method.first + i + 1), klass, NULL, &error);
+                       method = mono_get_method_checked (klass->image, MONO_TOKEN_METHOD_DEF | (first_idx + i + 1), klass, NULL, &error);
                        if (!method) {
                                mono_error_cleanup (&error); /* FIXME don't swallow the error */
                                continue;
@@ -9875,8 +9946,8 @@ mono_class_get_method_from_name_flags (MonoClass *klass, const char *name, int p
 
        mono_class_init (klass);
 
-       if (klass->generic_class && !klass->methods) {
-               res = mono_class_get_method_from_name_flags (klass->generic_class->container_class, name, param_count, flags);
+       if (mono_class_is_ginst (klass) && !klass->methods) {
+               res = mono_class_get_method_from_name_flags (mono_class_get_generic_class (klass)->container_class, name, param_count, flags);
                if (res) {
                        MonoError error;
                        res = mono_class_inflate_generic_method_full_checked (res, klass, mono_class_get_context (klass), &error);
@@ -9895,7 +9966,8 @@ mono_class_get_method_from_name_flags (MonoClass *klass, const char *name, int p
                 */
                if (!klass->methods)
                        return NULL;
-               for (i = 0; i < klass->method.count; ++i) {
+               int mcount = mono_class_get_method_count (klass);
+               for (i = 0; i < mcount; ++i) {
                        MonoMethod *method = klass->methods [i];
 
                        if (method->name[0] == name [0] && 
@@ -9925,21 +9997,63 @@ mono_class_get_method_from_name_flags (MonoClass *klass, const char *name, int p
  *
  * LOCKING: Acquires the loader lock.
  */
-gboolean
-mono_class_set_failure (MonoClass *klass, guint32 ex_type, void *ex_data)
+static gboolean
+mono_class_set_failure (MonoClass *klass, MonoErrorBoxed *boxed_error)
 {
+       g_assert (boxed_error != NULL);
+
        if (mono_class_has_failure (klass))
                return FALSE;
 
        mono_loader_lock ();
-       klass->exception_type = ex_type;
-       if (ex_data)
-               mono_image_property_insert (klass->image, klass, MONO_CLASS_PROP_EXCEPTION_DATA, ex_data);
+       klass->has_failure = 1;
+       mono_image_property_insert (klass->image, klass, MONO_CLASS_PROP_EXCEPTION_DATA, boxed_error);
        mono_loader_unlock ();
 
        return TRUE;
 }
 
+gboolean
+mono_class_has_failure (const MonoClass *klass)
+{
+       g_assert (klass != NULL);
+       return klass->has_failure != 0;
+}
+
+
+/**
+ * mono_class_set_type_load_failure:
+ * @klass: class in which the failure was detected
+ * @fmt: Printf-style error message string.
+ *
+ * Collect detected failure informaion in the class for later processing.
+ * The error is stored as a MonoErrorBoxed as with mono_error_set_type_load_class ()
+ * Note that only the first failure is kept.
+ *
+ * Returns FALSE if a failure was already set on the class, or TRUE otherwise.
+ *
+ * LOCKING: Acquires the loader lock.
+ */
+gboolean
+mono_class_set_type_load_failure (MonoClass *klass, const char * fmt, ...)
+{
+       MonoError prepare_error;
+       va_list args;
+
+       if (mono_class_has_failure (klass))
+               return FALSE;
+       
+       mono_error_init (&prepare_error);
+       
+       va_start (args, fmt);
+       mono_error_vset_type_load_class (&prepare_error, klass, fmt, args);
+       va_end (args);
+
+       MonoErrorBoxed *box = mono_error_box (&prepare_error, klass->image);
+       mono_error_cleanup (&prepare_error);
+       return mono_class_set_failure (klass, box);
+}
+
 /*
  * mono_class_get_exception_data:
  *
@@ -9947,10 +10061,10 @@ mono_class_set_failure (MonoClass *klass, guint32 ex_type, void *ex_data)
  *
  * LOCKING: Acquires the loader lock.
  */
-gpointer
-mono_class_get_exception_data (MonoClass *klass)
+static gpointer
+mono_class_get_exception_data (const MonoClass *klass)
 {
-       return mono_image_property_lookup (klass->image, klass, MONO_CLASS_PROP_EXCEPTION_DATA);
+       return mono_image_property_lookup (klass->image, (MonoClass*)klass, MONO_CLASS_PROP_EXCEPTION_DATA);
 }
 
 /**
@@ -9963,16 +10077,32 @@ mono_classes_init (void)
 {
        mono_os_mutex_init (&classes_mutex);
 
+       mono_native_tls_alloc (&setup_fields_tls_id, NULL);
+       mono_native_tls_alloc (&init_pending_tls_id, NULL);
+
+       mono_counters_register ("MonoClassDef count",
+                                                       MONO_COUNTER_METADATA | MONO_COUNTER_INT, &class_def_count);
+       mono_counters_register ("MonoClassGtd count",
+                                                       MONO_COUNTER_METADATA | MONO_COUNTER_INT, &class_gtd_count);
+       mono_counters_register ("MonoClassGenericInst count",
+                                                       MONO_COUNTER_METADATA | MONO_COUNTER_INT, &class_ginst_count);
+       mono_counters_register ("MonoClassGenericParam count",
+                                                       MONO_COUNTER_METADATA | MONO_COUNTER_INT, &class_gparam_count);
+       mono_counters_register ("MonoClassArray count",
+                                                       MONO_COUNTER_METADATA | MONO_COUNTER_INT, &class_array_count);
+       mono_counters_register ("MonoClassPointer count",
+                                                       MONO_COUNTER_METADATA | MONO_COUNTER_INT, &class_pointer_count);
        mono_counters_register ("Inflated methods size",
                                                        MONO_COUNTER_GENERICS | MONO_COUNTER_INT, &inflated_methods_size);
-       mono_counters_register ("Inflated classes",
-                                                       MONO_COUNTER_GENERICS | MONO_COUNTER_INT, &inflated_classes);
        mono_counters_register ("Inflated classes size",
                                                        MONO_COUNTER_GENERICS | MONO_COUNTER_INT, &inflated_classes_size);
        mono_counters_register ("MonoClass size",
                                                        MONO_COUNTER_METADATA | MONO_COUNTER_INT, &classes_size);
        mono_counters_register ("MonoClassExt size",
                                                        MONO_COUNTER_METADATA | MONO_COUNTER_INT, &class_ext_size);
+
+       mono_counters_register ("MonoClassExt count",
+                                                       MONO_COUNTER_METADATA | MONO_COUNTER_INT, &class_ext_count);
 }
 
 /**
@@ -9983,6 +10113,9 @@ mono_classes_init (void)
 void
 mono_classes_cleanup (void)
 {
+       mono_native_tls_free (setup_fields_tls_id);
+       mono_native_tls_free (init_pending_tls_id);
+
        if (global_interface_bitset)
                mono_bitset_free (global_interface_bitset);
        global_interface_bitset = NULL;
@@ -10000,55 +10133,12 @@ mono_classes_cleanup (void)
 MonoException*
 mono_class_get_exception_for_failure (MonoClass *klass)
 {
-       gpointer exception_data = mono_class_get_exception_data (klass);
-
-       switch (mono_class_get_failure(klass)) {
-       case MONO_EXCEPTION_TYPE_LOAD: {
-               MonoString *name;
-               MonoException *ex;
-               char *str = mono_type_get_full_name (klass);
-               char *astr = klass->image->assembly? mono_stringify_assembly_name (&klass->image->assembly->aname): NULL;
-               name = mono_string_new (mono_domain_get (), str);
-               g_free (str);
-               ex = mono_get_exception_type_load (name, astr);
-               g_free (astr);
-               return ex;
-       }
-       case MONO_EXCEPTION_MISSING_METHOD: {
-               char *class_name = (char *)exception_data;
-               char *assembly_name = class_name + strlen (class_name) + 1;
-
-               return mono_get_exception_missing_method (class_name, assembly_name);
-       }
-       case MONO_EXCEPTION_MISSING_FIELD: {
-               char *class_name = (char *)exception_data;
-               char *member_name = class_name + strlen (class_name) + 1;
-
-               return mono_get_exception_missing_field (class_name, member_name);
-       }
-       case MONO_EXCEPTION_FILE_NOT_FOUND: {
-               char *msg_format = (char *)exception_data;
-               char *assembly_name = msg_format + strlen (msg_format) + 1;
-               char *msg = g_strdup_printf (msg_format, assembly_name);
-               MonoException *ex;
-
-               ex = mono_get_exception_file_not_found2 (msg, mono_string_new (mono_domain_get (), assembly_name));
-
-               g_free (msg);
-
-               return ex;
-       }
-       case MONO_EXCEPTION_BAD_IMAGE: {
-               return mono_get_exception_bad_image_format ((const char *)exception_data);
-       }
-       case MONO_EXCEPTION_INVALID_PROGRAM: {
-               return mono_exception_from_name_msg (mono_defaults.corlib, "System", "InvalidProgramException", "");
-       }
-       default: {
-               /* TODO - handle other class related failures */
-               return mono_get_exception_execution_engine ("Unknown class failure");
-       }
-       }
+       if (!mono_class_has_failure (klass))
+               return NULL;
+       MonoError unboxed_error;
+       mono_error_init (&unboxed_error);
+       mono_error_set_for_class_failure (&unboxed_error, klass);
+       return mono_error_convert_to_exception (&unboxed_error);
 }
 
 static gboolean
@@ -10067,7 +10157,8 @@ is_nesting_type (MonoClass *outer_klass, MonoClass *inner_klass)
 MonoClass *
 mono_class_get_generic_type_definition (MonoClass *klass)
 {
-       return klass->generic_class ? klass->generic_class->container_class : klass;
+       MonoGenericClass *gklass =  mono_class_try_get_generic_class (klass);
+       return gklass ? gklass->container_class : klass;
 }
 
 /*
@@ -10164,8 +10255,9 @@ static MonoClass*
 get_generic_definition_class (MonoClass *klass)
 {
        while (klass) {
-               if (klass->generic_class && klass->generic_class->container_class)
-                       return klass->generic_class->container_class;
+               MonoGenericClass *gklass = mono_class_try_get_generic_class (klass);
+               if (gklass && gklass->container_class)
+                       return gklass->container_class;
                klass = klass->parent;
        }
        return NULL;
@@ -10219,12 +10311,12 @@ can_access_type (MonoClass *access_klass, MonoClass *member_klass)
        if (member_klass->element_class && !member_klass->enumtype)
                member_klass = member_klass->element_class;
 
-       access_level = member_klass->flags & TYPE_ATTRIBUTE_VISIBILITY_MASK;
+       access_level = mono_class_get_flags (member_klass) & TYPE_ATTRIBUTE_VISIBILITY_MASK;
 
        if (member_klass->byval_arg.type == MONO_TYPE_VAR || member_klass->byval_arg.type == MONO_TYPE_MVAR)
                return TRUE;
 
-       if (member_klass->generic_class && !can_access_instantiation (access_klass, member_klass->generic_class->context.class_inst))
+       if (mono_class_is_ginst (member_klass) && !can_access_instantiation (access_klass, mono_class_get_generic_class (member_klass)->context.class_inst))
                return FALSE;
 
        if (is_nesting_type (access_klass, member_klass) || (access_klass->nested_in && is_nesting_type (access_klass->nested_in, member_klass)))
@@ -10275,15 +10367,16 @@ can_access_member (MonoClass *access_klass, MonoClass *member_klass, MonoClass*
        if (access_klass->image->assembly && access_klass->image->assembly->corlib_internal)
                return TRUE;
 
-       if (((access_klass->generic_class && access_klass->generic_class->container_class) ||
-                                       access_klass->generic_container) && 
+       MonoGenericClass *access_gklass = mono_class_try_get_generic_class (access_klass);
+       if (((access_gklass && access_gklass->container_class) ||
+                                       mono_class_is_gtd (access_klass)) && 
                        (member_generic_def = get_generic_definition_class (member_klass))) {
                MonoClass *access_container;
 
-               if (access_klass->generic_container)
+               if (mono_class_is_gtd (access_klass))
                        access_container = access_klass;
                else
-                       access_container = access_klass->generic_class->container_class;
+                       access_container = access_gklass->container_class;
 
                if (can_access_member (access_container, member_generic_def, context_klass, access_level))
                        return TRUE;
@@ -10521,7 +10614,9 @@ gboolean mono_type_is_valid_enum_basetype (MonoType * type) {
  * FIXME: enum types are not allowed to have a cctor, but mono_reflection_create_runtime_class sets has_cctor to 1 for all types
  * FIXME: TypeBuilder enums can have any kind of static fields, but the spec is very explicit about that (P II 14.3)
  */
-gboolean mono_class_is_valid_enum (MonoClass *klass) {
+gboolean
+mono_class_is_valid_enum (MonoClass *klass)
+{
        MonoClassField * field;
        gpointer iter = NULL;
        gboolean found_base_field = FALSE;
@@ -10532,7 +10627,7 @@ gboolean mono_class_is_valid_enum (MonoClass *klass) {
                return FALSE;
        }
 
-       if ((klass->flags & TYPE_ATTRIBUTE_LAYOUT_MASK) != TYPE_ATTRIBUTE_AUTO_LAYOUT)
+       if (!mono_class_is_auto_layout (klass))
                return FALSE;
 
        while ((field = mono_class_get_fields (klass, &iter))) {
@@ -10548,7 +10643,7 @@ gboolean mono_class_is_valid_enum (MonoClass *klass) {
        if (!found_base_field)
                return FALSE;
 
-       if (klass->method.count > 0) 
+       if (mono_class_get_method_count (klass) > 0)
                return FALSE;
 
        return TRUE;
@@ -10557,7 +10652,7 @@ gboolean mono_class_is_valid_enum (MonoClass *klass) {
 gboolean
 mono_generic_class_is_generic_type_definition (MonoGenericClass *gklass)
 {
-       return gklass->context.class_inst == gklass->container_class->generic_container->context.class_inst;
+       return gklass->context.class_inst == mono_class_get_generic_container (gklass->container_class)->context.class_inst;
 }
 
 /*
@@ -10586,15 +10681,16 @@ mono_class_alloc_ext (MonoClass *klass)
 {
        MonoClassExt *ext;
 
-       if (klass->ext)
+       if (mono_class_get_ext (klass))
                return;
 
        ext = (MonoClassExt *)mono_class_alloc0 (klass, sizeof (MonoClassExt));
        mono_image_lock (klass->image);
        mono_memory_barrier ();
-       if (!klass->ext)
-               klass->ext = ext;
+       if (!mono_class_get_ext (klass))
+               mono_class_set_ext (klass, ext);
        class_ext_size += sizeof (MonoClassExt);
+       ++class_ext_count;
        mono_image_unlock (klass->image);
 }
 
@@ -10629,21 +10725,21 @@ mono_class_setup_interfaces (MonoClass *klass, MonoError *error)
                if (interface_count > 1)
                        interfaces [1] = mono_class_bind_generic_parameters (
                           mono_defaults.generic_ireadonlylist_class, 1, args, FALSE);
-       } else if (klass->generic_class) {
-               MonoClass *gklass = klass->generic_class->container_class;
+       } else if (mono_class_is_ginst (klass)) {
+               MonoClass *gklass = mono_class_get_generic_class (klass)->container_class;
 
                mono_class_setup_interfaces (gklass, error);
                if (!mono_error_ok (error)) {
-                       mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, g_strdup ("Could not setup the interfaces"));
+                       mono_class_set_type_load_failure (klass, "Could not setup the interfaces");
                        return;
                }
 
                interface_count = gklass->interface_count;
                interfaces = mono_class_new0 (klass, MonoClass *, interface_count);
                for (i = 0; i < interface_count; i++) {
-                       interfaces [i] = mono_class_inflate_generic_class_checked (gklass->interfaces [i], mono_generic_class_get_context (klass->generic_class), error);
+                       interfaces [i] = mono_class_inflate_generic_class_checked (gklass->interfaces [i], mono_generic_class_get_context (mono_class_get_generic_class (klass)), error);
                        if (!mono_error_ok (error)) {
-                               mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, g_strdup ("Could not setup the interfaces"));
+                               mono_class_set_type_load_failure (klass, "Could not setup the interfaces");
                                return;
                        }
                }
@@ -10671,7 +10767,8 @@ mono_field_resolve_type (MonoClassField *field, MonoError *error)
 {
        MonoClass *klass = field->parent;
        MonoImage *image = klass->image;
-       MonoClass *gtd = klass->generic_class ? mono_class_get_generic_type_definition (klass) : NULL;
+       MonoClass *gtd = mono_class_is_ginst (klass) ? mono_class_get_generic_type_definition (klass) : NULL;
+       MonoType *ftype;
        int field_idx = field - klass->fields;
 
        mono_error_init (error);
@@ -10680,37 +10777,41 @@ mono_field_resolve_type (MonoClassField *field, MonoError *error)
                MonoClassField *gfield = &gtd->fields [field_idx];
                MonoType *gtype = mono_field_get_type_checked (gfield, error);
                if (!mono_error_ok (error)) {
-                       char *err_msg = g_strdup_printf ("Could not load field %d type due to: %s", field_idx, mono_error_get_message (error));
-                       mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, err_msg);
+                       char *full_name = mono_type_get_full_name (gtd);
+                       mono_class_set_type_load_failure (klass, "Could not load generic type of field '%s:%s' (%d) due to: %s", full_name, gfield->name, field_idx, mono_error_get_message (error));
+                       g_free (full_name);
                }
 
-               field->type = mono_class_inflate_generic_type_no_copy (image, gtype, mono_class_get_context (klass), error);
+               ftype = mono_class_inflate_generic_type_no_copy (image, gtype, mono_class_get_context (klass), error);
                if (!mono_error_ok (error)) {
-                       char *err_msg = g_strdup_printf ("Could not load field %d type due to: %s", field_idx, mono_error_get_message (error));
-                       mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, err_msg);
+                       char *full_name = mono_type_get_full_name (klass);
+                       mono_class_set_type_load_failure (klass, "Could not load instantiated type of field '%s:%s' (%d) due to: %s", full_name, field->name, field_idx, mono_error_get_message (error));
+                       g_free (full_name);
                }
        } else {
                const char *sig;
                guint32 cols [MONO_FIELD_SIZE];
                MonoGenericContainer *container = NULL;
-               int idx = klass->field.first + field_idx;
+               int idx = mono_class_get_first_field_idx (klass) + field_idx;
 
                /*FIXME, in theory we do not lazy load SRE fields*/
                g_assert (!image_is_dynamic (image));
 
-               if (klass->generic_container) {
-                       container = klass->generic_container;
+               if (mono_class_is_gtd (klass)) {
+                       container = mono_class_get_generic_container (klass);
                } else if (gtd) {
-                       container = gtd->generic_container;
+                       container = mono_class_get_generic_container (gtd);
                        g_assert (container);
                }
 
-               /* klass->field.first and idx points into the fieldptr table */
+               /* first_field_idx and idx points into the fieldptr table */
                mono_metadata_decode_table_row (image, MONO_TABLE_FIELD, idx, cols, MONO_FIELD_SIZE);
 
                if (!mono_verifier_verify_field_signature (image, cols [MONO_FIELD_SIGNATURE], NULL)) {
-                       mono_error_set_type_load_class (error, klass, "Could not verify field %s signature", field->name);;
-                       mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, g_strdup (mono_error_get_message (error)));
+                       char *full_name = mono_type_get_full_name (klass);
+                       mono_error_set_type_load_class (error, klass, "Could not verify field '%s:%s' signature", full_name, field->name);;
+                       mono_class_set_type_load_failure (klass, "%s", mono_error_get_message (error));
+                       g_free (full_name);
                        return;
                }
 
@@ -10720,12 +10821,15 @@ mono_field_resolve_type (MonoClassField *field, MonoError *error)
                /* FIELD signature == 0x06 */
                g_assert (*sig == 0x06);
 
-               field->type = mono_metadata_parse_type_checked (image, container, cols [MONO_FIELD_FLAGS], FALSE, sig + 1, &sig, error);
-               if (!field->type) {
-                       char *err_msg = g_strdup_printf ("Could not load field %d type due to: %s", field_idx, mono_error_get_message (error));
-                       mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, err_msg);
+               ftype = mono_metadata_parse_type_checked (image, container, cols [MONO_FIELD_FLAGS], FALSE, sig + 1, &sig, error);
+               if (!ftype) {
+                       char *full_name = mono_type_get_full_name (klass);
+                       mono_class_set_type_load_failure (klass, "Could not load type of field '%s:%s' (%d) due to: %s", full_name, field->name, field_idx, mono_error_get_message (error));
+                       g_free (full_name);
                }
        }
+       mono_memory_barrier ();
+       field->type = ftype;
 }
 
 static guint32
@@ -10733,7 +10837,7 @@ mono_field_resolve_flags (MonoClassField *field)
 {
        MonoClass *klass = field->parent;
        MonoImage *image = klass->image;
-       MonoClass *gtd = klass->generic_class ? mono_class_get_generic_type_definition (klass) : NULL;
+       MonoClass *gtd = mono_class_is_ginst (klass) ? mono_class_get_generic_type_definition (klass) : NULL;
        int field_idx = field - klass->fields;
 
 
@@ -10741,7 +10845,7 @@ mono_field_resolve_flags (MonoClassField *field)
                MonoClassField *gfield = &gtd->fields [field_idx];
                return mono_field_get_flags (gfield);
        } else {
-               int idx = klass->field.first + field_idx;
+               int idx = mono_class_get_first_field_idx (klass) + field_idx;
 
                /*FIXME, in theory we do not lazy load SRE fields*/
                g_assert (!image_is_dynamic (image));
@@ -10750,21 +10854,6 @@ mono_field_resolve_flags (MonoClassField *field)
        }
 }
 
-/**
- * mono_class_setup_basic_field_info:
- * @class: The class to initialize
- *
- * Initializes the klass->fields array of fields.
- * Aquires the loader lock.
- */
-static void
-mono_class_setup_basic_field_info_locking (MonoClass *klass)
-{
-       mono_loader_lock ();
-       mono_class_setup_basic_field_info (klass);
-       mono_loader_unlock ();
-}
-
 /**
  * mono_class_get_fields_lazy:
  * @klass: the MonoClass to act on
@@ -10786,11 +10875,11 @@ mono_class_get_fields_lazy (MonoClass* klass, gpointer *iter)
        if (!iter)
                return NULL;
        if (!*iter) {
-               mono_class_setup_basic_field_info_locking (klass);
+               mono_class_setup_basic_field_info (klass);
                if (!klass->fields)
                        return NULL;
                /* start from the first */
-               if (klass->field.count) {
+               if (mono_class_get_field_count (klass)) {
                        *iter = &klass->fields [0];
                        return (MonoClassField *)*iter;
                } else {
@@ -10800,7 +10889,7 @@ mono_class_get_fields_lazy (MonoClass* klass, gpointer *iter)
        }
        field = (MonoClassField *)*iter;
        field++;
-       if (field < &klass->fields [klass->field.count]) {
+       if (field < &klass->fields [mono_class_get_field_count (klass)]) {
                *iter = field;
                return (MonoClassField *)*iter;
        }
index bedd740079bfdc160e07c76ae65b67134f7af777..cf61058a3a7525b92fa2ad8c0f355db5b1289bd0 100644 (file)
 #include <string.h>
 #include <errno.h>
 
+#if defined(HOST_WIN32)
+#include <oleauto.h>
+#endif
+
 /*
 Code shared between the DISABLE_COM and !DISABLE_COM
 */
@@ -356,7 +360,8 @@ cominterop_get_method_interface (MonoMethod* method)
                                gboolean found = FALSE;
                                ic = (MonoClass *)g_ptr_array_index (ifaces, i);
                                offset = mono_class_interface_offset (method->klass, ic);
-                               for (j = 0; j < ic->method.count; ++j) {
+                               int mcount = mono_class_get_method_count (ic);
+                               for (j = 0; j < mcount; ++j) {
                                        if (method->klass->vtable [j + offset] == method) {
                                                found = TRUE;
                                                break;
@@ -396,7 +401,8 @@ cominterop_get_com_slot_for_method (MonoMethod* method)
                ic = cominterop_get_method_interface (method);
                offset = mono_class_interface_offset (method->klass, ic);
                g_assert(offset >= 0);
-               for(i = 0; i < ic->method.count; ++i) {
+               int mcount = mono_class_get_method_count (ic);
+               for(i = 0; i < mcount; ++i) {
                        if (method->klass->vtable [i + offset] == method)
                        {
                                slot = ic->methods[i]->slot;
@@ -1502,7 +1508,7 @@ ves_icall_System_Runtime_InteropServices_Marshal_ReleaseInternal (gpointer pUnk)
 
 static gboolean cominterop_can_support_dispatch (MonoClass* klass)
 {
-       if (!(klass->flags & TYPE_ATTRIBUTE_PUBLIC) )
+       if (!mono_class_is_public (klass))
                return FALSE;
 
        if (!cominterop_com_visible (klass))
@@ -2018,7 +2024,7 @@ cominterop_get_ccw_checked (MonoObject* object, MonoClass* itf, MonoError *error
                start_slot = 7;
        }
        else {
-               method_count += iface->method.count;
+               method_count += mono_class_get_method_count (iface);
                start_slot = cominterop_get_com_slot_begin (iface);
                iface = NULL;
        }
@@ -2033,7 +2039,7 @@ cominterop_get_ccw_checked (MonoObject* object, MonoClass* itf, MonoError *error
                        memcpy (vtable+3, idispatch, sizeof (idispatch));
 
                iface = itf;
-               for (i = iface->method.count-1; i >= 0;i--) {
+               for (i = mono_class_get_method_count (iface) - 1; i >= 0; i--) {
                        int param_index = 0;
                        MonoMethodBuilder *mb;
                        MonoMarshalSpec ** mspecs;
diff --git a/mono/metadata/console-win32-internals.h b/mono/metadata/console-win32-internals.h
new file mode 100644 (file)
index 0000000..e0cd222
--- /dev/null
@@ -0,0 +1,18 @@
+/*
+ * Copyright 2016 Microsoft
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
+ */
+#ifndef __MONO_CONSOLE_WIN32_INTERNALS_H__
+#define __MONO_CONSOLE_WIN32_INTERNALS_H__
+
+#include <config.h>
+#include <glib.h>
+
+#include "mono/metadata/object.h"
+#include "mono/metadata/object-internals.h"
+#include "mono/utils/mono-error.h"
+#include "mono/utils/mono-error-internals.h"
+#include <mono/metadata/console-io.h>
+
+#endif /* __MONO_CONSOLE_WIN32_INTERNALS_H__ */
+
diff --git a/mono/metadata/console-win32-uwp.c b/mono/metadata/console-win32-uwp.c
new file mode 100644 (file)
index 0000000..938ef80
--- /dev/null
@@ -0,0 +1,98 @@
+/*
+ * console-win32-uwp.c: UWP console support for Mono.
+ *
+ * Copyright 2016 Microsoft
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
+*/
+#include <config.h>
+#include <glib.h>
+#include "mono/utils/mono-compiler.h"
+
+#if G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT)
+#include <windows.h>
+#include "mono/metadata/console-win32-internals.h"
+
+MonoBoolean
+ves_icall_System_ConsoleDriver_Isatty (HANDLE handle)
+{
+       MonoError mono_error;
+       mono_error_init (&mono_error);
+
+       g_unsupported_api ("Console");
+
+       mono_error_set_not_supported (&mono_error, G_UNSUPPORTED_API, "Console");
+       mono_error_set_pending_exception (&mono_error);
+
+       SetLastError (ERROR_NOT_SUPPORTED);
+
+       return FALSE;
+}
+
+MonoBoolean
+ves_icall_System_ConsoleDriver_SetEcho (MonoBoolean want_echo)
+{
+       MonoError mono_error;
+       mono_error_init (&mono_error);
+
+       g_unsupported_api ("Console");
+
+       mono_error_set_not_supported (&mono_error, G_UNSUPPORTED_API, "Console");
+       mono_error_set_pending_exception (&mono_error);
+
+       SetLastError (ERROR_NOT_SUPPORTED);
+
+       return FALSE;
+}
+
+MonoBoolean
+ves_icall_System_ConsoleDriver_SetBreak (MonoBoolean want_break)
+{
+       MonoError mono_error;
+       mono_error_init (&mono_error);
+
+       g_unsupported_api ("Console");
+
+       mono_error_set_not_supported (&mono_error, G_UNSUPPORTED_API, "Console");
+       mono_error_set_pending_exception (&mono_error);
+
+       SetLastError (ERROR_NOT_SUPPORTED);
+
+       return FALSE;
+}
+
+gint32
+ves_icall_System_ConsoleDriver_InternalKeyAvailable (gint32 timeout)
+{
+       MonoError mono_error;
+       mono_error_init (&mono_error);
+
+       g_unsupported_api ("Console");
+
+       mono_error_set_not_supported (&mono_error, G_UNSUPPORTED_API, "Console");
+       mono_error_set_pending_exception (&mono_error);
+
+       SetLastError (ERROR_NOT_SUPPORTED);
+
+       return FALSE;
+}
+
+MonoBoolean
+ves_icall_System_ConsoleDriver_TtySetup (MonoString *keypad, MonoString *teardown, MonoArray **control_chars, int **size)
+{
+       MonoError mono_error;
+       mono_error_init (&mono_error);
+
+       g_unsupported_api ("Console");
+
+       mono_error_set_not_supported (&mono_error, G_UNSUPPORTED_API, "Console");
+       mono_error_set_pending_exception (&mono_error);
+
+       SetLastError (ERROR_NOT_SUPPORTED);
+
+       return FALSE;
+}
+
+#else /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
+
+MONO_EMPTY_SOURCE_FILE (console_win32_uwp);
+#endif /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
index c7c8c49017b6182ee292e7d2d9fc373621384b22..06a0244477e1afd5e3a0ba40d4fddcd4c8e56ed1 100644 (file)
@@ -41,11 +41,11 @@ mono_console_handle_async_ops (void)
 {
 }
 
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
 MonoBoolean
 ves_icall_System_ConsoleDriver_Isatty (HANDLE handle)
 {
        DWORD mode;
-
        return GetConsoleMode (handle, &mode) != 0;
 }
 
@@ -72,3 +72,4 @@ ves_icall_System_ConsoleDriver_TtySetup (MonoString *keypad, MonoString *teardow
 {
        return FALSE;
 }
+#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */
diff --git a/mono/metadata/coree-internals.h b/mono/metadata/coree-internals.h
new file mode 100644 (file)
index 0000000..393ad77
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2016 Microsoft
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
+ */
+#ifndef __MONO_COREE_INTERNALS_H__
+#define __MONO_COREE_INTERNALS_H__
+
+#include <config.h>
+#include <glib.h>
+
+#ifdef HOST_WIN32
+#include <windows.h>
+
+BOOL STDMETHODCALLTYPE
+_CorDllMain (HINSTANCE hInst, DWORD dwReason, LPVOID lpReserved);
+
+__int32 STDMETHODCALLTYPE
+_CorExeMain (void);
+
+void STDMETHODCALLTYPE
+CorExitProcess (int exitCode);
+
+STDAPI
+_CorValidateImage (PVOID *ImageBase, LPCWSTR FileName);
+
+STDAPI_(VOID)
+_CorImageUnloading (PVOID ImageBase);
+
+STDAPI
+CorBindToRuntimeEx (LPCWSTR pwszVersion, LPCWSTR pwszBuildFlavor,
+                   DWORD startupFlags, REFCLSID rclsid, REFIID riid, LPVOID FAR *ppv);
+
+STDAPI
+CorBindToRuntime (LPCWSTR pwszVersion, LPCWSTR pwszBuildFlavor,
+                 REFCLSID rclsid, REFIID riid, LPVOID FAR *ppv);
+
+HMODULE WINAPI
+MonoLoadImage (LPCWSTR FileName);
+
+void mono_coree_set_act_ctx (const char *file_name);
+#endif /* HOST_WIN32 */
+
+#endif /* __MONO_COREE_INTERNALS_H__ */
+
diff --git a/mono/metadata/coree-windows-uwp.c b/mono/metadata/coree-windows-uwp.c
new file mode 100644 (file)
index 0000000..d756607
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * coree-windows-uwp.c: UWP coree support for Mono.
+ *
+ * Copyright 2016 Microsoft
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
+*/
+#include <config.h>
+#include <glib.h>
+#include "mono/utils/mono-compiler.h"
+
+#if G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT)
+#include <windows.h>
+#include "mono/metadata/coree-internals.h"
+
+BOOL STDMETHODCALLTYPE
+_CorDllMain(HINSTANCE hInst, DWORD dwReason, LPVOID lpReserved)
+{
+       g_unsupported_api ("_CorDllMain");
+       return FALSE;
+}
+
+__int32 STDMETHODCALLTYPE
+_CorExeMain(void)
+{
+       g_unsupported_api ("_CorExeMain");
+       ExitProcess (EXIT_FAILURE);
+}
+
+STDAPI
+_CorValidateImage(PVOID *ImageBase, LPCWSTR FileName)
+{
+       g_unsupported_api ("_CorValidateImage");
+       return E_UNEXPECTED;
+}
+
+HMODULE WINAPI
+MonoLoadImage(LPCWSTR FileName)
+{
+       g_unsupported_api ("MonoLoadImage");
+       return NULL;
+}
+
+void
+mono_coree_set_act_ctx (const char *file_name)
+{
+       g_unsupported_api ("CreateActCtx, ActivateActCtx");
+       SetLastError (ERROR_NOT_SUPPORTED);
+
+       return;
+}
+
+#else /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
+
+MONO_EMPTY_SOURCE_FILE (coree_windows_uwp);
+#endif /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
index 4436229376e10101b1d16f827601c72f466d2328..428fb9b989f80b6fea16ac5b54aad5cdf52cceb3 100644 (file)
@@ -12,8 +12,8 @@
 
 #ifdef HOST_WIN32
 
-#include <string.h>
 #include <glib.h>
+#include <string.h>
 #include <mono/io-layer/io-layer.h>
 #include <mono/utils/mono-path.h>
 #include "cil-coff.h"
 #include "threads.h"
 #include "environment.h"
 #include "coree.h"
+#include "coree-internals.h"
 
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
 #include <shellapi.h>
+#endif
 
 HMODULE coree_module_handle = NULL;
 
@@ -68,6 +71,7 @@ mono_get_module_file_name (HMODULE module_handle)
 }
 
 /* Entry point called by LdrLoadDll of ntdll.dll after _CorValidateImage. */
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
 BOOL STDMETHODCALLTYPE _CorDllMain(HINSTANCE hInst, DWORD dwReason, LPVOID lpReserved)
 {
        MonoAssembly* assembly;
@@ -134,8 +138,10 @@ BOOL STDMETHODCALLTYPE _CorDllMain(HINSTANCE hInst, DWORD dwReason, LPVOID lpRes
 
        return TRUE;
 }
+#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */
 
 /* Called by ntdll.dll reagardless of entry point after _CorValidateImage. */
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
 __int32 STDMETHODCALLTYPE _CorExeMain(void)
 {
        MonoError error;
@@ -207,6 +213,7 @@ __int32 STDMETHODCALLTYPE _CorExeMain(void)
        /* return does not terminate the process. */
        ExitProcess (mono_environment_exitcode_get ());
 }
+#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */
 
 /* Called by msvcrt.dll when shutting down. */
 void STDMETHODCALLTYPE CorExitProcess(int exitCode)
@@ -223,6 +230,7 @@ void STDMETHODCALLTYPE CorExitProcess(int exitCode)
 }
 
 /* Called by ntdll.dll before _CorDllMain and _CorExeMain. */
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
 STDAPI _CorValidateImage(PVOID *ImageBase, LPCWSTR FileName)
 {
        IMAGE_DOS_HEADER* DosHeader;
@@ -385,6 +393,7 @@ STDAPI _CorValidateImage(PVOID *ImageBase, LPCWSTR FileName)
 
        return STATUS_SUCCESS;
 }
+#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */
 
 /* Called by ntdll.dll. */
 STDAPI_(VOID) _CorImageUnloading(PVOID ImageBase)
@@ -406,6 +415,7 @@ STDAPI CorBindToRuntime(LPCWSTR pwszVersion, LPCWSTR pwszBuildFlavor, REFCLSID r
        return CorBindToRuntimeEx (pwszVersion, pwszBuildFlavor, 0, rclsid, riid, ppv);
 }
 
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
 HMODULE WINAPI MonoLoadImage(LPCWSTR FileName)
 {
        HANDLE FileHandle;
@@ -482,6 +492,7 @@ CloseFile:
        CloseHandle(FileHandle);
        return NULL;
 }
+#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */
 
 typedef struct _EXPORT_FIXUP
 {
@@ -499,14 +510,14 @@ typedef struct _EXPORT_FIXUP
 
 /* Has to be binary ordered. */
 static const EXPORT_FIXUP ExportFixups[] = {
-       {"CorBindToRuntime", &CorBindToRuntime},
-       {"CorBindToRuntimeEx", &CorBindToRuntimeEx},
-       {"CorExitProcess", &CorExitProcess},
-       {"_CorDllMain", &_CorDllMain},
-       {"_CorExeMain", &_CorExeMain},
-       {"_CorImageUnloading", &_CorImageUnloading},
-       {"_CorValidateImage", &_CorValidateImage},
-       {NULL, NULL}
+       {"CorBindToRuntime", {&CorBindToRuntime}},
+       {"CorBindToRuntimeEx", {&CorBindToRuntimeEx}},
+       {"CorExitProcess", {&CorExitProcess}},
+       {"_CorDllMain", {&_CorDllMain}},
+       {"_CorExeMain", {&_CorExeMain}},
+       {"_CorImageUnloading", {&_CorImageUnloading}},
+       {"_CorValidateImage", {&_CorValidateImage}},
+       {NULL, {NULL}}
 };
 
 #define EXPORT_FIXUP_COUNT (sizeof(ExportFixups) / sizeof(EXPORT_FIXUP) - 1)
@@ -795,7 +806,15 @@ STDAPI MonoFixupExe(HMODULE ModuleHandle)
                        ImportDesc = (IMAGE_IMPORT_DESCRIPTOR*)((DWORD_PTR)DosHeader + ImportDir->VirtualAddress);
                        while (ImportDesc->Name && ImportDesc->OriginalFirstThunk)
                        {
-                               ImportModuleHandle = LoadLibraryA((PCSTR)((DWORD_PTR)DosHeader + ImportDesc->Name));
+                               gchar *file_utf8 = (gchar *)((DWORD_PTR)DosHeader + ImportDesc->Name);
+
+                               gunichar2 *file_utf16 = g_utf8_to_utf16 (file_utf8, (glong)strlen (file_utf8), NULL, NULL, NULL);
+                               ImportModuleHandle = NULL;
+                               if (file_utf16 != NULL) {
+                                       ImportModuleHandle = LoadLibraryW(file_utf16);
+                                       g_free (file_utf16);
+                               }
+
                                if (ImportModuleHandle == NULL)
                                        return E_FAIL;
 
@@ -828,8 +847,9 @@ STDAPI MonoFixupExe(HMODULE ModuleHandle)
        return S_OK;
 }
 
-static void
-mono_set_act_ctx (const char* file_name)
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
+void
+mono_coree_set_act_ctx (const char* file_name)
 {
        typedef HANDLE (WINAPI* CREATEACTCTXW_PROC) (PCACTCTXW pActCtx);
        typedef BOOL (WINAPI* ACTIVATEACTCTX_PROC) (HANDLE hActCtx, ULONG_PTR* lpCookie);
@@ -888,6 +908,7 @@ mono_set_act_ctx (const char* file_name)
        if (handle != INVALID_HANDLE_VALUE)
                ActivateActCtx_proc (handle, &cookie);
 }
+#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */
 
 void
 mono_load_coree (const char* exe_file_name)
@@ -901,7 +922,7 @@ mono_load_coree (const char* exe_file_name)
                return;
 
        if (!init_from_coree && exe_file_name)
-               mono_set_act_ctx (exe_file_name);
+               mono_coree_set_act_ctx (exe_file_name);
 
        /* ntdll.dll loads mscoree.dll from the system32 directory. */
        required_size = GetSystemDirectory (NULL, 0);
diff --git a/mono/metadata/custom-attrs-internals.h b/mono/metadata/custom-attrs-internals.h
new file mode 100644 (file)
index 0000000..76bd1c2
--- /dev/null
@@ -0,0 +1,15 @@
+#ifndef __MONO_METADATA_CUSTOM_ATTRS_INTERNALS_H__
+#define __MONO_METADATA_CUSTOM_ATTRS_INTERNALS_H__
+
+#include <mono/metadata/object.h>
+#include <mono/metadata/reflection.h>
+
+MonoCustomAttrInfo*
+mono_custom_attrs_from_builders (MonoImage *alloc_img, MonoImage *image, MonoArray *cattrs);
+
+typedef gboolean (*MonoAssemblyMetadataCustomAttrIterFunc) (MonoImage *image, guint32 typeref_scope_token, const gchar* nspace, const gchar* name, guint32 method_token, gpointer user_data);
+
+void
+mono_assembly_metadata_foreach_custom_attr (MonoAssembly *assembly, MonoAssemblyMetadataCustomAttrIterFunc func, gpointer user_data);
+
+#endif  /* __MONO_METADATA_REFLECTION_CUSTOM_ATTRS_INTERNALS_H__ */
diff --git a/mono/metadata/custom-attrs.c b/mono/metadata/custom-attrs.c
new file mode 100644 (file)
index 0000000..8e56148
--- /dev/null
@@ -0,0 +1,1887 @@
+/*
+ * custom-attrs.c: Custom attributes.
+ * 
+ * Author:
+ *   Paolo Molaro (lupus@ximian.com)
+ *
+ * Copyright 2001-2003 Ximian, Inc (http://www.ximian.com)
+ * Copyright 2004-2009 Novell, Inc (http://www.novell.com)
+ * Copyright 2011 Rodrigo Kumpera
+ * Copyright 2016 Microsoft
+ *
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
+ */
+#include <config.h>
+#include "mono/metadata/assembly.h"
+#include "mono/metadata/gc-internals.h"
+#include "mono/metadata/mono-endian.h"
+#include "mono/metadata/object-internals.h"
+#include "mono/metadata/reflection-cache.h"
+#include "mono/metadata/custom-attrs-internals.h"
+#include "mono/metadata/sre-internals.h"
+#include "mono/metadata/reflection-internals.h"
+#include "mono/metadata/tabledefs.h"
+#include "mono/metadata/tokentype.h"
+#include "mono/metadata/verify-internals.h"
+#include "mono/utils/checked-build.h"
+
+
+#define CHECK_ADD4_OVERFLOW_UN(a, b) ((guint32)(0xFFFFFFFFU) - (guint32)(b) < (guint32)(a))
+#define CHECK_ADD8_OVERFLOW_UN(a, b) ((guint64)(0xFFFFFFFFFFFFFFFFUL) - (guint64)(b) < (guint64)(a))
+
+#if SIZEOF_VOID_P == 4
+#define CHECK_ADDP_OVERFLOW_UN(a,b) CHECK_ADD4_OVERFLOW_UN(a, b)
+#else
+#define CHECK_ADDP_OVERFLOW_UN(a,b) CHECK_ADD8_OVERFLOW_UN(a, b)
+#endif
+
+#define ADDP_IS_GREATER_OR_OVF(a, b, c) (((a) + (b) > (c)) || CHECK_ADDP_OVERFLOW_UN (a, b))
+#define ADD_IS_GREATER_OR_OVF(a, b, c) (((a) + (b) > (c)) || CHECK_ADD4_OVERFLOW_UN (a, b))
+
+static gboolean type_is_reference (MonoType *type);
+
+static GENERATE_GET_CLASS_WITH_CACHE (custom_attribute_typed_argument, System.Reflection, CustomAttributeTypedArgument);
+static GENERATE_GET_CLASS_WITH_CACHE (custom_attribute_named_argument, System.Reflection, CustomAttributeNamedArgument);
+
+/*
+ * LOCKING: Acquires the loader lock. 
+ */
+static MonoCustomAttrInfo*
+lookup_custom_attr (MonoImage *image, gpointer member)
+{
+       MONO_REQ_GC_NEUTRAL_MODE;
+
+       MonoCustomAttrInfo* res;
+
+       res = (MonoCustomAttrInfo *)mono_image_property_lookup (image, member, MONO_PROP_DYNAMIC_CATTR);
+
+       if (!res)
+               return NULL;
+
+       res = (MonoCustomAttrInfo *)g_memdup (res, MONO_SIZEOF_CUSTOM_ATTR_INFO + sizeof (MonoCustomAttrEntry) * res->num_attrs);
+       res->cached = 0;
+       return res;
+}
+
+static gboolean
+custom_attr_visible (MonoImage *image, MonoReflectionCustomAttr *cattr)
+{
+       MONO_REQ_GC_UNSAFE_MODE;
+
+       /* FIXME: Need to do more checks */
+       if (cattr->ctor->method && (cattr->ctor->method->klass->image != image)) {
+               int visibility = mono_class_get_flags (cattr->ctor->method->klass) & TYPE_ATTRIBUTE_VISIBILITY_MASK;
+
+               if ((visibility != TYPE_ATTRIBUTE_PUBLIC) && (visibility != TYPE_ATTRIBUTE_NESTED_PUBLIC))
+                       return FALSE;
+       }
+
+       return TRUE;
+}
+
+static gboolean
+type_is_reference (MonoType *type)
+{
+       switch (type->type) {
+       case MONO_TYPE_BOOLEAN:
+       case MONO_TYPE_CHAR:
+       case MONO_TYPE_U:
+       case MONO_TYPE_I:
+       case MONO_TYPE_U1:
+       case MONO_TYPE_I1:
+       case MONO_TYPE_U2:
+       case MONO_TYPE_I2:
+       case MONO_TYPE_U4:
+       case MONO_TYPE_I4:
+       case MONO_TYPE_U8:
+       case MONO_TYPE_I8:
+       case MONO_TYPE_R8:
+       case MONO_TYPE_R4:
+       case MONO_TYPE_VALUETYPE:
+               return FALSE;
+       default:
+               return TRUE;
+       }
+}
+
+static void
+free_param_data (MonoMethodSignature *sig, void **params) {
+       int i;
+       for (i = 0; i < sig->param_count; ++i) {
+               if (!type_is_reference (sig->params [i]))
+                       g_free (params [i]);
+       }
+}
+
+/*
+ * Find the field index in the metadata FieldDef table.
+ */
+static guint32
+find_field_index (MonoClass *klass, MonoClassField *field) {
+       int i;
+
+       int fcount = mono_class_get_field_count (klass);
+       for (i = 0; i < fcount; ++i) {
+               if (field == &klass->fields [i])
+                       return mono_class_get_first_field_idx (klass) + 1 + i;
+       }
+       return 0;
+}
+
+/*
+ * Find the property index in the metadata Property table.
+ */
+static guint32
+find_property_index (MonoClass *klass, MonoProperty *property) {
+       int i;
+       MonoClassExt *ext = mono_class_get_ext (klass);
+
+       for (i = 0; i < ext->property.count; ++i) {
+               if (property == &ext->properties [i])
+                       return ext->property.first + 1 + i;
+       }
+       return 0;
+}
+
+/*
+ * Find the event index in the metadata Event table.
+ */
+static guint32
+find_event_index (MonoClass *klass, MonoEvent *event) {
+       int i;
+       MonoClassExt *ext = mono_class_get_ext (klass);
+
+       for (i = 0; i < ext->event.count; ++i) {
+               if (event == &ext->events [i])
+                       return ext->event.first + 1 + i;
+       }
+       return 0;
+}
+
+/*
+ * Load the type with name @n on behalf of image @image.  On failure sets @error and returns NULL.
+ * The @is_enum flag only affects the error message that's displayed on failure.
+ */
+static MonoType*
+cattr_type_from_name (char *n, MonoImage *image, gboolean is_enum, MonoError *error)
+{
+       MonoError inner_error;
+       MonoType *t = mono_reflection_type_from_name_checked (n, image, &inner_error);
+       if (!t) {
+               mono_error_set_type_load_name (error, g_strdup(n), NULL,
+                                              "Could not load %s %s while decoding custom attribute: %s",
+                                              is_enum ? "enum type": "type",
+                                              n,
+                                              mono_error_get_message (&inner_error));
+               mono_error_cleanup (&inner_error);
+               return NULL;
+       }
+       return t;
+}
+
+static MonoClass*
+load_cattr_enum_type (MonoImage *image, const char *p, const char **end, MonoError *error)
+{
+       char *n;
+       MonoType *t;
+       int slen = mono_metadata_decode_value (p, &p);
+
+       mono_error_init (error);
+
+       n = (char *)g_memdup (p, slen + 1);
+       n [slen] = 0;
+       t = cattr_type_from_name (n, image, TRUE, error);
+       g_free (n);
+       return_val_if_nok (error, NULL);
+       p += slen;
+       *end = p;
+       return mono_class_from_mono_type (t);
+}
+
+static void*
+load_cattr_value (MonoImage *image, MonoType *t, const char *p, const char **end, MonoError *error)
+{
+       int slen, type = t->type;
+       MonoClass *tklass = t->data.klass;
+
+       mono_error_init (error);
+
+handle_enum:
+       switch (type) {
+       case MONO_TYPE_U1:
+       case MONO_TYPE_I1:
+       case MONO_TYPE_BOOLEAN: {
+               MonoBoolean *bval = (MonoBoolean *)g_malloc (sizeof (MonoBoolean));
+               *bval = *p;
+               *end = p + 1;
+               return bval;
+       }
+       case MONO_TYPE_CHAR:
+       case MONO_TYPE_U2:
+       case MONO_TYPE_I2: {
+               guint16 *val = (guint16 *)g_malloc (sizeof (guint16));
+               *val = read16 (p);
+               *end = p + 2;
+               return val;
+       }
+#if SIZEOF_VOID_P == 4
+       case MONO_TYPE_U:
+       case MONO_TYPE_I:
+#endif
+       case MONO_TYPE_R4:
+       case MONO_TYPE_U4:
+       case MONO_TYPE_I4: {
+               guint32 *val = (guint32 *)g_malloc (sizeof (guint32));
+               *val = read32 (p);
+               *end = p + 4;
+               return val;
+       }
+#if SIZEOF_VOID_P == 8
+       case MONO_TYPE_U: /* error out instead? this should probably not happen */
+       case MONO_TYPE_I:
+#endif
+       case MONO_TYPE_U8:
+       case MONO_TYPE_I8: {
+               guint64 *val = (guint64 *)g_malloc (sizeof (guint64));
+               *val = read64 (p);
+               *end = p + 8;
+               return val;
+       }
+       case MONO_TYPE_R8: {
+               double *val = (double *)g_malloc (sizeof (double));
+               readr8 (p, val);
+               *end = p + 8;
+               return val;
+       }
+       case MONO_TYPE_VALUETYPE:
+               if (t->data.klass->enumtype) {
+                       type = mono_class_enum_basetype (t->data.klass)->type;
+                       goto handle_enum;
+               } else {
+                       MonoClass *k =  t->data.klass;
+                       
+                       if (mono_is_corlib_image (k->image) && strcmp (k->name_space, "System") == 0 && strcmp (k->name, "DateTime") == 0){
+                               guint64 *val = (guint64 *)g_malloc (sizeof (guint64));
+                               *val = read64 (p);
+                               *end = p + 8;
+                               return val;
+                       }
+               }
+               g_error ("generic valutype %s not handled in custom attr value decoding", t->data.klass->name);
+               break;
+               
+       case MONO_TYPE_STRING:
+               if (*p == (char)0xFF) {
+                       *end = p + 1;
+                       return NULL;
+               }
+               slen = mono_metadata_decode_value (p, &p);
+               *end = p + slen;
+               return mono_string_new_len_checked (mono_domain_get (), p, slen, error);
+       case MONO_TYPE_CLASS: {
+               MonoReflectionType *rt;
+               char *n;
+               MonoType *t;
+               if (*p == (char)0xFF) {
+                       *end = p + 1;
+                       return NULL;
+               }
+handle_type:
+               slen = mono_metadata_decode_value (p, &p);
+               n = (char *)g_memdup (p, slen + 1);
+               n [slen] = 0;
+               t = cattr_type_from_name (n, image, FALSE, error);
+               g_free (n);
+               return_val_if_nok (error, NULL);
+               *end = p + slen;
+
+               rt = mono_type_get_object_checked (mono_domain_get (), t, error);
+               if (!mono_error_ok (error))
+                       return NULL;
+
+               return rt;
+       }
+       case MONO_TYPE_OBJECT: {
+               char subt = *p++;
+               MonoObject *obj;
+               MonoClass *subc = NULL;
+               void *val;
+
+               if (subt == 0x50) {
+                       goto handle_type;
+               } else if (subt == 0x0E) {
+                       type = MONO_TYPE_STRING;
+                       goto handle_enum;
+               } else if (subt == 0x1D) {
+                       MonoType simple_type = {{0}};
+                       int etype = *p;
+                       p ++;
+
+                       type = MONO_TYPE_SZARRAY;
+                       if (etype == 0x50) {
+                               tklass = mono_defaults.systemtype_class;
+                       } else if (etype == 0x55) {
+                               tklass = load_cattr_enum_type (image, p, &p, error);
+                               if (!mono_error_ok (error))
+                                       return NULL;
+                       } else {
+                               if (etype == 0x51)
+                                       /* See Partition II, Appendix B3 */
+                                       etype = MONO_TYPE_OBJECT;
+                               simple_type.type = (MonoTypeEnum)etype;
+                               tklass = mono_class_from_mono_type (&simple_type);
+                       }
+                       goto handle_enum;
+               } else if (subt == 0x55) {
+                       char *n;
+                       MonoType *t;
+                       slen = mono_metadata_decode_value (p, &p);
+                       n = (char *)g_memdup (p, slen + 1);
+                       n [slen] = 0;
+                       t = cattr_type_from_name (n, image, FALSE, error);
+                       g_free (n);
+                       return_val_if_nok (error, NULL);
+                       p += slen;
+                       subc = mono_class_from_mono_type (t);
+               } else if (subt >= MONO_TYPE_BOOLEAN && subt <= MONO_TYPE_R8) {
+                       MonoType simple_type = {{0}};
+                       simple_type.type = (MonoTypeEnum)subt;
+                       subc = mono_class_from_mono_type (&simple_type);
+               } else {
+                       g_error ("Unknown type 0x%02x for object type encoding in custom attr", subt);
+               }
+               val = load_cattr_value (image, &subc->byval_arg, p, end, error);
+               obj = NULL;
+               if (mono_error_ok (error)) {
+                       obj = mono_object_new_checked (mono_domain_get (), subc, error);
+                       g_assert (!subc->has_references);
+                       if (mono_error_ok (error))
+                               mono_gc_memmove_atomic ((char*)obj + sizeof (MonoObject), val, mono_class_value_size (subc, NULL));
+               }
+
+               g_free (val);
+               return obj;
+       }
+       case MONO_TYPE_SZARRAY: {
+               MonoArray *arr;
+               guint32 i, alen, basetype;
+               alen = read32 (p);
+               p += 4;
+               if (alen == 0xffffffff) {
+                       *end = p;
+                       return NULL;
+               }
+               arr = mono_array_new_checked (mono_domain_get(), tklass, alen, error);
+               return_val_if_nok (error, NULL);
+               basetype = tklass->byval_arg.type;
+               if (basetype == MONO_TYPE_VALUETYPE && tklass->enumtype)
+                       basetype = mono_class_enum_basetype (tklass)->type;
+               switch (basetype)
+               {
+                       case MONO_TYPE_U1:
+                       case MONO_TYPE_I1:
+                       case MONO_TYPE_BOOLEAN:
+                               for (i = 0; i < alen; i++) {
+                                       MonoBoolean val = *p++;
+                                       mono_array_set (arr, MonoBoolean, i, val);
+                               }
+                               break;
+                       case MONO_TYPE_CHAR:
+                       case MONO_TYPE_U2:
+                       case MONO_TYPE_I2:
+                               for (i = 0; i < alen; i++) {
+                                       guint16 val = read16 (p);
+                                       mono_array_set (arr, guint16, i, val);
+                                       p += 2;
+                               }
+                               break;
+                       case MONO_TYPE_R4:
+                       case MONO_TYPE_U4:
+                       case MONO_TYPE_I4:
+                               for (i = 0; i < alen; i++) {
+                                       guint32 val = read32 (p);
+                                       mono_array_set (arr, guint32, i, val);
+                                       p += 4;
+                               }
+                               break;
+                       case MONO_TYPE_R8:
+                               for (i = 0; i < alen; i++) {
+                                       double val;
+                                       readr8 (p, &val);
+                                       mono_array_set (arr, double, i, val);
+                                       p += 8;
+                               }
+                               break;
+                       case MONO_TYPE_U8:
+                       case MONO_TYPE_I8:
+                               for (i = 0; i < alen; i++) {
+                                       guint64 val = read64 (p);
+                                       mono_array_set (arr, guint64, i, val);
+                                       p += 8;
+                               }
+                               break;
+                       case MONO_TYPE_CLASS:
+                       case MONO_TYPE_OBJECT:
+                       case MONO_TYPE_STRING:
+                       case MONO_TYPE_SZARRAY:
+                               for (i = 0; i < alen; i++) {
+                                       MonoObject *item = (MonoObject *)load_cattr_value (image, &tklass->byval_arg, p, &p, error);
+                                       if (!mono_error_ok (error))
+                                               return NULL;
+                                       mono_array_setref (arr, i, item);
+                               }
+                               break;
+                       default:
+                               g_error ("Type 0x%02x not handled in custom attr array decoding", basetype);
+               }
+               *end=p;
+               return arr;
+       }
+       default:
+               g_error ("Type 0x%02x not handled in custom attr value decoding", type);
+       }
+       return NULL;
+}
+
+static MonoObject*
+load_cattr_value_boxed (MonoDomain *domain, MonoImage *image, MonoType *t, const char* p, const char** end, MonoError *error)
+{
+       mono_error_init (error);
+
+       gboolean is_ref = type_is_reference (t);
+
+       void *val = load_cattr_value (image, t, p, end, error);
+       if (!is_ok (error)) {
+               if (is_ref)
+                       g_free (val);
+               return NULL;
+       }
+
+       if (is_ref)
+               return (MonoObject*)val;
+
+       MonoObject *boxed = mono_value_box_checked (domain, mono_class_from_mono_type (t), val, error);
+       g_free (val);
+       return boxed;
+}
+
+static MonoObject*
+create_cattr_typed_arg (MonoType *t, MonoObject *val, MonoError *error)
+{
+       static MonoMethod *ctor;
+       MonoObject *retval;
+       void *params [2], *unboxed;
+
+       mono_error_init (error);
+
+       if (!ctor)
+               ctor = mono_class_get_method_from_name (mono_class_get_custom_attribute_typed_argument_class (), ".ctor", 2);
+       
+       params [0] = mono_type_get_object_checked (mono_domain_get (), t, error);
+       return_val_if_nok (error, NULL);
+
+       params [1] = val;
+       retval = mono_object_new_checked (mono_domain_get (), mono_class_get_custom_attribute_typed_argument_class (), error);
+       return_val_if_nok (error, NULL);
+       unboxed = mono_object_unbox (retval);
+
+       mono_runtime_invoke_checked (ctor, unboxed, params, error);
+       return_val_if_nok (error, NULL);
+
+       return retval;
+}
+
+static MonoObject*
+create_cattr_named_arg (void *minfo, MonoObject *typedarg, MonoError *error)
+{
+       static MonoMethod *ctor;
+       MonoObject *retval;
+       void *unboxed, *params [2];
+
+       mono_error_init (error);
+
+       if (!ctor)
+               ctor = mono_class_get_method_from_name (mono_class_get_custom_attribute_named_argument_class (), ".ctor", 2);
+
+       params [0] = minfo;
+       params [1] = typedarg;
+       retval = mono_object_new_checked (mono_domain_get (), mono_class_get_custom_attribute_named_argument_class (), error);
+       return_val_if_nok (error, NULL);
+
+       unboxed = mono_object_unbox (retval);
+
+       mono_runtime_invoke_checked (ctor, unboxed, params, error);
+       return_val_if_nok (error, NULL);
+
+       return retval;
+}
+
+
+MonoCustomAttrInfo*
+mono_custom_attrs_from_builders (MonoImage *alloc_img, MonoImage *image, MonoArray *cattrs)
+{
+       MONO_REQ_GC_UNSAFE_MODE;
+
+       int i, index, count, not_visible;
+       MonoCustomAttrInfo *ainfo;
+       MonoReflectionCustomAttr *cattr;
+
+       if (!cattrs)
+               return NULL;
+       /* FIXME: check in assembly the Run flag is set */
+
+       count = mono_array_length (cattrs);
+
+       /* Skip nonpublic attributes since MS.NET seems to do the same */
+       /* FIXME: This needs to be done more globally */
+       not_visible = 0;
+       for (i = 0; i < count; ++i) {
+               cattr = (MonoReflectionCustomAttr*)mono_array_get (cattrs, gpointer, i);
+               if (!custom_attr_visible (image, cattr))
+                       not_visible ++;
+       }
+
+       int num_attrs = count - not_visible;
+       ainfo = (MonoCustomAttrInfo *)mono_image_g_malloc0 (alloc_img, MONO_SIZEOF_CUSTOM_ATTR_INFO + sizeof (MonoCustomAttrEntry) * num_attrs);
+
+       ainfo->image = image;
+       ainfo->num_attrs = num_attrs;
+       ainfo->cached = alloc_img != NULL;
+       index = 0;
+       for (i = 0; i < count; ++i) {
+               cattr = (MonoReflectionCustomAttr*)mono_array_get (cattrs, gpointer, i);
+               if (custom_attr_visible (image, cattr)) {
+                       unsigned char *saved = (unsigned char *)mono_image_alloc (image, mono_array_length (cattr->data));
+                       memcpy (saved, mono_array_addr (cattr->data, char, 0), mono_array_length (cattr->data));
+                       ainfo->attrs [index].ctor = cattr->ctor->method;
+                       g_assert (cattr->ctor->method);
+                       ainfo->attrs [index].data = saved;
+                       ainfo->attrs [index].data_size = mono_array_length (cattr->data);
+                       index ++;
+               }
+       }
+       g_assert (index == num_attrs && count == num_attrs + not_visible);
+
+       return ainfo;
+}
+
+
+static MonoObject*
+create_custom_attr (MonoImage *image, MonoMethod *method, const guchar *data, guint32 len, MonoError *error)
+{
+       const char *p = (const char*)data;
+       const char *named;
+       guint32 i, j, num_named;
+       MonoObject *attr;
+       void *params_buf [32];
+       void **params = NULL;
+       MonoMethodSignature *sig;
+
+       mono_error_init (error);
+
+       mono_class_init (method->klass);
+
+       if (!mono_verifier_verify_cattr_content (image, method, data, len, NULL)) {
+               mono_error_set_generic_error (error, "System.Reflection", "CustomAttributeFormatException", "Binary format of the specified custom attribute was invalid.");
+               return NULL;
+       }
+
+       if (len == 0) {
+               attr = mono_object_new_checked (mono_domain_get (), method->klass, error);
+               if (!mono_error_ok (error)) return NULL;
+
+               mono_runtime_invoke_checked (method, attr, NULL, error);
+               if (!mono_error_ok (error))
+                       return NULL;
+
+               return attr;
+       }
+
+       if (len < 2 || read16 (p) != 0x0001) /* Prolog */
+               return NULL;
+
+       /*g_print ("got attr %s\n", method->klass->name);*/
+
+       sig = mono_method_signature (method);
+       if (sig->param_count < 32) {
+               params = params_buf;
+               memset (params, 0, sizeof (void*) * sig->param_count);
+       } else {
+               /* Allocate using GC so it gets GC tracking */
+               params = (void **)mono_gc_alloc_fixed (sig->param_count * sizeof (void*), MONO_GC_DESCRIPTOR_NULL, MONO_ROOT_SOURCE_REFLECTION, "custom attribute parameters");
+       }
+
+       /* skip prolog */
+       p += 2;
+       for (i = 0; i < mono_method_signature (method)->param_count; ++i) {
+               params [i] = load_cattr_value (image, mono_method_signature (method)->params [i], p, &p, error);
+               if (!mono_error_ok (error))
+                       goto fail;
+       }
+
+       named = p;
+       attr = mono_object_new_checked (mono_domain_get (), method->klass, error);
+       if (!mono_error_ok (error)) goto fail;
+
+       MonoObject *exc = NULL;
+       mono_runtime_try_invoke (method, attr, params, &exc, error);
+       if (!mono_error_ok (error))
+               goto fail;
+       if (exc) {
+               mono_error_set_exception_instance (error, (MonoException*)exc);
+               goto fail;
+       }
+
+       num_named = read16 (named);
+       named += 2;
+       for (j = 0; j < num_named; j++) {
+               gint name_len;
+               char *name, named_type, data_type;
+               named_type = *named++;
+               data_type = *named++; /* type of data */
+               if (data_type == MONO_TYPE_SZARRAY)
+                       data_type = *named++;
+               if (data_type == MONO_TYPE_ENUM) {
+                       gint type_len;
+                       char *type_name;
+                       type_len = mono_metadata_decode_blob_size (named, &named);
+                       type_name = (char *)g_malloc (type_len + 1);
+                       memcpy (type_name, named, type_len);
+                       type_name [type_len] = 0;
+                       named += type_len;
+                       /* FIXME: lookup the type and check type consistency */
+                       g_free (type_name);
+               }
+               name_len = mono_metadata_decode_blob_size (named, &named);
+               name = (char *)g_malloc (name_len + 1);
+               memcpy (name, named, name_len);
+               name [name_len] = 0;
+               named += name_len;
+               if (named_type == 0x53) {
+                       MonoClassField *field;
+                       void *val;
+
+                       /* how this fail is a blackbox */
+                       field = mono_class_get_field_from_name (mono_object_class (attr), name);
+                       if (!field) {
+                               mono_error_set_generic_error (error, "System.Reflection", "CustomAttributeFormatException", "Could not find a field with name %s", name);
+                               g_free (name);
+                               goto fail;
+                       }
+
+                       val = load_cattr_value (image, field->type, named, &named, error);
+                       if (!mono_error_ok (error)) {
+                               g_free (name);
+                               if (!type_is_reference (field->type))
+                                       g_free (val);
+                               goto fail;
+                       }
+
+                       mono_field_set_value (attr, field, val);
+                       if (!type_is_reference (field->type))
+                               g_free (val);
+               } else if (named_type == 0x54) {
+                       MonoProperty *prop;
+                       void *pparams [1];
+                       MonoType *prop_type;
+
+                       prop = mono_class_get_property_from_name (mono_object_class (attr), name);
+
+                       if (!prop) {
+                               mono_error_set_generic_error (error, "System.Reflection", "CustomAttributeFormatException", "Could not find a property with name %s", name);
+                               g_free (name);
+                               goto fail;
+                       }
+
+                       if (!prop->set) {
+                               mono_error_set_generic_error (error, "System.Reflection", "CustomAttributeFormatException", "Could not find the setter for %s", name);
+                               g_free (name);
+                               goto fail;
+                       }
+
+                       /* can we have more that 1 arg in a custom attr named property? */
+                       prop_type = prop->get? mono_method_signature (prop->get)->ret :
+                            mono_method_signature (prop->set)->params [mono_method_signature (prop->set)->param_count - 1];
+
+                       pparams [0] = load_cattr_value (image, prop_type, named, &named, error);
+                       if (!mono_error_ok (error)) {
+                               g_free (name);
+                               if (!type_is_reference (prop_type))
+                                       g_free (pparams [0]);
+                               goto fail;
+                       }
+
+
+                       mono_property_set_value_checked (prop, attr, pparams, error);
+                       if (!type_is_reference (prop_type))
+                               g_free (pparams [0]);
+                       if (!is_ok (error)) {
+                               g_free (name);
+                               goto fail;
+                       }
+               }
+               g_free (name);
+       }
+
+       free_param_data (method->signature, params);
+       if (params != params_buf)
+               mono_gc_free_fixed (params);
+
+       return attr;
+
+fail:
+       free_param_data (method->signature, params);
+       if (params != params_buf)
+               mono_gc_free_fixed (params);
+       return NULL;
+}
+       
+/*
+ * mono_reflection_create_custom_attr_data_args:
+ *
+ *   Create an array of typed and named arguments from the cattr blob given by DATA.
+ * TYPED_ARGS and NAMED_ARGS will contain the objects representing the arguments,
+ * NAMED_ARG_INFO will contain information about the named arguments.
+ */
+void
+mono_reflection_create_custom_attr_data_args (MonoImage *image, MonoMethod *method, const guchar *data, guint32 len, MonoArray **typed_args, MonoArray **named_args, CattrNamedArg **named_arg_info, MonoError *error)
+{
+       MonoArray *typedargs, *namedargs;
+       MonoClass *attrklass;
+       MonoDomain *domain;
+       const char *p = (const char*)data;
+       const char *named;
+       guint32 i, j, num_named;
+       CattrNamedArg *arginfo = NULL;
+
+       *typed_args = NULL;
+       *named_args = NULL;
+       *named_arg_info = NULL;
+
+       mono_error_init (error);
+
+       if (!mono_verifier_verify_cattr_content (image, method, data, len, NULL)) {
+               mono_error_set_generic_error (error, "System.Reflection", "CustomAttributeFormatException", "Binary format of the specified custom attribute was invalid.");
+               return;
+       }
+
+       mono_class_init (method->klass);
+       
+       domain = mono_domain_get ();
+
+       if (len < 2 || read16 (p) != 0x0001) /* Prolog */
+               return;
+
+       typedargs = mono_array_new_checked (domain, mono_get_object_class (), mono_method_signature (method)->param_count, error);
+       return_if_nok (error);
+
+       /* skip prolog */
+       p += 2;
+       for (i = 0; i < mono_method_signature (method)->param_count; ++i) {
+               MonoObject *obj;
+
+               obj = load_cattr_value_boxed (domain, image, mono_method_signature (method)->params [i], p, &p, error);
+               return_if_nok (error);
+               mono_array_setref (typedargs, i, obj);
+       }
+
+       named = p;
+       num_named = read16 (named);
+       namedargs = mono_array_new_checked (domain, mono_get_object_class (), num_named, error);
+       return_if_nok (error);
+       named += 2;
+       attrklass = method->klass;
+
+       arginfo = g_new0 (CattrNamedArg, num_named);
+       *named_arg_info = arginfo;
+
+       for (j = 0; j < num_named; j++) {
+               gint name_len;
+               char *name, named_type, data_type;
+               named_type = *named++;
+               data_type = *named++; /* type of data */
+               if (data_type == MONO_TYPE_SZARRAY)
+                       data_type = *named++;
+               if (data_type == MONO_TYPE_ENUM) {
+                       gint type_len;
+                       char *type_name;
+                       type_len = mono_metadata_decode_blob_size (named, &named);
+                       if (ADDP_IS_GREATER_OR_OVF ((const guchar*)named, type_len, data + len))
+                               goto fail;
+
+                       type_name = (char *)g_malloc (type_len + 1);
+                       memcpy (type_name, named, type_len);
+                       type_name [type_len] = 0;
+                       named += type_len;
+                       /* FIXME: lookup the type and check type consistency */
+                       g_free (type_name);
+               }
+               name_len = mono_metadata_decode_blob_size (named, &named);
+               if (ADDP_IS_GREATER_OR_OVF ((const guchar*)named, name_len, data + len))
+                       goto fail;
+               name = (char *)g_malloc (name_len + 1);
+               memcpy (name, named, name_len);
+               name [name_len] = 0;
+               named += name_len;
+               if (named_type == 0x53) {
+                       MonoObject *obj;
+                       MonoClassField *field = mono_class_get_field_from_name (attrklass, name);
+
+                       if (!field) {
+                               g_free (name);
+                               goto fail;
+                       }
+
+                       arginfo [j].type = field->type;
+                       arginfo [j].field = field;
+
+                       obj = load_cattr_value_boxed (domain, image, field->type, named, &named, error);
+                       if (!is_ok (error)) {
+                               g_free (name);
+                               return;
+                       }
+                       mono_array_setref (namedargs, j, obj);
+
+               } else if (named_type == 0x54) {
+                       MonoObject *obj;
+                       MonoType *prop_type;
+                       MonoProperty *prop = mono_class_get_property_from_name (attrklass, name);
+
+                       if (!prop || !prop->set) {
+                               g_free (name);
+                               goto fail;
+                       }
+
+                       prop_type = prop->get? mono_method_signature (prop->get)->ret :
+                            mono_method_signature (prop->set)->params [mono_method_signature (prop->set)->param_count - 1];
+
+                       arginfo [j].type = prop_type;
+                       arginfo [j].prop = prop;
+
+                       obj = load_cattr_value_boxed (domain, image, prop_type, named, &named, error);
+                       if (!is_ok (error)) {
+                               g_free (name);
+                               return;
+                       }
+                       mono_array_setref (namedargs, j, obj);
+               }
+               g_free (name);
+       }
+
+       *typed_args = typedargs;
+       *named_args = namedargs;
+       return;
+fail:
+       mono_error_set_generic_error (error, "System.Reflection", "CustomAttributeFormatException", "Binary format of the specified custom attribute was invalid.");
+       g_free (arginfo);
+       *named_arg_info = NULL;
+}
+
+static gboolean
+reflection_resolve_custom_attribute_data (MonoReflectionMethod *ref_method, MonoReflectionAssembly *assembly, gpointer data, guint32 len, MonoArray **ctor_args, MonoArray **named_args, MonoError *error)
+{
+       MonoDomain *domain;
+       MonoArray *typedargs, *namedargs;
+       MonoImage *image;
+       MonoMethod *method;
+       CattrNamedArg *arginfo = NULL;
+       int i;
+
+       mono_error_init (error);
+
+       *ctor_args = NULL;
+       *named_args = NULL;
+
+       if (len == 0)
+               return TRUE;
+
+       image = assembly->assembly->image;
+       method = ref_method->method;
+       domain = mono_object_domain (ref_method);
+
+       if (!mono_class_init (method->klass)) {
+               mono_error_set_for_class_failure (error, method->klass);
+               goto leave;
+       }
+
+       mono_reflection_create_custom_attr_data_args (image, method, (const guchar *)data, len, &typedargs, &namedargs, &arginfo, error);
+       if (!is_ok (error))
+               goto leave;
+
+       if (!typedargs || !namedargs)
+               goto leave;
+
+       for (i = 0; i < mono_method_signature (method)->param_count; ++i) {
+               MonoObject *obj = mono_array_get (typedargs, MonoObject*, i);
+               MonoObject *typedarg;
+
+               typedarg = create_cattr_typed_arg (mono_method_signature (method)->params [i], obj, error);
+               if (!is_ok (error))
+                       goto leave;
+               mono_array_setref (typedargs, i, typedarg);
+       }
+
+       for (i = 0; i < mono_array_length (namedargs); ++i) {
+               MonoObject *obj = mono_array_get (namedargs, MonoObject*, i);
+               MonoObject *typedarg, *namedarg, *minfo;
+
+               if (arginfo [i].prop) {
+                       minfo = (MonoObject*)mono_property_get_object_checked (domain, NULL, arginfo [i].prop, error);
+                       if (!minfo)
+                               goto leave;
+               } else {
+                       minfo = (MonoObject*)mono_field_get_object_checked (domain, NULL, arginfo [i].field, error);
+                       if (!is_ok (error))
+                               goto leave;
+               }
+
+               typedarg = create_cattr_typed_arg (arginfo [i].type, obj, error);
+               if (!is_ok (error))
+                       goto leave;
+               namedarg = create_cattr_named_arg (minfo, typedarg, error);
+               if (!is_ok (error))
+                       goto leave;
+
+               mono_array_setref (namedargs, i, namedarg);
+       }
+
+       *ctor_args = typedargs;
+       *named_args = namedargs;
+
+leave:
+       g_free (arginfo);
+       return mono_error_ok (error);
+}
+
+void
+ves_icall_System_Reflection_CustomAttributeData_ResolveArgumentsInternal (MonoReflectionMethod *ref_method, MonoReflectionAssembly *assembly, gpointer data, guint32 len, MonoArray **ctor_args, MonoArray **named_args)
+{
+       MonoError error;
+       (void) reflection_resolve_custom_attribute_data (ref_method, assembly, data, len, ctor_args, named_args, &error);
+       mono_error_set_pending_exception (&error);
+}
+
+static MonoObject*
+create_custom_attr_data (MonoImage *image, MonoCustomAttrEntry *cattr, MonoError *error)
+{
+       static MonoMethod *ctor;
+
+       MonoDomain *domain;
+       MonoObject *attr;
+       void *params [4];
+
+       mono_error_init (error);
+
+       g_assert (image->assembly);
+
+       if (!ctor)
+               ctor = mono_class_get_method_from_name (mono_defaults.customattribute_data_class, ".ctor", 4);
+
+       domain = mono_domain_get ();
+       attr = mono_object_new_checked (domain, mono_defaults.customattribute_data_class, error);
+       return_val_if_nok (error, NULL);
+       params [0] = mono_method_get_object_checked (domain, cattr->ctor, NULL, error);
+       return_val_if_nok (error, NULL);
+       params [1] = mono_assembly_get_object_checked (domain, image->assembly, error);
+       return_val_if_nok (error, NULL);
+       params [2] = (gpointer)&cattr->data;
+       params [3] = &cattr->data_size;
+
+       mono_runtime_invoke_checked (ctor, attr, params, error);
+       return_val_if_nok (error, NULL);
+       return attr;
+}
+
+static MonoArray*
+mono_custom_attrs_construct_by_type (MonoCustomAttrInfo *cinfo, MonoClass *attr_klass, MonoError *error)
+{
+       MonoArray *result;
+       MonoObject *attr;
+       int i, n;
+
+       mono_error_init (error);
+
+       for (i = 0; i < cinfo->num_attrs; ++i) {
+               MonoCustomAttrEntry *centry = &cinfo->attrs[i];
+               if (!centry->ctor) {
+                       /* The cattr type is not finished yet */
+                       /* We should include the type name but cinfo doesn't contain it */
+                       mono_error_set_type_load_name (error, NULL, NULL, "Custom attribute constructor is null because the custom attribute type is not finished yet.");
+                       return NULL;
+               }
+       }
+
+       n = 0;
+       if (attr_klass) {
+               for (i = 0; i < cinfo->num_attrs; ++i) {
+                       MonoMethod *ctor = cinfo->attrs[i].ctor;
+                       g_assert (ctor);
+                       if (mono_class_is_assignable_from (attr_klass, ctor->klass))
+                               n++;
+               }
+       } else {
+               n = cinfo->num_attrs;
+       }
+
+       result = mono_array_new_cached (mono_domain_get (), mono_defaults.attribute_class, n, error);
+       return_val_if_nok (error, NULL);
+       n = 0;
+       for (i = 0; i < cinfo->num_attrs; ++i) {
+               MonoCustomAttrEntry *centry = &cinfo->attrs [i];
+               if (!attr_klass || mono_class_is_assignable_from (attr_klass, centry->ctor->klass)) {
+                       attr = create_custom_attr (cinfo->image, centry->ctor, centry->data, centry->data_size, error);
+                       if (!mono_error_ok (error))
+                               return result;
+                       mono_array_setref (result, n, attr);
+                       n ++;
+               }
+       }
+       return result;
+}
+
+MonoArray*
+mono_custom_attrs_construct (MonoCustomAttrInfo *cinfo)
+{
+       MonoError error;
+       MonoArray *result = mono_custom_attrs_construct_by_type (cinfo, NULL, &error);
+       mono_error_assert_ok (&error); /*FIXME proper error handling*/
+
+       return result;
+}
+
+static MonoArray*
+mono_custom_attrs_data_construct (MonoCustomAttrInfo *cinfo, MonoError *error)
+{
+       MonoArray *result;
+       MonoObject *attr;
+       int i;
+       
+       mono_error_init (error);
+       result = mono_array_new_checked (mono_domain_get (), mono_defaults.customattribute_data_class, cinfo->num_attrs, error);
+       return_val_if_nok (error, NULL);
+       for (i = 0; i < cinfo->num_attrs; ++i) {
+               attr = create_custom_attr_data (cinfo->image, &cinfo->attrs [i], error);
+               return_val_if_nok (error, NULL);
+               mono_array_setref (result, i, attr);
+       }
+       return result;
+}
+
+/**
+ * mono_custom_attrs_from_index:
+ *
+ * Returns: NULL if no attributes are found or if a loading error occurs.
+ */
+MonoCustomAttrInfo*
+mono_custom_attrs_from_index (MonoImage *image, guint32 idx)
+{
+       MonoError error;
+       MonoCustomAttrInfo *result = mono_custom_attrs_from_index_checked (image, idx, FALSE, &error);
+       mono_error_cleanup (&error);
+       return result;
+}
+/**
+ * mono_custom_attrs_from_index_checked:
+ *
+ * Returns: NULL if no attributes are found.  On error returns NULL and sets @error.
+ */
+MonoCustomAttrInfo*
+mono_custom_attrs_from_index_checked (MonoImage *image, guint32 idx, gboolean ignore_missing, MonoError *error)
+{
+       guint32 mtoken, i, len;
+       guint32 cols [MONO_CUSTOM_ATTR_SIZE];
+       MonoTableInfo *ca;
+       MonoCustomAttrInfo *ainfo;
+       GList *tmp, *list = NULL;
+       const char *data;
+       MonoCustomAttrEntry* attr;
+
+       mono_error_init (error);
+
+       ca = &image->tables [MONO_TABLE_CUSTOMATTRIBUTE];
+
+       i = mono_metadata_custom_attrs_from_index (image, idx);
+       if (!i)
+               return NULL;
+       i --;
+       while (i < ca->rows) {
+               if (mono_metadata_decode_row_col (ca, i, MONO_CUSTOM_ATTR_PARENT) != idx)
+                       break;
+               list = g_list_prepend (list, GUINT_TO_POINTER (i));
+               ++i;
+       }
+       len = g_list_length (list);
+       if (!len)
+               return NULL;
+       ainfo = (MonoCustomAttrInfo *)g_malloc0 (MONO_SIZEOF_CUSTOM_ATTR_INFO + sizeof (MonoCustomAttrEntry) * len);
+       ainfo->num_attrs = len;
+       ainfo->image = image;
+       for (i = len, tmp = list; i != 0; --i, tmp = tmp->next) {
+               mono_metadata_decode_row (ca, GPOINTER_TO_UINT (tmp->data), cols, MONO_CUSTOM_ATTR_SIZE);
+               mtoken = cols [MONO_CUSTOM_ATTR_TYPE] >> MONO_CUSTOM_ATTR_TYPE_BITS;
+               switch (cols [MONO_CUSTOM_ATTR_TYPE] & MONO_CUSTOM_ATTR_TYPE_MASK) {
+               case MONO_CUSTOM_ATTR_TYPE_METHODDEF:
+                       mtoken |= MONO_TOKEN_METHOD_DEF;
+                       break;
+               case MONO_CUSTOM_ATTR_TYPE_MEMBERREF:
+                       mtoken |= MONO_TOKEN_MEMBER_REF;
+                       break;
+               default:
+                       g_error ("Unknown table for custom attr type %08x", cols [MONO_CUSTOM_ATTR_TYPE]);
+                       break;
+               }
+               attr = &ainfo->attrs [i - 1];
+               attr->ctor = mono_get_method_checked (image, mtoken, NULL, NULL, error);
+               if (!attr->ctor) {
+                       g_warning ("Can't find custom attr constructor image: %s mtoken: 0x%08x due to: %s", image->name, mtoken, mono_error_get_message (error));
+                       if (ignore_missing) {
+                               mono_error_cleanup (error);
+                               mono_error_init (error);
+                       } else {
+                               g_list_free (list);
+                               g_free (ainfo);
+                               return NULL;
+                       }
+               }
+
+               if (!mono_verifier_verify_cattr_blob (image, cols [MONO_CUSTOM_ATTR_VALUE], NULL)) {
+                       /*FIXME raising an exception here doesn't make any sense*/
+                       g_warning ("Invalid custom attribute blob on image %s for index %x", image->name, idx);
+                       g_list_free (list);
+                       g_free (ainfo);
+                       return NULL;
+               }
+               data = mono_metadata_blob_heap (image, cols [MONO_CUSTOM_ATTR_VALUE]);
+               attr->data_size = mono_metadata_decode_value (data, &data);
+               attr->data = (guchar*)data;
+       }
+       g_list_free (list);
+
+       return ainfo;
+}
+
+MonoCustomAttrInfo*
+mono_custom_attrs_from_method (MonoMethod *method)
+{
+       MonoError error;
+       MonoCustomAttrInfo* result = mono_custom_attrs_from_method_checked  (method, &error);
+       mono_error_cleanup (&error); /* FIXME want a better API that doesn't swallow the error */
+       return result;
+}
+
+MonoCustomAttrInfo*
+mono_custom_attrs_from_method_checked (MonoMethod *method, MonoError *error)
+{
+       guint32 idx;
+
+       mono_error_init (error);
+
+       /*
+        * An instantiated method has the same cattrs as the generic method definition.
+        *
+        * LAMESPEC: The .NET SRE throws an exception for instantiations of generic method builders
+        *           Note that this stanza is not necessary for non-SRE types, but it's a micro-optimization
+        */
+       if (method->is_inflated)
+               method = ((MonoMethodInflated *) method)->declaring;
+       
+       if (method_is_dynamic (method) || image_is_dynamic (method->klass->image))
+               return lookup_custom_attr (method->klass->image, method);
+
+       if (!method->token)
+               /* Synthetic methods */
+               return NULL;
+
+       idx = mono_method_get_index (method);
+       idx <<= MONO_CUSTOM_ATTR_BITS;
+       idx |= MONO_CUSTOM_ATTR_METHODDEF;
+       return mono_custom_attrs_from_index_checked (method->klass->image, idx, FALSE, error);
+}
+
+MonoCustomAttrInfo*
+mono_custom_attrs_from_class (MonoClass *klass)
+{
+       MonoError error;
+       MonoCustomAttrInfo *result = mono_custom_attrs_from_class_checked (klass, &error);
+       mono_error_cleanup (&error);
+       return result;
+}
+
+MonoCustomAttrInfo*
+mono_custom_attrs_from_class_checked (MonoClass *klass, MonoError *error)
+{
+       guint32 idx;
+
+       mono_error_init (error);
+
+       if (mono_class_is_ginst (klass))
+               klass = mono_class_get_generic_class (klass)->container_class;
+
+       if (image_is_dynamic (klass->image))
+               return lookup_custom_attr (klass->image, klass);
+
+       if (klass->byval_arg.type == MONO_TYPE_VAR || klass->byval_arg.type == MONO_TYPE_MVAR) {
+               idx = mono_metadata_token_index (klass->sizes.generic_param_token);
+               idx <<= MONO_CUSTOM_ATTR_BITS;
+               idx |= MONO_CUSTOM_ATTR_GENERICPAR;
+       } else {
+               idx = mono_metadata_token_index (klass->type_token);
+               idx <<= MONO_CUSTOM_ATTR_BITS;
+               idx |= MONO_CUSTOM_ATTR_TYPEDEF;
+       }
+       return mono_custom_attrs_from_index_checked (klass->image, idx, FALSE, error);
+}
+
+MonoCustomAttrInfo*
+mono_custom_attrs_from_assembly (MonoAssembly *assembly)
+{
+       MonoError error;
+       MonoCustomAttrInfo *result = mono_custom_attrs_from_assembly_checked (assembly, FALSE, &error);
+       mono_error_cleanup (&error);
+       return result;
+}
+
+MonoCustomAttrInfo*
+mono_custom_attrs_from_assembly_checked (MonoAssembly *assembly, gboolean ignore_missing, MonoError *error)
+{
+       guint32 idx;
+       
+       mono_error_init (error);
+
+       if (image_is_dynamic (assembly->image))
+               return lookup_custom_attr (assembly->image, assembly);
+       idx = 1; /* there is only one assembly */
+       idx <<= MONO_CUSTOM_ATTR_BITS;
+       idx |= MONO_CUSTOM_ATTR_ASSEMBLY;
+       return mono_custom_attrs_from_index_checked (assembly->image, idx, ignore_missing, error);
+}
+
+static MonoCustomAttrInfo*
+mono_custom_attrs_from_module (MonoImage *image, MonoError *error)
+{
+       guint32 idx;
+       
+       if (image_is_dynamic (image))
+               return lookup_custom_attr (image, image);
+       idx = 1; /* there is only one module */
+       idx <<= MONO_CUSTOM_ATTR_BITS;
+       idx |= MONO_CUSTOM_ATTR_MODULE;
+       return mono_custom_attrs_from_index_checked (image, idx, FALSE, error);
+}
+
+MonoCustomAttrInfo*
+mono_custom_attrs_from_property (MonoClass *klass, MonoProperty *property)
+{
+       MonoError error;
+       MonoCustomAttrInfo * result = mono_custom_attrs_from_property_checked (klass, property, &error);
+       mono_error_cleanup (&error);
+       return result;
+}
+
+MonoCustomAttrInfo*
+mono_custom_attrs_from_property_checked (MonoClass *klass, MonoProperty *property, MonoError *error)
+{
+       guint32 idx;
+       
+       if (image_is_dynamic (klass->image)) {
+               property = mono_metadata_get_corresponding_property_from_generic_type_definition (property);
+               return lookup_custom_attr (klass->image, property);
+       }
+       idx = find_property_index (klass, property);
+       idx <<= MONO_CUSTOM_ATTR_BITS;
+       idx |= MONO_CUSTOM_ATTR_PROPERTY;
+       return mono_custom_attrs_from_index_checked (klass->image, idx, FALSE, error);
+}
+
+MonoCustomAttrInfo*
+mono_custom_attrs_from_event (MonoClass *klass, MonoEvent *event)
+{
+       MonoError error;
+       MonoCustomAttrInfo * result = mono_custom_attrs_from_event_checked (klass, event, &error);
+       mono_error_cleanup (&error);
+       return result;
+}
+
+MonoCustomAttrInfo*
+mono_custom_attrs_from_event_checked (MonoClass *klass, MonoEvent *event, MonoError *error)
+{
+       guint32 idx;
+       
+       if (image_is_dynamic (klass->image)) {
+               event = mono_metadata_get_corresponding_event_from_generic_type_definition (event);
+               return lookup_custom_attr (klass->image, event);
+       }
+       idx = find_event_index (klass, event);
+       idx <<= MONO_CUSTOM_ATTR_BITS;
+       idx |= MONO_CUSTOM_ATTR_EVENT;
+       return mono_custom_attrs_from_index_checked (klass->image, idx, FALSE, error);
+}
+
+MonoCustomAttrInfo*
+mono_custom_attrs_from_field (MonoClass *klass, MonoClassField *field)
+{
+       MonoError error;
+       MonoCustomAttrInfo * result = mono_custom_attrs_from_field_checked (klass, field, &error);
+       mono_error_cleanup (&error);
+       return result;
+}
+
+MonoCustomAttrInfo*
+mono_custom_attrs_from_field_checked (MonoClass *klass, MonoClassField *field, MonoError *error)
+{
+       guint32 idx;
+       mono_error_init (error);
+
+       if (image_is_dynamic (klass->image)) {
+               field = mono_metadata_get_corresponding_field_from_generic_type_definition (field);
+               return lookup_custom_attr (klass->image, field);
+       }
+       idx = find_field_index (klass, field);
+       idx <<= MONO_CUSTOM_ATTR_BITS;
+       idx |= MONO_CUSTOM_ATTR_FIELDDEF;
+       return mono_custom_attrs_from_index_checked (klass->image, idx, FALSE, error);
+}
+
+/**
+ * mono_custom_attrs_from_param:
+ * @method: handle to the method that we want to retrieve custom parameter information from
+ * @param: parameter number, where zero represent the return value, and one is the first parameter in the method
+ *
+ * The result must be released with mono_custom_attrs_free().
+ *
+ * Returns: the custom attribute object for the specified parameter, or NULL if there are none.
+ */
+MonoCustomAttrInfo*
+mono_custom_attrs_from_param (MonoMethod *method, guint32 param)
+{
+       MonoError error;
+       MonoCustomAttrInfo *result = mono_custom_attrs_from_param_checked (method, param, &error);
+       mono_error_cleanup (&error);
+       return result;
+}
+
+/**
+ * mono_custom_attrs_from_param_checked:
+ * @method: handle to the method that we want to retrieve custom parameter information from
+ * @param: parameter number, where zero represent the return value, and one is the first parameter in the method
+ * @error: set on error
+ *
+ * The result must be released with mono_custom_attrs_free().
+ *
+ * Returns: the custom attribute object for the specified parameter, or NULL if there are none.  On failure returns NULL and sets @error.
+ */
+MonoCustomAttrInfo*
+mono_custom_attrs_from_param_checked (MonoMethod *method, guint32 param, MonoError *error)
+{
+       MonoTableInfo *ca;
+       guint32 i, idx, method_index;
+       guint32 param_list, param_last, param_pos, found;
+       MonoImage *image;
+       MonoReflectionMethodAux *aux;
+
+       mono_error_init (error);
+
+       /*
+        * An instantiated method has the same cattrs as the generic method definition.
+        *
+        * LAMESPEC: The .NET SRE throws an exception for instantiations of generic method builders
+        *           Note that this stanza is not necessary for non-SRE types, but it's a micro-optimization
+        */
+       if (method->is_inflated)
+               method = ((MonoMethodInflated *) method)->declaring;
+
+       if (image_is_dynamic (method->klass->image)) {
+               MonoCustomAttrInfo *res, *ainfo;
+               int size;
+
+               aux = (MonoReflectionMethodAux *)g_hash_table_lookup (((MonoDynamicImage*)method->klass->image)->method_aux_hash, method);
+               if (!aux || !aux->param_cattr)
+                       return NULL;
+
+               /* Need to copy since it will be freed later */
+               ainfo = aux->param_cattr [param];
+               if (!ainfo)
+                       return NULL;
+               size = MONO_SIZEOF_CUSTOM_ATTR_INFO + sizeof (MonoCustomAttrEntry) * ainfo->num_attrs;
+               res = (MonoCustomAttrInfo *)g_malloc0 (size);
+               memcpy (res, ainfo, size);
+               return res;
+       }
+
+       image = method->klass->image;
+       method_index = mono_method_get_index (method);
+       if (!method_index)
+               return NULL;
+       ca = &image->tables [MONO_TABLE_METHOD];
+
+       param_list = mono_metadata_decode_row_col (ca, method_index - 1, MONO_METHOD_PARAMLIST);
+       if (method_index == ca->rows) {
+               ca = &image->tables [MONO_TABLE_PARAM];
+               param_last = ca->rows + 1;
+       } else {
+               param_last = mono_metadata_decode_row_col (ca, method_index, MONO_METHOD_PARAMLIST);
+               ca = &image->tables [MONO_TABLE_PARAM];
+       }
+       found = FALSE;
+       for (i = param_list; i < param_last; ++i) {
+               param_pos = mono_metadata_decode_row_col (ca, i - 1, MONO_PARAM_SEQUENCE);
+               if (param_pos == param) {
+                       found = TRUE;
+                       break;
+               }
+       }
+       if (!found)
+               return NULL;
+       idx = i;
+       idx <<= MONO_CUSTOM_ATTR_BITS;
+       idx |= MONO_CUSTOM_ATTR_PARAMDEF;
+       return mono_custom_attrs_from_index_checked (image, idx, FALSE, error);
+}
+
+gboolean
+mono_custom_attrs_has_attr (MonoCustomAttrInfo *ainfo, MonoClass *attr_klass)
+{
+       int i;
+       for (i = 0; i < ainfo->num_attrs; ++i) {
+               MonoCustomAttrEntry *centry = &ainfo->attrs[i];
+               if (centry->ctor == NULL)
+                       continue;
+               MonoClass *klass = centry->ctor->klass;
+               if (klass == attr_klass || mono_class_has_parent (klass, attr_klass) || (MONO_CLASS_IS_INTERFACE (attr_klass) && mono_class_is_assignable_from (attr_klass, klass)))
+                       return TRUE;
+       }
+       return FALSE;
+}
+
+MonoObject*
+mono_custom_attrs_get_attr (MonoCustomAttrInfo *ainfo, MonoClass *attr_klass)
+{
+       MonoError error;
+       MonoObject *res = mono_custom_attrs_get_attr_checked (ainfo, attr_klass, &error);
+       mono_error_assert_ok (&error); /*FIXME proper error handling*/
+       return res;
+}
+
+MonoObject*
+mono_custom_attrs_get_attr_checked (MonoCustomAttrInfo *ainfo, MonoClass *attr_klass, MonoError *error)
+{
+       int i;
+       MonoCustomAttrEntry *centry = NULL;
+
+       g_assert (attr_klass != NULL);
+
+       mono_error_init (error);
+
+       for (i = 0; i < ainfo->num_attrs; ++i) {
+               centry = &ainfo->attrs[i];
+               if (centry->ctor == NULL)
+                       continue;
+               MonoClass *klass = centry->ctor->klass;
+               if (attr_klass == klass || mono_class_is_assignable_from (attr_klass, klass))
+                       break;
+       }
+       if (centry == NULL)
+               return NULL;
+
+       return create_custom_attr (ainfo->image, centry->ctor, centry->data, centry->data_size, error);
+}
+
+/*
+ * mono_reflection_get_custom_attrs_info:
+ * @obj: a reflection object handle
+ *
+ * Return the custom attribute info for attributes defined for the
+ * reflection handle @obj. The objects.
+ *
+ * FIXME this function leaks like a sieve for SRE objects.
+ */
+MonoCustomAttrInfo*
+mono_reflection_get_custom_attrs_info (MonoObject *obj)
+{
+       MonoError error;
+       MonoCustomAttrInfo *result = mono_reflection_get_custom_attrs_info_checked (obj, &error);
+       mono_error_assert_ok (&error);
+       return result;
+}
+
+/**
+ * mono_reflection_get_custom_attrs_info_checked:
+ * @obj: a reflection object handle
+ * @error: set on error
+ *
+ * Return the custom attribute info for attributes defined for the
+ * reflection handle @obj. The objects.
+ *
+ * On failure returns NULL and sets @error.
+ *
+ * FIXME this function leaks like a sieve for SRE objects.
+ */
+MonoCustomAttrInfo*
+mono_reflection_get_custom_attrs_info_checked (MonoObject *obj, MonoError *error)
+{
+       MonoClass *klass;
+       MonoCustomAttrInfo *cinfo = NULL;
+       
+       mono_error_init (error);
+
+       klass = obj->vtable->klass;
+       if (klass == mono_defaults.runtimetype_class) {
+               MonoType *type = mono_reflection_type_get_handle ((MonoReflectionType *)obj, error);
+               return_val_if_nok (error, NULL);
+               klass = mono_class_from_mono_type (type);
+               /*We cannot mono_class_init the class from which we'll load the custom attributes since this must work with broken types.*/
+               cinfo = mono_custom_attrs_from_class_checked (klass, error);
+               return_val_if_nok (error, NULL);
+       } else if (strcmp ("Assembly", klass->name) == 0 || strcmp ("MonoAssembly", klass->name) == 0) {
+               MonoReflectionAssembly *rassembly = (MonoReflectionAssembly*)obj;
+               cinfo = mono_custom_attrs_from_assembly_checked (rassembly->assembly, FALSE, error);
+               return_val_if_nok (error, NULL);
+       } else if (strcmp ("Module", klass->name) == 0 || strcmp ("MonoModule", klass->name) == 0) {
+               MonoReflectionModule *module = (MonoReflectionModule*)obj;
+               cinfo = mono_custom_attrs_from_module (module->image, error);
+               return_val_if_nok (error, NULL);
+       } else if (strcmp ("MonoProperty", klass->name) == 0) {
+               MonoReflectionProperty *rprop = (MonoReflectionProperty*)obj;
+               cinfo = mono_custom_attrs_from_property_checked (rprop->property->parent, rprop->property, error);
+               return_val_if_nok (error, NULL);
+       } else if (strcmp ("MonoEvent", klass->name) == 0) {
+               MonoReflectionMonoEvent *revent = (MonoReflectionMonoEvent*)obj;
+               cinfo = mono_custom_attrs_from_event_checked (revent->event->parent, revent->event, error);
+               return_val_if_nok (error, NULL);
+       } else if (strcmp ("MonoField", klass->name) == 0) {
+               MonoReflectionField *rfield = (MonoReflectionField*)obj;
+               cinfo = mono_custom_attrs_from_field_checked (rfield->field->parent, rfield->field, error);
+               return_val_if_nok (error, NULL);
+       } else if ((strcmp ("MonoMethod", klass->name) == 0) || (strcmp ("MonoCMethod", klass->name) == 0)) {
+               MonoReflectionMethod *rmethod = (MonoReflectionMethod*)obj;
+               cinfo = mono_custom_attrs_from_method_checked (rmethod->method, error);
+               return_val_if_nok (error, NULL);
+       } else if (strcmp ("ParameterInfo", klass->name) == 0 || strcmp ("MonoParameterInfo", klass->name) == 0) {
+               MonoReflectionParameter *param = (MonoReflectionParameter*)obj;
+               MonoClass *member_class = mono_object_class (param->MemberImpl);
+               if (mono_class_is_reflection_method_or_constructor (member_class)) {
+                       MonoReflectionMethod *rmethod = (MonoReflectionMethod*)param->MemberImpl;
+                       cinfo = mono_custom_attrs_from_param_checked (rmethod->method, param->PositionImpl + 1, error);
+                       return_val_if_nok (error, NULL);
+               } else if (mono_is_sr_mono_property (member_class)) {
+                       MonoReflectionProperty *prop = (MonoReflectionProperty *)param->MemberImpl;
+                       MonoMethod *method;
+                       if (!(method = prop->property->get))
+                               method = prop->property->set;
+                       g_assert (method);
+
+                       cinfo = mono_custom_attrs_from_param_checked (method, param->PositionImpl + 1, error);
+                       return_val_if_nok (error, NULL);
+               } 
+#ifndef DISABLE_REFLECTION_EMIT
+               else if (mono_is_sre_method_on_tb_inst (member_class)) {/*XXX This is a workaround for Compiler Context*/
+                       // FIXME: Is this still needed ?
+                       g_assert_not_reached ();
+               } else if (mono_is_sre_ctor_on_tb_inst (member_class)) { /*XX This is a workaround for Compiler Context*/
+                       // FIXME: Is this still needed ?
+                       g_assert_not_reached ();
+               } 
+#endif
+               else {
+                       char *type_name = mono_type_get_full_name (member_class);
+                       mono_error_set_not_supported (error,
+                                                     "Custom attributes on a ParamInfo with member %s are not supported",
+                                                     type_name);
+                       g_free (type_name);
+                       return NULL;
+               }
+       } else if (strcmp ("AssemblyBuilder", klass->name) == 0) {
+               MonoReflectionAssemblyBuilder *assemblyb = (MonoReflectionAssemblyBuilder*)obj;
+               cinfo = mono_custom_attrs_from_builders (NULL, assemblyb->assembly.assembly->image, assemblyb->cattrs);
+       } else if (strcmp ("TypeBuilder", klass->name) == 0) {
+               MonoReflectionTypeBuilder *tb = (MonoReflectionTypeBuilder*)obj;
+               cinfo = mono_custom_attrs_from_builders (NULL, &tb->module->dynamic_image->image, tb->cattrs);
+       } else if (strcmp ("ModuleBuilder", klass->name) == 0) {
+               MonoReflectionModuleBuilder *mb = (MonoReflectionModuleBuilder*)obj;
+               cinfo = mono_custom_attrs_from_builders (NULL, &mb->dynamic_image->image, mb->cattrs);
+       } else if (strcmp ("ConstructorBuilder", klass->name) == 0) {
+               MonoReflectionCtorBuilder *cb = (MonoReflectionCtorBuilder*)obj;
+               cinfo = mono_custom_attrs_from_builders (NULL, cb->mhandle->klass->image, cb->cattrs);
+       } else if (strcmp ("MethodBuilder", klass->name) == 0) {
+               MonoReflectionMethodBuilder *mb = (MonoReflectionMethodBuilder*)obj;
+               cinfo = mono_custom_attrs_from_builders (NULL, mb->mhandle->klass->image, mb->cattrs);
+       } else if (strcmp ("FieldBuilder", klass->name) == 0) {
+               MonoReflectionFieldBuilder *fb = (MonoReflectionFieldBuilder*)obj;
+               cinfo = mono_custom_attrs_from_builders (NULL, &((MonoReflectionTypeBuilder*)fb->typeb)->module->dynamic_image->image, fb->cattrs);
+       } else if (strcmp ("MonoGenericClass", klass->name) == 0) {
+               MonoReflectionGenericClass *gclass = (MonoReflectionGenericClass*)obj;
+               cinfo = mono_reflection_get_custom_attrs_info_checked ((MonoObject*)gclass->generic_type, error);
+               return_val_if_nok (error, NULL);
+       } else { /* handle other types here... */
+               g_error ("get custom attrs not yet supported for %s", klass->name);
+       }
+
+       return cinfo;
+}
+
+/*
+ * mono_reflection_get_custom_attrs_by_type:
+ * @obj: a reflection object handle
+ *
+ * Return an array with all the custom attributes defined of the
+ * reflection handle @obj. If @attr_klass is non-NULL, only custom attributes 
+ * of that type are returned. The objects are fully build. Return NULL if a loading error
+ * occurs.
+ */
+MonoArray*
+mono_reflection_get_custom_attrs_by_type (MonoObject *obj, MonoClass *attr_klass, MonoError *error)
+{
+       MonoArray *result;
+       MonoCustomAttrInfo *cinfo;
+
+       mono_error_init (error);
+
+       cinfo = mono_reflection_get_custom_attrs_info_checked (obj, error);
+       return_val_if_nok (error, NULL);
+       if (cinfo) {
+               result = mono_custom_attrs_construct_by_type (cinfo, attr_klass, error);
+               if (!cinfo->cached)
+                       mono_custom_attrs_free (cinfo);
+               if (!result)
+                       return NULL;
+       } else {
+               result = mono_array_new_cached (mono_domain_get (), mono_defaults.attribute_class, 0, error);
+       }
+
+       return result;
+}
+
+/*
+ * mono_reflection_get_custom_attrs:
+ * @obj: a reflection object handle
+ *
+ * Return an array with all the custom attributes defined of the
+ * reflection handle @obj. The objects are fully build. Return NULL if a loading error
+ * occurs.
+ */
+MonoArray*
+mono_reflection_get_custom_attrs (MonoObject *obj)
+{
+       MonoError error;
+
+       return mono_reflection_get_custom_attrs_by_type (obj, NULL, &error);
+}
+
+/*
+ * mono_reflection_get_custom_attrs_data:
+ * @obj: a reflection obj handle
+ *
+ * Returns an array of System.Reflection.CustomAttributeData,
+ * which include information about attributes reflected on
+ * types loaded using the Reflection Only methods
+ */
+MonoArray*
+mono_reflection_get_custom_attrs_data (MonoObject *obj)
+{
+       MonoError error;
+       MonoArray* result;
+       result = mono_reflection_get_custom_attrs_data_checked (obj, &error);
+       mono_error_cleanup (&error);
+       return result;
+}
+
+/*
+ * mono_reflection_get_custom_attrs_data_checked:
+ * @obj: a reflection obj handle
+ * @error: set on error
+ *
+ * Returns an array of System.Reflection.CustomAttributeData,
+ * which include information about attributes reflected on
+ * types loaded using the Reflection Only methods
+ */
+MonoArray*
+mono_reflection_get_custom_attrs_data_checked (MonoObject *obj, MonoError *error)
+{
+       MonoArray *result;
+       MonoCustomAttrInfo *cinfo;
+
+       mono_error_init (error);
+
+       cinfo = mono_reflection_get_custom_attrs_info_checked (obj, error);
+       return_val_if_nok (error, NULL);
+       if (cinfo) {
+               result = mono_custom_attrs_data_construct (cinfo, error);
+               if (!cinfo->cached)
+                       mono_custom_attrs_free (cinfo);
+               return_val_if_nok (error, NULL);
+       } else 
+               result = mono_array_new_checked (mono_domain_get (), mono_defaults.customattribute_data_class, 0, error);
+
+       return result;
+}
+
+static gboolean
+custom_attr_class_name_from_methoddef (MonoImage *image, guint32 method_token, const gchar **nspace, const gchar **class_name)
+{
+       /* mono_get_method_from_token () */
+       g_assert (mono_metadata_token_table (method_token) == MONO_TABLE_METHOD);
+       guint32 type_token = mono_metadata_typedef_from_method (image, method_token);
+       if (!type_token) {
+               /* Bad method token (could not find corresponding typedef) */
+               return FALSE;
+       }
+       type_token |= MONO_TOKEN_TYPE_DEF;
+       {
+               /* mono_class_create_from_typedef () */
+               MonoTableInfo *tt = &image->tables [MONO_TABLE_TYPEDEF];
+               guint32 cols [MONO_TYPEDEF_SIZE];
+               guint tidx = mono_metadata_token_index (type_token);
+
+               if (mono_metadata_token_table (type_token) != MONO_TABLE_TYPEDEF || tidx > tt->rows) {
+                       /* "Invalid typedef token %x", type_token */
+                       return FALSE;
+               }
+
+               mono_metadata_decode_row (tt, tidx - 1, cols, MONO_TYPEDEF_SIZE);
+
+               if (class_name)
+                       *class_name = mono_metadata_string_heap (image, cols [MONO_TYPEDEF_NAME]);
+               if (nspace)
+                       *nspace = mono_metadata_string_heap (image, cols [MONO_TYPEDEF_NAMESPACE]);
+               return TRUE;
+       }
+}
+
+
+/**
+ * custom_attr_class_name_from_method_token:
+ * @image: The MonoImage
+ * @method_token: a token for a custom attr constructor in @image
+ * @assembly_token: out argment set to the assembly ref token of the custom attr
+ * @nspace: out argument set to namespace (a string in the string heap of @image) of the custom attr
+ * @class_name: out argument set to the class name of the custom attr.
+ *
+ * Given an @image and a @method_token (which is assumed to be a
+ * constructor), fills in the out arguments with the assembly ref (if
+ * a methodref) and the namespace and class name of the custom
+ * attribute.
+ *
+ * Returns: TRUE on success, FALSE otherwise.
+ *
+ * LOCKING: does not take locks
+ */
+static gboolean
+custom_attr_class_name_from_method_token (MonoImage *image, guint32 method_token, guint32 *assembly_token, const gchar **nspace, const gchar **class_name)
+{
+       /* This only works with method tokens constructed from a
+        * custom attr token, which can only be methoddef or
+        * memberref */
+       g_assert (mono_metadata_token_table (method_token) == MONO_TABLE_METHOD
+                 || mono_metadata_token_table  (method_token) == MONO_TABLE_MEMBERREF);
+
+       if (mono_metadata_token_table (method_token) == MONO_TABLE_MEMBERREF) {
+               /* method_from_memberref () */
+               guint32 cols[6];
+               guint32 nindex, class_index;
+
+               int idx = mono_metadata_token_index (method_token);
+
+               mono_metadata_decode_row (&image->tables [MONO_TABLE_MEMBERREF], idx-1, cols, 3);
+               nindex = cols [MONO_MEMBERREF_CLASS] >> MONO_MEMBERREF_PARENT_BITS;
+               class_index = cols [MONO_MEMBERREF_CLASS] & MONO_MEMBERREF_PARENT_MASK;
+               if (class_index == MONO_MEMBERREF_PARENT_TYPEREF) {
+                       guint32 type_token = MONO_TOKEN_TYPE_REF | nindex;
+                       /* mono_class_from_typeref_checked () */
+                       {
+                               guint32 cols [MONO_TYPEREF_SIZE];
+                               MonoTableInfo  *t = &image->tables [MONO_TABLE_TYPEREF];
+
+                               mono_metadata_decode_row (t, (type_token&0xffffff)-1, cols, MONO_TYPEREF_SIZE);
+
+                               if (class_name)
+                                       *class_name = mono_metadata_string_heap (image, cols [MONO_TYPEREF_NAME]);
+                               if (nspace)
+                                       *nspace = mono_metadata_string_heap (image, cols [MONO_TYPEREF_NAMESPACE]);
+                               if (assembly_token)
+                                       *assembly_token = cols [MONO_TYPEREF_SCOPE];
+                               return TRUE;
+                       }
+               } else if (class_index == MONO_MEMBERREF_PARENT_METHODDEF) {
+                       guint32 methoddef_token = MONO_TOKEN_METHOD_DEF | nindex;
+                       if (assembly_token)
+                               *assembly_token = 0;
+                       return custom_attr_class_name_from_methoddef (image, methoddef_token, nspace, class_name);
+               } else {
+                       /* Attributes can't be generic, so it won't be
+                        * a typespec, and they're always
+                        * constructors, so it won't be a moduleref */
+                       g_assert_not_reached ();
+               }
+       } else {
+               /* must be MONO_TABLE_METHOD */
+               if (assembly_token)
+                       *assembly_token = 0;
+               return custom_attr_class_name_from_methoddef (image, method_token, nspace, class_name);
+       }
+}
+
+/**
+ * mono_assembly_metadata_foreach_custom_attr:
+ * @assembly: the assembly to iterate over
+ * @func: the function to call for each custom attribute
+ * @user_data: passed to @func
+ *
+ * Calls @func for each custom attribute type on the given assembly until @func returns TRUE.
+ * Everything is done using low-level metadata APIs, so it is safe to use during assembly loading.
+ *
+ */
+void
+mono_assembly_metadata_foreach_custom_attr (MonoAssembly *assembly, MonoAssemblyMetadataCustomAttrIterFunc func, gpointer user_data)
+{
+       MonoImage *image;
+       guint32 mtoken, i;
+       guint32 cols [MONO_CUSTOM_ATTR_SIZE];
+       MonoTableInfo *ca;
+       guint32 idx;
+
+       /*
+        * This might be called during assembly loading, so do everything using the low-level
+        * metadata APIs.
+        */
+
+       image = assembly->image;
+       g_assert (!image_is_dynamic (image));
+       idx = 1; /* there is only one assembly */
+       idx <<= MONO_CUSTOM_ATTR_BITS;
+       idx |= MONO_CUSTOM_ATTR_ASSEMBLY;
+
+       /* Inlined from mono_custom_attrs_from_index_checked () */
+       ca = &image->tables [MONO_TABLE_CUSTOMATTRIBUTE];
+       i = mono_metadata_custom_attrs_from_index (image, idx);
+       if (!i)
+               return;
+       i --;
+       gboolean stop_iterating = FALSE;
+       while (!stop_iterating && i < ca->rows) {
+               if (mono_metadata_decode_row_col (ca, i, MONO_CUSTOM_ATTR_PARENT) != idx)
+                       break;
+               mono_metadata_decode_row (ca, i, cols, MONO_CUSTOM_ATTR_SIZE);
+               i ++;
+               mtoken = cols [MONO_CUSTOM_ATTR_TYPE] >> MONO_CUSTOM_ATTR_TYPE_BITS;
+               switch (cols [MONO_CUSTOM_ATTR_TYPE] & MONO_CUSTOM_ATTR_TYPE_MASK) {
+               case MONO_CUSTOM_ATTR_TYPE_METHODDEF:
+                       mtoken |= MONO_TOKEN_METHOD_DEF;
+                       break;
+               case MONO_CUSTOM_ATTR_TYPE_MEMBERREF:
+                       mtoken |= MONO_TOKEN_MEMBER_REF;
+                       break;
+               default:
+                       g_warning ("Unknown table for custom attr type %08x", cols [MONO_CUSTOM_ATTR_TYPE]);
+                       continue;
+               }
+
+               const char *nspace = NULL;
+               const char *name = NULL;
+               guint32 assembly_token = 0;
+
+               if (!custom_attr_class_name_from_method_token (image, mtoken, &assembly_token, &nspace, &name))
+                       continue;
+
+               stop_iterating = func (image, assembly_token, nspace, name, mtoken, user_data);
+       }
+}
index f418b2078cee4af6f2da49eb191d887c99d458bb..b7e48f95d44aebf774a53df0f23ca8fc3521e7e7 100644 (file)
@@ -649,11 +649,6 @@ mono_debug_symfile_get_seq_points (MonoDebugMethodInfo *minfo, char **source_fil
                        if (source_files)
                                (*source_files) [i] = (*source_file_list)->len - 1;
                }
-               if ((*source_file_list)->len == 0 && stm.file) {
-                       MonoDebugSourceInfo *info = get_source_info (symfile, stm.file);
-
-                       g_ptr_array_add (*source_file_list, info);
-               }
        }                               
 
        if (n_seq_points) {
index e385adadfd5c1b29b241952e86dd661a1e78298b..5448aa4ca8f50d65095781497ed21baf794face5 100644 (file)
@@ -339,7 +339,6 @@ struct _MonoDomain {
        /* Needed by Thread:GetDomainID() */
        gint32             domain_id;
        gint32             shadow_serial;
-       unsigned char      inet_family_hint; // used in socket-io.c as a cache
        GSList             *domain_assemblies;
        MonoAssembly       *entry_assembly;
        char               *friendly_name;
@@ -383,16 +382,13 @@ struct _MonoDomain {
        GHashTable         *method_rgctx_hash;
 
        GHashTable         *generic_virtual_cases;
-       MonoThunkFreeList **thunk_free_lists;
-
-       GHashTable     *generic_virtual_thunks;
 
        /* Information maintained by the JIT engine */
        gpointer runtime_info;
 
        /*thread pool jobs, used to coordinate shutdown.*/
        volatile int                    threadpool_jobs;
-       HANDLE                          cleanup_semaphore;
+       gpointer                                cleanup_semaphore;
        
        /* Contains the compiled runtime invoke wrapper used by finalizers */
        gpointer            finalize_runtime_invoke;
@@ -700,4 +696,8 @@ mono_runtime_init_checked (MonoDomain *domain, MonoThreadStartCB start_cb, MonoT
 void
 mono_context_init_checked (MonoDomain *domain, MonoError *error);
 
+gboolean
+mono_assembly_has_reference_assembly_attribute (MonoAssembly *assembly, MonoError *error);
+
+
 #endif /* __MONO_METADATA_DOMAIN_INTERNALS_H__ */
index d564151b7df43e403c7a72cb7f58ca3810e3a468..020b0dd00c4406bc0d482714b2af17e65836b0d6 100644 (file)
 #include <mono/metadata/mono-config.h>
 #include <mono/metadata/threads-types.h>
 #include <mono/metadata/runtime.h>
+#include <mono/metadata/w32mutex.h>
+#include <mono/metadata/w32semaphore.h>
+#include <mono/metadata/w32event.h>
+#include <mono/metadata/w32process.h>
 #include <metadata/threads.h>
 #include <metadata/profiler-private.h>
 #include <mono/metadata/coree.h>
-#include <mono/utils/w32handle.h>
 
 //#define DEBUG_DOMAIN_UNLOAD 1
 
@@ -64,7 +67,6 @@ MONO_FAST_TLS_DECLARE(tls_appdomain);
        MonoThreadInfo *info; \
        MONO_FAST_TLS_SET (tls_appdomain,x); \
        mono_native_tls_set_value (appdomain_thread_id, x); \
-       mono_gc_set_current_thread_appdomain (x); \
        info = mono_thread_info_current (); \
        if (info) \
                mono_thread_info_tls_set (info, TLS_KEY_DOMAIN, (x));   \
@@ -76,7 +78,6 @@ MONO_FAST_TLS_DECLARE(tls_appdomain);
 #define SET_APPDOMAIN(x) do {                                          \
                MonoThreadInfo *info;                                                           \
                mono_native_tls_set_value (appdomain_thread_id, x);     \
-               mono_gc_set_current_thread_appdomain (x);               \
                info = mono_thread_info_current ();                             \
                if (info)                                                                                                \
                        mono_thread_info_tls_set (info, TLS_KEY_DOMAIN, (x));   \
@@ -180,7 +181,7 @@ lock_free_mempool_free (LockFreeMempool *mp)
        chunk = mp->chunks;
        while (chunk) {
                next = (LockFreeMempoolChunk *)chunk->prev;
-               mono_vfree (chunk, mono_pagesize ());
+               mono_vfree (chunk, mono_pagesize (), MONO_MEM_ACCOUNT_DOMAIN);
                chunk = next;
        }
        g_free (mp);
@@ -198,7 +199,7 @@ lock_free_mempool_chunk_new (LockFreeMempool *mp, int len)
        size = mono_pagesize ();
        while (size - sizeof (LockFreeMempoolChunk) < len)
                size += mono_pagesize ();
-       chunk = (LockFreeMempoolChunk *)mono_valloc (0, size, MONO_MMAP_READ|MONO_MMAP_WRITE);
+       chunk = (LockFreeMempoolChunk *)mono_valloc (0, size, MONO_MMAP_READ|MONO_MMAP_WRITE, MONO_MEM_ACCOUNT_DOMAIN);
        g_assert (chunk);
        chunk->mem = (guint8 *)ALIGN_PTR_TO ((char*)chunk + sizeof (LockFreeMempoolChunk), 16);
        chunk->size = ((char*)chunk + size) - (char*)chunk->mem;
@@ -510,7 +511,7 @@ mono_init_internal (const char *filename, const char *exe_filename, const char *
        static MonoDomain *domain = NULL;
        MonoAssembly *ass = NULL;
        MonoImageOpenStatus status = MONO_IMAGE_OK;
-       const MonoRuntimeInfo* runtimes [G_N_ELEMENTS (supported_runtimes) + 1];
+       const MonoRuntimeInfo* runtimes [G_N_ELEMENTS (supported_runtimes) + 1] = { NULL };
        int n, dummy;
 
 #ifdef DEBUG_DOMAIN_UNLOAD
@@ -520,16 +521,22 @@ mono_init_internal (const char *filename, const char *exe_filename, const char *
        if (domain)
                g_assert_not_reached ();
 
-#ifdef HOST_WIN32
+#if defined(HOST_WIN32) && G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
        /* Avoid system error message boxes. */
        SetErrorMode (SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX);
 #endif
 
 #ifndef HOST_WIN32
        mono_w32handle_init ();
+       mono_w32handle_namespace_init ();
        wapi_init ();
 #endif
 
+       mono_w32mutex_init ();
+       mono_w32semaphore_init ();
+       mono_w32event_init ();
+       mono_w32process_init ();
+
 #ifndef DISABLE_PERFCOUNTERS
        mono_perfcounters_init ();
 #endif
@@ -893,9 +900,10 @@ mono_cleanup (void)
        mono_native_tls_free (appdomain_thread_id);
        mono_coop_mutex_destroy (&appdomains_mutex);
 
+       mono_w32process_cleanup ();
+
 #ifndef HOST_WIN32
        wapi_cleanup ();
-       mono_w32handle_cleanup ();
 #endif
 }
 
@@ -1169,6 +1177,12 @@ mono_domain_free (MonoDomain *domain, gboolean force)
        g_slist_free (domain->domain_assemblies);
        domain->domain_assemblies = NULL;
 
+       /* 
+        * Send this after the assemblies have been unloaded and the domain is still in a 
+        * usable state.
+        */
+       mono_profiler_appdomain_event (domain, MONO_PROFILE_END_UNLOAD);
+
        if (free_domain_hook)
                free_domain_hook (domain);
 
@@ -1242,10 +1256,6 @@ mono_domain_free (MonoDomain *domain, gboolean force)
                g_hash_table_destroy (domain->generic_virtual_cases);
                domain->generic_virtual_cases = NULL;
        }
-       if (domain->generic_virtual_thunks) {
-               g_hash_table_destroy (domain->generic_virtual_thunks);
-               domain->generic_virtual_thunks = NULL;
-       }
        if (domain->ftnptrs_hash) {
                g_hash_table_destroy (domain->ftnptrs_hash);
                domain->ftnptrs_hash = NULL;
diff --git a/mono/metadata/dynamic-image-internals.h b/mono/metadata/dynamic-image-internals.h
new file mode 100644 (file)
index 0000000..e012168
--- /dev/null
@@ -0,0 +1,44 @@
+/* 
+ * Copyright 2016 Microsoft
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
+ */
+#ifndef __MONO_METADATA_DYNAMIC_IMAGE_INTERNALS_H__
+#define __MONO_METADATA_DYNAMIC_IMAGE_INTERNALS_H__
+
+#include <mono/metadata/object.h>
+#include <mono/metadata/metadata-internals.h>
+
+typedef struct {
+       guint32 import_lookup_table;
+       guint32 timestamp;
+       guint32 forwarder;
+       guint32 name_rva;
+       guint32 import_address_table_rva;
+} MonoIDT;
+
+typedef struct {
+       guint32 name_rva;
+       guint32 flags;
+} MonoILT;
+
+
+void
+mono_dynamic_images_init (void);
+
+void
+mono_dynamic_image_register_token (MonoDynamicImage *assembly, guint32 token, MonoObject *obj);
+
+gboolean
+mono_dynamic_image_is_valid_token (MonoDynamicImage *image, guint32 token);
+
+MonoDynamicImage*
+mono_dynamic_image_create (MonoDynamicAssembly *assembly, char *assembly_name, char *module_name);
+
+guint32
+mono_dynamic_image_add_to_blob_cached (MonoDynamicImage *assembly, char *b1, int s1, char *b2, int s2);
+
+void
+mono_dynimage_alloc_table (MonoDynamicTable *table, guint nrows);
+
+#endif  /* __MONO_METADATA_DYNAMIC_IMAGE_INTERNALS_H__ */
+
diff --git a/mono/metadata/dynamic-image.c b/mono/metadata/dynamic-image.c
new file mode 100644 (file)
index 0000000..9906f43
--- /dev/null
@@ -0,0 +1,558 @@
+/*
+ * dynamic-image.c: Images created at runtime.
+ *   
+ * 
+ * Author:
+ *   Paolo Molaro (lupus@ximian.com)
+ *
+ * Copyright 2001-2003 Ximian, Inc (http://www.ximian.com)
+ * Copyright 2004-2009 Novell, Inc (http://www.novell.com)
+ * Copyright 2011 Rodrigo Kumpera
+ * Copyright 2016 Microsoft
+ *
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
+ */
+
+#include <config.h>
+#include <glib.h>
+#include "mono/metadata/object.h"
+#include "mono/metadata/dynamic-image-internals.h"
+#include "mono/metadata/dynamic-stream-internals.h"
+#include "mono/metadata/gc-internals.h"
+#include "mono/metadata/metadata-internals.h"
+#include "mono/metadata/profiler-private.h"
+#include "mono/metadata/reflection-internals.h"
+#include "mono/metadata/sre-internals.h"
+#include "mono/utils/checked-build.h"
+#include "mono/utils/mono-error-internals.h"
+#include "mono/utils/mono-os-mutex.h"
+
+const unsigned char table_sizes [MONO_TABLE_NUM] = {
+       MONO_MODULE_SIZE,
+       MONO_TYPEREF_SIZE,
+       MONO_TYPEDEF_SIZE,
+       0,
+       MONO_FIELD_SIZE,
+       0,
+       MONO_METHOD_SIZE,
+       0,
+       MONO_PARAM_SIZE,
+       MONO_INTERFACEIMPL_SIZE,
+       MONO_MEMBERREF_SIZE,    /* 0x0A */
+       MONO_CONSTANT_SIZE,
+       MONO_CUSTOM_ATTR_SIZE,
+       MONO_FIELD_MARSHAL_SIZE,
+       MONO_DECL_SECURITY_SIZE,
+       MONO_CLASS_LAYOUT_SIZE,
+       MONO_FIELD_LAYOUT_SIZE, /* 0x10 */
+       MONO_STAND_ALONE_SIGNATURE_SIZE,
+       MONO_EVENT_MAP_SIZE,
+       0,
+       MONO_EVENT_SIZE,
+       MONO_PROPERTY_MAP_SIZE,
+       0,
+       MONO_PROPERTY_SIZE,
+       MONO_METHOD_SEMA_SIZE,
+       MONO_METHODIMPL_SIZE,
+       MONO_MODULEREF_SIZE,    /* 0x1A */
+       MONO_TYPESPEC_SIZE,
+       MONO_IMPLMAP_SIZE,      
+       MONO_FIELD_RVA_SIZE,
+       0,
+       0,
+       MONO_ASSEMBLY_SIZE,     /* 0x20 */
+       MONO_ASSEMBLY_PROCESSOR_SIZE,
+       MONO_ASSEMBLYOS_SIZE,
+       MONO_ASSEMBLYREF_SIZE,
+       MONO_ASSEMBLYREFPROC_SIZE,
+       MONO_ASSEMBLYREFOS_SIZE,
+       MONO_FILE_SIZE,
+       MONO_EXP_TYPE_SIZE,
+       MONO_MANIFEST_SIZE,
+       MONO_NESTED_CLASS_SIZE,
+
+       MONO_GENERICPARAM_SIZE, /* 0x2A */
+       MONO_METHODSPEC_SIZE,
+       MONO_GENPARCONSTRAINT_SIZE
+
+};
+
+// The dynamic images list is only needed to support the mempool reference tracking feature in checked-build.
+static GPtrArray *dynamic_images;
+static mono_mutex_t dynamic_images_mutex;
+
+static inline void
+dynamic_images_lock (void)
+{
+       mono_os_mutex_lock (&dynamic_images_mutex);
+}
+
+static inline void
+dynamic_images_unlock (void)
+{
+       mono_os_mutex_unlock (&dynamic_images_mutex);
+}
+
+void
+mono_dynamic_images_init (void)
+{
+       mono_os_mutex_init (&dynamic_images_mutex);
+}
+
+#ifndef DISABLE_REFLECTION_EMIT
+static void
+string_heap_init (MonoDynamicStream *sh)
+{
+       mono_dynstream_init (sh);
+}
+#endif
+
+#ifndef DISABLE_REFLECTION_EMIT
+static int
+mono_blob_entry_hash (const char* str)
+{
+       MONO_REQ_GC_NEUTRAL_MODE;
+
+       guint len, h;
+       const char *end;
+       len = mono_metadata_decode_blob_size (str, &str);
+       if (len > 0) {
+               end = str + len;
+               h = *str;
+               for (str += 1; str < end; str++)
+                       h = (h << 5) - h + *str;
+               return h;
+       } else {
+               return 0;
+       }
+}
+
+static gboolean
+mono_blob_entry_equal (const char *str1, const char *str2) {
+       MONO_REQ_GC_NEUTRAL_MODE;
+
+       int len, len2;
+       const char *end1;
+       const char *end2;
+       len = mono_metadata_decode_blob_size (str1, &end1);
+       len2 = mono_metadata_decode_blob_size (str2, &end2);
+       if (len != len2)
+               return 0;
+       return memcmp (end1, end2, len) == 0;
+}
+#endif
+
+
+/**
+ * mono_find_dynamic_image_owner:
+ *
+ * Find the dynamic image, if any, which a given pointer is located in the memory of.
+ */
+MonoImage *
+mono_find_dynamic_image_owner (void *ptr)
+{
+       MonoImage *owner = NULL;
+       int i;
+
+       dynamic_images_lock ();
+
+       if (dynamic_images)
+       {
+               for (i = 0; !owner && i < dynamic_images->len; ++i) {
+                       MonoImage *image = (MonoImage *)g_ptr_array_index (dynamic_images, i);
+                       if (mono_mempool_contains_addr (image->mempool, ptr))
+                               owner = image;
+               }
+       }
+
+       dynamic_images_unlock ();
+
+       return owner;
+}
+
+static inline void
+dynamic_image_lock (MonoDynamicImage *image)
+{
+       MONO_ENTER_GC_SAFE;
+       mono_image_lock ((MonoImage*)image);
+       MONO_EXIT_GC_SAFE;
+}
+
+static inline void
+dynamic_image_unlock (MonoDynamicImage *image)
+{
+       mono_image_unlock ((MonoImage*)image);
+}
+
+void
+mono_dynamic_image_register_token (MonoDynamicImage *assembly, guint32 token, MonoObject *obj)
+{
+       MONO_REQ_GC_UNSAFE_MODE;
+
+       dynamic_image_lock (assembly);
+       mono_g_hash_table_insert (assembly->tokens, GUINT_TO_POINTER (token), obj);
+       dynamic_image_unlock (assembly);
+}
+
+static MonoObject*
+lookup_dyn_token (MonoDynamicImage *assembly, guint32 token)
+{
+       MONO_REQ_GC_UNSAFE_MODE;
+
+       MonoObject *obj;
+
+       dynamic_image_lock (assembly);
+       obj = (MonoObject *)mono_g_hash_table_lookup (assembly->tokens, GUINT_TO_POINTER (token));
+       dynamic_image_unlock (assembly);
+
+       return obj;
+}
+
+/**
+ * 
+ * mono_dynamic_image_is_valid_token:
+ * 
+ * Returns TRUE if token is valid in the given image.
+ * 
+ */
+gboolean
+mono_dynamic_image_is_valid_token (MonoDynamicImage *image, guint32 token)
+{
+       return lookup_dyn_token (image, token) != NULL;
+}
+
+#ifndef DISABLE_REFLECTION_EMIT
+
+#endif /* DISABLE_REFLECTION_EMIT */
+
+#ifndef DISABLE_REFLECTION_EMIT
+/**
+ * mono_reflection_lookup_dynamic_token:
+ *
+ * Finish the Builder object pointed to by TOKEN and return the corresponding
+ * runtime structure. If HANDLE_CLASS is not NULL, it is set to the class required by 
+ * mono_ldtoken. If valid_token is TRUE, assert if it is not found in the token->object
+ * mapping table.
+ *
+ * LOCKING: Take the loader lock
+ */
+gpointer
+mono_reflection_lookup_dynamic_token (MonoImage *image, guint32 token, gboolean valid_token, MonoClass **handle_class, MonoGenericContext *context, MonoError *error)
+{
+       MonoDynamicImage *assembly = (MonoDynamicImage*)image;
+       MonoObject *obj;
+       MonoClass *klass;
+
+       mono_error_init (error);
+       
+       obj = lookup_dyn_token (assembly, token);
+       if (!obj) {
+               if (valid_token)
+                       g_error ("Could not find required dynamic token 0x%08x", token);
+               else {
+                       mono_error_set_execution_engine (error, "Could not find dynamic token 0x%08x", token);
+                       return NULL;
+               }
+       }
+
+       if (!handle_class)
+               handle_class = &klass;
+       gpointer result = mono_reflection_resolve_object (image, obj, handle_class, context, error);
+       return result;
+}
+
+/*
+ * mono_image_register_token:
+ *
+ *   Register the TOKEN->OBJ mapping in the mapping table in ASSEMBLY. This is required for
+ * the Module.ResolveXXXToken () methods to work.
+ */
+void
+mono_image_register_token (MonoDynamicImage *assembly, guint32 token, MonoObject *obj)
+{
+       MonoObject *prev;
+
+       dynamic_image_lock (assembly);
+       prev = (MonoObject *)mono_g_hash_table_lookup (assembly->tokens, GUINT_TO_POINTER (token));
+       if (prev) {
+               /* There could be multiple MethodInfo objects with the same token */
+               //g_assert (prev == obj);
+       } else {
+               mono_g_hash_table_insert (assembly->tokens, GUINT_TO_POINTER (token), obj);
+       }
+       dynamic_image_unlock (assembly);
+}
+
+#else /* DISABLE_REFLECTION_EMIT */
+
+gpointer
+mono_reflection_lookup_dynamic_token (MonoImage *image, guint32 token, gboolean valid_token, MonoClass **handle_class, MonoGenericContext *context, MonoError *error)
+{
+       mono_error_init (error);
+       return NULL;
+}
+
+void
+mono_image_register_token (MonoDynamicImage *assembly, guint32 token, MonoObject *obj)
+{
+}
+
+#endif /* DISABLE_REFLECTION_EMIT */
+
+#ifndef DISABLE_REFLECTION_EMIT
+MonoDynamicImage*
+mono_dynamic_image_create (MonoDynamicAssembly *assembly, char *assembly_name, char *module_name)
+{
+       static const guchar entrycode [16] = {0xff, 0x25, 0};
+       MonoDynamicImage *image;
+       int i;
+
+       const char *version;
+
+       if (!strcmp (mono_get_runtime_info ()->framework_version, "2.1"))
+               version = "v2.0.50727"; /* HACK: SL 2 enforces the .net 2 metadata version */
+       else
+               version = mono_get_runtime_info ()->runtime_version;
+
+#if HAVE_BOEHM_GC
+       /* The MonoGHashTable's need GC tracking */
+       image = (MonoDynamicImage *)GC_MALLOC (sizeof (MonoDynamicImage));
+#else
+       image = g_new0 (MonoDynamicImage, 1);
+#endif
+
+       mono_profiler_module_event (&image->image, MONO_PROFILE_START_LOAD);
+       
+       /*g_print ("created image %p\n", image);*/
+       /* keep in sync with image.c */
+       image->image.name = assembly_name;
+       image->image.assembly_name = image->image.name; /* they may be different */
+       image->image.module_name = module_name;
+       image->image.version = g_strdup (version);
+       image->image.md_version_major = 1;
+       image->image.md_version_minor = 1;
+       image->image.dynamic = TRUE;
+
+       image->image.references = g_new0 (MonoAssembly*, 1);
+       image->image.references [0] = NULL;
+
+       mono_image_init (&image->image);
+
+       image->token_fixups = mono_g_hash_table_new_type ((GHashFunc)mono_object_hash, NULL, MONO_HASH_KEY_GC, MONO_ROOT_SOURCE_REFLECTION, "dynamic module token fixups table");
+       image->method_to_table_idx = g_hash_table_new (NULL, NULL);
+       image->field_to_table_idx = g_hash_table_new (NULL, NULL);
+       image->method_aux_hash = g_hash_table_new (NULL, NULL);
+       image->vararg_aux_hash = g_hash_table_new (NULL, NULL);
+       image->handleref = g_hash_table_new (NULL, NULL);
+       image->handleref_managed = mono_g_hash_table_new_type ((GHashFunc)mono_object_hash, NULL, MONO_HASH_KEY_GC, MONO_ROOT_SOURCE_REFLECTION, "dynamic module reference-to-token table");
+       image->tokens = mono_g_hash_table_new_type (NULL, NULL, MONO_HASH_VALUE_GC, MONO_ROOT_SOURCE_REFLECTION, "dynamic module tokens table");
+       image->generic_def_objects = mono_g_hash_table_new_type (NULL, NULL, MONO_HASH_VALUE_GC, MONO_ROOT_SOURCE_REFLECTION, "dynamic module generic definitions table");
+       image->typespec = g_hash_table_new ((GHashFunc)mono_metadata_type_hash, (GCompareFunc)mono_metadata_type_equal);
+       image->typeref = g_hash_table_new ((GHashFunc)mono_metadata_type_hash, (GCompareFunc)mono_metadata_type_equal);
+       image->blob_cache = g_hash_table_new ((GHashFunc)mono_blob_entry_hash, (GCompareFunc)mono_blob_entry_equal);
+       image->gen_params = g_ptr_array_new ();
+       image->remapped_tokens = mono_g_hash_table_new_type (NULL, NULL, MONO_HASH_VALUE_GC, MONO_ROOT_SOURCE_REFLECTION, "dynamic module remapped tokens table");
+
+       /*g_print ("string heap create for image %p (%s)\n", image, module_name);*/
+       string_heap_init (&image->sheap);
+       mono_dynstream_add_data (&image->us, "", 1);
+       mono_dynamic_image_add_to_blob_cached (image, (char*) "", 1, NULL, 0);
+       /* import tables... */
+       mono_dynstream_add_data (&image->code, (char*)entrycode, sizeof (entrycode));
+       image->iat_offset = mono_dynstream_add_zero (&image->code, 8); /* two IAT entries */
+       image->idt_offset = mono_dynstream_add_zero (&image->code, 2 * sizeof (MonoIDT)); /* two IDT entries */
+       image->imp_names_offset = mono_dynstream_add_zero (&image->code, 2); /* flags for name entry */
+       mono_dynstream_add_data (&image->code, "_CorExeMain", 12);
+       mono_dynstream_add_data (&image->code, "mscoree.dll", 12);
+       image->ilt_offset = mono_dynstream_add_zero (&image->code, 8); /* two ILT entries */
+       mono_dynstream_data_align (&image->code);
+
+       image->cli_header_offset = mono_dynstream_add_zero (&image->code, sizeof (MonoCLIHeader));
+
+       for (i=0; i < MONO_TABLE_NUM; ++i) {
+               image->tables [i].next_idx = 1;
+               image->tables [i].columns = table_sizes [i];
+       }
+
+       image->image.assembly = (MonoAssembly*)assembly;
+       image->run = assembly->run;
+       image->save = assembly->save;
+       image->pe_kind = 0x1; /* ILOnly */
+       image->machine = 0x14c; /* I386 */
+       
+       mono_profiler_module_loaded (&image->image, MONO_PROFILE_OK);
+
+       dynamic_images_lock ();
+
+       if (!dynamic_images)
+               dynamic_images = g_ptr_array_new ();
+
+       g_ptr_array_add (dynamic_images, image);
+
+       dynamic_images_unlock ();
+
+       return image;
+}
+#else /* DISABLE_REFLECTION_EMIT */
+MonoDynamicImage*
+mono_dynamic_image_create (MonoDynamicAssembly *assembly, char *assembly_name, char *module_name)
+{
+       g_assert_not_reached ();
+       return NULL;
+}
+#endif /* DISABLE_REFLECTION_EMIT */
+
+guint32
+mono_dynamic_image_add_to_blob_cached (MonoDynamicImage *assembly, char *b1, int s1, char *b2, int s2)
+{
+       MONO_REQ_GC_NEUTRAL_MODE;
+
+       guint32 idx;
+       char *copy;
+       gpointer oldkey, oldval;
+
+       copy = (char *)g_malloc (s1+s2);
+       memcpy (copy, b1, s1);
+       memcpy (copy + s1, b2, s2);
+       if (g_hash_table_lookup_extended (assembly->blob_cache, copy, &oldkey, &oldval)) {
+               g_free (copy);
+               idx = GPOINTER_TO_UINT (oldval);
+       } else {
+               idx = mono_dynstream_add_data (&assembly->blob, b1, s1);
+               mono_dynstream_add_data (&assembly->blob, b2, s2);
+               g_hash_table_insert (assembly->blob_cache, copy, GUINT_TO_POINTER (idx));
+       }
+       return idx;
+}
+
+void
+mono_dynimage_alloc_table (MonoDynamicTable *table, guint nrows)
+{
+       MONO_REQ_GC_NEUTRAL_MODE;
+
+       table->rows = nrows;
+       g_assert (table->columns);
+       if (nrows + 1 >= table->alloc_rows) {
+               while (nrows + 1 >= table->alloc_rows) {
+                       if (table->alloc_rows == 0)
+                               table->alloc_rows = 16;
+                       else
+                               table->alloc_rows *= 2;
+               }
+
+               table->values = (guint32 *)g_renew (guint32, table->values, (table->alloc_rows) * table->columns);
+       }
+}
+
+
+static void
+free_blob_cache_entry (gpointer key, gpointer val, gpointer user_data)
+{
+       g_free (key);
+}
+
+static void
+release_hashtable (MonoGHashTable **hash)
+{
+       if (*hash) {
+               mono_g_hash_table_destroy (*hash);
+               *hash = NULL;
+       }
+}
+
+void
+mono_dynamic_image_release_gc_roots (MonoDynamicImage *image)
+{
+       release_hashtable (&image->token_fixups);
+       release_hashtable (&image->handleref_managed);
+       release_hashtable (&image->tokens);
+       release_hashtable (&image->remapped_tokens);
+       release_hashtable (&image->generic_def_objects);
+}
+
+// Free dynamic image pass one: Free resources but not image itself
+void
+mono_dynamic_image_free (MonoDynamicImage *image)
+{
+       MonoDynamicImage *di = image;
+       GList *list;
+       int i;
+
+       if (di->typespec)
+               g_hash_table_destroy (di->typespec);
+       if (di->typeref)
+               g_hash_table_destroy (di->typeref);
+       if (di->handleref)
+               g_hash_table_destroy (di->handleref);
+       if (di->handleref_managed)
+               mono_g_hash_table_destroy (di->handleref_managed);
+       if (di->tokens)
+               mono_g_hash_table_destroy (di->tokens);
+       if (di->remapped_tokens)
+               mono_g_hash_table_destroy (di->remapped_tokens);
+       if (di->generic_def_objects)
+               mono_g_hash_table_destroy (di->generic_def_objects);
+       if (di->blob_cache) {
+               g_hash_table_foreach (di->blob_cache, free_blob_cache_entry, NULL);
+               g_hash_table_destroy (di->blob_cache);
+       }
+       if (di->standalonesig_cache)
+               g_hash_table_destroy (di->standalonesig_cache);
+       for (list = di->array_methods; list; list = list->next) {
+               ArrayMethod *am = (ArrayMethod *)list->data;
+               mono_sre_array_method_free (am);
+       }
+       g_list_free (di->array_methods);
+       if (di->gen_params) {
+               for (i = 0; i < di->gen_params->len; i++) {
+                       GenericParamTableEntry *entry = (GenericParamTableEntry *)g_ptr_array_index (di->gen_params, i);
+                       mono_sre_generic_param_table_entry_free (entry);
+               }
+               g_ptr_array_free (di->gen_params, TRUE);
+       }
+       if (di->token_fixups)
+               mono_g_hash_table_destroy (di->token_fixups);
+       if (di->method_to_table_idx)
+               g_hash_table_destroy (di->method_to_table_idx);
+       if (di->field_to_table_idx)
+               g_hash_table_destroy (di->field_to_table_idx);
+       if (di->method_aux_hash)
+               g_hash_table_destroy (di->method_aux_hash);
+       if (di->vararg_aux_hash)
+               g_hash_table_destroy (di->vararg_aux_hash);
+       g_free (di->strong_name);
+       g_free (di->win32_res);
+       if (di->public_key)
+               g_free (di->public_key);
+
+       /*g_print ("string heap destroy for image %p\n", di);*/
+       mono_dynamic_stream_reset (&di->sheap);
+       mono_dynamic_stream_reset (&di->code);
+       mono_dynamic_stream_reset (&di->resources);
+       mono_dynamic_stream_reset (&di->us);
+       mono_dynamic_stream_reset (&di->blob);
+       mono_dynamic_stream_reset (&di->tstream);
+       mono_dynamic_stream_reset (&di->guid);
+       for (i = 0; i < MONO_TABLE_NUM; ++i) {
+               g_free (di->tables [i].values);
+       }
+
+       dynamic_images_lock ();
+
+       if (dynamic_images)
+               g_ptr_array_remove (dynamic_images, di);
+
+       dynamic_images_unlock ();
+}
+
+// Free dynamic image pass two: Free image itself (might never get called in some debug modes)
+void
+mono_dynamic_image_free_image (MonoDynamicImage *image)
+{
+       /* See create_dynamic_mono_image () */
+#if HAVE_BOEHM_GC
+       /* Allocated using GC_MALLOC */
+#else
+       g_free (image);
+#endif
+}
diff --git a/mono/metadata/dynamic-stream-internals.h b/mono/metadata/dynamic-stream-internals.h
new file mode 100644 (file)
index 0000000..454f350
--- /dev/null
@@ -0,0 +1,30 @@
+/* 
+ * Copyright 2016 Microsoft
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
+ */
+#ifndef __MONO_METADATA_DYNAMIC_STREAM_INTERNALS_H__
+#define __MONO_METADATA_DYNAMIC_STREAM_INTERNALS_H__
+
+#include <mono/metadata/object.h>
+#include <mono/metadata/metadata-internals.h>
+
+void
+mono_dynstream_init (MonoDynamicStream *stream);
+
+guint32
+mono_dynstream_insert_string (MonoDynamicStream *sh, const char *str);
+
+guint32
+mono_dynstream_insert_mstring (MonoDynamicStream *sh, MonoString *str, MonoError *error);
+
+guint32
+mono_dynstream_add_data (MonoDynamicStream *stream, const char *data, guint32 len);
+
+guint32
+mono_dynstream_add_zero (MonoDynamicStream *stream, guint32 len);
+
+void
+mono_dynstream_data_align (MonoDynamicStream *stream);
+
+#endif  /* __MONO_METADATA_DYNAMIC_STREAM_INTERNALS_H__ */
+
diff --git a/mono/metadata/dynamic-stream.c b/mono/metadata/dynamic-stream.c
new file mode 100644 (file)
index 0000000..6cf6370
--- /dev/null
@@ -0,0 +1,131 @@
+/*
+ * dynamic-stream.c: MonoDynamicStream
+ * Copyright 2016 Microsoft
+ *
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
+ */
+
+#include <config.h>
+#include <glib.h>
+
+#include "mono/metadata/dynamic-stream-internals.h"
+#include "mono/metadata/metadata-internals.h"
+#include "mono/utils/checked-build.h"
+#include "mono/utils/mono-error-internals.h"
+
+void
+mono_dynstream_init (MonoDynamicStream *sh)
+{
+       MONO_REQ_GC_NEUTRAL_MODE;
+
+       sh->index = 0;
+       sh->alloc_size = 4096;
+       sh->data = (char *)g_malloc (4096);
+       sh->hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
+       mono_dynstream_insert_string (sh, "");
+}
+
+static void
+make_room_in_stream (MonoDynamicStream *stream, int size)
+{
+       MONO_REQ_GC_NEUTRAL_MODE;
+
+       if (size <= stream->alloc_size)
+               return;
+       
+       while (stream->alloc_size <= size) {
+               if (stream->alloc_size < 4096)
+                       stream->alloc_size = 4096;
+               else
+                       stream->alloc_size *= 2;
+       }
+       
+       stream->data = (char *)g_realloc (stream->data, stream->alloc_size);
+}
+
+guint32
+mono_dynstream_insert_string (MonoDynamicStream *sh, const char *str)
+{
+       MONO_REQ_GC_NEUTRAL_MODE;
+
+       guint32 idx;
+       guint32 len;
+       gpointer oldkey, oldval;
+
+       if (g_hash_table_lookup_extended (sh->hash, str, &oldkey, &oldval))
+               return GPOINTER_TO_UINT (oldval);
+
+       len = strlen (str) + 1;
+       idx = sh->index;
+       
+       make_room_in_stream (sh, idx + len);
+
+       /*
+        * We strdup the string even if we already copy them in sh->data
+        * so that the string pointers in the hash remain valid even if
+        * we need to realloc sh->data. We may want to avoid that later.
+        */
+       g_hash_table_insert (sh->hash, g_strdup (str), GUINT_TO_POINTER (idx));
+       memcpy (sh->data + idx, str, len);
+       sh->index += len;
+       return idx;
+}
+
+guint32
+mono_dynstream_insert_mstring (MonoDynamicStream *sh, MonoString *str, MonoError *error)
+{
+       MONO_REQ_GC_UNSAFE_MODE;
+
+       mono_error_init (error);
+       char *name = mono_string_to_utf8_checked (str, error);
+       return_val_if_nok (error, -1);
+       guint32 idx;
+       idx = mono_dynstream_insert_string (sh, name);
+       g_free (name);
+       return idx;
+}
+
+guint32
+mono_dynstream_add_data (MonoDynamicStream *stream, const char *data, guint32 len)
+{
+       MONO_REQ_GC_NEUTRAL_MODE;
+
+       guint32 idx;
+       
+       make_room_in_stream (stream, stream->index + len);
+       memcpy (stream->data + stream->index, data, len);
+       idx = stream->index;
+       stream->index += len;
+       /* 
+        * align index? Not without adding an additional param that controls it since
+        * we may store a blob value in pieces.
+        */
+       return idx;
+}
+
+guint32
+mono_dynstream_add_zero (MonoDynamicStream *stream, guint32 len)
+{
+       MONO_REQ_GC_NEUTRAL_MODE;
+
+       guint32 idx;
+       
+       make_room_in_stream (stream, stream->index + len);
+       memset (stream->data + stream->index, 0, len);
+       idx = stream->index;
+       stream->index += len;
+       return idx;
+}
+
+void
+mono_dynstream_data_align (MonoDynamicStream *stream)
+{
+       MONO_REQ_GC_NEUTRAL_MODE;
+
+       guint32 count = stream->index % 4;
+
+       /* we assume the stream data will be aligned */
+       if (count)
+               mono_dynstream_add_zero (stream, 4 - count);
+}
+
index e9ebcf38d384ca945bae7903c53e1658fee3691e..79454c3f38b5810ea8c2ce529c0d9e576e277b20 100644 (file)
@@ -962,25 +962,32 @@ mono_exception_get_managed_backtrace (MonoException *exc)
 }
 
 char *
-mono_exception_get_native_backtrace (MonoException *exc)
+mono_exception_handle_get_native_backtrace (MonoExceptionHandle exc)
 {
 #ifdef HAVE_BACKTRACE_SYMBOLS
        MonoDomain *domain;
-       MonoArray *arr = exc->native_trace_ips;
+       MonoArrayHandle arr = MONO_HANDLE_NEW(MonoArray, NULL);
        int i, len;
        GString *text;
        char **messages;
 
-       if (!arr)
+       MONO_HANDLE_GET (arr, exc, native_trace_ips);
+
+       if (MONO_HANDLE_IS_NULL(arr))
                return g_strdup ("");
        domain = mono_domain_get ();
-       len = mono_array_length (arr);
+       len = mono_array_handle_length (arr);
        text = g_string_new_len (NULL, len * 20);
-       messages = backtrace_symbols (mono_array_addr (arr, gpointer, 0), len);
-
+       uint32_t gchandle;
+       void *addr = MONO_ARRAY_HANDLE_PIN (arr, gpointer, 0, &gchandle);
+       MONO_ENTER_GC_SAFE;
+       messages = backtrace_symbols (addr, len);
+       MONO_EXIT_GC_SAFE;
+       mono_gchandle_free (gchandle);
 
        for (i = 0; i < len; ++i) {
-               gpointer ip = mono_array_get (arr, gpointer, i);
+               gpointer ip;
+               MONO_HANDLE_ARRAY_GETVAL (ip, arr, gpointer, i);
                MonoJitInfo *ji = mono_jit_info_table_find (mono_domain_get (), (char *)ip);
                if (ji) {
                        char *msg = mono_debug_print_stack_frame (mono_jit_info_get_method (ji), (char*)ip - (char*)ji->code_start, domain);
@@ -991,25 +998,27 @@ mono_exception_get_native_backtrace (MonoException *exc)
                }
        }
 
-       free (messages);
+       g_free (messages);
        return g_string_free (text, FALSE);
 #else
        return g_strdup ("");
 #endif
 }
 
-MonoString *
-ves_icall_Mono_Runtime_GetNativeStackTrace (MonoException *exc)
+MonoStringHandle
+ves_icall_Mono_Runtime_GetNativeStackTrace (MonoExceptionHandle exc, MonoError *error)
 {
        char *trace;
-       MonoString *res;
+       MonoStringHandle res;
+       mono_error_init (error);
+
        if (!exc) {
-               mono_set_pending_exception (mono_get_exception_argument_null ("exception"));
-               return NULL;
+               mono_error_set_argument_null (error, "exception", "");
+               return NULL_HANDLE_STRING;
        }
 
-       trace = mono_exception_get_native_backtrace (exc);
-       res = mono_string_new (mono_domain_get (), trace);
+       trace = mono_exception_handle_get_native_backtrace (exc);
+       res = mono_string_new_handle (mono_domain_get (), trace, error);
        g_free (trace);
        return res;
 }
@@ -1076,10 +1085,10 @@ mono_invoke_unhandled_exception_hook (MonoObject *exc)
                
                if (str && is_ok (&inner_error)) {
                        msg = mono_string_to_utf8_checked (str, &inner_error);
-               }
-               if (!is_ok (&inner_error)) {
-                       msg = g_strdup_printf ("Nested exception while formatting original exception");
-                       mono_error_cleanup (&inner_error);
+                       if (!is_ok (&inner_error)) {
+                               msg = g_strdup_printf ("Nested exception while formatting original exception");
+                               mono_error_cleanup (&inner_error);
+                       }
                } else if (other) {
                        char *original_backtrace = mono_exception_get_managed_backtrace ((MonoException*)exc);
                        char *nested_backtrace = mono_exception_get_managed_backtrace ((MonoException*)other);
diff --git a/mono/metadata/file-io-internals.h b/mono/metadata/file-io-internals.h
new file mode 100644 (file)
index 0000000..ad45529
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2016 Microsoft
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
+ */
+#ifndef __MONO_FILE_IO_INTERNALS_H__
+#define __MONO_FILE_IO_INTERNALS_H__
+
+#include <config.h>
+#include <glib.h>
+#include "mono/metadata/object.h"
+#include "mono/metadata/object-internals.h"
+
+gboolean
+mono_file_io_move_file (gunichar2 *path, gunichar2 *dest, gint32 *error);
+
+gboolean
+mono_file_io_copy_file (gunichar2 *path, gunichar2 *dest, gboolean overwrite, gint32 *error);
+
+gint64
+mono_file_io_get_file_size (HANDLE handle, gint32 *error);
+
+gboolean
+mono_file_io_lock_file (HANDLE handle, gint64 position, gint64 length, gint32 *error);
+
+gboolean
+mono_file_io_replace_file (gunichar2 *destinationFileName, gunichar2 *sourceFileName,
+                          gunichar2 *destinationBackupFileName, guint32 flags, gint32 *error);
+
+gboolean
+mono_file_io_unlock_file (HANDLE handle, gint64 position, gint64 length, gint32 *error);
+
+HANDLE
+mono_file_io_get_console_output (void);
+
+HANDLE
+mono_file_io_get_console_error (void);
+
+HANDLE
+mono_file_io_get_console_input (void);
+
+#endif /* __MONO_FILE_IO_INTERNALS_H__ */
diff --git a/mono/metadata/file-io-windows-internals.h b/mono/metadata/file-io-windows-internals.h
new file mode 100644 (file)
index 0000000..df372e8
--- /dev/null
@@ -0,0 +1,15 @@
+/*
+ * Copyright 2016 Microsoft
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
+ */
+#ifndef _MONO_METADATA_FILEIO_WINDOWS_H_
+#define _MONO_METADATA_FILEIO_WINDOWS_H_
+
+#include <config.h>
+#include <glib.h>
+
+#ifdef HOST_WIN32
+#include "mono/metadata/file-io.h"
+#include "mono/metadata/file-io-internals.h"
+#endif /* HOST_WIN32 */
+#endif /* _MONO_METADATA_FILEIO_WINDOWS_H_ */
diff --git a/mono/metadata/file-io-windows-uwp.c b/mono/metadata/file-io-windows-uwp.c
new file mode 100644 (file)
index 0000000..3af6c05
--- /dev/null
@@ -0,0 +1,167 @@
+/*
+ * file-io-windows-uwp.c: UWP file-io support for Mono.
+ *
+ * Copyright 2016 Microsoft
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
+*/
+#include <config.h>
+#include <glib.h>
+#include "mono/utils/mono-compiler.h"
+
+#if G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT)
+#include <windows.h>
+#include "mono/metadata/file-io-windows-internals.h"
+
+gboolean
+mono_file_io_move_file (gunichar2 *path, gunichar2 *dest, gint32 *error)
+{
+       gboolean result = FALSE;
+       MONO_ENTER_GC_SAFE;
+
+       result = MoveFileEx (path, dest, MOVEFILE_COPY_ALLOWED);
+       if (result == FALSE) {
+               *error=GetLastError ();
+       }
+
+       MONO_EXIT_GC_SAFE;
+       return result;
+}
+
+gboolean
+mono_file_io_replace_file (gunichar2 *destinationFileName, gunichar2 *sourceFileName,
+                          gunichar2 *destinationBackupFileName, guint32 flags, gint32 *error)
+{
+       gboolean result = FALSE;
+       MONO_ENTER_GC_SAFE;
+
+       result = ReplaceFile (destinationFileName, sourceFileName, destinationBackupFileName, flags, NULL, NULL);
+       if (result == FALSE) {
+               *error=GetLastError ();
+       }
+
+       MONO_EXIT_GC_SAFE;
+       return result;
+}
+
+gboolean
+mono_file_io_copy_file (gunichar2 *path, gunichar2 *dest, gboolean overwrite, gint32 *error)
+{
+       gboolean                                                result = FALSE;
+       COPYFILE2_EXTENDED_PARAMETERS   copy_param = {0};
+
+       copy_param.dwSize = sizeof (COPYFILE2_EXTENDED_PARAMETERS);
+       copy_param.dwCopyFlags = (!overwrite) ? COPY_FILE_FAIL_IF_EXISTS : 0;
+
+       MONO_ENTER_GC_SAFE;
+
+       result = SUCCEEDED (CopyFile2 (path, dest, &copy_param));
+       if (result == FALSE) {
+               *error=GetLastError ();
+       }
+
+       MONO_EXIT_GC_SAFE;
+       return result;
+}
+
+gint64
+mono_file_io_get_file_size (HANDLE handle, gint32 *error)
+{
+       LARGE_INTEGER length;
+
+       MONO_ENTER_GC_SAFE;
+
+       if (!GetFileSizeEx (handle, &length)) {
+               *error=GetLastError ();
+               length.QuadPart = INVALID_FILE_SIZE;
+       }
+
+       MONO_EXIT_GC_SAFE;
+       return length.QuadPart;
+}
+
+gboolean
+mono_file_io_lock_file (HANDLE handle, gint64 position, gint64 length, gint32 *error)
+{
+       gboolean result = FALSE;
+       MONO_ENTER_GC_SAFE;
+
+       result = LockFile (handle, position & 0xFFFFFFFF, position >> 32,
+                          length & 0xFFFFFFFF, length >> 32);
+
+       if (result == FALSE) {
+               *error = GetLastError ();
+       }
+
+       MONO_EXIT_GC_SAFE;
+       return result;
+}
+
+gboolean
+mono_file_io_unlock_file (HANDLE handle, gint64 position, gint64 length, gint32 *error)
+{
+       gboolean result = FALSE;
+       MONO_ENTER_GC_SAFE;
+
+       result = UnlockFile (handle, position & 0xFFFFFFFF, position >> 32,
+                            length & 0xFFFFFFFF, length >> 32);
+
+       if (result == FALSE) {
+               *error = GetLastError ();
+       }
+
+       MONO_EXIT_GC_SAFE;
+       return result;
+}
+
+HANDLE
+mono_file_io_get_console_output (void)
+{
+       MonoError mono_error;
+       mono_error_init (&mono_error);
+
+       g_unsupported_api ("GetStdHandle (STD_OUTPUT_HANDLE)");
+
+       mono_error_set_not_supported (&mono_error, G_UNSUPPORTED_API, "GetStdHandle (STD_OUTPUT_HANDLE)");
+       mono_error_set_pending_exception (&mono_error);
+
+       SetLastError (ERROR_NOT_SUPPORTED);
+
+       return INVALID_HANDLE_VALUE;
+}
+
+HANDLE
+mono_file_io_get_console_input (void)
+{
+       MonoError mono_error;
+       mono_error_init (&mono_error);
+
+       g_unsupported_api ("GetStdHandle (STD_INPUT_HANDLE)");
+
+       mono_error_set_not_supported (&mono_error, G_UNSUPPORTED_API, "GetStdHandle (STD_INPUT_HANDLE)");
+       mono_error_set_pending_exception (&mono_error);
+
+       SetLastError (ERROR_NOT_SUPPORTED);
+
+       return INVALID_HANDLE_VALUE;
+}
+
+HANDLE
+mono_file_io_get_console_error (void)
+{
+       MonoError mono_error;
+       mono_error_init (&mono_error);
+
+       g_unsupported_api ("GetStdHandle (STD_ERROR_HANDLE)");
+
+       mono_error_set_not_supported (&mono_error, G_UNSUPPORTED_API, "GetStdHandle (STD_ERROR_HANDLE)");
+       mono_error_set_pending_exception (&mono_error);
+
+       SetLastError (ERROR_NOT_SUPPORTED);
+
+       return INVALID_HANDLE_VALUE;
+}
+
+#else /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
+
+MONO_EMPTY_SOURCE_FILE (file_io_windows_uwp);
+#endif /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
diff --git a/mono/metadata/file-io-windows.c b/mono/metadata/file-io-windows.c
new file mode 100644 (file)
index 0000000..e7dd111
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * file-io-windows.c: Windows File IO internal calls.
+ *
+ * Copyright 2016 Microsoft
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
+ */
+#include <config.h>
+#include <glib.h>
+
+#if defined(HOST_WIN32)
+#include <winsock2.h>
+#include <windows.h>
+#include "mono/metadata/file-io-windows-internals.h"
+
+gunichar2
+ves_icall_System_IO_MonoIO_get_VolumeSeparatorChar ()
+{
+       return (gunichar2) ':'; /* colon */
+}
+
+gunichar2
+ves_icall_System_IO_MonoIO_get_DirectorySeparatorChar ()
+{
+       return (gunichar2) '\\';        /* backslash */
+}
+
+gunichar2
+ves_icall_System_IO_MonoIO_get_AltDirectorySeparatorChar ()
+{
+       return (gunichar2) '/'; /* forward slash */
+}
+
+gunichar2
+ves_icall_System_IO_MonoIO_get_PathSeparator ()
+{
+       return (gunichar2) ';'; /* semicolon */
+}
+
+void ves_icall_System_IO_MonoIO_DumpHandles (void)
+{
+       return;
+}
+#endif /* HOST_WIN32 */
index 9315bdf828fed4df658bc31e68eab9fda9c95f93..0b001db668921cde759f8d3dbc434bc30aedf43f 100644 (file)
 #include <mono/metadata/object.h>
 #include <mono/io-layer/io-layer.h>
 #include <mono/metadata/file-io.h>
+#include <mono/metadata/file-io-internals.h>
 #include <mono/metadata/exception.h>
 #include <mono/metadata/appdomain.h>
 #include <mono/metadata/marshal.h>
 #include <mono/utils/strenc.h>
 #include <utils/mono-io-portability.h>
-#include <mono/utils/w32handle.h>
+#include <mono/metadata/w32handle.h>
 
 #undef DEBUG
 
@@ -489,8 +490,13 @@ ves_icall_System_IO_MonoIO_FindFirst (MonoString *path,
        ifh = g_new (IncrementalFind, 1);
        ifh->find_handle = find_handle;
        ifh->utf8_path = mono_string_to_utf8_checked (path, &error);
-       if (mono_error_set_pending_exception (&error))
+       if (mono_error_set_pending_exception (&error)) {
+               MONO_ENTER_GC_SAFE;
+               FindClose (find_handle);
+               MONO_EXIT_GC_SAFE;
+               g_free (ifh);
                return NULL;
+       }
        ifh->domain = mono_domain_get ();
        *handle = ifh;
 
@@ -601,33 +607,55 @@ ves_icall_System_IO_MonoIO_SetCurrentDirectory (MonoString *path,
        return(ret);
 }
 
-MonoBoolean
-ves_icall_System_IO_MonoIO_MoveFile (MonoString *path, MonoString *dest,
-                                    gint32 *error)
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
+gboolean
+mono_file_io_move_file (gunichar2 *path, gunichar2 *dest, gint32 *error)
 {
-       gboolean ret;
+       gboolean result = FALSE;
        MONO_ENTER_GC_SAFE;
-       
+
+       result = MoveFile (path, dest);
+       if (result == FALSE) {
+               *error=GetLastError ();
+       }
+
+       MONO_EXIT_GC_SAFE;
+       return result;
+}
+#endif /* HAVE_CLASSIC_WINAPI_SUPPORT */
+
+MonoBoolean
+ves_icall_System_IO_MonoIO_MoveFile (MonoString *path, MonoString *dest, gint32 *error)
+{
        *error=ERROR_SUCCESS;
+       return mono_file_io_move_file (mono_string_chars (path), mono_string_chars (dest), error);
+}
 
-       ret=MoveFile (mono_string_chars (path), mono_string_chars (dest));
-       if(ret==FALSE) {
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
+gboolean
+mono_file_io_replace_file (gunichar2 *destinationFileName, gunichar2 *sourceFileName,
+                          gunichar2 *destinationBackupFileName, guint32 flags, gint32 *error)
+{
+       gboolean result = FALSE;
+       MONO_ENTER_GC_SAFE;
+
+       result = ReplaceFile (destinationFileName, sourceFileName, destinationBackupFileName, flags, NULL, NULL);
+       if (result == FALSE) {
                *error=GetLastError ();
        }
 
        MONO_EXIT_GC_SAFE;
-       return(ret);
+       return result;
 }
+#endif /* HAVE_CLASSIC_WINAPI_SUPPORT */
 
 MonoBoolean
 ves_icall_System_IO_MonoIO_ReplaceFile (MonoString *sourceFileName, MonoString *destinationFileName,
                                        MonoString *destinationBackupFileName, MonoBoolean ignoreMetadataErrors,
                                        gint32 *error)
 {
-       gboolean ret;
        gunichar2 *utf16_sourceFileName = NULL, *utf16_destinationFileName = NULL, *utf16_destinationBackupFileName = NULL;
        guint32 replaceFlags = REPLACEFILE_WRITE_THROUGH;
-       MONO_ENTER_GC_SAFE;
 
        if (sourceFileName)
                utf16_sourceFileName = mono_string_chars (sourceFileName);
@@ -641,31 +669,33 @@ ves_icall_System_IO_MonoIO_ReplaceFile (MonoString *sourceFileName, MonoString *
                replaceFlags |= REPLACEFILE_IGNORE_MERGE_ERRORS;
 
        /* FIXME: source and destination file names must not be NULL, but apparently they might be! */
-       ret = ReplaceFile (utf16_destinationFileName, utf16_sourceFileName, utf16_destinationBackupFileName,
-                        replaceFlags, NULL, NULL);
-       if (ret == FALSE)
-               *error = GetLastError ();
+       return mono_file_io_replace_file (utf16_destinationFileName, utf16_sourceFileName,
+                                         utf16_destinationBackupFileName, replaceFlags, error);
+}
+
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
+gboolean
+mono_file_io_copy_file (gunichar2 *path, gunichar2 *dest, gboolean overwrite, gint32 *error)
+{
+       gboolean result = FALSE;
+       MONO_ENTER_GC_SAFE;
+
+       result = CopyFile (path, dest, !overwrite);
+       if (result == FALSE) {
+               *error=GetLastError ();
+       }
 
        MONO_EXIT_GC_SAFE;
-       return ret;
+       return result;
 }
+#endif /* HAVE_CLASSIC_WINAPI_SUPPORT */
 
 MonoBoolean
 ves_icall_System_IO_MonoIO_CopyFile (MonoString *path, MonoString *dest,
                                     MonoBoolean overwrite, gint32 *error)
 {
-       gboolean ret;
-       MONO_ENTER_GC_SAFE;
-       
        *error=ERROR_SUCCESS;
-       
-       ret=CopyFile (mono_string_chars (path), mono_string_chars (dest), !overwrite);
-       if(ret==FALSE) {
-               *error=GetLastError ();
-       }
-       
-       MONO_EXIT_GC_SAFE;
-       return(ret);
+       return mono_file_io_copy_file (mono_string_chars (path), mono_string_chars (dest), overwrite, error);
 }
 
 MonoBoolean
@@ -800,10 +830,6 @@ ves_icall_System_IO_MonoIO_Open (MonoString *filename, gint32 mode,
                if (options & FileOptions_Temporary)
                        attributes |= FILE_ATTRIBUTE_TEMPORARY;
                
-               /* Not sure if we should set FILE_FLAG_OVERLAPPED, how does this mix with the "Async" bool here? */
-               if (options & FileOptions_Asynchronous)
-                       attributes |= FILE_FLAG_OVERLAPPED;
-               
                if (options & FileOptions_WriteThrough)
                        attributes |= FILE_FLAG_WRITE_THROUGH;
        } else
@@ -947,23 +973,31 @@ ves_icall_System_IO_MonoIO_Flush (HANDLE handle, gint32 *error)
        return(ret);
 }
 
-gint64 
-ves_icall_System_IO_MonoIO_GetLength (HANDLE handle, gint32 *error)
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
+gint64
+mono_file_io_get_file_size (HANDLE handle, gint32 *error)
 {
        gint64 length;
        guint32 length_hi;
+
        MONO_ENTER_GC_SAFE;
 
-       *error=ERROR_SUCCESS;
-       
        length = GetFileSize (handle, &length_hi);
        if(length==INVALID_FILE_SIZE) {
                *error=GetLastError ();
        }
-       
+
        MONO_EXIT_GC_SAFE;
        return length | ((gint64)length_hi << 32);
 }
+#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */
+
+gint64
+ves_icall_System_IO_MonoIO_GetLength (HANDLE handle, gint32 *error)
+{
+       *error=ERROR_SUCCESS;
+       return mono_file_io_get_file_size (handle, error);
+}
 
 /* FIXME make gc suspendable */
 MonoBoolean
@@ -1051,22 +1085,46 @@ ves_icall_System_IO_MonoIO_SetFileTime (HANDLE handle, gint64 creation_time,
        return(ret);
 }
 
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
+HANDLE
+mono_file_io_get_console_output (void)
+{
+       return GetStdHandle (STD_OUTPUT_HANDLE);
+}
+#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */
+
 HANDLE 
 ves_icall_System_IO_MonoIO_get_ConsoleOutput ()
 {
-       return GetStdHandle (STD_OUTPUT_HANDLE);
+       return mono_file_io_get_console_output ();
 }
 
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
+HANDLE
+mono_file_io_get_console_input (void)
+{
+       return GetStdHandle (STD_INPUT_HANDLE);
+}
+#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */
+
 HANDLE 
 ves_icall_System_IO_MonoIO_get_ConsoleInput ()
 {
-       return GetStdHandle (STD_INPUT_HANDLE);
+       return mono_file_io_get_console_input ();
 }
 
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
+HANDLE
+mono_file_io_get_console_error (void)
+{
+       return GetStdHandle (STD_ERROR_HANDLE);
+}
+#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */
+
 HANDLE 
 ves_icall_System_IO_MonoIO_get_ConsoleError ()
 {
-       return GetStdHandle (STD_ERROR_HANDLE);
+       return mono_file_io_get_console_error ();
 }
 
 MonoBoolean
@@ -1112,48 +1170,34 @@ ves_icall_System_IO_MonoIO_DuplicateHandle (HANDLE source_process_handle, HANDLE
        return(TRUE);
 }
 
+#ifndef HOST_WIN32
 gunichar2 
 ves_icall_System_IO_MonoIO_get_VolumeSeparatorChar ()
 {
-#if defined (TARGET_WIN32)
-       return (gunichar2) ':'; /* colon */
-#else
        return (gunichar2) '/'; /* forward slash */
-#endif
 }
 
 gunichar2 
 ves_icall_System_IO_MonoIO_get_DirectorySeparatorChar ()
 {
-#if defined (TARGET_WIN32)
-       return (gunichar2) '\\';        /* backslash */
-#else
        return (gunichar2) '/'; /* forward slash */
-#endif
 }
 
 gunichar2 
 ves_icall_System_IO_MonoIO_get_AltDirectorySeparatorChar ()
 {
-#if defined (TARGET_WIN32)
-       return (gunichar2) '/'; /* forward slash */
-#else
        if (IS_PORTABILITY_SET)
                return (gunichar2) '\\';        /* backslash */
        else
                return (gunichar2) '/'; /* forward slash */
-#endif
 }
 
 gunichar2 
 ves_icall_System_IO_MonoIO_get_PathSeparator ()
 {
-#if defined (TARGET_WIN32)
-       return (gunichar2) ';'; /* semicolon */
-#else
        return (gunichar2) ':'; /* colon */
-#endif
 }
+#endif /* !HOST_WIN32 */
 
 static const gunichar2
 invalid_path_chars [] = {
@@ -1196,38 +1240,56 @@ ves_icall_System_IO_MonoIO_get_InvalidPathChars ()
        return chars;
 }
 
-void ves_icall_System_IO_MonoIO_Lock (HANDLE handle, gint64 position,
-                                     gint64 length, gint32 *error)
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
+gboolean
+mono_file_io_lock_file (HANDLE handle, gint64 position, gint64 length, gint32 *error)
 {
-       gboolean ret;
+       gboolean result = FALSE;
        MONO_ENTER_GC_SAFE;
-       
-       *error=ERROR_SUCCESS;
-       
-       ret=LockFile (handle, position & 0xFFFFFFFF, position >> 32,
-                     length & 0xFFFFFFFF, length >> 32);
-       if (ret == FALSE) {
+
+       result = LockFile (handle, position & 0xFFFFFFFF, position >> 32,
+                          length & 0xFFFFFFFF, length >> 32);
+
+       if (result == FALSE) {
                *error = GetLastError ();
        }
 
        MONO_EXIT_GC_SAFE;
+       return result;
 }
+#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */
 
-void ves_icall_System_IO_MonoIO_Unlock (HANDLE handle, gint64 position,
-                                       gint64 length, gint32 *error)
+void ves_icall_System_IO_MonoIO_Lock (HANDLE handle, gint64 position,
+                                     gint64 length, gint32 *error)
 {
-       gboolean ret;
-       MONO_ENTER_GC_SAFE;
-       
        *error=ERROR_SUCCESS;
+       mono_file_io_lock_file (handle, position, length, error);
+}
+
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
+gboolean
+mono_file_io_unlock_file (HANDLE handle, gint64 position, gint64 length, gint32 *error)
+{
+       gboolean result = FALSE;
+       MONO_ENTER_GC_SAFE;
        
-       ret=UnlockFile (handle, position & 0xFFFFFFFF, position >> 32,
-                       length & 0xFFFFFFFF, length >> 32);
-       if (ret == FALSE) {
+       result = UnlockFile (handle, position & 0xFFFFFFFF, position >> 32,
+                            length & 0xFFFFFFFF, length >> 32);
+
+       if (result == FALSE) {
                *error = GetLastError ();
        }
 
        MONO_EXIT_GC_SAFE;
+       return result;
+}
+#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */
+
+void ves_icall_System_IO_MonoIO_Unlock (HANDLE handle, gint64 position,
+                                       gint64 length, gint32 *error)
+{
+       *error=ERROR_SUCCESS;
+       mono_file_io_unlock_file (handle, position, length, error);
 }
 
 //Support for io-layer free mmap'd files.
@@ -1273,11 +1335,12 @@ mono_filesize_from_fd (int fd)
 
 #endif
 
+#ifndef HOST_WIN32
 void mono_w32handle_dump (void);
 
 void ves_icall_System_IO_MonoIO_DumpHandles (void)
 {
-#ifndef HOST_WIN32
+
        mono_w32handle_dump ();
-#endif
 }
+#endif /* !HOST_WIN32 */
index 84e3b4aa68d75000fbec036787887c36f1fe8930..4b9ce74499e04ec81a5b1ad1e422615d7c44636b 100644 (file)
@@ -63,7 +63,9 @@ enum {
        COULD_NOT_OPEN,
        CAPACITY_MUST_BE_POSITIVE,
        INVALID_FILE_MODE,
-       COULD_NOT_MAP_MEMORY
+       COULD_NOT_MAP_MEMORY,
+       ACCESS_DENIED,
+       CAPACITY_LARGER_THAN_LOGICAL_ADDRESS_SPACE
 };
 
 enum {
@@ -300,10 +302,16 @@ static void*
 open_memory_map (const char *c_mapName, int mode, gint64 *capacity, int access, int options, int *ioerror)
 {
        MmapHandle *handle;
-       if (*capacity <= 1) {
+       if (*capacity <= 0) {
                *ioerror = CAPACITY_MUST_BE_POSITIVE;
                return NULL;
        }
+#if SIZEOF_VOID_P == 4
+       if (*capacity > UINT32_MAX) {
+               *ioerror = CAPACITY_LARGER_THAN_LOGICAL_ADDRESS_SPACE;
+               return NULL;
+       }
+#endif
 
        if (!(mode == FILE_MODE_CREATE_NEW || mode == FILE_MODE_OPEN_OR_CREATE || mode == FILE_MODE_OPEN)) {
                *ioerror = INVALID_FILE_MODE;
@@ -499,8 +507,11 @@ mono_mmap_map (void *handle, gint64 offset, gint64 *size, int access, void **mma
        struct stat buf = { 0 };
        fstat (fh->fd, &buf); //FIXME error handling
 
+       *mmap_handle = NULL;
+       *base_address = NULL;
+
        if (offset > buf.st_size || ((eff_size + offset) > buf.st_size && !is_special_zero_size_file (&buf)))
-               goto error;
+               return ACCESS_DENIED;
        /**
          * We use the file size if one of the following conditions is true:
          *  -input size is zero
@@ -522,9 +533,6 @@ mono_mmap_map (void *handle, gint64 offset, gint64 *size, int access, void **mma
                return 0;
        }
 
-error:
-       *mmap_handle = NULL;
-       *base_address = NULL;
        return COULD_NOT_MAP_MEMORY;
 }
 
index dba37472c34741355a3f5e1e954f4c54a86801ad..3cc9124c0854ccf6626e244329df27bd8c5e90ae 100644 (file)
 /*
- * file-mmap-posix.c: File mmap internal calls
+ * file-mmap-windows.c: MemoryMappedFile internal calls for Windows
  *
- * Author:
- *     Rodrigo Kumpera
- *
- * Copyright 2014 Xamarin Inc (http://www.xamarin.com)
+ * Copyright 2016 Microsoft
  * Licensed under the MIT license. See LICENSE file in the project root for full license information.
  */
 
-#include <config.h>
-
-#ifdef HOST_WIN32
+/*
+ * The code in this file has been inspired by the CoreFX MemoryMappedFile Windows implementation contained in the files
+ *
+ * https://github.com/dotnet/corefx/blob/master/src/System.IO.MemoryMappedFiles/src/System/IO/MemoryMappedFiles/MemoryMappedFile.Windows.cs
+ * https://github.com/dotnet/corefx/blob/master/src/System.IO.MemoryMappedFiles/src/System/IO/MemoryMappedFiles/MemoryMappedView.Windows.cs
+ */
 
+#include <config.h>
 #include <glib.h>
-#include <string.h>
-#include <errno.h>
+#include <mono/utils/mono-compiler.h>
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) && defined(HOST_WIN32)
 
+#include <glib.h>
 
-#include <mono/metadata/object.h>
 #include <mono/metadata/file-mmap.h>
 
-void *
-mono_mmap_open_file (MonoString *path, int mode, MonoString *mapName, gint64 *capacity, int access, int options, int *error)
+// These control the retry behaviour when lock violation errors occur during Flush:
+#define MAX_FLUSH_WAITS 15  // must be <=30
+#define MAX_FLUSH_RETIRES_PER_WAIT 20
+
+typedef struct {
+       void *address;
+       size_t length;
+} MmapInstance;
+
+enum {
+       BAD_CAPACITY_FOR_FILE_BACKED = 1,
+       CAPACITY_SMALLER_THAN_FILE_SIZE,
+       FILE_NOT_FOUND,
+       FILE_ALREADY_EXISTS,
+       PATH_TOO_LONG,
+       COULD_NOT_OPEN,
+       CAPACITY_MUST_BE_POSITIVE,
+       INVALID_FILE_MODE,
+       COULD_NOT_MAP_MEMORY,
+       ACCESS_DENIED,
+       CAPACITY_LARGER_THAN_LOGICAL_ADDRESS_SPACE
+};
+
+enum {
+       FILE_MODE_CREATE_NEW = 1,
+       FILE_MODE_CREATE = 2,
+       FILE_MODE_OPEN = 3,
+       FILE_MODE_OPEN_OR_CREATE = 4,
+       FILE_MODE_TRUNCATE = 5,
+       FILE_MODE_APPEND = 6,
+};
+
+enum {
+       MMAP_FILE_ACCESS_READ_WRITE = 0,
+       MMAP_FILE_ACCESS_READ = 1,
+       MMAP_FILE_ACCESS_WRITE = 2,
+       MMAP_FILE_ACCESS_COPY_ON_WRITE = 3,
+       MMAP_FILE_ACCESS_READ_EXECUTE = 4,
+       MMAP_FILE_ACCESS_READ_WRITE_EXECUTE = 5,
+};
+
+static DWORD get_page_access (int access)
 {
-       g_error ("No windows backend");
-       return NULL;
+       switch (access) {
+       case MMAP_FILE_ACCESS_READ:
+               return PAGE_READONLY;
+       case MMAP_FILE_ACCESS_READ_WRITE:
+               return PAGE_READWRITE;
+       case MMAP_FILE_ACCESS_COPY_ON_WRITE:
+               return PAGE_WRITECOPY;
+       case MMAP_FILE_ACCESS_READ_EXECUTE:
+               return PAGE_EXECUTE_READ;
+       case MMAP_FILE_ACCESS_READ_WRITE_EXECUTE:
+               return PAGE_EXECUTE_READWRITE;
+       default:
+               g_error ("unknown MemoryMappedFileAccess %d", access);
+       }
 }
 
-void *
-mono_mmap_open_handle (void *handle, MonoString *mapName, gint64 *capacity, int access, int options, int *error)
+static DWORD get_file_access (int access)
 {
-       g_error ("No windows backend");
-       return NULL;
+       switch (access) {
+       case MMAP_FILE_ACCESS_READ:
+       case MMAP_FILE_ACCESS_READ_EXECUTE:
+               return GENERIC_READ;
+       case MMAP_FILE_ACCESS_READ_WRITE:
+       case MMAP_FILE_ACCESS_COPY_ON_WRITE:
+       case MMAP_FILE_ACCESS_READ_WRITE_EXECUTE:
+               return GENERIC_READ | GENERIC_WRITE;
+       case MMAP_FILE_ACCESS_WRITE:
+               return GENERIC_WRITE;
+       default:
+               g_error ("unknown MemoryMappedFileAccess %d", access);
+       }
 }
 
-void
-mono_mmap_close (void *mmap_handle)
+static int get_file_map_access (int access)
 {
-       g_error ("No windows backend");
+       switch (access) {
+       case MMAP_FILE_ACCESS_READ:
+               return FILE_MAP_READ;
+       case MMAP_FILE_ACCESS_WRITE:
+               return FILE_MAP_WRITE;
+       case MMAP_FILE_ACCESS_READ_WRITE:
+               return FILE_MAP_READ | FILE_MAP_WRITE;
+       case MMAP_FILE_ACCESS_COPY_ON_WRITE:
+               return FILE_MAP_COPY;
+       case MMAP_FILE_ACCESS_READ_EXECUTE:
+               return FILE_MAP_EXECUTE | FILE_MAP_READ;
+       case MMAP_FILE_ACCESS_READ_WRITE_EXECUTE:
+               return FILE_MAP_EXECUTE | FILE_MAP_READ | FILE_MAP_WRITE;
+       default:
+               g_error ("unknown MemoryMappedFileAccess %d", access);
+       }
 }
 
-void
-mono_mmap_configure_inheritability (void *mmap_handle, gboolean inheritability)
+static int convert_win32_error (int error, int def)
 {
-       g_error ("No windows backend");
+       switch (error) {
+       case ERROR_FILE_NOT_FOUND:
+               return FILE_NOT_FOUND;
+       case ERROR_FILE_EXISTS:
+       case ERROR_ALREADY_EXISTS:
+               return FILE_ALREADY_EXISTS;
+       case ERROR_ACCESS_DENIED:
+               return ACCESS_DENIED;
+       }
+       return def;
 }
 
-void
-mono_mmap_flush (void *mmap_handle)
+static void *open_handle (void *handle, MonoString *mapName, int mode, gint64 *capacity, int access, int options, int *error)
 {
-       g_error ("No windows backend");
+       g_assert (handle != NULL);
+
+       wchar_t *w_mapName = NULL;
+       HANDLE result = NULL;
+
+       if (handle == INVALID_HANDLE_VALUE) {
+               if (*capacity <= 0) {
+                       *error = CAPACITY_MUST_BE_POSITIVE;
+                       return NULL;
+               }
+#if SIZEOF_VOID_P == 4
+               if (*capacity > UINT32_MAX) {
+                       *error = CAPACITY_LARGER_THAN_LOGICAL_ADDRESS_SPACE;
+                       return NULL;
+               }
+#endif
+               if (!(mode == FILE_MODE_CREATE_NEW || mode == FILE_MODE_OPEN_OR_CREATE || mode == FILE_MODE_OPEN)) {
+                       *error = INVALID_FILE_MODE;
+                       return NULL;
+               }
+       } else {
+               FILE_STANDARD_INFO info;
+               if (!GetFileInformationByHandleEx ((HANDLE) handle, FileStandardInfo, &info, sizeof (FILE_STANDARD_INFO))) {
+                       *error = convert_win32_error (GetLastError (), COULD_NOT_OPEN);
+                       return NULL;
+               }
+               if (*capacity == 0) {
+                       if (info.EndOfFile.QuadPart == 0) {
+                               *error = CAPACITY_SMALLER_THAN_FILE_SIZE;
+                               return NULL;
+                       }
+               } else if (*capacity < info.EndOfFile.QuadPart) {
+                       *error = CAPACITY_SMALLER_THAN_FILE_SIZE;
+                       return NULL;
+               }
+       }
+
+       w_mapName = mapName ? mono_string_to_utf16 (mapName) : NULL;
+
+       if (mode == FILE_MODE_CREATE_NEW || handle != INVALID_HANDLE_VALUE) {
+               result = CreateFileMappingW ((HANDLE)handle, NULL, get_page_access (access) | options, (DWORD)(((guint64)*capacity) >> 32), (DWORD)*capacity, w_mapName);
+               if (result && GetLastError () == ERROR_ALREADY_EXISTS) {
+                       CloseHandle (result);
+                       result = NULL;
+                       *error = FILE_ALREADY_EXISTS;
+               } else if (!result && GetLastError () != NO_ERROR) {
+                       *error = convert_win32_error (GetLastError (), COULD_NOT_OPEN);
+               }
+       } else if (mode == FILE_MODE_OPEN || mode == FILE_MODE_OPEN_OR_CREATE && access == MMAP_FILE_ACCESS_WRITE) {
+               result = OpenFileMappingW (get_file_map_access (access), FALSE, w_mapName);
+               if (!result) {
+                       if (mode == FILE_MODE_OPEN_OR_CREATE && GetLastError () == ERROR_FILE_NOT_FOUND) {
+                               *error = INVALID_FILE_MODE;
+                       } else {
+                               *error = convert_win32_error (GetLastError (), COULD_NOT_OPEN);
+                       }
+               }
+       } else if (mode == FILE_MODE_OPEN_OR_CREATE) {
+
+               // This replicates how CoreFX does MemoryMappedFile.CreateOrOpen ().
+
+               /// Try to open the file if it exists -- this requires a bit more work. Loop until we can
+               /// either create or open a memory mapped file up to a timeout. CreateFileMapping may fail
+               /// if the file exists and we have non-null security attributes, in which case we need to
+               /// use OpenFileMapping.  But, there exists a race condition because the memory mapped file
+               /// may have closed between the two calls -- hence the loop. 
+               /// 
+               /// The retry/timeout logic increases the wait time each pass through the loop and times 
+               /// out in approximately 1.4 minutes. If after retrying, a MMF handle still hasn't been opened, 
+               /// throw an InvalidOperationException.
+
+               guint32 waitRetries = 14;   //((2^13)-1)*10ms == approximately 1.4mins
+               guint32 waitSleep = 0;
+
+               while (waitRetries > 0) {
+                       result = CreateFileMappingW ((HANDLE)handle, NULL, get_page_access (access) | options, (DWORD)(((guint64)*capacity) >> 32), (DWORD)*capacity, w_mapName);
+                       if (result)
+                               break;
+                       if (GetLastError() != ERROR_ACCESS_DENIED) {
+                               *error = convert_win32_error (GetLastError (), COULD_NOT_OPEN);
+                               break;
+                       }
+                       result = OpenFileMappingW (get_file_map_access (access), FALSE, w_mapName);
+                       if (result)
+                               break;
+                       if (GetLastError () != ERROR_FILE_NOT_FOUND) {
+                               *error = convert_win32_error (GetLastError (), COULD_NOT_OPEN);
+                               break;
+                       }
+                       // increase wait time
+                       --waitRetries;
+                       if (waitSleep == 0) {
+                               waitSleep = 10;
+                       } else {
+                               mono_thread_info_sleep (waitSleep, NULL);
+                               waitSleep *= 2;
+                       }
+               }
+
+               if (!result) {
+                       *error = COULD_NOT_OPEN;
+               }
+       }
+
+       if (w_mapName)
+               g_free (w_mapName);
+       return result;
 }
 
+void *mono_mmap_open_file (MonoString *path, int mode, MonoString *mapName, gint64 *capacity, int access, int options, int *error)
+{
+       g_assert (path != NULL || mapName != NULL);
+
+       wchar_t *w_path = NULL;
+       HANDLE hFile = INVALID_HANDLE_VALUE;
+       HANDLE result = NULL;
+       gboolean delete_on_error = FALSE;
+
+       if (path) {
+               w_path = mono_string_to_utf16 (path);
+               WIN32_FILE_ATTRIBUTE_DATA file_attrs;
+               gboolean existed = GetFileAttributesExW (w_path, GetFileExInfoStandard, &file_attrs);
+               if (!existed && mode == FILE_MODE_CREATE_NEW && *capacity == 0) {
+                       *error = CAPACITY_SMALLER_THAN_FILE_SIZE;
+                       goto done;
+               }
+               hFile = CreateFileW (w_path, get_file_access (access), FILE_SHARE_READ, NULL, mode, FILE_ATTRIBUTE_NORMAL, NULL);
+               if (hFile == INVALID_HANDLE_VALUE) {
+                       *error = convert_win32_error (GetLastError (), COULD_NOT_OPEN);
+                       goto done;
+               }
+               delete_on_error = !existed;
+       }
+
+       result = open_handle (hFile, mapName, mode, capacity, access, options, error);
+
+done:
+       if (!result && delete_on_error)
+               DeleteFileW (w_path);
+       if (w_path)
+               g_free (w_path);
 
+       return result;
+}
 
-int
-mono_mmap_map (void *handle, gint64 offset, gint64 *size, int access, void **mmap_handle, void **base_address)
+void *mono_mmap_open_handle (void *handle, MonoString *mapName, gint64 *capacity, int access, int options, int *error)
 {
-       g_error ("No windows backend");
+       g_assert (handle != NULL);
+
+       return open_handle (handle, mapName, FILE_MODE_OPEN, capacity, access, options, error);
+}
+
+void mono_mmap_close (void *mmap_handle)
+{
+       g_assert (mmap_handle);
+       CloseHandle ((HANDLE) mmap_handle);
+}
+
+void mono_mmap_configure_inheritability (void *mmap_handle, gboolean inheritability)
+{
+       g_assert (mmap_handle);
+       if (!SetHandleInformation ((HANDLE) mmap_handle, HANDLE_FLAG_INHERIT, inheritability ? HANDLE_FLAG_INHERIT : 0)) {
+               g_error ("mono_mmap_configure_inheritability: SetHandleInformation failed with error %d!", GetLastError ());
+       }
+}
+
+void mono_mmap_flush (void *mmap_handle)
+{
+       g_assert (mmap_handle);
+       MmapInstance *h = (MmapInstance *)mmap_handle;
+
+       if (FlushViewOfFile (h->address, h->length))
+               return;
+
+       // This replicates how CoreFX does MemoryMappedView.Flush ().
+
+       // It is a known issue within the NTFS transaction log system that
+       // causes FlushViewOfFile to intermittently fail with ERROR_LOCK_VIOLATION
+       // As a workaround, we catch this particular error and retry the flush operation 
+       // a few milliseconds later. If it does not work, we give it a few more tries with
+       // increasing intervals. Eventually, however, we need to give up. In ad-hoc tests
+       // this strategy successfully flushed the view after no more than 3 retries.
+
+       if (GetLastError () != ERROR_LOCK_VIOLATION)
+               // TODO: Propagate error to caller
+               return;
+
+       for (int w = 0; w < MAX_FLUSH_WAITS; w++) {
+               int pause = (1 << w);  // MaxFlushRetries should never be over 30
+               mono_thread_info_sleep (pause, NULL);
+
+               for (int r = 0; r < MAX_FLUSH_RETIRES_PER_WAIT; r++) {
+                       if (FlushViewOfFile (h->address, h->length))
+                               return;
+
+                       if (GetLastError () != ERROR_LOCK_VIOLATION)
+                               // TODO: Propagate error to caller
+                               return;
+
+                       mono_thread_info_yield ();
+               }
+       }
+
+       // We got to here, so there was no success:
+       // TODO: Propagate error to caller
+}
+
+int mono_mmap_map (void *handle, gint64 offset, gint64 *size, int access, void **mmap_handle, void **base_address)
+{
+       static DWORD allocationGranularity = 0;
+       if (allocationGranularity == 0) {
+               SYSTEM_INFO info;
+               GetSystemInfo (&info);
+               allocationGranularity = info.dwAllocationGranularity;
+       }
+
+       gint64 extraMemNeeded = offset % allocationGranularity;
+       guint64 newOffset = offset - extraMemNeeded;
+       gint64 nativeSize = (*size != 0) ? *size + extraMemNeeded : 0;
+
+#if SIZEOF_VOID_P == 4
+       if (nativeSize > UINT32_MAX)
+               return CAPACITY_LARGER_THAN_LOGICAL_ADDRESS_SPACE;
+#endif
+       
+       void *address = MapViewOfFile ((HANDLE) handle, get_file_map_access (access), (DWORD) (newOffset >> 32), (DWORD) newOffset, (SIZE_T) nativeSize);
+       if (!address)
+               return convert_win32_error (GetLastError (), COULD_NOT_MAP_MEMORY);
+
+       // Query the view for its size and allocation type
+       MEMORY_BASIC_INFORMATION viewInfo;
+       VirtualQuery (address, &viewInfo, sizeof (MEMORY_BASIC_INFORMATION));
+       guint64 viewSize = (guint64) viewInfo.RegionSize;
+
+       // Allocate the pages if we were using the MemoryMappedFileOptions.DelayAllocatePages option
+       // OR check if the allocated view size is smaller than the expected native size
+       // If multiple overlapping views are created over the file mapping object, the pages in a given region
+       // could have different attributes(MEM_RESERVE OR MEM_COMMIT) as MapViewOfFile preserves coherence between 
+       // views created on a mapping object backed by same file.
+       // In which case, the viewSize will be smaller than nativeSize required and viewState could be MEM_COMMIT 
+       // but more pages may need to be committed in the region.
+       // This is because, VirtualQuery function(that internally invokes VirtualQueryEx function) returns the attributes 
+       // and size of the region of pages with matching attributes starting from base address.
+       // VirtualQueryEx: http://msdn.microsoft.com/en-us/library/windows/desktop/aa366907(v=vs.85).aspx
+       if (((viewInfo.State & MEM_RESERVE) != 0) || viewSize < (guint64) nativeSize) {
+               void *tempAddress = VirtualAlloc (address, nativeSize != 0 ? nativeSize : viewSize, MEM_COMMIT, get_page_access (access));
+               if (!tempAddress) {
+                       return convert_win32_error (GetLastError (), COULD_NOT_MAP_MEMORY);
+               }
+               // again query the view for its new size
+               VirtualQuery (address, &viewInfo, sizeof (MEMORY_BASIC_INFORMATION));
+               viewSize = (guint64) viewInfo.RegionSize;
+       }
+
+       if (*size == 0)
+               *size = viewSize - extraMemNeeded;
+
+       MmapInstance *h = g_malloc0 (sizeof (MmapInstance));
+       h->address = address;
+       h->length = *size + extraMemNeeded;
+       *mmap_handle = h;
+       *base_address = (char*) address + (offset - newOffset);
+
        return 0;
 }
 
-gboolean
-mono_mmap_unmap (void *mmap_handle)
+gboolean mono_mmap_unmap (void *mmap_handle)
 {
-       g_error ("No windows backend");
-       return TRUE;
+       g_assert (mmap_handle);
+
+       MmapInstance *h = (MmapInstance *) mmap_handle;
+
+       gboolean result = UnmapViewOfFile (h->address);
+
+       g_free (h);
+       return result;
 }
 
+#else
+
+MONO_EMPTY_SOURCE_FILE (file_mmap_windows);
+
 #endif
index b5a19af282f4aa6e588dc7f1f28aef511acd9a7e..2ef55c6e6733baa729f9a37c2bbb544d82c7d03d 100644 (file)
@@ -103,8 +103,6 @@ extern void mono_gc_set_stack_end (void *stack_end);
 gboolean mono_object_is_alive (MonoObject* obj);
 gboolean mono_gc_is_finalizer_thread (MonoThread *thread);
 gpointer mono_gc_out_of_memory (size_t size);
-void     mono_gc_enable_events (void);
-void     mono_gc_enable_alloc_events (void);
 
 void mono_gchandle_set_target (guint32 gchandle, MonoObject *obj);
 
@@ -145,10 +143,6 @@ void     mono_gchandle_free_domain  (MonoDomain *domain);
 
 typedef void (*FinalizerThreadCallback) (gpointer user_data);
 
-/* if there are finalizers to run, run them. Returns the number of finalizers run */
-gboolean mono_gc_pending_finalizers (void);
-void     mono_gc_finalize_notify    (void);
-
 void* mono_gc_alloc_pinned_obj (MonoVTable *vtable, size_t size);
 void* mono_gc_alloc_obj (MonoVTable *vtable, size_t size);
 void* mono_gc_alloc_vector (MonoVTable *vtable, size_t size, uintptr_t max_length);
@@ -303,8 +297,6 @@ gboolean mono_gc_card_table_nursery_check (void);
 
 void* mono_gc_get_nursery (int *shift_bits, size_t *size);
 
-void mono_gc_set_current_thread_appdomain (MonoDomain *domain);
-
 void mono_gc_set_skip_thread (gboolean skip);
 
 #ifndef HOST_WIN32
@@ -368,6 +360,8 @@ guint mono_gc_get_vtable_bits (MonoClass *klass);
 
 void mono_gc_register_altstack (gpointer stack, gint32 stack_size, gpointer altstack, gint32 altstack_size);
 
+gboolean mono_gc_is_critical_method (MonoMethod *method);
+
 /* If set, print debugging messages around finalizers. */
 extern gboolean log_finalizers;
 
index fab34a56b8bc34ad104d3bfba90792e804c494cb..e66b4da35a2b97c6ae48945d7f18dc5325ee0fc3 100644 (file)
@@ -91,13 +91,13 @@ static void mono_reference_queue_cleanup (void);
 static void reference_queue_clear_for_domain (MonoDomain *domain);
 
 
-static guint32
-guarded_wait (HANDLE handle, guint32 timeout, gboolean alertable)
+static MonoThreadInfoWaitRet
+guarded_wait (MonoThreadHandle *thread_handle, guint32 timeout, gboolean alertable)
 {
-       guint32 result;
+       MonoThreadInfoWaitRet result;
 
        MONO_ENTER_GC_SAFE;
-       result = WaitForSingleObjectEx (handle, timeout, alertable);
+       result = mono_thread_info_wait_one_handle (thread_handle, timeout, alertable);
        MONO_EXIT_GC_SAFE;
 
        return result;
@@ -326,8 +326,12 @@ mono_gc_run_finalize (void *obj, void *data)
        if (log_finalizers)
                g_log ("mono-gc-finalizers", G_LOG_LEVEL_MESSAGE, "<%s at %p> Calling finalizer.", o->vtable->klass->name, o);
 
+       mono_profiler_gc_finalize_object_begin (o);
+
        runtime_invoke (o, NULL, &exc, NULL);
 
+       mono_profiler_gc_finalize_object_end (o);
+
        if (log_finalizers)
                g_log ("mono-gc-finalizers", G_LOG_LEVEL_MESSAGE, "<%s at %p> Returned from finalizer.", o->vtable->klass->name, o);
 
@@ -556,8 +560,6 @@ mono_domain_finalize (MonoDomain *domain, guint32 timeout)
                mono_gc_finalize_threadpool_threads ();
        }
 
-       mono_profiler_appdomain_event (domain, MONO_PROFILE_END_UNLOAD);
-
 done:
        if (InterlockedDecrement (&req->ref) == 0) {
                mono_coop_sem_destroy (&req->done);
@@ -640,7 +642,9 @@ ves_icall_System_GC_WaitForPendingFinalizers (void)
        ResetEvent (pending_done_event);
        mono_gc_finalize_notify ();
        /* g_print ("Waiting for pending finalizers....\n"); */
-       guarded_wait (pending_done_event, INFINITE, TRUE);
+       MONO_ENTER_GC_SAFE;
+       WaitForSingleObjectEx (pending_done_event, INFINITE, TRUE);
+       MONO_EXIT_GC_SAFE;
        /* g_print ("Done pending....\n"); */
 #else
        gboolean alerted = FALSE;
@@ -728,7 +732,7 @@ ves_icall_System_GCHandle_GetAddrOfPinnedObject (guint32 handle)
                } else {
                        /* the C# code will check and throw the exception */
                        /* FIXME: missing !klass->blittable test, see bug #61134 */
-                       if ((klass->flags & TYPE_ATTRIBUTE_LAYOUT_MASK) == TYPE_ATTRIBUTE_AUTO_LAYOUT)
+                       if (mono_class_is_auto_layout (klass))
                                return (gpointer)-1;
                        return (char*)obj + sizeof (MonoObject);
                }
@@ -914,11 +918,15 @@ finalizer_thread (gpointer unused)
 
                finalize_domain_objects ();
 
+               mono_profiler_gc_finalize_begin ();
+
                /* If finished == TRUE, mono_gc_cleanup has been called (from mono_runtime_cleanup),
                 * before the domain is unloaded.
                 */
                mono_gc_invoke_finalizers ();
 
+               mono_profiler_gc_finalize_end ();
+
                mono_threads_join_threads ();
 
                reference_queue_proccess_all ();
@@ -1008,6 +1016,7 @@ mono_gc_cleanup (void)
        if (!gc_disabled) {
                finished = TRUE;
                if (mono_thread_internal_current () != gc_thread) {
+                       int ret;
                        gint64 start_ticks = mono_msec_ticks ();
                        gint64 end_ticks = start_ticks + 2000;
 
@@ -1029,8 +1038,6 @@ mono_gc_cleanup (void)
                        }
 
                        if (!finalizer_thread_exited) {
-                               int ret;
-
                                /* Set a flag which the finalizer thread can check */
                                suspend_finalizers = TRUE;
                                mono_gc_suspend_finalizers ();
@@ -1041,23 +1048,22 @@ mono_gc_cleanup (void)
                                /* Wait for it to stop */
                                ret = guarded_wait (gc_thread->handle, 100, TRUE);
 
-                               if (ret == WAIT_TIMEOUT) {
+                               if (ret == MONO_THREAD_INFO_WAIT_RET_TIMEOUT) {
                                        /*
                                         * The finalizer thread refused to exit. Make it stop.
                                         */
                                        mono_thread_internal_stop (gc_thread);
                                        ret = guarded_wait (gc_thread->handle, 100, TRUE);
-                                       g_assert (ret != WAIT_TIMEOUT);
+                                       g_assert (ret != MONO_THREAD_INFO_WAIT_RET_TIMEOUT);
                                        /* The thread can't set this flag */
                                        finalizer_thread_exited = TRUE;
                                }
                        }
 
-                       int ret;
 
                        /* Wait for the thread to actually exit */
                        ret = guarded_wait (gc_thread->handle, INFINITE, TRUE);
-                       g_assert (ret == WAIT_OBJECT_0);
+                       g_assert (ret == MONO_THREAD_INFO_WAIT_RET_SUCCESS_0);
 
                        mono_thread_join (GUINT_TO_POINTER (gc_thread->tid));
                        g_assert (finalizer_thread_exited);
index 56b9b9353cd706fc6bab6b125dc0112f9b6a4f92..2465527e158e846009daa0ded3890858e2b6e908 100644 (file)
@@ -45,6 +45,29 @@ Combine: MonoDefaults, GENERATE_GET_CLASS_WITH_CACHE, TYPED_HANDLE_DECL and frie
        We could then generate neat type safe wrappers.
 */
 
+/*
+ * NOTE: Async suspend
+ * 
+ * If we are running with cooperative GC, all the handle stack
+ * manipulation will complete before a GC thread scans the handle
+ * stack. If we are using async suspend, however, a thread may be
+ * trying to allocate a new handle, or unwind the handle stack when
+ * the GC stops the world.
+ *
+ * In particular, we need to ensure that if the mutator thread is
+ * suspended while manipulating the handle stack, the stack is in a
+ * good enough state to be scanned.  In particular, the size of each
+ * chunk should be updated before an object is written into the
+ * handle, and chunks to be scanned (between bottom and top) should
+ * always be valid.
+ *
+ * Note that the handle stack is scanned PRECISELY (see
+ * sgen_client_scan_thread_data ()).  That means there should not be
+ * stale objects scanned.  So when we manipulate the size of a chunk,
+ * wemust ensure that the newly scannable slot is either null or
+ * points to a valid value.
+ */
+
 const MonoObjectHandle mono_null_value_handle = NULL;
 
 #define THIS_IS_AN_OK_NUMBER_OF_HANDLES 100
@@ -59,13 +82,28 @@ mono_handle_new (MonoObject *object)
 
 retry:
        if (G_LIKELY (top->size < OBJECTS_PER_HANDLES_CHUNK)) {
-               MonoObject **h = &top->objects [top->size++];
+               int idx = top->size;
+               /* can be interrupted anywhere here, so:
+                * 1. make sure the new slot is null
+                * 2. make the new slot scannable (increment size)
+                * 3. put a valid object in there
+                *
+                * (have to do 1 then 3 so that if we're interrupted
+                * between 1 and 2, the object is still live)
+                */
+               top->objects [idx] = NULL;
+               mono_memory_write_barrier ();
+               top->size++;
+               mono_memory_write_barrier ();
+               MonoObject **h = &top->objects [idx];
                *h = object;
                return h;
        }
        if (G_LIKELY (top->next)) {
+               top->next->size = 0;
+               /* make sure size == 0 is visible to a GC thread before it sees the new top */
+               mono_memory_write_barrier ();
                top = top->next;
-               top->size = 0;
                handles->top = top;
                goto retry;
        }
@@ -73,6 +111,8 @@ retry:
        new_chunk->size = 0;
        new_chunk->prev = top;
        new_chunk->next = NULL;
+       /* make sure size == 0 before new chunk is visible */
+       mono_memory_write_barrier ();
        top->next = new_chunk;
        handles->top = new_chunk;
        goto retry;
@@ -86,9 +126,10 @@ mono_handle_stack_alloc (void)
        HandleStack *stack = g_new (HandleStack, 1);
        HandleChunk *chunk = g_new (HandleChunk, 1);
 
-       stack->top = stack->bottom = chunk;
        chunk->size = 0;
        chunk->prev = chunk->next = NULL;
+       mono_memory_write_barrier ();
+       stack->top = stack->bottom = chunk;
        return stack;
 }
 
@@ -98,6 +139,8 @@ mono_handle_stack_free (HandleStack *stack)
        if (!stack)
                return;
        HandleChunk *c = stack->bottom;
+       stack->top = stack->bottom = NULL;
+       mono_memory_write_barrier ();
        while (c) {
                HandleChunk *next = c->next;
                g_free (c);
@@ -110,6 +153,8 @@ mono_handle_stack_free (HandleStack *stack)
 void
 mono_handle_stack_scan (HandleStack *stack, GcScanFunc func, gpointer gc_data)
 {
+       /* if we're running, we know the world is stopped.
+        */
        HandleChunk *cur = stack->bottom;
        HandleChunk *last = stack->top;
 
@@ -118,8 +163,10 @@ mono_handle_stack_scan (HandleStack *stack, GcScanFunc func, gpointer gc_data)
 
        while (cur) {
                int i;
-               for (i = 0; i < cur->size; ++i)
-                       func ((gpointer*)&cur->objects [i], gc_data);
+               for (i = 0; i < cur->size; ++i) {
+                       if (cur->objects [i] != NULL)
+                               func ((gpointer*)&cur->objects [i], gc_data);
+               }
                if (cur == last)
                        break;
                cur = cur->next;
@@ -140,7 +187,7 @@ mono_stack_mark_record_size (MonoThreadInfo *info, HandleStackMark *stackmark, c
        }
 
        if (size > THIS_IS_AN_OK_NUMBER_OF_HANDLES)
-               printf ("%s USED %d handles\n", func_name, size);
+               g_warning ("%s USED %d handles\n", func_name, size);
 }
 
 /*
@@ -157,9 +204,9 @@ mono_stack_mark_pop_value (MonoThreadInfo *info, HandleStackMark *stackmark, Mon
 /* Temporary place for some of the handle enabled wrapper functions*/
 
 MonoStringHandle
-mono_string_new_handle (MonoDomain *domain, const char *data)
+mono_string_new_handle (MonoDomain *domain, const char *data, MonoError *error)
 {
-       return MONO_HANDLE_NEW (MonoString, mono_string_new (domain, data));
+       return MONO_HANDLE_NEW (MonoString, mono_string_new_checked (domain, data, error));
 }
 
 MonoArrayHandle
@@ -176,3 +223,32 @@ mono_handle_verify (MonoRawHandle raw_handle)
        
 }
 #endif
+
+uintptr_t
+mono_array_handle_length (MonoArrayHandle arr)
+{
+       MONO_REQ_GC_UNSAFE_MODE;
+
+       return MONO_HANDLE_RAW (arr)->max_length;
+}
+
+uint32_t
+mono_gchandle_from_handle (MonoObjectHandle handle, mono_bool pinned)
+{
+       return mono_gchandle_new (MONO_HANDLE_RAW(handle), pinned);
+}
+
+MonoObjectHandle
+mono_gchandle_get_target_handle (uint32_t gchandle)
+{
+       return MONO_HANDLE_NEW (MonoObject, mono_gchandle_get_target);
+}
+
+gpointer
+mono_array_handle_pin_with_size (MonoArrayHandle handle, int size, uintptr_t idx, uint32_t *gchandle)
+{
+       g_assert (gchandle != NULL);
+       *gchandle = mono_gchandle_from_handle (MONO_HANDLE_CAST(MonoObject,handle), TRUE);
+       MonoArray *raw = MONO_HANDLE_RAW (handle);
+       return mono_array_addr_with_size (raw, size, idx);
+}
index f5e8d29ba3088aa08a9acf3f2e4686ab5e9965db..25ce103a09ca6fb7be63832b8ca3fae5fb823a38 100644 (file)
@@ -79,7 +79,7 @@ void mono_handle_stack_free (HandleStack *handlestack);
 MonoRawHandle mono_stack_mark_pop_value (MonoThreadInfo *info, HandleStackMark *stackmark, MonoRawHandle value);
 void mono_stack_mark_record_size (MonoThreadInfo *info, HandleStackMark *stackmark, const char *func_name);
 
-static void
+static inline void
 mono_stack_mark_init (MonoThreadInfo *info, HandleStackMark *stackmark)
 {
        HandleStack *handles = (HandleStack *)info->handle_stack;
@@ -87,12 +87,14 @@ mono_stack_mark_init (MonoThreadInfo *info, HandleStackMark *stackmark)
        stackmark->chunk = handles->top;
 }
 
-static void
+static inline void
 mono_stack_mark_pop (MonoThreadInfo *info, HandleStackMark *stackmark)
 {
        HandleStack *handles = (HandleStack *)info->handle_stack;
-       handles->top = stackmark->chunk;
-       handles->top->size = stackmark->size;
+       HandleChunk *old_top = stackmark->chunk;
+       old_top->size = stackmark->size;
+       mono_memory_write_barrier ();
+       handles->top = old_top;
 }
 
 /*
@@ -115,6 +117,19 @@ Icall macros
        mono_stack_mark_record_size (__info, &__mark, __FUNCTION__);    \
        mono_stack_mark_pop (__info, &__mark);
 
+#define HANDLE_FUNCTION_ENTER() do {                           \
+       MonoThreadInfo *__info = mono_thread_info_current ();   \
+       SETUP_ICALL_FRAME                                       \
+
+#define HANDLE_FUNCTION_RETURN()               \
+       CLEAR_ICALL_FRAME;                      \
+       } while (0)
+
+#define HANDLE_FUNCTION_RETURN_VAL(VAL)                \
+       CLEAR_ICALL_FRAME;                      \
+       return (VAL);                           \
+       } while (0)
+
 #ifdef MONO_NEEDS_STACK_WATERMARK
 
 static void
@@ -187,6 +202,8 @@ void mono_handle_verify (MonoRawHandle handle);
 
 #define TYPED_HANDLE_PAYLOAD_NAME(TYPE) TYPE ## HandlePayload
 #define TYPED_HANDLE_NAME(TYPE) TYPE ## Handle
+#define TYPED_OUT_HANDLE_NAME(TYPE) TYPE ## HandleOut
+
 
 /*
  * TYPED_HANDLE_DECL(SomeType):
@@ -199,8 +216,12 @@ void mono_handle_verify (MonoRawHandle handle);
  * } MonoObjectHandlePayload;
  *
  * typedef MonoObjectHandlePayload* MonoObjectHandle;
+ * typedef MonoObjectHandlePayload* MonoObjectHandleOut;
  */
-#define TYPED_HANDLE_DECL(TYPE) typedef struct { TYPE *__obj; } TYPED_HANDLE_PAYLOAD_NAME (TYPE) ; typedef TYPED_HANDLE_PAYLOAD_NAME (TYPE) * TYPED_HANDLE_NAME (TYPE)
+#define TYPED_HANDLE_DECL(TYPE)                                                \
+       typedef struct { TYPE *__obj; } TYPED_HANDLE_PAYLOAD_NAME (TYPE) ; \
+       typedef TYPED_HANDLE_PAYLOAD_NAME (TYPE) * TYPED_HANDLE_NAME (TYPE); \
+       typedef TYPED_HANDLE_PAYLOAD_NAME (TYPE) * TYPED_OUT_HANDLE_NAME (TYPE)
 /* Have to double expand because MONO_STRUCT_OFFSET is doing token pasting on cross-compilers. */
 #define MONO_HANDLE_PAYLOAD_OFFSET_(PayloadType) MONO_STRUCT_OFFSET(PayloadType, __obj)
 #define MONO_HANDLE_PAYLOAD_OFFSET(TYPE) MONO_HANDLE_PAYLOAD_OFFSET_(TYPED_HANDLE_PAYLOAD_NAME (TYPE))
@@ -214,6 +235,9 @@ void mono_handle_verify (MonoRawHandle handle);
 #define MONO_HANDLE_NEW(TYPE, VALUE) (TYPED_HANDLE_NAME(TYPE))( mono_handle_new ((MonoObject*)(VALUE)) )
 #define MONO_HANDLE_CAST(TYPE, VALUE) (TYPED_HANDLE_NAME(TYPE))( VALUE )
 
+#define MONO_HANDLE_IS_NULL(HANDLE) (MONO_HANDLE_RAW(HANDLE) == NULL)
+
+
 /*
 WARNING WARNING WARNING
 
@@ -226,12 +250,20 @@ This is why we evaluate index and value before any call to MONO_HANDLE_RAW or ot
 #define MONO_HANDLE_SETRAW(HANDLE, FIELD, VALUE) do {  \
                MonoObject *__val = (MonoObject*)(VALUE);       \
                MONO_OBJECT_SETREF (MONO_HANDLE_RAW (HANDLE), FIELD, __val);    \
-       } while (0);
+       } while (0)
 
 #define MONO_HANDLE_SET(HANDLE, FIELD, VALUE) do {     \
                MonoObjectHandle __val = MONO_HANDLE_CAST (MonoObject, VALUE);  \
                MONO_OBJECT_SETREF (MONO_HANDLE_RAW (HANDLE), FIELD, MONO_HANDLE_RAW (__val));  \
-       } while (0);
+       } while (0)
+
+/* N.B. RESULT is evaluated before HANDLE */
+#define MONO_HANDLE_GET(RESULT, HANDLE, FIELD) do {                    \
+               MonoObjectHandle __dest = MONO_HANDLE_CAST(MonoObject, RESULT); \
+               mono_gc_wbarrier_generic_store (&__dest->__obj,  (MonoObject*)(MONO_HANDLE_RAW(HANDLE)->FIELD)); \
+       } while (0)
+
+#define MONO_HANDLE_GETVAL(HANDLE, FIELD) (MONO_HANDLE_RAW(HANDLE)->FIELD)
 
 /* VS doesn't support typeof :( :( :( */
 #define MONO_HANDLE_SETVAL(HANDLE, FIELD, TYPE, VALUE) do {    \
@@ -245,12 +277,30 @@ This is why we evaluate index and value before any call to MONO_HANDLE_RAW or ot
                mono_array_setref_fast (MONO_HANDLE_RAW (HANDLE), __idx, MONO_HANDLE_RAW (__val));      \
        } while (0)
 
+#define MONO_HANDLE_ARRAY_SETVAL(HANDLE, TYPE, IDX, VALUE) do {                \
+               int __idx = (IDX);                                      \
+               TYPE __val = (VALUE);                   \
+               mono_array_set (MONO_HANDLE_RAW (HANDLE), TYPE, __idx, __val); \
+       } while (0)
+
 #define MONO_HANDLE_ARRAY_SETRAW(HANDLE, IDX, VALUE) do {      \
                int __idx = (IDX);      \
                MonoObject *__val = (MonoObject*)(VALUE);       \
-               mono_array_setref_fast (MONO_HANDLE_RAW (HANDLE), __idx, __val);        \
+               mono_array_setref_fast (MONO_HANDLE_RAW (HANDLE), __idx, __val); \
+       } while (0)
+
+/* N.B. DEST is evaluated AFTER all the other arguments */
+#define MONO_HANDLE_ARRAY_GETVAL(DEST, HANDLE, TYPE, IDX) do {         \
+               MonoArrayHandle __arr = (HANDLE);                       \
+               int __idx = (IDX);                                      \
+               TYPE __result = mono_array_get (MONO_HANDLE_RAW(__arr), TYPE, __idx); \
+               (DEST) =  __result;                                     \
        } while (0)
 
+#define MONO_HANDLE_ASSIGN(DESTH, SRCH)                                \
+       mono_handle_assign (MONO_HANDLE_CAST (MonoObject, (DESTH)), MONO_HANDLE_CAST(MonoObject, (SRCH)))
+
+#define MONO_HANDLE_DOMAIN(HANDLE) (mono_object_domain (MONO_HANDLE_RAW (MONO_HANDLE_CAST (MonoObject, HANDLE))))
 
 /* Baked typed handles we all want */
 TYPED_HANDLE_DECL (MonoString);
@@ -265,11 +315,39 @@ Init values to it.
 */
 extern const MonoObjectHandle mono_null_value_handle;
 
+static inline void
+mono_handle_assign (MonoObjectHandle dest, MonoObjectHandle src)
+{
+       mono_gc_wbarrier_generic_store (&dest->__obj, MONO_HANDLE_RAW(src));
+}
 
 //FIXME this should go somewhere else
-MonoStringHandle mono_string_new_handle (MonoDomain *domain, const char *data);
+MonoStringHandle mono_string_new_handle (MonoDomain *domain, const char *data, MonoError *error);
 MonoArrayHandle mono_array_new_handle (MonoDomain *domain, MonoClass *eclass, uintptr_t n, MonoError *error);
 
+uintptr_t mono_array_handle_length (MonoArrayHandle arr);
+
+#define mono_handle_class(o) mono_object_class (MONO_HANDLE_RAW (o))
+
+/* Local handles to global GC handles and back */
+
+uint32_t
+mono_gchandle_from_handle (MonoObjectHandle handle, mono_bool pinned);
+
+MonoObjectHandle
+mono_gchandle_get_target_handle (uint32_t gchandle);
+
+
+
+/* Pins the MonoArray using a gchandle and returns a pointer to the
+ * element with the given index (where each element is of the given
+ * size.  Call mono_gchandle_free to unpin.
+ */
+gpointer
+mono_array_handle_pin_with_size (MonoArrayHandle handle, int size, uintptr_t index, uint32_t *gchandle);
+
+#define MONO_ARRAY_HANDLE_PIN(handle,type,index,gchandle_out) mono_array_handle_pin_with_size (MONO_HANDLE_CAST(MonoArray,(handle)), sizeof (type), (index), (gchandle_out))
+
 G_END_DECLS
 
 #endif /* __MONO_HANDLE_H__ */
index 96cb5bd78c4f9fd85c676bb9a5f413b8a422232b..7423b14ea912fe11d179eaf5eaada9cb379a91a1 100644 (file)
@@ -84,9 +84,12 @@ ICALL(COMPROX_1, "AddProxy", ves_icall_Mono_Interop_ComInteropProxy_AddProxy)
 ICALL(COMPROX_2, "FindProxy", ves_icall_Mono_Interop_ComInteropProxy_FindProxy)
 #endif
 
+ICALL_TYPE(TLS_PROVIDER_FACTORY, "Mono.Net.Security.MonoTlsProviderFactory", TLS_PROVIDER_FACTORY_1)
+ICALL(TLS_PROVIDER_FACTORY_1, "IsBtlsSupported", ves_icall_Mono_TlsProviderFactory_IsBtlsSupported)
+
 ICALL_TYPE(RUNTIME, "Mono.Runtime", RUNTIME_1)
-ICALL(RUNTIME_1, "GetDisplayName", ves_icall_Mono_Runtime_GetDisplayName)
-ICALL(RUNTIME_12, "GetNativeStackTrace", ves_icall_Mono_Runtime_GetNativeStackTrace)
+HANDLES(ICALL(RUNTIME_1, "GetDisplayName", ves_icall_Mono_Runtime_GetDisplayName))
+HANDLES(ICALL(RUNTIME_12, "GetNativeStackTrace", ves_icall_Mono_Runtime_GetNativeStackTrace))
 
 ICALL_TYPE(RTCLASS, "Mono.RuntimeClassHandle", RTCLASS_1)
 ICALL(RTCLASS_1, "GetTypeFromClass", ves_icall_Mono_RuntimeClassHandle_GetTypeFromClass)
@@ -171,13 +174,13 @@ ICALL_TYPE (COMPO_W, "System.ComponentModel.Win32Exception", COMPO_W_1)
 ICALL (COMPO_W_1, "W32ErrorMessage", ves_icall_System_ComponentModel_Win32Exception_W32ErrorMessage)
 
 ICALL_TYPE(DEFAULTC, "System.Configuration.DefaultConfig", DEFAULTC_1)
-ICALL(DEFAULTC_1, "get_bundled_machine_config", get_bundled_machine_config)
+HANDLES(ICALL(DEFAULTC_1, "get_bundled_machine_config", ves_icall_System_Configuration_DefaultConfig_get_bundled_machine_config))
 ICALL(DEFAULTC_2, "get_machine_config_path", ves_icall_System_Configuration_DefaultConfig_get_machine_config_path)
 
 /* Note that the below icall shares the same function as DefaultConfig uses */
 ICALL_TYPE(INTCFGHOST, "System.Configuration.InternalConfigurationHost", INTCFGHOST_1)
 ICALL(INTCFGHOST_1, "get_bundled_app_config", get_bundled_app_config)
-ICALL(INTCFGHOST_2, "get_bundled_machine_config", get_bundled_machine_config)
+HANDLES(ICALL(INTCFGHOST_2, "get_bundled_machine_config", ves_icall_System_Configuration_InternalConfigurationHost_get_bundled_machine_config))
 
 ICALL_TYPE(CONSOLE, "System.ConsoleDriver", CONSOLE_1)
 ICALL(CONSOLE_1, "InternalKeyAvailable", ves_icall_System_ConsoleDriver_InternalKeyAvailable )
@@ -253,7 +256,7 @@ ICALL_TYPE(STOPWATCH, "System.Diagnostics.Stopwatch", STOPWATCH_1)
 ICALL(STOPWATCH_1, "GetTimestamp", mono_100ns_ticks)
 
 ICALL_TYPE(ENUM, "System.Enum", ENUM_1)
-ICALL(ENUM_1, "GetEnumValuesAndNames", ves_icall_System_Enum_GetEnumValuesAndNames)
+HANDLES(ICALL(ENUM_1, "GetEnumValuesAndNames", ves_icall_System_Enum_GetEnumValuesAndNames))
 ICALL(ENUM_2, "InternalBoxEnum", ves_icall_System_Enum_ToObject)
 ICALL(ENUM_3, "InternalCompareTo", ves_icall_System_Enum_compare_value_to)
 ICALL(ENUM_4, "InternalGetUnderlyingType", ves_icall_System_Enum_get_underlying_type)
@@ -280,23 +283,24 @@ ICALL(ENV_13, "get_Platform", ves_icall_System_Environment_get_Platform)
 ICALL(ENV_14, "get_ProcessorCount", mono_cpu_count)
 ICALL(ENV_15, "get_TickCount", ves_icall_System_Environment_get_TickCount)
 ICALL(ENV_16, "get_UserName", ves_icall_System_Environment_get_UserName)
+HANDLES(ICALL(ENV_16b, "get_bundled_machine_config", ves_icall_System_Environment_get_bundled_machine_config))
 ICALL(ENV_16m, "internalBroadcastSettingChange", ves_icall_System_Environment_BroadcastSettingChange)
-ICALL(ENV_17, "internalGetEnvironmentVariable", ves_icall_System_Environment_GetEnvironmentVariable)
-ICALL(ENV_18, "internalGetGacPath", ves_icall_System_Environment_GetGacPath)
-ICALL(ENV_19, "internalGetHome", ves_icall_System_Environment_InternalGetHome)
+HANDLES(ICALL(ENV_17, "internalGetEnvironmentVariable_native", ves_icall_System_Environment_GetEnvironmentVariable_native))
+HANDLES(ICALL(ENV_18, "internalGetGacPath", ves_icall_System_Environment_GetGacPath))
+HANDLES(ICALL(ENV_19, "internalGetHome", ves_icall_System_Environment_InternalGetHome))
 ICALL(ENV_20, "set_ExitCode", mono_environment_exitcode_set)
 
 ICALL_TYPE(GC, "System.GC", GC_0)
-ICALL(GC_0, "CollectionCount", mono_gc_collection_count)
+ICALL(GC_0, "GetCollectionCount", mono_gc_collection_count)
 ICALL(GC_0a, "GetGeneration", mono_gc_get_generation)
+ICALL(GC_0b, "GetMaxGeneration", mono_gc_max_generation)
 ICALL(GC_1, "GetTotalMemory", ves_icall_System_GC_GetTotalMemory)
 ICALL(GC_2, "InternalCollect", ves_icall_System_GC_InternalCollect)
 ICALL(GC_3, "KeepAlive", ves_icall_System_GC_KeepAlive)
-ICALL(GC_4, "ReRegisterForFinalize", ves_icall_System_GC_ReRegisterForFinalize)
 ICALL(GC_4a, "RecordPressure", mono_gc_add_memory_pressure)
-ICALL(GC_5, "SuppressFinalize", ves_icall_System_GC_SuppressFinalize)
 ICALL(GC_6, "WaitForPendingFinalizers", ves_icall_System_GC_WaitForPendingFinalizers)
-ICALL(GC_7, "get_MaxGeneration", mono_gc_max_generation)
+ICALL(GC_6b, "_ReRegisterForFinalize", ves_icall_System_GC_ReRegisterForFinalize)
+ICALL(GC_7, "_SuppressFinalize", ves_icall_System_GC_SuppressFinalize)
 ICALL(GC_9, "get_ephemeron_tombstone", ves_icall_System_GC_get_ephemeron_tombstone)
 ICALL(GC_8, "register_ephemeron_array", ves_icall_System_GC_register_ephemeron_array)
 
@@ -403,7 +407,7 @@ ICALL(MONOIO_32, "get_PathSeparator", ves_icall_System_IO_MonoIO_get_PathSeparat
 ICALL(MONOIO_33, "get_VolumeSeparatorChar", ves_icall_System_IO_MonoIO_get_VolumeSeparatorChar)
 
 ICALL_TYPE(IOPATH, "System.IO.Path", IOPATH_1)
-ICALL(IOPATH_1, "get_temp_path", ves_icall_System_IO_get_temp_path)
+HANDLES(ICALL(IOPATH_1, "get_temp_path", ves_icall_System_IO_get_temp_path))
 
 ICALL_TYPE(IOSELECTOR, "System.IOSelector", IOSELECTOR_1)
 ICALL(IOSELECTOR_1, "Add", ves_icall_System_IOSelector_Add)
@@ -439,8 +443,8 @@ ICALL(MCATTR_3, "IsDefinedInternal", custom_attrs_defined_internal)
 
 #ifndef DISABLE_SOCKETS
 ICALL_TYPE(NDNS, "System.Net.Dns", NDNS_1)
-ICALL(NDNS_1, "GetHostByAddr_internal(string,string&,string[]&,string[]&)", ves_icall_System_Net_Dns_GetHostByAddr_internal)
-ICALL(NDNS_2, "GetHostByName_internal(string,string&,string[]&,string[]&)", ves_icall_System_Net_Dns_GetHostByName_internal)
+ICALL(NDNS_1, "GetHostByAddr_internal(string,string&,string[]&,string[]&,int)", ves_icall_System_Net_Dns_GetHostByAddr_internal)
+ICALL(NDNS_2, "GetHostByName_internal(string,string&,string[]&,string[]&,int)", ves_icall_System_Net_Dns_GetHostByName_internal)
 ICALL(NDNS_3, "GetHostName_internal(string&)", ves_icall_System_Net_Dns_GetHostName_internal)
 
 #if defined(PLATFORM_MACOSX) || defined(PLATFORM_BSD)
@@ -454,7 +458,7 @@ ICALL(SOCK_2, "Available_internal(intptr,int&)", ves_icall_System_Net_Sockets_So
 ICALL(SOCK_3, "Bind_internal(intptr,System.Net.SocketAddress,int&)", ves_icall_System_Net_Sockets_Socket_Bind_internal)
 ICALL(SOCK_4, "Blocking_internal(intptr,bool,int&)", ves_icall_System_Net_Sockets_Socket_Blocking_internal)
 ICALL(SOCK_5, "Close_internal(intptr,int&)", ves_icall_System_Net_Sockets_Socket_Close_internal)
-ICALL(SOCK_6, "Connect_internal(intptr,System.Net.SocketAddress,int&)", ves_icall_System_Net_Sockets_Socket_Connect_internal)
+ICALL(SOCK_6, "Connect_internal(intptr,System.Net.SocketAddress,int&,bool)", ves_icall_System_Net_Sockets_Socket_Connect_internal)
 ICALL (SOCK_6a, "Disconnect_internal(intptr,bool,int&)", ves_icall_System_Net_Sockets_Socket_Disconnect_internal)
 ICALL(SOCK_7, "GetSocketOption_arr_internal(intptr,System.Net.Sockets.SocketOptionLevel,System.Net.Sockets.SocketOptionName,byte[]&,int&)", ves_icall_System_Net_Sockets_Socket_GetSocketOption_arr_internal)
 ICALL(SOCK_8, "GetSocketOption_obj_internal(intptr,System.Net.Sockets.SocketOptionLevel,System.Net.Sockets.SocketOptionName,object&,int&)", ves_icall_System_Net_Sockets_Socket_GetSocketOption_obj_internal)
@@ -462,15 +466,15 @@ ICALL(SOCK_21, "IOControl_internal(intptr,int,byte[],byte[],int&)", ves_icall_Sy
 ICALL(SOCK_9, "Listen_internal(intptr,int,int&)", ves_icall_System_Net_Sockets_Socket_Listen_internal)
 ICALL(SOCK_10, "LocalEndPoint_internal(intptr,int,int&)", ves_icall_System_Net_Sockets_Socket_LocalEndPoint_internal)
 ICALL(SOCK_11, "Poll_internal", ves_icall_System_Net_Sockets_Socket_Poll_internal)
-ICALL(SOCK_13, "ReceiveFrom_internal(intptr,byte[],int,int,System.Net.Sockets.SocketFlags,System.Net.SocketAddress&,int&)", ves_icall_System_Net_Sockets_Socket_ReceiveFrom_internal)
-ICALL(SOCK_11a, "Receive_internal(intptr,System.Net.Sockets.Socket/WSABUF[],System.Net.Sockets.SocketFlags,int&)", ves_icall_System_Net_Sockets_Socket_Receive_array_internal)
-ICALL(SOCK_12, "Receive_internal(intptr,byte[],int,int,System.Net.Sockets.SocketFlags,int&)", ves_icall_System_Net_Sockets_Socket_Receive_internal)
+ICALL(SOCK_13, "ReceiveFrom_internal(intptr,byte[],int,int,System.Net.Sockets.SocketFlags,System.Net.SocketAddress&,int&,bool)", ves_icall_System_Net_Sockets_Socket_ReceiveFrom_internal)
+ICALL(SOCK_11a, "Receive_internal(intptr,System.Net.Sockets.Socket/WSABUF[],System.Net.Sockets.SocketFlags,int&,bool)", ves_icall_System_Net_Sockets_Socket_Receive_array_internal)
+ICALL(SOCK_12, "Receive_internal(intptr,byte[],int,int,System.Net.Sockets.SocketFlags,int&,bool)", ves_icall_System_Net_Sockets_Socket_Receive_internal)
 ICALL(SOCK_14, "RemoteEndPoint_internal(intptr,int,int&)", ves_icall_System_Net_Sockets_Socket_RemoteEndPoint_internal)
 ICALL(SOCK_15, "Select_internal(System.Net.Sockets.Socket[]&,int,int&)", ves_icall_System_Net_Sockets_Socket_Select_internal)
-ICALL(SOCK_15a, "SendFile_internal(intptr,string,byte[],byte[],System.Net.Sockets.TransmitFileOptions)", ves_icall_System_Net_Sockets_Socket_SendFile_internal)
-ICALL(SOCK_16, "SendTo_internal(intptr,byte[],int,int,System.Net.Sockets.SocketFlags,System.Net.SocketAddress,int&)", ves_icall_System_Net_Sockets_Socket_SendTo_internal)
-ICALL(SOCK_16a, "Send_internal(intptr,System.Net.Sockets.Socket/WSABUF[],System.Net.Sockets.SocketFlags,int&)", ves_icall_System_Net_Sockets_Socket_Send_array_internal)
-ICALL(SOCK_17, "Send_internal(intptr,byte[],int,int,System.Net.Sockets.SocketFlags,int&)", ves_icall_System_Net_Sockets_Socket_Send_internal)
+ICALL(SOCK_15a, "SendFile_internal(intptr,string,byte[],byte[],System.Net.Sockets.TransmitFileOptions,int&,bool)", ves_icall_System_Net_Sockets_Socket_SendFile_internal)
+ICALL(SOCK_16, "SendTo_internal(intptr,byte[],int,int,System.Net.Sockets.SocketFlags,System.Net.SocketAddress,int&,bool)", ves_icall_System_Net_Sockets_Socket_SendTo_internal)
+ICALL(SOCK_16a, "Send_internal(intptr,System.Net.Sockets.Socket/WSABUF[],System.Net.Sockets.SocketFlags,int&,bool)", ves_icall_System_Net_Sockets_Socket_Send_array_internal)
+ICALL(SOCK_17, "Send_internal(intptr,byte[],int,int,System.Net.Sockets.SocketFlags,int&,bool)", ves_icall_System_Net_Sockets_Socket_Send_internal)
 ICALL(SOCK_18, "SetSocketOption_internal(intptr,System.Net.Sockets.SocketOptionLevel,System.Net.Sockets.SocketOptionName,object,byte[],int,int&)", ves_icall_System_Net_Sockets_Socket_SetSocketOption_internal)
 ICALL(SOCK_19, "Shutdown_internal(intptr,System.Net.Sockets.SocketShutdown,int&)", ves_icall_System_Net_Sockets_Socket_Shutdown_internal)
 ICALL(SOCK_20, "Socket_internal(System.Net.Sockets.AddressFamily,System.Net.Sockets.SocketType,System.Net.Sockets.ProtocolType,int&)", ves_icall_System_Net_Sockets_Socket_Socket_internal)
@@ -494,7 +498,7 @@ ICALL(OBJ_2, "InternalGetHashCode", mono_object_hash)
 ICALL(OBJ_3, "MemberwiseClone", ves_icall_System_Object_MemberwiseClone)
 
 ICALL_TYPE(ASSEM, "System.Reflection.Assembly", ASSEM_1a)
-ICALL(ASSEM_1a, "GetAotId", ves_icall_System_Reflection_Assembly_GetAotId)
+HANDLES(ICALL(ASSEM_1a, "GetAotId", ves_icall_System_Reflection_Assembly_GetAotId))
 ICALL(ASSEM_2, "GetCallingAssembly", ves_icall_System_Reflection_Assembly_GetCallingAssembly)
 ICALL(ASSEM_3, "GetEntryAssembly", ves_icall_System_Reflection_Assembly_GetEntryAssembly)
 ICALL(ASSEM_4, "GetExecutingAssembly", ves_icall_System_Reflection_Assembly_GetExecutingAssembly)
@@ -509,7 +513,7 @@ ICALL(ASSEM_12, "GetReferencedAssemblies", ves_icall_System_Reflection_Assembly_
 ICALL(ASSEM_13, "GetTypes", ves_icall_System_Reflection_Assembly_GetTypes)
 ICALL(ASSEM_14, "InternalGetAssemblyName", ves_icall_System_Reflection_Assembly_InternalGetAssemblyName)
 ICALL(ASSEM_15, "InternalGetType", ves_icall_System_Reflection_Assembly_InternalGetType)
-ICALL(ASSEM_16, "InternalImageRuntimeVersion", ves_icall_System_Reflection_Assembly_InternalImageRuntimeVersion)
+HANDLES(ICALL(ASSEM_16, "InternalImageRuntimeVersion", ves_icall_System_Reflection_Assembly_InternalImageRuntimeVersion))
 ICALL(ASSEM_17, "LoadFrom", ves_icall_System_Reflection_Assembly_LoadFrom)
 ICALL(ASSEM_18, "LoadPermissions", ves_icall_System_Reflection_Assembly_LoadPermissions)
 
@@ -519,7 +523,7 @@ ICALL(ASSEM_21, "get_ReflectionOnly", ves_icall_System_Reflection_Assembly_get_R
 ICALL(ASSEM_22, "get_code_base", ves_icall_System_Reflection_Assembly_get_code_base)
 ICALL(ASSEM_23, "get_fullname", ves_icall_System_Reflection_Assembly_get_fullName)
 ICALL(ASSEM_24, "get_global_assembly_cache", ves_icall_System_Reflection_Assembly_get_global_assembly_cache)
-ICALL(ASSEM_25, "get_location", ves_icall_System_Reflection_Assembly_get_location)
+HANDLES(ICALL(ASSEM_25, "get_location", ves_icall_System_Reflection_Assembly_get_location))
 ICALL(ASSEM_26, "load_with_partial_name", ves_icall_System_Reflection_Assembly_load_with_partial_name)
 
 ICALL_TYPE(ASSEMN, "System.Reflection.AssemblyName", ASSEMN_0)
@@ -530,8 +534,7 @@ ICALL(ASSEMN_2, "get_public_token", mono_digest_get_public_token)
 ICALL_TYPE(CATTR_DATA, "System.Reflection.CustomAttributeData", CATTR_DATA_1)
 ICALL(CATTR_DATA_1, "ResolveArgumentsInternal", ves_icall_System_Reflection_CustomAttributeData_ResolveArgumentsInternal)
 
-ICALL_TYPE(ASSEMB, "System.Reflection.Emit.AssemblyBuilder", ASSEMB_1)
-ICALL(ASSEMB_1, "InternalAddModule", ves_icall_AssemblyBuilder_InternalAddModule)
+ICALL_TYPE(ASSEMB, "System.Reflection.Emit.AssemblyBuilder", ASSEMB_2)
 ICALL(ASSEMB_2, "basic_init", ves_icall_AssemblyBuilder_basic_init)
 
 #ifndef DISABLE_REFLECTION_EMIT
@@ -545,19 +548,12 @@ ICALL(DYNM_1, "create_dynamic_method", ves_icall_DynamicMethod_create_dynamic_me
 ICALL_TYPE(ENUMB, "System.Reflection.Emit.EnumBuilder", ENUMB_1)
 ICALL(ENUMB_1, "setup_enum_type", ves_icall_EnumBuilder_setup_enum_type)
 
-ICALL_TYPE(GPARB, "System.Reflection.Emit.GenericTypeParameterBuilder", GPARB_1)
-ICALL(GPARB_1, "initialize", ves_icall_GenericTypeParameterBuilder_initialize_generic_parameter)
-
-ICALL_TYPE(METHODB, "System.Reflection.Emit.MethodBuilder", METHODB_1)
-ICALL(METHODB_1, "MakeGenericMethod", ves_icall_MethodBuilder_MakeGenericMethod)
-
 ICALL_TYPE(MODULEB, "System.Reflection.Emit.ModuleBuilder", MODULEB_10)
 ICALL(MODULEB_10, "GetRegisteredToken", ves_icall_ModuleBuilder_GetRegisteredToken)
 ICALL(MODULEB_8, "RegisterToken", ves_icall_ModuleBuilder_RegisterToken)
 ICALL(MODULEB_1, "WriteToFile", ves_icall_ModuleBuilder_WriteToFile)
 ICALL(MODULEB_2, "basic_init", ves_icall_ModuleBuilder_basic_init)
 ICALL(MODULEB_3, "build_metadata", ves_icall_ModuleBuilder_build_metadata)
-ICALL(MODULEB_4, "create_modified_type", ves_icall_ModuleBuilder_create_modified_type)
 ICALL(MODULEB_5, "getMethodToken", ves_icall_ModuleBuilder_getMethodToken)
 ICALL(MODULEB_6, "getToken", ves_icall_ModuleBuilder_getToken)
 ICALL(MODULEB_7, "getUSIndex", ves_icall_ModuleBuilder_getUSIndex)
@@ -567,19 +563,8 @@ ICALL_TYPE(SIGH, "System.Reflection.Emit.SignatureHelper", SIGH_1)
 ICALL(SIGH_1, "get_signature_field", ves_icall_SignatureHelper_get_signature_field)
 ICALL(SIGH_2, "get_signature_local", ves_icall_SignatureHelper_get_signature_local)
 
-#ifndef DISABLE_REFLECTION_EMIT
-ICALL_TYPE(SYMBOLTYPE, "System.Reflection.Emit.SymbolType", SYMBOLTYPE_1)
-ICALL(SYMBOLTYPE_1, "create_unmanaged_type", ves_icall_SymbolType_create_unmanaged_type)
-#endif
-
 ICALL_TYPE(TYPEB, "System.Reflection.Emit.TypeBuilder", TYPEB_1)
-ICALL(TYPEB_1, "create_generic_class", ves_icall_TypeBuilder_create_generic_class)
-ICALL(TYPEB_2, "create_internal_class", ves_icall_TypeBuilder_create_internal_class)
-ICALL(TYPEB_3, "create_runtime_class", ves_icall_TypeBuilder_create_runtime_class)
-ICALL(TYPEB_4, "get_IsGenericParameter", ves_icall_TypeBuilder_get_IsGenericParameter)
-ICALL(TYPEB_5, "get_event_info", ves_icall_TypeBuilder_get_event_info)
-ICALL(TYPEB_6, "setup_generic_class", ves_icall_TypeBuilder_setup_generic_class)
-ICALL(TYPEB_7, "setup_internal_class", ves_icall_TypeBuilder_setup_internal_class)
+ICALL(TYPEB_1, "create_runtime_class", ves_icall_TypeBuilder_create_runtime_class)
 
 ICALL_TYPE(EVENTI, "System.Reflection.EventInfo", EVENTI_1)
 ICALL(EVENTI_1, "internal_from_handle_type", ves_icall_System_Reflection_EventInfo_internal_from_handle_type)
@@ -600,7 +585,7 @@ ICALL(MBASE_4, "GetMethodFromHandleInternalType_native", ves_icall_System_Reflec
 ICALL_TYPE(MODULE, "System.Reflection.Module", MODULE_1)
 ICALL(MODULE_1, "Close", ves_icall_System_Reflection_Module_Close)
 ICALL(MODULE_2, "GetGlobalType", ves_icall_System_Reflection_Module_GetGlobalType)
-ICALL(MODULE_3, "GetGuidInternal", ves_icall_System_Reflection_Module_GetGuidInternal)
+HANDLES(ICALL(MODULE_3, "GetGuidInternal", ves_icall_System_Reflection_Module_GetGuidInternal))
 ICALL(MODULE_14, "GetHINSTANCE", ves_icall_System_Reflection_Module_GetHINSTANCE)
 ICALL(MODULE_4, "GetMDStreamVersion", ves_icall_System_Reflection_Module_GetMDStreamVersion)
 ICALL(MODULE_5, "GetPEKind", ves_icall_System_Reflection_Module_GetPEKind)
@@ -630,10 +615,6 @@ ICALL(MFIELD_6, "ResolveType", ves_icall_MonoField_ResolveType)
 ICALL(MFIELD_4, "SetValueInternal", ves_icall_MonoField_SetValueInternal)
 ICALL(MFIELD_7, "get_core_clr_security_level", ves_icall_MonoField_get_core_clr_security_level)
 
-ICALL_TYPE(MGENCL, "System.Reflection.MonoGenericClass", MGENCL_5)
-ICALL(MGENCL_5, "initialize", mono_reflection_generic_class_initialize)
-ICALL(MGENCL_6, "register_with_runtime", mono_reflection_register_with_runtime)
-
 ICALL_TYPE(MMETH, "System.Reflection.MonoMethod", MMETH_2)
 ICALL(MMETH_2, "GetGenericArguments", ves_icall_MonoMethod_GetGenericArguments)
 ICALL(MMETH_3, "GetGenericMethodDefinition_impl", ves_icall_MonoMethod_GetGenericMethodDefinition)
@@ -671,7 +652,7 @@ ICALL_TYPE(RUNH, "System.Runtime.CompilerServices.RuntimeHelpers", RUNH_1)
 ICALL(RUNH_1, "GetObjectValue", ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_GetObjectValue)
         /* REMOVEME: no longer needed, just so we dont break things when not needed */
 ICALL(RUNH_2, "GetOffsetToStringData", ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_GetOffsetToStringData)
-ICALL(RUNH_3, "InitializeArray", ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_InitializeArray)
+HANDLES(ICALL(RUNH_3, "InitializeArray", ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_InitializeArray))
 ICALL(RUNH_4, "RunClassConstructor", ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_RunClassConstructor)
 ICALL(RUNH_5, "RunModuleConstructor", ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_RunModuleConstructor)
 ICALL(RUNH_5h, "SufficientExecutionStack", ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_SufficientExecutionStack)
@@ -691,6 +672,7 @@ ICALL(MARSHAL_1, "AddRefInternal", ves_icall_System_Runtime_InteropServices_Mars
 ICALL_TYPE(MARSHAL, "System.Runtime.InteropServices.Marshal", MARSHAL_2)
 #endif
 ICALL(MARSHAL_2, "AllocCoTaskMem", ves_icall_System_Runtime_InteropServices_Marshal_AllocCoTaskMem)
+ICALL(MARSHAL_51,"AllocCoTaskMemSize(uintptr)", ves_icall_System_Runtime_InteropServices_Marshal_AllocCoTaskMemSize)
 ICALL(MARSHAL_3, "AllocHGlobal", ves_icall_System_Runtime_InteropServices_Marshal_AllocHGlobal)
 ICALL(MARSHAL_50, "BufferToBSTR", ves_icall_System_Runtime_InteropServices_Marshal_BufferToBSTR)
 ICALL(MARSHAL_4, "DestroyStructure", ves_icall_System_Runtime_InteropServices_Marshal_DestroyStructure)
@@ -704,12 +686,15 @@ ICALL(MARSHAL_8, "GetComSlotForMethodInfoInternal", ves_icall_System_Runtime_Int
 ICALL(MARSHAL_9, "GetDelegateForFunctionPointerInternal", ves_icall_System_Runtime_InteropServices_Marshal_GetDelegateForFunctionPointerInternal)
 ICALL(MARSHAL_10, "GetFunctionPointerForDelegateInternal", ves_icall_System_Runtime_InteropServices_Marshal_GetFunctionPointerForDelegateInternal)
 #ifndef DISABLE_COM
+ICALL(MARSHAL_52, "GetHRForException_WinRT", ves_icall_System_Runtime_InteropServices_Marshal_GetHRForException_WinRT)
 ICALL(MARSHAL_45, "GetIDispatchForObjectInternal", ves_icall_System_Runtime_InteropServices_Marshal_GetIDispatchForObjectInternal)
 ICALL(MARSHAL_46, "GetIUnknownForObjectInternal", ves_icall_System_Runtime_InteropServices_Marshal_GetIUnknownForObjectInternal)
 #endif
 ICALL(MARSHAL_11, "GetLastWin32Error", ves_icall_System_Runtime_InteropServices_Marshal_GetLastWin32Error)
 #ifndef DISABLE_COM
+ICALL(MARSHAL_53, "GetNativeActivationFactory", ves_icall_System_Runtime_InteropServices_Marshal_GetNativeActivationFactory)
 ICALL(MARSHAL_47, "GetObjectForCCW", ves_icall_System_Runtime_InteropServices_Marshal_GetObjectForCCW)
+ICALL(MARSHAL_54, "GetRawIUnknownForComObjectNoAddRef", ves_icall_System_Runtime_InteropServices_Marshal_GetRawIUnknownForComObjectNoAddRef)
 ICALL(MARSHAL_48, "IsComObject", ves_icall_System_Runtime_InteropServices_Marshal_IsComObject)
 #endif
 ICALL(MARSHAL_12, "OffsetOf", ves_icall_System_Runtime_InteropServices_Marshal_OffsetOf)
@@ -717,9 +702,7 @@ ICALL(MARSHAL_13, "Prelink", ves_icall_System_Runtime_InteropServices_Marshal_Pr
 ICALL(MARSHAL_14, "PrelinkAll", ves_icall_System_Runtime_InteropServices_Marshal_PrelinkAll)
 ICALL(MARSHAL_15, "PtrToStringAnsi(intptr)", ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringAnsi)
 ICALL(MARSHAL_16, "PtrToStringAnsi(intptr,int)", ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringAnsi_len)
-#ifndef DISABLE_COM
 ICALL(MARSHAL_17, "PtrToStringBSTR", ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringBSTR)
-#endif
 ICALL(MARSHAL_18, "PtrToStringUni(intptr)", ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringUni)
 ICALL(MARSHAL_19, "PtrToStringUni(intptr,int)", ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringUni_len)
 ICALL(MARSHAL_20, "PtrToStructure(intptr,System.Type)", ves_icall_System_Runtime_InteropServices_Marshal_PtrToStructure_type)
@@ -743,6 +726,16 @@ ICALL(MARSHAL_35, "UnsafeAddrOfPinnedArrayElement", ves_icall_System_Runtime_Int
 ICALL(MARSHAL_41, "copy_from_unmanaged", ves_icall_System_Runtime_InteropServices_Marshal_copy_from_unmanaged)
 ICALL(MARSHAL_42, "copy_to_unmanaged", ves_icall_System_Runtime_InteropServices_Marshal_copy_to_unmanaged)
 
+#ifndef DISABLE_COM
+ICALL_TYPE(WINDOWSRUNTIME_UNM, "System.Runtime.InteropServices.WindowsRuntime.UnsafeNativeMethods", WINDOWSRUNTIME_UNM_0)
+ICALL(WINDOWSRUNTIME_UNM_0, "GetRestrictedErrorInfo", ves_icall_System_Runtime_InteropServices_WindowsRuntime_UnsafeNativeMethods_GetRestrictedErrorInfo)
+ICALL(WINDOWSRUNTIME_UNM_1, "RoOriginateLanguageException", ves_icall_System_Runtime_InteropServices_WindowsRuntime_UnsafeNativeMethods_RoOriginateLanguageException)
+ICALL(WINDOWSRUNTIME_UNM_2, "RoReportUnhandledError", ves_icall_System_Runtime_InteropServices_WindowsRuntime_UnsafeNativeMethods_RoReportUnhandledError)
+ICALL(WINDOWSRUNTIME_UNM_3, "WindowsCreateString", ves_icall_System_Runtime_InteropServices_WindowsRuntime_UnsafeNativeMethods_WindowsCreateString)
+ICALL(WINDOWSRUNTIME_UNM_4, "WindowsDeleteString", ves_icall_System_Runtime_InteropServices_WindowsRuntime_UnsafeNativeMethods_WindowsDeleteString)
+ICALL(WINDOWSRUNTIME_UNM_5, "WindowsGetStringRawBuffer", ves_icall_System_Runtime_InteropServices_WindowsRuntime_UnsafeNativeMethods_WindowsGetStringRawBuffer)
+#endif
+
 ICALL_TYPE(ACTS, "System.Runtime.Remoting.Activation.ActivationServices", ACTS_1)
 ICALL(ACTS_1, "AllocateUninitializedClassInstance", ves_icall_System_Runtime_Activation_ActivationServices_AllocateUninitializedClassInstance)
 ICALL(ACTS_2, "EnableProxyActivation", ves_icall_System_Runtime_Activation_ActivationServices_EnableProxyActivation)
@@ -798,8 +791,8 @@ ICALL(RT_18, "MakePointerType", ves_icall_RuntimeType_MakePointerType)
 HANDLES(ICALL(RT_19, "getFullName", ves_icall_System_RuntimeType_getFullName))
 ICALL(RT_21, "get_DeclaringMethod", ves_icall_RuntimeType_get_DeclaringMethod)
 ICALL(RT_22, "get_DeclaringType", ves_icall_RuntimeType_get_DeclaringType)
-ICALL(RT_23, "get_Name", ves_icall_RuntimeType_get_Name)
-ICALL(RT_24, "get_Namespace", ves_icall_RuntimeType_get_Namespace)
+HANDLES(ICALL(RT_23, "get_Name", ves_icall_RuntimeType_get_Name))
+HANDLES(ICALL(RT_24, "get_Namespace", ves_icall_RuntimeType_get_Namespace))
 ICALL(RT_25, "get_core_clr_security_level", vell_icall_RuntimeType_get_core_clr_security_level)
 ICALL(RT_26, "make_array_type", ves_icall_RuntimeType_make_array_type)
 ICALL(RT_27, "make_byref_type", ves_icall_RuntimeType_make_byref_type)
@@ -924,8 +917,8 @@ ICALL(MUTEX_3, "ReleaseMutex_internal(intptr)", ves_icall_System_Threading_Mutex
 
 ICALL_TYPE(NATIVEC, "System.Threading.NativeEventCalls", NATIVEC_1)
 ICALL(NATIVEC_1, "CloseEvent_internal", ves_icall_System_Threading_Events_CloseEvent_internal)
-ICALL(NATIVEC_2, "CreateEvent_internal(bool,bool,string,bool&)", ves_icall_System_Threading_Events_CreateEvent_internal)
-ICALL(NATIVEC_3, "OpenEvent_internal(string,System.Security.AccessControl.EventWaitHandleRights,System.IO.MonoIOError&)", ves_icall_System_Threading_Events_OpenEvent_internal)
+ICALL(NATIVEC_2, "CreateEvent_internal(bool,bool,string,int&)", ves_icall_System_Threading_Events_CreateEvent_internal)
+ICALL(NATIVEC_3, "OpenEvent_internal(string,System.Security.AccessControl.EventWaitHandleRights,int&)", ves_icall_System_Threading_Events_OpenEvent_internal)
 ICALL(NATIVEC_4, "ResetEvent_internal",  ves_icall_System_Threading_Events_ResetEvent_internal)
 ICALL(NATIVEC_5, "SetEvent_internal",    ves_icall_System_Threading_Events_SetEvent_internal)
 
diff --git a/mono/metadata/icall-internals.h b/mono/metadata/icall-internals.h
new file mode 100644 (file)
index 0000000..45a922c
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2016 Microsoft
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
+ */
+#ifndef __MONO_METADATA_ICALL_INTERNALS_H__
+#define __MONO_METADATA_ICALL_INTERNALS_H__
+
+#include <config.h>
+#include <glib.h>
+#include <mono/metadata/object-internals.h>
+
+// On Windows platform implementation of bellow methods are hosted in separate source file
+// icall-windows.c or icall-windows-*.c. On other platforms the implementation is still keept
+// in icall.c still declared as static and in some places even inlined.
+#ifdef HOST_WIN32
+void
+mono_icall_make_platform_path (gchar *path);
+
+const gchar *
+mono_icall_get_file_path_prefix (const gchar *path);
+
+gpointer
+mono_icall_module_get_hinstance (MonoReflectionModule *module);
+
+MonoString *
+mono_icall_get_machine_name (void);
+
+int
+mono_icall_get_platform (void);
+
+MonoString *
+mono_icall_get_new_line (void);
+
+MonoBoolean
+mono_icall_is_64bit_os (void);
+
+MonoArray *
+mono_icall_get_environment_variable_names (void);
+
+void
+mono_icall_set_environment_variable (MonoString *name, MonoString *value);
+
+MonoString *
+mono_icall_get_windows_folder_path (int folder);
+
+void
+mono_icall_broadcast_setting_change (void);
+
+void
+mono_icall_write_windows_debug_string (MonoString *message);
+
+gint32
+mono_icall_wait_for_input_idle (gpointer handle, gint32 milliseconds);
+#endif  /* HOST_WIN32 */
+
+// On platforms not using classic WIN API support the  implementation of bellow methods are hosted in separate source file
+// icall-windows-*.c. On platforms using classic WIN API the implementation is still keept in icall.c and still declared
+// static and in some places even inlined.
+#if !G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
+MonoArray *
+mono_icall_get_logical_drives (void);
+
+guint32
+mono_icall_drive_info_get_drive_type (MonoString *root_path_name);
+#endif  /* !G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */
+
+#endif /* __MONO_METADATA_ICALL_INTERNALS_H__ */
diff --git a/mono/metadata/icall-windows-internals.h b/mono/metadata/icall-windows-internals.h
new file mode 100644 (file)
index 0000000..0093767
--- /dev/null
@@ -0,0 +1,18 @@
+/*
+ * Copyright 2016 Microsoft
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
+ */
+#ifndef __MONO_METADATA_ICALL_WINDOWS_INTERNALS_H__
+#define __MONO_METADATA_ICALL_WINDOWS_INTERNALS_H__
+
+#include <config.h>
+#include <glib.h>
+
+#ifdef HOST_WIN32
+#include "mono/metadata/icall-internals.h"
+#include "mono/metadata/object.h"
+#include "mono/metadata/object-internals.h"
+#include "mono/metadata/class.h"
+#include "mono/metadata/class-internals.h"
+#endif /* HOST_WIN32 */
+#endif /* __MONO_METADATA_ICALL_WINDOWS_INTERNALS_H__ */
diff --git a/mono/metadata/icall-windows-uwp.c b/mono/metadata/icall-windows-uwp.c
new file mode 100644 (file)
index 0000000..f43e22f
--- /dev/null
@@ -0,0 +1,92 @@
+/*
+ * icall-windows-uwp.c: UWP icall support for Mono.
+ *
+ * Copyright 2016 Microsoft
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
+*/
+#include <config.h>
+#include <glib.h>
+#include "mono/utils/mono-compiler.h"
+
+#if G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT)
+#include <windows.h>
+#include "mono/metadata/icall-windows-internals.h"
+
+MonoString *
+mono_icall_get_machine_name (void)
+{
+       g_unsupported_api ("GetComputerName");
+       return mono_string_new (mono_domain_get (), "mono");
+}
+
+MonoString *
+mono_icall_get_windows_folder_path (int folder)
+{
+       g_unsupported_api ("SHGetFolderPath");
+       return mono_string_new (mono_domain_get (), "");
+}
+
+MonoArray *
+mono_icall_get_logical_drives (void)
+{
+       MonoError mono_error;
+       mono_error_init (&mono_error);
+
+       g_unsupported_api ("GetLogicalDriveStrings");
+
+       mono_error_set_not_supported (&mono_error, G_UNSUPPORTED_API, "GetLogicalDriveStrings");
+       mono_error_set_pending_exception (&mono_error);
+
+       SetLastError (ERROR_NOT_SUPPORTED);
+
+       return NULL;
+}
+
+void
+mono_icall_broadcast_setting_change (void)
+{
+       MonoError mono_error;
+       mono_error_init (&mono_error);
+
+       g_unsupported_api ("SendMessageTimeout");
+
+       mono_error_set_not_supported (&mono_error, G_UNSUPPORTED_API, "SendMessageTimeout");
+       mono_error_set_pending_exception (&mono_error);
+
+       SetLastError (ERROR_NOT_SUPPORTED);
+
+       return;
+}
+
+guint32
+mono_icall_drive_info_get_drive_type (MonoString *root_path_name)
+{
+       MonoError mono_error;
+       mono_error_init (&mono_error);
+
+       g_unsupported_api ("GetDriveType");
+
+       mono_error_set_not_supported (&mono_error, G_UNSUPPORTED_API, "GetDriveType");
+       mono_error_set_pending_exception (&mono_error);
+
+       return DRIVE_UNKNOWN;
+}
+
+gint32
+mono_icall_wait_for_input_idle (gpointer handle, gint32 milliseconds)
+{
+       MonoError mono_error;
+       mono_error_init (&mono_error);
+
+       g_unsupported_api ("WaitForInputIdle");
+
+       mono_error_set_not_supported (&mono_error, G_UNSUPPORTED_API, "WaitForInputIdle");
+       mono_error_set_pending_exception (&mono_error);
+
+       return WAIT_TIMEOUT;
+}
+
+#else /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
+
+MONO_EMPTY_SOURCE_FILE (icall_windows_uwp);
+#endif /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
diff --git a/mono/metadata/icall-windows.c b/mono/metadata/icall-windows.c
new file mode 100644 (file)
index 0000000..9ebcf30
--- /dev/null
@@ -0,0 +1,216 @@
+/*
+ * icall-windows.c: Windows icall support.
+ *
+ * Copyright 2016 Microsoft
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
+ */
+#include <config.h>
+#include <glib.h>
+
+#if defined(HOST_WIN32)
+#include <winsock2.h>
+#include <windows.h>
+#include "mono/metadata/icall-windows-internals.h"
+
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
+#include <shlobj.h>
+#endif
+
+void
+mono_icall_make_platform_path (gchar *path)
+{
+       for (size_t i = strlen (path); i > 0; i--)
+               if (path [i-1] == '\\')
+                       path [i-1] = '/';
+}
+
+const gchar *
+mono_icall_get_file_path_prefix (const gchar *path)
+{
+       if (*path == '/' && *(path + 1) == '/') {
+               return "file:";
+       } else {
+               return "file:///";
+       }
+}
+
+gpointer
+mono_icall_module_get_hinstance (MonoReflectionModule *module)
+{
+       if (module->image && module->image->is_module_handle)
+               return module->image->raw_data;
+
+       return (gpointer) (-1);
+}
+
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
+MonoString *
+mono_icall_get_machine_name (void)
+{
+       gunichar2 *buf;
+       guint32 len;
+       MonoString *result;
+
+       len = MAX_COMPUTERNAME_LENGTH + 1;
+       buf = g_new (gunichar2, len);
+
+       result = NULL;
+       if (GetComputerName (buf, (PDWORD) &len)) {
+               MonoError error;
+               result = mono_string_new_utf16_checked (mono_domain_get (), buf, len, &error);
+               mono_error_set_pending_exception (&error);
+       }
+
+       g_free (buf);
+       return result;
+}
+#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */
+
+int
+mono_icall_get_platform (void)
+{
+       /* Win32NT */
+       return 2;
+}
+
+MonoString *
+mono_icall_get_new_line (void)
+{
+       return mono_string_new (mono_domain_get (), "\r\n");
+}
+
+MonoBoolean
+mono_icall_is_64bit_os (void)
+{
+#if SIZEOF_VOID_P == 8
+       return TRUE;
+#else
+       gboolean isWow64Process = FALSE;
+       if (IsWow64Process (GetCurrentProcess (), &isWow64Process)) {
+               return (MonoBoolean)isWow64Process;
+       }
+       return FALSE;
+#endif
+}
+
+MonoArray *
+mono_icall_get_environment_variable_names (void)
+{
+       MonoError error;
+       MonoArray *names;
+       MonoDomain *domain;
+       MonoString *str;
+       WCHAR* env_strings;
+       WCHAR* env_string;
+       WCHAR* equal_str;
+       int n = 0;
+
+       env_strings = GetEnvironmentStrings();
+
+       if (env_strings) {
+               env_string = env_strings;
+               while (*env_string != '\0') {
+               /* weird case that MS seems to skip */
+                       if (*env_string != '=')
+                               n++;
+                       while (*env_string != '\0')
+                               env_string++;
+                       env_string++;
+               }
+       }
+
+       domain = mono_domain_get ();
+       names = mono_array_new_checked (domain, mono_defaults.string_class, n, &error);
+       if (mono_error_set_pending_exception (&error))
+               return NULL;
+
+       if (env_strings) {
+               n = 0;
+               env_string = env_strings;
+               while (*env_string != '\0') {
+                       /* weird case that MS seems to skip */
+                       if (*env_string != '=') {
+                               equal_str = wcschr(env_string, '=');
+                               g_assert(equal_str);
+                               str = mono_string_new_utf16_checked (domain, env_string, (gint32)(equal_str - env_string), &error);
+                               if (mono_error_set_pending_exception (&error))
+                                       return NULL;
+
+                               mono_array_setref (names, n, str);
+                               n++;
+                       }
+                       while (*env_string != '\0')
+                               env_string++;
+                       env_string++;
+               }
+
+               FreeEnvironmentStrings (env_strings);
+       }
+
+       return names;
+}
+
+void
+mono_icall_set_environment_variable (MonoString *name, MonoString *value)
+{
+       gunichar2 *utf16_name, *utf16_value;
+
+       utf16_name = mono_string_to_utf16 (name);
+       if ((value == NULL) || (mono_string_length (value) == 0) || (mono_string_chars (value)[0] == 0)) {
+               SetEnvironmentVariable (utf16_name, NULL);
+               g_free (utf16_name);
+               return;
+       }
+
+       utf16_value = mono_string_to_utf16 (value);
+
+       SetEnvironmentVariable (utf16_name, utf16_value);
+
+       g_free (utf16_name);
+       g_free (utf16_value);
+}
+
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
+MonoString *
+mono_icall_get_windows_folder_path (int folder)
+{
+       #ifndef CSIDL_FLAG_CREATE
+               #define CSIDL_FLAG_CREATE       0x8000
+       #endif
+
+       WCHAR path [MAX_PATH];
+       /* Create directory if no existing */
+       if (SUCCEEDED (SHGetFolderPathW (NULL, folder | CSIDL_FLAG_CREATE, NULL, 0, path))) {
+               int len = 0;
+               while (path [len])
+                       ++ len;
+               MonoError error;
+               MonoString *res = mono_string_new_utf16_checked (mono_domain_get (), path, len, &error);
+               mono_error_set_pending_exception (&error);
+               return res;
+       }
+       return mono_string_new (mono_domain_get (), "");
+}
+#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */
+
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
+void
+mono_icall_broadcast_setting_change (void)
+{
+       SendMessageTimeout (HWND_BROADCAST, WM_SETTINGCHANGE, (WPARAM)NULL, (LPARAM)L"Environment", SMTO_ABORTIFHUNG, 2000, 0);
+}
+
+gint32
+mono_icall_wait_for_input_idle (gpointer handle, gint32 milliseconds)
+{
+       return WaitForInputIdle (handle, milliseconds);
+}
+#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */
+
+void
+mono_icall_write_windows_debug_string (MonoString *message)
+{
+       OutputDebugString (mono_string_chars (message));
+}
+
+#endif /* HOST_WIN32 */
index 4825e86d16512a8a17e1bd80fde8f7af93995fe6..2689b7d39b1b1e31d960d01cd068fc3e2aae5aa1 100644 (file)
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
-#if defined (HOST_WIN32)
-#include <stdlib.h>
-#endif
 #if defined (HAVE_WCHAR_H)
 #include <wchar.h>
 #endif
-
+#include "mono/metadata/icall-internals.h"
 #include "mono/utils/mono-membar.h"
 #include <mono/metadata/object.h>
 #include <mono/metadata/threads.h>
@@ -43,7 +40,9 @@
 #include <mono/metadata/threadpool-ms-io.h>
 #include <mono/metadata/monitor.h>
 #include <mono/metadata/reflection.h>
+#include <mono/metadata/image-internals.h>
 #include <mono/metadata/assembly.h>
+#include <mono/metadata/assembly-internals.h>
 #include <mono/metadata/tabledefs.h>
 #include <mono/metadata/exception.h>
 #include <mono/metadata/exception-internals.h>
@@ -64,7 +63,7 @@
 #include <mono/metadata/sysmath.h>
 #include <mono/metadata/string-icalls.h>
 #include <mono/metadata/debug-helpers.h>
-#include <mono/metadata/process.h>
+#include <mono/metadata/w32process.h>
 #include <mono/metadata/environment.h>
 #include <mono/metadata/profiler-private.h>
 #include <mono/metadata/locales.h>
@@ -83,6 +82,9 @@
 #include <mono/metadata/file-mmap.h>
 #include <mono/metadata/seq-points-data.h>
 #include <mono/metadata/handle.h>
+#include <mono/metadata/w32mutex.h>
+#include <mono/metadata/w32semaphore.h>
+#include <mono/metadata/w32event.h>
 #include <mono/io-layer/io-layer.h>
 #include <mono/utils/monobitset.h>
 #include <mono/utils/mono-time.h>
 #include <mono/utils/mono-os-mutex.h>
 #include <mono/utils/mono-threads.h>
 
-#if defined (HOST_WIN32)
-#include <windows.h>
-#include <shlobj.h>
-#endif
 #include "decimal-ms.h"
 #include "number-ms.h"
 
@@ -111,8 +109,6 @@ extern MonoString* ves_icall_System_Environment_GetOSVersionString (void);
 
 ICALL_EXPORT MonoReflectionAssembly* ves_icall_System_Reflection_Assembly_GetCallingAssembly (void);
 
-TYPED_HANDLE_DECL (MonoReflectionType);
-
 /* Lazy class loading functions */
 static GENERATE_GET_CLASS_WITH_CACHE (system_version, System, Version)
 static GENERATE_GET_CLASS_WITH_CACHE (assembly_name, System.Reflection, AssemblyName)
@@ -139,6 +135,20 @@ mono_class_init_checked (MonoClass *klass, MonoError *error)
                mono_error_set_for_class_failure (error, klass);
 }
 
+#ifndef HOST_WIN32
+static inline void
+mono_icall_make_platform_path (gchar *path)
+{
+       return;
+}
+
+static inline const gchar *
+mono_icall_get_file_path_prefix (const gchar *path)
+{
+       return "file://";
+}
+#endif /* HOST_WIN32 */
+
 ICALL_EXPORT MonoObject *
 ves_icall_System_Array_GetValueImpl (MonoArray *arr, guint32 pos)
 {
@@ -831,41 +841,37 @@ ves_icall_System_Array_SetGenericValueImpl (MonoArray *arr, guint32 pos, gpointe
 }
 
 ICALL_EXPORT void
-ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_InitializeArray (MonoArray *array, MonoClassField *field_handle)
+ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_InitializeArray (MonoArrayHandle array, MonoClassField *field_handle, MonoError *error)
 {
-       MonoClass *klass = array->obj.vtable->klass;
+       mono_error_init (error);
+
+       MonoClass *klass = mono_handle_class (array);
        guint32 size = mono_array_element_size (klass);
        MonoType *type = mono_type_get_underlying_type (&klass->element_class->byval_arg);
        int align;
        const char *field_data;
 
        if (MONO_TYPE_IS_REFERENCE (type) || type->type == MONO_TYPE_VALUETYPE) {
-               MonoException *exc = mono_get_exception_argument("array",
-                       "Cannot initialize array of non-primitive type.");
-               mono_set_pending_exception (exc);
+               mono_error_set_argument (error, "array", "Cannot initialize array of non-primitive type");
                return;
        }
 
        if (!(field_handle->type->attrs & FIELD_ATTRIBUTE_HAS_FIELD_RVA)) {
-               MonoException *exc = mono_get_exception_argument("field_handle",
-                       "Field doesn't have an RVA");
-               mono_set_pending_exception (exc);
+               mono_error_set_argument (error, "field_handle", "Field '%s' doesn't have an RVA", mono_field_get_name (field_handle));
                return;
        }
 
-       size *= array->max_length;
+       size *= MONO_HANDLE_GETVAL(array, max_length);
        field_data = mono_field_get_data (field_handle);
 
        if (size > mono_type_size (field_handle->type, &align)) {
-               MonoException *exc = mono_get_exception_argument("field_handle",
-                       "Field not large enough to fill array");
-               mono_set_pending_exception (exc);
+               mono_error_set_argument (error, "field_handle", "Field not large enough to fill array");
                return;
        }
 
 #if G_BYTE_ORDER != G_LITTLE_ENDIAN
 #define SWAP(n) {                                                              \
-       guint ## n *data = (guint ## n *) mono_array_addr (array, char, 0);     \
+       guint ## n *data = (guint ## n *) mono_array_addr (MONO_HANDLE_RAW(array), char, 0); \
        guint ## n *src = (guint ## n *) field_data;                            \
        int i,                                                                  \
            nEnt = (size / sizeof(guint ## n));                                 \
@@ -894,11 +900,11 @@ ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_InitializeArray (MonoAr
                SWAP (64);
                break;
        default:
-               memcpy (mono_array_addr (array, char, 0), field_data, size);
+               memcpy (mono_array_addr (MONO_HANDLE_RAW(array), char, 0), field_data, size);
                break;
        }
 #else
-       memcpy (mono_array_addr (array, char, 0), field_data, size);
+       memcpy (mono_array_addr (MONO_HANDLE_RAW(array), char, 0), field_data, size);
 #endif
 }
 
@@ -934,7 +940,7 @@ ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_RunClassConstructor (Mo
        klass = mono_class_from_mono_type (handle);
        MONO_CHECK_ARG (handle, klass,);
 
-       if (klass->generic_container)
+       if (mono_class_is_gtd (klass))
                return;
 
        vtable = mono_class_vtable_full (mono_domain_get (), klass, &error);
@@ -974,20 +980,24 @@ ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_RunModuleConstructor (M
 ICALL_EXPORT MonoBoolean
 ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_SufficientExecutionStack (void)
 {
+#if defined(TARGET_WIN32) || defined(HOST_WIN32)
+       // It does not work on win32
+#else
        guint8 *stack_addr;
        guint8 *current;
        size_t stack_size;
-       /* later make this configurable and per-arch */
-       int min_size = 4096 * 4 * sizeof (void*);
+       int min_size;
+       MonoInternalThread *thread;
+
        mono_thread_info_get_stack_bounds (&stack_addr, &stack_size);
        /* if we have no info we are optimistic and assume there is enough room */
        if (!stack_addr)
                return TRUE;
-#ifdef HOST_WIN32
-       // FIXME: Windows dynamically extends the stack, so stack_addr might be close
-       // to the current sp
-       return TRUE;
-#endif
+
+       thread = mono_thread_internal_current ();
+       // .net seems to check that at least 50% of stack is available
+       min_size = thread->stack_size / 2;
+
        current = (guint8 *)&stack_addr;
        if (current > stack_addr) {
                if ((current - stack_addr) < min_size)
@@ -996,6 +1006,7 @@ ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_SufficientExecutionStac
                if (current - (stack_addr - stack_size) < min_size)
                        return FALSE;
        }
+#endif
        return TRUE;
 }
 
@@ -1287,7 +1298,7 @@ get_caller_no_system_or_reflection (MonoMethod *m, gint32 no, gint32 ilo, gboole
 }
 
 static MonoReflectionType *
-type_from_parsed_name (MonoTypeNameParse *info, MonoBoolean ignoreCase, MonoError *error)
+type_from_parsed_name (MonoTypeNameParse *info, MonoBoolean ignoreCase, MonoAssembly **caller_assembly, MonoError *error)
 {
        MonoMethod *m, *dest;
 
@@ -1338,6 +1349,7 @@ type_from_parsed_name (MonoTypeNameParse *info, MonoBoolean ignoreCase, MonoErro
        } else {
                g_warning (G_STRLOC);
        }
+       *caller_assembly = assembly;
 
        if (info->assembly.name)
                assembly = mono_assembly_load (&info->assembly, assembly ? assembly->basedir : NULL, NULL);
@@ -1382,6 +1394,7 @@ ves_icall_System_Type_internal_from_name (MonoString *name,
        MonoTypeNameParse info;
        MonoReflectionType *type = NULL;
        gboolean parsedOk;
+       MonoAssembly *caller_assembly;
 
        char *str = mono_string_to_utf8_checked (name, &error);
        if (!is_ok (&error))
@@ -1397,18 +1410,27 @@ ves_icall_System_Type_internal_from_name (MonoString *name,
                goto leave;
        }
 
-       type = type_from_parsed_name (&info, ignoreCase, &error);
-
-       mono_reflection_free_type_info (&info);
+       type = type_from_parsed_name (&info, ignoreCase, &caller_assembly, &error);
 
-       if (!is_ok (&error))
+       if (!is_ok (&error)) {
+               mono_reflection_free_type_info (&info);
                goto leave;
+       }
 
-       if (type == NULL){
+       if (type == NULL) {
                if (throwOnError) {
-                       mono_error_set_type_load_name (&error, g_strdup (str), NULL, "");
-                       goto leave;
+                       char *tname = info.name_space ? g_strdup_printf ("%s.%s", info.name_space, info.name) : g_strdup (info.name);
+                       char *aname;
+                       if (info.assembly.name)
+                               aname = mono_stringify_assembly_name (&info.assembly);
+                       else if (caller_assembly)
+                               aname = mono_stringify_assembly_name (mono_assembly_get_name (caller_assembly));
+                       else
+                               aname = g_strdup ("");
+                       mono_error_set_type_load_name (&error, tname, aname, "");
                }
+               mono_reflection_free_type_info (&info);
+               goto leave;
        }
        
 leave:
@@ -1644,7 +1666,7 @@ ICALL_EXPORT guint32
 ves_icall_RuntimeTypeHandle_GetAttributes (MonoReflectionType *type)
 {
        MonoClass *klass = mono_class_from_mono_type (type->type);
-       return klass->flags;
+       return mono_class_get_flags (klass);
 }
 
 ICALL_EXPORT MonoReflectionMarshalAsAttribute*
@@ -1656,8 +1678,9 @@ ves_icall_System_Reflection_FieldInfo_get_marshal_info (MonoReflectionField *fie
        MonoType *ftype;
        int i;
 
-       if (klass->generic_container ||
-           (klass->generic_class && klass->generic_class->context.class_inst->is_open))
+       MonoGenericClass *gklass = mono_class_try_get_generic_class (klass);
+       if (mono_class_is_gtd (klass) ||
+           (gklass && gklass->context.class_inst->is_open))
                return NULL;
 
        ftype = mono_field_get_type (field->field);
@@ -1867,9 +1890,7 @@ ICALL_EXPORT gint32
 ves_icall_MonoField_GetFieldOffset (MonoReflectionField *field)
 {
        MonoClass *parent = field->field->parent;
-       if (!parent->size_inited)
-               mono_class_init (parent);
-       mono_class_setup_fields_locking (parent);
+       mono_class_setup_fields (parent);
 
        return field->field->offset - sizeof (MonoObject);
 }
@@ -2073,12 +2094,13 @@ ves_icall_MonoField_GetRawConstantValue (MonoReflectionField *rfield)
        if (image_is_dynamic (field->parent->image)) {
                MonoClass *klass = field->parent;
                int fidx = field - klass->fields;
+               MonoClassExt *ext = mono_class_get_ext (klass);
+
+               g_assert (ext);
+               g_assert (ext->field_def_values);
+               def_type = ext->field_def_values [fidx].def_type;
+               def_value = ext->field_def_values [fidx].data;
 
-               g_assert (fidx >= 0 && fidx < klass->field.count);
-               g_assert (klass->ext);
-               g_assert (klass->ext->field_def_values);
-               def_type = klass->ext->field_def_values [fidx].def_type;
-               def_value = klass->ext->field_def_values [fidx].data;
                if (def_type == MONO_TYPE_END) {
                        mono_set_pending_exception (mono_get_exception_invalid_operation (NULL));
                        return NULL;
@@ -2345,7 +2367,7 @@ fill_iface_array (gpointer key, gpointer value, gpointer user_data)
        if (!mono_error_ok (data->error))
                return;
 
-       if (data->context && ic->generic_class && ic->generic_class->context.class_inst->is_open) {
+       if (data->context && mono_class_is_ginst (ic) && mono_class_get_generic_class (ic)->context.class_inst->is_open) {
                inflated = ret = mono_class_inflate_generic_type_checked (ret, data->context, data->error);
                if (!mono_error_ok (data->error))
                        return;
@@ -2380,9 +2402,9 @@ ves_icall_RuntimeType_GetInterfaces (MonoReflectionType* type)
 
        GHashTable *iface_hash = g_hash_table_new (get_interfaces_hash, NULL);
 
-       if (klass->generic_class && klass->generic_class->context.class_inst->is_open) {
+       if (mono_class_is_ginst (klass) && mono_class_get_generic_class (klass)->context.class_inst->is_open) {
                data.context = mono_class_get_context (klass);
-               klass = klass->generic_class->container_class;
+               klass = mono_class_get_generic_class (klass)->container_class;
        }
 
        for (parent = klass; parent; parent = parent->parent) {
@@ -2638,37 +2660,38 @@ ves_icall_RuntimeType_get_DeclaringType (MonoReflectionType *type)
        return ret;
 }
 
-ICALL_EXPORT MonoString*
-ves_icall_RuntimeType_get_Name (MonoReflectionType *type)
+ICALL_EXPORT MonoStringHandle
+ves_icall_RuntimeType_get_Name (MonoReflectionTypeHandle reftype, MonoError *error)
 {
-       MonoDomain *domain = mono_domain_get (); 
-       MonoClass *klass = mono_class_from_mono_type (type->type);
+       MonoDomain *domain = mono_domain_get ();
+       MonoType *type = MONO_HANDLE_RAW(reftype)->type; 
+       MonoClass *klass = mono_class_from_mono_type (type);
 
-       if (type->type->byref) {
+       if (type->byref) {
                char *n = g_strdup_printf ("%s&", klass->name);
-               MonoString *res = mono_string_new (domain, n);
+               MonoStringHandle res = mono_string_new_handle (domain, n, error);
 
                g_free (n);
 
                return res;
        } else {
-               return mono_string_new (domain, klass->name);
+               return mono_string_new_handle (domain, klass->name, error);
        }
 }
 
-ICALL_EXPORT MonoString*
-ves_icall_RuntimeType_get_Namespace (MonoReflectionType *type)
+ICALL_EXPORT MonoStringHandle
+ves_icall_RuntimeType_get_Namespace (MonoReflectionTypeHandle type, MonoError *error)
 {
        MonoDomain *domain = mono_domain_get (); 
-       MonoClass *klass = mono_class_from_mono_type (type->type);
+       MonoClass *klass = mono_class_from_mono_type_handle (type);
 
        while (klass->nested_in)
                klass = klass->nested_in;
 
        if (klass->name_space [0] == '\0')
-               return NULL;
+               return NULL_HANDLE_STRING;
        else
-               return mono_string_new (domain, klass->name_space);
+               return mono_string_new_handle (domain, klass->name_space, error);
 }
 
 ICALL_EXPORT gint32
@@ -2704,8 +2727,8 @@ ves_icall_RuntimeType_GetGenericArguments (MonoReflectionType *type, MonoBoolean
 
        klass = mono_class_from_mono_type (type->type);
 
-       if (klass->generic_container) {
-               MonoGenericContainer *container = klass->generic_container;
+       if (mono_class_is_gtd (klass)) {
+               MonoGenericContainer *container = mono_class_get_generic_container (klass);
                res = create_type_array (domain, runtimeTypeArray, container->type_argc, &error);
                if (mono_error_set_pending_exception (&error))
                        return NULL;
@@ -2718,8 +2741,8 @@ ves_icall_RuntimeType_GetGenericArguments (MonoReflectionType *type, MonoBoolean
 
                        mono_array_setref (res, i, rt);
                }
-       } else if (klass->generic_class) {
-               MonoGenericInst *inst = klass->generic_class->context.class_inst;
+       } else if (mono_class_is_ginst (klass)) {
+               MonoGenericInst *inst = mono_class_get_generic_class (klass)->context.class_inst;
                res = create_type_array (domain, runtimeTypeArray, inst->type_argc, &error);
                if (mono_error_set_pending_exception (&error))
                        return NULL;
@@ -2748,7 +2771,7 @@ ves_icall_RuntimeTypeHandle_IsGenericTypeDefinition (MonoReflectionType *type)
                return FALSE;
 
        klass = mono_class_from_mono_type (type->type);
-       return klass->generic_container != NULL;
+       return mono_class_is_gtd (klass);
 }
 
 ICALL_EXPORT MonoReflectionType*
@@ -2763,11 +2786,11 @@ ves_icall_RuntimeTypeHandle_GetGenericTypeDefinition_impl (MonoReflectionType *t
 
        klass = mono_class_from_mono_type (type->type);
 
-       if (klass->generic_container) {
+       if (mono_class_is_gtd (klass)) {
                return type; /* check this one */
        }
-       if (klass->generic_class) {
-               MonoClass *generic_class = klass->generic_class->container_class;
+       if (mono_class_is_ginst (klass)) {
+               MonoClass *generic_class = mono_class_get_generic_class (klass)->container_class;
                gpointer tb;
 
                tb = mono_class_get_ref_info (generic_class);
@@ -2816,7 +2839,7 @@ ves_icall_RuntimeType_MakeGenericType (MonoReflectionType *type, MonoArray *type
        klass = mono_class_from_mono_type (geninst);
 
        /*we might inflate to the GTD*/
-       if (klass->generic_class && !mono_verifier_class_is_valid_generic_instantiation (klass)) {
+       if (mono_class_is_ginst (klass) && !mono_verifier_class_is_valid_generic_instantiation (klass)) {
                mono_set_pending_exception (mono_get_exception_argument ("typeArguments", "Invalid generic arguments"));
                return NULL;
        }
@@ -2839,7 +2862,7 @@ ves_icall_RuntimeTypeHandle_HasInstantiation (MonoReflectionType *type)
                return FALSE;
 
        klass = mono_class_from_mono_type (type->type);
-       return klass->generic_class != NULL || klass->generic_container != NULL;
+       return mono_class_is_ginst (klass) || mono_class_is_gtd (klass);
 }
 
 ICALL_EXPORT gint32
@@ -3160,7 +3183,7 @@ ves_icall_InternalInvoke (MonoReflectionMethod *method, MonoObject *this_arg, Mo
                return NULL;
        }
 
-       if ((m->klass->flags & TYPE_ATTRIBUTE_ABSTRACT) && !strcmp (m->name, ".ctor") && !this_arg) {
+       if (mono_class_is_abstract (m->klass) && !strcmp (m->name, ".ctor") && !this_arg) {
                mono_gc_wbarrier_generic_store (exc, (MonoObject*) mono_exception_from_name_msg (mono_defaults.corlib, "System.Reflection", "TargetException", "Cannot invoke constructor of an abstract class."));
                return NULL;
        }
@@ -3619,64 +3642,77 @@ ves_icall_System_Enum_get_hashcode (MonoObject *eobj)
        return 0;
 }
 
+static void
+get_enum_field (MonoDomain *domain, MonoArrayHandle names, MonoArrayHandle values, int base_type, MonoClassField *field, guint* j, guint64 *previous_value, gboolean *sorted, MonoError *error)
+{
+       mono_error_init (error);
+       HANDLE_FUNCTION_ENTER();
+       guint64 field_value;
+       const char *p;
+       MonoTypeEnum def_type;
+
+       if (!(field->type->attrs & FIELD_ATTRIBUTE_STATIC))
+               goto leave;
+       if (strcmp ("value__", mono_field_get_name (field)) == 0)
+               goto leave;
+       if (mono_field_is_deleted (field))
+               goto leave;
+       MonoStringHandle name = mono_string_new_handle (domain, mono_field_get_name (field), error);
+       if (!is_ok (error))
+               goto leave;
+       MONO_HANDLE_ARRAY_SETREF (names, *j, name);
+
+       p = mono_class_get_field_default_value (field, &def_type);
+       /* len = */ mono_metadata_decode_blob_size (p, &p);
+
+       field_value = read_enum_value (p, base_type);
+       MONO_HANDLE_ARRAY_SETVAL (values, guint64, *j, field_value);
+
+       if (*previous_value > field_value)
+               *sorted = FALSE;
+
+       *previous_value = field_value;
+       (*j)++;
+leave:
+       HANDLE_FUNCTION_RETURN();
+}
+
 ICALL_EXPORT MonoBoolean
-ves_icall_System_Enum_GetEnumValuesAndNames (MonoReflectionType *type, MonoArray **values, MonoArray **names)
+ves_icall_System_Enum_GetEnumValuesAndNames (MonoReflectionTypeHandle type, MonoArrayHandleOut values, MonoArrayHandleOut names, MonoError *error)
 {
-       MonoError error;
-       MonoDomain *domain = mono_object_domain (type); 
-       MonoClass *enumc = mono_class_from_mono_type (type->type);
+       MonoDomain *domain = MONO_HANDLE_DOMAIN (type);
+       MonoClass *enumc = mono_class_from_mono_type (MONO_HANDLE_RAW(type)->type);
        guint j = 0, nvalues;
        gpointer iter;
        MonoClassField *field;
        int base_type;
-       guint64 field_value, previous_value = 0;
+       guint64 previous_value = 0;
        gboolean sorted = TRUE;
 
-       mono_class_init_checked (enumc, &error);
-       if (mono_error_set_pending_exception (&error))
-               return FALSE;
-
+       mono_error_init (error);
+       mono_class_init_checked (enumc, error);
+       return_val_if_nok (error, FALSE);
 
        if (!enumc->enumtype) {
-               mono_set_pending_exception (mono_get_exception_argument ("enumType", "Type provided must be an Enum."));
+               mono_error_set_argument (error, "enumType", "Type provided must be an Enum.");
                return TRUE;
        }
 
        base_type = mono_class_enum_basetype (enumc)->type;
 
-       nvalues = mono_class_num_fields (enumc) ? mono_class_num_fields (enumc) - 1 : 0;
-       *names = mono_array_new_checked (domain, mono_defaults.string_class, nvalues, &error);
-       if (mono_error_set_pending_exception (&error))
-               return FALSE;
-       *values = mono_array_new_checked (domain, mono_defaults.uint64_class, nvalues, &error);
-       if (mono_error_set_pending_exception (&error))
-               return FALSE;
+       nvalues = mono_class_num_fields (enumc) > 0 ? mono_class_num_fields (enumc) - 1 : 0;
+       MONO_HANDLE_ASSIGN(names, mono_array_new_handle (domain, mono_defaults.string_class, nvalues, error));
+       return_val_if_nok (error, FALSE);
+       MONO_HANDLE_ASSIGN(values, mono_array_new_handle (domain, mono_defaults.uint64_class, nvalues, error));
+       return_val_if_nok (error, FALSE);
 
        iter = NULL;
        while ((field = mono_class_get_fields (enumc, &iter))) {
-               const char *p;
-               MonoTypeEnum def_type;
-
-               if (!(field->type->attrs & FIELD_ATTRIBUTE_STATIC))
-                       continue;
-               if (strcmp ("value__", mono_field_get_name (field)) == 0)
-                       continue;
-               if (mono_field_is_deleted (field))
-                       continue;
-               mono_array_setref (*names, j, mono_string_new (domain, mono_field_get_name (field)));
-
-               p = mono_class_get_field_default_value (field, &def_type);
-               /* len = */ mono_metadata_decode_blob_size (p, &p);
-
-               field_value = read_enum_value (p, base_type);
-               mono_array_set (*values, guint64, j, field_value);
-
-               if (previous_value > field_value)
-                       sorted = FALSE;
-
-               previous_value = field_value;
-               ++j;
+               get_enum_field(domain, names, values, base_type, field, &j, &previous_value, &sorted, error);
+               if (!is_ok (error))
+                       break;
        }
+       return_val_if_nok (error, FALSE);
 
        return sorted;
 }
@@ -4273,15 +4309,15 @@ ves_icall_RuntimeType_GetNestedTypes_native (MonoReflectionType *type, char *str
         * nested types that aren't generic.  In any case, the container of that
         * nested type would be the generic type definition.
         */
-       if (klass->generic_class)
-               klass = klass->generic_class->container_class;
+       if (mono_class_is_ginst (klass))
+               klass = mono_class_get_generic_class (klass)->container_class;
 
        res_array = g_ptr_array_new ();
        
        iter = NULL;
        while ((nested = mono_class_get_nested_types (klass, &iter))) {
                match = 0;
-               if ((nested->flags & TYPE_ATTRIBUTE_VISIBILITY_MASK) == TYPE_ATTRIBUTE_NESTED_PUBLIC) {
+               if ((mono_class_get_flags (nested) & TYPE_ATTRIBUTE_VISIBILITY_MASK) == TYPE_ATTRIBUTE_NESTED_PUBLIC) {
                        if (bflags & BFLAGS_Public)
                                match++;
                } else {
@@ -4418,8 +4454,8 @@ ves_icall_System_Reflection_Assembly_InternalGetType (MonoReflectionAssembly *as
                /* need to report exceptions ? */
                if (throwOnError && mono_class_has_failure (klass)) {
                        /* report SecurityException (or others) that occured when loading the assembly */
-                       MonoException *exc = mono_class_get_exception_for_failure (klass);
-                       mono_set_pending_exception (exc);
+                       mono_error_set_for_class_failure (&error, klass);
+                       mono_error_set_pending_exception (&error);
                        return NULL;
                }
        }
@@ -4480,25 +4516,13 @@ ves_icall_System_Reflection_Assembly_get_code_base (MonoReflectionAssembly *asse
 
        replace_shadow_path (domain, dirname, &absolute);
        g_free (dirname);
-#if HOST_WIN32
-       {
-               gint i;
-               for (i = strlen (absolute) - 1; i >= 0; i--)
-                       if (absolute [i] == '\\')
-                               absolute [i] = '/';
-       }
-#endif
+
+       mono_icall_make_platform_path (absolute);
+
        if (escaped) {
                uri = g_filename_to_uri (absolute, NULL, NULL);
        } else {
-               const char *prepend = "file://";
-#if HOST_WIN32
-               if (*absolute == '/' && *(absolute + 1) == '/') {
-                       prepend = "file:";
-               } else {
-                       prepend = "file:///";
-               }
-#endif
+               const gchar *prepend = mono_icall_get_file_path_prefix (absolute);
                uri = g_strconcat (prepend, absolute, NULL);
        }
 
@@ -4542,15 +4566,12 @@ ves_icall_System_Reflection_Assembly_load_with_partial_name (MonoString *mname,
        return result;
 }
 
-ICALL_EXPORT MonoString *
-ves_icall_System_Reflection_Assembly_get_location (MonoReflectionAssembly *assembly)
+ICALL_EXPORT MonoStringHandle
+ves_icall_System_Reflection_Assembly_get_location (MonoReflectionAssemblyHandle refassembly, MonoError *error)
 {
-       MonoDomain *domain = mono_object_domain (assembly); 
-       MonoString *res;
-
-       res = mono_string_new (domain, mono_image_get_filename (assembly->assembly->image));
-
-       return res;
+       MonoDomain *domain = MONO_HANDLE_DOMAIN (refassembly);
+       MonoAssembly *assembly = MONO_HANDLE_RAW (refassembly)->assembly;
+       return mono_string_new_handle (domain, mono_image_get_filename (assembly->image), error);
 }
 
 ICALL_EXPORT MonoBoolean
@@ -4559,12 +4580,13 @@ ves_icall_System_Reflection_Assembly_get_ReflectionOnly (MonoReflectionAssembly
        return assembly->assembly->ref_only;
 }
 
-ICALL_EXPORT MonoString *
-ves_icall_System_Reflection_Assembly_InternalImageRuntimeVersion (MonoReflectionAssembly *assembly)
+ICALL_EXPORT MonoStringHandle
+ves_icall_System_Reflection_Assembly_InternalImageRuntimeVersion (MonoReflectionAssemblyHandle refassembly, MonoError *error)
 {
-       MonoDomain *domain = mono_object_domain (assembly); 
+       MonoDomain *domain = MONO_HANDLE_DOMAIN (refassembly);
+       MonoAssembly *assembly = MONO_HANDLE_RAW (refassembly)->assembly;
 
-       return mono_string_new (domain, assembly->assembly->image->version);
+       return mono_string_new_handle (domain, assembly->image->version, error);
 }
 
 ICALL_EXPORT MonoReflectionMethod*
@@ -4619,8 +4641,8 @@ ves_icall_System_Reflection_Assembly_GetManifestResourceNames (MonoReflectionAss
        return result;
 }
 
-ICALL_EXPORT MonoString*
-ves_icall_System_Reflection_Assembly_GetAotId ()
+ICALL_EXPORT MonoStringHandle
+ves_icall_System_Reflection_Assembly_GetAotId (MonoError *error)
 {
        int i;
        guint8 aotid_sum = 0;
@@ -4636,8 +4658,11 @@ ves_icall_System_Reflection_Assembly_GetAotId ()
 
        if (aotid_sum == 0)
                return NULL;
-       
-       return mono_string_new (domain, mono_guid_to_string((guint8*) aotid));
+
+       gchar *guid = mono_guid_to_string((guint8*) aotid);
+       MonoStringHandle res = mono_string_new_handle (domain, guid, error);
+       g_free (guid);
+       return res;
 }
 
 static MonoObject*
@@ -4827,8 +4852,8 @@ ves_icall_System_Reflection_Assembly_GetManifestResourceInternal (MonoReflection
                g_assert ((impl & MONO_IMPLEMENTATION_MASK) == MONO_IMPLEMENTATION_FILE);
                file_idx = impl >> MONO_IMPLEMENTATION_BITS;
 
-               module = mono_image_load_file_for_image (assembly->assembly->image, file_idx);
-               if (!module)
+               module = mono_image_load_file_for_image_checked (assembly->assembly->image, file_idx, &error);
+               if (mono_error_set_pending_exception (&error) || !module)
                        return NULL;
        }
        else
@@ -5028,7 +5053,9 @@ ves_icall_System_Reflection_Assembly_GetModulesInternal (MonoReflectionAssembly
                        mono_array_setref (res, j, rm);
                }
                else {
-                       MonoImage *m = mono_image_load_file_for_image (image, i + 1);
+                       MonoImage *m = mono_image_load_file_for_image_checked (image, i + 1, &error);
+                       if (mono_error_set_pending_exception (&error))
+                               return NULL;
                        if (!m) {
                                MonoString *fname = mono_string_new (mono_domain_get (), mono_metadata_string_heap (image, cols [MONO_FILE_NAME]));
                                mono_set_pending_exception (mono_get_exception_file_not_found2 (NULL, fname));
@@ -5078,10 +5105,10 @@ mono_method_get_equivalent_method (MonoMethod *method, MonoClass *klass)
                MonoGenericContext ctx;
                ctx.method_inst = inflated->context.method_inst;
                ctx.class_inst = inflated->context.class_inst;
-               if (klass->generic_class)
-                       ctx.class_inst = klass->generic_class->context.class_inst;
-               else if (klass->generic_container)
-                       ctx.class_inst = klass->generic_container->context.class_inst;
+               if (mono_class_is_ginst (klass))
+                       ctx.class_inst = mono_class_get_generic_class (klass)->context.class_inst;
+               else if (mono_class_is_gtd (klass))
+                       ctx.class_inst = mono_class_get_generic_container (klass)->context.class_inst;
                result = mono_class_inflate_generic_method_full_checked (inflated->declaring, klass, &ctx, &error);
                g_assert (mono_error_ok (&error)); /* FIXME don't swallow the error */
                return result;
@@ -5090,7 +5117,8 @@ mono_method_get_equivalent_method (MonoMethod *method, MonoClass *klass)
        mono_class_setup_methods (method->klass);
        if (mono_class_has_failure (method->klass))
                return NULL;
-       for (i = 0; i < method->klass->method.count; ++i) {
+       int mcount = mono_class_get_method_count (method->klass);
+       for (i = 0; i < mcount; ++i) {
                if (method->klass->methods [i] == method) {
                        offset = i;
                        break;
@@ -5099,7 +5127,7 @@ mono_method_get_equivalent_method (MonoMethod *method, MonoClass *klass)
        mono_class_setup_methods (klass);
        if (mono_class_has_failure (klass))
                return NULL;
-       g_assert (offset >= 0 && offset < klass->method.count);
+       g_assert (offset >= 0 && offset < mono_class_get_method_count (klass));
        return klass->methods [offset];
 }
 
@@ -5219,7 +5247,7 @@ ves_icall_System_RuntimeType_getFullName (MonoReflectionTypeHandle object, gbool
                return NULL_HANDLE_STRING;
        }
 
-       res = mono_string_new_handle (domain, name);
+       res = mono_string_new_handle (domain, name, error);
        g_free (name);
 
        return res;
@@ -5284,25 +5312,14 @@ fill_reflection_assembly_name (MonoDomain *domain, MonoReflectionAssemblyName *a
 
        codebase = NULL;
        if (absolute != NULL && *absolute != '\0') {
-               const gchar *prepend = "file://";
                gchar *result;
 
                codebase = g_strdup (absolute);
 
-#if HOST_WIN32
-               {
-                       gint i;
-                       for (i = strlen (codebase) - 1; i >= 0; i--)
-                               if (codebase [i] == '\\')
-                                       codebase [i] = '/';
+               mono_icall_make_platform_path (codebase);
+
+               const gchar *prepend = mono_icall_get_file_path_prefix (codebase);
 
-                       if (*codebase == '/' && *(codebase + 1) == '/') {
-                               prepend = "file:";
-                       } else {
-                               prepend = "file:///";
-                       }
-               }
-#endif
                result = g_strconcat (prepend, codebase, NULL);
                g_free (codebase);
                codebase = result;
@@ -5552,7 +5569,9 @@ ves_icall_System_Reflection_Assembly_GetTypes (MonoReflectionAssembly *assembly,
        /* Append data from all modules in the assembly */
        for (i = 0; i < table->rows; ++i) {
                if (!(mono_metadata_decode_row_col (table, i, MONO_FILE_FLAGS) & FILE_CONTAINS_NO_METADATA)) {
-                       MonoImage *loaded_image = mono_assembly_load_module (image->assembly, i + 1);
+                       MonoImage *loaded_image = mono_assembly_load_module_checked (image->assembly, i + 1, &error);
+                       if (mono_error_set_pending_exception (&error))
+                               return NULL;
                        if (loaded_image) {
                                MonoArray *ex2;
                                MonoArray *res2;
@@ -5703,24 +5722,28 @@ ves_icall_System_Reflection_Module_Close (MonoReflectionModule *module)
                mono_image_close (module->image);*/
 }
 
-ICALL_EXPORT MonoString*
-ves_icall_System_Reflection_Module_GetGuidInternal (MonoReflectionModule *module)
+ICALL_EXPORT MonoStringHandle
+ves_icall_System_Reflection_Module_GetGuidInternal (MonoReflectionModuleHandle refmodule, MonoError *error)
 {
-       MonoDomain *domain = mono_object_domain (module); 
+       MonoDomain *domain = MONO_HANDLE_DOMAIN (refmodule);
+       MonoImage *image = MONO_HANDLE_RAW (refmodule)->image;
 
-       g_assert (module->image);
-       return mono_string_new (domain, module->image->guid);
+       g_assert (image);
+       return mono_string_new_handle (domain, image->guid, error);
+}
+
+#ifndef HOST_WIN32
+static inline gpointer
+mono_icall_module_get_hinstance (MonoReflectionModule *module)
+{
+       return (gpointer) (-1);
 }
+#endif /* HOST_WIN32 */
 
 ICALL_EXPORT gpointer
 ves_icall_System_Reflection_Module_GetHINSTANCE (MonoReflectionModule *module)
 {
-#ifdef HOST_WIN32
-       if (module->image && module->image->is_module_handle)
-               return module->image->raw_data;
-#endif
-
-       return (gpointer) (-1);
+       return mono_icall_module_get_hinstance (module);
 }
 
 ICALL_EXPORT void
@@ -6123,7 +6146,6 @@ static void
 check_for_invalid_type (MonoClass *klass, MonoError *error)
 {
        char *name;
-       MonoString *str;
 
        mono_error_init (error);
 
@@ -6131,10 +6153,7 @@ check_for_invalid_type (MonoClass *klass, MonoError *error)
                return;
 
        name = mono_type_get_full_name (klass);
-       str =  mono_string_new (mono_domain_get (), name);
-       g_free (name);
-       mono_error_set_exception_instance (error, mono_get_exception_type_load (str, NULL));
-
+       mono_error_set_type_load_name (error, name, g_strdup (""), "");
 }
 ICALL_EXPORT MonoReflectionType *
 ves_icall_RuntimeType_make_array_type (MonoReflectionType *type, int rank)
@@ -6145,7 +6164,8 @@ ves_icall_RuntimeType_make_array_type (MonoReflectionType *type, int rank)
 
        klass = mono_class_from_mono_type (type->type);
        check_for_invalid_type (klass, &error);
-       mono_error_set_pending_exception (&error);
+       if (mono_error_set_pending_exception (&error))
+               return NULL;
 
        if (rank == 0) //single dimentional array
                aklass = mono_array_class_get (klass, 1);
@@ -6212,6 +6232,7 @@ ves_icall_System_Delegate_CreateDelegate_internal (MonoReflectionType *type, Mon
        MonoObject *delegate;
        gpointer func;
        MonoMethod *method = info->method;
+       MonoMethodSignature *sig = mono_method_signature(method);
 
        mono_class_init_checked (delegate_class, &error);
        if (mono_error_set_pending_exception (&error))
@@ -6236,6 +6257,13 @@ ves_icall_System_Delegate_CreateDelegate_internal (MonoReflectionType *type, Mon
                }
        }
 
+       if (sig->generic_param_count && method->wrapper_type == MONO_WRAPPER_NONE) {
+               if (!method->is_inflated) {
+                       mono_set_pending_exception(mono_get_exception_argument("method", " Cannot bind to the target method because its signature differs from that of the delegate type"));
+                       return NULL;
+               }
+       }
+
        delegate = mono_object_new_checked (mono_object_domain (type), delegate_class, &error);
        if (mono_error_set_pending_exception (&error))
                return NULL;
@@ -6442,28 +6470,11 @@ ves_icall_System_Environment_get_UserName (void)
        return mono_string_new (mono_domain_get (), g_get_user_name ());
 }
 
-
-ICALL_EXPORT MonoString *
-ves_icall_System_Environment_get_MachineName (void)
+#ifndef HOST_WIN32
+static MonoString *
+mono_icall_get_machine_name (void)
 {
-#if defined (HOST_WIN32)
-       gunichar2 *buf;
-       guint32 len;
-       MonoString *result;
-
-       len = MAX_COMPUTERNAME_LENGTH + 1;
-       buf = g_new (gunichar2, len);
-
-       result = NULL;
-       if (GetComputerName (buf, (PDWORD) &len)) {
-               MonoError error;
-               result = mono_string_new_utf16_checked (mono_domain_get (), buf, len, &error);
-               mono_error_set_pending_exception (&error);
-       }
-
-       g_free (buf);
-       return result;
-#elif !defined(DISABLE_SOCKETS)
+#if !defined(DISABLE_SOCKETS)
        MonoString *result;
        char *buf;
        int n;
@@ -6486,14 +6497,19 @@ ves_icall_System_Environment_get_MachineName (void)
        return mono_string_new (mono_domain_get (), "mono");
 #endif
 }
+#endif /* !HOST_WIN32 */
 
-ICALL_EXPORT int
-ves_icall_System_Environment_get_Platform (void)
+ICALL_EXPORT MonoString *
+ves_icall_System_Environment_get_MachineName (void)
 {
-#if defined (TARGET_WIN32)
-       /* Win32NT */
-       return 2;
-#elif defined(__MACH__)
+       return mono_icall_get_machine_name ();
+}
+
+#ifndef HOST_WIN32
+static inline int
+mono_icall_get_platform (void)
+{
+#if defined(__MACH__)
        /* OSX */
        //
        // Notice that the value is hidden from user code, and only exposed
@@ -6508,29 +6524,36 @@ ves_icall_System_Environment_get_Platform (void)
        return 4;
 #endif
 }
+#endif /* !HOST_WIN32 */
+
+ICALL_EXPORT int
+ves_icall_System_Environment_get_Platform (void)
+{
+       return mono_icall_get_platform ();
+}
+
+#ifndef HOST_WIN32
+static inline MonoString *
+mono_icall_get_new_line (void)
+{
+       return mono_string_new (mono_domain_get (), "\n");
+}
+#endif /* !HOST_WIN32 */
 
 ICALL_EXPORT MonoString *
 ves_icall_System_Environment_get_NewLine (void)
 {
-#if defined (HOST_WIN32)
-       return mono_string_new (mono_domain_get (), "\r\n");
-#else
-       return mono_string_new (mono_domain_get (), "\n");
-#endif
+       return mono_icall_get_new_line ();
 }
 
-ICALL_EXPORT MonoBoolean
-ves_icall_System_Environment_GetIs64BitOperatingSystem (void)
+#ifndef HOST_WIN32
+static inline MonoBoolean
+mono_icall_is_64bit_os (void)
 {
 #if SIZEOF_VOID_P == 8
        return TRUE;
 #else
-#ifdef HOST_WIN32
-       gboolean isWow64Process = FALSE;
-       if (IsWow64Process (GetCurrentProcess (), &isWow64Process)) {
-               return (MonoBoolean)isWow64Process;
-       }
-#elif defined(HAVE_SYS_UTSNAME_H)
+#if defined(HAVE_SYS_UTSNAME_H)
        struct utsname name;
 
        if (uname (&name) >= 0) {
@@ -6540,28 +6563,28 @@ ves_icall_System_Environment_GetIs64BitOperatingSystem (void)
        return FALSE;
 #endif
 }
+#endif /* !HOST_WIN32 */
 
-ICALL_EXPORT MonoString *
-ves_icall_System_Environment_GetEnvironmentVariable (MonoString *name)
+ICALL_EXPORT MonoBoolean
+ves_icall_System_Environment_GetIs64BitOperatingSystem (void)
+{
+       return mono_icall_is_64bit_os ();
+}
+
+ICALL_EXPORT MonoStringHandle
+ves_icall_System_Environment_GetEnvironmentVariable_native (const gchar *utf8_name, MonoError *error)
 {
-       MonoError error;
        const gchar *value;
-       gchar *utf8_name;
 
-       if (name == NULL)
-               return NULL;
+       if (utf8_name == NULL)
+               return NULL_HANDLE_STRING;
 
-       utf8_name = mono_string_to_utf8_checked (name, &error); /* FIXME: this should be ascii */
-       if (mono_error_set_pending_exception (&error))
-               return NULL;
        value = g_getenv (utf8_name);
 
-       g_free (utf8_name);
-
        if (value == 0)
-               return NULL;
+               return NULL_HANDLE_STRING;
        
-       return mono_string_new (mono_domain_get (), value);
+       return mono_string_new_handle (mono_domain_get (), value, error);
 }
 
 /*
@@ -6597,65 +6620,10 @@ ves_icall_System_Environment_GetCoomandLineArgs (void)
        return result;
 }
 
-ICALL_EXPORT MonoArray *
-ves_icall_System_Environment_GetEnvironmentVariableNames (void)
+#ifndef HOST_WIN32
+static MonoArray *
+mono_icall_get_environment_variable_names (void)
 {
-#ifdef HOST_WIN32
-       MonoError error;
-       MonoArray *names;
-       MonoDomain *domain;
-       MonoString *str;
-       WCHAR* env_strings;
-       WCHAR* env_string;
-       WCHAR* equal_str;
-       int n = 0;
-
-       env_strings = GetEnvironmentStrings();
-
-       if (env_strings) {
-               env_string = env_strings;
-               while (*env_string != '\0') {
-               /* weird case that MS seems to skip */
-                       if (*env_string != '=')
-                               n++;
-                       while (*env_string != '\0')
-                               env_string++;
-                       env_string++;
-               }
-       }
-
-       domain = mono_domain_get ();
-       names = mono_array_new_checked (domain, mono_defaults.string_class, n, &error);
-       if (mono_error_set_pending_exception (&error))
-               return NULL;
-
-       if (env_strings) {
-               n = 0;
-               env_string = env_strings;
-               while (*env_string != '\0') {
-                       /* weird case that MS seems to skip */
-                       if (*env_string != '=') {
-                               equal_str = wcschr(env_string, '=');
-                               g_assert(equal_str);
-                               MonoError error;
-                               str = mono_string_new_utf16_checked (domain, env_string, equal_str-env_string, &error);
-                               if (mono_error_set_pending_exception (&error))
-                                       return NULL;
-
-                               mono_array_setref (names, n, str);
-                               n++;
-                       }
-                       while (*env_string != '\0')
-                               env_string++;
-                       env_string++;
-               }
-
-               FreeEnvironmentStrings (env_strings);
-       }
-
-       return names;
-
-#else
        MonoError error;
        MonoArray *names;
        MonoDomain *domain;
@@ -6686,34 +6654,22 @@ ves_icall_System_Environment_GetEnvironmentVariableNames (void)
        }
 
        return names;
-#endif
 }
+#endif /* !HOST_WIN32 */
 
-ICALL_EXPORT void
-ves_icall_System_Environment_InternalSetEnvironmentVariable (MonoString *name, MonoString *value)
+ICALL_EXPORT MonoArray *
+ves_icall_System_Environment_GetEnvironmentVariableNames (void)
+{
+       return mono_icall_get_environment_variable_names ();
+}
+
+#ifndef HOST_WIN32
+static void
+mono_icall_set_environment_variable (MonoString *name, MonoString *value)
 {
-#ifdef HOST_WIN32
-       gunichar2 *utf16_name, *utf16_value;
-#else
        gchar *utf8_name, *utf8_value;
        MonoError error;
-#endif
-
-#ifdef HOST_WIN32
-       utf16_name = mono_string_to_utf16 (name);
-       if ((value == NULL) || (mono_string_length (value) == 0) || (mono_string_chars (value)[0] == 0)) {
-               SetEnvironmentVariable (utf16_name, NULL);
-               g_free (utf16_name);
-               return;
-       }
-
-       utf16_value = mono_string_to_utf16 (value);
-
-       SetEnvironmentVariable (utf16_name, utf16_value);
 
-       g_free (utf16_name);
-       g_free (utf16_value);
-#else
        utf8_name = mono_string_to_utf8_checked (name, &error); /* FIXME: this should be ascii */
        if (mono_error_set_pending_exception (&error))
                return;
@@ -6734,7 +6690,13 @@ ves_icall_System_Environment_InternalSetEnvironmentVariable (MonoString *name, M
 
        g_free (utf8_name);
        g_free (utf8_value);
-#endif
+}
+#endif /* !HOST_WIN32 */
+
+ICALL_EXPORT void
+ves_icall_System_Environment_InternalSetEnvironmentVariable (MonoString *name, MonoString *value)
+{
+       mono_icall_set_environment_variable (name, value);
 }
 
 ICALL_EXPORT void
@@ -6760,42 +6722,33 @@ ves_icall_System_Environment_Exit (int result)
        exit (result);
 }
 
-ICALL_EXPORT MonoString*
-ves_icall_System_Environment_GetGacPath (void)
+ICALL_EXPORT MonoStringHandle
+ves_icall_System_Environment_GetGacPath (MonoError *error)
 {
-       return mono_string_new (mono_domain_get (), mono_assembly_getrootdir ());
+       return mono_string_new_handle (mono_domain_get (), mono_assembly_getrootdir (), error);
 }
 
-ICALL_EXPORT MonoString*
-ves_icall_System_Environment_GetWindowsFolderPath (int folder)
+#ifndef HOST_WIN32
+static inline MonoString *
+mono_icall_get_windows_folder_path (int folder)
 {
-#if defined (HOST_WIN32)
-       #ifndef CSIDL_FLAG_CREATE
-               #define CSIDL_FLAG_CREATE       0x8000
-       #endif
-
-       WCHAR path [MAX_PATH];
-       /* Create directory if no existing */
-       if (SUCCEEDED (SHGetFolderPathW (NULL, folder | CSIDL_FLAG_CREATE, NULL, 0, path))) {
-               int len = 0;
-               while (path [len])
-                       ++ len;
-               MonoError error;
-               MonoString *res = mono_string_new_utf16_checked (mono_domain_get (), path, len, &error);
-               mono_error_set_pending_exception (&error);
-               return res;
-       }
-#else
        g_warning ("ves_icall_System_Environment_GetWindowsFolderPath should only be called on Windows!");
-#endif
        return mono_string_new (mono_domain_get (), "");
 }
+#endif /* !HOST_WIN32 */
 
-ICALL_EXPORT MonoArray *
-ves_icall_System_Environment_GetLogicalDrives (void)
+ICALL_EXPORT MonoString*
+ves_icall_System_Environment_GetWindowsFolderPath (int folder)
+{
+       return mono_icall_get_windows_folder_path (folder);
+}
+
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
+static MonoArray *
+mono_icall_get_logical_drives (void)
 {
        MonoError error;
-        gunichar2 buf [256], *ptr, *dname;
+       gunichar2 buf [256], *ptr, *dname;
        gunichar2 *u16;
        guint initial_size = 127, size = 128;
        gint ndrives;
@@ -6850,6 +6803,13 @@ leave:
 
        return result;
 }
+#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */
+
+ICALL_EXPORT MonoArray *
+ves_icall_System_Environment_GetLogicalDrives (void)
+{
+       return mono_icall_get_logical_drives ();
+}
 
 ICALL_EXPORT MonoString *
 ves_icall_System_IO_DriveInfo_GetDriveFormat (MonoString *path)
@@ -6864,10 +6824,10 @@ ves_icall_System_IO_DriveInfo_GetDriveFormat (MonoString *path)
        return result;
 }
 
-ICALL_EXPORT MonoString *
-ves_icall_System_Environment_InternalGetHome (void)
+ICALL_EXPORT MonoStringHandle
+ves_icall_System_Environment_InternalGetHome (MonoError *error)
 {
-       return mono_string_new (mono_domain_get (), g_get_home_dir ());
+       return mono_string_new_handle (mono_domain_get (), g_get_home_dir (), error);
 }
 
 static const char *encodings [] = {
@@ -6911,7 +6871,7 @@ ves_icall_System_Text_EncodingHelper_InternalCodePage (gint32 *int_code_page)
        *int_code_page = -1;
 
        g_get_charset (&cset);
-       c = codepage = strdup (cset);
+       c = codepage = g_strdup (cset);
        for (c = codepage; *c; c++){
                if (isascii (*c) && isalpha (*c))
                        *c = tolower (*c);
@@ -6938,7 +6898,7 @@ ves_icall_System_Text_EncodingHelper_InternalCodePage (gint32 *int_code_page)
        
        if (strstr (codepage, "utf_8") != NULL)
                *int_code_page |= 0x10000000;
-       free (codepage);
+       g_free (codepage);
        
        if (want_name && *int_code_page == -1)
                return mono_string_new (mono_domain_get (), cset);
@@ -6958,12 +6918,18 @@ ves_icall_System_Environment_get_HasShutdownStarted (void)
        return FALSE;
 }
 
+#ifndef HOST_WIN32
+static inline void
+mono_icall_broadcast_setting_change (void)
+{
+       return;
+}
+#endif /* !HOST_WIN32 */
+
 ICALL_EXPORT void
 ves_icall_System_Environment_BroadcastSettingChange (void)
 {
-#ifdef HOST_WIN32
-       SendMessageTimeout (HWND_BROADCAST, WM_SETTINGCHANGE, (WPARAM)NULL, (LPARAM)L"Environment", SMTO_ABORTIFHUNG, 2000, 0);
-#endif
+       mono_icall_broadcast_setting_change ();
 }
 
 ICALL_EXPORT
@@ -7030,7 +6996,7 @@ ves_icall_Remoting_RemotingServices_GetVirtualMethod (
        mono_class_setup_vtable (klass);
        vtable = klass->vtable;
 
-       if (method->klass->flags & TYPE_ATTRIBUTE_INTERFACE) {
+       if (mono_class_is_interface (method->klass)) {
                gboolean variance_used = FALSE;
                /*MS fails with variant interfaces but it's the right thing to do anyway.*/
                int offs = mono_class_interface_offset_with_variance (klass, method->klass, &variance_used);
@@ -7093,7 +7059,7 @@ ves_icall_System_Runtime_Activation_ActivationServices_AllocateUninitializedClas
        if (mono_error_set_pending_exception (&error))
                return NULL;
 
-       if (MONO_CLASS_IS_INTERFACE (klass) || (klass->flags & TYPE_ATTRIBUTE_ABSTRACT)) {
+       if (MONO_CLASS_IS_INTERFACE (klass) || mono_class_is_abstract (klass)) {
                mono_set_pending_exception (mono_get_exception_argument ("type", "Type cannot be instantiated"));
                return NULL;
        }
@@ -7117,10 +7083,10 @@ ves_icall_System_Runtime_Activation_ActivationServices_AllocateUninitializedClas
        }
 }
 
-ICALL_EXPORT MonoString *
-ves_icall_System_IO_get_temp_path (void)
+ICALL_EXPORT MonoStringHandle
+ves_icall_System_IO_get_temp_path (MonoError *error)
 {
-       return mono_string_new (mono_domain_get (), g_get_tmp_dir ());
+       return mono_string_new_handle (mono_domain_get (), g_get_tmp_dir (), error);
 }
 
 #ifndef PLATFORM_NO_DRIVEINFO
@@ -7152,12 +7118,21 @@ ves_icall_System_IO_DriveInfo_GetDiskFreeSpace (MonoString *path_name, guint64 *
        return result;
 }
 
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
+static inline guint32
+mono_icall_drive_info_get_drive_type (MonoString *root_path_name)
+{
+       return GetDriveType (mono_string_chars (root_path_name));
+}
+#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */
+
 ICALL_EXPORT guint32
 ves_icall_System_IO_DriveInfo_GetDriveType (MonoString *root_path_name)
 {
-       return GetDriveType (mono_string_chars (root_path_name));
+       return mono_icall_drive_info_get_drive_type (root_path_name);
 }
-#endif
+
+#endif /* PLATFORM_NO_DRIVEINFO */
 
 ICALL_EXPORT gpointer
 ves_icall_RuntimeMethodHandle_GetFunctionPointer (MonoMethod *method)
@@ -7176,15 +7151,8 @@ ves_icall_System_Configuration_DefaultConfig_get_machine_config_path (void)
 
        path = g_build_path (G_DIR_SEPARATOR_S, mono_get_config_dir (), "mono", mono_get_runtime_info ()->framework_version, "machine.config", NULL);
 
-#if defined (HOST_WIN32)
-       /* Avoid mixing '/' and '\\' */
-       {
-               gint i;
-               for (i = strlen (path) - 1; i >= 0; i--)
-                       if (path [i] == '/')
-                               path [i] = '\\';
-       }
-#endif
+       mono_icall_make_platform_path (path);
+
        mcpath = mono_string_new (mono_domain_get (), path);
        g_free (path);
 
@@ -7238,19 +7206,39 @@ get_bundled_app_config (void)
        return mono_string_new (mono_domain_get (), app_config);
 }
 
-static MonoString *
-get_bundled_machine_config (void)
+static MonoStringHandle
+get_bundled_machine_config (MonoError *error)
 {
        const gchar *machine_config;
 
        machine_config = mono_get_machine_config ();
 
        if (!machine_config)
-               return NULL;
+               return NULL_HANDLE_STRING;
+
+       return mono_string_new_handle (mono_domain_get (), machine_config, error);
+}
+
+ICALL_EXPORT MonoStringHandle
+ves_icall_System_Environment_get_bundled_machine_config (MonoError *error)
+{
+       return get_bundled_machine_config (error);
+}
+
+
+ICALL_EXPORT MonoStringHandle
+ves_icall_System_Configuration_DefaultConfig_get_bundled_machine_config (MonoError *error)
+{
+       return get_bundled_machine_config (error);
+}
 
-       return mono_string_new (mono_domain_get (), machine_config);
+ICALL_EXPORT MonoStringHandle
+ves_icall_System_Configuration_InternalConfigurationHost_get_bundled_machine_config (MonoError *error)
+{
+       return get_bundled_machine_config (error);
 }
 
+
 ICALL_EXPORT MonoString *
 ves_icall_System_Web_Util_ICalls_get_machine_install_dir (void)
 {
@@ -7259,15 +7247,8 @@ ves_icall_System_Web_Util_ICalls_get_machine_install_dir (void)
 
        path = g_path_get_dirname (mono_get_config_dir ());
 
-#if defined (HOST_WIN32)
-       /* Avoid mixing '/' and '\\' */
-       {
-               gint i;
-               for (i = strlen (path) - 1; i >= 0; i--)
-                       if (path [i] == '/')
-                               path [i] = '\\';
-       }
-#endif
+       mono_icall_make_platform_path (path);
+
        ipath = mono_string_new (mono_domain_get (), path);
        g_free (path);
 
@@ -7322,14 +7303,18 @@ ves_icall_System_Diagnostics_Debugger_Log (int level, MonoString *category, Mono
                mono_get_runtime_callbacks ()->debug_log (level, category, message);
 }
 
+#ifndef HOST_WIN32
+static inline void
+mono_icall_write_windows_debug_string (MonoString *message)
+{
+       g_warning ("WriteWindowsDebugString called and HOST_WIN32 not defined!\n");
+}
+#endif /* !HOST_WIN32 */
+
 ICALL_EXPORT void
 ves_icall_System_Diagnostics_DefaultTraceListener_WriteWindowsDebugString (MonoString *message)
 {
-#if defined (HOST_WIN32)
-       OutputDebugString (mono_string_chars (message));
-#else
-       g_warning ("WriteWindowsDebugString called and HOST_WIN32 not defined!\n");
-#endif
+       mono_icall_write_windows_debug_string (message);
 }
 
 /* Only used for value types */
@@ -7381,11 +7366,12 @@ ves_icall_MonoMethod_get_base_method (MonoReflectionMethod *m, gboolean definiti
                return m;
 
        klass = method->klass;
-       if (klass->generic_class) {
+       if (mono_class_is_ginst (klass)) {
                generic_inst = mono_class_get_context (klass);
-               klass = klass->generic_class->container_class;
+               klass = mono_class_get_generic_class (klass)->container_class;
        }
 
+retry:
        if (definition) {
                /* At the end of the loop, klass points to the eldest class that has this virtual function slot. */
                for (parent = klass->parent; parent != NULL; parent = parent->parent) {
@@ -7419,9 +7405,9 @@ ves_icall_MonoMethod_get_base_method (MonoReflectionMethod *m, gboolean definiti
                                        return NULL;
                                }
                        }
-                       if (parent->generic_class) {
+                       if (mono_class_is_ginst (parent)) {
                                parent_inst = mono_class_get_context (parent);
-                               parent = parent->generic_class->container_class;
+                               parent = mono_class_get_generic_class (parent)->container_class;
                        }
 
                        mono_class_setup_vtable (parent);
@@ -7443,9 +7429,9 @@ ves_icall_MonoMethod_get_base_method (MonoReflectionMethod *m, gboolean definiti
 
                        generic_inst = NULL;
                }
-               if (klass->generic_class) {
+               if (mono_class_is_ginst (klass)) {
                        generic_inst = mono_class_get_context (klass);
-                       klass = klass->generic_class->container_class;
+                       klass = mono_class_get_generic_class (klass)->container_class;
                }
 
        }
@@ -7472,14 +7458,38 @@ ves_icall_MonoMethod_get_base_method (MonoReflectionMethod *m, gboolean definiti
        result = klass->vtable [slot];
        if (result == NULL) {
                /* It is an abstract method */
+               gboolean found = FALSE;
                gpointer iter = NULL;
-               while ((result = mono_class_get_methods (klass, &iter)))
-                       if (result->slot == slot)
+               while ((result = mono_class_get_methods (klass, &iter))) {
+                       if (result->slot == slot) {
+                               found = TRUE;
                                break;
+                       }
+               }
+               /* found might be FALSE if we looked in an abstract class
+                * that doesn't override an abstract method of its
+                * parent: 
+                *   abstract class Base {
+                *     public abstract void Foo ();
+                *   }
+                *   abstract class Derived : Base { }
+                *   class Child : Derived {
+                *     public override void Foo () { }
+                *  }
+                *
+                *  if m was Child.Foo and we ask for the base method,
+                *  then we get here with klass == Derived and found == FALSE
+                */
+               /* but it shouldn't be the case that if we're looking
+                * for the definition and didn't find a result; the
+                * loop above should've taken us as far as we could
+                * go! */
+               g_assert (!(definition && !found));
+               if (!found)
+                       goto retry;
        }
 
-       if (result == NULL)
-               return m;
+       g_assert (result != NULL);
 
        ret = mono_method_get_object_checked (mono_domain_get (), result, NULL, &error);
        mono_error_set_pending_exception (&error);
@@ -7936,14 +7946,15 @@ ves_icall_MonoCustomAttrs_GetCustomAttributesDataInternal (MonoObject *obj)
 }
 
 
-ICALL_EXPORT MonoString*
-ves_icall_Mono_Runtime_GetDisplayName (void)
+ICALL_EXPORT MonoStringHandle
+ves_icall_Mono_Runtime_GetDisplayName (MonoError *error)
 {
        char *info;
-       MonoString *display_name;
+       MonoStringHandle display_name;
 
+       mono_error_init (error);
        info = mono_get_runtime_callbacks ()->get_runtime_build_info ();
-       display_name = mono_string_new (mono_domain_get (), info);
+       display_name = mono_string_new_handle (mono_domain_get (), info, error);
        g_free (info);
        return display_name;
 }
@@ -7970,76 +7981,103 @@ ves_icall_System_ComponentModel_Win32Exception_W32ErrorMessage (guint32 code)
        return message;
 }
 
-ICALL_EXPORT gpointer
-ves_icall_Microsoft_Win32_NativeMethods_GetCurrentProcess (void)
+#ifndef HOST_WIN32
+static inline gint32
+mono_icall_wait_for_input_idle (gpointer handle, gint32 milliseconds)
 {
-       return GetCurrentProcess ();
+       return WAIT_TIMEOUT;
 }
+#endif /* !HOST_WIN32 */
 
-ICALL_EXPORT MonoBoolean
-ves_icall_Microsoft_Win32_NativeMethods_GetExitCodeProcess (gpointer handle, gint32 *exitcode)
+ICALL_EXPORT gint32
+ves_icall_Microsoft_Win32_NativeMethods_WaitForInputIdle (gpointer handle, gint32 milliseconds)
 {
-       return GetExitCodeProcess (handle, (guint32*) exitcode);
+       return mono_icall_wait_for_input_idle (handle, milliseconds);
+}
+
+ICALL_EXPORT gint32
+ves_icall_Microsoft_Win32_NativeMethods_GetCurrentProcessId (void)
+{
+       return mono_process_current_pid ();
 }
 
 ICALL_EXPORT MonoBoolean
-ves_icall_Microsoft_Win32_NativeMethods_CloseProcess (gpointer handle)
+ves_icall_Mono_TlsProviderFactory_IsBtlsSupported (void)
 {
-#if defined(TARGET_WIN32) || defined(HOST_WIN32)
-       return CloseHandle (handle);
+#if HAVE_BTLS
+       return TRUE;
 #else
-       return CloseProcess (handle);
+       return FALSE;
 #endif
 }
 
-ICALL_EXPORT MonoBoolean
-ves_icall_Microsoft_Win32_NativeMethods_TerminateProcess (gpointer handle, gint32 exitcode)
+#ifndef DISABLE_COM
+
+ICALL_EXPORT int
+ves_icall_System_Runtime_InteropServices_Marshal_GetHRForException_WinRT(MonoException* ex)
 {
-       return TerminateProcess (handle, exitcode);
+       mono_set_pending_exception(mono_get_exception_not_implemented("System.Runtime.InteropServices.Marshal.GetHRForException_WinRT internal call is not implemented."));
+       return 0;
 }
 
-ICALL_EXPORT gint32
-ves_icall_Microsoft_Win32_NativeMethods_WaitForInputIdle (gpointer handle, gint32 milliseconds)
+ICALL_EXPORT MonoObject*
+ves_icall_System_Runtime_InteropServices_Marshal_GetNativeActivationFactory(MonoObject* type)
+{
+       mono_set_pending_exception(mono_get_exception_not_implemented("System.Runtime.InteropServices.Marshal.GetNativeActivationFactory internal call is not implemented."));
+       return NULL;
+}
+
+ICALL_EXPORT void*
+ves_icall_System_Runtime_InteropServices_Marshal_GetRawIUnknownForComObjectNoAddRef(MonoObject* obj)
 {
-       return WaitForInputIdle (handle, milliseconds);
+       mono_set_pending_exception(mono_get_exception_not_implemented("System.Runtime.InteropServices.Marshal.GetRawIUnknownForComObjectNoAddRef internal call is not implemented."));
+       return NULL;
 }
 
-ICALL_EXPORT MonoBoolean
-ves_icall_Microsoft_Win32_NativeMethods_GetProcessWorkingSetSize (gpointer handle, gsize *min, gsize *max)
+ICALL_EXPORT MonoObject*
+ves_icall_System_Runtime_InteropServices_WindowsRuntime_UnsafeNativeMethods_GetRestrictedErrorInfo()
 {
-       return GetProcessWorkingSetSize (handle, min, max);
+       mono_set_pending_exception(mono_get_exception_not_implemented("System.Runtime.InteropServices.WindowsRuntime.UnsafeNativeMethods.GetRestrictedErrorInfo internal call is not implemented."));
+       return NULL;
 }
 
 ICALL_EXPORT MonoBoolean
-ves_icall_Microsoft_Win32_NativeMethods_SetProcessWorkingSetSize (gpointer handle, gsize min, gsize max)
+ves_icall_System_Runtime_InteropServices_WindowsRuntime_UnsafeNativeMethods_RoOriginateLanguageException(int error, MonoString* message, void* languageException)
 {
-       return SetProcessWorkingSetSize (handle, min, max);
+       mono_set_pending_exception(mono_get_exception_not_implemented("System.Runtime.InteropServices.WindowsRuntime.UnsafeNativeMethods.RoOriginateLanguageException internal call is not implemented."));
+       return FALSE;
 }
 
-ICALL_EXPORT MonoBoolean
-ves_icall_Microsoft_Win32_NativeMethods_GetProcessTimes (gpointer handle, gint64 *creationtime, gint64 *exittime, gint64 *kerneltime, gint64 *usertime)
+ICALL_EXPORT void
+ves_icall_System_Runtime_InteropServices_WindowsRuntime_UnsafeNativeMethods_RoReportUnhandledError(MonoObject* error)
 {
-       return GetProcessTimes (handle, (LPFILETIME) creationtime, (LPFILETIME) exittime, (LPFILETIME) kerneltime, (LPFILETIME) usertime);
+       mono_set_pending_exception(mono_get_exception_not_implemented("System.Runtime.InteropServices.WindowsRuntime.UnsafeNativeMethods.RoReportUnhandledError internal call is not implemented."));
 }
 
-ICALL_EXPORT gint32
-ves_icall_Microsoft_Win32_NativeMethods_GetCurrentProcessId (void)
+ICALL_EXPORT int
+ves_icall_System_Runtime_InteropServices_WindowsRuntime_UnsafeNativeMethods_WindowsCreateString(MonoString* sourceString, int length, void** hstring)
 {
-       return mono_process_current_pid ();
+       mono_set_pending_exception(mono_get_exception_not_implemented("System.Runtime.InteropServices.WindowsRuntime.UnsafeNativeMethods.WindowsCreateString internal call is not implemented."));
+       return 0;
 }
 
-ICALL_EXPORT gint32
-ves_icall_Microsoft_Win32_NativeMethods_GetPriorityClass (gpointer handle)
+ICALL_EXPORT int
+ves_icall_System_Runtime_InteropServices_WindowsRuntime_UnsafeNativeMethods_WindowsDeleteString(void* hstring)
 {
-       return GetPriorityClass (handle);
+       mono_set_pending_exception(mono_get_exception_not_implemented("System.Runtime.InteropServices.WindowsRuntime.UnsafeNativeMethods.WindowsDeleteString internal call is not implemented."));
+       return 0;
 }
 
-ICALL_EXPORT MonoBoolean
-ves_icall_Microsoft_Win32_NativeMethods_SetPriorityClass (gpointer handle, gint32 priorityClass)
+ICALL_EXPORT mono_unichar2*
+ves_icall_System_Runtime_InteropServices_WindowsRuntime_UnsafeNativeMethods_WindowsGetStringRawBuffer(void* hstring, unsigned* length)
 {
-       return SetPriorityClass (handle, priorityClass);
+       mono_set_pending_exception(mono_get_exception_not_implemented("System.Runtime.InteropServices.WindowsRuntime.UnsafeNativeMethods.WindowsGetStringRawBuffer internal call is not implemented."));
+       return NULL;
 }
 
+#endif
+
+
 #ifndef DISABLE_ICALL_TABLES
 
 #define ICALL_TYPE(id,name,first)
index 959575f6a0a4a8c8996720693fd4a39d412b0c4a..6281e3b241c35eb37cbb5d1ead242c7ab41ccb16 100644 (file)
 MonoImage *
 mono_find_image_owner (void *ptr);
 
+MonoImage*
+mono_image_load_file_for_image_checked (MonoImage *image, int fileidx, MonoError *error);
+
+MonoImage*
+mono_image_load_module_checked (MonoImage *image, int idx, MonoError *error);
+
 #endif /* __MONO_METADATA_IMAGE_INTERNALS_H__ */
index 50eaded2e37279442560273998901d1e3cbb82ea..0a2b5eca65c89fcbc8856a6efaae94b1a742fa0b 100644 (file)
@@ -28,6 +28,7 @@
 #include "marshal.h"
 #include "coree.h"
 #include <mono/io-layer/io-layer.h>
+#include <mono/utils/checked-build.h>
 #include <mono/utils/mono-logger-internals.h>
 #include <mono/utils/mono-path.h>
 #include <mono/utils/mono-mmap.h>
@@ -66,18 +67,43 @@ enum {
 };
 static GHashTable *loaded_images_hashes [4] = {NULL, NULL, NULL, NULL};
 
-static GHashTable *get_loaded_images_hash (gboolean refonly)
+static GHashTable *
+get_loaded_images_hash (gboolean refonly)
 {
        int idx = refonly ? IMAGES_HASH_PATH_REFONLY : IMAGES_HASH_PATH;
        return loaded_images_hashes [idx];
 }
 
-static GHashTable *get_loaded_images_by_name_hash (gboolean refonly)
+static GHashTable *
+get_loaded_images_by_name_hash (gboolean refonly)
 {
        int idx = refonly ? IMAGES_HASH_NAME_REFONLY : IMAGES_HASH_NAME;
        return loaded_images_hashes [idx];
 }
 
+// Change the assembly set in `image` to the assembly set in `assemblyImage`. Halt if overwriting is attempted.
+// Can be used on modules loaded through either the "file" or "module" mechanism
+static gboolean
+assign_assembly_parent_for_netmodule (MonoImage *image, MonoImage *assemblyImage, MonoError *error)
+{
+       // Assembly to assign
+       MonoAssembly *assembly = assemblyImage->assembly;
+
+       while (1) {
+               // Assembly currently assigned
+               MonoAssembly *assemblyOld = image->assembly;
+               if (assemblyOld) {
+                       if (assemblyOld == assembly)
+                               return TRUE;
+                       mono_error_set_bad_image (error, assemblyImage, "Attempted to load module %s which has already been loaded by assembly %s. This is not supported in Mono.", image->name, assemblyOld->image->name);
+                       return FALSE;
+               }
+               gpointer result = InterlockedExchangePointer((gpointer *)&image->assembly, assembly);
+               if (result == assembly)
+                       return TRUE;
+       }
+}
+
 static gboolean debug_assembly_unload = FALSE;
 
 #define mono_images_lock() if (mutex_inited) mono_os_mutex_lock (&images_mutex)
@@ -632,13 +658,13 @@ load_modules (MonoImage *image)
 }
 
 /**
- * mono_image_load_module:
+ * mono_image_load_module_checked:
  *
  *   Load the module with the one-based index IDX from IMAGE and return it. Return NULL if
- * it cannot be loaded.
+ * it cannot be loaded. NULL without MonoError being set will be interpreted as "not found".
  */
 MonoImage*
-mono_image_load_module (MonoImage *image, int idx)
+mono_image_load_module_checked (MonoImage *image, int idx, MonoError *error)
 {
        MonoTableInfo *t;
        MonoTableInfo *file_table;
@@ -648,6 +674,8 @@ mono_image_load_module (MonoImage *image, int idx)
        GList *list_iter, *valid_modules = NULL;
        MonoImageOpenStatus status;
 
+       mono_error_init (error);
+
        if ((image->module_count == 0) || (idx > image->module_count || idx <= 0))
                return NULL;
        if (image->modules_loaded [idx - 1])
@@ -683,10 +711,18 @@ mono_image_load_module (MonoImage *image, int idx)
                }
                if (valid) {
                        module_ref = g_build_filename (base_dir, name, NULL);
-                       image->modules [idx - 1] = mono_image_open_full (module_ref, &status, refonly);
-                       if (image->modules [idx - 1]) {
-                               mono_image_addref (image->modules [idx - 1]);
-                               image->modules [idx - 1]->assembly = image->assembly;
+                       MonoImage *moduleImage = mono_image_open_full (module_ref, &status, refonly);
+                       if (moduleImage) {
+                               if (!assign_assembly_parent_for_netmodule (moduleImage, image, error)) {
+                                       mono_image_close (moduleImage);
+                                       g_free (module_ref);
+                                       g_free (base_dir);
+                                       g_list_free (valid_modules);
+                                       return NULL;
+                               }
+
+                               image->modules [idx - 1] = image;
+
 #ifdef HOST_WIN32
                                if (image->modules [idx - 1]->is_module_handle)
                                        mono_image_fixup_vtable (image->modules [idx - 1]);
@@ -705,6 +741,15 @@ mono_image_load_module (MonoImage *image, int idx)
        return image->modules [idx - 1];
 }
 
+MonoImage*
+mono_image_load_module (MonoImage *image, int idx)
+{
+       MonoError error;
+       MonoImage *result = mono_image_load_module_checked (image, idx, &error);
+       mono_error_assert_ok (&error);
+       return result;
+}
+
 static gpointer
 class_key_extract (gpointer value)
 {
@@ -716,7 +761,7 @@ class_key_extract (gpointer value)
 static gpointer*
 class_next_value (gpointer value)
 {
-       MonoClass *klass = (MonoClass *)value;
+       MonoClassDef *klass = (MonoClassDef *)value;
 
        return (gpointer*)&klass->next_class_cache;
 }
@@ -1653,6 +1698,17 @@ mono_wrapper_caches_free (MonoWrapperCaches *cache)
        free_hash (cache->thunk_invoke_cache);
 }
 
+static void
+mono_image_close_except_pools_all (MonoImage**images, int image_count)
+{
+       for (int i = 0; i < image_count; ++i) {
+               if (images [i]) {
+                       if (!mono_image_close_except_pools (images [i]))
+                               images [i] = NULL;
+               }
+       }
+}
+
 /*
  * Returns whether mono_image_close_finish() must be called as well.
  * We must unload images in two steps because clearing the domain in
@@ -1773,7 +1829,6 @@ mono_image_close_except_pools (MonoImage *image)
                g_free (image->name);
                g_free (image->guid);
                g_free (image->version);
-               g_free (image->files);
        }
 
        if (image->method_cache)
@@ -1852,12 +1907,8 @@ mono_image_close_except_pools (MonoImage *image)
                g_free (image->image_info);
        }
 
-       for (i = 0; i < image->module_count; ++i) {
-               if (image->modules [i]) {
-                       if (!mono_image_close_except_pools (image->modules [i]))
-                               image->modules [i] = NULL;
-               }
-       }
+       mono_image_close_except_pools_all (image->files, image->file_count);
+       mono_image_close_except_pools_all (image->modules, image->module_count);
        if (image->modules_loaded)
                g_free (image->modules_loaded);
 
@@ -1876,6 +1927,17 @@ mono_image_close_except_pools (MonoImage *image)
        return TRUE;
 }
 
+static void
+mono_image_close_all (MonoImage**images, int image_count)
+{
+       for (int i = 0; i < image_count; ++i) {
+               if (images [i])
+                       mono_image_close_finish (images [i]);
+       }
+       if (images)
+               g_free (images);
+}
+
 void
 mono_image_close_finish (MonoImage *image)
 {
@@ -1891,12 +1953,8 @@ mono_image_close_finish (MonoImage *image)
                image->references = NULL;
        }
 
-       for (i = 0; i < image->module_count; ++i) {
-               if (image->modules [i])
-                       mono_image_close_finish (image->modules [i]);
-       }
-       if (image->modules)
-               g_free (image->modules);
+       mono_image_close_all (image->files, image->file_count);
+       mono_image_close_all (image->modules, image->module_count);
 
 #ifndef DISABLE_PERFCOUNTERS
        mono_perfcounters->loader_bytes -= mono_mempool_get_allocated (image->mempool);
@@ -2153,8 +2211,9 @@ mono_image_get_resource (MonoImage *image, guint32 offset, guint32 *size)
        return data;
 }
 
+// Returning NULL with no error set will be interpeted as "not found"
 MonoImage*
-mono_image_load_file_for_image (MonoImage *image, int fileidx)
+mono_image_load_file_for_image_checked (MonoImage *image, int fileidx, MonoError *error)
 {
        char *base_dir, *name;
        MonoImage *res;
@@ -2162,6 +2221,8 @@ mono_image_load_file_for_image (MonoImage *image, int fileidx)
        const char *fname;
        guint32 fname_id;
 
+       mono_error_init (error);
+
        if (fileidx < 1 || fileidx > t->rows)
                return NULL;
 
@@ -2189,14 +2250,21 @@ mono_image_load_file_for_image (MonoImage *image, int fileidx)
        } else {
                int i;
                /* g_print ("loaded file %s from %s (%p)\n", name, image->name, image->assembly); */
-               res->assembly = image->assembly;
+               if (!assign_assembly_parent_for_netmodule (res, image, error)) {
+                       mono_image_unlock (image);
+                       mono_image_close (res);
+                       return NULL;
+               }
+
                for (i = 0; i < res->module_count; ++i) {
                        if (res->modules [i] && !res->modules [i]->assembly)
                                res->modules [i]->assembly = image->assembly;
                }
 
-               if (!image->files)
+               if (!image->files) {
                        image->files = g_new0 (MonoImage*, t->rows);
+                       image->file_count = t->rows;
+               }
                image->files [fileidx - 1] = res;
                mono_image_unlock (image);
                /* vtable fixup can't happen with the image lock held */
@@ -2212,6 +2280,15 @@ done:
        return res;
 }
 
+MonoImage*
+mono_image_load_file_for_image (MonoImage *image, int fileidx)
+{
+       MonoError error;
+       MonoImage *result = mono_image_load_file_for_image_checked (image, fileidx, &error);
+       mono_error_assert_ok (&error);
+       return result;
+}
+
 /**
  * mono_image_get_strong_name:
  * @image: a MonoImage
@@ -2400,6 +2477,8 @@ mono_image_has_authenticode_entry (MonoImage *image)
 {
        MonoCLIImageInfo *iinfo = (MonoCLIImageInfo *)image->image_info;
        MonoDotNetHeader *header = &iinfo->cli_header;
+       if (!header)
+               return FALSE;
        MonoPEDirEntry *de = &header->datadir.pe_certificate_table;
        // the Authenticode "pre" (non ASN.1) header is 8 bytes long
        return ((de->rva != 0) && (de->size > 8));
@@ -2450,6 +2529,31 @@ mono_image_strdup (MonoImage *image, const char *s)
        return res;
 }
 
+char*
+mono_image_strdup_vprintf (MonoImage *image, const char *format, va_list args)
+{
+       char *buf;
+       mono_image_lock (image);
+       buf = mono_mempool_strdup_vprintf (image->mempool, format, args);
+       mono_image_unlock (image);
+#ifndef DISABLE_PERFCOUNTERS
+       mono_perfcounters->loader_bytes += strlen (buf);
+#endif
+       return buf;
+}
+
+char*
+mono_image_strdup_printf (MonoImage *image, const char *format, ...)
+{
+       char *buf;
+       va_list args;
+
+       va_start (args, format);
+       buf = mono_image_strdup_vprintf (image, format, args);
+       va_end (args);
+       return buf;
+}
+
 GList*
 g_list_prepend_image (MonoImage *image, GList *list, gpointer data)
 {
@@ -2522,6 +2626,7 @@ mono_image_property_lookup (MonoImage *image, gpointer subject, guint32 property
 void
 mono_image_property_insert (MonoImage *image, gpointer subject, guint32 property, gpointer value)
 {
+       CHECKED_METADATA_STORE_LOCAL (image->mempool, value);
        mono_image_lock (image);
        mono_property_hash_insert (image->property_hash, subject, property, value);
        mono_image_unlock (image);
index c3ad58b3431c00e04a95676339e5f07ea2e3291f..b158ec26834acc9962eb16361ee9cb94ba8dd243 100644 (file)
@@ -3,6 +3,7 @@
 
 #include <stdio.h>
 #include <mono/utils/mono-publib.h>
+#include <mono/utils/mono-error.h>
 
 MONO_BEGIN_DECLS
 
@@ -50,9 +51,9 @@ MONO_API int           mono_image_ensure_section_idx (MonoImage *image,
 
 MONO_API uint32_t       mono_image_get_entry_point    (MonoImage *image);
 MONO_API const char   *mono_image_get_resource       (MonoImage *image, uint32_t offset, uint32_t *size);
-MONO_API MonoImage*    mono_image_load_file_for_image (MonoImage *image, int fileidx);
+MONO_RT_EXTERNAL_ONLY MONO_API MonoImage*    mono_image_load_file_for_image (MonoImage *image, int fileidx);
 
-MONO_API MonoImage*    mono_image_load_module (MonoImage *image, int idx);
+MONO_RT_EXTERNAL_ONLY MONO_API MonoImage*    mono_image_load_module (MonoImage *image, int idx);
 
 MONO_API const char*   mono_image_get_name       (MonoImage *image);
 MONO_API const char*   mono_image_get_filename   (MonoImage *image);
index e94b73d590cfe85fd055d00b341fc8d84198c924..6ffff1a6b7328511743975d2b247935fe7aa9d6d 100644 (file)
@@ -195,7 +195,7 @@ jit_info_table_chunk_index (MonoJitInfoTableChunk *chunk, MonoThreadHazardPointe
 
        while (left < right) {
                int pos = (left + right) / 2;
-               MonoJitInfo *ji = (MonoJitInfo *)get_hazardous_pointer((gpointer volatile*)&chunk->data [pos], hp, JIT_INFO_HAZARD_INDEX);
+               MonoJitInfo *ji = (MonoJitInfo *)mono_get_hazardous_pointer((gpointer volatile*)&chunk->data [pos], hp, JIT_INFO_HAZARD_INDEX);
                gint8 *code_end = (gint8*)ji->code_start + ji->code_size;
 
                if (addr < code_end)
@@ -228,7 +228,7 @@ jit_info_table_find (MonoJitInfoTable *table, MonoThreadHazardPointers *hp, gint
                MonoJitInfoTableChunk *chunk = table->chunks [chunk_pos];
 
                while (pos < chunk->num_elements) {
-                       ji = (MonoJitInfo *)get_hazardous_pointer ((gpointer volatile*)&chunk->data [pos], hp, JIT_INFO_HAZARD_INDEX);
+                       ji = (MonoJitInfo *)mono_get_hazardous_pointer ((gpointer volatile*)&chunk->data [pos], hp, JIT_INFO_HAZARD_INDEX);
 
                        ++pos;
 
@@ -286,7 +286,7 @@ mono_jit_info_table_find_internal (MonoDomain *domain, char *addr, gboolean try_
           table by a hazard pointer and make sure that the pointer is
           still there after we've made it hazardous, we don't have to
           worry about the writer freeing the table. */
-       table = (MonoJitInfoTable *)get_hazardous_pointer ((gpointer volatile*)&domain->jit_info_table, hp, JIT_INFO_TABLE_HAZARD_INDEX);
+       table = (MonoJitInfoTable *)mono_get_hazardous_pointer ((gpointer volatile*)&domain->jit_info_table, hp, JIT_INFO_TABLE_HAZARD_INDEX);
 
        ji = jit_info_table_find (table, hp, (gint8*)addr);
        if (hp)
@@ -298,7 +298,7 @@ mono_jit_info_table_find_internal (MonoDomain *domain, char *addr, gboolean try_
 
        /* Maybe its an AOT module */
        if (try_aot && mono_get_root_domain () && mono_get_root_domain ()->aot_modules) {
-               table = (MonoJitInfoTable *)get_hazardous_pointer ((gpointer volatile*)&mono_get_root_domain ()->aot_modules, hp, JIT_INFO_TABLE_HAZARD_INDEX);
+               table = (MonoJitInfoTable *)mono_get_hazardous_pointer ((gpointer volatile*)&mono_get_root_domain ()->aot_modules, hp, JIT_INFO_TABLE_HAZARD_INDEX);
                module_ji = jit_info_table_find (table, hp, (gint8*)addr);
                if (module_ji)
                        ji = jit_info_find_in_aot_func (domain, module_ji->d.image, addr);
index 4f36ba3c82c11fd5f55a5e8e10866928fdf0a9a5..9e09748c344ba714c8e4002ed87f1531f690eb2d 100644 (file)
@@ -194,7 +194,7 @@ field_from_memberref (MonoImage *image, guint32 token, MonoClass **retklass,
        fname = mono_metadata_string_heap (image, cols [MONO_MEMBERREF_NAME]);
 
        if (!mono_verifier_verify_memberref_field_signature (image, cols [MONO_MEMBERREF_SIGNATURE], NULL)) {
-               mono_error_set_bad_image (error, image, "Bad field '%s' signature 0x%08x", class_index, token);
+               mono_error_set_bad_image (error, image, "Bad field '%u' signature 0x%08x", class_index, token);
                return NULL;
        }
 
@@ -209,7 +209,7 @@ field_from_memberref (MonoImage *image, guint32 token, MonoClass **retklass,
                klass = mono_class_get_and_inflate_typespec_checked (image, MONO_TOKEN_TYPE_SPEC | nindex, context, error);
                break;
        default:
-               mono_error_set_bad_image (error, image, "Bad field field '%s' signature 0x%08x", class_index, token);
+               mono_error_set_bad_image (error, image, "Bad field field '%u' signature 0x%08x", class_index, token);
        }
 
        if (!klass)
@@ -319,7 +319,7 @@ mono_field_from_token_checked (MonoImage *image, guint32 token, MonoClass **retk
                }
        }
 
-       if (field && field->parent && !field->parent->generic_class && !field->parent->generic_container) {
+       if (field && field->parent && !mono_class_is_ginst (field->parent) && !mono_class_is_gtd (field->parent)) {
                mono_image_lock (image);
                mono_conc_hashtable_insert (image->field_cache, GUINT_TO_POINTER (token), field);
                mono_image_unlock (image);
@@ -362,15 +362,17 @@ find_method_in_class (MonoClass *klass, const char *name, const char *qname, con
        /* Search directly in the metadata to avoid calling setup_methods () */
        mono_error_init (error);
 
-       /* FIXME: !from_class->generic_class condition causes test failures. */
-       if (klass->type_token && !image_is_dynamic (klass->image) && !klass->methods && !klass->rank && klass == from_class && !from_class->generic_class) {
-               for (i = 0; i < klass->method.count; ++i) {
+       /* FIXME: !mono_class_is_ginst (from_class) condition causes test failures. */
+       if (klass->type_token && !image_is_dynamic (klass->image) && !klass->methods && !klass->rank && klass == from_class && !mono_class_is_ginst (from_class)) {
+               int first_idx = mono_class_get_first_method_idx (klass);
+               int mcount = mono_class_get_method_count (klass);
+               for (i = 0; i < mcount; ++i) {
                        guint32 cols [MONO_METHOD_SIZE];
                        MonoMethod *method;
                        const char *m_name;
                        MonoMethodSignature *other_sig;
 
-                       mono_metadata_decode_table_row (klass->image, MONO_TABLE_METHOD, klass->method.first + i, cols, MONO_METHOD_SIZE);
+                       mono_metadata_decode_table_row (klass->image, MONO_TABLE_METHOD, first_idx + i, cols, MONO_METHOD_SIZE);
 
                        m_name = mono_metadata_string_heap (klass->image, cols [MONO_METHOD_NAME]);
 
@@ -379,7 +381,7 @@ find_method_in_class (MonoClass *klass, const char *name, const char *qname, con
                                  (name && !strcmp (m_name, name))))
                                continue;
 
-                       method = mono_get_method_checked (klass->image, MONO_TOKEN_METHOD_DEF | (klass->method.first + i + 1), klass, NULL, error);
+                       method = mono_get_method_checked (klass->image, MONO_TOKEN_METHOD_DEF | (first_idx + i + 1), klass, NULL, error);
                        if (!mono_error_ok (error)) //bail out if we hit a loader error
                                return NULL;
                        if (method) {
@@ -403,7 +405,8 @@ find_method_in_class (MonoClass *klass, const char *name, const char *qname, con
 
                return NULL;
        }
-       for (i = 0; i < klass->method.count; ++i) {
+       int mcount = mono_class_get_method_count (klass);
+       for (i = 0; i < mcount; ++i) {
                MonoMethod *m = klass->methods [i];
                MonoMethodSignature *msig;
 
@@ -431,7 +434,7 @@ find_method_in_class (MonoClass *klass, const char *name, const char *qname, con
                }
        }
 
-       if (i < klass->method.count)
+       if (i < mcount)
                return mono_class_get_method_by_index (from_class, i);
        return NULL;
 }
@@ -668,7 +671,7 @@ mono_method_get_signature_checked (MonoMethod *method, MonoImage *image, guint32
                return mono_method_signature_checked (method, error);
        }
 
-       if (method->klass->generic_class)
+       if (mono_class_is_ginst (method->klass))
                return mono_method_signature_checked (method, error);
 
        if (image_is_dynamic (image)) {
@@ -751,7 +754,8 @@ mono_method_search_in_array_class (MonoClass *klass, const char *name, MonoMetho
 
        mono_class_setup_methods (klass);
        g_assert (!mono_class_has_failure (klass)); /*FIXME this should not fail, right?*/
-       for (i = 0; i < klass->method.count; ++i) {
+       int mcount = mono_class_get_method_count (klass);
+       for (i = 0; i < mcount; ++i) {
                MonoMethod *method = klass->methods [i];
                if (strcmp (method->name, name) == 0 && sig->param_count == method->signature->param_count)
                        return method;
@@ -854,7 +858,7 @@ method_from_memberref (MonoImage *image, guint32 idx, MonoGenericContext *typesp
                type = &klass->byval_arg;
 
                if (type->type != MONO_TYPE_ARRAY && type->type != MONO_TYPE_SZARRAY) {
-                       MonoClass *in_class = klass->generic_class ? klass->generic_class->container_class : klass;
+                       MonoClass *in_class = mono_class_is_ginst (klass) ? mono_class_get_generic_class (klass)->container_class : klass;
                        method = find_method (in_class, NULL, mname, sig, klass, error);
                        break;
                }
@@ -941,12 +945,12 @@ method_from_methodspec (MonoImage *image, MonoGenericContext *context, guint32 i
 
        klass = method->klass;
 
-       if (klass->generic_class) {
+       if (mono_class_is_ginst (klass)) {
                g_assert (method->is_inflated);
                method = ((MonoMethodInflated *) method)->declaring;
        }
 
-       new_context.class_inst = klass->generic_class ? klass->generic_class->context.class_inst : NULL;
+       new_context.class_inst = mono_class_is_ginst (klass) ? mono_class_get_generic_class (klass)->context.class_inst : NULL;
        new_context.method_inst = inst;
 
        method = mono_class_inflate_generic_method_full_checked (method, klass, &new_context, error);
@@ -1123,6 +1127,14 @@ cached_module_load (const char *name, int flags, char **err)
        return res;
 }
 
+void
+mono_loader_register_module (const char *name, MonoDl *module)
+{
+       if (!global_module_map)
+               global_module_map = g_hash_table_new (g_str_hash, g_str_equal);
+       g_hash_table_insert (global_module_map, g_strdup (name), module);
+}
+
 static MonoDl *internal_module;
 
 static gboolean
@@ -1651,7 +1663,7 @@ mono_get_method_from_token (MonoImage *image, guint32 token, MonoClass *klass,
                sig = mono_metadata_blob_heap (image, cols [4]);
        /* size = */ mono_metadata_decode_blob_size (sig, &sig);
 
-       container = klass->generic_container;
+       container = mono_class_try_get_generic_container (klass);
 
        /* 
         * load_generic_params does a binary search so only call it if the method 
@@ -2133,8 +2145,6 @@ mono_method_get_wrapper_data (MonoMethod *method, guint32 id)
        g_assert (method != NULL);
        g_assert (method->wrapper_type != MONO_WRAPPER_NONE);
 
-       if (method->is_inflated)
-               method = ((MonoMethodInflated *) method)->declaring;
        data = (void **)((MonoMethodWrapper *)method)->method_data;
        g_assert (data != NULL);
        g_assert (id <= GPOINTER_TO_UINT (*data));
@@ -2224,7 +2234,7 @@ mono_stack_walk_async_safe (MonoStackWalkAsyncSafe func, void *initial_sig_conte
        AsyncStackWalkUserData ud = { func, user_data };
 
        mono_sigctx_to_monoctx (initial_sig_context, &ctx);
-       mono_get_eh_callbacks ()->mono_walk_stack_with_ctx (async_stack_walk_adapter, NULL, MONO_UNWIND_SIGNAL_SAFE, &ud);
+       mono_get_eh_callbacks ()->mono_walk_stack_with_ctx (async_stack_walk_adapter, &ctx, MONO_UNWIND_SIGNAL_SAFE, &ud);
 }
 
 static gboolean
@@ -2368,10 +2378,10 @@ mono_method_signature_checked (MonoMethod *m, MonoError *error)
 
        sig = mono_metadata_blob_heap (img, sig_offset = mono_metadata_decode_row_col (&img->tables [MONO_TABLE_METHOD], idx - 1, MONO_METHOD_SIGNATURE));
 
-       g_assert (!m->klass->generic_class);
+       g_assert (!mono_class_is_ginst (m->klass));
        container = mono_method_get_generic_container (m);
        if (!container)
-               container = m->klass->generic_container;
+               container = mono_class_try_get_generic_container (m->klass);
 
        /* Generic signatures depend on the container so they cannot be cached */
        /* icall/pinvoke signatures cannot be cached cause we modify them below */
@@ -2573,7 +2583,7 @@ mono_method_get_header_checked (MonoMethod *method, MonoError *error)
         */
        container = mono_method_get_generic_container (method);
        if (!container)
-               container = method->klass->generic_container;
+               container = mono_class_try_get_generic_container (method->klass);
        return mono_metadata_parse_mh_full (img, container, (const char *)loc, error);
 }
 
@@ -2614,12 +2624,14 @@ mono_method_get_index (MonoMethod *method)
        mono_class_setup_methods (klass);
        if (mono_class_has_failure (klass))
                return 0;
-       for (i = 0; i < klass->method.count; ++i) {
+       int first_idx = mono_class_get_first_method_idx (klass);
+       int mcount = mono_class_get_method_count (klass);
+       for (i = 0; i < mcount; ++i) {
                if (method == klass->methods [i]) {
                        if (klass->image->uncompressed_metadata)
-                               return mono_metadata_translate_token_index (klass->image, MONO_TABLE_METHOD, klass->method.first + i + 1);
+                               return mono_metadata_translate_token_index (klass->image, MONO_TABLE_METHOD, first_idx + i + 1);
                        else
-                               return klass->method.first + i + 1;
+                               return first_idx + i + 1;
                }
        }
        return 0;
index a2c6d349ddf15fcc186278750843b8289e4a6c96..328cb5ac7583312904112bbfb933f779f8a9c402 100644 (file)
@@ -63,7 +63,6 @@ mono_lookup_internal_call (MonoMethod *method);
 void*
 mono_lookup_internal_call_full (MonoMethod *method, mono_bool *uses_handles);
 
-
 MONO_API const char*
 mono_lookup_icall_symbol (MonoMethod *m);
 
index bcb0dc3c0146748719a55c6a9002fc609a2c61b4..783b528339c41d84657ab7ae50fcd0b0eb5831b9 100644 (file)
@@ -434,7 +434,7 @@ get_darwin_locale (void)
                                        len += bytes_converted + 1;
                                }
 
-                               darwin_locale = (char *) malloc (len + 1);
+                               darwin_locale = (char *) g_malloc (len + 1);
                                CFStringGetBytes (locale_language, CFRangeMake (0, CFStringGetLength (locale_language)), kCFStringEncodingMacRoman, 0, FALSE, (UInt8 *) darwin_locale, len, &bytes_converted);
 
                                darwin_locale[bytes_converted] = '-';
@@ -454,9 +454,9 @@ get_darwin_locale (void)
 
                        if (locale_cfstr) {
                                len = CFStringGetMaximumSizeForEncoding (CFStringGetLength (locale_cfstr), kCFStringEncodingMacRoman) + 1;
-                               darwin_locale = (char *) malloc (len);
+                               darwin_locale = (char *) g_malloc (len);
                                if (!CFStringGetCString (locale_cfstr, darwin_locale, len, kCFStringEncodingMacRoman)) {
-                                       free (darwin_locale);
+                                       g_free (darwin_locale);
                                        CFRelease (locale);
                                        darwin_locale = NULL;
                                        return NULL;
index f0d2bca6ed49d12a513f5356d770a9790b2e53f3..8ca4a27ab8211ed592ba4f0cbbe4d7f78d4ad91f 100644 (file)
 #endif
 
 #include <mono/io-layer/io-layer.h>
+#include <mono/utils/mono-compiler.h>
 
 #include "lock-tracer.h"
 
-
 /*
  * This is a very simple lock trace implementation. It can be used to verify that the runtime is
  * correctly following all locking rules.
@@ -141,5 +141,7 @@ mono_locks_lock_released (RuntimeLocks kind, gpointer lock)
 {
        add_record (RECORD_LOCK_RELEASED, kind, lock);
 }
+#else
 
-#endif
+MONO_EMPTY_SOURCE_FILE (lock_tracer);
+#endif /* LOCK_TRACER */
diff --git a/mono/metadata/marshal-internals.h b/mono/metadata/marshal-internals.h
new file mode 100644 (file)
index 0000000..1b4ff57
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2016 Microsoft
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
+ */
+#ifndef __MONO_METADATA_MARSHAL_INTERNALS_H__
+#define __MONO_METADATA_MARSHAL_INTERNALS_H__
+
+#include <config.h>
+#include <glib.h>
+#include <mono/metadata/object-internals.h>
+
+// On Windows platform implementation of bellow methods are hosted in separate source file
+// masrshal-windows.c or marshal-windows-*.c. On other platforms the implementation is still keept
+// in marshal.c still declared as static and in some places even inlined.
+#ifdef HOST_WIN32
+void*
+mono_marshal_alloc_co_task_mem (size_t size);
+
+void
+mono_marshal_free_co_task_mem (void *ptr);
+
+gpointer
+mono_marshal_realloc_co_task_mem (gpointer ptr, size_t size);
+
+void*
+mono_marshal_alloc_hglobal (size_t size);
+
+gpointer
+mono_marshal_realloc_hglobal (gpointer ptr, size_t size);
+
+void
+mono_marshal_free_hglobal (void *ptr);
+
+gpointer
+mono_string_to_utf8str (MonoString *s);
+#endif  /* HOST_WIN32 */
+
+#endif /* __MONO_METADATA_MARSHAL_INTERNALS_H__ */
diff --git a/mono/metadata/marshal-windows-internals.h b/mono/metadata/marshal-windows-internals.h
new file mode 100644 (file)
index 0000000..d6b3f45
--- /dev/null
@@ -0,0 +1,17 @@
+/*
+ * Copyright 2016 Microsoft
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
+ */
+#ifndef __MONO_METADATA_MARSHAL_WINDOWS_INTERNALS_H__
+#define __MONO_METADATA_MARSHAL_WINDOWS_INTERNALS_H__
+
+#include <config.h>
+#include <glib.h>
+
+#ifdef HOST_WIN32
+#include "mono/metadata/marshal.h"
+#include "mono/metadata/marshal-internals.h"
+#include "mono/metadata/exception.h"
+#endif /* HOST_WIN32 */
+
+#endif /* __MONO_METADATA_MARSHAL_WINDOWS_INTERNALS_H__ */
diff --git a/mono/metadata/marshal-windows-uwp.c b/mono/metadata/marshal-windows-uwp.c
new file mode 100644 (file)
index 0000000..7ac1a33
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * marshal-windows-uwp.c: UWP marshal support for Mono.
+ *
+ * Copyright 2016 Microsoft
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
+*/
+#include <config.h>
+#include <glib.h>
+#include "mono/utils/mono-compiler.h"
+
+#if G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT)
+#include <windows.h>
+#include "mono/metadata/marshal-windows-internals.h"
+
+void *
+mono_marshal_alloc_hglobal (size_t size)
+{
+       return HeapAlloc (GetProcessHeap (), 0, size);
+}
+
+gpointer
+mono_marshal_realloc_hglobal (gpointer ptr, size_t size)
+{
+       return HeapReAlloc (GetProcessHeap (), 0, ptr, size);
+}
+
+void
+mono_marshal_free_hglobal (gpointer ptr)
+{
+       HeapFree (GetProcessHeap (), 0, ptr);
+       return;
+}
+
+#else /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
+
+MONO_EMPTY_SOURCE_FILE (marshal_windows_uwp);
+#endif /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
diff --git a/mono/metadata/marshal-windows.c b/mono/metadata/marshal-windows.c
new file mode 100644 (file)
index 0000000..69ee01d
--- /dev/null
@@ -0,0 +1,125 @@
+/*
+ * marshal-windows.c: Windows marshal support.
+ *
+ * Copyright 2016 Microsoft
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
+ */
+#include <config.h>
+#include <glib.h>
+
+#if defined(HOST_WIN32)
+#include <winsock2.h>
+#include <windows.h>
+#include <objbase.h>
+#include "mono/metadata/marshal-windows-internals.h"
+
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
+void*
+mono_marshal_alloc_hglobal (size_t size)
+{
+       return GlobalAlloc (GMEM_FIXED, size);
+}
+
+gpointer
+mono_marshal_realloc_hglobal (gpointer ptr, size_t size)
+{
+       return GlobalReAlloc (ptr, size, GMEM_MOVEABLE);
+}
+
+void
+mono_marshal_free_hglobal (gpointer ptr)
+{
+       GlobalFree (ptr);
+       return;
+}
+#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */
+
+void*
+mono_marshal_alloc_co_task_mem (size_t size)
+{
+       return CoTaskMemAlloc (size);
+}
+
+void
+mono_marshal_free_co_task_mem (void *ptr)
+{
+       CoTaskMemFree (ptr);
+       return;
+}
+
+gpointer
+mono_marshal_realloc_co_task_mem (gpointer ptr, size_t size)
+{
+       return CoTaskMemRealloc (ptr, size);
+}
+
+gpointer
+ves_icall_System_Runtime_InteropServices_Marshal_StringToHGlobalAnsi (MonoString *string)
+{
+       MonoError error;
+       char* tres, *ret;
+       size_t len;
+       tres = mono_string_to_utf8_checked (string, &error);
+       if (mono_error_set_pending_exception (&error))
+               return NULL;
+       if (!tres)
+               return tres;
+
+       /*
+        * mono_string_to_utf8_checked() returns a memory area at least as large as the size of the
+        * MonoString, even if it contains NULL characters. The copy we allocate here has to be equally
+        * large.
+        */
+       len = MAX (strlen (tres) + 1, string->length);
+       ret = ves_icall_System_Runtime_InteropServices_Marshal_AllocHGlobal ((gpointer)len);
+       memcpy (ret, tres, len);
+       g_free (tres);
+       return ret;
+}
+
+gpointer
+ves_icall_System_Runtime_InteropServices_Marshal_StringToHGlobalUni (MonoString *string)
+{
+       if (string == NULL)
+               return NULL;
+       else {
+               size_t len = ((mono_string_length (string) + 1) * 2);
+               gunichar2 *res = ves_icall_System_Runtime_InteropServices_Marshal_AllocHGlobal ((gpointer)len);
+
+               memcpy (res, mono_string_chars (string), mono_string_length (string) * 2);
+               res [mono_string_length (string)] = 0;
+               return res;
+       }
+}
+
+gpointer
+mono_string_to_utf8str (MonoString *s)
+{
+       char *as, *tmp;
+       glong len;
+       GError *error = NULL;
+
+       if (s == NULL)
+               return NULL;
+
+       if (!s->length) {
+               as = CoTaskMemAlloc (1);
+               as [0] = '\0';
+               return as;
+       }
+
+       tmp = g_utf16_to_utf8 (mono_string_chars (s), s->length, NULL, &len, &error);
+       if (error) {
+               MonoException *exc = mono_get_exception_argument ("string", error->message);
+               g_error_free (error);
+               mono_set_pending_exception (exc);
+               return NULL;
+       } else {
+               as = CoTaskMemAlloc (len + 1);
+               memcpy (as, tmp, len + 1);
+               g_free (tmp);
+               return as;
+       }
+}
+
+#endif /* HOST_WIN32 */
index b27996839e9356dd40c0496abbc451ef3723a6d6..4f8631d5c50a65def07773c353b27fc079f259ac 100644 (file)
@@ -20,6 +20,7 @@
 #include "loader.h"
 #include "cil-coff.h"
 #include "metadata/marshal.h"
+#include "metadata/marshal-internals.h"
 #include "metadata/method-builder.h"
 #include "metadata/tabledefs.h"
 #include "metadata/exception.h"
@@ -81,6 +82,8 @@ static MonoNativeTlsKey load_type_info_tls_id;
 
 static gboolean use_aot_wrappers;
 
+static int class_marshal_info_count;
+
 static void ftnptr_eh_callback_default (guint32 gchandle);
 
 static MonoFtnPtrEHCallback ftnptr_eh_callback = ftnptr_eh_callback_default;
@@ -95,7 +98,7 @@ static void
 emit_struct_conv (MonoMethodBuilder *mb, MonoClass *klass, gboolean to_object);
 
 static void
-emit_struct_conv_full (MonoMethodBuilder *mb, MonoClass *klass, gboolean to_object, MonoMarshalNative string_encoding);
+emit_struct_conv_full (MonoMethodBuilder *mb, MonoClass *klass, gboolean to_object, int offset_of_first_child_field, MonoMarshalNative string_encoding);
 
 static void 
 mono_struct_delete_old (MonoClass *klass, char *ptr);
@@ -106,8 +109,10 @@ mono_marshal_string_to_utf16 (MonoString *s);
 static void *
 mono_marshal_string_to_utf16_copy (MonoString *s);
 
+#ifndef HOST_WIN32
 static gpointer
-mono_string_to_lpstr (MonoString *string_obj);
+mono_string_to_utf8str (MonoString *string_obj);
+#endif
 
 static MonoStringBuilder *
 mono_string_utf8_to_builder2 (char *text);
@@ -303,7 +308,7 @@ mono_marshal_init (void)
                register_icall (mono_string_new_wrapper, "mono_string_new_wrapper", "obj ptr", FALSE);
                register_icall (mono_string_new_len_wrapper, "mono_string_new_len_wrapper", "obj ptr int", FALSE);
                register_icall (ves_icall_mono_string_to_utf8, "ves_icall_mono_string_to_utf8", "ptr obj", FALSE);
-               register_icall (mono_string_to_lpstr, "mono_string_to_lpstr", "ptr obj", FALSE);
+               register_icall (mono_string_to_utf8str, "mono_string_to_utf8str", "ptr obj", FALSE);
                register_icall (mono_string_to_ansibstr, "mono_string_to_ansibstr", "ptr object", FALSE);
                register_icall (mono_string_builder_to_utf8, "mono_string_builder_to_utf8", "ptr object", FALSE);
                register_icall (mono_string_builder_to_utf16, "mono_string_builder_to_utf16", "ptr object", FALSE);
@@ -351,6 +356,10 @@ mono_marshal_init (void)
 
                mono_cominterop_init ();
                mono_remoting_init ();
+
+               mono_counters_register ("MonoClass::class_marshal_info_count count",
+                                                               MONO_COUNTER_METADATA | MONO_COUNTER_INT, &class_marshal_info_count);
+
        }
 }
 
@@ -778,7 +787,7 @@ mono_free_lparray (MonoArray *array, gpointer* nativeArray)
        if (klass->element_class->byval_arg.type == MONO_TYPE_CLASS) {
                for(i = 0; i < array->max_length; ++i)
                        mono_marshal_free_ccw (mono_array_get (array, MonoObject*, i));
-               free(nativeArray);
+               g_free (nativeArray);
        }
 #endif
 }
@@ -919,13 +928,13 @@ mono_string_utf8_to_builder (MonoStringBuilder *sb, char *text)
        if (!sb || !text)
                return;
 
-       int len = strlen (text);
-       if (len > mono_string_builder_capacity (sb))
-               len = mono_string_builder_capacity (sb);
-
        GError *error = NULL;
        glong copied;
-       gunichar2* ut = g_utf8_to_utf16 (text, len, NULL, &copied, &error);
+       gunichar2* ut = g_utf8_to_utf16 (text, strlen (text), NULL, &copied, &error);
+       int capacity = mono_string_builder_capacity (sb);
+
+       if (copied > capacity)
+               copied = capacity;
 
        if (!error) {
                MONO_OBJECT_SETREF (sb, chunkPrevious, NULL);
@@ -949,7 +958,6 @@ mono_string_utf8_to_builder2 (char *text)
        return sb;
 }
 
-
 void
 mono_string_utf16_to_builder (MonoStringBuilder *sb, gunichar2 *text)
 {
@@ -982,7 +990,7 @@ mono_string_builder_to_utf8 (MonoStringBuilder *sb)
 {
        MonoError error;
        GError *gerror = NULL;
-
+       glong byte_count;
        if (!sb)
                return NULL;
 
@@ -990,7 +998,7 @@ mono_string_builder_to_utf8 (MonoStringBuilder *sb)
 
        guint str_len = mono_string_builder_string_length (sb);
 
-       gchar *tmp = g_utf16_to_utf8 (str_utf16, str_len, NULL, NULL, &gerror);
+       gchar *tmp = g_utf16_to_utf8 (str_utf16, str_len, NULL, &byte_count, &gerror);
 
        if (gerror) {
                g_error_free (gerror);
@@ -999,7 +1007,7 @@ mono_string_builder_to_utf8 (MonoStringBuilder *sb)
                return NULL;
        } else {
                guint len = mono_string_builder_capacity (sb) + 1;
-               gchar *res = (gchar *)mono_marshal_alloc (len * sizeof (gchar), &error);
+               gchar *res = (gchar *)mono_marshal_alloc (MAX (byte_count+1, len * sizeof (gchar)), &error);
                if (!mono_error_ok (&error)) {
                        mono_marshal_free (str_utf16);
                        g_free (tmp);
@@ -1007,9 +1015,8 @@ mono_string_builder_to_utf8 (MonoStringBuilder *sb)
                        return NULL;
                }
 
-               g_assert (str_len < len);
-               memcpy (res, tmp, str_len * sizeof (gchar));
-               res[str_len] = '\0';
+               memcpy (res, tmp, byte_count);
+               res[byte_count] = '\0';
 
                mono_marshal_free (str_utf16);
                g_free (tmp);
@@ -1075,43 +1082,17 @@ mono_string_builder_to_utf16 (MonoStringBuilder *sb)
        return str;
 }
 
+#ifndef HOST_WIN32
 /* This is a JIT icall, it sets the pending exception and returns NULL on error. */
 static gpointer
-mono_string_to_lpstr (MonoString *s)
+mono_string_to_utf8str (MonoString *s)
 {
-#ifdef TARGET_WIN32
-       char *as, *tmp;
-       glong len;
-       GError *error = NULL;
-
-       if (s == NULL)
-               return NULL;
-
-       if (!s->length) {
-               as = CoTaskMemAlloc (1);
-               as [0] = '\0';
-               return as;
-       }
-
-       tmp = g_utf16_to_utf8 (mono_string_chars (s), s->length, NULL, &len, &error);
-       if (error) {
-               MonoException *exc = mono_get_exception_argument ("string", error->message);
-               g_error_free (error);
-               mono_set_pending_exception (exc);
-               return NULL;
-       } else {
-               as = CoTaskMemAlloc (len + 1);
-               memcpy (as, tmp, len + 1);
-               g_free (tmp);
-               return as;
-       }
-#else
        MonoError error;
        char *result = mono_string_to_utf8_checked (s, &error);
        mono_error_set_pending_exception (&error);
        return result;
+}
 #endif
-}      
 
 gpointer
 mono_string_to_ansibstr (MonoString *string_obj)
@@ -1499,7 +1480,10 @@ emit_ptr_to_object_conv (MonoMethodBuilder *mb, MonoType *type, MonoMarshalConv
 #endif
                mono_mb_emit_byte (mb, CEE_STIND_REF);  
                break;
+
+               // In Mono historically LPSTR was treated as a UTF8STR
        case MONO_MARSHAL_CONV_STR_LPSTR:
+       case MONO_MARSHAL_CONV_STR_UTF8STR:
                mono_mb_emit_ldloc (mb, 1);
                mono_mb_emit_ldloc (mb, 0);
                mono_mb_emit_byte (mb, CEE_LDIND_I);
@@ -1627,6 +1611,7 @@ conv_to_icall (MonoMarshalConv conv, int *ind_store_type)
        case MONO_MARSHAL_CONV_LPTSTR_STR:
                *ind_store_type = CEE_STIND_REF;
                return mono_string_new_wrapper;
+       case MONO_MARSHAL_CONV_UTF8STR_STR:
        case MONO_MARSHAL_CONV_LPSTR_STR:
                *ind_store_type = CEE_STIND_REF;
                return mono_string_new_wrapper;
@@ -1634,10 +1619,12 @@ conv_to_icall (MonoMarshalConv conv, int *ind_store_type)
 #ifdef TARGET_WIN32
                return mono_marshal_string_to_utf16;
 #else
-               return mono_string_to_lpstr;
+               return mono_string_to_utf8str;
 #endif
+               // In Mono historically LPSTR was treated as a UTF8STR
+       case MONO_MARSHAL_CONV_STR_UTF8STR:
        case MONO_MARSHAL_CONV_STR_LPSTR:
-               return mono_string_to_lpstr;
+               return mono_string_to_utf8str;
        case MONO_MARSHAL_CONV_STR_BSTR:
                return mono_string_to_bstr;
        case MONO_MARSHAL_CONV_BSTR_STR:
@@ -1646,6 +1633,7 @@ conv_to_icall (MonoMarshalConv conv, int *ind_store_type)
        case MONO_MARSHAL_CONV_STR_TBSTR:
        case MONO_MARSHAL_CONV_STR_ANSIBSTR:
                return mono_string_to_ansibstr;
+       case MONO_MARSHAL_CONV_SB_UTF8STR:
        case MONO_MARSHAL_CONV_SB_LPSTR:
                return mono_string_builder_to_utf8;
        case MONO_MARSHAL_CONV_SB_LPTSTR:
@@ -1667,6 +1655,7 @@ conv_to_icall (MonoMarshalConv conv, int *ind_store_type)
        case MONO_MARSHAL_CONV_FTN_DEL:
                *ind_store_type = CEE_STIND_REF;
                return mono_ftnptr_to_delegate;
+       case MONO_MARSHAL_CONV_UTF8STR_SB:
        case MONO_MARSHAL_CONV_LPSTR_SB:
                *ind_store_type = CEE_STIND_REF;
                return mono_string_utf8_to_builder;
@@ -1713,6 +1702,8 @@ emit_object_to_ptr_conv (MonoMethodBuilder *mb, MonoType *type, MonoMarshalConv
                mono_mb_emit_byte (mb, CEE_NEG);
                mono_mb_emit_byte (mb, CEE_STIND_I2);
                break;
+       // In Mono historically LPSTR was treated as a UTF8STR
+       case MONO_MARSHAL_CONV_STR_UTF8STR:
        case MONO_MARSHAL_CONV_STR_LPWSTR:
        case MONO_MARSHAL_CONV_STR_LPSTR:
        case MONO_MARSHAL_CONV_STR_LPTSTR:
@@ -1937,15 +1928,28 @@ emit_object_to_ptr_conv (MonoMethodBuilder *mb, MonoType *type, MonoMarshalConv
        }
 }
 
+static int
+offset_of_first_nonstatic_field (MonoClass *klass)
+{
+       int i;
+       int fcount = mono_class_get_field_count (klass);
+       for (i = 0; i < fcount; i++) {
+               if (!(klass->fields[i].type->attrs & FIELD_ATTRIBUTE_STATIC) && !mono_field_is_deleted (&klass->fields[i]))
+                       return klass->fields[i].offset - sizeof (MonoObject);
+       }
+
+       return 0;
+}
+
 static void
 emit_struct_conv_full (MonoMethodBuilder *mb, MonoClass *klass, gboolean to_object,
-                                          MonoMarshalNative string_encoding)
+                                               int offset_of_first_child_field, MonoMarshalNative string_encoding)
 {
        MonoMarshalType *info;
        int i;
 
        if (klass->parent)
-               emit_struct_conv(mb, klass->parent, to_object);
+               emit_struct_conv_full (mb, klass->parent, to_object, offset_of_first_nonstatic_field (klass), string_encoding);
 
        info = mono_marshal_load_type_info (klass);
 
@@ -1953,21 +1957,26 @@ emit_struct_conv_full (MonoMethodBuilder *mb, MonoClass *klass, gboolean to_obje
                return;
 
        if (klass->blittable) {
-               int msize = mono_class_value_size (klass, NULL);
-               g_assert (msize == info->native_size);
+               int usize = mono_class_value_size (klass, NULL);
+               g_assert (usize == info->native_size);
                mono_mb_emit_ldloc (mb, 1);
                mono_mb_emit_ldloc (mb, 0);
-               mono_mb_emit_icon (mb, msize);
+               mono_mb_emit_icon (mb, usize);
                mono_mb_emit_byte (mb, CEE_PREFIX1);
                mono_mb_emit_byte (mb, CEE_CPBLK);
 
-               mono_mb_emit_add_to_local (mb, 0, msize);
-               mono_mb_emit_add_to_local (mb, 1, msize);
+               if (to_object) {
+                       mono_mb_emit_add_to_local (mb, 0, usize);
+                       mono_mb_emit_add_to_local (mb, 1, offset_of_first_child_field);
+               } else {
+                       mono_mb_emit_add_to_local (mb, 0, offset_of_first_child_field);
+                       mono_mb_emit_add_to_local (mb, 1, usize);
+               }
                return;
        }
 
        if (klass != mono_class_try_get_safehandle_class ()) {
-               if ((klass->flags & TYPE_ATTRIBUTE_LAYOUT_MASK) == TYPE_ATTRIBUTE_AUTO_LAYOUT) {
+               if (mono_class_is_auto_layout (klass)) {
                        char *msg = g_strdup_printf ("Type %s which is passed to unmanaged code must have a StructLayout attribute.",
                                                                                 mono_type_full_name (&klass->byval_arg));
                        mono_mb_emit_exception_marshal_directive (mb, msg);
@@ -2002,7 +2011,7 @@ emit_struct_conv_full (MonoMethodBuilder *mb, MonoClass *klass, gboolean to_obje
                         * the layout to the managed structure as well.
                         */
                        
-                       if (((klass->flags & TYPE_ATTRIBUTE_LAYOUT_MASK) == TYPE_ATTRIBUTE_EXPLICIT_LAYOUT) && (usize == 0)) {
+                       if (mono_class_is_explicit_layout (klass) && (usize == 0)) {
                                if (MONO_TYPE_IS_REFERENCE (info->fields [i].field->type) ||
                                    ((!last_field && MONO_TYPE_IS_REFERENCE (info->fields [i + 1].field->type))))
                                        g_error ("Type %s which has an [ExplicitLayout] attribute cannot have a "
@@ -2166,7 +2175,7 @@ emit_struct_conv_full (MonoMethodBuilder *mb, MonoClass *klass, gboolean to_obje
 static void
 emit_struct_conv (MonoMethodBuilder *mb, MonoClass *klass, gboolean to_object)
 {
-       emit_struct_conv_full (mb, klass, to_object, (MonoMarshalNative)-1);
+       emit_struct_conv_full (mb, klass, to_object, 0, (MonoMarshalNative)-1);
 }
 
 static void
@@ -2425,6 +2434,8 @@ mono_marshal_get_string_to_ptr_conv (MonoMethodPInvoke *piinfo, MonoMarshalSpec
                return MONO_MARSHAL_CONV_STR_LPTSTR;
        case MONO_NATIVE_BSTR:
                return MONO_MARSHAL_CONV_STR_BSTR;
+       case MONO_NATIVE_UTF8STR:
+               return MONO_MARSHAL_CONV_STR_UTF8STR;
        default:
                return MONO_MARSHAL_CONV_INVALID;
        }
@@ -2438,13 +2449,12 @@ mono_marshal_get_stringbuilder_to_ptr_conv (MonoMethodPInvoke *piinfo, MonoMarsh
        switch (encoding) {
        case MONO_NATIVE_LPWSTR:
                return MONO_MARSHAL_CONV_SB_LPWSTR;
-               break;
        case MONO_NATIVE_LPSTR:
                return MONO_MARSHAL_CONV_SB_LPSTR;
-               break;
+       case MONO_NATIVE_UTF8STR:
+               return MONO_MARSHAL_CONV_SB_UTF8STR;
        case MONO_NATIVE_LPTSTR:
                return MONO_MARSHAL_CONV_SB_LPTSTR;
-               break;
        default:
                return MONO_MARSHAL_CONV_INVALID;
        }
@@ -2461,6 +2471,8 @@ mono_marshal_get_ptr_to_string_conv (MonoMethodPInvoke *piinfo, MonoMarshalSpec
        case MONO_NATIVE_LPWSTR:
                *need_free = FALSE;
                return MONO_MARSHAL_CONV_LPWSTR_STR;
+       case MONO_NATIVE_UTF8STR:
+               return MONO_MARSHAL_CONV_UTF8STR_STR;
        case MONO_NATIVE_LPSTR:
        case MONO_NATIVE_VBBYREFSTR:
                return MONO_MARSHAL_CONV_LPSTR_STR;
@@ -2488,6 +2500,8 @@ mono_marshal_get_ptr_to_stringbuilder_conv (MonoMethodPInvoke *piinfo, MonoMarsh
                 */
                *need_free = FALSE;
                return MONO_MARSHAL_CONV_LPWSTR_SB;
+       case MONO_NATIVE_UTF8STR:
+               return MONO_MARSHAL_CONV_UTF8STR_SB;
        case MONO_NATIVE_LPSTR:
                return MONO_MARSHAL_CONV_LPSTR_SB;
                break;
@@ -2675,6 +2689,11 @@ mono_marshal_method_from_wrapper (MonoMethod *wrapper)
                        return info->d.runtime_invoke.method;
                else
                        return NULL;
+       case MONO_WRAPPER_DELEGATE_INVOKE:
+               if (info)
+                       return info->d.delegate_invoke.method;
+               else
+                       return NULL;
        default:
                return NULL;
        }
@@ -2870,6 +2889,7 @@ cache_generic_delegate_wrapper (GHashTable *cache, MonoMethod *orig_method, Mono
 {
        MonoError error;
        MonoMethod *inst, *res;
+       WrapperInfo *ginfo, *info;
 
        /*
         * We use the same cache for the generic definition and the instances.
@@ -2877,6 +2897,16 @@ cache_generic_delegate_wrapper (GHashTable *cache, MonoMethod *orig_method, Mono
        inst = mono_class_inflate_generic_method_checked (def, ctx, &error);
        g_assert (mono_error_ok (&error)); /* FIXME don't swallow the error */
 
+       ginfo = mono_marshal_get_wrapper_info (def);
+       if (ginfo) {
+               info = (WrapperInfo *)mono_image_alloc0 (def->klass->image, sizeof (WrapperInfo));
+               info->subtype = ginfo->subtype;
+               if (info->subtype == WRAPPER_SUBTYPE_NONE) {
+                       info->d.delegate_invoke.method = mono_class_inflate_generic_method_checked (ginfo->d.delegate_invoke.method, ctx, &error);
+                       mono_error_assert_ok (&error);
+               }
+       }
+
        mono_memory_barrier ();
        mono_marshal_lock ();
        res = (MonoMethod *)g_hash_table_lookup (cache, orig_method->klass);
@@ -3246,7 +3276,7 @@ mono_marshal_get_delegate_invoke_internal (MonoMethod *method, gboolean callvirt
        MonoMethod *res;
        GHashTable *cache;
        gpointer cache_key = NULL;
-       SignaturePointerPair key;
+       SignaturePointerPair key = { NULL, NULL };
        SignaturePointerPair *new_key;
        int local_i, local_len, local_delegates, local_d, local_target, local_res;
        int pos0, pos1, pos2;
@@ -3255,7 +3285,7 @@ mono_marshal_get_delegate_invoke_internal (MonoMethod *method, gboolean callvirt
        gboolean closed_over_null = FALSE;
        MonoGenericContext *ctx = NULL;
        MonoGenericContainer *container = NULL;
-       MonoMethod *orig_method = NULL;
+       MonoMethod *orig_method = method;
        WrapperInfo *info;
        WrapperSubtype subtype = WRAPPER_SUBTYPE_NONE;
        gboolean found;
@@ -3299,13 +3329,12 @@ mono_marshal_get_delegate_invoke_internal (MonoMethod *method, gboolean callvirt
         * For generic delegates, create a generic wrapper, and return an instance to help AOT.
         */
        if (method->is_inflated && subtype == WRAPPER_SUBTYPE_NONE) {
-               orig_method = method;
                ctx = &((MonoMethodInflated*)method)->context;
                method = ((MonoMethodInflated*)method)->declaring;
 
                container = mono_method_get_generic_container (method);
                if (!container)
-                       container = method->klass->generic_container;
+                       container = mono_class_try_get_generic_container (method->klass); //FIXME is this a case of a try?
                g_assert (container);
 
                invoke_sig = sig = mono_signature_no_pinvoke (method);
@@ -4921,8 +4950,7 @@ emit_marshal_vtype (EmitMarshalContext *m, int argnum, MonoType *t,
                        break;
                }
 
-               if (((klass->flags & TYPE_ATTRIBUTE_LAYOUT_MASK) == TYPE_ATTRIBUTE_EXPLICIT_LAYOUT) ||
-                       klass->blittable || klass->enumtype)
+               if (mono_class_is_explicit_layout (klass) || klass->blittable || klass->enumtype)
                        break;
 
                conv_arg = mono_mb_add_local (mb, &mono_defaults.int_class->byval_arg);
@@ -4968,8 +4996,7 @@ emit_marshal_vtype (EmitMarshalContext *m, int argnum, MonoType *t,
                        /* Have to change the signature since the vtype is passed byref */
                        m->csig->params [argnum - m->csig->hasthis] = &mono_defaults.int_class->byval_arg;
 
-                       if (((klass->flags & TYPE_ATTRIBUTE_LAYOUT_MASK) == TYPE_ATTRIBUTE_EXPLICIT_LAYOUT) ||
-                               klass->blittable || klass->enumtype)
+                       if (mono_class_is_explicit_layout (klass) || klass->blittable || klass->enumtype)
                                mono_mb_emit_ldarg_addr (mb, argnum);
                        else
                                mono_mb_emit_ldloc (mb, conv_arg);
@@ -4984,8 +5011,7 @@ emit_marshal_vtype (EmitMarshalContext *m, int argnum, MonoType *t,
                        break;
                }
 
-               if (((klass->flags & TYPE_ATTRIBUTE_LAYOUT_MASK) == TYPE_ATTRIBUTE_EXPLICIT_LAYOUT) ||
-                       klass->blittable || klass->enumtype) {
+               if (mono_class_is_explicit_layout (klass) || klass->blittable || klass->enumtype) {
                        mono_mb_emit_ldarg (mb, argnum);
                        break;
                }                       
@@ -5017,8 +5043,7 @@ emit_marshal_vtype (EmitMarshalContext *m, int argnum, MonoType *t,
                        break;
                }
 
-               if (((klass->flags & TYPE_ATTRIBUTE_LAYOUT_MASK) == TYPE_ATTRIBUTE_EXPLICIT_LAYOUT) ||
-                       klass->blittable || klass->enumtype)
+               if (mono_class_is_explicit_layout (klass) || klass->blittable || klass->enumtype)
                        break;
 
                if (t->byref) {
@@ -5046,8 +5071,7 @@ emit_marshal_vtype (EmitMarshalContext *m, int argnum, MonoType *t,
                break;
 
        case MARSHAL_ACTION_CONV_RESULT:
-               if (((klass->flags & TYPE_ATTRIBUTE_LAYOUT_MASK) == TYPE_ATTRIBUTE_EXPLICIT_LAYOUT) ||
-                       klass->blittable) {
+               if (mono_class_is_explicit_layout (klass) || klass->blittable) {
                        mono_mb_emit_stloc (mb, 3);
                        break;
                }
@@ -5066,8 +5090,7 @@ emit_marshal_vtype (EmitMarshalContext *m, int argnum, MonoType *t,
                break;
 
        case MARSHAL_ACTION_MANAGED_CONV_IN:
-               if (((klass->flags & TYPE_ATTRIBUTE_LAYOUT_MASK) == TYPE_ATTRIBUTE_EXPLICIT_LAYOUT) ||
-                       klass->blittable || klass->enumtype) {
+               if (mono_class_is_explicit_layout (klass) || klass->blittable || klass->enumtype) {
                        conv_arg = 0;
                        break;
                }
@@ -5099,11 +5122,8 @@ emit_marshal_vtype (EmitMarshalContext *m, int argnum, MonoType *t,
                break;
 
        case MARSHAL_ACTION_MANAGED_CONV_OUT:
-               if (((klass->flags & TYPE_ATTRIBUTE_LAYOUT_MASK) == TYPE_ATTRIBUTE_EXPLICIT_LAYOUT) ||
-                       klass->blittable || klass->enumtype) {
+               if (mono_class_is_explicit_layout (klass) || klass->blittable || klass->enumtype)
                        break;
-               }
-
                if (t->byref && (t->attrs & PARAM_ATTRIBUTE_IN) && !(t->attrs & PARAM_ATTRIBUTE_OUT))
                        break;
 
@@ -5126,8 +5146,7 @@ emit_marshal_vtype (EmitMarshalContext *m, int argnum, MonoType *t,
                break;
 
        case MARSHAL_ACTION_MANAGED_CONV_RESULT:
-               if (((klass->flags & TYPE_ATTRIBUTE_LAYOUT_MASK) == TYPE_ATTRIBUTE_EXPLICIT_LAYOUT) ||
-                       klass->blittable || klass->enumtype) {
+               if (mono_class_is_explicit_layout (klass) || klass->blittable || klass->enumtype) {
                        mono_mb_emit_stloc (mb, 3);
                        m->retobj_var = 0;
                        break;
@@ -5459,7 +5478,7 @@ emit_marshal_safehandle (EmitMarshalContext *m, int argnum, MonoType *t,
                MonoMethod *ctor = NULL;
                int intptr_handle_slot;
                
-               if (t->data.klass->flags & TYPE_ATTRIBUTE_ABSTRACT){
+               if (mono_class_is_abstract (t->data.klass)) {
                        mono_mb_emit_byte (mb, CEE_POP);
                        mono_mb_emit_exception_marshal_directive (mb, g_strdup ("Returned SafeHandles should not be abstract"));
                        break;
@@ -5732,6 +5751,9 @@ emit_marshal_object (EmitMarshalContext *m, int argnum, MonoType *t,
                                case MONO_NATIVE_LPSTR:
                                        mono_mb_emit_icall (mb, mono_string_utf8_to_builder2);
                                        break;
+                               case MONO_NATIVE_UTF8STR:
+                                       mono_mb_emit_icall (mb, mono_string_utf8_to_builder2);
+                                       break;
                                default:
                                        g_assert_not_reached ();
                                }
@@ -5842,6 +5864,8 @@ emit_marshal_object (EmitMarshalContext *m, int argnum, MonoType *t,
                        mono_mb_emit_ldloc (mb, 0);
                        mono_mb_emit_icall (mb, conv_to_icall (MONO_MARSHAL_CONV_FTN_DEL, NULL));
                        mono_mb_emit_stloc (mb, 3);
+               } else if (klass == mono_defaults.stringbuilder_class){
+                       // FIXME: implement
                } else {
                        /* set src */
                        mono_mb_emit_stloc (mb, 0);
@@ -5901,7 +5925,7 @@ emit_marshal_object (EmitMarshalContext *m, int argnum, MonoType *t,
                        encoding = mono_marshal_get_string_encoding (m->piinfo, spec);
 
                        // FIXME:
-                       g_assert (encoding == MONO_NATIVE_LPSTR);
+                       g_assert (encoding == MONO_NATIVE_LPSTR || encoding == MONO_NATIVE_UTF8STR);
 
                        g_assert (!t->byref);
                        g_assert (encoding != -1);
@@ -5913,7 +5937,7 @@ emit_marshal_object (EmitMarshalContext *m, int argnum, MonoType *t,
                }
 
                /* The class can not have an automatic layout */
-               if ((klass->flags & TYPE_ATTRIBUTE_LAYOUT_MASK) == TYPE_ATTRIBUTE_AUTO_LAYOUT) {
+               if (mono_class_is_auto_layout (klass)) {
                        mono_mb_emit_auto_layout_exception (mb, klass);
                        break;
                }
@@ -6033,7 +6057,7 @@ emit_marshal_object (EmitMarshalContext *m, int argnum, MonoType *t,
                }
 
                /* The class can not have an automatic layout */
-               if ((klass->flags & TYPE_ATTRIBUTE_LAYOUT_MASK) == TYPE_ATTRIBUTE_AUTO_LAYOUT) {
+               if (mono_class_is_auto_layout (klass)) {
                        mono_mb_emit_auto_layout_exception (mb, klass);
                        break;
                }
@@ -6343,7 +6367,7 @@ emit_marshal_array (EmitMarshalContext *m, int argnum, MonoType *t,
                                mono_mb_emit_stloc (mb, 1);
 
                                /* emit valuetype conversion code */
-                               emit_struct_conv_full (mb, eklass, FALSE, eklass == mono_defaults.char_class ? encoding : (MonoMarshalNative)-1);
+                               emit_struct_conv_full (mb, eklass, FALSE, 0, eklass == mono_defaults.char_class ? encoding : (MonoMarshalNative)-1);
                        }
 
                        mono_mb_emit_add_to_local (mb, index_var, 1);
@@ -6488,7 +6512,7 @@ emit_marshal_array (EmitMarshalContext *m, int argnum, MonoType *t,
                                        mono_mb_emit_stloc (mb, 1);
 
                                        /* emit valuetype conversion code */
-                                       emit_struct_conv_full (mb, eklass, TRUE, eklass == mono_defaults.char_class ? encoding : (MonoMarshalNative)-1);
+                                       emit_struct_conv_full (mb, eklass, TRUE, 0, eklass == mono_defaults.char_class ? encoding : (MonoMarshalNative)-1);
                                }
 
                                if (need_free) {
@@ -6667,7 +6691,8 @@ emit_marshal_array (EmitMarshalContext *m, int argnum, MonoType *t,
                        mono_mb_emit_icon (mb, esize);
                        mono_mb_emit_byte (mb, CEE_MUL);
                        mono_mb_emit_byte (mb, CEE_PREFIX1);
-                       mono_mb_emit_byte (mb, CEE_CPBLK);                      
+                       mono_mb_emit_byte (mb, CEE_CPBLK);
+                       mono_mb_patch_branch (mb, label1);
                        break;
                }
 
@@ -7493,7 +7518,7 @@ mono_marshal_emit_native_wrapper (MonoImage *image, MonoMethodBuilder *mb, MonoM
        if (MONO_TYPE_ISSTRUCT (sig->ret)) {
                MonoClass *klass = mono_class_from_mono_type (sig->ret);
                mono_class_init (klass);
-               if (!(((klass->flags & TYPE_ATTRIBUTE_LAYOUT_MASK) == TYPE_ATTRIBUTE_EXPLICIT_LAYOUT) || klass->blittable)) {
+               if (!(mono_class_is_explicit_layout (klass) || klass->blittable)) {
                        /* This is used by emit_marshal_vtype (), but it needs to go right before the call */
                        mono_mb_emit_byte (mb, MONO_CUSTOM_PREFIX);
                        mono_mb_emit_byte (mb, CEE_MONO_VTADDR);
@@ -7768,6 +7793,8 @@ mono_marshal_get_native_wrapper (MonoMethod *method, gboolean check_exceptions,
                int thread_info_var = -1, stack_mark_var = -1, error_var = -1;
                MonoMethodSignature *call_sig = csig;
                gboolean uses_handles = FALSE;
+               gboolean has_outarg_handles = FALSE;
+               int *outarg_handle = NULL;
                (void) mono_lookup_internal_call_full (method, &uses_handles);
 
 
@@ -7784,9 +7811,13 @@ mono_marshal_get_native_wrapper (MonoMethod *method, gboolean check_exceptions,
                        ret->param_count = csig->param_count + 1;
                        ret->ret = csig->ret;
                        for (int i = 0; i < csig->param_count; ++i) {
-                               // FIXME: TODO implement handle wrapping for out and inout params.
-                               g_assert (!mono_signature_param_is_out (csig, i));
-                               ret->params [i] = csig->params [i];
+                               if (MONO_TYPE_IS_REFERENCE (csig->params[i])) {
+                                       ret->params [i] = mono_class_get_byref_type (mono_class_from_mono_type(csig->params[i]));
+                                       if (mono_signature_param_is_out (csig, i)) {
+                                               has_outarg_handles = TRUE;
+                                       }
+                               } else
+                                       ret->params [i] = csig->params [i];
                        }
                        ret->params [csig->param_count] = &mono_get_intptr_class ()->byval_arg;
                        call_sig = ret;
@@ -7800,7 +7831,17 @@ mono_marshal_get_native_wrapper (MonoMethod *method, gboolean check_exceptions,
                        stack_mark_var = mono_mb_add_local (mb, &handle_stack_mark_class->byval_arg);
                        error_var = mono_mb_add_local (mb, &error_class->byval_arg);
 
-                       // FIXME: Change csig so it passes a handle not an objref
+                       if (has_outarg_handles) {
+                               outarg_handle = g_new0 (int, sig->param_count);
+
+                               /* add a local var to hold the handles for each out arg */
+                               for (int i = 0; i < sig->param_count; ++i) {
+                                       if (mono_signature_param_is_out (sig, i) && MONO_TYPE_IS_REFERENCE (sig->params[i])) {
+                                               outarg_handle[i] = mono_mb_add_local (mb, sig->params[i]);
+                                       } else if (outarg_handle != NULL)
+                                               outarg_handle[i] = -1;
+                               }
+                       }
                }
 
                if (sig->hasthis) {
@@ -7827,9 +7868,24 @@ mono_marshal_get_native_wrapper (MonoMethod *method, gboolean check_exceptions,
                                mono_mb_emit_icall (mb, mono_handle_new);
                        }
                        for (i = 0; i < sig->param_count; i++) {
-                               mono_mb_emit_ldarg (mb, i + sig->hasthis);
-                               if (MONO_TYPE_IS_REFERENCE (sig->params [i])) {
-                                       mono_mb_emit_icall (mb, mono_handle_new);
+                               /* load each argument. object reference arguments get wrapped in handles */
+
+                               if (!MONO_TYPE_IS_REFERENCE (sig->params [i])) {
+                                       mono_mb_emit_ldarg (mb, i + sig->hasthis);
+                               } else {
+                                       if (outarg_handle && outarg_handle[i] != -1) {
+                                               /* handleI = argI = mono_handle_new (NULL) */
+                                               mono_mb_emit_byte (mb, CEE_LDNULL);
+                                               mono_mb_emit_icall (mb, mono_handle_new);
+                                               /* tmp = argI */
+                                               mono_mb_emit_byte (mb, CEE_DUP);
+                                               /* handleI = tmp */
+                                               mono_mb_emit_stloc (mb, outarg_handle[i]);
+                                       } else {
+                                               /* argI = mono_handle_new (argI_raw) */
+                                               mono_mb_emit_ldarg (mb, i + sig->hasthis);
+                                               mono_mb_emit_icall (mb, mono_handle_new);
+                                       }
                                }
                        }
                        mono_mb_emit_ldloc_addr (mb, error_var);
@@ -7860,6 +7916,25 @@ mono_marshal_get_native_wrapper (MonoMethod *method, gboolean check_exceptions,
                                mono_mb_emit_byte (mb, CEE_LDIND_REF);
                                mono_mb_patch_branch (mb, pos);
                        }
+                       if (outarg_handle != NULL) {
+                               for (i = 0; i < sig->param_count; i++) {
+                                       if (outarg_handle[i] != -1) {
+                                               /* *argI_raw = MONO_HANDLE_RAW (handleI) */
+
+                                               /* argI_raw */
+                                               mono_mb_emit_ldarg (mb, i + sig->hasthis);
+                                               /* handleI */
+                                               mono_mb_emit_ldloc (mb, outarg_handle[i]);
+                                               /* MONO_HANDLE_RAW(handleI) */
+                                               mono_mb_emit_ldflda (mb, MONO_HANDLE_PAYLOAD_OFFSET (MonoObject));
+                                               mono_mb_emit_byte (mb, CEE_LDIND_REF);
+                                               /* *argI_raw = MONO_HANDLE_RAW(handleI) */
+                                               mono_mb_emit_byte (mb, CEE_STIND_REF);
+                                       }
+                               }
+                               g_free (outarg_handle);
+                               outarg_handle = NULL;
+                       }
                        mono_mb_emit_ldloc (mb, thread_info_var);
                        mono_mb_emit_ldloc_addr (mb, stack_mark_var);
                        mono_mb_emit_ldloc_addr (mb, error_var);
@@ -8232,7 +8307,7 @@ mono_marshal_emit_managed_wrapper (MonoMethodBuilder *mb, MonoMethodSignature *i
        if (MONO_TYPE_ISSTRUCT (sig->ret)) {
                MonoClass *klass = mono_class_from_mono_type (sig->ret);
                mono_class_init (klass);
-               if (!(((klass->flags & TYPE_ATTRIBUTE_LAYOUT_MASK) == TYPE_ATTRIBUTE_EXPLICIT_LAYOUT) || klass->blittable)) {
+               if (!(mono_class_is_explicit_layout (klass) || klass->blittable)) {
                        /* This is used by emit_marshal_vtype (), but it needs to go right before the call */
                        mono_mb_emit_byte (mb, MONO_CUSTOM_PREFIX);
                        mono_mb_emit_byte (mb, CEE_MONO_VTADDR);
@@ -9103,8 +9178,9 @@ mono_marshal_get_struct_to_ptr (MonoClass *klass)
 
        mono_marshal_load_type_info (klass);
 
-       if (klass->marshal_info->str_to_ptr)
-               return klass->marshal_info->str_to_ptr;
+       MonoMarshalType *marshal_info = mono_class_get_marshal_info (klass);
+       if (marshal_info->str_to_ptr)
+               return marshal_info->str_to_ptr;
 
        if (!stoptr) 
                stoptr = mono_class_get_method_from_name (mono_defaults.marshal_class, "StructureToPtr", 3);
@@ -9150,10 +9226,10 @@ mono_marshal_get_struct_to_ptr (MonoClass *klass)
        mono_mb_free (mb);
 
        mono_marshal_lock ();
-       if (!klass->marshal_info->str_to_ptr)
-               klass->marshal_info->str_to_ptr = res;
+       if (!marshal_info->str_to_ptr)
+               marshal_info->str_to_ptr = res;
        else
-               res = klass->marshal_info->str_to_ptr;
+               res = marshal_info->str_to_ptr;
        mono_marshal_unlock ();
        return res;
 }
@@ -9176,8 +9252,9 @@ mono_marshal_get_ptr_to_struct (MonoClass *klass)
 
        mono_marshal_load_type_info (klass);
 
-       if (klass->marshal_info->ptr_to_str)
-               return klass->marshal_info->ptr_to_str;
+       MonoMarshalType *marshal_info = mono_class_get_marshal_info (klass);
+       if (marshal_info->ptr_to_str)
+               return marshal_info->ptr_to_str;
 
        if (!ptostr) {
                MonoMethodSignature *sig;
@@ -9228,10 +9305,10 @@ mono_marshal_get_ptr_to_struct (MonoClass *klass)
        mono_mb_free (mb);
 
        mono_marshal_lock ();
-       if (!klass->marshal_info->ptr_to_str)
-               klass->marshal_info->ptr_to_str = res;
+       if (!marshal_info->ptr_to_str)
+               marshal_info->ptr_to_str = res;
        else
-               res = klass->marshal_info->ptr_to_str;
+               res = marshal_info->ptr_to_str;
        mono_marshal_unlock ();
        return res;
 }
@@ -9257,7 +9334,7 @@ mono_marshal_get_synchronized_inner_wrapper (MonoMethod *method)
                method = ((MonoMethodInflated*)method)->declaring;
                container = mono_method_get_generic_container (method);
                if (!container)
-                       container = method->klass->generic_container;
+                       container = mono_class_try_get_generic_container (method->klass); //FIXME is this a case of a try?
                g_assert (container);
        }
 
@@ -9311,7 +9388,7 @@ mono_marshal_get_synchronized_wrapper (MonoMethod *method)
                method = ((MonoMethodInflated*)method)->declaring;
                container = mono_method_get_generic_container (method);
                if (!container)
-                       container = method->klass->generic_container;
+                       container = mono_class_try_get_generic_container (method->klass); //FIXME is this a case of a try?
                g_assert (container);
        }
 
@@ -9345,7 +9422,8 @@ mono_marshal_get_synchronized_wrapper (MonoMethod *method)
 #endif
 
        if (method->klass->valuetype && !(method->flags & MONO_METHOD_ATTR_STATIC)) {
-               mono_class_set_failure (method->klass, MONO_EXCEPTION_TYPE_LOAD, NULL);
+               /* FIXME Is this really the best way to signal an error here?  Isn't this called much later after class setup? -AK */
+               mono_class_set_type_load_failure (method->klass, "");
 #ifndef DISABLE_JIT
                /* This will throw the type load exception when the wrapper is compiled */
                mono_mb_emit_byte (mb, CEE_LDNULL);
@@ -9537,7 +9615,7 @@ is_monomorphic_array (MonoClass *klass)
                return FALSE;
 
        element_class = klass->element_class;
-       return (element_class->flags & TYPE_ATTRIBUTE_SEALED) || element_class->valuetype;
+       return mono_class_is_sealed (element_class) || element_class->valuetype;
 }
 
 static int
@@ -9557,7 +9635,7 @@ get_virtual_stelemref_kind (MonoClass *element_class)
        /*Arrays are sealed but are covariant on their element type, We can't use any of the fast paths.*/
        if (mono_class_is_marshalbyref (element_class) || element_class->rank || mono_class_has_variant_generic_params (element_class))
                return STELEMREF_COMPLEX;
-       if (element_class->flags & TYPE_ATTRIBUTE_SEALED)
+       if (mono_class_is_sealed (element_class))
                return STELEMREF_SEALED_CLASS;
        return STELEMREF_CLASS;
 }
@@ -9916,14 +9994,14 @@ get_virtual_stelemref_wrapper (int kind)
                /* uiid = klass->interface_id; */
                mono_mb_emit_ldloc (mb, aklass);
                mono_mb_emit_ldflda (mb, MONO_STRUCT_OFFSET (MonoClass, interface_id));
-               mono_mb_emit_byte (mb, CEE_LDIND_U2);
+               mono_mb_emit_byte (mb, CEE_LDIND_U4);
                mono_mb_emit_stloc (mb, uiid);
 
                /*if (uiid > vt->max_interface_id)*/
                mono_mb_emit_ldloc (mb, uiid);
                mono_mb_emit_ldloc (mb, vtable);
                mono_mb_emit_ldflda (mb, MONO_STRUCT_OFFSET (MonoVTable, max_interface_id));
-               mono_mb_emit_byte (mb, CEE_LDIND_U2);
+               mono_mb_emit_byte (mb, CEE_LDIND_U4);
                b2 = mono_mb_emit_branch (mb, CEE_BGT_UN);
 
                /* if (!(vt->interface_bitmap [(uiid) >> 3] & (1 << ((uiid)&7)))) */
@@ -10499,6 +10577,18 @@ mono_marshal_get_array_accessor_wrapper (MonoMethod *method)
        return res;     
 }
 
+#ifndef HOST_WIN32
+static inline void*
+mono_marshal_alloc_co_task_mem (size_t size)
+{
+       if ((gulong)size == 0)
+               /* This returns a valid pointer for size 0 on MS.NET */
+               size = 4;
+
+       return g_try_malloc ((gulong)size);
+}
+#endif
+
 void*
 mono_marshal_alloc (gulong size, MonoError *error)
 {
@@ -10506,13 +10596,10 @@ mono_marshal_alloc (gulong size, MonoError *error)
 
        mono_error_init (error);
 
-#ifdef HOST_WIN32
-       res = CoTaskMemAlloc (size);
-#else
-       res = g_try_malloc ((gulong)size);
+       res = mono_marshal_alloc_co_task_mem (size);
        if (!res)
-               mono_error_set_out_of_memory (error, "Could not allocate %i bytes", size);
-#endif
+               mono_error_set_out_of_memory (error, "Could not allocate %lu bytes", size);
+
        return res;
 }
 
@@ -10530,14 +10617,19 @@ ves_icall_marshal_alloc (gulong size)
        return ret;
 }
 
-void
-mono_marshal_free (gpointer ptr)
+#ifndef HOST_WIN32
+static inline void
+mono_marshal_free_co_task_mem (void *ptr)
 {
-#ifdef HOST_WIN32
-       CoTaskMemFree (ptr);
-#else
        g_free (ptr);
+       return;
+}
 #endif
+
+void
+mono_marshal_free (gpointer ptr)
+{
+       mono_marshal_free_co_task_mem (ptr);
 }
 
 void
@@ -10760,7 +10852,7 @@ ves_icall_System_Runtime_InteropServices_Marshal_SizeOf (MonoReflectionType *rty
                return 0;
        }
 
-       layout = (klass->flags & TYPE_ATTRIBUTE_LAYOUT_MASK);
+       layout = (mono_class_get_flags (klass) & TYPE_ATTRIBUTE_LAYOUT_MASK);
 
        if (type->type == MONO_TYPE_PTR || type->type == MONO_TYPE_FNPTR) {
                return sizeof (gpointer);
@@ -10936,30 +11028,14 @@ ves_icall_System_Runtime_InteropServices_Marshal_OffsetOf (MonoReflectionType *t
        return info->fields [match_index].offset;
 }
 
+#ifndef HOST_WIN32
 gpointer
 ves_icall_System_Runtime_InteropServices_Marshal_StringToHGlobalAnsi (MonoString *string)
 {
        MonoError error;
-#ifdef HOST_WIN32
-       char* tres, *ret;
-       size_t len;
-       tres = mono_string_to_utf8_checked (string, &error);
-       if (mono_error_set_pending_exception (&error))
-               return NULL;
-       if (!tres)
-               return tres;
-
-       len = strlen (tres) + 1;
-       ret = ves_icall_System_Runtime_InteropServices_Marshal_AllocHGlobal (len);
-       memcpy (ret, tres, len);
-       g_free (tres);
-       return ret;
-
-#else
        char *ret = mono_string_to_utf8_checked (string, &error);
        mono_error_set_pending_exception (&error);
        return ret;
-#endif
 }
 
 gpointer
@@ -10968,17 +11044,14 @@ ves_icall_System_Runtime_InteropServices_Marshal_StringToHGlobalUni (MonoString
        if (string == NULL)
                return NULL;
        else {
-#ifdef TARGET_WIN32
-               gunichar2 *res = ves_icall_System_Runtime_InteropServices_Marshal_AllocHGlobal 
-                       ((mono_string_length (string) + 1) * 2);
-#else
                gunichar2 *res = (gunichar2 *)g_malloc ((mono_string_length (string) + 1) * 2);
-#endif
+
                memcpy (res, mono_string_chars (string), mono_string_length (string) * 2);
                res [mono_string_length (string)] = 0;
                return res;
        }
 }
+#endif /* !HOST_WIN32 */
 
 static void
 mono_struct_delete_old (MonoClass *klass, char *ptr)
@@ -11021,6 +11094,7 @@ mono_struct_delete_old (MonoClass *klass, char *ptr)
                case MONO_MARSHAL_CONV_STR_BSTR:
                case MONO_MARSHAL_CONV_STR_ANSIBSTR:
                case MONO_MARSHAL_CONV_STR_TBSTR:
+               case MONO_MARSHAL_CONV_STR_UTF8STR:
                        mono_marshal_free (*(gpointer *)cpos);
                        break;
 
@@ -11047,6 +11121,14 @@ ves_icall_System_Runtime_InteropServices_Marshal_DestroyStructure (gpointer src,
        mono_struct_delete_old (klass, (char *)src);
 }
 
+#ifndef HOST_WIN32
+static inline void *
+mono_marshal_alloc_hglobal (size_t size)
+{
+       return g_try_malloc (size);
+}
+#endif
+
 void*
 ves_icall_System_Runtime_InteropServices_Marshal_AllocHGlobal (gpointer size)
 {
@@ -11057,11 +11139,8 @@ ves_icall_System_Runtime_InteropServices_Marshal_AllocHGlobal (gpointer size)
                /* This returns a valid pointer for size 0 on MS.NET */
                s = 4;
 
-#ifdef HOST_WIN32
-       res = GlobalAlloc (GMEM_FIXED, s);
-#else
-       res = g_try_malloc (s);
-#endif
+       res = mono_marshal_alloc_hglobal (s);
+
        if (!res) {
                mono_set_pending_exception (mono_domain_get ()->out_of_memory_ex);
                return NULL;
@@ -11070,6 +11149,14 @@ ves_icall_System_Runtime_InteropServices_Marshal_AllocHGlobal (gpointer size)
        return res;
 }
 
+#ifndef HOST_WIN32
+static inline gpointer
+mono_marshal_realloc_hglobal (gpointer ptr, size_t size)
+{
+       return g_try_realloc (ptr, size);
+}
+#endif
+
 gpointer
 ves_icall_System_Runtime_InteropServices_Marshal_ReAllocHGlobal (gpointer ptr, gpointer size)
 {
@@ -11081,11 +11168,8 @@ ves_icall_System_Runtime_InteropServices_Marshal_ReAllocHGlobal (gpointer ptr, g
                return NULL;
        }
 
-#ifdef HOST_WIN32
-       res = GlobalReAlloc (ptr, s, GMEM_MOVEABLE);
-#else
-       res = g_try_realloc (ptr, s);
-#endif
+       res = mono_marshal_realloc_hglobal (ptr, s);
+
        if (!res) {
                mono_set_pending_exception (mono_domain_get ()->out_of_memory_ex);
                return NULL;
@@ -11094,30 +11178,38 @@ ves_icall_System_Runtime_InteropServices_Marshal_ReAllocHGlobal (gpointer ptr, g
        return res;
 }
 
-void
-ves_icall_System_Runtime_InteropServices_Marshal_FreeHGlobal (void *ptr)
+#ifndef HOST_WIN32
+static inline void
+mono_marshal_free_hglobal (gpointer ptr)
 {
-#ifdef HOST_WIN32
-       GlobalFree (ptr);
-#else
        g_free (ptr);
+       return;
+}
 #endif
+
+void
+ves_icall_System_Runtime_InteropServices_Marshal_FreeHGlobal (void *ptr)
+{
+       mono_marshal_free_hglobal (ptr);
 }
 
 void*
 ves_icall_System_Runtime_InteropServices_Marshal_AllocCoTaskMem (int size)
 {
-       void *res;
+       void *res = mono_marshal_alloc_co_task_mem (size);
 
-#ifdef HOST_WIN32
-       res = CoTaskMemAlloc (size);
-#else
-       if ((gulong)size == 0)
-               /* This returns a valid pointer for size 0 on MS.NET */
-               size = 4;
+       if (!res) {
+               mono_set_pending_exception (mono_domain_get ()->out_of_memory_ex);
+               return NULL;
+       }
+       return res;
+}
+
+void*
+ves_icall_System_Runtime_InteropServices_Marshal_AllocCoTaskMemSize (gulong size)
+{
+       void *res = mono_marshal_alloc_co_task_mem (size);
 
-       res = g_try_malloc ((gulong)size);
-#endif
        if (!res) {
                mono_set_pending_exception (mono_domain_get ()->out_of_memory_ex);
                return NULL;
@@ -11128,23 +11220,23 @@ ves_icall_System_Runtime_InteropServices_Marshal_AllocCoTaskMem (int size)
 void
 ves_icall_System_Runtime_InteropServices_Marshal_FreeCoTaskMem (void *ptr)
 {
-#ifdef HOST_WIN32
-       CoTaskMemFree (ptr);
-#else
-       g_free (ptr);
-#endif
+       mono_marshal_free_co_task_mem (ptr);
+       return;
 }
 
+#ifndef HOST_WIN32
+static inline gpointer
+mono_marshal_realloc_co_task_mem (gpointer ptr, size_t size)
+{
+       return g_try_realloc (ptr, (gulong)size);
+}
+#endif
+
 gpointer
 ves_icall_System_Runtime_InteropServices_Marshal_ReAllocCoTaskMem (gpointer ptr, int size)
 {
-       void *res;
+       void *res = mono_marshal_realloc_co_task_mem (ptr, size);
 
-#ifdef HOST_WIN32
-       res = CoTaskMemRealloc (ptr, size);
-#else
-       res = g_try_realloc (ptr, (gulong)size);
-#endif
        if (!res) {
                mono_set_pending_exception (mono_domain_get ()->out_of_memory_ex);
                return NULL;
@@ -11193,7 +11285,7 @@ mono_marshal_is_loading_type_info (MonoClass *klass)
 /**
  * mono_marshal_load_type_info:
  *
- *  Initialize klass->marshal_info using information from metadata. This function can
+ *  Initialize klass::marshal_info using information from metadata. This function can
  * recursively call itself, and the caller is responsible to avoid that by calling 
  * mono_marshal_is_loading_type_info () beforehand.
  *
@@ -11212,14 +11304,16 @@ mono_marshal_load_type_info (MonoClass* klass)
 
        g_assert (klass != NULL);
 
-       if (klass->marshal_info)
-               return klass->marshal_info;
+       info = mono_class_get_marshal_info (klass);
+       if (info)
+               return info;
 
        if (!klass->inited)
                mono_class_init (klass);
 
-       if (klass->marshal_info)
-               return klass->marshal_info;
+       info = mono_class_get_marshal_info (klass);
+       if (info)
+               return info;
 
        /*
         * This function can recursively call itself, so we keep the list of classes which are
@@ -11239,7 +11333,7 @@ mono_marshal_load_type_info (MonoClass* klass)
                count++;
        }
 
-       layout = klass->flags & TYPE_ATTRIBUTE_LAYOUT_MASK;
+       layout = mono_class_get_flags (klass) & TYPE_ATTRIBUTE_LAYOUT_MASK;
 
        /* The mempool is protected by the loader lock */
        info = (MonoMarshalType *)mono_image_alloc0 (klass->image, MONO_SIZEOF_MARSHAL_TYPE + sizeof (MonoMarshalField) * count);
@@ -11303,6 +11397,9 @@ mono_marshal_load_type_info (MonoClass* klass)
                j++;
        }
 
+       if (klass->byval_arg.type == MONO_TYPE_PTR)
+               info->native_size = sizeof (gpointer);
+
        if (layout != TYPE_ATTRIBUTE_AUTO_LAYOUT) {
                info->native_size = MAX (native_size, info->native_size);
                /*
@@ -11338,14 +11435,17 @@ mono_marshal_load_type_info (MonoClass* klass)
        mono_native_tls_set_value (load_type_info_tls_id, loads_list);
 
        mono_marshal_lock ();
-       if (!klass->marshal_info) {
+       MonoMarshalType *info2 = mono_class_get_marshal_info (klass);
+       if (!info2) {
                /*We do double-checking locking on marshal_info */
                mono_memory_barrier ();
-               klass->marshal_info = info;
+               mono_class_set_marshal_info (klass, info);
+               ++class_marshal_info_count;
+               info2 = info;
        }
        mono_marshal_unlock ();
 
-       return klass->marshal_info;
+       return info2;
 }
 
 /**
@@ -11357,8 +11457,9 @@ mono_marshal_load_type_info (MonoClass* klass)
  */
 gint32
 mono_class_native_size (MonoClass *klass, guint32 *align)
-{      
-       if (!klass->marshal_info) {
+{
+       MonoMarshalType *info = mono_class_get_marshal_info (klass);
+       if (!info) {
                if (mono_marshal_is_loading_type_info (klass)) {
                        if (align)
                                *align = 0;
@@ -11366,12 +11467,13 @@ mono_class_native_size (MonoClass *klass, guint32 *align)
                } else {
                        mono_marshal_load_type_info (klass);
                }
+               info = mono_class_get_marshal_info (klass);
        }
 
        if (align)
-               *align = klass->marshal_info->min_align;
+               *align = info->min_align;
 
-       return klass->marshal_info->native_size;
+       return info->native_size;
 }
 
 /*
@@ -11501,6 +11603,7 @@ mono_marshal_type_size (MonoType *type, MonoMarshalSpec *mspec, guint32 *align,
        case MONO_NATIVE_BSTR:
        case MONO_NATIVE_ANSIBSTR:
        case MONO_NATIVE_TBSTR:
+       case MONO_NATIVE_UTF8STR:
        case MONO_NATIVE_LPARRAY:
        case MONO_NATIVE_SAFEARRAY:
        case MONO_NATIVE_IUNKNOWN:
@@ -11584,10 +11687,10 @@ mono_marshal_asany (MonoObject *o, MonoMarshalNative string_encoding, int param_
                switch (string_encoding) {
                case MONO_NATIVE_LPWSTR:
                        return mono_marshal_string_to_utf16_copy ((MonoString*)o);
-                       break;
                case MONO_NATIVE_LPSTR:
-                       return mono_string_to_lpstr ((MonoString*)o);
-                       break;
+               case MONO_NATIVE_UTF8STR:
+                       // Same code path, because in Mono, we treated strings as Utf8
+                       return mono_string_to_utf8str ((MonoString*)o);
                default:
                        g_warning ("marshaling conversion %d not implemented", string_encoding);
                        g_assert_not_reached ();
@@ -11602,11 +11705,10 @@ mono_marshal_asany (MonoObject *o, MonoMarshalNative string_encoding, int param_
 
                klass = t->data.klass;
 
-               if ((klass->flags & TYPE_ATTRIBUTE_LAYOUT_MASK) == TYPE_ATTRIBUTE_AUTO_LAYOUT)
+               if (mono_class_is_auto_layout (klass))
                        break;
 
-               if (klass->valuetype && (((klass->flags & TYPE_ATTRIBUTE_LAYOUT_MASK) == TYPE_ATTRIBUTE_EXPLICIT_LAYOUT) ||
-                       klass->blittable || klass->enumtype))
+               if (klass->valuetype && (mono_class_is_explicit_layout (klass) || klass->blittable || klass->enumtype))
                        return mono_object_unbox (o);
 
                res = mono_marshal_alloc (mono_class_native_size (klass, NULL), &error);
@@ -11655,6 +11757,7 @@ mono_marshal_free_asany (MonoObject *o, gpointer ptr, MonoMarshalNative string_e
                switch (string_encoding) {
                case MONO_NATIVE_LPWSTR:
                case MONO_NATIVE_LPSTR:
+               case MONO_NATIVE_UTF8STR:
                        mono_marshal_free (ptr);
                        break;
                default:
@@ -11666,8 +11769,7 @@ mono_marshal_free_asany (MonoObject *o, gpointer ptr, MonoMarshalNative string_e
        case MONO_TYPE_VALUETYPE: {
                klass = t->data.klass;
 
-               if (klass->valuetype && (((klass->flags & TYPE_ATTRIBUTE_LAYOUT_MASK) == TYPE_ATTRIBUTE_EXPLICIT_LAYOUT) ||
-                                                                klass->blittable || klass->enumtype))
+               if (klass->valuetype && (mono_class_is_explicit_layout (klass) || klass->blittable || klass->enumtype))
                        break;
 
                if (param_attrs & PARAM_ATTRIBUTE_OUT) {
index 166db1478ce52312ca113fd954646df022247a7e..e22653f2d5bd2f1538e4c02e1f451bca53a067b2 100644 (file)
@@ -490,6 +490,9 @@ ves_icall_System_Runtime_InteropServices_Marshal_DestroyStructure (gpointer src,
 void*
 ves_icall_System_Runtime_InteropServices_Marshal_AllocCoTaskMem (int size);
 
+void*
+ves_icall_System_Runtime_InteropServices_Marshal_AllocCoTaskMemSize (gulong size);
+
 void
 ves_icall_System_Runtime_InteropServices_Marshal_FreeCoTaskMem (void *ptr);
 
index b1ea15c1f22a611073b76af96b4ffc94dc614d2f..4896a237fe49060fcad67b280e3ac7c9820dc638 100644 (file)
@@ -57,6 +57,12 @@ g_slist_append_mempool (MonoMemPool *mp, GSList *list, gpointer data)
                return new_list;
 }
 
+char*
+mono_mempool_strdup_vprintf (MonoMemPool *pool, const char *format, va_list args);
+
+char*
+mono_mempool_strdup_printf (MonoMemPool *pool, const char *format, ...) MONO_ATTR_FORMAT_PRINTF(2,3);;
+
 long
 mono_mempool_get_bytes_allocated (void);
 
index 6bf3410d818ec7115921f01c4e9c45dd27109e80..7a871f034bfd58b28de0092507c84d2cc6c41b37 100644 (file)
@@ -198,25 +198,27 @@ static mono_mutex_t mempool_tracing_lock;
 static void
 mono_backtrace (int size)
 {
-        void *array[BACKTRACE_DEPTH];
-        char **names;
-        int i, symbols;
-        static gboolean inited;
-
-        if (!inited) {
-            mono_os_mutex_init_recursive (&mempool_tracing_lock);
-            inited = TRUE;
-        }
-
-        mono_os_mutex_lock (&mempool_tracing_lock);
-        g_print ("Allocating %d bytes\n", size);
-        symbols = backtrace (array, BACKTRACE_DEPTH);
-        names = backtrace_symbols (array, symbols);
-        for (i = 1; i < symbols; ++i) {
-                g_print ("\t%s\n", names [i]);
-        }
-        free (names);
-        mono_os_mutex_unlock (&mempool_tracing_lock);
+       void *array[BACKTRACE_DEPTH];
+       char **names;
+       int i, symbols;
+       static gboolean inited;
+
+       if (!inited) {
+               mono_os_mutex_init_recursive (&mempool_tracing_lock);
+               inited = TRUE;
+       }
+
+       mono_os_mutex_lock (&mempool_tracing_lock);
+       g_print ("Allocating %d bytes\n", size);
+       MONO_ENTER_GC_SAFE;
+       symbols = backtrace (array, BACKTRACE_DEPTH);
+       names = backtrace_symbols (array, symbols);
+       MONO_EXIT_GC_SAFE;
+       for (i = 1; i < symbols; ++i) {
+               g_print ("\t%s\n", names [i]);
+       }
+       g_free (names);
+       mono_os_mutex_unlock (&mempool_tracing_lock);
 }
 
 #endif
@@ -381,6 +383,35 @@ mono_mempool_strdup (MonoMemPool *pool,
        return res;
 }
 
+char*
+mono_mempool_strdup_vprintf (MonoMemPool *pool, const char *format, va_list args)
+{
+       size_t buflen;
+       char *buf;
+       va_list args2;
+       va_copy (args2, args);
+       int len = vsnprintf (NULL, 0, format, args2);
+       va_end (args2);
+
+       if (len >= 0 && (buf = (char*)mono_mempool_alloc (pool, (buflen = (size_t) (len + 1)))) != NULL) {
+               vsnprintf (buf, buflen, format, args);
+       } else {
+               buf = NULL;
+       }
+       return buf;
+}
+
+char*
+mono_mempool_strdup_printf (MonoMemPool *pool, const char *format, ...)
+{
+       char *buf;
+       va_list args;
+       va_start (args, format);
+       buf = mono_mempool_strdup_vprintf (pool, format, args);
+       va_end (args);
+       return buf;
+}
+
 /**
  * mono_mempool_get_allocated:
  *
index a1b9eb841781775dcf0fdc3cc5d768ddcfde08e8..1c82b442e2798dbc7ce8fdcf4855fc7c9bdc8ed3 100644 (file)
@@ -175,10 +175,12 @@ typedef struct {
 
 struct _MonoImage {
        /*
-        * The number of assemblies which reference this MonoImage though their 'image'
-        * field plus the number of images which reference this MonoImage through their 
-        * 'modules' field, plus the number of threads holding temporary references to
-        * this image between calls of mono_image_open () and mono_image_close ().
+        * This count is incremented during these situations:
+        *   - An assembly references this MonoImage though its 'image' field
+        *   - This MonoImage is present in the 'files' field of an image
+        *   - This MonoImage is present in the 'modules' field of an image
+        *   - A thread is holding a temporary reference to this MonoImage between
+        *     calls to mono_image_open and mono_image_close ()
         */
        int   ref_count;
 
@@ -258,16 +260,16 @@ struct _MonoImage {
        MonoAssembly **references;
        int nreferences;
 
-       /* Code files in the assembly. */
+       /* Code files in the assembly. The main assembly has a "file" table and also a "module"
+        * table, where the module table is a subset of the file table. We track both lists,
+        * and because we can lazy-load them at different times we reference-increment both.
+        */
        MonoImage **modules;
        guint32 module_count;
        gboolean *modules_loaded;
 
-       /*
-        * Files in the assembly. Items are either NULL or alias items in modules, so this does not impact ref_count.
-        * Protected by the image lock.
-        */
        MonoImage **files;
+       guint32 file_count;
 
        gpointer aot_module;
 
@@ -497,7 +499,6 @@ struct _MonoDynamicImage {
        GHashTable *method_aux_hash;
        GHashTable *vararg_aux_hash;
        MonoGHashTable *generic_def_objects;
-       MonoGHashTable *methodspec;
        /*
         * Maps final token values to the object they describe.
         */
@@ -637,6 +638,12 @@ mono_image_alloc0 (MonoImage *image, guint size);
 char*
 mono_image_strdup (MonoImage *image, const char *s);
 
+char*
+mono_image_strdup_vprintf (MonoImage *image, const char *format, va_list args);
+
+char*
+mono_image_strdup_printf (MonoImage *image, const char *format, ...) MONO_ATTR_FORMAT_PRINTF(2,3);;
+
 GList*
 g_list_prepend_image (MonoImage *image, GList *list, gpointer data);
 
@@ -910,5 +917,8 @@ mono_image_set_description (MonoImageSet *);
 MonoImageSet *
 mono_find_image_set_owner (void *ptr);
 
+void
+mono_loader_register_module (const char *name, MonoDl *module);
+
 #endif /* __MONO_METADATA_INTERNALS_H__ */
 
index c3beaa4553795cf7d9285b3b0f68c5d3c88abf7e..9b4ca91bc753965ceaba0e55cf9b8f096af0ee08 100644 (file)
@@ -2397,7 +2397,7 @@ verify_typeref_table (VerifyContext *ctx)
 }
 
 /*bits 9,11,14,15,19,21,24-31 */
-#define INVALID_TYPEDEF_FLAG_BITS ((1 << 6) | (1 << 9) | (1 << 14) | (1 << 15) | (1 << 19) | (1 << 21) | 0xFF000000)
+#define INVALID_TYPEDEF_FLAG_BITS ((1 << 6) | (1 << 9) | (1 << 15) | (1 << 19) | (1 << 21) | 0xFF000000)
 static void
 verify_typedef_table (VerifyContext *ctx)
 {
index 2df6db21ec67febd81d791c9663007b2d3660c01..973c4ca8bf3fd71660817db7391b2c5c30fa107f 100644 (file)
@@ -2789,6 +2789,9 @@ free_inflated_method (MonoMethodInflated *imethod)
        if (method->signature)
                mono_metadata_free_inflated_signature (method->signature);
 
+       if (method->wrapper_type)
+               g_free (((MonoMethodWrapper*)method)->method_data);
+
        g_free (method);
 }
 
@@ -2806,8 +2809,6 @@ static void
 free_generic_class (MonoGenericClass *gclass)
 {
        /* The gclass itself is allocated from the image set mempool */
-       if (gclass->is_dynamic)
-               mono_reflection_free_dynamic_generic_class (gclass);
        if (gclass->cached_class && gclass->cached_class->interface_id)
                mono_unload_interface_id (gclass->cached_class);
 }
@@ -2936,7 +2937,7 @@ mono_metadata_get_generic_inst (int type_argc, MonoType **type_argv)
 static gboolean
 mono_metadata_is_type_builder_generic_type_definition (MonoClass *container_class, MonoGenericInst *inst, gboolean is_dynamic)
 {
-       MonoGenericContainer *container = container_class->generic_container
+       MonoGenericContainer *container = mono_class_get_generic_container (container_class)
 
        if (!is_dynamic || container_class->wastypebuilder || container->type_argc != inst->type_argc)
                return FALSE;
@@ -2958,6 +2959,8 @@ mono_metadata_lookup_generic_class (MonoClass *container_class, MonoGenericInst
        MonoImageSet *set;
        CollectData data;
 
+       g_assert (mono_class_get_generic_container (container_class)->type_argc == inst->type_argc);
+
        memset (&helper, 0, sizeof(helper)); // act like g_new0
        helper.container_class = container_class;
        helper.context.class_inst = inst;
@@ -2984,20 +2987,16 @@ mono_metadata_lookup_generic_class (MonoClass *container_class, MonoGenericInst
                return gclass;
        }
 
-       if (is_dynamic) {
-               MonoDynamicGenericClass *dgclass = mono_image_set_new0 (set, MonoDynamicGenericClass, 1);
-               gclass = &dgclass->generic_class;
+       gclass = mono_image_set_new0 (set, MonoGenericClass, 1);
+       if (is_dynamic)
                gclass->is_dynamic = 1;
-       } else {
-               gclass = mono_image_set_new0 (set, MonoGenericClass, 1);
-       }
 
        gclass->is_tb_open = is_tb_open;
        gclass->container_class = container_class;
        gclass->context.class_inst = inst;
        gclass->context.method_inst = NULL;
        gclass->owner = set;
-       if (inst == container_class->generic_container->context.class_inst && !is_tb_open)
+       if (inst == mono_class_get_generic_container (container_class)->context.class_inst && !is_tb_open)
                gclass->cached_class = container_class;
 
        g_hash_table_insert (set->gclass_cache, gclass, gclass);
@@ -3092,7 +3091,7 @@ do_mono_metadata_parse_generic_class (MonoType *type, MonoImage *m, MonoGenericC
                return FALSE;
 
        gklass = mono_class_from_mono_type (gtype);
-       if (!gklass->generic_container) {
+       if (!mono_class_is_gtd (gklass)) {
                mono_error_set_bad_image (error, m, "Generic instance with non-generic definition");
                return FALSE;
        }
@@ -4807,7 +4806,7 @@ static gboolean
 _mono_metadata_generic_class_container_equal (const MonoGenericClass *g1, MonoClass *c2, gboolean signature_only)
 {
        MonoGenericInst *i1 = g1->context.class_inst;
-       MonoGenericInst *i2 = c2->generic_container->context.class_inst;
+       MonoGenericInst *i2 = mono_class_get_generic_container (c2)->context.class_inst;
 
        if (!mono_metadata_class_equal (g1->container_class, c2, signature_only))
                return FALSE;
@@ -4962,12 +4961,12 @@ mono_metadata_class_equal (MonoClass *c1, MonoClass *c2, gboolean signature_only
 {
        if (c1 == c2)
                return TRUE;
-       if (c1->generic_class && c2->generic_class)
-               return _mono_metadata_generic_class_equal (c1->generic_class, c2->generic_class, signature_only);
-       if (c1->generic_class && c2->generic_container)
-               return _mono_metadata_generic_class_container_equal (c1->generic_class, c2, signature_only);
-       if (c1->generic_container && c2->generic_class)
-               return _mono_metadata_generic_class_container_equal (c2->generic_class, c1, signature_only);
+       if (mono_class_is_ginst (c1) && mono_class_is_ginst (c2))
+               return _mono_metadata_generic_class_equal (mono_class_get_generic_class (c1), mono_class_get_generic_class (c2), signature_only);
+       if (mono_class_is_ginst (c1) && mono_class_is_gtd (c2))
+               return _mono_metadata_generic_class_container_equal (mono_class_get_generic_class (c1), c2, signature_only);
+       if (mono_class_is_gtd (c1) && mono_class_is_ginst (c2))
+               return _mono_metadata_generic_class_container_equal (mono_class_get_generic_class (c2), c1, signature_only);
        if ((c1->byval_arg.type == MONO_TYPE_VAR) && (c2->byval_arg.type == MONO_TYPE_VAR))
                return mono_metadata_generic_param_equal_internal (
                        c1->byval_arg.data.generic_param, c2->byval_arg.data.generic_param, signature_only);
@@ -5815,6 +5814,9 @@ handle_enum:
                        case MONO_NATIVE_TBSTR:
                                *conv = MONO_MARSHAL_CONV_STR_TBSTR;
                                return MONO_NATIVE_TBSTR;
+                       case MONO_NATIVE_UTF8STR:
+                               *conv = MONO_MARSHAL_CONV_STR_UTF8STR;
+                               return MONO_NATIVE_UTF8STR;
                        case MONO_NATIVE_BYVALTSTR:
                                if (unicode)
                                        *conv = MONO_MARSHAL_CONV_STR_BYVALWSTR;
@@ -6459,6 +6461,12 @@ mono_type_is_reference (MonoType *type)
                !mono_metadata_generic_class_is_valuetype (type->data.generic_class))));
 }
 
+mono_bool
+mono_type_is_generic_parameter (MonoType *type)
+{
+       return !type->byref && (type->type == MONO_TYPE_VAR || type->type == MONO_TYPE_MVAR);
+}
+
 /**
  * mono_signature_get_return_type:
  * @sig: the method signature inspected
@@ -6604,10 +6612,10 @@ mono_metadata_get_corresponding_field_from_generic_type_definition (MonoClassFie
        MonoClass *gtd;
        int offset;
 
-       if (!field->parent->generic_class)
+       if (!mono_class_is_ginst (field->parent))
                return field;
 
-       gtd = field->parent->generic_class->container_class;
+       gtd = mono_class_get_generic_class (field->parent)->container_class;
        offset = field - field->parent->fields;
        return gtd->fields + offset;
 }
@@ -6622,12 +6630,12 @@ mono_metadata_get_corresponding_event_from_generic_type_definition (MonoEvent *e
        MonoClass *gtd;
        int offset;
 
-       if (!event->parent->generic_class)
+       if (!mono_class_is_ginst (event->parent))
                return event;
 
-       gtd = event->parent->generic_class->container_class;
-       offset = event - event->parent->ext->events;
-       return gtd->ext->events + offset;
+       gtd = mono_class_get_generic_class (event->parent)->container_class;
+       offset = event - mono_class_get_ext (event->parent)->events;
+       return mono_class_get_ext (gtd)->events + offset;
 }
 
 /*
@@ -6640,12 +6648,12 @@ mono_metadata_get_corresponding_property_from_generic_type_definition (MonoPrope
        MonoClass *gtd;
        int offset;
 
-       if (!property->parent->generic_class)
+       if (!mono_class_is_ginst (property->parent))
                return property;
 
-       gtd = property->parent->generic_class->container_class;
-       offset = property - property->parent->ext->properties;
-       return gtd->ext->properties + offset;
+       gtd = mono_class_get_generic_class (property->parent)->container_class;
+       offset = property - mono_class_get_ext (property->parent)->properties;
+       return mono_class_get_ext (gtd)->properties + offset;
 }
 
 MonoWrapperCaches*
index 6a5172d8810d4b3c4e6d0400952e663f01381184..d8e48318b4da77868fe8e06b40810e31849b6402 100644 (file)
@@ -15,9 +15,9 @@ MONO_BEGIN_DECLS
 #define MONO_TYPE_IS_POINTER(t) mono_type_is_pointer (t)
 #define MONO_TYPE_IS_REFERENCE(t) mono_type_is_reference (t)
 
-#define MONO_CLASS_IS_INTERFACE(c) ((c->flags & TYPE_ATTRIBUTE_INTERFACE) || (c->byval_arg.type == MONO_TYPE_VAR) || (c->byval_arg.type == MONO_TYPE_MVAR))
+#define MONO_CLASS_IS_INTERFACE(c) ((mono_class_get_flags (c) & TYPE_ATTRIBUTE_INTERFACE) || (c->byval_arg.type == MONO_TYPE_VAR) || (c->byval_arg.type == MONO_TYPE_MVAR))
 
-#define MONO_CLASS_IS_IMPORT(c) ((c->flags & TYPE_ATTRIBUTE_IMPORT))
+#define MONO_CLASS_IS_IMPORT(c) ((mono_class_get_flags (c) & TYPE_ATTRIBUTE_IMPORT))
 
 typedef struct _MonoClass MonoClass;
 typedef struct _MonoDomain MonoDomain;
@@ -76,6 +76,9 @@ typedef enum {
        MONO_NATIVE_LPSTRUCT = 0x2b,
        MONO_NATIVE_CUSTOM = 0x2c,
        MONO_NATIVE_ERROR = 0x2d,
+       // TODO: MONO_NATIVE_IINSPECTABLE = 0x2e
+       // TODO: MONO_NATIVE_HSTRING = 0x2f
+       MONO_NATIVE_UTF8STR = 0x30,
        MONO_NATIVE_MAX = 0x50 /* no info */
 } MonoMarshalNative;
 
@@ -162,7 +165,11 @@ typedef enum {
        MONO_MARSHAL_FREE_ARRAY,
        MONO_MARSHAL_CONV_BSTR_STR,
        MONO_MARSHAL_CONV_SAFEHANDLE,
-       MONO_MARSHAL_CONV_HANDLEREF
+       MONO_MARSHAL_CONV_HANDLEREF,
+       MONO_MARSHAL_CONV_STR_UTF8STR,
+       MONO_MARSHAL_CONV_SB_UTF8STR,
+       MONO_MARSHAL_CONV_UTF8STR_STR,
+       MONO_MARSHAL_CONV_UTF8STR_SB,
 } MonoMarshalConv;
 
 #define MONO_MARSHAL_CONV_INVALID ((MonoMarshalConv)-1)
@@ -284,7 +291,6 @@ typedef struct {
 typedef struct _MonoType MonoType;
 typedef struct _MonoGenericInst MonoGenericInst;
 typedef struct _MonoGenericClass MonoGenericClass;
-typedef struct _MonoDynamicGenericClass MonoDynamicGenericClass;
 typedef struct _MonoGenericContext MonoGenericContext;
 typedef struct _MonoGenericContainer MonoGenericContainer;
 typedef struct _MonoGenericParam MonoGenericParam;
@@ -350,6 +356,7 @@ MONO_API mono_bool mono_type_is_struct    (MonoType *type);
 MONO_API mono_bool mono_type_is_void      (MonoType *type);
 MONO_API mono_bool mono_type_is_pointer   (MonoType *type);
 MONO_API mono_bool mono_type_is_reference (MonoType *type);
+mono_bool mono_type_is_generic_parameter (MonoType *type);
 
 MONO_API MonoType*
 mono_signature_get_return_type (MonoMethodSignature *sig);
index fe09d0c24b881a1c10ee7046c94cb5c5aba395e8..1d9ff1b8acc251ee6fd5524232aa1edf35204b71 100644 (file)
@@ -26,6 +26,7 @@
 #include <mono/metadata/debug-helpers.h>
 #include <mono/metadata/tabledefs.h>
 #include <mono/metadata/marshal.h>
+#include <mono/metadata/w32event.h>
 #include <mono/utils/mono-threads.h>
 #include <mono/metadata/profiler-private.h>
 #include <mono/utils/mono-time.h>
@@ -630,18 +631,19 @@ mono_object_hash (MonoObject* obj)
 #endif
 }
 
-static void
+static gboolean
 mono_monitor_ensure_owned (LockWord lw, guint32 id)
 {
        if (lock_word_is_flat (lw)) {
                if (lock_word_get_owner (lw) == id)
-                       return;
+                       return TRUE;
        } else if (lock_word_is_inflated (lw)) {
                if (mon_status_get_owner (lock_word_get_inflated_lock (lw)->status) == id)
-                       return;
+                       return TRUE;
        }
 
        mono_set_pending_exception (mono_get_exception_synchronization_lock ("Object synchronization method was called from an unsynchronized block of code."));
+       return FALSE;
 }
 
 /*
@@ -877,7 +879,25 @@ retry_contended:
 #endif
        thread = mono_thread_internal_current ();
 
-       mono_thread_set_state (thread, ThreadState_WaitSleepJoin);
+       /*
+        * If we allow interruption, we check the test state for an abort request before going into sleep.
+        * This is a workaround to the fact that Thread.Abort does non-sticky interruption of semaphores.
+        *
+        * Semaphores don't support the sticky interruption with mono_thread_info_install_interrupt.
+        *
+        * A better fix would be to switch to wait with something that allows sticky interrupts together
+        * with wrapping it with abort_protected_block_count for the non-alertable cases.
+        * And somehow make this whole dance atomic and not crazy expensive. Good luck.
+        *
+        */
+       if (allow_interruption) {
+               if (!mono_thread_test_and_set_state (thread, (MonoThreadState)(ThreadState_StopRequested | ThreadState_AbortRequested), ThreadState_WaitSleepJoin)) {
+                       wait_ret = MONO_SEM_TIMEDWAIT_RET_ALERTED;
+                       goto done_waiting;
+               }
+       } else {
+               mono_thread_set_state (thread, ThreadState_WaitSleepJoin);
+       }
 
        /*
         * We pass ALERTABLE instead of allow_interruption since we have to check for the
@@ -886,7 +906,8 @@ retry_contended:
        wait_ret = mono_coop_sem_timedwait (mon->entry_sem, waitms, MONO_SEM_FLAGS_ALERTABLE);
 
        mono_thread_clr_state (thread, ThreadState_WaitSleepJoin);
-       
+
+done_waiting:
 #ifndef DISABLE_PERFCOUNTERS
        mono_perfcounters->thread_queue_len--;
 #endif
@@ -930,7 +951,7 @@ retry_contended:
        if (wait_ret == MONO_SEM_TIMEDWAIT_RET_ALERTED) {
                LOCK_DEBUG (g_message ("%s: (%d) interrupted waiting, returning -1", __func__, id));
                return -1;
-       } else if (wait_ret == MONO_SEM_TIMEDWAIT_RET_ALERTED) {
+       } else if (wait_ret == MONO_SEM_TIMEDWAIT_RET_TIMEDOUT) {
                LOCK_DEBUG (g_message ("%s: (%d) timed out waiting, returning FALSE", __func__, id));
                return 0;
        } else {
@@ -996,11 +1017,35 @@ mono_monitor_try_enter_internal (MonoObject *obj, guint32 ms, gboolean allow_int
 gboolean 
 mono_monitor_enter (MonoObject *obj)
 {
+       gint32 res;
+       gboolean allow_interruption = TRUE;
        if (G_UNLIKELY (!obj)) {
                mono_set_pending_exception (mono_get_exception_argument_null ("obj"));
                return FALSE;
        }
-       return mono_monitor_try_enter_internal (obj, INFINITE, FALSE) == 1;
+
+       /*
+        * An inquisitive mind could ask what's the deal with this loop.
+        * It exists to deal with interrupting a monitor enter that happened within an abort-protected block, like a .cctor.
+        *
+        * The thread will be set with a pending abort and the wait might even be interrupted. Either way, once we call mono_thread_interruption_checkpoint,
+        * it will return NULL meaning we can't be aborted right now. Once that happens we switch to non-alertable.
+        */
+       do {
+               res = mono_monitor_try_enter_internal (obj, INFINITE, allow_interruption);
+               /*This means we got interrupted during the wait and didn't got the monitor.*/
+               if (res == -1) {
+                       MonoException *exc = mono_thread_interruption_checkpoint ();
+                       if (exc) {
+                               mono_set_pending_exception (exc);
+                               return FALSE;
+                       } else {
+                               //we detected a pending interruption but it turned out to be a false positive, we ignore it from now on (this feels like a hack, right?, threads.c should give us less confusing directions)
+                               allow_interruption = FALSE;
+                       }
+               }
+       } while (res == -1);
+       return TRUE;
 }
 
 gboolean 
@@ -1038,7 +1083,8 @@ mono_monitor_exit (MonoObject *obj)
 
        lw.sync = obj->synchronisation;
 
-       mono_monitor_ensure_owned (lw, mono_thread_info_get_small_id ());
+       if (!mono_monitor_ensure_owned (lw, mono_thread_info_get_small_id ()))
+               return;
 
        if (G_UNLIKELY (lock_word_is_inflated (lw)))
                mono_monitor_exit_inflated (obj);
@@ -1083,18 +1129,22 @@ void
 ves_icall_System_Threading_Monitor_Monitor_try_enter_with_atomic_var (MonoObject *obj, guint32 ms, char *lockTaken)
 {
        gint32 res;
+       gboolean allow_interruption = TRUE;
        if (G_UNLIKELY (!obj)) {
                mono_set_pending_exception (mono_get_exception_argument_null ("obj"));
                return;
        }
        do {
-               res = mono_monitor_try_enter_internal (obj, ms, TRUE);
+               res = mono_monitor_try_enter_internal (obj, ms, allow_interruption);
                /*This means we got interrupted during the wait and didn't got the monitor.*/
                if (res == -1) {
                        MonoException *exc = mono_thread_interruption_checkpoint ();
                        if (exc) {
                                mono_set_pending_exception (exc);
                                return;
+                       } else {
+                               //we detected a pending interruption but it turned out to be a false positive, we ignore it from now on (this feels like a hack, right?, threads.c should give us less confusing directions)
+                               allow_interruption = FALSE;
                        }
                }
        } while (res == -1);
@@ -1185,7 +1235,8 @@ ves_icall_System_Threading_Monitor_Monitor_pulse (MonoObject *obj)
        id = mono_thread_info_get_small_id ();
        lw.sync = obj->synchronisation;
 
-       mono_monitor_ensure_owned (lw, id);
+       if (!mono_monitor_ensure_owned (lw, id))
+               return;
 
        if (!lock_word_is_inflated (lw)) {
                /* No threads waiting. A wait would have inflated the lock */
@@ -1199,7 +1250,7 @@ ves_icall_System_Threading_Monitor_Monitor_pulse (MonoObject *obj)
        if (mon->wait_list != NULL) {
                LOCK_DEBUG (g_message ("%s: (%d) signalling and dequeuing handle %p", __func__, mono_thread_info_get_small_id (), mon->wait_list->data));
        
-               SetEvent (mon->wait_list->data);
+               mono_w32event_set (mon->wait_list->data);
                mon->wait_list = g_slist_remove (mon->wait_list, mon->wait_list->data);
        }
 }
@@ -1216,7 +1267,8 @@ ves_icall_System_Threading_Monitor_Monitor_pulse_all (MonoObject *obj)
        id = mono_thread_info_get_small_id ();
        lw.sync = obj->synchronisation;
 
-       mono_monitor_ensure_owned (lw, id);
+       if (!mono_monitor_ensure_owned (lw, id))
+               return;
 
        if (!lock_word_is_inflated (lw)) {
                /* No threads waiting. A wait would have inflated the lock */
@@ -1230,7 +1282,7 @@ ves_icall_System_Threading_Monitor_Monitor_pulse_all (MonoObject *obj)
        while (mon->wait_list != NULL) {
                LOCK_DEBUG (g_message ("%s: (%d) signalling and dequeuing handle %p", __func__, mono_thread_info_get_small_id (), mon->wait_list->data));
        
-               SetEvent (mon->wait_list->data);
+               mono_w32event_set (mon->wait_list->data);
                mon->wait_list = g_slist_remove (mon->wait_list, mon->wait_list->data);
        }
 }
@@ -1252,7 +1304,8 @@ ves_icall_System_Threading_Monitor_Monitor_wait (MonoObject *obj, guint32 ms)
 
        lw.sync = obj->synchronisation;
 
-       mono_monitor_ensure_owned (lw, id);
+       if (!mono_monitor_ensure_owned (lw, id))
+               return FALSE;
 
        if (!lock_word_is_inflated (lw)) {
                mono_monitor_inflate_owned (obj, id);
@@ -1265,7 +1318,7 @@ ves_icall_System_Threading_Monitor_Monitor_wait (MonoObject *obj, guint32 ms)
        if (mono_thread_current_check_pending_interrupt ())
                return FALSE;
        
-       event = CreateEvent (NULL, FALSE, FALSE, NULL);
+       event = mono_w32event_create (FALSE, FALSE);
        if (event == NULL) {
                mono_set_pending_exception (mono_get_exception_synchronization_lock ("Failed to set up wait event"));
                return FALSE;
index ece67d1286cd4fef23ca0b3389e7af6b58171f82..2e61a1b3373548162adf8a0291ebc00c3411fe4a 100644 (file)
@@ -41,3 +41,13 @@ mono_config_get_bin_dir (void)
 #endif
 }
 
+const char*
+mono_config_get_reloc_lib_dir (void)
+{
+#ifdef MONO_RELOC_LIBDIR
+       return MONO_RELOC_LIBDIR;
+#else
+       return NULL;
+#endif
+}
+
index 9488511bde4b719d7f0ba0a1f779915250eb5812..25e765122539c04384aad6f75ade2ee5efb39637 100644 (file)
@@ -13,4 +13,7 @@ mono_config_get_cfg_dir (void);
 const char*
 mono_config_get_bin_dir (void);
 
+const char*
+mono_config_get_reloc_lib_dir (void);
+
 #endif
index 42f36d36854a771c3b1a7c1915cbfe1cf81038dd..fe82c2e037bef78c7074f11e22a817abd3093f40 100644 (file)
 #endif
 #endif
 
+/**
+ * mono_config_get_os:
+ *
+ * Returns the operating system that Mono is running on, as used for dllmap entries.
+ */
+const char *
+mono_config_get_os (void)
+{
+       return CONFIG_OS;
+}
+
+/**
+ * mono_config_get_cpu:
+ *
+ * Returns the architecture that Mono is running on, as used for dllmap entries.
+ */
+const char *
+mono_config_get_cpu (void)
+{
+       return CONFIG_CPU;
+}
+
+/**
+ * mono_config_get_wordsize:
+ *
+ * Returns the word size that Mono is running on, as used for dllmap entries.
+ */
+const char *
+mono_config_get_wordsize (void)
+{
+       return CONFIG_WORDSIZE;
+}
+
 static void start_element (GMarkupParseContext *context, 
                            const gchar         *element_name,
                           const gchar        **attribute_names,
@@ -281,13 +314,14 @@ dllmap_start (gpointer user_data,
                        else if (strcmp (attribute_names [i], "target") == 0){
                                char *p = strstr (attribute_values [i], "$mono_libdir");
                                if (p != NULL){
-                                       const char *libdir = mono_assembly_getrootdir ();
+                                       char *libdir = mono_native_getrootdir ();
                                        size_t libdir_len = strlen (libdir);
                                        char *result;
                                        
                                        result = (char *)g_malloc (libdir_len-strlen("$mono_libdir")+strlen(attribute_values[i])+1);
                                        strncpy (result, attribute_values[i], p-attribute_values[i]);
                                        strcpy (result+(p-attribute_values[i]), libdir);
+                                       g_free (libdir);
                                        strcat (result, p+strlen("$mono_libdir"));
                                        info->target = result;
                                } else 
index 4e68b8a15d82762bdbc9c0be57aedfe2fd84c135..b9695c14ba296122fa8444d0c942074e2e389997 100644 (file)
 
 MONO_BEGIN_DECLS
 
+MONO_API const char *mono_config_get_os (void);
+MONO_API const char *mono_config_get_cpu (void);
+MONO_API const char *mono_config_get_wordsize (void);
+
 MONO_API const char* mono_get_config_dir (void);
 MONO_API void        mono_set_config_dir (const char *dir);
 
index a4c48f1413dda3adef0ed9064d111854343a075e..0a697360e22e3404541a4f645725d78a2d518217 100644 (file)
@@ -9,6 +9,7 @@
  * Licensed under the MIT license. See LICENSE file in the project root for full license information.
  */
 #include <config.h>
+#include <mono/utils/mono-compiler.h>
 #include "mono-endian.h"
 
 #if NO_UNALIGNED_ACCESS
@@ -86,4 +87,8 @@ mono_read64 (const unsigned char *x)
        return r.i;
 }
 
+#else /* NO_UNALIGNED_ACCESS */
+
+MONO_EMPTY_SOURCE_FILE (mono_endian);
+
 #endif
index e1455148696b130e5e21dffd5c0d4eaa56ad9815..c5c65b66947c8a8f83e1c8dd53f3aee795ddf1a1 100644 (file)
@@ -50,6 +50,8 @@ MONO_API int    mono_gc_get_generation  (MonoObject *object);
 MONO_API int    mono_gc_collection_count (int generation);
 MONO_API int64_t mono_gc_get_used_size   (void);
 MONO_API int64_t mono_gc_get_heap_size   (void);
+MONO_API MonoBoolean mono_gc_pending_finalizers (void);
+MONO_API void     mono_gc_finalize_notify    (void);
 MONO_API int    mono_gc_invoke_finalizers (void);
 /* heap walking is only valid in the pre-stop-world event callback */
 MONO_API int    mono_gc_walk_heap        (int flags, MonoGCReferences callback, void *data);
index dbd443d7328d4a77a92ecfb7fa22120516686886..cd2c622a89d19f0f1054157a3b8795f696415a40 100644 (file)
 #include <mach/message.h>
 #include <mach/mach_host.h>
 #include <mach/host_info.h>
+#include <sys/sysctl.h>
 #endif
-#if defined (__NetBSD__) || defined (__APPLE__)
+#if defined (__NetBSD__)
+#include <sys/param.h>
 #include <sys/sysctl.h>
+#include <sys/vmmeter.h>
 #endif
 #include "metadata/mono-perfcounters.h"
 #include "metadata/appdomain.h"
@@ -425,7 +428,7 @@ mono_determine_physical_ram_size (void)
        int mib[2] = {
                CTL_HW,
 #ifdef __NetBSD__
-               HW_PHYSMEM
+               HW_PHYSMEM64
 #else
                HW_MEMSIZE
 #endif
@@ -474,29 +477,22 @@ mono_determine_physical_ram_available_size (void)
 #elif defined (__NetBSD__)
        struct vmtotal vm_total;
        guint64 page_size;
-       int mib [2];
+       int mib[2];
        size_t len;
 
+       mib[0] = CTL_VM;
+       mib[1] = VM_METER;
 
-       mib = {
-               CTL_VM,
-#if defined (VM_METER)
-               VM_METER
-#else
-               VM_TOTAL
-#endif
-       };
        len = sizeof (vm_total);
        sysctl (mib, 2, &vm_total, &len, NULL, 0);
 
-       mib = {
-               CTL_HW,
-               HW_PAGESIZE
-       };
+       mib[0] = CTL_HW;
+       mib[1] = HW_PAGESIZE;
+
        len = sizeof (page_size);
-       sysctl (mib, 2, &page_size, &len, NULL, 0
+       sysctl (mib, 2, &page_size, &len, NULL, 0);
 
-       return ((guint64) value.t_free * page_size) / 1024;
+       return ((guint64) vm_total.t_free * page_size) / 1024;
 #elif defined (__APPLE__)
        mach_msg_type_number_t count = HOST_VM_INFO_COUNT;
        mach_port_t host = mach_host_self();
index d651b0e5b08387b9b4829e0ce74b612e1fc3cc54..5f3ecb93ea65582aaadb6081e7cfa9e1f2f0c7dc 100644 (file)
@@ -53,7 +53,7 @@ extern MonoBoolean ves_icall_System_Net_NetworkInformation_MacOsIPInterfacePrope
                return FALSE;
 
        // Allocate suffcient memory for available data based on the previous sysctl call
-       if ((buf = malloc(needed)) == NULL)
+       if ((buf = g_malloc (needed)) == NULL)
                return FALSE;
 
        // Second sysctl call to retrieve data into appropriately sized buffer
@@ -102,7 +102,7 @@ extern MonoBoolean ves_icall_System_Net_NetworkInformation_MacOsIPInterfacePrope
                mono_array_setref (*gw_addr_list, gwnum, addr_string);
                gwnum++;
        }
-       free(buf);
+       g_free (buf);
        return TRUE;
 }
 
diff --git a/mono/metadata/mono-security-windows-internals.h b/mono/metadata/mono-security-windows-internals.h
new file mode 100644 (file)
index 0000000..a7cc247
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2016 Microsoft
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
+ */
+#ifndef __MONO_METADATA_MONO_SECURITY_WINDOWS_INTERNALS_H__
+#define __MONO_METADATA_MONO_SECURITY_WINDOWS_INTERNALS_H__
+
+#include <config.h>
+#include <glib.h>
+
+#ifdef HOST_WIN32
+#include "mono/metadata/security.h"
+#include "mono/metadata/object.h"
+#include "mono/metadata/object-internals.h"
+#include "mono/metadata/metadata.h"
+#include "mono/metadata/metadata-internals.h"
+
+gint32
+mono_security_win_get_token_name (gpointer token, gunichar2 ** uniname);
+
+gboolean
+mono_security_win_is_machine_protected (gunichar2 *path);
+
+gboolean
+mono_security_win_is_user_protected (gunichar2 *path);
+
+gboolean
+mono_security_win_protect_machine (gunichar2 *path);
+
+gboolean
+mono_security_win_protect_user (gunichar2 *path);
+#endif /* HOST_WIN32 */
+
+#endif /* __MONO_METADATA_MONO_SECURITY_WINDOWS_INTERNALS_H__ */
diff --git a/mono/metadata/mono-security-windows-uwp.c b/mono/metadata/mono-security-windows-uwp.c
new file mode 100644 (file)
index 0000000..01549b8
--- /dev/null
@@ -0,0 +1,177 @@
+/*
+ * mono-security-windows-uwp.c: UWP security support for Mono.
+ *
+ * Copyright 2016 Microsoft
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
+*/
+#include <config.h>
+#include <glib.h>
+#include "mono/utils/mono-compiler.h"
+
+#if G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT)
+#include <windows.h>
+#include "mono/metadata/mono-security-windows-internals.h"
+
+gpointer
+ves_icall_System_Security_Principal_WindowsIdentity_GetCurrentToken (void)
+{
+       MonoError mono_error;
+       mono_error_init (&mono_error);
+
+       g_unsupported_api ("OpenThreadToken, OpenProcessToken");
+
+       mono_error_set_not_supported (&mono_error, G_UNSUPPORTED_API, "OpenThreadToken, OpenProcessToken");
+       mono_error_set_pending_exception (&mono_error);
+
+       SetLastError (ERROR_NOT_SUPPORTED);
+
+       return NULL;
+}
+
+MonoArray*
+ves_icall_System_Security_Principal_WindowsIdentity_GetRoles (gpointer token)
+{
+       MonoError mono_error;
+       mono_error_init (&mono_error);
+
+       g_unsupported_api ("GetTokenInformation");
+
+       mono_error_set_not_supported (&mono_error, G_UNSUPPORTED_API, "GetTokenInformation");
+       mono_error_set_pending_exception (&mono_error);
+
+       SetLastError (ERROR_NOT_SUPPORTED);
+
+       return NULL;
+}
+
+gpointer
+ves_icall_System_Security_Principal_WindowsImpersonationContext_DuplicateToken (gpointer token)
+{
+       MonoError mono_error;
+       mono_error_init (&mono_error);
+
+       g_unsupported_api ("DuplicateToken");
+
+       mono_error_set_not_supported (&mono_error, G_UNSUPPORTED_API, "DuplicateToken");
+       mono_error_set_pending_exception (&mono_error);
+
+       SetLastError (ERROR_NOT_SUPPORTED);
+
+       return NULL;
+}
+
+gboolean
+ves_icall_System_Security_Principal_WindowsImpersonationContext_SetCurrentToken (gpointer token)
+{
+       MonoError mono_error;
+       mono_error_init (&mono_error);
+
+       g_unsupported_api ("ImpersonateLoggedOnUser");
+
+       mono_error_set_not_supported (&mono_error, G_UNSUPPORTED_API, "ImpersonateLoggedOnUser");
+       mono_error_set_pending_exception (&mono_error);
+
+       SetLastError (ERROR_NOT_SUPPORTED);
+
+       return FALSE;
+}
+
+gboolean
+ves_icall_System_Security_Principal_WindowsImpersonationContext_RevertToSelf (void)
+{
+       MonoError mono_error;
+       mono_error_init (&mono_error);
+
+       g_unsupported_api ("RevertToSelf");
+
+       mono_error_set_not_supported(&mono_error, G_UNSUPPORTED_API, "RevertToSelf");
+       mono_error_set_pending_exception (&mono_error);
+
+       SetLastError (ERROR_NOT_SUPPORTED);
+
+       return FALSE;
+}
+
+gint32
+mono_security_win_get_token_name (gpointer token, gunichar2 ** uniname)
+{
+       MonoError mono_error;
+       mono_error_init (&mono_error);
+
+       g_unsupported_api ("GetTokenInformation");
+
+       mono_error_set_not_supported (&mono_error, G_UNSUPPORTED_API, "GetTokenInformation");
+       mono_error_set_pending_exception (&mono_error);
+
+       SetLastError (ERROR_NOT_SUPPORTED);
+
+       return 0;
+}
+
+gboolean
+mono_security_win_is_machine_protected (gunichar2 *path)
+{
+       MonoError mono_error;
+       mono_error_init (&mono_error);
+
+       g_unsupported_api ("GetNamedSecurityInfo, LocalFree");
+
+       mono_error_set_not_supported (&mono_error, G_UNSUPPORTED_API, "GetNamedSecurityInfo, LocalFree");
+       mono_error_set_pending_exception (&mono_error);
+
+       SetLastError (ERROR_NOT_SUPPORTED);
+
+       return FALSE;
+}
+
+gboolean
+mono_security_win_is_user_protected (gunichar2 *path)
+{
+       MonoError mono_error;
+       mono_error_init (&mono_error);
+
+       g_unsupported_api ("GetNamedSecurityInfo, LocalFree");
+
+       mono_error_set_not_supported (&mono_error, G_UNSUPPORTED_API, "GetNamedSecurityInfo, LocalFree");
+       mono_error_set_pending_exception (&mono_error);
+
+       SetLastError (ERROR_NOT_SUPPORTED);
+
+       return FALSE;
+}
+
+gboolean
+mono_security_win_protect_machine (gunichar2 *path)
+{
+       MonoError mono_error;
+       mono_error_init (&mono_error);
+
+       g_unsupported_api ("BuildTrusteeWithSid, SetEntriesInAcl, SetNamedSecurityInfo, LocalFree, FreeSid");
+
+       mono_error_set_not_supported (&mono_error, G_UNSUPPORTED_API, "BuildTrusteeWithSid, SetEntriesInAcl, SetNamedSecurityInfo, LocalFree, FreeSid");
+       mono_error_set_pending_exception (&mono_error);
+
+       SetLastError (ERROR_NOT_SUPPORTED);
+
+       return FALSE;
+}
+
+gboolean
+mono_security_win_protect_user (gunichar2 *path)
+{
+       MonoError mono_error;
+       mono_error_init (&mono_error);
+
+       g_unsupported_api ("BuildTrusteeWithSid, SetEntriesInAcl, SetNamedSecurityInfo, LocalFree");
+
+       mono_error_set_not_supported (&mono_error, G_UNSUPPORTED_API, "BuildTrusteeWithSid, SetEntriesInAcl, SetNamedSecurityInfo, LocalFree");
+       mono_error_set_pending_exception (&mono_error);
+
+       SetLastError (ERROR_NOT_SUPPORTED);
+
+       return FALSE;
+}
+#else /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
+
+MONO_EMPTY_SOURCE_FILE (mono_security_windows_uwp);
+#endif /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
diff --git a/mono/metadata/mono-security-windows.c b/mono/metadata/mono-security-windows.c
new file mode 100644 (file)
index 0000000..f6d088d
--- /dev/null
@@ -0,0 +1,495 @@
+/*
+ * mono-security-windows.c: Windows security support.
+ *
+ * Copyright 2016 Microsoft
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
+ */
+#include <config.h>
+#include <glib.h>
+
+#if defined(HOST_WIN32)
+#include <winsock2.h>
+#include <windows.h>
+#include "mono/metadata/mono-security-windows-internals.h"
+
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
+#include <aclapi.h>
+#include <accctrl.h>
+#endif
+
+#ifndef PROTECTED_DACL_SECURITY_INFORMATION
+#define PROTECTED_DACL_SECURITY_INFORMATION    0x80000000L
+#endif
+
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
+static gunichar2*
+GetSidName (gunichar2 *server, PSID sid, gint32 *size)
+{
+       gunichar2 *uniname = NULL;
+       DWORD cchName = 0;
+       DWORD cchDomain = 0;
+       SID_NAME_USE peUse; /* out */
+
+       LookupAccountSid (server, sid, NULL, &cchName, NULL,
+               &cchDomain, &peUse);
+
+       if ((cchName > 0) && (cchDomain > 0)) {
+               gunichar2 *user = g_malloc0 ((cchName + 1) * 2);
+               gunichar2 *domain = g_malloc0 ((cchDomain + 1) * 2);
+
+               LookupAccountSid (server, sid, user, &cchName, domain,
+                       &cchDomain, &peUse);
+
+               if (cchName > 0) {
+                       if (cchDomain > 0) {
+                               /* domain/machine name included (+ sepearator) */
+                               *size = cchName + cchDomain + 1;
+                               uniname = g_malloc0 ((*size + 1) * 2);
+                               memcpy (uniname, domain, cchDomain * 2);
+                               *(uniname + cchDomain) = '\\';
+                               memcpy (uniname + cchDomain + 1, user, cchName * 2);
+                               g_free (user);
+                       }
+                       else {
+                               /* no domain / machine */
+                               *size = cchName;
+                               uniname = user;
+                       }
+               }
+               else {
+                       /* nothing -> return NULL */
+                       g_free (user);
+               }
+
+               g_free (domain);
+       }
+
+       return uniname;
+}
+
+gpointer
+ves_icall_System_Security_Principal_WindowsIdentity_GetCurrentToken (void)
+{
+       gpointer token = NULL;
+
+       /* Note: This isn't a copy of the Token - we must not close it!!!
+        * http://www.develop.com/kbrown/book/html/whatis_windowsprincipal.html
+        */
+
+       /* thread may be impersonating somebody */
+       if (OpenThreadToken (GetCurrentThread (), MAXIMUM_ALLOWED, 1, &token) == 0) {
+               /* if not take the process identity */
+               OpenProcessToken (GetCurrentProcess (), MAXIMUM_ALLOWED, &token);
+       }
+
+       return token;
+}
+
+gint32
+mono_security_win_get_token_name (gpointer token, gunichar2 ** uniname)
+{
+       gint32 size = 0;
+
+       GetTokenInformation (token, TokenUser, NULL, size, (PDWORD)&size);
+       if (size > 0) {
+               TOKEN_USER *tu = g_malloc0 (size);
+               if (GetTokenInformation (token, TokenUser, tu, size, (PDWORD)&size)) {
+                       *uniname = GetSidName (NULL, tu->User.Sid, &size);
+               }
+               g_free (tu);
+       }
+
+       return size;
+}
+#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */
+
+MonoString*
+ves_icall_System_Security_Principal_WindowsIdentity_GetTokenName (gpointer token)
+{
+       MonoError error;
+       MonoString *result = NULL;
+       gunichar2 *uniname = NULL;
+       gint32 size = 0;
+
+       mono_error_init (&error);
+
+       size = mono_security_win_get_token_name (token, &uniname);
+
+       if (size > 0) {
+               result = mono_string_new_utf16_checked (mono_domain_get (), uniname, size, &error);
+       }
+       else
+               result = mono_string_new (mono_domain_get (), "");
+
+       if (uniname)
+               g_free (uniname);
+
+       mono_error_set_pending_exception (&error);
+       return result;
+}
+
+gpointer
+ves_icall_System_Security_Principal_WindowsIdentity_GetUserToken (MonoString *username)
+{
+       gpointer token = NULL;
+
+       /* TODO: MS has something like this working in Windows 2003 (client and
+        * server) but works only for domain accounts (so it's quite limiting).
+        * http://www.develop.com/kbrown/book/html/howto_logonuser.html
+        */
+       g_warning ("Unsupported on Win32 (anyway requires W2K3 minimum)");
+       return token;
+}
+
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
+MonoArray*
+ves_icall_System_Security_Principal_WindowsIdentity_GetRoles (gpointer token)
+{
+       MonoError error;
+       MonoArray *array = NULL;
+       MonoDomain *domain = mono_domain_get ();
+
+       gint32 size = 0;
+
+       GetTokenInformation (token, TokenGroups, NULL, size, (PDWORD)&size);
+       if (size > 0) {
+               TOKEN_GROUPS *tg = g_malloc0 (size);
+               if (GetTokenInformation (token, TokenGroups, tg, size, (PDWORD)&size)) {
+                       int i=0;
+                       int num = tg->GroupCount;
+
+                       array = mono_array_new_checked (domain, mono_get_string_class (), num, &error);
+                       if (mono_error_set_pending_exception (&error)) {
+                               g_free (tg);
+                               return NULL;
+                       }
+
+                       for (i=0; i < num; i++) {
+                               gint32 size = 0;
+                               gunichar2 *uniname = GetSidName (NULL, tg->Groups [i].Sid, &size);
+
+                               if (uniname) {
+                                       MonoString *str = mono_string_new_utf16_checked (domain, uniname, size, &error);
+                                       if (!is_ok (&error)) {
+                                               g_free (uniname);
+                                               g_free (tg);
+                                               mono_error_set_pending_exception (&error);
+                                               return NULL;
+                                       }
+                                       mono_array_setref (array, i, str);
+                                       g_free (uniname);
+                               }
+                       }
+               }
+               g_free (tg);
+       }
+
+       if (!array) {
+               /* return empty array of string, i.e. string [0] */
+               array = mono_array_new_checked (domain, mono_get_string_class (), 0, &error);
+               mono_error_set_pending_exception (&error);
+       }
+       return array;
+}
+#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */
+
+gboolean
+ves_icall_System_Security_Principal_WindowsImpersonationContext_CloseToken (gpointer token)
+{
+       gboolean result = TRUE;
+       result = (CloseHandle (token) != 0);
+       return result;
+}
+
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
+gpointer
+ves_icall_System_Security_Principal_WindowsImpersonationContext_DuplicateToken (gpointer token)
+{
+       gpointer dupe = NULL;
+
+       if (DuplicateToken (token, SecurityImpersonation, &dupe) == 0) {
+               dupe = NULL;
+       }
+       return dupe;
+}
+#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */
+
+gboolean
+ves_icall_System_Security_Principal_WindowsPrincipal_IsMemberOfGroupId (gpointer user, gpointer group)
+{
+       gboolean result = FALSE;
+
+       /* The convertion from an ID to a string is done in managed code for Windows */
+       g_warning ("IsMemberOfGroupId should never be called on Win32");
+       return result;
+}
+
+gboolean
+ves_icall_System_Security_Principal_WindowsPrincipal_IsMemberOfGroupName (gpointer user, MonoString *group)
+{
+       gboolean result = FALSE;
+
+       /* Windows version use a cache built using WindowsIdentity._GetRoles */
+       g_warning ("IsMemberOfGroupName should never be called on Win32");
+       return result;
+}
+
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
+static PSID
+GetAdministratorsSid (void)
+{
+       SID_IDENTIFIER_AUTHORITY admins = { SECURITY_NT_AUTHORITY };
+       PSID pSid = NULL;
+       if (!AllocateAndInitializeSid (&admins, 2, SECURITY_BUILTIN_DOMAIN_RID,
+               DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, &pSid))
+               return NULL;
+       /* Note: this SID must be freed with FreeSid () */
+       return pSid;
+}
+
+static PSID
+GetEveryoneSid (void)
+{
+       SID_IDENTIFIER_AUTHORITY everyone = { SECURITY_WORLD_SID_AUTHORITY };
+       PSID pSid = NULL;
+       if (!AllocateAndInitializeSid (&everyone, 1, SECURITY_WORLD_RID, 0, 0, 0, 0, 0, 0, 0, &pSid))
+               return NULL;
+       /* Note: this SID must be freed with FreeSid () */
+       return pSid;
+}
+
+static PSID
+GetCurrentUserSid (void)
+{
+       PSID sid = NULL;
+       guint32 size = 0;
+       gpointer token = ves_icall_System_Security_Principal_WindowsIdentity_GetCurrentToken ();
+
+       GetTokenInformation (token, TokenUser, NULL, size, (PDWORD)&size);
+       if (size > 0) {
+               TOKEN_USER *tu = g_malloc0 (size);
+               if (GetTokenInformation (token, TokenUser, tu, size, (PDWORD)&size)) {
+                       DWORD length = GetLengthSid (tu->User.Sid);
+                       sid = (PSID) g_malloc0 (length);
+                       if (!CopySid (length, sid, tu->User.Sid)) {
+                               g_free (sid);
+                               sid = NULL;
+                       }
+               }
+               g_free (tu);
+       }
+       /* Note: this SID must be freed with g_free () */
+       return sid;
+}
+
+static ACCESS_MASK
+GetRightsFromSid (PSID sid, PACL acl)
+{
+       ACCESS_MASK rights = 0;
+       TRUSTEE trustee;
+
+       BuildTrusteeWithSidW (&trustee, sid);
+       if (GetEffectiveRightsFromAcl (acl, &trustee, &rights) != ERROR_SUCCESS)
+               return 0;
+
+       return rights;
+}
+
+gboolean
+mono_security_win_is_machine_protected (gunichar2 *path)
+{
+       gboolean success = FALSE;
+       PACL pDACL = NULL;
+       PSECURITY_DESCRIPTOR pSD = NULL;
+       PSID pEveryoneSid = NULL;
+
+       DWORD dwRes = GetNamedSecurityInfoW (path, SE_FILE_OBJECT, DACL_SECURITY_INFORMATION, NULL, NULL, &pDACL, NULL, &pSD);
+       if (dwRes != ERROR_SUCCESS)
+               return FALSE;
+
+       /* We check that Everyone is still limited to READ-ONLY -
+       but not if new entries have been added by an Administrator */
+
+       pEveryoneSid = GetEveryoneSid ();
+       if (pEveryoneSid) {
+               ACCESS_MASK rights = GetRightsFromSid (pEveryoneSid, pDACL);
+               /* http://msdn.microsoft.com/library/en-us/security/security/generic_access_rights.asp?frame=true */
+               success = (rights == (READ_CONTROL | SYNCHRONIZE | FILE_READ_DATA | FILE_READ_EA | FILE_READ_ATTRIBUTES));
+               FreeSid (pEveryoneSid);
+       }
+       /* Note: we don't need to check our own access -
+       we'll know soon enough when reading the file */
+
+       if (pSD)
+               LocalFree (pSD);
+
+       return success;
+}
+
+gboolean
+mono_security_win_is_user_protected (gunichar2 *path)
+{
+       gboolean success = FALSE;
+       PACL pDACL = NULL;
+       PSID pEveryoneSid = NULL;
+       PSECURITY_DESCRIPTOR pSecurityDescriptor = NULL;
+
+       DWORD dwRes = GetNamedSecurityInfoW (path, SE_FILE_OBJECT,
+               DACL_SECURITY_INFORMATION, NULL, NULL, &pDACL, NULL, &pSecurityDescriptor);
+       if (dwRes != ERROR_SUCCESS)
+               return FALSE;
+
+       /* We check that our original entries in the ACL are in place -
+       but not if new entries have been added by the user */
+
+       /* Everyone should be denied */
+       pEveryoneSid = GetEveryoneSid ();
+       if (pEveryoneSid) {
+               ACCESS_MASK rights = GetRightsFromSid (pEveryoneSid, pDACL);
+               success = (rights == 0);
+               FreeSid (pEveryoneSid);
+       }
+       /* Note: we don't need to check our own access -
+       we'll know soon enough when reading the file */
+
+       if (pSecurityDescriptor)
+               LocalFree (pSecurityDescriptor);
+
+       return success;
+}
+
+gboolean
+mono_security_win_protect_machine (gunichar2 *path)
+{
+       PSID pEveryoneSid = GetEveryoneSid ();
+       PSID pAdminsSid = GetAdministratorsSid ();
+       DWORD retval = -1;
+
+       if (pEveryoneSid && pAdminsSid) {
+               PACL pDACL = NULL;
+               EXPLICIT_ACCESS ea [2];
+               ZeroMemory (&ea, 2 * sizeof (EXPLICIT_ACCESS));
+
+               /* grant all access to the BUILTIN\Administrators group */
+               BuildTrusteeWithSidW (&ea [0].Trustee, pAdminsSid);
+               ea [0].grfAccessPermissions = GENERIC_ALL;
+               ea [0].grfAccessMode = SET_ACCESS;
+               ea [0].grfInheritance = SUB_CONTAINERS_AND_OBJECTS_INHERIT;
+               ea [0].Trustee.TrusteeForm = TRUSTEE_IS_SID;
+               ea [0].Trustee.TrusteeType = TRUSTEE_IS_WELL_KNOWN_GROUP;
+
+               /* read-only access everyone */
+               BuildTrusteeWithSidW (&ea [1].Trustee, pEveryoneSid);
+               ea [1].grfAccessPermissions = GENERIC_READ;
+               ea [1].grfAccessMode = SET_ACCESS;
+               ea [1].grfInheritance = SUB_CONTAINERS_AND_OBJECTS_INHERIT;
+               ea [1].Trustee.TrusteeForm = TRUSTEE_IS_SID;
+               ea [1].Trustee.TrusteeType = TRUSTEE_IS_WELL_KNOWN_GROUP;
+
+               retval = SetEntriesInAcl (2, ea, NULL, &pDACL);
+               if (retval == ERROR_SUCCESS) {
+                       /* with PROTECTED_DACL_SECURITY_INFORMATION we */
+                       /* remove any existing ACL (like inherited ones) */
+                       retval = SetNamedSecurityInfo (path, SE_FILE_OBJECT,
+                               DACL_SECURITY_INFORMATION | PROTECTED_DACL_SECURITY_INFORMATION,
+                               NULL, NULL, pDACL, NULL);
+               }
+               if (pDACL)
+                       LocalFree (pDACL);
+       }
+
+       if (pEveryoneSid)
+               FreeSid (pEveryoneSid);
+       if (pAdminsSid)
+               FreeSid (pAdminsSid);
+       return (retval == ERROR_SUCCESS);
+}
+
+gboolean
+mono_security_win_protect_user (gunichar2 *path)
+{
+       DWORD retval = -1;
+
+       PSID pCurrentSid = GetCurrentUserSid ();
+       if (pCurrentSid) {
+               PACL pDACL = NULL;
+               EXPLICIT_ACCESS ea;
+               ZeroMemory (&ea, sizeof (EXPLICIT_ACCESS));
+
+               /* grant exclusive access to the current user */
+               BuildTrusteeWithSidW (&ea.Trustee, pCurrentSid);
+               ea.grfAccessPermissions = GENERIC_ALL;
+               ea.grfAccessMode = SET_ACCESS;
+               ea.grfInheritance = SUB_CONTAINERS_AND_OBJECTS_INHERIT;
+               ea.Trustee.TrusteeForm = TRUSTEE_IS_SID;
+               ea.Trustee.TrusteeType = TRUSTEE_IS_USER;
+
+               retval = SetEntriesInAcl (1, &ea, NULL, &pDACL);
+               if (retval == ERROR_SUCCESS) {
+                       /* with PROTECTED_DACL_SECURITY_INFORMATION we
+                          remove any existing ACL (like inherited ones) */
+                       retval = SetNamedSecurityInfo (path, SE_FILE_OBJECT,
+                               DACL_SECURITY_INFORMATION | PROTECTED_DACL_SECURITY_INFORMATION,
+                               NULL, NULL, pDACL, NULL);
+               }
+
+               if (pDACL)
+                       LocalFree (pDACL);
+               g_free (pCurrentSid); /* g_malloc0 */
+       }
+
+       return (retval == ERROR_SUCCESS);
+}
+#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */
+
+MonoBoolean
+ves_icall_Mono_Security_Cryptography_KeyPairPersistence_CanSecure (MonoString *root)
+{
+       gint32 flags;
+
+       /* ACL are nice... unless you have FAT or other uncivilized filesystem */
+       if (!GetVolumeInformation (mono_string_chars (root), NULL, 0, NULL, NULL, (LPDWORD)&flags, NULL, 0))
+               return FALSE;
+       return ((flags & FS_PERSISTENT_ACLS) == FS_PERSISTENT_ACLS);
+}
+
+MonoBoolean
+ves_icall_Mono_Security_Cryptography_KeyPairPersistence_IsMachineProtected (MonoString *path)
+{
+       gboolean ret = FALSE;
+
+       /* no one, but the owner, should have write access to the directory */
+       ret = mono_security_win_is_machine_protected (mono_string_chars (path));
+       return (MonoBoolean)ret;
+}
+
+MonoBoolean
+ves_icall_Mono_Security_Cryptography_KeyPairPersistence_IsUserProtected (MonoString *path)
+{
+       gboolean ret = FALSE;
+
+       /* no one, but the user, should have access to the directory */
+       ret = mono_security_win_is_user_protected (mono_string_chars (path));
+       return (MonoBoolean)ret;
+}
+
+MonoBoolean
+ves_icall_Mono_Security_Cryptography_KeyPairPersistence_ProtectMachine (MonoString *path)
+{
+       gboolean ret = FALSE;
+
+       /* read/write to owner, read to everyone else */
+       ret = mono_security_win_protect_machine (mono_string_chars (path));
+       return (MonoBoolean)ret;
+}
+
+MonoBoolean
+ves_icall_Mono_Security_Cryptography_KeyPairPersistence_ProtectUser (MonoString *path)
+{
+       gboolean ret = FALSE;
+
+       /* read/write to user, no access to everyone else */
+       ret = mono_security_win_protect_user (mono_string_chars (path));
+       return (MonoBoolean)ret;
+}
+#endif /* HOST_WIN32 */
index b27da358575742b762965b76338ececeb5248327..09b8cd44abe6deaba2428602aa257022dbf21a88 100644 (file)
 #include <mono/io-layer/io-layer.h>
 #include <mono/utils/strenc.h>
 
-#ifdef HOST_WIN32
-
-#include <aclapi.h>
-#include <accctrl.h>
-
-#ifndef PROTECTED_DACL_SECURITY_INFORMATION
-#define PROTECTED_DACL_SECURITY_INFORMATION    0x80000000L
-#endif
-
-#else
-
+#ifndef HOST_WIN32
 #include <config.h>
 #ifdef HAVE_GRP_H
 #include <grp.h>
 #endif
 
 #endif /* defined(__GNUC__) */
-
-#endif /* not HOST_WIN32 */
-
+#endif /* !HOST_WIN32 */
 
 /* internal functions - reuse driven */
 
-#ifdef HOST_WIN32
-
 /* ask a server to translate a SID into a textual representation */
-static gunichar2*
-GetSidName (gunichar2 *server, PSID sid, gint32 *size) 
-{
-       gunichar2 *uniname = NULL;
-       DWORD cchName = 0;
-       DWORD cchDomain = 0;
-       SID_NAME_USE peUse; /* out */
-
-       LookupAccountSid (server, sid, NULL, &cchName, NULL, 
-               &cchDomain, &peUse); 
-       
-       if ((cchName > 0) && (cchDomain > 0)) {
-               gunichar2 *user = g_malloc0 ((cchName + 1) * 2);
-               gunichar2 *domain = g_malloc0 ((cchDomain + 1) * 2);
-
-               LookupAccountSid (server, sid, user, &cchName, domain,
-                       &cchDomain, &peUse);
-
-               if (cchName > 0) {
-                       if (cchDomain > 0) {
-                               /* domain/machine name included (+ sepearator) */
-                               *size = cchName + cchDomain + 1;
-                               uniname = g_malloc0 ((*size + 1) * 2);
-                               memcpy (uniname, domain, cchDomain * 2);
-                               *(uniname + cchDomain) = '\\';
-                               memcpy (uniname + cchDomain + 1, user, cchName * 2);
-                               g_free (user);
-                       }
-                       else {
-                               /* no domain / machine */
-                               *size = cchName;
-                               uniname = user;
-                       }
-               }
-               else {
-                       /* nothing -> return NULL */
-                       g_free (user);
-               }
-
-               g_free (domain);
-       }
-
-       return uniname;
-}
-
-
-#else /* not HOST_WIN32 */
-
+#ifndef HOST_WIN32
 #define MONO_SYSCONF_DEFAULT_SIZE      ((size_t) 1024)
 
 /*
@@ -133,7 +72,6 @@ static size_t mono_sysconf (int name)
        return (size == -1) ? MONO_SYSCONF_DEFAULT_SIZE : size;
 }
 
-
 static gchar*
 GetTokenName (uid_t uid)
 {
@@ -174,7 +112,6 @@ GetTokenName (uid_t uid)
        return uname;
 }
 
-
 static gboolean
 IsMemberInList (uid_t user, struct group *g) 
 {
@@ -201,7 +138,6 @@ IsMemberInList (uid_t user, struct group *g)
        return result;
 }
 
-
 static gboolean
 IsDefaultGroup (uid_t user, gid_t group)
 {
@@ -241,7 +177,6 @@ IsDefaultGroup (uid_t user, gid_t group)
        return result;
 }
 
-
 static gboolean
 IsMemberOf (gid_t user, struct group *g) 
 {
@@ -255,37 +190,34 @@ IsMemberOf (gid_t user, struct group *g)
        /* is the user in the group list */
        return IsMemberInList (user, g);
 }
-
-#endif
-
+#endif /* !HOST_WIN32 */
 
 /* ICALLS */
 
-
 /* System.Security.Principal.WindowsIdentity */
 
-
+#ifndef HOST_WIN32
 gpointer
 ves_icall_System_Security_Principal_WindowsIdentity_GetCurrentToken (void)
 {
-       gpointer token = NULL;
+       return GINT_TO_POINTER (geteuid ());
+}
+
+static gint32
+internal_get_token_name (gpointer token, gunichar2 ** uniname)
+{
+       gint32 size = 0;
 
-#ifdef HOST_WIN32
-       /* Note: This isn't a copy of the Token - we must not close it!!!
-        * http://www.develop.com/kbrown/book/html/whatis_windowsprincipal.html
-        */
+       gchar *uname = GetTokenName ((uid_t) GPOINTER_TO_INT (token));
 
-       /* thread may be impersonating somebody */
-       if (OpenThreadToken (GetCurrentThread (), TOKEN_QUERY, 1, &token) == 0) {
-               /* if not take the process identity */
-               OpenProcessToken (GetCurrentProcess (), TOKEN_QUERY, &token);
+       if (uname) {
+               size = strlen (uname);
+               *uniname = g_utf8_to_utf16 (uname, size, NULL, NULL, NULL);
+               g_free (uname);
        }
-#else
-       token = GINT_TO_POINTER (geteuid ());
-#endif
-       return token;
-}
 
+       return size;
+}
 
 MonoString*
 ves_icall_System_Security_Principal_WindowsIdentity_GetTokenName (gpointer token)
@@ -296,24 +228,8 @@ ves_icall_System_Security_Principal_WindowsIdentity_GetTokenName (gpointer token
        gint32 size = 0;
 
        mono_error_init (&error);
-#ifdef HOST_WIN32
-       GetTokenInformation (token, TokenUser, NULL, size, (PDWORD)&size);
-       if (size > 0) {
-               TOKEN_USER *tu = g_malloc0 (size);
-               if (GetTokenInformation (token, TokenUser, tu, size, (PDWORD)&size)) {
-                       uniname = GetSidName (NULL, tu->User.Sid, &size);
-               }
-               g_free (tu);
-       }
-#else 
-       gchar *uname = GetTokenName ((uid_t) GPOINTER_TO_INT (token));
 
-       if (uname) {
-               size = strlen (uname);
-               uniname = g_utf8_to_utf16 (uname, size, NULL, NULL, NULL);
-               g_free (uname);
-       }
-#endif /* HOST_WIN32 */
+       size = internal_get_token_name (token, &uniname);
 
        if (size > 0) {
                result = mono_string_new_utf16_checked (mono_domain_get (), uniname, size, &error);
@@ -327,22 +243,12 @@ ves_icall_System_Security_Principal_WindowsIdentity_GetTokenName (gpointer token
        mono_error_set_pending_exception (&error);
        return result;
 }
+#endif  /* !HOST_WIN32 */
 
-
+#ifndef HOST_WIN32
 gpointer
 ves_icall_System_Security_Principal_WindowsIdentity_GetUserToken (MonoString *username)
 {
-#ifdef HOST_WIN32
-       gpointer token = NULL;
-
-       /* TODO: MS has something like this working in Windows 2003 (client and
-        * server) but works only for domain accounts (so it's quite limiting).
-        * http://www.develop.com/kbrown/book/html/howto_logonuser.html
-        */
-       g_warning ("Unsupported on Win32 (anyway requires W2K3 minimum)");
-
-#else /* HOST_WIN32*/
-
 #ifdef HAVE_GETPWNAM_R
        struct passwd pwd;
        size_t fbufsize;
@@ -380,59 +286,26 @@ ves_icall_System_Security_Principal_WindowsIdentity_GetUserToken (MonoString *us
        g_free (fbuf);
 #endif
        g_free (utf8_name);
-#endif
+
        return token;
 }
-
+#endif /* HOST_WIN32 */
 
 /* http://www.dotnet247.com/247reference/msgs/39/195403.aspx
 // internal static string[] WindowsIdentity._GetRoles (IntPtr token)
 */
+
+#ifndef HOST_WIN32
 MonoArray*
-ves_icall_System_Security_Principal_WindowsIdentity_GetRoles (gpointer token) 
+ves_icall_System_Security_Principal_WindowsIdentity_GetRoles (gpointer token)
 {
        MonoError error;
        MonoArray *array = NULL;
-       MonoDomain *domain = mono_domain_get (); 
-#ifdef HOST_WIN32
-       gint32 size = 0;
-
-       GetTokenInformation (token, TokenGroups, NULL, size, (PDWORD)&size);
-       if (size > 0) {
-               TOKEN_GROUPS *tg = g_malloc0 (size);
-               if (GetTokenInformation (token, TokenGroups, tg, size, (PDWORD)&size)) {
-                       int i=0;
-                       int num = tg->GroupCount;
-
-                       array = mono_array_new_checked (domain, mono_get_string_class (), num, &error);
-                       if (mono_error_set_pending_exception (&error)) {
-                               g_free (tg);
-                               return NULL;
-                       }
+       MonoDomain *domain = mono_domain_get ();
 
-                       for (i=0; i < num; i++) {
-                               gint32 size = 0;
-                               gunichar2 *uniname = GetSidName (NULL, tg->Groups [i].Sid, &size);
-
-                               if (uniname) {
-                                       MonoString *str = mono_string_new_utf16_checked (domain, uniname, size, &error);
-                                       if (!is_ok (&error)) {
-                                               g_free (uniname);
-                                               g_free (tg);
-                                               mono_error_set_pending_exception (&error);
-                                               return NULL;
-                                       }
-                                       mono_array_setref (array, i, str);
-                                       g_free (uniname);
-                               }
-                       }
-               }
-               g_free (tg);
-       }
-#else
        /* POSIX-compliant systems should use IsMemberOfGroupId or IsMemberOfGroupName */
        g_warning ("WindowsIdentity._GetRoles should never be called on POSIX");
-#endif
+
        if (!array) {
                /* return empty array of string, i.e. string [0] */
                array = mono_array_new_checked (domain, mono_get_string_class (), 0, &error);
@@ -440,39 +313,27 @@ ves_icall_System_Security_Principal_WindowsIdentity_GetRoles (gpointer token)
        }
        return array;
 }
-
+#endif /* !HOST_WIN32 */
 
 /* System.Security.Principal.WindowsImpersonationContext */
 
-
+#ifndef HOST_WIN32
 gboolean
 ves_icall_System_Security_Principal_WindowsImpersonationContext_CloseToken (gpointer token)
 {
-       gboolean result = TRUE;
-
-#ifdef HOST_WIN32
-       result = (CloseHandle (token) != 0);
-#endif
-       return result;
+       return TRUE;
 }
+#endif /* !HOST_WIN32 */
 
-
+#ifndef HOST_WIN32
 gpointer
 ves_icall_System_Security_Principal_WindowsImpersonationContext_DuplicateToken (gpointer token)
 {
-       gpointer dupe = NULL;
-
-#ifdef HOST_WIN32
-       if (DuplicateToken (token, SecurityImpersonation, &dupe) == 0) {
-               dupe = NULL;
-       }
-#else
-       dupe = token;
-#endif
-       return dupe;
+       return token;
 }
+#endif /* !HOST_WIN32 */
 
-
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
 gboolean
 ves_icall_System_Security_Principal_WindowsImpersonationContext_SetCurrentToken (gpointer token)
 {
@@ -480,28 +341,22 @@ ves_icall_System_Security_Principal_WindowsImpersonationContext_SetCurrentToken
        return (ImpersonateLoggedOnUser (token) != 0);
 }
 
-
 gboolean
 ves_icall_System_Security_Principal_WindowsImpersonationContext_RevertToSelf (void)
 {
        /* Posix version implemented in /mono/mono/io-layer/security.c */
        return (RevertToSelf () != 0);
 }
-
+#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */
 
 /* System.Security.Principal.WindowsPrincipal */
 
+#ifndef HOST_WIN32
 gboolean
 ves_icall_System_Security_Principal_WindowsPrincipal_IsMemberOfGroupId (gpointer user, gpointer group)
 {
        gboolean result = FALSE;
 
-#ifdef HOST_WIN32
-       /* The convertion from an ID to a string is done in managed code for Windows */
-       g_warning ("IsMemberOfGroupId should never be called on Win32");
-
-#else /* HOST_WIN32 */
-
 #ifdef HAVE_GETGRGID_R
        struct group grp;
        size_t fbufsize;
@@ -533,22 +388,13 @@ ves_icall_System_Security_Principal_WindowsPrincipal_IsMemberOfGroupId (gpointer
        g_free (fbuf);
 #endif
 
-#endif /* HOST_WIN32 */
-
        return result;
 }
 
-
 gboolean
 ves_icall_System_Security_Principal_WindowsPrincipal_IsMemberOfGroupName (gpointer user, MonoString *group)
 {
        gboolean result = FALSE;
-
-#ifdef HOST_WIN32
-       /* Windows version use a cache built using WindowsIdentity._GetRoles */
-       g_warning ("IsMemberOfGroupName should never be called on Win32");
-
-#else /* HOST_WIN32 */
        gchar *utf8_groupname;
 
        utf8_groupname = mono_unicode_to_external (mono_string_chars (group));
@@ -581,231 +427,15 @@ ves_icall_System_Security_Principal_WindowsPrincipal_IsMemberOfGroupName (gpoint
 #endif
                g_free (utf8_groupname);
        }
-#endif /* HOST_WIN32 */
 
        return result;
 }
-
+#endif /* !HOST_WIN32 */
 
 /* Mono.Security.Cryptography IO related internal calls */
 
-#ifdef HOST_WIN32
-
-static PSID
-GetAdministratorsSid (void) 
-{
-       SID_IDENTIFIER_AUTHORITY admins = SECURITY_NT_AUTHORITY;
-       PSID pSid = NULL;
-       if (!AllocateAndInitializeSid (&admins, 2, SECURITY_BUILTIN_DOMAIN_RID, 
-               DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, &pSid)) 
-               return NULL;
-       /* Note: this SID must be freed with FreeSid () */
-       return pSid;
-}
-
-
-static PSID
-GetEveryoneSid (void)
-{
-       SID_IDENTIFIER_AUTHORITY everyone = SECURITY_WORLD_SID_AUTHORITY;
-       PSID pSid = NULL;
-       if (!AllocateAndInitializeSid (&everyone, 1, SECURITY_WORLD_RID, 0, 0, 0, 0, 0, 0, 0, &pSid))
-               return NULL;
-       /* Note: this SID must be freed with FreeSid () */
-       return pSid;
-}
-
-
-static PSID
-GetCurrentUserSid (void) 
-{
-       PSID sid = NULL;
-       guint32 size = 0;
-       gpointer token = ves_icall_System_Security_Principal_WindowsIdentity_GetCurrentToken ();
-
-       GetTokenInformation (token, TokenUser, NULL, size, (PDWORD)&size);
-       if (size > 0) {
-               TOKEN_USER *tu = g_malloc0 (size);
-               if (GetTokenInformation (token, TokenUser, tu, size, (PDWORD)&size)) {
-                       DWORD length = GetLengthSid (tu->User.Sid);
-                       sid = (PSID) g_malloc0 (length);
-                       if (!CopySid (length, sid, tu->User.Sid)) {
-                               g_free (sid);
-                               sid = NULL;
-                       }
-               }
-               g_free (tu);
-       }
-       /* Note: this SID must be freed with g_free () */
-       return sid;
-}
-
-
-static ACCESS_MASK
-GetRightsFromSid (PSID sid, PACL acl) 
-{
-       ACCESS_MASK rights = 0;
-       TRUSTEE trustee;
-
-       BuildTrusteeWithSidW (&trustee, sid);
-       if (GetEffectiveRightsFromAcl (acl, &trustee, &rights) != ERROR_SUCCESS)
-               return 0;
-
-       return rights;
-}
-
-
-static gboolean 
-IsMachineProtected (gunichar2 *path)
-{
-       gboolean success = FALSE;
-       PACL pDACL = NULL;
-       PSID pEveryoneSid = NULL;
-
-       DWORD dwRes = GetNamedSecurityInfoW (path, SE_FILE_OBJECT, DACL_SECURITY_INFORMATION, NULL, NULL, &pDACL, NULL, NULL);
-       if (dwRes != ERROR_SUCCESS)
-               return FALSE;
-
-       /* We check that Everyone is still limited to READ-ONLY -
-       but not if new entries have been added by an Administrator */
-
-       pEveryoneSid = GetEveryoneSid ();
-       if (pEveryoneSid) {
-               ACCESS_MASK rights = GetRightsFromSid (pEveryoneSid, pDACL);
-               /* http://msdn.microsoft.com/library/en-us/security/security/generic_access_rights.asp?frame=true */
-               success = (rights == (READ_CONTROL | SYNCHRONIZE | FILE_READ_DATA | FILE_READ_EA | FILE_READ_ATTRIBUTES));
-               FreeSid (pEveryoneSid);
-       }
-       /* Note: we don't need to check our own access - 
-       we'll know soon enough when reading the file */
-
-       if (pDACL)
-               LocalFree (pDACL);
-
-       return success;
-}
-
-
-static gboolean 
-IsUserProtected (gunichar2 *path)
-{
-       gboolean success = FALSE;
-       PACL pDACL = NULL;
-       PSID pEveryoneSid = NULL;
-       PSECURITY_DESCRIPTOR pSecurityDescriptor = NULL;
-
-       DWORD dwRes = GetNamedSecurityInfoW (path, SE_FILE_OBJECT, 
-               DACL_SECURITY_INFORMATION, NULL, NULL, &pDACL, NULL, &pSecurityDescriptor);
-       if (dwRes != ERROR_SUCCESS)
-               return FALSE;
-
-       /* We check that our original entries in the ACL are in place -
-       but not if new entries have been added by the user */
-
-       /* Everyone should be denied */
-       pEveryoneSid = GetEveryoneSid ();
-       if (pEveryoneSid) {
-               ACCESS_MASK rights = GetRightsFromSid (pEveryoneSid, pDACL);
-               success = (rights == 0);
-               FreeSid (pEveryoneSid);
-       }
-       /* Note: we don't need to check our own access - 
-       we'll know soon enough when reading the file */
-
-       if (pSecurityDescriptor)
-               LocalFree (pSecurityDescriptor);
-
-       return success;
-}
-
-
-static gboolean 
-ProtectMachine (gunichar2 *path)
-{
-       PSID pEveryoneSid = GetEveryoneSid ();
-       PSID pAdminsSid = GetAdministratorsSid ();
-       DWORD retval = -1;
-
-       if (pEveryoneSid && pAdminsSid) {
-               PACL pDACL = NULL;
-               EXPLICIT_ACCESS ea [2];
-               ZeroMemory (&ea, 2 * sizeof (EXPLICIT_ACCESS));
-
-               /* grant all access to the BUILTIN\Administrators group */
-               BuildTrusteeWithSidW (&ea [0].Trustee, pAdminsSid);
-               ea [0].grfAccessPermissions = GENERIC_ALL;
-               ea [0].grfAccessMode = SET_ACCESS;
-               ea [0].grfInheritance = SUB_CONTAINERS_AND_OBJECTS_INHERIT;
-               ea [0].Trustee.TrusteeForm = TRUSTEE_IS_SID;
-               ea [0].Trustee.TrusteeType = TRUSTEE_IS_WELL_KNOWN_GROUP;
-
-               /* read-only access everyone */
-               BuildTrusteeWithSidW (&ea [1].Trustee, pEveryoneSid);
-               ea [1].grfAccessPermissions = GENERIC_READ;
-               ea [1].grfAccessMode = SET_ACCESS;
-               ea [1].grfInheritance = SUB_CONTAINERS_AND_OBJECTS_INHERIT;
-               ea [1].Trustee.TrusteeForm = TRUSTEE_IS_SID;
-               ea [1].Trustee.TrusteeType = TRUSTEE_IS_WELL_KNOWN_GROUP;
-
-               retval = SetEntriesInAcl (2, ea, NULL, &pDACL);
-               if (retval == ERROR_SUCCESS) {
-                       /* with PROTECTED_DACL_SECURITY_INFORMATION we */
-                       /* remove any existing ACL (like inherited ones) */
-                       retval = SetNamedSecurityInfo (path, SE_FILE_OBJECT, 
-                               DACL_SECURITY_INFORMATION | PROTECTED_DACL_SECURITY_INFORMATION,
-                               NULL, NULL, pDACL, NULL);
-               }
-               if (pDACL)
-                       LocalFree (pDACL);
-       }
-
-       if (pEveryoneSid)
-               FreeSid (pEveryoneSid);
-       if (pAdminsSid)
-               FreeSid (pAdminsSid);
-       return (retval == ERROR_SUCCESS);
-}
-
-
-static gboolean 
-ProtectUser (gunichar2 *path)
-{
-       DWORD retval = -1;
-
-       PSID pCurrentSid = GetCurrentUserSid ();
-       if (pCurrentSid) {
-               PACL pDACL = NULL;
-               EXPLICIT_ACCESS ea;
-               ZeroMemory (&ea, sizeof (EXPLICIT_ACCESS));
-
-               /* grant exclusive access to the current user */
-               BuildTrusteeWithSidW (&ea.Trustee, pCurrentSid);
-               ea.grfAccessPermissions = GENERIC_ALL;
-               ea.grfAccessMode = SET_ACCESS;
-               ea.grfInheritance = SUB_CONTAINERS_AND_OBJECTS_INHERIT;
-               ea.Trustee.TrusteeForm = TRUSTEE_IS_SID;
-               ea.Trustee.TrusteeType = TRUSTEE_IS_USER;
-
-               retval = SetEntriesInAcl (1, &ea, NULL, &pDACL);
-               if (retval == ERROR_SUCCESS) {
-                       /* with PROTECTED_DACL_SECURITY_INFORMATION we
-                          remove any existing ACL (like inherited ones) */
-                       retval = SetNamedSecurityInfo (path, SE_FILE_OBJECT, 
-                               DACL_SECURITY_INFORMATION | PROTECTED_DACL_SECURITY_INFORMATION,
-                               NULL, NULL, pDACL, NULL);
-               }
-
-               if (pDACL)
-                       LocalFree (pDACL);
-               g_free (pCurrentSid); /* g_malloc0 */
-       }
-
-       return (retval == ERROR_SUCCESS);
-}
-
-#else
-
-static gboolean 
+#ifndef HOST_WIN32
+static gboolean
 IsProtected (MonoString *path, gint32 protection) 
 {
        gboolean result = FALSE;
@@ -821,7 +451,7 @@ IsProtected (MonoString *path, gint32 protection)
 }
 
 
-static gboolean 
+static gboolean
 Protect (MonoString *path, gint32 file_mode, gint32 add_dir_mode)
 {
        gboolean result = FALSE;
@@ -839,85 +469,53 @@ Protect (MonoString *path, gint32 file_mode, gint32 add_dir_mode)
        return result;
 }
 
-#endif /* not HOST_WIN32 */
-
-
 MonoBoolean
 ves_icall_Mono_Security_Cryptography_KeyPairPersistence_CanSecure (MonoString *root)
 {
-#if HOST_WIN32
-       gint32 flags;
-
-       /* ACL are nice... unless you have FAT or other uncivilized filesystem */
-       if (!GetVolumeInformation (mono_string_chars (root), NULL, 0, NULL, NULL, (LPDWORD)&flags, NULL, 0))
-               return FALSE;
-       return ((flags & FS_PERSISTENT_ACLS) == FS_PERSISTENT_ACLS);
-#else
        /* we assume some kind of security is applicable outside Windows */
        return TRUE;
-#endif
 }
 
-
 MonoBoolean
 ves_icall_Mono_Security_Cryptography_KeyPairPersistence_IsMachineProtected (MonoString *path)
 {
        gboolean ret = FALSE;
 
        /* no one, but the owner, should have write access to the directory */
-#ifdef HOST_WIN32
-       ret = IsMachineProtected (mono_string_chars (path));
-#else
        ret = IsProtected (path, (S_IWGRP | S_IWOTH));
-#endif
-       return ret;
+       return (MonoBoolean)ret;
 }
 
-
 MonoBoolean
 ves_icall_Mono_Security_Cryptography_KeyPairPersistence_IsUserProtected (MonoString *path)
 {
        gboolean ret = FALSE;
 
        /* no one, but the user, should have access to the directory */
-#ifdef HOST_WIN32
-       ret = IsUserProtected (mono_string_chars (path));
-#else
        ret = IsProtected (path, (S_IRGRP | S_IWGRP | S_IXGRP | S_IROTH | S_IWOTH | S_IXOTH));
-#endif
-       return ret;
+       return (MonoBoolean)ret;
 }
 
-
 MonoBoolean
 ves_icall_Mono_Security_Cryptography_KeyPairPersistence_ProtectMachine (MonoString *path)
 {
        gboolean ret = FALSE;
 
        /* read/write to owner, read to everyone else */
-#ifdef HOST_WIN32
-       ret = ProtectMachine (mono_string_chars (path));
-#else
        ret = Protect (path, (S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH), (S_IXUSR | S_IXGRP | S_IXOTH));
-#endif
-       return ret;
+       return (MonoBoolean)ret;
 }
 
-
 MonoBoolean
 ves_icall_Mono_Security_Cryptography_KeyPairPersistence_ProtectUser (MonoString *path)
 {
        gboolean ret = FALSE;
        
        /* read/write to user, no access to everyone else */
-#ifdef HOST_WIN32
-       ret = ProtectUser (mono_string_chars (path));
-#else
        ret = Protect (path, (S_IRUSR | S_IWUSR), S_IXUSR);
-#endif
-       return ret;
+       return (MonoBoolean)ret;
 }
-
+#endif /* !HOST_WIN32 */
 
 /*
  * Returns TRUE if there is "something" where the Authenticode signature is 
@@ -929,7 +527,7 @@ MonoBoolean
 ves_icall_System_Security_Policy_Evidence_IsAuthenticodePresent (MonoReflectionAssembly *refass)
 {
        if (refass && refass->assembly && refass->assembly->image) {
-               return mono_image_has_authenticode_entry (refass->assembly->image);
+               return (MonoBoolean)mono_image_has_authenticode_entry (refass->assembly->image);
        }
        return FALSE;
 }
index c1a531c0dc87eac782c46785a481b82df532abc6..9ea87bd844c51a3efaf775a8b159251b1271fc2f 100644 (file)
@@ -26,6 +26,10 @@ mono_gc_base_init (void)
 
        mono_counters_init ();
 
+#ifndef HOST_WIN32
+       mono_w32handle_init ();
+#endif
+
        memset (&cb, 0, sizeof (cb));
        /* TODO: This casts away an incompatible pointer type warning in the same
                 manner that boehm-gc does it. This is probably worth investigating
@@ -107,16 +111,6 @@ mono_object_is_alive (MonoObject* o)
        return TRUE;
 }
 
-void
-mono_gc_enable_events (void)
-{
-}
-
-void
-mono_gc_enable_alloc_events (void)
-{
-}
-
 int
 mono_gc_register_root (char *start, size_t size, void *descr, MonoGCRootSource source, const char *msg)
 {
@@ -191,7 +185,7 @@ mono_gc_free_fixed (void* addr)
 void *
 mono_gc_alloc_obj (MonoVTable *vtable, size_t size)
 {
-       MonoObject *obj = calloc (1, size);
+       MonoObject *obj = g_calloc (1, size);
 
        obj->vtable = vtable;
 
@@ -201,7 +195,7 @@ mono_gc_alloc_obj (MonoVTable *vtable, size_t size)
 void *
 mono_gc_alloc_vector (MonoVTable *vtable, size_t size, uintptr_t max_length)
 {
-       MonoArray *obj = calloc (1, size);
+       MonoArray *obj = g_calloc (1, size);
 
        obj->obj.vtable = vtable;
        obj->max_length = max_length;
@@ -212,7 +206,7 @@ mono_gc_alloc_vector (MonoVTable *vtable, size_t size, uintptr_t max_length)
 void *
 mono_gc_alloc_array (MonoVTable *vtable, size_t size, uintptr_t max_length, uintptr_t bounds_size)
 {
-       MonoArray *obj = calloc (1, size);
+       MonoArray *obj = g_calloc (1, size);
 
        obj->obj.vtable = vtable;
        obj->max_length = max_length;
@@ -226,7 +220,7 @@ mono_gc_alloc_array (MonoVTable *vtable, size_t size, uintptr_t max_length, uint
 void *
 mono_gc_alloc_string (MonoVTable *vtable, size_t size, gint32 len)
 {
-       MonoString *obj = calloc (1, size);
+       MonoString *obj = g_calloc (1, size);
 
        obj->object.vtable = vtable;
        obj->length = len;
@@ -450,11 +444,6 @@ mono_gc_get_nursery (int *shift_bits, size_t *size)
        return NULL;
 }
 
-void
-mono_gc_set_current_thread_appdomain (MonoDomain *domain)
-{
-}
-
 gboolean
 mono_gc_precise_stack_mark_enabled (void)
 {
@@ -467,6 +456,16 @@ mono_gc_get_logfile (void)
        return NULL;
 }
 
+void
+mono_gc_params_set (const char* options)
+{
+}
+
+void
+mono_gc_debug_set (const char* options)
+{
+}
+
 void
 mono_gc_conservatively_scan_area (void *start, void *end)
 {
@@ -551,5 +550,7 @@ mono_gc_is_null (void)
 {
        return TRUE;
 }
+#else
 
-#endif
+MONO_EMPTY_SOURCE_FILE (null_gc);
+#endif /* HAVE_NULL_GC */
index a3ae4dfdd377d0fe6d10a22b2d37ab35ace6bb32..b3ad83d12e7825b0b1064b61ded4f15bbf8b1673 100644 (file)
@@ -7,6 +7,7 @@
 #include <mono/metadata/mempool.h>
 #include <mono/metadata/class-internals.h>
 #include <mono/metadata/threads-types.h>
+#include <mono/metadata/handle.h>
 #include <mono/io-layer/io-layer.h>
 #include "mono/utils/mono-compiler.h"
 #include "mono/utils/mono-error.h"
@@ -218,6 +219,9 @@ struct _MonoException {
        MonoArray  *native_trace_ips;
 };
 
+/* Safely access System.Exception from native code */
+TYPED_HANDLE_DECL (MonoException);
+
 typedef struct {
        MonoException base;
 } MonoSystemException;
@@ -262,6 +266,9 @@ struct _MonoReflectionType {
        MonoType  *type;
 };
 
+/* Safely access System.Type from native code */
+TYPED_HANDLE_DECL (MonoReflectionType);
+
 /* This corresponds to System.RuntimeType */
 typedef struct {
        MonoReflectionType type;
@@ -345,7 +352,8 @@ typedef enum {
 struct _MonoInternalThread {
        MonoObject  obj;
        volatile int lock_thread_id; /* to be used as the pre-shifted thread id in thin locks. Used for appdomain_ref push/pop */
-       HANDLE      handle;
+       MonoThreadHandle *handle;
+       HANDLE native_handle;
        MonoArray  *cached_culture_info;
        gunichar2  *name;
        guint32     name_len;
@@ -353,7 +361,6 @@ struct _MonoInternalThread {
        MonoException *abort_exc;
        int abort_state_handle;
        guint64 tid;    /* This is accessed as a gsize in the code (so it can hold a 64bit pointer on systems that need it), but needs to reserve 64 bits of space on all machines as it corresponds to a field in managed code */
-       HANDLE      start_notify;
        gpointer stack_ptr;
        gpointer *static_data;
        void *thread_info; /*This is MonoThreadInfo*, but to simplify dependencies, let's make it a void* here. */
@@ -376,14 +383,25 @@ struct _MonoInternalThread {
        gpointer interrupt_on_stop;
        gsize    flags;
        gpointer thread_pinning_ref;
+       gsize abort_protected_block_count;
+       gint32 priority;
+       GPtrArray *owned_mutexes;
+       MonoOSEvent *suspended;
+       gint32 self_suspended; // TRUE | FALSE
        /* 
         * These fields are used to avoid having to increment corlib versions
         * when a new field is added to this structure.
         * Please synchronize any changes with InternalThread in Thread.cs, i.e. add the
         * same field there.
         */
-       gpointer unused1;
-       gpointer unused2;
+       gsize unused1;
+       gsize unused2;
+
+       /* This is used only to check that we are in sync between the representation
+        * of MonoInternalThread in native and InternalThread in managed
+        *
+        * DO NOT RENAME! DO NOT ADD FIELDS AFTER! */
+       gpointer last;
 };
 
 struct _MonoThread {
@@ -391,7 +409,6 @@ struct _MonoThread {
        struct _MonoInternalThread *internal_thread;
        MonoObject *start_obj;
        MonoException *pending_exception;
-       gint32 priority;
 };
 
 typedef struct {
@@ -584,6 +601,7 @@ typedef struct {
        void (*mono_raise_exception_with_ctx) (MonoException *ex, MonoContext *ctx);
        gboolean (*mono_exception_walk_trace) (MonoException *ex, MonoInternalExceptionFrameWalk func, gpointer user_data);
        gboolean (*mono_install_handler_block_guard) (MonoThreadUnwindState *unwind_state);
+       gboolean (*mono_current_thread_has_handle_block_guard) (void);
 } MonoRuntimeExceptionHandlingCallbacks;
 
 /* used to free a dynamic method */
@@ -808,6 +826,9 @@ struct _MonoReflectionAssembly {
        MonoString *name;
 };
 
+/* Safely access System.Reflection.Assembly from native code */
+TYPED_HANDLE_DECL (MonoReflectionAssembly);
+
 typedef struct {
        MonoReflectionType *utype;
        MonoArray *values;
@@ -1097,6 +1118,9 @@ struct _MonoReflectionModule {
        guint32 token;
 };
 
+/* Safely access System.Reflection.Module from native code */
+TYPED_HANDLE_DECL (MonoReflectionModule);
+
 typedef struct {
        MonoReflectionModule module;
        MonoDynamicImage *dynamic_image;
@@ -1162,12 +1186,16 @@ typedef struct {
        guint32 attrs;
 } MonoReflectionGenericParam;
 
+typedef struct {
+       MonoReflectionType type;
+       MonoReflectionTypeBuilder *tb;
+} MonoReflectionEnumBuilder;
+
 typedef struct _MonoReflectionGenericClass MonoReflectionGenericClass;
 struct _MonoReflectionGenericClass {
        MonoReflectionType type;
        MonoReflectionType *generic_type; /*Can be either a MonoType or a TypeBuilder*/
        MonoArray *type_arguments;
-       guint32 initialized;
 };
 
 typedef struct {
@@ -1264,26 +1292,6 @@ typedef struct {
        MonoArray *modopts;
 } MonoReflectionSigHelper;
 
-typedef struct {
-       MonoObject object;
-       MonoReflectionGenericClass *inst;
-       MonoObject *fb; /*can be either a MonoField or a FieldBuilder*/
-} MonoReflectionFieldOnTypeBuilderInst;
-
-typedef struct {
-       MonoObject object;
-       MonoReflectionGenericClass *inst;
-       MonoObject *cb; /*can be either a MonoCMethod or ConstructorBuilder*/
-} MonoReflectionCtorOnTypeBuilderInst;
-
-typedef struct {
-       MonoObject object;
-       MonoReflectionType *inst;
-       MonoObject *mb; /*can be either a MonoMethod or MethodBuilder*/
-       MonoArray *method_args;
-       MonoReflectionMethodBuilder *generic_method_definition;
-} MonoReflectionMethodOnTypeBuilderInst;
-
 typedef struct {
        MonoObject object;
        MonoBoolean visible;
@@ -1329,7 +1337,6 @@ typedef struct {
 } CattrNamedArg;
 
 gboolean          mono_image_create_pefile (MonoReflectionModuleBuilder *module, HANDLE file, MonoError *error);
-MonoReflectionModule * mono_image_load_module_dynamic (MonoReflectionAssemblyBuilder *assembly, MonoString *file_name, MonoError *error);
 guint32       mono_image_insert_string (MonoReflectionModuleBuilder *module, MonoString *str);
 guint32       mono_image_create_token  (MonoDynamicImage *assembly, MonoObject *obj, gboolean create_methodspec, gboolean register_token, MonoError *error);
 guint32       mono_image_create_method_token (MonoDynamicImage *assembly, MonoObject *obj, MonoArray *opt_param_types, MonoError *error);
@@ -1340,18 +1347,6 @@ void          mono_dynamic_image_release_gc_roots (MonoDynamicImage *image);
 
 void        mono_reflection_setup_internal_class  (MonoReflectionTypeBuilder *tb);
 
-void
-ves_icall_TypeBuilder_create_internal_class (MonoReflectionTypeBuilder *tb);
-
-void
-ves_icall_TypeBuilder_setup_generic_class (MonoReflectionTypeBuilder *tb);
-
-MonoReflectionType*
-ves_icall_TypeBuilder_create_runtime_class (MonoReflectionTypeBuilder *tb);
-
-void
-ves_icall_TypeBuilder_setup_internal_class (MonoReflectionTypeBuilder *tb);
-
 void        mono_reflection_get_dynamic_overrides (MonoClass *klass, MonoMethod ***overrides, int *num_overrides, MonoError *error);
 
 void mono_reflection_destroy_dynamic_method (MonoReflectionDynamicMethod *mb);
@@ -1390,18 +1385,12 @@ mono_reflection_lookup_dynamic_token (MonoImage *image, guint32 token, gboolean
 gboolean
 mono_reflection_call_is_assignable_to (MonoClass *klass, MonoClass *oklass, MonoError *error);
 
-gboolean
-mono_reflection_is_valid_dynamic_token (MonoDynamicImage *image, guint32 token);
-
 void
 ves_icall_System_Reflection_CustomAttributeData_ResolveArgumentsInternal (MonoReflectionMethod *method, MonoReflectionAssembly *assembly, gpointer data, guint32 data_length, MonoArray **ctor_args, MonoArray ** named_args);
 
 MonoType*
 mono_reflection_type_get_handle (MonoReflectionType *ref, MonoError *error);
 
-void
-mono_reflection_free_dynamic_generic_class (MonoGenericClass *gclass);
-
 gboolean
 mono_image_build_metadata (MonoReflectionModuleBuilder *module, MonoError *error);
 
@@ -1519,14 +1508,14 @@ struct _MonoIMTCheckItem {
        guint8            has_target_code;
 };
 
-typedef gpointer (*MonoImtThunkBuilder) (MonoVTable *vtable, MonoDomain *domain,
+typedef gpointer (*MonoImtTrampolineBuilder) (MonoVTable *vtable, MonoDomain *domain,
                MonoIMTCheckItem **imt_entries, int count, gpointer fail_trunk);
 
 void
-mono_install_imt_thunk_builder (MonoImtThunkBuilder func);
+mono_install_imt_trampoline_builder (MonoImtTrampolineBuilder func);
 
 void
-mono_set_always_build_imt_thunks (gboolean value);
+mono_set_always_build_imt_trampolines (gboolean value);
 
 void
 mono_vtable_build_imt_slot (MonoVTable* vtable, int imt_slot);
@@ -1540,7 +1529,7 @@ mono_method_add_generic_virtual_invocation (MonoDomain *domain, MonoVTable *vtab
                                                                                        MonoMethod *method, gpointer code);
 
 gpointer
-mono_method_alloc_generic_virtual_thunk (MonoDomain *domain, int size);
+mono_method_alloc_generic_virtual_trampoline (MonoDomain *domain, int size);
 
 typedef enum {
        MONO_UNHANDLED_POLICY_LEGACY,
@@ -1641,10 +1630,10 @@ MonoString*
 mono_string_intern_checked (MonoString *str, MonoError *error);
 
 char *
-mono_exception_get_native_backtrace (MonoException *exc);
+mono_exception_handle_get_native_backtrace (MonoExceptionHandle exc);
 
-MonoString *
-ves_icall_Mono_Runtime_GetNativeStackTrace (MonoException *exc);
+MonoStringHandle
+ves_icall_Mono_Runtime_GetNativeStackTrace (MonoExceptionHandle exc, MonoError *erro);
 
 char *
 mono_exception_get_managed_backtrace (MonoException *exc);
@@ -1780,25 +1769,19 @@ ves_icall_AssemblyBuilder_basic_init (MonoReflectionAssemblyBuilder *assemblyb);
 MonoReflectionModule*
 ves_icall_AssemblyBuilder_InternalAddModule (MonoReflectionAssemblyBuilder *ab, MonoString *fileName);
 
-void
-ves_icall_TypeBuilder_create_generic_class (MonoReflectionTypeBuilder *tb);
-
 MonoArray*
 ves_icall_CustomAttributeBuilder_GetBlob (MonoReflectionAssembly *assembly, MonoObject *ctor, MonoArray *ctorArgs, MonoArray *properties, MonoArray *propValues, MonoArray *fields, MonoArray* fieldValues);
 
 void
 ves_icall_DynamicMethod_create_dynamic_method (MonoReflectionDynamicMethod *mb);
 
-MonoBoolean
-ves_icall_TypeBuilder_get_IsGenericParameter (MonoReflectionTypeBuilder *tb);
+MonoReflectionType*
+ves_icall_TypeBuilder_create_runtime_class (MonoReflectionTypeBuilder *tb);
 
 void
 ves_icall_EnumBuilder_setup_enum_type (MonoReflectionType *enumtype,
                                                                           MonoReflectionType *t);
 
-MonoReflectionType*
-ves_icall_ModuleBuilder_create_modified_type (MonoReflectionTypeBuilder *tb, MonoString *smodifiers);
-
 void
 ves_icall_ModuleBuilder_basic_init (MonoReflectionModuleBuilder *moduleb);
 
@@ -1808,10 +1791,4 @@ ves_icall_ModuleBuilder_getUSIndex (MonoReflectionModuleBuilder *module, MonoStr
 void
 ves_icall_ModuleBuilder_set_wrappers_type (MonoReflectionModuleBuilder *moduleb, MonoReflectionType *type);
 
-void
-ves_icall_GenericTypeParameterBuilder_initialize_generic_parameter (MonoReflectionGenericParam *gparam);
-
-MonoReflectionMethod*
-ves_icall_MethodBuilder_MakeGenericMethod (MonoReflectionMethod *rmethod, MonoArray *types);
-
 #endif /* __MONO_OBJECT_INTERNALS_H__ */
index 67da8451d17030e15f33c538ce08eefe1afbbd6a..5c78288ec8b20f808fa2db0e74d9612e7ac817b3 100644 (file)
@@ -92,6 +92,7 @@ DECL_OFFSET(MonoDelegate, extra_arg)
 DECL_OFFSET(MonoInternalThread, tid)
 DECL_OFFSET(MonoInternalThread, small_id)
 DECL_OFFSET(MonoInternalThread, static_data)
+DECL_OFFSET(MonoInternalThread, last)
 
 DECL_OFFSET(MonoMulticastDelegate, delegates)
 
@@ -133,11 +134,9 @@ DECL_OFFSET(MonoThreadsSync, nest)
 
 #ifdef HAVE_SGEN_GC
 DECL_OFFSET(SgenClientThreadInfo, in_critical_region)
-#ifndef HAVE_KW_THREAD
-DECL_OFFSET(SgenThreadInfo, tlab_next_addr)
+DECL_OFFSET(SgenThreadInfo, tlab_next)
 DECL_OFFSET(SgenThreadInfo, tlab_temp_end)
 #endif
-#endif
 
 #endif //DISABLE METADATA OFFSETS
 
@@ -239,6 +238,8 @@ DECL_OFFSET(GSharedVtCallInfo, gsharedvt_in)
 #endif
 
 #if defined(TARGET_ARM64)
+DECL_OFFSET (MonoContext, has_fregs)
+
 DECL_OFFSET(GSharedVtCallInfo, stack_usage)
 DECL_OFFSET(GSharedVtCallInfo, gsharedvt_in)
 DECL_OFFSET(GSharedVtCallInfo, ret_marshal)
index 3f61428872f77097b9890ebc75896f26de35786d..0c8d83cffbfc3807751be377ff88e191f1cf4249 100644 (file)
@@ -41,6 +41,7 @@
 #include <mono/metadata/gc-internals.h>
 #include <mono/metadata/verify-internals.h>
 #include <mono/metadata/reflection-internals.h>
+#include <mono/metadata/w32event.h>
 #include <mono/utils/strenc.h>
 #include <mono/utils/mono-counters.h>
 #include <mono/utils/mono-error-internals.h>
@@ -329,6 +330,7 @@ mono_runtime_class_init_full (MonoVTable *vtable, MonoError *error)
        MonoNativeThreadId tid;
        int do_initialization = 0;
        MonoDomain *last_domain = NULL;
+       MonoException * pending_tae = NULL;
 
        mono_error_init (error);
 
@@ -431,14 +433,22 @@ mono_runtime_class_init_full (MonoVTable *vtable, MonoError *error)
 
        if (do_initialization) {
                MonoException *exc = NULL;
+
+               mono_threads_begin_abort_protected_block ();
                mono_runtime_try_invoke (method, NULL, NULL, (MonoObject**) &exc, error);
-               if (exc != NULL && mono_error_ok (error)) {
-                       mono_error_set_exception_instance (error, exc);
-               }
+               mono_threads_end_abort_protected_block ();
+
+               //exception extracted, error will be set to the right value later
+               if (exc == NULL && !mono_error_ok (error))//invoking failed but exc was not set
+                       exc = mono_error_convert_to_exception (error);
+               else
+                       mono_error_cleanup (error);
+
+               mono_error_init (error);
 
                /* If the initialization failed, mark the class as unusable. */
                /* Avoid infinite loops */
-               if (!(mono_error_ok(error) ||
+               if (!(!exc ||
                          (klass->image == mono_defaults.corlib &&
                           !strcmp (klass->name_space, "System") &&
                           !strcmp (klass->name, "TypeInitializationException")))) {
@@ -451,15 +461,9 @@ mono_runtime_class_init_full (MonoVTable *vtable, MonoError *error)
 
                        MonoException *exc_to_throw = mono_get_exception_type_initialization_checked (full_name, exc, error);
                        g_free (full_name);
-                       return_val_if_nok (error, FALSE);
 
-                       mono_error_set_exception_instance (error, exc_to_throw);
+                       mono_error_assert_ok (error); //We can't recover from this, no way to fail a type we can't alloc a failure.
 
-                       MonoException *exc_to_store = mono_error_convert_to_exception (error);
-                       /* What we really want to do here is clone the error object and store one copy in the
-                        * domain's exception hash and use the other one to error out here. */
-                       mono_error_init (error);
-                       mono_error_set_exception_instance (error, exc_to_store);
                        /*
                         * Store the exception object so it could be thrown on subsequent
                         * accesses.
@@ -467,7 +471,7 @@ mono_runtime_class_init_full (MonoVTable *vtable, MonoError *error)
                        mono_domain_lock (domain);
                        if (!domain->type_init_exception_hash)
                                domain->type_init_exception_hash = mono_g_hash_table_new_type (mono_aligned_addr_hash, NULL, MONO_HASH_VALUE_GC, MONO_ROOT_SOURCE_DOMAIN, "type initialization exceptions table");
-                       mono_g_hash_table_insert (domain->type_init_exception_hash, klass, exc_to_store);
+                       mono_g_hash_table_insert (domain->type_init_exception_hash, klass, exc_to_throw);
                        mono_domain_unlock (domain);
                }
 
@@ -475,6 +479,11 @@ mono_runtime_class_init_full (MonoVTable *vtable, MonoError *error)
                        mono_domain_set (last_domain, TRUE);
                lock->done = TRUE;
                mono_type_init_unlock (lock);
+               if (exc && mono_object_class (exc) == mono_defaults.threadabortexception_class)
+                       pending_tae = exc;
+               //TAEs are blocked around .cctors, they must escape as soon as no cctor is left to run.
+               if (!pending_tae)
+                       pending_tae = mono_thread_try_resume_interruption ();
        } else {
                /* this just blocks until the initializing thread is done */
                mono_type_init_lock (lock);
@@ -495,7 +504,10 @@ mono_runtime_class_init_full (MonoVTable *vtable, MonoError *error)
                vtable->initialized = 1;
        mono_type_initialization_unlock ();
 
-       if (vtable->init_failed) {
+       //TAE wins over TIE
+       if (pending_tae)
+               mono_error_set_exception_instance (error, pending_tae);
+       else if (vtable->init_failed) {
                /* Either we were the initializing thread or we waited for the initialization */
                mono_error_set_exception_instance (error, get_type_init_exception_for_vtable (vtable));
                return FALSE;
@@ -560,8 +572,8 @@ default_delegate_trampoline (MonoDomain *domain, MonoClass *klass)
 }
 
 static MonoDelegateTrampoline arch_create_delegate_trampoline = default_delegate_trampoline;
-static MonoImtThunkBuilder imt_thunk_builder;
-static gboolean always_build_imt_thunks;
+static MonoImtTrampolineBuilder imt_trampoline_builder;
+static gboolean always_build_imt_trampolines;
 
 #if (MONO_IMT_SIZE > 32)
 #error "MONO_IMT_SIZE cannot be larger than 32"
@@ -594,14 +606,15 @@ mono_install_delegate_trampoline (MonoDelegateTrampoline func)
 }
 
 void
-mono_install_imt_thunk_builder (MonoImtThunkBuilder func) {
-       imt_thunk_builder = func;
+mono_install_imt_trampoline_builder (MonoImtTrampolineBuilder func)
+{
+       imt_trampoline_builder = func;
 }
 
 void
-mono_set_always_build_imt_thunks (gboolean value)
+mono_set_always_build_imt_trampolines (gboolean value)
 {
-       always_build_imt_thunks = value;
+       always_build_imt_trampolines = value;
 }
 
 /**
@@ -1195,7 +1208,7 @@ mono_method_get_imt_slot (MonoMethod *method)
                break;
        }
        
-       free (hashes_start);
+       g_free (hashes_start);
        /* Report the result */
        return c % MONO_IMT_SIZE;
 }
@@ -1323,7 +1336,7 @@ imt_sort_slot_entries (MonoImtBuilderEntry *entries) {
 
        imt_emit_ir (sorted_array, 0, number_of_entries, result);
 
-       free (sorted_array);
+       g_free (sorted_array);
        return result;
 }
 
@@ -1333,15 +1346,15 @@ initialize_imt_slot (MonoVTable *vtable, MonoDomain *domain, MonoImtBuilderEntry
        MONO_REQ_GC_NEUTRAL_MODE;
 
        if (imt_builder_entry != NULL) {
-               if (imt_builder_entry->children == 0 && !fail_tramp && !always_build_imt_thunks) {
+               if (imt_builder_entry->children == 0 && !fail_tramp && !always_build_imt_trampolines) {
                        /* No collision, return the vtable slot contents */
                        return vtable->vtable [imt_builder_entry->value.vtable_slot];
                } else {
-                       /* Collision, build the thunk */
+                       /* Collision, build the trampoline */
                        GPtrArray *imt_ir = imt_sort_slot_entries (imt_builder_entry);
                        gpointer result;
                        int i;
-                       result = imt_thunk_builder (vtable, domain,
+                       result = imt_trampoline_builder (vtable, domain,
                                (MonoIMTCheckItem**)imt_ir->pdata, imt_ir->len, fail_tramp);
                        for (i = 0; i < imt_ir->len; ++i)
                                g_free (g_ptr_array_index (imt_ir, i));
@@ -1390,17 +1403,18 @@ build_imt_slots (MonoClass *klass, MonoVTable *vt, MonoDomain *domain, gpointer*
 
                mono_class_setup_methods (iface);
                vt_slot = interface_offset;
-               for (method_slot_in_interface = 0; method_slot_in_interface < iface->method.count; method_slot_in_interface++) {
+               int mcount = mono_class_get_method_count (iface);
+               for (method_slot_in_interface = 0; method_slot_in_interface < mcount; method_slot_in_interface++) {
                        MonoMethod *method;
 
-                       if (slot_num >= 0 && iface->is_inflated) {
+                       if (slot_num >= 0 && mono_class_is_ginst (iface)) {
                                /*
                                 * The imt slot of the method is the same as for its declaring method,
                                 * see the comment in mono_method_get_imt_slot (), so we can
                                 * avoid inflating methods which will be discarded by 
                                 * add_imt_builder_entry anyway.
                                 */
-                               method = mono_class_get_method_by_index (iface->generic_class->container_class, method_slot_in_interface);
+                               method = mono_class_get_method_by_index (mono_class_get_generic_class (iface)->container_class, method_slot_in_interface);
                                if (mono_method_get_imt_slot (method) != slot_num) {
                                        vt_slot ++;
                                        continue;
@@ -1425,14 +1439,15 @@ build_imt_slots (MonoClass *klass, MonoVTable *vt, MonoDomain *domain, gpointer*
                for (list_item = extra_interfaces; list_item != NULL; list_item=list_item->next) {
                        MonoClass* iface = (MonoClass *)list_item->data;
                        int method_slot_in_interface;
-                       for (method_slot_in_interface = 0; method_slot_in_interface < iface->method.count; method_slot_in_interface++) {
+                       int mcount = mono_class_get_method_count (iface);
+                       for (method_slot_in_interface = 0; method_slot_in_interface < mcount; method_slot_in_interface++) {
                                MonoMethod *method = mono_class_get_method_by_index (iface, method_slot_in_interface);
 
                                if (method->is_generic)
                                        has_generic_virtual = TRUE;
                                add_imt_builder_entry (imt_builder, method, &imt_collisions_bitmap, interface_offset + method_slot_in_interface, slot_num);
                        }
-                       interface_offset += iface->method.count;
+                       interface_offset += mcount;
                }
        }
        for (i = 0; i < MONO_IMT_SIZE; ++i) {
@@ -1463,12 +1478,12 @@ build_imt_slots (MonoClass *klass, MonoVTable *vt, MonoDomain *domain, gpointer*
 
                        if (has_generic_virtual || has_variant_iface) {
                                /*
-                                * There might be collisions later when the the thunk is expanded.
+                                * There might be collisions later when the the trampoline is expanded.
                                 */
                                imt_collisions_bitmap |= (1 << i);
 
                                /* 
-                                * The IMT thunk might be called with an instance of one of the 
+                                * The IMT trampoline might be called with an instance of one of the 
                                 * generic virtual methods, so has to fallback to the IMT trampoline.
                                 */
                                imt [i] = initialize_imt_slot (vt, domain, imt_builder [i], callbacks.get_imt_trampoline (vt, i));
@@ -1503,7 +1518,7 @@ build_imt_slots (MonoClass *klass, MonoVTable *vt, MonoDomain *domain, gpointer*
                        entry = next;
                }
        }
-       free (imt_builder);
+       g_free (imt_builder);
        /* we OR the bitmap since we may build just a single imt slot at a time */
        vt->imt_collisions_bitmap |= imt_collisions_bitmap;
 }
@@ -1521,7 +1536,7 @@ build_imt (MonoClass *klass, MonoVTable *vt, MonoDomain *domain, gpointer* imt,
  * @imt_slot: slot in the IMT table
  *
  * Fill the given @imt_slot in the IMT table of @vtable with
- * a trampoline or a thunk for the case of collisions.
+ * a trampoline or a trampoline for the case of collisions.
  * This is part of the internal mono API.
  *
  * LOCKING: Take the domain lock.
@@ -1549,167 +1564,35 @@ mono_vtable_build_imt_slot (MonoVTable* vtable, int imt_slot)
        mono_loader_unlock ();
 }
 
-
-/*
- * The first two free list entries both belong to the wait list: The
- * first entry is the pointer to the head of the list and the second
- * entry points to the last element.  That way appending and removing
- * the first element are both O(1) operations.
- */
-#ifdef MONO_SMALL_CONFIG
-#define NUM_FREE_LISTS         6
-#else
-#define NUM_FREE_LISTS         12
-#endif
-#define FIRST_FREE_LIST_SIZE   64
-#define MAX_WAIT_LENGTH        50
 #define THUNK_THRESHOLD                10
 
-/*
- * LOCKING: The domain lock must be held.
- */
-static void
-init_thunk_free_lists (MonoDomain *domain)
-{
-       MONO_REQ_GC_NEUTRAL_MODE;
-
-       if (domain->thunk_free_lists)
-               return;
-       domain->thunk_free_lists = (MonoThunkFreeList **)mono_domain_alloc0 (domain, sizeof (gpointer) * NUM_FREE_LISTS);
-}
-
-static int
-list_index_for_size (int item_size)
-{
-       int i = 2;
-       int size = FIRST_FREE_LIST_SIZE;
-
-       while (item_size > size && i < NUM_FREE_LISTS - 1) {
-               i++;
-               size <<= 1;
-       }
-
-       return i;
-}
-
 /**
- * mono_method_alloc_generic_virtual_thunk:
+ * mono_method_alloc_generic_virtual_trampoline:
  * @domain: a domain
  * @size: size in bytes
  *
  * Allocs size bytes to be used for the code of a generic virtual
- * thunk.  It's either allocated from the domain's code manager or
+ * trampoline.  It's either allocated from the domain's code manager or
  * reused from a previously invalidated piece.
  *
  * LOCKING: The domain lock must be held.
  */
 gpointer
-mono_method_alloc_generic_virtual_thunk (MonoDomain *domain, int size)
+mono_method_alloc_generic_virtual_trampoline (MonoDomain *domain, int size)
 {
        MONO_REQ_GC_NEUTRAL_MODE;
 
        static gboolean inited = FALSE;
-       static int generic_virtual_thunks_size = 0;
-
-       guint32 *p;
-       int i;
-       MonoThunkFreeList **l;
-
-       init_thunk_free_lists (domain);
-
-       size += sizeof (guint32);
-       if (size < sizeof (MonoThunkFreeList))
-               size = sizeof (MonoThunkFreeList);
+       static int generic_virtual_trampolines_size = 0;
 
-       i = list_index_for_size (size);
-       for (l = &domain->thunk_free_lists [i]; *l; l = &(*l)->next) {
-               if ((*l)->size >= size) {
-                       MonoThunkFreeList *item = *l;
-                       *l = item->next;
-                       return ((guint32*)item) + 1;
-               }
-       }
-
-       /* no suitable item found - search lists of larger sizes */
-       while (++i < NUM_FREE_LISTS) {
-               MonoThunkFreeList *item = domain->thunk_free_lists [i];
-               if (!item)
-                       continue;
-               g_assert (item->size > size);
-               domain->thunk_free_lists [i] = item->next;
-               return ((guint32*)item) + 1;
-       }
-
-       /* still nothing found - allocate it */
        if (!inited) {
-               mono_counters_register ("Generic virtual thunk bytes",
-                               MONO_COUNTER_GENERICS | MONO_COUNTER_INT, &generic_virtual_thunks_size);
+               mono_counters_register ("Generic virtual trampoline bytes",
+                               MONO_COUNTER_GENERICS | MONO_COUNTER_INT, &generic_virtual_trampolines_size);
                inited = TRUE;
        }
-       generic_virtual_thunks_size += size;
+       generic_virtual_trampolines_size += size;
 
-       p = (guint32 *)mono_domain_code_reserve (domain, size);
-       *p = size;
-
-       mono_domain_lock (domain);
-       if (!domain->generic_virtual_thunks)
-               domain->generic_virtual_thunks = g_hash_table_new (NULL, NULL);
-       g_hash_table_insert (domain->generic_virtual_thunks, p, p);
-       mono_domain_unlock (domain);
-
-       return p + 1;
-}
-
-/*
- * LOCKING: The domain lock must be held.
- */
-static void
-invalidate_generic_virtual_thunk (MonoDomain *domain, gpointer code)
-{
-       MONO_REQ_GC_NEUTRAL_MODE;
-
-       guint32 *p = (guint32 *)code;
-       MonoThunkFreeList *l = (MonoThunkFreeList*)(p - 1);
-       gboolean found = FALSE;
-
-       mono_domain_lock (domain);
-       if (!domain->generic_virtual_thunks)
-               domain->generic_virtual_thunks = g_hash_table_new (NULL, NULL);
-       if (g_hash_table_lookup (domain->generic_virtual_thunks, l))
-               found = TRUE;
-       mono_domain_unlock (domain);
-
-       if (!found)
-               /* Not allocated by mono_method_alloc_generic_virtual_thunk (), i.e. AOT */
-               return;
-       init_thunk_free_lists (domain);
-
-       while (domain->thunk_free_lists [0] && domain->thunk_free_lists [0]->length >= MAX_WAIT_LENGTH) {
-               MonoThunkFreeList *item = domain->thunk_free_lists [0];
-               int length = item->length;
-               int i;
-
-               /* unlink the first item from the wait list */
-               domain->thunk_free_lists [0] = item->next;
-               domain->thunk_free_lists [0]->length = length - 1;
-
-               i = list_index_for_size (item->size);
-
-               /* put it in the free list */
-               item->next = domain->thunk_free_lists [i];
-               domain->thunk_free_lists [i] = item;
-       }
-
-       l->next = NULL;
-       if (domain->thunk_free_lists [1]) {
-               domain->thunk_free_lists [1] = domain->thunk_free_lists [1]->next = l;
-               domain->thunk_free_lists [0]->length++;
-       } else {
-               g_assert (!domain->thunk_free_lists [0]);
-
-               domain->thunk_free_lists [0] = domain->thunk_free_lists [1] = l;
-               domain->thunk_free_lists [0]->length = 1;
-       }
+       return mono_domain_code_reserve (domain, size);
 }
 
 typedef struct _GenericVirtualCase {
@@ -1773,7 +1656,7 @@ get_generic_virtual_entries (MonoDomain *domain, gpointer *vtable_slot)
  * Registers a call via unmanaged code to a generic virtual method
  * instantiation or variant interface method.  If the number of calls reaches a threshold
  * (THUNK_THRESHOLD), the method is added to the vtable slot's generic
- * virtual method thunk.
+ * virtual method trampoline.
  */
 void
 mono_method_add_generic_virtual_invocation (MonoDomain *domain, MonoVTable *vtable,
@@ -1784,6 +1667,7 @@ mono_method_add_generic_virtual_invocation (MonoDomain *domain, MonoVTable *vtab
 
        static gboolean inited = FALSE;
        static int num_added = 0;
+       static int num_freed = 0;
 
        GenericVirtualCase *gvc, *list;
        MonoImtBuilderEntry *entries;
@@ -1794,6 +1678,12 @@ mono_method_add_generic_virtual_invocation (MonoDomain *domain, MonoVTable *vtab
        if (!domain->generic_virtual_cases)
                domain->generic_virtual_cases = g_hash_table_new (mono_aligned_addr_hash, NULL);
 
+       if (!inited) {
+               mono_counters_register ("Generic virtual cases", MONO_COUNTER_GENERICS | MONO_COUNTER_INT, &num_added);
+               mono_counters_register ("Freed IMT trampolines", MONO_COUNTER_GENERICS | MONO_COUNTER_INT, &num_freed);
+               inited = TRUE;
+       }
+
        /* Check whether the case was already added */
        list = (GenericVirtualCase *)g_hash_table_lookup (domain->generic_virtual_cases, vtable_slot);
        gvc = list;
@@ -1813,10 +1703,6 @@ mono_method_add_generic_virtual_invocation (MonoDomain *domain, MonoVTable *vtab
 
                g_hash_table_insert (domain->generic_virtual_cases, vtable_slot, gvc);
 
-               if (!inited) {
-                       mono_counters_register ("Generic virtual cases", MONO_COUNTER_GENERICS | MONO_COUNTER_INT, &num_added);
-                       inited = TRUE;
-               }
                num_added++;
        }
 
@@ -1829,7 +1715,7 @@ mono_method_add_generic_virtual_invocation (MonoDomain *domain, MonoVTable *vtab
                        int displacement = (gpointer*)vtable_slot - (gpointer*)vtable;
                        int imt_slot = MONO_IMT_SIZE + displacement;
 
-                       /* Force the rebuild of the thunk at the next call */
+                       /* Force the rebuild of the trampoline at the next call */
                        imt_trampoline = callbacks.get_imt_trampoline (vtable, imt_slot);
                        *vtable_slot = imt_trampoline;
                } else {
@@ -1839,8 +1725,8 @@ mono_method_add_generic_virtual_invocation (MonoDomain *domain, MonoVTable *vtab
 
                        sorted = imt_sort_slot_entries (entries);
 
-                       *vtable_slot = imt_thunk_builder (NULL, domain, (MonoIMTCheckItem**)sorted->pdata, sorted->len,
-                                                                                         vtable_trampoline);
+                       *vtable_slot = imt_trampoline_builder (NULL, domain, (MonoIMTCheckItem**)sorted->pdata, sorted->len,
+                                                                                                  vtable_trampoline);
 
                        while (entries) {
                                MonoImtBuilderEntry *next = entries->next;
@@ -1851,14 +1737,10 @@ mono_method_add_generic_virtual_invocation (MonoDomain *domain, MonoVTable *vtab
                        for (i = 0; i < sorted->len; ++i)
                                g_free (g_ptr_array_index (sorted, i));
                        g_ptr_array_free (sorted, TRUE);
-               }
 
-#ifndef __native_client__
-               /* We don't re-use any thunks as there is a lot of overhead */
-               /* to deleting and re-using code in Native Client.          */
-               if (old_thunk != vtable_trampoline && old_thunk != imt_trampoline)
-                       invalidate_generic_virtual_thunk (domain, old_thunk);
-#endif
+                       if (old_thunk != vtable_trampoline && old_thunk != imt_trampoline)
+                               num_freed ++;
+               }
        }
 
        mono_domain_unlock (domain);
@@ -2010,7 +1892,7 @@ mono_class_create_runtime_vtable (MonoDomain *domain, MonoClass *klass, MonoErro
                if (mono_class_has_failure (element_class)) {
                        /*Can happen if element_class only got bad after mono_class_setup_vtable*/
                        if (!mono_class_has_failure (klass))
-                               mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, NULL);
+                               mono_class_set_type_load_failure (klass, "");
                        mono_domain_unlock (domain);
                        mono_loader_unlock ();
                        mono_error_set_for_class_failure (error, klass);
@@ -2025,7 +1907,7 @@ mono_class_create_runtime_vtable (MonoDomain *domain, MonoClass *klass, MonoErro
        if (!klass->vtable_size)
                mono_class_setup_vtable (klass);
 
-       if (klass->generic_class && !klass->vtable)
+       if (mono_class_is_ginst (klass) && !klass->vtable)
                mono_class_check_vtable_constraints (klass, NULL);
 
        /* Initialize klass->has_finalize */
@@ -2322,7 +2204,8 @@ mono_class_proxy_vtable (MonoDomain *domain, MonoRemoteClass *remote_class, Mono
        MONO_REQ_GC_UNSAFE_MODE;
 
        MonoVTable *vt, *pvt;
-       int i, j, vtsize, max_interface_id, extra_interface_vtsize = 0;
+       int i, j, vtsize, extra_interface_vtsize = 0;
+       guint32 max_interface_id;
        MonoClass *k;
        GSList *extra_interfaces = NULL;
        MonoClass *klass = remote_class->proxy_class;
@@ -2410,7 +2293,7 @@ mono_class_proxy_vtable (MonoDomain *domain, MonoRemoteClass *remote_class, Mono
                        pvt->vtable [i] = NULL;
        }
 
-       if (klass->flags & TYPE_ATTRIBUTE_ABSTRACT) {
+       if (mono_class_is_abstract (klass)) {
                /* create trampolines for abstract methods */
                for (k = klass; k; k = k->parent) {
                        MonoMethod* m;
@@ -2568,7 +2451,7 @@ create_remote_class_key (MonoRemoteClass *remote_class, MonoClass *extra_class)
        int i, j;
        
        if (remote_class == NULL) {
-               if (extra_class->flags & TYPE_ATTRIBUTE_INTERFACE) {
+               if (mono_class_is_interface (extra_class)) {
                        key = (void **)g_malloc (sizeof(gpointer) * 3);
                        key [0] = GINT_TO_POINTER (2);
                        key [1] = mono_defaults.marshalbyrefobject_class;
@@ -2579,7 +2462,7 @@ create_remote_class_key (MonoRemoteClass *remote_class, MonoClass *extra_class)
                        key [1] = extra_class;
                }
        } else {
-               if (extra_class != NULL && (extra_class->flags & TYPE_ATTRIBUTE_INTERFACE)) {
+               if (extra_class != NULL && mono_class_is_interface (extra_class)) {
                        key = (void **)g_malloc (sizeof(gpointer) * (remote_class->interface_count + 3));
                        key [0] = GINT_TO_POINTER (remote_class->interface_count + 2);
                        key [1] = remote_class->proxy_class;
@@ -2668,7 +2551,7 @@ mono_remote_class (MonoDomain *domain, MonoString *class_name, MonoClass *proxy_
        g_free (key);
        key = mp_key;
 
-       if (proxy_class->flags & TYPE_ATTRIBUTE_INTERFACE) {
+       if (mono_class_is_interface (proxy_class)) {
                rc = (MonoRemoteClass *)mono_domain_alloc (domain, MONO_SIZEOF_REMOTE_CLASS + sizeof(MonoClass*));
                rc->interface_count = 1;
                rc->interfaces [0] = proxy_class;
@@ -2715,7 +2598,7 @@ clone_remote_class (MonoDomain *domain, MonoRemoteClass* remote_class, MonoClass
        g_free (key);
        key = mp_key;
 
-       if (extra_class->flags & TYPE_ATTRIBUTE_INTERFACE) {
+       if (mono_class_is_interface (extra_class)) {
                int i,j;
                rc = (MonoRemoteClass *)mono_domain_alloc (domain, MONO_SIZEOF_REMOTE_CLASS + sizeof(MonoClass*) * (remote_class->interface_count + 1));
                rc->proxy_class = remote_class->proxy_class;
@@ -2816,7 +2699,7 @@ mono_upgrade_remote_class (MonoDomain *domain, MonoObject *proxy_object, MonoCla
        tproxy = (MonoTransparentProxy*) proxy_object;
        remote_class = tproxy->remote_class;
        
-       if (klass->flags & TYPE_ATTRIBUTE_INTERFACE) {
+       if (mono_class_is_interface (klass)) {
                int i;
                redo_vtable = TRUE;
                for (i = 0; i < remote_class->interface_count && redo_vtable; i++)
@@ -2887,7 +2770,7 @@ mono_object_get_virtual_method (MonoObject *obj, MonoMethod *method)
 
        /* check method->slot is a valid index: perform isinstance? */
        if (method->slot != -1) {
-               if (method->klass->flags & TYPE_ATTRIBUTE_INTERFACE) {
+               if (mono_class_is_interface (method->klass)) {
                        if (!is_proxy) {
                                gboolean variance_used = FALSE;
                                int iface_offset = mono_class_interface_offset_with_variance (klass, method->klass, &variance_used);
@@ -3865,7 +3748,7 @@ mono_nullable_init (guint8 *buf, MonoObject *value, MonoClass *klass)
 
        MonoClass *param_class = klass->cast_class;
 
-       mono_class_setup_fields_locking (klass);
+       mono_class_setup_fields (klass);
        g_assert (klass->fields_inited);
                                
        g_assert (mono_class_from_mono_type (klass->fields [0].type) == param_class);
@@ -3899,7 +3782,7 @@ mono_nullable_box (guint8 *buf, MonoClass *klass, MonoError *error)
        mono_error_init (error);
        MonoClass *param_class = klass->cast_class;
 
-       mono_class_setup_fields_locking (klass);
+       mono_class_setup_fields (klass);
        g_assert (klass->fields_inited);
 
        g_assert (mono_class_from_mono_type (klass->fields [0].type) == param_class);
@@ -4660,10 +4543,13 @@ mono_unhandled_exception (MonoObject *exc)
        if (!current_appdomain_delegate && !root_appdomain_delegate) {
                mono_print_unhandled_exception (exc);
        } else {
+               /* unhandled exception callbacks must not be aborted */
+               mono_threads_begin_abort_protected_block ();
                if (root_appdomain_delegate)
                        call_unhandled_exception_delegate (root_domain, root_appdomain_delegate, exc);
                if (current_appdomain_delegate)
                        call_unhandled_exception_delegate (current_domain, current_appdomain_delegate, exc);
+               mono_threads_end_abort_protected_block ();
        }
 
        /* set exitcode only if we will abort the process */
@@ -5574,7 +5460,7 @@ mono_class_get_allocation_ftn (MonoVTable *vtable, gboolean for_box, gboolean *p
 
        *pass_size_in_words = FALSE;
 
-       if (mono_class_has_finalizer (vtable->klass) || mono_class_is_marshalbyref (vtable->klass) || (mono_profiler_get_events () & MONO_PROFILE_ALLOCATIONS))
+       if (mono_class_has_finalizer (vtable->klass) || mono_class_is_marshalbyref (vtable->klass))
                return ves_icall_object_new_specific;
 
        if (vtable->gc_descr != MONO_GC_DESCRIPTOR_NULL) {
@@ -5939,7 +5825,7 @@ mono_array_new_full_checked (MonoDomain *domain, MonoClass *array_class, uintptr
                o = (MonoObject *)mono_gc_alloc_vector (vtable, byte_len, len);
 
        if (G_UNLIKELY (!o)) {
-               mono_error_set_out_of_memory (error, "Could not allocate %i bytes", byte_len);
+               mono_error_set_out_of_memory (error, "Could not allocate %zd bytes", (gsize) byte_len);
                return NULL;
        }
 
@@ -6053,7 +5939,7 @@ mono_array_new_specific_checked (MonoVTable *vtable, uintptr_t n, MonoError *err
        o = (MonoObject *)mono_gc_alloc_vector (vtable, byte_len, n);
 
        if (G_UNLIKELY (!o)) {
-               mono_error_set_out_of_memory (error, "Could not allocate %i bytes", byte_len);
+               mono_error_set_out_of_memory (error, "Could not allocate %zd bytes", (gsize) byte_len);
                return NULL;
        }
 
@@ -6211,7 +6097,7 @@ mono_string_new_size_checked (MonoDomain *domain, gint32 len, MonoError *error)
        s = (MonoString *)mono_gc_alloc_string (vtable, size, len);
 
        if (G_UNLIKELY (!s)) {
-               mono_error_set_out_of_memory (error, "Could not allocate %i bytes", size);
+               mono_error_set_out_of_memory (error, "Could not allocate %zd bytes", size);
                return NULL;
        }
 
@@ -6604,7 +6490,7 @@ mono_object_isinst_checked (MonoObject *obj, MonoClass *klass, MonoError *error)
        if (!klass->inited)
                mono_class_init (klass);
 
-       if (mono_class_is_marshalbyref (klass) || (klass->flags & TYPE_ATTRIBUTE_INTERFACE)) {
+       if (mono_class_is_marshalbyref (klass) || mono_class_is_interface (klass)) {
                result = mono_object_isinst_mbyref_checked (obj, klass, error);
                return result;
        }
@@ -6640,7 +6526,7 @@ mono_object_isinst_mbyref_checked (MonoObject *obj, MonoClass *klass, MonoError
 
        vt = obj->vtable;
        
-       if (klass->flags & TYPE_ATTRIBUTE_INTERFACE) {
+       if (mono_class_is_interface (klass)) {
                if (MONO_VTABLE_IMPLEMENTS_INTERFACE (vt, klass->interface_id)) {
                        return obj;
                }
@@ -7533,14 +7419,16 @@ ves_icall_System_Runtime_Remoting_Messaging_AsyncResult_Invoke (MonoAsyncResult
 
                ac->msg->exc = NULL;
 
-               MonoError invoke_error;
-               res = mono_message_invoke (ares->async_delegate, ac->msg, &ac->msg->exc, &ac->out_args, &invoke_error);
+               res = mono_message_invoke (ares->async_delegate, ac->msg, &ac->msg->exc, &ac->out_args, &error);
+
+               /* The exit side of the invoke must not be aborted as it would leave the runtime in an undefined state */
+               mono_threads_begin_abort_protected_block ();
 
                if (!ac->msg->exc) {
-                       MonoException *ex = mono_error_convert_to_exception (&invoke_error);
+                       MonoException *ex = mono_error_convert_to_exception (&error);
                        ac->msg->exc = (MonoObject *)ex;
                } else {
-                       mono_error_cleanup (&invoke_error);
+                       mono_error_cleanup (&error);
                }
 
                MONO_OBJECT_SETREF (ac, res, res);
@@ -7552,13 +7440,16 @@ ves_icall_System_Runtime_Remoting_Messaging_AsyncResult_Invoke (MonoAsyncResult
                mono_monitor_exit ((MonoObject*) ares);
 
                if (wait_event != NULL)
-                       SetEvent (wait_event);
+                       mono_w32event_set (wait_event);
 
-               if (ac->cb_method) {
+               mono_error_init (&error); //the else branch would leave it in an undefined state
+               if (ac->cb_method)
                        mono_runtime_invoke_checked (ac->cb_method, ac->cb_target, (gpointer*) &ares, &error);
-                       if (mono_error_set_pending_exception (&error))
-                               return NULL;
-               }
+
+               mono_threads_end_abort_protected_block ();
+
+               if (mono_error_set_pending_exception (&error))
+                       return NULL;
        }
 
        return res;
@@ -7809,6 +7700,15 @@ mono_object_try_to_string (MonoObject *obj, MonoObject **exc, MonoError *error)
 
 
 
+static char *
+get_native_backtrace (MonoException *exc_raw)
+{
+       HANDLE_FUNCTION_ENTER ();
+       MONO_HANDLE_DCL(MonoException, exc);
+       char * trace = mono_exception_handle_get_native_backtrace (exc);
+       HANDLE_FUNCTION_RETURN_VAL (trace);
+}
+
 /**
  * mono_print_unhandled_exception:
  * @exc: The exception
@@ -7834,7 +7734,7 @@ mono_print_unhandled_exception (MonoObject *exc)
        } else {
                
                if (((MonoException*)exc)->native_trace_ips) {
-                       message = mono_exception_get_native_backtrace ((MonoException*)exc);
+                       message = get_native_backtrace ((MonoException*)exc);
                        free_message = TRUE;
                } else {
                        MonoObject *other_exc = NULL;
@@ -7955,7 +7855,7 @@ mono_delegate_ctor (MonoObject *this_obj, MonoObject *target, gpointer addr, Mon
                ji = mono_jit_info_table_find (mono_get_root_domain (), (char *)mono_get_addr_from_ftnptr (addr));
        if (ji) {
                method = mono_jit_info_get_method (ji);
-               g_assert (!method->klass->generic_container);
+               g_assert (!mono_class_is_gtd (method->klass));
        }
 
        return mono_delegate_ctor_with_method (this_obj, target, addr, method, error);
diff --git a/mono/metadata/process.c b/mono/metadata/process.c
deleted file mode 100644 (file)
index 8178d28..0000000
+++ /dev/null
@@ -1,940 +0,0 @@
-/*
- * process.c: System.Diagnostics.Process support
- *
- * Author:
- *     Dick Porter (dick@ximian.com)
- *
- * Copyright 2002 Ximian, Inc.
- * Copyright 2002-2006 Novell, Inc.
- * Licensed under the MIT license. See LICENSE file in the project root for full license information.
- */
-
-#include <config.h>
-
-#include <glib.h>
-#include <string.h>
-
-#include <mono/metadata/object-internals.h>
-#include <mono/metadata/process.h>
-#include <mono/metadata/assembly.h>
-#include <mono/metadata/appdomain.h>
-#include <mono/metadata/image.h>
-#include <mono/metadata/cil-coff.h>
-#include <mono/metadata/exception.h>
-#include <mono/metadata/threadpool-ms-io.h>
-#include <mono/utils/strenc.h>
-#include <mono/utils/mono-proclib.h>
-#include <mono/io-layer/io-layer.h>
-/* FIXME: fix this code to not depend so much on the internals */
-#include <mono/metadata/class-internals.h>
-#include <mono/utils/w32handle.h>
-
-#define LOGDEBUG(...)  
-/* define LOGDEBUG(...) g_message(__VA_ARGS__)  */
-
-#ifdef _WIN32
-#include <shellapi.h>
-#endif
-
-HANDLE
-ves_icall_System_Diagnostics_Process_GetProcess_internal (guint32 pid)
-{
-       HANDLE handle;
-       
-       /* GetCurrentProcess returns a pseudo-handle, so use
-        * OpenProcess instead
-        */
-       handle = OpenProcess (PROCESS_ALL_ACCESS, TRUE, pid);
-       if (handle == NULL)
-               /* FIXME: Throw an exception */
-               return NULL;
-       return handle;
-}
-
-static MonoImage *system_assembly;
-
-static void
-stash_system_assembly (MonoObject *obj)
-{
-       if (!system_assembly)
-               system_assembly = obj->vtable->klass->image;
-}
-
-//Hand coded version that loads from system
-static MonoClass*
-mono_class_get_file_version_info_class (void)
-{
-       static MonoClass *tmp_class;
-       MonoClass *klass = tmp_class;
-       if (!klass) {
-               klass = mono_class_load_from_name (system_assembly, "System.Diagnostics", "FileVersionInfo");
-               mono_memory_barrier ();
-               tmp_class = klass;
-       }
-       return klass;
-}
-
-static MonoClass*
-mono_class_get_process_module_class (void)
-{
-       static MonoClass *tmp_class;
-       MonoClass *klass = tmp_class;
-       if (!klass) {
-               klass = mono_class_load_from_name (system_assembly, "System.Diagnostics", "ProcessModule");
-               mono_memory_barrier ();
-               tmp_class = klass;
-       }
-       return klass;
-}
-
-static guint32
-unicode_chars (const gunichar2 *str)
-{
-       guint32 len;
-
-       for (len = 0; str [len] != '\0'; ++len)
-               ;
-       return len;
-}
-
-static void
-process_set_field_object (MonoObject *obj, const gchar *fieldname,
-                                                 MonoObject *data)
-{
-       MonoClassField *field;
-
-       LOGDEBUG (g_message ("%s: Setting field %s to object at %p", __func__, fieldname, data));
-
-       field = mono_class_get_field_from_name (mono_object_class (obj),
-                                                                                       fieldname);
-       mono_gc_wbarrier_generic_store (((char *)obj) + field->offset, data);
-}
-
-static void
-process_set_field_string (MonoObject *obj, const gchar *fieldname,
-                                                 const gunichar2 *val, guint32 len, MonoError *error)
-{
-       MonoClassField *field;
-       MonoString *string;
-
-       mono_error_init (error);
-
-       LOGDEBUG (g_message ("%s: Setting field %s to [%s]", __func__, fieldname, g_utf16_to_utf8 (val, len, NULL, NULL, NULL)));
-
-       string = mono_string_new_utf16_checked (mono_object_domain (obj), val, len, error);
-       
-       field = mono_class_get_field_from_name (mono_object_class (obj),
-                                                                                       fieldname);
-       mono_gc_wbarrier_generic_store (((char *)obj) + field->offset, (MonoObject*)string);
-}
-
-static void
-process_set_field_string_char (MonoObject *obj, const gchar *fieldname,
-                                                          const gchar *val)
-{
-       MonoClassField *field;
-       MonoString *string;
-
-       LOGDEBUG (g_message ("%s: Setting field %s to [%s]", __func__, fieldname, val));
-
-       string = mono_string_new (mono_object_domain (obj), val);
-       
-       field = mono_class_get_field_from_name (mono_object_class (obj), fieldname);
-       mono_gc_wbarrier_generic_store (((char *)obj) + field->offset, (MonoObject*)string);
-}
-
-static void
-process_set_field_int (MonoObject *obj, const gchar *fieldname,
-                                          guint32 val)
-{
-       MonoClassField *field;
-
-       LOGDEBUG (g_message ("%s: Setting field %s to %d", __func__,fieldname, val));
-       
-       field = mono_class_get_field_from_name (mono_object_class (obj),
-                                             fieldname);
-       *(guint32 *)(((char *)obj) + field->offset)=val;
-}
-
-static void
-process_set_field_intptr (MonoObject *obj, const gchar *fieldname,
-                                                 gpointer val)
-{
-       MonoClassField *field;
-
-       LOGDEBUG (g_message ("%s: Setting field %s to %p", __func__, fieldname, val));
-       
-       field = mono_class_get_field_from_name (mono_object_class (obj),
-                                                                                       fieldname);
-       *(gpointer *)(((char *)obj) + field->offset) = val;
-}
-
-static void
-process_set_field_bool (MonoObject *obj, const gchar *fieldname,
-                                               gboolean val)
-{
-       MonoClassField *field;
-
-       LOGDEBUG (g_message ("%s: Setting field %s to %s", __func__, fieldname, val ? "TRUE":"FALSE"));
-       
-       field = mono_class_get_field_from_name (mono_object_class (obj),
-                                                                                       fieldname);
-       *(guint8 *)(((char *)obj) + field->offset) = val;
-}
-
-#define SFI_COMMENTS           "\\StringFileInfo\\%02X%02X%02X%02X\\Comments"
-#define SFI_COMPANYNAME                "\\StringFileInfo\\%02X%02X%02X%02X\\CompanyName"
-#define SFI_FILEDESCRIPTION    "\\StringFileInfo\\%02X%02X%02X%02X\\FileDescription"
-#define SFI_FILEVERSION                "\\StringFileInfo\\%02X%02X%02X%02X\\FileVersion"
-#define SFI_INTERNALNAME       "\\StringFileInfo\\%02X%02X%02X%02X\\InternalName"
-#define SFI_LEGALCOPYRIGHT     "\\StringFileInfo\\%02X%02X%02X%02X\\LegalCopyright"
-#define SFI_LEGALTRADEMARKS    "\\StringFileInfo\\%02X%02X%02X%02X\\LegalTrademarks"
-#define SFI_ORIGINALFILENAME   "\\StringFileInfo\\%02X%02X%02X%02X\\OriginalFilename"
-#define SFI_PRIVATEBUILD       "\\StringFileInfo\\%02X%02X%02X%02X\\PrivateBuild"
-#define SFI_PRODUCTNAME                "\\StringFileInfo\\%02X%02X%02X%02X\\ProductName"
-#define SFI_PRODUCTVERSION     "\\StringFileInfo\\%02X%02X%02X%02X\\ProductVersion"
-#define SFI_SPECIALBUILD       "\\StringFileInfo\\%02X%02X%02X%02X\\SpecialBuild"
-#define EMPTY_STRING           (gunichar2*)"\000\000"
-
-static void
-process_module_string_read (MonoObject *filever, gpointer data,
-                                                       const gchar *fieldname,
-                                                       guchar lang_hi, guchar lang_lo,
-                                                       const gchar *key, MonoError *error)
-{
-       gchar *lang_key_utf8;
-       gunichar2 *lang_key, *buffer;
-       UINT chars;
-
-       mono_error_init (error);
-
-       lang_key_utf8 = g_strdup_printf (key, lang_lo, lang_hi, 0x04, 0xb0);
-
-       LOGDEBUG (g_message ("%s: asking for [%s]", __func__, lang_key_utf8));
-
-       lang_key = g_utf8_to_utf16 (lang_key_utf8, -1, NULL, NULL, NULL);
-
-       if (VerQueryValue (data, lang_key, (gpointer *)&buffer, &chars) && chars > 0) {
-               LOGDEBUG (g_message ("%s: found %d chars of [%s]", __func__, chars, g_utf16_to_utf8 (buffer, chars, NULL, NULL, NULL)));
-               /* chars includes trailing null */
-               process_set_field_string (filever, fieldname, buffer, chars - 1, error);
-       } else {
-               process_set_field_string (filever, fieldname, EMPTY_STRING, 0, error);
-       }
-
-       g_free (lang_key);
-       g_free (lang_key_utf8);
-}
-
-typedef struct {
-       const char *name;
-       const char *id;
-} StringTableEntry;
-
-static StringTableEntry stringtable_entries [] = {
-       { "comments", SFI_COMMENTS },
-       { "companyname", SFI_COMPANYNAME },
-       { "filedescription", SFI_FILEDESCRIPTION },
-       { "fileversion", SFI_FILEVERSION },
-       { "internalname", SFI_INTERNALNAME },
-       { "legalcopyright", SFI_LEGALCOPYRIGHT },
-       { "legaltrademarks", SFI_LEGALTRADEMARKS },
-       { "originalfilename", SFI_ORIGINALFILENAME },
-       { "privatebuild", SFI_PRIVATEBUILD },
-       { "productname", SFI_PRODUCTNAME },
-       { "productversion", SFI_PRODUCTVERSION },
-       { "specialbuild", SFI_SPECIALBUILD }
-};
-
-static void
-process_module_stringtable (MonoObject *filever, gpointer data,
-                                                       guchar lang_hi, guchar lang_lo, MonoError *error)
-{
-       int i;
-
-       for (i = 0; i < G_N_ELEMENTS (stringtable_entries); ++i) {
-               process_module_string_read (filever, data, stringtable_entries [i].name, lang_hi, lang_lo,
-                                                                       stringtable_entries [i].id, error);
-               return_if_nok (error);
-       }
-}
-
-static void
-process_get_fileversion (MonoObject *filever, gunichar2 *filename, MonoError *error)
-{
-       DWORD verinfohandle;
-       VS_FIXEDFILEINFO *ffi;
-       gpointer data;
-       DWORD datalen;
-       guchar *trans_data;
-       gunichar2 *query;
-       UINT ffi_size, trans_size;
-       BOOL ok;
-       gunichar2 lang_buf[128];
-       guint32 lang, lang_count;
-
-       mono_error_init (error);
-
-       datalen = GetFileVersionInfoSize (filename, &verinfohandle);
-       if (datalen) {
-               data = g_malloc0 (datalen);
-               ok = GetFileVersionInfo (filename, verinfohandle, datalen,
-                                        data);
-               if (ok) {
-                       query = g_utf8_to_utf16 ("\\", -1, NULL, NULL, NULL);
-                       if (query == NULL) {
-                               g_free (data);
-                               return;
-                       }
-                       
-                       if (VerQueryValue (data, query, (gpointer *)&ffi,
-                           &ffi_size)) {
-                               LOGDEBUG (g_message ("%s: recording assembly: FileName [%s] FileVersionInfo [%d.%d.%d.%d]", __func__, g_utf16_to_utf8 (filename, -1, NULL, NULL, NULL), HIWORD (ffi->dwFileVersionMS), LOWORD (ffi->dwFileVersionMS), HIWORD (ffi->dwFileVersionLS), LOWORD (ffi->dwFileVersionLS)));
-       
-                               process_set_field_int (filever, "filemajorpart", HIWORD (ffi->dwFileVersionMS));
-                               process_set_field_int (filever, "fileminorpart", LOWORD (ffi->dwFileVersionMS));
-                               process_set_field_int (filever, "filebuildpart", HIWORD (ffi->dwFileVersionLS));
-                               process_set_field_int (filever, "fileprivatepart", LOWORD (ffi->dwFileVersionLS));
-
-                               process_set_field_int (filever, "productmajorpart", HIWORD (ffi->dwProductVersionMS));
-                               process_set_field_int (filever, "productminorpart", LOWORD (ffi->dwProductVersionMS));
-                               process_set_field_int (filever, "productbuildpart", HIWORD (ffi->dwProductVersionLS));
-                               process_set_field_int (filever, "productprivatepart", LOWORD (ffi->dwProductVersionLS));
-
-                               process_set_field_bool (filever, "isdebug", ((ffi->dwFileFlags & ffi->dwFileFlagsMask) & VS_FF_DEBUG) != 0);
-                               process_set_field_bool (filever, "isprerelease", ((ffi->dwFileFlags & ffi->dwFileFlagsMask) & VS_FF_PRERELEASE) != 0);
-                               process_set_field_bool (filever, "ispatched", ((ffi->dwFileFlags & ffi->dwFileFlagsMask) & VS_FF_PATCHED) != 0);
-                               process_set_field_bool (filever, "isprivatebuild", ((ffi->dwFileFlags & ffi->dwFileFlagsMask) & VS_FF_PRIVATEBUILD) != 0);
-                               process_set_field_bool (filever, "isspecialbuild", ((ffi->dwFileFlags & ffi->dwFileFlagsMask) & VS_FF_SPECIALBUILD) != 0);
-                       }
-                       g_free (query);
-
-                       query = g_utf8_to_utf16 ("\\VarFileInfo\\Translation", -1, NULL, NULL, NULL);
-                       if (query == NULL) {
-                               g_free (data);
-                               return;
-                       }
-                       
-                       if (VerQueryValue (data, query,
-                                          (gpointer *)&trans_data,
-                                          &trans_size)) {
-                               /* use the first language ID we see
-                                */
-                               if (trans_size >= 4) {
-                                       LOGDEBUG (g_message("%s: %s has 0x%0x 0x%0x 0x%0x 0x%0x", __func__, g_utf16_to_utf8 (filename, -1, NULL, NULL, NULL), trans_data[0], trans_data[1], trans_data[2], trans_data[3]));
-                                       lang = (trans_data[0]) |
-                                               (trans_data[1] << 8) |
-                                               (trans_data[2] << 16) |
-                                               (trans_data[3] << 24);
-                                       /* Only give the lower 16 bits
-                                        * to VerLanguageName, as
-                                        * Windows gets confused
-                                        * otherwise
-                                        */
-                                       lang_count = VerLanguageName (lang & 0xFFFF, lang_buf, 128);
-                                       if (lang_count) {
-                                               process_set_field_string (filever, "language", lang_buf, lang_count, error);
-                                               return_if_nok (error);
-                                       }
-                                       process_module_stringtable (filever, data, trans_data[0], trans_data[1], error);
-                                       return_if_nok (error);
-                               }
-                       } else {
-                               int i;
-
-                               for (i = 0; i < G_N_ELEMENTS (stringtable_entries); ++i) {
-                                       /* No strings, so set every field to
-                                        * the empty string
-                                        */
-                                       process_set_field_string (filever,
-                                                                                         stringtable_entries [i].name,
-                                                                                         EMPTY_STRING, 0, error);
-                                       return_if_nok (error);
-                               }
-
-                               /* And language seems to be set to
-                                * en_US according to bug 374600
-                                */
-                               lang_count = VerLanguageName (0x0409, lang_buf, 128);
-                               if (lang_count) {
-                                       process_set_field_string (filever, "language", lang_buf, lang_count, error);
-                                       return_if_nok (error);
-                               }
-                       }
-                       
-                       g_free (query);
-               }
-               g_free (data);
-       }
-}
-
-static void
-process_get_assembly_fileversion (MonoObject *filever, MonoAssembly *assembly)
-{
-       process_set_field_int (filever, "filemajorpart", assembly->aname.major);
-       process_set_field_int (filever, "fileminorpart", assembly->aname.minor);
-       process_set_field_int (filever, "filebuildpart", assembly->aname.build);
-}
-
-static MonoObject*
-get_process_module (MonoAssembly *assembly, MonoClass *proc_class, MonoError *error)
-{
-       MonoObject *item, *filever;
-       MonoDomain *domain = mono_domain_get ();
-       char *filename;
-       const char *modulename = assembly->aname.name;
-
-       mono_error_init (error);
-
-       /* Build a System.Diagnostics.ProcessModule with the data.
-        */
-       item = mono_object_new_checked (domain, proc_class, error);
-       return_val_if_nok (error, NULL);
-       filever = mono_object_new_checked (domain, mono_class_get_file_version_info_class (), error);
-       return_val_if_nok (error, NULL);
-
-       filename = g_strdup_printf ("[In Memory] %s", modulename);
-
-       process_get_assembly_fileversion (filever, assembly);
-       process_set_field_string_char (filever, "filename", filename);
-       process_set_field_object (item, "version_info", filever);
-
-       process_set_field_intptr (item, "baseaddr", assembly->image->raw_data);
-       process_set_field_int (item, "memory_size", assembly->image->raw_data_len);
-       process_set_field_string_char (item, "filename", filename);
-       process_set_field_string_char (item, "modulename", modulename);
-
-       g_free (filename);
-
-       return item;
-}
-
-static MonoObject*
-process_add_module (HANDLE process, HMODULE mod, gunichar2 *filename, gunichar2 *modulename, MonoClass *proc_class, MonoError *error)
-{
-       MonoObject *item, *filever;
-       MonoDomain *domain = mono_domain_get ();
-       MODULEINFO modinfo;
-       BOOL ok;
-
-       mono_error_init (error);
-
-       /* Build a System.Diagnostics.ProcessModule with the data.
-        */
-       item = mono_object_new_checked (domain, proc_class, error);
-       return_val_if_nok (error, NULL);
-       filever = mono_object_new_checked (domain, mono_class_get_file_version_info_class (), error);
-       return_val_if_nok (error, NULL);
-
-       process_get_fileversion (filever, filename, error);
-       return_val_if_nok (error, NULL);
-
-       process_set_field_string (filever, "filename", filename,
-                                                         unicode_chars (filename), error);
-       return_val_if_nok (error, NULL);
-       ok = GetModuleInformation (process, mod, &modinfo, sizeof(MODULEINFO));
-       if (ok) {
-               process_set_field_intptr (item, "baseaddr",
-                                         modinfo.lpBaseOfDll);
-               process_set_field_intptr (item, "entryaddr",
-                                         modinfo.EntryPoint);
-               process_set_field_int (item, "memory_size",
-                                      modinfo.SizeOfImage);
-       }
-       process_set_field_string (item, "filename", filename,
-                                                         unicode_chars (filename), error);
-       return_val_if_nok (error, NULL);
-       process_set_field_string (item, "modulename", modulename,
-                                                         unicode_chars (modulename), error);
-       return_val_if_nok (error, NULL);
-       process_set_field_object (item, "version_info", filever);
-
-       return item;
-}
-
-static GPtrArray*
-get_domain_assemblies (MonoDomain *domain)
-{
-       GSList *tmp;
-       GPtrArray *assemblies;
-
-       /* 
-        * Make a copy of the list of assemblies because we can't hold the assemblies
-        * lock while creating objects etc.
-        */
-       assemblies = g_ptr_array_new ();
-       mono_domain_assemblies_lock (domain);
-       for (tmp = domain->domain_assemblies; tmp; tmp = tmp->next) {
-               MonoAssembly *ass = (MonoAssembly *)tmp->data;
-               if (ass->image->fileio_used)
-                       continue;
-               g_ptr_array_add (assemblies, ass);
-       }
-       mono_domain_assemblies_unlock (domain);
-
-       return assemblies;
-}
-
-/* Returns an array of System.Diagnostics.ProcessModule */
-MonoArray *
-ves_icall_System_Diagnostics_Process_GetModules_internal (MonoObject *this_obj, HANDLE process)
-{
-       MonoError error;
-       MonoArray *temp_arr = NULL;
-       MonoArray *arr;
-       HMODULE mods[1024];
-       gunichar2 filename[MAX_PATH];
-       gunichar2 modname[MAX_PATH];
-       DWORD needed;
-       guint32 count = 0, module_count = 0, assembly_count = 0;
-       guint32 i, num_added = 0;
-       GPtrArray *assemblies = NULL;
-       static HANDLE current_process = 0;
-       
-       if (current_process == 0) {
-               int pid = mono_process_current_pid ();
-               current_process = ves_icall_System_Diagnostics_Process_GetProcess_internal (pid);
-       }
-
-       stash_system_assembly (this_obj);
-
-       if (process == current_process) {
-               assemblies = get_domain_assemblies (mono_domain_get ());
-               assembly_count = assemblies->len;
-       }
-
-       if (EnumProcessModules (process, mods, sizeof(mods), &needed)) {
-               module_count += needed / sizeof(HMODULE);
-       }
-
-       count = module_count + assembly_count; 
-       temp_arr = mono_array_new_checked (mono_domain_get (), mono_class_get_process_module_class (), count, &error);
-       if (mono_error_set_pending_exception (&error))
-               return NULL;
-
-       for (i = 0; i < module_count; i++) {
-               if (GetModuleBaseName (process, mods[i], modname, MAX_PATH) &&
-                               GetModuleFileNameEx (process, mods[i], filename, MAX_PATH)) {
-                       MonoObject *module = process_add_module (process, mods[i],
-                                                                                                        filename, modname, mono_class_get_process_module_class (), &error);
-                       if (!mono_error_ok (&error)) {
-                               mono_error_set_pending_exception (&error);
-                               return NULL;
-                       }
-                       mono_array_setref (temp_arr, num_added++, module);
-               }
-       }
-
-       if (assemblies) {
-               for (i = 0; i < assembly_count; i++) {
-                       MonoAssembly *ass = (MonoAssembly *)g_ptr_array_index (assemblies, i);
-                       MonoObject *module = get_process_module (ass, mono_class_get_process_module_class (), &error);
-                       if (!mono_error_ok (&error)) {
-                               mono_error_set_pending_exception (&error);
-                               return NULL;
-                       }
-                       mono_array_setref (temp_arr, num_added++, module);
-               }
-               g_ptr_array_free (assemblies, TRUE);
-       }
-
-       if (count == num_added) {
-               arr = temp_arr;
-       } else {
-               /* shorter version of the array */
-               arr = mono_array_new_checked (mono_domain_get (), mono_class_get_process_module_class (), num_added, &error);
-               if (mono_error_set_pending_exception (&error))
-                       return NULL;
-
-               for (i = 0; i < num_added; i++)
-                       mono_array_setref (arr, i, mono_array_get (temp_arr, MonoObject*, i));
-       }
-
-       return arr;
-}
-
-void
-ves_icall_System_Diagnostics_FileVersionInfo_GetVersionInfo_internal (MonoObject *this_obj, MonoString *filename)
-{
-       MonoError error;
-
-       stash_system_assembly (this_obj);
-       
-       process_get_fileversion (this_obj, mono_string_chars (filename), &error);
-       if (!mono_error_ok (&error)) {
-               mono_error_set_pending_exception (&error);
-               return;
-       }
-       process_set_field_string (this_obj, "filename",
-                                                         mono_string_chars (filename),
-                                                         mono_string_length (filename), &error);
-       if (!mono_error_ok (&error)) {
-               mono_error_set_pending_exception (&error);
-               return;
-       }
-}
-
-/* Only used when UseShellExecute is false */
-static gchar *
-quote_path (const gchar *path)
-{
-       gchar *res = g_shell_quote (path);
-#ifdef TARGET_WIN32
-       {
-       gchar *q = res;
-       while (*q) {
-               if (*q == '\'')
-                       *q = '\"';
-               q++;
-       }
-       }
-#endif
-       return res;
-}
-
-/* Only used when UseShellExecute is false */
-static gboolean
-complete_path (const gunichar2 *appname, gchar **completed)
-{
-       gchar *utf8app, *utf8appmemory;
-       gchar *found;
-
-       utf8appmemory = utf8app = g_utf16_to_utf8 (appname, -1, NULL, NULL, NULL);
-#ifdef TARGET_WIN32 // Should this happen on all platforms? 
-       {
-               // remove the quotes around utf8app.
-               size_t len;
-               len = strlen (utf8app);
-               if (len) {
-                       if (utf8app[len-1] == '\"')
-                               utf8app[len-1] = '\0';
-                       if (utf8app[0] == '\"')
-                               utf8app++;
-               }
-       }
-#endif
-
-       if (g_path_is_absolute (utf8app)) {
-               *completed = quote_path (utf8app);
-               g_free (utf8appmemory);
-               return TRUE;
-       }
-
-       if (g_file_test (utf8app, G_FILE_TEST_IS_EXECUTABLE) && !g_file_test (utf8app, G_FILE_TEST_IS_DIR)) {
-               *completed = quote_path (utf8app);
-               g_free (utf8appmemory);
-               return TRUE;
-       }
-       
-       found = g_find_program_in_path (utf8app);
-       if (found == NULL) {
-               *completed = NULL;
-               g_free (utf8appmemory);
-               return FALSE;
-       }
-
-       *completed = quote_path (found);
-       g_free (found);
-       g_free (utf8appmemory);
-       return TRUE;
-}
-
-MonoBoolean
-ves_icall_System_Diagnostics_Process_ShellExecuteEx_internal (MonoProcessStartInfo *proc_start_info, MonoProcInfo *process_info)
-{
-       SHELLEXECUTEINFO shellex = {0};
-       gboolean ret;
-
-       shellex.cbSize = sizeof(SHELLEXECUTEINFO);
-       shellex.fMask = (gulong)(SEE_MASK_FLAG_DDEWAIT | SEE_MASK_NOCLOSEPROCESS | SEE_MASK_UNICODE);
-       shellex.nShow = (gulong)proc_start_info->window_style;
-       shellex.nShow = (gulong)((shellex.nShow == 0) ? 1 : (shellex.nShow == 1 ? 0 : shellex.nShow));
-
-       if (proc_start_info->filename != NULL) {
-               shellex.lpFile = mono_string_chars (proc_start_info->filename);
-       }
-
-       if (proc_start_info->arguments != NULL) {
-               shellex.lpParameters = mono_string_chars (proc_start_info->arguments);
-       }
-
-       if (proc_start_info->verb != NULL &&
-           mono_string_length (proc_start_info->verb) != 0) {
-               shellex.lpVerb = mono_string_chars (proc_start_info->verb);
-       }
-
-       if (proc_start_info->working_directory != NULL &&
-           mono_string_length (proc_start_info->working_directory) != 0) {
-               shellex.lpDirectory = mono_string_chars (proc_start_info->working_directory);
-       }
-
-       if (proc_start_info->error_dialog) {    
-               shellex.hwnd = proc_start_info->error_dialog_parent_handle;
-       } else {
-               shellex.fMask = (gulong)(shellex.fMask | SEE_MASK_FLAG_NO_UI);
-       }
-
-       ret = ShellExecuteEx (&shellex);
-       if (ret == FALSE) {
-               process_info->pid = -GetLastError ();
-       } else {
-               process_info->process_handle = shellex.hProcess;
-               process_info->thread_handle = NULL;
-#if !defined(MONO_CROSS_COMPILE)
-               process_info->pid = GetProcessId (shellex.hProcess);
-#else
-               process_info->pid = 0;
-#endif
-               process_info->tid = 0;
-       }
-
-       return ret;
-}
-
-MonoBoolean
-ves_icall_System_Diagnostics_Process_CreateProcess_internal (MonoProcessStartInfo *proc_start_info, HANDLE stdin_handle, HANDLE stdout_handle, HANDLE stderr_handle, MonoProcInfo *process_info)
-{
-       MonoError error G_GNUC_UNUSED;
-       gboolean ret;
-       gunichar2 *dir;
-       STARTUPINFO startinfo={0};
-       PROCESS_INFORMATION procinfo;
-       gunichar2 *shell_path = NULL;
-       gchar *env_vars = NULL;
-       gboolean free_shell_path = TRUE;
-       gchar *spath = NULL;
-       MonoString *cmd = proc_start_info->arguments;
-       guint32 creation_flags, logon_flags;
-       
-       startinfo.cb = sizeof(STARTUPINFO);
-       startinfo.dwFlags = STARTF_USESTDHANDLES;
-       startinfo.hStdInput = stdin_handle;
-       startinfo.hStdOutput = stdout_handle;
-       startinfo.hStdError = stderr_handle;
-
-       creation_flags = CREATE_UNICODE_ENVIRONMENT;
-       if (proc_start_info->create_no_window)
-               creation_flags |= CREATE_NO_WINDOW;
-       
-       shell_path = mono_string_chars (proc_start_info->filename);
-       complete_path (shell_path, &spath);
-       if (spath == NULL) {
-               process_info->pid = -ERROR_FILE_NOT_FOUND;
-               return FALSE;
-       }
-#ifdef TARGET_WIN32
-       /* Seems like our CreateProcess does not work as the windows one.
-        * This hack is needed to deal with paths containing spaces */
-       shell_path = NULL;
-       free_shell_path = FALSE;
-       if (cmd) {
-               gchar *newcmd, *tmp;
-               tmp = mono_string_to_utf8_checked (cmd, &error);
-               if (mono_error_set_pending_exception (&error)) {
-                       g_free (spath);
-                       return NULL;
-               }
-               newcmd = g_strdup_printf ("%s %s", spath, tmp);
-               cmd = mono_string_new_wrapper (newcmd);
-               g_free (tmp);
-               g_free (newcmd);
-       }
-       else {
-               cmd = mono_string_new_wrapper (spath);
-       }
-#else
-       shell_path = g_utf8_to_utf16 (spath, -1, NULL, NULL, NULL);
-#endif
-       g_free (spath);
-
-       if (process_info->env_keys) {
-               gint i, len; 
-               MonoString *ms;
-               MonoString *key, *value;
-               gunichar2 *str, *ptr;
-               gunichar2 *equals16;
-
-               for (len = 0, i = 0; i < mono_array_length (process_info->env_keys); i++) {
-                       ms = mono_array_get (process_info->env_values, MonoString *, i);
-                       if (ms == NULL)
-                               continue;
-
-                       len += mono_string_length (ms) * sizeof (gunichar2);
-                       ms = mono_array_get (process_info->env_keys, MonoString *, i);
-                       len += mono_string_length (ms) * sizeof (gunichar2);
-                       len += 2 * sizeof (gunichar2);
-               }
-
-               equals16 = g_utf8_to_utf16 ("=", 1, NULL, NULL, NULL);
-               ptr = str = g_new0 (gunichar2, len + 1);
-               for (i = 0; i < mono_array_length (process_info->env_keys); i++) {
-                       value = mono_array_get (process_info->env_values, MonoString *, i);
-                       if (value == NULL)
-                               continue;
-
-                       key = mono_array_get (process_info->env_keys, MonoString *, i);
-                       memcpy (ptr, mono_string_chars (key), mono_string_length (key) * sizeof (gunichar2));
-                       ptr += mono_string_length (key);
-
-                       memcpy (ptr, equals16, sizeof (gunichar2));
-                       ptr++;
-
-                       memcpy (ptr, mono_string_chars (value), mono_string_length (value) * sizeof (gunichar2));
-                       ptr += mono_string_length (value);
-                       ptr++;
-               }
-
-               g_free (equals16);
-               env_vars = (gchar *) str;
-       }
-       
-       /* The default dir name is "".  Turn that into NULL to mean
-        * "current directory"
-        */
-       if (proc_start_info->working_directory == NULL || mono_string_length (proc_start_info->working_directory) == 0)
-               dir = NULL;
-       else
-               dir = mono_string_chars (proc_start_info->working_directory);
-
-       if (process_info->username) {
-               logon_flags = process_info->load_user_profile ? LOGON_WITH_PROFILE : 0;
-               ret = CreateProcessWithLogonW (
-                       mono_string_chars (process_info->username),
-                       process_info->domain ? mono_string_chars (process_info->domain) : NULL,
-                       (const gunichar2 *)process_info->password, logon_flags, shell_path,
-                       cmd ? mono_string_chars (cmd) : NULL,
-                       creation_flags, env_vars, dir, &startinfo, &procinfo);
-       } else {
-               ret = CreateProcess (shell_path, cmd ? mono_string_chars (cmd): NULL, NULL, NULL, TRUE, creation_flags, env_vars, dir, &startinfo, &procinfo);
-       }
-
-       g_free (env_vars);
-       if (free_shell_path)
-               g_free (shell_path);
-
-       if (ret) {
-               process_info->process_handle = procinfo.hProcess;
-               /*process_info->thread_handle=procinfo.hThread;*/
-               process_info->thread_handle = NULL;
-               if (procinfo.hThread != NULL && procinfo.hThread != INVALID_HANDLE_VALUE)
-                       CloseHandle (procinfo.hThread);
-               process_info->pid = procinfo.dwProcessId;
-               process_info->tid = procinfo.dwThreadId;
-       } else {
-               process_info->pid = -GetLastError ();
-       }
-       
-       return ret;
-}
-
-MonoString *
-ves_icall_System_Diagnostics_Process_ProcessName_internal (HANDLE process)
-{
-       MonoError error;
-       MonoString *string;
-       gboolean ok;
-       HMODULE mod;
-       gunichar2 name[MAX_PATH];
-       DWORD needed;
-       guint32 len;
-       
-       ok = EnumProcessModules (process, &mod, sizeof(mod), &needed);
-       if (!ok)
-               return NULL;
-       
-       len = GetModuleBaseName (process, mod, name, MAX_PATH);
-       if (len == 0)
-               return NULL;
-       
-       LOGDEBUG (g_message ("%s: process name is [%s]", __func__, g_utf16_to_utf8 (name, -1, NULL, NULL, NULL)));
-       
-       string = mono_string_new_utf16_checked (mono_domain_get (), name, len, &error);
-       if (!mono_error_ok (&error))
-               mono_error_set_pending_exception (&error);
-       
-       return string;
-}
-
-/* Returns an array of pids */
-MonoArray *
-ves_icall_System_Diagnostics_Process_GetProcesses_internal (void)
-{
-#if !defined(HOST_WIN32)
-       MonoError error;
-       MonoArray *procs;
-       gpointer *pidarray;
-       int i, count;
-
-       pidarray = mono_process_list (&count);
-       if (!pidarray) {
-               mono_set_pending_exception (mono_get_exception_not_supported ("This system does not support EnumProcesses"));
-               return NULL;
-       }
-       procs = mono_array_new_checked (mono_domain_get (), mono_get_int32_class (), count, &error);
-       if (mono_error_set_pending_exception (&error)) {
-               g_free (pidarray);
-               return NULL;
-       }
-       if (sizeof (guint32) == sizeof (gpointer)) {
-               memcpy (mono_array_addr (procs, guint32, 0), pidarray, count * sizeof (gint32));
-       } else {
-               for (i = 0; i < count; ++i)
-                       *(mono_array_addr (procs, guint32, i)) = GPOINTER_TO_UINT (pidarray [i]);
-       }
-       g_free (pidarray);
-
-       return procs;
-#else
-       MonoError error;
-       MonoArray *procs;
-       gboolean ret;
-       DWORD needed;
-       int count;
-       guint32 *pids;
-
-       count = 512;
-       do {
-               pids = g_new0 (guint32, count);
-               ret = EnumProcesses (pids, count * sizeof (guint32), &needed);
-               if (ret == FALSE) {
-                       MonoException *exc;
-
-                       g_free (pids);
-                       pids = NULL;
-                       exc = mono_get_exception_not_supported ("This system does not support EnumProcesses");
-                       mono_set_pending_exception (exc);
-                       return NULL;
-               }
-               if (needed < (count * sizeof (guint32)))
-                       break;
-               g_free (pids);
-               pids = NULL;
-               count = (count * 3) / 2;
-       } while (TRUE);
-
-       count = needed / sizeof (guint32);
-       procs = mono_array_new_checked (mono_domain_get (), mono_get_int32_class (), count, &error);
-       if (mono_error_set_pending_exception (&error)) {
-               g_free (pids);
-               return NULL;
-       }
-
-       memcpy (mono_array_addr (procs, guint32, 0), pids, needed);
-       g_free (pids);
-       pids = NULL;
-       
-       return procs;
-#endif
-}
-
-gint64
-ves_icall_System_Diagnostics_Process_GetProcessData (int pid, gint32 data_type, gint32 *error)
-{
-       MonoProcessError perror;
-       guint64 res;
-
-       res = mono_process_get_data_with_error (GINT_TO_POINTER (pid), (MonoProcessData)data_type, &perror);
-       if (error)
-               *error = perror;
-       return res;
-}
diff --git a/mono/metadata/process.h b/mono/metadata/process.h
deleted file mode 100644 (file)
index bad2095..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * process.h: System.Diagnostics.Process support
- *
- * Author:
- *     Dick Porter (dick@ximian.com)
- *
- * (C) 2002 Ximian, Inc.
- */
-
-#ifndef _MONO_METADATA_PROCESS_H_
-#define _MONO_METADATA_PROCESS_H_
-
-#include <config.h>
-#include <glib.h>
-
-#include <mono/metadata/object.h>
-#include <mono/io-layer/io-layer.h>
-#include "mono/utils/mono-compiler.h"
-
-typedef struct 
-{
-       HANDLE process_handle;
-       HANDLE thread_handle;
-       guint32 pid; /* Contains GetLastError () on failure */
-       guint32 tid;
-       MonoArray *env_keys;
-       MonoArray *env_values;
-       MonoString *username;
-       MonoString *domain;
-       gpointer password; /* BSTR from SecureString in 2.0 profile */
-       MonoBoolean load_user_profile;
-} MonoProcInfo;
-
-typedef struct
-{
-       MonoObject object;
-       MonoString *filename;
-       MonoString *arguments;
-       MonoString *working_directory;
-       MonoString *verb;
-       guint32 window_style;
-       MonoBoolean error_dialog;
-       gpointer error_dialog_parent_handle;
-       MonoBoolean use_shell_execute;
-       MonoString *username;
-       MonoString *domain;
-       MonoObject *password; /* SecureString in 2.0 profile, dummy in 1.x */
-       MonoString *password_in_clear_text;
-       MonoBoolean load_user_profile;
-       MonoBoolean redirect_standard_input;
-       MonoBoolean redirect_standard_output;
-       MonoBoolean redirect_standard_error;
-       MonoObject *encoding_stdout;
-       MonoObject *encoding_stderr;
-       MonoBoolean create_no_window;
-       MonoObject *weak_parent_process;
-       MonoObject *envVars;
-} MonoProcessStartInfo;
-
-G_BEGIN_DECLS
-
-HANDLE ves_icall_System_Diagnostics_Process_GetProcess_internal (guint32 pid);
-MonoArray *ves_icall_System_Diagnostics_Process_GetProcesses_internal (void);
-MonoArray *ves_icall_System_Diagnostics_Process_GetModules_internal (MonoObject *this_obj, HANDLE process);
-void ves_icall_System_Diagnostics_FileVersionInfo_GetVersionInfo_internal (MonoObject *this_obj, MonoString *filename);
-MonoBoolean ves_icall_System_Diagnostics_Process_ShellExecuteEx_internal (MonoProcessStartInfo *proc_start_info, MonoProcInfo *process_handle);
-MonoBoolean ves_icall_System_Diagnostics_Process_CreateProcess_internal (MonoProcessStartInfo *proc_start_info, HANDLE stdin_handle, HANDLE stdout_handle, HANDLE stderr_handle, MonoProcInfo *process_handle);
-MonoString *ves_icall_System_Diagnostics_Process_ProcessName_internal (HANDLE process);
-gint64 ves_icall_System_Diagnostics_Process_GetProcessData (int pid, gint32 data_type, gint32 *error);
-
-G_END_DECLS
-
-#endif /* _MONO_METADATA_PROCESS_H_ */
-
index 5888b90fca925bdcfd35082990fa52a0fa83fb4d..1bf80e2c867a41e775e7b2ebb3ba1da5794d2f5f 100644 (file)
@@ -75,6 +75,11 @@ void mono_profiler_gc_moves       (void **objects, int num);
 void mono_profiler_gc_handle      (int op, int type, uintptr_t handle, MonoObject *obj);
 void mono_profiler_gc_roots       (int num, void **objects, int *root_types, uintptr_t *extra_info);
 
+void mono_profiler_gc_finalize_begin (void);
+void mono_profiler_gc_finalize_object_begin (MonoObject *obj);
+void mono_profiler_gc_finalize_object_end (MonoObject *obj);
+void mono_profiler_gc_finalize_end (void);
+
 void mono_profiler_code_chunk_new (gpointer chunk, int size);
 void mono_profiler_code_chunk_destroy (gpointer chunk);
 void mono_profiler_code_buffer_new (gpointer buffer, int size, MonoProfilerCodeBufferType type, gconstpointer data);
index 4920694b731f928265424c78bfa730b5238bd7aa..0fd162dd98a86884d77a104587973a79cd5549a0 100644 (file)
@@ -102,6 +102,11 @@ struct _ProfilerDesc {
        MonoProfileGCHandleFunc  gc_handle;
        MonoProfileGCRootFunc    gc_roots;
 
+       MonoProfileGCFinalizeFunc gc_finalize_begin;
+       MonoProfileGCFinalizeObjectFunc gc_finalize_object_begin;
+       MonoProfileGCFinalizeObjectFunc gc_finalize_object_end;
+       MonoProfileGCFinalizeFunc gc_finalize_end;
+
        MonoProfileFunc          runtime_initialized_event;
 
        MonoProfilerCodeChunkNew code_chunk_new;
@@ -268,7 +273,6 @@ mono_profiler_install_transition (MonoProfileMethodResult callback)
 void 
 mono_profiler_install_allocation (MonoProfileAllocFunc callback)
 {
-       mono_gc_enable_alloc_events ();
        if (!prof_list)
                return;
        prof_list->allocation_cb = callback;
@@ -871,7 +875,6 @@ mono_profiler_gc_roots (int num, void **objects, int *root_types, uintptr_t *ext
 void
 mono_profiler_install_gc (MonoProfileGCFunc callback, MonoProfileGCResizeFunc heap_resize_callback)
 {
-       mono_gc_enable_events ();
        if (!prof_list)
                return;
        prof_list->gc_event = callback;
@@ -925,6 +928,50 @@ mono_profiler_install_gc_roots (MonoProfileGCHandleFunc handle_callback, MonoPro
        prof_list->gc_roots = roots_callback;
 }
 
+void
+mono_profiler_gc_finalize_begin (void)
+{
+       for (ProfilerDesc *prof = prof_list; prof; prof = prof->next)
+               if ((prof->events & MONO_PROFILE_GC_FINALIZATION) && prof->gc_finalize_begin)
+                       prof->gc_finalize_begin (prof->profiler);
+}
+
+void
+mono_profiler_gc_finalize_object_begin (MonoObject *obj)
+{
+       for (ProfilerDesc *prof = prof_list; prof; prof = prof->next)
+               if ((prof->events & MONO_PROFILE_GC_FINALIZATION) && prof->gc_finalize_object_begin)
+                       prof->gc_finalize_object_begin (prof->profiler, obj);
+}
+
+void
+mono_profiler_gc_finalize_object_end (MonoObject *obj)
+{
+       for (ProfilerDesc *prof = prof_list; prof; prof = prof->next)
+               if ((prof->events & MONO_PROFILE_GC_FINALIZATION) && prof->gc_finalize_object_end)
+                       prof->gc_finalize_object_end (prof->profiler, obj);
+}
+
+void
+mono_profiler_gc_finalize_end (void)
+{
+       for (ProfilerDesc *prof = prof_list; prof; prof = prof->next)
+               if ((prof->events & MONO_PROFILE_GC_FINALIZATION) && prof->gc_finalize_end)
+                       prof->gc_finalize_end (prof->profiler);
+}
+
+void
+mono_profiler_install_gc_finalize (MonoProfileGCFinalizeFunc begin, MonoProfileGCFinalizeObjectFunc begin_obj, MonoProfileGCFinalizeObjectFunc end_obj, MonoProfileGCFinalizeFunc end)
+{
+       if (!prof_list)
+               return;
+
+       prof_list->gc_finalize_begin = begin;
+       prof_list->gc_finalize_object_begin = begin_obj;
+       prof_list->gc_finalize_object_end = end_obj;
+       prof_list->gc_finalize_end = end;
+}
+
 void
 mono_profiler_install_runtime_initialized (MonoProfileFunc runtime_initialized_callback)
 {
index b793548ef8fbd98782f7975b1b08ffd0d0a3634d..84dc1bb83b1bca0dbdf7309649757483a5fbe593 100644 (file)
@@ -31,7 +31,8 @@ typedef enum {
        MONO_PROFILE_IOMAP_EVENTS     = 1 << 18, /* this should likely be removed, too */
        MONO_PROFILE_GC_MOVES         = 1 << 19,
        MONO_PROFILE_GC_ROOTS         = 1 << 20,
-       MONO_PROFILE_CONTEXT_EVENTS   = 1 << 21
+       MONO_PROFILE_CONTEXT_EVENTS   = 1 << 21,
+       MONO_PROFILE_GC_FINALIZATION  = 1 << 22
 } MonoProfileFlags;
 
 typedef enum {
@@ -39,6 +40,7 @@ typedef enum {
        MONO_PROFILE_FAILED
 } MonoProfileResult;
 
+// Keep somewhat in sync with libgc/include/gc.h:enum GC_EventType
 typedef enum {
        MONO_GC_EVENT_START,
        MONO_GC_EVENT_MARK_START,
@@ -46,10 +48,26 @@ typedef enum {
        MONO_GC_EVENT_RECLAIM_START,
        MONO_GC_EVENT_RECLAIM_END,
        MONO_GC_EVENT_END,
+       /*
+        * This is the actual arrival order of the following events:
+        *
+        * MONO_GC_EVENT_PRE_STOP_WORLD
+        * MONO_GC_EVENT_PRE_STOP_WORLD_LOCKED
+        * MONO_GC_EVENT_POST_STOP_WORLD
+        * MONO_GC_EVENT_PRE_START_WORLD
+        * MONO_GC_EVENT_POST_START_WORLD_UNLOCKED
+        * MONO_GC_EVENT_POST_START_WORLD
+        *
+        * The LOCKED and UNLOCKED events guarantee that, by the time they arrive,
+        * the GC and suspend locks will both have been acquired and released,
+        * respectively.
+        */
        MONO_GC_EVENT_PRE_STOP_WORLD,
        MONO_GC_EVENT_POST_STOP_WORLD,
        MONO_GC_EVENT_PRE_START_WORLD,
-       MONO_GC_EVENT_POST_START_WORLD
+       MONO_GC_EVENT_POST_START_WORLD,
+       MONO_GC_EVENT_PRE_STOP_WORLD_LOCKED,
+       MONO_GC_EVENT_POST_START_WORLD_UNLOCKED
 } MonoGCEvent;
 
 /* coverage info */
@@ -150,6 +168,9 @@ typedef void (*MonoProfileGCResizeFunc)   (MonoProfiler *prof, int64_t new_size)
 typedef void (*MonoProfileGCHandleFunc)   (MonoProfiler *prof, int op, int type, uintptr_t handle, MonoObject *obj);
 typedef void (*MonoProfileGCRootFunc)     (MonoProfiler *prof, int num_roots, void **objects, int *root_types, uintptr_t *extra_info);
 
+typedef void (*MonoProfileGCFinalizeFunc)  (MonoProfiler *prof);
+typedef void (*MonoProfileGCFinalizeObjectFunc) (MonoProfiler *prof, MonoObject *obj);
+
 typedef void (*MonoProfileIomapFunc) (MonoProfiler *prof, const char *report, const char *pathname, const char *new_pathname);
 
 typedef mono_bool (*MonoProfileCoverageFilterFunc)   (MonoProfiler *prof, MonoMethod *method);
@@ -197,6 +218,7 @@ MONO_API void mono_profiler_coverage_get  (MonoProfiler *prof, MonoMethod *metho
 MONO_API void mono_profiler_install_gc    (MonoProfileGCFunc callback, MonoProfileGCResizeFunc heap_resize_callback);
 MONO_API void mono_profiler_install_gc_moves    (MonoProfileGCMoveFunc callback);
 MONO_API void mono_profiler_install_gc_roots    (MonoProfileGCHandleFunc handle_callback, MonoProfileGCRootFunc roots_callback);
+MONO_API void mono_profiler_install_gc_finalize (MonoProfileGCFinalizeFunc begin, MonoProfileGCFinalizeObjectFunc begin_obj, MonoProfileGCFinalizeObjectFunc end_obj, MonoProfileGCFinalizeFunc end);
 MONO_API void mono_profiler_install_runtime_initialized (MonoProfileFunc runtime_initialized_callback);
 
 MONO_API void mono_profiler_install_code_chunk_new (MonoProfilerCodeChunkNew callback);
diff --git a/mono/metadata/property-bag.c b/mono/metadata/property-bag.c
new file mode 100644 (file)
index 0000000..28e8113
--- /dev/null
@@ -0,0 +1,49 @@
+
+/*
+ * property-bag.c: Linearizable property bag.
+ *
+ * Authors:
+ *   Rodrigo Kumpera (kumpera@gmail.com)
+ *
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
+ */
+#include <mono/metadata/property-bag.h>
+#include <mono/utils/atomic.h>
+#include <mono/utils/mono-membar.h>
+
+void*
+mono_property_bag_get (MonoPropertyBag *bag, int tag)
+{
+       MonoPropertyBagItem *item;
+       
+       for (item = bag->head; item && item->tag <= tag; item = item->next) {
+               if (item->tag == tag)
+                       return item;
+       }
+       return NULL;
+}
+
+void*
+mono_property_bag_add (MonoPropertyBag *bag, void *value)
+{
+       MonoPropertyBagItem *cur, **prev, *item = value;
+       int tag = item->tag;
+       mono_memory_barrier (); //publish the values in value
+
+retry:
+       prev = &bag->head;
+       while (1) {
+               cur = *prev;
+               if (!cur || cur->tag > tag) {
+                       item->next = cur;
+                       if (InterlockedCompareExchangePointer ((void*)prev, item, cur) == cur)
+                               return item;
+                       goto retry;
+               } else if (cur->tag == tag) {
+                       return cur;
+               } else {
+                       prev = &cur->next;
+               }
+       }
+       return value;
+}
diff --git a/mono/metadata/property-bag.h b/mono/metadata/property-bag.h
new file mode 100644 (file)
index 0000000..8f3f0ee
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * property-bag.h: Linearizable property bag.
+ *
+ * Authors:
+ *   Rodrigo Kumpera (kumpera@gmail.com)
+ *
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
+ */
+#ifndef __MONO_METADATA_PROPERTY_BAG_H__
+#define __MONO_METADATA_PROPERTY_BAG_H__
+
+#include <mono/utils/mono-compiler.h>
+
+typedef struct _MonoPropertyBagItem MonoPropertyBagItem;
+
+struct _MonoPropertyBagItem {
+       MonoPropertyBagItem *next;
+       int tag;
+};
+
+typedef struct {
+       MonoPropertyBagItem *head;
+} MonoPropertyBag;
+
+void* mono_property_bag_get (MonoPropertyBag *bag, int tag);
+void* mono_property_bag_add (MonoPropertyBag *bag, void *value);
+
+#endif
diff --git a/mono/metadata/reflection-cache.h b/mono/metadata/reflection-cache.h
new file mode 100644 (file)
index 0000000..ec4d722
--- /dev/null
@@ -0,0 +1,80 @@
+/* 
+ * Copyright 2016 Microsoft
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
+ */
+#ifndef __MONO_METADATA_REFLECTION_CACHE_H__
+#define __MONO_METADATA_REFLECTION_CACHE_H__
+
+#include <glib.h>
+#include <mono/metadata/domain-internals.h>
+#include <mono/metadata/mono-hash.h>
+#include <mono/metadata/mempool.h>
+
+/*
+ * We need to return always the same object for MethodInfo, FieldInfo etc..
+ * but we need to consider the reflected type.
+ * type uses a different hash, since it uses custom hash/equal functions.
+ */
+
+typedef struct {
+       gpointer item;
+       MonoClass *refclass;
+} ReflectedEntry;
+
+gboolean
+reflected_equal (gconstpointer a, gconstpointer b);
+
+guint
+reflected_hash (gconstpointer a);
+
+#ifdef HAVE_BOEHM_GC
+/* ReflectedEntry doesn't need to be GC tracked */
+#define ALLOC_REFENTRY g_new0 (ReflectedEntry, 1)
+#define FREE_REFENTRY(entry) g_free ((entry))
+#define REFENTRY_REQUIRES_CLEANUP
+#else
+#define ALLOC_REFENTRY (ReflectedEntry *)mono_mempool_alloc (domain->mp, sizeof (ReflectedEntry))
+/* FIXME: */
+#define FREE_REFENTRY(entry)
+#endif
+
+
+#define CACHE_OBJECT(t,p,o,k)  \
+       do {    \
+               t _obj; \
+        ReflectedEntry pe; \
+        pe.item = (p); \
+        pe.refclass = (k); \
+        mono_domain_lock (domain); \
+               if (!domain->refobject_hash)    \
+                       domain->refobject_hash = mono_g_hash_table_new_type (reflected_hash, reflected_equal, MONO_HASH_VALUE_GC, MONO_ROOT_SOURCE_DOMAIN, "domain reflection objects table");  \
+        _obj = (t)mono_g_hash_table_lookup (domain->refobject_hash, &pe); \
+        if (!_obj) { \
+                   ReflectedEntry *e = ALLOC_REFENTRY;         \
+                   e->item = (p);      \
+                   e->refclass = (k);  \
+                   mono_g_hash_table_insert (domain->refobject_hash, e,o);     \
+            _obj = o; \
+        } \
+               mono_domain_unlock (domain);    \
+        return _obj; \
+       } while (0)
+
+#define CHECK_OBJECT(t,p,k)    \
+       do {    \
+               t _obj; \
+               ReflectedEntry e;       \
+               e.item = (p);   \
+               e.refclass = (k);       \
+               mono_domain_lock (domain);      \
+               if (!domain->refobject_hash)    \
+                       domain->refobject_hash = mono_g_hash_table_new_type (reflected_hash, reflected_equal, MONO_HASH_VALUE_GC, MONO_ROOT_SOURCE_DOMAIN, "domain reflection objects table");  \
+               if ((_obj = (t)mono_g_hash_table_lookup (domain->refobject_hash, &e))) {        \
+                       mono_domain_unlock (domain);    \
+                       return _obj;    \
+               }       \
+        mono_domain_unlock (domain); \
+       } while (0)
+
+
+#endif /*__MONO_METADATA_REFLECTION_CACHE_H__*/
index 327bb93142ce85d0579bf1bd8ae484a92e545331..85e757fbf5dbf85904bd7c00fcb4b71347c72e5d 100644 (file)
@@ -1,14 +1,23 @@
 /* 
  * Copyright 2014 Xamarin Inc
+ * Copyright 2016 Microsoft
  * Licensed under the MIT license. See LICENSE file in the project root for full license information.
  */
 #ifndef __MONO_METADATA_REFLECTION_INTERNALS_H__
 #define __MONO_METADATA_REFLECTION_INTERNALS_H__
 
+#include <mono/metadata/object-internals.h>
 #include <mono/metadata/reflection.h>
+#include <mono/metadata/class-internals.h>
 #include <mono/utils/mono-compiler.h>
 #include <mono/utils/mono-error.h>
 
+gboolean
+mono_reflection_is_usertype (MonoReflectionType *ref);
+
+MonoReflectionType*
+mono_reflection_type_resolve_user_types (MonoReflectionType *type, MonoError *error);
+
 MonoType*
 mono_reflection_get_type_checked (MonoImage *rootimage, MonoImage* image, MonoTypeNameParse *info, mono_bool ignorecase, mono_bool *type_resolve, MonoError *error);
 
@@ -32,13 +41,13 @@ MonoArray*
 mono_reflection_get_custom_attrs_blob_checked (MonoReflectionAssembly *assembly, MonoObject *ctor, MonoArray *ctorArgs, MonoArray *properties, MonoArray *propValues, MonoArray *fields, MonoArray* fieldValues, MonoError *error);
 
 MonoCustomAttrInfo*
-mono_custom_attrs_from_index_checked    (MonoImage *image, uint32_t idx, MonoError *error);
+mono_custom_attrs_from_index_checked    (MonoImage *image, uint32_t idx, gboolean ignore_missing, MonoError *error);
 MonoCustomAttrInfo*
 mono_custom_attrs_from_method_checked   (MonoMethod *method, MonoError *error);
 MonoCustomAttrInfo*
 mono_custom_attrs_from_class_checked           (MonoClass *klass, MonoError *error);
 MonoCustomAttrInfo*
-mono_custom_attrs_from_assembly_checked        (MonoAssembly *assembly, MonoError *error);
+mono_custom_attrs_from_assembly_checked        (MonoAssembly *assembly, gboolean ignore_missing, MonoError *error);
 MonoCustomAttrInfo*
 mono_custom_attrs_from_property_checked        (MonoClass *klass, MonoProperty *property, MonoError *error);
 MonoCustomAttrInfo*
@@ -82,5 +91,8 @@ mono_module_file_get_object_checked (MonoDomain *domain, MonoImage *image, int t
 MonoReflectionMethodBody*
 mono_method_body_get_object_checked (MonoDomain *domain, MonoMethod *method, MonoError *error);
 
+MonoClass *
+mono_class_from_mono_type_handle (MonoReflectionTypeHandle h);
+
 
 #endif /* __MONO_METADATA_REFLECTION_INTERNALS_H__ */
index d87d51d41d675d5469a36acc0ba96b5a178e08de..c0c334a0f23e3b0671c51336e7144180378d7774 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * reflection.c: Routines for creating an image at runtime.
+ * reflection.c: System.Type icalls and related reflection queries.
  * 
  * Author:
  *   Paolo Molaro (lupus@ximian.com)
@@ -7,11 +7,11 @@
  * Copyright 2001-2003 Ximian, Inc (http://www.ximian.com)
  * Copyright 2004-2009 Novell, Inc (http://www.novell.com)
  * Copyright 2011 Rodrigo Kumpera
+ * Copyright 2016 Microsoft
  *
  * Licensed under the MIT license. See LICENSE file in the project root for full license information.
  */
 #include <config.h>
-#include "mono/utils/mono-digest.h"
 #include "mono/utils/mono-membar.h"
 #include "mono/metadata/reflection-internals.h"
 #include "mono/metadata/tabledefs.h"
@@ -19,7 +19,6 @@
 #include <mono/metadata/profiler-private.h>
 #include "mono/metadata/class-internals.h"
 #include "mono/metadata/gc-internals.h"
-#include "mono/metadata/tokentype.h"
 #include "mono/metadata/domain-internals.h"
 #include "mono/metadata/opcodes.h"
 #include "mono/metadata/assembly.h"
@@ -27,6 +26,8 @@
 #include <mono/metadata/exception.h>
 #include <mono/metadata/marshal.h>
 #include <mono/metadata/security-manager.h>
+#include <mono/metadata/reflection-cache.h>
+#include <mono/metadata/sre-internals.h>
 #include <stdio.h>
 #include <glib.h>
 #include <errno.h>
 #include <mono/utils/mono-string.h>
 #include <mono/utils/mono-error-internals.h>
 #include <mono/utils/checked-build.h>
+#include <mono/utils/mono-counters.h>
 
-static gboolean is_usertype (MonoReflectionType *ref);
-static MonoReflectionType *mono_reflection_type_resolve_user_types (MonoReflectionType *type, MonoError *error);
-static gboolean mono_reflection_create_generic_class (MonoReflectionTypeBuilder *tb, MonoError *error);
-static void mono_image_module_basic_init (MonoReflectionModuleBuilder *module);
-
-typedef struct {
-       char *p;
-       char *buf;
-       char *end;
-} SigBuffer;
-
-#define TEXT_OFFSET 512
-#define CLI_H_SIZE 136
-#define FILE_ALIGN 512
-#define VIRT_ALIGN 8192
-#define START_TEXT_RVA  0x00002000
-
-typedef struct {
-       MonoReflectionILGen *ilgen;
-       MonoReflectionType *rtype;
-       MonoArray *parameters;
-       MonoArray *generic_params;
-       MonoGenericContainer *generic_container;
-       MonoArray *pinfo;
-       MonoArray *opt_types;
-       guint32 attrs;
-       guint32 iattrs;
-       guint32 call_conv;
-       guint32 *table_idx; /* note: it's a pointer */
-       MonoArray *code;
-       MonoObject *type;
-       MonoString *name;
-       MonoBoolean init_locals;
-       MonoBoolean skip_visibility;
-       MonoArray *return_modreq;
-       MonoArray *return_modopt;
-       MonoArray *param_modreq;
-       MonoArray *param_modopt;
-       MonoArray *permissions;
-       MonoMethod *mhandle;
-       guint32 nrefs;
-       gpointer *refs;
-       /* for PInvoke */
-       int charset, extra_flags, native_cc;
-       MonoString *dll, *dllentry;
-} ReflectionMethodBuilder;
-
-typedef struct {
-       guint32 owner;
-       MonoReflectionGenericParam *gparam;
-} GenericParamTableEntry;
-
-const unsigned char table_sizes [MONO_TABLE_NUM] = {
-       MONO_MODULE_SIZE,
-       MONO_TYPEREF_SIZE,
-       MONO_TYPEDEF_SIZE,
-       0,
-       MONO_FIELD_SIZE,
-       0,
-       MONO_METHOD_SIZE,
-       0,
-       MONO_PARAM_SIZE,
-       MONO_INTERFACEIMPL_SIZE,
-       MONO_MEMBERREF_SIZE,    /* 0x0A */
-       MONO_CONSTANT_SIZE,
-       MONO_CUSTOM_ATTR_SIZE,
-       MONO_FIELD_MARSHAL_SIZE,
-       MONO_DECL_SECURITY_SIZE,
-       MONO_CLASS_LAYOUT_SIZE,
-       MONO_FIELD_LAYOUT_SIZE, /* 0x10 */
-       MONO_STAND_ALONE_SIGNATURE_SIZE,
-       MONO_EVENT_MAP_SIZE,
-       0,
-       MONO_EVENT_SIZE,
-       MONO_PROPERTY_MAP_SIZE,
-       0,
-       MONO_PROPERTY_SIZE,
-       MONO_METHOD_SEMA_SIZE,
-       MONO_METHODIMPL_SIZE,
-       MONO_MODULEREF_SIZE,    /* 0x1A */
-       MONO_TYPESPEC_SIZE,
-       MONO_IMPLMAP_SIZE,      
-       MONO_FIELD_RVA_SIZE,
-       0,
-       0,
-       MONO_ASSEMBLY_SIZE,     /* 0x20 */
-       MONO_ASSEMBLY_PROCESSOR_SIZE,
-       MONO_ASSEMBLYOS_SIZE,
-       MONO_ASSEMBLYREF_SIZE,
-       MONO_ASSEMBLYREFPROC_SIZE,
-       MONO_ASSEMBLYREFOS_SIZE,
-       MONO_FILE_SIZE,
-       MONO_EXP_TYPE_SIZE,
-       MONO_MANIFEST_SIZE,
-       MONO_NESTED_CLASS_SIZE,
-
-       MONO_GENERICPARAM_SIZE, /* 0x2A */
-       MONO_METHODSPEC_SIZE,
-       MONO_GENPARCONSTRAINT_SIZE
-
-};
-
-#ifndef DISABLE_REFLECTION_EMIT
-static guint32 mono_image_get_methodref_token (MonoDynamicImage *assembly, MonoMethod *method, gboolean create_typespec);
-static guint32 mono_image_get_methodbuilder_token (MonoDynamicImage *assembly, MonoReflectionMethodBuilder *mb, gboolean create_open_instance, MonoError *error);
-static guint32 mono_image_get_ctorbuilder_token (MonoDynamicImage *assembly, MonoReflectionCtorBuilder *cb, MonoError *error);
-static guint32 mono_image_get_sighelper_token (MonoDynamicImage *assembly, MonoReflectionSigHelper *helper, MonoError *error);
-static gboolean ensure_runtime_vtable (MonoClass *klass, MonoError  *error);
-static gpointer resolve_object (MonoImage *image, MonoObject *obj, MonoClass **handle_class, MonoGenericContext *context, MonoError *error);
-static guint32 mono_image_get_methodref_token_for_methodbuilder (MonoDynamicImage *assembly, MonoReflectionMethodBuilder *method, MonoError *error);
-static guint32 encode_generic_method_sig (MonoDynamicImage *assembly, MonoGenericContext *context);
-static gpointer register_assembly (MonoDomain *domain, MonoReflectionAssembly *res, MonoAssembly *assembly);
-static gboolean reflection_methodbuilder_from_method_builder (ReflectionMethodBuilder *rmb, MonoReflectionMethodBuilder *mb, MonoError *error);
-static gboolean reflection_methodbuilder_from_ctor_builder (ReflectionMethodBuilder *rmb, MonoReflectionCtorBuilder *mb, MonoError *error);
-static guint32 create_generic_typespec (MonoDynamicImage *assembly, MonoReflectionTypeBuilder *tb, MonoError *error);
-#endif
-
-static guint32 mono_image_typedef_or_ref (MonoDynamicImage *assembly, MonoType *type);
-static guint32 mono_image_typedef_or_ref_full (MonoDynamicImage *assembly, MonoType *type, gboolean try_typespec);
-static void    mono_image_get_generic_param_info (MonoReflectionGenericParam *gparam, guint32 owner, MonoDynamicImage *assembly);
-static guint32 encode_marshal_blob (MonoDynamicImage *assembly, MonoReflectionMarshal *minfo, MonoError *error);
-static guint32 encode_constant (MonoDynamicImage *assembly, MonoObject *val, guint32 *ret_type);
-static char*   type_get_qualified_name (MonoType *type, MonoAssembly *ass);
-static void    encode_type (MonoDynamicImage *assembly, MonoType *type, SigBuffer *buf);
 static void get_default_param_value_blobs (MonoMethod *method, char **blobs, guint32 *types);
-static MonoReflectionType *mono_reflection_type_get_underlying_system_type (MonoReflectionType* t, MonoError *error);
 static MonoType* mono_reflection_get_type_with_rootimage (MonoImage *rootimage, MonoImage* image, MonoTypeNameParse *info, gboolean ignorecase, gboolean *type_resolve, MonoError *error);
-static MonoReflectionType* mono_reflection_type_resolve_user_types (MonoReflectionType *type, MonoError *error);
-static gboolean is_sre_array (MonoClass *klass);
-static gboolean is_sre_byref (MonoClass *klass);
-static gboolean is_sre_pointer (MonoClass *klass);
-static gboolean is_sre_type_builder (MonoClass *klass);
-static gboolean is_sre_method_builder (MonoClass *klass);
-static gboolean is_sre_ctor_builder (MonoClass *klass);
-static gboolean is_sre_field_builder (MonoClass *klass);
-static gboolean is_sr_mono_method (MonoClass *klass);
-static gboolean is_sr_mono_cmethod (MonoClass *klass);
-static gboolean is_sr_mono_generic_method (MonoClass *klass);
-static gboolean is_sr_mono_generic_cmethod (MonoClass *klass);
-static gboolean is_sr_mono_field (MonoClass *klass);
-static gboolean is_sr_mono_property (MonoClass *klass);
-static gboolean is_sre_method_on_tb_inst (MonoClass *klass);
-static gboolean is_sre_ctor_on_tb_inst (MonoClass *klass);
-
-static gboolean type_is_reference (MonoType *type);
-
-static guint32 mono_image_get_methodspec_token (MonoDynamicImage *assembly, MonoMethod *method);
-static guint32 mono_image_get_inflated_method_token (MonoDynamicImage *assembly, MonoMethod *m);
-static MonoMethod * inflate_method (MonoReflectionType *type, MonoObject *obj, MonoError *error);
-
-static guint32 create_typespec (MonoDynamicImage *assembly, MonoType *type);
-static void init_type_builder_generics (MonoObject *type, MonoError *error);
-
-#define RESOLVE_TYPE(type, error) do {                                 \
-       type = (MonoObject *)mono_reflection_type_resolve_user_types ((MonoReflectionType*)type, error); \
-} while (0)
-#define RESOLVE_ARRAY_TYPE_ELEMENT(array, index, error) do {           \
-       MonoReflectionType *__type = mono_array_get (array, MonoReflectionType*, index); \
-       __type = mono_reflection_type_resolve_user_types (__type, error); \
-       if (mono_error_ok (error))                                      \
-               mono_array_set (arr, MonoReflectionType*, index, __type); \
-} while (0)
-
-#define mono_type_array_get_and_resolve(array, index, error) mono_reflection_type_get_handle ((MonoReflectionType*)mono_array_get (array, gpointer, index), error)
-
-#define CHECK_ADD4_OVERFLOW_UN(a, b) ((guint32)(0xFFFFFFFFU) - (guint32)(b) < (guint32)(a))
-#define CHECK_ADD8_OVERFLOW_UN(a, b) ((guint64)(0xFFFFFFFFFFFFFFFFUL) - (guint64)(b) < (guint64)(a))
-
-#if SIZEOF_VOID_P == 4
-#define CHECK_ADDP_OVERFLOW_UN(a,b) CHECK_ADD4_OVERFLOW_UN(a, b)
-#else
-#define CHECK_ADDP_OVERFLOW_UN(a,b) CHECK_ADD8_OVERFLOW_UN(a, b)
-#endif
-
-#define ADDP_IS_GREATER_OR_OVF(a, b, c) (((a) + (b) > (c)) || CHECK_ADDP_OVERFLOW_UN (a, b))
-#define ADD_IS_GREATER_OR_OVF(a, b, c) (((a) + (b) > (c)) || CHECK_ADD4_OVERFLOW_UN (a, b))
 
 /* Class lazy loading functions */
 static GENERATE_GET_CLASS_WITH_CACHE (mono_assembly, System.Reflection, MonoAssembly)
 static GENERATE_GET_CLASS_WITH_CACHE (mono_module, System.Reflection, MonoModule)
-static GENERATE_GET_CLASS_WITH_CACHE (mono_generic_method, System.Reflection, MonoGenericMethod);
-static GENERATE_GET_CLASS_WITH_CACHE (mono_generic_cmethod, System.Reflection, MonoGenericCMethod);
 static GENERATE_GET_CLASS_WITH_CACHE (mono_method, System.Reflection, MonoMethod);
 static GENERATE_GET_CLASS_WITH_CACHE (mono_cmethod, System.Reflection, MonoCMethod);
 static GENERATE_GET_CLASS_WITH_CACHE (mono_field, System.Reflection, MonoField);
@@ -238,14222 +64,2215 @@ static GENERATE_GET_CLASS_WITH_CACHE (missing, System.Reflection, Missing);
 static GENERATE_GET_CLASS_WITH_CACHE (method_body, System.Reflection, MethodBody);
 static GENERATE_GET_CLASS_WITH_CACHE (local_variable_info, System.Reflection, LocalVariableInfo);
 static GENERATE_GET_CLASS_WITH_CACHE (exception_handling_clause, System.Reflection, ExceptionHandlingClause);
-static GENERATE_GET_CLASS_WITH_CACHE (custom_attribute_typed_argument, System.Reflection, CustomAttributeTypedArgument);
-static GENERATE_GET_CLASS_WITH_CACHE (custom_attribute_named_argument, System.Reflection, CustomAttributeNamedArgument);
 static GENERATE_GET_CLASS_WITH_CACHE (type_builder, System.Reflection.Emit, TypeBuilder);
-static GENERATE_GET_CLASS_WITH_CACHE (marshal_as_attribute, System.Runtime.InteropServices, MarshalAsAttribute);
 static GENERATE_GET_CLASS_WITH_CACHE (dbnull, System, DBNull);
 
-// The dynamic images list is only needed to support the mempool reference tracking feature in checked-build.
-static GPtrArray *dynamic_images;
-static mono_mutex_t dynamic_images_mutex;
-
-static inline void
-dynamic_images_lock (void)
-{
-       mono_os_mutex_lock (&dynamic_images_mutex);
-}
-
-static inline void
-dynamic_images_unlock (void)
-{
-       mono_os_mutex_unlock (&dynamic_images_mutex);
-}
-
-/**
- * mono_find_dynamic_image_owner:
- *
- * Find the dynamic image, if any, which a given pointer is located in the memory of.
- */
-MonoImage *
-mono_find_dynamic_image_owner (void *ptr)
-{
-       MonoImage *owner = NULL;
-       int i;
-
-       dynamic_images_lock ();
-
-       if (dynamic_images)
-       {
-               for (i = 0; !owner && i < dynamic_images->len; ++i) {
-                       MonoImage *image = (MonoImage *)g_ptr_array_index (dynamic_images, i);
-                       if (mono_mempool_contains_addr (image->mempool, ptr))
-                               owner = image;
-               }
-       }
-
-       dynamic_images_unlock ();
 
-       return owner;
-}
+static int class_ref_info_handle_count;
 
 void
 mono_reflection_init (void)
 {
-       mono_os_mutex_init (&dynamic_images_mutex);
-}
+       mono_reflection_emit_init ();
 
-static inline void
-dynamic_image_lock (MonoDynamicImage *image)
-{
-       MONO_ENTER_GC_SAFE;
-       mono_image_lock ((MonoImage*)image);
-       MONO_EXIT_GC_SAFE;
-}
+       mono_counters_register ("MonoClass::ref_info_handle count",
+                                                       MONO_COUNTER_METADATA | MONO_COUNTER_INT, &class_ref_info_handle_count);
 
-static inline void
-dynamic_image_unlock (MonoDynamicImage *image)
-{
-       mono_image_unlock ((MonoImage*)image);
 }
 
-static void
-register_dyn_token (MonoDynamicImage *assembly, guint32 token, MonoObject *obj)
+/*
+ * mono_class_get_ref_info:
+ *
+ *   Return the type builder/generic param builder corresponding to KLASS, if it exists.
+ */
+gpointer
+mono_class_get_ref_info (MonoClass *klass)
 {
        MONO_REQ_GC_UNSAFE_MODE;
+       guint32 ref_info_handle = mono_class_get_ref_info_handle (klass);
 
-       dynamic_image_lock (assembly);
-       mono_g_hash_table_insert (assembly->tokens, GUINT_TO_POINTER (token), obj);
-       dynamic_image_unlock (assembly);
+       if (ref_info_handle == 0)
+               return NULL;
+       else
+               return mono_gchandle_get_target (ref_info_handle);
 }
 
-static MonoObject*
-lookup_dyn_token (MonoDynamicImage *assembly, guint32 token)
+void
+mono_class_set_ref_info (MonoClass *klass, gpointer obj)
 {
        MONO_REQ_GC_UNSAFE_MODE;
 
-       MonoObject *obj;
-
-       dynamic_image_lock (assembly);
-       obj = (MonoObject *)mono_g_hash_table_lookup (assembly->tokens, GUINT_TO_POINTER (token));
-       dynamic_image_unlock (assembly);
+       guint32 candidate = mono_gchandle_new ((MonoObject*)obj, FALSE);
+       guint32 handle = mono_class_set_ref_info_handle (klass, candidate);
+       ++class_ref_info_handle_count;
 
-       return obj;
+       if (handle != candidate)
+               mono_gchandle_free (candidate);
 }
 
-static void
-sigbuffer_init (SigBuffer *buf, int size)
+void
+mono_class_free_ref_info (MonoClass *klass)
 {
        MONO_REQ_GC_NEUTRAL_MODE;
+       guint32 handle = mono_class_get_ref_info_handle (klass);
 
-       buf->buf = (char *)g_malloc (size);
-       buf->p = buf->buf;
-       buf->end = buf->buf + size;
+       if (handle) {
+               mono_gchandle_free (handle);
+               mono_class_set_ref_info_handle (klass, 0);
+       }
 }
 
-static void
-sigbuffer_make_room (SigBuffer *buf, int size)
+
+void
+mono_custom_attrs_free (MonoCustomAttrInfo *ainfo)
 {
        MONO_REQ_GC_NEUTRAL_MODE;
 
-       if (buf->end - buf->p < size) {
-               int new_size = buf->end - buf->buf + size + 32;
-               char *p = (char *)g_realloc (buf->buf, new_size);
-               size = buf->p - buf->buf;
-               buf->buf = p;
-               buf->p = p + size;
-               buf->end = buf->buf + new_size;
-       }
+       if (ainfo && !ainfo->cached)
+               g_free (ainfo);
 }
 
-static void
-sigbuffer_add_value (SigBuffer *buf, guint32 val)
+
+gboolean
+reflected_equal (gconstpointer a, gconstpointer b)
 {
-       MONO_REQ_GC_NEUTRAL_MODE;
+       const ReflectedEntry *ea = (const ReflectedEntry *)a;
+       const ReflectedEntry *eb = (const ReflectedEntry *)b;
 
-       sigbuffer_make_room (buf, 6);
-       mono_metadata_encode_value (val, buf->p, &buf->p);
+       return (ea->item == eb->item) && (ea->refclass == eb->refclass);
 }
 
-static void
-sigbuffer_add_byte (SigBuffer *buf, guint8 val)
-{
-       MONO_REQ_GC_NEUTRAL_MODE;
-
-       sigbuffer_make_room (buf, 1);
-       buf->p [0] = val;
-       buf->p++;
+guint
+reflected_hash (gconstpointer a) {
+       const ReflectedEntry *ea = (const ReflectedEntry *)a;
+       return mono_aligned_addr_hash (ea->item);
 }
 
+
 static void
-sigbuffer_add_mem (SigBuffer *buf, char *p, guint32 size)
+clear_cached_object (MonoDomain *domain, gpointer o, MonoClass *klass)
 {
-       MONO_REQ_GC_NEUTRAL_MODE;
+       mono_domain_lock (domain);
+       if (domain->refobject_hash) {
+        ReflectedEntry pe;
+               gpointer orig_pe, orig_value;
 
-       sigbuffer_make_room (buf, size);
-       memcpy (buf->p, p, size);
-       buf->p += size;
+               pe.item = o;
+               pe.refclass = klass;
+               if (mono_g_hash_table_lookup_extended (domain->refobject_hash, &pe, &orig_pe, &orig_value)) {
+                       mono_g_hash_table_remove (domain->refobject_hash, &pe);
+                       FREE_REFENTRY (orig_pe);
+               }
+       }
+       mono_domain_unlock (domain);
 }
 
+#ifdef REFENTRY_REQUIRES_CLEANUP
 static void
-sigbuffer_free (SigBuffer *buf)
+cleanup_refobject_hash (gpointer key, gpointer value, gpointer user_data)
 {
-       MONO_REQ_GC_NEUTRAL_MODE;
-
-       g_free (buf->buf);
+       FREE_REFENTRY (key);
 }
+#endif
 
-#ifndef DISABLE_REFLECTION_EMIT
-/**
- * mp_g_alloc:
- *
- * Allocate memory from the @image mempool if it is non-NULL. Otherwise, allocate memory
- * from the C heap.
- */
-static gpointer
-image_g_malloc (MonoImage *image, guint size)
+void
+mono_reflection_cleanup_domain (MonoDomain *domain)
 {
-       MONO_REQ_GC_NEUTRAL_MODE;
-
-       if (image)
-               return mono_image_alloc (image, size);
-       else
-               return g_malloc (size);
+       if (domain->refobject_hash) {
+/*let's avoid scanning the whole hashtable if not needed*/
+#ifdef REFENTRY_REQUIRES_CLEANUP
+               mono_g_hash_table_foreach (domain->refobject_hash, cleanup_refobject_hash, NULL);
+#endif
+               mono_g_hash_table_destroy (domain->refobject_hash);
+               domain->refobject_hash = NULL;
+       }
 }
-#endif /* !DISABLE_REFLECTION_EMIT */
 
-/**
- * image_g_alloc0:
+
+/*
+ * mono_assembly_get_object:
+ * @domain: an app domain
+ * @assembly: an assembly
  *
- * Allocate memory from the @image mempool if it is non-NULL. Otherwise, allocate memory
- * from the C heap.
+ * Return an System.Reflection.Assembly object representing the MonoAssembly @assembly.
  */
-static gpointer
-image_g_malloc0 (MonoImage *image, guint size)
+MonoReflectionAssembly*
+mono_assembly_get_object (MonoDomain *domain, MonoAssembly *assembly)
 {
-       MONO_REQ_GC_NEUTRAL_MODE;
-
-       if (image)
-               return mono_image_alloc0 (image, size);
-       else
-               return g_malloc0 (size);
+       MonoError error;
+       MonoReflectionAssembly *result;
+       result = mono_assembly_get_object_checked (domain, assembly, &error);
+       mono_error_cleanup (&error); /* FIXME new API that doesn't swallow the error */
+       return result;
 }
-
-/**
- * image_g_free:
- * @image: a MonoImage
- * @ptr: pointer
+/*
+ * mono_assembly_get_object_checked:
+ * @domain: an app domain
+ * @assembly: an assembly
  *
- * If @image is NULL, free @ptr, otherwise do nothing.
+ * Return an System.Reflection.Assembly object representing the MonoAssembly @assembly.
  */
-static void
-image_g_free (MonoImage *image, gpointer ptr)
+MonoReflectionAssembly*
+mono_assembly_get_object_checked (MonoDomain *domain, MonoAssembly *assembly, MonoError *error)
 {
-       if (image == NULL)
-               g_free (ptr);
-}
+       MonoReflectionAssembly *res;
+       
+       mono_error_init (error);
 
-#ifndef DISABLE_REFLECTION_EMIT
-static char*
-image_strdup (MonoImage *image, const char *s)
-{
-       MONO_REQ_GC_NEUTRAL_MODE;
+       CHECK_OBJECT (MonoReflectionAssembly *, assembly, NULL);
+       res = (MonoReflectionAssembly *)mono_object_new_checked (domain, mono_class_get_mono_assembly_class (), error);
+       if (!res)
+               return NULL;
+       res->assembly = assembly;
 
-       if (image)
-               return mono_image_strdup (image, s);
-       else
-               return g_strdup (s);
+       CACHE_OBJECT (MonoReflectionAssembly *, assembly, res, NULL);
 }
-#endif
-
-#define image_g_new(image,struct_type, n_structs)              \
-    ((struct_type *) image_g_malloc (image, ((gsize) sizeof (struct_type)) * ((gsize) (n_structs))))
 
-#define image_g_new0(image,struct_type, n_structs)             \
-    ((struct_type *) image_g_malloc0 (image, ((gsize) sizeof (struct_type)) * ((gsize) (n_structs))))
 
 
-static void
-alloc_table (MonoDynamicTable *table, guint nrows)
+MonoReflectionModule*   
+mono_module_get_object   (MonoDomain *domain, MonoImage *image)
 {
-       MONO_REQ_GC_NEUTRAL_MODE;
-
-       table->rows = nrows;
-       g_assert (table->columns);
-       if (nrows + 1 >= table->alloc_rows) {
-               while (nrows + 1 >= table->alloc_rows) {
-                       if (table->alloc_rows == 0)
-                               table->alloc_rows = 16;
-                       else
-                               table->alloc_rows *= 2;
-               }
-
-               table->values = (guint32 *)g_renew (guint32, table->values, (table->alloc_rows) * table->columns);
-       }
+       MonoError error;
+       MonoReflectionModule *result;
+       result = mono_module_get_object_checked (domain, image, &error);
+       mono_error_cleanup (&error);
+       return result;
 }
 
-static void
-make_room_in_stream (MonoDynamicStream *stream, int size)
+MonoReflectionModule*
+mono_module_get_object_checked (MonoDomain *domain, MonoImage *image, MonoError *error)
 {
-       MONO_REQ_GC_NEUTRAL_MODE;
-
-       if (size <= stream->alloc_size)
-               return;
-       
-       while (stream->alloc_size <= size) {
-               if (stream->alloc_size < 4096)
-                       stream->alloc_size = 4096;
-               else
-                       stream->alloc_size *= 2;
-       }
+       MonoReflectionModule *res;
+       char* basename;
        
-       stream->data = (char *)g_realloc (stream->data, stream->alloc_size);
-}
-
-static guint32
-string_heap_insert (MonoDynamicStream *sh, const char *str)
-{
-       MONO_REQ_GC_NEUTRAL_MODE;
-
-       guint32 idx;
-       guint32 len;
-       gpointer oldkey, oldval;
+       mono_error_init (error);
+       CHECK_OBJECT (MonoReflectionModule *, image, NULL);
+       res = (MonoReflectionModule *)mono_object_new_checked (domain, mono_class_get_mono_module_class (), error);
+       if (!res)
+               return NULL;
 
-       if (g_hash_table_lookup_extended (sh->hash, str, &oldkey, &oldval))
-               return GPOINTER_TO_UINT (oldval);
+       res->image = image;
+       MonoReflectionAssembly *assm_obj = mono_assembly_get_object_checked (domain, image->assembly, error);
+       if (!assm_obj)
+               return NULL;
+       MONO_OBJECT_SETREF (res, assembly, assm_obj);
 
-       len = strlen (str) + 1;
-       idx = sh->index;
+       MONO_OBJECT_SETREF (res, fqname, mono_string_new (domain, image->name));
+       basename = g_path_get_basename (image->name);
+       MONO_OBJECT_SETREF (res, name, mono_string_new (domain, basename));
+       MONO_OBJECT_SETREF (res, scopename, mono_string_new (domain, image->module_name));
        
-       make_room_in_stream (sh, idx + len);
-
-       /*
-        * We strdup the string even if we already copy them in sh->data
-        * so that the string pointers in the hash remain valid even if
-        * we need to realloc sh->data. We may want to avoid that later.
-        */
-       g_hash_table_insert (sh->hash, g_strdup (str), GUINT_TO_POINTER (idx));
-       memcpy (sh->data + idx, str, len);
-       sh->index += len;
-       return idx;
-}
+       g_free (basename);
 
-static guint32
-string_heap_insert_mstring (MonoDynamicStream *sh, MonoString *str, MonoError *error)
-{
-       MONO_REQ_GC_UNSAFE_MODE;
+       if (image->assembly->image == image) {
+               res->token = mono_metadata_make_token (MONO_TABLE_MODULE, 1);
+       } else {
+               int i;
+               res->token = 0;
+               if (image->assembly->image->modules) {
+                       for (i = 0; i < image->assembly->image->module_count; i++) {
+                               if (image->assembly->image->modules [i] == image)
+                                       res->token = mono_metadata_make_token (MONO_TABLE_MODULEREF, i + 1);
+                       }
+                       g_assert (res->token);
+               }
+       }
 
-       mono_error_init (error);
-       char *name = mono_string_to_utf8_checked (str, error);
-       return_val_if_nok (error, -1);
-       guint32 idx;
-       idx = string_heap_insert (sh, name);
-       g_free (name);
-       return idx;
+       CACHE_OBJECT (MonoReflectionModule *, image, res, NULL);
 }
 
-#ifndef DISABLE_REFLECTION_EMIT
-static void
-string_heap_init (MonoDynamicStream *sh)
+MonoReflectionModule*
+mono_module_file_get_object (MonoDomain *domain, MonoImage *image, int table_index)
 {
-       MONO_REQ_GC_NEUTRAL_MODE;
-
-       sh->index = 0;
-       sh->alloc_size = 4096;
-       sh->data = (char *)g_malloc (4096);
-       sh->hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
-       string_heap_insert (sh, "");
+       MonoError error;
+       MonoReflectionModule *result;
+       result = mono_module_file_get_object_checked (domain, image, table_index, &error);
+       mono_error_cleanup (&error);
+       return result;
 }
-#endif
 
-static guint32
-mono_image_add_stream_data (MonoDynamicStream *stream, const char *data, guint32 len)
+MonoReflectionModule*
+mono_module_file_get_object_checked (MonoDomain *domain, MonoImage *image, int table_index, MonoError *error)
 {
-       MONO_REQ_GC_NEUTRAL_MODE;
-
-       guint32 idx;
+       MonoReflectionModule *res;
+       MonoTableInfo *table;
+       guint32 cols [MONO_FILE_SIZE];
+       const char *name;
+       guint32 i, name_idx;
+       const char *val;
        
-       make_room_in_stream (stream, stream->index + len);
-       memcpy (stream->data + stream->index, data, len);
-       idx = stream->index;
-       stream->index += len;
-       /* 
-        * align index? Not without adding an additional param that controls it since
-        * we may store a blob value in pieces.
-        */
-       return idx;
-}
+       mono_error_init (error);
 
-static guint32
-mono_image_add_stream_zero (MonoDynamicStream *stream, guint32 len)
-{
-       MONO_REQ_GC_NEUTRAL_MODE;
+       res = (MonoReflectionModule *)mono_object_new_checked (domain, mono_class_get_mono_module_class (), error);
+       if (!res)
+               return NULL;
 
-       guint32 idx;
-       
-       make_room_in_stream (stream, stream->index + len);
-       memset (stream->data + stream->index, 0, len);
-       idx = stream->index;
-       stream->index += len;
-       return idx;
-}
+       table = &image->tables [MONO_TABLE_FILE];
+       g_assert (table_index < table->rows);
+       mono_metadata_decode_row (table, table_index, cols, MONO_FILE_SIZE);
 
-static void
-stream_data_align (MonoDynamicStream *stream)
-{
-       MONO_REQ_GC_NEUTRAL_MODE;
-
-       char buf [4] = {0};
-       guint32 count = stream->index % 4;
-
-       /* we assume the stream data will be aligned */
-       if (count)
-               mono_image_add_stream_data (stream, buf, 4 - count);
-}
-
-#ifndef DISABLE_REFLECTION_EMIT
-static int
-mono_blob_entry_hash (const char* str)
-{
-       MONO_REQ_GC_NEUTRAL_MODE;
+       res->image = NULL;
+       MonoReflectionAssembly *assm_obj = mono_assembly_get_object_checked (domain, image->assembly, error);
+       if (!assm_obj)
+               return NULL;
+       MONO_OBJECT_SETREF (res, assembly, assm_obj);
+       name = mono_metadata_string_heap (image, cols [MONO_FILE_NAME]);
 
-       guint len, h;
-       const char *end;
-       len = mono_metadata_decode_blob_size (str, &str);
-       if (len > 0) {
-               end = str + len;
-               h = *str;
-               for (str += 1; str < end; str++)
-                       h = (h << 5) - h + *str;
-               return h;
-       } else {
-               return 0;
+       /* Check whenever the row has a corresponding row in the moduleref table */
+       table = &image->tables [MONO_TABLE_MODULEREF];
+       for (i = 0; i < table->rows; ++i) {
+               name_idx = mono_metadata_decode_row_col (table, i, MONO_MODULEREF_NAME);
+               val = mono_metadata_string_heap (image, name_idx);
+               if (strcmp (val, name) == 0)
+                       res->image = image->modules [i];
        }
-}
-
-static gboolean
-mono_blob_entry_equal (const char *str1, const char *str2) {
-       MONO_REQ_GC_NEUTRAL_MODE;
-
-       int len, len2;
-       const char *end1;
-       const char *end2;
-       len = mono_metadata_decode_blob_size (str1, &end1);
-       len2 = mono_metadata_decode_blob_size (str2, &end2);
-       if (len != len2)
-               return 0;
-       return memcmp (end1, end2, len) == 0;
-}
-#endif
-static guint32
-add_to_blob_cached (MonoDynamicImage *assembly, char *b1, int s1, char *b2, int s2)
-{
-       MONO_REQ_GC_NEUTRAL_MODE;
 
-       guint32 idx;
-       char *copy;
-       gpointer oldkey, oldval;
+       MONO_OBJECT_SETREF (res, fqname, mono_string_new (domain, name));
+       MONO_OBJECT_SETREF (res, name, mono_string_new (domain, name));
+       MONO_OBJECT_SETREF (res, scopename, mono_string_new (domain, name));
+       res->is_resource = cols [MONO_FILE_FLAGS] & FILE_CONTAINS_NO_METADATA;
+       res->token = mono_metadata_make_token (MONO_TABLE_FILE, table_index + 1);
 
-       copy = (char *)g_malloc (s1+s2);
-       memcpy (copy, b1, s1);
-       memcpy (copy + s1, b2, s2);
-       if (g_hash_table_lookup_extended (assembly->blob_cache, copy, &oldkey, &oldval)) {
-               g_free (copy);
-               idx = GPOINTER_TO_UINT (oldval);
-       } else {
-               idx = mono_image_add_stream_data (&assembly->blob, b1, s1);
-               mono_image_add_stream_data (&assembly->blob, b2, s2);
-               g_hash_table_insert (assembly->blob_cache, copy, GUINT_TO_POINTER (idx));
-       }
-       return idx;
+       return res;
 }
 
-static guint32
-sigbuffer_add_to_blob_cached (MonoDynamicImage *assembly, SigBuffer *buf)
+static MonoType*
+mono_type_normalize (MonoType *type)
 {
-       MONO_REQ_GC_NEUTRAL_MODE;
-
-       char blob_size [8];
-       char *b = blob_size;
-       guint32 size = buf->p - buf->buf;
-       /* store length */
-       g_assert (size <= (buf->end - buf->buf));
-       mono_metadata_encode_value (size, b, &b);
-       return add_to_blob_cached (assembly, blob_size, b-blob_size, buf->buf, size);
-}
-
-/*
- * Copy len * nelem bytes from val to dest, swapping bytes to LE if necessary.
- * dest may be misaligned.
- */
-static void
-swap_with_size (char *dest, const char* val, int len, int nelem) {
-       MONO_REQ_GC_NEUTRAL_MODE;
-#if G_BYTE_ORDER != G_LITTLE_ENDIAN
-       int elem;
+       int i;
+       MonoGenericClass *gclass;
+       MonoGenericInst *ginst;
+       MonoClass *gtd;
+       MonoGenericContainer *gcontainer;
+       MonoType **argv = NULL;
+       gboolean is_denorm_gtd = TRUE, requires_rebind = FALSE;
 
-       for (elem = 0; elem < nelem; ++elem) {
-               switch (len) {
-               case 1:
-                       *dest = *val;
-                       break;
-               case 2:
-                       dest [0] = val [1];
-                       dest [1] = val [0];
-                       break;
-               case 4:
-                       dest [0] = val [3];
-                       dest [1] = val [2];
-                       dest [2] = val [1];
-                       dest [3] = val [0];
-                       break;
-               case 8:
-                       dest [0] = val [7];
-                       dest [1] = val [6];
-                       dest [2] = val [5];
-                       dest [3] = val [4];
-                       dest [4] = val [3];
-                       dest [5] = val [2];
-                       dest [6] = val [1];
-                       dest [7] = val [0];
-                       break;
-               default:
-                       g_assert_not_reached ();
-               }
-               dest += len;
-               val += len;
-       }
-#else
-       memcpy (dest, val, len * nelem);
-#endif
-}
+       if (type->type != MONO_TYPE_GENERICINST)
+               return type;
 
-static guint32
-add_mono_string_to_blob_cached (MonoDynamicImage *assembly, MonoString *str)
-{
-       MONO_REQ_GC_UNSAFE_MODE;
-       
-       char blob_size [64];
-       char *b = blob_size;
-       guint32 idx = 0, len;
+       gclass = type->data.generic_class;
+       ginst = gclass->context.class_inst;
+       if (!ginst->is_open)
+               return type;
 
-       len = str->length * 2;
-       mono_metadata_encode_value (len, b, &b);
-#if G_BYTE_ORDER != G_LITTLE_ENDIAN
-       {
-               char *swapped = g_malloc (2 * mono_string_length (str));
-               const char *p = (const char*)mono_string_chars (str);
+       gtd = gclass->container_class;
+       gcontainer = mono_class_get_generic_container (gtd);
+       argv = g_newa (MonoType*, ginst->type_argc);
 
-               swap_with_size (swapped, p, 2, mono_string_length (str));
-               idx = add_to_blob_cached (assembly, blob_size, b-blob_size, swapped, len);
-               g_free (swapped);
+       for (i = 0; i < ginst->type_argc; ++i) {
+               MonoType *t = ginst->type_argv [i], *norm;
+               if (t->type != MONO_TYPE_VAR || t->data.generic_param->num != i || t->data.generic_param->owner != gcontainer)
+                       is_denorm_gtd = FALSE;
+               norm = mono_type_normalize (t);
+               argv [i] = norm;
+               if (norm != t)
+                       requires_rebind = TRUE;
        }
-#else
-       idx = add_to_blob_cached (assembly, blob_size, b-blob_size, (char*)mono_string_chars (str), len);
-#endif
-       return idx;
-}
 
-#ifndef DISABLE_REFLECTION_EMIT
-static MonoClass *
-default_class_from_mono_type (MonoType *type)
-{
-       MONO_REQ_GC_NEUTRAL_MODE;
+       if (is_denorm_gtd)
+               return type->byref == gtd->byval_arg.byref ? &gtd->byval_arg : &gtd->this_arg;
 
-       switch (type->type) {
-       case MONO_TYPE_OBJECT:
-               return mono_defaults.object_class;
-       case MONO_TYPE_VOID:
-               return mono_defaults.void_class;
-       case MONO_TYPE_BOOLEAN:
-               return mono_defaults.boolean_class;
-       case MONO_TYPE_CHAR:
-               return mono_defaults.char_class;
-       case MONO_TYPE_I1:
-               return mono_defaults.sbyte_class;
-       case MONO_TYPE_U1:
-               return mono_defaults.byte_class;
-       case MONO_TYPE_I2:
-               return mono_defaults.int16_class;
-       case MONO_TYPE_U2:
-               return mono_defaults.uint16_class;
-       case MONO_TYPE_I4:
-               return mono_defaults.int32_class;
-       case MONO_TYPE_U4:
-               return mono_defaults.uint32_class;
-       case MONO_TYPE_I:
-               return mono_defaults.int_class;
-       case MONO_TYPE_U:
-               return mono_defaults.uint_class;
-       case MONO_TYPE_I8:
-               return mono_defaults.int64_class;
-       case MONO_TYPE_U8:
-               return mono_defaults.uint64_class;
-       case MONO_TYPE_R4:
-               return mono_defaults.single_class;
-       case MONO_TYPE_R8:
-               return mono_defaults.double_class;
-       case MONO_TYPE_STRING:
-               return mono_defaults.string_class;
-       default:
-               g_warning ("default_class_from_mono_type: implement me 0x%02x\n", type->type);
-               g_assert_not_reached ();
+       if (requires_rebind) {
+               MonoClass *klass = mono_class_bind_generic_parameters (gtd, ginst->type_argc, argv, gclass->is_dynamic);
+               return type->byref == klass->byval_arg.byref ? &klass->byval_arg : &klass->this_arg;
        }
-       
-       return NULL;
-}
-#endif
 
+       return type;
+}
 /*
- * mono_class_get_ref_info:
+ * mono_type_get_object:
+ * @domain: an app domain
+ * @type: a type
  *
- *   Return the type builder/generic param builder corresponding to KLASS, if it exists.
+ * Return an System.MonoType object representing the type @type.
  */
-gpointer
-mono_class_get_ref_info (MonoClass *klass)
-{
-       MONO_REQ_GC_UNSAFE_MODE;
-
-       if (klass->ref_info_handle == 0)
-               return NULL;
-       else
-               return mono_gchandle_get_target (klass->ref_info_handle);
-}
-
-void
-mono_class_set_ref_info (MonoClass *klass, gpointer obj)
-{
-       MONO_REQ_GC_UNSAFE_MODE;
-
-       klass->ref_info_handle = mono_gchandle_new ((MonoObject*)obj, FALSE);
-       g_assert (klass->ref_info_handle != 0);
-}
-
-void
-mono_class_free_ref_info (MonoClass *klass)
+MonoReflectionType*
+mono_type_get_object (MonoDomain *domain, MonoType *type)
 {
-       MONO_REQ_GC_NEUTRAL_MODE;
+       MonoError error;
+       MonoReflectionType *ret = mono_type_get_object_checked (domain, type, &error);
+       mono_error_cleanup (&error);
 
-       if (klass->ref_info_handle) {
-               mono_gchandle_free (klass->ref_info_handle);
-               klass->ref_info_handle = 0;
-       }
+       return ret;
 }
 
-static void
-encode_generic_class (MonoDynamicImage *assembly, MonoGenericClass *gclass, SigBuffer *buf)
+MonoReflectionType*
+mono_type_get_object_checked (MonoDomain *domain, MonoType *type, MonoError *error)
 {
-       MONO_REQ_GC_NEUTRAL_MODE;
-
-       int i;
-       MonoGenericInst *class_inst;
+       MonoType *norm_type;
+       MonoReflectionType *res;
        MonoClass *klass;
 
-       g_assert (gclass);
-
-       class_inst = gclass->context.class_inst;
-
-       sigbuffer_add_value (buf, MONO_TYPE_GENERICINST);
-       klass = gclass->container_class;
-       sigbuffer_add_value (buf, klass->byval_arg.type);
-       sigbuffer_add_value (buf, mono_image_typedef_or_ref_full (assembly, &klass->byval_arg, FALSE));
+       mono_error_init (error);
 
-       sigbuffer_add_value (buf, class_inst->type_argc);
-       for (i = 0; i < class_inst->type_argc; ++i)
-               encode_type (assembly, class_inst->type_argv [i], buf);
+       klass = mono_class_from_mono_type (type);
 
-}
+       /*we must avoid using @type as it might have come
+        * from a mono_metadata_type_dup and the caller
+        * expects that is can be freed.
+        * Using the right type from 
+        */
+       type = klass->byval_arg.byref == type->byref ? &klass->byval_arg : &klass->this_arg;
 
-static void
-encode_type (MonoDynamicImage *assembly, MonoType *type, SigBuffer *buf)
-{
-       MONO_REQ_GC_NEUTRAL_MODE;
+       /* void is very common */
+       if (type->type == MONO_TYPE_VOID && domain->typeof_void)
+               return (MonoReflectionType*)domain->typeof_void;
 
-       if (!type) {
-               g_assert_not_reached ();
-               return;
-       }
-               
-       if (type->byref)
-               sigbuffer_add_value (buf, MONO_TYPE_BYREF);
-
-       switch (type->type){
-       case MONO_TYPE_VOID:
-       case MONO_TYPE_BOOLEAN:
-       case MONO_TYPE_CHAR:
-       case MONO_TYPE_I1:
-       case MONO_TYPE_U1:
-       case MONO_TYPE_I2:
-       case MONO_TYPE_U2:
-       case MONO_TYPE_I4:
-       case MONO_TYPE_U4:
-       case MONO_TYPE_I8:
-       case MONO_TYPE_U8:
-       case MONO_TYPE_R4:
-       case MONO_TYPE_R8:
-       case MONO_TYPE_I:
-       case MONO_TYPE_U:
-       case MONO_TYPE_STRING:
-       case MONO_TYPE_OBJECT:
-       case MONO_TYPE_TYPEDBYREF:
-               sigbuffer_add_value (buf, type->type);
-               break;
-       case MONO_TYPE_PTR:
-               sigbuffer_add_value (buf, type->type);
-               encode_type (assembly, type->data.type, buf);
-               break;
-       case MONO_TYPE_SZARRAY:
-               sigbuffer_add_value (buf, type->type);
-               encode_type (assembly, &type->data.klass->byval_arg, buf);
-               break;
-       case MONO_TYPE_VALUETYPE:
-       case MONO_TYPE_CLASS: {
-               MonoClass *k = mono_class_from_mono_type (type);
-
-               if (k->generic_container) {
-                       MonoGenericClass *gclass = mono_metadata_lookup_generic_class (k, k->generic_container->context.class_inst, TRUE);
-                       encode_generic_class (assembly, gclass, buf);
-               } else {
-                       /*
-                        * Make sure we use the correct type.
-                        */
-                       sigbuffer_add_value (buf, k->byval_arg.type);
-                       /*
-                        * ensure only non-byref gets passed to mono_image_typedef_or_ref(),
-                        * otherwise two typerefs could point to the same type, leading to
-                        * verification errors.
-                        */
-                       sigbuffer_add_value (buf, mono_image_typedef_or_ref (assembly, &k->byval_arg));
-               }
-               break;
-       }
-       case MONO_TYPE_ARRAY:
-               sigbuffer_add_value (buf, type->type);
-               encode_type (assembly, &type->data.array->eklass->byval_arg, buf);
-               sigbuffer_add_value (buf, type->data.array->rank);
-               sigbuffer_add_value (buf, 0); /* FIXME: set to 0 for now */
-               sigbuffer_add_value (buf, 0);
-               break;
-       case MONO_TYPE_GENERICINST:
-               encode_generic_class (assembly, type->data.generic_class, buf);
-               break;
-       case MONO_TYPE_VAR:
-       case MONO_TYPE_MVAR:
-               sigbuffer_add_value (buf, type->type);
-               sigbuffer_add_value (buf, mono_type_get_generic_param_num (type));
-               break;
-       default:
-               g_error ("need to encode type %x", type->type);
+       /*
+        * If the vtable of the given class was already created, we can use
+        * the MonoType from there and avoid all locking and hash table lookups.
+        * 
+        * We cannot do this for TypeBuilders as mono_reflection_create_runtime_class expects
+        * that the resulting object is different.   
+        */
+       if (type == &klass->byval_arg && !image_is_dynamic (klass->image)) {
+               MonoVTable *vtable = mono_class_try_get_vtable (domain, klass);
+               if (vtable && vtable->type)
+                       return (MonoReflectionType *)vtable->type;
        }
-}
-
-static void
-encode_reflection_type (MonoDynamicImage *assembly, MonoReflectionType *type, SigBuffer *buf, MonoError *error)
-{
-       MONO_REQ_GC_UNSAFE_MODE;
-
-       mono_error_init (error);
 
-       if (!type) {
-               sigbuffer_add_value (buf, MONO_TYPE_VOID);
-               return;
+       mono_loader_lock (); /*FIXME mono_class_init and mono_class_vtable acquire it*/
+       mono_domain_lock (domain);
+       if (!domain->type_hash)
+               domain->type_hash = mono_g_hash_table_new_type ((GHashFunc)mono_metadata_type_hash, 
+                               (GCompareFunc)mono_metadata_type_equal, MONO_HASH_VALUE_GC, MONO_ROOT_SOURCE_DOMAIN, "domain reflection types table");
+       if ((res = (MonoReflectionType *)mono_g_hash_table_lookup (domain->type_hash, type))) {
+               mono_domain_unlock (domain);
+               mono_loader_unlock ();
+               return res;
        }
 
-       MonoType *t = mono_reflection_type_get_handle (type, error);
-       return_if_nok (error);
-       encode_type (assembly, t, buf);
-}
-
-static void
-encode_custom_modifiers (MonoDynamicImage *assembly, MonoArray *modreq, MonoArray *modopt, SigBuffer *buf, MonoError *error)
-{
-       MONO_REQ_GC_UNSAFE_MODE;
-
-       int i;
+       /*Types must be normalized so a generic instance of the GTD get's the same inner type.
+        * For example in: Foo<A,B>; Bar<A> : Foo<A, Bar<A>>
+        * The second Bar will be encoded a generic instance of Bar with <A> as parameter.
+        * On all other places, Bar<A> will be encoded as the GTD itself. This is an implementation
+        * artifact of how generics are encoded and should be transparent to managed code so we
+        * need to weed out this diference when retrieving managed System.Type objects.
+        */
+       norm_type = mono_type_normalize (type);
+       if (norm_type != type) {
+               res = mono_type_get_object_checked (domain, norm_type, error);
+               if (!mono_error_ok (error))
+                       return NULL;
+               mono_g_hash_table_insert (domain->type_hash, type, res);
+               mono_domain_unlock (domain);
+               mono_loader_unlock ();
+               return res;
+       }
 
-       mono_error_init (error);
+       /* This MonoGenericClass hack is no longer necessary. Let's leave it here until we finish with the 2-stage type-builder setup.*/
+       if ((type->type == MONO_TYPE_GENERICINST) && type->data.generic_class->is_dynamic && !type->data.generic_class->container_class->wastypebuilder)
+               g_assert (0);
 
-       if (modreq) {
-               for (i = 0; i < mono_array_length (modreq); ++i) {
-                       MonoType *mod = mono_type_array_get_and_resolve (modreq, i, error);
-                       return_if_nok (error);
-                       sigbuffer_add_byte (buf, MONO_TYPE_CMOD_REQD);
-                       sigbuffer_add_value (buf, mono_image_typedef_or_ref (assembly, mod));
-               }
-       }
-       if (modopt) {
-               for (i = 0; i < mono_array_length (modopt); ++i) {
-                       MonoType *mod = mono_type_array_get_and_resolve (modopt, i, error);
-                       return_if_nok (error);
-                       sigbuffer_add_byte (buf, MONO_TYPE_CMOD_OPT);
-                       sigbuffer_add_value (buf, mono_image_typedef_or_ref (assembly, mod));
-               }
+       if (mono_class_get_ref_info (klass) && !klass->wastypebuilder && !type->byref) {
+               mono_domain_unlock (domain);
+               mono_loader_unlock ();
+               return (MonoReflectionType *)mono_class_get_ref_info (klass);
        }
-}
-
-#ifndef DISABLE_REFLECTION_EMIT
-static guint32
-method_encode_signature (MonoDynamicImage *assembly, MonoMethodSignature *sig)
-{
-       MONO_REQ_GC_UNSAFE_MODE;
+       /* This is stored in vtables/JITted code so it has to be pinned */
+       res = (MonoReflectionType *)mono_object_new_pinned (domain, mono_defaults.runtimetype_class, error);
+       if (!mono_error_ok (error))
+               return NULL;
 
-       SigBuffer buf;
-       int i;
-       guint32 nparams =  sig->param_count;
-       guint32 idx;
+       res->type = type;
+       mono_g_hash_table_insert (domain->type_hash, type, res);
 
-       if (!assembly->save)
-               return 0;
+       if (type->type == MONO_TYPE_VOID)
+               domain->typeof_void = (MonoObject*)res;
 
-       sigbuffer_init (&buf, 32);
-       /*
-        * FIXME: vararg, explicit_this, differenc call_conv values...
-        */
-       idx = sig->call_convention;
-       if (sig->hasthis)
-               idx |= 0x20; /* hasthis */
-       if (sig->generic_param_count)
-               idx |= 0x10; /* generic */
-       sigbuffer_add_byte (&buf, idx);
-       if (sig->generic_param_count)
-               sigbuffer_add_value (&buf, sig->generic_param_count);
-       sigbuffer_add_value (&buf, nparams);
-       encode_type (assembly, sig->ret, &buf);
-       for (i = 0; i < nparams; ++i) {
-               if (i == sig->sentinelpos)
-                       sigbuffer_add_byte (&buf, MONO_TYPE_SENTINEL);
-               encode_type (assembly, sig->params [i], &buf);
-       }
-       idx = sigbuffer_add_to_blob_cached (assembly, &buf);
-       sigbuffer_free (&buf);
-       return idx;
+       mono_domain_unlock (domain);
+       mono_loader_unlock ();
+       return res;
 }
-#endif
 
-static guint32
-method_builder_encode_signature (MonoDynamicImage *assembly, ReflectionMethodBuilder *mb, MonoError *error)
+/*
+ * mono_method_get_object:
+ * @domain: an app domain
+ * @method: a method
+ * @refclass: the reflected type (can be NULL)
+ *
+ * Return an System.Reflection.MonoMethod object representing the method @method.
+ */
+MonoReflectionMethod*
+mono_method_get_object (MonoDomain *domain, MonoMethod *method, MonoClass *refclass)
 {
-       MONO_REQ_GC_UNSAFE_MODE;
-
-       mono_error_init (error);
-
-       /*
-        * FIXME: reuse code from method_encode_signature().
-        */
-       SigBuffer buf;
-       int i;
-       guint32 nparams =  mb->parameters ? mono_array_length (mb->parameters): 0;
-       guint32 ngparams = mb->generic_params ? mono_array_length (mb->generic_params): 0;
-       guint32 notypes = mb->opt_types ? mono_array_length (mb->opt_types): 0;
-       guint32 idx;
-
-       sigbuffer_init (&buf, 32);
-       /* LAMESPEC: all the call conv spec is foobared */
-       idx = mb->call_conv & 0x60; /* has-this, explicit-this */
-       if (mb->call_conv & 2)
-               idx |= 0x5; /* vararg */
-       if (!(mb->attrs & METHOD_ATTRIBUTE_STATIC))
-               idx |= 0x20; /* hasthis */
-       if (ngparams)
-               idx |= 0x10; /* generic */
-       sigbuffer_add_byte (&buf, idx);
-       if (ngparams)
-               sigbuffer_add_value (&buf, ngparams);
-       sigbuffer_add_value (&buf, nparams + notypes);
-       encode_custom_modifiers (assembly, mb->return_modreq, mb->return_modopt, &buf, error);
-       if (!is_ok (error))
-               goto leave;
-       encode_reflection_type (assembly, mb->rtype, &buf, error);
-       if (!is_ok (error))
-               goto leave;
-       for (i = 0; i < nparams; ++i) {
-               MonoArray *modreq = NULL;
-               MonoArray *modopt = NULL;
-               MonoReflectionType *pt;
-
-               if (mb->param_modreq && (i < mono_array_length (mb->param_modreq)))
-                       modreq = mono_array_get (mb->param_modreq, MonoArray*, i);
-               if (mb->param_modopt && (i < mono_array_length (mb->param_modopt)))
-                       modopt = mono_array_get (mb->param_modopt, MonoArray*, i);
-               encode_custom_modifiers (assembly, modreq, modopt, &buf, error);
-               if (!is_ok (error))
-                       goto leave;
-               pt = mono_array_get (mb->parameters, MonoReflectionType*, i);
-               encode_reflection_type (assembly, pt, &buf, error);
-               if (!is_ok (error))
-                       goto leave;
-       }
-       if (notypes)
-               sigbuffer_add_byte (&buf, MONO_TYPE_SENTINEL);
-       for (i = 0; i < notypes; ++i) {
-               MonoReflectionType *pt;
-
-               pt = mono_array_get (mb->opt_types, MonoReflectionType*, i);
-               encode_reflection_type (assembly, pt, &buf, error);
-               if (!is_ok (error))
-                       goto leave;
-       }
-
-       idx = sigbuffer_add_to_blob_cached (assembly, &buf);
-leave:
-       sigbuffer_free (&buf);
-       return idx;
+       MonoError error;
+       MonoReflectionMethod *ret = NULL;
+       ret = mono_method_get_object_checked (domain, method, refclass, &error);
+       mono_error_cleanup (&error);
+       return ret;
 }
 
-static guint32
-encode_locals (MonoDynamicImage *assembly, MonoReflectionILGen *ilgen, MonoError *error)
+/*
+ * mono_method_get_object_checked:
+ * @domain: an app domain
+ * @method: a method
+ * @refclass: the reflected type (can be NULL)
+ * @error: set on error.
+ *
+ * Return an System.Reflection.MonoMethod object representing the method @method.
+ * Returns NULL and sets @error on error.
+ */
+MonoReflectionMethod*
+mono_method_get_object_checked (MonoDomain *domain, MonoMethod *method, MonoClass *refclass, MonoError *error)
 {
-       MONO_REQ_GC_UNSAFE_MODE;
+       /*
+        * We use the same C representation for methods and constructors, but the type 
+        * name in C# is different.
+        */
+       MonoReflectionType *rt;
+       MonoClass *klass;
+       MonoReflectionMethod *ret;
 
        mono_error_init (error);
 
-       MonoDynamicTable *table;
-       guint32 *values;
-       guint32 idx, sig_idx;
-       guint nl = mono_array_length (ilgen->locals);
-       SigBuffer buf;
-       int i;
+       if (!refclass)
+               refclass = method->klass;
 
-       sigbuffer_init (&buf, 32);
-       sigbuffer_add_value (&buf, 0x07);
-       sigbuffer_add_value (&buf, nl);
-       for (i = 0; i < nl; ++i) {
-               MonoReflectionLocalBuilder *lb = mono_array_get (ilgen->locals, MonoReflectionLocalBuilder*, i);
-               
-               if (lb->is_pinned)
-                       sigbuffer_add_value (&buf, MONO_TYPE_PINNED);
-               
-               encode_reflection_type (assembly, (MonoReflectionType*)lb->type, &buf, error);
-               if (!is_ok (error)) {
-                       sigbuffer_free (&buf);
-                       return 0;
-               }
+       CHECK_OBJECT (MonoReflectionMethod *, method, refclass);
+       if (*method->name == '.' && (strcmp (method->name, ".ctor") == 0 || strcmp (method->name, ".cctor") == 0)) {
+               klass = mono_class_get_mono_cmethod_class ();
        }
-       sig_idx = sigbuffer_add_to_blob_cached (assembly, &buf);
-       sigbuffer_free (&buf);
-
-       if (assembly->standalonesig_cache == NULL)
-               assembly->standalonesig_cache = g_hash_table_new (NULL, NULL);
-       idx = GPOINTER_TO_UINT (g_hash_table_lookup (assembly->standalonesig_cache, GUINT_TO_POINTER (sig_idx)));
-       if (idx)
-               return idx;
+       else {
+               klass = mono_class_get_mono_method_class ();
+       }
+       ret = (MonoReflectionMethod*)mono_object_new_checked (domain, klass, error);
+       if (!mono_error_ok (error))
+               goto leave;
+       ret->method = method;
 
-       table = &assembly->tables [MONO_TABLE_STANDALONESIG];
-       idx = table->next_idx ++;
-       table->rows ++;
-       alloc_table (table, table->rows);
-       values = table->values + idx * MONO_STAND_ALONE_SIGNATURE_SIZE;
+       rt = mono_type_get_object_checked (domain, &refclass->byval_arg, error);
+       if (!mono_error_ok (error))
+               goto leave;
 
-       values [MONO_STAND_ALONE_SIGNATURE] = sig_idx;
+       MONO_OBJECT_SETREF (ret, reftype, rt);
 
-       g_hash_table_insert (assembly->standalonesig_cache, GUINT_TO_POINTER (sig_idx), GUINT_TO_POINTER (idx));
+       CACHE_OBJECT (MonoReflectionMethod *, method, ret, refclass);
 
-       return idx;
+leave:
+       g_assert (!mono_error_ok (error));
+       return NULL;
 }
 
-static guint32
-method_count_clauses (MonoReflectionILGen *ilgen)
+/*
+ * mono_method_clear_object:
+ *
+ *   Clear the cached reflection objects for the dynamic method METHOD.
+ */
+void
+mono_method_clear_object (MonoDomain *domain, MonoMethod *method)
 {
-       MONO_REQ_GC_UNSAFE_MODE;
-
-       guint32 num_clauses = 0;
-       int i;
+       MonoClass *klass;
+       g_assert (method_is_dynamic (method));
 
-       MonoILExceptionInfo *ex_info;
-       for (i = 0; i < mono_array_length (ilgen->ex_handlers); ++i) {
-               ex_info = (MonoILExceptionInfo*)mono_array_addr (ilgen->ex_handlers, MonoILExceptionInfo, i);
-               if (ex_info->handlers)
-                       num_clauses += mono_array_length (ex_info->handlers);
-               else
-                       num_clauses++;
+       klass = method->klass;
+       while (klass) {
+               clear_cached_object (domain, method, klass);
+               klass = klass->parent;
+       }
+       /* Added by mono_param_get_objects () */
+       clear_cached_object (domain, &(method->signature), NULL);
+       klass = method->klass;
+       while (klass) {
+               clear_cached_object (domain, &(method->signature), klass);
+               klass = klass->parent;
        }
-
-       return num_clauses;
 }
 
-#ifndef DISABLE_REFLECTION_EMIT
-static MonoExceptionClause*
-method_encode_clauses (MonoImage *image, MonoDynamicImage *assembly, MonoReflectionILGen *ilgen, guint32 num_clauses, MonoError *error)
+/*
+ * mono_field_get_object:
+ * @domain: an app domain
+ * @klass: a type
+ * @field: a field
+ *
+ * Return an System.Reflection.MonoField object representing the field @field
+ * in class @klass.
+ */
+MonoReflectionField*
+mono_field_get_object (MonoDomain *domain, MonoClass *klass, MonoClassField *field)
 {
-       MONO_REQ_GC_UNSAFE_MODE;
-
-       mono_error_init (error);
-
-       MonoExceptionClause *clauses;
-       MonoExceptionClause *clause;
-       MonoILExceptionInfo *ex_info;
-       MonoILExceptionBlock *ex_block;
-       guint32 finally_start;
-       int i, j, clause_index;;
-
-       clauses = image_g_new0 (image, MonoExceptionClause, num_clauses);
-
-       clause_index = 0;
-       for (i = mono_array_length (ilgen->ex_handlers) - 1; i >= 0; --i) {
-               ex_info = (MonoILExceptionInfo*)mono_array_addr (ilgen->ex_handlers, MonoILExceptionInfo, i);
-               finally_start = ex_info->start + ex_info->len;
-               if (!ex_info->handlers)
-                       continue;
-               for (j = 0; j < mono_array_length (ex_info->handlers); ++j) {
-                       ex_block = (MonoILExceptionBlock*)mono_array_addr (ex_info->handlers, MonoILExceptionBlock, j);
-                       clause = &(clauses [clause_index]);
-
-                       clause->flags = ex_block->type;
-                       clause->try_offset = ex_info->start;
-
-                       if (ex_block->type == MONO_EXCEPTION_CLAUSE_FINALLY)
-                               clause->try_len = finally_start - ex_info->start;
-                       else
-                               clause->try_len = ex_info->len;
-                       clause->handler_offset = ex_block->start;
-                       clause->handler_len = ex_block->len;
-                       if (ex_block->extype) {
-                               MonoType *extype = mono_reflection_type_get_handle ((MonoReflectionType*)ex_block->extype, error);
-
-                               if (!is_ok (error)) {
-                                       image_g_free (image, clauses);
-                                       return NULL;
-                               }
-                               clause->data.catch_class = mono_class_from_mono_type (extype);
-                       } else {
-                               if (ex_block->type == MONO_EXCEPTION_CLAUSE_FILTER)
-                                       clause->data.filter_offset = ex_block->filter_offset;
-                               else
-                                       clause->data.filter_offset = 0;
-                       }
-                       finally_start = ex_block->start + ex_block->len;
-
-                       clause_index ++;
-               }
-       }
-
-       return clauses;
+       MonoError error;
+       MonoReflectionField *result;
+       result = mono_field_get_object_checked (domain, klass, field, &error);
+       mono_error_cleanup (&error);
+       return result;
 }
-#endif /* !DISABLE_REFLECTION_EMIT */
 
-/**
- * method_encode_code:
- *
- * @assembly the assembly
- * @mb the managed MethodBuilder
- * @error set on error
+/*
+ * mono_field_get_object_checked:
+ * @domain: an app domain
+ * @klass: a type
+ * @field: a field
+ * @error: set on error
  *
- * Note that the return value is not sensible if @error is set.
+ * Return an System.Reflection.MonoField object representing the field @field
+ * in class @klass. On error, returns NULL and sets @error.
  */
-static guint32
-method_encode_code (MonoDynamicImage *assembly, ReflectionMethodBuilder *mb, MonoError *error)
+MonoReflectionField*
+mono_field_get_object_checked (MonoDomain *domain, MonoClass *klass, MonoClassField *field, MonoError *error)
 {
-       MONO_REQ_GC_UNSAFE_MODE;
-
-       char flags = 0;
-       guint32 idx;
-       guint32 code_size;
-       gint32 max_stack, i;
-       gint32 num_locals = 0;
-       gint32 num_exception = 0;
-       gint maybe_small;
-       guint32 fat_flags;
-       char fat_header [12];
-       guint32 int_value;
-       guint16 short_value;
-       guint32 local_sig = 0;
-       guint32 header_size = 12;
-       MonoArray *code;
+       MonoReflectionType *rt;
+       MonoReflectionField *res;
 
        mono_error_init (error);
 
-       if ((mb->attrs & (METHOD_ATTRIBUTE_PINVOKE_IMPL | METHOD_ATTRIBUTE_ABSTRACT)) ||
-                       (mb->iattrs & (METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL | METHOD_IMPL_ATTRIBUTE_RUNTIME)))
-               return 0;
-
-       /*if (mb->name)
-               g_print ("Encode method %s\n", mono_string_to_utf8 (mb->name));*/
-       if (mb->ilgen) {
-               code = mb->ilgen->code;
-               code_size = mb->ilgen->code_len;
-               max_stack = mb->ilgen->max_stack;
-               num_locals = mb->ilgen->locals ? mono_array_length (mb->ilgen->locals) : 0;
-               if (mb->ilgen->ex_handlers)
-                       num_exception = method_count_clauses (mb->ilgen);
-       } else {
-               code = mb->code;
-               if (code == NULL){
-                       MonoError inner_error;
-                       char *name = mono_string_to_utf8_checked (mb->name, &inner_error);
-                       if (!is_ok (&inner_error)) {
-                               name = g_strdup ("");
-                               mono_error_cleanup (&inner_error);
-                       }
-                       char *str = g_strdup_printf ("Method %s does not have any IL associated", name);
-                       mono_error_set_argument (error, NULL, "a method does not have any IL associated");
-                       g_free (str);
-                       g_free (name);
-                       return 0;
-               }
-
-               code_size = mono_array_length (code);
-               max_stack = 8; /* we probably need to run a verifier on the code... */
-       }
+       CHECK_OBJECT (MonoReflectionField *, field, klass);
+       res = (MonoReflectionField *)mono_object_new_checked (domain, mono_class_get_mono_field_class (), error);
+       if (!res)
+               return NULL;
+       res->klass = klass;
+       res->field = field;
+       MONO_OBJECT_SETREF (res, name, mono_string_new (domain, mono_field_get_name (field)));
 
-       stream_data_align (&assembly->code);
+       if (field->type) {
+               rt = mono_type_get_object_checked (domain, field->type, error);
+               if (!mono_error_ok (error))
+                       return NULL;
 
-       /* check for exceptions, maxstack, locals */
-       maybe_small = (max_stack <= 8) && (!num_locals) && (!num_exception);
-       if (maybe_small) {
-               if (code_size < 64 && !(code_size & 1)) {
-                       flags = (code_size << 2) | 0x2;
-               } else if (code_size < 32 && (code_size & 1)) {
-                       flags = (code_size << 2) | 0x6; /* LAMESPEC: see metadata.c */
-               } else {
-                       goto fat_header;
-               }
-               idx = mono_image_add_stream_data (&assembly->code, &flags, 1);
-               /* add to the fixup todo list */
-               if (mb->ilgen && mb->ilgen->num_token_fixups)
-                       mono_g_hash_table_insert (assembly->token_fixups, mb->ilgen, GUINT_TO_POINTER (idx + 1));
-               mono_image_add_stream_data (&assembly->code, mono_array_addr (code, char, 0), code_size);
-               return assembly->text_rva + idx;
-       } 
-fat_header:
-       if (num_locals) {
-               local_sig = MONO_TOKEN_SIGNATURE | encode_locals (assembly, mb->ilgen, error);
-               return_val_if_nok (error, 0);
-       }
-       /* 
-        * FIXME: need to set also the header size in fat_flags.
-        * (and more sects and init locals flags)
-        */
-       fat_flags =  0x03;
-       if (num_exception)
-               fat_flags |= METHOD_HEADER_MORE_SECTS;
-       if (mb->init_locals)
-               fat_flags |= METHOD_HEADER_INIT_LOCALS;
-       fat_header [0] = fat_flags;
-       fat_header [1] = (header_size / 4 ) << 4;
-       short_value = GUINT16_TO_LE (max_stack);
-       memcpy (fat_header + 2, &short_value, 2);
-       int_value = GUINT32_TO_LE (code_size);
-       memcpy (fat_header + 4, &int_value, 4);
-       int_value = GUINT32_TO_LE (local_sig);
-       memcpy (fat_header + 8, &int_value, 4);
-       idx = mono_image_add_stream_data (&assembly->code, fat_header, 12);
-       /* add to the fixup todo list */
-       if (mb->ilgen && mb->ilgen->num_token_fixups)
-               mono_g_hash_table_insert (assembly->token_fixups, mb->ilgen, GUINT_TO_POINTER (idx + 12));
-       
-       mono_image_add_stream_data (&assembly->code, mono_array_addr (code, char, 0), code_size);
-       if (num_exception) {
-               unsigned char sheader [4];
-               MonoILExceptionInfo * ex_info;
-               MonoILExceptionBlock * ex_block;
-               int j;
-
-               stream_data_align (&assembly->code);
-               /* always use fat format for now */
-               sheader [0] = METHOD_HEADER_SECTION_FAT_FORMAT | METHOD_HEADER_SECTION_EHTABLE;
-               num_exception *= 6 * sizeof (guint32);
-               num_exception += 4; /* include the size of the header */
-               sheader [1] = num_exception & 0xff;
-               sheader [2] = (num_exception >> 8) & 0xff;
-               sheader [3] = (num_exception >> 16) & 0xff;
-               mono_image_add_stream_data (&assembly->code, (char*)sheader, 4);
-               /* fat header, so we are already aligned */
-               /* reverse order */
-               for (i = mono_array_length (mb->ilgen->ex_handlers) - 1; i >= 0; --i) {
-                       ex_info = (MonoILExceptionInfo *)mono_array_addr (mb->ilgen->ex_handlers, MonoILExceptionInfo, i);
-                       if (ex_info->handlers) {
-                               int finally_start = ex_info->start + ex_info->len;
-                               for (j = 0; j < mono_array_length (ex_info->handlers); ++j) {
-                                       guint32 val;
-                                       ex_block = (MonoILExceptionBlock*)mono_array_addr (ex_info->handlers, MonoILExceptionBlock, j);
-                                       /* the flags */
-                                       val = GUINT32_TO_LE (ex_block->type);
-                                       mono_image_add_stream_data (&assembly->code, (char*)&val, sizeof (guint32));
-                                       /* try offset */
-                                       val = GUINT32_TO_LE (ex_info->start);
-                                       mono_image_add_stream_data (&assembly->code, (char*)&val, sizeof (guint32));
-                                       /* need fault, too, probably */
-                                       if (ex_block->type == MONO_EXCEPTION_CLAUSE_FINALLY)
-                                               val = GUINT32_TO_LE (finally_start - ex_info->start);
-                                       else
-                                               val = GUINT32_TO_LE (ex_info->len);
-                                       mono_image_add_stream_data (&assembly->code, (char*)&val, sizeof (guint32));
-                                       /* handler offset */
-                                       val = GUINT32_TO_LE (ex_block->start);
-                                       mono_image_add_stream_data (&assembly->code, (char*)&val, sizeof (guint32));
-                                       /* handler len */
-                                       val = GUINT32_TO_LE (ex_block->len);
-                                       mono_image_add_stream_data (&assembly->code, (char*)&val, sizeof (guint32));
-                                       finally_start = ex_block->start + ex_block->len;
-                                       if (ex_block->extype) {
-                                               MonoType *extype = mono_reflection_type_get_handle ((MonoReflectionType*)ex_block->extype, error);
-                                               return_val_if_nok (error, 0);
-
-                                               val = mono_metadata_token_from_dor (mono_image_typedef_or_ref (assembly, extype));
-                                       } else {
-                                               if (ex_block->type == MONO_EXCEPTION_CLAUSE_FILTER)
-                                                       val = ex_block->filter_offset;
-                                               else
-                                                       val = 0;
-                                       }
-                                       val = GUINT32_TO_LE (val);
-                                       mono_image_add_stream_data (&assembly->code, (char*)&val, sizeof (guint32));
-                                       /*g_print ("out clause %d: from %d len=%d, handler at %d, %d, finally_start=%d, ex_info->start=%d, ex_info->len=%d, ex_block->type=%d, j=%d, i=%d\n", 
-                                                       clause.flags, clause.try_offset, clause.try_len, clause.handler_offset, clause.handler_len, finally_start, ex_info->start, ex_info->len, ex_block->type, j, i);*/
-                               }
-                       } else {
-                               g_error ("No clauses for ex info block %d", i);
-                       }
-               }
+               MONO_OBJECT_SETREF (res, type, rt);
        }
-       return assembly->text_rva + idx;
+       res->attrs = mono_field_get_flags (field);
+       CACHE_OBJECT (MonoReflectionField *, field, res, klass);
 }
 
-static guint32
-find_index_in_table (MonoDynamicImage *assembly, int table_idx, int col, guint32 token)
+/*
+ * mono_property_get_object:
+ * @domain: an app domain
+ * @klass: a type
+ * @property: a property
+ *
+ * Return an System.Reflection.MonoProperty object representing the property @property
+ * in class @klass.
+ */
+MonoReflectionProperty*
+mono_property_get_object (MonoDomain *domain, MonoClass *klass, MonoProperty *property)
 {
-       MONO_REQ_GC_NEUTRAL_MODE;
-
-       int i;
-       MonoDynamicTable *table;
-       guint32 *values;
-       
-       table = &assembly->tables [table_idx];
-
-       g_assert (col < table->columns);
-
-       values = table->values + table->columns;
-       for (i = 1; i <= table->rows; ++i) {
-               if (values [col] == token)
-                       return i;
-               values += table->columns;
-       }
-       return 0;
+       MonoError error;
+       MonoReflectionProperty *result;
+       result = mono_property_get_object_checked (domain, klass, property, &error);
+       mono_error_cleanup (&error);
+       return result;
 }
 
-/*
- * LOCKING: Acquires the loader lock. 
+/**
+ * mono_property_get_object:
+ * @domain: an app domain
+ * @klass: a type
+ * @property: a property
+ * @error: set on error
+ *
+ * Return an System.Reflection.MonoProperty object representing the property @property
+ * in class @klass.  On error returns NULL and sets @error.
  */
-static MonoCustomAttrInfo*
-lookup_custom_attr (MonoImage *image, gpointer member)
+MonoReflectionProperty*
+mono_property_get_object_checked (MonoDomain *domain, MonoClass *klass, MonoProperty *property, MonoError *error)
 {
-       MONO_REQ_GC_NEUTRAL_MODE;
-
-       MonoCustomAttrInfo* res;
+       MonoReflectionProperty *res;
 
-       res = (MonoCustomAttrInfo *)mono_image_property_lookup (image, member, MONO_PROP_DYNAMIC_CATTR);
+       mono_error_init (error);
 
+       CHECK_OBJECT (MonoReflectionProperty *, property, klass);
+       res = (MonoReflectionProperty *)mono_object_new_checked (domain, mono_class_get_mono_property_class (), error);
        if (!res)
                return NULL;
-
-       res = (MonoCustomAttrInfo *)g_memdup (res, MONO_SIZEOF_CUSTOM_ATTR_INFO + sizeof (MonoCustomAttrEntry) * res->num_attrs);
-       res->cached = 0;
-       return res;
+       res->klass = klass;
+       res->property = property;
+       CACHE_OBJECT (MonoReflectionProperty *, property, res, klass);
 }
 
-static gboolean
-custom_attr_visible (MonoImage *image, MonoReflectionCustomAttr *cattr)
+/*
+ * mono_event_get_object:
+ * @domain: an app domain
+ * @klass: a type
+ * @event: a event
+ *
+ * Return an System.Reflection.MonoEvent object representing the event @event
+ * in class @klass.
+ */
+MonoReflectionEvent*
+mono_event_get_object (MonoDomain *domain, MonoClass *klass, MonoEvent *event)
 {
-       MONO_REQ_GC_UNSAFE_MODE;
-
-       /* FIXME: Need to do more checks */
-       if (cattr->ctor->method && (cattr->ctor->method->klass->image != image)) {
-               int visibility = cattr->ctor->method->klass->flags & TYPE_ATTRIBUTE_VISIBILITY_MASK;
-
-               if ((visibility != TYPE_ATTRIBUTE_PUBLIC) && (visibility != TYPE_ATTRIBUTE_NESTED_PUBLIC))
-                       return FALSE;
-       }
-
-       return TRUE;
+       MonoError error;
+       MonoReflectionEvent *result;
+       result = mono_event_get_object_checked (domain, klass, event, &error);
+       mono_error_cleanup (&error);
+       return result;
 }
 
-static MonoCustomAttrInfo*
-mono_custom_attrs_from_builders (MonoImage *alloc_img, MonoImage *image, MonoArray *cattrs)
+/**
+ * mono_event_get_object_checked:
+ * @domain: an app domain
+ * @klass: a type
+ * @event: a event
+ * @error: set on error
+ *
+ * Return an System.Reflection.MonoEvent object representing the event @event
+ * in class @klass. On failure sets @error and returns NULL
+ */
+MonoReflectionEvent*
+mono_event_get_object_checked (MonoDomain *domain, MonoClass *klass, MonoEvent *event, MonoError *error)
 {
-       MONO_REQ_GC_UNSAFE_MODE;
-
-       int i, index, count, not_visible;
-       MonoCustomAttrInfo *ainfo;
-       MonoReflectionCustomAttr *cattr;
+       MonoReflectionEvent *res;
+       MonoReflectionMonoEvent *mono_event;
 
-       if (!cattrs)
+       mono_error_init (error);
+       CHECK_OBJECT (MonoReflectionEvent *, event, klass);
+       mono_event = (MonoReflectionMonoEvent *)mono_object_new_checked (domain, mono_class_get_mono_event_class (), error);
+       if (!mono_event)
                return NULL;
-       /* FIXME: check in assembly the Run flag is set */
-
-       count = mono_array_length (cattrs);
-
-       /* Skip nonpublic attributes since MS.NET seems to do the same */
-       /* FIXME: This needs to be done more globally */
-       not_visible = 0;
-       for (i = 0; i < count; ++i) {
-               cattr = (MonoReflectionCustomAttr*)mono_array_get (cattrs, gpointer, i);
-               if (!custom_attr_visible (image, cattr))
-                       not_visible ++;
-       }
-
-       int num_attrs = count - not_visible;
-       ainfo = (MonoCustomAttrInfo *)image_g_malloc0 (alloc_img, MONO_SIZEOF_CUSTOM_ATTR_INFO + sizeof (MonoCustomAttrEntry) * num_attrs);
-
-       ainfo->image = image;
-       ainfo->num_attrs = num_attrs;
-       ainfo->cached = alloc_img != NULL;
-       index = 0;
-       for (i = 0; i < count; ++i) {
-               cattr = (MonoReflectionCustomAttr*)mono_array_get (cattrs, gpointer, i);
-               if (custom_attr_visible (image, cattr)) {
-                       unsigned char *saved = (unsigned char *)mono_image_alloc (image, mono_array_length (cattr->data));
-                       memcpy (saved, mono_array_addr (cattr->data, char, 0), mono_array_length (cattr->data));
-                       ainfo->attrs [index].ctor = cattr->ctor->method;
-                       g_assert (cattr->ctor->method);
-                       ainfo->attrs [index].data = saved;
-                       ainfo->attrs [index].data_size = mono_array_length (cattr->data);
-                       index ++;
-               }
-       }
-       g_assert (index == num_attrs && count == num_attrs + not_visible);
-
-       return ainfo;
+       mono_event->klass = klass;
+       mono_event->event = event;
+       res = (MonoReflectionEvent*)mono_event;
+       CACHE_OBJECT (MonoReflectionEvent *, event, res, klass);
 }
 
-#ifndef DISABLE_REFLECTION_EMIT
-/*
- * LOCKING: Acquires the loader lock. 
+/**
+ * mono_get_reflection_missing_object:
+ * @domain: Domain where the object lives
+ *
+ * Returns the System.Reflection.Missing.Value singleton object
+ * (of type System.Reflection.Missing).
+ *
+ * Used as the value for ParameterInfo.DefaultValue when Optional
+ * is present
  */
-static void
-mono_save_custom_attrs (MonoImage *image, void *obj, MonoArray *cattrs)
+static MonoObject *
+mono_get_reflection_missing_object (MonoDomain *domain)
 {
-       MONO_REQ_GC_UNSAFE_MODE;
-
-       MonoCustomAttrInfo *ainfo, *tmp;
-
-       if (!cattrs || !mono_array_length (cattrs))
-               return;
-
-       ainfo = mono_custom_attrs_from_builders (image, image, cattrs);
-
-       mono_loader_lock ();
-       tmp = (MonoCustomAttrInfo *)mono_image_property_lookup (image, obj, MONO_PROP_DYNAMIC_CATTR);
-       if (tmp)
-               mono_custom_attrs_free (tmp);
-       mono_image_property_insert (image, obj, MONO_PROP_DYNAMIC_CATTR, ainfo);
-       mono_loader_unlock ();
-
+       MonoError error;
+       MonoObject *obj;
+       static MonoClassField *missing_value_field = NULL;
+       
+       if (!missing_value_field) {
+               MonoClass *missing_klass;
+               missing_klass = mono_class_get_missing_class ();
+               mono_class_init (missing_klass);
+               missing_value_field = mono_class_get_field_from_name (missing_klass, "Value");
+               g_assert (missing_value_field);
+       }
+       obj = mono_field_get_value_object_checked (domain, missing_value_field, NULL, &error);
+       mono_error_assert_ok (&error);
+       return obj;
 }
-#endif
 
-void
-mono_custom_attrs_free (MonoCustomAttrInfo *ainfo)
+static MonoObject*
+get_dbnull (MonoDomain *domain, MonoObject **dbnull)
 {
-       MONO_REQ_GC_NEUTRAL_MODE;
+       if (!*dbnull)
+               *dbnull = mono_get_dbnull_object (domain);
+       return *dbnull;
+}
 
-       if (ainfo && !ainfo->cached)
-               g_free (ainfo);
+static MonoObject*
+get_reflection_missing (MonoDomain *domain, MonoObject **reflection_missing)
+{
+       if (!*reflection_missing)
+               *reflection_missing = mono_get_reflection_missing_object (domain);
+       return *reflection_missing;
 }
 
 /*
- * idx is the table index of the object
- * type is one of MONO_CUSTOM_ATTR_*
+ * mono_param_get_objects:
+ * @domain: an app domain
+ * @method: a method
+ *
+ * Return an System.Reflection.ParameterInfo array object representing the parameters
+ * in the method @method.
  */
-static gboolean
-mono_image_add_cattrs (MonoDynamicImage *assembly, guint32 idx, guint32 type, MonoArray *cattrs, MonoError *error)
+MonoArray*
+mono_param_get_objects_internal (MonoDomain *domain, MonoMethod *method, MonoClass *refclass, MonoError *error)
 {
-       MONO_REQ_GC_UNSAFE_MODE;
+       static MonoClass *System_Reflection_ParameterInfo;
+       static MonoClass *System_Reflection_ParameterInfo_array;
+       MonoArray *res = NULL;
+       MonoReflectionMethod *member = NULL;
+       MonoReflectionParameter *param = NULL;
+       char **names = NULL, **blobs = NULL;
+       guint32 *types = NULL;
+       MonoType *type = NULL;
+       MonoObject *dbnull = NULL;
+       MonoObject *missing = NULL;
+       MonoMarshalSpec **mspecs = NULL;
+       MonoMethodSignature *sig = NULL;
+       MonoVTable *pinfo_vtable;
+       MonoReflectionType *rt;
+       int i;
 
-       MonoDynamicTable *table;
-       MonoReflectionCustomAttr *cattr;
-       guint32 *values;
-       guint32 count, i, token;
-       char blob_size [6];
-       char *p = blob_size;
-       
        mono_error_init (error);
+       
+       if (!System_Reflection_ParameterInfo_array) {
+               MonoClass *klass;
 
-       /* it is legal to pass a NULL cattrs: we avoid to use the if in a lot of places */
-       if (!cattrs)
-               return TRUE;
-       count = mono_array_length (cattrs);
-       table = &assembly->tables [MONO_TABLE_CUSTOMATTRIBUTE];
-       table->rows += count;
-       alloc_table (table, table->rows);
-       values = table->values + table->next_idx * MONO_CUSTOM_ATTR_SIZE;
-       idx <<= MONO_CUSTOM_ATTR_BITS;
-       idx |= type;
-       for (i = 0; i < count; ++i) {
-               cattr = (MonoReflectionCustomAttr*)mono_array_get (cattrs, gpointer, i);
-               values [MONO_CUSTOM_ATTR_PARENT] = idx;
-               token = mono_image_create_token (assembly, (MonoObject*)cattr->ctor, FALSE, FALSE, error);
-               if (!mono_error_ok (error)) goto fail;
-               type = mono_metadata_token_index (token);
-               type <<= MONO_CUSTOM_ATTR_TYPE_BITS;
-               switch (mono_metadata_token_table (token)) {
-               case MONO_TABLE_METHOD:
-                       type |= MONO_CUSTOM_ATTR_TYPE_METHODDEF;
-                       /*
-                        * fixup_cattrs () needs to fix this up. We can't use image->tokens, since it contains the old token for the
-                        * method, not the one returned by mono_image_create_token ().
-                        */
-                       mono_g_hash_table_insert (assembly->remapped_tokens, GUINT_TO_POINTER (token), cattr->ctor);
-                       break;
-               case MONO_TABLE_MEMBERREF:
-                       type |= MONO_CUSTOM_ATTR_TYPE_MEMBERREF;
-                       break;
-               default:
-                       g_warning ("got wrong token in custom attr");
-                       continue;
-               }
-               values [MONO_CUSTOM_ATTR_TYPE] = type;
-               p = blob_size;
-               mono_metadata_encode_value (mono_array_length (cattr->data), p, &p);
-               values [MONO_CUSTOM_ATTR_VALUE] = add_to_blob_cached (assembly, blob_size, p - blob_size,
-                       mono_array_addr (cattr->data, char, 0), mono_array_length (cattr->data));
-               values += MONO_CUSTOM_ATTR_SIZE;
-               ++table->next_idx;
-       }
-
-       return TRUE;
+               klass = mono_class_get_mono_parameter_info_class ();
 
-fail:
-       return FALSE;
-}
+               mono_memory_barrier ();
+               System_Reflection_ParameterInfo = klass; 
 
-static void
-mono_image_add_decl_security (MonoDynamicImage *assembly, guint32 parent_token, MonoArray *permissions)
-{
-       MONO_REQ_GC_UNSAFE_MODE;
+       
+               klass = mono_array_class_get (klass, 1);
+               mono_memory_barrier ();
+               System_Reflection_ParameterInfo_array = klass;
+       }
 
-       MonoDynamicTable *table;
-       guint32 *values;
-       guint32 count, i, idx;
-       MonoReflectionPermissionSet *perm;
+       sig = mono_method_signature_checked (method, error);
+       if (!mono_error_ok (error))
+               goto leave;
 
-       if (!permissions)
-               return;
+       if (!sig->param_count) {
+               res = mono_array_new_specific_checked (mono_class_vtable (domain, System_Reflection_ParameterInfo_array), 0, error);
+               if (!res)
+                       goto leave;
 
-       count = mono_array_length (permissions);
-       table = &assembly->tables [MONO_TABLE_DECLSECURITY];
-       table->rows += count;
-       alloc_table (table, table->rows);
+               return res;
+       }
 
-       for (i = 0; i < mono_array_length (permissions); ++i) {
-               perm = (MonoReflectionPermissionSet*)mono_array_addr (permissions, MonoReflectionPermissionSet, i);
+       /* Note: the cache is based on the address of the signature into the method
+        * since we already cache MethodInfos with the method as keys.
+        */
+       CHECK_OBJECT (MonoArray*, &(method->signature), refclass);
 
-               values = table->values + table->next_idx * MONO_DECL_SECURITY_SIZE;
+       member = mono_method_get_object_checked (domain, method, refclass, error);
+       if (!member)
+               goto leave;
+       names = g_new (char *, sig->param_count);
+       mono_method_get_param_names (method, (const char **) names);
 
-               idx = mono_metadata_token_index (parent_token);
-               idx <<= MONO_HAS_DECL_SECURITY_BITS;
-               switch (mono_metadata_token_table (parent_token)) {
-               case MONO_TABLE_TYPEDEF:
-                       idx |= MONO_HAS_DECL_SECURITY_TYPEDEF;
-                       break;
-               case MONO_TABLE_METHOD:
-                       idx |= MONO_HAS_DECL_SECURITY_METHODDEF;
-                       break;
-               case MONO_TABLE_ASSEMBLY:
-                       idx |= MONO_HAS_DECL_SECURITY_ASSEMBLY;
-                       break;
-               default:
-                       g_assert_not_reached ();
-               }
+       mspecs = g_new (MonoMarshalSpec*, sig->param_count + 1);
+       mono_method_get_marshal_info (method, mspecs);
 
-               values [MONO_DECL_SECURITY_ACTION] = perm->action;
-               values [MONO_DECL_SECURITY_PARENT] = idx;
-               values [MONO_DECL_SECURITY_PERMISSIONSET] = add_mono_string_to_blob_cached (assembly, perm->pset);
+       res = mono_array_new_specific_checked (mono_class_vtable (domain, System_Reflection_ParameterInfo_array), sig->param_count, error);
+       if (!res)
+               goto leave;
 
-               ++table->next_idx;
-       }
-}
+       pinfo_vtable = mono_class_vtable (domain, System_Reflection_ParameterInfo);
+       for (i = 0; i < sig->param_count; ++i) {
+               param = (MonoReflectionParameter *) mono_object_new_specific_checked (pinfo_vtable, error);
+               if (!param)
+                       goto leave;
 
-/*
- * Fill in the MethodDef and ParamDef tables for a method.
- * This is used for both normal methods and constructors.
- */
-static gboolean
-mono_image_basic_method (ReflectionMethodBuilder *mb, MonoDynamicImage *assembly, MonoError *error)
-{
-       MONO_REQ_GC_UNSAFE_MODE;
+               rt = mono_type_get_object_checked (domain, sig->params [i], error);
+               if (!rt)
+                       goto leave;
 
-       MonoDynamicTable *table;
-       guint32 *values;
-       guint i, count;
+               MONO_OBJECT_SETREF (param, ClassImpl, rt);
 
-       mono_error_init (error);
+               MONO_OBJECT_SETREF (param, MemberImpl, (MonoObject*)member);
 
-       /* room in this table is already allocated */
-       table = &assembly->tables [MONO_TABLE_METHOD];
-       *mb->table_idx = table->next_idx ++;
-       g_hash_table_insert (assembly->method_to_table_idx, mb->mhandle, GUINT_TO_POINTER ((*mb->table_idx)));
-       values = table->values + *mb->table_idx * MONO_METHOD_SIZE;
-       values [MONO_METHOD_NAME] = string_heap_insert_mstring (&assembly->sheap, mb->name, error);
-       return_val_if_nok (error, FALSE);
-       values [MONO_METHOD_FLAGS] = mb->attrs;
-       values [MONO_METHOD_IMPLFLAGS] = mb->iattrs;
-       values [MONO_METHOD_SIGNATURE] = method_builder_encode_signature (assembly, mb, error);
-       return_val_if_nok (error, FALSE);
-       values [MONO_METHOD_RVA] = method_encode_code (assembly, mb, error);
-       return_val_if_nok (error, FALSE);
+               MONO_OBJECT_SETREF (param, NameImpl, mono_string_new (domain, names [i]));
 
-       table = &assembly->tables [MONO_TABLE_PARAM];
-       values [MONO_METHOD_PARAMLIST] = table->next_idx;
+               param->PositionImpl = i;
+               param->AttrsImpl = sig->params [i]->attrs;
 
-       mono_image_add_decl_security (assembly, 
-               mono_metadata_make_token (MONO_TABLE_METHOD, *mb->table_idx), mb->permissions);
+               if (!(param->AttrsImpl & PARAM_ATTRIBUTE_HAS_DEFAULT)) {
+                       if (param->AttrsImpl & PARAM_ATTRIBUTE_OPTIONAL)
+                               MONO_OBJECT_SETREF (param, DefaultValueImpl, get_reflection_missing (domain, &missing));
+                       else
+                               MONO_OBJECT_SETREF (param, DefaultValueImpl, get_dbnull (domain, &dbnull));
+               } else {
 
-       if (mb->pinfo) {
-               MonoDynamicTable *mtable;
-               guint32 *mvalues;
-               
-               mtable = &assembly->tables [MONO_TABLE_FIELDMARSHAL];
-               mvalues = mtable->values + mtable->next_idx * MONO_FIELD_MARSHAL_SIZE;
-               
-               count = 0;
-               for (i = 0; i < mono_array_length (mb->pinfo); ++i) {
-                       if (mono_array_get (mb->pinfo, gpointer, i))
-                               count++;
-               }
-               table->rows += count;
-               alloc_table (table, table->rows);
-               values = table->values + table->next_idx * MONO_PARAM_SIZE;
-               for (i = 0; i < mono_array_length (mb->pinfo); ++i) {
-                       MonoReflectionParamBuilder *pb;
-                       if ((pb = mono_array_get (mb->pinfo, MonoReflectionParamBuilder*, i))) {
-                               values [MONO_PARAM_FLAGS] = pb->attrs;
-                               values [MONO_PARAM_SEQUENCE] = i;
-                               if (pb->name != NULL) {
-                                       values [MONO_PARAM_NAME] = string_heap_insert_mstring (&assembly->sheap, pb->name, error);
-                                       return_val_if_nok (error, FALSE);
-                               } else {
-                                       values [MONO_PARAM_NAME] = 0;
-                               }
-                               values += MONO_PARAM_SIZE;
-                               if (pb->marshal_info) {
-                                       mtable->rows++;
-                                       alloc_table (mtable, mtable->rows);
-                                       mvalues = mtable->values + mtable->rows * MONO_FIELD_MARSHAL_SIZE;
-                                       mvalues [MONO_FIELD_MARSHAL_PARENT] = (table->next_idx << MONO_HAS_FIELD_MARSHAL_BITS) | MONO_HAS_FIELD_MARSHAL_PARAMDEF;
-                                       mvalues [MONO_FIELD_MARSHAL_NATIVE_TYPE] = encode_marshal_blob (assembly, pb->marshal_info, error);
-                                       return_val_if_nok (error, FALSE);
-                               }
-                               pb->table_idx = table->next_idx++;
-                               if (pb->attrs & PARAM_ATTRIBUTE_HAS_DEFAULT) {
-                                       guint32 field_type = 0;
-                                       mtable = &assembly->tables [MONO_TABLE_CONSTANT];
-                                       mtable->rows ++;
-                                       alloc_table (mtable, mtable->rows);
-                                       mvalues = mtable->values + mtable->rows * MONO_CONSTANT_SIZE;
-                                       mvalues [MONO_CONSTANT_PARENT] = MONO_HASCONSTANT_PARAM | (pb->table_idx << MONO_HASCONSTANT_BITS);
-                                       mvalues [MONO_CONSTANT_VALUE] = encode_constant (assembly, pb->def_value, &field_type);
-                                       mvalues [MONO_CONSTANT_TYPE] = field_type;
-                                       mvalues [MONO_CONSTANT_PADDING] = 0;
-                               }
+                       if (!blobs) {
+                               blobs = g_new0 (char *, sig->param_count);
+                               types = g_new0 (guint32, sig->param_count);
+                               get_default_param_value_blobs (method, blobs, types); 
                        }
-               }
-       }
-
-       return TRUE;
-}
-
-#ifndef DISABLE_REFLECTION_EMIT
-static gboolean
-reflection_methodbuilder_from_method_builder (ReflectionMethodBuilder *rmb, MonoReflectionMethodBuilder *mb, MonoError *error)
-{
-       MONO_REQ_GC_UNSAFE_MODE;
-
-       mono_error_init (error);
-       memset (rmb, 0, sizeof (ReflectionMethodBuilder));
 
-       rmb->ilgen = mb->ilgen;
-       rmb->rtype = mono_reflection_type_resolve_user_types ((MonoReflectionType*)mb->rtype, error);
-       return_val_if_nok (error, FALSE);
-       rmb->parameters = mb->parameters;
-       rmb->generic_params = mb->generic_params;
-       rmb->generic_container = mb->generic_container;
-       rmb->opt_types = NULL;
-       rmb->pinfo = mb->pinfo;
-       rmb->attrs = mb->attrs;
-       rmb->iattrs = mb->iattrs;
-       rmb->call_conv = mb->call_conv;
-       rmb->code = mb->code;
-       rmb->type = mb->type;
-       rmb->name = mb->name;
-       rmb->table_idx = &mb->table_idx;
-       rmb->init_locals = mb->init_locals;
-       rmb->skip_visibility = FALSE;
-       rmb->return_modreq = mb->return_modreq;
-       rmb->return_modopt = mb->return_modopt;
-       rmb->param_modreq = mb->param_modreq;
-       rmb->param_modopt = mb->param_modopt;
-       rmb->permissions = mb->permissions;
-       rmb->mhandle = mb->mhandle;
-       rmb->nrefs = 0;
-       rmb->refs = NULL;
-
-       if (mb->dll) {
-               rmb->charset = mb->charset;
-               rmb->extra_flags = mb->extra_flags;
-               rmb->native_cc = mb->native_cc;
-               rmb->dllentry = mb->dllentry;
-               rmb->dll = mb->dll;
-       }
+                       /* Build MonoType for the type from the Constant Table */
+                       if (!type)
+                               type = g_new0 (MonoType, 1);
+                       type->type = (MonoTypeEnum)types [i];
+                       type->data.klass = NULL;
+                       if (types [i] == MONO_TYPE_CLASS)
+                               type->data.klass = mono_defaults.object_class;
+                       else if ((sig->params [i]->type == MONO_TYPE_VALUETYPE) && sig->params [i]->data.klass->enumtype) {
+                               /* For enums, types [i] contains the base type */
 
-       return TRUE;
-}
+                                       type->type = MONO_TYPE_VALUETYPE;
+                                       type->data.klass = mono_class_from_mono_type (sig->params [i]);
+                       } else
+                               type->data.klass = mono_class_from_mono_type (type);
 
-static gboolean
-reflection_methodbuilder_from_ctor_builder (ReflectionMethodBuilder *rmb, MonoReflectionCtorBuilder *mb, MonoError *error)
-{
-       MONO_REQ_GC_UNSAFE_MODE;
+                       MonoObject *default_val_obj = mono_get_object_from_blob (domain, type, blobs [i], error);
+                       if (!is_ok (error))
+                               goto leave;
+                       MONO_OBJECT_SETREF (param, DefaultValueImpl, default_val_obj);
 
-       const char *name = mb->attrs & METHOD_ATTRIBUTE_STATIC ? ".cctor": ".ctor";
+                       /* Type in the Constant table is MONO_TYPE_CLASS for nulls */
+                       if (types [i] != MONO_TYPE_CLASS && !param->DefaultValueImpl) {
+                               if (param->AttrsImpl & PARAM_ATTRIBUTE_OPTIONAL)
+                                       MONO_OBJECT_SETREF (param, DefaultValueImpl, get_reflection_missing (domain, &missing));
+                               else
+                                       MONO_OBJECT_SETREF (param, DefaultValueImpl, get_dbnull (domain, &dbnull));
+                       }
+                       
+               }
 
-       mono_error_init (error);
+               if (mspecs [i + 1]) {
+                       MonoReflectionMarshalAsAttribute* mobj;
+                       mobj = mono_reflection_marshal_as_attribute_from_marshal_spec (domain, method->klass, mspecs [i + 1], error);
+                       if (!mobj)
+                               goto leave;
+                       MONO_OBJECT_SETREF (param, MarshalAsImpl, (MonoObject*)mobj);
+               }
+               
+               mono_array_setref (res, i, param);
+       }
+
+leave:
+       g_free (names);
+       g_free (blobs);
+       g_free (types);
+       g_free (type);
 
-       memset (rmb, 0, sizeof (ReflectionMethodBuilder));
+       if (sig) {
+               for (i = sig->param_count; i >= 0; i--) {
+                       if (mspecs [i])
+                               mono_metadata_free_marshal_spec (mspecs [i]);
+               }
+       }
+       g_free (mspecs);
 
-       rmb->ilgen = mb->ilgen;
-       rmb->rtype = mono_type_get_object_checked (mono_domain_get (), &mono_defaults.void_class->byval_arg, error);
-       return_val_if_nok (error, FALSE);
-       rmb->parameters = mb->parameters;
-       rmb->generic_params = NULL;
-       rmb->generic_container = NULL;
-       rmb->opt_types = NULL;
-       rmb->pinfo = mb->pinfo;
-       rmb->attrs = mb->attrs;
-       rmb->iattrs = mb->iattrs;
-       rmb->call_conv = mb->call_conv;
-       rmb->code = NULL;
-       rmb->type = mb->type;
-       rmb->name = mono_string_new (mono_domain_get (), name);
-       rmb->table_idx = &mb->table_idx;
-       rmb->init_locals = mb->init_locals;
-       rmb->skip_visibility = FALSE;
-       rmb->return_modreq = NULL;
-       rmb->return_modopt = NULL;
-       rmb->param_modreq = mb->param_modreq;
-       rmb->param_modopt = mb->param_modopt;
-       rmb->permissions = mb->permissions;
-       rmb->mhandle = mb->mhandle;
-       rmb->nrefs = 0;
-       rmb->refs = NULL;
-
-       return TRUE;
+       if (!is_ok (error))
+               return NULL;
+       
+       CACHE_OBJECT (MonoArray *, &(method->signature), res, refclass);
 }
 
-static void
-reflection_methodbuilder_from_dynamic_method (ReflectionMethodBuilder *rmb, MonoReflectionDynamicMethod *mb)
+MonoArray*
+mono_param_get_objects (MonoDomain *domain, MonoMethod *method)
 {
-       MONO_REQ_GC_UNSAFE_MODE;
-
-       memset (rmb, 0, sizeof (ReflectionMethodBuilder));
-
-       rmb->ilgen = mb->ilgen;
-       rmb->rtype = mb->rtype;
-       rmb->parameters = mb->parameters;
-       rmb->generic_params = NULL;
-       rmb->generic_container = NULL;
-       rmb->opt_types = NULL;
-       rmb->pinfo = NULL;
-       rmb->attrs = mb->attrs;
-       rmb->iattrs = 0;
-       rmb->call_conv = mb->call_conv;
-       rmb->code = NULL;
-       rmb->type = (MonoObject *) mb->owner;
-       rmb->name = mb->name;
-       rmb->table_idx = NULL;
-       rmb->init_locals = mb->init_locals;
-       rmb->skip_visibility = mb->skip_visibility;
-       rmb->return_modreq = NULL;
-       rmb->return_modopt = NULL;
-       rmb->param_modreq = NULL;
-       rmb->param_modopt = NULL;
-       rmb->permissions = NULL;
-       rmb->mhandle = mb->mhandle;
-       rmb->nrefs = 0;
-       rmb->refs = NULL;
-}      
-#endif
+       MonoError error;
+       MonoArray *result = mono_param_get_objects_internal (domain, method, NULL, &error);
+       mono_error_assert_ok (&error);
+       return result;
+}
 
-static gboolean
-mono_image_add_methodimpl (MonoDynamicImage *assembly, MonoReflectionMethodBuilder *mb, MonoError *error)
+/*
+ * mono_method_body_get_object:
+ * @domain: an app domain
+ * @method: a method
+ *
+ * Return an System.Reflection.MethodBody object representing the method @method.
+ */
+MonoReflectionMethodBody*
+mono_method_body_get_object (MonoDomain *domain, MonoMethod *method)
 {
-       MONO_REQ_GC_UNSAFE_MODE;
+       MonoError error;
+       MonoReflectionMethodBody *result = mono_method_body_get_object_checked (domain, method, &error);
+       mono_error_cleanup (&error);
+       return result;
+}
 
-       MonoReflectionTypeBuilder *tb = (MonoReflectionTypeBuilder *)mb->type;
-       MonoDynamicTable *table;
-       guint32 *values;
-       guint32 tok;
-       MonoReflectionMethod *m;
+/**
+ * mono_method_body_get_object_checked:
+ * @domain: an app domain
+ * @method: a method
+ * @error: set on error
+ *
+ * Return an System.Reflection.MethodBody object representing the
+ * method @method.  On failure, returns NULL and sets @error.
+ */
+MonoReflectionMethodBody*
+mono_method_body_get_object_checked (MonoDomain *domain, MonoMethod *method, MonoError *error)
+{
+       MonoReflectionMethodBody *ret;
+       MonoMethodHeader *header;
+       MonoImage *image;
+       MonoReflectionType *rt;
+       guint32 method_rva, local_var_sig_token;
+       char *ptr;
+       unsigned char format, flags;
        int i;
 
        mono_error_init (error);
 
-       if (!mb->override_methods)
-               return TRUE;
+       /* for compatibility with .net */
+       if (method_is_dynamic (method)) {
+               mono_error_set_generic_error (error, "System", "InvalidOperationException", "");
+               return NULL;
+       }
 
-       for (i = 0; i < mono_array_length (mb->override_methods); ++i) {
-               m = mono_array_get (mb->override_methods, MonoReflectionMethod*, i);
+       CHECK_OBJECT (MonoReflectionMethodBody *, method, NULL);
 
-               table = &assembly->tables [MONO_TABLE_METHODIMPL];
-               table->rows ++;
-               alloc_table (table, table->rows);
-               values = table->values + table->rows * MONO_METHODIMPL_SIZE;
-               values [MONO_METHODIMPL_CLASS] = tb->table_idx;
-               values [MONO_METHODIMPL_BODY] = MONO_METHODDEFORREF_METHODDEF | (mb->table_idx << MONO_METHODDEFORREF_BITS);
+       if ((method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL) ||
+               (method->flags & METHOD_ATTRIBUTE_ABSTRACT) ||
+           (method->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL) ||
+               (method->klass->image->raw_data && method->klass->image->raw_data [1] != 'Z') ||
+           (method->iflags & METHOD_IMPL_ATTRIBUTE_RUNTIME))
+               return NULL;
 
-               tok = mono_image_create_token (assembly, (MonoObject*)m, FALSE, FALSE, error);
-               return_val_if_nok (error, FALSE);
+       image = method->klass->image;
+       header = mono_method_get_header_checked (method, error);
+       return_val_if_nok (error, NULL);
 
-               switch (mono_metadata_token_table (tok)) {
-               case MONO_TABLE_MEMBERREF:
-                       tok = (mono_metadata_token_index (tok) << MONO_METHODDEFORREF_BITS ) | MONO_METHODDEFORREF_METHODREF;
+       if (!image_is_dynamic (image)) {
+               /* Obtain local vars signature token */
+               method_rva = mono_metadata_decode_row_col (&image->tables [MONO_TABLE_METHOD], mono_metadata_token_index (method->token) - 1, MONO_METHOD_RVA);
+               ptr = mono_image_rva_map (image, method_rva);
+               flags = *(const unsigned char *) ptr;
+               format = flags & METHOD_HEADER_FORMAT_MASK;
+               switch (format){
+               case METHOD_HEADER_TINY_FORMAT:
+                       local_var_sig_token = 0;
                        break;
-               case MONO_TABLE_METHOD:
-                       tok = (mono_metadata_token_index (tok) << MONO_METHODDEFORREF_BITS ) | MONO_METHODDEFORREF_METHODDEF;
+               case METHOD_HEADER_FAT_FORMAT:
+                       ptr += 2;
+                       ptr += 2;
+                       ptr += 4;
+                       local_var_sig_token = read32 (ptr);
                        break;
                default:
                        g_assert_not_reached ();
                }
-               values [MONO_METHODIMPL_DECLARATION] = tok;
-       }
-
-       return TRUE;
-}
-
-#ifndef DISABLE_REFLECTION_EMIT
-static gboolean
-mono_image_get_method_info (MonoReflectionMethodBuilder *mb, MonoDynamicImage *assembly, MonoError *error)
-{
-       MONO_REQ_GC_UNSAFE_MODE;
+       } else
+               local_var_sig_token = 0; //FIXME
 
-       MonoDynamicTable *table;
-       guint32 *values;
-       ReflectionMethodBuilder rmb;
-       int i;
+       ret = (MonoReflectionMethodBody*)mono_object_new_checked (domain, mono_class_get_method_body_class (), error);
+       if (!is_ok (error))
+               goto fail;
 
-       mono_error_init (error);
+       ret->init_locals = header->init_locals;
+       ret->max_stack = header->max_stack;
+       ret->local_var_sig_token = local_var_sig_token;
+       MonoArray *il_arr = mono_array_new_cached (domain, mono_defaults.byte_class, header->code_size, error);
+       if (!is_ok (error))
+               goto fail;
+       MONO_OBJECT_SETREF (ret, il, il_arr);
+       memcpy (mono_array_addr (ret->il, guint8, 0), header->code, header->code_size);
 
-       if (!reflection_methodbuilder_from_method_builder (&rmb, mb, error) ||
-           !mono_image_basic_method (&rmb, assembly, error))
-               return FALSE;
+       /* Locals */
+       MonoArray *locals_arr = mono_array_new_cached (domain, mono_class_get_local_variable_info_class (), header->num_locals, error);
+       if (!is_ok (error))
+               goto fail;
+       MONO_OBJECT_SETREF (ret, locals, locals_arr);
+       for (i = 0; i < header->num_locals; ++i) {
+               MonoReflectionLocalVariableInfo *info = (MonoReflectionLocalVariableInfo*)mono_object_new_checked (domain, mono_class_get_local_variable_info_class (), error);
+               if (!is_ok (error))
+                       goto fail;
 
-       mb->table_idx = *rmb.table_idx;
-
-       if (mb->dll) { /* It's a P/Invoke method */
-               guint32 moduleref;
-               /* map CharSet values to on-disk values */
-               int ncharset = (mb->charset ? (mb->charset - 1) * 2 : 0);
-               int extra_flags = mb->extra_flags;
-               table = &assembly->tables [MONO_TABLE_IMPLMAP];
-               table->rows ++;
-               alloc_table (table, table->rows);
-               values = table->values + table->rows * MONO_IMPLMAP_SIZE;
-               
-               values [MONO_IMPLMAP_FLAGS] = (mb->native_cc << 8) | ncharset | extra_flags;
-               values [MONO_IMPLMAP_MEMBER] = (mb->table_idx << 1) | 1; /* memberforwarded: method */
-               if (mb->dllentry) {
-                       values [MONO_IMPLMAP_NAME] = string_heap_insert_mstring (&assembly->sheap, mb->dllentry, error);
-                       return_val_if_nok (error, FALSE);
-               } else {
-                       values [MONO_IMPLMAP_NAME] = string_heap_insert_mstring (&assembly->sheap, mb->name, error);
-                       return_val_if_nok (error, FALSE);
-               }
-               moduleref = string_heap_insert_mstring (&assembly->sheap, mb->dll, error);
-               return_val_if_nok (error, FALSE);
-               if (!(values [MONO_IMPLMAP_SCOPE] = find_index_in_table (assembly, MONO_TABLE_MODULEREF, MONO_MODULEREF_NAME, moduleref))) {
-                       table = &assembly->tables [MONO_TABLE_MODULEREF];
-                       table->rows ++;
-                       alloc_table (table, table->rows);
-                       table->values [table->rows * MONO_MODULEREF_SIZE + MONO_MODULEREF_NAME] = moduleref;
-                       values [MONO_IMPLMAP_SCOPE] = table->rows;
-               }
-       }
+               rt = mono_type_get_object_checked (domain, header->locals [i], error);
+               if (!is_ok (error))
+                       goto fail;
 
-       if (mb->generic_params) {
-               table = &assembly->tables [MONO_TABLE_GENERICPARAM];
-               table->rows += mono_array_length (mb->generic_params);
-               alloc_table (table, table->rows);
-               for (i = 0; i < mono_array_length (mb->generic_params); ++i) {
-                       guint32 owner = MONO_TYPEORMETHOD_METHOD | (mb->table_idx << MONO_TYPEORMETHOD_BITS);
+               MONO_OBJECT_SETREF (info, local_type, rt);
 
-                       mono_image_get_generic_param_info (
-                               (MonoReflectionGenericParam *)mono_array_get (mb->generic_params, gpointer, i), owner, assembly);
-               }
+               info->is_pinned = header->locals [i]->pinned;
+               info->local_index = i;
+               mono_array_setref (ret->locals, i, info);
        }
 
-       return TRUE;
-}
-
-static gboolean
-mono_image_get_ctor_info (MonoDomain *domain, MonoReflectionCtorBuilder *mb, MonoDynamicImage *assembly, MonoError *error)
-{
-       MONO_REQ_GC_UNSAFE_MODE;
-
-       ReflectionMethodBuilder rmb;
-
-       if (!reflection_methodbuilder_from_ctor_builder (&rmb, mb, error))
-               return FALSE;
+       /* Exceptions */
+       MonoArray *exn_clauses = mono_array_new_cached (domain, mono_class_get_exception_handling_clause_class (), header->num_clauses, error);
+       if (!is_ok (error))
+               goto fail;
+       MONO_OBJECT_SETREF (ret, clauses, exn_clauses);
+       for (i = 0; i < header->num_clauses; ++i) {
+               MonoReflectionExceptionHandlingClause *info = (MonoReflectionExceptionHandlingClause*)mono_object_new_checked (domain, mono_class_get_exception_handling_clause_class (), error);
+               if (!is_ok (error))
+                       goto fail;
+               MonoExceptionClause *clause = &header->clauses [i];
 
-       if (!mono_image_basic_method (&rmb, assembly, error))
-               return FALSE;
+               info->flags = clause->flags;
+               info->try_offset = clause->try_offset;
+               info->try_length = clause->try_len;
+               info->handler_offset = clause->handler_offset;
+               info->handler_length = clause->handler_len;
+               if (clause->flags == MONO_EXCEPTION_CLAUSE_FILTER)
+                       info->filter_offset = clause->data.filter_offset;
+               else if (clause->data.catch_class) {
+                       rt = mono_type_get_object_checked (mono_domain_get (), &clause->data.catch_class->byval_arg, error);
+                       if (!is_ok (error))
+                               goto fail;
 
-       mb->table_idx = *rmb.table_idx;
+                       MONO_OBJECT_SETREF (info, catch_type, rt);
+               }
 
-       return TRUE;
-}
-#endif
+               mono_array_setref (ret->clauses, i, info);
+       }
 
-static char*
-type_get_fully_qualified_name (MonoType *type)
-{
-       MONO_REQ_GC_NEUTRAL_MODE;
+       mono_metadata_free_mh (header);
+       CACHE_OBJECT (MonoReflectionMethodBody *, method, ret, NULL);
+       return ret;
 
-       return mono_type_get_name_full (type, MONO_TYPE_NAME_FORMAT_ASSEMBLY_QUALIFIED);
+fail:
+       mono_metadata_free_mh (header);
+       return NULL;
 }
 
-static char*
-type_get_qualified_name (MonoType *type, MonoAssembly *ass)
+/**
+ * mono_get_dbnull_object:
+ * @domain: Domain where the object lives
+ *
+ * Returns the System.DBNull.Value singleton object
+ *
+ * Used as the value for ParameterInfo.DefaultValue 
+ */
+MonoObject *
+mono_get_dbnull_object (MonoDomain *domain)
 {
-       MONO_REQ_GC_UNSAFE_MODE;
-
-       MonoClass *klass;
-       MonoAssembly *ta;
-
-       klass = mono_class_from_mono_type (type);
-       if (!klass) 
-               return mono_type_get_name_full (type, MONO_TYPE_NAME_FORMAT_REFLECTION);
-       ta = klass->image->assembly;
-       if (assembly_is_dynamic (ta) || (ta == ass)) {
-               if (klass->generic_class || klass->generic_container)
-                       /* For generic type definitions, we want T, while REFLECTION returns T<K> */
-                       return mono_type_get_name_full (type, MONO_TYPE_NAME_FORMAT_FULL_NAME);
-               else
-                       return mono_type_get_name_full (type, MONO_TYPE_NAME_FORMAT_REFLECTION);
+       MonoError error;
+       MonoObject *obj;
+       static MonoClassField *dbnull_value_field = NULL;
+       
+       if (!dbnull_value_field) {
+               MonoClass *dbnull_klass;
+               dbnull_klass = mono_class_get_dbnull_class ();
+               dbnull_value_field = mono_class_get_field_from_name (dbnull_klass, "Value");
+               g_assert (dbnull_value_field);
        }
-
-       return mono_type_get_name_full (type, MONO_TYPE_NAME_FORMAT_ASSEMBLY_QUALIFIED);
+       obj = mono_field_get_value_object_checked (domain, dbnull_value_field, NULL, &error);
+       mono_error_assert_ok (&error);
+       return obj;
 }
 
-#ifndef DISABLE_REFLECTION_EMIT
-/*field_image is the image to which the eventual custom mods have been encoded against*/
-static guint32
-fieldref_encode_signature (MonoDynamicImage *assembly, MonoImage *field_image, MonoType *type)
+static void
+get_default_param_value_blobs (MonoMethod *method, char **blobs, guint32 *types)
 {
-       MONO_REQ_GC_NEUTRAL_MODE;
+       guint32 param_index, i, lastp, crow = 0;
+       guint32 param_cols [MONO_PARAM_SIZE], const_cols [MONO_CONSTANT_SIZE];
+       gint32 idx;
 
-       SigBuffer buf;
-       guint32 idx, i, token;
+       MonoClass *klass = method->klass;
+       MonoImage *image = klass->image;
+       MonoMethodSignature *methodsig = mono_method_signature (method);
 
-       if (!assembly->save)
-               return 0;
+       MonoTableInfo *constt;
+       MonoTableInfo *methodt;
+       MonoTableInfo *paramt;
 
-       sigbuffer_init (&buf, 32);
-       
-       sigbuffer_add_value (&buf, 0x06);
-       /* encode custom attributes before the type */
-       if (type->num_mods) {
-               for (i = 0; i < type->num_mods; ++i) {
-                       if (field_image) {
-                               MonoError error;
-                               MonoClass *klass = mono_class_get_checked (field_image, type->modifiers [i].token, &error);
-                               g_assert (mono_error_ok (&error)); /* FIXME don't swallow the error */
-
-                               token = mono_image_typedef_or_ref (assembly, &klass->byval_arg);
-                       } else {
-                               token = type->modifiers [i].token;
-                       }
+       if (!methodsig->param_count)
+               return;
 
-                       if (type->modifiers [i].required)
-                               sigbuffer_add_byte (&buf, MONO_TYPE_CMOD_REQD);
-                       else
-                               sigbuffer_add_byte (&buf, MONO_TYPE_CMOD_OPT);
+       mono_class_init (klass);
 
-                       sigbuffer_add_value (&buf, token);
+       if (image_is_dynamic (klass->image)) {
+               MonoReflectionMethodAux *aux;
+               if (method->is_inflated)
+                       method = ((MonoMethodInflated*)method)->declaring;
+               aux = (MonoReflectionMethodAux *)g_hash_table_lookup (((MonoDynamicImage*)method->klass->image)->method_aux_hash, method);
+               if (aux && aux->param_defaults) {
+                       memcpy (blobs, &(aux->param_defaults [1]), methodsig->param_count * sizeof (char*));
+                       memcpy (types, &(aux->param_default_types [1]), methodsig->param_count * sizeof (guint32));
                }
+               return;
        }
-       encode_type (assembly, type, &buf);
-       idx = sigbuffer_add_to_blob_cached (assembly, &buf);
-       sigbuffer_free (&buf);
-       return idx;
-}
-#endif
-
-static guint32
-field_encode_signature (MonoDynamicImage *assembly, MonoReflectionFieldBuilder *fb, MonoError *error)
-{
-       MONO_REQ_GC_UNSAFE_MODE;
 
-       mono_error_init (error);
-
-       SigBuffer buf;
-       guint32 idx;
-       guint32 typespec = 0;
-       MonoType *type;
-       MonoClass *klass;
-
-       init_type_builder_generics (fb->type, error);
-       return_val_if_nok (error, 0);
+       methodt = &klass->image->tables [MONO_TABLE_METHOD];
+       paramt = &klass->image->tables [MONO_TABLE_PARAM];
+       constt = &image->tables [MONO_TABLE_CONSTANT];
 
-       type = mono_reflection_type_get_handle ((MonoReflectionType*)fb->type, error);
-       return_val_if_nok (error, 0);
-       klass = mono_class_from_mono_type (type);
+       idx = mono_method_get_index (method) - 1;
+       g_assert (idx != -1);
 
-       sigbuffer_init (&buf, 32);
-       
-       sigbuffer_add_value (&buf, 0x06);
-       encode_custom_modifiers (assembly, fb->modreq, fb->modopt, &buf, error);
-       if (!is_ok (error))
-               goto fail;
-       /* encode custom attributes before the type */
+       param_index = mono_metadata_decode_row_col (methodt, idx, MONO_METHOD_PARAMLIST);
+       if (idx + 1 < methodt->rows)
+               lastp = mono_metadata_decode_row_col (methodt, idx + 1, MONO_METHOD_PARAMLIST);
+       else
+               lastp = paramt->rows + 1;
 
-       if (klass->generic_container)
-               typespec = create_typespec (assembly, type);
+       for (i = param_index; i < lastp; ++i) {
+               guint32 paramseq;
 
-       if (typespec) {
-               MonoGenericClass *gclass;
-               gclass = mono_metadata_lookup_generic_class (klass, klass->generic_container->context.class_inst, TRUE);
-               encode_generic_class (assembly, gclass, &buf);
-       } else {
-               encode_type (assembly, type, &buf);
-       }
-       idx = sigbuffer_add_to_blob_cached (assembly, &buf);
-       sigbuffer_free (&buf);
-       return idx;
-fail:
-       sigbuffer_free (&buf);
-       return 0;
-}
+               mono_metadata_decode_row (paramt, i - 1, param_cols, MONO_PARAM_SIZE);
+               paramseq = param_cols [MONO_PARAM_SEQUENCE];
 
-static guint32
-encode_constant (MonoDynamicImage *assembly, MonoObject *val, MonoTypeEnum *ret_type)
-{
-       MONO_REQ_GC_UNSAFE_MODE;
+               if (!(param_cols [MONO_PARAM_FLAGS] & PARAM_ATTRIBUTE_HAS_DEFAULT))
+                       continue;
 
-       char blob_size [64];
-       char *b = blob_size;
-       char *box_val;
-       char* buf;
-       guint32 idx = 0, len = 0, dummy = 0;
-
-       buf = (char *)g_malloc (64);
-       if (!val) {
-               *ret_type = MONO_TYPE_CLASS;
-               len = 4;
-               box_val = (char*)&dummy;
-       } else {
-               box_val = ((char*)val) + sizeof (MonoObject);
-               *ret_type = val->vtable->klass->byval_arg.type;
-       }
-handle_enum:
-       switch (*ret_type) {
-       case MONO_TYPE_BOOLEAN:
-       case MONO_TYPE_U1:
-       case MONO_TYPE_I1:
-               len = 1;
-               break;
-       case MONO_TYPE_CHAR:
-       case MONO_TYPE_U2:
-       case MONO_TYPE_I2:
-               len = 2;
-               break;
-       case MONO_TYPE_U4:
-       case MONO_TYPE_I4:
-       case MONO_TYPE_R4:
-               len = 4;
-               break;
-       case MONO_TYPE_U8:
-       case MONO_TYPE_I8:
-               len = 8;
-               break;
-       case MONO_TYPE_R8:
-               len = 8;
-               break;
-       case MONO_TYPE_VALUETYPE: {
-               MonoClass *klass = val->vtable->klass;
-               
-               if (klass->enumtype) {
-                       *ret_type = mono_class_enum_basetype (klass)->type;
-                       goto handle_enum;
-               } else if (mono_is_corlib_image (klass->image) && strcmp (klass->name_space, "System") == 0 && strcmp (klass->name, "DateTime") == 0) {
-                       len = 8;
-               } else 
-                       g_error ("we can't encode valuetypes, we should have never reached this line");
-               break;
-       }
-       case MONO_TYPE_CLASS:
-               break;
-       case MONO_TYPE_STRING: {
-               MonoString *str = (MonoString*)val;
-               /* there is no signature */
-               len = str->length * 2;
-               mono_metadata_encode_value (len, b, &b);
-#if G_BYTE_ORDER != G_LITTLE_ENDIAN
-               {
-                       char *swapped = g_malloc (2 * mono_string_length (str));
-                       const char *p = (const char*)mono_string_chars (str);
-
-                       swap_with_size (swapped, p, 2, mono_string_length (str));
-                       idx = add_to_blob_cached (assembly, blob_size, b-blob_size, swapped, len);
-                       g_free (swapped);
+               crow = mono_metadata_get_constant_index (image, MONO_TOKEN_PARAM_DEF | i, crow + 1);
+               if (!crow) {
+                       continue;
                }
-#else
-               idx = add_to_blob_cached (assembly, blob_size, b-blob_size, (char*)mono_string_chars (str), len);
-#endif
-
-               g_free (buf);
-               return idx;
-       }
-       case MONO_TYPE_GENERICINST:
-               *ret_type = val->vtable->klass->generic_class->container_class->byval_arg.type;
-               goto handle_enum;
-       default:
-               g_error ("we don't encode constant type 0x%02x yet", *ret_type);
+       
+               mono_metadata_decode_row (constt, crow - 1, const_cols, MONO_CONSTANT_SIZE);
+               blobs [paramseq - 1] = (char *)mono_metadata_blob_heap (image, const_cols [MONO_CONSTANT_VALUE]);
+               types [paramseq - 1] = const_cols [MONO_CONSTANT_TYPE];
        }
 
-       /* there is no signature */
-       mono_metadata_encode_value (len, b, &b);
-#if G_BYTE_ORDER != G_LITTLE_ENDIAN
-       idx = mono_image_add_stream_data (&assembly->blob, blob_size, b-blob_size);
-       swap_with_size (blob_size, box_val, len, 1);
-       mono_image_add_stream_data (&assembly->blob, blob_size, len);
-#else
-       idx = add_to_blob_cached (assembly, blob_size, b-blob_size, box_val, len);
-#endif
-
-       g_free (buf);
-       return idx;
+       return;
 }
 
-static guint32
-encode_marshal_blob (MonoDynamicImage *assembly, MonoReflectionMarshal *minfo, MonoError *error)
+MonoObject *
+mono_get_object_from_blob (MonoDomain *domain, MonoType *type, const char *blob, MonoError *error)
 {
-       MONO_REQ_GC_UNSAFE_MODE;
+       void *retval;
+       MonoClass *klass;
+       MonoObject *object;
+       MonoType *basetype = type;
 
        mono_error_init (error);
 
-       char *str;
-       SigBuffer buf;
-       guint32 idx, len;
-
-       sigbuffer_init (&buf, 32);
+       if (!blob)
+               return NULL;
+       
+       klass = mono_class_from_mono_type (type);
+       if (klass->valuetype) {
+               object = mono_object_new_checked (domain, klass, error);
+               return_val_if_nok (error, NULL);
+               retval = ((gchar *) object + sizeof (MonoObject));
+               if (klass->enumtype)
+                       basetype = mono_class_enum_basetype (klass);
+       } else {
+               retval = &object;
+       }
+                       
+       if (!mono_get_constant_value_from_blob (domain, basetype->type,  blob, retval, error))
+               return object;
+       else
+               return NULL;
+}
 
-       sigbuffer_add_value (&buf, minfo->type);
+static int
+assembly_name_to_aname (MonoAssemblyName *assembly, char *p) {
+       int found_sep;
+       char *s;
+       gboolean quoted = FALSE;
 
-       switch (minfo->type) {
-       case MONO_NATIVE_BYVALTSTR:
-       case MONO_NATIVE_BYVALARRAY:
-               sigbuffer_add_value (&buf, minfo->count);
-               break;
-       case MONO_NATIVE_LPARRAY:
-               if (minfo->eltype || minfo->has_size) {
-                       sigbuffer_add_value (&buf, minfo->eltype);
-                       if (minfo->has_size) {
-                               sigbuffer_add_value (&buf, minfo->param_num != -1? minfo->param_num: 0);
-                               sigbuffer_add_value (&buf, minfo->count != -1? minfo->count: 0);
+       memset (assembly, 0, sizeof (MonoAssemblyName));
+       assembly->culture = "";
+       memset (assembly->public_key_token, 0, MONO_PUBLIC_KEY_TOKEN_LENGTH);
 
-                               /* LAMESPEC: ElemMult is undocumented */
-                               sigbuffer_add_value (&buf, minfo->param_num != -1? 1: 0);
-                       }
-               }
-               break;
-       case MONO_NATIVE_SAFEARRAY:
-               if (minfo->eltype)
-                       sigbuffer_add_value (&buf, minfo->eltype);
-               break;
-       case MONO_NATIVE_CUSTOM:
-               if (minfo->guid) {
-                       str = mono_string_to_utf8_checked (minfo->guid, error);
-                       if (!is_ok (error)) {
-                               sigbuffer_free (&buf);
-                               return 0;
-                       }
-                       len = strlen (str);
-                       sigbuffer_add_value (&buf, len);
-                       sigbuffer_add_mem (&buf, str, len);
-                       g_free (str);
-               } else {
-                       sigbuffer_add_value (&buf, 0);
-               }
-               /* native type name */
-               sigbuffer_add_value (&buf, 0);
-               /* custom marshaler type name */
-               if (minfo->marshaltype || minfo->marshaltyperef) {
-                       if (minfo->marshaltyperef) {
-                               MonoType *marshaltype = mono_reflection_type_get_handle ((MonoReflectionType*)minfo->marshaltyperef, error);
-                               if (!is_ok (error)) {
-                                       sigbuffer_free (&buf);
-                                       return 0;
-                               }
-                               str = type_get_fully_qualified_name (marshaltype);
+       if (*p == '"') {
+               quoted = TRUE;
+               p++;
+       }
+       assembly->name = p;
+       while (*p && (isalnum (*p) || *p == '.' || *p == '-' || *p == '_' || *p == '$' || *p == '@' || g_ascii_isspace (*p)))
+               p++;
+       if (quoted) {
+               if (*p != '"')
+                       return 1;
+               *p = 0;
+               p++;
+       }
+       if (*p != ',')
+               return 1;
+       *p = 0;
+       /* Remove trailing whitespace */
+       s = p - 1;
+       while (*s && g_ascii_isspace (*s))
+               *s-- = 0;
+       p ++;
+       while (g_ascii_isspace (*p))
+               p++;
+       while (*p) {
+               if (*p == 'V' && g_ascii_strncasecmp (p, "Version=", 8) == 0) {
+                       p += 8;
+                       assembly->major = strtoul (p, &s, 10);
+                       if (s == p || *s != '.')
+                               return 1;
+                       p = ++s;
+                       assembly->minor = strtoul (p, &s, 10);
+                       if (s == p || *s != '.')
+                               return 1;
+                       p = ++s;
+                       assembly->build = strtoul (p, &s, 10);
+                       if (s == p || *s != '.')
+                               return 1;
+                       p = ++s;
+                       assembly->revision = strtoul (p, &s, 10);
+                       if (s == p)
+                               return 1;
+                       p = s;
+               } else if (*p == 'C' && g_ascii_strncasecmp (p, "Culture=", 8) == 0) {
+                       p += 8;
+                       if (g_ascii_strncasecmp (p, "neutral", 7) == 0) {
+                               assembly->culture = "";
+                               p += 7;
                        } else {
-                               str = mono_string_to_utf8_checked (minfo->marshaltype, error);
-                               if (!is_ok (error)) {
-                                       sigbuffer_free (&buf);
-                                       return 0;
+                               assembly->culture = p;
+                               while (*p && *p != ',') {
+                                       p++;
                                }
                        }
-                       len = strlen (str);
-                       sigbuffer_add_value (&buf, len);
-                       sigbuffer_add_mem (&buf, str, len);
-                       g_free (str);
-               } else {
-                       /* FIXME: Actually a bug, since this field is required.  Punting for now ... */
-                       sigbuffer_add_value (&buf, 0);
-               }
-               if (minfo->mcookie) {
-                       str = mono_string_to_utf8_checked (minfo->mcookie, error);
-                       if (!is_ok (error)) {
-                               sigbuffer_free (&buf);
-                               return 0;
+               } else if (*p == 'P' && g_ascii_strncasecmp (p, "PublicKeyToken=", 15) == 0) {
+                       p += 15;
+                       if (strncmp (p, "null", 4) == 0) {
+                               p += 4;
+                       } else {
+                               int len;
+                               gchar *start = p;
+                               while (*p && *p != ',') {
+                                       p++;
+                               }
+                               len = (p - start + 1);
+                               if (len > MONO_PUBLIC_KEY_TOKEN_LENGTH)
+                                       len = MONO_PUBLIC_KEY_TOKEN_LENGTH;
+                               g_strlcpy ((char*)assembly->public_key_token, start, len);
                        }
-                       len = strlen (str);
-                       sigbuffer_add_value (&buf, len);
-                       sigbuffer_add_mem (&buf, str, len);
-                       g_free (str);
                } else {
-                       sigbuffer_add_value (&buf, 0);
-               }
-               break;
-       default:
-               break;
-       }
-       idx = sigbuffer_add_to_blob_cached (assembly, &buf);
-       sigbuffer_free (&buf);
-       return idx;
-}
-
-static void
-mono_image_get_field_info (MonoReflectionFieldBuilder *fb, MonoDynamicImage *assembly, MonoError *error)
-{
-       MONO_REQ_GC_UNSAFE_MODE;
-
-       mono_error_init (error);
-
-       MonoDynamicTable *table;
-       guint32 *values;
-
-       /* maybe this fixup should be done in the C# code */
-       if (fb->attrs & FIELD_ATTRIBUTE_LITERAL)
-               fb->attrs |= FIELD_ATTRIBUTE_HAS_DEFAULT;
-       table = &assembly->tables [MONO_TABLE_FIELD];
-       fb->table_idx = table->next_idx ++;
-       g_hash_table_insert (assembly->field_to_table_idx, fb->handle, GUINT_TO_POINTER (fb->table_idx));
-       values = table->values + fb->table_idx * MONO_FIELD_SIZE;
-       values [MONO_FIELD_NAME] = string_heap_insert_mstring (&assembly->sheap, fb->name, error);
-       return_if_nok (error);
-       values [MONO_FIELD_FLAGS] = fb->attrs;
-       values [MONO_FIELD_SIGNATURE] = field_encode_signature (assembly, fb, error);
-       return_if_nok (error);
-
-
-       if (fb->offset != -1) {
-               table = &assembly->tables [MONO_TABLE_FIELDLAYOUT];
-               table->rows ++;
-               alloc_table (table, table->rows);
-               values = table->values + table->rows * MONO_FIELD_LAYOUT_SIZE;
-               values [MONO_FIELD_LAYOUT_FIELD] = fb->table_idx;
-               values [MONO_FIELD_LAYOUT_OFFSET] = fb->offset;
-       }
-       if (fb->attrs & FIELD_ATTRIBUTE_LITERAL) {
-               MonoTypeEnum field_type = (MonoTypeEnum)0;
-               table = &assembly->tables [MONO_TABLE_CONSTANT];
-               table->rows ++;
-               alloc_table (table, table->rows);
-               values = table->values + table->rows * MONO_CONSTANT_SIZE;
-               values [MONO_CONSTANT_PARENT] = MONO_HASCONSTANT_FIEDDEF | (fb->table_idx << MONO_HASCONSTANT_BITS);
-               values [MONO_CONSTANT_VALUE] = encode_constant (assembly, fb->def_value, &field_type);
-               values [MONO_CONSTANT_TYPE] = field_type;
-               values [MONO_CONSTANT_PADDING] = 0;
-       }
-       if (fb->attrs & FIELD_ATTRIBUTE_HAS_FIELD_RVA) {
-               guint32 rva_idx;
-               table = &assembly->tables [MONO_TABLE_FIELDRVA];
-               table->rows ++;
-               alloc_table (table, table->rows);
-               values = table->values + table->rows * MONO_FIELD_RVA_SIZE;
-               values [MONO_FIELD_RVA_FIELD] = fb->table_idx;
-               /*
-                * We store it in the code section because it's simpler for now.
-                */
-               if (fb->rva_data) {
-                       if (mono_array_length (fb->rva_data) >= 10)
-                               stream_data_align (&assembly->code);
-                       rva_idx = mono_image_add_stream_data (&assembly->code, mono_array_addr (fb->rva_data, char, 0), mono_array_length (fb->rva_data));
-               } else
-                       rva_idx = mono_image_add_stream_zero (&assembly->code, mono_class_value_size (fb->handle->parent, NULL));
-               values [MONO_FIELD_RVA_RVA] = rva_idx + assembly->text_rva;
-       }
-       if (fb->marshal_info) {
-               table = &assembly->tables [MONO_TABLE_FIELDMARSHAL];
-               table->rows ++;
-               alloc_table (table, table->rows);
-               values = table->values + table->rows * MONO_FIELD_MARSHAL_SIZE;
-               values [MONO_FIELD_MARSHAL_PARENT] = (fb->table_idx << MONO_HAS_FIELD_MARSHAL_BITS) | MONO_HAS_FIELD_MARSHAL_FIELDSREF;
-               values [MONO_FIELD_MARSHAL_NATIVE_TYPE] = encode_marshal_blob (assembly, fb->marshal_info, error);
-               return_if_nok (error);
-       }
-}
-
-static guint32
-property_encode_signature (MonoDynamicImage *assembly, MonoReflectionPropertyBuilder *fb, MonoError *error)
-{
-       MONO_REQ_GC_UNSAFE_MODE;
-
-       mono_error_init (error);
-
-       SigBuffer buf;
-       guint32 nparams = 0;
-       MonoReflectionMethodBuilder *mb = fb->get_method;
-       MonoReflectionMethodBuilder *smb = fb->set_method;
-       guint32 idx, i;
-
-       if (mb && mb->parameters)
-               nparams = mono_array_length (mb->parameters);
-       if (!mb && smb && smb->parameters)
-               nparams = mono_array_length (smb->parameters) - 1;
-       sigbuffer_init (&buf, 32);
-       if (fb->call_conv & 0x20)
-               sigbuffer_add_byte (&buf, 0x28);
-       else
-               sigbuffer_add_byte (&buf, 0x08);
-       sigbuffer_add_value (&buf, nparams);
-       if (mb) {
-               encode_reflection_type (assembly, (MonoReflectionType*)mb->rtype, &buf, error);
-               if (!is_ok (error))
-                       goto fail;
-               for (i = 0; i < nparams; ++i) {
-                       MonoReflectionType *pt = mono_array_get (mb->parameters, MonoReflectionType*, i);
-                       encode_reflection_type (assembly, pt, &buf, error);
-                       if (!is_ok (error))
-                               goto fail;
+                       while (*p && *p != ',')
+                               p++;
                }
-       } else if (smb && smb->parameters) {
-               /* the property type is the last param */
-               encode_reflection_type (assembly, mono_array_get (smb->parameters, MonoReflectionType*, nparams), &buf, error);
-               if (!is_ok (error))
-                       goto fail;
-
-               for (i = 0; i < nparams; ++i) {
-                       MonoReflectionType *pt = mono_array_get (smb->parameters, MonoReflectionType*, i);
-                       encode_reflection_type (assembly, pt, &buf, error);
-                       if (!is_ok (error))
-                               goto fail;
+               found_sep = 0;
+               while (g_ascii_isspace (*p) || *p == ',') {
+                       *p++ = 0;
+                       found_sep = 1;
+                       continue;
                }
-       } else {
-               encode_reflection_type (assembly, (MonoReflectionType*)fb->type, &buf, error);
-               if (!is_ok (error))
-                       goto fail;
+               /* failed */
+               if (!found_sep)
+                       return 1;
        }
 
-       idx = sigbuffer_add_to_blob_cached (assembly, &buf);
-       sigbuffer_free (&buf);
-       return idx;
-fail:
-       sigbuffer_free (&buf);
        return 0;
 }
 
-static void
-mono_image_get_property_info (MonoReflectionPropertyBuilder *pb, MonoDynamicImage *assembly, MonoError *error)
+/*
+ * mono_reflection_parse_type:
+ * @name: type name
+ *
+ * Parse a type name as accepted by the GetType () method and output the info
+ * extracted in the info structure.
+ * the name param will be mangled, so, make a copy before passing it to this function.
+ * The fields in info will be valid until the memory pointed to by name is valid.
+ *
+ * See also mono_type_get_name () below.
+ *
+ * Returns: 0 on parse error.
+ */
+static int
+_mono_reflection_parse_type (char *name, char **endptr, gboolean is_recursed,
+                            MonoTypeNameParse *info)
 {
-       MONO_REQ_GC_UNSAFE_MODE;
-
-       mono_error_init (error);
-
-       MonoDynamicTable *table;
-       guint32 *values;
-       guint num_methods = 0;
-       guint32 semaidx;
-
-       /* 
-        * we need to set things in the following tables:
-        * PROPERTYMAP (info already filled in _get_type_info ())
-        * PROPERTY    (rows already preallocated in _get_type_info ())
-        * METHOD      (method info already done with the generic method code)
-        * METHODSEMANTICS
-        * CONSTANT
-        */
-       table = &assembly->tables [MONO_TABLE_PROPERTY];
-       pb->table_idx = table->next_idx ++;
-       values = table->values + pb->table_idx * MONO_PROPERTY_SIZE;
-       values [MONO_PROPERTY_NAME] = string_heap_insert_mstring (&assembly->sheap, pb->name, error);
-       return_if_nok (error);
-       values [MONO_PROPERTY_FLAGS] = pb->attrs;
-       values [MONO_PROPERTY_TYPE] = property_encode_signature (assembly, pb, error);
-       return_if_nok (error);
-
-
-       /* FIXME: we still don't handle 'other' methods */
-       if (pb->get_method) num_methods ++;
-       if (pb->set_method) num_methods ++;
-
-       table = &assembly->tables [MONO_TABLE_METHODSEMANTICS];
-       table->rows += num_methods;
-       alloc_table (table, table->rows);
-
-       if (pb->get_method) {
-               semaidx = table->next_idx ++;
-               values = table->values + semaidx * MONO_METHOD_SEMA_SIZE;
-               values [MONO_METHOD_SEMA_SEMANTICS] = METHOD_SEMANTIC_GETTER;
-               values [MONO_METHOD_SEMA_METHOD] = pb->get_method->table_idx;
-               values [MONO_METHOD_SEMA_ASSOCIATION] = (pb->table_idx << MONO_HAS_SEMANTICS_BITS) | MONO_HAS_SEMANTICS_PROPERTY;
-       }
-       if (pb->set_method) {
-               semaidx = table->next_idx ++;
-               values = table->values + semaidx * MONO_METHOD_SEMA_SIZE;
-               values [MONO_METHOD_SEMA_SEMANTICS] = METHOD_SEMANTIC_SETTER;
-               values [MONO_METHOD_SEMA_METHOD] = pb->set_method->table_idx;
-               values [MONO_METHOD_SEMA_ASSOCIATION] = (pb->table_idx << MONO_HAS_SEMANTICS_BITS) | MONO_HAS_SEMANTICS_PROPERTY;
-       }
-       if (pb->attrs & PROPERTY_ATTRIBUTE_HAS_DEFAULT) {
-               MonoTypeEnum field_type = (MonoTypeEnum)0;
-               table = &assembly->tables [MONO_TABLE_CONSTANT];
-               table->rows ++;
-               alloc_table (table, table->rows);
-               values = table->values + table->rows * MONO_CONSTANT_SIZE;
-               values [MONO_CONSTANT_PARENT] = MONO_HASCONSTANT_PROPERTY | (pb->table_idx << MONO_HASCONSTANT_BITS);
-               values [MONO_CONSTANT_VALUE] = encode_constant (assembly, pb->def_value, &field_type);
-               values [MONO_CONSTANT_TYPE] = field_type;
-               values [MONO_CONSTANT_PADDING] = 0;
-       }
-}
+       char *start, *p, *w, *last_point, *startn;
+       int in_modifiers = 0;
+       int isbyref = 0, rank = 0, isptr = 0;
 
-static void
-mono_image_get_event_info (MonoReflectionEventBuilder *eb, MonoDynamicImage *assembly, MonoError *error)
-{
-       MONO_REQ_GC_UNSAFE_MODE;
+       start = p = w = name;
 
-       MonoDynamicTable *table;
-       guint32 *values;
-       guint num_methods = 0;
-       guint32 semaidx;
+       //FIXME could we just zero the whole struct? memset (&info, 0, sizeof (MonoTypeNameParse))
+       memset (&info->assembly, 0, sizeof (MonoAssemblyName));
+       info->name = info->name_space = NULL;
+       info->nested = NULL;
+       info->modifiers = NULL;
+       info->type_arguments = NULL;
 
-       /* 
-        * we need to set things in the following tables:
-        * EVENTMAP (info already filled in _get_type_info ())
-        * EVENT    (rows already preallocated in _get_type_info ())
-        * METHOD      (method info already done with the generic method code)
-        * METHODSEMANTICS
-        */
-       table = &assembly->tables [MONO_TABLE_EVENT];
-       eb->table_idx = table->next_idx ++;
-       values = table->values + eb->table_idx * MONO_EVENT_SIZE;
-       values [MONO_EVENT_NAME] = string_heap_insert_mstring (&assembly->sheap, eb->name, error);
-       return_if_nok (error);
-       values [MONO_EVENT_FLAGS] = eb->attrs;
-       MonoType *ebtype = mono_reflection_type_get_handle (eb->type, error);
-       return_if_nok (error);
-       values [MONO_EVENT_TYPE] = mono_image_typedef_or_ref (assembly, ebtype);
+       /* last_point separates the namespace from the name */
+       last_point = NULL;
+       /* Skips spaces */
+       while (*p == ' ') p++, start++, w++, name++;
 
-       /*
-        * FIXME: we still don't handle 'other' methods 
-        */
-       if (eb->add_method) num_methods ++;
-       if (eb->remove_method) num_methods ++;
-       if (eb->raise_method) num_methods ++;
-
-       table = &assembly->tables [MONO_TABLE_METHODSEMANTICS];
-       table->rows += num_methods;
-       alloc_table (table, table->rows);
-
-       if (eb->add_method) {
-               semaidx = table->next_idx ++;
-               values = table->values + semaidx * MONO_METHOD_SEMA_SIZE;
-               values [MONO_METHOD_SEMA_SEMANTICS] = METHOD_SEMANTIC_ADD_ON;
-               values [MONO_METHOD_SEMA_METHOD] = eb->add_method->table_idx;
-               values [MONO_METHOD_SEMA_ASSOCIATION] = (eb->table_idx << MONO_HAS_SEMANTICS_BITS) | MONO_HAS_SEMANTICS_EVENT;
-       }
-       if (eb->remove_method) {
-               semaidx = table->next_idx ++;
-               values = table->values + semaidx * MONO_METHOD_SEMA_SIZE;
-               values [MONO_METHOD_SEMA_SEMANTICS] = METHOD_SEMANTIC_REMOVE_ON;
-               values [MONO_METHOD_SEMA_METHOD] = eb->remove_method->table_idx;
-               values [MONO_METHOD_SEMA_ASSOCIATION] = (eb->table_idx << MONO_HAS_SEMANTICS_BITS) | MONO_HAS_SEMANTICS_EVENT;
-       }
-       if (eb->raise_method) {
-               semaidx = table->next_idx ++;
-               values = table->values + semaidx * MONO_METHOD_SEMA_SIZE;
-               values [MONO_METHOD_SEMA_SEMANTICS] = METHOD_SEMANTIC_FIRE;
-               values [MONO_METHOD_SEMA_METHOD] = eb->raise_method->table_idx;
-               values [MONO_METHOD_SEMA_ASSOCIATION] = (eb->table_idx << MONO_HAS_SEMANTICS_BITS) | MONO_HAS_SEMANTICS_EVENT;
-       }
-}
-
-static void
-encode_constraints (MonoReflectionGenericParam *gparam, guint32 owner, MonoDynamicImage *assembly, MonoError *error)
-{
-       MONO_REQ_GC_UNSAFE_MODE;
-
-       mono_error_init (error);
-
-       MonoDynamicTable *table;
-       guint32 num_constraints, i;
-       guint32 *values;
-       guint32 table_idx;
-
-       table = &assembly->tables [MONO_TABLE_GENERICPARAMCONSTRAINT];
-       num_constraints = gparam->iface_constraints ?
-               mono_array_length (gparam->iface_constraints) : 0;
-       table->rows += num_constraints;
-       if (gparam->base_type)
-               table->rows++;
-       alloc_table (table, table->rows);
-
-       if (gparam->base_type) {
-               table_idx = table->next_idx ++;
-               values = table->values + table_idx * MONO_GENPARCONSTRAINT_SIZE;
-
-               MonoType *gpbasetype = mono_reflection_type_get_handle (gparam->base_type, error);
-               return_if_nok (error);
-               values [MONO_GENPARCONSTRAINT_GENERICPAR] = owner;
-               values [MONO_GENPARCONSTRAINT_CONSTRAINT] = mono_image_typedef_or_ref (assembly, gpbasetype);
-       }
-
-       for (i = 0; i < num_constraints; i++) {
-               MonoReflectionType *constraint = (MonoReflectionType *)mono_array_get (
-                       gparam->iface_constraints, gpointer, i);
-
-               table_idx = table->next_idx ++;
-               values = table->values + table_idx * MONO_GENPARCONSTRAINT_SIZE;
-
-               MonoType *constraint_type = mono_reflection_type_get_handle (constraint, error);
-               return_if_nok (error);
-
-               values [MONO_GENPARCONSTRAINT_GENERICPAR] = owner;
-               values [MONO_GENPARCONSTRAINT_CONSTRAINT] = mono_image_typedef_or_ref (assembly, constraint_type);
-       }
-}
-
-static void
-mono_image_get_generic_param_info (MonoReflectionGenericParam *gparam, guint32 owner, MonoDynamicImage *assembly)
-{
-       MONO_REQ_GC_UNSAFE_MODE;
-
-       GenericParamTableEntry *entry;
-
-       /*
-        * The GenericParam table must be sorted according to the `owner' field.
-        * We need to do this sorting prior to writing the GenericParamConstraint
-        * table, since we have to use the final GenericParam table indices there
-        * and they must also be sorted.
-        */
-
-       entry = g_new0 (GenericParamTableEntry, 1);
-       entry->owner = owner;
-       /* FIXME: track where gen_params should be freed and remove the GC root as well */
-       MONO_GC_REGISTER_ROOT_IF_MOVING (entry->gparam, MONO_ROOT_SOURCE_REFLECTION, "reflection generic parameter");
-       entry->gparam = gparam;
-       
-       g_ptr_array_add (assembly->gen_params, entry);
-}
-
-static gboolean
-write_generic_param_entry (MonoDynamicImage *assembly, GenericParamTableEntry *entry, MonoError *error)
-{
-       MONO_REQ_GC_UNSAFE_MODE;
-
-       MonoDynamicTable *table;
-       MonoGenericParam *param;
-       guint32 *values;
-       guint32 table_idx;
-
-       mono_error_init (error);
-
-       table = &assembly->tables [MONO_TABLE_GENERICPARAM];
-       table_idx = table->next_idx ++;
-       values = table->values + table_idx * MONO_GENERICPARAM_SIZE;
-
-       MonoType *gparam_type = mono_reflection_type_get_handle ((MonoReflectionType*)entry->gparam, error);
-       return_val_if_nok (error, FALSE);
-
-       param = gparam_type->data.generic_param;
-
-       values [MONO_GENERICPARAM_OWNER] = entry->owner;
-       values [MONO_GENERICPARAM_FLAGS] = entry->gparam->attrs;
-       values [MONO_GENERICPARAM_NUMBER] = mono_generic_param_num (param);
-       values [MONO_GENERICPARAM_NAME] = string_heap_insert (&assembly->sheap, mono_generic_param_info (param)->name);
-
-       if (!mono_image_add_cattrs (assembly, table_idx, MONO_CUSTOM_ATTR_GENERICPAR, entry->gparam->cattrs, error))
-               return FALSE;
-
-       encode_constraints (entry->gparam, table_idx, assembly, error);
-       return_val_if_nok (error, FALSE);
-
-       return TRUE;
-}
-
-static guint32
-resolution_scope_from_image (MonoDynamicImage *assembly, MonoImage *image)
-{
-       MONO_REQ_GC_UNSAFE_MODE;
-
-       MonoDynamicTable *table;
-       guint32 token;
-       guint32 *values;
-       guint32 cols [MONO_ASSEMBLY_SIZE];
-       const char *pubkey;
-       guint32 publen;
-
-       if ((token = GPOINTER_TO_UINT (g_hash_table_lookup (assembly->handleref, image))))
-               return token;
-
-       if (assembly_is_dynamic (image->assembly) && (image->assembly == assembly->image.assembly)) {
-               table = &assembly->tables [MONO_TABLE_MODULEREF];
-               token = table->next_idx ++;
-               table->rows ++;
-               alloc_table (table, table->rows);
-               values = table->values + token * MONO_MODULEREF_SIZE;
-               values [MONO_MODULEREF_NAME] = string_heap_insert (&assembly->sheap, image->module_name);
-
-               token <<= MONO_RESOLUTION_SCOPE_BITS;
-               token |= MONO_RESOLUTION_SCOPE_MODULEREF;
-               g_hash_table_insert (assembly->handleref, image, GUINT_TO_POINTER (token));
-
-               return token;
-       }
-       
-       if (assembly_is_dynamic (image->assembly))
-               /* FIXME: */
-               memset (cols, 0, sizeof (cols));
-       else {
-               /* image->assembly->image is the manifest module */
-               image = image->assembly->image;
-               mono_metadata_decode_row (&image->tables [MONO_TABLE_ASSEMBLY], 0, cols, MONO_ASSEMBLY_SIZE);
-       }
-
-       table = &assembly->tables [MONO_TABLE_ASSEMBLYREF];
-       token = table->next_idx ++;
-       table->rows ++;
-       alloc_table (table, table->rows);
-       values = table->values + token * MONO_ASSEMBLYREF_SIZE;
-       values [MONO_ASSEMBLYREF_NAME] = string_heap_insert (&assembly->sheap, image->assembly_name);
-       values [MONO_ASSEMBLYREF_MAJOR_VERSION] = cols [MONO_ASSEMBLY_MAJOR_VERSION];
-       values [MONO_ASSEMBLYREF_MINOR_VERSION] = cols [MONO_ASSEMBLY_MINOR_VERSION];
-       values [MONO_ASSEMBLYREF_BUILD_NUMBER] = cols [MONO_ASSEMBLY_BUILD_NUMBER];
-       values [MONO_ASSEMBLYREF_REV_NUMBER] = cols [MONO_ASSEMBLY_REV_NUMBER];
-       values [MONO_ASSEMBLYREF_FLAGS] = 0;
-       values [MONO_ASSEMBLYREF_CULTURE] = 0;
-       values [MONO_ASSEMBLYREF_HASH_VALUE] = 0;
-
-       if (strcmp ("", image->assembly->aname.culture)) {
-               values [MONO_ASSEMBLYREF_CULTURE] = string_heap_insert (&assembly->sheap,
-                               image->assembly->aname.culture);
-       }
-
-       if ((pubkey = mono_image_get_public_key (image, &publen))) {
-               guchar pubtoken [9];
-               pubtoken [0] = 8;
-               mono_digest_get_public_token (pubtoken + 1, (guchar*)pubkey, publen);
-               values [MONO_ASSEMBLYREF_PUBLIC_KEY] = mono_image_add_stream_data (&assembly->blob, (char*)pubtoken, 9);
-       } else {
-               values [MONO_ASSEMBLYREF_PUBLIC_KEY] = 0;
-       }
-       token <<= MONO_RESOLUTION_SCOPE_BITS;
-       token |= MONO_RESOLUTION_SCOPE_ASSEMBLYREF;
-       g_hash_table_insert (assembly->handleref, image, GUINT_TO_POINTER (token));
-       return token;
-}
-
-static guint32
-create_typespec (MonoDynamicImage *assembly, MonoType *type)
-{
-       MONO_REQ_GC_NEUTRAL_MODE;
-
-       MonoDynamicTable *table;
-       guint32 *values;
-       guint32 token;
-       SigBuffer buf;
-
-       if ((token = GPOINTER_TO_UINT (g_hash_table_lookup (assembly->typespec, type))))
-               return token;
-
-       sigbuffer_init (&buf, 32);
-       switch (type->type) {
-       case MONO_TYPE_FNPTR:
-       case MONO_TYPE_PTR:
-       case MONO_TYPE_SZARRAY:
-       case MONO_TYPE_ARRAY:
-       case MONO_TYPE_VAR:
-       case MONO_TYPE_MVAR:
-       case MONO_TYPE_GENERICINST:
-               encode_type (assembly, type, &buf);
-               break;
-       case MONO_TYPE_CLASS:
-       case MONO_TYPE_VALUETYPE: {
-               MonoClass *k = mono_class_from_mono_type (type);
-               if (!k || !k->generic_container) {
-                       sigbuffer_free (&buf);
-                       return 0;
-               }
-               encode_type (assembly, type, &buf);
-               break;
-       }
-       default:
-               sigbuffer_free (&buf);
-               return 0;
-       }
-
-       table = &assembly->tables [MONO_TABLE_TYPESPEC];
-       if (assembly->save) {
-               token = sigbuffer_add_to_blob_cached (assembly, &buf);
-               alloc_table (table, table->rows + 1);
-               values = table->values + table->next_idx * MONO_TYPESPEC_SIZE;
-               values [MONO_TYPESPEC_SIGNATURE] = token;
-       }
-       sigbuffer_free (&buf);
-
-       token = MONO_TYPEDEFORREF_TYPESPEC | (table->next_idx << MONO_TYPEDEFORREF_BITS);
-       g_hash_table_insert (assembly->typespec, type, GUINT_TO_POINTER(token));
-       table->next_idx ++;
-       return token;
-}
-
-static guint32
-mono_image_typedef_or_ref_full (MonoDynamicImage *assembly, MonoType *type, gboolean try_typespec)
-{
-       MONO_REQ_GC_UNSAFE_MODE;
-
-       MonoDynamicTable *table;
-       guint32 *values;
-       guint32 token, scope, enclosing;
-       MonoClass *klass;
-
-       /* if the type requires a typespec, we must try that first*/
-       if (try_typespec && (token = create_typespec (assembly, type)))
-               return token;
-       token = GPOINTER_TO_UINT (g_hash_table_lookup (assembly->typeref, type));
-       if (token)
-               return token;
-       klass = mono_class_from_mono_type (type);
-       if (!klass)
-               klass = mono_class_from_mono_type (type);
-
-       /*
-        * If it's in the same module and not a generic type parameter:
-        */
-       if ((klass->image == &assembly->image) && (type->type != MONO_TYPE_VAR) && 
-                       (type->type != MONO_TYPE_MVAR)) {
-               MonoReflectionTypeBuilder *tb = (MonoReflectionTypeBuilder *)mono_class_get_ref_info (klass);
-               token = MONO_TYPEDEFORREF_TYPEDEF | (tb->table_idx << MONO_TYPEDEFORREF_BITS);
-               register_dyn_token (assembly, token, (MonoObject *)mono_class_get_ref_info (klass));
-               return token;
-       }
-
-       if (klass->nested_in) {
-               enclosing = mono_image_typedef_or_ref_full (assembly, &klass->nested_in->byval_arg, FALSE);
-               /* get the typeref idx of the enclosing type */
-               enclosing >>= MONO_TYPEDEFORREF_BITS;
-               scope = (enclosing << MONO_RESOLUTION_SCOPE_BITS) | MONO_RESOLUTION_SCOPE_TYPEREF;
-       } else {
-               scope = resolution_scope_from_image (assembly, klass->image);
-       }
-       table = &assembly->tables [MONO_TABLE_TYPEREF];
-       if (assembly->save) {
-               alloc_table (table, table->rows + 1);
-               values = table->values + table->next_idx * MONO_TYPEREF_SIZE;
-               values [MONO_TYPEREF_SCOPE] = scope;
-               values [MONO_TYPEREF_NAME] = string_heap_insert (&assembly->sheap, klass->name);
-               values [MONO_TYPEREF_NAMESPACE] = string_heap_insert (&assembly->sheap, klass->name_space);
-       }
-       token = MONO_TYPEDEFORREF_TYPEREF | (table->next_idx << MONO_TYPEDEFORREF_BITS); /* typeref */
-       g_hash_table_insert (assembly->typeref, type, GUINT_TO_POINTER(token));
-       table->next_idx ++;
-       register_dyn_token (assembly, token, (MonoObject *)mono_class_get_ref_info (klass));
-       return token;
-}
-
-/*
- * Despite the name, we handle also TypeSpec (with the above helper).
- */
-static guint32
-mono_image_typedef_or_ref (MonoDynamicImage *assembly, MonoType *type)
-{
-       return mono_image_typedef_or_ref_full (assembly, type, TRUE);
-}
-
-#ifndef DISABLE_REFLECTION_EMIT
-static guint32
-mono_image_add_memberef_row (MonoDynamicImage *assembly, guint32 parent, const char *name, guint32 sig)
-{
-       MONO_REQ_GC_NEUTRAL_MODE;
-
-       MonoDynamicTable *table;
-       guint32 *values;
-       guint32 token, pclass;
-
-       switch (parent & MONO_TYPEDEFORREF_MASK) {
-       case MONO_TYPEDEFORREF_TYPEREF:
-               pclass = MONO_MEMBERREF_PARENT_TYPEREF;
-               break;
-       case MONO_TYPEDEFORREF_TYPESPEC:
-               pclass = MONO_MEMBERREF_PARENT_TYPESPEC;
-               break;
-       case MONO_TYPEDEFORREF_TYPEDEF:
-               pclass = MONO_MEMBERREF_PARENT_TYPEDEF;
-               break;
-       default:
-               g_warning ("unknown typeref or def token 0x%08x for %s", parent, name);
-               return 0;
-       }
-       /* extract the index */
-       parent >>= MONO_TYPEDEFORREF_BITS;
-
-       table = &assembly->tables [MONO_TABLE_MEMBERREF];
-
-       if (assembly->save) {
-               alloc_table (table, table->rows + 1);
-               values = table->values + table->next_idx * MONO_MEMBERREF_SIZE;
-               values [MONO_MEMBERREF_CLASS] = pclass | (parent << MONO_MEMBERREF_PARENT_BITS);
-               values [MONO_MEMBERREF_NAME] = string_heap_insert (&assembly->sheap, name);
-               values [MONO_MEMBERREF_SIGNATURE] = sig;
-       }
-
-       token = MONO_TOKEN_MEMBER_REF | table->next_idx;
-       table->next_idx ++;
-
-       return token;
-}
-
-/*
- * Insert a memberef row into the metadata: the token that point to the memberref
- * is returned. Caching is done in the caller (mono_image_get_methodref_token() or
- * mono_image_get_fieldref_token()).
- * The sig param is an index to an already built signature.
- */
-static guint32
-mono_image_get_memberref_token (MonoDynamicImage *assembly, MonoType *type, const char *name, guint32 sig)
-{
-       MONO_REQ_GC_NEUTRAL_MODE;
-
-       guint32 parent = mono_image_typedef_or_ref (assembly, type);
-       return mono_image_add_memberef_row (assembly, parent, name, sig);
-}
-
-
-static guint32
-mono_image_get_methodref_token (MonoDynamicImage *assembly, MonoMethod *method, gboolean create_typespec)
-{
-       MONO_REQ_GC_NEUTRAL_MODE;
-
-       guint32 token;
-       MonoMethodSignature *sig;
-       
-       create_typespec = create_typespec && method->is_generic && method->klass->image != &assembly->image;
-
-       if (create_typespec) {
-               token = GPOINTER_TO_UINT (g_hash_table_lookup (assembly->handleref, GUINT_TO_POINTER (GPOINTER_TO_UINT (method) + 1)));
-               if (token)
-                       return token;
-       } 
-
-       token = GPOINTER_TO_UINT (g_hash_table_lookup (assembly->handleref, method));
-       if (token && !create_typespec)
-               return token;
-
-       g_assert (!method->is_inflated);
-       if (!token) {
-               /*
-                * A methodref signature can't contain an unmanaged calling convention.
-                */
-               sig = mono_metadata_signature_dup (mono_method_signature (method));
-               if ((sig->call_convention != MONO_CALL_DEFAULT) && (sig->call_convention != MONO_CALL_VARARG))
-                       sig->call_convention = MONO_CALL_DEFAULT;
-               token = mono_image_get_memberref_token (assembly, &method->klass->byval_arg,
-                       method->name,  method_encode_signature (assembly, sig));
-               g_free (sig);
-               g_hash_table_insert (assembly->handleref, method, GUINT_TO_POINTER(token));
-       }
-
-       if (create_typespec) {
-               MonoDynamicTable *table = &assembly->tables [MONO_TABLE_METHODSPEC];
-               g_assert (mono_metadata_token_table (token) == MONO_TABLE_MEMBERREF);
-               token = (mono_metadata_token_index (token) << MONO_METHODDEFORREF_BITS) | MONO_METHODDEFORREF_METHODREF;
-
-               if (assembly->save) {
-                       guint32 *values;
-
-                       alloc_table (table, table->rows + 1);
-                       values = table->values + table->next_idx * MONO_METHODSPEC_SIZE;
-                       values [MONO_METHODSPEC_METHOD] = token;
-                       values [MONO_METHODSPEC_SIGNATURE] = encode_generic_method_sig (assembly, &mono_method_get_generic_container (method)->context);
-               }
-
-               token = MONO_TOKEN_METHOD_SPEC | table->next_idx;
-               table->next_idx ++;
-               /*methodspec and memberef tokens are diferent, */
-               g_hash_table_insert (assembly->handleref, GUINT_TO_POINTER (GPOINTER_TO_UINT (method) + 1), GUINT_TO_POINTER (token));
-               return token;
-       }
-       return token;
-}
-
-static guint32
-mono_image_get_methodref_token_for_methodbuilder (MonoDynamicImage *assembly, MonoReflectionMethodBuilder *method, MonoError *error)
-{
-       guint32 token, parent, sig;
-       ReflectionMethodBuilder rmb;
-       MonoReflectionTypeBuilder *tb = (MonoReflectionTypeBuilder *)method->type;
-       
-       mono_error_init (error);
-       token = GPOINTER_TO_UINT (g_hash_table_lookup (assembly->handleref, method));
-       if (token)
-               return token;
-
-       if (!reflection_methodbuilder_from_method_builder (&rmb, method, error))
-               return 0;
-
-       /*
-        * A methodref signature can't contain an unmanaged calling convention.
-        * Since some flags are encoded as part of call_conv, we need to check against it.
-       */
-       if ((rmb.call_conv & ~0x60) != MONO_CALL_DEFAULT && (rmb.call_conv & ~0x60) != MONO_CALL_VARARG)
-               rmb.call_conv = (rmb.call_conv & 0x60) | MONO_CALL_DEFAULT;
-
-       sig = method_builder_encode_signature (assembly, &rmb, error);
-       return_val_if_nok (error, 0);
-
-       if (tb->generic_params) {
-               parent = create_generic_typespec (assembly, tb, error);
-               return_val_if_nok (error, 0);
-       } else {
-               MonoType *t = mono_reflection_type_get_handle ((MonoReflectionType*)rmb.type, error);
-               return_val_if_nok (error, 0);
-
-               parent = mono_image_typedef_or_ref (assembly, t);
-       }
-
-       char *name = mono_string_to_utf8_checked (method->name, error);
-       return_val_if_nok (error, 0);
-
-       token = mono_image_add_memberef_row (assembly, parent, name, sig);
-       g_free (name);
-
-       g_hash_table_insert (assembly->handleref, method, GUINT_TO_POINTER(token));
-
-       return token;
-}
-
-static guint32
-mono_image_get_varargs_method_token (MonoDynamicImage *assembly, guint32 original,
-                                    const gchar *name, guint32 sig)
-{
-       MonoDynamicTable *table;
-       guint32 token;
-       guint32 *values;
-       
-       table = &assembly->tables [MONO_TABLE_MEMBERREF];
-
-       if (assembly->save) {
-               alloc_table (table, table->rows + 1);
-               values = table->values + table->next_idx * MONO_MEMBERREF_SIZE;
-               values [MONO_MEMBERREF_CLASS] = original;
-               values [MONO_MEMBERREF_NAME] = string_heap_insert (&assembly->sheap, name);
-               values [MONO_MEMBERREF_SIGNATURE] = sig;
-       }
-
-       token = MONO_TOKEN_MEMBER_REF | table->next_idx;
-       table->next_idx ++;
-
-       return token;
-}
-
-static guint32
-encode_generic_method_definition_sig (MonoDynamicImage *assembly, MonoReflectionMethodBuilder *mb)
-{
-       SigBuffer buf;
-       int i;
-       guint32 nparams = mono_array_length (mb->generic_params);
-       guint32 idx;
-
-       if (!assembly->save)
-               return 0;
-
-       sigbuffer_init (&buf, 32);
-
-       sigbuffer_add_value (&buf, 0xa);
-       sigbuffer_add_value (&buf, nparams);
-
-       for (i = 0; i < nparams; i++) {
-               sigbuffer_add_value (&buf, MONO_TYPE_MVAR);
-               sigbuffer_add_value (&buf, i);
-       }
-
-       idx = sigbuffer_add_to_blob_cached (assembly, &buf);
-       sigbuffer_free (&buf);
-       return idx;
-}
-
-static guint32
-mono_image_get_methodspec_token_for_generic_method_definition (MonoDynamicImage *assembly, MonoReflectionMethodBuilder *mb, MonoError *error)
-{
-       MonoDynamicTable *table;
-       guint32 *values;
-       guint32 token, mtoken = 0;
-
-       mono_error_init (error);
-       token = GPOINTER_TO_UINT (mono_g_hash_table_lookup (assembly->methodspec, mb));
-       if (token)
-               return token;
-
-       table = &assembly->tables [MONO_TABLE_METHODSPEC];
-
-       mtoken = mono_image_get_methodref_token_for_methodbuilder (assembly, mb, error);
-       if (!mono_error_ok (error))
-               return 0;
-
-       switch (mono_metadata_token_table (mtoken)) {
-       case MONO_TABLE_MEMBERREF:
-               mtoken = (mono_metadata_token_index (mtoken) << MONO_METHODDEFORREF_BITS) | MONO_METHODDEFORREF_METHODREF;
-               break;
-       case MONO_TABLE_METHOD:
-               mtoken = (mono_metadata_token_index (mtoken) << MONO_METHODDEFORREF_BITS) | MONO_METHODDEFORREF_METHODDEF;
-               break;
-       default:
-               g_assert_not_reached ();
-       }
-
-       if (assembly->save) {
-               alloc_table (table, table->rows + 1);
-               values = table->values + table->next_idx * MONO_METHODSPEC_SIZE;
-               values [MONO_METHODSPEC_METHOD] = mtoken;
-               values [MONO_METHODSPEC_SIGNATURE] = encode_generic_method_definition_sig (assembly, mb);
-       }
-
-       token = MONO_TOKEN_METHOD_SPEC | table->next_idx;
-       table->next_idx ++;
-
-       mono_g_hash_table_insert (assembly->methodspec, mb, GUINT_TO_POINTER(token));
-       return token;
-}
-
-static guint32
-mono_image_get_methodbuilder_token (MonoDynamicImage *assembly, MonoReflectionMethodBuilder *mb, gboolean create_methodspec, MonoError *error)
-{
-       guint32 token;
-
-       mono_error_init (error);
-
-       if (mb->generic_params && create_methodspec) 
-               return mono_image_get_methodspec_token_for_generic_method_definition (assembly, mb, error);
-
-       token = GPOINTER_TO_UINT (mono_g_hash_table_lookup (assembly->handleref_managed, mb));
-       if (token)
-               return token;
-
-       token = mono_image_get_methodref_token_for_methodbuilder (assembly, mb, error);
-       if (!mono_error_ok (error))
-               return 0;
-       mono_g_hash_table_insert (assembly->handleref_managed, mb, GUINT_TO_POINTER(token));
-       return token;
-}
-
-static guint32
-mono_image_get_ctorbuilder_token (MonoDynamicImage *assembly, MonoReflectionCtorBuilder *mb, MonoError *error)
-{
-       guint32 token, parent, sig;
-       ReflectionMethodBuilder rmb;
-       char *name;
-       MonoReflectionTypeBuilder *tb = (MonoReflectionTypeBuilder *)mb->type;
-       
-       mono_error_init (error);
-       
-       token = GPOINTER_TO_UINT (mono_g_hash_table_lookup (assembly->handleref_managed, mb));
-       if (token)
-               return token;
-
-       if (!reflection_methodbuilder_from_ctor_builder (&rmb, mb, error))
-               return 0;
-
-       if (tb->generic_params) {
-               parent = create_generic_typespec (assembly, tb, error);
-               return_val_if_nok (error, 0);
-       } else {
-               MonoType * type = mono_reflection_type_get_handle ((MonoReflectionType*)tb, error);
-               return_val_if_nok (error, 0);
-               parent = mono_image_typedef_or_ref (assembly, type);
-       }
-       
-       name = mono_string_to_utf8_checked (rmb.name, error);
-       return_val_if_nok (error, 0);
-       sig = method_builder_encode_signature (assembly, &rmb, error);
-       return_val_if_nok (error, 0);
-
-       token = mono_image_add_memberef_row (assembly, parent, name, sig);
-
-       g_free (name);
-       mono_g_hash_table_insert (assembly->handleref_managed, mb, GUINT_TO_POINTER(token));
-       return token;
-}
-#endif
-
-static gboolean
-is_field_on_inst (MonoClassField *field)
-{
-       return (field->parent->generic_class && field->parent->generic_class->is_dynamic && ((MonoDynamicGenericClass*)field->parent->generic_class)->fields);
-}
-
-/*
- * If FIELD is a field of a MonoDynamicGenericClass, return its non-inflated type.
- */
-static MonoType*
-get_field_on_inst_generic_type (MonoClassField *field)
-{
-       MonoClass *klass, *gtd;
-       MonoDynamicGenericClass *dgclass;
-       int field_index;
-
-       g_assert (is_field_on_inst (field));
-
-       dgclass = (MonoDynamicGenericClass*)field->parent->generic_class;
-
-       if (field >= dgclass->fields && field - dgclass->fields < dgclass->count_fields) {
-               field_index = field - dgclass->fields;
-               return dgclass->field_generic_types [field_index];              
-       }
-
-       klass = field->parent;
-       gtd = klass->generic_class->container_class;
-
-       if (field >= klass->fields && field - klass->fields < klass->field.count) {
-               field_index = field - klass->fields;
-               return gtd->fields [field_index].type;
-       }
-
-       g_assert_not_reached ();
-       return 0;
-}
-
-#ifndef DISABLE_REFLECTION_EMIT
-static guint32
-mono_image_get_fieldref_token (MonoDynamicImage *assembly, MonoObject *f, MonoClassField *field)
-{
-       MonoType *type;
-       guint32 token;
-
-       g_assert (field);
-       g_assert (field->parent);
-
-       token = GPOINTER_TO_UINT (mono_g_hash_table_lookup (assembly->handleref_managed, f));
-       if (token)
-               return token;
-
-       if (field->parent->generic_class && field->parent->generic_class->container_class && field->parent->generic_class->container_class->fields) {
-               int index = field - field->parent->fields;
-               type = mono_field_get_type (&field->parent->generic_class->container_class->fields [index]);
-       } else {
-               if (is_field_on_inst (field))
-                       type = get_field_on_inst_generic_type (field);
-               else
-                       type = mono_field_get_type (field);
-       }
-       token = mono_image_get_memberref_token (assembly, &field->parent->byval_arg,
-                                                                                       mono_field_get_name (field),
-                                                                                       fieldref_encode_signature (assembly, field->parent->image, type));
-       mono_g_hash_table_insert (assembly->handleref_managed, f, GUINT_TO_POINTER(token));
-       return token;
-}
-
-static guint32
-mono_image_get_field_on_inst_token (MonoDynamicImage *assembly, MonoReflectionFieldOnTypeBuilderInst *f, MonoError *error)
-{
-       guint32 token;
-       MonoClass *klass;
-       MonoGenericClass *gclass;
-       MonoType *type;
-       char *name;
-
-       token = GPOINTER_TO_UINT (mono_g_hash_table_lookup (assembly->handleref_managed, f));
-       if (token)
-               return token;
-       if (is_sre_field_builder (mono_object_class (f->fb))) {
-               MonoReflectionFieldBuilder *fb = (MonoReflectionFieldBuilder *)f->fb;
-               type = mono_reflection_type_get_handle ((MonoReflectionType*)f->inst, error);
-               return_val_if_nok (error, 0);
-               klass = mono_class_from_mono_type (type);
-               gclass = type->data.generic_class;
-               g_assert (gclass->is_dynamic);
-
-               guint32 sig_token = field_encode_signature (assembly, fb, error);
-               return_val_if_nok (error, 0);
-               name = mono_string_to_utf8_checked (fb->name, error);
-               return_val_if_nok (error, 0);
-               token = mono_image_get_memberref_token (assembly, &klass->byval_arg, name, sig_token);
-               g_free (name);          
-       } else if (is_sr_mono_field (mono_object_class (f->fb))) {
-               guint32 sig;
-               MonoClassField *field = ((MonoReflectionField *)f->fb)->field;
-
-               type = mono_reflection_type_get_handle ((MonoReflectionType*)f->inst, error);
-               return_val_if_nok (error, 0);
-               klass = mono_class_from_mono_type (type);
-
-               sig = fieldref_encode_signature (assembly, field->parent->image, field->type);
-               token = mono_image_get_memberref_token (assembly, &klass->byval_arg, field->name, sig);
-       } else {
-               char *name = mono_type_get_full_name (mono_object_class (f->fb));
-               g_error ("mono_image_get_field_on_inst_token: don't know how to handle %s", name);
-       }
-
-       mono_g_hash_table_insert (assembly->handleref_managed, f, GUINT_TO_POINTER (token));
-       return token;
-}
-
-static guint32
-mono_image_get_ctor_on_inst_token (MonoDynamicImage *assembly, MonoReflectionCtorOnTypeBuilderInst *c, gboolean create_methodspec, MonoError *error)
-{
-       guint32 sig, token;
-       MonoClass *klass;
-       MonoGenericClass *gclass;
-       MonoType *type;
-
-       mono_error_init (error);
-
-       /* A ctor cannot be a generic method, so we can ignore create_methodspec */
-
-       token = GPOINTER_TO_UINT (mono_g_hash_table_lookup (assembly->handleref_managed, c));
-       if (token)
-               return token;
-
-       if (is_sre_ctor_builder (mono_object_class (c->cb))) {
-               MonoReflectionCtorBuilder *cb = (MonoReflectionCtorBuilder *)c->cb;
-               ReflectionMethodBuilder rmb;
-               char *name;
-
-               type = mono_reflection_type_get_handle ((MonoReflectionType*)c->inst, error);
-               return_val_if_nok (error, 0);
-               klass = mono_class_from_mono_type (type);
-
-               gclass = type->data.generic_class;
-               g_assert (gclass->is_dynamic);
-
-               if (!reflection_methodbuilder_from_ctor_builder (&rmb, cb, error))
-                       return 0;
-
-               sig = method_builder_encode_signature (assembly, &rmb, error);
-               return_val_if_nok (error, 0);
-
-               name = mono_string_to_utf8_checked (rmb.name, error);
-               return_val_if_nok (error, 0);
-
-               token = mono_image_get_memberref_token (assembly, &klass->byval_arg, name, sig);
-               g_free (name);
-       } else if (is_sr_mono_cmethod (mono_object_class (c->cb))) {
-               MonoMethod *mm = ((MonoReflectionMethod *)c->cb)->method;
-
-               type = mono_reflection_type_get_handle ((MonoReflectionType*)c->inst, error);
-               return_val_if_nok (error, 0);
-               klass = mono_class_from_mono_type (type);
-
-               sig = method_encode_signature (assembly, mono_method_signature (mm));
-               token = mono_image_get_memberref_token (assembly, &klass->byval_arg, mm->name, sig);
-       } else {
-               char *name = mono_type_get_full_name (mono_object_class (c->cb));
-               g_error ("mono_image_get_method_on_inst_token: don't know how to handle %s", name);
-       }
-
-
-       mono_g_hash_table_insert (assembly->handleref_managed, c, GUINT_TO_POINTER (token));
-       return token;
-}
-
-static MonoMethod*
-mono_reflection_method_on_tb_inst_get_handle (MonoReflectionMethodOnTypeBuilderInst *m, MonoError *error)
-{
-       MonoClass *klass;
-       MonoGenericContext tmp_context;
-       MonoType **type_argv;
-       MonoGenericInst *ginst;
-       MonoMethod *method, *inflated;
-       int count, i;
-
-       mono_error_init (error);
-
-       init_type_builder_generics ((MonoObject*)m->inst, error);
-       return_val_if_nok (error, NULL);
-
-       method = inflate_method (m->inst, (MonoObject*)m->mb, error);
-       return_val_if_nok (error, NULL);
-
-       klass = method->klass;
-
-       if (m->method_args == NULL)
-               return method;
-
-       if (method->is_inflated)
-               method = ((MonoMethodInflated *) method)->declaring;
-
-       count = mono_array_length (m->method_args);
-
-       type_argv = g_new0 (MonoType *, count);
-       for (i = 0; i < count; i++) {
-               MonoReflectionType *garg = (MonoReflectionType *)mono_array_get (m->method_args, gpointer, i);
-               type_argv [i] = mono_reflection_type_get_handle (garg, error);
-               return_val_if_nok (error, NULL);
-       }
-       ginst = mono_metadata_get_generic_inst (count, type_argv);
-       g_free (type_argv);
-
-       tmp_context.class_inst = klass->generic_class ? klass->generic_class->context.class_inst : NULL;
-       tmp_context.method_inst = ginst;
-
-       inflated = mono_class_inflate_generic_method_checked (method, &tmp_context, error);
-       mono_error_assert_ok (error);
-       return inflated;
-}
-
-static guint32
-mono_image_get_method_on_inst_token (MonoDynamicImage *assembly, MonoReflectionMethodOnTypeBuilderInst *m, gboolean create_methodspec, MonoError *error)
-{
-       guint32 sig, token = 0;
-       MonoType *type;
-       MonoClass *klass;
-
-       mono_error_init (error);
-
-       if (m->method_args) {
-               MonoMethod *inflated;
-
-               inflated = mono_reflection_method_on_tb_inst_get_handle (m, error);
-               return_val_if_nok (error, 0);
-
-               if (create_methodspec)
-                       token = mono_image_get_methodspec_token (assembly, inflated);
-               else
-                       token = mono_image_get_inflated_method_token (assembly, inflated);
-               return token;
-       }
-
-       token = GPOINTER_TO_UINT (mono_g_hash_table_lookup (assembly->handleref_managed, m));
-       if (token)
-               return token;
-
-       if (is_sre_method_builder (mono_object_class (m->mb))) {
-               MonoReflectionMethodBuilder *mb = (MonoReflectionMethodBuilder *)m->mb;
-               MonoGenericClass *gclass;
-               ReflectionMethodBuilder rmb;
-               char *name;
-
-               type = mono_reflection_type_get_handle ((MonoReflectionType*)m->inst, error);
-               return_val_if_nok (error, 0);
-               klass = mono_class_from_mono_type (type);
-               gclass = type->data.generic_class;
-               g_assert (gclass->is_dynamic);
-
-               if (!reflection_methodbuilder_from_method_builder (&rmb, mb, error))
-                       return 0;
-
-               sig = method_builder_encode_signature (assembly, &rmb, error);
-               return_val_if_nok (error, 0);
-
-               name = mono_string_to_utf8_checked (rmb.name, error);
-               return_val_if_nok (error, 0);
-
-               token = mono_image_get_memberref_token (assembly, &klass->byval_arg, name, sig);
-               g_free (name);          
-       } else if (is_sr_mono_method (mono_object_class (m->mb))) {
-               MonoMethod *mm = ((MonoReflectionMethod *)m->mb)->method;
-
-               type = mono_reflection_type_get_handle ((MonoReflectionType*)m->inst, error);
-               return_val_if_nok (error, 0);
-               klass = mono_class_from_mono_type (type);
-
-               sig = method_encode_signature (assembly, mono_method_signature (mm));
-               token = mono_image_get_memberref_token (assembly, &klass->byval_arg, mm->name, sig);
-       } else {
-               char *name = mono_type_get_full_name (mono_object_class (m->mb));
-               g_error ("mono_image_get_method_on_inst_token: don't know how to handle %s", name);
-       }
-
-       mono_g_hash_table_insert (assembly->handleref_managed, m, GUINT_TO_POINTER (token));
-       return token;
-}
-
-static guint32
-encode_generic_method_sig (MonoDynamicImage *assembly, MonoGenericContext *context)
-{
-       SigBuffer buf;
-       int i;
-       guint32 nparams = context->method_inst->type_argc;
-       guint32 idx;
-
-       if (!assembly->save)
-               return 0;
-
-       sigbuffer_init (&buf, 32);
-       /*
-        * FIXME: vararg, explicit_this, differenc call_conv values...
-        */
-       sigbuffer_add_value (&buf, 0xa); /* FIXME FIXME FIXME */
-       sigbuffer_add_value (&buf, nparams);
-
-       for (i = 0; i < nparams; i++)
-               encode_type (assembly, context->method_inst->type_argv [i], &buf);
-
-       idx = sigbuffer_add_to_blob_cached (assembly, &buf);
-       sigbuffer_free (&buf);
-       return idx;
-}
-
-static guint32
-method_encode_methodspec (MonoDynamicImage *assembly, MonoMethod *method)
-{
-       MonoDynamicTable *table;
-       guint32 *values;
-       guint32 token, mtoken = 0, sig;
-       MonoMethodInflated *imethod;
-       MonoMethod *declaring;
-
-       table = &assembly->tables [MONO_TABLE_METHODSPEC];
-
-       g_assert (method->is_inflated);
-       imethod = (MonoMethodInflated *) method;
-       declaring = imethod->declaring;
-
-       sig = method_encode_signature (assembly, mono_method_signature (declaring));
-       mtoken = mono_image_get_memberref_token (assembly, &method->klass->byval_arg, declaring->name, sig);
-
-       if (!mono_method_signature (declaring)->generic_param_count)
-               return mtoken;
-
-       switch (mono_metadata_token_table (mtoken)) {
-       case MONO_TABLE_MEMBERREF:
-               mtoken = (mono_metadata_token_index (mtoken) << MONO_METHODDEFORREF_BITS) | MONO_METHODDEFORREF_METHODREF;
-               break;
-       case MONO_TABLE_METHOD:
-               mtoken = (mono_metadata_token_index (mtoken) << MONO_METHODDEFORREF_BITS) | MONO_METHODDEFORREF_METHODDEF;
-               break;
-       default:
-               g_assert_not_reached ();
-       }
-
-       sig = encode_generic_method_sig (assembly, mono_method_get_context (method));
-
-       if (assembly->save) {
-               alloc_table (table, table->rows + 1);
-               values = table->values + table->next_idx * MONO_METHODSPEC_SIZE;
-               values [MONO_METHODSPEC_METHOD] = mtoken;
-               values [MONO_METHODSPEC_SIGNATURE] = sig;
-       }
-
-       token = MONO_TOKEN_METHOD_SPEC | table->next_idx;
-       table->next_idx ++;
-
-       return token;
-}
-
-static guint32
-mono_image_get_methodspec_token (MonoDynamicImage *assembly, MonoMethod *method)
-{
-       MonoMethodInflated *imethod;
-       guint32 token;
-       
-       token = GPOINTER_TO_UINT (g_hash_table_lookup (assembly->handleref, method));
-       if (token)
-               return token;
-
-       g_assert (method->is_inflated);
-       imethod = (MonoMethodInflated *) method;
-
-       if (mono_method_signature (imethod->declaring)->generic_param_count) {
-               token = method_encode_methodspec (assembly, method);
-       } else {
-               guint32 sig = method_encode_signature (
-                       assembly, mono_method_signature (imethod->declaring));
-               token = mono_image_get_memberref_token (
-                       assembly, &method->klass->byval_arg, method->name, sig);
-       }
-
-       g_hash_table_insert (assembly->handleref, method, GUINT_TO_POINTER(token));
-       return token;
-}
-
-static guint32
-mono_image_get_inflated_method_token (MonoDynamicImage *assembly, MonoMethod *m)
-{
-       MonoMethodInflated *imethod = (MonoMethodInflated *) m;
-       guint32 sig, token;
-
-       sig = method_encode_signature (assembly, mono_method_signature (imethod->declaring));
-       token = mono_image_get_memberref_token (
-               assembly, &m->klass->byval_arg, m->name, sig);
-
-       return token;
-}
-
-static guint32
-create_generic_typespec (MonoDynamicImage *assembly, MonoReflectionTypeBuilder *tb, MonoError *error)
-{
-       MonoDynamicTable *table;
-       MonoClass *klass;
-       MonoType *type;
-       guint32 *values;
-       guint32 token;
-       SigBuffer buf;
-       int count, i;
-
-       /*
-        * We're creating a TypeSpec for the TypeBuilder of a generic type declaration,
-        * ie. what we'd normally use as the generic type in a TypeSpec signature.
-        * Because of this, we must not insert it into the `typeref' hash table.
-        */
-       type = mono_reflection_type_get_handle ((MonoReflectionType*)tb, error);
-       return_val_if_nok (error, 0);
-       token = GPOINTER_TO_UINT (g_hash_table_lookup (assembly->typespec, type));
-       if (token)
-               return token;
-
-       sigbuffer_init (&buf, 32);
-
-       g_assert (tb->generic_params);
-       klass = mono_class_from_mono_type (type);
-
-       if (tb->generic_container) {
-               if (!mono_reflection_create_generic_class (tb, error))
-                       goto fail;
-       }
-
-       sigbuffer_add_value (&buf, MONO_TYPE_GENERICINST);
-       g_assert (klass->generic_container);
-       sigbuffer_add_value (&buf, klass->byval_arg.type);
-       sigbuffer_add_value (&buf, mono_image_typedef_or_ref_full (assembly, &klass->byval_arg, FALSE));
-
-       count = mono_array_length (tb->generic_params);
-       sigbuffer_add_value (&buf, count);
-       for (i = 0; i < count; i++) {
-               MonoReflectionGenericParam *gparam;
-
-               gparam = mono_array_get (tb->generic_params, MonoReflectionGenericParam *, i);
-               MonoType *gparam_type = mono_reflection_type_get_handle ((MonoReflectionType*)gparam, error);
-               if (!is_ok (error))
-                       goto fail;
-
-               encode_type (assembly, gparam_type, &buf);
-       }
-
-       table = &assembly->tables [MONO_TABLE_TYPESPEC];
-
-       if (assembly->save) {
-               token = sigbuffer_add_to_blob_cached (assembly, &buf);
-               alloc_table (table, table->rows + 1);
-               values = table->values + table->next_idx * MONO_TYPESPEC_SIZE;
-               values [MONO_TYPESPEC_SIGNATURE] = token;
-       }
-       sigbuffer_free (&buf);
-
-       token = MONO_TYPEDEFORREF_TYPESPEC | (table->next_idx << MONO_TYPEDEFORREF_BITS);
-       g_hash_table_insert (assembly->typespec, type, GUINT_TO_POINTER(token));
-       table->next_idx ++;
-       return token;
-fail:
-       sigbuffer_free (&buf);
-       return 0;
-}
-
-/*
- * Return a copy of TYPE, adding the custom modifiers in MODREQ and MODOPT.
- */
-static MonoType*
-add_custom_modifiers (MonoDynamicImage *assembly, MonoType *type, MonoArray *modreq, MonoArray *modopt, MonoError *error)
-{
-       int i, count, len, pos;
-       MonoType *t;
-
-       mono_error_init (error);
-
-       count = 0;
-       if (modreq)
-               count += mono_array_length (modreq);
-       if (modopt)
-               count += mono_array_length (modopt);
-
-       if (count == 0)
-               return mono_metadata_type_dup (NULL, type);
-
-       len = MONO_SIZEOF_TYPE + ((gint32)count) * sizeof (MonoCustomMod);
-       t = (MonoType *)g_malloc (len);
-       memcpy (t, type, MONO_SIZEOF_TYPE);
-
-       t->num_mods = count;
-       pos = 0;
-       if (modreq) {
-               for (i = 0; i < mono_array_length (modreq); ++i) {
-                       MonoType *mod = mono_type_array_get_and_resolve (modreq, i, error);
-                       if (!is_ok (error))
-                               goto fail;
-                       t->modifiers [pos].required = 1;
-                       t->modifiers [pos].token = mono_image_typedef_or_ref (assembly, mod);
-                       pos ++;
-               }
-       }
-       if (modopt) {
-               for (i = 0; i < mono_array_length (modopt); ++i) {
-                       MonoType *mod = mono_type_array_get_and_resolve (modopt, i, error);
-                       if (!is_ok (error))
-                               goto fail;
-                       t->modifiers [pos].required = 0;
-                       t->modifiers [pos].token = mono_image_typedef_or_ref (assembly, mod);
-                       pos ++;
-               }
-       }
-
-       return t;
-fail:
-       g_free (t);
-       return NULL;
-}
-
-static void
-init_type_builder_generics (MonoObject *type, MonoError *error)
-{
-       MonoReflectionTypeBuilder *tb;
-
-       mono_error_init (error);
-
-       if (!is_sre_type_builder(mono_object_class (type)))
-               return;
-       tb = (MonoReflectionTypeBuilder *)type;
-
-       if (tb && tb->generic_container)
-               mono_reflection_create_generic_class (tb, error);
-}
-
-static guint32
-mono_image_get_generic_field_token (MonoDynamicImage *assembly, MonoReflectionFieldBuilder *fb, MonoError *error)
-{
-       MonoDynamicTable *table;
-       MonoType *custom = NULL, *type;
-       guint32 *values;
-       guint32 token, pclass, parent, sig;
-       gchar *name;
-
-       mono_error_init (error);
-
-       token = GPOINTER_TO_UINT (mono_g_hash_table_lookup (assembly->handleref_managed, fb));
-       if (token)
-               return token;
-
-       MonoType *typeb = mono_reflection_type_get_handle (fb->typeb, error);
-       return_val_if_nok (error, 0);
-       /* FIXME: is this call necessary? */
-       mono_class_from_mono_type (typeb);
-
-       /*FIXME this is one more layer of ugliness due how types are created.*/
-       init_type_builder_generics (fb->type, error);
-       return_val_if_nok (error, 0);
-
-       /* fb->type does not include the custom modifiers */
-       /* FIXME: We should do this in one place when a fieldbuilder is created */
-       type = mono_reflection_type_get_handle ((MonoReflectionType*)fb->type, error);
-       return_val_if_nok (error, 0);
-
-       if (fb->modreq || fb->modopt) {
-               type = custom = add_custom_modifiers (assembly, type, fb->modreq, fb->modopt, error);
-               return_val_if_nok (error, 0);
-       }
-
-       sig = fieldref_encode_signature (assembly, NULL, type);
-       g_free (custom);
-
-       parent = create_generic_typespec (assembly, (MonoReflectionTypeBuilder *) fb->typeb, error);
-       return_val_if_nok (error, 0);
-       g_assert ((parent & MONO_TYPEDEFORREF_MASK) == MONO_TYPEDEFORREF_TYPESPEC);
-       
-       pclass = MONO_MEMBERREF_PARENT_TYPESPEC;
-       parent >>= MONO_TYPEDEFORREF_BITS;
-
-       table = &assembly->tables [MONO_TABLE_MEMBERREF];
-
-       name = mono_string_to_utf8_checked (fb->name, error);
-       return_val_if_nok (error, 0);
-
-       if (assembly->save) {
-               alloc_table (table, table->rows + 1);
-               values = table->values + table->next_idx * MONO_MEMBERREF_SIZE;
-               values [MONO_MEMBERREF_CLASS] = pclass | (parent << MONO_MEMBERREF_PARENT_BITS);
-               values [MONO_MEMBERREF_NAME] = string_heap_insert (&assembly->sheap, name);
-               values [MONO_MEMBERREF_SIGNATURE] = sig;
-       }
-
-       token = MONO_TOKEN_MEMBER_REF | table->next_idx;
-       table->next_idx ++;
-       mono_g_hash_table_insert (assembly->handleref_managed, fb, GUINT_TO_POINTER(token));
-       g_free (name);
-       return token;
-}
-
-static guint32
-mono_reflection_encode_sighelper (MonoDynamicImage *assembly, MonoReflectionSigHelper *helper, MonoError *error)
-{
-       SigBuffer buf;
-       guint32 nargs;
-       guint32 i, idx;
-
-       mono_error_init (error);
-
-       if (!assembly->save)
-               return 0;
-
-       /* FIXME: this means SignatureHelper.SignatureHelpType.HELPER_METHOD */
-       g_assert (helper->type == 2);
-
-       if (helper->arguments)
-               nargs = mono_array_length (helper->arguments);
-       else
-               nargs = 0;
-
-       sigbuffer_init (&buf, 32);
-
-       /* Encode calling convention */
-       /* Change Any to Standard */
-       if ((helper->call_conv & 0x03) == 0x03)
-               helper->call_conv = 0x01;
-       /* explicit_this implies has_this */
-       if (helper->call_conv & 0x40)
-               helper->call_conv &= 0x20;
-
-       if (helper->call_conv == 0) { /* Unmanaged */
-               idx = helper->unmanaged_call_conv - 1;
-       } else {
-               /* Managed */
-               idx = helper->call_conv & 0x60; /* has_this + explicit_this */
-               if (helper->call_conv & 0x02) /* varargs */
-                       idx += 0x05;
-       }
-
-       sigbuffer_add_byte (&buf, idx);
-       sigbuffer_add_value (&buf, nargs);
-       encode_reflection_type (assembly, helper->return_type, &buf, error);
-       if (!is_ok (error))
-               goto fail;
-       for (i = 0; i < nargs; ++i) {
-               MonoArray *modreqs = NULL;
-               MonoArray *modopts = NULL;
-               MonoReflectionType *pt;
-
-               if (helper->modreqs && (i < mono_array_length (helper->modreqs)))
-                       modreqs = mono_array_get (helper->modreqs, MonoArray*, i);
-               if (helper->modopts && (i < mono_array_length (helper->modopts)))
-                       modopts = mono_array_get (helper->modopts, MonoArray*, i);
-
-               encode_custom_modifiers (assembly, modreqs, modopts, &buf, error);
-               if (!is_ok (error))
-                       goto fail;
-               pt = mono_array_get (helper->arguments, MonoReflectionType*, i);
-               encode_reflection_type (assembly, pt, &buf, error);
-               if (!is_ok (error))
-                       goto fail;
-       }
-       idx = sigbuffer_add_to_blob_cached (assembly, &buf);
-       sigbuffer_free (&buf);
-
-       return idx;
-fail:
-       sigbuffer_free (&buf);
-       return 0;
-}
-
-static guint32 
-mono_image_get_sighelper_token (MonoDynamicImage *assembly, MonoReflectionSigHelper *helper, MonoError *error)
-{
-       guint32 idx;
-       MonoDynamicTable *table;
-       guint32 *values;
-
-       mono_error_init (error);
-
-       table = &assembly->tables [MONO_TABLE_STANDALONESIG];
-       idx = table->next_idx ++;
-       table->rows ++;
-       alloc_table (table, table->rows);
-       values = table->values + idx * MONO_STAND_ALONE_SIGNATURE_SIZE;
-
-       values [MONO_STAND_ALONE_SIGNATURE] =
-               mono_reflection_encode_sighelper (assembly, helper, error);
-       return_val_if_nok (error, 0);
-       
-       return idx;
-}
-
-static int
-reflection_cc_to_file (int call_conv) {
-       switch (call_conv & 0x3) {
-       case 0:
-       case 1: return MONO_CALL_DEFAULT;
-       case 2: return MONO_CALL_VARARG;
-       default:
-               g_assert_not_reached ();
-       }
-       return 0;
-}
-#endif /* !DISABLE_REFLECTION_EMIT */
-
-typedef struct {
-       MonoType *parent;
-       MonoMethodSignature *sig;
-       char *name;
-       guint32 token;
-} ArrayMethod;
-
-#ifndef DISABLE_REFLECTION_EMIT
-static guint32
-mono_image_get_array_token (MonoDynamicImage *assembly, MonoReflectionArrayMethod *m, MonoError *error)
-{
-       guint32 nparams, i;
-       GList *tmp;
-       char *name = NULL;
-       MonoMethodSignature *sig;
-       ArrayMethod *am = NULL;
-       MonoType *mtype;
-
-       mono_error_init (error);
-
-       nparams = mono_array_length (m->parameters);
-       sig = (MonoMethodSignature *)g_malloc0 (MONO_SIZEOF_METHOD_SIGNATURE + sizeof (MonoType*) * nparams);
-       sig->hasthis = 1;
-       sig->sentinelpos = -1;
-       sig->call_convention = reflection_cc_to_file (m->call_conv);
-       sig->param_count = nparams;
-       if (m->ret) {
-               sig->ret = mono_reflection_type_get_handle (m->ret, error);
-               if (!is_ok (error))
-                       goto fail;
-       } else
-               sig->ret = &mono_defaults.void_class->byval_arg;
-
-       mtype = mono_reflection_type_get_handle (m->parent, error);
-       if (!is_ok (error))
-               goto fail;
-
-       for (i = 0; i < nparams; ++i) {
-               sig->params [i] = mono_type_array_get_and_resolve (m->parameters, i, error);
-               if (!is_ok (error))
-                       goto fail;
-       }
-
-       name = mono_string_to_utf8_checked (m->name, error);
-       if (!is_ok (error))
-               goto fail;
-       for (tmp = assembly->array_methods; tmp; tmp = tmp->next) {
-               am = (ArrayMethod *)tmp->data;
-               if (strcmp (name, am->name) == 0 && 
-                               mono_metadata_type_equal (am->parent, mtype) &&
-                               mono_metadata_signature_equal (am->sig, sig)) {
-                       g_free (name);
-                       g_free (sig);
-                       m->table_idx = am->token & 0xffffff;
-                       return am->token;
-               }
-       }
-       am = g_new0 (ArrayMethod, 1);
-       am->name = name;
-       am->sig = sig;
-       am->parent = mtype;
-       am->token = mono_image_get_memberref_token (assembly, am->parent, name,
-               method_encode_signature (assembly, sig));
-       assembly->array_methods = g_list_prepend (assembly->array_methods, am);
-       m->table_idx = am->token & 0xffffff;
-       return am->token;
-fail:
-       g_free (am);
-       g_free (name);
-       g_free (sig);
-       return 0;
-
-}
-
-/*
- * Insert into the metadata tables all the info about the TypeBuilder tb.
- * Data in the tables is inserted in a predefined order, since some tables need to be sorted.
- */
-static gboolean
-mono_image_get_type_info (MonoDomain *domain, MonoReflectionTypeBuilder *tb, MonoDynamicImage *assembly, MonoError *error)
-{
-       MonoDynamicTable *table;
-       guint *values;
-       int i, is_object = 0, is_system = 0;
-       char *n;
-
-       mono_error_init (error);
-
-       table = &assembly->tables [MONO_TABLE_TYPEDEF];
-       values = table->values + tb->table_idx * MONO_TYPEDEF_SIZE;
-       values [MONO_TYPEDEF_FLAGS] = tb->attrs;
-       n = mono_string_to_utf8_checked (tb->name, error);
-       return_val_if_nok (error, FALSE);
-       if (strcmp (n, "Object") == 0)
-               is_object++;
-       values [MONO_TYPEDEF_NAME] = string_heap_insert (&assembly->sheap, n);
-       g_free (n);
-       n = mono_string_to_utf8_checked (tb->nspace, error);
-       return_val_if_nok (error, FALSE);
-       if (strcmp (n, "System") == 0)
-               is_system++;
-       values [MONO_TYPEDEF_NAMESPACE] = string_heap_insert (&assembly->sheap, n);
-       g_free (n);
-       if (tb->parent && !(is_system && is_object) && 
-                       !(tb->attrs & TYPE_ATTRIBUTE_INTERFACE)) { /* interfaces don't have a parent */
-               MonoType *parent_type = mono_reflection_type_get_handle ((MonoReflectionType*)tb->parent, error);
-               return_val_if_nok (error, FALSE);
-               values [MONO_TYPEDEF_EXTENDS] = mono_image_typedef_or_ref (assembly, parent_type);
-       } else {
-               values [MONO_TYPEDEF_EXTENDS] = 0;
-       }
-       values [MONO_TYPEDEF_FIELD_LIST] = assembly->tables [MONO_TABLE_FIELD].next_idx;
-       values [MONO_TYPEDEF_METHOD_LIST] = assembly->tables [MONO_TABLE_METHOD].next_idx;
-
-       /*
-        * if we have explicitlayout or sequentiallayouts, output data in the
-        * ClassLayout table.
-        */
-       if (((tb->attrs & TYPE_ATTRIBUTE_LAYOUT_MASK) != TYPE_ATTRIBUTE_AUTO_LAYOUT) &&
-                       ((tb->class_size > 0) || (tb->packing_size > 0))) {
-               table = &assembly->tables [MONO_TABLE_CLASSLAYOUT];
-               table->rows++;
-               alloc_table (table, table->rows);
-               values = table->values + table->rows * MONO_CLASS_LAYOUT_SIZE;
-               values [MONO_CLASS_LAYOUT_PARENT] = tb->table_idx;
-               values [MONO_CLASS_LAYOUT_CLASS_SIZE] = tb->class_size;
-               values [MONO_CLASS_LAYOUT_PACKING_SIZE] = tb->packing_size;
-       }
-
-       /* handle interfaces */
-       if (tb->interfaces) {
-               table = &assembly->tables [MONO_TABLE_INTERFACEIMPL];
-               i = table->rows;
-               table->rows += mono_array_length (tb->interfaces);
-               alloc_table (table, table->rows);
-               values = table->values + (i + 1) * MONO_INTERFACEIMPL_SIZE;
-               for (i = 0; i < mono_array_length (tb->interfaces); ++i) {
-                       MonoReflectionType* iface = (MonoReflectionType*) mono_array_get (tb->interfaces, gpointer, i);
-                       MonoType *iface_type = mono_reflection_type_get_handle (iface, error);
-                       return_val_if_nok (error, FALSE);
-                       values [MONO_INTERFACEIMPL_CLASS] = tb->table_idx;
-                       values [MONO_INTERFACEIMPL_INTERFACE] = mono_image_typedef_or_ref (assembly, iface_type);
-                       values += MONO_INTERFACEIMPL_SIZE;
-               }
-       }
-
-       /* handle fields */
-       if (tb->fields) {
-               table = &assembly->tables [MONO_TABLE_FIELD];
-               table->rows += tb->num_fields;
-               alloc_table (table, table->rows);
-               for (i = 0; i < tb->num_fields; ++i) {
-                       mono_image_get_field_info (
-                               mono_array_get (tb->fields, MonoReflectionFieldBuilder*, i), assembly, error);
-                       return_val_if_nok (error, FALSE);
-               }
-       }
-
-       /* handle constructors */
-       if (tb->ctors) {
-               table = &assembly->tables [MONO_TABLE_METHOD];
-               table->rows += mono_array_length (tb->ctors);
-               alloc_table (table, table->rows);
-               for (i = 0; i < mono_array_length (tb->ctors); ++i) {
-                       if (!mono_image_get_ctor_info (domain,
-                                                      mono_array_get (tb->ctors, MonoReflectionCtorBuilder*, i),
-                                                      assembly, error))
-                               return FALSE;
-               }
-       }
-
-       /* handle methods */
-       if (tb->methods) {
-               table = &assembly->tables [MONO_TABLE_METHOD];
-               table->rows += tb->num_methods;
-               alloc_table (table, table->rows);
-               for (i = 0; i < tb->num_methods; ++i) {
-                       if (!mono_image_get_method_info (
-                                   mono_array_get (tb->methods, MonoReflectionMethodBuilder*, i), assembly, error))
-                               return FALSE;
-               }
-       }
-
-       /* Do the same with properties etc.. */
-       if (tb->events && mono_array_length (tb->events)) {
-               table = &assembly->tables [MONO_TABLE_EVENT];
-               table->rows += mono_array_length (tb->events);
-               alloc_table (table, table->rows);
-               table = &assembly->tables [MONO_TABLE_EVENTMAP];
-               table->rows ++;
-               alloc_table (table, table->rows);
-               values = table->values + table->rows * MONO_EVENT_MAP_SIZE;
-               values [MONO_EVENT_MAP_PARENT] = tb->table_idx;
-               values [MONO_EVENT_MAP_EVENTLIST] = assembly->tables [MONO_TABLE_EVENT].next_idx;
-               for (i = 0; i < mono_array_length (tb->events); ++i) {
-                       mono_image_get_event_info (
-                               mono_array_get (tb->events, MonoReflectionEventBuilder*, i), assembly, error);
-                       return_val_if_nok (error, FALSE);
-               }
-       }
-       if (tb->properties && mono_array_length (tb->properties)) {
-               table = &assembly->tables [MONO_TABLE_PROPERTY];
-               table->rows += mono_array_length (tb->properties);
-               alloc_table (table, table->rows);
-               table = &assembly->tables [MONO_TABLE_PROPERTYMAP];
-               table->rows ++;
-               alloc_table (table, table->rows);
-               values = table->values + table->rows * MONO_PROPERTY_MAP_SIZE;
-               values [MONO_PROPERTY_MAP_PARENT] = tb->table_idx;
-               values [MONO_PROPERTY_MAP_PROPERTY_LIST] = assembly->tables [MONO_TABLE_PROPERTY].next_idx;
-               for (i = 0; i < mono_array_length (tb->properties); ++i) {
-                       mono_image_get_property_info (
-                               mono_array_get (tb->properties, MonoReflectionPropertyBuilder*, i), assembly, error);
-                       return_val_if_nok (error, FALSE);
-               }
-       }
-
-       /* handle generic parameters */
-       if (tb->generic_params) {
-               table = &assembly->tables [MONO_TABLE_GENERICPARAM];
-               table->rows += mono_array_length (tb->generic_params);
-               alloc_table (table, table->rows);
-               for (i = 0; i < mono_array_length (tb->generic_params); ++i) {
-                       guint32 owner = MONO_TYPEORMETHOD_TYPE | (tb->table_idx << MONO_TYPEORMETHOD_BITS);
-
-                       mono_image_get_generic_param_info (
-                               mono_array_get (tb->generic_params, MonoReflectionGenericParam*, i), owner, assembly);
-               }
-       }
-
-       mono_image_add_decl_security (assembly, 
-               mono_metadata_make_token (MONO_TABLE_TYPEDEF, tb->table_idx), tb->permissions);
-
-       if (tb->subtypes) {
-               MonoDynamicTable *ntable;
-               
-               ntable = &assembly->tables [MONO_TABLE_NESTEDCLASS];
-               ntable->rows += mono_array_length (tb->subtypes);
-               alloc_table (ntable, ntable->rows);
-               values = ntable->values + ntable->next_idx * MONO_NESTED_CLASS_SIZE;
-
-               for (i = 0; i < mono_array_length (tb->subtypes); ++i) {
-                       MonoReflectionTypeBuilder *subtype = mono_array_get (tb->subtypes, MonoReflectionTypeBuilder*, i);
-
-                       values [MONO_NESTED_CLASS_NESTED] = subtype->table_idx;
-                       values [MONO_NESTED_CLASS_ENCLOSING] = tb->table_idx;
-                       /*g_print ("nesting %s (%d) in %s (%d) (rows %d/%d)\n",
-                               mono_string_to_utf8 (subtype->name), subtype->table_idx,
-                               mono_string_to_utf8 (tb->name), tb->table_idx,
-                               ntable->next_idx, ntable->rows);*/
-                       values += MONO_NESTED_CLASS_SIZE;
-                       ntable->next_idx++;
-               }
-       }
-
-       return TRUE;
-}
-#endif
-
-static void
-collect_types (MonoPtrArray *types, MonoReflectionTypeBuilder *type)
-{
-       int i;
-
-       mono_ptr_array_append (*types, type);
-
-       if (!type->subtypes)
-               return;
-
-       for (i = 0; i < mono_array_length (type->subtypes); ++i) {
-               MonoReflectionTypeBuilder *subtype = mono_array_get (type->subtypes, MonoReflectionTypeBuilder*, i);
-               collect_types (types, subtype);
-       }
-}
-
-static gint
-compare_types_by_table_idx (MonoReflectionTypeBuilder **type1, MonoReflectionTypeBuilder **type2)
-{
-       if ((*type1)->table_idx < (*type2)->table_idx)
-               return -1;
-       else
-               if ((*type1)->table_idx > (*type2)->table_idx)
-                       return 1;
-       else
-               return 0;
-}
-
-static gboolean
-params_add_cattrs (MonoDynamicImage *assembly, MonoArray *pinfo, MonoError *error) {
-       int i;
-
-       mono_error_init (error);
-       if (!pinfo)
-               return TRUE;
-       for (i = 0; i < mono_array_length (pinfo); ++i) {
-               MonoReflectionParamBuilder *pb;
-               pb = mono_array_get (pinfo, MonoReflectionParamBuilder *, i);
-               if (!pb)
-                       continue;
-               if (!mono_image_add_cattrs (assembly, pb->table_idx, MONO_CUSTOM_ATTR_PARAMDEF, pb->cattrs, error))
-                       return FALSE;
-       }
-
-       return TRUE;
-}
-
-static gboolean
-type_add_cattrs (MonoDynamicImage *assembly, MonoReflectionTypeBuilder *tb, MonoError *error) {
-       int i;
-
-       mono_error_init (error);
-       
-       if (!mono_image_add_cattrs (assembly, tb->table_idx, MONO_CUSTOM_ATTR_TYPEDEF, tb->cattrs, error))
-               return FALSE;
-       if (tb->fields) {
-               for (i = 0; i < tb->num_fields; ++i) {
-                       MonoReflectionFieldBuilder* fb;
-                       fb = mono_array_get (tb->fields, MonoReflectionFieldBuilder*, i);
-                       if (!mono_image_add_cattrs (assembly, fb->table_idx, MONO_CUSTOM_ATTR_FIELDDEF, fb->cattrs, error))
-                               return FALSE;
-               }
-       }
-       if (tb->events) {
-               for (i = 0; i < mono_array_length (tb->events); ++i) {
-                       MonoReflectionEventBuilder* eb;
-                       eb = mono_array_get (tb->events, MonoReflectionEventBuilder*, i);
-                       if (!mono_image_add_cattrs (assembly, eb->table_idx, MONO_CUSTOM_ATTR_EVENT, eb->cattrs, error))
-                               return FALSE;
-               }
-       }
-       if (tb->properties) {
-               for (i = 0; i < mono_array_length (tb->properties); ++i) {
-                       MonoReflectionPropertyBuilder* pb;
-                       pb = mono_array_get (tb->properties, MonoReflectionPropertyBuilder*, i);
-                       if (!mono_image_add_cattrs (assembly, pb->table_idx, MONO_CUSTOM_ATTR_PROPERTY, pb->cattrs, error))
-                               return FALSE;
-               }
-       }
-       if (tb->ctors) {
-               for (i = 0; i < mono_array_length (tb->ctors); ++i) {
-                       MonoReflectionCtorBuilder* cb;
-                       cb = mono_array_get (tb->ctors, MonoReflectionCtorBuilder*, i);
-                       if (!mono_image_add_cattrs (assembly, cb->table_idx, MONO_CUSTOM_ATTR_METHODDEF, cb->cattrs, error) ||
-                           !params_add_cattrs (assembly, cb->pinfo, error))
-                               return FALSE;
-               }
-       }
-
-       if (tb->methods) {
-               for (i = 0; i < tb->num_methods; ++i) {
-                       MonoReflectionMethodBuilder* mb;
-                       mb = mono_array_get (tb->methods, MonoReflectionMethodBuilder*, i);
-                       if (!mono_image_add_cattrs (assembly, mb->table_idx, MONO_CUSTOM_ATTR_METHODDEF, mb->cattrs, error) ||
-                           !params_add_cattrs (assembly, mb->pinfo, error))
-                               return FALSE;
-               }
-       }
-
-       if (tb->subtypes) {
-               for (i = 0; i < mono_array_length (tb->subtypes); ++i) {
-                       if (!type_add_cattrs (assembly, mono_array_get (tb->subtypes, MonoReflectionTypeBuilder*, i), error))
-                               return FALSE;
-               }
-       }
-
-       return TRUE;
-}
-
-static gboolean
-module_add_cattrs (MonoDynamicImage *assembly, MonoReflectionModuleBuilder *moduleb, MonoError *error)
-{
-       int i;
-       
-       mono_error_init (error);
-
-       if (!mono_image_add_cattrs (assembly, moduleb->table_idx, MONO_CUSTOM_ATTR_MODULE, moduleb->cattrs, error))
-               return FALSE;
-
-       if (moduleb->global_methods) {
-               for (i = 0; i < mono_array_length (moduleb->global_methods); ++i) {
-                       MonoReflectionMethodBuilder* mb = mono_array_get (moduleb->global_methods, MonoReflectionMethodBuilder*, i);
-                       if (!mono_image_add_cattrs (assembly, mb->table_idx, MONO_CUSTOM_ATTR_METHODDEF, mb->cattrs, error) ||
-                           !params_add_cattrs (assembly, mb->pinfo, error))
-                               return FALSE;
-               }
-       }
-
-       if (moduleb->global_fields) {
-               for (i = 0; i < mono_array_length (moduleb->global_fields); ++i) {
-                       MonoReflectionFieldBuilder *fb = mono_array_get (moduleb->global_fields, MonoReflectionFieldBuilder*, i);
-                       if (!mono_image_add_cattrs (assembly, fb->table_idx, MONO_CUSTOM_ATTR_FIELDDEF, fb->cattrs, error))
-                               return FALSE;
-               }
-       }
-       
-       if (moduleb->types) {
-               for (i = 0; i < moduleb->num_types; ++i) {
-                       if (!type_add_cattrs (assembly, mono_array_get (moduleb->types, MonoReflectionTypeBuilder*, i), error))
-                               return FALSE;
-               }
-       }
-
-       return TRUE;
-}
-
-static gboolean
-mono_image_fill_file_table (MonoDomain *domain, MonoReflectionModule *module, MonoDynamicImage *assembly, MonoError *error)
-{
-       MonoDynamicTable *table;
-       guint32 *values;
-       char blob_size [6];
-       guchar hash [20];
-       char *b = blob_size;
-       char *dir, *path;
-
-       mono_error_init (error);
-
-       table = &assembly->tables [MONO_TABLE_FILE];
-       table->rows++;
-       alloc_table (table, table->rows);
-       values = table->values + table->next_idx * MONO_FILE_SIZE;
-       values [MONO_FILE_FLAGS] = FILE_CONTAINS_METADATA;
-       values [MONO_FILE_NAME] = string_heap_insert (&assembly->sheap, module->image->module_name);
-       if (image_is_dynamic (module->image)) {
-               /* This depends on the fact that the main module is emitted last */
-               dir = mono_string_to_utf8_checked (((MonoReflectionModuleBuilder*)module)->assemblyb->dir, error);
-               return_val_if_nok (error, FALSE);
-               path = g_strdup_printf ("%s%c%s", dir, G_DIR_SEPARATOR, module->image->module_name);
-       } else {
-               dir = NULL;
-               path = g_strdup (module->image->name);
-       }
-       mono_sha1_get_digest_from_file (path, hash);
-       g_free (dir);
-       g_free (path);
-       mono_metadata_encode_value (20, b, &b);
-       values [MONO_FILE_HASH_VALUE] = mono_image_add_stream_data (&assembly->blob, blob_size, b-blob_size);
-       mono_image_add_stream_data (&assembly->blob, (char*)hash, 20);
-       table->next_idx ++;
-       return TRUE;
-}
-
-static void
-mono_image_fill_module_table (MonoDomain *domain, MonoReflectionModuleBuilder *mb, MonoDynamicImage *assembly, MonoError *error)
-{
-       MonoDynamicTable *table;
-       int i;
-
-       mono_error_init (error);
-
-       table = &assembly->tables [MONO_TABLE_MODULE];
-       mb->table_idx = table->next_idx ++;
-       table->values [mb->table_idx * MONO_MODULE_SIZE + MONO_MODULE_NAME] = string_heap_insert_mstring (&assembly->sheap, mb->module.name, error);
-       return_if_nok (error);
-       i = mono_image_add_stream_data (&assembly->guid, mono_array_addr (mb->guid, char, 0), 16);
-       i /= 16;
-       ++i;
-       table->values [mb->table_idx * MONO_MODULE_SIZE + MONO_MODULE_GENERATION] = 0;
-       table->values [mb->table_idx * MONO_MODULE_SIZE + MONO_MODULE_MVID] = i;
-       table->values [mb->table_idx * MONO_MODULE_SIZE + MONO_MODULE_ENC] = 0;
-       table->values [mb->table_idx * MONO_MODULE_SIZE + MONO_MODULE_ENCBASE] = 0;
-}
-
-static guint32
-mono_image_fill_export_table_from_class (MonoDomain *domain, MonoClass *klass,
-       guint32 module_index, guint32 parent_index, MonoDynamicImage *assembly)
-{
-       MonoDynamicTable *table;
-       guint32 *values;
-       guint32 visib, res;
-
-       visib = klass->flags & TYPE_ATTRIBUTE_VISIBILITY_MASK;
-       if (! ((visib & TYPE_ATTRIBUTE_PUBLIC) || (visib & TYPE_ATTRIBUTE_NESTED_PUBLIC)))
-               return 0;
-
-       table = &assembly->tables [MONO_TABLE_EXPORTEDTYPE];
-       table->rows++;
-       alloc_table (table, table->rows);
-       values = table->values + table->next_idx * MONO_EXP_TYPE_SIZE;
-
-       values [MONO_EXP_TYPE_FLAGS] = klass->flags;
-       values [MONO_EXP_TYPE_TYPEDEF] = klass->type_token;
-       if (klass->nested_in)
-               values [MONO_EXP_TYPE_IMPLEMENTATION] = (parent_index << MONO_IMPLEMENTATION_BITS) + MONO_IMPLEMENTATION_EXP_TYPE;
-       else
-               values [MONO_EXP_TYPE_IMPLEMENTATION] = (module_index << MONO_IMPLEMENTATION_BITS) + MONO_IMPLEMENTATION_FILE;
-       values [MONO_EXP_TYPE_NAME] = string_heap_insert (&assembly->sheap, klass->name);
-       values [MONO_EXP_TYPE_NAMESPACE] = string_heap_insert (&assembly->sheap, klass->name_space);
-
-       res = table->next_idx;
-
-       table->next_idx ++;
-
-       /* Emit nested types */
-       if (klass->ext && klass->ext->nested_classes) {
-               GList *tmp;
-
-               for (tmp = klass->ext->nested_classes; tmp; tmp = tmp->next)
-                       mono_image_fill_export_table_from_class (domain, (MonoClass *)tmp->data, module_index, table->next_idx - 1, assembly);
-       }
-
-       return res;
-}
-
-static void
-mono_image_fill_export_table (MonoDomain *domain, MonoReflectionTypeBuilder *tb,
-                             guint32 module_index, guint32 parent_index, MonoDynamicImage *assembly,
-                             MonoError *error)
-{
-       MonoClass *klass;
-       guint32 idx, i;
-
-       mono_error_init (error);
-
-       MonoType *t = mono_reflection_type_get_handle ((MonoReflectionType*)tb, error);
-       return_if_nok (error);
-
-       klass = mono_class_from_mono_type (t);
-
-       klass->type_token = mono_metadata_make_token (MONO_TABLE_TYPEDEF, tb->table_idx);
-
-       idx = mono_image_fill_export_table_from_class (domain, klass, module_index, 
-                                                                                                  parent_index, assembly);
-
-       /* 
-        * Emit nested types
-        * We need to do this ourselves since klass->nested_classes is not set up.
-        */
-       if (tb->subtypes) {
-               for (i = 0; i < mono_array_length (tb->subtypes); ++i) {
-                       mono_image_fill_export_table (domain, mono_array_get (tb->subtypes, MonoReflectionTypeBuilder*, i), module_index, idx, assembly, error);
-                       return_if_nok (error);
-               }
-       }
-}
-
-static void
-mono_image_fill_export_table_from_module (MonoDomain *domain, MonoReflectionModule *module,
-       guint32 module_index, MonoDynamicImage *assembly)
-{
-       MonoImage *image = module->image;
-       MonoTableInfo  *t;
-       guint32 i;
-
-       t = &image->tables [MONO_TABLE_TYPEDEF];
-
-       for (i = 0; i < t->rows; ++i) {
-               MonoError error;
-               MonoClass *klass = mono_class_get_checked (image, mono_metadata_make_token (MONO_TABLE_TYPEDEF, i + 1), &error);
-               g_assert (mono_error_ok (&error)); /* FIXME don't swallow the error */
-
-               if (klass->flags & TYPE_ATTRIBUTE_PUBLIC)
-                       mono_image_fill_export_table_from_class (domain, klass, module_index, 0, assembly);
-       }
-}
-
-static void
-add_exported_type (MonoReflectionAssemblyBuilder *assemblyb, MonoDynamicImage *assembly, MonoClass *klass, guint32 parent_index)
-{
-       MonoDynamicTable *table;
-       guint32 *values;
-       guint32 scope, scope_idx, impl, current_idx;
-       gboolean forwarder = TRUE;
-       gpointer iter = NULL;
-       MonoClass *nested;
-
-       if (klass->nested_in) {
-               impl = (parent_index << MONO_IMPLEMENTATION_BITS) + MONO_IMPLEMENTATION_EXP_TYPE;
-               forwarder = FALSE;
-       } else {
-               scope = resolution_scope_from_image (assembly, klass->image);
-               g_assert ((scope & MONO_RESOLUTION_SCOPE_MASK) == MONO_RESOLUTION_SCOPE_ASSEMBLYREF);
-               scope_idx = scope >> MONO_RESOLUTION_SCOPE_BITS;
-               impl = (scope_idx << MONO_IMPLEMENTATION_BITS) + MONO_IMPLEMENTATION_ASSEMBLYREF;
-       }
-
-       table = &assembly->tables [MONO_TABLE_EXPORTEDTYPE];
-
-       table->rows++;
-       alloc_table (table, table->rows);
-       current_idx = table->next_idx;
-       values = table->values + current_idx * MONO_EXP_TYPE_SIZE;
-
-       values [MONO_EXP_TYPE_FLAGS] = forwarder ? TYPE_ATTRIBUTE_FORWARDER : 0;
-       values [MONO_EXP_TYPE_TYPEDEF] = 0;
-       values [MONO_EXP_TYPE_IMPLEMENTATION] = impl;
-       values [MONO_EXP_TYPE_NAME] = string_heap_insert (&assembly->sheap, klass->name);
-       values [MONO_EXP_TYPE_NAMESPACE] = string_heap_insert (&assembly->sheap, klass->name_space);
-
-       table->next_idx++;
-
-       while ((nested = mono_class_get_nested_types (klass, &iter)))
-               add_exported_type (assemblyb, assembly, nested, current_idx);
-}
-
-static void
-mono_image_fill_export_table_from_type_forwarders (MonoReflectionAssemblyBuilder *assemblyb, MonoDynamicImage *assembly)
-{
-       MonoError error;
-       MonoClass *klass;
-       int i;
-
-       if (!assemblyb->type_forwarders)
-               return;
-
-       for (i = 0; i < mono_array_length (assemblyb->type_forwarders); ++i) {
-               MonoReflectionType *t = mono_array_get (assemblyb->type_forwarders, MonoReflectionType *, i);
-               MonoType *type;
-               if (!t)
-                       continue;
-
-               type = mono_reflection_type_get_handle (t, &error);
-               mono_error_assert_ok (&error);
-               g_assert (type);
-
-               klass = mono_class_from_mono_type (type);
-
-               add_exported_type (assemblyb, assembly, klass, 0);
-       }
-}
-
-#define align_pointer(base,p)\
-       do {\
-               guint32 __diff = (unsigned char*)(p)-(unsigned char*)(base);\
-               if (__diff & 3)\
-                       (p) += 4 - (__diff & 3);\
-       } while (0)
-
-static int
-compare_constants (const void *a, const void *b)
-{
-       const guint32 *a_values = (const guint32 *)a;
-       const guint32 *b_values = (const guint32 *)b;
-       return a_values [MONO_CONSTANT_PARENT] - b_values [MONO_CONSTANT_PARENT];
-}
-
-static int
-compare_semantics (const void *a, const void *b)
-{
-       const guint32 *a_values = (const guint32 *)a;
-       const guint32 *b_values = (const guint32 *)b;
-       int assoc = a_values [MONO_METHOD_SEMA_ASSOCIATION] - b_values [MONO_METHOD_SEMA_ASSOCIATION];
-       if (assoc)
-               return assoc;
-       return a_values [MONO_METHOD_SEMA_SEMANTICS] - b_values [MONO_METHOD_SEMA_SEMANTICS];
-}
-
-static int
-compare_custom_attrs (const void *a, const void *b)
-{
-       const guint32 *a_values = (const guint32 *)a;
-       const guint32 *b_values = (const guint32 *)b;
-
-       return a_values [MONO_CUSTOM_ATTR_PARENT] - b_values [MONO_CUSTOM_ATTR_PARENT];
-}
-
-static int
-compare_field_marshal (const void *a, const void *b)
-{
-       const guint32 *a_values = (const guint32 *)a;
-       const guint32 *b_values = (const guint32 *)b;
-
-       return a_values [MONO_FIELD_MARSHAL_PARENT] - b_values [MONO_FIELD_MARSHAL_PARENT];
-}
-
-static int
-compare_nested (const void *a, const void *b)
-{
-       const guint32 *a_values = (const guint32 *)a;
-       const guint32 *b_values = (const guint32 *)b;
-
-       return a_values [MONO_NESTED_CLASS_NESTED] - b_values [MONO_NESTED_CLASS_NESTED];
-}
-
-static int
-compare_genericparam (const void *a, const void *b)
-{
-       MonoError error;
-       const GenericParamTableEntry **a_entry = (const GenericParamTableEntry **) a;
-       const GenericParamTableEntry **b_entry = (const GenericParamTableEntry **) b;
-
-       if ((*b_entry)->owner == (*a_entry)->owner) {
-               MonoType *a_type = mono_reflection_type_get_handle ((MonoReflectionType*)(*a_entry)->gparam, &error);
-               mono_error_assert_ok (&error);
-               MonoType *b_type = mono_reflection_type_get_handle ((MonoReflectionType*)(*b_entry)->gparam, &error);
-               mono_error_assert_ok (&error);
-               return 
-                       mono_type_get_generic_param_num (a_type) -
-                       mono_type_get_generic_param_num (b_type);
-       } else
-               return (*a_entry)->owner - (*b_entry)->owner;
-}
-
-static int
-compare_declsecurity_attrs (const void *a, const void *b)
-{
-       const guint32 *a_values = (const guint32 *)a;
-       const guint32 *b_values = (const guint32 *)b;
-
-       return a_values [MONO_DECL_SECURITY_PARENT] - b_values [MONO_DECL_SECURITY_PARENT];
-}
-
-static int
-compare_interface_impl (const void *a, const void *b)
-{
-       const guint32 *a_values = (const guint32 *)a;
-       const guint32 *b_values = (const guint32 *)b;
-
-       int klass = a_values [MONO_INTERFACEIMPL_CLASS] - b_values [MONO_INTERFACEIMPL_CLASS];
-       if (klass)
-               return klass;
-
-       return a_values [MONO_INTERFACEIMPL_INTERFACE] - b_values [MONO_INTERFACEIMPL_INTERFACE];
-}
-
-static void
-pad_heap (MonoDynamicStream *sh)
-{
-       if (sh->index & 3) {
-               int sz = 4 - (sh->index & 3);
-               memset (sh->data + sh->index, 0, sz);
-               sh->index += sz;
-       }
-}
-
-struct StreamDesc {
-       const char *name;
-       MonoDynamicStream *stream;
-};
-
-/*
- * build_compressed_metadata() fills in the blob of data that represents the 
- * raw metadata as it will be saved in the PE file. The five streams are output 
- * and the metadata tables are comnpressed from the guint32 array representation, 
- * to the compressed on-disk format.
- */
-static gboolean
-build_compressed_metadata (MonoDynamicImage *assembly, MonoError *error)
-{
-       MonoDynamicTable *table;
-       int i;
-       guint64 valid_mask = 0;
-       guint64 sorted_mask;
-       guint32 heapt_size = 0;
-       guint32 meta_size = 256; /* allow for header and other stuff */
-       guint32 table_offset;
-       guint32 ntables = 0;
-       guint64 *int64val;
-       guint32 *int32val;
-       guint16 *int16val;
-       MonoImage *meta;
-       unsigned char *p;
-       struct StreamDesc stream_desc [5];
-
-       mono_error_init (error);
-
-       qsort (assembly->gen_params->pdata, assembly->gen_params->len, sizeof (gpointer), compare_genericparam);
-       for (i = 0; i < assembly->gen_params->len; i++) {
-               GenericParamTableEntry *entry = (GenericParamTableEntry *)g_ptr_array_index (assembly->gen_params, i);
-               if (!write_generic_param_entry (assembly, entry, error))
-                       return FALSE;
-       }
-
-       stream_desc [0].name  = "#~";
-       stream_desc [0].stream = &assembly->tstream;
-       stream_desc [1].name  = "#Strings";
-       stream_desc [1].stream = &assembly->sheap;
-       stream_desc [2].name  = "#US";
-       stream_desc [2].stream = &assembly->us;
-       stream_desc [3].name  = "#Blob";
-       stream_desc [3].stream = &assembly->blob;
-       stream_desc [4].name  = "#GUID";
-       stream_desc [4].stream = &assembly->guid;
-       
-       /* tables that are sorted */
-       sorted_mask = ((guint64)1 << MONO_TABLE_CONSTANT) | ((guint64)1 << MONO_TABLE_FIELDMARSHAL)
-               | ((guint64)1 << MONO_TABLE_METHODSEMANTICS) | ((guint64)1 << MONO_TABLE_CLASSLAYOUT)
-               | ((guint64)1 << MONO_TABLE_FIELDLAYOUT) | ((guint64)1 << MONO_TABLE_FIELDRVA)
-               | ((guint64)1 << MONO_TABLE_IMPLMAP) | ((guint64)1 << MONO_TABLE_NESTEDCLASS)
-               | ((guint64)1 << MONO_TABLE_METHODIMPL) | ((guint64)1 << MONO_TABLE_CUSTOMATTRIBUTE)
-               | ((guint64)1 << MONO_TABLE_DECLSECURITY) | ((guint64)1 << MONO_TABLE_GENERICPARAM)
-               | ((guint64)1 << MONO_TABLE_INTERFACEIMPL);
-       
-       /* Compute table sizes */
-       /* the MonoImage has already been created in mono_image_basic_init() */
-       meta = &assembly->image;
-
-       /* sizes should be multiple of 4 */
-       pad_heap (&assembly->blob);
-       pad_heap (&assembly->guid);
-       pad_heap (&assembly->sheap);
-       pad_heap (&assembly->us);
-
-       /* Setup the info used by compute_sizes () */
-       meta->idx_blob_wide = assembly->blob.index >= 65536 ? 1 : 0;
-       meta->idx_guid_wide = assembly->guid.index >= 65536 ? 1 : 0;
-       meta->idx_string_wide = assembly->sheap.index >= 65536 ? 1 : 0;
-
-       meta_size += assembly->blob.index;
-       meta_size += assembly->guid.index;
-       meta_size += assembly->sheap.index;
-       meta_size += assembly->us.index;
-
-       for (i=0; i < MONO_TABLE_NUM; ++i)
-               meta->tables [i].rows = assembly->tables [i].rows;
-       
-       for (i = 0; i < MONO_TABLE_NUM; i++){
-               if (meta->tables [i].rows == 0)
-                       continue;
-               valid_mask |= (guint64)1 << i;
-               ntables ++;
-               meta->tables [i].row_size = mono_metadata_compute_size (
-                       meta, i, &meta->tables [i].size_bitfield);
-               heapt_size += meta->tables [i].row_size * meta->tables [i].rows;
-       }
-       heapt_size += 24; /* #~ header size */
-       heapt_size += ntables * 4;
-       /* make multiple of 4 */
-       heapt_size += 3;
-       heapt_size &= ~3;
-       meta_size += heapt_size;
-       meta->raw_metadata = (char *)g_malloc0 (meta_size);
-       p = (unsigned char*)meta->raw_metadata;
-       /* the metadata signature */
-       *p++ = 'B'; *p++ = 'S'; *p++ = 'J'; *p++ = 'B';
-       /* version numbers and 4 bytes reserved */
-       int16val = (guint16*)p;
-       *int16val++ = GUINT16_TO_LE (meta->md_version_major);
-       *int16val = GUINT16_TO_LE (meta->md_version_minor);
-       p += 8;
-       /* version string */
-       int32val = (guint32*)p;
-       *int32val = GUINT32_TO_LE ((strlen (meta->version) + 3) & (~3)); /* needs to be multiple of 4 */
-       p += 4;
-       memcpy (p, meta->version, strlen (meta->version));
-       p += GUINT32_FROM_LE (*int32val);
-       align_pointer (meta->raw_metadata, p);
-       int16val = (guint16*)p;
-       *int16val++ = GUINT16_TO_LE (0); /* flags must be 0 */
-       *int16val = GUINT16_TO_LE (5); /* number of streams */
-       p += 4;
-
-       /*
-        * write the stream info.
-        */
-       table_offset = (p - (unsigned char*)meta->raw_metadata) + 5 * 8 + 40; /* room needed for stream headers */
-       table_offset += 3; table_offset &= ~3;
-
-       assembly->tstream.index = heapt_size;
-       for (i = 0; i < 5; ++i) {
-               int32val = (guint32*)p;
-               stream_desc [i].stream->offset = table_offset;
-               *int32val++ = GUINT32_TO_LE (table_offset);
-               *int32val = GUINT32_TO_LE (stream_desc [i].stream->index);
-               table_offset += GUINT32_FROM_LE (*int32val);
-               table_offset += 3; table_offset &= ~3;
-               p += 8;
-               strcpy ((char*)p, stream_desc [i].name);
-               p += strlen (stream_desc [i].name) + 1;
-               align_pointer (meta->raw_metadata, p);
-       }
-       /* 
-        * now copy the data, the table stream header and contents goes first.
-        */
-       g_assert ((p - (unsigned char*)meta->raw_metadata) < assembly->tstream.offset);
-       p = (guchar*)meta->raw_metadata + assembly->tstream.offset;
-       int32val = (guint32*)p;
-       *int32val = GUINT32_TO_LE (0); /* reserved */
-       p += 4;
-
-       *p++ = 2; /* version */
-       *p++ = 0;
-
-       if (meta->idx_string_wide)
-               *p |= 0x01;
-       if (meta->idx_guid_wide)
-               *p |= 0x02;
-       if (meta->idx_blob_wide)
-               *p |= 0x04;
-       ++p;
-       *p++ = 1; /* reserved */
-       int64val = (guint64*)p;
-       *int64val++ = GUINT64_TO_LE (valid_mask);
-       *int64val++ = GUINT64_TO_LE (valid_mask & sorted_mask); /* bitvector of sorted tables  */
-       p += 16;
-       int32val = (guint32*)p;
-       for (i = 0; i < MONO_TABLE_NUM; i++){
-               if (meta->tables [i].rows == 0)
-                       continue;
-               *int32val++ = GUINT32_TO_LE (meta->tables [i].rows);
-       }
-       p = (unsigned char*)int32val;
-
-       /* sort the tables that still need sorting */
-       table = &assembly->tables [MONO_TABLE_CONSTANT];
-       if (table->rows)
-               qsort (table->values + MONO_CONSTANT_SIZE, table->rows, sizeof (guint32) * MONO_CONSTANT_SIZE, compare_constants);
-       table = &assembly->tables [MONO_TABLE_METHODSEMANTICS];
-       if (table->rows)
-               qsort (table->values + MONO_METHOD_SEMA_SIZE, table->rows, sizeof (guint32) * MONO_METHOD_SEMA_SIZE, compare_semantics);
-       table = &assembly->tables [MONO_TABLE_CUSTOMATTRIBUTE];
-       if (table->rows)
-               qsort (table->values + MONO_CUSTOM_ATTR_SIZE, table->rows, sizeof (guint32) * MONO_CUSTOM_ATTR_SIZE, compare_custom_attrs);
-       table = &assembly->tables [MONO_TABLE_FIELDMARSHAL];
-       if (table->rows)
-               qsort (table->values + MONO_FIELD_MARSHAL_SIZE, table->rows, sizeof (guint32) * MONO_FIELD_MARSHAL_SIZE, compare_field_marshal);
-       table = &assembly->tables [MONO_TABLE_NESTEDCLASS];
-       if (table->rows)
-               qsort (table->values + MONO_NESTED_CLASS_SIZE, table->rows, sizeof (guint32) * MONO_NESTED_CLASS_SIZE, compare_nested);
-       /* Section 21.11 DeclSecurity in Partition II doesn't specify this to be sorted by MS implementation requires it */
-       table = &assembly->tables [MONO_TABLE_DECLSECURITY];
-       if (table->rows)
-               qsort (table->values + MONO_DECL_SECURITY_SIZE, table->rows, sizeof (guint32) * MONO_DECL_SECURITY_SIZE, compare_declsecurity_attrs);
-       table = &assembly->tables [MONO_TABLE_INTERFACEIMPL];
-       if (table->rows)
-               qsort (table->values + MONO_INTERFACEIMPL_SIZE, table->rows, sizeof (guint32) * MONO_INTERFACEIMPL_SIZE, compare_interface_impl);
-
-       /* compress the tables */
-       for (i = 0; i < MONO_TABLE_NUM; i++){
-               int row, col;
-               guint32 *values;
-               guint32 bitfield = meta->tables [i].size_bitfield;
-               if (!meta->tables [i].rows)
-                       continue;
-               if (assembly->tables [i].columns != mono_metadata_table_count (bitfield))
-                       g_error ("col count mismatch in %d: %d %d", i, assembly->tables [i].columns, mono_metadata_table_count (bitfield));
-               meta->tables [i].base = (char*)p;
-               for (row = 1; row <= meta->tables [i].rows; ++row) {
-                       values = assembly->tables [i].values + row * assembly->tables [i].columns;
-                       for (col = 0; col < assembly->tables [i].columns; ++col) {
-                               switch (mono_metadata_table_size (bitfield, col)) {
-                               case 1:
-                                       *p++ = values [col];
-                                       break;
-                               case 2:
-                                       *p++ = values [col] & 0xff;
-                                       *p++ = (values [col] >> 8) & 0xff;
-                                       break;
-                               case 4:
-                                       *p++ = values [col] & 0xff;
-                                       *p++ = (values [col] >> 8) & 0xff;
-                                       *p++ = (values [col] >> 16) & 0xff;
-                                       *p++ = (values [col] >> 24) & 0xff;
-                                       break;
-                               default:
-                                       g_assert_not_reached ();
-                               }
-                       }
-               }
-               g_assert ((p - (const unsigned char*)meta->tables [i].base) == (meta->tables [i].rows * meta->tables [i].row_size));
-       }
-       
-       g_assert (assembly->guid.offset + assembly->guid.index < meta_size);
-       memcpy (meta->raw_metadata + assembly->sheap.offset, assembly->sheap.data, assembly->sheap.index);
-       memcpy (meta->raw_metadata + assembly->us.offset, assembly->us.data, assembly->us.index);
-       memcpy (meta->raw_metadata + assembly->blob.offset, assembly->blob.data, assembly->blob.index);
-       memcpy (meta->raw_metadata + assembly->guid.offset, assembly->guid.data, assembly->guid.index);
-
-       assembly->meta_size = assembly->guid.offset + assembly->guid.index;
-
-       return TRUE;
-}
-
-/*
- * Some tables in metadata need to be sorted according to some criteria, but
- * when methods and fields are first created with reflection, they may be assigned a token
- * that doesn't correspond to the final token they will get assigned after the sorting.
- * ILGenerator.cs keeps a fixup table that maps the position of tokens in the IL code stream
- * with the reflection objects that represent them. Once all the tables are set up, the 
- * reflection objects will contains the correct table index. fixup_method() will fixup the
- * tokens for the method with ILGenerator @ilgen.
- */
-static void
-fixup_method (MonoReflectionILGen *ilgen, gpointer value, MonoDynamicImage *assembly)
-{
-       guint32 code_idx = GPOINTER_TO_UINT (value);
-       MonoReflectionILTokenInfo *iltoken;
-       MonoReflectionFieldBuilder *field;
-       MonoReflectionCtorBuilder *ctor;
-       MonoReflectionMethodBuilder *method;
-       MonoReflectionTypeBuilder *tb;
-       MonoReflectionArrayMethod *am;
-       guint32 i, idx = 0;
-       unsigned char *target;
-
-       for (i = 0; i < ilgen->num_token_fixups; ++i) {
-               iltoken = (MonoReflectionILTokenInfo *)mono_array_addr_with_size (ilgen->token_fixups, sizeof (MonoReflectionILTokenInfo), i);
-               target = (guchar*)assembly->code.data + code_idx + iltoken->code_pos;
-               switch (target [3]) {
-               case MONO_TABLE_FIELD:
-                       if (!strcmp (iltoken->member->vtable->klass->name, "FieldBuilder")) {
-                               field = (MonoReflectionFieldBuilder *)iltoken->member;
-                               idx = field->table_idx;
-                       } else if (!strcmp (iltoken->member->vtable->klass->name, "MonoField")) {
-                               MonoClassField *f = ((MonoReflectionField*)iltoken->member)->field;
-                               idx = GPOINTER_TO_UINT (g_hash_table_lookup (assembly->field_to_table_idx, f));
-                       } else {
-                               g_assert_not_reached ();
-                       }
-                       break;
-               case MONO_TABLE_METHOD:
-                       if (!strcmp (iltoken->member->vtable->klass->name, "MethodBuilder")) {
-                               method = (MonoReflectionMethodBuilder *)iltoken->member;
-                               idx = method->table_idx;
-                       } else if (!strcmp (iltoken->member->vtable->klass->name, "ConstructorBuilder")) {
-                               ctor = (MonoReflectionCtorBuilder *)iltoken->member;
-                               idx = ctor->table_idx;
-                       } else if (!strcmp (iltoken->member->vtable->klass->name, "MonoMethod") || 
-                                          !strcmp (iltoken->member->vtable->klass->name, "MonoCMethod")) {
-                               MonoMethod *m = ((MonoReflectionMethod*)iltoken->member)->method;
-                               idx = GPOINTER_TO_UINT (g_hash_table_lookup (assembly->method_to_table_idx, m));
-                       } else {
-                               g_assert_not_reached ();
-                       }
-                       break;
-               case MONO_TABLE_TYPEDEF:
-                       if (strcmp (iltoken->member->vtable->klass->name, "TypeBuilder"))
-                               g_assert_not_reached ();
-                       tb = (MonoReflectionTypeBuilder *)iltoken->member;
-                       idx = tb->table_idx;
-                       break;
-               case MONO_TABLE_MEMBERREF:
-                       if (!strcmp (iltoken->member->vtable->klass->name, "MonoArrayMethod")) {
-                               am = (MonoReflectionArrayMethod*)iltoken->member;
-                               idx = am->table_idx;
-                       } else if (!strcmp (iltoken->member->vtable->klass->name, "MonoMethod") ||
-                                  !strcmp (iltoken->member->vtable->klass->name, "MonoCMethod") ||
-                                  !strcmp (iltoken->member->vtable->klass->name, "MonoGenericMethod") ||
-                                  !strcmp (iltoken->member->vtable->klass->name, "MonoGenericCMethod")) {
-                               MonoMethod *m = ((MonoReflectionMethod*)iltoken->member)->method;
-                               g_assert (m->klass->generic_class || m->klass->generic_container);
-                               continue;
-                       } else if (!strcmp (iltoken->member->vtable->klass->name, "FieldBuilder")) {
-                               continue;
-                       } else if (!strcmp (iltoken->member->vtable->klass->name, "MonoField")) {
-                               MonoClassField *f = ((MonoReflectionField*)iltoken->member)->field;
-                               g_assert (is_field_on_inst (f));
-                               continue;
-                       } else if (!strcmp (iltoken->member->vtable->klass->name, "MethodBuilder") ||
-                                       !strcmp (iltoken->member->vtable->klass->name, "ConstructorBuilder")) {
-                               continue;
-                       } else if (!strcmp (iltoken->member->vtable->klass->name, "FieldOnTypeBuilderInst")) {
-                               continue;
-                       } else if (!strcmp (iltoken->member->vtable->klass->name, "MethodOnTypeBuilderInst")) {
-                               continue;
-                       } else if (!strcmp (iltoken->member->vtable->klass->name, "ConstructorOnTypeBuilderInst")) {
-                               continue;
-                       } else {
-                               g_assert_not_reached ();
-                       }
-                       break;
-               case MONO_TABLE_METHODSPEC:
-                       if (!strcmp (iltoken->member->vtable->klass->name, "MonoGenericMethod")) {
-                               MonoMethod *m = ((MonoReflectionMethod*)iltoken->member)->method;
-                               g_assert (mono_method_signature (m)->generic_param_count);
-                               continue;
-                       } else if (!strcmp (iltoken->member->vtable->klass->name, "MethodBuilder")) {
-                               continue;
-                       } else if (!strcmp (iltoken->member->vtable->klass->name, "MethodOnTypeBuilderInst")) {
-                               continue;
-                       } else {
-                               g_assert_not_reached ();
-                       }
-                       break;
-               default:
-                       g_error ("got unexpected table 0x%02x in fixup", target [3]);
-               }
-               target [0] = idx & 0xff;
-               target [1] = (idx >> 8) & 0xff;
-               target [2] = (idx >> 16) & 0xff;
-       }
-}
-
-/*
- * fixup_cattrs:
- *
- *   The CUSTOM_ATTRIBUTE table might contain METHODDEF tokens whose final
- * value is not known when the table is emitted.
- */
-static void
-fixup_cattrs (MonoDynamicImage *assembly)
-{
-       MonoDynamicTable *table;
-       guint32 *values;
-       guint32 type, i, idx, token;
-       MonoObject *ctor;
-
-       table = &assembly->tables [MONO_TABLE_CUSTOMATTRIBUTE];
-
-       for (i = 0; i < table->rows; ++i) {
-               values = table->values + ((i + 1) * MONO_CUSTOM_ATTR_SIZE);
-
-               type = values [MONO_CUSTOM_ATTR_TYPE];
-               if ((type & MONO_CUSTOM_ATTR_TYPE_MASK) == MONO_CUSTOM_ATTR_TYPE_METHODDEF) {
-                       idx = type >> MONO_CUSTOM_ATTR_TYPE_BITS;
-                       token = mono_metadata_make_token (MONO_TABLE_METHOD, idx);
-                       ctor = (MonoObject *)mono_g_hash_table_lookup (assembly->remapped_tokens, GUINT_TO_POINTER (token));
-                       g_assert (ctor);
-
-                       if (!strcmp (ctor->vtable->klass->name, "MonoCMethod")) {
-                               MonoMethod *m = ((MonoReflectionMethod*)ctor)->method;
-                               idx = GPOINTER_TO_UINT (g_hash_table_lookup (assembly->method_to_table_idx, m));
-                               values [MONO_CUSTOM_ATTR_TYPE] = (idx << MONO_CUSTOM_ATTR_TYPE_BITS) | MONO_CUSTOM_ATTR_TYPE_METHODDEF;
-                       } else if (!strcmp (ctor->vtable->klass->name, "ConstructorBuilder")) {
-                               MonoMethod *m = ((MonoReflectionCtorBuilder*)ctor)->mhandle;
-                               idx = GPOINTER_TO_UINT (g_hash_table_lookup (assembly->method_to_table_idx, m));
-                               values [MONO_CUSTOM_ATTR_TYPE] = (idx << MONO_CUSTOM_ATTR_TYPE_BITS) | MONO_CUSTOM_ATTR_TYPE_METHODDEF;
-                       }
-               }
-       }
-}
-
-static gboolean
-assembly_add_resource_manifest (MonoReflectionModuleBuilder *mb, MonoDynamicImage *assembly, MonoReflectionResource *rsrc, guint32 implementation, MonoError *error)
-{
-       MonoDynamicTable *table;
-       guint32 *values;
-
-       mono_error_init (error);
-
-       table = &assembly->tables [MONO_TABLE_MANIFESTRESOURCE];
-       table->rows++;
-       alloc_table (table, table->rows);
-       values = table->values + table->next_idx * MONO_MANIFEST_SIZE;
-       values [MONO_MANIFEST_OFFSET] = rsrc->offset;
-       values [MONO_MANIFEST_FLAGS] = rsrc->attrs;
-       values [MONO_MANIFEST_NAME] = string_heap_insert_mstring (&assembly->sheap, rsrc->name, error);
-       return_val_if_nok (error, FALSE);
-       values [MONO_MANIFEST_IMPLEMENTATION] = implementation;
-       table->next_idx++;
-       return TRUE;
-}
-
-static gboolean
-assembly_add_resource (MonoReflectionModuleBuilder *mb, MonoDynamicImage *assembly, MonoReflectionResource *rsrc, MonoError *error)
-{
-       MonoDynamicTable *table;
-       guint32 *values;
-       char blob_size [6];
-       guchar hash [20];
-       char *b = blob_size;
-       char *name, *sname;
-       guint32 idx, offset;
-
-       mono_error_init (error);
-
-       if (rsrc->filename) {
-               name = mono_string_to_utf8_checked (rsrc->filename, error);
-               return_val_if_nok (error, FALSE);
-               sname = g_path_get_basename (name);
-       
-               table = &assembly->tables [MONO_TABLE_FILE];
-               table->rows++;
-               alloc_table (table, table->rows);
-               values = table->values + table->next_idx * MONO_FILE_SIZE;
-               values [MONO_FILE_FLAGS] = FILE_CONTAINS_NO_METADATA;
-               values [MONO_FILE_NAME] = string_heap_insert (&assembly->sheap, sname);
-               g_free (sname);
-
-               mono_sha1_get_digest_from_file (name, hash);
-               mono_metadata_encode_value (20, b, &b);
-               values [MONO_FILE_HASH_VALUE] = mono_image_add_stream_data (&assembly->blob, blob_size, b-blob_size);
-               mono_image_add_stream_data (&assembly->blob, (char*)hash, 20);
-               g_free (name);
-               idx = table->next_idx++;
-               rsrc->offset = 0;
-               idx = MONO_IMPLEMENTATION_FILE | (idx << MONO_IMPLEMENTATION_BITS);
-       } else {
-               char sizebuf [4];
-               char *data;
-               guint len;
-               if (rsrc->data) {
-                       data = mono_array_addr (rsrc->data, char, 0);
-                       len = mono_array_length (rsrc->data);
-               } else {
-                       data = NULL;
-                       len = 0;
-               }
-               offset = len;
-               sizebuf [0] = offset; sizebuf [1] = offset >> 8;
-               sizebuf [2] = offset >> 16; sizebuf [3] = offset >> 24;
-               rsrc->offset = mono_image_add_stream_data (&assembly->resources, sizebuf, 4);
-               mono_image_add_stream_data (&assembly->resources, data, len);
-
-               if (!mb->is_main)
-                       /* 
-                        * The entry should be emitted into the MANIFESTRESOURCE table of 
-                        * the main module, but that needs to reference the FILE table
-                        * which isn't emitted yet.
-                        */
-                       return TRUE;
-               else
-                       idx = 0;
-       }
-
-       return assembly_add_resource_manifest (mb, assembly, rsrc, idx, error);
-}
-
-static gboolean
-set_version_from_string (MonoString *version, guint32 *values, MonoError *error)
-{
-       gchar *ver, *p, *str;
-       guint32 i;
-       
-       mono_error_init (error);
-
-       values [MONO_ASSEMBLY_MAJOR_VERSION] = 0;
-       values [MONO_ASSEMBLY_MINOR_VERSION] = 0;
-       values [MONO_ASSEMBLY_REV_NUMBER] = 0;
-       values [MONO_ASSEMBLY_BUILD_NUMBER] = 0;
-       if (!version)
-               return TRUE;
-       ver = str = mono_string_to_utf8_checked (version, error);
-       return_val_if_nok (error, FALSE);
-       for (i = 0; i < 4; ++i) {
-               values [MONO_ASSEMBLY_MAJOR_VERSION + i] = strtol (ver, &p, 10);
-               switch (*p) {
-               case '.':
-                       p++;
-                       break;
-               case '*':
-                       /* handle Revision and Build */
-                       p++;
-                       break;
-               }
-               ver = p;
-       }
-       g_free (str);
-       return TRUE;
-}
-
-static guint32
-load_public_key (MonoArray *pkey, MonoDynamicImage *assembly) {
-       gsize len;
-       guint32 token = 0;
-       char blob_size [6];
-       char *b = blob_size;
-
-       if (!pkey)
-               return token;
-
-       len = mono_array_length (pkey);
-       mono_metadata_encode_value (len, b, &b);
-       token = mono_image_add_stream_data (&assembly->blob, blob_size, b - blob_size);
-       mono_image_add_stream_data (&assembly->blob, mono_array_addr (pkey, char, 0), len);
-
-       assembly->public_key = (guint8 *)g_malloc (len);
-       memcpy (assembly->public_key, mono_array_addr (pkey, char, 0), len);
-       assembly->public_key_len = len;
-
-       /* Special case: check for ECMA key (16 bytes) */
-       if ((len == MONO_ECMA_KEY_LENGTH) && mono_is_ecma_key (mono_array_addr (pkey, char, 0), len)) {
-               /* In this case we must reserve 128 bytes (1024 bits) for the signature */
-               assembly->strong_name_size = MONO_DEFAULT_PUBLIC_KEY_LENGTH;
-       } else if (len >= MONO_PUBLIC_KEY_HEADER_LENGTH + MONO_MINIMUM_PUBLIC_KEY_LENGTH) {
-               /* minimum key size (in 2.0) is 384 bits */
-               assembly->strong_name_size = len - MONO_PUBLIC_KEY_HEADER_LENGTH;
-       } else {
-               /* FIXME - verifier */
-               g_warning ("Invalid public key length: %d bits (total: %d)", (int)MONO_PUBLIC_KEY_BIT_SIZE (len), (int)len);
-               assembly->strong_name_size = MONO_DEFAULT_PUBLIC_KEY_LENGTH; /* to be safe */
-       }
-       assembly->strong_name = (char *)g_malloc0 (assembly->strong_name_size);
-
-       return token;
-}
-
-static gboolean
-mono_image_emit_manifest (MonoReflectionModuleBuilder *moduleb, MonoError *error)
-{
-       MonoDynamicTable *table;
-       MonoDynamicImage *assembly;
-       MonoReflectionAssemblyBuilder *assemblyb;
-       MonoDomain *domain;
-       guint32 *values;
-       int i;
-       guint32 module_index;
-
-       mono_error_init (error);
-
-       assemblyb = moduleb->assemblyb;
-       assembly = moduleb->dynamic_image;
-       domain = mono_object_domain (assemblyb);
-
-       /* Emit ASSEMBLY table */
-       table = &assembly->tables [MONO_TABLE_ASSEMBLY];
-       alloc_table (table, 1);
-       values = table->values + MONO_ASSEMBLY_SIZE;
-       values [MONO_ASSEMBLY_HASH_ALG] = assemblyb->algid? assemblyb->algid: ASSEMBLY_HASH_SHA1;
-       values [MONO_ASSEMBLY_NAME] = string_heap_insert_mstring (&assembly->sheap, assemblyb->name, error);
-       return_val_if_nok (error, FALSE);
-       if (assemblyb->culture) {
-               values [MONO_ASSEMBLY_CULTURE] = string_heap_insert_mstring (&assembly->sheap, assemblyb->culture, error);
-               return_val_if_nok (error, FALSE);
-       } else {
-               values [MONO_ASSEMBLY_CULTURE] = string_heap_insert (&assembly->sheap, "");
-       }
-       values [MONO_ASSEMBLY_PUBLIC_KEY] = load_public_key (assemblyb->public_key, assembly);
-       values [MONO_ASSEMBLY_FLAGS] = assemblyb->flags;
-       if (!set_version_from_string (assemblyb->version, values, error))
-               return FALSE;
-
-       /* Emit FILE + EXPORTED_TYPE table */
-       module_index = 0;
-       for (i = 0; i < mono_array_length (assemblyb->modules); ++i) {
-               int j;
-               MonoReflectionModuleBuilder *file_module = 
-                       mono_array_get (assemblyb->modules, MonoReflectionModuleBuilder*, i);
-               if (file_module != moduleb) {
-                       if (!mono_image_fill_file_table (domain, (MonoReflectionModule*)file_module, assembly, error))
-                               return FALSE;
-                       module_index ++;
-                       if (file_module->types) {
-                               for (j = 0; j < file_module->num_types; ++j) {
-                                       MonoReflectionTypeBuilder *tb = mono_array_get (file_module->types, MonoReflectionTypeBuilder*, j);
-                                       mono_image_fill_export_table (domain, tb, module_index, 0, assembly, error);
-                                       return_val_if_nok (error, FALSE);
-                               }
-                       }
-               }
-       }
-       if (assemblyb->loaded_modules) {
-               for (i = 0; i < mono_array_length (assemblyb->loaded_modules); ++i) {
-                       MonoReflectionModule *file_module = 
-                               mono_array_get (assemblyb->loaded_modules, MonoReflectionModule*, i);
-                       if (!mono_image_fill_file_table (domain, file_module, assembly, error))
-                               return FALSE;
-                       module_index ++;
-                       mono_image_fill_export_table_from_module (domain, file_module, module_index, assembly);
-               }
-       }
-       if (assemblyb->type_forwarders)
-               mono_image_fill_export_table_from_type_forwarders (assemblyb, assembly);
-
-       /* Emit MANIFESTRESOURCE table */
-       module_index = 0;
-       for (i = 0; i < mono_array_length (assemblyb->modules); ++i) {
-               int j;
-               MonoReflectionModuleBuilder *file_module = 
-                       mono_array_get (assemblyb->modules, MonoReflectionModuleBuilder*, i);
-               /* The table for the main module is emitted later */
-               if (file_module != moduleb) {
-                       module_index ++;
-                       if (file_module->resources) {
-                               int len = mono_array_length (file_module->resources);
-                               for (j = 0; j < len; ++j) {
-                                       MonoReflectionResource* res = (MonoReflectionResource*)mono_array_addr (file_module->resources, MonoReflectionResource, j);
-                                       if (!assembly_add_resource_manifest (file_module, assembly, res, MONO_IMPLEMENTATION_FILE | (module_index << MONO_IMPLEMENTATION_BITS), error))
-                                               return FALSE;
-                               }
-                       }
-               }
-       }
-       return TRUE;
-}
-
-#ifndef DISABLE_REFLECTION_EMIT_SAVE
-
-/*
- * mono_image_build_metadata() will fill the info in all the needed metadata tables
- * for the modulebuilder @moduleb.
- * At the end of the process, method and field tokens are fixed up and the 
- * on-disk compressed metadata representation is created.
- * Return TRUE on success, or FALSE on failure and sets @error
- */
-gboolean
-mono_image_build_metadata (MonoReflectionModuleBuilder *moduleb, MonoError *error)
-{
-       MonoDynamicTable *table;
-       MonoDynamicImage *assembly;
-       MonoReflectionAssemblyBuilder *assemblyb;
-       MonoDomain *domain;
-       MonoPtrArray types;
-       guint32 *values;
-       int i, j;
-
-       mono_error_init (error);
-
-       assemblyb = moduleb->assemblyb;
-       assembly = moduleb->dynamic_image;
-       domain = mono_object_domain (assemblyb);
-
-       if (assembly->text_rva)
-               return TRUE;
-
-       assembly->text_rva = START_TEXT_RVA;
-
-       if (moduleb->is_main) {
-               mono_image_emit_manifest (moduleb, error);
-               return_val_if_nok (error, FALSE);
-       }
-
-       table = &assembly->tables [MONO_TABLE_TYPEDEF];
-       table->rows = 1; /* .<Module> */
-       table->next_idx++;
-       alloc_table (table, table->rows);
-       /*
-        * Set the first entry.
-        */
-       values = table->values + table->columns;
-       values [MONO_TYPEDEF_FLAGS] = 0;
-       values [MONO_TYPEDEF_NAME] = string_heap_insert (&assembly->sheap, "<Module>") ;
-       values [MONO_TYPEDEF_NAMESPACE] = string_heap_insert (&assembly->sheap, "") ;
-       values [MONO_TYPEDEF_EXTENDS] = 0;
-       values [MONO_TYPEDEF_FIELD_LIST] = 1;
-       values [MONO_TYPEDEF_METHOD_LIST] = 1;
-
-       /* 
-        * handle global methods 
-        * FIXME: test what to do when global methods are defined in multiple modules.
-        */
-       if (moduleb->global_methods) {
-               table = &assembly->tables [MONO_TABLE_METHOD];
-               table->rows += mono_array_length (moduleb->global_methods);
-               alloc_table (table, table->rows);
-               for (i = 0; i < mono_array_length (moduleb->global_methods); ++i) {
-                       if (!mono_image_get_method_info (
-                                   mono_array_get (moduleb->global_methods, MonoReflectionMethodBuilder*, i), assembly, error))
-                               goto leave;
-               }
-       }
-       if (moduleb->global_fields) {
-               table = &assembly->tables [MONO_TABLE_FIELD];
-               table->rows += mono_array_length (moduleb->global_fields);
-               alloc_table (table, table->rows);
-               for (i = 0; i < mono_array_length (moduleb->global_fields); ++i) {
-                       mono_image_get_field_info (
-                               mono_array_get (moduleb->global_fields, MonoReflectionFieldBuilder*, i), assembly,
-                               error);
-                       if (!is_ok (error))
-                               goto leave;
-               }
-       }
-
-       table = &assembly->tables [MONO_TABLE_MODULE];
-       alloc_table (table, 1);
-       mono_image_fill_module_table (domain, moduleb, assembly, error);
-       if (!is_ok (error))
-               goto leave;
-
-       /* Collect all types into a list sorted by their table_idx */
-       mono_ptr_array_init (types, moduleb->num_types, MONO_ROOT_SOURCE_REFLECTION, "dynamic module types list");
-
-       if (moduleb->types)
-               for (i = 0; i < moduleb->num_types; ++i) {
-                       MonoReflectionTypeBuilder *type = mono_array_get (moduleb->types, MonoReflectionTypeBuilder*, i);
-                       collect_types (&types, type);
-               }
-
-       mono_ptr_array_sort (types, (int (*)(const void *, const void *))compare_types_by_table_idx);
-       table = &assembly->tables [MONO_TABLE_TYPEDEF];
-       table->rows += mono_ptr_array_size (types);
-       alloc_table (table, table->rows);
-
-       /*
-        * Emit type names + namespaces at one place inside the string heap,
-        * so load_class_names () needs to touch fewer pages.
-        */
-       for (i = 0; i < mono_ptr_array_size (types); ++i) {
-               MonoReflectionTypeBuilder *tb = (MonoReflectionTypeBuilder *)mono_ptr_array_get (types, i);
-               string_heap_insert_mstring (&assembly->sheap, tb->nspace, error);
-               if (!is_ok (error))
-                       goto leave_types;
-       }
-       for (i = 0; i < mono_ptr_array_size (types); ++i) {
-               MonoReflectionTypeBuilder *tb = (MonoReflectionTypeBuilder *)mono_ptr_array_get (types, i);
-               string_heap_insert_mstring (&assembly->sheap, tb->name, error);
-               if (!is_ok (error))
-                       goto leave_types;
-       }
-
-       for (i = 0; i < mono_ptr_array_size (types); ++i) {
-               MonoReflectionTypeBuilder *type = (MonoReflectionTypeBuilder *)mono_ptr_array_get (types, i);
-               if (!mono_image_get_type_info (domain, type, assembly, error))
-                       goto leave_types;
-       }
-
-       /* 
-        * table->rows is already set above and in mono_image_fill_module_table.
-        */
-       /* add all the custom attributes at the end, once all the indexes are stable */
-       if (!mono_image_add_cattrs (assembly, 1, MONO_CUSTOM_ATTR_ASSEMBLY, assemblyb->cattrs, error))
-               goto leave_types;
-
-       /* CAS assembly permissions */
-       if (assemblyb->permissions_minimum)
-               mono_image_add_decl_security (assembly, mono_metadata_make_token (MONO_TABLE_ASSEMBLY, 1), assemblyb->permissions_minimum);
-       if (assemblyb->permissions_optional)
-               mono_image_add_decl_security (assembly, mono_metadata_make_token (MONO_TABLE_ASSEMBLY, 1), assemblyb->permissions_optional);
-       if (assemblyb->permissions_refused)
-               mono_image_add_decl_security (assembly, mono_metadata_make_token (MONO_TABLE_ASSEMBLY, 1), assemblyb->permissions_refused);
-
-       if (!module_add_cattrs (assembly, moduleb, error))
-               goto leave_types;
-
-       /* fixup tokens */
-       mono_g_hash_table_foreach (assembly->token_fixups, (GHFunc)fixup_method, assembly);
-
-       /* Create the MethodImpl table.  We do this after emitting all methods so we already know
-        * the final tokens and don't need another fixup pass. */
-
-       if (moduleb->global_methods) {
-               for (i = 0; i < mono_array_length (moduleb->global_methods); ++i) {
-                       MonoReflectionMethodBuilder *mb = mono_array_get (
-                               moduleb->global_methods, MonoReflectionMethodBuilder*, i);
-                       if (!mono_image_add_methodimpl (assembly, mb, error))
-                               goto leave_types;
-               }
-       }
-
-       for (i = 0; i < mono_ptr_array_size (types); ++i) {
-               MonoReflectionTypeBuilder *type = (MonoReflectionTypeBuilder *)mono_ptr_array_get (types, i);
-               if (type->methods) {
-                       for (j = 0; j < type->num_methods; ++j) {
-                               MonoReflectionMethodBuilder *mb = mono_array_get (
-                                       type->methods, MonoReflectionMethodBuilder*, j);
-
-                               if (!mono_image_add_methodimpl (assembly, mb, error))
-                                       goto leave_types;
-                       }
-               }
-       }
-
-       fixup_cattrs (assembly);
-
-leave_types:
-       mono_ptr_array_destroy (types);
-leave:
-
-       return mono_error_ok (error);
-}
-
-#else /* DISABLE_REFLECTION_EMIT_SAVE */
-
-gboolean
-mono_image_build_metadata (MonoReflectionModuleBuilder *moduleb, MonoError *error)
-{
-       g_error ("This mono runtime was configured with --enable-minimal=reflection_emit_save, so saving of dynamic assemblies is not supported.");
-}
-
-#endif /* DISABLE_REFLECTION_EMIT_SAVE */
-
-
-typedef struct {
-       guint32 import_lookup_table;
-       guint32 timestamp;
-       guint32 forwarder;
-       guint32 name_rva;
-       guint32 import_address_table_rva;
-} MonoIDT;
-
-typedef struct {
-       guint32 name_rva;
-       guint32 flags;
-} MonoILT;
-
-#ifndef DISABLE_REFLECTION_EMIT
-
-/*
- * mono_image_insert_string:
- * @module: module builder object
- * @str: a string
- *
- * Insert @str into the user string stream of @module.
- */
-guint32
-mono_image_insert_string (MonoReflectionModuleBuilder *module, MonoString *str)
-{
-       MonoDynamicImage *assembly;
-       guint32 idx;
-       char buf [16];
-       char *b = buf;
-       
-       if (!module->dynamic_image)
-               mono_image_module_basic_init (module);
-
-       assembly = module->dynamic_image;
-       
-       if (assembly->save) {
-               mono_metadata_encode_value (1 | (str->length * 2), b, &b);
-               idx = mono_image_add_stream_data (&assembly->us, buf, b-buf);
-#if G_BYTE_ORDER != G_LITTLE_ENDIAN
-       {
-               char *swapped = g_malloc (2 * mono_string_length (str));
-               const char *p = (const char*)mono_string_chars (str);
-
-               swap_with_size (swapped, p, 2, mono_string_length (str));
-               mono_image_add_stream_data (&assembly->us, swapped, str->length * 2);
-               g_free (swapped);
-       }
-#else
-               mono_image_add_stream_data (&assembly->us, (const char*)mono_string_chars (str), str->length * 2);
-#endif
-               mono_image_add_stream_data (&assembly->us, "", 1);
-       } else {
-               idx = assembly->us.index ++;
-       }
-
-       register_dyn_token (assembly, MONO_TOKEN_STRING | idx, (MonoObject*)str);
-
-       return MONO_TOKEN_STRING | idx;
-}
-
-guint32
-mono_image_create_method_token (MonoDynamicImage *assembly, MonoObject *obj, MonoArray *opt_param_types, MonoError *error)
-{
-       MonoClass *klass;
-       guint32 token = 0;
-       MonoMethodSignature *sig;
-
-       mono_error_init (error);
-
-       klass = obj->vtable->klass;
-       if (strcmp (klass->name, "MonoMethod") == 0 || strcmp (klass->name, "MonoCMethod") == 0) {
-               MonoMethod *method = ((MonoReflectionMethod *)obj)->method;
-               MonoMethodSignature *old;
-               guint32 sig_token, parent;
-               int nargs, i;
-
-               g_assert (opt_param_types && (mono_method_signature (method)->sentinelpos >= 0));
-
-               nargs = mono_array_length (opt_param_types);
-               old = mono_method_signature (method);
-               sig = mono_metadata_signature_alloc ( &assembly->image, old->param_count + nargs);
-
-               sig->hasthis = old->hasthis;
-               sig->explicit_this = old->explicit_this;
-               sig->call_convention = old->call_convention;
-               sig->generic_param_count = old->generic_param_count;
-               sig->param_count = old->param_count + nargs;
-               sig->sentinelpos = old->param_count;
-               sig->ret = old->ret;
-
-               for (i = 0; i < old->param_count; i++)
-                       sig->params [i] = old->params [i];
-
-               for (i = 0; i < nargs; i++) {
-                       MonoReflectionType *rt = mono_array_get (opt_param_types, MonoReflectionType *, i);
-                       sig->params [old->param_count + i] = mono_reflection_type_get_handle (rt, error);
-                       if (!is_ok (error)) goto fail;
-               }
-
-               parent = mono_image_typedef_or_ref (assembly, &method->klass->byval_arg);
-               g_assert ((parent & MONO_TYPEDEFORREF_MASK) == MONO_MEMBERREF_PARENT_TYPEREF);
-               parent >>= MONO_TYPEDEFORREF_BITS;
-
-               parent <<= MONO_MEMBERREF_PARENT_BITS;
-               parent |= MONO_MEMBERREF_PARENT_TYPEREF;
-
-               sig_token = method_encode_signature (assembly, sig);
-               token = mono_image_get_varargs_method_token (assembly, parent, method->name, sig_token);
-       } else if (strcmp (klass->name, "MethodBuilder") == 0) {
-               MonoReflectionMethodBuilder *mb = (MonoReflectionMethodBuilder *)obj;
-               ReflectionMethodBuilder rmb;
-               guint32 parent, sig_token;
-               int nopt_args, nparams, ngparams, i;
-
-               if (!reflection_methodbuilder_from_method_builder (&rmb, mb, error))
-                       goto fail;
-               
-               rmb.opt_types = opt_param_types;
-               nopt_args = mono_array_length (opt_param_types);
-
-               nparams = rmb.parameters ? mono_array_length (rmb.parameters): 0;
-               ngparams = rmb.generic_params ? mono_array_length (rmb.generic_params): 0;
-               sig = mono_metadata_signature_alloc (&assembly->image, nparams + nopt_args);
-
-               sig->hasthis = !(rmb.attrs & METHOD_ATTRIBUTE_STATIC);
-               sig->explicit_this = (rmb.call_conv & 0x40) == 0x40;
-               sig->call_convention = rmb.call_conv;
-               sig->generic_param_count = ngparams;
-               sig->param_count = nparams + nopt_args;
-               sig->sentinelpos = nparams;
-               sig->ret = mono_reflection_type_get_handle (rmb.rtype, error);
-               if (!is_ok (error)) goto fail;
-
-               for (i = 0; i < nparams; i++) {
-                       MonoReflectionType *rt = mono_array_get (rmb.parameters, MonoReflectionType *, i);
-                       sig->params [i] = mono_reflection_type_get_handle (rt, error);
-                       if (!is_ok (error)) goto fail;
-               }
-
-               for (i = 0; i < nopt_args; i++) {
-                       MonoReflectionType *rt = mono_array_get (opt_param_types, MonoReflectionType *, i);
-                       sig->params [nparams + i] = mono_reflection_type_get_handle (rt, error);
-                       if (!is_ok (error)) goto fail;
-               }
-
-               sig_token = method_builder_encode_signature (assembly, &rmb, error);
-               if (!is_ok (error))
-                       goto fail;
-
-               parent = mono_image_create_token (assembly, obj, TRUE, TRUE, error);
-               if (!mono_error_ok (error))
-                       goto fail;
-               g_assert (mono_metadata_token_table (parent) == MONO_TABLE_METHOD);
-
-               parent = mono_metadata_token_index (parent) << MONO_MEMBERREF_PARENT_BITS;
-               parent |= MONO_MEMBERREF_PARENT_METHODDEF;
-
-               char *name = mono_string_to_utf8_checked (rmb.name, error);
-               if (!is_ok (error)) goto fail;
-               token = mono_image_get_varargs_method_token (
-                       assembly, parent, name, sig_token);
-               g_free (name);
-       } else {
-               g_error ("requested method token for %s\n", klass->name);
-       }
-
-       g_hash_table_insert (assembly->vararg_aux_hash, GUINT_TO_POINTER (token), sig);
-       register_dyn_token (assembly, token, obj);
-       return token;
-fail:
-       g_assert (!mono_error_ok (error));
-       return 0;
-}
-
-/*
- * mono_image_create_token:
- * @assembly: a dynamic assembly
- * @obj:
- * @register_token: Whenever to register the token in the assembly->tokens hash. 
- *
- * Get a token to insert in the IL code stream for the given MemberInfo.
- * The metadata emission routines need to pass FALSE as REGISTER_TOKEN, since by that time, 
- * the table_idx-es were recomputed, so registering the token would overwrite an existing 
- * entry.
- */
-guint32
-mono_image_create_token (MonoDynamicImage *assembly, MonoObject *obj, 
-                        gboolean create_open_instance, gboolean register_token,
-                        MonoError *error)
-{
-       MonoClass *klass;
-       guint32 token = 0;
-
-       mono_error_init (error);
-
-       klass = obj->vtable->klass;
-
-       /* Check for user defined reflection objects */
-       /* TypeDelegator is the only corlib type which doesn't look like a MonoReflectionType */
-       if (klass->image != mono_defaults.corlib || (strcmp (klass->name, "TypeDelegator") == 0)) {
-               mono_error_set_not_supported (error, "User defined subclasses of System.Type are not yet supported");
-               return 0;
-       }
-
-       if (strcmp (klass->name, "MethodBuilder") == 0) {
-               MonoReflectionMethodBuilder *mb = (MonoReflectionMethodBuilder *)obj;
-               MonoReflectionTypeBuilder *tb = (MonoReflectionTypeBuilder*)mb->type;
-
-               if (tb->module->dynamic_image == assembly && !tb->generic_params && !mb->generic_params)
-                       token = mb->table_idx | MONO_TOKEN_METHOD_DEF;
-               else {
-                       token = mono_image_get_methodbuilder_token (assembly, mb, create_open_instance, error);
-                       if (!mono_error_ok (error))
-                               return 0;
-               }
-               /*g_print ("got token 0x%08x for %s\n", token, mono_string_to_utf8 (mb->name));*/
-       } else if (strcmp (klass->name, "ConstructorBuilder") == 0) {
-               MonoReflectionCtorBuilder *mb = (MonoReflectionCtorBuilder *)obj;
-               MonoReflectionTypeBuilder *tb = (MonoReflectionTypeBuilder*)mb->type;
-
-               if (tb->module->dynamic_image == assembly && !tb->generic_params)
-                       token = mb->table_idx | MONO_TOKEN_METHOD_DEF;
-               else {
-                       token = mono_image_get_ctorbuilder_token (assembly, mb, error);
-                       if (!mono_error_ok (error))
-                               return 0;
-               }
-               /*g_print ("got token 0x%08x for %s\n", token, mono_string_to_utf8 (mb->name));*/
-       } else if (strcmp (klass->name, "FieldBuilder") == 0) {
-               MonoReflectionFieldBuilder *fb = (MonoReflectionFieldBuilder *)obj;
-               MonoReflectionTypeBuilder *tb = (MonoReflectionTypeBuilder *)fb->typeb;
-               if (tb->generic_params) {
-                       token = mono_image_get_generic_field_token (assembly, fb, error);
-                       return_val_if_nok (error, 0);
-               } else {
-                       if (tb->module->dynamic_image == assembly) {
-                               token = fb->table_idx | MONO_TOKEN_FIELD_DEF;
-                       } else {
-                               token = mono_image_get_fieldref_token (assembly, (MonoObject*)fb, fb->handle);
-                       }
-               }
-       } else if (strcmp (klass->name, "TypeBuilder") == 0) {
-               MonoReflectionTypeBuilder *tb = (MonoReflectionTypeBuilder *)obj;
-               if (create_open_instance && tb->generic_params) {
-                       MonoType *type;
-                       init_type_builder_generics (obj, error);
-                       return_val_if_nok (error, 0);
-                       type = mono_reflection_type_get_handle ((MonoReflectionType *)obj, error);
-                       return_val_if_nok (error, 0);
-                       token = mono_image_typedef_or_ref_full (assembly, type, TRUE);
-                       token = mono_metadata_token_from_dor (token);
-               } else if (tb->module->dynamic_image == assembly) {
-                       token = tb->table_idx | MONO_TOKEN_TYPE_DEF;
-               } else {
-                       MonoType *type;
-                       type = mono_reflection_type_get_handle ((MonoReflectionType *)obj, error);
-                       return_val_if_nok (error, 0);
-                       token = mono_metadata_token_from_dor (mono_image_typedef_or_ref (assembly, type));
-               }
-       } else if (strcmp (klass->name, "RuntimeType") == 0) {
-               MonoType *type = mono_reflection_type_get_handle ((MonoReflectionType *)obj, error);
-               return_val_if_nok (error, 0);
-               MonoClass *mc = mono_class_from_mono_type (type);
-               token = mono_metadata_token_from_dor (
-                       mono_image_typedef_or_ref_full (assembly, type, mc->generic_container == NULL || create_open_instance));
-       } else if (strcmp (klass->name, "GenericTypeParameterBuilder") == 0) {
-               MonoType *type = mono_reflection_type_get_handle ((MonoReflectionType *)obj, error);
-               return_val_if_nok (error, 0);
-               token = mono_metadata_token_from_dor (
-                       mono_image_typedef_or_ref (assembly, type));
-       } else if (strcmp (klass->name, "MonoGenericClass") == 0) {
-               MonoType *type = mono_reflection_type_get_handle ((MonoReflectionType *)obj, error);
-               return_val_if_nok (error, 0);
-               token = mono_metadata_token_from_dor (
-                       mono_image_typedef_or_ref (assembly, type));
-       } else if (strcmp (klass->name, "MonoCMethod") == 0 ||
-                  strcmp (klass->name, "MonoMethod") == 0 ||
-                  strcmp (klass->name, "MonoGenericMethod") == 0 ||
-                  strcmp (klass->name, "MonoGenericCMethod") == 0) {
-               MonoReflectionMethod *m = (MonoReflectionMethod *)obj;
-               if (m->method->is_inflated) {
-                       if (create_open_instance)
-                               token = mono_image_get_methodspec_token (assembly, m->method);
-                       else
-                               token = mono_image_get_inflated_method_token (assembly, m->method);
-               } else if ((m->method->klass->image == &assembly->image) &&
-                        !m->method->klass->generic_class) {
-                       static guint32 method_table_idx = 0xffffff;
-                       if (m->method->klass->wastypebuilder) {
-                               /* we use the same token as the one that was assigned
-                                * to the Methodbuilder.
-                                * FIXME: do the equivalent for Fields.
-                                */
-                               token = m->method->token;
-                       } else {
-                               /*
-                                * Each token should have a unique index, but the indexes are
-                                * assigned by managed code, so we don't know about them. An
-                                * easy solution is to count backwards...
-                                */
-                               method_table_idx --;
-                               token = MONO_TOKEN_METHOD_DEF | method_table_idx;
-                       }
-               } else {
-                       token = mono_image_get_methodref_token (assembly, m->method, create_open_instance);
-               }
-               /*g_print ("got token 0x%08x for %s\n", token, m->method->name);*/
-       } else if (strcmp (klass->name, "MonoField") == 0) {
-               MonoReflectionField *f = (MonoReflectionField *)obj;
-               if ((f->field->parent->image == &assembly->image) && !is_field_on_inst (f->field)) {
-                       static guint32 field_table_idx = 0xffffff;
-                       field_table_idx --;
-                       token = MONO_TOKEN_FIELD_DEF | field_table_idx;
-               } else {
-                       token = mono_image_get_fieldref_token (assembly, (MonoObject*)f, f->field);
-               }
-               /*g_print ("got token 0x%08x for %s\n", token, f->field->name);*/
-       } else if (strcmp (klass->name, "MonoArrayMethod") == 0) {
-               MonoReflectionArrayMethod *m = (MonoReflectionArrayMethod *)obj;
-               token = mono_image_get_array_token (assembly, m, error);
-               return_val_if_nok (error, 0);
-       } else if (strcmp (klass->name, "SignatureHelper") == 0) {
-               MonoReflectionSigHelper *s = (MonoReflectionSigHelper*)obj;
-               token = MONO_TOKEN_SIGNATURE | mono_image_get_sighelper_token (assembly, s, error);
-               return_val_if_nok (error, 0);
-       } else if (strcmp (klass->name, "EnumBuilder") == 0) {
-               MonoType *type = mono_reflection_type_get_handle ((MonoReflectionType *)obj, error);
-               return_val_if_nok (error, 0);
-               token = mono_metadata_token_from_dor (
-                       mono_image_typedef_or_ref (assembly, type));
-       } else if (strcmp (klass->name, "FieldOnTypeBuilderInst") == 0) {
-               MonoReflectionFieldOnTypeBuilderInst *f = (MonoReflectionFieldOnTypeBuilderInst*)obj;
-               token = mono_image_get_field_on_inst_token (assembly, f, error);
-               return_val_if_nok (error, 0);
-       } else if (strcmp (klass->name, "ConstructorOnTypeBuilderInst") == 0) {
-               MonoReflectionCtorOnTypeBuilderInst *c = (MonoReflectionCtorOnTypeBuilderInst*)obj;
-               token = mono_image_get_ctor_on_inst_token (assembly, c, create_open_instance, error);
-               if (!mono_error_ok (error))
-                       return 0;
-       } else if (strcmp (klass->name, "MethodOnTypeBuilderInst") == 0) {
-               MonoReflectionMethodOnTypeBuilderInst *m = (MonoReflectionMethodOnTypeBuilderInst*)obj;
-               token = mono_image_get_method_on_inst_token (assembly, m, create_open_instance, error);
-               if (!mono_error_ok (error))
-                       return 0;
-       } else if (is_sre_array (klass) || is_sre_byref (klass) || is_sre_pointer (klass)) {
-               MonoType *type = mono_reflection_type_get_handle ((MonoReflectionType *)obj, error);
-               return_val_if_nok (error, 0);
-               token = mono_metadata_token_from_dor (
-                               mono_image_typedef_or_ref (assembly, type));
-       } else {
-               g_error ("requested token for %s\n", klass->name);
-       }
-
-       if (register_token)
-               mono_image_register_token (assembly, token, obj);
-
-       return token;
-}
-
-/*
- * mono_image_register_token:
- *
- *   Register the TOKEN->OBJ mapping in the mapping table in ASSEMBLY. This is required for
- * the Module.ResolveXXXToken () methods to work.
- */
-void
-mono_image_register_token (MonoDynamicImage *assembly, guint32 token, MonoObject *obj)
-{
-       MonoObject *prev;
-
-       dynamic_image_lock (assembly);
-       prev = (MonoObject *)mono_g_hash_table_lookup (assembly->tokens, GUINT_TO_POINTER (token));
-       if (prev) {
-               /* There could be multiple MethodInfo objects with the same token */
-               //g_assert (prev == obj);
-       } else {
-               mono_g_hash_table_insert (assembly->tokens, GUINT_TO_POINTER (token), obj);
-       }
-       dynamic_image_unlock (assembly);
-}
-
-static MonoDynamicImage*
-create_dynamic_mono_image (MonoDynamicAssembly *assembly, char *assembly_name, char *module_name)
-{
-       static const guchar entrycode [16] = {0xff, 0x25, 0};
-       MonoDynamicImage *image;
-       int i;
-
-       const char *version;
-
-       if (!strcmp (mono_get_runtime_info ()->framework_version, "2.1"))
-               version = "v2.0.50727"; /* HACK: SL 2 enforces the .net 2 metadata version */
-       else
-               version = mono_get_runtime_info ()->runtime_version;
-
-#if HAVE_BOEHM_GC
-       /* The MonoGHashTable's need GC tracking */
-       image = (MonoDynamicImage *)GC_MALLOC (sizeof (MonoDynamicImage));
-#else
-       image = g_new0 (MonoDynamicImage, 1);
-#endif
-
-       mono_profiler_module_event (&image->image, MONO_PROFILE_START_LOAD);
-       
-       /*g_print ("created image %p\n", image);*/
-       /* keep in sync with image.c */
-       image->image.name = assembly_name;
-       image->image.assembly_name = image->image.name; /* they may be different */
-       image->image.module_name = module_name;
-       image->image.version = g_strdup (version);
-       image->image.md_version_major = 1;
-       image->image.md_version_minor = 1;
-       image->image.dynamic = TRUE;
-
-       image->image.references = g_new0 (MonoAssembly*, 1);
-       image->image.references [0] = NULL;
-
-       mono_image_init (&image->image);
-
-       image->token_fixups = mono_g_hash_table_new_type ((GHashFunc)mono_object_hash, NULL, MONO_HASH_KEY_GC, MONO_ROOT_SOURCE_REFLECTION, "dynamic module token fixups table");
-       image->method_to_table_idx = g_hash_table_new (NULL, NULL);
-       image->field_to_table_idx = g_hash_table_new (NULL, NULL);
-       image->method_aux_hash = g_hash_table_new (NULL, NULL);
-       image->vararg_aux_hash = g_hash_table_new (NULL, NULL);
-       image->handleref = g_hash_table_new (NULL, NULL);
-       image->handleref_managed = mono_g_hash_table_new_type ((GHashFunc)mono_object_hash, NULL, MONO_HASH_KEY_GC, MONO_ROOT_SOURCE_REFLECTION, "dynamic module reference-to-token table");
-       image->tokens = mono_g_hash_table_new_type (NULL, NULL, MONO_HASH_VALUE_GC, MONO_ROOT_SOURCE_REFLECTION, "dynamic module tokens table");
-       image->generic_def_objects = mono_g_hash_table_new_type (NULL, NULL, MONO_HASH_VALUE_GC, MONO_ROOT_SOURCE_REFLECTION, "dynamic module generic definitions table");
-       image->methodspec = mono_g_hash_table_new_type ((GHashFunc)mono_object_hash, NULL, MONO_HASH_KEY_GC, MONO_ROOT_SOURCE_REFLECTION, "dynamic module method specifications table");
-       image->typespec = g_hash_table_new ((GHashFunc)mono_metadata_type_hash, (GCompareFunc)mono_metadata_type_equal);
-       image->typeref = g_hash_table_new ((GHashFunc)mono_metadata_type_hash, (GCompareFunc)mono_metadata_type_equal);
-       image->blob_cache = g_hash_table_new ((GHashFunc)mono_blob_entry_hash, (GCompareFunc)mono_blob_entry_equal);
-       image->gen_params = g_ptr_array_new ();
-       image->remapped_tokens = mono_g_hash_table_new_type (NULL, NULL, MONO_HASH_VALUE_GC, MONO_ROOT_SOURCE_REFLECTION, "dynamic module remapped tokens table");
-
-       /*g_print ("string heap create for image %p (%s)\n", image, module_name);*/
-       string_heap_init (&image->sheap);
-       mono_image_add_stream_data (&image->us, "", 1);
-       add_to_blob_cached (image, (char*) "", 1, NULL, 0);
-       /* import tables... */
-       mono_image_add_stream_data (&image->code, (char*)entrycode, sizeof (entrycode));
-       image->iat_offset = mono_image_add_stream_zero (&image->code, 8); /* two IAT entries */
-       image->idt_offset = mono_image_add_stream_zero (&image->code, 2 * sizeof (MonoIDT)); /* two IDT entries */
-       image->imp_names_offset = mono_image_add_stream_zero (&image->code, 2); /* flags for name entry */
-       mono_image_add_stream_data (&image->code, "_CorExeMain", 12);
-       mono_image_add_stream_data (&image->code, "mscoree.dll", 12);
-       image->ilt_offset = mono_image_add_stream_zero (&image->code, 8); /* two ILT entries */
-       stream_data_align (&image->code);
-
-       image->cli_header_offset = mono_image_add_stream_zero (&image->code, sizeof (MonoCLIHeader));
-
-       for (i=0; i < MONO_TABLE_NUM; ++i) {
-               image->tables [i].next_idx = 1;
-               image->tables [i].columns = table_sizes [i];
-       }
-
-       image->image.assembly = (MonoAssembly*)assembly;
-       image->run = assembly->run;
-       image->save = assembly->save;
-       image->pe_kind = 0x1; /* ILOnly */
-       image->machine = 0x14c; /* I386 */
-       
-       mono_profiler_module_loaded (&image->image, MONO_PROFILE_OK);
-
-       dynamic_images_lock ();
-
-       if (!dynamic_images)
-               dynamic_images = g_ptr_array_new ();
-
-       g_ptr_array_add (dynamic_images, image);
-
-       dynamic_images_unlock ();
-
-       return image;
-}
-#endif
-
-static void
-free_blob_cache_entry (gpointer key, gpointer val, gpointer user_data)
-{
-       g_free (key);
-}
-
-static void
-release_hashtable (MonoGHashTable **hash)
-{
-       if (*hash) {
-               mono_g_hash_table_destroy (*hash);
-               *hash = NULL;
-       }
-}
-
-void
-mono_dynamic_image_release_gc_roots (MonoDynamicImage *image)
-{
-       release_hashtable (&image->token_fixups);
-       release_hashtable (&image->handleref_managed);
-       release_hashtable (&image->tokens);
-       release_hashtable (&image->remapped_tokens);
-       release_hashtable (&image->generic_def_objects);
-       release_hashtable (&image->methodspec);
-}
-
-// Free dynamic image pass one: Free resources but not image itself
-void
-mono_dynamic_image_free (MonoDynamicImage *image)
-{
-       MonoDynamicImage *di = image;
-       GList *list;
-       int i;
-
-       if (di->methodspec)
-               mono_g_hash_table_destroy (di->methodspec);
-       if (di->typespec)
-               g_hash_table_destroy (di->typespec);
-       if (di->typeref)
-               g_hash_table_destroy (di->typeref);
-       if (di->handleref)
-               g_hash_table_destroy (di->handleref);
-       if (di->handleref_managed)
-               mono_g_hash_table_destroy (di->handleref_managed);
-       if (di->tokens)
-               mono_g_hash_table_destroy (di->tokens);
-       if (di->remapped_tokens)
-               mono_g_hash_table_destroy (di->remapped_tokens);
-       if (di->generic_def_objects)
-               mono_g_hash_table_destroy (di->generic_def_objects);
-       if (di->blob_cache) {
-               g_hash_table_foreach (di->blob_cache, free_blob_cache_entry, NULL);
-               g_hash_table_destroy (di->blob_cache);
-       }
-       if (di->standalonesig_cache)
-               g_hash_table_destroy (di->standalonesig_cache);
-       for (list = di->array_methods; list; list = list->next) {
-               ArrayMethod *am = (ArrayMethod *)list->data;
-               g_free (am->sig);
-               g_free (am->name);
-               g_free (am);
-       }
-       g_list_free (di->array_methods);
-       if (di->gen_params) {
-               for (i = 0; i < di->gen_params->len; i++) {
-                       GenericParamTableEntry *entry = (GenericParamTableEntry *)g_ptr_array_index (di->gen_params, i);
-                       mono_gc_deregister_root ((char*) &entry->gparam);
-                       g_free (entry);
-               }
-               g_ptr_array_free (di->gen_params, TRUE);
-       }
-       if (di->token_fixups)
-               mono_g_hash_table_destroy (di->token_fixups);
-       if (di->method_to_table_idx)
-               g_hash_table_destroy (di->method_to_table_idx);
-       if (di->field_to_table_idx)
-               g_hash_table_destroy (di->field_to_table_idx);
-       if (di->method_aux_hash)
-               g_hash_table_destroy (di->method_aux_hash);
-       if (di->vararg_aux_hash)
-               g_hash_table_destroy (di->vararg_aux_hash);
-       g_free (di->strong_name);
-       g_free (di->win32_res);
-       if (di->public_key)
-               g_free (di->public_key);
-
-       /*g_print ("string heap destroy for image %p\n", di);*/
-       mono_dynamic_stream_reset (&di->sheap);
-       mono_dynamic_stream_reset (&di->code);
-       mono_dynamic_stream_reset (&di->resources);
-       mono_dynamic_stream_reset (&di->us);
-       mono_dynamic_stream_reset (&di->blob);
-       mono_dynamic_stream_reset (&di->tstream);
-       mono_dynamic_stream_reset (&di->guid);
-       for (i = 0; i < MONO_TABLE_NUM; ++i) {
-               g_free (di->tables [i].values);
-       }
-
-       dynamic_images_lock ();
-
-       if (dynamic_images)
-               g_ptr_array_remove (dynamic_images, di);
-
-       dynamic_images_unlock ();
-}
-
-// Free dynamic image pass two: Free image itself (might never get called in some debug modes)
-void
-mono_dynamic_image_free_image (MonoDynamicImage *image)
-{
-       /* See create_dynamic_mono_image () */
-#if HAVE_BOEHM_GC
-       /* Allocated using GC_MALLOC */
-#else
-       g_free (image);
-#endif
-}
-
-#ifndef DISABLE_REFLECTION_EMIT
-
-/*
- * mono_image_basic_init:
- * @assembly: an assembly builder object
- *
- * Create the MonoImage that represents the assembly builder and setup some
- * of the helper hash table and the basic metadata streams.
- */
-static void
-mono_image_basic_init (MonoReflectionAssemblyBuilder *assemblyb)
-{
-       MonoError error;
-       MonoDynamicAssembly *assembly;
-       MonoDynamicImage *image;
-       MonoDomain *domain = mono_object_domain (assemblyb);
-       
-       if (assemblyb->dynamic_assembly)
-               return;
-
-#if HAVE_BOEHM_GC
-       /* assembly->assembly.image might be GC allocated */
-       assembly = assemblyb->dynamic_assembly = (MonoDynamicAssembly *)GC_MALLOC (sizeof (MonoDynamicAssembly));
-#else
-       assembly = assemblyb->dynamic_assembly = g_new0 (MonoDynamicAssembly, 1);
-#endif
-
-       mono_profiler_assembly_event (&assembly->assembly, MONO_PROFILE_START_LOAD);
-       
-       assembly->assembly.ref_count = 1;
-       assembly->assembly.dynamic = TRUE;
-       assembly->assembly.corlib_internal = assemblyb->corlib_internal;
-       assemblyb->assembly.assembly = (MonoAssembly*)assembly;
-       assembly->assembly.basedir = mono_string_to_utf8_checked (assemblyb->dir, &error);
-       if (mono_error_set_pending_exception (&error))
-               return;
-       if (assemblyb->culture) {
-               assembly->assembly.aname.culture = mono_string_to_utf8_checked (assemblyb->culture, &error);
-               if (mono_error_set_pending_exception (&error))
-                       return;
-       } else
-               assembly->assembly.aname.culture = g_strdup ("");
-
-        if (assemblyb->version) {
-                       char *vstr = mono_string_to_utf8_checked (assemblyb->version, &error);
-                       if (mono_error_set_pending_exception (&error))
-                               return;
-                       char **version = g_strsplit (vstr, ".", 4);
-                       char **parts = version;
-                       assembly->assembly.aname.major = atoi (*parts++);
-                       assembly->assembly.aname.minor = atoi (*parts++);
-                       assembly->assembly.aname.build = *parts != NULL ? atoi (*parts++) : 0;
-                       assembly->assembly.aname.revision = *parts != NULL ? atoi (*parts) : 0;
-
-                       g_strfreev (version);
-                       g_free (vstr);
-        } else {
-                       assembly->assembly.aname.major = 0;
-                       assembly->assembly.aname.minor = 0;
-                       assembly->assembly.aname.build = 0;
-                       assembly->assembly.aname.revision = 0;
-        }
-
-       assembly->run = assemblyb->access != 2;
-       assembly->save = assemblyb->access != 1;
-       assembly->domain = domain;
-
-       char *assembly_name = mono_string_to_utf8_checked (assemblyb->name, &error);
-       if (mono_error_set_pending_exception (&error))
-               return;
-       image = create_dynamic_mono_image (assembly, assembly_name, g_strdup ("RefEmit_YouForgotToDefineAModule"));
-       image->initial_image = TRUE;
-       assembly->assembly.aname.name = image->image.name;
-       assembly->assembly.image = &image->image;
-       if (assemblyb->pktoken && assemblyb->pktoken->max_length) {
-               /* -1 to correct for the trailing NULL byte */
-               if (assemblyb->pktoken->max_length != MONO_PUBLIC_KEY_TOKEN_LENGTH - 1) {
-                       g_error ("Public key token length invalid for assembly %s: %i", assembly->assembly.aname.name, assemblyb->pktoken->max_length);
-               }
-               memcpy (&assembly->assembly.aname.public_key_token, mono_array_addr (assemblyb->pktoken, guint8, 0), assemblyb->pktoken->max_length);           
-       }
-
-       mono_domain_assemblies_lock (domain);
-       domain->domain_assemblies = g_slist_append (domain->domain_assemblies, assembly);
-       mono_domain_assemblies_unlock (domain);
-
-       register_assembly (mono_object_domain (assemblyb), &assemblyb->assembly, &assembly->assembly);
-       
-       mono_profiler_assembly_loaded (&assembly->assembly, MONO_PROFILE_OK);
-       
-       mono_assembly_invoke_load_hook ((MonoAssembly*)assembly);
-}
-
-#endif /* !DISABLE_REFLECTION_EMIT */
-
-#ifndef DISABLE_REFLECTION_EMIT_SAVE
-
-static int
-calc_section_size (MonoDynamicImage *assembly)
-{
-       int nsections = 0;
-
-       /* alignment constraints */
-       mono_image_add_stream_zero (&assembly->code, 4 - (assembly->code.index % 4));
-       g_assert ((assembly->code.index % 4) == 0);
-       assembly->meta_size += 3;
-       assembly->meta_size &= ~3;
-       mono_image_add_stream_zero (&assembly->resources, 4 - (assembly->resources.index % 4));
-       g_assert ((assembly->resources.index % 4) == 0);
-
-       assembly->sections [MONO_SECTION_TEXT].size = assembly->meta_size + assembly->code.index + assembly->resources.index + assembly->strong_name_size;
-       assembly->sections [MONO_SECTION_TEXT].attrs = SECT_FLAGS_HAS_CODE | SECT_FLAGS_MEM_EXECUTE | SECT_FLAGS_MEM_READ;
-       nsections++;
-
-       if (assembly->win32_res) {
-               guint32 res_size = (assembly->win32_res_size + 3) & ~3;
-
-               assembly->sections [MONO_SECTION_RSRC].size = res_size;
-               assembly->sections [MONO_SECTION_RSRC].attrs = SECT_FLAGS_HAS_INITIALIZED_DATA | SECT_FLAGS_MEM_READ;
-               nsections++;
-       }
-
-       assembly->sections [MONO_SECTION_RELOC].size = 12;
-       assembly->sections [MONO_SECTION_RELOC].attrs = SECT_FLAGS_MEM_READ | SECT_FLAGS_MEM_DISCARDABLE | SECT_FLAGS_HAS_INITIALIZED_DATA;
-       nsections++;
-
-       return nsections;
-}
-
-typedef struct {
-       guint32 id;
-       guint32 offset;
-       GSList *children;
-       MonoReflectionWin32Resource *win32_res; /* Only for leaf nodes */
-} ResTreeNode;
-
-static int
-resource_tree_compare_by_id (gconstpointer a, gconstpointer b)
-{
-       ResTreeNode *t1 = (ResTreeNode*)a;
-       ResTreeNode *t2 = (ResTreeNode*)b;
-
-       return t1->id - t2->id;
-}
-
-/*
- * resource_tree_create:
- *
- *  Organize the resources into a resource tree.
- */
-static ResTreeNode *
-resource_tree_create (MonoArray *win32_resources)
-{
-       ResTreeNode *tree, *res_node, *type_node, *lang_node;
-       GSList *l;
-       int i;
-
-       tree = g_new0 (ResTreeNode, 1);
-       
-       for (i = 0; i < mono_array_length (win32_resources); ++i) {
-               MonoReflectionWin32Resource *win32_res =
-                       (MonoReflectionWin32Resource*)mono_array_addr (win32_resources, MonoReflectionWin32Resource, i);
-
-               /* Create node */
-
-               /* FIXME: BUG: this stores managed references in unmanaged memory */
-               lang_node = g_new0 (ResTreeNode, 1);
-               lang_node->id = win32_res->lang_id;
-               lang_node->win32_res = win32_res;
-
-               /* Create type node if neccesary */
-               type_node = NULL;
-               for (l = tree->children; l; l = l->next)
-                       if (((ResTreeNode*)(l->data))->id == win32_res->res_type) {
-                               type_node = (ResTreeNode*)l->data;
-                               break;
-                       }
-
-               if (!type_node) {
-                       type_node = g_new0 (ResTreeNode, 1);
-                       type_node->id = win32_res->res_type;
-
-                       /* 
-                        * The resource types have to be sorted otherwise
-                        * Windows Explorer can't display the version information.
-                        */
-                       tree->children = g_slist_insert_sorted (tree->children, 
-                               type_node, resource_tree_compare_by_id);
-               }
-
-               /* Create res node if neccesary */
-               res_node = NULL;
-               for (l = type_node->children; l; l = l->next)
-                       if (((ResTreeNode*)(l->data))->id == win32_res->res_id) {
-                               res_node = (ResTreeNode*)l->data;
-                               break;
-                       }
-
-               if (!res_node) {
-                       res_node = g_new0 (ResTreeNode, 1);
-                       res_node->id = win32_res->res_id;
-                       type_node->children = g_slist_append (type_node->children, res_node);
-               }
-
-               res_node->children = g_slist_append (res_node->children, lang_node);
-       }
-
-       return tree;
-}
-
-/*
- * resource_tree_encode:
- * 
- *   Encode the resource tree into the format used in the PE file.
- */
-static void
-resource_tree_encode (ResTreeNode *node, char *begin, char *p, char **endbuf)
-{
-       char *entries;
-       MonoPEResourceDir dir;
-       MonoPEResourceDirEntry dir_entry;
-       MonoPEResourceDataEntry data_entry;
-       GSList *l;
-       guint32 res_id_entries;
-
-       /*
-        * For the format of the resource directory, see the article
-        * "An In-Depth Look into the Win32 Portable Executable File Format" by
-        * Matt Pietrek
-        */
-
-       memset (&dir, 0, sizeof (dir));
-       memset (&dir_entry, 0, sizeof (dir_entry));
-       memset (&data_entry, 0, sizeof (data_entry));
-
-       g_assert (sizeof (dir) == 16);
-       g_assert (sizeof (dir_entry) == 8);
-       g_assert (sizeof (data_entry) == 16);
-
-       node->offset = p - begin;
-
-       /* IMAGE_RESOURCE_DIRECTORY */
-       res_id_entries = g_slist_length (node->children);
-       dir.res_id_entries = GUINT16_TO_LE (res_id_entries);
-
-       memcpy (p, &dir, sizeof (dir));
-       p += sizeof (dir);
-
-       /* Reserve space for entries */
-       entries = p;
-       p += sizeof (dir_entry) * res_id_entries;
-
-       /* Write children */
-       for (l = node->children; l; l = l->next) {
-               ResTreeNode *child = (ResTreeNode*)l->data;
-
-               if (child->win32_res) {
-                       guint32 size;
-
-                       child->offset = p - begin;
-
-                       /* IMAGE_RESOURCE_DATA_ENTRY */
-                       data_entry.rde_data_offset = GUINT32_TO_LE (p - begin + sizeof (data_entry));
-                       size = mono_array_length (child->win32_res->res_data);
-                       data_entry.rde_size = GUINT32_TO_LE (size);
-
-                       memcpy (p, &data_entry, sizeof (data_entry));
-                       p += sizeof (data_entry);
-
-                       memcpy (p, mono_array_addr (child->win32_res->res_data, char, 0), size);
-                       p += size;
-               } else {
-                       resource_tree_encode (child, begin, p, &p);
-               }
-       }
-
-       /* IMAGE_RESOURCE_ENTRY */
-       for (l = node->children; l; l = l->next) {
-               ResTreeNode *child = (ResTreeNode*)l->data;
-
-               MONO_PE_RES_DIR_ENTRY_SET_NAME (dir_entry, FALSE, child->id);
-               MONO_PE_RES_DIR_ENTRY_SET_DIR (dir_entry, !child->win32_res, child->offset);
-
-               memcpy (entries, &dir_entry, sizeof (dir_entry));
-               entries += sizeof (dir_entry);
-       }
-
-       *endbuf = p;
-}
-
-static void
-resource_tree_free (ResTreeNode * node)
-{
-       GSList * list;
-       for (list = node->children; list; list = list->next)
-               resource_tree_free ((ResTreeNode*)list->data);
-       g_slist_free(node->children);
-       g_free (node);
-}
-
-static void
-assembly_add_win32_resources (MonoDynamicImage *assembly, MonoReflectionAssemblyBuilder *assemblyb)
-{
-       char *buf;
-       char *p;
-       guint32 size, i;
-       MonoReflectionWin32Resource *win32_res;
-       ResTreeNode *tree;
-
-       if (!assemblyb->win32_resources)
-               return;
-
-       /*
-        * Resources are stored in a three level tree inside the PE file.
-        * - level one contains a node for each type of resource
-        * - level two contains a node for each resource
-        * - level three contains a node for each instance of a resource for a
-        *   specific language.
-        */
-
-       tree = resource_tree_create (assemblyb->win32_resources);
-
-       /* Estimate the size of the encoded tree */
-       size = 0;
-       for (i = 0; i < mono_array_length (assemblyb->win32_resources); ++i) {
-               win32_res = (MonoReflectionWin32Resource*)mono_array_addr (assemblyb->win32_resources, MonoReflectionWin32Resource, i);
-               size += mono_array_length (win32_res->res_data);
-       }
-       /* Directory structure */
-       size += mono_array_length (assemblyb->win32_resources) * 256;
-       p = buf = (char *)g_malloc (size);
-
-       resource_tree_encode (tree, p, p, &p);
-
-       g_assert (p - buf <= size);
-
-       assembly->win32_res = (char *)g_malloc (p - buf);
-       assembly->win32_res_size = p - buf;
-       memcpy (assembly->win32_res, buf, p - buf);
-
-       g_free (buf);
-       resource_tree_free (tree);
-}
-
-static void
-fixup_resource_directory (char *res_section, char *p, guint32 rva)
-{
-       MonoPEResourceDir *dir = (MonoPEResourceDir*)p;
-       int i;
-
-       p += sizeof (MonoPEResourceDir);
-       for (i = 0; i < GUINT16_FROM_LE (dir->res_named_entries) + GUINT16_FROM_LE (dir->res_id_entries); ++i) {
-               MonoPEResourceDirEntry *dir_entry = (MonoPEResourceDirEntry*)p;
-               char *child = res_section + MONO_PE_RES_DIR_ENTRY_DIR_OFFSET (*dir_entry);
-               if (MONO_PE_RES_DIR_ENTRY_IS_DIR (*dir_entry)) {
-                       fixup_resource_directory (res_section, child, rva);
-               } else {
-                       MonoPEResourceDataEntry *data_entry = (MonoPEResourceDataEntry*)child;
-                       data_entry->rde_data_offset = GUINT32_TO_LE (GUINT32_FROM_LE (data_entry->rde_data_offset) + rva);
-               }
-
-               p += sizeof (MonoPEResourceDirEntry);
-       }
-}
-
-static void
-checked_write_file (HANDLE f, gconstpointer buffer, guint32 numbytes)
-{
-       guint32 dummy;
-       if (!WriteFile (f, buffer, numbytes, &dummy, NULL))
-               g_error ("WriteFile returned %d\n", GetLastError ());
-}
-
-/*
- * mono_image_create_pefile:
- * @mb: a module builder object
- * 
- * This function creates the PE-COFF header, the image sections, the CLI header  * etc. all the data is written in
- * assembly->pefile where it can be easily retrieved later in chunks.
- */
-gboolean
-mono_image_create_pefile (MonoReflectionModuleBuilder *mb, HANDLE file, MonoError *error)
-{
-       MonoMSDOSHeader *msdos;
-       MonoDotNetHeader *header;
-       MonoSectionTable *section;
-       MonoCLIHeader *cli_header;
-       guint32 size, image_size, virtual_base, text_offset;
-       guint32 header_start, section_start, file_offset, virtual_offset;
-       MonoDynamicImage *assembly;
-       MonoReflectionAssemblyBuilder *assemblyb;
-       MonoDynamicStream pefile_stream = {0};
-       MonoDynamicStream *pefile = &pefile_stream;
-       int i, nsections;
-       guint32 *rva, value;
-       guchar *p;
-       static const unsigned char msheader[] = {
-               0x4d, 0x5a, 0x90, 0x00, 0x03, 0x00, 0x00, 0x00,  0x04, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00,
-               0xb8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
-               0x0e, 0x1f, 0xba, 0x0e, 0x00, 0xb4, 0x09, 0xcd,  0x21, 0xb8, 0x01, 0x4c, 0xcd, 0x21, 0x54, 0x68,
-               0x69, 0x73, 0x20, 0x70, 0x72, 0x6f, 0x67, 0x72,  0x61, 0x6d, 0x20, 0x63, 0x61, 0x6e, 0x6e, 0x6f,
-               0x74, 0x20, 0x62, 0x65, 0x20, 0x72, 0x75, 0x6e,  0x20, 0x69, 0x6e, 0x20, 0x44, 0x4f, 0x53, 0x20,
-               0x6d, 0x6f, 0x64, 0x65, 0x2e, 0x0d, 0x0d, 0x0a,  0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-       };
-
-       mono_error_init (error);
-
-       assemblyb = mb->assemblyb;
-
-       mono_image_basic_init (assemblyb);
-       assembly = mb->dynamic_image;
-
-       assembly->pe_kind = assemblyb->pe_kind;
-       assembly->machine = assemblyb->machine;
-       ((MonoDynamicImage*)assemblyb->dynamic_assembly->assembly.image)->pe_kind = assemblyb->pe_kind;
-       ((MonoDynamicImage*)assemblyb->dynamic_assembly->assembly.image)->machine = assemblyb->machine;
-       
-       if (!mono_image_build_metadata (mb, error))
-               return FALSE;
-       
-
-       if (mb->is_main && assemblyb->resources) {
-               int len = mono_array_length (assemblyb->resources);
-               for (i = 0; i < len; ++i) {
-                       if (!assembly_add_resource (mb, assembly, (MonoReflectionResource*)mono_array_addr (assemblyb->resources, MonoReflectionResource, i), error))
-                               return FALSE;
-               }
-       }
-
-       if (mb->resources) {
-               int len = mono_array_length (mb->resources);
-               for (i = 0; i < len; ++i) {
-                       if (!assembly_add_resource (mb, assembly, (MonoReflectionResource*)mono_array_addr (mb->resources, MonoReflectionResource, i), error))
-                               return FALSE;
-               }
-       }
-
-       if (!build_compressed_metadata (assembly, error))
-               return FALSE;
-
-       if (mb->is_main)
-               assembly_add_win32_resources (assembly, assemblyb);
-
-       nsections = calc_section_size (assembly);
-       
-       /* The DOS header and stub */
-       g_assert (sizeof (MonoMSDOSHeader) == sizeof (msheader));
-       mono_image_add_stream_data (pefile, (char*)msheader, sizeof (msheader));
-
-       /* the dotnet header */
-       header_start = mono_image_add_stream_zero (pefile, sizeof (MonoDotNetHeader));
-
-       /* the section tables */
-       section_start = mono_image_add_stream_zero (pefile, sizeof (MonoSectionTable) * nsections);
-
-       file_offset = section_start + sizeof (MonoSectionTable) * nsections;
-       virtual_offset = VIRT_ALIGN;
-       image_size = 0;
-
-       for (i = 0; i < MONO_SECTION_MAX; ++i) {
-               if (!assembly->sections [i].size)
-                       continue;
-               /* align offsets */
-               file_offset += FILE_ALIGN - 1;
-               file_offset &= ~(FILE_ALIGN - 1);
-               virtual_offset += VIRT_ALIGN - 1;
-               virtual_offset &= ~(VIRT_ALIGN - 1);
-
-               assembly->sections [i].offset = file_offset;
-               assembly->sections [i].rva = virtual_offset;
-
-               file_offset += assembly->sections [i].size;
-               virtual_offset += assembly->sections [i].size;
-               image_size += (assembly->sections [i].size + VIRT_ALIGN - 1) & ~(VIRT_ALIGN - 1);
-       }
-
-       file_offset += FILE_ALIGN - 1;
-       file_offset &= ~(FILE_ALIGN - 1);
-
-       image_size += section_start + sizeof (MonoSectionTable) * nsections;
-
-       /* back-patch info */
-       msdos = (MonoMSDOSHeader*)pefile->data;
-       msdos->pe_offset = GUINT32_FROM_LE (sizeof (MonoMSDOSHeader));
-
-       header = (MonoDotNetHeader*)(pefile->data + header_start);
-       header->pesig [0] = 'P';
-       header->pesig [1] = 'E';
-       
-       header->coff.coff_machine = GUINT16_FROM_LE (assemblyb->machine);
-       header->coff.coff_sections = GUINT16_FROM_LE (nsections);
-       header->coff.coff_time = GUINT32_FROM_LE (time (NULL));
-       header->coff.coff_opt_header_size = GUINT16_FROM_LE (sizeof (MonoDotNetHeader) - sizeof (MonoCOFFHeader) - 4);
-       if (assemblyb->pekind == 1) {
-               /* it's a dll */
-               header->coff.coff_attributes = GUINT16_FROM_LE (0x210e);
-       } else {
-               /* it's an exe */
-               header->coff.coff_attributes = GUINT16_FROM_LE (0x010e);
-       }
-
-       virtual_base = 0x400000; /* FIXME: 0x10000000 if a DLL */
-
-       header->pe.pe_magic = GUINT16_FROM_LE (0x10B);
-       header->pe.pe_major = 6;
-       header->pe.pe_minor = 0;
-       size = assembly->sections [MONO_SECTION_TEXT].size;
-       size += FILE_ALIGN - 1;
-       size &= ~(FILE_ALIGN - 1);
-       header->pe.pe_code_size = GUINT32_FROM_LE(size);
-       size = assembly->sections [MONO_SECTION_RSRC].size;
-       size += FILE_ALIGN - 1;
-       size &= ~(FILE_ALIGN - 1);
-       header->pe.pe_data_size = GUINT32_FROM_LE(size);
-       g_assert (START_TEXT_RVA == assembly->sections [MONO_SECTION_TEXT].rva);
-       header->pe.pe_rva_code_base = GUINT32_FROM_LE (assembly->sections [MONO_SECTION_TEXT].rva);
-       header->pe.pe_rva_data_base = GUINT32_FROM_LE (assembly->sections [MONO_SECTION_RSRC].rva);
-       /* pe_rva_entry_point always at the beginning of the text section */
-       header->pe.pe_rva_entry_point = GUINT32_FROM_LE (assembly->sections [MONO_SECTION_TEXT].rva);
-
-       header->nt.pe_image_base = GUINT32_FROM_LE (virtual_base);
-       header->nt.pe_section_align = GUINT32_FROM_LE (VIRT_ALIGN);
-       header->nt.pe_file_alignment = GUINT32_FROM_LE (FILE_ALIGN);
-       header->nt.pe_os_major = GUINT16_FROM_LE (4);
-       header->nt.pe_os_minor = GUINT16_FROM_LE (0);
-       header->nt.pe_subsys_major = GUINT16_FROM_LE (4);
-       size = section_start;
-       size += FILE_ALIGN - 1;
-       size &= ~(FILE_ALIGN - 1);
-       header->nt.pe_header_size = GUINT32_FROM_LE (size);
-       size = image_size;
-       size += VIRT_ALIGN - 1;
-       size &= ~(VIRT_ALIGN - 1);
-       header->nt.pe_image_size = GUINT32_FROM_LE (size);
-
-       /*
-       // Translate the PEFileKind value to the value expected by the Windows loader
-       */
-       {
-               short kind;
-
-               /*
-               // PEFileKinds.Dll == 1
-               // PEFileKinds.ConsoleApplication == 2
-               // PEFileKinds.WindowApplication == 3
-               //
-               // need to get:
-               //     IMAGE_SUBSYSTEM_WINDOWS_GUI 2 // Image runs in the Windows GUI subsystem.
-                //     IMAGE_SUBSYSTEM_WINDOWS_CUI 3 // Image runs in the Windows character subsystem.
-               */
-               if (assemblyb->pekind == 3)
-                       kind = 2;
-               else
-                       kind = 3;
-               
-               header->nt.pe_subsys_required = GUINT16_FROM_LE (kind);
-       }    
-       header->nt.pe_stack_reserve = GUINT32_FROM_LE (0x00100000);
-       header->nt.pe_stack_commit = GUINT32_FROM_LE (0x00001000);
-       header->nt.pe_heap_reserve = GUINT32_FROM_LE (0x00100000);
-       header->nt.pe_heap_commit = GUINT32_FROM_LE (0x00001000);
-       header->nt.pe_loader_flags = GUINT32_FROM_LE (0);
-       header->nt.pe_data_dir_count = GUINT32_FROM_LE (16);
-
-       /* fill data directory entries */
-
-       header->datadir.pe_resource_table.size = GUINT32_FROM_LE (assembly->sections [MONO_SECTION_RSRC].size);
-       header->datadir.pe_resource_table.rva = GUINT32_FROM_LE (assembly->sections [MONO_SECTION_RSRC].rva);
-
-       header->datadir.pe_reloc_table.size = GUINT32_FROM_LE (assembly->sections [MONO_SECTION_RELOC].size);
-       header->datadir.pe_reloc_table.rva = GUINT32_FROM_LE (assembly->sections [MONO_SECTION_RELOC].rva);
-
-       header->datadir.pe_cli_header.size = GUINT32_FROM_LE (72);
-       header->datadir.pe_cli_header.rva = GUINT32_FROM_LE (assembly->text_rva + assembly->cli_header_offset);
-       header->datadir.pe_iat.size = GUINT32_FROM_LE (8);
-       header->datadir.pe_iat.rva = GUINT32_FROM_LE (assembly->text_rva + assembly->iat_offset);
-       /* patch entrypoint name */
-       if (assemblyb->pekind == 1)
-               memcpy (assembly->code.data + assembly->imp_names_offset + 2, "_CorDllMain", 12);
-       else
-               memcpy (assembly->code.data + assembly->imp_names_offset + 2, "_CorExeMain", 12);
-       /* patch imported function RVA name */
-       rva = (guint32*)(assembly->code.data + assembly->iat_offset);
-       *rva = GUINT32_FROM_LE (assembly->text_rva + assembly->imp_names_offset);
-
-       /* the import table */
-       header->datadir.pe_import_table.size = GUINT32_FROM_LE (79); /* FIXME: magic number? */
-       header->datadir.pe_import_table.rva = GUINT32_FROM_LE (assembly->text_rva + assembly->idt_offset);
-       /* patch imported dll RVA name and other entries in the dir */
-       rva = (guint32*)(assembly->code.data + assembly->idt_offset + G_STRUCT_OFFSET (MonoIDT, name_rva));
-       *rva = GUINT32_FROM_LE (assembly->text_rva + assembly->imp_names_offset + 14); /* 14 is hint+strlen+1 of func name */
-       rva = (guint32*)(assembly->code.data + assembly->idt_offset + G_STRUCT_OFFSET (MonoIDT, import_address_table_rva));
-       *rva = GUINT32_FROM_LE (assembly->text_rva + assembly->iat_offset);
-       rva = (guint32*)(assembly->code.data + assembly->idt_offset + G_STRUCT_OFFSET (MonoIDT, import_lookup_table));
-       *rva = GUINT32_FROM_LE (assembly->text_rva + assembly->ilt_offset);
-
-       p = (guchar*)(assembly->code.data + assembly->ilt_offset);
-       value = (assembly->text_rva + assembly->imp_names_offset);
-       *p++ = (value) & 0xff;
-       *p++ = (value >> 8) & (0xff);
-       *p++ = (value >> 16) & (0xff);
-       *p++ = (value >> 24) & (0xff);
-
-       /* the CLI header info */
-       cli_header = (MonoCLIHeader*)(assembly->code.data + assembly->cli_header_offset);
-       cli_header->ch_size = GUINT32_FROM_LE (72);
-       cli_header->ch_runtime_major = GUINT16_FROM_LE (2);
-       cli_header->ch_runtime_minor = GUINT16_FROM_LE (5);
-       cli_header->ch_flags = GUINT32_FROM_LE (assemblyb->pe_kind);
-       if (assemblyb->entry_point) {
-               guint32 table_idx = 0;
-               if (!strcmp (assemblyb->entry_point->object.vtable->klass->name, "MethodBuilder")) {
-                       MonoReflectionMethodBuilder *methodb = (MonoReflectionMethodBuilder*)assemblyb->entry_point;
-                       table_idx = methodb->table_idx;
-               } else {
-                       table_idx = GPOINTER_TO_UINT (g_hash_table_lookup (assembly->method_to_table_idx, assemblyb->entry_point->method));
-               }
-               cli_header->ch_entry_point = GUINT32_FROM_LE (table_idx | MONO_TOKEN_METHOD_DEF);
-       } else {
-               cli_header->ch_entry_point = GUINT32_FROM_LE (0);
-       }
-       /* The embedded managed resources */
-       text_offset = assembly->text_rva + assembly->code.index;
-       cli_header->ch_resources.rva = GUINT32_FROM_LE (text_offset);
-       cli_header->ch_resources.size = GUINT32_FROM_LE (assembly->resources.index);
-       text_offset += assembly->resources.index;
-       cli_header->ch_metadata.rva = GUINT32_FROM_LE (text_offset);
-       cli_header->ch_metadata.size = GUINT32_FROM_LE (assembly->meta_size);
-       text_offset += assembly->meta_size;
-       if (assembly->strong_name_size) {
-               cli_header->ch_strong_name.rva = GUINT32_FROM_LE (text_offset);
-               cli_header->ch_strong_name.size = GUINT32_FROM_LE (assembly->strong_name_size);
-               text_offset += assembly->strong_name_size;
-       }
-
-       /* write the section tables and section content */
-       section = (MonoSectionTable*)(pefile->data + section_start);
-       for (i = 0; i < MONO_SECTION_MAX; ++i) {
-               static const char section_names [][7] = {
-                       ".text", ".rsrc", ".reloc"
-               };
-               if (!assembly->sections [i].size)
-                       continue;
-               strcpy (section->st_name, section_names [i]);
-               /*g_print ("output section %s (%d), size: %d\n", section->st_name, i, assembly->sections [i].size);*/
-               section->st_virtual_address = GUINT32_FROM_LE (assembly->sections [i].rva);
-               section->st_virtual_size = GUINT32_FROM_LE (assembly->sections [i].size);
-               section->st_raw_data_size = GUINT32_FROM_LE (GUINT32_TO_LE (section->st_virtual_size) + (FILE_ALIGN - 1));
-               section->st_raw_data_size &= GUINT32_FROM_LE (~(FILE_ALIGN - 1));
-               section->st_raw_data_ptr = GUINT32_FROM_LE (assembly->sections [i].offset);
-               section->st_flags = GUINT32_FROM_LE (assembly->sections [i].attrs);
-               section ++;
-       }
-       
-       checked_write_file (file, pefile->data, pefile->index);
-       
-       mono_dynamic_stream_reset (pefile);
-       
-       for (i = 0; i < MONO_SECTION_MAX; ++i) {
-               if (!assembly->sections [i].size)
-                       continue;
-               
-               if (SetFilePointer (file, assembly->sections [i].offset, NULL, FILE_BEGIN) == INVALID_SET_FILE_POINTER)
-                       g_error ("SetFilePointer returned %d\n", GetLastError ());
-               
-               switch (i) {
-               case MONO_SECTION_TEXT:
-                       /* patch entry point */
-                       p = (guchar*)(assembly->code.data + 2);
-                       value = (virtual_base + assembly->text_rva + assembly->iat_offset);
-                       *p++ = (value) & 0xff;
-                       *p++ = (value >> 8) & 0xff;
-                       *p++ = (value >> 16) & 0xff;
-                       *p++ = (value >> 24) & 0xff;
-               
-                       checked_write_file (file, assembly->code.data, assembly->code.index);
-                       checked_write_file (file, assembly->resources.data, assembly->resources.index);
-                       checked_write_file (file, assembly->image.raw_metadata, assembly->meta_size);
-                       checked_write_file (file, assembly->strong_name, assembly->strong_name_size);
-                               
-
-                       g_free (assembly->image.raw_metadata);
-                       break;
-               case MONO_SECTION_RELOC: {
-                       struct {
-                               guint32 page_rva;
-                               guint32 block_size;
-                               guint16 type_and_offset;
-                               guint16 term;
-                       } reloc;
-                       
-                       g_assert (sizeof (reloc) == 12);
-                       
-                       reloc.page_rva = GUINT32_FROM_LE (assembly->text_rva);
-                       reloc.block_size = GUINT32_FROM_LE (12);
-                       
-                       /* 
-                        * the entrypoint is always at the start of the text section 
-                        * 3 is IMAGE_REL_BASED_HIGHLOW
-                        * 2 is patch_size_rva - text_rva
-                        */
-                       reloc.type_and_offset = GUINT16_FROM_LE ((3 << 12) + (2));
-                       reloc.term = 0;
-                       
-                       checked_write_file (file, &reloc, sizeof (reloc));
-                       
-                       break;
-               }
-               case MONO_SECTION_RSRC:
-                       if (assembly->win32_res) {
-
-                               /* Fixup the offsets in the IMAGE_RESOURCE_DATA_ENTRY structures */
-                               fixup_resource_directory (assembly->win32_res, assembly->win32_res, assembly->sections [i].rva);
-                               checked_write_file (file, assembly->win32_res, assembly->win32_res_size);
-                       }
-                       break;
-               default:
-                       g_assert_not_reached ();
-               }
-       }
-       
-       /* check that the file is properly padded */
-       if (SetFilePointer (file, file_offset, NULL, FILE_BEGIN) == INVALID_SET_FILE_POINTER)
-               g_error ("SetFilePointer returned %d\n", GetLastError ());
-       if (! SetEndOfFile (file))
-               g_error ("SetEndOfFile returned %d\n", GetLastError ());
-       
-       mono_dynamic_stream_reset (&assembly->code);
-       mono_dynamic_stream_reset (&assembly->us);
-       mono_dynamic_stream_reset (&assembly->blob);
-       mono_dynamic_stream_reset (&assembly->guid);
-       mono_dynamic_stream_reset (&assembly->sheap);
-
-       g_hash_table_foreach (assembly->blob_cache, (GHFunc)g_free, NULL);
-       g_hash_table_destroy (assembly->blob_cache);
-       assembly->blob_cache = NULL;
-
-       return TRUE;
-}
-
-#else /* DISABLE_REFLECTION_EMIT_SAVE */
-
-gboolean
-mono_image_create_pefile (MonoReflectionModuleBuilder *mb, HANDLE file, MonoError *error)
-{
-       g_assert_not_reached ();
-}
-
-#endif /* DISABLE_REFLECTION_EMIT_SAVE */
-
-#ifndef DISABLE_REFLECTION_EMIT
-
-MonoReflectionModule *
-mono_image_load_module_dynamic (MonoReflectionAssemblyBuilder *ab, MonoString *fileName, MonoError *error)
-{
-       char *name;
-       MonoImage *image;
-       MonoImageOpenStatus status;
-       MonoDynamicAssembly *assembly;
-       guint32 module_count;
-       MonoImage **new_modules;
-       gboolean *new_modules_loaded;
-       
-       mono_error_init (error);
-       
-       name = mono_string_to_utf8_checked (fileName, error);
-       return_val_if_nok (error, NULL);
-
-       image = mono_image_open (name, &status);
-       if (!image) {
-               if (status == MONO_IMAGE_ERROR_ERRNO)
-                       mono_error_set_exception_instance (error, mono_get_exception_file_not_found (fileName));
-               else
-                       mono_error_set_bad_image_name (error, name, NULL);
-               g_free (name);
-               return NULL;
-       }
-
-       g_free (name);
-
-       assembly = ab->dynamic_assembly;
-       image->assembly = (MonoAssembly*)assembly;
-
-       module_count = image->assembly->image->module_count;
-       new_modules = g_new0 (MonoImage *, module_count + 1);
-       new_modules_loaded = g_new0 (gboolean, module_count + 1);
-
-       if (image->assembly->image->modules)
-               memcpy (new_modules, image->assembly->image->modules, module_count * sizeof (MonoImage *));
-       if (image->assembly->image->modules_loaded)
-               memcpy (new_modules_loaded, image->assembly->image->modules_loaded, module_count * sizeof (gboolean));
-       new_modules [module_count] = image;
-       new_modules_loaded [module_count] = TRUE;
-       mono_image_addref (image);
-
-       g_free (image->assembly->image->modules);
-       image->assembly->image->modules = new_modules;
-       image->assembly->image->modules_loaded = new_modules_loaded;
-       image->assembly->image->module_count ++;
-
-       mono_assembly_load_references (image, &status);
-       if (status) {
-               mono_image_close (image);
-               mono_error_set_exception_instance (error, mono_get_exception_file_not_found (fileName));
-               return NULL;
-       }
-
-       return mono_module_get_object_checked (mono_domain_get (), image, error);
-}
-
-#endif /* DISABLE_REFLECTION_EMIT */
-
-/*
- * We need to return always the same object for MethodInfo, FieldInfo etc..
- * but we need to consider the reflected type.
- * type uses a different hash, since it uses custom hash/equal functions.
- */
-
-typedef struct {
-       gpointer item;
-       MonoClass *refclass;
-} ReflectedEntry;
-
-static gboolean
-reflected_equal (gconstpointer a, gconstpointer b) {
-       const ReflectedEntry *ea = (const ReflectedEntry *)a;
-       const ReflectedEntry *eb = (const ReflectedEntry *)b;
-
-       return (ea->item == eb->item) && (ea->refclass == eb->refclass);
-}
-
-static guint
-reflected_hash (gconstpointer a) {
-       const ReflectedEntry *ea = (const ReflectedEntry *)a;
-       return mono_aligned_addr_hash (ea->item);
-}
-
-#define CHECK_OBJECT(t,p,k)    \
-       do {    \
-               t _obj; \
-               ReflectedEntry e;       \
-               e.item = (p);   \
-               e.refclass = (k);       \
-               mono_domain_lock (domain);      \
-               if (!domain->refobject_hash)    \
-                       domain->refobject_hash = mono_g_hash_table_new_type (reflected_hash, reflected_equal, MONO_HASH_VALUE_GC, MONO_ROOT_SOURCE_DOMAIN, "domain reflection objects table");  \
-               if ((_obj = (t)mono_g_hash_table_lookup (domain->refobject_hash, &e))) {        \
-                       mono_domain_unlock (domain);    \
-                       return _obj;    \
-               }       \
-        mono_domain_unlock (domain); \
-       } while (0)
-
-#ifdef HAVE_BOEHM_GC
-/* ReflectedEntry doesn't need to be GC tracked */
-#define ALLOC_REFENTRY g_new0 (ReflectedEntry, 1)
-#define FREE_REFENTRY(entry) g_free ((entry))
-#define REFENTRY_REQUIRES_CLEANUP
-#else
-#define ALLOC_REFENTRY (ReflectedEntry *)mono_mempool_alloc (domain->mp, sizeof (ReflectedEntry))
-/* FIXME: */
-#define FREE_REFENTRY(entry)
-#endif
-
-#define CACHE_OBJECT(t,p,o,k)  \
-       do {    \
-               t _obj; \
-        ReflectedEntry pe; \
-        pe.item = (p); \
-        pe.refclass = (k); \
-        mono_domain_lock (domain); \
-               if (!domain->refobject_hash)    \
-                       domain->refobject_hash = mono_g_hash_table_new_type (reflected_hash, reflected_equal, MONO_HASH_VALUE_GC, MONO_ROOT_SOURCE_DOMAIN, "domain reflection objects table");  \
-        _obj = (t)mono_g_hash_table_lookup (domain->refobject_hash, &pe); \
-        if (!_obj) { \
-                   ReflectedEntry *e = ALLOC_REFENTRY;         \
-                   e->item = (p);      \
-                   e->refclass = (k);  \
-                   mono_g_hash_table_insert (domain->refobject_hash, e,o);     \
-            _obj = o; \
-        } \
-               mono_domain_unlock (domain);    \
-        return _obj; \
-       } while (0)
-
-static void
-clear_cached_object (MonoDomain *domain, gpointer o, MonoClass *klass)
-{
-       mono_domain_lock (domain);
-       if (domain->refobject_hash) {
-        ReflectedEntry pe;
-               gpointer orig_pe, orig_value;
-
-               pe.item = o;
-               pe.refclass = klass;
-               if (mono_g_hash_table_lookup_extended (domain->refobject_hash, &pe, &orig_pe, &orig_value)) {
-                       mono_g_hash_table_remove (domain->refobject_hash, &pe);
-                       FREE_REFENTRY (orig_pe);
-               }
-       }
-       mono_domain_unlock (domain);
-}
-
-#ifdef REFENTRY_REQUIRES_CLEANUP
-static void
-cleanup_refobject_hash (gpointer key, gpointer value, gpointer user_data)
-{
-       FREE_REFENTRY (key);
-}
-#endif
-
-void
-mono_reflection_cleanup_domain (MonoDomain *domain)
-{
-       if (domain->refobject_hash) {
-/*let's avoid scanning the whole hashtable if not needed*/
-#ifdef REFENTRY_REQUIRES_CLEANUP
-               mono_g_hash_table_foreach (domain->refobject_hash, cleanup_refobject_hash, NULL);
-#endif
-               mono_g_hash_table_destroy (domain->refobject_hash);
-               domain->refobject_hash = NULL;
-       }
-}
-
-#ifndef DISABLE_REFLECTION_EMIT
-static gpointer
-register_assembly (MonoDomain *domain, MonoReflectionAssembly *res, MonoAssembly *assembly)
-{
-       CACHE_OBJECT (MonoReflectionAssembly *, assembly, res, NULL);
-}
-
-static gpointer
-register_module (MonoDomain *domain, MonoReflectionModuleBuilder *res, MonoDynamicImage *module)
-{
-       CACHE_OBJECT (MonoReflectionModuleBuilder *, module, res, NULL);
-}
-
-static gboolean
-image_module_basic_init (MonoReflectionModuleBuilder *moduleb, MonoError *error)
-{
-       MonoDynamicImage *image = moduleb->dynamic_image;
-       MonoReflectionAssemblyBuilder *ab = moduleb->assemblyb;
-       mono_error_init (error);
-       if (!image) {
-               int module_count;
-               MonoImage **new_modules;
-               MonoImage *ass;
-               char *name, *fqname;
-               /*
-                * FIXME: we already created an image in mono_image_basic_init (), but
-                * we don't know which module it belongs to, since that is only 
-                * determined at assembly save time.
-                */
-               /*image = (MonoDynamicImage*)ab->dynamic_assembly->assembly.image; */
-               name = mono_string_to_utf8_checked (ab->name, error);
-               return_val_if_nok (error, FALSE);
-               fqname = mono_string_to_utf8_checked (moduleb->module.fqname, error);
-               if (!is_ok (error)) {
-                       g_free (name);
-                       return FALSE;
-               }
-               image = create_dynamic_mono_image (ab->dynamic_assembly, name, fqname);
-
-               moduleb->module.image = &image->image;
-               moduleb->dynamic_image = image;
-               register_module (mono_object_domain (moduleb), moduleb, image);
-
-               /* register the module with the assembly */
-               ass = ab->dynamic_assembly->assembly.image;
-               module_count = ass->module_count;
-               new_modules = g_new0 (MonoImage *, module_count + 1);
-
-               if (ass->modules)
-                       memcpy (new_modules, ass->modules, module_count * sizeof (MonoImage *));
-               new_modules [module_count] = &image->image;
-               mono_image_addref (&image->image);
-
-               g_free (ass->modules);
-               ass->modules = new_modules;
-               ass->module_count ++;
-       }
-       return TRUE;
-}
-
-static void
-mono_image_module_basic_init (MonoReflectionModuleBuilder *moduleb)
-{
-       MonoError error;
-       (void) image_module_basic_init (moduleb, &error);
-       mono_error_set_pending_exception (&error);
-}
-
-#endif
-
-/*
- * mono_assembly_get_object:
- * @domain: an app domain
- * @assembly: an assembly
- *
- * Return an System.Reflection.Assembly object representing the MonoAssembly @assembly.
- */
-MonoReflectionAssembly*
-mono_assembly_get_object (MonoDomain *domain, MonoAssembly *assembly)
-{
-       MonoError error;
-       MonoReflectionAssembly *result;
-       result = mono_assembly_get_object_checked (domain, assembly, &error);
-       mono_error_cleanup (&error); /* FIXME new API that doesn't swallow the error */
-       return result;
-}
-/*
- * mono_assembly_get_object_checked:
- * @domain: an app domain
- * @assembly: an assembly
- *
- * Return an System.Reflection.Assembly object representing the MonoAssembly @assembly.
- */
-MonoReflectionAssembly*
-mono_assembly_get_object_checked (MonoDomain *domain, MonoAssembly *assembly, MonoError *error)
-{
-       MonoReflectionAssembly *res;
-       
-       mono_error_init (error);
-
-       CHECK_OBJECT (MonoReflectionAssembly *, assembly, NULL);
-       res = (MonoReflectionAssembly *)mono_object_new_checked (domain, mono_class_get_mono_assembly_class (), error);
-       if (!res)
-               return NULL;
-       res->assembly = assembly;
-
-       CACHE_OBJECT (MonoReflectionAssembly *, assembly, res, NULL);
-}
-
-
-
-MonoReflectionModule*   
-mono_module_get_object   (MonoDomain *domain, MonoImage *image)
-{
-       MonoError error;
-       MonoReflectionModule *result;
-       result = mono_module_get_object_checked (domain, image, &error);
-       mono_error_cleanup (&error);
-       return result;
-}
-
-MonoReflectionModule*
-mono_module_get_object_checked (MonoDomain *domain, MonoImage *image, MonoError *error)
-{
-       MonoReflectionModule *res;
-       char* basename;
-       
-       mono_error_init (error);
-       CHECK_OBJECT (MonoReflectionModule *, image, NULL);
-       res = (MonoReflectionModule *)mono_object_new_checked (domain, mono_class_get_mono_module_class (), error);
-       if (!res)
-               return NULL;
-
-       res->image = image;
-       MonoReflectionAssembly *assm_obj = mono_assembly_get_object_checked (domain, image->assembly, error);
-       if (!assm_obj)
-               return NULL;
-       MONO_OBJECT_SETREF (res, assembly, assm_obj);
-
-       MONO_OBJECT_SETREF (res, fqname, mono_string_new (domain, image->name));
-       basename = g_path_get_basename (image->name);
-       MONO_OBJECT_SETREF (res, name, mono_string_new (domain, basename));
-       MONO_OBJECT_SETREF (res, scopename, mono_string_new (domain, image->module_name));
-       
-       g_free (basename);
-
-       if (image->assembly->image == image) {
-               res->token = mono_metadata_make_token (MONO_TABLE_MODULE, 1);
-       } else {
-               int i;
-               res->token = 0;
-               if (image->assembly->image->modules) {
-                       for (i = 0; i < image->assembly->image->module_count; i++) {
-                               if (image->assembly->image->modules [i] == image)
-                                       res->token = mono_metadata_make_token (MONO_TABLE_MODULEREF, i + 1);
-                       }
-                       g_assert (res->token);
-               }
-       }
-
-       CACHE_OBJECT (MonoReflectionModule *, image, res, NULL);
-}
-
-MonoReflectionModule*
-mono_module_file_get_object (MonoDomain *domain, MonoImage *image, int table_index)
-{
-       MonoError error;
-       MonoReflectionModule *result;
-       result = mono_module_file_get_object_checked (domain, image, table_index, &error);
-       mono_error_cleanup (&error);
-       return result;
-}
-
-MonoReflectionModule*
-mono_module_file_get_object_checked (MonoDomain *domain, MonoImage *image, int table_index, MonoError *error)
-{
-       MonoReflectionModule *res;
-       MonoTableInfo *table;
-       guint32 cols [MONO_FILE_SIZE];
-       const char *name;
-       guint32 i, name_idx;
-       const char *val;
-       
-       mono_error_init (error);
-
-       res = (MonoReflectionModule *)mono_object_new_checked (domain, mono_class_get_mono_module_class (), error);
-       if (!res)
-               return NULL;
-
-       table = &image->tables [MONO_TABLE_FILE];
-       g_assert (table_index < table->rows);
-       mono_metadata_decode_row (table, table_index, cols, MONO_FILE_SIZE);
-
-       res->image = NULL;
-       MonoReflectionAssembly *assm_obj = mono_assembly_get_object_checked (domain, image->assembly, error);
-       if (!assm_obj)
-               return NULL;
-       MONO_OBJECT_SETREF (res, assembly, assm_obj);
-       name = mono_metadata_string_heap (image, cols [MONO_FILE_NAME]);
-
-       /* Check whenever the row has a corresponding row in the moduleref table */
-       table = &image->tables [MONO_TABLE_MODULEREF];
-       for (i = 0; i < table->rows; ++i) {
-               name_idx = mono_metadata_decode_row_col (table, i, MONO_MODULEREF_NAME);
-               val = mono_metadata_string_heap (image, name_idx);
-               if (strcmp (val, name) == 0)
-                       res->image = image->modules [i];
-       }
-
-       MONO_OBJECT_SETREF (res, fqname, mono_string_new (domain, name));
-       MONO_OBJECT_SETREF (res, name, mono_string_new (domain, name));
-       MONO_OBJECT_SETREF (res, scopename, mono_string_new (domain, name));
-       res->is_resource = cols [MONO_FILE_FLAGS] & FILE_CONTAINS_NO_METADATA;
-       res->token = mono_metadata_make_token (MONO_TABLE_FILE, table_index + 1);
-
-       return res;
-}
-
-static gboolean
-verify_safe_for_managed_space (MonoType *type)
-{
-       switch (type->type) {
-#ifdef DEBUG_HARDER
-       case MONO_TYPE_ARRAY:
-               return verify_safe_for_managed_space (&type->data.array->eklass->byval_arg);
-       case MONO_TYPE_PTR:
-               return verify_safe_for_managed_space (type->data.type);
-       case MONO_TYPE_SZARRAY:
-               return verify_safe_for_managed_space (&type->data.klass->byval_arg);
-       case MONO_TYPE_GENERICINST: {
-               MonoGenericInst *inst = type->data.generic_class->inst;
-               int i;
-               if (!inst->is_open)
-                       break;
-               for (i = 0; i < inst->type_argc; ++i)
-                       if (!verify_safe_for_managed_space (inst->type_argv [i]))
-                               return FALSE;
-               return TRUE;
-       }
-#endif
-       case MONO_TYPE_VAR:
-       case MONO_TYPE_MVAR:
-               return TRUE;
-       default:
-               return TRUE;
-       }
-}
-
-static MonoType*
-mono_type_normalize (MonoType *type)
-{
-       int i;
-       MonoGenericClass *gclass;
-       MonoGenericInst *ginst;
-       MonoClass *gtd;
-       MonoGenericContainer *gcontainer;
-       MonoType **argv = NULL;
-       gboolean is_denorm_gtd = TRUE, requires_rebind = FALSE;
-
-       if (type->type != MONO_TYPE_GENERICINST)
-               return type;
-
-       gclass = type->data.generic_class;
-       ginst = gclass->context.class_inst;
-       if (!ginst->is_open)
-               return type;
-
-       gtd = gclass->container_class;
-       gcontainer = gtd->generic_container;
-       argv = g_newa (MonoType*, ginst->type_argc);
-
-       for (i = 0; i < ginst->type_argc; ++i) {
-               MonoType *t = ginst->type_argv [i], *norm;
-               if (t->type != MONO_TYPE_VAR || t->data.generic_param->num != i || t->data.generic_param->owner != gcontainer)
-                       is_denorm_gtd = FALSE;
-               norm = mono_type_normalize (t);
-               argv [i] = norm;
-               if (norm != t)
-                       requires_rebind = TRUE;
-       }
-
-       if (is_denorm_gtd)
-               return type->byref == gtd->byval_arg.byref ? &gtd->byval_arg : &gtd->this_arg;
-
-       if (requires_rebind) {
-               MonoClass *klass = mono_class_bind_generic_parameters (gtd, ginst->type_argc, argv, gclass->is_dynamic);
-               return type->byref == klass->byval_arg.byref ? &klass->byval_arg : &klass->this_arg;
-       }
-
-       return type;
-}
-/*
- * mono_type_get_object:
- * @domain: an app domain
- * @type: a type
- *
- * Return an System.MonoType object representing the type @type.
- */
-MonoReflectionType*
-mono_type_get_object (MonoDomain *domain, MonoType *type)
-{
-       MonoError error;
-       MonoReflectionType *ret = mono_type_get_object_checked (domain, type, &error);
-       mono_error_cleanup (&error);
-
-       return ret;
-}
-
-MonoReflectionType*
-mono_type_get_object_checked (MonoDomain *domain, MonoType *type, MonoError *error)
-{
-       MonoType *norm_type;
-       MonoReflectionType *res;
-       MonoClass *klass;
-
-       mono_error_init (error);
-
-       klass = mono_class_from_mono_type (type);
-
-       /*we must avoid using @type as it might have come
-        * from a mono_metadata_type_dup and the caller
-        * expects that is can be freed.
-        * Using the right type from 
-        */
-       type = klass->byval_arg.byref == type->byref ? &klass->byval_arg : &klass->this_arg;
-
-       /* void is very common */
-       if (type->type == MONO_TYPE_VOID && domain->typeof_void)
-               return (MonoReflectionType*)domain->typeof_void;
-
-       /*
-        * If the vtable of the given class was already created, we can use
-        * the MonoType from there and avoid all locking and hash table lookups.
-        * 
-        * We cannot do this for TypeBuilders as mono_reflection_create_runtime_class expects
-        * that the resulting object is different.   
-        */
-       if (type == &klass->byval_arg && !image_is_dynamic (klass->image)) {
-               MonoVTable *vtable = mono_class_try_get_vtable (domain, klass);
-               if (vtable && vtable->type)
-                       return (MonoReflectionType *)vtable->type;
-       }
-
-       mono_loader_lock (); /*FIXME mono_class_init and mono_class_vtable acquire it*/
-       mono_domain_lock (domain);
-       if (!domain->type_hash)
-               domain->type_hash = mono_g_hash_table_new_type ((GHashFunc)mono_metadata_type_hash, 
-                               (GCompareFunc)mono_metadata_type_equal, MONO_HASH_VALUE_GC, MONO_ROOT_SOURCE_DOMAIN, "domain reflection types table");
-       if ((res = (MonoReflectionType *)mono_g_hash_table_lookup (domain->type_hash, type))) {
-               mono_domain_unlock (domain);
-               mono_loader_unlock ();
-               return res;
-       }
-
-       /*Types must be normalized so a generic instance of the GTD get's the same inner type.
-        * For example in: Foo<A,B>; Bar<A> : Foo<A, Bar<A>>
-        * The second Bar will be encoded a generic instance of Bar with <A> as parameter.
-        * On all other places, Bar<A> will be encoded as the GTD itself. This is an implementation
-        * artifact of how generics are encoded and should be transparent to managed code so we
-        * need to weed out this diference when retrieving managed System.Type objects.
-        */
-       norm_type = mono_type_normalize (type);
-       if (norm_type != type) {
-               res = mono_type_get_object_checked (domain, norm_type, error);
-               if (!mono_error_ok (error))
-                       return NULL;
-               mono_g_hash_table_insert (domain->type_hash, type, res);
-               mono_domain_unlock (domain);
-               mono_loader_unlock ();
-               return res;
-       }
-
-       /* This MonoGenericClass hack is no longer necessary. Let's leave it here until we finish with the 2-stage type-builder setup.*/
-       if ((type->type == MONO_TYPE_GENERICINST) && type->data.generic_class->is_dynamic && !type->data.generic_class->container_class->wastypebuilder)
-               g_assert (0);
-
-       if (!verify_safe_for_managed_space (type)) {
-               mono_domain_unlock (domain);
-               mono_loader_unlock ();
-               mono_error_set_generic_error (error, "System", "InvalidOperationException", "This type cannot be propagated to managed space");
-               return NULL;
-       }
-
-       if (mono_class_get_ref_info (klass) && !klass->wastypebuilder) {
-               gboolean is_type_done = TRUE;
-               /* Generic parameters have reflection_info set but they are not finished together with their enclosing type.
-                * We must ensure that once a type is finished we don't return a GenericTypeParameterBuilder.
-                * We can't simply close the types as this will interfere with other parts of the generics machinery.
-               */
-               if (klass->byval_arg.type == MONO_TYPE_MVAR || klass->byval_arg.type == MONO_TYPE_VAR) {
-                       MonoGenericParam *gparam = klass->byval_arg.data.generic_param;
-
-                       if (gparam->owner && gparam->owner->is_method) {
-                               MonoMethod *method = gparam->owner->owner.method;
-                               if (method && mono_class_get_generic_type_definition (method->klass)->wastypebuilder)
-                                       is_type_done = FALSE;
-                       } else if (gparam->owner && !gparam->owner->is_method) {
-                               MonoClass *klass = gparam->owner->owner.klass;
-                               if (klass && mono_class_get_generic_type_definition (klass)->wastypebuilder)
-                                       is_type_done = FALSE;
-                       }
-               } 
-
-               /* g_assert_not_reached (); */
-               /* should this be considered an error condition? */
-               if (is_type_done && !type->byref) {
-                       mono_domain_unlock (domain);
-                       mono_loader_unlock ();
-                       return (MonoReflectionType *)mono_class_get_ref_info (klass);
-               }
-       }
-       /* This is stored in vtables/JITted code so it has to be pinned */
-       res = (MonoReflectionType *)mono_object_new_pinned (domain, mono_defaults.runtimetype_class, error);
-       if (!mono_error_ok (error))
-               return NULL;
-
-       res->type = type;
-       mono_g_hash_table_insert (domain->type_hash, type, res);
-
-       if (type->type == MONO_TYPE_VOID)
-               domain->typeof_void = (MonoObject*)res;
-
-       mono_domain_unlock (domain);
-       mono_loader_unlock ();
-       return res;
-}
-
-/*
- * mono_method_get_object:
- * @domain: an app domain
- * @method: a method
- * @refclass: the reflected type (can be NULL)
- *
- * Return an System.Reflection.MonoMethod object representing the method @method.
- */
-MonoReflectionMethod*
-mono_method_get_object (MonoDomain *domain, MonoMethod *method, MonoClass *refclass)
-{
-       MonoError error;
-       MonoReflectionMethod *ret = NULL;
-       ret = mono_method_get_object_checked (domain, method, refclass, &error);
-       mono_error_cleanup (&error);
-       return ret;
-}
-
-/*
- * mono_method_get_object_checked:
- * @domain: an app domain
- * @method: a method
- * @refclass: the reflected type (can be NULL)
- * @error: set on error.
- *
- * Return an System.Reflection.MonoMethod object representing the method @method.
- * Returns NULL and sets @error on error.
- */
-MonoReflectionMethod*
-mono_method_get_object_checked (MonoDomain *domain, MonoMethod *method, MonoClass *refclass, MonoError *error)
-{
-       /*
-        * We use the same C representation for methods and constructors, but the type 
-        * name in C# is different.
-        */
-       MonoReflectionType *rt;
-       MonoClass *klass;
-       MonoReflectionMethod *ret;
-
-       mono_error_init (error);
-
-       if (method->is_inflated) {
-               MonoReflectionGenericMethod *gret;
-
-               if (!refclass)
-                       refclass = method->klass;
-               CHECK_OBJECT (MonoReflectionMethod *, method, refclass);
-               if ((*method->name == '.') && (!strcmp (method->name, ".ctor") || !strcmp (method->name, ".cctor"))) {
-                       klass = mono_class_get_mono_generic_cmethod_class ();
-               } else {
-                       klass = mono_class_get_mono_generic_method_class ();
-               }
-               gret = (MonoReflectionGenericMethod*)mono_object_new_checked (domain, klass, error);
-               if (!mono_error_ok (error))
-                       goto leave;
-               gret->method.method = method;
-
-               MONO_OBJECT_SETREF (gret, method.name, mono_string_new (domain, method->name));
-
-               rt = mono_type_get_object_checked (domain, &refclass->byval_arg, error);
-               if (!mono_error_ok (error))
-                   goto leave;
-
-               MONO_OBJECT_SETREF (gret, method.reftype, rt);
-
-               CACHE_OBJECT (MonoReflectionMethod *, method, (MonoReflectionMethod*)gret, refclass);
-       }
-
-       if (!refclass)
-               refclass = method->klass;
-
-       CHECK_OBJECT (MonoReflectionMethod *, method, refclass);
-       if (*method->name == '.' && (strcmp (method->name, ".ctor") == 0 || strcmp (method->name, ".cctor") == 0)) {
-               klass = mono_class_get_mono_cmethod_class ();
-       }
-       else {
-               klass = mono_class_get_mono_method_class ();
-       }
-       ret = (MonoReflectionMethod*)mono_object_new_checked (domain, klass, error);
-       if (!mono_error_ok (error))
-               goto leave;
-       ret->method = method;
-
-       rt = mono_type_get_object_checked (domain, &refclass->byval_arg, error);
-       if (!mono_error_ok (error))
-               goto leave;
-
-       MONO_OBJECT_SETREF (ret, reftype, rt);
-
-       CACHE_OBJECT (MonoReflectionMethod *, method, ret, refclass);
-
-leave:
-       g_assert (!mono_error_ok (error));
-       return NULL;
-}
-
-/*
- * mono_method_clear_object:
- *
- *   Clear the cached reflection objects for the dynamic method METHOD.
- */
-void
-mono_method_clear_object (MonoDomain *domain, MonoMethod *method)
-{
-       MonoClass *klass;
-       g_assert (method_is_dynamic (method));
-
-       klass = method->klass;
-       while (klass) {
-               clear_cached_object (domain, method, klass);
-               klass = klass->parent;
-       }
-       /* Added by mono_param_get_objects () */
-       clear_cached_object (domain, &(method->signature), NULL);
-       klass = method->klass;
-       while (klass) {
-               clear_cached_object (domain, &(method->signature), klass);
-               klass = klass->parent;
-       }
-}
-
-/*
- * mono_field_get_object:
- * @domain: an app domain
- * @klass: a type
- * @field: a field
- *
- * Return an System.Reflection.MonoField object representing the field @field
- * in class @klass.
- */
-MonoReflectionField*
-mono_field_get_object (MonoDomain *domain, MonoClass *klass, MonoClassField *field)
-{
-       MonoError error;
-       MonoReflectionField *result;
-       result = mono_field_get_object_checked (domain, klass, field, &error);
-       mono_error_cleanup (&error);
-       return result;
-}
-
-/*
- * mono_field_get_object_checked:
- * @domain: an app domain
- * @klass: a type
- * @field: a field
- * @error: set on error
- *
- * Return an System.Reflection.MonoField object representing the field @field
- * in class @klass. On error, returns NULL and sets @error.
- */
-MonoReflectionField*
-mono_field_get_object_checked (MonoDomain *domain, MonoClass *klass, MonoClassField *field, MonoError *error)
-{
-       MonoReflectionType *rt;
-       MonoReflectionField *res;
-
-       mono_error_init (error);
-
-       CHECK_OBJECT (MonoReflectionField *, field, klass);
-       res = (MonoReflectionField *)mono_object_new_checked (domain, mono_class_get_mono_field_class (), error);
-       if (!res)
-               return NULL;
-       res->klass = klass;
-       res->field = field;
-       MONO_OBJECT_SETREF (res, name, mono_string_new (domain, mono_field_get_name (field)));
-
-       if (is_field_on_inst (field)) {
-               res->attrs = get_field_on_inst_generic_type (field)->attrs;
-
-               rt = mono_type_get_object_checked (domain, field->type, error);
-               if (!mono_error_ok (error))
-                       return NULL;
-
-               MONO_OBJECT_SETREF (res, type, rt);
-       } else {
-               if (field->type) {
-                       rt = mono_type_get_object_checked (domain, field->type, error);
-                       if (!mono_error_ok (error))
-                               return NULL;
-
-                       MONO_OBJECT_SETREF (res, type, rt);
-               }
-               res->attrs = mono_field_get_flags (field);
-       }
-       CACHE_OBJECT (MonoReflectionField *, field, res, klass);
-}
-
-/*
- * mono_property_get_object:
- * @domain: an app domain
- * @klass: a type
- * @property: a property
- *
- * Return an System.Reflection.MonoProperty object representing the property @property
- * in class @klass.
- */
-MonoReflectionProperty*
-mono_property_get_object (MonoDomain *domain, MonoClass *klass, MonoProperty *property)
-{
-       MonoError error;
-       MonoReflectionProperty *result;
-       result = mono_property_get_object_checked (domain, klass, property, &error);
-       mono_error_cleanup (&error);
-       return result;
-}
-
-/**
- * mono_property_get_object:
- * @domain: an app domain
- * @klass: a type
- * @property: a property
- * @error: set on error
- *
- * Return an System.Reflection.MonoProperty object representing the property @property
- * in class @klass.  On error returns NULL and sets @error.
- */
-MonoReflectionProperty*
-mono_property_get_object_checked (MonoDomain *domain, MonoClass *klass, MonoProperty *property, MonoError *error)
-{
-       MonoReflectionProperty *res;
-
-       mono_error_init (error);
-
-       CHECK_OBJECT (MonoReflectionProperty *, property, klass);
-       res = (MonoReflectionProperty *)mono_object_new_checked (domain, mono_class_get_mono_property_class (), error);
-       if (!res)
-               return NULL;
-       res->klass = klass;
-       res->property = property;
-       CACHE_OBJECT (MonoReflectionProperty *, property, res, klass);
-}
-
-/*
- * mono_event_get_object:
- * @domain: an app domain
- * @klass: a type
- * @event: a event
- *
- * Return an System.Reflection.MonoEvent object representing the event @event
- * in class @klass.
- */
-MonoReflectionEvent*
-mono_event_get_object (MonoDomain *domain, MonoClass *klass, MonoEvent *event)
-{
-       MonoError error;
-       MonoReflectionEvent *result;
-       result = mono_event_get_object_checked (domain, klass, event, &error);
-       mono_error_cleanup (&error);
-       return result;
-}
-
-/**
- * mono_event_get_object_checked:
- * @domain: an app domain
- * @klass: a type
- * @event: a event
- * @error: set on error
- *
- * Return an System.Reflection.MonoEvent object representing the event @event
- * in class @klass. On failure sets @error and returns NULL
- */
-MonoReflectionEvent*
-mono_event_get_object_checked (MonoDomain *domain, MonoClass *klass, MonoEvent *event, MonoError *error)
-{
-       MonoReflectionEvent *res;
-       MonoReflectionMonoEvent *mono_event;
-
-       mono_error_init (error);
-       CHECK_OBJECT (MonoReflectionEvent *, event, klass);
-       mono_event = (MonoReflectionMonoEvent *)mono_object_new_checked (domain, mono_class_get_mono_event_class (), error);
-       if (!mono_event)
-               return NULL;
-       mono_event->klass = klass;
-       mono_event->event = event;
-       res = (MonoReflectionEvent*)mono_event;
-       CACHE_OBJECT (MonoReflectionEvent *, event, res, klass);
-}
-
-/**
- * mono_get_reflection_missing_object:
- * @domain: Domain where the object lives
- *
- * Returns the System.Reflection.Missing.Value singleton object
- * (of type System.Reflection.Missing).
- *
- * Used as the value for ParameterInfo.DefaultValue when Optional
- * is present
- */
-static MonoObject *
-mono_get_reflection_missing_object (MonoDomain *domain)
-{
-       MonoError error;
-       MonoObject *obj;
-       static MonoClassField *missing_value_field = NULL;
-       
-       if (!missing_value_field) {
-               MonoClass *missing_klass;
-               missing_klass = mono_class_get_missing_class ();
-               mono_class_init (missing_klass);
-               missing_value_field = mono_class_get_field_from_name (missing_klass, "Value");
-               g_assert (missing_value_field);
-       }
-       obj = mono_field_get_value_object_checked (domain, missing_value_field, NULL, &error);
-       mono_error_assert_ok (&error);
-       return obj;
-}
-
-static MonoObject*
-get_dbnull (MonoDomain *domain, MonoObject **dbnull)
-{
-       if (!*dbnull)
-               *dbnull = mono_get_dbnull_object (domain);
-       return *dbnull;
-}
-
-static MonoObject*
-get_reflection_missing (MonoDomain *domain, MonoObject **reflection_missing)
-{
-       if (!*reflection_missing)
-               *reflection_missing = mono_get_reflection_missing_object (domain);
-       return *reflection_missing;
-}
-
-/*
- * mono_param_get_objects:
- * @domain: an app domain
- * @method: a method
- *
- * Return an System.Reflection.ParameterInfo array object representing the parameters
- * in the method @method.
- */
-MonoArray*
-mono_param_get_objects_internal (MonoDomain *domain, MonoMethod *method, MonoClass *refclass, MonoError *error)
-{
-       static MonoClass *System_Reflection_ParameterInfo;
-       static MonoClass *System_Reflection_ParameterInfo_array;
-       MonoArray *res = NULL;
-       MonoReflectionMethod *member = NULL;
-       MonoReflectionParameter *param = NULL;
-       char **names = NULL, **blobs = NULL;
-       guint32 *types = NULL;
-       MonoType *type = NULL;
-       MonoObject *dbnull = NULL;
-       MonoObject *missing = NULL;
-       MonoMarshalSpec **mspecs = NULL;
-       MonoMethodSignature *sig = NULL;
-       MonoVTable *pinfo_vtable;
-       MonoReflectionType *rt;
-       int i;
-
-       mono_error_init (error);
-       
-       if (!System_Reflection_ParameterInfo_array) {
-               MonoClass *klass;
-
-               klass = mono_class_get_mono_parameter_info_class ();
-
-               mono_memory_barrier ();
-               System_Reflection_ParameterInfo = klass; 
-
-       
-               klass = mono_array_class_get (klass, 1);
-               mono_memory_barrier ();
-               System_Reflection_ParameterInfo_array = klass;
-       }
-
-       sig = mono_method_signature_checked (method, error);
-       if (!mono_error_ok (error))
-               goto leave;
-
-       if (!sig->param_count) {
-               res = mono_array_new_specific_checked (mono_class_vtable (domain, System_Reflection_ParameterInfo_array), 0, error);
-               if (!res)
-                       goto leave;
-
-               return res;
-       }
-
-       /* Note: the cache is based on the address of the signature into the method
-        * since we already cache MethodInfos with the method as keys.
-        */
-       CHECK_OBJECT (MonoArray*, &(method->signature), refclass);
-
-       member = mono_method_get_object_checked (domain, method, refclass, error);
-       if (!member)
-               goto leave;
-       names = g_new (char *, sig->param_count);
-       mono_method_get_param_names (method, (const char **) names);
-
-       mspecs = g_new (MonoMarshalSpec*, sig->param_count + 1);
-       mono_method_get_marshal_info (method, mspecs);
-
-       res = mono_array_new_specific_checked (mono_class_vtable (domain, System_Reflection_ParameterInfo_array), sig->param_count, error);
-       if (!res)
-               goto leave;
-
-       pinfo_vtable = mono_class_vtable (domain, System_Reflection_ParameterInfo);
-       for (i = 0; i < sig->param_count; ++i) {
-               param = (MonoReflectionParameter *) mono_object_new_specific_checked (pinfo_vtable, error);
-               if (!param)
-                       goto leave;
-
-               rt = mono_type_get_object_checked (domain, sig->params [i], error);
-               if (!rt)
-                       goto leave;
-
-               MONO_OBJECT_SETREF (param, ClassImpl, rt);
-
-               MONO_OBJECT_SETREF (param, MemberImpl, (MonoObject*)member);
-
-               MONO_OBJECT_SETREF (param, NameImpl, mono_string_new (domain, names [i]));
-
-               param->PositionImpl = i;
-               param->AttrsImpl = sig->params [i]->attrs;
-
-               if (!(param->AttrsImpl & PARAM_ATTRIBUTE_HAS_DEFAULT)) {
-                       if (param->AttrsImpl & PARAM_ATTRIBUTE_OPTIONAL)
-                               MONO_OBJECT_SETREF (param, DefaultValueImpl, get_reflection_missing (domain, &missing));
-                       else
-                               MONO_OBJECT_SETREF (param, DefaultValueImpl, get_dbnull (domain, &dbnull));
-               } else {
-
-                       if (!blobs) {
-                               blobs = g_new0 (char *, sig->param_count);
-                               types = g_new0 (guint32, sig->param_count);
-                               get_default_param_value_blobs (method, blobs, types); 
-                       }
-
-                       /* Build MonoType for the type from the Constant Table */
-                       if (!type)
-                               type = g_new0 (MonoType, 1);
-                       type->type = (MonoTypeEnum)types [i];
-                       type->data.klass = NULL;
-                       if (types [i] == MONO_TYPE_CLASS)
-                               type->data.klass = mono_defaults.object_class;
-                       else if ((sig->params [i]->type == MONO_TYPE_VALUETYPE) && sig->params [i]->data.klass->enumtype) {
-                               /* For enums, types [i] contains the base type */
-
-                                       type->type = MONO_TYPE_VALUETYPE;
-                                       type->data.klass = mono_class_from_mono_type (sig->params [i]);
-                       } else
-                               type->data.klass = mono_class_from_mono_type (type);
-
-                       MonoObject *default_val_obj = mono_get_object_from_blob (domain, type, blobs [i], error);
-                       if (!is_ok (error))
-                               goto leave;
-                       MONO_OBJECT_SETREF (param, DefaultValueImpl, default_val_obj);
-
-                       /* Type in the Constant table is MONO_TYPE_CLASS for nulls */
-                       if (types [i] != MONO_TYPE_CLASS && !param->DefaultValueImpl) {
-                               if (param->AttrsImpl & PARAM_ATTRIBUTE_OPTIONAL)
-                                       MONO_OBJECT_SETREF (param, DefaultValueImpl, get_reflection_missing (domain, &missing));
-                               else
-                                       MONO_OBJECT_SETREF (param, DefaultValueImpl, get_dbnull (domain, &dbnull));
-                       }
-                       
-               }
-
-               if (mspecs [i + 1]) {
-                       MonoReflectionMarshalAsAttribute* mobj;
-                       mobj = mono_reflection_marshal_as_attribute_from_marshal_spec (domain, method->klass, mspecs [i + 1], error);
-                       if (!mobj)
-                               goto leave;
-                       MONO_OBJECT_SETREF (param, MarshalAsImpl, (MonoObject*)mobj);
-               }
-               
-               mono_array_setref (res, i, param);
-       }
-
-leave:
-       g_free (names);
-       g_free (blobs);
-       g_free (types);
-       g_free (type);
-
-       if (sig) {
-               for (i = sig->param_count; i >= 0; i--) {
-                       if (mspecs [i])
-                               mono_metadata_free_marshal_spec (mspecs [i]);
-               }
-       }
-       g_free (mspecs);
-
-       if (!is_ok (error))
-               return NULL;
-       
-       CACHE_OBJECT (MonoArray *, &(method->signature), res, refclass);
-}
-
-MonoArray*
-mono_param_get_objects (MonoDomain *domain, MonoMethod *method)
-{
-       MonoError error;
-       MonoArray *result = mono_param_get_objects_internal (domain, method, NULL, &error);
-       mono_error_assert_ok (&error);
-       return result;
-}
-
-/*
- * mono_method_body_get_object:
- * @domain: an app domain
- * @method: a method
- *
- * Return an System.Reflection.MethodBody object representing the method @method.
- */
-MonoReflectionMethodBody*
-mono_method_body_get_object (MonoDomain *domain, MonoMethod *method)
-{
-       MonoError error;
-       MonoReflectionMethodBody *result = mono_method_body_get_object_checked (domain, method, &error);
-       mono_error_cleanup (&error);
-       return result;
-}
-
-/**
- * mono_method_body_get_object_checked:
- * @domain: an app domain
- * @method: a method
- * @error: set on error
- *
- * Return an System.Reflection.MethodBody object representing the
- * method @method.  On failure, returns NULL and sets @error.
- */
-MonoReflectionMethodBody*
-mono_method_body_get_object_checked (MonoDomain *domain, MonoMethod *method, MonoError *error)
-{
-       MonoReflectionMethodBody *ret;
-       MonoMethodHeader *header;
-       MonoImage *image;
-       MonoReflectionType *rt;
-       guint32 method_rva, local_var_sig_token;
-       char *ptr;
-       unsigned char format, flags;
-       int i;
-
-       mono_error_init (error);
-
-       /* for compatibility with .net */
-       if (method_is_dynamic (method)) {
-               mono_error_set_generic_error (error, "System", "InvalidOperationException", "");
-               return NULL;
-       }
-
-       CHECK_OBJECT (MonoReflectionMethodBody *, method, NULL);
-
-       if ((method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL) ||
-               (method->flags & METHOD_ATTRIBUTE_ABSTRACT) ||
-           (method->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL) ||
-               (method->klass->image->raw_data && method->klass->image->raw_data [1] != 'Z') ||
-           (method->iflags & METHOD_IMPL_ATTRIBUTE_RUNTIME))
-               return NULL;
-
-       image = method->klass->image;
-       header = mono_method_get_header_checked (method, error);
-       return_val_if_nok (error, NULL);
-
-       if (!image_is_dynamic (image)) {
-               /* Obtain local vars signature token */
-               method_rva = mono_metadata_decode_row_col (&image->tables [MONO_TABLE_METHOD], mono_metadata_token_index (method->token) - 1, MONO_METHOD_RVA);
-               ptr = mono_image_rva_map (image, method_rva);
-               flags = *(const unsigned char *) ptr;
-               format = flags & METHOD_HEADER_FORMAT_MASK;
-               switch (format){
-               case METHOD_HEADER_TINY_FORMAT:
-                       local_var_sig_token = 0;
-                       break;
-               case METHOD_HEADER_FAT_FORMAT:
-                       ptr += 2;
-                       ptr += 2;
-                       ptr += 4;
-                       local_var_sig_token = read32 (ptr);
-                       break;
-               default:
-                       g_assert_not_reached ();
-               }
-       } else
-               local_var_sig_token = 0; //FIXME
-
-       ret = (MonoReflectionMethodBody*)mono_object_new_checked (domain, mono_class_get_method_body_class (), error);
-       if (!is_ok (error))
-               goto fail;
-
-       ret->init_locals = header->init_locals;
-       ret->max_stack = header->max_stack;
-       ret->local_var_sig_token = local_var_sig_token;
-       MonoArray *il_arr = mono_array_new_cached (domain, mono_defaults.byte_class, header->code_size, error);
-       if (!is_ok (error))
-               goto fail;
-       MONO_OBJECT_SETREF (ret, il, il_arr);
-       memcpy (mono_array_addr (ret->il, guint8, 0), header->code, header->code_size);
-
-       /* Locals */
-       MonoArray *locals_arr = mono_array_new_cached (domain, mono_class_get_local_variable_info_class (), header->num_locals, error);
-       if (!is_ok (error))
-               goto fail;
-       MONO_OBJECT_SETREF (ret, locals, locals_arr);
-       for (i = 0; i < header->num_locals; ++i) {
-               MonoReflectionLocalVariableInfo *info = (MonoReflectionLocalVariableInfo*)mono_object_new_checked (domain, mono_class_get_local_variable_info_class (), error);
-               if (!is_ok (error))
-                       goto fail;
-
-               rt = mono_type_get_object_checked (domain, header->locals [i], error);
-               if (!is_ok (error))
-                       goto fail;
-
-               MONO_OBJECT_SETREF (info, local_type, rt);
-
-               info->is_pinned = header->locals [i]->pinned;
-               info->local_index = i;
-               mono_array_setref (ret->locals, i, info);
-       }
-
-       /* Exceptions */
-       MonoArray *exn_clauses = mono_array_new_cached (domain, mono_class_get_exception_handling_clause_class (), header->num_clauses, error);
-       if (!is_ok (error))
-               goto fail;
-       MONO_OBJECT_SETREF (ret, clauses, exn_clauses);
-       for (i = 0; i < header->num_clauses; ++i) {
-               MonoReflectionExceptionHandlingClause *info = (MonoReflectionExceptionHandlingClause*)mono_object_new_checked (domain, mono_class_get_exception_handling_clause_class (), error);
-               if (!is_ok (error))
-                       goto fail;
-               MonoExceptionClause *clause = &header->clauses [i];
-
-               info->flags = clause->flags;
-               info->try_offset = clause->try_offset;
-               info->try_length = clause->try_len;
-               info->handler_offset = clause->handler_offset;
-               info->handler_length = clause->handler_len;
-               if (clause->flags == MONO_EXCEPTION_CLAUSE_FILTER)
-                       info->filter_offset = clause->data.filter_offset;
-               else if (clause->data.catch_class) {
-                       rt = mono_type_get_object_checked (mono_domain_get (), &clause->data.catch_class->byval_arg, error);
-                       if (!is_ok (error))
-                               goto fail;
-
-                       MONO_OBJECT_SETREF (info, catch_type, rt);
-               }
-
-               mono_array_setref (ret->clauses, i, info);
-       }
-
-       mono_metadata_free_mh (header);
-       CACHE_OBJECT (MonoReflectionMethodBody *, method, ret, NULL);
-       return ret;
-
-fail:
-       mono_metadata_free_mh (header);
-       return NULL;
-}
-
-/**
- * mono_get_dbnull_object:
- * @domain: Domain where the object lives
- *
- * Returns the System.DBNull.Value singleton object
- *
- * Used as the value for ParameterInfo.DefaultValue 
- */
-MonoObject *
-mono_get_dbnull_object (MonoDomain *domain)
-{
-       MonoError error;
-       MonoObject *obj;
-       static MonoClassField *dbnull_value_field = NULL;
-       
-       if (!dbnull_value_field) {
-               MonoClass *dbnull_klass;
-               dbnull_klass = mono_class_get_dbnull_class ();
-               dbnull_value_field = mono_class_get_field_from_name (dbnull_klass, "Value");
-               g_assert (dbnull_value_field);
-       }
-       obj = mono_field_get_value_object_checked (domain, dbnull_value_field, NULL, &error);
-       mono_error_assert_ok (&error);
-       return obj;
-}
-
-static void
-get_default_param_value_blobs (MonoMethod *method, char **blobs, guint32 *types)
-{
-       guint32 param_index, i, lastp, crow = 0;
-       guint32 param_cols [MONO_PARAM_SIZE], const_cols [MONO_CONSTANT_SIZE];
-       gint32 idx;
-
-       MonoClass *klass = method->klass;
-       MonoImage *image = klass->image;
-       MonoMethodSignature *methodsig = mono_method_signature (method);
-
-       MonoTableInfo *constt;
-       MonoTableInfo *methodt;
-       MonoTableInfo *paramt;
-
-       if (!methodsig->param_count)
-               return;
-
-       mono_class_init (klass);
-
-       if (image_is_dynamic (klass->image)) {
-               MonoReflectionMethodAux *aux;
-               if (method->is_inflated)
-                       method = ((MonoMethodInflated*)method)->declaring;
-               aux = (MonoReflectionMethodAux *)g_hash_table_lookup (((MonoDynamicImage*)method->klass->image)->method_aux_hash, method);
-               if (aux && aux->param_defaults) {
-                       memcpy (blobs, &(aux->param_defaults [1]), methodsig->param_count * sizeof (char*));
-                       memcpy (types, &(aux->param_default_types [1]), methodsig->param_count * sizeof (guint32));
-               }
-               return;
-       }
-
-       methodt = &klass->image->tables [MONO_TABLE_METHOD];
-       paramt = &klass->image->tables [MONO_TABLE_PARAM];
-       constt = &image->tables [MONO_TABLE_CONSTANT];
-
-       idx = mono_method_get_index (method) - 1;
-       g_assert (idx != -1);
-
-       param_index = mono_metadata_decode_row_col (methodt, idx, MONO_METHOD_PARAMLIST);
-       if (idx + 1 < methodt->rows)
-               lastp = mono_metadata_decode_row_col (methodt, idx + 1, MONO_METHOD_PARAMLIST);
-       else
-               lastp = paramt->rows + 1;
-
-       for (i = param_index; i < lastp; ++i) {
-               guint32 paramseq;
-
-               mono_metadata_decode_row (paramt, i - 1, param_cols, MONO_PARAM_SIZE);
-               paramseq = param_cols [MONO_PARAM_SEQUENCE];
-
-               if (!(param_cols [MONO_PARAM_FLAGS] & PARAM_ATTRIBUTE_HAS_DEFAULT))
-                       continue;
-
-               crow = mono_metadata_get_constant_index (image, MONO_TOKEN_PARAM_DEF | i, crow + 1);
-               if (!crow) {
-                       continue;
-               }
-       
-               mono_metadata_decode_row (constt, crow - 1, const_cols, MONO_CONSTANT_SIZE);
-               blobs [paramseq - 1] = (char *)mono_metadata_blob_heap (image, const_cols [MONO_CONSTANT_VALUE]);
-               types [paramseq - 1] = const_cols [MONO_CONSTANT_TYPE];
-       }
-
-       return;
-}
-
-MonoObject *
-mono_get_object_from_blob (MonoDomain *domain, MonoType *type, const char *blob, MonoError *error)
-{
-       void *retval;
-       MonoClass *klass;
-       MonoObject *object;
-       MonoType *basetype = type;
-
-       mono_error_init (error);
-
-       if (!blob)
-               return NULL;
-       
-       klass = mono_class_from_mono_type (type);
-       if (klass->valuetype) {
-               object = mono_object_new_checked (domain, klass, error);
-               return_val_if_nok (error, NULL);
-               retval = ((gchar *) object + sizeof (MonoObject));
-               if (klass->enumtype)
-                       basetype = mono_class_enum_basetype (klass);
-       } else {
-               retval = &object;
-       }
-                       
-       if (!mono_get_constant_value_from_blob (domain, basetype->type,  blob, retval, error))
-               return object;
-       else
-               return NULL;
-}
-
-static int
-assembly_name_to_aname (MonoAssemblyName *assembly, char *p) {
-       int found_sep;
-       char *s;
-       gboolean quoted = FALSE;
-
-       memset (assembly, 0, sizeof (MonoAssemblyName));
-       assembly->culture = "";
-       memset (assembly->public_key_token, 0, MONO_PUBLIC_KEY_TOKEN_LENGTH);
-
-       if (*p == '"') {
-               quoted = TRUE;
-               p++;
-       }
-       assembly->name = p;
-       while (*p && (isalnum (*p) || *p == '.' || *p == '-' || *p == '_' || *p == '$' || *p == '@' || g_ascii_isspace (*p)))
-               p++;
-       if (quoted) {
-               if (*p != '"')
-                       return 1;
-               *p = 0;
-               p++;
-       }
-       if (*p != ',')
-               return 1;
-       *p = 0;
-       /* Remove trailing whitespace */
-       s = p - 1;
-       while (*s && g_ascii_isspace (*s))
-               *s-- = 0;
-       p ++;
-       while (g_ascii_isspace (*p))
-               p++;
-       while (*p) {
-               if (*p == 'V' && g_ascii_strncasecmp (p, "Version=", 8) == 0) {
-                       p += 8;
-                       assembly->major = strtoul (p, &s, 10);
-                       if (s == p || *s != '.')
-                               return 1;
-                       p = ++s;
-                       assembly->minor = strtoul (p, &s, 10);
-                       if (s == p || *s != '.')
-                               return 1;
-                       p = ++s;
-                       assembly->build = strtoul (p, &s, 10);
-                       if (s == p || *s != '.')
-                               return 1;
-                       p = ++s;
-                       assembly->revision = strtoul (p, &s, 10);
-                       if (s == p)
-                               return 1;
-                       p = s;
-               } else if (*p == 'C' && g_ascii_strncasecmp (p, "Culture=", 8) == 0) {
-                       p += 8;
-                       if (g_ascii_strncasecmp (p, "neutral", 7) == 0) {
-                               assembly->culture = "";
-                               p += 7;
-                       } else {
-                               assembly->culture = p;
-                               while (*p && *p != ',') {
-                                       p++;
-                               }
-                       }
-               } else if (*p == 'P' && g_ascii_strncasecmp (p, "PublicKeyToken=", 15) == 0) {
-                       p += 15;
-                       if (strncmp (p, "null", 4) == 0) {
-                               p += 4;
-                       } else {
-                               int len;
-                               gchar *start = p;
-                               while (*p && *p != ',') {
-                                       p++;
-                               }
-                               len = (p - start + 1);
-                               if (len > MONO_PUBLIC_KEY_TOKEN_LENGTH)
-                                       len = MONO_PUBLIC_KEY_TOKEN_LENGTH;
-                               g_strlcpy ((char*)assembly->public_key_token, start, len);
-                       }
-               } else {
-                       while (*p && *p != ',')
-                               p++;
-               }
-               found_sep = 0;
-               while (g_ascii_isspace (*p) || *p == ',') {
-                       *p++ = 0;
-                       found_sep = 1;
-                       continue;
-               }
-               /* failed */
-               if (!found_sep)
-                       return 1;
-       }
-
-       return 0;
-}
-
-/*
- * mono_reflection_parse_type:
- * @name: type name
- *
- * Parse a type name as accepted by the GetType () method and output the info
- * extracted in the info structure.
- * the name param will be mangled, so, make a copy before passing it to this function.
- * The fields in info will be valid until the memory pointed to by name is valid.
- *
- * See also mono_type_get_name () below.
- *
- * Returns: 0 on parse error.
- */
-static int
-_mono_reflection_parse_type (char *name, char **endptr, gboolean is_recursed,
-                            MonoTypeNameParse *info)
-{
-       char *start, *p, *w, *last_point, *startn;
-       int in_modifiers = 0;
-       int isbyref = 0, rank = 0, isptr = 0;
-
-       start = p = w = name;
-
-       //FIXME could we just zero the whole struct? memset (&info, 0, sizeof (MonoTypeNameParse))
-       memset (&info->assembly, 0, sizeof (MonoAssemblyName));
-       info->name = info->name_space = NULL;
-       info->nested = NULL;
-       info->modifiers = NULL;
-       info->type_arguments = NULL;
-
-       /* last_point separates the namespace from the name */
-       last_point = NULL;
-       /* Skips spaces */
-       while (*p == ' ') p++, start++, w++, name++;
-
-       while (*p) {
-               switch (*p) {
-               case '+':
-                       *p = 0; /* NULL terminate the name */
-                       startn = p + 1;
-                       info->nested = g_list_append (info->nested, startn);
-                       /* we have parsed the nesting namespace + name */
-                       if (info->name)
-                               break;
-                       if (last_point) {
-                               info->name_space = start;
-                               *last_point = 0;
-                               info->name = last_point + 1;
-                       } else {
-                               info->name_space = (char *)"";
-                               info->name = start;
-                       }
-                       break;
-               case '.':
-                       last_point = p;
-                       break;
-               case '\\':
-                       ++p;
-                       break;
-               case '&':
-               case '*':
-               case '[':
-               case ',':
-               case ']':
-                       in_modifiers = 1;
-                       break;
-               default:
-                       break;
-               }
-               if (in_modifiers)
-                       break;
-               // *w++ = *p++;
-               p++;
-       }
-       
-       if (!info->name) {
-               if (last_point) {
-                       info->name_space = start;
-                       *last_point = 0;
-                       info->name = last_point + 1;
-               } else {
-                       info->name_space = (char *)"";
-                       info->name = start;
-               }
-       }
-       while (*p) {
-               switch (*p) {
-               case '&':
-                       if (isbyref) /* only one level allowed by the spec */
-                               return 0;
-                       isbyref = 1;
-                       isptr = 0;
-                       info->modifiers = g_list_append (info->modifiers, GUINT_TO_POINTER (0));
-                       *p++ = 0;
-                       break;
-               case '*':
-                       if (isbyref) /* pointer to ref not okay */
-                               return 0;
-                       info->modifiers = g_list_append (info->modifiers, GUINT_TO_POINTER (-1));
-                       isptr = 1;
-                       *p++ = 0;
-                       break;
-               case '[':
-                       if (isbyref) /* array of ref and generic ref are not okay */
-                               return 0;
-                       //Decide if it's an array of a generic argument list
-                       *p++ = 0;
-
-                       if (!*p) //XXX test
-                               return 0;
-                       if (*p  == ',' || *p == '*' || *p == ']') { //array
-                               isptr = 0;
-                               rank = 1;
-                               while (*p) {
-                                       if (*p == ']')
-                                               break;
-                                       if (*p == ',')
-                                               rank++;
-                                       else if (*p == '*') /* '*' means unknown lower bound */
-                                               info->modifiers = g_list_append (info->modifiers, GUINT_TO_POINTER (-2));
-                                       else
-                                               return 0;
-                                       ++p;
-                               }
-                               if (*p++ != ']')
-                                       return 0;
-                               info->modifiers = g_list_append (info->modifiers, GUINT_TO_POINTER (rank));
-                       } else {
-                               if (rank || isptr) /* generic args after array spec or ptr*/ //XXX test
-                                       return 0;
-                               isptr = 0;
-                               info->type_arguments = g_ptr_array_new ();
-                               while (*p) {
-                                       MonoTypeNameParse *subinfo = g_new0 (MonoTypeNameParse, 1);
-                                       gboolean fqname = FALSE;
-
-                                       g_ptr_array_add (info->type_arguments, subinfo);
-
-                                       while (*p == ' ') p++;
-                                       if (*p == '[') {
-                                               p++;
-                                               fqname = TRUE;
-                                       }
-
-                                       if (!_mono_reflection_parse_type (p, &p, TRUE, subinfo))
-                                               return 0;
-
-                                       /*MS is lenient on [] delimited parameters that aren't fqn - and F# uses them.*/
-                                       if (fqname && (*p != ']')) {
-                                               char *aname;
-
-                                               if (*p != ',')
-                                                       return 0;
-                                               *p++ = 0;
-
-                                               aname = p;
-                                               while (*p && (*p != ']'))
-                                                       p++;
-
-                                               if (*p != ']')
-                                                       return 0;
-
-                                               *p++ = 0;
-                                               while (*aname) {
-                                                       if (g_ascii_isspace (*aname)) {
-                                                               ++aname;
-                                                               continue;
-                                                       }
-                                                       break;
-                                               }
-                                               if (!*aname ||
-                                                   !assembly_name_to_aname (&subinfo->assembly, aname))
-                                                       return 0;
-                                       } else if (fqname && (*p == ']')) {
-                                               *p++ = 0;
-                                       }
-                                       if (*p == ']') {
-                                               *p++ = 0;
-                                               break;
-                                       } else if (!*p) {
-                                               return 0;
-                                       }
-                                       *p++ = 0;
-                               }
-                       }
-                       break;
-               case ']':
-                       if (is_recursed)
-                               goto end;
-                       return 0;
-               case ',':
-                       if (is_recursed)
-                               goto end;
-                       *p++ = 0;
-                       while (*p) {
-                               if (g_ascii_isspace (*p)) {
-                                       ++p;
-                                       continue;
-                               }
-                               break;
-                       }
-                       if (!*p)
-                               return 0; /* missing assembly name */
-                       if (!assembly_name_to_aname (&info->assembly, p))
-                               return 0;
-                       break;
-               default:
-                       return 0;
-               }
-               if (info->assembly.name)
-                       break;
-       }
-       // *w = 0; /* terminate class name */
- end:
-       if (!info->name || !*info->name)
-               return 0;
-       if (endptr)
-               *endptr = p;
-       /* add other consistency checks */
-       return 1;
-}
-
-
-/**
- * mono_identifier_unescape_type_name_chars:
- * @identifier: the display name of a mono type
- *
- * Returns:
- *  The name in internal form, that is without escaping backslashes.
- *
- *  The string is modified in place!
- */
-char*
-mono_identifier_unescape_type_name_chars(char* identifier)
-{
-       char *w, *r;
-       if (!identifier)
-               return NULL;
-       for (w = r = identifier; *r != 0; r++)
-       {
-               char c = *r;
-               if (c == '\\') {
-                       r++;
-                       if (*r == 0)
-                               break;
-                       c = *r;
-               }
-               *w = c;
-               w++;
-       }
-       if (w != r)
-               *w = 0;
-       return identifier;
-}
-
-void
-mono_identifier_unescape_info (MonoTypeNameParse* info);
-
-static void
-unescape_each_type_argument(void* data, void* user_data)
-{
-       MonoTypeNameParse* info = (MonoTypeNameParse*)data;
-       mono_identifier_unescape_info (info);
-}
-
-static void
-unescape_each_nested_name (void* data, void* user_data)
-{
-       char* nested_name = (char*) data;
-       mono_identifier_unescape_type_name_chars(nested_name);
-}
-
-/**
- * mono_identifier_unescape_info:
- *
- * @info: a parsed display form of an (optionally assembly qualified) full type name.
- *
- * Returns: nothing.
- *
- * Destructively updates the info by unescaping the identifiers that
- * comprise the type namespace, name, nested types (if any) and
- * generic type arguments (if any).
- *
- * The resulting info has the names in internal form.
- *
- */
-void
-mono_identifier_unescape_info (MonoTypeNameParse *info)
-{
-       if (!info)
-               return;
-       mono_identifier_unescape_type_name_chars(info->name_space);
-       mono_identifier_unescape_type_name_chars(info->name);
-       // but don't escape info->assembly
-       if (info->type_arguments)
-               g_ptr_array_foreach(info->type_arguments, &unescape_each_type_argument, NULL);
-       if (info->nested)
-               g_list_foreach(info->nested, &unescape_each_nested_name, NULL);
-}
-
-int
-mono_reflection_parse_type (char *name, MonoTypeNameParse *info)
-{
-       int ok = _mono_reflection_parse_type (name, NULL, FALSE, info);
-       if (ok) {
-               mono_identifier_unescape_info (info);
-       }
-       return ok;
-}
-
-static MonoType*
-_mono_reflection_get_type_from_info (MonoTypeNameParse *info, MonoImage *image, gboolean ignorecase, MonoError *error)
-{
-       gboolean type_resolve = FALSE;
-       MonoType *type;
-       MonoImage *rootimage = image;
-
-       mono_error_init (error);
-
-       if (info->assembly.name) {
-               MonoAssembly *assembly = mono_assembly_loaded (&info->assembly);
-               if (!assembly && image && image->assembly && mono_assembly_names_equal (&info->assembly, &image->assembly->aname))
-                       /* 
-                        * This could happen in the AOT compiler case when the search hook is not
-                        * installed.
-                        */
-                       assembly = image->assembly;
-               if (!assembly) {
-                       /* then we must load the assembly ourselve - see #60439 */
-                       assembly = mono_assembly_load (&info->assembly, image->assembly->basedir, NULL);
-                       if (!assembly)
-                               return NULL;
-               }
-               image = assembly->image;
-       } else if (!image) {
-               image = mono_defaults.corlib;
-       }
-
-       type = mono_reflection_get_type_with_rootimage (rootimage, image, info, ignorecase, &type_resolve, error);
-       if (type == NULL && !info->assembly.name && image != mono_defaults.corlib) {
-               /* ignore the error and try again */
-               mono_error_cleanup (error);
-               mono_error_init (error);
-               image = mono_defaults.corlib;
-               type = mono_reflection_get_type_with_rootimage (rootimage, image, info, ignorecase, &type_resolve, error);
-       }
-
-       return type;
-}
-
-/**
- * mono_reflection_get_type_internal:
- *
- * Returns: may return NULL on success, sets error on failure.
- */
-static MonoType*
-mono_reflection_get_type_internal (MonoImage *rootimage, MonoImage* image, MonoTypeNameParse *info, gboolean ignorecase, MonoError *error)
-{
-       MonoClass *klass;
-       GList *mod;
-       int modval;
-       gboolean bounded = FALSE;
-       
-       mono_error_init (error);
-       if (!image)
-               image = mono_defaults.corlib;
-
-       if (!rootimage)
-               rootimage = mono_defaults.corlib;
-
-       if (ignorecase)
-               klass = mono_class_from_name_case_checked (image, info->name_space, info->name, error);
-       else
-               klass = mono_class_from_name_checked (image, info->name_space, info->name, error);
-
-       if (!klass)
-               return NULL;
-
-       for (mod = info->nested; mod; mod = mod->next) {
-               gpointer iter = NULL;
-               MonoClass *parent;
-
-               parent = klass;
-               mono_class_init (parent);
-
-               while ((klass = mono_class_get_nested_types (parent, &iter))) {
-                       char *lastp;
-                       char *nested_name, *nested_nspace;
-                       gboolean match = TRUE;
-
-                       lastp = strrchr ((const char *)mod->data, '.');
-                       if (lastp) {
-                               /* Nested classes can have namespaces */
-                               int nspace_len;
-
-                               nested_name = g_strdup (lastp + 1);
-                               nspace_len = lastp - (char*)mod->data;
-                               nested_nspace = (char *)g_malloc (nspace_len + 1);
-                               memcpy (nested_nspace, mod->data, nspace_len);
-                               nested_nspace [nspace_len] = '\0';
-
-                       } else {
-                               nested_name = (char *)mod->data;
-                               nested_nspace = NULL;
-                       }
-
-                       if (nested_nspace) {
-                               if (ignorecase) {
-                                       if (!(klass->name_space && mono_utf8_strcasecmp (klass->name_space, nested_nspace) == 0))
-                                               match = FALSE;
-                               } else {
-                                       if (!(klass->name_space && strcmp (klass->name_space, nested_nspace) == 0))
-                                               match = FALSE;
-                               }
-                       }
-                       if (match) {
-                               if (ignorecase) {
-                                       if (mono_utf8_strcasecmp (klass->name, nested_name) != 0)
-                                               match = FALSE;
-                               } else {
-                                       if (strcmp (klass->name, nested_name) != 0)
-                                               match = FALSE;
-                               }
-                       }
-                       if (lastp) {
-                               g_free (nested_name);
-                               g_free (nested_nspace);
-                       }
-                       if (match)
-                               break;
-               }
-
-               if (!klass)
-                       break;
-       }
-       if (!klass)
-               return NULL;
-
-       if (info->type_arguments) {
-               MonoType **type_args = g_new0 (MonoType *, info->type_arguments->len);
-               MonoReflectionType *the_type;
-               MonoType *instance;
-               int i;
-
-               for (i = 0; i < info->type_arguments->len; i++) {
-                       MonoTypeNameParse *subinfo = (MonoTypeNameParse *)g_ptr_array_index (info->type_arguments, i);
-
-                       type_args [i] = _mono_reflection_get_type_from_info (subinfo, rootimage, ignorecase, error);
-                       if (!type_args [i]) {
-                               g_free (type_args);
-                               return NULL;
-                       }
-               }
-
-               the_type = mono_type_get_object_checked (mono_domain_get (), &klass->byval_arg, error);
-               if (!the_type)
-                       return NULL;
-
-               instance = mono_reflection_bind_generic_parameters (
-                       the_type, info->type_arguments->len, type_args, error);
-
-               g_free (type_args);
-               if (!instance)
-                       return NULL;
-
-               klass = mono_class_from_mono_type (instance);
-       }
-
-       for (mod = info->modifiers; mod; mod = mod->next) {
-               modval = GPOINTER_TO_UINT (mod->data);
-               if (!modval) { /* byref: must be last modifier */
-                       return &klass->this_arg;
-               } else if (modval == -1) {
-                       klass = mono_ptr_class_get (&klass->byval_arg);
-               } else if (modval == -2) {
-                       bounded = TRUE;
-               } else { /* array rank */
-                       klass = mono_bounded_array_class_get (klass, modval, bounded);
-               }
-       }
-
-       return &klass->byval_arg;
-}
-
-/*
- * mono_reflection_get_type:
- * @image: a metadata context
- * @info: type description structure
- * @ignorecase: flag for case-insensitive string compares
- * @type_resolve: whenever type resolve was already tried
- *
- * Build a MonoType from the type description in @info.
- * 
- */
-
-MonoType*
-mono_reflection_get_type (MonoImage* image, MonoTypeNameParse *info, gboolean ignorecase, gboolean *type_resolve) {
-       MonoError error;
-       MonoType *result = mono_reflection_get_type_with_rootimage (image, image, info, ignorecase, type_resolve, &error);
-       mono_error_cleanup (&error);
-       return result;
-}
-
-/**
- * mono_reflection_get_type_checked:
- * @rootimage: the image of the currently active managed caller
- * @image: a metadata context
- * @info: type description structure
- * @ignorecase: flag for case-insensitive string compares
- * @type_resolve: whenever type resolve was already tried
- * @error: set on error.
- *
- * Build a MonoType from the type description in @info. On failure returns NULL and sets @error.
- *
- */
-MonoType*
-mono_reflection_get_type_checked (MonoImage *rootimage, MonoImage* image, MonoTypeNameParse *info, gboolean ignorecase, gboolean *type_resolve, MonoError *error) {
-       mono_error_init (error);
-       return mono_reflection_get_type_with_rootimage (rootimage, image, info, ignorecase, type_resolve, error);
-}
-
-
-static MonoType*
-mono_reflection_get_type_internal_dynamic (MonoImage *rootimage, MonoAssembly *assembly, MonoTypeNameParse *info, gboolean ignorecase, MonoError *error)
-{
-       MonoReflectionAssemblyBuilder *abuilder;
-       MonoType *type;
-       int i;
-
-       mono_error_init (error);
-       g_assert (assembly_is_dynamic (assembly));
-       abuilder = (MonoReflectionAssemblyBuilder*)mono_assembly_get_object_checked (((MonoDynamicAssembly*)assembly)->domain, assembly, error);
-       if (!abuilder)
-               return NULL;
-
-       /* Enumerate all modules */
-
-       type = NULL;
-       if (abuilder->modules) {
-               for (i = 0; i < mono_array_length (abuilder->modules); ++i) {
-                       MonoReflectionModuleBuilder *mb = mono_array_get (abuilder->modules, MonoReflectionModuleBuilder*, i);
-                       type = mono_reflection_get_type_internal (rootimage, &mb->dynamic_image->image, info, ignorecase, error);
-                       if (type)
-                               break;
-                       if (!mono_error_ok (error))
-                               return NULL;
-               }
-       }
-
-       if (!type && abuilder->loaded_modules) {
-               for (i = 0; i < mono_array_length (abuilder->loaded_modules); ++i) {
-                       MonoReflectionModule *mod = mono_array_get (abuilder->loaded_modules, MonoReflectionModule*, i);
-                       type = mono_reflection_get_type_internal (rootimage, mod->image, info, ignorecase, error);
-                       if (type)
-                               break;
-                       if (!mono_error_ok (error))
-                               return NULL;
-               }
-       }
-
-       return type;
-}
-       
-MonoType*
-mono_reflection_get_type_with_rootimage (MonoImage *rootimage, MonoImage* image, MonoTypeNameParse *info, gboolean ignorecase, gboolean *type_resolve, MonoError *error)
-{
-       MonoType *type;
-       MonoReflectionAssembly *assembly;
-       GString *fullName;
-       GList *mod;
-
-       mono_error_init (error);
-
-       if (image && image_is_dynamic (image))
-               type = mono_reflection_get_type_internal_dynamic (rootimage, image->assembly, info, ignorecase, error);
-       else {
-               type = mono_reflection_get_type_internal (rootimage, image, info, ignorecase, error);
-       }
-       return_val_if_nok (error, NULL);
-
-       if (type)
-               return type;
-       if (!mono_domain_has_type_resolve (mono_domain_get ()))
-               return NULL;
-
-       if (type_resolve) {
-               if (*type_resolve) 
-                       return NULL;
-               else
-                       *type_resolve = TRUE;
-       }
-       
-       /* Reconstruct the type name */
-       fullName = g_string_new ("");
-       if (info->name_space && (info->name_space [0] != '\0'))
-               g_string_printf (fullName, "%s.%s", info->name_space, info->name);
-       else
-               g_string_printf (fullName, "%s", info->name);
-       for (mod = info->nested; mod; mod = mod->next)
-               g_string_append_printf (fullName, "+%s", (char*)mod->data);
-
-       assembly = mono_domain_try_type_resolve_checked ( mono_domain_get (), fullName->str, NULL, error);
-       if (!is_ok (error)) {
-               g_string_free (fullName, TRUE);
-               return NULL;
-       }
-
-       if (assembly) {
-               if (assembly_is_dynamic (assembly->assembly))
-                       type = mono_reflection_get_type_internal_dynamic (rootimage, assembly->assembly,
-                                                                         info, ignorecase, error);
-               else
-                       type = mono_reflection_get_type_internal (rootimage, assembly->assembly->image, 
-                                                                 info, ignorecase, error);
-       }
-       g_string_free (fullName, TRUE);
-       return_val_if_nok (error, NULL);
-       return type;
-}
-
-void
-mono_reflection_free_type_info (MonoTypeNameParse *info)
-{
-       g_list_free (info->modifiers);
-       g_list_free (info->nested);
-
-       if (info->type_arguments) {
-               int i;
-
-               for (i = 0; i < info->type_arguments->len; i++) {
-                       MonoTypeNameParse *subinfo = (MonoTypeNameParse *)g_ptr_array_index (info->type_arguments, i);
-
-                       mono_reflection_free_type_info (subinfo);
-                       /*We free the subinfo since it is allocated by _mono_reflection_parse_type*/
-                       g_free (subinfo);
-               }
-
-               g_ptr_array_free (info->type_arguments, TRUE);
-       }
-}
-
-/*
- * mono_reflection_type_from_name:
- * @name: type name.
- * @image: a metadata context (can be NULL).
- *
- * Retrieves a MonoType from its @name. If the name is not fully qualified,
- * it defaults to get the type from @image or, if @image is NULL or loading
- * from it fails, uses corlib.
- * 
- */
-MonoType*
-mono_reflection_type_from_name (char *name, MonoImage *image)
-{
-       MonoError error;
-       MonoType  *result = mono_reflection_type_from_name_checked (name, image, &error);
-       mono_error_cleanup (&error);
-       return result;
-}
-
-/**
- * mono_reflection_type_from_name_checked:
- * @name: type name.
- * @image: a metadata context (can be NULL).
- * @error: set on errror.
- *
- * Retrieves a MonoType from its @name. If the name is not fully qualified,
- * it defaults to get the type from @image or, if @image is NULL or loading
- * from it fails, uses corlib.  On failure returns NULL and sets @error.
- * 
- */
-MonoType*
-mono_reflection_type_from_name_checked (char *name, MonoImage *image, MonoError *error)
-{
-       MonoType *type = NULL;
-       MonoTypeNameParse info;
-       char *tmp;
-
-       mono_error_init (error);
-       /* Make a copy since parse_type modifies its argument */
-       tmp = g_strdup (name);
-       
-       /*g_print ("requested type %s\n", str);*/
-       if (mono_reflection_parse_type (tmp, &info)) {
-               type = _mono_reflection_get_type_from_info (&info, image, FALSE, error);
-               if (!is_ok (error)) {
-                       g_free (tmp);
-                       mono_reflection_free_type_info (&info);
-                       return NULL;
-               }
-       }
-
-       g_free (tmp);
-       mono_reflection_free_type_info (&info);
-       return type;
-}
-
-/*
- * mono_reflection_get_token:
- *
- *   Return the metadata token of OBJ which should be an object
- * representing a metadata element.
- */
-guint32
-mono_reflection_get_token (MonoObject *obj)
-{
-       MonoError error;
-       guint32 result = mono_reflection_get_token_checked (obj, &error);
-       mono_error_assert_ok (&error);
-       return result;
-}
-
-/**
- * mono_reflection_get_token_checked:
- * @obj: the object
- * @error: set on error
- *
- *   Return the metadata token of @obj which should be an object
- * representing a metadata element.  On failure sets @error.
- */
-guint32
-mono_reflection_get_token_checked (MonoObject *obj, MonoError *error)
-{
-       MonoClass *klass;
-       guint32 token = 0;
-
-       mono_error_init (error);
-
-       klass = obj->vtable->klass;
-
-       if (strcmp (klass->name, "MethodBuilder") == 0) {
-               MonoReflectionMethodBuilder *mb = (MonoReflectionMethodBuilder *)obj;
-
-               token = mb->table_idx | MONO_TOKEN_METHOD_DEF;
-       } else if (strcmp (klass->name, "ConstructorBuilder") == 0) {
-               MonoReflectionCtorBuilder *mb = (MonoReflectionCtorBuilder *)obj;
-
-               token = mb->table_idx | MONO_TOKEN_METHOD_DEF;
-       } else if (strcmp (klass->name, "FieldBuilder") == 0) {
-               MonoReflectionFieldBuilder *fb = (MonoReflectionFieldBuilder *)obj;
-
-               token = fb->table_idx | MONO_TOKEN_FIELD_DEF;
-       } else if (strcmp (klass->name, "TypeBuilder") == 0) {
-               MonoReflectionTypeBuilder *tb = (MonoReflectionTypeBuilder *)obj;
-               token = tb->table_idx | MONO_TOKEN_TYPE_DEF;
-       } else if (strcmp (klass->name, "RuntimeType") == 0) {
-               MonoType *type = mono_reflection_type_get_handle ((MonoReflectionType*)obj, error);
-               return_val_if_nok (error, 0);
-               MonoClass *mc = mono_class_from_mono_type (type);
-               if (!mono_class_init (mc)) {
-                       mono_error_set_for_class_failure (error, mc);
-                       return 0;
-               }
-
-               token = mc->type_token;
-       } else if (strcmp (klass->name, "MonoCMethod") == 0 ||
-                  strcmp (klass->name, "MonoMethod") == 0 ||
-                  strcmp (klass->name, "MonoGenericMethod") == 0 ||
-                  strcmp (klass->name, "MonoGenericCMethod") == 0) {
-               MonoReflectionMethod *m = (MonoReflectionMethod *)obj;
-               if (m->method->is_inflated) {
-                       MonoMethodInflated *inflated = (MonoMethodInflated *) m->method;
-                       return inflated->declaring->token;
-               } else {
-                       token = m->method->token;
-               }
-       } else if (strcmp (klass->name, "MonoField") == 0) {
-               MonoReflectionField *f = (MonoReflectionField*)obj;
-
-               if (is_field_on_inst (f->field)) {
-                       MonoDynamicGenericClass *dgclass = (MonoDynamicGenericClass*)f->field->parent->generic_class;
-
-                       if (f->field >= dgclass->fields && f->field < dgclass->fields + dgclass->count_fields) {
-                               int field_index = f->field - dgclass->fields;
-                               MonoObject *obj;
-
-                               g_assert (field_index >= 0 && field_index < dgclass->count_fields);
-                               obj = dgclass->field_objects [field_index];
-                               return mono_reflection_get_token_checked (obj, error);
-                       }
-               }
-               token = mono_class_get_field_token (f->field);
-       } else if (strcmp (klass->name, "MonoProperty") == 0) {
-               MonoReflectionProperty *p = (MonoReflectionProperty*)obj;
-
-               token = mono_class_get_property_token (p->property);
-       } else if (strcmp (klass->name, "MonoEvent") == 0) {
-               MonoReflectionMonoEvent *p = (MonoReflectionMonoEvent*)obj;
-
-               token = mono_class_get_event_token (p->event);
-       } else if (strcmp (klass->name, "ParameterInfo") == 0 || strcmp (klass->name, "MonoParameterInfo") == 0) {
-               MonoReflectionParameter *p = (MonoReflectionParameter*)obj;
-               MonoClass *member_class = mono_object_class (p->MemberImpl);
-               g_assert (mono_class_is_reflection_method_or_constructor (member_class));
-
-               token = mono_method_get_param_token (((MonoReflectionMethod*)p->MemberImpl)->method, p->PositionImpl);
-       } else if (strcmp (klass->name, "Module") == 0 || strcmp (klass->name, "MonoModule") == 0) {
-               MonoReflectionModule *m = (MonoReflectionModule*)obj;
-
-               token = m->token;
-       } else if (strcmp (klass->name, "Assembly") == 0 || strcmp (klass->name, "MonoAssembly") == 0) {
-               token = mono_metadata_make_token (MONO_TABLE_ASSEMBLY, 1);
-       } else {
-               mono_error_set_not_implemented (error, "MetadataToken is not supported for type '%s.%s'",
-                                               klass->name_space, klass->name);
-               return 0;
-       }
-
-       return token;
-}
-
-/*
- * Load the type with name @n on behalf of image @image.  On failure sets @error and returns NULL.
- * The @is_enum flag only affects the error message that's displayed on failure.
- */
-static MonoType*
-cattr_type_from_name (char *n, MonoImage *image, gboolean is_enum, MonoError *error)
-{
-       MonoError inner_error;
-       MonoType *t = mono_reflection_type_from_name_checked (n, image, &inner_error);
-       if (!t) {
-               mono_error_set_type_load_name (error, g_strdup(n), NULL,
-                                              "Could not load %s %s while decoding custom attribute: %s",
-                                              is_enum ? "enum type": "type",
-                                              n,
-                                              mono_error_get_message (&inner_error));
-               mono_error_cleanup (&inner_error);
-               return NULL;
-       }
-       return t;
-}
-
-static MonoClass*
-load_cattr_enum_type (MonoImage *image, const char *p, const char **end, MonoError *error)
-{
-       char *n;
-       MonoType *t;
-       int slen = mono_metadata_decode_value (p, &p);
-
-       mono_error_init (error);
-
-       n = (char *)g_memdup (p, slen + 1);
-       n [slen] = 0;
-       t = cattr_type_from_name (n, image, TRUE, error);
-       g_free (n);
-       return_val_if_nok (error, NULL);
-       p += slen;
-       *end = p;
-       return mono_class_from_mono_type (t);
-}
-
-static void*
-load_cattr_value (MonoImage *image, MonoType *t, const char *p, const char **end, MonoError *error)
-{
-       int slen, type = t->type;
-       MonoClass *tklass = t->data.klass;
-
-       mono_error_init (error);
-
-handle_enum:
-       switch (type) {
-       case MONO_TYPE_U1:
-       case MONO_TYPE_I1:
-       case MONO_TYPE_BOOLEAN: {
-               MonoBoolean *bval = (MonoBoolean *)g_malloc (sizeof (MonoBoolean));
-               *bval = *p;
-               *end = p + 1;
-               return bval;
-       }
-       case MONO_TYPE_CHAR:
-       case MONO_TYPE_U2:
-       case MONO_TYPE_I2: {
-               guint16 *val = (guint16 *)g_malloc (sizeof (guint16));
-               *val = read16 (p);
-               *end = p + 2;
-               return val;
-       }
-#if SIZEOF_VOID_P == 4
-       case MONO_TYPE_U:
-       case MONO_TYPE_I:
-#endif
-       case MONO_TYPE_R4:
-       case MONO_TYPE_U4:
-       case MONO_TYPE_I4: {
-               guint32 *val = (guint32 *)g_malloc (sizeof (guint32));
-               *val = read32 (p);
-               *end = p + 4;
-               return val;
-       }
-#if SIZEOF_VOID_P == 8
-       case MONO_TYPE_U: /* error out instead? this should probably not happen */
-       case MONO_TYPE_I:
-#endif
-       case MONO_TYPE_U8:
-       case MONO_TYPE_I8: {
-               guint64 *val = (guint64 *)g_malloc (sizeof (guint64));
-               *val = read64 (p);
-               *end = p + 8;
-               return val;
-       }
-       case MONO_TYPE_R8: {
-               double *val = (double *)g_malloc (sizeof (double));
-               readr8 (p, val);
-               *end = p + 8;
-               return val;
-       }
-       case MONO_TYPE_VALUETYPE:
-               if (t->data.klass->enumtype) {
-                       type = mono_class_enum_basetype (t->data.klass)->type;
-                       goto handle_enum;
-               } else {
-                       MonoClass *k =  t->data.klass;
-                       
-                       if (mono_is_corlib_image (k->image) && strcmp (k->name_space, "System") == 0 && strcmp (k->name, "DateTime") == 0){
-                               guint64 *val = (guint64 *)g_malloc (sizeof (guint64));
-                               *val = read64 (p);
-                               *end = p + 8;
-                               return val;
-                       }
-               }
-               g_error ("generic valutype %s not handled in custom attr value decoding", t->data.klass->name);
-               break;
-               
-       case MONO_TYPE_STRING:
-               if (*p == (char)0xFF) {
-                       *end = p + 1;
-                       return NULL;
-               }
-               slen = mono_metadata_decode_value (p, &p);
-               *end = p + slen;
-               return mono_string_new_len_checked (mono_domain_get (), p, slen, error);
-       case MONO_TYPE_CLASS: {
-               MonoReflectionType *rt;
-               char *n;
-               MonoType *t;
-               if (*p == (char)0xFF) {
-                       *end = p + 1;
-                       return NULL;
-               }
-handle_type:
-               slen = mono_metadata_decode_value (p, &p);
-               n = (char *)g_memdup (p, slen + 1);
-               n [slen] = 0;
-               t = cattr_type_from_name (n, image, FALSE, error);
-               g_free (n);
-               return_val_if_nok (error, NULL);
-               *end = p + slen;
-
-               rt = mono_type_get_object_checked (mono_domain_get (), t, error);
-               if (!mono_error_ok (error))
-                       return NULL;
-
-               return rt;
-       }
-       case MONO_TYPE_OBJECT: {
-               char subt = *p++;
-               MonoObject *obj;
-               MonoClass *subc = NULL;
-               void *val;
-
-               if (subt == 0x50) {
-                       goto handle_type;
-               } else if (subt == 0x0E) {
-                       type = MONO_TYPE_STRING;
-                       goto handle_enum;
-               } else if (subt == 0x1D) {
-                       MonoType simple_type = {{0}};
-                       int etype = *p;
-                       p ++;
-
-                       type = MONO_TYPE_SZARRAY;
-                       if (etype == 0x50) {
-                               tklass = mono_defaults.systemtype_class;
-                       } else if (etype == 0x55) {
-                               tklass = load_cattr_enum_type (image, p, &p, error);
-                               if (!mono_error_ok (error))
-                                       return NULL;
-                       } else {
-                               if (etype == 0x51)
-                                       /* See Partition II, Appendix B3 */
-                                       etype = MONO_TYPE_OBJECT;
-                               simple_type.type = (MonoTypeEnum)etype;
-                               tklass = mono_class_from_mono_type (&simple_type);
-                       }
-                       goto handle_enum;
-               } else if (subt == 0x55) {
-                       char *n;
-                       MonoType *t;
-                       slen = mono_metadata_decode_value (p, &p);
-                       n = (char *)g_memdup (p, slen + 1);
-                       n [slen] = 0;
-                       t = cattr_type_from_name (n, image, FALSE, error);
-                       g_free (n);
-                       return_val_if_nok (error, NULL);
-                       p += slen;
-                       subc = mono_class_from_mono_type (t);
-               } else if (subt >= MONO_TYPE_BOOLEAN && subt <= MONO_TYPE_R8) {
-                       MonoType simple_type = {{0}};
-                       simple_type.type = (MonoTypeEnum)subt;
-                       subc = mono_class_from_mono_type (&simple_type);
-               } else {
-                       g_error ("Unknown type 0x%02x for object type encoding in custom attr", subt);
-               }
-               val = load_cattr_value (image, &subc->byval_arg, p, end, error);
-               obj = NULL;
-               if (mono_error_ok (error)) {
-                       obj = mono_object_new_checked (mono_domain_get (), subc, error);
-                       g_assert (!subc->has_references);
-                       if (mono_error_ok (error))
-                               mono_gc_memmove_atomic ((char*)obj + sizeof (MonoObject), val, mono_class_value_size (subc, NULL));
-               }
-
-               g_free (val);
-               return obj;
-       }
-       case MONO_TYPE_SZARRAY: {
-               MonoArray *arr;
-               guint32 i, alen, basetype;
-               alen = read32 (p);
-               p += 4;
-               if (alen == 0xffffffff) {
-                       *end = p;
-                       return NULL;
-               }
-               arr = mono_array_new_checked (mono_domain_get(), tklass, alen, error);
-               return_val_if_nok (error, NULL);
-               basetype = tklass->byval_arg.type;
-               if (basetype == MONO_TYPE_VALUETYPE && tklass->enumtype)
-                       basetype = mono_class_enum_basetype (tklass)->type;
-               switch (basetype)
-               {
-                       case MONO_TYPE_U1:
-                       case MONO_TYPE_I1:
-                       case MONO_TYPE_BOOLEAN:
-                               for (i = 0; i < alen; i++) {
-                                       MonoBoolean val = *p++;
-                                       mono_array_set (arr, MonoBoolean, i, val);
-                               }
-                               break;
-                       case MONO_TYPE_CHAR:
-                       case MONO_TYPE_U2:
-                       case MONO_TYPE_I2:
-                               for (i = 0; i < alen; i++) {
-                                       guint16 val = read16 (p);
-                                       mono_array_set (arr, guint16, i, val);
-                                       p += 2;
-                               }
-                               break;
-                       case MONO_TYPE_R4:
-                       case MONO_TYPE_U4:
-                       case MONO_TYPE_I4:
-                               for (i = 0; i < alen; i++) {
-                                       guint32 val = read32 (p);
-                                       mono_array_set (arr, guint32, i, val);
-                                       p += 4;
-                               }
-                               break;
-                       case MONO_TYPE_R8:
-                               for (i = 0; i < alen; i++) {
-                                       double val;
-                                       readr8 (p, &val);
-                                       mono_array_set (arr, double, i, val);
-                                       p += 8;
-                               }
-                               break;
-                       case MONO_TYPE_U8:
-                       case MONO_TYPE_I8:
-                               for (i = 0; i < alen; i++) {
-                                       guint64 val = read64 (p);
-                                       mono_array_set (arr, guint64, i, val);
-                                       p += 8;
-                               }
-                               break;
-                       case MONO_TYPE_CLASS:
-                       case MONO_TYPE_OBJECT:
-                       case MONO_TYPE_STRING:
-                       case MONO_TYPE_SZARRAY:
-                               for (i = 0; i < alen; i++) {
-                                       MonoObject *item = (MonoObject *)load_cattr_value (image, &tklass->byval_arg, p, &p, error);
-                                       if (!mono_error_ok (error))
-                                               return NULL;
-                                       mono_array_setref (arr, i, item);
-                               }
-                               break;
-                       default:
-                               g_error ("Type 0x%02x not handled in custom attr array decoding", basetype);
-               }
-               *end=p;
-               return arr;
-       }
-       default:
-               g_error ("Type 0x%02x not handled in custom attr value decoding", type);
-       }
-       return NULL;
-}
-
-static MonoObject*
-load_cattr_value_boxed (MonoDomain *domain, MonoImage *image, MonoType *t, const char* p, const char** end, MonoError *error)
-{
-       mono_error_init (error);
-
-       gboolean is_ref = type_is_reference (t);
-
-       void *val = load_cattr_value (image, t, p, end, error);
-       if (!is_ok (error)) {
-               if (is_ref)
-                       g_free (val);
-               return NULL;
-       }
-
-       if (is_ref)
-               return (MonoObject*)val;
-
-       MonoObject *boxed = mono_value_box_checked (domain, mono_class_from_mono_type (t), val, error);
-       g_free (val);
-       return boxed;
-}
-
-static MonoObject*
-create_cattr_typed_arg (MonoType *t, MonoObject *val, MonoError *error)
-{
-       static MonoMethod *ctor;
-       MonoObject *retval;
-       void *params [2], *unboxed;
-
-       mono_error_init (error);
-
-       if (!ctor)
-               ctor = mono_class_get_method_from_name (mono_class_get_custom_attribute_typed_argument_class (), ".ctor", 2);
-       
-       params [0] = mono_type_get_object_checked (mono_domain_get (), t, error);
-       return_val_if_nok (error, NULL);
-
-       params [1] = val;
-       retval = mono_object_new_checked (mono_domain_get (), mono_class_get_custom_attribute_typed_argument_class (), error);
-       return_val_if_nok (error, NULL);
-       unboxed = mono_object_unbox (retval);
-
-       mono_runtime_invoke_checked (ctor, unboxed, params, error);
-       return_val_if_nok (error, NULL);
-
-       return retval;
-}
-
-static MonoObject*
-create_cattr_named_arg (void *minfo, MonoObject *typedarg, MonoError *error)
-{
-       static MonoMethod *ctor;
-       MonoObject *retval;
-       void *unboxed, *params [2];
-
-       mono_error_init (error);
-
-       if (!ctor)
-               ctor = mono_class_get_method_from_name (mono_class_get_custom_attribute_named_argument_class (), ".ctor", 2);
-
-       params [0] = minfo;
-       params [1] = typedarg;
-       retval = mono_object_new_checked (mono_domain_get (), mono_class_get_custom_attribute_named_argument_class (), error);
-       return_val_if_nok (error, NULL);
-
-       unboxed = mono_object_unbox (retval);
-
-       mono_runtime_invoke_checked (ctor, unboxed, params, error);
-       return_val_if_nok (error, NULL);
-
-       return retval;
-}
-
-static gboolean
-type_is_reference (MonoType *type)
-{
-       switch (type->type) {
-       case MONO_TYPE_BOOLEAN:
-       case MONO_TYPE_CHAR:
-       case MONO_TYPE_U:
-       case MONO_TYPE_I:
-       case MONO_TYPE_U1:
-       case MONO_TYPE_I1:
-       case MONO_TYPE_U2:
-       case MONO_TYPE_I2:
-       case MONO_TYPE_U4:
-       case MONO_TYPE_I4:
-       case MONO_TYPE_U8:
-       case MONO_TYPE_I8:
-       case MONO_TYPE_R8:
-       case MONO_TYPE_R4:
-       case MONO_TYPE_VALUETYPE:
-               return FALSE;
-       default:
-               return TRUE;
-       }
-}
-
-static void
-free_param_data (MonoMethodSignature *sig, void **params) {
-       int i;
-       for (i = 0; i < sig->param_count; ++i) {
-               if (!type_is_reference (sig->params [i]))
-                       g_free (params [i]);
-       }
-}
-
-/*
- * Find the field index in the metadata FieldDef table.
- */
-static guint32
-find_field_index (MonoClass *klass, MonoClassField *field) {
-       int i;
-
-       for (i = 0; i < klass->field.count; ++i) {
-               if (field == &klass->fields [i])
-                       return klass->field.first + 1 + i;
-       }
-       return 0;
-}
-
-/*
- * Find the property index in the metadata Property table.
- */
-static guint32
-find_property_index (MonoClass *klass, MonoProperty *property) {
-       int i;
-
-       for (i = 0; i < klass->ext->property.count; ++i) {
-               if (property == &klass->ext->properties [i])
-                       return klass->ext->property.first + 1 + i;
-       }
-       return 0;
-}
-
-/*
- * Find the event index in the metadata Event table.
- */
-static guint32
-find_event_index (MonoClass *klass, MonoEvent *event) {
-       int i;
-
-       for (i = 0; i < klass->ext->event.count; ++i) {
-               if (event == &klass->ext->events [i])
-                       return klass->ext->event.first + 1 + i;
-       }
-       return 0;
-}
-
-static MonoObject*
-create_custom_attr (MonoImage *image, MonoMethod *method, const guchar *data, guint32 len, MonoError *error)
-{
-       const char *p = (const char*)data;
-       const char *named;
-       guint32 i, j, num_named;
-       MonoObject *attr;
-       void *params_buf [32];
-       void **params = NULL;
-       MonoMethodSignature *sig;
-
-       mono_error_init (error);
-
-       mono_class_init (method->klass);
-
-       if (!mono_verifier_verify_cattr_content (image, method, data, len, NULL)) {
-               mono_error_set_generic_error (error, "System.Reflection", "CustomAttributeFormatException", "Binary format of the specified custom attribute was invalid.");
-               return NULL;
-       }
-
-       if (len == 0) {
-               attr = mono_object_new_checked (mono_domain_get (), method->klass, error);
-               if (!mono_error_ok (error)) return NULL;
-
-               mono_runtime_invoke_checked (method, attr, NULL, error);
-               if (!mono_error_ok (error))
-                       return NULL;
-
-               return attr;
-       }
-
-       if (len < 2 || read16 (p) != 0x0001) /* Prolog */
-               return NULL;
-
-       /*g_print ("got attr %s\n", method->klass->name);*/
-
-       sig = mono_method_signature (method);
-       if (sig->param_count < 32) {
-               params = params_buf;
-               memset (params, 0, sizeof (void*) * sig->param_count);
-       } else {
-               /* Allocate using GC so it gets GC tracking */
-               params = (void **)mono_gc_alloc_fixed (sig->param_count * sizeof (void*), MONO_GC_DESCRIPTOR_NULL, MONO_ROOT_SOURCE_REFLECTION, "custom attribute parameters");
-       }
-
-       /* skip prolog */
-       p += 2;
-       for (i = 0; i < mono_method_signature (method)->param_count; ++i) {
-               params [i] = load_cattr_value (image, mono_method_signature (method)->params [i], p, &p, error);
-               if (!mono_error_ok (error))
-                       goto fail;
-       }
-
-       named = p;
-       attr = mono_object_new_checked (mono_domain_get (), method->klass, error);
-       if (!mono_error_ok (error)) goto fail;
-
-       MonoObject *exc = NULL;
-       mono_runtime_try_invoke (method, attr, params, &exc, error);
-       if (!mono_error_ok (error))
-               goto fail;
-       if (exc) {
-               mono_error_set_exception_instance (error, (MonoException*)exc);
-               goto fail;
-       }
-
-       num_named = read16 (named);
-       named += 2;
-       for (j = 0; j < num_named; j++) {
-               gint name_len;
-               char *name, named_type, data_type;
-               named_type = *named++;
-               data_type = *named++; /* type of data */
-               if (data_type == MONO_TYPE_SZARRAY)
-                       data_type = *named++;
-               if (data_type == MONO_TYPE_ENUM) {
-                       gint type_len;
-                       char *type_name;
-                       type_len = mono_metadata_decode_blob_size (named, &named);
-                       type_name = (char *)g_malloc (type_len + 1);
-                       memcpy (type_name, named, type_len);
-                       type_name [type_len] = 0;
-                       named += type_len;
-                       /* FIXME: lookup the type and check type consistency */
-                       g_free (type_name);
-               }
-               name_len = mono_metadata_decode_blob_size (named, &named);
-               name = (char *)g_malloc (name_len + 1);
-               memcpy (name, named, name_len);
-               name [name_len] = 0;
-               named += name_len;
-               if (named_type == 0x53) {
-                       MonoClassField *field;
-                       void *val;
-
-                       /* how this fail is a blackbox */
-                       field = mono_class_get_field_from_name (mono_object_class (attr), name);
-                       if (!field) {
-                               mono_error_set_generic_error (error, "System.Reflection", "CustomAttributeFormatException", "Could not find a field with name %s", name);
-                               g_free (name);
-                               goto fail;
-                       }
-
-                       val = load_cattr_value (image, field->type, named, &named, error);
-                       if (!mono_error_ok (error)) {
-                               g_free (name);
-                               if (!type_is_reference (field->type))
-                                       g_free (val);
-                               goto fail;
-                       }
-
-                       mono_field_set_value (attr, field, val);
-                       if (!type_is_reference (field->type))
-                               g_free (val);
-               } else if (named_type == 0x54) {
-                       MonoProperty *prop;
-                       void *pparams [1];
-                       MonoType *prop_type;
-
-                       prop = mono_class_get_property_from_name (mono_object_class (attr), name);
-
-                       if (!prop) {
-                               mono_error_set_generic_error (error, "System.Reflection", "CustomAttributeFormatException", "Could not find a property with name %s", name);
-                               g_free (name);
-                               goto fail;
-                       }
-
-                       if (!prop->set) {
-                               mono_error_set_generic_error (error, "System.Reflection", "CustomAttributeFormatException", "Could not find the setter for %s", name);
-                               g_free (name);
-                               goto fail;
-                       }
-
-                       /* can we have more that 1 arg in a custom attr named property? */
-                       prop_type = prop->get? mono_method_signature (prop->get)->ret :
-                            mono_method_signature (prop->set)->params [mono_method_signature (prop->set)->param_count - 1];
-
-                       pparams [0] = load_cattr_value (image, prop_type, named, &named, error);
-                       if (!mono_error_ok (error)) {
-                               g_free (name);
-                               if (!type_is_reference (prop_type))
-                                       g_free (pparams [0]);
-                               goto fail;
-                       }
-
-
-                       mono_property_set_value_checked (prop, attr, pparams, error);
-                       if (!type_is_reference (prop_type))
-                               g_free (pparams [0]);
-                       if (!is_ok (error)) {
-                               g_free (name);
-                               goto fail;
-                       }
-               }
-               g_free (name);
-       }
-
-       free_param_data (method->signature, params);
-       if (params != params_buf)
-               mono_gc_free_fixed (params);
-
-       return attr;
-
-fail:
-       free_param_data (method->signature, params);
-       if (params != params_buf)
-               mono_gc_free_fixed (params);
-       return NULL;
-}
-       
-/*
- * mono_reflection_create_custom_attr_data_args:
- *
- *   Create an array of typed and named arguments from the cattr blob given by DATA.
- * TYPED_ARGS and NAMED_ARGS will contain the objects representing the arguments,
- * NAMED_ARG_INFO will contain information about the named arguments.
- */
-void
-mono_reflection_create_custom_attr_data_args (MonoImage *image, MonoMethod *method, const guchar *data, guint32 len, MonoArray **typed_args, MonoArray **named_args, CattrNamedArg **named_arg_info, MonoError *error)
-{
-       MonoArray *typedargs, *namedargs;
-       MonoClass *attrklass;
-       MonoDomain *domain;
-       const char *p = (const char*)data;
-       const char *named;
-       guint32 i, j, num_named;
-       CattrNamedArg *arginfo = NULL;
-
-       *typed_args = NULL;
-       *named_args = NULL;
-       *named_arg_info = NULL;
-
-       mono_error_init (error);
-
-       if (!mono_verifier_verify_cattr_content (image, method, data, len, NULL)) {
-               mono_error_set_generic_error (error, "System.Reflection", "CustomAttributeFormatException", "Binary format of the specified custom attribute was invalid.");
-               return;
-       }
-
-       mono_class_init (method->klass);
-       
-       domain = mono_domain_get ();
-
-       if (len < 2 || read16 (p) != 0x0001) /* Prolog */
-               return;
-
-       typedargs = mono_array_new_checked (domain, mono_get_object_class (), mono_method_signature (method)->param_count, error);
-       return_if_nok (error);
-
-       /* skip prolog */
-       p += 2;
-       for (i = 0; i < mono_method_signature (method)->param_count; ++i) {
-               MonoObject *obj;
-
-               obj = load_cattr_value_boxed (domain, image, mono_method_signature (method)->params [i], p, &p, error);
-               return_if_nok (error);
-               mono_array_setref (typedargs, i, obj);
-       }
-
-       named = p;
-       num_named = read16 (named);
-       namedargs = mono_array_new_checked (domain, mono_get_object_class (), num_named, error);
-       return_if_nok (error);
-       named += 2;
-       attrklass = method->klass;
-
-       arginfo = g_new0 (CattrNamedArg, num_named);
-       *named_arg_info = arginfo;
-
-       for (j = 0; j < num_named; j++) {
-               gint name_len;
-               char *name, named_type, data_type;
-               named_type = *named++;
-               data_type = *named++; /* type of data */
-               if (data_type == MONO_TYPE_SZARRAY)
-                       data_type = *named++;
-               if (data_type == MONO_TYPE_ENUM) {
-                       gint type_len;
-                       char *type_name;
-                       type_len = mono_metadata_decode_blob_size (named, &named);
-                       if (ADDP_IS_GREATER_OR_OVF ((const guchar*)named, type_len, data + len))
-                               goto fail;
-
-                       type_name = (char *)g_malloc (type_len + 1);
-                       memcpy (type_name, named, type_len);
-                       type_name [type_len] = 0;
-                       named += type_len;
-                       /* FIXME: lookup the type and check type consistency */
-                       g_free (type_name);
-               }
-               name_len = mono_metadata_decode_blob_size (named, &named);
-               if (ADDP_IS_GREATER_OR_OVF ((const guchar*)named, name_len, data + len))
-                       goto fail;
-               name = (char *)g_malloc (name_len + 1);
-               memcpy (name, named, name_len);
-               name [name_len] = 0;
-               named += name_len;
-               if (named_type == 0x53) {
-                       MonoObject *obj;
-                       MonoClassField *field = mono_class_get_field_from_name (attrklass, name);
-
-                       if (!field) {
-                               g_free (name);
-                               goto fail;
-                       }
-
-                       arginfo [j].type = field->type;
-                       arginfo [j].field = field;
-
-                       obj = load_cattr_value_boxed (domain, image, field->type, named, &named, error);
-                       if (!is_ok (error)) {
-                               g_free (name);
-                               return;
-                       }
-                       mono_array_setref (namedargs, j, obj);
-
-               } else if (named_type == 0x54) {
-                       MonoObject *obj;
-                       MonoType *prop_type;
-                       MonoProperty *prop = mono_class_get_property_from_name (attrklass, name);
-
-                       if (!prop || !prop->set) {
-                               g_free (name);
-                               goto fail;
-                       }
-
-                       prop_type = prop->get? mono_method_signature (prop->get)->ret :
-                            mono_method_signature (prop->set)->params [mono_method_signature (prop->set)->param_count - 1];
-
-                       arginfo [j].type = prop_type;
-                       arginfo [j].prop = prop;
-
-                       obj = load_cattr_value_boxed (domain, image, prop_type, named, &named, error);
-                       if (!is_ok (error)) {
-                               g_free (name);
-                               return;
-                       }
-                       mono_array_setref (namedargs, j, obj);
-               }
-               g_free (name);
-       }
-
-       *typed_args = typedargs;
-       *named_args = namedargs;
-       return;
-fail:
-       mono_error_set_generic_error (error, "System.Reflection", "CustomAttributeFormatException", "Binary format of the specified custom attribute was invalid.");
-       g_free (arginfo);
-       *named_arg_info = NULL;
-}
-
-static gboolean
-reflection_resolve_custom_attribute_data (MonoReflectionMethod *ref_method, MonoReflectionAssembly *assembly, gpointer data, guint32 len, MonoArray **ctor_args, MonoArray **named_args, MonoError *error)
-{
-       MonoDomain *domain;
-       MonoArray *typedargs, *namedargs;
-       MonoImage *image;
-       MonoMethod *method;
-       CattrNamedArg *arginfo = NULL;
-       int i;
-
-       mono_error_init (error);
-
-       *ctor_args = NULL;
-       *named_args = NULL;
-
-       if (len == 0)
-               return TRUE;
-
-       image = assembly->assembly->image;
-       method = ref_method->method;
-       domain = mono_object_domain (ref_method);
-
-       if (!mono_class_init (method->klass)) {
-               mono_error_set_for_class_failure (error, method->klass);
-               goto leave;
-       }
-
-       mono_reflection_create_custom_attr_data_args (image, method, (const guchar *)data, len, &typedargs, &namedargs, &arginfo, error);
-       if (!is_ok (error))
-               goto leave;
-
-       if (!typedargs || !namedargs)
-               goto leave;
-
-       for (i = 0; i < mono_method_signature (method)->param_count; ++i) {
-               MonoObject *obj = mono_array_get (typedargs, MonoObject*, i);
-               MonoObject *typedarg;
-
-               typedarg = create_cattr_typed_arg (mono_method_signature (method)->params [i], obj, error);
-               if (!is_ok (error))
-                       goto leave;
-               mono_array_setref (typedargs, i, typedarg);
-       }
-
-       for (i = 0; i < mono_array_length (namedargs); ++i) {
-               MonoObject *obj = mono_array_get (namedargs, MonoObject*, i);
-               MonoObject *typedarg, *namedarg, *minfo;
-
-               if (arginfo [i].prop) {
-                       minfo = (MonoObject*)mono_property_get_object_checked (domain, NULL, arginfo [i].prop, error);
-                       if (!minfo)
-                               goto leave;
-               } else {
-                       minfo = (MonoObject*)mono_field_get_object_checked (domain, NULL, arginfo [i].field, error);
-                       if (!is_ok (error))
-                               goto leave;
-               }
-
-               typedarg = create_cattr_typed_arg (arginfo [i].type, obj, error);
-               if (!is_ok (error))
-                       goto leave;
-               namedarg = create_cattr_named_arg (minfo, typedarg, error);
-               if (!is_ok (error))
-                       goto leave;
-
-               mono_array_setref (namedargs, i, namedarg);
-       }
-
-       *ctor_args = typedargs;
-       *named_args = namedargs;
-
-leave:
-       g_free (arginfo);
-       return mono_error_ok (error);
-}
-
-void
-ves_icall_System_Reflection_CustomAttributeData_ResolveArgumentsInternal (MonoReflectionMethod *ref_method, MonoReflectionAssembly *assembly, gpointer data, guint32 len, MonoArray **ctor_args, MonoArray **named_args)
-{
-       MonoError error;
-       (void) reflection_resolve_custom_attribute_data (ref_method, assembly, data, len, ctor_args, named_args, &error);
-       mono_error_set_pending_exception (&error);
-}
-
-static MonoObject*
-create_custom_attr_data (MonoImage *image, MonoCustomAttrEntry *cattr, MonoError *error)
-{
-       static MonoMethod *ctor;
-
-       MonoDomain *domain;
-       MonoObject *attr;
-       void *params [4];
-
-       mono_error_init (error);
-
-       g_assert (image->assembly);
-
-       if (!ctor)
-               ctor = mono_class_get_method_from_name (mono_defaults.customattribute_data_class, ".ctor", 4);
-
-       domain = mono_domain_get ();
-       attr = mono_object_new_checked (domain, mono_defaults.customattribute_data_class, error);
-       return_val_if_nok (error, NULL);
-       params [0] = mono_method_get_object_checked (domain, cattr->ctor, NULL, error);
-       return_val_if_nok (error, NULL);
-       params [1] = mono_assembly_get_object_checked (domain, image->assembly, error);
-       return_val_if_nok (error, NULL);
-       params [2] = (gpointer)&cattr->data;
-       params [3] = &cattr->data_size;
-
-       mono_runtime_invoke_checked (ctor, attr, params, error);
-       return_val_if_nok (error, NULL);
-       return attr;
-}
-
-static MonoArray*
-mono_custom_attrs_construct_by_type (MonoCustomAttrInfo *cinfo, MonoClass *attr_klass, MonoError *error)
-{
-       MonoArray *result;
-       MonoObject *attr;
-       int i, n;
-
-       mono_error_init (error);
-
-       for (i = 0; i < cinfo->num_attrs; ++i) {
-               MonoCustomAttrEntry *centry = &cinfo->attrs[i];
-               if (!centry->ctor) {
-                       /* The cattr type is not finished yet */
-                       /* We should include the type name but cinfo doesn't contain it */
-                       mono_error_set_type_load_name (error, NULL, NULL, "Custom attribute constructor is null because the custom attribute type is not finished yet.");
-                       return NULL;
-               }
-       }
-
-       n = 0;
-       if (attr_klass) {
-               for (i = 0; i < cinfo->num_attrs; ++i) {
-                       MonoMethod *ctor = cinfo->attrs[i].ctor;
-                       g_assert (ctor);
-                       if (mono_class_is_assignable_from (attr_klass, ctor->klass))
-                               n++;
-               }
-       } else {
-               n = cinfo->num_attrs;
-       }
-
-       result = mono_array_new_cached (mono_domain_get (), mono_defaults.attribute_class, n, error);
-       return_val_if_nok (error, NULL);
-       n = 0;
-       for (i = 0; i < cinfo->num_attrs; ++i) {
-               MonoCustomAttrEntry *centry = &cinfo->attrs [i];
-               if (!attr_klass || mono_class_is_assignable_from (attr_klass, centry->ctor->klass)) {
-                       attr = create_custom_attr (cinfo->image, centry->ctor, centry->data, centry->data_size, error);
-                       if (!mono_error_ok (error))
-                               return result;
-                       mono_array_setref (result, n, attr);
-                       n ++;
-               }
-       }
-       return result;
-}
-
-MonoArray*
-mono_custom_attrs_construct (MonoCustomAttrInfo *cinfo)
-{
-       MonoError error;
-       MonoArray *result = mono_custom_attrs_construct_by_type (cinfo, NULL, &error);
-       mono_error_assert_ok (&error); /*FIXME proper error handling*/
-
-       return result;
-}
-
-static MonoArray*
-mono_custom_attrs_data_construct (MonoCustomAttrInfo *cinfo, MonoError *error)
-{
-       MonoArray *result;
-       MonoObject *attr;
-       int i;
-       
-       mono_error_init (error);
-       result = mono_array_new_checked (mono_domain_get (), mono_defaults.customattribute_data_class, cinfo->num_attrs, error);
-       return_val_if_nok (error, NULL);
-       for (i = 0; i < cinfo->num_attrs; ++i) {
-               attr = create_custom_attr_data (cinfo->image, &cinfo->attrs [i], error);
-               return_val_if_nok (error, NULL);
-               mono_array_setref (result, i, attr);
-       }
-       return result;
-}
-
-/**
- * mono_custom_attrs_from_index:
- *
- * Returns: NULL if no attributes are found or if a loading error occurs.
- */
-MonoCustomAttrInfo*
-mono_custom_attrs_from_index (MonoImage *image, guint32 idx)
-{
-       MonoError error;
-       MonoCustomAttrInfo *result = mono_custom_attrs_from_index_checked (image, idx, &error);
-       mono_error_cleanup (&error);
-       return result;
-}
-/**
- * mono_custom_attrs_from_index_checked:
- *
- * Returns: NULL if no attributes are found.  On error returns NULL and sets @error.
- */
-MonoCustomAttrInfo*
-mono_custom_attrs_from_index_checked (MonoImage *image, guint32 idx, MonoError *error)
-{
-       guint32 mtoken, i, len;
-       guint32 cols [MONO_CUSTOM_ATTR_SIZE];
-       MonoTableInfo *ca;
-       MonoCustomAttrInfo *ainfo;
-       GList *tmp, *list = NULL;
-       const char *data;
-       MonoCustomAttrEntry* attr;
-
-       mono_error_init (error);
-
-       ca = &image->tables [MONO_TABLE_CUSTOMATTRIBUTE];
-
-       i = mono_metadata_custom_attrs_from_index (image, idx);
-       if (!i)
-               return NULL;
-       i --;
-       while (i < ca->rows) {
-               if (mono_metadata_decode_row_col (ca, i, MONO_CUSTOM_ATTR_PARENT) != idx)
-                       break;
-               list = g_list_prepend (list, GUINT_TO_POINTER (i));
-               ++i;
-       }
-       len = g_list_length (list);
-       if (!len)
-               return NULL;
-       ainfo = (MonoCustomAttrInfo *)g_malloc0 (MONO_SIZEOF_CUSTOM_ATTR_INFO + sizeof (MonoCustomAttrEntry) * len);
-       ainfo->num_attrs = len;
-       ainfo->image = image;
-       for (i = len, tmp = list; i != 0; --i, tmp = tmp->next) {
-               mono_metadata_decode_row (ca, GPOINTER_TO_UINT (tmp->data), cols, MONO_CUSTOM_ATTR_SIZE);
-               mtoken = cols [MONO_CUSTOM_ATTR_TYPE] >> MONO_CUSTOM_ATTR_TYPE_BITS;
-               switch (cols [MONO_CUSTOM_ATTR_TYPE] & MONO_CUSTOM_ATTR_TYPE_MASK) {
-               case MONO_CUSTOM_ATTR_TYPE_METHODDEF:
-                       mtoken |= MONO_TOKEN_METHOD_DEF;
-                       break;
-               case MONO_CUSTOM_ATTR_TYPE_MEMBERREF:
-                       mtoken |= MONO_TOKEN_MEMBER_REF;
-                       break;
-               default:
-                       g_error ("Unknown table for custom attr type %08x", cols [MONO_CUSTOM_ATTR_TYPE]);
-                       break;
-               }
-               attr = &ainfo->attrs [i - 1];
-               attr->ctor = mono_get_method_checked (image, mtoken, NULL, NULL, error);
-               if (!attr->ctor) {
-                       g_warning ("Can't find custom attr constructor image: %s mtoken: 0x%08x due to %s", image->name, mtoken, mono_error_get_message (error));
-                       g_list_free (list);
-                       g_free (ainfo);
-                       return NULL;
-               }
-
-               if (!mono_verifier_verify_cattr_blob (image, cols [MONO_CUSTOM_ATTR_VALUE], NULL)) {
-                       /*FIXME raising an exception here doesn't make any sense*/
-                       g_warning ("Invalid custom attribute blob on image %s for index %x", image->name, idx);
-                       g_list_free (list);
-                       g_free (ainfo);
-                       return NULL;
-               }
-               data = mono_metadata_blob_heap (image, cols [MONO_CUSTOM_ATTR_VALUE]);
-               attr->data_size = mono_metadata_decode_value (data, &data);
-               attr->data = (guchar*)data;
-       }
-       g_list_free (list);
-
-       return ainfo;
-}
-
-MonoCustomAttrInfo*
-mono_custom_attrs_from_method (MonoMethod *method)
-{
-       MonoError error;
-       MonoCustomAttrInfo* result = mono_custom_attrs_from_method_checked  (method, &error);
-       mono_error_cleanup (&error); /* FIXME want a better API that doesn't swallow the error */
-       return result;
-}
-
-MonoCustomAttrInfo*
-mono_custom_attrs_from_method_checked (MonoMethod *method, MonoError *error)
-{
-       guint32 idx;
-
-       mono_error_init (error);
-
-       /*
-        * An instantiated method has the same cattrs as the generic method definition.
-        *
-        * LAMESPEC: The .NET SRE throws an exception for instantiations of generic method builders
-        *           Note that this stanza is not necessary for non-SRE types, but it's a micro-optimization
-        */
-       if (method->is_inflated)
-               method = ((MonoMethodInflated *) method)->declaring;
-       
-       if (method_is_dynamic (method) || image_is_dynamic (method->klass->image))
-               return lookup_custom_attr (method->klass->image, method);
-
-       if (!method->token)
-               /* Synthetic methods */
-               return NULL;
-
-       idx = mono_method_get_index (method);
-       idx <<= MONO_CUSTOM_ATTR_BITS;
-       idx |= MONO_CUSTOM_ATTR_METHODDEF;
-       return mono_custom_attrs_from_index_checked (method->klass->image, idx, error);
-}
-
-MonoCustomAttrInfo*
-mono_custom_attrs_from_class (MonoClass *klass)
-{
-       MonoError error;
-       MonoCustomAttrInfo *result = mono_custom_attrs_from_class_checked (klass, &error);
-       mono_error_cleanup (&error);
-       return result;
-}
-
-MonoCustomAttrInfo*
-mono_custom_attrs_from_class_checked (MonoClass *klass, MonoError *error)
-{
-       guint32 idx;
-
-       mono_error_init (error);
-
-       if (klass->generic_class)
-               klass = klass->generic_class->container_class;
-
-       if (image_is_dynamic (klass->image))
-               return lookup_custom_attr (klass->image, klass);
-
-       if (klass->byval_arg.type == MONO_TYPE_VAR || klass->byval_arg.type == MONO_TYPE_MVAR) {
-               idx = mono_metadata_token_index (klass->sizes.generic_param_token);
-               idx <<= MONO_CUSTOM_ATTR_BITS;
-               idx |= MONO_CUSTOM_ATTR_GENERICPAR;
-       } else {
-               idx = mono_metadata_token_index (klass->type_token);
-               idx <<= MONO_CUSTOM_ATTR_BITS;
-               idx |= MONO_CUSTOM_ATTR_TYPEDEF;
-       }
-       return mono_custom_attrs_from_index_checked (klass->image, idx, error);
-}
-
-MonoCustomAttrInfo*
-mono_custom_attrs_from_assembly (MonoAssembly *assembly)
-{
-       MonoError error;
-       MonoCustomAttrInfo *result = mono_custom_attrs_from_assembly_checked (assembly, &error);
-       mono_error_cleanup (&error);
-       return result;
-}
-
-MonoCustomAttrInfo*
-mono_custom_attrs_from_assembly_checked (MonoAssembly *assembly, MonoError *error)
-{
-       guint32 idx;
-       
-       mono_error_init (error);
-
-       if (image_is_dynamic (assembly->image))
-               return lookup_custom_attr (assembly->image, assembly);
-       idx = 1; /* there is only one assembly */
-       idx <<= MONO_CUSTOM_ATTR_BITS;
-       idx |= MONO_CUSTOM_ATTR_ASSEMBLY;
-       return mono_custom_attrs_from_index_checked (assembly->image, idx, error);
-}
-
-static MonoCustomAttrInfo*
-mono_custom_attrs_from_module (MonoImage *image, MonoError *error)
-{
-       guint32 idx;
-       
-       if (image_is_dynamic (image))
-               return lookup_custom_attr (image, image);
-       idx = 1; /* there is only one module */
-       idx <<= MONO_CUSTOM_ATTR_BITS;
-       idx |= MONO_CUSTOM_ATTR_MODULE;
-       return mono_custom_attrs_from_index_checked (image, idx, error);
-}
-
-MonoCustomAttrInfo*
-mono_custom_attrs_from_property (MonoClass *klass, MonoProperty *property)
-{
-       MonoError error;
-       MonoCustomAttrInfo * result = mono_custom_attrs_from_property_checked (klass, property, &error);
-       mono_error_cleanup (&error);
-       return result;
-}
-
-MonoCustomAttrInfo*
-mono_custom_attrs_from_property_checked (MonoClass *klass, MonoProperty *property, MonoError *error)
-{
-       guint32 idx;
-       
-       if (image_is_dynamic (klass->image)) {
-               property = mono_metadata_get_corresponding_property_from_generic_type_definition (property);
-               return lookup_custom_attr (klass->image, property);
-       }
-       idx = find_property_index (klass, property);
-       idx <<= MONO_CUSTOM_ATTR_BITS;
-       idx |= MONO_CUSTOM_ATTR_PROPERTY;
-       return mono_custom_attrs_from_index_checked (klass->image, idx, error);
-}
-
-MonoCustomAttrInfo*
-mono_custom_attrs_from_event (MonoClass *klass, MonoEvent *event)
-{
-       MonoError error;
-       MonoCustomAttrInfo * result = mono_custom_attrs_from_event_checked (klass, event, &error);
-       mono_error_cleanup (&error);
-       return result;
-}
-
-MonoCustomAttrInfo*
-mono_custom_attrs_from_event_checked (MonoClass *klass, MonoEvent *event, MonoError *error)
-{
-       guint32 idx;
-       
-       if (image_is_dynamic (klass->image)) {
-               event = mono_metadata_get_corresponding_event_from_generic_type_definition (event);
-               return lookup_custom_attr (klass->image, event);
-       }
-       idx = find_event_index (klass, event);
-       idx <<= MONO_CUSTOM_ATTR_BITS;
-       idx |= MONO_CUSTOM_ATTR_EVENT;
-       return mono_custom_attrs_from_index_checked (klass->image, idx, error);
-}
-
-MonoCustomAttrInfo*
-mono_custom_attrs_from_field (MonoClass *klass, MonoClassField *field)
-{
-       MonoError error;
-       MonoCustomAttrInfo * result = mono_custom_attrs_from_field_checked (klass, field, &error);
-       mono_error_cleanup (&error);
-       return result;
-}
-
-MonoCustomAttrInfo*
-mono_custom_attrs_from_field_checked (MonoClass *klass, MonoClassField *field, MonoError *error)
-{
-       guint32 idx;
-       mono_error_init (error);
-
-       if (image_is_dynamic (klass->image)) {
-               field = mono_metadata_get_corresponding_field_from_generic_type_definition (field);
-               return lookup_custom_attr (klass->image, field);
-       }
-       idx = find_field_index (klass, field);
-       idx <<= MONO_CUSTOM_ATTR_BITS;
-       idx |= MONO_CUSTOM_ATTR_FIELDDEF;
-       return mono_custom_attrs_from_index_checked (klass->image, idx, error);
-}
-
-/**
- * mono_custom_attrs_from_param:
- * @method: handle to the method that we want to retrieve custom parameter information from
- * @param: parameter number, where zero represent the return value, and one is the first parameter in the method
- *
- * The result must be released with mono_custom_attrs_free().
- *
- * Returns: the custom attribute object for the specified parameter, or NULL if there are none.
- */
-MonoCustomAttrInfo*
-mono_custom_attrs_from_param (MonoMethod *method, guint32 param)
-{
-       MonoError error;
-       MonoCustomAttrInfo *result = mono_custom_attrs_from_param_checked (method, param, &error);
-       mono_error_cleanup (&error);
-       return result;
-}
-
-/**
- * mono_custom_attrs_from_param_checked:
- * @method: handle to the method that we want to retrieve custom parameter information from
- * @param: parameter number, where zero represent the return value, and one is the first parameter in the method
- * @error: set on error
- *
- * The result must be released with mono_custom_attrs_free().
- *
- * Returns: the custom attribute object for the specified parameter, or NULL if there are none.  On failure returns NULL and sets @error.
- */
-MonoCustomAttrInfo*
-mono_custom_attrs_from_param_checked (MonoMethod *method, guint32 param, MonoError *error)
-{
-       MonoTableInfo *ca;
-       guint32 i, idx, method_index;
-       guint32 param_list, param_last, param_pos, found;
-       MonoImage *image;
-       MonoReflectionMethodAux *aux;
-
-       mono_error_init (error);
-
-       /*
-        * An instantiated method has the same cattrs as the generic method definition.
-        *
-        * LAMESPEC: The .NET SRE throws an exception for instantiations of generic method builders
-        *           Note that this stanza is not necessary for non-SRE types, but it's a micro-optimization
-        */
-       if (method->is_inflated)
-               method = ((MonoMethodInflated *) method)->declaring;
-
-       if (image_is_dynamic (method->klass->image)) {
-               MonoCustomAttrInfo *res, *ainfo;
-               int size;
-
-               aux = (MonoReflectionMethodAux *)g_hash_table_lookup (((MonoDynamicImage*)method->klass->image)->method_aux_hash, method);
-               if (!aux || !aux->param_cattr)
-                       return NULL;
-
-               /* Need to copy since it will be freed later */
-               ainfo = aux->param_cattr [param];
-               if (!ainfo)
-                       return NULL;
-               size = MONO_SIZEOF_CUSTOM_ATTR_INFO + sizeof (MonoCustomAttrEntry) * ainfo->num_attrs;
-               res = (MonoCustomAttrInfo *)g_malloc0 (size);
-               memcpy (res, ainfo, size);
-               return res;
-       }
-
-       image = method->klass->image;
-       method_index = mono_method_get_index (method);
-       if (!method_index)
-               return NULL;
-       ca = &image->tables [MONO_TABLE_METHOD];
-
-       param_list = mono_metadata_decode_row_col (ca, method_index - 1, MONO_METHOD_PARAMLIST);
-       if (method_index == ca->rows) {
-               ca = &image->tables [MONO_TABLE_PARAM];
-               param_last = ca->rows + 1;
-       } else {
-               param_last = mono_metadata_decode_row_col (ca, method_index, MONO_METHOD_PARAMLIST);
-               ca = &image->tables [MONO_TABLE_PARAM];
-       }
-       found = FALSE;
-       for (i = param_list; i < param_last; ++i) {
-               param_pos = mono_metadata_decode_row_col (ca, i - 1, MONO_PARAM_SEQUENCE);
-               if (param_pos == param) {
-                       found = TRUE;
-                       break;
-               }
-       }
-       if (!found)
-               return NULL;
-       idx = i;
-       idx <<= MONO_CUSTOM_ATTR_BITS;
-       idx |= MONO_CUSTOM_ATTR_PARAMDEF;
-       return mono_custom_attrs_from_index_checked (image, idx, error);
-}
-
-gboolean
-mono_custom_attrs_has_attr (MonoCustomAttrInfo *ainfo, MonoClass *attr_klass)
-{
-       int i;
-       for (i = 0; i < ainfo->num_attrs; ++i) {
-               MonoClass *klass = ainfo->attrs [i].ctor->klass;
-               if (mono_class_has_parent (klass, attr_klass) || (MONO_CLASS_IS_INTERFACE (attr_klass) && mono_class_is_assignable_from (attr_klass, klass)))
-                       return TRUE;
-       }
-       return FALSE;
-}
-
-MonoObject*
-mono_custom_attrs_get_attr (MonoCustomAttrInfo *ainfo, MonoClass *attr_klass)
-{
-       MonoError error;
-       MonoObject *res = mono_custom_attrs_get_attr_checked (ainfo, attr_klass, &error);
-       mono_error_assert_ok (&error); /*FIXME proper error handling*/
-       return res;
-}
-
-MonoObject*
-mono_custom_attrs_get_attr_checked (MonoCustomAttrInfo *ainfo, MonoClass *attr_klass, MonoError *error)
-{
-       int i, attr_index;
-       MonoArray *attrs;
-
-       mono_error_init (error);
-
-       attr_index = -1;
-       for (i = 0; i < ainfo->num_attrs; ++i) {
-               MonoClass *klass = ainfo->attrs [i].ctor->klass;
-               if (mono_class_has_parent (klass, attr_klass)) {
-                       attr_index = i;
-                       break;
-               }
-       }
-       if (attr_index == -1)
-               return NULL;
-
-       attrs = mono_custom_attrs_construct_by_type (ainfo, NULL, error);
-       if (!mono_error_ok (error))
-               return NULL;
-       return mono_array_get (attrs, MonoObject*, attr_index);
-}
-
-/*
- * mono_reflection_get_custom_attrs_info:
- * @obj: a reflection object handle
- *
- * Return the custom attribute info for attributes defined for the
- * reflection handle @obj. The objects.
- *
- * FIXME this function leaks like a sieve for SRE objects.
- */
-MonoCustomAttrInfo*
-mono_reflection_get_custom_attrs_info (MonoObject *obj)
-{
-       MonoError error;
-       MonoCustomAttrInfo *result = mono_reflection_get_custom_attrs_info_checked (obj, &error);
-       mono_error_assert_ok (&error);
-       return result;
-}
-
-/**
- * mono_reflection_get_custom_attrs_info_checked:
- * @obj: a reflection object handle
- * @error: set on error
- *
- * Return the custom attribute info for attributes defined for the
- * reflection handle @obj. The objects.
- *
- * On failure returns NULL and sets @error.
- *
- * FIXME this function leaks like a sieve for SRE objects.
- */
-MonoCustomAttrInfo*
-mono_reflection_get_custom_attrs_info_checked (MonoObject *obj, MonoError *error)
-{
-       MonoClass *klass;
-       MonoCustomAttrInfo *cinfo = NULL;
-       
-       mono_error_init (error);
-
-       klass = obj->vtable->klass;
-       if (klass == mono_defaults.runtimetype_class) {
-               MonoType *type = mono_reflection_type_get_handle ((MonoReflectionType *)obj, error);
-               return_val_if_nok (error, NULL);
-               klass = mono_class_from_mono_type (type);
-               /*We cannot mono_class_init the class from which we'll load the custom attributes since this must work with broken types.*/
-               cinfo = mono_custom_attrs_from_class_checked (klass, error);
-               return_val_if_nok (error, NULL);
-       } else if (strcmp ("Assembly", klass->name) == 0 || strcmp ("MonoAssembly", klass->name) == 0) {
-               MonoReflectionAssembly *rassembly = (MonoReflectionAssembly*)obj;
-               cinfo = mono_custom_attrs_from_assembly_checked (rassembly->assembly, error);
-               return_val_if_nok (error, NULL);
-       } else if (strcmp ("Module", klass->name) == 0 || strcmp ("MonoModule", klass->name) == 0) {
-               MonoReflectionModule *module = (MonoReflectionModule*)obj;
-               cinfo = mono_custom_attrs_from_module (module->image, error);
-               return_val_if_nok (error, NULL);
-       } else if (strcmp ("MonoProperty", klass->name) == 0) {
-               MonoReflectionProperty *rprop = (MonoReflectionProperty*)obj;
-               cinfo = mono_custom_attrs_from_property_checked (rprop->property->parent, rprop->property, error);
-               return_val_if_nok (error, NULL);
-       } else if (strcmp ("MonoEvent", klass->name) == 0) {
-               MonoReflectionMonoEvent *revent = (MonoReflectionMonoEvent*)obj;
-               cinfo = mono_custom_attrs_from_event_checked (revent->event->parent, revent->event, error);
-               return_val_if_nok (error, NULL);
-       } else if (strcmp ("MonoField", klass->name) == 0) {
-               MonoReflectionField *rfield = (MonoReflectionField*)obj;
-               cinfo = mono_custom_attrs_from_field_checked (rfield->field->parent, rfield->field, error);
-               return_val_if_nok (error, NULL);
-       } else if ((strcmp ("MonoMethod", klass->name) == 0) || (strcmp ("MonoCMethod", klass->name) == 0)) {
-               MonoReflectionMethod *rmethod = (MonoReflectionMethod*)obj;
-               cinfo = mono_custom_attrs_from_method_checked (rmethod->method, error);
-               return_val_if_nok (error, NULL);
-       } else if ((strcmp ("MonoGenericMethod", klass->name) == 0) || (strcmp ("MonoGenericCMethod", klass->name) == 0)) {
-               MonoReflectionMethod *rmethod = (MonoReflectionMethod*)obj;
-               cinfo = mono_custom_attrs_from_method_checked (rmethod->method, error);
-               return_val_if_nok (error, NULL);
-       } else if (strcmp ("ParameterInfo", klass->name) == 0 || strcmp ("MonoParameterInfo", klass->name) == 0) {
-               MonoReflectionParameter *param = (MonoReflectionParameter*)obj;
-               MonoClass *member_class = mono_object_class (param->MemberImpl);
-               if (mono_class_is_reflection_method_or_constructor (member_class)) {
-                       MonoReflectionMethod *rmethod = (MonoReflectionMethod*)param->MemberImpl;
-                       cinfo = mono_custom_attrs_from_param_checked (rmethod->method, param->PositionImpl + 1, error);
-                       return_val_if_nok (error, NULL);
-               } else if (is_sr_mono_property (member_class)) {
-                       MonoReflectionProperty *prop = (MonoReflectionProperty *)param->MemberImpl;
-                       MonoMethod *method;
-                       if (!(method = prop->property->get))
-                               method = prop->property->set;
-                       g_assert (method);
-
-                       cinfo = mono_custom_attrs_from_param_checked (method, param->PositionImpl + 1, error);
-                       return_val_if_nok (error, NULL);
-               } 
-#ifndef DISABLE_REFLECTION_EMIT
-               else if (is_sre_method_on_tb_inst (member_class)) {/*XXX This is a workaround for Compiler Context*/
-                       MonoMethod *method = mono_reflection_method_on_tb_inst_get_handle ((MonoReflectionMethodOnTypeBuilderInst*)param->MemberImpl, error);
-                       return_val_if_nok (error, NULL);
-                       cinfo = mono_custom_attrs_from_param_checked (method, param->PositionImpl + 1, error);
-                       return_val_if_nok (error, NULL);
-               } else if (is_sre_ctor_on_tb_inst (member_class)) { /*XX This is a workaround for Compiler Context*/
-                       MonoReflectionCtorOnTypeBuilderInst *c = (MonoReflectionCtorOnTypeBuilderInst*)param->MemberImpl;
-                       MonoMethod *method = NULL;
-                       if (is_sre_ctor_builder (mono_object_class (c->cb)))
-                               method = ((MonoReflectionCtorBuilder *)c->cb)->mhandle;
-                       else if (is_sr_mono_cmethod (mono_object_class (c->cb)))
-                               method = ((MonoReflectionMethod *)c->cb)->method;
-                       else
-                               g_error ("mono_reflection_get_custom_attrs_info:: can't handle a CTBI with base_method of type %s", mono_type_get_full_name (member_class));
-
-                       cinfo = mono_custom_attrs_from_param_checked (method, param->PositionImpl + 1, error);
-                       return_val_if_nok (error, NULL);
-               } 
-#endif
-               else {
-                       char *type_name = mono_type_get_full_name (member_class);
-                       mono_error_set_not_supported (error,
-                                                     "Custom attributes on a ParamInfo with member %s are not supported",
-                                                     type_name);
-                       g_free (type_name);
-                       return NULL;
-               }
-       } else if (strcmp ("AssemblyBuilder", klass->name) == 0) {
-               MonoReflectionAssemblyBuilder *assemblyb = (MonoReflectionAssemblyBuilder*)obj;
-               cinfo = mono_custom_attrs_from_builders (NULL, assemblyb->assembly.assembly->image, assemblyb->cattrs);
-       } else if (strcmp ("TypeBuilder", klass->name) == 0) {
-               MonoReflectionTypeBuilder *tb = (MonoReflectionTypeBuilder*)obj;
-               cinfo = mono_custom_attrs_from_builders (NULL, &tb->module->dynamic_image->image, tb->cattrs);
-       } else if (strcmp ("ModuleBuilder", klass->name) == 0) {
-               MonoReflectionModuleBuilder *mb = (MonoReflectionModuleBuilder*)obj;
-               cinfo = mono_custom_attrs_from_builders (NULL, &mb->dynamic_image->image, mb->cattrs);
-       } else if (strcmp ("ConstructorBuilder", klass->name) == 0) {
-               MonoReflectionCtorBuilder *cb = (MonoReflectionCtorBuilder*)obj;
-               cinfo = mono_custom_attrs_from_builders (NULL, cb->mhandle->klass->image, cb->cattrs);
-       } else if (strcmp ("MethodBuilder", klass->name) == 0) {
-               MonoReflectionMethodBuilder *mb = (MonoReflectionMethodBuilder*)obj;
-               cinfo = mono_custom_attrs_from_builders (NULL, mb->mhandle->klass->image, mb->cattrs);
-       } else if (strcmp ("FieldBuilder", klass->name) == 0) {
-               MonoReflectionFieldBuilder *fb = (MonoReflectionFieldBuilder*)obj;
-               cinfo = mono_custom_attrs_from_builders (NULL, &((MonoReflectionTypeBuilder*)fb->typeb)->module->dynamic_image->image, fb->cattrs);
-       } else if (strcmp ("MonoGenericClass", klass->name) == 0) {
-               MonoReflectionGenericClass *gclass = (MonoReflectionGenericClass*)obj;
-               cinfo = mono_reflection_get_custom_attrs_info_checked ((MonoObject*)gclass->generic_type, error);
-               return_val_if_nok (error, NULL);
-       } else { /* handle other types here... */
-               g_error ("get custom attrs not yet supported for %s", klass->name);
-       }
-
-       return cinfo;
-}
-
-/*
- * mono_reflection_get_custom_attrs_by_type:
- * @obj: a reflection object handle
- *
- * Return an array with all the custom attributes defined of the
- * reflection handle @obj. If @attr_klass is non-NULL, only custom attributes 
- * of that type are returned. The objects are fully build. Return NULL if a loading error
- * occurs.
- */
-MonoArray*
-mono_reflection_get_custom_attrs_by_type (MonoObject *obj, MonoClass *attr_klass, MonoError *error)
-{
-       MonoArray *result;
-       MonoCustomAttrInfo *cinfo;
-
-       mono_error_init (error);
-
-       cinfo = mono_reflection_get_custom_attrs_info_checked (obj, error);
-       return_val_if_nok (error, NULL);
-       if (cinfo) {
-               result = mono_custom_attrs_construct_by_type (cinfo, attr_klass, error);
-               if (!cinfo->cached)
-                       mono_custom_attrs_free (cinfo);
-               if (!result)
-                       return NULL;
-       } else {
-               result = mono_array_new_cached (mono_domain_get (), mono_defaults.attribute_class, 0, error);
-       }
-
-       return result;
-}
-
-/*
- * mono_reflection_get_custom_attrs:
- * @obj: a reflection object handle
- *
- * Return an array with all the custom attributes defined of the
- * reflection handle @obj. The objects are fully build. Return NULL if a loading error
- * occurs.
- */
-MonoArray*
-mono_reflection_get_custom_attrs (MonoObject *obj)
-{
-       MonoError error;
-
-       return mono_reflection_get_custom_attrs_by_type (obj, NULL, &error);
-}
-
-/*
- * mono_reflection_get_custom_attrs_data:
- * @obj: a reflection obj handle
- *
- * Returns an array of System.Reflection.CustomAttributeData,
- * which include information about attributes reflected on
- * types loaded using the Reflection Only methods
- */
-MonoArray*
-mono_reflection_get_custom_attrs_data (MonoObject *obj)
-{
-       MonoError error;
-       MonoArray* result;
-       result = mono_reflection_get_custom_attrs_data_checked (obj, &error);
-       mono_error_cleanup (&error);
-       return result;
-}
-
-/*
- * mono_reflection_get_custom_attrs_data_checked:
- * @obj: a reflection obj handle
- * @error: set on error
- *
- * Returns an array of System.Reflection.CustomAttributeData,
- * which include information about attributes reflected on
- * types loaded using the Reflection Only methods
- */
-MonoArray*
-mono_reflection_get_custom_attrs_data_checked (MonoObject *obj, MonoError *error)
-{
-       MonoArray *result;
-       MonoCustomAttrInfo *cinfo;
-
-       mono_error_init (error);
-
-       cinfo = mono_reflection_get_custom_attrs_info_checked (obj, error);
-       return_val_if_nok (error, NULL);
-       if (cinfo) {
-               result = mono_custom_attrs_data_construct (cinfo, error);
-               if (!cinfo->cached)
-                       mono_custom_attrs_free (cinfo);
-               return_val_if_nok (error, NULL);
-       } else 
-               result = mono_array_new_checked (mono_domain_get (), mono_defaults.customattribute_data_class, 0, error);
-
-       return result;
-}
-
-static MonoReflectionType*
-mono_reflection_type_get_underlying_system_type (MonoReflectionType* t, MonoError *error)
-{
-       static MonoMethod *method_get_underlying_system_type = NULL;
-       MonoReflectionType *rt;
-       MonoMethod *usertype_method;
-
-       mono_error_init (error);
-
-       if (!method_get_underlying_system_type)
-               method_get_underlying_system_type = mono_class_get_method_from_name (mono_defaults.systemtype_class, "get_UnderlyingSystemType", 0);
-
-       usertype_method = mono_object_get_virtual_method ((MonoObject *) t, method_get_underlying_system_type);
-
-       rt = (MonoReflectionType *) mono_runtime_invoke_checked (usertype_method, t, NULL, error);
-
-       return rt;
-}
-
-
-static gboolean
-is_corlib_type (MonoClass *klass)
-{
-       return klass->image == mono_defaults.corlib;
-}
-
-#define check_corlib_type_cached(_class, _namespace, _name) do { \
-       static MonoClass *cached_class; \
-       if (cached_class) \
-               return cached_class == _class; \
-       if (is_corlib_type (_class) && !strcmp (_name, _class->name) && !strcmp (_namespace, _class->name_space)) { \
-               cached_class = _class; \
-               return TRUE; \
-       } \
-       return FALSE; \
-} while (0) \
-
-
-#ifndef DISABLE_REFLECTION_EMIT
-static gboolean
-is_sre_array (MonoClass *klass)
-{
-       check_corlib_type_cached (klass, "System.Reflection.Emit", "ArrayType");
-}
-
-static gboolean
-is_sre_byref (MonoClass *klass)
-{
-       check_corlib_type_cached (klass, "System.Reflection.Emit", "ByRefType");
-}
-
-static gboolean
-is_sre_pointer (MonoClass *klass)
-{
-       check_corlib_type_cached (klass, "System.Reflection.Emit", "PointerType");
-}
-
-static gboolean
-is_sre_generic_instance (MonoClass *klass)
-{
-       check_corlib_type_cached (klass, "System.Reflection", "MonoGenericClass");
-}
-
-static gboolean
-is_sre_type_builder (MonoClass *klass)
-{
-       check_corlib_type_cached (klass, "System.Reflection.Emit", "TypeBuilder");
-}
-
-static gboolean
-is_sre_method_builder (MonoClass *klass)
-{
-       check_corlib_type_cached (klass, "System.Reflection.Emit", "MethodBuilder");
-}
-
-static gboolean
-is_sre_ctor_builder (MonoClass *klass)
-{
-       check_corlib_type_cached (klass, "System.Reflection.Emit", "ConstructorBuilder");
-}
-
-static gboolean
-is_sre_field_builder (MonoClass *klass)
-{
-       check_corlib_type_cached (klass, "System.Reflection.Emit", "FieldBuilder");
-}
-
-static gboolean
-is_sre_method_on_tb_inst (MonoClass *klass)
-{
-       check_corlib_type_cached (klass, "System.Reflection.Emit", "MethodOnTypeBuilderInst");
-}
-
-static gboolean
-is_sre_ctor_on_tb_inst (MonoClass *klass)
-{
-       check_corlib_type_cached (klass, "System.Reflection.Emit", "ConstructorOnTypeBuilderInst");
-}
-
-MonoType*
-mono_reflection_type_get_handle (MonoReflectionType* ref, MonoError *error)
-{
-       MonoClass *klass;
-       mono_error_init (error);
-
-       if (!ref)
-               return NULL;
-       if (ref->type)
-               return ref->type;
-
-       if (is_usertype (ref)) {
-               ref = mono_reflection_type_get_underlying_system_type (ref, error);
-               if (ref == NULL || is_usertype (ref) || !is_ok (error))
-                       return NULL;
-               if (ref->type)
-                       return ref->type;
-       }
-
-       klass = mono_object_class (ref);
-
-       if (is_sre_array (klass)) {
-               MonoType *res;
-               MonoReflectionArrayType *sre_array = (MonoReflectionArrayType*)ref;
-               MonoType *base = mono_reflection_type_get_handle (sre_array->element_type, error);
-               return_val_if_nok (error, NULL);
-               g_assert (base);
-               if (sre_array->rank == 0) //single dimentional array
-                       res = &mono_array_class_get (mono_class_from_mono_type (base), 1)->byval_arg;
-               else
-                       res = &mono_bounded_array_class_get (mono_class_from_mono_type (base), sre_array->rank, TRUE)->byval_arg;
-               sre_array->type.type = res;
-               return res;
-       } else if (is_sre_byref (klass)) {
-               MonoType *res;
-               MonoReflectionDerivedType *sre_byref = (MonoReflectionDerivedType*)ref;
-               MonoType *base = mono_reflection_type_get_handle (sre_byref->element_type, error);
-               return_val_if_nok (error, NULL);
-               g_assert (base);
-               res = &mono_class_from_mono_type (base)->this_arg;
-               sre_byref->type.type = res;
-               return res;
-       } else if (is_sre_pointer (klass)) {
-               MonoType *res;
-               MonoReflectionDerivedType *sre_pointer = (MonoReflectionDerivedType*)ref;
-               MonoType *base = mono_reflection_type_get_handle (sre_pointer->element_type, error);
-               return_val_if_nok (error, NULL);
-               g_assert (base);
-               res = &mono_ptr_class_get (base)->byval_arg;
-               sre_pointer->type.type = res;
-               return res;
-       } else if (is_sre_generic_instance (klass)) {
-               MonoType *res, **types;
-               MonoReflectionGenericClass *gclass = (MonoReflectionGenericClass*)ref;
-               int i, count;
-
-               count = mono_array_length (gclass->type_arguments);
-               types = g_new0 (MonoType*, count);
-               for (i = 0; i < count; ++i) {
-                       MonoReflectionType *t = (MonoReflectionType *)mono_array_get (gclass->type_arguments, gpointer, i);
-                       types [i] = mono_reflection_type_get_handle (t, error);
-                       if (!types[i] || !is_ok (error)) {
-                               g_free (types);
-                               return NULL;
-                       }
-               }
-
-               res = mono_reflection_bind_generic_parameters (gclass->generic_type, count, types, error);
-               g_free (types);
-               g_assert (res);
-               gclass->type.type = res;
-               return res;
-       }
-
-       g_error ("Cannot handle corlib user type %s", mono_type_full_name (&mono_object_class(ref)->byval_arg));
-       return NULL;
-}
-
-void
-ves_icall_SymbolType_create_unmanaged_type (MonoReflectionType *type)
-{
-       MonoError error;
-       mono_reflection_type_get_handle (type, &error);
-       mono_error_set_pending_exception (&error);
-}
-
-static gboolean
-reflection_register_with_runtime (MonoReflectionType *type, MonoError *error)
-{
-       MonoDomain *domain = mono_object_domain ((MonoObject*)type);
-       MonoClass *klass;
-
-       mono_error_init (error);
-
-       MonoType *res = mono_reflection_type_get_handle (type, error);
-
-       if (!res && is_ok (error)) {
-               mono_error_set_argument (error, NULL, "Invalid generic instantiation, one or more arguments are not proper user types");
-       }
-       return_val_if_nok (error, FALSE);
-
-       klass = mono_class_from_mono_type (res);
-
-       mono_loader_lock (); /*same locking as mono_type_get_object_checked */
-       mono_domain_lock (domain);
-
-       if (!image_is_dynamic (klass->image)) {
-               mono_class_setup_supertypes (klass);
-       } else {
-               if (!domain->type_hash)
-                       domain->type_hash = mono_g_hash_table_new_type ((GHashFunc)mono_metadata_type_hash, 
-                                       (GCompareFunc)mono_metadata_type_equal, MONO_HASH_VALUE_GC, MONO_ROOT_SOURCE_DOMAIN, "domain reflection types table");
-               mono_g_hash_table_insert (domain->type_hash, res, type);
-       }
-       mono_domain_unlock (domain);
-       mono_loader_unlock ();
-
-       return TRUE;
-}
-
-void
-mono_reflection_register_with_runtime (MonoReflectionType *type)
-{
-       MonoError error;
-       (void) reflection_register_with_runtime (type, &error);
-       mono_error_set_pending_exception (&error);
-}
-
-/**
- * LOCKING: Assumes the loader lock is held.
- */
-static MonoMethodSignature*
-parameters_to_signature (MonoImage *image, MonoArray *parameters, MonoError *error) {
-       MonoMethodSignature *sig;
-       int count, i;
-
-       mono_error_init (error);
-
-       count = parameters? mono_array_length (parameters): 0;
-
-       sig = (MonoMethodSignature *)image_g_malloc0 (image, MONO_SIZEOF_METHOD_SIGNATURE + sizeof (MonoType*) * count);
-       sig->param_count = count;
-       sig->sentinelpos = -1; /* FIXME */
-       for (i = 0; i < count; ++i) {
-               sig->params [i] = mono_type_array_get_and_resolve (parameters, i, error);
-               if (!is_ok (error)) {
-                       image_g_free (image, sig);
-                       return NULL;
-               }
-       }
-       return sig;
-}
-
-/**
- * LOCKING: Assumes the loader lock is held.
- */
-static MonoMethodSignature*
-ctor_builder_to_signature (MonoImage *image, MonoReflectionCtorBuilder *ctor, MonoError *error) {
-       MonoMethodSignature *sig;
-
-       mono_error_init (error);
-
-       sig = parameters_to_signature (image, ctor->parameters, error);
-       return_val_if_nok (error, NULL);
-       sig->hasthis = ctor->attrs & METHOD_ATTRIBUTE_STATIC? 0: 1;
-       sig->ret = &mono_defaults.void_class->byval_arg;
-       return sig;
-}
-
-/**
- * LOCKING: Assumes the loader lock is held.
- */
-static MonoMethodSignature*
-method_builder_to_signature (MonoImage *image, MonoReflectionMethodBuilder *method, MonoError *error) {
-       MonoMethodSignature *sig;
-
-       mono_error_init (error);
-
-       sig = parameters_to_signature (image, method->parameters, error);
-       return_val_if_nok (error, NULL);
-       sig->hasthis = method->attrs & METHOD_ATTRIBUTE_STATIC? 0: 1;
-       if (method->rtype) {
-               sig->ret = mono_reflection_type_get_handle ((MonoReflectionType*)method->rtype, error);
-               if (!is_ok (error)) {
-                       image_g_free (image, sig);
-                       return NULL;
-               }
-       } else {
-               sig->ret = &mono_defaults.void_class->byval_arg;
-       }
-       sig->generic_param_count = method->generic_params ? mono_array_length (method->generic_params) : 0;
-       return sig;
-}
-
-static MonoMethodSignature*
-dynamic_method_to_signature (MonoReflectionDynamicMethod *method, MonoError *error) {
-       MonoMethodSignature *sig;
-
-       mono_error_init (error);
-
-       sig = parameters_to_signature (NULL, method->parameters, error);
-       return_val_if_nok (error, NULL);
-       sig->hasthis = method->attrs & METHOD_ATTRIBUTE_STATIC? 0: 1;
-       if (method->rtype) {
-               sig->ret = mono_reflection_type_get_handle (method->rtype, error);
-               if (!is_ok (error)) {
-                       g_free (sig);
-                       return NULL;
-               }
-       } else {
-               sig->ret = &mono_defaults.void_class->byval_arg;
-       }
-       sig->generic_param_count = 0;
-       return sig;
-}
-
-static void
-get_prop_name_and_type (MonoObject *prop, char **name, MonoType **type, MonoError *error)
-{
-       mono_error_init (error);
-       MonoClass *klass = mono_object_class (prop);
-       if (strcmp (klass->name, "PropertyBuilder") == 0) {
-               MonoReflectionPropertyBuilder *pb = (MonoReflectionPropertyBuilder *)prop;
-               *name = mono_string_to_utf8_checked (pb->name, error);
-               return_if_nok (error);
-               *type = mono_reflection_type_get_handle ((MonoReflectionType*)pb->type, error);
-       } else {
-               MonoReflectionProperty *p = (MonoReflectionProperty *)prop;
-               *name = g_strdup (p->property->name);
-               if (p->property->get)
-                       *type = mono_method_signature (p->property->get)->ret;
-               else
-                       *type = mono_method_signature (p->property->set)->params [mono_method_signature (p->property->set)->param_count - 1];
-       }
-}
-
-static void
-get_field_name_and_type (MonoObject *field, char **name, MonoType **type, MonoError *error)
-{
-       mono_error_init (error);
-       MonoClass *klass = mono_object_class (field);
-       if (strcmp (klass->name, "FieldBuilder") == 0) {
-               MonoReflectionFieldBuilder *fb = (MonoReflectionFieldBuilder *)field;
-               *name = mono_string_to_utf8_checked (fb->name, error);
-               return_if_nok (error);
-               *type = mono_reflection_type_get_handle ((MonoReflectionType*)fb->type, error);
-       } else {
-               MonoReflectionField *f = (MonoReflectionField *)field;
-               *name = g_strdup (mono_field_get_name (f->field));
-               *type = f->field->type;
-       }
-}
-
-#else /* DISABLE_REFLECTION_EMIT */
-
-void
-mono_reflection_register_with_runtime (MonoReflectionType *type)
-{
-       /* This is empty */
-}
-
-static gboolean
-is_sre_type_builder (MonoClass *klass)
-{
-       return FALSE;
-}
-
-static gboolean
-is_sre_generic_instance (MonoClass *klass)
-{
-       return FALSE;
-}
-
-static void
-init_type_builder_generics (MonoObject *type, MonoError *error)
-{
-       mono_error_init (error);
-}
-
-#endif /* !DISABLE_REFLECTION_EMIT */
-
-
-static gboolean
-is_sr_mono_field (MonoClass *klass)
-{
-       check_corlib_type_cached (klass, "System.Reflection", "MonoField");
-}
-
-static gboolean
-is_sr_mono_property (MonoClass *klass)
-{
-       check_corlib_type_cached (klass, "System.Reflection", "MonoProperty");
-}
-
-static gboolean
-is_sr_mono_method (MonoClass *klass)
-{
-       check_corlib_type_cached (klass, "System.Reflection", "MonoMethod");
-}
-
-static gboolean
-is_sr_mono_cmethod (MonoClass *klass)
-{
-       check_corlib_type_cached (klass, "System.Reflection", "MonoCMethod");
-}
-
-static gboolean
-is_sr_mono_generic_method (MonoClass *klass)
-{
-       check_corlib_type_cached (klass, "System.Reflection", "MonoGenericMethod");
-}
-
-static gboolean
-is_sr_mono_generic_cmethod (MonoClass *klass)
-{
-       check_corlib_type_cached (klass, "System.Reflection", "MonoGenericCMethod");
-}
-
-gboolean
-mono_class_is_reflection_method_or_constructor (MonoClass *klass)
-{
-       return is_sr_mono_method (klass) || is_sr_mono_cmethod (klass) || is_sr_mono_generic_method (klass) || is_sr_mono_generic_cmethod (klass);
-}
-
-static gboolean
-is_usertype (MonoReflectionType *ref)
-{
-       MonoClass *klass = mono_object_class (ref);
-       return klass->image != mono_defaults.corlib || strcmp ("TypeDelegator", klass->name) == 0;
-}
-
-static inline MonoBoolean
-is_generic_parameter (MonoType *type)
-{
-       return !type->byref && (type->type == MONO_TYPE_VAR || type->type == MONO_TYPE_MVAR);
-}
-
-static MonoReflectionType*
-mono_reflection_type_resolve_user_types (MonoReflectionType *type, MonoError *error)
-{
-       mono_error_init (error);
-       if (!type || type->type)
-               return type;
-
-       if (is_usertype (type)) {
-               type = mono_reflection_type_get_underlying_system_type (type, error);
-               return_val_if_nok (error, NULL);
-               if (is_usertype (type)) {
-                       mono_error_set_not_supported (error, "User defined subclasses of System.Type are not yet supported22");
-                       return NULL;
-               }
-       }
-
-       return type;
-}
-/**
- * encode_cattr_value:
- * Encode a value in a custom attribute stream of bytes.
- * The value to encode is either supplied as an object in argument val
- * (valuetypes are boxed), or as a pointer to the data in the
- * argument argval.
- * @type represents the type of the value
- * @buffer is the start of the buffer
- * @p the current position in the buffer
- * @buflen contains the size of the buffer and is used to return the new buffer size
- * if this needs to be realloced.
- * @retbuffer and @retp return the start and the position of the buffer
- * @error set on error.
- */
-static void
-encode_cattr_value (MonoAssembly *assembly, char *buffer, char *p, char **retbuffer, char **retp, guint32 *buflen, MonoType *type, MonoObject *arg, char *argval, MonoError *error)
-{
-       MonoTypeEnum simple_type;
-       
-       mono_error_init (error);
-       if ((p-buffer) + 10 >= *buflen) {
-               char *newbuf;
-               *buflen *= 2;
-               newbuf = (char *)g_realloc (buffer, *buflen);
-               p = newbuf + (p-buffer);
-               buffer = newbuf;
-       }
-       if (!argval)
-               argval = ((char*)arg + sizeof (MonoObject));
-       simple_type = type->type;
-handle_enum:
-       switch (simple_type) {
-       case MONO_TYPE_BOOLEAN:
-       case MONO_TYPE_U1:
-       case MONO_TYPE_I1:
-               *p++ = *argval;
-               break;
-       case MONO_TYPE_CHAR:
-       case MONO_TYPE_U2:
-       case MONO_TYPE_I2:
-               swap_with_size (p, argval, 2, 1);
-               p += 2;
-               break;
-       case MONO_TYPE_U4:
-       case MONO_TYPE_I4:
-       case MONO_TYPE_R4:
-               swap_with_size (p, argval, 4, 1);
-               p += 4;
-               break;
-       case MONO_TYPE_R8:
-               swap_with_size (p, argval, 8, 1);
-               p += 8;
-               break;
-       case MONO_TYPE_U8:
-       case MONO_TYPE_I8:
-               swap_with_size (p, argval, 8, 1);
-               p += 8;
-               break;
-       case MONO_TYPE_VALUETYPE:
-               if (type->data.klass->enumtype) {
-                       simple_type = mono_class_enum_basetype (type->data.klass)->type;
-                       goto handle_enum;
-               } else {
-                       g_warning ("generic valutype %s not handled in custom attr value decoding", type->data.klass->name);
-               }
-               break;
-       case MONO_TYPE_STRING: {
-               char *str;
-               guint32 slen;
-               if (!arg) {
-                       *p++ = 0xFF;
-                       break;
-               }
-               str = mono_string_to_utf8_checked ((MonoString*)arg, error);
-               return_if_nok (error);
-               slen = strlen (str);
-               if ((p-buffer) + 10 + slen >= *buflen) {
-                       char *newbuf;
-                       *buflen *= 2;
-                       *buflen += slen;
-                       newbuf = (char *)g_realloc (buffer, *buflen);
-                       p = newbuf + (p-buffer);
-                       buffer = newbuf;
-               }
-               mono_metadata_encode_value (slen, p, &p);
-               memcpy (p, str, slen);
-               p += slen;
-               g_free (str);
-               break;
-       }
-       case MONO_TYPE_CLASS: {
-               char *str;
-               guint32 slen;
-               MonoType *arg_type;
-               if (!arg) {
-                       *p++ = 0xFF;
-                       break;
-               }
-handle_type:
-               arg_type = mono_reflection_type_get_handle ((MonoReflectionType*)arg, error);
-               return_if_nok (error);
-
-               str = type_get_qualified_name (arg_type, NULL);
-               slen = strlen (str);
-               if ((p-buffer) + 10 + slen >= *buflen) {
-                       char *newbuf;
-                       *buflen *= 2;
-                       *buflen += slen;
-                       newbuf = (char *)g_realloc (buffer, *buflen);
-                       p = newbuf + (p-buffer);
-                       buffer = newbuf;
-               }
-               mono_metadata_encode_value (slen, p, &p);
-               memcpy (p, str, slen);
-               p += slen;
-               g_free (str);
-               break;
-       }
-       case MONO_TYPE_SZARRAY: {
-               int len, i;
-               MonoClass *eclass, *arg_eclass;
-
-               if (!arg) {
-                       *p++ = 0xff; *p++ = 0xff; *p++ = 0xff; *p++ = 0xff;
-                       break;
-               }
-               len = mono_array_length ((MonoArray*)arg);
-               *p++ = len & 0xff;
-               *p++ = (len >> 8) & 0xff;
-               *p++ = (len >> 16) & 0xff;
-               *p++ = (len >> 24) & 0xff;
-               *retp = p;
-               *retbuffer = buffer;
-               eclass = type->data.klass;
-               arg_eclass = mono_object_class (arg)->element_class;
-
-               if (!eclass) {
-                       /* Happens when we are called from the MONO_TYPE_OBJECT case below */
-                       eclass = mono_defaults.object_class;
-               }
-               if (eclass == mono_defaults.object_class && arg_eclass->valuetype) {
-                       char *elptr = mono_array_addr ((MonoArray*)arg, char, 0);
-                       int elsize = mono_class_array_element_size (arg_eclass);
-                       for (i = 0; i < len; ++i) {
-                               encode_cattr_value (assembly, buffer, p, &buffer, &p, buflen, &arg_eclass->byval_arg, NULL, elptr, error);
-                               return_if_nok (error);
-                               elptr += elsize;
-                       }
-               } else if (eclass->valuetype && arg_eclass->valuetype) {
-                       char *elptr = mono_array_addr ((MonoArray*)arg, char, 0);
-                       int elsize = mono_class_array_element_size (eclass);
-                       for (i = 0; i < len; ++i) {
-                               encode_cattr_value (assembly, buffer, p, &buffer, &p, buflen, &eclass->byval_arg, NULL, elptr, error);
-                               return_if_nok (error);
-                               elptr += elsize;
-                       }
-               } else {
-                       for (i = 0; i < len; ++i) {
-                               encode_cattr_value (assembly, buffer, p, &buffer, &p, buflen, &eclass->byval_arg, mono_array_get ((MonoArray*)arg, MonoObject*, i), NULL, error);
-                               return_if_nok (error);
-                       }
-               }
-               break;
-       }
-       case MONO_TYPE_OBJECT: {
-               MonoClass *klass;
-               char *str;
-               guint32 slen;
-
-               /*
-                * The parameter type is 'object' but the type of the actual
-                * argument is not. So we have to add type information to the blob
-                * too. This is completely undocumented in the spec.
-                */
-
-               if (arg == NULL) {
-                       *p++ = MONO_TYPE_STRING;        // It's same hack as MS uses
-                       *p++ = 0xFF;
-                       break;
-               }
-               
-               klass = mono_object_class (arg);
-
-               if (mono_object_isinst_checked (arg, mono_defaults.systemtype_class, error)) {
-                       *p++ = 0x50;
-                       goto handle_type;
-               } else {
-                       return_if_nok (error);
-               }
-
-               if (klass->enumtype) {
-                       *p++ = 0x55;
-               } else if (klass == mono_defaults.string_class) {
-                       simple_type = MONO_TYPE_STRING;
-                       *p++ = 0x0E;
-                       goto handle_enum;
-               } else if (klass->rank == 1) {
-                       *p++ = 0x1D;
-                       if (klass->element_class->byval_arg.type == MONO_TYPE_OBJECT)
-                               /* See Partition II, Appendix B3 */
-                               *p++ = 0x51;
-                       else
-                               *p++ = klass->element_class->byval_arg.type;
-                       encode_cattr_value (assembly, buffer, p, &buffer, &p, buflen, &klass->byval_arg, arg, NULL, error);
-                       return_if_nok (error);
-                       break;
-               } else if (klass->byval_arg.type >= MONO_TYPE_BOOLEAN && klass->byval_arg.type <= MONO_TYPE_R8) {
-                       *p++ = simple_type = klass->byval_arg.type;
-                       goto handle_enum;
-               } else {
-                       g_error ("unhandled type in custom attr");
-               }
-               str = type_get_qualified_name (mono_class_get_type(klass), NULL);
-               slen = strlen (str);
-               if ((p-buffer) + 10 + slen >= *buflen) {
-                       char *newbuf;
-                       *buflen *= 2;
-                       *buflen += slen;
-                       newbuf = (char *)g_realloc (buffer, *buflen);
-                       p = newbuf + (p-buffer);
-                       buffer = newbuf;
-               }
-               mono_metadata_encode_value (slen, p, &p);
-               memcpy (p, str, slen);
-               p += slen;
-               g_free (str);
-               simple_type = mono_class_enum_basetype (klass)->type;
-               goto handle_enum;
-       }
-       default:
-               g_error ("type 0x%02x not yet supported in custom attr encoder", simple_type);
-       }
-       *retp = p;
-       *retbuffer = buffer;
-}
-
-static void
-encode_field_or_prop_type (MonoType *type, char *p, char **retp)
-{
-       if (type->type == MONO_TYPE_VALUETYPE && type->data.klass->enumtype) {
-               char *str = type_get_qualified_name (type, NULL);
-               int slen = strlen (str);
-
-               *p++ = 0x55;
-               /*
-                * This seems to be optional...
-                * *p++ = 0x80;
-                */
-               mono_metadata_encode_value (slen, p, &p);
-               memcpy (p, str, slen);
-               p += slen;
-               g_free (str);
-       } else if (type->type == MONO_TYPE_OBJECT) {
-               *p++ = 0x51;
-       } else if (type->type == MONO_TYPE_CLASS) {
-               /* it should be a type: encode_cattr_value () has the check */
-               *p++ = 0x50;
-       } else {
-               mono_metadata_encode_value (type->type, p, &p);
-               if (type->type == MONO_TYPE_SZARRAY)
-                       /* See the examples in Partition VI, Annex B */
-                       encode_field_or_prop_type (&type->data.klass->byval_arg, p, &p);
-       }
-
-       *retp = p;
-}
-
-#ifndef DISABLE_REFLECTION_EMIT
-static void
-encode_named_val (MonoReflectionAssembly *assembly, char *buffer, char *p, char **retbuffer, char **retp, guint32 *buflen, MonoType *type, char *name, MonoObject *value, MonoError *error)
-{
-       int len;
-
-       mono_error_init (error);
-
-       /* Preallocate a large enough buffer */
-       if (type->type == MONO_TYPE_VALUETYPE && type->data.klass->enumtype) {
-               char *str = type_get_qualified_name (type, NULL);
-               len = strlen (str);
-               g_free (str);
-       } else if (type->type == MONO_TYPE_SZARRAY && type->data.klass->enumtype) {
-               char *str = type_get_qualified_name (&type->data.klass->byval_arg, NULL);
-               len = strlen (str);
-               g_free (str);
-       } else {
-               len = 0;
-       }
-       len += strlen (name);
-
-       if ((p-buffer) + 20 + len >= *buflen) {
-               char *newbuf;
-               *buflen *= 2;
-               *buflen += len;
-               newbuf = (char *)g_realloc (buffer, *buflen);
-               p = newbuf + (p-buffer);
-               buffer = newbuf;
-       }
-
-       encode_field_or_prop_type (type, p, &p);
-
-       len = strlen (name);
-       mono_metadata_encode_value (len, p, &p);
-       memcpy (p, name, len);
-       p += len;
-       encode_cattr_value (assembly->assembly, buffer, p, &buffer, &p, buflen, type, value, NULL, error);
-       return_if_nok (error);
-       *retp = p;
-       *retbuffer = buffer;
-}
-
-/**
- * mono_reflection_get_custom_attrs_blob:
- * @ctor: custom attribute constructor
- * @ctorArgs: arguments o the constructor
- * @properties:
- * @propValues:
- * @fields:
- * @fieldValues:
- * 
- * Creates the blob of data that needs to be saved in the metadata and that represents
- * the custom attributed described by @ctor, @ctorArgs etc.
- * Returns: a Byte array representing the blob of data.
- */
-MonoArray*
-mono_reflection_get_custom_attrs_blob (MonoReflectionAssembly *assembly, MonoObject *ctor, MonoArray *ctorArgs, MonoArray *properties, MonoArray *propValues, MonoArray *fields, MonoArray* fieldValues) 
-{
-       MonoError error;
-       MonoArray *result = mono_reflection_get_custom_attrs_blob_checked (assembly, ctor, ctorArgs, properties, propValues, fields, fieldValues, &error);
-       mono_error_cleanup (&error);
-       return result;
-}
-
-/**
- * mono_reflection_get_custom_attrs_blob_checked:
- * @ctor: custom attribute constructor
- * @ctorArgs: arguments o the constructor
- * @properties:
- * @propValues:
- * @fields:
- * @fieldValues:
- * @error: set on error
- * 
- * Creates the blob of data that needs to be saved in the metadata and that represents
- * the custom attributed described by @ctor, @ctorArgs etc.
- * Returns: a Byte array representing the blob of data.  On failure returns NULL and sets @error.
- */
-MonoArray*
-mono_reflection_get_custom_attrs_blob_checked (MonoReflectionAssembly *assembly, MonoObject *ctor, MonoArray *ctorArgs, MonoArray *properties, MonoArray *propValues, MonoArray *fields, MonoArray* fieldValues, MonoError *error) 
-{
-       MonoArray *result = NULL;
-       MonoMethodSignature *sig;
-       MonoObject *arg;
-       char *buffer, *p;
-       guint32 buflen, i;
-
-       mono_error_init (error);
-
-       if (strcmp (ctor->vtable->klass->name, "MonoCMethod")) {
-               /* sig is freed later so allocate it in the heap */
-               sig = ctor_builder_to_signature (NULL, (MonoReflectionCtorBuilder*)ctor, error);
-               if (!is_ok (error)) {
-                       g_free (sig);
-                       return NULL;
-               }
-       } else {
-               sig = mono_method_signature (((MonoReflectionMethod*)ctor)->method);
-       }
-
-       g_assert (mono_array_length (ctorArgs) == sig->param_count);
-       buflen = 256;
-       p = buffer = (char *)g_malloc (buflen);
-       /* write the prolog */
-       *p++ = 1;
-       *p++ = 0;
-       for (i = 0; i < sig->param_count; ++i) {
-               arg = mono_array_get (ctorArgs, MonoObject*, i);
-               encode_cattr_value (assembly->assembly, buffer, p, &buffer, &p, &buflen, sig->params [i], arg, NULL, error);
-               if (!is_ok (error)) goto leave;
-       }
-       i = 0;
-       if (properties)
-               i += mono_array_length (properties);
-       if (fields)
-               i += mono_array_length (fields);
-       *p++ = i & 0xff;
-       *p++ = (i >> 8) & 0xff;
-       if (properties) {
-               MonoObject *prop;
-               for (i = 0; i < mono_array_length (properties); ++i) {
-                       MonoType *ptype;
-                       char *pname;
-
-                       prop = (MonoObject *)mono_array_get (properties, gpointer, i);
-                       get_prop_name_and_type (prop, &pname, &ptype, error);
-                       if (!is_ok (error)) goto leave;
-                       *p++ = 0x54; /* PROPERTY signature */
-                       encode_named_val (assembly, buffer, p, &buffer, &p, &buflen, ptype, pname, (MonoObject*)mono_array_get (propValues, gpointer, i), error);
-                       g_free (pname);
-                       if (!is_ok (error)) goto leave;
-               }
-       }
-
-       if (fields) {
-               MonoObject *field;
-               for (i = 0; i < mono_array_length (fields); ++i) {
-                       MonoType *ftype;
-                       char *fname;
-
-                       field = (MonoObject *)mono_array_get (fields, gpointer, i);
-                       get_field_name_and_type (field, &fname, &ftype, error);
-                       if (!is_ok (error)) goto leave;
-                       *p++ = 0x53; /* FIELD signature */
-                       encode_named_val (assembly, buffer, p, &buffer, &p, &buflen, ftype, fname, (MonoObject*)mono_array_get (fieldValues, gpointer, i), error);
-                       g_free (fname);
-                       if (!is_ok (error)) goto leave;
-               }
-       }
-
-       g_assert (p - buffer <= buflen);
-       buflen = p - buffer;
-       result = mono_array_new_checked (mono_domain_get (), mono_defaults.byte_class, buflen, error);
-       if (!is_ok (error))
-               goto leave;
-       p = mono_array_addr (result, char, 0);
-       memcpy (p, buffer, buflen);
-leave:
-       g_free (buffer);
-       if (strcmp (ctor->vtable->klass->name, "MonoCMethod"))
-               g_free (sig);
-       return result;
-}
-
-/**
- * reflection_setup_internal_class:
- * @tb: a TypeBuilder object
- * @error: set on error
- *
- * Creates a MonoClass that represents the TypeBuilder.
- * This is a trick that lets us simplify a lot of reflection code
- * (and will allow us to support Build and Run assemblies easier).
- *
- * Returns TRUE on success. On failure, returns FALSE and sets @error.
- */
-static gboolean
-reflection_setup_internal_class (MonoReflectionTypeBuilder *tb, MonoError *error)
-{
-       MonoClass *klass, *parent;
-
-       mono_error_init (error);
-       RESOLVE_TYPE (tb->parent, error);
-       return_val_if_nok (error, FALSE);
-
-       mono_loader_lock ();
-
-       if (tb->parent) {
-               MonoType *parent_type = mono_reflection_type_get_handle ((MonoReflectionType*)tb->parent, error);
-               if (!is_ok (error)) {
-                       mono_loader_unlock ();
-                       return FALSE;
-               }
-               /* check so we can compile corlib correctly */
-               if (strcmp (mono_object_class (tb->parent)->name, "TypeBuilder") == 0) {
-                       /* mono_class_setup_mono_type () guaranteess type->data.klass is valid */
-                       parent = parent_type->data.klass;
-               } else {
-                       parent = mono_class_from_mono_type (parent_type);
-               }
-       } else {
-               parent = NULL;
-       }
-       
-       /* the type has already being created: it means we just have to change the parent */
-       if (tb->type.type) {
-               klass = mono_class_from_mono_type (tb->type.type);
-               klass->parent = NULL;
-               /* fool mono_class_setup_parent */
-               klass->supertypes = NULL;
-               mono_class_setup_parent (klass, parent);
-               mono_class_setup_mono_type (klass);
-               mono_loader_unlock ();
-               return TRUE;
-       }
-
-       klass = (MonoClass *)mono_image_alloc0 (&tb->module->dynamic_image->image, sizeof (MonoClass));
-
-       klass->image = &tb->module->dynamic_image->image;
-
-       klass->inited = 1; /* we lie to the runtime */
-       klass->name = mono_string_to_utf8_image (klass->image, tb->name, error);
-       if (!is_ok (error))
-               goto failure;
-       klass->name_space = mono_string_to_utf8_image (klass->image, tb->nspace, error);
-       if (!is_ok (error))
-               goto failure;
-       klass->type_token = MONO_TOKEN_TYPE_DEF | tb->table_idx;
-       klass->flags = tb->attrs;
-       
-       mono_profiler_class_event (klass, MONO_PROFILE_START_LOAD);
-
-       klass->element_class = klass;
-
-       if (mono_class_get_ref_info (klass) == NULL) {
-
-               mono_class_set_ref_info (klass, tb);
-
-               /* Put into cache so mono_class_get_checked () will find it.
-               Skip nested types as those should not be available on the global scope. */
-               if (!tb->nesting_type)
-                       mono_image_add_to_name_cache (klass->image, klass->name_space, klass->name, tb->table_idx);
-
-               /*
-               We must register all types as we cannot rely on the name_cache hashtable since we find the class
-               by performing a mono_class_get which does the full resolution.
-
-               Working around this semantics would require us to write a lot of code for no clear advantage.
-               */
-               mono_image_append_class_to_reflection_info_set (klass);
-       } else {
-               g_assert (mono_class_get_ref_info (klass) == tb);
-       }
-
-       register_dyn_token (tb->module->dynamic_image, MONO_TOKEN_TYPE_DEF | tb->table_idx, (MonoObject*)tb);
-
-       if (parent != NULL) {
-               mono_class_setup_parent (klass, parent);
-       } else if (strcmp (klass->name, "Object") == 0 && strcmp (klass->name_space, "System") == 0) {
-               const char *old_n = klass->name;
-               /* trick to get relative numbering right when compiling corlib */
-               klass->name = "BuildingObject";
-               mono_class_setup_parent (klass, mono_defaults.object_class);
-               klass->name = old_n;
-       }
-
-       if ((!strcmp (klass->name, "ValueType") && !strcmp (klass->name_space, "System")) ||
-                       (!strcmp (klass->name, "Object") && !strcmp (klass->name_space, "System")) ||
-                       (!strcmp (klass->name, "Enum") && !strcmp (klass->name_space, "System"))) {
-               klass->instance_size = sizeof (MonoObject);
-               klass->size_inited = 1;
-               mono_class_setup_vtable_general (klass, NULL, 0, NULL);
-       }
-
-       mono_class_setup_mono_type (klass);
-
-       mono_class_setup_supertypes (klass);
-
-       /*
-        * FIXME: handle interfaces.
-        */
-
-       tb->type.type = &klass->byval_arg;
-
-       if (tb->nesting_type) {
-               g_assert (tb->nesting_type->type);
-               MonoType *nesting_type = mono_reflection_type_get_handle (tb->nesting_type, error);
-               if (!is_ok (error)) goto failure;
-               klass->nested_in = mono_class_from_mono_type (nesting_type);
-       }
-
-       /*g_print ("setup %s as %s (%p)\n", klass->name, ((MonoObject*)tb)->vtable->klass->name, tb);*/
-
-       mono_profiler_class_loaded (klass, MONO_PROFILE_OK);
-       
-       mono_loader_unlock ();
-       return TRUE;
-
-failure:
-       mono_loader_unlock ();
-       return FALSE;
-}
-
-/**
- * ves_icall_TypeBuilder_setup_internal_class:
- * @tb: a TypeBuilder object
- *
- * (icall)
- * Creates a MonoClass that represents the TypeBuilder.
- * This is a trick that lets us simplify a lot of reflection code
- * (and will allow us to support Build and Run assemblies easier).
- *
- */
-void
-ves_icall_TypeBuilder_setup_internal_class (MonoReflectionTypeBuilder *tb)
-{
-       MonoError error;
-       (void) reflection_setup_internal_class (tb, &error);
-       mono_error_set_pending_exception (&error);
-}
-
-/*
- * ves_icall_TypeBuilder_setup_generic_class:
- * @tb: a TypeBuilder object
- *
- * Setup the generic class before adding the first generic parameter.
- */
-void
-ves_icall_TypeBuilder_setup_generic_class (MonoReflectionTypeBuilder *tb)
-{
-}
-
-/**
- * mono_reflection_create_generic_class:
- * @tb: a TypeBuilder object
- * @error: set on error
- *
- * Creates the generic class after all generic parameters have been added.
- * On success returns TRUE, on failure returns FALSE and sets @error.
- * 
- */
-static gboolean
-mono_reflection_create_generic_class (MonoReflectionTypeBuilder *tb, MonoError *error)
-{
-
-       MonoClass *klass;
-       int count, i;
-
-       mono_error_init (error);
-
-       klass = mono_class_from_mono_type (tb->type.type);
-
-       count = tb->generic_params ? mono_array_length (tb->generic_params) : 0;
-
-       if (klass->generic_container || (count == 0))
-               return TRUE;
-
-       g_assert (tb->generic_container && (tb->generic_container->owner.klass == klass));
-
-       klass->generic_container = (MonoGenericContainer *)mono_image_alloc0 (klass->image, sizeof (MonoGenericContainer));
-
-       klass->generic_container->owner.klass = klass;
-       klass->generic_container->type_argc = count;
-       klass->generic_container->type_params = (MonoGenericParamFull *)mono_image_alloc0 (klass->image, sizeof (MonoGenericParamFull) * count);
-
-       klass->is_generic = 1;
-
-       for (i = 0; i < count; i++) {
-               MonoReflectionGenericParam *gparam = (MonoReflectionGenericParam *)mono_array_get (tb->generic_params, gpointer, i);
-               MonoType *param_type = mono_reflection_type_get_handle ((MonoReflectionType*)gparam, error);
-               return_val_if_nok (error, FALSE);
-               MonoGenericParamFull *param = (MonoGenericParamFull *) param_type->data.generic_param;
-               klass->generic_container->type_params [i] = *param;
-               /*Make sure we are a diferent type instance */
-               klass->generic_container->type_params [i].param.owner = klass->generic_container;
-               klass->generic_container->type_params [i].info.pklass = NULL;
-               klass->generic_container->type_params [i].info.flags = gparam->attrs;
-
-               g_assert (klass->generic_container->type_params [i].param.owner);
-       }
-
-       klass->generic_container->context.class_inst = mono_get_shared_generic_inst (klass->generic_container);
-       return TRUE;
-}
-
-/**
- * reflection_create_internal_class:
- * @tb: a TypeBuilder object
- * @error: set on error
- *
- * Actually create the MonoClass that is associated with the TypeBuilder.
- * On success returns TRUE, on failure returns FALSE and sets @error.
- *
- */
-static gboolean
-reflection_create_internal_class (MonoReflectionTypeBuilder *tb, MonoError *error)
-{
-       MonoClass *klass;
-
-       mono_error_init (error);
-       klass = mono_class_from_mono_type (tb->type.type);
-
-       mono_loader_lock ();
-       if (klass->enumtype && mono_class_enum_basetype (klass) == NULL) {
-               MonoReflectionFieldBuilder *fb;
-               MonoClass *ec;
-               MonoType *enum_basetype;
-
-               g_assert (tb->fields != NULL);
-               g_assert (mono_array_length (tb->fields) >= 1);
-
-               fb = mono_array_get (tb->fields, MonoReflectionFieldBuilder*, 0);
-
-               MonoType *field_type = mono_reflection_type_get_handle ((MonoReflectionType*)fb->type, error);
-               if (!is_ok (error)) {
-                       mono_loader_unlock ();
-                       return FALSE;
-               }
-               if (!mono_type_is_valid_enum_basetype (field_type)) {
-                       mono_loader_unlock ();
-                       return TRUE;
-               }
-
-               enum_basetype = mono_reflection_type_get_handle ((MonoReflectionType*)fb->type, error);
-               if (!is_ok (error)) {
-                       mono_loader_unlock ();
-                       return FALSE;
-               }
-               klass->element_class = mono_class_from_mono_type (enum_basetype);
-               if (!klass->element_class)
-                       klass->element_class = mono_class_from_mono_type (enum_basetype);
-
-               /*
-                * get the element_class from the current corlib.
-                */
-               ec = default_class_from_mono_type (enum_basetype);
-               klass->instance_size = ec->instance_size;
-               klass->size_inited = 1;
-               /* 
-                * this is almost safe to do with enums and it's needed to be able
-                * to create objects of the enum type (for use in SetConstant).
-                */
-               /* FIXME: Does this mean enums can't have method overrides ? */
-               mono_class_setup_vtable_general (klass, NULL, 0, NULL);
-       }
-       mono_loader_unlock ();
-       return TRUE;
-}
-
-/**
- * ves_icall_TypeBuilder_create_internal_class:
- * @tb: a TypeBuilder object
- *
- * (icall)
- * Actually create the MonoClass that is associated with the TypeBuilder.
- */
-void
-ves_icall_TypeBuilder_create_internal_class (MonoReflectionTypeBuilder *tb)
-{
-       MonoError error;
-       (void) reflection_create_internal_class (tb, &error);
-       mono_error_set_pending_exception (&error);
-}
-
-static MonoMarshalSpec*
-mono_marshal_spec_from_builder (MonoImage *image, MonoAssembly *assembly,
-                               MonoReflectionMarshal *minfo, MonoError *error)
-{
-       MonoMarshalSpec *res;
-
-       mono_error_init (error);
-
-       res = image_g_new0 (image, MonoMarshalSpec, 1);
-       res->native = (MonoMarshalNative)minfo->type;
-
-       switch (minfo->type) {
-       case MONO_NATIVE_LPARRAY:
-               res->data.array_data.elem_type = (MonoMarshalNative)minfo->eltype;
-               if (minfo->has_size) {
-                       res->data.array_data.param_num = minfo->param_num;
-                       res->data.array_data.num_elem = minfo->count;
-                       res->data.array_data.elem_mult = minfo->param_num == -1 ? 0 : 1;
-               }
-               else {
-                       res->data.array_data.param_num = -1;
-                       res->data.array_data.num_elem = -1;
-                       res->data.array_data.elem_mult = -1;
-               }
-               break;
-
-       case MONO_NATIVE_BYVALTSTR:
-       case MONO_NATIVE_BYVALARRAY:
-               res->data.array_data.num_elem = minfo->count;
-               break;
-
-       case MONO_NATIVE_CUSTOM:
-               if (minfo->marshaltyperef) {
-                       MonoType *marshaltyperef = mono_reflection_type_get_handle ((MonoReflectionType*)minfo->marshaltyperef, error);
-                       if (!is_ok (error)) {
-                               image_g_free (image, res);
-                               return NULL;
-                       }
-                       res->data.custom_data.custom_name =
-                               type_get_fully_qualified_name (marshaltyperef);
-               }
-               if (minfo->mcookie) {
-                       res->data.custom_data.cookie = mono_string_to_utf8_checked (minfo->mcookie, error);
-                       if (!is_ok (error)) {
-                               image_g_free (image, res);
-                               return NULL;
-                       }
-               }
-               break;
-
-       default:
-               break;
-       }
-
-       return res;
-}
-#endif /* !DISABLE_REFLECTION_EMIT */
-
-MonoReflectionMarshalAsAttribute*
-mono_reflection_marshal_as_attribute_from_marshal_spec (MonoDomain *domain, MonoClass *klass,
-                                                       MonoMarshalSpec *spec, MonoError *error)
-{
-       MonoReflectionType *rt;
-       MonoReflectionMarshalAsAttribute *minfo;
-       MonoType *mtype;
-
-       mono_error_init (error);
-       
-       minfo = (MonoReflectionMarshalAsAttribute*)mono_object_new_checked (domain, mono_class_get_marshal_as_attribute_class (), error);
-       if (!minfo)
-               return NULL;
-       minfo->utype = spec->native;
-
-       switch (minfo->utype) {
-       case MONO_NATIVE_LPARRAY:
-               minfo->array_subtype = spec->data.array_data.elem_type;
-               minfo->size_const = spec->data.array_data.num_elem;
-               if (spec->data.array_data.param_num != -1)
-                       minfo->size_param_index = spec->data.array_data.param_num;
-               break;
-
-       case MONO_NATIVE_BYVALTSTR:
-       case MONO_NATIVE_BYVALARRAY:
-               minfo->size_const = spec->data.array_data.num_elem;
-               break;
-
-       case MONO_NATIVE_CUSTOM:
-               if (spec->data.custom_data.custom_name) {
-                       mtype = mono_reflection_type_from_name_checked (spec->data.custom_data.custom_name, klass->image, error);
-                       return_val_if_nok  (error, NULL);
-
-                       if (mtype) {
-                               rt = mono_type_get_object_checked (domain, mtype, error);
-                               if (!rt)
-                                       return NULL;
-
-                               MONO_OBJECT_SETREF (minfo, marshal_type_ref, rt);
-                       }
-
-                       MONO_OBJECT_SETREF (minfo, marshal_type, mono_string_new (domain, spec->data.custom_data.custom_name));
-               }
-               if (spec->data.custom_data.cookie)
-                       MONO_OBJECT_SETREF (minfo, marshal_cookie, mono_string_new (domain, spec->data.custom_data.cookie));
-               break;
-
-       default:
-               break;
-       }
-
-       return minfo;
-}
-
-#ifndef DISABLE_REFLECTION_EMIT
-static MonoMethod*
-reflection_methodbuilder_to_mono_method (MonoClass *klass,
-                                        ReflectionMethodBuilder *rmb,
-                                        MonoMethodSignature *sig,
-                                        MonoError *error)
-{
-       MonoMethod *m;
-       MonoMethodWrapper *wrapperm;
-       MonoMarshalSpec **specs;
-       MonoReflectionMethodAux *method_aux;
-       MonoImage *image;
-       gboolean dynamic;
-       int i;
-
-       mono_error_init (error);
-       /*
-        * Methods created using a MethodBuilder should have their memory allocated
-        * inside the image mempool, while dynamic methods should have their memory
-        * malloc'd.
-        */
-       dynamic = rmb->refs != NULL;
-       image = dynamic ? NULL : klass->image;
-
-       if (!dynamic)
-               g_assert (!klass->generic_class);
-
-       mono_loader_lock ();
-
-       if ((rmb->attrs & METHOD_ATTRIBUTE_PINVOKE_IMPL) ||
-                       (rmb->iattrs & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL))
-               m = (MonoMethod *)image_g_new0 (image, MonoMethodPInvoke, 1);
-       else
-               m = (MonoMethod *)image_g_new0 (image, MonoMethodWrapper, 1);
-
-       wrapperm = (MonoMethodWrapper*)m;
-
-       m->dynamic = dynamic;
-       m->slot = -1;
-       m->flags = rmb->attrs;
-       m->iflags = rmb->iattrs;
-       m->name = mono_string_to_utf8_image_ignore (image, rmb->name);
-       m->klass = klass;
-       m->signature = sig;
-       m->sre_method = TRUE;
-       m->skip_visibility = rmb->skip_visibility;
-       if (rmb->table_idx)
-               m->token = MONO_TOKEN_METHOD_DEF | (*rmb->table_idx);
-
-       if (m->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL) {
-               if (klass == mono_defaults.string_class && !strcmp (m->name, ".ctor"))
-                       m->string_ctor = 1;
-
-               m->signature->pinvoke = 1;
-       } else if (m->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL) {
-               m->signature->pinvoke = 1;
-
-               method_aux = image_g_new0 (image, MonoReflectionMethodAux, 1);
-
-               method_aux->dllentry = rmb->dllentry ? mono_string_to_utf8_image (image, rmb->dllentry, error) : image_strdup (image, m->name);
-               mono_error_assert_ok (error);
-               method_aux->dll = mono_string_to_utf8_image (image, rmb->dll, error);
-               mono_error_assert_ok (error);
-               
-               ((MonoMethodPInvoke*)m)->piflags = (rmb->native_cc << 8) | (rmb->charset ? (rmb->charset - 1) * 2 : 0) | rmb->extra_flags;
-
-               if (image_is_dynamic (klass->image))
-                       g_hash_table_insert (((MonoDynamicImage*)klass->image)->method_aux_hash, m, method_aux);
-
-               mono_loader_unlock ();
-
-               return m;
-       } else if (!(m->flags & METHOD_ATTRIBUTE_ABSTRACT) &&
-                          !(m->iflags & METHOD_IMPL_ATTRIBUTE_RUNTIME)) {
-               MonoMethodHeader *header;
-               guint32 code_size;
-               gint32 max_stack, i;
-               gint32 num_locals = 0;
-               gint32 num_clauses = 0;
-               guint8 *code;
-
-               if (rmb->ilgen) {
-                       code = mono_array_addr (rmb->ilgen->code, guint8, 0);
-                       code_size = rmb->ilgen->code_len;
-                       max_stack = rmb->ilgen->max_stack;
-                       num_locals = rmb->ilgen->locals ? mono_array_length (rmb->ilgen->locals) : 0;
-                       if (rmb->ilgen->ex_handlers)
-                               num_clauses = method_count_clauses (rmb->ilgen);
-               } else {
-                       if (rmb->code) {
-                               code = mono_array_addr (rmb->code, guint8, 0);
-                               code_size = mono_array_length (rmb->code);
-                               /* we probably need to run a verifier on the code... */
-                               max_stack = 8; 
-                       }
-                       else {
-                               code = NULL;
-                               code_size = 0;
-                               max_stack = 8;
-                       }
-               }
-
-               header = (MonoMethodHeader *)image_g_malloc0 (image, MONO_SIZEOF_METHOD_HEADER + num_locals * sizeof (MonoType*));
-               header->code_size = code_size;
-               header->code = (const unsigned char *)image_g_malloc (image, code_size);
-               memcpy ((char*)header->code, code, code_size);
-               header->max_stack = max_stack;
-               header->init_locals = rmb->init_locals;
-               header->num_locals = num_locals;
-
-               for (i = 0; i < num_locals; ++i) {
-                       MonoReflectionLocalBuilder *lb = 
-                               mono_array_get (rmb->ilgen->locals, MonoReflectionLocalBuilder*, i);
-
-                       header->locals [i] = image_g_new0 (image, MonoType, 1);
-                       MonoType *type = mono_reflection_type_get_handle ((MonoReflectionType*)lb->type, error);
-                       mono_error_assert_ok (error);
-                       memcpy (header->locals [i], type, MONO_SIZEOF_TYPE);
-               }
-
-               header->num_clauses = num_clauses;
-               if (num_clauses) {
-                       header->clauses = method_encode_clauses (image, (MonoDynamicImage*)klass->image,
-                                                                rmb->ilgen, num_clauses, error);
-                       mono_error_assert_ok (error);
-               }
-
-               wrapperm->header = header;
-       }
-
-       if (rmb->generic_params) {
-               int count = mono_array_length (rmb->generic_params);
-               MonoGenericContainer *container = rmb->generic_container;
-
-               g_assert (container);
-
-               container->type_argc = count;
-               container->type_params = image_g_new0 (image, MonoGenericParamFull, count);
-               container->owner.method = m;
-               container->is_anonymous = FALSE; // Method is now known, container is no longer anonymous
-
-               m->is_generic = TRUE;
-               mono_method_set_generic_container (m, container);
-
-               for (i = 0; i < count; i++) {
-                       MonoReflectionGenericParam *gp =
-                               mono_array_get (rmb->generic_params, MonoReflectionGenericParam*, i);
-                       MonoType *gp_type = mono_reflection_type_get_handle ((MonoReflectionType*)gp, error);
-                       mono_error_assert_ok (error);
-                       MonoGenericParamFull *param = (MonoGenericParamFull *) gp_type->data.generic_param;
-                       container->type_params [i] = *param;
-               }
-
-               /*
-                * The method signature might have pointers to generic parameters that belong to other methods.
-                * This is a valid SRE case, but the resulting method signature must be encoded using the proper
-                * generic parameters.
-                */
-               for (i = 0; i < m->signature->param_count; ++i) {
-                       MonoType *t = m->signature->params [i];
-                       if (t->type == MONO_TYPE_MVAR) {
-                               MonoGenericParam *gparam =  t->data.generic_param;
-                               if (gparam->num < count) {
-                                       m->signature->params [i] = mono_metadata_type_dup (image, m->signature->params [i]);
-                                       m->signature->params [i]->data.generic_param = mono_generic_container_get_param (container, gparam->num);
-                               }
-
-                       }
-               }
-
-               if (klass->generic_container) {
-                       container->parent = klass->generic_container;
-                       container->context.class_inst = klass->generic_container->context.class_inst;
-               }
-               container->context.method_inst = mono_get_shared_generic_inst (container);
-       }
-
-       if (rmb->refs) {
-               MonoMethodWrapper *mw = (MonoMethodWrapper*)m;
-               int i;
-               void **data;
-
-               m->wrapper_type = MONO_WRAPPER_DYNAMIC_METHOD;
-
-               mw->method_data = data = image_g_new (image, gpointer, rmb->nrefs + 1);
-               data [0] = GUINT_TO_POINTER (rmb->nrefs);
-               for (i = 0; i < rmb->nrefs; ++i)
-                       data [i + 1] = rmb->refs [i];
-       }
-
-       method_aux = NULL;
-
-       /* Parameter info */
-       if (rmb->pinfo) {
-               if (!method_aux)
-                       method_aux = image_g_new0 (image, MonoReflectionMethodAux, 1);
-               method_aux->param_names = image_g_new0 (image, char *, mono_method_signature (m)->param_count + 1);
-               for (i = 0; i <= m->signature->param_count; ++i) {
-                       MonoReflectionParamBuilder *pb;
-                       if ((pb = mono_array_get (rmb->pinfo, MonoReflectionParamBuilder*, i))) {
-                               if ((i > 0) && (pb->attrs)) {
-                                       /* Make a copy since it might point to a shared type structure */
-                                       m->signature->params [i - 1] = mono_metadata_type_dup (klass->image, m->signature->params [i - 1]);
-                                       m->signature->params [i - 1]->attrs = pb->attrs;
-                               }
-
-                               if (pb->attrs & PARAM_ATTRIBUTE_HAS_DEFAULT) {
-                                       MonoDynamicImage *assembly;
-                                       guint32 idx, len;
-                                       MonoTypeEnum def_type;
-                                       char *p;
-                                       const char *p2;
-
-                                       if (!method_aux->param_defaults) {
-                                               method_aux->param_defaults = image_g_new0 (image, guint8*, m->signature->param_count + 1);
-                                               method_aux->param_default_types = image_g_new0 (image, guint32, m->signature->param_count + 1);
-                                       }
-                                       assembly = (MonoDynamicImage*)klass->image;
-                                       idx = encode_constant (assembly, pb->def_value, &def_type);
-                                       /* Copy the data from the blob since it might get realloc-ed */
-                                       p = assembly->blob.data + idx;
-                                       len = mono_metadata_decode_blob_size (p, &p2);
-                                       len += p2 - p;
-                                       method_aux->param_defaults [i] = (uint8_t *)image_g_malloc (image, len);
-                                       method_aux->param_default_types [i] = def_type;
-                                       memcpy ((gpointer)method_aux->param_defaults [i], p, len);
-                               }
-
-                               if (pb->name) {
-                                       method_aux->param_names [i] = mono_string_to_utf8_image (image, pb->name, error);
-                                       mono_error_assert_ok (error);
-                               }
-                               if (pb->cattrs) {
-                                       if (!method_aux->param_cattr)
-                                               method_aux->param_cattr = image_g_new0 (image, MonoCustomAttrInfo*, m->signature->param_count + 1);
-                                       method_aux->param_cattr [i] = mono_custom_attrs_from_builders (image, klass->image, pb->cattrs);
-                               }
-                       }
-               }
-       }
-
-       /* Parameter marshalling */
-       specs = NULL;
-       if (rmb->pinfo)         
-               for (i = 0; i < mono_array_length (rmb->pinfo); ++i) {
-                       MonoReflectionParamBuilder *pb;
-                       if ((pb = mono_array_get (rmb->pinfo, MonoReflectionParamBuilder*, i))) {
-                               if (pb->marshal_info) {
-                                       if (specs == NULL)
-                                               specs = image_g_new0 (image, MonoMarshalSpec*, sig->param_count + 1);
-                                       specs [pb->position] = 
-                                               mono_marshal_spec_from_builder (image, klass->image->assembly, pb->marshal_info, error);
-                                       if (!is_ok (error)) {
-                                               mono_loader_unlock ();
-                                               image_g_free (image, specs);
-                                               /* FIXME: if image is NULL, this leaks all the other stuff we alloc'd in this function */
-                                               return NULL;
-                                       }
-                               }
-                       }
-               }
-       if (specs != NULL) {
-               if (!method_aux)
-                       method_aux = image_g_new0 (image, MonoReflectionMethodAux, 1);
-               method_aux->param_marshall = specs;
-       }
-
-       if (image_is_dynamic (klass->image) && method_aux)
-               g_hash_table_insert (((MonoDynamicImage*)klass->image)->method_aux_hash, m, method_aux);
-
-       mono_loader_unlock ();
-
-       return m;
-}      
-
-static MonoMethod*
-ctorbuilder_to_mono_method (MonoClass *klass, MonoReflectionCtorBuilder* mb, MonoError *error)
-{
-       ReflectionMethodBuilder rmb;
-       MonoMethodSignature *sig;
-
-       mono_loader_lock ();
-       g_assert (klass->image != NULL);
-       sig = ctor_builder_to_signature (klass->image, mb, error);
-       mono_loader_unlock ();
-       return_val_if_nok (error, NULL);
-
-       if (!reflection_methodbuilder_from_ctor_builder (&rmb, mb, error))
-               return NULL;
-
-       mb->mhandle = reflection_methodbuilder_to_mono_method (klass, &rmb, sig, error);
-       return_val_if_nok (error, NULL);
-       mono_save_custom_attrs (klass->image, mb->mhandle, mb->cattrs);
-
-       /* If we are in a generic class, we might be called multiple times from inflate_method */
-       if (!((MonoDynamicImage*)(MonoDynamicImage*)klass->image)->save && !klass->generic_container) {
-               /* ilgen is no longer needed */
-               mb->ilgen = NULL;
-       }
-
-       return mb->mhandle;
-}
-
-static MonoMethod*
-methodbuilder_to_mono_method (MonoClass *klass, MonoReflectionMethodBuilder* mb, MonoError *error)
-{
-       ReflectionMethodBuilder rmb;
-       MonoMethodSignature *sig;
-
-       mono_error_init (error);
-
-       mono_loader_lock ();
-       g_assert (klass->image != NULL);
-       sig = method_builder_to_signature (klass->image, mb, error);
-       mono_loader_unlock ();
-       return_val_if_nok (error, NULL);
-
-       if (!reflection_methodbuilder_from_method_builder (&rmb, mb, error))
-               return NULL;
-
-       mb->mhandle = reflection_methodbuilder_to_mono_method (klass, &rmb, sig, error);
-       return_val_if_nok (error, NULL);
-       mono_save_custom_attrs (klass->image, mb->mhandle, mb->cattrs);
-
-       /* If we are in a generic class, we might be called multiple times from inflate_method */
-       if (!((MonoDynamicImage*)(MonoDynamicImage*)klass->image)->save && !klass->generic_container) {
-               /* ilgen is no longer needed */
-               mb->ilgen = NULL;
-       }
-       return mb->mhandle;
-}
-
-static MonoClassField*
-fieldbuilder_to_mono_class_field (MonoClass *klass, MonoReflectionFieldBuilder* fb, MonoError *error)
-{
-       MonoClassField *field;
-       MonoType *custom;
-
-       mono_error_init (error);
-
-       field = g_new0 (MonoClassField, 1);
-
-       field->name = mono_string_to_utf8_image (klass->image, fb->name, error);
-       mono_error_assert_ok (error);
-       if (fb->attrs || fb->modreq || fb->modopt) {
-               MonoType *type = mono_reflection_type_get_handle ((MonoReflectionType*)fb->type, error);
-               if (!is_ok (error)) {
-                       g_free (field);
-                       return NULL;
-               }
-               field->type = mono_metadata_type_dup (NULL, type);
-               field->type->attrs = fb->attrs;
-
-               g_assert (image_is_dynamic (klass->image));
-               custom = add_custom_modifiers ((MonoDynamicImage*)klass->image, field->type, fb->modreq, fb->modopt, error);
-               g_free (field->type);
-               if (!is_ok (error)) {
-                       g_free (field);
-                       return NULL;
-               }
-               field->type = mono_metadata_type_dup (klass->image, custom);
-               g_free (custom);
-       } else {
-               field->type = mono_reflection_type_get_handle ((MonoReflectionType*)fb->type, error);
-               if (!is_ok (error)) {
-                       g_free (field);
-                       return NULL;
-               }
-       }
-       if (fb->offset != -1)
-               field->offset = fb->offset;
-       field->parent = klass;
-       mono_save_custom_attrs (klass->image, field, fb->cattrs);
-
-       // FIXME: Can't store fb->def_value/RVA, is it needed for field_on_insts ?
-
-       return field;
-}
-#endif
-
-/**
- * mono_reflection_bind_generic_parameters:
- * @type: a managed type object (which should be some kind of generic (instance? definition?))
- * @type_args: the number of type arguments to bind
- * @types: array of type arguments
- * @error: set on error
- *
- * Given a managed type object for a generic type instance, binds each of its arguments to the specified types.
- * Returns the MonoType* for the resulting type instantiation.  On failure returns NULL and sets @error.
- */
-MonoType*
-mono_reflection_bind_generic_parameters (MonoReflectionType *type, int type_argc, MonoType **types, MonoError *error)
-{
-       MonoClass *klass;
-       MonoReflectionTypeBuilder *tb = NULL;
-       gboolean is_dynamic = FALSE;
-       MonoClass *geninst;
-
-       mono_error_init (error);
-       
-       mono_loader_lock ();
-
-       if (is_sre_type_builder (mono_object_class (type))) {
-               tb = (MonoReflectionTypeBuilder *) type;
-
-               is_dynamic = TRUE;
-       } else if (is_sre_generic_instance (mono_object_class (type))) {
-               MonoReflectionGenericClass *rgi = (MonoReflectionGenericClass *) type;
-               MonoReflectionType *gtd = rgi->generic_type;
-
-               if (is_sre_type_builder (mono_object_class (gtd))) {
-                       tb = (MonoReflectionTypeBuilder *)gtd;
-                       is_dynamic = TRUE;
-               }
-       }
-
-       /* FIXME: fix the CreateGenericParameters protocol to avoid the two stage setup of TypeBuilders */
-       if (tb && tb->generic_container) {
-               if (!mono_reflection_create_generic_class (tb, error)) {
-                       mono_loader_unlock ();
-                       return NULL;
-               }
-       }
-
-       MonoType *t = mono_reflection_type_get_handle (type, error);
-       if (!is_ok (error)) {
-               mono_loader_unlock ();
-               return NULL;
-       }
-
-       klass = mono_class_from_mono_type (t);
-       if (!klass->generic_container) {
-               mono_loader_unlock ();
-               mono_error_set_type_load_class (error, klass, "Cannot bind generic parameters of a non-generic type");
-               return NULL;
-       }
-
-       if (klass->wastypebuilder) {
-               tb = (MonoReflectionTypeBuilder *) mono_class_get_ref_info (klass);
-
-               is_dynamic = TRUE;
-       }
-
-       mono_loader_unlock ();
-
-       geninst = mono_class_bind_generic_parameters (klass, type_argc, types, is_dynamic);
-
-       return &geninst->byval_arg;
-}
-
-MonoClass*
-mono_class_bind_generic_parameters (MonoClass *klass, int type_argc, MonoType **types, gboolean is_dynamic)
-{
-       MonoGenericClass *gclass;
-       MonoGenericInst *inst;
-
-       g_assert (klass->generic_container);
-
-       inst = mono_metadata_get_generic_inst (type_argc, types);
-       gclass = mono_metadata_lookup_generic_class (klass, inst, is_dynamic);
-
-       return mono_generic_class_get_class (gclass);
-}
-
-static MonoReflectionMethod*
-reflection_bind_generic_method_parameters (MonoReflectionMethod *rmethod, MonoArray *types, MonoError *error)
-{
-       MonoClass *klass;
-       MonoMethod *method, *inflated;
-       MonoMethodInflated *imethod;
-       MonoGenericContext tmp_context;
-       MonoGenericInst *ginst;
-       MonoType **type_argv;
-       int count, i;
-
-       mono_error_init (error);
-
-       /*FIXME but this no longer should happen*/
-       if (!strcmp (rmethod->object.vtable->klass->name, "MethodBuilder")) {
-#ifndef DISABLE_REFLECTION_EMIT
-               MonoReflectionMethodBuilder *mb = NULL;
-               MonoType *tb;
-               MonoClass *klass;
-
-               mb = (MonoReflectionMethodBuilder *) rmethod;
-               tb = mono_reflection_type_get_handle ((MonoReflectionType*)mb->type, error);
-               return_val_if_nok (error, NULL);
-               klass = mono_class_from_mono_type (tb);
-
-               method = methodbuilder_to_mono_method (klass, mb, error);
-               return_val_if_nok (error, NULL);
-#else
-               g_assert_not_reached ();
-               method = NULL;
-#endif
-       } else {
-               method = rmethod->method;
-       }
-
-       klass = method->klass;
-
-       if (method->is_inflated)
-               method = ((MonoMethodInflated *) method)->declaring;
-
-       count = mono_method_signature (method)->generic_param_count;
-       if (count != mono_array_length (types))
-               return NULL;
-
-       type_argv = g_new0 (MonoType *, count);
-       for (i = 0; i < count; i++) {
-               MonoReflectionType *garg = (MonoReflectionType *)mono_array_get (types, gpointer, i);
-               type_argv [i] = mono_reflection_type_get_handle (garg, error);
-               if (!is_ok (error)) {
-                       g_free (type_argv);
-                       return NULL;
-               }
-       }
-       ginst = mono_metadata_get_generic_inst (count, type_argv);
-       g_free (type_argv);
-
-       tmp_context.class_inst = klass->generic_class ? klass->generic_class->context.class_inst : NULL;
-       tmp_context.method_inst = ginst;
-
-       inflated = mono_class_inflate_generic_method_checked (method, &tmp_context, error);
-       mono_error_assert_ok (error);
-       imethod = (MonoMethodInflated *) inflated;
-
-       /*FIXME but I think this is no longer necessary*/
-       if (image_is_dynamic (method->klass->image)) {
-               MonoDynamicImage *image = (MonoDynamicImage*)method->klass->image;
-               /*
-                * This table maps metadata structures representing inflated methods/fields
-                * to the reflection objects representing their generic definitions.
-                */
-               mono_image_lock ((MonoImage*)image);
-               mono_g_hash_table_insert (image->generic_def_objects, imethod, rmethod);
-               mono_image_unlock ((MonoImage*)image);
-       }
-
-       if (!mono_verifier_is_method_valid_generic_instantiation (inflated)) {
-               mono_error_set_argument (error, "typeArguments", "Invalid generic arguments");
-               return NULL;
-       }
-       
-       MonoReflectionMethod *ret = mono_method_get_object_checked (mono_object_domain (rmethod), inflated, NULL, error);
-       return ret;
-}
-
-MonoReflectionMethod*
-ves_icall_MethodBuilder_MakeGenericMethod (MonoReflectionMethod *rmethod, MonoArray *types)
-{
-       MonoError error;
-       MonoReflectionMethod *result = reflection_bind_generic_method_parameters (rmethod, types, &error);
-       mono_error_set_pending_exception (&error);
-       return result;
-}
-
-MonoReflectionMethod*
-ves_icall_MonoMethod_MakeGenericMethod_impl (MonoReflectionMethod *rmethod, MonoArray *types)
-{
-       MonoError error;
-       MonoReflectionMethod *result = reflection_bind_generic_method_parameters (rmethod, types, &error);
-       mono_error_set_pending_exception (&error);
-       return result;
-}
-
-#ifndef DISABLE_REFLECTION_EMIT
-
-static MonoMethod *
-inflate_mono_method (MonoClass *klass, MonoMethod *method, MonoObject *obj)
-{
-       MonoMethodInflated *imethod;
-       MonoGenericContext *context;
-       int i;
-
-       /*
-        * With generic code sharing the klass might not be inflated.
-        * This can happen because classes inflated with their own
-        * type arguments are "normalized" to the uninflated class.
-        */
-       if (!klass->generic_class)
-               return method;
-
-       context = mono_class_get_context (klass);
-
-       if (klass->method.count && klass->methods) {
-               /* Find the already created inflated method */
-               for (i = 0; i < klass->method.count; ++i) {
-                       g_assert (klass->methods [i]->is_inflated);
-                       if (((MonoMethodInflated*)klass->methods [i])->declaring == method)
-                               break;
-               }
-               g_assert (i < klass->method.count);
-               imethod = (MonoMethodInflated*)klass->methods [i];
-       } else {
-               MonoError error;
-               imethod = (MonoMethodInflated *) mono_class_inflate_generic_method_full_checked (method, klass, context, &error);
-               mono_error_assert_ok (&error);
-       }
-
-       if (method->is_generic && image_is_dynamic (method->klass->image)) {
-               MonoDynamicImage *image = (MonoDynamicImage*)method->klass->image;
-
-               mono_image_lock ((MonoImage*)image);
-               mono_g_hash_table_insert (image->generic_def_objects, imethod, obj);
-               mono_image_unlock ((MonoImage*)image);
-       }
-       return (MonoMethod *) imethod;
-}
-
-static MonoMethod *
-inflate_method (MonoReflectionType *type, MonoObject *obj, MonoError *error)
-{
-       MonoMethod *method;
-       MonoClass *gklass;
-
-       mono_error_init (error);
-
-       MonoClass *type_class = mono_object_class (type);
-
-       if (is_sre_generic_instance (type_class)) {
-               MonoReflectionGenericClass *mgc = (MonoReflectionGenericClass*)type;
-               MonoType *generic_type = mono_reflection_type_get_handle ((MonoReflectionType*)mgc->generic_type, error);
-               return_val_if_nok (error, NULL);
-               gklass = mono_class_from_mono_type (generic_type);
-       } else if (is_sre_type_builder (type_class)) {
-               MonoType *t = mono_reflection_type_get_handle (type, error);
-               return_val_if_nok (error, NULL);
-               gklass = mono_class_from_mono_type (t);
-       } else if (type->type) {
-               gklass = mono_class_from_mono_type (type->type);
-               gklass = mono_class_get_generic_type_definition (gklass);
-       } else {
-               g_error ("Can't handle type %s", mono_type_get_full_name (mono_object_class (type)));
-       }
-
-       if (!strcmp (obj->vtable->klass->name, "MethodBuilder"))
-               if (((MonoReflectionMethodBuilder*)obj)->mhandle)
-                       method = ((MonoReflectionMethodBuilder*)obj)->mhandle;
-               else {
-                       method = methodbuilder_to_mono_method (gklass, (MonoReflectionMethodBuilder *) obj, error);
-                       if (!method)
-                               return NULL;
-               }
-       else if (!strcmp (obj->vtable->klass->name, "ConstructorBuilder")) {
-               method = ctorbuilder_to_mono_method (gklass, (MonoReflectionCtorBuilder *) obj, error);
-               if (!method)
-                       return NULL;
-       } else if (!strcmp (obj->vtable->klass->name, "MonoMethod") || !strcmp (obj->vtable->klass->name, "MonoCMethod"))
-               method = ((MonoReflectionMethod *) obj)->method;
-       else {
-               method = NULL; /* prevent compiler warning */
-               g_error ("can't handle type %s", obj->vtable->klass->name);
-       }
-
-       MonoType *t = mono_reflection_type_get_handle (type, error);
-       return_val_if_nok (error, NULL);
-       return inflate_mono_method (mono_class_from_mono_type (t), method, obj);
-}
-
-/*TODO avoid saving custom attrs for generic classes as it's enough to have them on the generic type definition.*/
-static gboolean
-reflection_generic_class_initialize (MonoReflectionGenericClass *type, MonoArray *fields, MonoError *error)
-{
-       MonoGenericClass *gclass;
-       MonoDynamicGenericClass *dgclass;
-       MonoClass *klass, *gklass;
-       MonoType *gtype;
-       int i;
-
-       mono_error_init (error);
-
-       gtype = mono_reflection_type_get_handle ((MonoReflectionType*)type, error);
-       return_val_if_nok (error, FALSE);
-       klass = mono_class_from_mono_type (gtype);
-       g_assert (gtype->type == MONO_TYPE_GENERICINST);
-       gclass = gtype->data.generic_class;
-
-       if (!gclass->is_dynamic)
-               return TRUE;
-
-       dgclass = (MonoDynamicGenericClass *) gclass;
-
-       if (dgclass->initialized)
-               return TRUE;
-
-       gklass = gclass->container_class;
-       mono_class_init (gklass);
-
-       dgclass->count_fields = fields ? mono_array_length (fields) : 0;
-
-       dgclass->fields = mono_image_set_new0 (gclass->owner, MonoClassField, dgclass->count_fields);
-       dgclass->field_objects = mono_image_set_new0 (gclass->owner, MonoObject*, dgclass->count_fields);
-       dgclass->field_generic_types = mono_image_set_new0 (gclass->owner, MonoType*, dgclass->count_fields);
-
-       for (i = 0; i < dgclass->count_fields; i++) {
-               MonoObject *obj = (MonoObject *)mono_array_get (fields, gpointer, i);
-               MonoClassField *field, *inflated_field = NULL;
-
-               if (!strcmp (obj->vtable->klass->name, "FieldBuilder")) {
-                       inflated_field = field = fieldbuilder_to_mono_class_field (klass, (MonoReflectionFieldBuilder *) obj, error);
-                       return_val_if_nok (error, FALSE);
-               } else if (!strcmp (obj->vtable->klass->name, "MonoField"))
-                       field = ((MonoReflectionField *) obj)->field;
-               else {
-                       field = NULL; /* prevent compiler warning */
-                       g_assert_not_reached ();
-               }
-
-               dgclass->fields [i] = *field;
-               dgclass->fields [i].parent = klass;
-               dgclass->fields [i].type = mono_class_inflate_generic_type_checked (
-                       field->type, mono_generic_class_get_context ((MonoGenericClass *) dgclass), error);
-               mono_error_assert_ok (error); /* FIXME don't swallow the error */
-               dgclass->field_generic_types [i] = field->type;
-               MONO_GC_REGISTER_ROOT_IF_MOVING (dgclass->field_objects [i], MONO_ROOT_SOURCE_REFLECTION, "dynamic generic class field object");
-               dgclass->field_objects [i] = obj;
-
-               if (inflated_field) {
-                       g_free (inflated_field);
-               } else {
-                       dgclass->fields [i].name = mono_image_set_strdup (gclass->owner, dgclass->fields [i].name);
-               }
-       }
-
-       dgclass->initialized = TRUE;
-       return TRUE;
-}
-
-void
-mono_reflection_generic_class_initialize (MonoReflectionGenericClass *type, MonoArray *fields)
-{
-       MonoError error;
-       (void) reflection_generic_class_initialize (type, fields, &error);
-       mono_error_set_pending_exception (&error);
-}
-
-void
-mono_reflection_free_dynamic_generic_class (MonoGenericClass *gclass)
-{
-       MonoDynamicGenericClass *dgclass;
-       int i;
-
-       g_assert (gclass->is_dynamic);
-
-       dgclass = (MonoDynamicGenericClass *)gclass;
-
-       for (i = 0; i < dgclass->count_fields; ++i) {
-               MonoClassField *field = dgclass->fields + i;
-               mono_metadata_free_type (field->type);
-               MONO_GC_UNREGISTER_ROOT_IF_MOVING (dgclass->field_objects [i]);
-       }
-}
-
-/**
- * fix_partial_generic_class:
- * @klass: a generic instantiation MonoClass
- * @error: set on error
- *
- * Assumes that the generic container of @klass has its vtable
- * initialized, and updates the parent class, insterfaces, methods and
- * fields of @klass by inflating the types using the generic context.
- *
- * On success returns TRUE, on failure returns FALSE and sets @error.
- *
- */
-static gboolean
-fix_partial_generic_class (MonoClass *klass, MonoError *error)
-{
-       MonoClass *gklass = klass->generic_class->container_class;
-       MonoDynamicGenericClass *dgclass;
-       int i;
-
-       mono_error_init (error);
-
-       if (klass->wastypebuilder)
-               return TRUE;
-
-       dgclass = (MonoDynamicGenericClass *)  klass->generic_class;
-       if (klass->parent != gklass->parent) {
-               MonoType *parent_type = mono_class_inflate_generic_type_checked (&gklass->parent->byval_arg, &klass->generic_class->context, error);
-               if (mono_error_ok (error)) {
-                       MonoClass *parent = mono_class_from_mono_type (parent_type);
-                       mono_metadata_free_type (parent_type);
-                       if (parent != klass->parent) {
-                               /*fool mono_class_setup_parent*/
-                               klass->supertypes = NULL;
-                               mono_class_setup_parent (klass, parent);
-                       }
-               } else {
-                       if (gklass->wastypebuilder)
-                               klass->wastypebuilder = TRUE;
-                       return FALSE;
-               }
-       }
-
-       if (!dgclass->initialized)
-               return TRUE;
-
-       if (klass->method.count != gklass->method.count) {
-               klass->method.count = gklass->method.count;
-               klass->methods = (MonoMethod **)mono_image_alloc (klass->image, sizeof (MonoMethod*) * (klass->method.count + 1));
-
-               for (i = 0; i < klass->method.count; i++) {
-                       klass->methods [i] = mono_class_inflate_generic_method_full_checked (
-                               gklass->methods [i], klass, mono_class_get_context (klass), error);
-                       mono_error_assert_ok (error);
-               }
-       }
-
-       if (klass->interface_count && klass->interface_count != gklass->interface_count) {
-               klass->interface_count = gklass->interface_count;
-               klass->interfaces = (MonoClass **)mono_image_alloc (klass->image, sizeof (MonoClass*) * gklass->interface_count);
-               klass->interfaces_packed = NULL; /*make setup_interface_offsets happy*/
-
-               for (i = 0; i < gklass->interface_count; ++i) {
-                       MonoType *iface_type = mono_class_inflate_generic_type_checked (&gklass->interfaces [i]->byval_arg, mono_class_get_context (klass), error);
-                       return_val_if_nok (error, FALSE);
-
-                       klass->interfaces [i] = mono_class_from_mono_type (iface_type);
-                       mono_metadata_free_type (iface_type);
-
-                       if (!ensure_runtime_vtable (klass->interfaces [i], error))
-                               return FALSE;
-               }
-               klass->interfaces_inited = 1;
-       }
-
-       if (klass->field.count != gklass->field.count) {
-               klass->field.count = gklass->field.count;
-               klass->fields = image_g_new0 (klass->image, MonoClassField, klass->field.count);
-
-               for (i = 0; i < klass->field.count; i++) {
-                       klass->fields [i] = gklass->fields [i];
-                       klass->fields [i].parent = klass;
-                       klass->fields [i].type = mono_class_inflate_generic_type_checked (gklass->fields [i].type, mono_class_get_context (klass), error);
-                       return_val_if_nok (error, FALSE);
-               }
-       }
-
-       /*We can only finish with this klass once it's parent has as well*/
-       if (gklass->wastypebuilder)
-               klass->wastypebuilder = TRUE;
-       return TRUE;
-}
-
-/**
- * ensure_generic_class_runtime_vtable:
- * @klass a generic class
- * @error set on error
- *
- * Ensures that the generic container of @klass has a vtable and
- * returns TRUE on success.  On error returns FALSE and sets @error.
- */
-static gboolean
-ensure_generic_class_runtime_vtable (MonoClass *klass, MonoError *error)
-{
-       MonoClass *gklass = klass->generic_class->container_class;
-
-       mono_error_init (error);
-
-       if (!ensure_runtime_vtable (gklass, error))
-               return FALSE;
-
-       return fix_partial_generic_class (klass, error);
-}
-
-/**
- * ensure_runtime_vtable:
- * @klass the class
- * @error set on error
- *
- * Ensures that @klass has a vtable and returns TRUE on success. On
- * error returns FALSE and sets @error.
- */
-static gboolean
-ensure_runtime_vtable (MonoClass *klass, MonoError *error)
-{
-       MonoReflectionTypeBuilder *tb = (MonoReflectionTypeBuilder *)mono_class_get_ref_info (klass);
-       int i, num, j;
-
-       mono_error_init (error);
-
-       if (!image_is_dynamic (klass->image) || (!tb && !klass->generic_class) || klass->wastypebuilder)
-               return TRUE;
-       if (klass->parent)
-               if (!ensure_runtime_vtable (klass->parent, error))
-                       return FALSE;
-
-       if (tb) {
-               num = tb->ctors? mono_array_length (tb->ctors): 0;
-               num += tb->num_methods;
-               klass->method.count = num;
-               klass->methods = (MonoMethod **)mono_image_alloc (klass->image, sizeof (MonoMethod*) * num);
-               num = tb->ctors? mono_array_length (tb->ctors): 0;
-               for (i = 0; i < num; ++i) {
-                       MonoMethod *ctor = ctorbuilder_to_mono_method (klass, mono_array_get (tb->ctors, MonoReflectionCtorBuilder*, i), error);
-                       if (!ctor)
-                               return FALSE;
-                       klass->methods [i] = ctor;
-               }
-               num = tb->num_methods;
-               j = i;
-               for (i = 0; i < num; ++i) {
-                       MonoMethod *meth = methodbuilder_to_mono_method (klass, mono_array_get (tb->methods, MonoReflectionMethodBuilder*, i), error);
-                       if (!meth)
-                               return FALSE;
-                       klass->methods [j++] = meth;
-               }
-       
-               if (tb->interfaces) {
-                       klass->interface_count = mono_array_length (tb->interfaces);
-                       klass->interfaces = (MonoClass **)mono_image_alloc (klass->image, sizeof (MonoClass*) * klass->interface_count);
-                       for (i = 0; i < klass->interface_count; ++i) {
-                               MonoType *iface = mono_type_array_get_and_resolve (tb->interfaces, i, error);
-                               return_val_if_nok (error, FALSE);
-                               klass->interfaces [i] = mono_class_from_mono_type (iface);
-                               if (!ensure_runtime_vtable (klass->interfaces [i], error))
-                                       return FALSE;
+       while (*p) {
+               switch (*p) {
+               case '+':
+                       *p = 0; /* NULL terminate the name */
+                       startn = p + 1;
+                       info->nested = g_list_append (info->nested, startn);
+                       /* we have parsed the nesting namespace + name */
+                       if (info->name)
+                               break;
+                       if (last_point) {
+                               info->name_space = start;
+                               *last_point = 0;
+                               info->name = last_point + 1;
+                       } else {
+                               info->name_space = (char *)"";
+                               info->name = start;
                        }
-                       klass->interfaces_inited = 1;
-               }
-       } else if (klass->generic_class){
-               if (!ensure_generic_class_runtime_vtable (klass, error)) {
-                       mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, NULL);
-                       return FALSE;
-               }
-       }
-
-       if (klass->flags & TYPE_ATTRIBUTE_INTERFACE) {
-               int slot_num = 0;
-               for (i = 0; i < klass->method.count; ++i) {
-                       MonoMethod *im = klass->methods [i];
-                       if (!(im->flags & METHOD_ATTRIBUTE_STATIC))
-                               im->slot = slot_num++;
+                       break;
+               case '.':
+                       last_point = p;
+                       break;
+               case '\\':
+                       ++p;
+                       break;
+               case '&':
+               case '*':
+               case '[':
+               case ',':
+               case ']':
+                       in_modifiers = 1;
+                       break;
+               default:
+                       break;
                }
-               
-               klass->interfaces_packed = NULL; /*make setup_interface_offsets happy*/
-               mono_class_setup_interface_offsets (klass);
-               mono_class_setup_interface_id (klass);
-       }
-
-       /*
-        * The generic vtable is needed even if image->run is not set since some
-        * runtime code like ves_icall_Type_GetMethodsByName depends on 
-        * method->slot being defined.
-        */
-
-       /* 
-        * tb->methods could not be freed since it is used for determining 
-        * overrides during dynamic vtable construction.
-        */
-
-       return TRUE;
-}
-
-static MonoMethod*
-mono_reflection_method_get_handle (MonoObject *method, MonoError *error)
-{
-       mono_error_init (error);
-       MonoClass *klass = mono_object_class (method);
-       if (is_sr_mono_method (klass) || is_sr_mono_generic_method (klass)) {
-               MonoReflectionMethod *sr_method = (MonoReflectionMethod*)method;
-               return sr_method->method;
-       }
-       if (is_sre_method_builder (klass)) {
-               MonoReflectionMethodBuilder *mb = (MonoReflectionMethodBuilder*)method;
-               return mb->mhandle;
+               if (in_modifiers)
+                       break;
+               // *w++ = *p++;
+               p++;
        }
-       if (is_sre_method_on_tb_inst (klass)) {
-               MonoReflectionMethodOnTypeBuilderInst *m = (MonoReflectionMethodOnTypeBuilderInst*)method;
-               MonoMethod *result;
-               /*FIXME move this to a proper method and unify with resolve_object*/
-               if (m->method_args) {
-                       result = mono_reflection_method_on_tb_inst_get_handle (m, error);
+       
+       if (!info->name) {
+               if (last_point) {
+                       info->name_space = start;
+                       *last_point = 0;
+                       info->name = last_point + 1;
                } else {
-                       MonoType *type = mono_reflection_type_get_handle ((MonoReflectionType*)m->inst, error);
-                       return_val_if_nok (error, NULL);
-                       MonoClass *inflated_klass = mono_class_from_mono_type (type);
-                       MonoMethod *mono_method;
-
-                       if (is_sre_method_builder (mono_object_class (m->mb)))
-                               mono_method = ((MonoReflectionMethodBuilder *)m->mb)->mhandle;
-                       else if (is_sr_mono_method (mono_object_class (m->mb)))
-                               mono_method = ((MonoReflectionMethod *)m->mb)->method;
-                       else
-                               g_error ("resolve_object:: can't handle a MTBI with base_method of type %s", mono_type_get_full_name (mono_object_class (m->mb)));
-
-                       result = inflate_mono_method (inflated_klass, mono_method, (MonoObject*)m->mb);
+                       info->name_space = (char *)"";
+                       info->name = start;
                }
-               return result;
        }
+       while (*p) {
+               switch (*p) {
+               case '&':
+                       if (isbyref) /* only one level allowed by the spec */
+                               return 0;
+                       isbyref = 1;
+                       isptr = 0;
+                       info->modifiers = g_list_append (info->modifiers, GUINT_TO_POINTER (0));
+                       *p++ = 0;
+                       break;
+               case '*':
+                       if (isbyref) /* pointer to ref not okay */
+                               return 0;
+                       info->modifiers = g_list_append (info->modifiers, GUINT_TO_POINTER (-1));
+                       isptr = 1;
+                       *p++ = 0;
+                       break;
+               case '[':
+                       if (isbyref) /* array of ref and generic ref are not okay */
+                               return 0;
+                       //Decide if it's an array of a generic argument list
+                       *p++ = 0;
 
-       g_error ("Can't handle methods of type %s:%s", klass->name_space, klass->name);
-       return NULL;
-}
-
-void
-mono_reflection_get_dynamic_overrides (MonoClass *klass, MonoMethod ***overrides, int *num_overrides, MonoError *error)
-{
-       MonoReflectionTypeBuilder *tb;
-       int i, j, onum;
-       MonoReflectionMethod *m;
-
-       mono_error_init (error);
-       *overrides = NULL;
-       *num_overrides = 0;
-
-       g_assert (image_is_dynamic (klass->image));
-
-       if (!mono_class_get_ref_info (klass))
-               return;
+                       if (!*p) //XXX test
+                               return 0;
+                       if (*p  == ',' || *p == '*' || *p == ']') { //array
+                               isptr = 0;
+                               rank = 1;
+                               while (*p) {
+                                       if (*p == ']')
+                                               break;
+                                       if (*p == ',')
+                                               rank++;
+                                       else if (*p == '*') /* '*' means unknown lower bound */
+                                               info->modifiers = g_list_append (info->modifiers, GUINT_TO_POINTER (-2));
+                                       else
+                                               return 0;
+                                       ++p;
+                               }
+                               if (*p++ != ']')
+                                       return 0;
+                               info->modifiers = g_list_append (info->modifiers, GUINT_TO_POINTER (rank));
+                       } else {
+                               if (rank || isptr) /* generic args after array spec or ptr*/ //XXX test
+                                       return 0;
+                               isptr = 0;
+                               info->type_arguments = g_ptr_array_new ();
+                               while (*p) {
+                                       MonoTypeNameParse *subinfo = g_new0 (MonoTypeNameParse, 1);
+                                       gboolean fqname = FALSE;
 
-       g_assert (strcmp (((MonoObject*)mono_class_get_ref_info (klass))->vtable->klass->name, "TypeBuilder") == 0);
+                                       g_ptr_array_add (info->type_arguments, subinfo);
 
-       tb = (MonoReflectionTypeBuilder*)mono_class_get_ref_info (klass);
+                                       while (*p == ' ') p++;
+                                       if (*p == '[') {
+                                               p++;
+                                               fqname = TRUE;
+                                       }
 
-       onum = 0;
-       if (tb->methods) {
-               for (i = 0; i < tb->num_methods; ++i) {
-                       MonoReflectionMethodBuilder *mb = 
-                               mono_array_get (tb->methods, MonoReflectionMethodBuilder*, i);
-                       if (mb->override_methods)
-                               onum += mono_array_length (mb->override_methods);
-               }
-       }
+                                       if (!_mono_reflection_parse_type (p, &p, TRUE, subinfo))
+                                               return 0;
 
-       if (onum) {
-               *overrides = g_new0 (MonoMethod*, onum * 2);
+                                       /*MS is lenient on [] delimited parameters that aren't fqn - and F# uses them.*/
+                                       if (fqname && (*p != ']')) {
+                                               char *aname;
 
-               onum = 0;
-               for (i = 0; i < tb->num_methods; ++i) {
-                       MonoReflectionMethodBuilder *mb = 
-                               mono_array_get (tb->methods, MonoReflectionMethodBuilder*, i);
-                       if (mb->override_methods) {
-                               for (j = 0; j < mono_array_length (mb->override_methods); ++j) {
-                                       m = mono_array_get (mb->override_methods, MonoReflectionMethod*, j);
+                                               if (*p != ',')
+                                                       return 0;
+                                               *p++ = 0;
 
-                                       (*overrides) [onum * 2] = mono_reflection_method_get_handle ((MonoObject*)m, error);
-                                       return_if_nok (error);
-                                       (*overrides) [onum * 2 + 1] = mb->mhandle;
+                                               aname = p;
+                                               while (*p && (*p != ']'))
+                                                       p++;
 
-                                       g_assert (mb->mhandle);
+                                               if (*p != ']')
+                                                       return 0;
 
-                                       onum ++;
+                                               *p++ = 0;
+                                               while (*aname) {
+                                                       if (g_ascii_isspace (*aname)) {
+                                                               ++aname;
+                                                               continue;
+                                                       }
+                                                       break;
+                                               }
+                                               if (!*aname ||
+                                                   !assembly_name_to_aname (&subinfo->assembly, aname))
+                                                       return 0;
+                                       } else if (fqname && (*p == ']')) {
+                                               *p++ = 0;
+                                       }
+                                       if (*p == ']') {
+                                               *p++ = 0;
+                                               break;
+                                       } else if (!*p) {
+                                               return 0;
+                                       }
+                                       *p++ = 0;
                                }
                        }
+                       break;
+               case ']':
+                       if (is_recursed)
+                               goto end;
+                       return 0;
+               case ',':
+                       if (is_recursed)
+                               goto end;
+                       *p++ = 0;
+                       while (*p) {
+                               if (g_ascii_isspace (*p)) {
+                                       ++p;
+                                       continue;
+                               }
+                               break;
+                       }
+                       if (!*p)
+                               return 0; /* missing assembly name */
+                       if (!assembly_name_to_aname (&info->assembly, p))
+                               return 0;
+                       break;
+               default:
+                       return 0;
                }
+               if (info->assembly.name)
+                       break;
        }
-
-       *num_overrides = onum;
-}
-
-static void
-typebuilder_setup_fields (MonoClass *klass, MonoError *error)
-{
-       MonoReflectionTypeBuilder *tb = (MonoReflectionTypeBuilder *)mono_class_get_ref_info (klass);
-       MonoReflectionFieldBuilder *fb;
-       MonoClassField *field;
-       MonoImage *image = klass->image;
-       const char *p, *p2;
-       int i;
-       guint32 len, idx, real_size = 0;
-
-       klass->field.count = tb->num_fields;
-       klass->field.first = 0;
-
-       mono_error_init (error);
-
-       if (tb->class_size) {
-               if ((tb->packing_size & 0xffffff00) != 0) {
-                       char *err_msg = g_strdup_printf ("Could not load struct '%s' with packing size %d >= 256", klass->name, tb->packing_size);
-                       mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, err_msg);
-                       return;
-               }
-               klass->packing_size = tb->packing_size;
-               real_size = klass->instance_size + tb->class_size;
-       }
-
-       if (!klass->field.count) {
-               klass->instance_size = MAX (klass->instance_size, real_size);
-               return;
-       }
-       
-       klass->fields = image_g_new0 (image, MonoClassField, klass->field.count);
-       mono_class_alloc_ext (klass);
-       klass->ext->field_def_values = image_g_new0 (image, MonoFieldDefaultValue, klass->field.count);
-       /*
-       This is, guess what, a hack.
-       The issue is that the runtime doesn't know how to setup the fields of a typebuider and crash.
-       On the static path no field class is resolved, only types are built. This is the right thing to do
-       but we suck.
-       Setting size_inited is harmless because we're doing the same job as mono_class_setup_fields anyway.
-       */
-       klass->size_inited = 1;
-
-       for (i = 0; i < klass->field.count; ++i) {
-               MonoArray *rva_data;
-               fb = (MonoReflectionFieldBuilder *)mono_array_get (tb->fields, gpointer, i);
-               field = &klass->fields [i];
-               field->name = mono_string_to_utf8_image (image, fb->name, error);
-               if (!mono_error_ok (error))
-                       return;
-               if (fb->attrs) {
-                       MonoType *type = mono_reflection_type_get_handle ((MonoReflectionType*)fb->type, error);
-                       return_if_nok (error);
-                       field->type = mono_metadata_type_dup (klass->image, type);
-                       field->type->attrs = fb->attrs;
-               } else {
-                       field->type = mono_reflection_type_get_handle ((MonoReflectionType*)fb->type, error);
-                       return_if_nok (error);
-               }
-
-               if ((fb->attrs & FIELD_ATTRIBUTE_HAS_FIELD_RVA) && (rva_data = fb->rva_data)) {
-                       char *base = mono_array_addr (rva_data, char, 0);
-                       size_t size = mono_array_length (rva_data);
-                       char *data = (char *)mono_image_alloc (klass->image, size);
-                       memcpy (data, base, size);
-                       klass->ext->field_def_values [i].data = data;
-               }
-               if (fb->offset != -1)
-                       field->offset = fb->offset;
-               field->parent = klass;
-               fb->handle = field;
-               mono_save_custom_attrs (klass->image, field, fb->cattrs);
-
-               if (klass->enumtype && !(field->type->attrs & FIELD_ATTRIBUTE_STATIC)) {
-                       klass->cast_class = klass->element_class = mono_class_from_mono_type (field->type);
-               }
-               if (fb->def_value) {
-                       MonoDynamicImage *assembly = (MonoDynamicImage*)klass->image;
-                       field->type->attrs |= FIELD_ATTRIBUTE_HAS_DEFAULT;
-                       idx = encode_constant (assembly, fb->def_value, &klass->ext->field_def_values [i].def_type);
-                       /* Copy the data from the blob since it might get realloc-ed */
-                       p = assembly->blob.data + idx;
-                       len = mono_metadata_decode_blob_size (p, &p2);
-                       len += p2 - p;
-                       klass->ext->field_def_values [i].data = (const char *)mono_image_alloc (image, len);
-                       memcpy ((gpointer)klass->ext->field_def_values [i].data, p, len);
-               }
-       }
-
-       klass->instance_size = MAX (klass->instance_size, real_size);
-       mono_class_layout_fields (klass, klass->instance_size);
-}
-
-static void
-typebuilder_setup_properties (MonoClass *klass, MonoError *error)
-{
-       MonoReflectionTypeBuilder *tb = (MonoReflectionTypeBuilder *)mono_class_get_ref_info (klass);
-       MonoReflectionPropertyBuilder *pb;
-       MonoImage *image = klass->image;
-       MonoProperty *properties;
-       int i;
-
-       mono_error_init (error);
-
-       if (!klass->ext)
-               klass->ext = image_g_new0 (image, MonoClassExt, 1);
-
-       klass->ext->property.count = tb->properties ? mono_array_length (tb->properties) : 0;
-       klass->ext->property.first = 0;
-
-       properties = image_g_new0 (image, MonoProperty, klass->ext->property.count);
-       klass->ext->properties = properties;
-       for (i = 0; i < klass->ext->property.count; ++i) {
-               pb = mono_array_get (tb->properties, MonoReflectionPropertyBuilder*, i);
-               properties [i].parent = klass;
-               properties [i].attrs = pb->attrs;
-               properties [i].name = mono_string_to_utf8_image (image, pb->name, error);
-               if (!mono_error_ok (error))
-                       return;
-               if (pb->get_method)
-                       properties [i].get = pb->get_method->mhandle;
-               if (pb->set_method)
-                       properties [i].set = pb->set_method->mhandle;
-
-               mono_save_custom_attrs (klass->image, &properties [i], pb->cattrs);
-               if (pb->def_value) {
-                       guint32 len, idx;
-                       const char *p, *p2;
-                       MonoDynamicImage *assembly = (MonoDynamicImage*)klass->image;
-                       if (!klass->ext->prop_def_values)
-                               klass->ext->prop_def_values = image_g_new0 (image, MonoFieldDefaultValue, klass->ext->property.count);
-                       properties [i].attrs |= PROPERTY_ATTRIBUTE_HAS_DEFAULT;
-                       idx = encode_constant (assembly, pb->def_value, &klass->ext->prop_def_values [i].def_type);
-                       /* Copy the data from the blob since it might get realloc-ed */
-                       p = assembly->blob.data + idx;
-                       len = mono_metadata_decode_blob_size (p, &p2);
-                       len += p2 - p;
-                       klass->ext->prop_def_values [i].data = (const char *)mono_image_alloc (image, len);
-                       memcpy ((gpointer)klass->ext->prop_def_values [i].data, p, len);
-               }
-       }
-}
-
-static MonoReflectionEvent *
-reflection_event_builder_get_event_info (MonoReflectionTypeBuilder *tb, MonoReflectionEventBuilder *eb, MonoError *error)
-{
-       mono_error_init (error);
-
-       MonoEvent *event = g_new0 (MonoEvent, 1);
-       MonoClass *klass;
-
-       MonoType *type = mono_reflection_type_get_handle ((MonoReflectionType*)tb, error);
-       if (!is_ok (error)) {
-               g_free (event);
-               return NULL;
-       }
-       klass = mono_class_from_mono_type (type);
-
-       event->parent = klass;
-       event->attrs = eb->attrs;
-       event->name = mono_string_to_utf8_checked (eb->name, error);
-       if (!is_ok (error)) {
-               g_free (event);
-               return NULL;
-       }
-       if (eb->add_method)
-               event->add = eb->add_method->mhandle;
-       if (eb->remove_method)
-               event->remove = eb->remove_method->mhandle;
-       if (eb->raise_method)
-               event->raise = eb->raise_method->mhandle;
-
-#ifndef MONO_SMALL_CONFIG
-       if (eb->other_methods) {
-               int j;
-               event->other = g_new0 (MonoMethod*, mono_array_length (eb->other_methods) + 1);
-               for (j = 0; j < mono_array_length (eb->other_methods); ++j) {
-                       MonoReflectionMethodBuilder *mb = 
-                               mono_array_get (eb->other_methods,
-                                               MonoReflectionMethodBuilder*, j);
-                       event->other [j] = mb->mhandle;
-               }
-       }
-#endif
-
-       MonoReflectionEvent *ev_obj = mono_event_get_object_checked (mono_object_domain (tb), klass, event, error);
-       if (!is_ok (error)) {
-#ifndef MONO_SMALL_CONFIG
-               g_free (event->other);
-#endif
-               g_free (event);
-               return NULL;
-       }
-       return ev_obj;
+       // *w = 0; /* terminate class name */
+ end:
+       if (!info->name || !*info->name)
+               return 0;
+       if (endptr)
+               *endptr = p;
+       /* add other consistency checks */
+       return 1;
 }
 
-MonoReflectionEvent *
-ves_icall_TypeBuilder_get_event_info (MonoReflectionTypeBuilder *tb, MonoReflectionEventBuilder *eb)
-{
-       MonoError error;
-       MonoReflectionEvent *result = reflection_event_builder_get_event_info (tb, eb, &error);
-       mono_error_set_pending_exception (&error);
-       return result;
-}
 
-static void
-typebuilder_setup_events (MonoClass *klass, MonoError *error)
+/**
+ * mono_identifier_unescape_type_name_chars:
+ * @identifier: the display name of a mono type
+ *
+ * Returns:
+ *  The name in internal form, that is without escaping backslashes.
+ *
+ *  The string is modified in place!
+ */
+char*
+mono_identifier_unescape_type_name_chars(char* identifier)
 {
-       MonoReflectionTypeBuilder *tb = (MonoReflectionTypeBuilder *)mono_class_get_ref_info (klass);
-       MonoReflectionEventBuilder *eb;
-       MonoImage *image = klass->image;
-       MonoEvent *events;
-       int i;
-
-       mono_error_init (error);
-
-       if (!klass->ext)
-               klass->ext = image_g_new0 (image, MonoClassExt, 1);
-
-       klass->ext->event.count = tb->events ? mono_array_length (tb->events) : 0;
-       klass->ext->event.first = 0;
-
-       events = image_g_new0 (image, MonoEvent, klass->ext->event.count);
-       klass->ext->events = events;
-       for (i = 0; i < klass->ext->event.count; ++i) {
-               eb = mono_array_get (tb->events, MonoReflectionEventBuilder*, i);
-               events [i].parent = klass;
-               events [i].attrs = eb->attrs;
-               events [i].name = mono_string_to_utf8_image (image, eb->name, error);
-               if (!mono_error_ok (error))
-                       return;
-               if (eb->add_method)
-                       events [i].add = eb->add_method->mhandle;
-               if (eb->remove_method)
-                       events [i].remove = eb->remove_method->mhandle;
-               if (eb->raise_method)
-                       events [i].raise = eb->raise_method->mhandle;
-
-#ifndef MONO_SMALL_CONFIG
-               if (eb->other_methods) {
-                       int j;
-                       events [i].other = image_g_new0 (image, MonoMethod*, mono_array_length (eb->other_methods) + 1);
-                       for (j = 0; j < mono_array_length (eb->other_methods); ++j) {
-                               MonoReflectionMethodBuilder *mb = 
-                                       mono_array_get (eb->other_methods,
-                                                                       MonoReflectionMethodBuilder*, j);
-                               events [i].other [j] = mb->mhandle;
-                       }
+       char *w, *r;
+       if (!identifier)
+               return NULL;
+       for (w = r = identifier; *r != 0; r++)
+       {
+               char c = *r;
+               if (c == '\\') {
+                       r++;
+                       if (*r == 0)
+                               break;
+                       c = *r;
                }
-#endif
-               mono_save_custom_attrs (klass->image, &events [i], eb->cattrs);
+               *w = c;
+               w++;
        }
+       if (w != r)
+               *w = 0;
+       return identifier;
 }
 
-struct remove_instantiations_user_data
-{
-       MonoClass *klass;
-       MonoError *error;
-};
+void
+mono_identifier_unescape_info (MonoTypeNameParse* info);
 
-static gboolean
-remove_instantiations_of_and_ensure_contents (gpointer key,
-                                                 gpointer value,
-                                                 gpointer user_data)
+static void
+unescape_each_type_argument(void* data, void* user_data)
 {
-       struct remove_instantiations_user_data *data = (struct remove_instantiations_user_data*)user_data;
-       MonoType *type = (MonoType*)key;
-       MonoClass *klass = data->klass;
-       gboolean already_failed = !is_ok (data->error);
-       MonoError lerror;
-       MonoError *error = already_failed ? &lerror : data->error;
-
-       if ((type->type == MONO_TYPE_GENERICINST) && (type->data.generic_class->container_class == klass)) {
-               MonoClass *inst_klass = mono_class_from_mono_type (type);
-               //Ensure it's safe to use it.
-               if (!fix_partial_generic_class (inst_klass, error)) {
-                       mono_class_set_failure (inst_klass, MONO_EXCEPTION_TYPE_LOAD, NULL);
-                       // Marked the class with failure, but since some other instantiation already failed,
-                       // just report that one, and swallow the error from this one.
-                       if (already_failed)
-                               mono_error_cleanup (error);
-               }
-               return TRUE;
-       } else
-               return FALSE;
+       MonoTypeNameParse* info = (MonoTypeNameParse*)data;
+       mono_identifier_unescape_info (info);
 }
 
 static void
-check_array_for_usertypes (MonoArray *arr, MonoError *error)
+unescape_each_nested_name (void* data, void* user_data)
 {
-       mono_error_init (error);
-       int i;
+       char* nested_name = (char*) data;
+       mono_identifier_unescape_type_name_chars(nested_name);
+}
 
-       if (!arr)
+/**
+ * mono_identifier_unescape_info:
+ *
+ * @info: a parsed display form of an (optionally assembly qualified) full type name.
+ *
+ * Returns: nothing.
+ *
+ * Destructively updates the info by unescaping the identifiers that
+ * comprise the type namespace, name, nested types (if any) and
+ * generic type arguments (if any).
+ *
+ * The resulting info has the names in internal form.
+ *
+ */
+void
+mono_identifier_unescape_info (MonoTypeNameParse *info)
+{
+       if (!info)
                return;
+       mono_identifier_unescape_type_name_chars(info->name_space);
+       mono_identifier_unescape_type_name_chars(info->name);
+       // but don't escape info->assembly
+       if (info->type_arguments)
+               g_ptr_array_foreach(info->type_arguments, &unescape_each_type_argument, NULL);
+       if (info->nested)
+               g_list_foreach(info->nested, &unescape_each_nested_name, NULL);
+}
 
-       for (i = 0; i < mono_array_length (arr); ++i) {
-               RESOLVE_ARRAY_TYPE_ELEMENT (arr, i, error);
-               if (!mono_error_ok (error))
-                       break;
+int
+mono_reflection_parse_type (char *name, MonoTypeNameParse *info)
+{
+       int ok = _mono_reflection_parse_type (name, NULL, FALSE, info);
+       if (ok) {
+               mono_identifier_unescape_info (info);
        }
+       return ok;
 }
 
-MonoReflectionType*
-ves_icall_TypeBuilder_create_runtime_class (MonoReflectionTypeBuilder *tb)
+static MonoType*
+_mono_reflection_get_type_from_info (MonoTypeNameParse *info, MonoImage *image, gboolean ignorecase, MonoError *error)
 {
-       MonoError error;
-       MonoClass *klass;
-       MonoDomain* domain;
-       MonoReflectionType* res;
-       int i, j;
-
-       mono_error_init (&error);
+       gboolean type_resolve = FALSE;
+       MonoType *type;
+       MonoImage *rootimage = image;
 
-       domain = mono_object_domain (tb);
-       klass = mono_class_from_mono_type (tb->type.type);
+       mono_error_init (error);
 
-       /*
-        * Check for user defined Type subclasses.
-        */
-       RESOLVE_TYPE (tb->parent, &error);
-       if (!is_ok (&error))
-               goto failure_unlocked;
-       check_array_for_usertypes (tb->interfaces, &error);
-       if (!is_ok (&error))
-               goto failure_unlocked;
-       if (tb->fields) {
-               for (i = 0; i < mono_array_length (tb->fields); ++i) {
-                       MonoReflectionFieldBuilder *fb = (MonoReflectionFieldBuilder *)mono_array_get (tb->fields, gpointer, i);
-                       if (fb) {
-                               RESOLVE_TYPE (fb->type, &error);
-                               if (!is_ok (&error))
-                                       goto failure_unlocked;
-                               check_array_for_usertypes (fb->modreq, &error);
-                               if (!is_ok (&error))
-                                       goto failure_unlocked;
-                               check_array_for_usertypes (fb->modopt, &error);
-                               if (!is_ok (&error))
-                                       goto failure_unlocked;
-                               if (fb->marshal_info && fb->marshal_info->marshaltyperef) {
-                                       RESOLVE_TYPE (fb->marshal_info->marshaltyperef, &error);
-                                       if (!is_ok (&error))
-                                               goto failure_unlocked;
-                               }
-                       }
-               }
-       }
-       if (tb->methods) {
-               for (i = 0; i < mono_array_length (tb->methods); ++i) {
-                       MonoReflectionMethodBuilder *mb = (MonoReflectionMethodBuilder *)mono_array_get (tb->methods, gpointer, i);
-                       if (mb) {
-                               RESOLVE_TYPE (mb->rtype, &error);
-                               if (!is_ok (&error))
-                                       goto failure_unlocked;
-                               check_array_for_usertypes (mb->return_modreq, &error);
-                               if (!is_ok (&error))
-                                       goto failure_unlocked;
-                               check_array_for_usertypes (mb->return_modopt, &error);
-                               if (!is_ok (&error))
-                                       goto failure_unlocked;
-                               check_array_for_usertypes (mb->parameters, &error);
-                               if (!is_ok (&error))
-                                       goto failure_unlocked;
-                               if (mb->param_modreq)
-                                       for (j = 0; j < mono_array_length (mb->param_modreq); ++j) {
-                                               check_array_for_usertypes (mono_array_get (mb->param_modreq, MonoArray*, j), &error);
-                                               if (!is_ok (&error))
-                                                       goto failure_unlocked;
-                                       }
-                               if (mb->param_modopt)
-                                       for (j = 0; j < mono_array_length (mb->param_modopt); ++j) {
-                                               check_array_for_usertypes (mono_array_get (mb->param_modopt, MonoArray*, j), &error);
-                                               if (!is_ok (&error))
-                                                       goto failure_unlocked;
-                                       }
-                       }
-               }
-       }
-       if (tb->ctors) {
-               for (i = 0; i < mono_array_length (tb->ctors); ++i) {
-                       MonoReflectionCtorBuilder *mb = (MonoReflectionCtorBuilder *)mono_array_get (tb->ctors, gpointer, i);
-                       if (mb) {
-                               check_array_for_usertypes (mb->parameters, &error);
-                               if (!is_ok (&error))
-                                       goto failure_unlocked;
-                               if (mb->param_modreq)
-                                       for (j = 0; j < mono_array_length (mb->param_modreq); ++j) {
-                                               check_array_for_usertypes (mono_array_get (mb->param_modreq, MonoArray*, j), &error);
-                                               if (!is_ok (&error))
-                                                       goto failure_unlocked;
-                                       }
-                               if (mb->param_modopt)
-                                       for (j = 0; j < mono_array_length (mb->param_modopt); ++j) {
-                                               check_array_for_usertypes (mono_array_get (mb->param_modopt, MonoArray*, j), &error);
-                                               if (!is_ok (&error))
-                                                       goto failure_unlocked;
-                                       }
-                       }
+       if (info->assembly.name) {
+               MonoAssembly *assembly = mono_assembly_loaded (&info->assembly);
+               if (!assembly && image && image->assembly && mono_assembly_names_equal (&info->assembly, &image->assembly->aname))
+                       /* 
+                        * This could happen in the AOT compiler case when the search hook is not
+                        * installed.
+                        */
+                       assembly = image->assembly;
+               if (!assembly) {
+                       /* then we must load the assembly ourselve - see #60439 */
+                       assembly = mono_assembly_load (&info->assembly, image->assembly->basedir, NULL);
+                       if (!assembly)
+                               return NULL;
                }
+               image = assembly->image;
+       } else if (!image) {
+               image = mono_defaults.corlib;
        }
 
-       mono_save_custom_attrs (klass->image, klass, tb->cattrs);
-
-       /* 
-        * we need to lock the domain because the lock will be taken inside
-        * So, we need to keep the locking order correct.
-        */
-       mono_loader_lock ();
-       mono_domain_lock (domain);
-       if (klass->wastypebuilder) {
-               mono_domain_unlock (domain);
-               mono_loader_unlock ();
-
-               res = mono_type_get_object_checked (mono_object_domain (tb), &klass->byval_arg, &error);
-               mono_error_set_pending_exception (&error);
-
-               return res;
+       type = mono_reflection_get_type_with_rootimage (rootimage, image, info, ignorecase, &type_resolve, error);
+       if (type == NULL && !info->assembly.name && image != mono_defaults.corlib) {
+               /* ignore the error and try again */
+               mono_error_cleanup (error);
+               mono_error_init (error);
+               image = mono_defaults.corlib;
+               type = mono_reflection_get_type_with_rootimage (rootimage, image, info, ignorecase, &type_resolve, error);
        }
-       /*
-        * Fields to set in klass:
-        * the various flags: delegate/unicode/contextbound etc.
-        */
-       klass->flags = tb->attrs;
-       klass->has_cctor = 1;
-
-       mono_class_setup_parent (klass, klass->parent);
-       /* fool mono_class_setup_supertypes */
-       klass->supertypes = NULL;
-       mono_class_setup_supertypes (klass);
-       mono_class_setup_mono_type (klass);
-
-#if 0
-       if (!((MonoDynamicImage*)klass->image)->run) {
-               if (klass->generic_container) {
-                       /* FIXME: The code below can't handle generic classes */
-                       klass->wastypebuilder = TRUE;
-                       mono_loader_unlock ();
-                       mono_domain_unlock (domain);
 
-                       res = mono_type_get_object_checked (mono_object_domain (tb), &klass->byval_arg, &error);
-                       mono_error_set_pending_exception (&error);
-
-                       return res;
-               }
-       }
-#endif
+       return type;
+}
 
-       /* enums are done right away */
-       if (!klass->enumtype)
-               if (!ensure_runtime_vtable (klass, &error))
-                       goto failure;
+/**
+ * mono_reflection_get_type_internal:
+ *
+ * Returns: may return NULL on success, sets error on failure.
+ */
+static MonoType*
+mono_reflection_get_type_internal (MonoImage *rootimage, MonoImage* image, MonoTypeNameParse *info, gboolean ignorecase, MonoError *error)
+{
+       MonoClass *klass;
+       GList *mod;
+       int modval;
+       gboolean bounded = FALSE;
+       
+       mono_error_init (error);
+       if (!image)
+               image = mono_defaults.corlib;
 
-       if (tb->subtypes) {
-               for (i = 0; i < mono_array_length (tb->subtypes); ++i) {
-                       MonoReflectionTypeBuilder *subtb = mono_array_get (tb->subtypes, MonoReflectionTypeBuilder*, i);
-                       mono_class_alloc_ext (klass);
-                       MonoType *subtype = mono_reflection_type_get_handle ((MonoReflectionType*)subtb, &error);
-                       if (!is_ok (&error)) goto failure;
-                       klass->ext->nested_classes = g_list_prepend_image (klass->image, klass->ext->nested_classes, mono_class_from_mono_type (subtype));
-               }
-       }
+       if (!rootimage)
+               rootimage = mono_defaults.corlib;
 
-       klass->nested_classes_inited = TRUE;
-
-       /* fields and object layout */
-       if (klass->parent) {
-               if (!klass->parent->size_inited)
-                       mono_class_init (klass->parent);
-               klass->instance_size = klass->parent->instance_size;
-               klass->sizes.class_size = 0;
-               klass->min_align = klass->parent->min_align;
-               /* if the type has no fields we won't call the field_setup
-                * routine which sets up klass->has_references.
-                */
-               klass->has_references |= klass->parent->has_references;
-       } else {
-               klass->instance_size = sizeof (MonoObject);
-               klass->min_align = 1;
-       }
+       if (ignorecase)
+               klass = mono_class_from_name_case_checked (image, info->name_space, info->name, error);
+       else
+               klass = mono_class_from_name_checked (image, info->name_space, info->name, error);
 
-       /* FIXME: handle packing_size and instance_size */
-       typebuilder_setup_fields (klass, &error);
-       if (!mono_error_ok (&error))
-               goto failure;
-       typebuilder_setup_properties (klass, &error);
-       if (!mono_error_ok (&error))
-               goto failure;
+       if (!klass)
+               return NULL;
 
-       typebuilder_setup_events (klass, &error);
-       if (!mono_error_ok (&error))
-               goto failure;
+       for (mod = info->nested; mod; mod = mod->next) {
+               gpointer iter = NULL;
+               MonoClass *parent;
 
-       klass->wastypebuilder = TRUE;
+               parent = klass;
+               mono_class_init (parent);
 
-       /* 
-        * If we are a generic TypeBuilder, there might be instantiations in the type cache
-        * which have type System.Reflection.MonoGenericClass, but after the type is created, 
-        * we want to return normal System.MonoType objects, so clear these out from the cache.
-        *
-        * Together with this we must ensure the contents of all instances to match the created type.
-        */
-       if (domain->type_hash && klass->generic_container) {
-               struct remove_instantiations_user_data data;
-               data.klass = klass;
-               data.error = &error;
-               mono_error_assert_ok (&error);
-               mono_g_hash_table_foreach_remove (domain->type_hash, remove_instantiations_of_and_ensure_contents, &data);
-               if (!is_ok (&error))
-                       goto failure;
-       }
+               while ((klass = mono_class_get_nested_types (parent, &iter))) {
+                       char *lastp;
+                       char *nested_name, *nested_nspace;
+                       gboolean match = TRUE;
 
-       mono_domain_unlock (domain);
-       mono_loader_unlock ();
+                       lastp = strrchr ((const char *)mod->data, '.');
+                       if (lastp) {
+                               /* Nested classes can have namespaces */
+                               int nspace_len;
 
-       if (klass->enumtype && !mono_class_is_valid_enum (klass)) {
-               mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, NULL);
-               mono_error_set_type_load_class (&error, klass, "Not a valid enumeration");
-               goto failure_unlocked;
-       }
+                               nested_name = g_strdup (lastp + 1);
+                               nspace_len = lastp - (char*)mod->data;
+                               nested_nspace = (char *)g_malloc (nspace_len + 1);
+                               memcpy (nested_nspace, mod->data, nspace_len);
+                               nested_nspace [nspace_len] = '\0';
 
-       res = mono_type_get_object_checked (mono_object_domain (tb), &klass->byval_arg, &error);
-       if (!is_ok (&error))
-               goto failure_unlocked;
+                       } else {
+                               nested_name = (char *)mod->data;
+                               nested_nspace = NULL;
+                       }
 
-       g_assert (res != (MonoReflectionType*)tb);
+                       if (nested_nspace) {
+                               if (ignorecase) {
+                                       if (!(klass->name_space && mono_utf8_strcasecmp (klass->name_space, nested_nspace) == 0))
+                                               match = FALSE;
+                               } else {
+                                       if (!(klass->name_space && strcmp (klass->name_space, nested_nspace) == 0))
+                                               match = FALSE;
+                               }
+                       }
+                       if (match) {
+                               if (ignorecase) {
+                                       if (mono_utf8_strcasecmp (klass->name, nested_name) != 0)
+                                               match = FALSE;
+                               } else {
+                                       if (strcmp (klass->name, nested_name) != 0)
+                                               match = FALSE;
+                               }
+                       }
+                       if (lastp) {
+                               g_free (nested_name);
+                               g_free (nested_nspace);
+                       }
+                       if (match)
+                               break;
+               }
 
-       return res;
+               if (!klass)
+                       break;
+       }
+       if (!klass)
+               return NULL;
 
-failure:
-       mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, NULL);
-       klass->wastypebuilder = TRUE;
-       mono_domain_unlock (domain);
-       mono_loader_unlock ();
-failure_unlocked:
-       mono_error_set_pending_exception (&error);
-       return NULL;
-}
+       if (info->type_arguments) {
+               MonoType **type_args = g_new0 (MonoType *, info->type_arguments->len);
+               MonoReflectionType *the_type;
+               MonoType *instance;
+               int i;
 
-static gboolean
-reflection_initialize_generic_parameter (MonoReflectionGenericParam *gparam, MonoError *error)
-{
-       MonoGenericParamFull *param;
-       MonoImage *image;
-       MonoClass *pklass;
+               for (i = 0; i < info->type_arguments->len; i++) {
+                       MonoTypeNameParse *subinfo = (MonoTypeNameParse *)g_ptr_array_index (info->type_arguments, i);
 
-       mono_error_init (error);
+                       type_args [i] = _mono_reflection_get_type_from_info (subinfo, rootimage, ignorecase, error);
+                       if (!type_args [i]) {
+                               g_free (type_args);
+                               return NULL;
+                       }
+               }
 
-       image = &gparam->tbuilder->module->dynamic_image->image;
+               the_type = mono_type_get_object_checked (mono_domain_get (), &klass->byval_arg, error);
+               if (!the_type)
+                       return NULL;
 
-       param = mono_image_new0 (image, MonoGenericParamFull, 1);
+               instance = mono_reflection_bind_generic_parameters (
+                       the_type, info->type_arguments->len, type_args, error);
 
-       param->info.name = mono_string_to_utf8_image (image, gparam->name, error);
-       mono_error_assert_ok (error);
-       param->param.num = gparam->index;
+               g_free (type_args);
+               if (!instance)
+                       return NULL;
 
-       if (gparam->mbuilder) {
-               if (!gparam->mbuilder->generic_container) {
-                       MonoType *tb = mono_reflection_type_get_handle ((MonoReflectionType*)gparam->mbuilder->type, error);
-                       return_val_if_nok (error, FALSE);
+               klass = mono_class_from_mono_type (instance);
+       }
 
-                       MonoClass *klass = mono_class_from_mono_type (tb);
-                       gparam->mbuilder->generic_container = (MonoGenericContainer *)mono_image_alloc0 (klass->image, sizeof (MonoGenericContainer));
-                       gparam->mbuilder->generic_container->is_method = TRUE;
-                       /* 
-                        * Cannot set owner.method, since the MonoMethod is not created yet.
-                        * Set the image field instead, so type_in_image () works.
-                        */
-                       gparam->mbuilder->generic_container->is_anonymous = TRUE;
-                       gparam->mbuilder->generic_container->owner.image = klass->image;
-               }
-               param->param.owner = gparam->mbuilder->generic_container;
-       } else if (gparam->tbuilder) {
-               if (!gparam->tbuilder->generic_container) {
-                       MonoType *tb = mono_reflection_type_get_handle ((MonoReflectionType*)gparam->tbuilder, error);
-                       return_val_if_nok (error, FALSE);
-                       MonoClass *klass = mono_class_from_mono_type (tb);
-                       gparam->tbuilder->generic_container = (MonoGenericContainer *)mono_image_alloc0 (klass->image, sizeof (MonoGenericContainer));
-                       gparam->tbuilder->generic_container->owner.klass = klass;
+       for (mod = info->modifiers; mod; mod = mod->next) {
+               modval = GPOINTER_TO_UINT (mod->data);
+               if (!modval) { /* byref: must be last modifier */
+                       return &klass->this_arg;
+               } else if (modval == -1) {
+                       klass = mono_ptr_class_get (&klass->byval_arg);
+               } else if (modval == -2) {
+                       bounded = TRUE;
+               } else { /* array rank */
+                       klass = mono_bounded_array_class_get (klass, modval, bounded);
                }
-               param->param.owner = gparam->tbuilder->generic_container;
        }
 
-       pklass = mono_class_from_generic_parameter_internal ((MonoGenericParam *) param);
-
-       gparam->type.type = &pklass->byval_arg;
+       return &klass->byval_arg;
+}
 
-       mono_class_set_ref_info (pklass, gparam);
-       mono_image_append_class_to_reflection_info_set (pklass);
+/*
+ * mono_reflection_get_type:
+ * @image: a metadata context
+ * @info: type description structure
+ * @ignorecase: flag for case-insensitive string compares
+ * @type_resolve: whenever type resolve was already tried
+ *
+ * Build a MonoType from the type description in @info.
+ * 
+ */
 
-       return TRUE;
+MonoType*
+mono_reflection_get_type (MonoImage* image, MonoTypeNameParse *info, gboolean ignorecase, gboolean *type_resolve) {
+       MonoError error;
+       MonoType *result = mono_reflection_get_type_with_rootimage (image, image, info, ignorecase, type_resolve, &error);
+       mono_error_cleanup (&error);
+       return result;
 }
 
-void
-ves_icall_GenericTypeParameterBuilder_initialize_generic_parameter (MonoReflectionGenericParam *gparam)
-{
-       MonoError error;
-       (void) reflection_initialize_generic_parameter (gparam, &error);
-       mono_error_set_pending_exception (&error);
+/**
+ * mono_reflection_get_type_checked:
+ * @rootimage: the image of the currently active managed caller
+ * @image: a metadata context
+ * @info: type description structure
+ * @ignorecase: flag for case-insensitive string compares
+ * @type_resolve: whenever type resolve was already tried
+ * @error: set on error.
+ *
+ * Build a MonoType from the type description in @info. On failure returns NULL and sets @error.
+ *
+ */
+MonoType*
+mono_reflection_get_type_checked (MonoImage *rootimage, MonoImage* image, MonoTypeNameParse *info, gboolean ignorecase, gboolean *type_resolve, MonoError *error) {
+       mono_error_init (error);
+       return mono_reflection_get_type_with_rootimage (rootimage, image, info, ignorecase, type_resolve, error);
 }
 
 
-static MonoArray *
-reflection_sighelper_get_signature_local (MonoReflectionSigHelper *sig, MonoError *error)
+static MonoType*
+mono_reflection_get_type_internal_dynamic (MonoImage *rootimage, MonoAssembly *assembly, MonoTypeNameParse *info, gboolean ignorecase, MonoError *error)
 {
-       MonoReflectionModuleBuilder *module = sig->module;
-       MonoDynamicImage *assembly = module != NULL ? module->dynamic_image : NULL;
-       guint32 na = sig->arguments ? mono_array_length (sig->arguments) : 0;
-       guint32 buflen, i;
-       MonoArray *result;
-       SigBuffer buf;
+       MonoReflectionAssemblyBuilder *abuilder;
+       MonoType *type;
+       int i;
 
        mono_error_init (error);
+       g_assert (assembly_is_dynamic (assembly));
+       abuilder = (MonoReflectionAssemblyBuilder*)mono_assembly_get_object_checked (((MonoDynamicAssembly*)assembly)->domain, assembly, error);
+       if (!abuilder)
+               return NULL;
 
-       check_array_for_usertypes (sig->arguments, error);
-       return_val_if_nok (error, NULL);
-
-       sigbuffer_init (&buf, 32);
+       /* Enumerate all modules */
 
-       sigbuffer_add_value (&buf, 0x07);
-       sigbuffer_add_value (&buf, na);
-       if (assembly != NULL){
-               for (i = 0; i < na; ++i) {
-                       MonoReflectionType *type = mono_array_get (sig->arguments, MonoReflectionType*, i);
-                       encode_reflection_type (assembly, type, &buf, error);
-                       if (!is_ok (error)) goto fail;
+       type = NULL;
+       if (abuilder->modules) {
+               for (i = 0; i < mono_array_length (abuilder->modules); ++i) {
+                       MonoReflectionModuleBuilder *mb = mono_array_get (abuilder->modules, MonoReflectionModuleBuilder*, i);
+                       type = mono_reflection_get_type_internal (rootimage, &mb->dynamic_image->image, info, ignorecase, error);
+                       if (type)
+                               break;
+                       if (!mono_error_ok (error))
+                               return NULL;
                }
        }
 
-       buflen = buf.p - buf.buf;
-       result = mono_array_new_checked (mono_domain_get (), mono_defaults.byte_class, buflen, error);
-       if (!is_ok (error)) goto fail;
-       memcpy (mono_array_addr (result, char, 0), buf.buf, buflen);
-       sigbuffer_free (&buf);
-       return result;
-fail:
-       sigbuffer_free (&buf);
-       return NULL;
-}
+       if (!type && abuilder->loaded_modules) {
+               for (i = 0; i < mono_array_length (abuilder->loaded_modules); ++i) {
+                       MonoReflectionModule *mod = mono_array_get (abuilder->loaded_modules, MonoReflectionModule*, i);
+                       type = mono_reflection_get_type_internal (rootimage, mod->image, info, ignorecase, error);
+                       if (type)
+                               break;
+                       if (!mono_error_ok (error))
+                               return NULL;
+               }
+       }
 
-MonoArray *
-ves_icall_SignatureHelper_get_signature_local (MonoReflectionSigHelper *sig)
-{
-       MonoError error;
-       MonoArray *result = reflection_sighelper_get_signature_local (sig, &error);
-       mono_error_set_pending_exception (&error);
-       return result;
+       return type;
 }
-
-static MonoArray *
-reflection_sighelper_get_signature_field (MonoReflectionSigHelper *sig, MonoError *error)
+       
+MonoType*
+mono_reflection_get_type_with_rootimage (MonoImage *rootimage, MonoImage* image, MonoTypeNameParse *info, gboolean ignorecase, gboolean *type_resolve, MonoError *error)
 {
-       MonoDynamicImage *assembly = sig->module->dynamic_image;
-       guint32 na = sig->arguments ? mono_array_length (sig->arguments) : 0;
-       guint32 buflen, i;
-       MonoArray *result;
-       SigBuffer buf;
+       MonoType *type;
+       MonoReflectionAssembly *assembly;
+       GString *fullName;
+       GList *mod;
 
        mono_error_init (error);
 
-       check_array_for_usertypes (sig->arguments, error);
+       if (image && image_is_dynamic (image))
+               type = mono_reflection_get_type_internal_dynamic (rootimage, image->assembly, info, ignorecase, error);
+       else {
+               type = mono_reflection_get_type_internal (rootimage, image, info, ignorecase, error);
+       }
        return_val_if_nok (error, NULL);
 
-       sigbuffer_init (&buf, 32);
+       if (type)
+               return type;
+       if (!mono_domain_has_type_resolve (mono_domain_get ()))
+               return NULL;
 
-       sigbuffer_add_value (&buf, 0x06);
-       for (i = 0; i < na; ++i) {
-               MonoReflectionType *type = mono_array_get (sig->arguments, MonoReflectionType*, i);
-               encode_reflection_type (assembly, type, &buf, error);
-               if (!is_ok (error))
-                       goto fail;
+       if (type_resolve) {
+               if (*type_resolve) 
+                       return NULL;
+               else
+                       *type_resolve = TRUE;
        }
+       
+       /* Reconstruct the type name */
+       fullName = g_string_new ("");
+       if (info->name_space && (info->name_space [0] != '\0'))
+               g_string_printf (fullName, "%s.%s", info->name_space, info->name);
+       else
+               g_string_printf (fullName, "%s", info->name);
+       for (mod = info->nested; mod; mod = mod->next)
+               g_string_append_printf (fullName, "+%s", (char*)mod->data);
 
-       buflen = buf.p - buf.buf;
-       result = mono_array_new_checked (mono_domain_get (), mono_defaults.byte_class, buflen, error);
-       if (!is_ok (error)) goto fail;
-       memcpy (mono_array_addr (result, char, 0), buf.buf, buflen);
-       sigbuffer_free (&buf);
-
-       return result;
-fail:
-       sigbuffer_free (&buf);
-       return NULL;
-}
-
-MonoArray *
-ves_icall_SignatureHelper_get_signature_field (MonoReflectionSigHelper *sig)
-{
-       MonoError error;
-       MonoArray *result = reflection_sighelper_get_signature_field (sig, &error);
-       mono_error_set_pending_exception (&error);
-       return result;
-}
-
-typedef struct {
-       MonoMethod *handle;
-       MonoDomain *domain;
-} DynamicMethodReleaseData;
-
-/*
- * The runtime automatically clean up those after finalization.
-*/     
-static MonoReferenceQueue *dynamic_method_queue;
-
-static void
-free_dynamic_method (void *dynamic_method)
-{
-       DynamicMethodReleaseData *data = (DynamicMethodReleaseData *)dynamic_method;
-       MonoDomain *domain = data->domain;
-       MonoMethod *method = data->handle;
-       guint32 dis_link;
-
-       mono_domain_lock (domain);
-       dis_link = (guint32)(size_t)g_hash_table_lookup (domain->method_to_dyn_method, method);
-       g_hash_table_remove (domain->method_to_dyn_method, method);
-       mono_domain_unlock (domain);
-       g_assert (dis_link);
-       mono_gchandle_free (dis_link);
-
-       mono_runtime_free_method (domain, method);
-       g_free (data);
-}
-
-static gboolean
-reflection_create_dynamic_method (MonoReflectionDynamicMethod *mb, MonoError *error)
-{
-       MonoReferenceQueue *queue;
-       MonoMethod *handle;
-       DynamicMethodReleaseData *release_data;
-       ReflectionMethodBuilder rmb;
-       MonoMethodSignature *sig;
-       MonoClass *klass;
-       MonoDomain *domain;
-       GSList *l;
-       int i;
-
-       mono_error_init (error);
-
-       if (mono_runtime_is_shutting_down ()) {
-               mono_error_set_generic_error (error, "System", "InvalidOperationException", "");
-               return FALSE;
+       assembly = mono_domain_try_type_resolve_checked ( mono_domain_get (), fullName->str, NULL, error);
+       if (!is_ok (error)) {
+               g_string_free (fullName, TRUE);
+               return NULL;
        }
 
-       if (!(queue = dynamic_method_queue)) {
-               mono_loader_lock ();
-               if (!(queue = dynamic_method_queue))
-                       queue = dynamic_method_queue = mono_gc_reference_queue_new (free_dynamic_method);
-               mono_loader_unlock ();
+       if (assembly) {
+               if (assembly_is_dynamic (assembly->assembly))
+                       type = mono_reflection_get_type_internal_dynamic (rootimage, assembly->assembly,
+                                                                         info, ignorecase, error);
+               else
+                       type = mono_reflection_get_type_internal (rootimage, assembly->assembly->image, 
+                                                                 info, ignorecase, error);
        }
+       g_string_free (fullName, TRUE);
+       return_val_if_nok (error, NULL);
+       return type;
+}
 
-       sig = dynamic_method_to_signature (mb, error);
-       return_val_if_nok (error, FALSE);
-
-       reflection_methodbuilder_from_dynamic_method (&rmb, mb);
-
-       /*
-        * Resolve references.
-        */
-       /* 
-        * Every second entry in the refs array is reserved for storing handle_class,
-        * which is needed by the ldtoken implementation in the JIT.
-        */
-       rmb.nrefs = mb->nrefs;
-       rmb.refs = g_new0 (gpointer, mb->nrefs + 1);
-       for (i = 0; i < mb->nrefs; i += 2) {
-               MonoClass *handle_class;
-               gpointer ref;
-               MonoObject *obj = mono_array_get (mb->refs, MonoObject*, i);
-
-               if (strcmp (obj->vtable->klass->name, "DynamicMethod") == 0) {
-                       MonoReflectionDynamicMethod *method = (MonoReflectionDynamicMethod*)obj;
-                       /*
-                        * The referenced DynamicMethod should already be created by the managed
-                        * code, except in the case of circular references. In that case, we store
-                        * method in the refs array, and fix it up later when the referenced 
-                        * DynamicMethod is created.
-                        */
-                       if (method->mhandle) {
-                               ref = method->mhandle;
-                       } else {
-                               /* FIXME: GC object stored in unmanaged memory */
-                               ref = method;
+void
+mono_reflection_free_type_info (MonoTypeNameParse *info)
+{
+       g_list_free (info->modifiers);
+       g_list_free (info->nested);
 
-                               /* FIXME: GC object stored in unmanaged memory */
-                               method->referenced_by = g_slist_append (method->referenced_by, mb);
-                       }
-                       handle_class = mono_defaults.methodhandle_class;
-               } else {
-                       MonoException *ex = NULL;
-                       ref = resolve_object (mb->module->image, obj, &handle_class, NULL, error);
-                       if (!is_ok  (error)) {
-                               g_free (rmb.refs);
-                               return FALSE;
-                       }
-                       if (!ref)
-                               ex = mono_get_exception_type_load (NULL, NULL);
-                       else if (mono_security_core_clr_enabled ())
-                               ex = mono_security_core_clr_ensure_dynamic_method_resolved_object (ref, handle_class);
-
-                       if (ex) {
-                               g_free (rmb.refs);
-                               mono_error_set_exception_instance (error, ex);
-                               return FALSE;
-                       }
-               }
+       if (info->type_arguments) {
+               int i;
 
-               rmb.refs [i] = ref; /* FIXME: GC object stored in unmanaged memory (change also resolve_object() signature) */
-               rmb.refs [i + 1] = handle_class;
-       }               
+               for (i = 0; i < info->type_arguments->len; i++) {
+                       MonoTypeNameParse *subinfo = (MonoTypeNameParse *)g_ptr_array_index (info->type_arguments, i);
 
-       if (mb->owner) {
-               MonoType *owner_type = mono_reflection_type_get_handle ((MonoReflectionType*)mb->owner, error);
-               if (!is_ok (error)) {
-                       g_free (rmb.refs);
-                       return FALSE;
+                       mono_reflection_free_type_info (subinfo);
+                       /*We free the subinfo since it is allocated by _mono_reflection_parse_type*/
+                       g_free (subinfo);
                }
-               klass = mono_class_from_mono_type (owner_type);
-       } else {
-               klass = mono_defaults.object_class;
-       }
-
-       mb->mhandle = handle = reflection_methodbuilder_to_mono_method (klass, &rmb, sig, error);
-       g_free (rmb.refs);
-       return_val_if_nok (error, FALSE);
-
-       release_data = g_new (DynamicMethodReleaseData, 1);
-       release_data->handle = handle;
-       release_data->domain = mono_object_get_domain ((MonoObject*)mb);
-       if (!mono_gc_reference_queue_add (queue, (MonoObject*)mb, release_data))
-               g_free (release_data);
-
-       /* Fix up refs entries pointing at us */
-       for (l = mb->referenced_by; l; l = l->next) {
-               MonoReflectionDynamicMethod *method = (MonoReflectionDynamicMethod*)l->data;
-               MonoMethodWrapper *wrapper = (MonoMethodWrapper*)method->mhandle;
-               gpointer *data;
-               
-               g_assert (method->mhandle);
 
-               data = (gpointer*)wrapper->method_data;
-               for (i = 0; i < GPOINTER_TO_UINT (data [0]); i += 2) {
-                       if ((data [i + 1] == mb) && (data [i + 1 + 1] == mono_defaults.methodhandle_class))
-                               data [i + 1] = mb->mhandle;
-               }
+               g_ptr_array_free (info->type_arguments, TRUE);
        }
-       g_slist_free (mb->referenced_by);
-
-       /* ilgen is no longer needed */
-       mb->ilgen = NULL;
-
-       domain = mono_domain_get ();
-       mono_domain_lock (domain);
-       if (!domain->method_to_dyn_method)
-               domain->method_to_dyn_method = g_hash_table_new (NULL, NULL);
-       g_hash_table_insert (domain->method_to_dyn_method, handle, (gpointer)(size_t)mono_gchandle_new_weakref ((MonoObject *)mb, TRUE));
-       mono_domain_unlock (domain);
-
-       return TRUE;
-}
-
-void
-ves_icall_DynamicMethod_create_dynamic_method (MonoReflectionDynamicMethod *mb)
-{
-       MonoError error;
-       (void) reflection_create_dynamic_method (mb, &error);
-       mono_error_set_pending_exception (&error);
 }
 
-#endif /* DISABLE_REFLECTION_EMIT */
-
-/**
- * 
- * mono_reflection_is_valid_dynamic_token:
- * 
- * Returns TRUE if token is valid.
+/*
+ * mono_reflection_type_from_name:
+ * @name: type name.
+ * @image: a metadata context (can be NULL).
+ *
+ * Retrieves a MonoType from its @name. If the name is not fully qualified,
+ * it defaults to get the type from @image or, if @image is NULL or loading
+ * from it fails, uses corlib.
  * 
  */
-gboolean
-mono_reflection_is_valid_dynamic_token (MonoDynamicImage *image, guint32 token)
-{
-       return lookup_dyn_token (image, token) != NULL;
-}
-
-MonoMethodSignature *
-mono_reflection_lookup_signature (MonoImage *image, MonoMethod *method, guint32 token, MonoError *error)
+MonoType*
+mono_reflection_type_from_name (char *name, MonoImage *image)
 {
-       MonoMethodSignature *sig;
-       g_assert (image_is_dynamic (image));
-
-       mono_error_init (error);
-
-       sig = (MonoMethodSignature *)g_hash_table_lookup (((MonoDynamicImage*)image)->vararg_aux_hash, GUINT_TO_POINTER (token));
-       if (sig)
-               return sig;
-
-       return mono_method_signature_checked (method, error);
+       MonoError error;
+       MonoType  *result = mono_reflection_type_from_name_checked (name, image, &error);
+       mono_error_cleanup (&error);
+       return result;
 }
 
-#ifndef DISABLE_REFLECTION_EMIT
-
 /**
- * mono_reflection_lookup_dynamic_token:
- *
- * Finish the Builder object pointed to by TOKEN and return the corresponding
- * runtime structure. If HANDLE_CLASS is not NULL, it is set to the class required by 
- * mono_ldtoken. If valid_token is TRUE, assert if it is not found in the token->object
- * mapping table.
+ * mono_reflection_type_from_name_checked:
+ * @name: type name.
+ * @image: a metadata context (can be NULL).
+ * @error: set on errror.
  *
- * LOCKING: Take the loader lock
+ * Retrieves a MonoType from its @name. If the name is not fully qualified,
+ * it defaults to get the type from @image or, if @image is NULL or loading
+ * from it fails, uses corlib.  On failure returns NULL and sets @error.
+ * 
  */
-gpointer
-mono_reflection_lookup_dynamic_token (MonoImage *image, guint32 token, gboolean valid_token, MonoClass **handle_class, MonoGenericContext *context, MonoError *error)
+MonoType*
+mono_reflection_type_from_name_checked (char *name, MonoImage *image, MonoError *error)
 {
-       MonoDynamicImage *assembly = (MonoDynamicImage*)image;
-       MonoObject *obj;
-       MonoClass *klass;
+       MonoType *type = NULL;
+       MonoTypeNameParse info;
+       char *tmp;
 
        mono_error_init (error);
+       /* Make a copy since parse_type modifies its argument */
+       tmp = g_strdup (name);
        
-       obj = lookup_dyn_token (assembly, token);
-       if (!obj) {
-               if (valid_token)
-                       g_error ("Could not find required dynamic token 0x%08x", token);
-               else {
-                       mono_error_set_execution_engine (error, "Could not find dynamic token 0x%08x", token);
+       /*g_print ("requested type %s\n", str);*/
+       if (mono_reflection_parse_type (tmp, &info)) {
+               type = _mono_reflection_get_type_from_info (&info, image, FALSE, error);
+               if (!is_ok (error)) {
+                       g_free (tmp);
+                       mono_reflection_free_type_info (&info);
                        return NULL;
                }
        }
 
-       if (!handle_class)
-               handle_class = &klass;
-       gpointer result = resolve_object (image, obj, handle_class, context, error);
-       return result;
+       g_free (tmp);
+       mono_reflection_free_type_info (&info);
+       return type;
 }
 
 /*
- * ensure_complete_type:
+ * mono_reflection_get_token:
  *
- *   Ensure that KLASS is completed if it is a dynamic type, or references
- * dynamic types.
+ *   Return the metadata token of OBJ which should be an object
+ * representing a metadata element.
  */
-static void
-ensure_complete_type (MonoClass *klass, MonoError *error)
+guint32
+mono_reflection_get_token (MonoObject *obj)
 {
-       mono_error_init (error);
-
-       if (image_is_dynamic (klass->image) && !klass->wastypebuilder && mono_class_get_ref_info (klass)) {
-               MonoReflectionTypeBuilder *tb = (MonoReflectionTypeBuilder *)mono_class_get_ref_info (klass);
+       MonoError error;
+       guint32 result = mono_reflection_get_token_checked (obj, &error);
+       mono_error_assert_ok (&error);
+       return result;
+}
 
-               mono_domain_try_type_resolve_checked (mono_domain_get (), NULL, (MonoObject*)tb, error);
-               return_if_nok (error);
+/**
+ * mono_reflection_get_token_checked:
+ * @obj: the object
+ * @error: set on error
+ *
+ *   Return the metadata token of @obj which should be an object
+ * representing a metadata element.  On failure sets @error.
+ */
+guint32
+mono_reflection_get_token_checked (MonoObject *obj, MonoError *error)
+{
+       MonoClass *klass;
+       guint32 token = 0;
 
-               // Asserting here could break a lot of code
-               //g_assert (klass->wastypebuilder);
-       }
+       mono_error_init (error);
 
-       if (klass->generic_class) {
-               MonoGenericInst *inst = klass->generic_class->context.class_inst;
-               int i;
+       klass = obj->vtable->klass;
 
-               for (i = 0; i < inst->type_argc; ++i) {
-                       ensure_complete_type (mono_class_from_mono_type (inst->type_argv [i]), error);
-                       return_if_nok (error);
-               }
-       }
-}
+       if (strcmp (klass->name, "MethodBuilder") == 0) {
+               MonoReflectionMethodBuilder *mb = (MonoReflectionMethodBuilder *)obj;
 
-static gpointer
-resolve_object (MonoImage *image, MonoObject *obj, MonoClass **handle_class, MonoGenericContext *context, MonoError *error)
-{
-       gpointer result = NULL;
+               token = mb->table_idx | MONO_TOKEN_METHOD_DEF;
+       } else if (strcmp (klass->name, "ConstructorBuilder") == 0) {
+               MonoReflectionCtorBuilder *mb = (MonoReflectionCtorBuilder *)obj;
 
-       mono_error_init (error);
+               token = mb->table_idx | MONO_TOKEN_METHOD_DEF;
+       } else if (strcmp (klass->name, "FieldBuilder") == 0) {
+               MonoReflectionFieldBuilder *fb = (MonoReflectionFieldBuilder *)obj;
 
-       if (strcmp (obj->vtable->klass->name, "String") == 0) {
-               result = mono_string_intern_checked ((MonoString*)obj, error);
-               return_val_if_nok (error, NULL);
-               *handle_class = mono_defaults.string_class;
-               g_assert (result);
-       } else if (strcmp (obj->vtable->klass->name, "RuntimeType") == 0) {
+               token = fb->table_idx | MONO_TOKEN_FIELD_DEF;
+       } else if (strcmp (klass->name, "TypeBuilder") == 0) {
+               MonoReflectionTypeBuilder *tb = (MonoReflectionTypeBuilder *)obj;
+               token = tb->table_idx | MONO_TOKEN_TYPE_DEF;
+       } else if (strcmp (klass->name, "RuntimeType") == 0) {
                MonoType *type = mono_reflection_type_get_handle ((MonoReflectionType*)obj, error);
-               return_val_if_nok (error, NULL);
+               return_val_if_nok (error, 0);
                MonoClass *mc = mono_class_from_mono_type (type);
                if (!mono_class_init (mc)) {
                        mono_error_set_for_class_failure (error, mc);
-                       return NULL;
-               }
-
-               if (context) {
-                       MonoType *inflated = mono_class_inflate_generic_type_checked (type, context, error);
-                       return_val_if_nok (error, NULL);
-
-                       result = mono_class_from_mono_type (inflated);
-                       mono_metadata_free_type (inflated);
-               } else {
-                       result = mono_class_from_mono_type (type);
-               }
-               *handle_class = mono_defaults.typehandle_class;
-               g_assert (result);
-       } else if (strcmp (obj->vtable->klass->name, "MonoMethod") == 0 ||
-                  strcmp (obj->vtable->klass->name, "MonoCMethod") == 0 ||
-                  strcmp (obj->vtable->klass->name, "MonoGenericCMethod") == 0 ||
-                  strcmp (obj->vtable->klass->name, "MonoGenericMethod") == 0) {
-               result = ((MonoReflectionMethod*)obj)->method;
-               if (context) {
-                       result = mono_class_inflate_generic_method_checked ((MonoMethod *)result, context, error);
-                       mono_error_assert_ok (error);
-               }
-               *handle_class = mono_defaults.methodhandle_class;
-               g_assert (result);
-       } else if (strcmp (obj->vtable->klass->name, "MethodBuilder") == 0) {
-               MonoReflectionMethodBuilder *mb = (MonoReflectionMethodBuilder*)obj;
-               result = mb->mhandle;
-               if (!result) {
-                       /* Type is not yet created */
-                       MonoReflectionTypeBuilder *tb = (MonoReflectionTypeBuilder*)mb->type;
-
-                       mono_domain_try_type_resolve_checked (mono_domain_get (), NULL, (MonoObject*)tb, error);
-                       return_val_if_nok (error, NULL);
-
-                       /*
-                        * Hopefully this has been filled in by calling CreateType() on the
-                        * TypeBuilder.
-                        */
-                       /*
-                        * TODO: This won't work if the application finishes another 
-                        * TypeBuilder instance instead of this one.
-                        */
-                       result = mb->mhandle;
-               }
-               if (context) {
-                       result = mono_class_inflate_generic_method_checked ((MonoMethod *)result, context, error);
-                       mono_error_assert_ok (error);
-               }
-               *handle_class = mono_defaults.methodhandle_class;
-       } else if (strcmp (obj->vtable->klass->name, "ConstructorBuilder") == 0) {
-               MonoReflectionCtorBuilder *cb = (MonoReflectionCtorBuilder*)obj;
-
-               result = cb->mhandle;
-               if (!result) {
-                       MonoReflectionTypeBuilder *tb = (MonoReflectionTypeBuilder*)cb->type;
-
-                       mono_domain_try_type_resolve_checked (mono_domain_get (), NULL, (MonoObject*)tb, error);
-                       return_val_if_nok (error, NULL);
-                       result = cb->mhandle;
-               }
-               if (context) {
-                       result = mono_class_inflate_generic_method_checked ((MonoMethod *)result, context, error);
-                       mono_error_assert_ok (error);
-               }
-               *handle_class = mono_defaults.methodhandle_class;
-       } else if (strcmp (obj->vtable->klass->name, "MonoField") == 0) {
-               MonoClassField *field = ((MonoReflectionField*)obj)->field;
-
-               ensure_complete_type (field->parent, error);
-               return_val_if_nok (error, NULL);
-
-               if (context) {
-                       MonoType *inflated = mono_class_inflate_generic_type_checked (&field->parent->byval_arg, context, error);
-                       return_val_if_nok (error, NULL);
-
-                       MonoClass *klass = mono_class_from_mono_type (inflated);
-                       MonoClassField *inflated_field;
-                       gpointer iter = NULL;
-                       mono_metadata_free_type (inflated);
-                       while ((inflated_field = mono_class_get_fields (klass, &iter))) {
-                               if (!strcmp (field->name, inflated_field->name))
-                                       break;
-                       }
-                       g_assert (inflated_field && !strcmp (field->name, inflated_field->name));
-                       result = inflated_field;
-               } else {
-                       result = field;
-               }
-               *handle_class = mono_defaults.fieldhandle_class;
-               g_assert (result);
-       } else if (strcmp (obj->vtable->klass->name, "FieldBuilder") == 0) {
-               MonoReflectionFieldBuilder *fb = (MonoReflectionFieldBuilder*)obj;
-               result = fb->handle;
-
-               if (!result) {
-                       MonoReflectionTypeBuilder *tb = (MonoReflectionTypeBuilder*)fb->typeb;
-
-                       mono_domain_try_type_resolve_checked (mono_domain_get (), NULL, (MonoObject*)tb, error);
-                       return_val_if_nok (error, NULL);
-                       result = fb->handle;
-               }
-
-               if (fb->handle && fb->handle->parent->generic_container) {
-                       MonoClass *klass = fb->handle->parent;
-                       MonoType *type = mono_class_inflate_generic_type_checked (&klass->byval_arg, context, error);
-                       return_val_if_nok (error, NULL);
-
-                       MonoClass *inflated = mono_class_from_mono_type (type);
-
-                       result = mono_class_get_field_from_name (inflated, mono_field_get_name (fb->handle));
-                       g_assert (result);
-                       mono_metadata_free_type (type);
-               }
-               *handle_class = mono_defaults.fieldhandle_class;
-       } else if (strcmp (obj->vtable->klass->name, "TypeBuilder") == 0) {
-               MonoReflectionTypeBuilder *tb = (MonoReflectionTypeBuilder*)obj;
-               MonoType *type = mono_reflection_type_get_handle ((MonoReflectionType*)tb, error);
-               return_val_if_nok (error, NULL);
-               MonoClass *klass;
-
-               klass = type->data.klass;
-               if (klass->wastypebuilder) {
-                       /* Already created */
-                       result = klass;
-               }
-               else {
-                       mono_domain_try_type_resolve_checked (mono_domain_get (), NULL, (MonoObject*)tb, error);
-                       return_val_if_nok (error, NULL);
-                       result = type->data.klass;
-                       g_assert (result);
+                       return 0;
                }
-               *handle_class = mono_defaults.typehandle_class;
-       } else if (strcmp (obj->vtable->klass->name, "SignatureHelper") == 0) {
-               MonoReflectionSigHelper *helper = (MonoReflectionSigHelper*)obj;
-               MonoMethodSignature *sig;
-               int nargs, i;
-
-               if (helper->arguments)
-                       nargs = mono_array_length (helper->arguments);
-               else
-                       nargs = 0;
 
-               sig = mono_metadata_signature_alloc (image, nargs);
-               sig->explicit_this = helper->call_conv & 64 ? 1 : 0;
-               sig->hasthis = helper->call_conv & 32 ? 1 : 0;
-
-               if (helper->unmanaged_call_conv) { /* unmanaged */
-                       sig->call_convention = helper->unmanaged_call_conv - 1;
-                       sig->pinvoke = TRUE;
-               } else if (helper->call_conv & 0x02) {
-                       sig->call_convention = MONO_CALL_VARARG;
+               token = mc->type_token;
+       } else if (strcmp (klass->name, "MonoCMethod") == 0 ||
+                          strcmp (klass->name, "MonoMethod") == 0) {
+               MonoReflectionMethod *m = (MonoReflectionMethod *)obj;
+               if (m->method->is_inflated) {
+                       MonoMethodInflated *inflated = (MonoMethodInflated *) m->method;
+                       return inflated->declaring->token;
                } else {
-                       sig->call_convention = MONO_CALL_DEFAULT;
-               }
-
-               sig->param_count = nargs;
-               /* TODO: Copy type ? */
-               sig->ret = helper->return_type->type;
-               for (i = 0; i < nargs; ++i) {
-                       sig->params [i] = mono_type_array_get_and_resolve (helper->arguments, i, error);
-                       if (!is_ok (error)) {
-                               image_g_free (image, sig);
-                               return NULL;
-                       }
+                       token = m->method->token;
                }
+       } else if (strcmp (klass->name, "MonoField") == 0) {
+               MonoReflectionField *f = (MonoReflectionField*)obj;
 
-               result = sig;
-               *handle_class = NULL;
-       } else if (strcmp (obj->vtable->klass->name, "DynamicMethod") == 0) {
-               MonoReflectionDynamicMethod *method = (MonoReflectionDynamicMethod*)obj;
-               /* Already created by the managed code */
-               g_assert (method->mhandle);
-               result = method->mhandle;
-               *handle_class = mono_defaults.methodhandle_class;
-       } else if (strcmp (obj->vtable->klass->name, "GenericTypeParameterBuilder") == 0) {
-               MonoType *type = mono_reflection_type_get_handle ((MonoReflectionType*)obj, error);
-               return_val_if_nok (error, NULL);
-               type = mono_class_inflate_generic_type_checked (type, context, error);
-               return_val_if_nok (error, NULL);
-
-               result = mono_class_from_mono_type (type);
-               *handle_class = mono_defaults.typehandle_class;
-               g_assert (result);
-               mono_metadata_free_type (type);
-       } else if (strcmp (obj->vtable->klass->name, "MonoGenericClass") == 0) {
-               MonoType *type = mono_reflection_type_get_handle ((MonoReflectionType*)obj, error);
-               return_val_if_nok (error, NULL);
-               type = mono_class_inflate_generic_type_checked (type, context, error);
-               return_val_if_nok (error, NULL);
-
-               result = mono_class_from_mono_type (type);
-               *handle_class = mono_defaults.typehandle_class;
-               g_assert (result);
-               mono_metadata_free_type (type);
-       } else if (strcmp (obj->vtable->klass->name, "FieldOnTypeBuilderInst") == 0) {
-               MonoReflectionFieldOnTypeBuilderInst *f = (MonoReflectionFieldOnTypeBuilderInst*)obj;
-               MonoClass *inflated;
-               MonoType *type;
-               MonoClassField *field;
-
-               if (is_sre_field_builder (mono_object_class (f->fb)))
-                       field = ((MonoReflectionFieldBuilder*)f->fb)->handle;
-               else if (is_sr_mono_field (mono_object_class (f->fb)))
-                       field = ((MonoReflectionField*)f->fb)->field;
-               else
-                       g_error ("resolve_object:: can't handle a FTBI with base_method of type %s", mono_type_get_full_name (mono_object_class (f->fb)));
-
-               MonoType *finst = mono_reflection_type_get_handle ((MonoReflectionType*)f->inst, error);
-               return_val_if_nok (error, NULL);
-               type = mono_class_inflate_generic_type_checked (finst, context, error);
-               return_val_if_nok (error, NULL);
+               token = mono_class_get_field_token (f->field);
+       } else if (strcmp (klass->name, "MonoProperty") == 0) {
+               MonoReflectionProperty *p = (MonoReflectionProperty*)obj;
 
-               inflated = mono_class_from_mono_type (type);
+               token = mono_class_get_property_token (p->property);
+       } else if (strcmp (klass->name, "MonoEvent") == 0) {
+               MonoReflectionMonoEvent *p = (MonoReflectionMonoEvent*)obj;
 
-               result = field = mono_class_get_field_from_name (inflated, mono_field_get_name (field));
-               ensure_complete_type (field->parent, error);
-               if (!is_ok (error)) {
-                       mono_metadata_free_type (type);
-                       return NULL;
-               }
+               token = mono_class_get_event_token (p->event);
+       } else if (strcmp (klass->name, "ParameterInfo") == 0 || strcmp (klass->name, "MonoParameterInfo") == 0) {
+               MonoReflectionParameter *p = (MonoReflectionParameter*)obj;
+               MonoClass *member_class = mono_object_class (p->MemberImpl);
+               g_assert (mono_class_is_reflection_method_or_constructor (member_class));
 
-               g_assert (result);
-               mono_metadata_free_type (type);
-               *handle_class = mono_defaults.fieldhandle_class;
-       } else if (strcmp (obj->vtable->klass->name, "ConstructorOnTypeBuilderInst") == 0) {
-               MonoReflectionCtorOnTypeBuilderInst *c = (MonoReflectionCtorOnTypeBuilderInst*)obj;
-               MonoType *cinst = mono_reflection_type_get_handle ((MonoReflectionType*)c->inst, error);
-               return_val_if_nok (error, NULL);
-               MonoType *type = mono_class_inflate_generic_type_checked (cinst, context, error);
-               return_val_if_nok (error, NULL);
+               token = mono_method_get_param_token (((MonoReflectionMethod*)p->MemberImpl)->method, p->PositionImpl);
+       } else if (strcmp (klass->name, "Module") == 0 || strcmp (klass->name, "MonoModule") == 0) {
+               MonoReflectionModule *m = (MonoReflectionModule*)obj;
 
-               MonoClass *inflated_klass = mono_class_from_mono_type (type);
-               MonoMethod *method;
+               token = m->token;
+       } else if (strcmp (klass->name, "Assembly") == 0 || strcmp (klass->name, "MonoAssembly") == 0) {
+               token = mono_metadata_make_token (MONO_TABLE_ASSEMBLY, 1);
+       } else {
+               mono_error_set_not_implemented (error, "MetadataToken is not supported for type '%s.%s'",
+                                               klass->name_space, klass->name);
+               return 0;
+       }
 
-               if (is_sre_ctor_builder (mono_object_class (c->cb)))
-                       method = ((MonoReflectionCtorBuilder *)c->cb)->mhandle;
-               else if (is_sr_mono_cmethod (mono_object_class (c->cb)))
-                       method = ((MonoReflectionMethod *)c->cb)->method;
-               else
-                       g_error ("resolve_object:: can't handle a CTBI with base_method of type %s", mono_type_get_full_name (mono_object_class (c->cb)));
-
-               result = inflate_mono_method (inflated_klass, method, (MonoObject*)c->cb);
-               *handle_class = mono_defaults.methodhandle_class;
-               mono_metadata_free_type (type);
-       } else if (strcmp (obj->vtable->klass->name, "MethodOnTypeBuilderInst") == 0) {
-               MonoReflectionMethodOnTypeBuilderInst *m = (MonoReflectionMethodOnTypeBuilderInst*)obj;
-               if (m->method_args) {
-                       result = mono_reflection_method_on_tb_inst_get_handle (m, error);
-                       return_val_if_nok (error, NULL);
-                       if (context) {
-                               result = mono_class_inflate_generic_method_checked ((MonoMethod *)result, context, error);
-                               mono_error_assert_ok (error);
-                       }
-               } else {
-                       MonoType *minst = mono_reflection_type_get_handle ((MonoReflectionType*)m->inst, error);
-                       return_val_if_nok (error, NULL);
-                       MonoType *type = mono_class_inflate_generic_type_checked (minst, context, error);
-                       return_val_if_nok (error, NULL);
-
-                       MonoClass *inflated_klass = mono_class_from_mono_type (type);
-                       MonoMethod *method;
-
-                       if (is_sre_method_builder (mono_object_class (m->mb)))
-                               method = ((MonoReflectionMethodBuilder *)m->mb)->mhandle;
-                       else if (is_sr_mono_method (mono_object_class (m->mb)))
-                               method = ((MonoReflectionMethod *)m->mb)->method;
-                       else
-                               g_error ("resolve_object:: can't handle a MTBI with base_method of type %s", mono_type_get_full_name (mono_object_class (m->mb)));
+       return token;
+}
 
-                       result = inflate_mono_method (inflated_klass, method, (MonoObject*)m->mb);
-                       mono_metadata_free_type (type);
-               }
-               *handle_class = mono_defaults.methodhandle_class;
-       } else if (strcmp (obj->vtable->klass->name, "MonoArrayMethod") == 0) {
-               MonoReflectionArrayMethod *m = (MonoReflectionArrayMethod*)obj;
-               MonoType *mtype;
-               MonoClass *klass;
-               MonoMethod *method;
-               gpointer iter;
-               char *name;
 
-               mtype = mono_reflection_type_get_handle (m->parent, error);
-               return_val_if_nok (error, NULL);
-               klass = mono_class_from_mono_type (mtype);
+gboolean
+mono_reflection_is_usertype (MonoReflectionType *ref)
+{
+       MonoClass *klass = mono_object_class (ref);
+       return klass->image != mono_defaults.corlib || strcmp ("TypeDelegator", klass->name) == 0;
+}
 
-               /* Find the method */
+/**
+ * mono_reflection_bind_generic_parameters:
+ * @type: a managed type object (which should be some kind of generic (instance? definition?))
+ * @type_args: the number of type arguments to bind
+ * @types: array of type arguments
+ * @error: set on error
+ *
+ * Given a managed type object for a generic type instance, binds each of its arguments to the specified types.
+ * Returns the MonoType* for the resulting type instantiation.  On failure returns NULL and sets @error.
+ */
+MonoType*
+mono_reflection_bind_generic_parameters (MonoReflectionType *type, int type_argc, MonoType **types, MonoError *error)
+{
+       MonoClass *klass;
+       gboolean is_dynamic = FALSE;
+       MonoClass *geninst;
 
-               name = mono_string_to_utf8_checked (m->name, error);
-               return_val_if_nok (error, NULL);
-               iter = NULL;
-               while ((method = mono_class_get_methods (klass, &iter))) {
-                       if (!strcmp (method->name, name))
-                               break;
-               }
-               g_free (name);
+       mono_error_init (error);
+       
+       mono_loader_lock ();
 
-               // FIXME:
-               g_assert (method);
-               // FIXME: Check parameters/return value etc. match
-
-               result = method;
-               *handle_class = mono_defaults.methodhandle_class;
-       } else if (is_sre_array (mono_object_get_class(obj)) ||
-                               is_sre_byref (mono_object_get_class(obj)) ||
-                               is_sre_pointer (mono_object_get_class(obj))) {
-               MonoReflectionType *ref_type = (MonoReflectionType *)obj;
-               MonoType *type = mono_reflection_type_get_handle (ref_type, error);
-               return_val_if_nok (error, NULL);
+       if (mono_is_sre_type_builder (mono_object_class (type))) {
+               is_dynamic = TRUE;
+       } else if (mono_is_sre_generic_instance (mono_object_class (type))) {
+               MonoReflectionGenericClass *rgi = (MonoReflectionGenericClass *) type;
+               MonoReflectionType *gtd = rgi->generic_type;
 
-               if (context) {
-                       MonoType *inflated = mono_class_inflate_generic_type_checked (type, context, error);
-                       return_val_if_nok (error, NULL);
+               if (mono_is_sre_type_builder (mono_object_class (gtd)))
+                       is_dynamic = TRUE;
+       }
 
-                       result = mono_class_from_mono_type (inflated);
-                       mono_metadata_free_type (inflated);
-               } else {
-                       result = mono_class_from_mono_type (type);
-               }
-               *handle_class = mono_defaults.typehandle_class;
-       } else {
-               g_print ("%s\n", obj->vtable->klass->name);
-               g_assert_not_reached ();
+       MonoType *t = mono_reflection_type_get_handle (type, error);
+       if (!is_ok (error)) {
+               mono_loader_unlock ();
+               return NULL;
        }
-       return result;
-}
 
-#else /* DISABLE_REFLECTION_EMIT */
+       klass = mono_class_from_mono_type (t);
+       if (!mono_class_is_gtd (klass)) {
+               mono_loader_unlock ();
+               mono_error_set_type_load_class (error, klass, "Cannot bind generic parameters of a non-generic type");
+               return NULL;
+       }
 
-MonoArray*
-mono_reflection_get_custom_attrs_blob (MonoReflectionAssembly *assembly, MonoObject *ctor, MonoArray *ctorArgs, MonoArray *properties, MonoArray *propValues, MonoArray *fields, MonoArray* fieldValues) 
-{
-       g_assert_not_reached ();
-       return NULL;
-}
+       guint gtd_type_argc = mono_class_get_generic_container (klass)->type_argc;
+       if (gtd_type_argc != type_argc) {
+               mono_loader_unlock ();
+               mono_error_set_argument (error, "types", "The generic type definition needs %d type arguments, but was instantiated with %d ", gtd_type_argc, type_argc);
+               return NULL;
+       }
 
-void
-ves_icall_TypeBuilder_setup_internal_class (MonoReflectionTypeBuilder *tb)
-{
-       g_assert_not_reached ();
-}
 
-void
-ves_icall_TypeBuilder_setup_generic_class (MonoReflectionTypeBuilder *tb)
-{
-       g_assert_not_reached ();
-}
+       if (klass->wastypebuilder)
+               is_dynamic = TRUE;
 
-static gboolean
-mono_reflection_create_generic_class (MonoReflectionTypeBuilder *tb, MonoError *error)
-{
-       g_assert_not_reached ();
-       return FALSE;
-}
+       mono_loader_unlock ();
 
-void
-mono_reflection_create_internal_class (MonoReflectionTypeBuilder *tb)
-{
-       g_assert_not_reached ();
-}
+       geninst = mono_class_bind_generic_parameters (klass, type_argc, types, is_dynamic);
 
-static void
-mono_image_basic_init (MonoReflectionAssemblyBuilder *assemblyb)
-{
-       g_error ("This mono runtime was configured with --enable-minimal=reflection_emit, so System.Reflection.Emit is not supported.");
+       return &geninst->byval_arg;
 }
 
-static void
-mono_image_module_basic_init (MonoReflectionModuleBuilder *moduleb)
+MonoClass*
+mono_class_bind_generic_parameters (MonoClass *klass, int type_argc, MonoType **types, gboolean is_dynamic)
 {
-       g_assert_not_reached ();
-}
+       MonoGenericClass *gclass;
+       MonoGenericInst *inst;
 
-MonoReflectionModule *
-mono_image_load_module_dynamic (MonoReflectionAssemblyBuilder *ab, MonoString *fileName, MonoError *error)
-{
-       g_assert_not_reached ();
-       return NULL;
-}
+       g_assert (mono_class_is_gtd (klass));
 
-guint32
-mono_image_insert_string (MonoReflectionModuleBuilder *module, MonoString *str)
-{
-       g_assert_not_reached ();
-       return 0;
-}
+       inst = mono_metadata_get_generic_inst (type_argc, types);
+       gclass = mono_metadata_lookup_generic_class (klass, inst, is_dynamic);
 
-guint32
-mono_image_create_method_token (MonoDynamicImage *assembly, MonoObject *obj, MonoArray *opt_param_types, MonoError *error)
-{
-       g_assert_not_reached ();
-       return 0;
+       return mono_generic_class_get_class (gclass);
 }
 
-guint32
-mono_image_create_token (MonoDynamicImage *assembly, MonoObject *obj, 
-                        gboolean create_open_instance, gboolean register_token, MonoError *error)
+static MonoReflectionMethod*
+reflection_bind_generic_method_parameters (MonoReflectionMethod *rmethod, MonoArray *types, MonoError *error)
 {
-       g_assert_not_reached ();
-       return 0;
-}
+       MonoClass *klass;
+       MonoMethod *method, *inflated;
+       MonoMethodInflated *imethod;
+       MonoGenericContext tmp_context;
+       MonoGenericInst *ginst;
+       MonoType **type_argv;
+       int count, i;
 
-void
-mono_image_register_token (MonoDynamicImage *assembly, guint32 token, MonoObject *obj)
-{
-}
+       mono_error_init (error);
 
-void
-mono_reflection_generic_class_initialize (MonoReflectionGenericClass *type, MonoArray *fields)
-{
-       g_assert_not_reached ();
-}
+       g_assert (strcmp (rmethod->object.vtable->klass->name, "MethodBuilder"));
 
-void
-mono_reflection_get_dynamic_overrides (MonoClass *klass, MonoMethod ***overrides, int *num_overrides, MonoError *error)
-{
-       mono_error_init (error);
-       *overrides = NULL;
-       *num_overrides = 0;
-}
+       method = rmethod->method;
 
-MonoReflectionEvent *
-ves_icall_TypeBuilder_get_event_info (MonoReflectionTypeBuilder *tb, MonoReflectionEventBuilder *eb)
-{
-       g_assert_not_reached ();
-       return NULL;
-}
+       klass = method->klass;
 
-MonoReflectionType*
-ves_icall_TypeBuilder_create_runtime_class (MonoReflectionTypeBuilder *tb)
-{
-       g_assert_not_reached ();
-       return NULL;
-}
+       if (method->is_inflated)
+               method = ((MonoMethodInflated *) method)->declaring;
 
-void
-mono_reflection_initialize_generic_parameter (MonoReflectionGenericParam *gparam)
-{
-       g_assert_not_reached ();
-}
+       count = mono_method_signature (method)->generic_param_count;
+       if (count != mono_array_length (types))
+               return NULL;
 
-MonoArray *
-ves_icall_SignatureHelper_get_signature_local (MonoReflectionSigHelper *sig)
-{
-       g_assert_not_reached ();
-       return NULL;
-}
+       type_argv = g_new0 (MonoType *, count);
+       for (i = 0; i < count; i++) {
+               MonoReflectionType *garg = (MonoReflectionType *)mono_array_get (types, gpointer, i);
+               type_argv [i] = mono_reflection_type_get_handle (garg, error);
+               if (!is_ok (error)) {
+                       g_free (type_argv);
+                       return NULL;
+               }
+       }
+       ginst = mono_metadata_get_generic_inst (count, type_argv);
+       g_free (type_argv);
 
-MonoArray *
-ves_icall_SignatureHelper_get_signature_field (MonoReflectionSigHelper *sig)
-{
-       g_assert_not_reached ();
-       return NULL;
-}
+       tmp_context.class_inst = mono_class_is_ginst (klass) ? mono_class_get_generic_class (klass)->context.class_inst : NULL;
+       tmp_context.method_inst = ginst;
 
-void 
-ves_icall_DynamicMethod_create_dynamic_method (MonoReflectionDynamicMethod *mb)
-{
-}
+       inflated = mono_class_inflate_generic_method_checked (method, &tmp_context, error);
+       mono_error_assert_ok (error);
+       imethod = (MonoMethodInflated *) inflated;
 
-gpointer
-mono_reflection_lookup_dynamic_token (MonoImage *image, guint32 token, gboolean valid_token, MonoClass **handle_class, MonoGenericContext *context, MonoError *error)
-{
-       mono_error_init (error);
-       return NULL;
-}
+       /*FIXME but I think this is no longer necessary*/
+       if (image_is_dynamic (method->klass->image)) {
+               MonoDynamicImage *image = (MonoDynamicImage*)method->klass->image;
+               /*
+                * This table maps metadata structures representing inflated methods/fields
+                * to the reflection objects representing their generic definitions.
+                */
+               mono_image_lock ((MonoImage*)image);
+               mono_g_hash_table_insert (image->generic_def_objects, imethod, rmethod);
+               mono_image_unlock ((MonoImage*)image);
+       }
 
-MonoType*
-mono_reflection_type_get_handle (MonoReflectionType* ref, MonoError *error)
-{
-       mono_error_init (error);
-       if (!ref)
+       if (!mono_verifier_is_method_valid_generic_instantiation (inflated)) {
+               mono_error_set_argument (error, "typeArguments", "Invalid generic arguments");
                return NULL;
-       return ref->type;
+       }
+       
+       return mono_method_get_object_checked (mono_object_domain (rmethod), inflated, NULL, error);
 }
 
-void
-mono_reflection_free_dynamic_generic_class (MonoGenericClass *gclass)
+MonoReflectionMethod*
+ves_icall_MonoMethod_MakeGenericMethod_impl (MonoReflectionMethod *rmethod, MonoArray *types)
 {
-       g_assert_not_reached ();
+       MonoError error;
+       MonoReflectionMethod *result = reflection_bind_generic_method_parameters (rmethod, types, &error);
+       mono_error_set_pending_exception (&error);
+       return result;
 }
 
-#endif /* DISABLE_REFLECTION_EMIT */
 
 /* SECURITY_ACTION_* are defined in mono/metadata/tabledefs.h */
 const static guint32 declsec_flags_map[] = {
@@ -14548,8 +2367,9 @@ mono_declsec_flags_from_method (MonoMethod *method)
 guint32
 mono_declsec_flags_from_class (MonoClass *klass)
 {
-       if (klass->flags & TYPE_ATTRIBUTE_HAS_SECURITY) {
-               if (!klass->ext || !klass->ext->declsec_flags) {
+       if (mono_class_get_flags (klass) & TYPE_ATTRIBUTE_HAS_SECURITY) {
+               MonoClassExt *ext = mono_class_get_ext (klass);
+               if (!ext || !ext->declsec_flags) {
                        guint32 idx;
 
                        idx = mono_metadata_token_index (klass->type_token);
@@ -14557,11 +2377,12 @@ mono_declsec_flags_from_class (MonoClass *klass)
                        idx |= MONO_HAS_DECL_SECURITY_TYPEDEF;
                        mono_loader_lock ();
                        mono_class_alloc_ext (klass);
+                       ext = mono_class_get_ext (klass);
                        mono_loader_unlock ();
                        /* we cache the flags on classes */
-                       klass->ext->declsec_flags = mono_declsec_get_flags (klass->image, idx);
+                       ext->declsec_flags = mono_declsec_get_flags (klass->image, idx);
                }
-               return klass->ext->declsec_flags;
+               return ext->declsec_flags;
        }
        return 0;
 }
@@ -14945,207 +2766,14 @@ mono_reflection_assembly_get_assembly (MonoReflectionAssembly *refassembly)
        return refassembly->assembly;
 }
 
-gint32
-ves_icall_ModuleBuilder_getToken (MonoReflectionModuleBuilder *mb, MonoObject *obj, gboolean create_open_instance)
-{
-       MONO_CHECK_ARG_NULL (obj, 0);
-
-       MonoError error;
-       gint32 result = mono_image_create_token (mb->dynamic_image, obj, create_open_instance, TRUE, &error);
-       mono_error_set_pending_exception (&error);
-       return result;
-}
-
-gint32
-ves_icall_ModuleBuilder_getMethodToken (MonoReflectionModuleBuilder *mb,
-                                       MonoReflectionMethod *method,
-                                       MonoArray *opt_param_types)
-{
-       MONO_CHECK_ARG_NULL (method, 0);
-
-       MonoError error;
-       gint32 result = mono_image_create_method_token (
-               mb->dynamic_image, (MonoObject *) method, opt_param_types, &error);
-       mono_error_set_pending_exception (&error);
-       return result;
-}
-
-void
-ves_icall_ModuleBuilder_WriteToFile (MonoReflectionModuleBuilder *mb, HANDLE file)
-{
-       MonoError error;
-       mono_image_create_pefile (mb, file, &error);
-       mono_error_set_pending_exception (&error);
-}
-
-void
-ves_icall_ModuleBuilder_build_metadata (MonoReflectionModuleBuilder *mb)
-{
-       MonoError error;
-       mono_image_build_metadata (mb, &error);
-       mono_error_set_pending_exception (&error);
-}
-
-void
-ves_icall_ModuleBuilder_RegisterToken (MonoReflectionModuleBuilder *mb, MonoObject *obj, guint32 token)
-{
-       mono_image_register_token (mb->dynamic_image, token, obj);
-}
-
-MonoObject*
-ves_icall_ModuleBuilder_GetRegisteredToken (MonoReflectionModuleBuilder *mb, guint32 token)
-{
-       MonoObject *obj;
-
-       mono_loader_lock ();
-       obj = (MonoObject *)mono_g_hash_table_lookup (mb->dynamic_image->tokens, GUINT_TO_POINTER (token));
-       mono_loader_unlock ();
-
-       return obj;
-}
-
-MonoReflectionModule*
-ves_icall_AssemblyBuilder_InternalAddModule (MonoReflectionAssemblyBuilder *ab, MonoString *fileName)
-{
-       MonoError error;
-       MonoReflectionModule *result = mono_image_load_module_dynamic (ab, fileName, &error);
-       mono_error_set_pending_exception (&error);
-       return result;
-}
-
 /**
- * ves_icall_TypeBuilder_create_generic_class:
- * @tb: a TypeBuilder object
+ * mono_class_from_mono_type_handle:
+ * @reftype: the System.Type handle
  *
- * (icall)
- * Creates the generic class after all generic parameters have been added.
+ * Returns the MonoClass* corresponding to the given type.
  */
-void
-ves_icall_TypeBuilder_create_generic_class (MonoReflectionTypeBuilder *tb)
-{
-       MonoError error;
-       (void) mono_reflection_create_generic_class (tb, &error);
-       mono_error_set_pending_exception (&error);
-}
-
-#ifndef DISABLE_REFLECTION_EMIT
-MonoArray*
-ves_icall_CustomAttributeBuilder_GetBlob (MonoReflectionAssembly *assembly, MonoObject *ctor, MonoArray *ctorArgs, MonoArray *properties, MonoArray *propValues, MonoArray *fields, MonoArray* fieldValues)
-{
-       MonoError error;
-       MonoArray *result = mono_reflection_get_custom_attrs_blob_checked (assembly, ctor, ctorArgs, properties, propValues, fields, fieldValues, &error);
-       mono_error_set_pending_exception (&error);
-       return result;
-}
-#endif
-
-void
-ves_icall_AssemblyBuilder_basic_init (MonoReflectionAssemblyBuilder *assemblyb)
-{
-       mono_image_basic_init (assemblyb);
-}
-
-MonoBoolean
-ves_icall_TypeBuilder_get_IsGenericParameter (MonoReflectionTypeBuilder *tb)
-{
-       return is_generic_parameter (tb->type.type);
-}
-
-void
-ves_icall_EnumBuilder_setup_enum_type (MonoReflectionType *enumtype,
-                                                                          MonoReflectionType *t)
-{
-       enumtype->type = t->type;
-}
-
-MonoReflectionType*
-ves_icall_ModuleBuilder_create_modified_type (MonoReflectionTypeBuilder *tb, MonoString *smodifiers)
-{
-       MonoError error;
-       MonoReflectionType *ret;
-       MonoClass *klass;
-       int isbyref = 0, rank;
-       char *p;
-       char *str = mono_string_to_utf8_checked (smodifiers, &error);
-       if (mono_error_set_pending_exception (&error))
-               return NULL;
-
-       klass = mono_class_from_mono_type (tb->type.type);
-       p = str;
-       /* logic taken from mono_reflection_parse_type(): keep in sync */
-       while (*p) {
-               switch (*p) {
-               case '&':
-                       if (isbyref) { /* only one level allowed by the spec */
-                               g_free (str);
-                               return NULL;
-                       }
-                       isbyref = 1;
-                       p++;
-
-                       g_free (str);
-
-                       ret = mono_type_get_object_checked (mono_object_domain (tb), &klass->this_arg, &error);
-                       mono_error_set_pending_exception (&error);
-
-                       return ret;
-               case '*':
-                       klass = mono_ptr_class_get (&klass->byval_arg);
-                       mono_class_init (klass);
-                       p++;
-                       break;
-               case '[':
-                       rank = 1;
-                       p++;
-                       while (*p) {
-                               if (*p == ']')
-                                       break;
-                               if (*p == ',')
-                                       rank++;
-                               else if (*p != '*') { /* '*' means unknown lower bound */
-                                       g_free (str);
-                                       return NULL;
-                               }
-                               ++p;
-                       }
-                       if (*p != ']') {
-                               g_free (str);
-                               return NULL;
-                       }
-                       p++;
-                       klass = mono_array_class_get (klass, rank);
-                       mono_class_init (klass);
-                       break;
-               default:
-                       break;
-               }
-       }
-
-       g_free (str);
-
-       ret = mono_type_get_object_checked (mono_object_domain (tb), &klass->byval_arg, &error);
-       mono_error_set_pending_exception (&error);
-
-       return ret;
-}
-
-void
-ves_icall_ModuleBuilder_basic_init (MonoReflectionModuleBuilder *moduleb)
-{
-       mono_image_module_basic_init (moduleb);
-}
-
-guint32
-ves_icall_ModuleBuilder_getUSIndex (MonoReflectionModuleBuilder *module, MonoString *str)
-{
-       return mono_image_insert_string (module, str);
-}
-
-void
-ves_icall_ModuleBuilder_set_wrappers_type (MonoReflectionModuleBuilder *moduleb, MonoReflectionType *type)
+MonoClass*
+mono_class_from_mono_type_handle (MonoReflectionTypeHandle reftype)
 {
-       MonoDynamicImage *image = moduleb->dynamic_image;
-
-       g_assert (type->type);
-       image->wrappers_type = mono_class_from_mono_type (type->type);
+       return mono_class_from_mono_type (MONO_HANDLE_RAW (reftype)->type);
 }
index 7484759db58c9288cd269392cbf5a565e0880ac5..80e334ed349d31f8c6c511f0b35cf0dd2b3a53b9 100644 (file)
@@ -102,6 +102,7 @@ MONO_API MonoCustomAttrInfo* mono_custom_attrs_from_field    (MonoClass *klass,
 MONO_RT_EXTERNAL_ONLY
 MONO_API MonoCustomAttrInfo* mono_custom_attrs_from_param    (MonoMethod *method, uint32_t param);
 MONO_API mono_bool           mono_custom_attrs_has_attr      (MonoCustomAttrInfo *ainfo, MonoClass *attr_klass);
+MONO_RT_EXTERNAL_ONLY
 MONO_API MonoObject*         mono_custom_attrs_get_attr      (MonoCustomAttrInfo *ainfo, MonoClass *attr_klass);
 MONO_API void                mono_custom_attrs_free          (MonoCustomAttrInfo *ainfo);
 
index 30595ee5410e1a43cf886966b5e7175899ccf2ff..a29cf91a1cc2fb23cdd1dc9400203e7107d8ac36 100644 (file)
@@ -197,7 +197,10 @@ mono_remoting_marshal_init (void)
                register_icall (mono_marshal_xdomain_copy_out_value, "mono_marshal_xdomain_copy_out_value", "void object object", FALSE);
                register_icall (mono_remoting_wrapper, "mono_remoting_wrapper", "object ptr ptr", FALSE);
                register_icall (mono_upgrade_remote_class_wrapper, "mono_upgrade_remote_class_wrapper", "void object object", FALSE);
+
+#ifndef DISABLE_JIT
                register_icall (mono_compile_method_icall, "mono_compile_method_icall", "ptr ptr", FALSE);
+#endif
 
        }
 
index e3143cc564f100c57a79be6b7903fd167127eaaf..f817f956297457016c5c2a7665d87b96fdd59da1 100644 (file)
@@ -160,13 +160,13 @@ set_type_load_exception_type (const char *format, MonoClass *klass)
 {
        char *type_name = mono_type_get_full_name (klass);
        char *parent_name = mono_type_get_full_name (klass->parent);
-       char *message = g_strdup_printf (format, type_name, parent_name);
+       char *message = mono_image_strdup_printf (klass->image, format, type_name, parent_name);
 
        g_free (parent_name);
        g_free (type_name);
        
-       mono_trace (G_LOG_LEVEL_WARNING, MONO_TRACE_SECURITY, message);
-       mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, message);
+       mono_trace (G_LOG_LEVEL_WARNING, MONO_TRACE_SECURITY, "%s", message);
+       mono_class_set_type_load_failure (klass, "%s", message);
        // note: do not free string given to mono_class_set_failure
 }
 
@@ -183,13 +183,13 @@ set_type_load_exception_methods (const char *format, MonoMethod *override, MonoM
 {
        char *method_name = get_method_full_name (override);
        char *base_name = get_method_full_name (base);
-       char *message = g_strdup_printf (format, method_name, base_name);
+       char *message = mono_image_strdup_printf (override->klass->image, format, method_name, base_name);
 
        g_free (base_name);
        g_free (method_name);
 
-       mono_trace (G_LOG_LEVEL_WARNING, MONO_TRACE_SECURITY, message);
-       mono_class_set_failure (override->klass, MONO_EXCEPTION_TYPE_LOAD, message);
+       mono_trace (G_LOG_LEVEL_WARNING, MONO_TRACE_SECURITY, "%s", message);
+       mono_class_set_type_load_failure (override->klass, "%s", message);
        // note: do not free string given to mono_class_set_failure
 }
 
@@ -206,7 +206,8 @@ get_default_ctor (MonoClass *klass)
        if (!klass->methods)
                return NULL;
 
-       for (i = 0; i < klass->method.count; ++i) {
+       int mcount = mono_class_get_method_count (klass);
+       for (i = 0; i < mcount; ++i) {
                MonoMethodSignature *sig;
                MonoMethod *method = klass->methods [i];
 
@@ -561,7 +562,7 @@ get_argument_exception (const char *format, MonoMethod *caller, MonoMethod *call
        g_free (callee_name);
        g_free (caller_name);
 
-       mono_trace (G_LOG_LEVEL_WARNING, MONO_TRACE_SECURITY, message);
+       mono_trace (G_LOG_LEVEL_WARNING, MONO_TRACE_SECURITY, "%s", message);
        ex = mono_get_exception_argument ("method", message);
        g_free (message);
 
@@ -586,7 +587,7 @@ get_field_access_exception (const char *format, MonoMethod *caller, MonoClassFie
        g_free (field_name);
        g_free (caller_name);
 
-       mono_trace (G_LOG_LEVEL_WARNING, MONO_TRACE_SECURITY, message);
+       mono_trace (G_LOG_LEVEL_WARNING, MONO_TRACE_SECURITY, "%s", message);
        ex = mono_get_exception_field_access_msg (message);
        g_free (message);
 
@@ -611,7 +612,7 @@ get_method_access_exception (const char *format, MonoMethod *caller, MonoMethod
        g_free (callee_name);
        g_free (caller_name);
 
-       mono_trace (G_LOG_LEVEL_WARNING, MONO_TRACE_SECURITY, message);
+       mono_trace (G_LOG_LEVEL_WARNING, MONO_TRACE_SECURITY, "%s", message);
        ex = mono_get_exception_method_access_msg (message);
        g_free (message);
 
index b6b594071296138a7fed75f03e6d122a98c82767..4f996c727d73161c972cb8a5af4fcfef55060258 100644 (file)
@@ -450,6 +450,7 @@ mono_seq_point_data_write (SeqPointData *data, char *path)
 
        fwrite (buffer_orig, 1, buffer - buffer_orig, f);
        g_free (buffer_orig);
+       fclose (f);
 
        return TRUE;
 }
index 0597bdd7882fdd994391eadbe65c84ca58c0c181..09224b2f15be171f37d2107b293af76b76c47d38 100644 (file)
@@ -33,9 +33,16 @@ void sgen_bridge_describe_pointer (GCObject *object);
 gboolean sgen_is_bridge_object (GCObject *obj);
 void sgen_mark_bridge_object (GCObject *obj);
 
+gboolean sgen_bridge_handle_gc_param (const char *opt);
 gboolean sgen_bridge_handle_gc_debug (const char *opt);
 void sgen_bridge_print_gc_debug_usage (void);
 
+typedef struct {
+       char *dump_prefix;
+       gboolean accounting;
+       gboolean scc_precise_merge; // Used by Tarjan
+} SgenBridgeProcessorConfig;
+
 typedef struct {
        void (*reset_data) (void);
        void (*processing_stw_step) (void);
@@ -44,10 +51,9 @@ typedef struct {
        MonoGCBridgeObjectKind (*class_kind) (MonoClass *klass);
        void (*register_finalized_object) (GCObject *object);
        void (*describe_pointer) (GCObject *object);
-       void (*enable_accounting) (void);
 
-       // Optional-- used for debugging
-       void (*set_dump_prefix) (const char *prefix);
+       /* Should be called once, immediately after init */
+       void (*set_config) (const SgenBridgeProcessorConfig *);
 
        /*
         * These are set by processing_build_callback_data().
index 006e68c50121f32e9de1a776a9f164ead82907dd..7ec2d4386dfb5f4934169182128e402931b4f397 100644 (file)
@@ -33,6 +33,8 @@ typedef enum {
 static BridgeProcessorSelection bridge_processor_selection = BRIDGE_PROCESSOR_DEFAULT;
 // Most recently requested callbacks
 static MonoGCBridgeCallbacks pending_bridge_callbacks;
+// Configuration to be passed to bridge processor after init
+static SgenBridgeProcessorConfig bridge_processor_config;
 // Currently-in-use callbacks
 MonoGCBridgeCallbacks bridge_callbacks;
 
@@ -84,6 +86,12 @@ bridge_processor_name (const char *name)
        }
 }
 
+static gboolean
+bridge_processor_started ()
+{
+       return bridge_processor.reset_data != NULL;
+}
+
 // Initialize a single bridge processor
 static void
 init_bridge_processor (SgenBridgeProcessor *processor, BridgeProcessorSelection selection)
@@ -133,9 +141,17 @@ sgen_init_bridge ()
                bridge_callbacks = pending_bridge_callbacks;
 
                // If a bridge was registered but there is no bridge processor yet
-               if (bridge_callbacks.cross_references && !bridge_processor.reset_data)
+               if (bridge_callbacks.cross_references && !bridge_processor_started ()) {
                        init_bridge_processor (&bridge_processor, bridge_processor_selection);
 
+                       if (bridge_processor.set_config)
+                               bridge_processor.set_config (&bridge_processor_config);
+
+                       // Config is no longer needed so free its memory
+                       free (bridge_processor_config.dump_prefix);
+                       bridge_processor_config.dump_prefix = NULL;
+               }
+
                sgen_gc_unlock ();
        }
 }
@@ -147,7 +163,7 @@ sgen_set_bridge_implementation (const char *name)
 
        if (selection == BRIDGE_PROCESSOR_INVALID)
                g_warning ("Invalid value for bridge processor implementation, valid values are: 'new', 'old' and 'tarjan'.");
-       else if (bridge_processor.reset_data)
+       else if (bridge_processor_started ())
                g_warning ("Cannot set bridge processor implementation once bridge has already started");
        else
                bridge_processor_selection = selection;
@@ -480,12 +496,9 @@ sgen_bridge_describe_pointer (GCObject *obj)
 static void
 set_dump_prefix (const char *prefix)
 {
-       if (!bridge_processor.set_dump_prefix) {
-               fprintf (stderr, "Warning: Bridge implementation does not support dumping - ignoring.\n");
-               return;
-       }
-
-       bridge_processor.set_dump_prefix (prefix);
+       if (bridge_processor_config.dump_prefix)
+               free (bridge_processor_config.dump_prefix);
+       bridge_processor_config.dump_prefix = strdup (prefix);
 }
 
 /* Test support code */
@@ -652,22 +665,39 @@ register_test_bridge_callbacks (const char *bridge_class_name)
        mono_gc_register_bridge_callbacks (&callbacks);
 }
 
+gboolean
+sgen_bridge_handle_gc_param (const char *opt)
+{
+       g_assert (!bridge_processor_started ());
+
+       if (!strcmp (opt, "bridge-require-precise-merge")) {
+               bridge_processor_config.scc_precise_merge = TRUE;
+       } else {
+               return FALSE;
+       }
+
+       return TRUE;
+}
+
 gboolean
 sgen_bridge_handle_gc_debug (const char *opt)
 {
+       g_assert (!bridge_processor_started ());
+
        if (g_str_has_prefix (opt, "bridge=")) {
                opt = strchr (opt, '=') + 1;
                register_test_bridge_callbacks (g_strdup (opt));
        } else if (!strcmp (opt, "enable-bridge-accounting")) {
-               bridge_processor.enable_accounting ();
+               bridge_processor_config.accounting = TRUE;
        } else if (g_str_has_prefix (opt, "bridge-dump=")) {
                char *prefix = strchr (opt, '=') + 1;
-               set_dump_prefix (prefix);
+               set_dump_prefix(prefix);
        } else if (g_str_has_prefix (opt, "bridge-compare-to=")) {
                const char *name = strchr (opt, '=') + 1;
                BridgeProcessorSelection selection = bridge_processor_name (name);
 
                if (selection != BRIDGE_PROCESSOR_INVALID) {
+                       // Compare processor doesn't get config
                        init_bridge_processor (&compare_to_bridge_processor, selection);
                } else {
                        g_warning ("Invalid bridge implementation to compare against - ignoring.");
index b11df8a17b5e39d83ef82e05e98ca52c5125cf87..a03b0a81bfd508c93bcc82afa65aa3ff6e4ae3da 100644 (file)
@@ -17,8 +17,8 @@
  * When SGen is done marking, it puts together a list of all dead bridged
  * objects.  This is passed to the bridge processor, which does an analysis to
  * simplify the graph: It replaces strongly-connected components with single
- * nodes, and then removes any nodes corresponding to components which do not
- * contain bridged objects.
+ * nodes, and may remove nodes corresponding to components which do not contain
+ * bridged objects.
  *
  * The output of the SCC analysis is passed to the client's `cross_references()`
  * callback.  This consists of 2 arrays, an array of SCCs (MonoGCBridgeSCC),
@@ -54,7 +54,7 @@
 MONO_BEGIN_DECLS
 
 enum {
-       SGEN_BRIDGE_VERSION = 4
+       SGEN_BRIDGE_VERSION = 5
 };
        
 typedef enum {
index 332ed1df8f69815856f3e4af7d43b2167692664b..cb60f3b58ec2b86b58701a4fb1e194a177135c2e 100644 (file)
@@ -39,9 +39,6 @@ struct _SgenClientThreadInfo {
        gboolean skip, suspend_done;
        volatile int in_critical_region;
 
-       gpointer stopped_ip;    /* only valid if the thread is stopped */
-       MonoDomain *stopped_domain; /* dsto */
-
        /*
        This is set the argument of mono_gc_set_skip_thread.
 
@@ -84,6 +81,7 @@ extern void mono_sgen_init_stw (void);
 
 enum {
        INTERNAL_MEM_EPHEMERON_LINK = INTERNAL_MEM_FIRST_CLIENT,
+       INTERNAL_MEM_MOVED_OBJECT,
        INTERNAL_MEM_MAX
 };
 
@@ -699,11 +697,6 @@ sgen_client_binary_protocol_pin_stats (int objects_pinned_in_nursery, size_t byt
 {
 }
 
-int sgen_thread_handshake (BOOL suspend);
-gboolean sgen_suspend_thread (SgenThreadInfo *info);
-gboolean sgen_resume_thread (SgenThreadInfo *info);
-void sgen_wait_for_suspend_ack (int count);
-
 #ifdef HAVE_KW_THREAD
 extern __thread SgenThreadInfo *sgen_thread_info;
 #define TLAB_ACCESS_INIT
index 5c3d772c9facfac1cf717ac952192f0324739f8d..26e6a089b5dbb987e5d5cb6af8efc54b7c63eca1 100644 (file)
@@ -16,6 +16,7 @@
 #include "sgen/sgen-client.h"
 #include "sgen/sgen-cardtable.h"
 #include "sgen/sgen-pinning.h"
+#include "sgen/sgen-thread-pool.h"
 #include "metadata/marshal.h"
 #include "metadata/method-builder.h"
 #include "metadata/abi-details.h"
@@ -28,6 +29,7 @@
 #include "utils/mono-logger-internals.h"
 #include "utils/mono-threads-coop.h"
 #include "sgen/sgen-thread-pool.h"
+#include "utils/mono-threads.h"
 
 #ifdef HEAVY_STATISTICS
 static guint64 stat_wbarrier_set_arrayref = 0;
@@ -183,19 +185,57 @@ mono_gc_wbarrier_value_copy_bitmap (gpointer _dest, gpointer _src, int size, uns
        sgen_wbarrier_value_copy_bitmap (_dest, _src, size, bitmap);
 }
 
+int
+mono_gc_get_suspend_signal (void)
+{
+       return mono_threads_suspend_get_suspend_signal ();
+}
+
+int
+mono_gc_get_restart_signal (void)
+{
+       return mono_threads_suspend_get_restart_signal ();
+}
+
 static MonoMethod *write_barrier_conc_method;
 static MonoMethod *write_barrier_noconc_method;
 
 gboolean
 sgen_is_critical_method (MonoMethod *method)
 {
-       return (method == write_barrier_conc_method || method == write_barrier_noconc_method || sgen_is_managed_allocator (method));
+       return sgen_is_managed_allocator (method);
 }
 
 gboolean
 sgen_has_critical_method (void)
 {
-       return write_barrier_conc_method || write_barrier_noconc_method || sgen_has_managed_allocator ();
+       return sgen_has_managed_allocator ();
+}
+
+static gboolean
+ip_in_critical_region (MonoDomain *domain, gpointer ip)
+{
+       MonoJitInfo *ji;
+       MonoMethod *method;
+
+       /*
+        * We pass false for 'try_aot' so this becomes async safe.
+        * It won't find aot methods whose jit info is not yet loaded,
+        * so we preload their jit info in the JIT.
+        */
+       ji = mono_jit_info_table_find_internal (domain, ip, FALSE, FALSE);
+       if (!ji)
+               return FALSE;
+
+       method = mono_jit_info_get_method (ji);
+
+       return mono_runtime_is_critical_method (method) || sgen_is_critical_method (method);
+}
+
+gboolean
+mono_gc_is_critical_method (MonoMethod *method)
+{
+       return sgen_is_critical_method (method);
 }
 
 #ifndef DISABLE_JIT
@@ -491,7 +531,7 @@ mono_gc_invoke_finalizers (void)
        return sgen_gc_invoke_finalizers ();
 }
 
-gboolean
+MonoBoolean
 mono_gc_pending_finalizers (void)
 {
        return sgen_have_pending_finalizers ();
@@ -731,18 +771,6 @@ mono_gc_ephemeron_array_add (MonoObject *obj)
  * Appdomain handling
  */
 
-void
-mono_gc_set_current_thread_appdomain (MonoDomain *domain)
-{
-       SgenThreadInfo *info = mono_thread_info_current ();
-
-       /* Could be called from sgen_thread_unregister () with a NULL info */
-       if (domain) {
-               g_assert (info);
-               info->client_info.stopped_domain = domain;
-       }
-}
-
 static gboolean
 need_remove_object_for_domain (GCObject *start, MonoDomain *domain)
 {
@@ -917,20 +945,12 @@ mono_gc_clear_domain (MonoDomain * domain)
  * Allocation
  */
 
-static gboolean alloc_events = FALSE;
-
-void
-mono_gc_enable_alloc_events (void)
-{
-       alloc_events = TRUE;
-}
-
 void*
 mono_gc_alloc_obj (MonoVTable *vtable, size_t size)
 {
        MonoObject *obj = sgen_alloc_obj (vtable, size);
 
-       if (G_UNLIKELY (alloc_events)) {
+       if (G_UNLIKELY (mono_profiler_events & MONO_PROFILE_ALLOCATIONS)) {
                if (obj)
                        mono_profiler_allocation (obj);
        }
@@ -943,7 +963,7 @@ mono_gc_alloc_pinned_obj (MonoVTable *vtable, size_t size)
 {
        MonoObject *obj = sgen_alloc_obj_pinned (vtable, size);
 
-       if (G_UNLIKELY (alloc_events)) {
+       if (G_UNLIKELY (mono_profiler_events & MONO_PROFILE_ALLOCATIONS)) {
                if (obj)
                        mono_profiler_allocation (obj);
        }
@@ -956,7 +976,7 @@ mono_gc_alloc_mature (MonoVTable *vtable, size_t size)
 {
        MonoObject *obj = sgen_alloc_obj_mature (vtable, size);
 
-       if (G_UNLIKELY (alloc_events)) {
+       if (G_UNLIKELY (mono_profiler_events & MONO_PROFILE_ALLOCATIONS)) {
                if (obj)
                        mono_profiler_allocation (obj);
        }
@@ -968,11 +988,11 @@ void*
 mono_gc_alloc_fixed (size_t size, MonoGCDescriptor descr, MonoGCRootSource source, const char *msg)
 {
        /* FIXME: do a single allocation */
-       void *res = calloc (1, size);
+       void *res = g_calloc (1, size);
        if (!res)
                return NULL;
        if (!mono_gc_register_root ((char *)res, size, descr, source, msg)) {
-               free (res);
+               g_free (res);
                res = NULL;
        }
        return res;
@@ -982,7 +1002,7 @@ void
 mono_gc_free_fixed (void* addr)
 {
        mono_gc_deregister_root ((char *)addr);
-       free (addr);
+       g_free (addr);
 }
 
 /*
@@ -995,32 +1015,7 @@ static gboolean use_managed_allocator = TRUE;
 
 #ifdef MANAGED_ALLOCATION
 
-#ifdef HAVE_KW_THREAD
-
-#define EMIT_TLS_ACCESS_VAR(_mb, _var) /* nothing to do */
-
-#define EMIT_TLS_ACCESS_IN_CRITICAL_REGION_ADDR(mb, _var) \
-       do { \
-               mono_mb_emit_byte ((mb), MONO_CUSTOM_PREFIX); \
-               mono_mb_emit_byte ((mb), CEE_MONO_TLS); \
-               mono_mb_emit_i4 ((mb), TLS_KEY_SGEN_IN_CRITICAL_REGION_ADDR); \
-       } while (0)
-
-#define EMIT_TLS_ACCESS_NEXT_ADDR(mb, _var)    do {    \
-       mono_mb_emit_byte ((mb), MONO_CUSTOM_PREFIX);   \
-       mono_mb_emit_byte ((mb), CEE_MONO_TLS);         \
-       mono_mb_emit_i4 ((mb), TLS_KEY_SGEN_TLAB_NEXT_ADDR);            \
-       } while (0)
-
-#define EMIT_TLS_ACCESS_TEMP_END(mb, _var)     do {    \
-       mono_mb_emit_byte ((mb), MONO_CUSTOM_PREFIX);   \
-       mono_mb_emit_byte ((mb), CEE_MONO_TLS);         \
-       mono_mb_emit_i4 ((mb), TLS_KEY_SGEN_TLAB_TEMP_END);             \
-       } while (0)
-
-#else
-
-#if defined(TARGET_OSX) || defined(TARGET_WIN32) || defined(TARGET_ANDROID) || defined(TARGET_IOS)
+#if defined(HAVE_KW_THREAD) || defined(TARGET_OSX) || defined(TARGET_WIN32) || defined(TARGET_ANDROID) || defined(TARGET_IOS)
 
 // Cache the SgenThreadInfo pointer in a local 'var'.
 #define EMIT_TLS_ACCESS_VAR(mb, var) \
@@ -1041,9 +1036,8 @@ static gboolean use_managed_allocator = TRUE;
 
 #define EMIT_TLS_ACCESS_NEXT_ADDR(mb, var)     do {    \
        mono_mb_emit_ldloc ((mb), (var));               \
-       mono_mb_emit_icon ((mb), MONO_STRUCT_OFFSET (SgenThreadInfo, tlab_next_addr));  \
+       mono_mb_emit_icon ((mb), MONO_STRUCT_OFFSET (SgenThreadInfo, tlab_next));       \
        mono_mb_emit_byte ((mb), CEE_ADD);              \
-       mono_mb_emit_byte ((mb), CEE_LDIND_I);          \
        } while (0)
 
 #define EMIT_TLS_ACCESS_TEMP_END(mb, var)      do {    \
@@ -1058,7 +1052,6 @@ static gboolean use_managed_allocator = TRUE;
 #define EMIT_TLS_ACCESS_NEXT_ADDR(mb, _var)    do { g_error ("sgen is not supported when using --with-tls=pthread.\n"); } while (0)
 #define EMIT_TLS_ACCESS_TEMP_END(mb, _var)     do { g_error ("sgen is not supported when using --with-tls=pthread.\n"); } while (0)
 #define EMIT_TLS_ACCESS_IN_CRITICAL_REGION_ADDR(mb, _var)      do { g_error ("sgen is not supported when using --with-tls=pthread.\n"); } while (0)
-#endif
 
 #endif
 
@@ -1146,6 +1139,10 @@ create_allocator (int atype, ManagedAllocatorVariant variant)
                goto done;
        }
 
+       /*
+        * Tls access might call foreign code or code without jinfo. This can
+        * only happen if we are outside of the critical region.
+        */
        EMIT_TLS_ACCESS_VAR (mb, thread_var);
 
        size_var = mono_mb_add_local (mb, &mono_defaults.int_class->byval_arg);
@@ -1508,10 +1505,10 @@ mono_gc_get_managed_allocator_by_type (int atype, ManagedAllocatorVariant varian
        MonoMethod *res;
        MonoMethod **cache;
 
-       if (!use_managed_allocator)
+       if (variant == MANAGED_ALLOCATOR_REGULAR && !use_managed_allocator)
                return NULL;
 
-       if (!mono_runtime_has_tls_get ())
+       if (variant == MANAGED_ALLOCATOR_REGULAR && !mono_runtime_has_tls_get ())
                return NULL;
 
        switch (variant) {
@@ -1776,7 +1773,7 @@ mono_gc_alloc_vector (MonoVTable *vtable, size_t size, uintptr_t max_length)
        UNLOCK_GC;
 
  done:
-       if (G_UNLIKELY (alloc_events))
+       if (G_UNLIKELY (mono_profiler_events & MONO_PROFILE_ALLOCATIONS))
                mono_profiler_allocation (&arr->obj);
 
        SGEN_ASSERT (6, SGEN_ALIGN_UP (size) == SGEN_ALIGN_UP (sgen_client_par_object_get_size (vtable, (GCObject*)arr)), "Vector has incorrect size.");
@@ -1824,7 +1821,7 @@ mono_gc_alloc_array (MonoVTable *vtable, size_t size, uintptr_t max_length, uint
        UNLOCK_GC;
 
  done:
-       if (G_UNLIKELY (alloc_events))
+       if (G_UNLIKELY (mono_profiler_events & MONO_PROFILE_ALLOCATIONS))
                mono_profiler_allocation (&arr->obj);
 
        SGEN_ASSERT (6, SGEN_ALIGN_UP (size) == SGEN_ALIGN_UP (sgen_client_par_object_get_size (vtable, (GCObject*)arr)), "Array has incorrect size.");
@@ -1865,7 +1862,7 @@ mono_gc_alloc_string (MonoVTable *vtable, size_t size, gint32 len)
        UNLOCK_GC;
 
  done:
-       if (G_UNLIKELY (alloc_events))
+       if (G_UNLIKELY (mono_profiler_events & MONO_PROFILE_ALLOCATIONS))
                mono_profiler_allocation (&str->object);
 
        return str;
@@ -2084,22 +2081,45 @@ sgen_client_collecting_major_3 (SgenPointerQueue *fin_ready_queue, SgenPointerQu
 static void *moved_objects [MOVED_OBJECTS_NUM];
 static int moved_objects_idx = 0;
 
+static SgenPointerQueue moved_objects_queue = SGEN_POINTER_QUEUE_INIT (INTERNAL_MEM_MOVED_OBJECT);
+
 void
 mono_sgen_register_moved_object (void *obj, void *destination)
 {
-       g_assert (mono_profiler_events & MONO_PROFILE_GC_MOVES);
+       /*
+        * This function can be called from SGen's worker threads. We want to try
+        * and avoid exposing those threads to the profiler API, so queue up move
+        * events and send them later when the main GC thread calls
+        * mono_sgen_gc_event_moves ().
+        *
+        * TODO: Once SGen has multiple worker threads, we need to switch to a
+        * lock-free data structure for the queue as multiple threads will be
+        * adding to it at the same time.
+        */
+       if (sgen_thread_pool_is_thread_pool_thread (mono_native_thread_id_get ())) {
+               sgen_pointer_queue_add (&moved_objects_queue, obj);
+               sgen_pointer_queue_add (&moved_objects_queue, destination);
+       } else {
+               if (moved_objects_idx == MOVED_OBJECTS_NUM) {
+                       mono_profiler_gc_moves (moved_objects, moved_objects_idx);
+                       moved_objects_idx = 0;
+               }
 
-       if (moved_objects_idx == MOVED_OBJECTS_NUM) {
-               mono_profiler_gc_moves (moved_objects, moved_objects_idx);
-               moved_objects_idx = 0;
+               moved_objects [moved_objects_idx++] = obj;
+               moved_objects [moved_objects_idx++] = destination;
        }
-       moved_objects [moved_objects_idx++] = obj;
-       moved_objects [moved_objects_idx++] = destination;
 }
 
 void
 mono_sgen_gc_event_moves (void)
 {
+       while (!sgen_pointer_queue_is_empty (&moved_objects_queue)) {
+               void *dst = sgen_pointer_queue_pop (&moved_objects_queue);
+               void *src = sgen_pointer_queue_pop (&moved_objects_queue);
+
+               mono_sgen_register_moved_object (src, dst);
+       }
+
        if (moved_objects_idx) {
                mono_profiler_gc_moves (moved_objects, moved_objects_idx);
                moved_objects_idx = 0;
@@ -2221,8 +2241,6 @@ sgen_client_thread_register (SgenThreadInfo* info, void *stack_bottom_fallback)
 #endif
 
        info->client_info.skip = 0;
-       info->client_info.stopped_ip = NULL;
-       info->client_info.stopped_domain = NULL;
 
        info->client_info.stack_start = NULL;
 
@@ -2231,12 +2249,9 @@ sgen_client_thread_register (SgenThreadInfo* info, void *stack_bottom_fallback)
        info->client_info.signal = 0;
 #endif
 
-       /* On win32, stack_start_limit should be 0, since the stack can grow dynamically */
        mono_thread_info_get_stack_bounds (&staddr, &stsize);
        if (staddr) {
-#ifndef HOST_WIN32
                info->client_info.stack_start_limit = staddr;
-#endif
                info->client_info.stack_end = staddr + stsize;
        } else {
                gsize stack_bottom = (gsize)stack_bottom_fallback;
@@ -2296,12 +2311,6 @@ mono_gc_set_skip_thread (gboolean skip)
        UNLOCK_GC;
 }
 
-static gboolean
-is_critical_method (MonoMethod *method)
-{
-       return mono_runtime_is_critical_method (method) || sgen_is_critical_method (method);
-}
-
 static gboolean
 thread_in_critical_region (SgenThreadInfo *info)
 {
@@ -2324,7 +2333,7 @@ sgen_thread_detach (SgenThreadInfo *p)
         * so we assume that if the domain is still registered, we can detach
         * the thread
         */
-       if (mono_domain_get ())
+       if (mono_thread_internal_current_is_attached ())
                mono_thread_detach_internal (mono_thread_internal_current ());
 }
 
@@ -2538,11 +2547,6 @@ mono_gc_get_generation (MonoObject *obj)
        return 1;
 }
 
-void
-mono_gc_enable_events (void)
-{
-}
-
 const char *
 mono_gc_get_gc_name (void)
 {
@@ -2814,6 +2818,7 @@ sgen_client_description_for_internal_mem_type (int type)
 {
        switch (type) {
        case INTERNAL_MEM_EPHEMERON_LINK: return "ephemeron-link";
+       case INTERNAL_MEM_MOVED_OBJECT: return "moved-object";
        default:
                return NULL;
        }
@@ -2860,8 +2865,8 @@ sgen_client_init (void)
        cb.thread_detach = sgen_thread_detach;
        cb.thread_unregister = sgen_thread_unregister;
        cb.thread_attach = sgen_thread_attach;
-       cb.mono_method_is_critical = (gboolean (*)(void *))is_critical_method;
        cb.mono_thread_in_critical_region = thread_in_critical_region;
+       cb.ip_in_critical_region = ip_in_critical_region;
 
        mono_threads_init (&cb, sizeof (SgenThreadInfo));
 
@@ -2890,13 +2895,6 @@ sgen_client_init (void)
        }
 #endif
 
-       /*
-        * This needs to happen before any internal allocations because
-        * it inits the small id which is required for hazard pointer
-        * operations.
-        */
-       sgen_os_init ();
-
        mono_gc_register_thread (&dummy);
 }
 
@@ -2919,7 +2917,7 @@ sgen_client_handle_gc_param (const char *opt)
        } else if (g_str_has_prefix (opt, "toggleref-test")) {
                /* FIXME: This should probably in MONO_GC_DEBUG */
                sgen_register_test_toggleref_callback ();
-       } else {
+       } else if (!sgen_bridge_handle_gc_param (opt)) {
                return FALSE;
        }
        return TRUE;
@@ -2996,6 +2994,10 @@ mono_gc_base_init (void)
 
        mono_counters_init ();
 
+#ifndef HOST_WIN32
+       mono_w32handle_init ();
+#endif
+
 #ifdef HEAVY_STATISTICS
        mono_counters_register ("los marked cards", MONO_COUNTER_GC | MONO_COUNTER_ULONG, &los_marked_cards);
        mono_counters_register ("los array cards scanned ", MONO_COUNTER_GC | MONO_COUNTER_ULONG, &los_array_cards);
@@ -3013,7 +3015,7 @@ mono_gc_base_init (void)
 
 #if defined(HAVE_KW_THREAD)
        /* This can happen with using libmonosgen.so */
-       if (mono_tls_key_get_offset (TLS_KEY_SGEN_TLAB_NEXT_ADDR) == -1)
+       if (mono_tls_key_get_offset (TLS_KEY_SGEN_THREAD_INFO) == -1)
                sgen_set_use_managed_allocator (FALSE);
 #endif
 
@@ -3024,6 +3026,9 @@ void
 mono_gc_base_cleanup (void)
 {
        sgen_thread_pool_shutdown ();
+
+       // We should have consumed any outstanding moves.
+       g_assert (sgen_pointer_queue_is_empty (&moved_objects_queue));
 }
 
 gboolean
index 4631c0c5430f2ec946931fee01fee5ae079a6ad7..8b51ccf588a23f92ff45121dbc1499c5957b5bbc 100644 (file)
@@ -101,6 +101,8 @@ typedef struct _SCC {
 #endif
 } SCC;
 
+static char *dump_prefix = NULL;
+
 // Maps managed objects to corresponding HashEntry stricts
 static SgenHashTable hash_table = SGEN_HASH_TABLE_INIT (INTERNAL_MEM_BRIDGE_HASH_TABLE, INTERNAL_MEM_BRIDGE_HASH_TABLE_ENTRY, sizeof (HashEntry), mono_aligned_addr_hash, NULL);
 
@@ -161,11 +163,16 @@ dyn_array_int_contains (DynIntArray *da, int x)
 #endif
 
 static void
-enable_accounting (void)
+set_config (const SgenBridgeProcessorConfig *config)
 {
-       SgenHashTable table = SGEN_HASH_TABLE_INIT (INTERNAL_MEM_BRIDGE_HASH_TABLE, INTERNAL_MEM_BRIDGE_HASH_TABLE_ENTRY, sizeof (HashEntryWithAccounting), mono_aligned_addr_hash, NULL);
-       bridge_accounting_enabled = TRUE;
-       hash_table = table;
+       if (config->accounting) {
+               SgenHashTable table = SGEN_HASH_TABLE_INIT (INTERNAL_MEM_BRIDGE_HASH_TABLE, INTERNAL_MEM_BRIDGE_HASH_TABLE_ENTRY, sizeof (HashEntryWithAccounting), mono_aligned_addr_hash, NULL);
+               bridge_accounting_enabled = TRUE;
+               hash_table = table;
+       }
+       if (config->dump_prefix) {
+               dump_prefix = strdup (config->dump_prefix);
+       }
 }
 
 static MonoGCBridgeObjectKind
@@ -189,7 +196,7 @@ class_kind (MonoClass *klass)
 
                /* FIXME the bridge check can be quite expensive, cache it at the class level. */
                /* An array of a sealed type that is not a bridge will never get to a bridge */
-               if ((elem_class->flags & TYPE_ATTRIBUTE_SEALED) && !elem_class->has_references && !bridge_callbacks.bridge_class_kind (elem_class)) {
+               if ((mono_class_get_flags (elem_class) & TYPE_ATTRIBUTE_SEALED) && !elem_class->has_references && !bridge_callbacks.bridge_class_kind (elem_class)) {
                        SGEN_LOG (6, "class %s is opaque\n", klass->name);
                        return GC_BRIDGE_OPAQUE_CLASS;
                }
@@ -604,8 +611,6 @@ reset_flags (SCC *scc)
 }
 #endif
 
-static char *dump_prefix = NULL;
-
 static void
 dump_graph (void)
 {
@@ -657,12 +662,6 @@ dump_graph (void)
        fclose (file);
 }
 
-static void
-set_dump_prefix (const char *prefix)
-{
-       dump_prefix = strdup (prefix);
-}
-
 static int
 compare_hash_entries (const HashEntry *e1, const HashEntry *e2)
 {
@@ -1031,7 +1030,7 @@ processing_after_callback (int generation)
                        for (j = 0; j < api_sccs [i]->num_objs; ++j) {
                                GCVTable vtable = SGEN_LOAD_VTABLE (api_sccs [i]->objs [j]);
                                mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_GC,
-                                       "OBJECT %s (%p) SCC [%d] %s",
+                                       "OBJECT %s.%s (%p) SCC [%d] %s",
                                                sgen_client_vtable_get_namespace (vtable), sgen_client_vtable_get_name (vtable), api_sccs [i]->objs [j],
                                                i,
                                                api_sccs [i]->is_alive  ? "ALIVE" : "DEAD");
@@ -1087,8 +1086,7 @@ sgen_new_bridge_init (SgenBridgeProcessor *collector)
        collector->class_kind = class_kind;
        collector->register_finalized_object = register_finalized_object;
        collector->describe_pointer = describe_pointer;
-       collector->enable_accounting = enable_accounting;
-       collector->set_dump_prefix = set_dump_prefix;
+       collector->set_config = set_config;
 
        bridge_processor = collector;
 }
index d33d5d86815d795db6168cf97b9e0f24b9c3f1ff..346e4b0aeb50a1aff3d8ada64bf8b2042898dd17 100644 (file)
@@ -372,11 +372,13 @@ dyn_array_int_merge_one (DynIntArray *array, int value)
 
 
 static void
-enable_accounting (void)
+set_config (const SgenBridgeProcessorConfig *config)
 {
-       SgenHashTable table = SGEN_HASH_TABLE_INIT (INTERNAL_MEM_BRIDGE_HASH_TABLE, INTERNAL_MEM_BRIDGE_HASH_TABLE_ENTRY, sizeof (HashEntryWithAccounting), mono_aligned_addr_hash, NULL);
-       bridge_accounting_enabled = TRUE;
-       hash_table = table;
+       if (config->accounting) {
+               SgenHashTable table = SGEN_HASH_TABLE_INIT (INTERNAL_MEM_BRIDGE_HASH_TABLE, INTERNAL_MEM_BRIDGE_HASH_TABLE_ENTRY, sizeof (HashEntryWithAccounting), mono_aligned_addr_hash, NULL);
+               bridge_accounting_enabled = TRUE;
+               hash_table = table;
+       }
 }
 
 static MonoGCBridgeObjectKind
@@ -922,7 +924,7 @@ sgen_old_bridge_init (SgenBridgeProcessor *collector)
        collector->class_kind = class_kind;
        collector->register_finalized_object = register_finalized_object;
        collector->describe_pointer = describe_pointer;
-       collector->enable_accounting = enable_accounting;
+       collector->set_config = set_config;
 
        bridge_processor = collector;
 }
diff --git a/mono/metadata/sgen-os-coop.c b/mono/metadata/sgen-os-coop.c
deleted file mode 100644 (file)
index 90c8266..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * sgen-os-coop.c: SGen Cooperative backend support.
- *
- * Author:
- *     João Matos (joao.matos@xamarin.com)
- * Copyright (C) 2015 Xamarin Inc
- *
- * Licensed under the MIT license. See LICENSE file in the project root for full license information.
- */
-
-#include "config.h"
-#ifdef HAVE_SGEN_GC
-
-
-#include <glib.h>
-#include "sgen/sgen-gc.h"
-#include "sgen/sgen-archdep.h"
-#include "sgen/sgen-protocol.h"
-#include "metadata/object-internals.h"
-#include "metadata/gc-internals.h"
-
-
-#if defined(USE_COOP_GC)
-
-gboolean
-sgen_resume_thread (SgenThreadInfo *info)
-{
-       g_error ("FIXME");
-       return FALSE;
-}
-
-gboolean
-sgen_suspend_thread (SgenThreadInfo *info)
-{
-       g_error ("FIXME");
-       return FALSE;
-}
-
-void
-sgen_wait_for_suspend_ack (int count)
-{
-}
-
-/* LOCKING: assumes the GC lock is held */
-int
-sgen_thread_handshake (BOOL suspend)
-{
-       g_error ("FIXME");
-       return 0;
-}
-
-void
-sgen_os_init (void)
-{
-}
-
-int
-mono_gc_get_suspend_signal (void)
-{
-       return -1;
-}
-
-int
-mono_gc_get_restart_signal (void)
-{
-       return -1;
-}
-
-#endif
-#endif
diff --git a/mono/metadata/sgen-os-mach.c b/mono/metadata/sgen-os-mach.c
deleted file mode 100644 (file)
index 1f87eb1..0000000
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * sgen-os-mach.c: Mach-OS support.
- *
- * Author:
- *     Paolo Molaro (lupus@ximian.com)
- *     Mark Probst (mprobst@novell.com)
- *     Geoff Norton (gnorton@novell.com)
- *
- * Copyright 2010 Novell, Inc (http://www.novell.com)
- * Copyright (C) 2012 Xamarin Inc
- *
- * Licensed under the MIT license. See LICENSE file in the project root for full license information.
- */
-
-#include "config.h"
-#ifdef HAVE_SGEN_GC
-
-
-#include <glib.h>
-#include "sgen/sgen-gc.h"
-#include "sgen/sgen-archdep.h"
-#include "sgen/sgen-protocol.h"
-#include "sgen/sgen-thread-pool.h"
-#include "metadata/object-internals.h"
-#include "metadata/gc-internals.h"
-
-#if defined(__MACH__)
-#include "utils/mach-support.h"
-#endif
-
-#if defined(__MACH__) && MONO_MACH_ARCH_SUPPORTED
-
-#if !defined(USE_COOP_GC)
-gboolean
-sgen_resume_thread (SgenThreadInfo *info)
-{
-       kern_return_t ret;
-       do {
-               ret = thread_resume (info->client_info.info.native_handle);
-       } while (ret == KERN_ABORTED);
-       return ret == KERN_SUCCESS;
-}
-
-gboolean
-sgen_suspend_thread (SgenThreadInfo *info)
-{
-       mach_msg_type_number_t num_state;
-       thread_state_t state;
-       kern_return_t ret;
-       ucontext_t ctx;
-       mcontext_t mctx;
-
-       gpointer stack_start;
-
-       state = (thread_state_t) alloca (mono_mach_arch_get_thread_state_size ());
-       mctx = (mcontext_t) alloca (mono_mach_arch_get_mcontext_size ());
-
-       do {
-               ret = thread_suspend (info->client_info.info.native_handle);
-       } while (ret == KERN_ABORTED);
-       if (ret != KERN_SUCCESS)
-               return FALSE;
-
-       do {
-               ret = mono_mach_arch_get_thread_state (info->client_info.info.native_handle, state, &num_state);
-       } while (ret == KERN_ABORTED);
-       if (ret != KERN_SUCCESS)
-               return FALSE;
-
-       mono_mach_arch_thread_state_to_mcontext (state, mctx);
-       ctx.uc_mcontext = mctx;
-
-       info->client_info.stopped_domain = mono_thread_info_tls_get (info, TLS_KEY_DOMAIN);
-       info->client_info.stopped_ip = (gpointer) mono_mach_arch_get_ip (state);
-       info->client_info.stack_start = NULL;
-       stack_start = (char*) mono_mach_arch_get_sp (state) - REDZONE_SIZE;
-       /* If stack_start is not within the limits, then don't set it in info and we will be restarted. */
-       if (stack_start >= info->client_info.stack_start_limit && stack_start <= info->client_info.stack_end) {
-               info->client_info.stack_start = stack_start;
-
-               mono_sigctx_to_monoctx (&ctx, &info->client_info.ctx);
-       } else {
-               g_assert (!info->client_info.stack_start);
-       }
-
-       /* Notify the JIT */
-       if (mono_gc_get_gc_callbacks ()->thread_suspend_func)
-               mono_gc_get_gc_callbacks ()->thread_suspend_func (info->client_info.runtime_data, &ctx, NULL);
-
-       SGEN_LOG (2, "thread %p stopped at %p stack_start=%p", (void*)(gsize)info->client_info.info.native_handle, info->client_info.stopped_ip, info->client_info.stack_start);
-       binary_protocol_thread_suspend ((gpointer)mono_thread_info_get_tid (info), info->client_info.stopped_ip);
-
-       return TRUE;
-}
-
-void
-sgen_wait_for_suspend_ack (int count)
-{
-    /* mach thread_resume is synchronous so we dont need to wait for them */
-}
-
-/* LOCKING: assumes the GC lock is held */
-int
-sgen_thread_handshake (BOOL suspend)
-{
-       SgenThreadInfo *cur_thread = mono_thread_info_current ();
-       kern_return_t ret;
-
-       int count = 0;
-
-       cur_thread->client_info.suspend_done = TRUE;
-       FOREACH_THREAD (info) {
-               if (info == cur_thread || sgen_thread_pool_is_thread_pool_thread (mono_thread_info_get_tid (info)))
-                       continue;
-
-               info->client_info.suspend_done = FALSE;
-               if (info->client_info.gc_disabled)
-                       continue;
-
-               if (suspend) {
-                       if (!sgen_suspend_thread (info))
-                               continue;
-               } else {
-                       do {
-                               ret = thread_resume (info->client_info.info.native_handle);
-                       } while (ret == KERN_ABORTED);
-                       if (ret != KERN_SUCCESS)
-                               continue;
-               }
-               count ++;
-       } FOREACH_THREAD_END
-       return count;
-}
-
-void
-sgen_os_init (void)
-{
-}
-
-int
-mono_gc_get_suspend_signal (void)
-{
-       return -1;
-}
-
-int
-mono_gc_get_restart_signal (void)
-{
-       return -1;
-}
-#endif
-#endif
-#endif
diff --git a/mono/metadata/sgen-os-posix.c b/mono/metadata/sgen-os-posix.c
deleted file mode 100644 (file)
index 1016841..0000000
+++ /dev/null
@@ -1,246 +0,0 @@
-/*
- * sgen-os-posix.c: Posix support.
- *
- * Author:
- *     Paolo Molaro (lupus@ximian.com)
- *     Mark Probst (mprobst@novell.com)
- *     Geoff Norton (gnorton@novell.com)
- *
- * Copyright 2010 Novell, Inc (http://www.novell.com)
- * Copyright (C) 2012 Xamarin Inc
- *
- * Licensed under the MIT license. See LICENSE file in the project root for full license information.
- */
-
-#include "config.h"
-
-#if defined(HAVE_SGEN_GC) && !defined(USE_COOP_GC)
-#if !defined(__MACH__) && !MONO_MACH_ARCH_SUPPORTED && defined(HAVE_PTHREAD_KILL)
-
-#include <errno.h>
-#include <glib.h>
-#include "sgen/sgen-gc.h"
-#include "metadata/gc-internals.h"
-#include "sgen/sgen-archdep.h"
-#include "metadata/object-internals.h"
-#include "utils/mono-signal-handler.h"
-
-#if defined(__APPLE__) || defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
-const static int suspend_signal_num = SIGXFSZ;
-#else
-const static int suspend_signal_num = SIGPWR;
-#endif
-const static int restart_signal_num = SIGXCPU;
-
-static SgenSemaphore suspend_ack_semaphore;
-static SgenSemaphore *suspend_ack_semaphore_ptr;
-
-static sigset_t suspend_signal_mask;
-static sigset_t suspend_ack_signal_mask;
-
-static void
-suspend_thread (SgenThreadInfo *info, void *context)
-{
-       int stop_count;
-       MonoContext ctx;
-       gpointer stack_start;
-
-       info->client_info.stopped_domain = mono_domain_get ();
-       info->client_info.stack_start = NULL;
-       info->client_info.signal = 0;
-       stop_count = sgen_global_stop_count;
-       /* duplicate signal */
-       if (0 && info->client_info.stop_count == stop_count)
-               return;
-
-       if (context) {
-               mono_sigctx_to_monoctx (context, &ctx);
-               info->client_info.stopped_ip = MONO_CONTEXT_GET_IP (&ctx);
-               stack_start = (((guint8 *) MONO_CONTEXT_GET_SP (&ctx)) - REDZONE_SIZE);
-       } else {
-               info->client_info.stopped_ip = NULL;
-               stack_start = NULL;
-       }
-
-       /* If stack_start is not within the limits, then don't set it
-          in info and we will be restarted. */
-       if (stack_start >= info->client_info.stack_start_limit && stack_start <= info->client_info.stack_end) {
-               info->client_info.stack_start = stack_start;
-
-               if (context) {
-                       memcpy (&info->client_info.ctx, &ctx, sizeof (MonoContext));
-               } else {
-                       memset (&info->client_info.ctx, 0, sizeof (MonoContext));
-               }
-       } else {
-               g_assert (!info->client_info.stack_start);
-       }
-
-       /* Notify the JIT */
-       if (mono_gc_get_gc_callbacks ()->thread_suspend_func)
-               mono_gc_get_gc_callbacks ()->thread_suspend_func (info->client_info.runtime_data, context, NULL);
-
-       SGEN_LOG (4, "Posting suspend_ack_semaphore for suspend from %p %p", info, (gpointer) (gsize) mono_native_thread_id_get ());
-
-       /*
-       Block the restart signal. 
-       We need to block the restart signal while posting to the suspend_ack semaphore or we race to sigsuspend,
-       which might miss the signal and get stuck.
-       */
-       pthread_sigmask (SIG_BLOCK, &suspend_ack_signal_mask, NULL);
-
-       /* notify the waiting thread */
-       SGEN_SEMAPHORE_POST (suspend_ack_semaphore_ptr);
-       info->client_info.stop_count = stop_count;
-
-       /* wait until we receive the restart signal */
-       do {
-               info->client_info.signal = 0;
-               sigsuspend (&suspend_signal_mask);
-       } while (info->client_info.signal != restart_signal_num);
-
-       /* Unblock the restart signal. */
-       pthread_sigmask (SIG_UNBLOCK, &suspend_ack_signal_mask, NULL);
-
-       SGEN_LOG (4, "Posting suspend_ack_semaphore for resume from %p %p\n", info, (gpointer) (gsize) mono_native_thread_id_get ());
-       /* notify the waiting thread */
-       SGEN_SEMAPHORE_POST (suspend_ack_semaphore_ptr);
-}
-
-/* LOCKING: assumes the GC lock is held (by the stopping thread) */
-MONO_SIG_HANDLER_FUNC (static, suspend_handler)
-{
-       /*
-        * The suspend signal handler potentially uses syscalls that
-        * can set errno, and it calls functions that use the hazard
-        * pointer machinery.  Since we're interrupting other code we
-        * must restore those to the values they had when we
-        * interrupted.
-        */
-       SgenThreadInfo *info;
-       int old_errno = errno;
-       int hp_save_index = mono_hazard_pointer_save_for_signal_handler ();
-       MONO_SIG_HANDLER_GET_CONTEXT;
-
-       info = mono_thread_info_current ();
-       suspend_thread (info, ctx);
-
-       mono_hazard_pointer_restore_for_signal_handler (hp_save_index);
-       errno = old_errno;
-}
-
-MONO_SIG_HANDLER_FUNC (static, restart_handler)
-{
-       SgenThreadInfo *info;
-       int old_errno = errno;
-
-       info = mono_thread_info_current ();
-       info->client_info.signal = restart_signal_num;
-       SGEN_LOG (4, "Restart handler in %p %p", info, (gpointer) (gsize) mono_native_thread_id_get ());
-       errno = old_errno;
-}
-
-gboolean
-sgen_resume_thread (SgenThreadInfo *info)
-{
-       return mono_threads_pthread_kill (info, restart_signal_num) == 0;
-}
-
-gboolean
-sgen_suspend_thread (SgenThreadInfo *info)
-{
-       return mono_threads_pthread_kill (info, suspend_signal_num) == 0;
-}
-
-void
-sgen_wait_for_suspend_ack (int count)
-{
-       int i, result;
-
-       for (i = 0; i < count; ++i) {
-               while ((result = SGEN_SEMAPHORE_WAIT (suspend_ack_semaphore_ptr)) != 0) {
-                       if (errno != EINTR) {
-                               g_error ("SGEN_SEMAPHORE_WAIT FAILED with %d errno %d (%s)", result, errno, strerror (errno));
-                       }
-               }
-       }
-}
-
-int
-sgen_thread_handshake (BOOL suspend)
-{
-       int count, result;
-       int signum = suspend ? suspend_signal_num : restart_signal_num;
-
-       MonoNativeThreadId me = mono_native_thread_id_get ();
-
-       count = 0;
-       mono_thread_info_current ()->client_info.suspend_done = TRUE;
-       FOREACH_THREAD (info) {
-               if (mono_native_thread_id_equals (mono_thread_info_get_tid (info), me)) {
-                       continue;
-               }
-               info->client_info.suspend_done = FALSE;
-               if (info->client_info.gc_disabled)
-                       continue;
-               /*if (signum == suspend_signal_num && info->stop_count == global_stop_count)
-                       continue;*/
-               result = mono_threads_pthread_kill (info, signum);
-               if (result == 0) {
-                       count++;
-               } else {
-                       info->client_info.skip = 1;
-               }
-       } FOREACH_THREAD_END
-
-       sgen_wait_for_suspend_ack (count);
-
-       SGEN_LOG (4, "%s handshake for %d threads\n", suspend ? "suspend" : "resume", count);
-
-       return count;
-}
-
-void
-sgen_os_init (void)
-{
-       struct sigaction sinfo;
-
-       if (mono_thread_info_unified_management_enabled ())
-               return;
-
-       suspend_ack_semaphore_ptr = &suspend_ack_semaphore;
-       SGEN_SEMAPHORE_INIT (&suspend_ack_semaphore, 0);
-
-       sigfillset (&sinfo.sa_mask);
-       sinfo.sa_flags = SA_RESTART | SA_SIGINFO;
-       sinfo.sa_sigaction = suspend_handler;
-       if (sigaction (suspend_signal_num, &sinfo, NULL) != 0) {
-               g_error ("failed sigaction");
-       }
-
-       sinfo.sa_handler = (void (*)(int))restart_handler;
-       if (sigaction (restart_signal_num, &sinfo, NULL) != 0) {
-               g_error ("failed sigaction");
-       }
-
-       sigfillset (&suspend_signal_mask);
-       sigdelset (&suspend_signal_mask, restart_signal_num);
-
-       sigemptyset (&suspend_ack_signal_mask);
-       sigaddset (&suspend_ack_signal_mask, restart_signal_num);
-       
-}
-
-int
-mono_gc_get_suspend_signal (void)
-{
-       return suspend_signal_num;
-}
-
-int
-mono_gc_get_restart_signal (void)
-{
-       return restart_signal_num;
-}
-#endif
-#endif
diff --git a/mono/metadata/sgen-os-win32.c b/mono/metadata/sgen-os-win32.c
deleted file mode 100644 (file)
index 8b78616..0000000
+++ /dev/null
@@ -1,145 +0,0 @@
-#include "config.h"
-
-#if defined(HAVE_SGEN_GC) && !defined(USE_COOP_GC) && defined(HOST_WIN32)
-
-#include "io-layer/io-layer.h"
-
-#include "sgen/sgen-gc.h"
-#include "metadata/gc-internals.h"
-
-gboolean
-sgen_resume_thread (SgenThreadInfo *info)
-{
-       DWORD id = mono_thread_info_get_tid (info);
-       HANDLE handle = OpenThread (THREAD_ALL_ACCESS, FALSE, id);
-       DWORD result;
-
-       g_assert (handle);
-
-       result = ResumeThread (handle);
-       g_assert (result != (DWORD)-1);
-
-       CloseHandle (handle);
-
-       return result != (DWORD)-1;
-}
-
-gboolean
-sgen_suspend_thread (SgenThreadInfo *info)
-{
-       DWORD id = mono_thread_info_get_tid (info);
-       HANDLE handle = OpenThread (THREAD_ALL_ACCESS, FALSE, id);
-       CONTEXT context;
-       DWORD result;
-
-       g_assert (id != GetCurrentThreadId ());
-
-       g_assert (handle);
-
-       result = SuspendThread (handle);
-       if (result == (DWORD)-1) {
-               fprintf (stderr, "could not suspend thread %x (handle %p): %d\n", id, handle, GetLastError ()); fflush (stderr);
-               CloseHandle (handle);
-               return FALSE;
-       }
-
-       context.ContextFlags = CONTEXT_INTEGER | CONTEXT_CONTROL;
-
-       if (!GetThreadContext (handle, &context)) {
-               g_assert_not_reached ();
-               ResumeThread (handle);
-               CloseHandle (handle);
-               return FALSE;
-       }
-
-       g_assert (context.ContextFlags & CONTEXT_INTEGER);
-       g_assert (context.ContextFlags & CONTEXT_CONTROL);
-
-       CloseHandle (handle);
-
-#if !defined(MONO_CROSS_COMPILE)
-       memset (&info->client_info.ctx, 0, sizeof (MonoContext));
-#ifdef TARGET_AMD64
-    info->client_info.ctx.gregs[AMD64_RIP] = context.Rip;
-    info->client_info.ctx.gregs[AMD64_RAX] = context.Rax;
-    info->client_info.ctx.gregs[AMD64_RCX] = context.Rcx;
-    info->client_info.ctx.gregs[AMD64_RDX] = context.Rdx;
-    info->client_info.ctx.gregs[AMD64_RBX] = context.Rbx;
-    info->client_info.ctx.gregs[AMD64_RSP] = context.Rsp;
-    info->client_info.ctx.gregs[AMD64_RBP] = context.Rbp;
-    info->client_info.ctx.gregs[AMD64_RSI] = context.Rsi;
-    info->client_info.ctx.gregs[AMD64_RDI] = context.Rdi;
-    info->client_info.ctx.gregs[AMD64_R8] = context.R8;
-    info->client_info.ctx.gregs[AMD64_R9] = context.R9;
-    info->client_info.ctx.gregs[AMD64_R10] = context.R10;
-    info->client_info.ctx.gregs[AMD64_R11] = context.R11;
-    info->client_info.ctx.gregs[AMD64_R12] = context.R12;
-    info->client_info.ctx.gregs[AMD64_R13] = context.R13;
-    info->client_info.ctx.gregs[AMD64_R14] = context.R14;
-    info->client_info.ctx.gregs[AMD64_R15] = context.R15;
-    info->client_info.stopped_ip = info->client_info.ctx.gregs[AMD64_RIP];
-    info->client_info.stack_start = (char*)info->client_info.ctx.gregs[AMD64_RSP] - REDZONE_SIZE;
-#else
-       info->client_info.ctx.edi = context.Edi;
-       info->client_info.ctx.esi = context.Esi;
-       info->client_info.ctx.ebx = context.Ebx;
-       info->client_info.ctx.edx = context.Edx;
-       info->client_info.ctx.ecx = context.Ecx;
-       info->client_info.ctx.eax = context.Eax;
-       info->client_info.ctx.ebp = context.Ebp;
-       info->client_info.ctx.esp = context.Esp;
-       info->client_info.stopped_ip = (gpointer)context.Eip;
-       info->client_info.stack_start = (char*)context.Esp - REDZONE_SIZE;
-#endif
-#endif
-
-       /* Notify the JIT */
-       if (mono_gc_get_gc_callbacks ()->thread_suspend_func)
-               mono_gc_get_gc_callbacks ()->thread_suspend_func (info->client_info.runtime_data, NULL, NULL);
-
-       return TRUE;
-}
-
-void
-sgen_wait_for_suspend_ack (int count)
-{
-       /* Win32 suspend/resume is synchronous, so we don't need to wait for anything */
-}
-
-int
-sgen_thread_handshake (BOOL suspend)
-{
-       SgenThreadInfo *current = mono_thread_info_current ();
-       int count = 0;
-
-       current->client_info.suspend_done = TRUE;
-       FOREACH_THREAD (info) {
-               if (info == current)
-                       continue;
-               info->client_info.suspend_done = FALSE;
-               if (info->client_info.gc_disabled)
-                       continue;
-               if (suspend) {
-                       if (!sgen_suspend_thread (info))
-                               continue;
-               } else {
-                       if (!sgen_resume_thread (info))
-                               continue;
-               }
-               ++count;
-       } FOREACH_THREAD_END
-       return count;
-}
-
-void
-sgen_os_init (void)
-{
-}
-
-int
-mono_gc_get_suspend_signal (void)
-{
-       return -1;
-}
-
-#endif
index ea14448ccfbfaeb7b376fbf06abd59135cf6b680..22ff814df699bdcad3b99b174a2f25ee433e93ea 100644 (file)
@@ -25,6 +25,7 @@
 #include "metadata/sgen-bridge-internals.h"
 #include "metadata/gc-internals.h"
 #include "utils/mono-threads.h"
+#include "utils/mono-threads-debug.h"
 
 #define TV_DECLARE SGEN_TV_DECLARE
 #define TV_GETTIME SGEN_TV_GETTIME
@@ -76,106 +77,6 @@ update_current_thread_stack (void *start)
                mono_gc_get_gc_callbacks ()->thread_suspend_func (info->client_info.runtime_data, NULL, &info->client_info.ctx);
 }
 
-static gboolean
-is_ip_in_managed_allocator (MonoDomain *domain, gpointer ip)
-{
-       MonoJitInfo *ji;
-
-       if (!mono_thread_internal_current ())
-               /* Happens during thread attach */
-               return FALSE;
-
-       if (!ip || !domain)
-               return FALSE;
-       if (!sgen_has_critical_method ())
-               return FALSE;
-
-       /*
-        * mono_jit_info_table_find is not async safe since it calls into the AOT runtime to load information for
-        * missing methods (#13951). To work around this, we disable the AOT fallback. For this to work, the JIT needs
-        * to register the jit info for all GC critical methods after they are JITted/loaded.
-        */
-       ji = mono_jit_info_table_find_internal (domain, (char *)ip, FALSE, FALSE);
-       if (!ji)
-               return FALSE;
-
-       return sgen_is_critical_method (mono_jit_info_get_method (ji));
-}
-
-static int
-restart_threads_until_none_in_managed_allocator (void)
-{
-       int num_threads_died = 0;
-       int sleep_duration = -1;
-
-       for (;;) {
-               int restart_count = 0, restarted_count = 0;
-               /* restart all threads that stopped in the
-                  allocator */
-               FOREACH_THREAD (info) {
-                       gboolean result;
-                       if (info->client_info.skip || info->client_info.gc_disabled || info->client_info.suspend_done)
-                               continue;
-                       if (mono_thread_info_is_live (info) &&
-                                       (!info->client_info.stack_start || info->client_info.in_critical_region || info->client_info.info.inside_critical_region ||
-                                       is_ip_in_managed_allocator (info->client_info.stopped_domain, info->client_info.stopped_ip))) {
-                               binary_protocol_thread_restart ((gpointer)mono_thread_info_get_tid (info));
-                               SGEN_LOG (3, "thread %p resumed.", (void*) (size_t) info->client_info.info.native_handle);
-                               result = sgen_resume_thread (info);
-                               if (result) {
-                                       ++restart_count;
-                               } else {
-                                       info->client_info.skip = 1;
-                               }
-                       } else {
-                               /* we set the stopped_ip to
-                                  NULL for threads which
-                                  we're not restarting so
-                                  that we can easily identify
-                                  the others */
-                               info->client_info.stopped_ip = NULL;
-                               info->client_info.stopped_domain = NULL;
-                               info->client_info.suspend_done = TRUE;
-                       }
-               } FOREACH_THREAD_END
-               /* if no threads were restarted, we're done */
-               if (restart_count == 0)
-                       break;
-
-               /* wait for the threads to signal their restart */
-               sgen_wait_for_suspend_ack (restart_count);
-
-               if (sleep_duration < 0) {
-                       mono_thread_info_yield ();
-                       sleep_duration = 0;
-               } else {
-                       g_usleep (sleep_duration);
-                       sleep_duration += 10;
-               }
-
-               /* stop them again */
-               FOREACH_THREAD (info) {
-                       gboolean result;
-                       if (info->client_info.skip || info->client_info.stopped_ip == NULL)
-                               continue;
-                       result = sgen_suspend_thread (info);
-
-                       if (result) {
-                               ++restarted_count;
-                       } else {
-                               info->client_info.skip = 1;
-                       }
-               } FOREACH_THREAD_END
-               /* some threads might have died */
-               num_threads_died += restart_count - restarted_count;
-               /* wait for the threads to signal their suspension
-                  again */
-               sgen_wait_for_suspend_ack (restarted_count);
-       }
-
-       return num_threads_died;
-}
-
 static void
 acquire_gc_locks (void)
 {
@@ -209,6 +110,8 @@ sgen_client_stop_world (int generation)
 
        acquire_gc_locks ();
 
+       mono_profiler_gc_event (MONO_GC_EVENT_PRE_STOP_WORLD_LOCKED, generation);
+
        /* We start to scan after locks are taking, this ensures we won't be interrupted. */
        sgen_process_togglerefs ();
 
@@ -218,15 +121,7 @@ sgen_client_stop_world (int generation)
        SGEN_LOG (3, "stopping world n %d from %p %p", sgen_global_stop_count, mono_thread_info_current (), (gpointer) (gsize) mono_native_thread_id_get ());
        TV_GETTIME (stop_world_time);
 
-       if (mono_thread_info_unified_management_enabled ()) {
-               sgen_unified_suspend_stop_world ();
-       } else {
-               int count, dead;
-               count = sgen_thread_handshake (TRUE);
-               dead = restart_threads_until_none_in_managed_allocator ();
-               if (count < dead)
-                       g_error ("More threads have died (%d) that been initialy suspended %d", dead, count);
-       }
+       sgen_unified_suspend_stop_world ();
 
        SGEN_LOG (3, "world stopped");
 
@@ -258,10 +153,7 @@ sgen_client_restart_world (int generation, gint64 *stw_time)
 
        TV_GETTIME (start_handshake);
 
-       if (mono_thread_info_unified_management_enabled ())
-               sgen_unified_suspend_restart_world ();
-       else
-               sgen_thread_handshake (FALSE);
+       sgen_unified_suspend_restart_world ();
 
        TV_GETTIME (end_sw);
        time_restart_world += TV_ELAPSED (start_handshake, end_sw);
@@ -283,6 +175,8 @@ sgen_client_restart_world (int generation, gint64 *stw_time)
         */
        release_gc_locks ();
 
+       mono_profiler_gc_event (MONO_GC_EVENT_POST_START_WORLD_UNLOCKED, generation);
+
        *stw_time = usec;
 }
 
@@ -354,30 +248,35 @@ sgen_is_thread_in_current_stw (SgenThreadInfo *info, int *reason)
 static void
 sgen_unified_suspend_stop_world (void)
 {
-       int restart_counter;
        int sleep_duration = -1;
 
        mono_threads_begin_global_suspend ();
-       THREADS_STW_DEBUG ("[GC-STW-BEGIN] *** BEGIN SUSPEND *** \n");
+       THREADS_STW_DEBUG ("[GC-STW-BEGIN][%p] *** BEGIN SUSPEND *** \n", mono_thread_info_get_tid (mono_thread_info_current ()));
 
        FOREACH_THREAD (info) {
-               int reason;
                info->client_info.skip = FALSE;
                info->client_info.suspend_done = FALSE;
-               if (sgen_is_thread_in_current_stw (info, &reason)) {
-                       info->client_info.skip = !mono_thread_info_begin_suspend (info);
-                       THREADS_STW_DEBUG ("[GC-STW-BEGIN-SUSPEND] SUSPEND thread %p skip %d\n", mono_thread_info_get_tid (info), info->client_info.skip);
-               } else {
-                       THREADS_STW_DEBUG ("[GC-STW-BEGIN-SUSPEND] IGNORE thread %p skip %d reason %d\n", mono_thread_info_get_tid (info), info->client_info.skip, reason);
+
+               int reason;
+               if (!sgen_is_thread_in_current_stw (info, &reason)) {
+                       THREADS_STW_DEBUG ("[GC-STW-BEGIN-SUSPEND] IGNORE thread %p skip %s reason %d\n", mono_thread_info_get_tid (info), info->client_info.skip ? "true" : "false", reason);
+                       continue;
                }
+
+               info->client_info.skip = !mono_thread_info_begin_suspend (info);
+
+               THREADS_STW_DEBUG ("[GC-STW-BEGIN-SUSPEND] SUSPEND thread %p skip %s\n", mono_thread_info_get_tid (info), info->client_info.skip ? "true" : "false");
        } FOREACH_THREAD_END
 
        mono_thread_info_current ()->client_info.suspend_done = TRUE;
        mono_threads_wait_pending_operations ();
 
        for (;;) {
-               restart_counter = 0;
+               gint restart_counter = 0;
+
                FOREACH_THREAD (info) {
+                       gint suspend_count;
+
                        int reason = 0;
                        if (info->client_info.suspend_done || !sgen_is_thread_in_current_stw (info, &reason)) {
                                THREADS_STW_DEBUG ("[GC-STW-RESTART] IGNORE RESUME thread %p not been processed done %d current %d reason %d\n", mono_thread_info_get_tid (info), info->client_info.suspend_done, !sgen_is_thread_in_current_stw (info, NULL), reason);
@@ -390,27 +289,28 @@ sgen_unified_suspend_stop_world (void)
                        - We haven't accepted the previous suspend as good.
                        - We haven't gave up on it for this STW (it's either bad or asked not to)
                        */
-                       if (mono_thread_info_in_critical_location (info)) {
-                               gboolean res;
-                               gint suspend_count = mono_thread_info_suspend_count (info);
-                               if (!(suspend_count == 1))
-                                       g_error ("[%p] suspend_count = %d, but should be 1", mono_thread_info_get_tid (info), suspend_count);
-                               res = mono_thread_info_begin_resume (info);
-                               THREADS_STW_DEBUG ("[GC-STW-RESTART] RESTART thread %p skip %d\n", mono_thread_info_get_tid (info), res);
-                               if (res)
-                                       ++restart_counter;
-                               else
-                                       info->client_info.skip = TRUE;
-                       } else {
-                               THREADS_STW_DEBUG ("[GC-STW-RESTART] DONE thread %p deemed fully suspended\n", mono_thread_info_get_tid (info));
-                               g_assert (!info->client_info.in_critical_region);
+                       if (!mono_thread_info_in_critical_location (info)) {
                                info->client_info.suspend_done = TRUE;
+
+                               THREADS_STW_DEBUG ("[GC-STW-RESTART] DONE thread %p deemed fully suspended\n", mono_thread_info_get_tid (info));
+                               continue;
                        }
+
+                       suspend_count = mono_thread_info_suspend_count (info);
+                       if (!(suspend_count == 1))
+                               g_error ("[%p] suspend_count = %d, but should be 1", mono_thread_info_get_tid (info), suspend_count);
+
+                       info->client_info.skip = !mono_thread_info_begin_resume (info);
+                       if (!info->client_info.skip)
+                               restart_counter += 1;
+
+                       THREADS_STW_DEBUG ("[GC-STW-RESTART] RESTART thread %p skip %s\n", mono_thread_info_get_tid (info), info->client_info.skip ? "true" : "false");
                } FOREACH_THREAD_END
 
+               mono_threads_wait_pending_operations ();
+
                if (restart_counter == 0)
                        break;
-               mono_threads_wait_pending_operations ();
 
                if (sleep_duration < 0) {
                        mono_thread_info_yield ();
@@ -427,54 +327,51 @@ sgen_unified_suspend_stop_world (void)
                                continue;
                        }
 
-                       if (mono_thread_info_is_running (info)) {
-                               gboolean res = mono_thread_info_begin_suspend (info);
-                               THREADS_STW_DEBUG ("[GC-STW-RESTART] SUSPEND thread %p skip %d\n", mono_thread_info_get_tid (info), res);
-                               if (!res)
-                                       info->client_info.skip = TRUE;
+                       if (!mono_thread_info_is_running (info)) {
+                               THREADS_STW_DEBUG ("[GC-STW-RESTART] IGNORE SUSPEND thread %p not running\n", mono_thread_info_get_tid (info));
+                               continue;
                        }
+
+                       info->client_info.skip = !mono_thread_info_begin_suspend (info);
+
+                       THREADS_STW_DEBUG ("[GC-STW-RESTART] SUSPEND thread %p skip %s\n", mono_thread_info_get_tid (info), info->client_info.skip ? "true" : "false");
                } FOREACH_THREAD_END
 
                mono_threads_wait_pending_operations ();
        }
 
        FOREACH_THREAD (info) {
+               gpointer stopped_ip;
+
                int reason = 0;
-               if (sgen_is_thread_in_current_stw (info, &reason)) {
-                       MonoThreadUnwindState *state;
-
-                       THREADS_STW_DEBUG ("[GC-STW-SUSPEND-END] thread %p is suspended\n", mono_thread_info_get_tid (info));
-                       g_assert (info->client_info.suspend_done);
-
-                       state = mono_thread_info_get_suspend_state (info);
-
-                       info->client_info.ctx = state->ctx;
-
-                       if (!state->unwind_data [MONO_UNWIND_DATA_DOMAIN] || !state->unwind_data [MONO_UNWIND_DATA_LMF]) {
-                               /* thread is starting or detaching, nothing to scan here */
-                               info->client_info.stopped_domain = NULL;
-                               info->client_info.stopped_ip = NULL;
-                               info->client_info.stack_start = NULL;
-                       } else {
-                               /* Once we remove the old suspend code, we should move sgen to directly access the state in MonoThread */
-                               info->client_info.stopped_domain = (MonoDomain*) mono_thread_info_tls_get (info, TLS_KEY_DOMAIN);
-                               info->client_info.stopped_ip = (gpointer) (MONO_CONTEXT_GET_IP (&info->client_info.ctx));
-                               info->client_info.stack_start = (gpointer) ((char*)MONO_CONTEXT_GET_SP (&info->client_info.ctx) - REDZONE_SIZE);
-
-                               /* altstack signal handler, sgen can't handle them, mono-threads should have handled this. */
-                               if (!info->client_info.stack_start
-                                        || info->client_info.stack_start < info->client_info.stack_start_limit
-                                        || info->client_info.stack_start >= info->client_info.stack_end) {
-                                       g_error ("BAD STACK: stack_start = %p, stack_start_limit = %p, stack_end = %p",
-                                               info->client_info.stack_start, info->client_info.stack_start_limit, info->client_info.stack_end);
-                               }
-                       }
+               if (!sgen_is_thread_in_current_stw (info, &reason)) {
+                       g_assert (!info->client_info.suspend_done || info == mono_thread_info_current ());
 
-                       binary_protocol_thread_suspend ((gpointer) mono_thread_info_get_tid (info), info->client_info.stopped_ip);
-               } else {
                        THREADS_STW_DEBUG ("[GC-STW-SUSPEND-END] thread %p is NOT suspended, reason %d\n", mono_thread_info_get_tid (info), reason);
-                       g_assert (!info->client_info.suspend_done || info == mono_thread_info_current ());
+                       continue;
+               }
+
+               g_assert (info->client_info.suspend_done);
+
+               info->client_info.ctx = mono_thread_info_get_suspend_state (info)->ctx;
+
+               /* Once we remove the old suspend code, we should move sgen to directly access the state in MonoThread */
+               info->client_info.stack_start = (gpointer) ((char*)MONO_CONTEXT_GET_SP (&info->client_info.ctx) - REDZONE_SIZE);
+
+               /* altstack signal handler, sgen can't handle them, mono-threads should have handled this. */
+               if (!info->client_info.stack_start
+                        || info->client_info.stack_start < info->client_info.stack_start_limit
+                        || info->client_info.stack_start >= info->client_info.stack_end) {
+                       g_error ("BAD STACK: stack_start = %p, stack_start_limit = %p, stack_end = %p",
+                               info->client_info.stack_start, info->client_info.stack_start_limit, info->client_info.stack_end);
                }
+
+               stopped_ip = (gpointer) (MONO_CONTEXT_GET_IP (&info->client_info.ctx));
+
+               binary_protocol_thread_suspend ((gpointer) mono_thread_info_get_tid (info), stopped_ip);
+
+               THREADS_STW_DEBUG ("[GC-STW-SUSPEND-END] thread %p is suspended, stopped_ip = %p, stack = %p -> %p\n",
+                       mono_thread_info_get_tid (info), stopped_ip, info->client_info.stack_start, info->client_info.stack_start ? info->client_info.stack_end : NULL);
        } FOREACH_THREAD_END
 }
 
index 76c5ac64a90d1380e68f88e5e0f1b44f83a7481c..fc9a73de67d011c315611e66f02b762b081236ba 100644 (file)
@@ -19,8 +19,6 @@
 
 #include "sgen/sgen-gc.h"
 #include "sgen-bridge-internals.h"
-#include "sgen/sgen-hash-table.h"
-#include "sgen/sgen-qsort.h"
 #include "tabledefs.h"
 #include "utils/mono-logger-internals.h"
 
  *     which colors. The color graph then becomes the reduced SCC graph.
  */
 
-static void
-enable_accounting (void)
-{
-       // bridge_accounting_enabled = TRUE;
-       // hash_table = (SgenHashTable)SGEN_HASH_TABLE_INIT (INTERNAL_MEM_BRIDGE_HASH_TABLE, INTERNAL_MEM_BRIDGE_HASH_TABLE_ENTRY, sizeof (HashEntryWithAccounting), mono_aligned_addr_hash, NULL);
-}
-
 // Is this class bridged or not, and should its dependencies be scanned or not?
 // The result of this callback will be cached for use by is_opaque_object later.
 static MonoGCBridgeObjectKind
@@ -71,7 +62,7 @@ class_kind (MonoClass *klass)
 
                /* FIXME the bridge check can be quite expensive, cache it at the class level. */
                /* An array of a sealed type that is not a bridge will never get to a bridge */
-               if ((elem_class->flags & TYPE_ATTRIBUTE_SEALED) && !elem_class->has_references && !bridge_callbacks.bridge_class_kind (elem_class)) {
+               if ((mono_class_get_flags (elem_class) & TYPE_ATTRIBUTE_SEALED) && !elem_class->has_references && !bridge_callbacks.bridge_class_kind (elem_class)) {
                        SGEN_LOG (6, "class %s is opaque\n", klass->name);
                        return GC_BRIDGE_OPAQUE_CLASS;
                }
@@ -83,6 +74,36 @@ class_kind (MonoClass *klass)
 //enable usage logging
 // #define DUMP_GRAPH 1
 
+/* Used in bridgeless_color_is_heavy:
+ * The idea here is as long as the reference fanin and fanout on a node are both 2 or greater, then
+ * removing that node will result in a net increase in edge count. So the question is which node
+ * removals are counterproductive (i.e., how many edges saved balances out one node added).
+ * The number of edges saved by preserving a node is (fanin*fanout - fanin - fanout).
+ *
+ * With all that in mind:
+ *
+ * - HEAVY_REFS_MIN is the number that *both* fanin and fanout must meet to preserve the node.
+ * - HEAVY_COMBINED_REFS_MIN is the number (fanin*fanout) must meet to preserve the node.
+ *
+ * Note HEAVY_COMBINED_REFS_MIN must be <= 2*INCOMING_COLORS_MAX, or we won't know the true fanin.
+ */
+
+#define HEAVY_REFS_MIN 2
+#define HEAVY_COMBINED_REFS_MIN 60
+
+/* Used in ColorData:
+ * The higher INCOMING_COLORS_BITS is the higher HEAVY_COMBINED_REFS_MIN can be (see above).
+ * However, API_INDEX_BITS + INCOMING_COLORS_BITS must be equal to 31, and if API_INDEX_BITS is too
+ * low then terrible things will happen if too many colors are generated. (The number of colors we
+ * will ever attempt to generate is currently naturally limited by the JNI GREF limit.)
+ */
+
+#define API_INDEX_BITS        26
+#define INCOMING_COLORS_BITS  5
+
+#define API_INDEX_MAX         ((1<<API_INDEX_BITS)-1)
+#define INCOMING_COLORS_MAX   ((1<<INCOMING_COLORS_BITS)-1)
+
 // ScanData state
 enum {
        INITIAL,
@@ -94,13 +115,17 @@ enum {
 /*
 Optimizations:
        We can split this data structure in two, those with bridges and those without
+       (and only bridgeless need to record incoming_colors)
 */
 typedef struct {
-    // Colors (ColorDatas) linked to by objects with this color
+       // Colors (ColorDatas) linked to by objects with this color
        DynPtrArray other_colors;
-    // Bridge objects (GCObjects) held by objects with this color
+       // Bridge objects (GCObjects) held by objects with this color
        DynPtrArray bridges;
-       int api_index    : 31;
+       // Index of this color's MonoGCBridgeSCC in the array passed to the client (or -1 for none)
+       signed api_index         : API_INDEX_BITS;
+       // Count of colors that list this color in their other_colors
+       unsigned incoming_colors : INCOMING_COLORS_BITS;
        unsigned visited : 1;
 } ColorData;
 
@@ -115,7 +140,7 @@ typedef struct _ScanData {
        // Tarjan algorithm index (order visited)
        int index;
        // Tarjan index of lowest-index object known reachable from here
-       int low_index : 27;
+       signed low_index : 27;
 
        // See "ScanData state" enum above
        unsigned state : 2;
@@ -124,7 +149,22 @@ typedef struct _ScanData {
        unsigned obj_state : 2;
 } ScanData;
 
+/* Should color be made visible to client even though it has no bridges?
+ * True if we predict the number of reduced edges to be enough to justify the extra node.
+ */
+static inline gboolean
+bridgeless_color_is_heavy (ColorData *data) {
+       int fanin = data->incoming_colors;
+       int fanout = dyn_array_ptr_size (&data->other_colors);
+       return fanin > HEAVY_REFS_MIN && fanout > HEAVY_REFS_MIN
+               && fanin*fanout >= HEAVY_COMBINED_REFS_MIN;
+}
 
+// Should color be made visible to client?
+static inline gboolean
+color_visible_to_client (ColorData *data) {
+       return dyn_array_ptr_size (&data->bridges) || bridgeless_color_is_heavy (data);
+}
 
 // Stacks of ScanData objects used for tarjan algorithm.
 // The Tarjan algorithm is normally defined recursively; here scan_stack simulates the call stack of a recursive algorithm,
@@ -134,12 +174,21 @@ static DynPtrArray scan_stack, loop_stack;
 // GCObjects on which register_finalized_object has been called
 static DynPtrArray registered_bridges;
 
-// ColorData objects
+// As we traverse the graph, which ColorData objects are accessible from our current position?
 static DynPtrArray color_merge_array;
+// Running hash of the contents of the color_merge_array.
+static unsigned int color_merge_array_hash;
+
+static void color_merge_array_empty ()
+{
+       dyn_array_ptr_empty (&color_merge_array);
+       color_merge_array_hash = 0;
+}
 
 static int ignored_objects;
 static int object_index;
 static int num_colors_with_bridges;
+static int num_sccs;
 static int xref_count;
 
 static size_t setup_time, tarjan_time, scc_setup_time, gather_xref_time, xref_setup_time, cleanup_time;
@@ -161,6 +210,7 @@ static ObjectBucket *root_object_bucket;
 static ObjectBucket *cur_object_bucket;
 static int object_data_count;
 
+// Arenas to allocate ScanData from
 static ObjectBucket*
 new_object_bucket (void)
 {
@@ -213,7 +263,7 @@ free_object_buckets (void)
 //ColorData buckets
 #define NUM_COLOR_ENTRIES ((BUCKET_SIZE - SIZEOF_VOID_P * 2) / sizeof (ColorData))
 
-// Same as ObjectBucket except NUM_COLOR_ENTRIES and NUM_SCAN_ENTRIES differ
+// Arenas for ColorDatas, same as ObjectBucket except items-per-bucket differs
 typedef struct _ColorBucket ColorBucket;
 struct _ColorBucket {
        ColorBucket *next;
@@ -356,11 +406,13 @@ find_or_create_data (GCObject *obj)
 //----------
 typedef struct {
        ColorData *color;
-       int hash;
+       unsigned int hash;
 } HashEntry;
 
 /*
-We tried 2/32, 2/128, 4/32, 4/128, 6/128 and 8/128.
+The merge cache maps an ordered list of ColorDatas [the color_merge_array] to a single ColorData.
+
+About cache bucket tuning: We tried 2/32, 2/128, 4/32, 4/128, 6/128 and 8/128.
 
 The performance cost between 4/128 and 8/128 is so small since cache movement happens completely in the same cacheline,
 making the extra space pretty much free.
@@ -373,17 +425,39 @@ Memory wise, 4/32 takes 512 and 8/128 takes 8k, so it's quite reasonable.
 #define ELEMENTS_PER_BUCKET 8
 #define COLOR_CACHE_SIZE 128
 static HashEntry merge_cache [COLOR_CACHE_SIZE][ELEMENTS_PER_BUCKET];
+static unsigned int hash_perturb;
+
+// If true, disable an optimization where sometimes SCC nodes are merged without a perfect check
+static gboolean scc_precise_merge;
 
-static int
-mix_hash (size_t hash)
+static unsigned int
+mix_hash (uintptr_t source)
 {
-       return (int)(((hash * 215497) >> 16) ^ ((hash * 1823231) + hash));
+       unsigned int hash = source;
+
+       // The full hash determines whether two colors can be merged-- sometimes exclusively.
+       // This value changes every GC, so XORing it in before performing the hash will make the
+       // chance that two different colors will produce the same hash on successive GCs very low.
+       hash = hash ^ hash_perturb;
+
+       // Actual hash
+       hash = (((hash * 215497) >> 16) ^ ((hash * 1823231) + hash));
+
+       // Mix in highest bits on 64-bit systems only
+       if (sizeof (source) > 4)
+               hash = hash ^ (source >> 32);
+
+       return hash;
 }
 
 static void
 reset_cache (void)
 {
        memset (merge_cache, 0, sizeof (merge_cache));
+
+       // When using the precise merge debug option, we do not want the inconsistency caused by hash_perturb.
+       if (!scc_precise_merge)
+               ++hash_perturb;
 }
 
 
@@ -397,6 +471,13 @@ dyn_array_ptr_contains (DynPtrArray *da, void *x)
        return FALSE;
 }
 
+static gboolean
+match_colors_estimate (DynPtrArray *a, DynPtrArray *b)
+{
+       return dyn_array_ptr_size (a) == dyn_array_ptr_size (b);
+}
+
+
 static gboolean
 match_colors (DynPtrArray *a, DynPtrArray *b)
 {
@@ -411,23 +492,36 @@ match_colors (DynPtrArray *a, DynPtrArray *b)
        return TRUE;
 }
 
-static int cache_hits, cache_misses;
+// If scc_precise_merge, "semihits" refers to find_in_cache calls aborted because the merge array was too large.
+// Otherwise "semihits" refers to cache hits where the match was only estimated.
+static int cache_hits, cache_semihits, cache_misses;
 
+// The cache contains only non-bridged colors.
 static ColorData*
 find_in_cache (int *insert_index)
 {
        HashEntry *bucket;
-       int i, hash, size, index;
+       int i, size, index;
 
        size = dyn_array_ptr_size (&color_merge_array);
-       /* Cache checking is very ineficient with a lot of elements*/
-       if (size > 3)
+
+       /* Color equality checking is very expensive with a lot of elements, so when there are many
+        * elements we switch to a cheap comparison method which allows false positives. When false
+        * positives occur the worst that can happen is two items will be inappropriately merged
+        * and memory will be retained longer than it should be. We assume that will correct itself
+        * on the next GC (the hash_perturb mechanism increases the probability of this).
+        *
+        * Because this has *some* potential to create problems, if the user set the debug option
+        * 'enable-tarjan-precise-merge' we bail out early (and never merge SCCs with >3 colors).
+        */
+       gboolean color_merge_array_large = size > 3;
+       if (scc_precise_merge && color_merge_array_large) {
+               ++cache_semihits;
                return NULL;
+       }
 
-       hash = 0;
-       for (i = 0 ; i < size; ++i)
-               hash += mix_hash ((size_t)dyn_array_ptr_get (&color_merge_array, i));
-       if (!hash)
+       unsigned int hash = color_merge_array_hash;
+       if (!hash) // 0 is used to indicate an empty bucket entry
                hash = 1;
 
        index = hash & (COLOR_CACHE_SIZE - 1);
@@ -435,9 +529,17 @@ find_in_cache (int *insert_index)
        for (i = 0; i < ELEMENTS_PER_BUCKET; ++i) {
                if (bucket [i].hash != hash)
                        continue;
-               if (match_colors (&bucket [i].color->other_colors, &color_merge_array)) {
-                       ++cache_hits;
-                       return bucket [i].color;
+
+               if (color_merge_array_large) {
+                       if (match_colors_estimate (&bucket [i].color->other_colors, &color_merge_array)) {
+                               ++cache_semihits;
+                               return bucket [i].color;
+                       }
+               } else {
+                       if (match_colors (&bucket [i].color->other_colors, &color_merge_array)) {
+                               ++cache_hits;
+                               return bucket [i].color;
+                       }
                }
        }
 
@@ -450,14 +552,16 @@ find_in_cache (int *insert_index)
        return NULL;
 }
 
+// A color is needed for an SCC. If the SCC has bridges, the color MUST be newly allocated.
+// If the SCC lacks bridges, the allocator MAY use the cache to merge it with an existing one.
 static ColorData*
-new_color (gboolean force_new)
+new_color (gboolean has_bridges)
 {
-       int i = -1;
+       int cacheSlot = -1;
        ColorData *cd;
        /* XXX Try to find an equal one and return it */
-       if (!force_new) {
-               cd = find_in_cache (&i);
+       if (!has_bridges) {
+               cd = find_in_cache (&cacheSlot);
                if (cd)
                        return cd;
        }
@@ -465,9 +569,16 @@ new_color (gboolean force_new)
        cd = alloc_color_data ();
        cd->api_index = -1;
        dyn_array_ptr_set_all (&cd->other_colors, &color_merge_array);
-       /* if i >= 0, it means we prepared a given slot to receive the new color */
-       if (i >= 0)
-               merge_cache [i][0].color = cd;
+
+       // Inform targets
+       for (int i = 0; i < dyn_array_ptr_size (&color_merge_array); ++i) {
+               ColorData *points_to = (ColorData *)dyn_array_ptr_get (&color_merge_array, i);
+               points_to->incoming_colors = MIN (points_to->incoming_colors + 1, INCOMING_COLORS_MAX);
+       }
+
+       /* if cacheSlot >= 0, it means we prepared a given slot to receive the new color */
+       if (cacheSlot >= 0)
+               merge_cache [cacheSlot][0].color = cd;
 
        return cd;
 }
@@ -587,6 +698,7 @@ compute_low_index (ScanData *data, GCObject *obj)
 
        cd = other->color;
        if (!cd->visited) {
+               color_merge_array_hash += mix_hash ((uintptr_t) other->color);
                dyn_array_ptr_add (&color_merge_array, other->color);
                cd->visited = TRUE;
        }
@@ -608,16 +720,24 @@ compute_low (ScanData *data)
        #include "sgen/sgen-scan-object.h"
 }
 
+// A non-bridged object needs a single color describing the current merge array.
 static ColorData*
 reduce_color (void)
 {
        ColorData *color = NULL;
        int size = dyn_array_ptr_size (&color_merge_array);
 
+       // Merge array is empty-- this SCC points to no bridged colors.
+       // This SCC can be ignored completely.
        if (size == 0)
                color = NULL;
+
+       // Merge array has one item-- this SCC points to a single bridged color.
+       // This SCC can be forwarded to the pointed-to color.
        else if (size == 1) {
                color = (ColorData *)dyn_array_ptr_get (&color_merge_array, 0);
+
+       // This SCC gets to talk to the color allocator.
        } else
                color = new_color (FALSE);
 
@@ -694,7 +814,7 @@ create_scc (ScanData *data)
                g_assert (cd->visited);
                cd->visited = FALSE;
        }
-       dyn_array_ptr_empty (&color_merge_array);
+       color_merge_array_empty ();
        found_bridge = FALSE;
 }
 
@@ -704,7 +824,7 @@ dfs (void)
        g_assert (dyn_array_ptr_size (&scan_stack) == 1);
        g_assert (dyn_array_ptr_size (&loop_stack) == 0);
 
-       dyn_array_ptr_empty (&color_merge_array);
+       color_merge_array_empty ();
 
        while (dyn_array_ptr_size (&scan_stack) > 0) {
                ScanData *data = (ScanData *)dyn_array_ptr_pop (&scan_stack);
@@ -891,7 +1011,7 @@ gather_xrefs (ColorData *color)
                if (src->visited)
                        continue;
                src->visited = TRUE;
-               if (dyn_array_ptr_size (&src->bridges))
+               if (color_visible_to_client (src))
                        dyn_array_ptr_add (&color_merge_array, src);
                else
                        gather_xrefs (src);
@@ -907,7 +1027,7 @@ reset_xrefs (ColorData *color)
                if (!src->visited)
                        continue;
                src->visited = FALSE;
-               if (!dyn_array_ptr_size (&src->bridges))
+               if (!color_visible_to_client (src))
                        reset_xrefs (src);
        }
 }
@@ -915,9 +1035,7 @@ reset_xrefs (ColorData *color)
 static void
 processing_build_callback_data (int generation)
 {
-       int j, api_index;
-       MonoGCBridgeSCC **api_sccs;
-       MonoGCBridgeXRef *api_xrefs;
+       int j;
        gint64 curtime;
        ColorBucket *cur;
 
@@ -936,15 +1054,27 @@ processing_build_callback_data (int generation)
        printf ("number of SCCs %d\n", num_colors_with_bridges);
 #endif
 
+       // Count the number of SCCs visible to the client
+       num_sccs = 0;
+       for (cur = root_color_bucket; cur; cur = cur->next) {
+               ColorData *cd;
+               for (cd = &cur->data [0]; cd < cur->next_data; ++cd) {
+                       if (color_visible_to_client (cd))
+                               num_sccs++;
+               }
+       }
+
        /* This is a straightforward translation from colors to the bridge callback format. */
-       api_sccs = (MonoGCBridgeSCC **)sgen_alloc_internal_dynamic (sizeof (MonoGCBridgeSCC*) * num_colors_with_bridges, INTERNAL_MEM_BRIDGE_DATA, TRUE);
-       api_index = xref_count = 0;
+       MonoGCBridgeSCC **api_sccs = (MonoGCBridgeSCC **)sgen_alloc_internal_dynamic (sizeof (MonoGCBridgeSCC*) * num_sccs, INTERNAL_MEM_BRIDGE_DATA, TRUE);
+       int api_index = 0;
+       xref_count = 0;
 
+       // Convert visible SCCs, along with their bridged object list, to MonoGCBridgeSCCs in the client's SCC list
        for (cur = root_color_bucket; cur; cur = cur->next) {
                ColorData *cd;
                for (cd = &cur->data [0]; cd < cur->next_data; ++cd) {
                        int bridges = dyn_array_ptr_size (&cd->bridges);
-                       if (!bridges)
+                       if (!(bridges || bridgeless_color_is_heavy (cd)))
                                continue;
 
                        api_sccs [api_index] = (MonoGCBridgeSCC *)sgen_alloc_internal_dynamic (sizeof (MonoGCBridgeSCC) + sizeof (MonoObject*) * bridges, INTERNAL_MEM_BRIDGE_DATA, TRUE);
@@ -955,20 +1085,22 @@ processing_build_callback_data (int generation)
 
                        for (j = 0; j < bridges; ++j)
                                api_sccs [api_index]->objs [j] = (MonoObject *)dyn_array_ptr_get (&cd->bridges, j);
+
+                       g_assert(api_index < API_INDEX_MAX);
                        api_index++;
                }
        }
 
        scc_setup_time = step_timer (&curtime);
 
+       // Eliminate non-visible SCCs from the SCC list and redistribute xrefs
        for (cur = root_color_bucket; cur; cur = cur->next) {
                ColorData *cd;
                for (cd = &cur->data [0]; cd < cur->next_data; ++cd) {
-                       int bridges = dyn_array_ptr_size (&cd->bridges);
-                       if (!bridges)
+                       if (!color_visible_to_client (cd))
                                continue;
 
-                       dyn_array_ptr_empty (&color_merge_array);
+                       color_merge_array_empty ();
                        gather_xrefs (cd);
                        reset_xrefs (cd);
                        dyn_array_ptr_set_all (&cd->other_colors, &color_merge_array);
@@ -983,27 +1115,28 @@ processing_build_callback_data (int generation)
        dump_color_table (" after xref pass", TRUE);
 #endif
 
-       api_xrefs = (MonoGCBridgeXRef *)sgen_alloc_internal_dynamic (sizeof (MonoGCBridgeXRef) * xref_count, INTERNAL_MEM_BRIDGE_DATA, TRUE);
-       api_index = 0;
+       // Write out xrefs array
+       MonoGCBridgeXRef *api_xrefs = (MonoGCBridgeXRef *)sgen_alloc_internal_dynamic (sizeof (MonoGCBridgeXRef) * xref_count, INTERNAL_MEM_BRIDGE_DATA, TRUE);
+       int xref_index = 0;
        for (cur = root_color_bucket; cur; cur = cur->next) {
                ColorData *src;
                for (src = &cur->data [0]; src < cur->next_data; ++src) {
-                       int bridges = dyn_array_ptr_size (&src->bridges);
-                       if (!bridges)
+                       if (!color_visible_to_client (src))
                                continue;
 
                        for (j = 0; j < dyn_array_ptr_size (&src->other_colors); ++j) {
                                ColorData *dest = (ColorData *)dyn_array_ptr_get (&src->other_colors, j);
-                               g_assert (dyn_array_ptr_size (&dest->bridges)); /* We flattened the color graph, so this must never happen. */
+                               g_assert (color_visible_to_client (dest)); /* Supposedly we already eliminated all xrefs to non-visible objects. */
+
+                               api_xrefs [xref_index].src_scc_index = src->api_index;
+                               api_xrefs [xref_index].dst_scc_index = dest->api_index;
 
-                               api_xrefs [api_index].src_scc_index = src->api_index;
-                               api_xrefs [api_index].dst_scc_index = dest->api_index;
-                               ++api_index;
+                               ++xref_index;
                        }
                }
        }
 
-       g_assert (xref_count == api_index);
+       g_assert (xref_count == xref_index);
        xref_setup_time = step_timer (&curtime);
 
 #if defined (DUMP_GRAPH)
@@ -1013,7 +1146,7 @@ processing_build_callback_data (int generation)
 #endif
 
        //FIXME move half of the cleanup to before the bridge callback?
-       bridge_processor->num_sccs = num_colors_with_bridges;
+       bridge_processor->num_sccs = num_sccs;
        bridge_processor->api_sccs = api_sccs;
        bridge_processor->num_xrefs = xref_count;
        bridge_processor->api_xrefs = api_xrefs;
@@ -1026,7 +1159,7 @@ processing_after_callback (int generation)
        int bridge_count = dyn_array_ptr_size (&registered_bridges);
        int object_count = object_data_count;
        int color_count = color_data_count;
-       int scc_count = num_colors_with_bridges;
+       int colors_with_bridges_count = num_colors_with_bridges;
 
        SGEN_TV_GETTIME (curtime);
 
@@ -1035,10 +1168,10 @@ processing_after_callback (int generation)
 
        cleanup_time = step_timer (&curtime);
 
-       mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_GC, "GC_TAR_BRIDGE bridges %d objects %d colors %d ignored %d sccs %d xref %d cache %d/%d setup %.2fms tarjan %.2fms scc-setup %.2fms gather-xref %.2fms xref-setup %.2fms cleanup %.2fms",
-               bridge_count, object_count, color_count,
-               ignored_objects, scc_count, xref_count,
-               cache_hits, cache_misses,
+       mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_GC, "GC_TAR_BRIDGE bridges %d objects %d opaque %d colors %d colors-bridged %d colors-visible %d xref %d cache-hit %d cache-%s %d cache-miss %d setup %.2fms tarjan %.2fms scc-setup %.2fms gather-xref %.2fms xref-setup %.2fms cleanup %.2fms",
+               bridge_count, object_count, ignored_objects,
+               color_count, colors_with_bridges_count, num_sccs, xref_count,
+               cache_hits, (scc_precise_merge ? "abstain" : "semihit"), cache_semihits, cache_misses,
                setup_time / 10000.0f,
                tarjan_time / 10000.0f,
                scc_setup_time / 10000.0f,
@@ -1046,7 +1179,7 @@ processing_after_callback (int generation)
                xref_setup_time / 10000.0f,
                cleanup_time / 10000.0f);
 
-       cache_hits = cache_misses = 0;
+       cache_hits = cache_semihits = cache_misses = 0;
        ignored_objects = 0;
 }
 
@@ -1072,6 +1205,15 @@ describe_pointer (GCObject *obj)
        // printf ("  is visited: %d\n", (int)entry->is_visited);
 }
 
+static void
+set_config (const SgenBridgeProcessorConfig *config)
+{
+       if (config->scc_precise_merge) {
+               hash_perturb = 0;
+               scc_precise_merge = TRUE;
+       }
+}
+
 void
 sgen_tarjan_bridge_init (SgenBridgeProcessor *collector)
 {
@@ -1082,12 +1224,12 @@ sgen_tarjan_bridge_init (SgenBridgeProcessor *collector)
        collector->class_kind = class_kind;
        collector->register_finalized_object = register_finalized_object;
        collector->describe_pointer = describe_pointer;
-       collector->enable_accounting = enable_accounting;
-       // collector->set_dump_prefix = set_dump_prefix;
+       collector->set_config = set_config;
 
        sgen_register_fixed_internal_mem_type (INTERNAL_MEM_TARJAN_OBJ_BUCKET, BUCKET_SIZE);
        g_assert (sizeof (ObjectBucket) <= BUCKET_SIZE);
        g_assert (sizeof (ColorBucket) <= BUCKET_SIZE);
+       g_assert (API_INDEX_BITS + INCOMING_COLORS_BITS <= 31);
        bridge_processor = collector;
 }
 
diff --git a/mono/metadata/socket-io-windows-internals.h b/mono/metadata/socket-io-windows-internals.h
new file mode 100644 (file)
index 0000000..b76f9cb
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+* socket-io-windows-internals.h: Windows specific socket code.
+*
+* Copyright 2016 Microsoft
+* Licensed under the MIT license. See LICENSE file in the project root for full license information.
+*/
+#ifndef __MONO_METADATA_SOCKET_IO_WINDOWS_INTERNALS_H__
+#define __MONO_METADATA_SOCKET_IO_WINDOWS_INTERNALS_H__
+
+#include <config.h>
+#include <glib.h>
+#include <mono/io-layer/io-layer.h>
+
+SOCKET alertable_accept (SOCKET s, struct sockaddr *addr, int *addrlen, gboolean blocking);
+int alertable_connect (SOCKET s, const struct sockaddr *name, int namelen, gboolean blocking);
+int alertable_recv (SOCKET s, char *buf, int len, int flags, gboolean blocking);
+int alertable_recvfrom (SOCKET s, char *buf, int len, int flags, struct sockaddr *from, int *fromlen, gboolean blocking);
+int alertable_WSARecv (SOCKET s, LPWSABUF lpBuffers, DWORD dwBufferCount, LPDWORD lpNumberOfBytesRecvd, LPDWORD lpFlags, LPWSAOVERLAPPED lpOverlapped, LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine, gboolean blocking);
+int alertable_send (SOCKET s, char *buf, int len, int flags, gboolean blocking);
+int alertable_sendto (SOCKET s, const char *buf, int len, int flags, const struct sockaddr *to, int tolen, gboolean blocking);
+int alertable_WSASend (SOCKET s, LPWSABUF lpBuffers, DWORD dwBufferCount, LPDWORD lpNumberOfBytesRecvd, DWORD lpFlags, LPWSAOVERLAPPED lpOverlapped, LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine, gboolean blocking);
+
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT | HAVE_UWP_WINAPI_SUPPORT)
+BOOL alertable_TransmitFile (SOCKET hSocket, HANDLE hFile, DWORD nNumberOfBytesToWrite, DWORD nNumberOfBytesPerSend, LPOVERLAPPED lpOverlapped, LPTRANSMIT_FILE_BUFFERS lpTransmitBuffers, DWORD dwReserved, gboolean blocking);
+#endif
+
+#endif // __MONO_METADATA_SOCKET_IO_WINDOWS_INTERNALS_H__
diff --git a/mono/metadata/socket-io-windows.c b/mono/metadata/socket-io-windows.c
new file mode 100644 (file)
index 0000000..125dbeb
--- /dev/null
@@ -0,0 +1,209 @@
+/*
+* socket-io-windows.c: Windows specific socket code.
+*
+* Copyright 2016 Microsoft
+* Licensed under the MIT license. See LICENSE file in the project root for full license information.
+*/
+#include <config.h>
+#include <glib.h>
+
+#include "mono/metadata/socket-io-windows-internals.h"
+
+#define LOGDEBUG(...)  
+
+static gboolean set_blocking (SOCKET sock, gboolean block)
+{
+       u_long non_block = block ? 0 : 1;
+       return ioctlsocket (sock, FIONBIO, &non_block) != SOCKET_ERROR;
+}
+
+static DWORD get_socket_timeout (SOCKET sock, int optname)
+{
+       DWORD timeout = 0;
+       int optlen = sizeof (DWORD);
+       if (getsockopt (sock, SOL_SOCKET, optname, (char *)&timeout, &optlen) == SOCKET_ERROR) {
+               WSASetLastError (0);
+               return WSA_INFINITE;
+       }
+       if (timeout == 0)
+               timeout = WSA_INFINITE; // 0 means infinite
+       return timeout;
+}
+
+/*
+* Performs an alertable wait for the specified event (FD_ACCEPT_BIT,
+* FD_CONNECT_BIT, FD_READ_BIT, FD_WRITE_BIT) on the specified socket.
+* Returns TRUE if the event is fired without errors. Calls WSASetLastError()
+* with WSAEINTR and returns FALSE if the thread is alerted. If the event is
+* fired but with an error WSASetLastError() is called to set the error and the
+* function returns FALSE.
+*/
+static gboolean alertable_socket_wait (SOCKET sock, int event_bit)
+{
+       static char *EVENT_NAMES[] = { "FD_READ", "FD_WRITE", NULL /*FD_OOB*/, "FD_ACCEPT", "FD_CONNECT", "FD_CLOSE" };
+       gboolean success = FALSE;
+       int error = -1;
+       DWORD timeout = WSA_INFINITE;
+       if (event_bit == FD_READ_BIT || event_bit == FD_WRITE_BIT) {
+               timeout = get_socket_timeout (sock, event_bit == FD_READ_BIT ? SO_RCVTIMEO : SO_SNDTIMEO);
+       }
+       WSASetLastError (0);
+       WSAEVENT event = WSACreateEvent ();
+       if (event != WSA_INVALID_EVENT) {
+               if (WSAEventSelect (sock, event, (1 << event_bit) | FD_CLOSE) != SOCKET_ERROR) {
+                       LOGDEBUG (g_message ("%06d - Calling WSAWaitForMultipleEvents () on socket %d", GetCurrentThreadId (), sock));
+                       DWORD ret = WSAWaitForMultipleEvents (1, &event, TRUE, timeout, TRUE);
+                       if (ret == WSA_WAIT_IO_COMPLETION) {
+                               LOGDEBUG (g_message ("%06d - WSAWaitForMultipleEvents () returned WSA_WAIT_IO_COMPLETION for socket %d", GetCurrentThreadId (), sock));
+                               error = WSAEINTR;
+                       } else if (ret == WSA_WAIT_TIMEOUT) {
+                               error = WSAETIMEDOUT;
+                       } else {
+                               g_assert (ret == WSA_WAIT_EVENT_0);
+                               WSANETWORKEVENTS ne = { 0 };
+                               if (WSAEnumNetworkEvents (sock, event, &ne) != SOCKET_ERROR) {
+                                       if (ne.lNetworkEvents & (1 << event_bit) && ne.iErrorCode[event_bit]) {
+                                               LOGDEBUG (g_message ("%06d - %s error %d on socket %d", GetCurrentThreadId (), EVENT_NAMES[event_bit], ne.iErrorCode[event_bit], sock));
+                                               error = ne.iErrorCode[event_bit];
+                                       } else if (ne.lNetworkEvents & FD_CLOSE_BIT && ne.iErrorCode[FD_CLOSE_BIT]) {
+                                               LOGDEBUG (g_message ("%06d - FD_CLOSE error %d on socket %d", GetCurrentThreadId (), ne.iErrorCode[FD_CLOSE_BIT], sock));
+                                               error = ne.iErrorCode[FD_CLOSE_BIT];
+                                       } else {
+                                               LOGDEBUG (g_message ("%06d - WSAEnumNetworkEvents () finished successfully on socket %d", GetCurrentThreadId (), sock));
+                                               success = TRUE;
+                                               error = 0;
+                                       }
+                               }
+                       }
+                       WSAEventSelect (sock, NULL, 0);
+               }
+               WSACloseEvent (event);
+       }
+       if (error != -1) {
+               WSASetLastError (error);
+       }
+       return success;
+}
+
+#define ALERTABLE_SOCKET_CALL(event_bit, blocking, repeat, ret, op, sock, ...) \
+       LOGDEBUG (g_message ("%06d - Performing %s " #op " () on socket %d", GetCurrentThreadId (), blocking ? "blocking" : "non-blocking", sock)); \
+       if (blocking) { \
+               if (set_blocking(sock, FALSE)) { \
+                       while (-1 == (int) (ret = op (sock, __VA_ARGS__))) { \
+                               int _error = WSAGetLastError ();\
+                               if (_error != WSAEWOULDBLOCK && _error != WSA_IO_PENDING) \
+                                       break; \
+                               if (!alertable_socket_wait (sock, event_bit) || !repeat) \
+                                       break; \
+                       } \
+                       int _saved_error = WSAGetLastError (); \
+                       set_blocking (sock, TRUE); \
+                       WSASetLastError (_saved_error); \
+               } \
+       } else { \
+               ret = op (sock, __VA_ARGS__); \
+       } \
+       int _saved_error = WSAGetLastError (); \
+       LOGDEBUG (g_message ("%06d - Finished %s " #op " () on socket %d (ret = %d, WSAGetLastError() = %d)", GetCurrentThreadId (), \
+               blocking ? "blocking" : "non-blocking", sock, ret, _saved_error)); \
+       WSASetLastError (_saved_error);
+
+SOCKET alertable_accept (SOCKET s, struct sockaddr *addr, int *addrlen, gboolean blocking)
+{
+       SOCKET newsock = INVALID_SOCKET;
+       ALERTABLE_SOCKET_CALL (FD_ACCEPT_BIT, blocking, TRUE, newsock, accept, s, addr, addrlen);
+       return newsock;
+}
+
+int alertable_connect (SOCKET s, const struct sockaddr *name, int namelen, gboolean blocking)
+{
+       int ret = SOCKET_ERROR;
+       ALERTABLE_SOCKET_CALL (FD_CONNECT_BIT, blocking, FALSE, ret, connect, s, name, namelen);
+       ret = WSAGetLastError () != 0 ? SOCKET_ERROR : 0;
+       return ret;
+}
+
+int alertable_recv (SOCKET s, char *buf, int len, int flags, gboolean blocking)
+{
+       int ret = SOCKET_ERROR;
+       ALERTABLE_SOCKET_CALL (FD_READ_BIT, blocking, TRUE, ret, recv, s, buf, len, flags);
+       return ret;
+}
+
+int alertable_recvfrom (SOCKET s, char *buf, int len, int flags, struct sockaddr *from, int *fromlen, gboolean blocking)
+{
+       int ret = SOCKET_ERROR;
+       ALERTABLE_SOCKET_CALL (FD_READ_BIT, blocking, TRUE, ret, recvfrom, s, buf, len, flags, from, fromlen);
+       return ret;
+}
+
+int alertable_WSARecv (SOCKET s, LPWSABUF lpBuffers, DWORD dwBufferCount, LPDWORD lpNumberOfBytesRecvd, LPDWORD lpFlags, LPWSAOVERLAPPED lpOverlapped, LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine, gboolean blocking)
+{
+       int ret = SOCKET_ERROR;
+       ALERTABLE_SOCKET_CALL (FD_READ_BIT, blocking, TRUE, ret, WSARecv, s, lpBuffers, dwBufferCount, lpNumberOfBytesRecvd, lpFlags, lpOverlapped, lpCompletionRoutine);
+       return ret;
+}
+
+int alertable_send (SOCKET s, char *buf, int len, int flags, gboolean blocking)
+{
+       int ret = SOCKET_ERROR;
+       ALERTABLE_SOCKET_CALL (FD_WRITE_BIT, blocking, FALSE, ret, send, s, buf, len, flags);
+       return ret;
+}
+
+int alertable_sendto (SOCKET s, const char *buf, int len, int flags, const struct sockaddr *to, int tolen, gboolean blocking)
+{
+       int ret = SOCKET_ERROR;
+       ALERTABLE_SOCKET_CALL (FD_WRITE_BIT, blocking, FALSE, ret, sendto, s, buf, len, flags, to, tolen);
+       return ret;
+}
+
+int alertable_WSASend (SOCKET s, LPWSABUF lpBuffers, DWORD dwBufferCount, LPDWORD lpNumberOfBytesRecvd, DWORD lpFlags, LPWSAOVERLAPPED lpOverlapped, LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine, gboolean blocking)
+{
+       int ret = SOCKET_ERROR;
+       ALERTABLE_SOCKET_CALL (FD_WRITE_BIT, blocking, FALSE, ret, WSASend, s, lpBuffers, dwBufferCount, lpNumberOfBytesRecvd, lpFlags, lpOverlapped, lpCompletionRoutine);
+       return ret;
+}
+
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT | HAVE_UWP_WINAPI_SUPPORT)
+BOOL alertable_TransmitFile (SOCKET hSocket, HANDLE hFile, DWORD nNumberOfBytesToWrite, DWORD nNumberOfBytesPerSend, LPOVERLAPPED lpOverlapped, LPTRANSMIT_FILE_BUFFERS lpTransmitBuffers, DWORD dwReserved, gboolean blocking)
+{
+       LOGDEBUG (g_message ("%06d - Performing %s TransmitFile () on socket %d", GetCurrentThreadId (), blocking ? "blocking" : "non-blocking", hSocket));
+
+       int error = 0;
+       if (blocking) {
+               g_assert (lpOverlapped == NULL);
+               OVERLAPPED overlapped = { 0 };
+               overlapped.hEvent = WSACreateEvent ();
+               if (overlapped.hEvent == WSA_INVALID_EVENT)
+                       return FALSE;
+               if (!TransmitFile (hSocket, hFile, nNumberOfBytesToWrite, nNumberOfBytesPerSend, &overlapped, lpTransmitBuffers, dwReserved)) {
+                       error = WSAGetLastError ();
+                       if (error == WSA_IO_PENDING) {
+                               error = 0;
+                               // NOTE: .NET's Socket.SendFile() doesn't honor the Socket's SendTimeout so we shouldn't either
+                               DWORD ret = WaitForSingleObjectEx (overlapped.hEvent, INFINITE, TRUE);
+                               if (ret == WAIT_IO_COMPLETION) {
+                                       LOGDEBUG (g_message ("%06d - WaitForSingleObjectEx () returned WSA_WAIT_IO_COMPLETION for socket %d", GetCurrentThreadId (), hSocket));
+                                       error = WSAEINTR;
+                               } else if (ret == WAIT_TIMEOUT) {
+                                       error = WSAETIMEDOUT;
+                               } else if (ret != WAIT_OBJECT_0) {
+                                       error = GetLastError ();
+                               }
+                       }
+               }
+               WSACloseEvent (overlapped.hEvent);
+       } else {
+               if (!TransmitFile (hSocket, hFile, nNumberOfBytesToWrite, nNumberOfBytesPerSend, lpOverlapped, lpTransmitBuffers, dwReserved)) {
+                       error = WSAGetLastError ();
+               }
+       }
+
+       LOGDEBUG (g_message ("%06d - Finished %s TransmitFile () on socket %d (ret = %d, WSAGetLastError() = %d)", GetCurrentThreadId (), \
+               blocking ? "blocking" : "non-blocking", hSocket, error == 0, error));
+       WSASetLastError (error);
+
+       return error == 0;
+}
+#endif /* #if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT | HAVE_UWP_WINAPI_SUPPORT) */
index 04c55e7241bc4a85ced64fc6cf8bfbc3ae11a192..b5866b73a22bb730dc3109f85cf6c7576e1f7662 100644 (file)
@@ -62,7 +62,7 @@
 #include <mono/utils/mono-threads.h>
 #include <mono/utils/mono-memory-model.h>
 #include <mono/utils/networking.h>
-#include <mono/utils/w32handle.h>
+#include <mono/metadata/w32handle.h>
 
 #include <time.h>
 #ifdef HAVE_SYS_TIME_H
 #include <ifaddrs.h>
 #endif
 
+#if defined(_MSC_VER) && G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT | HAVE_UWP_WINAPI_SUPPORT)
+#include <MSWSock.h>
+#endif
+
 #include "mono/io-layer/socket-wrappers.h"
+#ifdef HOST_WIN32
+#include "mono/metadata/socket-io-windows-internals.h"
+#endif
 
 #define LOGDEBUG(...)  
 /* define LOGDEBUG(...) g_message(__VA_ARGS__)  */
@@ -588,61 +595,6 @@ get_socket_assembly (void)
        return domain->socket_assembly;
 }
 
-static gint32
-get_family_hint (MonoError *error)
-{
-       MonoDomain *domain = mono_domain_get ();
-
-       mono_error_init (error);
-
-       if (!domain->inet_family_hint) {
-               MonoImage *socket_assembly;
-               MonoClass *socket_class;
-               MonoClassField *ipv6_field, *ipv4_field;
-               gint32 ipv6_enabled = -1, ipv4_enabled = -1;
-               MonoVTable *vtable;
-
-               socket_assembly = get_socket_assembly ();
-               g_assert (socket_assembly);
-
-               socket_class = mono_class_load_from_name (socket_assembly, "System.Net.Sockets", "Socket");
-
-               ipv4_field = mono_class_get_field_from_name (socket_class, "ipv4_supported");
-               g_assert (ipv4_field);
-
-               ipv6_field = mono_class_get_field_from_name (socket_class, "ipv6_supported");
-               g_assert (ipv6_field);
-
-               vtable = mono_class_vtable (mono_domain_get (), socket_class);
-               g_assert (vtable);
-
-               mono_runtime_class_init_full (vtable, error);
-               return_val_if_nok (error, -1);
-
-               mono_field_static_get_value_checked (vtable, ipv4_field, &ipv4_enabled, error);
-               return_val_if_nok (error, -1);
-               mono_field_static_get_value_checked (vtable, ipv6_field, &ipv6_enabled, error);
-               return_val_if_nok (error, -1);
-
-               mono_domain_lock (domain);
-               if (ipv4_enabled == 1 && ipv6_enabled == 1) {
-                       domain->inet_family_hint = 1;
-               } else if (ipv4_enabled == 1) {
-                       domain->inet_family_hint = 2;
-               } else {
-                       domain->inet_family_hint = 3;
-               }
-               mono_domain_unlock (domain);
-       }
-       switch (domain->inet_family_hint) {
-       case 1: return PF_UNSPEC;
-       case 2: return PF_INET;
-       case 3: return PF_INET6;
-       default:
-               return PF_UNSPEC;
-       }
-}
-
 gpointer
 ves_icall_System_Net_Sockets_Socket_Socket_internal (MonoObject *this_obj, gint32 family, gint32 type, gint32 proto, gint32 *werror)
 {
@@ -765,7 +717,7 @@ ves_icall_System_Net_Sockets_Socket_Accept_internal (SOCKET sock, gint32 *werror
        {
                MonoInternalThread *curthread = mono_thread_internal_current ();
                curthread->interrupt_on_stop = (gpointer)TRUE;
-               newsock = _wapi_accept (sock, NULL, 0);
+               newsock = alertable_accept (sock, NULL, 0, blocking);
                curthread->interrupt_on_stop = (gpointer)FALSE;
        }
 #else
@@ -774,16 +726,15 @@ ves_icall_System_Net_Sockets_Socket_Accept_internal (SOCKET sock, gint32 *werror
 
        MONO_EXIT_GC_SAFE;
 
+       if (newsock == INVALID_SOCKET)
+               *werror = WSAGetLastError ();
+
        mono_thread_info_uninstall_interrupt (&interrupted);
-       if (interrupted) {
+       if (interrupted)
                *werror = WSAEINTR;
-               return NULL;
-       }
 
-       if (newsock == INVALID_SOCKET) {
-               *werror = WSAGetLastError ();
+       if (*werror)
                return NULL;
-       }
        
        return GUINT_TO_POINTER (newsock);
 }
@@ -1304,7 +1255,7 @@ ves_icall_System_Net_Sockets_Socket_Poll_internal (SOCKET sock, gint mode,
 }
 
 void
-ves_icall_System_Net_Sockets_Socket_Connect_internal (SOCKET sock, MonoObject *sockaddr, gint32 *werror)
+ves_icall_System_Net_Sockets_Socket_Connect_internal (SOCKET sock, MonoObject *sockaddr, gint32 *werror, gboolean blocking)
 {
        MonoError error;
        struct sockaddr *sa;
@@ -1332,22 +1283,25 @@ ves_icall_System_Net_Sockets_Socket_Connect_internal (SOCKET sock, MonoObject *s
 
        MONO_ENTER_GC_SAFE;
 
+#ifdef HOST_WIN32
+       ret = alertable_connect (sock, sa, sa_size, blocking);
+#else
        ret = _wapi_connect (sock, sa, sa_size);
+#endif
 
        MONO_EXIT_GC_SAFE;
 
-       mono_thread_info_uninstall_interrupt (&interrupted);
-       if (interrupted) {
-               *werror = WSAEINTR;
-               return;
-       }
-
        if (ret == SOCKET_ERROR)
                *werror = WSAGetLastError ();
 
+       mono_thread_info_uninstall_interrupt (&interrupted);
+       if (interrupted)
+               *werror = WSAEINTR;
+
        g_free (sa);
 }
 
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT | HAVE_UWP_WINAPI_SUPPORT)
 /* These #defines from mswsock.h from wine.  Defining them here allows
  * us to build this file on a mingw box that doesn't know the magic
  * numbers, but still run on a newer windows box that does.
@@ -1423,10 +1377,10 @@ ves_icall_System_Net_Sockets_Socket_Disconnect_internal (SOCKET sock, MonoBoolea
        MONO_ENTER_GC_SAFE;
 
        if (_wapi_disconnectex != NULL) {
-               if (!_wapi_disconnectex (sock, NULL, TF_REUSE_SOCKET, 0))
+               if (!_wapi_disconnectex (sock, NULL, reuse ? TF_REUSE_SOCKET : 0, 0))
                        *werror = WSAGetLastError ();
        } else if (_wapi_transmitfile != NULL) {
-               if (!_wapi_transmitfile (sock, NULL, 0, 0, NULL, NULL, TF_DISCONNECT | TF_REUSE_SOCKET))
+               if (!_wapi_transmitfile (sock, NULL, 0, 0, NULL, NULL, TF_DISCONNECT | (reuse ? TF_REUSE_SOCKET : 0)))
                        *werror = WSAGetLastError ();
        } else {
                *werror = ERROR_NOT_SUPPORTED;
@@ -1438,9 +1392,10 @@ ves_icall_System_Net_Sockets_Socket_Disconnect_internal (SOCKET sock, MonoBoolea
        if (interrupted)
                *werror = WSAEINTR;
 }
+#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT | HAVE_UWP_WINAPI_SUPPORT) */
 
 gint32
-ves_icall_System_Net_Sockets_Socket_Receive_internal (SOCKET sock, MonoArray *buffer, gint32 offset, gint32 count, gint32 flags, gint32 *werror)
+ves_icall_System_Net_Sockets_Socket_Receive_internal (SOCKET sock, MonoArray *buffer, gint32 offset, gint32 count, gint32 flags, gint32 *werror, gboolean blocking)
 {
        int ret;
        guchar *buf;
@@ -1472,7 +1427,7 @@ ves_icall_System_Net_Sockets_Socket_Receive_internal (SOCKET sock, MonoArray *bu
 #ifdef HOST_WIN32
        {
                curthread->interrupt_on_stop = (gpointer)TRUE;
-               ret = _wapi_recv (sock, buf, count, recvflags);
+               ret = alertable_recv (sock, buf, count, recvflags, blocking);
                curthread->interrupt_on_stop = (gpointer)FALSE;
        }
 #else
@@ -1481,22 +1436,21 @@ ves_icall_System_Net_Sockets_Socket_Receive_internal (SOCKET sock, MonoArray *bu
 
        MONO_EXIT_GC_SAFE;
 
+       if (ret == SOCKET_ERROR)
+               *werror = WSAGetLastError ();
+
        mono_thread_info_uninstall_interrupt (&interrupted);
-       if (interrupted) {
+       if (interrupted)
                *werror = WSAEINTR;
-               return 0;
-       }
 
-       if (ret == SOCKET_ERROR) {
-               *werror = WSAGetLastError ();
+       if (*werror)
                return 0;
-       }
 
        return ret;
 }
 
 gint32
-ves_icall_System_Net_Sockets_Socket_Receive_array_internal (SOCKET sock, MonoArray *buffers, gint32 flags, gint32 *werror)
+ves_icall_System_Net_Sockets_Socket_Receive_array_internal (SOCKET sock, MonoArray *buffers, gint32 flags, gint32 *werror, gboolean blocking)
 {
        int ret, count;
        gboolean interrupted;
@@ -1523,26 +1477,29 @@ ves_icall_System_Net_Sockets_Socket_Receive_array_internal (SOCKET sock, MonoArr
 
        MONO_ENTER_GC_SAFE;
 
+#ifdef HOST_WIN32
+       ret = alertable_WSARecv (sock, wsabufs, count, &recv, &recvflags, NULL, NULL, blocking);
+#else
        ret = WSARecv (sock, wsabufs, count, &recv, &recvflags, NULL, NULL);
+#endif
 
        MONO_EXIT_GC_SAFE;
 
+       if (ret == SOCKET_ERROR)
+               *werror = WSAGetLastError ();
+
        mono_thread_info_uninstall_interrupt (&interrupted);
-       if (interrupted) {
+       if (interrupted)
                *werror = WSAEINTR;
-               return 0;
-       }
 
-       if (ret == SOCKET_ERROR) {
-               *werror = WSAGetLastError ();
+       if (*werror)
                return 0;
-       }
 
        return recv;
 }
 
 gint32
-ves_icall_System_Net_Sockets_Socket_ReceiveFrom_internal (SOCKET sock, MonoArray *buffer, gint32 offset, gint32 count, gint32 flags, MonoObject **sockaddr, gint32 *werror)
+ves_icall_System_Net_Sockets_Socket_ReceiveFrom_internal (SOCKET sock, MonoArray *buffer, gint32 offset, gint32 count, gint32 flags, MonoObject **sockaddr, gint32 *werror, gboolean blocking)
 {
        MonoError error;
        int ret;
@@ -1584,20 +1541,24 @@ ves_icall_System_Net_Sockets_Socket_ReceiveFrom_internal (SOCKET sock, MonoArray
 
        MONO_ENTER_GC_SAFE;
 
+#ifdef HOST_WIN32
+       ret = alertable_recvfrom (sock, buf, count, recvflags, sa, &sa_size, blocking);
+#else
        ret = _wapi_recvfrom (sock, buf, count, recvflags, sa, &sa_size);
+#endif
 
        MONO_EXIT_GC_SAFE;
 
+       if (ret == SOCKET_ERROR)
+               *werror = WSAGetLastError ();
+
        mono_thread_info_uninstall_interrupt (&interrupted);
-       if (interrupted) {
-               g_free (sa);
+
+       if (interrupted)
                *werror = WSAEINTR;
-               return 0;
-       }
 
-       if (ret==SOCKET_ERROR) {
-               g_free (sa);
-               *werror = WSAGetLastError ();
+       if (*werror) {
+               g_free(sa);
                return 0;
        }
 
@@ -1622,7 +1583,7 @@ ves_icall_System_Net_Sockets_Socket_ReceiveFrom_internal (SOCKET sock, MonoArray
 }
 
 gint32
-ves_icall_System_Net_Sockets_Socket_Send_internal (SOCKET sock, MonoArray *buffer, gint32 offset, gint32 count, gint32 flags, gint32 *werror)
+ves_icall_System_Net_Sockets_Socket_Send_internal (SOCKET sock, MonoArray *buffer, gint32 offset, gint32 count, gint32 flags, gint32 *werror, gboolean blocking)
 {
        int ret;
        guchar *buf;
@@ -1656,26 +1617,29 @@ ves_icall_System_Net_Sockets_Socket_Send_internal (SOCKET sock, MonoArray *buffe
 
        MONO_ENTER_GC_SAFE;
 
+#ifdef HOST_WIN32
+       ret = alertable_send (sock, buf, count, sendflags, blocking);
+#else
        ret = _wapi_send (sock, buf, count, sendflags);
+#endif
 
        MONO_EXIT_GC_SAFE;
 
+       if (ret == SOCKET_ERROR)
+               *werror = WSAGetLastError ();
+
        mono_thread_info_uninstall_interrupt (&interrupted);
-       if (interrupted) {
+       if (interrupted)
                *werror = WSAEINTR;
-               return 0;
-       }
 
-       if (ret == SOCKET_ERROR) {
-               *werror = WSAGetLastError ();
+       if (*werror)
                return 0;
-       }
 
        return ret;
 }
 
 gint32
-ves_icall_System_Net_Sockets_Socket_Send_array_internal (SOCKET sock, MonoArray *buffers, gint32 flags, gint32 *werror)
+ves_icall_System_Net_Sockets_Socket_Send_array_internal (SOCKET sock, MonoArray *buffers, gint32 flags, gint32 *werror, gboolean blocking)
 {
        int ret, count;
        DWORD sent;
@@ -1702,26 +1666,29 @@ ves_icall_System_Net_Sockets_Socket_Send_array_internal (SOCKET sock, MonoArray
 
        MONO_ENTER_GC_SAFE;
 
+#ifdef HOST_WIN32
+       ret = alertable_WSASend (sock, wsabufs, count, &sent, sendflags, NULL, NULL, blocking);
+#else
        ret = WSASend (sock, wsabufs, count, &sent, sendflags, NULL, NULL);
+#endif
 
        MONO_EXIT_GC_SAFE;
 
+       if (ret == SOCKET_ERROR)
+               *werror = WSAGetLastError ();
+
        mono_thread_info_uninstall_interrupt (&interrupted);
-       if (interrupted) {
+       if (interrupted)
                *werror = WSAEINTR;
-               return 0;
-       }
 
-       if (ret == SOCKET_ERROR) {
-               *werror = WSAGetLastError ();
+       if (*werror)
                return 0;
-       }
-       
+
        return sent;
 }
 
 gint32
-ves_icall_System_Net_Sockets_Socket_SendTo_internal (SOCKET sock, MonoArray *buffer, gint32 offset, gint32 count, gint32 flags, MonoObject *sockaddr, gint32 *werror)
+ves_icall_System_Net_Sockets_Socket_SendTo_internal (SOCKET sock, MonoArray *buffer, gint32 offset, gint32 count, gint32 flags, MonoObject *sockaddr, gint32 *werror, gboolean blocking)
 {
        MonoError error;
        int ret;
@@ -1769,22 +1736,26 @@ ves_icall_System_Net_Sockets_Socket_SendTo_internal (SOCKET sock, MonoArray *buf
 
        MONO_ENTER_GC_SAFE;
 
+#ifdef HOST_WIN32
+       ret = alertable_sendto (sock, buf, count, sendflags, sa, sa_size, blocking);
+#else
        ret = _wapi_sendto (sock, buf, count, sendflags, sa, sa_size);
+#endif
 
        MONO_EXIT_GC_SAFE;
 
+       if (ret == SOCKET_ERROR)
+               *werror = WSAGetLastError ();
+
        mono_thread_info_uninstall_interrupt (&interrupted);
-       if (interrupted) {
-               g_free (sa);
+       if (interrupted)
                *werror = WSAEINTR;
-               return 0;
-       }
 
-       if (ret == SOCKET_ERROR)
-               *werror = WSAGetLastError ();
+       g_free(sa);
+
+       if (*werror)
+               return 0;
 
-       g_free (sa);
-       
        return ret;
 }
 
@@ -1794,7 +1765,7 @@ Socket_to_SOCKET (MonoObject *sockobj)
        MonoSafeHandle *safe_handle;
        MonoClassField *field;
        
-       field = mono_class_get_field_from_name (sockobj->vtable->klass, "safe_handle");
+       field = mono_class_get_field_from_name (sockobj->vtable->klass, "m_Handle");
        safe_handle = ((MonoSafeHandle *)(*(gpointer *)(((char *)sockobj) + field->offset)));
 
        if (safe_handle == NULL)
@@ -1961,7 +1932,7 @@ ves_icall_System_Net_Sockets_Socket_GetSocketOption_obj_internal (SOCKET sock, g
        int system_level = 0;
        int system_name = 0;
        int ret;
-       int val;
+       int val = 0;
        socklen_t valsize = sizeof (val);
        struct linger linger;
        socklen_t lingersize = sizeof (linger);
@@ -2454,14 +2425,14 @@ ves_icall_System_Net_Sockets_Socket_Shutdown_internal (SOCKET sock, gint32 how,
 
        MONO_EXIT_GC_SAFE;
 
+       if (ret == SOCKET_ERROR)
+               *werror = WSAGetLastError ();
+
        mono_thread_info_uninstall_interrupt (&interrupted);
        if (interrupted) {
                *werror = WSAEINTR;
-               return;
        }
 
-       if (ret == SOCKET_ERROR)
-               *werror = WSAGetLastError ();
 }
 
 gint
@@ -2620,50 +2591,18 @@ leave2:
        return is_ok (error);
 }
 
-static int
-get_addrinfo_family_hint (MonoError *error)
-{
-       int hint;
-
-       mono_error_init (error);
-
-       hint = get_family_hint (error);
-       return_val_if_nok (error, 0);
-
-       switch (hint) {
-       case PF_UNSPEC:
-               return MONO_HINT_UNSPECIFIED;
-       case PF_INET:
-               return MONO_HINT_IPV4;
-#ifdef PF_INET6
-       case PF_INET6:
-               return MONO_HINT_IPV6;
-#endif
-       default:
-               g_error ("invalid hint");
-               return 0;
-       }
-}
-
 MonoBoolean
-ves_icall_System_Net_Dns_GetHostByName_internal (MonoString *host, MonoString **h_name, MonoArray **h_aliases, MonoArray **h_addr_list)
+ves_icall_System_Net_Dns_GetHostByName_internal (MonoString *host, MonoString **h_name, MonoArray **h_aliases, MonoArray **h_addr_list, gint32 hint)
 {
        MonoError error;
        gboolean add_local_ips = FALSE, add_info_ok = TRUE;
        gchar this_hostname [256];
        MonoAddressInfo *info = NULL;
-       int hint;
 
        char *hostname = mono_string_to_utf8_checked (host, &error);
        if (mono_error_set_pending_exception (&error))
                return FALSE;
 
-       hint = get_addrinfo_family_hint (&error);
-       if (!mono_error_ok (&error)) {
-               mono_error_set_pending_exception (&error);
-               return FALSE;
-       }
-
        if (*hostname == '\0') {
                add_local_ips = TRUE;
                *h_name = host;
@@ -2698,14 +2637,14 @@ ves_icall_System_Net_Dns_GetHostByName_internal (MonoString *host, MonoString **
 }
 
 MonoBoolean
-ves_icall_System_Net_Dns_GetHostByAddr_internal (MonoString *addr, MonoString **h_name, MonoArray **h_aliases, MonoArray **h_addr_list)
+ves_icall_System_Net_Dns_GetHostByAddr_internal (MonoString *addr, MonoString **h_name, MonoArray **h_aliases, MonoArray **h_addr_list, gint32 hint)
 {
        char *address;
        struct sockaddr_in saddr;
        struct sockaddr_in6 saddr6;
        MonoAddressInfo *info = NULL;
        MonoError error;
-       gint32 family, hint;
+       gint32 family;
        gchar hostname [NI_MAXHOST] = { 0 };
        gboolean ret;
 
@@ -2752,11 +2691,6 @@ ves_icall_System_Net_Dns_GetHostByAddr_internal (MonoString *addr, MonoString **
        if (!ret)
                return FALSE;
 
-       hint = get_addrinfo_family_hint (&error);
-       if (!mono_error_ok (&error)) {
-               mono_error_set_pending_exception (&error);
-               return FALSE;
-       }
        if (mono_get_address_info (hostname, 0, hint | MONO_HINT_CANONICAL_NAME | MONO_HINT_CONFIGURED_ONLY, &info) != 0)
                return FALSE;
 
@@ -2780,11 +2714,11 @@ ves_icall_System_Net_Dns_GetHostName_internal (MonoString **h_name)
        return TRUE;
 }
 
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT | HAVE_UWP_WINAPI_SUPPORT)
 gboolean
-ves_icall_System_Net_Sockets_Socket_SendFile_internal (SOCKET sock, MonoString *filename, MonoArray *pre_buffer, MonoArray *post_buffer, gint flags)
+ves_icall_System_Net_Sockets_Socket_SendFile_internal (SOCKET sock, MonoString *filename, MonoArray *pre_buffer, MonoArray *post_buffer, gint flags, gint32 *werror, gboolean blocking)
 {
        HANDLE file;
-       gint32 werror;
        gboolean ret;
        gboolean interrupted;
        TRANSMIT_FILE_BUFFERS buffers;
@@ -2794,10 +2728,10 @@ ves_icall_System_Net_Sockets_Socket_SendFile_internal (SOCKET sock, MonoString *
 
        /* FIXME: replace file by a proper fd that we can call open and close on, as they are interruptible */
 
-       file = ves_icall_System_IO_MonoIO_Open (filename, FileMode_Open, FileAccess_Read, FileShare_Read, 0, &werror);
+       file = ves_icall_System_IO_MonoIO_Open (filename, FileMode_Open, FileAccess_Read, FileShare_Read, 0, werror);
 
        if (file == INVALID_HANDLE_VALUE) {
-               SetLastError (werror);
+               SetLastError (*werror);
                return FALSE;
        }
 
@@ -2820,14 +2754,21 @@ ves_icall_System_Net_Sockets_Socket_SendFile_internal (SOCKET sock, MonoString *
 
        MONO_ENTER_GC_SAFE;
 
+#ifdef HOST_WIN32
+       ret = alertable_TransmitFile (sock, file, 0, 0, NULL, &buffers, flags, blocking);
+#else
        ret = TransmitFile (sock, file, 0, 0, NULL, &buffers, flags);
+#endif
 
        MONO_EXIT_GC_SAFE;
 
+       if (!ret)
+               *werror = WSAGetLastError ();
+
        mono_thread_info_uninstall_interrupt (&interrupted);
        if (interrupted) {
                CloseHandle (file);
-               SetLastError (WSAEINTR);
+               *werror = WSAEINTR;
                return FALSE;
        }
 
@@ -2837,8 +2778,12 @@ ves_icall_System_Net_Sockets_Socket_SendFile_internal (SOCKET sock, MonoString *
 
        MONO_EXIT_GC_SAFE;
 
+       if (*werror)
+               return FALSE;
+
        return ret;
 }
+#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT | HAVE_UWP_WINAPI_SUPPORT) */
 
 gboolean
 ves_icall_System_Net_Sockets_Socket_SupportPortReuse (MonoProtocolType proto)
index e228f0a2e63df038682a3d004622f541cf928284..7a8c9361ad6334ca7843275c0eb43f9ac99ebe18 100644 (file)
@@ -169,25 +169,25 @@ extern void ves_icall_System_Net_Sockets_Socket_Listen_internal(SOCKET sock, gui
 extern MonoObject *ves_icall_System_Net_Sockets_Socket_LocalEndPoint_internal(SOCKET sock, gint32 af, gint32 *error);
 extern MonoObject *ves_icall_System_Net_Sockets_Socket_RemoteEndPoint_internal(SOCKET sock, gint32 af, gint32 *error);
 extern void ves_icall_System_Net_Sockets_Socket_Bind_internal(SOCKET sock, MonoObject *sockaddr, gint32 *error);
-extern void ves_icall_System_Net_Sockets_Socket_Connect_internal(SOCKET sock, MonoObject *sockaddr, gint32 *error);
-extern gint32 ves_icall_System_Net_Sockets_Socket_Receive_internal(SOCKET sock, MonoArray *buffer, gint32 offset, gint32 count, gint32 flags, gint32 *error);
-extern gint32 ves_icall_System_Net_Sockets_Socket_Receive_array_internal(SOCKET sock, MonoArray *buffers, gint32 flags, gint32 *error);
-extern gint32 ves_icall_System_Net_Sockets_Socket_ReceiveFrom_internal(SOCKET sock, MonoArray *buffer, gint32 offset, gint32 count, gint32 flags, MonoObject **sockaddr, gint32 *error);
-extern gint32 ves_icall_System_Net_Sockets_Socket_Send_internal(SOCKET sock, MonoArray *buffer, gint32 offset, gint32 count, gint32 flags, gint32 *error);
-extern gint32 ves_icall_System_Net_Sockets_Socket_Send_array_internal(SOCKET sock, MonoArray *buffers, gint32 flags, gint32 *error);
-extern gint32 ves_icall_System_Net_Sockets_Socket_SendTo_internal(SOCKET sock, MonoArray *buffer, gint32 offset, gint32 count, gint32 flags, MonoObject *sockaddr, gint32 *error);
+extern void ves_icall_System_Net_Sockets_Socket_Connect_internal(SOCKET sock, MonoObject *sockaddr, gint32 *error, gboolean blocking);
+extern gint32 ves_icall_System_Net_Sockets_Socket_Receive_internal(SOCKET sock, MonoArray *buffer, gint32 offset, gint32 count, gint32 flags, gint32 *error, gboolean blocking);
+extern gint32 ves_icall_System_Net_Sockets_Socket_Receive_array_internal(SOCKET sock, MonoArray *buffers, gint32 flags, gint32 *error, gboolean blocking);
+extern gint32 ves_icall_System_Net_Sockets_Socket_ReceiveFrom_internal(SOCKET sock, MonoArray *buffer, gint32 offset, gint32 count, gint32 flags, MonoObject **sockaddr, gint32 *error, gboolean blocking);
+extern gint32 ves_icall_System_Net_Sockets_Socket_Send_internal(SOCKET sock, MonoArray *buffer, gint32 offset, gint32 count, gint32 flags, gint32 *error, gboolean blocking);
+extern gint32 ves_icall_System_Net_Sockets_Socket_Send_array_internal(SOCKET sock, MonoArray *buffers, gint32 flags, gint32 *error, gboolean blocking);
+extern gint32 ves_icall_System_Net_Sockets_Socket_SendTo_internal(SOCKET sock, MonoArray *buffer, gint32 offset, gint32 count, gint32 flags, MonoObject *sockaddr, gint32 *error, gboolean blocking);
 extern void ves_icall_System_Net_Sockets_Socket_Select_internal(MonoArray **sockets, gint32 timeout, gint32 *error);
 extern void ves_icall_System_Net_Sockets_Socket_Shutdown_internal(SOCKET sock, gint32 how, gint32 *error);
 extern void ves_icall_System_Net_Sockets_Socket_GetSocketOption_obj_internal(SOCKET sock, gint32 level, gint32 name, MonoObject **obj_val, gint32 *error);
 extern void ves_icall_System_Net_Sockets_Socket_GetSocketOption_arr_internal(SOCKET sock, gint32 level, gint32 name, MonoArray **byte_val, gint32 *error);
 extern void ves_icall_System_Net_Sockets_Socket_SetSocketOption_internal(SOCKET sock, gint32 level, gint32 name, MonoObject *obj_val, MonoArray *byte_val, gint32 int_val, gint32 *error);
 extern int ves_icall_System_Net_Sockets_Socket_IOControl_internal (SOCKET sock, gint32 code, MonoArray *input, MonoArray *output, gint32 *error);
-extern MonoBoolean ves_icall_System_Net_Dns_GetHostByName_internal(MonoString *host, MonoString **h_name, MonoArray **h_aliases, MonoArray **h_addr_list);
-extern MonoBoolean ves_icall_System_Net_Dns_GetHostByAddr_internal(MonoString *addr, MonoString **h_name, MonoArray **h_aliases, MonoArray **h_addr_list);
+extern MonoBoolean ves_icall_System_Net_Dns_GetHostByName_internal(MonoString *host, MonoString **h_name, MonoArray **h_aliases, MonoArray **h_addr_list, gint32 hint);
+extern MonoBoolean ves_icall_System_Net_Dns_GetHostByAddr_internal(MonoString *addr, MonoString **h_name, MonoArray **h_aliases, MonoArray **h_addr_list, gint32 hint);
 extern MonoBoolean ves_icall_System_Net_Dns_GetHostName_internal(MonoString **h_name);
 extern MonoBoolean ves_icall_System_Net_Sockets_Socket_Poll_internal (SOCKET sock, gint mode, gint timeout, gint32 *error);
 extern void ves_icall_System_Net_Sockets_Socket_Disconnect_internal(SOCKET sock, MonoBoolean reuse, gint32 *error);
-extern gboolean ves_icall_System_Net_Sockets_Socket_SendFile_internal (SOCKET sock, MonoString *filename, MonoArray *pre_buffer, MonoArray *post_buffer, gint flags);
+extern gboolean ves_icall_System_Net_Sockets_Socket_SendFile_internal (SOCKET sock, MonoString *filename, MonoArray *pre_buffer, MonoArray *post_buffer, gint flags, gint32 *error, gboolean blocking);
 void icall_cancel_blocking_socket_operation (MonoThread *thread);
 extern gboolean ves_icall_System_Net_Sockets_Socket_SupportPortReuse (MonoProtocolType proto);
 
diff --git a/mono/metadata/sre-encode.c b/mono/metadata/sre-encode.c
new file mode 100644 (file)
index 0000000..a412c15
--- /dev/null
@@ -0,0 +1,1193 @@
+/*
+ * sre-encode.c: Routines for encoding SRE builders into a
+ *    MonoDynamicImage and generating tokens.
+ *   
+ * 
+ * Author:
+ *   Paolo Molaro (lupus@ximian.com)
+ *
+ * Copyright 2001-2003 Ximian, Inc (http://www.ximian.com)
+ * Copyright 2004-2009 Novell, Inc (http://www.novell.com)
+ * Copyright 2011 Rodrigo Kumpera
+ * Copyright 2016 Microsoft
+ *
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
+ */
+#include <config.h>
+#include <glib.h>
+
+#include "mono/metadata/dynamic-image-internals.h"
+#include "mono/metadata/dynamic-stream-internals.h"
+#include "mono/metadata/object-internals.h"
+#include "mono/metadata/sre-internals.h"
+#include "mono/metadata/tabledefs.h"
+#include "mono/metadata/tokentype.h"
+#include "mono/utils/checked-build.h"
+
+typedef struct {
+       char *p;
+       char *buf;
+       char *end;
+} SigBuffer;
+
+static guint32 create_typespec (MonoDynamicImage *assembly, MonoType *type);
+static void    encode_type (MonoDynamicImage *assembly, MonoType *type, SigBuffer *buf);
+static guint32 mono_image_typedef_or_ref (MonoDynamicImage *assembly, MonoType *type);
+
+#define mono_type_array_get_and_resolve(array, index, error) mono_reflection_type_get_handle ((MonoReflectionType*)mono_array_get (array, gpointer, index), error)
+
+static guint32
+mono_image_add_stream_data (MonoDynamicStream *stream, const char *data, guint32 len)
+{
+       return mono_dynstream_add_data (stream, data, len);
+}
+
+static void
+alloc_table (MonoDynamicTable *table, guint nrows)
+{
+       mono_dynimage_alloc_table (table, nrows);
+}
+
+static void
+sigbuffer_init (SigBuffer *buf, int size)
+{
+       MONO_REQ_GC_NEUTRAL_MODE;
+
+       buf->buf = (char *)g_malloc (size);
+       buf->p = buf->buf;
+       buf->end = buf->buf + size;
+}
+
+static void
+sigbuffer_make_room (SigBuffer *buf, int size)
+{
+       MONO_REQ_GC_NEUTRAL_MODE;
+
+       if (buf->end - buf->p < size) {
+               int new_size = buf->end - buf->buf + size + 32;
+               char *p = (char *)g_realloc (buf->buf, new_size);
+               size = buf->p - buf->buf;
+               buf->buf = p;
+               buf->p = p + size;
+               buf->end = buf->buf + new_size;
+       }
+}
+
+static void
+sigbuffer_add_value (SigBuffer *buf, guint32 val)
+{
+       MONO_REQ_GC_NEUTRAL_MODE;
+
+       sigbuffer_make_room (buf, 6);
+       mono_metadata_encode_value (val, buf->p, &buf->p);
+}
+
+static void
+sigbuffer_add_byte (SigBuffer *buf, guint8 val)
+{
+       MONO_REQ_GC_NEUTRAL_MODE;
+
+       sigbuffer_make_room (buf, 1);
+       buf->p [0] = val;
+       buf->p++;
+}
+
+static void
+sigbuffer_add_mem (SigBuffer *buf, char *p, guint32 size)
+{
+       MONO_REQ_GC_NEUTRAL_MODE;
+
+       sigbuffer_make_room (buf, size);
+       memcpy (buf->p, p, size);
+       buf->p += size;
+}
+
+static void
+sigbuffer_free (SigBuffer *buf)
+{
+       MONO_REQ_GC_NEUTRAL_MODE;
+
+       g_free (buf->buf);
+}
+
+static guint32
+sigbuffer_add_to_blob_cached (MonoDynamicImage *assembly, SigBuffer *buf)
+{
+       MONO_REQ_GC_NEUTRAL_MODE;
+
+       char blob_size [8];
+       char *b = blob_size;
+       guint32 size = buf->p - buf->buf;
+       /* store length */
+       g_assert (size <= (buf->end - buf->buf));
+       mono_metadata_encode_value (size, b, &b);
+       return mono_dynamic_image_add_to_blob_cached (assembly, blob_size, b-blob_size, buf->buf, size);
+}
+
+
+static void
+encode_generic_class (MonoDynamicImage *assembly, MonoGenericClass *gclass, SigBuffer *buf)
+{
+       MONO_REQ_GC_NEUTRAL_MODE;
+
+       int i;
+       MonoGenericInst *class_inst;
+       MonoClass *klass;
+
+       g_assert (gclass);
+
+       class_inst = gclass->context.class_inst;
+
+       sigbuffer_add_value (buf, MONO_TYPE_GENERICINST);
+       klass = gclass->container_class;
+       sigbuffer_add_value (buf, klass->byval_arg.type);
+       sigbuffer_add_value (buf, mono_dynimage_encode_typedef_or_ref_full (assembly, &klass->byval_arg, FALSE));
+
+       sigbuffer_add_value (buf, class_inst->type_argc);
+       for (i = 0; i < class_inst->type_argc; ++i)
+               encode_type (assembly, class_inst->type_argv [i], buf);
+
+}
+
+static void
+encode_type (MonoDynamicImage *assembly, MonoType *type, SigBuffer *buf)
+{
+       MONO_REQ_GC_NEUTRAL_MODE;
+
+       if (!type) {
+               g_assert_not_reached ();
+               return;
+       }
+               
+       if (type->byref)
+               sigbuffer_add_value (buf, MONO_TYPE_BYREF);
+
+       switch (type->type){
+       case MONO_TYPE_VOID:
+       case MONO_TYPE_BOOLEAN:
+       case MONO_TYPE_CHAR:
+       case MONO_TYPE_I1:
+       case MONO_TYPE_U1:
+       case MONO_TYPE_I2:
+       case MONO_TYPE_U2:
+       case MONO_TYPE_I4:
+       case MONO_TYPE_U4:
+       case MONO_TYPE_I8:
+       case MONO_TYPE_U8:
+       case MONO_TYPE_R4:
+       case MONO_TYPE_R8:
+       case MONO_TYPE_I:
+       case MONO_TYPE_U:
+       case MONO_TYPE_STRING:
+       case MONO_TYPE_OBJECT:
+       case MONO_TYPE_TYPEDBYREF:
+               sigbuffer_add_value (buf, type->type);
+               break;
+       case MONO_TYPE_PTR:
+               sigbuffer_add_value (buf, type->type);
+               encode_type (assembly, type->data.type, buf);
+               break;
+       case MONO_TYPE_SZARRAY:
+               sigbuffer_add_value (buf, type->type);
+               encode_type (assembly, &type->data.klass->byval_arg, buf);
+               break;
+       case MONO_TYPE_VALUETYPE:
+       case MONO_TYPE_CLASS: {
+               MonoClass *k = mono_class_from_mono_type (type);
+
+               if (mono_class_is_gtd (k)) {
+                       MonoGenericClass *gclass = mono_metadata_lookup_generic_class (k, mono_class_get_generic_container (k)->context.class_inst, TRUE);
+                       encode_generic_class (assembly, gclass, buf);
+               } else {
+                       /*
+                        * Make sure we use the correct type.
+                        */
+                       sigbuffer_add_value (buf, k->byval_arg.type);
+                       /*
+                        * ensure only non-byref gets passed to mono_image_typedef_or_ref(),
+                        * otherwise two typerefs could point to the same type, leading to
+                        * verification errors.
+                        */
+                       sigbuffer_add_value (buf, mono_image_typedef_or_ref (assembly, &k->byval_arg));
+               }
+               break;
+       }
+       case MONO_TYPE_ARRAY:
+               sigbuffer_add_value (buf, type->type);
+               encode_type (assembly, &type->data.array->eklass->byval_arg, buf);
+               sigbuffer_add_value (buf, type->data.array->rank);
+               sigbuffer_add_value (buf, 0); /* FIXME: set to 0 for now */
+               sigbuffer_add_value (buf, 0);
+               break;
+       case MONO_TYPE_GENERICINST:
+               encode_generic_class (assembly, type->data.generic_class, buf);
+               break;
+       case MONO_TYPE_VAR:
+       case MONO_TYPE_MVAR:
+               sigbuffer_add_value (buf, type->type);
+               sigbuffer_add_value (buf, mono_type_get_generic_param_num (type));
+               break;
+       default:
+               g_error ("need to encode type %x", type->type);
+       }
+}
+
+static void
+encode_reflection_type (MonoDynamicImage *assembly, MonoReflectionType *type, SigBuffer *buf, MonoError *error)
+{
+       MONO_REQ_GC_UNSAFE_MODE;
+
+       mono_error_init (error);
+
+       if (!type) {
+               sigbuffer_add_value (buf, MONO_TYPE_VOID);
+               return;
+       }
+
+       MonoType *t = mono_reflection_type_get_handle (type, error);
+       return_if_nok (error);
+       encode_type (assembly, t, buf);
+}
+
+static void
+encode_custom_modifiers (MonoDynamicImage *assembly, MonoArray *modreq, MonoArray *modopt, SigBuffer *buf, MonoError *error)
+{
+       MONO_REQ_GC_UNSAFE_MODE;
+
+       int i;
+
+       mono_error_init (error);
+
+       if (modreq) {
+               for (i = 0; i < mono_array_length (modreq); ++i) {
+                       MonoType *mod = mono_type_array_get_and_resolve (modreq, i, error);
+                       return_if_nok (error);
+                       sigbuffer_add_byte (buf, MONO_TYPE_CMOD_REQD);
+                       sigbuffer_add_value (buf, mono_image_typedef_or_ref (assembly, mod));
+               }
+       }
+       if (modopt) {
+               for (i = 0; i < mono_array_length (modopt); ++i) {
+                       MonoType *mod = mono_type_array_get_and_resolve (modopt, i, error);
+                       return_if_nok (error);
+                       sigbuffer_add_byte (buf, MONO_TYPE_CMOD_OPT);
+                       sigbuffer_add_value (buf, mono_image_typedef_or_ref (assembly, mod));
+               }
+       }
+}
+
+#ifndef DISABLE_REFLECTION_EMIT
+guint32
+mono_dynimage_encode_method_signature (MonoDynamicImage *assembly, MonoMethodSignature *sig)
+{
+       MONO_REQ_GC_UNSAFE_MODE;
+
+       SigBuffer buf;
+       int i;
+       guint32 nparams =  sig->param_count;
+       guint32 idx;
+
+       if (!assembly->save)
+               return 0;
+
+       sigbuffer_init (&buf, 32);
+       /*
+        * FIXME: vararg, explicit_this, differenc call_conv values...
+        */
+       idx = sig->call_convention;
+       if (sig->hasthis)
+               idx |= 0x20; /* hasthis */
+       if (sig->generic_param_count)
+               idx |= 0x10; /* generic */
+       sigbuffer_add_byte (&buf, idx);
+       if (sig->generic_param_count)
+               sigbuffer_add_value (&buf, sig->generic_param_count);
+       sigbuffer_add_value (&buf, nparams);
+       encode_type (assembly, sig->ret, &buf);
+       for (i = 0; i < nparams; ++i) {
+               if (i == sig->sentinelpos)
+                       sigbuffer_add_byte (&buf, MONO_TYPE_SENTINEL);
+               encode_type (assembly, sig->params [i], &buf);
+       }
+       idx = sigbuffer_add_to_blob_cached (assembly, &buf);
+       sigbuffer_free (&buf);
+       return idx;
+}
+#else /* DISABLE_REFLECTION_EMIT */
+guint32
+mono_dynimage_encode_method_signature (MonoDynamicImage *assembly, MonoMethodSignature *sig)
+{
+       g_assert_not_reached ();
+       return 0;
+}
+#endif
+
+guint32
+mono_dynimage_encode_method_builder_signature (MonoDynamicImage *assembly, ReflectionMethodBuilder *mb, MonoError *error)
+{
+       MONO_REQ_GC_UNSAFE_MODE;
+
+       mono_error_init (error);
+
+       /*
+        * FIXME: reuse code from method_encode_signature().
+        */
+       SigBuffer buf;
+       int i;
+       guint32 nparams =  mb->parameters ? mono_array_length (mb->parameters): 0;
+       guint32 ngparams = mb->generic_params ? mono_array_length (mb->generic_params): 0;
+       guint32 notypes = mb->opt_types ? mono_array_length (mb->opt_types): 0;
+       guint32 idx;
+
+       sigbuffer_init (&buf, 32);
+       /* LAMESPEC: all the call conv spec is foobared */
+       idx = mb->call_conv & 0x60; /* has-this, explicit-this */
+       if (mb->call_conv & 2)
+               idx |= 0x5; /* vararg */
+       if (!(mb->attrs & METHOD_ATTRIBUTE_STATIC))
+               idx |= 0x20; /* hasthis */
+       if (ngparams)
+               idx |= 0x10; /* generic */
+       sigbuffer_add_byte (&buf, idx);
+       if (ngparams)
+               sigbuffer_add_value (&buf, ngparams);
+       sigbuffer_add_value (&buf, nparams + notypes);
+       encode_custom_modifiers (assembly, mb->return_modreq, mb->return_modopt, &buf, error);
+       if (!is_ok (error))
+               goto leave;
+       encode_reflection_type (assembly, mb->rtype, &buf, error);
+       if (!is_ok (error))
+               goto leave;
+       for (i = 0; i < nparams; ++i) {
+               MonoArray *modreq = NULL;
+               MonoArray *modopt = NULL;
+               MonoReflectionType *pt;
+
+               if (mb->param_modreq && (i < mono_array_length (mb->param_modreq)))
+                       modreq = mono_array_get (mb->param_modreq, MonoArray*, i);
+               if (mb->param_modopt && (i < mono_array_length (mb->param_modopt)))
+                       modopt = mono_array_get (mb->param_modopt, MonoArray*, i);
+               encode_custom_modifiers (assembly, modreq, modopt, &buf, error);
+               if (!is_ok (error))
+                       goto leave;
+               pt = mono_array_get (mb->parameters, MonoReflectionType*, i);
+               encode_reflection_type (assembly, pt, &buf, error);
+               if (!is_ok (error))
+                       goto leave;
+       }
+       if (notypes)
+               sigbuffer_add_byte (&buf, MONO_TYPE_SENTINEL);
+       for (i = 0; i < notypes; ++i) {
+               MonoReflectionType *pt;
+
+               pt = mono_array_get (mb->opt_types, MonoReflectionType*, i);
+               encode_reflection_type (assembly, pt, &buf, error);
+               if (!is_ok (error))
+                       goto leave;
+       }
+
+       idx = sigbuffer_add_to_blob_cached (assembly, &buf);
+leave:
+       sigbuffer_free (&buf);
+       return idx;
+}
+
+guint32
+mono_dynimage_encode_locals (MonoDynamicImage *assembly, MonoReflectionILGen *ilgen, MonoError *error)
+{
+       MONO_REQ_GC_UNSAFE_MODE;
+
+       mono_error_init (error);
+
+       MonoDynamicTable *table;
+       guint32 *values;
+       guint32 idx, sig_idx;
+       guint nl = mono_array_length (ilgen->locals);
+       SigBuffer buf;
+       int i;
+
+       sigbuffer_init (&buf, 32);
+       sigbuffer_add_value (&buf, 0x07);
+       sigbuffer_add_value (&buf, nl);
+       for (i = 0; i < nl; ++i) {
+               MonoReflectionLocalBuilder *lb = mono_array_get (ilgen->locals, MonoReflectionLocalBuilder*, i);
+               
+               if (lb->is_pinned)
+                       sigbuffer_add_value (&buf, MONO_TYPE_PINNED);
+               
+               encode_reflection_type (assembly, (MonoReflectionType*)lb->type, &buf, error);
+               if (!is_ok (error)) {
+                       sigbuffer_free (&buf);
+                       return 0;
+               }
+       }
+       sig_idx = sigbuffer_add_to_blob_cached (assembly, &buf);
+       sigbuffer_free (&buf);
+
+       if (assembly->standalonesig_cache == NULL)
+               assembly->standalonesig_cache = g_hash_table_new (NULL, NULL);
+       idx = GPOINTER_TO_UINT (g_hash_table_lookup (assembly->standalonesig_cache, GUINT_TO_POINTER (sig_idx)));
+       if (idx)
+               return idx;
+
+       table = &assembly->tables [MONO_TABLE_STANDALONESIG];
+       idx = table->next_idx ++;
+       table->rows ++;
+       alloc_table (table, table->rows);
+       values = table->values + idx * MONO_STAND_ALONE_SIGNATURE_SIZE;
+
+       values [MONO_STAND_ALONE_SIGNATURE] = sig_idx;
+
+       g_hash_table_insert (assembly->standalonesig_cache, GUINT_TO_POINTER (sig_idx), GUINT_TO_POINTER (idx));
+
+       return idx;
+}
+
+
+/*
+ * Copy len * nelem bytes from val to dest, swapping bytes to LE if necessary.
+ * dest may be misaligned.
+ */
+static void
+swap_with_size (char *dest, const char* val, int len, int nelem) {
+       MONO_REQ_GC_NEUTRAL_MODE;
+#if G_BYTE_ORDER != G_LITTLE_ENDIAN
+       int elem;
+
+       for (elem = 0; elem < nelem; ++elem) {
+               switch (len) {
+               case 1:
+                       *dest = *val;
+                       break;
+               case 2:
+                       dest [0] = val [1];
+                       dest [1] = val [0];
+                       break;
+               case 4:
+                       dest [0] = val [3];
+                       dest [1] = val [2];
+                       dest [2] = val [1];
+                       dest [3] = val [0];
+                       break;
+               case 8:
+                       dest [0] = val [7];
+                       dest [1] = val [6];
+                       dest [2] = val [5];
+                       dest [3] = val [4];
+                       dest [4] = val [3];
+                       dest [5] = val [2];
+                       dest [6] = val [1];
+                       dest [7] = val [0];
+                       break;
+               default:
+                       g_assert_not_reached ();
+               }
+               dest += len;
+               val += len;
+       }
+#else
+       memcpy (dest, val, len * nelem);
+#endif
+}
+
+
+guint32
+mono_dynimage_encode_constant (MonoDynamicImage *assembly, MonoObject *val, MonoTypeEnum *ret_type)
+{
+       MONO_REQ_GC_UNSAFE_MODE;
+
+       char blob_size [64];
+       char *b = blob_size;
+       char *box_val;
+       char* buf;
+       guint32 idx = 0, len = 0, dummy = 0;
+
+       buf = (char *)g_malloc (64);
+       if (!val) {
+               *ret_type = MONO_TYPE_CLASS;
+               len = 4;
+               box_val = (char*)&dummy;
+       } else {
+               box_val = ((char*)val) + sizeof (MonoObject);
+               *ret_type = val->vtable->klass->byval_arg.type;
+       }
+handle_enum:
+       switch (*ret_type) {
+       case MONO_TYPE_BOOLEAN:
+       case MONO_TYPE_U1:
+       case MONO_TYPE_I1:
+               len = 1;
+               break;
+       case MONO_TYPE_CHAR:
+       case MONO_TYPE_U2:
+       case MONO_TYPE_I2:
+               len = 2;
+               break;
+       case MONO_TYPE_U4:
+       case MONO_TYPE_I4:
+       case MONO_TYPE_R4:
+               len = 4;
+               break;
+       case MONO_TYPE_U8:
+       case MONO_TYPE_I8:
+               len = 8;
+               break;
+       case MONO_TYPE_R8:
+               len = 8;
+               break;
+       case MONO_TYPE_VALUETYPE: {
+               MonoClass *klass = val->vtable->klass;
+               
+               if (klass->enumtype) {
+                       *ret_type = mono_class_enum_basetype (klass)->type;
+                       goto handle_enum;
+               } else if (mono_is_corlib_image (klass->image) && strcmp (klass->name_space, "System") == 0 && strcmp (klass->name, "DateTime") == 0) {
+                       len = 8;
+               } else 
+                       g_error ("we can't encode valuetypes, we should have never reached this line");
+               break;
+       }
+       case MONO_TYPE_CLASS:
+               break;
+       case MONO_TYPE_STRING: {
+               MonoString *str = (MonoString*)val;
+               /* there is no signature */
+               len = str->length * 2;
+               mono_metadata_encode_value (len, b, &b);
+#if G_BYTE_ORDER != G_LITTLE_ENDIAN
+               {
+                       char *swapped = g_malloc (2 * mono_string_length (str));
+                       const char *p = (const char*)mono_string_chars (str);
+
+                       swap_with_size (swapped, p, 2, mono_string_length (str));
+                       idx = mono_dynamic_image_add_to_blob_cached (assembly, blob_size, b-blob_size, swapped, len);
+                       g_free (swapped);
+               }
+#else
+               idx = mono_dynamic_image_add_to_blob_cached (assembly, blob_size, b-blob_size, (char*)mono_string_chars (str), len);
+#endif
+
+               g_free (buf);
+               return idx;
+       }
+       case MONO_TYPE_GENERICINST:
+               *ret_type = mono_class_get_generic_class (val->vtable->klass)->container_class->byval_arg.type;
+               goto handle_enum;
+       default:
+               g_error ("we don't encode constant type 0x%02x yet", *ret_type);
+       }
+
+       /* there is no signature */
+       mono_metadata_encode_value (len, b, &b);
+#if G_BYTE_ORDER != G_LITTLE_ENDIAN
+       idx = mono_image_add_stream_data (&assembly->blob, blob_size, b-blob_size);
+       swap_with_size (blob_size, box_val, len, 1);
+       mono_image_add_stream_data (&assembly->blob, blob_size, len);
+#else
+       idx = mono_dynamic_image_add_to_blob_cached (assembly, blob_size, b-blob_size, box_val, len);
+#endif
+
+       g_free (buf);
+       return idx;
+}
+
+guint32
+mono_dynimage_encode_field_signature (MonoDynamicImage *assembly, MonoReflectionFieldBuilder *fb, MonoError *error)
+{
+       MONO_REQ_GC_UNSAFE_MODE;
+
+       mono_error_init (error);
+
+       SigBuffer buf;
+       guint32 idx;
+       guint32 typespec = 0;
+       MonoType *type;
+       MonoClass *klass;
+
+       type = mono_reflection_type_get_handle ((MonoReflectionType*)fb->type, error);
+       return_val_if_nok (error, 0);
+       klass = mono_class_from_mono_type (type);
+
+       sigbuffer_init (&buf, 32);
+       
+       sigbuffer_add_value (&buf, 0x06);
+       encode_custom_modifiers (assembly, fb->modreq, fb->modopt, &buf, error);
+       if (!is_ok (error))
+               goto fail;
+       /* encode custom attributes before the type */
+
+       if (mono_class_is_gtd (klass))
+               typespec = create_typespec (assembly, type);
+
+       if (typespec) {
+               MonoGenericClass *gclass;
+               gclass = mono_metadata_lookup_generic_class (klass, mono_class_get_generic_container (klass)->context.class_inst, TRUE);
+               encode_generic_class (assembly, gclass, &buf);
+       } else {
+               encode_type (assembly, type, &buf);
+       }
+       idx = sigbuffer_add_to_blob_cached (assembly, &buf);
+       sigbuffer_free (&buf);
+       return idx;
+fail:
+       sigbuffer_free (&buf);
+       return 0;
+}
+
+#ifndef DISABLE_REFLECTION_EMIT
+/*field_image is the image to which the eventual custom mods have been encoded against*/
+guint32
+mono_dynimage_encode_fieldref_signature (MonoDynamicImage *assembly, MonoImage *field_image, MonoType *type)
+{
+       MONO_REQ_GC_NEUTRAL_MODE;
+
+       SigBuffer buf;
+       guint32 idx, i, token;
+
+       if (!assembly->save)
+               return 0;
+
+       sigbuffer_init (&buf, 32);
+       
+       sigbuffer_add_value (&buf, 0x06);
+       /* encode custom attributes before the type */
+       if (type->num_mods) {
+               for (i = 0; i < type->num_mods; ++i) {
+                       if (field_image) {
+                               MonoError error;
+                               MonoClass *klass = mono_class_get_checked (field_image, type->modifiers [i].token, &error);
+                               g_assert (mono_error_ok (&error)); /* FIXME don't swallow the error */
+
+                               token = mono_image_typedef_or_ref (assembly, &klass->byval_arg);
+                       } else {
+                               token = type->modifiers [i].token;
+                       }
+
+                       if (type->modifiers [i].required)
+                               sigbuffer_add_byte (&buf, MONO_TYPE_CMOD_REQD);
+                       else
+                               sigbuffer_add_byte (&buf, MONO_TYPE_CMOD_OPT);
+
+                       sigbuffer_add_value (&buf, token);
+               }
+       }
+       encode_type (assembly, type, &buf);
+       idx = sigbuffer_add_to_blob_cached (assembly, &buf);
+       sigbuffer_free (&buf);
+       return idx;
+}
+#else /* DISABLE_REFLECTION_EMIT */
+guint32
+mono_dynimage_encode_fieldref_signature (MonoDynamicImage *assembly, MonoImage *field_image, MonoType *type)
+{
+       g_assert_not_reached ();
+       return 0;
+}
+#endif /* DISABLE_REFLECTION_EMIT */
+
+static guint32
+create_typespec (MonoDynamicImage *assembly, MonoType *type)
+{
+       MONO_REQ_GC_NEUTRAL_MODE;
+
+       MonoDynamicTable *table;
+       guint32 *values;
+       guint32 token;
+       SigBuffer buf;
+
+       if ((token = GPOINTER_TO_UINT (g_hash_table_lookup (assembly->typespec, type))))
+               return token;
+
+       sigbuffer_init (&buf, 32);
+       switch (type->type) {
+       case MONO_TYPE_FNPTR:
+       case MONO_TYPE_PTR:
+       case MONO_TYPE_SZARRAY:
+       case MONO_TYPE_ARRAY:
+       case MONO_TYPE_VAR:
+       case MONO_TYPE_MVAR:
+       case MONO_TYPE_GENERICINST:
+               encode_type (assembly, type, &buf);
+               break;
+       case MONO_TYPE_CLASS:
+       case MONO_TYPE_VALUETYPE: {
+               MonoClass *k = mono_class_from_mono_type (type);
+               if (!k || !mono_class_is_gtd (k)) {
+                       sigbuffer_free (&buf);
+                       return 0;
+               }
+               encode_type (assembly, type, &buf);
+               break;
+       }
+       default:
+               sigbuffer_free (&buf);
+               return 0;
+       }
+
+       table = &assembly->tables [MONO_TABLE_TYPESPEC];
+       if (assembly->save) {
+               token = sigbuffer_add_to_blob_cached (assembly, &buf);
+               alloc_table (table, table->rows + 1);
+               values = table->values + table->next_idx * MONO_TYPESPEC_SIZE;
+               values [MONO_TYPESPEC_SIGNATURE] = token;
+       }
+       sigbuffer_free (&buf);
+
+       token = MONO_TYPEDEFORREF_TYPESPEC | (table->next_idx << MONO_TYPEDEFORREF_BITS);
+       g_hash_table_insert (assembly->typespec, type, GUINT_TO_POINTER(token));
+       table->next_idx ++;
+       return token;
+}
+
+guint32
+mono_dynimage_encode_typedef_or_ref_full (MonoDynamicImage *assembly, MonoType *type, gboolean try_typespec)
+{
+       MONO_REQ_GC_UNSAFE_MODE;
+
+       MonoDynamicTable *table;
+       guint32 *values;
+       guint32 token, scope, enclosing;
+       MonoClass *klass;
+
+       /* if the type requires a typespec, we must try that first*/
+       if (try_typespec && (token = create_typespec (assembly, type)))
+               return token;
+       token = GPOINTER_TO_UINT (g_hash_table_lookup (assembly->typeref, type));
+       if (token)
+               return token;
+       klass = mono_class_from_mono_type (type);
+
+       /*
+        * If it's in the same module and not a generic type parameter:
+        */
+       if ((klass->image == &assembly->image) && (type->type != MONO_TYPE_VAR) && 
+                       (type->type != MONO_TYPE_MVAR)) {
+               MonoReflectionTypeBuilder *tb = (MonoReflectionTypeBuilder *)mono_class_get_ref_info (klass);
+               token = MONO_TYPEDEFORREF_TYPEDEF | (tb->table_idx << MONO_TYPEDEFORREF_BITS);
+               mono_dynamic_image_register_token (assembly, token, (MonoObject *)mono_class_get_ref_info (klass));
+               return token;
+       }
+
+       if (klass->nested_in) {
+               enclosing = mono_dynimage_encode_typedef_or_ref_full (assembly, &klass->nested_in->byval_arg, FALSE);
+               /* get the typeref idx of the enclosing type */
+               enclosing >>= MONO_TYPEDEFORREF_BITS;
+               scope = (enclosing << MONO_RESOLUTION_SCOPE_BITS) | MONO_RESOLUTION_SCOPE_TYPEREF;
+       } else {
+               scope = mono_reflection_resolution_scope_from_image (assembly, klass->image);
+       }
+       table = &assembly->tables [MONO_TABLE_TYPEREF];
+       if (assembly->save) {
+               alloc_table (table, table->rows + 1);
+               values = table->values + table->next_idx * MONO_TYPEREF_SIZE;
+               values [MONO_TYPEREF_SCOPE] = scope;
+               values [MONO_TYPEREF_NAME] = mono_dynstream_insert_string (&assembly->sheap, klass->name);
+               values [MONO_TYPEREF_NAMESPACE] = mono_dynstream_insert_string (&assembly->sheap, klass->name_space);
+       }
+       token = MONO_TYPEDEFORREF_TYPEREF | (table->next_idx << MONO_TYPEDEFORREF_BITS); /* typeref */
+       g_hash_table_insert (assembly->typeref, type, GUINT_TO_POINTER(token));
+       table->next_idx ++;
+       mono_dynamic_image_register_token (assembly, token, (MonoObject *)mono_class_get_ref_info (klass));
+       return token;
+}
+
+/*
+ * Despite the name, we handle also TypeSpec (with the above helper).
+ */
+static guint32
+mono_image_typedef_or_ref (MonoDynamicImage *assembly, MonoType *type)
+{
+       return mono_dynimage_encode_typedef_or_ref_full (assembly, type, TRUE);
+}
+
+guint32
+mono_dynimage_encode_generic_method_sig (MonoDynamicImage *assembly, MonoGenericContext *context)
+{
+       SigBuffer buf;
+       int i;
+       guint32 nparams = context->method_inst->type_argc;
+       guint32 idx;
+
+       if (!assembly->save)
+               return 0;
+
+       sigbuffer_init (&buf, 32);
+       /*
+        * FIXME: vararg, explicit_this, differenc call_conv values...
+        */
+       sigbuffer_add_value (&buf, 0xa); /* FIXME FIXME FIXME */
+       sigbuffer_add_value (&buf, nparams);
+
+       for (i = 0; i < nparams; i++)
+               encode_type (assembly, context->method_inst->type_argv [i], &buf);
+
+       idx = sigbuffer_add_to_blob_cached (assembly, &buf);
+       sigbuffer_free (&buf);
+       return idx;
+}
+
+#ifndef DISABLE_REFLECTION_EMIT
+guint32
+mono_dynimage_encode_reflection_sighelper (MonoDynamicImage *assembly, MonoReflectionSigHelper *helper, MonoError *error)
+{
+       SigBuffer buf;
+       guint32 nargs;
+       guint32 i, idx;
+
+       mono_error_init (error);
+
+       if (!assembly->save)
+               return 0;
+
+       /* FIXME: this means SignatureHelper.SignatureHelpType.HELPER_METHOD */
+       g_assert (helper->type == 2);
+
+       if (helper->arguments)
+               nargs = mono_array_length (helper->arguments);
+       else
+               nargs = 0;
+
+       sigbuffer_init (&buf, 32);
+
+       /* Encode calling convention */
+       /* Change Any to Standard */
+       if ((helper->call_conv & 0x03) == 0x03)
+               helper->call_conv = 0x01;
+       /* explicit_this implies has_this */
+       if (helper->call_conv & 0x40)
+               helper->call_conv &= 0x20;
+
+       if (helper->call_conv == 0) { /* Unmanaged */
+               idx = helper->unmanaged_call_conv - 1;
+       } else {
+               /* Managed */
+               idx = helper->call_conv & 0x60; /* has_this + explicit_this */
+               if (helper->call_conv & 0x02) /* varargs */
+                       idx += 0x05;
+       }
+
+       sigbuffer_add_byte (&buf, idx);
+       sigbuffer_add_value (&buf, nargs);
+       encode_reflection_type (assembly, helper->return_type, &buf, error);
+       if (!is_ok (error))
+               goto fail;
+       for (i = 0; i < nargs; ++i) {
+               MonoArray *modreqs = NULL;
+               MonoArray *modopts = NULL;
+               MonoReflectionType *pt;
+
+               if (helper->modreqs && (i < mono_array_length (helper->modreqs)))
+                       modreqs = mono_array_get (helper->modreqs, MonoArray*, i);
+               if (helper->modopts && (i < mono_array_length (helper->modopts)))
+                       modopts = mono_array_get (helper->modopts, MonoArray*, i);
+
+               encode_custom_modifiers (assembly, modreqs, modopts, &buf, error);
+               if (!is_ok (error))
+                       goto fail;
+               pt = mono_array_get (helper->arguments, MonoReflectionType*, i);
+               encode_reflection_type (assembly, pt, &buf, error);
+               if (!is_ok (error))
+                       goto fail;
+       }
+       idx = sigbuffer_add_to_blob_cached (assembly, &buf);
+       sigbuffer_free (&buf);
+
+       return idx;
+fail:
+       sigbuffer_free (&buf);
+       return 0;
+}
+#else /* DISABLE_REFLECTION_EMIT */
+guint32
+mono_dynimage_encode_reflection_sighelper (MonoDynamicImage *assembly, MonoReflectionSigHelper *helper, MonoError *error)
+{
+       g_assert_not_reached ();
+       return 0;
+}
+#endif /* DISABLE_REFLECTION_EMIT */
+
+static MonoArray *
+reflection_sighelper_get_signature_local (MonoReflectionSigHelper *sig, MonoError *error)
+{
+       MonoReflectionModuleBuilder *module = sig->module;
+       MonoDynamicImage *assembly = module != NULL ? module->dynamic_image : NULL;
+       guint32 na = sig->arguments ? mono_array_length (sig->arguments) : 0;
+       guint32 buflen, i;
+       MonoArray *result;
+       SigBuffer buf;
+
+       mono_error_init (error);
+
+       sigbuffer_init (&buf, 32);
+
+       sigbuffer_add_value (&buf, 0x07);
+       sigbuffer_add_value (&buf, na);
+       if (assembly != NULL){
+               for (i = 0; i < na; ++i) {
+                       MonoReflectionType *type = mono_array_get (sig->arguments, MonoReflectionType*, i);
+                       encode_reflection_type (assembly, type, &buf, error);
+                       if (!is_ok (error)) goto fail;
+               }
+       }
+
+       buflen = buf.p - buf.buf;
+       result = mono_array_new_checked (mono_domain_get (), mono_defaults.byte_class, buflen, error);
+       if (!is_ok (error)) goto fail;
+       memcpy (mono_array_addr (result, char, 0), buf.buf, buflen);
+       sigbuffer_free (&buf);
+       return result;
+fail:
+       sigbuffer_free (&buf);
+       return NULL;
+}
+
+static MonoArray *
+reflection_sighelper_get_signature_field (MonoReflectionSigHelper *sig, MonoError *error)
+{
+       MonoDynamicImage *assembly = sig->module->dynamic_image;
+       guint32 na = sig->arguments ? mono_array_length (sig->arguments) : 0;
+       guint32 buflen, i;
+       MonoArray *result;
+       SigBuffer buf;
+
+       mono_error_init (error);
+
+       sigbuffer_init (&buf, 32);
+
+       sigbuffer_add_value (&buf, 0x06);
+       for (i = 0; i < na; ++i) {
+               MonoReflectionType *type = mono_array_get (sig->arguments, MonoReflectionType*, i);
+               encode_reflection_type (assembly, type, &buf, error);
+               if (!is_ok (error))
+                       goto fail;
+       }
+
+       buflen = buf.p - buf.buf;
+       result = mono_array_new_checked (mono_domain_get (), mono_defaults.byte_class, buflen, error);
+       if (!is_ok (error)) goto fail;
+       memcpy (mono_array_addr (result, char, 0), buf.buf, buflen);
+       sigbuffer_free (&buf);
+
+       return result;
+fail:
+       sigbuffer_free (&buf);
+       return NULL;
+}
+
+static char*
+type_get_fully_qualified_name (MonoType *type)
+{
+       MONO_REQ_GC_NEUTRAL_MODE;
+
+       return mono_type_get_name_full (type, MONO_TYPE_NAME_FORMAT_ASSEMBLY_QUALIFIED);
+}
+
+#ifndef DISABLE_REFLECTION_EMIT_SAVE
+guint32
+mono_dynimage_save_encode_marshal_blob (MonoDynamicImage *assembly, MonoReflectionMarshal *minfo, MonoError *error)
+{
+       MONO_REQ_GC_UNSAFE_MODE;
+
+       mono_error_init (error);
+
+       char *str;
+       SigBuffer buf;
+       guint32 idx, len;
+
+       sigbuffer_init (&buf, 32);
+
+       sigbuffer_add_value (&buf, minfo->type);
+
+       switch (minfo->type) {
+       case MONO_NATIVE_BYVALTSTR:
+       case MONO_NATIVE_BYVALARRAY:
+               sigbuffer_add_value (&buf, minfo->count);
+               break;
+       case MONO_NATIVE_LPARRAY:
+               if (minfo->eltype || minfo->has_size) {
+                       sigbuffer_add_value (&buf, minfo->eltype);
+                       if (minfo->has_size) {
+                               sigbuffer_add_value (&buf, minfo->param_num != -1? minfo->param_num: 0);
+                               sigbuffer_add_value (&buf, minfo->count != -1? minfo->count: 0);
+
+                               /* LAMESPEC: ElemMult is undocumented */
+                               sigbuffer_add_value (&buf, minfo->param_num != -1? 1: 0);
+                       }
+               }
+               break;
+       case MONO_NATIVE_SAFEARRAY:
+               if (minfo->eltype)
+                       sigbuffer_add_value (&buf, minfo->eltype);
+               break;
+       case MONO_NATIVE_CUSTOM:
+               if (minfo->guid) {
+                       str = mono_string_to_utf8_checked (minfo->guid, error);
+                       if (!is_ok (error)) {
+                               sigbuffer_free (&buf);
+                               return 0;
+                       }
+                       len = strlen (str);
+                       sigbuffer_add_value (&buf, len);
+                       sigbuffer_add_mem (&buf, str, len);
+                       g_free (str);
+               } else {
+                       sigbuffer_add_value (&buf, 0);
+               }
+               /* native type name */
+               sigbuffer_add_value (&buf, 0);
+               /* custom marshaler type name */
+               if (minfo->marshaltype || minfo->marshaltyperef) {
+                       if (minfo->marshaltyperef) {
+                               MonoType *marshaltype = mono_reflection_type_get_handle ((MonoReflectionType*)minfo->marshaltyperef, error);
+                               if (!is_ok (error)) {
+                                       sigbuffer_free (&buf);
+                                       return 0;
+                               }
+                               str = type_get_fully_qualified_name (marshaltype);
+                       } else {
+                               str = mono_string_to_utf8_checked (minfo->marshaltype, error);
+                               if (!is_ok (error)) {
+                                       sigbuffer_free (&buf);
+                                       return 0;
+                               }
+                       }
+                       len = strlen (str);
+                       sigbuffer_add_value (&buf, len);
+                       sigbuffer_add_mem (&buf, str, len);
+                       g_free (str);
+               } else {
+                       /* FIXME: Actually a bug, since this field is required.  Punting for now ... */
+                       sigbuffer_add_value (&buf, 0);
+               }
+               if (minfo->mcookie) {
+                       str = mono_string_to_utf8_checked (minfo->mcookie, error);
+                       if (!is_ok (error)) {
+                               sigbuffer_free (&buf);
+                               return 0;
+                       }
+                       len = strlen (str);
+                       sigbuffer_add_value (&buf, len);
+                       sigbuffer_add_mem (&buf, str, len);
+                       g_free (str);
+               } else {
+                       sigbuffer_add_value (&buf, 0);
+               }
+               break;
+       default:
+               break;
+       }
+       idx = sigbuffer_add_to_blob_cached (assembly, &buf);
+       sigbuffer_free (&buf);
+       return idx;
+}
+
+guint32
+mono_dynimage_save_encode_property_signature (MonoDynamicImage *assembly, MonoReflectionPropertyBuilder *fb, MonoError *error)
+{
+       MONO_REQ_GC_UNSAFE_MODE;
+
+       mono_error_init (error);
+
+       SigBuffer buf;
+       guint32 nparams = 0;
+       MonoReflectionMethodBuilder *mb = fb->get_method;
+       MonoReflectionMethodBuilder *smb = fb->set_method;
+       guint32 idx, i;
+
+       if (mb && mb->parameters)
+               nparams = mono_array_length (mb->parameters);
+       if (!mb && smb && smb->parameters)
+               nparams = mono_array_length (smb->parameters) - 1;
+       sigbuffer_init (&buf, 32);
+       if (fb->call_conv & 0x20)
+               sigbuffer_add_byte (&buf, 0x28);
+       else
+               sigbuffer_add_byte (&buf, 0x08);
+       sigbuffer_add_value (&buf, nparams);
+       if (mb) {
+               encode_reflection_type (assembly, (MonoReflectionType*)mb->rtype, &buf, error);
+               if (!is_ok (error))
+                       goto fail;
+               for (i = 0; i < nparams; ++i) {
+                       MonoReflectionType *pt = mono_array_get (mb->parameters, MonoReflectionType*, i);
+                       encode_reflection_type (assembly, pt, &buf, error);
+                       if (!is_ok (error))
+                               goto fail;
+               }
+       } else if (smb && smb->parameters) {
+               /* the property type is the last param */
+               encode_reflection_type (assembly, mono_array_get (smb->parameters, MonoReflectionType*, nparams), &buf, error);
+               if (!is_ok (error))
+                       goto fail;
+
+               for (i = 0; i < nparams; ++i) {
+                       MonoReflectionType *pt = mono_array_get (smb->parameters, MonoReflectionType*, i);
+                       encode_reflection_type (assembly, pt, &buf, error);
+                       if (!is_ok (error))
+                               goto fail;
+               }
+       } else {
+               encode_reflection_type (assembly, (MonoReflectionType*)fb->type, &buf, error);
+               if (!is_ok (error))
+                       goto fail;
+       }
+
+       idx = sigbuffer_add_to_blob_cached (assembly, &buf);
+       sigbuffer_free (&buf);
+       return idx;
+fail:
+       sigbuffer_free (&buf);
+       return 0;
+}
+
+
+#else /*DISABLE_REFLECTION_EMIT_SAVE*/
+guint32
+mono_dynimage_save_encode_marshal_blob (MonoDynamicImage *assembly, MonoReflectionMarshal *minfo, MonoError *error)
+{
+       g_assert_not_reached ();
+       return 0;
+}
+
+guint32
+mono_dynimage_save_encode_property_signature (MonoDynamicImage *assembly, MonoReflectionPropertyBuilder *fb, MonoError *error)
+{
+       g_assert_not_reached ();
+       return 0;
+}
+#endif /*DISABLE_REFLECTION_EMIT_SAVE*/
+
+#ifndef DISABLE_REFLECTION_EMIT
+MonoArray *
+ves_icall_SignatureHelper_get_signature_local (MonoReflectionSigHelper *sig)
+{
+       MonoError error;
+       MonoArray *result = reflection_sighelper_get_signature_local (sig, &error);
+       mono_error_set_pending_exception (&error);
+       return result;
+}
+
+MonoArray *
+ves_icall_SignatureHelper_get_signature_field (MonoReflectionSigHelper *sig)
+{
+       MonoError error;
+       MonoArray *result = reflection_sighelper_get_signature_field (sig, &error);
+       mono_error_set_pending_exception (&error);
+       return result;
+}
+#else /* DISABLE_REFLECTION_EMIT */
+MonoArray *
+ves_icall_SignatureHelper_get_signature_local (MonoReflectionSigHelper *sig)
+{
+       g_assert_not_reached ();
+       return NULL;
+}
+
+MonoArray *
+ves_icall_SignatureHelper_get_signature_field (MonoReflectionSigHelper *sig)
+{
+       g_assert_not_reached ();
+       return NULL;
+}
+
+#endif /* DISABLE_REFLECTION_EMIT */
diff --git a/mono/metadata/sre-internals.h b/mono/metadata/sre-internals.h
new file mode 100644 (file)
index 0000000..5f902cd
--- /dev/null
@@ -0,0 +1,139 @@
+/* 
+ * Copyright 2016 Microsoft
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
+ */
+#ifndef __MONO_METADATA_SRE_INTERNALS_H__
+#define __MONO_METADATA_SRE_INTERNALS_H__
+
+#include <mono/metadata/object-internals.h>
+
+typedef struct _ArrayMethod ArrayMethod;
+
+typedef struct {
+       guint32 owner;
+       MonoReflectionGenericParam *gparam;
+} GenericParamTableEntry;
+
+typedef struct {
+       MonoReflectionILGen *ilgen;
+       MonoReflectionType *rtype;
+       MonoArray *parameters;
+       MonoArray *generic_params;
+       MonoGenericContainer *generic_container;
+       MonoArray *pinfo;
+       MonoArray *opt_types;
+       guint32 attrs;
+       guint32 iattrs;
+       guint32 call_conv;
+       guint32 *table_idx; /* note: it's a pointer */
+       MonoArray *code;
+       MonoObject *type;
+       MonoString *name;
+       MonoBoolean init_locals;
+       MonoBoolean skip_visibility;
+       MonoArray *return_modreq;
+       MonoArray *return_modopt;
+       MonoArray *param_modreq;
+       MonoArray *param_modopt;
+       MonoArray *permissions;
+       MonoMethod *mhandle;
+       guint32 nrefs;
+       gpointer *refs;
+       /* for PInvoke */
+       int charset, extra_flags, native_cc;
+       MonoString *dll, *dllentry;
+} ReflectionMethodBuilder;
+
+void
+mono_reflection_emit_init (void);
+
+void
+mono_reflection_dynimage_basic_init (MonoReflectionAssemblyBuilder *assemblyb);
+
+gpointer
+mono_image_g_malloc0 (MonoImage *image, guint size);
+
+gboolean
+mono_is_sre_type_builder (MonoClass *klass);
+
+gboolean
+mono_is_sre_generic_instance (MonoClass *klass);
+
+gboolean
+mono_is_sre_method_on_tb_inst (MonoClass *klass);
+
+gboolean
+mono_is_sre_ctor_builder (MonoClass *klass);
+
+gboolean
+mono_is_sre_ctor_on_tb_inst (MonoClass *klass);
+
+gboolean
+mono_is_sr_mono_cmethod (MonoClass *klass);
+
+gboolean
+mono_is_sr_mono_property (MonoClass *klass);
+
+gpointer
+mono_reflection_resolve_object (MonoImage *image, MonoObject *obj, MonoClass **handle_class, MonoGenericContext *context, MonoError *error);
+
+void
+mono_sre_array_method_free (ArrayMethod *am);
+
+void
+mono_sre_generic_param_table_entry_free (GenericParamTableEntry *entry);
+
+gboolean
+mono_reflection_methodbuilder_from_method_builder (ReflectionMethodBuilder *rmb, MonoReflectionMethodBuilder *mb,
+                                                  MonoError *error);
+gboolean
+mono_reflection_methodbuilder_from_ctor_builder (ReflectionMethodBuilder *rmb, MonoReflectionCtorBuilder *mb,
+                                                MonoError *error);
+                                                           
+guint32
+mono_reflection_resolution_scope_from_image (MonoDynamicImage *assembly, MonoImage *image);
+
+guint32 mono_reflection_method_count_clauses (MonoReflectionILGen *ilgen);
+
+
+/* sre-encode */
+
+guint32
+mono_dynimage_encode_field_signature (MonoDynamicImage *assembly, MonoReflectionFieldBuilder *fb, MonoError *error);
+
+guint32
+mono_dynimage_encode_constant (MonoDynamicImage *assembly, MonoObject *val, MonoTypeEnum *ret_type);
+
+guint32
+mono_dynimage_encode_locals (MonoDynamicImage *assembly, MonoReflectionILGen *ilgen, MonoError *error);
+
+guint32
+mono_dynimage_encode_fieldref_signature (MonoDynamicImage *assembly, MonoImage *field_image, MonoType *type);
+
+guint32
+mono_dynimage_encode_method_signature (MonoDynamicImage *assembly, MonoMethodSignature *sig);
+
+guint32
+mono_dynimage_encode_method_builder_signature (MonoDynamicImage *assembly, ReflectionMethodBuilder *mb,
+                                              MonoError *error);
+
+guint32
+mono_dynimage_encode_generic_method_sig (MonoDynamicImage *assembly, MonoGenericContext *context);
+
+guint32
+mono_dynimage_encode_typedef_or_ref_full (MonoDynamicImage *assembly, MonoType *type, gboolean try_typespec);
+
+guint32
+mono_dynimage_encode_reflection_sighelper (MonoDynamicImage *assembly, MonoReflectionSigHelper *helper,
+                                          MonoError *error);
+
+/* sre-encode, without DISABLE_REFLECTION_EMIT_SAVE (o.w. g_assert_not_reached ()) */
+
+guint32
+mono_dynimage_save_encode_marshal_blob (MonoDynamicImage *assembly, MonoReflectionMarshal *minfo, MonoError *error);
+
+guint32
+mono_dynimage_save_encode_property_signature (MonoDynamicImage *assembly, MonoReflectionPropertyBuilder *fb, MonoError *error);
+
+#endif  /* __MONO_METADATA_SRE_INTERNALS_H__ */
+
diff --git a/mono/metadata/sre-save.c b/mono/metadata/sre-save.c
new file mode 100644 (file)
index 0000000..b52ff6c
--- /dev/null
@@ -0,0 +1,3112 @@
+/*
+ * sre-save.c: Routine for saving an image to a file.
+ *   
+ * 
+ * Author:
+ *   Paolo Molaro (lupus@ximian.com)
+ *
+ * Copyright 2001-2003 Ximian, Inc (http://www.ximian.com)
+ * Copyright 2004-2009 Novell, Inc (http://www.novell.com)
+ * Copyright 2011 Rodrigo Kumpera
+ * Copyright 2016 Microsoft
+ *
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
+ */
+
+#include <config.h>
+#include <glib.h>
+
+#include "mono/metadata/dynamic-image-internals.h"
+#include "mono/metadata/dynamic-stream-internals.h"
+#include "mono/metadata/mono-ptr-array.h"
+#include "mono/metadata/object-internals.h"
+#include "mono/metadata/sre-internals.h"
+#include "mono/metadata/security-manager.h"
+#include "mono/metadata/tabledefs.h"
+#include "mono/metadata/tokentype.h"
+
+#include "mono/utils/checked-build.h"
+#include "mono/utils/mono-digest.h"
+#include "mono/utils/mono-error-internals.h"
+
+#define TEXT_OFFSET 512
+#define CLI_H_SIZE 136
+#define FILE_ALIGN 512
+#define VIRT_ALIGN 8192
+#define START_TEXT_RVA  0x00002000
+
+static void    mono_image_get_generic_param_info (MonoReflectionGenericParam *gparam, guint32 owner, MonoDynamicImage *assembly);
+
+static void
+alloc_table (MonoDynamicTable *table, guint nrows)
+{
+       mono_dynimage_alloc_table (table, nrows);
+}
+
+static guint32
+string_heap_insert (MonoDynamicStream *sh, const char *str)
+{
+       return mono_dynstream_insert_string (sh, str);
+}
+
+static guint32
+string_heap_insert_mstring (MonoDynamicStream *sh, MonoString *str, MonoError *error)
+{
+       return mono_dynstream_insert_mstring (sh, str, error);
+}
+
+static guint32
+mono_image_add_stream_data (MonoDynamicStream *stream, const char *data, guint32 len)
+{
+       return mono_dynstream_add_data (stream, data, len);
+}
+
+static guint32
+mono_image_add_stream_zero (MonoDynamicStream *stream, guint32 len)
+{
+       return mono_dynstream_add_zero (stream, len);
+}
+
+static void
+stream_data_align (MonoDynamicStream *stream)
+{
+       mono_dynstream_data_align (stream);
+}
+
+static guint32
+mono_image_typedef_or_ref (MonoDynamicImage *assembly, MonoType *type)
+{
+       return mono_dynimage_encode_typedef_or_ref_full (assembly, type, TRUE);
+}
+
+static guint32
+find_index_in_table (MonoDynamicImage *assembly, int table_idx, int col, guint32 token)
+{
+       MONO_REQ_GC_NEUTRAL_MODE;
+
+       int i;
+       MonoDynamicTable *table;
+       guint32 *values;
+       
+       table = &assembly->tables [table_idx];
+
+       g_assert (col < table->columns);
+
+       values = table->values + table->columns;
+       for (i = 1; i <= table->rows; ++i) {
+               if (values [col] == token)
+                       return i;
+               values += table->columns;
+       }
+       return 0;
+}
+
+/*
+ * Copy len * nelem bytes from val to dest, swapping bytes to LE if necessary.
+ * dest may be misaligned.
+ */
+static void
+swap_with_size (char *dest, const char* val, int len, int nelem) {
+       MONO_REQ_GC_NEUTRAL_MODE;
+#if G_BYTE_ORDER != G_LITTLE_ENDIAN
+       int elem;
+
+       for (elem = 0; elem < nelem; ++elem) {
+               switch (len) {
+               case 1:
+                       *dest = *val;
+                       break;
+               case 2:
+                       dest [0] = val [1];
+                       dest [1] = val [0];
+                       break;
+               case 4:
+                       dest [0] = val [3];
+                       dest [1] = val [2];
+                       dest [2] = val [1];
+                       dest [3] = val [0];
+                       break;
+               case 8:
+                       dest [0] = val [7];
+                       dest [1] = val [6];
+                       dest [2] = val [5];
+                       dest [3] = val [4];
+                       dest [4] = val [3];
+                       dest [5] = val [2];
+                       dest [6] = val [1];
+                       dest [7] = val [0];
+                       break;
+               default:
+                       g_assert_not_reached ();
+               }
+               dest += len;
+               val += len;
+       }
+#else
+       memcpy (dest, val, len * nelem);
+#endif
+}
+
+static guint32
+add_mono_string_to_blob_cached (MonoDynamicImage *assembly, MonoString *str)
+{
+       MONO_REQ_GC_UNSAFE_MODE;
+       
+       char blob_size [64];
+       char *b = blob_size;
+       guint32 idx = 0, len;
+
+       len = str->length * 2;
+       mono_metadata_encode_value (len, b, &b);
+#if G_BYTE_ORDER != G_LITTLE_ENDIAN
+       {
+               char *swapped = g_malloc (2 * mono_string_length (str));
+               const char *p = (const char*)mono_string_chars (str);
+
+               swap_with_size (swapped, p, 2, mono_string_length (str));
+               idx = mono_dynamic_image_add_to_blob_cached (assembly, blob_size, b-blob_size, swapped, len);
+               g_free (swapped);
+       }
+#else
+       idx = mono_dynamic_image_add_to_blob_cached (assembly, blob_size, b-blob_size, (char*)mono_string_chars (str), len);
+#endif
+       return idx;
+}
+
+/*
+ * idx is the table index of the object
+ * type is one of MONO_CUSTOM_ATTR_*
+ */
+static gboolean
+mono_image_add_cattrs (MonoDynamicImage *assembly, guint32 idx, guint32 type, MonoArray *cattrs, MonoError *error)
+{
+       MONO_REQ_GC_UNSAFE_MODE;
+
+       MonoDynamicTable *table;
+       MonoReflectionCustomAttr *cattr;
+       guint32 *values;
+       guint32 count, i, token;
+       char blob_size [6];
+       char *p = blob_size;
+       
+       mono_error_init (error);
+
+       /* it is legal to pass a NULL cattrs: we avoid to use the if in a lot of places */
+       if (!cattrs)
+               return TRUE;
+       count = mono_array_length (cattrs);
+       table = &assembly->tables [MONO_TABLE_CUSTOMATTRIBUTE];
+       table->rows += count;
+       alloc_table (table, table->rows);
+       values = table->values + table->next_idx * MONO_CUSTOM_ATTR_SIZE;
+       idx <<= MONO_CUSTOM_ATTR_BITS;
+       idx |= type;
+       for (i = 0; i < count; ++i) {
+               cattr = (MonoReflectionCustomAttr*)mono_array_get (cattrs, gpointer, i);
+               values [MONO_CUSTOM_ATTR_PARENT] = idx;
+               token = mono_image_create_token (assembly, (MonoObject*)cattr->ctor, FALSE, FALSE, error);
+               if (!mono_error_ok (error)) goto fail;
+               type = mono_metadata_token_index (token);
+               type <<= MONO_CUSTOM_ATTR_TYPE_BITS;
+               switch (mono_metadata_token_table (token)) {
+               case MONO_TABLE_METHOD:
+                       type |= MONO_CUSTOM_ATTR_TYPE_METHODDEF;
+                       /*
+                        * fixup_cattrs () needs to fix this up. We can't use image->tokens, since it contains the old token for the
+                        * method, not the one returned by mono_image_create_token ().
+                        */
+                       mono_g_hash_table_insert (assembly->remapped_tokens, GUINT_TO_POINTER (token), cattr->ctor);
+                       break;
+               case MONO_TABLE_MEMBERREF:
+                       type |= MONO_CUSTOM_ATTR_TYPE_MEMBERREF;
+                       break;
+               default:
+                       g_warning ("got wrong token in custom attr");
+                       continue;
+               }
+               values [MONO_CUSTOM_ATTR_TYPE] = type;
+               p = blob_size;
+               mono_metadata_encode_value (mono_array_length (cattr->data), p, &p);
+               values [MONO_CUSTOM_ATTR_VALUE] = mono_dynamic_image_add_to_blob_cached (assembly, blob_size, p - blob_size,
+                       mono_array_addr (cattr->data, char, 0), mono_array_length (cattr->data));
+               values += MONO_CUSTOM_ATTR_SIZE;
+               ++table->next_idx;
+       }
+
+       return TRUE;
+
+fail:
+       return FALSE;
+}
+
+static void
+mono_image_add_decl_security (MonoDynamicImage *assembly, guint32 parent_token, MonoArray *permissions)
+{
+       MONO_REQ_GC_UNSAFE_MODE;
+
+       MonoDynamicTable *table;
+       guint32 *values;
+       guint32 count, i, idx;
+       MonoReflectionPermissionSet *perm;
+
+       if (!permissions)
+               return;
+
+       count = mono_array_length (permissions);
+       table = &assembly->tables [MONO_TABLE_DECLSECURITY];
+       table->rows += count;
+       alloc_table (table, table->rows);
+
+       for (i = 0; i < mono_array_length (permissions); ++i) {
+               perm = (MonoReflectionPermissionSet*)mono_array_addr (permissions, MonoReflectionPermissionSet, i);
+
+               values = table->values + table->next_idx * MONO_DECL_SECURITY_SIZE;
+
+               idx = mono_metadata_token_index (parent_token);
+               idx <<= MONO_HAS_DECL_SECURITY_BITS;
+               switch (mono_metadata_token_table (parent_token)) {
+               case MONO_TABLE_TYPEDEF:
+                       idx |= MONO_HAS_DECL_SECURITY_TYPEDEF;
+                       break;
+               case MONO_TABLE_METHOD:
+                       idx |= MONO_HAS_DECL_SECURITY_METHODDEF;
+                       break;
+               case MONO_TABLE_ASSEMBLY:
+                       idx |= MONO_HAS_DECL_SECURITY_ASSEMBLY;
+                       break;
+               default:
+                       g_assert_not_reached ();
+               }
+
+               values [MONO_DECL_SECURITY_ACTION] = perm->action;
+               values [MONO_DECL_SECURITY_PARENT] = idx;
+               values [MONO_DECL_SECURITY_PERMISSIONSET] = add_mono_string_to_blob_cached (assembly, perm->pset);
+
+               ++table->next_idx;
+       }
+}
+
+/**
+ * method_encode_code:
+ *
+ * @assembly the assembly
+ * @mb the managed MethodBuilder
+ * @error set on error
+ *
+ * Note that the return value is not sensible if @error is set.
+ */
+static guint32
+method_encode_code (MonoDynamicImage *assembly, ReflectionMethodBuilder *mb, MonoError *error)
+{
+       MONO_REQ_GC_UNSAFE_MODE;
+
+       char flags = 0;
+       guint32 idx;
+       guint32 code_size;
+       gint32 max_stack, i;
+       gint32 num_locals = 0;
+       gint32 num_exception = 0;
+       gint maybe_small;
+       guint32 fat_flags;
+       char fat_header [12];
+       guint32 int_value;
+       guint16 short_value;
+       guint32 local_sig = 0;
+       guint32 header_size = 12;
+       MonoArray *code;
+
+       mono_error_init (error);
+
+       if ((mb->attrs & (METHOD_ATTRIBUTE_PINVOKE_IMPL | METHOD_ATTRIBUTE_ABSTRACT)) ||
+                       (mb->iattrs & (METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL | METHOD_IMPL_ATTRIBUTE_RUNTIME)))
+               return 0;
+
+       /*if (mb->name)
+               g_print ("Encode method %s\n", mono_string_to_utf8 (mb->name));*/
+       if (mb->ilgen) {
+               code = mb->ilgen->code;
+               code_size = mb->ilgen->code_len;
+               max_stack = mb->ilgen->max_stack;
+               num_locals = mb->ilgen->locals ? mono_array_length (mb->ilgen->locals) : 0;
+               if (mb->ilgen->ex_handlers)
+                       num_exception = mono_reflection_method_count_clauses (mb->ilgen);
+       } else {
+               code = mb->code;
+               if (code == NULL){
+                       MonoError inner_error;
+                       char *name = mono_string_to_utf8_checked (mb->name, &inner_error);
+                       if (!is_ok (&inner_error)) {
+                               name = g_strdup ("");
+                               mono_error_cleanup (&inner_error);
+                       }
+                       char *str = g_strdup_printf ("Method %s does not have any IL associated", name);
+                       mono_error_set_argument (error, NULL, "a method does not have any IL associated");
+                       g_free (str);
+                       g_free (name);
+                       return 0;
+               }
+
+               code_size = mono_array_length (code);
+               max_stack = 8; /* we probably need to run a verifier on the code... */
+       }
+
+       stream_data_align (&assembly->code);
+
+       /* check for exceptions, maxstack, locals */
+       maybe_small = (max_stack <= 8) && (!num_locals) && (!num_exception);
+       if (maybe_small) {
+               if (code_size < 64 && !(code_size & 1)) {
+                       flags = (code_size << 2) | 0x2;
+               } else if (code_size < 32 && (code_size & 1)) {
+                       flags = (code_size << 2) | 0x6; /* LAMESPEC: see metadata.c */
+               } else {
+                       goto fat_header;
+               }
+               idx = mono_image_add_stream_data (&assembly->code, &flags, 1);
+               /* add to the fixup todo list */
+               if (mb->ilgen && mb->ilgen->num_token_fixups)
+                       mono_g_hash_table_insert (assembly->token_fixups, mb->ilgen, GUINT_TO_POINTER (idx + 1));
+               mono_image_add_stream_data (&assembly->code, mono_array_addr (code, char, 0), code_size);
+               return assembly->text_rva + idx;
+       } 
+fat_header:
+       if (num_locals) {
+               local_sig = MONO_TOKEN_SIGNATURE | mono_dynimage_encode_locals (assembly, mb->ilgen, error);
+               return_val_if_nok (error, 0);
+       }
+       /* 
+        * FIXME: need to set also the header size in fat_flags.
+        * (and more sects and init locals flags)
+        */
+       fat_flags =  0x03;
+       if (num_exception)
+               fat_flags |= METHOD_HEADER_MORE_SECTS;
+       if (mb->init_locals)
+               fat_flags |= METHOD_HEADER_INIT_LOCALS;
+       fat_header [0] = fat_flags;
+       fat_header [1] = (header_size / 4 ) << 4;
+       short_value = GUINT16_TO_LE (max_stack);
+       memcpy (fat_header + 2, &short_value, 2);
+       int_value = GUINT32_TO_LE (code_size);
+       memcpy (fat_header + 4, &int_value, 4);
+       int_value = GUINT32_TO_LE (local_sig);
+       memcpy (fat_header + 8, &int_value, 4);
+       idx = mono_image_add_stream_data (&assembly->code, fat_header, 12);
+       /* add to the fixup todo list */
+       if (mb->ilgen && mb->ilgen->num_token_fixups)
+               mono_g_hash_table_insert (assembly->token_fixups, mb->ilgen, GUINT_TO_POINTER (idx + 12));
+       
+       mono_image_add_stream_data (&assembly->code, mono_array_addr (code, char, 0), code_size);
+       if (num_exception) {
+               unsigned char sheader [4];
+               MonoILExceptionInfo * ex_info;
+               MonoILExceptionBlock * ex_block;
+               int j;
+
+               stream_data_align (&assembly->code);
+               /* always use fat format for now */
+               sheader [0] = METHOD_HEADER_SECTION_FAT_FORMAT | METHOD_HEADER_SECTION_EHTABLE;
+               num_exception *= 6 * sizeof (guint32);
+               num_exception += 4; /* include the size of the header */
+               sheader [1] = num_exception & 0xff;
+               sheader [2] = (num_exception >> 8) & 0xff;
+               sheader [3] = (num_exception >> 16) & 0xff;
+               mono_image_add_stream_data (&assembly->code, (char*)sheader, 4);
+               /* fat header, so we are already aligned */
+               /* reverse order */
+               for (i = mono_array_length (mb->ilgen->ex_handlers) - 1; i >= 0; --i) {
+                       ex_info = (MonoILExceptionInfo *)mono_array_addr (mb->ilgen->ex_handlers, MonoILExceptionInfo, i);
+                       if (ex_info->handlers) {
+                               int finally_start = ex_info->start + ex_info->len;
+                               for (j = 0; j < mono_array_length (ex_info->handlers); ++j) {
+                                       guint32 val;
+                                       ex_block = (MonoILExceptionBlock*)mono_array_addr (ex_info->handlers, MonoILExceptionBlock, j);
+                                       /* the flags */
+                                       val = GUINT32_TO_LE (ex_block->type);
+                                       mono_image_add_stream_data (&assembly->code, (char*)&val, sizeof (guint32));
+                                       /* try offset */
+                                       val = GUINT32_TO_LE (ex_info->start);
+                                       mono_image_add_stream_data (&assembly->code, (char*)&val, sizeof (guint32));
+                                       /* need fault, too, probably */
+                                       if (ex_block->type == MONO_EXCEPTION_CLAUSE_FINALLY)
+                                               val = GUINT32_TO_LE (finally_start - ex_info->start);
+                                       else
+                                               val = GUINT32_TO_LE (ex_info->len);
+                                       mono_image_add_stream_data (&assembly->code, (char*)&val, sizeof (guint32));
+                                       /* handler offset */
+                                       val = GUINT32_TO_LE (ex_block->start);
+                                       mono_image_add_stream_data (&assembly->code, (char*)&val, sizeof (guint32));
+                                       /* handler len */
+                                       val = GUINT32_TO_LE (ex_block->len);
+                                       mono_image_add_stream_data (&assembly->code, (char*)&val, sizeof (guint32));
+                                       finally_start = ex_block->start + ex_block->len;
+                                       if (ex_block->extype) {
+                                               MonoType *extype = mono_reflection_type_get_handle ((MonoReflectionType*)ex_block->extype, error);
+                                               return_val_if_nok (error, 0);
+
+                                               val = mono_metadata_token_from_dor (mono_image_typedef_or_ref (assembly, extype));
+                                       } else {
+                                               if (ex_block->type == MONO_EXCEPTION_CLAUSE_FILTER)
+                                                       val = ex_block->filter_offset;
+                                               else
+                                                       val = 0;
+                                       }
+                                       val = GUINT32_TO_LE (val);
+                                       mono_image_add_stream_data (&assembly->code, (char*)&val, sizeof (guint32));
+                                       /*g_print ("out clause %d: from %d len=%d, handler at %d, %d, finally_start=%d, ex_info->start=%d, ex_info->len=%d, ex_block->type=%d, j=%d, i=%d\n", 
+                                                       clause.flags, clause.try_offset, clause.try_len, clause.handler_offset, clause.handler_len, finally_start, ex_info->start, ex_info->len, ex_block->type, j, i);*/
+                               }
+                       } else {
+                               g_error ("No clauses for ex info block %d", i);
+                       }
+               }
+       }
+       return assembly->text_rva + idx;
+}
+
+/*
+ * Fill in the MethodDef and ParamDef tables for a method.
+ * This is used for both normal methods and constructors.
+ */
+static gboolean
+mono_image_basic_method (ReflectionMethodBuilder *mb, MonoDynamicImage *assembly, MonoError *error)
+{
+       MONO_REQ_GC_UNSAFE_MODE;
+
+       MonoDynamicTable *table;
+       guint32 *values;
+       guint i, count;
+
+       mono_error_init (error);
+
+       /* room in this table is already allocated */
+       table = &assembly->tables [MONO_TABLE_METHOD];
+       *mb->table_idx = table->next_idx ++;
+       g_hash_table_insert (assembly->method_to_table_idx, mb->mhandle, GUINT_TO_POINTER ((*mb->table_idx)));
+       values = table->values + *mb->table_idx * MONO_METHOD_SIZE;
+       values [MONO_METHOD_NAME] = string_heap_insert_mstring (&assembly->sheap, mb->name, error);
+       return_val_if_nok (error, FALSE);
+       values [MONO_METHOD_FLAGS] = mb->attrs;
+       values [MONO_METHOD_IMPLFLAGS] = mb->iattrs;
+       values [MONO_METHOD_SIGNATURE] = mono_dynimage_encode_method_builder_signature (assembly, mb, error);
+       return_val_if_nok (error, FALSE);
+       values [MONO_METHOD_RVA] = method_encode_code (assembly, mb, error);
+       return_val_if_nok (error, FALSE);
+
+       table = &assembly->tables [MONO_TABLE_PARAM];
+       values [MONO_METHOD_PARAMLIST] = table->next_idx;
+
+       mono_image_add_decl_security (assembly, 
+               mono_metadata_make_token (MONO_TABLE_METHOD, *mb->table_idx), mb->permissions);
+
+       if (mb->pinfo) {
+               MonoDynamicTable *mtable;
+               guint32 *mvalues;
+               
+               mtable = &assembly->tables [MONO_TABLE_FIELDMARSHAL];
+               mvalues = mtable->values + mtable->next_idx * MONO_FIELD_MARSHAL_SIZE;
+               
+               count = 0;
+               for (i = 0; i < mono_array_length (mb->pinfo); ++i) {
+                       if (mono_array_get (mb->pinfo, gpointer, i))
+                               count++;
+               }
+               table->rows += count;
+               alloc_table (table, table->rows);
+               values = table->values + table->next_idx * MONO_PARAM_SIZE;
+               for (i = 0; i < mono_array_length (mb->pinfo); ++i) {
+                       MonoReflectionParamBuilder *pb;
+                       if ((pb = mono_array_get (mb->pinfo, MonoReflectionParamBuilder*, i))) {
+                               values [MONO_PARAM_FLAGS] = pb->attrs;
+                               values [MONO_PARAM_SEQUENCE] = i;
+                               if (pb->name != NULL) {
+                                       values [MONO_PARAM_NAME] = string_heap_insert_mstring (&assembly->sheap, pb->name, error);
+                                       return_val_if_nok (error, FALSE);
+                               } else {
+                                       values [MONO_PARAM_NAME] = 0;
+                               }
+                               values += MONO_PARAM_SIZE;
+                               if (pb->marshal_info) {
+                                       mtable->rows++;
+                                       alloc_table (mtable, mtable->rows);
+                                       mvalues = mtable->values + mtable->rows * MONO_FIELD_MARSHAL_SIZE;
+                                       mvalues [MONO_FIELD_MARSHAL_PARENT] = (table->next_idx << MONO_HAS_FIELD_MARSHAL_BITS) | MONO_HAS_FIELD_MARSHAL_PARAMDEF;
+                                       mvalues [MONO_FIELD_MARSHAL_NATIVE_TYPE] = mono_dynimage_save_encode_marshal_blob (assembly, pb->marshal_info, error);
+                                       return_val_if_nok (error, FALSE);
+                               }
+                               pb->table_idx = table->next_idx++;
+                               if (pb->attrs & PARAM_ATTRIBUTE_HAS_DEFAULT) {
+                                       guint32 field_type = 0;
+                                       mtable = &assembly->tables [MONO_TABLE_CONSTANT];
+                                       mtable->rows ++;
+                                       alloc_table (mtable, mtable->rows);
+                                       mvalues = mtable->values + mtable->rows * MONO_CONSTANT_SIZE;
+                                       mvalues [MONO_CONSTANT_PARENT] = MONO_HASCONSTANT_PARAM | (pb->table_idx << MONO_HASCONSTANT_BITS);
+                                       mvalues [MONO_CONSTANT_VALUE] = mono_dynimage_encode_constant (assembly, pb->def_value, &field_type);
+                                       mvalues [MONO_CONSTANT_TYPE] = field_type;
+                                       mvalues [MONO_CONSTANT_PADDING] = 0;
+                               }
+                       }
+               }
+       }
+
+       return TRUE;
+}
+
+static gboolean
+mono_image_add_methodimpl (MonoDynamicImage *assembly, MonoReflectionMethodBuilder *mb, MonoError *error)
+{
+       MONO_REQ_GC_UNSAFE_MODE;
+
+       MonoReflectionTypeBuilder *tb = (MonoReflectionTypeBuilder *)mb->type;
+       MonoDynamicTable *table;
+       guint32 *values;
+       guint32 tok;
+       MonoReflectionMethod *m;
+       int i;
+
+       mono_error_init (error);
+
+       if (!mb->override_methods)
+               return TRUE;
+
+       for (i = 0; i < mono_array_length (mb->override_methods); ++i) {
+               m = mono_array_get (mb->override_methods, MonoReflectionMethod*, i);
+
+               table = &assembly->tables [MONO_TABLE_METHODIMPL];
+               table->rows ++;
+               alloc_table (table, table->rows);
+               values = table->values + table->rows * MONO_METHODIMPL_SIZE;
+               values [MONO_METHODIMPL_CLASS] = tb->table_idx;
+               values [MONO_METHODIMPL_BODY] = MONO_METHODDEFORREF_METHODDEF | (mb->table_idx << MONO_METHODDEFORREF_BITS);
+
+               tok = mono_image_create_token (assembly, (MonoObject*)m, FALSE, FALSE, error);
+               return_val_if_nok (error, FALSE);
+
+               switch (mono_metadata_token_table (tok)) {
+               case MONO_TABLE_MEMBERREF:
+                       tok = (mono_metadata_token_index (tok) << MONO_METHODDEFORREF_BITS ) | MONO_METHODDEFORREF_METHODREF;
+                       break;
+               case MONO_TABLE_METHOD:
+                       tok = (mono_metadata_token_index (tok) << MONO_METHODDEFORREF_BITS ) | MONO_METHODDEFORREF_METHODDEF;
+                       break;
+               default:
+                       g_assert_not_reached ();
+               }
+               values [MONO_METHODIMPL_DECLARATION] = tok;
+       }
+
+       return TRUE;
+}
+
+#ifndef DISABLE_REFLECTION_EMIT
+static gboolean
+mono_image_get_method_info (MonoReflectionMethodBuilder *mb, MonoDynamicImage *assembly, MonoError *error)
+{
+       MONO_REQ_GC_UNSAFE_MODE;
+
+       MonoDynamicTable *table;
+       guint32 *values;
+       ReflectionMethodBuilder rmb;
+       int i;
+
+       mono_error_init (error);
+
+       if (!mono_reflection_methodbuilder_from_method_builder (&rmb, mb, error) ||
+           !mono_image_basic_method (&rmb, assembly, error))
+               return FALSE;
+
+       mb->table_idx = *rmb.table_idx;
+
+       if (mb->dll) { /* It's a P/Invoke method */
+               guint32 moduleref;
+               /* map CharSet values to on-disk values */
+               int ncharset = (mb->charset ? (mb->charset - 1) * 2 : 0);
+               int extra_flags = mb->extra_flags;
+               table = &assembly->tables [MONO_TABLE_IMPLMAP];
+               table->rows ++;
+               alloc_table (table, table->rows);
+               values = table->values + table->rows * MONO_IMPLMAP_SIZE;
+               
+               values [MONO_IMPLMAP_FLAGS] = (mb->native_cc << 8) | ncharset | extra_flags;
+               values [MONO_IMPLMAP_MEMBER] = (mb->table_idx << 1) | 1; /* memberforwarded: method */
+               if (mb->dllentry) {
+                       values [MONO_IMPLMAP_NAME] = string_heap_insert_mstring (&assembly->sheap, mb->dllentry, error);
+                       return_val_if_nok (error, FALSE);
+               } else {
+                       values [MONO_IMPLMAP_NAME] = string_heap_insert_mstring (&assembly->sheap, mb->name, error);
+                       return_val_if_nok (error, FALSE);
+               }
+               moduleref = string_heap_insert_mstring (&assembly->sheap, mb->dll, error);
+               return_val_if_nok (error, FALSE);
+               if (!(values [MONO_IMPLMAP_SCOPE] = find_index_in_table (assembly, MONO_TABLE_MODULEREF, MONO_MODULEREF_NAME, moduleref))) {
+                       table = &assembly->tables [MONO_TABLE_MODULEREF];
+                       table->rows ++;
+                       alloc_table (table, table->rows);
+                       table->values [table->rows * MONO_MODULEREF_SIZE + MONO_MODULEREF_NAME] = moduleref;
+                       values [MONO_IMPLMAP_SCOPE] = table->rows;
+               }
+       }
+
+       if (mb->generic_params) {
+               table = &assembly->tables [MONO_TABLE_GENERICPARAM];
+               table->rows += mono_array_length (mb->generic_params);
+               alloc_table (table, table->rows);
+               for (i = 0; i < mono_array_length (mb->generic_params); ++i) {
+                       guint32 owner = MONO_TYPEORMETHOD_METHOD | (mb->table_idx << MONO_TYPEORMETHOD_BITS);
+
+                       mono_image_get_generic_param_info (
+                               (MonoReflectionGenericParam *)mono_array_get (mb->generic_params, gpointer, i), owner, assembly);
+               }
+       }
+
+       return TRUE;
+}
+
+static gboolean
+mono_image_get_ctor_info (MonoDomain *domain, MonoReflectionCtorBuilder *mb, MonoDynamicImage *assembly, MonoError *error)
+{
+       MONO_REQ_GC_UNSAFE_MODE;
+
+       ReflectionMethodBuilder rmb;
+
+       if (!mono_reflection_methodbuilder_from_ctor_builder (&rmb, mb, error))
+               return FALSE;
+
+       if (!mono_image_basic_method (&rmb, assembly, error))
+               return FALSE;
+
+       mb->table_idx = *rmb.table_idx;
+
+       return TRUE;
+}
+#endif
+
+static void
+mono_image_get_field_info (MonoReflectionFieldBuilder *fb, MonoDynamicImage *assembly, MonoError *error)
+{
+       MONO_REQ_GC_UNSAFE_MODE;
+
+       mono_error_init (error);
+
+       MonoDynamicTable *table;
+       guint32 *values;
+
+       /* maybe this fixup should be done in the C# code */
+       if (fb->attrs & FIELD_ATTRIBUTE_LITERAL)
+               fb->attrs |= FIELD_ATTRIBUTE_HAS_DEFAULT;
+       table = &assembly->tables [MONO_TABLE_FIELD];
+       fb->table_idx = table->next_idx ++;
+       g_hash_table_insert (assembly->field_to_table_idx, fb->handle, GUINT_TO_POINTER (fb->table_idx));
+       values = table->values + fb->table_idx * MONO_FIELD_SIZE;
+       values [MONO_FIELD_NAME] = string_heap_insert_mstring (&assembly->sheap, fb->name, error);
+       return_if_nok (error);
+       values [MONO_FIELD_FLAGS] = fb->attrs;
+       values [MONO_FIELD_SIGNATURE] = mono_dynimage_encode_field_signature (assembly, fb, error);
+       return_if_nok (error);
+
+       if (fb->offset != -1) {
+               table = &assembly->tables [MONO_TABLE_FIELDLAYOUT];
+               table->rows ++;
+               alloc_table (table, table->rows);
+               values = table->values + table->rows * MONO_FIELD_LAYOUT_SIZE;
+               values [MONO_FIELD_LAYOUT_FIELD] = fb->table_idx;
+               values [MONO_FIELD_LAYOUT_OFFSET] = fb->offset;
+       }
+       if (fb->attrs & FIELD_ATTRIBUTE_LITERAL) {
+               MonoTypeEnum field_type = (MonoTypeEnum)0;
+               table = &assembly->tables [MONO_TABLE_CONSTANT];
+               table->rows ++;
+               alloc_table (table, table->rows);
+               values = table->values + table->rows * MONO_CONSTANT_SIZE;
+               values [MONO_CONSTANT_PARENT] = MONO_HASCONSTANT_FIEDDEF | (fb->table_idx << MONO_HASCONSTANT_BITS);
+               values [MONO_CONSTANT_VALUE] = mono_dynimage_encode_constant (assembly, fb->def_value, &field_type);
+               values [MONO_CONSTANT_TYPE] = field_type;
+               values [MONO_CONSTANT_PADDING] = 0;
+       }
+       if (fb->attrs & FIELD_ATTRIBUTE_HAS_FIELD_RVA) {
+               guint32 rva_idx;
+               table = &assembly->tables [MONO_TABLE_FIELDRVA];
+               table->rows ++;
+               alloc_table (table, table->rows);
+               values = table->values + table->rows * MONO_FIELD_RVA_SIZE;
+               values [MONO_FIELD_RVA_FIELD] = fb->table_idx;
+               /*
+                * We store it in the code section because it's simpler for now.
+                */
+               if (fb->rva_data) {
+                       if (mono_array_length (fb->rva_data) >= 10)
+                               stream_data_align (&assembly->code);
+                       rva_idx = mono_image_add_stream_data (&assembly->code, mono_array_addr (fb->rva_data, char, 0), mono_array_length (fb->rva_data));
+               } else
+                       rva_idx = mono_image_add_stream_zero (&assembly->code, mono_class_value_size (fb->handle->parent, NULL));
+               values [MONO_FIELD_RVA_RVA] = rva_idx + assembly->text_rva;
+       }
+       if (fb->marshal_info) {
+               table = &assembly->tables [MONO_TABLE_FIELDMARSHAL];
+               table->rows ++;
+               alloc_table (table, table->rows);
+               values = table->values + table->rows * MONO_FIELD_MARSHAL_SIZE;
+               values [MONO_FIELD_MARSHAL_PARENT] = (fb->table_idx << MONO_HAS_FIELD_MARSHAL_BITS) | MONO_HAS_FIELD_MARSHAL_FIELDSREF;
+               values [MONO_FIELD_MARSHAL_NATIVE_TYPE] = mono_dynimage_save_encode_marshal_blob (assembly, fb->marshal_info, error);
+               return_if_nok (error);
+       }
+}
+
+static void
+mono_image_get_property_info (MonoReflectionPropertyBuilder *pb, MonoDynamicImage *assembly, MonoError *error)
+{
+       MONO_REQ_GC_UNSAFE_MODE;
+
+       mono_error_init (error);
+
+       MonoDynamicTable *table;
+       guint32 *values;
+       guint num_methods = 0;
+       guint32 semaidx;
+
+       /* 
+        * we need to set things in the following tables:
+        * PROPERTYMAP (info already filled in _get_type_info ())
+        * PROPERTY    (rows already preallocated in _get_type_info ())
+        * METHOD      (method info already done with the generic method code)
+        * METHODSEMANTICS
+        * CONSTANT
+        */
+       table = &assembly->tables [MONO_TABLE_PROPERTY];
+       pb->table_idx = table->next_idx ++;
+       values = table->values + pb->table_idx * MONO_PROPERTY_SIZE;
+       values [MONO_PROPERTY_NAME] = string_heap_insert_mstring (&assembly->sheap, pb->name, error);
+       return_if_nok (error);
+       values [MONO_PROPERTY_FLAGS] = pb->attrs;
+       values [MONO_PROPERTY_TYPE] = mono_dynimage_save_encode_property_signature (assembly, pb, error);
+       return_if_nok (error);
+
+
+       /* FIXME: we still don't handle 'other' methods */
+       if (pb->get_method) num_methods ++;
+       if (pb->set_method) num_methods ++;
+
+       table = &assembly->tables [MONO_TABLE_METHODSEMANTICS];
+       table->rows += num_methods;
+       alloc_table (table, table->rows);
+
+       if (pb->get_method) {
+               semaidx = table->next_idx ++;
+               values = table->values + semaidx * MONO_METHOD_SEMA_SIZE;
+               values [MONO_METHOD_SEMA_SEMANTICS] = METHOD_SEMANTIC_GETTER;
+               values [MONO_METHOD_SEMA_METHOD] = pb->get_method->table_idx;
+               values [MONO_METHOD_SEMA_ASSOCIATION] = (pb->table_idx << MONO_HAS_SEMANTICS_BITS) | MONO_HAS_SEMANTICS_PROPERTY;
+       }
+       if (pb->set_method) {
+               semaidx = table->next_idx ++;
+               values = table->values + semaidx * MONO_METHOD_SEMA_SIZE;
+               values [MONO_METHOD_SEMA_SEMANTICS] = METHOD_SEMANTIC_SETTER;
+               values [MONO_METHOD_SEMA_METHOD] = pb->set_method->table_idx;
+               values [MONO_METHOD_SEMA_ASSOCIATION] = (pb->table_idx << MONO_HAS_SEMANTICS_BITS) | MONO_HAS_SEMANTICS_PROPERTY;
+       }
+       if (pb->attrs & PROPERTY_ATTRIBUTE_HAS_DEFAULT) {
+               MonoTypeEnum field_type = (MonoTypeEnum)0;
+               table = &assembly->tables [MONO_TABLE_CONSTANT];
+               table->rows ++;
+               alloc_table (table, table->rows);
+               values = table->values + table->rows * MONO_CONSTANT_SIZE;
+               values [MONO_CONSTANT_PARENT] = MONO_HASCONSTANT_PROPERTY | (pb->table_idx << MONO_HASCONSTANT_BITS);
+               values [MONO_CONSTANT_VALUE] = mono_dynimage_encode_constant (assembly, pb->def_value, &field_type);
+               values [MONO_CONSTANT_TYPE] = field_type;
+               values [MONO_CONSTANT_PADDING] = 0;
+       }
+}
+
+static void
+mono_image_get_event_info (MonoReflectionEventBuilder *eb, MonoDynamicImage *assembly, MonoError *error)
+{
+       MONO_REQ_GC_UNSAFE_MODE;
+
+       MonoDynamicTable *table;
+       guint32 *values;
+       guint num_methods = 0;
+       guint32 semaidx;
+
+       /* 
+        * we need to set things in the following tables:
+        * EVENTMAP (info already filled in _get_type_info ())
+        * EVENT    (rows already preallocated in _get_type_info ())
+        * METHOD      (method info already done with the generic method code)
+        * METHODSEMANTICS
+        */
+       table = &assembly->tables [MONO_TABLE_EVENT];
+       eb->table_idx = table->next_idx ++;
+       values = table->values + eb->table_idx * MONO_EVENT_SIZE;
+       values [MONO_EVENT_NAME] = string_heap_insert_mstring (&assembly->sheap, eb->name, error);
+       return_if_nok (error);
+       values [MONO_EVENT_FLAGS] = eb->attrs;
+       MonoType *ebtype = mono_reflection_type_get_handle (eb->type, error);
+       return_if_nok (error);
+       values [MONO_EVENT_TYPE] = mono_image_typedef_or_ref (assembly, ebtype);
+
+       /*
+        * FIXME: we still don't handle 'other' methods 
+        */
+       if (eb->add_method) num_methods ++;
+       if (eb->remove_method) num_methods ++;
+       if (eb->raise_method) num_methods ++;
+
+       table = &assembly->tables [MONO_TABLE_METHODSEMANTICS];
+       table->rows += num_methods;
+       alloc_table (table, table->rows);
+
+       if (eb->add_method) {
+               semaidx = table->next_idx ++;
+               values = table->values + semaidx * MONO_METHOD_SEMA_SIZE;
+               values [MONO_METHOD_SEMA_SEMANTICS] = METHOD_SEMANTIC_ADD_ON;
+               values [MONO_METHOD_SEMA_METHOD] = eb->add_method->table_idx;
+               values [MONO_METHOD_SEMA_ASSOCIATION] = (eb->table_idx << MONO_HAS_SEMANTICS_BITS) | MONO_HAS_SEMANTICS_EVENT;
+       }
+       if (eb->remove_method) {
+               semaidx = table->next_idx ++;
+               values = table->values + semaidx * MONO_METHOD_SEMA_SIZE;
+               values [MONO_METHOD_SEMA_SEMANTICS] = METHOD_SEMANTIC_REMOVE_ON;
+               values [MONO_METHOD_SEMA_METHOD] = eb->remove_method->table_idx;
+               values [MONO_METHOD_SEMA_ASSOCIATION] = (eb->table_idx << MONO_HAS_SEMANTICS_BITS) | MONO_HAS_SEMANTICS_EVENT;
+       }
+       if (eb->raise_method) {
+               semaidx = table->next_idx ++;
+               values = table->values + semaidx * MONO_METHOD_SEMA_SIZE;
+               values [MONO_METHOD_SEMA_SEMANTICS] = METHOD_SEMANTIC_FIRE;
+               values [MONO_METHOD_SEMA_METHOD] = eb->raise_method->table_idx;
+               values [MONO_METHOD_SEMA_ASSOCIATION] = (eb->table_idx << MONO_HAS_SEMANTICS_BITS) | MONO_HAS_SEMANTICS_EVENT;
+       }
+}
+
+static void
+encode_constraints (MonoReflectionGenericParam *gparam, guint32 owner, MonoDynamicImage *assembly, MonoError *error)
+{
+       MONO_REQ_GC_UNSAFE_MODE;
+
+       mono_error_init (error);
+
+       MonoDynamicTable *table;
+       guint32 num_constraints, i;
+       guint32 *values;
+       guint32 table_idx;
+
+       table = &assembly->tables [MONO_TABLE_GENERICPARAMCONSTRAINT];
+       num_constraints = gparam->iface_constraints ?
+               mono_array_length (gparam->iface_constraints) : 0;
+       table->rows += num_constraints;
+       if (gparam->base_type)
+               table->rows++;
+       alloc_table (table, table->rows);
+
+       if (gparam->base_type) {
+               table_idx = table->next_idx ++;
+               values = table->values + table_idx * MONO_GENPARCONSTRAINT_SIZE;
+
+               MonoType *gpbasetype = mono_reflection_type_get_handle (gparam->base_type, error);
+               return_if_nok (error);
+               values [MONO_GENPARCONSTRAINT_GENERICPAR] = owner;
+               values [MONO_GENPARCONSTRAINT_CONSTRAINT] = mono_image_typedef_or_ref (assembly, gpbasetype);
+       }
+
+       for (i = 0; i < num_constraints; i++) {
+               MonoReflectionType *constraint = (MonoReflectionType *)mono_array_get (
+                       gparam->iface_constraints, gpointer, i);
+
+               table_idx = table->next_idx ++;
+               values = table->values + table_idx * MONO_GENPARCONSTRAINT_SIZE;
+
+               MonoType *constraint_type = mono_reflection_type_get_handle (constraint, error);
+               return_if_nok (error);
+
+               values [MONO_GENPARCONSTRAINT_GENERICPAR] = owner;
+               values [MONO_GENPARCONSTRAINT_CONSTRAINT] = mono_image_typedef_or_ref (assembly, constraint_type);
+       }
+}
+
+static void
+mono_image_get_generic_param_info (MonoReflectionGenericParam *gparam, guint32 owner, MonoDynamicImage *assembly)
+{
+       MONO_REQ_GC_UNSAFE_MODE;
+
+       GenericParamTableEntry *entry;
+
+       /*
+        * The GenericParam table must be sorted according to the `owner' field.
+        * We need to do this sorting prior to writing the GenericParamConstraint
+        * table, since we have to use the final GenericParam table indices there
+        * and they must also be sorted.
+        */
+
+       entry = g_new0 (GenericParamTableEntry, 1);
+       entry->owner = owner;
+       /* FIXME: track where gen_params should be freed and remove the GC root as well */
+       MONO_GC_REGISTER_ROOT_IF_MOVING (entry->gparam, MONO_ROOT_SOURCE_REFLECTION, "reflection generic parameter");
+       entry->gparam = gparam;
+       
+       g_ptr_array_add (assembly->gen_params, entry);
+}
+
+static gboolean
+write_generic_param_entry (MonoDynamicImage *assembly, GenericParamTableEntry *entry, MonoError *error)
+{
+       MONO_REQ_GC_UNSAFE_MODE;
+
+       MonoDynamicTable *table;
+       MonoGenericParam *param;
+       guint32 *values;
+       guint32 table_idx;
+
+       mono_error_init (error);
+
+       table = &assembly->tables [MONO_TABLE_GENERICPARAM];
+       table_idx = table->next_idx ++;
+       values = table->values + table_idx * MONO_GENERICPARAM_SIZE;
+
+       MonoType *gparam_type = mono_reflection_type_get_handle ((MonoReflectionType*)entry->gparam, error);
+       return_val_if_nok (error, FALSE);
+
+       param = gparam_type->data.generic_param;
+
+       values [MONO_GENERICPARAM_OWNER] = entry->owner;
+       values [MONO_GENERICPARAM_FLAGS] = entry->gparam->attrs;
+       values [MONO_GENERICPARAM_NUMBER] = mono_generic_param_num (param);
+       values [MONO_GENERICPARAM_NAME] = string_heap_insert (&assembly->sheap, mono_generic_param_info (param)->name);
+
+       if (!mono_image_add_cattrs (assembly, table_idx, MONO_CUSTOM_ATTR_GENERICPAR, entry->gparam->cattrs, error))
+               return FALSE;
+
+       encode_constraints (entry->gparam, table_idx, assembly, error);
+       return_val_if_nok (error, FALSE);
+
+       return TRUE;
+}
+
+static void
+collect_types (MonoPtrArray *types, MonoReflectionTypeBuilder *type)
+{
+       int i;
+
+       mono_ptr_array_append (*types, type);
+
+       if (!type->subtypes)
+               return;
+
+       for (i = 0; i < mono_array_length (type->subtypes); ++i) {
+               MonoReflectionTypeBuilder *subtype = mono_array_get (type->subtypes, MonoReflectionTypeBuilder*, i);
+               collect_types (types, subtype);
+       }
+}
+
+static gint
+compare_types_by_table_idx (MonoReflectionTypeBuilder **type1, MonoReflectionTypeBuilder **type2)
+{
+       if ((*type1)->table_idx < (*type2)->table_idx)
+               return -1;
+       else
+               if ((*type1)->table_idx > (*type2)->table_idx)
+                       return 1;
+       else
+               return 0;
+}
+
+static gboolean
+params_add_cattrs (MonoDynamicImage *assembly, MonoArray *pinfo, MonoError *error) {
+       int i;
+
+       mono_error_init (error);
+       if (!pinfo)
+               return TRUE;
+       for (i = 0; i < mono_array_length (pinfo); ++i) {
+               MonoReflectionParamBuilder *pb;
+               pb = mono_array_get (pinfo, MonoReflectionParamBuilder *, i);
+               if (!pb)
+                       continue;
+               if (!mono_image_add_cattrs (assembly, pb->table_idx, MONO_CUSTOM_ATTR_PARAMDEF, pb->cattrs, error))
+                       return FALSE;
+       }
+
+       return TRUE;
+}
+
+static gboolean
+type_add_cattrs (MonoDynamicImage *assembly, MonoReflectionTypeBuilder *tb, MonoError *error) {
+       int i;
+
+       mono_error_init (error);
+       
+       if (!mono_image_add_cattrs (assembly, tb->table_idx, MONO_CUSTOM_ATTR_TYPEDEF, tb->cattrs, error))
+               return FALSE;
+       if (tb->fields) {
+               for (i = 0; i < tb->num_fields; ++i) {
+                       MonoReflectionFieldBuilder* fb;
+                       fb = mono_array_get (tb->fields, MonoReflectionFieldBuilder*, i);
+                       if (!mono_image_add_cattrs (assembly, fb->table_idx, MONO_CUSTOM_ATTR_FIELDDEF, fb->cattrs, error))
+                               return FALSE;
+               }
+       }
+       if (tb->events) {
+               for (i = 0; i < mono_array_length (tb->events); ++i) {
+                       MonoReflectionEventBuilder* eb;
+                       eb = mono_array_get (tb->events, MonoReflectionEventBuilder*, i);
+                       if (!mono_image_add_cattrs (assembly, eb->table_idx, MONO_CUSTOM_ATTR_EVENT, eb->cattrs, error))
+                               return FALSE;
+               }
+       }
+       if (tb->properties) {
+               for (i = 0; i < mono_array_length (tb->properties); ++i) {
+                       MonoReflectionPropertyBuilder* pb;
+                       pb = mono_array_get (tb->properties, MonoReflectionPropertyBuilder*, i);
+                       if (!mono_image_add_cattrs (assembly, pb->table_idx, MONO_CUSTOM_ATTR_PROPERTY, pb->cattrs, error))
+                               return FALSE;
+               }
+       }
+       if (tb->ctors) {
+               for (i = 0; i < mono_array_length (tb->ctors); ++i) {
+                       MonoReflectionCtorBuilder* cb;
+                       cb = mono_array_get (tb->ctors, MonoReflectionCtorBuilder*, i);
+                       if (!mono_image_add_cattrs (assembly, cb->table_idx, MONO_CUSTOM_ATTR_METHODDEF, cb->cattrs, error) ||
+                           !params_add_cattrs (assembly, cb->pinfo, error))
+                               return FALSE;
+               }
+       }
+
+       if (tb->methods) {
+               for (i = 0; i < tb->num_methods; ++i) {
+                       MonoReflectionMethodBuilder* mb;
+                       mb = mono_array_get (tb->methods, MonoReflectionMethodBuilder*, i);
+                       if (!mono_image_add_cattrs (assembly, mb->table_idx, MONO_CUSTOM_ATTR_METHODDEF, mb->cattrs, error) ||
+                           !params_add_cattrs (assembly, mb->pinfo, error))
+                               return FALSE;
+               }
+       }
+
+       if (tb->subtypes) {
+               for (i = 0; i < mono_array_length (tb->subtypes); ++i) {
+                       if (!type_add_cattrs (assembly, mono_array_get (tb->subtypes, MonoReflectionTypeBuilder*, i), error))
+                               return FALSE;
+               }
+       }
+
+       return TRUE;
+}
+
+static gboolean
+module_add_cattrs (MonoDynamicImage *assembly, MonoReflectionModuleBuilder *moduleb, MonoError *error)
+{
+       int i;
+       
+       mono_error_init (error);
+
+       if (!mono_image_add_cattrs (assembly, moduleb->table_idx, MONO_CUSTOM_ATTR_MODULE, moduleb->cattrs, error))
+               return FALSE;
+
+       if (moduleb->global_methods) {
+               for (i = 0; i < mono_array_length (moduleb->global_methods); ++i) {
+                       MonoReflectionMethodBuilder* mb = mono_array_get (moduleb->global_methods, MonoReflectionMethodBuilder*, i);
+                       if (!mono_image_add_cattrs (assembly, mb->table_idx, MONO_CUSTOM_ATTR_METHODDEF, mb->cattrs, error) ||
+                           !params_add_cattrs (assembly, mb->pinfo, error))
+                               return FALSE;
+               }
+       }
+
+       if (moduleb->global_fields) {
+               for (i = 0; i < mono_array_length (moduleb->global_fields); ++i) {
+                       MonoReflectionFieldBuilder *fb = mono_array_get (moduleb->global_fields, MonoReflectionFieldBuilder*, i);
+                       if (!mono_image_add_cattrs (assembly, fb->table_idx, MONO_CUSTOM_ATTR_FIELDDEF, fb->cattrs, error))
+                               return FALSE;
+               }
+       }
+       
+       if (moduleb->types) {
+               for (i = 0; i < moduleb->num_types; ++i) {
+                       if (!type_add_cattrs (assembly, mono_array_get (moduleb->types, MonoReflectionTypeBuilder*, i), error))
+                               return FALSE;
+               }
+       }
+
+       return TRUE;
+}
+
+static gboolean
+mono_image_fill_file_table (MonoDomain *domain, MonoReflectionModule *module, MonoDynamicImage *assembly, MonoError *error)
+{
+       MonoDynamicTable *table;
+       guint32 *values;
+       char blob_size [6];
+       guchar hash [20];
+       char *b = blob_size;
+       char *dir, *path;
+
+       mono_error_init (error);
+
+       table = &assembly->tables [MONO_TABLE_FILE];
+       table->rows++;
+       alloc_table (table, table->rows);
+       values = table->values + table->next_idx * MONO_FILE_SIZE;
+       values [MONO_FILE_FLAGS] = FILE_CONTAINS_METADATA;
+       values [MONO_FILE_NAME] = string_heap_insert (&assembly->sheap, module->image->module_name);
+       if (image_is_dynamic (module->image)) {
+               /* This depends on the fact that the main module is emitted last */
+               dir = mono_string_to_utf8_checked (((MonoReflectionModuleBuilder*)module)->assemblyb->dir, error);
+               return_val_if_nok (error, FALSE);
+               path = g_strdup_printf ("%s%c%s", dir, G_DIR_SEPARATOR, module->image->module_name);
+       } else {
+               dir = NULL;
+               path = g_strdup (module->image->name);
+       }
+       mono_sha1_get_digest_from_file (path, hash);
+       g_free (dir);
+       g_free (path);
+       mono_metadata_encode_value (20, b, &b);
+       values [MONO_FILE_HASH_VALUE] = mono_image_add_stream_data (&assembly->blob, blob_size, b-blob_size);
+       mono_image_add_stream_data (&assembly->blob, (char*)hash, 20);
+       table->next_idx ++;
+       return TRUE;
+}
+
+static void
+mono_image_fill_module_table (MonoDomain *domain, MonoReflectionModuleBuilder *mb, MonoDynamicImage *assembly, MonoError *error)
+{
+       MonoDynamicTable *table;
+       int i;
+
+       mono_error_init (error);
+
+       table = &assembly->tables [MONO_TABLE_MODULE];
+       mb->table_idx = table->next_idx ++;
+       table->values [mb->table_idx * MONO_MODULE_SIZE + MONO_MODULE_NAME] = string_heap_insert_mstring (&assembly->sheap, mb->module.name, error);
+       return_if_nok (error);
+       i = mono_image_add_stream_data (&assembly->guid, mono_array_addr (mb->guid, char, 0), 16);
+       i /= 16;
+       ++i;
+       table->values [mb->table_idx * MONO_MODULE_SIZE + MONO_MODULE_GENERATION] = 0;
+       table->values [mb->table_idx * MONO_MODULE_SIZE + MONO_MODULE_MVID] = i;
+       table->values [mb->table_idx * MONO_MODULE_SIZE + MONO_MODULE_ENC] = 0;
+       table->values [mb->table_idx * MONO_MODULE_SIZE + MONO_MODULE_ENCBASE] = 0;
+}
+
+static guint32
+mono_image_fill_export_table_from_class (MonoDomain *domain, MonoClass *klass,
+       guint32 module_index, guint32 parent_index, MonoDynamicImage *assembly)
+{
+       MonoDynamicTable *table;
+       guint32 *values;
+       guint32 visib, res;
+
+       visib = mono_class_get_flags (klass) & TYPE_ATTRIBUTE_VISIBILITY_MASK;
+       if (! ((visib & TYPE_ATTRIBUTE_PUBLIC) || (visib & TYPE_ATTRIBUTE_NESTED_PUBLIC)))
+               return 0;
+
+       table = &assembly->tables [MONO_TABLE_EXPORTEDTYPE];
+       table->rows++;
+       alloc_table (table, table->rows);
+       values = table->values + table->next_idx * MONO_EXP_TYPE_SIZE;
+
+       values [MONO_EXP_TYPE_FLAGS] = mono_class_get_flags (klass);
+       values [MONO_EXP_TYPE_TYPEDEF] = klass->type_token;
+       if (klass->nested_in)
+               values [MONO_EXP_TYPE_IMPLEMENTATION] = (parent_index << MONO_IMPLEMENTATION_BITS) + MONO_IMPLEMENTATION_EXP_TYPE;
+       else
+               values [MONO_EXP_TYPE_IMPLEMENTATION] = (module_index << MONO_IMPLEMENTATION_BITS) + MONO_IMPLEMENTATION_FILE;
+       values [MONO_EXP_TYPE_NAME] = string_heap_insert (&assembly->sheap, klass->name);
+       values [MONO_EXP_TYPE_NAMESPACE] = string_heap_insert (&assembly->sheap, klass->name_space);
+
+       res = table->next_idx;
+
+       table->next_idx ++;
+
+       /* Emit nested types */
+       MonoClassExt *ext = mono_class_get_ext (klass);
+       if (ext && ext->nested_classes) {
+               GList *tmp;
+
+               for (tmp = ext->nested_classes; tmp; tmp = tmp->next)
+                       mono_image_fill_export_table_from_class (domain, (MonoClass *)tmp->data, module_index, table->next_idx - 1, assembly);
+       }
+
+       return res;
+}
+
+static void
+mono_image_fill_export_table (MonoDomain *domain, MonoReflectionTypeBuilder *tb,
+                             guint32 module_index, guint32 parent_index, MonoDynamicImage *assembly,
+                             MonoError *error)
+{
+       MonoClass *klass;
+       guint32 idx, i;
+
+       mono_error_init (error);
+
+       MonoType *t = mono_reflection_type_get_handle ((MonoReflectionType*)tb, error);
+       return_if_nok (error);
+
+       klass = mono_class_from_mono_type (t);
+
+       klass->type_token = mono_metadata_make_token (MONO_TABLE_TYPEDEF, tb->table_idx);
+
+       idx = mono_image_fill_export_table_from_class (domain, klass, module_index, 
+                                                                                                  parent_index, assembly);
+
+       /* 
+        * Emit nested types
+        * We need to do this ourselves since klass->nested_classes is not set up.
+        */
+       if (tb->subtypes) {
+               for (i = 0; i < mono_array_length (tb->subtypes); ++i) {
+                       mono_image_fill_export_table (domain, mono_array_get (tb->subtypes, MonoReflectionTypeBuilder*, i), module_index, idx, assembly, error);
+                       return_if_nok (error);
+               }
+       }
+}
+
+static void
+mono_image_fill_export_table_from_module (MonoDomain *domain, MonoReflectionModule *module,
+       guint32 module_index, MonoDynamicImage *assembly)
+{
+       MonoImage *image = module->image;
+       MonoTableInfo  *t;
+       guint32 i;
+
+       t = &image->tables [MONO_TABLE_TYPEDEF];
+
+       for (i = 0; i < t->rows; ++i) {
+               MonoError error;
+               MonoClass *klass = mono_class_get_checked (image, mono_metadata_make_token (MONO_TABLE_TYPEDEF, i + 1), &error);
+               g_assert (mono_error_ok (&error)); /* FIXME don't swallow the error */
+
+               if (mono_class_is_public (klass))
+                       mono_image_fill_export_table_from_class (domain, klass, module_index, 0, assembly);
+       }
+}
+
+static void
+add_exported_type (MonoReflectionAssemblyBuilder *assemblyb, MonoDynamicImage *assembly, MonoClass *klass, guint32 parent_index)
+{
+       MonoDynamicTable *table;
+       guint32 *values;
+       guint32 scope, scope_idx, impl, current_idx;
+       gboolean forwarder = TRUE;
+       gpointer iter = NULL;
+       MonoClass *nested;
+
+       if (klass->nested_in) {
+               impl = (parent_index << MONO_IMPLEMENTATION_BITS) + MONO_IMPLEMENTATION_EXP_TYPE;
+               forwarder = FALSE;
+       } else {
+               scope = mono_reflection_resolution_scope_from_image (assembly, klass->image);
+               g_assert ((scope & MONO_RESOLUTION_SCOPE_MASK) == MONO_RESOLUTION_SCOPE_ASSEMBLYREF);
+               scope_idx = scope >> MONO_RESOLUTION_SCOPE_BITS;
+               impl = (scope_idx << MONO_IMPLEMENTATION_BITS) + MONO_IMPLEMENTATION_ASSEMBLYREF;
+       }
+
+       table = &assembly->tables [MONO_TABLE_EXPORTEDTYPE];
+
+       table->rows++;
+       alloc_table (table, table->rows);
+       current_idx = table->next_idx;
+       values = table->values + current_idx * MONO_EXP_TYPE_SIZE;
+
+       values [MONO_EXP_TYPE_FLAGS] = forwarder ? TYPE_ATTRIBUTE_FORWARDER : 0;
+       values [MONO_EXP_TYPE_TYPEDEF] = 0;
+       values [MONO_EXP_TYPE_IMPLEMENTATION] = impl;
+       values [MONO_EXP_TYPE_NAME] = string_heap_insert (&assembly->sheap, klass->name);
+       values [MONO_EXP_TYPE_NAMESPACE] = string_heap_insert (&assembly->sheap, klass->name_space);
+
+       table->next_idx++;
+
+       while ((nested = mono_class_get_nested_types (klass, &iter)))
+               add_exported_type (assemblyb, assembly, nested, current_idx);
+}
+
+static void
+mono_image_fill_export_table_from_type_forwarders (MonoReflectionAssemblyBuilder *assemblyb, MonoDynamicImage *assembly)
+{
+       MonoError error;
+       MonoClass *klass;
+       int i;
+
+       if (!assemblyb->type_forwarders)
+               return;
+
+       for (i = 0; i < mono_array_length (assemblyb->type_forwarders); ++i) {
+               MonoReflectionType *t = mono_array_get (assemblyb->type_forwarders, MonoReflectionType *, i);
+               MonoType *type;
+               if (!t)
+                       continue;
+
+               type = mono_reflection_type_get_handle (t, &error);
+               mono_error_assert_ok (&error);
+               g_assert (type);
+
+               klass = mono_class_from_mono_type (type);
+
+               add_exported_type (assemblyb, assembly, klass, 0);
+       }
+}
+
+#define align_pointer(base,p)\
+       do {\
+               guint32 __diff = (unsigned char*)(p)-(unsigned char*)(base);\
+               if (__diff & 3)\
+                       (p) += 4 - (__diff & 3);\
+       } while (0)
+
+static int
+compare_constants (const void *a, const void *b)
+{
+       const guint32 *a_values = (const guint32 *)a;
+       const guint32 *b_values = (const guint32 *)b;
+       return a_values [MONO_CONSTANT_PARENT] - b_values [MONO_CONSTANT_PARENT];
+}
+
+static int
+compare_semantics (const void *a, const void *b)
+{
+       const guint32 *a_values = (const guint32 *)a;
+       const guint32 *b_values = (const guint32 *)b;
+       int assoc = a_values [MONO_METHOD_SEMA_ASSOCIATION] - b_values [MONO_METHOD_SEMA_ASSOCIATION];
+       if (assoc)
+               return assoc;
+       return a_values [MONO_METHOD_SEMA_SEMANTICS] - b_values [MONO_METHOD_SEMA_SEMANTICS];
+}
+
+static int
+compare_custom_attrs (const void *a, const void *b)
+{
+       const guint32 *a_values = (const guint32 *)a;
+       const guint32 *b_values = (const guint32 *)b;
+
+       return a_values [MONO_CUSTOM_ATTR_PARENT] - b_values [MONO_CUSTOM_ATTR_PARENT];
+}
+
+static int
+compare_field_marshal (const void *a, const void *b)
+{
+       const guint32 *a_values = (const guint32 *)a;
+       const guint32 *b_values = (const guint32 *)b;
+
+       return a_values [MONO_FIELD_MARSHAL_PARENT] - b_values [MONO_FIELD_MARSHAL_PARENT];
+}
+
+static int
+compare_nested (const void *a, const void *b)
+{
+       const guint32 *a_values = (const guint32 *)a;
+       const guint32 *b_values = (const guint32 *)b;
+
+       return a_values [MONO_NESTED_CLASS_NESTED] - b_values [MONO_NESTED_CLASS_NESTED];
+}
+
+static int
+compare_genericparam (const void *a, const void *b)
+{
+       MonoError error;
+       const GenericParamTableEntry **a_entry = (const GenericParamTableEntry **) a;
+       const GenericParamTableEntry **b_entry = (const GenericParamTableEntry **) b;
+
+       if ((*b_entry)->owner == (*a_entry)->owner) {
+               MonoType *a_type = mono_reflection_type_get_handle ((MonoReflectionType*)(*a_entry)->gparam, &error);
+               mono_error_assert_ok (&error);
+               MonoType *b_type = mono_reflection_type_get_handle ((MonoReflectionType*)(*b_entry)->gparam, &error);
+               mono_error_assert_ok (&error);
+               return 
+                       mono_type_get_generic_param_num (a_type) -
+                       mono_type_get_generic_param_num (b_type);
+       } else
+               return (*a_entry)->owner - (*b_entry)->owner;
+}
+
+static int
+compare_declsecurity_attrs (const void *a, const void *b)
+{
+       const guint32 *a_values = (const guint32 *)a;
+       const guint32 *b_values = (const guint32 *)b;
+
+       return a_values [MONO_DECL_SECURITY_PARENT] - b_values [MONO_DECL_SECURITY_PARENT];
+}
+
+static int
+compare_interface_impl (const void *a, const void *b)
+{
+       const guint32 *a_values = (const guint32 *)a;
+       const guint32 *b_values = (const guint32 *)b;
+
+       int klass = a_values [MONO_INTERFACEIMPL_CLASS] - b_values [MONO_INTERFACEIMPL_CLASS];
+       if (klass)
+               return klass;
+
+       return a_values [MONO_INTERFACEIMPL_INTERFACE] - b_values [MONO_INTERFACEIMPL_INTERFACE];
+}
+
+struct StreamDesc {
+       const char *name;
+       MonoDynamicStream *stream;
+};
+
+/*
+ * build_compressed_metadata() fills in the blob of data that represents the 
+ * raw metadata as it will be saved in the PE file. The five streams are output 
+ * and the metadata tables are comnpressed from the guint32 array representation, 
+ * to the compressed on-disk format.
+ */
+static gboolean
+build_compressed_metadata (MonoDynamicImage *assembly, MonoError *error)
+{
+       MonoDynamicTable *table;
+       int i;
+       guint64 valid_mask = 0;
+       guint64 sorted_mask;
+       guint32 heapt_size = 0;
+       guint32 meta_size = 256; /* allow for header and other stuff */
+       guint32 table_offset;
+       guint32 ntables = 0;
+       guint64 *int64val;
+       guint32 *int32val;
+       guint16 *int16val;
+       MonoImage *meta;
+       unsigned char *p;
+       struct StreamDesc stream_desc [5];
+
+       mono_error_init (error);
+
+       qsort (assembly->gen_params->pdata, assembly->gen_params->len, sizeof (gpointer), compare_genericparam);
+       for (i = 0; i < assembly->gen_params->len; i++) {
+               GenericParamTableEntry *entry = (GenericParamTableEntry *)g_ptr_array_index (assembly->gen_params, i);
+               if (!write_generic_param_entry (assembly, entry, error))
+                       return FALSE;
+       }
+
+       stream_desc [0].name  = "#~";
+       stream_desc [0].stream = &assembly->tstream;
+       stream_desc [1].name  = "#Strings";
+       stream_desc [1].stream = &assembly->sheap;
+       stream_desc [2].name  = "#US";
+       stream_desc [2].stream = &assembly->us;
+       stream_desc [3].name  = "#Blob";
+       stream_desc [3].stream = &assembly->blob;
+       stream_desc [4].name  = "#GUID";
+       stream_desc [4].stream = &assembly->guid;
+       
+       /* tables that are sorted */
+       sorted_mask = ((guint64)1 << MONO_TABLE_CONSTANT) | ((guint64)1 << MONO_TABLE_FIELDMARSHAL)
+               | ((guint64)1 << MONO_TABLE_METHODSEMANTICS) | ((guint64)1 << MONO_TABLE_CLASSLAYOUT)
+               | ((guint64)1 << MONO_TABLE_FIELDLAYOUT) | ((guint64)1 << MONO_TABLE_FIELDRVA)
+               | ((guint64)1 << MONO_TABLE_IMPLMAP) | ((guint64)1 << MONO_TABLE_NESTEDCLASS)
+               | ((guint64)1 << MONO_TABLE_METHODIMPL) | ((guint64)1 << MONO_TABLE_CUSTOMATTRIBUTE)
+               | ((guint64)1 << MONO_TABLE_DECLSECURITY) | ((guint64)1 << MONO_TABLE_GENERICPARAM)
+               | ((guint64)1 << MONO_TABLE_INTERFACEIMPL);
+       
+       /* Compute table sizes */
+       /* the MonoImage has already been created in mono_reflection_dynimage_basic_init() */
+       meta = &assembly->image;
+
+       /* sizes should be multiple of 4 */
+       mono_dynstream_data_align (&assembly->blob);
+       mono_dynstream_data_align (&assembly->guid);
+       mono_dynstream_data_align (&assembly->sheap);
+       mono_dynstream_data_align (&assembly->us);
+
+       /* Setup the info used by compute_sizes () */
+       meta->idx_blob_wide = assembly->blob.index >= 65536 ? 1 : 0;
+       meta->idx_guid_wide = assembly->guid.index >= 65536 ? 1 : 0;
+       meta->idx_string_wide = assembly->sheap.index >= 65536 ? 1 : 0;
+
+       meta_size += assembly->blob.index;
+       meta_size += assembly->guid.index;
+       meta_size += assembly->sheap.index;
+       meta_size += assembly->us.index;
+
+       for (i=0; i < MONO_TABLE_NUM; ++i)
+               meta->tables [i].rows = assembly->tables [i].rows;
+       
+       for (i = 0; i < MONO_TABLE_NUM; i++){
+               if (meta->tables [i].rows == 0)
+                       continue;
+               valid_mask |= (guint64)1 << i;
+               ntables ++;
+               meta->tables [i].row_size = mono_metadata_compute_size (
+                       meta, i, &meta->tables [i].size_bitfield);
+               heapt_size += meta->tables [i].row_size * meta->tables [i].rows;
+       }
+       heapt_size += 24; /* #~ header size */
+       heapt_size += ntables * 4;
+       /* make multiple of 4 */
+       heapt_size += 3;
+       heapt_size &= ~3;
+       meta_size += heapt_size;
+       meta->raw_metadata = (char *)g_malloc0 (meta_size);
+       p = (unsigned char*)meta->raw_metadata;
+       /* the metadata signature */
+       *p++ = 'B'; *p++ = 'S'; *p++ = 'J'; *p++ = 'B';
+       /* version numbers and 4 bytes reserved */
+       int16val = (guint16*)p;
+       *int16val++ = GUINT16_TO_LE (meta->md_version_major);
+       *int16val = GUINT16_TO_LE (meta->md_version_minor);
+       p += 8;
+       /* version string */
+       int32val = (guint32*)p;
+       *int32val = GUINT32_TO_LE ((strlen (meta->version) + 3) & (~3)); /* needs to be multiple of 4 */
+       p += 4;
+       memcpy (p, meta->version, strlen (meta->version));
+       p += GUINT32_FROM_LE (*int32val);
+       align_pointer (meta->raw_metadata, p);
+       int16val = (guint16*)p;
+       *int16val++ = GUINT16_TO_LE (0); /* flags must be 0 */
+       *int16val = GUINT16_TO_LE (5); /* number of streams */
+       p += 4;
+
+       /*
+        * write the stream info.
+        */
+       table_offset = (p - (unsigned char*)meta->raw_metadata) + 5 * 8 + 40; /* room needed for stream headers */
+       table_offset += 3; table_offset &= ~3;
+
+       assembly->tstream.index = heapt_size;
+       for (i = 0; i < 5; ++i) {
+               int32val = (guint32*)p;
+               stream_desc [i].stream->offset = table_offset;
+               *int32val++ = GUINT32_TO_LE (table_offset);
+               *int32val = GUINT32_TO_LE (stream_desc [i].stream->index);
+               table_offset += GUINT32_FROM_LE (*int32val);
+               table_offset += 3; table_offset &= ~3;
+               p += 8;
+               strcpy ((char*)p, stream_desc [i].name);
+               p += strlen (stream_desc [i].name) + 1;
+               align_pointer (meta->raw_metadata, p);
+       }
+       /* 
+        * now copy the data, the table stream header and contents goes first.
+        */
+       g_assert ((p - (unsigned char*)meta->raw_metadata) < assembly->tstream.offset);
+       p = (guchar*)meta->raw_metadata + assembly->tstream.offset;
+       int32val = (guint32*)p;
+       *int32val = GUINT32_TO_LE (0); /* reserved */
+       p += 4;
+
+       *p++ = 2; /* version */
+       *p++ = 0;
+
+       if (meta->idx_string_wide)
+               *p |= 0x01;
+       if (meta->idx_guid_wide)
+               *p |= 0x02;
+       if (meta->idx_blob_wide)
+               *p |= 0x04;
+       ++p;
+       *p++ = 1; /* reserved */
+       int64val = (guint64*)p;
+       *int64val++ = GUINT64_TO_LE (valid_mask);
+       *int64val++ = GUINT64_TO_LE (valid_mask & sorted_mask); /* bitvector of sorted tables  */
+       p += 16;
+       int32val = (guint32*)p;
+       for (i = 0; i < MONO_TABLE_NUM; i++){
+               if (meta->tables [i].rows == 0)
+                       continue;
+               *int32val++ = GUINT32_TO_LE (meta->tables [i].rows);
+       }
+       p = (unsigned char*)int32val;
+
+       /* sort the tables that still need sorting */
+       table = &assembly->tables [MONO_TABLE_CONSTANT];
+       if (table->rows)
+               qsort (table->values + MONO_CONSTANT_SIZE, table->rows, sizeof (guint32) * MONO_CONSTANT_SIZE, compare_constants);
+       table = &assembly->tables [MONO_TABLE_METHODSEMANTICS];
+       if (table->rows)
+               qsort (table->values + MONO_METHOD_SEMA_SIZE, table->rows, sizeof (guint32) * MONO_METHOD_SEMA_SIZE, compare_semantics);
+       table = &assembly->tables [MONO_TABLE_CUSTOMATTRIBUTE];
+       if (table->rows)
+               qsort (table->values + MONO_CUSTOM_ATTR_SIZE, table->rows, sizeof (guint32) * MONO_CUSTOM_ATTR_SIZE, compare_custom_attrs);
+       table = &assembly->tables [MONO_TABLE_FIELDMARSHAL];
+       if (table->rows)
+               qsort (table->values + MONO_FIELD_MARSHAL_SIZE, table->rows, sizeof (guint32) * MONO_FIELD_MARSHAL_SIZE, compare_field_marshal);
+       table = &assembly->tables [MONO_TABLE_NESTEDCLASS];
+       if (table->rows)
+               qsort (table->values + MONO_NESTED_CLASS_SIZE, table->rows, sizeof (guint32) * MONO_NESTED_CLASS_SIZE, compare_nested);
+       /* Section 21.11 DeclSecurity in Partition II doesn't specify this to be sorted by MS implementation requires it */
+       table = &assembly->tables [MONO_TABLE_DECLSECURITY];
+       if (table->rows)
+               qsort (table->values + MONO_DECL_SECURITY_SIZE, table->rows, sizeof (guint32) * MONO_DECL_SECURITY_SIZE, compare_declsecurity_attrs);
+       table = &assembly->tables [MONO_TABLE_INTERFACEIMPL];
+       if (table->rows)
+               qsort (table->values + MONO_INTERFACEIMPL_SIZE, table->rows, sizeof (guint32) * MONO_INTERFACEIMPL_SIZE, compare_interface_impl);
+
+       /* compress the tables */
+       for (i = 0; i < MONO_TABLE_NUM; i++){
+               int row, col;
+               guint32 *values;
+               guint32 bitfield = meta->tables [i].size_bitfield;
+               if (!meta->tables [i].rows)
+                       continue;
+               if (assembly->tables [i].columns != mono_metadata_table_count (bitfield))
+                       g_error ("col count mismatch in %d: %d %d", i, assembly->tables [i].columns, mono_metadata_table_count (bitfield));
+               meta->tables [i].base = (char*)p;
+               for (row = 1; row <= meta->tables [i].rows; ++row) {
+                       values = assembly->tables [i].values + row * assembly->tables [i].columns;
+                       for (col = 0; col < assembly->tables [i].columns; ++col) {
+                               switch (mono_metadata_table_size (bitfield, col)) {
+                               case 1:
+                                       *p++ = values [col];
+                                       break;
+                               case 2:
+                                       *p++ = values [col] & 0xff;
+                                       *p++ = (values [col] >> 8) & 0xff;
+                                       break;
+                               case 4:
+                                       *p++ = values [col] & 0xff;
+                                       *p++ = (values [col] >> 8) & 0xff;
+                                       *p++ = (values [col] >> 16) & 0xff;
+                                       *p++ = (values [col] >> 24) & 0xff;
+                                       break;
+                               default:
+                                       g_assert_not_reached ();
+                               }
+                       }
+               }
+               g_assert ((p - (const unsigned char*)meta->tables [i].base) == (meta->tables [i].rows * meta->tables [i].row_size));
+       }
+       
+       g_assert (assembly->guid.offset + assembly->guid.index < meta_size);
+       memcpy (meta->raw_metadata + assembly->sheap.offset, assembly->sheap.data, assembly->sheap.index);
+       memcpy (meta->raw_metadata + assembly->us.offset, assembly->us.data, assembly->us.index);
+       memcpy (meta->raw_metadata + assembly->blob.offset, assembly->blob.data, assembly->blob.index);
+       memcpy (meta->raw_metadata + assembly->guid.offset, assembly->guid.data, assembly->guid.index);
+
+       assembly->meta_size = assembly->guid.offset + assembly->guid.index;
+
+       return TRUE;
+}
+
+/*
+ * Some tables in metadata need to be sorted according to some criteria, but
+ * when methods and fields are first created with reflection, they may be assigned a token
+ * that doesn't correspond to the final token they will get assigned after the sorting.
+ * ILGenerator.cs keeps a fixup table that maps the position of tokens in the IL code stream
+ * with the reflection objects that represent them. Once all the tables are set up, the 
+ * reflection objects will contains the correct table index. fixup_method() will fixup the
+ * tokens for the method with ILGenerator @ilgen.
+ */
+static void
+fixup_method (MonoReflectionILGen *ilgen, gpointer value, MonoDynamicImage *assembly)
+{
+       guint32 code_idx = GPOINTER_TO_UINT (value);
+       MonoReflectionILTokenInfo *iltoken;
+       MonoReflectionTypeBuilder *tb;
+       MonoReflectionArrayMethod *am;
+       guint32 i, idx = 0;
+       unsigned char *target;
+
+       for (i = 0; i < ilgen->num_token_fixups; ++i) {
+               iltoken = (MonoReflectionILTokenInfo *)mono_array_addr_with_size (ilgen->token_fixups, sizeof (MonoReflectionILTokenInfo), i);
+               target = (guchar*)assembly->code.data + code_idx + iltoken->code_pos;
+               switch (target [3]) {
+               case MONO_TABLE_FIELD:
+                       if (!strcmp (iltoken->member->vtable->klass->name, "FieldBuilder")) {
+                               g_assert_not_reached ();
+                       } else if (!strcmp (iltoken->member->vtable->klass->name, "MonoField")) {
+                               MonoClassField *f = ((MonoReflectionField*)iltoken->member)->field;
+                               idx = GPOINTER_TO_UINT (g_hash_table_lookup (assembly->field_to_table_idx, f));
+                       } else {
+                               g_assert_not_reached ();
+                       }
+                       break;
+               case MONO_TABLE_METHOD:
+                       if (!strcmp (iltoken->member->vtable->klass->name, "MethodBuilder")) {
+                               g_assert_not_reached ();
+                       } else if (!strcmp (iltoken->member->vtable->klass->name, "ConstructorBuilder")) {
+                               g_assert_not_reached ();
+                       } else if (!strcmp (iltoken->member->vtable->klass->name, "MonoMethod") || 
+                                          !strcmp (iltoken->member->vtable->klass->name, "MonoCMethod")) {
+                               MonoMethod *m = ((MonoReflectionMethod*)iltoken->member)->method;
+                               idx = GPOINTER_TO_UINT (g_hash_table_lookup (assembly->method_to_table_idx, m));
+                       } else {
+                               g_assert_not_reached ();
+                       }
+                       break;
+               case MONO_TABLE_TYPEDEF:
+                       if (!strcmp (iltoken->member->vtable->klass->name, "TypeBuilder")) {
+                               g_assert_not_reached ();
+                       } else if (!strcmp (iltoken->member->vtable->klass->name, "RuntimeType")) {
+                               MonoClass *k = mono_class_from_mono_type (((MonoReflectionType*)iltoken->member)->type);
+                               MonoObject *obj = mono_class_get_ref_info (k);
+                               g_assert (obj);
+                               g_assert (!strcmp (obj->vtable->klass->name, "TypeBuilder"));
+                               tb = (MonoReflectionTypeBuilder*)obj;
+                               idx = tb->table_idx;
+                       } else {
+                               g_assert_not_reached ();
+                       }
+                       break;
+               case MONO_TABLE_MEMBERREF:
+                       if (!strcmp (iltoken->member->vtable->klass->name, "MonoArrayMethod")) {
+                               am = (MonoReflectionArrayMethod*)iltoken->member;
+                               idx = am->table_idx;
+                       } else if (!strcmp (iltoken->member->vtable->klass->name, "MonoMethod") ||
+                                          !strcmp (iltoken->member->vtable->klass->name, "MonoCMethod")) {
+                               MonoMethod *m = ((MonoReflectionMethod*)iltoken->member)->method;
+                               g_assert (mono_class_is_ginst (m->klass) || mono_class_is_gtd (m->klass));
+                               continue;
+                       } else if (!strcmp (iltoken->member->vtable->klass->name, "FieldBuilder")) {
+                               g_assert_not_reached ();
+                               continue;
+                       } else if (!strcmp (iltoken->member->vtable->klass->name, "MonoField")) {
+                               continue;
+                       } else if (!strcmp (iltoken->member->vtable->klass->name, "MethodBuilder") ||
+                                       !strcmp (iltoken->member->vtable->klass->name, "ConstructorBuilder")) {
+                               g_assert_not_reached ();
+                               continue;
+                       } else if (!strcmp (iltoken->member->vtable->klass->name, "FieldOnTypeBuilderInst")) {
+                               g_assert_not_reached ();
+                               continue;
+                       } else if (!strcmp (iltoken->member->vtable->klass->name, "MethodOnTypeBuilderInst")) {
+                               g_assert_not_reached ();
+                               continue;
+                       } else if (!strcmp (iltoken->member->vtable->klass->name, "ConstructorOnTypeBuilderInst")) {
+                               g_assert_not_reached ();
+                               continue;
+                       } else {
+                               g_assert_not_reached ();
+                       }
+                       break;
+               case MONO_TABLE_METHODSPEC:
+                       if (!strcmp (iltoken->member->vtable->klass->name, "MonoMethod")) {
+                               MonoMethod *m = ((MonoReflectionMethod*)iltoken->member)->method;
+                               g_assert (mono_method_signature (m)->generic_param_count);
+                               continue;
+                       } else if (!strcmp (iltoken->member->vtable->klass->name, "MethodBuilder")) {
+                               g_assert_not_reached ();
+                               continue;
+                       } else if (!strcmp (iltoken->member->vtable->klass->name, "MethodOnTypeBuilderInst")) {
+                               g_assert_not_reached ();
+                               continue;
+                       } else {
+                               g_assert_not_reached ();
+                       }
+                       break;
+               case MONO_TABLE_TYPESPEC:
+                       if (!strcmp (iltoken->member->vtable->klass->name, "RuntimeType")) {
+                               continue;
+                       } else {
+                               g_assert_not_reached ();
+                       }
+                       break;
+               default:
+                       g_error ("got unexpected table 0x%02x in fixup", target [3]);
+               }
+               target [0] = idx & 0xff;
+               target [1] = (idx >> 8) & 0xff;
+               target [2] = (idx >> 16) & 0xff;
+       }
+}
+
+/*
+ * fixup_cattrs:
+ *
+ *   The CUSTOM_ATTRIBUTE table might contain METHODDEF tokens whose final
+ * value is not known when the table is emitted.
+ */
+static void
+fixup_cattrs (MonoDynamicImage *assembly)
+{
+       MonoDynamicTable *table;
+       guint32 *values;
+       guint32 type, i, idx, token;
+       MonoObject *ctor;
+
+       table = &assembly->tables [MONO_TABLE_CUSTOMATTRIBUTE];
+
+       for (i = 0; i < table->rows; ++i) {
+               values = table->values + ((i + 1) * MONO_CUSTOM_ATTR_SIZE);
+
+               type = values [MONO_CUSTOM_ATTR_TYPE];
+               if ((type & MONO_CUSTOM_ATTR_TYPE_MASK) == MONO_CUSTOM_ATTR_TYPE_METHODDEF) {
+                       idx = type >> MONO_CUSTOM_ATTR_TYPE_BITS;
+                       token = mono_metadata_make_token (MONO_TABLE_METHOD, idx);
+                       ctor = (MonoObject *)mono_g_hash_table_lookup (assembly->remapped_tokens, GUINT_TO_POINTER (token));
+                       g_assert (ctor);
+
+                       if (!strcmp (ctor->vtable->klass->name, "MonoCMethod")) {
+                               MonoMethod *m = ((MonoReflectionMethod*)ctor)->method;
+                               idx = GPOINTER_TO_UINT (g_hash_table_lookup (assembly->method_to_table_idx, m));
+                               values [MONO_CUSTOM_ATTR_TYPE] = (idx << MONO_CUSTOM_ATTR_TYPE_BITS) | MONO_CUSTOM_ATTR_TYPE_METHODDEF;
+                       } else if (!strcmp (ctor->vtable->klass->name, "ConstructorBuilder")) {
+                               MonoMethod *m = ((MonoReflectionCtorBuilder*)ctor)->mhandle;
+                               idx = GPOINTER_TO_UINT (g_hash_table_lookup (assembly->method_to_table_idx, m));
+                               values [MONO_CUSTOM_ATTR_TYPE] = (idx << MONO_CUSTOM_ATTR_TYPE_BITS) | MONO_CUSTOM_ATTR_TYPE_METHODDEF;
+                       }
+               }
+       }
+}
+
+static gboolean
+assembly_add_resource_manifest (MonoReflectionModuleBuilder *mb, MonoDynamicImage *assembly, MonoReflectionResource *rsrc, guint32 implementation, MonoError *error)
+{
+       MonoDynamicTable *table;
+       guint32 *values;
+
+       mono_error_init (error);
+
+       table = &assembly->tables [MONO_TABLE_MANIFESTRESOURCE];
+       table->rows++;
+       alloc_table (table, table->rows);
+       values = table->values + table->next_idx * MONO_MANIFEST_SIZE;
+       values [MONO_MANIFEST_OFFSET] = rsrc->offset;
+       values [MONO_MANIFEST_FLAGS] = rsrc->attrs;
+       values [MONO_MANIFEST_NAME] = string_heap_insert_mstring (&assembly->sheap, rsrc->name, error);
+       return_val_if_nok (error, FALSE);
+       values [MONO_MANIFEST_IMPLEMENTATION] = implementation;
+       table->next_idx++;
+       return TRUE;
+}
+
+static gboolean
+assembly_add_resource (MonoReflectionModuleBuilder *mb, MonoDynamicImage *assembly, MonoReflectionResource *rsrc, MonoError *error)
+{
+       MonoDynamicTable *table;
+       guint32 *values;
+       char blob_size [6];
+       guchar hash [20];
+       char *b = blob_size;
+       char *name, *sname;
+       guint32 idx, offset;
+
+       mono_error_init (error);
+
+       if (rsrc->filename) {
+               name = mono_string_to_utf8_checked (rsrc->filename, error);
+               return_val_if_nok (error, FALSE);
+               sname = g_path_get_basename (name);
+       
+               table = &assembly->tables [MONO_TABLE_FILE];
+               table->rows++;
+               alloc_table (table, table->rows);
+               values = table->values + table->next_idx * MONO_FILE_SIZE;
+               values [MONO_FILE_FLAGS] = FILE_CONTAINS_NO_METADATA;
+               values [MONO_FILE_NAME] = string_heap_insert (&assembly->sheap, sname);
+               g_free (sname);
+
+               mono_sha1_get_digest_from_file (name, hash);
+               mono_metadata_encode_value (20, b, &b);
+               values [MONO_FILE_HASH_VALUE] = mono_image_add_stream_data (&assembly->blob, blob_size, b-blob_size);
+               mono_image_add_stream_data (&assembly->blob, (char*)hash, 20);
+               g_free (name);
+               idx = table->next_idx++;
+               rsrc->offset = 0;
+               idx = MONO_IMPLEMENTATION_FILE | (idx << MONO_IMPLEMENTATION_BITS);
+       } else {
+               char sizebuf [4];
+               char *data;
+               guint len;
+               if (rsrc->data) {
+                       data = mono_array_addr (rsrc->data, char, 0);
+                       len = mono_array_length (rsrc->data);
+               } else {
+                       data = NULL;
+                       len = 0;
+               }
+               offset = len;
+               sizebuf [0] = offset; sizebuf [1] = offset >> 8;
+               sizebuf [2] = offset >> 16; sizebuf [3] = offset >> 24;
+               rsrc->offset = mono_image_add_stream_data (&assembly->resources, sizebuf, 4);
+               mono_image_add_stream_data (&assembly->resources, data, len);
+
+               if (!mb->is_main)
+                       /* 
+                        * The entry should be emitted into the MANIFESTRESOURCE table of 
+                        * the main module, but that needs to reference the FILE table
+                        * which isn't emitted yet.
+                        */
+                       return TRUE;
+               else
+                       idx = 0;
+       }
+
+       return assembly_add_resource_manifest (mb, assembly, rsrc, idx, error);
+}
+
+static gboolean
+set_version_from_string (MonoString *version, guint32 *values, MonoError *error)
+{
+       gchar *ver, *p, *str;
+       guint32 i;
+       
+       mono_error_init (error);
+
+       values [MONO_ASSEMBLY_MAJOR_VERSION] = 0;
+       values [MONO_ASSEMBLY_MINOR_VERSION] = 0;
+       values [MONO_ASSEMBLY_REV_NUMBER] = 0;
+       values [MONO_ASSEMBLY_BUILD_NUMBER] = 0;
+       if (!version)
+               return TRUE;
+       ver = str = mono_string_to_utf8_checked (version, error);
+       return_val_if_nok (error, FALSE);
+       for (i = 0; i < 4; ++i) {
+               values [MONO_ASSEMBLY_MAJOR_VERSION + i] = strtol (ver, &p, 10);
+               switch (*p) {
+               case '.':
+                       p++;
+                       break;
+               case '*':
+                       /* handle Revision and Build */
+                       p++;
+                       break;
+               }
+               ver = p;
+       }
+       g_free (str);
+       return TRUE;
+}
+
+static guint32
+load_public_key (MonoArray *pkey, MonoDynamicImage *assembly) {
+       gsize len;
+       guint32 token = 0;
+       char blob_size [6];
+       char *b = blob_size;
+
+       if (!pkey)
+               return token;
+
+       len = mono_array_length (pkey);
+       mono_metadata_encode_value (len, b, &b);
+       token = mono_image_add_stream_data (&assembly->blob, blob_size, b - blob_size);
+       mono_image_add_stream_data (&assembly->blob, mono_array_addr (pkey, char, 0), len);
+
+       assembly->public_key = (guint8 *)g_malloc (len);
+       memcpy (assembly->public_key, mono_array_addr (pkey, char, 0), len);
+       assembly->public_key_len = len;
+
+       /* Special case: check for ECMA key (16 bytes) */
+       if ((len == MONO_ECMA_KEY_LENGTH) && mono_is_ecma_key (mono_array_addr (pkey, char, 0), len)) {
+               /* In this case we must reserve 128 bytes (1024 bits) for the signature */
+               assembly->strong_name_size = MONO_DEFAULT_PUBLIC_KEY_LENGTH;
+       } else if (len >= MONO_PUBLIC_KEY_HEADER_LENGTH + MONO_MINIMUM_PUBLIC_KEY_LENGTH) {
+               /* minimum key size (in 2.0) is 384 bits */
+               assembly->strong_name_size = len - MONO_PUBLIC_KEY_HEADER_LENGTH;
+       } else {
+               /* FIXME - verifier */
+               g_warning ("Invalid public key length: %d bits (total: %d)", (int)MONO_PUBLIC_KEY_BIT_SIZE (len), (int)len);
+               assembly->strong_name_size = MONO_DEFAULT_PUBLIC_KEY_LENGTH; /* to be safe */
+       }
+       assembly->strong_name = (char *)g_malloc0 (assembly->strong_name_size);
+
+       return token;
+}
+
+static gboolean
+mono_image_emit_manifest (MonoReflectionModuleBuilder *moduleb, MonoError *error)
+{
+       MonoDynamicTable *table;
+       MonoDynamicImage *assembly;
+       MonoReflectionAssemblyBuilder *assemblyb;
+       MonoDomain *domain;
+       guint32 *values;
+       int i;
+       guint32 module_index;
+
+       mono_error_init (error);
+
+       assemblyb = moduleb->assemblyb;
+       assembly = moduleb->dynamic_image;
+       domain = mono_object_domain (assemblyb);
+
+       /* Emit ASSEMBLY table */
+       table = &assembly->tables [MONO_TABLE_ASSEMBLY];
+       alloc_table (table, 1);
+       values = table->values + MONO_ASSEMBLY_SIZE;
+       values [MONO_ASSEMBLY_HASH_ALG] = assemblyb->algid? assemblyb->algid: ASSEMBLY_HASH_SHA1;
+       values [MONO_ASSEMBLY_NAME] = string_heap_insert_mstring (&assembly->sheap, assemblyb->name, error);
+       return_val_if_nok (error, FALSE);
+       if (assemblyb->culture) {
+               values [MONO_ASSEMBLY_CULTURE] = string_heap_insert_mstring (&assembly->sheap, assemblyb->culture, error);
+               return_val_if_nok (error, FALSE);
+       } else {
+               values [MONO_ASSEMBLY_CULTURE] = string_heap_insert (&assembly->sheap, "");
+       }
+       values [MONO_ASSEMBLY_PUBLIC_KEY] = load_public_key (assemblyb->public_key, assembly);
+       values [MONO_ASSEMBLY_FLAGS] = assemblyb->flags;
+       if (!set_version_from_string (assemblyb->version, values, error))
+               return FALSE;
+
+       /* Emit FILE + EXPORTED_TYPE table */
+       module_index = 0;
+       for (i = 0; i < mono_array_length (assemblyb->modules); ++i) {
+               int j;
+               MonoReflectionModuleBuilder *file_module = 
+                       mono_array_get (assemblyb->modules, MonoReflectionModuleBuilder*, i);
+               if (file_module != moduleb) {
+                       if (!mono_image_fill_file_table (domain, (MonoReflectionModule*)file_module, assembly, error))
+                               return FALSE;
+                       module_index ++;
+                       if (file_module->types) {
+                               for (j = 0; j < file_module->num_types; ++j) {
+                                       MonoReflectionTypeBuilder *tb = mono_array_get (file_module->types, MonoReflectionTypeBuilder*, j);
+                                       mono_image_fill_export_table (domain, tb, module_index, 0, assembly, error);
+                                       return_val_if_nok (error, FALSE);
+                               }
+                       }
+               }
+       }
+       if (assemblyb->loaded_modules) {
+               for (i = 0; i < mono_array_length (assemblyb->loaded_modules); ++i) {
+                       MonoReflectionModule *file_module = 
+                               mono_array_get (assemblyb->loaded_modules, MonoReflectionModule*, i);
+                       if (!mono_image_fill_file_table (domain, file_module, assembly, error))
+                               return FALSE;
+                       module_index ++;
+                       mono_image_fill_export_table_from_module (domain, file_module, module_index, assembly);
+               }
+       }
+       if (assemblyb->type_forwarders)
+               mono_image_fill_export_table_from_type_forwarders (assemblyb, assembly);
+
+       /* Emit MANIFESTRESOURCE table */
+       module_index = 0;
+       for (i = 0; i < mono_array_length (assemblyb->modules); ++i) {
+               int j;
+               MonoReflectionModuleBuilder *file_module = 
+                       mono_array_get (assemblyb->modules, MonoReflectionModuleBuilder*, i);
+               /* The table for the main module is emitted later */
+               if (file_module != moduleb) {
+                       module_index ++;
+                       if (file_module->resources) {
+                               int len = mono_array_length (file_module->resources);
+                               for (j = 0; j < len; ++j) {
+                                       MonoReflectionResource* res = (MonoReflectionResource*)mono_array_addr (file_module->resources, MonoReflectionResource, j);
+                                       if (!assembly_add_resource_manifest (file_module, assembly, res, MONO_IMPLEMENTATION_FILE | (module_index << MONO_IMPLEMENTATION_BITS), error))
+                                               return FALSE;
+                               }
+                       }
+               }
+       }
+       return TRUE;
+}
+
+#ifndef DISABLE_REFLECTION_EMIT_SAVE
+
+/*
+ * Insert into the metadata tables all the info about the TypeBuilder tb.
+ * Data in the tables is inserted in a predefined order, since some tables need to be sorted.
+ */
+static gboolean
+mono_image_get_type_info (MonoDomain *domain, MonoReflectionTypeBuilder *tb, MonoDynamicImage *assembly, MonoError *error)
+{
+       MonoDynamicTable *table;
+       guint *values;
+       int i, is_object = 0, is_system = 0;
+       char *n;
+
+       mono_error_init (error);
+
+       table = &assembly->tables [MONO_TABLE_TYPEDEF];
+       values = table->values + tb->table_idx * MONO_TYPEDEF_SIZE;
+       values [MONO_TYPEDEF_FLAGS] = tb->attrs;
+       n = mono_string_to_utf8_checked (tb->name, error);
+       return_val_if_nok (error, FALSE);
+       if (strcmp (n, "Object") == 0)
+               is_object++;
+       values [MONO_TYPEDEF_NAME] = string_heap_insert (&assembly->sheap, n);
+       g_free (n);
+       n = mono_string_to_utf8_checked (tb->nspace, error);
+       return_val_if_nok (error, FALSE);
+       if (strcmp (n, "System") == 0)
+               is_system++;
+       values [MONO_TYPEDEF_NAMESPACE] = string_heap_insert (&assembly->sheap, n);
+       g_free (n);
+       if (tb->parent && !(is_system && is_object) && 
+                       !(tb->attrs & TYPE_ATTRIBUTE_INTERFACE)) { /* interfaces don't have a parent */
+               MonoType *parent_type = mono_reflection_type_get_handle ((MonoReflectionType*)tb->parent, error);
+               return_val_if_nok (error, FALSE);
+               values [MONO_TYPEDEF_EXTENDS] = mono_image_typedef_or_ref (assembly, parent_type);
+       } else {
+               values [MONO_TYPEDEF_EXTENDS] = 0;
+       }
+       values [MONO_TYPEDEF_FIELD_LIST] = assembly->tables [MONO_TABLE_FIELD].next_idx;
+       values [MONO_TYPEDEF_METHOD_LIST] = assembly->tables [MONO_TABLE_METHOD].next_idx;
+
+       /*
+        * if we have explicitlayout or sequentiallayouts, output data in the
+        * ClassLayout table.
+        */
+       if (((tb->attrs & TYPE_ATTRIBUTE_LAYOUT_MASK) != TYPE_ATTRIBUTE_AUTO_LAYOUT) &&
+                       ((tb->class_size > 0) || (tb->packing_size > 0))) {
+               table = &assembly->tables [MONO_TABLE_CLASSLAYOUT];
+               table->rows++;
+               alloc_table (table, table->rows);
+               values = table->values + table->rows * MONO_CLASS_LAYOUT_SIZE;
+               values [MONO_CLASS_LAYOUT_PARENT] = tb->table_idx;
+               values [MONO_CLASS_LAYOUT_CLASS_SIZE] = tb->class_size;
+               values [MONO_CLASS_LAYOUT_PACKING_SIZE] = tb->packing_size;
+       }
+
+       /* handle interfaces */
+       if (tb->interfaces) {
+               table = &assembly->tables [MONO_TABLE_INTERFACEIMPL];
+               i = table->rows;
+               table->rows += mono_array_length (tb->interfaces);
+               alloc_table (table, table->rows);
+               values = table->values + (i + 1) * MONO_INTERFACEIMPL_SIZE;
+               for (i = 0; i < mono_array_length (tb->interfaces); ++i) {
+                       MonoReflectionType* iface = (MonoReflectionType*) mono_array_get (tb->interfaces, gpointer, i);
+                       MonoType *iface_type = mono_reflection_type_get_handle (iface, error);
+                       return_val_if_nok (error, FALSE);
+                       values [MONO_INTERFACEIMPL_CLASS] = tb->table_idx;
+                       values [MONO_INTERFACEIMPL_INTERFACE] = mono_image_typedef_or_ref (assembly, iface_type);
+                       values += MONO_INTERFACEIMPL_SIZE;
+               }
+       }
+
+       /* handle fields */
+       if (tb->fields) {
+               table = &assembly->tables [MONO_TABLE_FIELD];
+               table->rows += tb->num_fields;
+               alloc_table (table, table->rows);
+               for (i = 0; i < tb->num_fields; ++i) {
+                       mono_image_get_field_info (
+                               mono_array_get (tb->fields, MonoReflectionFieldBuilder*, i), assembly, error);
+                       return_val_if_nok (error, FALSE);
+               }
+       }
+
+       /* handle constructors */
+       if (tb->ctors) {
+               table = &assembly->tables [MONO_TABLE_METHOD];
+               table->rows += mono_array_length (tb->ctors);
+               alloc_table (table, table->rows);
+               for (i = 0; i < mono_array_length (tb->ctors); ++i) {
+                       if (!mono_image_get_ctor_info (domain,
+                                                      mono_array_get (tb->ctors, MonoReflectionCtorBuilder*, i),
+                                                      assembly, error))
+                               return FALSE;
+               }
+       }
+
+       /* handle methods */
+       if (tb->methods) {
+               table = &assembly->tables [MONO_TABLE_METHOD];
+               table->rows += tb->num_methods;
+               alloc_table (table, table->rows);
+               for (i = 0; i < tb->num_methods; ++i) {
+                       if (!mono_image_get_method_info (
+                                   mono_array_get (tb->methods, MonoReflectionMethodBuilder*, i), assembly, error))
+                               return FALSE;
+               }
+       }
+
+       /* Do the same with properties etc.. */
+       if (tb->events && mono_array_length (tb->events)) {
+               table = &assembly->tables [MONO_TABLE_EVENT];
+               table->rows += mono_array_length (tb->events);
+               alloc_table (table, table->rows);
+               table = &assembly->tables [MONO_TABLE_EVENTMAP];
+               table->rows ++;
+               alloc_table (table, table->rows);
+               values = table->values + table->rows * MONO_EVENT_MAP_SIZE;
+               values [MONO_EVENT_MAP_PARENT] = tb->table_idx;
+               values [MONO_EVENT_MAP_EVENTLIST] = assembly->tables [MONO_TABLE_EVENT].next_idx;
+               for (i = 0; i < mono_array_length (tb->events); ++i) {
+                       mono_image_get_event_info (
+                               mono_array_get (tb->events, MonoReflectionEventBuilder*, i), assembly, error);
+                       return_val_if_nok (error, FALSE);
+               }
+       }
+       if (tb->properties && mono_array_length (tb->properties)) {
+               table = &assembly->tables [MONO_TABLE_PROPERTY];
+               table->rows += mono_array_length (tb->properties);
+               alloc_table (table, table->rows);
+               table = &assembly->tables [MONO_TABLE_PROPERTYMAP];
+               table->rows ++;
+               alloc_table (table, table->rows);
+               values = table->values + table->rows * MONO_PROPERTY_MAP_SIZE;
+               values [MONO_PROPERTY_MAP_PARENT] = tb->table_idx;
+               values [MONO_PROPERTY_MAP_PROPERTY_LIST] = assembly->tables [MONO_TABLE_PROPERTY].next_idx;
+               for (i = 0; i < mono_array_length (tb->properties); ++i) {
+                       mono_image_get_property_info (
+                               mono_array_get (tb->properties, MonoReflectionPropertyBuilder*, i), assembly, error);
+                       return_val_if_nok (error, FALSE);
+               }
+       }
+
+       /* handle generic parameters */
+       if (tb->generic_params) {
+               table = &assembly->tables [MONO_TABLE_GENERICPARAM];
+               table->rows += mono_array_length (tb->generic_params);
+               alloc_table (table, table->rows);
+               for (i = 0; i < mono_array_length (tb->generic_params); ++i) {
+                       guint32 owner = MONO_TYPEORMETHOD_TYPE | (tb->table_idx << MONO_TYPEORMETHOD_BITS);
+
+                       mono_image_get_generic_param_info (
+                               mono_array_get (tb->generic_params, MonoReflectionGenericParam*, i), owner, assembly);
+               }
+       }
+
+       mono_image_add_decl_security (assembly, 
+               mono_metadata_make_token (MONO_TABLE_TYPEDEF, tb->table_idx), tb->permissions);
+
+       if (tb->subtypes) {
+               MonoDynamicTable *ntable;
+               
+               ntable = &assembly->tables [MONO_TABLE_NESTEDCLASS];
+               ntable->rows += mono_array_length (tb->subtypes);
+               alloc_table (ntable, ntable->rows);
+               values = ntable->values + ntable->next_idx * MONO_NESTED_CLASS_SIZE;
+
+               for (i = 0; i < mono_array_length (tb->subtypes); ++i) {
+                       MonoReflectionTypeBuilder *subtype = mono_array_get (tb->subtypes, MonoReflectionTypeBuilder*, i);
+
+                       values [MONO_NESTED_CLASS_NESTED] = subtype->table_idx;
+                       values [MONO_NESTED_CLASS_ENCLOSING] = tb->table_idx;
+                       /*g_print ("nesting %s (%d) in %s (%d) (rows %d/%d)\n",
+                               mono_string_to_utf8 (subtype->name), subtype->table_idx,
+                               mono_string_to_utf8 (tb->name), tb->table_idx,
+                               ntable->next_idx, ntable->rows);*/
+                       values += MONO_NESTED_CLASS_SIZE;
+                       ntable->next_idx++;
+               }
+       }
+
+       return TRUE;
+}
+
+
+/*
+ * mono_image_build_metadata() will fill the info in all the needed metadata tables
+ * for the modulebuilder @moduleb.
+ * At the end of the process, method and field tokens are fixed up and the 
+ * on-disk compressed metadata representation is created.
+ * Return TRUE on success, or FALSE on failure and sets @error
+ */
+gboolean
+mono_image_build_metadata (MonoReflectionModuleBuilder *moduleb, MonoError *error)
+{
+       MonoDynamicTable *table;
+       MonoDynamicImage *assembly;
+       MonoReflectionAssemblyBuilder *assemblyb;
+       MonoDomain *domain;
+       MonoPtrArray types;
+       guint32 *values;
+       int i, j;
+
+       mono_error_init (error);
+
+       assemblyb = moduleb->assemblyb;
+       assembly = moduleb->dynamic_image;
+       domain = mono_object_domain (assemblyb);
+
+       if (assembly->text_rva)
+               return TRUE;
+
+       assembly->text_rva = START_TEXT_RVA;
+
+       if (moduleb->is_main) {
+               mono_image_emit_manifest (moduleb, error);
+               return_val_if_nok (error, FALSE);
+       }
+
+       table = &assembly->tables [MONO_TABLE_TYPEDEF];
+       table->rows = 1; /* .<Module> */
+       table->next_idx++;
+       alloc_table (table, table->rows);
+       /*
+        * Set the first entry.
+        */
+       values = table->values + table->columns;
+       values [MONO_TYPEDEF_FLAGS] = 0;
+       values [MONO_TYPEDEF_NAME] = string_heap_insert (&assembly->sheap, "<Module>") ;
+       values [MONO_TYPEDEF_NAMESPACE] = string_heap_insert (&assembly->sheap, "") ;
+       values [MONO_TYPEDEF_EXTENDS] = 0;
+       values [MONO_TYPEDEF_FIELD_LIST] = 1;
+       values [MONO_TYPEDEF_METHOD_LIST] = 1;
+
+       /* 
+        * handle global methods 
+        * FIXME: test what to do when global methods are defined in multiple modules.
+        */
+       if (moduleb->global_methods) {
+               table = &assembly->tables [MONO_TABLE_METHOD];
+               table->rows += mono_array_length (moduleb->global_methods);
+               alloc_table (table, table->rows);
+               for (i = 0; i < mono_array_length (moduleb->global_methods); ++i) {
+                       if (!mono_image_get_method_info (
+                                   mono_array_get (moduleb->global_methods, MonoReflectionMethodBuilder*, i), assembly, error))
+                               goto leave;
+               }
+       }
+       if (moduleb->global_fields) {
+               table = &assembly->tables [MONO_TABLE_FIELD];
+               table->rows += mono_array_length (moduleb->global_fields);
+               alloc_table (table, table->rows);
+               for (i = 0; i < mono_array_length (moduleb->global_fields); ++i) {
+                       mono_image_get_field_info (
+                               mono_array_get (moduleb->global_fields, MonoReflectionFieldBuilder*, i), assembly,
+                               error);
+                       if (!is_ok (error))
+                               goto leave;
+               }
+       }
+
+       table = &assembly->tables [MONO_TABLE_MODULE];
+       alloc_table (table, 1);
+       mono_image_fill_module_table (domain, moduleb, assembly, error);
+       if (!is_ok (error))
+               goto leave;
+
+       /* Collect all types into a list sorted by their table_idx */
+       mono_ptr_array_init (types, moduleb->num_types, MONO_ROOT_SOURCE_REFLECTION, "dynamic module types list");
+
+       if (moduleb->types)
+               for (i = 0; i < moduleb->num_types; ++i) {
+                       MonoReflectionTypeBuilder *type = mono_array_get (moduleb->types, MonoReflectionTypeBuilder*, i);
+                       collect_types (&types, type);
+               }
+
+       mono_ptr_array_sort (types, (int (*)(const void *, const void *))compare_types_by_table_idx);
+       table = &assembly->tables [MONO_TABLE_TYPEDEF];
+       table->rows += mono_ptr_array_size (types);
+       alloc_table (table, table->rows);
+
+       /*
+        * Emit type names + namespaces at one place inside the string heap,
+        * so load_class_names () needs to touch fewer pages.
+        */
+       for (i = 0; i < mono_ptr_array_size (types); ++i) {
+               MonoReflectionTypeBuilder *tb = (MonoReflectionTypeBuilder *)mono_ptr_array_get (types, i);
+               string_heap_insert_mstring (&assembly->sheap, tb->nspace, error);
+               if (!is_ok (error))
+                       goto leave_types;
+       }
+       for (i = 0; i < mono_ptr_array_size (types); ++i) {
+               MonoReflectionTypeBuilder *tb = (MonoReflectionTypeBuilder *)mono_ptr_array_get (types, i);
+               string_heap_insert_mstring (&assembly->sheap, tb->name, error);
+               if (!is_ok (error))
+                       goto leave_types;
+       }
+
+       for (i = 0; i < mono_ptr_array_size (types); ++i) {
+               MonoReflectionTypeBuilder *type = (MonoReflectionTypeBuilder *)mono_ptr_array_get (types, i);
+               if (!mono_image_get_type_info (domain, type, assembly, error))
+                       goto leave_types;
+       }
+
+       /* 
+        * table->rows is already set above and in mono_image_fill_module_table.
+        */
+       /* add all the custom attributes at the end, once all the indexes are stable */
+       if (!mono_image_add_cattrs (assembly, 1, MONO_CUSTOM_ATTR_ASSEMBLY, assemblyb->cattrs, error))
+               goto leave_types;
+
+       /* CAS assembly permissions */
+       if (assemblyb->permissions_minimum)
+               mono_image_add_decl_security (assembly, mono_metadata_make_token (MONO_TABLE_ASSEMBLY, 1), assemblyb->permissions_minimum);
+       if (assemblyb->permissions_optional)
+               mono_image_add_decl_security (assembly, mono_metadata_make_token (MONO_TABLE_ASSEMBLY, 1), assemblyb->permissions_optional);
+       if (assemblyb->permissions_refused)
+               mono_image_add_decl_security (assembly, mono_metadata_make_token (MONO_TABLE_ASSEMBLY, 1), assemblyb->permissions_refused);
+
+       if (!module_add_cattrs (assembly, moduleb, error))
+               goto leave_types;
+
+       /* fixup tokens */
+       mono_g_hash_table_foreach (assembly->token_fixups, (GHFunc)fixup_method, assembly);
+
+       /* Create the MethodImpl table.  We do this after emitting all methods so we already know
+        * the final tokens and don't need another fixup pass. */
+
+       if (moduleb->global_methods) {
+               for (i = 0; i < mono_array_length (moduleb->global_methods); ++i) {
+                       MonoReflectionMethodBuilder *mb = mono_array_get (
+                               moduleb->global_methods, MonoReflectionMethodBuilder*, i);
+                       if (!mono_image_add_methodimpl (assembly, mb, error))
+                               goto leave_types;
+               }
+       }
+
+       for (i = 0; i < mono_ptr_array_size (types); ++i) {
+               MonoReflectionTypeBuilder *type = (MonoReflectionTypeBuilder *)mono_ptr_array_get (types, i);
+               if (type->methods) {
+                       for (j = 0; j < type->num_methods; ++j) {
+                               MonoReflectionMethodBuilder *mb = mono_array_get (
+                                       type->methods, MonoReflectionMethodBuilder*, j);
+
+                               if (!mono_image_add_methodimpl (assembly, mb, error))
+                                       goto leave_types;
+                       }
+               }
+       }
+
+       fixup_cattrs (assembly);
+
+leave_types:
+       mono_ptr_array_destroy (types);
+leave:
+
+       return mono_error_ok (error);
+}
+
+#else /* DISABLE_REFLECTION_EMIT_SAVE */
+
+gboolean
+mono_image_build_metadata (MonoReflectionModuleBuilder *moduleb, MonoError *error)
+{
+       g_error ("This mono runtime was configured with --enable-minimal=reflection_emit_save, so saving of dynamic assemblies is not supported.");
+}
+
+#endif /* DISABLE_REFLECTION_EMIT_SAVE */
+
+#ifndef DISABLE_REFLECTION_EMIT_SAVE
+
+static int
+calc_section_size (MonoDynamicImage *assembly)
+{
+       int nsections = 0;
+
+       /* alignment constraints */
+       mono_image_add_stream_zero (&assembly->code, 4 - (assembly->code.index % 4));
+       g_assert ((assembly->code.index % 4) == 0);
+       assembly->meta_size += 3;
+       assembly->meta_size &= ~3;
+       mono_image_add_stream_zero (&assembly->resources, 4 - (assembly->resources.index % 4));
+       g_assert ((assembly->resources.index % 4) == 0);
+
+       assembly->sections [MONO_SECTION_TEXT].size = assembly->meta_size + assembly->code.index + assembly->resources.index + assembly->strong_name_size;
+       assembly->sections [MONO_SECTION_TEXT].attrs = SECT_FLAGS_HAS_CODE | SECT_FLAGS_MEM_EXECUTE | SECT_FLAGS_MEM_READ;
+       nsections++;
+
+       if (assembly->win32_res) {
+               guint32 res_size = (assembly->win32_res_size + 3) & ~3;
+
+               assembly->sections [MONO_SECTION_RSRC].size = res_size;
+               assembly->sections [MONO_SECTION_RSRC].attrs = SECT_FLAGS_HAS_INITIALIZED_DATA | SECT_FLAGS_MEM_READ;
+               nsections++;
+       }
+
+       assembly->sections [MONO_SECTION_RELOC].size = 12;
+       assembly->sections [MONO_SECTION_RELOC].attrs = SECT_FLAGS_MEM_READ | SECT_FLAGS_MEM_DISCARDABLE | SECT_FLAGS_HAS_INITIALIZED_DATA;
+       nsections++;
+
+       return nsections;
+}
+
+typedef struct {
+       guint32 id;
+       guint32 offset;
+       GSList *children;
+       MonoReflectionWin32Resource *win32_res; /* Only for leaf nodes */
+} ResTreeNode;
+
+static int
+resource_tree_compare_by_id (gconstpointer a, gconstpointer b)
+{
+       ResTreeNode *t1 = (ResTreeNode*)a;
+       ResTreeNode *t2 = (ResTreeNode*)b;
+
+       return t1->id - t2->id;
+}
+
+/*
+ * resource_tree_create:
+ *
+ *  Organize the resources into a resource tree.
+ */
+static ResTreeNode *
+resource_tree_create (MonoArray *win32_resources)
+{
+       ResTreeNode *tree, *res_node, *type_node, *lang_node;
+       GSList *l;
+       int i;
+
+       tree = g_new0 (ResTreeNode, 1);
+       
+       for (i = 0; i < mono_array_length (win32_resources); ++i) {
+               MonoReflectionWin32Resource *win32_res =
+                       (MonoReflectionWin32Resource*)mono_array_addr (win32_resources, MonoReflectionWin32Resource, i);
+
+               /* Create node */
+
+               /* FIXME: BUG: this stores managed references in unmanaged memory */
+               lang_node = g_new0 (ResTreeNode, 1);
+               lang_node->id = win32_res->lang_id;
+               lang_node->win32_res = win32_res;
+
+               /* Create type node if neccesary */
+               type_node = NULL;
+               for (l = tree->children; l; l = l->next)
+                       if (((ResTreeNode*)(l->data))->id == win32_res->res_type) {
+                               type_node = (ResTreeNode*)l->data;
+                               break;
+                       }
+
+               if (!type_node) {
+                       type_node = g_new0 (ResTreeNode, 1);
+                       type_node->id = win32_res->res_type;
+
+                       /* 
+                        * The resource types have to be sorted otherwise
+                        * Windows Explorer can't display the version information.
+                        */
+                       tree->children = g_slist_insert_sorted (tree->children, 
+                               type_node, resource_tree_compare_by_id);
+               }
+
+               /* Create res node if neccesary */
+               res_node = NULL;
+               for (l = type_node->children; l; l = l->next)
+                       if (((ResTreeNode*)(l->data))->id == win32_res->res_id) {
+                               res_node = (ResTreeNode*)l->data;
+                               break;
+                       }
+
+               if (!res_node) {
+                       res_node = g_new0 (ResTreeNode, 1);
+                       res_node->id = win32_res->res_id;
+                       type_node->children = g_slist_append (type_node->children, res_node);
+               }
+
+               res_node->children = g_slist_append (res_node->children, lang_node);
+       }
+
+       return tree;
+}
+
+/*
+ * resource_tree_encode:
+ * 
+ *   Encode the resource tree into the format used in the PE file.
+ */
+static void
+resource_tree_encode (ResTreeNode *node, char *begin, char *p, char **endbuf)
+{
+       char *entries;
+       MonoPEResourceDir dir;
+       MonoPEResourceDirEntry dir_entry;
+       MonoPEResourceDataEntry data_entry;
+       GSList *l;
+       guint32 res_id_entries;
+
+       /*
+        * For the format of the resource directory, see the article
+        * "An In-Depth Look into the Win32 Portable Executable File Format" by
+        * Matt Pietrek
+        */
+
+       memset (&dir, 0, sizeof (dir));
+       memset (&dir_entry, 0, sizeof (dir_entry));
+       memset (&data_entry, 0, sizeof (data_entry));
+
+       g_assert (sizeof (dir) == 16);
+       g_assert (sizeof (dir_entry) == 8);
+       g_assert (sizeof (data_entry) == 16);
+
+       node->offset = p - begin;
+
+       /* IMAGE_RESOURCE_DIRECTORY */
+       res_id_entries = g_slist_length (node->children);
+       dir.res_id_entries = GUINT16_TO_LE (res_id_entries);
+
+       memcpy (p, &dir, sizeof (dir));
+       p += sizeof (dir);
+
+       /* Reserve space for entries */
+       entries = p;
+       p += sizeof (dir_entry) * res_id_entries;
+
+       /* Write children */
+       for (l = node->children; l; l = l->next) {
+               ResTreeNode *child = (ResTreeNode*)l->data;
+
+               if (child->win32_res) {
+                       guint32 size;
+
+                       child->offset = p - begin;
+
+                       /* IMAGE_RESOURCE_DATA_ENTRY */
+                       data_entry.rde_data_offset = GUINT32_TO_LE (p - begin + sizeof (data_entry));
+                       size = mono_array_length (child->win32_res->res_data);
+                       data_entry.rde_size = GUINT32_TO_LE (size);
+
+                       memcpy (p, &data_entry, sizeof (data_entry));
+                       p += sizeof (data_entry);
+
+                       memcpy (p, mono_array_addr (child->win32_res->res_data, char, 0), size);
+                       p += size;
+               } else {
+                       resource_tree_encode (child, begin, p, &p);
+               }
+       }
+
+       /* IMAGE_RESOURCE_ENTRY */
+       for (l = node->children; l; l = l->next) {
+               ResTreeNode *child = (ResTreeNode*)l->data;
+
+               MONO_PE_RES_DIR_ENTRY_SET_NAME (dir_entry, FALSE, child->id);
+               MONO_PE_RES_DIR_ENTRY_SET_DIR (dir_entry, !child->win32_res, child->offset);
+
+               memcpy (entries, &dir_entry, sizeof (dir_entry));
+               entries += sizeof (dir_entry);
+       }
+
+       *endbuf = p;
+}
+
+static void
+resource_tree_free (ResTreeNode * node)
+{
+       GSList * list;
+       for (list = node->children; list; list = list->next)
+               resource_tree_free ((ResTreeNode*)list->data);
+       g_slist_free(node->children);
+       g_free (node);
+}
+
+static void
+assembly_add_win32_resources (MonoDynamicImage *assembly, MonoReflectionAssemblyBuilder *assemblyb)
+{
+       char *buf;
+       char *p;
+       guint32 size, i;
+       MonoReflectionWin32Resource *win32_res;
+       ResTreeNode *tree;
+
+       if (!assemblyb->win32_resources)
+               return;
+
+       /*
+        * Resources are stored in a three level tree inside the PE file.
+        * - level one contains a node for each type of resource
+        * - level two contains a node for each resource
+        * - level three contains a node for each instance of a resource for a
+        *   specific language.
+        */
+
+       tree = resource_tree_create (assemblyb->win32_resources);
+
+       /* Estimate the size of the encoded tree */
+       size = 0;
+       for (i = 0; i < mono_array_length (assemblyb->win32_resources); ++i) {
+               win32_res = (MonoReflectionWin32Resource*)mono_array_addr (assemblyb->win32_resources, MonoReflectionWin32Resource, i);
+               size += mono_array_length (win32_res->res_data);
+       }
+       /* Directory structure */
+       size += mono_array_length (assemblyb->win32_resources) * 256;
+       p = buf = (char *)g_malloc (size);
+
+       resource_tree_encode (tree, p, p, &p);
+
+       g_assert (p - buf <= size);
+
+       assembly->win32_res = (char *)g_malloc (p - buf);
+       assembly->win32_res_size = p - buf;
+       memcpy (assembly->win32_res, buf, p - buf);
+
+       g_free (buf);
+       resource_tree_free (tree);
+}
+
+static void
+fixup_resource_directory (char *res_section, char *p, guint32 rva)
+{
+       MonoPEResourceDir *dir = (MonoPEResourceDir*)p;
+       int i;
+
+       p += sizeof (MonoPEResourceDir);
+       for (i = 0; i < GUINT16_FROM_LE (dir->res_named_entries) + GUINT16_FROM_LE (dir->res_id_entries); ++i) {
+               MonoPEResourceDirEntry *dir_entry = (MonoPEResourceDirEntry*)p;
+               char *child = res_section + MONO_PE_RES_DIR_ENTRY_DIR_OFFSET (*dir_entry);
+               if (MONO_PE_RES_DIR_ENTRY_IS_DIR (*dir_entry)) {
+                       fixup_resource_directory (res_section, child, rva);
+               } else {
+                       MonoPEResourceDataEntry *data_entry = (MonoPEResourceDataEntry*)child;
+                       data_entry->rde_data_offset = GUINT32_TO_LE (GUINT32_FROM_LE (data_entry->rde_data_offset) + rva);
+               }
+
+               p += sizeof (MonoPEResourceDirEntry);
+       }
+}
+
+static void
+checked_write_file (HANDLE f, gconstpointer buffer, guint32 numbytes)
+{
+       guint32 dummy;
+       if (!WriteFile (f, buffer, numbytes, &dummy, NULL))
+               g_error ("WriteFile returned %d\n", GetLastError ());
+}
+
+/*
+ * mono_image_create_pefile:
+ * @mb: a module builder object
+ * 
+ * This function creates the PE-COFF header, the image sections, the CLI header  * etc. all the data is written in
+ * assembly->pefile where it can be easily retrieved later in chunks.
+ */
+gboolean
+mono_image_create_pefile (MonoReflectionModuleBuilder *mb, HANDLE file, MonoError *error)
+{
+       MonoMSDOSHeader *msdos;
+       MonoDotNetHeader *header;
+       MonoSectionTable *section;
+       MonoCLIHeader *cli_header;
+       guint32 size, image_size, virtual_base, text_offset;
+       guint32 header_start, section_start, file_offset, virtual_offset;
+       MonoDynamicImage *assembly;
+       MonoReflectionAssemblyBuilder *assemblyb;
+       MonoDynamicStream pefile_stream = {0};
+       MonoDynamicStream *pefile = &pefile_stream;
+       int i, nsections;
+       guint32 *rva, value;
+       guchar *p;
+       static const unsigned char msheader[] = {
+               0x4d, 0x5a, 0x90, 0x00, 0x03, 0x00, 0x00, 0x00,  0x04, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00,
+               0xb8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
+               0x0e, 0x1f, 0xba, 0x0e, 0x00, 0xb4, 0x09, 0xcd,  0x21, 0xb8, 0x01, 0x4c, 0xcd, 0x21, 0x54, 0x68,
+               0x69, 0x73, 0x20, 0x70, 0x72, 0x6f, 0x67, 0x72,  0x61, 0x6d, 0x20, 0x63, 0x61, 0x6e, 0x6e, 0x6f,
+               0x74, 0x20, 0x62, 0x65, 0x20, 0x72, 0x75, 0x6e,  0x20, 0x69, 0x6e, 0x20, 0x44, 0x4f, 0x53, 0x20,
+               0x6d, 0x6f, 0x64, 0x65, 0x2e, 0x0d, 0x0d, 0x0a,  0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+       };
+
+       mono_error_init (error);
+
+       assemblyb = mb->assemblyb;
+
+       mono_reflection_dynimage_basic_init (assemblyb);
+       assembly = mb->dynamic_image;
+
+       assembly->pe_kind = assemblyb->pe_kind;
+       assembly->machine = assemblyb->machine;
+       ((MonoDynamicImage*)assemblyb->dynamic_assembly->assembly.image)->pe_kind = assemblyb->pe_kind;
+       ((MonoDynamicImage*)assemblyb->dynamic_assembly->assembly.image)->machine = assemblyb->machine;
+       
+       if (!mono_image_build_metadata (mb, error))
+               return FALSE;
+       
+
+       if (mb->is_main && assemblyb->resources) {
+               int len = mono_array_length (assemblyb->resources);
+               for (i = 0; i < len; ++i) {
+                       if (!assembly_add_resource (mb, assembly, (MonoReflectionResource*)mono_array_addr (assemblyb->resources, MonoReflectionResource, i), error))
+                               return FALSE;
+               }
+       }
+
+       if (mb->resources) {
+               int len = mono_array_length (mb->resources);
+               for (i = 0; i < len; ++i) {
+                       if (!assembly_add_resource (mb, assembly, (MonoReflectionResource*)mono_array_addr (mb->resources, MonoReflectionResource, i), error))
+                               return FALSE;
+               }
+       }
+
+       if (!build_compressed_metadata (assembly, error))
+               return FALSE;
+
+       if (mb->is_main)
+               assembly_add_win32_resources (assembly, assemblyb);
+
+       nsections = calc_section_size (assembly);
+       
+       /* The DOS header and stub */
+       g_assert (sizeof (MonoMSDOSHeader) == sizeof (msheader));
+       mono_image_add_stream_data (pefile, (char*)msheader, sizeof (msheader));
+
+       /* the dotnet header */
+       header_start = mono_image_add_stream_zero (pefile, sizeof (MonoDotNetHeader));
+
+       /* the section tables */
+       section_start = mono_image_add_stream_zero (pefile, sizeof (MonoSectionTable) * nsections);
+
+       file_offset = section_start + sizeof (MonoSectionTable) * nsections;
+       virtual_offset = VIRT_ALIGN;
+       image_size = 0;
+
+       for (i = 0; i < MONO_SECTION_MAX; ++i) {
+               if (!assembly->sections [i].size)
+                       continue;
+               /* align offsets */
+               file_offset += FILE_ALIGN - 1;
+               file_offset &= ~(FILE_ALIGN - 1);
+               virtual_offset += VIRT_ALIGN - 1;
+               virtual_offset &= ~(VIRT_ALIGN - 1);
+
+               assembly->sections [i].offset = file_offset;
+               assembly->sections [i].rva = virtual_offset;
+
+               file_offset += assembly->sections [i].size;
+               virtual_offset += assembly->sections [i].size;
+               image_size += (assembly->sections [i].size + VIRT_ALIGN - 1) & ~(VIRT_ALIGN - 1);
+       }
+
+       file_offset += FILE_ALIGN - 1;
+       file_offset &= ~(FILE_ALIGN - 1);
+
+       image_size += section_start + sizeof (MonoSectionTable) * nsections;
+
+       /* back-patch info */
+       msdos = (MonoMSDOSHeader*)pefile->data;
+       msdos->pe_offset = GUINT32_FROM_LE (sizeof (MonoMSDOSHeader));
+
+       header = (MonoDotNetHeader*)(pefile->data + header_start);
+       header->pesig [0] = 'P';
+       header->pesig [1] = 'E';
+       
+       header->coff.coff_machine = GUINT16_FROM_LE (assemblyb->machine);
+       header->coff.coff_sections = GUINT16_FROM_LE (nsections);
+       header->coff.coff_time = GUINT32_FROM_LE (time (NULL));
+       header->coff.coff_opt_header_size = GUINT16_FROM_LE (sizeof (MonoDotNetHeader) - sizeof (MonoCOFFHeader) - 4);
+       if (assemblyb->pekind == 1) {
+               /* it's a dll */
+               header->coff.coff_attributes = GUINT16_FROM_LE (0x210e);
+       } else {
+               /* it's an exe */
+               header->coff.coff_attributes = GUINT16_FROM_LE (0x010e);
+       }
+
+       virtual_base = 0x400000; /* FIXME: 0x10000000 if a DLL */
+
+       header->pe.pe_magic = GUINT16_FROM_LE (0x10B);
+       header->pe.pe_major = 6;
+       header->pe.pe_minor = 0;
+       size = assembly->sections [MONO_SECTION_TEXT].size;
+       size += FILE_ALIGN - 1;
+       size &= ~(FILE_ALIGN - 1);
+       header->pe.pe_code_size = GUINT32_FROM_LE(size);
+       size = assembly->sections [MONO_SECTION_RSRC].size;
+       size += FILE_ALIGN - 1;
+       size &= ~(FILE_ALIGN - 1);
+       header->pe.pe_data_size = GUINT32_FROM_LE(size);
+       g_assert (START_TEXT_RVA == assembly->sections [MONO_SECTION_TEXT].rva);
+       header->pe.pe_rva_code_base = GUINT32_FROM_LE (assembly->sections [MONO_SECTION_TEXT].rva);
+       header->pe.pe_rva_data_base = GUINT32_FROM_LE (assembly->sections [MONO_SECTION_RSRC].rva);
+       /* pe_rva_entry_point always at the beginning of the text section */
+       header->pe.pe_rva_entry_point = GUINT32_FROM_LE (assembly->sections [MONO_SECTION_TEXT].rva);
+
+       header->nt.pe_image_base = GUINT32_FROM_LE (virtual_base);
+       header->nt.pe_section_align = GUINT32_FROM_LE (VIRT_ALIGN);
+       header->nt.pe_file_alignment = GUINT32_FROM_LE (FILE_ALIGN);
+       header->nt.pe_os_major = GUINT16_FROM_LE (4);
+       header->nt.pe_os_minor = GUINT16_FROM_LE (0);
+       header->nt.pe_subsys_major = GUINT16_FROM_LE (4);
+       size = section_start;
+       size += FILE_ALIGN - 1;
+       size &= ~(FILE_ALIGN - 1);
+       header->nt.pe_header_size = GUINT32_FROM_LE (size);
+       size = image_size;
+       size += VIRT_ALIGN - 1;
+       size &= ~(VIRT_ALIGN - 1);
+       header->nt.pe_image_size = GUINT32_FROM_LE (size);
+
+       /*
+       // Translate the PEFileKind value to the value expected by the Windows loader
+       */
+       {
+               short kind;
+
+               /*
+               // PEFileKinds.Dll == 1
+               // PEFileKinds.ConsoleApplication == 2
+               // PEFileKinds.WindowApplication == 3
+               //
+               // need to get:
+               //     IMAGE_SUBSYSTEM_WINDOWS_GUI 2 // Image runs in the Windows GUI subsystem.
+                //     IMAGE_SUBSYSTEM_WINDOWS_CUI 3 // Image runs in the Windows character subsystem.
+               */
+               if (assemblyb->pekind == 3)
+                       kind = 2;
+               else
+                       kind = 3;
+               
+               header->nt.pe_subsys_required = GUINT16_FROM_LE (kind);
+       }    
+       header->nt.pe_stack_reserve = GUINT32_FROM_LE (0x00100000);
+       header->nt.pe_stack_commit = GUINT32_FROM_LE (0x00001000);
+       header->nt.pe_heap_reserve = GUINT32_FROM_LE (0x00100000);
+       header->nt.pe_heap_commit = GUINT32_FROM_LE (0x00001000);
+       header->nt.pe_loader_flags = GUINT32_FROM_LE (0);
+       header->nt.pe_data_dir_count = GUINT32_FROM_LE (16);
+
+       /* fill data directory entries */
+
+       header->datadir.pe_resource_table.size = GUINT32_FROM_LE (assembly->sections [MONO_SECTION_RSRC].size);
+       header->datadir.pe_resource_table.rva = GUINT32_FROM_LE (assembly->sections [MONO_SECTION_RSRC].rva);
+
+       header->datadir.pe_reloc_table.size = GUINT32_FROM_LE (assembly->sections [MONO_SECTION_RELOC].size);
+       header->datadir.pe_reloc_table.rva = GUINT32_FROM_LE (assembly->sections [MONO_SECTION_RELOC].rva);
+
+       header->datadir.pe_cli_header.size = GUINT32_FROM_LE (72);
+       header->datadir.pe_cli_header.rva = GUINT32_FROM_LE (assembly->text_rva + assembly->cli_header_offset);
+       header->datadir.pe_iat.size = GUINT32_FROM_LE (8);
+       header->datadir.pe_iat.rva = GUINT32_FROM_LE (assembly->text_rva + assembly->iat_offset);
+       /* patch entrypoint name */
+       if (assemblyb->pekind == 1)
+               memcpy (assembly->code.data + assembly->imp_names_offset + 2, "_CorDllMain", 12);
+       else
+               memcpy (assembly->code.data + assembly->imp_names_offset + 2, "_CorExeMain", 12);
+       /* patch imported function RVA name */
+       rva = (guint32*)(assembly->code.data + assembly->iat_offset);
+       *rva = GUINT32_FROM_LE (assembly->text_rva + assembly->imp_names_offset);
+
+       /* the import table */
+       header->datadir.pe_import_table.size = GUINT32_FROM_LE (79); /* FIXME: magic number? */
+       header->datadir.pe_import_table.rva = GUINT32_FROM_LE (assembly->text_rva + assembly->idt_offset);
+       /* patch imported dll RVA name and other entries in the dir */
+       rva = (guint32*)(assembly->code.data + assembly->idt_offset + G_STRUCT_OFFSET (MonoIDT, name_rva));
+       *rva = GUINT32_FROM_LE (assembly->text_rva + assembly->imp_names_offset + 14); /* 14 is hint+strlen+1 of func name */
+       rva = (guint32*)(assembly->code.data + assembly->idt_offset + G_STRUCT_OFFSET (MonoIDT, import_address_table_rva));
+       *rva = GUINT32_FROM_LE (assembly->text_rva + assembly->iat_offset);
+       rva = (guint32*)(assembly->code.data + assembly->idt_offset + G_STRUCT_OFFSET (MonoIDT, import_lookup_table));
+       *rva = GUINT32_FROM_LE (assembly->text_rva + assembly->ilt_offset);
+
+       p = (guchar*)(assembly->code.data + assembly->ilt_offset);
+       value = (assembly->text_rva + assembly->imp_names_offset);
+       *p++ = (value) & 0xff;
+       *p++ = (value >> 8) & (0xff);
+       *p++ = (value >> 16) & (0xff);
+       *p++ = (value >> 24) & (0xff);
+
+       /* the CLI header info */
+       cli_header = (MonoCLIHeader*)(assembly->code.data + assembly->cli_header_offset);
+       cli_header->ch_size = GUINT32_FROM_LE (72);
+       cli_header->ch_runtime_major = GUINT16_FROM_LE (2);
+       cli_header->ch_runtime_minor = GUINT16_FROM_LE (5);
+       cli_header->ch_flags = GUINT32_FROM_LE (assemblyb->pe_kind);
+       if (assemblyb->entry_point) {
+               guint32 table_idx = 0;
+               if (!strcmp (assemblyb->entry_point->object.vtable->klass->name, "MethodBuilder")) {
+                       MonoReflectionMethodBuilder *methodb = (MonoReflectionMethodBuilder*)assemblyb->entry_point;
+                       table_idx = methodb->table_idx;
+               } else {
+                       table_idx = GPOINTER_TO_UINT (g_hash_table_lookup (assembly->method_to_table_idx, assemblyb->entry_point->method));
+               }
+               cli_header->ch_entry_point = GUINT32_FROM_LE (table_idx | MONO_TOKEN_METHOD_DEF);
+       } else {
+               cli_header->ch_entry_point = GUINT32_FROM_LE (0);
+       }
+       /* The embedded managed resources */
+       text_offset = assembly->text_rva + assembly->code.index;
+       cli_header->ch_resources.rva = GUINT32_FROM_LE (text_offset);
+       cli_header->ch_resources.size = GUINT32_FROM_LE (assembly->resources.index);
+       text_offset += assembly->resources.index;
+       cli_header->ch_metadata.rva = GUINT32_FROM_LE (text_offset);
+       cli_header->ch_metadata.size = GUINT32_FROM_LE (assembly->meta_size);
+       text_offset += assembly->meta_size;
+       if (assembly->strong_name_size) {
+               cli_header->ch_strong_name.rva = GUINT32_FROM_LE (text_offset);
+               cli_header->ch_strong_name.size = GUINT32_FROM_LE (assembly->strong_name_size);
+               text_offset += assembly->strong_name_size;
+       }
+
+       /* write the section tables and section content */
+       section = (MonoSectionTable*)(pefile->data + section_start);
+       for (i = 0; i < MONO_SECTION_MAX; ++i) {
+               static const char section_names [][7] = {
+                       ".text", ".rsrc", ".reloc"
+               };
+               if (!assembly->sections [i].size)
+                       continue;
+               strcpy (section->st_name, section_names [i]);
+               /*g_print ("output section %s (%d), size: %d\n", section->st_name, i, assembly->sections [i].size);*/
+               section->st_virtual_address = GUINT32_FROM_LE (assembly->sections [i].rva);
+               section->st_virtual_size = GUINT32_FROM_LE (assembly->sections [i].size);
+               section->st_raw_data_size = GUINT32_FROM_LE (GUINT32_TO_LE (section->st_virtual_size) + (FILE_ALIGN - 1));
+               section->st_raw_data_size &= GUINT32_FROM_LE (~(FILE_ALIGN - 1));
+               section->st_raw_data_ptr = GUINT32_FROM_LE (assembly->sections [i].offset);
+               section->st_flags = GUINT32_FROM_LE (assembly->sections [i].attrs);
+               section ++;
+       }
+       
+       checked_write_file (file, pefile->data, pefile->index);
+       
+       mono_dynamic_stream_reset (pefile);
+       
+       for (i = 0; i < MONO_SECTION_MAX; ++i) {
+               if (!assembly->sections [i].size)
+                       continue;
+               
+               if (SetFilePointer (file, assembly->sections [i].offset, NULL, FILE_BEGIN) == INVALID_SET_FILE_POINTER)
+                       g_error ("SetFilePointer returned %d\n", GetLastError ());
+               
+               switch (i) {
+               case MONO_SECTION_TEXT:
+                       /* patch entry point */
+                       p = (guchar*)(assembly->code.data + 2);
+                       value = (virtual_base + assembly->text_rva + assembly->iat_offset);
+                       *p++ = (value) & 0xff;
+                       *p++ = (value >> 8) & 0xff;
+                       *p++ = (value >> 16) & 0xff;
+                       *p++ = (value >> 24) & 0xff;
+               
+                       checked_write_file (file, assembly->code.data, assembly->code.index);
+                       checked_write_file (file, assembly->resources.data, assembly->resources.index);
+                       checked_write_file (file, assembly->image.raw_metadata, assembly->meta_size);
+                       checked_write_file (file, assembly->strong_name, assembly->strong_name_size);
+                               
+
+                       g_free (assembly->image.raw_metadata);
+                       break;
+               case MONO_SECTION_RELOC: {
+                       struct {
+                               guint32 page_rva;
+                               guint32 block_size;
+                               guint16 type_and_offset;
+                               guint16 term;
+                       } reloc;
+                       
+                       g_assert (sizeof (reloc) == 12);
+                       
+                       reloc.page_rva = GUINT32_FROM_LE (assembly->text_rva);
+                       reloc.block_size = GUINT32_FROM_LE (12);
+                       
+                       /* 
+                        * the entrypoint is always at the start of the text section 
+                        * 3 is IMAGE_REL_BASED_HIGHLOW
+                        * 2 is patch_size_rva - text_rva
+                        */
+                       reloc.type_and_offset = GUINT16_FROM_LE ((3 << 12) + (2));
+                       reloc.term = 0;
+                       
+                       checked_write_file (file, &reloc, sizeof (reloc));
+                       
+                       break;
+               }
+               case MONO_SECTION_RSRC:
+                       if (assembly->win32_res) {
+
+                               /* Fixup the offsets in the IMAGE_RESOURCE_DATA_ENTRY structures */
+                               fixup_resource_directory (assembly->win32_res, assembly->win32_res, assembly->sections [i].rva);
+                               checked_write_file (file, assembly->win32_res, assembly->win32_res_size);
+                       }
+                       break;
+               default:
+                       g_assert_not_reached ();
+               }
+       }
+       
+       /* check that the file is properly padded */
+       if (SetFilePointer (file, file_offset, NULL, FILE_BEGIN) == INVALID_SET_FILE_POINTER)
+               g_error ("SetFilePointer returned %d\n", GetLastError ());
+       if (! SetEndOfFile (file))
+               g_error ("SetEndOfFile returned %d\n", GetLastError ());
+       
+       mono_dynamic_stream_reset (&assembly->code);
+       mono_dynamic_stream_reset (&assembly->us);
+       mono_dynamic_stream_reset (&assembly->blob);
+       mono_dynamic_stream_reset (&assembly->guid);
+       mono_dynamic_stream_reset (&assembly->sheap);
+
+       g_hash_table_foreach (assembly->blob_cache, (GHFunc)g_free, NULL);
+       g_hash_table_destroy (assembly->blob_cache);
+       assembly->blob_cache = NULL;
+
+       return TRUE;
+}
+
+#else /* DISABLE_REFLECTION_EMIT_SAVE */
+
+gboolean
+mono_image_create_pefile (MonoReflectionModuleBuilder *mb, HANDLE file, MonoError *error)
+{
+       g_assert_not_reached ();
+}
+
+#endif /* DISABLE_REFLECTION_EMIT_SAVE */
+
diff --git a/mono/metadata/sre.c b/mono/metadata/sre.c
new file mode 100644 (file)
index 0000000..3d73c75
--- /dev/null
@@ -0,0 +1,4144 @@
+/*
+ * sre.c: Routines for creating an image at runtime
+ *   and related System.Reflection.Emit icalls
+ *   
+ * 
+ * Author:
+ *   Paolo Molaro (lupus@ximian.com)
+ *
+ * Copyright 2001-2003 Ximian, Inc (http://www.ximian.com)
+ * Copyright 2004-2009 Novell, Inc (http://www.novell.com)
+ * Copyright 2011 Rodrigo Kumpera
+ * Copyright 2016 Microsoft
+ *
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
+ */
+#include <config.h>
+#include <glib.h>
+#include "mono/metadata/assembly.h"
+#include "mono/metadata/debug-helpers.h"
+#include "mono/metadata/dynamic-image-internals.h"
+#include "mono/metadata/dynamic-stream-internals.h"
+#include "mono/metadata/exception.h"
+#include "mono/metadata/gc-internals.h"
+#include "mono/metadata/mono-ptr-array.h"
+#include "mono/metadata/object-internals.h"
+#include "mono/metadata/profiler-private.h"
+#include "mono/metadata/reflection-internals.h"
+#include "mono/metadata/reflection-cache.h"
+#include "mono/metadata/sre-internals.h"
+#include "mono/metadata/custom-attrs-internals.h"
+#include "mono/metadata/security-manager.h"
+#include "mono/metadata/security-core-clr.h"
+#include "mono/metadata/tabledefs.h"
+#include "mono/metadata/tokentype.h"
+#include "mono/utils/checked-build.h"
+#include "mono/utils/mono-digest.h"
+
+static GENERATE_GET_CLASS_WITH_CACHE (marshal_as_attribute, System.Runtime.InteropServices, MarshalAsAttribute);
+static GENERATE_GET_CLASS_WITH_CACHE (module_builder, System.Reflection.Emit, ModuleBuilder);
+
+#ifndef DISABLE_REFLECTION_EMIT
+static guint32 mono_image_get_methodref_token (MonoDynamicImage *assembly, MonoMethod *method, gboolean create_typespec);
+static guint32 mono_image_get_sighelper_token (MonoDynamicImage *assembly, MonoReflectionSigHelper *helper, MonoError *error);
+static gboolean ensure_runtime_vtable (MonoClass *klass, MonoError  *error);
+static void reflection_methodbuilder_from_dynamic_method (ReflectionMethodBuilder *rmb, MonoReflectionDynamicMethod *mb);
+static gboolean reflection_setup_internal_class (MonoReflectionTypeBuilder *tb, MonoError *error);
+
+static gpointer register_assembly (MonoDomain *domain, MonoReflectionAssembly *res, MonoAssembly *assembly);
+#endif
+
+static char*   type_get_qualified_name (MonoType *type, MonoAssembly *ass);
+static MonoReflectionType *mono_reflection_type_get_underlying_system_type (MonoReflectionType* t, MonoError *error);
+static gboolean is_sre_array (MonoClass *klass);
+static gboolean is_sre_byref (MonoClass *klass);
+static gboolean is_sre_pointer (MonoClass *klass);
+static gboolean is_sre_generic_instance (MonoClass *klass);
+static gboolean is_sre_type_builder (MonoClass *klass);
+static gboolean is_sre_method_builder (MonoClass *klass);
+static gboolean is_sre_field_builder (MonoClass *klass);
+static gboolean is_sre_gparam_builder (MonoClass *klass);
+static gboolean is_sre_enum_builder (MonoClass *klass);
+static gboolean is_sr_mono_method (MonoClass *klass);
+static gboolean is_sr_mono_field (MonoClass *klass);
+
+static guint32 mono_image_get_methodspec_token (MonoDynamicImage *assembly, MonoMethod *method);
+static guint32 mono_image_get_inflated_method_token (MonoDynamicImage *assembly, MonoMethod *m);
+
+#define mono_type_array_get_and_resolve(array, index, error) mono_reflection_type_get_handle ((MonoReflectionType*)mono_array_get (array, gpointer, index), error)
+
+static void mono_image_module_basic_init (MonoReflectionModuleBuilder *module);
+
+void
+mono_reflection_emit_init (void)
+{
+       mono_dynamic_images_init ();
+}
+
+static char*
+type_get_fully_qualified_name (MonoType *type)
+{
+       MONO_REQ_GC_NEUTRAL_MODE;
+
+       return mono_type_get_name_full (type, MONO_TYPE_NAME_FORMAT_ASSEMBLY_QUALIFIED);
+}
+
+static char*
+type_get_qualified_name (MonoType *type, MonoAssembly *ass)
+{
+       MONO_REQ_GC_UNSAFE_MODE;
+
+       MonoClass *klass;
+       MonoAssembly *ta;
+
+       klass = mono_class_from_mono_type (type);
+       if (!klass) 
+               return mono_type_get_name_full (type, MONO_TYPE_NAME_FORMAT_REFLECTION);
+       ta = klass->image->assembly;
+       if (assembly_is_dynamic (ta) || (ta == ass)) {
+               if (mono_class_is_ginst (klass) || mono_class_is_gtd (klass))
+                       /* For generic type definitions, we want T, while REFLECTION returns T<K> */
+                       return mono_type_get_name_full (type, MONO_TYPE_NAME_FORMAT_FULL_NAME);
+               else
+                       return mono_type_get_name_full (type, MONO_TYPE_NAME_FORMAT_REFLECTION);
+       }
+
+       return mono_type_get_name_full (type, MONO_TYPE_NAME_FORMAT_ASSEMBLY_QUALIFIED);
+}
+
+#ifndef DISABLE_REFLECTION_EMIT
+/**
+ * mp_g_alloc:
+ *
+ * Allocate memory from the @image mempool if it is non-NULL. Otherwise, allocate memory
+ * from the C heap.
+ */
+static gpointer
+image_g_malloc (MonoImage *image, guint size)
+{
+       MONO_REQ_GC_NEUTRAL_MODE;
+
+       if (image)
+               return mono_image_alloc (image, size);
+       else
+               return g_malloc (size);
+}
+#endif /* !DISABLE_REFLECTION_EMIT */
+
+/**
+ * image_g_alloc0:
+ *
+ * Allocate memory from the @image mempool if it is non-NULL. Otherwise, allocate memory
+ * from the C heap.
+ */
+gpointer
+mono_image_g_malloc0 (MonoImage *image, guint size)
+{
+       MONO_REQ_GC_NEUTRAL_MODE;
+
+       if (image)
+               return mono_image_alloc0 (image, size);
+       else
+               return g_malloc0 (size);
+}
+
+/**
+ * image_g_free:
+ * @image: a MonoImage
+ * @ptr: pointer
+ *
+ * If @image is NULL, free @ptr, otherwise do nothing.
+ */
+static void
+image_g_free (MonoImage *image, gpointer ptr)
+{
+       if (image == NULL)
+               g_free (ptr);
+}
+
+#ifndef DISABLE_REFLECTION_EMIT
+static char*
+image_strdup (MonoImage *image, const char *s)
+{
+       MONO_REQ_GC_NEUTRAL_MODE;
+
+       if (image)
+               return mono_image_strdup (image, s);
+       else
+               return g_strdup (s);
+}
+#endif
+
+#define image_g_new(image,struct_type, n_structs)              \
+    ((struct_type *) image_g_malloc (image, ((gsize) sizeof (struct_type)) * ((gsize) (n_structs))))
+
+#define image_g_new0(image,struct_type, n_structs)             \
+    ((struct_type *) mono_image_g_malloc0 (image, ((gsize) sizeof (struct_type)) * ((gsize) (n_structs))))
+
+
+static void
+alloc_table (MonoDynamicTable *table, guint nrows)
+{
+       mono_dynimage_alloc_table (table, nrows);
+}
+
+static guint32
+string_heap_insert (MonoDynamicStream *sh, const char *str)
+{
+       return mono_dynstream_insert_string (sh, str);
+}
+
+static guint32
+mono_image_add_stream_data (MonoDynamicStream *stream, const char *data, guint32 len)
+{
+       return mono_dynstream_add_data (stream, data, len);
+}
+
+/*
+ * Despite the name, we handle also TypeSpec (with the above helper).
+ */
+static guint32
+mono_image_typedef_or_ref (MonoDynamicImage *assembly, MonoType *type)
+{
+       return mono_dynimage_encode_typedef_or_ref_full (assembly, type, TRUE);
+}
+
+/*
+ * Copy len * nelem bytes from val to dest, swapping bytes to LE if necessary.
+ * dest may be misaligned.
+ */
+static void
+swap_with_size (char *dest, const char* val, int len, int nelem) {
+       MONO_REQ_GC_NEUTRAL_MODE;
+#if G_BYTE_ORDER != G_LITTLE_ENDIAN
+       int elem;
+
+       for (elem = 0; elem < nelem; ++elem) {
+               switch (len) {
+               case 1:
+                       *dest = *val;
+                       break;
+               case 2:
+                       dest [0] = val [1];
+                       dest [1] = val [0];
+                       break;
+               case 4:
+                       dest [0] = val [3];
+                       dest [1] = val [2];
+                       dest [2] = val [1];
+                       dest [3] = val [0];
+                       break;
+               case 8:
+                       dest [0] = val [7];
+                       dest [1] = val [6];
+                       dest [2] = val [5];
+                       dest [3] = val [4];
+                       dest [4] = val [3];
+                       dest [5] = val [2];
+                       dest [6] = val [1];
+                       dest [7] = val [0];
+                       break;
+               default:
+                       g_assert_not_reached ();
+               }
+               dest += len;
+               val += len;
+       }
+#else
+       memcpy (dest, val, len * nelem);
+#endif
+}
+
+guint32
+mono_reflection_method_count_clauses (MonoReflectionILGen *ilgen)
+{
+       MONO_REQ_GC_UNSAFE_MODE;
+
+       guint32 num_clauses = 0;
+       int i;
+
+       MonoILExceptionInfo *ex_info;
+       for (i = 0; i < mono_array_length (ilgen->ex_handlers); ++i) {
+               ex_info = (MonoILExceptionInfo*)mono_array_addr (ilgen->ex_handlers, MonoILExceptionInfo, i);
+               if (ex_info->handlers)
+                       num_clauses += mono_array_length (ex_info->handlers);
+               else
+                       num_clauses++;
+       }
+
+       return num_clauses;
+}
+
+#ifndef DISABLE_REFLECTION_EMIT
+static MonoExceptionClause*
+method_encode_clauses (MonoImage *image, MonoDynamicImage *assembly, MonoReflectionILGen *ilgen, guint32 num_clauses, MonoError *error)
+{
+       MONO_REQ_GC_UNSAFE_MODE;
+
+       mono_error_init (error);
+
+       MonoExceptionClause *clauses;
+       MonoExceptionClause *clause;
+       MonoILExceptionInfo *ex_info;
+       MonoILExceptionBlock *ex_block;
+       guint32 finally_start;
+       int i, j, clause_index;;
+
+       clauses = image_g_new0 (image, MonoExceptionClause, num_clauses);
+
+       clause_index = 0;
+       for (i = mono_array_length (ilgen->ex_handlers) - 1; i >= 0; --i) {
+               ex_info = (MonoILExceptionInfo*)mono_array_addr (ilgen->ex_handlers, MonoILExceptionInfo, i);
+               finally_start = ex_info->start + ex_info->len;
+               if (!ex_info->handlers)
+                       continue;
+               for (j = 0; j < mono_array_length (ex_info->handlers); ++j) {
+                       ex_block = (MonoILExceptionBlock*)mono_array_addr (ex_info->handlers, MonoILExceptionBlock, j);
+                       clause = &(clauses [clause_index]);
+
+                       clause->flags = ex_block->type;
+                       clause->try_offset = ex_info->start;
+
+                       if (ex_block->type == MONO_EXCEPTION_CLAUSE_FINALLY)
+                               clause->try_len = finally_start - ex_info->start;
+                       else
+                               clause->try_len = ex_info->len;
+                       clause->handler_offset = ex_block->start;
+                       clause->handler_len = ex_block->len;
+                       if (ex_block->extype) {
+                               MonoType *extype = mono_reflection_type_get_handle ((MonoReflectionType*)ex_block->extype, error);
+
+                               if (!is_ok (error)) {
+                                       image_g_free (image, clauses);
+                                       return NULL;
+                               }
+                               clause->data.catch_class = mono_class_from_mono_type (extype);
+                       } else {
+                               if (ex_block->type == MONO_EXCEPTION_CLAUSE_FILTER)
+                                       clause->data.filter_offset = ex_block->filter_offset;
+                               else
+                                       clause->data.filter_offset = 0;
+                       }
+                       finally_start = ex_block->start + ex_block->len;
+
+                       clause_index ++;
+               }
+       }
+
+       return clauses;
+}
+#endif /* !DISABLE_REFLECTION_EMIT */
+
+#ifndef DISABLE_REFLECTION_EMIT
+/*
+ * LOCKING: Acquires the loader lock. 
+ */
+static void
+mono_save_custom_attrs (MonoImage *image, void *obj, MonoArray *cattrs)
+{
+       MONO_REQ_GC_UNSAFE_MODE;
+
+       MonoCustomAttrInfo *ainfo, *tmp;
+
+       if (!cattrs || !mono_array_length (cattrs))
+               return;
+
+       ainfo = mono_custom_attrs_from_builders (image, image, cattrs);
+
+       mono_loader_lock ();
+       tmp = (MonoCustomAttrInfo *)mono_image_property_lookup (image, obj, MONO_PROP_DYNAMIC_CATTR);
+       if (tmp)
+               mono_custom_attrs_free (tmp);
+       mono_image_property_insert (image, obj, MONO_PROP_DYNAMIC_CATTR, ainfo);
+       mono_loader_unlock ();
+
+}
+#endif
+
+guint32
+mono_reflection_resolution_scope_from_image (MonoDynamicImage *assembly, MonoImage *image)
+{
+       MONO_REQ_GC_UNSAFE_MODE;
+
+       MonoDynamicTable *table;
+       guint32 token;
+       guint32 *values;
+       guint32 cols [MONO_ASSEMBLY_SIZE];
+       const char *pubkey;
+       guint32 publen;
+
+       if ((token = GPOINTER_TO_UINT (g_hash_table_lookup (assembly->handleref, image))))
+               return token;
+
+       if (assembly_is_dynamic (image->assembly) && (image->assembly == assembly->image.assembly)) {
+               table = &assembly->tables [MONO_TABLE_MODULEREF];
+               token = table->next_idx ++;
+               table->rows ++;
+               alloc_table (table, table->rows);
+               values = table->values + token * MONO_MODULEREF_SIZE;
+               values [MONO_MODULEREF_NAME] = string_heap_insert (&assembly->sheap, image->module_name);
+
+               token <<= MONO_RESOLUTION_SCOPE_BITS;
+               token |= MONO_RESOLUTION_SCOPE_MODULEREF;
+               g_hash_table_insert (assembly->handleref, image, GUINT_TO_POINTER (token));
+
+               return token;
+       }
+       
+       if (assembly_is_dynamic (image->assembly))
+               /* FIXME: */
+               memset (cols, 0, sizeof (cols));
+       else {
+               /* image->assembly->image is the manifest module */
+               image = image->assembly->image;
+               mono_metadata_decode_row (&image->tables [MONO_TABLE_ASSEMBLY], 0, cols, MONO_ASSEMBLY_SIZE);
+       }
+
+       table = &assembly->tables [MONO_TABLE_ASSEMBLYREF];
+       token = table->next_idx ++;
+       table->rows ++;
+       alloc_table (table, table->rows);
+       values = table->values + token * MONO_ASSEMBLYREF_SIZE;
+       values [MONO_ASSEMBLYREF_NAME] = string_heap_insert (&assembly->sheap, image->assembly_name);
+       values [MONO_ASSEMBLYREF_MAJOR_VERSION] = cols [MONO_ASSEMBLY_MAJOR_VERSION];
+       values [MONO_ASSEMBLYREF_MINOR_VERSION] = cols [MONO_ASSEMBLY_MINOR_VERSION];
+       values [MONO_ASSEMBLYREF_BUILD_NUMBER] = cols [MONO_ASSEMBLY_BUILD_NUMBER];
+       values [MONO_ASSEMBLYREF_REV_NUMBER] = cols [MONO_ASSEMBLY_REV_NUMBER];
+       values [MONO_ASSEMBLYREF_FLAGS] = 0;
+       values [MONO_ASSEMBLYREF_CULTURE] = 0;
+       values [MONO_ASSEMBLYREF_HASH_VALUE] = 0;
+
+       if (strcmp ("", image->assembly->aname.culture)) {
+               values [MONO_ASSEMBLYREF_CULTURE] = string_heap_insert (&assembly->sheap,
+                               image->assembly->aname.culture);
+       }
+
+       if ((pubkey = mono_image_get_public_key (image, &publen))) {
+               guchar pubtoken [9];
+               pubtoken [0] = 8;
+               mono_digest_get_public_token (pubtoken + 1, (guchar*)pubkey, publen);
+               values [MONO_ASSEMBLYREF_PUBLIC_KEY] = mono_image_add_stream_data (&assembly->blob, (char*)pubtoken, 9);
+       } else {
+               values [MONO_ASSEMBLYREF_PUBLIC_KEY] = 0;
+       }
+       token <<= MONO_RESOLUTION_SCOPE_BITS;
+       token |= MONO_RESOLUTION_SCOPE_ASSEMBLYREF;
+       g_hash_table_insert (assembly->handleref, image, GUINT_TO_POINTER (token));
+       return token;
+}
+
+#ifndef DISABLE_REFLECTION_EMIT
+gboolean
+mono_reflection_methodbuilder_from_method_builder (ReflectionMethodBuilder *rmb, MonoReflectionMethodBuilder *mb, MonoError *error)
+{
+       MONO_REQ_GC_UNSAFE_MODE;
+
+       mono_error_init (error);
+       memset (rmb, 0, sizeof (ReflectionMethodBuilder));
+
+       rmb->ilgen = mb->ilgen;
+       rmb->rtype = (MonoReflectionType*)mb->rtype;
+       return_val_if_nok (error, FALSE);
+       rmb->parameters = mb->parameters;
+       rmb->generic_params = mb->generic_params;
+       rmb->generic_container = mb->generic_container;
+       rmb->opt_types = NULL;
+       rmb->pinfo = mb->pinfo;
+       rmb->attrs = mb->attrs;
+       rmb->iattrs = mb->iattrs;
+       rmb->call_conv = mb->call_conv;
+       rmb->code = mb->code;
+       rmb->type = mb->type;
+       rmb->name = mb->name;
+       rmb->table_idx = &mb->table_idx;
+       rmb->init_locals = mb->init_locals;
+       rmb->skip_visibility = FALSE;
+       rmb->return_modreq = mb->return_modreq;
+       rmb->return_modopt = mb->return_modopt;
+       rmb->param_modreq = mb->param_modreq;
+       rmb->param_modopt = mb->param_modopt;
+       rmb->permissions = mb->permissions;
+       rmb->mhandle = mb->mhandle;
+       rmb->nrefs = 0;
+       rmb->refs = NULL;
+
+       if (mb->dll) {
+               rmb->charset = mb->charset;
+               rmb->extra_flags = mb->extra_flags;
+               rmb->native_cc = mb->native_cc;
+               rmb->dllentry = mb->dllentry;
+               rmb->dll = mb->dll;
+       }
+
+       return TRUE;
+}
+
+gboolean
+mono_reflection_methodbuilder_from_ctor_builder (ReflectionMethodBuilder *rmb, MonoReflectionCtorBuilder *mb, MonoError *error)
+{
+       MONO_REQ_GC_UNSAFE_MODE;
+
+       const char *name = mb->attrs & METHOD_ATTRIBUTE_STATIC ? ".cctor": ".ctor";
+
+       mono_error_init (error);
+
+       memset (rmb, 0, sizeof (ReflectionMethodBuilder));
+
+       rmb->ilgen = mb->ilgen;
+       rmb->rtype = mono_type_get_object_checked (mono_domain_get (), &mono_defaults.void_class->byval_arg, error);
+       return_val_if_nok (error, FALSE);
+       rmb->parameters = mb->parameters;
+       rmb->generic_params = NULL;
+       rmb->generic_container = NULL;
+       rmb->opt_types = NULL;
+       rmb->pinfo = mb->pinfo;
+       rmb->attrs = mb->attrs;
+       rmb->iattrs = mb->iattrs;
+       rmb->call_conv = mb->call_conv;
+       rmb->code = NULL;
+       rmb->type = mb->type;
+       rmb->name = mono_string_new (mono_domain_get (), name);
+       rmb->table_idx = &mb->table_idx;
+       rmb->init_locals = mb->init_locals;
+       rmb->skip_visibility = FALSE;
+       rmb->return_modreq = NULL;
+       rmb->return_modopt = NULL;
+       rmb->param_modreq = mb->param_modreq;
+       rmb->param_modopt = mb->param_modopt;
+       rmb->permissions = mb->permissions;
+       rmb->mhandle = mb->mhandle;
+       rmb->nrefs = 0;
+       rmb->refs = NULL;
+
+       return TRUE;
+}
+
+static void
+reflection_methodbuilder_from_dynamic_method (ReflectionMethodBuilder *rmb, MonoReflectionDynamicMethod *mb)
+{
+       MONO_REQ_GC_UNSAFE_MODE;
+
+       memset (rmb, 0, sizeof (ReflectionMethodBuilder));
+
+       rmb->ilgen = mb->ilgen;
+       rmb->rtype = mb->rtype;
+       rmb->parameters = mb->parameters;
+       rmb->generic_params = NULL;
+       rmb->generic_container = NULL;
+       rmb->opt_types = NULL;
+       rmb->pinfo = NULL;
+       rmb->attrs = mb->attrs;
+       rmb->iattrs = 0;
+       rmb->call_conv = mb->call_conv;
+       rmb->code = NULL;
+       rmb->type = (MonoObject *) mb->owner;
+       rmb->name = mb->name;
+       rmb->table_idx = NULL;
+       rmb->init_locals = mb->init_locals;
+       rmb->skip_visibility = mb->skip_visibility;
+       rmb->return_modreq = NULL;
+       rmb->return_modopt = NULL;
+       rmb->param_modreq = NULL;
+       rmb->param_modopt = NULL;
+       rmb->permissions = NULL;
+       rmb->mhandle = mb->mhandle;
+       rmb->nrefs = 0;
+       rmb->refs = NULL;
+}      
+#else /* DISABLE_REFLECTION_EMIT */
+gboolean
+mono_reflection_methodbuilder_from_method_builder (ReflectionMethodBuilder *rmb, MonoReflectionMethodBuilder *mb, MonoError *error) {
+       g_assert_not_reached ();
+       return FALSE;
+}
+gboolean
+mono_reflection_methodbuilder_from_ctor_builder (ReflectionMethodBuilder *rmb, MonoReflectionCtorBuilder *mb, MonoError *error)
+{
+       g_assert_not_reached ();
+       return FALSE;
+}
+#endif /* DISABLE_REFLECTION_EMIT */
+
+#ifndef DISABLE_REFLECTION_EMIT
+static guint32
+mono_image_add_memberef_row (MonoDynamicImage *assembly, guint32 parent, const char *name, guint32 sig)
+{
+       MONO_REQ_GC_NEUTRAL_MODE;
+
+       MonoDynamicTable *table;
+       guint32 *values;
+       guint32 token, pclass;
+
+       switch (parent & MONO_TYPEDEFORREF_MASK) {
+       case MONO_TYPEDEFORREF_TYPEREF:
+               pclass = MONO_MEMBERREF_PARENT_TYPEREF;
+               break;
+       case MONO_TYPEDEFORREF_TYPESPEC:
+               pclass = MONO_MEMBERREF_PARENT_TYPESPEC;
+               break;
+       case MONO_TYPEDEFORREF_TYPEDEF:
+               pclass = MONO_MEMBERREF_PARENT_TYPEDEF;
+               break;
+       default:
+               g_warning ("unknown typeref or def token 0x%08x for %s", parent, name);
+               return 0;
+       }
+       /* extract the index */
+       parent >>= MONO_TYPEDEFORREF_BITS;
+
+       table = &assembly->tables [MONO_TABLE_MEMBERREF];
+
+       if (assembly->save) {
+               alloc_table (table, table->rows + 1);
+               values = table->values + table->next_idx * MONO_MEMBERREF_SIZE;
+               values [MONO_MEMBERREF_CLASS] = pclass | (parent << MONO_MEMBERREF_PARENT_BITS);
+               values [MONO_MEMBERREF_NAME] = string_heap_insert (&assembly->sheap, name);
+               values [MONO_MEMBERREF_SIGNATURE] = sig;
+       }
+
+       token = MONO_TOKEN_MEMBER_REF | table->next_idx;
+       table->next_idx ++;
+
+       return token;
+}
+
+/*
+ * Insert a memberef row into the metadata: the token that point to the memberref
+ * is returned. Caching is done in the caller (mono_image_get_methodref_token() or
+ * mono_image_get_fieldref_token()).
+ * The sig param is an index to an already built signature.
+ */
+static guint32
+mono_image_get_memberref_token (MonoDynamicImage *assembly, MonoType *type, const char *name, guint32 sig)
+{
+       MONO_REQ_GC_NEUTRAL_MODE;
+
+       guint32 parent = mono_image_typedef_or_ref (assembly, type);
+       return mono_image_add_memberef_row (assembly, parent, name, sig);
+}
+
+
+static guint32
+mono_image_get_methodref_token (MonoDynamicImage *assembly, MonoMethod *method, gboolean create_typespec)
+{
+       MONO_REQ_GC_NEUTRAL_MODE;
+
+       guint32 token;
+       MonoMethodSignature *sig;
+       
+       create_typespec = create_typespec && method->is_generic && method->klass->image != &assembly->image;
+
+       if (create_typespec) {
+               token = GPOINTER_TO_UINT (g_hash_table_lookup (assembly->handleref, GUINT_TO_POINTER (GPOINTER_TO_UINT (method) + 1)));
+               if (token)
+                       return token;
+       } 
+
+       token = GPOINTER_TO_UINT (g_hash_table_lookup (assembly->handleref, method));
+       if (token && !create_typespec)
+               return token;
+
+       g_assert (!method->is_inflated);
+       if (!token) {
+               /*
+                * A methodref signature can't contain an unmanaged calling convention.
+                */
+               sig = mono_metadata_signature_dup (mono_method_signature (method));
+               if ((sig->call_convention != MONO_CALL_DEFAULT) && (sig->call_convention != MONO_CALL_VARARG))
+                       sig->call_convention = MONO_CALL_DEFAULT;
+               token = mono_image_get_memberref_token (assembly, &method->klass->byval_arg,
+                       method->name,  mono_dynimage_encode_method_signature (assembly, sig));
+               g_free (sig);
+               g_hash_table_insert (assembly->handleref, method, GUINT_TO_POINTER(token));
+       }
+
+       if (create_typespec) {
+               MonoDynamicTable *table = &assembly->tables [MONO_TABLE_METHODSPEC];
+               g_assert (mono_metadata_token_table (token) == MONO_TABLE_MEMBERREF);
+               token = (mono_metadata_token_index (token) << MONO_METHODDEFORREF_BITS) | MONO_METHODDEFORREF_METHODREF;
+
+               if (assembly->save) {
+                       guint32 *values;
+
+                       alloc_table (table, table->rows + 1);
+                       values = table->values + table->next_idx * MONO_METHODSPEC_SIZE;
+                       values [MONO_METHODSPEC_METHOD] = token;
+                       values [MONO_METHODSPEC_SIGNATURE] = mono_dynimage_encode_generic_method_sig (assembly, &mono_method_get_generic_container (method)->context);
+               }
+
+               token = MONO_TOKEN_METHOD_SPEC | table->next_idx;
+               table->next_idx ++;
+               /*methodspec and memberef tokens are diferent, */
+               g_hash_table_insert (assembly->handleref, GUINT_TO_POINTER (GPOINTER_TO_UINT (method) + 1), GUINT_TO_POINTER (token));
+               return token;
+       }
+       return token;
+}
+
+static guint32
+mono_image_get_varargs_method_token (MonoDynamicImage *assembly, guint32 original,
+                                    const gchar *name, guint32 sig)
+{
+       MonoDynamicTable *table;
+       guint32 token;
+       guint32 *values;
+       
+       table = &assembly->tables [MONO_TABLE_MEMBERREF];
+
+       if (assembly->save) {
+               alloc_table (table, table->rows + 1);
+               values = table->values + table->next_idx * MONO_MEMBERREF_SIZE;
+               values [MONO_MEMBERREF_CLASS] = original;
+               values [MONO_MEMBERREF_NAME] = string_heap_insert (&assembly->sheap, name);
+               values [MONO_MEMBERREF_SIGNATURE] = sig;
+       }
+
+       token = MONO_TOKEN_MEMBER_REF | table->next_idx;
+       table->next_idx ++;
+
+       return token;
+}
+
+#endif
+
+static gboolean
+is_field_on_inst (MonoClassField *field)
+{
+       return mono_class_is_ginst (field->parent) && mono_class_get_generic_class (field->parent)->is_dynamic;
+}
+
+#ifndef DISABLE_REFLECTION_EMIT
+static guint32
+mono_image_get_fieldref_token (MonoDynamicImage *assembly, MonoObject *f, MonoClassField *field)
+{
+       MonoType *type;
+       guint32 token;
+
+       g_assert (field);
+       g_assert (field->parent);
+
+       token = GPOINTER_TO_UINT (mono_g_hash_table_lookup (assembly->handleref_managed, f));
+       if (token)
+               return token;
+
+       if (mono_class_is_ginst (field->parent) && mono_class_get_generic_class (field->parent)->container_class && mono_class_get_generic_class (field->parent)->container_class->fields) {
+               int index = field - field->parent->fields;
+               type = mono_field_get_type (&mono_class_get_generic_class (field->parent)->container_class->fields [index]);
+       } else {
+               type = mono_field_get_type (field);
+       }
+       token = mono_image_get_memberref_token (assembly, &field->parent->byval_arg,
+                                                                                       mono_field_get_name (field),
+                                                                                       mono_dynimage_encode_fieldref_signature (assembly, field->parent->image, type));
+       mono_g_hash_table_insert (assembly->handleref_managed, f, GUINT_TO_POINTER(token));
+       return token;
+}
+
+static guint32
+method_encode_methodspec (MonoDynamicImage *assembly, MonoMethod *method)
+{
+       MonoDynamicTable *table;
+       guint32 *values;
+       guint32 token, mtoken = 0, sig;
+       MonoMethodInflated *imethod;
+       MonoMethod *declaring;
+
+       table = &assembly->tables [MONO_TABLE_METHODSPEC];
+
+       g_assert (method->is_inflated);
+       imethod = (MonoMethodInflated *) method;
+       declaring = imethod->declaring;
+
+       sig = mono_dynimage_encode_method_signature (assembly, mono_method_signature (declaring));
+       mtoken = mono_image_get_memberref_token (assembly, &method->klass->byval_arg, declaring->name, sig);
+
+       if (!mono_method_signature (declaring)->generic_param_count)
+               return mtoken;
+
+       switch (mono_metadata_token_table (mtoken)) {
+       case MONO_TABLE_MEMBERREF:
+               mtoken = (mono_metadata_token_index (mtoken) << MONO_METHODDEFORREF_BITS) | MONO_METHODDEFORREF_METHODREF;
+               break;
+       case MONO_TABLE_METHOD:
+               mtoken = (mono_metadata_token_index (mtoken) << MONO_METHODDEFORREF_BITS) | MONO_METHODDEFORREF_METHODDEF;
+               break;
+       default:
+               g_assert_not_reached ();
+       }
+
+       sig = mono_dynimage_encode_generic_method_sig (assembly, mono_method_get_context (method));
+
+       if (assembly->save) {
+               alloc_table (table, table->rows + 1);
+               values = table->values + table->next_idx * MONO_METHODSPEC_SIZE;
+               values [MONO_METHODSPEC_METHOD] = mtoken;
+               values [MONO_METHODSPEC_SIGNATURE] = sig;
+       }
+
+       token = MONO_TOKEN_METHOD_SPEC | table->next_idx;
+       table->next_idx ++;
+
+       return token;
+}
+
+static guint32
+mono_image_get_methodspec_token (MonoDynamicImage *assembly, MonoMethod *method)
+{
+       MonoMethodInflated *imethod;
+       guint32 token;
+       
+       token = GPOINTER_TO_UINT (g_hash_table_lookup (assembly->handleref, method));
+       if (token)
+               return token;
+
+       g_assert (method->is_inflated);
+       imethod = (MonoMethodInflated *) method;
+
+       if (mono_method_signature (imethod->declaring)->generic_param_count) {
+               token = method_encode_methodspec (assembly, method);
+       } else {
+               guint32 sig = mono_dynimage_encode_method_signature (
+                       assembly, mono_method_signature (imethod->declaring));
+               token = mono_image_get_memberref_token (
+                       assembly, &method->klass->byval_arg, method->name, sig);
+       }
+
+       g_hash_table_insert (assembly->handleref, method, GUINT_TO_POINTER(token));
+       return token;
+}
+
+static guint32
+mono_image_get_inflated_method_token (MonoDynamicImage *assembly, MonoMethod *m)
+{
+       MonoMethodInflated *imethod = (MonoMethodInflated *) m;
+       guint32 sig, token;
+
+       sig = mono_dynimage_encode_method_signature (assembly, mono_method_signature (imethod->declaring));
+       token = mono_image_get_memberref_token (
+               assembly, &m->klass->byval_arg, m->name, sig);
+
+       return token;
+}
+
+static guint32 
+mono_image_get_sighelper_token (MonoDynamicImage *assembly, MonoReflectionSigHelper *helper, MonoError *error)
+{
+       guint32 idx;
+       MonoDynamicTable *table;
+       guint32 *values;
+
+       mono_error_init (error);
+
+       table = &assembly->tables [MONO_TABLE_STANDALONESIG];
+       idx = table->next_idx ++;
+       table->rows ++;
+       alloc_table (table, table->rows);
+       values = table->values + idx * MONO_STAND_ALONE_SIGNATURE_SIZE;
+
+       values [MONO_STAND_ALONE_SIGNATURE] =
+               mono_dynimage_encode_reflection_sighelper (assembly, helper, error);
+       return_val_if_nok (error, 0);
+       
+       return idx;
+}
+
+static int
+reflection_cc_to_file (int call_conv) {
+       switch (call_conv & 0x3) {
+       case 0:
+       case 1: return MONO_CALL_DEFAULT;
+       case 2: return MONO_CALL_VARARG;
+       default:
+               g_assert_not_reached ();
+       }
+       return 0;
+}
+#endif /* !DISABLE_REFLECTION_EMIT */
+
+struct _ArrayMethod {
+       MonoType *parent;
+       MonoMethodSignature *sig;
+       char *name;
+       guint32 token;
+};
+
+void
+mono_sre_array_method_free (ArrayMethod *am)
+{
+       g_free (am->sig);
+       g_free (am->name);
+       g_free (am);
+}
+
+#ifndef DISABLE_REFLECTION_EMIT
+static guint32
+mono_image_get_array_token (MonoDynamicImage *assembly, MonoReflectionArrayMethod *m, MonoError *error)
+{
+       guint32 nparams, i;
+       GList *tmp;
+       char *name = NULL;
+       MonoMethodSignature *sig;
+       ArrayMethod *am = NULL;
+       MonoType *mtype;
+
+       mono_error_init (error);
+
+       nparams = mono_array_length (m->parameters);
+       sig = (MonoMethodSignature *)g_malloc0 (MONO_SIZEOF_METHOD_SIGNATURE + sizeof (MonoType*) * nparams);
+       sig->hasthis = 1;
+       sig->sentinelpos = -1;
+       sig->call_convention = reflection_cc_to_file (m->call_conv);
+       sig->param_count = nparams;
+       if (m->ret) {
+               sig->ret = mono_reflection_type_get_handle (m->ret, error);
+               if (!is_ok (error))
+                       goto fail;
+       } else
+               sig->ret = &mono_defaults.void_class->byval_arg;
+
+       mtype = mono_reflection_type_get_handle (m->parent, error);
+       if (!is_ok (error))
+               goto fail;
+
+       for (i = 0; i < nparams; ++i) {
+               sig->params [i] = mono_type_array_get_and_resolve (m->parameters, i, error);
+               if (!is_ok (error))
+                       goto fail;
+       }
+
+       name = mono_string_to_utf8_checked (m->name, error);
+       if (!is_ok (error))
+               goto fail;
+       for (tmp = assembly->array_methods; tmp; tmp = tmp->next) {
+               am = (ArrayMethod *)tmp->data;
+               if (strcmp (name, am->name) == 0 && 
+                               mono_metadata_type_equal (am->parent, mtype) &&
+                               mono_metadata_signature_equal (am->sig, sig)) {
+                       g_free (name);
+                       g_free (sig);
+                       m->table_idx = am->token & 0xffffff;
+                       return am->token;
+               }
+       }
+       am = g_new0 (ArrayMethod, 1);
+       am->name = name;
+       am->sig = sig;
+       am->parent = mtype;
+       am->token = mono_image_get_memberref_token (assembly, am->parent, name,
+               mono_dynimage_encode_method_signature (assembly, sig));
+       assembly->array_methods = g_list_prepend (assembly->array_methods, am);
+       m->table_idx = am->token & 0xffffff;
+       return am->token;
+fail:
+       g_free (am);
+       g_free (name);
+       g_free (sig);
+       return 0;
+
+}
+#endif
+
+#ifndef DISABLE_REFLECTION_EMIT
+
+/*
+ * mono_image_insert_string:
+ * @module: module builder object
+ * @str: a string
+ *
+ * Insert @str into the user string stream of @module.
+ */
+guint32
+mono_image_insert_string (MonoReflectionModuleBuilder *module, MonoString *str)
+{
+       MonoDynamicImage *assembly;
+       guint32 idx;
+       char buf [16];
+       char *b = buf;
+       
+       if (!module->dynamic_image)
+               mono_image_module_basic_init (module);
+
+       assembly = module->dynamic_image;
+       
+       if (assembly->save) {
+               mono_metadata_encode_value (1 | (str->length * 2), b, &b);
+               idx = mono_image_add_stream_data (&assembly->us, buf, b-buf);
+#if G_BYTE_ORDER != G_LITTLE_ENDIAN
+       {
+               char *swapped = g_malloc (2 * mono_string_length (str));
+               const char *p = (const char*)mono_string_chars (str);
+
+               swap_with_size (swapped, p, 2, mono_string_length (str));
+               mono_image_add_stream_data (&assembly->us, swapped, str->length * 2);
+               g_free (swapped);
+       }
+#else
+               mono_image_add_stream_data (&assembly->us, (const char*)mono_string_chars (str), str->length * 2);
+#endif
+               mono_image_add_stream_data (&assembly->us, "", 1);
+       } else {
+               idx = assembly->us.index ++;
+       }
+
+       mono_dynamic_image_register_token (assembly, MONO_TOKEN_STRING | idx, (MonoObject*)str);
+
+       return MONO_TOKEN_STRING | idx;
+}
+
+guint32
+mono_image_create_method_token (MonoDynamicImage *assembly, MonoObject *obj, MonoArray *opt_param_types, MonoError *error)
+{
+       MonoClass *klass;
+       guint32 token = 0;
+       MonoMethodSignature *sig;
+
+       mono_error_init (error);
+
+       klass = obj->vtable->klass;
+       if (strcmp (klass->name, "MonoMethod") == 0 || strcmp (klass->name, "MonoCMethod") == 0) {
+               MonoMethod *method = ((MonoReflectionMethod *)obj)->method;
+               MonoMethodSignature *old;
+               guint32 sig_token, parent;
+               int nargs, i;
+
+               g_assert (opt_param_types && (mono_method_signature (method)->sentinelpos >= 0));
+
+               nargs = mono_array_length (opt_param_types);
+               old = mono_method_signature (method);
+               sig = mono_metadata_signature_alloc ( &assembly->image, old->param_count + nargs);
+
+               sig->hasthis = old->hasthis;
+               sig->explicit_this = old->explicit_this;
+               sig->call_convention = old->call_convention;
+               sig->generic_param_count = old->generic_param_count;
+               sig->param_count = old->param_count + nargs;
+               sig->sentinelpos = old->param_count;
+               sig->ret = old->ret;
+
+               for (i = 0; i < old->param_count; i++)
+                       sig->params [i] = old->params [i];
+
+               for (i = 0; i < nargs; i++) {
+                       MonoReflectionType *rt = mono_array_get (opt_param_types, MonoReflectionType *, i);
+                       sig->params [old->param_count + i] = mono_reflection_type_get_handle (rt, error);
+                       if (!is_ok (error)) goto fail;
+               }
+
+               parent = mono_image_typedef_or_ref (assembly, &method->klass->byval_arg);
+               g_assert ((parent & MONO_TYPEDEFORREF_MASK) == MONO_MEMBERREF_PARENT_TYPEREF);
+               parent >>= MONO_TYPEDEFORREF_BITS;
+
+               parent <<= MONO_MEMBERREF_PARENT_BITS;
+               parent |= MONO_MEMBERREF_PARENT_TYPEREF;
+
+               sig_token = mono_dynimage_encode_method_signature (assembly, sig);
+               token = mono_image_get_varargs_method_token (assembly, parent, method->name, sig_token);
+       } else if (strcmp (klass->name, "MethodBuilder") == 0) {
+               MonoReflectionMethodBuilder *mb = (MonoReflectionMethodBuilder *)obj;
+               ReflectionMethodBuilder rmb;
+               guint32 parent, sig_token;
+               int nopt_args, nparams, ngparams, i;
+
+               if (!mono_reflection_methodbuilder_from_method_builder (&rmb, mb, error))
+                       goto fail;
+               
+               rmb.opt_types = opt_param_types;
+               nopt_args = mono_array_length (opt_param_types);
+
+               nparams = rmb.parameters ? mono_array_length (rmb.parameters): 0;
+               ngparams = rmb.generic_params ? mono_array_length (rmb.generic_params): 0;
+               sig = mono_metadata_signature_alloc (&assembly->image, nparams + nopt_args);
+
+               sig->hasthis = !(rmb.attrs & METHOD_ATTRIBUTE_STATIC);
+               sig->explicit_this = (rmb.call_conv & 0x40) == 0x40;
+               sig->call_convention = rmb.call_conv;
+               sig->generic_param_count = ngparams;
+               sig->param_count = nparams + nopt_args;
+               sig->sentinelpos = nparams;
+               sig->ret = mono_reflection_type_get_handle (rmb.rtype, error);
+               if (!is_ok (error)) goto fail;
+
+               for (i = 0; i < nparams; i++) {
+                       MonoReflectionType *rt = mono_array_get (rmb.parameters, MonoReflectionType *, i);
+                       sig->params [i] = mono_reflection_type_get_handle (rt, error);
+                       if (!is_ok (error)) goto fail;
+               }
+
+               for (i = 0; i < nopt_args; i++) {
+                       MonoReflectionType *rt = mono_array_get (opt_param_types, MonoReflectionType *, i);
+                       sig->params [nparams + i] = mono_reflection_type_get_handle (rt, error);
+                       if (!is_ok (error)) goto fail;
+               }
+
+               // FIXME: This doesn't work, we don't use 'sig' for anything
+               // The token fixup doesn't work either
+               g_assert_not_reached ();
+
+               sig_token = mono_dynimage_encode_method_builder_signature (assembly, &rmb, error);
+               if (!is_ok (error))
+                       goto fail;
+
+               parent = mono_image_create_token (assembly, obj, TRUE, TRUE, error);
+               if (!mono_error_ok (error))
+                       goto fail;
+               g_assert (mono_metadata_token_table (parent) == MONO_TABLE_METHOD);
+
+               parent = mono_metadata_token_index (parent) << MONO_MEMBERREF_PARENT_BITS;
+               parent |= MONO_MEMBERREF_PARENT_METHODDEF;
+
+               char *name = mono_string_to_utf8_checked (rmb.name, error);
+               if (!is_ok (error)) goto fail;
+               token = mono_image_get_varargs_method_token (
+                       assembly, parent, name, sig_token);
+               g_free (name);
+       } else {
+               g_error ("requested method token for %s\n", klass->name);
+       }
+
+       g_hash_table_insert (assembly->vararg_aux_hash, GUINT_TO_POINTER (token), sig);
+       mono_dynamic_image_register_token (assembly, token, obj);
+       return token;
+fail:
+       g_assert (!mono_error_ok (error));
+       return 0;
+}
+
+/*
+ * mono_image_create_token:
+ * @assembly: a dynamic assembly
+ * @obj:
+ * @register_token: Whenever to register the token in the assembly->tokens hash. 
+ *
+ * Get a token to insert in the IL code stream for the given MemberInfo.
+ * The metadata emission routines need to pass FALSE as REGISTER_TOKEN, since by that time, 
+ * the table_idx-es were recomputed, so registering the token would overwrite an existing 
+ * entry.
+ */
+guint32
+mono_image_create_token (MonoDynamicImage *assembly, MonoObject *obj, 
+                        gboolean create_open_instance, gboolean register_token,
+                        MonoError *error)
+{
+       MonoClass *klass;
+       guint32 token = 0;
+
+       mono_error_init (error);
+
+       klass = obj->vtable->klass;
+
+       /* Check for user defined reflection objects */
+       /* TypeDelegator is the only corlib type which doesn't look like a MonoReflectionType */
+       if (klass->image != mono_defaults.corlib || (strcmp (klass->name, "TypeDelegator") == 0)) {
+               mono_error_set_not_supported (error, "User defined subclasses of System.Type are not yet supported");
+               return 0;
+       }
+
+       if (strcmp (klass->name, "RuntimeType") == 0) {
+               MonoType *type = mono_reflection_type_get_handle ((MonoReflectionType *)obj, error);
+               return_val_if_nok (error, 0);
+               MonoClass *mc = mono_class_from_mono_type (type);
+               token = mono_metadata_token_from_dor (
+                       mono_dynimage_encode_typedef_or_ref_full (assembly, type, !mono_class_is_gtd (mc) || create_open_instance));
+       } else if (strcmp (klass->name, "MonoCMethod") == 0 ||
+                          strcmp (klass->name, "MonoMethod") == 0) {
+               MonoReflectionMethod *m = (MonoReflectionMethod *)obj;
+               if (m->method->is_inflated) {
+                       if (create_open_instance)
+                               token = mono_image_get_methodspec_token (assembly, m->method);
+                       else
+                               token = mono_image_get_inflated_method_token (assembly, m->method);
+               } else if ((m->method->klass->image == &assembly->image) &&
+                        !mono_class_is_ginst (m->method->klass)) {
+                       static guint32 method_table_idx = 0xffffff;
+                       if (m->method->klass->wastypebuilder) {
+                               /* we use the same token as the one that was assigned
+                                * to the Methodbuilder.
+                                * FIXME: do the equivalent for Fields.
+                                */
+                               token = m->method->token;
+                       } else {
+                               /*
+                                * Each token should have a unique index, but the indexes are
+                                * assigned by managed code, so we don't know about them. An
+                                * easy solution is to count backwards...
+                                */
+                               method_table_idx --;
+                               token = MONO_TOKEN_METHOD_DEF | method_table_idx;
+                       }
+               } else {
+                       token = mono_image_get_methodref_token (assembly, m->method, create_open_instance);
+               }
+               /*g_print ("got token 0x%08x for %s\n", token, m->method->name);*/
+       } else if (strcmp (klass->name, "MonoField") == 0) {
+               MonoReflectionField *f = (MonoReflectionField *)obj;
+               if ((f->field->parent->image == &assembly->image) && !is_field_on_inst (f->field)) {
+                       static guint32 field_table_idx = 0xffffff;
+                       field_table_idx --;
+                       token = MONO_TOKEN_FIELD_DEF | field_table_idx;
+               } else {
+                       token = mono_image_get_fieldref_token (assembly, (MonoObject*)f, f->field);
+               }
+               /*g_print ("got token 0x%08x for %s\n", token, f->field->name);*/
+       } else if (strcmp (klass->name, "MonoArrayMethod") == 0) {
+               MonoReflectionArrayMethod *m = (MonoReflectionArrayMethod *)obj;
+               token = mono_image_get_array_token (assembly, m, error);
+               return_val_if_nok (error, 0);
+       } else if (strcmp (klass->name, "SignatureHelper") == 0) {
+               MonoReflectionSigHelper *s = (MonoReflectionSigHelper*)obj;
+               token = MONO_TOKEN_SIGNATURE | mono_image_get_sighelper_token (assembly, s, error);
+               return_val_if_nok (error, 0);
+       } else if (strcmp (klass->name, "EnumBuilder") == 0) {
+               MonoType *type = mono_reflection_type_get_handle ((MonoReflectionType *)obj, error);
+               return_val_if_nok (error, 0);
+               token = mono_metadata_token_from_dor (
+                       mono_image_typedef_or_ref (assembly, type));
+       } else {
+               g_error ("requested token for %s\n", klass->name);
+       }
+
+       if (register_token)
+               mono_image_register_token (assembly, token, obj);
+
+       return token;
+}
+
+
+#endif
+
+#ifndef DISABLE_REFLECTION_EMIT
+
+/*
+ * mono_reflection_dynimage_basic_init:
+ * @assembly: an assembly builder object
+ *
+ * Create the MonoImage that represents the assembly builder and setup some
+ * of the helper hash table and the basic metadata streams.
+ */
+void
+mono_reflection_dynimage_basic_init (MonoReflectionAssemblyBuilder *assemblyb)
+{
+       MonoError error;
+       MonoDynamicAssembly *assembly;
+       MonoDynamicImage *image;
+       MonoDomain *domain = mono_object_domain (assemblyb);
+       
+       if (assemblyb->dynamic_assembly)
+               return;
+
+#if HAVE_BOEHM_GC
+       /* assembly->assembly.image might be GC allocated */
+       assembly = assemblyb->dynamic_assembly = (MonoDynamicAssembly *)GC_MALLOC (sizeof (MonoDynamicAssembly));
+#else
+       assembly = assemblyb->dynamic_assembly = g_new0 (MonoDynamicAssembly, 1);
+#endif
+
+       mono_profiler_assembly_event (&assembly->assembly, MONO_PROFILE_START_LOAD);
+       
+       assembly->assembly.ref_count = 1;
+       assembly->assembly.dynamic = TRUE;
+       assembly->assembly.corlib_internal = assemblyb->corlib_internal;
+       assemblyb->assembly.assembly = (MonoAssembly*)assembly;
+       assembly->assembly.basedir = mono_string_to_utf8_checked (assemblyb->dir, &error);
+       if (mono_error_set_pending_exception (&error))
+               return;
+       if (assemblyb->culture) {
+               assembly->assembly.aname.culture = mono_string_to_utf8_checked (assemblyb->culture, &error);
+               if (mono_error_set_pending_exception (&error))
+                       return;
+       } else
+               assembly->assembly.aname.culture = g_strdup ("");
+
+        if (assemblyb->version) {
+                       char *vstr = mono_string_to_utf8_checked (assemblyb->version, &error);
+                       if (mono_error_set_pending_exception (&error))
+                               return;
+                       char **version = g_strsplit (vstr, ".", 4);
+                       char **parts = version;
+                       assembly->assembly.aname.major = atoi (*parts++);
+                       assembly->assembly.aname.minor = atoi (*parts++);
+                       assembly->assembly.aname.build = *parts != NULL ? atoi (*parts++) : 0;
+                       assembly->assembly.aname.revision = *parts != NULL ? atoi (*parts) : 0;
+
+                       g_strfreev (version);
+                       g_free (vstr);
+        } else {
+                       assembly->assembly.aname.major = 0;
+                       assembly->assembly.aname.minor = 0;
+                       assembly->assembly.aname.build = 0;
+                       assembly->assembly.aname.revision = 0;
+        }
+
+       assembly->run = assemblyb->access != 2;
+       assembly->save = assemblyb->access != 1;
+       assembly->domain = domain;
+
+       char *assembly_name = mono_string_to_utf8_checked (assemblyb->name, &error);
+       if (mono_error_set_pending_exception (&error))
+               return;
+       image = mono_dynamic_image_create (assembly, assembly_name, g_strdup ("RefEmit_YouForgotToDefineAModule"));
+       image->initial_image = TRUE;
+       assembly->assembly.aname.name = image->image.name;
+       assembly->assembly.image = &image->image;
+       if (assemblyb->pktoken && assemblyb->pktoken->max_length) {
+               /* -1 to correct for the trailing NULL byte */
+               if (assemblyb->pktoken->max_length != MONO_PUBLIC_KEY_TOKEN_LENGTH - 1) {
+                       g_error ("Public key token length invalid for assembly %s: %i", assembly->assembly.aname.name, assemblyb->pktoken->max_length);
+               }
+               memcpy (&assembly->assembly.aname.public_key_token, mono_array_addr (assemblyb->pktoken, guint8, 0), assemblyb->pktoken->max_length);           
+       }
+
+       mono_domain_assemblies_lock (domain);
+       domain->domain_assemblies = g_slist_append (domain->domain_assemblies, assembly);
+       mono_domain_assemblies_unlock (domain);
+
+       register_assembly (mono_object_domain (assemblyb), &assemblyb->assembly, &assembly->assembly);
+       
+       mono_profiler_assembly_loaded (&assembly->assembly, MONO_PROFILE_OK);
+       
+       mono_assembly_invoke_load_hook ((MonoAssembly*)assembly);
+}
+
+#endif /* !DISABLE_REFLECTION_EMIT */
+
+#ifndef DISABLE_REFLECTION_EMIT
+static gpointer
+register_assembly (MonoDomain *domain, MonoReflectionAssembly *res, MonoAssembly *assembly)
+{
+       CACHE_OBJECT (MonoReflectionAssembly *, assembly, res, NULL);
+}
+
+static gpointer
+register_module (MonoDomain *domain, MonoReflectionModuleBuilder *res, MonoDynamicImage *module)
+{
+       CACHE_OBJECT (MonoReflectionModuleBuilder *, module, res, NULL);
+}
+
+static gboolean
+image_module_basic_init (MonoReflectionModuleBuilder *moduleb, MonoError *error)
+{
+       MonoDynamicImage *image = moduleb->dynamic_image;
+       MonoReflectionAssemblyBuilder *ab = moduleb->assemblyb;
+       mono_error_init (error);
+       if (!image) {
+               int module_count;
+               MonoImage **new_modules;
+               MonoImage *ass;
+               char *name, *fqname;
+               /*
+                * FIXME: we already created an image in mono_reflection_dynimage_basic_init (), but
+                * we don't know which module it belongs to, since that is only 
+                * determined at assembly save time.
+                */
+               /*image = (MonoDynamicImage*)ab->dynamic_assembly->assembly.image; */
+               name = mono_string_to_utf8_checked (ab->name, error);
+               return_val_if_nok (error, FALSE);
+               fqname = mono_string_to_utf8_checked (moduleb->module.fqname, error);
+               if (!is_ok (error)) {
+                       g_free (name);
+                       return FALSE;
+               }
+               image = mono_dynamic_image_create (ab->dynamic_assembly, name, fqname);
+
+               moduleb->module.image = &image->image;
+               moduleb->dynamic_image = image;
+               register_module (mono_object_domain (moduleb), moduleb, image);
+
+               /* register the module with the assembly */
+               ass = ab->dynamic_assembly->assembly.image;
+               module_count = ass->module_count;
+               new_modules = g_new0 (MonoImage *, module_count + 1);
+
+               if (ass->modules)
+                       memcpy (new_modules, ass->modules, module_count * sizeof (MonoImage *));
+               new_modules [module_count] = &image->image;
+               mono_image_addref (&image->image);
+
+               g_free (ass->modules);
+               ass->modules = new_modules;
+               ass->module_count ++;
+       }
+       return TRUE;
+}
+
+static void
+mono_image_module_basic_init (MonoReflectionModuleBuilder *moduleb)
+{
+       MonoError error;
+       (void) image_module_basic_init (moduleb, &error);
+       mono_error_set_pending_exception (&error);
+}
+
+#endif
+
+static gboolean
+is_corlib_type (MonoClass *klass)
+{
+       return klass->image == mono_defaults.corlib;
+}
+
+#define check_corlib_type_cached(_class, _namespace, _name) do { \
+       static MonoClass *cached_class; \
+       if (cached_class) \
+               return cached_class == _class; \
+       if (is_corlib_type (_class) && !strcmp (_name, _class->name) && !strcmp (_namespace, _class->name_space)) { \
+               cached_class = _class; \
+               return TRUE; \
+       } \
+       return FALSE; \
+} while (0) \
+
+
+
+#ifndef DISABLE_REFLECTION_EMIT
+static gboolean
+is_sre_array (MonoClass *klass)
+{
+       check_corlib_type_cached (klass, "System.Reflection.Emit", "ArrayType");
+}
+
+static gboolean
+is_sre_byref (MonoClass *klass)
+{
+       check_corlib_type_cached (klass, "System.Reflection.Emit", "ByRefType");
+}
+
+static gboolean
+is_sre_pointer (MonoClass *klass)
+{
+       check_corlib_type_cached (klass, "System.Reflection.Emit", "PointerType");
+}
+
+static gboolean
+is_sre_generic_instance (MonoClass *klass)
+{
+       check_corlib_type_cached (klass, "System.Reflection.Emit", "TypeBuilderInstantiation");
+}
+
+static gboolean
+is_sre_type_builder (MonoClass *klass)
+{
+       check_corlib_type_cached (klass, "System.Reflection.Emit", "TypeBuilder");
+}
+
+static gboolean
+is_sre_method_builder (MonoClass *klass)
+{
+       check_corlib_type_cached (klass, "System.Reflection.Emit", "MethodBuilder");
+}
+
+gboolean
+mono_is_sre_ctor_builder (MonoClass *klass)
+{
+       check_corlib_type_cached (klass, "System.Reflection.Emit", "ConstructorBuilder");
+}
+
+static gboolean
+is_sre_field_builder (MonoClass *klass)
+{
+       check_corlib_type_cached (klass, "System.Reflection.Emit", "FieldBuilder");
+}
+
+static gboolean
+is_sre_gparam_builder (MonoClass *klass)
+{
+       check_corlib_type_cached (klass, "System.Reflection.Emit", "GenericTypeParameterBuilder");
+}
+
+static gboolean
+is_sre_enum_builder (MonoClass *klass)
+{
+       check_corlib_type_cached (klass, "System.Reflection.Emit", "EnumBuilder");
+}
+
+gboolean
+mono_is_sre_method_on_tb_inst (MonoClass *klass)
+{
+       check_corlib_type_cached (klass, "System.Reflection.Emit", "MethodOnTypeBuilderInst");
+}
+
+gboolean
+mono_is_sre_ctor_on_tb_inst (MonoClass *klass)
+{
+       check_corlib_type_cached (klass, "System.Reflection.Emit", "ConstructorOnTypeBuilderInst");
+}
+
+static MonoReflectionType*
+mono_reflection_type_get_underlying_system_type (MonoReflectionType* t, MonoError *error)
+{
+       static MonoMethod *method_get_underlying_system_type = NULL;
+       MonoReflectionType *rt;
+       MonoMethod *usertype_method;
+
+       mono_error_init (error);
+
+       if (!method_get_underlying_system_type)
+               method_get_underlying_system_type = mono_class_get_method_from_name (mono_defaults.systemtype_class, "get_UnderlyingSystemType", 0);
+
+       usertype_method = mono_object_get_virtual_method ((MonoObject *) t, method_get_underlying_system_type);
+
+       rt = (MonoReflectionType *) mono_runtime_invoke_checked (usertype_method, t, NULL, error);
+
+       return rt;
+}
+
+MonoType*
+mono_reflection_type_get_handle (MonoReflectionType* ref, MonoError *error)
+{
+       MonoClass *klass;
+       mono_error_init (error);
+
+       if (!ref)
+               return NULL;
+       if (ref->type)
+               return ref->type;
+
+       if (mono_reflection_is_usertype (ref)) {
+               ref = mono_reflection_type_get_underlying_system_type (ref, error);
+               if (ref == NULL || mono_reflection_is_usertype (ref) || !is_ok (error))
+                       return NULL;
+               if (ref->type)
+                       return ref->type;
+       }
+
+       klass = mono_object_class (ref);
+
+       if (is_sre_array (klass)) {
+               MonoType *res;
+               MonoReflectionArrayType *sre_array = (MonoReflectionArrayType*)ref;
+               MonoType *base = mono_reflection_type_get_handle (sre_array->element_type, error);
+               return_val_if_nok (error, NULL);
+               g_assert (base);
+               if (sre_array->rank == 0) //single dimentional array
+                       res = &mono_array_class_get (mono_class_from_mono_type (base), 1)->byval_arg;
+               else
+                       res = &mono_bounded_array_class_get (mono_class_from_mono_type (base), sre_array->rank, TRUE)->byval_arg;
+               sre_array->type.type = res;
+               return res;
+       } else if (is_sre_byref (klass)) {
+               MonoType *res;
+               MonoReflectionDerivedType *sre_byref = (MonoReflectionDerivedType*)ref;
+               MonoType *base = mono_reflection_type_get_handle (sre_byref->element_type, error);
+               return_val_if_nok (error, NULL);
+               g_assert (base);
+               res = &mono_class_from_mono_type (base)->this_arg;
+               sre_byref->type.type = res;
+               return res;
+       } else if (is_sre_pointer (klass)) {
+               MonoType *res;
+               MonoReflectionDerivedType *sre_pointer = (MonoReflectionDerivedType*)ref;
+               MonoType *base = mono_reflection_type_get_handle (sre_pointer->element_type, error);
+               return_val_if_nok (error, NULL);
+               g_assert (base);
+               res = &mono_ptr_class_get (base)->byval_arg;
+               sre_pointer->type.type = res;
+               return res;
+       } else if (is_sre_generic_instance (klass)) {
+               MonoType *res, **types;
+               MonoReflectionGenericClass *gclass = (MonoReflectionGenericClass*)ref;
+               int i, count;
+
+               count = mono_array_length (gclass->type_arguments);
+               types = g_new0 (MonoType*, count);
+               for (i = 0; i < count; ++i) {
+                       MonoReflectionType *t = (MonoReflectionType *)mono_array_get (gclass->type_arguments, gpointer, i);
+                       types [i] = mono_reflection_type_get_handle (t, error);
+                       if (!types[i] || !is_ok (error)) {
+                               g_free (types);
+                               return NULL;
+                       }
+               }
+
+               res = mono_reflection_bind_generic_parameters (gclass->generic_type, count, types, error);
+               g_free (types);
+               g_assert (res);
+               gclass->type.type = res;
+               return res;
+       } else if (is_sre_gparam_builder (klass)) {
+               MonoReflectionGenericParam *gparam = (MonoReflectionGenericParam *)ref;
+               MonoGenericParamFull *param;
+               MonoImage *image;
+               MonoClass *pklass;
+
+               image = &gparam->tbuilder->module->dynamic_image->image;
+
+               param = mono_image_new0 (image, MonoGenericParamFull, 1);
+
+               param->info.name = mono_string_to_utf8_image (image, gparam->name, error);
+               mono_error_assert_ok (error);
+               param->param.num = gparam->index;
+
+               if (gparam->mbuilder) {
+                       if (!gparam->mbuilder->generic_container) {
+                               gparam->mbuilder->generic_container = (MonoGenericContainer *)mono_image_alloc0 (image, sizeof (MonoGenericContainer));
+                               gparam->mbuilder->generic_container->is_method = TRUE;
+                               /*
+                                * Cannot set owner.method, since the MonoMethod is not created yet.
+                                * Set the image field instead, so type_in_image () works.
+                                */
+                               gparam->mbuilder->generic_container->is_anonymous = TRUE;
+                               gparam->mbuilder->generic_container->owner.image = image;
+                       }
+                       param->param.owner = gparam->mbuilder->generic_container;
+               } else if (gparam->tbuilder) {
+                       MonoType *type = mono_reflection_type_get_handle ((MonoReflectionType*)(gparam->tbuilder), error);
+                       mono_error_assert_ok (error);
+                       MonoClass *owner = mono_class_from_mono_type (type);
+                       g_assert (mono_class_is_gtd (owner));
+                       param->param.owner = mono_class_get_generic_container (owner);
+               }
+
+               pklass = mono_class_from_generic_parameter_internal ((MonoGenericParam *) param);
+
+               gparam->type.type = &pklass->byval_arg;
+
+               mono_class_set_ref_info (pklass, gparam);
+               mono_image_append_class_to_reflection_info_set (pklass);
+
+               return &pklass->byval_arg;
+       } else if (is_sre_enum_builder (klass)) {
+               MonoReflectionEnumBuilder *ebuilder = (MonoReflectionEnumBuilder *)ref;
+
+               return mono_reflection_type_get_handle ((MonoReflectionType*)ebuilder->tb, error);
+       } else if (is_sre_type_builder (klass)) {
+               MonoReflectionTypeBuilder *tb = (MonoReflectionTypeBuilder*)ref;
+
+               /* This happens when a finished type references an unfinished one. Have to create the minimal type */
+               reflection_setup_internal_class (tb, error);
+               mono_error_assert_ok (error);
+               g_assert (ref->type);
+               return ref->type;
+       }
+
+       g_error ("Cannot handle corlib user type %s", mono_type_full_name (&mono_object_class(ref)->byval_arg));
+       return NULL;
+}
+
+/**
+ * LOCKING: Assumes the loader lock is held.
+ */
+static MonoMethodSignature*
+parameters_to_signature (MonoImage *image, MonoArray *parameters, MonoError *error) {
+       MonoMethodSignature *sig;
+       int count, i;
+
+       mono_error_init (error);
+
+       count = parameters? mono_array_length (parameters): 0;
+
+       sig = (MonoMethodSignature *)mono_image_g_malloc0 (image, MONO_SIZEOF_METHOD_SIGNATURE + sizeof (MonoType*) * count);
+       sig->param_count = count;
+       sig->sentinelpos = -1; /* FIXME */
+       for (i = 0; i < count; ++i) {
+               sig->params [i] = mono_type_array_get_and_resolve (parameters, i, error);
+               if (!is_ok (error)) {
+                       image_g_free (image, sig);
+                       return NULL;
+               }
+       }
+       return sig;
+}
+
+/**
+ * LOCKING: Assumes the loader lock is held.
+ */
+static MonoMethodSignature*
+ctor_builder_to_signature (MonoImage *image, MonoReflectionCtorBuilder *ctor, MonoError *error) {
+       MonoMethodSignature *sig;
+
+       mono_error_init (error);
+
+       sig = parameters_to_signature (image, ctor->parameters, error);
+       return_val_if_nok (error, NULL);
+       sig->hasthis = ctor->attrs & METHOD_ATTRIBUTE_STATIC? 0: 1;
+       sig->ret = &mono_defaults.void_class->byval_arg;
+       return sig;
+}
+
+/**
+ * LOCKING: Assumes the loader lock is held.
+ */
+static MonoMethodSignature*
+method_builder_to_signature (MonoImage *image, MonoReflectionMethodBuilder *method, MonoError *error) {
+       MonoMethodSignature *sig;
+
+       mono_error_init (error);
+
+       sig = parameters_to_signature (image, method->parameters, error);
+       return_val_if_nok (error, NULL);
+       sig->hasthis = method->attrs & METHOD_ATTRIBUTE_STATIC? 0: 1;
+       if (method->rtype) {
+               sig->ret = mono_reflection_type_get_handle ((MonoReflectionType*)method->rtype, error);
+               if (!is_ok (error)) {
+                       image_g_free (image, sig);
+                       return NULL;
+               }
+       } else {
+               sig->ret = &mono_defaults.void_class->byval_arg;
+       }
+       sig->generic_param_count = method->generic_params ? mono_array_length (method->generic_params) : 0;
+       return sig;
+}
+
+static MonoMethodSignature*
+dynamic_method_to_signature (MonoReflectionDynamicMethod *method, MonoError *error) {
+       MonoMethodSignature *sig;
+
+       mono_error_init (error);
+
+       sig = parameters_to_signature (NULL, method->parameters, error);
+       return_val_if_nok (error, NULL);
+       sig->hasthis = method->attrs & METHOD_ATTRIBUTE_STATIC? 0: 1;
+       if (method->rtype) {
+               sig->ret = mono_reflection_type_get_handle (method->rtype, error);
+               if (!is_ok (error)) {
+                       g_free (sig);
+                       return NULL;
+               }
+       } else {
+               sig->ret = &mono_defaults.void_class->byval_arg;
+       }
+       sig->generic_param_count = 0;
+       return sig;
+}
+
+static void
+get_prop_name_and_type (MonoObject *prop, char **name, MonoType **type, MonoError *error)
+{
+       mono_error_init (error);
+       MonoClass *klass = mono_object_class (prop);
+       if (strcmp (klass->name, "PropertyBuilder") == 0) {
+               MonoReflectionPropertyBuilder *pb = (MonoReflectionPropertyBuilder *)prop;
+               *name = mono_string_to_utf8_checked (pb->name, error);
+               return_if_nok (error);
+               *type = mono_reflection_type_get_handle ((MonoReflectionType*)pb->type, error);
+       } else {
+               MonoReflectionProperty *p = (MonoReflectionProperty *)prop;
+               *name = g_strdup (p->property->name);
+               if (p->property->get)
+                       *type = mono_method_signature (p->property->get)->ret;
+               else
+                       *type = mono_method_signature (p->property->set)->params [mono_method_signature (p->property->set)->param_count - 1];
+       }
+}
+
+static void
+get_field_name_and_type (MonoObject *field, char **name, MonoType **type, MonoError *error)
+{
+       mono_error_init (error);
+       MonoClass *klass = mono_object_class (field);
+       if (strcmp (klass->name, "FieldBuilder") == 0) {
+               MonoReflectionFieldBuilder *fb = (MonoReflectionFieldBuilder *)field;
+               *name = mono_string_to_utf8_checked (fb->name, error);
+               return_if_nok (error);
+               *type = mono_reflection_type_get_handle ((MonoReflectionType*)fb->type, error);
+       } else {
+               MonoReflectionField *f = (MonoReflectionField *)field;
+               *name = g_strdup (mono_field_get_name (f->field));
+               *type = f->field->type;
+       }
+}
+
+#else /* DISABLE_REFLECTION_EMIT */
+
+static gboolean
+is_sre_type_builder (MonoClass *klass)
+{
+       return FALSE;
+}
+
+static gboolean
+is_sre_generic_instance (MonoClass *klass)
+{
+       return FALSE;
+}
+
+gboolean
+mono_is_sre_ctor_builder (MonoClass *klass)
+{
+       return FALSE;
+}
+
+gboolean
+mono_is_sre_method_on_tb_inst (MonoClass *klass)
+{
+       return FALSE;
+}
+
+gboolean
+mono_is_sre_ctor_on_tb_inst (MonoClass *klass)
+{
+       return FALSE;
+}
+
+#endif /* !DISABLE_REFLECTION_EMIT */
+
+
+static gboolean
+is_sr_mono_field (MonoClass *klass)
+{
+       check_corlib_type_cached (klass, "System.Reflection", "MonoField");
+}
+
+gboolean
+mono_is_sr_mono_property (MonoClass *klass)
+{
+       check_corlib_type_cached (klass, "System.Reflection", "MonoProperty");
+}
+
+static gboolean
+is_sr_mono_method (MonoClass *klass)
+{
+       check_corlib_type_cached (klass, "System.Reflection", "MonoMethod");
+}
+
+gboolean
+mono_is_sr_mono_cmethod (MonoClass *klass)
+{
+       check_corlib_type_cached (klass, "System.Reflection", "MonoCMethod");
+}
+
+gboolean
+mono_class_is_reflection_method_or_constructor (MonoClass *klass)
+{
+       return is_sr_mono_method (klass) || mono_is_sr_mono_cmethod (klass);
+}
+
+gboolean
+mono_is_sre_type_builder (MonoClass *klass)
+{
+       return is_sre_type_builder (klass);
+}
+
+gboolean
+mono_is_sre_generic_instance (MonoClass *klass)
+{
+       return is_sre_generic_instance (klass);
+}
+
+
+
+/**
+ * encode_cattr_value:
+ * Encode a value in a custom attribute stream of bytes.
+ * The value to encode is either supplied as an object in argument val
+ * (valuetypes are boxed), or as a pointer to the data in the
+ * argument argval.
+ * @type represents the type of the value
+ * @buffer is the start of the buffer
+ * @p the current position in the buffer
+ * @buflen contains the size of the buffer and is used to return the new buffer size
+ * if this needs to be realloced.
+ * @retbuffer and @retp return the start and the position of the buffer
+ * @error set on error.
+ */
+static void
+encode_cattr_value (MonoAssembly *assembly, char *buffer, char *p, char **retbuffer, char **retp, guint32 *buflen, MonoType *type, MonoObject *arg, char *argval, MonoError *error)
+{
+       MonoTypeEnum simple_type;
+       
+       mono_error_init (error);
+       if ((p-buffer) + 10 >= *buflen) {
+               char *newbuf;
+               *buflen *= 2;
+               newbuf = (char *)g_realloc (buffer, *buflen);
+               p = newbuf + (p-buffer);
+               buffer = newbuf;
+       }
+       if (!argval)
+               argval = ((char*)arg + sizeof (MonoObject));
+       simple_type = type->type;
+handle_enum:
+       switch (simple_type) {
+       case MONO_TYPE_BOOLEAN:
+       case MONO_TYPE_U1:
+       case MONO_TYPE_I1:
+               *p++ = *argval;
+               break;
+       case MONO_TYPE_CHAR:
+       case MONO_TYPE_U2:
+       case MONO_TYPE_I2:
+               swap_with_size (p, argval, 2, 1);
+               p += 2;
+               break;
+       case MONO_TYPE_U4:
+       case MONO_TYPE_I4:
+       case MONO_TYPE_R4:
+               swap_with_size (p, argval, 4, 1);
+               p += 4;
+               break;
+       case MONO_TYPE_R8:
+               swap_with_size (p, argval, 8, 1);
+               p += 8;
+               break;
+       case MONO_TYPE_U8:
+       case MONO_TYPE_I8:
+               swap_with_size (p, argval, 8, 1);
+               p += 8;
+               break;
+       case MONO_TYPE_VALUETYPE:
+               if (type->data.klass->enumtype) {
+                       simple_type = mono_class_enum_basetype (type->data.klass)->type;
+                       goto handle_enum;
+               } else {
+                       g_warning ("generic valutype %s not handled in custom attr value decoding", type->data.klass->name);
+               }
+               break;
+       case MONO_TYPE_STRING: {
+               char *str;
+               guint32 slen;
+               if (!arg) {
+                       *p++ = 0xFF;
+                       break;
+               }
+               str = mono_string_to_utf8_checked ((MonoString*)arg, error);
+               return_if_nok (error);
+               slen = strlen (str);
+               if ((p-buffer) + 10 + slen >= *buflen) {
+                       char *newbuf;
+                       *buflen *= 2;
+                       *buflen += slen;
+                       newbuf = (char *)g_realloc (buffer, *buflen);
+                       p = newbuf + (p-buffer);
+                       buffer = newbuf;
+               }
+               mono_metadata_encode_value (slen, p, &p);
+               memcpy (p, str, slen);
+               p += slen;
+               g_free (str);
+               break;
+       }
+       case MONO_TYPE_CLASS: {
+               char *str;
+               guint32 slen;
+               MonoType *arg_type;
+               if (!arg) {
+                       *p++ = 0xFF;
+                       break;
+               }
+handle_type:
+               arg_type = mono_reflection_type_get_handle ((MonoReflectionType*)arg, error);
+               return_if_nok (error);
+
+               str = type_get_qualified_name (arg_type, NULL);
+               slen = strlen (str);
+               if ((p-buffer) + 10 + slen >= *buflen) {
+                       char *newbuf;
+                       *buflen *= 2;
+                       *buflen += slen;
+                       newbuf = (char *)g_realloc (buffer, *buflen);
+                       p = newbuf + (p-buffer);
+                       buffer = newbuf;
+               }
+               mono_metadata_encode_value (slen, p, &p);
+               memcpy (p, str, slen);
+               p += slen;
+               g_free (str);
+               break;
+       }
+       case MONO_TYPE_SZARRAY: {
+               int len, i;
+               MonoClass *eclass, *arg_eclass;
+
+               if (!arg) {
+                       *p++ = 0xff; *p++ = 0xff; *p++ = 0xff; *p++ = 0xff;
+                       break;
+               }
+               len = mono_array_length ((MonoArray*)arg);
+               *p++ = len & 0xff;
+               *p++ = (len >> 8) & 0xff;
+               *p++ = (len >> 16) & 0xff;
+               *p++ = (len >> 24) & 0xff;
+               *retp = p;
+               *retbuffer = buffer;
+               eclass = type->data.klass;
+               arg_eclass = mono_object_class (arg)->element_class;
+
+               if (!eclass) {
+                       /* Happens when we are called from the MONO_TYPE_OBJECT case below */
+                       eclass = mono_defaults.object_class;
+               }
+               if (eclass == mono_defaults.object_class && arg_eclass->valuetype) {
+                       char *elptr = mono_array_addr ((MonoArray*)arg, char, 0);
+                       int elsize = mono_class_array_element_size (arg_eclass);
+                       for (i = 0; i < len; ++i) {
+                               encode_cattr_value (assembly, buffer, p, &buffer, &p, buflen, &arg_eclass->byval_arg, NULL, elptr, error);
+                               return_if_nok (error);
+                               elptr += elsize;
+                       }
+               } else if (eclass->valuetype && arg_eclass->valuetype) {
+                       char *elptr = mono_array_addr ((MonoArray*)arg, char, 0);
+                       int elsize = mono_class_array_element_size (eclass);
+                       for (i = 0; i < len; ++i) {
+                               encode_cattr_value (assembly, buffer, p, &buffer, &p, buflen, &eclass->byval_arg, NULL, elptr, error);
+                               return_if_nok (error);
+                               elptr += elsize;
+                       }
+               } else {
+                       for (i = 0; i < len; ++i) {
+                               encode_cattr_value (assembly, buffer, p, &buffer, &p, buflen, &eclass->byval_arg, mono_array_get ((MonoArray*)arg, MonoObject*, i), NULL, error);
+                               return_if_nok (error);
+                       }
+               }
+               break;
+       }
+       case MONO_TYPE_OBJECT: {
+               MonoClass *klass;
+               char *str;
+               guint32 slen;
+
+               /*
+                * The parameter type is 'object' but the type of the actual
+                * argument is not. So we have to add type information to the blob
+                * too. This is completely undocumented in the spec.
+                */
+
+               if (arg == NULL) {
+                       *p++ = MONO_TYPE_STRING;        // It's same hack as MS uses
+                       *p++ = 0xFF;
+                       break;
+               }
+               
+               klass = mono_object_class (arg);
+
+               if (mono_object_isinst_checked (arg, mono_defaults.systemtype_class, error)) {
+                       *p++ = 0x50;
+                       goto handle_type;
+               } else {
+                       return_if_nok (error);
+               }
+
+               if (klass->enumtype) {
+                       *p++ = 0x55;
+               } else if (klass == mono_defaults.string_class) {
+                       simple_type = MONO_TYPE_STRING;
+                       *p++ = 0x0E;
+                       goto handle_enum;
+               } else if (klass->rank == 1) {
+                       *p++ = 0x1D;
+                       if (klass->element_class->byval_arg.type == MONO_TYPE_OBJECT)
+                               /* See Partition II, Appendix B3 */
+                               *p++ = 0x51;
+                       else
+                               *p++ = klass->element_class->byval_arg.type;
+                       encode_cattr_value (assembly, buffer, p, &buffer, &p, buflen, &klass->byval_arg, arg, NULL, error);
+                       return_if_nok (error);
+                       break;
+               } else if (klass->byval_arg.type >= MONO_TYPE_BOOLEAN && klass->byval_arg.type <= MONO_TYPE_R8) {
+                       *p++ = simple_type = klass->byval_arg.type;
+                       goto handle_enum;
+               } else {
+                       g_error ("unhandled type in custom attr");
+               }
+               str = type_get_qualified_name (mono_class_get_type(klass), NULL);
+               slen = strlen (str);
+               if ((p-buffer) + 10 + slen >= *buflen) {
+                       char *newbuf;
+                       *buflen *= 2;
+                       *buflen += slen;
+                       newbuf = (char *)g_realloc (buffer, *buflen);
+                       p = newbuf + (p-buffer);
+                       buffer = newbuf;
+               }
+               mono_metadata_encode_value (slen, p, &p);
+               memcpy (p, str, slen);
+               p += slen;
+               g_free (str);
+               simple_type = mono_class_enum_basetype (klass)->type;
+               goto handle_enum;
+       }
+       default:
+               g_error ("type 0x%02x not yet supported in custom attr encoder", simple_type);
+       }
+       *retp = p;
+       *retbuffer = buffer;
+}
+
+static void
+encode_field_or_prop_type (MonoType *type, char *p, char **retp)
+{
+       if (type->type == MONO_TYPE_VALUETYPE && type->data.klass->enumtype) {
+               char *str = type_get_qualified_name (type, NULL);
+               int slen = strlen (str);
+
+               *p++ = 0x55;
+               /*
+                * This seems to be optional...
+                * *p++ = 0x80;
+                */
+               mono_metadata_encode_value (slen, p, &p);
+               memcpy (p, str, slen);
+               p += slen;
+               g_free (str);
+       } else if (type->type == MONO_TYPE_OBJECT) {
+               *p++ = 0x51;
+       } else if (type->type == MONO_TYPE_CLASS) {
+               /* it should be a type: encode_cattr_value () has the check */
+               *p++ = 0x50;
+       } else {
+               mono_metadata_encode_value (type->type, p, &p);
+               if (type->type == MONO_TYPE_SZARRAY)
+                       /* See the examples in Partition VI, Annex B */
+                       encode_field_or_prop_type (&type->data.klass->byval_arg, p, &p);
+       }
+
+       *retp = p;
+}
+
+#ifndef DISABLE_REFLECTION_EMIT
+static void
+encode_named_val (MonoReflectionAssembly *assembly, char *buffer, char *p, char **retbuffer, char **retp, guint32 *buflen, MonoType *type, char *name, MonoObject *value, MonoError *error)
+{
+       int len;
+
+       mono_error_init (error);
+
+       /* Preallocate a large enough buffer */
+       if (type->type == MONO_TYPE_VALUETYPE && type->data.klass->enumtype) {
+               char *str = type_get_qualified_name (type, NULL);
+               len = strlen (str);
+               g_free (str);
+       } else if (type->type == MONO_TYPE_SZARRAY && type->data.klass->enumtype) {
+               char *str = type_get_qualified_name (&type->data.klass->byval_arg, NULL);
+               len = strlen (str);
+               g_free (str);
+       } else {
+               len = 0;
+       }
+       len += strlen (name);
+
+       if ((p-buffer) + 20 + len >= *buflen) {
+               char *newbuf;
+               *buflen *= 2;
+               *buflen += len;
+               newbuf = (char *)g_realloc (buffer, *buflen);
+               p = newbuf + (p-buffer);
+               buffer = newbuf;
+       }
+
+       encode_field_or_prop_type (type, p, &p);
+
+       len = strlen (name);
+       mono_metadata_encode_value (len, p, &p);
+       memcpy (p, name, len);
+       p += len;
+       encode_cattr_value (assembly->assembly, buffer, p, &buffer, &p, buflen, type, value, NULL, error);
+       return_if_nok (error);
+       *retp = p;
+       *retbuffer = buffer;
+}
+
+/**
+ * mono_reflection_get_custom_attrs_blob:
+ * @ctor: custom attribute constructor
+ * @ctorArgs: arguments o the constructor
+ * @properties:
+ * @propValues:
+ * @fields:
+ * @fieldValues:
+ * 
+ * Creates the blob of data that needs to be saved in the metadata and that represents
+ * the custom attributed described by @ctor, @ctorArgs etc.
+ * Returns: a Byte array representing the blob of data.
+ */
+MonoArray*
+mono_reflection_get_custom_attrs_blob (MonoReflectionAssembly *assembly, MonoObject *ctor, MonoArray *ctorArgs, MonoArray *properties, MonoArray *propValues, MonoArray *fields, MonoArray* fieldValues) 
+{
+       MonoError error;
+       MonoArray *result = mono_reflection_get_custom_attrs_blob_checked (assembly, ctor, ctorArgs, properties, propValues, fields, fieldValues, &error);
+       mono_error_cleanup (&error);
+       return result;
+}
+
+/**
+ * mono_reflection_get_custom_attrs_blob_checked:
+ * @ctor: custom attribute constructor
+ * @ctorArgs: arguments o the constructor
+ * @properties:
+ * @propValues:
+ * @fields:
+ * @fieldValues:
+ * @error: set on error
+ * 
+ * Creates the blob of data that needs to be saved in the metadata and that represents
+ * the custom attributed described by @ctor, @ctorArgs etc.
+ * Returns: a Byte array representing the blob of data.  On failure returns NULL and sets @error.
+ */
+MonoArray*
+mono_reflection_get_custom_attrs_blob_checked (MonoReflectionAssembly *assembly, MonoObject *ctor, MonoArray *ctorArgs, MonoArray *properties, MonoArray *propValues, MonoArray *fields, MonoArray* fieldValues, MonoError *error) 
+{
+       MonoArray *result = NULL;
+       MonoMethodSignature *sig;
+       MonoObject *arg;
+       char *buffer, *p;
+       guint32 buflen, i;
+
+       mono_error_init (error);
+
+       if (strcmp (ctor->vtable->klass->name, "MonoCMethod")) {
+               /* sig is freed later so allocate it in the heap */
+               sig = ctor_builder_to_signature (NULL, (MonoReflectionCtorBuilder*)ctor, error);
+               if (!is_ok (error)) {
+                       g_free (sig);
+                       return NULL;
+               }
+       } else {
+               sig = mono_method_signature (((MonoReflectionMethod*)ctor)->method);
+       }
+
+       g_assert (mono_array_length (ctorArgs) == sig->param_count);
+       buflen = 256;
+       p = buffer = (char *)g_malloc (buflen);
+       /* write the prolog */
+       *p++ = 1;
+       *p++ = 0;
+       for (i = 0; i < sig->param_count; ++i) {
+               arg = mono_array_get (ctorArgs, MonoObject*, i);
+               encode_cattr_value (assembly->assembly, buffer, p, &buffer, &p, &buflen, sig->params [i], arg, NULL, error);
+               if (!is_ok (error)) goto leave;
+       }
+       i = 0;
+       if (properties)
+               i += mono_array_length (properties);
+       if (fields)
+               i += mono_array_length (fields);
+       *p++ = i & 0xff;
+       *p++ = (i >> 8) & 0xff;
+       if (properties) {
+               MonoObject *prop;
+               for (i = 0; i < mono_array_length (properties); ++i) {
+                       MonoType *ptype;
+                       char *pname;
+
+                       prop = (MonoObject *)mono_array_get (properties, gpointer, i);
+                       get_prop_name_and_type (prop, &pname, &ptype, error);
+                       if (!is_ok (error)) goto leave;
+                       *p++ = 0x54; /* PROPERTY signature */
+                       encode_named_val (assembly, buffer, p, &buffer, &p, &buflen, ptype, pname, (MonoObject*)mono_array_get (propValues, gpointer, i), error);
+                       g_free (pname);
+                       if (!is_ok (error)) goto leave;
+               }
+       }
+
+       if (fields) {
+               MonoObject *field;
+               for (i = 0; i < mono_array_length (fields); ++i) {
+                       MonoType *ftype;
+                       char *fname;
+
+                       field = (MonoObject *)mono_array_get (fields, gpointer, i);
+                       get_field_name_and_type (field, &fname, &ftype, error);
+                       if (!is_ok (error)) goto leave;
+                       *p++ = 0x53; /* FIELD signature */
+                       encode_named_val (assembly, buffer, p, &buffer, &p, &buflen, ftype, fname, (MonoObject*)mono_array_get (fieldValues, gpointer, i), error);
+                       g_free (fname);
+                       if (!is_ok (error)) goto leave;
+               }
+       }
+
+       g_assert (p - buffer <= buflen);
+       buflen = p - buffer;
+       result = mono_array_new_checked (mono_domain_get (), mono_defaults.byte_class, buflen, error);
+       if (!is_ok (error))
+               goto leave;
+       p = mono_array_addr (result, char, 0);
+       memcpy (p, buffer, buflen);
+leave:
+       g_free (buffer);
+       if (strcmp (ctor->vtable->klass->name, "MonoCMethod"))
+               g_free (sig);
+       return result;
+}
+
+/**
+ * reflection_setup_internal_class:
+ * @tb: a TypeBuilder object
+ * @error: set on error
+ *
+ * Creates a MonoClass that represents the TypeBuilder.
+ * This is a trick that lets us simplify a lot of reflection code
+ * (and will allow us to support Build and Run assemblies easier).
+ *
+ * Returns TRUE on success. On failure, returns FALSE and sets @error.
+ */
+static gboolean
+reflection_setup_internal_class (MonoReflectionTypeBuilder *tb, MonoError *error)
+{
+       MonoClass *klass, *parent;
+
+       mono_error_init (error);
+
+       mono_loader_lock ();
+
+       if (tb->parent) {
+               MonoType *parent_type = mono_reflection_type_get_handle ((MonoReflectionType*)tb->parent, error);
+               if (!is_ok (error)) {
+                       mono_loader_unlock ();
+                       return FALSE;
+               }
+               /* check so we can compile corlib correctly */
+               if (strcmp (mono_object_class (tb->parent)->name, "TypeBuilder") == 0) {
+                       /* mono_class_setup_mono_type () guaranteess type->data.klass is valid */
+                       parent = parent_type->data.klass;
+               } else {
+                       parent = mono_class_from_mono_type (parent_type);
+               }
+       } else {
+               parent = NULL;
+       }
+       
+       /* the type has already being created: it means we just have to change the parent */
+       if (tb->type.type) {
+               klass = mono_class_from_mono_type (tb->type.type);
+               klass->parent = NULL;
+               /* fool mono_class_setup_parent */
+               klass->supertypes = NULL;
+               mono_class_setup_parent (klass, parent);
+               mono_class_setup_mono_type (klass);
+               mono_loader_unlock ();
+               return TRUE;
+       }
+
+       /*
+        * The size calculation here warrants some explaining. 
+        * reflection_setup_internal_class is called too early, well before we know whether the type will be a GTD or DEF,
+        * meaning we need to alloc enough space to morth a def into a gtd.
+        */
+       klass = (MonoClass *)mono_image_alloc0 (&tb->module->dynamic_image->image, MAX (sizeof (MonoClassDef), sizeof (MonoClassGtd)));
+       klass->class_kind = MONO_CLASS_DEF;
+
+       klass->image = &tb->module->dynamic_image->image;
+
+       klass->inited = 1; /* we lie to the runtime */
+       klass->name = mono_string_to_utf8_image (klass->image, tb->name, error);
+       if (!is_ok (error))
+               goto failure;
+       klass->name_space = mono_string_to_utf8_image (klass->image, tb->nspace, error);
+       if (!is_ok (error))
+               goto failure;
+       klass->type_token = MONO_TOKEN_TYPE_DEF | tb->table_idx;
+       mono_class_set_flags (klass, tb->attrs);
+       
+       mono_profiler_class_event (klass, MONO_PROFILE_START_LOAD);
+
+       klass->element_class = klass;
+
+       if (mono_class_get_ref_info (klass) == NULL) {
+               mono_class_set_ref_info (klass, tb);
+
+               /* Put into cache so mono_class_get_checked () will find it.
+               Skip nested types as those should not be available on the global scope. */
+               if (!tb->nesting_type)
+                       mono_image_add_to_name_cache (klass->image, klass->name_space, klass->name, tb->table_idx);
+
+               /*
+               We must register all types as we cannot rely on the name_cache hashtable since we find the class
+               by performing a mono_class_get which does the full resolution.
+
+               Working around this semantics would require us to write a lot of code for no clear advantage.
+               */
+               mono_image_append_class_to_reflection_info_set (klass);
+       } else {
+               g_assert (mono_class_get_ref_info (klass) == tb);
+       }
+
+       mono_dynamic_image_register_token (tb->module->dynamic_image, MONO_TOKEN_TYPE_DEF | tb->table_idx, (MonoObject*)tb);
+
+       if (parent != NULL) {
+               mono_class_setup_parent (klass, parent);
+       } else if (strcmp (klass->name, "Object") == 0 && strcmp (klass->name_space, "System") == 0) {
+               const char *old_n = klass->name;
+               /* trick to get relative numbering right when compiling corlib */
+               klass->name = "BuildingObject";
+               mono_class_setup_parent (klass, mono_defaults.object_class);
+               klass->name = old_n;
+       }
+
+       if ((!strcmp (klass->name, "ValueType") && !strcmp (klass->name_space, "System")) ||
+                       (!strcmp (klass->name, "Object") && !strcmp (klass->name_space, "System")) ||
+                       (!strcmp (klass->name, "Enum") && !strcmp (klass->name_space, "System"))) {
+               klass->instance_size = sizeof (MonoObject);
+               klass->size_inited = 1;
+               mono_class_setup_vtable_general (klass, NULL, 0, NULL);
+       }
+
+       mono_class_setup_mono_type (klass);
+
+       mono_class_setup_supertypes (klass);
+
+       /*
+        * FIXME: handle interfaces.
+        */
+
+       tb->type.type = &klass->byval_arg;
+
+       if (tb->nesting_type) {
+               reflection_setup_internal_class ((MonoReflectionTypeBuilder*)tb->nesting_type, error);
+               g_assert (tb->nesting_type->type);
+               MonoType *nesting_type = mono_reflection_type_get_handle (tb->nesting_type, error);
+               if (!is_ok (error)) goto failure;
+               klass->nested_in = mono_class_from_mono_type (nesting_type);
+       }
+
+       /*g_print ("setup %s as %s (%p)\n", klass->name, ((MonoObject*)tb)->vtable->klass->name, tb);*/
+
+       mono_profiler_class_loaded (klass, MONO_PROFILE_OK);
+       
+       mono_loader_unlock ();
+       return TRUE;
+
+failure:
+       mono_loader_unlock ();
+       return FALSE;
+}
+
+/**
+ * reflection_create_generic_class:
+ * @tb: a TypeBuilder object
+ * @error: set on error
+ *
+ * Creates the generic class after all generic parameters have been added.
+ * On success returns TRUE, on failure returns FALSE and sets @error.
+ */
+static gboolean
+reflection_create_generic_class (MonoReflectionTypeBuilder *tb, MonoError *error)
+{
+       MonoClass *klass;
+       int count, i;
+
+       mono_error_init (error);
+
+       reflection_setup_internal_class (tb, error);
+
+       klass = mono_class_from_mono_type (tb->type.type);
+
+       count = tb->generic_params ? mono_array_length (tb->generic_params) : 0;
+
+       if (count == 0)
+               return TRUE;
+
+       MonoGenericContainer *generic_container = (MonoGenericContainer *)mono_image_alloc0 (klass->image, sizeof (MonoGenericContainer));
+
+       generic_container->owner.klass = klass;
+       generic_container->type_argc = count;
+       generic_container->type_params = (MonoGenericParamFull *)mono_image_alloc0 (klass->image, sizeof (MonoGenericParamFull) * count);
+
+       klass->class_kind = MONO_CLASS_GTD;
+       mono_class_set_generic_container (klass, generic_container);
+
+
+       for (i = 0; i < count; i++) {
+               MonoReflectionGenericParam *gparam = (MonoReflectionGenericParam *)mono_array_get (tb->generic_params, gpointer, i);
+               MonoType *param_type = mono_reflection_type_get_handle ((MonoReflectionType*)gparam, error);
+               return_val_if_nok (error, FALSE);
+               MonoGenericParamFull *param = (MonoGenericParamFull *) param_type->data.generic_param;
+               generic_container->type_params [i] = *param;
+               /*Make sure we are a diferent type instance */
+               generic_container->type_params [i].param.owner = generic_container;
+               generic_container->type_params [i].info.pklass = NULL;
+               generic_container->type_params [i].info.flags = gparam->attrs;
+
+               g_assert (generic_container->type_params [i].param.owner);
+       }
+
+       generic_container->context.class_inst = mono_get_shared_generic_inst (generic_container);
+       return TRUE;
+}
+
+static MonoMarshalSpec*
+mono_marshal_spec_from_builder (MonoImage *image, MonoAssembly *assembly,
+                               MonoReflectionMarshal *minfo, MonoError *error)
+{
+       MonoMarshalSpec *res;
+
+       mono_error_init (error);
+
+       res = image_g_new0 (image, MonoMarshalSpec, 1);
+       res->native = (MonoMarshalNative)minfo->type;
+
+       switch (minfo->type) {
+       case MONO_NATIVE_LPARRAY:
+               res->data.array_data.elem_type = (MonoMarshalNative)minfo->eltype;
+               if (minfo->has_size) {
+                       res->data.array_data.param_num = minfo->param_num;
+                       res->data.array_data.num_elem = minfo->count;
+                       res->data.array_data.elem_mult = minfo->param_num == -1 ? 0 : 1;
+               }
+               else {
+                       res->data.array_data.param_num = -1;
+                       res->data.array_data.num_elem = -1;
+                       res->data.array_data.elem_mult = -1;
+               }
+               break;
+
+       case MONO_NATIVE_BYVALTSTR:
+       case MONO_NATIVE_BYVALARRAY:
+               res->data.array_data.num_elem = minfo->count;
+               break;
+
+       case MONO_NATIVE_CUSTOM:
+               if (minfo->marshaltyperef) {
+                       MonoType *marshaltyperef = mono_reflection_type_get_handle ((MonoReflectionType*)minfo->marshaltyperef, error);
+                       if (!is_ok (error)) {
+                               image_g_free (image, res);
+                               return NULL;
+                       }
+                       res->data.custom_data.custom_name =
+                               type_get_fully_qualified_name (marshaltyperef);
+               }
+               if (minfo->mcookie) {
+                       res->data.custom_data.cookie = mono_string_to_utf8_checked (minfo->mcookie, error);
+                       if (!is_ok (error)) {
+                               image_g_free (image, res);
+                               return NULL;
+                       }
+               }
+               break;
+
+       default:
+               break;
+       }
+
+       return res;
+}
+#endif /* !DISABLE_REFLECTION_EMIT */
+
+MonoReflectionMarshalAsAttribute*
+mono_reflection_marshal_as_attribute_from_marshal_spec (MonoDomain *domain, MonoClass *klass,
+                                                       MonoMarshalSpec *spec, MonoError *error)
+{
+       MonoReflectionType *rt;
+       MonoReflectionMarshalAsAttribute *minfo;
+       MonoType *mtype;
+
+       mono_error_init (error);
+       
+       minfo = (MonoReflectionMarshalAsAttribute*)mono_object_new_checked (domain, mono_class_get_marshal_as_attribute_class (), error);
+       if (!minfo)
+               return NULL;
+       minfo->utype = spec->native;
+
+       switch (minfo->utype) {
+       case MONO_NATIVE_LPARRAY:
+               minfo->array_subtype = spec->data.array_data.elem_type;
+               minfo->size_const = spec->data.array_data.num_elem;
+               if (spec->data.array_data.param_num != -1)
+                       minfo->size_param_index = spec->data.array_data.param_num;
+               break;
+
+       case MONO_NATIVE_BYVALTSTR:
+       case MONO_NATIVE_BYVALARRAY:
+               minfo->size_const = spec->data.array_data.num_elem;
+               break;
+
+       case MONO_NATIVE_CUSTOM:
+               if (spec->data.custom_data.custom_name) {
+                       mtype = mono_reflection_type_from_name_checked (spec->data.custom_data.custom_name, klass->image, error);
+                       return_val_if_nok  (error, NULL);
+
+                       if (mtype) {
+                               rt = mono_type_get_object_checked (domain, mtype, error);
+                               if (!rt)
+                                       return NULL;
+
+                               MONO_OBJECT_SETREF (minfo, marshal_type_ref, rt);
+                       }
+
+                       MONO_OBJECT_SETREF (minfo, marshal_type, mono_string_new (domain, spec->data.custom_data.custom_name));
+               }
+               if (spec->data.custom_data.cookie)
+                       MONO_OBJECT_SETREF (minfo, marshal_cookie, mono_string_new (domain, spec->data.custom_data.cookie));
+               break;
+
+       default:
+               break;
+       }
+
+       return minfo;
+}
+
+#ifndef DISABLE_REFLECTION_EMIT
+static MonoMethod*
+reflection_methodbuilder_to_mono_method (MonoClass *klass,
+                                        ReflectionMethodBuilder *rmb,
+                                        MonoMethodSignature *sig,
+                                        MonoError *error)
+{
+       MonoMethod *m;
+       MonoMethodWrapper *wrapperm;
+       MonoMarshalSpec **specs;
+       MonoReflectionMethodAux *method_aux;
+       MonoImage *image;
+       gboolean dynamic;
+       int i;
+
+       mono_error_init (error);
+       /*
+        * Methods created using a MethodBuilder should have their memory allocated
+        * inside the image mempool, while dynamic methods should have their memory
+        * malloc'd.
+        */
+       dynamic = rmb->refs != NULL;
+       image = dynamic ? NULL : klass->image;
+
+       if (!dynamic)
+               g_assert (!mono_class_is_ginst (klass));
+
+       mono_loader_lock ();
+
+       if ((rmb->attrs & METHOD_ATTRIBUTE_PINVOKE_IMPL) ||
+                       (rmb->iattrs & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL))
+               m = (MonoMethod *)image_g_new0 (image, MonoMethodPInvoke, 1);
+       else
+               m = (MonoMethod *)image_g_new0 (image, MonoMethodWrapper, 1);
+
+       wrapperm = (MonoMethodWrapper*)m;
+
+       m->dynamic = dynamic;
+       m->slot = -1;
+       m->flags = rmb->attrs;
+       m->iflags = rmb->iattrs;
+       m->name = mono_string_to_utf8_image_ignore (image, rmb->name);
+       m->klass = klass;
+       m->signature = sig;
+       m->sre_method = TRUE;
+       m->skip_visibility = rmb->skip_visibility;
+       if (rmb->table_idx)
+               m->token = MONO_TOKEN_METHOD_DEF | (*rmb->table_idx);
+
+       if (m->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL) {
+               if (klass == mono_defaults.string_class && !strcmp (m->name, ".ctor"))
+                       m->string_ctor = 1;
+
+               m->signature->pinvoke = 1;
+       } else if (m->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL) {
+               m->signature->pinvoke = 1;
+
+               method_aux = image_g_new0 (image, MonoReflectionMethodAux, 1);
+
+               method_aux->dllentry = rmb->dllentry ? mono_string_to_utf8_image (image, rmb->dllentry, error) : image_strdup (image, m->name);
+               mono_error_assert_ok (error);
+               method_aux->dll = mono_string_to_utf8_image (image, rmb->dll, error);
+               mono_error_assert_ok (error);
+               
+               ((MonoMethodPInvoke*)m)->piflags = (rmb->native_cc << 8) | (rmb->charset ? (rmb->charset - 1) * 2 : 0) | rmb->extra_flags;
+
+               if (image_is_dynamic (klass->image))
+                       g_hash_table_insert (((MonoDynamicImage*)klass->image)->method_aux_hash, m, method_aux);
+
+               mono_loader_unlock ();
+
+               return m;
+       } else if (!(m->flags & METHOD_ATTRIBUTE_ABSTRACT) &&
+                          !(m->iflags & METHOD_IMPL_ATTRIBUTE_RUNTIME)) {
+               MonoMethodHeader *header;
+               guint32 code_size;
+               gint32 max_stack, i;
+               gint32 num_locals = 0;
+               gint32 num_clauses = 0;
+               guint8 *code;
+
+               if (rmb->ilgen) {
+                       code = mono_array_addr (rmb->ilgen->code, guint8, 0);
+                       code_size = rmb->ilgen->code_len;
+                       max_stack = rmb->ilgen->max_stack;
+                       num_locals = rmb->ilgen->locals ? mono_array_length (rmb->ilgen->locals) : 0;
+                       if (rmb->ilgen->ex_handlers)
+                               num_clauses = mono_reflection_method_count_clauses (rmb->ilgen);
+               } else {
+                       if (rmb->code) {
+                               code = mono_array_addr (rmb->code, guint8, 0);
+                               code_size = mono_array_length (rmb->code);
+                               /* we probably need to run a verifier on the code... */
+                               max_stack = 8; 
+                       }
+                       else {
+                               code = NULL;
+                               code_size = 0;
+                               max_stack = 8;
+                       }
+               }
+
+               header = (MonoMethodHeader *)mono_image_g_malloc0 (image, MONO_SIZEOF_METHOD_HEADER + num_locals * sizeof (MonoType*));
+               header->code_size = code_size;
+               header->code = (const unsigned char *)image_g_malloc (image, code_size);
+               memcpy ((char*)header->code, code, code_size);
+               header->max_stack = max_stack;
+               header->init_locals = rmb->init_locals;
+               header->num_locals = num_locals;
+
+               for (i = 0; i < num_locals; ++i) {
+                       MonoReflectionLocalBuilder *lb = 
+                               mono_array_get (rmb->ilgen->locals, MonoReflectionLocalBuilder*, i);
+
+                       header->locals [i] = image_g_new0 (image, MonoType, 1);
+                       MonoType *type = mono_reflection_type_get_handle ((MonoReflectionType*)lb->type, error);
+                       mono_error_assert_ok (error);
+                       memcpy (header->locals [i], type, MONO_SIZEOF_TYPE);
+               }
+
+               header->num_clauses = num_clauses;
+               if (num_clauses) {
+                       header->clauses = method_encode_clauses (image, (MonoDynamicImage*)klass->image,
+                                                                rmb->ilgen, num_clauses, error);
+                       mono_error_assert_ok (error);
+               }
+
+               wrapperm->header = header;
+       }
+
+       if (rmb->generic_params) {
+               int count = mono_array_length (rmb->generic_params);
+               MonoGenericContainer *container;
+
+               container = (MonoGenericContainer *)mono_image_alloc0 (klass->image, sizeof (MonoGenericContainer));
+               container->is_method = TRUE;
+               container->is_anonymous = FALSE;
+               container->type_argc = count;
+               container->type_params = image_g_new0 (image, MonoGenericParamFull, count);
+               container->owner.method = m;
+
+               m->is_generic = TRUE;
+               mono_method_set_generic_container (m, container);
+
+               for (i = 0; i < count; i++) {
+                       MonoReflectionGenericParam *gp =
+                               mono_array_get (rmb->generic_params, MonoReflectionGenericParam*, i);
+                       MonoType *gp_type = mono_reflection_type_get_handle ((MonoReflectionType*)gp, error);
+                       mono_error_assert_ok (error);
+                       MonoGenericParamFull *param = (MonoGenericParamFull *) gp_type->data.generic_param;
+                       container->type_params [i] = *param;
+                       container->type_params [i].param.owner = container;
+
+                       gp->type.type->data.generic_param = (MonoGenericParam*)&container->type_params [i];
+
+                       MonoClass *gklass = mono_class_from_mono_type (gp_type);
+                       gklass->wastypebuilder = TRUE;
+               }
+
+               /*
+                * The method signature might have pointers to generic parameters that belong to other methods.
+                * This is a valid SRE case, but the resulting method signature must be encoded using the proper
+                * generic parameters.
+                */
+               for (i = 0; i < m->signature->param_count; ++i) {
+                       MonoType *t = m->signature->params [i];
+                       if (t->type == MONO_TYPE_MVAR) {
+                               MonoGenericParam *gparam =  t->data.generic_param;
+                               if (gparam->num < count) {
+                                       m->signature->params [i] = mono_metadata_type_dup (image, m->signature->params [i]);
+                                       m->signature->params [i]->data.generic_param = mono_generic_container_get_param (container, gparam->num);
+                               }
+
+                       }
+               }
+
+               if (mono_class_is_gtd (klass)) {
+                       container->parent = mono_class_get_generic_container (klass);
+                       container->context.class_inst = mono_class_get_generic_container (klass)->context.class_inst;
+               }
+               container->context.method_inst = mono_get_shared_generic_inst (container);
+       }
+
+       if (rmb->refs) {
+               MonoMethodWrapper *mw = (MonoMethodWrapper*)m;
+               int i;
+               void **data;
+
+               m->wrapper_type = MONO_WRAPPER_DYNAMIC_METHOD;
+
+               mw->method_data = data = image_g_new (image, gpointer, rmb->nrefs + 1);
+               data [0] = GUINT_TO_POINTER (rmb->nrefs);
+               for (i = 0; i < rmb->nrefs; ++i)
+                       data [i + 1] = rmb->refs [i];
+       }
+
+       method_aux = NULL;
+
+       /* Parameter info */
+       if (rmb->pinfo) {
+               if (!method_aux)
+                       method_aux = image_g_new0 (image, MonoReflectionMethodAux, 1);
+               method_aux->param_names = image_g_new0 (image, char *, mono_method_signature (m)->param_count + 1);
+               for (i = 0; i <= m->signature->param_count; ++i) {
+                       MonoReflectionParamBuilder *pb;
+                       if ((pb = mono_array_get (rmb->pinfo, MonoReflectionParamBuilder*, i))) {
+                               if ((i > 0) && (pb->attrs)) {
+                                       /* Make a copy since it might point to a shared type structure */
+                                       m->signature->params [i - 1] = mono_metadata_type_dup (klass->image, m->signature->params [i - 1]);
+                                       m->signature->params [i - 1]->attrs = pb->attrs;
+                               }
+
+                               if (pb->attrs & PARAM_ATTRIBUTE_HAS_DEFAULT) {
+                                       MonoDynamicImage *assembly;
+                                       guint32 idx, len;
+                                       MonoTypeEnum def_type;
+                                       char *p;
+                                       const char *p2;
+
+                                       if (!method_aux->param_defaults) {
+                                               method_aux->param_defaults = image_g_new0 (image, guint8*, m->signature->param_count + 1);
+                                               method_aux->param_default_types = image_g_new0 (image, guint32, m->signature->param_count + 1);
+                                       }
+                                       assembly = (MonoDynamicImage*)klass->image;
+                                       idx = mono_dynimage_encode_constant (assembly, pb->def_value, &def_type);
+                                       /* Copy the data from the blob since it might get realloc-ed */
+                                       p = assembly->blob.data + idx;
+                                       len = mono_metadata_decode_blob_size (p, &p2);
+                                       len += p2 - p;
+                                       method_aux->param_defaults [i] = (uint8_t *)image_g_malloc (image, len);
+                                       method_aux->param_default_types [i] = def_type;
+                                       memcpy ((gpointer)method_aux->param_defaults [i], p, len);
+                               }
+
+                               if (pb->name) {
+                                       method_aux->param_names [i] = mono_string_to_utf8_image (image, pb->name, error);
+                                       mono_error_assert_ok (error);
+                               }
+                               if (pb->cattrs) {
+                                       if (!method_aux->param_cattr)
+                                               method_aux->param_cattr = image_g_new0 (image, MonoCustomAttrInfo*, m->signature->param_count + 1);
+                                       method_aux->param_cattr [i] = mono_custom_attrs_from_builders (image, klass->image, pb->cattrs);
+                               }
+                       }
+               }
+       }
+
+       /* Parameter marshalling */
+       specs = NULL;
+       if (rmb->pinfo)         
+               for (i = 0; i < mono_array_length (rmb->pinfo); ++i) {
+                       MonoReflectionParamBuilder *pb;
+                       if ((pb = mono_array_get (rmb->pinfo, MonoReflectionParamBuilder*, i))) {
+                               if (pb->marshal_info) {
+                                       if (specs == NULL)
+                                               specs = image_g_new0 (image, MonoMarshalSpec*, sig->param_count + 1);
+                                       specs [pb->position] = 
+                                               mono_marshal_spec_from_builder (image, klass->image->assembly, pb->marshal_info, error);
+                                       if (!is_ok (error)) {
+                                               mono_loader_unlock ();
+                                               image_g_free (image, specs);
+                                               /* FIXME: if image is NULL, this leaks all the other stuff we alloc'd in this function */
+                                               return NULL;
+                                       }
+                               }
+                       }
+               }
+       if (specs != NULL) {
+               if (!method_aux)
+                       method_aux = image_g_new0 (image, MonoReflectionMethodAux, 1);
+               method_aux->param_marshall = specs;
+       }
+
+       if (image_is_dynamic (klass->image) && method_aux)
+               g_hash_table_insert (((MonoDynamicImage*)klass->image)->method_aux_hash, m, method_aux);
+
+       mono_loader_unlock ();
+
+       return m;
+}      
+
+static MonoMethod*
+ctorbuilder_to_mono_method (MonoClass *klass, MonoReflectionCtorBuilder* mb, MonoError *error)
+{
+       ReflectionMethodBuilder rmb;
+       MonoMethodSignature *sig;
+
+       mono_loader_lock ();
+
+       if (!mono_reflection_methodbuilder_from_ctor_builder (&rmb, mb, error))
+               return NULL;
+
+       g_assert (klass->image != NULL);
+       sig = ctor_builder_to_signature (klass->image, mb, error);
+       mono_loader_unlock ();
+       return_val_if_nok (error, NULL);
+
+       mb->mhandle = reflection_methodbuilder_to_mono_method (klass, &rmb, sig, error);
+       return_val_if_nok (error, NULL);
+       mono_save_custom_attrs (klass->image, mb->mhandle, mb->cattrs);
+
+       if (!((MonoDynamicImage*)(MonoDynamicImage*)klass->image)->save) {
+               /* ilgen is no longer needed */
+               mb->ilgen = NULL;
+       }
+
+       return mb->mhandle;
+}
+
+static MonoMethod*
+methodbuilder_to_mono_method (MonoClass *klass, MonoReflectionMethodBuilder* mb, MonoError *error)
+{
+       ReflectionMethodBuilder rmb;
+       MonoMethodSignature *sig;
+
+       mono_error_init (error);
+
+       mono_loader_lock ();
+
+       if (!mono_reflection_methodbuilder_from_method_builder (&rmb, mb, error))
+               return NULL;
+
+       g_assert (klass->image != NULL);
+       sig = method_builder_to_signature (klass->image, mb, error);
+       mono_loader_unlock ();
+       return_val_if_nok (error, NULL);
+
+       mb->mhandle = reflection_methodbuilder_to_mono_method (klass, &rmb, sig, error);
+       return_val_if_nok (error, NULL);
+       mono_save_custom_attrs (klass->image, mb->mhandle, mb->cattrs);
+
+       if (!((MonoDynamicImage*)(MonoDynamicImage*)klass->image)->save)
+               /* ilgen is no longer needed */
+               mb->ilgen = NULL;
+       return mb->mhandle;
+}
+#endif
+
+#ifndef DISABLE_REFLECTION_EMIT
+
+/**
+ * fix_partial_generic_class:
+ * @klass: a generic instantiation MonoClass
+ * @error: set on error
+ *
+ * Assumes that the generic container of @klass has its vtable
+ * initialized, and updates the parent class, interfaces, methods and
+ * fields of @klass by inflating the types using the generic context.
+ *
+ * On success returns TRUE, on failure returns FALSE and sets @error.
+ *
+ */
+static gboolean
+fix_partial_generic_class (MonoClass *klass, MonoError *error)
+{
+       MonoClass *gklass = mono_class_get_generic_class (klass)->container_class;
+       int i;
+
+       mono_error_init (error);
+
+       if (klass->wastypebuilder)
+               return TRUE;
+
+       if (klass->parent != gklass->parent) {
+               MonoType *parent_type = mono_class_inflate_generic_type_checked (&gklass->parent->byval_arg, &mono_class_get_generic_class (klass)->context, error);
+               if (mono_error_ok (error)) {
+                       MonoClass *parent = mono_class_from_mono_type (parent_type);
+                       mono_metadata_free_type (parent_type);
+                       if (parent != klass->parent) {
+                               /*fool mono_class_setup_parent*/
+                               klass->supertypes = NULL;
+                               mono_class_setup_parent (klass, parent);
+                       }
+               } else {
+                       if (gklass->wastypebuilder)
+                               klass->wastypebuilder = TRUE;
+                       return FALSE;
+               }
+       }
+
+       if (!mono_class_get_generic_class (klass)->need_sync)
+               return TRUE;
+
+       int mcount = mono_class_get_method_count (klass);
+       int gmcount = mono_class_get_method_count (gklass);
+       if (mcount != gmcount) {
+               mono_class_set_method_count (klass, gmcount);
+               klass->methods = (MonoMethod **)mono_image_alloc (klass->image, sizeof (MonoMethod*) * (gmcount + 1));
+
+               for (i = 0; i < gmcount; i++) {
+                       klass->methods [i] = mono_class_inflate_generic_method_full_checked (
+                               gklass->methods [i], klass, mono_class_get_context (klass), error);
+                       mono_error_assert_ok (error);
+               }
+       }
+
+       if (klass->interface_count && klass->interface_count != gklass->interface_count) {
+               klass->interface_count = gklass->interface_count;
+               klass->interfaces = (MonoClass **)mono_image_alloc (klass->image, sizeof (MonoClass*) * gklass->interface_count);
+               klass->interfaces_packed = NULL; /*make setup_interface_offsets happy*/
+
+               for (i = 0; i < gklass->interface_count; ++i) {
+                       MonoType *iface_type = mono_class_inflate_generic_type_checked (&gklass->interfaces [i]->byval_arg, mono_class_get_context (klass), error);
+                       return_val_if_nok (error, FALSE);
+
+                       klass->interfaces [i] = mono_class_from_mono_type (iface_type);
+                       mono_metadata_free_type (iface_type);
+
+                       if (!ensure_runtime_vtable (klass->interfaces [i], error))
+                               return FALSE;
+               }
+               klass->interfaces_inited = 1;
+       }
+
+       int fcount = mono_class_get_field_count (klass);
+       int gfcount = mono_class_get_field_count (gklass);
+       if (fcount != gfcount) {
+               mono_class_set_field_count (klass, gfcount);
+               klass->fields = image_g_new0 (klass->image, MonoClassField, gfcount);
+
+               for (i = 0; i < gfcount; i++) {
+                       klass->fields [i] = gklass->fields [i];
+                       klass->fields [i].parent = klass;
+                       klass->fields [i].type = mono_class_inflate_generic_type_checked (gklass->fields [i].type, mono_class_get_context (klass), error);
+                       return_val_if_nok (error, FALSE);
+               }
+       }
+
+       /*We can only finish with this klass once it's parent has as well*/
+       if (gklass->wastypebuilder)
+               klass->wastypebuilder = TRUE;
+       return TRUE;
+}
+
+/**
+ * ensure_generic_class_runtime_vtable:
+ * @klass a generic class
+ * @error set on error
+ *
+ * Ensures that the generic container of @klass has a vtable and
+ * returns TRUE on success.  On error returns FALSE and sets @error.
+ */
+static gboolean
+ensure_generic_class_runtime_vtable (MonoClass *klass, MonoError *error)
+{
+       MonoClass *gklass = mono_class_get_generic_class (klass)->container_class;
+
+       mono_error_init (error);
+
+       if (!ensure_runtime_vtable (gklass, error))
+               return FALSE;
+
+       return fix_partial_generic_class (klass, error);
+}
+
+/**
+ * ensure_runtime_vtable:
+ * @klass the class
+ * @error set on error
+ *
+ * Ensures that @klass has a vtable and returns TRUE on success. On
+ * error returns FALSE and sets @error.
+ */
+static gboolean
+ensure_runtime_vtable (MonoClass *klass, MonoError *error)
+{
+       MonoReflectionTypeBuilder *tb = (MonoReflectionTypeBuilder *)mono_class_get_ref_info (klass);
+       int i, num, j;
+
+       mono_error_init (error);
+
+       if (!image_is_dynamic (klass->image) || (!tb && !mono_class_is_ginst (klass)) || klass->wastypebuilder)
+               return TRUE;
+       if (klass->parent)
+               if (!ensure_runtime_vtable (klass->parent, error))
+                       return FALSE;
+
+       if (tb) {
+               num = tb->ctors? mono_array_length (tb->ctors): 0;
+               num += tb->num_methods;
+               mono_class_set_method_count (klass, num);
+               klass->methods = (MonoMethod **)mono_image_alloc (klass->image, sizeof (MonoMethod*) * num);
+               num = tb->ctors? mono_array_length (tb->ctors): 0;
+               for (i = 0; i < num; ++i) {
+                       MonoMethod *ctor = ctorbuilder_to_mono_method (klass, mono_array_get (tb->ctors, MonoReflectionCtorBuilder*, i), error);
+                       if (!ctor)
+                               return FALSE;
+                       klass->methods [i] = ctor;
+               }
+               num = tb->num_methods;
+               j = i;
+               for (i = 0; i < num; ++i) {
+                       MonoMethod *meth = methodbuilder_to_mono_method (klass, mono_array_get (tb->methods, MonoReflectionMethodBuilder*, i), error);
+                       if (!meth)
+                               return FALSE;
+                       klass->methods [j++] = meth;
+               }
+       
+               if (tb->interfaces) {
+                       klass->interface_count = mono_array_length (tb->interfaces);
+                       klass->interfaces = (MonoClass **)mono_image_alloc (klass->image, sizeof (MonoClass*) * klass->interface_count);
+                       for (i = 0; i < klass->interface_count; ++i) {
+                               MonoType *iface = mono_type_array_get_and_resolve (tb->interfaces, i, error);
+                               return_val_if_nok (error, FALSE);
+                               klass->interfaces [i] = mono_class_from_mono_type (iface);
+                               if (!ensure_runtime_vtable (klass->interfaces [i], error))
+                                       return FALSE;
+                       }
+                       klass->interfaces_inited = 1;
+               }
+       } else if (mono_class_is_ginst (klass)){
+               if (!ensure_generic_class_runtime_vtable (klass, error)) {
+                       mono_class_set_type_load_failure (klass, "Could not initialize vtable for generic class due to: %s", mono_error_get_message (error));
+                       return FALSE;
+               }
+       }
+
+       if (mono_class_is_interface (klass) && !mono_class_is_ginst (klass)) {
+               int slot_num = 0;
+               int mcount = mono_class_get_method_count (klass);
+               for (i = 0; i < mcount; ++i) {
+                       MonoMethod *im = klass->methods [i];
+                       if (!(im->flags & METHOD_ATTRIBUTE_STATIC))
+                               im->slot = slot_num++;
+               }
+               
+               klass->interfaces_packed = NULL; /*make setup_interface_offsets happy*/
+               mono_class_setup_interface_offsets (klass);
+               mono_class_setup_interface_id (klass);
+       }
+
+       /*
+        * The generic vtable is needed even if image->run is not set since some
+        * runtime code like ves_icall_Type_GetMethodsByName depends on 
+        * method->slot being defined.
+        */
+
+       /* 
+        * tb->methods could not be freed since it is used for determining 
+        * overrides during dynamic vtable construction.
+        */
+
+       return TRUE;
+}
+
+static MonoMethod*
+mono_reflection_method_get_handle (MonoObject *method, MonoError *error)
+{
+       mono_error_init (error);
+       MonoClass *klass = mono_object_class (method);
+       if (is_sr_mono_method (klass)) {
+               MonoReflectionMethod *sr_method = (MonoReflectionMethod*)method;
+               return sr_method->method;
+       }
+       if (is_sre_method_builder (klass)) {
+               MonoReflectionMethodBuilder *mb = (MonoReflectionMethodBuilder*)method;
+               return mb->mhandle;
+       }
+       if (mono_is_sre_method_on_tb_inst (klass)) {
+               MonoClass *handle_class;
+
+               MonoMethod *result =  mono_reflection_resolve_object (NULL, method, &handle_class, NULL, error);
+               return_val_if_nok (error, NULL);
+
+               return result;
+       }
+
+       g_error ("Can't handle methods of type %s:%s", klass->name_space, klass->name);
+       return NULL;
+}
+
+void
+mono_reflection_get_dynamic_overrides (MonoClass *klass, MonoMethod ***overrides, int *num_overrides, MonoError *error)
+{
+       MonoReflectionTypeBuilder *tb;
+       int i, j, onum;
+       MonoReflectionMethod *m;
+
+       mono_error_init (error);
+       *overrides = NULL;
+       *num_overrides = 0;
+
+       g_assert (image_is_dynamic (klass->image));
+
+       if (!mono_class_get_ref_info (klass))
+               return;
+
+       g_assert (strcmp (((MonoObject*)mono_class_get_ref_info (klass))->vtable->klass->name, "TypeBuilder") == 0);
+
+       tb = (MonoReflectionTypeBuilder*)mono_class_get_ref_info (klass);
+
+       onum = 0;
+       if (tb->methods) {
+               for (i = 0; i < tb->num_methods; ++i) {
+                       MonoReflectionMethodBuilder *mb = 
+                               mono_array_get (tb->methods, MonoReflectionMethodBuilder*, i);
+                       if (mb->override_methods)
+                               onum += mono_array_length (mb->override_methods);
+               }
+       }
+
+       if (onum) {
+               *overrides = g_new0 (MonoMethod*, onum * 2);
+
+               onum = 0;
+               for (i = 0; i < tb->num_methods; ++i) {
+                       MonoReflectionMethodBuilder *mb = 
+                               mono_array_get (tb->methods, MonoReflectionMethodBuilder*, i);
+                       if (mb->override_methods) {
+                               for (j = 0; j < mono_array_length (mb->override_methods); ++j) {
+                                       m = mono_array_get (mb->override_methods, MonoReflectionMethod*, j);
+
+                                       (*overrides) [onum * 2] = mono_reflection_method_get_handle ((MonoObject*)m, error);
+                                       return_if_nok (error);
+                                       (*overrides) [onum * 2 + 1] = mb->mhandle;
+
+                                       g_assert (mb->mhandle);
+
+                                       onum ++;
+                               }
+                       }
+               }
+       }
+
+       *num_overrides = onum;
+}
+
+/* This initializes the same data as mono_class_setup_fields () */
+static void
+typebuilder_setup_fields (MonoClass *klass, MonoError *error)
+{
+       MonoReflectionTypeBuilder *tb = (MonoReflectionTypeBuilder *)mono_class_get_ref_info (klass);
+       MonoReflectionFieldBuilder *fb;
+       MonoClassField *field;
+       MonoClassExt *ext;
+       MonoImage *image = klass->image;
+       const char *p, *p2;
+       int i, instance_size, packing_size = 0;
+       guint32 len, idx;
+
+       if (klass->parent) {
+               if (!klass->parent->size_inited)
+                       mono_class_init (klass->parent);
+               instance_size = klass->parent->instance_size;
+       } else {
+               instance_size = sizeof (MonoObject);
+       }
+
+       int fcount = tb->num_fields;
+       mono_class_set_field_count (klass, fcount);
+
+       mono_error_init (error);
+
+       if (tb->class_size) {
+               packing_size = tb->packing_size;
+               instance_size += tb->class_size;
+       }
+       
+       klass->fields = image_g_new0 (image, MonoClassField, fcount);
+       mono_class_alloc_ext (klass);
+       ext = mono_class_get_ext (klass);
+       ext->field_def_values = image_g_new0 (image, MonoFieldDefaultValue, fcount);
+       /*
+       This is, guess what, a hack.
+       The issue is that the runtime doesn't know how to setup the fields of a typebuider and crash.
+       On the static path no field class is resolved, only types are built. This is the right thing to do
+       but we suck.
+       Setting size_inited is harmless because we're doing the same job as mono_class_setup_fields anyway.
+       */
+       klass->size_inited = 1;
+
+       for (i = 0; i < fcount; ++i) {
+               MonoArray *rva_data;
+               fb = (MonoReflectionFieldBuilder *)mono_array_get (tb->fields, gpointer, i);
+               field = &klass->fields [i];
+               field->parent = klass;
+               field->name = mono_string_to_utf8_image (image, fb->name, error);
+               if (!mono_error_ok (error))
+                       return;
+               if (fb->attrs) {
+                       MonoType *type = mono_reflection_type_get_handle ((MonoReflectionType*)fb->type, error);
+                       return_if_nok (error);
+                       field->type = mono_metadata_type_dup (klass->image, type);
+                       field->type->attrs = fb->attrs;
+               } else {
+                       field->type = mono_reflection_type_get_handle ((MonoReflectionType*)fb->type, error);
+                       return_if_nok (error);
+               }
+
+               if ((fb->attrs & FIELD_ATTRIBUTE_HAS_FIELD_RVA) && (rva_data = fb->rva_data)) {
+                       char *base = mono_array_addr (rva_data, char, 0);
+                       size_t size = mono_array_length (rva_data);
+                       char *data = (char *)mono_image_alloc (klass->image, size);
+                       memcpy (data, base, size);
+                       ext->field_def_values [i].data = data;
+               }
+               if (fb->offset != -1)
+                       field->offset = fb->offset;
+               fb->handle = field;
+               mono_save_custom_attrs (klass->image, field, fb->cattrs);
+
+               if (fb->def_value) {
+                       MonoDynamicImage *assembly = (MonoDynamicImage*)klass->image;
+                       field->type->attrs |= FIELD_ATTRIBUTE_HAS_DEFAULT;
+                       idx = mono_dynimage_encode_constant (assembly, fb->def_value, &ext->field_def_values [i].def_type);
+                       /* Copy the data from the blob since it might get realloc-ed */
+                       p = assembly->blob.data + idx;
+                       len = mono_metadata_decode_blob_size (p, &p2);
+                       len += p2 - p;
+                       ext->field_def_values [i].data = (const char *)mono_image_alloc (image, len);
+                       memcpy ((gpointer)ext->field_def_values [i].data, p, len);
+               }
+       }
+
+       mono_class_layout_fields (klass, instance_size, packing_size, TRUE);
+}
+
+static void
+typebuilder_setup_properties (MonoClass *klass, MonoError *error)
+{
+       MonoReflectionTypeBuilder *tb = (MonoReflectionTypeBuilder *)mono_class_get_ref_info (klass);
+       MonoReflectionPropertyBuilder *pb;
+       MonoImage *image = klass->image;
+       MonoProperty *properties;
+       MonoClassExt *ext;
+       int i;
+
+       mono_error_init (error);
+
+       ext = mono_class_get_ext (klass);
+       if (!ext)
+               mono_class_set_ext (klass, ext = image_g_new0 (image, MonoClassExt, 1));
+
+       ext->property.count = tb->properties ? mono_array_length (tb->properties) : 0;
+       ext->property.first = 0;
+
+       properties = image_g_new0 (image, MonoProperty, ext->property.count);
+       ext->properties = properties;
+       for (i = 0; i < ext->property.count; ++i) {
+               pb = mono_array_get (tb->properties, MonoReflectionPropertyBuilder*, i);
+               properties [i].parent = klass;
+               properties [i].attrs = pb->attrs;
+               properties [i].name = mono_string_to_utf8_image (image, pb->name, error);
+               if (!mono_error_ok (error))
+                       return;
+               if (pb->get_method)
+                       properties [i].get = pb->get_method->mhandle;
+               if (pb->set_method)
+                       properties [i].set = pb->set_method->mhandle;
+
+               mono_save_custom_attrs (klass->image, &properties [i], pb->cattrs);
+               if (pb->def_value) {
+                       guint32 len, idx;
+                       const char *p, *p2;
+                       MonoDynamicImage *assembly = (MonoDynamicImage*)klass->image;
+                       if (!ext->prop_def_values)
+                               ext->prop_def_values = image_g_new0 (image, MonoFieldDefaultValue, ext->property.count);
+                       properties [i].attrs |= PROPERTY_ATTRIBUTE_HAS_DEFAULT;
+                       idx = mono_dynimage_encode_constant (assembly, pb->def_value, &ext->prop_def_values [i].def_type);
+                       /* Copy the data from the blob since it might get realloc-ed */
+                       p = assembly->blob.data + idx;
+                       len = mono_metadata_decode_blob_size (p, &p2);
+                       len += p2 - p;
+                       ext->prop_def_values [i].data = (const char *)mono_image_alloc (image, len);
+                       memcpy ((gpointer)ext->prop_def_values [i].data, p, len);
+               }
+       }
+}
+
+static void
+typebuilder_setup_events (MonoClass *klass, MonoError *error)
+{
+       MonoReflectionTypeBuilder *tb = (MonoReflectionTypeBuilder *)mono_class_get_ref_info (klass);
+       MonoReflectionEventBuilder *eb;
+       MonoImage *image = klass->image;
+       MonoEvent *events;
+       MonoClassExt *ext;
+       int i;
+
+       mono_error_init (error);
+
+       ext = mono_class_get_ext (klass);
+       if (!ext)
+               mono_class_set_ext (klass, ext = image_g_new0 (image, MonoClassExt, 1));
+
+       ext->event.count = tb->events ? mono_array_length (tb->events) : 0;
+       ext->event.first = 0;
+
+       events = image_g_new0 (image, MonoEvent, ext->event.count);
+       ext->events = events;
+       for (i = 0; i < ext->event.count; ++i) {
+               eb = mono_array_get (tb->events, MonoReflectionEventBuilder*, i);
+               events [i].parent = klass;
+               events [i].attrs = eb->attrs;
+               events [i].name = mono_string_to_utf8_image (image, eb->name, error);
+               if (!mono_error_ok (error))
+                       return;
+               if (eb->add_method)
+                       events [i].add = eb->add_method->mhandle;
+               if (eb->remove_method)
+                       events [i].remove = eb->remove_method->mhandle;
+               if (eb->raise_method)
+                       events [i].raise = eb->raise_method->mhandle;
+
+#ifndef MONO_SMALL_CONFIG
+               if (eb->other_methods) {
+                       int j;
+                       events [i].other = image_g_new0 (image, MonoMethod*, mono_array_length (eb->other_methods) + 1);
+                       for (j = 0; j < mono_array_length (eb->other_methods); ++j) {
+                               MonoReflectionMethodBuilder *mb = 
+                                       mono_array_get (eb->other_methods,
+                                                                       MonoReflectionMethodBuilder*, j);
+                               events [i].other [j] = mb->mhandle;
+                       }
+               }
+#endif
+               mono_save_custom_attrs (klass->image, &events [i], eb->cattrs);
+       }
+}
+
+struct remove_instantiations_user_data
+{
+       MonoClass *klass;
+       MonoError *error;
+};
+
+static gboolean
+remove_instantiations_of_and_ensure_contents (gpointer key,
+                                                 gpointer value,
+                                                 gpointer user_data)
+{
+       struct remove_instantiations_user_data *data = (struct remove_instantiations_user_data*)user_data;
+       MonoType *type = (MonoType*)key;
+       MonoClass *klass = data->klass;
+       gboolean already_failed = !is_ok (data->error);
+       MonoError lerror;
+       MonoError *error = already_failed ? &lerror : data->error;
+
+       if ((type->type == MONO_TYPE_GENERICINST) && (type->data.generic_class->container_class == klass)) {
+               MonoClass *inst_klass = mono_class_from_mono_type (type);
+               //Ensure it's safe to use it.
+               if (!fix_partial_generic_class (inst_klass, error)) {
+                       mono_class_set_type_load_failure (inst_klass, "Could not initialized generic type instance due to: %s", mono_error_get_message (error));
+                       // Marked the class with failure, but since some other instantiation already failed,
+                       // just report that one, and swallow the error from this one.
+                       if (already_failed)
+                               mono_error_cleanup (error);
+               }
+               return TRUE;
+       } else
+               return FALSE;
+}
+
+MonoReflectionType*
+ves_icall_TypeBuilder_create_runtime_class (MonoReflectionTypeBuilder *tb)
+{
+       MonoError error;
+       MonoClass *klass;
+       MonoDomain* domain;
+       MonoReflectionType* res;
+       int i;
+
+       mono_error_init (&error);
+
+       reflection_create_generic_class (tb, &error);
+       mono_error_assert_ok (&error);
+
+       domain = mono_object_domain (tb);
+       klass = mono_class_from_mono_type (tb->type.type);
+
+       mono_save_custom_attrs (klass->image, klass, tb->cattrs);
+
+       /* 
+        * we need to lock the domain because the lock will be taken inside
+        * So, we need to keep the locking order correct.
+        */
+       mono_loader_lock ();
+       mono_domain_lock (domain);
+       if (klass->wastypebuilder) {
+               mono_domain_unlock (domain);
+               mono_loader_unlock ();
+
+               res = mono_type_get_object_checked (mono_object_domain (tb), &klass->byval_arg, &error);
+               mono_error_set_pending_exception (&error);
+
+               return res;
+       }
+       /*
+        * Fields to set in klass:
+        * the various flags: delegate/unicode/contextbound etc.
+        */
+       mono_class_set_flags (klass, tb->attrs);
+       klass->has_cctor = 1;
+
+       mono_class_setup_parent (klass, klass->parent);
+       /* fool mono_class_setup_supertypes */
+       klass->supertypes = NULL;
+       mono_class_setup_supertypes (klass);
+       mono_class_setup_mono_type (klass);
+
+       /* enums are done right away */
+       if (!klass->enumtype)
+               if (!ensure_runtime_vtable (klass, &error))
+                       goto failure;
+
+       if (tb->subtypes) {
+               for (i = 0; i < mono_array_length (tb->subtypes); ++i) {
+                       MonoReflectionTypeBuilder *subtb = mono_array_get (tb->subtypes, MonoReflectionTypeBuilder*, i);
+                       mono_class_alloc_ext (klass);
+
+                       if (!subtb->type.type) {
+                               reflection_setup_internal_class (subtb, &error);
+                               mono_error_assert_ok (&error);
+                       }
+
+                       MonoType *subtype = mono_reflection_type_get_handle ((MonoReflectionType*)subtb, &error);
+                       if (!is_ok (&error)) goto failure;
+                       mono_class_get_ext (klass)->nested_classes = g_list_prepend_image (klass->image, mono_class_get_ext (klass)->nested_classes, mono_class_from_mono_type (subtype));
+               }
+       }
+
+       klass->nested_classes_inited = TRUE;
+
+       typebuilder_setup_fields (klass, &error);
+       if (!mono_error_ok (&error))
+               goto failure;
+       typebuilder_setup_properties (klass, &error);
+       if (!mono_error_ok (&error))
+               goto failure;
+
+       typebuilder_setup_events (klass, &error);
+       if (!mono_error_ok (&error))
+               goto failure;
+
+       klass->wastypebuilder = TRUE;
+
+       if (tb->generic_params) {
+               for (i = 0; i < mono_array_length (tb->generic_params); i++) {
+                       MonoReflectionGenericParam *gparam = (MonoReflectionGenericParam *)mono_array_get (tb->generic_params, gpointer, i);
+                       MonoType *param_type = mono_reflection_type_get_handle ((MonoReflectionType*)gparam, &error);
+                       MonoClass *gklass = mono_class_from_mono_type (param_type);
+
+                       gklass->wastypebuilder = TRUE;
+               }
+       }
+
+       /* 
+        * If we are a generic TypeBuilder, there might be instantiations in the type cache
+        * which have type System.Reflection.MonoGenericClass, but after the type is created, 
+        * we want to return normal System.MonoType objects, so clear these out from the cache.
+        *
+        * Together with this we must ensure the contents of all instances to match the created type.
+        */
+       if (domain->type_hash && mono_class_is_gtd (klass)) {
+               struct remove_instantiations_user_data data;
+               data.klass = klass;
+               data.error = &error;
+               mono_error_assert_ok (&error);
+               mono_g_hash_table_foreach_remove (domain->type_hash, remove_instantiations_of_and_ensure_contents, &data);
+               if (!is_ok (&error))
+                       goto failure;
+       }
+
+       mono_domain_unlock (domain);
+       mono_loader_unlock ();
+
+       if (klass->enumtype && !mono_class_is_valid_enum (klass)) {
+               mono_class_set_type_load_failure (klass, "Not a valid enumeration");
+               mono_error_set_type_load_class (&error, klass, "Not a valid enumeration");
+               goto failure_unlocked;
+       }
+
+       res = mono_type_get_object_checked (mono_object_domain (tb), &klass->byval_arg, &error);
+       if (!is_ok (&error))
+               goto failure_unlocked;
+
+       g_assert (res != (MonoReflectionType*)tb);
+
+       return res;
+
+failure:
+       mono_class_set_type_load_failure (klass, "TypeBuilder could not create runtime class due to: %s", mono_error_get_message (&error));
+       klass->wastypebuilder = TRUE;
+       mono_domain_unlock (domain);
+       mono_loader_unlock ();
+failure_unlocked:
+       mono_error_set_pending_exception (&error);
+       return NULL;
+}
+
+typedef struct {
+       MonoMethod *handle;
+       MonoDomain *domain;
+} DynamicMethodReleaseData;
+
+/*
+ * The runtime automatically clean up those after finalization.
+*/     
+static MonoReferenceQueue *dynamic_method_queue;
+
+static void
+free_dynamic_method (void *dynamic_method)
+{
+       DynamicMethodReleaseData *data = (DynamicMethodReleaseData *)dynamic_method;
+       MonoDomain *domain = data->domain;
+       MonoMethod *method = data->handle;
+       guint32 dis_link;
+
+       mono_domain_lock (domain);
+       dis_link = (guint32)(size_t)g_hash_table_lookup (domain->method_to_dyn_method, method);
+       g_hash_table_remove (domain->method_to_dyn_method, method);
+       mono_domain_unlock (domain);
+       g_assert (dis_link);
+       mono_gchandle_free (dis_link);
+
+       mono_runtime_free_method (domain, method);
+       g_free (data);
+}
+
+static gboolean
+reflection_create_dynamic_method (MonoReflectionDynamicMethod *mb, MonoError *error)
+{
+       MonoReferenceQueue *queue;
+       MonoMethod *handle;
+       DynamicMethodReleaseData *release_data;
+       ReflectionMethodBuilder rmb;
+       MonoMethodSignature *sig;
+       MonoClass *klass;
+       MonoDomain *domain;
+       GSList *l;
+       int i;
+
+       mono_error_init (error);
+
+       if (mono_runtime_is_shutting_down ()) {
+               mono_error_set_generic_error (error, "System", "InvalidOperationException", "");
+               return FALSE;
+       }
+
+       if (!(queue = dynamic_method_queue)) {
+               mono_loader_lock ();
+               if (!(queue = dynamic_method_queue))
+                       queue = dynamic_method_queue = mono_gc_reference_queue_new (free_dynamic_method);
+               mono_loader_unlock ();
+       }
+
+       sig = dynamic_method_to_signature (mb, error);
+       return_val_if_nok (error, FALSE);
+
+       reflection_methodbuilder_from_dynamic_method (&rmb, mb);
+
+       /*
+        * Resolve references.
+        */
+       /* 
+        * Every second entry in the refs array is reserved for storing handle_class,
+        * which is needed by the ldtoken implementation in the JIT.
+        */
+       rmb.nrefs = mb->nrefs;
+       rmb.refs = g_new0 (gpointer, mb->nrefs + 1);
+       for (i = 0; i < mb->nrefs; i += 2) {
+               MonoClass *handle_class;
+               gpointer ref;
+               MonoObject *obj = mono_array_get (mb->refs, MonoObject*, i);
+
+               if (strcmp (obj->vtable->klass->name, "DynamicMethod") == 0) {
+                       MonoReflectionDynamicMethod *method = (MonoReflectionDynamicMethod*)obj;
+                       /*
+                        * The referenced DynamicMethod should already be created by the managed
+                        * code, except in the case of circular references. In that case, we store
+                        * method in the refs array, and fix it up later when the referenced 
+                        * DynamicMethod is created.
+                        */
+                       if (method->mhandle) {
+                               ref = method->mhandle;
+                       } else {
+                               /* FIXME: GC object stored in unmanaged memory */
+                               ref = method;
+
+                               /* FIXME: GC object stored in unmanaged memory */
+                               method->referenced_by = g_slist_append (method->referenced_by, mb);
+                       }
+                       handle_class = mono_defaults.methodhandle_class;
+               } else {
+                       MonoException *ex = NULL;
+                       ref = mono_reflection_resolve_object (mb->module->image, obj, &handle_class, NULL, error);
+                       if (!is_ok  (error)) {
+                               g_free (rmb.refs);
+                               return FALSE;
+                       }
+                       if (!ref)
+                               ex = mono_get_exception_type_load (NULL, NULL);
+                       else if (mono_security_core_clr_enabled ())
+                               ex = mono_security_core_clr_ensure_dynamic_method_resolved_object (ref, handle_class);
+
+                       if (ex) {
+                               g_free (rmb.refs);
+                               mono_error_set_exception_instance (error, ex);
+                               return FALSE;
+                       }
+               }
+
+               rmb.refs [i] = ref; /* FIXME: GC object stored in unmanaged memory (change also resolve_object() signature) */
+               rmb.refs [i + 1] = handle_class;
+       }               
+
+       if (mb->owner) {
+               MonoType *owner_type = mono_reflection_type_get_handle ((MonoReflectionType*)mb->owner, error);
+               if (!is_ok (error)) {
+                       g_free (rmb.refs);
+                       return FALSE;
+               }
+               klass = mono_class_from_mono_type (owner_type);
+       } else {
+               klass = mono_defaults.object_class;
+       }
+
+       mb->mhandle = handle = reflection_methodbuilder_to_mono_method (klass, &rmb, sig, error);
+       g_free (rmb.refs);
+       return_val_if_nok (error, FALSE);
+
+       release_data = g_new (DynamicMethodReleaseData, 1);
+       release_data->handle = handle;
+       release_data->domain = mono_object_get_domain ((MonoObject*)mb);
+       if (!mono_gc_reference_queue_add (queue, (MonoObject*)mb, release_data))
+               g_free (release_data);
+
+       /* Fix up refs entries pointing at us */
+       for (l = mb->referenced_by; l; l = l->next) {
+               MonoReflectionDynamicMethod *method = (MonoReflectionDynamicMethod*)l->data;
+               MonoMethodWrapper *wrapper = (MonoMethodWrapper*)method->mhandle;
+               gpointer *data;
+               
+               g_assert (method->mhandle);
+
+               data = (gpointer*)wrapper->method_data;
+               for (i = 0; i < GPOINTER_TO_UINT (data [0]); i += 2) {
+                       if ((data [i + 1] == mb) && (data [i + 1 + 1] == mono_defaults.methodhandle_class))
+                               data [i + 1] = mb->mhandle;
+               }
+       }
+       g_slist_free (mb->referenced_by);
+
+       /* ilgen is no longer needed */
+       mb->ilgen = NULL;
+
+       domain = mono_domain_get ();
+       mono_domain_lock (domain);
+       if (!domain->method_to_dyn_method)
+               domain->method_to_dyn_method = g_hash_table_new (NULL, NULL);
+       g_hash_table_insert (domain->method_to_dyn_method, handle, (gpointer)(size_t)mono_gchandle_new_weakref ((MonoObject *)mb, TRUE));
+       mono_domain_unlock (domain);
+
+       return TRUE;
+}
+
+void
+ves_icall_DynamicMethod_create_dynamic_method (MonoReflectionDynamicMethod *mb)
+{
+       MonoError error;
+       (void) reflection_create_dynamic_method (mb, &error);
+       mono_error_set_pending_exception (&error);
+}
+
+#endif /* DISABLE_REFLECTION_EMIT */
+
+MonoMethodSignature *
+mono_reflection_lookup_signature (MonoImage *image, MonoMethod *method, guint32 token, MonoError *error)
+{
+       MonoMethodSignature *sig;
+       g_assert (image_is_dynamic (image));
+
+       mono_error_init (error);
+
+       sig = (MonoMethodSignature *)g_hash_table_lookup (((MonoDynamicImage*)image)->vararg_aux_hash, GUINT_TO_POINTER (token));
+       if (sig)
+               return sig;
+
+       return mono_method_signature_checked (method, error);
+}
+
+#ifndef DISABLE_REFLECTION_EMIT
+
+/*
+ * ensure_complete_type:
+ *
+ *   Ensure that KLASS is completed if it is a dynamic type, or references
+ * dynamic types.
+ */
+static void
+ensure_complete_type (MonoClass *klass, MonoError *error)
+{
+       mono_error_init (error);
+
+       if (image_is_dynamic (klass->image) && !klass->wastypebuilder && mono_class_get_ref_info (klass)) {
+               MonoReflectionTypeBuilder *tb = (MonoReflectionTypeBuilder *)mono_class_get_ref_info (klass);
+
+               mono_domain_try_type_resolve_checked (mono_domain_get (), NULL, (MonoObject*)tb, error);
+               return_if_nok (error);
+
+               // Asserting here could break a lot of code
+               //g_assert (klass->wastypebuilder);
+       }
+
+       if (mono_class_is_ginst (klass)) {
+               MonoGenericInst *inst = mono_class_get_generic_class (klass)->context.class_inst;
+               int i;
+
+               for (i = 0; i < inst->type_argc; ++i) {
+                       ensure_complete_type (mono_class_from_mono_type (inst->type_argv [i]), error);
+                       return_if_nok (error);
+               }
+       }
+}
+
+gpointer
+mono_reflection_resolve_object (MonoImage *image, MonoObject *obj, MonoClass **handle_class, MonoGenericContext *context, MonoError *error)
+{
+       MonoClass *oklass = obj->vtable->klass;
+       gpointer result = NULL;
+
+       mono_error_init (error);
+
+       if (strcmp (oklass->name, "String") == 0) {
+               result = mono_string_intern_checked ((MonoString*)obj, error);
+               return_val_if_nok (error, NULL);
+               *handle_class = mono_defaults.string_class;
+               g_assert (result);
+       } else if (strcmp (oklass->name, "RuntimeType") == 0) {
+               MonoType *type = mono_reflection_type_get_handle ((MonoReflectionType*)obj, error);
+               return_val_if_nok (error, NULL);
+               MonoClass *mc = mono_class_from_mono_type (type);
+               if (!mono_class_init (mc)) {
+                       mono_error_set_for_class_failure (error, mc);
+                       return NULL;
+               }
+
+               if (context) {
+                       MonoType *inflated = mono_class_inflate_generic_type_checked (type, context, error);
+                       return_val_if_nok (error, NULL);
+
+                       result = mono_class_from_mono_type (inflated);
+                       mono_metadata_free_type (inflated);
+               } else {
+                       result = mono_class_from_mono_type (type);
+               }
+               *handle_class = mono_defaults.typehandle_class;
+               g_assert (result);
+       } else if (strcmp (oklass->name, "MonoMethod") == 0 ||
+                          strcmp (oklass->name, "MonoCMethod") == 0) {
+               result = ((MonoReflectionMethod*)obj)->method;
+               if (context) {
+                       result = mono_class_inflate_generic_method_checked ((MonoMethod *)result, context, error);
+                       mono_error_assert_ok (error);
+               }
+               *handle_class = mono_defaults.methodhandle_class;
+               g_assert (result);
+       } else if (strcmp (oklass->name, "MonoField") == 0) {
+               MonoClassField *field = ((MonoReflectionField*)obj)->field;
+
+               ensure_complete_type (field->parent, error);
+               return_val_if_nok (error, NULL);
+
+               if (context) {
+                       MonoType *inflated = mono_class_inflate_generic_type_checked (&field->parent->byval_arg, context, error);
+                       return_val_if_nok (error, NULL);
+
+                       MonoClass *klass = mono_class_from_mono_type (inflated);
+                       MonoClassField *inflated_field;
+                       gpointer iter = NULL;
+                       mono_metadata_free_type (inflated);
+                       while ((inflated_field = mono_class_get_fields (klass, &iter))) {
+                               if (!strcmp (field->name, inflated_field->name))
+                                       break;
+                       }
+                       g_assert (inflated_field && !strcmp (field->name, inflated_field->name));
+                       result = inflated_field;
+               } else {
+                       result = field;
+               }
+               *handle_class = mono_defaults.fieldhandle_class;
+               g_assert (result);
+       } else if (strcmp (oklass->name, "TypeBuilder") == 0) {
+               MonoReflectionTypeBuilder *tb = (MonoReflectionTypeBuilder*)obj;
+               MonoType *type = mono_reflection_type_get_handle ((MonoReflectionType*)tb, error);
+               return_val_if_nok (error, NULL);
+               MonoClass *klass;
+
+               klass = type->data.klass;
+               if (klass->wastypebuilder) {
+                       /* Already created */
+                       result = klass;
+               }
+               else {
+                       mono_domain_try_type_resolve_checked (mono_domain_get (), NULL, (MonoObject*)tb, error);
+                       return_val_if_nok (error, NULL);
+                       result = type->data.klass;
+                       g_assert (result);
+               }
+               *handle_class = mono_defaults.typehandle_class;
+       } else if (strcmp (oklass->name, "SignatureHelper") == 0) {
+               MonoReflectionSigHelper *helper = (MonoReflectionSigHelper*)obj;
+               MonoMethodSignature *sig;
+               int nargs, i;
+
+               if (helper->arguments)
+                       nargs = mono_array_length (helper->arguments);
+               else
+                       nargs = 0;
+
+               sig = mono_metadata_signature_alloc (image, nargs);
+               sig->explicit_this = helper->call_conv & 64 ? 1 : 0;
+               sig->hasthis = helper->call_conv & 32 ? 1 : 0;
+
+               if (helper->unmanaged_call_conv) { /* unmanaged */
+                       sig->call_convention = helper->unmanaged_call_conv - 1;
+                       sig->pinvoke = TRUE;
+               } else if (helper->call_conv & 0x02) {
+                       sig->call_convention = MONO_CALL_VARARG;
+               } else {
+                       sig->call_convention = MONO_CALL_DEFAULT;
+               }
+
+               sig->param_count = nargs;
+               /* TODO: Copy type ? */
+               sig->ret = helper->return_type->type;
+               for (i = 0; i < nargs; ++i) {
+                       sig->params [i] = mono_type_array_get_and_resolve (helper->arguments, i, error);
+                       if (!is_ok (error)) {
+                               image_g_free (image, sig);
+                               return NULL;
+                       }
+               }
+
+               result = sig;
+               *handle_class = NULL;
+       } else if (strcmp (oklass->name, "DynamicMethod") == 0) {
+               MonoReflectionDynamicMethod *method = (MonoReflectionDynamicMethod*)obj;
+               /* Already created by the managed code */
+               g_assert (method->mhandle);
+               result = method->mhandle;
+               *handle_class = mono_defaults.methodhandle_class;
+       } else if (strcmp (oklass->name, "MonoArrayMethod") == 0) {
+               MonoReflectionArrayMethod *m = (MonoReflectionArrayMethod*)obj;
+               MonoType *mtype;
+               MonoClass *klass;
+               MonoMethod *method;
+               gpointer iter;
+               char *name;
+
+               mtype = mono_reflection_type_get_handle (m->parent, error);
+               return_val_if_nok (error, NULL);
+               klass = mono_class_from_mono_type (mtype);
+
+               /* Find the method */
+
+               name = mono_string_to_utf8_checked (m->name, error);
+               return_val_if_nok (error, NULL);
+               iter = NULL;
+               while ((method = mono_class_get_methods (klass, &iter))) {
+                       if (!strcmp (method->name, name))
+                               break;
+               }
+               g_free (name);
+
+               // FIXME:
+               g_assert (method);
+               // FIXME: Check parameters/return value etc. match
+
+               result = method;
+               *handle_class = mono_defaults.methodhandle_class;
+       } else if (is_sre_method_builder (oklass) ||
+                          mono_is_sre_ctor_builder (oklass) ||
+                          is_sre_field_builder (oklass) ||
+                          is_sre_gparam_builder (oklass) ||
+                          is_sre_generic_instance (oklass) ||
+                          is_sre_array (oklass) ||
+                          is_sre_byref (oklass) ||
+                          is_sre_pointer (oklass) ||
+                          !strcmp (oklass->name, "FieldOnTypeBuilderInst") ||
+                          !strcmp (oklass->name, "MethodOnTypeBuilderInst") ||
+                          !strcmp (oklass->name, "ConstructorOnTypeBuilderInst")) {
+               static MonoMethod *resolve_method;
+               if (!resolve_method) {
+                       MonoMethod *m = mono_class_get_method_from_name_flags (mono_class_get_module_builder_class (), "RuntimeResolve", 1, 0);
+                       g_assert (m);
+                       mono_memory_barrier ();
+                       resolve_method = m;
+               }
+               void *args [16];
+               args [0] = obj;
+               obj = mono_runtime_invoke_checked (resolve_method, NULL, args, error);
+               mono_error_assert_ok (error);
+               g_assert (obj);
+               return mono_reflection_resolve_object (image, obj, handle_class, context, error);
+       } else {
+               g_print ("%s\n", obj->vtable->klass->name);
+               g_assert_not_reached ();
+       }
+       return result;
+}
+
+#else /* DISABLE_REFLECTION_EMIT */
+
+MonoArray*
+mono_reflection_get_custom_attrs_blob (MonoReflectionAssembly *assembly, MonoObject *ctor, MonoArray *ctorArgs, MonoArray *properties, MonoArray *propValues, MonoArray *fields, MonoArray* fieldValues) 
+{
+       g_assert_not_reached ();
+       return NULL;
+}
+
+void
+mono_reflection_dynimage_basic_init (MonoReflectionAssemblyBuilder *assemblyb)
+{
+       g_error ("This mono runtime was configured with --enable-minimal=reflection_emit, so System.Reflection.Emit is not supported.");
+}
+
+static void
+mono_image_module_basic_init (MonoReflectionModuleBuilder *moduleb)
+{
+       g_assert_not_reached ();
+}
+
+guint32
+mono_image_insert_string (MonoReflectionModuleBuilder *module, MonoString *str)
+{
+       g_assert_not_reached ();
+       return 0;
+}
+
+guint32
+mono_image_create_method_token (MonoDynamicImage *assembly, MonoObject *obj, MonoArray *opt_param_types, MonoError *error)
+{
+       g_assert_not_reached ();
+       return 0;
+}
+
+guint32
+mono_image_create_token (MonoDynamicImage *assembly, MonoObject *obj, 
+                        gboolean create_open_instance, gboolean register_token, MonoError *error)
+{
+       g_assert_not_reached ();
+       return 0;
+}
+
+void
+mono_reflection_get_dynamic_overrides (MonoClass *klass, MonoMethod ***overrides, int *num_overrides, MonoError *error)
+{
+       mono_error_init (error);
+       *overrides = NULL;
+       *num_overrides = 0;
+}
+
+MonoReflectionType*
+ves_icall_TypeBuilder_create_runtime_class (MonoReflectionTypeBuilder *tb)
+{
+       g_assert_not_reached ();
+       return NULL;
+}
+
+void 
+ves_icall_DynamicMethod_create_dynamic_method (MonoReflectionDynamicMethod *mb)
+{
+}
+
+MonoType*
+mono_reflection_type_get_handle (MonoReflectionType* ref, MonoError *error)
+{
+       mono_error_init (error);
+       if (!ref)
+               return NULL;
+       return ref->type;
+}
+
+#endif /* DISABLE_REFLECTION_EMIT */
+
+void
+mono_sre_generic_param_table_entry_free (GenericParamTableEntry *entry)
+{
+       mono_gc_deregister_root ((char*) &entry->gparam);
+       g_free (entry);
+}
+
+gint32
+ves_icall_ModuleBuilder_getToken (MonoReflectionModuleBuilder *mb, MonoObject *obj, gboolean create_open_instance)
+{
+       MONO_CHECK_ARG_NULL (obj, 0);
+
+       MonoError error;
+       gint32 result = mono_image_create_token (mb->dynamic_image, obj, create_open_instance, TRUE, &error);
+       mono_error_set_pending_exception (&error);
+       return result;
+}
+
+gint32
+ves_icall_ModuleBuilder_getMethodToken (MonoReflectionModuleBuilder *mb,
+                                       MonoReflectionMethod *method,
+                                       MonoArray *opt_param_types)
+{
+       MONO_CHECK_ARG_NULL (method, 0);
+
+       MonoError error;
+       gint32 result = mono_image_create_method_token (
+               mb->dynamic_image, (MonoObject *) method, opt_param_types, &error);
+       mono_error_set_pending_exception (&error);
+       return result;
+}
+
+void
+ves_icall_ModuleBuilder_WriteToFile (MonoReflectionModuleBuilder *mb, HANDLE file)
+{
+       MonoError error;
+       mono_image_create_pefile (mb, file, &error);
+       mono_error_set_pending_exception (&error);
+}
+
+void
+ves_icall_ModuleBuilder_build_metadata (MonoReflectionModuleBuilder *mb)
+{
+       MonoError error;
+       mono_image_build_metadata (mb, &error);
+       mono_error_set_pending_exception (&error);
+}
+
+void
+ves_icall_ModuleBuilder_RegisterToken (MonoReflectionModuleBuilder *mb, MonoObject *obj, guint32 token)
+{
+       mono_image_register_token (mb->dynamic_image, token, obj);
+}
+
+MonoObject*
+ves_icall_ModuleBuilder_GetRegisteredToken (MonoReflectionModuleBuilder *mb, guint32 token)
+{
+       MonoObject *obj;
+
+       mono_loader_lock ();
+       obj = (MonoObject *)mono_g_hash_table_lookup (mb->dynamic_image->tokens, GUINT_TO_POINTER (token));
+       mono_loader_unlock ();
+
+       return obj;
+}
+
+#ifndef DISABLE_REFLECTION_EMIT
+MonoArray*
+ves_icall_CustomAttributeBuilder_GetBlob (MonoReflectionAssembly *assembly, MonoObject *ctor, MonoArray *ctorArgs, MonoArray *properties, MonoArray *propValues, MonoArray *fields, MonoArray* fieldValues)
+{
+       MonoError error;
+       MonoArray *result = mono_reflection_get_custom_attrs_blob_checked (assembly, ctor, ctorArgs, properties, propValues, fields, fieldValues, &error);
+       mono_error_set_pending_exception (&error);
+       return result;
+}
+#endif
+
+void
+ves_icall_AssemblyBuilder_basic_init (MonoReflectionAssemblyBuilder *assemblyb)
+{
+       mono_reflection_dynimage_basic_init (assemblyb);
+}
+
+void
+ves_icall_EnumBuilder_setup_enum_type (MonoReflectionType *enumtype,
+                                                                          MonoReflectionType *t)
+{
+       enumtype->type = t->type;
+}
+
+void
+ves_icall_ModuleBuilder_basic_init (MonoReflectionModuleBuilder *moduleb)
+{
+       mono_image_module_basic_init (moduleb);
+}
+
+guint32
+ves_icall_ModuleBuilder_getUSIndex (MonoReflectionModuleBuilder *module, MonoString *str)
+{
+       return mono_image_insert_string (module, str);
+}
+
+void
+ves_icall_ModuleBuilder_set_wrappers_type (MonoReflectionModuleBuilder *moduleb, MonoReflectionType *type)
+{
+       MonoDynamicImage *image = moduleb->dynamic_image;
+
+       g_assert (type->type);
+       image->wrappers_type = mono_class_from_mono_type (type->type);
+}
index c15d5be8ad134fdac250e1280362368eb263f58e..afd2bcc9e366b4b188cc4321437877f69327b172 100644 (file)
@@ -33,6 +33,7 @@
 #include <mono/metadata/object-internals.h>
 #include <mono/metadata/threadpool-ms.h>
 #include <mono/metadata/threadpool-ms-io.h>
+#include <mono/metadata/w32event.h>
 #include <mono/utils/atomic.h>
 #include <mono/utils/mono-compiler.h>
 #include <mono/utils/mono-complex.h>
@@ -159,6 +160,11 @@ typedef struct {
        gboolean suspended;
 } ThreadPool;
 
+typedef struct {
+       gint32 ref;
+       MonoCoopCond cond;
+} ThreadPoolDomainCleanupSemaphore;
+
 typedef enum {
        TRANSITION_WARMUP,
        TRANSITION_INITIALIZING,
@@ -418,24 +424,36 @@ domain_remove (ThreadPoolDomain *tpdomain)
 static ThreadPoolDomain *
 domain_get (MonoDomain *domain, gboolean create)
 {
-       ThreadPoolDomain *tpdomain = NULL;
        guint i;
 
        g_assert (domain);
 
        for (i = 0; i < threadpool->domains->len; ++i) {
+               ThreadPoolDomain *tpdomain;
+
                tpdomain = (ThreadPoolDomain *)g_ptr_array_index (threadpool->domains, i);
                if (tpdomain->domain == domain)
                        return tpdomain;
        }
 
        if (create) {
+               ThreadPoolDomain *tpdomain;
+               ThreadPoolDomainCleanupSemaphore *cleanup_semaphore;
+               cleanup_semaphore = g_new0 (ThreadPoolDomainCleanupSemaphore, 1);
+               cleanup_semaphore->ref = 2;
+               mono_coop_cond_init (&cleanup_semaphore->cond);
+
+               g_assert(!domain->cleanup_semaphore);
+               domain->cleanup_semaphore = cleanup_semaphore;
+
                tpdomain = g_new0 (ThreadPoolDomain, 1);
                tpdomain->domain = domain;
                domain_add (tpdomain);
+
+               return tpdomain;
        }
 
-       return tpdomain;
+       return NULL;
 }
 
 static void
@@ -644,7 +662,7 @@ worker_thread (gpointer data)
                tpdomain->outstanding_request --;
                g_assert (tpdomain->outstanding_request >= 0);
 
-               mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_THREADPOOL, "[%p] worker running in domain %p",
+               mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_THREADPOOL, "[%p] worker running in domain %p (outstanding requests %d) ",
                        mono_native_thread_id_get (), tpdomain->domain, tpdomain->outstanding_request);
 
                g_assert (tpdomain->domain);
@@ -681,10 +699,23 @@ worker_thread (gpointer data)
                g_assert (tpdomain->domain->threadpool_jobs >= 0);
 
                if (tpdomain->domain->threadpool_jobs == 0 && mono_domain_is_unloading (tpdomain->domain)) {
-                       gboolean removed = domain_remove (tpdomain);
+                       ThreadPoolDomainCleanupSemaphore *cleanup_semaphore;
+                       gboolean removed;
+
+                       removed = domain_remove(tpdomain);
                        g_assert (removed);
-                       if (tpdomain->domain->cleanup_semaphore)
-                               ReleaseSemaphore (tpdomain->domain->cleanup_semaphore, 1, NULL);
+
+                       cleanup_semaphore = (ThreadPoolDomainCleanupSemaphore*) tpdomain->domain->cleanup_semaphore;
+                       g_assert (cleanup_semaphore);
+
+                       mono_coop_cond_signal (&cleanup_semaphore->cond);
+
+                       if (InterlockedDecrement (&cleanup_semaphore->ref) == 0) {
+                               mono_coop_cond_destroy (&cleanup_semaphore->cond);
+                               g_free (cleanup_semaphore);
+                               tpdomain->domain->cleanup_semaphore = NULL;
+                       }
+
                        domain_free (tpdomain);
                        tpdomain = NULL;
                }
@@ -751,7 +782,7 @@ worker_try_create (void)
        if ((thread = mono_thread_create_internal (mono_get_root_domain (), worker_thread, NULL, TRUE, 0, &error)) != NULL) {
                threadpool->worker_creation_current_count += 1;
 
-               mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_THREADPOOL, "[%p] try create worker, created %p, now = %d count = %d", mono_native_thread_id_get (), thread->tid, now, threadpool->worker_creation_current_count);
+               mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_THREADPOOL, "[%p] try create worker, created %p, now = %d count = %d", mono_native_thread_id_get (), GUINT_TO_POINTER(thread->tid), now, threadpool->worker_creation_current_count);
                mono_coop_mutex_unlock (&threadpool->worker_creation_lock);
                return TRUE;
        }
@@ -1401,7 +1432,7 @@ mono_threadpool_ms_end_invoke (MonoAsyncResult *ares, MonoArray **out_args, Mono
                if (ares->handle) {
                        wait_event = mono_wait_handle_get_handle ((MonoWaitHandle*) ares->handle);
                } else {
-                       wait_event = CreateEvent (NULL, TRUE, FALSE, NULL);
+                       wait_event = mono_w32event_create (TRUE, FALSE);
                        g_assert(wait_event);
                        MonoWaitHandle *wait_handle = mono_wait_handle_new (mono_object_domain (ares), wait_event, error);
                        if (!is_ok (error)) {
@@ -1427,9 +1458,10 @@ mono_threadpool_ms_end_invoke (MonoAsyncResult *ares, MonoArray **out_args, Mono
 gboolean
 mono_threadpool_ms_remove_domain_jobs (MonoDomain *domain, int timeout)
 {
-       gboolean res = TRUE;
        gint64 end;
-       gpointer sem;
+       ThreadPoolDomain *tpdomain;
+       ThreadPoolDomainCleanupSemaphore *cleanup_semaphore;
+       gboolean ret;
 
        g_assert (domain);
        g_assert (timeout >= -1);
@@ -1448,38 +1480,59 @@ mono_threadpool_ms_remove_domain_jobs (MonoDomain *domain, int timeout)
 #endif
 
        /*
-        * There might be some threads out that could be about to execute stuff from the given domain.
-        * We avoid that by setting up a semaphore to be pulsed by the thread that reaches zero.
-        */
-       sem = domain->cleanup_semaphore = CreateSemaphore (NULL, 0, 1, NULL);
+       * There might be some threads out that could be about to execute stuff from the given domain.
+       * We avoid that by waiting on a semaphore to be pulsed by the thread that reaches zero.
+       * The semaphore is only created for domains which queued threadpool jobs.
+       * We always wait on the semaphore rather than ensuring domain->threadpool_jobs is 0.
+       * There may be pending outstanding requests which will create new jobs.
+       * The semaphore is signaled the threadpool domain has been removed from list
+       * and we know no more jobs for the domain will be processed.
+       */
+
+       mono_lazy_initialize(&status, initialize);
+       mono_coop_mutex_lock(&threadpool->domains_lock);
+
+       tpdomain = domain_get (domain, FALSE);
+       if (!tpdomain || tpdomain->outstanding_request == 0) {
+               mono_coop_mutex_unlock(&threadpool->domains_lock);
+               return TRUE;
+       }
 
-       /*
-        * The memory barrier here is required to have global ordering between assigning to cleanup_semaphone
-        * and reading threadpool_jobs. Otherwise this thread could read a stale version of threadpool_jobs
-        * and wait forever.
-        */
-       mono_memory_write_barrier ();
+       g_assert (domain->cleanup_semaphore);
+       cleanup_semaphore = (ThreadPoolDomainCleanupSemaphore*) domain->cleanup_semaphore;
 
-       while (domain->threadpool_jobs) {
-               gint64 now;
+       ret = TRUE;
+
+       do {
+               if (timeout == -1) {
+                       mono_coop_cond_wait (&cleanup_semaphore->cond, &threadpool->domains_lock);
+               } else {
+                       gint64 now;
+                       gint res;
 
-               if (timeout != -1) {
-                       now = mono_msec_ticks ();
+                       now = mono_msec_ticks();
                        if (now > end) {
-                               res = FALSE;
+                               ret = FALSE;
+                               break;
+                       }
+
+                       res = mono_coop_cond_timedwait (&cleanup_semaphore->cond, &threadpool->domains_lock, end - now);
+                       if (res != 0) {
+                               ret = FALSE;
                                break;
                        }
                }
+       } while (tpdomain->outstanding_request != 0);
 
-               MONO_ENTER_GC_SAFE;
-               WaitForSingleObject (sem, timeout != -1 ? end - now : timeout);
-               MONO_EXIT_GC_SAFE;
+       if (InterlockedDecrement (&cleanup_semaphore->ref) == 0) {
+               mono_coop_cond_destroy (&cleanup_semaphore->cond);
+               g_free (cleanup_semaphore);
+               domain->cleanup_semaphore = NULL;
        }
 
-       domain->cleanup_semaphore = NULL;
-       CloseHandle (sem);
+       mono_coop_mutex_unlock(&threadpool->domains_lock);
 
-       return res;
+       return ret;
 }
 
 void
index 5b910191f6c4ff0adba5cc680d20d653d034cfb4..84f2c15e98fc5e19d14ad4990b018da5766fb9e6 100644 (file)
@@ -42,6 +42,14 @@ typedef enum {
        ThreadApartmentState_Unknown = 0x00000002
 } MonoThreadApartmentState;
 
+typedef enum {
+       MONO_THREAD_PRIORITY_LOWEST       = 0,
+       MONO_THREAD_PRIORITY_BELOW_NORMAL = 1,
+       MONO_THREAD_PRIORITY_NORMAL       = 2,
+       MONO_THREAD_PRIORITY_ABOVE_NORMAL = 3,
+       MONO_THREAD_PRIORITY_HIGHEST      = 4,
+} MonoThreadPriority;
+
 #define SPECIAL_STATIC_NONE 0
 #define SPECIAL_STATIC_THREAD 1
 #define SPECIAL_STATIC_CONTEXT 2
@@ -62,7 +70,7 @@ void mono_threads_install_cleanup (MonoThreadCleanupFunc func);
 
 void ves_icall_System_Threading_Thread_ConstructInternalThread (MonoThread *this_obj);
 HANDLE ves_icall_System_Threading_Thread_Thread_internal(MonoThread *this_obj, MonoObject *start);
-void ves_icall_System_Threading_InternalThread_Thread_free_internal(MonoInternalThread *this_obj, HANDLE thread);
+void ves_icall_System_Threading_InternalThread_Thread_free_internal(MonoInternalThread *this_obj);
 void ves_icall_System_Threading_Thread_Sleep_internal(gint32 ms);
 gboolean ves_icall_System_Threading_Thread_Join_internal(MonoThread *this_obj, int ms);
 gint32 ves_icall_System_Threading_Thread_GetDomainID (void);
@@ -75,17 +83,6 @@ MonoObject* ves_icall_System_Threading_Thread_GetCachedCurrentCulture (MonoInter
 void ves_icall_System_Threading_Thread_SetCachedCurrentCulture (MonoThread *this_obj, MonoObject *culture);
 MonoObject* ves_icall_System_Threading_Thread_GetCachedCurrentUICulture (MonoInternalThread *this_obj);
 void ves_icall_System_Threading_Thread_SetCachedCurrentUICulture (MonoThread *this_obj, MonoObject *culture);
-HANDLE ves_icall_System_Threading_Mutex_CreateMutex_internal(MonoBoolean owned, MonoString *name, MonoBoolean *created);
-MonoBoolean ves_icall_System_Threading_Mutex_ReleaseMutex_internal (HANDLE handle );
-HANDLE ves_icall_System_Threading_Mutex_OpenMutex_internal (MonoString *name, gint32 rights, gint32 *error);
-HANDLE ves_icall_System_Threading_Semaphore_CreateSemaphore_internal (gint32 initialCount, gint32 maximumCount, MonoString *name, gint32 *error);
-MonoBoolean ves_icall_System_Threading_Semaphore_ReleaseSemaphore_internal (HANDLE handle, gint32 releaseCount, gint32 *prevcount);
-HANDLE ves_icall_System_Threading_Semaphore_OpenSemaphore_internal (MonoString *name, gint32 rights, gint32 *error);
-HANDLE ves_icall_System_Threading_Events_CreateEvent_internal (MonoBoolean manual, MonoBoolean initial, MonoString *name, MonoBoolean *created);
-gboolean ves_icall_System_Threading_Events_SetEvent_internal (HANDLE handle);
-gboolean ves_icall_System_Threading_Events_ResetEvent_internal (HANDLE handle);
-void ves_icall_System_Threading_Events_CloseEvent_internal (HANDLE handle);
-HANDLE ves_icall_System_Threading_Events_OpenEvent_internal (MonoString *name, gint32 rights, gint32 *error);
 
 gint32 ves_icall_System_Threading_WaitHandle_WaitAll_internal(MonoArray *mono_handles, gint32 ms);
 gint32 ves_icall_System_Threading_WaitHandle_WaitAny_internal(MonoArray *mono_handles, gint32 ms);
@@ -198,6 +195,7 @@ gboolean mono_thread_current_check_pending_interrupt (void);
 void mono_thread_set_state (MonoInternalThread *thread, MonoThreadState state);
 void mono_thread_clr_state (MonoInternalThread *thread, MonoThreadState state);
 gboolean mono_thread_test_state (MonoInternalThread *thread, MonoThreadState test);
+gboolean mono_thread_test_and_set_state (MonoInternalThread *thread, MonoThreadState test, MonoThreadState set);
 
 void mono_thread_init_apartment_state (void);
 void mono_thread_cleanup_apartment_state (void);
@@ -258,4 +256,17 @@ mono_threads_attach_coop (MonoDomain *domain, gpointer *dummy);
 MONO_API void
 mono_threads_detach_coop (gpointer cookie, gpointer *dummy);
 
+void mono_threads_begin_abort_protected_block (void);
+void mono_threads_end_abort_protected_block (void);
+MonoException* mono_thread_try_resume_interruption (void);
+
+gboolean
+mono_thread_internal_current_is_attached (void);
+
+void
+mono_thread_internal_describe (MonoInternalThread *internal, GString *str);
+
+gboolean
+mono_thread_internal_is_current (MonoInternalThread *internal);
+
 #endif /* _MONO_METADATA_THREADS_TYPES_H_ */
index 8ae79d05d99dfdc68bbe473398d18d8c9e377775..83ac3dd994b2e47ec5e10becd6e65abd8495a717 100644 (file)
 #include <mono/utils/mono-memory-model.h>
 #include <mono/utils/mono-threads-coop.h>
 #include <mono/utils/mono-error-internals.h>
+#include <mono/utils/os-event.h>
+#include <mono/utils/mono-threads-debug.h>
+#include <mono/metadata/w32handle.h>
+#include <mono/metadata/w32event.h>
+#include <mono/metadata/w32mutex.h>
 
 #include <mono/metadata/gc-internals.h>
 #include <mono/metadata/reflection-internals.h>
+#include <mono/metadata/abi-details.h>
 
 #ifdef HAVE_SIGNAL_H
 #include <signal.h>
 #endif
 
+#if defined(HOST_WIN32)
+#include <objbase.h>
+#endif
+
 #if defined(PLATFORM_ANDROID) && !defined(TARGET_ARM64) && !defined(TARGET_AMD64)
 #define USE_TKILL_ON_ANDROID 1
 #endif
@@ -82,14 +92,6 @@ extern int tkill (pid_t tid, int signal);
 #define LOCK_THREAD(thread) lock_thread((thread))
 #define UNLOCK_THREAD(thread) unlock_thread((thread))
 
-typedef struct
-{
-       guint32 (*func)(void *);
-       MonoThread *obj;
-       MonoObject *delegate;
-       void *start_arg;
-} StartInfo;
-
 typedef union {
        gint32 ival;
        gfloat fval;
@@ -150,7 +152,7 @@ static MonoReferenceQueue *context_queue;
 
 /*
  * Threads which are starting up and they are not in the 'threads' hash yet.
- * When handle_store is called for a thread, it will be removed from this hash table.
+ * When mono_thread_attach_internal is called for a thread, it will be removed from this hash table.
  * Protected by mono_threads_lock ().
  */
 static MonoGHashTable *threads_starting_up = NULL;
@@ -191,7 +193,6 @@ static MonoThreadCleanupFunc mono_thread_cleanup_fn = NULL;
 static guint32 default_stacksize = 0;
 #define default_stacksize_for_thread(thread) ((thread)->stack_size? (thread)->stack_size: default_stacksize)
 
-static void thread_adjust_static_data (MonoInternalThread *thread);
 static void context_adjust_static_data (MonoAppContext *ctx);
 static void mono_free_static_data (gpointer* static_data);
 static void mono_init_static_data_info (StaticDataInfo *static_data);
@@ -214,7 +215,7 @@ static mono_mutex_t interlocked_mutex;
 static gint32 thread_interruption_requested = 0;
 
 /* Event signaled when a thread changes its background mode */
-static HANDLE background_change_event;
+static MonoOSEvent background_change_event;
 
 static gboolean shutting_down = FALSE;
 
@@ -269,87 +270,6 @@ thread_get_tid (MonoInternalThread *thread)
        return MONO_UINT_TO_NATIVE_THREAD_ID (thread->tid);
 }
 
-/* handle_store() and handle_remove() manage the array of threads that
- * still need to be waited for when the main thread exits.
- *
- * If handle_store() returns FALSE the thread must not be started
- * because Mono is shutting down.
- */
-static gboolean handle_store(MonoThread *thread, gboolean force_attach)
-{
-       mono_threads_lock ();
-
-       THREAD_DEBUG (g_message ("%s: thread %p ID %"G_GSIZE_FORMAT, __func__, thread, (gsize)thread->internal_thread->tid));
-
-       if (threads_starting_up)
-               mono_g_hash_table_remove (threads_starting_up, thread);
-
-       if (shutting_down && !force_attach) {
-               mono_threads_unlock ();
-               return FALSE;
-       }
-
-       if(threads==NULL) {
-               MONO_GC_REGISTER_ROOT_FIXED (threads, MONO_ROOT_SOURCE_THREADING, "threads table");
-               threads=mono_g_hash_table_new_type (NULL, NULL, MONO_HASH_VALUE_GC, MONO_ROOT_SOURCE_THREADING, "threads table");
-       }
-
-       /* We don't need to duplicate thread->handle, because it is
-        * only closed when the thread object is finalized by the GC.
-        */
-       g_assert (thread->internal_thread);
-       mono_g_hash_table_insert(threads, (gpointer)(gsize)(thread->internal_thread->tid),
-                                thread->internal_thread);
-
-       mono_threads_unlock ();
-
-       return TRUE;
-}
-
-static gboolean handle_remove(MonoInternalThread *thread)
-{
-       gboolean ret;
-       gsize tid = thread->tid;
-
-       THREAD_DEBUG (g_message ("%s: thread ID %"G_GSIZE_FORMAT, __func__, tid));
-
-       mono_threads_lock ();
-
-       if (threads) {
-               /* We have to check whether the thread object for the
-                * tid is still the same in the table because the
-                * thread might have been destroyed and the tid reused
-                * in the meantime, in which case the tid would be in
-                * the table, but with another thread object.
-                */
-               if (mono_g_hash_table_lookup (threads, (gpointer)tid) == thread) {
-                       mono_g_hash_table_remove (threads, (gpointer)tid);
-                       ret = TRUE;
-               } else {
-                       ret = FALSE;
-               }
-       }
-       else
-               ret = FALSE;
-       
-       mono_threads_unlock ();
-
-       /* Don't close the handle here, wait for the object finalizer
-        * to do it. Otherwise, the following race condition applies:
-        *
-        * 1) Thread exits (and handle_remove() closes the handle)
-        *
-        * 2) Some other handle is reassigned the same slot
-        *
-        * 3) Another thread tries to join the first thread, and
-        * blocks waiting for the reassigned handle to be signalled
-        * (which might never happen).  This is possible, because the
-        * thread calling Join() still has a reference to the first
-        * thread's object.
-        */
-       return ret;
-}
-
 static void ensure_synch_cs_set (MonoInternalThread *thread)
 {
        MonoCoopMutex *synch_cs;
@@ -405,6 +325,8 @@ is_threadabort_exception (MonoClass *klass)
  */
 static void thread_cleanup (MonoInternalThread *thread)
 {
+       gboolean ret;
+
        g_assert (thread != NULL);
 
        if (thread->abort_state_handle) {
@@ -453,13 +375,45 @@ static void thread_cleanup (MonoInternalThread *thread)
        if (InterlockedExchange (&thread->interruption_requested, 0))
                InterlockedDecrement (&thread_interruption_requested);
 
+       mono_threads_lock ();
+
+       if (!threads) {
+               ret = FALSE;
+       } else if (mono_g_hash_table_lookup (threads, (gpointer)thread->tid) != thread) {
+               /* We have to check whether the thread object for the
+                * tid is still the same in the table because the
+                * thread might have been destroyed and the tid reused
+                * in the meantime, in which case the tid would be in
+                * the table, but with another thread object.
+                */
+               ret = FALSE;
+       } else {
+               mono_g_hash_table_remove (threads, (gpointer)thread->tid);
+               ret = TRUE;
+       }
+
+       mono_threads_unlock ();
+
+       /* Don't close the handle here, wait for the object finalizer
+        * to do it. Otherwise, the following race condition applies:
+        *
+        * 1) Thread exits (and thread_cleanup() closes the handle)
+        *
+        * 2) Some other handle is reassigned the same slot
+        *
+        * 3) Another thread tries to join the first thread, and
+        * blocks waiting for the reassigned handle to be signalled
+        * (which might never happen).  This is possible, because the
+        * thread calling Join() still has a reference to the first
+        * thread's object.
+        */
+
        /* if the thread is not in the hash it has been removed already */
-       if (!handle_remove (thread)) {
+       if (!ret) {
                if (thread == mono_thread_internal_current ()) {
                        mono_domain_unset ();
                        mono_memory_barrier ();
                }
-               /* This needs to be called even if handle_remove () fails */
                if (mono_thread_cleanup_fn)
                        mono_thread_cleanup_fn (thread_get_tid (thread));
                return;
@@ -499,6 +453,10 @@ static void thread_cleanup (MonoInternalThread *thread)
                thread->thread_pinning_ref = NULL;
        }
 
+       g_assert (thread->suspended);
+       mono_os_event_destroy (thread->suspended);
+       g_free (thread->suspended);
+       thread->suspended = NULL;
 }
 
 /*
@@ -587,23 +545,18 @@ set_current_thread_for_domain (MonoDomain *domain, MonoInternalThread *thread, M
 }
 
 static MonoThread*
-create_thread_object (MonoDomain *domain)
+create_thread_object (MonoDomain *domain, MonoInternalThread *internal)
 {
+       MonoThread *thread;
+       MonoVTable *vtable;
        MonoError error;
-       MonoVTable *vt = mono_class_vtable (domain, mono_defaults.thread_class);
-       MonoThread *t = (MonoThread*)mono_object_new_mature (vt, &error);
-       /* only possible failure mode is OOM, from which we don't expect to recover. */
-       mono_error_assert_ok (&error);
-       return t;
-}
 
-static MonoThread*
-new_thread_with_internal (MonoDomain *domain, MonoInternalThread *internal)
-{
-       MonoThread *thread;
+       vtable = mono_class_vtable (domain, mono_defaults.thread_class);
+       g_assert (vtable);
 
-       thread = create_thread_object (domain);
-       thread->priority = MONO_THREAD_PRIORITY_NORMAL;
+       thread = (MonoThread*)mono_object_new_mature (vtable, &error);
+       /* only possible failure mode is OOM, from which we don't expect to recover. */
+       mono_error_assert_ok (&error);
 
        MONO_OBJECT_SETREF (thread, internal_thread, internal);
 
@@ -611,7 +564,7 @@ new_thread_with_internal (MonoDomain *domain, MonoInternalThread *internal)
 }
 
 static MonoInternalThread*
-create_internal_thread (void)
+create_internal_thread_object (void)
 {
        MonoError error;
        MonoInternalThread *thread;
@@ -632,88 +585,233 @@ create_internal_thread (void)
                MONO_GC_REGISTER_ROOT_PINNING (thread->thread_pinning_ref, MONO_ROOT_SOURCE_THREADING, "thread pinning reference");
        }
 
+       thread->priority = MONO_THREAD_PRIORITY_NORMAL;
+
+       thread->suspended = g_new0 (MonoOSEvent, 1);
+       mono_os_event_init (thread->suspended, TRUE);
+
        return thread;
 }
 
+static void
+mono_thread_internal_set_priority (MonoInternalThread *internal, MonoThreadPriority priority)
+{
+       g_assert (internal);
+
+       g_assert (priority >= MONO_THREAD_PRIORITY_LOWEST);
+       g_assert (priority <= MONO_THREAD_PRIORITY_HIGHEST);
+       g_assert (MONO_THREAD_PRIORITY_LOWEST < MONO_THREAD_PRIORITY_HIGHEST);
+
+#ifdef HOST_WIN32
+       BOOL res;
+
+       g_assert (internal->native_handle);
+
+       res = SetThreadPriority (internal->native_handle, priority - 2);
+       if (!res)
+               g_error ("%s: SetThreadPriority failed, error %d", __func__, GetLastError ());
+#else /* HOST_WIN32 */
+       pthread_t tid;
+       int policy;
+       struct sched_param param;
+       gint res;
+
+       tid = thread_get_tid (internal);
+
+       res = pthread_getschedparam (tid, &policy, &param);
+       if (res != 0)
+               g_error ("%s: pthread_getschedparam failed, error: \"%s\" (%d)", __func__, g_strerror (res), res);
+
+#ifdef _POSIX_PRIORITY_SCHEDULING
+       int max, min;
+
+       /* Necessary to get valid priority range */
+
+       min = sched_get_priority_min (policy);
+       max = sched_get_priority_max (policy);
+
+       if (max > 0 && min >= 0 && max > min) {
+               double srange, drange, sposition, dposition;
+               srange = MONO_THREAD_PRIORITY_HIGHEST - MONO_THREAD_PRIORITY_LOWEST;
+               drange = max - min;
+               sposition = priority - MONO_THREAD_PRIORITY_LOWEST;
+               dposition = (sposition / srange) * drange;
+               param.sched_priority = (int)(dposition + min);
+       } else
+#endif
+       {
+               switch (policy) {
+               case SCHED_FIFO:
+               case SCHED_RR:
+                       param.sched_priority = 50;
+                       break;
+#ifdef SCHED_BATCH
+               case SCHED_BATCH:
+#endif
+               case SCHED_OTHER:
+                       param.sched_priority = 0;
+                       break;
+               default:
+                       g_error ("%s: unknown policy %d", __func__, policy);
+               }
+       }
+
+       res = pthread_setschedparam (tid, policy, &param);
+       if (res != 0) {
+               if (res == EPERM) {
+                       g_warning ("%s: pthread_setschedparam failed, error: \"%s\" (%d)", __func__, g_strerror (res), res);
+                       return;
+               }
+               g_error ("%s: pthread_setschedparam failed, error: \"%s\" (%d)", __func__, g_strerror (res), res);
+       }
+#endif /* HOST_WIN32 */
+}
+
+static void 
+mono_alloc_static_data (gpointer **static_data_ptr, guint32 offset, gboolean threadlocal);
+
 static gboolean
-init_root_domain_thread (MonoInternalThread *thread, MonoThread *candidate)
+mono_thread_attach_internal (MonoThread *thread, gboolean force_attach, gboolean force_domain, gsize *stack_ptr)
 {
-       MonoDomain *domain = mono_get_root_domain ();
+       MonoThreadInfo *info;
+       MonoInternalThread *internal;
+       MonoDomain *domain, *root_domain;
+
+       g_assert (thread);
+
+       info = mono_thread_info_current ();
+
+       internal = thread->internal_thread;
+       internal->handle = mono_threads_open_thread_handle (info->handle);
+#ifdef HOST_WIN32
+       internal->native_handle = OpenThread (THREAD_ALL_ACCESS, FALSE, GetCurrentThreadId ());
+#endif
+       internal->tid = MONO_NATIVE_THREAD_ID_TO_UINT (mono_native_thread_id_get ());
+       internal->thread_info = info;
+       internal->small_id = info->small_id;
+       internal->stack_ptr = stack_ptr;
+
+       THREAD_DEBUG (g_message ("%s: (%"G_GSIZE_FORMAT") Setting current_object_key to %p", __func__, mono_native_thread_id_get (), internal));
+
+       SET_CURRENT_OBJECT (internal);
 
-       if (!candidate || candidate->obj.vtable->domain != domain) {
-               candidate = new_thread_with_internal (domain, thread);
+       domain = mono_object_domain (thread);
+
+       mono_thread_push_appdomain_ref (domain);
+       if (!mono_domain_set (domain, force_domain)) {
+               mono_thread_pop_appdomain_ref ();
+               return FALSE;
        }
-       set_current_thread_for_domain (domain, thread, candidate);
-       g_assert (!thread->root_domain_thread);
-       MONO_OBJECT_SETREF (thread, root_domain_thread, candidate);
+
+       mono_threads_lock ();
+
+       if (threads_starting_up)
+               mono_g_hash_table_remove (threads_starting_up, thread);
+
+       if (shutting_down && !force_attach) {
+               mono_threads_unlock ();
+               return FALSE;
+       }
+
+       if (!threads) {
+               MONO_GC_REGISTER_ROOT_FIXED (threads, MONO_ROOT_SOURCE_THREADING, "threads table");
+               threads = mono_g_hash_table_new_type (NULL, NULL, MONO_HASH_VALUE_GC, MONO_ROOT_SOURCE_THREADING, "threads table");
+       }
+
+       /* We don't need to duplicate thread->handle, because it is
+        * only closed when the thread object is finalized by the GC. */
+       mono_g_hash_table_insert (threads, (gpointer)(gsize)(internal->tid), internal);
+
+       /* We have to do this here because mono_thread_start_cb
+        * requires that root_domain_thread is set up. */
+       if (thread_static_info.offset || thread_static_info.idx > 0) {
+               /* get the current allocated size */
+               guint32 offset = MAKE_SPECIAL_STATIC_OFFSET (thread_static_info.idx, thread_static_info.offset, 0);
+               mono_alloc_static_data (&internal->static_data, offset, TRUE);
+       }
+
+       mono_threads_unlock ();
+
+       root_domain = mono_get_root_domain ();
+
+       g_assert (!internal->root_domain_thread);
+       if (domain != root_domain)
+               MONO_OBJECT_SETREF (internal, root_domain_thread, create_thread_object (root_domain, internal));
+       else
+               MONO_OBJECT_SETREF (internal, root_domain_thread, thread);
+
+       if (domain != root_domain)
+               set_current_thread_for_domain (root_domain, internal, internal->root_domain_thread);
+
+       set_current_thread_for_domain (domain, internal, thread);
+
+       THREAD_DEBUG (g_message ("%s: Attached thread ID %"G_GSIZE_FORMAT" (handle %p)", __func__, internal->tid, internal->handle));
+
        return TRUE;
 }
 
-static guint32 WINAPI start_wrapper_internal(void *data)
+typedef struct {
+       gint32 ref;
+       MonoThread *thread;
+       MonoObject *start_delegate;
+       MonoObject *start_delegate_arg;
+       MonoThreadStart start_func;
+       gpointer start_func_arg;
+       gboolean failed;
+       MonoCoopSem registered;
+} StartInfo;
+
+static guint32 WINAPI start_wrapper_internal(StartInfo *start_info, gsize *stack_ptr)
 {
        MonoError error;
-       MonoThreadInfo *info;
-       StartInfo *start_info = (StartInfo *)data;
-       guint32 (*start_func)(void *);
-       void *start_arg;
+       MonoThreadStart start_func;
+       void *start_func_arg;
        gsize tid;
        /* 
-        * We don't create a local to hold start_info->obj, so hopefully it won't get pinned during a
+        * We don't create a local to hold start_info->thread, so hopefully it won't get pinned during a
         * GC stack walk.
         */
-       MonoInternalThread *internal = start_info->obj->internal_thread;
-       MonoObject *start_delegate = start_info->delegate;
-       MonoDomain *domain = start_info->obj->obj.vtable->domain;
+       MonoThread *thread;
+       MonoInternalThread *internal;
+       MonoObject *start_delegate;
+       MonoObject *start_delegate_arg;
+       MonoDomain *domain;
 
-       THREAD_DEBUG (g_message ("%s: (%"G_GSIZE_FORMAT") Start wrapper", __func__, mono_native_thread_id_get ()));
+       thread = start_info->thread;
+       internal = thread->internal_thread;
+       domain = mono_object_domain (start_info->thread);
 
-       /* We can be sure start_info->obj->tid and
-        * start_info->obj->handle have been set, because the thread
-        * was created suspended, and these values were set before the
-        * thread resumed
-        */
+       THREAD_DEBUG (g_message ("%s: (%"G_GSIZE_FORMAT") Start wrapper", __func__, mono_native_thread_id_get ()));
 
-       info = mono_thread_info_current ();
-       g_assert (info);
-       internal->thread_info = info;
-       internal->small_id = info->small_id;
+       if (!mono_thread_attach_internal (thread, FALSE, FALSE, stack_ptr)) {
+               start_info->failed = TRUE;
 
-       tid = internal->tid;
+               mono_coop_sem_post (&start_info->registered);
 
-       SET_CURRENT_OBJECT (internal);
+               if (InterlockedDecrement (&start_info->ref) == 0) {
+                       mono_coop_sem_destroy (&start_info->registered);
+                       g_free (start_info);
+               }
 
-       /* Every thread references the appdomain which created it */
-       mono_thread_push_appdomain_ref (domain);
-       
-       if (!mono_domain_set (domain, FALSE)) {
-               /* No point in raising an appdomain_unloaded exception here */
-               /* FIXME: Cleanup here */
-               mono_thread_pop_appdomain_ref ();
                return 0;
        }
 
-       start_func = start_info->func;
-       start_arg = start_info->obj->start_obj;
-       if (!start_arg)
-               start_arg = start_info->start_arg;
+       mono_thread_internal_set_priority (internal, internal->priority);
+
+       tid = internal->tid;
 
-       /* We have to do this here because mono_thread_new_init()
-          requires that root_domain_thread is set up. */
-       thread_adjust_static_data (internal);
-       init_root_domain_thread (internal, start_info->obj);
+       start_delegate = start_info->start_delegate;
+       start_delegate_arg = start_info->start_delegate_arg;
+       start_func = start_info->start_func;
+       start_func_arg = start_info->start_func_arg;
 
        /* This MUST be called before any managed code can be
         * executed, as it calls the callback function that (for the
         * jit) sets the lmf marker.
         */
-       mono_thread_new_init (tid, &tid, start_func);
-       internal->stack_ptr = &tid;
-       if (domain != mono_get_root_domain ())
-               set_current_thread_for_domain (domain, internal, start_info->obj);
-
-       LIBGC_DEBUG (g_message ("%s: (%"G_GSIZE_FORMAT",%d) Setting thread stack to %p", __func__, mono_native_thread_id_get (), getpid (), thread->stack_ptr));
 
-       THREAD_DEBUG (g_message ("%s: (%"G_GSIZE_FORMAT") Setting current_object_key to %p", __func__, mono_native_thread_id_get (), internal));
+       if (mono_thread_start_cb)
+               mono_thread_start_cb (tid, stack_ptr, start_func);
 
        /* On 2.0 profile (and higher), set explicitly since state might have been
           Unknown */
@@ -722,16 +820,16 @@ static guint32 WINAPI start_wrapper_internal(void *data)
 
        mono_thread_init_apartment_state ();
 
-       if(internal->start_notify!=NULL) {
-               /* Let the thread that called Start() know we're
-                * ready
-                */
-               ReleaseSemaphore (internal->start_notify, 1, NULL);
+       /* Let the thread that called Start() know we're ready */
+       mono_coop_sem_post (&start_info->registered);
+
+       if (InterlockedDecrement (&start_info->ref) == 0) {
+               mono_coop_sem_destroy (&start_info->registered);
+               g_free (start_info);
        }
 
-       g_free (start_info);
-       THREAD_DEBUG (g_message ("%s: start_wrapper for %"G_GSIZE_FORMAT, __func__,
-                                                        internal->tid));
+       /* start_info is not valid anymore */
+       start_info = NULL;
 
        /* 
         * Call this after calling start_notify, since the profiler callback might want
@@ -750,12 +848,14 @@ static guint32 WINAPI start_wrapper_internal(void *data)
 
        /* start_func is set only for unmanaged start functions */
        if (start_func) {
-               start_func (start_arg);
+               start_func (start_func_arg);
        } else {
                void *args [1];
+
                g_assert (start_delegate != NULL);
-               args [0] = start_arg;
+
                /* we may want to handle the exception here. See comment below on unhandled exceptions */
+               args [0] = (gpointer) start_delegate_arg;
                mono_runtime_delegate_invoke_checked (start_delegate, args, &error);
 
                if (!mono_error_ok (&error)) {
@@ -788,31 +888,18 @@ static guint32 WINAPI start_wrapper_internal(void *data)
         * for the current thead */
        mono_thread_cleanup_apartment_state ();
 
-       thread_cleanup (internal);
+       mono_thread_detach_internal (internal);
 
        internal->tid = 0;
 
-       /* Remove the reference to the thread object in the TLS data,
-        * so the thread object can be finalized.  This won't be
-        * reached if the thread threw an uncaught exception, so those
-        * thread handles will stay referenced :-( (This is due to
-        * missing support for scanning thread-specific data in the
-        * Boehm GC - the io-layer keeps a GC-visible hash of pointers
-        * to TLS data.)
-        */
-       SET_CURRENT_OBJECT (NULL);
-
        return(0);
 }
 
 static gsize WINAPI start_wrapper(void *data)
 {
-       volatile int dummy;
+       volatile gsize dummy;
 
-       /* Avoid scanning the frames above this frame during a GC */
-       mono_gc_set_stack_end ((void*)&dummy);
-
-       return start_wrapper_internal (data);
+       return start_wrapper_internal ((StartInfo*) data, (gsize*) &dummy);
 }
 
 /*
@@ -822,12 +909,19 @@ static gsize WINAPI start_wrapper(void *data)
  * LOCKING: Acquires the threads lock.
  */
 static gboolean
-create_thread (MonoThread *thread, MonoInternalThread *internal, StartInfo *start_info, gboolean threadpool_thread, guint32 stack_size,
-                          MonoError *error)
+create_thread (MonoThread *thread, MonoInternalThread *internal, MonoObject *start_delegate, MonoThreadStart start_func, gpointer start_func_arg,
+       gboolean threadpool_thread, guint32 stack_size, MonoError *error)
 {
-       HANDLE thread_handle;
+       StartInfo *start_info = NULL;
+       MonoThreadHandle *thread_handle;
        MonoNativeThreadId tid;
-       MonoThreadParm tp;
+       gboolean ret;
+       gsize stack_set_size;
+
+       if (start_delegate)
+               g_assert (!start_func && !start_func_arg);
+       if (start_func)
+               g_assert (!start_delegate);
 
        /*
         * Join joinable threads to prevent running out of threads since the finalizer
@@ -839,7 +933,6 @@ create_thread (MonoThread *thread, MonoInternalThread *internal, StartInfo *star
 
        mono_threads_lock ();
        if (shutting_down) {
-               g_free (start_info);
                mono_threads_unlock ();
                return FALSE;
        }
@@ -850,77 +943,65 @@ create_thread (MonoThread *thread, MonoInternalThread *internal, StartInfo *star
        mono_g_hash_table_insert (threads_starting_up, thread, thread);
        mono_threads_unlock ();
 
-       internal->start_notify = CreateSemaphore (NULL, 0, 0x7fffffff, NULL);
-       if (!internal->start_notify) {
-               mono_threads_lock ();
-               mono_g_hash_table_remove (threads_starting_up, thread);
-               mono_threads_unlock ();
-               g_warning ("%s: CreateSemaphore error 0x%x", __func__, GetLastError ());
-               g_free (start_info);
-               return FALSE;
-       }
+       internal->threadpool_thread = threadpool_thread;
+       if (threadpool_thread)
+               mono_thread_set_state (internal, ThreadState_Background);
 
-       if (stack_size == 0)
-               stack_size = default_stacksize_for_thread (internal);
+       start_info = g_new0 (StartInfo, 1);
+       start_info->ref = 2;
+       start_info->thread = thread;
+       start_info->start_delegate = start_delegate;
+       start_info->start_delegate_arg = thread->start_obj;
+       start_info->start_func = start_func;
+       start_info->start_func_arg = start_func_arg;
+       start_info->failed = FALSE;
+       mono_coop_sem_init (&start_info->registered, 0);
 
-       /* Create suspended, so we can do some housekeeping before the thread
-        * starts
-        */
-       tp.priority = thread->priority;
-       tp.stack_size = stack_size;
-       tp.creation_flags = CREATE_SUSPENDED;
+       if (stack_size == 0)
+               stack_set_size = default_stacksize_for_thread (internal);
+       else
+               stack_set_size = 0;
 
-       thread_handle = mono_threads_create_thread (start_wrapper, start_info, &tp, &tid);
+       thread_handle = mono_threads_create_thread (start_wrapper, start_info, &stack_set_size, &tid);
 
        if (thread_handle == NULL) {
                /* The thread couldn't be created, so set an exception */
                mono_threads_lock ();
                mono_g_hash_table_remove (threads_starting_up, thread);
                mono_threads_unlock ();
-               g_free (start_info);
                mono_error_set_execution_engine (error, "Couldn't create thread. Error 0x%x", GetLastError());
-               return FALSE;
+               /* ref is not going to be decremented in start_wrapper_internal */
+               InterlockedDecrement (&start_info->ref);
+               ret = FALSE;
+               goto done;
        }
-       THREAD_DEBUG (g_message ("%s: Started thread ID %"G_GSIZE_FORMAT" (handle %p)", __func__, tid, thread_handle));
 
-       internal->handle = thread_handle;
-       internal->tid = MONO_NATIVE_THREAD_ID_TO_UINT (tid);
-
-       internal->threadpool_thread = threadpool_thread;
-       if (threadpool_thread)
-               mono_thread_set_state (internal, ThreadState_Background);
+       internal->stack_size = (int) stack_set_size;
 
        THREAD_DEBUG (g_message ("%s: (%"G_GSIZE_FORMAT") Launching thread %p (%"G_GSIZE_FORMAT")", __func__, mono_native_thread_id_get (), internal, (gsize)internal->tid));
 
-       /* Only store the handle when the thread is about to be
-        * launched, to avoid the main thread deadlocking while trying
-        * to clean up a thread that will never be signalled.
+       /*
+        * Wait for the thread to set up its TLS data etc, so
+        * theres no potential race condition if someone tries
+        * to look up the data believing the thread has
+        * started
         */
-       if (!handle_store (thread, FALSE))
-               return FALSE;
 
-       mono_thread_info_resume (tid);
+       mono_coop_sem_wait (&start_info->registered, MONO_SEM_FLAGS_NONE);
 
-       if (internal->start_notify) {
-               /*
-                * Wait for the thread to set up its TLS data etc, so
-                * theres no potential race condition if someone tries
-                * to look up the data believing the thread has
-                * started
-                */
-               THREAD_DEBUG (g_message ("%s: (%"G_GSIZE_FORMAT") waiting for thread %p (%"G_GSIZE_FORMAT") to start", __func__, mono_native_thread_id_get (), internal, (gsize)internal->tid));
+       mono_threads_close_thread_handle (thread_handle);
 
-               MONO_ENTER_GC_SAFE;
-               WaitForSingleObjectEx (internal->start_notify, INFINITE, FALSE);
-               MONO_EXIT_GC_SAFE;
+       THREAD_DEBUG (g_message ("%s: (%"G_GSIZE_FORMAT") Done launching thread %p (%"G_GSIZE_FORMAT")", __func__, mono_native_thread_id_get (), internal, (gsize)internal->tid));
 
-               CloseHandle (internal->start_notify);
-               internal->start_notify = NULL;
-       }
+       ret = !start_info->failed;
 
-       THREAD_DEBUG (g_message ("%s: (%"G_GSIZE_FORMAT") Done launching thread %p (%"G_GSIZE_FORMAT")", __func__, mono_native_thread_id_get (), internal, (gsize)internal->tid));
+done:
+       if (InterlockedDecrement (&start_info->ref) == 0) {
+               mono_coop_sem_destroy (&start_info->registered);
+               g_free (start_info);
+       }
 
-       return TRUE;
+       return ret;
 }
 
 void mono_thread_new_init (intptr_t tid, gpointer stack_start, gpointer func)
@@ -950,31 +1031,20 @@ mono_thread_create_internal (MonoDomain *domain, gpointer func, gpointer arg, gb
 {
        MonoThread *thread;
        MonoInternalThread *internal;
-       StartInfo *start_info;
        gboolean res;
 
        mono_error_init (error);
 
-       thread = create_thread_object (domain);
-       thread->priority = MONO_THREAD_PRIORITY_NORMAL;
+       internal = create_internal_thread_object ();
 
-       internal = create_internal_thread ();
-
-       MONO_OBJECT_SETREF (thread, internal_thread, internal);
+       thread = create_thread_object (domain, internal);
 
-       start_info = g_new0 (StartInfo, 1);
-       start_info->func = (guint32 (*)(void *))func;
-       start_info->obj = thread;
-       start_info->start_arg = arg;
+       LOCK_THREAD (internal);
 
-       res = create_thread (thread, internal, start_info, threadpool_thread, stack_size, error);
+       res = create_thread (thread, internal, NULL, (MonoThreadStart) func, arg, threadpool_thread, stack_size, error);
        return_val_if_nok (error, NULL);
 
-       /* Check that the managed and unmanaged layout of MonoInternalThread matches */
-#ifndef MONO_CROSS_COMPILE
-       if (mono_check_corlib_version () == NULL)
-               g_assert (((char*)&internal->unused2 - (char*)internal) == mono_defaults.internal_thread_class->fields [mono_defaults.internal_thread_class->field.count - 1].offset);
-#endif
+       UNLOCK_THREAD (internal);
 
        return internal;
 }
@@ -1004,13 +1074,12 @@ mono_thread_attach (MonoDomain *domain)
 MonoThread *
 mono_thread_attach_full (MonoDomain *domain, gboolean force_attach)
 {
-       MonoThreadInfo *info;
-       MonoInternalThread *thread;
-       MonoThread *current_thread;
-       HANDLE thread_handle;
+       MonoInternalThread *internal;
+       MonoThread *thread;
        MonoNativeThreadId tid;
+       gsize stack_ptr;
 
-       if ((thread = mono_thread_internal_current ())) {
+       if (mono_thread_internal_current_is_attached ()) {
                if (domain != mono_domain_get ())
                        mono_domain_set (domain, TRUE);
                /* Already attached */
@@ -1021,44 +1090,19 @@ mono_thread_attach_full (MonoDomain *domain, gboolean force_attach)
                g_error ("Thread %"G_GSIZE_FORMAT" calling into managed code is not registered with the GC. On UNIX, this can be fixed by #include-ing <gc.h> before <pthread.h> in the file containing the thread creation code.", mono_native_thread_id_get ());
        }
 
-       thread = create_internal_thread ();
-
-       thread_handle = mono_thread_info_open_handle ();
-       g_assert (thread_handle);
-
        tid=mono_native_thread_id_get ();
 
-       thread->handle = thread_handle;
-       thread->tid = MONO_NATIVE_THREAD_ID_TO_UINT (tid);
-       thread->stack_ptr = &tid;
-
-       THREAD_DEBUG (g_message ("%s: Attached thread ID %"G_GSIZE_FORMAT" (handle %p)", __func__, tid, thread_handle));
-
-       info = mono_thread_info_current ();
-       g_assert (info);
-       thread->thread_info = info;
-       thread->small_id = info->small_id;
+       internal = create_internal_thread_object ();
 
-       current_thread = new_thread_with_internal (domain, thread);
+       thread = create_thread_object (domain, internal);
 
-       if (!handle_store (current_thread, force_attach)) {
+       if (!mono_thread_attach_internal (thread, force_attach, TRUE, &stack_ptr)) {
                /* Mono is shutting down, so just wait for the end */
                for (;;)
                        mono_thread_info_sleep (10000, NULL);
        }
 
-       THREAD_DEBUG (g_message ("%s: (%"G_GSIZE_FORMAT") Setting current_object_key to %p", __func__, mono_native_thread_id_get (), thread));
-
-       SET_CURRENT_OBJECT (thread);
-       mono_domain_set (domain, TRUE);
-
-       thread_adjust_static_data (thread);
-
-       init_root_domain_thread (thread, current_thread);
-
-       if (domain != mono_get_root_domain ())
-               set_current_thread_for_domain (domain, thread, current_thread);
-
+       THREAD_DEBUG (g_message ("%s: Attached thread ID %"G_GSIZE_FORMAT" (handle %p)", __func__, tid, internal->handle));
 
        if (mono_thread_attach_cb) {
                guint8 *staddr;
@@ -1067,17 +1111,17 @@ mono_thread_attach_full (MonoDomain *domain, gboolean force_attach)
                mono_thread_info_get_stack_bounds (&staddr, &stsize);
 
                if (staddr == NULL)
-                       mono_thread_attach_cb (MONO_NATIVE_THREAD_ID_TO_UINT (tid), &tid);
+                       mono_thread_attach_cb (MONO_NATIVE_THREAD_ID_TO_UINT (tid), &stack_ptr);
                else
                        mono_thread_attach_cb (MONO_NATIVE_THREAD_ID_TO_UINT (tid), staddr + stsize);
        }
 
        /* Can happen when we attach the profiler helper thread in order to heapshot. */
-       if (!info->tools_thread)
+       if (!mono_thread_info_current ()->tools_thread)
                // FIXME: Need a separate callback
                mono_profiler_thread_start (MONO_NATIVE_THREAD_ID_TO_UINT (tid));
 
-       return current_thread;
+       return thread;
 }
 
 void
@@ -1087,12 +1131,16 @@ mono_thread_detach_internal (MonoInternalThread *thread)
 
        THREAD_DEBUG (g_message ("%s: mono_thread_detach for %p (%"G_GSIZE_FORMAT")", __func__, thread, (gsize)thread->tid));
 
+#ifndef HOST_WIN32
+       mono_w32mutex_abandon ();
+#endif
+
        thread_cleanup (thread);
 
        SET_CURRENT_OBJECT (NULL);
        mono_domain_unset ();
 
-       /* Don't need to CloseHandle this thread, even though we took a
+       /* Don't need to close the handle to this thread, even though we took a
         * reference in mono_thread_attach (), because the GC will do it
         * when the Thread object is finalised.
         */
@@ -1128,6 +1176,18 @@ mono_thread_detach_if_exiting (void)
        return FALSE;
 }
 
+gboolean
+mono_thread_internal_current_is_attached (void)
+{
+       MonoInternalThread *internal;
+
+       internal = GET_CURRENT_OBJECT ();
+       if (!internal)
+               return FALSE;
+
+       return TRUE;
+}
+
 void
 mono_thread_exit (void)
 {
@@ -1135,14 +1195,13 @@ mono_thread_exit (void)
 
        THREAD_DEBUG (g_message ("%s: mono_thread_exit for %p (%"G_GSIZE_FORMAT")", __func__, thread, (gsize)thread->tid));
 
-       thread_cleanup (thread);
-       SET_CURRENT_OBJECT (NULL);
-       mono_domain_unset ();
+       mono_thread_detach_internal (thread);
 
        /* we could add a callback here for embedders to use. */
        if (mono_thread_get_main () && (thread == mono_thread_get_main ()->internal_thread))
                exit (mono_environment_exitcode_get ());
-       mono_thread_info_exit ();
+
+       mono_thread_info_exit (0);
 }
 
 void
@@ -1150,7 +1209,7 @@ ves_icall_System_Threading_Thread_ConstructInternalThread (MonoThread *this_obj)
 {
        MonoInternalThread *internal;
 
-       internal = create_internal_thread ();
+       internal = create_internal_thread_object ();
 
        internal->state = ThreadState_Unstarted;
 
@@ -1162,7 +1221,6 @@ ves_icall_System_Threading_Thread_Thread_internal (MonoThread *this_obj,
                                                                                                   MonoObject *start)
 {
        MonoError error;
-       StartInfo *start_info;
        MonoInternalThread *internal;
        gboolean res;
 
@@ -1184,15 +1242,8 @@ ves_icall_System_Threading_Thread_Thread_internal (MonoThread *this_obj,
                UNLOCK_THREAD (internal);
                return this_obj;
        }
-       /* This is freed in start_wrapper */
-       start_info = g_new0 (StartInfo, 1);
-       start_info->func = NULL;
-       start_info->start_arg = NULL;
-       start_info->delegate = start;
-       start_info->obj = this_obj;
-       g_assert (this_obj->obj.vtable->domain == mono_domain_get ());
 
-       res = create_thread (this_obj, internal, start_info, FALSE, 0, &error);
+       res = create_thread (this_obj, internal, start, NULL, NULL, FALSE, 0, &error);
        if (!res) {
                mono_error_cleanup (&error);
                UNLOCK_THREAD (internal);
@@ -1211,17 +1262,23 @@ ves_icall_System_Threading_Thread_Thread_internal (MonoThread *this_obj,
  * This is called from the finalizer of the internal thread object.
  */
 void
-ves_icall_System_Threading_InternalThread_Thread_free_internal (MonoInternalThread *this_obj, HANDLE thread)
+ves_icall_System_Threading_InternalThread_Thread_free_internal (MonoInternalThread *this_obj)
 {
-       THREAD_DEBUG (g_message ("%s: Closing thread %p, handle %p", __func__, this, thread));
+       THREAD_DEBUG (g_message ("%s: Closing thread %p, handle %p", __func__, this, this_obj->handle));
 
        /*
         * Since threads keep a reference to their thread object while running, by the time this function is called,
         * the thread has already exited/detached, i.e. thread_cleanup () has ran. The exception is during shutdown,
         * when thread_cleanup () can be called after this.
         */
-       if (thread)
-               CloseHandle (thread);
+       if (this_obj->handle) {
+               mono_threads_close_thread_handle (this_obj->handle);
+               this_obj->handle = NULL;
+       }
+
+#if HOST_WIN32
+       CloseHandle (this_obj->native_handle);
+#endif
 
        if (this_obj->synch_cs) {
                MonoCoopMutex *synch_cs = this_obj->synch_cs;
@@ -1448,11 +1505,9 @@ ves_icall_System_Threading_Thread_GetPriority (MonoThread *this_obj)
        MonoInternalThread *internal = this_obj->internal_thread;
 
        LOCK_THREAD (internal);
-       if (internal->handle != NULL)
-               priority = mono_thread_info_get_priority ((MonoThreadInfo*) internal->thread_info);
-       else
-               priority = this_obj->priority;
+       priority = internal->priority;
        UNLOCK_THREAD (internal);
+
        return priority;
 }
 
@@ -1469,9 +1524,9 @@ ves_icall_System_Threading_Thread_SetPriority (MonoThread *this_obj, int priorit
        MonoInternalThread *internal = this_obj->internal_thread;
 
        LOCK_THREAD (internal);
-       this_obj->priority = priority;
-       if (internal->handle != NULL)
-               mono_thread_info_set_priority ((MonoThreadInfo*) internal->thread_info, this_obj->priority);
+       internal->priority = priority;
+       if (internal->thread_info != NULL)
+               mono_thread_internal_set_priority (internal, priority);
        UNLOCK_THREAD (internal);
 }
 
@@ -1524,7 +1579,7 @@ mono_thread_current (void)
 
        if (!*current_thread_ptr) {
                g_assert (domain != mono_get_root_domain ());
-               *current_thread_ptr = new_thread_with_internal (domain, internal);
+               *current_thread_ptr = create_thread_object (domain, internal);
        }
        return *current_thread_ptr;
 }
@@ -1541,7 +1596,7 @@ mono_thread_current_for_thread (MonoInternalThread *internal)
 
        if (!*current_thread_ptr) {
                g_assert (domain != mono_get_root_domain ());
-               *current_thread_ptr = new_thread_with_internal (domain, internal);
+               *current_thread_ptr = create_thread_object (domain, internal);
        }
        return *current_thread_ptr;
 }
@@ -1558,7 +1613,7 @@ gboolean
 ves_icall_System_Threading_Thread_Join_internal(MonoThread *this_obj, int ms)
 {
        MonoInternalThread *thread = this_obj->internal_thread;
-       HANDLE handle = thread->handle;
+       MonoThreadHandle *handle = thread->handle;
        MonoInternalThread *cur_thread = mono_thread_internal_current ();
        gboolean ret;
 
@@ -1584,12 +1639,12 @@ ves_icall_System_Threading_Thread_Join_internal(MonoThread *this_obj, int ms)
        mono_thread_set_state (cur_thread, ThreadState_WaitSleepJoin);
 
        MONO_ENTER_GC_SAFE;
-       ret=WaitForSingleObjectEx (handle, ms, TRUE);
+       ret=mono_thread_info_wait_one_handle (handle, ms, TRUE);
        MONO_EXIT_GC_SAFE;
 
        mono_thread_clr_state (cur_thread, ThreadState_WaitSleepJoin);
        
-       if(ret==WAIT_OBJECT_0) {
+       if(ret==MONO_THREAD_INFO_WAIT_RET_SUCCESS_0) {
                THREAD_DEBUG (g_message ("%s: join successful", __func__));
 
                return(TRUE);
@@ -1697,7 +1752,7 @@ gint32 ves_icall_System_Threading_WaitHandle_WaitAll_internal(MonoArray *mono_ha
 gint32 ves_icall_System_Threading_WaitHandle_WaitAny_internal(MonoArray *mono_handles, gint32 ms)
 {
        MonoError error;
-       HANDLE handles [MAXIMUM_WAIT_OBJECTS];
+       HANDLE handles [MONO_W32HANDLE_MAXIMUM_WAIT_OBJECTS];
        uintptr_t numhandles;
        guint32 ret;
        guint32 i;
@@ -1709,7 +1764,7 @@ gint32 ves_icall_System_Threading_WaitHandle_WaitAny_internal(MonoArray *mono_ha
                return map_native_wait_result_to_managed (WAIT_FAILED);
 
        numhandles = mono_array_length(mono_handles);
-       if (numhandles > MAXIMUM_WAIT_OBJECTS)
+       if (numhandles > MONO_W32HANDLE_MAXIMUM_WAIT_OBJECTS)
                return map_native_wait_result_to_managed (WAIT_FAILED);
 
        for(i = 0; i < numhandles; i++) {       
@@ -1730,19 +1785,9 @@ gint32 ves_icall_System_Threading_WaitHandle_WaitAny_internal(MonoArray *mono_ha
        THREAD_WAIT_DEBUG (g_message ("%s: (%"G_GSIZE_FORMAT") returning %d", __func__, mono_native_thread_id_get (), ret));
 
        mono_error_set_pending_exception (&error);
-       /*
-        * These need to be here.  See MSDN dos on WaitForMultipleObjects.
-        */
-       if (ret >= WAIT_OBJECT_0 && ret <= WAIT_OBJECT_0 + numhandles - 1) {
-               return map_native_wait_result_to_managed (ret - WAIT_OBJECT_0);
-       }
-       else if (ret >= WAIT_ABANDONED_0 && ret <= WAIT_ABANDONED_0 + numhandles - 1) {
-               return map_native_wait_result_to_managed (ret - WAIT_ABANDONED_0);
-       }
-       else {
-               /* WAIT_FAILED in waithandle.cs is different from WAIT_FAILED in Win32 API */
-               return map_native_wait_result_to_managed (ret);
-       }
+
+       /* WAIT_FAILED in waithandle.cs is different from WAIT_FAILED in Win32 API */
+       return map_native_wait_result_to_managed (ret);
 }
 
 gint32 ves_icall_System_Threading_WaitHandle_WaitOne_internal(HANDLE handle, gint32 ms)
@@ -1793,125 +1838,6 @@ ves_icall_System_Threading_WaitHandle_SignalAndWait_Internal (HANDLE toSignal, H
        return map_native_wait_result_to_managed (ret);
 }
 
-HANDLE ves_icall_System_Threading_Mutex_CreateMutex_internal (MonoBoolean owned, MonoString *name, MonoBoolean *created)
-{ 
-       HANDLE mutex;
-       
-       *created = TRUE;
-       
-       if (name == NULL) {
-               mutex = CreateMutex (NULL, owned, NULL);
-       } else {
-               mutex = CreateMutex (NULL, owned, mono_string_chars (name));
-               
-               if (GetLastError () == ERROR_ALREADY_EXISTS) {
-                       *created = FALSE;
-               }
-       }
-
-       return(mutex);
-}                                                                   
-
-MonoBoolean ves_icall_System_Threading_Mutex_ReleaseMutex_internal (HANDLE handle ) { 
-       return(ReleaseMutex (handle));
-}
-
-HANDLE ves_icall_System_Threading_Mutex_OpenMutex_internal (MonoString *name,
-                                                           gint32 rights,
-                                                           gint32 *error)
-{
-       HANDLE ret;
-       
-       *error = ERROR_SUCCESS;
-       
-       ret = OpenMutex (rights, FALSE, mono_string_chars (name));
-       if (ret == NULL) {
-               *error = GetLastError ();
-       }
-       
-       return(ret);
-}
-
-
-HANDLE ves_icall_System_Threading_Semaphore_CreateSemaphore_internal (gint32 initialCount, gint32 maximumCount, MonoString *name, gint32 *error)
-{ 
-       HANDLE sem;
-       
-       if (name == NULL) {
-               sem = CreateSemaphore (NULL, initialCount, maximumCount, NULL);
-       } else {
-               sem = CreateSemaphore (NULL, initialCount, maximumCount,
-                                      mono_string_chars (name));
-       }
-
-       *error = GetLastError ();
-       return(sem);
-}                                                                   
-
-MonoBoolean ves_icall_System_Threading_Semaphore_ReleaseSemaphore_internal (HANDLE handle, gint32 releaseCount, gint32 *prevcount)
-{ 
-       return ReleaseSemaphore (handle, releaseCount, prevcount);
-}
-
-HANDLE ves_icall_System_Threading_Semaphore_OpenSemaphore_internal (MonoString *name, gint32 rights, gint32 *error)
-{
-       HANDLE sem;
-
-       sem = OpenSemaphore (rights, FALSE, mono_string_chars (name));
-       *error = GetLastError ();
-
-       return(sem);
-}
-
-HANDLE ves_icall_System_Threading_Events_CreateEvent_internal (MonoBoolean manual, MonoBoolean initial, MonoString *name, MonoBoolean *created)
-{
-       HANDLE event;
-       
-       *created = TRUE;
-
-       if (name == NULL) {
-               event = CreateEvent (NULL, manual, initial, NULL);
-       } else {
-               event = CreateEvent (NULL, manual, initial,
-                                    mono_string_chars (name));
-               
-               if (GetLastError () == ERROR_ALREADY_EXISTS) {
-                       *created = FALSE;
-               }
-       }
-       
-       return(event);
-}
-
-gboolean ves_icall_System_Threading_Events_SetEvent_internal (HANDLE handle) {
-       return (SetEvent(handle));
-}
-
-gboolean ves_icall_System_Threading_Events_ResetEvent_internal (HANDLE handle) {
-       return (ResetEvent(handle));
-}
-
-void
-ves_icall_System_Threading_Events_CloseEvent_internal (HANDLE handle) {
-       CloseHandle (handle);
-}
-
-HANDLE ves_icall_System_Threading_Events_OpenEvent_internal (MonoString *name,
-                                                            gint32 rights,
-                                                            gint32 *error)
-{
-       HANDLE ret;
-       
-       *error = ERROR_SUCCESS;
-       
-       ret = OpenEvent (rights, FALSE, mono_string_chars (name));
-       if (ret == NULL) {
-               *error = GetLastError ();
-       }
-       
-       return(ret);
-}
-
 gint32 ves_icall_System_Threading_Interlocked_Increment_Int (gint32 *location)
 {
        return InterlockedIncrement (location);
@@ -2156,7 +2082,7 @@ ves_icall_System_Threading_Thread_ClrState (MonoInternalThread* this_obj, guint3
                 * be notified, since it has to rebuild the list of threads to
                 * wait for.
                 */
-               SetEvent (background_change_event);
+               mono_os_event_set (&background_change_event);
        }
 }
 
@@ -2170,7 +2096,7 @@ ves_icall_System_Threading_Thread_SetState (MonoInternalThread* this_obj, guint3
                 * be notified, since it has to rebuild the list of threads to
                 * wait for.
                 */
-               SetEvent (background_change_event);
+               mono_os_event_set (&background_change_event);
        }
 }
 
@@ -2408,6 +2334,7 @@ mono_thread_suspend (MonoInternalThread *thread)
        }
        
        thread->state |= ThreadState_SuspendRequested;
+       mono_os_event_reset (thread->suspended);
 
        if (thread == mono_thread_internal_current ()) {
                /* calls UNLOCK_THREAD (thread) */
@@ -2434,7 +2361,9 @@ static gboolean
 mono_thread_resume (MonoInternalThread *thread)
 {
        if ((thread->state & ThreadState_SuspendRequested) != 0) {
+               // MOSTLY_ASYNC_SAFE_PRINTF ("RESUME (1) thread %p\n", thread_get_tid (thread));
                thread->state &= ~ThreadState_SuspendRequested;
+               mono_os_event_set (thread->suspended);
                return TRUE;
        }
 
@@ -2443,16 +2372,23 @@ mono_thread_resume (MonoInternalThread *thread)
                (thread->state & ThreadState_Aborted) != 0 || 
                (thread->state & ThreadState_Stopped) != 0)
        {
+               // MOSTLY_ASYNC_SAFE_PRINTF ("RESUME (2) thread %p\n", thread_get_tid (thread));
                return FALSE;
        }
 
-       UNLOCK_THREAD (thread);
+       // MOSTLY_ASYNC_SAFE_PRINTF ("RESUME (3) thread %p\n", thread_get_tid (thread));
 
-       /* Awake the thread */
-       if (!mono_thread_info_resume (thread_get_tid (thread)))
-               return FALSE;
+       mono_os_event_set (thread->suspended);
 
-       LOCK_THREAD (thread);
+       if (!thread->self_suspended) {
+               UNLOCK_THREAD (thread);
+
+               /* Awake the thread */
+               if (!mono_thread_info_resume (thread_get_tid (thread)))
+                       return FALSE;
+
+               LOCK_THREAD (thread);
+       }
 
        thread->state &= ~ThreadState_Suspended;
 
@@ -2921,8 +2857,7 @@ void mono_thread_init (MonoThreadStartCB start_cb,
        mono_os_mutex_init_recursive(&interlocked_mutex);
        mono_os_mutex_init_recursive(&joinable_threads_mutex);
        
-       background_change_event = CreateEvent (NULL, TRUE, FALSE, NULL);
-       g_assert(background_change_event != NULL);
+       mono_os_event_init (&background_change_event, FALSE);
        
        mono_init_static_data_info (&thread_static_info);
        mono_init_static_data_info (&context_static_info);
@@ -2931,25 +2866,18 @@ void mono_thread_init (MonoThreadStartCB start_cb,
 
        mono_thread_start_cb = start_cb;
        mono_thread_attach_cb = attach_cb;
-
-       /* Get a pseudo handle to the current process.  This is just a
-        * kludge so that wapi can build a process handle if needed.
-        * As a pseudo handle is returned, we don't need to clean
-        * anything up.
-        */
-       GetCurrentProcess ();
 }
 
 void mono_thread_cleanup (void)
 {
-#if !defined(RUN_IN_SUBTHREAD)
+#if !defined(RUN_IN_SUBTHREAD) && !defined(HOST_WIN32)
        /* The main thread must abandon any held mutexes (particularly
         * important for named mutexes as they are shared across
         * processes, see bug 74680.)  This will happen when the
         * thread exits, but if it's not running in a subthread it
         * won't exit in time.
         */
-       mono_thread_info_set_exited (mono_thread_info_current ());
+       mono_w32mutex_abandon ();
 #endif
 
 #if 0
@@ -2961,7 +2889,7 @@ void mono_thread_cleanup (void)
        mono_os_mutex_destroy (&interlocked_mutex);
        mono_os_mutex_destroy (&delayed_free_table_mutex);
        mono_os_mutex_destroy (&small_id_mutex);
-       CloseHandle (background_change_event);
+       mono_os_event_destroy (&background_change_event);
 #endif
 
        mono_native_tls_free (current_object_key);
@@ -2993,106 +2921,50 @@ static void print_tids (gpointer key, gpointer value, gpointer user)
 
 struct wait_data 
 {
-       HANDLE handles[MAXIMUM_WAIT_OBJECTS];
-       MonoInternalThread *threads[MAXIMUM_WAIT_OBJECTS];
+       MonoThreadHandle *handles[MONO_W32HANDLE_MAXIMUM_WAIT_OBJECTS];
+       MonoInternalThread *threads[MONO_W32HANDLE_MAXIMUM_WAIT_OBJECTS];
        guint32 num;
 };
 
-static void wait_for_tids (struct wait_data *wait, guint32 timeout)
-{
-       guint32 i, ret;
-       
-       THREAD_DEBUG (g_message("%s: %d threads to wait for in this batch", __func__, wait->num));
-
-       MONO_ENTER_GC_SAFE;
-       ret=WaitForMultipleObjectsEx(wait->num, wait->handles, TRUE, timeout, TRUE);
-       MONO_EXIT_GC_SAFE;
-
-       if(ret==WAIT_FAILED) {
-               /* See the comment in build_wait_tids() */
-               THREAD_DEBUG (g_message ("%s: Wait failed", __func__));
-               return;
-       }
-       
-       for(i=0; i<wait->num; i++)
-               CloseHandle (wait->handles[i]);
-
-       if (ret == WAIT_TIMEOUT)
-               return;
-
-       for(i=0; i<wait->num; i++) {
-               gsize tid = wait->threads[i]->tid;
-
-               /*
-                * On !win32, when the thread handle becomes signalled, it just means the thread has exited user code,
-                * it can still run io-layer etc. code. So wait for it to really exit.
-                * FIXME: This won't join threads which are not in the joinable_hash yet.
-                */
-               mono_thread_join ((gpointer)tid);
-
-               mono_threads_lock ();
-               if(mono_g_hash_table_lookup (threads, (gpointer)tid)!=NULL) {
-                       /* This thread must have been killed, because
-                        * it hasn't cleaned itself up. (It's just
-                        * possible that the thread exited before the
-                        * parent thread had a chance to store the
-                        * handle, and now there is another pointer to
-                        * the already-exited thread stored.  In this
-                        * case, we'll just get two
-                        * mono_profiler_thread_end() calls for the
-                        * same thread.)
-                        */
-       
-                       mono_threads_unlock ();
-                       THREAD_DEBUG (g_message ("%s: cleaning up after thread %p (%"G_GSIZE_FORMAT")", __func__, wait->threads[i], tid));
-                       thread_cleanup (wait->threads[i]);
-               } else {
-                       mono_threads_unlock ();
-               }
-       }
-}
-
-static void wait_for_tids_or_state_change (struct wait_data *wait, guint32 timeout)
+static void
+wait_for_tids (struct wait_data *wait, guint32 timeout, gboolean check_state_change)
 {
-       guint32 i, ret, count;
+       guint32 i;
+       MonoThreadInfoWaitRet ret;
        
        THREAD_DEBUG (g_message("%s: %d threads to wait for in this batch", __func__, wait->num));
 
-       /* Add the thread state change event, so it wakes up if a thread changes
-        * to background mode.
-        */
-       count = wait->num;
-       if (count < MAXIMUM_WAIT_OBJECTS) {
-               wait->handles [count] = background_change_event;
-               count++;
-       }
+       /* Add the thread state change event, so it wakes
+        * up if a thread changes to background mode. */
 
        MONO_ENTER_GC_SAFE;
-       ret=WaitForMultipleObjectsEx (count, wait->handles, FALSE, timeout, TRUE);
+       if (check_state_change)
+               ret = mono_thread_info_wait_multiple_handle (wait->handles, wait->num, &background_change_event, FALSE, timeout, TRUE);
+       else
+               ret = mono_thread_info_wait_multiple_handle (wait->handles, wait->num, NULL, TRUE, timeout, TRUE);
        MONO_EXIT_GC_SAFE;
 
-       if(ret==WAIT_FAILED) {
+       if (ret == MONO_THREAD_INFO_WAIT_RET_FAILED) {
                /* See the comment in build_wait_tids() */
                THREAD_DEBUG (g_message ("%s: Wait failed", __func__));
                return;
        }
        
-       for(i=0; i<wait->num; i++)
-               CloseHandle (wait->handles[i]);
+       for( i = 0; i < wait->num; i++)
+               mono_threads_close_thread_handle (wait->handles [i]);
 
-       if (ret == WAIT_TIMEOUT)
+       if (ret == MONO_THREAD_INFO_WAIT_RET_TIMEOUT)
                return;
        
        if (ret < wait->num) {
-               gsize tid = wait->threads[ret]->tid;
+               MonoInternalThread *internal;
+
+               internal = wait->threads [ret];
+
                mono_threads_lock ();
-               if (mono_g_hash_table_lookup (threads, (gpointer)tid)!=NULL) {
-                       /* See comment in wait_for_tids about thread cleanup */
-                       mono_threads_unlock ();
-                       THREAD_DEBUG (g_message ("%s: cleaning up after thread %"G_GSIZE_FORMAT, __func__, tid));
-                       thread_cleanup (wait->threads [ret]);
-               } else
-                       mono_threads_unlock ();
+               if (mono_g_hash_table_lookup (threads, (gpointer) internal->tid) == internal)
+                       g_error ("%s: failed to call mono_thread_detach_internal on thread %p, InternalThread: %p", __func__, internal->tid, internal);
+               mono_threads_unlock ();
        }
 }
 
@@ -3100,8 +2972,7 @@ static void build_wait_tids (gpointer key, gpointer value, gpointer user)
 {
        struct wait_data *wait=(struct wait_data *)user;
 
-       if(wait->num<MAXIMUM_WAIT_OBJECTS) {
-               HANDLE handle;
+       if(wait->num<MONO_W32HANDLE_MAXIMUM_WAIT_OBJECTS - 1) {
                MonoInternalThread *thread=(MonoInternalThread *)value;
 
                /* Ignore background threads, we abort them later */
@@ -3131,15 +3002,9 @@ static void build_wait_tids (gpointer key, gpointer value, gpointer user)
                        return;
                }
 
-               handle = mono_threads_open_thread_handle (thread->handle, thread_get_tid (thread));
-               if (handle == NULL) {
-                       THREAD_DEBUG (g_message ("%s: ignoring unopenable thread %"G_GSIZE_FORMAT, __func__, (gsize)thread->tid));
-                       return;
-               }
-               
                THREAD_DEBUG (g_message ("%s: Invoking mono_thread_manage callback on thread %p", __func__, thread));
                if ((thread->manage_callback == NULL) || (thread->manage_callback (thread->root_domain_thread) == TRUE)) {
-                       wait->handles[wait->num]=handle;
+                       wait->handles[wait->num]=mono_threads_open_thread_handle (thread->handle);
                        wait->threads[wait->num]=thread;
                        wait->num++;
 
@@ -3162,9 +3027,8 @@ remove_and_abort_threads (gpointer key, gpointer value, gpointer user)
        struct wait_data *wait=(struct wait_data *)user;
        MonoNativeThreadId self = mono_native_thread_id_get ();
        MonoInternalThread *thread = (MonoInternalThread *)value;
-       HANDLE handle;
 
-       if (wait->num >= MAXIMUM_WAIT_OBJECTS)
+       if (wait->num >= MONO_W32HANDLE_MAXIMUM_WAIT_OBJECTS)
                return FALSE;
 
        /* The finalizer thread is not a background thread */
@@ -3172,11 +3036,7 @@ remove_and_abort_threads (gpointer key, gpointer value, gpointer user)
             && (thread->state & ThreadState_Background) != 0
             && (thread->flags & MONO_THREAD_FLAG_DONT_MANAGE) == 0
        ) {
-               handle = mono_threads_open_thread_handle (thread->handle, thread_get_tid (thread));
-               if (handle == NULL)
-                       return FALSE;
-
-               wait->handles[wait->num] = handle;
+               wait->handles[wait->num] = mono_threads_open_thread_handle (thread->handle);
                wait->threads[wait->num] = thread;
                wait->num++;
 
@@ -3220,11 +3080,11 @@ mono_threads_set_shutting_down (void)
                        UNLOCK_THREAD (current_thread);
                }
 
-               /*since we're killing the thread, unset the current domain.*/
-               mono_domain_unset ();
+               /*since we're killing the thread, detach it.*/
+               mono_thread_detach_internal (current_thread);
 
                /* Wake up other threads potentially waiting for us */
-               mono_thread_info_exit ();
+               mono_thread_info_exit (0);
        } else {
                shutting_down = TRUE;
 
@@ -3232,7 +3092,7 @@ mono_threads_set_shutting_down (void)
                 * interrupt the main thread if it is waiting for all
                 * the other threads.
                 */
-               SetEvent (background_change_event);
+               mono_os_event_set (&background_change_event);
                
                mono_threads_unlock ();
        }
@@ -3265,16 +3125,15 @@ void mono_thread_manage (void)
                THREAD_DEBUG (g_message ("%s: There are %d threads to join", __func__, mono_g_hash_table_size (threads));
                        mono_g_hash_table_foreach (threads, print_tids, NULL));
        
-               ResetEvent (background_change_event);
+               mono_os_event_reset (&background_change_event);
                wait->num=0;
-               /*We must zero all InternalThread pointers to avoid making the GC unhappy.*/
-               memset (wait->threads, 0, MAXIMUM_WAIT_OBJECTS * SIZEOF_VOID_P);
+               /* We must zero all InternalThread pointers to avoid making the GC unhappy. */
+               memset (wait->threads, 0, MONO_W32HANDLE_MAXIMUM_WAIT_OBJECTS * SIZEOF_VOID_P);
                mono_g_hash_table_foreach (threads, build_wait_tids, wait);
                mono_threads_unlock ();
-               if(wait->num>0) {
+               if (wait->num > 0)
                        /* Something to wait for */
-                       wait_for_tids_or_state_change (wait, INFINITE);
-               }
+                       wait_for_tids (wait, INFINITE, TRUE);
                THREAD_DEBUG (g_message ("%s: I have %d threads after waiting.", __func__, wait->num));
        } while(wait->num>0);
 
@@ -3294,15 +3153,15 @@ void mono_thread_manage (void)
 
                wait->num = 0;
                /*We must zero all InternalThread pointers to avoid making the GC unhappy.*/
-               memset (wait->threads, 0, MAXIMUM_WAIT_OBJECTS * SIZEOF_VOID_P);
+               memset (wait->threads, 0, MONO_W32HANDLE_MAXIMUM_WAIT_OBJECTS * SIZEOF_VOID_P);
                mono_g_hash_table_foreach_remove (threads, remove_and_abort_threads, wait);
 
                mono_threads_unlock ();
 
                THREAD_DEBUG (g_message ("%s: wait->num is now %d", __func__, wait->num));
-               if(wait->num>0) {
+               if (wait->num > 0) {
                        /* Something to wait for */
-                       wait_for_tids (wait, INFINITE);
+                       wait_for_tids (wait, INFINITE, FALSE);
                }
        } while (wait->num > 0);
        
@@ -3319,10 +3178,9 @@ collect_threads_for_suspend (gpointer key, gpointer value, gpointer user_data)
 {
        MonoInternalThread *thread = (MonoInternalThread*)value;
        struct wait_data *wait = (struct wait_data*)user_data;
-       HANDLE handle;
 
        /* 
-        * We try to exclude threads early, to avoid running into the MAXIMUM_WAIT_OBJECTS
+        * We try to exclude threads early, to avoid running into the MONO_W32HANDLE_MAXIMUM_WAIT_OBJECTS
         * limitation.
         * This needs no locking.
         */
@@ -3330,12 +3188,8 @@ collect_threads_for_suspend (gpointer key, gpointer value, gpointer user_data)
                (thread->state & ThreadState_Stopped) != 0)
                return;
 
-       if (wait->num<MAXIMUM_WAIT_OBJECTS) {
-               handle = mono_threads_open_thread_handle (thread->handle, thread_get_tid (thread));
-               if (handle == NULL)
-                       return;
-
-               wait->handles [wait->num] = handle;
+       if (wait->num<MONO_W32HANDLE_MAXIMUM_WAIT_OBJECTS) {
+               wait->handles [wait->num] = mono_threads_open_thread_handle (thread->handle);
                wait->threads [wait->num] = thread;
                wait->num++;
        }
@@ -3373,7 +3227,7 @@ void mono_thread_suspend_all_other_threads (void)
 
        /*
         * We make multiple calls to WaitForMultipleObjects since:
-        * - we can only wait for MAXIMUM_WAIT_OBJECTS threads
+        * - we can only wait for MONO_W32HANDLE_MAXIMUM_WAIT_OBJECTS threads
         * - some threads could exit without becoming suspended
         */
        finished = FALSE;
@@ -3384,7 +3238,7 @@ void mono_thread_suspend_all_other_threads (void)
                 */
                wait->num = 0;
                /*We must zero all InternalThread pointers to avoid making the GC unhappy.*/
-               memset (wait->threads, 0, MAXIMUM_WAIT_OBJECTS * SIZEOF_VOID_P);
+               memset (wait->threads, 0, MONO_W32HANDLE_MAXIMUM_WAIT_OBJECTS * SIZEOF_VOID_P);
                mono_threads_lock ();
                mono_g_hash_table_foreach (threads, collect_threads_for_suspend, wait);
                mono_threads_unlock ();
@@ -3398,8 +3252,8 @@ void mono_thread_suspend_all_other_threads (void)
                             || mono_gc_is_finalizer_internal_thread (thread)
                             || (thread->flags & MONO_THREAD_FLAG_DONT_MANAGE)
                        ) {
-                               //CloseHandle (wait->handles [i]);
-                               wait->threads [i] = NULL; /* ignore this thread in next loop */
+                               mono_threads_close_thread_handle (wait->handles [i]);
+                               wait->threads [i] = NULL;
                                continue;
                        }
 
@@ -3409,8 +3263,8 @@ void mono_thread_suspend_all_other_threads (void)
                                (thread->state & ThreadState_StopRequested) != 0 ||
                                (thread->state & ThreadState_Stopped) != 0) {
                                UNLOCK_THREAD (thread);
-                               CloseHandle (wait->handles [i]);
-                               wait->threads [i] = NULL; /* ignore this thread in next loop */
+                               mono_threads_close_thread_handle (wait->handles [i]);
+                               wait->threads [i] = NULL;
                                continue;
                        }
 
@@ -3421,9 +3275,13 @@ void mono_thread_suspend_all_other_threads (void)
                                thread->state &= ~ThreadState_AbortRequested;
                        
                        thread->state |= ThreadState_SuspendRequested;
+                       mono_os_event_reset (thread->suspended);
 
                        /* Signal the thread to suspend + calls UNLOCK_THREAD (thread) */
                        async_suspend_internal (thread, TRUE);
+
+                       mono_threads_close_thread_handle (wait->handles [i]);
+                       wait->threads [i] = NULL;
                }
                if (eventidx <= 0) {
                        /* 
@@ -3481,7 +3339,7 @@ get_thread_dump (MonoThreadInfo *info, gpointer ud)
 #if 0
 /* This no longer works with remote unwinding */
        g_string_append_printf (text, " tid=0x%p this=0x%p ", (gpointer)(gsize)thread->tid, thread);
-       mono_thread_info_describe (info, text);
+       mono_thread_internal_describe (thread, text);
        g_string_append (text, "\n");
 #endif
 
@@ -3858,11 +3716,8 @@ collect_appdomain_thread (gpointer key, gpointer value, gpointer user_data)
        if (mono_thread_internal_has_appdomain_ref (thread, domain)) {
                /* printf ("ABORTING THREAD %p BECAUSE IT REFERENCES DOMAIN %s.\n", thread->tid, domain->friendly_name); */
 
-               if(data->wait.num<MAXIMUM_WAIT_OBJECTS) {
-                       HANDLE handle = mono_threads_open_thread_handle (thread->handle, thread_get_tid (thread));
-                       if (handle == NULL)
-                               return;
-                       data->wait.handles [data->wait.num] = handle;
+               if(data->wait.num<MONO_W32HANDLE_MAXIMUM_WAIT_OBJECTS) {
+                       data->wait.handles [data->wait.num] = mono_threads_open_thread_handle (thread->handle);
                        data->wait.threads [data->wait.num] = thread;
                        data->wait.num++;
                } else {
@@ -3911,7 +3766,7 @@ mono_threads_abort_appdomain_threads (MonoDomain *domain, int timeout)
                         * We should wait for the threads either to abort, or to leave the
                         * domain. We can't do the latter, so we wait with a timeout.
                         */
-                       wait_for_tids (&user_data.wait, 100);
+                       wait_for_tids (&user_data.wait, 100, FALSE);
                }
 
                /* Update remaining time */
@@ -4142,22 +3997,6 @@ mono_alloc_static_data_slot (StaticDataInfo *static_data, guint32 size, guint32
        return offset;
 }
 
-/* 
- * ensure thread static fields already allocated are valid for thread
- * This function is called when a thread is created or on thread attach.
- */
-static void
-thread_adjust_static_data (MonoInternalThread *thread)
-{
-       mono_threads_lock ();
-       if (thread_static_info.offset || thread_static_info.idx > 0) {
-               /* get the current allocated size */
-               guint32 offset = MAKE_SPECIAL_STATIC_OFFSET (thread_static_info.idx, thread_static_info.offset, 0);
-               mono_alloc_static_data (&thread->static_data, offset, TRUE);
-       }
-       mono_threads_unlock ();
-}
-
 /*
  * LOCKING: requires that threads_mutex is held
  */
@@ -4524,7 +4363,6 @@ mono_thread_request_interruption (gboolean running_managed)
                thread->state & ThreadState_Background)
                ExitThread (1);
 #endif
-       
        if (InterlockedCompareExchange (&thread->interruption_requested, 1, 0) == 1)
                return NULL;
        InterlockedIncrement (&thread_interruption_requested);
@@ -4538,7 +4376,7 @@ mono_thread_request_interruption (gboolean running_managed)
                   or similar */
                /* Our implementation of this function ignores the func argument */
 #ifdef HOST_WIN32
-               QueueUserAPC ((PAPCFUNC)dummy_apc, thread->handle, (ULONG_PTR)NULL);
+               QueueUserAPC ((PAPCFUNC)dummy_apc, thread->native_handle, (ULONG_PTR)NULL);
 #else
                mono_thread_info_self_interrupt ();
 #endif
@@ -4701,6 +4539,29 @@ mono_thread_set_state (MonoInternalThread *thread, MonoThreadState state)
        UNLOCK_THREAD (thread);
 }
 
+/**
+ * mono_thread_test_and_set_state:
+ *
+ * Test if current state of @thread include @test. If it does not, OR @set into the state.
+ *
+ * Returns TRUE is @set was OR'd in.
+ */
+gboolean
+mono_thread_test_and_set_state (MonoInternalThread *thread, MonoThreadState test, MonoThreadState set)
+{
+       LOCK_THREAD (thread);
+
+       if ((thread->state & test) != 0) {
+               UNLOCK_THREAD (thread);
+               return FALSE;
+       }
+
+       thread->state |= set;
+       UNLOCK_THREAD (thread);
+
+       return TRUE;
+}
+
 void
 mono_thread_clr_state (MonoInternalThread *thread, MonoThreadState state)
 {
@@ -4742,11 +4603,24 @@ mono_runtime_has_tls_get (void)
 static void
 self_interrupt_thread (void *_unused)
 {
-       MonoThreadInfo *info = mono_thread_info_current ();
-       MonoException *exc = mono_thread_execute_interruption ();
-       if (exc) /*We must use _with_context since we didn't trampoline into the runtime*/
-               mono_raise_exception_with_context (exc, &info->thread_saved_state [ASYNC_SUSPEND_STATE_INDEX].ctx); /* FIXME using thread_saved_state [ASYNC_SUSPEND_STATE_INDEX] can race with another suspend coming in. */
-       g_assert_not_reached (); /*this MUST not happen since we can't resume from an async call*/
+       MonoException *exc;
+       MonoThreadInfo *info;
+
+       exc = mono_thread_execute_interruption ();
+       if (!exc) {
+               if (mono_threads_is_coop_enabled ()) {
+                       /* We can return from an async call in coop, as
+                        * it's simply called when exiting the safepoint */
+                       return;
+               }
+
+               g_error ("%s: we can't resume from an async call", __func__);
+       }
+
+       info = mono_thread_info_current ();
+
+       /* We must use _with_context since we didn't trampoline into the runtime */
+       mono_raise_exception_with_context (exc, &info->thread_saved_state [ASYNC_SUSPEND_STATE_INDEX].ctx); /* FIXME using thread_saved_state [ASYNC_SUSPEND_STATE_INDEX] can race with another suspend coming in. */
 }
 
 static gboolean
@@ -4803,6 +4677,13 @@ async_abort_critical (MonoThreadInfo *info, gpointer ud)
        if (mono_get_eh_callbacks ()->mono_install_handler_block_guard (mono_thread_info_get_suspend_state (info)))
                return MonoResumeThread;
 
+       /*
+       The target thread is running at least one protected block, which must not be interrupted, so we give up.
+       The protected block code will give them a chance when appropriate.
+       */
+       if (thread->abort_protected_block_count)
+               return MonoResumeThread;
+
        /*someone is already interrupting it*/
        if (InterlockedCompareExchange (&thread->interruption_requested, 1, 0) == 1)
                return MonoResumeThread;
@@ -4860,6 +4741,9 @@ self_abort_internal (MonoError *error)
        /* FIXME this is insanely broken, it doesn't cause interruption to happen synchronously
         * since passing FALSE to mono_thread_request_interruption makes sure it returns NULL */
 
+       /*
+       Self aborts ignore the protected block logic and raise the TAE regardless. This is verified by one of the tests in mono/tests/abort-cctor.cs.
+       */
        exc = mono_thread_request_interruption (TRUE);
        if (exc)
                mono_error_set_exception_instance (error, exc);
@@ -4887,9 +4771,14 @@ async_suspend_critical (MonoThreadInfo *info, gpointer ud)
        running_managed = mono_jit_info_match (ji, MONO_CONTEXT_GET_IP (&mono_thread_info_get_suspend_state (info)->ctx));
 
        if (running_managed && !protected_wrapper) {
-               thread->state &= ~ThreadState_SuspendRequested;
-               thread->state |= ThreadState_Suspended;
-               return KeepSuspended;
+               if (mono_threads_is_coop_enabled ()) {
+                       mono_thread_info_setup_async_call (info, self_interrupt_thread, NULL);
+                       return MonoResumeThread;
+               } else {
+                       thread->state &= ~ThreadState_SuspendRequested;
+                       thread->state |= ThreadState_Suspended;
+                       return KeepSuspended;
+               }
        } else {
                if (InterlockedCompareExchange (&thread->interruption_requested, 1, 0) == 0)
                        InterlockedIncrement (&thread_interruption_requested);
@@ -4908,6 +4797,10 @@ async_suspend_internal (MonoInternalThread *thread, gboolean interrupt)
 
        g_assert (thread != mono_thread_internal_current ());
 
+       // MOSTLY_ASYNC_SAFE_PRINTF ("ASYNC SUSPEND thread %p\n", thread_get_tid (thread));
+
+       thread->self_suspended = FALSE;
+
        data.thread = thread;
        data.interrupt = interrupt;
        data.interrupt_token = NULL;
@@ -4924,16 +4817,26 @@ static void
 self_suspend_internal (void)
 {
        MonoInternalThread *thread;
+       MonoOSEvent *event;
+       MonoOSEventWaitRet res;
 
        thread = mono_thread_internal_current ();
 
-       mono_thread_info_begin_self_suspend ();
+       // MOSTLY_ASYNC_SAFE_PRINTF ("SELF SUSPEND thread %p\n", thread_get_tid (thread));
+
+       thread->self_suspended = TRUE;
+
        thread->state &= ~ThreadState_SuspendRequested;
        thread->state |= ThreadState_Suspended;
 
        UNLOCK_THREAD (thread);
 
-       mono_thread_info_end_self_suspend ();
+       event = thread->suspended;
+
+       MONO_ENTER_GC_SAFE;
+       res = mono_os_event_wait_one (event, MONO_INFINITE_WAIT);
+       g_assert (res == MONO_OS_EVENT_WAIT_RET_SUCCESS_0 || res == MONO_OS_EVENT_WAIT_RET_ALERTED);
+       MONO_EXIT_GC_SAFE;
 }
 
 /*
@@ -5014,7 +4917,7 @@ mono_threads_join_threads (void)
                        if (thread != pthread_self ()) {
                                MONO_ENTER_GC_SAFE;
                                /* This shouldn't block */
-                               pthread_join (thread, NULL);
+                               mono_native_thread_join (thread);
                                MONO_EXIT_GC_SAFE;
                        }
                } else {
@@ -5050,7 +4953,7 @@ mono_thread_join (gpointer tid)
                return;
        thread = (pthread_t)tid;
        MONO_ENTER_GC_SAFE;
-       pthread_join (thread, NULL);
+       mono_native_thread_join (thread);
        MONO_EXIT_GC_SAFE;
 #endif
 }
@@ -5065,17 +4968,16 @@ mono_thread_internal_check_for_interruption_critical (MonoInternalThread *thread
 void
 mono_thread_internal_unhandled_exception (MonoObject* exc)
 {
-       if (mono_runtime_unhandled_exception_policy_get () == MONO_UNHANDLED_POLICY_CURRENT) {
-               MonoClass *klass = exc->vtable->klass;
-               if (is_threadabort_exception (klass)) {
-                       mono_thread_internal_reset_abort (mono_thread_internal_current ());
-               } else if (!is_appdomainunloaded_exception (klass)) {
-                       mono_unhandled_exception (exc);
-                       if (mono_environment_exitcode_get () == 1) {
-                               mono_environment_exitcode_set (255);
-                               mono_invoke_unhandled_exception_hook (exc);
-                               g_assert_not_reached ();
-                       }
+       MonoClass *klass = exc->vtable->klass;
+       if (is_threadabort_exception (klass)) {
+               mono_thread_internal_reset_abort (mono_thread_internal_current ());
+       } else if (!is_appdomainunloaded_exception (klass)
+               && mono_runtime_unhandled_exception_policy_get () == MONO_UNHANDLED_POLICY_CURRENT) {
+               mono_unhandled_exception (exc);
+               if (mono_environment_exitcode_get () == 1) {
+                       mono_environment_exitcode_set (255);
+                       mono_invoke_unhandled_exception_hook (exc);
+                       g_assert_not_reached ();
                }
        }
 }
@@ -5185,3 +5087,87 @@ mono_threads_detach_coop (gpointer cookie, gpointer *dummy)
                }
        }
 }
+
+void
+mono_threads_begin_abort_protected_block (void)
+{
+       MonoInternalThread *thread;
+
+       thread = mono_thread_internal_current ();
+       ++thread->abort_protected_block_count;
+       mono_memory_barrier ();
+}
+
+void
+mono_threads_end_abort_protected_block (void)
+{
+       MonoInternalThread *thread;
+
+       thread = mono_thread_internal_current ();
+
+       mono_memory_barrier ();
+       --thread->abort_protected_block_count;
+}
+
+MonoException*
+mono_thread_try_resume_interruption (void)
+{
+       MonoInternalThread *thread;
+
+       thread = mono_thread_internal_current ();
+       if (thread->abort_protected_block_count || mono_get_eh_callbacks ()->mono_current_thread_has_handle_block_guard ())
+               return NULL;
+
+       return mono_thread_resume_interruption ();
+}
+
+#if 0
+/* Returns TRUE if the current thread is ready to be interrupted. */
+gboolean
+mono_threads_is_ready_to_be_interrupted (void)
+{
+       MonoInternalThread *thread;
+
+       thread = mono_thread_internal_current ();
+       LOCK_THREAD (thread);
+       if (thread->state & (MonoThreadState)(ThreadState_StopRequested | ThreadState_SuspendRequested | ThreadState_AbortRequested)) {
+               UNLOCK_THREAD (thread);
+               return FALSE;
+       }
+
+       if (thread->abort_protected_block_count || mono_get_eh_callbacks ()->mono_current_thread_has_handle_block_guard ()) {
+               UNLOCK_THREAD (thread);
+               return FALSE;
+       }
+
+       UNLOCK_THREAD (thread);
+       return TRUE;
+}
+#endif
+
+void
+mono_thread_internal_describe (MonoInternalThread *internal, GString *text)
+{
+       g_string_append_printf (text, ", thread handle : %p", internal->handle);
+
+       if (internal->thread_info) {
+               g_string_append (text, ", state : ");
+               mono_thread_info_describe_interrupt_token ((MonoThreadInfo*) internal->thread_info, text);
+       }
+
+       if (internal->owned_mutexes) {
+               int i;
+
+               g_string_append (text, ", owns : [");
+               for (i = 0; i < internal->owned_mutexes->len; i++)
+                       g_string_append_printf (text, i == 0 ? "%p" : ", %p", g_ptr_array_index (internal->owned_mutexes, i));
+               g_string_append (text, "]");
+       }
+}
+
+gboolean
+mono_thread_internal_is_current (MonoInternalThread *internal)
+{
+       g_assert (internal);
+       return mono_native_thread_id_equals (mono_native_thread_id_get (), MONO_UINT_TO_NATIVE_THREAD_ID (internal->tid));
+}
index 09b76d4a128204dd9f34f314c3d4514c5ded671b..106bae0725557f553a4fbb760eea7b3d04a9ee74 100644 (file)
@@ -12,6 +12,7 @@
 #include <config.h>
 
 #include <mono/metadata/object-internals.h>
+#include <mono/metadata/dynamic-image-internals.h>
 #include <mono/metadata/verify.h>
 #include <mono/metadata/verify-internals.h>
 #include <mono/metadata/opcodes.h>
@@ -371,7 +372,7 @@ static gboolean
 token_bounds_check (MonoImage *image, guint32 token)
 {
        if (image_is_dynamic (image))
-               return mono_reflection_is_valid_dynamic_token ((MonoDynamicImage*)image, token);
+               return mono_dynamic_image_is_valid_token ((MonoDynamicImage*)image, token);
        return image->tables [mono_metadata_token_table (token)].rows >= mono_metadata_token_index (token) && mono_metadata_token_index (token) > 0;
 }
 
@@ -470,7 +471,8 @@ mono_class_has_default_constructor (MonoClass *klass)
        if (mono_class_has_failure (klass))
                return FALSE;
 
-       for (i = 0; i < klass->method.count; ++i) {
+       int mcount = mono_class_get_method_count (klass);
+       for (i = 0; i < mcount; ++i) {
                method = klass->methods [i];
                if (mono_method_is_constructor (method) &&
                        mono_method_signature (method) &&
@@ -528,7 +530,7 @@ mono_type_is_valid_type_in_context_full (MonoType *type, MonoGenericContext *con
                if (klass->byval_arg.type != type->type)
                        return mono_type_is_valid_type_in_context_full (&klass->byval_arg, context, check_gtd);
 
-               if (check_gtd && klass->generic_container)
+               if (check_gtd && mono_class_is_gtd (klass))
                        return FALSE;
                break;
        }
@@ -596,11 +598,11 @@ is_valid_generic_instantiation (MonoGenericContainer *gc, MonoGenericContext *co
                 * The type A <K> has a parent B<K>, that is inflated into the GTD B<>.
                 * Since A<K> is open, thus not instantiatable, this is valid.
                 */
-               if (paramClass->generic_container && param_type->type != MONO_TYPE_GENERICINST && !ginst->is_open)
+               if (mono_class_is_gtd (paramClass) && param_type->type != MONO_TYPE_GENERICINST && !ginst->is_open)
                        return FALSE;
 
                /*it's not safe to call mono_class_init from here*/
-               if (paramClass->generic_class && !paramClass->inited) {
+               if (mono_class_is_ginst (paramClass) && !paramClass->inited) {
                        if (!mono_class_is_valid_generic_instantiation (NULL, paramClass))
                                return FALSE;
                }
@@ -753,9 +755,9 @@ verifier_get_generic_param_from_type (VerifyContext *ctx, MonoType *type)
 
        if (type->type == MONO_TYPE_VAR) {
                MonoClass *gtd = method->klass;
-               if (gtd->generic_class)
-                       gtd = gtd->generic_class->container_class;
-               gc = gtd->generic_container;
+               if (mono_class_is_ginst (gtd))
+                       gtd = mono_class_get_generic_class (gtd)->container_class;
+               gc = mono_class_try_get_generic_container (gtd);
        } else { //MVAR
                MonoMethod *gmd = method;
                if (method->is_inflated)
@@ -830,9 +832,9 @@ mono_method_repect_method_constraints (VerifyContext *ctx, MonoMethod *method)
 static gboolean
 mono_class_repect_method_constraints (VerifyContext *ctx, MonoClass *klass)
 {
-       MonoGenericClass *gklass = klass->generic_class;
+       MonoGenericClass *gklass = mono_class_get_generic_class (klass);
        MonoGenericInst *ginst = gklass->context.class_inst;
-       MonoGenericContainer *gc = gklass->container_class->generic_container;
+       MonoGenericContainer *gc = mono_class_get_generic_container (gklass->container_class);
        return !gc || generic_arguments_respect_constraints (ctx, gc, &gklass->context, ginst);
 }
 
@@ -853,9 +855,9 @@ mono_method_is_valid_generic_instantiation (VerifyContext *ctx, MonoMethod *meth
 static gboolean
 mono_class_is_valid_generic_instantiation (VerifyContext *ctx, MonoClass *klass)
 {
-       MonoGenericClass *gklass = klass->generic_class;
+       MonoGenericClass *gklass = mono_class_get_generic_class (klass);
        MonoGenericInst *ginst = gklass->context.class_inst;
-       MonoGenericContainer *gc = gklass->container_class->generic_container;
+       MonoGenericContainer *gc = mono_class_get_generic_container (gklass->container_class);
        if (ctx && !is_valid_generic_instantiation_in_context (ctx, ginst, TRUE))
                return FALSE;
        return is_valid_generic_instantiation (gc, &gklass->context, ginst);
@@ -886,19 +888,19 @@ mono_type_is_valid_in_context (VerifyContext *ctx, MonoType *type)
        klass = mono_class_from_mono_type (type);
        mono_class_init (klass);
        if (mono_class_has_failure (klass)) {
-               if (klass->generic_class && !mono_class_is_valid_generic_instantiation (NULL, klass))
+               if (mono_class_is_ginst (klass) && !mono_class_is_valid_generic_instantiation (NULL, klass))
                        ADD_VERIFY_ERROR2 (ctx, g_strdup_printf ("Invalid generic instantiation of type %s.%s at 0x%04x", klass->name_space, klass->name, ctx->ip_offset), MONO_EXCEPTION_TYPE_LOAD);
                else
                        ADD_VERIFY_ERROR2 (ctx, g_strdup_printf ("Could not load type %s.%s at 0x%04x", klass->name_space, klass->name, ctx->ip_offset), MONO_EXCEPTION_TYPE_LOAD);
                return FALSE;
        }
 
-       if (klass->generic_class && mono_class_has_failure (klass->generic_class->container_class)) {
+       if (mono_class_is_ginst (klass) && mono_class_has_failure (mono_class_get_generic_class (klass)->container_class)) {
                ADD_VERIFY_ERROR2 (ctx, g_strdup_printf ("Could not load type %s.%s at 0x%04x", klass->name_space, klass->name, ctx->ip_offset), MONO_EXCEPTION_TYPE_LOAD);
                return FALSE;
        }
 
-       if (!klass->generic_class)
+       if (!mono_class_is_ginst (klass))
                return TRUE;
 
        if (!mono_class_is_valid_generic_instantiation (ctx, klass)) {
@@ -1677,7 +1679,7 @@ get_boxable_mono_type (VerifyContext* ctx, int token, const char *opcode)
        if (!(klass = mono_class_from_mono_type (type)))
                ADD_VERIFY_ERROR (ctx, g_strdup_printf ("Could not retrieve type token for %s at 0x%04x", opcode, ctx->ip_offset));
 
-       if (klass->generic_container && type->type != MONO_TYPE_GENERICINST)
+       if (mono_class_is_gtd (klass) && type->type != MONO_TYPE_GENERICINST)
                CODE_NOT_VERIFIABLE (ctx, g_strdup_printf ("Cannot use the generic type definition in a boxable type position for %s at 0x%04x", opcode, ctx->ip_offset));      
 
        check_unverifiable_type (ctx, type);
@@ -2187,14 +2189,14 @@ verifier_class_is_assignable_from (MonoClass *target, MonoClass *candidate)
        if (mono_class_is_assignable_from (target, candidate))
                return TRUE;
 
-       if (!MONO_CLASS_IS_INTERFACE (target) || !target->generic_class || candidate->rank != 1)
+       if (!MONO_CLASS_IS_INTERFACE (target) || !mono_class_is_ginst (target) || candidate->rank != 1)
                return FALSE;
 
-       iface_gtd = target->generic_class->container_class;
+       iface_gtd = mono_class_get_generic_class (target)->container_class;
        if (iface_gtd != mono_defaults.generic_ilist_class && iface_gtd != get_icollection_class () && iface_gtd != get_ienumerable_class ())
                return FALSE;
 
-       target = mono_class_from_mono_type (target->generic_class->context.class_inst->type_argv [0]);
+       target = mono_class_from_mono_type (mono_class_get_generic_class (target)->context.class_inst->type_argv [0]);
        candidate = candidate->element_class;
 
        return TRUE;
@@ -2673,7 +2675,7 @@ verify_ldftn_delegate (VerifyContext *ctx, MonoClass *delegate, ILStackDesc *val
         * the object is a this arg (comes from a ldarg.0), and there is no starg.0.
         * This rules doesn't apply if the object on stack is a boxed valuetype.
         */
-       if ((method->flags & METHOD_ATTRIBUTE_VIRTUAL) && !(method->flags & METHOD_ATTRIBUTE_FINAL) && !(method->klass->flags & TYPE_ATTRIBUTE_SEALED) && !stack_slot_is_boxed_value (value)) {
+       if ((method->flags & METHOD_ATTRIBUTE_VIRTUAL) && !(method->flags & METHOD_ATTRIBUTE_FINAL) && !mono_class_is_sealed (method->klass) && !stack_slot_is_boxed_value (value)) {
                /*A stdarg 0 must not happen, we fail here only in fail fast mode to avoid double error reports*/
                if (IS_FAIL_FAST_MODE (ctx) && ctx->has_this_store)
                        CODE_NOT_VERIFIABLE (ctx, g_strdup_printf ("Invalid ldftn with virtual function in method with stdarg 0 at  0x%04x", ctx->ip_offset));
@@ -3165,7 +3167,7 @@ do_invoke_method (VerifyContext *ctx, int method_token, gboolean virtual_)
                if (method->flags & METHOD_ATTRIBUTE_ABSTRACT) 
                        CODE_NOT_VERIFIABLE (ctx, g_strdup_printf ("Cannot use call with an abstract method at 0x%04x", ctx->ip_offset));
                
-               if ((method->flags & METHOD_ATTRIBUTE_VIRTUAL) && !(method->flags & METHOD_ATTRIBUTE_FINAL) && !(method->klass->flags & TYPE_ATTRIBUTE_SEALED)) {
+               if ((method->flags & METHOD_ATTRIBUTE_VIRTUAL) && !(method->flags & METHOD_ATTRIBUTE_FINAL) && !mono_class_is_sealed (method->klass)) {
                        virt_check_this = TRUE;
                        ctx->code [ctx->ip_offset].flags |= IL_CODE_CALL_NONFINAL_VIRTUAL;
                }
@@ -3810,7 +3812,7 @@ do_newobj (VerifyContext *ctx, int token)
                return;
        }
 
-       if (method->klass->flags & (TYPE_ATTRIBUTE_ABSTRACT | TYPE_ATTRIBUTE_INTERFACE))
+       if (mono_class_get_flags (method->klass) & (TYPE_ATTRIBUTE_ABSTRACT | TYPE_ATTRIBUTE_INTERFACE))
                CODE_NOT_VERIFIABLE (ctx, g_strdup_printf ("Trying to instantiate an abstract or interface type at 0x%04x", ctx->ip_offset));
 
        if (!IS_SKIP_VISIBILITY (ctx) && !mono_method_can_access_method_full (ctx->method, method, NULL)) {
@@ -4642,7 +4644,7 @@ merge_stacks (VerifyContext *ctx, ILCodeDesc *from, ILCodeDesc *to, gboolean sta
                        }
 
                        /* if old class is an interface that new class implements */
-                       if (old_class->flags & TYPE_ATTRIBUTE_INTERFACE) {
+                       if (mono_class_is_interface (old_class)) {
                                if (verifier_class_is_assignable_from (old_class, new_class)) {
                                        match_class = old_class;
                                        goto match_found;       
@@ -4655,7 +4657,7 @@ merge_stacks (VerifyContext *ctx, ILCodeDesc *from, ILCodeDesc *to, gboolean sta
                                }
                        }
 
-                       if (new_class->flags & TYPE_ATTRIBUTE_INTERFACE) {
+                       if (mono_class_is_interface (new_class)) {
                                if (verifier_class_is_assignable_from (new_class, old_class)) {
                                        match_class = new_class;
                                        goto match_found;       
@@ -4847,7 +4849,7 @@ mono_method_verify (MonoMethod *method, int level)
                finish_collect_stats ();
                return ctx.list;
        }
-       if (!method->is_generic && !method->klass->is_generic && ctx.signature->has_type_parameters) {
+       if (!method->is_generic && !mono_class_is_gtd (method->klass) && ctx.signature->has_type_parameters) {
                ADD_VERIFY_ERROR (&ctx, g_strdup_printf ("Method and signature don't match in terms of genericity"));
                finish_collect_stats ();
                return ctx.list;
@@ -4894,11 +4896,11 @@ mono_method_verify (MonoMethod *method, int level)
        if (ctx.signature->is_inflated)
                ctx.generic_context = generic_context = mono_method_get_context (method);
 
-       if (!generic_context && (method->klass->generic_container || method->is_generic)) {
+       if (!generic_context && (mono_class_is_gtd (method->klass) || method->is_generic)) {
                if (method->is_generic)
                        ctx.generic_context = generic_context = &(mono_method_get_generic_container (method)->context);
                else
-                       ctx.generic_context = generic_context = &method->klass->generic_container->context;
+                       ctx.generic_context = generic_context = &mono_class_get_generic_container (method->klass)->context;
        }
 
        for (i = 0; i < ctx.num_locals; ++i) {
@@ -6101,7 +6103,7 @@ verify_class_for_overlapping_reference_fields (MonoClass *klass)
        MonoClassField *field;
        gboolean is_fulltrust = mono_verifier_is_class_full_trust (klass);
        /*We can't skip types with !has_references since this is calculated after we have run.*/
-       if (!((klass->flags & TYPE_ATTRIBUTE_LAYOUT_MASK) == TYPE_ATTRIBUTE_EXPLICIT_LAYOUT))
+       if (!mono_class_is_explicit_layout (klass))
                return TRUE;
 
 
@@ -6116,7 +6118,8 @@ verify_class_for_overlapping_reference_fields (MonoClass *klass)
                if (mono_field_is_deleted (field) || (field->type->attrs & FIELD_ATTRIBUTE_STATIC))
                        continue;
 
-               for (j = i; j < klass->field.count; ++j) {
+               int fcount = mono_class_get_field_count (klass);
+               for (j = i; j < fcount; ++j) {
                        MonoClassField *other = &klass->fields [j];
                        int otherEnd = get_field_end (other);
                        if (mono_field_is_deleted (other) || (is_valuetype && !MONO_TYPE_IS_REFERENCE (other->type)) || (other->type->attrs & FIELD_ATTRIBUTE_STATIC))
@@ -6155,8 +6158,8 @@ verify_class_fields (MonoClass *klass)
        MonoClassField *field;
        MonoGenericContext *context = mono_class_get_context (klass);
        GHashTable *unique_fields = g_hash_table_new_full (&field_hash, &field_equals, NULL, NULL);
-       if (klass->generic_container)
-               context = &klass->generic_container->context;
+       if (mono_class_is_gtd (klass))
+               context = &mono_class_get_generic_container (klass)->context;
 
        while ((field = mono_class_get_fields (klass, &iter)) != NULL) {
                if (!mono_type_is_valid_type_in_context (field->type, context)) {
@@ -6179,7 +6182,7 @@ verify_interfaces (MonoClass *klass)
        int i;
        for (i = 0; i < klass->interface_count; ++i) {
                MonoClass *iface = klass->interfaces [i];
-               if (!(iface->flags & TYPE_ATTRIBUTE_INTERFACE))
+               if (!mono_class_get_flags (iface))
                        return FALSE;
        }
        return TRUE;
@@ -6258,7 +6261,7 @@ static gboolean
 verify_generic_parameters (MonoClass *klass)
 {
        int i;
-       MonoGenericContainer *gc = klass->generic_container;
+       MonoGenericContainer *gc = mono_class_get_generic_container (klass);
        MonoBitSet *used_args = mono_bitset_new (gc->type_argc, 0);
 
        for (i = 0; i < gc->type_argc; ++i) {
@@ -6283,7 +6286,7 @@ verify_generic_parameters (MonoClass *klass)
 
                        if (mono_type_is_generic_argument (constraint_type) && !recursive_mark_constraint_args (used_args, gc, constraint_type))
                                goto fail;
-                       if (ctr->generic_class && !mono_class_is_valid_generic_instantiation (NULL, ctr))
+                       if (mono_class_is_ginst (ctr) && !mono_class_is_valid_generic_instantiation (NULL, ctr))
                                goto fail;
                }
        }
@@ -6316,25 +6319,25 @@ mono_verifier_verify_class (MonoClass *klass)
        if (klass->parent) {
                if (MONO_CLASS_IS_INTERFACE (klass->parent))
                        return FALSE;
-               if (!klass->generic_class && klass->parent->generic_container)
+               if (!mono_class_is_ginst (klass) && mono_class_is_gtd (klass->parent))
                        return FALSE;
-               if (klass->parent->generic_class && !klass->generic_class) {
+               if (mono_class_is_ginst (klass->parent) && !mono_class_is_ginst (klass)) {
                        MonoGenericContext *context = mono_class_get_context (klass);
-                       if (klass->generic_container)
-                               context = &klass->generic_container->context;
+                       if (mono_class_is_gtd (klass))
+                               context = &mono_class_get_generic_container (klass)->context;
                        if (!mono_type_is_valid_type_in_context (&klass->parent->byval_arg, context))
                                return FALSE;
                }
        }
-       if (klass->generic_container && (klass->flags & TYPE_ATTRIBUTE_LAYOUT_MASK) == TYPE_ATTRIBUTE_EXPLICIT_LAYOUT)
+       if (mono_class_is_gtd (klass) && (mono_class_is_explicit_layout (klass)))
                return FALSE;
-       if (klass->generic_container && !verify_generic_parameters (klass))
+       if (mono_class_is_gtd (klass) && !verify_generic_parameters (klass))
                return FALSE;
        if (!verify_class_for_overlapping_reference_fields (klass))
                return FALSE;
-       if (klass->generic_class && !mono_class_is_valid_generic_instantiation (NULL, klass))
+       if (mono_class_is_ginst (klass) && !mono_class_is_valid_generic_instantiation (NULL, klass))
                return FALSE;
-       if (klass->generic_class == NULL && !verify_class_fields (klass))
+       if (!mono_class_is_ginst (klass) && !verify_class_fields (klass))
                return FALSE;
        if (klass->valuetype && !verify_valuetype_layout (klass))
                return FALSE;
index 75f52c6628f35dcb0f44d9340eb1c971996b373a..bc4b2d293dd4771fa01947fb4e37cca1ecb67e56 100644 (file)
@@ -4,6 +4,7 @@
 #include <mono/metadata/metadata.h>
 #include <mono/metadata/image.h>
 #include <mono/metadata/loader.h>
+#include <mono/metadata/class-internals.h>
 #include <glib.h> /* GSList dep */
 
 MONO_BEGIN_DECLS
@@ -48,7 +49,7 @@ typedef struct {
 
 typedef struct {
        MonoVerifyInfo info;
-       int8_t exception_type; /*should be one of MONO_EXCEPTION_* */
+       MonoExceptionType exception_type : 8; /*should be one of MONO_EXCEPTION_* */
 } MonoVerifyInfoExtended;
 
 
diff --git a/mono/metadata/w32event-unix.c b/mono/metadata/w32event-unix.c
new file mode 100644 (file)
index 0000000..6c95aaf
--- /dev/null
@@ -0,0 +1,403 @@
+/*
+ * w32event-unix.c: Runtime support for managed Event on Unix
+ *
+ * Author:
+ *     Ludovic Henry (luhenry@microsoft.com)
+ *
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
+ */
+
+#include "w32event.h"
+
+#include "w32handle-namespace.h"
+#include "mono/io-layer/io-layer.h"
+#include "mono/utils/mono-logger-internals.h"
+#include "mono/metadata/w32handle.h"
+
+typedef struct {
+       gboolean manual;
+       guint32 set_count;
+} MonoW32HandleEvent;
+
+struct MonoW32HandleNamedEvent {
+       MonoW32HandleEvent e;
+       MonoW32HandleNamespace sharedns;
+};
+
+static gboolean event_handle_own (gpointer handle, MonoW32HandleType type, guint32 *statuscode)
+{
+       MonoW32HandleEvent *event_handle;
+       gboolean ok;
+
+       *statuscode = WAIT_OBJECT_0;
+
+       ok = mono_w32handle_lookup (handle, type, (gpointer *)&event_handle);
+       if (!ok) {
+               g_warning ("%s: error looking up %s handle %p",
+                       __func__, mono_w32handle_get_typename (type), handle);
+               return FALSE;
+       }
+
+       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: owning %s handle %p",
+               __func__, mono_w32handle_get_typename (type), handle);
+
+       if (!event_handle->manual) {
+               g_assert (event_handle->set_count > 0);
+               event_handle->set_count --;
+
+               if (event_handle->set_count == 0)
+                       mono_w32handle_set_signal_state (handle, FALSE, FALSE);
+       }
+
+       return TRUE;
+}
+
+static void event_signal(gpointer handle)
+{
+       ves_icall_System_Threading_Events_SetEvent_internal (handle);
+}
+
+static gboolean event_own (gpointer handle, guint32 *statuscode)
+{
+       return event_handle_own (handle, MONO_W32HANDLE_EVENT, statuscode);
+}
+
+static void namedevent_signal (gpointer handle)
+{
+       ves_icall_System_Threading_Events_SetEvent_internal (handle);
+}
+
+/* NB, always called with the shared handle lock held */
+static gboolean namedevent_own (gpointer handle, guint32 *statuscode)
+{
+       return event_handle_own (handle, MONO_W32HANDLE_NAMEDEVENT, statuscode);
+}
+
+static void event_details (gpointer data)
+{
+       MonoW32HandleEvent *event = (MonoW32HandleEvent *)data;
+       g_print ("manual: %s, set_count: %d",
+               event->manual ? "TRUE" : "FALSE", event->set_count);
+}
+
+static void namedevent_details (gpointer data)
+{
+       MonoW32HandleNamedEvent *namedevent = (MonoW32HandleNamedEvent *)data;
+       g_print ("manual: %s, set_count: %d, name: \"%s\"",
+               namedevent->e.manual ? "TRUE" : "FALSE", namedevent->e.set_count, namedevent->sharedns.name);
+}
+
+static const gchar* event_typename (void)
+{
+       return "Event";
+}
+
+static gsize event_typesize (void)
+{
+       return sizeof (MonoW32HandleEvent);
+}
+
+static const gchar* namedevent_typename (void)
+{
+       return "N.Event";
+}
+
+static gsize namedevent_typesize (void)
+{
+       return sizeof (MonoW32HandleNamedEvent);
+}
+
+void
+mono_w32event_init (void)
+{
+       static MonoW32HandleOps event_ops = {
+               NULL,                   /* close */
+               event_signal,           /* signal */
+               event_own,              /* own */
+               NULL,                   /* is_owned */
+               NULL,                   /* special_wait */
+               NULL,                   /* prewait */
+               event_details,  /* details */
+               event_typename, /* typename */
+               event_typesize, /* typesize */
+       };
+
+       static MonoW32HandleOps namedevent_ops = {
+               NULL,                   /* close */
+               namedevent_signal,      /* signal */
+               namedevent_own,         /* own */
+               NULL,                   /* is_owned */
+               NULL,                   /* special_wait */
+               NULL,                   /* prewait */
+               namedevent_details,     /* details */
+               namedevent_typename, /* typename */
+               namedevent_typesize, /* typesize */
+       };
+
+       mono_w32handle_register_ops (MONO_W32HANDLE_EVENT,      &event_ops);
+       mono_w32handle_register_ops (MONO_W32HANDLE_NAMEDEVENT, &namedevent_ops);
+
+       mono_w32handle_register_capabilities (MONO_W32HANDLE_EVENT,
+               (MonoW32HandleCapability)(MONO_W32HANDLE_CAP_WAIT | MONO_W32HANDLE_CAP_SIGNAL));
+       mono_w32handle_register_capabilities (MONO_W32HANDLE_NAMEDEVENT,
+               (MonoW32HandleCapability)(MONO_W32HANDLE_CAP_WAIT | MONO_W32HANDLE_CAP_SIGNAL));
+}
+
+gpointer
+mono_w32event_create (gboolean manual, gboolean initial)
+{
+       gpointer handle;
+       gint32 error;
+
+       handle = ves_icall_System_Threading_Events_CreateEvent_internal (manual, initial, NULL, &error);
+       if (error != ERROR_SUCCESS)
+               g_assert (!handle);
+
+       return handle;
+}
+
+void
+mono_w32event_set (gpointer handle)
+{
+       ves_icall_System_Threading_Events_SetEvent_internal (handle);
+}
+
+void
+mono_w32event_reset (gpointer handle)
+{
+       ves_icall_System_Threading_Events_ResetEvent_internal (handle);
+}
+
+static gpointer event_handle_create (MonoW32HandleEvent *event_handle, MonoW32HandleType type, gboolean manual, gboolean initial)
+{
+       gpointer handle;
+
+       event_handle->manual = manual;
+       event_handle->set_count = (initial && !manual) ? 1 : 0;
+
+       handle = mono_w32handle_new (type, event_handle);
+       if (handle == INVALID_HANDLE_VALUE) {
+               g_warning ("%s: error creating %s handle",
+                       __func__, mono_w32handle_get_typename (type));
+               SetLastError (ERROR_GEN_FAILURE);
+               return NULL;
+       }
+
+       mono_w32handle_lock_handle (handle);
+
+       if (initial)
+               mono_w32handle_set_signal_state (handle, TRUE, FALSE);
+
+       mono_w32handle_unlock_handle (handle);
+
+       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: created %s handle %p",
+               __func__, mono_w32handle_get_typename (type), handle);
+
+       return handle;
+}
+
+static gpointer event_create (gboolean manual, gboolean initial)
+{
+       MonoW32HandleEvent event_handle;
+       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: creating %s handle",
+               __func__, mono_w32handle_get_typename (MONO_W32HANDLE_EVENT));
+       return event_handle_create (&event_handle, MONO_W32HANDLE_EVENT, manual, initial);
+}
+
+static gpointer namedevent_create (gboolean manual, gboolean initial, const gunichar2 *name G_GNUC_UNUSED)
+{
+       gpointer handle;
+       gchar *utf8_name;
+
+       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: creating %s handle",
+               __func__, mono_w32handle_get_typename (MONO_W32HANDLE_NAMEDEVENT));
+
+       /* w32 seems to guarantee that opening named objects can't race each other */
+       mono_w32handle_namespace_lock ();
+
+       utf8_name = g_utf16_to_utf8 (name, -1, NULL, NULL, NULL);
+
+       handle = mono_w32handle_namespace_search_handle (MONO_W32HANDLE_NAMEDEVENT, utf8_name);
+       if (handle == INVALID_HANDLE_VALUE) {
+               /* The name has already been used for a different object. */
+               handle = NULL;
+               SetLastError (ERROR_INVALID_HANDLE);
+       } else if (handle) {
+               /* Not an error, but this is how the caller is informed that the event wasn't freshly created */
+               SetLastError (ERROR_ALREADY_EXISTS);
+
+               /* mono_w32handle_namespace_search_handle already adds a ref to the handle */
+       } else {
+               /* A new named event */
+               MonoW32HandleNamedEvent namedevent_handle;
+
+               strncpy (&namedevent_handle.sharedns.name [0], utf8_name, MAX_PATH);
+               namedevent_handle.sharedns.name [MAX_PATH] = '\0';
+
+               handle = event_handle_create ((MonoW32HandleEvent*) &namedevent_handle, MONO_W32HANDLE_NAMEDEVENT, manual, initial);
+       }
+
+       g_free (utf8_name);
+
+       mono_w32handle_namespace_unlock ();
+
+       return handle;
+}
+
+gpointer
+ves_icall_System_Threading_Events_CreateEvent_internal (MonoBoolean manual, MonoBoolean initial, MonoString *name, gint32 *error)
+{
+       gpointer event;
+
+       /* Need to blow away any old errors here, because code tests
+        * for ERROR_ALREADY_EXISTS on success (!) to see if an event
+        * was freshly created */
+       SetLastError (ERROR_SUCCESS);
+
+       event = name ? namedevent_create (manual, initial, mono_string_chars (name)) : event_create (manual, initial);
+
+       *error = GetLastError ();
+
+       return event;
+}
+
+gboolean
+ves_icall_System_Threading_Events_SetEvent_internal (gpointer handle)
+{
+       MonoW32HandleType type;
+       MonoW32HandleEvent *event_handle;
+
+       if (handle == NULL) {
+               SetLastError (ERROR_INVALID_HANDLE);
+               return(FALSE);
+       }
+
+       switch (type = mono_w32handle_get_type (handle)) {
+       case MONO_W32HANDLE_EVENT:
+       case MONO_W32HANDLE_NAMEDEVENT:
+               break;
+       default:
+               SetLastError (ERROR_INVALID_HANDLE);
+               return FALSE;
+       }
+
+       if (!mono_w32handle_lookup (handle, type, (gpointer *)&event_handle)) {
+               g_warning ("%s: error looking up %s handle %p",
+                       __func__, mono_w32handle_get_typename (type), handle);
+               return FALSE;
+       }
+
+       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: setting %s handle %p",
+               __func__, mono_w32handle_get_typename (type), handle);
+
+       mono_w32handle_lock_handle (handle);
+
+       if (!event_handle->manual) {
+               event_handle->set_count = 1;
+               mono_w32handle_set_signal_state (handle, TRUE, FALSE);
+       } else {
+               mono_w32handle_set_signal_state (handle, TRUE, TRUE);
+       }
+
+       mono_w32handle_unlock_handle (handle);
+
+       return TRUE;
+}
+
+gboolean
+ves_icall_System_Threading_Events_ResetEvent_internal (gpointer handle)
+{
+       MonoW32HandleType type;
+       MonoW32HandleEvent *event_handle;
+
+       SetLastError (ERROR_SUCCESS);
+
+       if (handle == NULL) {
+               SetLastError (ERROR_INVALID_HANDLE);
+               return(FALSE);
+       }
+
+       switch (type = mono_w32handle_get_type (handle)) {
+       case MONO_W32HANDLE_EVENT:
+       case MONO_W32HANDLE_NAMEDEVENT:
+               break;
+       default:
+               SetLastError (ERROR_INVALID_HANDLE);
+               return FALSE;
+       }
+
+       if (!mono_w32handle_lookup (handle, type, (gpointer *)&event_handle)) {
+               g_warning ("%s: error looking up %s handle %p",
+                       __func__, mono_w32handle_get_typename (type), handle);
+               return FALSE;
+       }
+
+       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: resetting %s handle %p",
+               __func__, mono_w32handle_get_typename (type), handle);
+
+       mono_w32handle_lock_handle (handle);
+
+       if (!mono_w32handle_issignalled (handle)) {
+               mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: no need to reset %s handle %p",
+                       __func__, mono_w32handle_get_typename (type), handle);
+       } else {
+               mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: obtained write lock on %s handle %p",
+                       __func__, mono_w32handle_get_typename (type), handle);
+
+               mono_w32handle_set_signal_state (handle, FALSE, FALSE);
+       }
+
+       event_handle->set_count = 0;
+
+       mono_w32handle_unlock_handle (handle);
+
+       return TRUE;
+}
+
+void
+ves_icall_System_Threading_Events_CloseEvent_internal (gpointer handle)
+{
+       CloseHandle (handle);
+}
+
+gpointer
+ves_icall_System_Threading_Events_OpenEvent_internal (MonoString *name, gint32 rights G_GNUC_UNUSED, gint32 *error)
+{
+       gpointer handle;
+       gchar *utf8_name;
+
+       *error = ERROR_SUCCESS;
+
+       /* w32 seems to guarantee that opening named objects can't race each other */
+       mono_w32handle_namespace_lock ();
+
+       utf8_name = g_utf16_to_utf8 (mono_string_chars (name), -1, NULL, NULL, NULL);
+
+       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Opening named event [%s]", __func__, utf8_name);
+
+       handle = mono_w32handle_namespace_search_handle (MONO_W32HANDLE_NAMEDEVENT, utf8_name);
+       if (handle == INVALID_HANDLE_VALUE) {
+               /* The name has already been used for a different object. */
+               *error = ERROR_INVALID_HANDLE;
+               goto cleanup;
+       } else if (!handle) {
+               /* This name doesn't exist */
+               *error = ERROR_FILE_NOT_FOUND;
+               goto cleanup;
+       }
+
+       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: returning named event handle %p", __func__, handle);
+
+cleanup:
+       g_free (utf8_name);
+
+       mono_w32handle_namespace_unlock ();
+
+       return handle;
+}
+
+MonoW32HandleNamespace*
+mono_w32event_get_namespace (MonoW32HandleNamedEvent *event)
+{
+       return &event->sharedns;
+}
diff --git a/mono/metadata/w32event-win32.c b/mono/metadata/w32event-win32.c
new file mode 100644 (file)
index 0000000..8659021
--- /dev/null
@@ -0,0 +1,80 @@
+/*
+ * w32event-win32.c: Runtime support for managed Event on Win32
+ *
+ * Author:
+ *     Ludovic Henry (luhenry@microsoft.com)
+ *
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
+ */
+
+#include "w32event.h"
+
+#include <windows.h>
+#include <winbase.h>
+
+void
+mono_w32event_init (void)
+{
+}
+
+gpointer
+mono_w32event_create (gboolean manual, gboolean initial)
+{
+       return CreateEvent (NULL, manual, initial, NULL);
+}
+
+void
+mono_w32event_set (gpointer handle)
+{
+       SetEvent (handle);
+}
+
+void
+mono_w32event_reset (gpointer handle)
+{
+       ResetEvent (handle);
+}
+
+gpointer
+ves_icall_System_Threading_Events_CreateEvent_internal (MonoBoolean manual, MonoBoolean initial, MonoString *name, gint32 *error)
+{
+       gpointer event;
+
+       event = CreateEvent (NULL, manual, initial, name ? mono_string_chars (name) : NULL);
+
+       *error = GetLastError ();
+
+       return event;
+}
+
+gboolean
+ves_icall_System_Threading_Events_SetEvent_internal (gpointer handle)
+{
+       return SetEvent (handle);
+}
+
+gboolean
+ves_icall_System_Threading_Events_ResetEvent_internal (gpointer handle)
+{
+       return ResetEvent (handle);
+}
+
+void
+ves_icall_System_Threading_Events_CloseEvent_internal (gpointer handle)
+{
+       CloseHandle (handle);
+}
+
+gpointer
+ves_icall_System_Threading_Events_OpenEvent_internal (MonoString *name, gint32 rights, gint32 *error)
+{
+       gpointer handle;
+
+       *error = ERROR_SUCCESS;
+
+       handle = OpenEvent (rights, FALSE, mono_string_chars (name));
+       if (!handle)
+               *error = GetLastError ();
+
+       return handle;
+}
diff --git a/mono/metadata/w32event.h b/mono/metadata/w32event.h
new file mode 100644 (file)
index 0000000..1f41b1a
--- /dev/null
@@ -0,0 +1,43 @@
+
+#ifndef _MONO_METADATA_W32EVENT_H_
+#define _MONO_METADATA_W32EVENT_H_
+
+#include <config.h>
+#include <glib.h>
+
+#include "object.h"
+#include "w32handle-namespace.h"
+
+void
+mono_w32event_init (void);
+
+gpointer
+mono_w32event_create (gboolean manual, gboolean initial);
+
+void
+mono_w32event_set (gpointer handle);
+
+void
+mono_w32event_reset (gpointer handle);
+
+gpointer
+ves_icall_System_Threading_Events_CreateEvent_internal (MonoBoolean manual, MonoBoolean initial, MonoString *name, gint32 *error);
+
+gboolean
+ves_icall_System_Threading_Events_SetEvent_internal (gpointer handle);
+
+gboolean
+ves_icall_System_Threading_Events_ResetEvent_internal (gpointer handle);
+
+void
+ves_icall_System_Threading_Events_CloseEvent_internal (gpointer handle);
+
+gpointer
+ves_icall_System_Threading_Events_OpenEvent_internal (MonoString *name, gint32 rights, gint32 *error);
+
+typedef struct MonoW32HandleNamedEvent MonoW32HandleNamedEvent;
+
+MonoW32HandleNamespace*
+mono_w32event_get_namespace (MonoW32HandleNamedEvent *event);
+
+#endif /* _MONO_METADATA_W32EVENT_H_ */
diff --git a/mono/metadata/w32handle-namespace.c b/mono/metadata/w32handle-namespace.c
new file mode 100644 (file)
index 0000000..2eb2145
--- /dev/null
@@ -0,0 +1,123 @@
+/*
+ * w32handle-namespace.c: namespace for w32handles
+ *
+ * Author:
+ *     Ludovic Henry (luhenry@microsoft.com)
+ *
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
+ */
+
+#include <config.h>
+
+#ifndef HOST_WIN32
+
+#include "w32handle-namespace.h"
+
+#include "w32mutex.h"
+#include "w32semaphore.h"
+#include "w32event.h"
+#include "mono/io-layer/io-layer.h"
+#include "mono/utils/mono-logger-internals.h"
+#include "mono/utils/mono-coop-mutex.h"
+
+static MonoCoopMutex lock;
+
+void
+mono_w32handle_namespace_init (void)
+{
+       mono_coop_mutex_init (&lock);
+}
+
+void
+mono_w32handle_namespace_lock (void)
+{
+       mono_coop_mutex_lock (&lock);
+}
+
+void
+mono_w32handle_namespace_unlock (void)
+{
+       mono_coop_mutex_unlock (&lock);
+}
+
+static gboolean
+has_namespace (MonoW32HandleType type)
+{
+       switch (type) {
+       case MONO_W32HANDLE_NAMEDMUTEX:
+       case MONO_W32HANDLE_NAMEDSEM:
+       case MONO_W32HANDLE_NAMEDEVENT:
+               return TRUE;
+       default:
+               return FALSE;
+       }
+}
+
+typedef struct {
+       gpointer ret;
+       MonoW32HandleType type;
+       gchar *name;
+} NamespaceSearchHandleData;
+
+static gboolean
+mono_w32handle_namespace_search_handle_callback (gpointer handle, gpointer data, gpointer user_data)
+{
+       NamespaceSearchHandleData *search_data;
+       MonoW32HandleType type;
+       MonoW32HandleNamespace *sharedns;
+
+       type = mono_w32handle_get_type (handle);
+       if (!has_namespace (type))
+               return FALSE;
+
+       search_data = (NamespaceSearchHandleData*) user_data;
+
+       switch (type) {
+       case MONO_W32HANDLE_NAMEDMUTEX: sharedns = mono_w32mutex_get_namespace ((MonoW32HandleNamedMutex*) data); break;
+       case MONO_W32HANDLE_NAMEDSEM:   sharedns = mono_w32semaphore_get_namespace ((MonoW32HandleNamedSemaphore*) data); break;
+       case MONO_W32HANDLE_NAMEDEVENT: sharedns = mono_w32event_get_namespace ((MonoW32HandleNamedEvent*) data); break;
+       default:
+               g_assert_not_reached ();
+       }
+
+       if (strcmp (sharedns->name, search_data->name) == 0) {
+               if (type != search_data->type) {
+                       /* Its the wrong type, so fail now */
+                       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: handle %p matches name but is wrong type: %s",
+                               __func__, handle, mono_w32handle_get_typename (type));
+                       search_data->ret = INVALID_HANDLE_VALUE;
+               } else {
+                       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: handle %p matches name and type",
+                               __func__, handle);
+
+                       /* we do not want the handle to be destroyed before we return it  */
+                       mono_w32handle_ref (handle);
+
+                       search_data->ret = handle;
+               }
+
+               return TRUE;
+       }
+
+       return FALSE;
+}
+
+gpointer
+mono_w32handle_namespace_search_handle (MonoW32HandleType type, gchar *name)
+{
+       NamespaceSearchHandleData search_data;
+
+       if (!has_namespace (type))
+               g_error ("%s: type %s does not have a namespace", __func__, type);
+
+       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Lookup for handle named [%s] type %s",
+               __func__, name, mono_w32handle_get_typename (type));
+
+       search_data.ret = NULL;
+       search_data.type = type;
+       search_data.name = name;
+       mono_w32handle_foreach (mono_w32handle_namespace_search_handle_callback, &search_data);
+       return search_data.ret;
+}
+
+#endif
diff --git a/mono/metadata/w32handle-namespace.h b/mono/metadata/w32handle-namespace.h
new file mode 100644 (file)
index 0000000..75797a8
--- /dev/null
@@ -0,0 +1,28 @@
+
+#ifndef _MONO_METADATA_W32HANDLE_NAMESPACE_H_
+#define _MONO_METADATA_W32HANDLE_NAMESPACE_H_
+
+#include <config.h>
+#include <glib.h>
+
+#include "mono/metadata/w32handle.h"
+
+#define MONO_W32HANDLE_NAMESPACE_MAX_PATH 260
+
+typedef struct {
+       gchar name [MONO_W32HANDLE_NAMESPACE_MAX_PATH + 1];
+} MonoW32HandleNamespace;
+
+void
+mono_w32handle_namespace_init (void);
+
+void
+mono_w32handle_namespace_lock (void);
+
+void
+mono_w32handle_namespace_unlock (void);
+
+gpointer
+mono_w32handle_namespace_search_handle (MonoW32HandleType type, gchar *name);
+
+#endif /* _MONO_METADATA_W32HANDLE_NAMESPACE_H_ */
\ No newline at end of file
diff --git a/mono/metadata/w32handle.c b/mono/metadata/w32handle.c
new file mode 100644 (file)
index 0000000..ef3b248
--- /dev/null
@@ -0,0 +1,1452 @@
+/*
+ * w32handle.c:  Generic and internal operations on handles
+ *
+ * Author:
+ *     Dick Porter (dick@ximian.com)
+ *     Ludovic Henry (luhenry@microsoft.com)
+ *
+ * (C) 2002-2011 Novell, Inc.
+ * Copyright 2011 Xamarin Inc
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
+ */
+
+#include <config.h>
+#include <glib.h>
+
+#include "w32handle.h"
+
+#include "utils/atomic.h"
+#include "utils/mono-logger-internals.h"
+#include "utils/mono-os-mutex.h"
+#include "utils/mono-proclib.h"
+#include "utils/mono-threads.h"
+#include "utils/mono-time.h"
+
+#undef DEBUG_REFS
+
+#define SLOT_MAX               (1024 * 16)
+
+/* must be a power of 2 */
+#define HANDLE_PER_SLOT        (256)
+
+#define INFINITE 0xFFFFFFFF
+
+typedef struct {
+       MonoW32HandleType type;
+       guint ref;
+       gboolean signalled;
+       mono_mutex_t signal_mutex;
+       mono_cond_t signal_cond;
+       gpointer specific;
+} MonoW32HandleBase;
+
+static MonoW32HandleCapability handle_caps [MONO_W32HANDLE_COUNT];
+static MonoW32HandleOps *handle_ops [MONO_W32HANDLE_COUNT];
+
+/*
+ * We can hold SLOT_MAX * HANDLE_PER_SLOT handles.
+ * If 4M handles are not enough... Oh, well... we will crash.
+ */
+#define SLOT_INDEX(x)  (x / HANDLE_PER_SLOT)
+#define SLOT_OFFSET(x) (x % HANDLE_PER_SLOT)
+
+static MonoW32HandleBase *private_handles [SLOT_MAX];
+static guint32 private_handles_count = 0;
+static guint32 private_handles_slots_count = 0;
+
+guint32 mono_w32handle_fd_reserve;
+
+/*
+ * This is an internal handle which is used for handling waiting for multiple handles.
+ * Threads which wait for multiple handles wait on this one handle, and when a handle
+ * is signalled, this handle is signalled too.
+ */
+static mono_mutex_t global_signal_mutex;
+static mono_cond_t global_signal_cond;
+
+static mono_mutex_t scan_mutex;
+
+static gboolean shutting_down = FALSE;
+
+static gboolean
+type_is_fd (MonoW32HandleType type)
+{
+       switch (type) {
+       case MONO_W32HANDLE_FILE:
+       case MONO_W32HANDLE_CONSOLE:
+       case MONO_W32HANDLE_SOCKET:
+       case MONO_W32HANDLE_PIPE:
+               return TRUE;
+       default:
+               return FALSE;
+       }
+}
+
+static gboolean
+mono_w32handle_lookup_data (gpointer handle, MonoW32HandleBase **handle_data)
+{
+       gsize index, offset;
+
+       g_assert (handle_data);
+
+       index = SLOT_INDEX ((gsize) handle);
+       if (index >= SLOT_MAX)
+               return FALSE;
+       if (!private_handles [index])
+               return FALSE;
+
+       offset = SLOT_OFFSET ((gsize) handle);
+       if (private_handles [index][offset].type == MONO_W32HANDLE_UNUSED)
+               return FALSE;
+
+       *handle_data = &private_handles [index][offset];
+       return TRUE;
+}
+
+MonoW32HandleType
+mono_w32handle_get_type (gpointer handle)
+{
+       MonoW32HandleBase *handle_data;
+
+       if (!mono_w32handle_lookup_data (handle, &handle_data))
+               return MONO_W32HANDLE_UNUSED;   /* An impossible type */
+
+       return handle_data->type;
+}
+
+static const gchar*
+mono_w32handle_ops_typename (MonoW32HandleType type);
+
+const gchar*
+mono_w32handle_get_typename (MonoW32HandleType type)
+{
+       return mono_w32handle_ops_typename (type);
+}
+
+void
+mono_w32handle_set_signal_state (gpointer handle, gboolean state, gboolean broadcast)
+{
+       MonoW32HandleBase *handle_data;
+
+       if (!mono_w32handle_lookup_data (handle, &handle_data)) {
+               return;
+       }
+
+#ifdef DEBUG
+       g_message ("%s: setting state of %p to %s (broadcast %s)", __func__,
+                  handle, state?"TRUE":"FALSE", broadcast?"TRUE":"FALSE");
+#endif
+
+       if (state == TRUE) {
+               /* Tell everyone blocking on a single handle */
+
+               /* The condition the global signal cond is waiting on is the signalling of
+                * _any_ handle. So lock it before setting the signalled state.
+                */
+               mono_os_mutex_lock (&global_signal_mutex);
+
+               /* This function _must_ be called with
+                * handle->signal_mutex locked
+                */
+               handle_data->signalled=state;
+
+               if (broadcast == TRUE) {
+                       mono_os_cond_broadcast (&handle_data->signal_cond);
+               } else {
+                       mono_os_cond_signal (&handle_data->signal_cond);
+               }
+
+               /* Tell everyone blocking on multiple handles that something
+                * was signalled
+                */
+               mono_os_cond_broadcast (&global_signal_cond);
+
+               mono_os_mutex_unlock (&global_signal_mutex);
+       } else {
+               handle_data->signalled=state;
+       }
+}
+
+gboolean
+mono_w32handle_issignalled (gpointer handle)
+{
+       MonoW32HandleBase *handle_data;
+
+       if (!mono_w32handle_lookup_data (handle, &handle_data)) {
+               return(FALSE);
+       }
+
+       return handle_data->signalled;
+}
+
+static void
+mono_w32handle_lock_signal_mutex (void)
+{
+#ifdef DEBUG
+       g_message ("%s: lock global signal mutex", __func__);
+#endif
+
+       mono_os_mutex_lock (&global_signal_mutex);
+}
+
+static void
+mono_w32handle_unlock_signal_mutex (void)
+{
+#ifdef DEBUG
+       g_message ("%s: unlock global signal mutex", __func__);
+#endif
+
+       mono_os_mutex_unlock (&global_signal_mutex);
+}
+
+void
+mono_w32handle_lock_handle (gpointer handle)
+{
+       MonoW32HandleBase *handle_data;
+
+       if (!mono_w32handle_lookup_data (handle, &handle_data))
+               g_error ("%s: failed to lookup handle %p", __func__, handle);
+
+       mono_w32handle_ref (handle);
+
+       mono_os_mutex_lock (&handle_data->signal_mutex);
+
+       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_W32HANDLE, "%s: lock handle %p", __func__, handle);
+}
+
+gboolean
+mono_w32handle_trylock_handle (gpointer handle)
+{
+       MonoW32HandleBase *handle_data;
+       gboolean locked;
+
+       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_W32HANDLE, "%s: trylock handle %p", __func__, handle);
+
+       if (!mono_w32handle_lookup_data (handle, &handle_data))
+               g_error ("%s: failed to lookup handle %p", __func__, handle);
+
+       mono_w32handle_ref (handle);
+
+       locked = mono_os_mutex_trylock (&handle_data->signal_mutex) == 0;
+       if (!locked)
+               mono_w32handle_unref (handle);
+
+       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_W32HANDLE, "%s: trylock handle %p, locked: %s", __func__, handle, locked ? "true" : "false");
+
+       return locked;
+}
+
+void
+mono_w32handle_unlock_handle (gpointer handle)
+{
+       MonoW32HandleBase *handle_data;
+
+       if (!mono_w32handle_lookup_data (handle, &handle_data))
+               g_error ("%s: failed to lookup handle %p", __func__, handle);
+
+       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_W32HANDLE, "%s: unlock handle %p", __func__, handle);
+
+       mono_os_mutex_unlock (&handle_data->signal_mutex);
+
+       mono_w32handle_unref (handle);
+}
+
+/*
+ * wapi_init:
+ *
+ *   Initialize the io-layer.
+ */
+void
+mono_w32handle_init (void)
+{
+       static gboolean initialized = FALSE;
+
+       if (initialized)
+               return;
+
+       g_assert ((sizeof (handle_ops) / sizeof (handle_ops[0]))
+                 == MONO_W32HANDLE_COUNT);
+
+       /* This is needed by the code in mono_w32handle_new_internal */
+       mono_w32handle_fd_reserve = (eg_getdtablesize () + (HANDLE_PER_SLOT - 1)) & ~(HANDLE_PER_SLOT - 1);
+
+       do {
+               /*
+                * The entries in private_handles reserved for fds are allocated lazily to
+                * save memory.
+                */
+
+               private_handles_count += HANDLE_PER_SLOT;
+               private_handles_slots_count ++;
+       } while(mono_w32handle_fd_reserve > private_handles_count);
+
+       mono_os_mutex_init (&scan_mutex);
+
+       mono_os_cond_init (&global_signal_cond);
+       mono_os_mutex_init (&global_signal_mutex);
+
+       initialized = TRUE;
+}
+
+void
+mono_w32handle_cleanup (void)
+{
+       int i, j, k;
+
+       g_assert (!shutting_down);
+       shutting_down = TRUE;
+
+       /* Every shared handle we were using ought really to be closed
+        * by now, but to make sure just blow them all away.  The
+        * exiting finalizer thread in particular races us to the
+        * program exit and doesn't always win, so it can be left
+        * cluttering up the shared file.  Anything else left over is
+        * really a bug.
+        */
+       for(i = SLOT_INDEX (0); private_handles[i] != NULL; i++) {
+               for(j = SLOT_OFFSET (0); j < HANDLE_PER_SLOT; j++) {
+                       MonoW32HandleBase *handle_data = &private_handles[i][j];
+                       gpointer handle = GINT_TO_POINTER (i*HANDLE_PER_SLOT+j);
+
+                       for(k = handle_data->ref; k > 0; k--) {
+                               mono_w32handle_unref (handle);
+                       }
+               }
+       }
+
+       for (i = 0; i < SLOT_MAX; ++i)
+               g_free (private_handles [i]);
+}
+
+static gsize
+mono_w32handle_ops_typesize (MonoW32HandleType type);
+
+static void mono_w32handle_init_handle (MonoW32HandleBase *handle,
+                              MonoW32HandleType type, gpointer handle_specific)
+{
+       g_assert (handle->ref == 0);
+
+       handle->type = type;
+       handle->signalled = FALSE;
+       handle->ref = 1;
+
+       mono_os_cond_init (&handle->signal_cond);
+       mono_os_mutex_init (&handle->signal_mutex);
+
+       if (handle_specific)
+               handle->specific = g_memdup (handle_specific, mono_w32handle_ops_typesize (type));
+}
+
+/*
+ * mono_w32handle_new_internal:
+ * @type: Init handle to this type
+ *
+ * Search for a free handle and initialize it. Return the handle on
+ * success and 0 on failure.  This is only called from
+ * mono_w32handle_new, and scan_mutex must be held.
+ */
+static guint32 mono_w32handle_new_internal (MonoW32HandleType type,
+                                         gpointer handle_specific)
+{
+       guint32 i, k, count;
+       static guint32 last = 0;
+       gboolean retry = FALSE;
+       
+       /* A linear scan should be fast enough.  Start from the last
+        * allocation, assuming that handles are allocated more often
+        * than they're freed. Leave the space reserved for file
+        * descriptors
+        */
+
+       if (last < mono_w32handle_fd_reserve) {
+               last = mono_w32handle_fd_reserve;
+       } else {
+               retry = TRUE;
+       }
+
+again:
+       count = last;
+       for(i = SLOT_INDEX (count); i < private_handles_slots_count; i++) {
+               if (private_handles [i]) {
+                       for (k = SLOT_OFFSET (count); k < HANDLE_PER_SLOT; k++) {
+                               MonoW32HandleBase *handle = &private_handles [i][k];
+
+                               if(handle->type == MONO_W32HANDLE_UNUSED) {
+                                       last = count + 1;
+
+                                       mono_w32handle_init_handle (handle, type, handle_specific);
+                                       return (count);
+                               }
+                               count++;
+                       }
+               }
+       }
+
+       if(retry && last > mono_w32handle_fd_reserve) {
+               /* Try again from the beginning */
+               last = mono_w32handle_fd_reserve;
+               goto again;
+       }
+
+       /* Will need to expand the array.  The caller will sort it out */
+
+       return(0);
+}
+
+gpointer
+mono_w32handle_new (MonoW32HandleType type, gpointer handle_specific)
+{
+       guint32 handle_idx = 0;
+       gpointer handle;
+
+       g_assert (!shutting_down);
+
+       g_assert(!type_is_fd(type));
+
+       mono_os_mutex_lock (&scan_mutex);
+
+       while ((handle_idx = mono_w32handle_new_internal (type, handle_specific)) == 0) {
+               /* Try and expand the array, and have another go */
+               int idx = SLOT_INDEX (private_handles_count);
+               if (idx >= SLOT_MAX) {
+                       break;
+               }
+
+               private_handles [idx] = g_new0 (MonoW32HandleBase, HANDLE_PER_SLOT);
+
+               private_handles_count += HANDLE_PER_SLOT;
+               private_handles_slots_count ++;
+       }
+
+       mono_os_mutex_unlock (&scan_mutex);
+
+       if (handle_idx == 0) {
+               /* We ran out of slots */
+               handle = INVALID_HANDLE_VALUE;
+               mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_W32HANDLE, "%s: failed to create %s handle", __func__, mono_w32handle_ops_typename (type));
+               goto done;
+       }
+
+       /* Make sure we left the space for fd mappings */
+       g_assert (handle_idx >= mono_w32handle_fd_reserve);
+
+       handle = GUINT_TO_POINTER (handle_idx);
+
+       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_W32HANDLE, "%s: create %s handle %p", __func__, mono_w32handle_ops_typename (type), handle);
+
+done:
+       return(handle);
+}
+
+gpointer mono_w32handle_new_fd (MonoW32HandleType type, int fd,
+                             gpointer handle_specific)
+{
+       MonoW32HandleBase *handle_data;
+       int fd_index, fd_offset;
+
+       g_assert (!shutting_down);
+
+       g_assert(type_is_fd(type));
+
+       if (fd >= mono_w32handle_fd_reserve) {
+               mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_W32HANDLE, "%s: failed to create %s handle, fd is too big", __func__, mono_w32handle_ops_typename (type));
+
+               return(GUINT_TO_POINTER (INVALID_HANDLE_VALUE));
+       }
+
+       fd_index = SLOT_INDEX (fd);
+       fd_offset = SLOT_OFFSET (fd);
+
+       /* Initialize the array entries on demand */
+       if (!private_handles [fd_index]) {
+               mono_os_mutex_lock (&scan_mutex);
+
+               if (!private_handles [fd_index])
+                       private_handles [fd_index] = g_new0 (MonoW32HandleBase, HANDLE_PER_SLOT);
+
+               mono_os_mutex_unlock (&scan_mutex);
+       }
+
+       handle_data = &private_handles [fd_index][fd_offset];
+
+       if (handle_data->type != MONO_W32HANDLE_UNUSED) {
+               mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_W32HANDLE, "%s: failed to create %s handle, fd is already in use", __func__, mono_w32handle_ops_typename (type));
+               /* FIXME: clean up this handle?  We can't do anything
+                * with the fd, cos thats the new one
+                */
+               return(GUINT_TO_POINTER (INVALID_HANDLE_VALUE));
+       }
+
+       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_W32HANDLE, "%s: create %s handle %p", __func__, mono_w32handle_ops_typename (type), GUINT_TO_POINTER(fd));
+
+       mono_w32handle_init_handle (handle_data, type, handle_specific);
+
+       return(GUINT_TO_POINTER(fd));
+}
+
+gboolean
+mono_w32handle_lookup (gpointer handle, MonoW32HandleType type,
+                             gpointer *handle_specific)
+{
+       MonoW32HandleBase *handle_data;
+
+       g_assert (handle_specific);
+
+       if (!mono_w32handle_lookup_data (handle, &handle_data)) {
+               return(FALSE);
+       }
+
+       if (handle_data->type != type) {
+               return(FALSE);
+       }
+
+       *handle_specific = handle_data->specific;
+
+       return(TRUE);
+}
+
+static gboolean
+mono_w32handle_ref_core (gpointer handle, MonoW32HandleBase *handle_data);
+
+static gboolean
+mono_w32handle_unref_core (gpointer handle, MonoW32HandleBase *handle_data, guint minimum);
+
+void
+mono_w32handle_foreach (gboolean (*on_each)(gpointer handle, gpointer data, gpointer user_data), gpointer user_data)
+{
+       guint32 i, k;
+
+       mono_os_mutex_lock (&scan_mutex);
+
+       for (i = SLOT_INDEX (0); i < private_handles_slots_count; i++) {
+               if (!private_handles [i])
+                       continue;
+               for (k = SLOT_OFFSET (0); k < HANDLE_PER_SLOT; k++) {
+                       MonoW32HandleBase *handle_data = NULL;
+                       gpointer handle;
+                       gboolean destroy, finished;
+
+                       handle_data = &private_handles [i][k];
+                       if (handle_data->type == MONO_W32HANDLE_UNUSED)
+                               continue;
+
+                       handle = GUINT_TO_POINTER (i * HANDLE_PER_SLOT + k);
+
+                       if (!mono_w32handle_ref_core (handle, handle_data)) {
+                               /* we are racing with mono_w32handle_unref:
+                                *  the handle ref has been decremented, but it
+                                *  hasn't yet been destroyed. */
+                               continue;
+                       }
+
+                       finished = on_each (handle, handle_data->specific, user_data);
+
+                       /* we do not want to have to destroy the handle here,
+                        * as it would means the ref/unref are unbalanced */
+                       destroy = mono_w32handle_unref_core (handle, handle_data, 2);
+                       g_assert (!destroy);
+
+                       if (finished)
+                               goto done;
+               }
+       }
+
+done:
+       mono_os_mutex_unlock (&scan_mutex);
+}
+
+static gboolean
+mono_w32handle_ref_core (gpointer handle, MonoW32HandleBase *handle_data)
+{
+       guint old, new;
+
+       do {
+               old = handle_data->ref;
+               if (old == 0)
+                       return FALSE;
+
+               new = old + 1;
+       } while (InterlockedCompareExchange ((gint32*) &handle_data->ref, new, old) != old);
+
+       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_W32HANDLE, "%s: ref %s handle %p, ref: %d -> %d",
+               __func__, mono_w32handle_ops_typename (handle_data->type), handle, old, new);
+
+       return TRUE;
+}
+
+static gboolean
+mono_w32handle_unref_core (gpointer handle, MonoW32HandleBase *handle_data, guint minimum)
+{
+       MonoW32HandleType type;
+       guint old, new;
+
+       type = handle_data->type;
+
+       do {
+               old = handle_data->ref;
+               if (!(old >= minimum))
+                       g_error ("%s: handle %p has ref %d, it should be >= %d", __func__, handle, old, minimum);
+
+               new = old - 1;
+       } while (InterlockedCompareExchange ((gint32*) &handle_data->ref, new, old) != old);
+
+       /* handle_data might contain invalid data from now on, if
+        * another thread is unref'ing this handle at the same time */
+
+       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_W32HANDLE, "%s: unref %s handle %p, ref: %d -> %d destroy: %s",
+               __func__, mono_w32handle_ops_typename (type), handle, old, new, new == 0 ? "true" : "false");
+
+       return new == 0;
+}
+
+void mono_w32handle_ref (gpointer handle)
+{
+       MonoW32HandleBase *handle_data;
+
+       if (!mono_w32handle_lookup_data (handle, &handle_data)) {
+               mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_W32HANDLE, "%s: failed to ref handle %p, unknown handle", __func__, handle);
+               return;
+       }
+
+       if (!mono_w32handle_ref_core (handle, handle_data))
+               g_error ("%s: failed to ref handle %p", __func__, handle);
+}
+
+static void (*_wapi_handle_ops_get_close_func (MonoW32HandleType type))(gpointer, gpointer);
+
+/* The handle must not be locked on entry to this function */
+void
+mono_w32handle_unref (gpointer handle)
+{
+       MonoW32HandleBase *handle_data;
+       gboolean destroy;
+
+       if (!mono_w32handle_lookup_data (handle, &handle_data)) {
+               mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_W32HANDLE, "%s: failed to unref handle %p, unknown handle",
+                       __func__, handle);
+               return;
+       }
+
+       destroy = mono_w32handle_unref_core (handle, handle_data, 1);
+
+       if (destroy) {
+               /* Need to copy the handle info, reset the slot in the
+                * array, and _only then_ call the close function to
+                * avoid race conditions (eg file descriptors being
+                * closed, and another file being opened getting the
+                * same fd racing the memset())
+                */
+               MonoW32HandleType type;
+               gpointer handle_specific;
+               void (*close_func)(gpointer, gpointer);
+
+               type = handle_data->type;
+               handle_specific = handle_data->specific;
+
+               mono_os_mutex_lock (&scan_mutex);
+
+               mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_W32HANDLE, "%s: destroy %s handle %p", __func__, mono_w32handle_ops_typename (type), handle);
+
+               mono_os_mutex_destroy (&handle_data->signal_mutex);
+               mono_os_cond_destroy (&handle_data->signal_cond);
+
+               memset (handle_data, 0, sizeof (MonoW32HandleBase));
+
+               mono_os_mutex_unlock (&scan_mutex);
+
+               close_func = _wapi_handle_ops_get_close_func (type);
+               if (close_func != NULL) {
+                       close_func (handle, handle_specific);
+               }
+
+               g_free (handle_specific);
+       }
+}
+
+static void
+mono_w32handle_ops_close (gpointer handle, gpointer data);
+
+void
+mono_w32handle_force_close (gpointer handle, gpointer data)
+{
+       mono_w32handle_ops_close (handle, data);
+}
+
+void
+mono_w32handle_register_ops (MonoW32HandleType type, MonoW32HandleOps *ops)
+{
+       handle_ops [type] = ops;
+}
+
+void mono_w32handle_register_capabilities (MonoW32HandleType type,
+                                        MonoW32HandleCapability caps)
+{
+       handle_caps[type] = caps;
+}
+
+gboolean mono_w32handle_test_capabilities (gpointer handle,
+                                        MonoW32HandleCapability caps)
+{
+       MonoW32HandleBase *handle_data;
+       MonoW32HandleType type;
+
+       if (!mono_w32handle_lookup_data (handle, &handle_data)) {
+               return(FALSE);
+       }
+
+       type = handle_data->type;
+
+       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_W32HANDLE, "%s: testing 0x%x against 0x%x (%d)", __func__,
+                  handle_caps[type], caps, handle_caps[type] & caps);
+
+       return((handle_caps[type] & caps) != 0);
+}
+
+static void (*_wapi_handle_ops_get_close_func (MonoW32HandleType type))(gpointer, gpointer)
+{
+       if (handle_ops[type] != NULL &&
+           handle_ops[type]->close != NULL) {
+               return (handle_ops[type]->close);
+       }
+
+       return (NULL);
+}
+
+static void
+mono_w32handle_ops_close (gpointer handle, gpointer data)
+{
+       MonoW32HandleBase *handle_data;
+       MonoW32HandleType type;
+
+       if (!mono_w32handle_lookup_data (handle, &handle_data)) {
+               return;
+       }
+
+       type = handle_data->type;
+
+       if (handle_ops[type] != NULL &&
+           handle_ops[type]->close != NULL) {
+               handle_ops[type]->close (handle, data);
+       }
+}
+
+static void
+mono_w32handle_ops_details (MonoW32HandleType type, gpointer data)
+{
+       if (handle_ops[type] != NULL &&
+           handle_ops[type]->details != NULL) {
+               handle_ops[type]->details (data);
+       }
+}
+
+static const gchar*
+mono_w32handle_ops_typename (MonoW32HandleType type)
+{
+       g_assert (handle_ops [type]);
+       g_assert (handle_ops [type]->typename);
+       return handle_ops [type]->typename ();
+}
+
+static gsize
+mono_w32handle_ops_typesize (MonoW32HandleType type)
+{
+       g_assert (handle_ops [type]);
+       g_assert (handle_ops [type]->typesize);
+       return handle_ops [type]->typesize ();
+}
+
+static void
+mono_w32handle_ops_signal (gpointer handle)
+{
+       MonoW32HandleBase *handle_data;
+       MonoW32HandleType type;
+
+       if (!mono_w32handle_lookup_data (handle, &handle_data)) {
+               return;
+       }
+
+       type = handle_data->type;
+
+       if (handle_ops[type] != NULL && handle_ops[type]->signal != NULL) {
+               handle_ops[type]->signal (handle);
+       }
+}
+
+static gboolean
+mono_w32handle_ops_own (gpointer handle, guint32 *statuscode)
+{
+       MonoW32HandleBase *handle_data;
+       MonoW32HandleType type;
+
+       if (!mono_w32handle_lookup_data (handle, &handle_data)) {
+               return(FALSE);
+       }
+
+       type = handle_data->type;
+
+       if (handle_ops[type] != NULL && handle_ops[type]->own_handle != NULL) {
+               return(handle_ops[type]->own_handle (handle, statuscode));
+       } else {
+               return(FALSE);
+       }
+}
+
+static gboolean
+mono_w32handle_ops_isowned (gpointer handle)
+{
+       MonoW32HandleBase *handle_data;
+       MonoW32HandleType type;
+
+       if (!mono_w32handle_lookup_data (handle, &handle_data)) {
+               return(FALSE);
+       }
+
+       type = handle_data->type;
+
+       if (handle_ops[type] != NULL && handle_ops[type]->is_owned != NULL) {
+               return(handle_ops[type]->is_owned (handle));
+       } else {
+               return(FALSE);
+       }
+}
+
+static MonoW32HandleWaitRet
+mono_w32handle_ops_specialwait (gpointer handle, guint32 timeout, gboolean *alerted)
+{
+       MonoW32HandleBase *handle_data;
+       MonoW32HandleType type;
+
+       if (!mono_w32handle_lookup_data (handle, &handle_data)) {
+               return(WAIT_FAILED);
+       }
+
+       type = handle_data->type;
+
+       if (handle_ops[type] != NULL &&
+           handle_ops[type]->special_wait != NULL) {
+               return(handle_ops[type]->special_wait (handle, timeout, alerted));
+       } else {
+               return(WAIT_FAILED);
+       }
+}
+
+static void
+mono_w32handle_ops_prewait (gpointer handle)
+{
+       MonoW32HandleBase *handle_data;
+       MonoW32HandleType type;
+
+       if (!mono_w32handle_lookup_data (handle, &handle_data)) {
+               return;
+       }
+
+       type = handle_data->type;
+
+       if (handle_ops[type] != NULL &&
+           handle_ops[type]->prewait != NULL) {
+               handle_ops[type]->prewait (handle);
+       }
+}
+
+static void
+spin (guint32 ms)
+{
+#ifdef HOST_WIN32
+       SleepEx (ms, TRUE);
+#else
+       struct timespec sleepytime;
+
+       g_assert (ms < 1000);
+
+       sleepytime.tv_sec = 0;
+       sleepytime.tv_nsec = ms * 1000000;
+       nanosleep (&sleepytime, NULL);
+#endif /* HOST_WIN32 */
+}
+
+static void
+mono_w32handle_lock_handles (gpointer *handles, gsize numhandles)
+{
+       guint32 i, iter=0;
+
+       /* Lock all the handles, with backoff */
+again:
+       for(i=0; i<numhandles; i++) {
+               gpointer handle = handles[i];
+
+               mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_W32HANDLE, "%s: attempting to lock %p", __func__, handle);
+
+               if (!mono_w32handle_trylock_handle (handle)) {
+                       /* Bummer */
+
+                       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_W32HANDLE, "%s: attempt failed for %p: %s", __func__,
+                                  handle);
+
+                       while (i--) {
+                               handle = handles[i];
+
+                               mono_w32handle_unlock_handle (handle);
+                       }
+
+                       /* If iter ever reaches 100 the nanosleep will
+                        * return EINVAL immediately, but we have a
+                        * design flaw if that happens.
+                        */
+                       iter++;
+                       if(iter==100) {
+                               g_warning ("%s: iteration overflow!",
+                                          __func__);
+                               iter=1;
+                       }
+
+                       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_W32HANDLE, "%s: Backing off for %d ms", __func__,
+                                  iter*10);
+                       spin (10 * iter);
+
+                       goto again;
+               }
+       }
+
+       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_W32HANDLE, "%s: Locked all handles", __func__);
+}
+
+static void
+mono_w32handle_unlock_handles (gpointer *handles, gsize numhandles)
+{
+       guint32 i;
+
+       for(i=0; i<numhandles; i++) {
+               gpointer handle = handles[i];
+
+               mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_W32HANDLE, "%s: unlocking handle %p", __func__, handle);
+
+               mono_w32handle_unlock_handle (handle);
+       }
+}
+
+static int
+mono_w32handle_timedwait_signal_naked (mono_cond_t *cond, mono_mutex_t *mutex, guint32 timeout, gboolean poll, gboolean *alerted)
+{
+       int res;
+
+       if (!poll) {
+               res = mono_os_cond_timedwait (cond, mutex, timeout);
+       } else {
+               /* This is needed when waiting for process handles */
+               if (!alerted) {
+                       /*
+                        * pthread_cond_(timed)wait() can return 0 even if the condition was not
+                        * signalled.  This happens at least on Darwin.  We surface this, i.e., we
+                        * get spurious wake-ups.
+                        *
+                        * http://pubs.opengroup.org/onlinepubs/007908775/xsh/pthread_cond_wait.html
+                        */
+                       res = mono_os_cond_timedwait (cond, mutex, timeout);
+               } else {
+                       if (timeout < 100) {
+                               /* Real timeout is less than 100ms time */
+                               res = mono_os_cond_timedwait (cond, mutex, timeout);
+                       } else {
+                               res = mono_os_cond_timedwait (cond, mutex, 100);
+
+                               /* Mask the fake timeout, this will cause
+                                * another poll if the cond was not really signaled
+                                */
+                               if (res == -1)
+                                       res = 0;
+                       }
+               }
+       }
+
+       return res;
+}
+
+static void
+signal_global (gpointer unused)
+{
+       /* If we reach here, then interrupt token is set to the flag value, which
+        * means that the target thread is either
+        * - before the first CAS in timedwait, which means it won't enter the wait.
+        * - it is after the first CAS, so it is already waiting, or it will enter
+        *    the wait, and it will be interrupted by the broadcast. */
+       mono_os_mutex_lock (&global_signal_mutex);
+       mono_os_cond_broadcast (&global_signal_cond);
+       mono_os_mutex_unlock (&global_signal_mutex);
+}
+
+static int
+mono_w32handle_timedwait_signal (guint32 timeout, gboolean poll, gboolean *alerted)
+{
+       int res;
+
+       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_W32HANDLE, "%s: waiting for global", __func__);
+
+       if (alerted)
+               *alerted = FALSE;
+
+       if (alerted) {
+               mono_thread_info_install_interrupt (signal_global, NULL, alerted);
+               if (*alerted)
+                       return 0;
+       }
+
+       res = mono_w32handle_timedwait_signal_naked (&global_signal_cond, &global_signal_mutex, timeout, poll, alerted);
+
+       if (alerted)
+               mono_thread_info_uninstall_interrupt (alerted);
+
+       return res;
+}
+
+static void
+signal_handle_and_unref (gpointer handle)
+{
+       MonoW32HandleBase *handle_data;
+       mono_cond_t *cond;
+       mono_mutex_t *mutex;
+
+       if (!mono_w32handle_lookup_data (handle, &handle_data))
+               g_error ("cannot signal unknown handle %p", handle);
+
+       /* If we reach here, then interrupt token is set to the flag value, which
+        * means that the target thread is either
+        * - before the first CAS in timedwait, which means it won't enter the wait.
+        * - it is after the first CAS, so it is already waiting, or it will enter
+        *    the wait, and it will be interrupted by the broadcast. */
+       cond = &handle_data->signal_cond;
+       mutex = &handle_data->signal_mutex;
+
+       mono_os_mutex_lock (mutex);
+       mono_os_cond_broadcast (cond);
+       mono_os_mutex_unlock (mutex);
+
+       mono_w32handle_unref (handle);
+}
+
+static int
+mono_w32handle_timedwait_signal_handle (gpointer handle, guint32 timeout, gboolean poll, gboolean *alerted)
+{
+       MonoW32HandleBase *handle_data;
+       int res;
+
+       if (!mono_w32handle_lookup_data (handle, &handle_data))
+               g_error ("cannot wait on unknown handle %p", handle);
+
+       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_W32HANDLE, "%s: waiting for %p (type %s)", __func__, handle,
+                  mono_w32handle_ops_typename (mono_w32handle_get_type (handle)));
+
+       if (alerted)
+               *alerted = FALSE;
+
+       if (alerted) {
+               mono_thread_info_install_interrupt (signal_handle_and_unref, handle, alerted);
+               if (*alerted)
+                       return 0;
+               mono_w32handle_ref (handle);
+       }
+
+       res = mono_w32handle_timedwait_signal_naked (&handle_data->signal_cond, &handle_data->signal_mutex, timeout, poll, alerted);
+
+       if (alerted) {
+               mono_thread_info_uninstall_interrupt (alerted);
+               if (!*alerted) {
+                       /* if it is alerted, then the handle is unref in the interrupt callback */
+                       mono_w32handle_unref (handle);
+               }
+       }
+
+       return res;
+}
+
+static gboolean
+dump_callback (gpointer handle, gpointer handle_specific, gpointer user_data)
+{
+       MonoW32HandleBase *handle_data;
+
+       if (!mono_w32handle_lookup_data (handle, &handle_data))
+               g_error ("cannot dump unknown handle %p", handle);
+
+       g_print ("%p [%7s] signalled: %5s ref: %3d ",
+               handle, mono_w32handle_ops_typename (handle_data->type), handle_data->signalled ? "true" : "false", handle_data->ref);
+       mono_w32handle_ops_details (handle_data->type, handle_data->specific);
+       g_print ("\n");
+
+       return FALSE;
+}
+
+void mono_w32handle_dump (void)
+{
+       mono_w32handle_foreach (dump_callback, NULL);
+}
+
+static gboolean
+own_if_signalled (gpointer handle, guint32 *statuscode)
+{
+       if (!mono_w32handle_issignalled (handle))
+               return FALSE;
+
+       *statuscode = WAIT_OBJECT_0;
+       mono_w32handle_ops_own (handle, statuscode);
+       return TRUE;
+}
+
+static gboolean
+own_if_owned( gpointer handle, guint32 *statuscode)
+{
+       if (!mono_w32handle_ops_isowned (handle))
+               return FALSE;
+
+       *statuscode = WAIT_OBJECT_0;
+       mono_w32handle_ops_own (handle, statuscode);
+       return TRUE;
+}
+
+MonoW32HandleWaitRet
+mono_w32handle_wait_one (gpointer handle, guint32 timeout, gboolean alertable)
+{
+       MonoW32HandleWaitRet ret;
+       gboolean alerted;
+       gint64 start;
+       guint32 statuscode = 0;
+
+       alerted = FALSE;
+
+       if (mono_w32handle_test_capabilities (handle, MONO_W32HANDLE_CAP_SPECIAL_WAIT)) {
+               mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_W32HANDLE, "%s: handle %p has special wait",
+                       __func__, handle);
+
+               return mono_w32handle_ops_specialwait (handle, timeout, alertable ? &alerted : NULL);
+       }
+
+       if (!mono_w32handle_test_capabilities (handle, MONO_W32HANDLE_CAP_WAIT)) {
+               mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_W32HANDLE, "%s: handle %p can't be waited for",
+                       __func__, handle);
+
+               return MONO_W32HANDLE_WAIT_RET_FAILED;
+       }
+
+       mono_w32handle_lock_handle (handle);
+
+       if (mono_w32handle_test_capabilities (handle, MONO_W32HANDLE_CAP_OWN)) {
+               if (own_if_owned (handle, &statuscode)) {
+                       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_W32HANDLE, "%s: handle %p already owned",
+                               __func__, handle);
+
+                       ret = statuscode == WAIT_ABANDONED_0 ? MONO_W32HANDLE_WAIT_RET_ABANDONED_0 : MONO_W32HANDLE_WAIT_RET_SUCCESS_0;
+                       goto done;
+               }
+       }
+
+       if (timeout != INFINITE)
+               start = mono_msec_ticks ();
+
+       for (;;) {
+               gint waited;
+
+               if (own_if_signalled (handle, &statuscode)) {
+                       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_W32HANDLE, "%s: handle %p signalled",
+                               __func__, handle);
+
+                       ret = statuscode == WAIT_ABANDONED_0 ? MONO_W32HANDLE_WAIT_RET_ABANDONED_0 : MONO_W32HANDLE_WAIT_RET_SUCCESS_0;
+                       goto done;
+               }
+
+               mono_w32handle_ops_prewait (handle);
+
+               if (timeout == INFINITE) {
+                       waited = mono_w32handle_timedwait_signal_handle (handle, INFINITE, FALSE, alertable ? &alerted : NULL);
+               } else {
+                       gint64 elapsed;
+
+                       elapsed = mono_msec_ticks () - start;
+                       if (elapsed > timeout) {
+                               ret = MONO_W32HANDLE_WAIT_RET_TIMEOUT;
+                               goto done;
+                       }
+
+                       waited = mono_w32handle_timedwait_signal_handle (handle, timeout - elapsed, FALSE, alertable ? &alerted : NULL);
+               }
+
+               if (alerted) {
+                       ret = MONO_W32HANDLE_WAIT_RET_ALERTED;
+                       goto done;
+               }
+
+               if (waited != 0) {
+                       ret = MONO_W32HANDLE_WAIT_RET_TIMEOUT;
+                       goto done;
+               }
+       }
+
+done:
+       mono_w32handle_unlock_handle (handle);
+
+       return ret;
+}
+
+MonoW32HandleWaitRet
+mono_w32handle_wait_multiple (gpointer *handles, gsize nhandles, gboolean waitall, guint32 timeout, gboolean alertable)
+{
+       MonoW32HandleWaitRet ret;
+       gboolean alerted, poll;
+       gint i;
+       gint64 start;
+       gpointer handles_sorted [MONO_W32HANDLE_MAXIMUM_WAIT_OBJECTS];
+       guint32 statuscodes [MONO_W32HANDLE_MAXIMUM_WAIT_OBJECTS] = {0};
+
+       if (nhandles == 0)
+               return MONO_W32HANDLE_WAIT_RET_FAILED;
+
+       if (nhandles == 1)
+               return mono_w32handle_wait_one (handles [0], timeout, alertable);
+
+       alerted = FALSE;
+
+       if (nhandles > MONO_W32HANDLE_MAXIMUM_WAIT_OBJECTS) {
+               mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_W32HANDLE, "%s: too many handles: %zd",
+                       __func__, nhandles);
+
+               return MONO_W32HANDLE_WAIT_RET_FAILED;
+       }
+
+       for (i = 0; i < nhandles; ++i) {
+               if (!mono_w32handle_test_capabilities (handles[i], MONO_W32HANDLE_CAP_WAIT)
+                        && !mono_w32handle_test_capabilities (handles[i], MONO_W32HANDLE_CAP_SPECIAL_WAIT))
+               {
+                       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_W32HANDLE, "%s: handle %p can't be waited for",
+                                  __func__, handles [i]);
+
+                       return MONO_W32HANDLE_WAIT_RET_FAILED;
+               }
+
+               handles_sorted [i] = handles [i];
+       }
+
+       qsort (handles_sorted, nhandles, sizeof (gpointer), g_direct_equal);
+       for (i = 1; i < nhandles; ++i) {
+               if (handles_sorted [i - 1] == handles_sorted [i]) {
+                       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_W32HANDLE, "%s: handle %p is duplicated",
+                               __func__, handles_sorted [i]);
+
+                       return MONO_W32HANDLE_WAIT_RET_FAILED;
+               }
+       }
+
+       poll = FALSE;
+       for (i = 0; i < nhandles; ++i) {
+               if (mono_w32handle_get_type (handles [i]) == MONO_W32HANDLE_PROCESS) {
+                       /* Can't wait for a process handle + another handle without polling */
+                       poll = TRUE;
+               }
+       }
+
+       if (timeout != INFINITE)
+               start = mono_msec_ticks ();
+
+       for (i = 0; i < nhandles; ++i) {
+               /* Add a reference, as we need to ensure the handle wont
+                * disappear from under us while we're waiting in the loop
+                * (not lock, as we don't want exclusive access here) */
+               mono_w32handle_ref (handles [i]);
+       }
+
+       for (;;) {
+               gsize count, lowest;
+               gboolean signalled;
+               gint waited;
+
+               count = 0;
+               lowest = nhandles;
+
+               mono_w32handle_lock_handles (handles, nhandles);
+
+               for (i = 0; i < nhandles; i++) {
+                       if ((mono_w32handle_test_capabilities (handles [i], MONO_W32HANDLE_CAP_OWN) && mono_w32handle_ops_isowned (handles [i]))
+                                || mono_w32handle_issignalled (handles [i]))
+                       {
+                               count ++;
+
+                               if (i < lowest)
+                                       lowest = i;
+                       }
+               }
+
+               signalled = (waitall && count == nhandles) || (!waitall && count > 0);
+
+               if (signalled) {
+                       for (i = 0; i < nhandles; i++)
+                               own_if_signalled (handles [i], &statuscodes [i]);
+               }
+
+               mono_w32handle_unlock_handles (handles, nhandles);
+
+               if (signalled) {
+                       ret = MONO_W32HANDLE_WAIT_RET_SUCCESS_0 + lowest;
+                       for (i = lowest; i < nhandles; i++) {
+                               if (statuscodes [i] == WAIT_ABANDONED_0) {
+                                       ret = MONO_W32HANDLE_WAIT_RET_ABANDONED_0 + lowest;
+                                       break;
+                               }
+                       }
+                       goto done;
+               }
+
+               for (i = 0; i < nhandles; i++) {
+                       mono_w32handle_ops_prewait (handles[i]);
+
+                       if (mono_w32handle_test_capabilities (handles [i], MONO_W32HANDLE_CAP_SPECIAL_WAIT)
+                                && !mono_w32handle_issignalled (handles [i]))
+                       {
+                               mono_w32handle_ops_specialwait (handles [i], 0, alertable ? &alerted : NULL);
+                       }
+               }
+
+               mono_w32handle_lock_signal_mutex ();
+
+               if (waitall) {
+                       signalled = TRUE;
+                       for (i = 0; i < nhandles; ++i) {
+                               if (!mono_w32handle_issignalled (handles [i])) {
+                                       signalled = FALSE;
+                                       break;
+                               }
+                       }
+               } else {
+                       signalled = FALSE;
+                       for (i = 0; i < nhandles; ++i) {
+                               if (mono_w32handle_issignalled (handles [i])) {
+                                       signalled = TRUE;
+                                       break;
+                               }
+                       }
+               }
+
+               waited = 0;
+
+               if (!signalled) {
+                       if (timeout == INFINITE) {
+                               waited = mono_w32handle_timedwait_signal (INFINITE, poll, alertable ? &alerted : NULL);
+                       } else {
+                               gint64 elapsed;
+
+                               elapsed = mono_msec_ticks () - start;
+                               if (elapsed > timeout) {
+                                       ret = MONO_W32HANDLE_WAIT_RET_TIMEOUT;
+
+                                       mono_w32handle_unlock_signal_mutex ();
+
+                                       goto done;
+                               }
+
+                               waited = mono_w32handle_timedwait_signal (timeout - elapsed, poll, alertable ? &alerted : NULL);
+                       }
+               }
+
+               mono_w32handle_unlock_signal_mutex ();
+
+               if (alerted) {
+                       ret = MONO_W32HANDLE_WAIT_RET_ALERTED;
+                       goto done;
+               }
+
+               if (waited != 0) {
+                       ret = MONO_W32HANDLE_WAIT_RET_TIMEOUT;
+                       goto done;
+               }
+       }
+
+done:
+       for (i = 0; i < nhandles; i++) {
+               /* Unref everything we reffed above */
+               mono_w32handle_unref (handles [i]);
+       }
+
+       return ret;
+}
+
+MonoW32HandleWaitRet
+mono_w32handle_signal_and_wait (gpointer signal_handle, gpointer wait_handle, guint32 timeout, gboolean alertable)
+{
+       MonoW32HandleWaitRet ret;
+       gint64 start;
+       gboolean alerted;
+       guint32 statuscode = 0;
+       gpointer handles [2];
+
+       alerted = FALSE;
+
+       if (!mono_w32handle_test_capabilities (signal_handle, MONO_W32HANDLE_CAP_SIGNAL))
+               return MONO_W32HANDLE_WAIT_RET_FAILED;
+       if (!mono_w32handle_test_capabilities (wait_handle, MONO_W32HANDLE_CAP_WAIT))
+               return MONO_W32HANDLE_WAIT_RET_FAILED;
+
+       if (mono_w32handle_test_capabilities (wait_handle, MONO_W32HANDLE_CAP_SPECIAL_WAIT)) {
+               g_warning ("%s: handle %p has special wait, implement me!!", __func__, wait_handle);
+               return MONO_W32HANDLE_WAIT_RET_FAILED;
+       }
+
+       handles [0] = wait_handle;
+       handles [1] = signal_handle;
+
+       mono_w32handle_lock_handles (handles, 2);
+
+       mono_w32handle_ops_signal (signal_handle);
+
+       mono_w32handle_unlock_handle (signal_handle);
+
+       if (mono_w32handle_test_capabilities (wait_handle, MONO_W32HANDLE_CAP_OWN)) {
+               if (own_if_owned (wait_handle, &statuscode)) {
+                       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_W32HANDLE, "%s: handle %p already owned",
+                               __func__, wait_handle);
+
+                       ret = statuscode == WAIT_ABANDONED_0 ? MONO_W32HANDLE_WAIT_RET_ABANDONED_0 : MONO_W32HANDLE_WAIT_RET_SUCCESS_0;
+                       goto done;
+               }
+       }
+
+       if (timeout != INFINITE)
+               start = mono_msec_ticks ();
+
+       for (;;) {
+               gint waited;
+
+               if (own_if_signalled (wait_handle, &statuscode)) {
+                       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_W32HANDLE, "%s: handle %p signalled",
+                               __func__, wait_handle);
+
+                       ret = statuscode == WAIT_ABANDONED_0 ? MONO_W32HANDLE_WAIT_RET_ABANDONED_0 : MONO_W32HANDLE_WAIT_RET_SUCCESS_0;
+                       goto done;
+               }
+
+               mono_w32handle_ops_prewait (wait_handle);
+
+               if (timeout == INFINITE) {
+                       waited = mono_w32handle_timedwait_signal_handle (wait_handle, INFINITE, FALSE, alertable ? &alerted : NULL);
+               } else {
+                       gint64 elapsed;
+
+                       elapsed = mono_msec_ticks () - start;
+                       if (elapsed > timeout) {
+                               ret = MONO_W32HANDLE_WAIT_RET_TIMEOUT;
+                               goto done;
+                       }
+
+                       waited = mono_w32handle_timedwait_signal_handle (wait_handle, timeout - elapsed, FALSE, alertable ? &alerted : NULL);
+               }
+
+               if (alerted) {
+                       ret = MONO_W32HANDLE_WAIT_RET_ALERTED;
+                       goto done;
+               }
+
+               if (waited != 0) {
+                       ret = MONO_W32HANDLE_WAIT_RET_TIMEOUT;
+                       goto done;
+               }
+       }
+
+done:
+       mono_w32handle_unlock_handle (wait_handle);
+
+       return ret;
+}
diff --git a/mono/metadata/w32handle.h b/mono/metadata/w32handle.h
new file mode 100644 (file)
index 0000000..ce7d76e
--- /dev/null
@@ -0,0 +1,162 @@
+
+#ifndef _MONO_METADATA_W32HANDLE_H_
+#define _MONO_METADATA_W32HANDLE_H_
+
+#include <config.h>
+#include <glib.h>
+
+#ifndef INVALID_HANDLE_VALUE
+#define INVALID_HANDLE_VALUE (gpointer)-1
+#endif
+
+#define MONO_W32HANDLE_MAXIMUM_WAIT_OBJECTS 64
+
+typedef enum {
+       MONO_W32HANDLE_UNUSED = 0,
+       MONO_W32HANDLE_FILE,
+       MONO_W32HANDLE_CONSOLE,
+       MONO_W32HANDLE_THREAD,
+       MONO_W32HANDLE_SEM,
+       MONO_W32HANDLE_MUTEX,
+       MONO_W32HANDLE_EVENT,
+       MONO_W32HANDLE_SOCKET,
+       MONO_W32HANDLE_FIND,
+       MONO_W32HANDLE_PROCESS,
+       MONO_W32HANDLE_PIPE,
+       MONO_W32HANDLE_NAMEDMUTEX,
+       MONO_W32HANDLE_NAMEDSEM,
+       MONO_W32HANDLE_NAMEDEVENT,
+       MONO_W32HANDLE_COUNT
+} MonoW32HandleType;
+
+typedef enum {
+       MONO_W32HANDLE_WAIT_RET_SUCCESS_0   =  0,
+       MONO_W32HANDLE_WAIT_RET_ABANDONED_0 =  MONO_W32HANDLE_WAIT_RET_SUCCESS_0 + MONO_W32HANDLE_MAXIMUM_WAIT_OBJECTS,
+       MONO_W32HANDLE_WAIT_RET_ALERTED     = -1,
+       MONO_W32HANDLE_WAIT_RET_TIMEOUT     = -2,
+       MONO_W32HANDLE_WAIT_RET_FAILED      = -3,
+} MonoW32HandleWaitRet;
+
+typedef struct 
+{
+       void (*close)(gpointer handle, gpointer data);
+
+       /* SignalObjectAndWait */
+       void (*signal)(gpointer signal);
+
+       /* Called by WaitForSingleObject and WaitForMultipleObjects,
+        * with the handle locked (shared handles aren't locked.)
+        * Returns TRUE if ownership was established, false otherwise.
+        * If TRUE, *statuscode contains a status code such as
+        * WAIT_OBJECT_0 or WAIT_ABANDONED_0.
+        */
+       gboolean (*own_handle)(gpointer handle, guint32 *statuscode);
+
+       /* Called by WaitForSingleObject and WaitForMultipleObjects, if the
+        * handle in question is "ownable" (ie mutexes), to see if the current
+        * thread already owns this handle
+        */
+       gboolean (*is_owned)(gpointer handle);
+
+       /* Called by WaitForSingleObject and WaitForMultipleObjects,
+        * if the handle in question needs a special wait function
+        * instead of using the normal handle signal mechanism.
+        * Returns the WaitForSingleObject return code.
+        */
+       MonoW32HandleWaitRet (*special_wait)(gpointer handle, guint32 timeout, gboolean *alerted);
+
+       /* Called by WaitForSingleObject and WaitForMultipleObjects,
+        * if the handle in question needs some preprocessing before the
+        * signal wait.
+        */
+       void (*prewait)(gpointer handle);
+
+       /* Called when dumping the handles */
+       void (*details)(gpointer data);
+
+       /* Called to get the name of the handle type */
+       const gchar* (*typename) (void);
+
+       /* Called to get the size of the handle type */
+       gsize (*typesize) (void);
+} MonoW32HandleOps;
+
+typedef enum {
+       MONO_W32HANDLE_CAP_WAIT         = 0x01,
+       MONO_W32HANDLE_CAP_SIGNAL       = 0x02,
+       MONO_W32HANDLE_CAP_OWN          = 0x04,
+       MONO_W32HANDLE_CAP_SPECIAL_WAIT = 0x08,
+} MonoW32HandleCapability;
+
+extern guint32 mono_w32handle_fd_reserve;
+
+void
+mono_w32handle_init (void);
+
+void
+mono_w32handle_cleanup (void);
+
+void
+mono_w32handle_register_ops (MonoW32HandleType type, MonoW32HandleOps *ops);
+
+gpointer
+mono_w32handle_new (MonoW32HandleType type, gpointer handle_specific);
+
+gpointer
+mono_w32handle_new_fd (MonoW32HandleType type, int fd, gpointer handle_specific);
+
+MonoW32HandleType
+mono_w32handle_get_type (gpointer handle);
+
+const gchar*
+mono_w32handle_get_typename (MonoW32HandleType type);
+
+gboolean
+mono_w32handle_lookup (gpointer handle, MonoW32HandleType type, gpointer *handle_specific);
+
+void
+mono_w32handle_foreach (gboolean (*on_each)(gpointer handle, gpointer data, gpointer user_data), gpointer user_data);
+
+void
+mono_w32handle_dump (void);
+
+void
+mono_w32handle_ref (gpointer handle);
+
+void
+mono_w32handle_unref (gpointer handle);
+
+void
+mono_w32handle_register_capabilities (MonoW32HandleType type, MonoW32HandleCapability caps);
+
+gboolean
+mono_w32handle_test_capabilities (gpointer handle, MonoW32HandleCapability caps);
+
+void
+mono_w32handle_force_close (gpointer handle, gpointer data);
+
+void
+mono_w32handle_set_signal_state (gpointer handle, gboolean state, gboolean broadcast);
+
+gboolean
+mono_w32handle_issignalled (gpointer handle);
+
+void
+mono_w32handle_lock_handle (gpointer handle);
+
+gboolean
+mono_w32handle_trylock_handle (gpointer handle);
+
+void
+mono_w32handle_unlock_handle (gpointer handle);
+
+MonoW32HandleWaitRet
+mono_w32handle_wait_one (gpointer handle, guint32 timeout, gboolean alertable);
+
+MonoW32HandleWaitRet
+mono_w32handle_wait_multiple (gpointer *handles, gsize nhandles, gboolean waitall, guint32 timeout, gboolean alertable);
+
+MonoW32HandleWaitRet
+mono_w32handle_signal_and_wait (gpointer signal_handle, gpointer wait_handle, guint32 timeout, gboolean alertable);
+
+#endif /* _MONO_METADATA_W32HANDLE_H_ */
diff --git a/mono/metadata/w32mutex-unix.c b/mono/metadata/w32mutex-unix.c
new file mode 100644 (file)
index 0000000..d27fd5b
--- /dev/null
@@ -0,0 +1,538 @@
+/*
+ * w32mutex-unix.c: Runtime support for managed Mutex on Unix
+ *
+ * Author:
+ *     Ludovic Henry (luhenry@microsoft.com)
+ *
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
+ */
+
+#include "w32mutex.h"
+
+#include <pthread.h>
+
+#include "w32handle-namespace.h"
+#include "mono/io-layer/io-layer.h"
+#include "mono/metadata/object-internals.h"
+#include "mono/utils/mono-logger-internals.h"
+#include "mono/utils/mono-threads.h"
+#include "mono/metadata/w32handle.h"
+
+typedef struct {
+       MonoNativeThreadId tid;
+       guint32 recursion;
+       gboolean abandoned;
+} MonoW32HandleMutex;
+
+struct MonoW32HandleNamedMutex {
+       MonoW32HandleMutex m;
+       MonoW32HandleNamespace sharedns;
+};
+
+static void
+thread_own_mutex (MonoInternalThread *internal, gpointer handle)
+{
+       mono_w32handle_ref (handle);
+
+       /* if we are not on the current thread, there is a
+        * race condition when allocating internal->owned_mutexes */
+       g_assert (mono_thread_internal_is_current (internal));
+
+       if (!internal->owned_mutexes)
+               internal->owned_mutexes = g_ptr_array_new ();
+
+       g_ptr_array_add (internal->owned_mutexes, handle);
+}
+
+static void
+thread_disown_mutex (MonoInternalThread *internal, gpointer handle)
+{
+       gboolean removed;
+
+       g_assert (mono_thread_internal_is_current (internal));
+
+       g_assert (internal->owned_mutexes);
+       removed = g_ptr_array_remove (internal->owned_mutexes, handle);
+       g_assert (removed);
+
+       mono_w32handle_unref (handle);
+}
+
+static gboolean
+mutex_handle_own (gpointer handle, MonoW32HandleType type, guint32 *statuscode)
+{
+       MonoW32HandleMutex *mutex_handle;
+
+       *statuscode = WAIT_OBJECT_0;
+
+       if (!mono_w32handle_lookup (handle, type, (gpointer *)&mutex_handle)) {
+               g_warning ("%s: error looking up %s handle %p", __func__, mono_w32handle_get_typename (type), handle);
+               return FALSE;
+       }
+
+       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: owning %s handle %p, before: [tid: %p, recursion: %d], after: [tid: %p, recursion: %d], abandoned: %s",
+               __func__, mono_w32handle_get_typename (type), handle, (gpointer) mutex_handle->tid, mutex_handle->recursion, (gpointer) pthread_self (), mutex_handle->recursion + 1, mutex_handle->abandoned ? "true" : "false");
+
+       if (mutex_handle->recursion != 0) {
+               g_assert (pthread_equal (pthread_self (), mutex_handle->tid));
+               mutex_handle->recursion++;
+       } else {
+               mutex_handle->tid = pthread_self ();
+               mutex_handle->recursion = 1;
+
+               thread_own_mutex (mono_thread_internal_current (), handle);
+       }
+
+       if (mutex_handle->abandoned) {
+               mutex_handle->abandoned = FALSE;
+               *statuscode = WAIT_ABANDONED_0;
+       }
+
+       mono_w32handle_set_signal_state (handle, FALSE, FALSE);
+
+       return TRUE;
+}
+
+static gboolean
+mutex_handle_is_owned (gpointer handle, MonoW32HandleType type)
+{
+       MonoW32HandleMutex *mutex_handle;
+
+       if (!mono_w32handle_lookup (handle, type, (gpointer *)&mutex_handle)) {
+               g_warning ("%s: error looking up %s handle %p", __func__, mono_w32handle_get_typename (type), handle);
+               return FALSE;
+       }
+
+       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: testing ownership %s handle %p",
+               __func__, mono_w32handle_get_typename (type), handle);
+
+       if (mutex_handle->recursion > 0 && pthread_equal (mutex_handle->tid, pthread_self ())) {
+               mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: %s handle %p owned by %p",
+                       __func__, mono_w32handle_get_typename (type), handle, (gpointer) pthread_self ());
+               return TRUE;
+       } else {
+               mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: %s handle %p not owned by %p, tid: %p recursion: %d",
+                       __func__, mono_w32handle_get_typename (type), handle, (gpointer) pthread_self (), (gpointer) mutex_handle->tid, mutex_handle->recursion);
+               return FALSE;
+       }
+}
+
+static void mutex_signal(gpointer handle)
+{
+       ves_icall_System_Threading_Mutex_ReleaseMutex_internal (handle);
+}
+
+static gboolean mutex_own (gpointer handle, guint32 *statuscode)
+{
+       return mutex_handle_own (handle, MONO_W32HANDLE_MUTEX, statuscode);
+}
+
+static gboolean mutex_is_owned (gpointer handle)
+{
+       
+       return mutex_handle_is_owned (handle, MONO_W32HANDLE_MUTEX);
+}
+
+static void namedmutex_signal (gpointer handle)
+{
+       ves_icall_System_Threading_Mutex_ReleaseMutex_internal (handle);
+}
+
+/* NB, always called with the shared handle lock held */
+static gboolean namedmutex_own (gpointer handle, guint32 *statuscode)
+{
+       return mutex_handle_own (handle, MONO_W32HANDLE_NAMEDMUTEX, statuscode);
+}
+
+static gboolean namedmutex_is_owned (gpointer handle)
+{
+       return mutex_handle_is_owned (handle, MONO_W32HANDLE_NAMEDMUTEX);
+}
+
+static void mutex_handle_prewait (gpointer handle, MonoW32HandleType type)
+{
+       /* If the mutex is not currently owned, do nothing and let the
+        * usual wait carry on.  If it is owned, check that the owner
+        * is still alive; if it isn't we override the previous owner
+        * and assume that process exited abnormally and failed to
+        * clean up.
+        */
+       MonoW32HandleMutex *mutex_handle;
+
+       if (!mono_w32handle_lookup (handle, type, (gpointer *)&mutex_handle)) {
+               g_warning ("%s: error looking up %s handle %p",
+                       __func__, mono_w32handle_get_typename (type), handle);
+               return;
+       }
+
+       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: pre-waiting %s handle %p, owned? %s",
+               __func__, mono_w32handle_get_typename (type), handle, mutex_handle->recursion != 0 ? "true" : "false");
+}
+
+/* The shared state is not locked when prewait methods are called */
+static void mutex_prewait (gpointer handle)
+{
+       mutex_handle_prewait (handle, MONO_W32HANDLE_MUTEX);
+}
+
+/* The shared state is not locked when prewait methods are called */
+static void namedmutex_prewait (gpointer handle)
+{
+       mutex_handle_prewait (handle, MONO_W32HANDLE_NAMEDMUTEX);
+}
+
+static void mutex_details (gpointer data)
+{
+       MonoW32HandleMutex *mut = (MonoW32HandleMutex *)data;
+       
+#ifdef PTHREAD_POINTER_ID
+       g_print ("own: %5p, count: %5u", mut->tid, mut->recursion);
+#else
+       g_print ("own: %5ld, count: %5u", mut->tid, mut->recursion);
+#endif
+}
+
+static void namedmutex_details (gpointer data)
+{
+       MonoW32HandleNamedMutex *namedmut = (MonoW32HandleNamedMutex *)data;
+       
+#ifdef PTHREAD_POINTER_ID
+       g_print ("own: %5p, count: %5u, name: \"%s\"",
+               namedmut->m.tid, namedmut->m.recursion, namedmut->sharedns.name);
+#else
+       g_print ("own: %5ld, count: %5u, name: \"%s\"",
+               namedmut->m.tid, namedmut->m.recursion, namedmut->sharedns.name);
+#endif
+}
+
+static const gchar* mutex_typename (void)
+{
+       return "Mutex";
+}
+
+static gsize mutex_typesize (void)
+{
+       return sizeof (MonoW32HandleMutex);
+}
+
+static const gchar* namedmutex_typename (void)
+{
+       return "N.Mutex";
+}
+
+static gsize namedmutex_typesize (void)
+{
+       return sizeof (MonoW32HandleNamedMutex);
+}
+
+void
+mono_w32mutex_init (void)
+{
+       static MonoW32HandleOps mutex_ops = {
+               NULL,                   /* close */
+               mutex_signal,           /* signal */
+               mutex_own,              /* own */
+               mutex_is_owned,         /* is_owned */
+               NULL,                   /* special_wait */
+               mutex_prewait,                  /* prewait */
+               mutex_details,  /* details */
+               mutex_typename, /* typename */
+               mutex_typesize, /* typesize */
+       };
+
+       static MonoW32HandleOps namedmutex_ops = {
+               NULL,                   /* close */
+               namedmutex_signal,      /* signal */
+               namedmutex_own,         /* own */
+               namedmutex_is_owned,    /* is_owned */
+               NULL,                   /* special_wait */
+               namedmutex_prewait,     /* prewait */
+               namedmutex_details,     /* details */
+               namedmutex_typename,    /* typename */
+               namedmutex_typesize,    /* typesize */
+       };
+
+       mono_w32handle_register_ops (MONO_W32HANDLE_MUTEX,      &mutex_ops);
+       mono_w32handle_register_ops (MONO_W32HANDLE_NAMEDMUTEX, &namedmutex_ops);
+
+       mono_w32handle_register_capabilities (MONO_W32HANDLE_MUTEX,
+               (MonoW32HandleCapability)(MONO_W32HANDLE_CAP_WAIT | MONO_W32HANDLE_CAP_SIGNAL | MONO_W32HANDLE_CAP_OWN));
+       mono_w32handle_register_capabilities (MONO_W32HANDLE_NAMEDMUTEX,
+               (MonoW32HandleCapability)(MONO_W32HANDLE_CAP_WAIT | MONO_W32HANDLE_CAP_SIGNAL | MONO_W32HANDLE_CAP_OWN));
+}
+
+static gpointer mutex_handle_create (MonoW32HandleMutex *mutex_handle, MonoW32HandleType type, gboolean owned)
+{
+       gpointer handle;
+       guint32 statuscode;
+
+       mutex_handle->tid = 0;
+       mutex_handle->recursion = 0;
+       mutex_handle->abandoned = FALSE;
+
+       handle = mono_w32handle_new (type, mutex_handle);
+       if (handle == INVALID_HANDLE_VALUE) {
+               g_warning ("%s: error creating %s handle",
+                       __func__, mono_w32handle_get_typename (type));
+               SetLastError (ERROR_GEN_FAILURE);
+               return NULL;
+       }
+
+       mono_w32handle_lock_handle (handle);
+
+       if (owned)
+               mutex_handle_own (handle, type, &statuscode);
+       else
+               mono_w32handle_set_signal_state (handle, TRUE, FALSE);
+
+       mono_w32handle_unlock_handle (handle);
+
+       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: created %s handle %p",
+               __func__, mono_w32handle_get_typename (type), handle);
+
+       return handle;
+}
+
+static gpointer mutex_create (gboolean owned)
+{
+       MonoW32HandleMutex mutex_handle;
+       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: creating %s handle",
+               __func__, mono_w32handle_get_typename (MONO_W32HANDLE_MUTEX));
+       return mutex_handle_create (&mutex_handle, MONO_W32HANDLE_MUTEX, owned);
+}
+
+static gpointer namedmutex_create (gboolean owned, const gunichar2 *name)
+{
+       gpointer handle;
+       gchar *utf8_name;
+
+       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: creating %s handle",
+               __func__, mono_w32handle_get_typename (MONO_W32HANDLE_NAMEDMUTEX));
+
+       /* w32 seems to guarantee that opening named objects can't race each other */
+       mono_w32handle_namespace_lock ();
+
+       utf8_name = g_utf16_to_utf8 (name, -1, NULL, NULL, NULL);
+
+       handle = mono_w32handle_namespace_search_handle (MONO_W32HANDLE_NAMEDMUTEX, utf8_name);
+       if (handle == INVALID_HANDLE_VALUE) {
+               /* The name has already been used for a different object. */
+               handle = NULL;
+               SetLastError (ERROR_INVALID_HANDLE);
+       } else if (handle) {
+               /* Not an error, but this is how the caller is informed that the mutex wasn't freshly created */
+               SetLastError (ERROR_ALREADY_EXISTS);
+
+               /* mono_w32handle_namespace_search_handle already adds a ref to the handle */
+       } else {
+               /* A new named mutex */
+               MonoW32HandleNamedMutex namedmutex_handle;
+
+               strncpy (&namedmutex_handle.sharedns.name [0], utf8_name, MAX_PATH);
+               namedmutex_handle.sharedns.name [MAX_PATH] = '\0';
+
+               handle = mutex_handle_create ((MonoW32HandleMutex*) &namedmutex_handle, MONO_W32HANDLE_NAMEDMUTEX, owned);
+       }
+
+       g_free (utf8_name);
+
+       mono_w32handle_namespace_unlock ();
+
+       return handle;
+}
+
+gpointer
+ves_icall_System_Threading_Mutex_CreateMutex_internal (MonoBoolean owned, MonoString *name, MonoBoolean *created)
+{
+       gpointer mutex;
+
+       *created = TRUE;
+
+       /* Need to blow away any old errors here, because code tests
+        * for ERROR_ALREADY_EXISTS on success (!) to see if a mutex
+        * was freshly created */
+       SetLastError (ERROR_SUCCESS);
+
+       if (!name) {
+               mutex = mutex_create (owned);
+       } else {
+               mutex = namedmutex_create (owned, mono_string_chars (name));
+
+               if (GetLastError () == ERROR_ALREADY_EXISTS)
+                       *created = FALSE;
+       }
+
+       return mutex;
+}
+
+MonoBoolean
+ves_icall_System_Threading_Mutex_ReleaseMutex_internal (gpointer handle)
+{
+       MonoW32HandleType type;
+       MonoW32HandleMutex *mutex_handle;
+       pthread_t tid;
+       gboolean ret;
+
+       if (handle == NULL) {
+               SetLastError (ERROR_INVALID_HANDLE);
+               return FALSE;
+       }
+
+       switch (type = mono_w32handle_get_type (handle)) {
+       case MONO_W32HANDLE_MUTEX:
+       case MONO_W32HANDLE_NAMEDMUTEX:
+               break;
+       default:
+               SetLastError (ERROR_INVALID_HANDLE);
+               return FALSE;
+       }
+
+       if (!mono_w32handle_lookup (handle, type, (gpointer *)&mutex_handle)) {
+               g_warning ("%s: error looking up %s handle %p",
+                       __func__, mono_w32handle_get_typename (type), handle);
+               return FALSE;
+       }
+
+       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: releasing %s handle %p, tid: %p recursion: %d",
+               __func__, mono_w32handle_get_typename (type), handle, (gpointer) mutex_handle->tid, mutex_handle->recursion);
+
+       mono_w32handle_lock_handle (handle);
+
+       tid = pthread_self ();
+
+       if (mutex_handle->abandoned) {
+               // The Win32 ReleaseMutex() function returns TRUE for abandoned mutexes
+               ret = TRUE;
+       } else if (!pthread_equal (mutex_handle->tid, tid)) {
+               ret = FALSE;
+
+               mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: we don't own %s handle %p (owned by %ld, me %ld)",
+                           __func__, mono_w32handle_get_typename (type), handle, (long)mutex_handle->tid, (long)tid);
+       } else {
+               ret = TRUE;
+
+               /* OK, we own this mutex */
+               mutex_handle->recursion--;
+
+               if (mutex_handle->recursion == 0) {
+                       thread_disown_mutex (mono_thread_internal_current (), handle);
+
+                       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: unlocking %s handle %p, tid: %p recusion : %d",
+                               __func__, mono_w32handle_get_typename (type), handle, (gpointer) mutex_handle->tid, mutex_handle->recursion);
+
+                       mutex_handle->tid = 0;
+                       mono_w32handle_set_signal_state (handle, TRUE, FALSE);
+               }
+       }
+
+       mono_w32handle_unlock_handle (handle);
+
+       return ret;
+}
+
+gpointer
+ves_icall_System_Threading_Mutex_OpenMutex_internal (MonoString *name, gint32 rights G_GNUC_UNUSED, gint32 *error)
+{
+       gpointer handle;
+       gchar *utf8_name;
+
+       *error = ERROR_SUCCESS;
+
+       /* w32 seems to guarantee that opening named objects can't race each other */
+       mono_w32handle_namespace_lock ();
+
+       utf8_name = g_utf16_to_utf8 (mono_string_chars (name), -1, NULL, NULL, NULL);
+
+       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Opening named mutex [%s]",
+               __func__, utf8_name);
+
+       handle = mono_w32handle_namespace_search_handle (MONO_W32HANDLE_NAMEDMUTEX, utf8_name);
+       if (handle == INVALID_HANDLE_VALUE) {
+               /* The name has already been used for a different object. */
+               *error = ERROR_INVALID_HANDLE;
+               goto cleanup;
+       } else if (!handle) {
+               /* This name doesn't exist */
+               *error = ERROR_FILE_NOT_FOUND;
+               goto cleanup;
+       }
+
+       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: returning named mutex handle %p",
+               __func__, handle);
+
+cleanup:
+       g_free (utf8_name);
+
+       mono_w32handle_namespace_unlock ();
+
+       return handle;
+}
+
+void
+mono_w32mutex_abandon (void)
+{
+       MonoInternalThread *internal;
+
+       g_assert (mono_thread_internal_current_is_attached ());
+
+       internal = mono_thread_internal_current ();
+       g_assert (internal);
+
+       if (!internal->owned_mutexes)
+               return;
+
+       while (internal->owned_mutexes->len) {
+               MonoW32HandleType type;
+               MonoW32HandleMutex *mutex_handle;
+               MonoNativeThreadId tid;
+               gpointer handle;
+
+               handle = g_ptr_array_index (internal->owned_mutexes, 0);
+
+               switch (type = mono_w32handle_get_type (handle)) {
+               case MONO_W32HANDLE_MUTEX:
+               case MONO_W32HANDLE_NAMEDMUTEX:
+                       break;
+               default:
+                       g_assert_not_reached ();
+               }
+
+               if (!mono_w32handle_lookup (handle, type, (gpointer *)&mutex_handle)) {
+                       g_error ("%s: error looking up %s handle %p",
+                               __func__, mono_w32handle_get_typename (type), handle);
+               }
+
+               mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: abandoning %s handle %p",
+                       __func__, mono_w32handle_get_typename (type), handle);
+
+               tid = MONO_UINT_TO_NATIVE_THREAD_ID (internal->tid);
+
+               if (!pthread_equal (mutex_handle->tid, tid))
+                       g_error ("%s: trying to release mutex %p acquired by thread %p from thread %p",
+                               __func__, handle, (gpointer) mutex_handle->tid, (gpointer) tid);
+
+               mono_w32handle_lock_handle (handle);
+
+               mutex_handle->recursion = 0;
+               mutex_handle->tid = 0;
+               mutex_handle->abandoned = TRUE;
+
+               mono_w32handle_set_signal_state (handle, TRUE, FALSE);
+
+               thread_disown_mutex (internal, handle);
+
+               mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: abandoned %s handle %p",
+                       __func__, mono_w32handle_get_typename (type), handle);
+
+               mono_w32handle_unlock_handle (handle);
+       }
+
+       g_ptr_array_free (internal->owned_mutexes, TRUE);
+       internal->owned_mutexes = NULL;
+}
+
+MonoW32HandleNamespace*
+mono_w32mutex_get_namespace (MonoW32HandleNamedMutex *mutex)
+{
+       return &mutex->sharedns;
+}
diff --git a/mono/metadata/w32mutex-win32.c b/mono/metadata/w32mutex-win32.c
new file mode 100644 (file)
index 0000000..6f967e8
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ * w32mutex-win32.c: Runtime support for managed Mutex on Win32
+ *
+ * Author:
+ *     Ludovic Henry (luhenry@microsoft.com)
+ *
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
+ */
+
+#include "w32mutex.h"
+
+#include <windows.h>
+#include <winbase.h>
+
+void
+mono_w32mutex_init (void)
+{
+}
+
+gpointer
+ves_icall_System_Threading_Mutex_CreateMutex_internal (MonoBoolean owned, MonoString *name, MonoBoolean *created)
+{
+       HANDLE mutex;
+
+       *created = TRUE;
+
+       if (!name) {
+               mutex = CreateMutex (NULL, owned, NULL);
+       } else {
+               mutex = CreateMutex (NULL, owned, mono_string_chars (name));
+
+               if (GetLastError () == ERROR_ALREADY_EXISTS)
+                       *created = FALSE;
+       }
+
+       return mutex;
+}
+
+MonoBoolean
+ves_icall_System_Threading_Mutex_ReleaseMutex_internal (gpointer handle)
+{
+       return ReleaseMutex (handle);
+}
+
+gpointer
+ves_icall_System_Threading_Mutex_OpenMutex_internal (MonoString *name, gint32 rights, gint32 *error)
+{
+       HANDLE ret;
+
+       *error = ERROR_SUCCESS;
+
+       ret = OpenMutex (rights, FALSE, mono_string_chars (name));
+       if (!ret)
+               *error = GetLastError ();
+
+       return ret;
+}
diff --git a/mono/metadata/w32mutex.h b/mono/metadata/w32mutex.h
new file mode 100644 (file)
index 0000000..917b36f
--- /dev/null
@@ -0,0 +1,33 @@
+
+#ifndef _MONO_METADATA_W32MUTEX_H_
+#define _MONO_METADATA_W32MUTEX_H_
+
+#include <config.h>
+#include <glib.h>
+
+#include "object.h"
+#include "w32handle-namespace.h"
+
+void
+mono_w32mutex_init (void);
+
+gpointer
+ves_icall_System_Threading_Mutex_CreateMutex_internal (MonoBoolean owned, MonoString *name, MonoBoolean *created);
+
+MonoBoolean
+ves_icall_System_Threading_Mutex_ReleaseMutex_internal (gpointer handle);
+
+gpointer
+ves_icall_System_Threading_Mutex_OpenMutex_internal (MonoString *name, gint32 rights, gint32 *error);
+
+typedef struct MonoW32HandleNamedMutex MonoW32HandleNamedMutex;
+
+MonoW32HandleNamespace*
+mono_w32mutex_get_namespace (MonoW32HandleNamedMutex *mutex);
+
+#ifndef HOST_WIN32
+void
+mono_w32mutex_abandon (void);
+#endif
+
+#endif /* _MONO_METADATA_W32MUTEX_H_ */
diff --git a/mono/metadata/w32process-internals.h b/mono/metadata/w32process-internals.h
new file mode 100644 (file)
index 0000000..ad59f4c
--- /dev/null
@@ -0,0 +1,29 @@
+
+#ifndef _MONO_METADATA_W32PROCESS_INTERNALS_H_
+#define _MONO_METADATA_W32PROCESS_INTERNALS_H_
+
+#include <config.h>
+#include <glib.h>
+
+#include "io-layer/io-layer.h"
+
+#if !defined(HOST_WIN32)
+
+guint32
+mono_w32process_get_pid (gpointer handle);
+
+gboolean
+mono_w32process_try_get_modules (gpointer process, gpointer *modules, guint32 size, guint32 *needed);
+
+guint32
+mono_w32process_module_get_name (gpointer process, gpointer module, gunichar2 *basename, guint32 size);
+
+guint32
+mono_w32process_module_get_filename (gpointer process, gpointer module, gunichar2 *basename, guint32 size);
+
+gboolean
+mono_w32process_module_get_information (gpointer process, gpointer module, MODULEINFO *modinfo, guint32 size);
+
+#endif /* !defined(HOST_WIN32) */
+
+#endif /* _MONO_METADATA_W32PROCESS_INTERNALS_H_ */
diff --git a/mono/metadata/w32process-unix-bsd.c b/mono/metadata/w32process-unix-bsd.c
new file mode 100644 (file)
index 0000000..79655b9
--- /dev/null
@@ -0,0 +1,151 @@
+
+#include "w32process.h"
+#include "w32process-unix-internals.h"
+
+#ifdef USE_BSD_BACKEND
+
+#include <errno.h>
+#include <sys/proc.h>
+#include <sys/sysctl.h>
+#if !defined(__OpenBSD__)
+#include <sys/utsname.h>
+#endif
+#if defined(__FreeBSD__)
+#include <sys/user.h> /* struct kinfo_proc */
+#endif
+
+#include <link.h>
+
+#include "utils/mono-logger-internals.h"
+
+gchar*
+mono_w32process_get_name (pid_t pid)
+{
+       gint mib [6];
+       gsize size;
+       struct kinfo_proc *pi;
+       gchar *ret;
+
+#if defined(__FreeBSD__)
+       mib [0] = CTL_KERN;
+       mib [1] = KERN_PROC;
+       mib [2] = KERN_PROC_PID;
+       mib [3] = pid;
+       if (sysctl(mib, 4, NULL, &size, NULL, 0) < 0) {
+               mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: sysctl() failed: %d", __func__, errno);
+               return NULL;
+       }
+
+       if ((pi = g_malloc (size)) == NULL)
+               return NULL;
+
+       if (sysctl (mib, 4, pi, &size, NULL, 0) < 0) {
+               if (errno == ENOMEM) {
+                       g_free (pi);
+                       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Didn't allocate enough memory for kproc info", __func__);
+               }
+               return NULL;
+       }
+
+       ret = strlen (pi->ki_comm) > 0 ? g_strdup (pi->ki_comm) : NULL;
+
+       g_free (pi);
+#elif defined(__OpenBSD__)
+       mib [0] = CTL_KERN;
+       mib [1] = KERN_PROC;
+       mib [2] = KERN_PROC_PID;
+       mib [3] = pid;
+       mib [4] = sizeof(struct kinfo_proc);
+       mib [5] = 0;
+
+retry:
+       if (sysctl(mib, 6, NULL, &size, NULL, 0) < 0) {
+               mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: sysctl() failed: %d", __func__, errno);
+               return NULL;
+       }
+
+       if ((pi = g_malloc (size)) == NULL)
+               return NULL;
+
+       mib[5] = (int)(size / sizeof(struct kinfo_proc));
+
+       if ((sysctl (mib, 6, pi, &size, NULL, 0) < 0) ||
+               (size != sizeof (struct kinfo_proc))) {
+               if (errno == ENOMEM) {
+                       g_free (pi);
+                       goto retry;
+               }
+               return NULL;
+       }
+
+       ret = strlen (pi->p_comm) > 0 ? g_strdup (pi->p_comm) : NULL;
+
+       g_free (pi);
+#endif
+
+       return ret;
+}
+
+gchar*
+mono_w32process_get_path (pid_t pid)
+{
+       return mono_w32process_get_name (pid);
+}
+
+static gint
+mono_w32process_get_modules_callback (struct dl_phdr_info *info, gsize size, gpointer ptr)
+{
+       if (size < offsetof (struct dl_phdr_info, dlpi_phnum) + sizeof (info->dlpi_phnum))
+               return (-1);
+
+       struct dl_phdr_info *cpy = g_calloc (1, sizeof(struct dl_phdr_info));
+       if (!cpy)
+               return (-1);
+
+       memcpy(cpy, info, sizeof(*info));
+
+       g_ptr_array_add ((GPtrArray *)ptr, cpy);
+
+       return (0);
+}
+
+GSList*
+mono_w32process_get_modules (pid_t pid)
+{
+       GSList *ret = NULL;
+       MonoW32ProcessModule *mod;
+       GPtrArray *dlarray = g_ptr_array_new();
+       gint i;
+
+       if (dl_iterate_phdr (mono_w32process_get_modules_callback, dlarray) < 0)
+               return NULL;
+
+       for (i = 0; i < dlarray->len; i++) {
+               struct dl_phdr_info *info = g_ptr_array_index (dlarray, i);
+
+               mod = g_new0 (MonoW32ProcessModule, 1);
+               mod->address_start = (gpointer)(info->dlpi_addr + info->dlpi_phdr[0].p_vaddr);
+               mod->address_end = (gpointer)(info->dlpi_addr + info->dlpi_phdr[info->dlpi_phnum - 1].p_vaddr);
+               mod->perms = g_strdup ("r--p");
+               mod->address_offset = 0;
+               mod->inode = i;
+               mod->filename = g_strdup (info->dlpi_name);
+
+               mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: inode=%d, filename=%s, address_start=%p, address_end=%p",
+                       __func__, mod->inode, mod->filename, mod->address_start, mod->address_end);
+
+               g_free (info);
+
+               if (g_slist_find_custom (ret, mod, mono_w32process_module_equals) == NULL) {
+                       ret = g_slist_prepend (ret, mod);
+               } else {
+                       mono_w32process_module_free (mod);
+               }
+       }
+
+       g_ptr_array_free (dlarray, TRUE);
+
+       return g_slist_reverse (ret);
+}
+
+#endif
diff --git a/mono/metadata/w32process-unix-default.c b/mono/metadata/w32process-unix-default.c
new file mode 100644 (file)
index 0000000..0b48370
--- /dev/null
@@ -0,0 +1,256 @@
+
+#include "w32process.h"
+#include "w32process-unix-internals.h"
+
+#ifdef USE_DEFAULT_BACKEND
+
+#include <unistd.h>
+
+#ifdef PLATFORM_SOLARIS
+/* procfs.h cannot be included if this define is set, but it seems to work fine if it is undefined */
+#if _FILE_OFFSET_BITS == 64
+#undef _FILE_OFFSET_BITS
+#include <procfs.h>
+#define _FILE_OFFSET_BITS 64
+#else
+#include <procfs.h>
+#endif
+#endif
+
+#include "utils/mono-logger-internals.h"
+
+#ifndef MAXPATHLEN
+#define MAXPATHLEN 242
+#endif
+
+gchar*
+mono_w32process_get_name (pid_t pid)
+{
+       FILE *fp;
+       gchar *filename;
+       gchar buf[256];
+       gchar *ret = NULL;
+
+#if defined(PLATFORM_SOLARIS)
+       filename = g_strdup_printf ("/proc/%d/psinfo", pid);
+       if ((fp = fopen (filename, "r")) != NULL) {
+               struct psinfo info;
+               int nread;
+
+               nread = fread (&info, sizeof (info), 1, fp);
+               if (nread == 1) {
+                       ret = g_strdup (info.pr_fname);
+               }
+
+               fclose (fp);
+       }
+       g_free (filename);
+#else
+       memset (buf, '\0', sizeof(buf));
+       filename = g_strdup_printf ("/proc/%d/exe", pid);
+       if (readlink (filename, buf, 255) > 0) {
+               ret = g_strdup (buf);
+       }
+       g_free (filename);
+
+       if (ret != NULL) {
+               return(ret);
+       }
+
+       filename = g_strdup_printf ("/proc/%d/cmdline", pid);
+       if ((fp = fopen (filename, "r")) != NULL) {
+               if (fgets (buf, 256, fp) != NULL) {
+                       ret = g_strdup (buf);
+               }
+
+               fclose (fp);
+       }
+       g_free (filename);
+
+       if (ret != NULL) {
+               return(ret);
+       }
+
+       filename = g_strdup_printf ("/proc/%d/stat", pid);
+       if ((fp = fopen (filename, "r")) != NULL) {
+               if (fgets (buf, 256, fp) != NULL) {
+                       char *start, *end;
+
+                       start = strchr (buf, '(');
+                       if (start != NULL) {
+                               end = strchr (start + 1, ')');
+
+                               if (end != NULL) {
+                                       ret = g_strndup (start + 1,
+                                                        end - start - 1);
+                               }
+                       }
+               }
+
+               fclose (fp);
+       }
+       g_free (filename);
+#endif
+
+       return ret;
+}
+
+gchar*
+mono_w32process_get_path (pid_t pid)
+{
+       return mono_w32process_get_name (pid);
+}
+
+static FILE *
+open_process_map (int pid, const char *mode)
+{
+       gint i;
+       const gchar *proc_path[] = {
+               "/proc/%d/maps", /* GNU/Linux */
+               "/proc/%d/map",  /* FreeBSD */
+               NULL
+       };
+
+       for (i = 0; proc_path [i]; i++) {
+               gchar *filename;
+               FILE *fp;
+
+               filename = g_strdup_printf (proc_path[i], pid);
+               fp = fopen (filename, mode);
+               g_free (filename);
+
+               if (fp)
+                       return fp;
+       }
+
+       return NULL;
+}
+
+
+GSList*
+mono_w32process_get_modules (pid_t pid)
+{
+       GSList *ret = NULL;
+       FILE *fp;
+       MonoW32ProcessModule *mod;
+       gchar buf[MAXPATHLEN + 1], *p, *endp;
+       gchar *start_start, *end_start, *prot_start, *offset_start;
+       gchar *maj_dev_start, *min_dev_start, *inode_start, prot_buf[5];
+       gpointer address_start, address_end, address_offset;
+       guint32 maj_dev, min_dev;
+       guint64 inode;
+       guint64 device;
+
+       fp = open_process_map (pid, "r");
+       if (!fp)
+               return NULL;
+
+       while (fgets (buf, sizeof(buf), fp)) {
+               p = buf;
+               while (g_ascii_isspace (*p)) ++p;
+               start_start = p;
+               if (!g_ascii_isxdigit (*start_start)) {
+                       continue;
+               }
+               address_start = (gpointer)strtoul (start_start, &endp, 16);
+               p = endp;
+               if (*p != '-') {
+                       continue;
+               }
+
+               ++p;
+               end_start = p;
+               if (!g_ascii_isxdigit (*end_start)) {
+                       continue;
+               }
+               address_end = (gpointer)strtoul (end_start, &endp, 16);
+               p = endp;
+               if (!g_ascii_isspace (*p)) {
+                       continue;
+               }
+
+               while (g_ascii_isspace (*p)) ++p;
+               prot_start = p;
+               if (*prot_start != 'r' && *prot_start != '-') {
+                       continue;
+               }
+               memcpy (prot_buf, prot_start, 4);
+               prot_buf[4] = '\0';
+               while (!g_ascii_isspace (*p)) ++p;
+
+               while (g_ascii_isspace (*p)) ++p;
+               offset_start = p;
+               if (!g_ascii_isxdigit (*offset_start)) {
+                       continue;
+               }
+               address_offset = (gpointer)strtoul (offset_start, &endp, 16);
+               p = endp;
+               if (!g_ascii_isspace (*p)) {
+                       continue;
+               }
+
+               while(g_ascii_isspace (*p)) ++p;
+               maj_dev_start = p;
+               if (!g_ascii_isxdigit (*maj_dev_start)) {
+                       continue;
+               }
+               maj_dev = strtoul (maj_dev_start, &endp, 16);
+               p = endp;
+               if (*p != ':') {
+                       continue;
+               }
+
+               ++p;
+               min_dev_start = p;
+               if (!g_ascii_isxdigit (*min_dev_start)) {
+                       continue;
+               }
+               min_dev = strtoul (min_dev_start, &endp, 16);
+               p = endp;
+               if (!g_ascii_isspace (*p)) {
+                       continue;
+               }
+
+               while (g_ascii_isspace (*p)) ++p;
+               inode_start = p;
+               if (!g_ascii_isxdigit (*inode_start)) {
+                       continue;
+               }
+               inode = (guint64)strtol (inode_start, &endp, 10);
+               p = endp;
+               if (!g_ascii_isspace (*p)) {
+                       continue;
+               }
+
+               device = makedev ((int)maj_dev, (int)min_dev);
+               if ((device == 0) && (inode == 0)) {
+                       continue;
+               }
+
+               while(g_ascii_isspace (*p)) ++p;
+               /* p now points to the filename */
+
+               mod = g_new0 (MonoW32ProcessModule, 1);
+               mod->address_start = address_start;
+               mod->address_end = address_end;
+               mod->perms = g_strdup (prot_buf);
+               mod->address_offset = address_offset;
+               mod->device = device;
+               mod->inode = inode;
+               mod->filename = g_strdup (g_strstrip (p));
+
+               if (g_slist_find_custom (ret, mod, mono_w32process_module_equals) == NULL) {
+                       ret = g_slist_prepend (ret, mod);
+               } else {
+                       mono_w32process_module_free (mod);
+               }
+       }
+
+       ret = g_slist_reverse (ret);
+
+       fclose (fp);
+
+       return(ret);
+}
+
+#endif
diff --git a/mono/metadata/w32process-unix-haiku.c b/mono/metadata/w32process-unix-haiku.c
new file mode 100644 (file)
index 0000000..4311993
--- /dev/null
@@ -0,0 +1,56 @@
+
+#include "w32process.h"
+#include "w32process-unix-internals.h"
+
+#ifdef USE_HAIKU_BACKEND
+
+#include <KernelKit.h>
+
+gchar*
+mono_w32process_get_name (pid_t pid)
+{
+       image_info imageInfo;
+       int32 cookie = 0;
+
+       if (get_next_image_info ((team_id) pid, &cookie, &imageInfo) != B_OK)
+               return NULL;
+
+       return g_strdup (imageInfo.name);
+}
+
+gchar*
+mono_w32process_get_path (pid_t pid)
+{
+       return mono_w32process_get_name (pid);
+}
+
+GSList*
+mono_w32process_get_modules (pid_t pid)
+{
+       GSList *ret = NULL;
+       MonoW32ProcessModule *mod;
+       gint32 cookie = 0;
+       image_info imageInfo;
+
+       while (get_next_image_info (B_CURRENT_TEAM, &cookie, &imageInfo) == B_OK) {
+               mod = g_new0 (MonoW32ProcessModule, 1);
+               mod->device = imageInfo.device;
+               mod->inode = imageInfo.node;
+               mod->filename = g_strdup (imageInfo.name);
+               mod->address_start = MIN (imageInfo.text, imageInfo.data);
+               mod->address_end = MAX ((uint8_t*)imageInfo.text + imageInfo.text_size,
+                       (uint8_t*)imageInfo.data + imageInfo.data_size);
+               mod->perms = g_strdup ("r--p");
+               mod->address_offset = 0;
+
+               if (g_slist_find_custom (ret, mod, mono_w32process_module_equals) == NULL) {
+                       ret = g_slist_prepend (ret, mod);
+               } else {
+                       mono_w32process_module_free (mod);
+               }
+       }
+
+       return g_slist_reverse (ret);
+}
+
+#endif
diff --git a/mono/metadata/w32process-unix-internals.h b/mono/metadata/w32process-unix-internals.h
new file mode 100644 (file)
index 0000000..71226c3
--- /dev/null
@@ -0,0 +1,57 @@
+
+#ifndef _MONO_METADATA_W32PROCESS_UNIX_INTERNALS_H_
+#define _MONO_METADATA_W32PROCESS_UNIX_INTERNALS_H_
+
+#include <config.h>
+#include <glib.h>
+
+/*
+ * FOR EXCLUSIVE USE BY w32process-unix.c
+ */
+
+#if defined(PLATFORM_MACOSX)
+#define USE_OSX_BACKEND
+#elif (defined(__OpenBSD__) || defined(__FreeBSD__)) && defined(HAVE_LINK_H)
+#define USE_BSD_BACKEND
+#elif defined(__HAIKU__)
+#define USE_HAIKU_BACKEND
+#else
+#define USE_DEFAULT_BACKEND
+#endif
+
+typedef struct {
+       gpointer address_start;
+       gpointer address_end;
+       gchar *perms;
+       gpointer address_offset;
+       guint64 device;
+       guint64 inode;
+       gchar *filename;
+} MonoW32ProcessModule;
+
+gchar*
+mono_w32process_get_name (pid_t pid);
+
+GSList*
+mono_w32process_get_modules (pid_t pid);
+
+static void
+mono_w32process_module_free (MonoW32ProcessModule *module)
+{
+       g_free (module->perms);
+       g_free (module->filename);
+       g_free (module);
+}
+
+/*
+ * Used to look through the GSList* returned by mono_w32process_get_modules
+ */
+static gint
+mono_w32process_module_equals (gconstpointer a, gconstpointer b)
+{
+       MonoW32ProcessModule *want = (MonoW32ProcessModule *)a;
+       MonoW32ProcessModule *compare = (MonoW32ProcessModule *)b;
+       return (want->device == compare->device && want->inode == compare->inode) ? 0 : 1;
+}
+
+#endif /* _MONO_METADATA_W32PROCESS_UNIX_INTERNALS_H_ */
diff --git a/mono/metadata/w32process-unix-osx.c b/mono/metadata/w32process-unix-osx.c
new file mode 100644 (file)
index 0000000..eb3d5b7
--- /dev/null
@@ -0,0 +1,160 @@
+
+#include "w32process.h"
+#include "w32process-unix-internals.h"
+
+#ifdef USE_OSX_BACKEND
+
+#include <errno.h>
+#include <sys/time.h>
+#include <sys/proc.h>
+#include <sys/sysctl.h>
+#include <sys/utsname.h>
+#include <mach-o/dyld.h>
+#include <mach-o/getsect.h>
+
+/* sys/resource.h (for rusage) is required when using osx 10.3 (but not 10.4) */
+#ifdef __APPLE__
+#include <TargetConditionals.h>
+#include <sys/resource.h>
+#ifdef HAVE_LIBPROC_H
+/* proc_name */
+#include <libproc.h>
+#endif
+#endif
+
+#include "utils/mono-logger-internals.h"
+
+gchar*
+mono_w32process_get_name (pid_t pid)
+{
+       gchar *ret = NULL;
+
+#if defined (__mono_ppc__) || !defined (TARGET_OSX)
+       size_t size;
+       struct kinfo_proc *pi;
+       gint mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, pid };
+
+       if (sysctl(mib, 4, NULL, &size, NULL, 0) < 0)
+               return(ret);
+
+       if ((pi = g_malloc (size)) == NULL)
+               return(ret);
+
+       if (sysctl (mib, 4, pi, &size, NULL, 0) < 0) {
+               if (errno == ENOMEM) {
+                       g_free (pi);
+                       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Didn't allocate enough memory for kproc info", __func__);
+               }
+               return(ret);
+       }
+
+       if (strlen (pi->kp_proc.p_comm) > 0)
+               ret = g_strdup (pi->kp_proc.p_comm);
+
+       g_free (pi);
+#else
+       gchar buf[256];
+
+       /* No proc name on OSX < 10.5 nor ppc nor iOS */
+       memset (buf, '\0', sizeof(buf));
+       proc_name (pid, buf, sizeof(buf));
+
+       // Fixes proc_name triming values to 15 characters #32539
+       if (strlen (buf) >= MAXCOMLEN - 1) {
+               gchar path_buf [PROC_PIDPATHINFO_MAXSIZE];
+               gchar *name_buf;
+               gint path_len;
+
+               memset (path_buf, '\0', sizeof(path_buf));
+               path_len = proc_pidpath (pid, path_buf, sizeof(path_buf));
+
+               if (path_len > 0 && path_len < sizeof(path_buf)) {
+                       name_buf = path_buf + path_len;
+                       for(;name_buf > path_buf; name_buf--) {
+                               if (name_buf [0] == '/') {
+                                       name_buf++;
+                                       break;
+                               }
+                       }
+
+                       if (memcmp (buf, name_buf, MAXCOMLEN - 1) == 0)
+                               ret = g_strdup (name_buf);
+               }
+       }
+
+       if (ret == NULL && strlen (buf) > 0)
+               ret = g_strdup (buf);
+#endif
+
+       return ret;
+}
+
+gchar*
+mono_w32process_get_path (pid_t pid)
+{
+#if defined(__mono_ppc__) || !defined(TARGET_OSX)
+       return mono_w32process_get_name (pid);
+#else
+       gchar buf [PROC_PIDPATHINFO_MAXSIZE];
+       gint res;
+
+       res = proc_pidpath (pid, buf, sizeof (buf));
+       if (res <= 0)
+               return NULL;
+       if (buf [0] == '\0')
+               return NULL;
+       return g_strdup (buf);
+#endif
+}
+
+GSList*
+mono_w32process_get_modules (pid_t pid)
+{
+       GSList *ret = NULL;
+       MonoW32ProcessModule *mod;
+       guint32 count = _dyld_image_count ();
+       int i = 0;
+
+       for (i = 0; i < count; i++) {
+#if SIZEOF_VOID_P == 8
+               const struct mach_header_64 *hdr;
+               const struct section_64 *sec;
+#else
+               const struct mach_header *hdr;
+               const struct section *sec;
+#endif
+               const char *name;
+
+               name = _dyld_get_image_name (i);
+#if SIZEOF_VOID_P == 8
+               hdr = (const struct mach_header_64*)_dyld_get_image_header (i);
+               sec = getsectbynamefromheader_64 (hdr, SEG_DATA, SECT_DATA);
+#else
+               hdr = _dyld_get_image_header (i);
+               sec = getsectbynamefromheader (hdr, SEG_DATA, SECT_DATA);
+#endif
+
+               /* Some dynlibs do not have data sections on osx (#533893) */
+               if (sec == 0)
+                       continue;
+
+               mod = g_new0 (MonoW32ProcessModule, 1);
+               mod->address_start = GINT_TO_POINTER (sec->addr);
+               mod->address_end = GINT_TO_POINTER (sec->addr+sec->size);
+               mod->perms = g_strdup ("r--p");
+               mod->address_offset = 0;
+               mod->device = makedev (0, 0);
+               mod->inode = i;
+               mod->filename = g_strdup (name);
+
+               if (g_slist_find_custom (ret, mod, mono_w32process_module_equals) == NULL) {
+                       ret = g_slist_prepend (ret, mod);
+               } else {
+                       mono_w32process_module_free (mod);
+               }
+       }
+
+       return g_slist_reverse (ret);
+}
+
+#endif
diff --git a/mono/metadata/w32process-unix.c b/mono/metadata/w32process-unix.c
new file mode 100644 (file)
index 0000000..46d7c4c
--- /dev/null
@@ -0,0 +1,2378 @@
+/*
+ * process.c: System.Diagnostics.Process support
+ *
+ * Author:
+ *     Dick Porter (dick@ximian.com)
+ *
+ * Copyright 2002 Ximian, Inc.
+ * Copyright 2002-2006 Novell, Inc.
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
+ */
+
+#include <config.h>
+#include <glib.h>
+
+#include <stdio.h>
+#include <string.h>
+#include <pthread.h>
+#include <sched.h>
+#include <sys/time.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#ifdef HAVE_SIGNAL_H
+#include <signal.h>
+#endif
+#include <sys/time.h>
+#include <fcntl.h>
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#include <ctype.h>
+
+#ifdef HAVE_SYS_WAIT_H
+#include <sys/wait.h>
+#endif
+#ifdef HAVE_SYS_RESOURCE_H
+#include <sys/resource.h>
+#endif
+
+#ifdef HAVE_SYS_MKDEV_H
+#include <sys/mkdev.h>
+#endif
+
+#ifdef HAVE_UTIME_H
+#include <utime.h>
+#endif
+
+#include <mono/metadata/w32process.h>
+#include <mono/metadata/w32process-internals.h>
+#include <mono/metadata/w32process-unix-internals.h>
+#include <mono/metadata/class.h>
+#include <mono/metadata/class-internals.h>
+#include <mono/metadata/object.h>
+#include <mono/metadata/object-internals.h>
+#include <mono/metadata/metadata.h>
+#include <mono/metadata/metadata-internals.h>
+#include <mono/metadata/exception.h>
+#include <mono/io-layer/io-layer.h>
+#include <mono/metadata/w32handle.h>
+#include <mono/utils/mono-membar.h>
+#include <mono/utils/mono-logger-internals.h>
+#include <mono/utils/strenc.h>
+#include <mono/utils/mono-proclib.h>
+#include <mono/utils/mono-path.h>
+#include <mono/utils/mono-lazy-init.h>
+#include <mono/utils/mono-signal-handler.h>
+#include <mono/utils/mono-time.h>
+
+#ifndef MAXPATHLEN
+#define MAXPATHLEN 242
+#endif
+
+#define STILL_ACTIVE ((int) 0x00000103)
+
+#define LOGDEBUG(...)
+/* define LOGDEBUG(...) g_message(__VA_ARGS__)  */
+
+/* The process' environment strings */
+#if defined(__APPLE__)
+#if defined (TARGET_OSX)
+/* Apple defines this in crt_externs.h but doesn't provide that header for 
+ * arm-apple-darwin9.  We'll manually define the symbol on Apple as it does
+ * in fact exist on all implementations (so far) 
+ */
+gchar ***_NSGetEnviron(void);
+#define environ (*_NSGetEnviron())
+#else
+static char *mono_environ[1] = { NULL };
+#define environ mono_environ
+#endif /* defined (TARGET_OSX) */
+#else
+extern char **environ;
+#endif
+
+/*
+ * Handles > _WAPI_PROCESS_UNHANDLED are pseudo handles which represent processes
+ * not started by the runtime.
+ */
+/* This marks a system process that we don't have a handle on */
+/* FIXME: Cope with PIDs > sizeof guint */
+#define _WAPI_PROCESS_UNHANDLED (1 << (8*sizeof(pid_t)-1))
+
+#define WAPI_IS_PSEUDO_PROCESS_HANDLE(handle) ((GPOINTER_TO_UINT(handle) & _WAPI_PROCESS_UNHANDLED) == _WAPI_PROCESS_UNHANDLED)
+#define WAPI_PID_TO_HANDLE(pid) GINT_TO_POINTER (_WAPI_PROCESS_UNHANDLED + (pid))
+#define WAPI_HANDLE_TO_PID(handle) (GPOINTER_TO_UINT ((handle)) - _WAPI_PROCESS_UNHANDLED)
+
+typedef enum {
+       STARTF_USESHOWWINDOW=0x001,
+       STARTF_USESIZE=0x002,
+       STARTF_USEPOSITION=0x004,
+       STARTF_USECOUNTCHARS=0x008,
+       STARTF_USEFILLATTRIBUTE=0x010,
+       STARTF_RUNFULLSCREEN=0x020,
+       STARTF_FORCEONFEEDBACK=0x040,
+       STARTF_FORCEOFFFEEDBACK=0x080,
+       STARTF_USESTDHANDLES=0x100
+} StartupFlags;
+
+typedef struct {
+       gpointer input;
+       gpointer output;
+       gpointer error;
+} StartupHandles;
+
+typedef struct {
+#if G_BYTE_ORDER == G_BIG_ENDIAN
+       guint32 highDateTime;
+       guint32 lowDateTime;
+#else
+       guint32 lowDateTime;
+       guint32 highDateTime;
+#endif
+} ProcessTime;
+
+/*
+ * MonoProcess describes processes we create.
+ * It contains a semaphore that can be waited on in order to wait
+ * for process termination. It's accessed in our SIGCHLD handler,
+ * when status is updated (and pid cleared, to not clash with
+ * subsequent processes that may get executed).
+ */
+typedef struct _MonoProcess MonoProcess;
+struct _MonoProcess {
+       pid_t pid; /* the pid of the process. This value is only valid until the process has exited. */
+       MonoSemType exit_sem; /* this semaphore will be released when the process exits */
+       int status; /* the exit status */
+       gint32 handle_count; /* the number of handles to this mono_process instance */
+       /* we keep a ref to the creating _WapiHandle_process handle until
+        * the process has exited, so that the information there isn't lost.
+        */
+       gpointer handle;
+       gboolean freeable;
+       MonoProcess *next;
+};
+
+/* MonoW32HandleProcess is a structure containing all the required information for process handling. */
+typedef struct {
+       pid_t id;
+       guint32 exitstatus;
+       gpointer main_thread;
+       WapiFileTime create_time;
+       WapiFileTime exit_time;
+       char *proc_name;
+       size_t min_working_set;
+       size_t max_working_set;
+       gboolean exited;
+       MonoProcess *mono_process;
+} MonoW32HandleProcess;
+
+#if HAVE_SIGACTION
+static mono_lazy_init_t process_sig_chld_once = MONO_LAZY_INIT_STATUS_NOT_INITIALIZED;
+#endif
+
+static gchar *cli_launcher;
+
+/* The signal-safe logic to use processes goes like this:
+ * - The list must be safe to traverse for the signal handler at all times.
+ *   It's safe to: prepend an entry (which is a single store to 'processes'),
+ *   unlink an entry (assuming the unlinked entry isn't freed and doesn't
+ *   change its 'next' pointer so that it can still be traversed).
+ * When cleaning up we first unlink an entry, then we verify that
+ * the read lock isn't locked. Then we can free the entry, since
+ * we know that nobody is using the old version of the list (including
+ * the unlinked entry).
+ * We also need to lock when adding and cleaning up so that those two
+ * operations don't mess with eachother. (This lock is not used in the
+ * signal handler) */
+static MonoProcess *processes;
+static mono_mutex_t processes_mutex;
+
+static gpointer current_process;
+
+static const gunichar2 utf16_space_bytes [2] = { 0x20, 0 };
+static const gunichar2 *utf16_space = utf16_space_bytes;
+static const gunichar2 utf16_quote_bytes [2] = { 0x22, 0 };
+static const gunichar2 *utf16_quote = utf16_quote_bytes;
+
+static void
+process_details (gpointer data)
+{
+       MonoW32HandleProcess *process_handle = (MonoW32HandleProcess *) data;
+       g_print ("id: %d, exited: %s, exitstatus: %d",
+               process_handle->id, process_handle->exited ? "true" : "false", process_handle->exitstatus);
+}
+
+static const gchar*
+process_typename (void)
+{
+       return "Process";
+}
+
+static gsize
+process_typesize (void)
+{
+       return sizeof (MonoW32HandleProcess);
+}
+
+static MonoW32HandleWaitRet
+process_wait (gpointer handle, guint32 timeout, gboolean *alerted)
+{
+       MonoW32HandleProcess *process_handle;
+       pid_t pid G_GNUC_UNUSED, ret;
+       int status;
+       gint64 start, now;
+       MonoProcess *mp;
+       gboolean res;
+
+       /* FIXME: We can now easily wait on processes that aren't our own children,
+        * but WaitFor*Object won't call us for pseudo handles. */
+       g_assert (!WAPI_IS_PSEUDO_PROCESS_HANDLE (handle));
+
+       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s (%p, %u)", __func__, handle, timeout);
+
+       if (alerted)
+               *alerted = FALSE;
+
+       res = mono_w32handle_lookup (handle, MONO_W32HANDLE_PROCESS, (gpointer*) &process_handle);
+       if (!res) {
+               g_warning ("%s: error looking up process handle %p", __func__, handle);
+               return MONO_W32HANDLE_WAIT_RET_FAILED;
+       }
+
+       if (process_handle->exited) {
+               /* We've already done this one */
+               mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s (%p, %u): Process already exited", __func__, handle, timeout);
+               return MONO_W32HANDLE_WAIT_RET_SUCCESS_0;
+       }
+
+       pid = process_handle->id;
+
+       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s (%p, %u): PID: %d", __func__, handle, timeout, pid);
+
+       /* We don't need to lock processes here, the entry
+        * has a handle_count > 0 which means it will not be freed. */
+       mp = process_handle->mono_process;
+       if (!mp) {
+               pid_t res;
+
+               if (pid == mono_process_current_pid ()) {
+                       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s (%p, %u): waiting on current process", __func__, handle, timeout);
+                       return MONO_W32HANDLE_WAIT_RET_TIMEOUT;
+               }
+
+               /* This path is used when calling Process.HasExited, so
+                * it is only used to poll the state of the process, not
+                * to actually wait on it to exit */
+               g_assert (timeout == 0);
+
+               mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s (%p, %u): waiting on non-child process", __func__, handle, timeout);
+
+               res = waitpid (pid, &status, WNOHANG);
+               if (res == 0) {
+                       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s (%p, %u): non-child process wait timeout", __func__, handle, timeout);
+                       return MONO_W32HANDLE_WAIT_RET_TIMEOUT;
+               }
+               if (res > 0) {
+                       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s (%p, %u): non-child process waited successfully", __func__, handle, timeout);
+                       return MONO_W32HANDLE_WAIT_RET_SUCCESS_0;
+               }
+
+               mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s (%p, %u): non-child process wait failed, error : %s (%d))", __func__, handle, timeout, g_strerror (errno), errno);
+               return MONO_W32HANDLE_WAIT_RET_FAILED;
+       }
+
+       start = mono_msec_ticks ();
+       now = start;
+
+       while (1) {
+               if (timeout != INFINITE) {
+                       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s (%p, %u): waiting on semaphore for %li ms...",
+                               __func__, handle, timeout, (long)(timeout - (now - start)));
+                       ret = mono_os_sem_timedwait (&mp->exit_sem, (timeout - (now - start)), alerted ? MONO_SEM_FLAGS_ALERTABLE : MONO_SEM_FLAGS_NONE);
+               } else {
+                       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s (%p, %u): waiting on semaphore forever...",
+                               __func__, handle, timeout);
+                       ret = mono_os_sem_wait (&mp->exit_sem, alerted ? MONO_SEM_FLAGS_ALERTABLE : MONO_SEM_FLAGS_NONE);
+               }
+
+               if (ret == MONO_SEM_TIMEDWAIT_RET_SUCCESS) {
+                       /* Success, process has exited */
+                       mono_os_sem_post (&mp->exit_sem);
+                       break;
+               }
+
+               if (ret == MONO_SEM_TIMEDWAIT_RET_TIMEDOUT) {
+                       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s (%p, %u): wait timeout (timeout = 0)", __func__, handle, timeout);
+                       return MONO_W32HANDLE_WAIT_RET_TIMEOUT;
+               }
+
+               now = mono_msec_ticks ();
+               if (now - start >= timeout) {
+                       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s (%p, %u): wait timeout", __func__, handle, timeout);
+                       return MONO_W32HANDLE_WAIT_RET_TIMEOUT;
+               }
+
+               if (alerted && ret == MONO_SEM_TIMEDWAIT_RET_ALERTED) {
+                       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s (%p, %u): wait alerted", __func__, handle, timeout);
+                       *alerted = TRUE;
+                       return MONO_W32HANDLE_WAIT_RET_ALERTED;
+               }
+       }
+
+       /* Process must have exited */
+       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s (%p, %u): Waited successfully", __func__, handle, timeout);
+
+       status = mp->status;
+       if (WIFSIGNALED (status))
+               process_handle->exitstatus = 128 + WTERMSIG (status);
+       else
+               process_handle->exitstatus = WEXITSTATUS (status);
+       _wapi_time_t_to_filetime (time (NULL), &process_handle->exit_time);
+
+       process_handle->exited = TRUE;
+
+       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s (%p, %u): Setting pid %d signalled, exit status %d",
+                  __func__, handle, timeout, process_handle->id, process_handle->exitstatus);
+
+       mono_w32handle_set_signal_state (handle, TRUE, TRUE);
+
+       return MONO_W32HANDLE_WAIT_RET_SUCCESS_0;
+}
+
+static void
+processes_cleanup (void)
+{
+       static gint32 cleaning_up;
+       MonoProcess *mp;
+       MonoProcess *prev = NULL;
+       GSList *finished = NULL;
+       GSList *l;
+       gpointer unref_handle;
+
+       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s", __func__);
+
+       /* Ensure we're not in here in multiple threads at once, nor recursive. */
+       if (InterlockedCompareExchange (&cleaning_up, 1, 0) != 0)
+               return;
+
+       for (mp = processes; mp; mp = mp->next) {
+               if (mp->pid == 0 && mp->handle) {
+                       /* This process has exited and we need to remove the artifical ref
+                        * on the handle */
+                       mono_os_mutex_lock (&processes_mutex);
+                       unref_handle = mp->handle;
+                       mp->handle = NULL;
+                       mono_os_mutex_unlock (&processes_mutex);
+                       if (unref_handle)
+                               mono_w32handle_unref (unref_handle);
+               }
+       }
+
+       /*
+        * Remove processes which exited from the processes list.
+        * We need to synchronize with the sigchld handler here, which runs
+        * asynchronously. The handler requires that the processes list
+        * remain valid.
+        */
+       mono_os_mutex_lock (&processes_mutex);
+
+       mp = processes;
+       while (mp) {
+               if (mp->handle_count == 0 && mp->freeable) {
+                       /*
+                        * Unlink the entry.
+                        * This code can run parallel with the sigchld handler, but the
+                        * modifications it makes are safe.
+                        */
+                       if (mp == processes)
+                               processes = mp->next;
+                       else
+                               prev->next = mp->next;
+                       finished = g_slist_prepend (finished, mp);
+
+                       mp = mp->next;
+               } else {
+                       prev = mp;
+                       mp = mp->next;
+               }
+       }
+
+       mono_memory_barrier ();
+
+       for (l = finished; l; l = l->next) {
+               /*
+                * All the entries in the finished list are unlinked from processes, and
+                * they have the 'finished' flag set, which means the sigchld handler is done
+                * accessing them.
+                */
+               mp = (MonoProcess *)l->data;
+               mono_os_sem_destroy (&mp->exit_sem);
+               g_free (mp);
+       }
+       g_slist_free (finished);
+
+       mono_os_mutex_unlock (&processes_mutex);
+
+       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s done", __func__);
+
+       InterlockedExchange (&cleaning_up, 0);
+}
+
+static void
+process_close (gpointer handle, gpointer data)
+{
+       MonoW32HandleProcess *process_handle;
+
+       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s", __func__);
+
+       process_handle = (MonoW32HandleProcess *) data;
+       g_free (process_handle->proc_name);
+       process_handle->proc_name = NULL;
+       if (process_handle->mono_process)
+               InterlockedDecrement (&process_handle->mono_process->handle_count);
+       processes_cleanup ();
+}
+
+static MonoW32HandleOps process_ops = {
+       process_close,          /* close_shared */
+       NULL,                           /* signal */
+       NULL,                           /* own */
+       NULL,                           /* is_owned */
+       process_wait,                   /* special_wait */
+       NULL,                           /* prewait */
+       process_details,        /* details */
+       process_typename,       /* typename */
+       process_typesize,       /* typesize */
+};
+
+static void
+process_set_defaults (MonoW32HandleProcess *process_handle)
+{
+       /* These seem to be the defaults on w2k */
+       process_handle->min_working_set = 204800;
+       process_handle->max_working_set = 1413120;
+
+       _wapi_time_t_to_filetime (time (NULL), &process_handle->create_time);
+}
+
+static void
+process_set_name (MonoW32HandleProcess *process_handle)
+{
+       char *progname, *utf8_progname, *slash;
+
+       progname = g_get_prgname ();
+       utf8_progname = mono_utf8_from_external (progname);
+
+       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: using [%s] as prog name", __func__, progname);
+
+       if (utf8_progname) {
+               slash = strrchr (utf8_progname, '/');
+               if (slash)
+                       process_handle->proc_name = g_strdup (slash+1);
+               else
+                       process_handle->proc_name = g_strdup (utf8_progname);
+               g_free (utf8_progname);
+       }
+}
+
+void
+mono_w32process_init (void)
+{
+       MonoW32HandleProcess process_handle;
+
+       mono_w32handle_register_ops (MONO_W32HANDLE_PROCESS, &process_ops);
+
+       mono_w32handle_register_capabilities (MONO_W32HANDLE_PROCESS,
+               (MonoW32HandleCapability)(MONO_W32HANDLE_CAP_WAIT | MONO_W32HANDLE_CAP_SPECIAL_WAIT));
+
+       memset (&process_handle, 0, sizeof (process_handle));
+       process_handle.id = wapi_getpid ();
+       process_set_defaults (&process_handle);
+       process_set_name (&process_handle);
+
+       current_process = mono_w32handle_new (MONO_W32HANDLE_PROCESS, &process_handle);
+       g_assert (current_process);
+
+       mono_os_mutex_init (&processes_mutex);
+}
+
+void
+mono_w32process_cleanup (void)
+{
+       g_free (cli_launcher);
+}
+
+/* Check if a pid is valid - i.e. if a process exists with this pid. */
+static gboolean
+is_pid_valid (pid_t pid)
+{
+       gboolean result = FALSE;
+
+#if defined(HOST_WATCHOS)
+       result = TRUE; // TODO: Rewrite using sysctl
+#elif defined(PLATFORM_MACOSX) || defined(__OpenBSD__) || defined(__FreeBSD__)
+       if (((kill(pid, 0) == 0) || (errno == EPERM)) && pid != 0)
+               result = TRUE;
+#elif defined(__HAIKU__)
+       team_info teamInfo;
+       if (get_team_info ((team_id)pid, &teamInfo) == B_OK)
+               result = TRUE;
+#else
+       char *dir = g_strdup_printf ("/proc/%d", pid);
+       if (!access (dir, F_OK))
+               result = TRUE;
+       g_free (dir);
+#endif
+
+       return result;
+}
+
+static int
+len16 (const gunichar2 *str)
+{
+       int len = 0;
+
+       while (*str++ != 0)
+               len++;
+
+       return len;
+}
+
+static gunichar2 *
+utf16_concat (const gunichar2 *first, ...)
+{
+       va_list args;
+       int total = 0, i;
+       const gunichar2 *s;
+       const gunichar2 *p;
+       gunichar2 *ret;
+
+       va_start (args, first);
+       total += len16 (first);
+       for (s = va_arg (args, gunichar2 *); s != NULL; s = va_arg(args, gunichar2 *))
+               total += len16 (s);
+       va_end (args);
+
+       ret = g_new (gunichar2, total + 1);
+       if (ret == NULL)
+               return NULL;
+
+       ret [total] = 0;
+       i = 0;
+       for (s = first; *s != 0; s++)
+               ret [i++] = *s;
+       va_start (args, first);
+       for (s = va_arg (args, gunichar2 *); s != NULL; s = va_arg (args, gunichar2 *)){
+               for (p = s; *p != 0; p++)
+                       ret [i++] = *p;
+       }
+       va_end (args);
+
+       return ret;
+}
+
+guint32
+mono_w32process_get_pid (gpointer handle)
+{
+       MonoW32HandleProcess *process_handle;
+       gboolean res;
+
+       if (WAPI_IS_PSEUDO_PROCESS_HANDLE (handle)) {
+               /* This is a pseudo handle */
+               return WAPI_HANDLE_TO_PID (handle);
+       }
+
+       res = mono_w32handle_lookup (handle, MONO_W32HANDLE_PROCESS, (gpointer*) &process_handle);
+       if (!res) {
+               SetLastError (ERROR_INVALID_HANDLE);
+               return 0;
+       }
+
+       return process_handle->id;
+}
+
+typedef struct {
+       guint32 pid;
+       gpointer handle;
+} GetProcessForeachData;
+
+static gboolean
+get_process_foreach_callback (gpointer handle, gpointer handle_specific, gpointer user_data)
+{
+       GetProcessForeachData *foreach_data;
+       MonoW32HandleProcess *process_handle;
+       pid_t pid;
+
+       foreach_data = (GetProcessForeachData*) user_data;
+
+       if (mono_w32handle_get_type (handle) != MONO_W32HANDLE_PROCESS)
+               return FALSE;
+
+       g_assert (!WAPI_IS_PSEUDO_PROCESS_HANDLE (handle));
+
+       process_handle = (MonoW32HandleProcess*) handle_specific;
+
+       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: looking at process %d", __func__, process_handle->id);
+
+       pid = process_handle->id;
+       if (pid == 0)
+               return FALSE;
+
+       /* It's possible to have more than one process handle with the
+        * same pid, but only the one running process can be
+        * unsignalled. */
+       if (foreach_data->pid != pid)
+               return FALSE;
+       if (mono_w32handle_issignalled (handle))
+               return FALSE;
+
+       mono_w32handle_ref (handle);
+       foreach_data->handle = handle;
+       return TRUE;
+}
+
+HANDLE
+ves_icall_System_Diagnostics_Process_GetProcess_internal (guint32 pid)
+{
+       GetProcessForeachData foreach_data;
+       gpointer handle;
+
+       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: looking for process %d", __func__, pid);
+
+       memset (&foreach_data, 0, sizeof (foreach_data));
+       foreach_data.pid = pid;
+       mono_w32handle_foreach (get_process_foreach_callback, &foreach_data);
+       handle = foreach_data.handle;
+       if (handle) {
+               /* get_process_foreach_callback already added a ref */
+               return handle;
+       }
+
+       if (is_pid_valid (pid)) {
+               /* Return a pseudo handle for processes we don't have handles for */
+               return WAPI_PID_TO_HANDLE (pid);
+       }
+
+       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Can't find pid %d", __func__, pid);
+
+       SetLastError (ERROR_PROC_NOT_FOUND);
+       return NULL;
+}
+
+static gboolean
+match_procname_to_modulename (char *procname, char *modulename)
+{
+       char* lastsep = NULL;
+       char* lastsep2 = NULL;
+       char* pname = NULL;
+       char* mname = NULL;
+       gboolean result = FALSE;
+
+       if (procname == NULL || modulename == NULL)
+               return (FALSE);
+
+       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: procname=\"%s\", modulename=\"%s\"", __func__, procname, modulename);
+       pname = mono_path_resolve_symlinks (procname);
+       mname = mono_path_resolve_symlinks (modulename);
+
+       if (!strcmp (pname, mname))
+               result = TRUE;
+
+       if (!result) {
+               lastsep = strrchr (mname, '/');
+               if (lastsep)
+                       if (!strcmp (lastsep+1, pname))
+                               result = TRUE;
+               if (!result) {
+                       lastsep2 = strrchr (pname, '/');
+                       if (lastsep2){
+                               if (lastsep) {
+                                       if (!strcmp (lastsep+1, lastsep2+1))
+                                               result = TRUE;
+                               } else {
+                                       if (!strcmp (mname, lastsep2+1))
+                                               result = TRUE;
+                               }
+                       }
+               }
+       }
+
+       g_free (pname);
+       g_free (mname);
+
+       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: result is %d", __func__, result);
+       return result;
+}
+
+gboolean
+mono_w32process_try_get_modules (gpointer process, gpointer *modules, guint32 size, guint32 *needed)
+{
+       MonoW32HandleProcess *process_handle;
+       GSList *mods = NULL;
+       MonoW32ProcessModule *module;
+       guint32 count, avail = size / sizeof(gpointer);
+       int i;
+       pid_t pid;
+       char *proc_name = NULL;
+       gboolean res;
+
+       /* Store modules in an array of pointers (main module as
+        * modules[0]), using the load address for each module as a
+        * token.  (Use 'NULL' as an alternative for the main module
+        * so that the simple implementation can just return one item
+        * for now.)  Get the info from /proc/<pid>/maps on linux,
+        * /proc/<pid>/map on FreeBSD, other systems will have to
+        * implement /dev/kmem reading or whatever other horrid
+        * technique is needed.
+        */
+       if (size < sizeof(gpointer))
+               return FALSE;
+
+       if (WAPI_IS_PSEUDO_PROCESS_HANDLE (process)) {
+               pid = WAPI_HANDLE_TO_PID (process);
+               proc_name = mono_w32process_get_name (pid);
+       } else {
+               res = mono_w32handle_lookup (process, MONO_W32HANDLE_PROCESS, (gpointer*) &process_handle);
+               if (!res) {
+                       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Can't find process %p", __func__, process);
+                       return FALSE;
+               }
+
+               pid = process_handle->id;
+               proc_name = g_strdup (process_handle->proc_name);
+       }
+
+       if (!proc_name) {
+               modules[0] = NULL;
+               *needed = sizeof(gpointer);
+               return TRUE;
+       }
+
+       mods = mono_w32process_get_modules (pid);
+       if (!mods) {
+               modules[0] = NULL;
+               *needed = sizeof(gpointer);
+               g_free (proc_name);
+               return TRUE;
+       }
+
+       count = g_slist_length (mods);
+
+       /* count + 1 to leave slot 0 for the main module */
+       *needed = sizeof(gpointer) * (count + 1);
+
+       /*
+        * Use the NULL shortcut, as the first line in
+        * /proc/<pid>/maps isn't the executable, and we need
+        * that first in the returned list. Check the module name
+        * to see if it ends with the proc name and substitute
+        * the first entry with it.  FIXME if this turns out to
+        * be a problem.
+        */
+       modules[0] = NULL;
+       for (i = 0; i < (avail - 1) && i < count; i++) {
+               module = (MonoW32ProcessModule *)g_slist_nth_data (mods, i);
+               if (modules[0] != NULL)
+                       modules[i] = module->address_start;
+               else if (match_procname_to_modulename (proc_name, module->filename))
+                       modules[0] = module->address_start;
+               else
+                       modules[i + 1] = module->address_start;
+       }
+
+       for (i = 0; i < count; i++) {
+               mono_w32process_module_free ((MonoW32ProcessModule *)g_slist_nth_data (mods, i));
+       }
+       g_slist_free (mods);
+       g_free (proc_name);
+
+       return TRUE;
+}
+
+guint32
+mono_w32process_module_get_filename (gpointer process, gpointer module, gunichar2 *basename, guint32 size)
+{
+       gint pid, len;
+       gsize bytes;
+       gchar *path;
+       gunichar2 *proc_path;
+
+       size *= sizeof (gunichar2); /* adjust for unicode characters */
+
+       if (basename == NULL || size == 0)
+               return 0;
+
+       pid = mono_w32process_get_pid (process);
+
+       path = mono_w32process_get_path (pid);
+       if (path == NULL)
+               return 0;
+
+       proc_path = mono_unicode_from_external (path, &bytes);
+       g_free (path);
+
+       if (proc_path == NULL)
+               return 0;
+
+       len = (bytes / 2);
+
+       /* Add the terminator */
+       bytes += 2;
+
+       if (size < bytes) {
+               mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Size %d smaller than needed (%ld); truncating", __func__, size, bytes);
+               memcpy (basename, proc_path, size);
+       } else {
+               mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Size %d larger than needed (%ld)", __func__, size, bytes);
+               memcpy (basename, proc_path, bytes);
+       }
+
+       g_free (proc_path);
+
+       return len;
+}
+
+guint32
+mono_w32process_module_get_name (gpointer process, gpointer module, gunichar2 *basename, guint32 size)
+{
+       MonoW32HandleProcess *process_handle;
+       pid_t pid;
+       gunichar2 *procname;
+       char *procname_ext = NULL;
+       glong len;
+       gsize bytes;
+       GSList *mods = NULL;
+       MonoW32ProcessModule *found_module;
+       guint32 count;
+       int i;
+       char *proc_name = NULL;
+       gboolean res;
+
+       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Getting module base name, process handle %p module %p",
+                  __func__, process, module);
+
+       size = size * sizeof (gunichar2); /* adjust for unicode characters */
+
+       if (basename == NULL || size == 0)
+               return 0;
+
+       if (WAPI_IS_PSEUDO_PROCESS_HANDLE (process)) {
+               /* This is a pseudo handle */
+               pid = (pid_t)WAPI_HANDLE_TO_PID (process);
+               proc_name = mono_w32process_get_name (pid);
+       } else {
+               res = mono_w32handle_lookup (process, MONO_W32HANDLE_PROCESS, (gpointer*) &process_handle);
+               if (!res) {
+                       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Can't find process %p", __func__, process);
+                       return 0;
+               }
+
+               pid = process_handle->id;
+               proc_name = g_strdup (process_handle->proc_name);
+       }
+
+       mods = mono_w32process_get_modules (pid);
+       if (!mods) {
+               g_free (proc_name);
+               return 0;
+       }
+
+       count = g_slist_length (mods);
+
+       /* If module != NULL compare the address.
+        * If module == NULL we are looking for the main module.
+        * The best we can do for now check it the module name end with the process name.
+        */
+       for (i = 0; i < count; i++) {
+               found_module = (MonoW32ProcessModule *)g_slist_nth_data (mods, i);
+               if (procname_ext == NULL &&
+                       ((module == NULL && match_procname_to_modulename (proc_name, found_module->filename)) ||
+                        (module != NULL && found_module->address_start == module))) {
+                       procname_ext = g_path_get_basename (found_module->filename);
+               }
+
+               mono_w32process_module_free (found_module);
+       }
+
+       if (procname_ext == NULL) {
+               /* If it's *still* null, we might have hit the
+                * case where reading /proc/$pid/maps gives an
+                * empty file for this user.
+                */
+               procname_ext = mono_w32process_get_name (pid);
+       }
+
+       g_slist_free (mods);
+       g_free (proc_name);
+
+       if (procname_ext) {
+               mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Process name is [%s]", __func__,
+                          procname_ext);
+
+               procname = mono_unicode_from_external (procname_ext, &bytes);
+               if (procname == NULL) {
+                       /* bugger */
+                       g_free (procname_ext);
+                       return 0;
+               }
+
+               len = (bytes / 2);
+
+               /* Add the terminator */
+               bytes += 2;
+
+               if (size < bytes) {
+                       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Size %d smaller than needed (%ld); truncating", __func__, size, bytes);
+
+                       memcpy (basename, procname, size);
+               } else {
+                       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Size %d larger than needed (%ld)",
+                                  __func__, size, bytes);
+
+                       memcpy (basename, procname, bytes);
+               }
+
+               g_free (procname);
+               g_free (procname_ext);
+
+               return len;
+       }
+
+       return 0;
+}
+
+gboolean
+mono_w32process_module_get_information (gpointer process, gpointer module, WapiModuleInfo *modinfo, guint32 size)
+{
+       MonoW32HandleProcess *process_handle;
+       pid_t pid;
+       GSList *mods = NULL;
+       MonoW32ProcessModule *found_module;
+       guint32 count;
+       int i;
+       gboolean ret = FALSE;
+       char *proc_name = NULL;
+       gboolean res;
+
+       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Getting module info, process handle %p module %p",
+                  __func__, process, module);
+
+       if (modinfo == NULL || size < sizeof (WapiModuleInfo))
+               return FALSE;
+
+       if (WAPI_IS_PSEUDO_PROCESS_HANDLE (process)) {
+               pid = (pid_t)WAPI_HANDLE_TO_PID (process);
+               proc_name = mono_w32process_get_name (pid);
+       } else {
+               res = mono_w32handle_lookup (process, MONO_W32HANDLE_PROCESS, (gpointer*) &process_handle);
+               if (!res) {
+                       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Can't find process %p", __func__, process);
+                       return FALSE;
+               }
+
+               pid = process_handle->id;
+               proc_name = g_strdup (process_handle->proc_name);
+       }
+
+       mods = mono_w32process_get_modules (pid);
+       if (!mods) {
+               g_free (proc_name);
+               return FALSE;
+       }
+
+       count = g_slist_length (mods);
+
+       /* If module != NULL compare the address.
+        * If module == NULL we are looking for the main module.
+        * The best we can do for now check it the module name end with the process name.
+        */
+       for (i = 0; i < count; i++) {
+                       found_module = (MonoW32ProcessModule *)g_slist_nth_data (mods, i);
+                       if (ret == FALSE &&
+                               ((module == NULL && match_procname_to_modulename (proc_name, found_module->filename)) ||
+                                (module != NULL && found_module->address_start == module))) {
+                               modinfo->lpBaseOfDll = found_module->address_start;
+                               modinfo->SizeOfImage = (gsize)(found_module->address_end) - (gsize)(found_module->address_start);
+                               modinfo->EntryPoint = found_module->address_offset;
+                               ret = TRUE;
+                       }
+
+                       mono_w32process_module_free (found_module);
+       }
+
+       g_slist_free (mods);
+       g_free (proc_name);
+
+       return ret;
+}
+
+static void
+switch_dir_separators (char *path)
+{
+       size_t i, pathLength = strlen(path);
+       
+       /* Turn all the slashes round the right way, except for \' */
+       /* There are probably other characters that need to be excluded as well. */
+       for (i = 0; i < pathLength; i++) {
+               if (path[i] == '\\' && i < pathLength - 1 && path[i+1] != '\'' )
+                       path[i] = '/';
+       }
+}
+
+#if HAVE_SIGACTION
+
+MONO_SIGNAL_HANDLER_FUNC (static, mono_sigchld_signal_handler, (int _dummy, siginfo_t *info, void *context))
+{
+       int status;
+       int pid;
+       MonoProcess *p;
+
+       do {
+               do {
+                       pid = waitpid (-1, &status, WNOHANG);
+               } while (pid == -1 && errno == EINTR);
+
+               if (pid <= 0)
+                       break;
+
+               /*
+                * This can run concurrently with the code in the rest of this module.
+                */
+               for (p = processes; p; p = p->next) {
+                       if (p->pid != pid)
+                               continue;
+
+                       p->pid = 0; /* this pid doesn't exist anymore, clear it */
+                       p->status = status;
+                       mono_os_sem_post (&p->exit_sem);
+                       mono_memory_barrier ();
+                       /* Mark this as freeable, the pointer becomes invalid afterwards */
+                       p->freeable = TRUE;
+                       break;
+               }
+       } while (1);
+}
+
+static void
+process_add_sigchld_handler (void)
+{
+       struct sigaction sa;
+
+       sa.sa_sigaction = mono_sigchld_signal_handler;
+       sigemptyset (&sa.sa_mask);
+       sa.sa_flags = SA_NOCLDSTOP | SA_SIGINFO;
+       g_assert (sigaction (SIGCHLD, &sa, NULL) != -1);
+       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "Added SIGCHLD handler");
+}
+
+#endif
+
+static gboolean
+is_readable_or_executable (const char *prog)
+{
+       struct stat buf;
+       int a = access (prog, R_OK);
+       int b = access (prog, X_OK);
+       if (a != 0 && b != 0)
+               return FALSE;
+       if (stat (prog, &buf))
+               return FALSE;
+       if (S_ISREG (buf.st_mode))
+               return TRUE;
+       return FALSE;
+}
+
+static gboolean
+is_executable (const char *prog)
+{
+       struct stat buf;
+       if (access (prog, X_OK) != 0)
+               return FALSE;
+       if (stat (prog, &buf))
+               return FALSE;
+       if (S_ISREG (buf.st_mode))
+               return TRUE;
+       return FALSE;
+}
+
+static gboolean
+is_managed_binary (const char *filename)
+{
+       int original_errno = errno;
+#if defined(HAVE_LARGE_FILE_SUPPORT) && defined(O_LARGEFILE)
+       int file = open (filename, O_RDONLY | O_LARGEFILE);
+#else
+       int file = open (filename, O_RDONLY);
+#endif
+       off_t new_offset;
+       unsigned char buffer[8];
+       off_t file_size, optional_header_offset;
+       off_t pe_header_offset, clr_header_offset;
+       gboolean managed = FALSE;
+       int num_read;
+       guint32 first_word, second_word, magic_number;
+       
+       /* If we are unable to open the file, then we definitely
+        * can't say that it is managed. The child mono process
+        * probably wouldn't be able to open it anyway.
+        */
+       if (file < 0) {
+               errno = original_errno;
+               return FALSE;
+       }
+
+       /* Retrieve the length of the file for future sanity checks. */
+       file_size = lseek (file, 0, SEEK_END);
+       lseek (file, 0, SEEK_SET);
+
+       /* We know we need to read a header field at offset 60. */
+       if (file_size < 64)
+               goto leave;
+
+       num_read = read (file, buffer, 2);
+
+       if ((num_read != 2) || (buffer[0] != 'M') || (buffer[1] != 'Z'))
+               goto leave;
+
+       new_offset = lseek (file, 60, SEEK_SET);
+
+       if (new_offset != 60)
+               goto leave;
+       
+       num_read = read (file, buffer, 4);
+
+       if (num_read != 4)
+               goto leave;
+       pe_header_offset =  buffer[0]
+               | (buffer[1] <<  8)
+               | (buffer[2] << 16)
+               | (buffer[3] << 24);
+       
+       if (pe_header_offset + 24 > file_size)
+               goto leave;
+
+       new_offset = lseek (file, pe_header_offset, SEEK_SET);
+
+       if (new_offset != pe_header_offset)
+               goto leave;
+
+       num_read = read (file, buffer, 4);
+
+       if ((num_read != 4) || (buffer[0] != 'P') || (buffer[1] != 'E') || (buffer[2] != 0) || (buffer[3] != 0))
+               goto leave;
+
+       /*
+        * Verify that the header we want in the optional header data
+        * is present in this binary.
+        */
+       new_offset = lseek (file, pe_header_offset + 20, SEEK_SET);
+
+       if (new_offset != pe_header_offset + 20)
+               goto leave;
+
+       num_read = read (file, buffer, 2);
+
+       if ((num_read != 2) || ((buffer[0] | (buffer[1] << 8)) < 216))
+               goto leave;
+
+       optional_header_offset = pe_header_offset + 24;
+
+       /* Read the PE magic number */
+       new_offset = lseek (file, optional_header_offset, SEEK_SET);
+       
+       if (new_offset != optional_header_offset)
+               goto leave;
+
+       num_read = read (file, buffer, 2);
+
+       if (num_read != 2)
+               goto leave;
+
+       magic_number = (buffer[0] | (buffer[1] << 8));
+       
+       if (magic_number == 0x10B)  // PE32
+               clr_header_offset = 208;
+       else if (magic_number == 0x20B)  // PE32+
+               clr_header_offset = 224;
+       else
+               goto leave;
+
+       /* Read the CLR header address and size fields. These will be
+        * zero if the binary is not managed.
+        */
+       new_offset = lseek (file, optional_header_offset + clr_header_offset, SEEK_SET);
+
+       if (new_offset != optional_header_offset + clr_header_offset)
+               goto leave;
+
+       num_read = read (file, buffer, 8);
+       
+       /* We are not concerned with endianness, only with
+        * whether it is zero or not.
+        */
+       first_word = *(guint32 *)&buffer[0];
+       second_word = *(guint32 *)&buffer[4];
+       
+       if ((num_read != 8) || (first_word == 0) || (second_word == 0))
+               goto leave;
+       
+       managed = TRUE;
+
+leave:
+       close (file);
+       errno = original_errno;
+       return managed;
+}
+
+static gboolean
+process_create (const gunichar2 *appname, const gunichar2 *cmdline, gpointer new_environ,
+       const gunichar2 *cwd, StartupHandles *startup_handles, MonoW32ProcessInfo *process_info)
+{
+#if defined (HAVE_FORK) && defined (HAVE_EXECVE)
+       char *cmd = NULL, *prog = NULL, *full_prog = NULL, *args = NULL, *args_after_prog = NULL;
+       char *dir = NULL, **env_strings = NULL, **argv = NULL;
+       guint32 i, env_count = 0;
+       gboolean ret = FALSE;
+       gpointer handle = NULL;
+       GError *gerr = NULL;
+       int in_fd, out_fd, err_fd;
+       pid_t pid = 0;
+       int startup_pipe [2] = {-1, -1};
+       int dummy;
+       MonoProcess *mono_process;
+
+#if HAVE_SIGACTION
+       mono_lazy_initialize (&process_sig_chld_once, process_add_sigchld_handler);
+#endif
+
+       /* appname and cmdline specify the executable and its args:
+        *
+        * If appname is not NULL, it is the name of the executable.
+        * Otherwise the executable is the first token in cmdline.
+        *
+        * Executable searching:
+        *
+        * If appname is not NULL, it can specify the full path and
+        * file name, or else a partial name and the current directory
+        * will be used.  There is no additional searching.
+        *
+        * If appname is NULL, the first whitespace-delimited token in
+        * cmdline is used.  If the name does not contain a full
+        * directory path, the search sequence is:
+        *
+        * 1) The directory containing the current process
+        * 2) The current working directory
+        * 3) The windows system directory  (Ignored)
+        * 4) The windows directory (Ignored)
+        * 5) $PATH
+        *
+        * Just to make things more interesting, tokens can contain
+        * white space if they are surrounded by quotation marks.  I'm
+        * beginning to understand just why windows apps are generally
+        * so crap, with an API like this :-(
+        */
+       if (appname != NULL) {
+               cmd = mono_unicode_to_external (appname);
+               if (cmd == NULL) {
+                       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: unicode conversion returned NULL",
+                                  __func__);
+
+                       SetLastError (ERROR_PATH_NOT_FOUND);
+                       goto free_strings;
+               }
+
+               switch_dir_separators(cmd);
+       }
+
+       if (cmdline != NULL) {
+               args = mono_unicode_to_external (cmdline);
+               if (args == NULL) {
+                       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: unicode conversion returned NULL", __func__);
+
+                       SetLastError (ERROR_PATH_NOT_FOUND);
+                       goto free_strings;
+               }
+       }
+
+       if (cwd != NULL) {
+               dir = mono_unicode_to_external (cwd);
+               if (dir == NULL) {
+                       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: unicode conversion returned NULL", __func__);
+
+                       SetLastError (ERROR_PATH_NOT_FOUND);
+                       goto free_strings;
+               }
+
+               /* Turn all the slashes round the right way */
+               switch_dir_separators(dir);
+       }
+
+
+       /* We can't put off locating the executable any longer :-( */
+       if (cmd != NULL) {
+               char *unquoted;
+               if (g_ascii_isalpha (cmd[0]) && (cmd[1] == ':')) {
+                       /* Strip off the drive letter.  I can't
+                        * believe that CP/M holdover is still
+                        * visible...
+                        */
+                       g_memmove (cmd, cmd+2, strlen (cmd)-2);
+                       cmd[strlen (cmd)-2] = '\0';
+               }
+
+               unquoted = g_shell_unquote (cmd, NULL);
+               if (unquoted[0] == '/') {
+                       /* Assume full path given */
+                       prog = g_strdup (unquoted);
+
+                       /* Executable existing ? */
+                       if (!is_readable_or_executable (prog)) {
+                               mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Couldn't find executable %s",
+                                          __func__, prog);
+                               g_free (unquoted);
+                               SetLastError (ERROR_FILE_NOT_FOUND);
+                               goto free_strings;
+                       }
+               } else {
+                       /* Search for file named by cmd in the current
+                        * directory
+                        */
+                       char *curdir = g_get_current_dir ();
+
+                       prog = g_strdup_printf ("%s/%s", curdir, unquoted);
+                       g_free (curdir);
+
+                       /* And make sure it's readable */
+                       if (!is_readable_or_executable (prog)) {
+                               mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Couldn't find executable %s",
+                                          __func__, prog);
+                               g_free (unquoted);
+                               SetLastError (ERROR_FILE_NOT_FOUND);
+                               goto free_strings;
+                       }
+               }
+               g_free (unquoted);
+
+               args_after_prog = args;
+       } else {
+               char *token = NULL;
+               char quote;
+
+               /* Dig out the first token from args, taking quotation
+                * marks into account
+                */
+
+               /* First, strip off all leading whitespace */
+               args = g_strchug (args);
+
+               /* args_after_prog points to the contents of args
+                * after token has been set (otherwise argv[0] is
+                * duplicated)
+                */
+               args_after_prog = args;
+
+               /* Assume the opening quote will always be the first
+                * character
+                */
+               if (args[0] == '\"' || args [0] == '\'') {
+                       quote = args [0];
+                       for (i = 1; args[i] != '\0' && args[i] != quote; i++);
+                       if (args [i + 1] == '\0' || g_ascii_isspace (args[i+1])) {
+                               /* We found the first token */
+                               token = g_strndup (args+1, i-1);
+                               args_after_prog = g_strchug (args + i + 1);
+                       } else {
+                               /* Quotation mark appeared in the
+                                * middle of the token.  Just give the
+                                * whole first token, quotes and all,
+                                * to exec.
+                                */
+                       }
+               }
+
+               if (token == NULL) {
+                       /* No quote mark, or malformed */
+                       for (i = 0; args[i] != '\0'; i++) {
+                               if (g_ascii_isspace (args[i])) {
+                                       token = g_strndup (args, i);
+                                       args_after_prog = args + i + 1;
+                                       break;
+                               }
+                       }
+               }
+
+               if (token == NULL && args[0] != '\0') {
+                       /* Must be just one token in the string */
+                       token = g_strdup (args);
+                       args_after_prog = NULL;
+               }
+
+               if (token == NULL) {
+                       /* Give up */
+                       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Couldn't find what to exec", __func__);
+
+                       SetLastError (ERROR_PATH_NOT_FOUND);
+                       goto free_strings;
+               }
+
+               /* Turn all the slashes round the right way. Only for
+                * the prg. name
+                */
+               switch_dir_separators(token);
+
+               if (g_ascii_isalpha (token[0]) && (token[1] == ':')) {
+                       /* Strip off the drive letter.  I can't
+                        * believe that CP/M holdover is still
+                        * visible...
+                        */
+                       g_memmove (token, token+2, strlen (token)-2);
+                       token[strlen (token)-2] = '\0';
+               }
+
+               if (token[0] == '/') {
+                       /* Assume full path given */
+                       prog = g_strdup (token);
+
+                       /* Executable existing ? */
+                       if (!is_readable_or_executable (prog)) {
+                               mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Couldn't find executable %s",
+                                          __func__, token);
+                               g_free (token);
+                               SetLastError (ERROR_FILE_NOT_FOUND);
+                               goto free_strings;
+                       }
+               } else {
+                       char *curdir = g_get_current_dir ();
+
+                       /* FIXME: Need to record the directory
+                        * containing the current process, and check
+                        * that for the new executable as the first
+                        * place to look
+                        */
+
+                       prog = g_strdup_printf ("%s/%s", curdir, token);
+                       g_free (curdir);
+
+                       /* I assume X_OK is the criterion to use,
+                        * rather than F_OK
+                        *
+                        * X_OK is too strict *if* the target is a CLR binary
+                        */
+                       if (!is_readable_or_executable (prog)) {
+                               g_free (prog);
+                               prog = g_find_program_in_path (token);
+                               if (prog == NULL) {
+                                       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Couldn't find executable %s", __func__, token);
+
+                                       g_free (token);
+                                       SetLastError (ERROR_FILE_NOT_FOUND);
+                                       goto free_strings;
+                               }
+                       }
+               }
+
+               g_free (token);
+       }
+
+       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Exec prog [%s] args [%s]",
+               __func__, prog, args_after_prog);
+
+       /* Check for CLR binaries; if found, we will try to invoke
+        * them using the same mono binary that started us.
+        */
+       if (is_managed_binary (prog)) {
+               gunichar2 *newapp, *newcmd;
+               gsize bytes_ignored;
+
+               newapp = mono_unicode_from_external (cli_launcher ? cli_launcher : "mono", &bytes_ignored);
+               if (newapp) {
+                       if (appname)
+                               newcmd = utf16_concat (utf16_quote, newapp, utf16_quote, utf16_space, appname, utf16_space, cmdline, NULL);
+                       else
+                               newcmd = utf16_concat (utf16_quote, newapp, utf16_quote, utf16_space, cmdline, NULL);
+
+                       g_free (newapp);
+
+                       if (newcmd) {
+                               ret = process_create (NULL, newcmd, new_environ, cwd, startup_handles, process_info);
+
+                               g_free (newcmd);
+
+                               goto free_strings;
+                       }
+               }
+       } else {
+               if (!is_executable (prog)) {
+                       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Executable permisson not set on %s", __func__, prog);
+                       SetLastError (ERROR_ACCESS_DENIED);
+                       goto free_strings;
+               }
+       }
+
+       if (args_after_prog != NULL && *args_after_prog) {
+               char *qprog;
+
+               qprog = g_shell_quote (prog);
+               full_prog = g_strconcat (qprog, " ", args_after_prog, NULL);
+               g_free (qprog);
+       } else {
+               full_prog = g_shell_quote (prog);
+       }
+
+       ret = g_shell_parse_argv (full_prog, NULL, &argv, &gerr);
+       if (ret == FALSE) {
+               g_message ("process_create: %s\n", gerr->message);
+               g_error_free (gerr);
+               gerr = NULL;
+               goto free_strings;
+       }
+
+       if (startup_handles) {
+               in_fd = GPOINTER_TO_UINT (startup_handles->input);
+               out_fd = GPOINTER_TO_UINT (startup_handles->output);
+               err_fd = GPOINTER_TO_UINT (startup_handles->error);
+       } else {
+               in_fd = GPOINTER_TO_UINT (GetStdHandle (STD_INPUT_HANDLE));
+               out_fd = GPOINTER_TO_UINT (GetStdHandle (STD_OUTPUT_HANDLE));
+               err_fd = GPOINTER_TO_UINT (GetStdHandle (STD_ERROR_HANDLE));
+       }
+
+       /* new_environ is a block of NULL-terminated strings, which
+        * is itself NULL-terminated. Of course, passing an array of
+        * string pointers would have made things too easy :-(
+        *
+        * If new_environ is not NULL it specifies the entire set of
+        * environment variables in the new process.  Otherwise the
+        * new process inherits the same environment.
+        */
+       if (new_environ) {
+               gunichar2 *new_environp;
+
+               /* Count the number of strings */
+               for (new_environp = (gunichar2 *)new_environ; *new_environp; new_environp++) {
+                       env_count++;
+                       while (*new_environp)
+                               new_environp++;
+               }
+
+               /* +2: one for the process handle value, and the last
+                * one is NULL
+                */
+               env_strings = g_new0 (char *, env_count + 2);
+
+               /* Copy each environ string into 'strings' turning it
+                * into utf8 (or the requested encoding) at the same
+                * time
+                */
+               env_count = 0;
+               for (new_environp = (gunichar2 *)new_environ; *new_environp; new_environp++) {
+                       env_strings[env_count] = mono_unicode_to_external (new_environp);
+                       env_count++;
+                       while (*new_environp) {
+                               new_environp++;
+                       }
+               }
+       } else {
+               for (i = 0; environ[i] != NULL; i++)
+                       env_count++;
+
+               /* +2: one for the process handle value, and the last
+                * one is NULL
+                */
+               env_strings = g_new0 (char *, env_count + 2);
+
+               /* Copy each environ string into 'strings' turning it
+                * into utf8 (or the requested encoding) at the same
+                * time
+                */
+               env_count = 0;
+               for (i = 0; environ[i] != NULL; i++) {
+                       env_strings[env_count] = g_strdup (environ[i]);
+                       env_count++;
+               }
+       }
+
+       /* Create a pipe to make sure the child doesn't exit before
+        * we can add the process to the linked list of processes */
+       if (pipe (startup_pipe) == -1) {
+               /* Could not create the pipe to synchroniz process startup. We'll just not synchronize.
+                * This is just for a very hard to hit race condition in the first place */
+               startup_pipe [0] = startup_pipe [1] = -1;
+               mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: new process startup not synchronized. We may not notice if the newly created process exits immediately.", __func__);
+       }
+
+#if HAVE_SIGACTION
+       /* FIXME: block SIGCHLD */
+#endif
+
+       switch (pid = fork ()) {
+       case -1: /* Error */ {
+               SetLastError (ERROR_OUTOFMEMORY);
+               ret = FALSE;
+               break;
+       }
+       case 0: /* Child */ {
+               if (startup_pipe [0] != -1) {
+                       /* Wait until the parent has updated it's internal data */
+                       ssize_t _i G_GNUC_UNUSED = read (startup_pipe [0], &dummy, 1);
+                       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: child: parent has completed its setup", __func__);
+                       close (startup_pipe [0]);
+                       close (startup_pipe [1]);
+               }
+
+               /* should we detach from the process group? */
+
+               /* Connect stdin, stdout and stderr */
+               dup2 (in_fd, 0);
+               dup2 (out_fd, 1);
+               dup2 (err_fd, 2);
+
+               /* Close all file descriptors */
+               for (i = mono_w32handle_fd_reserve - 1; i > 2; i--)
+                       close (i);
+
+#ifdef DEBUG_ENABLED
+               mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: exec()ing [%s] in dir [%s]", __func__, cmd,
+                          dir == NULL?".":dir);
+               for (i = 0; argv[i] != NULL; i++)
+                       g_message ("arg %d: [%s]", i, argv[i]);
+
+               for (i = 0; env_strings[i] != NULL; i++)
+                       g_message ("env %d: [%s]", i, env_strings[i]);
+#endif
+
+               /* set cwd */
+               if (dir != NULL && chdir (dir) == -1) {
+                       /* set error */
+                       _exit (-1);
+               }
+
+               /* exec */
+               execve (argv[0], argv, env_strings);
+
+               /* set error */
+               _exit (-1);
+
+               break;
+       }
+       default: /* Parent */ {
+               MonoW32HandleProcess process_handle;
+
+               memset (&process_handle, 0, sizeof (process_handle));
+               process_handle.id = pid;
+               process_handle.proc_name = g_strdup (prog);
+               process_set_defaults (&process_handle);
+
+               /* Add our mono_process into the linked list of processes */
+               mono_process = (MonoProcess *) g_malloc0 (sizeof (MonoProcess));
+               mono_process->pid = pid;
+               mono_process->handle_count = 1;
+               mono_os_sem_init (&mono_process->exit_sem, 0);
+
+               process_handle.mono_process = mono_process;
+
+               handle = mono_w32handle_new (MONO_W32HANDLE_PROCESS, &process_handle);
+               if (handle == INVALID_HANDLE_VALUE) {
+                       g_warning ("%s: error creating process handle", __func__);
+
+                       mono_os_sem_destroy (&mono_process->exit_sem);
+                       g_free (mono_process);
+
+                       SetLastError (ERROR_OUTOFMEMORY);
+                       ret = FALSE;
+                       break;
+               }
+
+               /* Keep the process handle artificially alive until the process
+                * exits so that the information in the handle isn't lost. */
+               mono_w32handle_ref (handle);
+               mono_process->handle = handle;
+
+               mono_os_mutex_lock (&processes_mutex);
+               mono_process->next = processes;
+               processes = mono_process;
+               mono_os_mutex_unlock (&processes_mutex);
+
+               if (process_info != NULL) {
+                       process_info->process_handle = handle;
+                       process_info->pid = pid;
+
+                       /* FIXME: we might need to handle the thread info some day */
+                       process_info->thread_handle = INVALID_HANDLE_VALUE;
+                       process_info->tid = 0;
+               }
+
+               break;
+       }
+       }
+
+#if HAVE_SIGACTION
+       /* FIXME: unblock SIGCHLD */
+#endif
+
+       if (startup_pipe [1] != -1) {
+               /* Write 1 byte, doesn't matter what */
+               ssize_t _i G_GNUC_UNUSED = write (startup_pipe [1], startup_pipe, 1);
+               close (startup_pipe [0]);
+               close (startup_pipe [1]);
+       }
+
+free_strings:
+       if (cmd)
+               g_free (cmd);
+       if (full_prog)
+               g_free (full_prog);
+       if (prog)
+               g_free (prog);
+       if (args)
+               g_free (args);
+       if (dir)
+               g_free (dir);
+       if (env_strings)
+               g_strfreev (env_strings);
+       if (argv)
+               g_strfreev (argv);
+
+       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: returning handle %p for pid %d", __func__, handle, pid);
+
+       /* Check if something needs to be cleaned up. */
+       processes_cleanup ();
+
+       return ret;
+#else
+       SetLastError (ERROR_NOT_SUPPORTED);
+       return FALSE;
+#endif // defined (HAVE_FORK) && defined (HAVE_EXECVE)
+}
+
+MonoBoolean
+ves_icall_System_Diagnostics_Process_ShellExecuteEx_internal (MonoW32ProcessStartInfo *proc_start_info, MonoW32ProcessInfo *process_info)
+{
+       const gunichar2 *lpFile;
+       const gunichar2 *lpParameters;
+       const gunichar2 *lpDirectory;
+       gunichar2 *args;
+       gboolean ret;
+
+       if (!proc_start_info->filename) {
+               /* w2k returns TRUE for this, for some reason. */
+               ret = TRUE;
+               goto done;
+       }
+
+       lpFile = proc_start_info->filename ? mono_string_chars (proc_start_info->filename) : NULL;
+       lpParameters = proc_start_info->arguments ? mono_string_chars (proc_start_info->arguments) : NULL;
+       lpDirectory = proc_start_info->working_directory && mono_string_length (proc_start_info->working_directory) != 0 ?
+               mono_string_chars (proc_start_info->working_directory) : NULL;
+
+       /* Put both executable and parameters into the second argument
+        * to process_create (), so it searches $PATH.  The conversion
+        * into and back out of utf8 is because there is no
+        * g_strdup_printf () equivalent for gunichar2 :-(
+        */
+       args = utf16_concat (utf16_quote, lpFile, utf16_quote, lpParameters == NULL ? NULL : utf16_space, lpParameters, NULL);
+       if (args == NULL) {
+               SetLastError (ERROR_INVALID_DATA);
+               ret = FALSE;
+               goto done;
+       }
+       ret = process_create (NULL, args, NULL, lpDirectory, NULL, process_info);
+       g_free (args);
+
+       if (!ret && GetLastError () == ERROR_OUTOFMEMORY)
+               goto done;
+
+       if (!ret) {
+               static char *handler;
+               static gunichar2 *handler_utf16;
+
+               if (handler_utf16 == (gunichar2 *)-1) {
+                       ret = FALSE;
+                       goto done;
+               }
+
+#ifdef PLATFORM_MACOSX
+               handler = g_strdup ("/usr/bin/open");
+#else
+               /*
+                * On Linux, try: xdg-open, the FreeDesktop standard way of doing it,
+                * if that fails, try to use gnome-open, then kfmclient
+                */
+               handler = g_find_program_in_path ("xdg-open");
+               if (handler == NULL){
+                       handler = g_find_program_in_path ("gnome-open");
+                       if (handler == NULL){
+                               handler = g_find_program_in_path ("kfmclient");
+                               if (handler == NULL){
+                                       handler_utf16 = (gunichar2 *) -1;
+                                       ret = FALSE;
+                                       goto done;
+                               } else {
+                                       /* kfmclient needs exec argument */
+                                       char *old = handler;
+                                       handler = g_strconcat (old, " exec",
+                                                              NULL);
+                                       g_free (old);
+                               }
+                       }
+               }
+#endif
+               handler_utf16 = g_utf8_to_utf16 (handler, -1, NULL, NULL, NULL);
+               g_free (handler);
+
+               /* Put quotes around the filename, in case it's a url
+                * that contains #'s (process_create() calls
+                * g_shell_parse_argv(), which deliberately throws
+                * away anything after an unquoted #).  Fixes bug
+                * 371567.
+                */
+               args = utf16_concat (handler_utf16, utf16_space, utf16_quote, lpFile, utf16_quote,
+                       lpParameters == NULL ? NULL : utf16_space, lpParameters, NULL);
+               if (args == NULL) {
+                       SetLastError (ERROR_INVALID_DATA);
+                       ret = FALSE;
+                       goto done;
+               }
+               ret = process_create (NULL, args, NULL, lpDirectory, NULL, process_info);
+               g_free (args);
+               if (!ret) {
+                       if (GetLastError () != ERROR_OUTOFMEMORY)
+                               SetLastError (ERROR_INVALID_DATA);
+                       ret = FALSE;
+                       goto done;
+               }
+               /* Shell exec should not return a process handle when it spawned a GUI thing, like a browser. */
+               CloseHandle (process_info->process_handle);
+               process_info->process_handle = NULL;
+       }
+
+done:
+       if (ret == FALSE) {
+               process_info->pid = -GetLastError ();
+       } else {
+               process_info->thread_handle = NULL;
+#if !defined(MONO_CROSS_COMPILE)
+               process_info->pid = mono_w32process_get_pid (process_info->process_handle);
+#else
+               process_info->pid = 0;
+#endif
+               process_info->tid = 0;
+       }
+
+       return ret;
+}
+
+/* Only used when UseShellExecute is false */
+static gboolean
+process_get_complete_path (const gunichar2 *appname, gchar **completed)
+{
+       gchar *utf8app;
+       gchar *found;
+
+       utf8app = g_utf16_to_utf8 (appname, -1, NULL, NULL, NULL);
+
+       if (g_path_is_absolute (utf8app)) {
+               *completed = g_shell_quote (utf8app);
+               g_free (utf8app);
+               return TRUE;
+       }
+
+       if (g_file_test (utf8app, G_FILE_TEST_IS_EXECUTABLE) && !g_file_test (utf8app, G_FILE_TEST_IS_DIR)) {
+               *completed = g_shell_quote (utf8app);
+               g_free (utf8app);
+               return TRUE;
+       }
+       
+       found = g_find_program_in_path (utf8app);
+       if (found == NULL) {
+               *completed = NULL;
+               g_free (utf8app);
+               return FALSE;
+       }
+
+       *completed = g_shell_quote (found);
+       g_free (found);
+       g_free (utf8app);
+       return TRUE;
+}
+
+static gboolean
+process_get_shell_arguments (MonoW32ProcessStartInfo *proc_start_info, gunichar2 **shell_path, MonoString **cmd)
+{
+       gchar *spath = NULL;
+
+       *shell_path = NULL;
+       *cmd = proc_start_info->arguments;
+
+       process_get_complete_path (mono_string_chars (proc_start_info->filename), &spath);
+       if (spath != NULL) {
+               *shell_path = g_utf8_to_utf16 (spath, -1, NULL, NULL, NULL);
+               g_free (spath);
+       }
+
+       return (*shell_path != NULL) ? TRUE : FALSE;
+}
+
+MonoBoolean
+ves_icall_System_Diagnostics_Process_CreateProcess_internal (MonoW32ProcessStartInfo *proc_start_info,
+       HANDLE stdin_handle, HANDLE stdout_handle, HANDLE stderr_handle, MonoW32ProcessInfo *process_info)
+{
+       gboolean ret;
+       gunichar2 *dir;
+       StartupHandles startup_handles;
+       gunichar2 *shell_path = NULL;
+       gchar *env_vars = NULL;
+       MonoString *cmd = NULL;
+
+       memset (&startup_handles, 0, sizeof (startup_handles));
+       startup_handles.input = stdin_handle;
+       startup_handles.output = stdout_handle;
+       startup_handles.error = stderr_handle;
+
+       if (process_get_shell_arguments (proc_start_info, &shell_path, &cmd) == FALSE) {
+               process_info->pid = -ERROR_FILE_NOT_FOUND;
+               return FALSE;
+       }
+
+       if (process_info->env_keys) {
+               gint i, len; 
+               MonoString *ms;
+               MonoString *key, *value;
+               gunichar2 *str, *ptr;
+               gunichar2 *equals16;
+
+               for (len = 0, i = 0; i < mono_array_length (process_info->env_keys); i++) {
+                       ms = mono_array_get (process_info->env_values, MonoString *, i);
+                       if (ms == NULL)
+                               continue;
+
+                       len += mono_string_length (ms) * sizeof (gunichar2);
+                       ms = mono_array_get (process_info->env_keys, MonoString *, i);
+                       len += mono_string_length (ms) * sizeof (gunichar2);
+                       len += 2 * sizeof (gunichar2);
+               }
+
+               equals16 = g_utf8_to_utf16 ("=", 1, NULL, NULL, NULL);
+               ptr = str = g_new0 (gunichar2, len + 1);
+               for (i = 0; i < mono_array_length (process_info->env_keys); i++) {
+                       value = mono_array_get (process_info->env_values, MonoString *, i);
+                       if (value == NULL)
+                               continue;
+
+                       key = mono_array_get (process_info->env_keys, MonoString *, i);
+                       memcpy (ptr, mono_string_chars (key), mono_string_length (key) * sizeof (gunichar2));
+                       ptr += mono_string_length (key);
+
+                       memcpy (ptr, equals16, sizeof (gunichar2));
+                       ptr++;
+
+                       memcpy (ptr, mono_string_chars (value), mono_string_length (value) * sizeof (gunichar2));
+                       ptr += mono_string_length (value);
+                       ptr++;
+               }
+
+               g_free (equals16);
+               env_vars = (gchar *) str;
+       }
+       
+       /* The default dir name is "".  Turn that into NULL to mean "current directory" */
+       dir = proc_start_info->working_directory && mono_string_length (proc_start_info->working_directory) > 0 ?
+                       mono_string_chars (proc_start_info->working_directory) : NULL;
+
+       ret = process_create (shell_path, cmd ? mono_string_chars (cmd): NULL, env_vars, dir, &startup_handles, process_info);
+
+       g_free (env_vars);
+       if (shell_path != NULL)
+               g_free (shell_path);
+
+       if (!ret)
+               process_info->pid = -GetLastError ();
+
+       return ret;
+}
+
+/* Returns an array of pids */
+MonoArray *
+ves_icall_System_Diagnostics_Process_GetProcesses_internal (void)
+{
+       MonoError error;
+       MonoArray *procs;
+       gpointer *pidarray;
+       int i, count;
+
+       pidarray = mono_process_list (&count);
+       if (!pidarray) {
+               mono_set_pending_exception (mono_get_exception_not_supported ("This system does not support EnumProcesses"));
+               return NULL;
+       }
+       procs = mono_array_new_checked (mono_domain_get (), mono_get_int32_class (), count, &error);
+       if (mono_error_set_pending_exception (&error)) {
+               g_free (pidarray);
+               return NULL;
+       }
+       if (sizeof (guint32) == sizeof (gpointer)) {
+               memcpy (mono_array_addr (procs, guint32, 0), pidarray, count * sizeof (gint32));
+       } else {
+               for (i = 0; i < count; ++i)
+                       *(mono_array_addr (procs, guint32, i)) = GPOINTER_TO_UINT (pidarray [i]);
+       }
+       g_free (pidarray);
+
+       return procs;
+}
+
+void
+mono_w32process_set_cli_launcher (gchar *path)
+{
+       g_free (cli_launcher);
+       cli_launcher = g_strdup (path);
+}
+
+gpointer
+ves_icall_Microsoft_Win32_NativeMethods_GetCurrentProcess (void)
+{
+       mono_w32handle_ref (current_process);
+       return current_process;
+}
+
+MonoBoolean
+ves_icall_Microsoft_Win32_NativeMethods_GetExitCodeProcess (gpointer handle, gint32 *exitcode)
+{
+       MonoW32HandleProcess *process_handle;
+       guint32 pid;
+       gboolean res;
+
+       if (!exitcode)
+               return FALSE;
+
+       if (WAPI_IS_PSEUDO_PROCESS_HANDLE (handle)) {
+               pid = WAPI_HANDLE_TO_PID (handle);
+               /* This is a pseudo handle, so we don't know what the exit
+                * code was, but we can check whether it's alive or not */
+               if (is_pid_valid (pid)) {
+                       *exitcode = STILL_ACTIVE;
+                       return TRUE;
+               } else {
+                       *exitcode = -1;
+                       return TRUE;
+               }
+       }
+
+       res = mono_w32handle_lookup (handle, MONO_W32HANDLE_PROCESS, (gpointer*) &process_handle);
+       if (!res) {
+               mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Can't find process %p", __func__, handle);
+               return FALSE;
+       }
+
+       if (process_handle->id == wapi_getpid ()) {
+               *exitcode = STILL_ACTIVE;
+               return TRUE;
+       }
+
+       /* A process handle is only signalled if the process has exited
+        * and has been waited for. Make sure any process exit has been
+        * noticed before checking if the process is signalled.
+        * Fixes bug 325463. */
+       mono_w32handle_wait_one (handle, 0, TRUE);
+
+       *exitcode = mono_w32handle_issignalled (handle) ? process_handle->exitstatus : STILL_ACTIVE;
+       return TRUE;
+}
+
+MonoBoolean
+ves_icall_Microsoft_Win32_NativeMethods_CloseProcess (gpointer handle)
+{
+       if (WAPI_IS_PSEUDO_PROCESS_HANDLE (handle))
+               return TRUE;
+       return CloseHandle (handle);
+}
+
+MonoBoolean
+ves_icall_Microsoft_Win32_NativeMethods_TerminateProcess (gpointer handle, gint32 exitcode)
+{
+#ifdef HAVE_KILL
+       MonoW32HandleProcess *process_handle;
+       int ret;
+       pid_t pid;
+
+       if (WAPI_IS_PSEUDO_PROCESS_HANDLE (handle)) {
+               /* This is a pseudo handle */
+               pid = (pid_t)WAPI_HANDLE_TO_PID (handle);
+       } else {
+               gboolean res;
+
+               res = mono_w32handle_lookup (handle, MONO_W32HANDLE_PROCESS, (gpointer*) &process_handle);
+               if (!res) {
+                       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Can't find process %p", __func__, handle);
+                       SetLastError (ERROR_INVALID_HANDLE);
+                       return FALSE;
+               }
+
+               pid = process_handle->id;
+       }
+
+       ret = kill (pid, exitcode == -1 ? SIGKILL : SIGTERM);
+       if (ret == 0)
+               return TRUE;
+
+       switch (errno) {
+       case EINVAL: SetLastError (ERROR_INVALID_PARAMETER); break;
+       case EPERM:  SetLastError (ERROR_ACCESS_DENIED);     break;
+       case ESRCH:  SetLastError (ERROR_PROC_NOT_FOUND);    break;
+       default:     SetLastError (ERROR_GEN_FAILURE);       break;
+       }
+
+       return FALSE;
+#else
+       g_error ("kill() is not supported by this platform");
+#endif
+}
+
+MonoBoolean
+ves_icall_Microsoft_Win32_NativeMethods_GetProcessWorkingSetSize (gpointer handle, gsize *min, gsize *max)
+{
+       MonoW32HandleProcess *process_handle;
+       gboolean res;
+
+       if (!min || !max)
+               return FALSE;
+
+       if (WAPI_IS_PSEUDO_PROCESS_HANDLE (handle))
+               return FALSE;
+
+       res = mono_w32handle_lookup (handle, MONO_W32HANDLE_PROCESS, (gpointer*) &process_handle);
+       if (!res) {
+               mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Can't find process %p", __func__, handle);
+               return FALSE;
+       }
+
+       *min = process_handle->min_working_set;
+       *max = process_handle->max_working_set;
+       return TRUE;
+}
+
+MonoBoolean
+ves_icall_Microsoft_Win32_NativeMethods_SetProcessWorkingSetSize (gpointer handle, gsize min, gsize max)
+{
+       MonoW32HandleProcess *process_handle;
+       gboolean res;
+
+       if (WAPI_IS_PSEUDO_PROCESS_HANDLE (handle))
+               return FALSE;
+
+       res = mono_w32handle_lookup (handle, MONO_W32HANDLE_PROCESS, (gpointer*) &process_handle);
+       if (!res) {
+               mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Can't find process %p", __func__, handle);
+               return FALSE;
+       }
+
+       process_handle->min_working_set = min;
+       process_handle->max_working_set = max;
+       return TRUE;
+}
+
+gint32
+ves_icall_Microsoft_Win32_NativeMethods_GetPriorityClass (gpointer handle)
+{
+#ifdef HAVE_GETPRIORITY
+       MonoW32HandleProcess *process_handle;
+       gint ret;
+       pid_t pid;
+
+       if (WAPI_IS_PSEUDO_PROCESS_HANDLE (handle)) {
+               /* This is a pseudo handle */
+               pid = (pid_t)WAPI_HANDLE_TO_PID (handle);
+       } else {
+               gboolean res;
+
+               res = mono_w32handle_lookup (handle, MONO_W32HANDLE_PROCESS, (gpointer*) &process_handle);
+               if (!res) {
+                       SetLastError (ERROR_INVALID_HANDLE);
+                       return 0;
+               }
+
+               pid = process_handle->id;
+       }
+
+       errno = 0;
+       ret = getpriority (PRIO_PROCESS, pid);
+       if (ret == -1 && errno != 0) {
+               switch (errno) {
+               case EPERM:
+               case EACCES:
+                       SetLastError (ERROR_ACCESS_DENIED);
+                       break;
+               case ESRCH:
+                       SetLastError (ERROR_PROC_NOT_FOUND);
+                       break;
+               default:
+                       SetLastError (ERROR_GEN_FAILURE);
+               }
+               return 0;
+       }
+
+       if (ret == 0)
+               return MONO_W32PROCESS_PRIORITY_CLASS_NORMAL;
+       else if (ret < -15)
+               return MONO_W32PROCESS_PRIORITY_CLASS_REALTIME;
+       else if (ret < -10)
+               return MONO_W32PROCESS_PRIORITY_CLASS_HIGH;
+       else if (ret < 0)
+               return MONO_W32PROCESS_PRIORITY_CLASS_ABOVE_NORMAL;
+       else if (ret > 10)
+               return MONO_W32PROCESS_PRIORITY_CLASS_IDLE;
+       else if (ret > 0)
+               return MONO_W32PROCESS_PRIORITY_CLASS_BELOW_NORMAL;
+
+       return MONO_W32PROCESS_PRIORITY_CLASS_NORMAL;
+#else
+       SetLastError (ERROR_NOT_SUPPORTED);
+       return 0;
+#endif
+}
+
+MonoBoolean
+ves_icall_Microsoft_Win32_NativeMethods_SetPriorityClass (gpointer handle, gint32 priorityClass)
+{
+#ifdef HAVE_SETPRIORITY
+       MonoW32HandleProcess *process_handle;
+       int ret;
+       int prio;
+       pid_t pid;
+
+       if (WAPI_IS_PSEUDO_PROCESS_HANDLE (handle)) {
+               /* This is a pseudo handle */
+               pid = (pid_t)WAPI_HANDLE_TO_PID (handle);
+       } else {
+               gboolean res;
+
+               res = mono_w32handle_lookup (handle, MONO_W32HANDLE_PROCESS, (gpointer*) &process_handle);
+               if (!res) {
+                       SetLastError (ERROR_INVALID_HANDLE);
+                       return FALSE;
+               }
+
+               pid = process_handle->id;
+       }
+
+       switch (priorityClass) {
+       case MONO_W32PROCESS_PRIORITY_CLASS_IDLE:
+               prio = 19;
+               break;
+       case MONO_W32PROCESS_PRIORITY_CLASS_BELOW_NORMAL:
+               prio = 10;
+               break;
+       case MONO_W32PROCESS_PRIORITY_CLASS_NORMAL:
+               prio = 0;
+               break;
+       case MONO_W32PROCESS_PRIORITY_CLASS_ABOVE_NORMAL:
+               prio = -5;
+               break;
+       case MONO_W32PROCESS_PRIORITY_CLASS_HIGH:
+               prio = -11;
+               break;
+       case MONO_W32PROCESS_PRIORITY_CLASS_REALTIME:
+               prio = -20;
+               break;
+       default:
+               SetLastError (ERROR_INVALID_PARAMETER);
+               return FALSE;
+       }
+
+       ret = setpriority (PRIO_PROCESS, pid, prio);
+       if (ret == -1) {
+               switch (errno) {
+               case EPERM:
+               case EACCES:
+                       SetLastError (ERROR_ACCESS_DENIED);
+                       break;
+               case ESRCH:
+                       SetLastError (ERROR_PROC_NOT_FOUND);
+                       break;
+               default:
+                       SetLastError (ERROR_GEN_FAILURE);
+               }
+       }
+
+       return ret == 0;
+#else
+       SetLastError (ERROR_NOT_SUPPORTED);
+       return FALSE;
+#endif
+}
+
+static void
+ticks_to_processtime (guint64 ticks, ProcessTime *processtime)
+{
+       processtime->lowDateTime = ticks & 0xFFFFFFFF;
+       processtime->highDateTime = ticks >> 32;
+}
+
+static void
+wapifiletime_to_processtime (WapiFileTime wapi_filetime, ProcessTime *processtime)
+{
+       processtime->lowDateTime = wapi_filetime.dwLowDateTime;
+       processtime->highDateTime = wapi_filetime.dwHighDateTime;
+}
+
+MonoBoolean
+ves_icall_Microsoft_Win32_NativeMethods_GetProcessTimes (gpointer handle, gint64 *creation_time, gint64 *exit_time, gint64 *kernel_time, gint64 *user_time)
+{
+       MonoW32HandleProcess *process_handle;
+       ProcessTime *creation_processtime, *exit_processtime, *kernel_processtime, *user_processtime;
+       gboolean res;
+
+       if (!creation_time || !exit_time || !kernel_time || !user_time) {
+               /* Not sure if w32 allows NULLs here or not */
+               return FALSE;
+       }
+
+       creation_processtime = (ProcessTime*) creation_time;
+       exit_processtime = (ProcessTime*) exit_time;
+       kernel_processtime = (ProcessTime*) kernel_time;
+       user_processtime = (ProcessTime*) user_time;
+
+       memset (creation_processtime, 0, sizeof (ProcessTime));
+       memset (exit_processtime, 0, sizeof (ProcessTime));
+       memset (kernel_processtime, 0, sizeof (ProcessTime));
+       memset (user_processtime, 0, sizeof (ProcessTime));
+
+       if (WAPI_IS_PSEUDO_PROCESS_HANDLE (handle)) {
+               gint64 start_ticks, user_ticks, kernel_ticks;
+
+               mono_process_get_times (GINT_TO_POINTER (WAPI_HANDLE_TO_PID (handle)),
+                       &start_ticks, &user_ticks, &kernel_ticks);
+
+               ticks_to_processtime (start_ticks, creation_processtime);
+               ticks_to_processtime (user_ticks, kernel_processtime);
+               ticks_to_processtime (kernel_ticks, user_processtime);
+               return TRUE;
+       }
+
+       res = mono_w32handle_lookup (handle, MONO_W32HANDLE_PROCESS, (gpointer*) &process_handle);
+       if (!res) {
+               mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Can't find process %p", __func__, handle);
+               return FALSE;
+       }
+
+       wapifiletime_to_processtime (process_handle->create_time, creation_processtime);
+
+       /* A process handle is only signalled if the process has
+        * exited, otherwise exit_processtime isn't set */
+       if (mono_w32handle_issignalled (handle))
+               wapifiletime_to_processtime (process_handle->exit_time, exit_processtime);
+
+#ifdef HAVE_GETRUSAGE
+       if (process_handle->id == getpid ()) {
+               struct rusage time_data;
+               if (getrusage (RUSAGE_SELF, &time_data) == 0) {
+                       ticks_to_processtime ((guint64)time_data.ru_utime.tv_sec * 10000000 + (guint64)time_data.ru_utime.tv_usec * 10, user_processtime);
+                       ticks_to_processtime ((guint64)time_data.ru_stime.tv_sec * 10000000 + (guint64)time_data.ru_stime.tv_usec * 10, kernel_processtime);
+               }
+       }
+#endif
+
+       return TRUE;
+}
diff --git a/mono/metadata/w32process-win32-internals.h b/mono/metadata/w32process-win32-internals.h
new file mode 100644 (file)
index 0000000..a5eb90a
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2016 Microsoft
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
+ */
+#ifndef __MONO_METADATA_PROCESS_INTERNALS_H__
+#define __MONO_METADATA_PROCESS_INTERNALS_H__
+
+#include <config.h>
+#include <glib.h>
+
+// On platforms not using classic WIN API support the  implementation of bellow methods are hosted in separate source file
+// process-windows-*.c. On platforms using classic WIN API the implementation is still keept in process.c and still declared
+// static and in some places even inlined.
+#if !G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
+void
+mono_w32process_get_fileversion (MonoObject *filever, gunichar2 *filename, MonoError *error);
+
+void
+mono_process_init_startup_info (HANDLE stdin_handle, HANDLE stdout_handle,
+                               HANDLE stderr_handle,STARTUPINFO *startinfo);
+
+gboolean
+mono_process_create_process (MonoW32ProcessInfo *mono_process_info, gunichar2 *shell_path, MonoString *cmd,
+                            guint32 creation_flags, gchar *env_vars, gunichar2 *dir, STARTUPINFO *start_info,
+                            PROCESS_INFORMATION *process_info);
+
+MonoBoolean
+mono_icall_get_process_working_set_size (gpointer handle, gsize *min, gsize *max);
+
+MonoBoolean
+mono_icall_set_process_working_set_size (gpointer handle, gsize min, gsize max);
+
+gint32
+mono_icall_get_priority_class (gpointer handle);
+
+MonoBoolean
+mono_icall_set_priority_class (gpointer handle, gint32 priorityClass);
+
+gboolean
+mono_process_win_enum_processes (DWORD *pids, DWORD count, DWORD *needed);
+#endif  /* !G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */
+
+#endif /* __MONO_METADATA_PROCESS_INTERNALS_H__ */
diff --git a/mono/metadata/w32process-win32-uwp.c b/mono/metadata/w32process-win32-uwp.c
new file mode 100644 (file)
index 0000000..cbd46b7
--- /dev/null
@@ -0,0 +1,223 @@
+/*
+ * process-windows-uwp.c: UWP process support for Mono.
+ *
+ * Copyright 2016 Microsoft
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
+*/
+#include <config.h>
+#include <glib.h>
+#include "mono/utils/mono-compiler.h"
+
+#if G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT)
+#include <windows.h>
+#include <mono/metadata/object-internals.h>
+#include "mono/metadata/w32process.h"
+#include "mono/metadata/w32process-internals.h"
+#include "mono/metadata/w32process-win32-internals.h"
+
+gboolean
+mono_process_win_enum_processes (DWORD *pids, DWORD count, DWORD *needed)
+{
+       g_unsupported_api ("EnumProcesses");
+       *needed = 0;
+       SetLastError (ERROR_NOT_SUPPORTED);
+
+       return FALSE;
+}
+
+HANDLE
+ves_icall_System_Diagnostics_Process_GetProcess_internal (guint32 pid)
+{
+       MonoError mono_error;
+       mono_error_init (&mono_error);
+
+       g_unsupported_api ("OpenProcess");
+
+       mono_error_set_not_supported (&mono_error, G_UNSUPPORTED_API, "OpenProcess");
+       mono_error_set_pending_exception (&mono_error);
+
+       SetLastError (ERROR_NOT_SUPPORTED);
+
+       return NULL;
+}
+
+void
+mono_w32process_get_fileversion (MonoObject *filever, gunichar2 *filename, MonoError *error)
+{
+       g_unsupported_api ("GetFileVersionInfoSize, GetFileVersionInfo, VerQueryValue, VerLanguageName");
+
+       mono_error_init (error);
+       mono_error_set_not_supported (error, G_UNSUPPORTED_API, "GetFileVersionInfoSize, GetFileVersionInfo, VerQueryValue, VerLanguageName");
+
+       SetLastError (ERROR_NOT_SUPPORTED);
+}
+
+MonoObject*
+process_add_module (HANDLE process, HMODULE mod, gunichar2 *filename, gunichar2 *modulename, MonoClass *proc_class, MonoError *error)
+{
+       g_unsupported_api ("GetModuleInformation");
+
+       mono_error_init (error);
+       mono_error_set_not_supported (error, G_UNSUPPORTED_API, "GetModuleInformation");
+
+       SetLastError (ERROR_NOT_SUPPORTED);
+
+       return NULL;
+}
+
+MonoArray *
+ves_icall_System_Diagnostics_Process_GetModules_internal (MonoObject *this_obj, HANDLE process)
+{
+       MonoError mono_error;
+       mono_error_init (&mono_error);
+
+       g_unsupported_api ("EnumProcessModules, GetModuleBaseName, GetModuleFileNameEx");
+
+       mono_error_set_not_supported (&mono_error, G_UNSUPPORTED_API, "EnumProcessModules, GetModuleBaseName, GetModuleFileNameEx");
+       mono_error_set_pending_exception (&mono_error);
+
+       SetLastError (ERROR_NOT_SUPPORTED);
+
+       return NULL;
+}
+
+MonoBoolean
+ves_icall_System_Diagnostics_Process_ShellExecuteEx_internal (MonoW32ProcessStartInfo *proc_start_info, MonoW32ProcessInfo *process_info)
+{
+       MonoError mono_error;
+       mono_error_init (&mono_error);
+
+       g_unsupported_api ("ShellExecuteEx");
+
+       mono_error_set_not_supported (&mono_error, G_UNSUPPORTED_API, "ShellExecuteEx");
+       mono_error_set_pending_exception (&mono_error);
+
+       process_info->pid = (guint32)(-ERROR_NOT_SUPPORTED);
+       SetLastError (ERROR_NOT_SUPPORTED);
+
+       return FALSE;
+}
+
+MonoString *
+ves_icall_System_Diagnostics_Process_ProcessName_internal (HANDLE process)
+{
+       MonoError error;
+       MonoString *string;
+       gunichar2 name[MAX_PATH];
+       guint32 len;
+
+       len = GetModuleFileName (NULL, name, G_N_ELEMENTS (name));
+       if (len == 0)
+               return NULL;
+
+       string = mono_string_new_utf16_checked (mono_domain_get (), name, len, &error);
+       if (!mono_error_ok (&error))
+               mono_error_set_pending_exception (&error);
+
+       return string;
+}
+
+void
+mono_process_init_startup_info (HANDLE stdin_handle, HANDLE stdout_handle, HANDLE stderr_handle, STARTUPINFO *startinfo)
+{
+       startinfo->cb = sizeof(STARTUPINFO);
+       startinfo->dwFlags = 0;
+       startinfo->hStdInput = INVALID_HANDLE_VALUE;
+       startinfo->hStdOutput = INVALID_HANDLE_VALUE;
+       startinfo->hStdError = INVALID_HANDLE_VALUE;
+       return;
+}
+
+gboolean
+mono_process_create_process (MonoW32ProcessInfo *mono_process_info, gunichar2 *shell_path, MonoString *cmd, guint32 creation_flags,
+                            gchar *env_vars, gunichar2 *dir, STARTUPINFO *start_info, PROCESS_INFORMATION *process_info)
+{
+       MonoError       mono_error;
+       gchar           *api_name = "";
+
+       if (mono_process_info->username) {
+               api_name = "CreateProcessWithLogonW";
+       } else {
+               api_name = "CreateProcess";
+       }
+
+       memset (&process_info, 0, sizeof (PROCESS_INFORMATION));
+       g_unsupported_api (api_name);
+
+       mono_error_init (&mono_error);
+       mono_error_set_not_supported (&mono_error, G_UNSUPPORTED_API, api_name);
+       mono_error_set_pending_exception (&mono_error);
+
+       SetLastError (ERROR_NOT_SUPPORTED);
+
+       return FALSE;
+}
+
+MonoBoolean
+mono_icall_get_process_working_set_size (gpointer handle, gsize *min, gsize *max)
+{
+       MonoError mono_error;
+       mono_error_init (&mono_error);
+
+       g_unsupported_api ("GetProcessWorkingSetSize");
+
+       mono_error_set_not_supported(&mono_error, G_UNSUPPORTED_API, "GetProcessWorkingSetSize");
+       mono_error_set_pending_exception (&mono_error);
+
+       SetLastError (ERROR_NOT_SUPPORTED);
+
+       return FALSE;
+}
+
+MonoBoolean
+mono_icall_set_process_working_set_size (gpointer handle, gsize min, gsize max)
+{
+       MonoError mono_error;
+       mono_error_init (&mono_error);
+
+       g_unsupported_api ("SetProcessWorkingSetSize");
+
+       mono_error_set_not_supported (&mono_error, G_UNSUPPORTED_API, "SetProcessWorkingSetSize");
+       mono_error_set_pending_exception (&mono_error);
+
+       SetLastError (ERROR_NOT_SUPPORTED);
+
+       return FALSE;
+}
+
+gint32
+mono_icall_get_priority_class (gpointer handle)
+{
+       MonoError mono_error;
+       mono_error_init (&mono_error);
+
+       g_unsupported_api ("GetPriorityClass");
+
+       mono_error_set_not_supported (&mono_error, G_UNSUPPORTED_API, "GetPriorityClass");
+       mono_error_set_pending_exception (&mono_error);
+
+       SetLastError (ERROR_NOT_SUPPORTED);
+
+       return FALSE;
+}
+
+MonoBoolean
+mono_icall_set_priority_class (gpointer handle, gint32 priorityClass)
+{
+       MonoError mono_error;
+       mono_error_init (&mono_error);
+
+       g_unsupported_api ("SetPriorityClass");
+
+       mono_error_set_not_supported(&mono_error, G_UNSUPPORTED_API, "SetPriorityClass");
+       mono_error_set_pending_exception (&mono_error);
+
+       SetLastError (ERROR_NOT_SUPPORTED);
+
+       return FALSE;
+}
+
+#else /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
+
+MONO_EMPTY_SOURCE_FILE (process_windows_uwp);
+#endif /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
diff --git a/mono/metadata/w32process-win32.c b/mono/metadata/w32process-win32.c
new file mode 100644 (file)
index 0000000..15cfd4d
--- /dev/null
@@ -0,0 +1,500 @@
+/*
+ * process.c: System.Diagnostics.Process support
+ *
+ * Author:
+ *     Dick Porter (dick@ximian.com)
+ *
+ * Copyright 2002 Ximian, Inc.
+ * Copyright 2002-2006 Novell, Inc.
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
+ */
+
+#include <config.h>
+
+#include <glib.h>
+#include <string.h>
+
+#include <winsock2.h>
+#include <windows.h>
+
+#include <mono/metadata/object-internals.h>
+#include <mono/metadata/w32process.h>
+#include <mono/metadata/w32process-win32-internals.h>
+#include <mono/metadata/assembly.h>
+#include <mono/metadata/appdomain.h>
+#include <mono/metadata/image.h>
+#include <mono/metadata/cil-coff.h>
+#include <mono/metadata/exception.h>
+#include <mono/metadata/threadpool-ms-io.h>
+#include <mono/utils/strenc.h>
+#include <mono/utils/mono-proclib.h>
+#include <mono/io-layer/io-layer.h>
+/* FIXME: fix this code to not depend so much on the internals */
+#include <mono/metadata/class-internals.h>
+#include <mono/metadata/w32handle.h>
+
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
+#include <shellapi.h>
+#endif
+
+void
+mono_w32process_init (void)
+{
+}
+
+void
+mono_w32process_cleanup (void)
+{
+}
+
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
+HANDLE
+ves_icall_System_Diagnostics_Process_GetProcess_internal (guint32 pid)
+{
+       HANDLE handle;
+       
+       /* GetCurrentProcess returns a pseudo-handle, so use
+        * OpenProcess instead
+        */
+       handle = OpenProcess (PROCESS_ALL_ACCESS, TRUE, pid);
+       if (handle == NULL)
+               /* FIXME: Throw an exception */
+               return NULL;
+       return handle;
+}
+#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT | HAVE_UWP_WINAPI_SUPPORT) */
+
+static gchar*
+mono_process_unquote_application_name (gchar *appname)
+{
+       size_t len = strlen (appname);
+       if (len) {
+               if (appname[len-1] == '\"')
+                       appname[len-1] = '\0';
+               if (appname[0] == '\"')
+                       appname++;
+       }
+
+       return appname;
+}
+
+static gchar*
+mono_process_quote_path (const gchar *path)
+{
+       gchar *res = g_shell_quote (path);
+       gchar *q = res;
+       while (*q) {
+               if (*q == '\'')
+                       *q = '\"';
+               q++;
+       }
+       return res;
+}
+
+/* Only used when UseShellExecute is false */
+static gboolean
+mono_process_complete_path (const gunichar2 *appname, gchar **completed)
+{
+       gchar *utf8app, *utf8appmemory;
+       gchar *found;
+
+       utf8appmemory = g_utf16_to_utf8 (appname, -1, NULL, NULL, NULL);
+       utf8app = mono_process_unquote_application_name (utf8appmemory);
+
+       if (g_path_is_absolute (utf8app)) {
+               *completed = mono_process_quote_path (utf8app);
+               g_free (utf8appmemory);
+               return TRUE;
+       }
+
+       if (g_file_test (utf8app, G_FILE_TEST_IS_EXECUTABLE) && !g_file_test (utf8app, G_FILE_TEST_IS_DIR)) {
+               *completed = mono_process_quote_path (utf8app);
+               g_free (utf8appmemory);
+               return TRUE;
+       }
+       
+       found = g_find_program_in_path (utf8app);
+       if (found == NULL) {
+               *completed = NULL;
+               g_free (utf8appmemory);
+               return FALSE;
+       }
+
+       *completed = mono_process_quote_path (found);
+       g_free (found);
+       g_free (utf8appmemory);
+       return TRUE;
+}
+
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
+MonoBoolean
+ves_icall_System_Diagnostics_Process_ShellExecuteEx_internal (MonoW32ProcessStartInfo *proc_start_info, MonoW32ProcessInfo *process_info)
+{
+       SHELLEXECUTEINFO shellex = {0};
+       gboolean ret;
+
+       shellex.cbSize = sizeof(SHELLEXECUTEINFO);
+       shellex.fMask = (gulong)(SEE_MASK_FLAG_DDEWAIT | SEE_MASK_NOCLOSEPROCESS | SEE_MASK_UNICODE);
+       shellex.nShow = (gulong)proc_start_info->window_style;
+       shellex.nShow = (gulong)((shellex.nShow == 0) ? 1 : (shellex.nShow == 1 ? 0 : shellex.nShow));
+
+       if (proc_start_info->filename != NULL) {
+               shellex.lpFile = mono_string_chars (proc_start_info->filename);
+       }
+
+       if (proc_start_info->arguments != NULL) {
+               shellex.lpParameters = mono_string_chars (proc_start_info->arguments);
+       }
+
+       if (proc_start_info->verb != NULL &&
+           mono_string_length (proc_start_info->verb) != 0) {
+               shellex.lpVerb = mono_string_chars (proc_start_info->verb);
+       }
+
+       if (proc_start_info->working_directory != NULL &&
+           mono_string_length (proc_start_info->working_directory) != 0) {
+               shellex.lpDirectory = mono_string_chars (proc_start_info->working_directory);
+       }
+
+       if (proc_start_info->error_dialog) {    
+               shellex.hwnd = proc_start_info->error_dialog_parent_handle;
+       } else {
+               shellex.fMask = (gulong)(shellex.fMask | SEE_MASK_FLAG_NO_UI);
+       }
+
+       ret = ShellExecuteEx (&shellex);
+       if (ret == FALSE) {
+               process_info->pid = -GetLastError ();
+       } else {
+               process_info->process_handle = shellex.hProcess;
+               process_info->thread_handle = NULL;
+#if !defined(MONO_CROSS_COMPILE)
+               process_info->pid = GetProcessId (shellex.hProcess);
+#else
+               process_info->pid = 0;
+#endif
+               process_info->tid = 0;
+       }
+
+       return ret;
+}
+#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */
+
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
+static inline void
+mono_process_init_startup_info (HANDLE stdin_handle, HANDLE stdout_handle, HANDLE stderr_handle, STARTUPINFO *startinfo)
+{
+       startinfo->cb = sizeof(STARTUPINFO);
+       startinfo->dwFlags = STARTF_USESTDHANDLES;
+       startinfo->hStdInput = stdin_handle;
+       startinfo->hStdOutput = stdout_handle;
+       startinfo->hStdError = stderr_handle;
+       return;
+}
+#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */
+
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
+static gboolean
+mono_process_create_process (MonoW32ProcessInfo *mono_process_info, gunichar2 *shell_path,
+                            MonoString *cmd, guint32 creation_flags, gchar *env_vars,
+                            gunichar2 *dir, STARTUPINFO *start_info, PROCESS_INFORMATION *process_info)
+{
+       gboolean result = FALSE;
+
+       if (mono_process_info->username) {
+               guint32 logon_flags = mono_process_info->load_user_profile ? LOGON_WITH_PROFILE : 0;
+
+               result = CreateProcessWithLogonW (mono_string_chars (mono_process_info->username),
+                                                 mono_process_info->domain ? mono_string_chars (mono_process_info->domain) : NULL,
+                                                 (const gunichar2 *)mono_process_info->password,
+                                                 logon_flags,
+                                                 shell_path,
+                                                 cmd ? mono_string_chars (cmd) : NULL,
+                                                 creation_flags,
+                                                 env_vars, dir, start_info, process_info);
+
+       } else {
+
+               result = CreateProcess (shell_path,
+                                       cmd ? mono_string_chars (cmd): NULL,
+                                       NULL,
+                                       NULL,
+                                       TRUE,
+                                       creation_flags,
+                                       env_vars,
+                                       dir,
+                                       start_info,
+                                       process_info);
+
+       }
+
+       return result;
+}
+#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */
+
+static gboolean
+mono_process_get_shell_arguments (MonoW32ProcessStartInfo *proc_start_info, gunichar2 **shell_path, MonoString **cmd)
+{
+       gchar           *spath = NULL;
+       gchar           *new_cmd, *cmd_utf8;
+       MonoError       mono_error;
+
+       *shell_path = NULL;
+       *cmd = proc_start_info->arguments;
+
+       mono_process_complete_path (mono_string_chars (proc_start_info->filename), &spath);
+       if (spath != NULL) {
+               /* Seems like our CreateProcess does not work as the windows one.
+                * This hack is needed to deal with paths containing spaces */
+               if (*cmd) {
+                       cmd_utf8 = mono_string_to_utf8_checked (*cmd, &mono_error);
+                       if (!mono_error_set_pending_exception (&mono_error)) {
+                               new_cmd = g_strdup_printf ("%s %s", spath, cmd_utf8);
+                               *cmd = mono_string_new_wrapper (new_cmd);
+                               g_free (cmd_utf8);
+                               g_free (new_cmd);
+                       } else {
+                               *cmd = NULL;
+                       }
+               }
+               else {
+                       *cmd = mono_string_new_wrapper (spath);
+               }
+
+               g_free (spath);
+       }
+
+       return (*cmd != NULL) ? TRUE : FALSE;
+}
+
+MonoBoolean
+ves_icall_System_Diagnostics_Process_CreateProcess_internal (MonoW32ProcessStartInfo *proc_start_info, HANDLE stdin_handle,
+                                                            HANDLE stdout_handle, HANDLE stderr_handle, MonoW32ProcessInfo *process_info)
+{
+       gboolean ret;
+       gunichar2 *dir;
+       STARTUPINFO startinfo={0};
+       PROCESS_INFORMATION procinfo;
+       gunichar2 *shell_path = NULL;
+       gchar *env_vars = NULL;
+       MonoString *cmd = NULL;
+       guint32 creation_flags;
+
+       mono_process_init_startup_info (stdin_handle, stdout_handle, stderr_handle, &startinfo);
+
+       creation_flags = CREATE_UNICODE_ENVIRONMENT;
+       if (proc_start_info->create_no_window)
+               creation_flags |= CREATE_NO_WINDOW;
+       
+       if (mono_process_get_shell_arguments (proc_start_info, &shell_path, &cmd) == FALSE) {
+               process_info->pid = -ERROR_FILE_NOT_FOUND;
+               return FALSE;
+       }
+
+       if (process_info->env_keys) {
+               gint i, len; 
+               MonoString *ms;
+               MonoString *key, *value;
+               gunichar2 *str, *ptr;
+               gunichar2 *equals16;
+
+               for (len = 0, i = 0; i < mono_array_length (process_info->env_keys); i++) {
+                       ms = mono_array_get (process_info->env_values, MonoString *, i);
+                       if (ms == NULL)
+                               continue;
+
+                       len += mono_string_length (ms) * sizeof (gunichar2);
+                       ms = mono_array_get (process_info->env_keys, MonoString *, i);
+                       len += mono_string_length (ms) * sizeof (gunichar2);
+                       len += 2 * sizeof (gunichar2);
+               }
+
+               equals16 = g_utf8_to_utf16 ("=", 1, NULL, NULL, NULL);
+               ptr = str = g_new0 (gunichar2, len + 1);
+               for (i = 0; i < mono_array_length (process_info->env_keys); i++) {
+                       value = mono_array_get (process_info->env_values, MonoString *, i);
+                       if (value == NULL)
+                               continue;
+
+                       key = mono_array_get (process_info->env_keys, MonoString *, i);
+                       memcpy (ptr, mono_string_chars (key), mono_string_length (key) * sizeof (gunichar2));
+                       ptr += mono_string_length (key);
+
+                       memcpy (ptr, equals16, sizeof (gunichar2));
+                       ptr++;
+
+                       memcpy (ptr, mono_string_chars (value), mono_string_length (value) * sizeof (gunichar2));
+                       ptr += mono_string_length (value);
+                       ptr++;
+               }
+
+               g_free (equals16);
+               env_vars = (gchar *) str;
+       }
+       
+       /* The default dir name is "".  Turn that into NULL to mean
+        * "current directory"
+        */
+       if (proc_start_info->working_directory == NULL || mono_string_length (proc_start_info->working_directory) == 0)
+               dir = NULL;
+       else
+               dir = mono_string_chars (proc_start_info->working_directory);
+
+       ret = mono_process_create_process (process_info, shell_path, cmd, creation_flags, env_vars, dir, &startinfo, &procinfo);
+
+       g_free (env_vars);
+       if (shell_path != NULL)
+               g_free (shell_path);
+
+       if (ret) {
+               process_info->process_handle = procinfo.hProcess;
+               /*process_info->thread_handle=procinfo.hThread;*/
+               process_info->thread_handle = NULL;
+               if (procinfo.hThread != NULL && procinfo.hThread != INVALID_HANDLE_VALUE)
+                       CloseHandle (procinfo.hThread);
+               process_info->pid = procinfo.dwProcessId;
+               process_info->tid = procinfo.dwThreadId;
+       } else {
+               process_info->pid = -GetLastError ();
+       }
+       
+       return ret;
+}
+
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
+static inline gboolean
+mono_process_win_enum_processes (DWORD *pids, DWORD count, DWORD *needed)
+{
+       return EnumProcesses (pids, count, needed);
+}
+#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */
+
+MonoArray *
+ves_icall_System_Diagnostics_Process_GetProcesses_internal (void)
+{
+       MonoError error;
+       MonoArray *procs;
+       gboolean ret;
+       DWORD needed;
+       int count;
+       DWORD *pids;
+
+       count = 512;
+       do {
+               pids = g_new0 (DWORD, count);
+               ret = mono_process_win_enum_processes (pids, count * sizeof (guint32), &needed);
+               if (ret == FALSE) {
+                       MonoException *exc;
+
+                       g_free (pids);
+                       pids = NULL;
+                       exc = mono_get_exception_not_supported ("This system does not support EnumProcesses");
+                       mono_set_pending_exception (exc);
+                       return NULL;
+               }
+               if (needed < (count * sizeof (guint32)))
+                       break;
+               g_free (pids);
+               pids = NULL;
+               count = (count * 3) / 2;
+       } while (TRUE);
+
+       count = needed / sizeof (guint32);
+       procs = mono_array_new_checked (mono_domain_get (), mono_get_int32_class (), count, &error);
+       if (mono_error_set_pending_exception (&error)) {
+               g_free (pids);
+               return NULL;
+       }
+
+       memcpy (mono_array_addr (procs, guint32, 0), pids, needed);
+       g_free (pids);
+       pids = NULL;
+
+       return procs;
+}
+
+MonoBoolean
+ves_icall_Microsoft_Win32_NativeMethods_CloseProcess (gpointer handle)
+{
+       return CloseHandle (handle);
+}
+
+MonoBoolean
+ves_icall_Microsoft_Win32_NativeMethods_TerminateProcess (gpointer handle, gint32 exitcode)
+{
+       return TerminateProcess (handle, exitcode);
+}
+
+MonoBoolean
+ves_icall_Microsoft_Win32_NativeMethods_GetExitCodeProcess (gpointer handle, gint32 *exitcode)
+{
+       return GetExitCodeProcess (handle, exitcode);
+}
+
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
+static inline MonoBoolean
+mono_icall_get_process_working_set_size (gpointer handle, gsize *min, gsize *max)
+{
+       return GetProcessWorkingSetSize (handle, min, max);
+}
+#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */
+
+MonoBoolean
+ves_icall_Microsoft_Win32_NativeMethods_GetProcessWorkingSetSize (gpointer handle, gsize *min, gsize *max)
+{
+       return mono_icall_get_process_working_set_size (handle, min, max);
+}
+
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
+static inline MonoBoolean
+mono_icall_set_process_working_set_size (gpointer handle, gsize min, gsize max)
+{
+       return SetProcessWorkingSetSize (handle, min, max);
+}
+#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */
+
+MonoBoolean
+ves_icall_Microsoft_Win32_NativeMethods_SetProcessWorkingSetSize (gpointer handle, gsize min, gsize max)
+{
+       return mono_icall_set_process_working_set_size (handle, min, max);
+}
+
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
+static inline gint32
+mono_icall_get_priority_class (gpointer handle)
+{
+       return GetPriorityClass (handle);
+}
+#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */
+
+gint32
+ves_icall_Microsoft_Win32_NativeMethods_GetPriorityClass (gpointer handle)
+{
+       return mono_icall_get_priority_class (handle);
+}
+
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
+static inline MonoBoolean
+mono_icall_set_priority_class (gpointer handle, gint32 priorityClass)
+{
+       return SetPriorityClass (handle, (guint32) priorityClass);
+}
+#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */
+
+MonoBoolean
+ves_icall_Microsoft_Win32_NativeMethods_SetPriorityClass (gpointer handle, gint32 priorityClass)
+{
+       return mono_icall_set_priority_class (handle, priorityClass);
+}
+
+MonoBoolean
+ves_icall_Microsoft_Win32_NativeMethods_GetProcessTimes (gpointer handle, gint64 *creationtime, gint64 *exittime, gint64 *kerneltime, gint64 *usertime)
+{
+       return GetProcessTimes (handle, (LPFILETIME) creationtime, (LPFILETIME) exittime, (LPFILETIME) kerneltime, (LPFILETIME) usertime);
+}
+
+gpointer
+ves_icall_Microsoft_Win32_NativeMethods_GetCurrentProcess (void)
+{
+       return GetCurrentProcess ();
+}
diff --git a/mono/metadata/w32process.c b/mono/metadata/w32process.c
new file mode 100644 (file)
index 0000000..614168e
--- /dev/null
@@ -0,0 +1,624 @@
+
+#include <glib.h>
+
+#include "w32process.h"
+#include "w32process-internals.h"
+#include "w32process-win32-internals.h"
+#include "object.h"
+#include "object-internals.h"
+#include "class.h"
+#include "class-internals.h"
+#include "image.h"
+#include "utils/mono-proclib.h"
+
+#define LOGDEBUG(...)
+/* define LOGDEBUG(...) g_message(__VA_ARGS__)  */
+
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) && defined(HOST_WIN32)
+
+static guint32
+mono_w32process_get_pid (gpointer handle)
+{
+       return GetProcessId (handle);
+}
+
+static gboolean
+mono_w32process_try_get_modules (gpointer process, gpointer *modules, guint32 size, guint32 *needed)
+{
+       return EnumProcessModules (process, (HMODULE *) modules, size, (LPDWORD) needed);
+}
+
+static guint32
+mono_w32process_module_get_name (gpointer process, gpointer module, gunichar2 *basename, guint32 size)
+{
+       return GetModuleBaseName (process, module, basename, size);
+}
+
+static guint32
+mono_w32process_module_get_filename (gpointer process, gpointer module, gunichar2 *basename, guint32 size)
+{
+       return GetModuleFileNameEx (process, module, basename, size);
+}
+
+static gboolean
+mono_w32process_module_get_information (gpointer process, gpointer module, MODULEINFO *modinfo, guint32 size)
+{
+       return GetModuleInformation (process, module, modinfo, size);
+}
+
+#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) && defined(HOST_WIN32) */
+
+static MonoImage *system_image;
+
+static void
+stash_system_image (MonoImage *image)
+{
+       system_image = image;
+}
+
+static MonoClass*
+get_file_version_info_class (void)
+{
+       static MonoClass *file_version_info_class;
+
+       if (file_version_info_class)
+               return file_version_info_class;
+
+       g_assert (system_image);
+
+       return file_version_info_class = mono_class_load_from_name (
+               system_image, "System.Diagnostics", "FileVersionInfo");
+}
+
+static MonoClass*
+get_process_module_class (void)
+{
+       static MonoClass *process_module_class;
+
+       if (process_module_class)
+               return process_module_class;
+
+       g_assert (system_image);
+
+       return process_module_class = mono_class_load_from_name (
+               system_image, "System.Diagnostics", "ProcessModule");
+}
+
+static guint32
+unicode_chars (const gunichar2 *str)
+{
+       guint32 len;
+       for (len = 0; str [len] != '\0'; ++len) {}
+       return len;
+}
+
+static void
+process_set_field_object (MonoObject *obj, const gchar *fieldname, MonoObject *data)
+{
+       MonoClass *klass;
+       MonoClassField *field;
+
+       LOGDEBUG (g_message ("%s: Setting field %s to object at %p", __func__, fieldname, data));
+
+       klass = mono_object_class (obj);
+       g_assert (klass);
+
+       field = mono_class_get_field_from_name (klass, fieldname);
+       g_assert (field);
+
+       mono_gc_wbarrier_generic_store (((char *)obj) + field->offset, data);
+}
+
+static void
+process_set_field_string (MonoObject *obj, const gchar *fieldname, const gunichar2 *val, guint32 len, MonoError *error)
+{
+       MonoDomain *domain;
+       MonoClass *klass;
+       MonoClassField *field;
+       MonoString *string;
+
+       mono_error_init (error);
+
+       LOGDEBUG (g_message ("%s: Setting field %s to [%s]", __func__, fieldname, g_utf16_to_utf8 (val, len, NULL, NULL, NULL)));
+
+       domain = mono_object_domain (obj);
+       g_assert (domain);
+
+       klass = mono_object_class (obj);
+       g_assert (klass);
+
+       field = mono_class_get_field_from_name (klass, fieldname);
+       g_assert (field);
+
+       string = mono_string_new_utf16_checked (domain, val, len, error);
+       return_if_nok (error);
+
+       mono_gc_wbarrier_generic_store (((char *)obj) + field->offset, (MonoObject*)string);
+}
+
+static void
+process_set_field_string_char (MonoObject *obj, const gchar *fieldname, const gchar *val)
+{
+       MonoDomain *domain;
+       MonoClass *klass;
+       MonoClassField *field;
+       MonoString *string;
+
+       LOGDEBUG (g_message ("%s: Setting field %s to [%s]", __func__, fieldname, val));
+
+       domain = mono_object_domain (obj);
+       g_assert (domain);
+
+       klass = mono_object_class (obj);
+       g_assert (klass);
+
+       field = mono_class_get_field_from_name (klass, fieldname);
+       g_assert (field);
+
+       string = mono_string_new (domain, val);
+
+       mono_gc_wbarrier_generic_store (((char *)obj) + field->offset, (MonoObject*)string);
+}
+
+static void
+process_set_field_int (MonoObject *obj, const gchar *fieldname, guint32 val)
+{
+       MonoClass *klass;
+       MonoClassField *field;
+
+       LOGDEBUG (g_message ("%s: Setting field %s to %d", __func__,fieldname, val));
+
+       klass = mono_object_class (obj);
+       g_assert (klass);
+
+       field = mono_class_get_field_from_name (klass, fieldname);
+       g_assert (field);
+
+       *(guint32 *)(((char *)obj) + field->offset)=val;
+}
+
+static void
+process_set_field_intptr (MonoObject *obj, const gchar *fieldname, gpointer val)
+{
+       MonoClass *klass;
+       MonoClassField *field;
+
+       LOGDEBUG (g_message ("%s: Setting field %s to %p", __func__, fieldname, val));
+
+       klass = mono_object_class (obj);
+       g_assert (klass);
+
+       field = mono_class_get_field_from_name (klass, fieldname);
+       g_assert (field);
+
+       *(gpointer *)(((char *)obj) + field->offset) = val;
+}
+
+static void
+process_set_field_bool (MonoObject *obj, const gchar *fieldname, gboolean val)
+{
+       MonoClass *klass;
+       MonoClassField *field;
+
+       LOGDEBUG (g_message ("%s: Setting field %s to %s", __func__, fieldname, val ? "TRUE":"FALSE"));
+
+       klass = mono_object_class (obj);
+       g_assert (klass);
+
+       field = mono_class_get_field_from_name (klass, fieldname);
+       g_assert (field);
+
+       *(guint8 *)(((char *)obj) + field->offset) = val;
+}
+
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
+
+#define SFI_COMMENTS           "\\StringFileInfo\\%02X%02X%02X%02X\\Comments"
+#define SFI_COMPANYNAME                "\\StringFileInfo\\%02X%02X%02X%02X\\CompanyName"
+#define SFI_FILEDESCRIPTION    "\\StringFileInfo\\%02X%02X%02X%02X\\FileDescription"
+#define SFI_FILEVERSION                "\\StringFileInfo\\%02X%02X%02X%02X\\FileVersion"
+#define SFI_INTERNALNAME       "\\StringFileInfo\\%02X%02X%02X%02X\\InternalName"
+#define SFI_LEGALCOPYRIGHT     "\\StringFileInfo\\%02X%02X%02X%02X\\LegalCopyright"
+#define SFI_LEGALTRADEMARKS    "\\StringFileInfo\\%02X%02X%02X%02X\\LegalTrademarks"
+#define SFI_ORIGINALFILENAME   "\\StringFileInfo\\%02X%02X%02X%02X\\OriginalFilename"
+#define SFI_PRIVATEBUILD       "\\StringFileInfo\\%02X%02X%02X%02X\\PrivateBuild"
+#define SFI_PRODUCTNAME                "\\StringFileInfo\\%02X%02X%02X%02X\\ProductName"
+#define SFI_PRODUCTVERSION     "\\StringFileInfo\\%02X%02X%02X%02X\\ProductVersion"
+#define SFI_SPECIALBUILD       "\\StringFileInfo\\%02X%02X%02X%02X\\SpecialBuild"
+#define EMPTY_STRING           (gunichar2*)"\000\000"
+
+typedef struct {
+       const char *name;
+       const char *id;
+} StringTableEntry;
+
+static StringTableEntry stringtable_entries [] = {
+       { "comments", SFI_COMMENTS },
+       { "companyname", SFI_COMPANYNAME },
+       { "filedescription", SFI_FILEDESCRIPTION },
+       { "fileversion", SFI_FILEVERSION },
+       { "internalname", SFI_INTERNALNAME },
+       { "legalcopyright", SFI_LEGALCOPYRIGHT },
+       { "legaltrademarks", SFI_LEGALTRADEMARKS },
+       { "originalfilename", SFI_ORIGINALFILENAME },
+       { "privatebuild", SFI_PRIVATEBUILD },
+       { "productname", SFI_PRODUCTNAME },
+       { "productversion", SFI_PRODUCTVERSION },
+       { "specialbuild", SFI_SPECIALBUILD }
+};
+
+static void
+process_module_string_read (MonoObject *filever, gpointer data, const gchar *fieldname,
+               guchar lang_hi, guchar lang_lo, const gchar *key, MonoError *error)
+{
+       gchar *lang_key_utf8;
+       gunichar2 *lang_key, *buffer;
+       UINT chars;
+
+       mono_error_init (error);
+
+       lang_key_utf8 = g_strdup_printf (key, lang_lo, lang_hi, 0x04, 0xb0);
+
+       LOGDEBUG (g_message ("%s: asking for [%s]", __func__, lang_key_utf8));
+
+       lang_key = g_utf8_to_utf16 (lang_key_utf8, -1, NULL, NULL, NULL);
+
+       if (VerQueryValue (data, lang_key, (gpointer *)&buffer, &chars) && chars > 0) {
+               LOGDEBUG (g_message ("%s: found %d chars of [%s]", __func__, chars, g_utf16_to_utf8 (buffer, chars, NULL, NULL, NULL)));
+               /* chars includes trailing null */
+               process_set_field_string (filever, fieldname, buffer, chars - 1, error);
+       } else {
+               process_set_field_string (filever, fieldname, EMPTY_STRING, 0, error);
+       }
+
+       g_free (lang_key);
+       g_free (lang_key_utf8);
+}
+
+static void
+process_module_stringtable (MonoObject *filever, gpointer data, guchar lang_hi, guchar lang_lo, MonoError *error)
+{
+       for (int i = 0; i < G_N_ELEMENTS (stringtable_entries); ++i) {
+               process_module_string_read (filever, data, stringtable_entries [i].name,
+                       lang_hi, lang_lo, stringtable_entries [i].id, error);
+               return_if_nok (error);
+       }
+}
+
+static void
+mono_w32process_get_fileversion (MonoObject *filever, gunichar2 *filename, MonoError *error)
+{
+       DWORD verinfohandle;
+       VS_FIXEDFILEINFO *ffi;
+       gpointer data;
+       DWORD datalen;
+       guchar *trans_data;
+       gunichar2 *query;
+       UINT ffi_size, trans_size;
+       BOOL ok;
+       gunichar2 lang_buf[128];
+       guint32 lang, lang_count;
+
+       mono_error_init (error);
+
+       datalen = GetFileVersionInfoSize (filename, &verinfohandle);
+       if (datalen) {
+               data = g_malloc0 (datalen);
+               ok = GetFileVersionInfo (filename, verinfohandle, datalen, data);
+               if (ok) {
+                       query = g_utf8_to_utf16 ("\\", -1, NULL, NULL, NULL);
+                       if (query == NULL) {
+                               g_free (data);
+                               return;
+                       }
+
+                       if (VerQueryValue (data, query, (gpointer *)&ffi, &ffi_size)) {
+                               LOGDEBUG (g_message ("%s: recording assembly: FileName [%s] FileVersionInfo [%d.%d.%d.%d]", __func__, g_utf16_to_utf8 (filename, -1, NULL, NULL, NULL), HIWORD (ffi->dwFileVersionMS), LOWORD (ffi->dwFileVersionMS), HIWORD (ffi->dwFileVersionLS), LOWORD (ffi->dwFileVersionLS)));
+
+                               process_set_field_int (filever, "filemajorpart", HIWORD (ffi->dwFileVersionMS));
+                               process_set_field_int (filever, "fileminorpart", LOWORD (ffi->dwFileVersionMS));
+                               process_set_field_int (filever, "filebuildpart", HIWORD (ffi->dwFileVersionLS));
+                               process_set_field_int (filever, "fileprivatepart", LOWORD (ffi->dwFileVersionLS));
+
+                               process_set_field_int (filever, "productmajorpart", HIWORD (ffi->dwProductVersionMS));
+                               process_set_field_int (filever, "productminorpart", LOWORD (ffi->dwProductVersionMS));
+                               process_set_field_int (filever, "productbuildpart", HIWORD (ffi->dwProductVersionLS));
+                               process_set_field_int (filever, "productprivatepart", LOWORD (ffi->dwProductVersionLS));
+
+                               process_set_field_bool (filever, "isdebug", ((ffi->dwFileFlags & ffi->dwFileFlagsMask) & VS_FF_DEBUG) != 0);
+                               process_set_field_bool (filever, "isprerelease", ((ffi->dwFileFlags & ffi->dwFileFlagsMask) & VS_FF_PRERELEASE) != 0);
+                               process_set_field_bool (filever, "ispatched", ((ffi->dwFileFlags & ffi->dwFileFlagsMask) & VS_FF_PATCHED) != 0);
+                               process_set_field_bool (filever, "isprivatebuild", ((ffi->dwFileFlags & ffi->dwFileFlagsMask) & VS_FF_PRIVATEBUILD) != 0);
+                               process_set_field_bool (filever, "isspecialbuild", ((ffi->dwFileFlags & ffi->dwFileFlagsMask) & VS_FF_SPECIALBUILD) != 0);
+                       }
+                       g_free (query);
+
+                       query = g_utf8_to_utf16 ("\\VarFileInfo\\Translation", -1, NULL, NULL, NULL);
+                       if (query == NULL) {
+                               g_free (data);
+                               return;
+                       }
+
+                       if (VerQueryValue (data, query, (gpointer *)&trans_data, &trans_size)) {
+                               /* use the first language ID we see */
+                               if (trans_size >= 4) {
+                                       LOGDEBUG (g_message("%s: %s has 0x%0x 0x%0x 0x%0x 0x%0x", __func__, g_utf16_to_utf8 (filename, -1, NULL, NULL, NULL), trans_data[0], trans_data[1], trans_data[2], trans_data[3]));
+                                       lang = (trans_data[0]) | (trans_data[1] << 8) | (trans_data[2] << 16) | (trans_data[3] << 24);
+                                       /* Only give the lower 16 bits to VerLanguageName, as Windows gets confused otherwise  */
+                                       lang_count = VerLanguageName (lang & 0xFFFF, lang_buf, 128);
+                                       if (lang_count) {
+                                               process_set_field_string (filever, "language", lang_buf, lang_count, error);
+                                               return_if_nok (error);
+                                       }
+                                       process_module_stringtable (filever, data, trans_data[0], trans_data[1], error);
+                                       return_if_nok (error);
+                               }
+                       } else {
+                               int i;
+
+                               for (i = 0; i < G_N_ELEMENTS (stringtable_entries); ++i) {
+                                       /* No strings, so set every field to the empty string */
+                                       process_set_field_string (filever, stringtable_entries [i].name, EMPTY_STRING, 0, error);
+                                       return_if_nok (error);
+                               }
+
+                               /* And language seems to be set to en_US according to bug 374600 */
+                               lang_count = VerLanguageName (0x0409, lang_buf, 128);
+                               if (lang_count) {
+                                       process_set_field_string (filever, "language", lang_buf, lang_count, error);
+                                       return_if_nok (error);
+                               }
+                       }
+
+                       g_free (query);
+               }
+               g_free (data);
+       }
+}
+
+#endif /* #if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */
+
+void
+ves_icall_System_Diagnostics_FileVersionInfo_GetVersionInfo_internal (MonoObject *this_obj, MonoString *filename)
+{
+       MonoError error;
+
+       stash_system_image (mono_object_class (this_obj)->image);
+
+       mono_w32process_get_fileversion (this_obj, mono_string_chars (filename), &error);
+       if (!mono_error_ok (&error)) {
+               mono_error_set_pending_exception (&error);
+               return;
+       }
+
+       process_set_field_string (this_obj, "filename", mono_string_chars (filename), mono_string_length (filename), &error);
+       if (!mono_error_ok (&error)) {
+               mono_error_set_pending_exception (&error);
+       }
+}
+
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
+
+static GPtrArray*
+get_domain_assemblies (MonoDomain *domain)
+{
+       GSList *tmp;
+       GPtrArray *assemblies;
+
+       /*
+        * Make a copy of the list of assemblies because we can't hold the assemblies
+        * lock while creating objects etc.
+        */
+       assemblies = g_ptr_array_new ();
+       mono_domain_assemblies_lock (domain);
+       for (tmp = domain->domain_assemblies; tmp; tmp = tmp->next) {
+               MonoAssembly *ass = (MonoAssembly *)tmp->data;
+               if (ass->image->fileio_used)
+                       continue;
+               g_ptr_array_add (assemblies, ass);
+       }
+       mono_domain_assemblies_unlock (domain);
+
+       return assemblies;
+}
+
+static MonoObject*
+process_add_module (HANDLE process, HMODULE mod, gunichar2 *filename, gunichar2 *modulename, MonoClass *proc_class, MonoError *error)
+{
+       MonoObject *item, *filever;
+       MonoDomain *domain = mono_domain_get ();
+       MODULEINFO modinfo;
+       BOOL ok;
+
+       mono_error_init (error);
+
+       /* Build a System.Diagnostics.ProcessModule with the data. */
+       item = mono_object_new_checked (domain, proc_class, error);
+       return_val_if_nok (error, NULL);
+
+       filever = mono_object_new_checked (domain, get_file_version_info_class (), error);
+       return_val_if_nok (error, NULL);
+
+       mono_w32process_get_fileversion (filever, filename, error);
+       return_val_if_nok (error, NULL);
+
+       process_set_field_string (filever, "filename", filename, unicode_chars (filename), error);
+       return_val_if_nok (error, NULL);
+
+       ok = mono_w32process_module_get_information (process, mod, &modinfo, sizeof(MODULEINFO));
+       if (ok) {
+               process_set_field_intptr (item, "baseaddr", modinfo.lpBaseOfDll);
+               process_set_field_intptr (item, "entryaddr", modinfo.EntryPoint);
+               process_set_field_int (item, "memory_size", modinfo.SizeOfImage);
+       }
+
+       process_set_field_string (item, "filename", filename, unicode_chars (filename), error);
+       return_val_if_nok (error, NULL);
+
+       process_set_field_string (item, "modulename", modulename, unicode_chars (modulename), error);
+       return_val_if_nok (error, NULL);
+
+       process_set_field_object (item, "version_info", filever);
+
+       return item;
+}
+
+static void
+process_get_assembly_fileversion (MonoObject *filever, MonoAssembly *assembly)
+{
+       process_set_field_int (filever, "filemajorpart", assembly->aname.major);
+       process_set_field_int (filever, "fileminorpart", assembly->aname.minor);
+       process_set_field_int (filever, "filebuildpart", assembly->aname.build);
+}
+
+static MonoObject*
+process_get_module (MonoAssembly *assembly, MonoClass *proc_class, MonoError *error)
+{
+       MonoObject *item, *filever;
+       MonoDomain *domain;
+       gchar *filename;
+       const gchar *modulename;
+
+       mono_error_init (error);
+
+       domain = mono_domain_get ();
+
+       modulename = assembly->aname.name;
+
+       /* Build a System.Diagnostics.ProcessModule with the data. */
+       item = mono_object_new_checked (domain, proc_class, error);
+       return_val_if_nok (error, NULL);
+
+       filever = mono_object_new_checked (domain, get_file_version_info_class (), error);
+       return_val_if_nok (error, NULL);
+
+       filename = g_strdup_printf ("[In Memory] %s", modulename);
+
+       process_get_assembly_fileversion (filever, assembly);
+       process_set_field_string_char (filever, "filename", filename);
+       process_set_field_object (item, "version_info", filever);
+
+       process_set_field_intptr (item, "baseaddr", assembly->image->raw_data);
+       process_set_field_int (item, "memory_size", assembly->image->raw_data_len);
+       process_set_field_string_char (item, "filename", filename);
+       process_set_field_string_char (item, "modulename", modulename);
+
+       g_free (filename);
+
+       return item;
+}
+
+/* Returns an array of System.Diagnostics.ProcessModule */
+MonoArray *
+ves_icall_System_Diagnostics_Process_GetModules_internal (MonoObject *this_obj, HANDLE process)
+{
+       MonoError error;
+       MonoArray *temp_arr = NULL;
+       MonoArray *arr;
+       HMODULE mods[1024];
+       gunichar2 filename[MAX_PATH];
+       gunichar2 modname[MAX_PATH];
+       DWORD needed;
+       guint32 count = 0, module_count = 0, assembly_count = 0;
+       guint32 i, num_added = 0;
+       GPtrArray *assemblies = NULL;
+
+       stash_system_image (mono_object_class (this_obj)->image);
+
+       if (mono_w32process_get_pid (process) == mono_process_current_pid ()) {
+               assemblies = get_domain_assemblies (mono_domain_get ());
+               assembly_count = assemblies->len;
+       }
+
+       if (mono_w32process_try_get_modules (process, mods, sizeof(mods), &needed))
+               module_count += needed / sizeof(HMODULE);
+
+       count = module_count + assembly_count;
+       temp_arr = mono_array_new_checked (mono_domain_get (), get_process_module_class (), count, &error);
+       if (mono_error_set_pending_exception (&error))
+               return NULL;
+
+       for (i = 0; i < module_count; i++) {
+               if (mono_w32process_module_get_name (process, mods[i], modname, MAX_PATH)
+                        && mono_w32process_module_get_filename (process, mods[i], filename, MAX_PATH))
+               {
+                       MonoObject *module = process_add_module (process, mods[i], filename, modname, get_process_module_class (), &error);
+                       if (!mono_error_ok (&error)) {
+                               mono_error_set_pending_exception (&error);
+                               return NULL;
+                       }
+                       mono_array_setref (temp_arr, num_added++, module);
+               }
+       }
+
+       if (assemblies) {
+               for (i = 0; i < assembly_count; i++) {
+                       MonoAssembly *ass = (MonoAssembly *)g_ptr_array_index (assemblies, i);
+                       MonoObject *module = process_get_module (ass, get_process_module_class (), &error);
+                       if (!mono_error_ok (&error)) {
+                               mono_error_set_pending_exception (&error);
+                               return NULL;
+                       }
+                       mono_array_setref (temp_arr, num_added++, module);
+               }
+               g_ptr_array_free (assemblies, TRUE);
+       }
+
+       if (count == num_added) {
+               arr = temp_arr;
+       } else {
+               /* shorter version of the array */
+               arr = mono_array_new_checked (mono_domain_get (), get_process_module_class (), num_added, &error);
+               if (mono_error_set_pending_exception (&error))
+                       return NULL;
+
+               for (i = 0; i < num_added; i++)
+                       mono_array_setref (arr, i, mono_array_get (temp_arr, MonoObject*, i));
+       }
+
+       return arr;
+}
+
+#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */
+
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
+
+MonoString *
+ves_icall_System_Diagnostics_Process_ProcessName_internal (HANDLE process)
+{
+       MonoError error;
+       MonoString *string;
+       gunichar2 name[MAX_PATH];
+       guint32 len;
+       gboolean ok;
+       HMODULE mod;
+       DWORD needed;
+
+       ok = mono_w32process_try_get_modules (process, &mod, sizeof(mod), &needed);
+       if (!ok)
+               return NULL;
+
+       len = mono_w32process_module_get_name (process, mod, name, MAX_PATH);
+       if (len == 0)
+               return NULL;
+
+       string = mono_string_new_utf16_checked (mono_domain_get (), name, len, &error);
+       if (!mono_error_ok (&error))
+               mono_error_set_pending_exception (&error);
+
+       return string;
+}
+
+#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */
+
+gint64
+ves_icall_System_Diagnostics_Process_GetProcessData (int pid, gint32 data_type, gint32 *error)
+{
+       MonoProcessError perror;
+       guint64 res;
+
+       res = mono_process_get_data_with_error (GINT_TO_POINTER (pid), (MonoProcessData)data_type, &perror);
+       if (error)
+               *error = perror;
+       return res;
+}
diff --git a/mono/metadata/w32process.h b/mono/metadata/w32process.h
new file mode 100644 (file)
index 0000000..7df9caf
--- /dev/null
@@ -0,0 +1,142 @@
+/*
+ * w32process.h: System.Diagnostics.Process support
+ *
+ * Author:
+ *     Dick Porter (dick@ximian.com)
+ *
+ * (C) 2002 Ximian, Inc.
+ */
+
+#ifndef _MONO_METADATA_W32PROCESS_H_
+#define _MONO_METADATA_W32PROCESS_H_
+
+#include <config.h>
+#include <glib.h>
+
+#if HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+
+#include <mono/metadata/object.h>
+
+G_BEGIN_DECLS
+
+typedef enum {
+       MONO_W32PROCESS_PRIORITY_CLASS_NORMAL       = 0x0020,
+       MONO_W32PROCESS_PRIORITY_CLASS_IDLE         = 0x0040,
+       MONO_W32PROCESS_PRIORITY_CLASS_HIGH         = 0x0080,
+       MONO_W32PROCESS_PRIORITY_CLASS_REALTIME     = 0x0100,
+       MONO_W32PROCESS_PRIORITY_CLASS_BELOW_NORMAL = 0x4000,
+       MONO_W32PROCESS_PRIORITY_CLASS_ABOVE_NORMAL = 0x8000,
+} MonoW32ProcessPriorityClass;
+
+typedef struct 
+{
+       gpointer process_handle;
+       gpointer thread_handle;
+       guint32 pid; /* Contains GetLastError () on failure */
+       guint32 tid;
+       MonoArray *env_keys;
+       MonoArray *env_values;
+       MonoString *username;
+       MonoString *domain;
+       gpointer password; /* BSTR from SecureString in 2.0 profile */
+       MonoBoolean load_user_profile;
+} MonoW32ProcessInfo;
+
+typedef struct
+{
+       MonoObject object;
+       MonoString *filename;
+       MonoString *arguments;
+       MonoString *working_directory;
+       MonoString *verb;
+       guint32 window_style;
+       MonoBoolean error_dialog;
+       gpointer error_dialog_parent_handle;
+       MonoBoolean use_shell_execute;
+       MonoString *username;
+       MonoString *domain;
+       MonoObject *password; /* SecureString in 2.0 profile, dummy in 1.x */
+       MonoString *password_in_clear_text;
+       MonoBoolean load_user_profile;
+       MonoBoolean redirect_standard_input;
+       MonoBoolean redirect_standard_output;
+       MonoBoolean redirect_standard_error;
+       MonoObject *encoding_stdout;
+       MonoObject *encoding_stderr;
+       MonoBoolean create_no_window;
+       MonoObject *weak_parent_process;
+       MonoObject *envVars;
+} MonoW32ProcessStartInfo;
+
+void
+mono_w32process_init (void);
+
+void
+mono_w32process_cleanup (void);
+
+#ifndef HOST_WIN32
+
+void
+mono_w32process_set_cli_launcher (gchar *path);
+
+gchar*
+mono_w32process_get_path (pid_t pid);
+
+#endif
+
+gpointer
+ves_icall_System_Diagnostics_Process_GetProcess_internal (guint32 pid);
+
+MonoArray*
+ves_icall_System_Diagnostics_Process_GetProcesses_internal (void);
+
+MonoArray*
+ves_icall_System_Diagnostics_Process_GetModules_internal (MonoObject *this_obj, gpointer process);
+
+void
+ves_icall_System_Diagnostics_FileVersionInfo_GetVersionInfo_internal (MonoObject *this_obj, MonoString *filename);
+
+MonoBoolean
+ves_icall_System_Diagnostics_Process_ShellExecuteEx_internal (MonoW32ProcessStartInfo *proc_start_info, MonoW32ProcessInfo *process_handle);
+
+MonoBoolean
+ves_icall_System_Diagnostics_Process_CreateProcess_internal (MonoW32ProcessStartInfo *proc_start_info, gpointer stdin_handle,
+       gpointer stdout_handle, gpointer stderr_handle, MonoW32ProcessInfo *process_handle);
+
+MonoString*
+ves_icall_System_Diagnostics_Process_ProcessName_internal (gpointer process);
+
+gint64
+ves_icall_System_Diagnostics_Process_GetProcessData (int pid, gint32 data_type, gint32 *error);
+
+gpointer
+ves_icall_Microsoft_Win32_NativeMethods_GetCurrentProcess (void);
+
+MonoBoolean
+ves_icall_Microsoft_Win32_NativeMethods_GetExitCodeProcess (gpointer handle, gint32 *exitcode);
+
+MonoBoolean
+ves_icall_Microsoft_Win32_NativeMethods_CloseProcess (gpointer handle);
+
+MonoBoolean
+ves_icall_Microsoft_Win32_NativeMethods_TerminateProcess (gpointer handle, gint32 exitcode);
+
+MonoBoolean
+ves_icall_Microsoft_Win32_NativeMethods_GetProcessWorkingSetSize (gpointer handle, gsize *min, gsize *max);
+MonoBoolean
+ves_icall_Microsoft_Win32_NativeMethods_SetProcessWorkingSetSize (gpointer handle, gsize min, gsize max);
+
+gint32
+ves_icall_Microsoft_Win32_NativeMethods_GetPriorityClass (gpointer handle);
+MonoBoolean
+ves_icall_Microsoft_Win32_NativeMethods_SetPriorityClass (gpointer handle, gint32 priorityClass);
+
+MonoBoolean
+ves_icall_Microsoft_Win32_NativeMethods_GetProcessTimes (gpointer handle, gint64 *creationtime, gint64 *exittime, gint64 *kerneltime, gint64 *usertime);
+
+G_END_DECLS
+
+#endif /* _MONO_METADATA_W32PROCESS_H_ */
+
diff --git a/mono/metadata/w32semaphore-unix.c b/mono/metadata/w32semaphore-unix.c
new file mode 100644 (file)
index 0000000..f0a93d1
--- /dev/null
@@ -0,0 +1,352 @@
+/*
+ * w32semaphore-unix.c: Runtime support for managed Semaphore on Unix
+ *
+ * Author:
+ *     Ludovic Henry (luhenry@microsoft.com)
+ *
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
+ */
+
+#include "w32semaphore.h"
+
+#include "w32handle-namespace.h"
+#include "mono/io-layer/io-layer.h"
+#include "mono/utils/mono-logger-internals.h"
+#include "mono/metadata/w32handle.h"
+
+typedef struct {
+       guint32 val;
+       gint32 max;
+} MonoW32HandleSemaphore;
+
+struct MonoW32HandleNamedSemaphore {
+       MonoW32HandleSemaphore s;
+       MonoW32HandleNamespace sharedns;
+};
+
+static gboolean sem_handle_own (gpointer handle, MonoW32HandleType type, guint32 *statuscode)
+{
+       MonoW32HandleSemaphore *sem_handle;
+
+       *statuscode = WAIT_OBJECT_0;
+
+       if (!mono_w32handle_lookup (handle, type, (gpointer *)&sem_handle)) {
+               g_warning ("%s: error looking up %s handle %p",
+                       __func__, mono_w32handle_get_typename (type), handle);
+               return FALSE;
+       }
+
+       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: owning %s handle %p",
+               __func__, mono_w32handle_get_typename (type), handle);
+
+       sem_handle->val--;
+
+       if (sem_handle->val == 0)
+               mono_w32handle_set_signal_state (handle, FALSE, FALSE);
+
+       return TRUE;
+}
+
+static void sema_signal(gpointer handle)
+{
+       ves_icall_System_Threading_Semaphore_ReleaseSemaphore_internal(handle, 1, NULL);
+}
+
+static gboolean sema_own (gpointer handle, guint32 *statuscode)
+{
+       return sem_handle_own (handle, MONO_W32HANDLE_SEM, statuscode);
+}
+
+static void namedsema_signal (gpointer handle)
+{
+       ves_icall_System_Threading_Semaphore_ReleaseSemaphore_internal (handle, 1, NULL);
+}
+
+/* NB, always called with the shared handle lock held */
+static gboolean namedsema_own (gpointer handle, guint32 *statuscode)
+{
+       return sem_handle_own (handle, MONO_W32HANDLE_NAMEDSEM, statuscode);
+}
+
+static void sema_details (gpointer data)
+{
+       MonoW32HandleSemaphore *sem = (MonoW32HandleSemaphore *)data;
+       g_print ("val: %5u, max: %5d", sem->val, sem->max);
+}
+
+static void namedsema_details (gpointer data)
+{
+       MonoW32HandleNamedSemaphore *namedsem = (MonoW32HandleNamedSemaphore *)data;
+       g_print ("val: %5u, max: %5d, name: \"%s\"", namedsem->s.val, namedsem->s.max, namedsem->sharedns.name);
+}
+
+static const gchar* sema_typename (void)
+{
+       return "Semaphore";
+}
+
+static gsize sema_typesize (void)
+{
+       return sizeof (MonoW32HandleSemaphore);
+}
+
+static const gchar* namedsema_typename (void)
+{
+       return "N.Semaphore";
+}
+
+static gsize namedsema_typesize (void)
+{
+       return sizeof (MonoW32HandleNamedSemaphore);
+}
+
+void
+mono_w32semaphore_init (void)
+{
+       static MonoW32HandleOps sem_ops = {
+               NULL,                   /* close */
+               sema_signal,            /* signal */
+               sema_own,               /* own */
+               NULL,                   /* is_owned */
+               NULL,                   /* special_wait */
+               NULL,                   /* prewait */
+               sema_details,   /* details */
+               sema_typename,  /* typename */
+               sema_typesize,  /* typesize */
+       };
+
+       static MonoW32HandleOps namedsem_ops = {
+               NULL,                   /* close */
+               namedsema_signal,       /* signal */
+               namedsema_own,          /* own */
+               NULL,                   /* is_owned */
+               NULL,                   /* special_wait */
+               NULL,                   /* prewait */
+               namedsema_details,      /* details */
+               namedsema_typename,     /* typename */
+               namedsema_typesize,     /* typesize */
+       };
+
+       mono_w32handle_register_ops (MONO_W32HANDLE_SEM,      &sem_ops);
+       mono_w32handle_register_ops (MONO_W32HANDLE_NAMEDSEM, &namedsem_ops);
+
+       mono_w32handle_register_capabilities (MONO_W32HANDLE_SEM,
+               (MonoW32HandleCapability)(MONO_W32HANDLE_CAP_WAIT | MONO_W32HANDLE_CAP_SIGNAL));
+       mono_w32handle_register_capabilities (MONO_W32HANDLE_NAMEDSEM,
+               (MonoW32HandleCapability)(MONO_W32HANDLE_CAP_WAIT | MONO_W32HANDLE_CAP_SIGNAL));
+}
+
+static gpointer
+sem_handle_create (MonoW32HandleSemaphore *sem_handle, MonoW32HandleType type, gint32 initial, gint32 max)
+{
+       gpointer handle;
+
+       sem_handle->val = initial;
+       sem_handle->max = max;
+
+       handle = mono_w32handle_new (type, sem_handle);
+       if (handle == INVALID_HANDLE_VALUE) {
+               g_warning ("%s: error creating %s handle",
+                       __func__, mono_w32handle_get_typename (type));
+               SetLastError (ERROR_GEN_FAILURE);
+               return NULL;
+       }
+
+       mono_w32handle_lock_handle (handle);
+
+       if (initial != 0)
+               mono_w32handle_set_signal_state (handle, TRUE, FALSE);
+
+       mono_w32handle_unlock_handle (handle);
+
+       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: created %s handle %p",
+               __func__, mono_w32handle_get_typename (type), handle);
+
+       return handle;
+}
+
+static gpointer
+sem_create (gint32 initial, gint32 max)
+{
+       MonoW32HandleSemaphore sem_handle;
+       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: creating %s handle, initial %d max %d",
+               __func__, mono_w32handle_get_typename (MONO_W32HANDLE_SEM), initial, max);
+       return sem_handle_create (&sem_handle, MONO_W32HANDLE_SEM, initial, max);
+}
+
+static gpointer
+namedsem_create (gint32 initial, gint32 max, const gunichar2 *name)
+{
+       gpointer handle;
+       gchar *utf8_name;
+
+       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: creating %s handle, initial %d max %d name \"%s\"",
+                   __func__, mono_w32handle_get_typename (MONO_W32HANDLE_NAMEDSEM), initial, max, (const char*)name);
+
+       /* w32 seems to guarantee that opening named objects can't race each other */
+       mono_w32handle_namespace_lock ();
+
+       utf8_name = g_utf16_to_utf8 (name, -1, NULL, NULL, NULL);
+
+       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Creating named sem name [%s] initial %d max %d", __func__, utf8_name, initial, max);
+
+       handle = mono_w32handle_namespace_search_handle (MONO_W32HANDLE_NAMEDSEM, utf8_name);
+       if (handle == INVALID_HANDLE_VALUE) {
+               /* The name has already been used for a different object. */
+               handle = NULL;
+               SetLastError (ERROR_INVALID_HANDLE);
+       } else if (handle) {
+               /* Not an error, but this is how the caller is informed that the semaphore wasn't freshly created */
+               SetLastError (ERROR_ALREADY_EXISTS);
+
+               /* mono_w32handle_namespace_search_handle already adds a ref to the handle */
+       } else {
+               /* A new named semaphore */
+               MonoW32HandleNamedSemaphore namedsem_handle;
+
+               strncpy (&namedsem_handle.sharedns.name [0], utf8_name, MAX_PATH);
+               namedsem_handle.sharedns.name [MAX_PATH] = '\0';
+
+               handle = sem_handle_create ((MonoW32HandleSemaphore*) &namedsem_handle, MONO_W32HANDLE_NAMEDSEM, initial, max);
+       }
+
+       g_free (utf8_name);
+
+       mono_w32handle_namespace_unlock ();
+
+       return handle;
+}
+
+gpointer
+ves_icall_System_Threading_Semaphore_CreateSemaphore_internal (gint32 initialCount, gint32 maximumCount, MonoString *name, gint32 *error)
+{ 
+       gpointer sem;
+
+       if (maximumCount <= 0) {
+               mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: maximumCount <= 0", __func__);
+
+               *error = ERROR_INVALID_PARAMETER;
+               return NULL;
+       }
+
+       if (initialCount > maximumCount || initialCount < 0) {
+               mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: initialCount > maximumCount or < 0", __func__);
+
+               *error = ERROR_INVALID_PARAMETER;
+               return NULL;
+       }
+
+       /* Need to blow away any old errors here, because code tests
+        * for ERROR_ALREADY_EXISTS on success (!) to see if a
+        * semaphore was freshly created
+        */
+       SetLastError (ERROR_SUCCESS);
+
+       if (!name)
+               sem = sem_create (initialCount, maximumCount);
+       else
+               sem = namedsem_create (initialCount, maximumCount, mono_string_chars (name));
+
+       *error = GetLastError ();
+
+       return sem;
+}
+
+MonoBoolean
+ves_icall_System_Threading_Semaphore_ReleaseSemaphore_internal (gpointer handle, gint32 releaseCount, gint32 *prevcount)
+{
+       MonoW32HandleType type;
+       MonoW32HandleSemaphore *sem_handle;
+       MonoBoolean ret;
+
+       if (!handle) {
+               SetLastError (ERROR_INVALID_HANDLE);
+               return FALSE;
+       }
+
+       switch (type = mono_w32handle_get_type (handle)) {
+       case MONO_W32HANDLE_SEM:
+       case MONO_W32HANDLE_NAMEDSEM:
+               break;
+       default:
+               SetLastError (ERROR_INVALID_HANDLE);
+               return FALSE;
+       }
+
+       if (!mono_w32handle_lookup (handle, type, (gpointer *)&sem_handle)) {
+               g_warning ("%s: error looking up sem handle %p", __func__, handle);
+               return FALSE;
+       }
+
+       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: releasing %s handle %p",
+               __func__, mono_w32handle_get_typename (type), handle);
+
+       mono_w32handle_lock_handle (handle);
+
+       /* Do this before checking for count overflow, because overflowing
+        * max is a listed technique for finding the current value */
+       if (prevcount)
+               *prevcount = sem_handle->val;
+
+       /* No idea why max is signed, but thats the spec :-( */
+       if (sem_handle->val + releaseCount > (guint32)sem_handle->max) {
+               mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: %s handle %p val %d count %d max %d, max value would be exceeded",
+                       __func__, mono_w32handle_get_typename (type), handle, sem_handle->val, releaseCount, sem_handle->max);
+
+               ret = FALSE;
+       } else {
+               mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: %s handle %p val %d count %d max %d",
+                       __func__, mono_w32handle_get_typename (type), handle, sem_handle->val, releaseCount, sem_handle->max);
+
+               sem_handle->val += releaseCount;
+               mono_w32handle_set_signal_state (handle, TRUE, TRUE);
+
+               ret = TRUE;
+       }
+
+       mono_w32handle_unlock_handle (handle);
+
+       return ret;
+}
+
+gpointer
+ves_icall_System_Threading_Semaphore_OpenSemaphore_internal (MonoString *name, gint32 rights, gint32 *error)
+{
+       gpointer handle;
+       gchar *utf8_name;
+
+       *error = ERROR_SUCCESS;
+
+       /* w32 seems to guarantee that opening named objects can't race each other */
+       mono_w32handle_namespace_lock ();
+
+       utf8_name = g_utf16_to_utf8 (mono_string_chars (name), -1, NULL, NULL, NULL);
+
+       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Opening named sem [%s]", __func__, utf8_name);
+
+       handle = mono_w32handle_namespace_search_handle (MONO_W32HANDLE_NAMEDSEM, utf8_name);
+       if (handle == INVALID_HANDLE_VALUE) {
+               /* The name has already been used for a different object. */
+               *error = ERROR_INVALID_HANDLE;
+               goto cleanup;
+       } else if (!handle) {
+               /* This name doesn't exist */
+               *error = ERROR_FILE_NOT_FOUND;
+               goto cleanup;
+       }
+
+       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: returning named sem handle %p", __func__, handle);
+
+cleanup:
+       g_free (utf8_name);
+
+       mono_w32handle_namespace_unlock ();
+
+       return handle;
+}
+
+MonoW32HandleNamespace*
+mono_w32semaphore_get_namespace (MonoW32HandleNamedSemaphore *semaphore)
+{
+       return &semaphore->sharedns;
+}
diff --git a/mono/metadata/w32semaphore-win32.c b/mono/metadata/w32semaphore-win32.c
new file mode 100644 (file)
index 0000000..bd6bdc9
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * w32semaphore-win32.c: Runtime support for managed Semaphore on Win32
+ *
+ * Author:
+ *     Ludovic Henry (luhenry@microsoft.com)
+ *
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
+ */
+
+#include "w32semaphore.h"
+
+#include <windows.h>
+#include <winbase.h>
+
+void
+mono_w32semaphore_init (void)
+{
+}
+
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT | HAVE_UWP_WINAPI_SUPPORT)
+gpointer
+ves_icall_System_Threading_Semaphore_CreateSemaphore_internal (gint32 initialCount, gint32 maximumCount, MonoString *name, gint32 *error)
+{ 
+       HANDLE sem;
+
+       sem = CreateSemaphore (NULL, initialCount, maximumCount, name ? mono_string_chars (name) : NULL);
+
+       *error = GetLastError ();
+
+       return sem;
+}
+#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT | HAVE_UWP_WINAPI_SUPPORT) */
+
+MonoBoolean
+ves_icall_System_Threading_Semaphore_ReleaseSemaphore_internal (gpointer handle, gint32 releaseCount, gint32 *prevcount)
+{ 
+       return ReleaseSemaphore (handle, releaseCount, prevcount);
+}
+
+gpointer
+ves_icall_System_Threading_Semaphore_OpenSemaphore_internal (MonoString *name, gint32 rights, gint32 *error)
+{
+       HANDLE sem;
+
+       sem = OpenSemaphore (rights, FALSE, mono_string_chars (name));
+
+       *error = GetLastError ();
+
+       return sem;
+}
\ No newline at end of file
diff --git a/mono/metadata/w32semaphore.h b/mono/metadata/w32semaphore.h
new file mode 100644 (file)
index 0000000..789dfbe
--- /dev/null
@@ -0,0 +1,28 @@
+
+#ifndef _MONO_METADATA_W32SEMAPHORE_H_
+#define _MONO_METADATA_W32SEMAPHORE_H_
+
+#include <config.h>
+#include <glib.h>
+
+#include "object.h"
+#include "w32handle-namespace.h"
+
+void
+mono_w32semaphore_init (void);
+
+gpointer
+ves_icall_System_Threading_Semaphore_CreateSemaphore_internal (gint32 initialCount, gint32 maximumCount, MonoString *name, gint32 *error);
+
+MonoBoolean
+ves_icall_System_Threading_Semaphore_ReleaseSemaphore_internal (gpointer handle, gint32 releaseCount, gint32 *prevcount);
+
+gpointer
+ves_icall_System_Threading_Semaphore_OpenSemaphore_internal (MonoString *name, gint32 rights, gint32 *error);
+
+typedef struct MonoW32HandleNamedSemaphore MonoW32HandleNamedSemaphore;
+
+MonoW32HandleNamespace*
+mono_w32semaphore_get_namespace (MonoW32HandleNamedSemaphore *semaphore);
+
+#endif /* _MONO_METADATA_W32SEMAPHORE_H_ */
index 28f66c47f4be8d5fdd121046d8a700ebb4ce8ce5..8cc6e1d051e42ac9465eed8df37431de3dd22991 100644 (file)
@@ -32,4 +32,4 @@
 /mono-boehm
 /buildver-sgen.h
 /buildver-boehm.h
-/regressionexitcode.out
+/regressiontests.out
index e3983f69e2b4f769154a6b7cac805abfe91e71bb..bba551cc940b77fbfda4a2d822842b3630def3cd 100755 (executable)
@@ -372,7 +372,9 @@ darwin_sources = \
        mini-darwin.c
 
 windows_sources = \
-       mini-windows.c
+       mini-windows.c \
+       mini-windows.h \
+       mini-windows-dllmain.c
 
 posix_sources = \
        mini-posix.c
@@ -482,12 +484,13 @@ test_sources =                    \
        generics.cs             \
        generics-variant-types.il\
        basic-simd.cs \
+       basic-vectors.cs \
        aot-tests.cs \
        gc-test.cs \
        gshared.cs
 
 
-regtests_UNIVERSAL=basic.exe basic-float.exe basic-long.exe basic-calls.exe objects.exe arrays.exe basic-math.exe exceptions.exe iltests.exe devirtualization.exe generics.exe basic-simd.exe
+regtests_UNIVERSAL=basic.exe basic-float.exe basic-long.exe basic-calls.exe objects.exe arrays.exe basic-math.exe exceptions.exe iltests.exe devirtualization.exe generics.exe basic-simd.exe basic-vectors.exe
 
 if INSTALL_MOBILE_STATIC
 regtests= \
@@ -620,6 +623,9 @@ CSFLAGS = -unsafe -nowarn:0219,0169,0414,0649
 basic-simd.exe: basic-simd.cs TestDriver.dll
        $(MCS) -out:$@ $(CSFLAGS) $< -r:TestDriver.dll -r:$(CLASS)/Mono.Simd.dll
 
+basic-vectors.exe: basic-vectors.cs TestDriver.dll
+       $(MCS) -out:$@ $(CSFLAGS) $< -r:TestDriver.dll -r:$(CLASS)/System.Numerics.dll
+
 nacl.exe: nacl.cs TestDriver.dll
        $(MCS) -out:$@ $(CSFLAGS) $< -r:TestDriver.dll -r:$(CLASS)/Mono.Simd.dll
 
@@ -696,8 +702,16 @@ checktests: $(regtests)
        for i in $(regtests); do $(MINI_RUNTIME) $$i; done
 
 rcheck-nunit: mono $(regtests)
-       -($(MINI_RUNTIME) --regression $(regtests); echo $$? > regressionexitcode.out) | $(srcdir)/emitnunit.pl
-       exit $$(cat regressionexitcode.out)
+       $(MINI_RUNTIME) --regression $(regtests) > regressiontests.out 2>&1; cat regressiontests.out; \
+       if grep -q "100% pass" regressiontests.out; then successbool=True; failurescount=0; else successbool=False; failurescount=1; fi; \
+       echo "<?xml version='1.0' encoding='utf-8'?>\
+               <test-results failures='$$failurescount' total='1' not-run='0' name='regression-tests.dummy' date='$$(date +%F)' time='$$(date +%T)'>\
+                       <test-suite name='regression-tests.dummy' success='$$successbool' time='0'>\
+                               <results><test-case name='MonoTests.regressions.100percentsuccess' executed='True' success='$$successbool' time='0'>" > TestResult-regression.xml; \
+                                       if [ "$$successbool" = "False" ]; then echo "<failure><message><![CDATA[$$(cat regressiontests.out)]]></message><stack-trace></stack-trace></failure>" >> TestResult-regression.xml; fi; \
+                               echo "</test-case></results>\
+                       </test-suite>\
+               </test-results>" >> TestResult-regression.xml; exit $$failurescount
 
 rcheck: mono $(regtests)
        $(MINI_RUNTIME) --regression $(regtests)
@@ -833,7 +847,6 @@ CLEANFILES= $(BUILT_SOURCES) *.exe *.dll
 EXTRA_DIST = TestDriver.cs \
        TestHelpers.cs \
        genmdesc.pl                             \
-       emitnunit.pl                    \
        $(test_sources)                         \
        $(x86_sources) cpu-x86.md               \
        $(amd64_sources) cpu-amd64.md           \
index 17a8e84d91a9da461fd4b40e08d5040b4d624d1e..c4c00645c1630884ba75ec654fc47124dcd2a379 100644 (file)
@@ -13,6 +13,7 @@
 #include <mono/metadata/mempool.h>
 #include <mono/metadata/opcodes.h>
 #include <mono/metadata/mempool-internals.h>
+#include <mono/utils/mono-compiler.h>
 
 #include <config.h>
 
@@ -1380,4 +1381,8 @@ mono_perform_abc_removal (MonoCompile *cfg)
        process_block (cfg, cfg->bblocks [0], &area);
 }
 
-#endif /* DISABLE_JIT */
+#else /* !DISABLE_JIT */
+
+MONO_EMPTY_SOURCE_FILE (abcremoval);
+
+#endif /* !DISABLE_JIT */
index ebab8ae4b25519a818acf6fc04a10b53de9004c8..c419dfa2b42abf4139037e97340225628b8670b3 100644 (file)
@@ -13,6 +13,7 @@
 #include "mini.h"
 #include "ir-emit.h"
 #include "glib.h"
+#include <mono/utils/mono-compiler.h>
 
 #ifndef DISABLE_JIT
 
@@ -191,7 +192,9 @@ handle_instruction:
                        case OP_LOADU4_MEMBASE:
                        case OP_LOADI1_MEMBASE:
                        case OP_LOADI8_MEMBASE:
+#ifndef MONO_ARCH_SOFT_FLOAT_FALLBACK
                        case OP_LOADR4_MEMBASE:
+#endif
                        case OP_LOADR8_MEMBASE:
                                if (ins->inst_offset != 0)
                                        continue;
@@ -211,7 +214,9 @@ handle_instruction:
                        case OP_STOREI2_MEMBASE_REG:
                        case OP_STOREI4_MEMBASE_REG:
                        case OP_STOREI8_MEMBASE_REG:
+#ifndef MONO_ARCH_SOFT_FLOAT_FALLBACK
                        case OP_STORER4_MEMBASE_REG:
+#endif
                        case OP_STORER8_MEMBASE_REG:
                        case OP_STOREV_MEMBASE:
                                if (ins->inst_offset != 0)
@@ -358,4 +363,8 @@ done:
                mono_print_code (cfg, "AFTER ALIAS_ANALYSIS");
 }
 
+#else /* !DISABLE_JIT */
+
+MONO_EMPTY_SOURCE_FILE (alias_analysis);
+
 #endif /* !DISABLE_JIT */
index dba952c9ff1763d8926082130c5f10e4827e0a0e..6c30c8f5bd11d92bf78f9c95192070ef72b52487 100644 (file)
@@ -4,6 +4,7 @@
  * Author:
  *   Dietmar Maurer (dietmar@ximian.com)
  *   Zoltan Varga (vargaz@gmail.com)
+ *   Johan Lorensson (lateralusx.github@gmail.com)
  *
  * (C) 2002 Ximian, Inc.
  * Copyright 2003-2011 Novell, Inc 
 
 #if !defined(DISABLE_AOT) && !defined(DISABLE_JIT)
 
+// Use MSVC toolchain, Clang for MSVC using MSVC codegen and linker, when compiling for AMD64
+// targeting WIN32 platforms running AOT compiler on WIN32 platform with VS installation.
+#if defined(TARGET_AMD64) && defined(TARGET_WIN32) && defined(HOST_WIN32) && defined(_MSC_VER)
+#define TARGET_X86_64_WIN32_MSVC
+#endif
+
+#if defined(TARGET_X86_64_WIN32_MSVC)
+#define TARGET_WIN32_MSVC
+#endif
+
 #if defined(__linux__) || defined(__native_client_codegen__)
 #define RODATA_SECT ".rodata"
 #elif defined(TARGET_MACH)
 #define RODATA_SECT ".section __TEXT, __const"
+#elif defined(TARGET_WIN32_MSVC)
+#define RODATA_SECT ".rdata"
 #else
 #define RODATA_SECT ".text"
 #endif
@@ -219,6 +232,7 @@ typedef struct MonoAotCompile {
        gboolean gas_line_numbers;
        /* Whenever to emit an object file directly from llc */
        gboolean llvm_owriter;
+       gboolean llvm_owriter_supported;
        MonoImageWriter *w;
        MonoDwarfWriter *dwarf;
        FILE *fp;
@@ -325,6 +339,9 @@ get_unwind_info_offset (MonoAotCompile *acfg, guint8 *encoded, guint32 encoded_l
 static char*
 get_plt_entry_debug_sym (MonoAotCompile *acfg, MonoJumpInfo *ji, GHashTable *cache);
 
+static void
+add_gsharedvt_wrappers (MonoAotCompile *acfg, MonoMethodSignature *sig, gboolean gsharedvt_in, gboolean gsharedvt_out);
+
 static void
 aot_printf (MonoAotCompile *acfg, const gchar *format, ...)
 {
@@ -601,11 +618,29 @@ emit_global_inner (MonoAotCompile *acfg, const char *name, gboolean func)
 
 #endif
 
+static inline gboolean
+link_shared_library (MonoAotCompile *acfg)
+{
+       return !acfg->aot_opts.static_link && !acfg->aot_opts.asm_only;
+}
+
+static inline gboolean
+add_to_global_symbol_table (MonoAotCompile *acfg)
+{
+#ifdef TARGET_WIN32_MSVC
+       return acfg->aot_opts.no_dlsym || link_shared_library (acfg);
+#else
+       return acfg->aot_opts.no_dlsym;
+#endif
+}
+
 static void
 emit_global (MonoAotCompile *acfg, const char *name, gboolean func)
 {
-       if (acfg->aot_opts.no_dlsym) {
+       if (add_to_global_symbol_table (acfg))
                g_ptr_array_add (acfg->globals, g_strdup (name));
+
+       if (acfg->aot_opts.no_dlsym) {
                mono_img_writer_emit_local_symbol (acfg->w, name, NULL, func);
        } else {
                emit_global_inner (acfg, name, func);
@@ -810,6 +845,10 @@ emit_code_bytes (MonoAotCompile *acfg, const guint8* buf, int size)
 #define EMIT_DWARF_INFO 1
 #endif
 
+#ifdef TARGET_WIN32_MSVC
+#undef EMIT_DWARF_INFO
+#endif
+
 #if defined(TARGET_ARM)
 #define AOT_FUNC_ALIGNMENT 4
 #else
@@ -824,7 +863,9 @@ emit_code_bytes (MonoAotCompile *acfg, const guint8* buf, int size)
 #define PPC_LDX_OP "lwzx"
 #endif
 
-#ifdef TARGET_AMD64
+#ifdef TARGET_X86_64_WIN32_MSVC
+#define AOT_TARGET_STR "AMD64 (WIN32) (MSVC codegen)"
+#elif TARGET_AMD64
 #define AOT_TARGET_STR "AMD64"
 #endif
 
@@ -879,6 +920,7 @@ arch_init (MonoAotCompile *acfg)
 {
        acfg->llc_args = g_string_new ("");
        acfg->as_args = g_string_new ("");
+       acfg->llvm_owriter_supported = TRUE;
 
        /*
         * The prefix LLVM likes to put in front of symbol names on darwin.
@@ -941,6 +983,10 @@ arch_init (MonoAotCompile *acfg)
 #ifdef MONOTOUCH
        acfg->global_symbols = TRUE;
 #endif
+
+#ifdef TARGET_ANDROID
+       acfg->llvm_owriter_supported = FALSE;
+#endif
 }
 
 #ifdef TARGET_ARM64
@@ -1145,7 +1191,7 @@ arm64_emit_specific_trampoline_pages (MonoAotCompile *acfg)
        /* Trampoline argument */
        arm_ldrx (code, ARMREG_IP1, ARMREG_IP0, 0);
 
-       /* Same as arch_emit_imt_thunk () */
+       /* Same as arch_emit_imt_trampoline () */
        labels [0] = code;
        arm_ldrx (code, ARMREG_IP0, ARMREG_IP1, 0);
        arm_cmpx (code, ARMREG_IP0, MONO_ARCH_RGCTX_REG);
@@ -1177,7 +1223,7 @@ arm64_emit_specific_trampoline_pages (MonoAotCompile *acfg)
        emit_code_bytes (acfg, buf, code - buf);
 
        common_tramp_size = code - buf;
-       acfg->tramp_page_code_offsets [MONO_AOT_TRAMP_IMT_THUNK] = common_tramp_size;
+       acfg->tramp_page_code_offsets [MONO_AOT_TRAMP_IMT] = common_tramp_size;
 
        arm64_emit_tramp_page_specific_code (acfg, pagesize, common_tramp_size, specific_tramp_size);
 }
@@ -1215,7 +1261,7 @@ arm64_emit_static_rgctx_trampoline (MonoAotCompile *acfg, int offset, int *tramp
 }
 
 static void
-arm64_emit_imt_thunk (MonoAotCompile *acfg, int offset, int *tramp_size)
+arm64_emit_imt_trampoline (MonoAotCompile *acfg, int offset, int *tramp_size)
 {
        guint8 buf [128];
        guint8 *code, *labels [16];
@@ -1423,7 +1469,6 @@ arch_emit_got_access (MonoAotCompile *acfg, const char *got_symbol, guint8 *code
 #elif defined(TARGET_POWERPC)
        {
                guint8 buf [32];
-               guint8 *code;
 
                emit_bytes (acfg, code, mono_arch_get_patch_offset (code));
                code = buf;
@@ -1758,7 +1803,7 @@ arch_emit_specific_trampoline_pages (MonoAotCompile *acfg)
 
        acfg->tramp_page_code_offsets [MONO_AOT_TRAMP_SPECIFIC] = 16;
        acfg->tramp_page_code_offsets [MONO_AOT_TRAMP_STATIC_RGCTX] = 16;
-       acfg->tramp_page_code_offsets [MONO_AOT_TRAMP_IMT_THUNK] = 72;
+       acfg->tramp_page_code_offsets [MONO_AOT_TRAMP_IMT] = 72;
        acfg->tramp_page_code_offsets [MONO_AOT_TRAMP_GSHAREDVT_ARG] = 16;
 
        /* Unwind info for specifc trampolines */
@@ -2133,9 +2178,9 @@ arch_emit_static_rgctx_trampoline (MonoAotCompile *acfg, int offset, int *tramp_
 }      
 
 /*
- * arch_emit_imt_thunk:
+ * arch_emit_imt_trampoline:
  *
- *   Emit an IMT thunk usable in full-aot mode. The thunk uses 1 got slot which
+ *   Emit an IMT trampoline usable in full-aot mode. The trampoline uses 1 got slot which
  * points to an array of pointer pairs. The pairs of the form [key, ptr], where
  * key is the IMT key, and ptr holds the address of a memory location holding
  * the address to branch to if the IMT arg matches the key. The array is 
@@ -2144,7 +2189,7 @@ arch_emit_static_rgctx_trampoline (MonoAotCompile *acfg, int offset, int *tramp_
  * TRAMP_SIZE is set to the size of the emitted trampoline.
  */
 static void
-arch_emit_imt_thunk (MonoAotCompile *acfg, int offset, int *tramp_size)
+arch_emit_imt_trampoline (MonoAotCompile *acfg, int offset, int *tramp_size)
 {
 #if defined(TARGET_AMD64)
        guint8 *buf, *code;
@@ -2333,7 +2378,7 @@ arch_emit_imt_thunk (MonoAotCompile *acfg, int offset, int *tramp_size)
 
        *tramp_size = code - buf + 4;
 #elif defined(TARGET_ARM64)
-       arm64_emit_imt_thunk (acfg, offset, tramp_size);
+       arm64_emit_imt_trampoline (acfg, offset, tramp_size);
 #elif defined(TARGET_POWERPC)
        guint8 buf [128];
        guint8 *code, *labels [16];
@@ -2480,9 +2525,10 @@ mono_get_field_token (MonoClassField *field)
        MonoClass *klass = field->parent;
        int i;
 
-       for (i = 0; i < klass->field.count; ++i) {
+       int fcount = mono_class_get_field_count (klass);
+       for (i = 0; i < fcount; ++i) {
                if (field == &klass->fields [i])
-                       return MONO_TOKEN_FIELD_DEF | (klass->field.first + 1 + i);
+                       return MONO_TOKEN_FIELD_DEF | (mono_class_get_first_field_idx (klass) + 1 + i);
        }
 
        g_assert_not_reached ();
@@ -2761,7 +2807,7 @@ encode_klass_ref_inner (MonoAotCompile *acfg, MonoClass *klass, guint8 *buf, gui
         * information.
         */
 
-       if (klass->generic_class) {
+       if (mono_class_is_ginst (klass)) {
                guint32 token;
                g_assert (klass->type_token);
 
@@ -2771,8 +2817,8 @@ encode_klass_ref_inner (MonoAotCompile *acfg, MonoClass *klass, guint8 *buf, gui
                        encode_value (MONO_AOT_TYPEREF_TYPESPEC_TOKEN, p, &p);
                        encode_value (token, p, &p);
                } else {
-                       MonoClass *gclass = klass->generic_class->container_class;
-                       MonoGenericInst *inst = klass->generic_class->context.class_inst;
+                       MonoClass *gclass = mono_class_get_generic_class (klass)->container_class;
+                       MonoGenericInst *inst = mono_class_get_generic_class (klass)->context.class_inst;
                        static int count = 0;
                        guint8 *p1 = p;
 
@@ -2846,7 +2892,7 @@ encode_klass_ref (MonoAotCompile *acfg, MonoClass *klass, guint8 *buf, guint8 **
        /* 
         * The encoding of generic instances is large so emit them only once.
         */
-       if (klass->generic_class) {
+       if (mono_class_is_ginst (klass)) {
                guint32 token;
                g_assert (klass->type_token);
 
@@ -3607,7 +3653,7 @@ can_marshal_struct (MonoClass *klass)
        MonoMarshalType *info;
        int i;
 
-       if ((klass->flags & TYPE_ATTRIBUTE_LAYOUT_MASK) == TYPE_ATTRIBUTE_AUTO_LAYOUT)
+       if (mono_class_is_auto_layout (klass))
                return FALSE;
 
        info = mono_marshal_load_type_info (klass);
@@ -3679,8 +3725,8 @@ create_gsharedvt_inst (MonoAotCompile *acfg, MonoMethod *method, MonoGenericCont
 
        memset (ctx, 0, sizeof (MonoGenericContext));
 
-       if (method->klass->generic_container) {
-               shared_context = method->klass->generic_container->context;
+       if (mono_class_is_gtd (method->klass)) {
+               shared_context = mono_class_get_generic_container (method->klass)->context;
                inst = shared_context.class_inst;
 
                args = g_new0 (MonoType*, inst->type_argc);
@@ -3838,13 +3884,14 @@ add_wrappers (MonoAotCompile *acfg)
                csig->params [1] = &mono_defaults.exception_class->byval_arg;
                add_method (acfg, get_runtime_invoke_sig (csig));
 
-               /* Assembly runtime-invoke (string, bool) [DoAssemblyResolve] */
-               csig = mono_metadata_signature_alloc (mono_defaults.corlib, 2);
+               /* Assembly runtime-invoke (string, Assembly, bool) [DoAssemblyResolve] */
+               csig = mono_metadata_signature_alloc (mono_defaults.corlib, 3);
                csig->hasthis = 1;
                csig->ret = &(mono_class_load_from_name (
                                                                                        mono_defaults.corlib, "System.Reflection", "Assembly"))->byval_arg;
                csig->params [0] = &mono_defaults.string_class->byval_arg;
-               csig->params [1] = &mono_defaults.boolean_class->byval_arg;
+               csig->params [1] = &(mono_class_load_from_name (mono_defaults.corlib, "System.Reflection", "Assembly"))->byval_arg;
+               csig->params [2] = &mono_defaults.boolean_class->byval_arg;
                add_method (acfg, get_runtime_invoke_sig (csig));
 
                /* runtime-invoke used by finalizers */
@@ -3958,7 +4005,7 @@ add_wrappers (MonoAotCompile *acfg)
                if (!klass->delegate || klass == mono_defaults.delegate_class || klass == mono_defaults.multicastdelegate_class)
                        continue;
 
-               if (!klass->generic_container) {
+               if (!mono_class_is_gtd (klass)) {
                        method = mono_get_delegate_invoke (klass);
 
                        m = mono_marshal_get_delegate_invoke (method, NULL);
@@ -3998,7 +4045,7 @@ add_wrappers (MonoAotCompile *acfg)
                                        add_method (acfg, del_invoke);
                                }
                        }
-               } else if ((acfg->opts & MONO_OPT_GSHAREDVT) && klass->generic_container) {
+               } else if ((acfg->opts & MONO_OPT_GSHAREDVT) && mono_class_is_gtd (klass)) {
                        MonoError error;
                        MonoGenericContext ctx;
                        MonoMethod *inst, *gshared;
@@ -4092,7 +4139,7 @@ add_wrappers (MonoAotCompile *acfg)
                if (method->iflags & METHOD_IMPL_ATTRIBUTE_SYNCHRONIZED) {
                        if (method->is_generic) {
                                // FIXME:
-                       } else if ((acfg->opts & MONO_OPT_GSHAREDVT) && method->klass->generic_container) {
+                       } else if ((acfg->opts & MONO_OPT_GSHAREDVT) && mono_class_is_gtd (method->klass)) {
                                MonoError error;
                                MonoGenericContext ctx;
                                MonoMethod *inst, *gshared, *m;
@@ -4126,6 +4173,13 @@ add_wrappers (MonoAotCompile *acfg)
                        (method->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL)) {
                        add_method (acfg, mono_marshal_get_native_wrapper (method, TRUE, TRUE));
                }
+
+               if (method->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL) {
+                       if (acfg->aot_opts.llvm_only) {
+                               /* The wrappers have a different signature (hasthis is not set) so need to add this too */
+                               add_gsharedvt_wrappers (acfg, mono_method_signature (method), FALSE, TRUE);
+                       }
+               }
        }
  
        /* native-to-managed wrappers */
@@ -4259,7 +4313,7 @@ add_wrappers (MonoAotCompile *acfg)
                        continue;
                }
 
-               if (klass->valuetype && !klass->generic_container && can_marshal_struct (klass) &&
+               if (klass->valuetype && !mono_class_is_gtd (klass) && can_marshal_struct (klass) &&
                        !(klass->nested_in && strstr (klass->nested_in->name, "<PrivateImplementationDetails>") == klass->nested_in->name)) {
                        add_method (acfg, mono_marshal_get_struct_to_ptr (klass));
                        add_method (acfg, mono_marshal_get_ptr_to_struct (klass));
@@ -4274,8 +4328,8 @@ has_type_vars (MonoClass *klass)
                return TRUE;
        if (klass->rank)
                return has_type_vars (klass->element_class);
-       if (klass->generic_class) {
-               MonoGenericContext *context = &klass->generic_class->context;
+       if (mono_class_is_ginst (klass)) {
+               MonoGenericContext *context = &mono_class_get_generic_class (klass)->context;
                if (context->class_inst) {
                        int i;
 
@@ -4284,7 +4338,7 @@ has_type_vars (MonoClass *klass)
                                        return TRUE;
                }
        }
-       if (klass->generic_container)
+       if (mono_class_is_gtd (klass))
                return TRUE;
        return FALSE;
 }
@@ -4327,13 +4381,19 @@ gboolean mono_aot_mode_is_full (MonoAotOptions *opts)
        return opts->mode == MONO_AOT_MODE_FULL;
 }
 
+static
+gboolean mono_aot_mode_is_hybrid (MonoAotOptions *opts)
+{
+       return opts->mode == MONO_AOT_MODE_HYBRID;
+}
+
 static void add_generic_class_with_depth (MonoAotCompile *acfg, MonoClass *klass, int depth, const char *ref);
 
 static void
 add_generic_class (MonoAotCompile *acfg, MonoClass *klass, gboolean force, const char *ref)
 {
        /* This might lead to a huge code blowup so only do it if neccesary */
-       if (!mono_aot_mode_is_full (&acfg->aot_opts) && !force)
+       if (!mono_aot_mode_is_full (&acfg->aot_opts) && !mono_aot_mode_is_hybrid (&acfg->aot_opts) && !force)
                return;
 
        add_generic_class_with_depth (acfg, klass, 0, ref);
@@ -4388,13 +4448,13 @@ add_generic_class_with_depth (MonoAotCompile *acfg, MonoClass *klass, int depth,
 
        mono_class_init (klass);
 
-       if (klass->generic_class && klass->generic_class->context.class_inst->is_open)
+       if (mono_class_is_ginst (klass) && mono_class_get_generic_class (klass)->context.class_inst->is_open)
                return;
 
        if (has_type_vars (klass))
                return;
 
-       if (!klass->generic_class && !klass->rank)
+       if (!mono_class_is_ginst (klass) && !klass->rank)
                return;
 
        if (mono_class_has_failure (klass))
@@ -4418,7 +4478,7 @@ add_generic_class_with_depth (MonoAotCompile *acfg, MonoClass *klass, int depth,
         * Use gsharedvt for generic collections with vtype arguments to avoid code blowup.
         * Enable this only for some classes since gsharedvt might not support all methods.
         */
-       if ((acfg->opts & MONO_OPT_GSHAREDVT) && klass->image == mono_defaults.corlib && klass->generic_class && klass->generic_class->context.class_inst && is_vt_inst (klass->generic_class->context.class_inst) &&
+       if ((acfg->opts & MONO_OPT_GSHAREDVT) && klass->image == mono_defaults.corlib && mono_class_is_ginst (klass) && mono_class_get_generic_class (klass)->context.class_inst && is_vt_inst (mono_class_get_generic_class (klass)->context.class_inst) &&
                (!strcmp (klass->name, "Dictionary`2") || !strcmp (klass->name, "List`1") || !strcmp (klass->name, "ReadOnlyCollection`1")))
                use_gsharedvt = TRUE;
 
@@ -4475,7 +4535,7 @@ add_generic_class_with_depth (MonoAotCompile *acfg, MonoClass *klass, int depth,
         */
        if (klass->image == mono_defaults.corlib && !strcmp (klass->name_space, "System.Collections.Generic") &&
                (!strcmp(klass->name, "ICollection`1") || !strcmp (klass->name, "IEnumerable`1") || !strcmp (klass->name, "IList`1") || !strcmp (klass->name, "IEnumerator`1") || !strcmp (klass->name, "IReadOnlyList`1"))) {
-               MonoClass *tclass = mono_class_from_mono_type (klass->generic_class->context.class_inst->type_argv [0]);
+               MonoClass *tclass = mono_class_from_mono_type (mono_class_get_generic_class (klass)->context.class_inst->type_argv [0]);
                MonoClass *array_class = mono_bounded_array_class_get (tclass, 1, FALSE);
                gpointer iter;
                char *name_prefix;
@@ -4496,7 +4556,7 @@ add_generic_class_with_depth (MonoAotCompile *acfg, MonoClass *klass, int depth,
                                        break;
                        }
                        g_assert (nclass);
-                       nclass = mono_class_inflate_generic_class_checked (nclass, mono_generic_class_get_context (klass->generic_class), &error);
+                       nclass = mono_class_inflate_generic_class_checked (nclass, mono_generic_class_get_context (mono_class_get_generic_class (klass)), &error);
                        mono_error_assert_ok (&error); /* FIXME don't swallow the error */
                        add_generic_class (acfg, nclass, FALSE, "ICollection<T>");
                }
@@ -4516,7 +4576,7 @@ add_generic_class_with_depth (MonoAotCompile *acfg, MonoClass *klass, int depth,
        /* Add an instance of GenericComparer<T> which is created dynamically by Comparer<T> */
        if (klass->image == mono_defaults.corlib && !strcmp (klass->name_space, "System.Collections.Generic") && !strcmp (klass->name, "Comparer`1")) {
                MonoError error;
-               MonoClass *tclass = mono_class_from_mono_type (klass->generic_class->context.class_inst->type_argv [0]);
+               MonoClass *tclass = mono_class_from_mono_type (mono_class_get_generic_class (klass)->context.class_inst->type_argv [0]);
                MonoClass *icomparable, *gcomparer, *icomparable_inst;
                MonoGenericContext ctx;
                MonoType *args [16];
@@ -4544,7 +4604,7 @@ add_generic_class_with_depth (MonoAotCompile *acfg, MonoClass *klass, int depth,
        /* Add an instance of GenericEqualityComparer<T> which is created dynamically by EqualityComparer<T> */
        if (klass->image == mono_defaults.corlib && !strcmp (klass->name_space, "System.Collections.Generic") && !strcmp (klass->name, "EqualityComparer`1")) {
                MonoError error;
-               MonoClass *tclass = mono_class_from_mono_type (klass->generic_class->context.class_inst->type_argv [0]);
+               MonoClass *tclass = mono_class_from_mono_type (mono_class_get_generic_class (klass)->context.class_inst->type_argv [0]);
                MonoClass *iface, *gcomparer, *iface_inst;
                MonoGenericContext ctx;
                MonoType *args [16];
@@ -4573,7 +4633,7 @@ add_generic_class_with_depth (MonoAotCompile *acfg, MonoClass *klass, int depth,
        /* Add an instance of EnumComparer<T> which is created dynamically by EqualityComparer<T> for enums */
        if (klass->image == mono_defaults.corlib && !strcmp (klass->name_space, "System.Collections.Generic") && !strcmp (klass->name, "EqualityComparer`1")) {
                MonoClass *enum_comparer;
-               MonoClass *tclass = mono_class_from_mono_type (klass->generic_class->context.class_inst->type_argv [0]);
+               MonoClass *tclass = mono_class_from_mono_type (mono_class_get_generic_class (klass)->context.class_inst->type_argv [0]);
                MonoGenericContext ctx;
                MonoType *args [16];
 
@@ -4595,7 +4655,7 @@ add_generic_class_with_depth (MonoAotCompile *acfg, MonoClass *klass, int depth,
        /* Add an instance of ObjectComparer<T> which is created dynamically by Comparer<T> for enums */
        if (klass->image == mono_defaults.corlib && !strcmp (klass->name_space, "System.Collections.Generic") && !strcmp (klass->name, "Comparer`1")) {
                MonoClass *comparer;
-               MonoClass *tclass = mono_class_from_mono_type (klass->generic_class->context.class_inst->type_argv [0]);
+               MonoClass *tclass = mono_class_from_mono_type (mono_class_get_generic_class (klass)->context.class_inst->type_argv [0]);
                MonoGenericContext ctx;
                MonoType *args [16];
 
@@ -4771,7 +4831,7 @@ add_generic_instances (MonoAotCompile *acfg)
                                g_free (type_argv);
                        }
 
-                       if (method->is_generic || method->klass->generic_container)
+                       if (method->is_generic || mono_class_is_gtd (method->klass))
                                declaring_method = method;
                        else
                                declaring_method = mono_method_get_declaring_generic_method (method);
@@ -4990,7 +5050,7 @@ is_direct_callable (MonoAotCompile *acfg, MonoMethod *method, MonoJumpInfo *patc
                if (callee_cfg) {
                        gboolean direct_callable = TRUE;
 
-                       if (direct_callable && !(!callee_cfg->has_got_slots && (callee_cfg->method->klass->flags & TYPE_ATTRIBUTE_BEFORE_FIELD_INIT)))
+                       if (direct_callable && !(!callee_cfg->has_got_slots && mono_class_is_before_field_init (callee_cfg->method->klass)))
                                direct_callable = FALSE;
                        if ((callee_cfg->method->iflags & METHOD_IMPL_ATTRIBUTE_SYNCHRONIZED) && (!method || method->wrapper_type != MONO_WRAPPER_SYNCHRONIZED))
                                // FIXME: Maybe call the wrapper directly ?
@@ -5786,6 +5846,7 @@ encode_patch (MonoAotCompile *acfg, MonoJumpInfo *patch_info, guint8 *buf, guint
                encode_method_ref (acfg, patch_info->data.virt_method->method, p, &p);
                break;
        case MONO_PATCH_INFO_GC_SAFE_POINT_FLAG:
+       case MONO_PATCH_INFO_GET_TLS_TRAMP:
                break;
        default:
                g_warning ("unable to handle jump info %d", patch_info->type);
@@ -6249,11 +6310,11 @@ emit_klass_info (MonoAotCompile *acfg, guint32 token)
 
        mono_class_has_finalizer (klass);
 
-       if (klass->generic_container || cant_encode) {
+       if (mono_class_is_gtd (klass) || cant_encode) {
                encode_value (-1, p, &p);
        } else {
                encode_value (klass->vtable_size, p, &p);
-               encode_value ((klass->generic_container ? (1 << 8) : 0) | (no_special_static << 7) | (klass->has_static_refs << 6) | (klass->has_references << 5) | ((klass->blittable << 4) | ((klass->ext && klass->ext->nested_classes) ? 1 : 0) << 3) | (klass->has_cctor << 2) | (klass->has_finalize << 1) | klass->ghcimpl, p, &p);
+               encode_value ((mono_class_is_gtd (klass) ? (1 << 8) : 0) | (no_special_static << 7) | (klass->has_static_refs << 6) | (klass->has_references << 5) | ((klass->blittable << 4) | ((mono_class_get_ext (klass) && mono_class_get_ext (klass)->nested_classes) ? 1 : 0) << 3) | (klass->has_cctor << 2) | (klass->has_finalize << 1) | klass->ghcimpl, p, &p);
                if (klass->has_cctor)
                        encode_method_ref (acfg, mono_class_get_cctor (klass), p, &p);
                if (klass->has_finalize)
@@ -6704,7 +6765,7 @@ emit_trampolines (MonoAotCompile *acfg)
                 * These include the following:
                 * - specific trampolines
                 * - static rgctx invoke trampolines
-                * - imt thunks
+                * - imt trampolines
                 * These trampolines have the same code, they are parameterized by GOT 
                 * slots. 
                 * They are defined in this file, in the arch_... routines instead of
@@ -6740,8 +6801,8 @@ emit_trampolines (MonoAotCompile *acfg)
                        case MONO_AOT_TRAMP_STATIC_RGCTX:
                                sprintf (symbol, "static_rgctx_trampolines");
                                break;
-                       case MONO_AOT_TRAMP_IMT_THUNK:
-                               sprintf (symbol, "imt_thunks");
+                       case MONO_AOT_TRAMP_IMT:
+                               sprintf (symbol, "imt_trampolines");
                                break;
                        case MONO_AOT_TRAMP_GSHAREDVT_ARG:
                                sprintf (symbol, "gsharedvt_arg_trampolines");
@@ -6772,8 +6833,8 @@ emit_trampolines (MonoAotCompile *acfg)
                                        arch_emit_static_rgctx_trampoline (acfg, tramp_got_offset, &tramp_size);                                
                                        tramp_got_offset += 2;
                                        break;
-                               case MONO_AOT_TRAMP_IMT_THUNK:
-                                       arch_emit_imt_thunk (acfg, tramp_got_offset, &tramp_size);
+                               case MONO_AOT_TRAMP_IMT:
+                                       arch_emit_imt_trampoline (acfg, tramp_got_offset, &tramp_size);
                                        tramp_got_offset += 1;
                                        break;
                                case MONO_AOT_TRAMP_GSHAREDVT_ARG:
@@ -7306,7 +7367,7 @@ is_concrete_type (MonoType *t)
                if (!MONO_TYPE_ISSTRUCT (t))
                        return TRUE;
                klass = mono_class_from_mono_type (t);
-               orig_ctx = &klass->generic_class->context;
+               orig_ctx = &mono_class_get_generic_class (klass)->context;
 
                inst = orig_ctx->class_inst;
                if (inst) {
@@ -7443,7 +7504,7 @@ compile_method (MonoAotCompile *acfg, MonoMethod *method)
        InterlockedIncrement (&acfg->stats.mcount);
 
 #if 0
-       if (method->is_generic || method->klass->generic_container) {
+       if (method->is_generic || mono_class_is_gtd (method->klass)) {
                InterlockedIncrement (&acfg->stats.genericcount);
                return;
        }
@@ -7466,6 +7527,8 @@ compile_method (MonoAotCompile *acfg, MonoMethod *method)
                flags = (JitFlags)(flags | JIT_FLAG_LLVM_ONLY | JIT_FLAG_EXPLICIT_NULL_CHECKS);
        if (acfg->aot_opts.no_direct_calls)
                flags = (JitFlags)(flags | JIT_FLAG_NO_DIRECT_ICALLS);
+       if (acfg->aot_opts.direct_pinvoke)
+               flags = (JitFlags)(flags | JIT_FLAG_DIRECT_PINVOKE);
 
        jit_timer = mono_time_track_start ();
        cfg = mini_method_compile (method, acfg->opts, mono_get_root_domain (), flags, 0, index);
@@ -7622,7 +7685,7 @@ compile_method (MonoAotCompile *acfg, MonoMethod *method)
                        case MONO_PATCH_INFO_VTABLE: {
                                MonoClass *klass = patch_info->data.klass;
 
-                               if (klass->generic_class && !mini_class_is_generic_sharable (klass))
+                               if (mono_class_is_ginst (klass) && !mini_class_is_generic_sharable (klass))
                                        add_generic_class_with_depth (acfg, klass, depth + 5, "vtable");
                                break;
                        }
@@ -7630,7 +7693,7 @@ compile_method (MonoAotCompile *acfg, MonoMethod *method)
                                MonoClass *klass = patch_info->data.field->parent;
 
                                /* The .cctor needs to run at runtime. */
-                               if (klass->generic_class && !mono_generic_context_is_sharable_full (&klass->generic_class->context, FALSE, FALSE) && mono_class_get_cctor (klass))
+                               if (mono_class_is_ginst (klass) && !mono_generic_context_is_sharable_full (&mono_class_get_generic_class (klass)->context, FALSE, FALSE) && mono_class_get_cctor (klass))
                                        add_extra_method_with_depth (acfg, mono_class_get_cctor (klass), depth + 1);
                                break;
                        }
@@ -7770,7 +7833,7 @@ compile_method (MonoAotCompile *acfg, MonoMethod *method)
        InterlockedIncrement (&acfg->stats.ccount);
 }
  
-static gsize WINAPI
+static mono_thread_start_return_t WINAPI
 compile_thread_main (gpointer user_data)
 {
        MonoDomain *domain = ((MonoDomain **)user_data) [0];
@@ -8169,20 +8232,20 @@ mono_aot_patch_info_dup (MonoJumpInfo* ji)
 static int
 execute_system (const char * command)
 {
-       int status;
+       int status = 0;
 
-#if _WIN32
+#if HOST_WIN32
        // We need an extra set of quotes around the whole command to properly handle commands 
        // with spaces since internally the command is called through "cmd /c.
-       command = g_strdup_printf ("\"%s\"", command);
+       char * quoted_command = g_strdup_printf ("\"%s\"", command);
 
-       int size =  MultiByteToWideChar (CP_UTF8, 0 , command , -1, NULL , 0);
+       int size =  MultiByteToWideChar (CP_UTF8, 0 , quoted_command , -1, NULL , 0);
        wchar_t* wstr = g_malloc (sizeof (wchar_t) * size);
-       MultiByteToWideChar (CP_UTF8, 0, command, -1, wstr , size);
+       MultiByteToWideChar (CP_UTF8, 0, quoted_command, -1, wstr , size);
        status = _wsystem (wstr);
        g_free (wstr);
 
-       g_free (command);
+       g_free (quoted_command);
 #elif defined (HAVE_SYSTEM)
        status = system (command);
 #else
@@ -8363,7 +8426,7 @@ emit_code (MonoAotCompile *acfg)
                method = cfg->orig_method;
 
                /* Emit unbox trampoline */
-               if (mono_aot_mode_is_full (&acfg->aot_opts) && cfg->orig_method->klass->valuetype && !(acfg->aot_opts.llvm_only && cfg->compile_llvm)) {
+               if (mono_aot_mode_is_full (&acfg->aot_opts) && cfg->orig_method->klass->valuetype) {
                        sprintf (symbol, "ut_%d", get_method_index (acfg, method));
 
                        emit_section_change (acfg, ".text", 0);
@@ -8435,7 +8498,8 @@ emit_code (MonoAotCompile *acfg)
        emit_section_change (acfg, ".text", 1);
        emit_alignment_code (acfg, 8);
        emit_info_symbol (acfg, symbol);
-       emit_local_symbol (acfg, symbol, "method_addresses_end", TRUE);
+       if (acfg->aot_opts.write_symbols)
+               emit_local_symbol (acfg, symbol, "method_addresses_end", TRUE);
        emit_unset_mode (acfg);
        if (acfg->need_no_dead_strip)
                fprintf (acfg->fp, "    .no_dead_strip %s\n", symbol);
@@ -8445,11 +8509,7 @@ emit_code (MonoAotCompile *acfg)
                int call_size;
 
                if (acfg->cfgs [i]) {
-                       if (acfg->aot_opts.llvm_only && acfg->cfgs [i]->compile_llvm)
-                               /* Obtained by calling a generated function in the LLVM image */
-                               arch_emit_direct_call (acfg, symbol, FALSE, FALSE, NULL, &call_size);
-                       else
-                               arch_emit_direct_call (acfg, acfg->cfgs [i]->asm_symbol, FALSE, acfg->thumb_mixed && acfg->cfgs [i]->compile_llvm, NULL, &call_size);
+                       arch_emit_direct_call (acfg, acfg->cfgs [i]->asm_symbol, FALSE, acfg->thumb_mixed && acfg->cfgs [i]->compile_llvm, NULL, &call_size);
                } else {
                        arch_emit_direct_call (acfg, symbol, FALSE, FALSE, NULL, &call_size);
                }
@@ -8478,7 +8538,7 @@ emit_code (MonoAotCompile *acfg)
 
                method = cfg->orig_method;
 
-               if (mono_aot_mode_is_full (&acfg->aot_opts) && cfg->orig_method->klass->valuetype && !(acfg->aot_opts.llvm_only && cfg->compile_llvm)) {
+               if (mono_aot_mode_is_full (&acfg->aot_opts) && cfg->orig_method->klass->valuetype) {
                        index = get_method_index (acfg, method);
 
                        emit_int32 (acfg, index);
@@ -8508,7 +8568,7 @@ emit_code (MonoAotCompile *acfg)
 
                method = cfg->orig_method;
 
-               if (mono_aot_mode_is_full (&acfg->aot_opts) && cfg->orig_method->klass->valuetype && !(acfg->aot_opts.llvm_only && cfg->compile_llvm)) {
+               if (mono_aot_mode_is_full (&acfg->aot_opts) && cfg->orig_method->klass->valuetype) {
 #ifdef MONO_ARCH_AOT_SUPPORTED
                        int call_size;
 
@@ -8611,8 +8671,8 @@ mono_aot_method_hash (MonoMethod *method)
 
        sig = mono_method_signature (method);
 
-       if (method->klass->generic_class)
-               class_ginst = method->klass->generic_class->context.class_inst;
+       if (mono_class_is_ginst (method->klass))
+               class_ginst = mono_class_get_generic_class (method->klass)->context.class_inst;
        if (method->is_inflated)
                ginst = ((MonoMethodInflated*)method)->context.method_inst;
 
@@ -8629,8 +8689,8 @@ mono_aot_method_hash (MonoMethod *method)
        if (!method->wrapper_type) {
                char *full_name;
 
-               if (klass->generic_class)
-                       full_name = mono_type_full_name (&klass->generic_class->container_class->byval_arg);
+               if (mono_class_is_ginst (klass))
+                       full_name = mono_type_full_name (&mono_class_get_generic_class (klass)->container_class->byval_arg);
                else
                        full_name = mono_type_full_name (&klass->byval_arg);
 
@@ -8685,7 +8745,7 @@ mono_aot_method_hash (MonoMethod *method)
                break;
        }
        
-       free (hashes_start);
+       g_free (hashes_start);
        
        return c;
 }
@@ -8887,13 +8947,13 @@ emit_extra_methods (MonoAotCompile *acfg)
 static void
 generate_aotid (guint8* aotid)
 {
-       gpointer *rand_handle;
+       gpointer rand_handle;
        MonoError error;
 
        mono_rand_open ();
        rand_handle = mono_rand_init (NULL, 0);
 
-       mono_rand_try_get_bytes (rand_handle, aotid, 16, &error);
+       mono_rand_try_get_bytes (&rand_handle, aotid, 16, &error);
        mono_error_assert_ok (&error);
 
        mono_rand_close (rand_handle);
@@ -9234,7 +9294,8 @@ emit_got (MonoAotCompile *acfg)
 #else
        emit_section_change (acfg, ".bss", 0);
        emit_alignment (acfg, 8);
-       emit_local_symbol (acfg, symbol, "got_end", FALSE);
+       if (acfg->aot_opts.write_symbols)
+               emit_local_symbol (acfg, symbol, "got_end", FALSE);
        emit_label (acfg, symbol);
        if (acfg->llvm)
                emit_info_symbol (acfg, "jit_got");
@@ -9251,6 +9312,53 @@ typedef struct GlobalsTableEntry {
        struct GlobalsTableEntry *next;
 } GlobalsTableEntry;
 
+#ifdef TARGET_WIN32_MSVC
+#define DLL_ENTRY_POINT "DllMain"
+
+static void
+emit_library_info (MonoAotCompile *acfg)
+{
+       // Only include for shared libraries linked directly from generated object.
+       if (link_shared_library (acfg)) {
+               char    *name = NULL;
+               char    symbol [MAX_SYMBOL_SIZE];
+
+               // Ask linker to export all global symbols.
+               emit_section_change (acfg, ".drectve", 0);
+               for (guint i = 0; i < acfg->globals->len; ++i) {
+                       name = (char *)g_ptr_array_index (acfg->globals, i);
+                       g_assert (name != NULL);
+                       sprintf_s (symbol, MAX_SYMBOL_SIZE, " /EXPORT:%s", name);
+                       emit_string (acfg, symbol);
+               }
+
+               // Emit DLLMain function, needed by MSVC linker for DLL's.
+               // NOTE, DllMain should not go into exports above.
+               emit_section_change (acfg, ".text", 0);
+               emit_global (acfg, DLL_ENTRY_POINT, TRUE);
+               emit_label (acfg, DLL_ENTRY_POINT);
+
+               // Simple implementation of DLLMain, just returning TRUE.
+               // For more information about DLLMain: https://msdn.microsoft.com/en-us/library/windows/desktop/ms682583(v=vs.85).aspx
+               fprintf (acfg->fp, "movl $1, %%eax\n");
+               fprintf (acfg->fp, "ret\n");
+
+               // Inform linker about our dll entry function.
+               emit_section_change (acfg, ".drectve", 0);
+               emit_string (acfg, "/ENTRY:" DLL_ENTRY_POINT);
+               return;
+       }
+}
+
+#else
+
+static inline void
+emit_library_info (MonoAotCompile *acfg)
+{
+       return;
+}
+#endif
+
 static void
 emit_globals (MonoAotCompile *acfg)
 {
@@ -9262,6 +9370,7 @@ emit_globals (MonoAotCompile *acfg)
 
        if (!acfg->aot_opts.static_link)
                return;
+
        if (acfg->aot_opts.llvm_only) {
                g_assert (acfg->globals->len == 0);
                return;
@@ -9468,7 +9577,7 @@ emit_aot_file_info (MonoAotCompile *acfg, MonoAotFileInfo *info)
        if (acfg->num_trampoline_got_entries) {
                symbols [sindex ++] = "specific_trampolines";
                symbols [sindex ++] = "static_rgctx_trampolines";
-               symbols [sindex ++] = "imt_thunks";
+               symbols [sindex ++] = "imt_trampolines";
                symbols [sindex ++] = "gsharedvt_arg_trampolines";
        } else {
                symbols [sindex ++] = NULL;
@@ -9727,7 +9836,7 @@ collect_methods (MonoAotCompile *acfg)
                }
                */
 
-               if (method->is_generic || method->klass->generic_container)
+               if (method->is_generic || mono_class_is_gtd (method->klass))
                        /* Compile the ref shared version instead */
                        method = mini_get_shared_method (method);
 
@@ -9748,7 +9857,7 @@ collect_methods (MonoAotCompile *acfg)
                method = mono_get_method_checked (acfg->image, token, NULL, NULL, &error);
                report_loader_error (acfg, &error, "Failed to load method token 0x%x due to %s\n", i, mono_error_get_message (&error));
 
-               if (method->is_generic || method->klass->generic_container) {
+               if (method->is_generic || mono_class_is_gtd (method->klass)) {
                        MonoMethod *gshared;
 
                        gshared = mini_get_shared_method_full (method, TRUE, TRUE);
@@ -9772,10 +9881,9 @@ compile_methods (MonoAotCompile *acfg)
                GPtrArray *frag;
                int len, j;
                GPtrArray *threads;
-               HANDLE handle;
+               MonoThreadHandle *thread_handle;
                gpointer *user_data;
                MonoMethod **methods;
-               MonoThreadParm tp;
 
                methods_len = acfg->methods->len;
 
@@ -9806,16 +9914,14 @@ compile_methods (MonoAotCompile *acfg)
                        user_data [1] = acfg;
                        user_data [2] = frag;
                        
-                       tp.priority = MONO_THREAD_PRIORITY_NORMAL;
-                       tp.stack_size = 0;
-                       tp.creation_flags = 0;
-                       handle = mono_threads_create_thread (compile_thread_main, (gpointer) user_data, &tp, NULL);
-                       g_ptr_array_add (threads, handle);
+                       thread_handle = mono_threads_create_thread (compile_thread_main, (gpointer) user_data, NULL, NULL);
+                       g_ptr_array_add (threads, thread_handle);
                }
                g_free (methods);
 
                for (i = 0; i < threads->len; ++i) {
-                       WaitForSingleObjectEx (g_ptr_array_index (threads, i), INFINITE, FALSE);
+                       mono_thread_info_wait_one_handle (g_ptr_array_index (threads, i), INFINITE, FALSE);
+                       mono_threads_close_thread_handle (g_ptr_array_index (threads, i));
                }
        } else {
                methods_len = 0;
@@ -9836,7 +9942,9 @@ compile_asm (MonoAotCompile *acfg)
        const char *tool_prefix = acfg->aot_opts.tool_prefix ? acfg->aot_opts.tool_prefix : "";
        char *ld_flags = acfg->aot_opts.ld_flags ? acfg->aot_opts.ld_flags : g_strdup("");
 
-#if defined(TARGET_AMD64) && !defined(TARGET_MACH)
+#ifdef TARGET_WIN32_MSVC
+#define AS_OPTIONS "-c -x assembler"
+#elif defined(TARGET_AMD64) && !defined(TARGET_MACH)
 #define AS_OPTIONS "--64"
 #elif defined(TARGET_POWERPC64)
 #define AS_OPTIONS "-a64 -mppc64"
@@ -9856,10 +9964,18 @@ compile_asm (MonoAotCompile *acfg)
 #endif
 #elif defined(TARGET_OSX)
 #define AS_NAME "clang"
+#elif defined(TARGET_WIN32_MSVC)
+#define AS_NAME "clang.exe"
 #else
 #define AS_NAME "as"
 #endif
 
+#ifdef TARGET_WIN32_MSVC
+#define AS_OBJECT_FILE_SUFFIX "obj"
+#else
+#define AS_OBJECT_FILE_SUFFIX "o"
+#endif
+
 #if defined(sparc)
 #define LD_NAME "ld"
 #define LD_OPTIONS "-shared -G"
@@ -9869,6 +9985,9 @@ compile_asm (MonoAotCompile *acfg)
 #elif defined(TARGET_AMD64) && defined(TARGET_MACH)
 #define LD_NAME "clang"
 #define LD_OPTIONS "--shared"
+#elif defined(TARGET_WIN32_MSVC)
+#define LD_NAME "link.exe"
+#define LD_OPTIONS "/DLL /MACHINE:X64 /NOLOGO"
 #elif defined(TARGET_WIN32) && !defined(TARGET_ANDROID)
 #define LD_NAME "gcc"
 #define LD_OPTIONS "-shared"
@@ -9899,9 +10018,9 @@ compile_asm (MonoAotCompile *acfg)
                if (acfg->aot_opts.outfile)
                        objfile = g_strdup_printf ("%s", acfg->aot_opts.outfile);
                else
-                       objfile = g_strdup_printf ("%s.o", acfg->image->name);
+                       objfile = g_strdup_printf ("%s." AS_OBJECT_FILE_SUFFIX, acfg->image->name);
        } else {
-               objfile = g_strdup_printf ("%s.o", acfg->tmpfname);
+               objfile = g_strdup_printf ("%s." AS_OBJECT_FILE_SUFFIX, acfg->tmpfname);
        }
 
 #ifdef TARGET_OSX
@@ -9958,23 +10077,34 @@ compile_asm (MonoAotCompile *acfg)
        if (acfg->aot_opts.llvm_only)
                ld_flags = g_strdup_printf ("%s %s", ld_flags, "-lstdc++");
 
-#ifdef LD_NAME
+#ifdef TARGET_WIN32_MSVC
+       g_assert (tmp_outfile_name != NULL);
+       g_assert (objfile != NULL);
+       command = g_strdup_printf ("\"%s%s\" %s %s /OUT:\"%s\" \"%s\"", tool_prefix, LD_NAME, LD_OPTIONS,
+               ld_flags, tmp_outfile_name, objfile);
+#elif defined(LD_NAME)
        command = g_strdup_printf ("%s%s %s -o %s %s %s %s", tool_prefix, LD_NAME, LD_OPTIONS,
                wrap_path (tmp_outfile_name), wrap_path (llvm_ofile),
-               wrap_path (g_strdup_printf ("%s.o", acfg->tmpfname)), ld_flags);
+               wrap_path (g_strdup_printf ("%s." AS_OBJECT_FILE_SUFFIX, acfg->tmpfname)), ld_flags);
 #else
        // Default (linux)
-       char *args = g_strdup_printf ("%s %s -shared -o %s %s %s %s", tool_prefix, LD_OPTIONS,
-               wrap_path (tmp_outfile_name), wrap_path (llvm_ofile),
-               wrap_path (g_strdup_printf ("%s.o", acfg->tmpfname)), ld_flags);
-
-       if (acfg->llvm) {
-               command = g_strdup_printf ("clang++ %s", args);
+       if (acfg->aot_opts.tool_prefix) {
+               /* Cross compiling */
+               command = g_strdup_printf ("\"%sld\" %s -shared -o %s %s %s %s", tool_prefix, LD_OPTIONS,
+                                                                  wrap_path (tmp_outfile_name), wrap_path (llvm_ofile),
+                                                                  wrap_path (g_strdup_printf ("%s." AS_OBJECT_FILE_SUFFIX, acfg->tmpfname)), ld_flags);
        } else {
-               command = g_strdup_printf ("\"%sld\" %s", tool_prefix, args);
-       }
-       g_free (args);
+               char *args = g_strdup_printf ("%s -shared -o %s %s %s %s", LD_OPTIONS,
+                                                                         wrap_path (tmp_outfile_name), wrap_path (llvm_ofile),
+                                                                         wrap_path (g_strdup_printf ("%s." AS_OBJECT_FILE_SUFFIX, acfg->tmpfname)), ld_flags);
 
+               if (acfg->llvm) {
+                       command = g_strdup_printf ("clang++ %s", args);
+               } else {
+                       command = g_strdup_printf ("\"%sld\" %s", tool_prefix, args);
+               }
+               g_free (args);
+       }
 #endif
        aot_printf (acfg, "Executing the native linker: %s\n", command);
        if (execute_system (command) != 0) {
@@ -10359,6 +10489,11 @@ add_preinit_got_slots (MonoAotCompile *acfg)
        get_got_offset (acfg, FALSE, ji);
        get_got_offset (acfg, TRUE, ji);
 
+       ji = (MonoJumpInfo *)mono_mempool_alloc0 (acfg->mempool, sizeof (MonoJumpInfo));
+       ji->type = MONO_PATCH_INFO_GET_TLS_TRAMP;
+       get_got_offset (acfg, FALSE, ji);
+       get_got_offset (acfg, TRUE, ji);
+
        for (i = 0; i < sizeof (preinited_jit_icalls) / sizeof (char*); ++i) {
                ji = (MonoJumpInfo *)mono_mempool_alloc0 (acfg->mempool, sizeof (MonoAotCompile));
                ji->type = MONO_PATCH_INFO_INTERNAL_METHOD;
@@ -10415,34 +10550,27 @@ mono_compile_assembly (MonoAssembly *ass, guint32 opts, const char *aot_options)
        //acfg->aot_opts.print_skipped_methods = TRUE;
 
 #if !defined(MONO_ARCH_GSHAREDVT_SUPPORTED)
-       if (opts & MONO_OPT_GSHAREDVT) {
+       if (acfg->opts & MONO_OPT_GSHAREDVT) {
                aot_printerrf (acfg, "-O=gsharedvt not supported on this platform.\n");
                return 1;
        }
-#endif
-
-#if !defined(MONO_ARCH_GSHAREDVT_SUPPORTED)
-       if (!acfg->aot_opts.llvm_only && (opts & MONO_OPT_GSHAREDVT)) {
-               aot_printerrf (acfg, "-O=gsharedvt not supported on this platform.\n");
+       if (acfg->aot_opts.llvm_only) {
+               aot_printerrf (acfg, "--aot=llvmonly requires a runtime that supports gsharedvt.\n");
                return 1;
        }
+#else
+       if (acfg->aot_opts.llvm_only || mono_aot_mode_is_full (&acfg->aot_opts) || mono_aot_mode_is_hybrid (&acfg->aot_opts))
+               acfg->opts |= MONO_OPT_GSHAREDVT;
 #endif
 
+#if !defined(ENABLE_LLVM)
        if (acfg->aot_opts.llvm_only) {
-#ifndef MONO_ARCH_GSHAREDVT_SUPPORTED
-               aot_printerrf (acfg, "--aot=llvmonly requires a runtime that supports gsharedvt.\n");
+               aot_printerrf (acfg, "--aot=llvmonly requires a runtime compiled with llvm support.\n");
                return 1;
-#endif
-       }
-
-#if defined(MONO_ARCH_GSHAREDVT_SUPPORTED)
-       if (acfg->aot_opts.llvm_only || mono_aot_mode_is_full (&acfg->aot_opts)) {
-               acfg->opts |= MONO_OPT_GSHAREDVT;
-               opts |= MONO_OPT_GSHAREDVT;
        }
 #endif
 
-       if (opts & MONO_OPT_GSHAREDVT)
+       if (acfg->opts & MONO_OPT_GSHAREDVT)
                mono_set_generic_sharing_vt_supported (TRUE);
 
        aot_printf (acfg, "Mono Ahead of Time compiler - compiling assembly %s\n", image->name);
@@ -10494,22 +10622,9 @@ mono_compile_assembly (MonoAssembly *ass, guint32 opts, const char *aot_options)
                mini_llvm_init ();
 
                if (acfg->aot_opts.asm_only && !acfg->aot_opts.llvm_outfile) {
-                       aot_printerrf (acfg, "Compiling with LLVM and the asm-only option requires the llvm-outputfile= option.");
+                       aot_printerrf (acfg, "Compiling with LLVM and the asm-only option requires the llvm-outfile= option.\n");
                        return 1;
                }
-
-               /*
-                * Emit all LLVM code into a separate assembly/object file and link with it
-                * normally.
-                */
-               if (!acfg->aot_opts.asm_only) {
-                       acfg->llvm_owriter = TRUE;
-               } else if (acfg->aot_opts.llvm_outfile) {
-                       int len = strlen (acfg->aot_opts.llvm_outfile);
-
-                       if (len >= 2 && acfg->aot_opts.llvm_outfile [len - 2] == '.' && acfg->aot_opts.llvm_outfile [len - 1] == 'o')
-                               acfg->llvm_owriter = TRUE;
-               }
        }
 
        if (mono_aot_mode_is_full (&acfg->aot_opts))
@@ -10532,7 +10647,7 @@ mono_compile_assembly (MonoAssembly *ass, guint32 opts, const char *aot_options)
 #ifdef MONO_ARCH_GSHARED_SUPPORTED
        acfg->num_trampolines [MONO_AOT_TRAMP_STATIC_RGCTX] = mono_aot_mode_is_full (&acfg->aot_opts) ? acfg->aot_opts.nrgctx_trampolines : 0;
 #endif
-       acfg->num_trampolines [MONO_AOT_TRAMP_IMT_THUNK] = mono_aot_mode_is_full (&acfg->aot_opts) ? acfg->aot_opts.nimt_trampolines : 0;
+       acfg->num_trampolines [MONO_AOT_TRAMP_IMT] = mono_aot_mode_is_full (&acfg->aot_opts) ? acfg->aot_opts.nimt_trampolines : 0;
 #ifdef MONO_ARCH_GSHAREDVT_SUPPORTED
        if (acfg->opts & MONO_OPT_GSHAREDVT)
                acfg->num_trampolines [MONO_AOT_TRAMP_GSHAREDVT_ARG] = mono_aot_mode_is_full (&acfg->aot_opts) ? acfg->aot_opts.ngsharedvt_arg_trampolines : 0;
@@ -10542,6 +10657,22 @@ mono_compile_assembly (MonoAssembly *ass, guint32 opts, const char *aot_options)
 
        arch_init (acfg);
 
+       if (mono_use_llvm || acfg->aot_opts.llvm) {
+
+               /*
+                * Emit all LLVM code into a separate assembly/object file and link with it
+                * normally.
+                */
+               if (!acfg->aot_opts.asm_only && acfg->llvm_owriter_supported) {
+                       acfg->llvm_owriter = TRUE;
+               } else if (acfg->aot_opts.llvm_outfile) {
+                       int len = strlen (acfg->aot_opts.llvm_outfile);
+
+                       if (len >= 2 && acfg->aot_opts.llvm_outfile [len - 2] == '.' && acfg->aot_opts.llvm_outfile [len - 1] == 'o')
+                               acfg->llvm_owriter = TRUE;
+               }
+       }
+
        if (acfg->llvm && acfg->thumb_mixed)
                acfg->flags = (MonoAotFileFlags)(acfg->flags | MONO_AOT_FILE_FLAG_LLVM_THUMB);
        if (acfg->aot_opts.llvm_only)
@@ -10564,7 +10695,7 @@ mono_compile_assembly (MonoAssembly *ass, guint32 opts, const char *aot_options)
 
        acfg->method_index = 1;
 
-       if (mono_aot_mode_is_full (&acfg->aot_opts))
+       if (mono_aot_mode_is_full (&acfg->aot_opts) || mono_aot_mode_is_hybrid (&acfg->aot_opts))
                mono_set_partial_sharing_supported (TRUE);
 
        res = collect_methods (acfg);
@@ -10628,7 +10759,7 @@ mono_compile_assembly (MonoAssembly *ass, guint32 opts, const char *aot_options)
                        acfg->tmpfname = g_strdup_printf ("%s", acfg->aot_opts.outfile);
                else
                        acfg->tmpfname = g_strdup_printf ("%s.s", acfg->image->name);
-                       acfg->fp = fopen (acfg->tmpfname, "w+");
+               acfg->fp = fopen (acfg->tmpfname, "w+");
        } else {
                int i = g_file_open_tmp ("mono_aot_XXXXXX", &acfg->tmpfname, NULL);
                acfg->fp = fdopen (i, "w+");
@@ -10666,6 +10797,7 @@ mono_compile_assembly (MonoAssembly *ass, guint32 opts, const char *aot_options)
                acfg->gas_line_numbers = TRUE;
        }
 
+#ifdef EMIT_DWARF_INFO
        if ((!acfg->aot_opts.nodebug || acfg->aot_opts.dwarf_debug) && acfg->has_jitted_code) {
                if (acfg->aot_opts.dwarf_debug && !mono_debug_enabled ()) {
                        aot_printerrf (acfg, "The dwarf AOT option requires the --debug option.\n");
@@ -10673,6 +10805,7 @@ mono_compile_assembly (MonoAssembly *ass, guint32 opts, const char *aot_options)
                }
                acfg->dwarf = mono_dwarf_writer_create (acfg->w, NULL, 0, !acfg->gas_line_numbers);
        }
+#endif /* EMIT_DWARF_INFO */
 
        if (acfg->w)
                mono_img_writer_emit_start (acfg->w);
@@ -10723,6 +10856,8 @@ mono_compile_assembly (MonoAssembly *ass, guint32 opts, const char *aot_options)
 
        emit_file_info (acfg);
 
+       emit_library_info (acfg);
+
        if (acfg->dwarf) {
                emit_dwarf_info (acfg);
                mono_dwarf_writer_close (acfg->dwarf);
index 34fbdda6e078b66252696371c1bd626ff3589f60..c531afce043a4dc4ed03e3dd3909e7585c437a78 100644 (file)
@@ -473,7 +473,7 @@ decode_klass_ref (MonoAotModule *module, guint8 *buf, guint8 **endbuf, MonoError
                gclass = decode_klass_ref (module, p, &p, error);
                if (!gclass)
                        return NULL;
-               g_assert (gclass->generic_container);
+               g_assert (mono_class_is_gtd (gclass));
 
                memset (&ctx, 0, sizeof (ctx));
                ctx.class_inst = decode_generic_inst (module, p, &p, error);
@@ -528,7 +528,7 @@ decode_klass_ref (MonoAotModule *module, guint8 *buf, guint8 **endbuf, MonoError
                                        if (!class_def)
                                                return NULL;
 
-                                       container = class_def->generic_container;
+                                       container = mono_class_try_get_generic_container (class_def); //FIXME is this a case for a try_get?
                                }
                        } else {
                                // We didn't decode is_method, so we have to infer it from type enum.
@@ -684,7 +684,7 @@ decode_type (MonoAotModule *module, guint8 *buf, guint8 **endbuf, MonoError *err
                gclass = decode_klass_ref (module, p, &p, error);
                if (!gclass)
                        goto fail;
-               g_assert (gclass->generic_container);
+               g_assert (mono_class_is_gtd (gclass));
 
                memset (&ctx, 0, sizeof (ctx));
                ctx.class_inst = decode_generic_inst (module, p, &p, error);
@@ -694,7 +694,7 @@ decode_type (MonoAotModule *module, guint8 *buf, guint8 **endbuf, MonoError *err
                if (!type)
                        goto fail;
                klass = mono_class_from_mono_type (type);
-               t->data.generic_class = klass->generic_class;
+               t->data.generic_class = mono_class_get_generic_class (klass);
                break;
        }
        case MONO_TYPE_ARRAY: {
@@ -930,6 +930,9 @@ decode_method_ref_with_target (MonoAotModule *module, MethodRef *ref, MonoMethod
                                MANAGED_ALLOCATOR_SLOW_PATH : MANAGED_ALLOCATOR_REGULAR;
 
                        ref->method = mono_gc_get_managed_allocator_by_type (atype, variant);
+                       /* Try to fallback to the slow path version */
+                       if (!ref->method && variant == MANAGED_ALLOCATOR_REGULAR)
+                               ref->method = mono_gc_get_managed_allocator_by_type (atype, MANAGED_ALLOCATOR_SLOW_PATH);
                        if (!ref->method) {
                                mono_error_set_bad_image_name (error, module->aot_name, "Error: No managed allocator, but we need one for AOT.\nAre you using non-standard GC options?\n");
                                return FALSE;
@@ -1256,8 +1259,8 @@ decode_method_ref_with_target (MonoAotModule *module, MethodRef *ref, MonoMethod
 
                memset (&ctx, 0, sizeof (ctx));
 
-               if (FALSE && klass->generic_class) {
-                       ctx.class_inst = klass->generic_class->context.class_inst;
+               if (FALSE && mono_class_is_ginst (klass)) {
+                       ctx.class_inst = mono_class_get_generic_class (klass)->context.class_inst;
                        ctx.method_inst = NULL;
  
                        ref->method = mono_class_inflate_generic_method_full_checked (ref->method, klass, &ctx, error);
@@ -2148,7 +2151,7 @@ load_aot_module (MonoAssembly *assembly, gpointer user_data)
        amodule->mono_eh_frame = (guint8 *)info->mono_eh_frame;
        amodule->trampolines [MONO_AOT_TRAMP_SPECIFIC] = (guint8 *)info->specific_trampolines;
        amodule->trampolines [MONO_AOT_TRAMP_STATIC_RGCTX] = (guint8 *)info->static_rgctx_trampolines;
-       amodule->trampolines [MONO_AOT_TRAMP_IMT_THUNK] = (guint8 *)info->imt_thunks;
+       amodule->trampolines [MONO_AOT_TRAMP_IMT] = (guint8 *)info->imt_trampolines;
        amodule->trampolines [MONO_AOT_TRAMP_GSHAREDVT_ARG] = (guint8 *)info->gsharedvt_arg_trampolines;
 
        if (!strcmp (assembly->aname.name, "mscorlib"))
@@ -2441,7 +2444,7 @@ mono_aot_get_cached_class_info (MonoClass *klass, MonoCachedClassInfo *res)
        guint8 *p;
        gboolean err;
 
-       if (klass->rank || !amodule)
+       if (klass->rank || !klass->type_token || !amodule)
                return FALSE;
 
        p = (guint8*)&amodule->blob [mono_aot_get_offset (amodule->class_info_offsets, mono_metadata_token_index (klass->type_token) - 1)];
@@ -3699,6 +3702,7 @@ decode_patch (MonoAotModule *aot_module, MonoMemPool *mp, MonoJumpInfo *ji, guin
                break;
        }
        case MONO_PATCH_INFO_GC_SAFE_POINT_FLAG:
+       case MONO_PATCH_INFO_GET_TLS_TRAMP:
                break;
        case MONO_PATCH_INFO_AOT_JIT_INFO:
                ji->data.index = decode_value (p, &p);
@@ -3905,7 +3909,8 @@ load_method (MonoDomain *domain, MonoAotModule *amodule, MonoImage *image, MonoM
                }
        }
 
-       if (!(is_llvm_code (amodule, code) && (amodule->info.flags & MONO_AOT_FILE_FLAG_LLVM_ONLY))) {
+       if (!(is_llvm_code (amodule, code) && (amodule->info.flags & MONO_AOT_FILE_FLAG_LLVM_ONLY)) ||
+               (mono_llvm_only && method && method->wrapper_type == MONO_WRAPPER_NATIVE_TO_MANAGED)) {
                res = init_method (amodule, method_index, method, NULL, NULL, error);
                if (!res)
                        goto cleanup;
@@ -4021,32 +4026,6 @@ find_aot_method_in_amodule (MonoAotModule *amodule, MonoMethod *method, guint32
                        break;
                }
 
-               /*
-                * Special case: wrappers of shared generic methods.
-                * This is needed because of the way mini_get_shared_method () works,
-                * we could end up with multiple copies of the same wrapper.
-                */
-               if (m && method->wrapper_type && method->wrapper_type == m->wrapper_type &&
-                       method->wrapper_type == MONO_WRAPPER_SYNCHRONIZED) {
-                       MonoMethod *w1 = mono_marshal_method_from_wrapper (method);
-                       MonoMethod *w2 = mono_marshal_method_from_wrapper (m);
-
-                       if ((w1 == w2) || (w1->is_inflated && ((MonoMethodInflated *)w1)->declaring == w2)) {
-                               index = value;
-                               break;
-                       }
-               }
-               if (m && method->wrapper_type && method->wrapper_type == m->wrapper_type &&
-                       method->wrapper_type == MONO_WRAPPER_DELEGATE_INVOKE) {
-                       WrapperInfo *info1 = mono_marshal_get_wrapper_info (method);
-                       WrapperInfo *info2 = mono_marshal_get_wrapper_info (m);
-
-                       if (info1 && info2 && info1->subtype == info2->subtype && info1->d.delegate_invoke.method == info2->d.delegate_invoke.method) {
-                               index = value;
-                               break;
-                       }
-               }
-
                /* Methods decoded needlessly */
                if (m) {
                        //printf ("%d %s %s %p\n", n_extra_decodes, mono_method_full_name (method, TRUE), mono_method_full_name (m, TRUE), orig_p);
@@ -4234,7 +4213,7 @@ init_method (MonoAotModule *amodule, guint32 method_index, MonoMethod *method, M
        gboolean inited_ok = TRUE;
        if (init_class)
                inited_ok = mono_runtime_class_init_full (mono_class_vtable (domain, init_class), error);
-       else if (from_plt && klass_to_run_ctor && !klass_to_run_ctor->generic_container)
+       else if (from_plt && klass_to_run_ctor && !mono_class_is_gtd (klass_to_run_ctor))
                inited_ok = mono_runtime_class_init_full (mono_class_vtable (domain, klass_to_run_ctor), error);
        if (!inited_ok)
                return FALSE;
@@ -4301,10 +4280,10 @@ mono_aot_init_gshared_method_mrgctx (gpointer aot_module, guint32 method_index,
        MonoGenericContext context = { NULL, NULL };
        MonoClass *klass = rgctx->class_vtable->klass;
 
-       if (klass->generic_class)
-               context.class_inst = klass->generic_class->context.class_inst;
-       else if (klass->generic_container)
-               context.class_inst = klass->generic_container->context.class_inst;
+       if (mono_class_is_ginst (klass))
+               context.class_inst = mono_class_get_generic_class (klass)->context.class_inst;
+       else if (mono_class_is_gtd (klass))
+               context.class_inst = mono_class_get_generic_container (klass)->context.class_inst;
        context.method_inst = rgctx->method_inst;
 
        init_llvmonly_method (amodule, method_index, NULL, rgctx->class_vtable->klass, &context);
@@ -5182,7 +5161,7 @@ read_page_trampoline_uwinfo (MonoTrampInfo *info, int tramp_type, gboolean is_ge
                sprintf (symbol_name, "specific_trampolines_page_%s_p", is_generic ? "gen" : "sp");
        else if (tramp_type == MONO_AOT_TRAMP_STATIC_RGCTX)
                sprintf (symbol_name, "rgctx_trampolines_page_%s_p", is_generic ? "gen" : "sp");
-       else if (tramp_type == MONO_AOT_TRAMP_IMT_THUNK)
+       else if (tramp_type == MONO_AOT_TRAMP_IMT)
                sprintf (symbol_name, "imt_trampolines_page_%s_p", is_generic ? "gen" : "sp");
        else if (tramp_type == MONO_AOT_TRAMP_GSHAREDVT_ARG)
                sprintf (symbol_name, "gsharedvt_trampolines_page_%s_p", is_generic ? "gen" : "sp");
@@ -5230,7 +5209,7 @@ get_new_trampoline_from_page (int tramp_type)
                tpage = load_function (amodule, "specific_trampolines_page");
        else if (tramp_type == MONO_AOT_TRAMP_STATIC_RGCTX)
                tpage = load_function (amodule, "rgctx_trampolines_page");
-       else if (tramp_type == MONO_AOT_TRAMP_IMT_THUNK)
+       else if (tramp_type == MONO_AOT_TRAMP_IMT)
                tpage = load_function (amodule, "imt_trampolines_page");
        else if (tramp_type == MONO_AOT_TRAMP_GSHAREDVT_ARG)
                tpage = load_function (amodule, "gsharedvt_arg_trampolines_page");
@@ -5358,7 +5337,7 @@ get_new_imt_trampoline_from_page (gpointer arg)
        void *code;
        gpointer *data;
 
-       code = get_new_trampoline_from_page (MONO_AOT_TRAMP_IMT_THUNK);
+       code = get_new_trampoline_from_page (MONO_AOT_TRAMP_IMT);
 
        data = (gpointer*)((char*)code - MONO_AOT_TRAMP_PAGE_SIZE);
        data [0] = arg;
@@ -5611,13 +5590,13 @@ mono_aot_get_lazy_fetch_trampoline (guint32 slot)
 }
 
 static void
-no_imt_thunk (void)
+no_imt_trampoline (void)
 {
-       g_assert_not_reached ();
+       g_assert_not_reached ();
 }
 
 gpointer
-mono_aot_get_imt_thunk (MonoVTable *vtable, MonoDomain *domain, MonoIMTCheckItem **imt_entries, int count, gpointer fail_tramp)
+mono_aot_get_imt_trampoline (MonoVTable *vtable, MonoDomain *domain, MonoIMTCheckItem **imt_entries, int count, gpointer fail_tramp)
 {
        guint32 got_offset;
        gpointer code;
@@ -5626,7 +5605,7 @@ mono_aot_get_imt_thunk (MonoVTable *vtable, MonoDomain *domain, MonoIMTCheckItem
        MonoAotModule *amodule;
 
        if (mono_llvm_only)
-               return no_imt_thunk;
+               return no_imt_trampoline;
 
        real_count = 0;
        for (i = 0; i < count; ++i) {
@@ -5663,7 +5642,7 @@ mono_aot_get_imt_thunk (MonoVTable *vtable, MonoDomain *domain, MonoIMTCheckItem
        if (USE_PAGE_TRAMPOLINES) {
                code = get_new_imt_trampoline_from_page (buf);
        } else {
-               code = get_numerous_trampoline (MONO_AOT_TRAMP_IMT_THUNK, 1, &amodule, &got_offset, NULL);
+               code = get_numerous_trampoline (MONO_AOT_TRAMP_IMT, 1, &amodule, &got_offset, NULL);
 
                amodule->got [got_offset] = buf;
        }
@@ -5944,7 +5923,7 @@ mono_aot_get_lazy_fetch_trampoline (guint32 slot)
 }
 
 gpointer
-mono_aot_get_imt_thunk (MonoVTable *vtable, MonoDomain *domain, MonoIMTCheckItem **imt_entries, int count, gpointer fail_tramp)
+mono_aot_get_imt_trampoline (MonoVTable *vtable, MonoDomain *domain, MonoIMTCheckItem **imt_entries, int count, gpointer fail_tramp)
 {
        g_assert_not_reached ();
        return NULL;
diff --git a/mono/mini/basic-vectors.cs b/mono/mini/basic-vectors.cs
new file mode 100644 (file)
index 0000000..18c1bc0
--- /dev/null
@@ -0,0 +1,1397 @@
+using System;
+using System.Numerics;
+using System.Runtime.CompilerServices;
+
+/*
+ * Tests for the SIMD intrinsics in the System.Numerics.Vectors assembly.
+ */
+public class VectorTests {
+
+#if !MOBILE
+       public static int Main (string[] args) {
+               return TestDriver.RunTests (typeof (VectorTests), args);
+       }
+#endif
+
+       //
+       // Vector2 tests
+       //
+
+       public static int test_0_vector2_ctor_1 () {
+               var v = new Vector2 (1.0f);
+
+               if (v.X != 1.0f)
+                       return 1;
+               if (v.Y != 1.0f)
+                       return 2;
+               return 0;
+       }
+
+       public static int test_0_vector2_ctor_2 () {
+               var v = new Vector2 (1.0f, 2.0f);
+
+               if (v.X != 1.0f)
+                       return 1;
+               if (v.Y != 2.0f)
+                       return 2;
+               return 0;
+       }
+
+       [MethodImplAttribute (MethodImplOptions.NoInlining)]
+       public static bool vector2_equals (Vector2 v1, Vector2 v2) {
+               // cmpeqps+pmovmskb
+               return v1.Equals (v2);
+       }
+
+       public static int test_0_vector2_equals () {
+               var v1 = new Vector2 (1.0f, 2.0f);
+               var v2 = new Vector2 (2.0f, 2.0f);
+
+               if (vector2_equals (v1, v2))
+                       return 1;
+               if (!vector2_equals (v1, v1))
+                       return 2;
+               return 0;
+       }
+
+       [MethodImplAttribute (MethodImplOptions.NoInlining)]
+       public static float vector2_dot (Vector2 v1, Vector2 v2) {
+               return Vector2.Dot (v1, v2);
+       }
+
+       public static int test_0_vector2_dot () {
+               var v1 = new Vector2 (1.0f, 1.0f);
+               var v2 = new Vector2 (2.0f, 2.0f);
+
+               float f = vector2_dot (v1, v2);
+               if (f != 4.0f)
+                       return 1;
+               f = vector2_dot (v1, v1);
+               if (f != 2.0f)
+                       return 2;
+               return 0;
+       }
+
+       [MethodImplAttribute (MethodImplOptions.NoInlining)]
+       public static Vector2 vector2_min (Vector2 v1, Vector2 v2) {
+               return Vector2.Min (v1, v2);
+       }
+
+       public static int test_0_vector2_min () {
+               var v1 = new Vector2 (1.0f, 1.0f);
+               var v2 = new Vector2 (2.0f, 2.0f);
+
+               var v3 = vector2_min (v1, v2);
+               if (v3.X != 1.0f || v3.Y != 1.0f)
+                       return 1;
+               v3 = vector2_min (v2, v2);
+               if (v3.X != 2.0f || v3.Y != 2.0f)
+                       return 2;
+               return 0;
+       }
+
+       [MethodImplAttribute (MethodImplOptions.NoInlining)]
+       public static Vector2 vector2_max (Vector2 v1, Vector2 v2) {
+               return Vector2.Max (v1, v2);
+       }
+
+       public static int test_0_vector2_max () {
+               var v1 = new Vector2 (1.0f, 1.0f);
+               var v2 = new Vector2 (2.0f, 2.0f);
+
+               var v3 = vector2_max (v1, v2);
+               if (v3.X != 2.0f || v3.Y != 2.0f)
+                       return 1;
+               v3 = vector2_min (v1, v1);
+               if (v3.X != 1.0f || v3.Y != 1.0f)
+                       return 2;
+               return 0;
+       }
+
+       [MethodImplAttribute (MethodImplOptions.NoInlining)]
+       public static Vector2 vector2_abs (Vector2 v1) {
+               return Vector2.Abs (v1);
+       }
+
+       public static int test_0_vector2_abs () {
+               var v1 = new Vector2 (-1.0f, -2.0f);
+               var v2 = new Vector2 (1.0f, 2.0f);
+
+               var v3 = vector2_abs (v1);
+               if (v3.X != 1.0f || v3.Y != 2.0f)
+                       return 1;
+               v3 = vector2_abs (v2);
+               if (v3.X != 1.0f || v3.Y != 2.0f)
+                       return 2;
+               return 0;
+       }
+
+       [MethodImplAttribute (MethodImplOptions.NoInlining)]
+       public static Vector2 vector2_sqrt (Vector2 v1) {
+               return Vector2.SquareRoot (v1);
+       }
+
+       public static int test_0_vector2_sqrt () {
+               var v1 = new Vector2 (1.0f, 0.0f);
+
+               var v3 = vector2_sqrt (v1);
+               if (v3.X != 1.0f || v3.Y != 0.0f)
+                       return 1;
+               return 0;
+       }
+
+       [MethodImplAttribute (MethodImplOptions.NoInlining)]
+       public static Vector2 vector2_add (Vector2 v1, Vector2 v2) {
+               return v1 + v2;
+       }
+
+       public static int test_0_vector2_add () {
+               var v1 = new Vector2 (1.0f, 2.0f);
+               var v2 = new Vector2 (3.0f, 4.0f);
+
+               var v3 = vector2_add (v1, v2);
+               if (v3.X != 4.0f || v3.Y != 6.0f)
+                       return 1;
+               return 0;
+       }
+
+       [MethodImplAttribute (MethodImplOptions.NoInlining)]
+       public static Vector2 vector2_sub (Vector2 v1, Vector2 v2) {
+               return v1 - v2;
+       }
+
+       public static int test_0_vector2_sub () {
+               var v1 = new Vector2 (1.0f, 2.0f);
+               var v2 = new Vector2 (3.0f, 5.0f);
+
+               var v3 = vector2_sub (v2, v1);
+               if (v3.X != 2.0f || v3.Y != 3.0f)
+                       return 1;
+               return 0;
+       }
+
+       [MethodImplAttribute (MethodImplOptions.NoInlining)]
+       public static Vector2 vector2_mul (Vector2 v1, Vector2 v2) {
+               return v1 * v2;
+       }
+
+       public static int test_0_vector2_mul () {
+               var v1 = new Vector2 (1.0f, 2.0f);
+               var v2 = new Vector2 (3.0f, 5.0f);
+
+               var v3 = vector2_mul (v2, v1);
+               if (v3.X != 3.0f || v3.Y != 10.0f)
+                       return 1;
+               return 0;
+       }
+
+       [MethodImplAttribute (MethodImplOptions.NoInlining)]
+       public static Vector2 vector2_mul_left (float v1, Vector2 v2) {
+               return v1 * v2;
+       }
+
+       public static int test_0_vector2_mul_left () {
+               var v1 = new Vector2 (3.0f, 5.0f);
+
+               var v3 = vector2_mul_left (2.0f, v1);
+               if (v3.X != 6.0f || v3.Y != 10.0f)
+                       return 1;
+               return 0;
+       }
+
+       [MethodImplAttribute (MethodImplOptions.NoInlining)]
+       public static Vector2 vector2_mul_right (Vector2 v1, float v2) {
+               return v1 * v2;
+       }
+
+       public static int test_0_vector2_mul_right () {
+               var v1 = new Vector2 (3.0f, 5.0f);
+
+               var v3 = vector2_mul_right (v1, 2.0f);
+               if (v3.X != 6.0f || v3.Y != 10.0f)
+                       return 1;
+               return 0;
+       }
+
+       [MethodImplAttribute (MethodImplOptions.NoInlining)]
+       public static Vector2 vector2_div (Vector2 v1, Vector2 v2) {
+               return v1 / v2;
+       }
+
+       public static int test_0_vector2_div () {
+               var v1 = new Vector2 (9.0f, 10.0f);
+               var v2 = new Vector2 (3.0f, 5.0f);
+
+               var v3 = vector2_div (v1, v2);
+               if (v3.X != 3.0f || v3.Y != 2.0f)
+                       return 1;
+               return 0;
+       }
+
+       [MethodImplAttribute (MethodImplOptions.NoInlining)]
+       public static Vector2 vector2_div_right (Vector2 v1, float v2) {
+               return v1 / v2;
+       }
+
+       public static int test_0_vector2_div_right () {
+               var v1 = new Vector2 (9.0f, 15.0f);
+
+               var v3 = vector2_div_right (v1, 3.0f);
+               if (v3.X != 3.0f || v3.Y != 5.0f)
+                       return 1;
+               return 0;
+       }
+
+       //
+       // Vector4 tests
+       //
+
+       public static int test_0_vector4_ctor_1 () {
+               var v = new Vector4 (1.0f);
+
+               if (v.X != 1.0f)
+                       return 1;
+               if (v.Y != 1.0f)
+                       return 2;
+               if (v.Z != 1.0f)
+                       return 3;
+               if (v.W != 1.0f)
+                       return 4;
+               return 0;
+       }
+
+       public static int test_0_vector4_ctor_2 () {
+               var v = new Vector4 (1.0f, 2.0f, 3.0f, 4.0f);
+
+               if (v.X != 1.0f)
+                       return 1;
+               if (v.Y != 2.0f)
+                       return 2;
+               if (v.Z != 3.0f)
+                       return 3;
+               if (v.W != 4.0f)
+                       return 4;
+               return 0;
+       }
+
+       [MethodImplAttribute (MethodImplOptions.NoInlining)]
+       public static bool vector4_equals (Vector4 v1, Vector4 v2) {
+               // cmpeqps+pmovmskb
+               return v1.Equals (v2);
+       }
+
+       public static int test_0_vector4_equals () {
+               var v1 = new Vector4 (1.0f, 2.0f, 3.0f, 4.0f);
+               var v2 = new Vector4 (2.0f, 2.0f, 2.0f, 2.0f);
+
+               if (vector4_equals (v1, v2))
+                       return 1;
+               if (!vector4_equals (v1, v1))
+                       return 2;
+               return 0;
+       }
+
+       [MethodImplAttribute (MethodImplOptions.NoInlining)]
+       public static float vector4_dot (Vector4 v1, Vector4 v2) {
+               return Vector4.Dot (v1, v2);
+       }
+
+       public static int test_0_vector4_dot () {
+               var v1 = new Vector4 (1.0f, 1.0f, 1.0f, 1.0f);
+               var v2 = new Vector4 (2.0f, 2.0f, 2.0f, 2.0f);
+
+               float f = vector4_dot (v1, v2);
+               if (f != 8.0f)
+                       return 1;
+               f = vector4_dot (v1, v1);
+               if (f != 4.0f)
+                       return 2;
+               return 0;
+       }
+
+       [MethodImplAttribute (MethodImplOptions.NoInlining)]
+       public static Vector4 vector4_min (Vector4 v1, Vector4 v2) {
+               return Vector4.Min (v1, v2);
+       }
+
+       public static int test_0_vector4_min () {
+               var v1 = new Vector4 (1.0f, 2.0f, 3.0f, 4.0f);
+               var v2 = new Vector4 (5.0f, 6.0f, 7.0f, 8.0f);
+
+               var v3 = vector4_min (v1, v2);
+               if (v3.X != 1.0f || v3.Y != 2.0f || v3.Z != 3.0f || v3.W != 4.0f)
+                       return 1;
+               v3 = vector4_min (v2, v2);
+               if (v3.X != 5.0f || v3.Y != 6.0f || v3.Z != 7.0f || v3.W != 8.0f)
+                       return 2;
+               return 0;
+       }
+
+       [MethodImplAttribute (MethodImplOptions.NoInlining)]
+       public static Vector4 vector4_max (Vector4 v1, Vector4 v2) {
+               return Vector4.Max (v1, v2);
+       }
+
+       public static int test_0_vector4_max () {
+               var v1 = new Vector4 (1.0f, 2.0f, 3.0f, 4.0f);
+               var v2 = new Vector4 (5.0f, 6.0f, 7.0f, 8.0f);
+
+               var v3 = vector4_max (v1, v2);
+               if (v3.X != 5.0f || v3.Y != 6.0f || v3.Z != 7.0f || v3.W != 8.0f)
+                       return 1;
+               v3 = vector4_max (v1, v1);
+               if (v3.X != 1.0f || v3.Y != 2.0f || v3.Z != 3.0f || v3.W != 4.0f)
+                       return 2;
+               return 0;
+       }
+
+       [MethodImplAttribute (MethodImplOptions.NoInlining)]
+       public static Vector4 vector4_abs (Vector4 v1) {
+               return Vector4.Abs (v1);
+       }
+
+       public static int test_0_vector4_abs () {
+               var v1 = new Vector4 (-1.0f, -2.0f, -3.0f, -4.0f);
+               var v2 = new Vector4 (1.0f, 2.0f, 3.0f, 4.0f);
+
+               var v3 = vector4_abs (v1);
+               if (v3.X != 1.0f || v3.Y != 2.0f || v3.Z != 3.0f || v3.W != 4.0f)
+                       return 1;
+               v3 = vector4_abs (v2);
+               if (v3.X != 1.0f || v3.Y != 2.0f || v3.Z != 3.0f || v3.W != 4.0f)
+                       return 2;
+               return 0;
+       }
+
+       [MethodImplAttribute (MethodImplOptions.NoInlining)]
+       public static Vector4 vector4_sqrt (Vector4 v1) {
+               return Vector4.SquareRoot (v1);
+       }
+
+       public static int test_0_vector4_sqrt () {
+               var v1 = new Vector4 (1.0f, 0.0f, 1.0f, 0.0f);
+
+               var v3 = vector4_sqrt (v1);
+               if (v3.X != 1.0f || v3.Y != 0.0f || v3.Z != 1.0f || v3.W != 0.0f)
+                       return 1;
+               return 0;
+       }
+
+       [MethodImplAttribute (MethodImplOptions.NoInlining)]
+       public static Vector4 vector4_add (Vector4 v1, Vector4 v2) {
+               return v1 + v2;
+       }
+
+       public static int test_0_vector4_add () {
+               var v1 = new Vector4 (1.0f, 2.0f, 3.0f, 4.0f);
+               var v2 = new Vector4 (5.0f, 6.0f, 7.0f, 8.0f);
+
+               var v3 = vector4_add (v1, v2);
+               if (v3.X != 6.0f || v3.Y != 8.0f || v3.Z != 10.0f || v3.W != 12.0f)
+                       return 1;
+               return 0;
+       }
+
+       [MethodImplAttribute (MethodImplOptions.NoInlining)]
+       public static Vector4 vector4_sub (Vector4 v1, Vector4 v2) {
+               return v1 - v2;
+       }
+
+       public static int test_0_vector4_sub () {
+               var v1 = new Vector4 (1.0f, 2.0f, 3.0f, 4.0f);
+               var v2 = new Vector4 (3.0f, 5.0f, 7.0f, 9.0f);
+
+               var v3 = vector4_sub (v2, v1);
+               if (v3.X != 2.0f || v3.Y != 3.0f || v3.Z != 4.0f || v3.W != 5.0f)
+                       return 1;
+               return 0;
+       }
+
+       [MethodImplAttribute (MethodImplOptions.NoInlining)]
+       public static Vector4 vector4_mul (Vector4 v1, Vector4 v2) {
+               return v1 * v2;
+       }
+
+       public static int test_0_vector4_mul () {
+               var v1 = new Vector4 (1.0f, 2.0f, 3.0f, 4.0f);
+               var v2 = new Vector4 (3.0f, 5.0f, 6.0f, 7.0f);
+
+               var v3 = vector4_mul (v2, v1);
+               if (v3.X != 3.0f || v3.Y != 10.0f || v3.Z != 18.0f || v3.W != 28.0f)
+                       return 1;
+               return 0;
+       }
+
+       [MethodImplAttribute (MethodImplOptions.NoInlining)]
+       public static Vector4 vector4_mul_left (float v1, Vector4 v2) {
+               return v1 * v2;
+       }
+
+       public static int test_0_vector4_mul_left () {
+               var v1 = new Vector4 (3.0f, 5.0f, 6.0f, 7.0f);
+
+               var v3 = vector4_mul_left (2.0f, v1);
+               if (v3.X != 6.0f || v3.Y != 10.0f || v3.Z != 12.0f || v3.W != 14.0f)
+                       return 1;
+               return 0;
+       }
+
+       [MethodImplAttribute (MethodImplOptions.NoInlining)]
+       public static Vector4 vector4_mul_right (Vector4 v1, float v2) {
+               return v1 * v2;
+       }
+
+       public static int test_0_vector4_mul_right () {
+               var v1 = new Vector4 (3.0f, 5.0f, 6.0f, 7.0f);
+
+               var v3 = vector4_mul_right (v1, 2.0f);
+               if (v3.X != 6.0f || v3.Y != 10.0f || v3.Z != 12.0f || v3.W != 14.0f)
+                       return 1;
+               return 0;
+       }
+
+       [MethodImplAttribute (MethodImplOptions.NoInlining)]
+       public static Vector4 vector4_div (Vector4 v1, Vector4 v2) {
+               return v1 / v2;
+       }
+
+       public static int test_0_vector4_div () {
+               var v1 = new Vector4 (9.0f, 10.0f, 12.0f, 21.0f);
+               var v2 = new Vector4 (3.0f, 5.0f, 6.0f, 7.0f);
+
+               var v3 = vector4_div (v1, v2);
+               if (v3.X != 3.0f || v3.Y != 2.0f || v3.Z != 2.0f || v3.W != 3.0f)
+                       return 1;
+               return 0;
+       }
+
+       [MethodImplAttribute (MethodImplOptions.NoInlining)]
+       public static Vector4 vector4_div_right (Vector4 v1, float v2) {
+               return v1 / v2;
+       }
+
+       public static int test_0_vector4_div_right () {
+               var v1 = new Vector4 (9.0f, 15.0f, 21.0f, 30.0f);
+
+               var v3 = vector4_div_right (v1, 3.0f);
+               if (v3.X != 3.0f || v3.Y != 5.0f || v3.Z != 7.0f || v3.W != 10.0f)
+                       return 1;
+               return 0;
+       }
+
+       public static int test_0_vector4_length () {
+               var v = new Vector4 (2.0f, 2.0f, 2.0f, 2.0f);
+               return v.Length () == 4.0f ? 0 : 1;
+       }
+
+       //
+       // Vector3 tests
+       //
+
+       public static int test_0_vector3_ctor_1 () {
+               var v = new Vector3 (1.0f);
+
+               if (v.X != 1.0f)
+                       return 1;
+               if (v.Y != 1.0f)
+                       return 2;
+               if (v.Z != 1.0f)
+                       return 3;
+               return 0;
+       }
+
+       public static int test_0_vector3_ctor_2 () {
+               var v = new Vector3 (1.0f, 2.0f, 3.0f);
+
+               if (v.X != 1.0f)
+                       return 1;
+               if (v.Y != 2.0f)
+                       return 2;
+               if (v.Z != 3.0f)
+                       return 3;
+               return 0;
+       }
+
+       [MethodImplAttribute (MethodImplOptions.NoInlining)]
+       public static bool vector3_equals (Vector3 v1, Vector3 v2) {
+               // cmpeqps+pmovmskb
+               return v1.Equals (v2);
+       }
+
+       public static int test_0_vector3_equals () {
+               var v1 = new Vector3 (1.0f, 2.0f, 3.0f);
+               var v2 = new Vector3 (2.0f, 2.0f, 2.0f);
+
+               if (vector3_equals (v1, v2))
+                       return 1;
+               if (!vector3_equals (v1, v1))
+                       return 2;
+               return 0;
+       }
+
+       [MethodImplAttribute (MethodImplOptions.NoInlining)]
+       public static float vector3_dot (Vector3 v1, Vector3 v2) {
+               return Vector3.Dot (v1, v2);
+       }
+
+       public static int test_0_vector3_dot () {
+               var v1 = new Vector3 (1.0f, 1.0f, 1.0f);
+               var v2 = new Vector3 (2.0f, 2.0f, 2.0f);
+
+               float f = vector3_dot (v1, v2);
+               if (f != 6.0f)
+                       return 1;
+               f = vector3_dot (v1, v1);
+               if (f != 3.0f)
+                       return 2;
+               return 0;
+       }
+
+       [MethodImplAttribute (MethodImplOptions.NoInlining)]
+       public static Vector3 vector3_min (Vector3 v1, Vector3 v2) {
+               return Vector3.Min (v1, v2);
+       }
+
+       public static int test_0_vector3_min () {
+               var v1 = new Vector3 (1.0f, 2.0f, 3.0f);
+               var v2 = new Vector3 (5.0f, 6.0f, 7.0f);
+
+               var v3 = vector3_min (v1, v2);
+               if (v3.X != 1.0f || v3.Y != 2.0f || v3.Z != 3.0f)
+                       return 1;
+               v3 = vector3_min (v2, v2);
+               if (v3.X != 5.0f || v3.Y != 6.0f || v3.Z != 7.0f)
+                       return 2;
+               return 0;
+       }
+
+       [MethodImplAttribute (MethodImplOptions.NoInlining)]
+       public static Vector3 vector3_max (Vector3 v1, Vector3 v2) {
+               return Vector3.Max (v1, v2);
+       }
+
+       public static int test_0_vector3_max () {
+               var v1 = new Vector3 (1.0f, 2.0f, 3.0f);
+               var v2 = new Vector3 (5.0f, 6.0f, 7.0f);
+
+               var v3 = vector3_max (v1, v2);
+               if (v3.X != 5.0f || v3.Y != 6.0f || v3.Z != 7.0f)
+                       return 1;
+               v3 = vector3_max (v1, v1);
+               if (v3.X != 1.0f || v3.Y != 2.0f || v3.Z != 3.0f)
+                       return 2;
+               return 0;
+       }
+
+       [MethodImplAttribute (MethodImplOptions.NoInlining)]
+       public static Vector3 vector3_abs (Vector3 v1) {
+               return Vector3.Abs (v1);
+       }
+
+       public static int test_0_vector3_abs () {
+               var v1 = new Vector3 (-1.0f, -2.0f, -3.0f);
+               var v2 = new Vector3 (1.0f, 2.0f, 3.0f);
+
+               var v3 = vector3_abs (v1);
+               if (v3.X != 1.0f || v3.Y != 2.0f || v3.Z != 3.0f)
+                       return 1;
+               v3 = vector3_abs (v2);
+               if (v3.X != 1.0f || v3.Y != 2.0f || v3.Z != 3.0f)
+                       return 2;
+               return 0;
+       }
+
+       [MethodImplAttribute (MethodImplOptions.NoInlining)]
+       public static Vector3 vector3_sqrt (Vector3 v1) {
+               return Vector3.SquareRoot (v1);
+       }
+
+       public static int test_0_vector3_sqrt () {
+               var v1 = new Vector3 (1.0f, 0.0f, 1.0f);
+
+               var v3 = vector3_sqrt (v1);
+               if (v3.X != 1.0f || v3.Y != 0.0f || v3.Z != 1.0f)
+                       return 1;
+               return 0;
+       }
+
+       [MethodImplAttribute (MethodImplOptions.NoInlining)]
+       public static Vector3 vector3_add (Vector3 v1, Vector3 v2) {
+               return v1 + v2;
+       }
+
+       public static int test_0_vector3_add () {
+               var v1 = new Vector3 (1.0f, 2.0f, 3.0f);
+               var v2 = new Vector3 (5.0f, 6.0f, 7.0f);
+
+               var v3 = vector3_add (v1, v2);
+               if (v3.X != 6.0f || v3.Y != 8.0f || v3.Z != 10.0f)
+                       return 1;
+               return 0;
+       }
+
+       [MethodImplAttribute (MethodImplOptions.NoInlining)]
+       public static Vector3 vector3_sub (Vector3 v1, Vector3 v2) {
+               return v1 - v2;
+       }
+
+       public static int test_0_vector3_sub () {
+               var v1 = new Vector3 (1.0f, 2.0f, 3.0f);
+               var v2 = new Vector3 (3.0f, 5.0f, 7.0f);
+
+               var v3 = vector3_sub (v2, v1);
+               if (v3.X != 2.0f || v3.Y != 3.0f || v3.Z != 4.0f)
+                       return 1;
+               return 0;
+       }
+
+       [MethodImplAttribute (MethodImplOptions.NoInlining)]
+       public static Vector3 vector3_mul (Vector3 v1, Vector3 v2) {
+               return v1 * v2;
+       }
+
+       public static int test_0_vector3_mul () {
+               var v1 = new Vector3 (1.0f, 2.0f, 3.0f);
+               var v2 = new Vector3 (3.0f, 5.0f, 6.0f);
+
+               var v3 = vector3_mul (v2, v1);
+               if (v3.X != 3.0f || v3.Y != 10.0f || v3.Z != 18.0f)
+                       return 1;
+               return 0;
+       }
+
+       [MethodImplAttribute (MethodImplOptions.NoInlining)]
+       public static Vector3 vector3_mul_left (float v1, Vector3 v2) {
+               return v1 * v2;
+       }
+
+       public static int test_0_vector3_mul_left () {
+               var v1 = new Vector3 (3.0f, 5.0f, 6.0f);
+
+               var v3 = vector3_mul_left (2.0f, v1);
+               if (v3.X != 6.0f || v3.Y != 10.0f || v3.Z != 12.0f)
+                       return 1;
+               return 0;
+       }
+
+       [MethodImplAttribute (MethodImplOptions.NoInlining)]
+       public static Vector3 vector3_mul_right (Vector3 v1, float v2) {
+               return v1 * v2;
+       }
+
+       public static int test_0_vector3_mul_right () {
+               var v1 = new Vector3 (3.0f, 5.0f, 6.0f);
+
+               var v3 = vector3_mul_right (v1, 2.0f);
+               if (v3.X != 6.0f || v3.Y != 10.0f || v3.Z != 12.0f)
+                       return 1;
+               return 0;
+       }
+
+       [MethodImplAttribute (MethodImplOptions.NoInlining)]
+       public static Vector3 vector3_div (Vector3 v1, Vector3 v2) {
+               return v1 / v2;
+       }
+
+       public static int test_0_vector3_div () {
+               var v1 = new Vector3 (9.0f, 10.0f, 12.0f);
+               var v2 = new Vector3 (3.0f, 5.0f, 6.0f);
+
+               var v3 = vector3_div (v1, v2);
+               if (v3.X != 3.0f || v3.Y != 2.0f || v3.Z != 2.0f)
+                       return 1;
+               return 0;
+       }
+
+       [MethodImplAttribute (MethodImplOptions.NoInlining)]
+       public static Vector3 vector3_div_right (Vector3 v1, float v2) {
+               return v1 / v2;
+       }
+
+       public static int test_0_vector3_div_right () {
+               var v1 = new Vector3 (9.0f, 15.0f, 21.0f);
+
+               var v3 = vector3_div_right (v1, 3.0f);
+               if (v3.X != 3.0f || v3.Y != 5.0f || v3.Z != 7.0f)
+                       return 1;
+               return 0;
+       }
+
+#if FALSE
+       //
+       // Vector<T>
+       //
+
+       public static int test_0_vector_t_count () {
+               // This assumes a 16 byte simd register size
+               if (Vector<byte>.Count != 16)
+                       return 1;
+               if (Vector<short>.Count != 8)
+                       return 2;
+               if (Vector<int>.Count != 4)
+                       return 3;
+               if (Vector<long>.Count != 2)
+                       return 4;
+               return 0;
+       }
+
+       public static int test_0_vector_t_zero () {
+               var v = Vector<byte>.Zero;
+               for (int i = 0; i < Vector<byte>.Count; ++i)
+                       if (v [i] != 0)
+                               return 1;
+               var v2 = Vector<double>.Zero;
+               for (int i = 0; i < Vector<double>.Count; ++i)
+                       if (v2 [i] != 0.0)
+                               return 2;
+               return 0;
+       }
+
+       public static int test_0_vector_t_i1_accessor () {
+               var elems = new byte [] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 };
+               var v = new Vector<byte> (elems, 0);
+               for (int i = 0; i < Vector<byte>.Count; ++i)
+                       if (v [i] != i + 1)
+                               return 1;
+               if (v [0] != 1)
+                       return 2;
+               if (v [1] != 2)
+                       return 2;
+               if (v [15] != 16)
+                       return 2;
+               try {
+                       int r = v [-1];
+                       return 3;
+               } catch (IndexOutOfRangeException) {
+               }
+               try {
+                       int r = v [16];
+                       return 4;
+               } catch (IndexOutOfRangeException) {
+               }
+               return 0;
+       }
+
+       public static int test_0_vector_t_i4_accessor () {
+               var elems = new int [] { 1, 2, 3, 4 };
+               var v = new Vector<int> (elems, 0);
+               for (int i = 0; i < Vector<int>.Count; ++i)
+                       if (v [i] != i + 1)
+                               return 1;
+               if (v [0] != 1)
+                       return 2;
+               if (v [1] != 2)
+                       return 2;
+               if (v [3] != 4)
+                       return 2;
+               try {
+                       int r = v [-1];
+                       return 3;
+               } catch (IndexOutOfRangeException) {
+               }
+               try {
+                       int r = v [Vector<int>.Count];
+                       return 4;
+               } catch (IndexOutOfRangeException) {
+               }
+               return 0;
+       }
+
+       public static int test_0_vector_t_i8_accessor () {
+               var elems = new long [] { 1, 2 };
+               var v = new Vector<long> (elems, 0);
+               for (int i = 0; i < Vector<long>.Count; ++i)
+                       if (v [i] != i + 1)
+                               return 1;
+               if (v [0] != 1)
+                       return 2;
+               if (v [1] != 2)
+                       return 2;
+               try {
+                       var r = v [-1];
+                       return 3;
+               } catch (IndexOutOfRangeException) {
+               }
+               try {
+                       var r = v [Vector<long>.Count];
+                       return 4;
+               } catch (IndexOutOfRangeException) {
+               }
+               return 0;
+       }
+
+       public static int test_0_vector_t_r8_accessor () {
+               var elems = new double [] { 1.0, 2.0 };
+               var v = new Vector<double> (elems, 0);
+               for (int i = 0; i < Vector<double>.Count; ++i)
+                       if (v [i] != (double)i + 1.0)
+                               return 1;
+               if (v [0] != 1.0)
+                       return 2;
+               if (v [1] != 2.0)
+                       return 2;
+               try {
+                       var r = v [-1];
+                       return 3;
+               } catch (IndexOutOfRangeException) {
+               }
+               try {
+                       var r = v [Vector<double>.Count];
+                       return 4;
+               } catch (IndexOutOfRangeException) {
+               }
+               return 0;
+       }
+
+       public static int test_0_vector_t_i1_ctor_3 () {
+               var v = new Vector<byte> (5);
+               for (int i = 0; i < 16; ++i)
+                       if (v [i] != 5)
+                               return 1;
+               return 0;
+       }
+
+       public static int test_0_vector_t_i2_ctor_3 () {
+               var v = new Vector<short> (5);
+               for (int i = 0; i < 8; ++i)
+                       if (v [i] != 5)
+                               return 1;
+               return 0;
+       }
+
+       public static int test_0_vector_t_i4_ctor_3 () {
+               var v = new Vector<int> (0xffffeee);
+               for (int i = 0; i < 4; ++i)
+                       if (v [i] != 0xffffeee)
+                               return 1;
+               return 0;
+       }
+
+       public static int test_0_vector_t_i8_ctor_3 () {
+               var v = new Vector<long> (0xffffeeeeabcdefL);
+               for (int i = 0; i < 2; ++i)
+                       if (v [i] != 0xffffeeeeabcdefL)
+                               return 1;
+               return 0;
+       }
+
+       public static int test_0_vector_t_r4_ctor_3 () {
+               var v = new Vector<float> (0.5f);
+               for (int i = 0; i < 4; ++i) {
+                       if (v [i] != 0.5f)
+                               return 1;
+               }
+               return 0;
+       }
+
+       public static int test_0_vector_t_r8_ctor_3 () {
+               var v = new Vector<double> (0.5f);
+               for (int i = 0; i < 2; ++i) {
+                       if (v [i] != 0.5f)
+                               return 1;
+               }
+               return 0;
+       }
+
+       public static int test_0_vector_t_i1_ctor () {
+               var elems = new byte [] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
+                                                                 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18 };
+               var v = new Vector<byte> (elems, 16);
+               for (int i = 0; i < 16; ++i)
+                       if (v [i] != i)
+                               return 1;
+               try {
+                       var v2 = new Vector<byte> (elems, 16 + 4);
+                       return 2;
+               } catch (IndexOutOfRangeException) {
+               }
+               return 0;
+       }
+
+       public static int test_0_vector_t_i1_ctor_2 () {
+               var elems = new byte [] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 };
+               var v = new Vector<byte> (elems);
+               for (int i = 0; i < 16; ++i)
+                       if (v [i] != i + 1)
+                               return 1;
+               try {
+                       var elems2 = new byte [] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
+                       var v2 = new Vector<byte> (elems2);
+                       return 2;
+               } catch (IndexOutOfRangeException) {
+               }
+               return 0;
+       }
+
+       public static int test_0_vector_t_r4_equal () {
+               var elems1 = new float [4] { 1.0f, 1.0f, 1.0f, 1.0f };
+               var v1 = new Vector<float> (elems1);
+               var elems2 = new float [4] { 1.0f, 2.0f, 1.0f, 2.0f };
+               var v2 = new Vector<float> (elems2);
+               Vector<int> v = Vector.Equals (v1, v2);
+               if (v [0] != -1 || v [1] != 0 || v [2] != -1 || v [3] != 0)
+                       return 1;
+               return 0;
+       }
+
+       public static int test_0_vector_t_r8_equal () {
+               var elems1 = new double [] { 1.0f, 1.0f };
+               var v1 = new Vector<double> (elems1);
+               var elems2 = new double [] { 1.0f, 2.0f };
+               var v2 = new Vector<double> (elems2);
+               Vector<long> v = Vector.Equals (v1, v2);
+               if (v [0] != -1 || v [1] != 0)
+                       return 1;
+               return 0;
+       }
+
+       public static int test_0_vector_t_i8_equal () {
+               var elems1 = new long [] { 1, 1 };
+               var v1 = new Vector<long> (elems1);
+               var elems2 = new long [] { 1, 2 };
+               var v2 = new Vector<long> (elems2);
+               Vector<long> v = Vector.Equals (v1, v2);
+               if (v [0] != -1 || v [1] != 0)
+                       return 1;
+               return 0;
+       }
+
+       public static int test_0_vector_t_i4_equal () {
+               var elems1 = new int [] { 1, 1, 1, 1 };
+               var v1 = new Vector<int> (elems1);
+               var elems2 = new int [] { 1, 2, 1, 2 };
+               var v2 = new Vector<int> (elems2);
+               Vector<int> v = Vector.Equals (v1, v2);
+               if (v [0] != -1 || v [1] != 0 || v [2] != -1 || v[3] != 0)
+                       return 1;
+               return 0;
+       }
+
+       /*
+       public static int test_0_vector_t_u4_equal () {
+               var elems1 = new uint [] { 1, 1, 1, 1 };
+               var v1 = new Vector<uint> (elems1);
+               var elems2 = new uint [] { 1, 2, 1, 2 };
+               var v2 = new Vector<uint> (elems2);
+               Vector<uint> v = Vector.Equals (v1, v2);
+               if (v [0] != 0xffffffff || v [1] != 0 || v [2] != 0xffffffff || v[3] != 0)
+                       return 1;
+               return 0;
+       }
+       */
+
+       public static int test_0_vector_t_i2_equal () {
+               var elems1 = new short [] { 1, 1, 1, 1, 1, 1, 1, 1 };
+               var v1 = new Vector<short> (elems1);
+               var elems2 = new short [] { 1, 2, 1, 2, 1, 2, 1, 2 };
+               var v2 = new Vector<short> (elems2);
+               Vector<short> v = Vector.Equals (v1, v2);
+               for (int i = 0; i < Vector<short>.Count; ++i) {
+                       if (i % 2 == 0 && v [i] != -1)
+                               return 1;
+                       if (i % 2 == 1 && v [i] != 0)
+                               return 1;
+               }
+               return 0;
+       }
+
+       public static int test_0_vector_t_u2_equal () {
+               var elems1 = new ushort [] { 1, 1, 1, 1, 1, 1, 1, 1 };
+               var v1 = new Vector<ushort> (elems1);
+               var elems2 = new ushort [] { 1, 2, 1, 2, 1, 2, 1, 2 };
+               var v2 = new Vector<ushort> (elems2);
+               Vector<ushort> v = Vector.Equals (v1, v2);
+               for (int i = 0; i < Vector<ushort>.Count; ++i) {
+                       if (i % 2 == 0 && v [i] != 0xffff)
+                               return 1;
+                       if (i % 2 == 1 && v [i] != 0)
+                               return 1;
+               }
+               return 0;
+       }
+
+       public static int test_0_vector_t_i1_equal () {
+               var elems1 = new sbyte [] { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 };
+               var v1 = new Vector<sbyte> (elems1);
+               var elems2 = new sbyte [] { 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2 };
+               var v2 = new Vector<sbyte> (elems2);
+               Vector<sbyte> v = Vector.Equals (v1, v2);
+               for (int i = 0; i < Vector<sbyte>.Count; ++i) {
+                       if (i % 2 == 0 && v [i] != -1)
+                               return 1;
+                       if (i % 2 == 1 && v [i] != 0)
+                               return 1;
+               }
+               return 0;
+       }
+
+       public static int test_0_vector_t_u1_equal () {
+               var elems1 = new byte [] { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 };
+               var v1 = new Vector<byte> (elems1);
+               var elems2 = new byte [] { 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2 };
+               var v2 = new Vector<byte> (elems2);
+               Vector<byte> v = Vector.Equals (v1, v2);
+               for (int i = 0; i < Vector<byte>.Count; ++i) {
+                       if (i % 2 == 0 && v [i] != 0xff)
+                               return 1;
+                       if (i % 2 == 1 && v [i] != 0)
+                               return 1;
+               }
+               return 0;
+       }
+
+       /* op_Explicit () -> Vector<int32> */
+
+       public static int test_0_vector_t_cast_vector_int32 () {
+               var v1 = new Vector<long> (new long [] { 0x123456789abcdef0L, 0x23456789abcdef01L });
+               var v = (Vector<int>)v1;
+               if ((uint)v [0] != 0x9abcdef0 || (uint)v [1] != 0x12345678)
+                       return 1;
+               if ((uint)v [2] != 0xabcdef01 || (uint)v [3] != 0x23456789)
+                       return 2;
+               return 0;
+       }
+
+       /* Vector.GreaterThanOrEqual */
+
+       public static int test_0_vector_t_i1_ge () {
+               var elems1 = new sbyte [] { 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1 };
+               var v1 = new Vector<sbyte> (elems1);
+               var elems2 = new sbyte [] { 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2 };
+               var v2 = new Vector<sbyte> (elems2);
+               Vector<sbyte> v = Vector.GreaterThanOrEqual (v1, v2);
+               for (int i = 0; i < Vector<sbyte>.Count; ++i) {
+                       if (i % 2 == 0 && v [i] != -1)
+                               return 1;
+                       if (i % 2 == 1 && v [i] != 0)
+                               return 1;
+               }
+               return 0;
+       }
+
+       public static int test_0_vector_t_i2_ge () {
+               var elems1 = new short [] { 1, 1, 0, 1, 1, 1, 0, 1 };
+               var v1 = new Vector<short> (elems1);
+               var elems2 = new short [] { 0, 2, 0, 2, 0, 2, 0, 2 };
+               var v2 = new Vector<short> (elems2);
+               Vector<short> v = Vector.GreaterThanOrEqual (v1, v2);
+               for (int i = 0; i < Vector<short>.Count; ++i) {
+                       if (i % 2 == 0 && v [i] != -1)
+                               return 1;
+                       if (i % 2 == 1 && v [i] != 0)
+                               return 1;
+               }
+               return 0;
+       }
+
+       public static int test_0_vector_t_i4_ge () {
+               var elems1 = new int [] { 1, 1, 0, 1 };
+               var v1 = new Vector<int> (elems1);
+               var elems2 = new int [] { 0, 2, 0, 2 };
+               var v2 = new Vector<int> (elems2);
+               Vector<int> v = Vector.GreaterThanOrEqual (v1, v2);
+               if (v [0] != -1 || v [1] != 0 || v [2] != -1 || v[3] != 0)
+                       return 1;
+               return 0;
+       }
+
+       public static int test_0_vector_t_i8_ge () {
+               var elems1 = new long [] { 1, 1 };
+               var v1 = new Vector<long> (elems1);
+               var elems2 = new long [] { 0, 1 };
+               var v2 = new Vector<long> (elems2);
+               Vector<long> v = Vector.GreaterThanOrEqual (v1, v2);
+               if (v [0] != -1 || v [1] != -1)
+                       return 1;
+               return 0;
+       }
+
+       /* Vector.LessThan */
+
+       public static int test_0_vector_t_i1_lt () {
+               var elems1 = new sbyte [] { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 };
+               var v1 = new Vector<sbyte> (elems1);
+               var elems2 = new sbyte [] { 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2 };
+               var v2 = new Vector<sbyte> (elems2);
+               Vector<sbyte> v = Vector.LessThan (v2, v1);
+               for (int i = 0; i < Vector<sbyte>.Count; ++i) {
+                       if (i % 2 == 0 && v [i] != -1)
+                               return 1;
+                       if (i % 2 == 1 && v [i] != 0)
+                               return 1;
+               }
+               return 0;
+       }
+
+       /* Vector.GreaterThan */
+
+       public static int test_0_vector_t_i1_gt () {
+               var elems1 = new sbyte [] { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 };
+               var v1 = new Vector<sbyte> (elems1);
+               var elems2 = new sbyte [] { 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2 };
+               var v2 = new Vector<sbyte> (elems2);
+               Vector<sbyte> v = Vector.GreaterThan (v1, v2);
+               for (int i = 0; i < Vector<sbyte>.Count; ++i) {
+                       if (i % 2 == 0 && v [i] != -1)
+                               return 1;
+                       if (i % 2 == 1 && v [i] != 0)
+                               return 1;
+               }
+               return 0;
+       }
+
+       /* Vector.LessThanOrEqual */
+       public static int test_0_vector_t_i1_le () {
+               var elems1 = new sbyte [] { 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2 };
+               var v1 = new Vector<sbyte> (elems1);
+               var elems2 = new sbyte [] { 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1 };
+               var v2 = new Vector<sbyte> (elems2);
+               Vector<sbyte> v = Vector.LessThanOrEqual (v1, v2);
+               for (int i = 0; i < Vector<sbyte>.Count; ++i) {
+                       if (i % 2 == 0 && v [i] != -1)
+                               return 1;
+                       if (i % 2 == 1 && v [i] != 0)
+                               return 1;
+               }
+               return 0;
+       }
+
+       /* Vector.Abs */
+
+       [MethodImplAttribute (MethodImplOptions.NoInlining)]
+       public static Vector<T> vector_t_abs<T> (Vector<T> v1) where T: struct {
+               return Vector.Abs (v1);
+       }
+
+       public static int test_0_vector_t_u1_abs () {
+               var elems1 = new byte [] { 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2 };
+               var v1 = new Vector<byte> (elems1);
+
+               if (vector_t_abs (v1) != v1)
+                       return 1;
+               return 0;
+       }
+
+       public static int test_0_vector_t_u2_abs () {
+               var elems1 = new ushort [] { 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2 };
+               var v1 = new Vector<ushort> (elems1);
+
+               if (vector_t_abs (v1) != v1)
+                       return 1;
+               return 0;
+       }
+
+       public static int test_0_vector_t_u4_abs () {
+               var elems1 = new uint [] { 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2 };
+               var v1 = new Vector<uint> (elems1);
+
+               if (vector_t_abs (v1) != v1)
+                       return 1;
+               return 0;
+       }
+
+       public static int test_0_vector_t_u8_abs () {
+               var elems1 = new ulong [] { 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2 };
+               var v1 = new Vector<ulong> (elems1);
+
+               if (vector_t_abs (v1) != v1)
+                       return 1;
+               return 0;
+       }
+
+       public static int test_0_vector_t_i1_abs () {
+               var elems1 = new sbyte [] { 1, -2, 1, -2, 1, -2, 1, -2, 1, -2, 1, -2, 1, -2, 1, -2 };
+               var v1 = new Vector<sbyte> (elems1);
+               var elems2 = new sbyte [] { 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2 };
+               var v2 = new Vector<sbyte> (elems2);
+
+               if (vector_t_abs (v1) != v2)
+                       return 1;
+               return 0;
+       }
+
+       // Vector<T>.Add
+       [MethodImplAttribute (MethodImplOptions.NoInlining)]
+       public static Vector<T> vector_add<T> (Vector<T> v1, Vector<T> v2) where T: struct {
+               return v1 + v2;
+       }
+
+       public static int test_0_vector_byte_add () {
+               var v1 = new Vector<byte> (new byte[] { 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2 });
+               var v2 = new Vector<byte> (new byte[] { 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4 });
+
+               var res = vector_add (v1, v1);
+               if (res != v2)
+                       return 1;
+               return 0;
+       }
+
+       public static int test_0_vector_sbyte_add () {
+               var v1 = new Vector<sbyte> (new sbyte[] { 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1 });
+               var v2 = new Vector<sbyte> (new sbyte[] { 2, -2, 2, -2, 2, -2, 2, -2, 2, -2, 2, -2, 2, -2, 2, -2 });
+
+               var res = vector_add (v1, v1);
+               if (res != v2)
+                       return 1;
+               return 0;
+       }
+
+       public static int test_0_vector_ushort_add () {
+               var v1 = new Vector<ushort> (new ushort[] { 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2 });
+               var v2 = new Vector<ushort> (new ushort[] { 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4 });
+
+               var res = vector_add (v1, v1);
+               if (res != v2)
+                       return 1;
+               return 0;
+       }
+
+       public static int test_0_vector_short_add () {
+               var v1 = new Vector<short> (new short[] { 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1 });
+               var v2 = new Vector<short> (new short[] { 2, -2, 2, -2, 2, -2, 2, -2, 2, -2, 2, -2, 2, -2, 2, -2 });
+
+               var res = vector_add (v1, v1);
+               if (res != v2)
+                       return 1;
+               return 0;
+       }
+
+       public static int test_0_vector_uint_add () {
+               var v1 = new Vector<uint> (new uint[] { 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2 });
+               var v2 = new Vector<uint> (new uint[] { 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4 });
+
+               var res = vector_add (v1, v1);
+               if (res != v2)
+                       return 1;
+               return 0;
+       }
+
+       public static int test_0_vector_int_add () {
+               var v1 = new Vector<int> (new int[] { 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1 });
+               var v2 = new Vector<int> (new int[] { 2, -2, 2, -2, 2, -2, 2, -2, 2, -2, 2, 2, 2, -2, 2, -2 });
+
+               var res = vector_add (v1, v1);
+               if (res != v2)
+                       return 1;
+               return 0;
+       }
+
+       public static int test_0_vector_double_add () {
+               var v1 = new Vector<double> (new double[] { 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0 });
+               var v2 = new Vector<double> (new double[] { 2.0, -2.0, 2.0, -2.0, 2.0, -2.0, 2.0, -2.0, 2.0, -2.0, 2.0, 2.0, 2.0, -2.0, 2.0, -2.0 });
+
+               var res = vector_add (v1, v1);
+               if (res != v2)
+                       return 1;
+               return 0;
+       }
+
+       public static int test_0_vector_float_add () {
+               var v1 = new Vector<float> (new float[] { 1.0f, -1.0f, 1.0f, -1.0f, 1.0f, -1.0f, 1.0f, -1.0f, 1.0f, -1.0f, 1.0f, -1.0f, 1.0f, -1.0f, 1.0f, -1.0f });
+               var v2 = new Vector<float> (new float[] { 2.0f, -2.0f, 2.0f, -2.0f, 2.0f, -2.0f, 2.0f, -2.0f, 2.0f, -2.0f, 2.0f, 2.0f, 2.0f, -2.0f, 2.0f, -2.0f });
+
+               var res = vector_add (v1, v1);
+               if (res != v2)
+                       return 1;
+               return 0;
+       }
+
+       // Vector<T>.op_Subtraction
+
+       [MethodImplAttribute (MethodImplOptions.NoInlining)]
+       public static Vector<T> vector_sub<T> (Vector<T> v1, Vector<T> v2) where T: struct {
+               return v1 - v2;
+       }
+
+       public static int test_0_vector_byte_sub () {
+               var v1 = new Vector<byte> (new byte[] { 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2 });
+
+               var res = vector_sub (v1, v1);
+               if (res != Vector<byte>.Zero)
+                       return 1;
+               return 0;
+       }
+
+       public static int test_0_vector_double_sub () {
+               var v1 = new Vector<double> (new double[] { 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0 });
+
+               var res = vector_sub (v1, v1);
+               if (res != Vector<double>.Zero)
+                       return 1;
+               return 0;
+       }
+
+       public static int test_0_vector_float_sub () {
+               var v1 = new Vector<float> (new float[] { 1.0f, -1.0f, 1.0f, -1.0f, 1.0f, -1.0f, 1.0f, -1.0f, 1.0f, -1.0f, 1.0f, -1.0f, 1.0f, -1.0f, 1.0f, -1.0f });
+
+               var res = vector_sub (v1, v1);
+               if (res != Vector<float>.Zero)
+                       return 1;
+               return 0;
+       }
+
+       // Vector<T>.op_Multiply
+       [MethodImplAttribute (MethodImplOptions.NoInlining)]
+       public static Vector<T> vector_mul<T> (Vector<T> v1, Vector<T> v2) where T: struct {
+               return v1 * v2;
+       }
+
+       public static int test_0_vector_int_mul () {
+               var v1 = new Vector<int> (new int[] { 1, 2, -1, 2, 1, 2, -1, 2, 1, -2, 1, 2, 1, 2, -1, 2 });
+               var v2 = new Vector<int> (new int[] { 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4 });
+
+               var res = vector_mul (v1, v1);
+               if (res != v2)
+                       return 1;
+               return 0;
+       }
+
+       public static int test_0_vector_double_mul () {
+               var v1 = new Vector<double> (new double[] { 2.0, -1.0, 2.0, -1.0 });
+               var v2 = new Vector<double> (new double[] { 4.0, 1.0, 4.0, 1.0 });
+
+               var res = vector_mul (v1, v1);
+               if (res != v2)
+                       return 1;
+               return 0;
+       }
+
+       public static int test_0_vector_float_mul () {
+               var v1 = new Vector<float> (new float[] { 2.0f, -1.0f, 2.0f, -1.0f });
+               var v2 = new Vector<float> (new float[] { 4.0f, 1.0f, 4.0f, 1.0f });
+
+               var res = vector_mul (v1, v1);
+               if (res != v2)
+                       return 1;
+               return 0;
+       }
+
+       // Vector<T>.op_Division
+       [MethodImplAttribute (MethodImplOptions.NoInlining)]
+       public static Vector<T> vector_div<T> (Vector<T> v1, Vector<T> v2) where T: struct {
+               return v1 / v2;
+       }
+
+       public static int test_0_vector_double_div () {
+               var v1 = new Vector<double> (new double[] { 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0 });
+               var v2 = new Vector<double> (new double[] { 1.0, 1.0, 1.0, 1.0 });
+
+               var res = vector_div (v1, v1);
+               if (res != v2)
+                       return 1;
+               return 0;
+       }
+
+       public static int test_0_vector_float_div () {
+               var v1 = new Vector<float> (new float[] { 1.0f, -1.0f, 1.0f, -1.0f, 1.0f, -1.0f, 1.0f, -1.0f, 1.0f, -1.0f, 1.0f, -1.0f, 1.0f, -1.0f, 1.0f, -1.0f });
+               var v2 = new Vector<float> (new float[] { 1.0f, 1.0f, 1.0f, 1.0f });
+
+               var res = vector_div (v1, v1);
+               if (res != v2)
+                       return 1;
+               return 0;
+       }
+
+#endif
+
+}
index cab90f84d3de89b717e58beaf13e98419f440afa..1602b03d59aae4ef6d211d82ce75bf61f80b17b6 100644 (file)
@@ -8,10 +8,12 @@
  * Copyright 2011 Xamarin Inc.  http://www.xamarin.com
  * Licensed under the MIT license. See LICENSE file in the project root for full license information.
  */
- #include "mini.h"
 
+#include "config.h"
+#include <mono/utils/mono-compiler.h>
 #ifndef DISABLE_JIT
+
+#include "mini.h"
 
 /*
  * Returns true if @bb is a basic block which falls through the next block.
@@ -1478,4 +1480,8 @@ mono_optimize_branches (MonoCompile *cfg)
        } while (changed && (niterations > 0));
 }
 
-#endif /* DISABLE_JIT */
+#else /* !DISABLE_JIT */
+
+MONO_EMPTY_SOURCE_FILE (branch_opts);
+
+#endif /* !DISABLE_JIT */
index a4910feb18003f48f13f6d6a994522daf1039c27..da291f47ab54fe474de156ea760709537c8a0d38 100644 (file)
@@ -361,6 +361,24 @@ mono_constant_fold_ins (MonoCompile *cfg, MonoInst *ins, MonoInst *arg1, MonoIns
                                return NULL;
                        }
                }
+               if ((arg1->opcode == OP_PCONST) && (arg2->opcode == OP_PCONST) && ins->next) {
+                       MonoInst *next = ins->next;
+
+                       if (next->opcode == OP_LCEQ) {
+                               gboolean res = arg1->inst_p0 == arg2->inst_p0;
+                               if (overwrite) {
+                                       NULLIFY_INS (ins);
+                                       next->opcode = OP_ICONST;
+                                       next->inst_c0 = res;
+                                       MONO_INST_NULLIFY_SREGS (next);
+                               } else {
+                                       ALLOC_DEST (cfg, dest, ins);
+                                       dest->opcode = OP_ICONST;
+                                       dest->inst_c0 = res;
+                               }
+                               break;
+                       }
+               }
                break;
        }
        case OP_FMOVE:
index 3eeae0fc0da1a42d346b733da64fe69f0d1e048b..63fcd28b4e4228698134cd71c0f8a65dc48041bc 100755 (executable)
@@ -741,6 +741,7 @@ cvttps2dq: dest:x src1:x len:5 clob:1
 
 xmove: dest:x src1:x len:5
 xzero: dest:x len:5
+xones: dest:x len:5
 
 iconv_to_x: dest:x src1:i len:5
 extract_i4: dest:i src1:x len:5
index a8eea0965d54bb34f9263672de5063974c378e48..7700619d2e9a316159bf9ee1dfe8342b70e15ac6 100644 (file)
@@ -459,26 +459,26 @@ atomic_exchange_i8: dest:i src1:i src2:i len:32
 atomic_cas_i4: dest:i src1:i src2:i src3:i len:32
 atomic_cas_i8: dest:i src1:i src2:i src3:i len:32
 memory_barrier: len:8 clob:a
-atomic_load_i1: dest:i src1:b len:20
-atomic_load_u1: dest:i src1:b len:20
-atomic_load_i2: dest:i src1:b len:20
-atomic_load_u2: dest:i src1:b len:20
-atomic_load_i4: dest:i src1:b len:16
-atomic_load_u4: dest:i src1:b len:16
-atomic_load_i8: dest:i src1:b len:12
-atomic_load_u8: dest:i src1:b len:12
-atomic_load_r4: dest:f src1:b len:24
-atomic_load_r8: dest:f src1:b len:20
-atomic_store_i1: dest:b src1:i len:16
-atomic_store_u1: dest:b src1:i len:16
-atomic_store_i2: dest:b src1:i len:16
-atomic_store_u2: dest:b src1:i len:16
-atomic_store_i4: dest:b src1:i len:16
-atomic_store_u4: dest:b src1:i len:16
-atomic_store_i8: dest:b src1:i len:12
-atomic_store_u8: dest:b src1:i len:12
-atomic_store_r4: dest:b src1:f len:24
-atomic_store_r8: dest:b src1:f len:20
+atomic_load_i1: dest:i src1:b len:24
+atomic_load_u1: dest:i src1:b len:24
+atomic_load_i2: dest:i src1:b len:24
+atomic_load_u2: dest:i src1:b len:24
+atomic_load_i4: dest:i src1:b len:24
+atomic_load_u4: dest:i src1:b len:24
+atomic_load_i8: dest:i src1:b len:20
+atomic_load_u8: dest:i src1:b len:20
+atomic_load_r4: dest:f src1:b len:28
+atomic_load_r8: dest:f src1:b len:24
+atomic_store_i1: dest:b src1:i len:20
+atomic_store_u1: dest:b src1:i len:20
+atomic_store_i2: dest:b src1:i len:20
+atomic_store_u2: dest:b src1:i len:20
+atomic_store_i4: dest:b src1:i len:20
+atomic_store_u4: dest:b src1:i len:20
+atomic_store_i8: dest:b src1:i len:20
+atomic_store_u8: dest:b src1:i len:20
+atomic_store_r4: dest:b src1:f len:28
+atomic_store_r8: dest:b src1:f len:24
 
 generic_class_init: src1:a len:44 clob:c
 gc_safe_point: src1:i len:12 clob:c
index d786bbad8fcc36e2a293eb5670aabf76360f42b6..846e1cd51410471e354a30ca42333def627dc127 100644 (file)
@@ -45,7 +45,7 @@
 #
 # See the code in mini-x86.c for more details on how the specifiers are used.
 #
-tailcall: len:120 clob:c
+tailcall: len:124 clob:c
 memory_barrier: len:4
 nop: len:4
 relaxed_nop: len:4
index ed3bee869a155630c8b1f6256d273db39a8487ff..f8aeed4392a79a5d52f54ad24b4b9eedbb9f591c 100644 (file)
@@ -71,6 +71,7 @@
 #include <mono/utils/mono-time.h>
 #include <mono/utils/mono-threads.h>
 #include <mono/utils/networking.h>
+#include <mono/utils/mono-proclib.h>
 #include "debugger-agent.h"
 #include "mini.h"
 #include "seq-points.h"
@@ -271,7 +272,7 @@ typedef struct {
 #define HEADER_LENGTH 11
 
 #define MAJOR_VERSION 2
-#define MINOR_VERSION 42
+#define MINOR_VERSION 44
 
 typedef enum {
        CMD_SET_VM = 1,
@@ -499,6 +500,7 @@ typedef enum {
        CMD_STACK_FRAME_GET_THIS = 2,
        CMD_STACK_FRAME_SET_VALUES = 3,
        CMD_STACK_FRAME_GET_DOMAIN = 4,
+       CMD_STACK_FRAME_SET_THIS = 5,
 } CmdStackFrame;
 
 typedef enum {
@@ -667,7 +669,7 @@ static MonoGHashTable *tid_to_thread_obj;
 
 static MonoNativeThreadId debugger_thread_id;
 
-static HANDLE debugger_thread_handle;
+static MonoThreadHandle *debugger_thread_handle;
 
 static int log_level;
 
@@ -931,7 +933,7 @@ mono_debugger_agent_parse_options (char *options)
                /* Waiting for deferred attachment */
                agent_config.defer = TRUE;
                if (agent_config.address == NULL) {
-                       agent_config.address = g_strdup_printf ("0.0.0.0:%u", 56000 + (getpid () % 1000));
+                       agent_config.address = g_strdup_printf ("0.0.0.0:%u", 56000 + (mono_process_current_pid () % 1000));
                }
        }
 
@@ -1627,12 +1629,7 @@ stop_debugger_thread (void)
 static void
 start_debugger_thread (void)
 {
-       MonoThreadParm tp;
-
-       tp.priority = MONO_THREAD_PRIORITY_NORMAL;
-       tp.stack_size = 0;
-       tp.creation_flags = 0;
-       debugger_thread_handle = mono_threads_create_thread (debugger_thread, NULL, &tp, NULL);
+       debugger_thread_handle = mono_threads_create_thread (debugger_thread, NULL, NULL, NULL);
        g_assert (debugger_thread_handle);
 }
 
@@ -2312,7 +2309,7 @@ decode_ptr_id (guint8 *buf, guint8 **endbuf, guint8 *limit, IdType type, MonoDom
        res = (Id *)g_ptr_array_index (ids [type], GPOINTER_TO_INT (id - 1));
        dbg_unlock ();
 
-       if (res->domain == NULL) {
+       if (res->domain == NULL || res->domain->state == MONO_APPDOMAIN_UNLOADED) {
                DEBUG_PRINTF (1, "ERR_UNLOADED, id=%d, type=%d.\n", id, type);
                *err = ERR_UNLOADED;
                return NULL;
@@ -5398,7 +5395,10 @@ ss_create (MonoInternalThread *thread, StepSize size, StepDepth depth, StepFilte
        tls = (DebuggerTlsData *)mono_g_hash_table_lookup (thread_to_tls, thread);
        mono_loader_unlock ();
        g_assert (tls);
-       g_assert (tls->context.valid);
+       if (!tls->context.valid) {
+               DEBUG_PRINTF (1, "Received a single step request on a thread with no managed frames.");
+               return ERR_INVALID_ARGUMENT;
+       }
 
        if (tls->restore_state.valid && MONO_CONTEXT_GET_IP (&tls->context.ctx) != MONO_CONTEXT_GET_IP (&tls->restore_state.ctx)) {
                /*
@@ -6686,7 +6686,7 @@ do_invoke_method (DebuggerTlsData *tls, Buffer *buf, InvokeData *invoke, guint8
 
        if (!m->klass->valuetype && !(m->flags & METHOD_ATTRIBUTE_STATIC) && !this_arg) {
                if (!strcmp (m->name, ".ctor")) {
-                       if (m->klass->flags & TYPE_ATTRIBUTE_ABSTRACT)
+                       if (mono_class_is_abstract (m->klass))
                                return ERR_INVALID_ARGUMENT;
                        else {
                                MonoError error;
@@ -8039,7 +8039,7 @@ type_commands_internal (int command, MonoClass *klass, MonoDomain *domain, guint
                        buffer_add_id (buf, 0);
                buffer_add_int (buf, klass->type_token);
                buffer_add_byte (buf, klass->rank);
-               buffer_add_int (buf, klass->flags);
+               buffer_add_int (buf, mono_class_get_flags (klass));
                b = 0;
                type = &klass->byval_arg;
                // FIXME: Can't decide whenever a class represents a byref type
@@ -8053,9 +8053,9 @@ type_commands_internal (int command, MonoClass *klass, MonoDomain *domain, guint
                        b |= (1 << 3);
                if (klass->enumtype)
                        b |= (1 << 4);
-               if (klass->generic_container)
+               if (mono_class_is_gtd (klass))
                        b |= (1 << 5);
-               if (klass->generic_container || klass->generic_class)
+               if (mono_class_is_gtd (klass) || mono_class_is_ginst (klass))
                        b |= (1 << 6);
                buffer_add_byte (buf, b);
                nnested = 0;
@@ -8067,25 +8067,25 @@ type_commands_internal (int command, MonoClass *klass, MonoDomain *domain, guint
                while ((nested = mono_class_get_nested_types (klass, &iter)))
                        buffer_add_typeid (buf, domain, nested);
                if (CHECK_PROTOCOL_VERSION (2, 12)) {
-                       if (klass->generic_container)
+                       if (mono_class_is_gtd (klass))
                                buffer_add_typeid (buf, domain, klass);
-                       else if (klass->generic_class)
-                               buffer_add_typeid (buf, domain, klass->generic_class->container_class);
+                       else if (mono_class_is_ginst (klass))
+                               buffer_add_typeid (buf, domain, mono_class_get_generic_class (klass)->container_class);
                        else
                                buffer_add_id (buf, 0);
                }
                if (CHECK_PROTOCOL_VERSION (2, 15)) {
                        int count, i;
 
-                       if (klass->generic_class) {
-                               MonoGenericInst *inst = klass->generic_class->context.class_inst;
+                       if (mono_class_is_ginst (klass)) {
+                               MonoGenericInst *inst = mono_class_get_generic_class (klass)->context.class_inst;
 
                                count = inst->type_argc;
                                buffer_add_int (buf, count);
                                for (i = 0; i < count; i++)
                                        buffer_add_typeid (buf, domain, mono_class_from_mono_type (inst->type_argv [i]));
-                       } else if (klass->generic_container) {
-                               MonoGenericContainer *container = klass->generic_container;
+                       } else if (mono_class_is_gtd (klass)) {
+                               MonoGenericContainer *container = mono_class_get_generic_container (klass);
                                MonoClass *pklass;
 
                                count = container->type_argc;
@@ -8627,6 +8627,12 @@ method_commands_internal (int command, MonoMethod *method, MonoDomain *domain, g
 
                locals = mono_debug_lookup_locals (method);
                if (!locals) {
+                       if (CHECK_PROTOCOL_VERSION (2, 43)) {
+                               /* Scopes */
+                               buffer_add_int (buf, 1);
+                               buffer_add_int (buf, 0);
+                               buffer_add_int (buf, header->code_size);
+                       }
                        buffer_add_int (buf, header->num_locals);
                        /* Types */
                        for (i = 0; i < header->num_locals; ++i) {
@@ -8644,6 +8650,17 @@ method_commands_internal (int command, MonoMethod *method, MonoDomain *domain, g
                                buffer_add_int (buf, header->code_size);
                        }
                } else {
+                       if (CHECK_PROTOCOL_VERSION (2, 43)) {
+                               /* Scopes */
+                               buffer_add_int (buf, locals->num_blocks);
+                               int last_start = 0;
+                               for (i = 0; i < locals->num_blocks; ++i) {
+                                       buffer_add_int (buf, locals->code_blocks [i].start_offset - last_start);
+                                       buffer_add_int (buf, locals->code_blocks [i].end_offset - locals->code_blocks [i].start_offset);
+                                       last_start = locals->code_blocks [i].start_offset;
+                               }
+                       }
+
                        num_locals = locals->num_locals;
                        buffer_add_int (buf, num_locals);
 
@@ -8897,7 +8914,7 @@ method_commands_internal (int command, MonoMethod *method, MonoDomain *domain, g
                }
                ginst = mono_metadata_get_generic_inst (type_argc, type_argv);
                g_free (type_argv);
-               tmp_context.class_inst = method->klass->generic_class ? method->klass->generic_class->context.class_inst : NULL;
+               tmp_context.class_inst = mono_class_is_ginst (method->klass) ? mono_class_get_generic_class (method->klass)->context.class_inst : NULL;
                tmp_context.method_inst = ginst;
 
                inflated = mono_class_inflate_generic_method_checked (method, &tmp_context, &error);
@@ -9257,6 +9274,25 @@ frame_commands (int command, guint8 *p, guint8 *end, Buffer *buf)
                        buffer_add_domainid (buf, frame->domain);
                break;
        }
+       case CMD_STACK_FRAME_SET_THIS: {
+               guint8 *val_buf;
+               MonoType *t;
+               MonoDebugVarInfo *var;
+
+               t = &frame->actual_method->klass->byval_arg;
+               /* Checked by the sender */
+               g_assert (MONO_TYPE_ISSTRUCT (t));
+               var = jit->this_var;
+               g_assert (var);
+
+               val_buf = (guint8 *)g_alloca (mono_class_instance_size (mono_class_from_mono_type (t)));
+               err = decode_value (t, frame->domain, val_buf, p, &p, end);
+               if (err != ERR_NONE)
+                       return err;
+
+               set_var (&frame->actual_method->klass->this_arg, var, &frame->ctx, frame->domain, val_buf, frame->reg_locations, &tls->restore_state.ctx);
+               break;
+       }
        default:
                return ERR_NOT_IMPLEMENTED;
        }
@@ -9676,6 +9712,7 @@ static const char* stack_frame_cmds_str[] = {
        "GET_THIS",
        "SET_VALUES",
        "GET_DOMAIN",
+       "SET_THIS"
 };
 
 static const char* array_cmds_str[] = {
@@ -9833,16 +9870,17 @@ debugger_thread (void *arg)
        thread->internal_thread->state |= ThreadState_Background;
        thread->internal_thread->flags |= MONO_THREAD_FLAG_DONT_MANAGE;
 
-       mono_set_is_debugger_attached (TRUE);
-       
        if (agent_config.defer) {
                if (!wait_for_attach ()) {
                        DEBUG_PRINTF (1, "[dbg] Can't attach, aborting debugger thread.\n");
                        attach_failed = TRUE; // Don't abort process when we can't listen
                } else {
+                       mono_set_is_debugger_attached (TRUE);
                        /* Send start event to client */
                        process_profiler_event (EVENT_KIND_VM_START, mono_thread_get_main ());
                }
+       } else {
+               mono_set_is_debugger_attached (TRUE);
        }
        
        while (!attach_failed) {
index 0409cd7d78d0b20f7c73f59982a985442802ecfa..aaa34a3bc34fba472c49726be3bd70936bc4426a 100644 (file)
@@ -15,6 +15,7 @@
 
 #include <mono/metadata/gc-internals.h>
 #include <mono/metadata/abi-details.h>
+#include <mono/utils/mono-compiler.h>
 
 #ifndef DISABLE_JIT
 
@@ -1889,6 +1890,13 @@ mono_local_emulate_ops (MonoCompile *cfg)
                        int op_noimm = mono_op_imm_to_op (ins->opcode);
                        MonoJitICallInfo *info;
 
+                       /*
+                        * These opcodes don't have logical equivalence to the emulating native
+                        * function. They are decomposed in specific fashion in mono_decompose_soft_float.
+                        */
+                       if (MONO_HAS_CUSTOM_EMULATION (ins))
+                               continue;
+
                        /*
                         * Emulation can't handle _IMM ops. If this is an imm opcode we need
                         * to check whether its non-imm counterpart is emulated and, if so,
@@ -1961,4 +1969,8 @@ mono_local_emulate_ops (MonoCompile *cfg)
        }
 }
 
-#endif /* DISABLE_JIT */
+#else /* !DISABLE_JIT */
+
+MONO_EMPTY_SOURCE_FILE (decompose);
+
+#endif /* !DISABLE_JIT */
index 9181e53b25257183de08774b3a793327ebe33be2..7d0716dad90c909c3d68fd2f59b0f2af827ad276 100644 (file)
 #include <mono/metadata/gc-internals.h>
 #include <mono/metadata/coree.h>
 #include <mono/metadata/attach.h>
+#include <mono/metadata/w32process.h>
 #include "mono/utils/mono-counters.h"
 #include "mono/utils/mono-hwcap.h"
 #include "mono/utils/mono-logger-internals.h"
+#include "mono/metadata/w32handle.h"
 
 #include "mini.h"
 #include "jit.h"
@@ -933,7 +935,7 @@ compile_all_methods_thread_main_inner (CompileAllThreadArgs *args)
                    (method->flags & METHOD_ATTRIBUTE_ABSTRACT))
                        continue;
 
-               if (method->klass->generic_container)
+               if (mono_class_is_gtd (method->klass))
                        continue;
                sig = mono_method_signature (method);
                if (!sig) {
@@ -1273,6 +1275,7 @@ mini_usage (void)
 #ifdef HOST_WIN32
                "    --mixed-mode           Enable mixed-mode image support.\n"
 #endif
+               "    --handlers             Install custom handlers, use --help-handlers for details.\n"
          );
 }
 
@@ -1367,30 +1370,6 @@ static const char info[] =
 #define error_if_aot_unsupported()
 #endif
 
-#ifdef HOST_WIN32
-BOOL APIENTRY DllMain (HMODULE module_handle, DWORD reason, LPVOID reserved)
-{
-       if (!mono_gc_dllmain (module_handle, reason, reserved))
-               return FALSE;
-
-       switch (reason)
-       {
-       case DLL_PROCESS_ATTACH:
-               mono_install_runtime_load (mini_init);
-               break;
-       case DLL_PROCESS_DETACH:
-               if (coree_module_handle)
-                       FreeLibrary (coree_module_handle);
-               break;
-       case DLL_THREAD_DETACH:
-               mono_thread_info_detach ();
-               break;
-       
-       }
-       return TRUE;
-}
-#endif
-
 static gboolean enable_debugging;
 
 /*
@@ -1457,6 +1436,10 @@ mono_jit_parse_options (int argc, char * argv[])
                        
                        if (!mono_debugger_insert_breakpoint (argv [++i], FALSE))
                                fprintf (stderr, "Error: invalid method name '%s'\n", argv [i]);
+               } else if (strncmp (argv[i], "--gc-params=", 12) == 0) {
+                       mono_gc_params_set (argv[i] + 12);
+               } else if (strncmp (argv[i], "--gc-debug=", 11) == 0) {
+                       mono_gc_debug_set (argv[i] + 11);
                } else if (strcmp (argv [i], "--llvm") == 0) {
 #ifndef MONO_ARCH_LLVM_SUPPORTED
                        fprintf (stderr, "Mono Warning: --llvm not supported on this platform.\n");
@@ -1523,6 +1506,7 @@ switch_gc (char* argv[], const char* target_gc)
 
 #ifdef HAVE_EXECVP
        execvp (path->str, argv);
+       fprintf (stderr, "Error: Failed to switch to %s gc. mono-%s is not installed.\n", target_gc, target_gc);
 #else
        fprintf (stderr, "Error: --gc=<NAME> option not supported on this platform.\n");
 #endif
@@ -1574,6 +1558,10 @@ switch_arch (char* argv[], const char* target_arch)
 }
 
 #endif
+
+#define MONO_HANDLERS_ARGUMENT "--handlers="
+#define MONO_HANDLERS_ARGUMENT_LEN G_N_ELEMENTS(MONO_HANDLERS_ARGUMENT)-1
+
 /**
  * mono_main:
  * @argc: number of arguments in the argv array
@@ -1701,6 +1689,10 @@ mono_main (int argc, char* argv[])
                        switch_gc (argv, "sgen");
                } else if (strcmp (argv [i], "--gc=boehm") == 0) {
                        switch_gc (argv, "boehm");
+               } else if (strncmp (argv[i], "--gc-params=", 12) == 0) {
+                       mono_gc_params_set (argv[i] + 12);
+               } else if (strncmp (argv[i], "--gc-debug=", 11) == 0) {
+                       mono_gc_debug_set (argv[i] + 11);
                }
 #ifdef TARGET_OSX
                else if (strcmp (argv [i], "--arch=32") == 0) {
@@ -1767,10 +1759,11 @@ mono_main (int argc, char* argv[])
                } else if (strcmp (argv [i], "--verify-all") == 0) {
                        mono_verifier_enable_verify_all ();
                } else if (strcmp (argv [i], "--full-aot") == 0) {
-                       mono_aot_only = TRUE;
+                       mono_jit_set_aot_mode (MONO_AOT_MODE_FULL);
                } else if (strcmp (argv [i], "--llvmonly") == 0) {
-                       mono_aot_only = TRUE;
-                       mono_llvm_only = TRUE;
+                       mono_jit_set_aot_mode (MONO_AOT_MODE_LLVMONLY);
+               } else if (strcmp (argv [i], "--hybrid-aot") == 0) {
+                       mono_jit_set_aot_mode (MONO_AOT_MODE_HYBRID);
                } else if (strcmp (argv [i], "--print-vtable") == 0) {
                        mono_print_vtable = TRUE;
                } else if (strcmp (argv [i], "--stats") == 0) {
@@ -1921,6 +1914,15 @@ mono_main (int argc, char* argv[])
                } else if (strcmp (argv [i], "--nacl-null-checks-off") == 0){
                        nacl_null_checks_off = TRUE;
 #endif
+               } else if (strncmp (argv [i], MONO_HANDLERS_ARGUMENT, MONO_HANDLERS_ARGUMENT_LEN) == 0) {
+                       //Install specific custom handlers.
+                       if (!mono_runtime_install_custom_handlers (argv[i] + MONO_HANDLERS_ARGUMENT_LEN)) {
+                               fprintf (stderr, "error: " MONO_HANDLERS_ARGUMENT ", one or more unknown handlers: '%s'\n", argv [i]);
+                               return 1;
+                       }
+               } else if (strcmp (argv [i], "--help-handlers") == 0) {
+                       mono_runtime_install_custom_handlers_usage ();
+                       return 0;
                } else if (argv [i][0] == '-' && argv [i][1] == '-' && mini_parse_debug_option (argv [i] + 2)) {
                } else {
                        fprintf (stderr, "Unknown command line option: '%s'\n", argv [i]);
@@ -1955,9 +1957,9 @@ mono_main (int argc, char* argv[])
        {
                char *runtime_path;
 
-               runtime_path = wapi_process_get_path (getpid ());
+               runtime_path = mono_w32process_get_path (getpid ());
                if (runtime_path) {
-                       wapi_process_set_cli_launcher (runtime_path);
+                       mono_w32process_set_cli_launcher (runtime_path);
                        g_free (runtime_path);
                }
        }
@@ -1986,15 +1988,13 @@ mono_main (int argc, char* argv[])
 
        mono_counters_init ();
 
+#ifndef HOST_WIN32
+       mono_w32handle_init ();
+#endif
+
        /* Set rootdir before loading config */
        mono_set_rootdir ();
 
-       /*
-        * We only set the native name of the thread since MS.NET leaves the
-        * managed thread name for the main thread as null.
-        */
-       mono_native_thread_set_name (mono_native_thread_id_get (), "Main");
-
        if (enable_profile) {
                mono_profiler_load (profile_options);
                mono_profiler_thread_name (MONO_NATIVE_THREAD_ID_TO_UINT (mono_native_thread_id_get ()), "Main");
@@ -2130,7 +2130,7 @@ mono_main (int argc, char* argv[])
                        exit (1);
                }
 
-#ifdef HOST_WIN32
+#if defined(HOST_WIN32) && G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
                /* Detach console when executing IMAGE_SUBSYSTEM_WINDOWS_GUI on win32 */
                if (!enable_debugging && !mono_compile_aot && ((MonoCLIImageInfo*)(mono_assembly_get_image (assembly)->image_info))->cli_header.nt.pe_subsys_required == IMAGE_SUBSYSTEM_WINDOWS_GUI)
                        FreeConsole ();
@@ -2321,11 +2321,21 @@ mono_jit_set_aot_only (gboolean val)
 void
 mono_jit_set_aot_mode (MonoAotMode mode)
 {
+       /* we don't want to set mono_aot_mode twice */
+       g_assert (mono_aot_mode == MONO_AOT_MODE_NONE);
        mono_aot_mode = mode;
+
        if (mono_aot_mode == MONO_AOT_MODE_LLVMONLY) {
                mono_aot_only = TRUE;
                mono_llvm_only = TRUE;
        }
+       if (mono_aot_mode == MONO_AOT_MODE_FULL) {
+               mono_aot_only = TRUE;
+       }
+       if (mono_aot_mode == MONO_AOT_MODE_HYBRID) {
+               mono_set_generic_sharing_vt_supported (TRUE);
+               mono_set_partial_sharing_supported (TRUE);
+       }
 }
 
 /**
index ad25f58728ec9c6a3de38dd253f4e0cecdb92c78..6c191d0b37ddd73527a2bc7a990cc95c964a19d8 100644 (file)
@@ -8,6 +8,7 @@
  */
 
 #include "config.h"
+#include <mono/utils/mono-compiler.h>
 
 #if !defined(DISABLE_AOT) && !defined(DISABLE_JIT)
 #include "dwarfwriter.h"
@@ -2002,4 +2003,9 @@ mono_dwarf_writer_emit_trampoline (MonoDwarfWriter *w, const char *tramp_name, c
        emit_fde (w, w->fde_index, start_symbol, end_symbol, code, code_size, unwind_info, FALSE);
        w->fde_index ++;
 }
+
+#else /* !defined(DISABLE_AOT) && !defined(DISABLE_JIT) */
+
+MONO_EMPTY_SOURCE_FILE (dwarfwriter);
+
 #endif /* End of: !defined(DISABLE_AOT) && !defined(DISABLE_JIT) */
diff --git a/mono/mini/emitnunit.pl b/mono/mini/emitnunit.pl
deleted file mode 100755 (executable)
index 63e6679..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-#!/usr/bin/perl
-use strict;
-use warnings;
-use Cwd;
-use POSIX qw(strftime uname locale_h);
-use Net::Domain qw(hostname hostfqdn);
-use locale;
-
-my $line;
-foreach $line (<STDIN>) {
-    chomp ($line);
-    print "$line\n";
-    if ($line =~ /^Overall results:/) {
-        # do magic nunit emission here
-        # failures look like:
-        #    Overall results: tests: 19992, failed: 48, opt combinations: 24 (pass: 99.76%)
-        # passes look like:
-        #    Overall results: tests: 20928, 100% pass, opt combinations: 24
-        my @words = split (/ /, $line);
-        my $failed;
-        my $successbool;
-        my $total = $words[3];
-        my $mylocale = setlocale (LC_CTYPE);
-        $mylocale = substr($mylocale, 0, index($mylocale, '.'));
-        $mylocale =~ s/_/-/;
-        if ($line =~ /failed:/) {
-            $failed = $words[5];
-        } else {
-            $failed = "0,";
-        }
-        chop ($failed);
-        chop ($total);
-        if ($failed > 0) {
-            $successbool = "False";
-        } else {
-            $successbool = "True";
-        }
-        open (my $nunitxml, '>', 'TestResult-regression.xml') or die "Could not write to 'TestResult-regression.xml' $!";
-        print $nunitxml "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n";
-        print $nunitxml "<!--This file represents the results of running a test suite-->\n";
-        print $nunitxml "<test-results name=\"regression-tests.dummy\" total=\"$total\" failures=\"$failed\" not-run=\"0\" date=\"" . strftime ("%F", localtime) . "\" time=\"" . strftime ("%T", localtime) . "\">\n";
-        print $nunitxml "  <environment nunit-version=\"2.4.8.0\" clr-version=\"4.0.30319.17020\" os-version=\"Unix " . (uname ())[2]  . "\" platform=\"Unix\" cwd=\"" . getcwd . "\" machine-name=\"" . hostname . "\" user=\"" . getpwuid ($<) . "\" user-domain=\"" . hostfqdn  . "\" />\n";
-        print $nunitxml "  <culture-info current-culture=\"$mylocale\" current-uiculture=\"$mylocale\" />\n";
-        print $nunitxml "  <test-suite name=\"regression-tests.dummy\" success=\"$successbool\" time=\"0\" asserts=\"0\">\n";
-        print $nunitxml "    <results>\n";
-        print $nunitxml "      <test-suite name=\"MonoTests\" success=\"$successbool\" time=\"0\" asserts=\"0\">\n";
-        print $nunitxml "        <results>\n";
-        print $nunitxml "          <test-suite name=\"regressions\" success=\"$successbool\" time=\"0\" asserts=\"0\">\n";
-        print $nunitxml "            <results>\n";
-        print $nunitxml "              <test-case name=\"MonoTests.regressions.100percentsuccess\" executed=\"True\" success=\"$successbool\" time=\"0\" asserts=\"0\"";
-        if ( $failed > 0) {
-        print $nunitxml ">\n";
-        print $nunitxml "                <failure>\n";
-        print $nunitxml "                  <message><![CDATA[";
-        foreach $line (<STDIN>) {
-            chomp ($line);
-            print "$line\n";
-        }
-        print $nunitxml "]]></message>\n";
-        print $nunitxml "                  <stack-trace>\n";
-        print $nunitxml "                  </stack-trace>\n";
-        print $nunitxml "                </failure>\n";
-        print $nunitxml "              </test-case>\n";
-        } else {
-        print $nunitxml " />\n";
-        }
-        print $nunitxml "            </results>\n";
-        print $nunitxml "          </test-suite>\n";
-        print $nunitxml "        </results>\n";
-        print $nunitxml "      </test-suite>\n";
-        print $nunitxml "    </results>\n";
-        print $nunitxml "  </test-suite>\n";
-        print $nunitxml "</test-results>\n";
-        close $nunitxml;
-    }
-}
index 919682acca6a9c5fb1d2d38456f16fabb01a9227..dbef0887519b5e12e85ba3320e952eef4a086c15 100644 (file)
@@ -152,6 +152,7 @@ void win32_seh_set_handler(int type, MonoW32ExceptionHandler handler)
 
 #endif /* TARGET_WIN32 */
 
+#ifndef DISABLE_JIT
 /*
  * mono_arch_get_restore_context:
  *
@@ -285,6 +286,7 @@ mono_arch_get_call_filter (MonoTrampInfo **info, gboolean aot)
 
        return start;
 }
+#endif /* !DISABLE_JIT */
 
 /* 
  * The first few arguments are dummy, to force the other arguments to be passed on
@@ -350,6 +352,7 @@ mono_amd64_resume_unwind (guint64 dummy1, guint64 dummy2, guint64 dummy3, guint6
        mono_resume_unwind (&ctx);
 }
 
+#ifndef DISABLE_JIT
 /*
  * get_throw_trampoline:
  *
@@ -496,6 +499,7 @@ mono_arch_get_throw_corlib_exception (MonoTrampInfo **info, gboolean aot)
 {
        return get_throw_trampoline (info, FALSE, TRUE, FALSE, FALSE, "throw_corlib_exception", aot);
 }
+#endif /* !DISABLE_JIT */
 
 /*
  * mono_arch_unwind_frame:
@@ -833,6 +837,7 @@ mono_amd64_get_original_ip (void)
        return lmf->rip;
 }
 
+#ifndef DISABLE_JIT
 GSList*
 mono_amd64_get_exception_trampolines (gboolean aot)
 {
@@ -851,6 +856,7 @@ mono_amd64_get_exception_trampolines (gboolean aot)
 
        return tramps;
 }
+#endif /* !DISABLE_JIT */
 
 void
 mono_arch_exceptions_init (void)
@@ -878,7 +884,7 @@ mono_arch_exceptions_init (void)
        }
 }
 
-#ifdef TARGET_WIN32
+#if defined(TARGET_WIN32) && !defined(DISABLE_JIT)
 
 /*
  * The mono_arch_unwindinfo* methods are used to build and add
@@ -1118,9 +1124,9 @@ mono_arch_unwindinfo_install_unwind_info (gpointer* monoui, gpointer code, guint
        RtlInstallFunctionTableCallback (((DWORD64)code) | 0x3, (DWORD64)code, code_size, MONO_GET_RUNTIME_FUNCTION_CALLBACK, code, NULL);
 }
 
-#endif
+#endif /* defined(TARGET_WIN32) !defined(DISABLE_JIT) */
 
-#if MONO_SUPPORT_TASKLETS
+#if MONO_SUPPORT_TASKLETS && !defined(DISABLE_JIT)
 MonoContinuationRestore
 mono_tasklets_arch_restore (void)
 {
@@ -1172,7 +1178,7 @@ mono_tasklets_arch_restore (void)
        saved = start;
        return (MonoContinuationRestore)saved;
 }
-#endif
+#endif /* MONO_SUPPORT_TASKLETS && !defined(DISABLE_JIT) */
 
 /*
  * mono_arch_setup_resume_sighandler_ctx:
@@ -1190,3 +1196,56 @@ mono_arch_setup_resume_sighandler_ctx (MonoContext *ctx, gpointer func)
                MONO_CONTEXT_SET_SP (ctx, (guint64)MONO_CONTEXT_GET_SP (ctx) - 8);
        MONO_CONTEXT_SET_IP (ctx, func);
 }
+
+#ifdef DISABLE_JIT
+gpointer
+mono_arch_get_restore_context (MonoTrampInfo **info, gboolean aot)
+{
+       g_assert_not_reached ();
+       return NULL;
+}
+
+gpointer
+mono_arch_get_call_filter (MonoTrampInfo **info, gboolean aot)
+{
+       g_assert_not_reached ();
+       return NULL;
+}
+
+gpointer
+mono_arch_get_throw_exception (MonoTrampInfo **info, gboolean aot)
+{
+       g_assert_not_reached ();
+       return NULL;
+}
+
+gpointer
+mono_arch_get_rethrow_exception (MonoTrampInfo **info, gboolean aot)
+{
+       g_assert_not_reached ();
+       return NULL;
+}
+
+gpointer
+mono_arch_get_throw_corlib_exception (MonoTrampInfo **info, gboolean aot)
+{
+       g_assert_not_reached ();
+       return NULL;
+}
+
+GSList*
+mono_amd64_get_exception_trampolines (gboolean aot)
+{
+       g_assert_not_reached ();
+       return NULL;
+}
+#endif /* DISABLE_JIT */
+
+#if !MONO_SUPPORT_TASKLETS || defined(DISABLE_JIT)
+MonoContinuationRestore
+mono_tasklets_arch_restore (void)
+{
+       g_assert_not_reached ();
+       return NULL;
+}
+#endif /* !MONO_SUPPORT_TASKLETS || defined(DISABLE_JIT) */
index fe210faa3a22ce14883bcad17c657328cf8bd746..9b7f762e9914a1512cbe5e6eacfa7a374e2b7a90 100644 (file)
@@ -29,15 +29,21 @@ mono_arch_get_restore_context (MonoTrampInfo **info, gboolean aot)
        MonoJumpInfo *ji = NULL;
        GSList *unwind_ops = NULL;
        int i, ctx_reg, size;
+       guint8 *labels [16];
 
        size = 256;
        code = start = mono_global_codeman_reserve (size);
 
        arm_movx (code, ARMREG_IP0, ARMREG_R0);
        ctx_reg = ARMREG_IP0;
+
        /* Restore fregs */
+       arm_ldrx (code, ARMREG_IP1, ctx_reg, MONO_STRUCT_OFFSET (MonoContext, has_fregs));
+       labels [0] = code;
+       arm_cbzx (code, ARMREG_IP1, 0);
        for (i = 0; i < 32; ++i)
                arm_ldrfpx (code, i, ctx_reg, MONO_STRUCT_OFFSET (MonoContext, fregs) + (i * 8));
+       mono_arm_patch (labels [0], code, MONO_R_ARM64_CBZ);
        /* Restore gregs */
        // FIXME: Restore less registers
        // FIXME: fp should be restored later
@@ -69,9 +75,10 @@ mono_arch_get_call_filter (MonoTrampInfo **info, gboolean aot)
 {
        guint8 *code;
        guint8* start;
-       int size, offset, gregs_offset, fregs_offset, ctx_offset, num_fregs, frame_size;
+       int i, size, offset, gregs_offset, fregs_offset, ctx_offset, num_fregs, frame_size;
        MonoJumpInfo *ji = NULL;
        GSList *unwind_ops = NULL;
+       guint8 *labels [16];
 
        size = 512;
        start = code = mono_global_codeman_reserve (size);
@@ -105,10 +112,19 @@ mono_arch_get_call_filter (MonoTrampInfo **info, gboolean aot)
        arm_strx (code, ARMREG_R0, ARMREG_FP, ctx_offset);
        /* Save gregs */
        code = mono_arm_emit_store_regarray (code, MONO_ARCH_CALLEE_SAVED_REGS | (1 << ARMREG_FP), ARMREG_FP, gregs_offset);
-       /* No need to save/restore fregs, since we don't currently use them */
+       /* Save fregs */
+       for (i = 0; i < num_fregs; ++i)
+               arm_strfpx (code, ARMREG_D8 + i, ARMREG_FP, fregs_offset + (i * 8));
 
        /* Load regs from ctx */
        code = mono_arm_emit_load_regarray (code, MONO_ARCH_CALLEE_SAVED_REGS, ARMREG_R0, MONO_STRUCT_OFFSET (MonoContext, regs));
+       /* Load fregs */
+       arm_ldrx (code, ARMREG_IP0, ARMREG_R0, MONO_STRUCT_OFFSET (MonoContext, has_fregs));
+       labels [0] = code;
+       arm_cbzx (code, ARMREG_IP0, 0);
+       for (i = 0; i < num_fregs; ++i)
+               arm_ldrfpx (code, ARMREG_D8 + i, ARMREG_R0, MONO_STRUCT_OFFSET (MonoContext, fregs) + (i * 8));
+       mono_arm_patch (labels [0], code, MONO_R_ARM64_CBZ);
        /* Load fp */
        arm_ldrx (code, ARMREG_FP, ARMREG_R0, MONO_STRUCT_OFFSET (MonoContext, regs) + (ARMREG_FP * 8));
 
@@ -126,6 +142,9 @@ mono_arch_get_call_filter (MonoTrampInfo **info, gboolean aot)
 
        /* Restore regs */
        code = mono_arm_emit_load_regarray (code, MONO_ARCH_CALLEE_SAVED_REGS, ARMREG_FP, gregs_offset);
+       /* Restore fregs */
+       for (i = 0; i < num_fregs; ++i)
+               arm_ldrfpx (code, ARMREG_D8 + i, ARMREG_FP, fregs_offset + (i * 8));
        /* Destroy frame */
        code = mono_arm_emit_destroy_frame (code, frame_size, (1 << ARMREG_IP0));
        arm_retx (code, ARMREG_LR);
@@ -374,6 +393,7 @@ mono_arm_throw_exception (gpointer arg, mgreg_t pc, mgreg_t *int_regs, gdouble *
        memset (&ctx, 0, sizeof (MonoContext));
        memcpy (&(ctx.regs [0]), int_regs, sizeof (mgreg_t) * 32);
        memcpy (&(ctx.fregs [ARMREG_D8]), fp_regs, sizeof (double) * 8);
+       ctx.has_fregs = 1;
        ctx.pc = pc;
 
        if (mono_object_isinst_checked (exc, mono_defaults.exception_class, &error)) {
@@ -402,6 +422,7 @@ mono_arm_resume_unwind (gpointer arg, mgreg_t pc, mgreg_t *int_regs, gdouble *fp
        memset (&ctx, 0, sizeof (MonoContext));
        memcpy (&(ctx.regs [0]), int_regs, sizeof (mgreg_t) * 32);
        memcpy (&(ctx.fregs [ARMREG_D8]), fp_regs, sizeof (double) * 8);
+       ctx.has_fregs = 1;
        ctx.pc = pc;
 
        mono_resume_unwind (&ctx);
index 80a579b05eb87e539e3b1c344edf636991b4c667..684d2d9a469a757f36deb86e1d0702c018b23458 100644 (file)
@@ -697,6 +697,11 @@ mono_arch_handle_altstack_exception (void *sigctx, MONO_SIG_HANDLER_INFO_TYPE *s
        }
 #else
        UCONTEXT_REG_NIP(uc) = (unsigned long)altstack_handle_and_restore;
+#if _CALL_ELF == 2
+       /* ELF v2 ABI calling convention requires to put the target address into
+       * r12 if we use the global entry point of a function. */
+       UCONTEXT_REG_Rn(uc, 12) = (unsigned long) altstack_handle_and_restore;
+#endif
 #endif
        UCONTEXT_REG_Rn(uc, 1) = (unsigned long)sp;
        UCONTEXT_REG_Rn(uc, PPC_FIRST_ARG_REG) = (unsigned long)(sp + 16);
@@ -739,6 +744,11 @@ setup_ucontext_return (void *uc, gpointer func)
        }
 #else
        UCONTEXT_REG_NIP(uc) = (unsigned long)func;
+#if _CALL_ELF == 2
+       /* ELF v2 ABI calling convention requires to put the target address into
+       * r12 if we use the global entry point of a function. */
+       UCONTEXT_REG_Rn(uc, 12) = (unsigned long) func;
+#endif
 #endif
 #endif
 }
index d737bc7f7f0768ab51457bf6008fda554de519d0..fe0957fa3f2a1a750ff8405a9b7e824a1c333c1e 100644 (file)
@@ -536,11 +536,11 @@ mono_x86_resume_unwind (mgreg_t *regs, MonoObject *exc,
 static guint8*
 get_throw_trampoline (const char *name, gboolean rethrow, gboolean llvm, gboolean corlib, gboolean llvm_abs, gboolean resume_unwind, MonoTrampInfo **info, gboolean aot)
 {
-       guint8 *start, *code;
+       guint8 *start, *code, *labels [16];
        int i, stack_size, stack_offset, arg_offsets [5], regs_offset;
        MonoJumpInfo *ji = NULL;
        GSList *unwind_ops = NULL;
-       guint kMaxCodeSize = 128;
+       guint kMaxCodeSize = 192;
 
        start = code = mono_global_codeman_reserve (kMaxCodeSize);
 
@@ -605,6 +605,18 @@ get_throw_trampoline (const char *name, gboolean rethrow, gboolean llvm, gboolea
        x86_lea_membase (code, X86_EAX, X86_ESP, stack_offset);
        x86_mov_membase_reg (code, X86_ESP, regs_offset + (X86_ESP * 4), X86_EAX, 4);
 
+       /* Clear fp stack */
+       labels [0] = code;
+       x86_fnstsw (code);
+       x86_shift_reg_imm (code, X86_SHR, X86_EAX, 11);
+       x86_alu_reg_imm (code, X86_AND, X86_EAX, 7);
+       x86_alu_reg_imm (code, X86_CMP, X86_EAX, 0);
+       labels [1] = code;
+       x86_branch8 (code, X86_CC_EQ, 0, FALSE);
+       x86_fstp (code, 0);
+       x86_jump_code (code, labels [0]);
+       mono_x86_patch (labels [1], code);
+
        /* Set arg1 == regs */
        x86_lea_membase (code, X86_EAX, X86_ESP, regs_offset);
        x86_mov_membase_reg (code, X86_ESP, arg_offsets [0], X86_EAX, 4);
index 80638b5048e6edf80854c7509ee3b7d18292cd5c..018619449191a8cf24899b7d1cba6f55519a85d0 100644 (file)
@@ -1272,7 +1272,6 @@ class Tests
                c.throw_catch_t ();
                return 0;
        }
-
 }
 
 #if !__MOBILE__
index 08d2891f87c239c138f3d1e48284f3f8c8399aef..95e1fff2bb42a59abeb32870870b8c718163494f 100644 (file)
@@ -8,6 +8,7 @@
  */
 
 #include <config.h>
+#include <mono/utils/mono-compiler.h>
 
 #ifndef DISABLE_JIT
 
@@ -346,5 +347,9 @@ mono_draw_graph (MonoCompile *cfg, MonoGraphOptions draw_options)
 #endif
 }
 
-#endif /* DISABLE_JIT */
+#else /* !DISABLE_JIT */
+
+MONO_EMPTY_SOURCE_FILE (graph);
+
+#endif /* !DISABLE_JIT */
 
index 88f8c2ebb22b780a3c461daf2d8b62e6370f3e68..65151b07024e8d1a2199d9b76119cd07be48c527 100644 (file)
@@ -1907,6 +1907,40 @@ public class Tests
                bool success = zz == 0xAAAAAAAAAAAAAAAA;
                return success ? 20 : 1;
        }
+
+       void gsharedvt_try_at_offset_0<T> (ref T disposable)
+               where T : class, IDisposable {
+                       try {
+                               disposable.Dispose ();
+                       } finally {
+                               disposable = null;
+                       }
+               }
+
+       [MethodImplAttribute (MethodImplOptions.NoInlining)]
+       static DateTimeOffset gsharedvt_vphi_inner<T> (T t) {
+               return DateTimeOffset.MinValue;
+       }
+
+       static DateTimeOffset gsharedvt_vphi<T> (T t) {
+               int[] arr = new int [10];
+
+               try {
+                       DateTimeOffset v;
+                       if (arr [0] == 0)
+                               v = gsharedvt_vphi_inner (t);
+                       else
+                               v = gsharedvt_vphi_inner (t);
+                       return v;
+               } catch {
+                       return DateTimeOffset.MinValue;
+               }
+       }
+
+       static int test_0_gsharedvt_vphi_volatile () {
+               gsharedvt_vphi (0);
+               return 0;
+       }
 }
 
 // #13191
index ab3bf8094a56e711648810e6ea8e7bfe3ea4c8dd..2e4619301d1b6ca24b81da6be81759e9fbef874b 100644 (file)
@@ -5,6 +5,7 @@
  *   Dietmar Maurer (dietmar@ximian.com)
  *   Zoltan Varga (vargaz@gmail.com)
  *   Paolo Molaro (lupus@ximian.com)
+ *   Johan Lorensson (lateralusx.github@gmail.com)
  *
  * (C) 2002 Ximian, Inc.
  */
@@ -88,6 +89,8 @@
 
 #if defined(TARGET_ASM_APPLE)
 #define AS_INT16_DIRECTIVE ".short"
+#elif defined(TARGET_ASM_GAS) && defined(TARGET_WIN32)
+#define AS_INT16_DIRECTIVE ".word"
 #elif defined(TARGET_ASM_GAS)
 #define AS_INT16_DIRECTIVE ".hword"
 #else
@@ -1735,8 +1738,45 @@ const char *get_label (const char *s)
        return s;
 }
 
+#ifdef TARGET_WIN32
+#define GLOBAL_SYMBOL_DEF_SCL 2
+#define LOCAL_SYMBOL_DEF_SCL 3
+
+static gboolean
+asm_writer_in_data_section (MonoImageWriter *acfg)
+{
+       gboolean        in_data_section = FALSE;
+       const char      *data_sections [] = {".data", ".bss", ".rdata"};
+
+       for (guchar i = 0; i < G_N_ELEMENTS (data_sections); ++i) {
+               if (strcmp (acfg->current_section, data_sections [i]) == 0) {
+                       in_data_section = TRUE;
+                       break;
+               }
+       }
+
+       return in_data_section;
+}
+
+static void
+asm_writer_emit_symbol_type (MonoImageWriter *acfg, const char *name, gboolean func, gboolean global)
+{
+       asm_writer_emit_unset_mode (acfg);
+
+       if (func) {
+               fprintf (acfg->fp, "\t.def %s; .scl %d; .type 32; .endef\n", name, (global == TRUE ? GLOBAL_SYMBOL_DEF_SCL : LOCAL_SYMBOL_DEF_SCL));
+       } else {
+               if (!asm_writer_in_data_section (acfg))
+                       fprintf (acfg->fp, "\t.data\n");
+       }
+
+       return;
+}
+
+#else
+
 static void
-asm_writer_emit_symbol_type (MonoImageWriter *acfg, const char *name, gboolean func)
+asm_writer_emit_symbol_type (MonoImageWriter *acfg, const char *name, gboolean func, gboolean global)
 {
        const char *stype;
 
@@ -1749,17 +1789,13 @@ asm_writer_emit_symbol_type (MonoImageWriter *acfg, const char *name, gboolean f
 
 #if defined(TARGET_ASM_APPLE)
 
-#elif defined(TARGET_WIN32)
-       if (func)
-               fprintf (acfg->fp, "\t.def %s; .scl 2; .type 32; .endef\n", name);
-       else
-               fprintf (acfg->fp, "\t.data\n");
 #elif defined(TARGET_ARM)
        fprintf (acfg->fp, "\t.type %s,#%s\n", name, stype);
 #else
        fprintf (acfg->fp, "\t.type %s,@%s\n", name, stype);
 #endif
 }
+#endif /* TARGET_WIN32 */
 
 static void
 asm_writer_emit_global (MonoImageWriter *acfg, const char *name, gboolean func)
@@ -1768,7 +1804,7 @@ asm_writer_emit_global (MonoImageWriter *acfg, const char *name, gboolean func)
 
        fprintf (acfg->fp, "\t.globl %s\n", name);
 
-       asm_writer_emit_symbol_type (acfg, name, func);
+       asm_writer_emit_symbol_type (acfg, name, func, TRUE);
 }
 
 static void
@@ -1780,7 +1816,7 @@ asm_writer_emit_local_symbol (MonoImageWriter *acfg, const char *name, const cha
        fprintf (acfg->fp, "\t.local %s\n", name);
 #endif
 
-       asm_writer_emit_symbol_type (acfg, name, func);
+       asm_writer_emit_symbol_type (acfg, name, func, FALSE);
 }
 
 static void
index abfa1ffe73b3cf93737bc63885693e13034587f3..6a029a65590a31526e41c5368f57432797fae1d8 100644 (file)
@@ -75,6 +75,12 @@ alloc_ireg_mp (MonoCompile *cfg)
        return vreg;
 }
 
+static inline guint32
+alloc_xreg (MonoCompile *cfg)
+{
+       return alloc_ireg (cfg);
+}
+
 static inline guint32
 alloc_dreg (MonoCompile *cfg, MonoStackType stack_type)
 {
@@ -100,11 +106,48 @@ alloc_dreg (MonoCompile *cfg, MonoStackType stack_type)
        }
 }
 
+/*
+ * Macros used to generate intermediate representation macros
+ *
+ * The macros use a `MonoConfig` object as its context, and among other
+ * things it is used to associate instructions with the memory pool with 
+ * it.
+ * 
+ * The macros come in three variations with slightly different
+ * features, the patter is: NEW_OP, EMIT_NEW_OP, MONO_EMIT_NEW_OP,
+ * the differences are as follows:
+ *
+ * `NEW_OP`: these are the basic macros to setup an instruction that is
+ * passed as an argument.
+ *
+ * `EMIT_NEW_OP`: these macros in addition to creating the instruction
+ * add the instruction to the current basic block in the `MonoConfig`
+ * object passed.   Usually these are used when further customization of
+ * the `inst` parameter is desired before the instruction is added to the
+ * MonoConfig current basic block.
+ *
+ * `MONO_EMIT_NEW_OP`: These variations of the instructions are used when
+ * you are merely interested in emitting the instruction into the `MonoConfig`
+ * parameter. 
+ */
 #undef MONO_INST_NEW
 /* 
  * FIXME: zeroing out some fields is not needed with the new IR, but the old 
  * JIT code still uses the left and right fields, so it has to stay.
  */
+
+/*
+ * MONO_INST_NEW: create a new MonoInst instance that is allocated on the MonoConfig pool.
+ *
+ * @cfg: the MonoConfig object that will be used as the context for the 
+ * instruction.
+ * @dest: this is the place where the instance of the `MonoInst` is stored.
+ * @op: the value that should be stored in the MonoInst.opcode field
+ *
+ * This initializes an empty MonoInst that has been nulled out, it is allocated
+ * from the memory pool associated with the MonoConfig, but it is not linked anywhere.
+ * the cil_code is set to the cfg->ip address. 
+ */
 #define MONO_INST_NEW(cfg,dest,op) do {        \
                (dest) = (MonoInst *)mono_mempool_alloc ((cfg)->mempool, sizeof (MonoInst));    \
                (dest)->inst_c0 = (dest)->inst_c1 = 0; \
index d7c6d9a232fe63bbbf3731b6bd6567f2caf676eb..225b9f3b2364fb861618fb8f1b94a6f32a6ea0c8 100644 (file)
@@ -72,10 +72,10 @@ ldvirtfn_internal (MonoObject *obj, MonoMethod *method, gboolean gshared)
        if (gshared && method->is_inflated && mono_method_get_context (method)->method_inst) {
                MonoGenericContext context = { NULL, NULL };
 
-               if (res->klass->generic_class)
-                       context.class_inst = res->klass->generic_class->context.class_inst;
-               else if (res->klass->generic_container)
-                       context.class_inst = res->klass->generic_container->context.class_inst;
+               if (mono_class_is_ginst (res->klass))
+                       context.class_inst = mono_class_get_generic_class (res->klass)->context.class_inst;
+               else if (mono_class_is_gtd (res->klass))
+                       context.class_inst = mono_class_get_generic_container (res->klass)->context.class_inst;
                context.method_inst = mono_method_get_context (method)->method_inst;
 
                res = mono_class_inflate_generic_method_checked (res, &context, &error);
@@ -1108,8 +1108,8 @@ mono_helper_compile_generic_method (MonoObject *obj, MonoMethod *method, gpointe
                return NULL;
        }
        vmethod = mono_object_get_virtual_method (obj, method);
-       g_assert (!vmethod->klass->generic_container);
-       g_assert (!vmethod->klass->generic_class || !vmethod->klass->generic_class->context.class_inst->is_open);
+       g_assert (!mono_class_is_gtd (vmethod->klass));
+       g_assert (!mono_class_is_ginst (vmethod->klass) || !mono_class_get_generic_class (vmethod->klass)->context.class_inst->is_open);
        g_assert (!context->method_inst || !context->method_inst->is_open);
 
        addr = mono_compile_method_checked (vmethod, &error);
@@ -1334,7 +1334,7 @@ constrained_gsharedvt_call_setup (gpointer mp, MonoMethod *cmethod, MonoClass *k
 
        mono_error_init (error);
 
-       if (klass->flags & TYPE_ATTRIBUTE_INTERFACE) {
+       if (mono_class_is_interface (klass)) {
                MonoObject *this_obj;
 
                /* Have to use the receiver's type instead of klass, the receiver is a ref type */
@@ -1352,7 +1352,7 @@ constrained_gsharedvt_call_setup (gpointer mp, MonoMethod *cmethod, MonoClass *k
                mono_class_setup_vtable (klass);
                g_assert (klass->vtable);
                vt_slot = mono_method_get_vtable_slot (cmethod);
-               if (cmethod->klass->flags & TYPE_ATTRIBUTE_INTERFACE) {
+               if (mono_class_is_interface (cmethod->klass)) {
                        iface_offset = mono_class_interface_offset (klass, cmethod->klass);
                        g_assert (iface_offset != -1);
                        vt_slot += iface_offset;
@@ -1608,10 +1608,10 @@ resolve_vcall (MonoVTable *vt, int slot, MonoMethod *imt_method, gpointer *out_a
                else
                        declaring = m;
 
-               if (m->klass->generic_class)
-                       context.class_inst = m->klass->generic_class->context.class_inst;
+               if (mono_class_is_ginst (m->klass))
+                       context.class_inst = mono_class_get_generic_class (m->klass)->context.class_inst;
                else
-                       g_assert (!m->klass->generic_container);
+                       g_assert (!mono_class_is_gtd (m->klass));
 
                generic_virtual = imt_method;
                g_assert (generic_virtual);
@@ -1692,10 +1692,10 @@ mono_resolve_generic_virtual_call (MonoVTable *vt, int slot, MonoMethod *generic
        else
                declaring = m;
 
-       if (m->klass->generic_class)
-               context.class_inst = m->klass->generic_class->context.class_inst;
+       if (mono_class_is_ginst (m->klass))
+               context.class_inst = mono_class_get_generic_class (m->klass)->context.class_inst;
        else
-               g_assert (!m->klass->generic_container);
+               g_assert (!mono_class_is_gtd (m->klass));
 
        g_assert (generic_virtual->is_inflated);
        context.method_inst = ((MonoMethodInflated*)generic_virtual)->context.method_inst;
@@ -1715,7 +1715,7 @@ mono_resolve_generic_virtual_call (MonoVTable *vt, int slot, MonoMethod *generic
 
        /*
         * This wastes memory but the memory usage is bounded since
-        * mono_method_add_generic_virtual_invocation () eventually builds an imt thunk for
+        * mono_method_add_generic_virtual_invocation () eventually builds an imt trampoline for
         * this vtable slot so we are not called any more for this instantiation.
         */
        MonoFtnDesc *ftndesc = mini_create_llvmonly_ftndesc (mono_domain_get (), addr, arg);
@@ -1765,7 +1765,7 @@ mono_resolve_generic_virtual_iface_call (MonoVTable *vt, int imt_slot, MonoMetho
 
        /*
         * This wastes memory but the memory usage is bounded since
-        * mono_method_add_generic_virtual_invocation () eventually builds an imt thunk for
+        * mono_method_add_generic_virtual_invocation () eventually builds an imt trampoline for
         * this vtable slot so we are not called any more for this instantiation.
         */
        MonoFtnDesc *ftndesc = mini_create_llvmonly_ftndesc (mono_domain_get (), addr, arg);
@@ -1924,3 +1924,8 @@ mono_throw_method_access (MonoMethod *callee, MonoMethod *caller)
        g_free (callee_name);
        g_free (caller_name);
 }
+
+void
+mono_dummy_jit_icall (void)
+{
+}
index 319ec902a013c47aaac095493c859aee047d2149..9d8deb26198c77832464ab704408e37ec51115cf 100644 (file)
@@ -226,4 +226,6 @@ double mono_ckfinite (double d);
 
 void mono_throw_method_access (MonoMethod *callee, MonoMethod *caller);
 
+void mono_dummy_jit_icall (void);
+
 #endif /* __MONO_JIT_ICALLS_H__ */
index 287022daad738c08857273cf5d686eb060edc1eb..faadc048ec98457f870f771ca0e919c1f03b7b0d 100644 (file)
@@ -9,6 +9,7 @@
 
 #include "mini.h"
 #include <mono/metadata/debug-helpers.h>
+#include <mono/utils/mono-compiler.h>
 
 #ifndef DISABLE_JIT
 
@@ -512,4 +513,8 @@ mono_linear_scan2 (MonoCompile *cfg, GList *vars, GList *regs, regmask_t *used_m
        g_list_free (inactive);
 }
 
-#endif /* #ifndef DISABLE_JIT */
+#else /* !DISABLE_JIT */
+
+MONO_EMPTY_SOURCE_FILE (linear_scan);
+
+#endif /* !DISABLE_JIT */
index c897893074057b178071b619e5420ae7a36b5b6e..7cc05634123e8b4a78b0d5f3c007578e563b3c1c 100644 (file)
@@ -10,6 +10,7 @@
  */
 
 #include <config.h>
+#include <mono/utils/mono-compiler.h>
 
 #ifndef DISABLE_JIT
 
@@ -1158,4 +1159,8 @@ mono_analyze_liveness_gc (MonoCompile *cfg)
        g_free (vreg_to_varinfo);
 }
 
-#endif /* DISABLE_JIT */
+#else /* !DISABLE_JIT */
+
+MONO_EMPTY_SOURCE_FILE (liveness);
+
+#endif /* !DISABLE_JIT */
index bc57ec67f9219aeb4dac3df784fb37820d4d931b..d8f62355b8ef1ecc69e4195fb804ef1f305fa687 100644 (file)
@@ -14,6 +14,8 @@
  */
 
 #include <config.h>
+#include <mono/utils/mono-compiler.h>
+
 #ifndef DISABLE_JIT
 
 #include <string.h>
@@ -171,6 +173,8 @@ mono_strength_reduction_division (MonoCompile *cfg, MonoInst *ins)
                                ins->inst_imm = power2;
                                break;
                        }
+                       if (cfg->backend->disable_div_with_mul)
+                               break;
                        allocated_vregs = TRUE;
                        /*
                         * Replacement of unsigned division with multiplication,
@@ -243,6 +247,8 @@ mono_strength_reduction_division (MonoCompile *cfg, MonoInst *ins)
                                break;
                        }
 
+                       if (cfg->backend->disable_div_with_mul)
+                               break;
                        /*
                         * Replacement of signed division with multiplication,
                         * shifts and additions Hacker's Delight, chapter 10-6.
@@ -362,7 +368,8 @@ mono_strength_reduction_ins (MonoCompile *cfg, MonoInst *ins, const char **spec)
        }
        case OP_IDIV_UN_IMM:
        case OP_IDIV_IMM: {
-               allocated_vregs = mono_strength_reduction_division (cfg, ins);
+               if (!COMPILE_LLVM (cfg))
+                       allocated_vregs = mono_strength_reduction_division (cfg, ins);
                break;
        }
 #if SIZEOF_REGISTER == 8
@@ -634,13 +641,15 @@ mono_local_cprop (MonoCompile *cfg)
                                /* FIXME: Make is_inst_imm a macro */
                                /* FIXME: Make is_inst_imm take an opcode argument */
                                /* is_inst_imm is only needed for binops */
-                               if ((((def->opcode == OP_ICONST) || ((sizeof (gpointer) == 8) && (def->opcode == OP_I8CONST))) &&
+                               if ((((def->opcode == OP_ICONST) || ((sizeof (gpointer) == 8) && (def->opcode == OP_I8CONST)) || (def->opcode == OP_PCONST)) &&
                                         (((srcindex == 0) && (ins->sreg2 == -1)) || mono_arch_is_inst_imm (def->inst_c0))) || 
                                        (!MONO_ARCH_USE_FPSTACK && (def->opcode == OP_R8CONST))) {
                                        guint32 opcode2;
 
                                        /* srcindex == 1 -> binop, ins->sreg2 == -1 -> unop */
-                                       if ((srcindex == 1) && (ins->sreg1 != -1) && defs [ins->sreg1] && (defs [ins->sreg1]->opcode == OP_ICONST) && defs [ins->sreg2]) {
+                                       if ((srcindex == 1) && (ins->sreg1 != -1) && defs [ins->sreg1] &&
+                                               ((defs [ins->sreg1]->opcode == OP_ICONST) || defs [ins->sreg1]->opcode == OP_PCONST) &&
+                                               defs [ins->sreg2]) {
                                                /* Both arguments are constants, perform cfold */
                                                mono_constant_fold_ins (cfg, ins, defs [ins->sreg1], defs [ins->sreg2], TRUE);
                                        } else if ((srcindex == 0) && (ins->sreg2 != -1) && defs [ins->sreg2]) {
@@ -732,6 +741,9 @@ mono_local_cprop (MonoCompile *cfg)
                                        dummy_arg1.inst_c0 = 1;
 
                                        mono_constant_fold_ins (cfg, ins, &dummy_arg1, NULL, TRUE);
+                               } else if (srcindex == 0 && ins->opcode == OP_COMPARE && defs [ins->sreg1]->opcode == OP_PCONST && defs [ins->sreg2] && defs [ins->sreg2]->opcode == OP_PCONST) {
+                                       /* typeof(T) == typeof(..) */
+                                       mono_constant_fold_ins (cfg, ins, defs [ins->sreg1], defs [ins->sreg2], TRUE);
                                }
                        }
 
@@ -997,4 +1009,8 @@ mono_local_deadce (MonoCompile *cfg)
        //mono_print_code (cfg, "AFTER LOCAL-DEADCE");
 }
 
-#endif /* DISABLE_JIT */
+#else /* !DISABLE_JIT */
+
+MONO_EMPTY_SOURCE_FILE (local_propagation);
+
+#endif /* !DISABLE_JIT */
index 1f9ffcf5d467b12f6b2ad89fdeadc57725db4b7d..80044897a83e48a34caee27a8aa05d1a92e74edc 100644 (file)
@@ -1,7 +1,24 @@
+/*
+ * main.c: The main entry point for the mono executable
+ *
+ * The main entry point does a few things:
+ * 
+ *   * It probes whether the executable has a bundle appended
+ *     at the end, and if so, registers the various bundled
+ *     resources with Mono and executes the contained bundle
+ *
+ *   * Parses the MONO_ENV_OPTIONS variable to treat the
+ *     contents of the variable as command line arguments for
+ *     the mono runtime
+ *
+ *   * Launches Mono, by calling mono_main.
+ */
 #include <config.h>
 #include <fcntl.h>
 #include <mono/metadata/assembly.h>
+#include <mono/metadata/mono-config.h>
 #include <mono/utils/mono-mmap.h>
+#include <mono/utils/mono-dl.h>
 #include "mini.h"
 
 #ifdef HAVE_UNISTD_H
@@ -28,8 +45,143 @@ mono_main_with_options (int argc, char *argv [])
        return mono_main (argc, argv);
 }
 
-#define STREAM_INT(x) (*(uint32_t*)x)
-#define STREAM_LONG(x) (*(uint64_t*)x)
+/*
+ * The Mono executable can initialize itself from a payload attached
+ * at the end of the main program.   The payload contains the
+ * main assembly, one or more managed assemblies, configuration
+ * files and other assets that are used instead of launching a
+ * program from the command line.
+ *
+ * The startup sequence probes for a magical signature at the end of
+ * the executable, if the 16 characters "xmonkeysloveplay" are found,
+ * the code expects the 64-bits just before it to contain an offset
+ * within the executable with a directory of assets.
+ *
+ * All pointers in the file format are encoded as little-endian values
+ *
+ * The format of the file is thus:
+ *
+ * Location        Content
+ * --------        -------
+ * lenght-16       Optional "xmonkeysloveplay", indicating that a
+ *                 bundled payload is contained in the executable.
+ * length-24       pointer to the directory in the file, address DIR
+ *
+ * DIR             32-bit value with the number of entries in the directory
+ * DIR+4           First directory entry.
+ *
+ * Each directory entry is made up of:
+ * 4-bytes         uint32_t containing the size of a string (STR)
+ * STRING          UTF8 encoded and \0 terminated string
+ * 8-bytes         uint64_t offset in the file with the payload associated with STRING
+ * 4-bytes         uint32_t size of the asset
+ *
+ * The following are the known directory entries, without the quotes:
+ * "assembly:NAME"  An assembly with the name NAME, assembly is in the payload
+ * "config:NAME"    A configuration file (usually file.dll.config) in the payload that is
+ *                  loaded as the config file for an assembly
+ * "systemconfig:"  Treats as a Mono system configuration, payload contains the config file.
+ * "options:"       The payload contains command line options to initialize Mono, as if you 
+                    had set them on MONO_ENV_OPTIONS
+ * "config_dir:DIR" Configures the MONO_PATH to point to point to DIR
+ * "machineconfig:" The payload contains the machine.config file to use at runtime
+ * "env:"           Sets the environment variable to the value encoded in the payload
+ *                  payload contains: 1-byte lenght for the \0 terminated variable,
+ *                  followed by the value.
+ * "library:NAME"   Bundled dynamic library NAME, payload contains the dynamic library
+ */
+#define STREAM_INT(x) GUINT32_TO_LE((*(uint32_t*)x))
+#define STREAM_LONG(x) GUINT64_TO_LE((*(uint64_t*)x))
+
+/**
+ * Loads a chunk of data from the file pointed to by the
+ * @fd starting at the file offset @offset for @size bytes
+ * and returns an allocated version of that string, or NULL
+ * on error.
+ */
+static char *
+load_from_region (int fd, uint64_t offset, uint64_t size)
+{
+       char *buffer;
+       off_t loc;
+       int status;
+       
+       do {
+               loc = lseek (fd, offset, SEEK_SET);
+       } while (loc == -1 && errno == EINTR);
+       if (loc == -1)
+               return NULL;
+       buffer = g_malloc (size + 1);
+       if (buffer == NULL)
+               return NULL;
+       buffer [size] = 0;
+       do {
+               status = read (fd, buffer, size);
+       } while (status == -1 && errno == EINTR);
+       if (status == -1){
+               g_free (buffer);
+               return NULL;
+       }
+       return buffer;
+}
+
+/* Did we initialize the temporary directory for dynamic libraries */
+static int bundle_save_library_initialized;
+
+/* List of bundled libraries we unpacked */
+static GSList *bundle_library_paths;
+
+/* Directory where we unpacked dynamic libraries */
+static char *bundled_dylibrary_directory;
+
+static void
+delete_bundled_libraries ()
+{
+       GSList *list;
+
+       for (list = bundle_library_paths; list != NULL; list = list->next){
+               unlink (list->data);
+       }
+       rmdir (bundled_dylibrary_directory);
+}
+
+static void
+bundle_save_library_initialize ()
+{
+       bundle_save_library_initialized = 1;
+       char *path = g_build_filename (g_get_tmp_dir (), "mono-bundle-XXXXXX", NULL);
+       bundled_dylibrary_directory = g_mkdtemp (path);
+       g_free (path);
+       if (bundled_dylibrary_directory == NULL)
+               return;
+       atexit (delete_bundled_libraries);
+}
+
+static void
+save_library (int fd, uint64_t offset, uint64_t size, const char *destfname)
+{
+       MonoDl *lib;
+       char *file, *buffer, *err, *internal_path;
+       if (!bundle_save_library_initialized)
+               bundle_save_library_initialize ();
+       
+       file = g_build_filename (bundled_dylibrary_directory, destfname, NULL);
+       buffer = load_from_region (fd, offset, size);
+       g_file_set_contents (file, buffer, size, NULL);
+
+       lib = mono_dl_open (file, MONO_DL_LAZY, &err);
+       if (lib == NULL){
+               fprintf (stderr, "Error loading shared library: %s %s\n", file, err);
+               exit (1);
+       }
+       // Register the name with "." as this is how it will be found when embedded
+       internal_path = g_build_filename (".", destfname, NULL);
+       mono_loader_register_module (internal_path, lib);
+       g_free (internal_path);
+       bundle_library_paths = g_slist_append (bundle_library_paths, file);
+       
+       g_free (buffer);
+}
 
 static gboolean
 probe_embedded (const char *program, int *ref_argc, char **ref_argv [])
@@ -103,25 +255,35 @@ probe_embedded (const char *program, int *ref_argc, char **ref_argv [])
                        char *config = kind + strlen ("config:");
                        char *aname = g_strdup (config);
                        aname [strlen(aname)-strlen(".config")] = 0;
-                       mono_register_config_for_assembly (aname, config);
-               } else if (strncmp (kind, "system_config:", strlen ("system_config:")) == 0){
-                       printf ("TODO s-Found: %s %llx\n", kind, (long long)offset);
+                       mono_register_config_for_assembly (aname, load_from_region (fd, offset, item_size));
+               } else if (strncmp (kind, "systemconfig:", strlen ("systemconfig:")) == 0){
+                       mono_config_parse_memory (load_from_region (fd, offset, item_size));
                } else if (strncmp (kind, "options:", strlen ("options:")) == 0){
-                       mono_parse_options_from (kind + strlen("options:"), ref_argc, ref_argv);
+                       mono_parse_options_from (load_from_region (fd, offset, item_size), ref_argc, ref_argv);
                } else if (strncmp (kind, "config_dir:", strlen ("config_dir:")) == 0){
-                       printf ("TODO Found: %s %llx\n", kind, (long long)offset);
+                       mono_set_dirs (getenv ("MONO_PATH"), load_from_region (fd, offset, item_size));
+               } else if (strncmp (kind, "machineconfig:", strlen ("machineconfig:")) == 0) {
+                       mono_register_machine_config (load_from_region (fd, offset, item_size));
+               } else if (strncmp (kind, "env:", strlen ("env:")) == 0){
+                       char *data = load_from_region (fd, offset, item_size);
+                       uint8_t count = *data++;
+                       char *value = data + count + 1;
+                       g_setenv (data, value, FALSE);
+               } else if (strncmp (kind, "library:", strlen ("library:")) == 0){
+                       save_library (fd, offset, item_size, kind + strlen ("library:"));
                } else {
                        fprintf (stderr, "Unknown stream on embedded package: %s\n", kind);
                        exit (1);
                }
        }
        g_array_append_val (assemblies, last);
-       
+
        mono_register_bundled_assemblies ((const MonoBundledAssembly **) assemblies->data);
        new_argv = g_new (char *, (*ref_argc)+1);
-       for (j = 0; j < *ref_argc; j++)
-               new_argv [j] = (*ref_argv)[j];
-       new_argv [j] = entry_point;
+       new_argv [0] = (*ref_argv)[0];
+       new_argv [1] = entry_point;
+       for (j = 1; j < *ref_argc; j++)
+               new_argv [j+1] = (*ref_argv)[j];
        *ref_argv = new_argv;
        (*ref_argc)++;
        
index 386a319cc50234118d4e32d940a370c1d0833609..da35e44bb2a1fe6c2ad49f00b7712356af9cc4fd 100644 (file)
@@ -12,6 +12,7 @@
  */
 
 #include <config.h>
+#include <mono/utils/mono-compiler.h>
 
 #ifndef DISABLE_JIT
 
@@ -154,8 +155,7 @@ emit_llvmonly_virtual_call (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSig
 /* helper methods signatures */
 static MonoMethodSignature *helper_sig_domain_get;
 static MonoMethodSignature *helper_sig_rgctx_lazy_fetch_trampoline;
-static MonoMethodSignature *helper_sig_llvmonly_imt_thunk;
-
+static MonoMethodSignature *helper_sig_llvmonly_imt_trampoline;
 
 /* type loading helpers */
 static GENERATE_GET_CLASS_WITH_CACHE (runtime_helpers, System.Runtime.CompilerServices, RuntimeHelpers)
@@ -364,7 +364,7 @@ mono_create_helper_signatures (void)
 {
        helper_sig_domain_get = mono_create_icall_signature ("ptr");
        helper_sig_rgctx_lazy_fetch_trampoline = mono_create_icall_signature ("ptr ptr");
-       helper_sig_llvmonly_imt_thunk = mono_create_icall_signature ("ptr ptr ptr");
+       helper_sig_llvmonly_imt_trampoline = mono_create_icall_signature ("ptr ptr ptr");
 }
 
 static MONO_NEVER_INLINE void
@@ -1658,7 +1658,7 @@ mini_emit_max_iid_check_vtable (MonoCompile *cfg, int vtable_reg, MonoClass *kla
 {
        int max_iid_reg = alloc_preg (cfg);
                
-       MONO_EMIT_NEW_LOAD_MEMBASE_OP (cfg, OP_LOADU2_MEMBASE, max_iid_reg, vtable_reg, MONO_STRUCT_OFFSET (MonoVTable, max_interface_id));
+       MONO_EMIT_NEW_LOAD_MEMBASE_OP (cfg, OP_LOADU4_MEMBASE, max_iid_reg, vtable_reg, MONO_STRUCT_OFFSET (MonoVTable, max_interface_id));
        mini_emit_max_iid_check (cfg, max_iid_reg, klass, false_target);
 }
 
@@ -1669,7 +1669,7 @@ mini_emit_max_iid_check_class (MonoCompile *cfg, int klass_reg, MonoClass *klass
 {
        int max_iid_reg = alloc_preg (cfg);
 
-       MONO_EMIT_NEW_LOAD_MEMBASE_OP (cfg, OP_LOADU2_MEMBASE, max_iid_reg, klass_reg, MONO_STRUCT_OFFSET (MonoClass, max_interface_id));
+       MONO_EMIT_NEW_LOAD_MEMBASE_OP (cfg, OP_LOADU4_MEMBASE, max_iid_reg, klass_reg, MONO_STRUCT_OFFSET (MonoClass, max_interface_id));
        mini_emit_max_iid_check (cfg, max_iid_reg, klass, false_target);
 }
 
@@ -1795,7 +1795,7 @@ mini_emit_castclass_inst (MonoCompile *cfg, int obj_reg, int klass_reg, MonoClas
                        mini_emit_class_check (cfg, eclass_reg, mono_defaults.enum_class);
                } else if (klass->cast_class == mono_defaults.enum_class) {
                        mini_emit_class_check (cfg, eclass_reg, mono_defaults.enum_class);
-               } else if (klass->cast_class->flags & TYPE_ATTRIBUTE_INTERFACE) {
+               } else if (mono_class_is_interface (klass->cast_class)) {
                        mini_emit_iface_class_cast (cfg, eclass_reg, klass->cast_class, NULL, NULL);
                } else {
                        // Pass -1 as obj_reg to skip the check below for arrays of arrays
@@ -2551,7 +2551,7 @@ check_method_sharing (MonoCompile *cfg, MonoMethod *cmethod, gboolean *out_pass_
        gboolean pass_mrgctx = FALSE;
 
        if (((cmethod->flags & METHOD_ATTRIBUTE_STATIC) || cmethod->klass->valuetype) &&
-               (cmethod->klass->generic_class || cmethod->klass->generic_container)) {
+               (mono_class_is_ginst (cmethod->klass) || mono_class_is_gtd (cmethod->klass))) {
                gboolean sharable = FALSE;
 
                if (mono_method_is_generic_sharable_full (cmethod, TRUE, TRUE, TRUE))
@@ -2792,7 +2792,7 @@ mono_emit_method_call_full (MonoCompile *cfg, MonoMethod *method, MonoMethodSign
        if (!sig)
                sig = mono_method_signature (method);
 
-       if (cfg->llvm_only && (method->klass->flags & TYPE_ATTRIBUTE_INTERFACE))
+       if (cfg->llvm_only && (mono_class_is_interface (method->klass)))
                g_assert_not_reached ();
 
        if (rgctx_arg) {
@@ -2830,7 +2830,7 @@ mono_emit_method_call_full (MonoCompile *cfg, MonoMethod *method, MonoMethodSign
        if (cfg->llvm_only && !call_target && virtual_ && (method->flags & METHOD_ATTRIBUTE_VIRTUAL))
                return emit_llvmonly_virtual_call (cfg, method, sig, 0, args);
 
-       need_unbox_trampoline = method->klass == mono_defaults.object_class || (method->klass->flags & TYPE_ATTRIBUTE_INTERFACE);
+       need_unbox_trampoline = method->klass == mono_defaults.object_class || mono_class_is_interface (method->klass);
 
        call = mono_emit_call_args (cfg, sig, args, FALSE, virtual_, tail, rgctx_arg ? TRUE : FALSE, need_unbox_trampoline);
 
@@ -2919,7 +2919,7 @@ mono_emit_method_call_full (MonoCompile *cfg, MonoMethod *method, MonoMethodSign
                } else {
                        vtable_reg = alloc_preg (cfg);
                        MONO_EMIT_NEW_LOAD_MEMBASE_FAULT (cfg, vtable_reg, this_reg, MONO_STRUCT_OFFSET (MonoObject, vtable));
-                       if (method->klass->flags & TYPE_ATTRIBUTE_INTERFACE) {
+                       if (mono_class_is_interface (method->klass)) {
                                guint32 imt_slot = mono_method_get_imt_slot (method);
                                emit_imt_argument (cfg, call, call->method, imt_arg);
                                slot_reg = vtable_reg;
@@ -4259,7 +4259,7 @@ handle_alloc (MonoCompile *cfg, MonoClass *klass, gboolean for_box, int context_
                EMIT_NEW_CLASSCONST (cfg, iargs [1], klass);
 
                alloc_ftn = ves_icall_object_new;
-       } else if (cfg->compile_aot && cfg->cbb->out_of_line && klass->type_token && klass->image == mono_defaults.corlib && !klass->generic_class) {
+       } else if (cfg->compile_aot && cfg->cbb->out_of_line && klass->type_token && klass->image == mono_defaults.corlib && !mono_class_is_ginst (klass)) {
                /* This happens often in argument checking code, eg. throw new FooException... */
                /* Avoid relocations and save some space by calling a helper function specialized to mscorlib */
                EMIT_NEW_ICONST (cfg, iargs [0], mono_metadata_token_index (klass->type_token));
@@ -4433,11 +4433,11 @@ mini_class_has_reference_variant_generic_argument (MonoCompile *cfg, MonoClass *
        MonoGenericContainer *container;
        MonoGenericInst *ginst;
 
-       if (klass->generic_class) {
-               container = klass->generic_class->container_class->generic_container;
-               ginst = klass->generic_class->context.class_inst;
-       } else if (klass->generic_container && context_used) {
-               container = klass->generic_container;
+       if (mono_class_is_ginst (klass)) {
+               container = mono_class_get_generic_container (mono_class_get_generic_class (klass)->container_class);
+               ginst = mono_class_get_generic_class (klass)->context.class_inst;
+       } else if (mono_class_is_gtd (klass) && context_used) {
+               container = mono_class_get_generic_container (klass);
                ginst = container->context.class_inst;
        } else {
                return FALSE;
@@ -4486,7 +4486,17 @@ icall_is_direct_callable (MonoCompile *cfg, MonoMethod *cmethod)
        return FALSE;
 }
 
-#define is_complex_isinst(klass) ((klass->flags & TYPE_ATTRIBUTE_INTERFACE) || klass->rank || mono_class_is_nullable (klass) || mono_class_is_marshalbyref (klass) || (klass->flags & TYPE_ATTRIBUTE_SEALED) || klass->byval_arg.type == MONO_TYPE_VAR || klass->byval_arg.type == MONO_TYPE_MVAR)
+static gboolean
+method_needs_stack_walk (MonoCompile *cfg, MonoMethod *cmethod)
+{
+       if (cmethod->klass == mono_defaults.systemtype_class) {
+               if (!strcmp (cmethod->name, "GetType"))
+                       return TRUE;
+       }
+       return FALSE;
+}
+
+#define is_complex_isinst(klass) (mono_class_is_interface (klass) || klass->rank || mono_class_is_nullable (klass) || mono_class_is_marshalbyref (klass) || mono_class_is_sealed (klass) || klass->byval_arg.type == MONO_TYPE_VAR || klass->byval_arg.type == MONO_TYPE_MVAR)
 
 static MonoInst*
 emit_isinst_with_cache (MonoCompile *cfg, MonoClass *klass, MonoInst **args)
@@ -4563,7 +4573,7 @@ handle_castclass (MonoCompile *cfg, MonoClass *klass, MonoInst *src, int context
        int vtable_reg = alloc_preg (cfg);
        MonoInst *klass_inst = NULL;
 
-       if (src->opcode == OP_PCONST && src->inst_p0 == 0)
+       if (MONO_INS_IS_PCONST_NULL (src))
                return src;
 
        if (context_used) {
@@ -4596,7 +4606,7 @@ handle_castclass (MonoCompile *cfg, MonoClass *klass, MonoInst *src, int context
 
        save_cast_details (cfg, klass, obj_reg, FALSE);
 
-       if (klass->flags & TYPE_ATTRIBUTE_INTERFACE) {
+       if (mono_class_is_interface (klass)) {
                MONO_EMIT_NEW_LOAD_MEMBASE (cfg, vtable_reg, obj_reg, MONO_STRUCT_OFFSET (MonoObject, vtable));
                mini_emit_iface_cast (cfg, vtable_reg, klass, NULL, NULL);
        } else {
@@ -4604,7 +4614,7 @@ handle_castclass (MonoCompile *cfg, MonoClass *klass, MonoInst *src, int context
 
                MONO_EMIT_NEW_LOAD_MEMBASE (cfg, vtable_reg, obj_reg, MONO_STRUCT_OFFSET (MonoObject, vtable));
 
-               if (!klass->rank && !cfg->compile_aot && !(cfg->opt & MONO_OPT_SHARED) && (klass->flags & TYPE_ATTRIBUTE_SEALED)) {
+               if (!klass->rank && !cfg->compile_aot && !(cfg->opt & MONO_OPT_SHARED) && mono_class_is_sealed (klass)) {
                        /* the remoting code is broken, access the class for now */
                        if (0) { /*FIXME what exactly is broken? This change refers to r39380 from 2005 and mention some remoting fixes were due.*/
                                MonoVTable *vt = mono_class_vtable (cfg->domain, klass);
@@ -4677,7 +4687,7 @@ handle_isinst (MonoCompile *cfg, MonoClass *klass, MonoInst *src, int context_us
 
        MONO_EMIT_NEW_LOAD_MEMBASE (cfg, vtable_reg, obj_reg, MONO_STRUCT_OFFSET (MonoObject, vtable));
 
-       if (klass->flags & TYPE_ATTRIBUTE_INTERFACE) {
+       if (mono_class_is_interface (klass)) {
                g_assert (!context_used);
                /* the is_null_bb target simply copies the input register to the output */
                mini_emit_iface_cast (cfg, vtable_reg, klass, false_bb, is_null_bb);
@@ -4707,7 +4717,7 @@ handle_isinst (MonoCompile *cfg, MonoClass *klass, MonoInst *src, int context_us
                        } else if (klass->cast_class == mono_defaults.enum_class) {
                                mini_emit_class_check_branch (cfg, eclass_reg, mono_defaults.enum_class, OP_PBEQ, is_null_bb);
                                MONO_EMIT_NEW_BRANCH_BLOCK (cfg, OP_BR, false_bb);
-                       } else if (klass->cast_class->flags & TYPE_ATTRIBUTE_INTERFACE) {
+                       } else if (mono_class_is_interface (klass->cast_class)) {
                                mini_emit_iface_class_cast (cfg, eclass_reg, klass->cast_class, false_bb, is_null_bb);
                        } else {
                                if ((klass->rank == 1) && (klass->byval_arg.type == MONO_TYPE_SZARRAY)) {
@@ -4727,7 +4737,7 @@ handle_isinst (MonoCompile *cfg, MonoClass *klass, MonoInst *src, int context_us
                        /* the is_null_bb target simply copies the input register to the output */
                        mini_emit_isninst_cast (cfg, klass_reg, klass->cast_class, false_bb, is_null_bb);
                } else {
-                       if (!cfg->compile_aot && !(cfg->opt & MONO_OPT_SHARED) && (klass->flags & TYPE_ATTRIBUTE_SEALED)) {
+                       if (!cfg->compile_aot && !(cfg->opt & MONO_OPT_SHARED) && mono_class_is_sealed (klass)) {
                                g_assert (!context_used);
                                /* the remoting code is broken, access the class for now */
                                if (0) {/*FIXME what exactly is broken? This change refers to r39380 from 2005 and mention some remoting fixes were due.*/
@@ -4796,7 +4806,7 @@ handle_cisinst (MonoCompile *cfg, MonoClass *klass, MonoInst *src)
        MONO_EMIT_NEW_BIALU_IMM (cfg, OP_COMPARE_IMM, -1, obj_reg, 0);
        MONO_EMIT_NEW_BRANCH_BLOCK (cfg, OP_PBEQ, false_bb);
 
-       if (klass->flags & TYPE_ATTRIBUTE_INTERFACE) {
+       if (mono_class_is_interface (klass)) {
 #ifndef DISABLE_REMOTING
                NEW_BBLOCK (cfg, interface_fail_bb);
 #endif
@@ -4900,7 +4910,7 @@ handle_ccastclass (MonoCompile *cfg, MonoClass *klass, MonoInst *src)
 
        save_cast_details (cfg, klass, obj_reg, FALSE);
 
-       if (klass->flags & TYPE_ATTRIBUTE_INTERFACE) {
+       if (mono_class_is_interface (klass)) {
 #ifndef DISABLE_REMOTING
                NEW_BBLOCK (cfg, interface_fail_bb);
        
@@ -5047,7 +5057,7 @@ handle_delegate_ctor (MonoCompile *cfg, MonoClass *klass, MonoInst *target, Mono
 
        /* Set target field */
        /* Optimize away setting of NULL target */
-       if (!(target->opcode == OP_PCONST && target->inst_p0 == 0)) {
+       if (!MONO_INS_IS_PCONST_NULL (target)) {
                MONO_EMIT_NEW_STORE_MEMBASE (cfg, OP_STORE_MEMBASE_REG, obj->dreg, MONO_STRUCT_OFFSET (MonoDelegate, target), target->dreg);
                if (cfg->gen_write_barriers) {
                        dreg = alloc_preg (cfg);
@@ -5177,7 +5187,7 @@ handle_constrained_gsharedvt_call (MonoCompile *cfg, MonoMethod *cmethod, MonoMe
         * This is hard to do with the current call code, since we would have to emit a branch and two different calls. So instead, we
         * pack the arguments into an array, and do the rest of the work in in an icall.
         */
-       if (((cmethod->klass == mono_defaults.object_class) || (cmethod->klass->flags & TYPE_ATTRIBUTE_INTERFACE) || (!cmethod->klass->valuetype && cmethod->klass->image != mono_defaults.corlib)) &&
+       if (((cmethod->klass == mono_defaults.object_class) || mono_class_is_interface (cmethod->klass) || (!cmethod->klass->valuetype && cmethod->klass->image != mono_defaults.corlib)) &&
                (MONO_TYPE_IS_VOID (fsig->ret) || MONO_TYPE_IS_PRIMITIVE (fsig->ret) || MONO_TYPE_IS_REFERENCE (fsig->ret) || MONO_TYPE_ISSTRUCT (fsig->ret) || mini_is_gsharedvt_type (fsig->ret)) &&
                (fsig->param_count == 0 || (!fsig->hasthis && fsig->param_count == 1) || (fsig->param_count == 1 && (MONO_TYPE_IS_REFERENCE (fsig->params [0]) || fsig->params [0]->byref || mini_is_gsharedvt_type (fsig->params [0]))))) {
                MonoInst *args [16];
@@ -5350,7 +5360,7 @@ mono_method_check_inlining (MonoCompile *cfg, MonoMethod *method)
                                        return FALSE;
                                }
                        }
-               } else if (method->klass->flags & TYPE_ATTRIBUTE_BEFORE_FIELD_INIT) {
+               } else if (mono_class_is_before_field_init (method->klass)) {
                        if (cfg->run_cctors && method->klass->has_cctor) {
                                /*FIXME it would easier and lazier to just use mono_class_try_get_vtable */
                                if (!method->klass->runtime_info)
@@ -5386,7 +5396,7 @@ mono_method_check_inlining (MonoCompile *cfg, MonoMethod *method)
                 * the cctor will need to be run at aot method load time, for example,
                 * or at the end of the compilation of the inlining method.
                 */
-               if (mono_class_needs_cctor_run (method->klass, NULL) && !((method->klass->flags & TYPE_ATTRIBUTE_BEFORE_FIELD_INIT)))
+               if (mono_class_needs_cctor_run (method->klass, NULL) && !mono_class_is_before_field_init (method->klass))
                        return FALSE;
        }
 
@@ -5416,7 +5426,7 @@ mini_field_access_needs_cctor_run (MonoCompile *cfg, MonoMethod *method, MonoCla
                        return FALSE;
        }
 
-       if (klass->flags & TYPE_ATTRIBUTE_BEFORE_FIELD_INIT) {
+       if (mono_class_is_before_field_init (klass)) {
                if (cfg->method == method)
                        return FALSE;
        }
@@ -5431,7 +5441,7 @@ mini_field_access_needs_cctor_run (MonoCompile *cfg, MonoMethod *method, MonoCla
        return TRUE;
 }
 
-static MonoInst*
+MonoInst*
 mini_emit_ldelema_1_ins (MonoCompile *cfg, MonoClass *klass, MonoInst *arr, MonoInst *index, gboolean bcheck)
 {
        MonoInst *ins;
@@ -5669,7 +5679,7 @@ emit_array_generic_access (MonoCompile *cfg, MonoMethodSignature *fsig, MonoInst
        if (is_set) {
                EMIT_NEW_LOAD_MEMBASE_TYPE (cfg, load, &eklass->byval_arg, args [2]->dreg, 0);
                EMIT_NEW_STORE_MEMBASE_TYPE (cfg, store, &eklass->byval_arg, addr->dreg, 0, load->dreg);
-               if (mini_type_is_reference (fsig->params [2]))
+               if (mini_type_is_reference (&eklass->byval_arg))
                        emit_write_barrier (cfg, addr, load);
        } else {
                EMIT_NEW_LOAD_MEMBASE_TYPE (cfg, load, &eklass->byval_arg, addr->dreg, 0);
@@ -5689,7 +5699,7 @@ static MonoInst*
 emit_array_store (MonoCompile *cfg, MonoClass *klass, MonoInst **sp, gboolean safety_checks)
 {
        if (safety_checks && generic_class_is_reference_type (cfg, klass) &&
-               !(sp [2]->opcode == OP_PCONST && sp [2]->inst_p0 == NULL)) {
+               !(MONO_INS_IS_PCONST_NULL (sp [2]))) {
                MonoClass *obj_array = mono_array_class_get_cached (mono_defaults.object_class, 1);
                MonoMethod *helper = mono_marshal_get_virtual_stelemref (obj_array);
                MonoInst *iargs [3];
@@ -6116,8 +6126,13 @@ mini_emit_inst_for_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSign
                        return NULL;
        } else if (cmethod->klass == mono_defaults.monitor_class) {
                gboolean is_enter = FALSE;
+               gboolean is_v4 = FALSE;
 
-               if (!strcmp (cmethod->name, "Enter") && mono_method_signature (cmethod)->param_count == 1)
+               if (!strcmp (cmethod->name, "Enter") && fsig->param_count == 2 && fsig->params [1]->byref) {
+                       is_enter = TRUE;
+                       is_v4 = TRUE;
+               }
+               if (!strcmp (cmethod->name, "Enter") && fsig->param_count == 1)
                        is_enter = TRUE;
 
                if (is_enter) {
@@ -6129,10 +6144,10 @@ mini_emit_inst_for_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSign
 
                        NEW_BBLOCK (cfg, end_bb);
 
-                       ins = mono_emit_jit_icall (cfg, (gpointer)mono_monitor_enter_fast, args);
+                       ins = mono_emit_jit_icall (cfg, is_v4 ? (gpointer)mono_monitor_enter_v4_fast : (gpointer)mono_monitor_enter_fast, args);
                        MONO_EMIT_NEW_BIALU_IMM (cfg, OP_ICOMPARE_IMM, -1, ins->dreg, 0);
                        MONO_EMIT_NEW_BRANCH_BLOCK (cfg, OP_IBNE_UN, end_bb);
-                       ins = mono_emit_jit_icall (cfg, (gpointer)mono_monitor_enter, args);
+                       ins = mono_emit_jit_icall (cfg, is_v4 ? (gpointer)mono_monitor_enter_v4 : (gpointer)mono_monitor_enter, args);
                        MONO_START_BB (cfg, end_bb);
                        return ins;
                }
@@ -6794,6 +6809,13 @@ mini_emit_inst_for_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSign
                 * all inputs:
                 * http://everything2.com/?node_id=1051618
                 */
+       } else if (cmethod->klass == mono_defaults.systemtype_class && !strcmp (cmethod->name, "op_Equality")) {
+               EMIT_NEW_BIALU (cfg, ins, OP_COMPARE, -1, args [0]->dreg, args [1]->dreg);
+               MONO_INST_NEW (cfg, ins, OP_PCEQ);
+               ins->dreg = alloc_preg (cfg);
+               ins->type = STACK_I4;
+               MONO_ADD_INS (cfg->cbb, ins);
+               return ins;
        } else if (((!strcmp (cmethod->klass->image->assembly->aname.name, "MonoMac") ||
                    !strcmp (cmethod->klass->image->assembly->aname.name, "monotouch")) &&
                                !strcmp (cmethod->klass->name_space, "XamCore.ObjCRuntime") &&
@@ -7062,11 +7084,11 @@ emit_init_local (MonoCompile *cfg, int local, MonoType *type, gboolean init)
 /*
  * inline_method:
  *
- *   Return the cost of inlining CMETHOD.
+ * Return the cost of inlining CMETHOD, or zero if it should not be inlined.
  */
 static int
 inline_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig, MonoInst **sp,
-                          guchar *ip, guint real_offset, gboolean inline_always)
+              guchar *ip, guint real_offset, gboolean inline_always)
 {
        MonoError error;
        MonoInst *ins, *rvar = NULL;
@@ -7702,7 +7724,7 @@ emit_llvmonly_virtual_call (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSig
        MonoInst *icall_args [16];
        MonoInst *call_target, *ins, *vtable_ins;
        int arg_reg, this_reg, vtable_reg;
-       gboolean is_iface = cmethod->klass->flags & TYPE_ATTRIBUTE_INTERFACE;
+       gboolean is_iface = mono_class_is_interface (cmethod->klass);
        gboolean is_gsharedvt = cfg->gsharedvt && mini_is_gsharedvt_variable_signature (fsig);
        gboolean variant_iface = FALSE;
        guint32 slot;
@@ -7799,7 +7821,7 @@ emit_llvmonly_virtual_call (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSig
                icall_args [0] = thunk_arg_ins;
                icall_args [1] = emit_get_rgctx_method (cfg, context_used,
                                                                                                cmethod, MONO_RGCTX_INFO_METHOD);
-               ftndesc_ins = mono_emit_calli (cfg, helper_sig_llvmonly_imt_thunk, icall_args, thunk_addr_ins, NULL, NULL);
+               ftndesc_ins = mono_emit_calli (cfg, helper_sig_llvmonly_imt_trampoline, icall_args, thunk_addr_ins, NULL, NULL);
 
                return emit_llvmonly_calli (cfg, fsig, sp, ftndesc_ins);
        }
@@ -7842,7 +7864,7 @@ emit_llvmonly_virtual_call (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSig
                icall_args [0] = thunk_arg_ins;
                icall_args [1] = emit_get_rgctx_method (cfg, context_used,
                                                                                                cmethod, MONO_RGCTX_INFO_METHOD);
-               ftndesc_ins = mono_emit_calli (cfg, helper_sig_llvmonly_imt_thunk, icall_args, thunk_addr_ins, NULL, NULL);
+               ftndesc_ins = mono_emit_calli (cfg, helper_sig_llvmonly_imt_trampoline, icall_args, thunk_addr_ins, NULL, NULL);
                ftndesc_ins->dreg = ftndesc_reg;
                /*
                 * Unlike normal iface calls, these imt thunks can return NULL, i.e. when they are passed an instantiation
@@ -7938,7 +7960,7 @@ is_jit_optimizer_disabled (MonoMethod *m)
                return FALSE;
        }
 
-       attrs = mono_custom_attrs_from_assembly_checked (ass, &error);
+       attrs = mono_custom_attrs_from_assembly_checked (ass, FALSE, &error);
        mono_error_cleanup (&error); /* FIXME don't swallow the error */
        if (attrs) {
                for (i = 0; i < attrs->num_attrs; ++i) {
@@ -8137,7 +8159,22 @@ emit_setret (MonoCompile *cfg, MonoInst *val)
 /*
  * mono_method_to_ir:
  *
- *   Translate the .net IL into linear IR.
+ * Translate the .net IL into linear IR.
+ *
+ * @start_bblock: if not NULL, the starting basic block, used during inlining.
+ * @end_bblock: if not NULL, the ending basic block, used during inlining.
+ * @return_var: if not NULL, the place where the return value is stored, used during inlining.   
+ * @inline_args: if not NULL, contains the arguments to the inline call
+ * @inline_offset: if not zero, the real offset from the inline call, or zero otherwise.
+ * @is_virtual_call: whether this method is being called as a result of a call to callvirt
+ *
+ * This method is used to turn ECMA IL into Mono's internal Linear IR
+ * reprensetation.  It is used both for entire methods, as well as
+ * inlining existing methods.  In the former case, the @start_bblock,
+ * @end_bblock, @return_var, @inline_args are all set to NULL, and the
+ * inline_offset is set to zero.
+ * 
+ * Returns: the inline cost, or -1 if there was an error processing this method.
  */
 int
 mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_bblock, MonoBasicBlock *end_bblock, 
@@ -8465,7 +8502,8 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
 
        /* we use a separate basic block for the initialization code */
        NEW_BBLOCK (cfg, init_localsbb);
-       cfg->bb_init = init_localsbb;
+       if (cfg->method == method)
+               cfg->bb_init = init_localsbb;
        init_localsbb->real_offset = cfg->real_offset;
        start_bblock->next_bb = init_localsbb;
        init_localsbb->next_bb = cfg->cbb;
@@ -9351,7 +9389,7 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
 
                        n = fsig->param_count + fsig->hasthis;
 
-                       if (!cfg->gshared && cmethod->klass->generic_container)
+                       if (!cfg->gshared && mono_class_is_gtd (cmethod->klass))
                                UNVERIFIED;
 
                        if (!cfg->gshared)
@@ -9370,7 +9408,7 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                                if (mini_is_gsharedvt_klass (constrained_class)) {
                                        if ((cmethod->klass != mono_defaults.object_class) && constrained_class->valuetype && cmethod->klass->valuetype) {
                                                /* The 'Own method' case below */
-                                       } else if (cmethod->klass->image != mono_defaults.corlib && !(cmethod->klass->flags & TYPE_ATTRIBUTE_INTERFACE) && !cmethod->klass->valuetype) {
+                                       } else if (cmethod->klass->image != mono_defaults.corlib && !mono_class_is_interface (cmethod->klass) && !cmethod->klass->valuetype) {
                                                /* 'The type parameter is instantiated as a reference type' case below. */
                                        } else {
                                                ins = handle_constrained_gsharedvt_call (cfg, cmethod, fsig, sp, constrained_class, &emit_widen);
@@ -9391,7 +9429,7 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                                         * A simple solution would be to box always and make a normal virtual call, but that would
                                         * be bad performance wise.
                                         */
-                                       if (cmethod->klass->flags & TYPE_ATTRIBUTE_INTERFACE && cmethod->klass->generic_class) {
+                                       if (mono_class_is_interface (cmethod->klass) && mono_class_is_ginst (cmethod->klass)) {
                                                /*
                                                 * The parent classes implement no generic interfaces, so the called method will be a vtype method, so no boxing neccessary.
                                                 */
@@ -9444,7 +9482,7 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                                                nonbox_call->dreg = ins->dreg;
                                                goto call_end;
                                        } else {
-                                               g_assert (cmethod->klass->flags & TYPE_ATTRIBUTE_INTERFACE);
+                                               g_assert (mono_class_is_interface (cmethod->klass));
                                                addr = emit_get_rgctx_virt_method (cfg, mono_class_check_context_used (constrained_class), constrained_class, cmethod, MONO_RGCTX_INFO_VIRT_METHOD_CODE);
                                                ins = (MonoInst*)mono_emit_calli (cfg, fsig, sp, addr, NULL, NULL);
                                                goto call_end;
@@ -9519,7 +9557,7 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                         * If the callee is a shared method, then its static cctor
                         * might not get called after the call was patched.
                         */
-                       if (cfg->gshared && cmethod->klass != method->klass && cmethod->klass->generic_class && mono_method_is_generic_sharable (cmethod, TRUE) && mono_class_needs_cctor_run (cmethod->klass, method)) {
+                       if (cfg->gshared && cmethod->klass != method->klass && mono_class_is_ginst (cmethod->klass) && mono_method_is_generic_sharable (cmethod, TRUE) && mono_class_needs_cctor_run (cmethod->klass, method)) {
                                emit_class_init (cfg, cmethod->klass);
                                CHECK_TYPELOAD (cmethod->klass);
                        }
@@ -9531,7 +9569,7 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
 
                                context_used = mini_method_check_context_used (cfg, cmethod);
 
-                               if (context_used && (cmethod->klass->flags & TYPE_ATTRIBUTE_INTERFACE)) {
+                               if (context_used && mono_class_is_interface (cmethod->klass)) {
                                        /* Generic method interface
                                           calls are resolved via a
                                           helper function and don't
@@ -9619,7 +9657,7 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                                if (cfg->gsharedvt && mini_is_gsharedvt_signature (fsig))
                                        GSHAREDVT_FAILURE (*ip);
 
-                               if (cfg->backend->have_generalized_imt_thunk && cfg->backend->gshared_supported && cmethod->wrapper_type == MONO_WRAPPER_NONE) {
+                               if (cfg->backend->have_generalized_imt_trampoline && cfg->backend->gshared_supported && cmethod->wrapper_type == MONO_WRAPPER_NONE) {
                                        g_assert (!imt_arg);
                                        if (!context_used)
                                                g_assert (cmethod->is_inflated);
@@ -9732,6 +9770,10 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                                }
 
                                if (!has_vtargs) {
+                                       if (need_seq_point) {
+                                               emit_seq_point (cfg, method, ip, FALSE, TRUE);
+                                               need_seq_point = FALSE;
+                                       }
                                        for (i = 0; i < n; ++i)
                                                EMIT_NEW_ARGSTORE (cfg, ins, i, sp [i]);
                                        MONO_INST_NEW (cfg, ins, OP_BR);
@@ -9770,13 +9812,13 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                         * This needs to be used for all generic calls, not just ones with a gsharedvt signature, to avoid
                         * patching gshared method addresses into a gsharedvt method.
                         */
-                       if (cfg->gsharedvt && (mini_is_gsharedvt_signature (fsig) || cmethod->is_inflated || cmethod->klass->generic_class) &&
+                       if (cfg->gsharedvt && (mini_is_gsharedvt_signature (fsig) || cmethod->is_inflated || mono_class_is_ginst (cmethod->klass)) &&
                                !(cmethod->klass->rank && cmethod->klass->byval_arg.type != MONO_TYPE_SZARRAY) &&
                                (!(cfg->llvm_only && virtual_ && (cmethod->flags & METHOD_ATTRIBUTE_VIRTUAL)))) {
                                MonoRgctxInfoType info_type;
 
                                if (virtual_) {
-                                       //if (cmethod->klass->flags & TYPE_ATTRIBUTE_INTERFACE)
+                                       //if (mono_class_is_interface (cmethod->klass))
                                                //GSHAREDVT_FAILURE (*ip);
                                        // disable for possible remoting calls
                                        if (fsig->hasthis && (mono_class_is_marshalbyref (method->klass) || method->klass == mono_defaults.object_class))
@@ -9789,7 +9831,7 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                                                                                                                 cmethod, MONO_RGCTX_INFO_METHOD);
                                                /* This is not needed, as the trampoline code will pass one, and it might be passed in the same reg as the imt arg */
                                                vtable_arg = NULL;
-                                       } else if ((cmethod->klass->flags & TYPE_ATTRIBUTE_INTERFACE) && !imt_arg) {
+                                       } else if (mono_class_is_interface (cmethod->klass) && !imt_arg) {
                                                /* This can happen when we call a fully instantiated iface method */
                                                imt_arg = emit_get_rgctx_method (cfg, context_used,
                                                                                                                 cmethod, MONO_RGCTX_INFO_METHOD);
@@ -9897,7 +9939,7 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                                        
                                        addr = mini_emit_ldelema_ins (cfg, cmethod, sp, ip, TRUE);
                                        EMIT_NEW_STORE_MEMBASE_TYPE (cfg, ins, fsig->params [fsig->param_count - 1], addr->dreg, 0, val->dreg);
-                                       if (cfg->gen_write_barriers && val->type == STACK_OBJ && !(val->opcode == OP_PCONST && val->inst_c0 == 0))
+                                       if (cfg->gen_write_barriers && val->type == STACK_OBJ && !MONO_INS_IS_PCONST_NULL (val))
                                                emit_write_barrier (cfg, addr, val);
                                        if (cfg->gen_write_barriers && mini_is_gsharedvt_klass (cmethod->klass))
                                                GSHAREDVT_FAILURE (*ip);
@@ -9993,7 +10035,8 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                        }
 
                        /* Common call */
-                       INLINE_FAILURE ("call");
+                       if (!(cmethod->iflags & METHOD_IMPL_ATTRIBUTE_AGGRESSIVE_INLINING))
+                               INLINE_FAILURE ("call");
                        ins = mono_emit_method_call_full (cfg, cmethod, fsig, tail_call, sp, virtual_ ? sp [0] : NULL,
                                                                                          imt_arg, vtable_arg);
 
@@ -10032,6 +10075,16 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                                EMIT_NEW_DUMMY_USE (cfg, dummy_use, keep_this_alive);
                        }
 
+                       if (cfg->llvm_only && cmethod && method_needs_stack_walk (cfg, cmethod)) {
+                               /*
+                                * Clang can convert these calls to tail calls which screw up the stack
+                                * walk. This happens even when the -fno-optimize-sibling-calls
+                                * option is passed to clang.
+                                * Work around this by emitting a dummy call.
+                                */
+                               mono_emit_jit_icall (cfg, mono_dummy_jit_icall, NULL);
+                       }
+
                        CHECK_CFG_EXCEPTION;
 
                        ip += 5;
@@ -10431,7 +10484,7 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
 
                        MONO_ADD_INS (cfg->cbb, ins);
 
-                       if (cfg->gen_write_barriers && *ip == CEE_STIND_REF && method->wrapper_type != MONO_WRAPPER_WRITE_BARRIER && !((sp [1]->opcode == OP_PCONST) && (sp [1]->inst_p0 == 0)))
+                       if (cfg->gen_write_barriers && *ip == CEE_STIND_REF && method->wrapper_type != MONO_WRAPPER_WRITE_BARRIER && !MONO_INS_IS_PCONST_NULL (sp [1]))
                                emit_write_barrier (cfg, sp [0], sp [1]);
 
                        inline_costs += 1;
@@ -10814,7 +10867,7 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                        if (mono_security_core_clr_enabled ())
                                ensure_method_is_allowed_to_call_method (cfg, method, cmethod);
 
-                       if (cfg->gshared && cmethod && cmethod->klass != method->klass && cmethod->klass->generic_class && mono_method_is_generic_sharable (cmethod, TRUE) && mono_class_needs_cctor_run (cmethod->klass, method)) {
+                       if (cfg->gshared && cmethod && cmethod->klass != method->klass && mono_class_is_ginst (cmethod->klass) && mono_method_is_generic_sharable (cmethod, TRUE) && mono_class_needs_cctor_run (cmethod->klass, method)) {
                                emit_class_init (cfg, cmethod->klass);
                                CHECK_TYPELOAD (cmethod->klass);
                        }
@@ -11006,13 +11059,18 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                                res = handle_unbox_gsharedvt (cfg, klass, *sp);
                                inline_costs += 2;
                        } else if (generic_class_is_reference_type (cfg, klass)) {
-                               MONO_INST_NEW (cfg, res, OP_CASTCLASS);
-                               res->dreg = alloc_preg (cfg);
-                               res->sreg1 = (*sp)->dreg;
-                               res->klass = klass;
-                               res->type = STACK_OBJ;
-                               MONO_ADD_INS (cfg->cbb, res);
-                               cfg->flags |= MONO_CFG_HAS_TYPE_CHECK;
+                               if (MONO_INS_IS_PCONST_NULL (*sp)) {
+                                       EMIT_NEW_PCONST (cfg, res, NULL);
+                                       res->type = STACK_OBJ;
+                               } else {
+                                       MONO_INST_NEW (cfg, res, OP_CASTCLASS);
+                                       res->dreg = alloc_preg (cfg);
+                                       res->sreg1 = (*sp)->dreg;
+                                       res->klass = klass;
+                                       res->type = STACK_OBJ;
+                                       MONO_ADD_INS (cfg->cbb, res);
+                                       cfg->flags |= MONO_CFG_HAS_TYPE_CHECK;
+                               }
                        } else if (mono_class_is_nullable (klass)) {
                                res = handle_unbox_nullable (cfg, *sp, klass, context_used);
                        } else {
@@ -11360,7 +11418,7 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                                        if (sp [0]->opcode != OP_LDADDR)
                                                store->flags |= MONO_INST_FAULT;
 
-                                       if (cfg->gen_write_barriers && mini_type_to_stind (cfg, field->type) == CEE_STIND_REF && !(sp [1]->opcode == OP_PCONST && sp [1]->inst_c0 == 0)) {
+                                       if (cfg->gen_write_barriers && mini_type_to_stind (cfg, field->type) == CEE_STIND_REF && !MONO_INS_IS_PCONST_NULL (sp [1])) {
                                                if (mini_is_gsharedvt_klass (klass)) {
                                                        g_assert (wbarrier_ptr_ins);
                                                        emit_write_barrier (cfg, wbarrier_ptr_ins, sp [1]);
@@ -11452,6 +11510,16 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
 
                                        MONO_EMIT_NULL_CHECK (cfg, sp [0]->dreg);
 
+                                       if (sp [0]->opcode == OP_LDADDR && klass->simd_type && cfg->opt & MONO_OPT_SIMD) {
+                                               ins = mono_emit_simd_field_load (cfg, field, sp [0]);
+                                               if (ins) {
+                                                       *sp++ = ins;
+                                                       ins_flag = 0;
+                                                       ip += 5;
+                                                       break;
+                                               }
+                                       }
+
                                        if (mini_is_gsharedvt_klass (klass)) {
                                                MonoInst *offset_ins;
 
@@ -11783,7 +11851,7 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                        EMIT_NEW_STORE_MEMBASE_TYPE (cfg, ins, &klass->byval_arg, sp [0]->dreg, 0, sp [1]->dreg);
                        ins->flags |= ins_flag;
                        if (cfg->gen_write_barriers && cfg->method->wrapper_type != MONO_WRAPPER_WRITE_BARRIER &&
-                                       generic_class_is_reference_type (cfg, klass)) {
+                               generic_class_is_reference_type (cfg, klass) && !MONO_INS_IS_PCONST_NULL (sp [1])) {
                                /* insert call to write barrier */
                                emit_write_barrier (cfg, sp [0], sp [1]);
                        }
@@ -12126,7 +12194,7 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                                MONO_EMIT_NEW_STORE_MEMBASE (cfg, OP_STOREP_MEMBASE_REG, addr->dreg, MONO_STRUCT_OFFSET (MonoTypedRef, klass), const_ins->dreg);
                                MONO_EMIT_NEW_BIALU_IMM (cfg, OP_ADD_IMM, type_reg, const_ins->dreg, MONO_STRUCT_OFFSET (MonoClass, byval_arg));
                                MONO_EMIT_NEW_STORE_MEMBASE (cfg, OP_STOREP_MEMBASE_REG, addr->dreg, MONO_STRUCT_OFFSET (MonoTypedRef, type), type_reg);
-                       } else if (cfg->compile_aot) {
+                       } else {
                                int const_reg = alloc_preg (cfg);
                                int type_reg = alloc_preg (cfg);
 
@@ -12134,9 +12202,6 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                                MONO_EMIT_NEW_STORE_MEMBASE (cfg, OP_STOREP_MEMBASE_REG, addr->dreg, MONO_STRUCT_OFFSET (MonoTypedRef, klass), const_reg);
                                MONO_EMIT_NEW_BIALU_IMM (cfg, OP_ADD_IMM, type_reg, const_reg, MONO_STRUCT_OFFSET (MonoClass, byval_arg));
                                MONO_EMIT_NEW_STORE_MEMBASE (cfg, OP_STOREP_MEMBASE_REG, addr->dreg, MONO_STRUCT_OFFSET (MonoTypedRef, type), type_reg);
-                       } else {
-                               MONO_EMIT_NEW_STORE_MEMBASE_IMM (cfg, OP_STOREP_MEMBASE_IMM, addr->dreg, MONO_STRUCT_OFFSET (MonoTypedRef, type), &klass->byval_arg);
-                               MONO_EMIT_NEW_STORE_MEMBASE_IMM (cfg, OP_STOREP_MEMBASE_IMM, addr->dreg, MONO_STRUCT_OFFSET (MonoTypedRef, klass), klass);
                        }
                        MONO_EMIT_NEW_STORE_MEMBASE (cfg, OP_STOREP_MEMBASE_REG, addr->dreg, MONO_STRUCT_OFFSET (MonoTypedRef, value), sp [0]->dreg);
 
@@ -12532,7 +12597,17 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                                cmethod = (MonoMethod *)mono_method_get_wrapper_data (method, token);
 
                                if (cfg->compile_aot) {
-                                       EMIT_NEW_AOTCONST (cfg, ins, MONO_PATCH_INFO_ICALL_ADDR, cmethod);
+                                       if (cfg->direct_pinvoke && ip + 6 < end && (ip [6] == CEE_POP)) {
+                                               /*
+                                                * This is generated by emit_native_wrapper () to resolve the pinvoke address
+                                                * before the call, its not needed when using direct pinvoke.
+                                                * This is not an optimization, but its used to avoid looking up pinvokes
+                                                * on platforms which don't support dlopen ().
+                                                */
+                                               EMIT_NEW_PCONST (cfg, ins, NULL);
+                                       } else {
+                                               EMIT_NEW_AOTCONST (cfg, ins, MONO_PATCH_INFO_ICALL_ADDR, cmethod);
+                                       }
                                } else {
                                        ptr = mono_lookup_internal_call (cmethod);
                                        g_assert (ptr);
@@ -13657,7 +13732,10 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
        if (cfg->method == method) {
                MonoBasicBlock *bb;
                for (bb = cfg->bb_entry; bb; bb = bb->next_bb) {
-                       bb->region = mono_find_block_region (cfg, bb->real_offset);
+                       if (bb == cfg->bb_init)
+                               bb->region = -1;
+                       else
+                               bb->region = mono_find_block_region (cfg, bb->real_offset);
                        if (cfg->spvars)
                                mono_create_spvar_for_region (cfg, bb->region);
                        if (cfg->verbose_level > 2)
@@ -15076,7 +15154,7 @@ mono_decompose_typecheck (MonoCompile *cfg, MonoBasicBlock *bb, MonoInst *ins)
                        ret = emit_isinst_with_cache_nonshared (cfg, source, klass);
                else
                        ret = emit_castclass_with_cache_nonshared (cfg, source, klass);
-       } else if (!context_used && (mono_class_is_marshalbyref (klass) || klass->flags & TYPE_ATTRIBUTE_INTERFACE)) {
+       } else if (!context_used && (mono_class_is_marshalbyref (klass) || mono_class_is_interface (klass))) {
                MonoInst *iargs [1];
                int costs;
 
@@ -15246,4 +15324,8 @@ NOTES
   the values on the stack before emitting the last instruction of the bb.
 */
 
-#endif /* DISABLE_JIT */
+#else /* !DISABLE_JIT */
+
+MONO_EMPTY_SOURCE_FILE (method_to_ir);
+
+#endif /* !DISABLE_JIT */
index 258b265e063cc4f986c7e5b5a7c9bfa47a1e82af..b9093c31c754baffd2002b29da8504fee3c4ca14 100644 (file)
@@ -33,7 +33,7 @@
 #include <mono/utils/mono-mmap.h>
 #include <mono/utils/mono-memory-model.h>
 #include <mono/utils/mono-tls.h>
-#include <mono/utils/mono-hwcap-x86.h>
+#include <mono/utils/mono-hwcap.h>
 #include <mono/utils/mono-threads.h>
 
 #include "trace.h"
@@ -339,39 +339,6 @@ merge_argument_class_from_type (MonoType *type, ArgumentClass class1)
        return class1;
 }
 
-static int
-count_fields_nested (MonoClass *klass, gboolean pinvoke)
-{
-       MonoMarshalType *info;
-       int i, count;
-
-       count = 0;
-       if (pinvoke) {
-               info = mono_marshal_load_type_info (klass);
-               g_assert(info);
-               for (i = 0; i < info->num_fields; ++i) {
-                       if (MONO_TYPE_ISSTRUCT (info->fields [i].field->type))
-                               count += count_fields_nested (mono_class_from_mono_type (info->fields [i].field->type), pinvoke);
-                       else
-                               count ++;
-               }
-       } else {
-               gpointer iter;
-               MonoClassField *field;
-
-               iter = NULL;
-               while ((field = mono_class_get_fields (klass, &iter))) {
-                       if (field->type->attrs & FIELD_ATTRIBUTE_STATIC)
-                               continue;
-                       if (MONO_TYPE_ISSTRUCT (field->type))
-                               count += count_fields_nested (mono_class_from_mono_type (field->type), pinvoke);
-                       else
-                               count ++;
-               }
-       }
-       return count;
-}
-
 typedef struct {
        MonoType *type;
        int size, offset;
@@ -382,8 +349,8 @@ typedef struct {
  *
  *   Collect field info from KLASS recursively into FIELDS.
  */
-static int
-collect_field_info_nested (MonoClass *klass, StructFieldInfo *fields, int index, int offset, gboolean pinvoke, gboolean unicode)
+static void
+collect_field_info_nested (MonoClass *klass, GArray *fields_array, int offset, gboolean pinvoke, gboolean unicode)
 {
        MonoMarshalType *info;
        int i;
@@ -393,16 +360,32 @@ collect_field_info_nested (MonoClass *klass, StructFieldInfo *fields, int index,
                g_assert(info);
                for (i = 0; i < info->num_fields; ++i) {
                        if (MONO_TYPE_ISSTRUCT (info->fields [i].field->type)) {
-                               index = collect_field_info_nested (mono_class_from_mono_type (info->fields [i].field->type), fields, index, info->fields [i].offset, pinvoke, unicode);
+                               collect_field_info_nested (mono_class_from_mono_type (info->fields [i].field->type), fields_array, info->fields [i].offset, pinvoke, unicode);
                        } else {
                                guint32 align;
+                               StructFieldInfo f;
 
-                               fields [index].type = info->fields [i].field->type;
-                               fields [index].size = mono_marshal_type_size (info->fields [i].field->type,
+                               f.type = info->fields [i].field->type;
+                               f.size = mono_marshal_type_size (info->fields [i].field->type,
                                                                                                                           info->fields [i].mspec,
                                                                                                                           &align, TRUE, unicode);
-                               fields [index].offset = offset + info->fields [i].offset;
-                               index ++;
+                               f.offset = offset + info->fields [i].offset;
+                               if (i == info->num_fields - 1 && f.size + f.offset < info->native_size) {
+                                       /* This can happen with .pack directives eg. 'fixed' arrays */
+                                       if (MONO_TYPE_IS_PRIMITIVE (f.type)) {
+                                               /* Replicate the last field to fill out the remaining place, since the code in add_valuetype () needs type information */
+                                               g_array_append_val (fields_array, f);
+                                               while (f.size + f.offset < info->native_size) {
+                                                       f.offset += f.size;
+                                                       g_array_append_val (fields_array, f);
+                                               }
+                                       } else {
+                                               f.size = info->native_size - f.offset;
+                                               g_array_append_val (fields_array, f);
+                                       }
+                               } else {
+                                       g_array_append_val (fields_array, f);
+                               }
                        }
                }
        } else {
@@ -414,18 +397,19 @@ collect_field_info_nested (MonoClass *klass, StructFieldInfo *fields, int index,
                        if (field->type->attrs & FIELD_ATTRIBUTE_STATIC)
                                continue;
                        if (MONO_TYPE_ISSTRUCT (field->type)) {
-                               index = collect_field_info_nested (mono_class_from_mono_type (field->type), fields, index, field->offset - sizeof (MonoObject), pinvoke, unicode);
+                               collect_field_info_nested (mono_class_from_mono_type (field->type), fields_array, field->offset - sizeof (MonoObject), pinvoke, unicode);
                        } else {
                                int align;
+                               StructFieldInfo f;
+
+                               f.type = field->type;
+                               f.size = mono_type_size (field->type, &align);
+                               f.offset = field->offset - sizeof (MonoObject) + offset;
 
-                               fields [index].type = field->type;
-                               fields [index].size = mono_type_size (field->type, &align);
-                               fields [index].offset = field->offset - sizeof (MonoObject) + offset;
-                               index ++;
+                               g_array_append_val (fields_array, f);
                        }
                }
        }
-       return index;
 }
 
 #ifdef TARGET_WIN32
@@ -434,7 +418,7 @@ collect_field_info_nested (MonoClass *klass, StructFieldInfo *fields, int index,
 #define MONO_WIN64_VALUE_TYPE_FITS_REG(arg_size) (arg_size <= SIZEOF_REGISTER && (arg_size == 1 || arg_size == 2 || arg_size == 4 || arg_size == 8))
 
 static gboolean
-allocate_register_for_valuetype_win64 (ArgInfo *arg_info, ArgumentClass arg_class, guint32 arg_size, AMD64_Reg_No int_regs [], int int_reg_count, AMD64_Reg_No float_regs [], int float_reg_count, guint32 *current_int_reg, guint32 *current_float_reg)
+allocate_register_for_valuetype_win64 (ArgInfo *arg_info, ArgumentClass arg_class, guint32 arg_size, AMD64_Reg_No int_regs [], int int_reg_count, AMD64_XMM_Reg_No float_regs [], int float_reg_count, guint32 *current_int_reg, guint32 *current_float_reg)
 {
        gboolean result = FALSE;
 
@@ -469,13 +453,13 @@ allocate_register_for_valuetype_win64 (ArgInfo *arg_info, ArgumentClass arg_clas
        return result;
 }
 
-inline gboolean
+static inline gboolean
 allocate_parameter_register_for_valuetype_win64 (ArgInfo *arg_info, ArgumentClass arg_class, guint32 arg_size, guint32 *current_int_reg, guint32 *current_float_reg)
 {
        return allocate_register_for_valuetype_win64 (arg_info, arg_class, arg_size, param_regs, PARAM_REGS, float_param_regs, FLOAT_PARAM_REGS, current_int_reg, current_float_reg);
 }
 
-inline gboolean
+static inline gboolean
 allocate_return_register_for_valuetype_win64 (ArgInfo *arg_info, ArgumentClass arg_class, guint32 arg_size, guint32 *current_int_reg, guint32 *current_float_reg)
 {
        return allocate_register_for_valuetype_win64 (arg_info, arg_class, arg_size, return_regs, RETURN_REGS, float_return_regs, FLOAT_RETURN_REGS, current_int_reg, current_float_reg);
@@ -646,6 +630,7 @@ add_valuetype (MonoMethodSignature *sig, ArgInfo *ainfo, MonoType *type,
        guint32 quadsize [2] = {8, 8};
        ArgumentClass args [2];
        StructFieldInfo *fields = NULL;
+       GArray *fields_array;
        MonoClass *klass;
        gboolean pass_on_stack = FALSE;
        int struct_size;
@@ -672,9 +657,10 @@ add_valuetype (MonoMethodSignature *sig, ArgInfo *ainfo, MonoType *type,
         * Collect field information recursively to be able to
         * handle nested structures.
         */
-       nfields = count_fields_nested (klass, sig->pinvoke);
-       fields = g_new0 (StructFieldInfo, nfields);
-       collect_field_info_nested (klass, fields, 0, 0, sig->pinvoke, klass->unicode);
+       fields_array = g_array_new (FALSE, TRUE, sizeof (StructFieldInfo));
+       collect_field_info_nested (klass, fields_array, 0, sig->pinvoke, klass->unicode);
+       fields = (StructFieldInfo*)fields_array->data;
+       nfields = fields_array->len;
 
        for (i = 0; i < nfields; ++i) {
                if ((fields [i].offset < 8) && (fields [i].offset + fields [i].size) > 8) {
@@ -697,7 +683,7 @@ add_valuetype (MonoMethodSignature *sig, ArgInfo *ainfo, MonoType *type,
                if (!is_return)
                        ainfo->arg_size = ALIGN_TO (size, 8);
 
-               g_free (fields);
+               g_array_free (fields_array, TRUE);
                return;
        }
 
@@ -739,7 +725,7 @@ add_valuetype (MonoMethodSignature *sig, ArgInfo *ainfo, MonoType *type,
                        if (!is_return)
                                ainfo->arg_size = ALIGN_TO (struct_size, 8);
 
-                       g_free (fields);
+                       g_array_free (fields_array, TRUE);
                        return;
                }
 
@@ -777,7 +763,7 @@ add_valuetype (MonoMethodSignature *sig, ArgInfo *ainfo, MonoType *type,
                }
        }
 
-       g_free (fields);
+       g_array_free (fields_array, TRUE);
 
        /* Post merger cleanup */
        if ((args [0] == ARG_CLASS_MEMORY) || (args [1] == ARG_CLASS_MEMORY))
@@ -6513,8 +6499,12 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
                case OP_XZERO:
                        amd64_sse_pxor_reg_reg (code, ins->dreg, ins->dreg);
                        break;
+               case OP_XONES:
+                       amd64_sse_pcmpeqb_reg_reg (code, ins->dreg, ins->dreg);
+                       break;
                case OP_ICONV_TO_R4_RAW:
                        amd64_movd_xreg_reg_size (code, ins->dreg, ins->sreg1, 4);
+                       amd64_sse_cvtss2sd_reg_reg (code, ins->dreg, ins->dreg);
                        break;
 
                case OP_FCONV_TO_R8_X:
@@ -7985,7 +7975,7 @@ imt_branch_distance (MonoIMTCheckItem **imt_entries, int start, int target)
  * LOCKING: called with the domain lock held
  */
 gpointer
-mono_arch_build_imt_thunk (MonoVTable *vtable, MonoDomain *domain, MonoIMTCheckItem **imt_entries, int count,
+mono_arch_build_imt_trampoline (MonoVTable *vtable, MonoDomain *domain, MonoIMTCheckItem **imt_entries, int count,
        gpointer fail_tramp)
 {
        int i;
@@ -8039,7 +8029,7 @@ mono_arch_build_imt_thunk (MonoVTable *vtable, MonoDomain *domain, MonoIMTCheckI
                size += item->chunk_size;
        }
        if (fail_tramp)
-               code = (guint8 *)mono_method_alloc_generic_virtual_thunk (domain, size);
+               code = (guint8 *)mono_method_alloc_generic_virtual_trampoline (domain, size);
        else
                code = (guint8 *)mono_domain_code_reserve (domain, size);
        start = code;
@@ -8130,7 +8120,7 @@ mono_arch_build_imt_thunk (MonoVTable *vtable, MonoDomain *domain, MonoIMTCheckI
        }
 
        if (!fail_tramp)
-               mono_stats.imt_thunks_size += code - start;
+               mono_stats.imt_trampolines_size += code - start;
        g_assert (code - start <= size);
 
        mono_profiler_code_buffer_new (start, code - start, MONO_PROFILER_CODE_BUFFER_IMT_TRAMPOLINE, NULL);
index 22e7413a6f531cb207b974d0cefdfff2605a12e9..24eb6524bf759596849b46637e9bc860c1a92d16 100644 (file)
@@ -191,11 +191,11 @@ typedef struct MonoCompileArch {
 
 static AMD64_Reg_No param_regs [] = { AMD64_RCX, AMD64_RDX, AMD64_R8, AMD64_R9 };
 
-static AMD64_Reg_No float_param_regs [] = { AMD64_XMM0, AMD64_XMM1, AMD64_XMM2, AMD64_XMM3 };
+static AMD64_XMM_Reg_No float_param_regs [] = { AMD64_XMM0, AMD64_XMM1, AMD64_XMM2, AMD64_XMM3 };
 
 static AMD64_Reg_No return_regs [] = { AMD64_RAX };
 
-static AMD64_Reg_No float_return_regs [] = { AMD64_XMM0 };
+static AMD64_XMM_Reg_No float_return_regs [] = { AMD64_XMM0 };
 
 #define PARAM_REGS G_N_ELEMENTS(param_regs)
 #define FLOAT_PARAM_REGS G_N_ELEMENTS(float_param_regs)
@@ -386,7 +386,7 @@ typedef struct {
 #define MONO_ARCH_EXC_REG AMD64_RAX
 #define MONO_ARCH_HAVE_CMOV_OPS 1
 #define MONO_ARCH_HAVE_EXCEPTIONS_INIT 1
-#define MONO_ARCH_HAVE_GENERALIZED_IMT_THUNK 1
+#define MONO_ARCH_HAVE_GENERALIZED_IMT_TRAMPOLINE 1
 #define MONO_ARCH_HAVE_LIVERANGE_OPS 1
 #define MONO_ARCH_HAVE_SIGCTX_TO_MONOCTX 1
 #define MONO_ARCH_HAVE_GET_TRAMPOLINES 1
index 6983398027a5b2bb2e37143c455dceb3db0635cc..13a3ffee37f8159a3b1346bf99c09b007ab5159b 100644 (file)
@@ -18,7 +18,7 @@
 #include <mono/metadata/profiler-private.h>
 #include <mono/metadata/debug-helpers.h>
 #include <mono/utils/mono-mmap.h>
-#include <mono/utils/mono-hwcap-arm.h>
+#include <mono/utils/mono-hwcap.h>
 #include <mono/utils/mono-memory-model.h>
 #include <mono/utils/mono-threads-coop.h>
 
@@ -127,6 +127,7 @@ static int vfp_scratch2 = ARM_VFP_D1;
 static int i8_align;
 
 static gpointer single_step_tramp, breakpoint_tramp;
+static gpointer get_tls_tramp;
 
 /*
  * The code generated for sequence points reads from this location, which is
@@ -167,6 +168,9 @@ int mono_exc_esp_offset = 0;
 static void mono_arch_compute_omit_fp (MonoCompile *cfg);
 #endif
 
+static guint8*
+emit_aotconst (MonoCompile *cfg, guint8 *code, int dreg, int patch_type, gpointer data);
+
 const char*
 mono_arch_regname (int reg)
 {
@@ -330,9 +334,21 @@ mono_arm_emit_tls_get (MonoCompile *cfg, guint8* code, int dreg, int tls_offset)
 {
 #ifdef HAVE_FAST_TLS
        code = mono_arm_emit_load_imm (code, ARMREG_R0, tls_offset);
-       mono_add_patch_info (cfg, code - cfg->native_code, MONO_PATCH_INFO_INTERNAL_METHOD,
-                       "mono_get_tls_key");
-       code = emit_call_seq (cfg, code);
+       if (cfg->compile_aot) {
+               /*
+                * This opcode is generated by CEE_MONO_JIT_ATTACH, so it can execute on
+                * threads which are not yet attached to the runtime. This means we can't
+                * call it directly, since the call would go through the trampoline code
+                * which assumes the thread is attached. So use a separate patch info type
+                * for it, and load it from a preinitialized GOT slot.
+                */
+               code = emit_aotconst (cfg, code, ARMREG_R1, MONO_PATCH_INFO_GET_TLS_TRAMP, NULL);
+               code = emit_call_reg (code, ARMREG_R1);
+       } else {
+               mono_add_patch_info (cfg, code - cfg->native_code, MONO_PATCH_INFO_INTERNAL_METHOD,
+                                                        "mono_get_tls_key");
+               code = emit_call_seq (cfg, code);
+       }
        if (dreg != ARMREG_R0)
                ARM_MOV_REG_REG (code, dreg, ARMREG_R0);
 #else
@@ -347,9 +363,14 @@ mono_arm_emit_tls_get_reg (MonoCompile *cfg, guint8* code, int dreg, int tls_off
 #ifdef HAVE_FAST_TLS
        if (tls_offset_reg != ARMREG_R0)
                ARM_MOV_REG_REG (code, ARMREG_R0, tls_offset_reg);
-       mono_add_patch_info (cfg, code - cfg->native_code, MONO_PATCH_INFO_INTERNAL_METHOD,
-                       "mono_get_tls_key");
-       code = emit_call_seq (cfg, code);
+       if (cfg->compile_aot) {
+               code = emit_aotconst (cfg, code, ARMREG_R1, MONO_PATCH_INFO_GET_TLS_TRAMP, NULL);
+               code = emit_call_reg (code, ARMREG_R1);
+       } else {
+               mono_add_patch_info (cfg, code - cfg->native_code, MONO_PATCH_INFO_INTERNAL_METHOD,
+                                                        "mono_get_tls_key");
+               code = emit_call_seq (cfg, code);
+       }
        if (dreg != ARMREG_R0)
                ARM_MOV_REG_REG (code, dreg, ARMREG_R0);
 #else
@@ -836,8 +857,8 @@ mono_arch_init (void)
                if (!mono_aot_only)
                        breakpoint_tramp = mini_get_breakpoint_trampoline ();
        } else {
-               ss_trigger_page = mono_valloc (NULL, mono_pagesize (), MONO_MMAP_READ|MONO_MMAP_32BIT);
-               bp_trigger_page = mono_valloc (NULL, mono_pagesize (), MONO_MMAP_READ|MONO_MMAP_32BIT);
+               ss_trigger_page = mono_valloc (NULL, mono_pagesize (), MONO_MMAP_READ|MONO_MMAP_32BIT, MONO_MEM_ACCOUNT_OTHER);
+               bp_trigger_page = mono_valloc (NULL, mono_pagesize (), MONO_MMAP_READ|MONO_MMAP_32BIT, MONO_MEM_ACCOUNT_OTHER);
                mono_mprotect (bp_trigger_page, mono_pagesize (), 0);
        }
 
@@ -5989,6 +6010,8 @@ mono_arch_register_lowlevel_calls (void)
                mono_register_jit_icall (tls_imp.get_tls_thunk, "mono_get_tls_key", mono_create_icall_signature ("ptr ptr"), TRUE);
                mono_register_jit_icall (tls_imp.set_tls_thunk, "mono_set_tls_key", mono_create_icall_signature ("void ptr ptr"), TRUE);
 
+               get_tls_tramp = tls_imp.get_tls_thunk;
+
                if (tls_imp.get_tls_thunk_end) {
                        mono_tramp_info_register (
                                mono_tramp_info_create (
@@ -6922,7 +6945,7 @@ mini_dump_bad_imt (int input_imt, int compared_imt, int pc)
 #endif
 
 gpointer
-mono_arch_build_imt_thunk (MonoVTable *vtable, MonoDomain *domain, MonoIMTCheckItem **imt_entries, int count,
+mono_arch_build_imt_trampoline (MonoVTable *vtable, MonoDomain *domain, MonoIMTCheckItem **imt_entries, int count,
        gpointer fail_tramp)
 {
        int size, i;
@@ -6974,7 +6997,7 @@ mono_arch_build_imt_thunk (MonoVTable *vtable, MonoDomain *domain, MonoIMTCheckI
                size += 4 * count; /* The ARM_ADD_REG_IMM to pop the stack */
 
        if (fail_tramp)
-               code = mono_method_alloc_generic_virtual_thunk (domain, size);
+               code = mono_method_alloc_generic_virtual_trampoline (domain, size);
        else
                code = mono_domain_code_reserve (domain, size);
        start = code;
@@ -6982,7 +7005,7 @@ mono_arch_build_imt_thunk (MonoVTable *vtable, MonoDomain *domain, MonoIMTCheckI
        unwind_ops = mono_arch_get_cie_program ();
 
 #ifdef DEBUG_IMT
-       g_print ("Building IMT thunk for class %s %s entries %d code size %d code at %p end %p vtable %p fail_tramp %p\n", vtable->klass->name_space, vtable->klass->name, count, size, start, ((guint8*)start) + size, vtable, fail_tramp);
+       g_print ("Building IMT trampoline for class %s %s entries %d code size %d code at %p end %p vtable %p fail_tramp %p\n", vtable->klass->name_space, vtable->klass->name, count, size, start, ((guint8*)start) + size, vtable, fail_tramp);
        for (i = 0; i < count; ++i) {
                MonoIMTCheckItem *item = imt_entries [i];
                g_print ("method %d (%p) %s vtable slot %p is_equals %d chunk size %d\n", i, item->key, ((MonoMethod*)item->key)->name, &vtable->vtable [item->value.vtable_slot], item->is_equals, item->chunk_size);
@@ -7148,7 +7171,7 @@ mono_arch_build_imt_thunk (MonoVTable *vtable, MonoDomain *domain, MonoIMTCheckI
 
        mono_arch_flush_icache ((guint8*)start, size);
        mono_profiler_code_buffer_new (start, code - start, MONO_PROFILER_CODE_BUFFER_IMT_TRAMPOLINE, NULL);
-       mono_stats.imt_thunks_size += code - start;
+       mono_stats.imt_trampolines_size += code - start;
 
        g_assert (DISTANCE (start, code) <= size);
 
@@ -7512,3 +7535,23 @@ mono_arch_get_call_info (MonoMemPool *mp, MonoMethodSignature *sig)
 {
        return get_call_info (mp, sig);
 }
+
+gpointer
+mono_arch_get_get_tls_tramp (void)
+{
+       return get_tls_tramp;
+}
+
+static guint8*
+emit_aotconst (MonoCompile *cfg, guint8 *code, int dreg, int patch_type, gpointer data)
+{
+       /* OP_AOTCONST */
+       mono_add_patch_info (cfg, code - cfg->native_code, patch_type, data);
+       ARM_LDR_IMM (code, dreg, ARMREG_PC, 0);
+       ARM_B (code, 0);
+       *(gpointer*)code = NULL;
+       code += 4;
+       /* Load the value from the GOT */
+       ARM_LDR_REG_REG (code, dreg, ARMREG_PC, dreg);
+       return code;
+}
index bc23a423d29a1f576c26f969c33e26ffd9d7a180..694f6b87e0e2d3f43ed800123f3925add53b1b2c 100644 (file)
@@ -316,7 +316,7 @@ typedef struct MonoCompileArch {
 
 #define MONO_ARCH_NEED_DIV_CHECK 1
 
-#define MONO_ARCH_HAVE_GENERALIZED_IMT_THUNK 1
+#define MONO_ARCH_HAVE_GENERALIZED_IMT_TRAMPOLINE 1
 
 #define MONO_ARCH_HAVE_FULL_AOT_TRAMPOLINES 1
 #define MONO_ARCH_HAVE_DECOMPOSE_LONG_OPTS 1
@@ -350,6 +350,7 @@ typedef struct MonoCompileArch {
 #define MONO_ARCH_HAVE_SDB_TRAMPOLINES 1
 #define MONO_ARCH_HAVE_PATCH_CODE_NEW 1
 #define MONO_ARCH_HAVE_OP_GENERIC_CLASS_INIT 1
+#define MONO_ARCH_HAVE_GET_TLS_TRAMP 1
 
 #define MONO_ARCH_HAVE_TLS_GET (mono_arm_have_tls_get ())
 #define MONO_ARCH_HAVE_TLS_GET_REG 1
index cb75bdf7a74fda7899a813f97ceae60ad6f7c895..3b4dd15c8c9acb3dc3a9bed4b689f664526ffe62 100644 (file)
@@ -839,6 +839,7 @@ emit_thunk (guint8 *code, gconstpointer target)
        arm_ldrx_lit (code, ARMREG_IP0, code + 8);
        arm_brx (code, ARMREG_IP0);
        *(guint64*)code = (guint64)target;
+       code += sizeof (guint64);
 
        mono_arch_flush_icache (p, code - p);
        return code;
@@ -933,7 +934,15 @@ arm_patch_full (MonoCompile *cfg, MonoDomain *domain, guint8 *code, guint8 *targ
 {
        switch (relocation) {
        case MONO_R_ARM64_B:
-               arm_b (code, target);
+               if (arm_is_bl_disp (code, target)) {
+                       arm_b (code, target);
+               } else {
+                       gpointer thunk;
+
+                       thunk = create_thunk (cfg, domain, code, target);
+                       g_assert (arm_is_bl_disp (code, thunk));
+                       arm_b (code, thunk);
+               }
                break;
        case MONO_R_ARM64_BCC: {
                int cond;
@@ -965,7 +974,7 @@ arm_patch_full (MonoCompile *cfg, MonoDomain *domain, guint8 *code, guint8 *targ
 
                        thunk = create_thunk (cfg, domain, code, target);
                        g_assert (arm_is_bl_disp (code, thunk));
-                       arm_bl (code, thunk);                   
+                       arm_bl (code, thunk);
                }
                break;
        default:
@@ -1776,7 +1785,29 @@ mono_arch_flush_icache (guint8 *code, gint size)
 #if __APPLE__
        sys_icache_invalidate (code, size);
 #else
-       __clear_cache (code, code + size);
+       /* Don't rely on GCC's __clear_cache implementation, as it caches
+        * icache/dcache cache line sizes, that can vary between cores on
+        * big.LITTLE architectures. */
+       guint64 end = (guint64) (code + size);
+       guint64 addr;
+       /* always go with cacheline size of 4 bytes as this code isn't perf critical
+        * anyway. Reading the cache line size from a machine register can be racy
+        * on a big.LITTLE architecture if the cores don't have the same cache line
+        * sizes. */
+       const size_t icache_line_size = 4;
+       const size_t dcache_line_size = 4;
+
+       addr = (guint64) code & ~(guint64) (dcache_line_size - 1);
+       for (; addr < end; addr += dcache_line_size)
+               asm volatile("dc civac, %0" : : "r" (addr) : "memory");
+       asm volatile("dsb ish" : : : "memory");
+
+       addr = (guint64) code & ~(guint64) (icache_line_size - 1);
+       for (; addr < end; addr += icache_line_size)
+               asm volatile("ic ivau, %0" : : "r" (addr) : "memory");
+
+       asm volatile ("dsb ish" : : : "memory");
+       asm volatile ("isb" : : : "memory");
 #endif
 #endif
 }
@@ -3631,11 +3662,12 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
                        guint8 *buf [16];
 
                        buf [0] = code;
-                       arm_ldaxrw (code, ARMREG_IP0, sreg1);
+                       arm_ldxrw (code, ARMREG_IP0, sreg1);
                        arm_addx (code, ARMREG_IP0, ARMREG_IP0, sreg2);
                        arm_stlxrw (code, ARMREG_IP1, ARMREG_IP0, sreg1);
                        arm_cbnzw (code, ARMREG_IP1, buf [0]);
 
+                       arm_dmb (code, 0);
                        arm_movx (code, dreg, ARMREG_IP0);
                        break;
                }
@@ -3643,11 +3675,12 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
                        guint8 *buf [16];
 
                        buf [0] = code;
-                       arm_ldaxrx (code, ARMREG_IP0, sreg1);
+                       arm_ldxrx (code, ARMREG_IP0, sreg1);
                        arm_addx (code, ARMREG_IP0, ARMREG_IP0, sreg2);
                        arm_stlxrx (code, ARMREG_IP1, ARMREG_IP0, sreg1);
                        arm_cbnzx (code, ARMREG_IP1, buf [0]);
 
+                       arm_dmb (code, 0);
                        arm_movx (code, dreg, ARMREG_IP0);
                        break;
                }
@@ -3655,10 +3688,11 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
                        guint8 *buf [16];
 
                        buf [0] = code;
-                       arm_ldaxrw (code, ARMREG_IP0, sreg1);
+                       arm_ldxrw (code, ARMREG_IP0, sreg1);
                        arm_stlxrw (code, ARMREG_IP1, sreg2, sreg1);
                        arm_cbnzw (code, ARMREG_IP1, buf [0]);
 
+                       arm_dmb (code, 0);
                        arm_movx (code, dreg, ARMREG_IP0);
                        break;
                }
@@ -3666,10 +3700,11 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
                        guint8 *buf [16];
 
                        buf [0] = code;
-                       arm_ldaxrx (code, ARMREG_IP0, sreg1);
+                       arm_ldxrx (code, ARMREG_IP0, sreg1);
                        arm_stlxrx (code, ARMREG_IP1, sreg2, sreg1);
                        arm_cbnzw (code, ARMREG_IP1, buf [0]);
 
+                       arm_dmb (code, 0);
                        arm_movx (code, dreg, ARMREG_IP0);
                        break;
                }
@@ -3678,7 +3713,7 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
 
                        /* sreg2 is the value, sreg3 is the comparand */
                        buf [0] = code;
-                       arm_ldaxrw (code, ARMREG_IP0, sreg1);
+                       arm_ldxrw (code, ARMREG_IP0, sreg1);
                        arm_cmpw (code, ARMREG_IP0, ins->sreg3);
                        buf [1] = code;
                        arm_bcc (code, ARMCOND_NE, 0);
@@ -3686,6 +3721,7 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
                        arm_cbnzw (code, ARMREG_IP1, buf [0]);
                        arm_patch_rel (buf [1], code, MONO_R_ARM64_BCC);
 
+                       arm_dmb (code, 0);
                        arm_movx (code, dreg, ARMREG_IP0);
                        break;
                }
@@ -3693,7 +3729,7 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
                        guint8 *buf [16];
 
                        buf [0] = code;
-                       arm_ldaxrx (code, ARMREG_IP0, sreg1);
+                       arm_ldxrx (code, ARMREG_IP0, sreg1);
                        arm_cmpx (code, ARMREG_IP0, ins->sreg3);
                        buf [1] = code;
                        arm_bcc (code, ARMCOND_NE, 0);
@@ -3701,41 +3737,54 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
                        arm_cbnzw (code, ARMREG_IP1, buf [0]);
                        arm_patch_rel (buf [1], code, MONO_R_ARM64_BCC);
 
+                       arm_dmb (code, 0);
                        arm_movx (code, dreg, ARMREG_IP0);
                        break;
                }
                case OP_ATOMIC_LOAD_I1: {
                        code = emit_addx_imm (code, ARMREG_LR, ins->inst_basereg, ins->inst_offset);
+                       if (ins->backend.memory_barrier_kind == MONO_MEMORY_BARRIER_SEQ)
+                               arm_dmb (code, 0);
                        arm_ldarb (code, ins->dreg, ARMREG_LR);
                        arm_sxtbx (code, ins->dreg, ins->dreg);
                        break;
                }
                case OP_ATOMIC_LOAD_U1: {
                        code = emit_addx_imm (code, ARMREG_LR, ins->inst_basereg, ins->inst_offset);
+                       if (ins->backend.memory_barrier_kind == MONO_MEMORY_BARRIER_SEQ)
+                               arm_dmb (code, 0);
                        arm_ldarb (code, ins->dreg, ARMREG_LR);
                        arm_uxtbx (code, ins->dreg, ins->dreg);
                        break;
                }
                case OP_ATOMIC_LOAD_I2: {
                        code = emit_addx_imm (code, ARMREG_LR, ins->inst_basereg, ins->inst_offset);
+                       if (ins->backend.memory_barrier_kind == MONO_MEMORY_BARRIER_SEQ)
+                               arm_dmb (code, 0);
                        arm_ldarh (code, ins->dreg, ARMREG_LR);
                        arm_sxthx (code, ins->dreg, ins->dreg);
                        break;
                }
                case OP_ATOMIC_LOAD_U2: {
                        code = emit_addx_imm (code, ARMREG_LR, ins->inst_basereg, ins->inst_offset);
+                       if (ins->backend.memory_barrier_kind == MONO_MEMORY_BARRIER_SEQ)
+                               arm_dmb (code, 0);
                        arm_ldarh (code, ins->dreg, ARMREG_LR);
                        arm_uxthx (code, ins->dreg, ins->dreg);
                        break;
                }
                case OP_ATOMIC_LOAD_I4: {
                        code = emit_addx_imm (code, ARMREG_LR, ins->inst_basereg, ins->inst_offset);
+                       if (ins->backend.memory_barrier_kind == MONO_MEMORY_BARRIER_SEQ)
+                               arm_dmb (code, 0);
                        arm_ldarw (code, ins->dreg, ARMREG_LR);
                        arm_sxtwx (code, ins->dreg, ins->dreg);
                        break;
                }
                case OP_ATOMIC_LOAD_U4: {
                        code = emit_addx_imm (code, ARMREG_LR, ins->inst_basereg, ins->inst_offset);
+                       if (ins->backend.memory_barrier_kind == MONO_MEMORY_BARRIER_SEQ)
+                               arm_dmb (code, 0);
                        arm_ldarw (code, ins->dreg, ARMREG_LR);
                        arm_movw (code, ins->dreg, ins->dreg); /* Clear upper half of the register. */
                        break;
@@ -3743,11 +3792,15 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
                case OP_ATOMIC_LOAD_I8:
                case OP_ATOMIC_LOAD_U8: {
                        code = emit_addx_imm (code, ARMREG_LR, ins->inst_basereg, ins->inst_offset);
+                       if (ins->backend.memory_barrier_kind == MONO_MEMORY_BARRIER_SEQ)
+                               arm_dmb (code, 0);
                        arm_ldarx (code, ins->dreg, ARMREG_LR);
                        break;
                }
                case OP_ATOMIC_LOAD_R4: {
                        code = emit_addx_imm (code, ARMREG_LR, ins->inst_basereg, ins->inst_offset);
+                       if (ins->backend.memory_barrier_kind == MONO_MEMORY_BARRIER_SEQ)
+                               arm_dmb (code, 0);
                        if (cfg->r4fp) {
                                arm_ldarw (code, ARMREG_LR, ARMREG_LR);
                                arm_fmov_rx_to_double (code, ins->dreg, ARMREG_LR);
@@ -3760,6 +3813,8 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
                }
                case OP_ATOMIC_LOAD_R8: {
                        code = emit_addx_imm (code, ARMREG_LR, ins->inst_basereg, ins->inst_offset);
+                       if (ins->backend.memory_barrier_kind == MONO_MEMORY_BARRIER_SEQ)
+                               arm_dmb (code, 0);
                        arm_ldarx (code, ARMREG_LR, ARMREG_LR);
                        arm_fmov_rx_to_double (code, ins->dreg, ARMREG_LR);
                        break;
@@ -3768,24 +3823,32 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
                case OP_ATOMIC_STORE_U1: {
                        code = emit_addx_imm (code, ARMREG_LR, ins->inst_destbasereg, ins->inst_offset);
                        arm_stlrb (code, ARMREG_LR, ins->sreg1);
+                       if (ins->backend.memory_barrier_kind == MONO_MEMORY_BARRIER_SEQ)
+                               arm_dmb (code, 0);
                        break;
                }
                case OP_ATOMIC_STORE_I2:
                case OP_ATOMIC_STORE_U2: {
                        code = emit_addx_imm (code, ARMREG_LR, ins->inst_destbasereg, ins->inst_offset);
                        arm_stlrh (code, ARMREG_LR, ins->sreg1);
+                       if (ins->backend.memory_barrier_kind == MONO_MEMORY_BARRIER_SEQ)
+                               arm_dmb (code, 0);
                        break;
                }
                case OP_ATOMIC_STORE_I4:
                case OP_ATOMIC_STORE_U4: {
                        code = emit_addx_imm (code, ARMREG_LR, ins->inst_destbasereg, ins->inst_offset);
                        arm_stlrw (code, ARMREG_LR, ins->sreg1);
+                       if (ins->backend.memory_barrier_kind == MONO_MEMORY_BARRIER_SEQ)
+                               arm_dmb (code, 0);
                        break;
                }
                case OP_ATOMIC_STORE_I8:
                case OP_ATOMIC_STORE_U8: {
                        code = emit_addx_imm (code, ARMREG_LR, ins->inst_destbasereg, ins->inst_offset);
                        arm_stlrx (code, ARMREG_LR, ins->sreg1);
+                       if (ins->backend.memory_barrier_kind == MONO_MEMORY_BARRIER_SEQ)
+                               arm_dmb (code, 0);
                        break;
                }
                case OP_ATOMIC_STORE_R4: {
@@ -3798,12 +3861,16 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
                                arm_fmov_double_to_rx (code, ARMREG_IP0, FP_TEMP_REG);
                                arm_stlrw (code, ARMREG_LR, ARMREG_IP0);
                        }
+                       if (ins->backend.memory_barrier_kind == MONO_MEMORY_BARRIER_SEQ)
+                               arm_dmb (code, 0);
                        break;
                }
                case OP_ATOMIC_STORE_R8: {
                        code = emit_addx_imm (code, ARMREG_LR, ins->inst_destbasereg, ins->inst_offset);
                        arm_fmov_double_to_rx (code, ARMREG_IP0, ins->sreg1);
                        arm_stlrx (code, ARMREG_LR, ARMREG_IP0);
+                       if (ins->backend.memory_barrier_kind == MONO_MEMORY_BARRIER_SEQ)
+                               arm_dmb (code, 0);
                        break;
                }
 
@@ -4915,14 +4982,14 @@ mono_arch_get_patch_offset (guint8 *code)
 }
 
 gpointer
-mono_arch_build_imt_thunk (MonoVTable *vtable, MonoDomain *domain, MonoIMTCheckItem **imt_entries, int count,
-                                                  gpointer fail_tramp)
+mono_arch_build_imt_trampoline (MonoVTable *vtable, MonoDomain *domain, MonoIMTCheckItem **imt_entries, int count,
+                                                               gpointer fail_tramp)
 {
        int i, buf_len, imt_reg;
        guint8 *buf, *code;
 
 #if DEBUG_IMT
-       printf ("building IMT thunk for class %s %s entries %d code size %d code at %p end %p vtable %p\n", vtable->klass->name_space, vtable->klass->name, count, size, start, ((guint8*)start) + size, vtable);
+       printf ("building IMT trampoline for class %s %s entries %d code size %d code at %p end %p vtable %p\n", vtable->klass->name_space, vtable->klass->name, count, size, start, ((guint8*)start) + size, vtable);
        for (i = 0; i < count; ++i) {
                MonoIMTCheckItem *item = imt_entries [i];
                printf ("method %d (%p) %s vtable slot %p is_equals %d chunk size %d\n", i, item->key, item->key->name, &vtable->vtable [item->value.vtable_slot], item->is_equals, item->chunk_size);
@@ -4957,7 +5024,7 @@ mono_arch_build_imt_thunk (MonoVTable *vtable, MonoDomain *domain, MonoIMTCheckI
        }
 
        if (fail_tramp)
-               buf = mono_method_alloc_generic_virtual_thunk (domain, buf_len);
+               buf = mono_method_alloc_generic_virtual_trampoline (domain, buf_len);
        else
                buf = mono_domain_code_reserve (domain, buf_len);
        code = buf;
@@ -5045,8 +5112,8 @@ mono_arch_get_trampolines (gboolean aot)
 #else /* DISABLE_JIT */
 
 gpointer
-mono_arch_build_imt_thunk (MonoVTable *vtable, MonoDomain *domain, MonoIMTCheckItem **imt_entries, int count,
-                                                  gpointer fail_tramp)
+mono_arch_build_imt_trampoline (MonoVTable *vtable, MonoDomain *domain, MonoIMTCheckItem **imt_entries, int count,
+                                                               gpointer fail_tramp)
 {
        g_assert_not_reached ();
        return NULL;
index e3e90eb6ea59bd350346001e0c5c22a065e4349e..a22a10af76105fc85ac1460970b5661a6ef21459 100644 (file)
@@ -130,7 +130,7 @@ typedef struct {
 #define MONO_ARCH_EXC_REG ARMREG_R0
 #define MONO_ARCH_HAVE_XP_UNWIND 1
 #define MONO_ARCH_HAVE_CREATE_DELEGATE_TRAMPOLINE 1
-#define MONO_ARCH_HAVE_GENERALIZED_IMT_THUNK 1
+#define MONO_ARCH_HAVE_GENERALIZED_IMT_TRAMPOLINE 1
 #define MONO_ARCH_USE_SIGACTION 1
 #define MONO_ARCH_HAVE_SIGCTX_TO_MONOCTX 1
 #define MONO_ARCH_HAVE_CONTEXT_SET_INT_REG 1
@@ -143,9 +143,7 @@ typedef struct {
 #define MONO_ARCH_DYN_CALL_SUPPORTED 1
 #define MONO_ARCH_DYN_CALL_PARAM_AREA (DYN_CALL_STACK_ARGS * 8)
 #define MONO_ARCH_SOFT_DEBUG_SUPPORTED 1
-#ifndef TARGET_ANDROID
 #define MONO_ARCH_GSHAREDVT_SUPPORTED 1
-#endif
 #define MONO_ARCH_HAVE_SETUP_RESUME_FROM_SIGNAL_HANDLER_CTX 1
 #define MONO_ARCH_HAVE_SETUP_ASYNC_CALLBACK 1
 #define MONO_ARCH_HAVE_GENERAL_RGCTX_LAZY_FETCH_TRAMPOLINE 1
index 57a7a38deef9f7845a8aaf94024d58955698e06e..876d35c635c87dabbcb0682569be6633970dcb94 100644 (file)
@@ -4,6 +4,8 @@
  * (C) 2003 Ximian, Inc.
  */
 
+#include "config.h"
+
 #include <string.h>
 #include <math.h>
 #ifdef HAVE_UNISTD_H
@@ -21,6 +23,8 @@
 #include "trace.h"
 #include "mini-arch.h"
 
+#ifndef DISABLE_JIT
+
 #ifndef MONO_MAX_XREGS
 
 #define MONO_MAX_XREGS 0
@@ -28,7 +32,6 @@
 #define MONO_ARCH_CALLEE_XREGS 0
 
 #endif
 
 #define MONO_ARCH_BANK_MIRRORED -2
 
@@ -411,47 +414,7 @@ typedef struct {
        regmask_t preferred_mask; /* the hreg where the register should be allocated, or 0 */
 } RegTrack;
 
-#if !defined(DISABLE_LOGGING) && !defined(DISABLE_JIT)
-
-static const char* const patch_info_str[] = {
-#define PATCH_INFO(a,b) "" #a,
-#include "patch-info.h"
-#undef PATCH_INFO
-};
-
-const char*
-mono_ji_type_to_string (MonoJumpInfoType type)
-{
-       return patch_info_str [type];
-}
-
-void
-mono_print_ji (const MonoJumpInfo *ji)
-{
-       switch (ji->type) {
-       case MONO_PATCH_INFO_RGCTX_FETCH: {
-               MonoJumpInfoRgctxEntry *entry = ji->data.rgctx_entry;
-
-               printf ("[RGCTX_FETCH ");
-               mono_print_ji (entry->data);
-               printf (" - %s]", mono_rgctx_info_type_to_str (entry->info_type));
-               break;
-       }
-       case MONO_PATCH_INFO_METHODCONST: {
-               char *s = mono_method_full_name (ji->data.method, TRUE);
-               printf ("[METHODCONST - %s]", s);
-               g_free (s);
-               break;
-       }
-       case MONO_PATCH_INFO_INTERNAL_METHOD: {
-               printf ("[INTERNAL_METHOD - %s]", ji->data.name);
-               break;
-       }
-       default:
-               printf ("[%s]", patch_info_str [ji->type]);
-               break;
-       }
-}
+#if !defined(DISABLE_LOGGING)
 
 void
 mono_print_ins_index (int i, MonoInst *ins)
@@ -785,22 +748,11 @@ print_regtrack (RegTrack *t, int num)
 }
 #else
 
-const char*
-mono_ji_type_to_string (MonoJumpInfoType type)
-{
-       return "";
-}
-
-void
-mono_print_ji (const MonoJumpInfo *ji)
-{
-}
-
 void
 mono_print_ins_index (int i, MonoInst *ins)
 {
 }
-#endif /* !defined(DISABLE_LOGGING) && !defined(DISABLE_JIT) */
+#endif /* !defined(DISABLE_LOGGING) */
 
 void
 mono_print_ins (MonoInst *ins)
@@ -1151,8 +1103,6 @@ get_callee_mask (const char spec)
 static gint8 desc_to_fixed_reg [256];
 static gboolean desc_to_fixed_reg_inited = FALSE;
 
-#ifndef DISABLE_JIT
-
 /*
  * Local register allocation.
  * We first scan the list of instructions and we save the liveness info of
@@ -2554,47 +2504,6 @@ mono_opcode_to_type (int opcode, int cmp_opcode)
        }
 }
 
-#endif /* DISABLE_JIT */
-
-gboolean
-mono_is_regsize_var (MonoType *t)
-{
-       t = mini_get_underlying_type (t);
-       switch (t->type) {
-       case MONO_TYPE_I1:
-       case MONO_TYPE_U1:
-       case MONO_TYPE_I2:
-       case MONO_TYPE_U2:
-       case MONO_TYPE_I4:
-       case MONO_TYPE_U4:
-       case MONO_TYPE_I:
-       case MONO_TYPE_U:
-       case MONO_TYPE_PTR:
-       case MONO_TYPE_FNPTR:
-#if SIZEOF_REGISTER == 8
-       case MONO_TYPE_I8:
-       case MONO_TYPE_U8:
-#endif
-               return TRUE;
-       case MONO_TYPE_OBJECT:
-       case MONO_TYPE_STRING:
-       case MONO_TYPE_CLASS:
-       case MONO_TYPE_SZARRAY:
-       case MONO_TYPE_ARRAY:
-               return TRUE;
-       case MONO_TYPE_GENERICINST:
-               if (!mono_type_generic_inst_is_valuetype (t))
-                       return TRUE;
-               return FALSE;
-       case MONO_TYPE_VALUETYPE:
-               return FALSE;
-       default:
-               return FALSE;
-       }
-}
-
-#ifndef DISABLE_JIT
-
 /*
  * mono_peephole_ins:
  *
@@ -2726,6 +2635,19 @@ mono_peephole_ins (MonoBasicBlock *bb, MonoInst *ins)
                        ins->sreg1 = last_ins->sreg1;
                }
                break;
+       case OP_LOADX_MEMBASE:
+               if (last_ins && last_ins->opcode == OP_STOREX_MEMBASE &&
+                       ins->inst_basereg == last_ins->inst_destbasereg &&
+                       ins->inst_offset == last_ins->inst_offset) {
+                       if (ins->dreg == last_ins->sreg1) {
+                               MONO_DELETE_INS (bb, ins);
+                               break;
+                       } else {
+                               ins->opcode = OP_XMOVE;
+                               ins->sreg1 = last_ins->sreg1;
+                       }
+               }
+               break;
        case OP_MOVE:
        case OP_FMOVE:
                /*
@@ -2844,3 +2766,40 @@ mono_regstate_free (MonoRegState *rs) {
 }
 
 #endif /* DISABLE_JIT */
+
+gboolean
+mono_is_regsize_var (MonoType *t)
+{
+       t = mini_get_underlying_type (t);
+       switch (t->type) {
+       case MONO_TYPE_I1:
+       case MONO_TYPE_U1:
+       case MONO_TYPE_I2:
+       case MONO_TYPE_U2:
+       case MONO_TYPE_I4:
+       case MONO_TYPE_U4:
+       case MONO_TYPE_I:
+       case MONO_TYPE_U:
+       case MONO_TYPE_PTR:
+       case MONO_TYPE_FNPTR:
+#if SIZEOF_REGISTER == 8
+       case MONO_TYPE_I8:
+       case MONO_TYPE_U8:
+#endif
+               return TRUE;
+       case MONO_TYPE_OBJECT:
+       case MONO_TYPE_STRING:
+       case MONO_TYPE_CLASS:
+       case MONO_TYPE_SZARRAY:
+       case MONO_TYPE_ARRAY:
+               return TRUE;
+       case MONO_TYPE_GENERICINST:
+               if (!mono_type_generic_inst_is_valuetype (t))
+                       return TRUE;
+               return FALSE;
+       case MONO_TYPE_VALUETYPE:
+               return FALSE;
+       default:
+               return FALSE;
+       }
+}
index a52f5eb80d06aef3137d018ac67b0940961f8460..4e632071ce2028c991303e2b827a93e61e2f0d8a 100644 (file)
@@ -166,8 +166,8 @@ gboolean
 mono_thread_state_init_from_handle (MonoThreadUnwindState *tctx, MonoThreadInfo *info)
 {
        kern_return_t ret;
-       mach_msg_type_number_t num_state;
-       thread_state_t state;
+       mach_msg_type_number_t num_state, num_fpstate;
+       thread_state_t state, fpstate;
        ucontext_t ctx;
        mcontext_t mctx;
        MonoJitTlsData *jit_tls;
@@ -183,15 +183,16 @@ mono_thread_state_init_from_handle (MonoThreadUnwindState *tctx, MonoThreadInfo
        tctx->unwind_data [MONO_UNWIND_DATA_JIT_TLS] = NULL;
 
        state = (thread_state_t) alloca (mono_mach_arch_get_thread_state_size ());
+       fpstate = (thread_state_t) alloca (mono_mach_arch_get_thread_fpstate_size ());
        mctx = (mcontext_t) alloca (mono_mach_arch_get_mcontext_size ());
 
        do {
-               ret = mono_mach_arch_get_thread_state (info->native_handle, state, &num_state);
+               ret = mono_mach_arch_get_thread_states (info->native_handle, state, &num_state, fpstate, &num_fpstate);
        } while (ret == KERN_ABORTED);
        if (ret != KERN_SUCCESS)
                return FALSE;
 
-       mono_mach_arch_thread_state_to_mcontext (state, mctx);
+       mono_mach_arch_thread_states_to_mcontext (state, fpstate, mctx);
        ctx.uc_mcontext = mctx;
 
        mono_sigctx_to_monoctx (&ctx, &tctx->ctx);
index d16cee8cee3daa00962ced9e1ed97a12959fc445..400940957fbd2e3c498784f371aaf5597e2de013 100644 (file)
@@ -94,6 +94,7 @@ static void restore_stack_protection (void);
 static void mono_walk_stack_full (MonoJitStackWalk func, MonoContext *start_ctx, MonoDomain *domain, MonoJitTlsData *jit_tls, MonoLMF *lmf, MonoUnwindOptions unwind_options, gpointer user_data);
 static void mono_raise_exception_with_ctx (MonoException *exc, MonoContext *ctx);
 static void mono_runtime_walk_stack_with_ctx (MonoJitStackWalk func, MonoContext *start_ctx, MonoUnwindOptions unwind_options, void *user_data);
+static gboolean mono_current_thread_has_handle_block_guard (void);
 
 void
 mono_exceptions_init (void)
@@ -136,6 +137,7 @@ mono_exceptions_init (void)
        cbs.mono_raise_exception_with_ctx = mono_raise_exception_with_ctx;
        cbs.mono_exception_walk_trace = mono_exception_walk_trace;
        cbs.mono_install_handler_block_guard = mono_install_handler_block_guard;
+       cbs.mono_current_thread_has_handle_block_guard = mono_current_thread_has_handle_block_guard;
        mono_install_eh_callbacks (&cbs);
 }
 
@@ -611,23 +613,23 @@ get_generic_context_from_stack_frame (MonoJitInfo *ji, gpointer generic_info)
                klass = vtable->klass;
        }
 
-       //g_assert (!method->klass->generic_container);
-       if (method->klass->generic_class)
-               method_container_class = method->klass->generic_class->container_class;
+       //g_assert (!mono_class_is_gtd (method->klass));
+       if (mono_class_is_ginst (method->klass))
+               method_container_class = mono_class_get_generic_class (method->klass)->container_class;
        else
                method_container_class = method->klass;
 
        /* class might refer to a subclass of method's class */
-       while (!(klass == method->klass || (klass->generic_class && klass->generic_class->container_class == method_container_class))) {
+       while (!(klass == method->klass || (mono_class_is_ginst (klass) && mono_class_get_generic_class (klass)->container_class == method_container_class))) {
                klass = klass->parent;
                g_assert (klass);
        }
 
-       if (klass->generic_class || klass->generic_container)
+       if (mono_class_is_ginst (klass) || mono_class_is_gtd (klass))
                context.class_inst = mini_class_get_context (klass)->class_inst;
 
-       if (klass->generic_class)
-               g_assert (mono_class_has_parent_and_ignore_generics (klass->generic_class->container_class, method_container_class));
+       if (mono_class_is_ginst (klass))
+               g_assert (mono_class_has_parent_and_ignore_generics (mono_class_get_generic_class (klass)->container_class, method_container_class));
        else
                g_assert (mono_class_has_parent_and_ignore_generics (klass, method_container_class));
 
@@ -1227,7 +1229,7 @@ wrap_non_exception_throws (MonoMethod *m)
 
        klass = mono_class_get_runtime_compat_attr_class ();
 
-       attrs = mono_custom_attrs_from_assembly_checked (ass, &error);
+       attrs = mono_custom_attrs_from_assembly_checked (ass, FALSE, &error);
        mono_error_cleanup (&error); /* FIXME don't swallow the error */
        if (attrs) {
                for (i = 0; i < attrs->num_attrs; ++i) {
@@ -1288,7 +1290,10 @@ build_native_trace (MonoError *error)
 #if defined (HAVE_BACKTRACE_SYMBOLS) && defined (TARGET_ARM)
        MonoArray *res;
        void *native_trace [MAX_UNMANAGED_BACKTRACE];
-       int size = backtrace (native_trace, MAX_UNMANAGED_BACKTRACE);
+       int size = -1;
+       MONO_ENTER_GC_SAFE;
+       size = backtrace (native_trace, MAX_UNMANAGED_BACKTRACE);
+       MONO_EXIT_GC_SAFE;
        int i;
 
        if (!size)
@@ -2058,13 +2063,13 @@ mono_setup_altstack (MonoJitTlsData *tls)
 
        if (mono_mprotect (tls->stack_ovf_guard_base, tls->stack_ovf_guard_size, MONO_MMAP_NONE)) {
                /* mprotect can fail for the main thread stack */
-               gpointer gaddr = mono_valloc (tls->stack_ovf_guard_base, tls->stack_ovf_guard_size, MONO_MMAP_NONE|MONO_MMAP_PRIVATE|MONO_MMAP_ANON|MONO_MMAP_FIXED);
+               gpointer gaddr = mono_valloc (tls->stack_ovf_guard_base, tls->stack_ovf_guard_size, MONO_MMAP_NONE|MONO_MMAP_PRIVATE|MONO_MMAP_ANON|MONO_MMAP_FIXED, MONO_MEM_ACCOUNT_EXCEPTIONS);
                g_assert (gaddr == tls->stack_ovf_guard_base);
                tls->stack_ovf_valloced = TRUE;
        }
 
        /* Setup an alternate signal stack */
-       tls->signal_stack = mono_valloc (0, MONO_ARCH_SIGNAL_STACK_SIZE, MONO_MMAP_READ|MONO_MMAP_WRITE|MONO_MMAP_PRIVATE|MONO_MMAP_ANON);
+       tls->signal_stack = mono_valloc (0, MONO_ARCH_SIGNAL_STACK_SIZE, MONO_MMAP_READ|MONO_MMAP_WRITE|MONO_MMAP_PRIVATE|MONO_MMAP_ANON, MONO_MEM_ACCOUNT_EXCEPTIONS);
        tls->signal_stack_size = MONO_ARCH_SIGNAL_STACK_SIZE;
 
        g_assert (tls->signal_stack);
@@ -2090,9 +2095,9 @@ mono_free_altstack (MonoJitTlsData *tls)
        g_assert (err == 0);
 
        if (tls->signal_stack)
-               mono_vfree (tls->signal_stack, MONO_ARCH_SIGNAL_STACK_SIZE);
+               mono_vfree (tls->signal_stack, MONO_ARCH_SIGNAL_STACK_SIZE, MONO_MEM_ACCOUNT_EXCEPTIONS);
        if (tls->stack_ovf_valloced)
-               mono_vfree (tls->stack_ovf_guard_base, tls->stack_ovf_guard_size);
+               mono_vfree (tls->stack_ovf_guard_base, tls->stack_ovf_guard_size, MONO_MEM_ACCOUNT_EXCEPTIONS);
        else
                mono_mprotect (tls->stack_ovf_guard_base, tls->stack_ovf_guard_size, MONO_MMAP_READ|MONO_MMAP_WRITE);
 }
@@ -2387,7 +2392,7 @@ mono_handle_native_sigsegv (int signal, void *ctx, MONO_SIG_HANDLER_INFO_TYPE *i
        for (i =0; i < size; ++i) {
                mono_runtime_printf_err ("\t%s", names [i]);
        }
-       free (names);
+       g_free (names);
 
        /* Try to get more meaningful information using gdb */
 
@@ -2502,7 +2507,7 @@ mono_print_thread_dump_internal (void *sigctx, MonoContext *start_ctx)
                g_string_append (text, "\n\"<unnamed thread>\"");
 
        g_string_append_printf (text, " tid=0x%p this=0x%p ", (gpointer)(gsize)thread->tid, thread);
-       mono_thread_info_describe ((MonoThreadInfo*) thread->thread_info, text);
+       mono_thread_internal_describe (thread, text);
        g_string_append (text, "\n");
 
 #ifdef MONO_ARCH_HAVE_SIGCTX_TO_MONOCTX
@@ -2676,6 +2681,13 @@ mono_install_handler_block_guard (MonoThreadUnwindState *ctx)
        return TRUE;
 }
 
+static gboolean
+mono_current_thread_has_handle_block_guard (void)
+{
+       MonoJitTlsData *jit_tls = (MonoJitTlsData *)mono_native_tls_get_value (mono_jit_tls_id);
+       return jit_tls && jit_tls->handler_block_return_address != NULL;
+}
+
 #else
 gboolean
 mono_install_handler_block_guard (MonoThreadUnwindState *ctx)
@@ -2683,6 +2695,12 @@ mono_install_handler_block_guard (MonoThreadUnwindState *ctx)
        return FALSE;
 }
 
+static gboolean
+mono_current_thread_has_handle_block_guard (void)
+{
+       return FALSE;
+}
+
 #endif
 
 void
@@ -2706,7 +2724,7 @@ mono_thread_state_init_from_sigctx (MonoThreadUnwindState *ctx, void *sigctx)
        MonoThreadInfo *thread = mono_thread_info_current_unchecked ();
        if (!thread) {
                ctx->valid = FALSE;
-               G_BREAKPOINT ();
+               g_error ("Invoked mono_thread_state_init_from_sigctx from non-Mono thread");
                return FALSE;
        }
 
index aca368c9dba9e1ad8ef382fa8e7532a93981ffe5..563a3a5b5de5caa4e94c8cbc673b04cb1e61ac32 100644 (file)
@@ -76,7 +76,7 @@ type_check_context_used (MonoType *type, gboolean recursive)
                if (recursive) {
                        MonoGenericClass *gclass = type->data.generic_class;
 
-                       g_assert (gclass->container_class->generic_container);
+                       g_assert (mono_class_is_gtd (gclass->container_class));
                        return mono_generic_context_check_used (&gclass->context);
                } else {
                        return 0;
@@ -137,10 +137,10 @@ mono_class_check_context_used (MonoClass *klass)
        context_used |= type_check_context_used (&klass->this_arg, FALSE);
        context_used |= type_check_context_used (&klass->byval_arg, FALSE);
 
-       if (klass->generic_class)
-               context_used |= mono_generic_context_check_used (&klass->generic_class->context);
-       else if (klass->generic_container)
-               context_used |= mono_generic_context_check_used (&klass->generic_container->context);
+       if (mono_class_is_ginst (klass))
+               context_used |= mono_generic_context_check_used (&mono_class_get_generic_class (klass)->context);
+       else if (mono_class_is_gtd (klass))
+               context_used |= mono_generic_context_check_used (&mono_class_get_generic_container (klass)->context);
 
        return context_used;
 }
@@ -274,8 +274,8 @@ register_generic_subclass (MonoClass *klass)
 
        g_assert (rgctx_template);
 
-       if (parent->generic_class)
-               parent = parent->generic_class->container_class;
+       if (mono_class_is_ginst (parent))
+               parent = mono_class_get_generic_class (parent)->container_class;
 
        if (!generic_subclass_hash)
                generic_subclass_hash = g_hash_table_new (mono_aligned_addr_hash, NULL);
@@ -475,21 +475,22 @@ mono_class_get_method_generic (MonoClass *klass, MonoMethod *method)
                declaring = method;
 
        m = NULL;
-       if (klass->generic_class)
+       if (mono_class_is_ginst (klass))
                m = mono_class_get_inflated_method (klass, declaring);
 
        if (!m) {
                mono_class_setup_methods (klass);
                if (mono_class_has_failure (klass))
                        return NULL;
-               for (i = 0; i < klass->method.count; ++i) {
+               int mcount = mono_class_get_method_count (klass);
+               for (i = 0; i < mcount; ++i) {
                        m = klass->methods [i];
                        if (m == declaring)
                                break;
                        if (m->is_inflated && mono_method_get_declaring_generic_method (m) == declaring)
                                break;
                }
-               if (i >= klass->method.count)
+               if (i >= mcount)
                        return NULL;
        }
 
@@ -734,8 +735,8 @@ class_get_rgctx_template_oti (MonoClass *klass, int type_argc, guint32 slot, gbo
 static MonoClass*
 class_uninstantiated (MonoClass *klass)
 {
-       if (klass->generic_class)
-               return klass->generic_class->container_class;
+       if (mono_class_is_ginst (klass))
+               return mono_class_get_generic_class (klass)->container_class;
        return klass;
 }
 
@@ -835,15 +836,15 @@ class_get_rgctx_template_oti (MonoClass *klass, int type_argc, guint32 slot, gbo
 
        DEBUG (printf ("get slot: %s %d\n", mono_type_full_name (&class->byval_arg), slot));
 
-       if (klass->generic_class && !shared) {
+       if (mono_class_is_ginst (klass) && !shared) {
                MonoRuntimeGenericContextInfoTemplate oti;
                gboolean tmp_do_free;
 
-               oti = class_get_rgctx_template_oti (klass->generic_class->container_class,
+               oti = class_get_rgctx_template_oti (mono_class_get_generic_class (klass)->container_class,
                                                                                        type_argc, slot, TRUE, FALSE, &tmp_do_free);
                if (oti.data) {
                        gpointer info = oti.data;
-                       oti.data = inflate_info (&oti, &klass->generic_class->context, klass, temporary);
+                       oti.data = inflate_info (&oti, &mono_class_get_generic_class (klass)->context, klass, temporary);
                        if (tmp_do_free)
                                free_inflated_info (oti.info_type, info);
                }
@@ -1118,7 +1119,7 @@ get_wrapper_shared_type (MonoType *t)
                        return get_wrapper_shared_type (&mono_defaults.object_class->byval_arg);
 
                klass = mono_class_from_mono_type (t);
-               orig_ctx = &klass->generic_class->context;
+               orig_ctx = &mono_class_get_generic_class (klass)->context;
 
                memset (&ctx, 0, sizeof (MonoGenericContext));
 
@@ -1136,7 +1137,7 @@ get_wrapper_shared_type (MonoType *t)
                                args [i] = get_wrapper_shared_type (inst->type_argv [i]);
                        ctx.method_inst = mono_metadata_get_generic_inst (inst->type_argc, args);
                }
-               klass = mono_class_inflate_generic_class_checked (klass->generic_class->container_class, &ctx, &error);
+               klass = mono_class_inflate_generic_class_checked (mono_class_get_generic_class (klass)->container_class, &ctx, &error);
                mono_error_assert_ok (&error); /* FIXME don't swallow the error */
                return &klass->byval_arg;
        }
@@ -1183,7 +1184,7 @@ mini_get_gsharedvt_in_sig_wrapper (MonoMethodSignature *sig)
        MonoMethod *res, *cached;
        WrapperInfo *info;
        MonoMethodSignature *csig, *gsharedvt_sig;
-       int i, pindex, retval_var;
+       int i, pindex, retval_var = 0;
        static GHashTable *cache;
 
        // FIXME: Memory management
@@ -1646,7 +1647,7 @@ instantiate_info (MonoDomain *domain, MonoRuntimeGenericContextInfoTemplate *oti
 
                mono_class_setup_vtable (info->klass);
                // FIXME: Check type load
-               if (iface_class->flags & TYPE_ATTRIBUTE_INTERFACE) {
+               if (mono_class_is_interface (iface_class)) {
                        ioffset = mono_class_interface_offset (info->klass, iface_class);
                        g_assert (ioffset != -1);
                } else {
@@ -1672,7 +1673,7 @@ instantiate_info (MonoDomain *domain, MonoRuntimeGenericContextInfoTemplate *oti
 
                mono_class_setup_vtable (info->klass);
                // FIXME: Check type load
-               if (iface_class->flags & TYPE_ATTRIBUTE_INTERFACE) {
+               if (mono_class_is_interface (iface_class)) {
                        ioffset = mono_class_interface_offset (info->klass, iface_class);
                        g_assert (ioffset != -1);
                } else {
@@ -1786,7 +1787,7 @@ instantiate_info (MonoDomain *domain, MonoRuntimeGenericContextInfoTemplate *oti
                                /* See mono_emit_method_call_full () */
                                /* The gsharedvt trampoline will recognize this constant */
                                vcall_offset = MONO_GSHAREDVT_DEL_INVOKE_VT_OFFSET;
-                       } else if (method->klass->flags & TYPE_ATTRIBUTE_INTERFACE) {
+                       } else if (mono_class_is_interface (method->klass)) {
                                guint32 imt_slot = mono_method_get_imt_slot (method);
                                vcall_offset = ((gint32)imt_slot - MONO_IMT_SIZE) * SIZEOF_VOID_P;
                        } else {
@@ -2058,8 +2059,8 @@ register_info (MonoClass *klass, int type_argc, gpointer data, MonoRgctxInfoType
                MonoRuntimeGenericContextTemplate *parent_template;
                MonoRuntimeGenericContextInfoTemplate *oti;
 
-               if (parent->generic_class)
-                       parent = parent->generic_class->container_class;
+               if (mono_class_is_ginst (parent))
+                       parent = mono_class_get_generic_class (parent)->container_class;
 
                parent_template = mono_class_get_runtime_generic_context_template (parent);
                oti = rgctx_template_get_other_slot (parent_template, type_argc, i);
@@ -2313,7 +2314,7 @@ fill_runtime_generic_context (MonoVTable *class_vtable, MonoRuntimeGenericContex
        int i, first_slot, size;
        MonoDomain *domain = class_vtable->domain;
        MonoClass *klass = class_vtable->klass;
-       MonoGenericContext *class_context = klass->generic_class ? &klass->generic_class->context : NULL;
+       MonoGenericContext *class_context = mono_class_is_ginst (klass) ? &mono_class_get_generic_class (klass)->context : NULL;
        MonoRuntimeGenericContextInfoTemplate oti;
        MonoGenericContext context = { class_context ? class_context->class_inst : NULL, method_inst };
        int rgctx_index;
@@ -2483,7 +2484,7 @@ mono_method_lookup_rgctx (MonoVTable *class_vtable, MonoGenericInst *method_inst
        MonoMethodRuntimeGenericContext *mrgctx;
        MonoMethodRuntimeGenericContext key;
 
-       g_assert (!class_vtable->klass->generic_container);
+       g_assert (!mono_class_is_gtd (class_vtable->klass));
        g_assert (!method_inst->is_open);
 
        mono_domain_lock (domain);
@@ -2634,7 +2635,7 @@ mono_method_is_generic_impl (MonoMethod *method)
           if not compiled with sharing. */
        if (method->wrapper_type != MONO_WRAPPER_NONE)
                return FALSE;
-       if (method->klass->generic_container)
+       if (mono_class_is_gtd (method->klass))
                return TRUE;
        return FALSE;
 }
@@ -2786,18 +2787,18 @@ mono_method_is_generic_sharable_full (MonoMethod *method, gboolean allow_type_va
                }
        }
 
-       if (method->klass->generic_class) {
-               if (!mono_generic_context_is_sharable_full (&method->klass->generic_class->context, allow_type_vars, allow_partial))
+       if (mono_class_is_ginst (method->klass)) {
+               if (!mono_generic_context_is_sharable_full (&mono_class_get_generic_class (method->klass)->context, allow_type_vars, allow_partial))
                        return FALSE;
 
-               g_assert (method->klass->generic_class->container_class &&
-                               method->klass->generic_class->container_class->generic_container);
+               g_assert (mono_class_get_generic_class (method->klass)->container_class &&
+                               mono_class_is_gtd (mono_class_get_generic_class (method->klass)->container_class));
 
-               if (has_constraints (method->klass->generic_class->container_class->generic_container))
+               if (has_constraints (mono_class_get_generic_container (mono_class_get_generic_class (method->klass)->container_class)))
                        return FALSE;
        }
 
-       if (method->klass->generic_container && !allow_type_vars)
+       if (mono_class_is_gtd (method->klass) && !allow_type_vars)
                return FALSE;
 
        /* This does potentially expensive cattr checks, so do it at the end */
@@ -2838,7 +2839,7 @@ mono_method_needs_static_rgctx_invoke (MonoMethod *method, gboolean allow_type_v
 
        return ((method->flags & METHOD_ATTRIBUTE_STATIC) ||
                        method->klass->valuetype) &&
-               (method->klass->generic_class || method->klass->generic_container);
+               (mono_class_is_ginst (method->klass) || mono_class_is_gtd (method->klass));
 }
 
 static MonoGenericInst*
@@ -2867,9 +2868,9 @@ mono_method_construct_object_context (MonoMethod *method)
 {
        MonoGenericContext object_context;
 
-       g_assert (!method->klass->generic_class);
-       if (method->klass->generic_container) {
-               int type_argc = method->klass->generic_container->type_argc;
+       g_assert (!mono_class_is_ginst (method->klass));
+       if (mono_class_is_gtd (method->klass)) {
+               int type_argc = mono_class_get_generic_container (method->klass)->type_argc;
 
                object_context.class_inst = get_object_generic_inst (type_argc);
        } else {
@@ -3003,10 +3004,10 @@ mono_generic_context_equal_deep (MonoGenericContext *context1, MonoGenericContex
 MonoClass*
 mini_class_get_container_class (MonoClass *klass)
 {
-       if (klass->generic_class)
-               return klass->generic_class->container_class;
+       if (mono_class_is_ginst (klass))
+               return mono_class_get_generic_class (klass)->container_class;
 
-       g_assert (klass->generic_container);
+       g_assert (mono_class_is_gtd (klass));
        return klass;
 }
 
@@ -3019,11 +3020,11 @@ mini_class_get_container_class (MonoClass *klass)
 MonoGenericContext*
 mini_class_get_context (MonoClass *klass)
 {
-       if (klass->generic_class)
-               return &klass->generic_class->context;
+       if (mono_class_is_ginst (klass))
+               return &mono_class_get_generic_class (klass)->context;
 
-       g_assert (klass->generic_container);
-       return &klass->generic_container->context;
+       g_assert (mono_class_is_gtd (klass));
+       return &mono_class_get_generic_container (klass)->context;
 }
 
 /*
@@ -3205,10 +3206,10 @@ mini_type_is_vtype (MonoType *t)
 gboolean
 mini_class_is_generic_sharable (MonoClass *klass)
 {
-       if (klass->generic_class && is_async_state_machine_class (klass))
+       if (mono_class_is_ginst (klass) && is_async_state_machine_class (klass))
                return FALSE;
 
-       return (klass->generic_class && mono_generic_context_is_sharable (&klass->generic_class->context, FALSE));
+       return (mono_class_is_ginst (klass) && mono_generic_context_is_sharable (&mono_class_get_generic_class (klass)->context, FALSE));
 }
 
 gboolean
@@ -3351,9 +3352,9 @@ get_shared_type (MonoType *t, MonoType *type)
 
                memset (&context, 0, sizeof (context));
                if (gclass->context.class_inst)
-                       context.class_inst = get_shared_inst (gclass->context.class_inst, gclass->container_class->generic_container->context.class_inst, NULL, FALSE, FALSE, TRUE);
+                       context.class_inst = get_shared_inst (gclass->context.class_inst, mono_class_get_generic_container (gclass->container_class)->context.class_inst, NULL, FALSE, FALSE, TRUE);
                if (gclass->context.method_inst)
-                       context.method_inst = get_shared_inst (gclass->context.method_inst, gclass->container_class->generic_container->context.method_inst, NULL, FALSE, FALSE, TRUE);
+                       context.method_inst = get_shared_inst (gclass->context.method_inst, mono_class_get_generic_container (gclass->container_class)->context.method_inst, NULL, FALSE, FALSE, TRUE);
 
                k = mono_class_inflate_generic_class_checked (gclass->container_class, &context, &error);
                mono_error_assert_ok (&error); /* FIXME don't swallow the error */
@@ -3436,7 +3437,27 @@ mini_get_shared_method_full (MonoMethod *method, gboolean all_vt, gboolean is_gs
        MonoGenericContext *context = mono_method_get_context (method);
        MonoGenericInst *inst;
 
-       if (method->is_generic || (method->klass->generic_container && !method->is_inflated)) {
+       /*
+        * Instead of creating a shared version of the wrapper, create a shared version of the original
+        * method and construct a wrapper for it. Otherwise, we could end up with two copies of the
+        * same wrapper, breaking AOT which assumes wrappers are unique.
+        * FIXME: Add other cases.
+        */
+       if (method->wrapper_type == MONO_WRAPPER_SYNCHRONIZED) {
+               MonoMethod *wrapper = mono_marshal_method_from_wrapper (method);
+
+               return mono_marshal_get_synchronized_wrapper (mini_get_shared_method_full (wrapper, all_vt, is_gsharedvt));
+       }
+       if (method->wrapper_type == MONO_WRAPPER_DELEGATE_INVOKE) {
+               WrapperInfo *info = mono_marshal_get_wrapper_info (method);
+
+               if (info->subtype == WRAPPER_SUBTYPE_NONE) {
+                       MonoMethod *m = mono_marshal_get_delegate_invoke (mini_get_shared_method_full (info->d.delegate_invoke.method, all_vt, is_gsharedvt), NULL);
+                       return m;
+               }
+       }
+
+       if (method->is_generic || (mono_class_is_gtd (method->klass) && !method->is_inflated)) {
                declaring_method = method;
        } else {
                declaring_method = mono_method_get_declaring_generic_method (method);
@@ -3446,14 +3467,14 @@ mini_get_shared_method_full (MonoMethod *method, gboolean all_vt, gboolean is_gs
        if (declaring_method->is_generic)
                shared_context = mono_method_get_generic_container (declaring_method)->context;
        else
-               shared_context = declaring_method->klass->generic_container->context;
+               shared_context = mono_class_get_generic_container (declaring_method->klass)->context;
 
        if (!is_gsharedvt)
                partial = mono_method_is_generic_sharable_full (method, FALSE, TRUE, FALSE);
 
        gsharedvt = is_gsharedvt || (!partial && mini_is_gsharedvt_sharable_method (method));
 
-       class_container = declaring_method->klass->generic_container;
+       class_container = mono_class_try_get_generic_container (declaring_method->klass); //FIXME is this a case for a try_get?
        method_container = mono_method_get_generic_container (declaring_method);
 
        /*
index d88a6c99a8f362bb690424ace4462d58f3d913d9..4cd9b377e3e2c933f1a7354396eef49194c34f3e 100644 (file)
@@ -21,7 +21,7 @@
 #include <mono/metadata/threads.h>
 #include <mono/metadata/profiler-private.h>
 #include <mono/utils/mono-math.h>
-#include <mono/utils/mono-hwcap-ia64.h>
+#include <mono/utils/mono-hwcap.h>
 
 #include "trace.h"
 #include "mini-ia64.h"
@@ -4532,8 +4532,8 @@ mono_arch_free_jit_tls_data (MonoJitTlsData *tls)
  * LOCKING: called with the domain lock held
  */
 gpointer
-mono_arch_build_imt_thunk (MonoVTable *vtable, MonoDomain *domain, MonoIMTCheckItem **imt_entries, int count,
-       gpointer fail_tramp)
+mono_arch_build_imt_trampoline (MonoVTable *vtable, MonoDomain *domain, MonoIMTCheckItem **imt_entries, int count,
+                                                               gpointer fail_tramp)
 {
        int i;
        int size = 0;
@@ -4613,7 +4613,7 @@ mono_arch_build_imt_thunk (MonoVTable *vtable, MonoDomain *domain, MonoIMTCheckI
 
        size = code.buf - buf;
        if (fail_tramp) {
-               start = mono_method_alloc_generic_virtual_thunk (domain, size + 16);
+               start = mono_method_alloc_generic_virtual_trampoline (domain, size + 16);
                start = (gpointer)ALIGN_TO (start, 16);
        } else {
                start = mono_domain_code_reserve (domain, size);
index bcb30ead561a6eca9a86a91aacca174989697d5c..bfee9d5c5480a3f0b0fb876524f6952cf2a5ef79 100644 (file)
@@ -109,6 +109,6 @@ unw_dyn_region_info_t* mono_ia64_create_unwind_region (Ia64CodegenState *code);
 
 #define MONO_ARCH_HAVE_INVALIDATE_METHOD 1
 #define MONO_ARCH_HAVE_SAVE_UNWIND_INFO 1
-#define MONO_ARCH_HAVE_GENERALIZED_IMT_THUNK 1
+#define MONO_ARCH_HAVE_GENERALIZED_IMT_TRAMPOLINE 1
 
 #endif /* __MONO_MINI_IA64_H__ */  
index 1bf14393db25142339add6f35a4e311d3ccbc728..a93ee9d9111282efa41f7bbf365408f93ad5f96b 100644 (file)
@@ -233,7 +233,7 @@ void
 mono_llvm_set_call_notail (LLVMValueRef func)
 {
 #if LLVM_API_VERSION > 100
-       //unwrap<CallInst>(func)->setTailCallKind (CallInst::TailCallKind::TCK_NoTail);
+       unwrap<CallInst>(func)->setTailCallKind (CallInst::TailCallKind::TCK_NoTail);
 #endif
 }
 
index 61f3730f520383cefbc8fb9fc89b5d279f097cf4..c403278c753feadc52a526f997f447468b8f2e97 100644 (file)
@@ -6,7 +6,8 @@
  * Licensed under the MIT license. See LICENSE file in the project root for full license information.
  */
 
-#include "mini.h"
+#include "config.h"
+
 #include <mono/metadata/debug-helpers.h>
 #include <mono/metadata/debug-mono-symfile.h>
 #include <mono/metadata/mempool-internals.h>
@@ -33,6 +34,8 @@
 #include "aot-compiler.h"
 #include "mini-llvm.h"
 
+#ifndef DISABLE_JIT
+
 #ifdef __MINGW32__
 
 #include <stddef.h>
@@ -148,6 +151,7 @@ typedef struct {
        LLVMValueRef rgctx_arg;
        LLVMValueRef this_arg;
        LLVMTypeRef *vreg_types;
+       gboolean *is_vphi;
        LLVMTypeRef method_type;
        LLVMBasicBlockRef init_bb, inited_bb;
        gboolean *is_dead;
@@ -170,6 +174,7 @@ typedef struct {
        GPtrArray *bblock_list;
        char *method_name;
        GHashTable *jit_callees;
+       LLVMValueRef long_bb_break_var;
 } EmitContext;
 
 typedef struct {
@@ -353,6 +358,36 @@ simd_class_to_llvm_type (EmitContext *ctx, MonoClass *klass)
                return LLVMVectorType (LLVMInt8Type (), 16);
        } else if (!strcmp (klass->name, "Vector16b")) {
                return LLVMVectorType (LLVMInt8Type (), 16);
+       } else if (!strcmp (klass->name, "Vector2")) {
+               /* System.Numerics */
+               return LLVMVectorType (LLVMFloatType (), 4);
+       } else if (!strcmp (klass->name, "Vector3")) {
+               return LLVMVectorType (LLVMFloatType (), 4);
+       } else if (!strcmp (klass->name, "Vector4")) {
+               return LLVMVectorType (LLVMFloatType (), 4);
+       } else if (!strcmp (klass->name, "Vector`1")) {
+               MonoType *etype = mono_class_get_generic_class (klass)->context.class_inst->type_argv [0];
+               switch (etype->type) {
+               case MONO_TYPE_I1:
+               case MONO_TYPE_U1:
+                       return LLVMVectorType (LLVMInt8Type (), 16);
+               case MONO_TYPE_I2:
+               case MONO_TYPE_U2:
+                       return LLVMVectorType (LLVMInt16Type (), 8);
+               case MONO_TYPE_I4:
+               case MONO_TYPE_U4:
+                       return LLVMVectorType (LLVMInt32Type (), 4);
+               case MONO_TYPE_I8:
+               case MONO_TYPE_U8:
+                       return LLVMVectorType (LLVMInt64Type (), 2);
+               case MONO_TYPE_R4:
+                       return LLVMVectorType (LLVMFloatType (), 4);
+               case MONO_TYPE_R8:
+                       return LLVMVectorType (LLVMDoubleType (), 2);
+               default:
+                       g_assert_not_reached ();
+                       return NULL;
+               }
        } else {
                printf ("%s\n", klass->name);
                NOT_IMPLEMENTED;
@@ -911,6 +946,8 @@ simd_op_to_intrins (int opcode)
                return "llvm.x86.sse2.pmulh.w";
        case OP_PMULW_HIGH_UN:
                return "llvm.x86.sse2.pmulhu.w";
+       case OP_DPPS:
+               return "llvm.x86.sse41.dpps";
 #endif
        default:
                g_assert_not_reached ();
@@ -1739,6 +1776,8 @@ get_handler_clause (MonoCompile *cfg, MonoBasicBlock *bb)
 static MonoExceptionClause *
 get_most_deep_clause (MonoCompile *cfg, EmitContext *ctx, MonoBasicBlock *bb)
 {
+       if (bb == cfg->bb_init)
+               return NULL;
        // Since they're sorted by nesting we just need
        // the first one that the bb is a member of
        for (int i = 0; i < cfg->header->num_clauses; i++) {
@@ -3483,6 +3522,9 @@ process_call (EmitContext *ctx, MonoBasicBlock *bb, LLVMBuilderRef *builder_ref,
 
        lcall = emit_call (ctx, bb, &builder, callee, args, LLVMCountParamTypes (llvm_sig));
 
+       if (ins->opcode != OP_TAILCALL && LLVMGetInstructionOpcode (lcall) == LLVMCall)
+               mono_llvm_set_call_notail (lcall);
+
        /*
         * Modify cconv and parameter attributes to pass rgctx/imt correctly.
         */
@@ -4150,13 +4192,36 @@ process_bb (EmitContext *ctx, MonoBasicBlock *bb)
                if (nins > 1000) {
                        /*
                         * Some steps in llc are non-linear in the size of basic blocks, see #5714.
-                        * Start a new bblock. If the llvm optimization passes merge these, we
-                        * can work around that by doing a volatile load + cond branch from
-                        * localloc-ed memory.
+                        * Start a new bblock.
+                        * Prevent the bblocks to be merged by doing a volatile load + cond branch
+                        * from localloc-ed memory.
                         */
-                       //set_failure (ctx, "basic block too long");
+                       if (!cfg->llvm_only)
+                               ;//set_failure (ctx, "basic block too long");
+
+                       if (!ctx->long_bb_break_var) {
+                               ctx->long_bb_break_var = build_alloca_llvm_type_name (ctx, LLVMInt32Type (), 0, "long_bb_break");
+                               mono_llvm_build_store (ctx->alloca_builder, LLVMConstInt (LLVMInt32Type (), 0, FALSE), ctx->long_bb_break_var, TRUE, LLVM_BARRIER_NONE);
+                       }
+
                        cbb = gen_bb (ctx, "CONT_LONG_BB");
-                       LLVMBuildBr (ctx->builder, cbb);
+                       LLVMBasicBlockRef dummy_bb = gen_bb (ctx, "CONT_LONG_BB_DUMMY");
+
+                       LLVMValueRef load = mono_llvm_build_load (builder, ctx->long_bb_break_var, "", TRUE);
+                       /*
+                        * The long_bb_break_var is initialized to 0 in the prolog, so this branch will always go to 'cbb'
+                        * but llvm doesn't know that, so the branch is not going to be eliminated.
+                        */
+                       LLVMValueRef cmp = LLVMBuildICmp (builder, LLVMIntEQ, load, LLVMConstInt (LLVMInt32Type (), 0, FALSE), "");
+
+                       LLVMBuildCondBr (builder, cmp, cbb, dummy_bb);
+
+                       /* Emit a dummy false bblock which does nothing but contains a volatile store so it cannot be eliminated */
+                       ctx->builder = builder = create_builder (ctx);
+                       LLVMPositionBuilderAtEnd (builder, dummy_bb);
+                       mono_llvm_build_store (builder, LLVMConstInt (LLVMInt32Type (), 1, FALSE), ctx->long_bb_break_var, TRUE, LLVM_BARRIER_NONE);
+                       LLVMBuildBr (builder, cbb);
+
                        ctx->builder = builder = create_builder (ctx);
                        LLVMPositionBuilderAtEnd (builder, cbb);
                        ctx->bblocks [bb->block_num].end_bblock = cbb;
@@ -5375,6 +5440,17 @@ process_bb (EmitContext *ctx, MonoBasicBlock *bb)
                        values [ins->dreg] = LLVMBuildSelect (builder, v, lhs, rhs, dname);
                        break;
                }
+
+/*
+ * See the ARM64 comment in mono/utils/atomic.h for an explanation of why this
+ * hack is necessary (for now).
+ */
+#ifdef TARGET_ARM64
+#define ARM64_ATOMIC_FENCE_FIX mono_llvm_build_fence (builder, LLVM_BARRIER_SEQ)
+#else
+#define ARM64_ATOMIC_FENCE_FIX
+#endif
+
                case OP_ATOMIC_EXCHANGE_I4:
                case OP_ATOMIC_EXCHANGE_I8: {
                        LLVMValueRef args [2];
@@ -5390,7 +5466,9 @@ process_bb (EmitContext *ctx, MonoBasicBlock *bb)
                        args [0] = convert (ctx, lhs, LLVMPointerType (t, 0));
                        args [1] = convert (ctx, rhs, t);
 
+                       ARM64_ATOMIC_FENCE_FIX;
                        values [ins->dreg] = mono_llvm_build_atomic_rmw (builder, LLVM_ATOMICRMW_OP_XCHG, args [0], args [1]);
+                       ARM64_ATOMIC_FENCE_FIX;
                        break;
                }
                case OP_ATOMIC_ADD_I4:
@@ -5407,7 +5485,9 @@ process_bb (EmitContext *ctx, MonoBasicBlock *bb)
 
                        args [0] = convert (ctx, lhs, LLVMPointerType (t, 0));
                        args [1] = convert (ctx, rhs, t);
+                       ARM64_ATOMIC_FENCE_FIX;
                        values [ins->dreg] = LLVMBuildAdd (builder, mono_llvm_build_atomic_rmw (builder, LLVM_ATOMICRMW_OP_ADD, args [0], args [1]), args [1], dname);
+                       ARM64_ATOMIC_FENCE_FIX;
                        break;
                }
                case OP_ATOMIC_CAS_I4:
@@ -5425,7 +5505,9 @@ process_bb (EmitContext *ctx, MonoBasicBlock *bb)
                        args [1] = convert (ctx, values [ins->sreg3], t);
                        /* new value */
                        args [2] = convert (ctx, values [ins->sreg2], t);
+                       ARM64_ATOMIC_FENCE_FIX;
                        val = mono_llvm_build_cmpxchg (builder, args [0], args [1], args [2]);
+                       ARM64_ATOMIC_FENCE_FIX;
                        /* cmpxchg returns a pair */
                        values [ins->dreg] = LLVMBuildExtractValue (builder, val, 0, "");
                        break;
@@ -5466,7 +5548,9 @@ process_bb (EmitContext *ctx, MonoBasicBlock *bb)
 
                        addr = convert (ctx, addr, LLVMPointerType (t, 0));
 
+                       ARM64_ATOMIC_FENCE_FIX;
                        values [ins->dreg] = emit_load_general (ctx, bb, &builder, size, addr, lhs, dname, is_volatile, barrier);
+                       ARM64_ATOMIC_FENCE_FIX;
 
                        if (sext)
                                values [ins->dreg] = LLVMBuildSExt (builder, values [ins->dreg], LLVMInt32Type (), dname);
@@ -5514,7 +5598,9 @@ process_bb (EmitContext *ctx, MonoBasicBlock *bb)
                        addr = LLVMBuildGEP (builder, convert (ctx, base, LLVMPointerType (t, 0)), &index, 1, "");
                        value = convert (ctx, values [ins->sreg1], t);
 
+                       ARM64_ATOMIC_FENCE_FIX;
                        emit_store_general (ctx, bb, &builder, size, value, addr, base, is_volatile, barrier);
+                       ARM64_ATOMIC_FENCE_FIX;
                        break;
                }
                case OP_RELAXED_NOP: {
@@ -6387,6 +6473,18 @@ process_bb (EmitContext *ctx, MonoBasicBlock *bb)
                        break;
                }
 
+               case OP_DPPS: {
+                       LLVMValueRef args [3];
+
+                       args [0] = lhs;
+                       args [1] = rhs;
+                       /* 0xf1 == multiply all 4 elements, add them together, and store the result to the lowest element */
+                       args [2] = LLVMConstInt (LLVMInt32Type (), 0xf1, FALSE);
+
+                       values [ins->dreg] = LLVMBuildCall (builder, get_intrinsic (ctx, simd_op_to_intrins (ins->opcode)), args, 3, dname);
+                       break;
+               }
+
 #endif /* SIMD */
 
                case OP_DUMMY_USE:
@@ -6521,7 +6619,7 @@ process_bb (EmitContext *ctx, MonoBasicBlock *bb)
 
                /* Convert the value to the type required by phi nodes */
                if (spec [MONO_INST_DEST] != ' ' && !MONO_IS_STORE_MEMBASE (ins) && ctx->vreg_types [ins->dreg]) {
-                       if (!values [ins->dreg])
+                       if (ctx->is_vphi [ins->dreg])
                                /* vtypes */
                                values [ins->dreg] = addresses [ins->dreg];
                        else
@@ -6670,6 +6768,7 @@ free_ctx (EmitContext *ctx)
        g_free (ctx->values);
        g_free (ctx->addresses);
        g_free (ctx->vreg_types);
+       g_free (ctx->is_vphi);
        g_free (ctx->vreg_cli_types);
        g_free (ctx->is_dead);
        g_free (ctx->unreachable);
@@ -6730,6 +6829,7 @@ mono_llvm_emit_method (MonoCompile *cfg)
         */
        ctx->addresses = g_new0 (LLVMValueRef, cfg->next_vreg);
        ctx->vreg_types = g_new0 (LLVMTypeRef, cfg->next_vreg);
+       ctx->is_vphi = g_new0 (gboolean, cfg->next_vreg);
        ctx->vreg_cli_types = g_new0 (MonoType*, cfg->next_vreg);
        ctx->phi_values = g_ptr_array_sized_new (256);
        /* 
@@ -7078,8 +7178,11 @@ emit_method_inner (EmitContext *ctx)
                                for (i = 0; i < ins->inst_phi_args [0]; i++) {
                                        int sreg1 = ins->inst_phi_args [i + 1];
                                        
-                                       if (sreg1 != -1)
+                                       if (sreg1 != -1) {
+                                               if (ins->opcode == OP_VPHI)
+                                                       ctx->is_vphi [sreg1] = TRUE;
                                                ctx->vreg_types [sreg1] = phi_type;
+                                       }
                                }
                                break;
                                }
@@ -7241,7 +7344,11 @@ emit_method_inner (EmitContext *ctx)
                ctx->module->max_method_idx = MAX (ctx->module->max_method_idx, cfg->method_index);
 
                // FIXME: beforefieldinit
-               if (ctx->has_got_access || mono_class_get_cctor (cfg->method->klass)) {
+               /*
+                * NATIVE_TO_MANAGED methods might be called on a thread not attached to the runtime, so they are initialized when loaded
+                * in load_method ().
+                */
+               if ((ctx->has_got_access || mono_class_get_cctor (cfg->method->klass)) && !(cfg->method->wrapper_type == MONO_WRAPPER_NATIVE_TO_MANAGED)) {
                        /*
                         * linkonce methods shouldn't have initialization,
                         * because they might belong to assemblies which
@@ -7795,6 +7902,7 @@ typedef enum {
        INTRINS_SSE_PSUBUSB,
        INTRINS_SSE_PAVGB,
        INTRINS_SSE_PAUSE,
+       INTRINS_SSE_DPPS,
 #endif
        INTRINS_NUM
 } IntrinsicId;
@@ -7876,7 +7984,8 @@ static IntrinsicDesc intrinsics[] = {
        {INTRINS_SSE_PADDUSB, "llvm.x86.sse2.paddus.b"},
        {INTRINS_SSE_PSUBUSB, "llvm.x86.sse2.psubus.b"},
        {INTRINS_SSE_PAVGB, "llvm.x86.sse2.pavg.b"},
-       {INTRINS_SSE_PAUSE, "llvm.x86.sse2.pause"}
+       {INTRINS_SSE_PAUSE, "llvm.x86.sse2.pause"},
+       {INTRINS_SSE_DPPS, "llvm.x86.sse41.dpps"}
 #endif
 };
 
@@ -8109,6 +8218,13 @@ add_intrinsic (LLVMModuleRef module, int id)
        case INTRINS_SSE_PAUSE:
                AddFunc (module, "llvm.x86.sse2.pause", LLVMVoidType (), NULL, 0);
                break;
+       case INTRINS_SSE_DPPS:
+               ret_type = type_to_simd_type (MONO_TYPE_R4);
+               arg_types [0] = type_to_simd_type (MONO_TYPE_R4);
+               arg_types [1] = type_to_simd_type (MONO_TYPE_R4);
+               arg_types [2] = LLVMInt32Type ();
+               AddFunc (module, name, ret_type, arg_types, 3);
+               break;
 #endif
        default:
                g_assert_not_reached ();
@@ -8332,7 +8448,7 @@ mono_llvm_create_aot_module (MonoAssembly *assembly, const char *global_prefix,
        module->llvm_only = llvm_only;
        /* The first few entries are reserved */
        module->max_got_offset = 16;
-       module->context = LLVMContextCreate ();
+       module->context = LLVMGetGlobalContext ();
 
        if (llvm_only)
                /* clang ignores our debug info because it has an invalid version */
@@ -8585,7 +8701,7 @@ emit_aot_file_info (MonoLLVMModule *module)
        if (info->trampoline_size [0]) {
                fields [tindex ++] = AddJitGlobal (module, eltype, "specific_trampolines");
                fields [tindex ++] = AddJitGlobal (module, eltype, "static_rgctx_trampolines");
-               fields [tindex ++] = AddJitGlobal (module, eltype, "imt_thunks");
+               fields [tindex ++] = AddJitGlobal (module, eltype, "imt_trampolines");
                fields [tindex ++] = AddJitGlobal (module, eltype, "gsharedvt_arg_trampolines");
        } else {
                fields [tindex ++] = LLVMConstNull (eltype);
@@ -9140,3 +9256,27 @@ default_mono_llvm_unhandled_exception (void)
  *   code.
  * - use pointer types to help optimizations.
  */
+
+#else /* DISABLE_JIT */
+
+void
+mono_llvm_cleanup (void)
+{
+}
+
+void
+mono_llvm_free_domain_info (MonoDomain *domain)
+{
+}
+
+void
+mono_llvm_init (void)
+{
+}
+
+void
+default_mono_llvm_unhandled_exception (void)
+{
+}
+
+#endif /* DISABLE_JIT */
index 5d6ebc7b6bc126975df54bdc38c29d247d5ca8d0..ea7474dd28bbfbfdd1a6bf703467bf5e23b37141 100644 (file)
@@ -19,7 +19,7 @@
 #include <mono/metadata/appdomain.h>
 #include <mono/metadata/debug-helpers.h>
 #include <mono/utils/mono-mmap.h>
-#include <mono/utils/mono-hwcap-mips.h>
+#include <mono/utils/mono-hwcap.h>
 
 #include <mono/arch/mips/mips-codegen.h>
 
@@ -714,8 +714,8 @@ mono_arch_init (void)
 {
        mono_os_mutex_init_recursive (&mini_arch_mutex);
 
-       ss_trigger_page = mono_valloc (NULL, mono_pagesize (), MONO_MMAP_READ|MONO_MMAP_32BIT);
-       bp_trigger_page = mono_valloc (NULL, mono_pagesize (), MONO_MMAP_READ|MONO_MMAP_32BIT);
+       ss_trigger_page = mono_valloc (NULL, mono_pagesize (), MONO_MMAP_READ|MONO_MMAP_32BIT, MONO_MEM_ACCOUNT_OTHER);
+       bp_trigger_page = mono_valloc (NULL, mono_pagesize (), MONO_MMAP_READ|MONO_MMAP_32BIT, MONO_MEM_ACCOUNT_OTHER);
        mono_mprotect (bp_trigger_page, mono_pagesize (), 0);
 }
 
@@ -2175,12 +2175,6 @@ mono_arch_decompose_long_opts (MonoCompile *cfg, MonoInst *ins)
        int tmp5 = -1;
 
        switch (ins->opcode) {
-#if 0
-       case OP_LCOMPARE:
-       case OP_LCOMPARE_IMM:
-               mono_print_ins (ins);
-               g_assert_not_reached ();
-#endif
        case OP_LADD:
                tmp1 = mono_alloc_ireg (cfg);
                MONO_EMIT_NEW_BIALU (cfg, OP_IADD, ins->dreg+1, ins->sreg1+1, ins->sreg2+1);
@@ -2217,17 +2211,6 @@ mono_arch_decompose_long_opts (MonoCompile *cfg, MonoInst *ins)
                NULLIFY_INS(ins);
                break;
 
-       case OP_LMUL:
-       case OP_LDIV:
-       case OP_LDIV_UN:
-       case OP_LREM:
-       case OP_LREM_UN:
-       case OP_LSHL:
-       case OP_LSHR:
-       case OP_LSHR_UN:
-               mono_print_ins (ins);
-               g_assert_not_reached ();
-
        case OP_LNEG:
                tmp1 = mono_alloc_ireg (cfg);
                MONO_EMIT_NEW_BIALU (cfg, OP_ISUB, ins->dreg+1, mips_zero, ins->sreg1+1);
@@ -2237,27 +2220,6 @@ mono_arch_decompose_long_opts (MonoCompile *cfg, MonoInst *ins)
                NULLIFY_INS(ins);
                break;
 
-#if 0
-       case OP_LNOT:
-#endif
-#if 0
-       case OP_LCONV_TO_I1:
-       case OP_LCONV_TO_I2:
-       case OP_LCONV_TO_I4:
-       case OP_LCONV_TO_I8:
-       case OP_LCONV_TO_R4:
-       case OP_LCONV_TO_R8:
-       case OP_LCONV_TO_U4:
-       case OP_LCONV_TO_U8:
-       case OP_LCONV_TO_U2:
-       case OP_LCONV_TO_U1:
-       case OP_LCONV_TO_I:
-       case OP_LCONV_TO_OVF_I:
-       case OP_LCONV_TO_OVF_U:
-#endif
-               mono_print_ins (ins);
-               g_assert_not_reached ();
-
        case OP_LADD_OVF:
                tmp1 = mono_alloc_ireg (cfg);
                tmp2 = mono_alloc_ireg (cfg);
@@ -2310,11 +2272,6 @@ mono_arch_decompose_long_opts (MonoCompile *cfg, MonoInst *ins)
                NULLIFY_INS(ins);
                break;
 
-       case OP_LMUL_OVF:
-       case OP_LMUL_OVF_UN:
-               mono_print_ins (ins);
-               g_assert_not_reached ();
-
        case OP_LSUB_OVF:
                tmp1 = mono_alloc_ireg (cfg);
                tmp2 = mono_alloc_ireg (cfg);
@@ -2361,60 +2318,6 @@ mono_arch_decompose_long_opts (MonoCompile *cfg, MonoInst *ins)
                MONO_EMIT_NEW_COMPARE_EXC (cfg, NE_UN, tmp2, mips_zero, "OverflowException");
                NULLIFY_INS(ins);
                break;
-#if 0
-       case OP_LCONV_TO_OVF_I1_UN:
-       case OP_LCONV_TO_OVF_I2_UN:
-       case OP_LCONV_TO_OVF_I4_UN:
-       case OP_LCONV_TO_OVF_I8_UN:
-       case OP_LCONV_TO_OVF_U1_UN:
-       case OP_LCONV_TO_OVF_U2_UN:
-       case OP_LCONV_TO_OVF_U4_UN:
-       case OP_LCONV_TO_OVF_U8_UN:
-       case OP_LCONV_TO_OVF_I_UN:
-       case OP_LCONV_TO_OVF_U_UN:
-       case OP_LCONV_TO_OVF_I1:
-       case OP_LCONV_TO_OVF_U1:
-       case OP_LCONV_TO_OVF_I2:
-       case OP_LCONV_TO_OVF_U2:
-       case OP_LCONV_TO_OVF_I4:
-       case OP_LCONV_TO_OVF_U4:
-       case OP_LCONV_TO_OVF_I8:
-       case OP_LCONV_TO_OVF_U8:
-#endif
-       case OP_LCEQ:
-       case OP_LCGT:
-       case OP_LCGT_UN:
-       case OP_LCLT:
-       case OP_LCLT_UN:
-#if 0
-       case OP_LCONV_TO_R_UN:
-       case OP_LCONV_TO_U:
-#endif
-       case OP_LMUL_IMM:
-       case OP_LSHL_IMM:
-       case OP_LSHR_IMM:
-       case OP_LSHR_UN_IMM:
-       case OP_LDIV_IMM:
-       case OP_LDIV_UN_IMM:
-       case OP_LREM_IMM:
-       case OP_LREM_UN_IMM:
-       case OP_LBEQ:
-       case OP_LBGE:
-       case OP_LBGT:
-       case OP_LBLE:
-       case OP_LBLT:
-       case OP_LBNE_UN:
-       case OP_LBGE_UN:
-       case OP_LBGT_UN:
-       case OP_LBLE_UN:
-       case OP_LBLT_UN:
-               mono_print_ins (ins);
-               g_assert_not_reached ();
-#if 0
-       case OP_LCONV_TO_R8_2:
-       case OP_LCONV_TO_R4_2:
-       case OP_LCONV_TO_R_UN_2:
-#endif
        case OP_LCONV_TO_OVF_I4_2:
                tmp1 = mono_alloc_ireg (cfg);
 
@@ -2424,14 +2327,6 @@ mono_arch_decompose_long_opts (MonoCompile *cfg, MonoInst *ins)
                MONO_EMIT_NEW_UNALU (cfg, OP_MOVE, ins->dreg, ins->sreg1);
                NULLIFY_INS(ins);
                break;
-
-       case OP_LMIN_UN:
-       case OP_LMAX_UN:
-       case OP_LMIN:
-       case OP_LMAX:
-               mono_print_ins (ins);
-               g_assert_not_reached ();
-
        default:
                break;
        }
@@ -5889,8 +5784,8 @@ mono_arch_context_get_int_reg (MonoContext *ctx, int reg)
  * LOCKING: called with the domain lock held
  */
 gpointer
-mono_arch_build_imt_thunk (MonoVTable *vtable, MonoDomain *domain, MonoIMTCheckItem **imt_entries, int count,
-       gpointer fail_tramp)
+mono_arch_build_imt_trampoline (MonoVTable *vtable, MonoDomain *domain, MonoIMTCheckItem **imt_entries, int count,
+                                                               gpointer fail_tramp)
 {
        int i;
        int size = 0;
@@ -5928,7 +5823,7 @@ mono_arch_build_imt_thunk (MonoVTable *vtable, MonoDomain *domain, MonoIMTCheckI
        /* the initial load of the vtable address */
        size += MIPS_LOAD_SEQUENCE_LENGTH;
        if (fail_tramp) {
-               code = mono_method_alloc_generic_virtual_thunk (domain, size);
+               code = mono_method_alloc_generic_virtual_trampoline (domain, size);
        } else {
                code = mono_domain_code_reserve (domain, size);
        }
@@ -6016,7 +5911,7 @@ mono_arch_build_imt_thunk (MonoVTable *vtable, MonoDomain *domain, MonoIMTCheckI
        }
 
        if (!fail_tramp)
-               mono_stats.imt_thunks_size += code - start;
+               mono_stats.imt_trampolines_size += code - start;
        g_assert (code - start <= size);
        mono_arch_flush_icache (start, size);
 
index 73d0ad3272062fad992e68c42e33ca075b703a07..df179bd2545334cd8cf1eca629efc0f54b487a43 100644 (file)
@@ -233,6 +233,15 @@ typedef struct MonoCompileArch {
 #define MONO_ARCH_EMULATE_FREM 1
 #endif
 
+/*
+ * mips backend misses some instructions that enable emitting of optimal
+ * code on other targets and, additionally, the register allocator gets
+ * confused by this optimization, failing to allocate all hw regs.
+ */
+#if SIZEOF_REGISTER == 4
+#define MONO_ARCH_NO_DIV_WITH_MUL
+#endif
+
 #if SIZEOF_REGISTER == 8
 #define MONO_ARCH_NO_EMULATE_LONG_MUL_OPTS
 #endif
@@ -264,7 +273,7 @@ typedef struct MonoCompileArch {
 #define MONO_ARCH_HAVE_DECOMPOSE_OPTS 1
 #define MONO_ARCH_HAVE_DECOMPOSE_LONG_OPTS 1
 
-#define MONO_ARCH_HAVE_GENERALIZED_IMT_THUNK 1
+#define MONO_ARCH_HAVE_GENERALIZED_IMT_TRAMPOLINE 1
 #define MONO_ARCH_SOFT_DEBUG_SUPPORTED 1
 #define MONO_ARCH_HAVE_SIGCTX_TO_MONOCTX 1
 #define MONO_ARCH_HAVE_SETUP_RESUME_FROM_SIGNAL_HANDLER_CTX 1
index 5d66853ece98745dcfe334f57c49d357517159d9..6e461b806b461d133a7ecd56912a48c49d441354 100644 (file)
@@ -406,6 +406,13 @@ mono_class_is_magic_float (MonoClass *klass)
 
        if (strcmp ("nfloat", klass->name) == 0) {
                magic_nfloat_class = klass;
+
+               /* Assert that we are using the matching assembly */
+               MonoClassField *value_field = mono_class_get_field_from_name (klass, "v");
+               g_assert (value_field);
+               MonoType *t = mono_field_get_type (value_field);
+               g_assert (t->type == mini_native_type_replace_type (&klass->byval_arg)->type);
+
                return TRUE;
        }
        return FALSE;
index 07dd0a435376575104bed2e5da8a9ffa6a8bc099..c65def26bab13a97247661a99e8be0b98ef2397d 100644 (file)
@@ -947,10 +947,15 @@ MINI_OP(OP_CVTPS2PD, "cvtps2pd", XREG, XREG, NONE)
 MINI_OP(OP_CVTTPD2DQ, "cvttpd2dq", XREG, XREG, NONE)
 MINI_OP(OP_CVTTPS2DQ, "cvttps2dq", XREG, XREG, NONE)
 
+/* r4 dot product */
+/* multiply all 4 single precision float elements, add them together, and store the result to the lowest element */
+MINI_OP(OP_DPPS, "dpps", XREG, XREG, XREG)
+
 #endif
 
 MINI_OP(OP_XMOVE,   "xmove", XREG, XREG, NONE)
 MINI_OP(OP_XZERO,   "xzero", XREG, NONE, NONE)
+MINI_OP(OP_XONES,   "xones", XREG, NONE, NONE)
 MINI_OP(OP_XPHI,       "xphi", XREG, NONE, NONE)
 
 /*
index 6f6e266a3b025d72fd9998435b46a8b053747b31..14c13a4c683d03803203ba0b6dcc753605fc7f73 100644 (file)
@@ -59,7 +59,6 @@
 #include <mono/utils/dtrace.h>
 #include <mono/utils/mono-signal-handler.h>
 #include <mono/utils/mono-threads.h>
-#include <mono/utils/mono-threads-posix-signals.h>
 
 #include "mini.h"
 #include <string.h>
@@ -140,11 +139,15 @@ mono_gdb_render_native_backtraces (pid_t crashed_pid)
 static GHashTable *mono_saved_signal_handlers = NULL;
 
 static struct sigaction *
-get_saved_signal_handler (int signo)
+get_saved_signal_handler (int signo, gboolean remove)
 {
-       if (mono_saved_signal_handlers)
+       if (mono_saved_signal_handlers) {
                /* The hash is only modified during startup, so no need for locking */
-               return (struct sigaction *)g_hash_table_lookup (mono_saved_signal_handlers, GINT_TO_POINTER (signo));
+               struct sigaction *handler = g_hash_table_lookup (mono_saved_signal_handlers, GINT_TO_POINTER (signo));
+               if (remove && handler)
+                       g_hash_table_remove (mono_saved_signal_handlers, GINT_TO_POINTER (signo));
+               return handler;
+       }
        return NULL;
 }
 
@@ -167,21 +170,14 @@ save_old_signal_handler (int signo, struct sigaction *old_action)
        handler_to_save->sa_flags = old_action->sa_flags;
        
        if (!mono_saved_signal_handlers)
-               mono_saved_signal_handlers = g_hash_table_new (NULL, NULL);
+               mono_saved_signal_handlers = g_hash_table_new_full (NULL, NULL, NULL, g_free);
        g_hash_table_insert (mono_saved_signal_handlers, GINT_TO_POINTER (signo), handler_to_save);
 }
 
-static void
-free_saved_sig_handler_func (gpointer key, gpointer value, gpointer user_data)
-{
-       g_free (value);
-}
-
 static void
 free_saved_signal_handlers (void)
 {
        if (mono_saved_signal_handlers) {
-               g_hash_table_foreach (mono_saved_signal_handlers, free_saved_sig_handler_func, NULL);
                g_hash_table_destroy (mono_saved_signal_handlers);
                mono_saved_signal_handlers = NULL;
        }
@@ -198,7 +194,7 @@ gboolean
 MONO_SIG_HANDLER_SIGNATURE (mono_chain_signal)
 {
        int signal = MONO_SIG_HANDLER_GET_SIGNO ();
-       struct sigaction *saved_handler = (struct sigaction *)get_saved_signal_handler (signal);
+       struct sigaction *saved_handler = (struct sigaction *)get_saved_signal_handler (signal, FALSE);
 
        if (saved_handler && saved_handler->sa_handler) {
                if (!(saved_handler->sa_flags & SA_SIGINFO)) {
@@ -338,14 +334,8 @@ MONO_SIG_HANDLER_FUNC (static, profiler_signal_handler)
 
        /* See the comment in mono_runtime_shutdown_stat_profiler (). */
        if (mono_native_thread_id_get () == sampling_thread) {
-#ifdef HAVE_CLOCK_NANOSLEEP
-               if (mono_profiler_get_sampling_mode () == MONO_PROFILER_STAT_MODE_PROCESS) {
-                       InterlockedIncrement (&profiler_interrupt_signals_received);
-                       return;
-               }
-#endif
-
-               g_error ("%s: Unexpected profiler signal received by the sampler thread", __func__);
+               InterlockedIncrement (&profiler_interrupt_signals_received);
+               return;
        }
 
        InterlockedIncrement (&profiler_signals_received);
@@ -453,7 +443,7 @@ static void
 remove_signal_handler (int signo)
 {
        struct sigaction sa;
-       struct sigaction *saved_action = get_saved_signal_handler (signo);
+       struct sigaction *saved_action = get_saved_signal_handler (signo, TRUE);
 
        if (!saved_action) {
                sa.sa_handler = SIG_DFL;
@@ -764,7 +754,7 @@ mono_runtime_shutdown_stat_profiler (void)
 {
        InterlockedWrite (&sampling_thread_running, 0);
 
-#ifdef HAVE_CLOCK_NANOSLEEP
+#ifndef PLATFORM_MACOSX
        /*
         * There is a slight problem when we're using CLOCK_PROCESS_CPUTIME_ID: If
         * we're shutting down and there's largely no activity in the process other
@@ -777,28 +767,22 @@ mono_runtime_shutdown_stat_profiler (void)
         * sampling_thread_running upon an interrupt and return immediately if it's
         * zero. profiler_signal_handler () has a special case to ignore the signal
         * for the sampler thread.
-        *
-        * We do not need to do this on platforms where we use a regular sleep
-        * based on a monotonic clock. The sleep will return in a reasonable amount
-        * of time in those cases.
         */
-       if (mono_profiler_get_sampling_mode () == MONO_PROFILER_STAT_MODE_PROCESS) {
-               MonoThreadInfo *info;
-
-               // Did it shut down already?
-               if ((info = mono_thread_info_lookup (sampling_thread))) {
-                       while (!InterlockedRead (&sampling_thread_exiting)) {
-                               mono_threads_pthread_kill (info, profiler_signal);
-                               mono_thread_info_usleep (10 * 1000 /* 10ms */);
-                       }
+       MonoThreadInfo *info;
 
-                       // Make sure info can be freed.
-                       mono_hazard_pointer_clear (mono_hazard_pointer_get (), 1);
+       // Did it shut down already?
+       if ((info = mono_thread_info_lookup (sampling_thread))) {
+               while (!InterlockedRead (&sampling_thread_exiting)) {
+                       mono_threads_pthread_kill (info, profiler_signal);
+                       mono_thread_info_usleep (10 * 1000 /* 10ms */);
                }
+
+               // Make sure info can be freed.
+               mono_hazard_pointer_clear (mono_hazard_pointer_get (), 1);
        }
 #endif
 
-       pthread_join (sampling_thread, NULL);
+       mono_native_thread_join (sampling_thread);
 
        /*
         * We can't safely remove the signal handler because we have no guarantee
@@ -828,7 +812,7 @@ mono_runtime_setup_stat_profiler (void)
         */
 #if defined (USE_POSIX_BACKEND) && defined (SIGRTMIN) && !defined (PLATFORM_ANDROID)
        /* Just take the first real-time signal we can get. */
-       profiler_signal = mono_threads_posix_signal_search_alternative (-1);
+       profiler_signal = mono_threads_suspend_search_alternative_signal ();
 #else
        profiler_signal = SIGPROF;
 #endif
index 3089a8546b1d3a4d605535a775c1f57d27eb793f..656ba1ed916e58c7eec2c00d683cea8fb106d1e6 100644 (file)
@@ -17,7 +17,7 @@
 #include <mono/metadata/debug-helpers.h>
 #include <mono/utils/mono-proclib.h>
 #include <mono/utils/mono-mmap.h>
-#include <mono/utils/mono-hwcap-ppc.h>
+#include <mono/utils/mono-hwcap.h>
 
 #include "mini-ppc.h"
 #ifdef TARGET_POWERPC64
@@ -627,8 +627,8 @@ mono_arch_init (void)
 
        mono_os_mutex_init_recursive (&mini_arch_mutex);
 
-       ss_trigger_page = mono_valloc (NULL, mono_pagesize (), MONO_MMAP_READ|MONO_MMAP_32BIT);
-       bp_trigger_page = mono_valloc (NULL, mono_pagesize (), MONO_MMAP_READ|MONO_MMAP_32BIT);
+       ss_trigger_page = mono_valloc (NULL, mono_pagesize (), MONO_MMAP_READ|MONO_MMAP_32BIT, MONO_MEM_ACCOUNT_OTHER);
+       bp_trigger_page = mono_valloc (NULL, mono_pagesize (), MONO_MMAP_READ|MONO_MMAP_32BIT, MONO_MEM_ACCOUNT_OTHER);
        mono_mprotect (bp_trigger_page, mono_pagesize (), 0);
 
        mono_aot_register_jit_icall ("mono_ppc_throw_exception", mono_ppc_throw_exception);
@@ -5824,8 +5824,8 @@ mono_arch_free_jit_tls_data (MonoJitTlsData *tls)
  * LOCKING: called with the domain lock held
  */
 gpointer
-mono_arch_build_imt_thunk (MonoVTable *vtable, MonoDomain *domain, MonoIMTCheckItem **imt_entries, int count,
-       gpointer fail_tramp)
+mono_arch_build_imt_trampoline (MonoVTable *vtable, MonoDomain *domain, MonoIMTCheckItem **imt_entries, int count,
+                                                               gpointer fail_tramp)
 {
        int i;
        int size = 0;
@@ -5862,7 +5862,7 @@ mono_arch_build_imt_thunk (MonoVTable *vtable, MonoDomain *domain, MonoIMTCheckI
        /* the initial load of the vtable address */
        size += PPC_LOAD_SEQUENCE_LENGTH + LOADSTORE_SIZE;
        if (fail_tramp) {
-               code = mono_method_alloc_generic_virtual_thunk (domain, size);
+               code = mono_method_alloc_generic_virtual_trampoline (domain, size);
        } else {
                code = mono_domain_code_reserve (domain, size);
        }
@@ -5955,7 +5955,7 @@ mono_arch_build_imt_thunk (MonoVTable *vtable, MonoDomain *domain, MonoIMTCheckI
        }
 
        if (!fail_tramp)
-               mono_stats.imt_thunks_size += code - start;
+               mono_stats.imt_trampolines_size += code - start;
        g_assert (code - start <= size);
        mono_arch_flush_icache (start, size);
 
index b0d4654de83ef98cbbb778de7b877fa6a16d860b..bf56b43d45ad23dd9dc30cace177d3819d6df1b0 100644 (file)
@@ -77,13 +77,8 @@ typedef struct MonoCompileArch {
 #define PPC_USES_FUNCTION_DESCRIPTOR
 #endif
 
-#ifndef __mono_ilp32__
-#define MONO_ARCH_HAVE_TLS_GET 1
-#endif
-
 #else /* must be __mono_ppc__ */
 
-#define MONO_ARCH_HAVE_TLS_GET 1
 #define MONO_ARCH_EMULATE_FCONV_TO_I8 1
 #define MONO_ARCH_EMULATE_LCONV_TO_R8 1
 #define MONO_ARCH_EMULATE_LCONV_TO_R4 1
@@ -183,7 +178,6 @@ typedef struct MonoCompileArch {
 #define PPC_LAST_FPARG_REG ppc_f13
 #define PPC_PASS_STRUCTS_BY_VALUE 1
 #define PPC_THREAD_PTR_REG ppc_r13
-#define MONO_ARCH_HAVE_SIGCTX_TO_MONOCTX 1
 #else
 #define PPC_RET_ADDR_OFFSET 4
 #define PPC_STACK_PARAM_OFFSET 8
@@ -200,6 +194,7 @@ typedef struct MonoCompileArch {
 #define MONO_ARCH_RETURN_CAN_USE_MULTIPLE_REGISTERS 0
 #define PPC_THREAD_PTR_REG ppc_r2
 #endif
+#define MONO_ARCH_HAVE_SIGCTX_TO_MONOCTX 1
 #define PPC_FIRST_ARG_REG ppc_r3
 #define PPC_LAST_ARG_REG ppc_r10
 #define PPC_FIRST_FPARG_REG ppc_f1
@@ -221,7 +216,7 @@ typedef struct MonoCompileArch {
 #define MONO_ARCH_HAVE_DECOMPOSE_OPTS 1
 #define MONO_ARCH_HAVE_DECOMPOSE_LONG_OPTS 1
 
-#define MONO_ARCH_HAVE_GENERALIZED_IMT_THUNK 1
+#define MONO_ARCH_HAVE_GENERALIZED_IMT_TRAMPOLINE 1
 
 #define MONO_ARCH_HAVE_FULL_AOT_TRAMPOLINES 1
 
index 857f52ea70ba7353ffbd0ab1a32b6225d63fc87a..77b4bb21415055645f74797cf80e24f8cc3aa600 100644 (file)
@@ -65,6 +65,7 @@
 #include <mono/utils/mono-threads.h>
 #include <mono/utils/mono-threads-coop.h>
 #include <mono/utils/checked-build.h>
+#include <mono/metadata/w32handle.h>
 #include <mono/io-layer/io-layer.h>
 
 #include "mini.h"
@@ -252,6 +253,8 @@ mono_print_method_from_ip (void *ip)
        MonoGenericSharingContext*gsctx;
        const char *shared_type;
 
+       if (!domain)
+               domain = mono_get_root_domain ();
        ji = mini_jit_info_table_find_ext (domain, (char *)ip, TRUE, &target_domain);
        if (ji && ji->is_trampoline) {
                MonoTrampInfo *tinfo = (MonoTrampInfo *)ji->d.tramp_info;
@@ -340,7 +343,7 @@ void *mono_global_codeman_reserve (int size)
        void *ptr;
 
        if (mono_aot_only)
-               g_error ("Attempting to allocate from the global code manager while running with --aot-only.\n");
+               g_error ("Attempting to allocate from the global code manager while running in aot-only mode.\n");
 
        if (!global_codeman) {
                /* This can happen during startup */
@@ -1093,6 +1096,63 @@ mono_patch_info_list_prepend (MonoJumpInfo *list, int ip, MonoJumpInfoType type,
        return ji;
 }
 
+#if !defined(DISABLE_LOGGING) && !defined(DISABLE_JIT)
+
+static const char* const patch_info_str[] = {
+#define PATCH_INFO(a,b) "" #a,
+#include "patch-info.h"
+#undef PATCH_INFO
+};
+
+const char*
+mono_ji_type_to_string (MonoJumpInfoType type)
+{
+       return patch_info_str [type];
+}
+
+void
+mono_print_ji (const MonoJumpInfo *ji)
+{
+       switch (ji->type) {
+       case MONO_PATCH_INFO_RGCTX_FETCH: {
+               MonoJumpInfoRgctxEntry *entry = ji->data.rgctx_entry;
+
+               printf ("[RGCTX_FETCH ");
+               mono_print_ji (entry->data);
+               printf (" - %s]", mono_rgctx_info_type_to_str (entry->info_type));
+               break;
+       }
+       case MONO_PATCH_INFO_METHODCONST: {
+               char *s = mono_method_full_name (ji->data.method, TRUE);
+               printf ("[METHODCONST - %s]", s);
+               g_free (s);
+               break;
+       }
+       case MONO_PATCH_INFO_INTERNAL_METHOD: {
+               printf ("[INTERNAL_METHOD - %s]", ji->data.name);
+               break;
+       }
+       default:
+               printf ("[%s]", patch_info_str [ji->type]);
+               break;
+       }
+}
+
+#else
+
+const char*
+mono_ji_type_to_string (MonoJumpInfoType type)
+{
+       return "";
+}
+
+void
+mono_print_ji (const MonoJumpInfo *ji)
+{
+}
+
+#endif
+
 /**
  * mono_patch_info_dup_mp:
  *
@@ -1221,6 +1281,7 @@ mono_patch_info_hash (gconstpointer data)
        case MONO_PATCH_INFO_GOT_OFFSET:
        case MONO_PATCH_INFO_GC_SAFE_POINT_FLAG:
        case MONO_PATCH_INFO_AOT_MODULE:
+       case MONO_PATCH_INFO_GET_TLS_TRAMP:
                return (ji->type << 8);
        case MONO_PATCH_INFO_CASTCLASS_CACHE:
                return (ji->type << 8) | (ji->data.index);
@@ -1440,11 +1501,11 @@ mono_resolve_patch_target (MonoMethod *method, MonoDomain *domain, guint8 *code,
                break;
        case MONO_PATCH_INFO_IID:
                mono_class_init (patch_info->data.klass);
-               target = GINT_TO_POINTER ((int)patch_info->data.klass->interface_id);
+               target = GUINT_TO_POINTER (patch_info->data.klass->interface_id);
                break;
        case MONO_PATCH_INFO_ADJUSTED_IID:
                mono_class_init (patch_info->data.klass);
-               target = GINT_TO_POINTER ((int)(-((patch_info->data.klass->interface_id + 1) * SIZEOF_VOID_P)));
+               target = GUINT_TO_POINTER ((guint32)(-((patch_info->data.klass->interface_id + 1) * SIZEOF_VOID_P)));
                break;
        case MONO_PATCH_INFO_VTABLE:
                target = mono_class_vtable (domain, patch_info->data.klass);
@@ -1474,7 +1535,7 @@ mono_resolve_patch_target (MonoMethod *method, MonoDomain *domain, guint8 *code,
                }
 
                g_assert (vtable);
-               if (!vtable->initialized && !(vtable->klass->flags & TYPE_ATTRIBUTE_BEFORE_FIELD_INIT) && (method && mono_class_needs_cctor_run (vtable->klass, method)))
+               if (!vtable->initialized && !mono_class_is_before_field_init (vtable->klass) && (method && mono_class_needs_cctor_run (vtable->klass, method)))
                        /* Done by the generated code */
                        ;
                else {
@@ -1660,6 +1721,13 @@ mono_resolve_patch_target (MonoMethod *method, MonoDomain *domain, guint8 *code,
        case MONO_PATCH_INFO_GSHAREDVT_IN_WRAPPER:
                target = mini_get_gsharedvt_wrapper (TRUE, NULL, patch_info->data.sig, NULL, -1, FALSE);
                break;
+       case MONO_PATCH_INFO_GET_TLS_TRAMP:
+#ifdef MONO_ARCH_HAVE_GET_TLS_TRAMP
+               target = mono_arch_get_get_tls_tramp ();
+#else
+               target = NULL;
+#endif
+               break;
        default:
                g_assert_not_reached ();
        }
@@ -1878,6 +1946,15 @@ mono_jit_compile_method_with_opt (MonoMethod *method, guint32 opt, MonoError *er
                if ((code = mono_aot_get_method_checked (domain, method, error))) {
                        MonoVTable *vtable;
 
+                       if (mono_runtime_is_critical_method (method) || mono_gc_is_critical_method (method)) {
+                               /*
+                                * The suspend code needs to be able to lookup these methods by ip in async context,
+                                * so preload their jit info.
+                                */
+                               MonoJitInfo *ji = mono_jit_info_table_find (domain, code);
+                               g_assert (ji);
+                       }
+
                        /*
                         * In llvm-only mode, method might be a shared method, so we can't initialize its class.
                         * This is not a problem, since it will be initialized when the method is first
@@ -2355,10 +2432,8 @@ mono_llvmonly_runtime_invoke (MonoMethod *method, RuntimeInvokeInfo *info, void
        runtime_invoke = (MonoObject *(*)(MonoObject *, void **, MonoObject **, void *))info->runtime_invoke;
 
        runtime_invoke (NULL, args, exc, info->compiled_method);
-       if (exc && *exc) {
-               mono_error_set_exception_instance (error, (MonoException*) *exc);
+       if (exc && *exc)
                return NULL;
-       }
 
        if (sig->ret->type != MONO_TYPE_VOID && info->ret_box_class)
                return mono_value_box_checked (domain, info->ret_box_class, retval, error);
@@ -2406,10 +2481,9 @@ mono_jit_runtime_invoke (MonoMethod *method, void *obj, void **params, MonoObjec
                         */
                        mono_class_setup_vtable (method->klass);
                        if (mono_class_has_failure (method->klass)) {
-                               MonoException *fail_exc = mono_class_get_exception_for_failure (method->klass);
+                               mono_error_set_for_class_failure (error, method->klass);
                                if (exc)
-                                       *exc = (MonoObject*)fail_exc;
-                               mono_error_set_exception_instance (error, fail_exc);
+                                       *exc = (MonoObject*)mono_class_get_exception_for_failure (method->klass);
                                return NULL;
                        }
                }
@@ -2544,12 +2618,17 @@ mono_jit_runtime_invoke (MonoMethod *method, void *obj, void **params, MonoObjec
        }
 #endif
 
-       if (mono_llvm_only)
-               return mono_llvmonly_runtime_invoke (method, info, obj, params, exc, error);
+       MonoObject *result;
 
-       runtime_invoke = (MonoObject *(*)(MonoObject *, void **, MonoObject **, void *))info->runtime_invoke;
+       if (mono_llvm_only) {
+               result = mono_llvmonly_runtime_invoke (method, info, obj, params, exc, error);
+               if (!is_ok (error))
+                       return NULL;
+       } else {
+               runtime_invoke = (MonoObject *(*)(MonoObject *, void **, MonoObject **, void *))info->runtime_invoke;
 
-       MonoObject *result = runtime_invoke ((MonoObject *)obj, params, exc, info->compiled_method);
+               result = runtime_invoke ((MonoObject *)obj, params, exc, info->compiled_method);
+       }
        if (catchExcInMonoError && *exc != NULL)
                mono_error_set_exception_instance (error, (MonoException*) *exc);
        return result;
@@ -2558,34 +2637,34 @@ mono_jit_runtime_invoke (MonoMethod *method, void *obj, void **params, MonoObjec
 typedef struct {
        MonoVTable *vtable;
        int slot;
-} IMTThunkInfo;
+} IMTTrampInfo;
 
-typedef gpointer (*IMTThunkFunc) (gpointer *arg, MonoMethod *imt_method);
+typedef gpointer (*IMTTrampFunc) (gpointer *arg, MonoMethod *imt_method);
 
 /*
- * mini_llvmonly_initial_imt_thunk:
+ * mini_llvmonly_initial_imt_tramp:
  *
- *  This function is called the first time a call is made through an IMT thunk.
- * It should have the same signature as the mono_llvmonly_imt_thunk_... functions.
+ *  This function is called the first time a call is made through an IMT trampoline.
+ * It should have the same signature as the mono_llvmonly_imt_tramp_... functions.
  */
 static gpointer
-mini_llvmonly_initial_imt_thunk (gpointer *arg, MonoMethod *imt_method)
+mini_llvmonly_initial_imt_tramp (gpointer *arg, MonoMethod *imt_method)
 {
-       IMTThunkInfo *info = (IMTThunkInfo*)arg;
+       IMTTrampInfo *info = (IMTTrampInfo*)arg;
        gpointer *imt;
        gpointer *ftndesc;
-       IMTThunkFunc func;
+       IMTTrampFunc func;
 
        mono_vtable_build_imt_slot (info->vtable, info->slot);
 
        imt = (gpointer*)info->vtable;
        imt -= MONO_IMT_SIZE;
 
-       /* Return what the real IMT thunk returns */
+       /* Return what the real IMT trampoline returns */
        ftndesc = imt [info->slot];
        func = ftndesc [0];
 
-       if (func == (IMTThunkFunc)mini_llvmonly_initial_imt_thunk)
+       if (func == (IMTTrampFunc)mini_llvmonly_initial_imt_tramp)
                /* Happens when the imt slot contains only a generic virtual method */
                return NULL;
        return func ((gpointer *)ftndesc [1], imt_method);
@@ -2593,11 +2672,11 @@ mini_llvmonly_initial_imt_thunk (gpointer *arg, MonoMethod *imt_method)
 
 /* This is called indirectly through an imt slot. */
 static gpointer
-mono_llvmonly_imt_thunk (gpointer *arg, MonoMethod *imt_method)
+mono_llvmonly_imt_tramp (gpointer *arg, MonoMethod *imt_method)
 {
        int i = 0;
 
-       /* arg points to an array created in mono_llvmonly_get_imt_thunk () */
+       /* arg points to an array created in mono_llvmonly_get_imt_trampoline () */
        while (arg [i] && arg [i] != imt_method)
                i += 2;
        g_assert (arg [i]);
@@ -2605,16 +2684,16 @@ mono_llvmonly_imt_thunk (gpointer *arg, MonoMethod *imt_method)
        return arg [i + 1];
 }
 
-/* Optimized versions of mono_llvmonly_imt_thunk () for different table sizes */
+/* Optimized versions of mono_llvmonly_imt_trampoline () for different table sizes */
 static gpointer
-mono_llvmonly_imt_thunk_1 (gpointer *arg, MonoMethod *imt_method)
+mono_llvmonly_imt_tramp_1 (gpointer *arg, MonoMethod *imt_method)
 {
        //g_assert (arg [0] == imt_method);
        return arg [1];
 }
 
 static gpointer
-mono_llvmonly_imt_thunk_2 (gpointer *arg, MonoMethod *imt_method)
+mono_llvmonly_imt_tramp_2 (gpointer *arg, MonoMethod *imt_method)
 {
        //g_assert (arg [0] == imt_method || arg [2] == imt_method);
        if (arg [0] == imt_method)
@@ -2624,7 +2703,7 @@ mono_llvmonly_imt_thunk_2 (gpointer *arg, MonoMethod *imt_method)
 }
 
 static gpointer
-mono_llvmonly_imt_thunk_3 (gpointer *arg, MonoMethod *imt_method)
+mono_llvmonly_imt_tramp_3 (gpointer *arg, MonoMethod *imt_method)
 {
        //g_assert (arg [0] == imt_method || arg [2] == imt_method || arg [4] == imt_method);
        if (arg [0] == imt_method)
@@ -2636,14 +2715,14 @@ mono_llvmonly_imt_thunk_3 (gpointer *arg, MonoMethod *imt_method)
 }
 
 /*
- * A version of the imt thunk used for generic virtual/variant iface methods.
- * Unlikely a normal imt thunk, its possible that IMT_METHOD is not found
+ * A version of the imt trampoline used for generic virtual/variant iface methods.
+ * Unlikely a normal imt trampoline, its possible that IMT_METHOD is not found
  * in the search table. The original JIT code had a 'fallback' trampoline it could
  * call, but we can't do that, so we just return NULL, and the compiled code
  * will handle it.
  */
 static gpointer
-mono_llvmonly_fallback_imt_thunk (gpointer *arg, MonoMethod *imt_method)
+mono_llvmonly_fallback_imt_tramp (gpointer *arg, MonoMethod *imt_method)
 {
        int i = 0;
 
@@ -2656,7 +2735,7 @@ mono_llvmonly_fallback_imt_thunk (gpointer *arg, MonoMethod *imt_method)
 }
 
 static gpointer
-mono_llvmonly_get_imt_thunk (MonoVTable *vtable, MonoDomain *domain, MonoIMTCheckItem **imt_entries, int count, gpointer fail_tramp)
+mono_llvmonly_get_imt_trampoline (MonoVTable *vtable, MonoDomain *domain, MonoIMTCheckItem **imt_entries, int count, gpointer fail_tramp)
 {
        gpointer *buf;
        gpointer *res;
@@ -2664,7 +2743,7 @@ mono_llvmonly_get_imt_thunk (MonoVTable *vtable, MonoDomain *domain, MonoIMTChec
        gboolean virtual_generic = FALSE;
 
        /*
-        * Create an array which is passed to the imt thunk functions.
+        * Create an array which is passed to the imt trampoline functions.
         * The array contains MonoMethod-function descriptor pairs, terminated by a NULL entry.
         */
 
@@ -2719,20 +2798,20 @@ mono_llvmonly_get_imt_thunk (MonoVTable *vtable, MonoDomain *domain, MonoIMTChec
        res = (void **)mono_domain_alloc (domain, 2 * sizeof (gpointer));
        switch (real_count) {
        case 1:
-               res [0] = mono_llvmonly_imt_thunk_1;
+               res [0] = mono_llvmonly_imt_tramp_1;
                break;
        case 2:
-               res [0] = mono_llvmonly_imt_thunk_2;
+               res [0] = mono_llvmonly_imt_tramp_2;
                break;
        case 3:
-               res [0] = mono_llvmonly_imt_thunk_3;
+               res [0] = mono_llvmonly_imt_tramp_3;
                break;
        default:
-               res [0] = mono_llvmonly_imt_thunk;
+               res [0] = mono_llvmonly_imt_tramp;
                break;
        }
        if (virtual_generic || fail_tramp)
-               res [0] = mono_llvmonly_fallback_imt_thunk;
+               res [0] = mono_llvmonly_fallback_imt_tramp;
        res [1] = buf;
 
        return res;
@@ -2954,13 +3033,13 @@ mini_get_vtable_trampoline (MonoVTable *vt, int slot_index)
 
        if (mono_llvm_only) {
                if (slot_index < 0) {
-                       /* Initialize the IMT thunks to a 'trampoline' so the generated code doesn't have to initialize it */
+                       /* Initialize the IMT trampoline to a 'trampoline' so the generated code doesn't have to initialize it */
                        // FIXME: Memory management
                        gpointer *ftndesc = g_malloc (2 * sizeof (gpointer));
-                       IMTThunkInfo *info = g_new0 (IMTThunkInfo, 1);
+                       IMTTrampInfo *info = g_new0 (IMTTrampInfo, 1);
                        info->vtable = vt;
                        info->slot = index;
-                       ftndesc [0] = mini_llvmonly_initial_imt_thunk;
+                       ftndesc [0] = mini_llvmonly_initial_imt_tramp;
                        ftndesc [1] = info;
                        mono_memory_barrier ();
                        return ftndesc;
@@ -3083,7 +3162,7 @@ mono_get_delegate_virtual_invoke_impl (MonoMethodSignature *sig, MonoMethod *met
                return NULL;
 
        is_virtual_generic = method->is_inflated && mono_method_get_declaring_generic_method (method)->is_generic;
-       is_interface = method->klass->flags & TYPE_ATTRIBUTE_INTERFACE ? TRUE : FALSE;
+       is_interface = mono_class_is_interface (method->klass);
        load_imt_reg = is_virtual_generic || is_interface;
 
        if (is_interface)
@@ -3569,6 +3648,10 @@ mini_init (const char *filename, const char *runtime_version)
 
        mono_counters_init ();
 
+#ifndef HOST_WIN32
+       mono_w32handle_init ();
+#endif
+
        mono_threads_runtime_init (&ticallbacks);
 
        if (g_getenv ("MONO_DEBUG") != NULL)
@@ -3655,12 +3738,12 @@ mini_init (const char *filename, const char *runtime_version)
        }
 
        if (mono_llvm_only) {
-               mono_install_imt_thunk_builder (mono_llvmonly_get_imt_thunk);
-               mono_set_always_build_imt_thunks (TRUE);
+               mono_install_imt_trampoline_builder (mono_llvmonly_get_imt_trampoline);
+               mono_set_always_build_imt_trampolines (TRUE);
        } else if (mono_aot_only) {
-               mono_install_imt_thunk_builder (mono_aot_get_imt_thunk);
+               mono_install_imt_trampoline_builder (mono_aot_get_imt_trampoline);
        } else {
-               mono_install_imt_thunk_builder (mono_arch_build_imt_thunk);
+               mono_install_imt_trampoline_builder (mono_arch_build_imt_trampoline);
        }
 
        /*Init arch tls information only after the metadata side is inited to make sure we see dynamic appdomain tls keys*/
@@ -3707,6 +3790,8 @@ mini_init (const char *filename, const char *runtime_version)
                 */
                mono_runtime_set_no_exec (TRUE);
 
+       mono_mem_account_register_counters ();
+
 #define JIT_RUNTIME_WORKS
 #ifdef JIT_RUNTIME_WORKS
        mono_install_runtime_cleanup ((MonoDomainFunc)mini_cleanup);
@@ -3734,6 +3819,8 @@ register_icalls (void)
                                ves_icall_get_trace);
        mono_add_internal_call ("Mono.Runtime::mono_runtime_install_handlers",
                                mono_runtime_install_handlers);
+       mono_add_internal_call ("Mono.Runtime::mono_runtime_cleanup_handlers",
+                               mono_runtime_cleanup_handlers);
 
 #if defined(PLATFORM_ANDROID) || defined(TARGET_ANDROID)
        mono_add_internal_call ("System.Diagnostics.Debugger::Mono_UnhandledException_internal",
@@ -3975,6 +4062,7 @@ register_icalls (void)
        register_icall (mono_get_assembly_object, "mono_get_assembly_object", "object ptr", TRUE);
        register_icall (mono_get_method_object, "mono_get_method_object", "object ptr", TRUE);
        register_icall (mono_throw_method_access, "mono_throw_method_access", "void ptr ptr", FALSE);
+       register_icall_no_wrapper (mono_dummy_jit_icall, "mono_dummy_jit_icall", "void");
 
        register_icall_with_wrapper (mono_monitor_enter, "mono_monitor_enter", "void obj");
        register_icall_with_wrapper (mono_monitor_enter_v4, "mono_monitor_enter_v4", "void obj ptr");
@@ -4023,7 +4111,7 @@ print_jit_stats (void)
                g_print ("IMT colliding slots:    %ld\n", mono_stats.imt_slots_with_collisions);
                g_print ("IMT max collisions:     %ld\n", mono_stats.imt_max_collisions_in_slot);
                g_print ("IMT methods at max col: %ld\n", mono_stats.imt_method_count_when_max_collisions);
-               g_print ("IMT thunks size:        %ld\n", mono_stats.imt_thunks_size);
+               g_print ("IMT trampolines size:   %ld\n", mono_stats.imt_trampolines_size);
 
                g_print ("JIT info table inserts: %ld\n", mono_stats.jit_info_table_insert_count);
                g_print ("JIT info table removes: %ld\n", mono_stats.jit_info_table_remove_count);
@@ -4109,6 +4197,10 @@ mini_cleanup (MonoDomain *domain)
        mono_os_mutex_destroy (&jit_mutex);
 
        mono_code_manager_cleanup ();
+
+#ifndef HOST_WIN32
+       mono_w32handle_cleanup ();
+#endif
 }
 
 void
@@ -4185,7 +4277,7 @@ mono_precompile_assembly (MonoAssembly *ass, void *user_data)
                }
                if (method->flags & METHOD_ATTRIBUTE_ABSTRACT)
                        continue;
-               if (method->is_generic || method->klass->generic_container)
+               if (method->is_generic || mono_class_is_gtd (method->klass))
                        continue;
 
                count++;
@@ -4240,3 +4332,23 @@ mono_personality (void)
        /* Not used */
        g_assert_not_reached ();
 }
+
+// Custom handlers currently only implemented by Windows.
+#ifndef HOST_WIN32
+gboolean
+mono_runtime_install_custom_handlers (const char *handlers)
+{
+       return FALSE;
+}
+
+void
+mono_runtime_install_custom_handlers_usage (void)
+{
+       fprintf (stdout,
+                "Custom Handlers:\n"
+                "   --handlers=HANDLERS            Enable handler support, HANDLERS is a comma\n"
+                "                                  separated list of available handlers to install.\n"
+                "\n"
+                "No handlers supported on current platform.\n");
+}
+#endif /* HOST_WIN32 */
index 3fe40d2cfc28fdd8a055b003ad58785d5cbd3427..c3f763ac5d0670b23b3a9373ff2f428f730ece1a 100644 (file)
@@ -237,7 +237,7 @@ if (ins->inst_target_bb->native_offset) {                                   \
 #define MAX(a, b) ((a) > (b) ? (a) : (b))
 
 /*
- * imt thunking size values
+ * imt trampoline size values
  */
 #define CMP_SIZE       24
 #define LOADCON_SIZE   20
@@ -268,7 +268,7 @@ if (ins->inst_target_bb->native_offset) {                                   \
 #include <mono/utils/mono-error-internals.h>
 #include <mono/utils/mono-math.h>
 #include <mono/utils/mono-mmap.h>
-#include <mono/utils/mono-hwcap-s390x.h>
+#include <mono/utils/mono-hwcap.h>
 #include <mono/utils/mono-threads.h>
 
 #include "mini-s390x.h"
@@ -399,8 +399,6 @@ pthread_key_t lmf_addr_key;
 
 gboolean lmf_addr_key_inited = FALSE; 
 
-facilityList_t facs;
-
 /*
  * The code generated for sequence points reads from this location, 
  * which is made read-only when single stepping is enabled.
@@ -1294,6 +1292,7 @@ handle_enum:
 
        ip = ((gint64) __builtin_extract_return_addr (__builtin_return_address (0)));
        printf (" ip: %p\n", (gpointer) ip);
+       va_end (ap);
 }
 
 /*========================= End of Function ========================*/
@@ -1330,8 +1329,8 @@ mono_arch_init (void)
        mono_set_partial_sharing_supported (FALSE);
        mono_os_mutex_init_recursive (&mini_arch_mutex);
 
-       ss_trigger_page = mono_valloc (NULL, mono_pagesize (), MONO_MMAP_READ);
-       bp_trigger_page = mono_valloc (NULL, mono_pagesize (), MONO_MMAP_READ);
+       ss_trigger_page = mono_valloc (NULL, mono_pagesize (), MONO_MMAP_READ, MONO_MEM_ACCOUNT_OTHER);
+       bp_trigger_page = mono_valloc (NULL, mono_pagesize (), MONO_MMAP_READ, MONO_MEM_ACCOUNT_OTHER);
        mono_mprotect (bp_trigger_page, mono_pagesize (), 0);
        
        code = (guint8 *) &breakpointCode;
@@ -1356,9 +1355,9 @@ void
 mono_arch_cleanup (void)
 {
        if (ss_trigger_page)
-               mono_vfree (ss_trigger_page, mono_pagesize ());
+               mono_vfree (ss_trigger_page, mono_pagesize (), MONO_MEM_ACCOUNT_OTHER);
        if (bp_trigger_page)
-               mono_vfree (bp_trigger_page, mono_pagesize ());
+               mono_vfree (bp_trigger_page, mono_pagesize (), MONO_MEM_ACCOUNT_OTHER);
        mono_os_mutex_destroy (&mini_arch_mutex);
 }
 
@@ -4370,7 +4369,7 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
                }
                        break;
                case OP_ICONV_TO_R_UN: {
-                       if (facs.fpe) {
+                       if (mono_hwcap_s390x_has_fpe) {
                                s390_cdlfbr (code, ins->dreg, 5, ins->sreg1, 0);
                        } else {
                                s390_llgfr (code, s390_r0, ins->sreg1);
@@ -4379,7 +4378,7 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
                }
                        break;
                case OP_LCONV_TO_R_UN: {
-                       if (facs.fpe) {
+                       if (mono_hwcap_s390x_has_fpe) {
                                s390_cdlgbr (code, ins->dreg, 5, ins->sreg1, 0);
                        } else {
                                short int *jump;
@@ -4416,7 +4415,7 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
                        s390_ngr   (code, ins->dreg, s390_r0);
                        break;
                case OP_FCONV_TO_U1:
-                       if (facs.fpe) {
+                       if (mono_hwcap_s390x_has_fpe) {
                                s390_clgdbr (code, ins->dreg, 5, ins->sreg1, 0);
                                s390_lghi  (code, s390_r0, 0xff);
                                s390_ngr   (code, ins->dreg, s390_r0);
@@ -4433,7 +4432,7 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
                        s390_ngr   (code, ins->dreg, s390_r0);
                        break;
                case OP_FCONV_TO_U2:
-                       if (facs.fpe) {
+                       if (mono_hwcap_s390x_has_fpe) {
                                s390_clgdbr (code, ins->dreg, 5, ins->sreg1, 0);
                                s390_llill  (code, s390_r0, 0xffff);
                                s390_ngr    (code, ins->dreg, s390_r0);
@@ -4447,7 +4446,7 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
                        break;
                case OP_FCONV_TO_U4:
                case OP_FCONV_TO_U:
-                       if (facs.fpe) {
+                       if (mono_hwcap_s390x_has_fpe) {
                                s390_clfdbr (code, ins->dreg, 5, ins->sreg1, 0);
                        } else {
                                code = emit_float_to_int (cfg, code, ins->dreg, ins->sreg1, 4, FALSE);
@@ -4457,7 +4456,7 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
                        s390_cgdbr (code, ins->dreg, 5, ins->sreg1);
                        break;
                case OP_FCONV_TO_U8:
-                       if (facs.fpe) {
+                       if (mono_hwcap_s390x_has_fpe) {
                                s390_clgdbr (code, ins->dreg, 5, ins->sreg1, 0);
                        } else {
                                code = emit_float_to_int (cfg, code, ins->dreg, ins->sreg1, 8, FALSE);
@@ -6664,16 +6663,16 @@ mono_arch_get_delegate_virtual_invoke_impl (MonoMethodSignature *sig, MonoMethod
 
 /*------------------------------------------------------------------*/
 /*                                                                  */
-/* Name                - mono_arch_build_imt_thunk.                        */
+/* Name                - mono_arch_build_imt_trampoline.                       */
 /*                                                                  */
 /* Function    -                                                   */
 /*                                                                 */
 /*------------------------------------------------------------------*/
 
 gpointer
-mono_arch_build_imt_thunk (MonoVTable *vtable, MonoDomain *domain, 
-                          MonoIMTCheckItem **imt_entries, int count,
-                          gpointer fail_tramp)
+mono_arch_build_imt_trampoline (MonoVTable *vtable, MonoDomain *domain, 
+                                                               MonoIMTCheckItem **imt_entries, int count,
+                                                               gpointer fail_tramp)
 {
        int i;
        int size = 0;
@@ -6712,7 +6711,7 @@ mono_arch_build_imt_thunk (MonoVTable *vtable, MonoDomain *domain,
        }
 
        if (fail_tramp)
-               code = mono_method_alloc_generic_virtual_thunk (domain, size);
+               code = mono_method_alloc_generic_virtual_trampoline (domain, size);
        else
                code = mono_domain_code_reserve (domain, size);
 
@@ -6795,11 +6794,11 @@ mono_arch_build_imt_thunk (MonoVTable *vtable, MonoDomain *domain,
        mono_profiler_code_buffer_new (start, code - start, MONO_PROFILER_CODE_BUFFER_IMT_TRAMPOLINE, NULL);
 
        if (!fail_tramp) 
-               mono_stats.imt_thunks_size += (code - start);
+               mono_stats.imt_trampolines_size += (code - start);
 
        g_assert (code - start <= size);
 
-       snprintf(trampName, sizeof(trampName), "%d_imt_thunk_trampoline", domain->domain_id);
+       snprintf(trampName, sizeof(trampName), "%d_imt_trampoline", domain->domain_id);
        mono_tramp_info_register (mono_tramp_info_create (trampName, start, code - start, NULL, NULL), domain);
 
        return (start);
@@ -7077,7 +7076,7 @@ mono_arch_cpu_enumerate_simd_versions (void)
 {
        guint32 sseOpts = 0;
 
-       if (facs.vec != 0) 
+       if (mono_hwcap_s390x_has_vec)
                sseOpts = (SIMD_VERSION_SSE1  | SIMD_VERSION_SSE2 |
                           SIMD_VERSION_SSE3  | SIMD_VERSION_SSSE3 |
                           SIMD_VERSION_SSE41 | SIMD_VERSION_SSE42 |
index 022f8a5e790b8ea9334d4fa61bb7f92c99229c9f..e43410353d1928e5b6ba332a678ca45426c7047b 100644 (file)
@@ -28,7 +28,7 @@
 #include <mono/metadata/debug-helpers.h>
 #include <mono/metadata/tokentype.h>
 #include <mono/utils/mono-math.h>
-#include <mono/utils/mono-hwcap-sparc.h>
+#include <mono/utils/mono-hwcap.h>
 
 #include "mini-sparc.h"
 #include "trace.h"
@@ -2256,8 +2256,8 @@ mono_sparc_is_virtual_call (guint32 *code)
  * LOCKING: called with the domain lock held
  */
 gpointer
-mono_arch_build_imt_thunk (MonoVTable *vtable, MonoDomain *domain, MonoIMTCheckItem **imt_entries, int count,
-       gpointer fail_tramp)
+mono_arch_build_imt_trampoline (MonoVTable *vtable, MonoDomain *domain, MonoIMTCheckItem **imt_entries, int count,
+                                                               gpointer fail_tramp)
 {
        int i;
        int size = 0;
@@ -2285,7 +2285,7 @@ mono_arch_build_imt_thunk (MonoVTable *vtable, MonoDomain *domain, MonoIMTCheckI
                size += item->chunk_size;
        }
        if (fail_tramp)
-               code = mono_method_alloc_generic_virtual_thunk (domain, size * 4);
+               code = mono_method_alloc_generic_virtual_trampoline (domain, size * 4);
        else
                code = mono_domain_code_reserve (domain, size * 4);
        start = code;
@@ -2352,7 +2352,7 @@ mono_arch_build_imt_thunk (MonoVTable *vtable, MonoDomain *domain, MonoIMTCheckI
 
        mono_arch_flush_icache ((guint8*)start, (code - start) * 4);
 
-       mono_stats.imt_thunks_size += (code - start) * 4;
+       mono_stats.imt_trampolines_size += (code - start) * 4;
        g_assert (code - start <= size);
 
        mono_tramp_info_register (mono_tramp_info_create (NULL, start, code - start, NULL, NULL), domain);
index 8c1fe23297bffd8ba8b6ce8c9a6f43e62fff2b78..7f37b4d8595122215981e9ac372ad48ab5b732fe 100644 (file)
@@ -198,8 +198,8 @@ mini_resolve_imt_method (MonoVTable *vt, gpointer *vtable_slot, MonoMethod *imt_
                /* imt_method->slot might not be set */
                impl = mono_class_get_vtable_entry (vt->klass, interface_offset + mono_method_get_declaring_generic_method (imt_method)->slot);
 
-               if (impl->klass->generic_class)
-                       context.class_inst = impl->klass->generic_class->context.class_inst;
+               if (mono_class_is_ginst (impl->klass))
+                       context.class_inst = mono_class_get_generic_class (impl->klass)->context.class_inst;
                context.method_inst = ((MonoMethodInflated*)imt_method)->context.method_inst;
                impl = mono_class_inflate_generic_method_checked (impl, &context, error);
                mono_error_assert_ok (error);
@@ -366,12 +366,9 @@ mini_add_method_trampoline (MonoMethod *m, gpointer compiled_method, gboolean ad
 
        if (callee_array_helper) {
                add_static_rgctx_tramp = FALSE;
-               /* FIXME: ji->from_aot is not set for llvm methods */
-               if (ji && (ji->from_aot || mono_aot_only)) {
-                       /* In AOT mode, compiled_method points to one of the InternalArray methods in Array. */
-                       if (!mono_llvm_only && mono_method_needs_static_rgctx_invoke (jinfo_get_method (ji), TRUE))
-                               add_static_rgctx_tramp = TRUE;
-               }
+               /* In AOT mode, compiled_method points to one of the InternalArray methods in Array. */
+               if (ji && !mono_llvm_only && mono_method_needs_static_rgctx_invoke (jinfo_get_method (ji), TRUE))
+                       add_static_rgctx_tramp = TRUE;
        }
 
        if (mono_llvm_only)
@@ -564,7 +561,7 @@ common_call_trampoline (mgreg_t *regs, guint8 *code, MonoMethod *m, MonoVTable *
                        vtable_slot = mini_resolve_imt_method (vt, vtable_slot, imt_method, &impl_method, &addr, &need_rgctx_tramp, &variant_iface, error);
                        return_val_if_nok (error, NULL);
 
-                       /* This is the vcall slot which gets called through the IMT thunk */
+                       /* This is the vcall slot which gets called through the IMT trampoline */
                        vtable_slot_to_patch = vtable_slot;
 
                        if (addr) {
@@ -594,10 +591,10 @@ common_call_trampoline (mgreg_t *regs, guint8 *code, MonoMethod *m, MonoVTable *
                else
                        declaring = m;
 
-               if (m->klass->generic_class)
-                       context.class_inst = m->klass->generic_class->context.class_inst;
+               if (mono_class_is_ginst (m->klass))
+                       context.class_inst = mono_class_get_generic_class (m->klass)->context.class_inst;
                else
-                       g_assert (!m->klass->generic_container);
+                       g_assert (!mono_class_is_gtd (m->klass));
 
                generic_virtual = mono_arch_find_imt_method (regs, code);
                g_assert (generic_virtual);
@@ -665,10 +662,10 @@ common_call_trampoline (mgreg_t *regs, guint8 *code, MonoMethod *m, MonoVTable *
                        else
                                declaring = m;
 
-                       if (klass->generic_class)
-                               context.class_inst = klass->generic_class->context.class_inst;
-                       else if (klass->generic_container)
-                               context.class_inst = klass->generic_container->context.class_inst;
+                       if (mono_class_is_ginst (klass))
+                               context.class_inst = mono_class_get_generic_class (klass)->context.class_inst;
+                       else if (mono_class_is_gtd (klass))
+                               context.class_inst = mono_class_get_generic_container (klass)->context.class_inst;
                        context.method_inst = method_inst;
 
                        actual_method = mono_class_inflate_generic_method_checked (declaring, &context, error);
@@ -853,7 +850,7 @@ mono_vcall_trampoline (mgreg_t *regs, guint8 *code, int slot, guint8 *tramp)
        gpointer *vtable_slot;
        MonoMethod *m;
        MonoError error;
-       gpointer addr, res;
+       gpointer addr, res = NULL;
 
        trampoline_calls ++;
 
@@ -938,10 +935,10 @@ mono_generic_virtual_remoting_trampoline (mgreg_t *regs, guint8 *code, MonoMetho
        else
                declaring = m;
 
-       if (m->klass->generic_class)
-               context.class_inst = m->klass->generic_class->context.class_inst;
+       if (mono_class_is_ginst (m->klass))
+               context.class_inst = mono_class_get_generic_class (m->klass)->context.class_inst;
        else
-               g_assert (!m->klass->generic_container);
+               g_assert (!mono_class_is_gtd (m->klass));
 
        imt_method = mono_arch_find_imt_method (regs, code);
        if (imt_method->is_inflated)
@@ -1191,7 +1188,7 @@ mono_delegate_trampoline (mgreg_t *regs, guint8 *code, gpointer *arg, guint8* tr
                         * If the call doesn't return a valuetype, then the vcall uses the same calling
                         * convention as a normal call.
                         */
-                       if (((method->klass->flags & TYPE_ATTRIBUTE_SEALED) || !(method->flags & METHOD_ATTRIBUTE_VIRTUAL)) && !MONO_TYPE_ISSTRUCT (sig->ret)) {
+                       if ((mono_class_is_sealed (method->klass) || !(method->flags & METHOD_ATTRIBUTE_VIRTUAL)) && !MONO_TYPE_ISSTRUCT (sig->ret)) {
                                callvirt = FALSE;
                                enable_caching = FALSE;
                        }
@@ -1200,7 +1197,7 @@ mono_delegate_trampoline (mgreg_t *regs, guint8 *code, gpointer *arg, guint8* tr
                if (delegate->target && 
                        method->flags & METHOD_ATTRIBUTE_VIRTUAL && 
                        method->flags & METHOD_ATTRIBUTE_ABSTRACT &&
-                       method->klass->flags & TYPE_ATTRIBUTE_ABSTRACT) {
+                       mono_class_is_abstract (method->klass)) {
                        method = mono_object_get_virtual_method (delegate->target, method);
                        enable_caching = FALSE;
                }
diff --git a/mono/mini/mini-windows-dllmain.c b/mono/mini/mini-windows-dllmain.c
new file mode 100644 (file)
index 0000000..887a6a1
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * mini-windows-dllmain.c: DllMain entry point.
+ *
+ * (C) 2002-2003 Ximian, Inc.
+ * (C) 2003-2006 Novell, Inc.
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
+ */
+
+#include <mono/metadata/coree.h>
+#include <mono/metadata/gc-internals.h>
+#include <mono/metadata/domain-internals.h>
+#include <mono/utils/mono-threads.h>
+#include "mini.h"
+
+#ifdef HOST_WIN32
+#include <windows.h>
+
+BOOL APIENTRY DllMain (HMODULE module_handle, DWORD reason, LPVOID reserved)
+{
+       if (!mono_gc_dllmain (module_handle, reason, reserved))
+               return FALSE;
+
+       switch (reason)
+       {
+       case DLL_PROCESS_ATTACH:
+               mono_install_runtime_load (mini_init);
+               break;
+       case DLL_PROCESS_DETACH:
+               if (coree_module_handle)
+                       FreeLibrary (coree_module_handle);
+               break;
+       case DLL_THREAD_DETACH:
+               mono_thread_info_detach ();
+               break;
+       
+       }
+       return TRUE;
+}
+#endif
+
diff --git a/mono/mini/mini-windows-uwp.c b/mono/mini/mini-windows-uwp.c
new file mode 100644 (file)
index 0000000..2d47970
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * mini-windows-uwp.c: UWP profiler stat support for Mono.
+ *
+ * Copyright 2016 Microsoft
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
+ */
+#include <config.h>
+#include <glib.h>
+#include "mono/utils/mono-compiler.h"
+
+#if G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT)
+#include <windows.h>
+
+void
+mono_runtime_setup_stat_profiler (void)
+{
+       g_unsupported_api ("OpenThread, GetThreadContext");
+       SetLastError (ERROR_NOT_SUPPORTED);
+       return;
+}
+
+void
+mono_runtime_shutdown_stat_profiler (void)
+{
+       g_unsupported_api ("OpenThread, GetThreadContext");
+       SetLastError (ERROR_NOT_SUPPORTED);
+       return;
+}
+
+static gboolean
+mono_setup_thread_context(DWORD thread_id, MonoContext *mono_context)
+{
+       memset (mono_context, 0, sizeof (MonoContext));
+       return FALSE;
+}
+
+#else /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
+
+MONO_EMPTY_SOURCE_FILE (mini_windows_uwp);
+#endif /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
+
index e7764e91beb749709474b294aef00cb5c30932ce..728583f3bf1b6c504ffbf9b82614cad8dce5d701 100644 (file)
@@ -13,6 +13,8 @@
 #include <config.h>
 #include <signal.h>
 #include <math.h>
+#include <conio.h>
+#include <assert.h>
 
 #include <mono/metadata/assembly.h>
 #include <mono/metadata/loader.h>
@@ -44,6 +46,7 @@
 #include <mono/utils/dtrace.h>
 
 #include "mini.h"
+#include "mini-windows.h"
 #include <string.h>
 #include <ctype.h>
 #include "trace.h"
 
 #include "jit-icalls.h"
 
-#ifdef _WIN32
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
 #include <mmsystem.h>
 #endif
 
+#define MONO_HANDLER_DELIMITER ','
+#define MONO_HANDLER_DELIMITER_LEN G_N_ELEMENTS(MONO_HANDLER_DELIMITER)-1
+
+#define MONO_HANDLER_ATEXIT_WAIT_KEYPRESS "atexit-waitkeypress"
+#define MONO_HANDLER_ATEXIT_WAIT_KEYPRESS_LEN G_N_ELEMENTS(MONO_HANDLER_ATEXIT_WAIT_KEYPRESS)-1
+
+// Typedefs used to setup handler table.
+typedef void (*handler)(void);
+
+typedef struct {
+       const char * cmd;
+       const int cmd_len;
+       handler handler;
+} HandlerItem;
+
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
+/**
+* atexit_wait_keypress:
+*
+* This function is installed as an atexit function making sure that the console is not terminated before the end user has a chance to read the result.
+* This can be handy in debug scenarios (running from within the debugger) since an exit of the process will close the console window
+* without giving the end user a chance to look at the output before closed.
+*/
+static void
+atexit_wait_keypress (void)
+{
+
+       fflush (stdin);
+
+       printf ("Press any key to continue . . . ");
+       fflush (stdout);
+
+       _getch ();
+
+       return;
+}
+
+/**
+* install_atexit_wait_keypress:
+*
+* This function installs the wait keypress exit handler.
+*/
+static void
+install_atexit_wait_keypress (void)
+{
+       atexit (atexit_wait_keypress);
+       return;
+}
+
+#else
+
+/**
+* install_atexit_wait_keypress:
+*
+* Not supported on WINAPI family.
+*/
+static void
+install_atexit_wait_keypress (void)
+{
+       return;
+}
+
+#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */
+
+// Table describing handlers that can be installed at process startup. Adding a new handler can be done by adding a new item to the table together with an install handler function.
+const HandlerItem g_handler_items[] = { { MONO_HANDLER_ATEXIT_WAIT_KEYPRESS, MONO_HANDLER_ATEXIT_WAIT_KEYPRESS_LEN, install_atexit_wait_keypress },
+                                       { NULL, 0, NULL } };
+
+/**
+ * get_handler_arg_len:
+ * @handlers: Get length of next handler.
+ *
+ * This function calculates the length of next handler included in argument.
+ *
+ * Returns: The length of next handler, if available.
+ */
+static size_t
+get_next_handler_arg_len (const char *handlers)
+{
+       assert (handlers != NULL);
+
+       size_t current_len = 0;
+       const char *handler = strchr (handlers, MONO_HANDLER_DELIMITER);
+       if (handler != NULL) {
+               // Get length of next handler arg.
+               current_len = (handler - handlers);
+       } else {
+               // Consume rest as length of next handler arg.
+               current_len = strlen (handlers);
+       }
+
+       return current_len;
+}
+
+/**
+ * install_custom_handler:
+ * @handlers: Handlers included in --handler argument, example "atexit-waitkeypress,someothercmd,yetanothercmd".
+ * @handler_arg_len: Output, length of consumed handler.
+ *
+ * This function installs the next handler included in @handlers parameter.
+ *
+ * Returns: TRUE on successful install, FALSE on failure or unrecognized handler.
+ */
+static gboolean
+install_custom_handler (const char *handlers, size_t *handler_arg_len)
+{
+       gboolean result = FALSE;
+
+       assert (handlers != NULL);
+       assert (handler_arg_len);
+
+       *handler_arg_len = get_next_handler_arg_len (handlers);
+       for (int current_item = 0; current_item < G_N_ELEMENTS (g_handler_items); ++current_item) {
+               const HandlerItem * handler_item = &g_handler_items [current_item];
+
+               if (handler_item->cmd == NULL)
+                       continue;
+
+               if (*handler_arg_len == handler_item->cmd_len && strncmp (handlers, handler_item->cmd, *handler_arg_len) == 0) {
+                       assert (handler_item->handler != NULL);
+                       handler_item->handler ();
+                       result = TRUE;
+                       break;
+               }
+       }
+       return result;
+}
+
 void
 mono_runtime_install_handlers (void)
 {
@@ -68,6 +199,44 @@ mono_runtime_install_handlers (void)
 #endif
 }
 
+gboolean
+mono_runtime_install_custom_handlers (const char *handlers)
+{
+       gboolean result = FALSE;
+
+       assert (handlers != NULL);
+       while (*handlers != '\0') {
+               size_t handler_arg_len = 0;
+
+               result = install_custom_handler (handlers, &handler_arg_len);
+               handlers += handler_arg_len;
+
+               if (*handlers == MONO_HANDLER_DELIMITER)
+                       handlers++;
+               if (!result)
+                       break;
+       }
+
+       return result;
+}
+
+void
+mono_runtime_install_custom_handlers_usage (void)
+{
+       fprintf (stdout,
+                "Custom Handlers:\n"
+                "   --handlers=HANDLERS            Enable handler support, HANDLERS is a comma\n"
+                "                                  separated list of available handlers to install.\n"
+                "\n"
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
+                "HANDLERS is composed of:\n"
+                "    atexit-waitkeypress           Install an atexit handler waiting for a keypress\n"
+                "                                  before exiting process.\n");
+#else
+                "No handlers supported on current platform.\n");
+#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */
+}
+
 void
 mono_runtime_cleanup_handlers (void)
 {
@@ -91,16 +260,17 @@ MONO_SIG_HANDLER_SIGNATURE (mono_chain_signal)
        return TRUE;
 }
 
-static HANDLE win32_main_thread;
-static MMRESULT win32_timer;
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
+static MMRESULT        g_timer_event = 0;
+static HANDLE g_timer_main_thread = INVALID_HANDLE_VALUE;
 
-static void CALLBACK
-win32_time_proc (UINT uID, UINT uMsg, DWORD dwUser, DWORD dw1, DWORD dw2)
+static VOID
+thread_timer_expired (HANDLE thread)
 {
        CONTEXT context;
 
        context.ContextFlags = CONTEXT_CONTROL;
-       if (GetThreadContext (win32_main_thread, &context)) {
+       if (GetThreadContext (thread, &context)) {
 #ifdef _WIN64
                mono_profiler_stat_hit ((guchar *) context.Rip, &context);
 #else
@@ -109,57 +279,75 @@ win32_time_proc (UINT uID, UINT uMsg, DWORD dwUser, DWORD dw1, DWORD dw2)
        }
 }
 
-void
-mono_runtime_setup_stat_profiler (void)
+static VOID CALLBACK
+timer_event_proc (UINT uID, UINT uMsg, DWORD_PTR dwUser, DWORD_PTR dw1, DWORD_PTR dw2)
 {
-       static int inited = 0;
-       TIMECAPS timecaps;
+       thread_timer_expired ((HANDLE)dwUser);
+}
 
-       if (inited)
-               return;
+static VOID
+stop_profiler_timer_event (void)
+{
+       if (g_timer_event != 0) {
+
+               timeKillEvent (g_timer_event);
+               g_timer_event = 0;
+       }
+
+       if (g_timer_main_thread != INVALID_HANDLE_VALUE) {
+
+               CloseHandle (g_timer_main_thread);
+               g_timer_main_thread = INVALID_HANDLE_VALUE;
+       }
+}
+
+static VOID
+start_profiler_timer_event (void)
+{
+       g_return_if_fail (g_timer_main_thread == INVALID_HANDLE_VALUE && g_timer_event == 0);
+
+       TIMECAPS timecaps;
 
-       inited = 1;
        if (timeGetDevCaps (&timecaps, sizeof (timecaps)) != TIMERR_NOERROR)
                return;
 
-       if ((win32_main_thread = OpenThread (READ_CONTROL | THREAD_GET_CONTEXT, FALSE, GetCurrentThreadId ())) == NULL)
+       g_timer_main_thread = OpenThread (READ_CONTROL | THREAD_GET_CONTEXT, FALSE, GetCurrentThreadId ());
+       if (g_timer_main_thread == NULL)
                return;
 
        if (timeBeginPeriod (1) != TIMERR_NOERROR)
                return;
 
-       if ((win32_timer = timeSetEvent (1, 0, (LPTIMECALLBACK)win32_time_proc, (DWORD_PTR)NULL, TIME_PERIODIC)) == 0) {
+       g_timer_event = timeSetEvent (1, 0, (LPTIMECALLBACK)timer_event_proc, (DWORD_PTR)g_timer_main_thread, TIME_PERIODIC | TIME_KILL_SYNCHRONOUS);
+       if (g_timer_event == 0) {
                timeEndPeriod (1);
                return;
        }
 }
 
+void
+mono_runtime_setup_stat_profiler (void)
+{
+       start_profiler_timer_event ();
+       return;
+}
+
 void
 mono_runtime_shutdown_stat_profiler (void)
 {
+       stop_profiler_timer_event ();
+       return;
 }
 
 gboolean
-mono_thread_state_init_from_handle (MonoThreadUnwindState *tctx, MonoThreadInfo *info)
+mono_setup_thread_context(DWORD thread_id, MonoContext *mono_context)
 {
-       DWORD id = mono_thread_info_get_tid (info);
        HANDLE handle;
        CONTEXT context;
-       DWORD result;
-       MonoContext *ctx;
-       MonoJitTlsData *jit_tls;
-       void *domain;
-       MonoLMF *lmf = NULL;
-       gpointer *addr;
-
-       tctx->valid = FALSE;
-       tctx->unwind_data [MONO_UNWIND_DATA_DOMAIN] = NULL;
-       tctx->unwind_data [MONO_UNWIND_DATA_LMF] = NULL;
-       tctx->unwind_data [MONO_UNWIND_DATA_JIT_TLS] = NULL;
 
-       g_assert (id != GetCurrentThreadId ());
+       g_assert (thread_id != GetCurrentThreadId ());
 
-       handle = OpenThread (THREAD_ALL_ACCESS, FALSE, id);
+       handle = OpenThread (THREAD_ALL_ACCESS, FALSE, thread_id);
        g_assert (handle);
 
        context.ContextFlags = CONTEXT_INTEGER | CONTEXT_CONTROL;
@@ -172,10 +360,29 @@ mono_thread_state_init_from_handle (MonoThreadUnwindState *tctx, MonoThreadInfo
        g_assert (context.ContextFlags & CONTEXT_INTEGER);
        g_assert (context.ContextFlags & CONTEXT_CONTROL);
 
-       ctx = &tctx->ctx;
+       memset (mono_context, 0, sizeof (MonoContext));
+       mono_sigctx_to_monoctx (&context, mono_context);
 
-       memset (ctx, 0, sizeof (MonoContext));
-       mono_sigctx_to_monoctx (&context, ctx);
+       CloseHandle (handle);
+       return TRUE;
+}
+#endif /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
+
+gboolean
+mono_thread_state_init_from_handle (MonoThreadUnwindState *tctx, MonoThreadInfo *info)
+{
+       DWORD id = mono_thread_info_get_tid (info);
+       MonoJitTlsData *jit_tls;
+       void *domain;
+       MonoLMF *lmf = NULL;
+       gpointer *addr;
+
+       tctx->valid = FALSE;
+       tctx->unwind_data [MONO_UNWIND_DATA_DOMAIN] = NULL;
+       tctx->unwind_data [MONO_UNWIND_DATA_LMF] = NULL;
+       tctx->unwind_data [MONO_UNWIND_DATA_JIT_TLS] = NULL;
+
+       mono_setup_thread_context(id, &tctx->ctx);
 
        /* mono_set_jit_tls () sets this */
        jit_tls = mono_thread_info_tls_get (info, TLS_KEY_JIT_TLS);
@@ -203,4 +410,3 @@ mono_thread_state_init_from_handle (MonoThreadUnwindState *tctx, MonoThreadInfo
 
        return TRUE;
 }
-
diff --git a/mono/mini/mini-windows.h b/mono/mini/mini-windows.h
new file mode 100644 (file)
index 0000000..ba823c3
--- /dev/null
@@ -0,0 +1,15 @@
+#ifndef __MONO_MINI_WINDOWS_H__
+#define __MONO_MINI_WINDOWS_H__
+
+#include <config.h>
+#include <glib.h>
+
+#ifdef HOST_WIN32
+#include "windows.h"
+#include "mini.h"
+#include "mono/utils/mono-context.h"
+
+gboolean
+mono_setup_thread_context(DWORD thread_id, MonoContext *mono_context);
+#endif /* HOST_WIN32 */
+#endif /* __MONO_MINI_WINDOWS_H__ */
index 9e1702be17c8e32286f5233e2423a4740d2b59ec..bcd050b24f64ce11327d9d3d368dece51e36a3ce 100644 (file)
@@ -29,7 +29,7 @@
 #include <mono/utils/mono-counters.h>
 #include <mono/utils/mono-mmap.h>
 #include <mono/utils/mono-memory-model.h>
-#include <mono/utils/mono-hwcap-x86.h>
+#include <mono/utils/mono-hwcap.h>
 #include <mono/utils/mono-threads.h>
 
 #include "trace.h"
@@ -5613,7 +5613,7 @@ imt_branch_distance (MonoIMTCheckItem **imt_entries, int start, int target)
  * LOCKING: called with the domain lock held
  */
 gpointer
-mono_arch_build_imt_thunk (MonoVTable *vtable, MonoDomain *domain, MonoIMTCheckItem **imt_entries, int count,
+mono_arch_build_imt_trampoline (MonoVTable *vtable, MonoDomain *domain, MonoIMTCheckItem **imt_entries, int count,
        gpointer fail_tramp)
 {
        int i;
@@ -5645,7 +5645,7 @@ mono_arch_build_imt_thunk (MonoVTable *vtable, MonoDomain *domain, MonoIMTCheckI
                size += item->chunk_size;
        }
        if (fail_tramp)
-               code = mono_method_alloc_generic_virtual_thunk (domain, size);
+               code = mono_method_alloc_generic_virtual_trampoline (domain, size);
        else
                code = mono_domain_code_reserve (domain, size);
        start = code;
@@ -5715,7 +5715,7 @@ mono_arch_build_imt_thunk (MonoVTable *vtable, MonoDomain *domain, MonoIMTCheckI
        }
 
        if (!fail_tramp)
-               mono_stats.imt_thunks_size += code - start;
+               mono_stats.imt_trampolines_size += code - start;
        g_assert (code - start <= size);
 
 #if DEBUG_IMT
@@ -5730,7 +5730,7 @@ mono_arch_build_imt_thunk (MonoVTable *vtable, MonoDomain *domain, MonoIMTCheckI
                if (vtable)
                        buff = g_strdup_printf ("imt_%s_%s_entries_%d", vtable->klass->name_space, vtable->klass->name, count);
                else
-                       buff = g_strdup_printf ("imt_thunk_entries_%d", count);
+                       buff = g_strdup_printf ("imt_trampoline_entries_%d", count);
                mono_emit_jit_tramp (start, code - start, buff);
                g_free (buff);
        }
index b70d836c2aa07fd9758bf632c62cb5cd404582a1..be98276e63f2ae26e8fe3f70dd2816901932562c 100644 (file)
@@ -207,7 +207,7 @@ typedef struct {
 #define MONO_ARCH_VTABLE_REG X86_EDX
 #define MONO_ARCH_RGCTX_REG MONO_ARCH_IMT_REG
 #define MONO_ARCH_EXC_REG X86_EAX
-#define MONO_ARCH_HAVE_GENERALIZED_IMT_THUNK 1
+#define MONO_ARCH_HAVE_GENERALIZED_IMT_TRAMPOLINE 1
 #define MONO_ARCH_HAVE_LIVERANGE_OPS 1
 #define MONO_ARCH_HAVE_SIGCTX_TO_MONOCTX 1
 #define MONO_ARCH_HAVE_FULL_AOT_TRAMPOLINES 1
index fff5ece8d5512e319ffe7c3a70bbaf25e5ba2b24..4da25a4d439edda2babe9a41e70d0ea1912c2b05 100644 (file)
@@ -419,6 +419,8 @@ mono_type_to_load_membase (MonoCompile *cfg, MonoType *type)
        case MONO_TYPE_TYPEDBYREF:
                return OP_LOADV_MEMBASE;
        case MONO_TYPE_GENERICINST:
+               if (MONO_CLASS_IS_SIMD (cfg, mono_class_from_mono_type (type)))
+                       return OP_LOADX_MEMBASE;
                if (mono_type_generic_inst_is_valuetype (type))
                        return OP_LOADV_MEMBASE;
                else
@@ -1052,7 +1054,7 @@ mini_method_verify (MonoCompile *cfg, MonoMethod *method, gboolean fail_compile)
                                        else if (info->exception_type == MONO_EXCEPTION_FIELD_ACCESS)
                                                mono_error_set_generic_error (&cfg->error, "System", "FieldAccessException", "%s", msg);
                                        else if (info->exception_type == MONO_EXCEPTION_UNVERIFIABLE_IL)
-                                               mono_error_set_generic_error (&cfg->error, "System.Security", "VerificationException", msg);
+                                               mono_error_set_generic_error (&cfg->error, "System.Security", "VerificationException", "%s", msg);
                                        if (!mono_error_ok (&cfg->error)) {
                                                mono_cfg_set_exception (cfg, MONO_EXCEPTION_MONO_ERROR);
                                                g_free (msg);
@@ -1983,6 +1985,18 @@ mono_create_tls_get (MonoCompile *cfg, MonoTlsKey key)
        if (!cfg->backend->have_tls_get)
                return NULL;
 
+#ifdef HAVE_KW_THREAD
+       /*
+        * MONO_THREAD_VAR_OFFSET definitions don't work when loading mono as a
+        * dynamic library. This means that we need to be conservative and don't
+        * aot code that contains these tls chunks.
+        *
+        * FIXME Remove HAVE_KW_THREAD altogether and use only pthread since it
+        * simplifies the code alot.
+        */
+       if (!cfg->full_aot)
+               cfg->disable_aot = TRUE;
+#endif
        /*
         * TLS offsets might be different at AOT time, so load them from a GOT slot and
         * use a different opcode.
@@ -2410,7 +2424,7 @@ mono_codegen (MonoCompile *cfg)
                gboolean is_generic = FALSE;
 
                if (cfg->method->is_inflated || mono_method_get_generic_container (cfg->method) ||
-                               cfg->method->klass->generic_container || cfg->method->klass->generic_class) {
+                               mono_class_is_gtd (cfg->method->klass) || mono_class_is_ginst (cfg->method->klass)) {
                        is_generic = TRUE;
                }
 
@@ -3124,8 +3138,8 @@ init_backend (MonoBackend *backend)
 #ifdef MONO_ARCH_HAVE_OBJC_GET_SELECTOR
        backend->have_objc_get_selector = 1;
 #endif
-#ifdef MONO_ARCH_HAVE_GENERALIZED_IMT_THUNK
-       backend->have_generalized_imt_thunk = 1;
+#ifdef MONO_ARCH_HAVE_GENERALIZED_IMT_TRAMPOLINE
+       backend->have_generalized_imt_trampoline = 1;
 #endif
 #ifdef MONO_ARCH_GSHARED_SUPPORTED
        backend->gshared_supported = 1;
@@ -3163,6 +3177,9 @@ init_backend (MonoBackend *backend)
 #ifdef MONO_ARCH_DYN_CALL_PARAM_AREA
        backend->dyn_call_param_area = MONO_ARCH_DYN_CALL_PARAM_AREA;
 #endif
+#ifdef MONO_ARCH_NO_DIV_WITH_MUL
+       backend->disable_div_with_mul = 1;
+#endif
 }
 
 /*
@@ -3300,6 +3317,7 @@ mini_method_compile (MonoMethod *method, guint32 opts, MonoDomain *domain, JitFl
        cfg->soft_breakpoints = debug_options.soft_breakpoints;
        cfg->check_pinvoke_callconv = debug_options.check_pinvoke_callconv;
        cfg->disable_direct_icalls = disable_direct_icalls;
+       cfg->direct_pinvoke = (flags & JIT_FLAG_DIRECT_PINVOKE) != 0;
        if (try_generic_shared)
                cfg->gshared = TRUE;
        cfg->compile_llvm = try_llvm;
@@ -3320,7 +3338,7 @@ mini_method_compile (MonoMethod *method, guint32 opts, MonoDomain *domain, JitFl
                cfg->seq_points = g_ptr_array_new ();
        mono_error_init (&cfg->error);
 
-       if (cfg->compile_aot && !try_generic_shared && (method->is_generic || method->klass->generic_container || method_is_gshared)) {
+       if (cfg->compile_aot && !try_generic_shared && (method->is_generic || mono_class_is_gtd (method->klass) || method_is_gshared)) {
                cfg->exception_type = MONO_EXCEPTION_GENERIC_SHARING_FAILED;
                return cfg;
        }
@@ -4041,7 +4059,7 @@ void
 mono_cfg_set_exception_invalid_program (MonoCompile *cfg, char *msg)
 {
        mono_cfg_set_exception (cfg, MONO_EXCEPTION_MONO_ERROR);
-       mono_error_set_generic_error (&cfg->error, "System", "InvalidProgramException", msg);
+       mono_error_set_generic_error (&cfg->error, "System", "InvalidProgramException", "%s", msg);
 }
 
 #endif /* DISABLE_JIT */
@@ -4229,7 +4247,7 @@ mono_jit_compile_method_inner (MonoMethod *method, MonoDomain *target_domain, in
 
        if (mono_aot_only) {
                char *fullname = mono_method_full_name (method, TRUE);
-               mono_error_set_execution_engine (error, "Attempting to JIT compile method '%s' while running with --aot-only. See http://docs.xamarin.com/ios/about/limitations for more information.\n", fullname);
+               mono_error_set_execution_engine (error, "Attempting to JIT compile method '%s' while running in aot-only mode. See https://developer.xamarin.com/guides/ios/advanced_topics/limitations/ for more information.\n", fullname);
                g_free (fullname);
 
                return NULL;
@@ -4385,9 +4403,8 @@ mono_jit_compile_method_inner (MonoMethod *method, MonoDomain *target_domain, in
 
        vtable = mono_class_vtable (target_domain, method->klass);
        if (!vtable) {
-               ex = mono_class_get_exception_for_failure (method->klass);
-               g_assert (ex);
-               mono_error_set_exception_instance (error, ex);
+               g_assert (mono_class_has_failure (method->klass));
+               mono_error_set_for_class_failure (error, method->klass);
                return NULL;
        }
 
index acf723adbb2dabe5abbeb2f9a1fb7d79e2031e37..239cdd38ebd3f904286268f91c53b52627de0e87 100644 (file)
 #endif
 
 /* Version number of the AOT file format */
-#define MONO_AOT_FILE_VERSION 136
+#define MONO_AOT_FILE_VERSION 137
 
 //TODO: This is x86/amd64 specific.
 #define mono_simd_shuffle_mask(a,b,c,d) ((a) | ((b) << 2) | ((c) << 4) | ((d) << 6))
@@ -179,7 +179,7 @@ enum {
 typedef enum {
        MONO_AOT_TRAMP_SPECIFIC = 0,
        MONO_AOT_TRAMP_STATIC_RGCTX = 1,
-       MONO_AOT_TRAMP_IMT_THUNK = 2,
+       MONO_AOT_TRAMP_IMT = 2,
        MONO_AOT_TRAMP_GSHAREDVT_ARG = 3,
        MONO_AOT_TRAMP_NUM = 4
 } MonoAotTrampoline;
@@ -254,7 +254,7 @@ typedef struct MonoAotFileInfo
        /* Blocks of various kinds of trampolines */
        gpointer specific_trampolines;
        gpointer static_rgctx_trampolines;
-       gpointer imt_thunks;
+       gpointer imt_trampolines;
        gpointer gsharedvt_arg_trampolines;
        /* In static mode, points to a table of global symbols for trampolines etc */
        gpointer globals;
@@ -490,6 +490,7 @@ enum {
 
 #define MONO_IS_SETCC(ins) ((((ins)->opcode >= OP_CEQ) && ((ins)->opcode <= OP_CLT_UN)) || (((ins)->opcode >= OP_ICEQ) && ((ins)->opcode <= OP_ICLE_UN)) || (((ins)->opcode >= OP_LCEQ) && ((ins)->opcode <= OP_LCLT_UN)) || (((ins)->opcode >= OP_FCEQ) && ((ins)->opcode <= OP_FCLT_UN)))
 
+#define MONO_HAS_CUSTOM_EMULATION(ins) (((ins)->opcode >= OP_FBEQ && (ins)->opcode <= OP_FBLT_UN) || ((ins)->opcode >= OP_FCEQ && (ins)->opcode <= OP_FCLT_UN))
 
 #define MONO_IS_LOAD_MEMBASE(ins) (((ins)->opcode >= OP_LOAD_MEMBASE && (ins)->opcode <= OP_LOADV_MEMBASE) || ((ins)->opcode >= OP_ATOMIC_LOAD_I1 && (ins)->opcode <= OP_ATOMIC_LOAD_R8))
 #define MONO_IS_STORE_MEMBASE(ins) (((ins)->opcode >= OP_STORE_MEMBASE_REG && (ins)->opcode <= OP_STOREV_MEMBASE) || ((ins)->opcode >= OP_ATOMIC_STORE_I1 && (ins)->opcode <= OP_ATOMIC_STORE_R8))
@@ -504,9 +505,11 @@ enum {
 
 /* FIXME: Add more instructions */
 /* INEG sets the condition codes, and the OP_LNEG decomposition depends on this on x86 */
-#define MONO_INS_HAS_NO_SIDE_EFFECT(ins) (MONO_IS_MOVE (ins) || (ins->opcode == OP_ICONST) || (ins->opcode == OP_I8CONST) || MONO_IS_ZERO (ins) || (ins->opcode == OP_ADD_IMM) || (ins->opcode == OP_R8CONST) || (ins->opcode == OP_LADD_IMM) || (ins->opcode == OP_ISUB_IMM) || (ins->opcode == OP_IADD_IMM) || (ins->opcode == OP_LNEG) || (ins->opcode == OP_ISUB) || (ins->opcode == OP_CMOV_IGE) || (ins->opcode == OP_ISHL_IMM) || (ins->opcode == OP_ISHR_IMM) || (ins->opcode == OP_ISHR_UN_IMM) || (ins->opcode == OP_IAND_IMM) || (ins->opcode == OP_ICONV_TO_U1) || (ins->opcode == OP_ICONV_TO_I1) || (ins->opcode == OP_SEXT_I4) || (ins->opcode == OP_LCONV_TO_U1) || (ins->opcode == OP_ICONV_TO_U2) || (ins->opcode == OP_ICONV_TO_I2) || (ins->opcode == OP_LCONV_TO_I2) || (ins->opcode == OP_LDADDR) || (ins->opcode == OP_PHI) || (ins->opcode == OP_NOP) || (ins->opcode == OP_ZEXT_I4) || (ins->opcode == OP_NOT_NULL) || (ins->opcode == OP_IL_SEQ_POINT))
+#define MONO_INS_HAS_NO_SIDE_EFFECT(ins) (MONO_IS_MOVE (ins) || (ins->opcode == OP_ICONST) || (ins->opcode == OP_I8CONST) || MONO_IS_ZERO (ins) || (ins->opcode == OP_ADD_IMM) || (ins->opcode == OP_R8CONST) || (ins->opcode == OP_LADD_IMM) || (ins->opcode == OP_ISUB_IMM) || (ins->opcode == OP_IADD_IMM) || (ins->opcode == OP_LNEG) || (ins->opcode == OP_ISUB) || (ins->opcode == OP_CMOV_IGE) || (ins->opcode == OP_ISHL_IMM) || (ins->opcode == OP_ISHR_IMM) || (ins->opcode == OP_ISHR_UN_IMM) || (ins->opcode == OP_IAND_IMM) || (ins->opcode == OP_ICONV_TO_U1) || (ins->opcode == OP_ICONV_TO_I1) || (ins->opcode == OP_SEXT_I4) || (ins->opcode == OP_LCONV_TO_U1) || (ins->opcode == OP_ICONV_TO_U2) || (ins->opcode == OP_ICONV_TO_I2) || (ins->opcode == OP_LCONV_TO_I2) || (ins->opcode == OP_LDADDR) || (ins->opcode == OP_PHI) || (ins->opcode == OP_NOP) || (ins->opcode == OP_ZEXT_I4) || (ins->opcode == OP_NOT_NULL) || (ins->opcode == OP_IL_SEQ_POINT) || (ins->opcode == OP_XZERO))
 
-#define MONO_METHOD_IS_FINAL(m) (((m)->flags & METHOD_ATTRIBUTE_FINAL) || ((m)->klass && ((m)->klass->flags & TYPE_ATTRIBUTE_SEALED)))
+#define MONO_INS_IS_PCONST_NULL(ins) ((ins)->opcode == OP_PCONST && (ins)->inst_p0 == 0)
+
+#define MONO_METHOD_IS_FINAL(m) (((m)->flags & METHOD_ATTRIBUTE_FINAL) || ((m)->klass && (mono_class_get_flags ((m)->klass) & TYPE_ATTRIBUTE_SEALED)))
 
 
 #ifdef MONO_ARCH_SIMD_INTRINSICS
@@ -1483,7 +1486,7 @@ typedef struct {
        guint            emulate_div : 1;
        guint            emulate_long_shift_opts : 1;
        guint            have_objc_get_selector : 1;
-       guint            have_generalized_imt_thunk : 1;
+       guint            have_generalized_imt_trampoline : 1;
        guint            have_tls_get : 1;
        guint            have_tls_get_reg : 1;
        guint            have_liverange_ops: 1;
@@ -1495,6 +1498,7 @@ typedef struct {
        guint            need_got_var : 1;
        guint            need_div_check : 1;
        guint            no_unaligned_access : 1;
+       guint            disable_div_with_mul : 1;
        int              monitor_enter_adjustment;
        int              dyn_call_param_area;
 } MonoBackend;
@@ -1509,12 +1513,14 @@ typedef enum {
        JIT_FLAG_FULL_AOT = (1 << 2),
        /* Whenever to compile with LLVM */
        JIT_FLAG_LLVM = (1 << 3),
-       /* Whenever to disable direct calls to direct calls to icall functions */
+       /* Whenever to disable direct calls to icall functions */
        JIT_FLAG_NO_DIRECT_ICALLS = (1 << 4),
        /* Emit explicit null checks */
        JIT_FLAG_EXPLICIT_NULL_CHECKS = (1 << 5),
        /* Whenever to compile in llvm-only mode */
        JIT_FLAG_LLVM_ONLY = (1 << 6),
+       /* Whenever calls to pinvoke functions are made directly */
+       JIT_FLAG_DIRECT_PINVOKE = (1 << 7)
 } JitFlags;
 
 /* Bit-fields in the MonoBasicBlock.region */
@@ -1684,6 +1690,7 @@ typedef struct {
        guint            disable_out_of_line_bblocks : 1;
        guint            disable_direct_icalls : 1;
        guint            disable_gc_safe_points : 1;
+       guint            direct_pinvoke : 1;
        guint            create_lmf_var : 1;
        /*
         * When this is set, the code to push/pop the LMF from the LMF stack is generated as IR
@@ -1739,7 +1746,7 @@ typedef struct {
        guint8          *thunks;
        /* Offset between the start of code and the thunks area */
        int              thunks_offset;
-       guint32          exception_type;        /* MONO_EXCEPTION_* */
+       MonoExceptionType exception_type;       /* MONO_EXCEPTION_* */
        guint32          exception_data;
        char*            exception_message;
        gpointer         exception_ptr;
@@ -2500,7 +2507,7 @@ gpointer mono_aot_get_trampoline_full       (const char *name, MonoTrampInfo **o
 gpointer mono_aot_get_unbox_trampoline      (MonoMethod *method);
 gpointer mono_aot_get_lazy_fetch_trampoline (guint32 slot);
 gpointer mono_aot_get_static_rgctx_trampoline (gpointer ctx, gpointer addr);
-gpointer mono_aot_get_imt_thunk             (MonoVTable *vtable, MonoDomain *domain, MonoIMTCheckItem **imt_entries, int count, gpointer fail_tramp);
+gpointer mono_aot_get_imt_trampoline        (MonoVTable *vtable, MonoDomain *domain, MonoIMTCheckItem **imt_entries, int count, gpointer fail_tramp);
 gpointer mono_aot_get_gsharedvt_arg_trampoline(gpointer arg, gpointer addr);
 guint8*  mono_aot_get_unwind_info           (MonoJitInfo *ji, guint32 *unwind_info_len);
 guint32  mono_aot_method_hash               (MonoMethod *method);
@@ -2612,6 +2619,7 @@ gboolean          mono_is_regsize_var (MonoType *t);
 void              mini_emit_memcpy (MonoCompile *cfg, int destreg, int doffset, int srcreg, int soffset, int size, int align);
 void              mini_emit_stobj (MonoCompile *cfg, MonoInst *dest, MonoInst *src, MonoClass *klass, gboolean native);
 void              mini_emit_initobj (MonoCompile *cfg, MonoInst *dest, const guchar *ip, MonoClass *klass);
+MonoInst*         mini_emit_ldelema_1_ins (MonoCompile *cfg, MonoClass *klass, MonoInst *arr, MonoInst *index, gboolean bcheck);
 CompRelation      mono_opcode_to_cond (int opcode) MONO_LLVM_INTERNAL;
 CompType          mono_opcode_to_type (int opcode, int cmp_opcode);
 CompRelation      mono_negate_cond (CompRelation cond);
@@ -2675,6 +2683,7 @@ guint8*   mono_arch_create_sdb_trampoline (gboolean single_step, MonoTrampInfo *
 gpointer  mono_arch_create_monitor_enter_trampoline (MonoTrampInfo **info, gboolean is_v4, gboolean aot);
 gpointer  mono_arch_create_monitor_exit_trampoline (MonoTrampInfo **info, gboolean aot);
 guint8   *mono_arch_create_llvm_native_thunk     (MonoDomain *domain, guint8* addr) MONO_LLVM_INTERNAL;
+gpointer  mono_arch_get_get_tls_tramp (void);
 GList    *mono_arch_get_allocatable_int_vars    (MonoCompile *cfg);
 GList    *mono_arch_get_global_int_regs         (MonoCompile *cfg);
 GList    *mono_arch_get_global_fp_regs          (MonoCompile *cfg);
@@ -2789,7 +2798,7 @@ gpointer mono_arch_get_delegate_virtual_invoke_impl (MonoMethodSignature *sig, M
 gpointer mono_arch_create_specific_trampoline   (gpointer arg1, MonoTrampolineType tramp_type, MonoDomain *domain, guint32 *code_len);
 MonoMethod* mono_arch_find_imt_method           (mgreg_t *regs, guint8 *code);
 MonoVTable* mono_arch_find_static_call_vtable   (mgreg_t *regs, guint8 *code);
-gpointer    mono_arch_build_imt_thunk           (MonoVTable *vtable, MonoDomain *domain, MonoIMTCheckItem **imt_entries, int count, gpointer fail_tramp);
+gpointer    mono_arch_build_imt_trampoline      (MonoVTable *vtable, MonoDomain *domain, MonoIMTCheckItem **imt_entries, int count, gpointer fail_tramp);
 void    mono_arch_notify_pending_exc            (MonoThreadInfo *info);
 guint8* mono_arch_get_call_target               (guint8 *code);
 guint32 mono_arch_get_plt_info_offset           (guint8 *plt_entry, mgreg_t *regs, guint8 *code);
@@ -3120,6 +3129,7 @@ enum {
 const char *mono_arch_xregname (int reg);
 void        mono_simd_simplify_indirection (MonoCompile *cfg);
 MonoInst*   mono_emit_simd_intrinsics (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig, MonoInst **args);
+MonoInst*   mono_emit_simd_field_load (MonoCompile *cfg, MonoClassField *field, MonoInst *addr);
 guint32     mono_arch_cpu_enumerate_simd_versions (void);
 void        mono_simd_intrinsics_init (void);
 
@@ -3148,6 +3158,8 @@ gboolean mono_jit_map_is_enabled (void);
  * Per-OS implementation functions.
  */
 void mono_runtime_install_handlers (void);
+gboolean mono_runtime_install_custom_handlers (const char *handlers);
+void mono_runtime_install_custom_handlers_usage (void);
 void mono_runtime_cleanup_handlers (void);
 void mono_runtime_setup_stat_profiler (void);
 void mono_runtime_shutdown_stat_profiler (void);
index e6635a4b49c8cfe2bf945c3efeb683bf9ea44a18..a55700355721adf50355dbc89013664042f1d700 100644 (file)
@@ -57,3 +57,4 @@ PATCH_INFO(AOT_JIT_INFO, "aot_jit_info")
 PATCH_INFO(GC_NURSERY_BITS, "gc_nursery_bits")
 PATCH_INFO(GSHAREDVT_IN_WRAPPER, "gsharedvt_in_wrapper")
 PATCH_INFO(ICALL_ADDR_CALL, "icall_addr_call")
+PATCH_INFO(GET_TLS_TRAMP, "get_tls_tramp")
index 6bffbd05c4927183446441b0f290e53e1595debf..70140712376e82b41c3f990bc4381e44d63cf9f6 100644 (file)
@@ -135,9 +135,9 @@ typedef struct {
        guint8 simd_version_flags;
        guint8 simd_emit_mode : 4;
        guint8 flags : 4;
-} SimdIntrinsc;
+} SimdIntrinsic;
 
-static const SimdIntrinsc vector4f_intrinsics[] = {
+static const SimdIntrinsic vector4f_intrinsics[] = {
        { SN_ctor, OP_EXPAND_R4, SIMD_VERSION_SSE1, SIMD_EMIT_CTOR },
        { SN_AddSub, OP_ADDSUBPS, SIMD_VERSION_SSE3, SIMD_EMIT_BINARY},
        { SN_AndNot, OP_ANDNPS, SIMD_VERSION_SSE1, SIMD_EMIT_BINARY},
@@ -191,7 +191,7 @@ static const SimdIntrinsc vector4f_intrinsics[] = {
        { SN_set_Z, 2, SIMD_VERSION_SSE1, SIMD_EMIT_SETTER }
 };
 
-static const SimdIntrinsc vector2d_intrinsics[] = {
+static const SimdIntrinsic vector2d_intrinsics[] = {
        { SN_ctor, OP_EXPAND_R8, SIMD_VERSION_SSE1, SIMD_EMIT_CTOR },
        { SN_AddSub, OP_ADDSUBPD, SIMD_VERSION_SSE3, SIMD_EMIT_BINARY,},
        { SN_AndNot, OP_ANDNPD, SIMD_VERSION_SSE1, SIMD_EMIT_BINARY },
@@ -235,7 +235,7 @@ static const SimdIntrinsc vector2d_intrinsics[] = {
        { SN_set_Y, 1, SIMD_VERSION_SSE1, SIMD_EMIT_SETTER },
 };
 
-static const SimdIntrinsc vector2ul_intrinsics[] = {
+static const SimdIntrinsic vector2ul_intrinsics[] = {
        { SN_ctor, OP_EXPAND_I8, SIMD_VERSION_SSE1, SIMD_EMIT_CTOR },
        { SN_CompareEqual, OP_PCMPEQQ, SIMD_VERSION_SSE41, SIMD_EMIT_BINARY },
        { SN_LoadAligned, 0, SIMD_VERSION_SSE1, SIMD_EMIT_LOAD_ALIGNED },
@@ -262,7 +262,7 @@ static const SimdIntrinsc vector2ul_intrinsics[] = {
        { SN_set_Y, 1, SIMD_VERSION_SSE1, SIMD_EMIT_SETTER },
 };
 
-static const SimdIntrinsc vector2l_intrinsics[] = {
+static const SimdIntrinsic vector2l_intrinsics[] = {
        { SN_ctor, OP_EXPAND_I8, SIMD_VERSION_SSE1, SIMD_EMIT_CTOR },
        { SN_CompareEqual, OP_PCMPEQQ, SIMD_VERSION_SSE41, SIMD_EMIT_BINARY },
        { SN_CompareGreaterThan, OP_PCMPGTQ, SIMD_VERSION_SSE42, SIMD_EMIT_BINARY },
@@ -290,7 +290,7 @@ static const SimdIntrinsc vector2l_intrinsics[] = {
        { SN_set_Y, 1, SIMD_VERSION_SSE1, SIMD_EMIT_SETTER },
 };
 
-static const SimdIntrinsc vector4ui_intrinsics[] = {
+static const SimdIntrinsic vector4ui_intrinsics[] = {
        { SN_ctor, OP_EXPAND_I4, SIMD_VERSION_SSE1, SIMD_EMIT_CTOR },
        { SN_ArithmeticRightShift, OP_PSARD, SIMD_VERSION_SSE1, SIMD_EMIT_SHIFT },
        { SN_CompareEqual, OP_PCMPEQD, SIMD_VERSION_SSE1, SIMD_EMIT_BINARY },
@@ -328,7 +328,7 @@ static const SimdIntrinsc vector4ui_intrinsics[] = {
        { SN_set_Z, 2, SIMD_VERSION_SSE1, SIMD_EMIT_SETTER },
 };
 
-static const SimdIntrinsc vector4i_intrinsics[] = {
+static const SimdIntrinsic vector4i_intrinsics[] = {
        { SN_ctor, OP_EXPAND_I4, SIMD_VERSION_SSE1, SIMD_EMIT_CTOR },
        { SN_CompareEqual, OP_PCMPEQD, SIMD_VERSION_SSE1, SIMD_EMIT_BINARY },
        { SN_CompareGreaterThan, OP_PCMPGTD, SIMD_VERSION_SSE1, SIMD_EMIT_BINARY },
@@ -369,7 +369,7 @@ static const SimdIntrinsc vector4i_intrinsics[] = {
        { SN_set_Z, 2, SIMD_VERSION_SSE1, SIMD_EMIT_SETTER },
 };
 
-static const SimdIntrinsc vector8us_intrinsics[] = {
+static const SimdIntrinsic vector8us_intrinsics[] = {
        { SN_ctor, OP_EXPAND_I2, SIMD_VERSION_SSE1, SIMD_EMIT_CTOR },
        { SN_AddWithSaturation, OP_PADDW_SAT_UN, SIMD_VERSION_SSE1, SIMD_EMIT_BINARY },
        { SN_ArithmeticRightShift, OP_PSARW, SIMD_VERSION_SSE1, SIMD_EMIT_SHIFT },
@@ -420,7 +420,7 @@ static const SimdIntrinsc vector8us_intrinsics[] = {
        { SN_set_V7, 7, SIMD_VERSION_SSE1, SIMD_EMIT_SETTER },
 };
 
-static const SimdIntrinsc vector8s_intrinsics[] = {
+static const SimdIntrinsic vector8s_intrinsics[] = {
        { SN_ctor, OP_EXPAND_I2, SIMD_VERSION_SSE1, SIMD_EMIT_CTOR },
        { SN_AddWithSaturation, OP_PADDW_SAT, SIMD_VERSION_SSE1, SIMD_EMIT_BINARY },
        { SN_CompareEqual, OP_PCMPEQW, SIMD_VERSION_SSE1, SIMD_EMIT_BINARY },
@@ -471,7 +471,7 @@ static const SimdIntrinsc vector8s_intrinsics[] = {
        { SN_set_V7, 7, SIMD_VERSION_SSE1, SIMD_EMIT_SETTER },
 };
 
-static const SimdIntrinsc vector16b_intrinsics[] = {
+static const SimdIntrinsic vector16b_intrinsics[] = {
        { SN_ctor, OP_EXPAND_I1, SIMD_VERSION_SSE1, SIMD_EMIT_CTOR },
        { SN_AddWithSaturation, OP_PADDB_SAT_UN, SIMD_VERSION_SSE1, SIMD_EMIT_BINARY },
        { SN_Average, OP_PAVGB_UN, SIMD_VERSION_SSE1, SIMD_EMIT_BINARY },
@@ -535,7 +535,7 @@ static const SimdIntrinsc vector16b_intrinsics[] = {
 Missing:
 setters
  */
-static const SimdIntrinsc vector16sb_intrinsics[] = {
+static const SimdIntrinsic vector16sb_intrinsics[] = {
        { SN_ctor, OP_EXPAND_I1, SIMD_VERSION_SSE1, SIMD_EMIT_CTOR },
        { SN_AddWithSaturation, OP_PADDB_SAT, SIMD_VERSION_SSE1, SIMD_EMIT_BINARY },
        { SN_CompareEqual, OP_PCMPEQB, SIMD_VERSION_SSE1, SIMD_EMIT_BINARY },
@@ -596,11 +596,14 @@ static const SimdIntrinsc vector16sb_intrinsics[] = {
 
 static guint32 simd_supported_versions;
 
+static MonoInst* emit_sys_numerics_intrinsics (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig, MonoInst **args);
+static MonoInst* emit_sys_numerics_vectors_intrinsics (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig, MonoInst **args);
+
 /*TODO match using number of parameters as well*/
 static int
 simd_intrinsic_compare_by_name (const void *key, const void *value)
 {
-       return strcmp (key, method_name (((SimdIntrinsc *)value)->name));
+       return strcmp (key, method_name (((SimdIntrinsic *)value)->name));
 }
 
 typedef enum {
@@ -818,9 +821,11 @@ mono_simd_simplify_indirection (MonoCompile *cfg)
 static int
 get_simd_vreg (MonoCompile *cfg, MonoMethod *cmethod, MonoInst *src)
 {
+       const char *spec = INS_INFO (src->opcode);
+
        if (src->opcode == OP_XMOVE) {
                return src->sreg1;
-       } else if (src->type == STACK_VTYPE) {
+       } else if (spec [MONO_INST_DEST] == 'x') {
                return src->dreg;
        }
        g_warning ("get_simd_vreg:: could not infer source simd vreg for op");
@@ -832,8 +837,10 @@ get_simd_vreg (MonoCompile *cfg, MonoMethod *cmethod, MonoInst *src)
  * This function will load the value if needed. 
  */
 static int
-load_simd_vreg (MonoCompile *cfg, MonoMethod *cmethod, MonoInst *src, gboolean *indirect)
+load_simd_vreg_class (MonoCompile *cfg, MonoClass *klass, MonoInst *src, gboolean *indirect)
 {
+       const char *spec = INS_INFO (src->opcode);
+
        if (indirect)
                *indirect = FALSE;
        if (src->opcode == OP_XMOVE) {
@@ -842,7 +849,7 @@ load_simd_vreg (MonoCompile *cfg, MonoMethod *cmethod, MonoInst *src, gboolean *
                int res = ((MonoInst*)src->inst_p0)->dreg;
                NULLIFY_INS (src);
                return res;
-       } else if (src->type == STACK_VTYPE) {
+       } else if (spec [MONO_INST_DEST] == 'x') {
                return src->dreg;
        } else if (src->type == STACK_PTR || src->type == STACK_MP) {
                MonoInst *ins;
@@ -850,7 +857,7 @@ load_simd_vreg (MonoCompile *cfg, MonoMethod *cmethod, MonoInst *src, gboolean *
                        *indirect = TRUE;
 
                MONO_INST_NEW (cfg, ins, OP_LOADX_MEMBASE);
-               ins->klass = cmethod->klass;
+               ins->klass = klass;
                ins->sreg1 = src->dreg;
                ins->type = STACK_VTYPE;
                ins->dreg = alloc_ireg (cfg);
@@ -862,6 +869,12 @@ load_simd_vreg (MonoCompile *cfg, MonoMethod *cmethod, MonoInst *src, gboolean *
        g_assert_not_reached ();
 }
 
+static int
+load_simd_vreg (MonoCompile *cfg, MonoMethod *cmethod, MonoInst *src, gboolean *indirect)
+{
+       return load_simd_vreg_class (cfg, cmethod->klass, src, indirect);
+}
+
 /*We share the var with fconv_to_r8_x to save some stack space.*/
 static MonoInst*
 get_double_spill_area (MonoCompile *cfg)
@@ -908,21 +921,149 @@ mono_type_to_expand_op (MonoType *type)
 }
 
 static int
-get_simd_vreg_or_expanded_scalar (MonoCompile *cfg, MonoMethod *cmethod, MonoInst *src, int position)
+type_to_comp_op (MonoType *t)
+{
+       switch (t->type) {
+       case MONO_TYPE_I1:
+       case MONO_TYPE_U1:
+               return OP_PCMPEQB;
+       case MONO_TYPE_I2:
+       case MONO_TYPE_U2:
+               return OP_PCMPEQW;
+       case MONO_TYPE_I4:
+       case MONO_TYPE_U4:
+               return OP_PCMPEQD;
+       case MONO_TYPE_I8:
+       case MONO_TYPE_U8:
+               return OP_PCMPEQQ;
+       case MONO_TYPE_R4:
+               return OP_COMPPS;
+       case MONO_TYPE_R8:
+               return OP_COMPPD;
+       default:
+               g_assert_not_reached ();
+               return -1;
+       }
+}
+
+static int
+type_to_gt_op (MonoType *t)
+{
+       switch (t->type) {
+       case MONO_TYPE_I1:
+               return OP_PCMPGTB;
+       case MONO_TYPE_I2:
+               return OP_PCMPGTW;
+       case MONO_TYPE_I4:
+               return OP_PCMPGTD;
+       case MONO_TYPE_I8:
+               return OP_PCMPGTQ;
+       default:
+               return -1;
+       }
+}
+
+static int
+type_to_padd_op (MonoType *t)
+{
+       switch (t->type) {
+       case MONO_TYPE_U1:
+       case MONO_TYPE_I1:
+               return OP_PADDB;
+       case MONO_TYPE_U2:
+       case MONO_TYPE_I2:
+               return OP_PADDW;
+       case MONO_TYPE_U4:
+       case MONO_TYPE_I4:
+               return OP_PADDD;
+       case MONO_TYPE_U8:
+       case MONO_TYPE_I8:
+               return OP_PADDQ;
+       case MONO_TYPE_R4:
+               return OP_ADDPS;
+       case MONO_TYPE_R8:
+               return OP_ADDPD;
+       default:
+               break;
+       }
+       return -1;
+}
+
+static int
+type_to_psub_op (MonoType *t)
+{
+       switch (t->type) {
+       case MONO_TYPE_U1:
+       case MONO_TYPE_I1:
+               return OP_PSUBB;
+       case MONO_TYPE_U2:
+       case MONO_TYPE_I2:
+               return OP_PSUBW;
+       case MONO_TYPE_U4:
+       case MONO_TYPE_I4:
+               return OP_PSUBD;
+       case MONO_TYPE_U8:
+       case MONO_TYPE_I8:
+               return OP_PSUBQ;
+       case MONO_TYPE_R4:
+               return OP_SUBPS;
+       case MONO_TYPE_R8:
+               return OP_SUBPD;
+       default:
+               break;
+       }
+       return -1;
+}
+
+static int
+type_to_pmul_op (MonoType *t)
+{
+       switch (t->type) {
+       case MONO_TYPE_U2:
+       case MONO_TYPE_I2:
+               return OP_PMULW;
+       case MONO_TYPE_U4:
+       case MONO_TYPE_I4:
+               return OP_PMULD;
+       case MONO_TYPE_U8:
+       case MONO_TYPE_I8:
+               return OP_PMULQ;
+       case MONO_TYPE_R4:
+               return OP_MULPS;
+       case MONO_TYPE_R8:
+               return OP_MULPD;
+       default:
+               break;
+       }
+       return -1;
+}
+
+static int
+type_to_pdiv_op (MonoType *t)
+{
+       switch (t->type) {
+       case MONO_TYPE_R4:
+               return OP_DIVPS;
+       case MONO_TYPE_R8:
+               return OP_DIVPD;
+       default:
+               break;
+       }
+       return -1;
+}
+
+static int
+get_simd_vreg_or_expanded_scalar (MonoCompile *cfg, MonoClass *klass, MonoType *param_type, MonoInst *src)
 {
        MonoInst *ins;
-       MonoMethodSignature *sig = mono_method_signature (cmethod);
        int expand_op;
 
-       g_assert (sig->param_count == 2);
-       g_assert (position == 0 || position == 1);
+       if (mono_class_from_mono_type (param_type)->simd_type)
+               return get_simd_vreg (cfg, NULL, src);
 
-       if (mono_class_from_mono_type (sig->params [position])->simd_type)
-               return get_simd_vreg (cfg, cmethod, src);
-
-       expand_op = mono_type_to_expand_op (sig->params [position]);
+       expand_op = mono_type_to_expand_op (param_type);
        MONO_INST_NEW (cfg, ins, expand_op);
-       ins->klass = cmethod->klass;
+       ins->klass = klass;
        ins->sreg1 = src->dreg;
        ins->type = STACK_VTYPE;
        ins->dreg = alloc_ireg (cfg);
@@ -936,29 +1077,45 @@ get_simd_vreg_or_expanded_scalar (MonoCompile *cfg, MonoMethod *cmethod, MonoIns
        return ins->dreg;
 }
 
+/*
+ * simd_intrinsic_emit_binary_op:
+ *
+ *   Emit a binary SIMD opcode.
+ * @LHS/@RHS are the two arguments, they can be either a SIMD type or a scalar one. Scalar arguments are
+ * expanded to the SIMD type.
+ */
 static MonoInst*
-simd_intrinsic_emit_binary (const SimdIntrinsc *intrinsic, MonoCompile *cfg, MonoMethod *cmethod, MonoInst **args)
+simd_intrinsic_emit_binary_op (MonoCompile *cfg, int opcode, int flags, MonoClass *klass, MonoType *lhs_type, MonoType *rhs_type, MonoInst *lhs, MonoInst *rhs)
 {
        MonoInst* ins;
        int left_vreg, right_vreg;
 
-       left_vreg = get_simd_vreg_or_expanded_scalar (cfg, cmethod, args [0], 0);
-       right_vreg = get_simd_vreg_or_expanded_scalar (cfg, cmethod, args [1], 1);
-
+       left_vreg = get_simd_vreg_or_expanded_scalar (cfg, klass, lhs_type, lhs);
+       right_vreg = get_simd_vreg_or_expanded_scalar (cfg, klass, rhs_type, rhs);
 
-       MONO_INST_NEW (cfg, ins, intrinsic->opcode);
-       ins->klass = cmethod->klass;
+       MONO_INST_NEW (cfg, ins, opcode);
+       ins->klass = klass;
        ins->sreg1 = left_vreg;
        ins->sreg2 = right_vreg;
        ins->type = STACK_VTYPE;
        ins->dreg = alloc_ireg (cfg);
-       ins->inst_c0 = intrinsic->flags;
+       ins->inst_c0 = flags;
        MONO_ADD_INS (cfg->cbb, ins);
        return ins;
 }
 
 static MonoInst*
-simd_intrinsic_emit_unary (const SimdIntrinsc *intrinsic, MonoCompile *cfg, MonoMethod *cmethod, MonoInst **args)
+simd_intrinsic_emit_binary (const SimdIntrinsic *intrinsic, MonoCompile *cfg, MonoMethod *cmethod, MonoInst **args)
+{
+       MonoMethodSignature *sig = mono_method_signature (cmethod);
+
+       g_assert (sig->param_count == 2);
+
+       return simd_intrinsic_emit_binary_op (cfg, intrinsic->opcode, intrinsic->flags, cmethod->klass, sig->params [0], sig->params [1], args [0], args [1]);
+}
+
+static MonoInst*
+simd_intrinsic_emit_unary (const SimdIntrinsic *intrinsic, MonoCompile *cfg, MonoMethod *cmethod, MonoInst **args)
 {
        MonoInst* ins;
        int vreg;
@@ -1066,7 +1223,7 @@ mono_type_to_slow_insert_op (MonoType *type)
 }
 
 static MonoInst*
-simd_intrinsic_emit_setter (const SimdIntrinsc *intrinsic, MonoCompile *cfg, MonoMethod *cmethod, MonoInst **args)
+simd_intrinsic_emit_setter (const SimdIntrinsic *intrinsic, MonoCompile *cfg, MonoMethod *cmethod, MonoInst **args)
 {
        MonoInst *ins;
        MonoMethodSignature *sig = mono_method_signature (cmethod);
@@ -1125,37 +1282,65 @@ simd_intrinsic_emit_setter (const SimdIntrinsc *intrinsic, MonoCompile *cfg, Mon
        return ins;
 }
 
+/*
+ * simd_intrinsic_emit_getter_op:
+ *
+ *   Emit IR for loading an element of a SIMD value.
+ *
+ * @klass is the simd type, @type is the element type.
+ */
 static MonoInst*
-simd_intrinsic_emit_getter (const SimdIntrinsc *intrinsic, MonoCompile *cfg, MonoMethod *cmethod, MonoInst **args)
+simd_intrinsic_emit_getter_op (MonoCompile *cfg, int index, MonoClass *klass, MonoType *type, MonoInst *arg)
 {
        MonoInst *ins;
-       MonoMethodSignature *sig = mono_method_signature (cmethod);
-       int vreg, shift_bits = mono_type_elements_shift_bits (sig->ret);
+       int vreg, shift_bits;
 
-       vreg = load_simd_vreg (cfg, cmethod, args [0], NULL);
+       vreg = load_simd_vreg_class (cfg, klass, arg, NULL);
+
+       if (type->type == MONO_TYPE_I8 || type->type == MONO_TYPE_U8 || type->type == MONO_TYPE_R8) {
+               MonoInst *ins;
+               gboolean is_r8 = type->type == MONO_TYPE_R8;
+
+               MONO_INST_NEW (cfg, ins, is_r8 ? OP_EXTRACT_R8 : OP_EXTRACT_I8);
+               ins->klass = klass;
+               ins->sreg1 = vreg;
+               ins->inst_c0 = index;
+               if (is_r8) {
+                       ins->type = STACK_R8;
+                       ins->dreg = alloc_freg (cfg);
+                       ins->backend.spill_var = get_double_spill_area (cfg);
+               } else {
+                       ins->type = STACK_I8;
+                       ins->dreg = alloc_lreg (cfg);
+               }
+               MONO_ADD_INS (cfg->cbb, ins);
+               return ins;
+       }
+
+       shift_bits = mono_type_elements_shift_bits (type);
 
-       if ((intrinsic->opcode >> shift_bits) && !cfg->compile_llvm) {
+       if ((index >> shift_bits) && !cfg->compile_llvm) {
                MONO_INST_NEW (cfg, ins, OP_PSHUFLED);
-               ins->klass = cmethod->klass;
+               ins->klass = klass;
                ins->sreg1 = vreg;
-               ins->inst_c0 = intrinsic->opcode >> shift_bits;
+               ins->inst_c0 = index >> shift_bits;
                ins->type = STACK_VTYPE;
                ins->dreg = vreg = alloc_ireg (cfg);
                MONO_ADD_INS (cfg->cbb, ins);
        }
 
-       MONO_INST_NEW (cfg, ins, mono_type_to_extract_op (sig->ret));
-       ins->klass = cmethod->klass;
+       MONO_INST_NEW (cfg, ins, mono_type_to_extract_op (type));
+       ins->klass = klass;
        ins->sreg1 = vreg;
        ins->type = STACK_I4;
        ins->dreg = vreg = alloc_ireg (cfg);
        if (cfg->compile_llvm)
-               ins->inst_c0 = intrinsic->opcode;
+               ins->inst_c0 = index;
        else
-               ins->inst_c0 = intrinsic->opcode & ((1 << shift_bits) - 1);
+               ins->inst_c0 = index & ((1 << shift_bits) - 1);
        MONO_ADD_INS (cfg->cbb, ins);
 
-       if (sig->ret->type == MONO_TYPE_R4) {
+       if (type->type == MONO_TYPE_R4) {
                MONO_INST_NEW (cfg, ins, cfg->r4fp ? OP_ICONV_TO_R4_RAW : OP_MOVE_I4_TO_F);
                ins->klass = mono_defaults.single_class;
                ins->sreg1 = vreg;
@@ -1168,7 +1353,15 @@ simd_intrinsic_emit_getter (const SimdIntrinsc *intrinsic, MonoCompile *cfg, Mon
 }
 
 static MonoInst*
-simd_intrinsic_emit_long_getter (const SimdIntrinsc *intrinsic, MonoCompile *cfg, MonoMethod *cmethod, MonoInst **args)
+simd_intrinsic_emit_getter (const SimdIntrinsic *intrinsic, MonoCompile *cfg, MonoMethod *cmethod, MonoInst **args)
+{
+       MonoMethodSignature *sig = mono_method_signature (cmethod);
+
+       return simd_intrinsic_emit_getter_op (cfg, intrinsic->opcode, cmethod->klass, sig->ret, args [0]);
+}
+
+static MonoInst*
+simd_intrinsic_emit_long_getter (const SimdIntrinsic *intrinsic, MonoCompile *cfg, MonoMethod *cmethod, MonoInst **args)
 {
        MonoInst *ins;
        int vreg;
@@ -1194,7 +1387,7 @@ simd_intrinsic_emit_long_getter (const SimdIntrinsc *intrinsic, MonoCompile *cfg
 }
 
 static MonoInst*
-simd_intrinsic_emit_ctor (const SimdIntrinsc *intrinsic, MonoCompile *cfg, MonoMethod *cmethod, MonoInst **args)
+simd_intrinsic_emit_ctor (const SimdIntrinsic *intrinsic, MonoCompile *cfg, MonoMethod *cmethod, MonoInst **args)
 {
        MonoInst *ins = NULL;
        int i, addr_reg;
@@ -1202,6 +1395,7 @@ simd_intrinsic_emit_ctor (const SimdIntrinsc *intrinsic, MonoCompile *cfg, MonoM
        MonoMethodSignature *sig = mono_method_signature (cmethod);
        int store_op = mono_type_to_store_membase (cfg, sig->params [0]);
        int arg_size = mono_type_size (sig->params [0], &i);
+       int opcode;
 
        if (sig->param_count == 1) {
                int dreg;
@@ -1214,7 +1408,11 @@ simd_intrinsic_emit_ctor (const SimdIntrinsc *intrinsic, MonoCompile *cfg, MonoM
                        dreg = alloc_ireg (cfg);
                }
 
-               MONO_INST_NEW (cfg, ins, intrinsic->opcode);
+               if (intrinsic)
+                       opcode = intrinsic->opcode;
+               else
+                       opcode = mono_type_to_expand_op (sig->params [0]);
+               MONO_INST_NEW (cfg, ins, opcode);
                ins->klass = cmethod->klass;
                ins->sreg1 = args [1]->dreg;
                ins->type = STACK_VTYPE;
@@ -1248,6 +1446,20 @@ simd_intrinsic_emit_ctor (const SimdIntrinsc *intrinsic, MonoCompile *cfg, MonoM
                EMIT_NEW_STORE_MEMBASE (cfg, ins, store_op, addr_reg, i * arg_size, args [i + 1]->dreg);
        }
 
+       if (sig->param_count * arg_size < 16) {
+               /* If there are not enough arguments, fill the rest with 0s */
+               for (i = sig->param_count; i < 16 / arg_size; ++i) {
+                       switch (arg_size) {
+                       case 4:
+                               MONO_EMIT_NEW_STORE_MEMBASE_IMM (cfg, OP_STOREI4_MEMBASE_IMM, addr_reg, i * arg_size, 0);
+                               break;
+                       default:
+                               g_assert_not_reached ();
+                               break;
+                       }
+               }
+       }
+
        if (is_ldaddr) { /*Eliminate LDADDR if it's initing a local var*/
                int vreg = ((MonoInst*)args [0]->inst_p0)->dreg;
                NULLIFY_INS (args [0]);
@@ -1263,16 +1475,22 @@ simd_intrinsic_emit_ctor (const SimdIntrinsc *intrinsic, MonoCompile *cfg, MonoM
 }
 
 static MonoInst*
-simd_intrinsic_emit_cast (const SimdIntrinsc *intrinsic, MonoCompile *cfg, MonoMethod *cmethod, MonoInst **args)
+simd_intrinsic_emit_cast (const SimdIntrinsic *intrinsic, MonoCompile *cfg, MonoMethod *cmethod, MonoInst **args)
 {
        MonoInst *ins;
+       MonoClass *klass;
        int vreg;
 
        vreg = get_simd_vreg (cfg, cmethod, args [0]);          
 
-       //TODO macroize this
+       if (cmethod->is_inflated)
+               /* Vector<T> */
+               klass = mono_class_from_mono_type (mono_method_signature (cmethod)->ret);
+       else
+               klass = cmethod->klass;
+
        MONO_INST_NEW (cfg, ins, OP_XMOVE);
-       ins->klass = cmethod->klass;
+       ins->klass = klass;
        ins->type = STACK_VTYPE;
        ins->sreg1 = vreg;
        ins->dreg = alloc_ireg (cfg);
@@ -1281,7 +1499,7 @@ simd_intrinsic_emit_cast (const SimdIntrinsc *intrinsic, MonoCompile *cfg, MonoM
 }
 
 static MonoInst*
-simd_intrinsic_emit_shift (const SimdIntrinsc *intrinsic, MonoCompile *cfg, MonoMethod *cmethod, MonoInst **args)
+simd_intrinsic_emit_shift (const SimdIntrinsic *intrinsic, MonoCompile *cfg, MonoMethod *cmethod, MonoInst **args)
 {
        MonoInst *ins;
        int vreg, vreg2 = -1, opcode = intrinsic->opcode;
@@ -1322,23 +1540,22 @@ mono_op_is_packed_compare (int op)
 }
 
 static MonoInst*
-simd_intrinsic_emit_equality (const SimdIntrinsc *intrinsic, MonoCompile *cfg, MonoMethod *cmethod, MonoInst **args)
+simd_intrinsic_emit_equality_op (MonoCompile *cfg, MonoMethod *cmethod, MonoInst **args, int opcode, int flags)
 {
        MonoInst* ins;
        int left_vreg, right_vreg, tmp_vreg;
 
-       left_vreg = get_simd_vreg (cfg, cmethod, args [0]);
+       left_vreg = load_simd_vreg (cfg, cmethod, args [0], NULL);
        right_vreg = get_simd_vreg (cfg, cmethod, args [1]);
        
-
-       MONO_INST_NEW (cfg, ins, intrinsic->opcode);
+       MONO_INST_NEW (cfg, ins, opcode);
        ins->klass = cmethod->klass;
        ins->sreg1 = left_vreg;
        ins->sreg2 = right_vreg;
        ins->type = STACK_VTYPE;
        ins->klass = cmethod->klass;
        ins->dreg = tmp_vreg = alloc_ireg (cfg);
-       ins->inst_c0 = intrinsic->flags;
+       ins->inst_c0 = flags;
        MONO_ADD_INS (cfg->cbb, ins);
 
        /*FIXME the next ops are SSE specific*/
@@ -1350,9 +1567,9 @@ simd_intrinsic_emit_equality (const SimdIntrinsc *intrinsic, MonoCompile *cfg, M
        MONO_ADD_INS (cfg->cbb, ins);
 
        /*FP ops have a not equal instruction, which means that we must test the results with OR semantics.*/
-       if (mono_op_is_packed_compare (intrinsic->opcode) || intrinsic->flags == SIMD_COMP_EQ) {
+       if (mono_op_is_packed_compare (opcode) || flags == SIMD_COMP_EQ) {
                MONO_EMIT_NEW_BIALU_IMM (cfg, OP_COMPARE_IMM, -1, tmp_vreg, 0xFFFF);
-               NEW_UNALU (cfg, ins, intrinsic->flags == SIMD_COMP_EQ ? OP_CEQ : OP_CLT_UN, tmp_vreg, -1);
+               NEW_UNALU (cfg, ins, flags == SIMD_COMP_EQ ? OP_CEQ : OP_CLT_UN, tmp_vreg, -1);
        } else {
                MONO_EMIT_NEW_BIALU_IMM (cfg, OP_COMPARE_IMM, -1, tmp_vreg, 0);
                NEW_UNALU (cfg, ins, OP_CGT_UN, tmp_vreg, -1);
@@ -1361,9 +1578,14 @@ simd_intrinsic_emit_equality (const SimdIntrinsc *intrinsic, MonoCompile *cfg, M
        return ins;
 }
 
+static MonoInst*
+simd_intrinsic_emit_equality (const SimdIntrinsic *intrinsic, MonoCompile *cfg, MonoMethod *cmethod, MonoInst **args)
+{
+       return simd_intrinsic_emit_equality_op (cfg, cmethod, args, intrinsic->opcode, intrinsic->flags);
+}
 
 static MonoInst*
-simd_intrinsic_emit_shuffle (const SimdIntrinsc *intrinsic, MonoCompile *cfg, MonoMethod *cmethod, MonoInst **args)
+simd_intrinsic_emit_shuffle (const SimdIntrinsic *intrinsic, MonoCompile *cfg, MonoMethod *cmethod, MonoInst **args)
 {
        MonoInst *ins;
        int vreg, vreg2 = -1;
@@ -1396,7 +1618,7 @@ simd_intrinsic_emit_shuffle (const SimdIntrinsc *intrinsic, MonoCompile *cfg, Mo
 }
 
 static MonoInst*
-simd_intrinsic_emit_load_aligned (const SimdIntrinsc *intrinsic, MonoCompile *cfg, MonoMethod *cmethod, MonoInst **args)
+simd_intrinsic_emit_load_aligned (const SimdIntrinsic *intrinsic, MonoCompile *cfg, MonoMethod *cmethod, MonoInst **args)
 {
        MonoInst *ins;
 
@@ -1410,7 +1632,7 @@ simd_intrinsic_emit_load_aligned (const SimdIntrinsc *intrinsic, MonoCompile *cf
 }
 
 static MonoInst*
-simd_intrinsic_emit_store (const SimdIntrinsc *intrinsic, MonoCompile *cfg, MonoMethod *cmethod, MonoInst **args)
+simd_intrinsic_emit_store (const SimdIntrinsic *intrinsic, MonoCompile *cfg, MonoMethod *cmethod, MonoInst **args)
 {
        MonoInst *ins;
        int vreg;
@@ -1427,7 +1649,7 @@ simd_intrinsic_emit_store (const SimdIntrinsc *intrinsic, MonoCompile *cfg, Mono
 }
 
 static MonoInst*
-simd_intrinsic_emit_extract_mask (const SimdIntrinsc *intrinsic, MonoCompile *cfg, MonoMethod *cmethod, MonoInst **args)
+simd_intrinsic_emit_extract_mask (const SimdIntrinsic *intrinsic, MonoCompile *cfg, MonoMethod *cmethod, MonoInst **args)
 {
        MonoInst *ins;
        int vreg;
@@ -1445,7 +1667,7 @@ simd_intrinsic_emit_extract_mask (const SimdIntrinsc *intrinsic, MonoCompile *cf
 }
 
 static MonoInst*
-simd_intrinsic_emit_prefetch (const SimdIntrinsc *intrinsic, MonoCompile *cfg, MonoMethod *cmethod, MonoInst **args)
+simd_intrinsic_emit_prefetch (const SimdIntrinsic *intrinsic, MonoCompile *cfg, MonoMethod *cmethod, MonoInst **args)
 {
        MonoInst *ins;
 
@@ -1457,6 +1679,19 @@ simd_intrinsic_emit_prefetch (const SimdIntrinsc *intrinsic, MonoCompile *cfg, M
        return ins;
 }
 
+static MonoInst*
+simd_intrinsic_emit_const (const SimdIntrinsic *intrinsic, MonoCompile *cfg, MonoMethod *cmethod, MonoInst **args)
+{
+       MonoInst *ins;
+
+       MONO_INST_NEW (cfg, ins, intrinsic->opcode);
+       ins->klass = cmethod->klass;
+       ins->type = STACK_VTYPE;
+       ins->dreg = alloc_xreg (cfg);
+       MONO_ADD_INS (cfg->cbb, ins);
+       return ins;
+}
+
 static const char *
 simd_version_name (guint32 version)
 {
@@ -1480,9 +1715,9 @@ simd_version_name (guint32 version)
 }
 
 static MonoInst*
-emit_intrinsics (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig, MonoInst **args, const SimdIntrinsc *intrinsics, guint32 size)
+emit_intrinsics (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig, MonoInst **args, const SimdIntrinsic *intrinsics, guint32 size)
 {
-       const SimdIntrinsc *result = (const SimdIntrinsc *)mono_binary_search (cmethod->name, intrinsics, size, sizeof (SimdIntrinsc), &simd_intrinsic_compare_by_name);
+       const SimdIntrinsic *result = (const SimdIntrinsic *)mono_binary_search (cmethod->name, intrinsics, size, sizeof (SimdIntrinsic), &simd_intrinsic_compare_by_name);
        if (!result) {
                DEBUG (printf ("function doesn't have a simd intrinsic %s::%s/%d\n", cmethod->klass->name, cmethod->name, fsig->param_count));
                return NULL;
@@ -1634,11 +1869,29 @@ emit_simd_runtime_intrinsics (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodS
        return NULL;
 }
 
+static gboolean
+is_sys_numerics_assembly (MonoAssembly *assembly)
+{
+       return !strcmp ("System.Numerics", assembly->aname.name);
+}
+
+static gboolean
+is_sys_numerics_vectors_assembly (MonoAssembly *assembly)
+{
+       return !strcmp ("System.Numerics.Vectors", assembly->aname.name);
+}
+
 MonoInst*
 mono_emit_simd_intrinsics (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig, MonoInst **args)
 {
        const char *class_name;
 
+       if (is_sys_numerics_assembly (cmethod->klass->image->assembly))
+               return emit_sys_numerics_intrinsics (cfg, cmethod, fsig, args);
+
+       if (is_sys_numerics_vectors_assembly (cmethod->klass->image->assembly))
+               return emit_sys_numerics_vectors_intrinsics (cfg, cmethod, fsig, args);
+
        if (strcmp ("Mono.Simd", cmethod->klass->image->assembly->aname.name) ||
            strcmp ("Mono.Simd", cmethod->klass->name_space))
                return NULL;
@@ -1659,28 +1912,394 @@ mono_emit_simd_intrinsics (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSign
 
        cfg->uses_simd_intrinsics = 1;
        if (!strcmp ("Vector2d", class_name))
-               return emit_intrinsics (cfg, cmethod, fsig, args, vector2d_intrinsics, sizeof (vector2d_intrinsics) / sizeof (SimdIntrinsc));
+               return emit_intrinsics (cfg, cmethod, fsig, args, vector2d_intrinsics, sizeof (vector2d_intrinsics) / sizeof (SimdIntrinsic));
        if (!strcmp ("Vector4f", class_name))
-               return emit_intrinsics (cfg, cmethod, fsig, args, vector4f_intrinsics, sizeof (vector4f_intrinsics) / sizeof (SimdIntrinsc));
+               return emit_intrinsics (cfg, cmethod, fsig, args, vector4f_intrinsics, sizeof (vector4f_intrinsics) / sizeof (SimdIntrinsic));
        if (!strcmp ("Vector2ul", class_name))
-               return emit_intrinsics (cfg, cmethod, fsig, args, vector2ul_intrinsics, sizeof (vector2ul_intrinsics) / sizeof (SimdIntrinsc));
+               return emit_intrinsics (cfg, cmethod, fsig, args, vector2ul_intrinsics, sizeof (vector2ul_intrinsics) / sizeof (SimdIntrinsic));
        if (!strcmp ("Vector2l", class_name))
-               return emit_intrinsics (cfg, cmethod, fsig, args, vector2l_intrinsics, sizeof (vector2l_intrinsics) / sizeof (SimdIntrinsc));
+               return emit_intrinsics (cfg, cmethod, fsig, args, vector2l_intrinsics, sizeof (vector2l_intrinsics) / sizeof (SimdIntrinsic));
        if (!strcmp ("Vector4ui", class_name))
-               return emit_intrinsics (cfg, cmethod, fsig, args, vector4ui_intrinsics, sizeof (vector4ui_intrinsics) / sizeof (SimdIntrinsc));
+               return emit_intrinsics (cfg, cmethod, fsig, args, vector4ui_intrinsics, sizeof (vector4ui_intrinsics) / sizeof (SimdIntrinsic));
        if (!strcmp ("Vector4i", class_name))
-               return emit_intrinsics (cfg, cmethod, fsig, args, vector4i_intrinsics, sizeof (vector4i_intrinsics) / sizeof (SimdIntrinsc));
+               return emit_intrinsics (cfg, cmethod, fsig, args, vector4i_intrinsics, sizeof (vector4i_intrinsics) / sizeof (SimdIntrinsic));
        if (!strcmp ("Vector8us", class_name))
-               return emit_intrinsics (cfg, cmethod, fsig, args, vector8us_intrinsics, sizeof (vector8us_intrinsics) / sizeof (SimdIntrinsc));
+               return emit_intrinsics (cfg, cmethod, fsig, args, vector8us_intrinsics, sizeof (vector8us_intrinsics) / sizeof (SimdIntrinsic));
        if (!strcmp ("Vector8s", class_name))
-               return emit_intrinsics (cfg, cmethod, fsig, args, vector8s_intrinsics, sizeof (vector8s_intrinsics) / sizeof (SimdIntrinsc));
+               return emit_intrinsics (cfg, cmethod, fsig, args, vector8s_intrinsics, sizeof (vector8s_intrinsics) / sizeof (SimdIntrinsic));
        if (!strcmp ("Vector16b", class_name))
-               return emit_intrinsics (cfg, cmethod, fsig, args, vector16b_intrinsics, sizeof (vector16b_intrinsics) / sizeof (SimdIntrinsc));
+               return emit_intrinsics (cfg, cmethod, fsig, args, vector16b_intrinsics, sizeof (vector16b_intrinsics) / sizeof (SimdIntrinsic));
        if (!strcmp ("Vector16sb", class_name))
-               return emit_intrinsics (cfg, cmethod, fsig, args, vector16sb_intrinsics, sizeof (vector16sb_intrinsics) / sizeof (SimdIntrinsc));
+               return emit_intrinsics (cfg, cmethod, fsig, args, vector16sb_intrinsics, sizeof (vector16sb_intrinsics) / sizeof (SimdIntrinsic));
+
+       return NULL;
+}
+
+// The entries should be ordered by name
+// System.Numerics.Vector2/Vector3/Vector4
+static const SimdIntrinsic vector2_intrinsics[] = {
+       { SN_ctor, OP_EXPAND_R4 },
+       { SN_Abs },
+       { SN_Dot, OP_DPPS },
+       { SN_Equals, OP_COMPPS, SIMD_VERSION_SSE1, SIMD_EMIT_EQUALITY, SIMD_COMP_EQ },
+       { SN_Max, OP_MAXPS, SIMD_VERSION_SSE1, SIMD_EMIT_BINARY },
+       { SN_Min, OP_MINPS, SIMD_VERSION_SSE1, SIMD_EMIT_BINARY },
+       { SN_SquareRoot, OP_SQRTPS, SIMD_VERSION_SSE1, SIMD_EMIT_UNARY },
+       { SN_op_Addition, OP_ADDPS, SIMD_VERSION_SSE1, SIMD_EMIT_BINARY },
+       { SN_op_Division, OP_DIVPS, SIMD_VERSION_SSE1, SIMD_EMIT_BINARY },
+       { SN_op_Multiply, OP_MULPS, SIMD_VERSION_SSE1, SIMD_EMIT_BINARY },
+       { SN_op_Subtraction, OP_SUBPS, SIMD_VERSION_SSE1, SIMD_EMIT_BINARY },
+};
+
+static MonoInst*
+emit_vector_intrinsics (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig, MonoInst **args)
+{
+       const SimdIntrinsic *intrins;
+       MonoMethodSignature *sig = mono_method_signature (cmethod);
+
+       /*
+        * Vector2/3/4 are handled the same way, since the underlying SIMD type is the same (4 * r4).
+        */
+       intrins = (const SimdIntrinsic*)mono_binary_search (cmethod->name, vector2_intrinsics, sizeof (vector2_intrinsics) / sizeof (SimdIntrinsic), sizeof (SimdIntrinsic), &simd_intrinsic_compare_by_name);
+       if (!intrins) {
+               //printf ("%s\n", mono_method_full_name (cmethod, 1));
+               return NULL;
+       }
+
+       if (cfg->verbose_level > 1) {
+               char *name = mono_method_full_name (cmethod, TRUE);
+               printf ("  SIMD intrinsic %s\n", name);
+               g_free (name);
+       }
+
+       switch (intrins->name) {
+       case SN_ctor:
+               return simd_intrinsic_emit_ctor (intrins, cfg, cmethod, args);
+               break;
+       case SN_Equals:
+               return simd_intrinsic_emit_equality (intrins, cfg, cmethod, args);
+               break;
+       case SN_SquareRoot:
+               return simd_intrinsic_emit_unary (intrins, cfg, cmethod, args);
+               break;
+       case SN_Dot:
+               if (COMPILE_LLVM (cfg)) {
+                       MonoInst *ins;
+
+                       ins = simd_intrinsic_emit_binary (intrins, cfg, cmethod, args);
+                       /* The end result is in the lowest element */
+                       return simd_intrinsic_emit_getter_op (cfg, 0, cmethod->klass, mono_method_signature (cmethod)->ret, ins);
+               }
+               break;
+       case SN_Abs: {
+               // abs(x) = max(x, sub(0,x))
+               MonoInst *sub;
+               MonoInst *zero;
+
+               MONO_INST_NEW (cfg, zero, OP_XZERO);
+               zero->dreg = alloc_xreg (cfg);
+               zero->klass = cmethod->klass;
+               MONO_ADD_INS (cfg->cbb, zero);
+
+               sub = simd_intrinsic_emit_binary_op (cfg, OP_SUBPS, 0, cmethod->klass, sig->params [0], sig->params [0], zero, args [0]);
+               return simd_intrinsic_emit_binary_op (cfg, OP_MAXPS, 0, cmethod->klass, sig->params [0], sig->params [0], args [0], sub);
+       }
+       case SN_Max:
+       case SN_Min:
+       case SN_op_Addition:
+       case SN_op_Division:
+       case SN_op_Multiply:
+       case SN_op_Subtraction:
+               return simd_intrinsic_emit_binary (intrins, cfg, cmethod, args);
+       default:
+               break;
+       }
+
+       return NULL;
+}
+
+static const SimdIntrinsic vector_t_intrinsics[] = {
+       { SN_ctor },
+       { SN_Abs },
+       { SN_Equals },
+       { SN_GreaterThan },
+       { SN_GreaterThanOrEqual },
+       { SN_LessThan },
+       { SN_LessThanOrEqual },
+       { SN_get_AllOnes, OP_XONES },
+       { SN_get_Count },
+       { SN_get_Item },
+       { SN_get_Zero, OP_XZERO },
+       { SN_op_Addition },
+       { SN_op_Division },
+       { SN_op_Explicit },
+       { SN_op_Multiply },
+       { SN_op_Subtraction }
+};
+
+static MonoInst*
+emit_vector_t_intrinsics (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig, MonoInst **args)
+{
+       const SimdIntrinsic *intrins;
+       MonoType *etype;
+       MonoInst *ins;
+       int size, len, index;
+
+       intrins = (const SimdIntrinsic*)mono_binary_search (cmethod->name, vector_t_intrinsics, sizeof (vector_t_intrinsics) / sizeof (SimdIntrinsic), sizeof (SimdIntrinsic), &simd_intrinsic_compare_by_name);
+       if (!intrins) {
+               //printf ("%s\n", mono_method_full_name (cmethod, 1));
+               return NULL;
+       }
+
+       if (cfg->verbose_level > 1) {
+               char *name = mono_method_full_name (cmethod, TRUE);
+               printf ("  SIMD intrinsic %s\n", name);
+               g_free (name);
+       }
+
+       etype = mono_class_get_context (cmethod->klass)->class_inst->type_argv [0];
+       size = mono_class_value_size (mono_class_from_mono_type (etype), NULL);
+       g_assert (size);
+       len = 16 / size;
+
+       switch (intrins->name) {
+       case SN_get_Count:
+               EMIT_NEW_ICONST (cfg, ins, len);
+               return ins;
+       case SN_get_AllOnes:
+       case SN_get_Zero:
+               return simd_intrinsic_emit_const (intrins, cfg, cmethod, args);
+       case SN_get_Item:
+               g_assert (fsig->param_count == 1);
+               if (args [1]->opcode != OP_ICONST)
+                       return NULL;
+               index = args [1]->inst_c0;
+               if (index < 0 || index >= len)
+                       return NULL;
+               return simd_intrinsic_emit_getter_op (cfg, index, cmethod->klass, etype, args [0]);
+       case SN_ctor:
+               if (fsig->param_count == 1 && mono_metadata_type_equal (fsig->params [0], etype))
+                       return simd_intrinsic_emit_ctor (NULL, cfg, cmethod, args);
+               if ((fsig->param_count == 1 || fsig->param_count == 2) && (fsig->params [0]->type == MONO_TYPE_SZARRAY)) {
+                       MonoInst *array_ins = args [1];
+                       MonoInst *index_ins;
+                       MonoInst *ldelema_ins;
+                       MonoInst *var;
+                       int end_index_reg;
+
+                       /* .ctor (T[]) or .ctor (T[], index) */
+
+                       if (fsig->param_count == 2) {
+                               index_ins = args [2];
+                       } else {
+                               EMIT_NEW_ICONST (cfg, index_ins, 0);
+                       }
+
+                       /* Emit index check for the end (index + len - 1 < array length) */
+                       end_index_reg = alloc_ireg (cfg);
+                       EMIT_NEW_BIALU_IMM (cfg, ins, OP_IADD_IMM, end_index_reg, index_ins->dreg, len - 1);
+                       MONO_EMIT_BOUNDS_CHECK (cfg, array_ins->dreg, MonoArray, max_length, end_index_reg);
+
+                       /* Load the array slice into the simd reg */
+                       ldelema_ins = mini_emit_ldelema_1_ins (cfg, mono_class_from_mono_type (etype), array_ins, index_ins, TRUE);
+                       g_assert (args [0]->opcode == OP_LDADDR);
+                       var = args [0]->inst_p0;
+                       EMIT_NEW_LOAD_MEMBASE (cfg, ins, OP_LOADX_MEMBASE, var->dreg, ldelema_ins->dreg, 0);
+                       ins->klass = cmethod->klass;
+                       return args [0];
+               }
+               break;
+       case SN_op_Explicit:
+               return simd_intrinsic_emit_cast (intrins, cfg, cmethod, args);
+       case SN_Equals:
+               if (fsig->param_count == 1)
+                       return simd_intrinsic_emit_equality_op (cfg, cmethod, args, type_to_comp_op (etype), SIMD_COMP_EQ);
+               if (fsig->param_count == 2)
+                       return simd_intrinsic_emit_binary_op (cfg, type_to_comp_op (etype), 0, cmethod->klass, fsig->params [0], fsig->params [1], args [0], args [1]);
+               break;
+
+       case SN_GreaterThan:
+       case SN_GreaterThanOrEqual:
+       case SN_LessThan: {
+               MonoInst *cmp1, *cmp2;
+               int eq_op, gt_op;
+
+               switch (etype->type) {
+               case MONO_TYPE_I1:
+               case MONO_TYPE_I2:
+               case MONO_TYPE_I4:
+               case MONO_TYPE_I8:
+                       break;
+               default:
+                       return NULL;
+               }
+
+               eq_op = type_to_comp_op (etype);
+               gt_op = type_to_gt_op (etype);
+
+               switch (intrins->name) {
+               case SN_GreaterThan:
+                       return simd_intrinsic_emit_binary_op (cfg, gt_op, 0, cmethod->klass, fsig->params [0], fsig->params [1], args [0], args [1]);
+               case SN_LessThanOrEqual:
+                       return simd_intrinsic_emit_binary_op (cfg, gt_op, 0, cmethod->klass, fsig->params [0], fsig->params [1], args [1], args [0]);
+               case SN_GreaterThanOrEqual:
+                       cmp1 = simd_intrinsic_emit_binary_op (cfg, eq_op, 0, cmethod->klass, fsig->params [0], fsig->params [1], args [0], args [1]);
+                       cmp2 = simd_intrinsic_emit_binary_op (cfg, gt_op, 0, cmethod->klass, fsig->params [0], fsig->params [1], args [0], args [1]);
+                       return simd_intrinsic_emit_binary_op (cfg, OP_POR, 0, cmethod->klass, fsig->params [0], fsig->params [1], cmp1, cmp2);
+               case SN_LessThan:
+                       cmp1 = simd_intrinsic_emit_binary_op (cfg, eq_op, 0, cmethod->klass, fsig->params [0], fsig->params [1], args [1], args [0]);
+                       cmp2 = simd_intrinsic_emit_binary_op (cfg, gt_op, 0, cmethod->klass, fsig->params [0], fsig->params [1], args [1], args [0]);
+                       return simd_intrinsic_emit_binary_op (cfg, OP_POR, 0, cmethod->klass, fsig->params [0], fsig->params [1], cmp1, cmp2);
+               default:
+                       g_assert_not_reached ();
+                       break;
+               }
+       }
+       case SN_Abs:
+               /* Vector<T>.Abs */
+               switch (etype->type) {
+               case MONO_TYPE_U1:
+               case MONO_TYPE_U2:
+               case MONO_TYPE_U4:
+               case MONO_TYPE_U8: {
+                       MonoInst *ins;
+
+                       /* No-op */
+                       MONO_INST_NEW (cfg, ins, OP_XMOVE);
+                       ins->klass = cmethod->klass;
+                       ins->type = STACK_VTYPE;
+                       ins->sreg1 = args [0]->dreg;
+                       ins->dreg = alloc_xreg (cfg);
+                       MONO_ADD_INS (cfg->cbb, ins);
+                       return ins;
+               }
+               default:
+                       break;
+               }
+               break;
+       case SN_op_Addition: {
+               int op = type_to_padd_op (etype);
+               if (op != -1)
+                       return simd_intrinsic_emit_binary_op (cfg, op, 0, cmethod->klass, fsig->params [0], fsig->params [0], args [0], args [1]);
+               break;
+       }
+       case SN_op_Subtraction: {
+               int op = type_to_psub_op (etype);
+               if (op != -1)
+                       return simd_intrinsic_emit_binary_op (cfg, op, 0, cmethod->klass, fsig->params [0], fsig->params [0], args [0], args [1]);
+               break;
+       }
+       case SN_op_Multiply: {
+               int op = type_to_pmul_op (etype);
+               if (op != -1)
+                       return simd_intrinsic_emit_binary_op (cfg, op, 0, cmethod->klass, fsig->params [0], fsig->params [0], args [0], args [1]);
+               break;
+       }
+       case SN_op_Division: {
+               int op = type_to_pdiv_op (etype);
+               if (op != -1)
+                       return simd_intrinsic_emit_binary_op (cfg, op, 0, cmethod->klass, fsig->params [0], fsig->params [0], args [0], args [1]);
+               break;
+       }
+       default:
+               break;
+       }
 
        return NULL;
 }
 
+/*
+ * emit_sys_numerics_intrinsics:
+ *
+ *   Emit intrinsics for the System.Numerics assembly.
+ */
+static MonoInst*
+emit_sys_numerics_intrinsics (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig, MonoInst **args)
+{
+       const char *nspace = cmethod->klass->name_space;
+       const char *class_name = cmethod->klass->name;
+
+       if (cfg->r4fp)
+               // FIXME:
+               return NULL;
+
+       if (!strcmp ("Vector2", class_name) || !strcmp ("Vector4", class_name) || !strcmp ("Vector3", class_name))
+               return emit_vector_intrinsics (cfg, cmethod, fsig, args);
+
+       if (!strcmp ("Vector`1", class_name))
+               return emit_vector_t_intrinsics (cfg, cmethod, fsig, args);
+
+       if (!strcmp ("System.Numerics", nspace) && !strcmp ("Vector", class_name)) {
+               if (!strcmp (cmethod->name, "get_IsHardwareAccelerated")) {
+                       MonoInst *ins;
+
+                       if (simd_supported_versions)
+                               EMIT_NEW_ICONST (cfg, ins, 1);
+                       else
+                               EMIT_NEW_ICONST (cfg, ins, 0);
+                       ins->type = STACK_I4;
+                       return ins;
+               }
+       }
+
+       return NULL;
+}
+
+static MonoInst*
+emit_sys_numerics_vectors_intrinsics (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig, MonoInst **args)
+{
+       const char *class_name = cmethod->klass->name;
+
+       if (cfg->r4fp)
+               // FIXME:
+               return NULL;
+
+       if (!strcmp (class_name, "Vector`1"))
+               return emit_vector_t_intrinsics (cfg, cmethod, fsig, args);
+       return NULL;
+}
+
+MonoInst*
+mono_emit_simd_field_load (MonoCompile *cfg, MonoClassField *field, MonoInst *addr)
+{
+       if (cfg->r4fp)
+               // FIXME:
+               return NULL;
+
+       if (is_sys_numerics_assembly (field->parent->image->assembly)) {
+               int index = -1;
+
+               if (!strcmp (field->parent->name, "Vector2") ||
+                       !strcmp (field->parent->name, "Vector3") ||
+                       !strcmp (field->parent->name, "Vector4")) {
+                       if (!strcmp (field->name, "X"))
+                               index = 0;
+                       else if (!strcmp (field->name, "Y"))
+                               index = 1;
+                       else if (!strcmp (field->name, "Z"))
+                               index = 2;
+                       else if (!strcmp (field->name, "W"))
+                               index = 3;
+               }
+
+               if (index != -1) {
+                       if (cfg->verbose_level > 1)
+                               printf ("  SIMD intrinsic field access: %s\n", field->name);
+
+                       return simd_intrinsic_emit_getter_op (cfg, index, field->parent, mono_field_get_type (field), addr);
+               }
+       }
+       return NULL;
+}
+
 #endif /* DISABLE_JIT */
+
+#else
+
+MonoInst*
+mono_emit_simd_field_load (MonoCompile *cfg, MonoClassField *field, MonoInst *addr)
+{
+       return NULL;
+}
+
 #endif /* MONO_ARCH_SIMD_INTRINSICS */
index 803d8daf1561bb4b8014414d1c389db1a90a7c79..725c5c304337ab89bbf31831b7b9698cf9590044 100644 (file)
@@ -1,3 +1,4 @@
+SIMD_METHOD("Abs", SN_Abs)
 SIMD_METHOD("AddSub", SN_AddSub)
 SIMD_METHOD("AddWithSaturation", SN_AddWithSaturation)
 SIMD_METHOD("AndNot", SN_AndNot)
@@ -16,14 +17,24 @@ SIMD_METHOD("ConvertToFloat", SN_ConvertToFloat)
 SIMD_METHOD("ConvertToInt", SN_ConvertToInt)
 SIMD_METHOD("ConvertToIntTruncated", SN_ConvertToIntTruncated)
 SIMD_METHOD(".ctor", SN_ctor)
+SIMD_METHOD("Dot", SN_Dot)
 SIMD_METHOD("Duplicate", SN_Duplicate)
 SIMD_METHOD("DuplicateHigh", SN_DuplicateHigh)
 SIMD_METHOD("DuplicateLow", SN_DuplicateLow)
+SIMD_METHOD("Equals", SN_Equals)
 SIMD_METHOD("ExtractByteMask", SN_ExtractByteMask)
+SIMD_METHOD("GreaterThan", SN_GreaterThan)
+SIMD_METHOD("GreaterThanOrEqual", SN_GreaterThanOrEqual)
+SIMD_METHOD("LessThan", SN_LessThan)
+SIMD_METHOD("LessThanOrEqual", SN_LessThanOrEqual)
+SIMD_METHOD("get_AllOnes", SN_get_AllOnes)
+SIMD_METHOD("get_Count", SN_get_Count)
+SIMD_METHOD("get_Item", SN_get_Item)
 SIMD_METHOD("get_W", SN_get_W)
 SIMD_METHOD("get_X", SN_get_X)
 SIMD_METHOD("get_Y", SN_get_Y)
 SIMD_METHOD("get_Z", SN_get_Z)
+SIMD_METHOD("get_Zero", SN_get_Zero)
 SIMD_METHOD("get_V0", SN_get_V0)
 SIMD_METHOD("get_V1", SN_get_V1)
 SIMD_METHOD("get_V2", SN_get_V2)
@@ -96,6 +107,7 @@ SIMD_METHOD("Shuffle", SN_Shuffle)
 SIMD_METHOD("SignedPackWithSignedSaturation", SN_SignedPackWithSignedSaturation)
 SIMD_METHOD("SignedPackWithUnsignedSaturation", SN_SignedPackWithUnsignedSaturation)
 SIMD_METHOD("Sqrt", SN_Sqrt)
+SIMD_METHOD("SquareRoot", SN_SquareRoot)
 SIMD_METHOD("StoreAligned", SN_StoreAligned)
 SIMD_METHOD("StoreNonTemporal", SN_StoreNonTemporal)
 SIMD_METHOD("SubtractWithSaturation", SN_SubtractWithSaturation)
index cb100267ef706a6c3608f7b09e12f5dcb92e1cfb..d70788c6afb39ce430fcde647838b3ca7689e66b 100644 (file)
@@ -13,6 +13,7 @@
 #include <mono/metadata/debug-helpers.h>
 #include <mono/metadata/mempool.h>
 #include <mono/metadata/mempool-internals.h>
+#include <mono/utils/mono-compiler.h>
 
 #ifndef DISABLE_JIT
 
@@ -1515,4 +1516,8 @@ mono_ssa_loop_invariant_code_motion (MonoCompile *cfg)
        }
 }
 
-#endif /* DISABLE_JIT */
+#else /* !DISABLE_JIT */
+
+MONO_EMPTY_SOURCE_FILE (ssa);
+
+#endif /* !DISABLE_JIT */
index 98f89d63500b7fe89ea677a7bbe041a911dd4a00..90f0af81b5a2c2e606f9e4b2d7be094f7be8d357 100644 (file)
@@ -101,17 +101,21 @@ mono_trace_eval (MonoMethod *method)
                
                switch (op->op){
                case MONO_TRACEOP_ALL:
-                       inc = 1; break;
+                       inc = 1;
+                       break;
                case MONO_TRACEOP_PROGRAM:
                        if (trace_spec.assembly && (method->klass->image == mono_assembly_get_image (trace_spec.assembly)))
-                               inc = 1; break;
+                               inc = 1;
+                       break;
                case MONO_TRACEOP_WRAPPER:
                        if ((method->wrapper_type == MONO_WRAPPER_NATIVE_TO_MANAGED) ||
                                (method->wrapper_type == MONO_WRAPPER_MANAGED_TO_NATIVE))
-                               inc = 1; break;
+                               inc = 1;
+                       break;
                case MONO_TRACEOP_METHOD:
                        if (mono_method_desc_full_match ((MonoMethodDesc *) op->data, method))
-                               inc = 1; break;
+                               inc = 1;
+                       break;
                case MONO_TRACEOP_CLASS:
                        if (strcmp (method->klass->name_space, op->data) == 0)
                                if (strcmp (method->klass->name, op->data2) == 0)
@@ -119,18 +123,21 @@ mono_trace_eval (MonoMethod *method)
                        break;
                case MONO_TRACEOP_ASSEMBLY:
                        if (strcmp (mono_image_get_name (method->klass->image), op->data) == 0)
-                               inc = 1; break;
+                               inc = 1;
+                       break;
                case MONO_TRACEOP_NAMESPACE:
                        if (strcmp (method->klass->name_space, op->data) == 0)
                                inc = 1;
+                       break;
                case MONO_TRACEOP_EXCEPTION:
                        break;
                }
-               if (op->exclude){
+               if (op->exclude) {
                        if (inc)
                                include = 0;
-               } else if (inc)
+               } else if (inc) {
                        include = 1;
+               }
        }
        return include;
 }
index d79b275dd893c1de7e0d28ccf83cb5da97d2ff03..03e2af6fd3943a8f6afcbb50c8c4994f98bde7f6 100644 (file)
@@ -33,6 +33,7 @@
 
 #define IS_REX(inst) (((inst) >= 0x40) && ((inst) <= 0x4f))
 
+#ifndef DISABLE_JIT
 /*
  * mono_arch_get_unbox_trampoline:
  * @m: method pointer
@@ -110,6 +111,7 @@ mono_arch_get_static_rgctx_trampoline (MonoMethod *m, MonoMethodRuntimeGenericCo
 
        return start;
 }
+#endif /* !DISABLE_JIT */
 
 #ifdef _WIN64
 // Workaround lack of Valgrind support for 64-bit Windows
@@ -171,6 +173,7 @@ mono_arch_patch_callsite (guint8 *method_start, guint8 *orig_code, guint8 *addr)
        }
 }
 
+#ifndef DISABLE_JIT
 guint8*
 mono_arch_create_llvm_native_thunk (MonoDomain *domain, guint8 *addr)
 {
@@ -190,6 +193,7 @@ mono_arch_create_llvm_native_thunk (MonoDomain *domain, guint8 *addr)
        mono_profiler_code_buffer_new (thunk_start, thunk_code - thunk_start, MONO_PROFILER_CODE_BUFFER_HELPER, NULL);
        return addr;
 }
+#endif /* !DISABLE_JIT */
 
 void
 mono_arch_patch_plt_entry (guint8 *code, gpointer *got, mgreg_t *regs, guint8 *addr)
@@ -208,6 +212,7 @@ mono_arch_patch_plt_entry (guint8 *code, gpointer *got, mgreg_t *regs, guint8 *a
        InterlockedExchangePointer (plt_jump_table_entry, addr);
 }
 
+#ifndef DISABLE_JIT
 static void
 stack_unaligned (MonoTrampolineType tramp_type)
 {
@@ -756,6 +761,7 @@ mono_arch_invalidate_method (MonoJitInfo *ji, void *func, gpointer func_arg)
        x86_push_imm (code, (guint64)func_arg);
        amd64_call_reg (code, AMD64_R11);
 }
+#endif /* !DISABLE_JIT */
 
 gpointer
 mono_amd64_handler_block_trampoline_helper (void)
@@ -764,10 +770,10 @@ mono_amd64_handler_block_trampoline_helper (void)
        return jit_tls->handler_block_return_address;
 }
 
+#ifndef DISABLE_JIT
 gpointer
 mono_arch_create_handler_block_trampoline (MonoTrampInfo **info, gboolean aot)
 {
-       guint8 *tramp = mono_get_trampoline_code (MONO_TRAMPOLINE_HANDLER_BLOCK_GUARD);
        guint8 *code, *buf;
        int tramp_size = 64;
        MonoJumpInfo *ji = NULL;
@@ -778,47 +784,52 @@ mono_arch_create_handler_block_trampoline (MonoTrampInfo **info, gboolean aot)
        unwind_ops = mono_arch_get_cie_program ();
 
        /*
-       This trampoline restore the call chain of the handler block then jumps into the code that deals with it.
-       */
-       if (!aot && mono_get_jit_tls_offset () != -1) {
-               code = mono_amd64_emit_tls_get (code, MONO_AMD64_ARG_REG1, mono_get_jit_tls_offset ());
-               amd64_mov_reg_membase (code, MONO_AMD64_ARG_REG1, MONO_AMD64_ARG_REG1, MONO_STRUCT_OFFSET (MonoJitTlsData, handler_block_return_address), 8);
-               /* Simulate a call */
-               amd64_push_reg (code, AMD64_RAX);
-               mono_add_unwind_op_def_cfa_offset (unwind_ops, code, buf, 16);
-               amd64_jump_code (code, tramp);
+        * This trampoline restore the call chain of the handler block then jumps into the code that deals with it.
+        * We get here from the ret emitted by CEE_ENDFINALLY.
+        * The stack is misaligned.
+        */
+       /* Align the stack before the call to mono_amd64_handler_block_trampoline_helper() */
+#ifdef TARGET_WIN32
+       /* Also make room for the "register parameter stack area" as specified by the Windows x64 ABI (4 64-bit registers) */
+       amd64_alu_reg_imm (code, X86_SUB, AMD64_RSP, 8 + 4 * 8);
+#else
+       amd64_alu_reg_imm (code, X86_SUB, AMD64_RSP, 8);
+#endif
+       if (aot) {
+               code = mono_arch_emit_load_aotconst (buf, code, &ji, MONO_PATCH_INFO_JIT_ICALL_ADDR, "mono_amd64_handler_block_trampoline_helper");
+               amd64_call_reg (code, AMD64_R11);
        } else {
-               /*
-                * We get here from the ret emitted by CEE_ENDFINALLY.
-                * The stack is misaligned.
-                */
-               /* Align the stack before the call */
-               amd64_alu_reg_imm (code, X86_SUB, AMD64_RSP, 8);
-               if (aot) {
-                       code = mono_arch_emit_load_aotconst (buf, code, &ji, MONO_PATCH_INFO_JIT_ICALL_ADDR, "mono_amd64_handler_block_trampoline_helper");
-                       amd64_call_reg (code, AMD64_R11);
-               } else {
-                       amd64_mov_reg_imm (code, AMD64_RAX, mono_amd64_handler_block_trampoline_helper);
-                       amd64_call_reg (code, AMD64_RAX);
-               }
-               /* Undo stack alignment */
-               amd64_alu_reg_imm (code, X86_ADD, AMD64_RSP, 8);
-               /* Save the result to the stack */
-               amd64_push_reg (code, AMD64_RAX);
-               if (aot) {
-                       char *name = g_strdup_printf ("trampoline_func_%d", MONO_TRAMPOLINE_HANDLER_BLOCK_GUARD);
-                       code = mono_arch_emit_load_aotconst (buf, code, &ji, MONO_PATCH_INFO_JIT_ICALL_ADDR, name);
-                       amd64_mov_reg_reg (code, AMD64_RAX, AMD64_R11, 8);
-               } else {
-                       amd64_mov_reg_imm (code, AMD64_RAX, tramp);
-               }
-               /* The stack is aligned */
+               amd64_mov_reg_imm (code, AMD64_RAX, mono_amd64_handler_block_trampoline_helper);
                amd64_call_reg (code, AMD64_RAX);
-               /* Load return address */
-               amd64_pop_reg (code, AMD64_RAX);
-               /* The stack is misaligned, thats what the code we branch to expects */
-               amd64_jump_reg (code, AMD64_RAX);
        }
+       /* Undo stack alignment */
+#ifdef TARGET_WIN32
+       amd64_alu_reg_imm (code, X86_ADD, AMD64_RSP, 8 + 4 * 8);
+#else
+       amd64_alu_reg_imm (code, X86_ADD, AMD64_RSP, 8);
+#endif
+       /* Save the result to the stack */
+       amd64_push_reg (code, AMD64_RAX);
+#ifdef TARGET_WIN32
+       /* Make room for the "register parameter stack area" as specified by the Windows x64 ABI (4 64-bit registers) */
+       amd64_alu_reg_imm (code, X86_SUB, AMD64_RSP, 4 * 8);
+#endif
+       if (aot) {
+               char *name = g_strdup_printf ("trampoline_func_%d", MONO_TRAMPOLINE_HANDLER_BLOCK_GUARD);
+               code = mono_arch_emit_load_aotconst (buf, code, &ji, MONO_PATCH_INFO_JIT_ICALL_ADDR, name);
+               amd64_mov_reg_reg (code, AMD64_RAX, AMD64_R11, 8);
+       } else {
+               amd64_mov_reg_imm (code, AMD64_RAX, mono_get_trampoline_func (MONO_TRAMPOLINE_HANDLER_BLOCK_GUARD));
+       }
+       /* The stack is aligned */
+       amd64_call_reg (code, AMD64_RAX);
+#ifdef TARGET_WIN32
+       amd64_alu_reg_imm (code, X86_ADD, AMD64_RSP, 4 * 8);
+#endif
+       /* Load return address */
+       amd64_pop_reg (code, AMD64_RAX);
+       /* The stack is misaligned, thats what the code we branch to expects */
+       amd64_jump_reg (code, AMD64_RAX);
 
        mono_arch_flush_icache (buf, code - buf);
        mono_profiler_code_buffer_new (buf, code - buf, MONO_PROFILER_CODE_BUFFER_HELPER, NULL);
@@ -828,6 +839,7 @@ mono_arch_create_handler_block_trampoline (MonoTrampInfo **info, gboolean aot)
 
        return buf;
 }
+#endif /* !DISABLE_JIT */
 
 /*
  * mono_arch_get_call_target:
@@ -858,6 +870,7 @@ mono_arch_get_plt_info_offset (guint8 *plt_entry, mgreg_t *regs, guint8 *code)
        return *(guint32*)(plt_entry + 6);
 }
 
+#ifndef DISABLE_JIT
 /*
  * mono_arch_create_sdb_trampoline:
  *
@@ -868,7 +881,7 @@ mono_arch_get_plt_info_offset (guint8 *plt_entry, mgreg_t *regs, guint8 *code)
 guint8*
 mono_arch_create_sdb_trampoline (gboolean single_step, MonoTrampInfo **info, gboolean aot)
 {
-       int tramp_size = 256;
+       int tramp_size = 512;
        int i, framesize, ctx_offset, cfa_offset, gregs_offset;
        guint8 *code, *buf;
        GSList *unwind_ops = NULL;
@@ -956,3 +969,69 @@ mono_arch_create_sdb_trampoline (gboolean single_step, MonoTrampInfo **info, gbo
 
        return buf;
 }
+#endif /* !DISABLE_JIT */
+
+#ifdef DISABLE_JIT
+gpointer
+mono_arch_get_unbox_trampoline (MonoMethod *m, gpointer addr)
+{
+       g_assert_not_reached ();
+       return NULL;
+}
+
+gpointer
+mono_arch_get_static_rgctx_trampoline (MonoMethod *m, MonoMethodRuntimeGenericContext *mrgctx, gpointer addr)
+{
+       g_assert_not_reached ();
+       return NULL;
+}
+
+gpointer
+mono_arch_create_rgctx_lazy_fetch_trampoline (guint32 slot, MonoTrampInfo **info, gboolean aot)
+{
+       g_assert_not_reached ();
+       return NULL;
+}
+
+guchar*
+mono_arch_create_generic_trampoline (MonoTrampolineType tramp_type, MonoTrampInfo **info, gboolean aot)
+{
+       g_assert_not_reached ();
+       return NULL;
+}
+
+gpointer
+mono_arch_create_specific_trampoline (gpointer arg1, MonoTrampolineType tramp_type, MonoDomain *domain, guint32 *code_len)
+{
+       g_assert_not_reached ();
+       return NULL;
+}
+
+gpointer
+mono_arch_create_general_rgctx_lazy_fetch_trampoline (MonoTrampInfo **info, gboolean aot)
+{
+       g_assert_not_reached ();
+       return NULL;
+}
+
+gpointer
+mono_arch_create_handler_block_trampoline (MonoTrampInfo **info, gboolean aot)
+{
+        g_assert_not_reached ();
+        return NULL;
+}
+
+void
+mono_arch_invalidate_method (MonoJitInfo *ji, void *func, gpointer func_arg)
+{
+       g_assert_not_reached ();
+       return;
+}
+
+guint8*
+mono_arch_create_sdb_trampoline (gboolean single_step, MonoTrampInfo **info, gboolean aot)
+{
+       g_assert_not_reached ();
+       return NULL;
+}
+#endif /* DISABLE_JIT */
index 02b1f12c08f2b5b74e669ece1bbd6e4ab7c43992..747163b176dc74678a91987d3b1046224ec8fd61 100644 (file)
@@ -876,13 +876,8 @@ mono_arch_get_call_target (guint8 *code)
 {
        guint32 ins = ((guint32*)(gpointer)code) [-1];
 
-#if MONOTOUCH
        /* Should be a 'bl' or a 'b' */
        if (((ins >> 25) & 0x7) == 0x5) {
-#else
-       /* Should be a 'bl' */
-       if ((((ins >> 25) & 0x7) == 0x5) && (((ins >> 24) & 0x1) == 0x1)) {
-#endif
                gint32 disp = ((((gint32)ins) & 0xffffff) << 8) >> 8;
                guint8 *target = code - 4 + 8 + (disp * 4);
 
index 3d7eb62e4004b07a10c4644c3086e9eedf21b66a..4f6c4acb204fc26e059d4c7c08d3e4c6315c8938 100644 (file)
@@ -73,10 +73,10 @@ libmono_profiler_iomap_la_LDFLAGS = $(prof_ldflags)
 libmono_profiler_iomap_static_la_SOURCES = mono-profiler-iomap.c
 libmono_profiler_iomap_static_la_LDFLAGS = -static
 
-libmono_profiler_log_la_SOURCES = proflog.c
+libmono_profiler_log_la_SOURCES = mono-profiler-log.c
 libmono_profiler_log_la_LIBADD = $(monodir)/mono/mini/$(LIBMONO_LA) $(GLIB_LIBS) $(Z_LIBS)
 libmono_profiler_log_la_LDFLAGS = $(prof_ldflags)
-libmono_profiler_log_static_la_SOURCES = proflog.c
+libmono_profiler_log_static_la_SOURCES = mono-profiler-log.c
 libmono_profiler_log_static_la_LDFLAGS = -static
 
 if HAVE_VTUNE
@@ -88,7 +88,7 @@ libmono_profiler_vtune_static_la_SOURCES = mono-profiler-vtune.c
 libmono_profiler_vtune_static_la_LDFLAGS = -static
 endif
 
-mprof_report_SOURCES = decode.c
+mprof_report_SOURCES = mprof-report.c
 mprof_report_LDADD = $(Z_LIBS) $(GLIB_LIBS) $(LIBICONV)
 
 PLOG_TESTS_SRC=test-alloc.cs test-busy.cs test-monitor.cs test-excleave.cs \
@@ -110,6 +110,7 @@ testlog: $(PLOG_TESTS)
 
 check-local: $(check_targets)
 
-EXTRA_DIST=utils.c utils.h proflog.h \
-       $(PLOG_TESTS_SRC) ptestrunner.pl \
+EXTRA_DIST=mono-profiler-log.h \
+       $(PLOG_TESTS_SRC) \
+       ptestrunner.pl \
        $(suppression_DATA)
diff --git a/mono/profiler/decode.c b/mono/profiler/decode.c
deleted file mode 100644 (file)
index e8d53af..0000000
+++ /dev/null
@@ -1,4094 +0,0 @@
-/*
- * decode.c: mprof-report program source: decode and analyze the log profiler data
- *
- * Authors:
- *   Paolo Molaro (lupus@ximian.com)
- *   Alex Rønne Petersen (alexrp@xamarin.com)
- *
- * Copyright 2010 Novell, Inc (http://www.novell.com)
- * Licensed under the MIT license. See LICENSE file in the project root for full license information.
- */
-
-/*
- * The Coverage XML output schema
- * <coverage>
- *   <assembly/>
- *   <class/>
- *   <method>
- *     <statement/>
- *   </method>
- * </coverage>
- *
- * Elements:
- *   <coverage> - The root element of the documentation. It can contain any number of
- *                <assembly>, <class> or <method> elements.
- *                Attributes:
- *                   - version: The version number for the file format - (eg: "0.3")
- *   <assembly> - Contains data about assemblies. Has no child elements
- *                Attributes:
- *                   - name: The name of the assembly - (eg: "System.Xml")
- *                   - guid: The GUID of the assembly
- *                   - filename: The filename of the assembly
- *                   - method-count: The number of methods in the assembly
- *                   - full: The number of fully covered methods
- *                   - partial: The number of partially covered methods
- *   <class> - Contains data about classes. Has no child elements
- *             Attributes:
- *                - name: The name of the class
- *                - method-count: The number of methods in the class
- *                - full: The number of fully covered methods
- *                - partial: The number of partially covered methods
- *   <method> - Contains data about methods. Can contain any number of <statement> elements
- *              Attributes:
- *                 - assembly: The name of the parent assembly
- *                 - class: The name of the parent class
- *                 - name: The name of the method, with all it's parameters
- *                 - filename: The name of the source file containing this method
- *                 - token
- *   <statement> - Contains data about IL statements. Has no child elements
- *                 Attributes:
- *                    - offset: The offset of the statement in the IL code after the previous
- *                              statement's offset
- *                    - counter: 1 if the line was covered, 0 if it was not
- *                    - line: The line number in the parent method's file
- *                    - column: The column on the line
- */
-#include <config.h>
-#include "utils.c"
-#include "proflog.h"
-#include <string.h>
-#include <assert.h>
-#include <stdio.h>
-#if !defined(__APPLE__) && !defined(__FreeBSD__)
-#include <malloc.h>
-#endif
-#include <unistd.h>
-#include <stdlib.h>
-#if defined (HAVE_SYS_ZLIB)
-#include <zlib.h>
-#endif
-#include <glib.h>
-#include <mono/metadata/profiler.h>
-#include <mono/metadata/object.h>
-#include <mono/metadata/debug-helpers.h>
-#include <mono/utils/mono-counters.h>
-
-#define HASH_SIZE 9371
-#define SMALL_HASH_SIZE 31
-
-#if defined(__native_client__) || defined(__native_client_codegen__)
-volatile int __nacl_thread_suspension_needed = 0;
-void __nacl_suspend_thread_if_needed() {}
-#endif
-
-static int debug = 0;
-static int collect_traces = 0;
-static int show_traces = 0;
-static int trace_max = 6;
-static int verbose = 0;
-static uintptr_t *tracked_objects = 0;
-static int num_tracked_objects = 0;
-static uintptr_t thread_filter = 0;
-static uint64_t find_size = 0;
-static const char* find_name = NULL;
-static uint64_t time_from = 0;
-static uint64_t time_to = 0xffffffffffffffffULL;
-static int use_time_filter = 0;
-static uint64_t startup_time = 0;
-static FILE* outfile = NULL;
-static FILE* coverage_outfile = NULL;
-
-static int32_t
-read_int16 (unsigned char *p)
-{
-       int32_t value = *p++;
-       value |= (*p++) << 8;
-       return value;
-}
-
-static int32_t
-read_int32 (unsigned char *p)
-{
-       int32_t value = *p++;
-       value |= (*p++) << 8;
-       value |= (*p++) << 16;
-       value |= (uint32_t)(*p++) << 24;
-       return value;
-}
-
-static int64_t
-read_int64 (unsigned char *p)
-{
-       uint64_t value = *p++;
-       value |= (*p++) << 8;
-       value |= (*p++) << 16;
-       value |= (uint64_t)(*p++) << 24;
-       value |= (uint64_t)(*p++) << 32;
-       value |= (uint64_t)(*p++) << 40;
-       value |= (uint64_t)(*p++) << 48;
-       value |= (uint64_t)(*p++) << 54;
-       return value;
-}
-
-static char*
-pstrdup (const char *s)
-{
-       int len = strlen (s) + 1;
-       char *p = (char *)malloc (len);
-       memcpy (p, s, len);
-       return p;
-}
-
-typedef struct _CounterValue CounterValue;
-struct _CounterValue {
-       uint64_t timestamp;
-       unsigned char *buffer;
-       CounterValue *next;
-};
-
-typedef struct _Counter Counter;
-struct _Counter {
-       int index;
-       const char *section;
-       const char *name;
-       int type;
-       int unit;
-       int variance;
-       CounterValue *values;
-       CounterValue *values_last;
-};
-
-typedef struct _CounterList CounterList;
-struct _CounterList {
-       Counter *counter;
-       CounterList *next;
-};
-
-typedef struct _CounterSection CounterSection;
-struct _CounterSection {
-       const char *value;
-       CounterList *counters;
-       CounterList *counters_last;
-       CounterSection *next;
-};
-
-typedef struct _CounterTimestamp CounterTimestamp;
-struct _CounterTimestamp {
-       uint64_t value;
-       CounterSection *sections;
-       CounterSection *sections_last;
-       CounterTimestamp *next;
-};
-
-static CounterList *counters = NULL;
-static CounterSection *counters_sections = NULL;
-static CounterTimestamp *counters_timestamps = NULL;
-
-enum {
-       COUNTERS_SORT_TIME,
-       COUNTERS_SORT_CATEGORY
-};
-
-static int counters_sort_mode = COUNTERS_SORT_TIME;
-
-static void
-add_counter_to_section (Counter *counter)
-{
-       CounterSection *csection, *s;
-       CounterList *clist;
-
-       clist = (CounterList *)calloc (1, sizeof (CounterList));
-       clist->counter = counter;
-
-       for (csection = counters_sections; csection; csection = csection->next) {
-               if (strcmp (csection->value, counter->section) == 0) {
-                       /* If section exist */
-                       if (!csection->counters)
-                               csection->counters = clist;
-                       else
-                               csection->counters_last->next = clist;
-                       csection->counters_last = clist;
-                       return;
-               }
-       }
-
-       /* If section does not exist */
-       csection = (CounterSection *)calloc (1, sizeof (CounterSection));
-       csection->value = counter->section;
-       csection->counters = clist;
-       csection->counters_last = clist;
-
-       if (!counters_sections) {
-               counters_sections = csection;
-       } else {
-               s = counters_sections;
-               while (s->next)
-                       s = s->next;
-               s->next = csection;
-       }
-}
-
-static void
-add_counter (const char *section, const char *name, int type, int unit, int variance, int index)
-{
-       CounterList *list, *l;
-       Counter *counter;
-
-       for (list = counters; list; list = list->next)
-               if (list->counter->index == index)
-                       return;
-
-       counter = (Counter *)calloc (1, sizeof (Counter));
-       counter->section = section;
-       counter->name = name;
-       counter->type = type;
-       counter->unit = unit;
-       counter->variance = variance;
-       counter->index = index;
-
-       list = (CounterList *)calloc (1, sizeof (CounterList));
-       list->counter = counter;
-
-       if (!counters) {
-               counters = list;
-       } else {
-               l = counters;
-               while (l->next)
-                       l = l->next;
-               l->next = list;
-       }
-
-       if (counters_sort_mode == COUNTERS_SORT_CATEGORY || !verbose)
-               add_counter_to_section (counter);
-}
-
-static void
-add_counter_to_timestamp (uint64_t timestamp, Counter *counter)
-{
-       CounterTimestamp *ctimestamp, *t;
-       CounterSection *csection;
-       CounterList *clist;
-
-       clist = (CounterList *)calloc (1, sizeof (CounterList));
-       clist->counter = counter;
-
-       for (ctimestamp = counters_timestamps; ctimestamp; ctimestamp = ctimestamp->next) {
-               if (ctimestamp->value == timestamp) {
-                       for (csection = ctimestamp->sections; csection; csection = csection->next) {
-                               if (strcmp (csection->value, counter->section) == 0) {
-                                       /* if timestamp exist and section exist */
-                                       if (!csection->counters)
-                                               csection->counters = clist;
-                                       else
-                                               csection->counters_last->next = clist;
-                                       csection->counters_last = clist;
-                                       return;
-                               }
-                       }
-
-                       /* if timestamp exist and section does not exist */
-                       csection = (CounterSection *)calloc (1, sizeof (CounterSection));
-                       csection->value = counter->section;
-                       csection->counters = clist;
-                       csection->counters_last = clist;
-
-                       if (!ctimestamp->sections)
-                               ctimestamp->sections = csection;
-                       else
-                               ctimestamp->sections_last->next = csection;
-                       ctimestamp->sections_last = csection;
-                       return;
-               }
-       }
-
-       /* If timestamp do not exist and section does not exist */
-       csection = (CounterSection *)calloc (1, sizeof (CounterSection));
-       csection->value = counter->section;
-       csection->counters = clist;
-       csection->counters_last = clist;
-
-       ctimestamp = (CounterTimestamp *)calloc (1, sizeof (CounterTimestamp));
-       ctimestamp->value = timestamp;
-       ctimestamp->sections = csection;
-       ctimestamp->sections_last = csection;
-
-       if (!counters_timestamps) {
-               counters_timestamps = ctimestamp;
-       } else {
-               t = counters_timestamps;
-               while (t->next)
-                       t = t->next;
-               t->next = ctimestamp;
-       }
-}
-
-static void
-add_counter_value (int index, CounterValue *value)
-{
-       CounterList *list;
-
-       for (list = counters; list; list = list->next) {
-               if (list->counter->index == index) {
-                       if (!list->counter->values)
-                               list->counter->values = value;
-                       else
-                               list->counter->values_last->next = value;
-                       list->counter->values_last = value;
-
-                       if (counters_sort_mode == COUNTERS_SORT_TIME)
-                               add_counter_to_timestamp (value->timestamp, list->counter);
-
-                       return;
-               }
-       }
-}
-
-static const char*
-section_name (int section)
-{
-       switch (section) {
-       case MONO_COUNTER_JIT: return "Mono JIT";
-       case MONO_COUNTER_GC: return "Mono GC";
-       case MONO_COUNTER_METADATA: return "Mono Metadata";
-       case MONO_COUNTER_GENERICS: return "Mono Generics";
-       case MONO_COUNTER_SECURITY: return "Mono Security";
-       case MONO_COUNTER_RUNTIME: return "Mono Runtime";
-       case MONO_COUNTER_SYSTEM: return "Mono System";
-       case MONO_COUNTER_PROFILER: return "Mono Profiler";
-       default: return "<unknown>";
-       }
-}
-
-static const char*
-type_name (int type)
-{
-       switch (type) {
-       case MONO_COUNTER_INT: return "Int";
-       case MONO_COUNTER_UINT: return "UInt";
-       case MONO_COUNTER_WORD: return "Word";
-       case MONO_COUNTER_LONG: return "Long";
-       case MONO_COUNTER_ULONG: return "ULong";
-       case MONO_COUNTER_DOUBLE: return "Double";
-       case MONO_COUNTER_STRING: return "String";
-       case MONO_COUNTER_TIME_INTERVAL: return "Time Interval";
-       default: return "<unknown>";
-       }
-}
-
-static const char*
-unit_name (int unit)
-{
-       switch (unit) {
-       case MONO_COUNTER_RAW: return "Raw";
-       case MONO_COUNTER_BYTES: return "Bytes";
-       case MONO_COUNTER_TIME: return "Time";
-       case MONO_COUNTER_COUNT: return "Count";
-       case MONO_COUNTER_PERCENTAGE: return "Percentage";
-       default: return "<unknown>";
-       }
-}
-
-static const char*
-variance_name (int variance)
-{
-       switch (variance) {
-       case MONO_COUNTER_MONOTONIC: return "Monotonic";
-       case MONO_COUNTER_CONSTANT: return "Constant";
-       case MONO_COUNTER_VARIABLE: return "Variable";
-       default: return "<unknown>";
-       }
-}
-
-static void
-dump_counters_value (Counter *counter, const char *key_format, const char *key, void *value)
-{
-       char format[32];
-
-       if (value == NULL) {
-               snprintf (format, sizeof (format), "%s : %%s\n", key_format);
-               fprintf (outfile, format, key, "<null>");
-       } else {
-               switch (counter->type) {
-               case MONO_COUNTER_INT:
-#if SIZEOF_VOID_P == 4
-               case MONO_COUNTER_WORD:
-#endif
-                       snprintf (format, sizeof (format), "%s : %%d\n", key_format);
-                       fprintf (outfile, format, key, *(int32_t*)value);
-                       break;
-               case MONO_COUNTER_UINT:
-                       snprintf (format, sizeof (format), "%s : %%u\n", key_format);
-                       fprintf (outfile, format, key, *(uint32_t*)value);
-                       break;
-               case MONO_COUNTER_LONG:
-#if SIZEOF_VOID_P == 8
-               case MONO_COUNTER_WORD:
-#endif
-               case MONO_COUNTER_TIME_INTERVAL:
-                       if (counter->type == MONO_COUNTER_LONG && counter->unit == MONO_COUNTER_TIME) {
-                               snprintf (format, sizeof (format), "%s : %%0.3fms\n", key_format);
-                               fprintf (outfile, format, key, (double)*(int64_t*)value / 10000.0);
-                       } else if (counter->type == MONO_COUNTER_TIME_INTERVAL) {
-                               snprintf (format, sizeof (format), "%s : %%0.3fms\n", key_format);
-                               fprintf (outfile, format, key, (double)*(int64_t*)value / 1000.0);
-                       } else {
-                               snprintf (format, sizeof (format), "%s : %%u\n", key_format);
-                               fprintf (outfile, format, key, *(int64_t*)value);
-                       }
-                       break;
-               case MONO_COUNTER_ULONG:
-                       snprintf (format, sizeof (format), "%s : %%llu\n", key_format);
-                       fprintf (outfile, format, key, *(uint64_t*)value);
-                       break;
-               case MONO_COUNTER_DOUBLE:
-                       snprintf (format, sizeof (format), "%s : %%f\n", key_format);
-                       fprintf (outfile, format, key, *(double*)value);
-                       break;
-               case MONO_COUNTER_STRING:
-                       snprintf (format, sizeof (format), "%s : %%s\n", key_format);
-                       fprintf (outfile, format, key, *(char*)value);
-                       break;
-               }
-       }
-}
-
-static void
-dump_counters (void)
-{
-       Counter *counter;
-       CounterValue *cvalue;
-       CounterTimestamp *ctimestamp;
-       CounterSection *csection;
-       CounterList *clist;
-       char strtimestamp[17];
-       int i, section_printed;
-
-       fprintf (outfile, "\nCounters:\n");
-
-       if (!verbose) {
-               char counters_to_print[][64] = {
-                       "Methods from AOT",
-                       "Methods JITted using mono JIT",
-                       "Methods JITted using LLVM",
-                       "Total time spent JITting (sec)",
-                       "User Time",
-                       "System Time",
-                       "Total Time",
-                       "Working Set",
-                       "Private Bytes",
-                       "Virtual Bytes",
-                       "Page Faults",
-                       "CPU Load Average - 1min",
-                       "CPU Load Average - 5min",
-                       "CPU Load Average - 15min",
-                       ""
-               };
-
-               for (csection = counters_sections; csection; csection = csection->next) {
-                       section_printed = 0;
-
-                       for (clist = csection->counters; clist; clist = clist->next) {
-                               counter = clist->counter;
-                               if (!counter->values_last)
-                                       continue;
-
-                               for (i = 0; counters_to_print [i][0] != 0; i++) {
-                                       if (strcmp (counters_to_print [i], counter->name) == 0) {
-                                               if (!section_printed) {
-                                                       fprintf (outfile, "\t%s:\n", csection->value);
-                                                       section_printed = 1;
-                                               }
-
-                                               dump_counters_value (counter, "\t\t%-30s", counter->name, counter->values_last->buffer);
-                                               break;
-                                       }
-                               }
-                       }
-               }
-       } else if (counters_sort_mode == COUNTERS_SORT_TIME) {
-               for (ctimestamp = counters_timestamps; ctimestamp; ctimestamp = ctimestamp->next) {
-                       fprintf (outfile, "\t%llu:%02llu:%02llu:%02llu.%03llu:\n",
-                               (unsigned long long) (ctimestamp->value / 1000 / 60 / 60 / 24 % 1000),
-                               (unsigned long long) (ctimestamp->value / 1000 / 60 / 60 % 24),
-                               (unsigned long long) (ctimestamp->value / 1000 / 60 % 60),
-                               (unsigned long long) (ctimestamp->value / 1000 % 60),
-                               (unsigned long long) (ctimestamp->value % 1000));
-
-                       for (csection = ctimestamp->sections; csection; csection = csection->next) {
-                               fprintf (outfile, "\t\t%s:\n", csection->value);
-
-                               for (clist = csection->counters; clist; clist = clist->next) {
-                                       counter = clist->counter;
-                                       for (cvalue = counter->values; cvalue; cvalue = cvalue->next) {
-                                               if (cvalue->timestamp != ctimestamp->value)
-                                                       continue;
-
-                                               dump_counters_value (counter, "\t\t\t%-30s", counter->name, cvalue->buffer);
-                                       }
-                               }
-                       }
-               }
-       } else if (counters_sort_mode == COUNTERS_SORT_CATEGORY) {
-               for (csection = counters_sections; csection; csection = csection->next) {
-                       fprintf (outfile, "\t%s:\n", csection->value);
-
-                       for (clist = csection->counters; clist; clist = clist->next) {
-                               counter = clist->counter;
-                               fprintf (outfile, "\t\t%s: [type: %s, unit: %s, variance: %s]\n",
-                                       counter->name, type_name (counter->type), unit_name (counter->unit), variance_name (counter->variance));
-
-                               for (cvalue = counter->values; cvalue; cvalue = cvalue->next) {
-                                       snprintf (strtimestamp, sizeof (strtimestamp), "%llu:%02llu:%02llu:%02llu.%03llu",
-                                               (unsigned long long) (cvalue->timestamp / 1000 / 60 / 60 / 24 % 1000),
-                                               (unsigned long long) (cvalue->timestamp / 1000 / 60 / 60 % 24),
-                                               (unsigned long long) (cvalue->timestamp / 1000 / 60 % 60),
-                                               (unsigned long long) (cvalue->timestamp / 1000 % 60),
-                                               (unsigned long long) (cvalue->timestamp % 1000));
-
-                                       dump_counters_value (counter, "\t\t\t%s", strtimestamp, cvalue->buffer);
-                               }
-                       }
-               }
-       }
-}
-
-static int num_images;
-typedef struct _ImageDesc ImageDesc;
-struct _ImageDesc {
-       ImageDesc *next;
-       intptr_t image;
-       char *filename;
-};
-
-static ImageDesc* image_hash [SMALL_HASH_SIZE] = {0};
-
-static void
-add_image (intptr_t image, char *name)
-{
-       int slot = ((image >> 2) & 0xffff) % SMALL_HASH_SIZE;
-       ImageDesc *cd = (ImageDesc *)malloc (sizeof (ImageDesc));
-       cd->image = image;
-       cd->filename = pstrdup (name);
-       cd->next = image_hash [slot];
-       image_hash [slot] = cd;
-       num_images++;
-}
-
-static int num_assemblies;
-
-typedef struct _AssemblyDesc AssemblyDesc;
-struct _AssemblyDesc {
-       AssemblyDesc *next;
-       intptr_t assembly;
-       char *asmname;
-};
-
-static AssemblyDesc* assembly_hash [SMALL_HASH_SIZE] = {0};
-
-static void
-add_assembly (intptr_t assembly, char *name)
-{
-       int slot = ((assembly >> 2) & 0xffff) % SMALL_HASH_SIZE;
-       AssemblyDesc *cd = (AssemblyDesc *)malloc (sizeof (AssemblyDesc));
-       cd->assembly = assembly;
-       cd->asmname = pstrdup (name);
-       cd->next = assembly_hash [slot];
-       assembly_hash [slot] = cd;
-       num_assemblies++;
-}
-
-typedef struct _BackTrace BackTrace;
-typedef struct {
-       uint64_t count;
-       BackTrace *bt;
-} CallContext;
-
-typedef struct {
-       int count;
-       int size;
-       CallContext *traces;
-} TraceDesc;
-
-typedef struct _ClassDesc ClassDesc;
-struct _ClassDesc {
-       ClassDesc *next;
-       intptr_t klass;
-       char *name;
-       intptr_t allocs;
-       uint64_t alloc_size;
-       TraceDesc traces;
-};
-
-static ClassDesc* class_hash [HASH_SIZE] = {0};
-static int num_classes = 0;
-
-static ClassDesc*
-add_class (intptr_t klass, const char *name)
-{
-       int slot = ((klass >> 2) & 0xffff) % HASH_SIZE;
-       ClassDesc *cd;
-       cd = class_hash [slot];
-       while (cd && cd->klass != klass)
-               cd = cd->next;
-       /* we resolved an unknown class (unless we had the code unloaded) */
-       if (cd) {
-               /*printf ("resolved unknown: %s\n", name);*/
-               free (cd->name);
-               cd->name = pstrdup (name);
-               return cd;
-       }
-       cd = (ClassDesc *)calloc (sizeof (ClassDesc), 1);
-       cd->klass = klass;
-       cd->name = pstrdup (name);
-       cd->next = class_hash [slot];
-       cd->allocs = 0;
-       cd->alloc_size = 0;
-       cd->traces.count = 0;
-       cd->traces.size = 0;
-       cd->traces.traces = NULL;
-       class_hash [slot] = cd;
-       num_classes++;
-       return cd;
-}
-
-static ClassDesc *
-lookup_class (intptr_t klass)
-{
-       int slot = ((klass >> 2) & 0xffff) % HASH_SIZE;
-       ClassDesc *cd = class_hash [slot];
-       while (cd && cd->klass != klass)
-               cd = cd->next;
-       if (!cd) {
-               char buf [128];
-               snprintf (buf, sizeof (buf), "unresolved class %p", (void*)klass);
-               return add_class (klass, buf);
-       }
-       return cd;
-}
-
-typedef struct _MethodDesc MethodDesc;
-struct _MethodDesc {
-       MethodDesc *next;
-       intptr_t method;
-       char *name;
-       intptr_t code;
-       int len;
-       int recurse_count;
-       int sample_hits;
-       int ignore_jit; /* when this is set, we collect the metadata but don't count this method fot jit time and code size, when filtering events */
-       uint64_t calls;
-       uint64_t total_time;
-       uint64_t callee_time;
-       uint64_t self_time;
-       TraceDesc traces;
-};
-
-static MethodDesc* method_hash [HASH_SIZE] = {0};
-static int num_methods = 0;
-
-static MethodDesc*
-add_method (intptr_t method, const char *name, intptr_t code, int len)
-{
-       int slot = ((method >> 2) & 0xffff) % HASH_SIZE;
-       MethodDesc *cd;
-       cd = method_hash [slot];
-       while (cd && cd->method != method)
-               cd = cd->next;
-       /* we resolved an unknown method (unless we had the code unloaded) */
-       if (cd) {
-               cd->code = code;
-               cd->len = len;
-               /*printf ("resolved unknown: %s\n", name);*/
-               free (cd->name);
-               cd->name = pstrdup (name);
-               return cd;
-       }
-       cd = (MethodDesc *)calloc (sizeof (MethodDesc), 1);
-       cd->method = method;
-       cd->name = pstrdup (name);
-       cd->code = code;
-       cd->len = len;
-       cd->calls = 0;
-       cd->total_time = 0;
-       cd->traces.count = 0;
-       cd->traces.size = 0;
-       cd->traces.traces = NULL;
-       cd->next = method_hash [slot];
-       method_hash [slot] = cd;
-       num_methods++;
-       return cd;
-}
-
-static MethodDesc *
-lookup_method (intptr_t method)
-{
-       int slot = ((method >> 2) & 0xffff) % HASH_SIZE;
-       MethodDesc *cd = method_hash [slot];
-       while (cd && cd->method != method)
-               cd = cd->next;
-       if (!cd) {
-               char buf [128];
-               snprintf (buf, sizeof (buf), "unknown method %p", (void*)method);
-               return add_method (method, buf, 0, 0);
-       }
-       return cd;
-}
-
-static int num_stat_samples = 0;
-static int size_stat_samples = 0;
-uintptr_t *stat_samples = NULL;
-int *stat_sample_desc = NULL;
-
-static void
-add_stat_sample (int type, uintptr_t ip) {
-       if (num_stat_samples == size_stat_samples) {
-               size_stat_samples *= 2;
-               if (!size_stat_samples)
-               size_stat_samples = 32;
-               stat_samples = (uintptr_t *)realloc (stat_samples, size_stat_samples * sizeof (uintptr_t));
-               stat_sample_desc = (int *)realloc (stat_sample_desc, size_stat_samples * sizeof (int));
-       }
-       stat_samples [num_stat_samples] = ip;
-       stat_sample_desc [num_stat_samples++] = type;
-}
-
-static MethodDesc*
-lookup_method_by_ip (uintptr_t ip)
-{
-       int i;
-       MethodDesc* m;
-       /* dumb */
-       for (i = 0; i < HASH_SIZE; ++i) {
-               m = method_hash [i];
-               while (m) {
-                       //printf ("checking %p against %p-%p\n", (void*)ip, (void*)(m->code), (void*)(m->code + m->len));
-                       if (ip >= (uintptr_t)m->code && ip < (uintptr_t)m->code + m->len) {
-                               return m;
-                       }
-                       m = m->next;
-               }
-       }
-       return NULL;
-}
-
-static int
-compare_method_samples (const void *a, const void *b)
-{
-       MethodDesc *const *A = (MethodDesc *const *)a;
-       MethodDesc *const *B = (MethodDesc *const *)b;
-       if ((*A)->sample_hits == (*B)->sample_hits)
-               return 0;
-       if ((*B)->sample_hits < (*A)->sample_hits)
-               return -1;
-       return 1;
-}
-
-typedef struct _UnmanagedSymbol UnmanagedSymbol;
-struct _UnmanagedSymbol {
-       UnmanagedSymbol *parent;
-       char *name;
-       int is_binary;
-       uintptr_t addr;
-       uintptr_t size;
-       uintptr_t sample_hits;
-};
-
-static UnmanagedSymbol **usymbols = NULL;
-static int usymbols_size = 0;
-static int usymbols_num = 0;
-
-static int
-compare_usymbol_addr (const void *a, const void *b)
-{
-       UnmanagedSymbol *const *A = (UnmanagedSymbol *const *)a;
-       UnmanagedSymbol *const *B = (UnmanagedSymbol *const *)b;
-       if ((*B)->addr == (*A)->addr)
-               return 0;
-       if ((*B)->addr > (*A)->addr)
-               return -1;
-       return 1;
-}
-
-static int
-compare_usymbol_samples (const void *a, const void *b)
-{
-       UnmanagedSymbol *const *A = (UnmanagedSymbol *const *)a;
-       UnmanagedSymbol *const *B = (UnmanagedSymbol *const *)b;
-       if ((*B)->sample_hits == (*A)->sample_hits)
-               return 0;
-       if ((*B)->sample_hits < (*A)->sample_hits)
-               return -1;
-       return 1;
-}
-
-static void
-add_unmanaged_symbol (uintptr_t addr, char *name, uintptr_t size)
-{
-       UnmanagedSymbol *sym;
-       if (usymbols_num == usymbols_size) {
-               int new_size = usymbols_size * 2;
-               if (!new_size)
-                       new_size = 16;
-               usymbols = (UnmanagedSymbol **)realloc (usymbols, sizeof (void*) * new_size);
-               usymbols_size = new_size;
-       }
-       sym = (UnmanagedSymbol *)calloc (sizeof (UnmanagedSymbol), 1);
-       sym->addr = addr;
-       sym->name = name;
-       sym->size = size;
-       usymbols [usymbols_num++] = sym;
-}
-
-/* only valid after the symbols are sorted */
-static UnmanagedSymbol*
-lookup_unmanaged_symbol (uintptr_t addr)
-{
-       int r = usymbols_num - 1;
-       int l = 0;
-       UnmanagedSymbol *sym;
-       int last_best = -1;
-       while (r >= l) {
-               int m = (l + r) / 2;
-               sym = usymbols [m];
-               if (addr == sym->addr)
-                       return sym;
-               if (addr < sym->addr) {
-                       r = m - 1;
-               } else if (addr > sym->addr) {
-                       l = m + 1;
-                       last_best = m;
-               }
-       }
-       if (last_best >= 0 && (addr - usymbols [last_best]->addr) < 4096)
-               return usymbols [last_best];
-       return NULL;
-}
-
-/* we use the same structure for binaries */
-static UnmanagedSymbol **ubinaries = NULL;
-static int ubinaries_size = 0;
-static int ubinaries_num = 0;
-
-static void
-add_unmanaged_binary (uintptr_t addr, char *name, uintptr_t size)
-{
-       UnmanagedSymbol *sym;
-       if (ubinaries_num == ubinaries_size) {
-               int new_size = ubinaries_size * 2;
-               if (!new_size)
-                       new_size = 16;
-               ubinaries = (UnmanagedSymbol **)realloc (ubinaries, sizeof (void*) * new_size);
-               ubinaries_size = new_size;
-       }
-       sym = (UnmanagedSymbol *)calloc (sizeof (UnmanagedSymbol), 1);
-       sym->addr = addr;
-       sym->name = name;
-       sym->size = size;
-       sym->is_binary = 1;
-       ubinaries [ubinaries_num++] = sym;
-}
-
-static UnmanagedSymbol*
-lookup_unmanaged_binary (uintptr_t addr)
-{
-       int i;
-       for (i = 0; i < ubinaries_num; ++i) {
-               UnmanagedSymbol *ubin = ubinaries [i];
-               if (addr >= ubin->addr && addr < ubin->addr + ubin->size) {
-                       return ubin;
-               }
-       }
-       return NULL;
-}
-
-static const char*
-sample_type_name (int type)
-{
-       switch (type) {
-       case SAMPLE_CYCLES: return "cycles";
-       case SAMPLE_INSTRUCTIONS: return "instructions retired";
-       case SAMPLE_CACHE_MISSES: return "cache misses";
-       case SAMPLE_CACHE_REFS: return "cache references";
-       case SAMPLE_BRANCHES: return "executed branches";
-       case SAMPLE_BRANCH_MISSES: return "unpredicted branches";
-       }
-       return "unknown";
-}
-
-static void
-set_usym_parent (UnmanagedSymbol** cachedus, int count)
-{
-       int i;
-       for (i = 0; i < count; ++i) {
-               UnmanagedSymbol *ubin = lookup_unmanaged_binary (cachedus [i]->addr);
-               if (ubin == cachedus [i])
-                       continue;
-               cachedus [i]->parent = ubin;
-       }
-}
-
-static void
-print_usym (UnmanagedSymbol* um)
-{
-       if (um->parent)
-               fprintf (outfile, "\t%6zd %6.2f %-36s in %s\n", um->sample_hits, um->sample_hits*100.0/num_stat_samples, um->name, um->parent->name);
-       else
-               fprintf (outfile, "\t%6zd %6.2f %s\n", um->sample_hits, um->sample_hits*100.0/num_stat_samples, um->name);
-}
-
-static int
-sym_percent (uintptr_t sample_hits)
-{
-       double pc;
-       if (verbose)
-               return 1;
-       pc = sample_hits*100.0/num_stat_samples;
-       return pc >= 0.1;
-}
-
-static void
-dump_samples (void)
-{
-       int i, u;
-       int count = 0, msize = 0;
-       int unmanaged_hits = 0;
-       int unresolved_hits = 0;
-       MethodDesc** cachedm = NULL;
-       int ucount = 0, usize = 0;
-       UnmanagedSymbol** cachedus = NULL;
-       if (!num_stat_samples)
-               return;
-       qsort (usymbols, usymbols_num, sizeof (UnmanagedSymbol*), compare_usymbol_addr);
-       for (i = 0; i < num_stat_samples; ++i) {
-               MethodDesc *m = lookup_method_by_ip (stat_samples [i]);
-               if (m) {
-                       if (!m->sample_hits) {
-                               if (count == msize) {
-                                       msize *= 2;
-                                       if (!msize)
-                                               msize = 4;
-                                       cachedm = (MethodDesc **)realloc (cachedm, sizeof (void*) * msize);
-                               }
-                               cachedm [count++] = m;
-                       }
-                       m->sample_hits++;
-               } else {
-                       UnmanagedSymbol *usym = lookup_unmanaged_symbol (stat_samples [i]);
-                       if (!usym) {
-                               unresolved_hits++;
-                               //printf ("unmanaged hit at %p\n", (void*)stat_samples [i]);
-                               usym = lookup_unmanaged_binary (stat_samples [i]);
-                       }
-                       if (usym) {
-                               if (!usym->sample_hits) {
-                                       if (ucount == usize) {
-                                               usize *= 2;
-                                               if (!usize)
-                                                       usize = 4;
-                                               cachedus = (UnmanagedSymbol **)realloc (cachedus, sizeof (void*) * usize);
-                                       }
-                                       cachedus [ucount++] = usym;
-                               }
-                               usym->sample_hits++;
-                       }
-                       unmanaged_hits++;
-               }
-       }
-       qsort (cachedm, count, sizeof (MethodDesc*), compare_method_samples);
-       qsort (cachedus, ucount, sizeof (UnmanagedSymbol*), compare_usymbol_samples);
-       set_usym_parent (cachedus, ucount);
-       fprintf (outfile, "\nStatistical samples summary\n");
-       fprintf (outfile, "\tSample type: %s\n", sample_type_name (stat_sample_desc [0]));
-       fprintf (outfile, "\tUnmanaged hits:  %6d (%4.1f%%)\n", unmanaged_hits, (100.0*unmanaged_hits)/num_stat_samples);
-       fprintf (outfile, "\tManaged hits:    %6d (%4.1f%%)\n", num_stat_samples - unmanaged_hits, (100.0*(num_stat_samples-unmanaged_hits))/num_stat_samples);
-       fprintf (outfile, "\tUnresolved hits: %6d (%4.1f%%)\n", unresolved_hits, (100.0*unresolved_hits)/num_stat_samples);
-       fprintf (outfile, "\t%6s %6s %s\n", "Hits", "%", "Method name");
-       i = 0;
-       u = 0;
-       while (i < count || u < ucount) {
-               if (i < count) {
-                       MethodDesc *m = cachedm [i];
-                       if (u < ucount) {
-                               UnmanagedSymbol *um = cachedus [u];
-                               if (um->sample_hits > m->sample_hits) {
-                                       if (!sym_percent (um->sample_hits))
-                                               break;
-                                       print_usym (um);
-                                       u++;
-                                       continue;
-                               }
-                       }
-                       if (!sym_percent (m->sample_hits))
-                               break;
-                       fprintf (outfile, "\t%6d %6.2f %s\n", m->sample_hits, m->sample_hits*100.0/num_stat_samples, m->name);
-                       i++;
-                       continue;
-               }
-               if (u < ucount) {
-                       UnmanagedSymbol *um = cachedus [u];
-                       if (!sym_percent (um->sample_hits))
-                               break;
-                       print_usym (um);
-                       u++;
-                       continue;
-               }
-       }
-}
-
-typedef struct _HeapClassDesc HeapClassDesc;
-typedef struct {
-       HeapClassDesc *klass;
-       uint64_t count;
-} HeapClassRevRef;
-
-struct _HeapClassDesc {
-       ClassDesc *klass;
-       int64_t count;
-       int64_t total_size;
-       HeapClassRevRef *rev_hash;
-       int rev_hash_size;
-       int rev_count;
-       uintptr_t pinned_references;
-       uintptr_t root_references;
-};
-
-static int
-add_rev_class_hashed (HeapClassRevRef *rev_hash, uintptr_t size, HeapClassDesc *hklass, uint64_t value)
-{
-       uintptr_t i;
-       uintptr_t start_pos;
-       start_pos = (hklass->klass->klass >> 2) % size;
-       assert (start_pos < size);
-       i = start_pos;
-       do {
-               if (rev_hash [i].klass == hklass) {
-                       rev_hash [i].count += value;
-                       return 0;
-               } else if (!rev_hash [i].klass) {
-                       rev_hash [i].klass = hklass;
-                       rev_hash [i].count += value;
-                       start_pos = 0;
-                       for (i = 0; i < size; ++i)
-                               if (rev_hash [i].klass && rev_hash [i].klass->klass == hklass->klass)
-                                       start_pos ++;
-                       assert (start_pos == 1);
-                       return 1;
-               }
-               /* wrap around */
-               if (++i == size)
-                       i = 0;
-       } while (i != start_pos);
-       /* should not happen */
-       printf ("failed revref store\n");
-       return 0;
-}
-
-static void
-add_heap_class_rev (HeapClassDesc *from, HeapClassDesc *to)
-{
-       uintptr_t i;
-       if (to->rev_count * 2 >= to->rev_hash_size) {
-               HeapClassRevRef *n;
-               uintptr_t old_size = to->rev_hash_size;
-               to->rev_hash_size *= 2;
-               if (to->rev_hash_size == 0)
-                       to->rev_hash_size = 4;
-               n = (HeapClassRevRef *)calloc (sizeof (HeapClassRevRef) * to->rev_hash_size, 1);
-               for (i = 0; i < old_size; ++i) {
-                       if (to->rev_hash [i].klass)
-                               add_rev_class_hashed (n, to->rev_hash_size, to->rev_hash [i].klass, to->rev_hash [i].count);
-               }
-               if (to->rev_hash)
-                       free (to->rev_hash);
-               to->rev_hash = n;
-       }
-       to->rev_count += add_rev_class_hashed (to->rev_hash, to->rev_hash_size, from, 1);
-}
-
-typedef struct {
-       uintptr_t objaddr;
-       HeapClassDesc *hklass;
-       uintptr_t num_refs;
-       uintptr_t refs [0];
-} HeapObjectDesc;
-
-typedef struct _HeapShot HeapShot;
-struct _HeapShot {
-       HeapShot *next;
-       uint64_t timestamp;
-       int class_count;
-       int hash_size;
-       HeapClassDesc **class_hash;
-       HeapClassDesc **sorted;
-       HeapObjectDesc **objects_hash;
-       uintptr_t objects_count;
-       uintptr_t objects_hash_size;
-       uintptr_t num_roots;
-       uintptr_t *roots;
-       uintptr_t *roots_extra;
-       int *roots_types;
-};
-
-static HeapShot *heap_shots = NULL;
-static int num_heap_shots = 0;
-
-static HeapShot*
-new_heap_shot (uint64_t timestamp)
-{
-       HeapShot *hs = (HeapShot *)calloc (sizeof (HeapShot), 1);
-       hs->hash_size = 4;
-       hs->class_hash = (HeapClassDesc **)calloc (sizeof (void*), hs->hash_size);
-       hs->timestamp = timestamp;
-       num_heap_shots++;
-       hs->next = heap_shots;
-       heap_shots = hs;
-       return hs;
-}
-
-static HeapClassDesc*
-heap_class_lookup (HeapShot *hs, ClassDesc *klass)
-{
-       int i;
-       unsigned int start_pos;
-       start_pos = ((uintptr_t)klass->klass >> 2) % hs->hash_size;
-       i = start_pos;
-       do {
-               HeapClassDesc* cd = hs->class_hash [i];
-               if (!cd)
-                       return NULL;
-               if (cd->klass == klass)
-                       return cd;
-               /* wrap around */
-               if (++i == hs->hash_size)
-                       i = 0;
-       } while (i != start_pos);
-       return NULL;
-}
-
-static int
-add_heap_hashed (HeapClassDesc **hash, HeapClassDesc **retv, uintptr_t hsize, ClassDesc *klass, uint64_t size, uint64_t count)
-{
-       uintptr_t i;
-       uintptr_t start_pos;
-       start_pos = ((uintptr_t)klass->klass >> 2) % hsize;
-       i = start_pos;
-       do {
-               if (hash [i] && hash [i]->klass == klass) {
-                       hash [i]->total_size += size;
-                       hash [i]->count += count;
-                       *retv = hash [i];
-                       return 0;
-               } else if (!hash [i]) {
-                       if (*retv) {
-                               hash [i] = *retv;
-                               return 1;
-                       }
-                       hash [i] = (HeapClassDesc *)calloc (sizeof (HeapClassDesc), 1);
-                       hash [i]->klass = klass;
-                       hash [i]->total_size += size;
-                       hash [i]->count += count;
-                       *retv = hash [i];
-                       return 1;
-               }
-               /* wrap around */
-               if (++i == hsize)
-                       i = 0;
-       } while (i != start_pos);
-       /* should not happen */
-       printf ("failed heap class store\n");
-       return 0;
-}
-
-static HeapClassDesc*
-add_heap_shot_class (HeapShot *hs, ClassDesc *klass, uint64_t size)
-{
-       HeapClassDesc *res;
-       int i;
-       if (hs->class_count * 2 >= hs->hash_size) {
-               HeapClassDesc **n;
-               int old_size = hs->hash_size;
-               hs->hash_size *= 2;
-               if (hs->hash_size == 0)
-                       hs->hash_size = 4;
-               n = (HeapClassDesc **)calloc (sizeof (void*) * hs->hash_size, 1);
-               for (i = 0; i < old_size; ++i) {
-                       res = hs->class_hash [i];
-                       if (hs->class_hash [i])
-                               add_heap_hashed (n, &res, hs->hash_size, hs->class_hash [i]->klass, hs->class_hash [i]->total_size, hs->class_hash [i]->count);
-               }
-               if (hs->class_hash)
-                       free (hs->class_hash);
-               hs->class_hash = n;
-       }
-       res = NULL;
-       hs->class_count += add_heap_hashed (hs->class_hash, &res, hs->hash_size, klass, size, 1);
-       //if (res->count == 1)
-       //      printf ("added heap class: %s\n", res->klass->name);
-       return res;
-}
-
-static HeapObjectDesc*
-alloc_heap_obj (uintptr_t objaddr, HeapClassDesc *hklass, uintptr_t num_refs)
-{
-       HeapObjectDesc* ho = (HeapObjectDesc *)calloc (sizeof (HeapObjectDesc) + num_refs * sizeof (uintptr_t), 1);
-       ho->objaddr = objaddr;
-       ho->hklass = hklass;
-       ho->num_refs = num_refs;
-       return ho;
-}
-
-static uintptr_t
-heap_shot_find_obj_slot (HeapShot *hs, uintptr_t objaddr)
-{
-       uintptr_t i;
-       uintptr_t start_pos;
-       HeapObjectDesc **hash = hs->objects_hash;
-       start_pos = ((uintptr_t)objaddr >> 3) % hs->objects_hash_size;
-       i = start_pos;
-       do {
-               if (hash [i] && hash [i]->objaddr == objaddr) {
-                       return i;
-               } else if (!hash [i]) {
-                       break; /* fail */
-               }
-               /* wrap around */
-               if (++i == hs->objects_hash_size)
-                       i = 0;
-       } while (i != start_pos);
-       /* should not happen */
-       //printf ("failed heap obj slot\n");
-       return -1;
-}
-
-static HeapObjectDesc*
-heap_shot_obj_add_refs (HeapShot *hs, uintptr_t objaddr, uintptr_t num, uintptr_t *ref_offset)
-{
-       HeapObjectDesc **hash = hs->objects_hash;
-       uintptr_t i = heap_shot_find_obj_slot (hs, objaddr);
-       if (i >= 0) {
-               HeapObjectDesc* ho = alloc_heap_obj (objaddr, hash [i]->hklass, hash [i]->num_refs + num);
-               *ref_offset = hash [i]->num_refs;
-               memcpy (ho->refs, hash [i]->refs, hash [i]->num_refs * sizeof (uintptr_t));
-               free (hash [i]);
-               hash [i] = ho;
-               return ho;
-       }
-       /* should not happen */
-       printf ("failed heap obj update\n");
-       return NULL;
-
-}
-
-static uintptr_t
-add_heap_hashed_obj (HeapObjectDesc **hash, uintptr_t hsize, HeapObjectDesc *obj)
-{
-       uintptr_t i;
-       uintptr_t start_pos;
-       start_pos = ((uintptr_t)obj->objaddr >> 3) % hsize;
-       i = start_pos;
-       do {
-               if (hash [i] && hash [i]->objaddr == obj->objaddr) {
-                       printf ("duplicate object!\n");
-                       return 0;
-               } else if (!hash [i]) {
-                       hash [i] = obj;
-                       return 1;
-               }
-               /* wrap around */
-               if (++i == hsize)
-                       i = 0;
-       } while (i != start_pos);
-       /* should not happen */
-       printf ("failed heap obj store\n");
-       return 0;
-}
-
-static void
-add_heap_shot_obj (HeapShot *hs, HeapObjectDesc *obj)
-{
-       uintptr_t i;
-       if (hs->objects_count * 2 >= hs->objects_hash_size) {
-               HeapObjectDesc **n;
-               uintptr_t old_size = hs->objects_hash_size;
-               hs->objects_hash_size *= 2;
-               if (hs->objects_hash_size == 0)
-                       hs->objects_hash_size = 4;
-               n = (HeapObjectDesc **)calloc (sizeof (void*) * hs->objects_hash_size, 1);
-               for (i = 0; i < old_size; ++i) {
-                       if (hs->objects_hash [i])
-                               add_heap_hashed_obj (n, hs->objects_hash_size, hs->objects_hash [i]);
-               }
-               if (hs->objects_hash)
-                       free (hs->objects_hash);
-               hs->objects_hash = n;
-       }
-       hs->objects_count += add_heap_hashed_obj (hs->objects_hash, hs->objects_hash_size, obj);
-}
-
-static void
-heap_shot_resolve_reverse_refs (HeapShot *hs)
-{
-       uintptr_t i;
-       for (i = 0; i < hs->objects_hash_size; ++i) {
-               uintptr_t r;
-               HeapObjectDesc *ho = hs->objects_hash [i];
-               if (!ho)
-                       continue;
-               for (r = 0; r < ho->num_refs; ++r) {
-                       uintptr_t oi = heap_shot_find_obj_slot (hs, ho->refs [r]);
-                       add_heap_class_rev (ho->hklass, hs->objects_hash [oi]->hklass);
-               }
-       }
-}
-
-#define MARK_GRAY 1
-#define MARK_BLACK 2
-
-static void
-heap_shot_mark_objects (HeapShot *hs)
-{
-       uintptr_t i, oi, r;
-       unsigned char *marks;
-       HeapObjectDesc *obj, *ref;
-       int marked_some;
-       uintptr_t num_marked = 0, num_unmarked;
-       for (i = 0; i < hs->num_roots; ++i) {
-               HeapClassDesc *cd;
-               oi = heap_shot_find_obj_slot (hs, hs->roots [i]);
-               if (oi == -1) {
-                       continue;
-               }
-               obj = hs->objects_hash [oi];
-               cd = obj->hklass;
-               if (hs->roots_types [i] & MONO_PROFILE_GC_ROOT_PINNING)
-                       cd->pinned_references++;
-               cd->root_references++;
-       }
-       if (!debug)
-               return;
-       /* consistency checks: it seems not all the objects are walked in the heap in some cases */
-       marks = (unsigned char *)calloc (hs->objects_hash_size, 1);
-       if (!marks)
-               return;
-       for (i = 0; i < hs->num_roots; ++i) {
-               oi = heap_shot_find_obj_slot (hs, hs->roots [i]);
-               if (oi == -1) {
-                       fprintf (outfile, "root type 0x%x for obj %p (%s) not found in heap\n", hs->roots_types [i], (void*)hs->roots [i], lookup_class (hs->roots_extra [i])->name);
-                       continue;
-               }
-               obj = hs->objects_hash [oi];
-               if (!marks [oi]) {
-                       marks [oi] = obj->num_refs? MARK_GRAY: MARK_BLACK;
-                       num_marked++;
-               }
-       }
-       marked_some = 1;
-       while (marked_some) {
-               marked_some = 0;
-               for (i = 0; i < hs->objects_hash_size; ++i) {
-                       if (marks [i] != MARK_GRAY)
-                               continue;
-                       marks [i] = MARK_BLACK;
-                       obj = hs->objects_hash [i];
-                       for (r = 0; r < obj->num_refs; ++r) {
-                               oi = heap_shot_find_obj_slot (hs, obj->refs [r]);
-                               if (oi == -1) {
-                                       fprintf (outfile, "referenced obj %p not found in heap\n", (void*)obj->refs [r]);
-                                       continue;
-                               }
-                               ref = hs->objects_hash [oi];
-                               if (!marks [oi]) {
-                                       marks [oi] = ref->num_refs? MARK_GRAY: MARK_BLACK;
-                               }
-                       }
-                       marked_some++;
-               }
-       }
-
-       num_unmarked = 0;
-       for (i = 0; i < hs->objects_hash_size; ++i) {
-               if (hs->objects_hash [i] && !marks [i]) {
-                       num_unmarked++;
-                       fprintf (outfile, "object %p (%s) unmarked\n", (void*)hs->objects_hash [i], hs->objects_hash [i]->hklass->klass->name);
-               }
-       }
-       fprintf (outfile, "Total unmarked: %zd/%zd\n", num_unmarked, hs->objects_count);
-       free (marks);
-}
-
-static void
-heap_shot_free_objects (HeapShot *hs)
-{
-       uintptr_t i;
-       for (i = 0; i < hs->objects_hash_size; ++i) {
-               HeapObjectDesc *ho = hs->objects_hash [i];
-               if (ho)
-                       free (ho);
-       }
-       if (hs->objects_hash)
-               free (hs->objects_hash);
-       hs->objects_hash = NULL;
-       hs->objects_hash_size = 0;
-       hs->objects_count = 0;
-}
-
-
-struct _BackTrace {
-       BackTrace *next;
-       unsigned int hash;
-       int count;
-       int id;
-       MethodDesc *methods [1];
-};
-
-static BackTrace *backtrace_hash [HASH_SIZE];
-static BackTrace **backtraces = NULL;
-static int num_backtraces = 0;
-static int next_backtrace = 0;
-
-static int
-hash_backtrace (int count, MethodDesc **methods)
-{
-       int hash = count;
-       int i;
-       for (i = 0; i < count; ++i) {
-               hash = (hash << 5) - hash + methods [i]->method;
-       }
-       return hash;
-}
-
-static int
-compare_backtrace (BackTrace *bt, int count, MethodDesc **methods)
-{
-       int i;
-       if (bt->count != count)
-               return 0;
-       for (i = 0; i < count; ++i)
-               if (methods [i] != bt->methods [i])
-                       return 0;
-       return 1;
-}
-
-static BackTrace*
-add_backtrace (int count, MethodDesc **methods)
-{
-       int hash = hash_backtrace (count, methods);
-       int slot = (hash & 0xffff) % HASH_SIZE;
-       BackTrace *bt = backtrace_hash [slot];
-       while (bt) {
-               if (bt->hash == hash && compare_backtrace (bt, count, methods))
-                       return bt;
-               bt = bt->next;
-       }
-       bt = (BackTrace *)malloc (sizeof (BackTrace) + ((count - 1) * sizeof (void*)));
-       bt->next = backtrace_hash [slot];
-       backtrace_hash [slot] = bt;
-       if (next_backtrace == num_backtraces) {
-               num_backtraces *= 2;
-               if (!num_backtraces)
-                       num_backtraces = 16;
-               backtraces = (BackTrace **)realloc (backtraces, sizeof (void*) * num_backtraces);
-       }
-       bt->id = next_backtrace++;
-       backtraces [bt->id] = bt;
-       bt->count = count;
-       bt->hash = hash;
-       for (slot = 0; slot < count; ++slot)
-               bt->methods [slot] = methods [slot];
-
-       return bt;
-}
-
-typedef struct _MonitorDesc MonitorDesc;
-typedef struct _ThreadContext ThreadContext;
-typedef struct _DomainContext DomainContext;
-typedef struct _RemCtxContext RemCtxContext;
-
-typedef struct {
-       FILE *file;
-#if defined (HAVE_SYS_ZLIB)
-       gzFile gzfile;
-#endif
-       unsigned char *buf;
-       int size;
-       int data_version;
-       int version_major;
-       int version_minor;
-       int timer_overhead;
-       int pid;
-       int port;
-       uint64_t startup_time;
-       ThreadContext *threads;
-       ThreadContext *current_thread;
-       DomainContext *domains;
-       DomainContext *current_domain;
-       RemCtxContext *remctxs;
-       RemCtxContext *current_remctx;
-} ProfContext;
-
-struct _ThreadContext {
-       ThreadContext *next;
-       intptr_t thread_id;
-       char *name;
-       /* emulated stack */
-       MethodDesc **stack;
-       uint64_t *time_stack;
-       uint64_t *callee_time_stack;
-       uint64_t last_time;
-       uint64_t contention_start;
-       MonitorDesc *monitor;
-       int stack_size;
-       int stack_id;
-       HeapShot *current_heap_shot;
-       uintptr_t num_roots;
-       uintptr_t size_roots;
-       uintptr_t *roots;
-       uintptr_t *roots_extra;
-       int *roots_types;
-       uint64_t gc_start_times [3];
-};
-
-struct _DomainContext {
-       DomainContext *next;
-       intptr_t domain_id;
-       const char *friendly_name;
-};
-
-struct _RemCtxContext {
-       RemCtxContext *next;
-       intptr_t remctx_id;
-       intptr_t domain_id;
-};
-
-static void
-ensure_buffer (ProfContext *ctx, int size)
-{
-       if (ctx->size < size) {
-               ctx->buf = (unsigned char *)realloc (ctx->buf, size);
-               ctx->size = size;
-       }
-}
-
-static int
-load_data (ProfContext *ctx, int size)
-{
-       ensure_buffer (ctx, size);
-#if defined (HAVE_SYS_ZLIB)
-       if (ctx->gzfile) {
-               int r = gzread (ctx->gzfile, ctx->buf, size);
-               if (r == 0)
-                       return size == 0? 1: 0;
-               return r == size;
-       } else
-#endif
-       {
-               int r = fread (ctx->buf, size, 1, ctx->file);
-               if (r == 0)
-                       return size == 0? 1: 0;
-               return r;
-       }
-}
-
-static ThreadContext*
-get_thread (ProfContext *ctx, intptr_t thread_id)
-{
-       ThreadContext *thread;
-       if (ctx->current_thread && ctx->current_thread->thread_id == thread_id)
-               return ctx->current_thread;
-       thread = ctx->threads;
-       while (thread) {
-               if (thread->thread_id == thread_id) {
-                       return thread;
-               }
-               thread = thread->next;
-       }
-       thread = (ThreadContext *)calloc (sizeof (ThreadContext), 1);
-       thread->next = ctx->threads;
-       ctx->threads = thread;
-       thread->thread_id = thread_id;
-       thread->last_time = 0;
-       thread->stack_id = 0;
-       thread->stack_size = 32;
-       thread->stack = (MethodDesc **)malloc (thread->stack_size * sizeof (void*));
-       thread->time_stack = (uint64_t *)malloc (thread->stack_size * sizeof (uint64_t));
-       thread->callee_time_stack = (uint64_t *)malloc (thread->stack_size * sizeof (uint64_t));
-       return thread;
-}
-
-static DomainContext *
-get_domain (ProfContext *ctx, intptr_t domain_id)
-{
-       if (ctx->current_domain && ctx->current_domain->domain_id == domain_id)
-               return ctx->current_domain;
-
-       DomainContext *domain = ctx->domains;
-
-       while (domain) {
-               if (domain->domain_id == domain_id)
-                       return domain;
-
-               domain = domain->next;
-       }
-
-       domain = (DomainContext *)calloc (sizeof (DomainContext), 1);
-       domain->next = ctx->domains;
-       ctx->domains = domain;
-       domain->domain_id = domain_id;
-
-       return domain;
-}
-
-static RemCtxContext *
-get_remctx (ProfContext *ctx, intptr_t remctx_id)
-{
-       if (ctx->current_remctx && ctx->current_remctx->remctx_id == remctx_id)
-               return ctx->current_remctx;
-
-       RemCtxContext *remctx = ctx->remctxs;
-
-       while (remctx) {
-               if (remctx->remctx_id == remctx_id)
-                       return remctx;
-
-               remctx = remctx->next;
-       }
-
-       remctx = (RemCtxContext *)calloc (sizeof (RemCtxContext), 1);
-       remctx->next = ctx->remctxs;
-       ctx->remctxs = remctx;
-       remctx->remctx_id = remctx_id;
-
-       return remctx;
-}
-
-static ThreadContext*
-load_thread (ProfContext *ctx, intptr_t thread_id)
-{
-       ThreadContext *thread = get_thread (ctx, thread_id);
-       ctx->current_thread = thread;
-       return thread;
-}
-
-static void
-ensure_thread_stack (ThreadContext *thread)
-{
-       if (thread->stack_id == thread->stack_size) {
-               thread->stack_size *= 2;
-               thread->stack = (MethodDesc **)realloc (thread->stack, thread->stack_size * sizeof (void*));
-               thread->time_stack = (uint64_t *)realloc (thread->time_stack, thread->stack_size * sizeof (uint64_t));
-               thread->callee_time_stack = (uint64_t *)realloc (thread->callee_time_stack, thread->stack_size * sizeof (uint64_t));
-       }
-}
-
-static int
-add_trace_hashed (CallContext *traces, int size, BackTrace *bt, uint64_t value)
-{
-       int i;
-       unsigned int start_pos;
-       start_pos = bt->hash % size;
-       i = start_pos;
-       do {
-               if (traces [i].bt == bt) {
-                       traces [i].count += value;
-                       return 0;
-               } else if (!traces [i].bt) {
-                       traces [i].bt = bt;
-                       traces [i].count += value;
-                       return 1;
-               }
-               /* wrap around */
-               if (++i == size)
-                       i = 0;
-       } while (i != start_pos);
-       /* should not happen */
-       printf ("failed trace store\n");
-       return 0;
-}
-
-static void
-add_trace_bt (BackTrace *bt, TraceDesc *trace, uint64_t value)
-{
-       int i;
-       if (!collect_traces)
-               return;
-       if (trace->count * 2 >= trace->size) {
-               CallContext *n;
-               int old_size = trace->size;
-               trace->size *= 2;
-               if (trace->size == 0)
-                       trace->size = 4;
-               n = (CallContext *)calloc (sizeof (CallContext) * trace->size, 1);
-               for (i = 0; i < old_size; ++i) {
-                       if (trace->traces [i].bt)
-                               add_trace_hashed (n, trace->size, trace->traces [i].bt, trace->traces [i].count);
-               }
-               if (trace->traces)
-                       free (trace->traces);
-               trace->traces = n;
-       }
-       trace->count += add_trace_hashed (trace->traces, trace->size, bt, value);
-}
-
-static BackTrace*
-add_trace_thread (ThreadContext *thread, TraceDesc *trace, uint64_t value)
-{
-       BackTrace *bt;
-       int count = thread->stack_id;
-       if (!collect_traces)
-               return NULL;
-       if (count > trace_max)
-               count = trace_max;
-       bt = add_backtrace (count, thread->stack + thread->stack_id - count);
-       add_trace_bt (bt, trace, value);
-       return bt;
-}
-
-static BackTrace*
-add_trace_methods (MethodDesc **methods, int count, TraceDesc *trace, uint64_t value)
-{
-       BackTrace *bt;
-       if (!collect_traces)
-               return NULL;
-       if (count > trace_max)
-               count = trace_max;
-       bt = add_backtrace (count, methods);
-       add_trace_bt (bt, trace, value);
-       return bt;
-}
-
-static void
-thread_add_root (ThreadContext *ctx, uintptr_t obj, int root_type, uintptr_t extra_info)
-{
-       if (ctx->num_roots == ctx->size_roots) {
-               int new_size = ctx->size_roots * 2;
-               if (!new_size)
-                       new_size = 4;
-               ctx->roots = (uintptr_t *)realloc (ctx->roots, new_size * sizeof (uintptr_t));
-               ctx->roots_extra = (uintptr_t *)realloc (ctx->roots_extra, new_size * sizeof (uintptr_t));
-               ctx->roots_types = (int *)realloc (ctx->roots_types, new_size * sizeof (int));
-               ctx->size_roots = new_size;
-       }
-       ctx->roots_types [ctx->num_roots] = root_type;
-       ctx->roots_extra [ctx->num_roots] = extra_info;
-       ctx->roots [ctx->num_roots++] = obj;
-}
-
-static int
-compare_callc (const void *a, const void *b)
-{
-       const CallContext *A = (const CallContext *)a;
-       const CallContext *B = (const CallContext *)b;
-       if (B->count == A->count)
-               return 0;
-       if (B->count < A->count)
-               return -1;
-       return 1;
-}
-
-static void
-sort_context_array (TraceDesc* traces)
-{
-       int i, j;
-       for (i = 0, j = 0; i < traces->size; ++i) {
-               if (traces->traces [i].bt) {
-                       traces->traces [j].bt = traces->traces [i].bt;
-                       traces->traces [j].count = traces->traces [i].count;
-                       j++;
-               }
-       }
-       qsort (traces->traces, traces->count, sizeof (CallContext), compare_callc);
-}
-
-static void
-push_method (ThreadContext *thread, MethodDesc *method, uint64_t timestamp)
-{
-       ensure_thread_stack (thread);
-       thread->time_stack [thread->stack_id] = timestamp;
-       thread->callee_time_stack [thread->stack_id] = 0;
-       thread->stack [thread->stack_id++] = method;
-       method->recurse_count++;
-}
-
-static void
-pop_method (ThreadContext *thread, MethodDesc *method, uint64_t timestamp)
-{
-       method->recurse_count--;
-       if (thread->stack_id > 0 && thread->stack [thread->stack_id - 1] == method) {
-               uint64_t tdiff;
-               thread->stack_id--;
-               method->calls++;
-               if (timestamp < thread->time_stack [thread->stack_id])
-                       fprintf (outfile, "time went backwards for %s\n", method->name);
-               tdiff = timestamp - thread->time_stack [thread->stack_id];
-               if (thread->callee_time_stack [thread->stack_id] > tdiff)
-                       fprintf (outfile, "callee time bigger for %s\n", method->name);
-               method->self_time += tdiff - thread->callee_time_stack [thread->stack_id];
-               method->callee_time += thread->callee_time_stack [thread->stack_id];
-               if (thread->stack_id)
-                       thread->callee_time_stack [thread->stack_id - 1] += tdiff;
-               //fprintf (outfile, "method %s took %d\n", method->name, (int)(tdiff/1000));
-       } else {
-               fprintf (outfile, "unmatched leave at stack pos: %d for method %s\n", thread->stack_id, method->name);
-       }
-}
-
-typedef struct {
-       uint64_t total_time;
-       uint64_t max_time;
-       int count;
-} GCDesc;
-static GCDesc gc_info [3];
-static uint64_t max_heap_size;
-static uint64_t gc_object_moves;
-static int gc_resizes;
-typedef struct {
-       uint64_t created;
-       uint64_t destroyed;
-       uint64_t live;
-       uint64_t max_live;
-       TraceDesc traces;
-       TraceDesc destroy_traces;
-} HandleInfo;
-static HandleInfo handle_info [4];
-
-static const char*
-gc_event_name (int ev)
-{
-       switch (ev) {
-       case MONO_GC_EVENT_START: return "start";
-       case MONO_GC_EVENT_MARK_START: return "mark start";
-       case MONO_GC_EVENT_MARK_END: return "mark end";
-       case MONO_GC_EVENT_RECLAIM_START: return "reclaim start";
-       case MONO_GC_EVENT_RECLAIM_END: return "reclaim end";
-       case MONO_GC_EVENT_END: return "end";
-       case MONO_GC_EVENT_PRE_STOP_WORLD: return "pre stop";
-       case MONO_GC_EVENT_POST_STOP_WORLD: return "post stop";
-       case MONO_GC_EVENT_PRE_START_WORLD: return "pre start";
-       case MONO_GC_EVENT_POST_START_WORLD: return "post start";
-       default:
-               return "unknown";
-       }
-}
-
-static uint64_t clause_summary [MONO_EXCEPTION_CLAUSE_FAULT + 1];
-static uint64_t throw_count = 0;
-static TraceDesc exc_traces;
-
-static const char*
-clause_name (int type)
-{
-       switch (type) {
-       case MONO_EXCEPTION_CLAUSE_NONE: return "catch";
-       case MONO_EXCEPTION_CLAUSE_FILTER: return "filter";
-       case MONO_EXCEPTION_CLAUSE_FINALLY: return "finally";
-       case MONO_EXCEPTION_CLAUSE_FAULT: return "fault";
-       default: return "invalid";
-       }
-}
-
-static uint64_t monitor_contention;
-static uint64_t monitor_failed;
-static uint64_t monitor_acquired;
-
-struct _MonitorDesc {
-       MonitorDesc *next;
-       uintptr_t objid;
-       uintptr_t contentions;
-       uint64_t wait_time;
-       uint64_t max_wait_time;
-       TraceDesc traces;
-};
-
-static MonitorDesc* monitor_hash [SMALL_HASH_SIZE] = {0};
-static int num_monitors = 0;
-
-static MonitorDesc*
-lookup_monitor (uintptr_t objid)
-{
-       int slot = ((objid >> 3) & 0xffff) % SMALL_HASH_SIZE;
-       MonitorDesc *cd = monitor_hash [slot];
-       while (cd && cd->objid != objid)
-               cd = cd->next;
-       if (!cd) {
-               cd = (MonitorDesc *)calloc (sizeof (MonitorDesc), 1);
-               cd->objid = objid;
-               cd->next = monitor_hash [slot];
-               monitor_hash [slot] = cd;
-               num_monitors++;
-       }
-       return cd;
-}
-
-static const char*
-monitor_ev_name (int ev)
-{
-       switch (ev) {
-       case MONO_PROFILER_MONITOR_CONTENTION: return "contended";
-       case MONO_PROFILER_MONITOR_DONE: return "acquired";
-       case MONO_PROFILER_MONITOR_FAIL: return "not taken";
-       default: return "invalid";
-       }
-}
-
-static const char*
-get_handle_name (int htype)
-{
-       switch (htype) {
-       case 0: return "weak";
-       case 1: return "weaktrack";
-       case 2: return "normal";
-       case 3: return "pinned";
-       default: return "unknown";
-       }
-}
-
-static const char*
-get_root_name (int rtype)
-{
-       switch (rtype & MONO_PROFILE_GC_ROOT_TYPEMASK) {
-       case MONO_PROFILE_GC_ROOT_STACK: return "stack";
-       case MONO_PROFILE_GC_ROOT_FINALIZER: return "finalizer";
-       case MONO_PROFILE_GC_ROOT_HANDLE: return "handle";
-       case MONO_PROFILE_GC_ROOT_OTHER: return "other";
-       case MONO_PROFILE_GC_ROOT_MISC: return "misc";
-       default: return "unknown";
-       }
-}
-
-static MethodDesc**
-decode_bt (MethodDesc** sframes, int *size, unsigned char *p, unsigned char **endp, intptr_t ptr_base)
-{
-       MethodDesc **frames;
-       int i;
-       int flags = decode_uleb128 (p, &p);
-       int count = decode_uleb128 (p, &p);
-       if (flags != 0)
-               return NULL;
-       if (count > *size)
-               frames = (MethodDesc **)malloc (count * sizeof (void*));
-       else
-               frames = sframes;
-       for (i = 0; i < count; ++i) {
-               intptr_t ptrdiff = decode_sleb128 (p, &p);
-               frames [i] = lookup_method (ptr_base + ptrdiff);
-       }
-       *size = count;
-       *endp = p;
-       return frames;
-}
-
-static void
-tracked_creation (uintptr_t obj, ClassDesc *cd, uint64_t size, BackTrace *bt, uint64_t timestamp)
-{
-       int i;
-       for (i = 0; i < num_tracked_objects; ++i) {
-               if (tracked_objects [i] != obj)
-                       continue;
-               fprintf (outfile, "Object %p created (%s, %llu bytes) at %.3f secs.\n", (void*)obj, cd->name, (unsigned long long) size, (timestamp - startup_time)/1000000000.0);
-               if (bt && bt->count) {
-                       int k;
-                       for (k = 0; k < bt->count; ++k)
-                               fprintf (outfile, "\t%s\n", bt->methods [k]->name);
-               }
-       }
-}
-
-static void
-track_handle (uintptr_t obj, int htype, uint32_t handle, BackTrace *bt, uint64_t timestamp)
-{
-       int i;
-       for (i = 0; i < num_tracked_objects; ++i) {
-               if (tracked_objects [i] != obj)
-                       continue;
-               fprintf (outfile, "Object %p referenced from handle %u at %.3f secs.\n", (void*)obj, handle, (timestamp - startup_time) / 1000000000.0);
-               if (bt && bt->count) {
-                       int k;
-                       for (k = 0; k < bt->count; ++k)
-                               fprintf (outfile, "\t%s\n", bt->methods [k]->name);
-               }
-       }
-}
-
-static void
-track_move (uintptr_t src, uintptr_t dst)
-{
-       int i;
-       for (i = 0; i < num_tracked_objects; ++i) {
-               if (tracked_objects [i] == src)
-                       fprintf (outfile, "Object %p moved to %p\n", (void*)src, (void*)dst);
-               else if (tracked_objects [i] == dst)
-                       fprintf (outfile, "Object %p moved from %p\n", (void*)dst, (void*)src);
-       }
-}
-
-static void
-track_obj_reference (uintptr_t obj, uintptr_t parent, ClassDesc *cd)
-{
-       int i;
-       for (i = 0; i < num_tracked_objects; ++i) {
-               if (tracked_objects [i] == obj)
-                       fprintf (outfile, "Object %p referenced from %p (%s).\n", (void*)obj, (void*)parent, cd->name);
-       }
-}
-
-static void
-found_object (uintptr_t obj)
-{
-       num_tracked_objects ++;
-       tracked_objects = (uintptr_t *)realloc (tracked_objects, num_tracked_objects * sizeof (tracked_objects [0]));
-       tracked_objects [num_tracked_objects - 1] = obj;
-}
-
-static int num_jit_helpers = 0;
-static int jit_helpers_code_size = 0;
-
-static const char*
-code_buffer_desc (int type)
-{
-       switch (type) {
-       case MONO_PROFILER_CODE_BUFFER_METHOD:
-               return "method";
-       case MONO_PROFILER_CODE_BUFFER_METHOD_TRAMPOLINE:
-               return "method trampoline";
-       case MONO_PROFILER_CODE_BUFFER_UNBOX_TRAMPOLINE:
-               return "unbox trampoline";
-       case MONO_PROFILER_CODE_BUFFER_IMT_TRAMPOLINE:
-               return "imt trampoline";
-       case MONO_PROFILER_CODE_BUFFER_GENERICS_TRAMPOLINE:
-               return "generics trampoline";
-       case MONO_PROFILER_CODE_BUFFER_SPECIFIC_TRAMPOLINE:
-               return "specific trampoline";
-       case MONO_PROFILER_CODE_BUFFER_HELPER:
-               return "misc helper";
-       case MONO_PROFILER_CODE_BUFFER_MONITOR:
-               return "monitor/lock";
-       case MONO_PROFILER_CODE_BUFFER_DELEGATE_INVOKE:
-               return "delegate invoke";
-       case MONO_PROFILER_CODE_BUFFER_EXCEPTION_HANDLING:
-               return "exception handling";
-       default:
-               return "unspecified";
-       }
-}
-
-typedef struct _CoverageAssembly CoverageAssembly;
-struct _CoverageAssembly {
-       char *name;
-       char *guid;
-       char *filename;
-       int number_of_methods;
-       int fully_covered;
-       int partially_covered;
-};
-
-typedef struct _CoverageClass CoverageClass;
-struct _CoverageClass {
-       char *assembly_name;
-       char *class_name;
-       int number_of_methods;
-       int fully_covered;
-       int partially_covered;
-};
-
-typedef struct _CoverageCoverage CoverageCoverage;
-struct _CoverageCoverage {
-       int method_id;
-       int offset;
-       int count;
-       int line;
-       int column;
-};
-
-typedef struct _CoverageMethod CoverageMethod;
-struct _CoverageMethod {
-       char *assembly_name;
-       char *class_name;
-       char *method_name;
-       char *method_signature;
-       char *filename;
-       int token;
-       int n_statements;
-       int method_id;
-       GPtrArray *coverage;
-};
-static GPtrArray *coverage_assemblies = NULL;
-static GPtrArray *coverage_methods = NULL;
-static GPtrArray *coverage_statements = NULL;
-static GHashTable *coverage_methods_hash = NULL;
-static GPtrArray *coverage_classes = NULL;
-static GHashTable *coverage_assembly_classes = NULL;
-
-static void
-gather_coverage_statements (void)
-{
-       for (guint i = 0; i < coverage_statements->len; i++) {
-               CoverageCoverage *coverage = (CoverageCoverage *)coverage_statements->pdata[i];
-               CoverageMethod *method = (CoverageMethod *)g_hash_table_lookup (coverage_methods_hash, GINT_TO_POINTER (coverage->method_id));
-               if (method == NULL) {
-                       fprintf (outfile, "Cannot find method with ID: %d\n", coverage->method_id);
-                       continue;
-               }
-
-               g_ptr_array_add (method->coverage, coverage);
-       }
-}
-
-static void
-coverage_add_assembly (CoverageAssembly *assembly)
-{
-       if (coverage_assemblies == NULL)
-               coverage_assemblies = g_ptr_array_new ();
-
-       g_ptr_array_add (coverage_assemblies, assembly);
-}
-
-static void
-coverage_add_method (CoverageMethod *method)
-{
-       if (coverage_methods == NULL) {
-               coverage_methods = g_ptr_array_new ();
-               coverage_methods_hash = g_hash_table_new (NULL, NULL);
-       }
-
-       g_ptr_array_add (coverage_methods, method);
-       g_hash_table_insert (coverage_methods_hash, GINT_TO_POINTER (method->method_id), method);
-}
-
-static void
-coverage_add_class (CoverageClass *klass)
-{
-       GPtrArray *classes = NULL;
-
-       if (coverage_classes == NULL) {
-               coverage_classes = g_ptr_array_new ();
-               coverage_assembly_classes = g_hash_table_new (g_str_hash, g_str_equal);
-       }
-
-       g_ptr_array_add (coverage_classes, klass);
-       classes = (GPtrArray *)g_hash_table_lookup (coverage_assembly_classes, klass->assembly_name);
-       if (classes == NULL) {
-               classes = g_ptr_array_new ();
-               g_hash_table_insert (coverage_assembly_classes, klass->assembly_name, classes);
-       }
-       g_ptr_array_add (classes, klass);
-}
-
-static void
-coverage_add_coverage (CoverageCoverage *coverage)
-{
-       if (coverage_statements == NULL)
-               coverage_statements = g_ptr_array_new ();
-
-       g_ptr_array_add (coverage_statements, coverage);
-}
-
-#define OBJ_ADDR(diff) ((obj_base + diff) << 3)
-#define LOG_TIME(base,diff) /*fprintf("outfile, time %llu + %llu near offset %d\n", base, diff, p - ctx->buf)*/
-
-
-/* Stats */
-#define BUFFER_HEADER_SIZE 48
-
-typedef struct {
-       int count, min_size, max_size, bytes;
-} EventStat;
-
-static int buffer_count;
-static EventStat stats [256];
-
-static void
-record_event_stats (int type, int size)
-{
-       ++stats [type].count;
-       if (!stats [type].min_size)
-               stats [type].min_size = size;
-       stats [type].min_size = MIN (stats [type].min_size, size);
-       stats [type].max_size = MAX (stats [type].max_size, size);
-       stats [type].bytes += size;
-}
-
-static int
-decode_buffer (ProfContext *ctx)
-{
-       unsigned char *p;
-       unsigned char *end;
-       intptr_t thread_id;
-       intptr_t ptr_base;
-       intptr_t obj_base;
-       intptr_t method_base;
-       uint64_t time_base;
-       uint64_t file_offset;
-       int len, i;
-       ThreadContext *thread;
-
-#ifdef HAVE_SYS_ZLIB
-       if (ctx->gzfile)
-               file_offset = gztell (ctx->gzfile);
-       else
-#endif
-               file_offset = ftell (ctx->file);
-       if (!load_data (ctx, 48))
-               return 0;
-       p = ctx->buf;
-       if (read_int32 (p) != BUF_ID) {
-               fprintf (outfile, "Incorrect buffer id: 0x%x\n", read_int32 (p));
-               for (i = 0; i < 48; ++i) {
-                       fprintf (outfile, "0x%x%s", p [i], i % 8?" ":"\n");
-               }
-               return 0;
-       }
-       len = read_int32 (p + 4);
-       time_base = read_int64 (p + 8);
-       ptr_base = read_int64 (p + 16);
-       obj_base = read_int64 (p + 24);
-       thread_id = read_int64 (p + 32);
-       method_base = read_int64 (p + 40);
-       if (debug)
-               fprintf (outfile, "buf: thread:%zx, len: %d, time: %llu, file offset: %llu\n", thread_id, len, (unsigned long long) time_base, (unsigned long long) file_offset);
-       thread = load_thread (ctx, thread_id);
-       if (!load_data (ctx, len))
-               return 0;
-
-       ++buffer_count;
-
-       if (!startup_time) {
-               startup_time = time_base;
-               if (use_time_filter) {
-                       time_from += startup_time;
-                       time_to += startup_time;
-               }
-       }
-       for (i = 0; i < thread->stack_id; ++i)
-               thread->stack [i]->recurse_count++;
-       p = ctx->buf;
-       end = p + len;
-       while (p < end) {
-               unsigned char *start = p;
-               unsigned char event = *p;
-               switch (*p & 0xf) {
-               case TYPE_GC: {
-                       int subtype = *p & 0xf0;
-                       uint64_t tdiff = decode_uleb128 (p + 1, &p);
-                       LOG_TIME (time_base, tdiff);
-                       time_base += tdiff;
-                       if (subtype == TYPE_GC_RESIZE) {
-                               uint64_t new_size = decode_uleb128 (p, &p);
-                               if (debug)
-                                       fprintf (outfile, "gc heap resized to %llu\n", (unsigned long long) new_size);
-                               gc_resizes++;
-                               if (new_size > max_heap_size)
-                                       max_heap_size = new_size;
-                       } else if (subtype == TYPE_GC_EVENT) {
-                               uint64_t ev = decode_uleb128 (p, &p);
-                               int gen = decode_uleb128 (p, &p);
-                               if (debug)
-                                       fprintf (outfile, "gc event for gen%d: %s at %llu (thread: 0x%zx)\n", gen, gc_event_name (ev), (unsigned long long) time_base, thread->thread_id);
-                               if (gen > 2) {
-                                       fprintf (outfile, "incorrect gc gen: %d\n", gen);
-                                       break;
-                               }
-                               if (ev == MONO_GC_EVENT_START) {
-                                       thread->gc_start_times [gen] = time_base;
-                                       gc_info [gen].count++;
-                               } else if (ev == MONO_GC_EVENT_END) {
-                                       tdiff = time_base - thread->gc_start_times [gen];
-                                       gc_info [gen].total_time += tdiff;
-                                       if (tdiff > gc_info [gen].max_time)
-                                               gc_info [gen].max_time = tdiff;
-                               }
-                       } else if (subtype == TYPE_GC_MOVE) {
-                               int j, num = decode_uleb128 (p, &p);
-                               gc_object_moves += num / 2;
-                               for (j = 0; j < num; j += 2) {
-                                       intptr_t obj1diff = decode_sleb128 (p, &p);
-                                       intptr_t obj2diff = decode_sleb128 (p, &p);
-                                       if (num_tracked_objects)
-                                               track_move (OBJ_ADDR (obj1diff), OBJ_ADDR (obj2diff));
-                                       if (debug) {
-                                               fprintf (outfile, "moved obj %p to %p\n", (void*)OBJ_ADDR (obj1diff), (void*)OBJ_ADDR (obj2diff));
-                                       }
-                               }
-                       } else if (subtype == TYPE_GC_HANDLE_CREATED || subtype == TYPE_GC_HANDLE_CREATED_BT) {
-                               int has_bt = subtype == TYPE_GC_HANDLE_CREATED_BT;
-                               int num_bt = 0;
-                               MethodDesc *sframes [8];
-                               MethodDesc **frames = sframes;
-                               int htype = decode_uleb128 (p, &p);
-                               uint32_t handle = decode_uleb128 (p, &p);
-                               intptr_t objdiff = decode_sleb128 (p, &p);
-                               if (has_bt) {
-                                       num_bt = 8;
-                                       frames = decode_bt (sframes, &num_bt, p, &p, ptr_base);
-                                       if (!frames) {
-                                               fprintf (outfile, "Cannot load backtrace\n");
-                                               return 0;
-                                       }
-                               }
-                               if (htype > 3)
-                                       return 0;
-                               if ((thread_filter && thread_filter == thread->thread_id) || (time_base >= time_from && time_base < time_to)) {
-                                       handle_info [htype].created++;
-                                       handle_info [htype].live++;
-                                       if (handle_info [htype].live > handle_info [htype].max_live)
-                                               handle_info [htype].max_live = handle_info [htype].live;
-                                       BackTrace *bt;
-                                       if (has_bt)
-                                               bt = add_trace_methods (frames, num_bt, &handle_info [htype].traces, 1);
-                                       else
-                                               bt = add_trace_thread (thread, &handle_info [htype].traces, 1);
-                                       if (num_tracked_objects)
-                                               track_handle (OBJ_ADDR (objdiff), htype, handle, bt, time_base);
-                               }
-                               if (debug)
-                                       fprintf (outfile, "handle (%s) %u created for object %p\n", get_handle_name (htype), handle, (void*)OBJ_ADDR (objdiff));
-                               if (frames != sframes)
-                                       free (frames);
-                       } else if (subtype == TYPE_GC_HANDLE_DESTROYED || subtype == TYPE_GC_HANDLE_DESTROYED_BT) {
-                               int has_bt = subtype == TYPE_GC_HANDLE_DESTROYED_BT;
-                               int num_bt = 0;
-                               MethodDesc *sframes [8];
-                               MethodDesc **frames = sframes;
-                               int htype = decode_uleb128 (p, &p);
-                               uint32_t handle = decode_uleb128 (p, &p);
-                               if (has_bt) {
-                                       num_bt = 8;
-                                       frames = decode_bt (sframes, &num_bt, p, &p, ptr_base);
-                                       if (!frames) {
-                                               fprintf (outfile, "Cannot load backtrace\n");
-                                               return 0;
-                                       }
-                               }
-                               if (htype > 3)
-                                       return 0;
-                               if ((thread_filter && thread_filter == thread->thread_id) || (time_base >= time_from && time_base < time_to)) {
-                                       handle_info [htype].destroyed ++;
-                                       handle_info [htype].live--;
-                                       BackTrace *bt;
-                                       if (has_bt)
-                                               bt = add_trace_methods (frames, num_bt, &handle_info [htype].destroy_traces, 1);
-                                       else
-                                               bt = add_trace_thread (thread, &handle_info [htype].destroy_traces, 1);
-                                       /* TODO: track_handle_free () - would need to record and keep track of the associated object address... */
-                               }
-                               if (debug)
-                                       fprintf (outfile, "handle (%s) %u destroyed\n", get_handle_name (htype), handle);
-                               if (frames != sframes)
-                                       free (frames);
-                       }
-                       break;
-               }
-               case TYPE_METADATA: {
-                       int subtype = *p & 0xf0;
-                       const char *load_str = subtype == TYPE_END_LOAD ? "loaded" : "unloaded";
-                       uint64_t tdiff = decode_uleb128 (p + 1, &p);
-                       int mtype = *p++;
-                       intptr_t ptrdiff = decode_sleb128 (p, &p);
-                       LOG_TIME (time_base, tdiff);
-                       time_base += tdiff;
-                       if (mtype == TYPE_CLASS) {
-                               intptr_t imptrdiff = decode_sleb128 (p, &p);
-                               uint64_t flags = decode_uleb128 (p, &p);
-                               if (flags) {
-                                       fprintf (outfile, "non-zero flags in class\n");
-                                       return 0;
-                               }
-                               if (debug)
-                                       fprintf (outfile, "%s class %p (%s in %p) at %llu\n", load_str, (void*)(ptr_base + ptrdiff), p, (void*)(ptr_base + imptrdiff), (unsigned long long) time_base);
-                               if (subtype == TYPE_END_LOAD)
-                                       add_class (ptr_base + ptrdiff, (char*)p);
-                               while (*p) p++;
-                               p++;
-                       } else if (mtype == TYPE_IMAGE) {
-                               uint64_t flags = decode_uleb128 (p, &p);
-                               if (flags) {
-                                       fprintf (outfile, "non-zero flags in image\n");
-                                       return 0;
-                               }
-                               if (debug)
-                                       fprintf (outfile, "%s image %p (%s) at %llu\n", load_str, (void*)(ptr_base + ptrdiff), p, (unsigned long long) time_base);
-                               if (subtype == TYPE_END_LOAD)
-                                       add_image (ptr_base + ptrdiff, (char*)p);
-                               while (*p) p++;
-                               p++;
-                       } else if (mtype == TYPE_ASSEMBLY) {
-                               uint64_t flags = decode_uleb128 (p, &p);
-                               if (flags) {
-                                       fprintf (outfile, "non-zero flags in assembly\n");
-                                       return 0;
-                               }
-                               if (debug)
-                                       fprintf (outfile, "%s assembly %p (%s) at %llu\n", load_str, (void*)(ptr_base + ptrdiff), p, (unsigned long long) time_base);
-                               if (subtype == TYPE_END_LOAD)
-                                       add_assembly (ptr_base + ptrdiff, (char*)p);
-                               while (*p) p++;
-                               p++;
-                       } else if (mtype == TYPE_DOMAIN) {
-                               uint64_t flags = decode_uleb128 (p, &p);
-                               if (flags) {
-                                       fprintf (outfile, "non-zero flags in domain\n");
-                                       return 0;
-                               }
-                               DomainContext *nd = get_domain (ctx, ptr_base + ptrdiff);
-                               /* no subtype means it's a name event, rather than start/stop */
-                               if (subtype == 0)
-                                       nd->friendly_name = pstrdup ((char *) p);
-                               if (debug) {
-                                       if (subtype == 0)
-                                               fprintf (outfile, "domain %p named at %llu: %s\n", (void *) (ptr_base + ptrdiff), (unsigned long long) time_base, p);
-                                       else
-                                               fprintf (outfile, "%s thread %p at %llu\n", load_str, (void *) (ptr_base + ptrdiff), (unsigned long long) time_base);
-                               }
-                               if (subtype == 0) {
-                                       while (*p) p++;
-                                       p++;
-                               }
-                       } else if (mtype == TYPE_CONTEXT) {
-                               uint64_t flags = decode_uleb128 (p, &p);
-                               if (flags) {
-                                       fprintf (outfile, "non-zero flags in context\n");
-                                       return 0;
-                               }
-                               intptr_t domaindiff = decode_sleb128 (p, &p);
-                               if (debug)
-                                       fprintf (outfile, "%s context %p (%p) at %llu\n", load_str, (void*)(ptr_base + ptrdiff), (void *) (ptr_base + domaindiff), (unsigned long long) time_base);
-                               if (subtype == TYPE_END_LOAD)
-                                       get_remctx (ctx, ptr_base + ptrdiff)->domain_id = ptr_base + domaindiff;
-                       } else if (mtype == TYPE_THREAD) {
-                               uint64_t flags = decode_uleb128 (p, &p);
-                               if (flags) {
-                                       fprintf (outfile, "non-zero flags in thread\n");
-                                       return 0;
-                               }
-                               ThreadContext *nt = get_thread (ctx, ptr_base + ptrdiff);
-                               /* no subtype means it's a name event, rather than start/stop */
-                               if (subtype == 0)
-                                       nt->name = pstrdup ((char*)p);
-                               if (debug) {
-                                       if (subtype == 0)
-                                               fprintf (outfile, "thread %p named at %llu: %s\n", (void*)(ptr_base + ptrdiff), (unsigned long long) time_base, p);
-                                       else
-                                               fprintf (outfile, "%s thread %p at %llu\n", load_str, (void *) (ptr_base + ptrdiff), (unsigned long long) time_base);
-                               }
-                               if (subtype == 0) {
-                                       while (*p) p++;
-                                       p++;
-                               }
-                       }
-                       break;
-               }
-               case TYPE_ALLOC: {
-                       int has_bt = *p & TYPE_ALLOC_BT;
-                       uint64_t tdiff = decode_uleb128 (p + 1, &p);
-                       intptr_t ptrdiff = decode_sleb128 (p, &p);
-                       intptr_t objdiff = decode_sleb128 (p, &p);
-                       uint64_t len;
-                       int num_bt = 0;
-                       MethodDesc* sframes [8];
-                       MethodDesc** frames = sframes;
-                       ClassDesc *cd = lookup_class (ptr_base + ptrdiff);
-                       len = decode_uleb128 (p, &p);
-                       LOG_TIME (time_base, tdiff);
-                       time_base += tdiff;
-                       if (debug)
-                               fprintf (outfile, "alloced object %p, size %llu (%s) at %llu\n", (void*)OBJ_ADDR (objdiff), (unsigned long long) len, lookup_class (ptr_base + ptrdiff)->name, (unsigned long long) time_base);
-                       if (has_bt) {
-                               num_bt = 8;
-                               frames = decode_bt (sframes, &num_bt, p, &p, ptr_base);
-                               if (!frames) {
-                                       fprintf (outfile, "Cannot load backtrace\n");
-                                       return 0;
-                               }
-                       }
-                       if ((thread_filter && thread_filter == thread->thread_id) || (time_base >= time_from && time_base < time_to)) {
-                               BackTrace *bt;
-                               cd->allocs++;
-                               cd->alloc_size += len;
-                               if (has_bt)
-                                       bt = add_trace_methods (frames, num_bt, &cd->traces, len);
-                               else
-                                       bt = add_trace_thread (thread, &cd->traces, len);
-                               if (find_size && len >= find_size) {
-                                       if (!find_name || strstr (cd->name, find_name))
-                                               found_object (OBJ_ADDR (objdiff));
-                               } else if (!find_size && find_name && strstr (cd->name, find_name)) {
-                                       found_object (OBJ_ADDR (objdiff));
-                               }
-                               if (num_tracked_objects)
-                                       tracked_creation (OBJ_ADDR (objdiff), cd, len, bt, time_base);
-                       }
-                       if (frames != sframes)
-                               free (frames);
-                       break;
-               }
-               case TYPE_METHOD: {
-                       int subtype = *p & 0xf0;
-                       uint64_t tdiff = decode_uleb128 (p + 1, &p);
-                       int64_t ptrdiff = decode_sleb128 (p, &p);
-                       LOG_TIME (time_base, tdiff);
-                       time_base += tdiff;
-                       method_base += ptrdiff;
-                       if (subtype == TYPE_JIT) {
-                               intptr_t codediff = decode_sleb128 (p, &p);
-                               int codelen = decode_uleb128 (p, &p);
-                               MethodDesc *jitted_method;
-                               if (debug)
-                                       fprintf (outfile, "jitted method %p (%s), size: %d, code: %p\n", (void*)(method_base), p, codelen, (void*)(ptr_base + codediff));
-                               jitted_method = add_method (method_base, (char*)p, ptr_base + codediff, codelen);
-                               if (!(time_base >= time_from && time_base < time_to))
-                                       jitted_method->ignore_jit = 1;
-                               while (*p) p++;
-                               p++;
-                       } else {
-                               MethodDesc *method;
-                               if ((thread_filter && thread_filter != thread->thread_id))
-                                       break;
-                               if (!(time_base >= time_from && time_base < time_to))
-                                       break;
-                               method = lookup_method (method_base);
-                               if (subtype == TYPE_ENTER) {
-                                       add_trace_thread (thread, &method->traces, 1);
-                                       push_method (thread, method, time_base);
-                               } else {
-                                       pop_method (thread, method, time_base);
-                               }
-                               if (debug)
-                                       fprintf (outfile, "%s method %s\n", subtype == TYPE_ENTER? "enter": subtype == TYPE_EXC_LEAVE? "exleave": "leave", method->name);
-                       }
-                       break;
-               }
-               case TYPE_HEAP: {
-                       int subtype = *p & 0xf0;
-                       if (subtype == TYPE_HEAP_OBJECT) {
-                               HeapObjectDesc *ho = NULL;
-                               int i;
-                               intptr_t objdiff = decode_sleb128 (p + 1, &p);
-                               intptr_t ptrdiff = decode_sleb128 (p, &p);
-                               uint64_t size = decode_uleb128 (p, &p);
-                               uintptr_t num = decode_uleb128 (p, &p);
-                               uintptr_t ref_offset = 0;
-                               uintptr_t last_obj_offset = 0;
-                               ClassDesc *cd = lookup_class (ptr_base + ptrdiff);
-                               if (size) {
-                                       HeapClassDesc *hcd = add_heap_shot_class (thread->current_heap_shot, cd, size);
-                                       if (collect_traces) {
-                                               ho = alloc_heap_obj (OBJ_ADDR (objdiff), hcd, num);
-                                               add_heap_shot_obj (thread->current_heap_shot, ho);
-                                               ref_offset = 0;
-                                       }
-                               } else {
-                                       if (collect_traces)
-                                               ho = heap_shot_obj_add_refs (thread->current_heap_shot, OBJ_ADDR (objdiff), num, &ref_offset);
-                               }
-                               for (i = 0; i < num; ++i) {
-                                       /* FIXME: use object distance to measure how good
-                                        * the GC is at keeping related objects close
-                                        */
-                                       uintptr_t offset = ctx->data_version > 1? last_obj_offset + decode_uleb128 (p, &p): -1;
-                                       intptr_t obj1diff = decode_sleb128 (p, &p);
-                                       last_obj_offset = offset;
-                                       if (collect_traces)
-                                               ho->refs [ref_offset + i] = OBJ_ADDR (obj1diff);
-                                       if (num_tracked_objects)
-                                               track_obj_reference (OBJ_ADDR (obj1diff), OBJ_ADDR (objdiff), cd);
-                               }
-                               if (debug && size)
-                                       fprintf (outfile, "traced object %p, size %llu (%s), refs: %zd\n", (void*)OBJ_ADDR (objdiff), (unsigned long long) size, cd->name, num);
-                       } else if (subtype == TYPE_HEAP_ROOT) {
-                               uintptr_t num = decode_uleb128 (p + 1, &p);
-                               uintptr_t gc_num G_GNUC_UNUSED = decode_uleb128 (p, &p);
-                               int i;
-                               for (i = 0; i < num; ++i) {
-                                       intptr_t objdiff = decode_sleb128 (p, &p);
-                                       int root_type = decode_uleb128 (p, &p);
-                                       /* we just discard the extra info for now */
-                                       uintptr_t extra_info = decode_uleb128 (p, &p);
-                                       if (debug)
-                                               fprintf (outfile, "object %p is a %s root\n", (void*)OBJ_ADDR (objdiff), get_root_name (root_type));
-                                       if (collect_traces)
-                                               thread_add_root (thread, OBJ_ADDR (objdiff), root_type, extra_info);
-                               }
-                       } else if (subtype == TYPE_HEAP_END) {
-                               uint64_t tdiff = decode_uleb128 (p + 1, &p);
-                               LOG_TIME (time_base, tdiff);
-                               time_base += tdiff;
-                               if (debug)
-                                       fprintf (outfile, "heap shot end\n");
-                               if (collect_traces) {
-                                       HeapShot *hs = thread->current_heap_shot;
-                                       if (hs && thread->num_roots) {
-                                               /* transfer the root ownershipt to the heapshot */
-                                               hs->num_roots = thread->num_roots;
-                                               hs->roots = thread->roots;
-                                               hs->roots_extra = thread->roots_extra;
-                                               hs->roots_types = thread->roots_types;
-                                       } else {
-                                               free (thread->roots);
-                                               free (thread->roots_extra);
-                                               free (thread->roots_types);
-                                       }
-                                       thread->num_roots = 0;
-                                       thread->size_roots = 0;
-                                       thread->roots = NULL;
-                                       thread->roots_extra = NULL;
-                                       thread->roots_types = NULL;
-                                       heap_shot_resolve_reverse_refs (hs);
-                                       heap_shot_mark_objects (hs);
-                                       heap_shot_free_objects (hs);
-                               }
-                               thread->current_heap_shot = NULL;
-                       } else if (subtype == TYPE_HEAP_START) {
-                               uint64_t tdiff = decode_uleb128 (p + 1, &p);
-                               LOG_TIME (time_base, tdiff);
-                               time_base += tdiff;
-                               if (debug)
-                                       fprintf (outfile, "heap shot start\n");
-                               thread->current_heap_shot = new_heap_shot (time_base);
-                       }
-                       break;
-               }
-               case TYPE_MONITOR: {
-                       int event = (*p >> 4) & 0x3;
-                       int has_bt = *p & TYPE_MONITOR_BT;
-                       uint64_t tdiff = decode_uleb128 (p + 1, &p);
-                       intptr_t objdiff = decode_sleb128 (p, &p);
-                       MethodDesc* sframes [8];
-                       MethodDesc** frames = sframes;
-                       int record;
-                       int num_bt = 0;
-                       LOG_TIME (time_base, tdiff);
-                       time_base += tdiff;
-                       record = (!thread_filter || thread_filter == thread->thread_id);
-                       if (!(time_base >= time_from && time_base < time_to))
-                               record = 0;
-                       if (event == MONO_PROFILER_MONITOR_CONTENTION) {
-                               MonitorDesc *mdesc = lookup_monitor (OBJ_ADDR (objdiff));
-                               if (record) {
-                                       monitor_contention++;
-                                       mdesc->contentions++;
-                                       thread->monitor = mdesc;
-                                       thread->contention_start = time_base;
-                               }
-                               if (has_bt) {
-                                       num_bt = 8;
-                                       frames = decode_bt (sframes, &num_bt, p, &p, ptr_base);
-                                       if (!frames) {
-                                               fprintf (outfile, "Cannot load backtrace\n");
-                                               return 0;
-                                       }
-                                       if (record)
-                                               add_trace_methods (frames, num_bt, &mdesc->traces, 1);
-                               } else {
-                                       if (record)
-                                               add_trace_thread (thread, &mdesc->traces, 1);
-                               }
-                       } else if (event == MONO_PROFILER_MONITOR_FAIL) {
-                               if (record) {
-                                       monitor_failed++;
-                                       if (thread->monitor && thread->contention_start) {
-                                               uint64_t wait_time = time_base - thread->contention_start;
-                                               if (wait_time > thread->monitor->max_wait_time)
-                                                       thread->monitor->max_wait_time = wait_time;
-                                               thread->monitor->wait_time += wait_time;
-                                               thread->monitor = NULL;
-                                               thread->contention_start = 0;
-                                       }
-                               }
-                       } else if (event == MONO_PROFILER_MONITOR_DONE) {
-                               if (record) {
-                                       monitor_acquired++;
-                                       if (thread->monitor && thread->contention_start) {
-                                               uint64_t wait_time = time_base - thread->contention_start;
-                                               if (wait_time > thread->monitor->max_wait_time)
-                                                       thread->monitor->max_wait_time = wait_time;
-                                               thread->monitor->wait_time += wait_time;
-                                               thread->monitor = NULL;
-                                               thread->contention_start = 0;
-                                       }
-                               }
-                       }
-                       if (debug)
-                               fprintf (outfile, "monitor %s for object %p\n", monitor_ev_name (event), (void*)OBJ_ADDR (objdiff));
-                       if (frames != sframes)
-                               free (frames);
-                       break;
-               }
-               case TYPE_EXCEPTION: {
-                       int subtype = *p & 0x70;
-                       int has_bt = *p & TYPE_EXCEPTION_BT;
-                       uint64_t tdiff = decode_uleb128 (p + 1, &p);
-                       MethodDesc* sframes [8];
-                       MethodDesc** frames = sframes;
-                       int record;
-                       LOG_TIME (time_base, tdiff);
-                       time_base += tdiff;
-                       record = (!thread_filter || thread_filter == thread->thread_id);
-                       if (!(time_base >= time_from && time_base < time_to))
-                               record = 0;
-                       if (subtype == TYPE_CLAUSE) {
-                               int clause_type = decode_uleb128 (p, &p);
-                               int clause_num = decode_uleb128 (p, &p);
-                               int64_t ptrdiff = decode_sleb128 (p, &p);
-                               method_base += ptrdiff;
-                               if (record)
-                                       clause_summary [clause_type]++;
-                               if (debug)
-                                       fprintf (outfile, "clause %s (%d) in method %s\n", clause_name (clause_type), clause_num, lookup_method (method_base)->name);
-                       } else {
-                               intptr_t objdiff = decode_sleb128 (p, &p);
-                               if (record)
-                                       throw_count++;
-                               if (has_bt) {
-                                       has_bt = 8;
-                                       frames = decode_bt (sframes, &has_bt, p, &p, ptr_base);
-                                       if (!frames) {
-                                               fprintf (outfile, "Cannot load backtrace\n");
-                                               return 0;
-                                       }
-                                       if (record)
-                                               add_trace_methods (frames, has_bt, &exc_traces, 1);
-                               } else {
-                                       if (record)
-                                               add_trace_thread (thread, &exc_traces, 1);
-                               }
-                               if (frames != sframes)
-                                       free (frames);
-                               if (debug)
-                                       fprintf (outfile, "throw %p\n", (void*)OBJ_ADDR (objdiff));
-                       }
-                       break;
-               }
-               case TYPE_RUNTIME: {
-                       int subtype = *p & 0xf0;
-                       uint64_t tdiff = decode_uleb128 (p + 1, &p);
-                       LOG_TIME (time_base, tdiff);
-                       time_base += tdiff;
-                       if (subtype == TYPE_JITHELPER) {
-                               int type = decode_uleb128 (p, &p);
-                               intptr_t codediff = decode_sleb128 (p, &p);
-                               int codelen = decode_uleb128 (p, &p);
-                               const char *name;
-                               if (type == MONO_PROFILER_CODE_BUFFER_SPECIFIC_TRAMPOLINE) {
-                                       name = (const char *)p;
-                                       while (*p) p++;
-                                               p++;
-                               } else {
-                                       name = code_buffer_desc (type);
-                               }
-                               num_jit_helpers++;
-                               jit_helpers_code_size += codelen;
-                               if (debug)
-                                       fprintf (outfile, "jit helper %s, size: %d, code: %p\n", name, codelen, (void*)(ptr_base + codediff));
-                       }
-                       break;
-               }
-               case TYPE_SAMPLE: {
-                       int subtype = *p & 0xf0;
-                       if (subtype == TYPE_SAMPLE_HIT) {
-                               int i;
-                               int sample_type = decode_uleb128 (p + 1, &p);
-                               uint64_t tstamp = decode_uleb128 (p, &p);
-                               void *tid = (void *) thread_id;
-                               if (ctx->data_version > 10)
-                                       tid = (void *) (ptr_base + decode_sleb128 (p, &p));
-                               int count = decode_uleb128 (p, &p);
-                               for (i = 0; i < count; ++i) {
-                                       uintptr_t ip = ptr_base + decode_sleb128 (p, &p);
-                                       if ((tstamp >= time_from && tstamp < time_to))
-                                               add_stat_sample (sample_type, ip);
-                                       if (debug)
-                                               fprintf (outfile, "sample hit, type: %d at %p for thread %p\n", sample_type, (void*)ip, tid);
-                               }
-                               if (ctx->data_version > 5) {
-                                       count = decode_uleb128 (p, &p);
-                                       for (i = 0; i < count; ++i) {
-                                               MethodDesc *method;
-                                               int64_t ptrdiff = decode_sleb128 (p, &p);
-                                               int il_offset = decode_sleb128 (p, &p);
-                                               int native_offset = decode_sleb128 (p, &p);
-                                               method_base += ptrdiff;
-                                               method = lookup_method (method_base);
-                                               if (debug)
-                                                       fprintf (outfile, "sample hit bt %d: %s at IL offset %d (native: %d)\n", i, method->name, il_offset, native_offset);
-                                       }
-                               }
-                       } else if (subtype == TYPE_SAMPLE_USYM) {
-                               /* un unmanaged symbol description */
-                               uintptr_t addr = ptr_base + decode_sleb128 (p + 1, &p);
-                               uintptr_t size = decode_uleb128 (p, &p);
-                               char *name;
-                               name = pstrdup ((char*)p);
-                               add_unmanaged_symbol (addr, name, size);
-                               if (debug)
-                                       fprintf (outfile, "unmanaged symbol %s at %p\n", name, (void*)addr);
-                               while (*p) p++;
-                               p++;
-                       } else if (subtype == TYPE_SAMPLE_UBIN) {
-                               /* un unmanaged binary loaded in memory */
-                               uint64_t tdiff = decode_uleb128 (p + 1, &p);
-                               uintptr_t addr = decode_sleb128 (p, &p);
-                               uint64_t offset G_GNUC_UNUSED = decode_uleb128 (p, &p);
-                               uintptr_t size = decode_uleb128 (p, &p);
-                               char *name;
-                               LOG_TIME (time_base, tdiff);
-                               time_base += tdiff;
-                               name = pstrdup ((char*)p);
-                               add_unmanaged_binary (addr, name, size);
-                               if (debug)
-                                       fprintf (outfile, "unmanaged binary %s at %p\n", name, (void*)addr);
-                               while (*p) p++;
-                               p++;
-                       } else if (subtype == TYPE_SAMPLE_COUNTERS_DESC) {
-                               uint64_t i, len = decode_uleb128 (p + 1, &p);
-                               for (i = 0; i < len; i++) {
-                                       uint64_t type, unit, variance, index;
-                                       uint64_t section = decode_uleb128 (p, &p);
-                                       char *section_str, *name;
-                                       if (section != MONO_COUNTER_PERFCOUNTERS) {
-                                               section_str = (char*) section_name (section);
-                                       } else {
-                                               section_str = pstrdup ((char*)p);
-                                               while (*p++);
-                                       }
-                                       name = pstrdup ((char*)p);
-                                       while (*p++);
-                                       type = decode_uleb128 (p, &p);
-                                       unit = decode_uleb128 (p, &p);
-                                       variance = decode_uleb128 (p, &p);
-                                       index = decode_uleb128 (p, &p);
-                                       add_counter (section_str, name, (int)type, (int)unit, (int)variance, (int)index);
-                               }
-                       } else if (subtype == TYPE_SAMPLE_COUNTERS) {
-                               int i;
-                               CounterValue *value, *previous = NULL;
-                               CounterList *list;
-                               uint64_t timestamp = decode_uleb128 (p + 1, &p);
-                               uint64_t time_between = timestamp / 1000 * 1000 * 1000 * 1000 + startup_time;
-                               while (1) {
-                                       uint64_t type, index = decode_uleb128 (p, &p);
-                                       if (index == 0)
-                                               break;
-
-                                       for (list = counters; list; list = list->next) {
-                                               if (list->counter->index == (int)index) {
-                                                       previous = list->counter->values_last;
-                                                       break;
-                                               }
-                                       }
-
-                                       type = decode_uleb128 (p, &p);
-
-                                       value = (CounterValue *)calloc (1, sizeof (CounterValue));
-                                       value->timestamp = timestamp;
-
-                                       switch (type) {
-                                       case MONO_COUNTER_INT:
-#if SIZEOF_VOID_P == 4
-                                       case MONO_COUNTER_WORD:
-#endif
-                                               value->buffer = (unsigned char *)malloc (sizeof (int32_t));
-                                               *(int32_t*)value->buffer = (int32_t)decode_sleb128 (p, &p) + (previous ? (*(int32_t*)previous->buffer) : 0);
-                                               break;
-                                       case MONO_COUNTER_UINT:
-                                               value->buffer = (unsigned char *)malloc (sizeof (uint32_t));
-                                               *(uint32_t*)value->buffer = (uint32_t)decode_uleb128 (p, &p) + (previous ? (*(uint32_t*)previous->buffer) : 0);
-                                               break;
-                                       case MONO_COUNTER_LONG:
-#if SIZEOF_VOID_P == 8
-                                       case MONO_COUNTER_WORD:
-#endif
-                                       case MONO_COUNTER_TIME_INTERVAL:
-                                               value->buffer = (unsigned char *)malloc (sizeof (int64_t));
-                                               *(int64_t*)value->buffer = (int64_t)decode_sleb128 (p, &p) + (previous ? (*(int64_t*)previous->buffer) : 0);
-                                               break;
-                                       case MONO_COUNTER_ULONG:
-                                               value->buffer = (unsigned char *)malloc (sizeof (uint64_t));
-                                               *(uint64_t*)value->buffer = (uint64_t)decode_uleb128 (p, &p) + (previous ? (*(uint64_t*)previous->buffer) : 0);
-                                               break;
-                                       case MONO_COUNTER_DOUBLE:
-                                               value->buffer = (unsigned char *)malloc (sizeof (double));
-#if TARGET_BYTE_ORDER == G_LITTLE_ENDIAN
-                                               for (i = 0; i < sizeof (double); i++)
-#else
-                                               for (i = sizeof (double) - 1; i >= 0; i--)
-#endif
-                                                       value->buffer[i] = *p++;
-                                               break;
-                                       case MONO_COUNTER_STRING:
-                                               if (*p++ == 0) {
-                                                       value->buffer = NULL;
-                                               } else {
-                                                       value->buffer = (unsigned char*) pstrdup ((char*)p);
-                                                       while (*p++);
-                                               }
-                                               break;
-                                       }
-                                       if (time_between >= time_from && time_between <= time_to)
-                                               add_counter_value (index, value);
-                               }
-                       } else {
-                               return 0;
-                       }
-                       break;
-               }
-               case TYPE_COVERAGE:{
-                       int subtype = *p & 0xf0;
-                       switch (subtype) {
-                       case TYPE_COVERAGE_METHOD: {
-                               CoverageMethod *method = g_new0 (CoverageMethod, 1);
-                               const char *assembly, *klass, *name, *sig, *filename;
-                               int token, n_offsets, method_id;
-
-                               p++;
-                               assembly = (const char *)p; while (*p) p++; p++;
-                               klass = (const char *)p; while (*p) p++; p++;
-                               name = (const char *)p; while (*p) p++; p++;
-                               sig = (const char *)p; while (*p) p++; p++;
-                               filename = (const char *)p; while (*p) p++; p++;
-
-                               token = decode_uleb128 (p, &p);
-                               method_id = decode_uleb128 (p, &p);
-                               n_offsets = decode_uleb128 (p, &p);
-
-                               method->assembly_name = g_strdup (assembly);
-                               method->class_name = g_strdup (klass);
-                               method->method_name = g_strdup (name);
-                               method->method_signature = g_strdup (sig);
-                               method->filename = g_strdup (filename);
-                               method->token = token;
-                               method->n_statements = n_offsets;
-                               method->coverage = g_ptr_array_new ();
-                               method->method_id = method_id;
-
-                               coverage_add_method (method);
-
-                               break;
-                       }
-                       case TYPE_COVERAGE_STATEMENT: {
-                               CoverageCoverage *coverage = g_new0 (CoverageCoverage, 1);
-                               int offset, count, line, column, method_id;
-
-                               p++;
-                               method_id = decode_uleb128 (p, &p);
-                               offset = decode_uleb128 (p, &p);
-                               count = decode_uleb128 (p, &p);
-                               line = decode_uleb128 (p, &p);
-                               column = decode_uleb128 (p, &p);
-
-                               coverage->method_id = method_id;
-                               coverage->offset = offset;
-                               coverage->count = count;
-                               coverage->line = line;
-                               coverage->column = column;
-
-                               coverage_add_coverage (coverage);
-                               break;
-                       }
-                       case TYPE_COVERAGE_ASSEMBLY: {
-                               CoverageAssembly *assembly = g_new0 (CoverageAssembly, 1);
-                               char *name, *guid, *filename;
-                               int number_of_methods, fully_covered, partially_covered;
-                               p++;
-
-                               name = (char *)p; while (*p) p++; p++;
-                               guid = (char *)p; while (*p) p++; p++;
-                               filename = (char *)p; while (*p) p++; p++;
-                               number_of_methods = decode_uleb128 (p, &p);
-                               fully_covered = decode_uleb128 (p, &p);
-                               partially_covered = decode_uleb128 (p, &p);
-
-                               assembly->name = g_strdup (name);
-                               assembly->guid = g_strdup (guid);
-                               assembly->filename = g_strdup (filename);
-                               assembly->number_of_methods = number_of_methods;
-                               assembly->fully_covered = fully_covered;
-                               assembly->partially_covered = partially_covered;
-
-                               coverage_add_assembly (assembly);
-                               break;
-                       }
-                       case TYPE_COVERAGE_CLASS: {
-                               CoverageClass *klass = g_new0 (CoverageClass, 1);
-                               char *assembly_name, *class_name;
-                               int number_of_methods, fully_covered, partially_covered;
-                               p++;
-
-                               assembly_name = (char *)p; while (*p) p++; p++;
-                               class_name = (char *)p; while (*p) p++; p++;
-                               number_of_methods = decode_uleb128 (p, &p);
-                               fully_covered = decode_uleb128 (p, &p);
-                               partially_covered = decode_uleb128 (p, &p);
-
-                               klass->assembly_name = g_strdup (assembly_name);
-                               klass->class_name = g_strdup (class_name);
-                               klass->number_of_methods = number_of_methods;
-                               klass->fully_covered = fully_covered;
-                               klass->partially_covered = partially_covered;
-
-                               coverage_add_class (klass);
-                               break;
-                       }
-
-                       default:
-                               break;
-                       }
-                       break;
-               }
-               default:
-                       fprintf (outfile, "unhandled profiler event: 0x%x at file offset: %llu + %lld (len: %d\n)\n", *p, (unsigned long long) file_offset, (long long) (p - ctx->buf), len);
-                       exit (1);
-               }
-               record_event_stats (event, p - start);
-       }
-       thread->last_time = time_base;
-       for (i = 0; i < thread->stack_id; ++i)
-               thread->stack [i]->recurse_count = 0;
-       return 1;
-}
-
-static ProfContext*
-load_file (char *name)
-{
-       unsigned char *p;
-       ProfContext *ctx = (ProfContext *)calloc (sizeof (ProfContext), 1);
-       if (strcmp (name, "-") == 0)
-               ctx->file = stdin;
-       else
-               ctx->file = fopen (name, "rb");
-       if (!ctx->file) {
-               printf ("Cannot open file: %s\n", name);
-               exit (1);
-       }
-#if defined (HAVE_SYS_ZLIB)
-       if (ctx->file != stdin)
-               ctx->gzfile = gzdopen (fileno (ctx->file), "rb");
-#endif
-       if (!load_data (ctx, 32))
-               return NULL;
-       p = ctx->buf;
-       if (read_int32 (p) != LOG_HEADER_ID || p [6] > LOG_DATA_VERSION)
-               return NULL;
-       ctx->version_major = p [4];
-       ctx->version_minor = p [5];
-       ctx->data_version = p [6];
-       /* reading 64 bit files on 32 bit systems not supported yet */
-       if (p [7] > sizeof (void*))
-               return NULL;
-       if (read_int32 (p + 20)) /* flags must be 0 */
-               return NULL;
-       ctx->startup_time = read_int64 (p + 8);
-       ctx->timer_overhead = read_int32 (p + 16);
-       ctx->pid = read_int32 (p + 24);
-       ctx->port = read_int16 (p + 28);
-       return ctx;
-}
-
-enum {
-       ALLOC_SORT_BYTES,
-       ALLOC_SORT_COUNT
-};
-static int alloc_sort_mode = ALLOC_SORT_BYTES;
-
-static int
-compare_class (const void *a, const void *b)
-{
-       ClassDesc *const *A = (ClassDesc *const *)a;
-       ClassDesc *const *B = (ClassDesc *const *)b;
-       uint64_t vala, valb;
-       if (alloc_sort_mode == ALLOC_SORT_BYTES) {
-               vala = (*A)->alloc_size;
-               valb = (*B)->alloc_size;
-       } else {
-               vala = (*A)->allocs;
-               valb = (*B)->allocs;
-       }
-       if (valb == vala)
-               return 0;
-       if (valb < vala)
-               return -1;
-       return 1;
-}
-
-static void
-dump_header (ProfContext *ctx)
-{
-       time_t st = ctx->startup_time / 1000;
-       char *t = ctime (&st);
-       fprintf (outfile, "\nMono log profiler data\n");
-       fprintf (outfile, "\tProfiler version: %d.%d\n", ctx->version_major, ctx->version_minor);
-       fprintf (outfile, "\tData version: %d\n", ctx->data_version);
-       fprintf (outfile, "\tMean timer overhead: %d nanoseconds\n", ctx->timer_overhead);
-       fprintf (outfile, "\tProgram startup: %s", t);
-       if (ctx->pid)
-               fprintf (outfile, "\tProgram ID: %d\n", ctx->pid);
-       if (ctx->port)
-               fprintf (outfile, "\tServer listening on: %d\n", ctx->port);
-}
-
-static void
-dump_traces (TraceDesc *traces, const char *desc)
-{
-       int j;
-       if (!show_traces)
-               return;
-       if (!traces->count)
-               return;
-       sort_context_array (traces);
-       for (j = 0; j < traces->count; ++j) {
-               int k;
-               BackTrace *bt;
-               bt = traces->traces [j].bt;
-               if (!bt->count)
-                       continue;
-               fprintf (outfile, "\t%llu %s from:\n", (unsigned long long) traces->traces [j].count, desc);
-               for (k = 0; k < bt->count; ++k)
-                       fprintf (outfile, "\t\t%s\n", bt->methods [k]->name);
-       }
-}
-
-static void
-dump_threads (ProfContext *ctx)
-{
-       ThreadContext *thread;
-       fprintf (outfile, "\nThread summary\n");
-       for (thread = ctx->threads; thread; thread = thread->next) {
-               if (thread->thread_id) {
-                       fprintf (outfile, "\tThread: %p, name: \"%s\"\n", (void*)thread->thread_id, thread->name? thread->name: "");
-               }
-       }
-}
-
-static void
-dump_domains (ProfContext *ctx)
-{
-       fprintf (outfile, "\nDomain summary\n");
-
-       for (DomainContext *domain = ctx->domains; domain; domain = domain->next)
-               fprintf (outfile, "\tDomain: %p, friendly name: \"%s\"\n", (void *) domain->domain_id, domain->friendly_name);
-}
-
-static void
-dump_remctxs (ProfContext *ctx)
-{
-       fprintf (outfile, "\nContext summary\n");
-
-       for (RemCtxContext *remctx = ctx->remctxs; remctx; remctx = remctx->next)
-               fprintf (outfile, "\tContext: %p, domain: %p\n", (void *) remctx->remctx_id, (void *) remctx->domain_id);
-}
-
-static void
-dump_exceptions (void)
-{
-       int i;
-       fprintf (outfile, "\nException summary\n");
-       fprintf (outfile, "\tThrows: %llu\n", (unsigned long long) throw_count);
-       dump_traces (&exc_traces, "throws");
-       for (i = 0; i <= MONO_EXCEPTION_CLAUSE_FAULT; ++i) {
-               if (!clause_summary [i])
-                       continue;
-               fprintf (outfile, "\tExecuted %s clauses: %llu\n", clause_name (i), (unsigned long long) clause_summary [i]);
-       }
-}
-
-static int
-compare_monitor (const void *a, const void *b)
-{
-       MonitorDesc *const *A = (MonitorDesc *const *)a;
-       MonitorDesc *const *B = (MonitorDesc *const *)b;
-       if ((*B)->wait_time == (*A)->wait_time)
-               return 0;
-       if ((*B)->wait_time < (*A)->wait_time)
-               return -1;
-       return 1;
-}
-
-static void
-dump_monitors (void)
-{
-       MonitorDesc **monitors;
-       int i, j;
-       if (!num_monitors)
-               return;
-       monitors = (MonitorDesc **)malloc (sizeof (void*) * num_monitors);
-       for (i = 0, j = 0; i < SMALL_HASH_SIZE; ++i) {
-               MonitorDesc *mdesc = monitor_hash [i];
-               while (mdesc) {
-                       monitors [j++] = mdesc;
-                       mdesc = mdesc->next;
-               }
-       }
-       qsort (monitors, num_monitors, sizeof (void*), compare_monitor);
-       fprintf (outfile, "\nMonitor lock summary\n");
-       for (i = 0; i < num_monitors; ++i) {
-               MonitorDesc *mdesc = monitors [i];
-               fprintf (outfile, "\tLock object %p: %d contentions\n", (void*)mdesc->objid, (int)mdesc->contentions);
-               fprintf (outfile, "\t\t%.6f secs total wait time, %.6f max, %.6f average\n",
-                       mdesc->wait_time/1000000000.0, mdesc->max_wait_time/1000000000.0, mdesc->wait_time/1000000000.0/mdesc->contentions);
-               dump_traces (&mdesc->traces, "contentions");
-       }
-       fprintf (outfile, "\tLock contentions: %llu\n", (unsigned long long) monitor_contention);
-       fprintf (outfile, "\tLock acquired: %llu\n", (unsigned long long) monitor_acquired);
-       fprintf (outfile, "\tLock failures: %llu\n", (unsigned long long) monitor_failed);
-}
-
-static void
-dump_gcs (void)
-{
-       int i;
-       fprintf (outfile, "\nGC summary\n");
-       fprintf (outfile, "\tGC resizes: %d\n", gc_resizes);
-       fprintf (outfile, "\tMax heap size: %llu\n", (unsigned long long) max_heap_size);
-       fprintf (outfile, "\tObject moves: %llu\n", (unsigned long long) gc_object_moves);
-       for (i = 0; i < 3; ++i) {
-               if (!gc_info [i].count)
-                       continue;
-               fprintf (outfile, "\tGen%d collections: %d, max time: %lluus, total time: %lluus, average: %lluus\n",
-                       i, gc_info [i].count,
-                       (unsigned long long) (gc_info [i].max_time / 1000),
-                       (unsigned long long) (gc_info [i].total_time / 1000),
-                       (unsigned long long) (gc_info [i].total_time / gc_info [i].count / 1000));
-       }
-       for (i = 0; i < 3; ++i) {
-               if (!handle_info [i].max_live)
-                       continue;
-               fprintf (outfile, "\tGC handles %s: created: %llu, destroyed: %llu, max: %llu\n",
-                       get_handle_name (i),
-                       (unsigned long long) (handle_info [i].created),
-                       (unsigned long long) (handle_info [i].destroyed),
-                       (unsigned long long) (handle_info [i].max_live));
-               dump_traces (&handle_info [i].traces, "created");
-               dump_traces (&handle_info [i].destroy_traces, "destroyed");
-       }
-}
-
-static void
-dump_jit (void)
-{
-       int i;
-       int code_size = 0;
-       int compiled_methods = 0;
-       MethodDesc* m;
-       fprintf (outfile, "\nJIT summary\n");
-       for (i = 0; i < HASH_SIZE; ++i) {
-               m = method_hash [i];
-               for (m = method_hash [i]; m; m = m->next) {
-                       if (!m->code || m->ignore_jit)
-                               continue;
-                       compiled_methods++;
-                       code_size += m->len;
-               }
-       }
-       fprintf (outfile, "\tCompiled methods: %d\n", compiled_methods);
-       fprintf (outfile, "\tGenerated code size: %d\n", code_size);
-       fprintf (outfile, "\tJIT helpers: %d\n", num_jit_helpers);
-       fprintf (outfile, "\tJIT helpers code size: %d\n", jit_helpers_code_size);
-}
-
-static void
-dump_allocations (void)
-{
-       int i, c;
-       intptr_t allocs = 0;
-       uint64_t size = 0;
-       int header_done = 0;
-       ClassDesc **classes = (ClassDesc **)malloc (num_classes * sizeof (void*));
-       ClassDesc *cd;
-       c = 0;
-       for (i = 0; i < HASH_SIZE; ++i) {
-               cd = class_hash [i];
-               while (cd) {
-                       classes [c++] = cd;
-                       cd = cd->next;
-               }
-       }
-       qsort (classes, num_classes, sizeof (void*), compare_class);
-       for (i = 0; i < num_classes; ++i) {
-               cd = classes [i];
-               if (!cd->allocs)
-                       continue;
-               allocs += cd->allocs;
-               size += cd->alloc_size;
-               if (!header_done++) {
-                       fprintf (outfile, "\nAllocation summary\n");
-                       fprintf (outfile, "%10s %10s %8s Type name\n", "Bytes", "Count", "Average");
-               }
-               fprintf (outfile, "%10llu %10zd %8llu %s\n",
-                       (unsigned long long) (cd->alloc_size),
-                       cd->allocs,
-                       (unsigned long long) (cd->alloc_size / cd->allocs),
-                       cd->name);
-               dump_traces (&cd->traces, "bytes");
-       }
-       if (allocs)
-               fprintf (outfile, "Total memory allocated: %llu bytes in %zd objects\n", (unsigned long long) size, allocs);
-}
-
-enum {
-       METHOD_SORT_TOTAL,
-       METHOD_SORT_SELF,
-       METHOD_SORT_CALLS
-};
-
-static int method_sort_mode = METHOD_SORT_TOTAL;
-
-static int
-compare_method (const void *a, const void *b)
-{
-       MethodDesc *const *A = (MethodDesc *const *)a;
-       MethodDesc *const *B = (MethodDesc *const *)b;
-       uint64_t vala, valb;
-       if (method_sort_mode == METHOD_SORT_SELF) {
-               vala = (*A)->self_time;
-               valb = (*B)->self_time;
-       } else if (method_sort_mode == METHOD_SORT_CALLS) {
-               vala = (*A)->calls;
-               valb = (*B)->calls;
-       } else {
-               vala = (*A)->total_time;
-               valb = (*B)->total_time;
-       }
-       if (vala == valb)
-               return 0;
-       if (valb < vala)
-               return -1;
-       return 1;
-}
-
-static void
-dump_metadata (void)
-{
-       fprintf (outfile, "\nMetadata summary\n");
-       fprintf (outfile, "\tLoaded images: %d\n", num_images);
-       if (verbose) {
-               ImageDesc *image;
-               int i;
-               for (i = 0; i < SMALL_HASH_SIZE; ++i) {
-                       image = image_hash [i];
-                       while (image) {
-                               fprintf (outfile, "\t\t%s\n", image->filename);
-                               image = image->next;
-                       }
-               }
-       }
-       fprintf (outfile, "\tLoaded assemblies: %d\n", num_assemblies);
-       if (verbose) {
-               AssemblyDesc *assembly;
-               int i;
-               for (i = 0; i < SMALL_HASH_SIZE; ++i) {
-                       assembly = assembly_hash [i];
-                       while (assembly) {
-                               fprintf (outfile, "\t\t%s\n", assembly->asmname);
-                               assembly = assembly->next;
-                       }
-               }
-       }
-}
-
-static void
-dump_methods (void)
-{
-       int i, c;
-       uint64_t calls = 0;
-       int header_done = 0;
-       MethodDesc **methods = (MethodDesc **)malloc (num_methods * sizeof (void*));
-       MethodDesc *cd;
-       c = 0;
-       for (i = 0; i < HASH_SIZE; ++i) {
-               cd = method_hash [i];
-               while (cd) {
-                       cd->total_time = cd->self_time + cd->callee_time;
-                       methods [c++] = cd;
-                       cd = cd->next;
-               }
-       }
-       qsort (methods, num_methods, sizeof (void*), compare_method);
-       for (i = 0; i < num_methods; ++i) {
-               uint64_t msecs;
-               uint64_t smsecs;
-               cd = methods [i];
-               if (!cd->calls)
-                       continue;
-               calls += cd->calls;
-               msecs = cd->total_time / 1000000;
-               smsecs = (cd->total_time - cd->callee_time) / 1000000;
-               if (!msecs && !verbose)
-                       continue;
-               if (!header_done++) {
-                       fprintf (outfile, "\nMethod call summary\n");
-                       fprintf (outfile, "%8s %8s %10s Method name\n", "Total(ms)", "Self(ms)", "Calls");
-               }
-               fprintf (outfile, "%8llu %8llu %10llu %s\n",
-                       (unsigned long long) (msecs),
-                       (unsigned long long) (smsecs),
-                       (unsigned long long) (cd->calls),
-                       cd->name);
-               dump_traces (&cd->traces, "calls");
-       }
-       if (calls)
-               fprintf (outfile, "Total calls: %llu\n", (unsigned long long) calls);
-}
-
-static int
-compare_heap_class (const void *a, const void *b)
-{
-       HeapClassDesc *const *A = (HeapClassDesc *const *)a;
-       HeapClassDesc *const *B = (HeapClassDesc *const *)b;
-       uint64_t vala, valb;
-       if (alloc_sort_mode == ALLOC_SORT_BYTES) {
-               vala = (*A)->total_size;
-               valb = (*B)->total_size;
-       } else {
-               vala = (*A)->count;
-               valb = (*B)->count;
-       }
-       if (valb == vala)
-               return 0;
-       if (valb < vala)
-               return -1;
-       return 1;
-}
-
-static int
-compare_rev_class (const void *a, const void *b)
-{
-       const HeapClassRevRef *A = (const HeapClassRevRef *)a;
-       const HeapClassRevRef *B = (const HeapClassRevRef *)b;
-       if (B->count == A->count)
-               return 0;
-       if (B->count < A->count)
-               return -1;
-       return 1;
-}
-
-static void
-dump_rev_claases (HeapClassRevRef *revs, int count)
-{
-       int j;
-       if (!show_traces)
-               return;
-       if (!count)
-               return;
-       for (j = 0; j < count; ++j) {
-               HeapClassDesc *cd = revs [j].klass;
-               fprintf (outfile, "\t\t%llu references from: %s\n",
-                       (unsigned long long) (revs [j].count),
-                       cd->klass->name);
-       }
-}
-
-static void
-heap_shot_summary (HeapShot *hs, int hs_num, HeapShot *last_hs)
-{
-       uint64_t size = 0;
-       uint64_t count = 0;
-       int ccount = 0;
-       int i;
-       HeapClassDesc *cd;
-       HeapClassDesc **sorted;
-       sorted = (HeapClassDesc **)malloc (sizeof (void*) * hs->class_count);
-       for (i = 0; i < hs->hash_size; ++i) {
-               cd = hs->class_hash [i];
-               if (!cd)
-                       continue;
-               count += cd->count;
-               size += cd->total_size;
-               sorted [ccount++] = cd;
-       }
-       hs->sorted = sorted;
-       qsort (sorted, ccount, sizeof (void*), compare_heap_class);
-       fprintf (outfile, "\n\tHeap shot %d at %.3f secs: size: %llu, object count: %llu, class count: %d, roots: %zd\n",
-               hs_num,
-               (hs->timestamp - startup_time)/1000000000.0,
-               (unsigned long long) (size),
-               (unsigned long long) (count),
-               ccount, hs->num_roots);
-       if (!verbose && ccount > 30)
-               ccount = 30;
-       fprintf (outfile, "\t%10s %10s %8s Class name\n", "Bytes", "Count", "Average");
-       for (i = 0; i < ccount; ++i) {
-               HeapClassRevRef *rev_sorted;
-               int j, k;
-               HeapClassDesc *ocd = NULL;
-               cd = sorted [i];
-               if (last_hs)
-                       ocd = heap_class_lookup (last_hs, cd->klass);
-               fprintf (outfile, "\t%10llu %10llu %8llu %s",
-                       (unsigned long long) (cd->total_size),
-                       (unsigned long long) (cd->count),
-                       (unsigned long long) (cd->total_size / cd->count),
-                       cd->klass->name);
-               if (ocd) {
-                       int64_t bdiff = cd->total_size - ocd->total_size;
-                       int64_t cdiff = cd->count - ocd->count;
-                       fprintf (outfile, " (bytes: %+lld, count: %+lld)\n", (long long) bdiff, (long long) cdiff);
-               } else {
-                       fprintf (outfile, "\n");
-               }
-               if (!collect_traces)
-                       continue;
-               rev_sorted = (HeapClassRevRef *)malloc (cd->rev_count * sizeof (HeapClassRevRef));
-               k = 0;
-               for (j = 0; j < cd->rev_hash_size; ++j) {
-                       if (cd->rev_hash [j].klass)
-                               rev_sorted [k++] = cd->rev_hash [j];
-               }
-               assert (cd->rev_count == k);
-               qsort (rev_sorted, cd->rev_count, sizeof (HeapClassRevRef), compare_rev_class);
-               if (cd->root_references)
-                       fprintf (outfile, "\t\t%zd root references (%zd pinning)\n", cd->root_references, cd->pinned_references);
-               dump_rev_claases (rev_sorted, cd->rev_count);
-               free (rev_sorted);
-       }
-       free (sorted);
-}
-
-static int
-compare_heap_shots (const void *a, const void *b)
-{
-       HeapShot *const *A = (HeapShot *const *)a;
-       HeapShot *const *B = (HeapShot *const *)b;
-       if ((*B)->timestamp == (*A)->timestamp)
-               return 0;
-       if ((*B)->timestamp > (*A)->timestamp)
-               return -1;
-       return 1;
-}
-
-static void
-dump_heap_shots (void)
-{
-       HeapShot **hs_sorted;
-       HeapShot *hs;
-       HeapShot *last_hs = NULL;
-       int i;
-       if (!heap_shots)
-               return;
-       hs_sorted = (HeapShot **)malloc (num_heap_shots * sizeof (void*));
-       fprintf (outfile, "\nHeap shot summary\n");
-       i = 0;
-       for (hs = heap_shots; hs; hs = hs->next)
-               hs_sorted [i++] = hs;
-       qsort (hs_sorted, num_heap_shots, sizeof (void*), compare_heap_shots);
-       for (i = 0; i < num_heap_shots; ++i) {
-               hs = hs_sorted [i];
-               heap_shot_summary (hs, i, last_hs);
-               last_hs = hs;
-       }
-}
-
-/* This is a very basic escape function that escapes < > and &
-   Ideally we'd use g_markup_escape_string but that function isn't
-        available in Mono's eglib. This was written without looking at the
-        source of that function in glib. */
-static char *
-escape_string_for_xml (const char *string)
-{
-       GString *string_builder = g_string_new (NULL);
-       const char *start, *p;
-
-       start = p = string;
-       while (*p) {
-               while (*p && *p != '&' && *p != '<' && *p != '>')
-                       p++;
-
-               g_string_append_len (string_builder, start, p - start);
-
-               if (*p == '\0')
-                       break;
-
-               switch (*p) {
-               case '<':
-                       g_string_append (string_builder, "&lt;");
-                       break;
-
-               case '>':
-                       g_string_append (string_builder, "&gt;");
-                       break;
-
-               case '&':
-                       g_string_append (string_builder, "&amp;");
-                       break;
-
-               default:
-                       break;
-               }
-
-               p++;
-               start = p;
-       }
-
-       return g_string_free (string_builder, FALSE);
-}
-
-static int
-sort_assemblies (gconstpointer a, gconstpointer b)
-{
-       CoverageAssembly *assembly_a = *(CoverageAssembly **)a;
-       CoverageAssembly *assembly_b = *(CoverageAssembly **)b;
-
-       if (assembly_a->name == NULL && assembly_b->name == NULL)
-               return 0;
-       else if (assembly_a->name == NULL)
-               return -1;
-       else if (assembly_b->name == NULL)
-               return 1;
-
-       return strcmp (assembly_a->name, assembly_b->name);
-}
-
-static void
-dump_coverage (void)
-{
-       if (!coverage_methods && !coverage_assemblies)
-               return;
-
-       gather_coverage_statements ();
-       fprintf (outfile, "\nCoverage Summary:\n");
-
-       if (coverage_outfile) {
-               fprintf (coverage_outfile, "<?xml version=\"1.0\"?>\n");
-               fprintf (coverage_outfile, "<coverage version=\"0.3\">\n");
-       }
-
-       g_ptr_array_sort (coverage_assemblies, sort_assemblies);
-
-       for (guint i = 0; i < coverage_assemblies->len; i++) {
-               CoverageAssembly *assembly = (CoverageAssembly *)coverage_assemblies->pdata[i];
-               GPtrArray *classes;
-
-               if (assembly->number_of_methods != 0) {
-                       int percentage = ((assembly->fully_covered + assembly->partially_covered) * 100) / assembly->number_of_methods;
-                       fprintf (outfile, "\t%s (%s) %d%% covered (%d methods - %d covered)\n", assembly->name, assembly->filename, percentage, assembly->number_of_methods, assembly->fully_covered);
-               } else
-                       fprintf (outfile, "\t%s (%s) ?%% covered (%d methods - %d covered)\n", assembly->name, assembly->filename, assembly->number_of_methods, assembly->fully_covered);
-
-               if (coverage_outfile) {
-                       char *escaped_name, *escaped_filename;
-                       escaped_name = escape_string_for_xml (assembly->name);
-                       escaped_filename = escape_string_for_xml (assembly->filename);
-
-                       fprintf (coverage_outfile, "\t<assembly name=\"%s\" guid=\"%s\" filename=\"%s\" method-count=\"%d\" full=\"%d\" partial=\"%d\"/>\n", escaped_name, assembly->guid, escaped_filename, assembly->number_of_methods, assembly->fully_covered, assembly->partially_covered);
-
-                       g_free (escaped_name);
-                       g_free (escaped_filename);
-               }
-
-               classes = (GPtrArray *)g_hash_table_lookup (coverage_assembly_classes, assembly->name);
-               if (classes) {
-                       for (guint j = 0; j < classes->len; j++) {
-                               CoverageClass *klass = (CoverageClass *)classes->pdata [j];
-
-                               if (klass->number_of_methods > 0) {
-                                       int percentage = ((klass->fully_covered + klass->partially_covered) * 100) / klass->number_of_methods;
-                                       fprintf (outfile, "\t\t%s %d%% covered (%d methods - %d covered)\n", klass->class_name, percentage, klass->number_of_methods, klass->fully_covered);
-                               } else
-                                       fprintf (outfile, "\t\t%s ?%% covered (%d methods - %d covered)\n", klass->class_name, klass->number_of_methods, klass->fully_covered);
-
-                               if (coverage_outfile) {
-                                       char *escaped_name;
-                                       escaped_name = escape_string_for_xml (klass->class_name);
-
-                                       fprintf (coverage_outfile, "\t\t<class name=\"%s\" method-count=\"%d\" full=\"%d\" partial=\"%d\"/>\n", escaped_name, klass->number_of_methods, klass->fully_covered, klass->partially_covered);
-                                       g_free (escaped_name);
-                               }
-                       }
-               }
-       }
-
-       for (guint i = 0; i < coverage_methods->len; i++) {
-               CoverageMethod *method = (CoverageMethod *)coverage_methods->pdata [i];
-
-               if (coverage_outfile) {
-                       char *escaped_assembly, *escaped_class, *escaped_method, *escaped_sig, *escaped_filename;
-
-                       escaped_assembly = escape_string_for_xml (method->assembly_name);
-                       escaped_class = escape_string_for_xml (method->class_name);
-                       escaped_method = escape_string_for_xml (method->method_name);
-                       escaped_sig = escape_string_for_xml (method->method_signature);
-                       escaped_filename = escape_string_for_xml (method->filename);
-
-                       fprintf (coverage_outfile, "\t<method assembly=\"%s\" class=\"%s\" name=\"%s (%s)\" filename=\"%s\" token=\"%d\">\n", escaped_assembly, escaped_class, escaped_method, escaped_sig, escaped_filename, method->token);
-
-                       g_free (escaped_assembly);
-                       g_free (escaped_class);
-                       g_free (escaped_method);
-                       g_free (escaped_sig);
-                       g_free (escaped_filename);
-
-                       for (guint j = 0; j < method->coverage->len; j++) {
-                               CoverageCoverage *coverage = (CoverageCoverage *)method->coverage->pdata [j];
-                               fprintf (coverage_outfile, "\t\t<statement offset=\"%d\" counter=\"%d\" line=\"%d\" column=\"%d\"/>\n", coverage->offset, coverage->count, coverage->line, coverage->column);
-                       }
-                       fprintf (coverage_outfile, "\t</method>\n");
-               }
-       }
-
-       if (coverage_outfile) {
-               fprintf (coverage_outfile, "</coverage>\n");
-               fclose (coverage_outfile);
-               coverage_outfile = NULL;
-       }
-}
-
-#define DUMP_EVENT_STAT(EVENT,SUBTYPE) dump_event (#EVENT, #SUBTYPE, EVENT, SUBTYPE);
-
-static void
-dump_event (const char *event_name, const char *subtype_name, int event, int subtype)
-{
-       int idx = event | subtype;
-       EventStat evt = stats [idx];
-       if (!evt.count)
-               return;
-
-       fprintf (outfile, "\t%16s\t%26s\tcount %6d\tmin %3d\tmax %6d\tbytes %d\n", event_name, subtype_name, evt.count, evt.min_size, evt.max_size, evt.bytes);
-}
-
-static void
-dump_stats (void)
-{
-       fprintf (outfile, "\nMlpd statistics\n");
-       fprintf (outfile, "\tBuffer count %d\toverhead %d (%d bytes per header)\n", buffer_count, buffer_count * BUFFER_HEADER_SIZE, BUFFER_HEADER_SIZE);
-       fprintf (outfile, "\nEvent details:\n");
-
-       DUMP_EVENT_STAT (TYPE_ALLOC, TYPE_ALLOC_NO_BT);
-       DUMP_EVENT_STAT (TYPE_ALLOC, TYPE_ALLOC_BT);
-
-       DUMP_EVENT_STAT (TYPE_GC, TYPE_GC_EVENT);
-       DUMP_EVENT_STAT (TYPE_GC, TYPE_GC_RESIZE);
-       DUMP_EVENT_STAT (TYPE_GC, TYPE_GC_MOVE);
-       DUMP_EVENT_STAT (TYPE_GC, TYPE_GC_HANDLE_CREATED);
-       DUMP_EVENT_STAT (TYPE_GC, TYPE_GC_HANDLE_DESTROYED);
-       DUMP_EVENT_STAT (TYPE_GC, TYPE_GC_HANDLE_CREATED_BT);
-       DUMP_EVENT_STAT (TYPE_GC, TYPE_GC_HANDLE_DESTROYED_BT);
-
-       DUMP_EVENT_STAT (TYPE_METADATA, TYPE_END_LOAD);
-       DUMP_EVENT_STAT (TYPE_METADATA, TYPE_END_UNLOAD);
-
-       DUMP_EVENT_STAT (TYPE_METHOD, TYPE_LEAVE);
-       DUMP_EVENT_STAT (TYPE_METHOD, TYPE_ENTER);
-       DUMP_EVENT_STAT (TYPE_METHOD, TYPE_EXC_LEAVE);
-       DUMP_EVENT_STAT (TYPE_METHOD, TYPE_JIT);
-
-       DUMP_EVENT_STAT (TYPE_EXCEPTION, TYPE_THROW);
-       DUMP_EVENT_STAT (TYPE_EXCEPTION, TYPE_CLAUSE);
-       DUMP_EVENT_STAT (TYPE_EXCEPTION, TYPE_EXCEPTION_BT);
-
-       DUMP_EVENT_STAT (TYPE_MONITOR, TYPE_MONITOR_NO_BT);
-       DUMP_EVENT_STAT (TYPE_MONITOR, TYPE_MONITOR_BT);
-
-       DUMP_EVENT_STAT (TYPE_HEAP, TYPE_HEAP_START);
-       DUMP_EVENT_STAT (TYPE_HEAP, TYPE_HEAP_END);
-       DUMP_EVENT_STAT (TYPE_HEAP, TYPE_HEAP_OBJECT);
-       DUMP_EVENT_STAT (TYPE_HEAP, TYPE_HEAP_ROOT);
-
-       DUMP_EVENT_STAT (TYPE_SAMPLE, TYPE_SAMPLE_HIT);
-       DUMP_EVENT_STAT (TYPE_SAMPLE, TYPE_SAMPLE_USYM);
-       DUMP_EVENT_STAT (TYPE_SAMPLE, TYPE_SAMPLE_UBIN);
-       DUMP_EVENT_STAT (TYPE_SAMPLE, TYPE_SAMPLE_COUNTERS_DESC);
-       DUMP_EVENT_STAT (TYPE_SAMPLE, TYPE_SAMPLE_COUNTERS);
-
-       DUMP_EVENT_STAT (TYPE_RUNTIME, TYPE_JITHELPER);
-
-       DUMP_EVENT_STAT (TYPE_COVERAGE, TYPE_COVERAGE_ASSEMBLY);
-       DUMP_EVENT_STAT (TYPE_COVERAGE, TYPE_COVERAGE_METHOD);
-       DUMP_EVENT_STAT (TYPE_COVERAGE, TYPE_COVERAGE_STATEMENT);
-       DUMP_EVENT_STAT (TYPE_COVERAGE, TYPE_COVERAGE_CLASS);
-}
-
-
-
-static void
-flush_context (ProfContext *ctx)
-{
-       ThreadContext *thread;
-       /* FIXME: sometimes there are leftovers: indagate */
-       for (thread = ctx->threads; thread; thread = thread->next) {
-               while (thread->stack_id) {
-                       if (debug)
-                               fprintf (outfile, "thread %p has %d items on stack\n", (void*)thread->thread_id, thread->stack_id);
-                       pop_method (thread, thread->stack [thread->stack_id - 1], thread->last_time);
-               }
-       }
-}
-
-static const char *reports = "header,jit,gc,sample,alloc,call,metadata,exception,monitor,thread,heapshot,counters,coverage";
-
-static const char*
-match_option (const char *p, const char *opt)
-{
-       int len = strlen (opt);
-       if (strncmp (p, opt, len) == 0) {
-               if (p [len] == ',')
-                       len++;
-               return p + len;
-       }
-       return p;
-}
-
-static int
-print_reports (ProfContext *ctx, const char *reps, int parse_only)
-{
-       const char *opt;
-       const char *p;
-       for (p = reps; *p; p = opt) {
-               if ((opt = match_option (p, "header")) != p) {
-                       if (!parse_only)
-                               dump_header (ctx);
-                       continue;
-               }
-               if ((opt = match_option (p, "thread")) != p) {
-                       if (!parse_only)
-                               dump_threads (ctx);
-                       continue;
-               }
-               if ((opt = match_option (p, "domain")) != p) {
-                       if (!parse_only)
-                               dump_domains (ctx);
-                       continue;
-               }
-               if ((opt = match_option (p, "context")) != p) {
-                       if (!parse_only)
-                               dump_remctxs (ctx);
-                       continue;
-               }
-               if ((opt = match_option (p, "gc")) != p) {
-                       if (!parse_only)
-                               dump_gcs ();
-                       continue;
-               }
-               if ((opt = match_option (p, "jit")) != p) {
-                       if (!parse_only)
-                               dump_jit ();
-                       continue;
-               }
-               if ((opt = match_option (p, "alloc")) != p) {
-                       if (!parse_only)
-                               dump_allocations ();
-                       continue;
-               }
-               if ((opt = match_option (p, "call")) != p) {
-                       if (!parse_only)
-                               dump_methods ();
-                       continue;
-               }
-               if ((opt = match_option (p, "metadata")) != p) {
-                       if (!parse_only)
-                               dump_metadata ();
-                       continue;
-               }
-               if ((opt = match_option (p, "exception")) != p) {
-                       if (!parse_only)
-                               dump_exceptions ();
-                       continue;
-               }
-               if ((opt = match_option (p, "monitor")) != p) {
-                       if (!parse_only)
-                               dump_monitors ();
-                       continue;
-               }
-               if ((opt = match_option (p, "heapshot")) != p) {
-                       if (!parse_only)
-                               dump_heap_shots ();
-                       continue;
-               }
-               if ((opt = match_option (p, "sample")) != p) {
-                       if (!parse_only)
-                               dump_samples ();
-                       continue;
-               }
-               if ((opt = match_option (p, "counters")) != p) {
-                       if (!parse_only)
-                               dump_counters ();
-                       continue;
-               }
-               if ((opt = match_option (p, "coverage")) != p) {
-                       if (!parse_only)
-                               dump_coverage ();
-                       continue;
-               }
-               if ((opt = match_option (p, "stats")) != p) {
-                       if (!parse_only)
-                               dump_stats ();
-                       continue;
-               }
-               return 0;
-       }
-       return 1;
-}
-
-static int
-add_find_spec (const char *p)
-{
-       if (p [0] == 'S' && p [1] == ':') {
-               char *vale;
-               find_size = strtoul (p + 2, &vale, 10);
-               return 1;
-       } else if (p [0] == 'T' && p [1] == ':') {
-               find_name = p + 2;
-               return 1;
-       }
-       return 0;
-}
-
-static void
-usage (void)
-{
-       printf ("Mono log profiler report version %d.%d\n", LOG_VERSION_MAJOR, LOG_VERSION_MINOR);
-       printf ("Usage: mprof-report [OPTIONS] FILENAME\n");
-       printf ("FILENAME can be '-' to read from standard input.\n");
-       printf ("Options:\n");
-       printf ("\t--help               display this help\n");
-       printf ("\t--out=FILE           write to FILE instead of stdout\n");
-       printf ("\t--traces             collect and show backtraces\n");
-       printf ("\t--maxframes=NUM      limit backtraces to NUM entries\n");
-       printf ("\t--reports=R1[,R2...] print the specified reports. Defaults are:\n");
-       printf ("\t                     %s\n", reports);
-       printf ("\t--method-sort=MODE   sort methods according to MODE: total, self, calls\n");
-       printf ("\t--alloc-sort=MODE    sort allocations according to MODE: bytes, count\n");
-       printf ("\t--counters-sort=MODE sort counters according to MODE: time, category\n");
-       printf ("\t                     only accessible in verbose mode\n");
-       printf ("\t--track=OB1[,OB2...] track what happens to objects OBJ1, O2 etc.\n");
-       printf ("\t--find=FINDSPEC      find and track objects matching FINFSPEC, where FINDSPEC is:\n");
-       printf ("\t                     S:minimum_size or T:partial_name\n");
-       printf ("\t--thread=THREADID    consider just the data for thread THREADID\n");
-       printf ("\t--time=FROM-TO       consider data FROM seconds from startup up to TO seconds\n");
-       printf ("\t--verbose            increase verbosity level\n");
-       printf ("\t--debug              display decoding debug info for mprof-report devs\n");
-       printf ("\t--coverage-out=FILE  write the coverage info to FILE as XML\n");
-}
-
-int
-main (int argc, char *argv[])
-{
-       ProfContext *ctx;
-       int i;
-       outfile = stdout;
-       for (i = 1; i < argc; ++i) {
-               if (strcmp ("--debug", argv [i]) == 0) {
-                       debug++;
-               } else if (strcmp ("--help", argv [i]) == 0) {
-                       usage ();
-                       return 0;
-               } else if (strncmp ("--alloc-sort=", argv [i], 13) == 0) {
-                       const char *val = argv [i] + 13;
-                       if (strcmp (val, "bytes") == 0) {
-                               alloc_sort_mode = ALLOC_SORT_BYTES;
-                       } else if (strcmp (val, "count") == 0) {
-                               alloc_sort_mode = ALLOC_SORT_COUNT;
-                       } else {
-                               usage ();
-                               return 1;
-                       }
-               } else if (strncmp ("--method-sort=", argv [i], 14) == 0) {
-                       const char *val = argv [i] + 14;
-                       if (strcmp (val, "total") == 0) {
-                               method_sort_mode = METHOD_SORT_TOTAL;
-                       } else if (strcmp (val, "self") == 0) {
-                               method_sort_mode = METHOD_SORT_SELF;
-                       } else if (strcmp (val, "calls") == 0) {
-                               method_sort_mode = METHOD_SORT_CALLS;
-                       } else {
-                               usage ();
-                               return 1;
-                       }
-               } else if (strncmp ("--counters-sort=", argv [i], 16) == 0) {
-                       const char *val = argv [i] + 16;
-                       if (strcmp (val, "time") == 0) {
-                               counters_sort_mode = COUNTERS_SORT_TIME;
-                       } else if (strcmp (val, "category") == 0) {
-                               counters_sort_mode = COUNTERS_SORT_CATEGORY;
-                       } else {
-                               usage ();
-                               return 1;
-                       }
-               } else if (strncmp ("--reports=", argv [i], 10) == 0) {
-                       const char *val = argv [i] + 10;
-                       if (!print_reports (NULL, val, 1)) {
-                               usage ();
-                               return 1;
-                       }
-                       reports = val;
-               } else if (strncmp ("--out=", argv [i], 6) == 0) {
-                       const char *val = argv [i] + 6;
-                       outfile = fopen (val, "w");
-                       if (!outfile) {
-                               printf ("Cannot open output file: %s\n", val);
-                               return 1;
-                       }
-               } else if (strncmp ("--maxframes=", argv [i], 12) == 0) {
-                       const char *val = argv [i] + 12;
-                       char *vale;
-                       trace_max = strtoul (val, &vale, 10);
-               } else if (strncmp ("--find=", argv [i], 7) == 0) {
-                       const char *val = argv [i] + 7;
-                       if (!add_find_spec (val)) {
-                               usage ();
-                               return 1;
-                       }
-               } else if (strncmp ("--track=", argv [i], 8) == 0) {
-                       const char *val = argv [i] + 8;
-                       char *vale;
-                       while (*val) {
-                               uintptr_t tracked_obj;
-                               if (*val == ',') {
-                                       val++;
-                                       continue;
-                               }
-                               tracked_obj = strtoul (val, &vale, 0);
-                               found_object (tracked_obj);
-                               val = vale;
-                       }
-               } else if (strncmp ("--thread=", argv [i], 9) == 0) {
-                       const char *val = argv [i] + 9;
-                       char *vale;
-                       thread_filter = strtoul (val, &vale, 0);
-               } else if (strncmp ("--time=", argv [i], 7) == 0) {
-                       char *val = pstrdup (argv [i] + 7);
-                       double from_secs, to_secs;
-                       char *top = strchr (val, '-');
-                       if (!top) {
-                               usage ();
-                               return 1;
-                       }
-                       *top++ = 0;
-                       from_secs = atof (val);
-                       to_secs = atof (top);
-                       free (val);
-                       if (from_secs > to_secs) {
-                               usage ();
-                               return 1;
-                       }
-                       time_from = from_secs * 1000000000;
-                       time_to = to_secs * 1000000000;
-                       use_time_filter = 1;
-               } else if (strcmp ("--verbose", argv [i]) == 0) {
-                       verbose++;
-               } else if (strcmp ("--traces", argv [i]) == 0) {
-                       show_traces = 1;
-                       collect_traces = 1;
-               } else if (strncmp ("--coverage-out=", argv [i], 15) == 0) {
-                       const char *val = argv [i] + 15;
-                       coverage_outfile = fopen (val, "w");
-                       if (!coverage_outfile) {
-                               printf ("Cannot open output file: %s\n", val);
-                               return 1;
-                       }
-               } else {
-                       break;
-               }
-       }
-       if (i >= argc) {
-               usage ();
-               return 2;
-       }
-       ctx = load_file (argv [i]);
-       if (!ctx) {
-               printf ("Not a log profiler data file (or unsupported version).\n");
-               return 1;
-       }
-       while (decode_buffer (ctx));
-       flush_context (ctx);
-       if (num_tracked_objects)
-               return 0;
-       print_reports (ctx, reports, 0);
-       return 0;
-}
diff --git a/mono/profiler/mono-profiler-log.c b/mono/profiler/mono-profiler-log.c
new file mode 100644 (file)
index 0000000..67741d9
--- /dev/null
@@ -0,0 +1,5029 @@
+/*
+ * mono-profiler-log.c: mono log profiler
+ *
+ * Authors:
+ *   Paolo Molaro (lupus@ximian.com)
+ *   Alex Rønne Petersen (alexrp@xamarin.com)
+ *
+ * Copyright 2010 Novell, Inc (http://www.novell.com)
+ * Copyright 2011 Xamarin Inc (http://www.xamarin.com)
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
+ */
+
+#include <config.h>
+#include <mono/metadata/assembly.h>
+#include <mono/metadata/debug-helpers.h>
+#include "../metadata/metadata-internals.h"
+#include <mono/metadata/mono-config.h>
+#include <mono/metadata/mono-gc.h>
+#include <mono/metadata/mono-perfcounters.h>
+#include <mono/metadata/profiler.h>
+#include <mono/utils/atomic.h>
+#include <mono/utils/hazard-pointer.h>
+#include <mono/utils/lock-free-alloc.h>
+#include <mono/utils/lock-free-queue.h>
+#include <mono/utils/mono-conc-hashtable.h>
+#include <mono/utils/mono-counters.h>
+#include <mono/utils/mono-linked-list-set.h>
+#include <mono/utils/mono-membar.h>
+#include <mono/utils/mono-mmap.h>
+#include <mono/utils/mono-os-mutex.h>
+#include <mono/utils/mono-os-semaphore.h>
+#include <mono/utils/mono-threads.h>
+#include <mono/utils/mono-threads-api.h>
+#include "mono-profiler-log.h"
+
+#ifdef HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+#include <fcntl.h>
+#ifdef HAVE_LINK_H
+#include <link.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if defined(__APPLE__)
+#include <mach/mach_time.h>
+#endif
+#include <netinet/in.h>
+#ifdef HAVE_SYS_MMAN_H
+#include <sys/mman.h>
+#endif
+#include <sys/socket.h>
+#if defined (HAVE_SYS_ZLIB)
+#include <zlib.h>
+#endif
+
+#define BUFFER_SIZE (4096 * 16)
+
+/* Worst-case size in bytes of a 64-bit value encoded with LEB128. */
+#define LEB128_SIZE 10
+
+/* Size of a value encoded as a single byte. */
+#undef BYTE_SIZE // mach/i386/vm_param.h on OS X defines this to 8, but it isn't used for anything.
+#define BYTE_SIZE 1
+
+/* Size in bytes of the event prefix (ID + time). */
+#define EVENT_SIZE (BYTE_SIZE + LEB128_SIZE)
+
+static volatile gint32 runtime_inited;
+static volatile gint32 in_shutdown;
+
+static gboolean no_counters;
+static int nocalls = 0;
+static int notraces = 0;
+static int use_zip = 0;
+static int do_report = 0;
+static int do_heap_shot = 0;
+static int max_call_depth = 100;
+static int command_port = 0;
+static int heapshot_requested = 0;
+static int sample_freq = 0;
+static int do_mono_sample = 0;
+static int do_debug = 0;
+static int do_coverage = 0;
+static gboolean only_coverage;
+static gboolean debug_coverage = FALSE;
+static MonoProfileSamplingMode sampling_mode = MONO_PROFILER_STAT_MODE_PROCESS;
+static int max_allocated_sample_hits;
+
+// Statistics for internal profiler data structures.
+static gint32 sample_allocations_ctr,
+              buffer_allocations_ctr;
+
+// Statistics for profiler events.
+static gint32 sync_points_ctr,
+              heap_objects_ctr,
+              heap_starts_ctr,
+              heap_ends_ctr,
+              heap_roots_ctr,
+              gc_events_ctr,
+              gc_resizes_ctr,
+              gc_allocs_ctr,
+              gc_moves_ctr,
+              gc_handle_creations_ctr,
+              gc_handle_deletions_ctr,
+              finalize_begins_ctr,
+              finalize_ends_ctr,
+              finalize_object_begins_ctr,
+              finalize_object_ends_ctr,
+              image_loads_ctr,
+              image_unloads_ctr,
+              assembly_loads_ctr,
+              assembly_unloads_ctr,
+              class_loads_ctr,
+              class_unloads_ctr,
+              method_entries_ctr,
+              method_exits_ctr,
+              method_exception_exits_ctr,
+              method_jits_ctr,
+              code_buffers_ctr,
+              exception_throws_ctr,
+              exception_clauses_ctr,
+              monitor_contentions_ctr,
+              monitor_acquisitions_ctr,
+              monitor_failures_ctr,
+              thread_starts_ctr,
+              thread_ends_ctr,
+              thread_names_ctr,
+              domain_loads_ctr,
+              domain_unloads_ctr,
+              domain_names_ctr,
+              context_loads_ctr,
+              context_unloads_ctr,
+              sample_ubins_ctr,
+              sample_usyms_ctr,
+              sample_hits_ctr,
+              counter_descriptors_ctr,
+              counter_samples_ctr,
+              perfcounter_descriptors_ctr,
+              perfcounter_samples_ctr,
+              coverage_methods_ctr,
+              coverage_statements_ctr,
+              coverage_classes_ctr,
+              coverage_assemblies_ctr;
+
+static MonoLinkedListSet profiler_thread_list;
+
+/*
+ * file format:
+ * [header] [buffer]*
+ *
+ * The file is composed by a header followed by 0 or more buffers.
+ * Each buffer contains events that happened on a thread: for a given thread
+ * buffers that appear later in the file are guaranteed to contain events
+ * that happened later in time. Buffers from separate threads could be interleaved,
+ * though.
+ * Buffers are not required to be aligned.
+ *
+ * header format:
+ * [id: 4 bytes] constant value: LOG_HEADER_ID
+ * [major: 1 byte] [minor: 1 byte] major and minor version of the log profiler
+ * [format: 1 byte] version of the data format for the rest of the file
+ * [ptrsize: 1 byte] size in bytes of a pointer in the profiled program
+ * [startup time: 8 bytes] time in milliseconds since the unix epoch when the program started
+ * [timer overhead: 4 bytes] approximate overhead in nanoseconds of the timer
+ * [flags: 4 bytes] file format flags, should be 0 for now
+ * [pid: 4 bytes] pid of the profiled process
+ * [port: 2 bytes] tcp port for server if != 0
+ * [args size: 4 bytes] size of args
+ * [args: string] arguments passed to the profiler
+ * [arch size: 4 bytes] size of arch
+ * [arch: string] architecture the profiler is running on
+ * [os size: 4 bytes] size of os
+ * [os: string] operating system the profiler is running on
+ *
+ * The multiple byte integers are in little-endian format.
+ *
+ * buffer format:
+ * [buffer header] [event]*
+ * Buffers have a fixed-size header followed by 0 or more bytes of event data.
+ * Timing information and other values in the event data are usually stored
+ * as uleb128 or sleb128 integers. To save space, as noted for each item below,
+ * some data is represented as a difference between the actual value and
+ * either the last value of the same type (like for timing information) or
+ * as the difference from a value stored in a buffer header.
+ *
+ * For timing information the data is stored as uleb128, since timing
+ * increases in a monotonic way in each thread: the value is the number of
+ * nanoseconds to add to the last seen timing data in a buffer. The first value
+ * in a buffer will be calculated from the time_base field in the buffer head.
+ *
+ * Object or heap sizes are stored as uleb128.
+ * Pointer differences are stored as sleb128, instead.
+ *
+ * If an unexpected value is found, the rest of the buffer should be ignored,
+ * as generally the later values need the former to be interpreted correctly.
+ *
+ * buffer header format:
+ * [bufid: 4 bytes] constant value: BUF_ID
+ * [len: 4 bytes] size of the data following the buffer header
+ * [time_base: 8 bytes] time base in nanoseconds since an unspecified epoch
+ * [ptr_base: 8 bytes] base value for pointers
+ * [obj_base: 8 bytes] base value for object addresses
+ * [thread id: 8 bytes] system-specific thread ID (pthread_t for example)
+ * [method_base: 8 bytes] base value for MonoMethod pointers
+ *
+ * event format:
+ * [extended info: upper 4 bits] [type: lower 4 bits]
+ * [time diff: uleb128] nanoseconds since last timing
+ * [data]*
+ * The data that follows depends on type and the extended info.
+ * Type is one of the enum values in mono-profiler-log.h: TYPE_ALLOC, TYPE_GC,
+ * TYPE_METADATA, TYPE_METHOD, TYPE_EXCEPTION, TYPE_MONITOR, TYPE_HEAP.
+ * The extended info bits are interpreted based on type, see
+ * each individual event description below.
+ * strings are represented as a 0-terminated utf8 sequence.
+ *
+ * backtrace format:
+ * [num: uleb128] number of frames following
+ * [frame: sleb128]* mum MonoMethod* as a pointer difference from the last such
+ * pointer or the buffer method_base
+ *
+ * type alloc format:
+ * type: TYPE_ALLOC
+ * exinfo: flags: TYPE_ALLOC_BT
+ * [ptr: sleb128] class as a byte difference from ptr_base
+ * [obj: sleb128] object address as a byte difference from obj_base
+ * [size: uleb128] size of the object in the heap
+ * If the TYPE_ALLOC_BT flag is set, a backtrace follows.
+ *
+ * type GC format:
+ * type: TYPE_GC
+ * exinfo: one of TYPE_GC_EVENT, TYPE_GC_RESIZE, TYPE_GC_MOVE, TYPE_GC_HANDLE_CREATED[_BT],
+ * TYPE_GC_HANDLE_DESTROYED[_BT], TYPE_GC_FINALIZE_START, TYPE_GC_FINALIZE_END,
+ * TYPE_GC_FINALIZE_OBJECT_START, TYPE_GC_FINALIZE_OBJECT_END
+ * if exinfo == TYPE_GC_RESIZE
+ *     [heap_size: uleb128] new heap size
+ * if exinfo == TYPE_GC_EVENT
+ *     [event type: byte] GC event (MONO_GC_EVENT_* from profiler.h)
+ *     [generation: byte] GC generation event refers to
+ * if exinfo == TYPE_GC_MOVE
+ *     [num_objects: uleb128] number of object moves that follow
+ *     [objaddr: sleb128]+ num_objects object pointer differences from obj_base
+ *     num is always an even number: the even items are the old
+ *     addresses, the odd numbers are the respective new object addresses
+ * if exinfo == TYPE_GC_HANDLE_CREATED[_BT]
+ *     [handle_type: uleb128] GC handle type (System.Runtime.InteropServices.GCHandleType)
+ *     upper bits reserved as flags
+ *     [handle: uleb128] GC handle value
+ *     [objaddr: sleb128] object pointer differences from obj_base
+ *     If exinfo == TYPE_GC_HANDLE_CREATED_BT, a backtrace follows.
+ * if exinfo == TYPE_GC_HANDLE_DESTROYED[_BT]
+ *     [handle_type: uleb128] GC handle type (System.Runtime.InteropServices.GCHandleType)
+ *     upper bits reserved as flags
+ *     [handle: uleb128] GC handle value
+ *     If exinfo == TYPE_GC_HANDLE_DESTROYED_BT, a backtrace follows.
+ * if exinfo == TYPE_GC_FINALIZE_OBJECT_{START,END}
+ *     [object: sleb128] the object as a difference from obj_base
+ *
+ * type metadata format:
+ * type: TYPE_METADATA
+ * exinfo: one of: TYPE_END_LOAD, TYPE_END_UNLOAD (optional for TYPE_THREAD and TYPE_DOMAIN)
+ * [mtype: byte] metadata type, one of: TYPE_CLASS, TYPE_IMAGE, TYPE_ASSEMBLY, TYPE_DOMAIN,
+ * TYPE_THREAD, TYPE_CONTEXT
+ * [pointer: sleb128] pointer of the metadata type depending on mtype
+ * if mtype == TYPE_CLASS
+ *     [image: sleb128] MonoImage* as a pointer difference from ptr_base
+ *     [name: string] full class name
+ * if mtype == TYPE_IMAGE
+ *     [name: string] image file name
+ * if mtype == TYPE_ASSEMBLY
+ *     [name: string] assembly name
+ * if mtype == TYPE_DOMAIN && exinfo == 0
+ *     [name: string] domain friendly name
+ * if mtype == TYPE_CONTEXT
+ *     [domain: sleb128] domain id as pointer
+ * if mtype == TYPE_THREAD && exinfo == 0
+ *     [name: string] thread name
+ *
+ * type method format:
+ * type: TYPE_METHOD
+ * exinfo: one of: TYPE_LEAVE, TYPE_ENTER, TYPE_EXC_LEAVE, TYPE_JIT
+ * [method: sleb128] MonoMethod* as a pointer difference from the last such
+ * pointer or the buffer method_base
+ * if exinfo == TYPE_JIT
+ *     [code address: sleb128] pointer to the native code as a diff from ptr_base
+ *     [code size: uleb128] size of the generated code
+ *     [name: string] full method name
+ *
+ * type exception format:
+ * type: TYPE_EXCEPTION
+ * exinfo: TYPE_THROW_BT flag or one of: TYPE_CLAUSE
+ * if exinfo == TYPE_CLAUSE
+ *     [clause type: byte] MonoExceptionEnum enum value
+ *     [clause index: uleb128] index of the current clause
+ *     [method: sleb128] MonoMethod* as a pointer difference from the last such
+ *     pointer or the buffer method_base
+ * else
+ *     [object: sleb128] the exception object as a difference from obj_base
+ *     if exinfo has TYPE_THROW_BT set, a backtrace follows.
+ *
+ * type runtime format:
+ * type: TYPE_RUNTIME
+ * exinfo: one of: TYPE_JITHELPER
+ * if exinfo == TYPE_JITHELPER
+ *     [type: byte] MonoProfilerCodeBufferType enum value
+ *     [buffer address: sleb128] pointer to the native code as a diff from ptr_base
+ *     [buffer size: uleb128] size of the generated code
+ *     if type == MONO_PROFILER_CODE_BUFFER_SPECIFIC_TRAMPOLINE
+ *             [name: string] buffer description name
+ *
+ * type monitor format:
+ * type: TYPE_MONITOR
+ * exinfo: TYPE_MONITOR_BT flag and one of: MONO_PROFILER_MONITOR_(CONTENTION|FAIL|DONE)
+ * [object: sleb128] the lock object as a difference from obj_base
+ * if exinfo.low3bits == MONO_PROFILER_MONITOR_CONTENTION
+ *     If the TYPE_MONITOR_BT flag is set, a backtrace follows.
+ *
+ * type heap format
+ * type: TYPE_HEAP
+ * exinfo: one of TYPE_HEAP_START, TYPE_HEAP_END, TYPE_HEAP_OBJECT, TYPE_HEAP_ROOT
+ * if exinfo == TYPE_HEAP_OBJECT
+ *     [object: sleb128] the object as a difference from obj_base
+ *     [class: sleb128] the object MonoClass* as a difference from ptr_base
+ *     [size: uleb128] size of the object on the heap
+ *     [num_refs: uleb128] number of object references
+ *     each referenced objref is preceded by a uleb128 encoded offset: the
+ *     first offset is from the object address and each next offset is relative
+ *     to the previous one
+ *     [objrefs: sleb128]+ object referenced as a difference from obj_base
+ *     The same object can appear multiple times, but only the first time
+ *     with size != 0: in the other cases this data will only be used to
+ *     provide additional referenced objects.
+ * if exinfo == TYPE_HEAP_ROOT
+ *     [num_roots: uleb128] number of root references
+ *     [num_gc: uleb128] number of major gcs
+ *     [object: sleb128] the object as a difference from obj_base
+ *     [root_type: byte] the root_type: MonoProfileGCRootType (profiler.h)
+ *     [extra_info: uleb128] the extra_info value
+ *     object, root_type and extra_info are repeated num_roots times
+ *
+ * type sample format
+ * type: TYPE_SAMPLE
+ * exinfo: one of TYPE_SAMPLE_HIT, TYPE_SAMPLE_USYM, TYPE_SAMPLE_UBIN, TYPE_SAMPLE_COUNTERS_DESC, TYPE_SAMPLE_COUNTERS
+ * if exinfo == TYPE_SAMPLE_HIT
+ *     [thread: sleb128] thread id as difference from ptr_base
+ *     [count: uleb128] number of following instruction addresses
+ *     [ip: sleb128]* instruction pointer as difference from ptr_base
+ *     [mbt_count: uleb128] number of managed backtrace frames
+ *     [method: sleb128]* MonoMethod* as a pointer difference from the last such
+ *     pointer or the buffer method_base (the first such method can be also indentified by ip, but this is not neccessarily true)
+ * if exinfo == TYPE_SAMPLE_USYM
+ *     [address: sleb128] symbol address as a difference from ptr_base
+ *     [size: uleb128] symbol size (may be 0 if unknown)
+ *     [name: string] symbol name
+ * if exinfo == TYPE_SAMPLE_UBIN
+ *     [address: sleb128] address where binary has been loaded
+ *     [offset: uleb128] file offset of mapping (the same file can be mapped multiple times)
+ *     [size: uleb128] memory size
+ *     [name: string] binary name
+ * if exinfo == TYPE_SAMPLE_COUNTERS_DESC
+ *     [len: uleb128] number of counters
+ *     for i = 0 to len
+ *             [section: uleb128] section of counter
+ *             if section == MONO_COUNTER_PERFCOUNTERS:
+ *                     [section_name: string] section name of counter
+ *             [name: string] name of counter
+ *             [type: byte] type of counter
+ *             [unit: byte] unit of counter
+ *             [variance: byte] variance of counter
+ *             [index: uleb128] unique index of counter
+ * if exinfo == TYPE_SAMPLE_COUNTERS
+ *     while true:
+ *             [index: uleb128] unique index of counter
+ *             if index == 0:
+ *                     break
+ *             [type: byte] type of counter value
+ *             if type == string:
+ *                     if value == null:
+ *                             [0: uleb128] 0 -> value is null
+ *                     else:
+ *                             [1: uleb128] 1 -> value is not null
+ *                             [value: string] counter value
+ *             else:
+ *                     [value: uleb128/sleb128/double] counter value, can be sleb128, uleb128 or double (determined by using type)
+ *
+ * type coverage format
+ * type: TYPE_COVERAGE
+ * exinfo: one of TYPE_COVERAGE_METHOD, TYPE_COVERAGE_STATEMENT, TYPE_COVERAGE_ASSEMBLY, TYPE_COVERAGE_CLASS
+ * if exinfo == TYPE_COVERAGE_METHOD
+ *  [assembly: string] name of assembly
+ *  [class: string] name of the class
+ *  [name: string] name of the method
+ *  [signature: string] the signature of the method
+ *  [filename: string] the file path of the file that contains this method
+ *  [token: uleb128] the method token
+ *  [method_id: uleb128] an ID for this data to associate with the buffers of TYPE_COVERAGE_STATEMENTS
+ *  [len: uleb128] the number of TYPE_COVERAGE_BUFFERS associated with this method
+ * if exinfo == TYPE_COVERAGE_STATEMENTS
+ *  [method_id: uleb128] an the TYPE_COVERAGE_METHOD buffer to associate this with
+ *  [offset: uleb128] the il offset relative to the previous offset
+ *  [counter: uleb128] the counter for this instruction
+ *  [line: uleb128] the line of filename containing this instruction
+ *  [column: uleb128] the column containing this instruction
+ * if exinfo == TYPE_COVERAGE_ASSEMBLY
+ *  [name: string] assembly name
+ *  [guid: string] assembly GUID
+ *  [filename: string] assembly filename
+ *  [number_of_methods: uleb128] the number of methods in this assembly
+ *  [fully_covered: uleb128] the number of fully covered methods
+ *  [partially_covered: uleb128] the number of partially covered methods
+ *    currently partially_covered will always be 0, and fully_covered is the
+ *    number of methods that are fully and partially covered.
+ * if exinfo == TYPE_COVERAGE_CLASS
+ *  [name: string] assembly name
+ *  [class: string] class name
+ *  [number_of_methods: uleb128] the number of methods in this class
+ *  [fully_covered: uleb128] the number of fully covered methods
+ *  [partially_covered: uleb128] the number of partially covered methods
+ *    currently partially_covered will always be 0, and fully_covered is the
+ *    number of methods that are fully and partially covered.
+ *
+ * type meta format:
+ * type: TYPE_META
+ * exinfo: one of: TYPE_SYNC_POINT
+ * if exinfo == TYPE_SYNC_POINT
+ *     [type: byte] MonoProfilerSyncPointType enum value
+ */
+
+// Pending data to be written to the log, for a single thread.
+// Threads periodically flush their own LogBuffers by calling safe_send
+typedef struct _LogBuffer LogBuffer;
+struct _LogBuffer {
+       // Next (older) LogBuffer in processing queue
+       LogBuffer *next;
+
+       uint64_t time_base;
+       uint64_t last_time;
+       uintptr_t ptr_base;
+       uintptr_t method_base;
+       uintptr_t last_method;
+       uintptr_t obj_base;
+       uintptr_t thread_id;
+
+       // Bytes allocated for this LogBuffer
+       int size;
+
+       // Start of currently unused space in buffer
+       unsigned char* cursor;
+
+       // Pointer to start-of-structure-plus-size (for convenience)
+       unsigned char* buf_end;
+
+       // Start of data in buffer. Contents follow "buffer format" described above.
+       unsigned char buf [1];
+};
+
+typedef struct {
+       MonoLinkedListSetNode node;
+
+       // Convenience pointer to the profiler structure.
+       MonoProfiler *profiler;
+
+       // Was this thread added to the LLS?
+       gboolean attached;
+
+       // The current log buffer for this thread.
+       LogBuffer *buffer;
+
+       // Methods referenced by events in `buffer`, see `MethodInfo`.
+       GPtrArray *methods;
+
+       // Current call depth for enter/leave events.
+       int call_depth;
+
+       // Indicates whether this thread is currently writing to its `buffer`.
+       gboolean busy;
+
+       // Has this thread written a thread end event to `buffer`?
+       gboolean ended;
+} MonoProfilerThread;
+
+static uintptr_t
+thread_id (void)
+{
+       return (uintptr_t) mono_native_thread_id_get ();
+}
+
+static uintptr_t
+process_id (void)
+{
+#ifdef HOST_WIN32
+       return (uintptr_t) GetCurrentProcessId ();
+#else
+       return (uintptr_t) getpid ();
+#endif
+}
+
+#ifdef __APPLE__
+static mach_timebase_info_data_t timebase_info;
+#elif defined (HOST_WIN32)
+static LARGE_INTEGER pcounter_freq;
+#endif
+
+#define TICKS_PER_SEC 1000000000LL
+
+static uint64_t
+current_time (void)
+{
+#ifdef __APPLE__
+       uint64_t time = mach_absolute_time ();
+
+       time *= timebase_info.numer;
+       time /= timebase_info.denom;
+
+       return time;
+#elif defined (HOST_WIN32)
+       LARGE_INTEGER value;
+
+       QueryPerformanceCounter (&value);
+
+       return value.QuadPart * TICKS_PER_SEC / pcounter_freq.QuadPart;
+#elif defined (CLOCK_MONOTONIC)
+       struct timespec tspec;
+
+       clock_gettime (CLOCK_MONOTONIC, &tspec);
+
+       return ((uint64_t) tspec.tv_sec * TICKS_PER_SEC + tspec.tv_nsec);
+#else
+       struct timeval tv;
+
+       gettimeofday (&tv, NULL);
+
+       return ((uint64_t) tv.tv_sec * TICKS_PER_SEC + tv.tv_usec * 1000);
+#endif
+}
+
+static int timer_overhead;
+
+static void
+init_time (void)
+{
+#ifdef __APPLE__
+       mach_timebase_info (&timebase_info);
+#elif defined (HOST_WIN32)
+       QueryPerformanceFrequency (&pcounter_freq);
+#endif
+
+       uint64_t time_start = current_time ();
+
+       for (int i = 0; i < 256; ++i)
+               current_time ();
+
+       uint64_t time_end = current_time ();
+
+       timer_overhead = (time_end - time_start) / 256;
+}
+
+/*
+ * These macros should be used when writing an event to a log buffer. They take
+ * care of a bunch of stuff that can be repetitive and error-prone, such as
+ * acquiring/releasing the buffer lock, incrementing the event counter,
+ * expanding the log buffer, processing requests, etc. They also create a scope
+ * so that it's harder to leak the LogBuffer pointer, which can be problematic
+ * as the pointer is unstable when the buffer lock isn't acquired.
+ */
+
+#define ENTER_LOG(COUNTER, BUFFER, SIZE) \
+       do { \
+               MonoProfilerThread *thread__ = PROF_TLS_GET (); \
+               if (thread__->attached) \
+                       buffer_lock (); \
+               g_assert (!thread__->busy && "Why are we trying to write a new event while already writing one?"); \
+               thread__->busy = TRUE; \
+               InterlockedIncrement ((COUNTER)); \
+               LogBuffer *BUFFER = ensure_logbuf_unsafe (thread__, (SIZE))
+
+#define EXIT_LOG_EXPLICIT(SEND, REQUESTS) \
+               thread__->busy = FALSE; \
+               if ((SEND)) \
+                       send_log_unsafe (TRUE); \
+               if (thread__->attached) \
+                       buffer_unlock (); \
+               if ((REQUESTS)) \
+                       process_requests (); \
+       } while (0)
+
+// Pass these to EXIT_LOG_EXPLICIT () for easier reading.
+#define DO_SEND TRUE
+#define NO_SEND FALSE
+#define DO_REQUESTS TRUE
+#define NO_REQUESTS FALSE
+
+#define EXIT_LOG EXIT_LOG_EXPLICIT (DO_SEND, DO_REQUESTS)
+
+static volatile gint32 buffer_rwlock_count;
+static volatile gpointer buffer_rwlock_exclusive;
+
+// Can be used recursively.
+static void
+buffer_lock (void)
+{
+       /*
+        * If the thread holding the exclusive lock tries to modify the
+        * reader count, just make it a no-op. This way, we also avoid
+        * invoking the GC safe point macros below, which could break if
+        * done from a thread that is currently the initiator of STW.
+        *
+        * In other words, we rely on the fact that the GC thread takes
+        * the exclusive lock in the gc_event () callback when the world
+        * is about to stop.
+        */
+       if (InterlockedReadPointer (&buffer_rwlock_exclusive) != (gpointer) thread_id ()) {
+               MONO_ENTER_GC_SAFE;
+
+               while (InterlockedReadPointer (&buffer_rwlock_exclusive))
+                       mono_thread_info_yield ();
+
+               InterlockedIncrement (&buffer_rwlock_count);
+
+               MONO_EXIT_GC_SAFE;
+       }
+
+       mono_memory_barrier ();
+}
+
+static void
+buffer_unlock (void)
+{
+       mono_memory_barrier ();
+
+       // See the comment in buffer_lock ().
+       if (InterlockedReadPointer (&buffer_rwlock_exclusive) == (gpointer) thread_id ())
+               return;
+
+       g_assert (InterlockedRead (&buffer_rwlock_count) && "Why are we trying to decrement a zero reader count?");
+
+       InterlockedDecrement (&buffer_rwlock_count);
+}
+
+// Cannot be used recursively.
+static void
+buffer_lock_excl (void)
+{
+       gpointer tid = (gpointer) thread_id ();
+
+       g_assert (InterlockedReadPointer (&buffer_rwlock_exclusive) != tid && "Why are we taking the exclusive lock twice?");
+
+       MONO_ENTER_GC_SAFE;
+
+       while (InterlockedCompareExchangePointer (&buffer_rwlock_exclusive, tid, 0))
+               mono_thread_info_yield ();
+
+       while (InterlockedRead (&buffer_rwlock_count))
+               mono_thread_info_yield ();
+
+       MONO_EXIT_GC_SAFE;
+
+       mono_memory_barrier ();
+}
+
+static void
+buffer_unlock_excl (void)
+{
+       mono_memory_barrier ();
+
+       g_assert (InterlockedReadPointer (&buffer_rwlock_exclusive) && "Why is the exclusive lock not held?");
+       g_assert (InterlockedReadPointer (&buffer_rwlock_exclusive) == (gpointer) thread_id () && "Why does another thread hold the exclusive lock?");
+       g_assert (!InterlockedRead (&buffer_rwlock_count) && "Why are there readers when the exclusive lock is held?");
+
+       InterlockedWritePointer (&buffer_rwlock_exclusive, NULL);
+}
+
+typedef struct _BinaryObject BinaryObject;
+struct _BinaryObject {
+       BinaryObject *next;
+       void *addr;
+       char *name;
+};
+
+struct _MonoProfiler {
+       FILE* file;
+#if defined (HAVE_SYS_ZLIB)
+       gzFile gzfile;
+#endif
+       char *args;
+       uint64_t startup_time;
+       int pipe_output;
+       int command_port;
+       int server_socket;
+       int pipes [2];
+       MonoNativeThreadId helper_thread;
+       MonoNativeThreadId writer_thread;
+       MonoNativeThreadId dumper_thread;
+       volatile gint32 run_writer_thread;
+       MonoLockFreeAllocSizeClass writer_entry_size_class;
+       MonoLockFreeAllocator writer_entry_allocator;
+       MonoLockFreeQueue writer_queue;
+       MonoSemType writer_queue_sem;
+       MonoConcurrentHashTable *method_table;
+       mono_mutex_t method_table_mutex;
+       volatile gint32 run_dumper_thread;
+       MonoLockFreeQueue dumper_queue;
+       MonoSemType dumper_queue_sem;
+       MonoLockFreeAllocSizeClass sample_size_class;
+       MonoLockFreeAllocator sample_allocator;
+       MonoLockFreeQueue sample_reuse_queue;
+       BinaryObject *binary_objects;
+       GPtrArray *coverage_filters;
+};
+
+typedef struct {
+       MonoLockFreeQueueNode node;
+       GPtrArray *methods;
+       LogBuffer *buffer;
+} WriterQueueEntry;
+
+#define WRITER_ENTRY_BLOCK_SIZE (mono_pagesize ())
+
+typedef struct {
+       MonoMethod *method;
+       MonoJitInfo *ji;
+       uint64_t time;
+} MethodInfo;
+
+#ifdef HOST_WIN32
+
+#define PROF_TLS_SET(VAL) (TlsSetValue (profiler_tls, (VAL)))
+#define PROF_TLS_GET() ((MonoProfilerThread *) TlsGetValue (profiler_tls))
+#define PROF_TLS_INIT() (profiler_tls = TlsAlloc ())
+#define PROF_TLS_FREE() (TlsFree (profiler_tls))
+
+static DWORD profiler_tls;
+
+#elif HAVE_KW_THREAD
+
+#define PROF_TLS_SET(VAL) (profiler_tls = (VAL))
+#define PROF_TLS_GET() (profiler_tls)
+#define PROF_TLS_INIT()
+#define PROF_TLS_FREE()
+
+static __thread MonoProfilerThread *profiler_tls;
+
+#else
+
+#define PROF_TLS_SET(VAL) (pthread_setspecific (profiler_tls, (VAL)))
+#define PROF_TLS_GET() ((MonoProfilerThread *) pthread_getspecific (profiler_tls))
+#define PROF_TLS_INIT() (pthread_key_create (&profiler_tls, NULL))
+#define PROF_TLS_FREE() (pthread_key_delete (profiler_tls))
+
+static pthread_key_t profiler_tls;
+
+#endif
+
+static char*
+pstrdup (const char *s)
+{
+       int len = strlen (s) + 1;
+       char *p = (char *) g_malloc (len);
+       memcpy (p, s, len);
+       return p;
+}
+
+static void *
+alloc_buffer (int size)
+{
+       return mono_valloc (NULL, size, MONO_MMAP_READ | MONO_MMAP_WRITE | MONO_MMAP_ANON | MONO_MMAP_PRIVATE, MONO_MEM_ACCOUNT_PROFILER);
+}
+
+static void
+free_buffer (void *buf, int size)
+{
+       mono_vfree (buf, size, MONO_MEM_ACCOUNT_PROFILER);
+}
+
+static LogBuffer*
+create_buffer (uintptr_t tid)
+{
+       LogBuffer* buf = (LogBuffer *) alloc_buffer (BUFFER_SIZE);
+
+       InterlockedIncrement (&buffer_allocations_ctr);
+
+       buf->size = BUFFER_SIZE;
+       buf->time_base = current_time ();
+       buf->last_time = buf->time_base;
+       buf->buf_end = (unsigned char *) buf + buf->size;
+       buf->cursor = buf->buf;
+       buf->thread_id = tid;
+
+       return buf;
+}
+
+/*
+ * Must be called with the reader lock held if thread is the current thread, or
+ * the exclusive lock if thread is a different thread. However, if thread is
+ * the current thread, and init_thread () was called with add_to_lls = FALSE,
+ * then no locking is necessary.
+ */
+static void
+init_buffer_state (MonoProfilerThread *thread)
+{
+       thread->buffer = create_buffer (thread->node.key);
+       thread->methods = NULL;
+}
+
+static void
+clear_hazard_pointers (MonoThreadHazardPointers *hp)
+{
+       mono_hazard_pointer_clear (hp, 0);
+       mono_hazard_pointer_clear (hp, 1);
+       mono_hazard_pointer_clear (hp, 2);
+}
+
+static MonoProfilerThread *
+init_thread (MonoProfiler *prof, gboolean add_to_lls)
+{
+       MonoProfilerThread *thread = PROF_TLS_GET ();
+
+       /*
+        * Sometimes we may try to initialize a thread twice. One example is the
+        * main thread: We initialize it when setting up the profiler, but we will
+        * also get a thread_start () callback for it. Another example is when
+        * attaching new threads to the runtime: We may get a gc_alloc () callback
+        * for that thread's thread object (where we initialize it), soon followed
+        * by a thread_start () callback.
+        *
+        * These cases are harmless anyhow. Just return if we've already done the
+        * initialization work.
+        */
+       if (thread)
+               return thread;
+
+       thread = g_malloc (sizeof (MonoProfilerThread));
+       thread->node.key = thread_id ();
+       thread->profiler = prof;
+       thread->attached = add_to_lls;
+       thread->call_depth = 0;
+       thread->busy = 0;
+       thread->ended = FALSE;
+
+       init_buffer_state (thread);
+
+       /*
+        * Some internal profiler threads don't need to be cleaned up
+        * by the main thread on shutdown.
+        */
+       if (add_to_lls) {
+               MonoThreadHazardPointers *hp = mono_hazard_pointer_get ();
+               g_assert (mono_lls_insert (&profiler_thread_list, hp, &thread->node) && "Why can't we insert the thread in the LLS?");
+               clear_hazard_pointers (hp);
+       }
+
+       PROF_TLS_SET (thread);
+
+       return thread;
+}
+
+// Only valid if init_thread () was called with add_to_lls = FALSE.
+static void
+deinit_thread (MonoProfilerThread *thread)
+{
+       g_assert (!thread->attached && "Why are we manually freeing an attached thread?");
+
+       g_free (thread);
+       PROF_TLS_SET (NULL);
+}
+
+// Only valid if init_thread () was called with add_to_lls = FALSE.
+static LogBuffer *
+ensure_logbuf_unsafe (MonoProfilerThread *thread, int bytes)
+{
+       LogBuffer *old = thread->buffer;
+
+       if (old && old->cursor + bytes + 100 < old->buf_end)
+               return old;
+
+       LogBuffer *new_ = create_buffer (thread->node.key);
+       new_->next = old;
+       thread->buffer = new_;
+
+       return new_;
+}
+
+static void
+encode_uleb128 (uint64_t value, uint8_t *buf, uint8_t **endbuf)
+{
+       uint8_t *p = buf;
+
+       do {
+               uint8_t b = value & 0x7f;
+               value >>= 7;
+
+               if (value != 0) /* more bytes to come */
+                       b |= 0x80;
+
+               *p ++ = b;
+       } while (value);
+
+       *endbuf = p;
+}
+
+static void
+encode_sleb128 (intptr_t value, uint8_t *buf, uint8_t **endbuf)
+{
+       int more = 1;
+       int negative = (value < 0);
+       unsigned int size = sizeof (intptr_t) * 8;
+       uint8_t byte;
+       uint8_t *p = buf;
+
+       while (more) {
+               byte = value & 0x7f;
+               value >>= 7;
+
+               /* the following is unnecessary if the
+                * implementation of >>= uses an arithmetic rather
+                * than logical shift for a signed left operand
+                */
+               if (negative)
+                       /* sign extend */
+                       value |= - ((intptr_t) 1 <<(size - 7));
+
+               /* sign bit of byte is second high order bit (0x40) */
+               if ((value == 0 && !(byte & 0x40)) ||
+                   (value == -1 && (byte & 0x40)))
+                       more = 0;
+               else
+                       byte |= 0x80;
+
+               *p ++= byte;
+       }
+
+       *endbuf = p;
+}
+
+static void
+emit_byte (LogBuffer *logbuffer, int value)
+{
+       logbuffer->cursor [0] = value;
+       logbuffer->cursor++;
+
+       g_assert (logbuffer->cursor <= logbuffer->buf_end && "Why are we writing past the buffer end?");
+}
+
+static void
+emit_value (LogBuffer *logbuffer, int value)
+{
+       encode_uleb128 (value, logbuffer->cursor, &logbuffer->cursor);
+
+       g_assert (logbuffer->cursor <= logbuffer->buf_end && "Why are we writing past the buffer end?");
+}
+
+static void
+emit_time (LogBuffer *logbuffer, uint64_t value)
+{
+       uint64_t tdiff = value - logbuffer->last_time;
+       encode_uleb128 (tdiff, logbuffer->cursor, &logbuffer->cursor);
+       logbuffer->last_time = value;
+
+       g_assert (logbuffer->cursor <= logbuffer->buf_end && "Why are we writing past the buffer end?");
+}
+
+static void
+emit_event_time (LogBuffer *logbuffer, int event, uint64_t time)
+{
+       emit_byte (logbuffer, event);
+       emit_time (logbuffer, time);
+}
+
+static void
+emit_event (LogBuffer *logbuffer, int event)
+{
+       emit_event_time (logbuffer, event, current_time ());
+}
+
+static void
+emit_svalue (LogBuffer *logbuffer, int64_t value)
+{
+       encode_sleb128 (value, logbuffer->cursor, &logbuffer->cursor);
+
+       g_assert (logbuffer->cursor <= logbuffer->buf_end && "Why are we writing past the buffer end?");
+}
+
+static void
+emit_uvalue (LogBuffer *logbuffer, uint64_t value)
+{
+       encode_uleb128 (value, logbuffer->cursor, &logbuffer->cursor);
+
+       g_assert (logbuffer->cursor <= logbuffer->buf_end && "Why are we writing past the buffer end?");
+}
+
+static void
+emit_ptr (LogBuffer *logbuffer, void *ptr)
+{
+       if (!logbuffer->ptr_base)
+               logbuffer->ptr_base = (uintptr_t) ptr;
+
+       emit_svalue (logbuffer, (intptr_t) ptr - logbuffer->ptr_base);
+
+       g_assert (logbuffer->cursor <= logbuffer->buf_end && "Why are we writing past the buffer end?");
+}
+
+static void
+emit_method_inner (LogBuffer *logbuffer, void *method)
+{
+       if (!logbuffer->method_base) {
+               logbuffer->method_base = (intptr_t) method;
+               logbuffer->last_method = (intptr_t) method;
+       }
+
+       encode_sleb128 ((intptr_t) ((char *) method - (char *) logbuffer->last_method), logbuffer->cursor, &logbuffer->cursor);
+       logbuffer->last_method = (intptr_t) method;
+
+       g_assert (logbuffer->cursor <= logbuffer->buf_end && "Why are we writing past the buffer end?");
+}
+
+static void
+register_method_local (MonoMethod *method, MonoJitInfo *ji)
+{
+       MonoProfilerThread *thread = PROF_TLS_GET ();
+
+       if (!mono_conc_hashtable_lookup (thread->profiler->method_table, method)) {
+               MethodInfo *info = (MethodInfo *) g_malloc (sizeof (MethodInfo));
+
+               info->method = method;
+               info->ji = ji;
+               info->time = current_time ();
+
+               GPtrArray *arr = thread->methods ? thread->methods : (thread->methods = g_ptr_array_new ());
+               g_ptr_array_add (arr, info);
+       }
+}
+
+static void
+emit_method (LogBuffer *logbuffer, MonoMethod *method)
+{
+       register_method_local (method, NULL);
+       emit_method_inner (logbuffer, method);
+}
+
+static void
+emit_obj (LogBuffer *logbuffer, void *ptr)
+{
+       if (!logbuffer->obj_base)
+               logbuffer->obj_base = (uintptr_t) ptr >> 3;
+
+       emit_svalue (logbuffer, ((uintptr_t) ptr >> 3) - logbuffer->obj_base);
+
+       g_assert (logbuffer->cursor <= logbuffer->buf_end && "Why are we writing past the buffer end?");
+}
+
+static void
+emit_string (LogBuffer *logbuffer, const char *str, size_t size)
+{
+       size_t i = 0;
+       if (str) {
+               for (; i < size; i++) {
+                       if (str[i] == '\0')
+                               break;
+                       emit_byte (logbuffer, str [i]);
+               }
+       }
+       emit_byte (logbuffer, '\0');
+}
+
+static void
+emit_double (LogBuffer *logbuffer, double value)
+{
+       int i;
+       unsigned char buffer[8];
+       memcpy (buffer, &value, 8);
+#if G_BYTE_ORDER == G_BIG_ENDIAN
+       for (i = 7; i >= 0; i--)
+#else
+       for (i = 0; i < 8; i++)
+#endif
+               emit_byte (logbuffer, buffer[i]);
+}
+
+static char*
+write_int16 (char *buf, int32_t value)
+{
+       int i;
+       for (i = 0; i < 2; ++i) {
+               buf [i] = value;
+               value >>= 8;
+       }
+       return buf + 2;
+}
+
+static char*
+write_int32 (char *buf, int32_t value)
+{
+       int i;
+       for (i = 0; i < 4; ++i) {
+               buf [i] = value;
+               value >>= 8;
+       }
+       return buf + 4;
+}
+
+static char*
+write_int64 (char *buf, int64_t value)
+{
+       int i;
+       for (i = 0; i < 8; ++i) {
+               buf [i] = value;
+               value >>= 8;
+       }
+       return buf + 8;
+}
+
+static char *
+write_header_string (char *p, const char *str)
+{
+       size_t len = strlen (str) + 1;
+
+       p = write_int32 (p, len);
+       strcpy (p, str);
+
+       return p + len;
+}
+
+static void
+dump_header (MonoProfiler *profiler)
+{
+       const char *args = profiler->args;
+       const char *arch = mono_config_get_cpu ();
+       const char *os = mono_config_get_os ();
+
+       char *hbuf = g_malloc (
+               sizeof (gint32) /* header id */ +
+               sizeof (gint8) /* major version */ +
+               sizeof (gint8) /* minor version */ +
+               sizeof (gint8) /* data version */ +
+               sizeof (gint8) /* word size */ +
+               sizeof (gint64) /* startup time */ +
+               sizeof (gint32) /* timer overhead */ +
+               sizeof (gint32) /* flags */ +
+               sizeof (gint32) /* process id */ +
+               sizeof (gint16) /* command port */ +
+               sizeof (gint32) + strlen (args) + 1 /* arguments */ +
+               sizeof (gint32) + strlen (arch) + 1 /* architecture */ +
+               sizeof (gint32) + strlen (os) + 1 /* operating system */
+       );
+       char *p = hbuf;
+
+       p = write_int32 (p, LOG_HEADER_ID);
+       *p++ = LOG_VERSION_MAJOR;
+       *p++ = LOG_VERSION_MINOR;
+       *p++ = LOG_DATA_VERSION;
+       *p++ = sizeof (void *);
+       p = write_int64 (p, ((uint64_t) time (NULL)) * 1000);
+       p = write_int32 (p, timer_overhead);
+       p = write_int32 (p, 0); /* flags */
+       p = write_int32 (p, process_id ());
+       p = write_int16 (p, profiler->command_port);
+       p = write_header_string (p, args);
+       p = write_header_string (p, arch);
+       p = write_header_string (p, os);
+
+#if defined (HAVE_SYS_ZLIB)
+       if (profiler->gzfile) {
+               gzwrite (profiler->gzfile, hbuf, p - hbuf);
+       } else
+#endif
+       {
+               fwrite (hbuf, p - hbuf, 1, profiler->file);
+               fflush (profiler->file);
+       }
+
+       g_free (hbuf);
+}
+
+/*
+ * Must be called with the reader lock held if thread is the current thread, or
+ * the exclusive lock if thread is a different thread. However, if thread is
+ * the current thread, and init_thread () was called with add_to_lls = FALSE,
+ * then no locking is necessary.
+ */
+static void
+send_buffer (MonoProfilerThread *thread)
+{
+       WriterQueueEntry *entry = mono_lock_free_alloc (&thread->profiler->writer_entry_allocator);
+       entry->methods = thread->methods;
+       entry->buffer = thread->buffer;
+
+       mono_lock_free_queue_node_init (&entry->node, FALSE);
+
+       mono_lock_free_queue_enqueue (&thread->profiler->writer_queue, &entry->node);
+       mono_os_sem_post (&thread->profiler->writer_queue_sem);
+}
+
+static void
+free_thread (gpointer p)
+{
+       MonoProfilerThread *thread = p;
+
+       if (!thread->ended) {
+               /*
+                * The thread is being cleaned up by the main thread during
+                * shutdown. This typically happens for internal runtime
+                * threads. We need to synthesize a thread end event.
+                */
+
+               InterlockedIncrement (&thread_ends_ctr);
+
+               LogBuffer *buf = ensure_logbuf_unsafe (thread,
+                       EVENT_SIZE /* event */ +
+                       BYTE_SIZE /* type */ +
+                       LEB128_SIZE /* tid */
+               );
+
+               emit_event (buf, TYPE_END_UNLOAD | TYPE_METADATA);
+               emit_byte (buf, TYPE_THREAD);
+               emit_ptr (buf, (void *) thread->node.key);
+       }
+
+       send_buffer (thread);
+
+       g_free (thread);
+}
+
+static void
+remove_thread (MonoProfilerThread *thread)
+{
+       MonoThreadHazardPointers *hp = mono_hazard_pointer_get ();
+
+       if (mono_lls_remove (&profiler_thread_list, hp, &thread->node))
+               mono_thread_hazardous_try_free (thread, free_thread);
+
+       clear_hazard_pointers (hp);
+}
+
+static void
+dump_buffer (MonoProfiler *profiler, LogBuffer *buf)
+{
+       char hbuf [128];
+       char *p = hbuf;
+
+       if (buf->next)
+               dump_buffer (profiler, buf->next);
+
+       if (buf->cursor - buf->buf) {
+               p = write_int32 (p, BUF_ID);
+               p = write_int32 (p, buf->cursor - buf->buf);
+               p = write_int64 (p, buf->time_base);
+               p = write_int64 (p, buf->ptr_base);
+               p = write_int64 (p, buf->obj_base);
+               p = write_int64 (p, buf->thread_id);
+               p = write_int64 (p, buf->method_base);
+
+#if defined (HAVE_SYS_ZLIB)
+               if (profiler->gzfile) {
+                       gzwrite (profiler->gzfile, hbuf, p - hbuf);
+                       gzwrite (profiler->gzfile, buf->buf, buf->cursor - buf->buf);
+               } else
+#endif
+               {
+                       fwrite (hbuf, p - hbuf, 1, profiler->file);
+                       fwrite (buf->buf, buf->cursor - buf->buf, 1, profiler->file);
+                       fflush (profiler->file);
+               }
+       }
+
+       free_buffer (buf, buf->size);
+}
+
+static void
+dump_buffer_threadless (MonoProfiler *profiler, LogBuffer *buf)
+{
+       for (LogBuffer *iter = buf; iter; iter = iter->next)
+               iter->thread_id = 0;
+
+       dump_buffer (profiler, buf);
+}
+
+static void
+process_requests (void)
+{
+       if (heapshot_requested)
+               mono_gc_collect (mono_gc_max_generation ());
+}
+
+// Only valid if init_thread () was called with add_to_lls = FALSE.
+static void
+send_log_unsafe (gboolean if_needed)
+{
+       MonoProfilerThread *thread = PROF_TLS_GET ();
+
+       if (!if_needed || (if_needed && thread->buffer->next)) {
+               if (!thread->attached)
+                       for (LogBuffer *iter = thread->buffer; iter; iter = iter->next)
+                               iter->thread_id = 0;
+
+               send_buffer (thread);
+               init_buffer_state (thread);
+       }
+}
+
+// Assumes that the exclusive lock is held.
+static void
+sync_point_flush (void)
+{
+       g_assert (InterlockedReadPointer (&buffer_rwlock_exclusive) == (gpointer) thread_id () && "Why don't we hold the exclusive lock?");
+
+       MONO_LLS_FOREACH_SAFE (&profiler_thread_list, MonoProfilerThread, thread) {
+               g_assert (thread->attached && "Why is a thread in the LLS not attached?");
+
+               send_buffer (thread);
+               init_buffer_state (thread);
+       } MONO_LLS_FOREACH_SAFE_END
+}
+
+// Assumes that the exclusive lock is held.
+static void
+sync_point_mark (MonoProfilerSyncPointType type)
+{
+       g_assert (InterlockedReadPointer (&buffer_rwlock_exclusive) == (gpointer) thread_id () && "Why don't we hold the exclusive lock?");
+
+       ENTER_LOG (&sync_points_ctr, logbuffer,
+               EVENT_SIZE /* event */ +
+               LEB128_SIZE /* type */
+       );
+
+       emit_event (logbuffer, TYPE_META | TYPE_SYNC_POINT);
+       emit_byte (logbuffer, type);
+
+       EXIT_LOG_EXPLICIT (NO_SEND, NO_REQUESTS);
+
+       send_log_unsafe (FALSE);
+}
+
+// Assumes that the exclusive lock is held.
+static void
+sync_point (MonoProfilerSyncPointType type)
+{
+       sync_point_flush ();
+       sync_point_mark (type);
+}
+
+static int
+gc_reference (MonoObject *obj, MonoClass *klass, uintptr_t size, uintptr_t num, MonoObject **refs, uintptr_t *offsets, void *data)
+{
+       /* account for object alignment in the heap */
+       size += 7;
+       size &= ~7;
+
+       ENTER_LOG (&heap_objects_ctr, logbuffer,
+               EVENT_SIZE /* event */ +
+               LEB128_SIZE /* obj */ +
+               LEB128_SIZE /* klass */ +
+               LEB128_SIZE /* size */ +
+               LEB128_SIZE /* num */ +
+               num * (
+                       LEB128_SIZE /* offset */ +
+                       LEB128_SIZE /* ref */
+               )
+       );
+
+       emit_event (logbuffer, TYPE_HEAP_OBJECT | TYPE_HEAP);
+       emit_obj (logbuffer, obj);
+       emit_ptr (logbuffer, klass);
+       emit_value (logbuffer, size);
+       emit_value (logbuffer, num);
+
+       uintptr_t last_offset = 0;
+
+       for (int i = 0; i < num; ++i) {
+               emit_value (logbuffer, offsets [i] - last_offset);
+               last_offset = offsets [i];
+               emit_obj (logbuffer, refs [i]);
+       }
+
+       EXIT_LOG_EXPLICIT (DO_SEND, NO_REQUESTS);
+
+       return 0;
+}
+
+static unsigned int hs_mode_ms = 0;
+static unsigned int hs_mode_gc = 0;
+static unsigned int hs_mode_ondemand = 0;
+static unsigned int gc_count = 0;
+static uint64_t last_hs_time = 0;
+static gboolean do_heap_walk = FALSE;
+
+static void
+heap_walk (MonoProfiler *profiler)
+{
+       ENTER_LOG (&heap_starts_ctr, logbuffer,
+               EVENT_SIZE /* event */
+       );
+
+       emit_event (logbuffer, TYPE_HEAP_START | TYPE_HEAP);
+
+       EXIT_LOG_EXPLICIT (DO_SEND, NO_REQUESTS);
+
+       mono_gc_walk_heap (0, gc_reference, NULL);
+
+       ENTER_LOG (&heap_ends_ctr, logbuffer,
+               EVENT_SIZE /* event */
+       );
+
+       emit_event (logbuffer, TYPE_HEAP_END | TYPE_HEAP);
+
+       EXIT_LOG_EXPLICIT (DO_SEND, NO_REQUESTS);
+}
+
+static void
+gc_roots (MonoProfiler *prof, int num, void **objects, int *root_types, uintptr_t *extra_info)
+{
+       ENTER_LOG (&heap_roots_ctr, logbuffer,
+               EVENT_SIZE /* event */ +
+               LEB128_SIZE /* num */ +
+               LEB128_SIZE /* collections */ +
+               num * (
+                       LEB128_SIZE /* object */ +
+                       LEB128_SIZE /* root type */ +
+                       LEB128_SIZE /* extra info */
+               )
+       );
+
+       emit_event (logbuffer, TYPE_HEAP_ROOT | TYPE_HEAP);
+       emit_value (logbuffer, num);
+       emit_value (logbuffer, mono_gc_collection_count (mono_gc_max_generation ()));
+
+       for (int i = 0; i < num; ++i) {
+               emit_obj (logbuffer, objects [i]);
+               emit_byte (logbuffer, root_types [i]);
+               emit_value (logbuffer, extra_info [i]);
+       }
+
+       EXIT_LOG_EXPLICIT (DO_SEND, NO_REQUESTS);
+}
+
+static void
+gc_event (MonoProfiler *profiler, MonoGCEvent ev, int generation)
+{
+       ENTER_LOG (&gc_events_ctr, logbuffer,
+               EVENT_SIZE /* event */ +
+               BYTE_SIZE /* gc event */ +
+               BYTE_SIZE /* generation */
+       );
+
+       emit_event (logbuffer, TYPE_GC_EVENT | TYPE_GC);
+       emit_byte (logbuffer, ev);
+       emit_byte (logbuffer, generation);
+
+       EXIT_LOG_EXPLICIT (NO_SEND, NO_REQUESTS);
+
+       switch (ev) {
+       case MONO_GC_EVENT_START:
+               if (generation == mono_gc_max_generation ())
+                       gc_count++;
+
+               uint64_t now = current_time ();
+
+               if (hs_mode_ms && (now - last_hs_time) / 1000 * 1000 >= hs_mode_ms)
+                       do_heap_walk = TRUE;
+               else if (hs_mode_gc && !(gc_count % hs_mode_gc))
+                       do_heap_walk = TRUE;
+               else if (hs_mode_ondemand)
+                       do_heap_walk = heapshot_requested;
+               else if (!hs_mode_ms && !hs_mode_gc && generation == mono_gc_max_generation ())
+                       do_heap_walk = TRUE;
+               break;
+       case MONO_GC_EVENT_PRE_STOP_WORLD_LOCKED:
+               /*
+                * Ensure that no thread can be in the middle of writing to
+                * a buffer when the world stops...
+                */
+               buffer_lock_excl ();
+               break;
+       case MONO_GC_EVENT_POST_STOP_WORLD:
+               /*
+                * ... So that we now have a consistent view of all buffers.
+                * This allows us to flush them. We need to do this because
+                * they may contain object allocation events that need to be
+                * committed to the log file before any object move events
+                * that will be produced during this GC.
+                */
+               sync_point (SYNC_POINT_WORLD_STOP);
+               break;
+       case MONO_GC_EVENT_PRE_START_WORLD:
+               if (do_heap_shot && do_heap_walk) {
+                       heap_walk (profiler);
+
+                       do_heap_walk = FALSE;
+                       heapshot_requested = 0;
+                       last_hs_time = current_time ();
+               }
+               break;
+       case MONO_GC_EVENT_POST_START_WORLD_UNLOCKED:
+               /*
+                * Similarly, we must now make sure that any object moves
+                * written to the GC thread's buffer are flushed. Otherwise,
+                * object allocation events for certain addresses could come
+                * after the move events that made those addresses available.
+                */
+               sync_point_mark (SYNC_POINT_WORLD_START);
+
+               /*
+                * Finally, it is safe to allow other threads to write to
+                * their buffers again.
+                */
+               buffer_unlock_excl ();
+               break;
+       default:
+               break;
+       }
+}
+
+static void
+gc_resize (MonoProfiler *profiler, int64_t new_size)
+{
+       ENTER_LOG (&gc_resizes_ctr, logbuffer,
+               EVENT_SIZE /* event */ +
+               LEB128_SIZE /* new size */
+       );
+
+       emit_event (logbuffer, TYPE_GC_RESIZE | TYPE_GC);
+       emit_value (logbuffer, new_size);
+
+       EXIT_LOG_EXPLICIT (DO_SEND, NO_REQUESTS);
+}
+
+// If you alter MAX_FRAMES, you may need to alter SAMPLE_BLOCK_SIZE too.
+#define MAX_FRAMES 32
+
+typedef struct {
+       int count;
+       MonoMethod* methods [MAX_FRAMES];
+       int32_t il_offsets [MAX_FRAMES];
+       int32_t native_offsets [MAX_FRAMES];
+} FrameData;
+
+static int num_frames = MAX_FRAMES;
+
+static mono_bool
+walk_stack (MonoMethod *method, int32_t native_offset, int32_t il_offset, mono_bool managed, void* data)
+{
+       FrameData *frame = (FrameData *)data;
+       if (method && frame->count < num_frames) {
+               frame->il_offsets [frame->count] = il_offset;
+               frame->native_offsets [frame->count] = native_offset;
+               frame->methods [frame->count++] = method;
+               //printf ("In %d %s at %d (native: %d)\n", frame->count, mono_method_get_name (method), il_offset, native_offset);
+       }
+       return frame->count == num_frames;
+}
+
+/*
+ * a note about stack walks: they can cause more profiler events to fire,
+ * so we need to make sure they don't happen after we started emitting an
+ * event, hence the collect_bt/emit_bt split.
+ */
+static void
+collect_bt (FrameData *data)
+{
+       data->count = 0;
+       mono_stack_walk_no_il (walk_stack, data);
+}
+
+static void
+emit_bt (MonoProfiler *prof, LogBuffer *logbuffer, FrameData *data)
+{
+       /* FIXME: this is actually tons of data and we should
+        * just output it the first time and use an id the next
+        */
+       if (data->count > num_frames)
+               printf ("bad num frames: %d\n", data->count);
+       emit_value (logbuffer, data->count);
+       //if (*p != data.count) {
+       //      printf ("bad num frames enc at %d: %d -> %d\n", count, data.count, *p); printf ("frames end: %p->%p\n", p, logbuffer->cursor); exit(0);}
+       while (data->count) {
+               emit_method (logbuffer, data->methods [--data->count]);
+       }
+}
+
+static void
+gc_alloc (MonoProfiler *prof, MonoObject *obj, MonoClass *klass)
+{
+       init_thread (prof, TRUE);
+
+       int do_bt = (nocalls && InterlockedRead (&runtime_inited) && !notraces) ? TYPE_ALLOC_BT : 0;
+       FrameData data;
+       uintptr_t len = mono_object_get_size (obj);
+       /* account for object alignment in the heap */
+       len += 7;
+       len &= ~7;
+
+       if (do_bt)
+               collect_bt (&data);
+
+       ENTER_LOG (&gc_allocs_ctr, logbuffer,
+               EVENT_SIZE /* event */ +
+               LEB128_SIZE /* klass */ +
+               LEB128_SIZE /* obj */ +
+               LEB128_SIZE /* size */ +
+               (do_bt ? (
+                       LEB128_SIZE /* count */ +
+                       data.count * (
+                               LEB128_SIZE /* method */
+                       )
+               ) : 0)
+       );
+
+       emit_event (logbuffer, do_bt | TYPE_ALLOC);
+       emit_ptr (logbuffer, klass);
+       emit_obj (logbuffer, obj);
+       emit_value (logbuffer, len);
+
+       if (do_bt)
+               emit_bt (prof, logbuffer, &data);
+
+       EXIT_LOG;
+}
+
+static void
+gc_moves (MonoProfiler *prof, void **objects, int num)
+{
+       ENTER_LOG (&gc_moves_ctr, logbuffer,
+               EVENT_SIZE /* event */ +
+               LEB128_SIZE /* num */ +
+               num * (
+                       LEB128_SIZE /* object */
+               )
+       );
+
+       emit_event (logbuffer, TYPE_GC_MOVE | TYPE_GC);
+       emit_value (logbuffer, num);
+
+       for (int i = 0; i < num; ++i)
+               emit_obj (logbuffer, objects [i]);
+
+       EXIT_LOG_EXPLICIT (DO_SEND, NO_REQUESTS);
+}
+
+static void
+gc_handle (MonoProfiler *prof, int op, int type, uintptr_t handle, MonoObject *obj)
+{
+       int do_bt = nocalls && InterlockedRead (&runtime_inited) && !notraces;
+       FrameData data;
+
+       if (do_bt)
+               collect_bt (&data);
+
+       gint32 *ctr = op == MONO_PROFILER_GC_HANDLE_CREATED ? &gc_handle_creations_ctr : &gc_handle_deletions_ctr;
+
+       ENTER_LOG (ctr, logbuffer,
+               EVENT_SIZE /* event */ +
+               LEB128_SIZE /* type */ +
+               LEB128_SIZE /* handle */ +
+               (op == MONO_PROFILER_GC_HANDLE_CREATED ? (
+                       LEB128_SIZE /* obj */
+               ) : 0) +
+               (do_bt ? (
+                       LEB128_SIZE /* count */ +
+                       data.count * (
+                               LEB128_SIZE /* method */
+                       )
+               ) : 0)
+       );
+
+       if (op == MONO_PROFILER_GC_HANDLE_CREATED)
+               emit_event (logbuffer, (do_bt ? TYPE_GC_HANDLE_CREATED_BT : TYPE_GC_HANDLE_CREATED) | TYPE_GC);
+       else if (op == MONO_PROFILER_GC_HANDLE_DESTROYED)
+               emit_event (logbuffer, (do_bt ? TYPE_GC_HANDLE_DESTROYED_BT : TYPE_GC_HANDLE_DESTROYED) | TYPE_GC);
+       else
+               g_assert_not_reached ();
+
+       emit_value (logbuffer, type);
+       emit_value (logbuffer, handle);
+
+       if (op == MONO_PROFILER_GC_HANDLE_CREATED)
+               emit_obj (logbuffer, obj);
+
+       if (do_bt)
+               emit_bt (prof, logbuffer, &data);
+
+       EXIT_LOG;
+}
+
+static void
+finalize_begin (MonoProfiler *prof)
+{
+       ENTER_LOG (&finalize_begins_ctr, buf,
+               EVENT_SIZE /* event */
+       );
+
+       emit_event (buf, TYPE_GC_FINALIZE_START | TYPE_GC);
+
+       EXIT_LOG;
+}
+
+static void
+finalize_end (MonoProfiler *prof)
+{
+       ENTER_LOG (&finalize_ends_ctr, buf,
+               EVENT_SIZE /* event */
+       );
+
+       emit_event (buf, TYPE_GC_FINALIZE_END | TYPE_GC);
+
+       EXIT_LOG;
+}
+
+static void
+finalize_object_begin (MonoProfiler *prof, MonoObject *obj)
+{
+       ENTER_LOG (&finalize_object_begins_ctr, buf,
+               EVENT_SIZE /* event */ +
+               LEB128_SIZE /* obj */
+       );
+
+       emit_event (buf, TYPE_GC_FINALIZE_OBJECT_START | TYPE_GC);
+       emit_obj (buf, obj);
+
+       EXIT_LOG;
+}
+
+static void
+finalize_object_end (MonoProfiler *prof, MonoObject *obj)
+{
+       ENTER_LOG (&finalize_object_ends_ctr, buf,
+               EVENT_SIZE /* event */ +
+               LEB128_SIZE /* obj */
+       );
+
+       emit_event (buf, TYPE_GC_FINALIZE_OBJECT_END | TYPE_GC);
+       emit_obj (buf, obj);
+
+       EXIT_LOG;
+}
+
+static char*
+push_nesting (char *p, MonoClass *klass)
+{
+       MonoClass *nesting;
+       const char *name;
+       const char *nspace;
+       nesting = mono_class_get_nesting_type (klass);
+       if (nesting) {
+               p = push_nesting (p, nesting);
+               *p++ = '/';
+               *p = 0;
+       }
+       name = mono_class_get_name (klass);
+       nspace = mono_class_get_namespace (klass);
+       if (*nspace) {
+               strcpy (p, nspace);
+               p += strlen (nspace);
+               *p++ = '.';
+               *p = 0;
+       }
+       strcpy (p, name);
+       p += strlen (name);
+       return p;
+}
+
+static char*
+type_name (MonoClass *klass)
+{
+       char buf [1024];
+       char *p;
+       push_nesting (buf, klass);
+       p = (char *) g_malloc (strlen (buf) + 1);
+       strcpy (p, buf);
+       return p;
+}
+
+static void
+image_loaded (MonoProfiler *prof, MonoImage *image, int result)
+{
+       if (result != MONO_PROFILE_OK)
+               return;
+
+       const char *name = mono_image_get_filename (image);
+       int nlen = strlen (name) + 1;
+
+       ENTER_LOG (&image_loads_ctr, logbuffer,
+               EVENT_SIZE /* event */ +
+               BYTE_SIZE /* type */ +
+               LEB128_SIZE /* image */ +
+               nlen /* name */
+       );
+
+       emit_event (logbuffer, TYPE_END_LOAD | TYPE_METADATA);
+       emit_byte (logbuffer, TYPE_IMAGE);
+       emit_ptr (logbuffer, image);
+       memcpy (logbuffer->cursor, name, nlen);
+       logbuffer->cursor += nlen;
+
+       EXIT_LOG;
+}
+
+static void
+image_unloaded (MonoProfiler *prof, MonoImage *image)
+{
+       const char *name = mono_image_get_filename (image);
+       int nlen = strlen (name) + 1;
+
+       ENTER_LOG (&image_unloads_ctr, logbuffer,
+               EVENT_SIZE /* event */ +
+               BYTE_SIZE /* type */ +
+               LEB128_SIZE /* image */ +
+               nlen /* name */
+       );
+
+       emit_event (logbuffer, TYPE_END_UNLOAD | TYPE_METADATA);
+       emit_byte (logbuffer, TYPE_IMAGE);
+       emit_ptr (logbuffer, image);
+       memcpy (logbuffer->cursor, name, nlen);
+       logbuffer->cursor += nlen;
+
+       EXIT_LOG;
+}
+
+static void
+assembly_loaded (MonoProfiler *prof, MonoAssembly *assembly, int result)
+{
+       if (result != MONO_PROFILE_OK)
+               return;
+
+       char *name = mono_stringify_assembly_name (mono_assembly_get_name (assembly));
+       int nlen = strlen (name) + 1;
+
+       ENTER_LOG (&assembly_loads_ctr, logbuffer,
+               EVENT_SIZE /* event */ +
+               BYTE_SIZE /* type */ +
+               LEB128_SIZE /* assembly */ +
+               nlen /* name */
+       );
+
+       emit_event (logbuffer, TYPE_END_LOAD | TYPE_METADATA);
+       emit_byte (logbuffer, TYPE_ASSEMBLY);
+       emit_ptr (logbuffer, assembly);
+       memcpy (logbuffer->cursor, name, nlen);
+       logbuffer->cursor += nlen;
+
+       EXIT_LOG;
+
+       mono_free (name);
+}
+
+static void
+assembly_unloaded (MonoProfiler *prof, MonoAssembly *assembly)
+{
+       char *name = mono_stringify_assembly_name (mono_assembly_get_name (assembly));
+       int nlen = strlen (name) + 1;
+
+       ENTER_LOG (&assembly_unloads_ctr, logbuffer,
+               EVENT_SIZE /* event */ +
+               BYTE_SIZE /* type */ +
+               LEB128_SIZE /* assembly */ +
+               nlen /* name */
+       );
+
+       emit_event (logbuffer, TYPE_END_UNLOAD | TYPE_METADATA);
+       emit_byte (logbuffer, TYPE_ASSEMBLY);
+       emit_ptr (logbuffer, assembly);
+       memcpy (logbuffer->cursor, name, nlen);
+       logbuffer->cursor += nlen;
+
+       EXIT_LOG;
+
+       mono_free (name);
+}
+
+static void
+class_loaded (MonoProfiler *prof, MonoClass *klass, int result)
+{
+       if (result != MONO_PROFILE_OK)
+               return;
+
+       char *name;
+
+       if (InterlockedRead (&runtime_inited))
+               name = mono_type_get_name (mono_class_get_type (klass));
+       else
+               name = type_name (klass);
+
+       int nlen = strlen (name) + 1;
+       MonoImage *image = mono_class_get_image (klass);
+
+       ENTER_LOG (&class_loads_ctr, logbuffer,
+               EVENT_SIZE /* event */ +
+               BYTE_SIZE /* type */ +
+               LEB128_SIZE /* klass */ +
+               LEB128_SIZE /* image */ +
+               nlen /* name */
+       );
+
+       emit_event (logbuffer, TYPE_END_LOAD | TYPE_METADATA);
+       emit_byte (logbuffer, TYPE_CLASS);
+       emit_ptr (logbuffer, klass);
+       emit_ptr (logbuffer, image);
+       memcpy (logbuffer->cursor, name, nlen);
+       logbuffer->cursor += nlen;
+
+       EXIT_LOG;
+
+       if (runtime_inited)
+               mono_free (name);
+       else
+               g_free (name);
+}
+
+static void
+class_unloaded (MonoProfiler *prof, MonoClass *klass)
+{
+       char *name;
+
+       if (InterlockedRead (&runtime_inited))
+               name = mono_type_get_name (mono_class_get_type (klass));
+       else
+               name = type_name (klass);
+
+       int nlen = strlen (name) + 1;
+       MonoImage *image = mono_class_get_image (klass);
+
+       ENTER_LOG (&class_unloads_ctr, logbuffer,
+               EVENT_SIZE /* event */ +
+               BYTE_SIZE /* type */ +
+               LEB128_SIZE /* klass */ +
+               LEB128_SIZE /* image */ +
+               nlen /* name */
+       );
+
+       emit_event (logbuffer, TYPE_END_UNLOAD | TYPE_METADATA);
+       emit_byte (logbuffer, TYPE_CLASS);
+       emit_ptr (logbuffer, klass);
+       emit_ptr (logbuffer, image);
+       memcpy (logbuffer->cursor, name, nlen);
+       logbuffer->cursor += nlen;
+
+       EXIT_LOG;
+
+       if (runtime_inited)
+               mono_free (name);
+       else
+               g_free (name);
+}
+
+static void process_method_enter_coverage (MonoProfiler *prof, MonoMethod *method);
+
+static void
+method_enter (MonoProfiler *prof, MonoMethod *method)
+{
+       process_method_enter_coverage (prof, method);
+
+       if (!only_coverage && PROF_TLS_GET ()->call_depth++ <= max_call_depth) {
+               ENTER_LOG (&method_entries_ctr, logbuffer,
+                       EVENT_SIZE /* event */ +
+                       LEB128_SIZE /* method */
+               );
+
+               emit_event (logbuffer, TYPE_ENTER | TYPE_METHOD);
+               emit_method (logbuffer, method);
+
+               EXIT_LOG;
+       }
+}
+
+static void
+method_leave (MonoProfiler *prof, MonoMethod *method)
+{
+       if (!only_coverage && --PROF_TLS_GET ()->call_depth <= max_call_depth) {
+               ENTER_LOG (&method_exits_ctr, logbuffer,
+                       EVENT_SIZE /* event */ +
+                       LEB128_SIZE /* method */
+               );
+
+               emit_event (logbuffer, TYPE_LEAVE | TYPE_METHOD);
+               emit_method (logbuffer, method);
+
+               EXIT_LOG;
+       }
+}
+
+static void
+method_exc_leave (MonoProfiler *prof, MonoMethod *method)
+{
+       if (!only_coverage && !nocalls && --PROF_TLS_GET ()->call_depth <= max_call_depth) {
+               ENTER_LOG (&method_exception_exits_ctr, logbuffer,
+                       EVENT_SIZE /* event */ +
+                       LEB128_SIZE /* method */
+               );
+
+               emit_event (logbuffer, TYPE_EXC_LEAVE | TYPE_METHOD);
+               emit_method (logbuffer, method);
+
+               EXIT_LOG;
+       }
+}
+
+static void
+method_jitted (MonoProfiler *prof, MonoMethod *method, MonoJitInfo *ji, int result)
+{
+       if (result != MONO_PROFILE_OK)
+               return;
+
+       register_method_local (method, ji);
+
+       process_requests ();
+}
+
+static void
+code_buffer_new (MonoProfiler *prof, void *buffer, int size, MonoProfilerCodeBufferType type, void *data)
+{
+       char *name;
+       int nlen;
+
+       if (type == MONO_PROFILER_CODE_BUFFER_SPECIFIC_TRAMPOLINE) {
+               name = (char *) data;
+               nlen = strlen (name) + 1;
+       } else {
+               name = NULL;
+               nlen = 0;
+       }
+
+       ENTER_LOG (&code_buffers_ctr, logbuffer,
+               EVENT_SIZE /* event */ +
+               BYTE_SIZE /* type */ +
+               LEB128_SIZE /* buffer */ +
+               LEB128_SIZE /* size */ +
+               (name ? (
+                       nlen /* name */
+               ) : 0)
+       );
+
+       emit_event (logbuffer, TYPE_JITHELPER | TYPE_RUNTIME);
+       emit_byte (logbuffer, type);
+       emit_ptr (logbuffer, buffer);
+       emit_value (logbuffer, size);
+
+       if (name) {
+               memcpy (logbuffer->cursor, name, nlen);
+               logbuffer->cursor += nlen;
+       }
+
+       EXIT_LOG;
+}
+
+static void
+throw_exc (MonoProfiler *prof, MonoObject *object)
+{
+       int do_bt = (nocalls && InterlockedRead (&runtime_inited) && !notraces) ? TYPE_THROW_BT : 0;
+       FrameData data;
+
+       if (do_bt)
+               collect_bt (&data);
+
+       ENTER_LOG (&exception_throws_ctr, logbuffer,
+               EVENT_SIZE /* event */ +
+               LEB128_SIZE /* object */ +
+               (do_bt ? (
+                       LEB128_SIZE /* count */ +
+                       data.count * (
+                               LEB128_SIZE /* method */
+                       )
+               ) : 0)
+       );
+
+       emit_event (logbuffer, do_bt | TYPE_EXCEPTION);
+       emit_obj (logbuffer, object);
+
+       if (do_bt)
+               emit_bt (prof, logbuffer, &data);
+
+       EXIT_LOG;
+}
+
+static void
+clause_exc (MonoProfiler *prof, MonoMethod *method, int clause_type, int clause_num)
+{
+       ENTER_LOG (&exception_clauses_ctr, logbuffer,
+               EVENT_SIZE /* event */ +
+               BYTE_SIZE /* clause type */ +
+               LEB128_SIZE /* clause num */ +
+               LEB128_SIZE /* method */
+       );
+
+       emit_event (logbuffer, TYPE_EXCEPTION | TYPE_CLAUSE);
+       emit_byte (logbuffer, clause_type);
+       emit_value (logbuffer, clause_num);
+       emit_method (logbuffer, method);
+
+       EXIT_LOG;
+}
+
+static void
+monitor_event (MonoProfiler *profiler, MonoObject *object, MonoProfilerMonitorEvent event)
+{
+       int do_bt = (nocalls && InterlockedRead (&runtime_inited) && !notraces && event == MONO_PROFILER_MONITOR_CONTENTION) ? TYPE_MONITOR_BT : 0;
+       FrameData data;
+
+       if (do_bt)
+               collect_bt (&data);
+
+       gint32 *ctr;
+
+       switch (event) {
+       case MONO_PROFILER_MONITOR_CONTENTION:
+               ctr = &monitor_contentions_ctr;
+               break;
+       case MONO_PROFILER_MONITOR_DONE:
+               ctr = &monitor_acquisitions_ctr;
+               break;
+       case MONO_PROFILER_MONITOR_FAIL:
+               ctr = &monitor_failures_ctr;
+               break;
+       default:
+               g_assert_not_reached ();
+               break;
+       }
+
+       ENTER_LOG (ctr, logbuffer,
+               EVENT_SIZE /* event */ +
+               LEB128_SIZE /* object */ +
+               (do_bt ? (
+                       LEB128_SIZE /* count */ +
+                       data.count * (
+                               LEB128_SIZE /* method */
+                       )
+               ) : 0)
+       );
+
+       emit_event (logbuffer, (event << 4) | do_bt | TYPE_MONITOR);
+       emit_obj (logbuffer, object);
+
+       if (do_bt)
+               emit_bt (profiler, logbuffer, &data);
+
+       EXIT_LOG;
+}
+
+static void
+thread_start (MonoProfiler *prof, uintptr_t tid)
+{
+       init_thread (prof, TRUE);
+
+       ENTER_LOG (&thread_starts_ctr, logbuffer,
+               EVENT_SIZE /* event */ +
+               BYTE_SIZE /* type */ +
+               LEB128_SIZE /* tid */
+       );
+
+       emit_event (logbuffer, TYPE_END_LOAD | TYPE_METADATA);
+       emit_byte (logbuffer, TYPE_THREAD);
+       emit_ptr (logbuffer, (void*) tid);
+
+       EXIT_LOG;
+}
+
+static void
+thread_end (MonoProfiler *prof, uintptr_t tid)
+{
+       ENTER_LOG (&thread_ends_ctr, logbuffer,
+               EVENT_SIZE /* event */ +
+               BYTE_SIZE /* type */ +
+               LEB128_SIZE /* tid */
+       );
+
+       emit_event (logbuffer, TYPE_END_UNLOAD | TYPE_METADATA);
+       emit_byte (logbuffer, TYPE_THREAD);
+       emit_ptr (logbuffer, (void*) tid);
+
+       EXIT_LOG_EXPLICIT (NO_SEND, NO_REQUESTS);
+
+       MonoProfilerThread *thread = PROF_TLS_GET ();
+
+       thread->ended = TRUE;
+       remove_thread (thread);
+
+       PROF_TLS_SET (NULL);
+}
+
+static void
+thread_name (MonoProfiler *prof, uintptr_t tid, const char *name)
+{
+       int len = strlen (name) + 1;
+
+       ENTER_LOG (&thread_names_ctr, logbuffer,
+               EVENT_SIZE /* event */ +
+               BYTE_SIZE /* type */ +
+               LEB128_SIZE /* tid */ +
+               len /* name */
+       );
+
+       emit_event (logbuffer, TYPE_METADATA);
+       emit_byte (logbuffer, TYPE_THREAD);
+       emit_ptr (logbuffer, (void*)tid);
+       memcpy (logbuffer->cursor, name, len);
+       logbuffer->cursor += len;
+
+       EXIT_LOG;
+}
+
+static void
+domain_loaded (MonoProfiler *prof, MonoDomain *domain, int result)
+{
+       if (result != MONO_PROFILE_OK)
+               return;
+
+       ENTER_LOG (&domain_loads_ctr, logbuffer,
+               EVENT_SIZE /* event */ +
+               BYTE_SIZE /* type */ +
+               LEB128_SIZE /* domain id */
+       );
+
+       emit_event (logbuffer, TYPE_END_LOAD | TYPE_METADATA);
+       emit_byte (logbuffer, TYPE_DOMAIN);
+       emit_ptr (logbuffer, (void*)(uintptr_t) mono_domain_get_id (domain));
+
+       EXIT_LOG;
+}
+
+static void
+domain_unloaded (MonoProfiler *prof, MonoDomain *domain)
+{
+       ENTER_LOG (&domain_unloads_ctr, logbuffer,
+               EVENT_SIZE /* event */ +
+               BYTE_SIZE /* type */ +
+               LEB128_SIZE /* domain id */
+       );
+
+       emit_event (logbuffer, TYPE_END_UNLOAD | TYPE_METADATA);
+       emit_byte (logbuffer, TYPE_DOMAIN);
+       emit_ptr (logbuffer, (void*)(uintptr_t) mono_domain_get_id (domain));
+
+       EXIT_LOG;
+}
+
+static void
+domain_name (MonoProfiler *prof, MonoDomain *domain, const char *name)
+{
+       int nlen = strlen (name) + 1;
+
+       ENTER_LOG (&domain_names_ctr, logbuffer,
+               EVENT_SIZE /* event */ +
+               BYTE_SIZE /* type */ +
+               LEB128_SIZE /* domain id */ +
+               nlen /* name */
+       );
+
+       emit_event (logbuffer, TYPE_METADATA);
+       emit_byte (logbuffer, TYPE_DOMAIN);
+       emit_ptr (logbuffer, (void*)(uintptr_t) mono_domain_get_id (domain));
+       memcpy (logbuffer->cursor, name, nlen);
+       logbuffer->cursor += nlen;
+
+       EXIT_LOG;
+}
+
+static void
+context_loaded (MonoProfiler *prof, MonoAppContext *context)
+{
+       ENTER_LOG (&context_loads_ctr, logbuffer,
+               EVENT_SIZE /* event */ +
+               BYTE_SIZE /* type */ +
+               LEB128_SIZE /* context id */ +
+               LEB128_SIZE /* domain id */
+       );
+
+       emit_event (logbuffer, TYPE_END_LOAD | TYPE_METADATA);
+       emit_byte (logbuffer, TYPE_CONTEXT);
+       emit_ptr (logbuffer, (void*)(uintptr_t) mono_context_get_id (context));
+       emit_ptr (logbuffer, (void*)(uintptr_t) mono_context_get_domain_id (context));
+
+       EXIT_LOG;
+}
+
+static void
+context_unloaded (MonoProfiler *prof, MonoAppContext *context)
+{
+       ENTER_LOG (&context_unloads_ctr, logbuffer,
+               EVENT_SIZE /* event */ +
+               BYTE_SIZE /* type */ +
+               LEB128_SIZE /* context id */ +
+               LEB128_SIZE /* domain id */
+       );
+
+       emit_event (logbuffer, TYPE_END_UNLOAD | TYPE_METADATA);
+       emit_byte (logbuffer, TYPE_CONTEXT);
+       emit_ptr (logbuffer, (void*)(uintptr_t) mono_context_get_id (context));
+       emit_ptr (logbuffer, (void*)(uintptr_t) mono_context_get_domain_id (context));
+
+       EXIT_LOG;
+}
+
+typedef struct {
+       MonoMethod *method;
+       MonoDomain *domain;
+       void *base_address;
+       int offset;
+} AsyncFrameInfo;
+
+typedef struct {
+       MonoLockFreeQueueNode node;
+       MonoProfiler *prof;
+       uint64_t time;
+       uintptr_t tid;
+       void *ip;
+       int count;
+       AsyncFrameInfo frames [MONO_ZERO_LEN_ARRAY];
+} SampleHit;
+
+static mono_bool
+async_walk_stack (MonoMethod *method, MonoDomain *domain, void *base_address, int offset, void *data)
+{
+       SampleHit *sample = (SampleHit *) data;
+
+       if (sample->count < num_frames) {
+               int i = sample->count;
+
+               sample->frames [i].method = method;
+               sample->frames [i].domain = domain;
+               sample->frames [i].base_address = base_address;
+               sample->frames [i].offset = offset;
+
+               sample->count++;
+       }
+
+       return sample->count == num_frames;
+}
+
+#define SAMPLE_SLOT_SIZE(FRAMES) (sizeof (SampleHit) + sizeof (AsyncFrameInfo) * (FRAMES - MONO_ZERO_LEN_ARRAY))
+#define SAMPLE_BLOCK_SIZE (mono_pagesize ())
+
+static void
+enqueue_sample_hit (gpointer p)
+{
+       SampleHit *sample = p;
+
+       mono_lock_free_queue_node_unpoison (&sample->node);
+       mono_lock_free_queue_enqueue (&sample->prof->dumper_queue, &sample->node);
+       mono_os_sem_post (&sample->prof->dumper_queue_sem);
+}
+
+static void
+mono_sample_hit (MonoProfiler *profiler, unsigned char *ip, void *context)
+{
+       /*
+        * Please note: We rely on the runtime loading the profiler with
+        * MONO_DL_EAGER (RTLD_NOW) so that references to runtime functions within
+        * this function (and its siblings) are resolved when the profiler is
+        * loaded. Otherwise, we would potentially invoke the dynamic linker when
+        * invoking runtime functions, which is not async-signal-safe.
+        */
+
+       if (InterlockedRead (&in_shutdown))
+               return;
+
+       SampleHit *sample = (SampleHit *) mono_lock_free_queue_dequeue (&profiler->sample_reuse_queue);
+
+       if (!sample) {
+               /*
+                * If we're out of reusable sample events and we're not allowed to
+                * allocate more, we have no choice but to drop the event.
+                */
+               if (InterlockedRead (&sample_allocations_ctr) >= max_allocated_sample_hits)
+                       return;
+
+               sample = mono_lock_free_alloc (&profiler->sample_allocator);
+               sample->prof = profiler;
+               mono_lock_free_queue_node_init (&sample->node, TRUE);
+
+               InterlockedIncrement (&sample_allocations_ctr);
+       }
+
+       sample->count = 0;
+       mono_stack_walk_async_safe (&async_walk_stack, context, sample);
+
+       sample->time = current_time ();
+       sample->tid = thread_id ();
+       sample->ip = ip;
+
+       mono_thread_hazardous_try_free (sample, enqueue_sample_hit);
+}
+
+static uintptr_t *code_pages = 0;
+static int num_code_pages = 0;
+static int size_code_pages = 0;
+#define CPAGE_SHIFT (9)
+#define CPAGE_SIZE (1 << CPAGE_SHIFT)
+#define CPAGE_MASK (~(CPAGE_SIZE - 1))
+#define CPAGE_ADDR(p) ((p) & CPAGE_MASK)
+
+static uintptr_t
+add_code_page (uintptr_t *hash, uintptr_t hsize, uintptr_t page)
+{
+       uintptr_t i;
+       uintptr_t start_pos;
+       start_pos = (page >> CPAGE_SHIFT) % hsize;
+       i = start_pos;
+       do {
+               if (hash [i] && CPAGE_ADDR (hash [i]) == CPAGE_ADDR (page)) {
+                       return 0;
+               } else if (!hash [i]) {
+                       hash [i] = page;
+                       return 1;
+               }
+               /* wrap around */
+               if (++i == hsize)
+                       i = 0;
+       } while (i != start_pos);
+       /* should not happen */
+       printf ("failed code page store\n");
+       return 0;
+}
+
+static void
+add_code_pointer (uintptr_t ip)
+{
+       uintptr_t i;
+       if (num_code_pages * 2 >= size_code_pages) {
+               uintptr_t *n;
+               uintptr_t old_size = size_code_pages;
+               size_code_pages *= 2;
+               if (size_code_pages == 0)
+                       size_code_pages = 16;
+               n = (uintptr_t *) g_calloc (sizeof (uintptr_t) * size_code_pages, 1);
+               for (i = 0; i < old_size; ++i) {
+                       if (code_pages [i])
+                               add_code_page (n, size_code_pages, code_pages [i]);
+               }
+               if (code_pages)
+                       g_free (code_pages);
+               code_pages = n;
+       }
+       num_code_pages += add_code_page (code_pages, size_code_pages, ip & CPAGE_MASK);
+}
+
+/* ELF code crashes on some systems. */
+//#if defined(HAVE_DL_ITERATE_PHDR) && defined(ELFMAG0)
+#if 0
+static void
+dump_ubin (MonoProfiler *prof, const char *filename, uintptr_t load_addr, uint64_t offset, uintptr_t size)
+{
+       int len = strlen (filename) + 1;
+
+       ENTER_LOG (&sample_ubins_ctr, logbuffer,
+               EVENT_SIZE /* event */ +
+               LEB128_SIZE /* load address */ +
+               LEB128_SIZE /* offset */ +
+               LEB128_SIZE /* size */ +
+               nlen /* file name */
+       );
+
+       emit_event (logbuffer, TYPE_SAMPLE | TYPE_SAMPLE_UBIN);
+       emit_svalue (logbuffer, load_addr);
+       emit_uvalue (logbuffer, offset);
+       emit_uvalue (logbuffer, size);
+       memcpy (logbuffer->cursor, filename, len);
+       logbuffer->cursor += len;
+
+       EXIT_LOG_EXPLICIT (DO_SEND, NO_REQUESTS);
+}
+#endif
+
+static void
+dump_usym (MonoProfiler *prof, const char *name, uintptr_t value, uintptr_t size)
+{
+       int len = strlen (name) + 1;
+
+       ENTER_LOG (&sample_usyms_ctr, logbuffer,
+               EVENT_SIZE /* event */ +
+               LEB128_SIZE /* value */ +
+               LEB128_SIZE /* size */ +
+               len /* name */
+       );
+
+       emit_event (logbuffer, TYPE_SAMPLE | TYPE_SAMPLE_USYM);
+       emit_ptr (logbuffer, (void*)value);
+       emit_value (logbuffer, size);
+       memcpy (logbuffer->cursor, name, len);
+       logbuffer->cursor += len;
+
+       EXIT_LOG_EXPLICIT (DO_SEND, NO_REQUESTS);
+}
+
+/* ELF code crashes on some systems. */
+//#if defined(ELFMAG0)
+#if 0
+
+#if SIZEOF_VOID_P == 4
+#define ELF_WSIZE 32
+#else
+#define ELF_WSIZE 64
+#endif
+#ifndef ElfW
+#define ElfW(type)      _ElfW (Elf, ELF_WSIZE, type)
+#define _ElfW(e,w,t)    _ElfW_1 (e, w, _##t)
+#define _ElfW_1(e,w,t)  e##w##t
+#endif
+
+static void
+dump_elf_symbols (MonoProfiler *prof, ElfW(Sym) *symbols, int num_symbols, const char *strtab, void *load_addr)
+{
+       int i;
+       for (i = 0; i < num_symbols; ++i) {
+               const char* sym;
+               sym =  strtab + symbols [i].st_name;
+               if (!symbols [i].st_name || !symbols [i].st_size || (symbols [i].st_info & 0xf) != STT_FUNC)
+                       continue;
+               //printf ("symbol %s at %d\n", sym, symbols [i].st_value);
+               dump_usym (sym, (uintptr_t)load_addr + symbols [i].st_value, symbols [i].st_size);
+       }
+}
+
+static int
+read_elf_symbols (MonoProfiler *prof, const char *filename, void *load_addr)
+{
+       int fd, i;
+       void *data;
+       struct stat statb;
+       uint64_t file_size;
+       ElfW(Ehdr) *header;
+       ElfW(Shdr) *sheader;
+       ElfW(Shdr) *shstrtabh;
+       ElfW(Shdr) *symtabh = NULL;
+       ElfW(Shdr) *strtabh = NULL;
+       ElfW(Sym) *symbols = NULL;
+       const char *strtab;
+       int num_symbols;
+
+       fd = open (filename, O_RDONLY);
+       if (fd < 0)
+               return 0;
+       if (fstat (fd, &statb) != 0) {
+               close (fd);
+               return 0;
+       }
+       file_size = statb.st_size;
+       data = mmap (NULL, file_size, PROT_READ, MAP_PRIVATE, fd, 0);
+       close (fd);
+       if (data == MAP_FAILED)
+               return 0;
+       header = data;
+       if (header->e_ident [EI_MAG0] != ELFMAG0 ||
+                       header->e_ident [EI_MAG1] != ELFMAG1 ||
+                       header->e_ident [EI_MAG2] != ELFMAG2 ||
+                       header->e_ident [EI_MAG3] != ELFMAG3 ) {
+               munmap (data, file_size);
+               return 0;
+       }
+       sheader = (void*)((char*)data + header->e_shoff);
+       shstrtabh = (void*)((char*)sheader + (header->e_shentsize * header->e_shstrndx));
+       strtab = (const char*)data + shstrtabh->sh_offset;
+       for (i = 0; i < header->e_shnum; ++i) {
+               //printf ("section header: %d\n", sheader->sh_type);
+               if (sheader->sh_type == SHT_SYMTAB) {
+                       symtabh = sheader;
+                       strtabh = (void*)((char*)data + header->e_shoff + sheader->sh_link * header->e_shentsize);
+                       /*printf ("symtab section header: %d, .strstr: %d\n", i, sheader->sh_link);*/
+                       break;
+               }
+               sheader = (void*)((char*)sheader + header->e_shentsize);
+       }
+       if (!symtabh || !strtabh) {
+               munmap (data, file_size);
+               return 0;
+       }
+       strtab = (const char*)data + strtabh->sh_offset;
+       num_symbols = symtabh->sh_size / symtabh->sh_entsize;
+       symbols = (void*)((char*)data + symtabh->sh_offset);
+       dump_elf_symbols (symbols, num_symbols, strtab, load_addr);
+       munmap (data, file_size);
+       return 1;
+}
+#endif
+
+/* ELF code crashes on some systems. */
+//#if defined(HAVE_DL_ITERATE_PHDR) && defined(ELFMAG0)
+#if 0
+static int
+elf_dl_callback (struct dl_phdr_info *info, size_t size, void *data)
+{
+       MonoProfiler *prof = data;
+       char buf [256];
+       const char *filename;
+       BinaryObject *obj;
+       char *a = (void*)info->dlpi_addr;
+       int i, num_sym;
+       ElfW(Dyn) *dyn = NULL;
+       ElfW(Sym) *symtab = NULL;
+       ElfW(Word) *hash_table = NULL;
+       ElfW(Ehdr) *header = NULL;
+       const char* strtab = NULL;
+       for (obj = prof->binary_objects; obj; obj = obj->next) {
+               if (obj->addr == a)
+                       return 0;
+       }
+       filename = info->dlpi_name;
+       if (!filename)
+               return 0;
+       if (!info->dlpi_addr && !filename [0]) {
+               int l = readlink ("/proc/self/exe", buf, sizeof (buf) - 1);
+               if (l > 0) {
+                       buf [l] = 0;
+                       filename = buf;
+               }
+       }
+       obj = g_calloc (sizeof (BinaryObject), 1);
+       obj->addr = (void*)info->dlpi_addr;
+       obj->name = pstrdup (filename);
+       obj->next = prof->binary_objects;
+       prof->binary_objects = obj;
+       //printf ("loaded file: %s at %p, segments: %d\n", filename, (void*)info->dlpi_addr, info->dlpi_phnum);
+       a = NULL;
+       for (i = 0; i < info->dlpi_phnum; ++i) {
+               //printf ("segment type %d file offset: %d, size: %d\n", info->dlpi_phdr[i].p_type, info->dlpi_phdr[i].p_offset, info->dlpi_phdr[i].p_memsz);
+               if (info->dlpi_phdr[i].p_type == PT_LOAD && !header) {
+                       header = (ElfW(Ehdr)*)(info->dlpi_addr + info->dlpi_phdr[i].p_vaddr);
+                       if (header->e_ident [EI_MAG0] != ELFMAG0 ||
+                                       header->e_ident [EI_MAG1] != ELFMAG1 ||
+                                       header->e_ident [EI_MAG2] != ELFMAG2 ||
+                                       header->e_ident [EI_MAG3] != ELFMAG3 ) {
+                               header = NULL;
+                       }
+                       dump_ubin (prof, filename, info->dlpi_addr + info->dlpi_phdr[i].p_vaddr, info->dlpi_phdr[i].p_offset, info->dlpi_phdr[i].p_memsz);
+               } else if (info->dlpi_phdr[i].p_type == PT_DYNAMIC) {
+                       dyn = (ElfW(Dyn) *)(info->dlpi_addr + info->dlpi_phdr[i].p_vaddr);
+               }
+       }
+       if (read_elf_symbols (prof, filename, (void*)info->dlpi_addr))
+               return 0;
+       if (!info->dlpi_name || !info->dlpi_name[0])
+               return 0;
+       if (!dyn)
+               return 0;
+       for (i = 0; dyn [i].d_tag != DT_NULL; ++i) {
+               if (dyn [i].d_tag == DT_SYMTAB) {
+                       if (symtab && do_debug)
+                               printf ("multiple symtabs: %d\n", i);
+                       symtab = (ElfW(Sym) *)(a + dyn [i].d_un.d_ptr);
+               } else if (dyn [i].d_tag == DT_HASH) {
+                       hash_table = (ElfW(Word) *)(a + dyn [i].d_un.d_ptr);
+               } else if (dyn [i].d_tag == DT_STRTAB) {
+                       strtab = (const char*)(a + dyn [i].d_un.d_ptr);
+               }
+       }
+       if (!hash_table)
+               return 0;
+       num_sym = hash_table [1];
+       dump_elf_symbols (prof, symtab, num_sym, strtab, (void*)info->dlpi_addr);
+       return 0;
+}
+
+static int
+load_binaries (MonoProfiler *prof)
+{
+       dl_iterate_phdr (elf_dl_callback, prof);
+       return 1;
+}
+#else
+static int
+load_binaries (MonoProfiler *prof)
+{
+       return 0;
+}
+#endif
+
+static const char*
+symbol_for (uintptr_t code)
+{
+#ifdef HAVE_DLADDR
+       void *ip = (void*)code;
+       Dl_info di;
+       if (dladdr (ip, &di)) {
+               if (di.dli_sname)
+                       return di.dli_sname;
+       } else {
+       /*      char **names;
+               names = backtrace_symbols (&ip, 1);
+               if (names) {
+                       const char* p = names [0];
+                       g_free (names);
+                       return p;
+               }
+               */
+       }
+#endif
+       return NULL;
+}
+
+static void
+dump_unmanaged_coderefs (MonoProfiler *prof)
+{
+       int i;
+       const char* last_symbol;
+       uintptr_t addr, page_end;
+
+       if (load_binaries (prof))
+               return;
+       for (i = 0; i < size_code_pages; ++i) {
+               const char* sym;
+               if (!code_pages [i] || code_pages [i] & 1)
+                       continue;
+               last_symbol = NULL;
+               addr = CPAGE_ADDR (code_pages [i]);
+               page_end = addr + CPAGE_SIZE;
+               code_pages [i] |= 1;
+               /* we dump the symbols for the whole page */
+               for (; addr < page_end; addr += 16) {
+                       sym = symbol_for (addr);
+                       if (sym && sym == last_symbol)
+                               continue;
+                       last_symbol = sym;
+                       if (!sym)
+                               continue;
+                       dump_usym (prof, sym, addr, 0); /* let's not guess the size */
+                       //printf ("found symbol at %p: %s\n", (void*)addr, sym);
+               }
+       }
+}
+
+static int
+mono_cpu_count (void)
+{
+#ifdef PLATFORM_ANDROID
+       /* Android tries really hard to save power by powering off CPUs on SMP phones which
+        * means the normal way to query cpu count returns a wrong value with userspace API.
+        * Instead we use /sys entries to query the actual hardware CPU count.
+        */
+       int count = 0;
+       char buffer[8] = {'\0'};
+       int present = open ("/sys/devices/system/cpu/present", O_RDONLY);
+       /* Format of the /sys entry is a cpulist of indexes which in the case
+        * of present is always of the form "0-(n-1)" when there is more than
+        * 1 core, n being the number of CPU cores in the system. Otherwise
+        * the value is simply 0
+        */
+       if (present != -1 && read (present, (char*)buffer, sizeof (buffer)) > 3)
+               count = strtol (((char*)buffer) + 2, NULL, 10);
+       if (present != -1)
+               close (present);
+       if (count > 0)
+               return count + 1;
+#endif
+
+#if defined(HOST_ARM) || defined (HOST_ARM64)
+
+       /* ARM platforms tries really hard to save power by powering off CPUs on SMP phones which
+        * means the normal way to query cpu count returns a wrong value with userspace API. */
+
+#ifdef _SC_NPROCESSORS_CONF
+       {
+               int count = sysconf (_SC_NPROCESSORS_CONF);
+               if (count > 0)
+                       return count;
+       }
+#endif
+
+#else
+
+#ifdef HAVE_SCHED_GETAFFINITY
+       {
+               cpu_set_t set;
+               if (sched_getaffinity (getpid (), sizeof (set), &set) == 0)
+                       return CPU_COUNT (&set);
+       }
+#endif
+#ifdef _SC_NPROCESSORS_ONLN
+       {
+               int count = sysconf (_SC_NPROCESSORS_ONLN);
+               if (count > 0)
+                       return count;
+       }
+#endif
+
+#endif /* defined(HOST_ARM) || defined (HOST_ARM64) */
+
+#ifdef USE_SYSCTL
+       {
+               int count;
+               int mib [2];
+               size_t len = sizeof (int);
+               mib [0] = CTL_HW;
+               mib [1] = HW_NCPU;
+               if (sysctl (mib, 2, &count, &len, NULL, 0) == 0)
+                       return count;
+       }
+#endif
+#ifdef HOST_WIN32
+       {
+               SYSTEM_INFO info;
+               GetSystemInfo (&info);
+               return info.dwNumberOfProcessors;
+       }
+#endif
+
+       static gboolean warned;
+
+       if (!warned) {
+               g_warning ("Don't know how to determine CPU count on this platform; assuming 1");
+               warned = TRUE;
+       }
+
+       return 1;
+}
+
+typedef struct MonoCounterAgent {
+       MonoCounter *counter;
+       // MonoCounterAgent specific data :
+       void *value;
+       size_t value_size;
+       short index;
+       short emitted;
+       struct MonoCounterAgent *next;
+} MonoCounterAgent;
+
+static MonoCounterAgent* counters;
+static int counters_index = 1;
+static mono_mutex_t counters_mutex;
+
+static void
+counters_add_agent (MonoCounter *counter)
+{
+       if (InterlockedRead (&in_shutdown))
+               return;
+
+       MonoCounterAgent *agent, *item;
+
+       mono_os_mutex_lock (&counters_mutex);
+
+       for (agent = counters; agent; agent = agent->next) {
+               if (agent->counter == counter) {
+                       agent->value_size = 0;
+                       if (agent->value) {
+                               g_free (agent->value);
+                               agent->value = NULL;
+                       }
+                       goto done;
+               }
+       }
+
+       agent = (MonoCounterAgent *) g_malloc (sizeof (MonoCounterAgent));
+       agent->counter = counter;
+       agent->value = NULL;
+       agent->value_size = 0;
+       agent->index = counters_index++;
+       agent->emitted = 0;
+       agent->next = NULL;
+
+       if (!counters) {
+               counters = agent;
+       } else {
+               item = counters;
+               while (item->next)
+                       item = item->next;
+               item->next = agent;
+       }
+
+done:
+       mono_os_mutex_unlock (&counters_mutex);
+}
+
+static mono_bool
+counters_init_foreach_callback (MonoCounter *counter, gpointer data)
+{
+       counters_add_agent (counter);
+       return TRUE;
+}
+
+static void
+counters_init (MonoProfiler *profiler)
+{
+       mono_os_mutex_init (&counters_mutex);
+
+       mono_counters_on_register (&counters_add_agent);
+       mono_counters_foreach (counters_init_foreach_callback, NULL);
+}
+
+static void
+counters_emit (MonoProfiler *profiler)
+{
+       MonoCounterAgent *agent;
+       int len = 0;
+       int size =
+               EVENT_SIZE /* event */ +
+               LEB128_SIZE /* len */
+       ;
+
+       mono_os_mutex_lock (&counters_mutex);
+
+       for (agent = counters; agent; agent = agent->next) {
+               if (agent->emitted)
+                       continue;
+
+               size +=
+                       LEB128_SIZE /* section */ +
+                       strlen (mono_counter_get_name (agent->counter)) + 1 /* name */ +
+                       BYTE_SIZE /* type */ +
+                       BYTE_SIZE /* unit */ +
+                       BYTE_SIZE /* variance */ +
+                       LEB128_SIZE /* index */
+               ;
+
+               len++;
+       }
+
+       if (!len)
+               goto done;
+
+       ENTER_LOG (&counter_descriptors_ctr, logbuffer, size);
+
+       emit_event (logbuffer, TYPE_SAMPLE_COUNTERS_DESC | TYPE_SAMPLE);
+       emit_value (logbuffer, len);
+
+       for (agent = counters; agent; agent = agent->next) {
+               const char *name;
+
+               if (agent->emitted)
+                       continue;
+
+               name = mono_counter_get_name (agent->counter);
+               emit_value (logbuffer, mono_counter_get_section (agent->counter));
+               emit_string (logbuffer, name, strlen (name) + 1);
+               emit_byte (logbuffer, mono_counter_get_type (agent->counter));
+               emit_byte (logbuffer, mono_counter_get_unit (agent->counter));
+               emit_byte (logbuffer, mono_counter_get_variance (agent->counter));
+               emit_value (logbuffer, agent->index);
+
+               agent->emitted = 1;
+       }
+
+       EXIT_LOG_EXPLICIT (DO_SEND, NO_REQUESTS);
+
+done:
+       mono_os_mutex_unlock (&counters_mutex);
+}
+
+static void
+counters_sample (MonoProfiler *profiler, uint64_t timestamp)
+{
+       MonoCounterAgent *agent;
+       MonoCounter *counter;
+       int type;
+       int buffer_size;
+       void *buffer;
+       int size;
+
+       counters_emit (profiler);
+
+       buffer_size = 8;
+       buffer = g_calloc (1, buffer_size);
+
+       mono_os_mutex_lock (&counters_mutex);
+
+       size =
+               EVENT_SIZE /* event */
+       ;
+
+       for (agent = counters; agent; agent = agent->next) {
+               size +=
+                       LEB128_SIZE /* index */ +
+                       BYTE_SIZE /* type */ +
+                       mono_counter_get_size (agent->counter) /* value */
+               ;
+       }
+
+       size +=
+               LEB128_SIZE /* stop marker */
+       ;
+
+       ENTER_LOG (&counter_samples_ctr, logbuffer, size);
+
+       emit_event_time (logbuffer, TYPE_SAMPLE_COUNTERS | TYPE_SAMPLE, timestamp);
+
+       for (agent = counters; agent; agent = agent->next) {
+               size_t size;
+
+               counter = agent->counter;
+
+               size = mono_counter_get_size (counter);
+
+               if (size > buffer_size) {
+                       buffer_size = size;
+                       buffer = g_realloc (buffer, buffer_size);
+               }
+
+               memset (buffer, 0, buffer_size);
+
+               g_assert (mono_counters_sample (counter, buffer, size));
+
+               type = mono_counter_get_type (counter);
+
+               if (!agent->value) {
+                       agent->value = g_calloc (1, size);
+                       agent->value_size = size;
+               } else {
+                       if (type == MONO_COUNTER_STRING) {
+                               if (strcmp (agent->value, buffer) == 0)
+                                       continue;
+                       } else {
+                               if (agent->value_size == size && memcmp (agent->value, buffer, size) == 0)
+                                       continue;
+                       }
+               }
+
+               emit_uvalue (logbuffer, agent->index);
+               emit_byte (logbuffer, type);
+               switch (type) {
+               case MONO_COUNTER_INT:
+#if SIZEOF_VOID_P == 4
+               case MONO_COUNTER_WORD:
+#endif
+                       emit_svalue (logbuffer, *(int*)buffer - *(int*)agent->value);
+                       break;
+               case MONO_COUNTER_UINT:
+                       emit_uvalue (logbuffer, *(guint*)buffer - *(guint*)agent->value);
+                       break;
+               case MONO_COUNTER_TIME_INTERVAL:
+               case MONO_COUNTER_LONG:
+#if SIZEOF_VOID_P == 8
+               case MONO_COUNTER_WORD:
+#endif
+                       emit_svalue (logbuffer, *(gint64*)buffer - *(gint64*)agent->value);
+                       break;
+               case MONO_COUNTER_ULONG:
+                       emit_uvalue (logbuffer, *(guint64*)buffer - *(guint64*)agent->value);
+                       break;
+               case MONO_COUNTER_DOUBLE:
+                       emit_double (logbuffer, *(double*)buffer);
+                       break;
+               case MONO_COUNTER_STRING:
+                       if (size == 0) {
+                               emit_byte (logbuffer, 0);
+                       } else {
+                               emit_byte (logbuffer, 1);
+                               emit_string (logbuffer, (char*)buffer, size);
+                       }
+                       break;
+               default:
+                       g_assert_not_reached ();
+               }
+
+               if (type == MONO_COUNTER_STRING && size > agent->value_size) {
+                       agent->value = g_realloc (agent->value, size);
+                       agent->value_size = size;
+               }
+
+               if (size > 0)
+                       memcpy (agent->value, buffer, size);
+       }
+       g_free (buffer);
+
+       emit_value (logbuffer, 0);
+
+       EXIT_LOG_EXPLICIT (DO_SEND, NO_REQUESTS);
+
+       mono_os_mutex_unlock (&counters_mutex);
+}
+
+typedef struct _PerfCounterAgent PerfCounterAgent;
+struct _PerfCounterAgent {
+       PerfCounterAgent *next;
+       int index;
+       char *category_name;
+       char *name;
+       int type;
+       gint64 value;
+       guint8 emitted;
+       guint8 updated;
+       guint8 deleted;
+};
+
+static PerfCounterAgent *perfcounters = NULL;
+
+static void
+perfcounters_emit (MonoProfiler *profiler)
+{
+       PerfCounterAgent *pcagent;
+       int len = 0;
+       int size =
+               EVENT_SIZE /* event */ +
+               LEB128_SIZE /* len */
+       ;
+
+       for (pcagent = perfcounters; pcagent; pcagent = pcagent->next) {
+               if (pcagent->emitted)
+                       continue;
+
+               size +=
+                       LEB128_SIZE /* section */ +
+                       strlen (pcagent->category_name) + 1 /* category name */ +
+                       strlen (pcagent->name) + 1 /* name */ +
+                       BYTE_SIZE /* type */ +
+                       BYTE_SIZE /* unit */ +
+                       BYTE_SIZE /* variance */ +
+                       LEB128_SIZE /* index */
+               ;
+
+               len++;
+       }
+
+       if (!len)
+               return;
+
+       ENTER_LOG (&perfcounter_descriptors_ctr, logbuffer, size);
+
+       emit_event (logbuffer, TYPE_SAMPLE_COUNTERS_DESC | TYPE_SAMPLE);
+       emit_value (logbuffer, len);
+
+       for (pcagent = perfcounters; pcagent; pcagent = pcagent->next) {
+               if (pcagent->emitted)
+                       continue;
+
+               emit_value (logbuffer, MONO_COUNTER_PERFCOUNTERS);
+               emit_string (logbuffer, pcagent->category_name, strlen (pcagent->category_name) + 1);
+               emit_string (logbuffer, pcagent->name, strlen (pcagent->name) + 1);
+               emit_byte (logbuffer, MONO_COUNTER_LONG);
+               emit_byte (logbuffer, MONO_COUNTER_RAW);
+               emit_byte (logbuffer, MONO_COUNTER_VARIABLE);
+               emit_value (logbuffer, pcagent->index);
+
+               pcagent->emitted = 1;
+       }
+
+       EXIT_LOG_EXPLICIT (DO_SEND, NO_REQUESTS);
+}
+
+static gboolean
+perfcounters_foreach (char *category_name, char *name, unsigned char type, gint64 value, gpointer user_data)
+{
+       PerfCounterAgent *pcagent;
+
+       for (pcagent = perfcounters; pcagent; pcagent = pcagent->next) {
+               if (strcmp (pcagent->category_name, category_name) != 0 || strcmp (pcagent->name, name) != 0)
+                       continue;
+               if (pcagent->value == value)
+                       return TRUE;
+
+               pcagent->value = value;
+               pcagent->updated = 1;
+               pcagent->deleted = 0;
+               return TRUE;
+       }
+
+       pcagent = g_new0 (PerfCounterAgent, 1);
+       pcagent->next = perfcounters;
+       pcagent->index = counters_index++;
+       pcagent->category_name = g_strdup (category_name);
+       pcagent->name = g_strdup (name);
+       pcagent->type = (int) type;
+       pcagent->value = value;
+       pcagent->emitted = 0;
+       pcagent->updated = 1;
+       pcagent->deleted = 0;
+
+       perfcounters = pcagent;
+
+       return TRUE;
+}
+
+static void
+perfcounters_sample (MonoProfiler *profiler, uint64_t timestamp)
+{
+       PerfCounterAgent *pcagent;
+       int len = 0;
+       int size;
+
+       mono_os_mutex_lock (&counters_mutex);
+
+       /* mark all perfcounters as deleted, foreach will unmark them as necessary */
+       for (pcagent = perfcounters; pcagent; pcagent = pcagent->next)
+               pcagent->deleted = 1;
+
+       mono_perfcounter_foreach (perfcounters_foreach, perfcounters);
+
+       perfcounters_emit (profiler);
+
+       size =
+               EVENT_SIZE /* event */
+       ;
+
+       for (pcagent = perfcounters; pcagent; pcagent = pcagent->next) {
+               if (pcagent->deleted || !pcagent->updated)
+                       continue;
+
+               size +=
+                       LEB128_SIZE /* index */ +
+                       BYTE_SIZE /* type */ +
+                       LEB128_SIZE /* value */
+               ;
+
+               len++;
+       }
+
+       if (!len)
+               goto done;
+
+       size +=
+               LEB128_SIZE /* stop marker */
+       ;
+
+       ENTER_LOG (&perfcounter_samples_ctr, logbuffer, size);
+
+       emit_event_time (logbuffer, TYPE_SAMPLE_COUNTERS | TYPE_SAMPLE, timestamp);
+
+       for (pcagent = perfcounters; pcagent; pcagent = pcagent->next) {
+               if (pcagent->deleted || !pcagent->updated)
+                       continue;
+               emit_uvalue (logbuffer, pcagent->index);
+               emit_byte (logbuffer, MONO_COUNTER_LONG);
+               emit_svalue (logbuffer, pcagent->value);
+
+               pcagent->updated = 0;
+       }
+
+       emit_value (logbuffer, 0);
+
+       EXIT_LOG_EXPLICIT (DO_SEND, NO_REQUESTS);
+
+done:
+       mono_os_mutex_unlock (&counters_mutex);
+}
+
+static void
+counters_and_perfcounters_sample (MonoProfiler *prof)
+{
+       uint64_t now = current_time ();
+
+       counters_sample (prof, now);
+       perfcounters_sample (prof, now);
+}
+
+#define COVERAGE_DEBUG(x) if (debug_coverage) {x}
+static mono_mutex_t coverage_mutex;
+static MonoConcurrentHashTable *coverage_methods = NULL;
+static MonoConcurrentHashTable *coverage_assemblies = NULL;
+static MonoConcurrentHashTable *coverage_classes = NULL;
+
+static MonoConcurrentHashTable *filtered_classes = NULL;
+static MonoConcurrentHashTable *entered_methods = NULL;
+static MonoConcurrentHashTable *image_to_methods = NULL;
+static MonoConcurrentHashTable *suppressed_assemblies = NULL;
+static gboolean coverage_initialized = FALSE;
+
+static GPtrArray *coverage_data = NULL;
+static int previous_offset = 0;
+
+typedef struct {
+       MonoLockFreeQueueNode node;
+       MonoMethod *method;
+} MethodNode;
+
+typedef struct {
+       int offset;
+       int counter;
+       char *filename;
+       int line;
+       int column;
+} CoverageEntry;
+
+static void
+free_coverage_entry (gpointer data, gpointer userdata)
+{
+       CoverageEntry *entry = (CoverageEntry *)data;
+       g_free (entry->filename);
+       g_free (entry);
+}
+
+static void
+obtain_coverage_for_method (MonoProfiler *prof, const MonoProfileCoverageEntry *entry)
+{
+       int offset = entry->iloffset - previous_offset;
+       CoverageEntry *e = g_new (CoverageEntry, 1);
+
+       previous_offset = entry->iloffset;
+
+       e->offset = offset;
+       e->counter = entry->counter;
+       e->filename = g_strdup(entry->filename ? entry->filename : "");
+       e->line = entry->line;
+       e->column = entry->col;
+
+       g_ptr_array_add (coverage_data, e);
+}
+
+static char *
+parse_generic_type_names(char *name)
+{
+       char *new_name, *ret;
+       int within_generic_declaration = 0, generic_members = 1;
+
+       if (name == NULL || *name == '\0')
+               return g_strdup ("");
+
+       if (!(ret = new_name = (char *) g_calloc (strlen (name) * 4 + 1, sizeof (char))))
+               return NULL;
+
+       do {
+               switch (*name) {
+                       case '<':
+                               within_generic_declaration = 1;
+                               break;
+
+                       case '>':
+                               within_generic_declaration = 0;
+
+                               if (*(name - 1) != '<') {
+                                       *new_name++ = '`';
+                                       *new_name++ = '0' + generic_members;
+                               } else {
+                                       memcpy (new_name, "&lt;&gt;", 8);
+                                       new_name += 8;
+                               }
+
+                               generic_members = 0;
+                               break;
+
+                       case ',':
+                               generic_members++;
+                               break;
+
+                       default:
+                               if (!within_generic_declaration)
+                                       *new_name++ = *name;
+
+                               break;
+               }
+       } while (*name++);
+
+       return ret;
+}
+
+static int method_id;
+static void
+build_method_buffer (gpointer key, gpointer value, gpointer userdata)
+{
+       MonoMethod *method = (MonoMethod *)value;
+       MonoProfiler *prof = (MonoProfiler *)userdata;
+       MonoClass *klass;
+       MonoImage *image;
+       char *class_name;
+       const char *image_name, *method_name, *sig, *first_filename;
+       guint i;
+
+       previous_offset = 0;
+       coverage_data = g_ptr_array_new ();
+
+       mono_profiler_coverage_get (prof, method, obtain_coverage_for_method);
+
+       klass = mono_method_get_class (method);
+       image = mono_class_get_image (klass);
+       image_name = mono_image_get_name (image);
+
+       sig = mono_signature_get_desc (mono_method_signature (method), TRUE);
+       class_name = parse_generic_type_names (mono_type_get_name (mono_class_get_type (klass)));
+       method_name = mono_method_get_name (method);
+
+       if (coverage_data->len != 0) {
+               CoverageEntry *entry = (CoverageEntry *)coverage_data->pdata[0];
+               first_filename = entry->filename ? entry->filename : "";
+       } else
+               first_filename = "";
+
+       image_name = image_name ? image_name : "";
+       sig = sig ? sig : "";
+       method_name = method_name ? method_name : "";
+
+       ENTER_LOG (&coverage_methods_ctr, logbuffer,
+               EVENT_SIZE /* event */ +
+               strlen (image_name) + 1 /* image name */ +
+               strlen (class_name) + 1 /* class name */ +
+               strlen (method_name) + 1 /* method name */ +
+               strlen (sig) + 1 /* signature */ +
+               strlen (first_filename) + 1 /* first file name */ +
+               LEB128_SIZE /* token */ +
+               LEB128_SIZE /* method id */ +
+               LEB128_SIZE /* entries */
+       );
+
+       emit_event (logbuffer, TYPE_COVERAGE_METHOD | TYPE_COVERAGE);
+       emit_string (logbuffer, image_name, strlen (image_name) + 1);
+       emit_string (logbuffer, class_name, strlen (class_name) + 1);
+       emit_string (logbuffer, method_name, strlen (method_name) + 1);
+       emit_string (logbuffer, sig, strlen (sig) + 1);
+       emit_string (logbuffer, first_filename, strlen (first_filename) + 1);
+
+       emit_uvalue (logbuffer, mono_method_get_token (method));
+       emit_uvalue (logbuffer, method_id);
+       emit_value (logbuffer, coverage_data->len);
+
+       EXIT_LOG_EXPLICIT (DO_SEND, NO_REQUESTS);
+
+       for (i = 0; i < coverage_data->len; i++) {
+               CoverageEntry *entry = (CoverageEntry *)coverage_data->pdata[i];
+
+               ENTER_LOG (&coverage_statements_ctr, logbuffer,
+                       EVENT_SIZE /* event */ +
+                       LEB128_SIZE /* method id */ +
+                       LEB128_SIZE /* offset */ +
+                       LEB128_SIZE /* counter */ +
+                       LEB128_SIZE /* line */ +
+                       LEB128_SIZE /* column */
+               );
+
+               emit_event (logbuffer, TYPE_COVERAGE_STATEMENT | TYPE_COVERAGE);
+               emit_uvalue (logbuffer, method_id);
+               emit_uvalue (logbuffer, entry->offset);
+               emit_uvalue (logbuffer, entry->counter);
+               emit_uvalue (logbuffer, entry->line);
+               emit_uvalue (logbuffer, entry->column);
+
+               EXIT_LOG_EXPLICIT (DO_SEND, NO_REQUESTS);
+       }
+
+       method_id++;
+
+       g_free (class_name);
+
+       g_ptr_array_foreach (coverage_data, free_coverage_entry, NULL);
+       g_ptr_array_free (coverage_data, TRUE);
+       coverage_data = NULL;
+}
+
+/* This empties the queue */
+static guint
+count_queue (MonoLockFreeQueue *queue)
+{
+       MonoLockFreeQueueNode *node;
+       guint count = 0;
+
+       while ((node = mono_lock_free_queue_dequeue (queue))) {
+               count++;
+               mono_thread_hazardous_try_free (node, g_free);
+       }
+
+       return count;
+}
+
+static void
+build_class_buffer (gpointer key, gpointer value, gpointer userdata)
+{
+       MonoClass *klass = (MonoClass *)key;
+       MonoLockFreeQueue *class_methods = (MonoLockFreeQueue *)value;
+       MonoImage *image;
+       char *class_name;
+       const char *assembly_name;
+       int number_of_methods, partially_covered;
+       guint fully_covered;
+
+       image = mono_class_get_image (klass);
+       assembly_name = mono_image_get_name (image);
+       class_name = mono_type_get_name (mono_class_get_type (klass));
+
+       assembly_name = assembly_name ? assembly_name : "";
+       number_of_methods = mono_class_num_methods (klass);
+       fully_covered = count_queue (class_methods);
+       /* We don't handle partial covered yet */
+       partially_covered = 0;
+
+       ENTER_LOG (&coverage_classes_ctr, logbuffer,
+               EVENT_SIZE /* event */ +
+               strlen (assembly_name) + 1 /* assembly name */ +
+               strlen (class_name) + 1 /* class name */ +
+               LEB128_SIZE /* no. methods */ +
+               LEB128_SIZE /* fully covered */ +
+               LEB128_SIZE /* partially covered */
+       );
+
+       emit_event (logbuffer, TYPE_COVERAGE_CLASS | TYPE_COVERAGE);
+       emit_string (logbuffer, assembly_name, strlen (assembly_name) + 1);
+       emit_string (logbuffer, class_name, strlen (class_name) + 1);
+       emit_uvalue (logbuffer, number_of_methods);
+       emit_uvalue (logbuffer, fully_covered);
+       emit_uvalue (logbuffer, partially_covered);
+
+       EXIT_LOG_EXPLICIT (DO_SEND, NO_REQUESTS);
+
+       g_free (class_name);
+}
+
+static void
+get_coverage_for_image (MonoImage *image, int *number_of_methods, guint *fully_covered, int *partially_covered)
+{
+       MonoLockFreeQueue *image_methods = (MonoLockFreeQueue *)mono_conc_hashtable_lookup (image_to_methods, image);
+
+       *number_of_methods = mono_image_get_table_rows (image, MONO_TABLE_METHOD);
+       if (image_methods)
+               *fully_covered = count_queue (image_methods);
+       else
+               *fully_covered = 0;
+
+       // FIXME: We don't handle partially covered yet.
+       *partially_covered = 0;
+}
+
+static void
+build_assembly_buffer (gpointer key, gpointer value, gpointer userdata)
+{
+       MonoAssembly *assembly = (MonoAssembly *)value;
+       MonoImage *image = mono_assembly_get_image (assembly);
+       const char *name, *guid, *filename;
+       int number_of_methods = 0, partially_covered = 0;
+       guint fully_covered = 0;
+
+       name = mono_image_get_name (image);
+       guid = mono_image_get_guid (image);
+       filename = mono_image_get_filename (image);
+
+       name = name ? name : "";
+       guid = guid ? guid : "";
+       filename = filename ? filename : "";
+
+       get_coverage_for_image (image, &number_of_methods, &fully_covered, &partially_covered);
+
+       ENTER_LOG (&coverage_assemblies_ctr, logbuffer,
+               EVENT_SIZE /* event */ +
+               strlen (name) + 1 /* name */ +
+               strlen (guid) + 1 /* guid */ +
+               strlen (filename) + 1 /* file name */ +
+               LEB128_SIZE /* no. methods */ +
+               LEB128_SIZE /* fully covered */ +
+               LEB128_SIZE /* partially covered */
+       );
+
+       emit_event (logbuffer, TYPE_COVERAGE_ASSEMBLY | TYPE_COVERAGE);
+       emit_string (logbuffer, name, strlen (name) + 1);
+       emit_string (logbuffer, guid, strlen (guid) + 1);
+       emit_string (logbuffer, filename, strlen (filename) + 1);
+       emit_uvalue (logbuffer, number_of_methods);
+       emit_uvalue (logbuffer, fully_covered);
+       emit_uvalue (logbuffer, partially_covered);
+
+       EXIT_LOG_EXPLICIT (DO_SEND, NO_REQUESTS);
+}
+
+static void
+dump_coverage (MonoProfiler *prof)
+{
+       if (!coverage_initialized)
+               return;
+
+       COVERAGE_DEBUG(fprintf (stderr, "Coverage: Started dump\n");)
+       method_id = 0;
+
+       mono_os_mutex_lock (&coverage_mutex);
+       mono_conc_hashtable_foreach (coverage_assemblies, build_assembly_buffer, NULL);
+       mono_conc_hashtable_foreach (coverage_classes, build_class_buffer, NULL);
+       mono_conc_hashtable_foreach (coverage_methods, build_method_buffer, prof);
+       mono_os_mutex_unlock (&coverage_mutex);
+
+       COVERAGE_DEBUG(fprintf (stderr, "Coverage: Finished dump\n");)
+}
+
+static void
+process_method_enter_coverage (MonoProfiler *prof, MonoMethod *method)
+{
+       MonoClass *klass;
+       MonoImage *image;
+
+       if (!coverage_initialized)
+               return;
+
+       klass = mono_method_get_class (method);
+       image = mono_class_get_image (klass);
+
+       if (mono_conc_hashtable_lookup (suppressed_assemblies, (gpointer) mono_image_get_name (image)))
+               return;
+
+       mono_os_mutex_lock (&coverage_mutex);
+       mono_conc_hashtable_insert (entered_methods, method, method);
+       mono_os_mutex_unlock (&coverage_mutex);
+}
+
+static MonoLockFreeQueueNode *
+create_method_node (MonoMethod *method)
+{
+       MethodNode *node = (MethodNode *) g_malloc (sizeof (MethodNode));
+       mono_lock_free_queue_node_init ((MonoLockFreeQueueNode *) node, FALSE);
+       node->method = method;
+
+       return (MonoLockFreeQueueNode *) node;
+}
+
+static gboolean
+coverage_filter (MonoProfiler *prof, MonoMethod *method)
+{
+       MonoError error;
+       MonoClass *klass;
+       MonoImage *image;
+       MonoAssembly *assembly;
+       MonoMethodHeader *header;
+       guint32 iflags, flags, code_size;
+       char *fqn, *classname;
+       gboolean has_positive, found;
+       MonoLockFreeQueue *image_methods, *class_methods;
+       MonoLockFreeQueueNode *node;
+
+       g_assert (coverage_initialized && "Why are we being asked for coverage filter info when we're not doing coverage?");
+
+       COVERAGE_DEBUG(fprintf (stderr, "Coverage filter for %s\n", mono_method_get_name (method));)
+
+       flags = mono_method_get_flags (method, &iflags);
+       if ((iflags & 0x1000 /*METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL*/) ||
+           (flags & 0x2000 /*METHOD_ATTRIBUTE_PINVOKE_IMPL*/)) {
+               COVERAGE_DEBUG(fprintf (stderr, "   Internal call or pinvoke - ignoring\n");)
+               return FALSE;
+       }
+
+       // Don't need to do anything else if we're already tracking this method
+       if (mono_conc_hashtable_lookup (coverage_methods, method)) {
+               COVERAGE_DEBUG(fprintf (stderr, "   Already tracking\n");)
+               return TRUE;
+       }
+
+       klass = mono_method_get_class (method);
+       image = mono_class_get_image (klass);
+
+       // Don't handle coverage for the core assemblies
+       if (mono_conc_hashtable_lookup (suppressed_assemblies, (gpointer) mono_image_get_name (image)) != NULL)
+               return FALSE;
+
+       if (prof->coverage_filters) {
+               /* Check already filtered classes first */
+               if (mono_conc_hashtable_lookup (filtered_classes, klass)) {
+                       COVERAGE_DEBUG(fprintf (stderr, "   Already filtered\n");)
+                       return FALSE;
+               }
+
+               classname = mono_type_get_name (mono_class_get_type (klass));
+
+               fqn = g_strdup_printf ("[%s]%s", mono_image_get_name (image), classname);
+
+               COVERAGE_DEBUG(fprintf (stderr, "   Looking for %s in filter\n", fqn);)
+               // Check positive filters first
+               has_positive = FALSE;
+               found = FALSE;
+               for (guint i = 0; i < prof->coverage_filters->len; ++i) {
+                       char *filter = (char *)g_ptr_array_index (prof->coverage_filters, i);
+
+                       if (filter [0] == '+') {
+                               filter = &filter [1];
+
+                               COVERAGE_DEBUG(fprintf (stderr, "   Checking against +%s ...", filter);)
+
+                               if (strstr (fqn, filter) != NULL) {
+                                       COVERAGE_DEBUG(fprintf (stderr, "matched\n");)
+                                       found = TRUE;
+                               } else
+                                       COVERAGE_DEBUG(fprintf (stderr, "no match\n");)
+
+                               has_positive = TRUE;
+                       }
+               }
+
+               if (has_positive && !found) {
+                       COVERAGE_DEBUG(fprintf (stderr, "   Positive match was not found\n");)
+
+                       mono_os_mutex_lock (&coverage_mutex);
+                       mono_conc_hashtable_insert (filtered_classes, klass, klass);
+                       mono_os_mutex_unlock (&coverage_mutex);
+                       g_free (fqn);
+                       g_free (classname);
+
+                       return FALSE;
+               }
+
+               for (guint i = 0; i < prof->coverage_filters->len; ++i) {
+                       // FIXME: Is substring search sufficient?
+                       char *filter = (char *)g_ptr_array_index (prof->coverage_filters, i);
+                       if (filter [0] == '+')
+                               continue;
+
+                       // Skip '-'
+                       filter = &filter [1];
+                       COVERAGE_DEBUG(fprintf (stderr, "   Checking against -%s ...", filter);)
+
+                       if (strstr (fqn, filter) != NULL) {
+                               COVERAGE_DEBUG(fprintf (stderr, "matched\n");)
+
+                               mono_os_mutex_lock (&coverage_mutex);
+                               mono_conc_hashtable_insert (filtered_classes, klass, klass);
+                               mono_os_mutex_unlock (&coverage_mutex);
+                               g_free (fqn);
+                               g_free (classname);
+
+                               return FALSE;
+                       } else
+                               COVERAGE_DEBUG(fprintf (stderr, "no match\n");)
+
+               }
+
+               g_free (fqn);
+               g_free (classname);
+       }
+
+       COVERAGE_DEBUG(fprintf (stderr, "   Handling coverage for %s\n", mono_method_get_name (method));)
+       header = mono_method_get_header_checked (method, &error);
+       mono_error_cleanup (&error);
+
+       mono_method_header_get_code (header, &code_size, NULL);
+
+       assembly = mono_image_get_assembly (image);
+
+       // Need to keep the assemblies around for as long as they are kept in the hashtable
+       // Nunit, for example, has a habit of unloading them before the coverage statistics are
+       // generated causing a crash. See https://bugzilla.xamarin.com/show_bug.cgi?id=39325
+       mono_assembly_addref (assembly);
+
+       mono_os_mutex_lock (&coverage_mutex);
+       mono_conc_hashtable_insert (coverage_methods, method, method);
+       mono_conc_hashtable_insert (coverage_assemblies, assembly, assembly);
+       mono_os_mutex_unlock (&coverage_mutex);
+
+       image_methods = (MonoLockFreeQueue *)mono_conc_hashtable_lookup (image_to_methods, image);
+
+       if (image_methods == NULL) {
+               image_methods = (MonoLockFreeQueue *) g_malloc (sizeof (MonoLockFreeQueue));
+               mono_lock_free_queue_init (image_methods);
+               mono_os_mutex_lock (&coverage_mutex);
+               mono_conc_hashtable_insert (image_to_methods, image, image_methods);
+               mono_os_mutex_unlock (&coverage_mutex);
+       }
+
+       node = create_method_node (method);
+       mono_lock_free_queue_enqueue (image_methods, node);
+
+       class_methods = (MonoLockFreeQueue *)mono_conc_hashtable_lookup (coverage_classes, klass);
+
+       if (class_methods == NULL) {
+               class_methods = (MonoLockFreeQueue *) g_malloc (sizeof (MonoLockFreeQueue));
+               mono_lock_free_queue_init (class_methods);
+               mono_os_mutex_lock (&coverage_mutex);
+               mono_conc_hashtable_insert (coverage_classes, klass, class_methods);
+               mono_os_mutex_unlock (&coverage_mutex);
+       }
+
+       node = create_method_node (method);
+       mono_lock_free_queue_enqueue (class_methods, node);
+
+       return TRUE;
+}
+
+#define LINE_BUFFER_SIZE 4096
+/* Max file limit of 128KB */
+#define MAX_FILE_SIZE 128 * 1024
+static char *
+get_file_content (FILE *stream)
+{
+       char *buffer;
+       ssize_t bytes_read;
+       long filesize;
+       int res, offset = 0;
+
+       res = fseek (stream, 0, SEEK_END);
+       if (res < 0)
+         return NULL;
+
+       filesize = ftell (stream);
+       if (filesize < 0)
+         return NULL;
+
+       res = fseek (stream, 0, SEEK_SET);
+       if (res < 0)
+         return NULL;
+
+       if (filesize > MAX_FILE_SIZE)
+         return NULL;
+
+       buffer = (char *) g_malloc ((filesize + 1) * sizeof (char));
+       while ((bytes_read = fread (buffer + offset, 1, LINE_BUFFER_SIZE, stream)) > 0)
+               offset += bytes_read;
+
+       /* NULL terminate our buffer */
+       buffer[filesize] = '\0';
+       return buffer;
+}
+
+static char *
+get_next_line (char *contents, char **next_start)
+{
+       char *p = contents;
+
+       if (p == NULL || *p == '\0') {
+               *next_start = NULL;
+               return NULL;
+       }
+
+       while (*p != '\n' && *p != '\0')
+               p++;
+
+       if (*p == '\n') {
+               *p = '\0';
+               *next_start = p + 1;
+       } else
+               *next_start = NULL;
+
+       return contents;
+}
+
+static void
+init_suppressed_assemblies (void)
+{
+       char *content;
+       char *line;
+       FILE *sa_file;
+
+       suppressed_assemblies = mono_conc_hashtable_new (g_str_hash, g_str_equal);
+       sa_file = fopen (SUPPRESSION_DIR "/mono-profiler-log.suppression", "r");
+       if (sa_file == NULL)
+               return;
+
+       /* Don't need to free @content as it is referred to by the lines stored in @suppressed_assemblies */
+       content = get_file_content (sa_file);
+       if (content == NULL) {
+               g_error ("mono-profiler-log.suppression is greater than 128kb - aborting\n");
+       }
+
+       while ((line = get_next_line (content, &content))) {
+               line = g_strchomp (g_strchug (line));
+               /* No locking needed as we're doing initialization */
+               mono_conc_hashtable_insert (suppressed_assemblies, line, line);
+       }
+
+       fclose (sa_file);
+}
+
+static void
+coverage_init (MonoProfiler *prof)
+{
+       g_assert (!coverage_initialized && "Why are we initializing coverage twice?");
+
+       COVERAGE_DEBUG(fprintf (stderr, "Coverage initialized\n");)
+
+       mono_os_mutex_init (&coverage_mutex);
+       coverage_methods = mono_conc_hashtable_new (NULL, NULL);
+       coverage_assemblies = mono_conc_hashtable_new (NULL, NULL);
+       coverage_classes = mono_conc_hashtable_new (NULL, NULL);
+       filtered_classes = mono_conc_hashtable_new (NULL, NULL);
+       entered_methods = mono_conc_hashtable_new (NULL, NULL);
+       image_to_methods = mono_conc_hashtable_new (NULL, NULL);
+       init_suppressed_assemblies ();
+
+       coverage_initialized = TRUE;
+}
+
+static void
+unref_coverage_assemblies (gpointer key, gpointer value, gpointer userdata)
+{
+       MonoAssembly *assembly = (MonoAssembly *)value;
+       mono_assembly_close (assembly);
+}
+
+static void
+free_sample_hit (gpointer p)
+{
+       mono_lock_free_free (p, SAMPLE_BLOCK_SIZE);
+}
+
+static void
+cleanup_reusable_samples (MonoProfiler *prof)
+{
+       SampleHit *sample;
+
+       while ((sample = (SampleHit *) mono_lock_free_queue_dequeue (&prof->sample_reuse_queue)))
+               mono_thread_hazardous_try_free (sample, free_sample_hit);
+}
+
+static void
+log_shutdown (MonoProfiler *prof)
+{
+       InterlockedWrite (&in_shutdown, 1);
+
+       if (!no_counters)
+               counters_and_perfcounters_sample (prof);
+
+       dump_coverage (prof);
+
+       char c = 1;
+
+       if (write (prof->pipes [1], &c, 1) != 1) {
+               fprintf (stderr, "Could not write to pipe: %s\n", strerror (errno));
+               exit (1);
+       }
+
+       mono_native_thread_join (prof->helper_thread);
+
+       mono_os_mutex_destroy (&counters_mutex);
+
+       MonoCounterAgent *mc_next;
+
+       for (MonoCounterAgent *cur = counters; cur; cur = mc_next) {
+               mc_next = cur->next;
+               g_free (cur);
+       }
+
+       PerfCounterAgent *pc_next;
+
+       for (PerfCounterAgent *cur = perfcounters; cur; cur = pc_next) {
+               pc_next = cur->next;
+               g_free (cur);
+       }
+
+       /*
+        * Ensure that we empty the LLS completely, even if some nodes are
+        * not immediately removed upon calling mono_lls_remove (), by
+        * iterating until the head is NULL.
+        */
+       while (profiler_thread_list.head) {
+               MONO_LLS_FOREACH_SAFE (&profiler_thread_list, MonoProfilerThread, thread) {
+                       g_assert (thread->attached && "Why is a thread in the LLS not attached?");
+
+                       remove_thread (thread);
+               } MONO_LLS_FOREACH_SAFE_END
+       }
+
+       /*
+        * Ensure that all threads have been freed, so that we don't miss any
+        * buffers when we shut down the writer thread below.
+        */
+       mono_thread_hazardous_try_free_all ();
+
+       InterlockedWrite (&prof->run_dumper_thread, 0);
+       mono_os_sem_post (&prof->dumper_queue_sem);
+       mono_native_thread_join (prof->dumper_thread);
+       mono_os_sem_destroy (&prof->dumper_queue_sem);
+
+       InterlockedWrite (&prof->run_writer_thread, 0);
+       mono_os_sem_post (&prof->writer_queue_sem);
+       mono_native_thread_join (prof->writer_thread);
+       mono_os_sem_destroy (&prof->writer_queue_sem);
+
+       /*
+        * Free all writer queue entries, and ensure that all sample hits will be
+        * added to the sample reuse queue.
+        */
+       mono_thread_hazardous_try_free_all ();
+
+       cleanup_reusable_samples (prof);
+
+       /*
+        * Finally, make sure that all sample hits are freed. This should cover all
+        * hazardous data from the profiler. We can now be sure that the runtime
+        * won't later invoke free functions in the profiler library after it has
+        * been unloaded.
+        */
+       mono_thread_hazardous_try_free_all ();
+
+       g_assert (!InterlockedRead (&buffer_rwlock_count) && "Why is the reader count still non-zero?");
+       g_assert (!InterlockedReadPointer (&buffer_rwlock_exclusive) && "Why does someone still hold the exclusive lock?");
+
+#if defined (HAVE_SYS_ZLIB)
+       if (prof->gzfile)
+               gzclose (prof->gzfile);
+#endif
+       if (prof->pipe_output)
+               pclose (prof->file);
+       else
+               fclose (prof->file);
+
+       mono_conc_hashtable_destroy (prof->method_table);
+       mono_os_mutex_destroy (&prof->method_table_mutex);
+
+       if (coverage_initialized) {
+               mono_os_mutex_lock (&coverage_mutex);
+               mono_conc_hashtable_foreach (coverage_assemblies, unref_coverage_assemblies, prof);
+               mono_os_mutex_unlock (&coverage_mutex);
+
+               mono_conc_hashtable_destroy (coverage_methods);
+               mono_conc_hashtable_destroy (coverage_assemblies);
+               mono_conc_hashtable_destroy (coverage_classes);
+               mono_conc_hashtable_destroy (filtered_classes);
+
+               mono_conc_hashtable_destroy (entered_methods);
+               mono_conc_hashtable_destroy (image_to_methods);
+               mono_conc_hashtable_destroy (suppressed_assemblies);
+               mono_os_mutex_destroy (&coverage_mutex);
+       }
+
+       PROF_TLS_FREE ();
+
+       g_free (prof->args);
+       g_free (prof);
+}
+
+static char*
+new_filename (const char* filename)
+{
+       time_t t = time (NULL);
+       int pid = process_id ();
+       char pid_buf [16];
+       char time_buf [16];
+       char *res, *d;
+       const char *p;
+       int count_dates = 0;
+       int count_pids = 0;
+       int s_date, s_pid;
+       struct tm *ts;
+       for (p = filename; *p; p++) {
+               if (*p != '%')
+                       continue;
+               p++;
+               if (*p == 't')
+                       count_dates++;
+               else if (*p == 'p')
+                       count_pids++;
+               else if (*p == 0)
+                       break;
+       }
+       if (!count_dates && !count_pids)
+               return pstrdup (filename);
+       snprintf (pid_buf, sizeof (pid_buf), "%d", pid);
+       ts = gmtime (&t);
+       snprintf (time_buf, sizeof (time_buf), "%d%02d%02d%02d%02d%02d",
+               1900 + ts->tm_year, 1 + ts->tm_mon, ts->tm_mday, ts->tm_hour, ts->tm_min, ts->tm_sec);
+       s_date = strlen (time_buf);
+       s_pid = strlen (pid_buf);
+       d = res = (char *) g_malloc (strlen (filename) + s_date * count_dates + s_pid * count_pids);
+       for (p = filename; *p; p++) {
+               if (*p != '%') {
+                       *d++ = *p;
+                       continue;
+               }
+               p++;
+               if (*p == 't') {
+                       strcpy (d, time_buf);
+                       d += s_date;
+                       continue;
+               } else if (*p == 'p') {
+                       strcpy (d, pid_buf);
+                       d += s_pid;
+                       continue;
+               } else if (*p == '%') {
+                       *d++ = '%';
+                       continue;
+               } else if (*p == 0)
+                       break;
+               *d++ = '%';
+               *d++ = *p;
+       }
+       *d = 0;
+       return res;
+}
+
+static void
+add_to_fd_set (fd_set *set, int fd, int *max_fd)
+{
+       /*
+        * This should only trigger for the basic FDs (server socket, pipes) at
+        * startup if for some mysterious reason they're too large. In this case,
+        * the profiler really can't function, and we're better off printing an
+        * error and exiting.
+        */
+       if (fd >= FD_SETSIZE) {
+               fprintf (stderr, "File descriptor is out of bounds for fd_set: %d\n", fd);
+               exit (1);
+       }
+
+       FD_SET (fd, set);
+
+       if (*max_fd < fd)
+               *max_fd = fd;
+}
+
+static void *
+helper_thread (void *arg)
+{
+       MonoProfiler *prof = (MonoProfiler *) arg;
+
+       mono_threads_attach_tools_thread ();
+       mono_native_thread_set_name (mono_native_thread_id_get (), "Profiler helper");
+
+       MonoProfilerThread *thread = init_thread (prof, FALSE);
+
+       GArray *command_sockets = g_array_new (FALSE, FALSE, sizeof (int));
+
+       while (1) {
+               fd_set rfds;
+               int max_fd = -1;
+
+               FD_ZERO (&rfds);
+
+               add_to_fd_set (&rfds, prof->server_socket, &max_fd);
+               add_to_fd_set (&rfds, prof->pipes [0], &max_fd);
+
+               for (gint i = 0; i < command_sockets->len; i++)
+                       add_to_fd_set (&rfds, g_array_index (command_sockets, int, i), &max_fd);
+
+               struct timeval tv = { .tv_sec = 1, .tv_usec = 0 };
+
+               // Sleep for 1sec or until a file descriptor has data.
+               if (select (max_fd + 1, &rfds, NULL, NULL, &tv) == -1) {
+                       if (errno == EINTR)
+                               continue;
+
+                       fprintf (stderr, "Error in mono-profiler-log server: %s", strerror (errno));
+                       exit (1);
+               }
+
+               if (!no_counters)
+                       counters_and_perfcounters_sample (prof);
+
+               buffer_lock_excl ();
+
+               sync_point (SYNC_POINT_PERIODIC);
+
+               buffer_unlock_excl ();
+
+               // Are we shutting down?
+               if (FD_ISSET (prof->pipes [0], &rfds)) {
+                       char c;
+                       read (prof->pipes [0], &c, 1);
+                       break;
+               }
+
+               for (gint i = 0; i < command_sockets->len; i++) {
+                       int fd = g_array_index (command_sockets, int, i);
+
+                       if (!FD_ISSET (fd, &rfds))
+                               continue;
+
+                       char buf [64];
+                       int len = read (fd, buf, sizeof (buf) - 1);
+
+                       if (len == -1)
+                               continue;
+
+                       if (!len) {
+                               // The other end disconnected.
+                               g_array_remove_index (command_sockets, i);
+                               close (fd);
+
+                               continue;
+                       }
+
+                       buf [len] = 0;
+
+                       if (!strcmp (buf, "heapshot\n") && hs_mode_ondemand) {
+                               // Rely on the finalization callbacks invoking process_requests ().
+                               heapshot_requested = 1;
+                               mono_gc_finalize_notify ();
+                       }
+               }
+
+               if (FD_ISSET (prof->server_socket, &rfds)) {
+                       int fd = accept (prof->server_socket, NULL, NULL);
+
+                       if (fd != -1) {
+                               if (fd >= FD_SETSIZE)
+                                       close (fd);
+                               else
+                                       g_array_append_val (command_sockets, fd);
+                       }
+               }
+       }
+
+       for (gint i = 0; i < command_sockets->len; i++)
+               close (g_array_index (command_sockets, int, i));
+
+       g_array_free (command_sockets, TRUE);
+
+       send_log_unsafe (FALSE);
+       deinit_thread (thread);
+
+       mono_thread_info_detach ();
+
+       return NULL;
+}
+
+static void
+start_helper_thread (MonoProfiler* prof)
+{
+       if (pipe (prof->pipes) == -1) {
+               fprintf (stderr, "Cannot create pipe: %s\n", strerror (errno));
+               exit (1);
+       }
+
+       prof->server_socket = socket (PF_INET, SOCK_STREAM, 0);
+
+       if (prof->server_socket == -1) {
+               fprintf (stderr, "Cannot create server socket: %s\n", strerror (errno));
+               exit (1);
+       }
+
+       struct sockaddr_in server_address;
+
+       memset (&server_address, 0, sizeof (server_address));
+       server_address.sin_family = AF_INET;
+       server_address.sin_addr.s_addr = INADDR_ANY;
+       server_address.sin_port = htons (prof->command_port);
+
+       if (bind (prof->server_socket, (struct sockaddr *) &server_address, sizeof (server_address)) == -1) {
+               fprintf (stderr, "Cannot bind server socket on port %d: %s\n", prof->command_port, strerror (errno));
+               close (prof->server_socket);
+               exit (1);
+       }
+
+       if (listen (prof->server_socket, 1) == -1) {
+               fprintf (stderr, "Cannot listen on server socket: %s\n", strerror (errno));
+               close (prof->server_socket);
+               exit (1);
+       }
+
+       socklen_t slen = sizeof (server_address);
+
+       if (getsockname (prof->server_socket, (struct sockaddr *) &server_address, &slen)) {
+               fprintf (stderr, "Could not get assigned port: %s\n", strerror (errno));
+               close (prof->server_socket);
+               exit (1);
+       }
+
+       prof->command_port = ntohs (server_address.sin_port);
+
+       if (!mono_native_thread_create (&prof->helper_thread, helper_thread, prof)) {
+               fprintf (stderr, "Could not start helper thread\n");
+               close (prof->server_socket);
+               exit (1);
+       }
+}
+
+static void
+free_writer_entry (gpointer p)
+{
+       mono_lock_free_free (p, WRITER_ENTRY_BLOCK_SIZE);
+}
+
+static gboolean
+handle_writer_queue_entry (MonoProfiler *prof)
+{
+       WriterQueueEntry *entry;
+
+       if ((entry = (WriterQueueEntry *) mono_lock_free_queue_dequeue (&prof->writer_queue))) {
+               if (!entry->methods)
+                       goto no_methods;
+
+               gboolean wrote_methods = FALSE;
+
+               /*
+                * Encode the method events in a temporary log buffer that we
+                * flush to disk before the main buffer, ensuring that all
+                * methods have metadata emitted before they're referenced.
+                *
+                * We use a 'proper' thread-local buffer for this as opposed
+                * to allocating and freeing a buffer by hand because the call
+                * to mono_method_full_name () below may trigger class load
+                * events when it retrieves the signature of the method. So a
+                * thread-local buffer needs to exist when such events occur.
+                */
+               for (guint i = 0; i < entry->methods->len; i++) {
+                       MethodInfo *info = (MethodInfo *) g_ptr_array_index (entry->methods, i);
+
+                       if (mono_conc_hashtable_lookup (prof->method_table, info->method))
+                               goto free_info; // This method already has metadata emitted.
+
+                       /*
+                        * Other threads use this hash table to get a general
+                        * idea of whether a method has already been emitted to
+                        * the stream. Due to the way we add to this table, it
+                        * can easily happen that multiple threads queue up the
+                        * same methods, but that's OK since eventually all
+                        * methods will be in this table and the thread-local
+                        * method lists will just be empty for the rest of the
+                        * app's lifetime.
+                        */
+                       mono_os_mutex_lock (&prof->method_table_mutex);
+                       mono_conc_hashtable_insert (prof->method_table, info->method, info->method);
+                       mono_os_mutex_unlock (&prof->method_table_mutex);
+
+                       char *name = mono_method_full_name (info->method, 1);
+                       int nlen = strlen (name) + 1;
+                       void *cstart = info->ji ? mono_jit_info_get_code_start (info->ji) : NULL;
+                       int csize = info->ji ? mono_jit_info_get_code_size (info->ji) : 0;
+
+                       ENTER_LOG (&method_jits_ctr, logbuffer,
+                               EVENT_SIZE /* event */ +
+                               LEB128_SIZE /* method */ +
+                               LEB128_SIZE /* start */ +
+                               LEB128_SIZE /* size */ +
+                               nlen /* name */
+                       );
+
+                       emit_event_time (logbuffer, TYPE_JIT | TYPE_METHOD, info->time);
+                       emit_method_inner (logbuffer, info->method);
+                       emit_ptr (logbuffer, cstart);
+                       emit_value (logbuffer, csize);
+
+                       memcpy (logbuffer->cursor, name, nlen);
+                       logbuffer->cursor += nlen;
+
+                       EXIT_LOG_EXPLICIT (NO_SEND, NO_REQUESTS);
+
+                       mono_free (name);
+
+                       wrote_methods = TRUE;
+
+               free_info:
+                       g_free (info);
+               }
+
+               g_ptr_array_free (entry->methods, TRUE);
+
+               if (wrote_methods) {
+                       dump_buffer_threadless (prof, PROF_TLS_GET ()->buffer);
+                       init_buffer_state (PROF_TLS_GET ());
+               }
+
+       no_methods:
+               dump_buffer (prof, entry->buffer);
+
+               mono_thread_hazardous_try_free (entry, free_writer_entry);
+
+               return TRUE;
+       }
+
+       return FALSE;
+}
+
+static void *
+writer_thread (void *arg)
+{
+       MonoProfiler *prof = (MonoProfiler *)arg;
+
+       mono_threads_attach_tools_thread ();
+       mono_native_thread_set_name (mono_native_thread_id_get (), "Profiler writer");
+
+       dump_header (prof);
+
+       MonoProfilerThread *thread = init_thread (prof, FALSE);
+
+       while (InterlockedRead (&prof->run_writer_thread)) {
+               mono_os_sem_wait (&prof->writer_queue_sem, MONO_SEM_FLAGS_NONE);
+               handle_writer_queue_entry (prof);
+       }
+
+       /* Drain any remaining entries on shutdown. */
+       while (handle_writer_queue_entry (prof));
+
+       free_buffer (thread->buffer, thread->buffer->size);
+       deinit_thread (thread);
+
+       mono_thread_info_detach ();
+
+       return NULL;
+}
+
+static void
+start_writer_thread (MonoProfiler* prof)
+{
+       InterlockedWrite (&prof->run_writer_thread, 1);
+
+       if (!mono_native_thread_create (&prof->writer_thread, writer_thread, prof)) {
+               fprintf (stderr, "Could not start writer thread\n");
+               exit (1);
+       }
+}
+
+static void
+reuse_sample_hit (gpointer p)
+{
+       SampleHit *sample = p;
+
+       mono_lock_free_queue_node_unpoison (&sample->node);
+       mono_lock_free_queue_enqueue (&sample->prof->sample_reuse_queue, &sample->node);
+}
+
+static gboolean
+handle_dumper_queue_entry (MonoProfiler *prof)
+{
+       SampleHit *sample;
+
+       if ((sample = (SampleHit *) mono_lock_free_queue_dequeue (&prof->dumper_queue))) {
+               for (int i = 0; i < sample->count; ++i) {
+                       MonoMethod *method = sample->frames [i].method;
+                       MonoDomain *domain = sample->frames [i].domain;
+                       void *address = sample->frames [i].base_address;
+
+                       if (!method) {
+                               g_assert (domain && "What happened to the domain pointer?");
+                               g_assert (address && "What happened to the instruction pointer?");
+
+                               MonoJitInfo *ji = mono_jit_info_table_find (domain, (char *) address);
+
+                               if (ji)
+                                       sample->frames [i].method = mono_jit_info_get_method (ji);
+                       }
+               }
+
+               ENTER_LOG (&sample_hits_ctr, logbuffer,
+                       EVENT_SIZE /* event */ +
+                       BYTE_SIZE /* type */ +
+                       LEB128_SIZE /* tid */ +
+                       LEB128_SIZE /* count */ +
+                       1 * (
+                               LEB128_SIZE /* ip */
+                       ) +
+                       LEB128_SIZE /* managed count */ +
+                       sample->count * (
+                               LEB128_SIZE /* method */
+                       )
+               );
+
+               emit_event_time (logbuffer, TYPE_SAMPLE | TYPE_SAMPLE_HIT, sample->time);
+               emit_byte (logbuffer, SAMPLE_CYCLES);
+               emit_ptr (logbuffer, (void *) sample->tid);
+               emit_value (logbuffer, 1);
+
+               // TODO: Actual native unwinding.
+               for (int i = 0; i < 1; ++i) {
+                       emit_ptr (logbuffer, sample->ip);
+                       add_code_pointer ((uintptr_t) sample->ip);
+               }
+
+               /* new in data version 6 */
+               emit_uvalue (logbuffer, sample->count);
+
+               for (int i = 0; i < sample->count; ++i)
+                       emit_method (logbuffer, sample->frames [i].method);
+
+               EXIT_LOG_EXPLICIT (DO_SEND, NO_REQUESTS);
+
+               mono_thread_hazardous_try_free (sample, reuse_sample_hit);
+
+               dump_unmanaged_coderefs (prof);
+       }
+
+       return FALSE;
+}
+
+static void *
+dumper_thread (void *arg)
+{
+       MonoProfiler *prof = (MonoProfiler *)arg;
+
+       mono_threads_attach_tools_thread ();
+       mono_native_thread_set_name (mono_native_thread_id_get (), "Profiler dumper");
+
+       MonoProfilerThread *thread = init_thread (prof, FALSE);
+
+       while (InterlockedRead (&prof->run_dumper_thread)) {
+               mono_os_sem_wait (&prof->dumper_queue_sem, MONO_SEM_FLAGS_NONE);
+               handle_dumper_queue_entry (prof);
+       }
+
+       /* Drain any remaining entries on shutdown. */
+       while (handle_dumper_queue_entry (prof));
+
+       send_log_unsafe (FALSE);
+       deinit_thread (thread);
+
+       mono_thread_info_detach ();
+
+       return NULL;
+}
+
+static void
+start_dumper_thread (MonoProfiler* prof)
+{
+       InterlockedWrite (&prof->run_dumper_thread, 1);
+
+       if (!mono_native_thread_create (&prof->dumper_thread, dumper_thread, prof)) {
+               fprintf (stderr, "Could not start dumper thread\n");
+               exit (1);
+       }
+}
+
+static void
+register_counter (const char *name, gint32 *counter)
+{
+       mono_counters_register (name, MONO_COUNTER_UINT | MONO_COUNTER_PROFILER | MONO_COUNTER_MONOTONIC, counter);
+}
+
+static void
+runtime_initialized (MonoProfiler *profiler)
+{
+       InterlockedWrite (&runtime_inited, 1);
+
+       register_counter ("Sample events allocated", &sample_allocations_ctr);
+       register_counter ("Log buffers allocated", &buffer_allocations_ctr);
+
+       register_counter ("Event: Sync points", &sync_points_ctr);
+       register_counter ("Event: Heap objects", &heap_objects_ctr);
+       register_counter ("Event: Heap starts", &heap_starts_ctr);
+       register_counter ("Event: Heap ends", &heap_ends_ctr);
+       register_counter ("Event: Heap roots", &heap_roots_ctr);
+       register_counter ("Event: GC events", &gc_events_ctr);
+       register_counter ("Event: GC resizes", &gc_resizes_ctr);
+       register_counter ("Event: GC allocations", &gc_allocs_ctr);
+       register_counter ("Event: GC moves", &gc_moves_ctr);
+       register_counter ("Event: GC handle creations", &gc_handle_creations_ctr);
+       register_counter ("Event: GC handle deletions", &gc_handle_deletions_ctr);
+       register_counter ("Event: GC finalize starts", &finalize_begins_ctr);
+       register_counter ("Event: GC finalize ends", &finalize_ends_ctr);
+       register_counter ("Event: GC finalize object starts", &finalize_object_begins_ctr);
+       register_counter ("Event: GC finalize object ends", &finalize_object_ends_ctr);
+       register_counter ("Event: Image loads", &image_loads_ctr);
+       register_counter ("Event: Image unloads", &image_unloads_ctr);
+       register_counter ("Event: Assembly loads", &assembly_loads_ctr);
+       register_counter ("Event: Assembly unloads", &assembly_unloads_ctr);
+       register_counter ("Event: Class loads", &class_loads_ctr);
+       register_counter ("Event: Class unloads", &class_unloads_ctr);
+       register_counter ("Event: Method entries", &method_entries_ctr);
+       register_counter ("Event: Method exits", &method_exits_ctr);
+       register_counter ("Event: Method exception leaves", &method_exception_exits_ctr);
+       register_counter ("Event: Method JITs", &method_jits_ctr);
+       register_counter ("Event: Code buffers", &code_buffers_ctr);
+       register_counter ("Event: Exception throws", &exception_throws_ctr);
+       register_counter ("Event: Exception clauses", &exception_clauses_ctr);
+       register_counter ("Event: Monitor contentions", &monitor_contentions_ctr);
+       register_counter ("Event: Monitor acquisitions", &monitor_acquisitions_ctr);
+       register_counter ("Event: Monitor failures", &monitor_failures_ctr);
+       register_counter ("Event: Thread starts", &thread_starts_ctr);
+       register_counter ("Event: Thread ends", &thread_ends_ctr);
+       register_counter ("Event: Thread names", &thread_names_ctr);
+       register_counter ("Event: Domain loads", &domain_loads_ctr);
+       register_counter ("Event: Domain unloads", &domain_unloads_ctr);
+       register_counter ("Event: Domain names", &domain_names_ctr);
+       register_counter ("Event: Context loads", &context_loads_ctr);
+       register_counter ("Event: Context unloads", &context_unloads_ctr);
+       register_counter ("Event: Sample binaries", &sample_ubins_ctr);
+       register_counter ("Event: Sample symbols", &sample_usyms_ctr);
+       register_counter ("Event: Sample hits", &sample_hits_ctr);
+       register_counter ("Event: Counter descriptors", &counter_descriptors_ctr);
+       register_counter ("Event: Counter samples", &counter_samples_ctr);
+       register_counter ("Event: Performance counter descriptors", &perfcounter_descriptors_ctr);
+       register_counter ("Event: Performance counter samples", &perfcounter_samples_ctr);
+       register_counter ("Event: Coverage methods", &coverage_methods_ctr);
+       register_counter ("Event: Coverage statements", &coverage_statements_ctr);
+       register_counter ("Event: Coverage classes", &coverage_classes_ctr);
+       register_counter ("Event: Coverage assemblies", &coverage_assemblies_ctr);
+
+       counters_init (profiler);
+
+       /*
+        * We must start the helper thread before the writer thread. This is
+        * because the helper thread sets up the command port which is written to
+        * the log header by the writer thread.
+        */
+       start_helper_thread (profiler);
+       start_writer_thread (profiler);
+       start_dumper_thread (profiler);
+}
+
+static MonoProfiler*
+create_profiler (const char *args, const char *filename, GPtrArray *filters)
+{
+       MonoProfiler *prof;
+       char *nf;
+       int force_delete = 0;
+       prof = (MonoProfiler *) g_calloc (1, sizeof (MonoProfiler));
+
+       prof->args = pstrdup (args);
+       prof->command_port = command_port;
+       if (filename && *filename == '-') {
+               force_delete = 1;
+               filename++;
+       }
+       if (!filename) {
+               if (do_report)
+                       filename = "|mprof-report -";
+               else
+                       filename = "output.mlpd";
+               nf = (char*)filename;
+       } else {
+               nf = new_filename (filename);
+               if (do_report) {
+                       int s = strlen (nf) + 32;
+                       char *p = (char *) g_malloc (s);
+                       snprintf (p, s, "|mprof-report '--out=%s' -", nf);
+                       g_free (nf);
+                       nf = p;
+               }
+       }
+       if (*nf == '|') {
+               prof->file = popen (nf + 1, "w");
+               prof->pipe_output = 1;
+       } else if (*nf == '#') {
+               int fd = strtol (nf + 1, NULL, 10);
+               prof->file = fdopen (fd, "a");
+       } else {
+               if (force_delete)
+                       unlink (nf);
+               prof->file = fopen (nf, "wb");
+       }
+       if (!prof->file) {
+               fprintf (stderr, "Cannot create profiler output: %s\n", nf);
+               exit (1);
+       }
+
+#if defined (HAVE_SYS_ZLIB)
+       if (use_zip)
+               prof->gzfile = gzdopen (fileno (prof->file), "wb");
+#endif
+
+       /*
+        * If you hit this assert while increasing MAX_FRAMES, you need to increase
+        * SAMPLE_BLOCK_SIZE as well.
+        */
+       g_assert (SAMPLE_SLOT_SIZE (MAX_FRAMES) * 2 < LOCK_FREE_ALLOC_SB_USABLE_SIZE (SAMPLE_BLOCK_SIZE));
+
+       // FIXME: We should free this stuff too.
+       mono_lock_free_allocator_init_size_class (&prof->sample_size_class, SAMPLE_SLOT_SIZE (num_frames), SAMPLE_BLOCK_SIZE);
+       mono_lock_free_allocator_init_allocator (&prof->sample_allocator, &prof->sample_size_class, MONO_MEM_ACCOUNT_PROFILER);
+
+       mono_lock_free_queue_init (&prof->sample_reuse_queue);
+
+       g_assert (sizeof (WriterQueueEntry) * 2 < LOCK_FREE_ALLOC_SB_USABLE_SIZE (WRITER_ENTRY_BLOCK_SIZE));
+
+       // FIXME: We should free this stuff too.
+       mono_lock_free_allocator_init_size_class (&prof->writer_entry_size_class, sizeof (WriterQueueEntry), WRITER_ENTRY_BLOCK_SIZE);
+       mono_lock_free_allocator_init_allocator (&prof->writer_entry_allocator, &prof->writer_entry_size_class, MONO_MEM_ACCOUNT_PROFILER);
+
+       mono_lock_free_queue_init (&prof->writer_queue);
+       mono_os_sem_init (&prof->writer_queue_sem, 0);
+
+       mono_lock_free_queue_init (&prof->dumper_queue);
+       mono_os_sem_init (&prof->dumper_queue_sem, 0);
+
+       mono_os_mutex_init (&prof->method_table_mutex);
+       prof->method_table = mono_conc_hashtable_new (NULL, NULL);
+
+       if (do_coverage)
+               coverage_init (prof);
+       prof->coverage_filters = filters;
+
+       prof->startup_time = current_time ();
+       return prof;
+}
+
+static void
+usage (int do_exit)
+{
+       printf ("Log profiler version %d.%d (format: %d)\n", LOG_VERSION_MAJOR, LOG_VERSION_MINOR, LOG_DATA_VERSION);
+       printf ("Usage: mono --profile=log[:OPTION1[,OPTION2...]] program.exe\n");
+       printf ("Options:\n");
+       printf ("\thelp                 show this usage info\n");
+       printf ("\t[no]alloc            enable/disable recording allocation info\n");
+       printf ("\t[no]calls            enable/disable recording enter/leave method events\n");
+       printf ("\theapshot[=MODE]      record heap shot info (by default at each major collection)\n");
+       printf ("\t                     MODE: every XXms milliseconds, every YYgc collections, ondemand\n");
+       printf ("\tcounters             sample counters every 1s\n");
+       printf ("\tsample[=TYPE]        use statistical sampling mode (by default cycles/100)\n");
+       printf ("\t                     TYPE: cycles,instr,cacherefs,cachemiss,branches,branchmiss\n");
+       printf ("\t                     TYPE can be followed by /FREQUENCY\n");
+       printf ("\tmaxframes=NUM        collect up to NUM stack frames\n");
+       printf ("\tcalldepth=NUM        ignore method events for call chain depth bigger than NUM\n");
+       printf ("\toutput=FILENAME      write the data to file FILENAME (-FILENAME to overwrite)\n");
+       printf ("\toutput=|PROGRAM      write the data to the stdin of PROGRAM\n");
+       printf ("\t                     %%t is subtituted with date and time, %%p with the pid\n");
+       printf ("\treport               create a report instead of writing the raw data to a file\n");
+       printf ("\tzip                  compress the output data\n");
+       printf ("\tport=PORTNUM         use PORTNUM for the listening command server\n");
+       printf ("\tcoverage             enable collection of code coverage data\n");
+       printf ("\tcovfilter=ASSEMBLY   add an assembly to the code coverage filters\n");
+       printf ("\t                     add a + to include the assembly or a - to exclude it\n");
+       printf ("\t                     filter=-mscorlib\n");
+       printf ("\tcovfilter-file=FILE  use FILE to generate the list of assemblies to be filtered\n");
+       if (do_exit)
+               exit (1);
+}
+
+static const char*
+match_option (const char* p, const char *opt, char **rval)
+{
+       int len = strlen (opt);
+       if (strncmp (p, opt, len) == 0) {
+               if (rval) {
+                       if (p [len] == '=' && p [len + 1]) {
+                               const char *opt = p + len + 1;
+                               const char *end = strchr (opt, ',');
+                               char *val;
+                               int l;
+                               if (end == NULL) {
+                                       l = strlen (opt);
+                               } else {
+                                       l = end - opt;
+                               }
+                               val = (char *) g_malloc (l + 1);
+                               memcpy (val, opt, l);
+                               val [l] = 0;
+                               *rval = val;
+                               return opt + l;
+                       }
+                       if (p [len] == 0 || p [len] == ',') {
+                               *rval = NULL;
+                               return p + len + (p [len] == ',');
+                       }
+                       usage (1);
+               } else {
+                       if (p [len] == 0)
+                               return p + len;
+                       if (p [len] == ',')
+                               return p + len + 1;
+               }
+       }
+       return p;
+}
+
+static void
+set_sample_freq (char *val)
+{
+       do_mono_sample = 1;
+       sample_freq = 100;
+
+       if (!val)
+               return;
+
+       char *p = val;
+
+       // Is it only the frequency (new option style)?
+       if (isdigit (*p))
+               goto parse;
+
+       // Skip the sample type for backwards compatibility.
+       while (isalpha (*p))
+               p++;
+
+       // Skip the forward slash only if we got a sample type.
+       if (p != val && *p == '/') {
+               p++;
+
+               char *end;
+
+       parse:
+               sample_freq = strtoul (p, &end, 10);
+
+               if (p == end)
+                       usage (1);
+
+               p = end;
+       }
+
+       if (*p)
+               usage (1);
+
+       g_free (val);
+}
+
+static void
+set_hsmode (char* val, int allow_empty)
+{
+       char *end;
+       unsigned int count;
+       if (allow_empty && !val)
+               return;
+       if (strcmp (val, "ondemand") == 0) {
+               hs_mode_ondemand = 1;
+               g_free (val);
+               return;
+       }
+       count = strtoul (val, &end, 10);
+       if (val == end)
+               usage (1);
+       if (strcmp (end, "ms") == 0)
+               hs_mode_ms = count;
+       else if (strcmp (end, "gc") == 0)
+               hs_mode_gc = count;
+       else
+               usage (1);
+       g_free (val);
+}
+
+/*
+ * declaration to silence the compiler: this is the entry point that
+ * mono will load from the shared library and call.
+ */
+extern void
+mono_profiler_startup (const char *desc);
+
+extern void
+mono_profiler_startup_log (const char *desc);
+
+/*
+ * this is the entry point that will be used when the profiler
+ * is embedded inside the main executable.
+ */
+void
+mono_profiler_startup_log (const char *desc)
+{
+       mono_profiler_startup (desc);
+}
+
+void
+mono_profiler_startup (const char *desc)
+{
+       MonoProfiler *prof;
+       GPtrArray *filters = NULL;
+       char *filename = NULL;
+       const char *p;
+       const char *opt;
+       int calls_enabled = 0;
+       int allocs_enabled = 0;
+       int events = MONO_PROFILE_GC|MONO_PROFILE_ALLOCATIONS|
+               MONO_PROFILE_GC_MOVES|MONO_PROFILE_CLASS_EVENTS|MONO_PROFILE_THREADS|
+               MONO_PROFILE_ENTER_LEAVE|MONO_PROFILE_JIT_COMPILATION|MONO_PROFILE_EXCEPTIONS|
+               MONO_PROFILE_MONITOR_EVENTS|MONO_PROFILE_MODULE_EVENTS|MONO_PROFILE_GC_ROOTS|
+               MONO_PROFILE_INS_COVERAGE|MONO_PROFILE_APPDOMAIN_EVENTS|MONO_PROFILE_CONTEXT_EVENTS|
+               MONO_PROFILE_ASSEMBLY_EVENTS|MONO_PROFILE_GC_FINALIZATION;
+
+       max_allocated_sample_hits = mono_cpu_count () * 1000;
+
+       p = desc;
+       if (strncmp (p, "log", 3))
+               usage (1);
+       p += 3;
+       if (*p == ':')
+               p++;
+       for (; *p; p = opt) {
+               char *val;
+               if (*p == ',') {
+                       opt = p + 1;
+                       continue;
+               }
+               if ((opt = match_option (p, "help", NULL)) != p) {
+                       usage (0);
+                       continue;
+               }
+               if ((opt = match_option (p, "calls", NULL)) != p) {
+                       calls_enabled = 1;
+                       continue;
+               }
+               if ((opt = match_option (p, "nocalls", NULL)) != p) {
+                       events &= ~MONO_PROFILE_ENTER_LEAVE;
+                       nocalls = 1;
+                       continue;
+               }
+               if ((opt = match_option (p, "alloc", NULL)) != p) {
+                       allocs_enabled = 1;
+                       continue;
+               }
+               if ((opt = match_option (p, "noalloc", NULL)) != p) {
+                       events &= ~MONO_PROFILE_ALLOCATIONS;
+                       events &= ~MONO_PROFILE_GC_MOVES;
+                       continue;
+               }
+               if ((opt = match_option (p, "nocounters", NULL)) != p) {
+                       no_counters = TRUE;
+                       continue;
+               }
+               if ((opt = match_option (p, "time", &val)) != p) {
+                       // For backwards compatibility.
+                       if (strcmp (val, "fast") && strcmp (val, "null"))
+                               usage (1);
+                       g_free (val);
+                       continue;
+               }
+               if ((opt = match_option (p, "report", NULL)) != p) {
+                       do_report = 1;
+                       continue;
+               }
+               if ((opt = match_option (p, "debug", NULL)) != p) {
+                       do_debug = 1;
+                       continue;
+               }
+               if ((opt = match_option (p, "sampling-real", NULL)) != p) {
+                       sampling_mode = MONO_PROFILER_STAT_MODE_REAL;
+                       continue;
+               }
+               if ((opt = match_option (p, "sampling-process", NULL)) != p) {
+                       sampling_mode = MONO_PROFILER_STAT_MODE_PROCESS;
+                       continue;
+               }
+               if ((opt = match_option (p, "heapshot", &val)) != p) {
+                       events &= ~MONO_PROFILE_ALLOCATIONS;
+                       events &= ~MONO_PROFILE_GC_MOVES;
+                       events &= ~MONO_PROFILE_ENTER_LEAVE;
+                       nocalls = 1;
+                       do_heap_shot = 1;
+                       set_hsmode (val, 1);
+                       continue;
+               }
+               if ((opt = match_option (p, "sample", &val)) != p) {
+                       events &= ~MONO_PROFILE_ALLOCATIONS;
+                       events &= ~MONO_PROFILE_GC_MOVES;
+                       events &= ~MONO_PROFILE_ENTER_LEAVE;
+                       nocalls = 1;
+                       set_sample_freq (val);
+                       continue;
+               }
+               if ((opt = match_option (p, "zip", NULL)) != p) {
+                       use_zip = 1;
+                       continue;
+               }
+               if ((opt = match_option (p, "output", &val)) != p) {
+                       filename = val;
+                       continue;
+               }
+               if ((opt = match_option (p, "port", &val)) != p) {
+                       char *end;
+                       command_port = strtoul (val, &end, 10);
+                       g_free (val);
+                       continue;
+               }
+               if ((opt = match_option (p, "maxframes", &val)) != p) {
+                       char *end;
+                       num_frames = strtoul (val, &end, 10);
+                       if (num_frames > MAX_FRAMES)
+                               num_frames = MAX_FRAMES;
+                       g_free (val);
+                       notraces = num_frames == 0;
+                       continue;
+               }
+               if ((opt = match_option (p, "maxsamples", &val)) != p) {
+                       char *end;
+                       max_allocated_sample_hits = strtoul (val, &end, 10);
+                       if (!max_allocated_sample_hits)
+                               max_allocated_sample_hits = G_MAXINT32;
+                       g_free (val);
+                       continue;
+               }
+               if ((opt = match_option (p, "calldepth", &val)) != p) {
+                       char *end;
+                       max_call_depth = strtoul (val, &end, 10);
+                       g_free (val);
+                       continue;
+               }
+               if ((opt = match_option (p, "counters", NULL)) != p) {
+                       // For backwards compatibility.
+                       continue;
+               }
+               if ((opt = match_option (p, "coverage", NULL)) != p) {
+                       do_coverage = 1;
+                       events |= MONO_PROFILE_ENTER_LEAVE;
+                       debug_coverage = (g_getenv ("MONO_PROFILER_DEBUG_COVERAGE") != NULL);
+                       continue;
+               }
+               if ((opt = match_option (p, "onlycoverage", NULL)) != p) {
+                       only_coverage = TRUE;
+                       continue;
+               }
+               if ((opt = match_option (p, "covfilter-file", &val)) != p) {
+                       FILE *filter_file;
+                       char *line, *content;
+
+                       if (filters == NULL)
+                               filters = g_ptr_array_new ();
+
+                       filter_file = fopen (val, "r");
+                       if (filter_file == NULL) {
+                               fprintf (stderr, "Unable to open %s\n", val);
+                               exit (0);
+                       }
+
+                       /* Don't need to free content as it is referred to by the lines stored in @filters */
+                       content = get_file_content (filter_file);
+                       if (content == NULL)
+                               fprintf (stderr, "WARNING: %s is greater than 128kb - ignoring\n", val);
+
+                       while ((line = get_next_line (content, &content)))
+                               g_ptr_array_add (filters, g_strchug (g_strchomp (line)));
+
+                       fclose (filter_file);
+                       continue;
+               }
+               if ((opt = match_option (p, "covfilter", &val)) != p) {
+                       if (filters == NULL)
+                               filters = g_ptr_array_new ();
+
+                       g_ptr_array_add (filters, val);
+                       continue;
+               }
+               if (opt == p) {
+                       usage (0);
+                       exit (0);
+               }
+       }
+
+       if (calls_enabled) {
+               events |= MONO_PROFILE_ENTER_LEAVE;
+               nocalls = 0;
+       }
+
+       if (allocs_enabled) {
+               events |= MONO_PROFILE_ALLOCATIONS;
+               events |= MONO_PROFILE_GC_MOVES;
+       }
+
+       // Only activate the bare minimum events the profiler needs to function.
+       if (only_coverage) {
+               if (!do_coverage) {
+                       fprintf (stderr, "The onlycoverage option is only valid when paired with the coverage option\n");
+                       exit (1);
+               }
+
+               no_counters = TRUE;
+               events = MONO_PROFILE_GC | MONO_PROFILE_THREADS | MONO_PROFILE_ENTER_LEAVE | MONO_PROFILE_INS_COVERAGE;
+       }
+
+       init_time ();
+
+       PROF_TLS_INIT ();
+
+       prof = create_profiler (desc, filename, filters);
+       if (!prof) {
+               PROF_TLS_FREE ();
+               return;
+       }
+
+       mono_lls_init (&profiler_thread_list, NULL);
+
+       init_thread (prof, TRUE);
+
+       mono_profiler_install (prof, log_shutdown);
+       mono_profiler_install_gc (gc_event, gc_resize);
+       mono_profiler_install_allocation (gc_alloc);
+       mono_profiler_install_gc_moves (gc_moves);
+       mono_profiler_install_gc_roots (gc_handle, gc_roots);
+       mono_profiler_install_gc_finalize (finalize_begin, finalize_object_begin, finalize_object_end, finalize_end);
+       mono_profiler_install_appdomain (NULL, domain_loaded, domain_unloaded, NULL);
+       mono_profiler_install_appdomain_name (domain_name);
+       mono_profiler_install_context (context_loaded, context_unloaded);
+       mono_profiler_install_class (NULL, class_loaded, class_unloaded, NULL);
+       mono_profiler_install_module (NULL, image_loaded, image_unloaded, NULL);
+       mono_profiler_install_assembly (NULL, assembly_loaded, assembly_unloaded, NULL);
+       mono_profiler_install_thread (thread_start, thread_end);
+       mono_profiler_install_thread_name (thread_name);
+       mono_profiler_install_enter_leave (method_enter, method_leave);
+       mono_profiler_install_jit_end (method_jitted);
+       mono_profiler_install_code_buffer_new (code_buffer_new);
+       mono_profiler_install_exception (throw_exc, method_exc_leave, clause_exc);
+       mono_profiler_install_monitor (monitor_event);
+       mono_profiler_install_runtime_initialized (runtime_initialized);
+       if (do_coverage)
+               mono_profiler_install_coverage_filter (coverage_filter);
+
+       if (do_mono_sample && sample_freq) {
+               events |= MONO_PROFILE_STATISTICAL;
+               mono_profiler_set_statistical_mode (sampling_mode, sample_freq);
+               mono_profiler_install_statistical (mono_sample_hit);
+       }
+
+       mono_profiler_set_events ((MonoProfileFlags)events);
+}
diff --git a/mono/profiler/mono-profiler-log.h b/mono/profiler/mono-profiler-log.h
new file mode 100644 (file)
index 0000000..99b5782
--- /dev/null
@@ -0,0 +1,156 @@
+#ifndef __MONO_PROFLOG_H__
+#define __MONO_PROFLOG_H__
+
+#define BUF_ID 0x4D504C01
+#define LOG_HEADER_ID 0x4D505A01
+#define LOG_VERSION_MAJOR 1
+#define LOG_VERSION_MINOR 1
+#define LOG_DATA_VERSION 13
+
+/*
+ * Changes in major/minor versions:
+ * version 1.0: removed sysid field from header
+ *              added args, arch, os fields to header
+ *
+ * Changes in data versions:
+ * version 2: added offsets in heap walk
+ * version 3: added GC roots
+ * version 4: added sample/statistical profiling
+ * version 5: added counters sampling
+ * version 6: added optional backtrace in sampling info
+ * version 8: added TYPE_RUNTIME and JIT helpers/trampolines
+ * version 9: added MONO_PROFILER_CODE_BUFFER_EXCEPTION_HANDLING
+ * version 10: added TYPE_COVERAGE
+ * version 11: added thread ID to TYPE_SAMPLE_HIT
+               added more load/unload events
+                   unload for class
+                   unload for image
+                   load/unload for appdomain
+                   load/unload for contexts
+                   load/unload/name for assemblies
+               removed TYPE_LOAD_ERR flag (profiler never generated it, now removed from the format itself)
+               added TYPE_GC_HANDLE_{CREATED,DESTROYED}_BT
+               TYPE_JIT events are no longer guaranteed to have code start/size info (can be zero)
+ * version 12: added MONO_COUNTER_PROFILER
+ * version 13: added MONO_GC_EVENT_{PRE_STOP_WORLD_LOCKED,POST_START_WORLD_UNLOCKED}
+               added TYPE_META + TYPE_SYNC_POINT
+               removed il and native offset in TYPE_SAMPLE_HIT
+               methods in backtraces are now encoded as proper method pointers
+               removed flags in backtrace format
+               removed flags in metadata events
+               changed the following fields to a single byte rather than leb128
+                   TYPE_GC_EVENT: event_type, generation
+                   TYPE_HEAP_ROOT: root_type
+                   TYPE_JITHELPER: type
+                   TYPE_SAMPLE_HIT: sample_type
+                   TYPE_CLAUSE: clause_type
+                   TYPE_SAMPLE_COUNTERS_DESC: type, unit, variance
+                   TYPE_SAMPLE_COUNTERS: type
+               added time fields to all events that were missing one
+                   TYPE_HEAP_OBJECT
+                   TYPE_HEAP_ROOT
+                   TYPE_SAMPLE_USYM
+                   TYPE_SAMPLE_COUNTERS_DESC
+                   TYPE_COVERAGE_METHOD
+                   TYPE_COVERAGE_STATEMENT
+                   TYPE_COVERAGE_CLASS
+                   TYPE_COVERAGE_ASSEMBLY
+               moved the time field in TYPE_SAMPLE_HIT to right after the event byte, now encoded as a regular time field
+               changed the time field in TYPE_SAMPLE_COUNTERS to be encoded as a regular time field (in nanoseconds)
+               added TYPE_GC_FINALIZE_{START,END,OBJECT_START,OBJECT_END}
+ */
+
+enum {
+       TYPE_ALLOC,
+       TYPE_GC,
+       TYPE_METADATA,
+       TYPE_METHOD,
+       TYPE_EXCEPTION,
+       TYPE_MONITOR,
+       TYPE_HEAP,
+       TYPE_SAMPLE,
+       TYPE_RUNTIME,
+       TYPE_COVERAGE,
+       TYPE_META,
+       /* extended type for TYPE_HEAP */
+       TYPE_HEAP_START  = 0 << 4,
+       TYPE_HEAP_END    = 1 << 4,
+       TYPE_HEAP_OBJECT = 2 << 4,
+       TYPE_HEAP_ROOT   = 3 << 4,
+       /* extended type for TYPE_METADATA */
+       TYPE_END_LOAD     = 2 << 4,
+       TYPE_END_UNLOAD   = 4 << 4,
+       /* extended type for TYPE_GC */
+       TYPE_GC_EVENT  = 1 << 4,
+       TYPE_GC_RESIZE = 2 << 4,
+       TYPE_GC_MOVE   = 3 << 4,
+       TYPE_GC_HANDLE_CREATED      = 4 << 4,
+       TYPE_GC_HANDLE_DESTROYED    = 5 << 4,
+       TYPE_GC_HANDLE_CREATED_BT   = 6 << 4,
+       TYPE_GC_HANDLE_DESTROYED_BT = 7 << 4,
+       TYPE_GC_FINALIZE_START = 8 << 4,
+       TYPE_GC_FINALIZE_END = 9 << 4,
+       TYPE_GC_FINALIZE_OBJECT_START = 10 << 4,
+       TYPE_GC_FINALIZE_OBJECT_END = 11 << 4,
+       /* extended type for TYPE_METHOD */
+       TYPE_LEAVE     = 1 << 4,
+       TYPE_ENTER     = 2 << 4,
+       TYPE_EXC_LEAVE = 3 << 4,
+       TYPE_JIT       = 4 << 4,
+       /* extended type for TYPE_EXCEPTION */
+       TYPE_THROW_NO_BT = 0 << 7,
+       TYPE_THROW_BT    = 1 << 7,
+       TYPE_CLAUSE      = 1 << 4,
+       /* extended type for TYPE_ALLOC */
+       TYPE_ALLOC_NO_BT  = 0 << 4,
+       TYPE_ALLOC_BT     = 1 << 4,
+       /* extended type for TYPE_MONITOR */
+       TYPE_MONITOR_NO_BT  = 0 << 7,
+       TYPE_MONITOR_BT     = 1 << 7,
+       /* extended type for TYPE_SAMPLE */
+       TYPE_SAMPLE_HIT           = 0 << 4,
+       TYPE_SAMPLE_USYM          = 1 << 4,
+       TYPE_SAMPLE_UBIN          = 2 << 4,
+       TYPE_SAMPLE_COUNTERS_DESC = 3 << 4,
+       TYPE_SAMPLE_COUNTERS      = 4 << 4,
+       /* extended type for TYPE_RUNTIME */
+       TYPE_JITHELPER = 1 << 4,
+       /* extended type for TYPE_COVERAGE */
+       TYPE_COVERAGE_ASSEMBLY = 0 << 4,
+       TYPE_COVERAGE_METHOD   = 1 << 4,
+       TYPE_COVERAGE_STATEMENT = 2 << 4,
+       TYPE_COVERAGE_CLASS = 3 << 4,
+       /* extended type for TYPE_META */
+       TYPE_SYNC_POINT = 0 << 4,
+       TYPE_END
+};
+
+enum {
+       /* metadata type byte for TYPE_METADATA */
+       TYPE_CLASS    = 1,
+       TYPE_IMAGE    = 2,
+       TYPE_ASSEMBLY = 3,
+       TYPE_DOMAIN   = 4,
+       TYPE_THREAD   = 5,
+       TYPE_CONTEXT  = 6,
+};
+
+typedef enum {
+       SYNC_POINT_PERIODIC,
+       SYNC_POINT_WORLD_STOP,
+       SYNC_POINT_WORLD_START
+} MonoProfilerSyncPointType;
+
+// Sampling sources
+// Unless you have compiled with --enable-perf-events, only SAMPLE_CYCLES is available
+enum {
+       SAMPLE_CYCLES = 1,
+       SAMPLE_INSTRUCTIONS,
+       SAMPLE_CACHE_MISSES,
+       SAMPLE_CACHE_REFS,
+       SAMPLE_BRANCHES,
+       SAMPLE_BRANCH_MISSES,
+       SAMPLE_LAST
+};
+
+#endif /* __MONO_PROFLOG_H__ */
index 3f071a108798834e9b64cbc978a537336940bb8b..78de58aaa08de08e66e16439a294f494979335c5 100644 (file)
@@ -109,7 +109,7 @@ method_jit_result (MonoProfiler *prof, MonoMethod *method, MonoJitInfo* jinfo, i
                                sourceLoc = mono_debug_lookup_source_location (method, dmji->line_numbers[i].native_offset, mono_domain_get());
                                if (sourceLoc == NULL)
                                {
-                                       free(vtuneMethod.line_number_table);
+                                       g_free (vtuneMethod.line_number_table);
                                        vtuneMethod.line_number_table = NULL;
                                        vtuneMethod.line_number_size = 0;
                                        break;
@@ -126,9 +126,9 @@ method_jit_result (MonoProfiler *prof, MonoMethod *method, MonoJitInfo* jinfo, i
                iJIT_NotifyEvent(iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED, &vtuneMethod);
 
                if (vtuneMethod.source_file_name != NULL)
-                       free(vtuneMethod.source_file_name);
+                       g_free (vtuneMethod.source_file_name);
                if (vtuneMethod.line_number_table != NULL)
-                       free(vtuneMethod.line_number_table);
+                       g_free (vtuneMethod.line_number_table);
        
                g_free (signature);
                g_free (name);
diff --git a/mono/profiler/mprof-report.c b/mono/profiler/mprof-report.c
new file mode 100644 (file)
index 0000000..1017d1f
--- /dev/null
@@ -0,0 +1,4306 @@
+/*
+ * mprof-report.c: mprof-report program source: decode and analyze the log profiler data
+ *
+ * Authors:
+ *   Paolo Molaro (lupus@ximian.com)
+ *   Alex Rønne Petersen (alexrp@xamarin.com)
+ *
+ * Copyright 2010 Novell, Inc (http://www.novell.com)
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
+ */
+
+/*
+ * The Coverage XML output schema
+ * <coverage>
+ *   <assembly/>
+ *   <class/>
+ *   <method>
+ *     <statement/>
+ *   </method>
+ * </coverage>
+ *
+ * Elements:
+ *   <coverage> - The root element of the documentation. It can contain any number of
+ *                <assembly>, <class> or <method> elements.
+ *                Attributes:
+ *                   - version: The version number for the file format - (eg: "0.3")
+ *   <assembly> - Contains data about assemblies. Has no child elements
+ *                Attributes:
+ *                   - name: The name of the assembly - (eg: "System.Xml")
+ *                   - guid: The GUID of the assembly
+ *                   - filename: The filename of the assembly
+ *                   - method-count: The number of methods in the assembly
+ *                   - full: The number of fully covered methods
+ *                   - partial: The number of partially covered methods
+ *   <class> - Contains data about classes. Has no child elements
+ *             Attributes:
+ *                - name: The name of the class
+ *                - method-count: The number of methods in the class
+ *                - full: The number of fully covered methods
+ *                - partial: The number of partially covered methods
+ *   <method> - Contains data about methods. Can contain any number of <statement> elements
+ *              Attributes:
+ *                 - assembly: The name of the parent assembly
+ *                 - class: The name of the parent class
+ *                 - name: The name of the method, with all it's parameters
+ *                 - filename: The name of the source file containing this method
+ *                 - token
+ *   <statement> - Contains data about IL statements. Has no child elements
+ *                 Attributes:
+ *                    - offset: The offset of the statement in the IL code after the previous
+ *                              statement's offset
+ *                    - counter: 1 if the line was covered, 0 if it was not
+ *                    - line: The line number in the parent method's file
+ *                    - column: The column on the line
+ */
+#include <config.h>
+#include "mono-profiler-log.h"
+#include <string.h>
+#include <assert.h>
+#include <stdio.h>
+#include <time.h>
+#if !defined(__APPLE__) && !defined(__FreeBSD__)
+#include <malloc.h>
+#endif
+#include <unistd.h>
+#include <stdlib.h>
+#if defined (HAVE_SYS_ZLIB)
+#include <zlib.h>
+#endif
+#include <glib.h>
+#include <mono/metadata/profiler.h>
+#include <mono/metadata/object.h>
+#include <mono/metadata/debug-helpers.h>
+#include <mono/utils/mono-counters.h>
+
+#define HASH_SIZE 9371
+#define SMALL_HASH_SIZE 31
+
+#if defined(__native_client__) || defined(__native_client_codegen__)
+volatile int __nacl_thread_suspension_needed = 0;
+void __nacl_suspend_thread_if_needed() {}
+#endif
+
+static int debug = 0;
+static int collect_traces = 0;
+static int show_traces = 0;
+static int trace_max = 6;
+static int verbose = 0;
+static uintptr_t *tracked_objects = 0;
+static int num_tracked_objects = 0;
+static uintptr_t thread_filter = 0;
+static uint64_t find_size = 0;
+static const char* find_name = NULL;
+static uint64_t time_from = 0;
+static uint64_t time_to = 0xffffffffffffffffULL;
+static int use_time_filter = 0;
+static uint64_t startup_time = 0;
+static FILE* outfile = NULL;
+static FILE* coverage_outfile = NULL;
+
+static int32_t
+read_int16 (unsigned char *p)
+{
+       int32_t value = *p++;
+       value |= (*p++) << 8;
+       return value;
+}
+
+static int32_t
+read_int32 (unsigned char *p)
+{
+       int32_t value = *p++;
+       value |= (*p++) << 8;
+       value |= (*p++) << 16;
+       value |= (uint32_t)(*p++) << 24;
+       return value;
+}
+
+static int64_t
+read_int64 (unsigned char *p)
+{
+       uint64_t value = *p++;
+       value |= (*p++) << 8;
+       value |= (*p++) << 16;
+       value |= (uint64_t)(*p++) << 24;
+       value |= (uint64_t)(*p++) << 32;
+       value |= (uint64_t)(*p++) << 40;
+       value |= (uint64_t)(*p++) << 48;
+       value |= (uint64_t)(*p++) << 54;
+       return value;
+}
+
+static char*
+pstrdup (const char *s)
+{
+       int len = strlen (s) + 1;
+       char *p = (char *) g_malloc (len);
+       memcpy (p, s, len);
+       return p;
+}
+
+typedef struct _CounterValue CounterValue;
+struct _CounterValue {
+       uint64_t timestamp;
+       unsigned char *buffer;
+       CounterValue *next;
+};
+
+typedef struct _Counter Counter;
+struct _Counter {
+       int index;
+       const char *section;
+       const char *name;
+       int type;
+       int unit;
+       int variance;
+       CounterValue *values;
+       CounterValue *values_last;
+};
+
+typedef struct _CounterList CounterList;
+struct _CounterList {
+       Counter *counter;
+       CounterList *next;
+};
+
+typedef struct _CounterSection CounterSection;
+struct _CounterSection {
+       const char *value;
+       CounterList *counters;
+       CounterList *counters_last;
+       CounterSection *next;
+};
+
+typedef struct _CounterTimestamp CounterTimestamp;
+struct _CounterTimestamp {
+       uint64_t value;
+       CounterSection *sections;
+       CounterSection *sections_last;
+       CounterTimestamp *next;
+};
+
+static CounterList *counters = NULL;
+static CounterSection *counters_sections = NULL;
+static CounterTimestamp *counters_timestamps = NULL;
+
+enum {
+       COUNTERS_SORT_TIME,
+       COUNTERS_SORT_CATEGORY
+};
+
+static int counters_sort_mode = COUNTERS_SORT_TIME;
+
+static void
+add_counter_to_section (Counter *counter)
+{
+       CounterSection *csection, *s;
+       CounterList *clist;
+
+       clist = (CounterList *) g_calloc (1, sizeof (CounterList));
+       clist->counter = counter;
+
+       for (csection = counters_sections; csection; csection = csection->next) {
+               if (strcmp (csection->value, counter->section) == 0) {
+                       /* If section exist */
+                       if (!csection->counters)
+                               csection->counters = clist;
+                       else
+                               csection->counters_last->next = clist;
+                       csection->counters_last = clist;
+                       return;
+               }
+       }
+
+       /* If section does not exist */
+       csection = (CounterSection *) g_calloc (1, sizeof (CounterSection));
+       csection->value = counter->section;
+       csection->counters = clist;
+       csection->counters_last = clist;
+
+       if (!counters_sections) {
+               counters_sections = csection;
+       } else {
+               s = counters_sections;
+               while (s->next)
+                       s = s->next;
+               s->next = csection;
+       }
+}
+
+static void
+add_counter (const char *section, const char *name, int type, int unit, int variance, int index)
+{
+       CounterList *list, *l;
+       Counter *counter;
+
+       for (list = counters; list; list = list->next)
+               if (list->counter->index == index)
+                       return;
+
+       counter = (Counter *) g_calloc (1, sizeof (Counter));
+       counter->section = section;
+       counter->name = name;
+       counter->type = type;
+       counter->unit = unit;
+       counter->variance = variance;
+       counter->index = index;
+
+       list = (CounterList *) g_calloc (1, sizeof (CounterList));
+       list->counter = counter;
+
+       if (!counters) {
+               counters = list;
+       } else {
+               l = counters;
+               while (l->next)
+                       l = l->next;
+               l->next = list;
+       }
+
+       if (counters_sort_mode == COUNTERS_SORT_CATEGORY || !verbose)
+               add_counter_to_section (counter);
+}
+
+static void
+add_counter_to_timestamp (uint64_t timestamp, Counter *counter)
+{
+       CounterTimestamp *ctimestamp, *t;
+       CounterSection *csection;
+       CounterList *clist;
+
+       clist = (CounterList *) g_calloc (1, sizeof (CounterList));
+       clist->counter = counter;
+
+       for (ctimestamp = counters_timestamps; ctimestamp; ctimestamp = ctimestamp->next) {
+               if (ctimestamp->value == timestamp) {
+                       for (csection = ctimestamp->sections; csection; csection = csection->next) {
+                               if (strcmp (csection->value, counter->section) == 0) {
+                                       /* if timestamp exist and section exist */
+                                       if (!csection->counters)
+                                               csection->counters = clist;
+                                       else
+                                               csection->counters_last->next = clist;
+                                       csection->counters_last = clist;
+                                       return;
+                               }
+                       }
+
+                       /* if timestamp exist and section does not exist */
+                       csection = (CounterSection *) g_calloc (1, sizeof (CounterSection));
+                       csection->value = counter->section;
+                       csection->counters = clist;
+                       csection->counters_last = clist;
+
+                       if (!ctimestamp->sections)
+                               ctimestamp->sections = csection;
+                       else
+                               ctimestamp->sections_last->next = csection;
+                       ctimestamp->sections_last = csection;
+                       return;
+               }
+       }
+
+       /* If timestamp do not exist and section does not exist */
+       csection = (CounterSection *) g_calloc (1, sizeof (CounterSection));
+       csection->value = counter->section;
+       csection->counters = clist;
+       csection->counters_last = clist;
+
+       ctimestamp = (CounterTimestamp *) g_calloc (1, sizeof (CounterTimestamp));
+       ctimestamp->value = timestamp;
+       ctimestamp->sections = csection;
+       ctimestamp->sections_last = csection;
+
+       if (!counters_timestamps) {
+               counters_timestamps = ctimestamp;
+       } else {
+               t = counters_timestamps;
+               while (t->next)
+                       t = t->next;
+               t->next = ctimestamp;
+       }
+}
+
+static void
+add_counter_value (int index, CounterValue *value)
+{
+       CounterList *list;
+
+       for (list = counters; list; list = list->next) {
+               if (list->counter->index == index) {
+                       if (!list->counter->values)
+                               list->counter->values = value;
+                       else
+                               list->counter->values_last->next = value;
+                       list->counter->values_last = value;
+
+                       if (counters_sort_mode == COUNTERS_SORT_TIME)
+                               add_counter_to_timestamp (value->timestamp, list->counter);
+
+                       return;
+               }
+       }
+}
+
+static const char*
+section_name (int section)
+{
+       switch (section) {
+       case MONO_COUNTER_JIT: return "Mono JIT";
+       case MONO_COUNTER_GC: return "Mono GC";
+       case MONO_COUNTER_METADATA: return "Mono Metadata";
+       case MONO_COUNTER_GENERICS: return "Mono Generics";
+       case MONO_COUNTER_SECURITY: return "Mono Security";
+       case MONO_COUNTER_RUNTIME: return "Mono Runtime";
+       case MONO_COUNTER_SYSTEM: return "Mono System";
+       case MONO_COUNTER_PROFILER: return "Mono Profiler";
+       default: return "<unknown>";
+       }
+}
+
+static const char*
+type_name (int type)
+{
+       switch (type) {
+       case MONO_COUNTER_INT: return "Int";
+       case MONO_COUNTER_UINT: return "UInt";
+       case MONO_COUNTER_WORD: return "Word";
+       case MONO_COUNTER_LONG: return "Long";
+       case MONO_COUNTER_ULONG: return "ULong";
+       case MONO_COUNTER_DOUBLE: return "Double";
+       case MONO_COUNTER_STRING: return "String";
+       case MONO_COUNTER_TIME_INTERVAL: return "Time Interval";
+       default: return "<unknown>";
+       }
+}
+
+static const char*
+unit_name (int unit)
+{
+       switch (unit) {
+       case MONO_COUNTER_RAW: return "Raw";
+       case MONO_COUNTER_BYTES: return "Bytes";
+       case MONO_COUNTER_TIME: return "Time";
+       case MONO_COUNTER_COUNT: return "Count";
+       case MONO_COUNTER_PERCENTAGE: return "Percentage";
+       default: return "<unknown>";
+       }
+}
+
+static const char*
+variance_name (int variance)
+{
+       switch (variance) {
+       case MONO_COUNTER_MONOTONIC: return "Monotonic";
+       case MONO_COUNTER_CONSTANT: return "Constant";
+       case MONO_COUNTER_VARIABLE: return "Variable";
+       default: return "<unknown>";
+       }
+}
+
+static void
+dump_counters_value (Counter *counter, const char *key_format, const char *key, void *value)
+{
+       char format[32];
+
+       if (value == NULL) {
+               snprintf (format, sizeof (format), "%s : %%s\n", key_format);
+               fprintf (outfile, format, key, "<null>");
+       } else {
+               switch (counter->type) {
+               case MONO_COUNTER_INT:
+#if SIZEOF_VOID_P == 4
+               case MONO_COUNTER_WORD:
+#endif
+                       snprintf (format, sizeof (format), "%s : %%d\n", key_format);
+                       fprintf (outfile, format, key, *(int32_t*)value);
+                       break;
+               case MONO_COUNTER_UINT:
+                       snprintf (format, sizeof (format), "%s : %%u\n", key_format);
+                       fprintf (outfile, format, key, *(uint32_t*)value);
+                       break;
+               case MONO_COUNTER_LONG:
+#if SIZEOF_VOID_P == 8
+               case MONO_COUNTER_WORD:
+#endif
+               case MONO_COUNTER_TIME_INTERVAL:
+                       if (counter->type == MONO_COUNTER_LONG && counter->unit == MONO_COUNTER_TIME) {
+                               snprintf (format, sizeof (format), "%s : %%0.3fms\n", key_format);
+                               fprintf (outfile, format, key, (double)*(int64_t*)value / 10000.0);
+                       } else if (counter->type == MONO_COUNTER_TIME_INTERVAL) {
+                               snprintf (format, sizeof (format), "%s : %%0.3fms\n", key_format);
+                               fprintf (outfile, format, key, (double)*(int64_t*)value / 1000.0);
+                       } else {
+                               snprintf (format, sizeof (format), "%s : %%u\n", key_format);
+                               fprintf (outfile, format, key, *(int64_t*)value);
+                       }
+                       break;
+               case MONO_COUNTER_ULONG:
+                       snprintf (format, sizeof (format), "%s : %%llu\n", key_format);
+                       fprintf (outfile, format, key, *(uint64_t*)value);
+                       break;
+               case MONO_COUNTER_DOUBLE:
+                       snprintf (format, sizeof (format), "%s : %%f\n", key_format);
+                       fprintf (outfile, format, key, *(double*)value);
+                       break;
+               case MONO_COUNTER_STRING:
+                       snprintf (format, sizeof (format), "%s : %%s\n", key_format);
+                       fprintf (outfile, format, key, *(char*)value);
+                       break;
+               }
+       }
+}
+
+static void
+dump_counters (void)
+{
+       Counter *counter;
+       CounterValue *cvalue;
+       CounterTimestamp *ctimestamp;
+       CounterSection *csection;
+       CounterList *clist;
+       char strtimestamp[17];
+       int i, section_printed;
+
+       fprintf (outfile, "\nCounters:\n");
+
+       if (!verbose) {
+               char counters_to_print[][64] = {
+                       "Methods from AOT",
+                       "Methods JITted using mono JIT",
+                       "Methods JITted using LLVM",
+                       "Total time spent JITting (sec)",
+                       "User Time",
+                       "System Time",
+                       "Total Time",
+                       "Working Set",
+                       "Private Bytes",
+                       "Virtual Bytes",
+                       "Page Faults",
+                       "CPU Load Average - 1min",
+                       "CPU Load Average - 5min",
+                       "CPU Load Average - 15min",
+                       ""
+               };
+
+               for (csection = counters_sections; csection; csection = csection->next) {
+                       section_printed = 0;
+
+                       for (clist = csection->counters; clist; clist = clist->next) {
+                               counter = clist->counter;
+                               if (!counter->values_last)
+                                       continue;
+
+                               for (i = 0; counters_to_print [i][0] != 0; i++) {
+                                       if (strcmp (counters_to_print [i], counter->name) == 0) {
+                                               if (!section_printed) {
+                                                       fprintf (outfile, "\t%s:\n", csection->value);
+                                                       section_printed = 1;
+                                               }
+
+                                               dump_counters_value (counter, "\t\t%-30s", counter->name, counter->values_last->buffer);
+                                               break;
+                                       }
+                               }
+                       }
+               }
+       } else if (counters_sort_mode == COUNTERS_SORT_TIME) {
+               for (ctimestamp = counters_timestamps; ctimestamp; ctimestamp = ctimestamp->next) {
+                       fprintf (outfile, "\t%llu:%02llu:%02llu:%02llu.%03llu:\n",
+                               (unsigned long long) (ctimestamp->value / 1000 / 60 / 60 / 24 % 1000),
+                               (unsigned long long) (ctimestamp->value / 1000 / 60 / 60 % 24),
+                               (unsigned long long) (ctimestamp->value / 1000 / 60 % 60),
+                               (unsigned long long) (ctimestamp->value / 1000 % 60),
+                               (unsigned long long) (ctimestamp->value % 1000));
+
+                       for (csection = ctimestamp->sections; csection; csection = csection->next) {
+                               fprintf (outfile, "\t\t%s:\n", csection->value);
+
+                               for (clist = csection->counters; clist; clist = clist->next) {
+                                       counter = clist->counter;
+                                       for (cvalue = counter->values; cvalue; cvalue = cvalue->next) {
+                                               if (cvalue->timestamp != ctimestamp->value)
+                                                       continue;
+
+                                               dump_counters_value (counter, "\t\t\t%-30s", counter->name, cvalue->buffer);
+                                       }
+                               }
+                       }
+               }
+       } else if (counters_sort_mode == COUNTERS_SORT_CATEGORY) {
+               for (csection = counters_sections; csection; csection = csection->next) {
+                       fprintf (outfile, "\t%s:\n", csection->value);
+
+                       for (clist = csection->counters; clist; clist = clist->next) {
+                               counter = clist->counter;
+                               fprintf (outfile, "\t\t%s: [type: %s, unit: %s, variance: %s]\n",
+                                       counter->name, type_name (counter->type), unit_name (counter->unit), variance_name (counter->variance));
+
+                               for (cvalue = counter->values; cvalue; cvalue = cvalue->next) {
+                                       snprintf (strtimestamp, sizeof (strtimestamp), "%llu:%02llu:%02llu:%02llu.%03llu",
+                                               (unsigned long long) (cvalue->timestamp / 1000 / 60 / 60 / 24 % 1000),
+                                               (unsigned long long) (cvalue->timestamp / 1000 / 60 / 60 % 24),
+                                               (unsigned long long) (cvalue->timestamp / 1000 / 60 % 60),
+                                               (unsigned long long) (cvalue->timestamp / 1000 % 60),
+                                               (unsigned long long) (cvalue->timestamp % 1000));
+
+                                       dump_counters_value (counter, "\t\t\t%s", strtimestamp, cvalue->buffer);
+                               }
+                       }
+               }
+       }
+}
+
+static int num_images;
+typedef struct _ImageDesc ImageDesc;
+struct _ImageDesc {
+       ImageDesc *next;
+       intptr_t image;
+       char *filename;
+};
+
+static ImageDesc* image_hash [SMALL_HASH_SIZE] = {0};
+
+static void
+add_image (intptr_t image, char *name)
+{
+       int slot = ((image >> 2) & 0xffff) % SMALL_HASH_SIZE;
+       ImageDesc *cd = (ImageDesc *) g_malloc (sizeof (ImageDesc));
+       cd->image = image;
+       cd->filename = pstrdup (name);
+       cd->next = image_hash [slot];
+       image_hash [slot] = cd;
+       num_images++;
+}
+
+static int num_assemblies;
+
+typedef struct _AssemblyDesc AssemblyDesc;
+struct _AssemblyDesc {
+       AssemblyDesc *next;
+       intptr_t assembly;
+       char *asmname;
+};
+
+static AssemblyDesc* assembly_hash [SMALL_HASH_SIZE] = {0};
+
+static void
+add_assembly (intptr_t assembly, char *name)
+{
+       int slot = ((assembly >> 2) & 0xffff) % SMALL_HASH_SIZE;
+       AssemblyDesc *cd = (AssemblyDesc *) g_malloc (sizeof (AssemblyDesc));
+       cd->assembly = assembly;
+       cd->asmname = pstrdup (name);
+       cd->next = assembly_hash [slot];
+       assembly_hash [slot] = cd;
+       num_assemblies++;
+}
+
+typedef struct _BackTrace BackTrace;
+typedef struct {
+       uint64_t count;
+       BackTrace *bt;
+} CallContext;
+
+typedef struct {
+       int count;
+       int size;
+       CallContext *traces;
+} TraceDesc;
+
+typedef struct _ClassDesc ClassDesc;
+struct _ClassDesc {
+       ClassDesc *next;
+       intptr_t klass;
+       char *name;
+       intptr_t allocs;
+       uint64_t alloc_size;
+       TraceDesc traces;
+};
+
+static ClassDesc* class_hash [HASH_SIZE] = {0};
+static int num_classes = 0;
+
+static ClassDesc*
+add_class (intptr_t klass, const char *name)
+{
+       int slot = ((klass >> 2) & 0xffff) % HASH_SIZE;
+       ClassDesc *cd;
+       cd = class_hash [slot];
+       while (cd && cd->klass != klass)
+               cd = cd->next;
+       /* we resolved an unknown class (unless we had the code unloaded) */
+       if (cd) {
+               /*printf ("resolved unknown: %s\n", name);*/
+               g_free (cd->name);
+               cd->name = pstrdup (name);
+               return cd;
+       }
+       cd = (ClassDesc *) g_calloc (sizeof (ClassDesc), 1);
+       cd->klass = klass;
+       cd->name = pstrdup (name);
+       cd->next = class_hash [slot];
+       cd->allocs = 0;
+       cd->alloc_size = 0;
+       cd->traces.count = 0;
+       cd->traces.size = 0;
+       cd->traces.traces = NULL;
+       class_hash [slot] = cd;
+       num_classes++;
+       return cd;
+}
+
+static ClassDesc *
+lookup_class (intptr_t klass)
+{
+       int slot = ((klass >> 2) & 0xffff) % HASH_SIZE;
+       ClassDesc *cd = class_hash [slot];
+       while (cd && cd->klass != klass)
+               cd = cd->next;
+       if (!cd) {
+               char buf [128];
+               snprintf (buf, sizeof (buf), "unresolved class %p", (void*)klass);
+               return add_class (klass, buf);
+       }
+       return cd;
+}
+
+typedef struct _MethodDesc MethodDesc;
+struct _MethodDesc {
+       MethodDesc *next;
+       intptr_t method;
+       char *name;
+       intptr_t code;
+       int len;
+       int recurse_count;
+       int sample_hits;
+       int ignore_jit; /* when this is set, we collect the metadata but don't count this method fot jit time and code size, when filtering events */
+       uint64_t calls;
+       uint64_t total_time;
+       uint64_t callee_time;
+       uint64_t self_time;
+       TraceDesc traces;
+};
+
+static MethodDesc* method_hash [HASH_SIZE] = {0};
+static int num_methods = 0;
+
+static MethodDesc*
+add_method (intptr_t method, const char *name, intptr_t code, int len)
+{
+       int slot = ((method >> 2) & 0xffff) % HASH_SIZE;
+       MethodDesc *cd;
+       cd = method_hash [slot];
+       while (cd && cd->method != method)
+               cd = cd->next;
+       /* we resolved an unknown method (unless we had the code unloaded) */
+       if (cd) {
+               cd->code = code;
+               cd->len = len;
+               /*printf ("resolved unknown: %s\n", name);*/
+               g_free (cd->name);
+               cd->name = pstrdup (name);
+               return cd;
+       }
+       cd = (MethodDesc *) g_calloc (sizeof (MethodDesc), 1);
+       cd->method = method;
+       cd->name = pstrdup (name);
+       cd->code = code;
+       cd->len = len;
+       cd->calls = 0;
+       cd->total_time = 0;
+       cd->traces.count = 0;
+       cd->traces.size = 0;
+       cd->traces.traces = NULL;
+       cd->next = method_hash [slot];
+       method_hash [slot] = cd;
+       num_methods++;
+       return cd;
+}
+
+static MethodDesc *
+lookup_method (intptr_t method)
+{
+       int slot = ((method >> 2) & 0xffff) % HASH_SIZE;
+       MethodDesc *cd = method_hash [slot];
+       while (cd && cd->method != method)
+               cd = cd->next;
+       if (!cd) {
+               char buf [128];
+               snprintf (buf, sizeof (buf), "unknown method %p", (void*)method);
+               return add_method (method, buf, 0, 0);
+       }
+       return cd;
+}
+
+static int num_stat_samples = 0;
+static int size_stat_samples = 0;
+uintptr_t *stat_samples = NULL;
+int *stat_sample_desc = NULL;
+
+static void
+add_stat_sample (int type, uintptr_t ip) {
+       if (num_stat_samples == size_stat_samples) {
+               size_stat_samples *= 2;
+               if (!size_stat_samples)
+               size_stat_samples = 32;
+               stat_samples = (uintptr_t *) g_realloc (stat_samples, size_stat_samples * sizeof (uintptr_t));
+               stat_sample_desc = (int *) g_realloc (stat_sample_desc, size_stat_samples * sizeof (int));
+       }
+       stat_samples [num_stat_samples] = ip;
+       stat_sample_desc [num_stat_samples++] = type;
+}
+
+static MethodDesc*
+lookup_method_by_ip (uintptr_t ip)
+{
+       int i;
+       MethodDesc* m;
+       /* dumb */
+       for (i = 0; i < HASH_SIZE; ++i) {
+               m = method_hash [i];
+               while (m) {
+                       //printf ("checking %p against %p-%p\n", (void*)ip, (void*)(m->code), (void*)(m->code + m->len));
+                       if (ip >= (uintptr_t)m->code && ip < (uintptr_t)m->code + m->len) {
+                               return m;
+                       }
+                       m = m->next;
+               }
+       }
+       return NULL;
+}
+
+static int
+compare_method_samples (const void *a, const void *b)
+{
+       MethodDesc *const *A = (MethodDesc *const *)a;
+       MethodDesc *const *B = (MethodDesc *const *)b;
+       if ((*A)->sample_hits == (*B)->sample_hits)
+               return 0;
+       if ((*B)->sample_hits < (*A)->sample_hits)
+               return -1;
+       return 1;
+}
+
+typedef struct _UnmanagedSymbol UnmanagedSymbol;
+struct _UnmanagedSymbol {
+       UnmanagedSymbol *parent;
+       char *name;
+       int is_binary;
+       uintptr_t addr;
+       uintptr_t size;
+       uintptr_t sample_hits;
+};
+
+static UnmanagedSymbol **usymbols = NULL;
+static int usymbols_size = 0;
+static int usymbols_num = 0;
+
+static int
+compare_usymbol_addr (const void *a, const void *b)
+{
+       UnmanagedSymbol *const *A = (UnmanagedSymbol *const *)a;
+       UnmanagedSymbol *const *B = (UnmanagedSymbol *const *)b;
+       if ((*B)->addr == (*A)->addr)
+               return 0;
+       if ((*B)->addr > (*A)->addr)
+               return -1;
+       return 1;
+}
+
+static int
+compare_usymbol_samples (const void *a, const void *b)
+{
+       UnmanagedSymbol *const *A = (UnmanagedSymbol *const *)a;
+       UnmanagedSymbol *const *B = (UnmanagedSymbol *const *)b;
+       if ((*B)->sample_hits == (*A)->sample_hits)
+               return 0;
+       if ((*B)->sample_hits < (*A)->sample_hits)
+               return -1;
+       return 1;
+}
+
+static void
+add_unmanaged_symbol (uintptr_t addr, char *name, uintptr_t size)
+{
+       UnmanagedSymbol *sym;
+       if (usymbols_num == usymbols_size) {
+               int new_size = usymbols_size * 2;
+               if (!new_size)
+                       new_size = 16;
+               usymbols = (UnmanagedSymbol **) g_realloc (usymbols, sizeof (void*) * new_size);
+               usymbols_size = new_size;
+       }
+       sym = (UnmanagedSymbol *) g_calloc (sizeof (UnmanagedSymbol), 1);
+       sym->addr = addr;
+       sym->name = name;
+       sym->size = size;
+       usymbols [usymbols_num++] = sym;
+}
+
+/* only valid after the symbols are sorted */
+static UnmanagedSymbol*
+lookup_unmanaged_symbol (uintptr_t addr)
+{
+       int r = usymbols_num - 1;
+       int l = 0;
+       UnmanagedSymbol *sym;
+       int last_best = -1;
+       while (r >= l) {
+               int m = (l + r) / 2;
+               sym = usymbols [m];
+               if (addr == sym->addr)
+                       return sym;
+               if (addr < sym->addr) {
+                       r = m - 1;
+               } else if (addr > sym->addr) {
+                       l = m + 1;
+                       last_best = m;
+               }
+       }
+       if (last_best >= 0 && (addr - usymbols [last_best]->addr) < 4096)
+               return usymbols [last_best];
+       return NULL;
+}
+
+/* we use the same structure for binaries */
+static UnmanagedSymbol **ubinaries = NULL;
+static int ubinaries_size = 0;
+static int ubinaries_num = 0;
+
+static void
+add_unmanaged_binary (uintptr_t addr, char *name, uintptr_t size)
+{
+       UnmanagedSymbol *sym;
+       if (ubinaries_num == ubinaries_size) {
+               int new_size = ubinaries_size * 2;
+               if (!new_size)
+                       new_size = 16;
+               ubinaries = (UnmanagedSymbol **) g_realloc (ubinaries, sizeof (void*) * new_size);
+               ubinaries_size = new_size;
+       }
+       sym = (UnmanagedSymbol *) g_calloc (sizeof (UnmanagedSymbol), 1);
+       sym->addr = addr;
+       sym->name = name;
+       sym->size = size;
+       sym->is_binary = 1;
+       ubinaries [ubinaries_num++] = sym;
+}
+
+static UnmanagedSymbol*
+lookup_unmanaged_binary (uintptr_t addr)
+{
+       int i;
+       for (i = 0; i < ubinaries_num; ++i) {
+               UnmanagedSymbol *ubin = ubinaries [i];
+               if (addr >= ubin->addr && addr < ubin->addr + ubin->size) {
+                       return ubin;
+               }
+       }
+       return NULL;
+}
+
+static const char*
+sample_type_name (int type)
+{
+       switch (type) {
+       case SAMPLE_CYCLES: return "cycles";
+       case SAMPLE_INSTRUCTIONS: return "instructions retired";
+       case SAMPLE_CACHE_MISSES: return "cache misses";
+       case SAMPLE_CACHE_REFS: return "cache references";
+       case SAMPLE_BRANCHES: return "executed branches";
+       case SAMPLE_BRANCH_MISSES: return "unpredicted branches";
+       }
+       return "unknown";
+}
+
+static void
+set_usym_parent (UnmanagedSymbol** cachedus, int count)
+{
+       int i;
+       for (i = 0; i < count; ++i) {
+               UnmanagedSymbol *ubin = lookup_unmanaged_binary (cachedus [i]->addr);
+               if (ubin == cachedus [i])
+                       continue;
+               cachedus [i]->parent = ubin;
+       }
+}
+
+static void
+print_usym (UnmanagedSymbol* um)
+{
+       if (um->parent)
+               fprintf (outfile, "\t%6zd %6.2f %-36s in %s\n", um->sample_hits, um->sample_hits*100.0/num_stat_samples, um->name, um->parent->name);
+       else
+               fprintf (outfile, "\t%6zd %6.2f %s\n", um->sample_hits, um->sample_hits*100.0/num_stat_samples, um->name);
+}
+
+static int
+sym_percent (uintptr_t sample_hits)
+{
+       double pc;
+       if (verbose)
+               return 1;
+       pc = sample_hits*100.0/num_stat_samples;
+       return pc >= 0.1;
+}
+
+static void
+dump_samples (void)
+{
+       int i, u;
+       int count = 0, msize = 0;
+       int unmanaged_hits = 0;
+       int unresolved_hits = 0;
+       MethodDesc** cachedm = NULL;
+       int ucount = 0, usize = 0;
+       UnmanagedSymbol** cachedus = NULL;
+       if (!num_stat_samples)
+               return;
+       qsort (usymbols, usymbols_num, sizeof (UnmanagedSymbol*), compare_usymbol_addr);
+       for (i = 0; i < num_stat_samples; ++i) {
+               MethodDesc *m = lookup_method_by_ip (stat_samples [i]);
+               if (m) {
+                       if (!m->sample_hits) {
+                               if (count == msize) {
+                                       msize *= 2;
+                                       if (!msize)
+                                               msize = 4;
+                                       cachedm = (MethodDesc **) g_realloc (cachedm, sizeof (void*) * msize);
+                               }
+                               cachedm [count++] = m;
+                       }
+                       m->sample_hits++;
+               } else {
+                       UnmanagedSymbol *usym = lookup_unmanaged_symbol (stat_samples [i]);
+                       if (!usym) {
+                               unresolved_hits++;
+                               //printf ("unmanaged hit at %p\n", (void*)stat_samples [i]);
+                               usym = lookup_unmanaged_binary (stat_samples [i]);
+                       }
+                       if (usym) {
+                               if (!usym->sample_hits) {
+                                       if (ucount == usize) {
+                                               usize *= 2;
+                                               if (!usize)
+                                                       usize = 4;
+                                               cachedus = (UnmanagedSymbol **) g_realloc (cachedus, sizeof (void*) * usize);
+                                       }
+                                       cachedus [ucount++] = usym;
+                               }
+                               usym->sample_hits++;
+                       }
+                       unmanaged_hits++;
+               }
+       }
+       qsort (cachedm, count, sizeof (MethodDesc*), compare_method_samples);
+       qsort (cachedus, ucount, sizeof (UnmanagedSymbol*), compare_usymbol_samples);
+       set_usym_parent (cachedus, ucount);
+       fprintf (outfile, "\nStatistical samples summary\n");
+       fprintf (outfile, "\tSample type: %s\n", sample_type_name (stat_sample_desc [0]));
+       fprintf (outfile, "\tUnmanaged hits:  %6d (%4.1f%%)\n", unmanaged_hits, (100.0*unmanaged_hits)/num_stat_samples);
+       fprintf (outfile, "\tManaged hits:    %6d (%4.1f%%)\n", num_stat_samples - unmanaged_hits, (100.0*(num_stat_samples-unmanaged_hits))/num_stat_samples);
+       fprintf (outfile, "\tUnresolved hits: %6d (%4.1f%%)\n", unresolved_hits, (100.0*unresolved_hits)/num_stat_samples);
+       fprintf (outfile, "\t%6s %6s %s\n", "Hits", "%", "Method name");
+       i = 0;
+       u = 0;
+       while (i < count || u < ucount) {
+               if (i < count) {
+                       MethodDesc *m = cachedm [i];
+                       if (u < ucount) {
+                               UnmanagedSymbol *um = cachedus [u];
+                               if (um->sample_hits > m->sample_hits) {
+                                       if (!sym_percent (um->sample_hits))
+                                               break;
+                                       print_usym (um);
+                                       u++;
+                                       continue;
+                               }
+                       }
+                       if (!sym_percent (m->sample_hits))
+                               break;
+                       fprintf (outfile, "\t%6d %6.2f %s\n", m->sample_hits, m->sample_hits*100.0/num_stat_samples, m->name);
+                       i++;
+                       continue;
+               }
+               if (u < ucount) {
+                       UnmanagedSymbol *um = cachedus [u];
+                       if (!sym_percent (um->sample_hits))
+                               break;
+                       print_usym (um);
+                       u++;
+                       continue;
+               }
+       }
+}
+
+typedef struct _HeapClassDesc HeapClassDesc;
+typedef struct {
+       HeapClassDesc *klass;
+       uint64_t count;
+} HeapClassRevRef;
+
+struct _HeapClassDesc {
+       ClassDesc *klass;
+       int64_t count;
+       int64_t total_size;
+       HeapClassRevRef *rev_hash;
+       int rev_hash_size;
+       int rev_count;
+       uintptr_t pinned_references;
+       uintptr_t root_references;
+};
+
+static int
+add_rev_class_hashed (HeapClassRevRef *rev_hash, uintptr_t size, HeapClassDesc *hklass, uint64_t value)
+{
+       uintptr_t i;
+       uintptr_t start_pos;
+       start_pos = (hklass->klass->klass >> 2) % size;
+       assert (start_pos < size);
+       i = start_pos;
+       do {
+               if (rev_hash [i].klass == hklass) {
+                       rev_hash [i].count += value;
+                       return 0;
+               } else if (!rev_hash [i].klass) {
+                       rev_hash [i].klass = hklass;
+                       rev_hash [i].count += value;
+                       start_pos = 0;
+                       for (i = 0; i < size; ++i)
+                               if (rev_hash [i].klass && rev_hash [i].klass->klass == hklass->klass)
+                                       start_pos ++;
+                       assert (start_pos == 1);
+                       return 1;
+               }
+               /* wrap around */
+               if (++i == size)
+                       i = 0;
+       } while (i != start_pos);
+       /* should not happen */
+       printf ("failed revref store\n");
+       return 0;
+}
+
+static void
+add_heap_class_rev (HeapClassDesc *from, HeapClassDesc *to)
+{
+       uintptr_t i;
+       if (to->rev_count * 2 >= to->rev_hash_size) {
+               HeapClassRevRef *n;
+               uintptr_t old_size = to->rev_hash_size;
+               to->rev_hash_size *= 2;
+               if (to->rev_hash_size == 0)
+                       to->rev_hash_size = 4;
+               n = (HeapClassRevRef *) g_calloc (sizeof (HeapClassRevRef) * to->rev_hash_size, 1);
+               for (i = 0; i < old_size; ++i) {
+                       if (to->rev_hash [i].klass)
+                               add_rev_class_hashed (n, to->rev_hash_size, to->rev_hash [i].klass, to->rev_hash [i].count);
+               }
+               if (to->rev_hash)
+                       g_free (to->rev_hash);
+               to->rev_hash = n;
+       }
+       to->rev_count += add_rev_class_hashed (to->rev_hash, to->rev_hash_size, from, 1);
+}
+
+typedef struct {
+       uintptr_t objaddr;
+       HeapClassDesc *hklass;
+       uintptr_t num_refs;
+       uintptr_t refs [0];
+} HeapObjectDesc;
+
+typedef struct _HeapShot HeapShot;
+struct _HeapShot {
+       HeapShot *next;
+       uint64_t timestamp;
+       int class_count;
+       int hash_size;
+       HeapClassDesc **class_hash;
+       HeapClassDesc **sorted;
+       HeapObjectDesc **objects_hash;
+       uintptr_t objects_count;
+       uintptr_t objects_hash_size;
+       uintptr_t num_roots;
+       uintptr_t *roots;
+       uintptr_t *roots_extra;
+       int *roots_types;
+};
+
+static HeapShot *heap_shots = NULL;
+static int num_heap_shots = 0;
+
+static HeapShot*
+new_heap_shot (uint64_t timestamp)
+{
+       HeapShot *hs = (HeapShot *) g_calloc (sizeof (HeapShot), 1);
+       hs->hash_size = 4;
+       hs->class_hash = (HeapClassDesc **) g_calloc (sizeof (void*), hs->hash_size);
+       hs->timestamp = timestamp;
+       num_heap_shots++;
+       hs->next = heap_shots;
+       heap_shots = hs;
+       return hs;
+}
+
+static HeapClassDesc*
+heap_class_lookup (HeapShot *hs, ClassDesc *klass)
+{
+       int i;
+       unsigned int start_pos;
+       start_pos = ((uintptr_t)klass->klass >> 2) % hs->hash_size;
+       i = start_pos;
+       do {
+               HeapClassDesc* cd = hs->class_hash [i];
+               if (!cd)
+                       return NULL;
+               if (cd->klass == klass)
+                       return cd;
+               /* wrap around */
+               if (++i == hs->hash_size)
+                       i = 0;
+       } while (i != start_pos);
+       return NULL;
+}
+
+static int
+add_heap_hashed (HeapClassDesc **hash, HeapClassDesc **retv, uintptr_t hsize, ClassDesc *klass, uint64_t size, uint64_t count)
+{
+       uintptr_t i;
+       uintptr_t start_pos;
+       start_pos = ((uintptr_t)klass->klass >> 2) % hsize;
+       i = start_pos;
+       do {
+               if (hash [i] && hash [i]->klass == klass) {
+                       hash [i]->total_size += size;
+                       hash [i]->count += count;
+                       *retv = hash [i];
+                       return 0;
+               } else if (!hash [i]) {
+                       if (*retv) {
+                               hash [i] = *retv;
+                               return 1;
+                       }
+                       hash [i] = (HeapClassDesc *) g_calloc (sizeof (HeapClassDesc), 1);
+                       hash [i]->klass = klass;
+                       hash [i]->total_size += size;
+                       hash [i]->count += count;
+                       *retv = hash [i];
+                       return 1;
+               }
+               /* wrap around */
+               if (++i == hsize)
+                       i = 0;
+       } while (i != start_pos);
+       /* should not happen */
+       printf ("failed heap class store\n");
+       return 0;
+}
+
+static HeapClassDesc*
+add_heap_shot_class (HeapShot *hs, ClassDesc *klass, uint64_t size)
+{
+       HeapClassDesc *res;
+       int i;
+       if (hs->class_count * 2 >= hs->hash_size) {
+               HeapClassDesc **n;
+               int old_size = hs->hash_size;
+               hs->hash_size *= 2;
+               if (hs->hash_size == 0)
+                       hs->hash_size = 4;
+               n = (HeapClassDesc **) g_calloc (sizeof (void*) * hs->hash_size, 1);
+               for (i = 0; i < old_size; ++i) {
+                       res = hs->class_hash [i];
+                       if (hs->class_hash [i])
+                               add_heap_hashed (n, &res, hs->hash_size, hs->class_hash [i]->klass, hs->class_hash [i]->total_size, hs->class_hash [i]->count);
+               }
+               if (hs->class_hash)
+                       g_free (hs->class_hash);
+               hs->class_hash = n;
+       }
+       res = NULL;
+       hs->class_count += add_heap_hashed (hs->class_hash, &res, hs->hash_size, klass, size, 1);
+       //if (res->count == 1)
+       //      printf ("added heap class: %s\n", res->klass->name);
+       return res;
+}
+
+static HeapObjectDesc*
+alloc_heap_obj (uintptr_t objaddr, HeapClassDesc *hklass, uintptr_t num_refs)
+{
+       HeapObjectDesc* ho = (HeapObjectDesc *) g_calloc (sizeof (HeapObjectDesc) + num_refs * sizeof (uintptr_t), 1);
+       ho->objaddr = objaddr;
+       ho->hklass = hklass;
+       ho->num_refs = num_refs;
+       return ho;
+}
+
+static uintptr_t
+heap_shot_find_obj_slot (HeapShot *hs, uintptr_t objaddr)
+{
+       uintptr_t i;
+       uintptr_t start_pos;
+       HeapObjectDesc **hash = hs->objects_hash;
+       start_pos = ((uintptr_t)objaddr >> 3) % hs->objects_hash_size;
+       i = start_pos;
+       do {
+               if (hash [i] && hash [i]->objaddr == objaddr) {
+                       return i;
+               } else if (!hash [i]) {
+                       break; /* fail */
+               }
+               /* wrap around */
+               if (++i == hs->objects_hash_size)
+                       i = 0;
+       } while (i != start_pos);
+       /* should not happen */
+       //printf ("failed heap obj slot\n");
+       return -1;
+}
+
+static HeapObjectDesc*
+heap_shot_obj_add_refs (HeapShot *hs, uintptr_t objaddr, uintptr_t num, uintptr_t *ref_offset)
+{
+       HeapObjectDesc **hash = hs->objects_hash;
+       uintptr_t i = heap_shot_find_obj_slot (hs, objaddr);
+       if (i >= 0) {
+               HeapObjectDesc* ho = alloc_heap_obj (objaddr, hash [i]->hklass, hash [i]->num_refs + num);
+               *ref_offset = hash [i]->num_refs;
+               memcpy (ho->refs, hash [i]->refs, hash [i]->num_refs * sizeof (uintptr_t));
+               g_free (hash [i]);
+               hash [i] = ho;
+               return ho;
+       }
+       /* should not happen */
+       printf ("failed heap obj update\n");
+       return NULL;
+
+}
+
+static uintptr_t
+add_heap_hashed_obj (HeapObjectDesc **hash, uintptr_t hsize, HeapObjectDesc *obj)
+{
+       uintptr_t i;
+       uintptr_t start_pos;
+       start_pos = ((uintptr_t)obj->objaddr >> 3) % hsize;
+       i = start_pos;
+       do {
+               if (hash [i] && hash [i]->objaddr == obj->objaddr) {
+                       printf ("duplicate object!\n");
+                       return 0;
+               } else if (!hash [i]) {
+                       hash [i] = obj;
+                       return 1;
+               }
+               /* wrap around */
+               if (++i == hsize)
+                       i = 0;
+       } while (i != start_pos);
+       /* should not happen */
+       printf ("failed heap obj store\n");
+       return 0;
+}
+
+static void
+add_heap_shot_obj (HeapShot *hs, HeapObjectDesc *obj)
+{
+       uintptr_t i;
+       if (hs->objects_count * 2 >= hs->objects_hash_size) {
+               HeapObjectDesc **n;
+               uintptr_t old_size = hs->objects_hash_size;
+               hs->objects_hash_size *= 2;
+               if (hs->objects_hash_size == 0)
+                       hs->objects_hash_size = 4;
+               n = (HeapObjectDesc **) g_calloc (sizeof (void*) * hs->objects_hash_size, 1);
+               for (i = 0; i < old_size; ++i) {
+                       if (hs->objects_hash [i])
+                               add_heap_hashed_obj (n, hs->objects_hash_size, hs->objects_hash [i]);
+               }
+               if (hs->objects_hash)
+                       g_free (hs->objects_hash);
+               hs->objects_hash = n;
+       }
+       hs->objects_count += add_heap_hashed_obj (hs->objects_hash, hs->objects_hash_size, obj);
+}
+
+static void
+heap_shot_resolve_reverse_refs (HeapShot *hs)
+{
+       uintptr_t i;
+       for (i = 0; i < hs->objects_hash_size; ++i) {
+               uintptr_t r;
+               HeapObjectDesc *ho = hs->objects_hash [i];
+               if (!ho)
+                       continue;
+               for (r = 0; r < ho->num_refs; ++r) {
+                       uintptr_t oi = heap_shot_find_obj_slot (hs, ho->refs [r]);
+                       add_heap_class_rev (ho->hklass, hs->objects_hash [oi]->hklass);
+               }
+       }
+}
+
+#define MARK_GRAY 1
+#define MARK_BLACK 2
+
+static void
+heap_shot_mark_objects (HeapShot *hs)
+{
+       uintptr_t i, oi, r;
+       unsigned char *marks;
+       HeapObjectDesc *obj, *ref;
+       int marked_some;
+       uintptr_t num_marked = 0, num_unmarked;
+       for (i = 0; i < hs->num_roots; ++i) {
+               HeapClassDesc *cd;
+               oi = heap_shot_find_obj_slot (hs, hs->roots [i]);
+               if (oi == -1) {
+                       continue;
+               }
+               obj = hs->objects_hash [oi];
+               cd = obj->hklass;
+               if (hs->roots_types [i] & MONO_PROFILE_GC_ROOT_PINNING)
+                       cd->pinned_references++;
+               cd->root_references++;
+       }
+       if (!debug)
+               return;
+       /* consistency checks: it seems not all the objects are walked in the heap in some cases */
+       marks = (unsigned char *) g_calloc (hs->objects_hash_size, 1);
+       if (!marks)
+               return;
+       for (i = 0; i < hs->num_roots; ++i) {
+               oi = heap_shot_find_obj_slot (hs, hs->roots [i]);
+               if (oi == -1) {
+                       fprintf (outfile, "root type 0x%x for obj %p (%s) not found in heap\n", hs->roots_types [i], (void*)hs->roots [i], lookup_class (hs->roots_extra [i])->name);
+                       continue;
+               }
+               obj = hs->objects_hash [oi];
+               if (!marks [oi]) {
+                       marks [oi] = obj->num_refs? MARK_GRAY: MARK_BLACK;
+                       num_marked++;
+               }
+       }
+       marked_some = 1;
+       while (marked_some) {
+               marked_some = 0;
+               for (i = 0; i < hs->objects_hash_size; ++i) {
+                       if (marks [i] != MARK_GRAY)
+                               continue;
+                       marks [i] = MARK_BLACK;
+                       obj = hs->objects_hash [i];
+                       for (r = 0; r < obj->num_refs; ++r) {
+                               oi = heap_shot_find_obj_slot (hs, obj->refs [r]);
+                               if (oi == -1) {
+                                       fprintf (outfile, "referenced obj %p not found in heap\n", (void*)obj->refs [r]);
+                                       continue;
+                               }
+                               ref = hs->objects_hash [oi];
+                               if (!marks [oi]) {
+                                       marks [oi] = ref->num_refs? MARK_GRAY: MARK_BLACK;
+                               }
+                       }
+                       marked_some++;
+               }
+       }
+
+       num_unmarked = 0;
+       for (i = 0; i < hs->objects_hash_size; ++i) {
+               if (hs->objects_hash [i] && !marks [i]) {
+                       num_unmarked++;
+                       fprintf (outfile, "object %p (%s) unmarked\n", (void*)hs->objects_hash [i], hs->objects_hash [i]->hklass->klass->name);
+               }
+       }
+       fprintf (outfile, "Total unmarked: %zd/%zd\n", num_unmarked, hs->objects_count);
+       g_free (marks);
+}
+
+static void
+heap_shot_free_objects (HeapShot *hs)
+{
+       uintptr_t i;
+       for (i = 0; i < hs->objects_hash_size; ++i) {
+               HeapObjectDesc *ho = hs->objects_hash [i];
+               if (ho)
+                       g_free (ho);
+       }
+       if (hs->objects_hash)
+               g_free (hs->objects_hash);
+       hs->objects_hash = NULL;
+       hs->objects_hash_size = 0;
+       hs->objects_count = 0;
+}
+
+
+struct _BackTrace {
+       BackTrace *next;
+       unsigned int hash;
+       int count;
+       int id;
+       MethodDesc *methods [1];
+};
+
+static BackTrace *backtrace_hash [HASH_SIZE];
+static BackTrace **backtraces = NULL;
+static int num_backtraces = 0;
+static int next_backtrace = 0;
+
+static int
+hash_backtrace (int count, MethodDesc **methods)
+{
+       int hash = count;
+       int i;
+       for (i = 0; i < count; ++i) {
+               hash = (hash << 5) - hash + methods [i]->method;
+       }
+       return hash;
+}
+
+static int
+compare_backtrace (BackTrace *bt, int count, MethodDesc **methods)
+{
+       int i;
+       if (bt->count != count)
+               return 0;
+       for (i = 0; i < count; ++i)
+               if (methods [i] != bt->methods [i])
+                       return 0;
+       return 1;
+}
+
+static BackTrace*
+add_backtrace (int count, MethodDesc **methods)
+{
+       int hash = hash_backtrace (count, methods);
+       int slot = (hash & 0xffff) % HASH_SIZE;
+       BackTrace *bt = backtrace_hash [slot];
+       while (bt) {
+               if (bt->hash == hash && compare_backtrace (bt, count, methods))
+                       return bt;
+               bt = bt->next;
+       }
+       bt = (BackTrace *) g_malloc (sizeof (BackTrace) + ((count - 1) * sizeof (void*)));
+       bt->next = backtrace_hash [slot];
+       backtrace_hash [slot] = bt;
+       if (next_backtrace == num_backtraces) {
+               num_backtraces *= 2;
+               if (!num_backtraces)
+                       num_backtraces = 16;
+               backtraces = (BackTrace **) g_realloc (backtraces, sizeof (void*) * num_backtraces);
+       }
+       bt->id = next_backtrace++;
+       backtraces [bt->id] = bt;
+       bt->count = count;
+       bt->hash = hash;
+       for (slot = 0; slot < count; ++slot)
+               bt->methods [slot] = methods [slot];
+
+       return bt;
+}
+
+typedef struct _MonitorDesc MonitorDesc;
+typedef struct _ThreadContext ThreadContext;
+typedef struct _DomainContext DomainContext;
+typedef struct _RemCtxContext RemCtxContext;
+
+typedef struct {
+       FILE *file;
+#if defined (HAVE_SYS_ZLIB)
+       gzFile gzfile;
+#endif
+       unsigned char *buf;
+       int size;
+       int data_version;
+       int version_major;
+       int version_minor;
+       int timer_overhead;
+       int pid;
+       int port;
+       char *args;
+       char *arch;
+       char *os;
+       uint64_t startup_time;
+       ThreadContext *threads;
+       ThreadContext *current_thread;
+       DomainContext *domains;
+       DomainContext *current_domain;
+       RemCtxContext *remctxs;
+       RemCtxContext *current_remctx;
+} ProfContext;
+
+struct _ThreadContext {
+       ThreadContext *next;
+       intptr_t thread_id;
+       char *name;
+       /* emulated stack */
+       MethodDesc **stack;
+       uint64_t *time_stack;
+       uint64_t *callee_time_stack;
+       uint64_t last_time;
+       uint64_t contention_start;
+       MonitorDesc *monitor;
+       int stack_size;
+       int stack_id;
+       HeapShot *current_heap_shot;
+       uintptr_t num_roots;
+       uintptr_t size_roots;
+       uintptr_t *roots;
+       uintptr_t *roots_extra;
+       int *roots_types;
+       uint64_t gc_start_times [3];
+};
+
+struct _DomainContext {
+       DomainContext *next;
+       intptr_t domain_id;
+       const char *friendly_name;
+};
+
+struct _RemCtxContext {
+       RemCtxContext *next;
+       intptr_t remctx_id;
+       intptr_t domain_id;
+};
+
+static void
+ensure_buffer (ProfContext *ctx, int size)
+{
+       if (ctx->size < size) {
+               ctx->buf = (unsigned char *) g_realloc (ctx->buf, size);
+               ctx->size = size;
+       }
+}
+
+static int
+load_data (ProfContext *ctx, int size)
+{
+       ensure_buffer (ctx, size);
+#if defined (HAVE_SYS_ZLIB)
+       if (ctx->gzfile) {
+               int r = gzread (ctx->gzfile, ctx->buf, size);
+               if (r == 0)
+                       return size == 0? 1: 0;
+               return r == size;
+       } else
+#endif
+       {
+               int r = fread (ctx->buf, size, 1, ctx->file);
+               if (r == 0)
+                       return size == 0? 1: 0;
+               return r;
+       }
+}
+
+static ThreadContext*
+get_thread (ProfContext *ctx, intptr_t thread_id)
+{
+       ThreadContext *thread;
+       if (ctx->current_thread && ctx->current_thread->thread_id == thread_id)
+               return ctx->current_thread;
+       thread = ctx->threads;
+       while (thread) {
+               if (thread->thread_id == thread_id) {
+                       return thread;
+               }
+               thread = thread->next;
+       }
+       thread = (ThreadContext *) g_calloc (sizeof (ThreadContext), 1);
+       thread->next = ctx->threads;
+       ctx->threads = thread;
+       thread->thread_id = thread_id;
+       thread->last_time = 0;
+       thread->stack_id = 0;
+       thread->stack_size = 32;
+       thread->stack = (MethodDesc **) g_malloc (thread->stack_size * sizeof (void*));
+       thread->time_stack = (uint64_t *) g_malloc (thread->stack_size * sizeof (uint64_t));
+       thread->callee_time_stack = (uint64_t *) g_malloc (thread->stack_size * sizeof (uint64_t));
+       return thread;
+}
+
+static DomainContext *
+get_domain (ProfContext *ctx, intptr_t domain_id)
+{
+       if (ctx->current_domain && ctx->current_domain->domain_id == domain_id)
+               return ctx->current_domain;
+
+       DomainContext *domain = ctx->domains;
+
+       while (domain) {
+               if (domain->domain_id == domain_id)
+                       return domain;
+
+               domain = domain->next;
+       }
+
+       domain = (DomainContext *) g_calloc (sizeof (DomainContext), 1);
+       domain->next = ctx->domains;
+       ctx->domains = domain;
+       domain->domain_id = domain_id;
+
+       return domain;
+}
+
+static RemCtxContext *
+get_remctx (ProfContext *ctx, intptr_t remctx_id)
+{
+       if (ctx->current_remctx && ctx->current_remctx->remctx_id == remctx_id)
+               return ctx->current_remctx;
+
+       RemCtxContext *remctx = ctx->remctxs;
+
+       while (remctx) {
+               if (remctx->remctx_id == remctx_id)
+                       return remctx;
+
+               remctx = remctx->next;
+       }
+
+       remctx = (RemCtxContext *) g_calloc (sizeof (RemCtxContext), 1);
+       remctx->next = ctx->remctxs;
+       ctx->remctxs = remctx;
+       remctx->remctx_id = remctx_id;
+
+       return remctx;
+}
+
+static ThreadContext*
+load_thread (ProfContext *ctx, intptr_t thread_id)
+{
+       ThreadContext *thread = get_thread (ctx, thread_id);
+       ctx->current_thread = thread;
+       return thread;
+}
+
+static void
+ensure_thread_stack (ThreadContext *thread)
+{
+       if (thread->stack_id == thread->stack_size) {
+               thread->stack_size *= 2;
+               thread->stack = (MethodDesc **) g_realloc (thread->stack, thread->stack_size * sizeof (void*));
+               thread->time_stack = (uint64_t *) g_realloc (thread->time_stack, thread->stack_size * sizeof (uint64_t));
+               thread->callee_time_stack = (uint64_t *) g_realloc (thread->callee_time_stack, thread->stack_size * sizeof (uint64_t));
+       }
+}
+
+static int
+add_trace_hashed (CallContext *traces, int size, BackTrace *bt, uint64_t value)
+{
+       int i;
+       unsigned int start_pos;
+       start_pos = bt->hash % size;
+       i = start_pos;
+       do {
+               if (traces [i].bt == bt) {
+                       traces [i].count += value;
+                       return 0;
+               } else if (!traces [i].bt) {
+                       traces [i].bt = bt;
+                       traces [i].count += value;
+                       return 1;
+               }
+               /* wrap around */
+               if (++i == size)
+                       i = 0;
+       } while (i != start_pos);
+       /* should not happen */
+       printf ("failed trace store\n");
+       return 0;
+}
+
+static void
+add_trace_bt (BackTrace *bt, TraceDesc *trace, uint64_t value)
+{
+       int i;
+       if (!collect_traces)
+               return;
+       if (trace->count * 2 >= trace->size) {
+               CallContext *n;
+               int old_size = trace->size;
+               trace->size *= 2;
+               if (trace->size == 0)
+                       trace->size = 4;
+               n = (CallContext *) g_calloc (sizeof (CallContext) * trace->size, 1);
+               for (i = 0; i < old_size; ++i) {
+                       if (trace->traces [i].bt)
+                               add_trace_hashed (n, trace->size, trace->traces [i].bt, trace->traces [i].count);
+               }
+               if (trace->traces)
+                       g_free (trace->traces);
+               trace->traces = n;
+       }
+       trace->count += add_trace_hashed (trace->traces, trace->size, bt, value);
+}
+
+static BackTrace*
+add_trace_thread (ThreadContext *thread, TraceDesc *trace, uint64_t value)
+{
+       BackTrace *bt;
+       int count = thread->stack_id;
+       if (!collect_traces)
+               return NULL;
+       if (count > trace_max)
+               count = trace_max;
+       bt = add_backtrace (count, thread->stack + thread->stack_id - count);
+       add_trace_bt (bt, trace, value);
+       return bt;
+}
+
+static BackTrace*
+add_trace_methods (MethodDesc **methods, int count, TraceDesc *trace, uint64_t value)
+{
+       BackTrace *bt;
+       if (!collect_traces)
+               return NULL;
+       if (count > trace_max)
+               count = trace_max;
+       bt = add_backtrace (count, methods);
+       add_trace_bt (bt, trace, value);
+       return bt;
+}
+
+static void
+thread_add_root (ThreadContext *ctx, uintptr_t obj, int root_type, uintptr_t extra_info)
+{
+       if (ctx->num_roots == ctx->size_roots) {
+               int new_size = ctx->size_roots * 2;
+               if (!new_size)
+                       new_size = 4;
+               ctx->roots = (uintptr_t *) g_realloc (ctx->roots, new_size * sizeof (uintptr_t));
+               ctx->roots_extra = (uintptr_t *) g_realloc (ctx->roots_extra, new_size * sizeof (uintptr_t));
+               ctx->roots_types = (int *) g_realloc (ctx->roots_types, new_size * sizeof (int));
+               ctx->size_roots = new_size;
+       }
+       ctx->roots_types [ctx->num_roots] = root_type;
+       ctx->roots_extra [ctx->num_roots] = extra_info;
+       ctx->roots [ctx->num_roots++] = obj;
+}
+
+static int
+compare_callc (const void *a, const void *b)
+{
+       const CallContext *A = (const CallContext *)a;
+       const CallContext *B = (const CallContext *)b;
+       if (B->count == A->count)
+               return 0;
+       if (B->count < A->count)
+               return -1;
+       return 1;
+}
+
+static void
+sort_context_array (TraceDesc* traces)
+{
+       int i, j;
+       for (i = 0, j = 0; i < traces->size; ++i) {
+               if (traces->traces [i].bt) {
+                       traces->traces [j].bt = traces->traces [i].bt;
+                       traces->traces [j].count = traces->traces [i].count;
+                       j++;
+               }
+       }
+       qsort (traces->traces, traces->count, sizeof (CallContext), compare_callc);
+}
+
+static void
+push_method (ThreadContext *thread, MethodDesc *method, uint64_t timestamp)
+{
+       ensure_thread_stack (thread);
+       thread->time_stack [thread->stack_id] = timestamp;
+       thread->callee_time_stack [thread->stack_id] = 0;
+       thread->stack [thread->stack_id++] = method;
+       method->recurse_count++;
+}
+
+static void
+pop_method (ThreadContext *thread, MethodDesc *method, uint64_t timestamp)
+{
+       method->recurse_count--;
+       if (thread->stack_id > 0 && thread->stack [thread->stack_id - 1] == method) {
+               uint64_t tdiff;
+               thread->stack_id--;
+               method->calls++;
+               if (timestamp < thread->time_stack [thread->stack_id])
+                       fprintf (outfile, "time went backwards for %s\n", method->name);
+               tdiff = timestamp - thread->time_stack [thread->stack_id];
+               if (thread->callee_time_stack [thread->stack_id] > tdiff)
+                       fprintf (outfile, "callee time bigger for %s\n", method->name);
+               method->self_time += tdiff - thread->callee_time_stack [thread->stack_id];
+               method->callee_time += thread->callee_time_stack [thread->stack_id];
+               if (thread->stack_id)
+                       thread->callee_time_stack [thread->stack_id - 1] += tdiff;
+               //fprintf (outfile, "method %s took %d\n", method->name, (int)(tdiff/1000));
+       } else {
+               fprintf (outfile, "unmatched leave at stack pos: %d for method %s\n", thread->stack_id, method->name);
+       }
+}
+
+typedef struct {
+       uint64_t total_time;
+       uint64_t max_time;
+       int count;
+} GCDesc;
+static GCDesc gc_info [3];
+static uint64_t max_heap_size;
+static uint64_t gc_object_moves;
+static int gc_resizes;
+typedef struct {
+       uint64_t created;
+       uint64_t destroyed;
+       uint64_t live;
+       uint64_t max_live;
+       TraceDesc traces;
+       TraceDesc destroy_traces;
+} HandleInfo;
+static HandleInfo handle_info [4];
+
+static const char*
+gc_event_name (int ev)
+{
+       switch (ev) {
+       case MONO_GC_EVENT_START: return "start";
+       case MONO_GC_EVENT_MARK_START: return "mark start";
+       case MONO_GC_EVENT_MARK_END: return "mark end";
+       case MONO_GC_EVENT_RECLAIM_START: return "reclaim start";
+       case MONO_GC_EVENT_RECLAIM_END: return "reclaim end";
+       case MONO_GC_EVENT_END: return "end";
+       case MONO_GC_EVENT_PRE_STOP_WORLD: return "pre stop";
+       case MONO_GC_EVENT_PRE_STOP_WORLD_LOCKED: return "pre stop lock";
+       case MONO_GC_EVENT_POST_STOP_WORLD: return "post stop";
+       case MONO_GC_EVENT_PRE_START_WORLD: return "pre start";
+       case MONO_GC_EVENT_POST_START_WORLD: return "post start";
+       case MONO_GC_EVENT_POST_START_WORLD_UNLOCKED: return "post start unlock";
+       default:
+               return "unknown";
+       }
+}
+
+static const char*
+sync_point_name (int type)
+{
+       switch (type) {
+       case SYNC_POINT_PERIODIC: return "periodic";
+       case SYNC_POINT_WORLD_STOP: return "world stop";
+       case SYNC_POINT_WORLD_START: return "world start";
+       default:
+               return "unknown";
+       }
+}
+
+static uint64_t clause_summary [MONO_EXCEPTION_CLAUSE_FAULT + 1];
+static uint64_t throw_count = 0;
+static TraceDesc exc_traces;
+
+static const char*
+clause_name (int type)
+{
+       switch (type) {
+       case MONO_EXCEPTION_CLAUSE_NONE: return "catch";
+       case MONO_EXCEPTION_CLAUSE_FILTER: return "filter";
+       case MONO_EXCEPTION_CLAUSE_FINALLY: return "finally";
+       case MONO_EXCEPTION_CLAUSE_FAULT: return "fault";
+       default: return "invalid";
+       }
+}
+
+static uint64_t monitor_contention;
+static uint64_t monitor_failed;
+static uint64_t monitor_acquired;
+
+struct _MonitorDesc {
+       MonitorDesc *next;
+       uintptr_t objid;
+       uintptr_t contentions;
+       uint64_t wait_time;
+       uint64_t max_wait_time;
+       TraceDesc traces;
+};
+
+static MonitorDesc* monitor_hash [SMALL_HASH_SIZE] = {0};
+static int num_monitors = 0;
+
+static MonitorDesc*
+lookup_monitor (uintptr_t objid)
+{
+       int slot = ((objid >> 3) & 0xffff) % SMALL_HASH_SIZE;
+       MonitorDesc *cd = monitor_hash [slot];
+       while (cd && cd->objid != objid)
+               cd = cd->next;
+       if (!cd) {
+               cd = (MonitorDesc *) g_calloc (sizeof (MonitorDesc), 1);
+               cd->objid = objid;
+               cd->next = monitor_hash [slot];
+               monitor_hash [slot] = cd;
+               num_monitors++;
+       }
+       return cd;
+}
+
+static const char*
+monitor_ev_name (int ev)
+{
+       switch (ev) {
+       case MONO_PROFILER_MONITOR_CONTENTION: return "contended";
+       case MONO_PROFILER_MONITOR_DONE: return "acquired";
+       case MONO_PROFILER_MONITOR_FAIL: return "not taken";
+       default: return "invalid";
+       }
+}
+
+static const char*
+get_handle_name (int htype)
+{
+       switch (htype) {
+       case 0: return "weak";
+       case 1: return "weaktrack";
+       case 2: return "normal";
+       case 3: return "pinned";
+       default: return "unknown";
+       }
+}
+
+static const char*
+get_root_name (int rtype)
+{
+       switch (rtype & MONO_PROFILE_GC_ROOT_TYPEMASK) {
+       case MONO_PROFILE_GC_ROOT_STACK: return "stack";
+       case MONO_PROFILE_GC_ROOT_FINALIZER: return "finalizer";
+       case MONO_PROFILE_GC_ROOT_HANDLE: return "handle";
+       case MONO_PROFILE_GC_ROOT_OTHER: return "other";
+       case MONO_PROFILE_GC_ROOT_MISC: return "misc";
+       default: return "unknown";
+       }
+}
+
+static uint64_t
+decode_uleb128 (uint8_t *buf, uint8_t **endbuf)
+{
+       uint64_t res = 0;
+       int shift = 0;
+
+       while (1) {
+               uint8_t b = *buf++;
+               res |= (((uint64_t) (b & 0x7f)) << shift);
+
+               if (!(b & 0x80))
+                       break;
+
+               shift += 7;
+       }
+
+       *endbuf = buf;
+
+       return res;
+}
+
+static intptr_t
+decode_sleb128 (uint8_t *buf, uint8_t **endbuf)
+{
+       uint8_t *p = buf;
+       intptr_t res = 0;
+       int shift = 0;
+
+       while (1) {
+               uint8_t b = *p;
+               p++;
+
+               res = res | (((intptr_t) (b & 0x7f)) << shift);
+               shift += 7;
+
+               if (!(b & 0x80)) {
+                       if (shift < sizeof (intptr_t) * 8 && (b & 0x40))
+                               res |= - ((intptr_t) 1 << shift);
+
+                       break;
+               }
+       }
+
+       *endbuf = p;
+
+       return res;
+}
+
+static MethodDesc**
+decode_bt (ProfContext *ctx, MethodDesc** sframes, int *size, unsigned char *p, unsigned char **endp, intptr_t ptr_base, intptr_t *method_base)
+{
+       MethodDesc **frames;
+       int i;
+       if (ctx->data_version < 13)
+               decode_uleb128 (p, &p); /* flags */
+       int count = decode_uleb128 (p, &p);
+       if (count > *size)
+               frames = (MethodDesc **) g_malloc (count * sizeof (void*));
+       else
+               frames = sframes;
+       for (i = 0; i < count; ++i) {
+               intptr_t ptrdiff = decode_sleb128 (p, &p);
+               if (ctx->data_version > 12) {
+                       *method_base += ptrdiff;
+                       frames [i] = lookup_method (*method_base);
+               } else {
+                       frames [i] = lookup_method (ptr_base + ptrdiff);
+               }
+       }
+       *size = count;
+       *endp = p;
+       return frames;
+}
+
+static void
+tracked_creation (uintptr_t obj, ClassDesc *cd, uint64_t size, BackTrace *bt, uint64_t timestamp)
+{
+       int i;
+       for (i = 0; i < num_tracked_objects; ++i) {
+               if (tracked_objects [i] != obj)
+                       continue;
+               fprintf (outfile, "Object %p created (%s, %llu bytes) at %.3f secs.\n", (void*)obj, cd->name, (unsigned long long) size, (timestamp - startup_time)/1000000000.0);
+               if (bt && bt->count) {
+                       int k;
+                       for (k = 0; k < bt->count; ++k)
+                               fprintf (outfile, "\t%s\n", bt->methods [k]->name);
+               }
+       }
+}
+
+static void
+track_handle (uintptr_t obj, int htype, uint32_t handle, BackTrace *bt, uint64_t timestamp)
+{
+       int i;
+       for (i = 0; i < num_tracked_objects; ++i) {
+               if (tracked_objects [i] != obj)
+                       continue;
+               fprintf (outfile, "Object %p referenced from handle %u at %.3f secs.\n", (void*)obj, handle, (timestamp - startup_time) / 1000000000.0);
+               if (bt && bt->count) {
+                       int k;
+                       for (k = 0; k < bt->count; ++k)
+                               fprintf (outfile, "\t%s\n", bt->methods [k]->name);
+               }
+       }
+}
+
+static void
+track_move (uintptr_t src, uintptr_t dst)
+{
+       int i;
+       for (i = 0; i < num_tracked_objects; ++i) {
+               if (tracked_objects [i] == src)
+                       fprintf (outfile, "Object %p moved to %p\n", (void*)src, (void*)dst);
+               else if (tracked_objects [i] == dst)
+                       fprintf (outfile, "Object %p moved from %p\n", (void*)dst, (void*)src);
+       }
+}
+
+static void
+track_obj_reference (uintptr_t obj, uintptr_t parent, ClassDesc *cd)
+{
+       int i;
+       for (i = 0; i < num_tracked_objects; ++i) {
+               if (tracked_objects [i] == obj)
+                       fprintf (outfile, "Object %p referenced from %p (%s).\n", (void*)obj, (void*)parent, cd->name);
+       }
+}
+
+static void
+found_object (uintptr_t obj)
+{
+       num_tracked_objects ++;
+       tracked_objects = (uintptr_t *) g_realloc (tracked_objects, num_tracked_objects * sizeof (tracked_objects [0]));
+       tracked_objects [num_tracked_objects - 1] = obj;
+}
+
+static int num_jit_helpers = 0;
+static int jit_helpers_code_size = 0;
+
+static const char*
+code_buffer_desc (int type)
+{
+       switch (type) {
+       case MONO_PROFILER_CODE_BUFFER_METHOD:
+               return "method";
+       case MONO_PROFILER_CODE_BUFFER_METHOD_TRAMPOLINE:
+               return "method trampoline";
+       case MONO_PROFILER_CODE_BUFFER_UNBOX_TRAMPOLINE:
+               return "unbox trampoline";
+       case MONO_PROFILER_CODE_BUFFER_IMT_TRAMPOLINE:
+               return "imt trampoline";
+       case MONO_PROFILER_CODE_BUFFER_GENERICS_TRAMPOLINE:
+               return "generics trampoline";
+       case MONO_PROFILER_CODE_BUFFER_SPECIFIC_TRAMPOLINE:
+               return "specific trampoline";
+       case MONO_PROFILER_CODE_BUFFER_HELPER:
+               return "misc helper";
+       case MONO_PROFILER_CODE_BUFFER_MONITOR:
+               return "monitor/lock";
+       case MONO_PROFILER_CODE_BUFFER_DELEGATE_INVOKE:
+               return "delegate invoke";
+       case MONO_PROFILER_CODE_BUFFER_EXCEPTION_HANDLING:
+               return "exception handling";
+       default:
+               return "unspecified";
+       }
+}
+
+typedef struct _CoverageAssembly CoverageAssembly;
+struct _CoverageAssembly {
+       char *name;
+       char *guid;
+       char *filename;
+       int number_of_methods;
+       int fully_covered;
+       int partially_covered;
+};
+
+typedef struct _CoverageClass CoverageClass;
+struct _CoverageClass {
+       char *assembly_name;
+       char *class_name;
+       int number_of_methods;
+       int fully_covered;
+       int partially_covered;
+};
+
+typedef struct _CoverageCoverage CoverageCoverage;
+struct _CoverageCoverage {
+       int method_id;
+       int offset;
+       int count;
+       int line;
+       int column;
+};
+
+typedef struct _CoverageMethod CoverageMethod;
+struct _CoverageMethod {
+       char *assembly_name;
+       char *class_name;
+       char *method_name;
+       char *method_signature;
+       char *filename;
+       int token;
+       int n_statements;
+       int method_id;
+       GPtrArray *coverage;
+};
+static GPtrArray *coverage_assemblies = NULL;
+static GPtrArray *coverage_methods = NULL;
+static GPtrArray *coverage_statements = NULL;
+static GHashTable *coverage_methods_hash = NULL;
+static GPtrArray *coverage_classes = NULL;
+static GHashTable *coverage_assembly_classes = NULL;
+
+static void
+gather_coverage_statements (void)
+{
+       for (guint i = 0; i < coverage_statements->len; i++) {
+               CoverageCoverage *coverage = (CoverageCoverage *)coverage_statements->pdata[i];
+               CoverageMethod *method = (CoverageMethod *)g_hash_table_lookup (coverage_methods_hash, GINT_TO_POINTER (coverage->method_id));
+               if (method == NULL) {
+                       fprintf (outfile, "Cannot find method with ID: %d\n", coverage->method_id);
+                       continue;
+               }
+
+               g_ptr_array_add (method->coverage, coverage);
+       }
+}
+
+static void
+coverage_add_assembly (CoverageAssembly *assembly)
+{
+       if (coverage_assemblies == NULL)
+               coverage_assemblies = g_ptr_array_new ();
+
+       g_ptr_array_add (coverage_assemblies, assembly);
+}
+
+static void
+coverage_add_method (CoverageMethod *method)
+{
+       if (coverage_methods == NULL) {
+               coverage_methods = g_ptr_array_new ();
+               coverage_methods_hash = g_hash_table_new (NULL, NULL);
+       }
+
+       g_ptr_array_add (coverage_methods, method);
+       g_hash_table_insert (coverage_methods_hash, GINT_TO_POINTER (method->method_id), method);
+}
+
+static void
+coverage_add_class (CoverageClass *klass)
+{
+       GPtrArray *classes = NULL;
+
+       if (coverage_classes == NULL) {
+               coverage_classes = g_ptr_array_new ();
+               coverage_assembly_classes = g_hash_table_new (g_str_hash, g_str_equal);
+       }
+
+       g_ptr_array_add (coverage_classes, klass);
+       classes = (GPtrArray *)g_hash_table_lookup (coverage_assembly_classes, klass->assembly_name);
+       if (classes == NULL) {
+               classes = g_ptr_array_new ();
+               g_hash_table_insert (coverage_assembly_classes, klass->assembly_name, classes);
+       }
+       g_ptr_array_add (classes, klass);
+}
+
+static void
+coverage_add_coverage (CoverageCoverage *coverage)
+{
+       if (coverage_statements == NULL)
+               coverage_statements = g_ptr_array_new ();
+
+       g_ptr_array_add (coverage_statements, coverage);
+}
+
+#define OBJ_ADDR(diff) ((obj_base + diff) << 3)
+#define LOG_TIME(base,diff) /*fprintf("outfile, time %llu + %llu near offset %d\n", base, diff, p - ctx->buf)*/
+
+
+/* Stats */
+#define BUFFER_HEADER_SIZE 48
+
+typedef struct {
+       int count, min_size, max_size, bytes;
+} EventStat;
+
+static int buffer_count;
+static EventStat stats [256];
+
+static void
+record_event_stats (int type, int size)
+{
+       ++stats [type].count;
+       if (!stats [type].min_size)
+               stats [type].min_size = size;
+       stats [type].min_size = MIN (stats [type].min_size, size);
+       stats [type].max_size = MAX (stats [type].max_size, size);
+       stats [type].bytes += size;
+}
+
+static int
+decode_buffer (ProfContext *ctx)
+{
+       unsigned char *p;
+       unsigned char *end;
+       intptr_t thread_id;
+       intptr_t ptr_base;
+       intptr_t obj_base;
+       intptr_t method_base;
+       uint64_t time_base;
+       uint64_t file_offset;
+       int len, i;
+       ThreadContext *thread;
+
+#ifdef HAVE_SYS_ZLIB
+       if (ctx->gzfile)
+               file_offset = gztell (ctx->gzfile);
+       else
+#endif
+               file_offset = ftell (ctx->file);
+       if (!load_data (ctx, 48))
+               return 0;
+       p = ctx->buf;
+       if (read_int32 (p) != BUF_ID) {
+               fprintf (outfile, "Incorrect buffer id: 0x%x\n", read_int32 (p));
+               for (i = 0; i < 48; ++i) {
+                       fprintf (outfile, "0x%x%s", p [i], i % 8?" ":"\n");
+               }
+               return 0;
+       }
+       len = read_int32 (p + 4);
+       time_base = read_int64 (p + 8);
+       ptr_base = read_int64 (p + 16);
+       obj_base = read_int64 (p + 24);
+       thread_id = read_int64 (p + 32);
+       method_base = read_int64 (p + 40);
+       if (debug)
+               fprintf (outfile, "buf: thread:%zx, len: %d, time: %llu, file offset: %llu\n", thread_id, len, (unsigned long long) time_base, (unsigned long long) file_offset);
+       thread = load_thread (ctx, thread_id);
+       if (!load_data (ctx, len))
+               return 0;
+
+       ++buffer_count;
+
+       if (!startup_time) {
+               startup_time = time_base;
+               if (use_time_filter) {
+                       time_from += startup_time;
+                       time_to += startup_time;
+               }
+       }
+       for (i = 0; i < thread->stack_id; ++i)
+               thread->stack [i]->recurse_count++;
+       p = ctx->buf;
+       end = p + len;
+       while (p < end) {
+               unsigned char *start = p;
+               unsigned char event = *p;
+               switch (*p & 0xf) {
+               case TYPE_GC: {
+                       int subtype = *p & 0xf0;
+                       uint64_t tdiff = decode_uleb128 (p + 1, &p);
+                       LOG_TIME (time_base, tdiff);
+                       time_base += tdiff;
+                       if (subtype == TYPE_GC_RESIZE) {
+                               uint64_t new_size = decode_uleb128 (p, &p);
+                               if (debug)
+                                       fprintf (outfile, "gc heap resized to %llu\n", (unsigned long long) new_size);
+                               gc_resizes++;
+                               if (new_size > max_heap_size)
+                                       max_heap_size = new_size;
+                       } else if (subtype == TYPE_GC_EVENT) {
+                               uint64_t ev;
+                               if (ctx->data_version > 12)
+                                       ev = *p++;
+                               else
+                                       ev = decode_uleb128 (p, &p);
+                               int gen;
+                               if (ctx->data_version > 12)
+                                       gen = *p++;
+                               else
+                                       gen = decode_uleb128 (p, &p);
+                               if (debug)
+                                       fprintf (outfile, "gc event for gen%d: %s at %llu (thread: 0x%zx)\n", gen, gc_event_name (ev), (unsigned long long) time_base, thread->thread_id);
+                               if (gen > 2) {
+                                       fprintf (outfile, "incorrect gc gen: %d\n", gen);
+                                       break;
+                               }
+                               if (ev == MONO_GC_EVENT_START) {
+                                       thread->gc_start_times [gen] = time_base;
+                                       gc_info [gen].count++;
+                               } else if (ev == MONO_GC_EVENT_END) {
+                                       tdiff = time_base - thread->gc_start_times [gen];
+                                       gc_info [gen].total_time += tdiff;
+                                       if (tdiff > gc_info [gen].max_time)
+                                               gc_info [gen].max_time = tdiff;
+                               }
+                       } else if (subtype == TYPE_GC_MOVE) {
+                               int j, num = decode_uleb128 (p, &p);
+                               gc_object_moves += num / 2;
+                               for (j = 0; j < num; j += 2) {
+                                       intptr_t obj1diff = decode_sleb128 (p, &p);
+                                       intptr_t obj2diff = decode_sleb128 (p, &p);
+                                       if (num_tracked_objects)
+                                               track_move (OBJ_ADDR (obj1diff), OBJ_ADDR (obj2diff));
+                                       if (debug) {
+                                               fprintf (outfile, "moved obj %p to %p\n", (void*)OBJ_ADDR (obj1diff), (void*)OBJ_ADDR (obj2diff));
+                                       }
+                               }
+                       } else if (subtype == TYPE_GC_HANDLE_CREATED || subtype == TYPE_GC_HANDLE_CREATED_BT) {
+                               int has_bt = subtype == TYPE_GC_HANDLE_CREATED_BT;
+                               int num_bt = 0;
+                               MethodDesc *sframes [8];
+                               MethodDesc **frames = sframes;
+                               int htype = decode_uleb128 (p, &p);
+                               uint32_t handle = decode_uleb128 (p, &p);
+                               intptr_t objdiff = decode_sleb128 (p, &p);
+                               if (has_bt) {
+                                       num_bt = 8;
+                                       frames = decode_bt (ctx, sframes, &num_bt, p, &p, ptr_base, &method_base);
+                                       if (!frames) {
+                                               fprintf (outfile, "Cannot load backtrace\n");
+                                               return 0;
+                                       }
+                               }
+                               if (htype > 3)
+                                       return 0;
+                               if ((thread_filter && thread_filter == thread->thread_id) || (time_base >= time_from && time_base < time_to)) {
+                                       handle_info [htype].created++;
+                                       handle_info [htype].live++;
+                                       if (handle_info [htype].live > handle_info [htype].max_live)
+                                               handle_info [htype].max_live = handle_info [htype].live;
+                                       BackTrace *bt;
+                                       if (has_bt)
+                                               bt = add_trace_methods (frames, num_bt, &handle_info [htype].traces, 1);
+                                       else
+                                               bt = add_trace_thread (thread, &handle_info [htype].traces, 1);
+                                       if (num_tracked_objects)
+                                               track_handle (OBJ_ADDR (objdiff), htype, handle, bt, time_base);
+                               }
+                               if (debug)
+                                       fprintf (outfile, "handle (%s) %u created for object %p\n", get_handle_name (htype), handle, (void*)OBJ_ADDR (objdiff));
+                               if (frames != sframes)
+                                       g_free (frames);
+                       } else if (subtype == TYPE_GC_HANDLE_DESTROYED || subtype == TYPE_GC_HANDLE_DESTROYED_BT) {
+                               int has_bt = subtype == TYPE_GC_HANDLE_DESTROYED_BT;
+                               int num_bt = 0;
+                               MethodDesc *sframes [8];
+                               MethodDesc **frames = sframes;
+                               int htype = decode_uleb128 (p, &p);
+                               uint32_t handle = decode_uleb128 (p, &p);
+                               if (has_bt) {
+                                       num_bt = 8;
+                                       frames = decode_bt (ctx, sframes, &num_bt, p, &p, ptr_base, &method_base);
+                                       if (!frames) {
+                                               fprintf (outfile, "Cannot load backtrace\n");
+                                               return 0;
+                                       }
+                               }
+                               if (htype > 3)
+                                       return 0;
+                               if ((thread_filter && thread_filter == thread->thread_id) || (time_base >= time_from && time_base < time_to)) {
+                                       handle_info [htype].destroyed ++;
+                                       handle_info [htype].live--;
+                                       BackTrace *bt;
+                                       if (has_bt)
+                                               bt = add_trace_methods (frames, num_bt, &handle_info [htype].destroy_traces, 1);
+                                       else
+                                               bt = add_trace_thread (thread, &handle_info [htype].destroy_traces, 1);
+                                       /* TODO: track_handle_free () - would need to record and keep track of the associated object address... */
+                               }
+                               if (debug)
+                                       fprintf (outfile, "handle (%s) %u destroyed\n", get_handle_name (htype), handle);
+                               if (frames != sframes)
+                                       g_free (frames);
+                       } else if (subtype == TYPE_GC_FINALIZE_START) {
+                               // TODO: Generate a finalizer report based on these events.
+                               if (debug)
+                                       fprintf (outfile, "gc finalizer queue being processed at %llu\n", (unsigned long long) time_base);
+                       } else if (subtype == TYPE_GC_FINALIZE_END) {
+                               if (debug)
+                                       fprintf (outfile, "gc finalizer queue finished processing at %llu\n", (unsigned long long) time_base);
+                       } else if (subtype == TYPE_GC_FINALIZE_OBJECT_START) {
+                               intptr_t objdiff = decode_sleb128 (p, &p);
+                               if (debug)
+                                       fprintf (outfile, "gc finalizing object %p at %llu\n", (void *) OBJ_ADDR (objdiff), (unsigned long long) time_base);
+                       } else if (subtype == TYPE_GC_FINALIZE_OBJECT_END) {
+                               intptr_t objdiff = decode_sleb128 (p, &p);
+                               if (debug)
+                                       fprintf (outfile, "gc finalized object %p at %llu\n", (void *) OBJ_ADDR (objdiff), (unsigned long long) time_base);
+                       }
+                       break;
+               }
+               case TYPE_METADATA: {
+                       int subtype = *p & 0xf0;
+                       const char *load_str = subtype == TYPE_END_LOAD ? "loaded" : "unloaded";
+                       uint64_t tdiff = decode_uleb128 (p + 1, &p);
+                       int mtype = *p++;
+                       intptr_t ptrdiff = decode_sleb128 (p, &p);
+                       LOG_TIME (time_base, tdiff);
+                       time_base += tdiff;
+                       if (mtype == TYPE_CLASS) {
+                               intptr_t imptrdiff = decode_sleb128 (p, &p);
+                               if (ctx->data_version < 13)
+                                       decode_uleb128 (p, &p); /* flags */
+                               if (debug)
+                                       fprintf (outfile, "%s class %p (%s in %p) at %llu\n", load_str, (void*)(ptr_base + ptrdiff), p, (void*)(ptr_base + imptrdiff), (unsigned long long) time_base);
+                               if (subtype == TYPE_END_LOAD)
+                                       add_class (ptr_base + ptrdiff, (char*)p);
+                               while (*p) p++;
+                               p++;
+                       } else if (mtype == TYPE_IMAGE) {
+                               if (ctx->data_version < 13)
+                                       decode_uleb128 (p, &p); /* flags */
+                               if (debug)
+                                       fprintf (outfile, "%s image %p (%s) at %llu\n", load_str, (void*)(ptr_base + ptrdiff), p, (unsigned long long) time_base);
+                               if (subtype == TYPE_END_LOAD)
+                                       add_image (ptr_base + ptrdiff, (char*)p);
+                               while (*p) p++;
+                               p++;
+                       } else if (mtype == TYPE_ASSEMBLY) {
+                               if (ctx->data_version < 13)
+                                       decode_uleb128 (p, &p); /* flags */
+                               if (debug)
+                                       fprintf (outfile, "%s assembly %p (%s) at %llu\n", load_str, (void*)(ptr_base + ptrdiff), p, (unsigned long long) time_base);
+                               if (subtype == TYPE_END_LOAD)
+                                       add_assembly (ptr_base + ptrdiff, (char*)p);
+                               while (*p) p++;
+                               p++;
+                       } else if (mtype == TYPE_DOMAIN) {
+                               if (ctx->data_version < 13)
+                                       decode_uleb128 (p, &p); /* flags */
+                               DomainContext *nd = get_domain (ctx, ptr_base + ptrdiff);
+                               /* no subtype means it's a name event, rather than start/stop */
+                               if (subtype == 0)
+                                       nd->friendly_name = pstrdup ((char *) p);
+                               if (debug) {
+                                       if (subtype == 0)
+                                               fprintf (outfile, "domain %p named at %llu: %s\n", (void *) (ptr_base + ptrdiff), (unsigned long long) time_base, p);
+                                       else
+                                               fprintf (outfile, "%s thread %p at %llu\n", load_str, (void *) (ptr_base + ptrdiff), (unsigned long long) time_base);
+                               }
+                               if (subtype == 0) {
+                                       while (*p) p++;
+                                       p++;
+                               }
+                       } else if (mtype == TYPE_CONTEXT) {
+                               if (ctx->data_version < 13)
+                                       decode_uleb128 (p, &p); /* flags */
+                               intptr_t domaindiff = decode_sleb128 (p, &p);
+                               if (debug)
+                                       fprintf (outfile, "%s context %p (%p) at %llu\n", load_str, (void*)(ptr_base + ptrdiff), (void *) (ptr_base + domaindiff), (unsigned long long) time_base);
+                               if (subtype == TYPE_END_LOAD)
+                                       get_remctx (ctx, ptr_base + ptrdiff)->domain_id = ptr_base + domaindiff;
+                       } else if (mtype == TYPE_THREAD) {
+                               if (ctx->data_version < 13)
+                                       decode_uleb128 (p, &p); /* flags */
+                               ThreadContext *nt = get_thread (ctx, ptr_base + ptrdiff);
+                               /* no subtype means it's a name event, rather than start/stop */
+                               if (subtype == 0)
+                                       nt->name = pstrdup ((char*)p);
+                               if (debug) {
+                                       if (subtype == 0)
+                                               fprintf (outfile, "thread %p named at %llu: %s\n", (void*)(ptr_base + ptrdiff), (unsigned long long) time_base, p);
+                                       else
+                                               fprintf (outfile, "%s thread %p at %llu\n", load_str, (void *) (ptr_base + ptrdiff), (unsigned long long) time_base);
+                               }
+                               if (subtype == 0) {
+                                       while (*p) p++;
+                                       p++;
+                               }
+                       }
+                       break;
+               }
+               case TYPE_ALLOC: {
+                       int has_bt = *p & TYPE_ALLOC_BT;
+                       uint64_t tdiff = decode_uleb128 (p + 1, &p);
+                       intptr_t ptrdiff = decode_sleb128 (p, &p);
+                       intptr_t objdiff = decode_sleb128 (p, &p);
+                       uint64_t len;
+                       int num_bt = 0;
+                       MethodDesc* sframes [8];
+                       MethodDesc** frames = sframes;
+                       ClassDesc *cd = lookup_class (ptr_base + ptrdiff);
+                       len = decode_uleb128 (p, &p);
+                       LOG_TIME (time_base, tdiff);
+                       time_base += tdiff;
+                       if (debug)
+                               fprintf (outfile, "alloced object %p, size %llu (%s) at %llu\n", (void*)OBJ_ADDR (objdiff), (unsigned long long) len, lookup_class (ptr_base + ptrdiff)->name, (unsigned long long) time_base);
+                       if (has_bt) {
+                               num_bt = 8;
+                               frames = decode_bt (ctx, sframes, &num_bt, p, &p, ptr_base, &method_base);
+                               if (!frames) {
+                                       fprintf (outfile, "Cannot load backtrace\n");
+                                       return 0;
+                               }
+                       }
+                       if ((thread_filter && thread_filter == thread->thread_id) || (time_base >= time_from && time_base < time_to)) {
+                               BackTrace *bt;
+                               cd->allocs++;
+                               cd->alloc_size += len;
+                               if (has_bt)
+                                       bt = add_trace_methods (frames, num_bt, &cd->traces, len);
+                               else
+                                       bt = add_trace_thread (thread, &cd->traces, len);
+                               if (find_size && len >= find_size) {
+                                       if (!find_name || strstr (cd->name, find_name))
+                                               found_object (OBJ_ADDR (objdiff));
+                               } else if (!find_size && find_name && strstr (cd->name, find_name)) {
+                                       found_object (OBJ_ADDR (objdiff));
+                               }
+                               if (num_tracked_objects)
+                                       tracked_creation (OBJ_ADDR (objdiff), cd, len, bt, time_base);
+                       }
+                       if (frames != sframes)
+                               g_free (frames);
+                       break;
+               }
+               case TYPE_METHOD: {
+                       int subtype = *p & 0xf0;
+                       uint64_t tdiff = decode_uleb128 (p + 1, &p);
+                       int64_t ptrdiff = decode_sleb128 (p, &p);
+                       LOG_TIME (time_base, tdiff);
+                       time_base += tdiff;
+                       method_base += ptrdiff;
+                       if (subtype == TYPE_JIT) {
+                               intptr_t codediff = decode_sleb128 (p, &p);
+                               int codelen = decode_uleb128 (p, &p);
+                               MethodDesc *jitted_method;
+                               if (debug)
+                                       fprintf (outfile, "jitted method %p (%s), size: %d, code: %p\n", (void*)(method_base), p, codelen, (void*)(ptr_base + codediff));
+                               jitted_method = add_method (method_base, (char*)p, ptr_base + codediff, codelen);
+                               if (!(time_base >= time_from && time_base < time_to))
+                                       jitted_method->ignore_jit = 1;
+                               while (*p) p++;
+                               p++;
+                       } else {
+                               MethodDesc *method;
+                               if ((thread_filter && thread_filter != thread->thread_id))
+                                       break;
+                               if (!(time_base >= time_from && time_base < time_to))
+                                       break;
+                               method = lookup_method (method_base);
+                               if (subtype == TYPE_ENTER) {
+                                       add_trace_thread (thread, &method->traces, 1);
+                                       push_method (thread, method, time_base);
+                               } else {
+                                       pop_method (thread, method, time_base);
+                               }
+                               if (debug)
+                                       fprintf (outfile, "%s method %s\n", subtype == TYPE_ENTER? "enter": subtype == TYPE_EXC_LEAVE? "exleave": "leave", method->name);
+                       }
+                       break;
+               }
+               case TYPE_HEAP: {
+                       int subtype = *p & 0xf0;
+                       if (subtype == TYPE_HEAP_OBJECT) {
+                               HeapObjectDesc *ho = NULL;
+                               int i;
+                               intptr_t objdiff;
+                               if (ctx->data_version > 12) {
+                                       uint64_t tdiff = decode_uleb128 (p + 1, &p);
+                                       LOG_TIME (time_base, tdiff);
+                                       time_base += tdiff;
+                                       objdiff = decode_sleb128 (p, &p);
+                               } else
+                                       objdiff = decode_sleb128 (p + 1, &p);
+                               intptr_t ptrdiff = decode_sleb128 (p, &p);
+                               uint64_t size = decode_uleb128 (p, &p);
+                               uintptr_t num = decode_uleb128 (p, &p);
+                               uintptr_t ref_offset = 0;
+                               uintptr_t last_obj_offset = 0;
+                               ClassDesc *cd = lookup_class (ptr_base + ptrdiff);
+                               if (size) {
+                                       HeapClassDesc *hcd = add_heap_shot_class (thread->current_heap_shot, cd, size);
+                                       if (collect_traces) {
+                                               ho = alloc_heap_obj (OBJ_ADDR (objdiff), hcd, num);
+                                               add_heap_shot_obj (thread->current_heap_shot, ho);
+                                               ref_offset = 0;
+                                       }
+                               } else {
+                                       if (collect_traces)
+                                               ho = heap_shot_obj_add_refs (thread->current_heap_shot, OBJ_ADDR (objdiff), num, &ref_offset);
+                               }
+                               for (i = 0; i < num; ++i) {
+                                       /* FIXME: use object distance to measure how good
+                                        * the GC is at keeping related objects close
+                                        */
+                                       uintptr_t offset = ctx->data_version > 1? last_obj_offset + decode_uleb128 (p, &p): -1;
+                                       intptr_t obj1diff = decode_sleb128 (p, &p);
+                                       last_obj_offset = offset;
+                                       if (collect_traces)
+                                               ho->refs [ref_offset + i] = OBJ_ADDR (obj1diff);
+                                       if (num_tracked_objects)
+                                               track_obj_reference (OBJ_ADDR (obj1diff), OBJ_ADDR (objdiff), cd);
+                               }
+                               if (debug && size)
+                                       fprintf (outfile, "traced object %p, size %llu (%s), refs: %zd\n", (void*)OBJ_ADDR (objdiff), (unsigned long long) size, cd->name, num);
+                       } else if (subtype == TYPE_HEAP_ROOT) {
+                               uintptr_t num;
+                               if (ctx->data_version > 12) {
+                                       uint64_t tdiff = decode_uleb128 (p + 1, &p);
+                                       LOG_TIME (time_base, tdiff);
+                                       time_base += tdiff;
+                                       num = decode_uleb128 (p, &p);
+                               } else
+                                       num = decode_uleb128 (p + 1, &p);
+                               uintptr_t gc_num G_GNUC_UNUSED = decode_uleb128 (p, &p);
+                               int i;
+                               for (i = 0; i < num; ++i) {
+                                       intptr_t objdiff = decode_sleb128 (p, &p);
+                                       int root_type;
+                                       if (ctx->data_version > 12)
+                                               root_type = *p++;
+                                       else
+                                               root_type = decode_uleb128 (p, &p);
+                                       /* we just discard the extra info for now */
+                                       uintptr_t extra_info = decode_uleb128 (p, &p);
+                                       if (debug)
+                                               fprintf (outfile, "object %p is a %s root\n", (void*)OBJ_ADDR (objdiff), get_root_name (root_type));
+                                       if (collect_traces)
+                                               thread_add_root (thread, OBJ_ADDR (objdiff), root_type, extra_info);
+                               }
+                       } else if (subtype == TYPE_HEAP_END) {
+                               uint64_t tdiff = decode_uleb128 (p + 1, &p);
+                               LOG_TIME (time_base, tdiff);
+                               time_base += tdiff;
+                               if (debug)
+                                       fprintf (outfile, "heap shot end\n");
+                               if (collect_traces) {
+                                       HeapShot *hs = thread->current_heap_shot;
+                                       if (hs && thread->num_roots) {
+                                               /* transfer the root ownershipt to the heapshot */
+                                               hs->num_roots = thread->num_roots;
+                                               hs->roots = thread->roots;
+                                               hs->roots_extra = thread->roots_extra;
+                                               hs->roots_types = thread->roots_types;
+                                       } else {
+                                               g_free (thread->roots);
+                                               g_free (thread->roots_extra);
+                                               g_free (thread->roots_types);
+                                       }
+                                       thread->num_roots = 0;
+                                       thread->size_roots = 0;
+                                       thread->roots = NULL;
+                                       thread->roots_extra = NULL;
+                                       thread->roots_types = NULL;
+                                       heap_shot_resolve_reverse_refs (hs);
+                                       heap_shot_mark_objects (hs);
+                                       heap_shot_free_objects (hs);
+                               }
+                               thread->current_heap_shot = NULL;
+                       } else if (subtype == TYPE_HEAP_START) {
+                               uint64_t tdiff = decode_uleb128 (p + 1, &p);
+                               LOG_TIME (time_base, tdiff);
+                               time_base += tdiff;
+                               if (debug)
+                                       fprintf (outfile, "heap shot start\n");
+                               thread->current_heap_shot = new_heap_shot (time_base);
+                       }
+                       break;
+               }
+               case TYPE_MONITOR: {
+                       int event = (*p >> 4) & 0x3;
+                       int has_bt = *p & TYPE_MONITOR_BT;
+                       uint64_t tdiff = decode_uleb128 (p + 1, &p);
+                       intptr_t objdiff = decode_sleb128 (p, &p);
+                       MethodDesc* sframes [8];
+                       MethodDesc** frames = sframes;
+                       int record;
+                       int num_bt = 0;
+                       LOG_TIME (time_base, tdiff);
+                       time_base += tdiff;
+                       record = (!thread_filter || thread_filter == thread->thread_id);
+                       if (!(time_base >= time_from && time_base < time_to))
+                               record = 0;
+                       if (event == MONO_PROFILER_MONITOR_CONTENTION) {
+                               MonitorDesc *mdesc = lookup_monitor (OBJ_ADDR (objdiff));
+                               if (record) {
+                                       monitor_contention++;
+                                       mdesc->contentions++;
+                                       thread->monitor = mdesc;
+                                       thread->contention_start = time_base;
+                               }
+                               if (has_bt) {
+                                       num_bt = 8;
+                                       frames = decode_bt (ctx, sframes, &num_bt, p, &p, ptr_base, &method_base);
+                                       if (!frames) {
+                                               fprintf (outfile, "Cannot load backtrace\n");
+                                               return 0;
+                                       }
+                                       if (record)
+                                               add_trace_methods (frames, num_bt, &mdesc->traces, 1);
+                               } else {
+                                       if (record)
+                                               add_trace_thread (thread, &mdesc->traces, 1);
+                               }
+                       } else if (event == MONO_PROFILER_MONITOR_FAIL) {
+                               if (record) {
+                                       monitor_failed++;
+                                       if (thread->monitor && thread->contention_start) {
+                                               uint64_t wait_time = time_base - thread->contention_start;
+                                               if (wait_time > thread->monitor->max_wait_time)
+                                                       thread->monitor->max_wait_time = wait_time;
+                                               thread->monitor->wait_time += wait_time;
+                                               thread->monitor = NULL;
+                                               thread->contention_start = 0;
+                                       }
+                               }
+                       } else if (event == MONO_PROFILER_MONITOR_DONE) {
+                               if (record) {
+                                       monitor_acquired++;
+                                       if (thread->monitor && thread->contention_start) {
+                                               uint64_t wait_time = time_base - thread->contention_start;
+                                               if (wait_time > thread->monitor->max_wait_time)
+                                                       thread->monitor->max_wait_time = wait_time;
+                                               thread->monitor->wait_time += wait_time;
+                                               thread->monitor = NULL;
+                                               thread->contention_start = 0;
+                                       }
+                               }
+                       }
+                       if (debug)
+                               fprintf (outfile, "monitor %s for object %p\n", monitor_ev_name (event), (void*)OBJ_ADDR (objdiff));
+                       if (frames != sframes)
+                               g_free (frames);
+                       break;
+               }
+               case TYPE_EXCEPTION: {
+                       int subtype = *p & 0x70;
+                       int has_bt = *p & TYPE_THROW_BT;
+                       uint64_t tdiff = decode_uleb128 (p + 1, &p);
+                       MethodDesc* sframes [8];
+                       MethodDesc** frames = sframes;
+                       int record;
+                       LOG_TIME (time_base, tdiff);
+                       time_base += tdiff;
+                       record = (!thread_filter || thread_filter == thread->thread_id);
+                       if (!(time_base >= time_from && time_base < time_to))
+                               record = 0;
+                       if (subtype == TYPE_CLAUSE) {
+                               int clause_type;
+                               if (ctx->data_version > 12)
+                                       clause_type = *p++;
+                               else
+                                       clause_type = decode_uleb128 (p, &p);
+                               int clause_num = decode_uleb128 (p, &p);
+                               int64_t ptrdiff = decode_sleb128 (p, &p);
+                               method_base += ptrdiff;
+                               if (record)
+                                       clause_summary [clause_type]++;
+                               if (debug)
+                                       fprintf (outfile, "clause %s (%d) in method %s\n", clause_name (clause_type), clause_num, lookup_method (method_base)->name);
+                       } else {
+                               intptr_t objdiff = decode_sleb128 (p, &p);
+                               if (record)
+                                       throw_count++;
+                               if (has_bt) {
+                                       has_bt = 8;
+                                       frames = decode_bt (ctx, sframes, &has_bt, p, &p, ptr_base, &method_base);
+                                       if (!frames) {
+                                               fprintf (outfile, "Cannot load backtrace\n");
+                                               return 0;
+                                       }
+                                       if (record)
+                                               add_trace_methods (frames, has_bt, &exc_traces, 1);
+                               } else {
+                                       if (record)
+                                               add_trace_thread (thread, &exc_traces, 1);
+                               }
+                               if (frames != sframes)
+                                       g_free (frames);
+                               if (debug)
+                                       fprintf (outfile, "throw %p\n", (void*)OBJ_ADDR (objdiff));
+                       }
+                       break;
+               }
+               case TYPE_RUNTIME: {
+                       int subtype = *p & 0xf0;
+                       uint64_t tdiff = decode_uleb128 (p + 1, &p);
+                       LOG_TIME (time_base, tdiff);
+                       time_base += tdiff;
+                       if (subtype == TYPE_JITHELPER) {
+                               int type;
+                               if (ctx->data_version > 12)
+                                       type = *p++;
+                               else
+                                       type = decode_uleb128 (p, &p);
+                               intptr_t codediff = decode_sleb128 (p, &p);
+                               int codelen = decode_uleb128 (p, &p);
+                               const char *name;
+                               if (type == MONO_PROFILER_CODE_BUFFER_SPECIFIC_TRAMPOLINE) {
+                                       name = (const char *)p;
+                                       while (*p) p++;
+                                               p++;
+                               } else {
+                                       name = code_buffer_desc (type);
+                               }
+                               num_jit_helpers++;
+                               jit_helpers_code_size += codelen;
+                               if (debug)
+                                       fprintf (outfile, "jit helper %s, size: %d, code: %p\n", name, codelen, (void*)(ptr_base + codediff));
+                       }
+                       break;
+               }
+               case TYPE_SAMPLE: {
+                       int subtype = *p & 0xf0;
+                       if (subtype == TYPE_SAMPLE_HIT) {
+                               int i;
+                               int sample_type;
+                               uint64_t tstamp;
+                               if (ctx->data_version > 12) {
+                                       uint64_t tdiff = decode_uleb128 (p + 1, &p);
+                                       LOG_TIME (time_base, tdiff);
+                                       time_base += tdiff;
+                                       sample_type = *p++;
+                                       tstamp = time_base;
+                               } else {
+                                       sample_type = decode_uleb128 (p + 1, &p);
+                                       tstamp = decode_uleb128 (p, &p);
+                               }
+                               void *tid = (void *) thread_id;
+                               if (ctx->data_version > 10)
+                                       tid = (void *) (ptr_base + decode_sleb128 (p, &p));
+                               int count = decode_uleb128 (p, &p);
+                               for (i = 0; i < count; ++i) {
+                                       uintptr_t ip = ptr_base + decode_sleb128 (p, &p);
+                                       if ((tstamp >= time_from && tstamp < time_to))
+                                               add_stat_sample (sample_type, ip);
+                                       if (debug)
+                                               fprintf (outfile, "sample hit, type: %d at %p for thread %p\n", sample_type, (void*)ip, tid);
+                               }
+                               if (ctx->data_version > 5) {
+                                       count = decode_uleb128 (p, &p);
+                                       for (i = 0; i < count; ++i) {
+                                               MethodDesc *method;
+                                               int64_t ptrdiff = decode_sleb128 (p, &p);
+                                               method_base += ptrdiff;
+                                               method = lookup_method (method_base);
+                                               if (debug)
+                                                       fprintf (outfile, "sample hit bt %d: %s\n", i, method->name);
+                                               if (ctx->data_version < 13) {
+                                                       decode_sleb128 (p, &p); /* il offset */
+                                                       decode_sleb128 (p, &p); /* native offset */
+                                               }
+                                       }
+                               }
+                       } else if (subtype == TYPE_SAMPLE_USYM) {
+                               /* un unmanaged symbol description */
+                               uintptr_t addr;
+                               if (ctx->data_version > 12) {
+                                       uint64_t tdiff = decode_uleb128 (p + 1, &p);
+                                       LOG_TIME (time_base, tdiff);
+                                       time_base += tdiff;
+                                       addr = ptr_base + decode_sleb128 (p, &p);
+                               } else
+                                       addr = ptr_base + decode_sleb128 (p + 1, &p);
+                               uintptr_t size = decode_uleb128 (p, &p);
+                               char *name;
+                               name = pstrdup ((char*)p);
+                               add_unmanaged_symbol (addr, name, size);
+                               if (debug)
+                                       fprintf (outfile, "unmanaged symbol %s at %p\n", name, (void*)addr);
+                               while (*p) p++;
+                               p++;
+                       } else if (subtype == TYPE_SAMPLE_UBIN) {
+                               /* un unmanaged binary loaded in memory */
+                               uint64_t tdiff = decode_uleb128 (p + 1, &p);
+                               uintptr_t addr = decode_sleb128 (p, &p);
+                               uint64_t offset G_GNUC_UNUSED = decode_uleb128 (p, &p);
+                               uintptr_t size = decode_uleb128 (p, &p);
+                               char *name;
+                               LOG_TIME (time_base, tdiff);
+                               time_base += tdiff;
+                               name = pstrdup ((char*)p);
+                               add_unmanaged_binary (addr, name, size);
+                               if (debug)
+                                       fprintf (outfile, "unmanaged binary %s at %p\n", name, (void*)addr);
+                               while (*p) p++;
+                               p++;
+                       } else if (subtype == TYPE_SAMPLE_COUNTERS_DESC) {
+                               uint64_t i, len;
+                               if (ctx->data_version > 12) {
+                                       uint64_t tdiff = decode_uleb128 (p + 1, &p);
+                                       LOG_TIME (time_base, tdiff);
+                                       time_base += tdiff;
+                                       len = decode_uleb128 (p, &p);
+                               } else
+                                       len = decode_uleb128 (p + 1, &p);
+                               for (i = 0; i < len; i++) {
+                                       uint64_t type, unit, variance, index;
+                                       uint64_t section = decode_uleb128 (p, &p);
+                                       char *section_str, *name;
+                                       if (section != MONO_COUNTER_PERFCOUNTERS) {
+                                               section_str = (char*) section_name (section);
+                                       } else {
+                                               section_str = pstrdup ((char*)p);
+                                               while (*p++);
+                                       }
+                                       name = pstrdup ((char*)p);
+                                       while (*p++);
+                                       if (ctx->data_version > 12) {
+                                               type = *p++;
+                                               unit = *p++;
+                                               variance = *p++;
+                                       } else {
+                                               type = decode_uleb128 (p, &p);
+                                               unit = decode_uleb128 (p, &p);
+                                               variance = decode_uleb128 (p, &p);
+                                       }
+                                       index = decode_uleb128 (p, &p);
+                                       add_counter (section_str, name, (int)type, (int)unit, (int)variance, (int)index);
+                               }
+                       } else if (subtype == TYPE_SAMPLE_COUNTERS) {
+                               int i;
+                               CounterValue *value, *previous = NULL;
+                               CounterList *list;
+                               uint64_t timestamp; // milliseconds since startup
+                               if (ctx->data_version > 12) {
+                                       uint64_t tdiff = decode_uleb128 (p + 1, &p);
+                                       LOG_TIME (time_base, tdiff);
+                                       time_base += tdiff;
+                                       timestamp = (time_base - startup_time) / 1000 / 1000;
+                               } else
+                                       timestamp = decode_uleb128 (p + 1, &p);
+                               uint64_t time_between = timestamp / 1000 * 1000 * 1000 * 1000 + startup_time;
+                               while (1) {
+                                       uint64_t type, index = decode_uleb128 (p, &p);
+                                       if (index == 0)
+                                               break;
+
+                                       for (list = counters; list; list = list->next) {
+                                               if (list->counter->index == (int)index) {
+                                                       previous = list->counter->values_last;
+                                                       break;
+                                               }
+                                       }
+
+                                       if (ctx->data_version > 12)
+                                               type = *p++;
+                                       else
+                                               type = decode_uleb128 (p, &p);
+
+                                       value = (CounterValue *) g_calloc (1, sizeof (CounterValue));
+                                       value->timestamp = timestamp;
+
+                                       switch (type) {
+                                       case MONO_COUNTER_INT:
+#if SIZEOF_VOID_P == 4
+                                       case MONO_COUNTER_WORD:
+#endif
+                                               value->buffer = (unsigned char *)g_malloc (sizeof (int32_t));
+                                               *(int32_t*)value->buffer = (int32_t)decode_sleb128 (p, &p) + (previous ? (*(int32_t*)previous->buffer) : 0);
+                                               break;
+                                       case MONO_COUNTER_UINT:
+                                               value->buffer = (unsigned char *) g_malloc (sizeof (uint32_t));
+                                               *(uint32_t*)value->buffer = (uint32_t)decode_uleb128 (p, &p) + (previous ? (*(uint32_t*)previous->buffer) : 0);
+                                               break;
+                                       case MONO_COUNTER_LONG:
+#if SIZEOF_VOID_P == 8
+                                       case MONO_COUNTER_WORD:
+#endif
+                                       case MONO_COUNTER_TIME_INTERVAL:
+                                               value->buffer = (unsigned char *) g_malloc (sizeof (int64_t));
+                                               *(int64_t*)value->buffer = (int64_t)decode_sleb128 (p, &p) + (previous ? (*(int64_t*)previous->buffer) : 0);
+                                               break;
+                                       case MONO_COUNTER_ULONG:
+                                               value->buffer = (unsigned char *) g_malloc (sizeof (uint64_t));
+                                               *(uint64_t*)value->buffer = (uint64_t)decode_uleb128 (p, &p) + (previous ? (*(uint64_t*)previous->buffer) : 0);
+                                               break;
+                                       case MONO_COUNTER_DOUBLE:
+                                               value->buffer = (unsigned char *) g_malloc (sizeof (double));
+#if TARGET_BYTE_ORDER == G_LITTLE_ENDIAN
+                                               for (i = 0; i < sizeof (double); i++)
+#else
+                                               for (i = sizeof (double) - 1; i >= 0; i--)
+#endif
+                                                       value->buffer[i] = *p++;
+                                               break;
+                                       case MONO_COUNTER_STRING:
+                                               if (*p++ == 0) {
+                                                       value->buffer = NULL;
+                                               } else {
+                                                       value->buffer = (unsigned char*) pstrdup ((char*)p);
+                                                       while (*p++);
+                                               }
+                                               break;
+                                       }
+                                       if (time_between >= time_from && time_between <= time_to)
+                                               add_counter_value (index, value);
+                               }
+                       } else {
+                               return 0;
+                       }
+                       break;
+               }
+               case TYPE_COVERAGE:{
+                       int subtype = *p & 0xf0;
+                       switch (subtype) {
+                       case TYPE_COVERAGE_METHOD: {
+                               CoverageMethod *method = g_new0 (CoverageMethod, 1);
+                               const char *assembly, *klass, *name, *sig, *filename;
+                               int token, n_offsets, method_id;
+
+                               p++;
+
+                               if (ctx->data_version > 12) {
+                                       uint64_t tdiff = decode_uleb128 (p, &p);
+                                       LOG_TIME (time_base, tdiff);
+                                       time_base += tdiff;
+                               }
+
+                               assembly = (const char *)p; while (*p) p++; p++;
+                               klass = (const char *)p; while (*p) p++; p++;
+                               name = (const char *)p; while (*p) p++; p++;
+                               sig = (const char *)p; while (*p) p++; p++;
+                               filename = (const char *)p; while (*p) p++; p++;
+
+                               token = decode_uleb128 (p, &p);
+                               method_id = decode_uleb128 (p, &p);
+                               n_offsets = decode_uleb128 (p, &p);
+
+                               method->assembly_name = g_strdup (assembly);
+                               method->class_name = g_strdup (klass);
+                               method->method_name = g_strdup (name);
+                               method->method_signature = g_strdup (sig);
+                               method->filename = g_strdup (filename);
+                               method->token = token;
+                               method->n_statements = n_offsets;
+                               method->coverage = g_ptr_array_new ();
+                               method->method_id = method_id;
+
+                               coverage_add_method (method);
+
+                               break;
+                       }
+                       case TYPE_COVERAGE_STATEMENT: {
+                               CoverageCoverage *coverage = g_new0 (CoverageCoverage, 1);
+                               int offset, count, line, column, method_id;
+
+                               p++;
+
+                               if (ctx->data_version > 12) {
+                                       uint64_t tdiff = decode_uleb128 (p, &p);
+                                       LOG_TIME (time_base, tdiff);
+                                       time_base += tdiff;
+                               }
+
+                               method_id = decode_uleb128 (p, &p);
+                               offset = decode_uleb128 (p, &p);
+                               count = decode_uleb128 (p, &p);
+                               line = decode_uleb128 (p, &p);
+                               column = decode_uleb128 (p, &p);
+
+                               coverage->method_id = method_id;
+                               coverage->offset = offset;
+                               coverage->count = count;
+                               coverage->line = line;
+                               coverage->column = column;
+
+                               coverage_add_coverage (coverage);
+                               break;
+                       }
+                       case TYPE_COVERAGE_ASSEMBLY: {
+                               CoverageAssembly *assembly = g_new0 (CoverageAssembly, 1);
+                               char *name, *guid, *filename;
+                               int number_of_methods, fully_covered, partially_covered;
+                               p++;
+
+                               if (ctx->data_version > 12) {
+                                       uint64_t tdiff = decode_uleb128 (p, &p);
+                                       LOG_TIME (time_base, tdiff);
+                                       time_base += tdiff;
+                               }
+
+                               name = (char *)p; while (*p) p++; p++;
+                               guid = (char *)p; while (*p) p++; p++;
+                               filename = (char *)p; while (*p) p++; p++;
+                               number_of_methods = decode_uleb128 (p, &p);
+                               fully_covered = decode_uleb128 (p, &p);
+                               partially_covered = decode_uleb128 (p, &p);
+
+                               assembly->name = g_strdup (name);
+                               assembly->guid = g_strdup (guid);
+                               assembly->filename = g_strdup (filename);
+                               assembly->number_of_methods = number_of_methods;
+                               assembly->fully_covered = fully_covered;
+                               assembly->partially_covered = partially_covered;
+
+                               coverage_add_assembly (assembly);
+                               break;
+                       }
+                       case TYPE_COVERAGE_CLASS: {
+                               CoverageClass *klass = g_new0 (CoverageClass, 1);
+                               char *assembly_name, *class_name;
+                               int number_of_methods, fully_covered, partially_covered;
+                               p++;
+
+                               if (ctx->data_version > 12) {
+                                       uint64_t tdiff = decode_uleb128 (p, &p);
+                                       LOG_TIME (time_base, tdiff);
+                                       time_base += tdiff;
+                               }
+
+                               assembly_name = (char *)p; while (*p) p++; p++;
+                               class_name = (char *)p; while (*p) p++; p++;
+                               number_of_methods = decode_uleb128 (p, &p);
+                               fully_covered = decode_uleb128 (p, &p);
+                               partially_covered = decode_uleb128 (p, &p);
+
+                               klass->assembly_name = g_strdup (assembly_name);
+                               klass->class_name = g_strdup (class_name);
+                               klass->number_of_methods = number_of_methods;
+                               klass->fully_covered = fully_covered;
+                               klass->partially_covered = partially_covered;
+
+                               coverage_add_class (klass);
+                               break;
+                       }
+
+                       default:
+                               break;
+                       }
+                       break;
+               }
+               case TYPE_META: {
+                       int subtype = *p & 0xf0;
+                       uint64_t tdiff = decode_uleb128 (p + 1, &p);
+                       LOG_TIME (time_base, tdiff);
+                       time_base += tdiff;
+                       if (subtype == TYPE_SYNC_POINT) {
+                               int type = *p++;
+                               if (debug)
+                                       fprintf (outfile, "sync point %i (%s)\n", type, sync_point_name (type));
+                       }
+                       break;
+               }
+               default:
+                       fprintf (outfile, "unhandled profiler event: 0x%x at file offset: %llu + %lld (len: %d\n)\n", *p, (unsigned long long) file_offset, (long long) (p - ctx->buf), len);
+                       exit (1);
+               }
+               record_event_stats (event, p - start);
+       }
+       thread->last_time = time_base;
+       for (i = 0; i < thread->stack_id; ++i)
+               thread->stack [i]->recurse_count = 0;
+       return 1;
+}
+
+static int
+read_header_string (ProfContext *ctx, char **field)
+{
+       if (!load_data (ctx, 4))
+               return 0;
+
+       if (!load_data (ctx, read_int32 (ctx->buf)))
+               return 0;
+
+       *field = pstrdup ((const char *) ctx->buf);
+
+       return 1;
+}
+
+static ProfContext*
+load_file (char *name)
+{
+       unsigned char *p;
+       ProfContext *ctx = (ProfContext *) g_calloc (sizeof (ProfContext), 1);
+       if (strcmp (name, "-") == 0)
+               ctx->file = stdin;
+       else
+               ctx->file = fopen (name, "rb");
+       if (!ctx->file) {
+               printf ("Cannot open file: %s\n", name);
+               exit (1);
+       }
+#if defined (HAVE_SYS_ZLIB)
+       if (ctx->file != stdin)
+               ctx->gzfile = gzdopen (fileno (ctx->file), "rb");
+#endif
+       if (!load_data (ctx, 30))
+               return NULL;
+       p = ctx->buf;
+       if (read_int32 (p) != LOG_HEADER_ID || p [6] > LOG_DATA_VERSION)
+               return NULL;
+       ctx->version_major = p [4];
+       ctx->version_minor = p [5];
+       ctx->data_version = p [6];
+       /* reading 64 bit files on 32 bit systems not supported yet */
+       if (p [7] > sizeof (void*))
+               return NULL;
+       if (read_int32 (p + 20)) /* flags must be 0 */
+               return NULL;
+       ctx->startup_time = read_int64 (p + 8);
+       ctx->timer_overhead = read_int32 (p + 16);
+       ctx->pid = read_int32 (p + 24);
+       ctx->port = read_int16 (p + 28);
+       if (ctx->version_major >= 1) {
+               if (!read_header_string (ctx, &ctx->args))
+                       return NULL;
+               if (!read_header_string (ctx, &ctx->arch))
+                       return NULL;
+               if (!read_header_string (ctx, &ctx->os))
+                       return NULL;
+       } else {
+               if (!load_data (ctx, 2)) /* old opsys field, was never used */
+                       return NULL;
+       }
+       return ctx;
+}
+
+enum {
+       ALLOC_SORT_BYTES,
+       ALLOC_SORT_COUNT
+};
+static int alloc_sort_mode = ALLOC_SORT_BYTES;
+
+static int
+compare_class (const void *a, const void *b)
+{
+       ClassDesc *const *A = (ClassDesc *const *)a;
+       ClassDesc *const *B = (ClassDesc *const *)b;
+       uint64_t vala, valb;
+       if (alloc_sort_mode == ALLOC_SORT_BYTES) {
+               vala = (*A)->alloc_size;
+               valb = (*B)->alloc_size;
+       } else {
+               vala = (*A)->allocs;
+               valb = (*B)->allocs;
+       }
+       if (valb == vala)
+               return 0;
+       if (valb < vala)
+               return -1;
+       return 1;
+}
+
+static void
+dump_header (ProfContext *ctx)
+{
+       time_t st = ctx->startup_time / 1000;
+       char *t = ctime (&st);
+       fprintf (outfile, "\nMono log profiler data\n");
+       fprintf (outfile, "\tProfiler version: %d.%d\n", ctx->version_major, ctx->version_minor);
+       fprintf (outfile, "\tData version: %d\n", ctx->data_version);
+       if (ctx->version_major >= 1) {
+               fprintf (outfile, "\tArguments: %s\n", ctx->args);
+               fprintf (outfile, "\tArchitecture: %s\n", ctx->arch);
+               fprintf (outfile, "\tOperating system: %s\n", ctx->os);
+       }
+       fprintf (outfile, "\tMean timer overhead: %d nanoseconds\n", ctx->timer_overhead);
+       fprintf (outfile, "\tProgram startup: %s", t);
+       if (ctx->pid)
+               fprintf (outfile, "\tProgram ID: %d\n", ctx->pid);
+       if (ctx->port)
+               fprintf (outfile, "\tServer listening on: %d\n", ctx->port);
+}
+
+static void
+dump_traces (TraceDesc *traces, const char *desc)
+{
+       int j;
+       if (!show_traces)
+               return;
+       if (!traces->count)
+               return;
+       sort_context_array (traces);
+       for (j = 0; j < traces->count; ++j) {
+               int k;
+               BackTrace *bt;
+               bt = traces->traces [j].bt;
+               if (!bt->count)
+                       continue;
+               fprintf (outfile, "\t%llu %s from:\n", (unsigned long long) traces->traces [j].count, desc);
+               for (k = 0; k < bt->count; ++k)
+                       fprintf (outfile, "\t\t%s\n", bt->methods [k]->name);
+       }
+}
+
+static void
+dump_threads (ProfContext *ctx)
+{
+       ThreadContext *thread;
+       fprintf (outfile, "\nThread summary\n");
+       for (thread = ctx->threads; thread; thread = thread->next) {
+               if (thread->thread_id) {
+                       fprintf (outfile, "\tThread: %p, name: \"%s\"\n", (void*)thread->thread_id, thread->name? thread->name: "");
+               }
+       }
+}
+
+static void
+dump_domains (ProfContext *ctx)
+{
+       fprintf (outfile, "\nDomain summary\n");
+
+       for (DomainContext *domain = ctx->domains; domain; domain = domain->next)
+               fprintf (outfile, "\tDomain: %p, friendly name: \"%s\"\n", (void *) domain->domain_id, domain->friendly_name);
+}
+
+static void
+dump_remctxs (ProfContext *ctx)
+{
+       fprintf (outfile, "\nContext summary\n");
+
+       for (RemCtxContext *remctx = ctx->remctxs; remctx; remctx = remctx->next)
+               fprintf (outfile, "\tContext: %p, domain: %p\n", (void *) remctx->remctx_id, (void *) remctx->domain_id);
+}
+
+static void
+dump_exceptions (void)
+{
+       int i;
+       fprintf (outfile, "\nException summary\n");
+       fprintf (outfile, "\tThrows: %llu\n", (unsigned long long) throw_count);
+       dump_traces (&exc_traces, "throws");
+       for (i = 0; i <= MONO_EXCEPTION_CLAUSE_FAULT; ++i) {
+               if (!clause_summary [i])
+                       continue;
+               fprintf (outfile, "\tExecuted %s clauses: %llu\n", clause_name (i), (unsigned long long) clause_summary [i]);
+       }
+}
+
+static int
+compare_monitor (const void *a, const void *b)
+{
+       MonitorDesc *const *A = (MonitorDesc *const *)a;
+       MonitorDesc *const *B = (MonitorDesc *const *)b;
+       if ((*B)->wait_time == (*A)->wait_time)
+               return 0;
+       if ((*B)->wait_time < (*A)->wait_time)
+               return -1;
+       return 1;
+}
+
+static void
+dump_monitors (void)
+{
+       MonitorDesc **monitors;
+       int i, j;
+       if (!num_monitors)
+               return;
+       monitors = (MonitorDesc **) g_malloc (sizeof (void*) * num_monitors);
+       for (i = 0, j = 0; i < SMALL_HASH_SIZE; ++i) {
+               MonitorDesc *mdesc = monitor_hash [i];
+               while (mdesc) {
+                       monitors [j++] = mdesc;
+                       mdesc = mdesc->next;
+               }
+       }
+       qsort (monitors, num_monitors, sizeof (void*), compare_monitor);
+       fprintf (outfile, "\nMonitor lock summary\n");
+       for (i = 0; i < num_monitors; ++i) {
+               MonitorDesc *mdesc = monitors [i];
+               fprintf (outfile, "\tLock object %p: %d contentions\n", (void*)mdesc->objid, (int)mdesc->contentions);
+               fprintf (outfile, "\t\t%.6f secs total wait time, %.6f max, %.6f average\n",
+                       mdesc->wait_time/1000000000.0, mdesc->max_wait_time/1000000000.0, mdesc->wait_time/1000000000.0/mdesc->contentions);
+               dump_traces (&mdesc->traces, "contentions");
+       }
+       fprintf (outfile, "\tLock contentions: %llu\n", (unsigned long long) monitor_contention);
+       fprintf (outfile, "\tLock acquired: %llu\n", (unsigned long long) monitor_acquired);
+       fprintf (outfile, "\tLock failures: %llu\n", (unsigned long long) monitor_failed);
+}
+
+static void
+dump_gcs (void)
+{
+       int i;
+       fprintf (outfile, "\nGC summary\n");
+       fprintf (outfile, "\tGC resizes: %d\n", gc_resizes);
+       fprintf (outfile, "\tMax heap size: %llu\n", (unsigned long long) max_heap_size);
+       fprintf (outfile, "\tObject moves: %llu\n", (unsigned long long) gc_object_moves);
+       for (i = 0; i < 3; ++i) {
+               if (!gc_info [i].count)
+                       continue;
+               fprintf (outfile, "\tGen%d collections: %d, max time: %lluus, total time: %lluus, average: %lluus\n",
+                       i, gc_info [i].count,
+                       (unsigned long long) (gc_info [i].max_time / 1000),
+                       (unsigned long long) (gc_info [i].total_time / 1000),
+                       (unsigned long long) (gc_info [i].total_time / gc_info [i].count / 1000));
+       }
+       for (i = 0; i < 3; ++i) {
+               if (!handle_info [i].max_live)
+                       continue;
+               fprintf (outfile, "\tGC handles %s: created: %llu, destroyed: %llu, max: %llu\n",
+                       get_handle_name (i),
+                       (unsigned long long) (handle_info [i].created),
+                       (unsigned long long) (handle_info [i].destroyed),
+                       (unsigned long long) (handle_info [i].max_live));
+               dump_traces (&handle_info [i].traces, "created");
+               dump_traces (&handle_info [i].destroy_traces, "destroyed");
+       }
+}
+
+static void
+dump_jit (void)
+{
+       int i;
+       int code_size = 0;
+       int compiled_methods = 0;
+       MethodDesc* m;
+       fprintf (outfile, "\nJIT summary\n");
+       for (i = 0; i < HASH_SIZE; ++i) {
+               m = method_hash [i];
+               for (m = method_hash [i]; m; m = m->next) {
+                       if (!m->code || m->ignore_jit)
+                               continue;
+                       compiled_methods++;
+                       code_size += m->len;
+               }
+       }
+       fprintf (outfile, "\tCompiled methods: %d\n", compiled_methods);
+       fprintf (outfile, "\tGenerated code size: %d\n", code_size);
+       fprintf (outfile, "\tJIT helpers: %d\n", num_jit_helpers);
+       fprintf (outfile, "\tJIT helpers code size: %d\n", jit_helpers_code_size);
+}
+
+static void
+dump_allocations (void)
+{
+       int i, c;
+       intptr_t allocs = 0;
+       uint64_t size = 0;
+       int header_done = 0;
+       ClassDesc **classes = (ClassDesc **) g_malloc (num_classes * sizeof (void*));
+       ClassDesc *cd;
+       c = 0;
+       for (i = 0; i < HASH_SIZE; ++i) {
+               cd = class_hash [i];
+               while (cd) {
+                       classes [c++] = cd;
+                       cd = cd->next;
+               }
+       }
+       qsort (classes, num_classes, sizeof (void*), compare_class);
+       for (i = 0; i < num_classes; ++i) {
+               cd = classes [i];
+               if (!cd->allocs)
+                       continue;
+               allocs += cd->allocs;
+               size += cd->alloc_size;
+               if (!header_done++) {
+                       fprintf (outfile, "\nAllocation summary\n");
+                       fprintf (outfile, "%10s %10s %8s Type name\n", "Bytes", "Count", "Average");
+               }
+               fprintf (outfile, "%10llu %10zd %8llu %s\n",
+                       (unsigned long long) (cd->alloc_size),
+                       cd->allocs,
+                       (unsigned long long) (cd->alloc_size / cd->allocs),
+                       cd->name);
+               dump_traces (&cd->traces, "bytes");
+       }
+       if (allocs)
+               fprintf (outfile, "Total memory allocated: %llu bytes in %zd objects\n", (unsigned long long) size, allocs);
+}
+
+enum {
+       METHOD_SORT_TOTAL,
+       METHOD_SORT_SELF,
+       METHOD_SORT_CALLS
+};
+
+static int method_sort_mode = METHOD_SORT_TOTAL;
+
+static int
+compare_method (const void *a, const void *b)
+{
+       MethodDesc *const *A = (MethodDesc *const *)a;
+       MethodDesc *const *B = (MethodDesc *const *)b;
+       uint64_t vala, valb;
+       if (method_sort_mode == METHOD_SORT_SELF) {
+               vala = (*A)->self_time;
+               valb = (*B)->self_time;
+       } else if (method_sort_mode == METHOD_SORT_CALLS) {
+               vala = (*A)->calls;
+               valb = (*B)->calls;
+       } else {
+               vala = (*A)->total_time;
+               valb = (*B)->total_time;
+       }
+       if (vala == valb)
+               return 0;
+       if (valb < vala)
+               return -1;
+       return 1;
+}
+
+static void
+dump_metadata (void)
+{
+       fprintf (outfile, "\nMetadata summary\n");
+       fprintf (outfile, "\tLoaded images: %d\n", num_images);
+       if (verbose) {
+               ImageDesc *image;
+               int i;
+               for (i = 0; i < SMALL_HASH_SIZE; ++i) {
+                       image = image_hash [i];
+                       while (image) {
+                               fprintf (outfile, "\t\t%s\n", image->filename);
+                               image = image->next;
+                       }
+               }
+       }
+       fprintf (outfile, "\tLoaded assemblies: %d\n", num_assemblies);
+       if (verbose) {
+               AssemblyDesc *assembly;
+               int i;
+               for (i = 0; i < SMALL_HASH_SIZE; ++i) {
+                       assembly = assembly_hash [i];
+                       while (assembly) {
+                               fprintf (outfile, "\t\t%s\n", assembly->asmname);
+                               assembly = assembly->next;
+                       }
+               }
+       }
+}
+
+static void
+dump_methods (void)
+{
+       int i, c;
+       uint64_t calls = 0;
+       int header_done = 0;
+       MethodDesc **methods = (MethodDesc **) g_malloc (num_methods * sizeof (void*));
+       MethodDesc *cd;
+       c = 0;
+       for (i = 0; i < HASH_SIZE; ++i) {
+               cd = method_hash [i];
+               while (cd) {
+                       cd->total_time = cd->self_time + cd->callee_time;
+                       methods [c++] = cd;
+                       cd = cd->next;
+               }
+       }
+       qsort (methods, num_methods, sizeof (void*), compare_method);
+       for (i = 0; i < num_methods; ++i) {
+               uint64_t msecs;
+               uint64_t smsecs;
+               cd = methods [i];
+               if (!cd->calls)
+                       continue;
+               calls += cd->calls;
+               msecs = cd->total_time / 1000000;
+               smsecs = (cd->total_time - cd->callee_time) / 1000000;
+               if (!msecs && !verbose)
+                       continue;
+               if (!header_done++) {
+                       fprintf (outfile, "\nMethod call summary\n");
+                       fprintf (outfile, "%8s %8s %10s Method name\n", "Total(ms)", "Self(ms)", "Calls");
+               }
+               fprintf (outfile, "%8llu %8llu %10llu %s\n",
+                       (unsigned long long) (msecs),
+                       (unsigned long long) (smsecs),
+                       (unsigned long long) (cd->calls),
+                       cd->name);
+               dump_traces (&cd->traces, "calls");
+       }
+       if (calls)
+               fprintf (outfile, "Total calls: %llu\n", (unsigned long long) calls);
+}
+
+static int
+compare_heap_class (const void *a, const void *b)
+{
+       HeapClassDesc *const *A = (HeapClassDesc *const *)a;
+       HeapClassDesc *const *B = (HeapClassDesc *const *)b;
+       uint64_t vala, valb;
+       if (alloc_sort_mode == ALLOC_SORT_BYTES) {
+               vala = (*A)->total_size;
+               valb = (*B)->total_size;
+       } else {
+               vala = (*A)->count;
+               valb = (*B)->count;
+       }
+       if (valb == vala)
+               return 0;
+       if (valb < vala)
+               return -1;
+       return 1;
+}
+
+static int
+compare_rev_class (const void *a, const void *b)
+{
+       const HeapClassRevRef *A = (const HeapClassRevRef *)a;
+       const HeapClassRevRef *B = (const HeapClassRevRef *)b;
+       if (B->count == A->count)
+               return 0;
+       if (B->count < A->count)
+               return -1;
+       return 1;
+}
+
+static void
+dump_rev_claases (HeapClassRevRef *revs, int count)
+{
+       int j;
+       if (!show_traces)
+               return;
+       if (!count)
+               return;
+       for (j = 0; j < count; ++j) {
+               HeapClassDesc *cd = revs [j].klass;
+               fprintf (outfile, "\t\t%llu references from: %s\n",
+                       (unsigned long long) (revs [j].count),
+                       cd->klass->name);
+       }
+}
+
+static void
+heap_shot_summary (HeapShot *hs, int hs_num, HeapShot *last_hs)
+{
+       uint64_t size = 0;
+       uint64_t count = 0;
+       int ccount = 0;
+       int i;
+       HeapClassDesc *cd;
+       HeapClassDesc **sorted;
+       sorted = (HeapClassDesc **) g_malloc (sizeof (void*) * hs->class_count);
+       for (i = 0; i < hs->hash_size; ++i) {
+               cd = hs->class_hash [i];
+               if (!cd)
+                       continue;
+               count += cd->count;
+               size += cd->total_size;
+               sorted [ccount++] = cd;
+       }
+       hs->sorted = sorted;
+       qsort (sorted, ccount, sizeof (void*), compare_heap_class);
+       fprintf (outfile, "\n\tHeap shot %d at %.3f secs: size: %llu, object count: %llu, class count: %d, roots: %zd\n",
+               hs_num,
+               (hs->timestamp - startup_time)/1000000000.0,
+               (unsigned long long) (size),
+               (unsigned long long) (count),
+               ccount, hs->num_roots);
+       if (!verbose && ccount > 30)
+               ccount = 30;
+       fprintf (outfile, "\t%10s %10s %8s Class name\n", "Bytes", "Count", "Average");
+       for (i = 0; i < ccount; ++i) {
+               HeapClassRevRef *rev_sorted;
+               int j, k;
+               HeapClassDesc *ocd = NULL;
+               cd = sorted [i];
+               if (last_hs)
+                       ocd = heap_class_lookup (last_hs, cd->klass);
+               fprintf (outfile, "\t%10llu %10llu %8llu %s",
+                       (unsigned long long) (cd->total_size),
+                       (unsigned long long) (cd->count),
+                       (unsigned long long) (cd->total_size / cd->count),
+                       cd->klass->name);
+               if (ocd) {
+                       int64_t bdiff = cd->total_size - ocd->total_size;
+                       int64_t cdiff = cd->count - ocd->count;
+                       fprintf (outfile, " (bytes: %+lld, count: %+lld)\n", (long long) bdiff, (long long) cdiff);
+               } else {
+                       fprintf (outfile, "\n");
+               }
+               if (!collect_traces)
+                       continue;
+               rev_sorted = (HeapClassRevRef *) g_malloc (cd->rev_count * sizeof (HeapClassRevRef));
+               k = 0;
+               for (j = 0; j < cd->rev_hash_size; ++j) {
+                       if (cd->rev_hash [j].klass)
+                               rev_sorted [k++] = cd->rev_hash [j];
+               }
+               assert (cd->rev_count == k);
+               qsort (rev_sorted, cd->rev_count, sizeof (HeapClassRevRef), compare_rev_class);
+               if (cd->root_references)
+                       fprintf (outfile, "\t\t%zd root references (%zd pinning)\n", cd->root_references, cd->pinned_references);
+               dump_rev_claases (rev_sorted, cd->rev_count);
+               g_free (rev_sorted);
+       }
+       g_free (sorted);
+}
+
+static int
+compare_heap_shots (const void *a, const void *b)
+{
+       HeapShot *const *A = (HeapShot *const *)a;
+       HeapShot *const *B = (HeapShot *const *)b;
+       if ((*B)->timestamp == (*A)->timestamp)
+               return 0;
+       if ((*B)->timestamp > (*A)->timestamp)
+               return -1;
+       return 1;
+}
+
+static void
+dump_heap_shots (void)
+{
+       HeapShot **hs_sorted;
+       HeapShot *hs;
+       HeapShot *last_hs = NULL;
+       int i;
+       if (!heap_shots)
+               return;
+       hs_sorted = (HeapShot **) g_malloc (num_heap_shots * sizeof (void*));
+       fprintf (outfile, "\nHeap shot summary\n");
+       i = 0;
+       for (hs = heap_shots; hs; hs = hs->next)
+               hs_sorted [i++] = hs;
+       qsort (hs_sorted, num_heap_shots, sizeof (void*), compare_heap_shots);
+       for (i = 0; i < num_heap_shots; ++i) {
+               hs = hs_sorted [i];
+               heap_shot_summary (hs, i, last_hs);
+               last_hs = hs;
+       }
+}
+
+/* This is a very basic escape function that escapes < > and &
+   Ideally we'd use g_markup_escape_string but that function isn't
+        available in Mono's eglib. This was written without looking at the
+        source of that function in glib. */
+static char *
+escape_string_for_xml (const char *string)
+{
+       GString *string_builder = g_string_new (NULL);
+       const char *start, *p;
+
+       start = p = string;
+       while (*p) {
+               while (*p && *p != '&' && *p != '<' && *p != '>')
+                       p++;
+
+               g_string_append_len (string_builder, start, p - start);
+
+               if (*p == '\0')
+                       break;
+
+               switch (*p) {
+               case '<':
+                       g_string_append (string_builder, "&lt;");
+                       break;
+
+               case '>':
+                       g_string_append (string_builder, "&gt;");
+                       break;
+
+               case '&':
+                       g_string_append (string_builder, "&amp;");
+                       break;
+
+               default:
+                       break;
+               }
+
+               p++;
+               start = p;
+       }
+
+       return g_string_free (string_builder, FALSE);
+}
+
+static int
+sort_assemblies (gconstpointer a, gconstpointer b)
+{
+       CoverageAssembly *assembly_a = *(CoverageAssembly **)a;
+       CoverageAssembly *assembly_b = *(CoverageAssembly **)b;
+
+       if (assembly_a->name == NULL && assembly_b->name == NULL)
+               return 0;
+       else if (assembly_a->name == NULL)
+               return -1;
+       else if (assembly_b->name == NULL)
+               return 1;
+
+       return strcmp (assembly_a->name, assembly_b->name);
+}
+
+static void
+dump_coverage (void)
+{
+       if (!coverage_methods && !coverage_assemblies)
+               return;
+
+       gather_coverage_statements ();
+       fprintf (outfile, "\nCoverage Summary:\n");
+
+       if (coverage_outfile) {
+               fprintf (coverage_outfile, "<?xml version=\"1.0\"?>\n");
+               fprintf (coverage_outfile, "<coverage version=\"0.3\">\n");
+       }
+
+       g_ptr_array_sort (coverage_assemblies, sort_assemblies);
+
+       for (guint i = 0; i < coverage_assemblies->len; i++) {
+               CoverageAssembly *assembly = (CoverageAssembly *)coverage_assemblies->pdata[i];
+               GPtrArray *classes;
+
+               if (assembly->number_of_methods != 0) {
+                       int percentage = ((assembly->fully_covered + assembly->partially_covered) * 100) / assembly->number_of_methods;
+                       fprintf (outfile, "\t%s (%s) %d%% covered (%d methods - %d covered)\n", assembly->name, assembly->filename, percentage, assembly->number_of_methods, assembly->fully_covered);
+               } else
+                       fprintf (outfile, "\t%s (%s) ?%% covered (%d methods - %d covered)\n", assembly->name, assembly->filename, assembly->number_of_methods, assembly->fully_covered);
+
+               if (coverage_outfile) {
+                       char *escaped_name, *escaped_filename;
+                       escaped_name = escape_string_for_xml (assembly->name);
+                       escaped_filename = escape_string_for_xml (assembly->filename);
+
+                       fprintf (coverage_outfile, "\t<assembly name=\"%s\" guid=\"%s\" filename=\"%s\" method-count=\"%d\" full=\"%d\" partial=\"%d\"/>\n", escaped_name, assembly->guid, escaped_filename, assembly->number_of_methods, assembly->fully_covered, assembly->partially_covered);
+
+                       g_free (escaped_name);
+                       g_free (escaped_filename);
+               }
+
+               classes = (GPtrArray *)g_hash_table_lookup (coverage_assembly_classes, assembly->name);
+               if (classes) {
+                       for (guint j = 0; j < classes->len; j++) {
+                               CoverageClass *klass = (CoverageClass *)classes->pdata [j];
+
+                               if (klass->number_of_methods > 0) {
+                                       int percentage = ((klass->fully_covered + klass->partially_covered) * 100) / klass->number_of_methods;
+                                       fprintf (outfile, "\t\t%s %d%% covered (%d methods - %d covered)\n", klass->class_name, percentage, klass->number_of_methods, klass->fully_covered);
+                               } else
+                                       fprintf (outfile, "\t\t%s ?%% covered (%d methods - %d covered)\n", klass->class_name, klass->number_of_methods, klass->fully_covered);
+
+                               if (coverage_outfile) {
+                                       char *escaped_name;
+                                       escaped_name = escape_string_for_xml (klass->class_name);
+
+                                       fprintf (coverage_outfile, "\t\t<class name=\"%s\" method-count=\"%d\" full=\"%d\" partial=\"%d\"/>\n", escaped_name, klass->number_of_methods, klass->fully_covered, klass->partially_covered);
+                                       g_free (escaped_name);
+                               }
+                       }
+               }
+       }
+
+       for (guint i = 0; i < coverage_methods->len; i++) {
+               CoverageMethod *method = (CoverageMethod *)coverage_methods->pdata [i];
+
+               if (coverage_outfile) {
+                       char *escaped_assembly, *escaped_class, *escaped_method, *escaped_sig, *escaped_filename;
+
+                       escaped_assembly = escape_string_for_xml (method->assembly_name);
+                       escaped_class = escape_string_for_xml (method->class_name);
+                       escaped_method = escape_string_for_xml (method->method_name);
+                       escaped_sig = escape_string_for_xml (method->method_signature);
+                       escaped_filename = escape_string_for_xml (method->filename);
+
+                       fprintf (coverage_outfile, "\t<method assembly=\"%s\" class=\"%s\" name=\"%s (%s)\" filename=\"%s\" token=\"%d\">\n", escaped_assembly, escaped_class, escaped_method, escaped_sig, escaped_filename, method->token);
+
+                       g_free (escaped_assembly);
+                       g_free (escaped_class);
+                       g_free (escaped_method);
+                       g_free (escaped_sig);
+                       g_free (escaped_filename);
+
+                       for (guint j = 0; j < method->coverage->len; j++) {
+                               CoverageCoverage *coverage = (CoverageCoverage *)method->coverage->pdata [j];
+                               fprintf (coverage_outfile, "\t\t<statement offset=\"%d\" counter=\"%d\" line=\"%d\" column=\"%d\"/>\n", coverage->offset, coverage->count, coverage->line, coverage->column);
+                       }
+                       fprintf (coverage_outfile, "\t</method>\n");
+               }
+       }
+
+       if (coverage_outfile) {
+               fprintf (coverage_outfile, "</coverage>\n");
+               fclose (coverage_outfile);
+               coverage_outfile = NULL;
+       }
+}
+
+#define DUMP_EVENT_STAT(EVENT,SUBTYPE) dump_event (#EVENT, #SUBTYPE, EVENT, SUBTYPE);
+
+static void
+dump_event (const char *event_name, const char *subtype_name, int event, int subtype)
+{
+       int idx = event | subtype;
+       EventStat evt = stats [idx];
+       if (!evt.count)
+               return;
+
+       fprintf (outfile, "\t%16s\t%26s\tcount %6d\tmin %3d\tmax %6d\tbytes %d\n", event_name, subtype_name, evt.count, evt.min_size, evt.max_size, evt.bytes);
+}
+
+static void
+dump_stats (void)
+{
+       fprintf (outfile, "\nMlpd statistics\n");
+       fprintf (outfile, "\tBuffer count %d\toverhead %d (%d bytes per header)\n", buffer_count, buffer_count * BUFFER_HEADER_SIZE, BUFFER_HEADER_SIZE);
+       fprintf (outfile, "\nEvent details:\n");
+
+       DUMP_EVENT_STAT (TYPE_ALLOC, TYPE_ALLOC_NO_BT);
+       DUMP_EVENT_STAT (TYPE_ALLOC, TYPE_ALLOC_BT);
+
+       DUMP_EVENT_STAT (TYPE_GC, TYPE_GC_EVENT);
+       DUMP_EVENT_STAT (TYPE_GC, TYPE_GC_RESIZE);
+       DUMP_EVENT_STAT (TYPE_GC, TYPE_GC_MOVE);
+       DUMP_EVENT_STAT (TYPE_GC, TYPE_GC_HANDLE_CREATED);
+       DUMP_EVENT_STAT (TYPE_GC, TYPE_GC_HANDLE_DESTROYED);
+       DUMP_EVENT_STAT (TYPE_GC, TYPE_GC_HANDLE_CREATED_BT);
+       DUMP_EVENT_STAT (TYPE_GC, TYPE_GC_HANDLE_DESTROYED_BT);
+
+       DUMP_EVENT_STAT (TYPE_METADATA, TYPE_END_LOAD);
+       DUMP_EVENT_STAT (TYPE_METADATA, TYPE_END_UNLOAD);
+
+       DUMP_EVENT_STAT (TYPE_METHOD, TYPE_LEAVE);
+       DUMP_EVENT_STAT (TYPE_METHOD, TYPE_ENTER);
+       DUMP_EVENT_STAT (TYPE_METHOD, TYPE_EXC_LEAVE);
+       DUMP_EVENT_STAT (TYPE_METHOD, TYPE_JIT);
+
+       DUMP_EVENT_STAT (TYPE_EXCEPTION, TYPE_THROW_NO_BT);
+       DUMP_EVENT_STAT (TYPE_EXCEPTION, TYPE_THROW_BT);
+       DUMP_EVENT_STAT (TYPE_EXCEPTION, TYPE_CLAUSE);
+
+       DUMP_EVENT_STAT (TYPE_MONITOR, TYPE_MONITOR_NO_BT);
+       DUMP_EVENT_STAT (TYPE_MONITOR, TYPE_MONITOR_BT);
+
+       DUMP_EVENT_STAT (TYPE_HEAP, TYPE_HEAP_START);
+       DUMP_EVENT_STAT (TYPE_HEAP, TYPE_HEAP_END);
+       DUMP_EVENT_STAT (TYPE_HEAP, TYPE_HEAP_OBJECT);
+       DUMP_EVENT_STAT (TYPE_HEAP, TYPE_HEAP_ROOT);
+
+       DUMP_EVENT_STAT (TYPE_SAMPLE, TYPE_SAMPLE_HIT);
+       DUMP_EVENT_STAT (TYPE_SAMPLE, TYPE_SAMPLE_USYM);
+       DUMP_EVENT_STAT (TYPE_SAMPLE, TYPE_SAMPLE_UBIN);
+       DUMP_EVENT_STAT (TYPE_SAMPLE, TYPE_SAMPLE_COUNTERS_DESC);
+       DUMP_EVENT_STAT (TYPE_SAMPLE, TYPE_SAMPLE_COUNTERS);
+
+       DUMP_EVENT_STAT (TYPE_RUNTIME, TYPE_JITHELPER);
+
+       DUMP_EVENT_STAT (TYPE_COVERAGE, TYPE_COVERAGE_ASSEMBLY);
+       DUMP_EVENT_STAT (TYPE_COVERAGE, TYPE_COVERAGE_METHOD);
+       DUMP_EVENT_STAT (TYPE_COVERAGE, TYPE_COVERAGE_STATEMENT);
+       DUMP_EVENT_STAT (TYPE_COVERAGE, TYPE_COVERAGE_CLASS);
+
+       DUMP_EVENT_STAT (TYPE_META, TYPE_SYNC_POINT);
+}
+
+
+
+static void
+flush_context (ProfContext *ctx)
+{
+       ThreadContext *thread;
+       /* FIXME: sometimes there are leftovers: indagate */
+       for (thread = ctx->threads; thread; thread = thread->next) {
+               while (thread->stack_id) {
+                       if (debug)
+                               fprintf (outfile, "thread %p has %d items on stack\n", (void*)thread->thread_id, thread->stack_id);
+                       pop_method (thread, thread->stack [thread->stack_id - 1], thread->last_time);
+               }
+       }
+}
+
+static const char *reports = "header,jit,gc,sample,alloc,call,metadata,exception,monitor,thread,heapshot,counters,coverage";
+
+static const char*
+match_option (const char *p, const char *opt)
+{
+       int len = strlen (opt);
+       if (strncmp (p, opt, len) == 0) {
+               if (p [len] == ',')
+                       len++;
+               return p + len;
+       }
+       return p;
+}
+
+static int
+print_reports (ProfContext *ctx, const char *reps, int parse_only)
+{
+       const char *opt;
+       const char *p;
+       for (p = reps; *p; p = opt) {
+               if ((opt = match_option (p, "header")) != p) {
+                       if (!parse_only)
+                               dump_header (ctx);
+                       continue;
+               }
+               if ((opt = match_option (p, "thread")) != p) {
+                       if (!parse_only)
+                               dump_threads (ctx);
+                       continue;
+               }
+               if ((opt = match_option (p, "domain")) != p) {
+                       if (!parse_only)
+                               dump_domains (ctx);
+                       continue;
+               }
+               if ((opt = match_option (p, "context")) != p) {
+                       if (!parse_only)
+                               dump_remctxs (ctx);
+                       continue;
+               }
+               if ((opt = match_option (p, "gc")) != p) {
+                       if (!parse_only)
+                               dump_gcs ();
+                       continue;
+               }
+               if ((opt = match_option (p, "jit")) != p) {
+                       if (!parse_only)
+                               dump_jit ();
+                       continue;
+               }
+               if ((opt = match_option (p, "alloc")) != p) {
+                       if (!parse_only)
+                               dump_allocations ();
+                       continue;
+               }
+               if ((opt = match_option (p, "call")) != p) {
+                       if (!parse_only)
+                               dump_methods ();
+                       continue;
+               }
+               if ((opt = match_option (p, "metadata")) != p) {
+                       if (!parse_only)
+                               dump_metadata ();
+                       continue;
+               }
+               if ((opt = match_option (p, "exception")) != p) {
+                       if (!parse_only)
+                               dump_exceptions ();
+                       continue;
+               }
+               if ((opt = match_option (p, "monitor")) != p) {
+                       if (!parse_only)
+                               dump_monitors ();
+                       continue;
+               }
+               if ((opt = match_option (p, "heapshot")) != p) {
+                       if (!parse_only)
+                               dump_heap_shots ();
+                       continue;
+               }
+               if ((opt = match_option (p, "sample")) != p) {
+                       if (!parse_only)
+                               dump_samples ();
+                       continue;
+               }
+               if ((opt = match_option (p, "counters")) != p) {
+                       if (!parse_only)
+                               dump_counters ();
+                       continue;
+               }
+               if ((opt = match_option (p, "coverage")) != p) {
+                       if (!parse_only)
+                               dump_coverage ();
+                       continue;
+               }
+               if ((opt = match_option (p, "stats")) != p) {
+                       if (!parse_only)
+                               dump_stats ();
+                       continue;
+               }
+               return 0;
+       }
+       return 1;
+}
+
+static int
+add_find_spec (const char *p)
+{
+       if (p [0] == 'S' && p [1] == ':') {
+               char *vale;
+               find_size = strtoul (p + 2, &vale, 10);
+               return 1;
+       } else if (p [0] == 'T' && p [1] == ':') {
+               find_name = p + 2;
+               return 1;
+       }
+       return 0;
+}
+
+static void
+usage (void)
+{
+       printf ("Mono log profiler report version %d.%d\n", LOG_VERSION_MAJOR, LOG_VERSION_MINOR);
+       printf ("Usage: mprof-report [OPTIONS] FILENAME\n");
+       printf ("FILENAME can be '-' to read from standard input.\n");
+       printf ("Options:\n");
+       printf ("\t--help               display this help\n");
+       printf ("\t--out=FILE           write to FILE instead of stdout\n");
+       printf ("\t--traces             collect and show backtraces\n");
+       printf ("\t--maxframes=NUM      limit backtraces to NUM entries\n");
+       printf ("\t--reports=R1[,R2...] print the specified reports. Defaults are:\n");
+       printf ("\t                     %s\n", reports);
+       printf ("\t--method-sort=MODE   sort methods according to MODE: total, self, calls\n");
+       printf ("\t--alloc-sort=MODE    sort allocations according to MODE: bytes, count\n");
+       printf ("\t--counters-sort=MODE sort counters according to MODE: time, category\n");
+       printf ("\t                     only accessible in verbose mode\n");
+       printf ("\t--track=OB1[,OB2...] track what happens to objects OBJ1, O2 etc.\n");
+       printf ("\t--find=FINDSPEC      find and track objects matching FINFSPEC, where FINDSPEC is:\n");
+       printf ("\t                     S:minimum_size or T:partial_name\n");
+       printf ("\t--thread=THREADID    consider just the data for thread THREADID\n");
+       printf ("\t--time=FROM-TO       consider data FROM seconds from startup up to TO seconds\n");
+       printf ("\t--verbose            increase verbosity level\n");
+       printf ("\t--debug              display decoding debug info for mprof-report devs\n");
+       printf ("\t--coverage-out=FILE  write the coverage info to FILE as XML\n");
+}
+
+int
+main (int argc, char *argv[])
+{
+       ProfContext *ctx;
+       int i;
+       outfile = stdout;
+       for (i = 1; i < argc; ++i) {
+               if (strcmp ("--debug", argv [i]) == 0) {
+                       debug++;
+               } else if (strcmp ("--help", argv [i]) == 0) {
+                       usage ();
+                       return 0;
+               } else if (strncmp ("--alloc-sort=", argv [i], 13) == 0) {
+                       const char *val = argv [i] + 13;
+                       if (strcmp (val, "bytes") == 0) {
+                               alloc_sort_mode = ALLOC_SORT_BYTES;
+                       } else if (strcmp (val, "count") == 0) {
+                               alloc_sort_mode = ALLOC_SORT_COUNT;
+                       } else {
+                               usage ();
+                               return 1;
+                       }
+               } else if (strncmp ("--method-sort=", argv [i], 14) == 0) {
+                       const char *val = argv [i] + 14;
+                       if (strcmp (val, "total") == 0) {
+                               method_sort_mode = METHOD_SORT_TOTAL;
+                       } else if (strcmp (val, "self") == 0) {
+                               method_sort_mode = METHOD_SORT_SELF;
+                       } else if (strcmp (val, "calls") == 0) {
+                               method_sort_mode = METHOD_SORT_CALLS;
+                       } else {
+                               usage ();
+                               return 1;
+                       }
+               } else if (strncmp ("--counters-sort=", argv [i], 16) == 0) {
+                       const char *val = argv [i] + 16;
+                       if (strcmp (val, "time") == 0) {
+                               counters_sort_mode = COUNTERS_SORT_TIME;
+                       } else if (strcmp (val, "category") == 0) {
+                               counters_sort_mode = COUNTERS_SORT_CATEGORY;
+                       } else {
+                               usage ();
+                               return 1;
+                       }
+               } else if (strncmp ("--reports=", argv [i], 10) == 0) {
+                       const char *val = argv [i] + 10;
+                       if (!print_reports (NULL, val, 1)) {
+                               usage ();
+                               return 1;
+                       }
+                       reports = val;
+               } else if (strncmp ("--out=", argv [i], 6) == 0) {
+                       const char *val = argv [i] + 6;
+                       outfile = fopen (val, "w");
+                       if (!outfile) {
+                               printf ("Cannot open output file: %s\n", val);
+                               return 1;
+                       }
+               } else if (strncmp ("--maxframes=", argv [i], 12) == 0) {
+                       const char *val = argv [i] + 12;
+                       char *vale;
+                       trace_max = strtoul (val, &vale, 10);
+               } else if (strncmp ("--find=", argv [i], 7) == 0) {
+                       const char *val = argv [i] + 7;
+                       if (!add_find_spec (val)) {
+                               usage ();
+                               return 1;
+                       }
+               } else if (strncmp ("--track=", argv [i], 8) == 0) {
+                       const char *val = argv [i] + 8;
+                       char *vale;
+                       while (*val) {
+                               uintptr_t tracked_obj;
+                               if (*val == ',') {
+                                       val++;
+                                       continue;
+                               }
+                               tracked_obj = strtoul (val, &vale, 0);
+                               found_object (tracked_obj);
+                               val = vale;
+                       }
+               } else if (strncmp ("--thread=", argv [i], 9) == 0) {
+                       const char *val = argv [i] + 9;
+                       char *vale;
+                       thread_filter = strtoul (val, &vale, 0);
+               } else if (strncmp ("--time=", argv [i], 7) == 0) {
+                       char *val = pstrdup (argv [i] + 7);
+                       double from_secs, to_secs;
+                       char *top = strchr (val, '-');
+                       if (!top) {
+                               usage ();
+                               return 1;
+                       }
+                       *top++ = 0;
+                       from_secs = atof (val);
+                       to_secs = atof (top);
+                       g_free (val);
+                       if (from_secs > to_secs) {
+                               usage ();
+                               return 1;
+                       }
+                       time_from = from_secs * 1000000000;
+                       time_to = to_secs * 1000000000;
+                       use_time_filter = 1;
+               } else if (strcmp ("--verbose", argv [i]) == 0) {
+                       verbose++;
+               } else if (strcmp ("--traces", argv [i]) == 0) {
+                       show_traces = 1;
+                       collect_traces = 1;
+               } else if (strncmp ("--coverage-out=", argv [i], 15) == 0) {
+                       const char *val = argv [i] + 15;
+                       coverage_outfile = fopen (val, "w");
+                       if (!coverage_outfile) {
+                               printf ("Cannot open output file: %s\n", val);
+                               return 1;
+                       }
+               } else {
+                       break;
+               }
+       }
+       if (i >= argc) {
+               usage ();
+               return 2;
+       }
+       ctx = load_file (argv [i]);
+       if (!ctx) {
+               printf ("Not a log profiler data file (or unsupported version).\n");
+               return 1;
+       }
+       while (decode_buffer (ctx));
+       flush_context (ctx);
+       if (num_tracked_objects)
+               return 0;
+       print_reports (ctx, reports, 0);
+       return 0;
+}
diff --git a/mono/profiler/proflog.c b/mono/profiler/proflog.c
deleted file mode 100644 (file)
index 99e6856..0000000
+++ /dev/null
@@ -1,4973 +0,0 @@
-/*
- * proflog.c: mono log profiler
- *
- * Authors:
- *   Paolo Molaro (lupus@ximian.com)
- *   Alex Rønne Petersen (alexrp@xamarin.com)
- *
- * Copyright 2010 Novell, Inc (http://www.novell.com)
- * Copyright 2011 Xamarin Inc (http://www.xamarin.com)
- * Licensed under the MIT license. See LICENSE file in the project root for full license information.
- */
-
-#include <config.h>
-#include "../mini/jit.h"
-#include "../metadata/metadata-internals.h"
-#include <mono/metadata/profiler.h>
-#include <mono/metadata/threads.h>
-#include <mono/metadata/mono-gc.h>
-#include <mono/metadata/debug-helpers.h>
-#include <mono/metadata/mono-perfcounters.h>
-#include <mono/metadata/appdomain.h>
-#include <mono/metadata/assembly.h>
-#include <mono/metadata/tokentype.h>
-#include <mono/metadata/tabledefs.h>
-#include <mono/utils/atomic.h>
-#include <mono/utils/mono-membar.h>
-#include <mono/utils/mono-mmap.h>
-#include <mono/utils/mono-counters.h>
-#include <mono/utils/mono-os-mutex.h>
-#include <mono/utils/mono-os-semaphore.h>
-#include <mono/utils/mono-conc-hashtable.h>
-#include <mono/utils/lock-free-alloc.h>
-#include <mono/utils/lock-free-queue.h>
-#include <mono/utils/hazard-pointer.h>
-#include <mono/utils/mono-threads.h>
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-#include <glib.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#ifdef HAVE_SCHED_GETAFFINITY
-#include <sched.h>
-#endif
-#include <fcntl.h>
-#include <errno.h>
-#if defined(HOST_WIN32) || defined(DISABLE_SOCKETS)
-#define DISABLE_HELPER_THREAD 1
-#endif
-
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif
-#ifdef HAVE_DLFCN_H
-#include <dlfcn.h>
-#endif
-#ifdef HAVE_EXECINFO_H
-#include <execinfo.h>
-#endif
-#ifdef HAVE_LINK_H
-#include <link.h>
-#endif
-
-#ifndef DISABLE_HELPER_THREAD
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <sys/select.h>
-#endif
-
-#ifdef HOST_WIN32
-#include <windows.h>
-#else
-#include <pthread.h>
-#endif
-
-#ifdef HAVE_SYS_STAT_H
-#include <sys/stat.h>
-#endif
-
-#include "utils.c"
-#include "proflog.h"
-
-#if defined (HAVE_SYS_ZLIB)
-#include <zlib.h>
-#endif
-
-#if defined(__linux__)
-
-#include <unistd.h>
-#include <sys/syscall.h>
-
-#ifdef ENABLE_PERF_EVENTS
-#include <linux/perf_event.h>
-
-#define USE_PERF_EVENTS 1
-
-static int read_perf_mmap (MonoProfiler* prof, int cpu);
-#endif
-
-#endif
-
-#define BUFFER_SIZE (4096 * 16)
-
-/* Worst-case size in bytes of a 64-bit value encoded with LEB128. */
-#define LEB128_SIZE 10
-/* Size in bytes of the event ID prefix. */
-#define EVENT_SIZE 1
-
-static int nocalls = 0;
-static int notraces = 0;
-static int use_zip = 0;
-static int do_report = 0;
-static int do_heap_shot = 0;
-static int max_call_depth = 100;
-static volatile int runtime_inited = 0;
-static int need_helper_thread = 0;
-static int command_port = 0;
-static int heapshot_requested = 0;
-static int sample_type = 0;
-static int sample_freq = 0;
-static int do_mono_sample = 0;
-static int in_shutdown = 0;
-static int do_debug = 0;
-static int do_counters = 0;
-static int do_coverage = 0;
-static gboolean debug_coverage = FALSE;
-static MonoProfileSamplingMode sampling_mode = MONO_PROFILER_STAT_MODE_PROCESS;
-static int max_allocated_sample_hits;
-
-static gint32 sample_hits;
-static gint32 sample_flushes;
-static gint32 sample_allocations;
-static gint32 buffer_allocations;
-static gint32 thread_starts;
-static gint32 thread_ends;
-static gint32 domain_loads;
-static gint32 domain_unloads;
-static gint32 context_loads;
-static gint32 context_unloads;
-static gint32 assembly_loads;
-static gint32 assembly_unloads;
-static gint32 image_loads;
-static gint32 image_unloads;
-static gint32 class_loads;
-static gint32 class_unloads;
-
-typedef struct _LogBuffer LogBuffer;
-
-/*
- * file format:
- * [header] [buffer]*
- *
- * The file is composed by a header followed by 0 or more buffers.
- * Each buffer contains events that happened on a thread: for a given thread
- * buffers that appear later in the file are guaranteed to contain events
- * that happened later in time. Buffers from separate threads could be interleaved,
- * though.
- * Buffers are not required to be aligned.
- *
- * header format:
- * [id: 4 bytes] constant value: LOG_HEADER_ID
- * [major: 1 byte] [minor: 1 byte] major and minor version of the log profiler
- * [format: 1 byte] version of the data format for the rest of the file
- * [ptrsize: 1 byte] size in bytes of a pointer in the profiled program
- * [startup time: 8 bytes] time in milliseconds since the unix epoch when the program started
- * [timer overhead: 4 bytes] approximate overhead in nanoseconds of the timer
- * [flags: 4 bytes] file format flags, should be 0 for now
- * [pid: 4 bytes] pid of the profiled process
- * [port: 2 bytes] tcp port for server if != 0
- * [sysid: 2 bytes] operating system and architecture identifier
- *
- * The multiple byte integers are in little-endian format.
- *
- * buffer format:
- * [buffer header] [event]*
- * Buffers have a fixed-size header followed by 0 or more bytes of event data.
- * Timing information and other values in the event data are usually stored
- * as uleb128 or sleb128 integers. To save space, as noted for each item below,
- * some data is represented as a difference between the actual value and
- * either the last value of the same type (like for timing information) or
- * as the difference from a value stored in a buffer header.
- *
- * For timing information the data is stored as uleb128, since timing
- * increases in a monotonic way in each thread: the value is the number of
- * nanoseconds to add to the last seen timing data in a buffer. The first value
- * in a buffer will be calculated from the time_base field in the buffer head.
- *
- * Object or heap sizes are stored as uleb128.
- * Pointer differences are stored as sleb128, instead.
- *
- * If an unexpected value is found, the rest of the buffer should be ignored,
- * as generally the later values need the former to be interpreted correctly.
- *
- * buffer header format:
- * [bufid: 4 bytes] constant value: BUF_ID
- * [len: 4 bytes] size of the data following the buffer header
- * [time_base: 8 bytes] time base in nanoseconds since an unspecified epoch
- * [ptr_base: 8 bytes] base value for pointers
- * [obj_base: 8 bytes] base value for object addresses
- * [thread id: 8 bytes] system-specific thread ID (pthread_t for example)
- * [method_base: 8 bytes] base value for MonoMethod pointers
- *
- * event format:
- * [extended info: upper 4 bits] [type: lower 4 bits] [data]*
- * The data that follows depends on type and the extended info.
- * Type is one of the enum values in proflog.h: TYPE_ALLOC, TYPE_GC,
- * TYPE_METADATA, TYPE_METHOD, TYPE_EXCEPTION, TYPE_MONITOR, TYPE_HEAP.
- * The extended info bits are interpreted based on type, see
- * each individual event description below.
- * strings are represented as a 0-terminated utf8 sequence.
- *
- * backtrace format:
- * [flags: uleb128] must be 0
- * [num: uleb128] number of frames following
- * [frame: sleb128]* num MonoMethod pointers as differences from ptr_base
- *
- * type alloc format:
- * type: TYPE_ALLOC
- * exinfo: flags: TYPE_ALLOC_BT
- * [time diff: uleb128] nanoseconds since last timing
- * [ptr: sleb128] class as a byte difference from ptr_base
- * [obj: sleb128] object address as a byte difference from obj_base
- * [size: uleb128] size of the object in the heap
- * If the TYPE_ALLOC_BT flag is set, a backtrace follows.
- *
- * type GC format:
- * type: TYPE_GC
- * exinfo: one of TYPE_GC_EVENT, TYPE_GC_RESIZE, TYPE_GC_MOVE, TYPE_GC_HANDLE_CREATED[_BT],
- * TYPE_GC_HANDLE_DESTROYED[_BT]
- * [time diff: uleb128] nanoseconds since last timing
- * if exinfo == TYPE_GC_RESIZE
- *     [heap_size: uleb128] new heap size
- * if exinfo == TYPE_GC_EVENT
- *     [event type: uleb128] GC event (MONO_GC_EVENT_* from profiler.h)
- *     [generation: uleb128] GC generation event refers to
- * if exinfo == TYPE_GC_MOVE
- *     [num_objects: uleb128] number of object moves that follow
- *     [objaddr: sleb128]+ num_objects object pointer differences from obj_base
- *     num is always an even number: the even items are the old
- *     addresses, the odd numbers are the respective new object addresses
- * if exinfo == TYPE_GC_HANDLE_CREATED[_BT]
- *     [handle_type: uleb128] GC handle type (System.Runtime.InteropServices.GCHandleType)
- *     upper bits reserved as flags
- *     [handle: uleb128] GC handle value
- *     [objaddr: sleb128] object pointer differences from obj_base
- *     If exinfo == TYPE_GC_HANDLE_CREATED_BT, a backtrace follows.
- * if exinfo == TYPE_GC_HANDLE_DESTROYED[_BT]
- *     [handle_type: uleb128] GC handle type (System.Runtime.InteropServices.GCHandleType)
- *     upper bits reserved as flags
- *     [handle: uleb128] GC handle value
- *     If exinfo == TYPE_GC_HANDLE_DESTROYED_BT, a backtrace follows.
- *
- * type metadata format:
- * type: TYPE_METADATA
- * exinfo: one of: TYPE_END_LOAD, TYPE_END_UNLOAD (optional for TYPE_THREAD and TYPE_DOMAIN)
- * [time diff: uleb128] nanoseconds since last timing
- * [mtype: byte] metadata type, one of: TYPE_CLASS, TYPE_IMAGE, TYPE_ASSEMBLY, TYPE_DOMAIN,
- * TYPE_THREAD, TYPE_CONTEXT
- * [pointer: sleb128] pointer of the metadata type depending on mtype
- * if mtype == TYPE_CLASS
- *     [image: sleb128] MonoImage* as a pointer difference from ptr_base
- *     [flags: uleb128] must be 0
- *     [name: string] full class name
- * if mtype == TYPE_IMAGE
- *     [flags: uleb128] must be 0
- *     [name: string] image file name
- * if mtype == TYPE_ASSEMBLY
- *     [flags: uleb128] must be 0
- *     [name: string] assembly name
- * if mtype == TYPE_DOMAIN
- *     [flags: uleb128] must be 0
- * if mtype == TYPE_DOMAIN && exinfo == 0
- *     [name: string] domain friendly name
- * if mtype == TYPE_CONTEXT
- *     [flags: uleb128] must be 0
- *     [domain: sleb128] domain id as pointer
- * if mtype == TYPE_THREAD && (format_version < 11 || (format_version > 10 && exinfo == 0))
- *     [flags: uleb128] must be 0
- *     [name: string] thread name
- *
- * type method format:
- * type: TYPE_METHOD
- * exinfo: one of: TYPE_LEAVE, TYPE_ENTER, TYPE_EXC_LEAVE, TYPE_JIT
- * [time diff: uleb128] nanoseconds since last timing
- * [method: sleb128] MonoMethod* as a pointer difference from the last such
- * pointer or the buffer method_base
- * if exinfo == TYPE_JIT
- *     [code address: sleb128] pointer to the native code as a diff from ptr_base
- *     [code size: uleb128] size of the generated code
- *     [name: string] full method name
- *
- * type runtime format:
- * type: TYPE_RUNTIME
- * exinfo: one of: TYPE_JITHELPER
- * [time diff: uleb128] nanoseconds since last timing
- * if exinfo == TYPE_JITHELPER
- *     [type: uleb128] MonoProfilerCodeBufferType enum value
- *     [buffer address: sleb128] pointer to the native code as a diff from ptr_base
- *     [buffer size: uleb128] size of the generated code
- *     if type == MONO_PROFILER_CODE_BUFFER_SPECIFIC_TRAMPOLINE
- *             [name: string] buffer description name
- *
- * type monitor format:
- * type: TYPE_MONITOR
- * exinfo: TYPE_MONITOR_BT flag and one of: MONO_PROFILER_MONITOR_(CONTENTION|FAIL|DONE)
- * [time diff: uleb128] nanoseconds since last timing
- * [object: sleb128] the lock object as a difference from obj_base
- * if exinfo.low3bits == MONO_PROFILER_MONITOR_CONTENTION
- *     If the TYPE_MONITOR_BT flag is set, a backtrace follows.
- *
- * type heap format
- * type: TYPE_HEAP
- * exinfo: one of TYPE_HEAP_START, TYPE_HEAP_END, TYPE_HEAP_OBJECT, TYPE_HEAP_ROOT
- * if exinfo == TYPE_HEAP_START
- *     [time diff: uleb128] nanoseconds since last timing
- * if exinfo == TYPE_HEAP_END
- *     [time diff: uleb128] nanoseconds since last timing
- * if exinfo == TYPE_HEAP_OBJECT
- *     [object: sleb128] the object as a difference from obj_base
- *     [class: sleb128] the object MonoClass* as a difference from ptr_base
- *     [size: uleb128] size of the object on the heap
- *     [num_refs: uleb128] number of object references
- *     if (format version > 1) each referenced objref is preceded by a
- *     uleb128 encoded offset: the first offset is from the object address
- *     and each next offset is relative to the previous one
- *     [objrefs: sleb128]+ object referenced as a difference from obj_base
- *     The same object can appear multiple times, but only the first time
- *     with size != 0: in the other cases this data will only be used to
- *     provide additional referenced objects.
- * if exinfo == TYPE_HEAP_ROOT
- *     [num_roots: uleb128] number of root references
- *     [num_gc: uleb128] number of major gcs
- *     [object: sleb128] the object as a difference from obj_base
- *     [root_type: uleb128] the root_type: MonoProfileGCRootType (profiler.h)
- *     [extra_info: uleb128] the extra_info value
- *     object, root_type and extra_info are repeated num_roots times
- *
- * type sample format
- * type: TYPE_SAMPLE
- * exinfo: one of TYPE_SAMPLE_HIT, TYPE_SAMPLE_USYM, TYPE_SAMPLE_UBIN, TYPE_SAMPLE_COUNTERS_DESC, TYPE_SAMPLE_COUNTERS
- * if exinfo == TYPE_SAMPLE_HIT
- *     [sample_type: uleb128] type of sample (SAMPLE_*)
- *     [timestamp: uleb128] nanoseconds since startup (note: different from other timestamps!)
- *     if (format_version > 10)
- *             [thread: sleb128] thread id as difference from ptr_base
- *     [count: uleb128] number of following instruction addresses
- *     [ip: sleb128]* instruction pointer as difference from ptr_base
- *     if (format_version > 5)
- *             [mbt_count: uleb128] number of managed backtrace info triplets (method + IL offset + native offset)
- *             [method: sleb128]* MonoMethod* as a pointer difference from the last such
- *             pointer or the buffer method_base (the first such method can be also indentified by ip, but this is not neccessarily true)
- *             [il_offset: sleb128]* IL offset inside method where the hit occurred
- *             [native_offset: sleb128]* native offset inside method where the hit occurred
- * if exinfo == TYPE_SAMPLE_USYM
- *     [address: sleb128] symbol address as a difference from ptr_base
- *     [size: uleb128] symbol size (may be 0 if unknown)
- *     [name: string] symbol name
- * if exinfo == TYPE_SAMPLE_UBIN
- *     [time diff: uleb128] nanoseconds since last timing
- *     [address: sleb128] address where binary has been loaded
- *     [offset: uleb128] file offset of mapping (the same file can be mapped multiple times)
- *     [size: uleb128] memory size
- *     [name: string] binary name
- * if exinfo == TYPE_SAMPLE_COUNTERS_DESC
- *     [len: uleb128] number of counters
- *     for i = 0 to len
- *             [section: uleb128] section of counter
- *             if section == MONO_COUNTER_PERFCOUNTERS:
- *                     [section_name: string] section name of counter
- *             [name: string] name of counter
- *             [type: uleb128] type of counter
- *             [unit: uleb128] unit of counter
- *             [variance: uleb128] variance of counter
- *             [index: uleb128] unique index of counter
- * if exinfo == TYPE_SAMPLE_COUNTERS
- *     [timestamp: uleb128] sampling timestamp
- *     while true:
- *             [index: uleb128] unique index of counter
- *             if index == 0:
- *                     break
- *             [type: uleb128] type of counter value
- *             if type == string:
- *                     if value == null:
- *                             [0: uleb128] 0 -> value is null
- *                     else:
- *                             [1: uleb128] 1 -> value is not null
- *                             [value: string] counter value
- *             else:
- *                     [value: uleb128/sleb128/double] counter value, can be sleb128, uleb128 or double (determined by using type)
- *
- * type coverage format
- * type: TYPE_COVERAGE
- * exinfo: one of TYPE_COVERAGE_METHOD, TYPE_COVERAGE_STATEMENT, TYPE_COVERAGE_ASSEMBLY, TYPE_COVERAGE_CLASS
- * if exinfo == TYPE_COVERAGE_METHOD
- *  [assembly: string] name of assembly
- *  [class: string] name of the class
- *  [name: string] name of the method
- *  [signature: string] the signature of the method
- *  [filename: string] the file path of the file that contains this method
- *  [token: uleb128] the method token
- *  [method_id: uleb128] an ID for this data to associate with the buffers of TYPE_COVERAGE_STATEMENTS
- *  [len: uleb128] the number of TYPE_COVERAGE_BUFFERS associated with this method
- * if exinfo == TYPE_COVERAGE_STATEMENTS
- *  [method_id: uleb128] an the TYPE_COVERAGE_METHOD buffer to associate this with
- *  [offset: uleb128] the il offset relative to the previous offset
- *  [counter: uleb128] the counter for this instruction
- *  [line: uleb128] the line of filename containing this instruction
- *  [column: uleb128] the column containing this instruction
- * if exinfo == TYPE_COVERAGE_ASSEMBLY
- *  [name: string] assembly name
- *  [guid: string] assembly GUID
- *  [filename: string] assembly filename
- *  [number_of_methods: uleb128] the number of methods in this assembly
- *  [fully_covered: uleb128] the number of fully covered methods
- *  [partially_covered: uleb128] the number of partially covered methods
- *    currently partially_covered will always be 0, and fully_covered is the
- *    number of methods that are fully and partially covered.
- * if exinfo == TYPE_COVERAGE_CLASS
- *  [name: string] assembly name
- *  [class: string] class name
- *  [number_of_methods: uleb128] the number of methods in this class
- *  [fully_covered: uleb128] the number of fully covered methods
- *  [partially_covered: uleb128] the number of partially covered methods
- *    currently partially_covered will always be 0, and fully_covered is the
- *    number of methods that are fully and partially covered.
- */
-
-/*
- * Format oddities that we ought to fix:
- *
- * - Methods written in emit_bt () should be based on the buffer's base
- *   method instead of the base pointer.
- * - The TYPE_SAMPLE_HIT event contains (currently) pointless data like
- *   always-one unmanaged frame count and always-zero IL offsets.
- *
- * These are mostly small things and are not worth a format change by
- * themselves. They should be done when some other major change has to
- * be done to the format.
- */
-
-// Pending data to be written to the log, for a single thread.
-// Threads periodically flush their own LogBuffers by calling safe_send
-struct _LogBuffer {
-       // Next (older) LogBuffer in processing queue
-       LogBuffer *next;
-
-       uint64_t time_base;
-       uint64_t last_time;
-       uintptr_t ptr_base;
-       uintptr_t method_base;
-       uintptr_t last_method;
-       uintptr_t obj_base;
-       uintptr_t thread_id;
-       int locked;
-       int call_depth;
-
-       // Bytes allocated for this LogBuffer
-       int size;
-
-       // Start of currently unused space in buffer
-       unsigned char* cursor;
-
-       // Pointer to start-of-structure-plus-size (for convenience)
-       unsigned char* buf_end;
-
-       // Start of data in buffer. Contents follow "buffer format" described above.
-       unsigned char buf [1];
-};
-
-static inline void
-ign_res (int G_GNUC_UNUSED unused, ...)
-{
-}
-
-#define ENTER_LOG(lb,str) if ((lb)->locked) {ign_res (write(2, str, strlen(str))); ign_res (write(2, "\n", 1));return;} else {(lb)->locked++;}
-#define EXIT_LOG(lb) (lb)->locked--;
-
-typedef struct _BinaryObject BinaryObject;
-
-struct _BinaryObject {
-       BinaryObject *next;
-       void *addr;
-       char *name;
-};
-
-struct _MonoProfiler {
-       FILE* file;
-#if defined (HAVE_SYS_ZLIB)
-       gzFile gzfile;
-#endif
-       uint64_t startup_time;
-       int pipe_output;
-       int last_gc_gen_started;
-       int command_port;
-       int server_socket;
-       int pipes [2];
-#ifndef HOST_WIN32
-       pthread_t helper_thread;
-       pthread_t writer_thread;
-       pthread_t dumper_thread;
-#endif
-       volatile gint32 run_writer_thread;
-       MonoLockFreeQueue writer_queue;
-       MonoSemType writer_queue_sem;
-       MonoConcurrentHashTable *method_table;
-       mono_mutex_t method_table_mutex;
-       volatile gint32 run_dumper_thread;
-       MonoLockFreeQueue dumper_queue;
-       MonoSemType dumper_queue_sem;
-       MonoLockFreeAllocSizeClass sample_size_class;
-       MonoLockFreeAllocator sample_allocator;
-       MonoLockFreeQueue sample_reuse_queue;
-       BinaryObject *binary_objects;
-       GPtrArray *coverage_filters;
-};
-
-typedef struct _WriterQueueEntry WriterQueueEntry;
-struct _WriterQueueEntry {
-       MonoLockFreeQueueNode node;
-       GPtrArray *methods;
-       LogBuffer *buffer;
-};
-
-typedef struct _MethodInfo MethodInfo;
-struct _MethodInfo {
-       MonoMethod *method;
-       MonoJitInfo *ji;
-       uint64_t time;
-};
-
-#ifdef TLS_INIT
-#undef TLS_INIT
-#endif
-
-#ifdef HOST_WIN32
-#define TLS_SET(x,y) (TlsSetValue (x, y))
-#define TLS_GET(t,x) ((t *) TlsGetValue (x))
-#define TLS_INIT(x) (x = TlsAlloc ())
-static int tlsbuffer;
-static int tlsmethodlist;
-#elif HAVE_KW_THREAD
-#define TLS_SET(x,y) (x = y)
-#define TLS_GET(t,x) (x)
-#define TLS_INIT(x)
-static __thread LogBuffer* tlsbuffer = NULL;
-static __thread GPtrArray* tlsmethodlist = NULL;
-#else
-#define TLS_SET(x,y) (pthread_setspecific (x, y))
-#define TLS_GET(t,x) ((t *) pthread_getspecific (x))
-#define TLS_INIT(x) (pthread_key_create (&x, NULL))
-static pthread_key_t tlsbuffer;
-static pthread_key_t tlsmethodlist;
-#endif
-
-static void safe_send (MonoProfiler *profiler, LogBuffer *logbuffer);
-
-static char*
-pstrdup (const char *s)
-{
-       int len = strlen (s) + 1;
-       char *p = (char *)malloc (len);
-       memcpy (p, s, len);
-       return p;
-}
-
-static LogBuffer*
-create_buffer (void)
-{
-       LogBuffer* buf = (LogBuffer *)alloc_buffer (BUFFER_SIZE);
-
-       InterlockedIncrement (&buffer_allocations);
-
-       buf->size = BUFFER_SIZE;
-       buf->time_base = current_time ();
-       buf->last_time = buf->time_base;
-       buf->buf_end = (unsigned char*)buf + buf->size;
-       buf->cursor = buf->buf;
-       return buf;
-}
-
-static void
-init_thread (void)
-{
-       if (!TLS_GET (LogBuffer, tlsbuffer)) {
-               LogBuffer *logbuffer = create_buffer ();
-               TLS_SET (tlsbuffer, logbuffer);
-               logbuffer->thread_id = thread_id ();
-       }
-       if (!TLS_GET (GPtrArray, tlsmethodlist)) {
-               GPtrArray *methodlist = g_ptr_array_new ();
-               TLS_SET (tlsmethodlist, methodlist);
-       }
-
-       //printf ("thread %p at time %llu\n", (void*)logbuffer->thread_id, logbuffer->time_base);
-}
-
-static LogBuffer *
-ensure_logbuf_inner (LogBuffer *old, int bytes)
-{
-       if (old && old->cursor + bytes + 100 < old->buf_end)
-               return old;
-
-       LogBuffer *new_ = (LogBuffer *)create_buffer ();
-       new_->thread_id = thread_id ();
-       new_->next = old;
-
-       if (old)
-               new_->call_depth = old->call_depth;
-
-       return new_;
-}
-
-static LogBuffer*
-ensure_logbuf (int bytes)
-{
-       LogBuffer *old = TLS_GET (LogBuffer, tlsbuffer);
-       LogBuffer *new_ = ensure_logbuf_inner (old, bytes);
-
-       if (new_ == old)
-               return old; // Still enough space.
-
-       TLS_SET (tlsbuffer, new_);
-       init_thread ();
-
-       return new_;
-}
-
-static void
-emit_byte (LogBuffer *logbuffer, int value)
-{
-       logbuffer->cursor [0] = value;
-       logbuffer->cursor++;
-       assert (logbuffer->cursor <= logbuffer->buf_end);
-}
-
-static void
-emit_value (LogBuffer *logbuffer, int value)
-{
-       encode_uleb128 (value, logbuffer->cursor, &logbuffer->cursor);
-       assert (logbuffer->cursor <= logbuffer->buf_end);
-}
-
-static void
-emit_time (LogBuffer *logbuffer, uint64_t value)
-{
-       uint64_t tdiff = value - logbuffer->last_time;
-       //if (value < logbuffer->last_time)
-       //      printf ("time went backwards\n");
-       //if (tdiff > 1000000)
-       //      printf ("large time offset: %llu\n", tdiff);
-       encode_uleb128 (tdiff, logbuffer->cursor, &logbuffer->cursor);
-       /*if (tdiff != decode_uleb128 (p, &p))
-               printf ("incorrect encoding: %llu\n", tdiff);*/
-       logbuffer->last_time = value;
-       assert (logbuffer->cursor <= logbuffer->buf_end);
-}
-
-static void
-emit_svalue (LogBuffer *logbuffer, int64_t value)
-{
-       encode_sleb128 (value, logbuffer->cursor, &logbuffer->cursor);
-       assert (logbuffer->cursor <= logbuffer->buf_end);
-}
-
-static void
-emit_uvalue (LogBuffer *logbuffer, uint64_t value)
-{
-       encode_uleb128 (value, logbuffer->cursor, &logbuffer->cursor);
-       assert (logbuffer->cursor <= logbuffer->buf_end);
-}
-
-static void
-emit_ptr (LogBuffer *logbuffer, void *ptr)
-{
-       if (!logbuffer->ptr_base)
-               logbuffer->ptr_base = (uintptr_t)ptr;
-       emit_svalue (logbuffer, (intptr_t)ptr - logbuffer->ptr_base);
-       assert (logbuffer->cursor <= logbuffer->buf_end);
-}
-
-static void
-emit_method_inner (LogBuffer *logbuffer, void *method)
-{
-       if (!logbuffer->method_base) {
-               logbuffer->method_base = (intptr_t)method;
-               logbuffer->last_method = (intptr_t)method;
-       }
-       encode_sleb128 ((intptr_t)((char*)method - (char*)logbuffer->last_method), logbuffer->cursor, &logbuffer->cursor);
-       logbuffer->last_method = (intptr_t)method;
-       assert (logbuffer->cursor <= logbuffer->buf_end);
-}
-
-/*
-typedef struct {
-       MonoMethod *method;
-       MonoJitInfo *found;
-} MethodSearch;
-
-static void
-find_method (MonoDomain *domain, void *user_data)
-{
-       MethodSearch *search = user_data;
-
-       if (search->found)
-               return;
-
-       MonoJitInfo *ji = mono_get_jit_info_from_method (domain, search->method);
-
-       // It could be AOT'd, so we need to get it from the AOT runtime's cache.
-       if (!ji) {
-               void *ip = mono_aot_get_method (domain, search->method);
-
-               // Avoid a slow path in mono_jit_info_table_find ().
-               if (ip)
-                       ji = mono_jit_info_table_find (domain, ip);
-       }
-
-       if (ji)
-               search->found = ji;
-}
-*/
-
-static void
-register_method_local (MonoProfiler *prof, MonoMethod *method, MonoJitInfo *ji)
-{
-       if (!mono_conc_hashtable_lookup (prof->method_table, method)) {
-               /*
-                * FIXME: In some cases, we crash while looking up JIT info for AOT'd methods.
-                * This usually happens for static constructors. This code is disabled for now
-                * as we don't need this info for anything critical.
-                *
-                * https://bugzilla.xamarin.com/show_bug.cgi?id=35171
-                */
-               /*
-               if (!ji) {
-                       MethodSearch search = { method, NULL };
-
-                       mono_domain_foreach (find_method, &search);
-
-                       ji = search.found;
-               }
-               */
-
-               /*
-                * FIXME: We can't always find JIT info for a generic shared method, especially
-                * if we obtained the MonoMethod during an async stack walk. For now, we deal
-                * with this by giving the generic shared method name and dummy code start/size
-                * information (i.e. zeroes).
-                */
-               //g_assert (ji);
-
-               MethodInfo *info = (MethodInfo *)malloc (sizeof (MethodInfo));
-
-               info->method = method;
-               info->ji = ji;
-               info->time = current_time ();
-
-               g_ptr_array_add (TLS_GET (GPtrArray, tlsmethodlist), info);
-       }
-}
-
-static void
-emit_method (MonoProfiler *prof, LogBuffer *logbuffer, MonoMethod *method)
-{
-       register_method_local (prof, method, NULL);
-       emit_method_inner (logbuffer, method);
-}
-
-static void
-emit_method_as_ptr (MonoProfiler *prof, LogBuffer *logbuffer, MonoMethod *method)
-{
-       register_method_local (prof, method, NULL);
-       emit_ptr (logbuffer, method);
-}
-
-static void
-emit_obj (LogBuffer *logbuffer, void *ptr)
-{
-       if (!logbuffer->obj_base)
-               logbuffer->obj_base = (uintptr_t)ptr >> 3;
-       emit_svalue (logbuffer, ((uintptr_t)ptr >> 3) - logbuffer->obj_base);
-       assert (logbuffer->cursor <= logbuffer->buf_end);
-}
-
-static void
-emit_string (LogBuffer *logbuffer, const char *str, size_t size)
-{
-       size_t i = 0;
-       if (str) {
-               for (; i < size; i++) {
-                       if (str[i] == '\0')
-                               break;
-                       emit_byte (logbuffer, str [i]);
-               }
-       }
-       emit_byte (logbuffer, '\0');
-}
-
-static void
-emit_double (LogBuffer *logbuffer, double value)
-{
-       int i;
-       unsigned char buffer[8];
-       memcpy (buffer, &value, 8);
-#if G_BYTE_ORDER == G_BIG_ENDIAN
-       for (i = 7; i >= 0; i--)
-#else
-       for (i = 0; i < 8; i++)
-#endif
-               emit_byte (logbuffer, buffer[i]);
-}
-
-static char*
-write_int16 (char *buf, int32_t value)
-{
-       int i;
-       for (i = 0; i < 2; ++i) {
-               buf [i] = value;
-               value >>= 8;
-       }
-       return buf + 2;
-}
-
-static char*
-write_int32 (char *buf, int32_t value)
-{
-       int i;
-       for (i = 0; i < 4; ++i) {
-               buf [i] = value;
-               value >>= 8;
-       }
-       return buf + 4;
-}
-
-static char*
-write_int64 (char *buf, int64_t value)
-{
-       int i;
-       for (i = 0; i < 8; ++i) {
-               buf [i] = value;
-               value >>= 8;
-       }
-       return buf + 8;
-}
-
-static void
-dump_header (MonoProfiler *profiler)
-{
-       char hbuf [128];
-       char *p = hbuf;
-       p = write_int32 (p, LOG_HEADER_ID);
-       *p++ = LOG_VERSION_MAJOR;
-       *p++ = LOG_VERSION_MINOR;
-       *p++ = LOG_DATA_VERSION;
-       *p++ = sizeof (void*);
-       p = write_int64 (p, ((uint64_t)time (NULL)) * 1000); /* startup time */
-       p = write_int32 (p, get_timer_overhead ()); /* timer overhead */
-       p = write_int32 (p, 0); /* flags */
-       p = write_int32 (p, process_id ()); /* pid */
-       p = write_int16 (p, profiler->command_port); /* port */
-       p = write_int16 (p, 0); /* opsystem */
-#if defined (HAVE_SYS_ZLIB)
-       if (profiler->gzfile) {
-               gzwrite (profiler->gzfile, hbuf, p - hbuf);
-       } else {
-               fwrite (hbuf, p - hbuf, 1, profiler->file);
-       }
-#else
-       fwrite (hbuf, p - hbuf, 1, profiler->file);
-       fflush (profiler->file);
-#endif
-}
-
-static void
-send_buffer (MonoProfiler *prof, GPtrArray *methods, LogBuffer *buffer)
-{
-       WriterQueueEntry *entry = (WriterQueueEntry *)calloc (1, sizeof (WriterQueueEntry));
-       mono_lock_free_queue_node_init (&entry->node, FALSE);
-       entry->methods = methods;
-       entry->buffer = buffer;
-       mono_lock_free_queue_enqueue (&prof->writer_queue, &entry->node);
-       mono_os_sem_post (&prof->writer_queue_sem);
-}
-
-static void
-dump_buffer (MonoProfiler *profiler, LogBuffer *buf)
-{
-       char hbuf [128];
-       char *p = hbuf;
-       if (buf->next)
-               dump_buffer (profiler, buf->next);
-       p = write_int32 (p, BUF_ID);
-       p = write_int32 (p, buf->cursor - buf->buf);
-       p = write_int64 (p, buf->time_base);
-       p = write_int64 (p, buf->ptr_base);
-       p = write_int64 (p, buf->obj_base);
-       p = write_int64 (p, buf->thread_id);
-       p = write_int64 (p, buf->method_base);
-#if defined (HAVE_SYS_ZLIB)
-       if (profiler->gzfile) {
-               gzwrite (profiler->gzfile, hbuf, p - hbuf);
-               gzwrite (profiler->gzfile, buf->buf, buf->cursor - buf->buf);
-       } else {
-#endif
-               fwrite (hbuf, p - hbuf, 1, profiler->file);
-               fwrite (buf->buf, buf->cursor - buf->buf, 1, profiler->file);
-               fflush (profiler->file);
-#if defined (HAVE_SYS_ZLIB)
-       }
-#endif
-       free_buffer (buf, buf->size);
-}
-
-static void
-process_requests (MonoProfiler *profiler)
-{
-       if (heapshot_requested)
-               mono_gc_collect (mono_gc_max_generation ());
-}
-
-static void counters_init (MonoProfiler *profiler);
-static void counters_sample (MonoProfiler *profiler, uint64_t timestamp, gboolean threadless);
-
-/*
- * Can be called only at safe callback locations.
- */
-static void
-safe_send (MonoProfiler *profiler, LogBuffer *logbuffer)
-{
-       /* We need the runtime initialized so that we have threads and hazard
-        * pointers available. Otherwise, the lock free queue will not work and
-        * there won't be a thread to process the data.
-        *
-        * While the runtime isn't initialized, we just accumulate data in the
-        * thread local buffer list.
-        */
-       if (!InterlockedRead (&runtime_inited))
-               return;
-
-       int cd = logbuffer->call_depth;
-
-       send_buffer (profiler, TLS_GET (GPtrArray, tlsmethodlist), TLS_GET (LogBuffer, tlsbuffer));
-
-       TLS_SET (tlsbuffer, NULL);
-       TLS_SET (tlsmethodlist, NULL);
-
-       init_thread ();
-
-       TLS_GET (LogBuffer, tlsbuffer)->call_depth = cd;
-}
-
-static void
-safe_send_threadless (MonoProfiler *prof, LogBuffer *buf)
-{
-       for (LogBuffer *iter = buf; iter; iter = iter->next)
-               iter->thread_id = 0;
-
-       safe_send (prof, buf);
-}
-
-static int
-gc_reference (MonoObject *obj, MonoClass *klass, uintptr_t size, uintptr_t num, MonoObject **refs, uintptr_t *offsets, void *data)
-{
-       int i;
-       uintptr_t last_offset = 0;
-       //const char *name = mono_class_get_name (klass);
-       LogBuffer *logbuffer = ensure_logbuf (
-               EVENT_SIZE /* event */ +
-               LEB128_SIZE /* obj */ +
-               LEB128_SIZE /* klass */ +
-               LEB128_SIZE /* size */ +
-               LEB128_SIZE /* num */ +
-               num * (
-                       LEB128_SIZE /* offset */ +
-                       LEB128_SIZE /* ref */
-               )
-       );
-       emit_byte (logbuffer, TYPE_HEAP_OBJECT | TYPE_HEAP);
-       emit_obj (logbuffer, obj);
-       emit_ptr (logbuffer, klass);
-       /* account for object alignment in the heap */
-       size += 7;
-       size &= ~7;
-       emit_value (logbuffer, size);
-       emit_value (logbuffer, num);
-       for (i = 0; i < num; ++i) {
-               emit_value (logbuffer, offsets [i] - last_offset);
-               last_offset = offsets [i];
-               emit_obj (logbuffer, refs [i]);
-       }
-       //if (num)
-       //      printf ("obj: %p, klass: %s, refs: %d, size: %d\n", obj, name, (int)num, (int)size);
-       return 0;
-}
-
-static unsigned int hs_mode_ms = 0;
-static unsigned int hs_mode_gc = 0;
-static unsigned int hs_mode_ondemand = 0;
-static unsigned int gc_count = 0;
-static uint64_t last_hs_time = 0;
-
-static void
-heap_walk (MonoProfiler *profiler)
-{
-       int do_walk = 0;
-       uint64_t now;
-       LogBuffer *logbuffer;
-       if (!do_heap_shot)
-               return;
-       logbuffer = ensure_logbuf (
-               EVENT_SIZE /* event */ +
-               LEB128_SIZE /* time */
-       );
-       now = current_time ();
-       if (hs_mode_ms && (now - last_hs_time)/1000000 >= hs_mode_ms)
-               do_walk = 1;
-       else if (hs_mode_gc && (gc_count % hs_mode_gc) == 0)
-               do_walk = 1;
-       else if (hs_mode_ondemand)
-               do_walk = heapshot_requested;
-       else if (!hs_mode_ms && !hs_mode_gc && profiler->last_gc_gen_started == mono_gc_max_generation ())
-               do_walk = 1;
-
-       if (!do_walk)
-               return;
-       heapshot_requested = 0;
-       emit_byte (logbuffer, TYPE_HEAP_START | TYPE_HEAP);
-       emit_time (logbuffer, now);
-       mono_gc_walk_heap (0, gc_reference, NULL);
-       logbuffer = ensure_logbuf (
-               EVENT_SIZE /* event */ +
-               LEB128_SIZE /* time */
-       );
-       now = current_time ();
-       emit_byte (logbuffer, TYPE_HEAP_END | TYPE_HEAP);
-       emit_time (logbuffer, now);
-       last_hs_time = now;
-}
-
-static void
-gc_event (MonoProfiler *profiler, MonoGCEvent ev, int generation) {
-       uint64_t now;
-       LogBuffer *logbuffer = ensure_logbuf (
-               EVENT_SIZE /* event */ +
-               LEB128_SIZE /* time */ +
-               LEB128_SIZE /* gc event */ +
-               LEB128_SIZE /* generation */
-       );
-       now = current_time ();
-       ENTER_LOG (logbuffer, "gcevent");
-       emit_byte (logbuffer, TYPE_GC_EVENT | TYPE_GC);
-       emit_time (logbuffer, now);
-       emit_value (logbuffer, ev);
-       emit_value (logbuffer, generation);
-       /* to deal with nested gen1 after gen0 started */
-       if (ev == MONO_GC_EVENT_START) {
-               profiler->last_gc_gen_started = generation;
-               if (generation == mono_gc_max_generation ())
-                       gc_count++;
-       }
-       if (ev == MONO_GC_EVENT_PRE_START_WORLD)
-               heap_walk (profiler);
-       EXIT_LOG (logbuffer);
-       if (ev == MONO_GC_EVENT_POST_START_WORLD)
-               safe_send (profiler, logbuffer);
-       //printf ("gc event %d for generation %d\n", ev, generation);
-}
-
-static void
-gc_resize (MonoProfiler *profiler, int64_t new_size) {
-       uint64_t now;
-       LogBuffer *logbuffer = ensure_logbuf (
-               EVENT_SIZE /* event */ +
-               LEB128_SIZE /* time */ +
-               LEB128_SIZE /* new size */
-       );
-       now = current_time ();
-       ENTER_LOG (logbuffer, "gcresize");
-       emit_byte (logbuffer, TYPE_GC_RESIZE | TYPE_GC);
-       emit_time (logbuffer, now);
-       emit_value (logbuffer, new_size);
-       //printf ("gc resized to %lld\n", new_size);
-       EXIT_LOG (logbuffer);
-}
-
-// If you alter MAX_FRAMES, you may need to alter SAMPLE_BLOCK_SIZE too.
-#define MAX_FRAMES 32
-
-typedef struct {
-       int count;
-       MonoMethod* methods [MAX_FRAMES];
-       int32_t il_offsets [MAX_FRAMES];
-       int32_t native_offsets [MAX_FRAMES];
-} FrameData;
-
-static int num_frames = MAX_FRAMES;
-
-static mono_bool
-walk_stack (MonoMethod *method, int32_t native_offset, int32_t il_offset, mono_bool managed, void* data)
-{
-       FrameData *frame = (FrameData *)data;
-       if (method && frame->count < num_frames) {
-               frame->il_offsets [frame->count] = il_offset;
-               frame->native_offsets [frame->count] = native_offset;
-               frame->methods [frame->count++] = method;
-               //printf ("In %d %s at %d (native: %d)\n", frame->count, mono_method_get_name (method), il_offset, native_offset);
-       }
-       return frame->count == num_frames;
-}
-
-/*
- * a note about stack walks: they can cause more profiler events to fire,
- * so we need to make sure they don't happen after we started emitting an
- * event, hence the collect_bt/emit_bt split.
- */
-static void
-collect_bt (FrameData *data)
-{
-       data->count = 0;
-       mono_stack_walk_no_il (walk_stack, data);
-}
-
-static void
-emit_bt (MonoProfiler *prof, LogBuffer *logbuffer, FrameData *data)
-{
-       /* FIXME: this is actually tons of data and we should
-        * just output it the first time and use an id the next
-        */
-       if (data->count > num_frames)
-               printf ("bad num frames: %d\n", data->count);
-       emit_value (logbuffer, 0); /* flags */
-       emit_value (logbuffer, data->count);
-       //if (*p != data.count) {
-       //      printf ("bad num frames enc at %d: %d -> %d\n", count, data.count, *p); printf ("frames end: %p->%p\n", p, logbuffer->cursor); exit(0);}
-       while (data->count) {
-               emit_method_as_ptr (prof, logbuffer, data->methods [--data->count]);
-       }
-}
-
-static void
-gc_alloc (MonoProfiler *prof, MonoObject *obj, MonoClass *klass)
-{
-       uint64_t now;
-       uintptr_t len;
-       int do_bt = (nocalls && InterlockedRead (&runtime_inited) && !notraces)? TYPE_ALLOC_BT: 0;
-       FrameData data;
-       LogBuffer *logbuffer;
-       len = mono_object_get_size (obj);
-       /* account for object alignment in the heap */
-       len += 7;
-       len &= ~7;
-       if (do_bt)
-               collect_bt (&data);
-       logbuffer = ensure_logbuf (
-               EVENT_SIZE /* event */ +
-               LEB128_SIZE /* time */ +
-               LEB128_SIZE /* klass */ +
-               LEB128_SIZE /* obj */ +
-               LEB128_SIZE /* size */ +
-               (do_bt ? (
-                       LEB128_SIZE /* flags */ +
-                       LEB128_SIZE /* count */ +
-                       data.count * (
-                               LEB128_SIZE /* method */
-                       )
-               ) : 0)
-       );
-       now = current_time ();
-       ENTER_LOG (logbuffer, "gcalloc");
-       emit_byte (logbuffer, do_bt | TYPE_ALLOC);
-       emit_time (logbuffer, now);
-       emit_ptr (logbuffer, klass);
-       emit_obj (logbuffer, obj);
-       emit_value (logbuffer, len);
-       if (do_bt)
-               emit_bt (prof, logbuffer, &data);
-       EXIT_LOG (logbuffer);
-       if (logbuffer->next)
-               safe_send (prof, logbuffer);
-       process_requests (prof);
-       //printf ("gc alloc %s at %p\n", mono_class_get_name (klass), obj);
-}
-
-static void
-gc_moves (MonoProfiler *prof, void **objects, int num)
-{
-       int i;
-       uint64_t now;
-       LogBuffer *logbuffer = ensure_logbuf (
-               EVENT_SIZE /* event */ +
-               LEB128_SIZE /* time */ +
-               LEB128_SIZE /* num */ +
-               num * (
-                       LEB128_SIZE /* object */
-               )
-       );
-       now = current_time ();
-       ENTER_LOG (logbuffer, "gcmove");
-       emit_byte (logbuffer, TYPE_GC_MOVE | TYPE_GC);
-       emit_time (logbuffer, now);
-       emit_value (logbuffer, num);
-       for (i = 0; i < num; ++i)
-               emit_obj (logbuffer, objects [i]);
-       //printf ("gc moved %d objects\n", num/2);
-       EXIT_LOG (logbuffer);
-}
-
-static void
-gc_roots (MonoProfiler *prof, int num, void **objects, int *root_types, uintptr_t *extra_info)
-{
-       int i;
-       LogBuffer *logbuffer = ensure_logbuf (
-               EVENT_SIZE /* event */ +
-               LEB128_SIZE /* num */ +
-               LEB128_SIZE /* collections */ +
-               num * (
-                       LEB128_SIZE /* object */ +
-                       LEB128_SIZE /* root type */ +
-                       LEB128_SIZE /* extra info */
-               )
-       );
-       ENTER_LOG (logbuffer, "gcroots");
-       emit_byte (logbuffer, TYPE_HEAP_ROOT | TYPE_HEAP);
-       emit_value (logbuffer, num);
-       emit_value (logbuffer, mono_gc_collection_count (mono_gc_max_generation ()));
-       for (i = 0; i < num; ++i) {
-               emit_obj (logbuffer, objects [i]);
-               emit_value (logbuffer, root_types [i]);
-               emit_value (logbuffer, extra_info [i]);
-       }
-       EXIT_LOG (logbuffer);
-}
-
-static void
-gc_handle (MonoProfiler *prof, int op, int type, uintptr_t handle, MonoObject *obj)
-{
-       int do_bt = nocalls && InterlockedRead (&runtime_inited) && !notraces;
-       uint64_t now;
-       FrameData data;
-
-       if (do_bt)
-               collect_bt (&data);
-
-       LogBuffer *logbuffer = ensure_logbuf (
-               EVENT_SIZE /* event */ +
-               LEB128_SIZE /* time */ +
-               LEB128_SIZE /* type */ +
-               LEB128_SIZE /* handle */ +
-               (op == MONO_PROFILER_GC_HANDLE_CREATED ? (
-                       LEB128_SIZE /* obj */
-               ) : 0) +
-               (do_bt ? (
-                       LEB128_SIZE /* flags */ +
-                       LEB128_SIZE /* count */ +
-                       data.count * (
-                               LEB128_SIZE /* method */
-                       )
-               ) : 0)
-       );
-
-       now = current_time ();
-       ENTER_LOG (logbuffer, "gchandle");
-
-       if (op == MONO_PROFILER_GC_HANDLE_CREATED)
-               emit_byte (logbuffer, (do_bt ? TYPE_GC_HANDLE_CREATED_BT : TYPE_GC_HANDLE_CREATED) | TYPE_GC);
-       else if (op == MONO_PROFILER_GC_HANDLE_DESTROYED)
-               emit_byte (logbuffer, (do_bt ? TYPE_GC_HANDLE_DESTROYED_BT : TYPE_GC_HANDLE_DESTROYED) | TYPE_GC);
-       else
-               g_assert_not_reached ();
-
-       emit_time (logbuffer, now);
-       emit_value (logbuffer, type);
-       emit_value (logbuffer, handle);
-
-       if (op == MONO_PROFILER_GC_HANDLE_CREATED)
-               emit_obj (logbuffer, obj);
-
-       if (do_bt)
-               emit_bt (prof, logbuffer, &data);
-
-       EXIT_LOG (logbuffer);
-       process_requests (prof);
-}
-
-static char*
-push_nesting (char *p, MonoClass *klass)
-{
-       MonoClass *nesting;
-       const char *name;
-       const char *nspace;
-       nesting = mono_class_get_nesting_type (klass);
-       if (nesting) {
-               p = push_nesting (p, nesting);
-               *p++ = '/';
-               *p = 0;
-       }
-       name = mono_class_get_name (klass);
-       nspace = mono_class_get_namespace (klass);
-       if (*nspace) {
-               strcpy (p, nspace);
-               p += strlen (nspace);
-               *p++ = '.';
-               *p = 0;
-       }
-       strcpy (p, name);
-       p += strlen (name);
-       return p;
-}
-
-static char*
-type_name (MonoClass *klass)
-{
-       char buf [1024];
-       char *p;
-       push_nesting (buf, klass);
-       p = (char *)malloc (strlen (buf) + 1);
-       strcpy (p, buf);
-       return p;
-}
-
-static void
-image_loaded (MonoProfiler *prof, MonoImage *image, int result)
-{
-       uint64_t now;
-       const char *name;
-       int nlen;
-       LogBuffer *logbuffer;
-       if (result != MONO_PROFILE_OK)
-               return;
-       name = mono_image_get_filename (image);
-       nlen = strlen (name) + 1;
-       logbuffer = ensure_logbuf (
-               EVENT_SIZE /* event */ +
-               LEB128_SIZE /* time */ +
-               EVENT_SIZE /* type */ +
-               LEB128_SIZE /* image */ +
-               LEB128_SIZE /* flags */ +
-               nlen /* name */
-       );
-       now = current_time ();
-       ENTER_LOG (logbuffer, "image");
-       emit_byte (logbuffer, TYPE_END_LOAD | TYPE_METADATA);
-       emit_time (logbuffer, now);
-       emit_byte (logbuffer, TYPE_IMAGE);
-       emit_ptr (logbuffer, image);
-       emit_value (logbuffer, 0); /* flags */
-       memcpy (logbuffer->cursor, name, nlen);
-       logbuffer->cursor += nlen;
-       //printf ("loaded image %p (%s)\n", image, name);
-       EXIT_LOG (logbuffer);
-       if (logbuffer->next)
-               safe_send (prof, logbuffer);
-       process_requests (prof);
-
-       InterlockedIncrement (&image_loads);
-}
-
-static void
-image_unloaded (MonoProfiler *prof, MonoImage *image)
-{
-       const char *name = mono_image_get_filename (image);
-       int nlen = strlen (name) + 1;
-       LogBuffer *logbuffer = ensure_logbuf (
-               EVENT_SIZE /* event */ +
-               LEB128_SIZE /* time */ +
-               EVENT_SIZE /* type */ +
-               LEB128_SIZE /* image */ +
-               LEB128_SIZE /* flags */ +
-               nlen /* name */
-       );
-       uint64_t now = current_time ();
-
-       ENTER_LOG (logbuffer, "image-unload");
-       emit_byte (logbuffer, TYPE_END_UNLOAD | TYPE_METADATA);
-       emit_time (logbuffer, now);
-       emit_byte (logbuffer, TYPE_IMAGE);
-       emit_ptr (logbuffer, image);
-       emit_value (logbuffer, 0); /* flags */
-       memcpy (logbuffer->cursor, name, nlen);
-       logbuffer->cursor += nlen;
-       EXIT_LOG (logbuffer);
-
-       if (logbuffer->next)
-               safe_send (prof, logbuffer);
-
-       process_requests (prof);
-
-       InterlockedIncrement (&image_unloads);
-}
-
-static void
-assembly_loaded (MonoProfiler *prof, MonoAssembly *assembly, int result)
-{
-       if (result != MONO_PROFILE_OK)
-               return;
-
-       char *name = mono_stringify_assembly_name (mono_assembly_get_name (assembly));
-       int nlen = strlen (name) + 1;
-       LogBuffer *logbuffer = ensure_logbuf (
-               EVENT_SIZE /* event */ +
-               LEB128_SIZE /* time */ +
-               EVENT_SIZE /* type */ +
-               LEB128_SIZE /* assembly */ +
-               LEB128_SIZE /* flags */ +
-               nlen /* name */
-       );
-       uint64_t now = current_time ();
-
-       ENTER_LOG (logbuffer, "assembly-load");
-       emit_byte (logbuffer, TYPE_END_LOAD | TYPE_METADATA);
-       emit_time (logbuffer, now);
-       emit_byte (logbuffer, TYPE_ASSEMBLY);
-       emit_ptr (logbuffer, assembly);
-       emit_value (logbuffer, 0); /* flags */
-       memcpy (logbuffer->cursor, name, nlen);
-       logbuffer->cursor += nlen;
-       EXIT_LOG (logbuffer);
-
-       mono_free (name);
-
-       if (logbuffer->next)
-               safe_send (prof, logbuffer);
-
-       process_requests (prof);
-
-       InterlockedIncrement (&assembly_loads);
-}
-
-static void
-assembly_unloaded (MonoProfiler *prof, MonoAssembly *assembly)
-{
-       char *name = mono_stringify_assembly_name (mono_assembly_get_name (assembly));
-       int nlen = strlen (name) + 1;
-       LogBuffer *logbuffer = ensure_logbuf (
-               EVENT_SIZE /* event */ +
-               LEB128_SIZE /* time */ +
-               EVENT_SIZE /* type */ +
-               LEB128_SIZE /* assembly */ +
-               LEB128_SIZE /* flags */ +
-               nlen /* name */
-       );
-       uint64_t now = current_time ();
-
-       ENTER_LOG (logbuffer, "assembly-unload");
-       emit_byte (logbuffer, TYPE_END_UNLOAD | TYPE_METADATA);
-       emit_time (logbuffer, now);
-       emit_byte (logbuffer, TYPE_ASSEMBLY);
-       emit_ptr (logbuffer, assembly);
-       emit_value (logbuffer, 0); /* flags */
-       memcpy (logbuffer->cursor, name, nlen);
-       logbuffer->cursor += nlen;
-       EXIT_LOG (logbuffer);
-
-       mono_free (name);
-
-       if (logbuffer->next)
-               safe_send (prof, logbuffer);
-
-       process_requests (prof);
-
-       InterlockedIncrement (&assembly_unloads);
-}
-
-static void
-class_loaded (MonoProfiler *prof, MonoClass *klass, int result)
-{
-       uint64_t now;
-       char *name;
-       int nlen;
-       MonoImage *image;
-       LogBuffer *logbuffer;
-       if (result != MONO_PROFILE_OK)
-               return;
-       if (InterlockedRead (&runtime_inited))
-               name = mono_type_get_name (mono_class_get_type (klass));
-       else
-               name = type_name (klass);
-       nlen = strlen (name) + 1;
-       image = mono_class_get_image (klass);
-       logbuffer = ensure_logbuf (
-               EVENT_SIZE /* event */ +
-               LEB128_SIZE /* time */ +
-               EVENT_SIZE /* type */ +
-               LEB128_SIZE /* klass */ +
-               LEB128_SIZE /* image */ +
-               LEB128_SIZE /* flags */ +
-               nlen /* name */
-       );
-       now = current_time ();
-       ENTER_LOG (logbuffer, "class");
-       emit_byte (logbuffer, TYPE_END_LOAD | TYPE_METADATA);
-       emit_time (logbuffer, now);
-       emit_byte (logbuffer, TYPE_CLASS);
-       emit_ptr (logbuffer, klass);
-       emit_ptr (logbuffer, image);
-       emit_value (logbuffer, 0); /* flags */
-       memcpy (logbuffer->cursor, name, nlen);
-       logbuffer->cursor += nlen;
-       //printf ("loaded class %p (%s)\n", klass, name);
-       if (runtime_inited)
-               mono_free (name);
-       else
-               free (name);
-       EXIT_LOG (logbuffer);
-       if (logbuffer->next)
-               safe_send (prof, logbuffer);
-       process_requests (prof);
-
-       InterlockedIncrement (&class_loads);
-}
-
-static void
-class_unloaded (MonoProfiler *prof, MonoClass *klass)
-{
-       char *name;
-
-       if (InterlockedRead (&runtime_inited))
-               name = mono_type_get_name (mono_class_get_type (klass));
-       else
-               name = type_name (klass);
-
-       int nlen = strlen (name) + 1;
-       MonoImage *image = mono_class_get_image (klass);
-       LogBuffer *logbuffer = ensure_logbuf (
-               EVENT_SIZE /* event */ +
-               LEB128_SIZE /* time */ +
-               EVENT_SIZE /* type */ +
-               LEB128_SIZE /* klass */ +
-               LEB128_SIZE /* image */ +
-               LEB128_SIZE /* flags */ +
-               nlen /* name */
-       );
-       uint64_t now = current_time ();
-
-       ENTER_LOG (logbuffer, "class-unload");
-       emit_byte (logbuffer, TYPE_END_UNLOAD | TYPE_METADATA);
-       emit_time (logbuffer, now);
-       emit_byte (logbuffer, TYPE_CLASS);
-       emit_ptr (logbuffer, klass);
-       emit_ptr (logbuffer, image);
-       emit_value (logbuffer, 0); /* flags */
-       memcpy (logbuffer->cursor, name, nlen);
-       logbuffer->cursor += nlen;
-       EXIT_LOG (logbuffer);
-
-       if (runtime_inited)
-               mono_free (name);
-       else
-               free (name);
-
-       if (logbuffer->next)
-               safe_send (prof, logbuffer);
-
-       process_requests (prof);
-
-       InterlockedIncrement (&class_unloads);
-}
-
-#ifndef DISABLE_HELPER_THREAD
-static void process_method_enter_coverage (MonoProfiler *prof, MonoMethod *method);
-#endif /* DISABLE_HELPER_THREAD */
-
-static void
-method_enter (MonoProfiler *prof, MonoMethod *method)
-{
-       uint64_t now = current_time ();
-
-#ifndef DISABLE_HELPER_THREAD
-       process_method_enter_coverage (prof, method);
-#endif /* DISABLE_HELPER_THREAD */
-
-       LogBuffer *logbuffer = ensure_logbuf (
-               EVENT_SIZE /* event */ +
-               LEB128_SIZE /* time */ +
-               LEB128_SIZE /* method */
-       );
-       if (logbuffer->call_depth++ > max_call_depth)
-               return;
-       ENTER_LOG (logbuffer, "enter");
-       emit_byte (logbuffer, TYPE_ENTER | TYPE_METHOD);
-       emit_time (logbuffer, now);
-       emit_method (prof, logbuffer, method);
-       EXIT_LOG (logbuffer);
-
-       process_requests (prof);
-}
-
-static void
-method_leave (MonoProfiler *prof, MonoMethod *method)
-{
-       uint64_t now;
-       LogBuffer *logbuffer = ensure_logbuf (
-               EVENT_SIZE /* event */ +
-               LEB128_SIZE /* time */ +
-               LEB128_SIZE /* method */
-       );
-       if (--logbuffer->call_depth > max_call_depth)
-               return;
-       now = current_time ();
-       ENTER_LOG (logbuffer, "leave");
-       emit_byte (logbuffer, TYPE_LEAVE | TYPE_METHOD);
-       emit_time (logbuffer, now);
-       emit_method (prof, logbuffer, method);
-       EXIT_LOG (logbuffer);
-       if (logbuffer->next)
-               safe_send (prof, logbuffer);
-       process_requests (prof);
-}
-
-static void
-method_exc_leave (MonoProfiler *prof, MonoMethod *method)
-{
-       uint64_t now;
-       LogBuffer *logbuffer;
-       if (nocalls)
-               return;
-       logbuffer = ensure_logbuf (
-               EVENT_SIZE /* event */ +
-               LEB128_SIZE /* time */ +
-               LEB128_SIZE /* method */
-       );
-       if (--logbuffer->call_depth > max_call_depth)
-               return;
-       now = current_time ();
-       ENTER_LOG (logbuffer, "eleave");
-       emit_byte (logbuffer, TYPE_EXC_LEAVE | TYPE_METHOD);
-       emit_time (logbuffer, now);
-       emit_method (prof, logbuffer, method);
-       EXIT_LOG (logbuffer);
-       process_requests (prof);
-}
-
-static void
-method_jitted (MonoProfiler *prof, MonoMethod *method, MonoJitInfo *ji, int result)
-{
-       if (result != MONO_PROFILE_OK)
-               return;
-
-       register_method_local (prof, method, ji);
-
-       process_requests (prof);
-}
-
-static void
-code_buffer_new (MonoProfiler *prof, void *buffer, int size, MonoProfilerCodeBufferType type, void *data)
-{
-       uint64_t now;
-       int nlen;
-       char *name;
-       LogBuffer *logbuffer;
-       if (type == MONO_PROFILER_CODE_BUFFER_SPECIFIC_TRAMPOLINE) {
-               name = (char *)data;
-               nlen = strlen (name) + 1;
-       } else {
-               name = NULL;
-               nlen = 0;
-       }
-       logbuffer = ensure_logbuf (
-               EVENT_SIZE /* event */ +
-               LEB128_SIZE /* time */ +
-               LEB128_SIZE /* type */ +
-               LEB128_SIZE /* buffer */ +
-               LEB128_SIZE /* size */ +
-               (name ? (
-                       nlen /* name */
-               ) : 0)
-       );
-       now = current_time ();
-       ENTER_LOG (logbuffer, "code buffer");
-       emit_byte (logbuffer, TYPE_JITHELPER | TYPE_RUNTIME);
-       emit_time (logbuffer, now);
-       emit_value (logbuffer, type);
-       emit_ptr (logbuffer, buffer);
-       emit_value (logbuffer, size);
-       if (name) {
-               memcpy (logbuffer->cursor, name, nlen);
-               logbuffer->cursor += nlen;
-       }
-       EXIT_LOG (logbuffer);
-       process_requests (prof);
-}
-
-static void
-throw_exc (MonoProfiler *prof, MonoObject *object)
-{
-       int do_bt = (nocalls && InterlockedRead (&runtime_inited) && !notraces)? TYPE_EXCEPTION_BT: 0;
-       uint64_t now;
-       FrameData data;
-       LogBuffer *logbuffer;
-       if (do_bt)
-               collect_bt (&data);
-       logbuffer = ensure_logbuf (
-               EVENT_SIZE /* event */ +
-               LEB128_SIZE /* time */ +
-               LEB128_SIZE /* object */ +
-               (do_bt ? (
-                       LEB128_SIZE /* flags */ +
-                       LEB128_SIZE /* count */ +
-                       data.count * (
-                               LEB128_SIZE /* method */
-                       )
-               ) : 0)
-       );
-       now = current_time ();
-       ENTER_LOG (logbuffer, "throw");
-       emit_byte (logbuffer, do_bt | TYPE_EXCEPTION);
-       emit_time (logbuffer, now);
-       emit_obj (logbuffer, object);
-       if (do_bt)
-               emit_bt (prof, logbuffer, &data);
-       EXIT_LOG (logbuffer);
-       process_requests (prof);
-}
-
-static void
-clause_exc (MonoProfiler *prof, MonoMethod *method, int clause_type, int clause_num)
-{
-       uint64_t now;
-       LogBuffer *logbuffer = ensure_logbuf (
-               EVENT_SIZE /* event */ +
-               LEB128_SIZE /* time */ +
-               LEB128_SIZE /* clause type */ +
-               LEB128_SIZE /* clause num */ +
-               LEB128_SIZE /* method */
-       );
-       now = current_time ();
-       ENTER_LOG (logbuffer, "clause");
-       emit_byte (logbuffer, TYPE_EXCEPTION | TYPE_CLAUSE);
-       emit_time (logbuffer, now);
-       emit_value (logbuffer, clause_type);
-       emit_value (logbuffer, clause_num);
-       emit_method (prof, logbuffer, method);
-       EXIT_LOG (logbuffer);
-
-       process_requests (prof);
-}
-
-static void
-monitor_event (MonoProfiler *profiler, MonoObject *object, MonoProfilerMonitorEvent event)
-{
-       int do_bt = (nocalls && InterlockedRead (&runtime_inited) && !notraces && event == MONO_PROFILER_MONITOR_CONTENTION)? TYPE_MONITOR_BT: 0;
-       uint64_t now;
-       FrameData data;
-       LogBuffer *logbuffer;
-       if (do_bt)
-               collect_bt (&data);
-       logbuffer = ensure_logbuf (
-               EVENT_SIZE /* event */ +
-               LEB128_SIZE /* time */ +
-               LEB128_SIZE /* object */ +
-               (do_bt ? (
-                       LEB128_SIZE /* flags */ +
-                       LEB128_SIZE /* count */ +
-                       data.count * (
-                               LEB128_SIZE /* method */
-                       )
-               ) : 0)
-       );
-       now = current_time ();
-       ENTER_LOG (logbuffer, "monitor");
-       emit_byte (logbuffer, (event << 4) | do_bt | TYPE_MONITOR);
-       emit_time (logbuffer, now);
-       emit_obj (logbuffer, object);
-       if (do_bt)
-               emit_bt (profiler, logbuffer, &data);
-       EXIT_LOG (logbuffer);
-       process_requests (profiler);
-}
-
-static void
-thread_start (MonoProfiler *prof, uintptr_t tid)
-{
-       //printf ("thread start %p\n", (void*)tid);
-       init_thread ();
-
-       LogBuffer *logbuffer = ensure_logbuf (
-               EVENT_SIZE /* event */ +
-               LEB128_SIZE /* time */ +
-               EVENT_SIZE /* type */ +
-               LEB128_SIZE /* tid */ +
-               LEB128_SIZE /* flags */
-       );
-       uint64_t now = current_time ();
-
-       ENTER_LOG (logbuffer, "thread-start");
-       emit_byte (logbuffer, TYPE_END_LOAD | TYPE_METADATA);
-       emit_time (logbuffer, now);
-       emit_byte (logbuffer, TYPE_THREAD);
-       emit_ptr (logbuffer, (void*) tid);
-       emit_value (logbuffer, 0); /* flags */
-       EXIT_LOG (logbuffer);
-
-       if (logbuffer->next)
-               safe_send (prof, logbuffer);
-
-       process_requests (prof);
-
-       InterlockedIncrement (&thread_starts);
-}
-
-static void
-thread_end (MonoProfiler *prof, uintptr_t tid)
-{
-       if (TLS_GET (LogBuffer, tlsbuffer)) {
-               LogBuffer *logbuffer = ensure_logbuf (
-                       EVENT_SIZE /* event */ +
-                       LEB128_SIZE /* time */ +
-                       EVENT_SIZE /* type */ +
-                       LEB128_SIZE /* tid */ +
-                       LEB128_SIZE /* flags */
-               );
-               uint64_t now = current_time ();
-
-               ENTER_LOG (logbuffer, "thread-end");
-               emit_byte (logbuffer, TYPE_END_UNLOAD | TYPE_METADATA);
-               emit_time (logbuffer, now);
-               emit_byte (logbuffer, TYPE_THREAD);
-               emit_ptr (logbuffer, (void*) tid);
-               emit_value (logbuffer, 0); /* flags */
-               EXIT_LOG (logbuffer);
-
-               send_buffer (prof, TLS_GET (GPtrArray, tlsmethodlist), logbuffer);
-
-               /* Don't process requests as the thread is detached from the runtime. */
-       }
-
-       TLS_SET (tlsbuffer, NULL);
-       TLS_SET (tlsmethodlist, NULL);
-
-       InterlockedIncrement (&thread_ends);
-}
-
-static void
-domain_loaded (MonoProfiler *prof, MonoDomain *domain, int result)
-{
-       if (result != MONO_PROFILE_OK)
-               return;
-
-       LogBuffer *logbuffer = ensure_logbuf (
-               EVENT_SIZE /* event */ +
-               LEB128_SIZE /* time */ +
-               EVENT_SIZE /* type */ +
-               LEB128_SIZE /* domain id */ +
-               LEB128_SIZE /* flags */
-       );
-       uint64_t now = current_time ();
-
-       ENTER_LOG (logbuffer, "domain-start");
-       emit_byte (logbuffer, TYPE_END_LOAD | TYPE_METADATA);
-       emit_time (logbuffer, now);
-       emit_byte (logbuffer, TYPE_DOMAIN);
-       emit_ptr (logbuffer, (void*)(uintptr_t) mono_domain_get_id (domain));
-       emit_value (logbuffer, 0); /* flags */
-       EXIT_LOG (logbuffer);
-
-       if (logbuffer->next)
-               safe_send (prof, logbuffer);
-
-       process_requests (prof);
-
-       InterlockedIncrement (&domain_loads);
-}
-
-static void
-domain_unloaded (MonoProfiler *prof, MonoDomain *domain)
-{
-       LogBuffer *logbuffer = ensure_logbuf (
-               EVENT_SIZE /* event */ +
-               LEB128_SIZE /* time */ +
-               EVENT_SIZE /* type */ +
-               LEB128_SIZE /* domain id */ +
-               LEB128_SIZE /* flags */
-       );
-       uint64_t now = current_time ();
-
-       ENTER_LOG (logbuffer, "domain-end");
-       emit_byte (logbuffer, TYPE_END_UNLOAD | TYPE_METADATA);
-       emit_time (logbuffer, now);
-       emit_byte (logbuffer, TYPE_DOMAIN);
-       emit_ptr (logbuffer, (void*)(uintptr_t) mono_domain_get_id (domain));
-       emit_value (logbuffer, 0); /* flags */
-       EXIT_LOG (logbuffer);
-
-       if (logbuffer->next)
-               safe_send (prof, logbuffer);
-
-       process_requests (prof);
-
-       InterlockedIncrement (&domain_unloads);
-}
-
-static void
-domain_name (MonoProfiler *prof, MonoDomain *domain, const char *name)
-{
-       int nlen = strlen (name) + 1;
-       LogBuffer *logbuffer = ensure_logbuf (
-               EVENT_SIZE /* event */ +
-               LEB128_SIZE /* time */ +
-               EVENT_SIZE /* type */ +
-               LEB128_SIZE /* domain id */ +
-               LEB128_SIZE /* flags */ +
-               nlen /* name */
-       );
-       uint64_t now = current_time ();
-
-       ENTER_LOG (logbuffer, "domain-name");
-       emit_byte (logbuffer, TYPE_METADATA);
-       emit_time (logbuffer, now);
-       emit_byte (logbuffer, TYPE_DOMAIN);
-       emit_ptr (logbuffer, (void*)(uintptr_t) mono_domain_get_id (domain));
-       emit_value (logbuffer, 0); /* flags */
-       memcpy (logbuffer->cursor, name, nlen);
-       logbuffer->cursor += nlen;
-       EXIT_LOG (logbuffer);
-
-       if (logbuffer->next)
-               safe_send (prof, logbuffer);
-
-       process_requests (prof);
-}
-
-static void
-context_loaded (MonoProfiler *prof, MonoAppContext *context)
-{
-       LogBuffer *logbuffer = ensure_logbuf (
-               EVENT_SIZE /* event */ +
-               LEB128_SIZE /* time */ +
-               EVENT_SIZE /* type */ +
-               LEB128_SIZE /* context id */ +
-               LEB128_SIZE /* flags */ +
-               LEB128_SIZE /* domain id */
-       );
-       uint64_t now = current_time ();
-
-       ENTER_LOG (logbuffer, "context-start");
-       emit_byte (logbuffer, TYPE_END_LOAD | TYPE_METADATA);
-       emit_time (logbuffer, now);
-       emit_byte (logbuffer, TYPE_CONTEXT);
-       emit_ptr (logbuffer, (void*)(uintptr_t) mono_context_get_id (context));
-       emit_value (logbuffer, 0); /* flags */
-       emit_ptr (logbuffer, (void*)(uintptr_t) mono_context_get_domain_id (context));
-       EXIT_LOG (logbuffer);
-
-       if (logbuffer->next)
-               safe_send (prof, logbuffer);
-
-       process_requests (prof);
-
-       InterlockedIncrement (&context_loads);
-}
-
-static void
-context_unloaded (MonoProfiler *prof, MonoAppContext *context)
-{
-       LogBuffer *logbuffer = ensure_logbuf (
-               EVENT_SIZE /* event */ +
-               LEB128_SIZE /* time */ +
-               EVENT_SIZE /* type */ +
-               LEB128_SIZE /* context id */ +
-               LEB128_SIZE /* flags */ +
-               LEB128_SIZE /* domain id */
-       );
-       uint64_t now = current_time ();
-
-       ENTER_LOG (logbuffer, "context-end");
-       emit_byte (logbuffer, TYPE_END_UNLOAD | TYPE_METADATA);
-       emit_time (logbuffer, now);
-       emit_byte (logbuffer, TYPE_CONTEXT);
-       emit_ptr (logbuffer, (void*)(uintptr_t) mono_context_get_id (context));
-       emit_value (logbuffer, 0); /* flags */
-       emit_ptr (logbuffer, (void*)(uintptr_t) mono_context_get_domain_id (context));
-       EXIT_LOG (logbuffer);
-
-       if (logbuffer->next)
-               safe_send (prof, logbuffer);
-
-       process_requests (prof);
-
-       InterlockedIncrement (&context_unloads);
-}
-
-static void
-thread_name (MonoProfiler *prof, uintptr_t tid, const char *name)
-{
-       int len = strlen (name) + 1;
-       uint64_t now;
-       LogBuffer *logbuffer;
-       logbuffer = ensure_logbuf (
-               EVENT_SIZE /* event */ +
-               LEB128_SIZE /* time */ +
-               EVENT_SIZE /* type */ +
-               LEB128_SIZE /* tid */ +
-               LEB128_SIZE /* flags */ +
-               len /* name */
-       );
-       now = current_time ();
-       ENTER_LOG (logbuffer, "tname");
-       emit_byte (logbuffer, TYPE_METADATA);
-       emit_time (logbuffer, now);
-       emit_byte (logbuffer, TYPE_THREAD);
-       emit_ptr (logbuffer, (void*)tid);
-       emit_value (logbuffer, 0); /* flags */
-       memcpy (logbuffer->cursor, name, len);
-       logbuffer->cursor += len;
-       EXIT_LOG (logbuffer);
-
-       if (logbuffer->next)
-               safe_send (prof, logbuffer);
-
-       process_requests (prof);
-}
-
-typedef struct {
-       MonoMethod *method;
-       MonoDomain *domain;
-       void *base_address;
-       int offset;
-} AsyncFrameInfo;
-
-typedef struct {
-       MonoLockFreeQueueNode node;
-       MonoProfiler *prof;
-       uint64_t elapsed;
-       uintptr_t tid;
-       void *ip;
-       int count;
-       AsyncFrameInfo frames [MONO_ZERO_LEN_ARRAY];
-} SampleHit;
-
-static mono_bool
-async_walk_stack (MonoMethod *method, MonoDomain *domain, void *base_address, int offset, void *data)
-{
-       SampleHit *sample = (SampleHit *) data;
-
-       if (sample->count < num_frames) {
-               int i = sample->count;
-
-               sample->frames [i].method = method;
-               sample->frames [i].domain = domain;
-               sample->frames [i].base_address = base_address;
-               sample->frames [i].offset = offset;
-
-               sample->count++;
-       }
-
-       return sample->count == num_frames;
-}
-
-#define SAMPLE_SLOT_SIZE(FRAMES) (sizeof (SampleHit) + sizeof (AsyncFrameInfo) * (FRAMES - MONO_ZERO_LEN_ARRAY))
-#define SAMPLE_BLOCK_SIZE (mono_pagesize ())
-
-static void
-enqueue_sample_hit (gpointer p)
-{
-       SampleHit *sample = p;
-
-       mono_lock_free_queue_node_unpoison (&sample->node);
-       mono_lock_free_queue_enqueue (&sample->prof->dumper_queue, &sample->node);
-       mono_os_sem_post (&sample->prof->dumper_queue_sem);
-
-       InterlockedIncrement (&sample_flushes);
-}
-
-static void
-mono_sample_hit (MonoProfiler *profiler, unsigned char *ip, void *context)
-{
-       /*
-        * Please note: We rely on the runtime loading the profiler with
-        * MONO_DL_EAGER (RTLD_NOW) so that references to runtime functions within
-        * this function (and its siblings) are resolved when the profiler is
-        * loaded. Otherwise, we would potentially invoke the dynamic linker when
-        * invoking runtime functions, which is not async-signal-safe.
-        */
-
-       if (in_shutdown)
-               return;
-
-       InterlockedIncrement (&sample_hits);
-
-       uint64_t now = current_time ();
-
-       SampleHit *sample = (SampleHit *) mono_lock_free_queue_dequeue (&profiler->sample_reuse_queue);
-
-       if (!sample) {
-               /*
-                * If we're out of reusable sample events and we're not allowed to
-                * allocate more, we have no choice but to drop the event.
-                */
-               if (InterlockedRead (&sample_allocations) >= max_allocated_sample_hits)
-                       return;
-
-               sample = mono_lock_free_alloc (&profiler->sample_allocator);
-               sample->prof = profiler;
-               mono_lock_free_queue_node_init (&sample->node, TRUE);
-
-               InterlockedIncrement (&sample_allocations);
-       }
-
-       sample->count = 0;
-       mono_stack_walk_async_safe (&async_walk_stack, context, sample);
-
-       uintptr_t elapsed = (now - profiler->startup_time) / 10000;
-
-       sample->elapsed = elapsed;
-       sample->tid = thread_id ();
-       sample->ip = ip;
-
-       if (do_debug) {
-               int len;
-               char buf [256];
-               snprintf (buf, sizeof (buf), "hit at %p in thread %p after %llu ms\n", ip, (void *) thread_id (), (unsigned long long int) elapsed / 100);
-               len = strlen (buf);
-               ign_res (write (2, buf, len));
-       }
-
-       mono_thread_hazardous_try_free (sample, enqueue_sample_hit);
-}
-
-static uintptr_t *code_pages = 0;
-static int num_code_pages = 0;
-static int size_code_pages = 0;
-#define CPAGE_SHIFT (9)
-#define CPAGE_SIZE (1 << CPAGE_SHIFT)
-#define CPAGE_MASK (~(CPAGE_SIZE - 1))
-#define CPAGE_ADDR(p) ((p) & CPAGE_MASK)
-
-static uintptr_t
-add_code_page (uintptr_t *hash, uintptr_t hsize, uintptr_t page)
-{
-       uintptr_t i;
-       uintptr_t start_pos;
-       start_pos = (page >> CPAGE_SHIFT) % hsize;
-       i = start_pos;
-       do {
-               if (hash [i] && CPAGE_ADDR (hash [i]) == CPAGE_ADDR (page)) {
-                       return 0;
-               } else if (!hash [i]) {
-                       hash [i] = page;
-                       return 1;
-               }
-               /* wrap around */
-               if (++i == hsize)
-                       i = 0;
-       } while (i != start_pos);
-       /* should not happen */
-       printf ("failed code page store\n");
-       return 0;
-}
-
-static void
-add_code_pointer (uintptr_t ip)
-{
-       uintptr_t i;
-       if (num_code_pages * 2 >= size_code_pages) {
-               uintptr_t *n;
-               uintptr_t old_size = size_code_pages;
-               size_code_pages *= 2;
-               if (size_code_pages == 0)
-                       size_code_pages = 16;
-               n = (uintptr_t *)calloc (sizeof (uintptr_t) * size_code_pages, 1);
-               for (i = 0; i < old_size; ++i) {
-                       if (code_pages [i])
-                               add_code_page (n, size_code_pages, code_pages [i]);
-               }
-               if (code_pages)
-                       free (code_pages);
-               code_pages = n;
-       }
-       num_code_pages += add_code_page (code_pages, size_code_pages, ip & CPAGE_MASK);
-}
-
-/* ELF code crashes on some systems. */
-//#if defined(HAVE_DL_ITERATE_PHDR) && defined(ELFMAG0)
-#if 0
-static void
-dump_ubin (const char *filename, uintptr_t load_addr, uint64_t offset, uintptr_t size)
-{
-       uint64_t now;
-       LogBuffer *logbuffer;
-       int len;
-       len = strlen (filename) + 1;
-       now = current_time ();
-       logbuffer = ensure_logbuf (
-               EVENT_SIZE /* event */ +
-               LEB128_SIZE /* time */ +
-               LEB128_SIZE /* load address */ +
-               LEB128_SIZE /* offset */ +
-               LEB128_SIZE /* size */ +
-               nlen /* file name */
-       );
-       emit_byte (logbuffer, TYPE_SAMPLE | TYPE_SAMPLE_UBIN);
-       emit_time (logbuffer, now);
-       emit_svalue (logbuffer, load_addr);
-       emit_uvalue (logbuffer, offset);
-       emit_uvalue (logbuffer, size);
-       memcpy (logbuffer->cursor, filename, len);
-       logbuffer->cursor += len;
-}
-#endif
-
-static void
-dump_usym (const char *name, uintptr_t value, uintptr_t size)
-{
-       LogBuffer *logbuffer;
-       int len;
-       len = strlen (name) + 1;
-       logbuffer = ensure_logbuf (
-               EVENT_SIZE /* event */ +
-               LEB128_SIZE /* value */ +
-               LEB128_SIZE /* size */ +
-               len /* name */
-       );
-       emit_byte (logbuffer, TYPE_SAMPLE | TYPE_SAMPLE_USYM);
-       emit_ptr (logbuffer, (void*)value);
-       emit_value (logbuffer, size);
-       memcpy (logbuffer->cursor, name, len);
-       logbuffer->cursor += len;
-}
-
-/* ELF code crashes on some systems. */
-//#if defined(ELFMAG0)
-#if 0
-
-#if SIZEOF_VOID_P == 4
-#define ELF_WSIZE 32
-#else
-#define ELF_WSIZE 64
-#endif
-#ifndef ElfW
-#define ElfW(type)      _ElfW (Elf, ELF_WSIZE, type)
-#define _ElfW(e,w,t)    _ElfW_1 (e, w, _##t)
-#define _ElfW_1(e,w,t)  e##w##t
-#endif
-
-static void
-dump_elf_symbols (ElfW(Sym) *symbols, int num_symbols, const char *strtab, void *load_addr)
-{
-       int i;
-       for (i = 0; i < num_symbols; ++i) {
-               const char* sym;
-               sym =  strtab + symbols [i].st_name;
-               if (!symbols [i].st_name || !symbols [i].st_size || (symbols [i].st_info & 0xf) != STT_FUNC)
-                       continue;
-               //printf ("symbol %s at %d\n", sym, symbols [i].st_value);
-               dump_usym (sym, (uintptr_t)load_addr + symbols [i].st_value, symbols [i].st_size);
-       }
-}
-
-static int
-read_elf_symbols (MonoProfiler *prof, const char *filename, void *load_addr)
-{
-       int fd, i;
-       void *data;
-       struct stat statb;
-       uint64_t file_size;
-       ElfW(Ehdr) *header;
-       ElfW(Shdr) *sheader;
-       ElfW(Shdr) *shstrtabh;
-       ElfW(Shdr) *symtabh = NULL;
-       ElfW(Shdr) *strtabh = NULL;
-       ElfW(Sym) *symbols = NULL;
-       const char *strtab;
-       int num_symbols;
-
-       fd = open (filename, O_RDONLY);
-       if (fd < 0)
-               return 0;
-       if (fstat (fd, &statb) != 0) {
-               close (fd);
-               return 0;
-       }
-       file_size = statb.st_size;
-       data = mmap (NULL, file_size, PROT_READ, MAP_PRIVATE, fd, 0);
-       close (fd);
-       if (data == MAP_FAILED)
-               return 0;
-       header = data;
-       if (header->e_ident [EI_MAG0] != ELFMAG0 ||
-                       header->e_ident [EI_MAG1] != ELFMAG1 ||
-                       header->e_ident [EI_MAG2] != ELFMAG2 ||
-                       header->e_ident [EI_MAG3] != ELFMAG3 ) {
-               munmap (data, file_size);
-               return 0;
-       }
-       sheader = (void*)((char*)data + header->e_shoff);
-       shstrtabh = (void*)((char*)sheader + (header->e_shentsize * header->e_shstrndx));
-       strtab = (const char*)data + shstrtabh->sh_offset;
-       for (i = 0; i < header->e_shnum; ++i) {
-               //printf ("section header: %d\n", sheader->sh_type);
-               if (sheader->sh_type == SHT_SYMTAB) {
-                       symtabh = sheader;
-                       strtabh = (void*)((char*)data + header->e_shoff + sheader->sh_link * header->e_shentsize);
-                       /*printf ("symtab section header: %d, .strstr: %d\n", i, sheader->sh_link);*/
-                       break;
-               }
-               sheader = (void*)((char*)sheader + header->e_shentsize);
-       }
-       if (!symtabh || !strtabh) {
-               munmap (data, file_size);
-               return 0;
-       }
-       strtab = (const char*)data + strtabh->sh_offset;
-       num_symbols = symtabh->sh_size / symtabh->sh_entsize;
-       symbols = (void*)((char*)data + symtabh->sh_offset);
-       dump_elf_symbols (symbols, num_symbols, strtab, load_addr);
-       munmap (data, file_size);
-       return 1;
-}
-#endif
-
-/* ELF code crashes on some systems. */
-//#if defined(HAVE_DL_ITERATE_PHDR) && defined(ELFMAG0)
-#if 0
-static int
-elf_dl_callback (struct dl_phdr_info *info, size_t size, void *data)
-{
-       MonoProfiler *prof = data;
-       char buf [256];
-       const char *filename;
-       BinaryObject *obj;
-       char *a = (void*)info->dlpi_addr;
-       int i, num_sym;
-       ElfW(Dyn) *dyn = NULL;
-       ElfW(Sym) *symtab = NULL;
-       ElfW(Word) *hash_table = NULL;
-       ElfW(Ehdr) *header = NULL;
-       const char* strtab = NULL;
-       for (obj = prof->binary_objects; obj; obj = obj->next) {
-               if (obj->addr == a)
-                       return 0;
-       }
-       filename = info->dlpi_name;
-       if (!filename)
-               return 0;
-       if (!info->dlpi_addr && !filename [0]) {
-               int l = readlink ("/proc/self/exe", buf, sizeof (buf) - 1);
-               if (l > 0) {
-                       buf [l] = 0;
-                       filename = buf;
-               }
-       }
-       obj = calloc (sizeof (BinaryObject), 1);
-       obj->addr = (void*)info->dlpi_addr;
-       obj->name = pstrdup (filename);
-       obj->next = prof->binary_objects;
-       prof->binary_objects = obj;
-       //printf ("loaded file: %s at %p, segments: %d\n", filename, (void*)info->dlpi_addr, info->dlpi_phnum);
-       a = NULL;
-       for (i = 0; i < info->dlpi_phnum; ++i) {
-               //printf ("segment type %d file offset: %d, size: %d\n", info->dlpi_phdr[i].p_type, info->dlpi_phdr[i].p_offset, info->dlpi_phdr[i].p_memsz);
-               if (info->dlpi_phdr[i].p_type == PT_LOAD && !header) {
-                       header = (ElfW(Ehdr)*)(info->dlpi_addr + info->dlpi_phdr[i].p_vaddr);
-                       if (header->e_ident [EI_MAG0] != ELFMAG0 ||
-                                       header->e_ident [EI_MAG1] != ELFMAG1 ||
-                                       header->e_ident [EI_MAG2] != ELFMAG2 ||
-                                       header->e_ident [EI_MAG3] != ELFMAG3 ) {
-                               header = NULL;
-                       }
-                       dump_ubin (filename, info->dlpi_addr + info->dlpi_phdr[i].p_vaddr, info->dlpi_phdr[i].p_offset, info->dlpi_phdr[i].p_memsz);
-               } else if (info->dlpi_phdr[i].p_type == PT_DYNAMIC) {
-                       dyn = (ElfW(Dyn) *)(info->dlpi_addr + info->dlpi_phdr[i].p_vaddr);
-               }
-       }
-       if (read_elf_symbols (prof, filename, (void*)info->dlpi_addr))
-               return 0;
-       if (!info->dlpi_name || !info->dlpi_name[0])
-               return 0;
-       if (!dyn)
-               return 0;
-       for (i = 0; dyn [i].d_tag != DT_NULL; ++i) {
-               if (dyn [i].d_tag == DT_SYMTAB) {
-                       if (symtab && do_debug)
-                               printf ("multiple symtabs: %d\n", i);
-                       symtab = (ElfW(Sym) *)(a + dyn [i].d_un.d_ptr);
-               } else if (dyn [i].d_tag == DT_HASH) {
-                       hash_table = (ElfW(Word) *)(a + dyn [i].d_un.d_ptr);
-               } else if (dyn [i].d_tag == DT_STRTAB) {
-                       strtab = (const char*)(a + dyn [i].d_un.d_ptr);
-               }
-       }
-       if (!hash_table)
-               return 0;
-       num_sym = hash_table [1];
-       dump_elf_symbols (symtab, num_sym, strtab, (void*)info->dlpi_addr);
-       return 0;
-}
-
-static int
-load_binaries (MonoProfiler *prof)
-{
-       dl_iterate_phdr (elf_dl_callback, prof);
-       return 1;
-}
-#else
-static int
-load_binaries (MonoProfiler *prof)
-{
-       return 0;
-}
-#endif
-
-static const char*
-symbol_for (uintptr_t code)
-{
-#ifdef HAVE_DLADDR
-       void *ip = (void*)code;
-       Dl_info di;
-       if (dladdr (ip, &di)) {
-               if (di.dli_sname)
-                       return di.dli_sname;
-       } else {
-       /*      char **names;
-               names = backtrace_symbols (&ip, 1);
-               if (names) {
-                       const char* p = names [0];
-                       free (names);
-                       return p;
-               }
-               */
-       }
-#endif
-       return NULL;
-}
-
-static void
-dump_unmanaged_coderefs (MonoProfiler *prof)
-{
-       int i;
-       const char* last_symbol;
-       uintptr_t addr, page_end;
-
-       if (load_binaries (prof))
-               return;
-       for (i = 0; i < size_code_pages; ++i) {
-               const char* sym;
-               if (!code_pages [i] || code_pages [i] & 1)
-                       continue;
-               last_symbol = NULL;
-               addr = CPAGE_ADDR (code_pages [i]);
-               page_end = addr + CPAGE_SIZE;
-               code_pages [i] |= 1;
-               /* we dump the symbols for the whole page */
-               for (; addr < page_end; addr += 16) {
-                       sym = symbol_for (addr);
-                       if (sym && sym == last_symbol)
-                               continue;
-                       last_symbol = sym;
-                       if (!sym)
-                               continue;
-                       dump_usym (sym, addr, 0); /* let's not guess the size */
-                       //printf ("found symbol at %p: %s\n", (void*)addr, sym);
-               }
-       }
-}
-
-static int
-mono_cpu_count (void)
-{
-#ifdef PLATFORM_ANDROID
-       /* Android tries really hard to save power by powering off CPUs on SMP phones which
-        * means the normal way to query cpu count returns a wrong value with userspace API.
-        * Instead we use /sys entries to query the actual hardware CPU count.
-        */
-       int count = 0;
-       char buffer[8] = {'\0'};
-       int present = open ("/sys/devices/system/cpu/present", O_RDONLY);
-       /* Format of the /sys entry is a cpulist of indexes which in the case
-        * of present is always of the form "0-(n-1)" when there is more than
-        * 1 core, n being the number of CPU cores in the system. Otherwise
-        * the value is simply 0
-        */
-       if (present != -1 && read (present, (char*)buffer, sizeof (buffer)) > 3)
-               count = strtol (((char*)buffer) + 2, NULL, 10);
-       if (present != -1)
-               close (present);
-       if (count > 0)
-               return count + 1;
-#endif
-
-#if defined(HOST_ARM) || defined (HOST_ARM64)
-
-       /* ARM platforms tries really hard to save power by powering off CPUs on SMP phones which
-        * means the normal way to query cpu count returns a wrong value with userspace API. */
-
-#ifdef _SC_NPROCESSORS_CONF
-       {
-               int count = sysconf (_SC_NPROCESSORS_CONF);
-               if (count > 0)
-                       return count;
-       }
-#endif
-
-#else
-
-#ifdef HAVE_SCHED_GETAFFINITY
-       {
-               cpu_set_t set;
-               if (sched_getaffinity (getpid (), sizeof (set), &set) == 0)
-                       return CPU_COUNT (&set);
-       }
-#endif
-#ifdef _SC_NPROCESSORS_ONLN
-       {
-               int count = sysconf (_SC_NPROCESSORS_ONLN);
-               if (count > 0)
-                       return count;
-       }
-#endif
-
-#endif /* defined(HOST_ARM) || defined (HOST_ARM64) */
-
-#ifdef USE_SYSCTL
-       {
-               int count;
-               int mib [2];
-               size_t len = sizeof (int);
-               mib [0] = CTL_HW;
-               mib [1] = HW_NCPU;
-               if (sysctl (mib, 2, &count, &len, NULL, 0) == 0)
-                       return count;
-       }
-#endif
-#ifdef HOST_WIN32
-       {
-               SYSTEM_INFO info;
-               GetSystemInfo (&info);
-               return info.dwNumberOfProcessors;
-       }
-#endif
-       /* FIXME: warn */
-       return 1;
-}
-
-#if USE_PERF_EVENTS
-
-typedef struct {
-       int perf_fd;
-       unsigned int prev_pos;
-       void *mmap_base;
-       struct perf_event_mmap_page *page_desc;
-} PerfData ;
-
-static PerfData *perf_data = NULL;
-static int num_perf;
-#define PERF_PAGES_SHIFT 4
-static int num_pages = 1 << PERF_PAGES_SHIFT;
-static unsigned int mmap_mask;
-
-typedef struct {
-       struct perf_event_header h;
-       uint64_t ip;
-       uint32_t pid;
-       uint32_t tid;
-       uint64_t timestamp;
-       uint64_t period;
-       uint64_t nframes;
-} PSample;
-
-static int
-perf_event_syscall (struct perf_event_attr *attr, pid_t pid, int cpu, int group_fd, unsigned long flags)
-{
-       attr->size = PERF_ATTR_SIZE_VER0;
-       //printf ("perf attr size: %d\n", attr->size);
-#if defined(__x86_64__)
-       return syscall(/*__NR_perf_event_open*/ 298, attr, pid, cpu, group_fd, flags);
-#elif defined(__i386__)
-       return syscall(/*__NR_perf_event_open*/ 336, attr, pid, cpu, group_fd, flags);
-#elif defined(__arm__) || defined (__aarch64__)
-       return syscall(/*__NR_perf_event_open*/ 364, attr, pid, cpu, group_fd, flags);
-#else
-       return -1;
-#endif
-}
-
-static int
-setup_perf_map (PerfData *perf)
-{
-       perf->mmap_base = mmap (NULL, (num_pages + 1) * getpagesize (), PROT_READ|PROT_WRITE, MAP_SHARED, perf->perf_fd, 0);
-       if (perf->mmap_base == MAP_FAILED) {
-               if (do_debug)
-                       printf ("failed mmap\n");
-               return 0;
-       }
-       perf->page_desc = perf->mmap_base;
-       if (do_debug)
-               printf ("mmap version: %d\n", perf->page_desc->version);
-       return 1;
-}
-
-static void
-dump_perf_hits (MonoProfiler *prof, void *buf, int size)
-{
-       LogBuffer *logbuffer;
-       int count = 1;
-       int mbt_count = 0;
-       void *end = (char*)buf + size;
-       int samples = 0;
-       int pid = getpid ();
-
-       while (buf < end) {
-               PSample *s = buf;
-               if (s->h.size == 0)
-                       break;
-               if (pid != s->pid) {
-                       if (do_debug)
-                               printf ("event for different pid: %d\n", s->pid);
-                       buf = (char*)buf + s->h.size;
-                       continue;
-               }
-               /*ip = (void*)s->ip;
-               printf ("sample: %d, size: %d, ip: %p (%s), timestamp: %llu, nframes: %llu\n",
-                       s->h.type, s->h.size, ip, symbol_for (ip), s->timestamp, s->nframes);*/
-               logbuffer = ensure_logbuf (
-                       EVENT_SIZE /* event */ +
-                       LEB128_SIZE /* type */ +
-                       LEB128_SIZE /* time */ +
-                       LEB128_SIZE /* tid */ +
-                       LEB128_SIZE /* count */ +
-                       count * (
-                               LEB128_SIZE /* ip */
-                       ) +
-                       LEB128_SIZE /* managed count */ +
-                       mbt_count * (
-                               LEB128_SIZE /* method */ +
-                               LEB128_SIZE /* il offset */ +
-                               LEB128_SIZE /* native offset */
-                       )
-               );
-               emit_byte (logbuffer, TYPE_SAMPLE | TYPE_SAMPLE_HIT);
-               emit_value (logbuffer, sample_type);
-               emit_uvalue (logbuffer, s->timestamp - prof->startup_time);
-               /*
-                * No useful thread ID to write here, since throughout the
-                * profiler we use pthread_self () but the ID we get from
-                * perf is the kernel's thread ID.
-                */
-               emit_ptr (logbuffer, 0);
-               emit_value (logbuffer, count);
-               emit_ptr (logbuffer, (void*)(uintptr_t)s->ip);
-               add_code_pointer (s->ip);
-               /* no support here yet for the managed backtrace */
-               emit_uvalue (logbuffer, mbt_count);
-               buf = (char*)buf + s->h.size;
-               samples++;
-       }
-       if (do_debug)
-               printf ("dumped %d samples\n", samples);
-       dump_unmanaged_coderefs (prof);
-}
-
-/* read events from the ring buffer */
-static int
-read_perf_mmap (MonoProfiler* prof, int cpu)
-{
-       PerfData *perf = perf_data + cpu;
-       unsigned char *buf;
-       unsigned char *data = (unsigned char*)perf->mmap_base + getpagesize ();
-       unsigned int head = perf->page_desc->data_head;
-       int diff, size;
-       unsigned int old;
-
-       mono_memory_read_barrier ();
-
-       old = perf->prev_pos;
-       diff = head - old;
-       if (diff < 0) {
-               if (do_debug)
-                       printf ("lost mmap events: old: %d, head: %d\n", old, head);
-               old = head;
-       }
-       size = head - old;
-       if ((old & mmap_mask) + size != (head & mmap_mask)) {
-               buf = data + (old & mmap_mask);
-               size = mmap_mask + 1 - (old & mmap_mask);
-               old += size;
-               /* size bytes at buf */
-               if (do_debug)
-                       printf ("found1 bytes of events: %d\n", size);
-               dump_perf_hits (prof, buf, size);
-       }
-       buf = data + (old & mmap_mask);
-       size = head - old;
-       /* size bytes at buf */
-       if (do_debug)
-               printf ("found bytes of events: %d\n", size);
-       dump_perf_hits (prof, buf, size);
-       old += size;
-       perf->prev_pos = old;
-       perf->page_desc->data_tail = old;
-       return 0;
-}
-
-static int
-setup_perf_event_for_cpu (PerfData *perf, int cpu)
-{
-       struct perf_event_attr attr;
-       memset (&attr, 0, sizeof (attr));
-       attr.type = PERF_TYPE_HARDWARE;
-       switch (sample_type) {
-       case SAMPLE_CYCLES: attr.config = PERF_COUNT_HW_CPU_CYCLES; break;
-       case SAMPLE_INSTRUCTIONS: attr.config = PERF_COUNT_HW_INSTRUCTIONS; break;
-       case SAMPLE_CACHE_MISSES: attr.config = PERF_COUNT_HW_CACHE_MISSES; break;
-       case SAMPLE_CACHE_REFS: attr.config = PERF_COUNT_HW_CACHE_REFERENCES; break;
-       case SAMPLE_BRANCHES: attr.config = PERF_COUNT_HW_BRANCH_INSTRUCTIONS; break;
-       case SAMPLE_BRANCH_MISSES: attr.config = PERF_COUNT_HW_BRANCH_MISSES; break;
-       default: attr.config = PERF_COUNT_HW_CPU_CYCLES; break;
-       }
-       attr.sample_type = PERF_SAMPLE_IP | PERF_SAMPLE_TID | PERF_SAMPLE_PERIOD | PERF_SAMPLE_TIME;
-//     attr.sample_type |= PERF_SAMPLE_CALLCHAIN;
-       attr.read_format = PERF_FORMAT_TOTAL_TIME_ENABLED | PERF_FORMAT_TOTAL_TIME_RUNNING | PERF_FORMAT_ID;
-       attr.inherit = 1;
-       attr.freq = 1;
-       attr.sample_freq = sample_freq;
-
-       perf->perf_fd = perf_event_syscall (&attr, getpid (), cpu, -1, 0);
-       if (do_debug)
-               printf ("perf fd: %d, freq: %d, event: %llu\n", perf->perf_fd, sample_freq, attr.config);
-       if (perf->perf_fd < 0) {
-               if (perf->perf_fd == -EPERM) {
-                       fprintf (stderr, "Perf syscall denied, do \"echo 1 > /proc/sys/kernel/perf_event_paranoid\" as root to enable.\n");
-               } else {
-                       if (do_debug)
-                               perror ("open perf event");
-               }
-               return 0;
-       }
-       if (!setup_perf_map (perf)) {
-               close (perf->perf_fd);
-               perf->perf_fd = -1;
-               return 0;
-       }
-       return 1;
-}
-
-static int
-setup_perf_event (void)
-{
-       int i, count = 0;
-       mmap_mask = num_pages * getpagesize () - 1;
-       num_perf = mono_cpu_count ();
-       perf_data = calloc (num_perf, sizeof (PerfData));
-       for (i = 0; i < num_perf; ++i) {
-               count += setup_perf_event_for_cpu (perf_data + i, i);
-       }
-       if (count)
-               return 1;
-       free (perf_data);
-       perf_data = NULL;
-       return 0;
-}
-
-#endif /* USE_PERF_EVENTS */
-
-#ifndef DISABLE_HELPER_THREAD
-
-typedef struct MonoCounterAgent {
-       MonoCounter *counter;
-       // MonoCounterAgent specific data :
-       void *value;
-       size_t value_size;
-       short index;
-       short emitted;
-       struct MonoCounterAgent *next;
-} MonoCounterAgent;
-
-static MonoCounterAgent* counters;
-static gboolean counters_initialized = FALSE;
-static int counters_index = 1;
-static mono_mutex_t counters_mutex;
-
-static void
-counters_add_agent (MonoCounter *counter)
-{
-       MonoCounterAgent *agent, *item;
-
-       if (!counters_initialized)
-               return;
-
-       mono_os_mutex_lock (&counters_mutex);
-
-       for (agent = counters; agent; agent = agent->next) {
-               if (agent->counter == counter) {
-                       agent->value_size = 0;
-                       if (agent->value) {
-                               free (agent->value);
-                               agent->value = NULL;
-                       }
-                       mono_os_mutex_unlock (&counters_mutex);
-                       return;
-               }
-       }
-
-       agent = (MonoCounterAgent *)malloc (sizeof (MonoCounterAgent));
-       agent->counter = counter;
-       agent->value = NULL;
-       agent->value_size = 0;
-       agent->index = counters_index++;
-       agent->emitted = 0;
-       agent->next = NULL;
-
-       if (!counters) {
-               counters = agent;
-       } else {
-               item = counters;
-               while (item->next)
-                       item = item->next;
-               item->next = agent;
-       }
-
-       mono_os_mutex_unlock (&counters_mutex);
-}
-
-static mono_bool
-counters_init_foreach_callback (MonoCounter *counter, gpointer data)
-{
-       counters_add_agent (counter);
-       return TRUE;
-}
-
-static void
-counters_init (MonoProfiler *profiler)
-{
-       assert (!counters_initialized);
-
-       mono_os_mutex_init (&counters_mutex);
-
-       counters_initialized = TRUE;
-
-       mono_counters_on_register (&counters_add_agent);
-       mono_counters_foreach (counters_init_foreach_callback, NULL);
-}
-
-static void
-counters_emit (MonoProfiler *profiler, gboolean threadless)
-{
-       MonoCounterAgent *agent;
-       LogBuffer *logbuffer;
-       int len = 0;
-       int size =
-               EVENT_SIZE /* event */ +
-               LEB128_SIZE /* len */
-       ;
-
-       if (!counters_initialized)
-               return;
-
-       mono_os_mutex_lock (&counters_mutex);
-
-       for (agent = counters; agent; agent = agent->next) {
-               if (agent->emitted)
-                       continue;
-
-               size +=
-                       LEB128_SIZE /* section */ +
-                       strlen (mono_counter_get_name (agent->counter)) + 1 /* name */ +
-                       LEB128_SIZE /* type */ +
-                       LEB128_SIZE /* unit */ +
-                       LEB128_SIZE /* variance */ +
-                       LEB128_SIZE /* index */
-               ;
-
-               len += 1;
-       }
-
-       if (!len) {
-               mono_os_mutex_unlock (&counters_mutex);
-               return;
-       }
-
-       logbuffer = ensure_logbuf (size);
-
-       ENTER_LOG (logbuffer, "counters");
-       emit_byte (logbuffer, TYPE_SAMPLE_COUNTERS_DESC | TYPE_SAMPLE);
-       emit_value (logbuffer, len);
-       for (agent = counters; agent; agent = agent->next) {
-               const char *name;
-
-               if (agent->emitted)
-                       continue;
-
-               name = mono_counter_get_name (agent->counter);
-               emit_value (logbuffer, mono_counter_get_section (agent->counter));
-               emit_string (logbuffer, name, strlen (name) + 1);
-               emit_value (logbuffer, mono_counter_get_type (agent->counter));
-               emit_value (logbuffer, mono_counter_get_unit (agent->counter));
-               emit_value (logbuffer, mono_counter_get_variance (agent->counter));
-               emit_value (logbuffer, agent->index);
-
-               agent->emitted = 1;
-       }
-       EXIT_LOG (logbuffer);
-
-       if (threadless)
-               safe_send_threadless (profiler, logbuffer);
-       else
-               safe_send (profiler, logbuffer);
-
-       mono_os_mutex_unlock (&counters_mutex);
-}
-
-static void
-counters_sample (MonoProfiler *profiler, uint64_t timestamp, gboolean threadless)
-{
-       MonoCounterAgent *agent;
-       MonoCounter *counter;
-       LogBuffer *logbuffer;
-       int type;
-       int buffer_size;
-       void *buffer;
-       int size;
-
-       if (!counters_initialized)
-               return;
-
-       counters_emit (profiler, threadless);
-
-       buffer_size = 8;
-       buffer = calloc (1, buffer_size);
-
-       mono_os_mutex_lock (&counters_mutex);
-
-       size =
-               EVENT_SIZE /* event */ +
-               LEB128_SIZE /* time */
-       ;
-
-       for (agent = counters; agent; agent = agent->next) {
-               size +=
-                       LEB128_SIZE /* index */ +
-                       LEB128_SIZE /* type */ +
-                       mono_counter_get_size (agent->counter) /* value */
-               ;
-       }
-
-       size +=
-               LEB128_SIZE /* stop marker */
-       ;
-
-       logbuffer = ensure_logbuf (size);
-
-       ENTER_LOG (logbuffer, "counters");
-       emit_byte (logbuffer, TYPE_SAMPLE_COUNTERS | TYPE_SAMPLE);
-       emit_uvalue (logbuffer, timestamp);
-       for (agent = counters; agent; agent = agent->next) {
-               size_t size;
-
-               counter = agent->counter;
-
-               size = mono_counter_get_size (counter);
-               if (size < 0) {
-                       continue; // FIXME error
-               } else if (size > buffer_size) {
-                       buffer_size = size;
-                       buffer = realloc (buffer, buffer_size);
-               }
-
-               memset (buffer, 0, buffer_size);
-
-               if (mono_counters_sample (counter, buffer, size) < 0)
-                       continue; // FIXME error
-
-               type = mono_counter_get_type (counter);
-
-               if (!agent->value) {
-                       agent->value = calloc (1, size);
-                       agent->value_size = size;
-               } else {
-                       if (type == MONO_COUNTER_STRING) {
-                               if (strcmp (agent->value, buffer) == 0)
-                                       continue;
-                       } else {
-                               if (agent->value_size == size && memcmp (agent->value, buffer, size) == 0)
-                                       continue;
-                       }
-               }
-
-               emit_uvalue (logbuffer, agent->index);
-               emit_uvalue (logbuffer, type);
-               switch (type) {
-               case MONO_COUNTER_INT:
-#if SIZEOF_VOID_P == 4
-               case MONO_COUNTER_WORD:
-#endif
-                       emit_svalue (logbuffer, *(int*)buffer - *(int*)agent->value);
-                       break;
-               case MONO_COUNTER_UINT:
-                       emit_uvalue (logbuffer, *(guint*)buffer - *(guint*)agent->value);
-                       break;
-               case MONO_COUNTER_TIME_INTERVAL:
-               case MONO_COUNTER_LONG:
-#if SIZEOF_VOID_P == 8
-               case MONO_COUNTER_WORD:
-#endif
-                       emit_svalue (logbuffer, *(gint64*)buffer - *(gint64*)agent->value);
-                       break;
-               case MONO_COUNTER_ULONG:
-                       emit_uvalue (logbuffer, *(guint64*)buffer - *(guint64*)agent->value);
-                       break;
-               case MONO_COUNTER_DOUBLE:
-                       emit_double (logbuffer, *(double*)buffer);
-                       break;
-               case MONO_COUNTER_STRING:
-                       if (size == 0) {
-                               emit_byte (logbuffer, 0);
-                       } else {
-                               emit_byte (logbuffer, 1);
-                               emit_string (logbuffer, (char*)buffer, size);
-                       }
-                       break;
-               default:
-                       assert (0);
-               }
-
-               if (type == MONO_COUNTER_STRING && size > agent->value_size) {
-                       agent->value = realloc (agent->value, size);
-                       agent->value_size = size;
-               }
-
-               if (size > 0)
-                       memcpy (agent->value, buffer, size);
-       }
-       free (buffer);
-
-       emit_value (logbuffer, 0);
-       EXIT_LOG (logbuffer);
-
-       if (threadless)
-               safe_send_threadless (profiler, logbuffer);
-       else
-               safe_send (profiler, logbuffer);
-
-       mono_os_mutex_unlock (&counters_mutex);
-}
-
-typedef struct _PerfCounterAgent PerfCounterAgent;
-struct _PerfCounterAgent {
-       PerfCounterAgent *next;
-       int index;
-       char *category_name;
-       char *name;
-       int type;
-       gint64 value;
-       guint8 emitted;
-       guint8 updated;
-       guint8 deleted;
-};
-
-static PerfCounterAgent *perfcounters = NULL;
-
-static void
-perfcounters_emit (MonoProfiler *profiler, gboolean threadless)
-{
-       PerfCounterAgent *pcagent;
-       LogBuffer *logbuffer;
-       int len = 0;
-       int size =
-               EVENT_SIZE /* event */ +
-               LEB128_SIZE /* len */
-       ;
-
-       for (pcagent = perfcounters; pcagent; pcagent = pcagent->next) {
-               if (pcagent->emitted)
-                       continue;
-
-               size +=
-                       LEB128_SIZE /* section */ +
-                       strlen (pcagent->category_name) + 1 /* category name */ +
-                       strlen (pcagent->name) + 1 /* name */ +
-                       LEB128_SIZE /* type */ +
-                       LEB128_SIZE /* unit */ +
-                       LEB128_SIZE /* variance */ +
-                       LEB128_SIZE /* index */
-               ;
-
-               len += 1;
-       }
-
-       if (!len)
-               return;
-
-       logbuffer = ensure_logbuf (size);
-
-       ENTER_LOG (logbuffer, "perfcounters");
-       emit_byte (logbuffer, TYPE_SAMPLE_COUNTERS_DESC | TYPE_SAMPLE);
-       emit_value (logbuffer, len);
-       for (pcagent = perfcounters; pcagent; pcagent = pcagent->next) {
-               if (pcagent->emitted)
-                       continue;
-
-               emit_value (logbuffer, MONO_COUNTER_PERFCOUNTERS);
-               emit_string (logbuffer, pcagent->category_name, strlen (pcagent->category_name) + 1);
-               emit_string (logbuffer, pcagent->name, strlen (pcagent->name) + 1);
-               emit_value (logbuffer, MONO_COUNTER_LONG);
-               emit_value (logbuffer, MONO_COUNTER_RAW);
-               emit_value (logbuffer, MONO_COUNTER_VARIABLE);
-               emit_value (logbuffer, pcagent->index);
-
-               pcagent->emitted = 1;
-       }
-       EXIT_LOG (logbuffer);
-
-       if (threadless)
-               safe_send_threadless (profiler, logbuffer);
-       else
-               safe_send (profiler, logbuffer);
-}
-
-static gboolean
-perfcounters_foreach (char *category_name, char *name, unsigned char type, gint64 value, gpointer user_data)
-{
-       PerfCounterAgent *pcagent;
-
-       for (pcagent = perfcounters; pcagent; pcagent = pcagent->next) {
-               if (strcmp (pcagent->category_name, category_name) != 0 || strcmp (pcagent->name, name) != 0)
-                       continue;
-               if (pcagent->value == value)
-                       return TRUE;
-
-               pcagent->value = value;
-               pcagent->updated = 1;
-               pcagent->deleted = 0;
-               return TRUE;
-       }
-
-       pcagent = g_new0 (PerfCounterAgent, 1);
-       pcagent->next = perfcounters;
-       pcagent->index = counters_index++;
-       pcagent->category_name = g_strdup (category_name);
-       pcagent->name = g_strdup (name);
-       pcagent->type = (int) type;
-       pcagent->value = value;
-       pcagent->emitted = 0;
-       pcagent->updated = 1;
-       pcagent->deleted = 0;
-
-       perfcounters = pcagent;
-
-       return TRUE;
-}
-
-static void
-perfcounters_sample (MonoProfiler *profiler, uint64_t timestamp, gboolean threadless)
-{
-       PerfCounterAgent *pcagent;
-       LogBuffer *logbuffer;
-       int size;
-
-       if (!counters_initialized)
-               return;
-
-       mono_os_mutex_lock (&counters_mutex);
-
-       /* mark all perfcounters as deleted, foreach will unmark them as necessary */
-       for (pcagent = perfcounters; pcagent; pcagent = pcagent->next)
-               pcagent->deleted = 1;
-
-       mono_perfcounter_foreach (perfcounters_foreach, perfcounters);
-
-       perfcounters_emit (profiler, threadless);
-
-       size =
-               EVENT_SIZE /* event */ +
-               LEB128_SIZE /* time */
-       ;
-
-       for (pcagent = perfcounters; pcagent; pcagent = pcagent->next) {
-               if (pcagent->deleted || !pcagent->updated)
-                       continue;
-
-               size +=
-                       LEB128_SIZE /* index */ +
-                       LEB128_SIZE /* type */ +
-                       LEB128_SIZE /* value */
-               ;
-       }
-
-       size +=
-               LEB128_SIZE /* stop marker */
-       ;
-
-       logbuffer = ensure_logbuf (size);
-
-       ENTER_LOG (logbuffer, "perfcounters");
-       emit_byte (logbuffer, TYPE_SAMPLE_COUNTERS | TYPE_SAMPLE);
-       emit_uvalue (logbuffer, timestamp);
-       for (pcagent = perfcounters; pcagent; pcagent = pcagent->next) {
-               if (pcagent->deleted || !pcagent->updated)
-                       continue;
-               emit_uvalue (logbuffer, pcagent->index);
-               emit_uvalue (logbuffer, MONO_COUNTER_LONG);
-               emit_svalue (logbuffer, pcagent->value);
-
-               pcagent->updated = 0;
-       }
-
-       emit_value (logbuffer, 0);
-       EXIT_LOG (logbuffer);
-
-       if (threadless)
-               safe_send_threadless (profiler, logbuffer);
-       else
-               safe_send (profiler, logbuffer);
-
-       mono_os_mutex_unlock (&counters_mutex);
-}
-
-static void
-counters_and_perfcounters_sample (MonoProfiler *prof, gboolean threadless)
-{
-       static uint64_t start = -1;
-       uint64_t now;
-
-       if (start == -1)
-               start = current_time ();
-
-       now = current_time ();
-       counters_sample (prof, (now - start) / 1000/ 1000, threadless);
-       perfcounters_sample (prof, (now - start) / 1000/ 1000, threadless);
-}
-
-#define COVERAGE_DEBUG(x) if (debug_coverage) {x}
-static mono_mutex_t coverage_mutex;
-static MonoConcurrentHashTable *coverage_methods = NULL;
-static MonoConcurrentHashTable *coverage_assemblies = NULL;
-static MonoConcurrentHashTable *coverage_classes = NULL;
-
-static MonoConcurrentHashTable *filtered_classes = NULL;
-static MonoConcurrentHashTable *entered_methods = NULL;
-static MonoConcurrentHashTable *image_to_methods = NULL;
-static MonoConcurrentHashTable *suppressed_assemblies = NULL;
-static gboolean coverage_initialized = FALSE;
-
-static GPtrArray *coverage_data = NULL;
-static int previous_offset = 0;
-
-typedef struct _MethodNode MethodNode;
-struct _MethodNode {
-       MonoLockFreeQueueNode node;
-       MonoMethod *method;
-};
-
-typedef struct _CoverageEntry CoverageEntry;
-struct _CoverageEntry {
-       int offset;
-       int counter;
-       char *filename;
-       int line;
-       int column;
-};
-
-static void
-free_coverage_entry (gpointer data, gpointer userdata)
-{
-       CoverageEntry *entry = (CoverageEntry *)data;
-       g_free (entry->filename);
-       g_free (entry);
-}
-
-static void
-obtain_coverage_for_method (MonoProfiler *prof, const MonoProfileCoverageEntry *entry)
-{
-       int offset = entry->iloffset - previous_offset;
-       CoverageEntry *e = g_new (CoverageEntry, 1);
-
-       previous_offset = entry->iloffset;
-
-       e->offset = offset;
-       e->counter = entry->counter;
-       e->filename = g_strdup(entry->filename ? entry->filename : "");
-       e->line = entry->line;
-       e->column = entry->col;
-
-       g_ptr_array_add (coverage_data, e);
-}
-
-static char *
-parse_generic_type_names(char *name)
-{
-       char *new_name, *ret;
-       int within_generic_declaration = 0, generic_members = 1;
-
-       if (name == NULL || *name == '\0')
-               return g_strdup ("");
-
-       if (!(ret = new_name = (char *)calloc (strlen (name) * 4 + 1, sizeof (char))))
-               return NULL;
-
-       do {
-               switch (*name) {
-                       case '<':
-                               within_generic_declaration = 1;
-                               break;
-
-                       case '>':
-                               within_generic_declaration = 0;
-
-                               if (*(name - 1) != '<') {
-                                       *new_name++ = '`';
-                                       *new_name++ = '0' + generic_members;
-                               } else {
-                                       memcpy (new_name, "&lt;&gt;", 8);
-                                       new_name += 8;
-                               }
-
-                               generic_members = 0;
-                               break;
-
-                       case ',':
-                               generic_members++;
-                               break;
-
-                       default:
-                               if (!within_generic_declaration)
-                                       *new_name++ = *name;
-
-                               break;
-               }
-       } while (*name++);
-
-       return ret;
-}
-
-static int method_id;
-static void
-build_method_buffer (gpointer key, gpointer value, gpointer userdata)
-{
-       MonoMethod *method = (MonoMethod *)value;
-       MonoProfiler *prof = (MonoProfiler *)userdata;
-       MonoClass *klass;
-       MonoImage *image;
-       char *class_name;
-       const char *image_name, *method_name, *sig, *first_filename;
-       LogBuffer *logbuffer;
-       guint i;
-
-       previous_offset = 0;
-       coverage_data = g_ptr_array_new ();
-
-       mono_profiler_coverage_get (prof, method, obtain_coverage_for_method);
-
-       klass = mono_method_get_class (method);
-       image = mono_class_get_image (klass);
-       image_name = mono_image_get_name (image);
-
-       sig = mono_signature_get_desc (mono_method_signature (method), TRUE);
-       class_name = parse_generic_type_names (mono_type_get_name (mono_class_get_type (klass)));
-       method_name = mono_method_get_name (method);
-
-       if (coverage_data->len != 0) {
-               CoverageEntry *entry = (CoverageEntry *)coverage_data->pdata[0];
-               first_filename = entry->filename ? entry->filename : "";
-       } else
-               first_filename = "";
-
-       image_name = image_name ? image_name : "";
-       sig = sig ? sig : "";
-       method_name = method_name ? method_name : "";
-
-       logbuffer = ensure_logbuf (
-               EVENT_SIZE /* event */ +
-               strlen (image_name) + 1 /* image name */ +
-               strlen (class_name) + 1 /* class name */ +
-               strlen (method_name) + 1 /* method name */ +
-               strlen (sig) + 1 /* signature */ +
-               strlen (first_filename) + 1 /* first file name */ +
-               LEB128_SIZE /* token */ +
-               LEB128_SIZE /* method id */ +
-               LEB128_SIZE /* entries */
-       );
-       ENTER_LOG (logbuffer, "coverage-methods");
-
-       emit_byte (logbuffer, TYPE_COVERAGE_METHOD | TYPE_COVERAGE);
-       emit_string (logbuffer, image_name, strlen (image_name) + 1);
-       emit_string (logbuffer, class_name, strlen (class_name) + 1);
-       emit_string (logbuffer, method_name, strlen (method_name) + 1);
-       emit_string (logbuffer, sig, strlen (sig) + 1);
-       emit_string (logbuffer, first_filename, strlen (first_filename) + 1);
-
-       emit_uvalue (logbuffer, mono_method_get_token (method));
-       emit_uvalue (logbuffer, method_id);
-       emit_value (logbuffer, coverage_data->len);
-
-       EXIT_LOG (logbuffer);
-       safe_send (prof, logbuffer);
-
-       for (i = 0; i < coverage_data->len; i++) {
-               CoverageEntry *entry = (CoverageEntry *)coverage_data->pdata[i];
-
-               logbuffer = ensure_logbuf (
-                       EVENT_SIZE /* event */ +
-                       LEB128_SIZE /* method id */ +
-                       LEB128_SIZE /* offset */ +
-                       LEB128_SIZE /* counter */ +
-                       LEB128_SIZE /* line */ +
-                       LEB128_SIZE /* column */
-               );
-               ENTER_LOG (logbuffer, "coverage-statement");
-
-               emit_byte (logbuffer, TYPE_COVERAGE_STATEMENT | TYPE_COVERAGE);
-               emit_uvalue (logbuffer, method_id);
-               emit_uvalue (logbuffer, entry->offset);
-               emit_uvalue (logbuffer, entry->counter);
-               emit_uvalue (logbuffer, entry->line);
-               emit_uvalue (logbuffer, entry->column);
-
-               EXIT_LOG (logbuffer);
-               safe_send (prof, logbuffer);
-       }
-
-       method_id++;
-
-       g_free (class_name);
-
-       g_ptr_array_foreach (coverage_data, free_coverage_entry, NULL);
-       g_ptr_array_free (coverage_data, TRUE);
-       coverage_data = NULL;
-}
-
-/* This empties the queue */
-static guint
-count_queue (MonoLockFreeQueue *queue)
-{
-       MonoLockFreeQueueNode *node;
-       guint count = 0;
-
-       while ((node = mono_lock_free_queue_dequeue (queue))) {
-               count++;
-               mono_thread_hazardous_try_free (node, free);
-       }
-
-       return count;
-}
-
-static void
-build_class_buffer (gpointer key, gpointer value, gpointer userdata)
-{
-       MonoClass *klass = (MonoClass *)key;
-       MonoLockFreeQueue *class_methods = (MonoLockFreeQueue *)value;
-       MonoProfiler *prof = (MonoProfiler *)userdata;
-       MonoImage *image;
-       char *class_name;
-       const char *assembly_name;
-       int number_of_methods, partially_covered;
-       guint fully_covered;
-       LogBuffer *logbuffer;
-
-       image = mono_class_get_image (klass);
-       assembly_name = mono_image_get_name (image);
-       class_name = mono_type_get_name (mono_class_get_type (klass));
-
-       assembly_name = assembly_name ? assembly_name : "";
-       number_of_methods = mono_class_num_methods (klass);
-       fully_covered = count_queue (class_methods);
-       /* We don't handle partial covered yet */
-       partially_covered = 0;
-
-       logbuffer = ensure_logbuf (
-               EVENT_SIZE /* event */ +
-               strlen (assembly_name) + 1 /* assembly name */ +
-               strlen (class_name) + 1 /* class name */ +
-               LEB128_SIZE /* no. methods */ +
-               LEB128_SIZE /* fully covered */ +
-               LEB128_SIZE /* partially covered */
-       );
-
-       ENTER_LOG (logbuffer, "coverage-class");
-       emit_byte (logbuffer, TYPE_COVERAGE_CLASS | TYPE_COVERAGE);
-       emit_string (logbuffer, assembly_name, strlen (assembly_name) + 1);
-       emit_string (logbuffer, class_name, strlen (class_name) + 1);
-       emit_uvalue (logbuffer, number_of_methods);
-       emit_uvalue (logbuffer, fully_covered);
-       emit_uvalue (logbuffer, partially_covered);
-       EXIT_LOG (logbuffer);
-
-       safe_send (prof, logbuffer);
-
-       g_free (class_name);
-}
-
-static void
-get_coverage_for_image (MonoImage *image, int *number_of_methods, guint *fully_covered, int *partially_covered)
-{
-       MonoLockFreeQueue *image_methods = (MonoLockFreeQueue *)mono_conc_hashtable_lookup (image_to_methods, image);
-
-       *number_of_methods = mono_image_get_table_rows (image, MONO_TABLE_METHOD);
-       if (image_methods)
-               *fully_covered = count_queue (image_methods);
-       else
-               *fully_covered = 0;
-
-       // FIXME: We don't handle partially covered yet.
-       *partially_covered = 0;
-}
-
-static void
-build_assembly_buffer (gpointer key, gpointer value, gpointer userdata)
-{
-       MonoAssembly *assembly = (MonoAssembly *)value;
-       MonoProfiler *prof = (MonoProfiler *)userdata;
-       MonoImage *image = mono_assembly_get_image (assembly);
-       LogBuffer *logbuffer;
-       const char *name, *guid, *filename;
-       int number_of_methods = 0, partially_covered = 0;
-       guint fully_covered = 0;
-
-       name = mono_image_get_name (image);
-       guid = mono_image_get_guid (image);
-       filename = mono_image_get_filename (image);
-
-       name = name ? name : "";
-       guid = guid ? guid : "";
-       filename = filename ? filename : "";
-
-       get_coverage_for_image (image, &number_of_methods, &fully_covered, &partially_covered);
-
-       logbuffer = ensure_logbuf (
-               EVENT_SIZE /* event */ +
-               strlen (name) + 1 /* name */ +
-               strlen (guid) + 1 /* guid */ +
-               strlen (filename) + 1 /* file name */ +
-               LEB128_SIZE /* no. methods */ +
-               LEB128_SIZE /* fully covered */ +
-               LEB128_SIZE /* partially covered */
-       );
-
-       ENTER_LOG (logbuffer, "coverage-assemblies");
-       emit_byte (logbuffer, TYPE_COVERAGE_ASSEMBLY | TYPE_COVERAGE);
-       emit_string (logbuffer, name, strlen (name) + 1);
-       emit_string (logbuffer, guid, strlen (guid) + 1);
-       emit_string (logbuffer, filename, strlen (filename) + 1);
-       emit_uvalue (logbuffer, number_of_methods);
-       emit_uvalue (logbuffer, fully_covered);
-       emit_uvalue (logbuffer, partially_covered);
-       EXIT_LOG (logbuffer);
-
-       safe_send (prof, logbuffer);
-}
-
-static void
-dump_coverage (MonoProfiler *prof)
-{
-       if (!coverage_initialized)
-               return;
-
-       COVERAGE_DEBUG(fprintf (stderr, "Coverage: Started dump\n");)
-       method_id = 0;
-
-       mono_os_mutex_lock (&coverage_mutex);
-       mono_conc_hashtable_foreach (coverage_assemblies, build_assembly_buffer, prof);
-       mono_conc_hashtable_foreach (coverage_classes, build_class_buffer, prof);
-       mono_conc_hashtable_foreach (coverage_methods, build_method_buffer, prof);
-       mono_os_mutex_unlock (&coverage_mutex);
-
-       COVERAGE_DEBUG(fprintf (stderr, "Coverage: Finished dump\n");)
-}
-
-static void
-process_method_enter_coverage (MonoProfiler *prof, MonoMethod *method)
-{
-       MonoClass *klass;
-       MonoImage *image;
-
-       if (!coverage_initialized)
-               return;
-
-       klass = mono_method_get_class (method);
-       image = mono_class_get_image (klass);
-
-       if (mono_conc_hashtable_lookup (suppressed_assemblies, (gpointer) mono_image_get_name (image)))
-               return;
-
-       mono_os_mutex_lock (&coverage_mutex);
-       mono_conc_hashtable_insert (entered_methods, method, method);
-       mono_os_mutex_unlock (&coverage_mutex);
-}
-
-static MonoLockFreeQueueNode *
-create_method_node (MonoMethod *method)
-{
-       MethodNode *node = (MethodNode *)g_malloc (sizeof (MethodNode));
-       mono_lock_free_queue_node_init ((MonoLockFreeQueueNode *) node, FALSE);
-       node->method = method;
-
-       return (MonoLockFreeQueueNode *) node;
-}
-
-static gboolean
-coverage_filter (MonoProfiler *prof, MonoMethod *method)
-{
-       MonoError error;
-       MonoClass *klass;
-       MonoImage *image;
-       MonoAssembly *assembly;
-       MonoMethodHeader *header;
-       guint32 iflags, flags, code_size;
-       char *fqn, *classname;
-       gboolean has_positive, found;
-       MonoLockFreeQueue *image_methods, *class_methods;
-       MonoLockFreeQueueNode *node;
-
-       if (!coverage_initialized)
-               return FALSE;
-
-       COVERAGE_DEBUG(fprintf (stderr, "Coverage filter for %s\n", mono_method_get_name (method));)
-
-       flags = mono_method_get_flags (method, &iflags);
-       if ((iflags & 0x1000 /*METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL*/) ||
-           (flags & 0x2000 /*METHOD_ATTRIBUTE_PINVOKE_IMPL*/)) {
-               COVERAGE_DEBUG(fprintf (stderr, "   Internal call or pinvoke - ignoring\n");)
-               return FALSE;
-       }
-
-       // Don't need to do anything else if we're already tracking this method
-       if (mono_conc_hashtable_lookup (coverage_methods, method)) {
-               COVERAGE_DEBUG(fprintf (stderr, "   Already tracking\n");)
-               return TRUE;
-       }
-
-       klass = mono_method_get_class (method);
-       image = mono_class_get_image (klass);
-
-       // Don't handle coverage for the core assemblies
-       if (mono_conc_hashtable_lookup (suppressed_assemblies, (gpointer) mono_image_get_name (image)) != NULL)
-               return FALSE;
-
-       if (prof->coverage_filters) {
-               /* Check already filtered classes first */
-               if (mono_conc_hashtable_lookup (filtered_classes, klass)) {
-                       COVERAGE_DEBUG(fprintf (stderr, "   Already filtered\n");)
-                       return FALSE;
-               }
-
-               classname = mono_type_get_name (mono_class_get_type (klass));
-
-               fqn = g_strdup_printf ("[%s]%s", mono_image_get_name (image), classname);
-
-               COVERAGE_DEBUG(fprintf (stderr, "   Looking for %s in filter\n", fqn);)
-               // Check positive filters first
-               has_positive = FALSE;
-               found = FALSE;
-               for (guint i = 0; i < prof->coverage_filters->len; ++i) {
-                       char *filter = (char *)g_ptr_array_index (prof->coverage_filters, i);
-
-                       if (filter [0] == '+') {
-                               filter = &filter [1];
-
-                               COVERAGE_DEBUG(fprintf (stderr, "   Checking against +%s ...", filter);)
-
-                               if (strstr (fqn, filter) != NULL) {
-                                       COVERAGE_DEBUG(fprintf (stderr, "matched\n");)
-                                       found = TRUE;
-                               } else
-                                       COVERAGE_DEBUG(fprintf (stderr, "no match\n");)
-
-                               has_positive = TRUE;
-                       }
-               }
-
-               if (has_positive && !found) {
-                       COVERAGE_DEBUG(fprintf (stderr, "   Positive match was not found\n");)
-
-                       mono_os_mutex_lock (&coverage_mutex);
-                       mono_conc_hashtable_insert (filtered_classes, klass, klass);
-                       mono_os_mutex_unlock (&coverage_mutex);
-                       g_free (fqn);
-                       g_free (classname);
-
-                       return FALSE;
-               }
-
-               for (guint i = 0; i < prof->coverage_filters->len; ++i) {
-                       // FIXME: Is substring search sufficient?
-                       char *filter = (char *)g_ptr_array_index (prof->coverage_filters, i);
-                       if (filter [0] == '+')
-                               continue;
-
-                       // Skip '-'
-                       filter = &filter [1];
-                       COVERAGE_DEBUG(fprintf (stderr, "   Checking against -%s ...", filter);)
-
-                       if (strstr (fqn, filter) != NULL) {
-                               COVERAGE_DEBUG(fprintf (stderr, "matched\n");)
-
-                               mono_os_mutex_lock (&coverage_mutex);
-                               mono_conc_hashtable_insert (filtered_classes, klass, klass);
-                               mono_os_mutex_unlock (&coverage_mutex);
-                               g_free (fqn);
-                               g_free (classname);
-
-                               return FALSE;
-                       } else
-                               COVERAGE_DEBUG(fprintf (stderr, "no match\n");)
-
-               }
-
-               g_free (fqn);
-               g_free (classname);
-       }
-
-       COVERAGE_DEBUG(fprintf (stderr, "   Handling coverage for %s\n", mono_method_get_name (method));)
-       header = mono_method_get_header_checked (method, &error);
-       mono_error_cleanup (&error);
-
-       mono_method_header_get_code (header, &code_size, NULL);
-
-       assembly = mono_image_get_assembly (image);
-
-       // Need to keep the assemblies around for as long as they are kept in the hashtable
-       // Nunit, for example, has a habit of unloading them before the coverage statistics are
-       // generated causing a crash. See https://bugzilla.xamarin.com/show_bug.cgi?id=39325
-       mono_assembly_addref (assembly);
-
-       mono_os_mutex_lock (&coverage_mutex);
-       mono_conc_hashtable_insert (coverage_methods, method, method);
-       mono_conc_hashtable_insert (coverage_assemblies, assembly, assembly);
-       mono_os_mutex_unlock (&coverage_mutex);
-
-       image_methods = (MonoLockFreeQueue *)mono_conc_hashtable_lookup (image_to_methods, image);
-
-       if (image_methods == NULL) {
-               image_methods = (MonoLockFreeQueue *)g_malloc (sizeof (MonoLockFreeQueue));
-               mono_lock_free_queue_init (image_methods);
-               mono_os_mutex_lock (&coverage_mutex);
-               mono_conc_hashtable_insert (image_to_methods, image, image_methods);
-               mono_os_mutex_unlock (&coverage_mutex);
-       }
-
-       node = create_method_node (method);
-       mono_lock_free_queue_enqueue (image_methods, node);
-
-       class_methods = (MonoLockFreeQueue *)mono_conc_hashtable_lookup (coverage_classes, klass);
-
-       if (class_methods == NULL) {
-               class_methods = (MonoLockFreeQueue *)g_malloc (sizeof (MonoLockFreeQueue));
-               mono_lock_free_queue_init (class_methods);
-               mono_os_mutex_lock (&coverage_mutex);
-               mono_conc_hashtable_insert (coverage_classes, klass, class_methods);
-               mono_os_mutex_unlock (&coverage_mutex);
-       }
-
-       node = create_method_node (method);
-       mono_lock_free_queue_enqueue (class_methods, node);
-
-       return TRUE;
-}
-
-#define LINE_BUFFER_SIZE 4096
-/* Max file limit of 128KB */
-#define MAX_FILE_SIZE 128 * 1024
-static char *
-get_file_content (FILE *stream)
-{
-       char *buffer;
-       ssize_t bytes_read;
-       long filesize;
-       int res, offset = 0;
-
-       res = fseek (stream, 0, SEEK_END);
-       if (res < 0)
-         return NULL;
-
-       filesize = ftell (stream);
-       if (filesize < 0)
-         return NULL;
-
-       res = fseek (stream, 0, SEEK_SET);
-       if (res < 0)
-         return NULL;
-
-       if (filesize > MAX_FILE_SIZE)
-         return NULL;
-
-       buffer = (char *)g_malloc ((filesize + 1) * sizeof (char));
-       while ((bytes_read = fread (buffer + offset, 1, LINE_BUFFER_SIZE, stream)) > 0)
-               offset += bytes_read;
-
-       /* NULL terminate our buffer */
-       buffer[filesize] = '\0';
-       return buffer;
-}
-
-static char *
-get_next_line (char *contents, char **next_start)
-{
-       char *p = contents;
-
-       if (p == NULL || *p == '\0') {
-               *next_start = NULL;
-               return NULL;
-       }
-
-       while (*p != '\n' && *p != '\0')
-               p++;
-
-       if (*p == '\n') {
-               *p = '\0';
-               *next_start = p + 1;
-       } else
-               *next_start = NULL;
-
-       return contents;
-}
-
-static void
-init_suppressed_assemblies (void)
-{
-       char *content;
-       char *line;
-       FILE *sa_file;
-
-       suppressed_assemblies = mono_conc_hashtable_new (g_str_hash, g_str_equal);
-       sa_file = fopen (SUPPRESSION_DIR "/mono-profiler-log.suppression", "r");
-       if (sa_file == NULL)
-               return;
-
-       /* Don't need to free @content as it is referred to by the lines stored in @suppressed_assemblies */
-       content = get_file_content (sa_file);
-       if (content == NULL) {
-               g_error ("mono-profiler-log.suppression is greater than 128kb - aborting\n");
-       }
-
-       while ((line = get_next_line (content, &content))) {
-               line = g_strchomp (g_strchug (line));
-               /* No locking needed as we're doing initialization */
-               mono_conc_hashtable_insert (suppressed_assemblies, line, line);
-       }
-
-       fclose (sa_file);
-}
-
-#endif /* DISABLE_HELPER_THREAD */
-
-static void
-coverage_init (MonoProfiler *prof)
-{
-#ifndef DISABLE_HELPER_THREAD
-       assert (!coverage_initialized);
-
-       COVERAGE_DEBUG(fprintf (stderr, "Coverage initialized\n");)
-
-       mono_os_mutex_init (&coverage_mutex);
-       coverage_methods = mono_conc_hashtable_new (NULL, NULL);
-       coverage_assemblies = mono_conc_hashtable_new (NULL, NULL);
-       coverage_classes = mono_conc_hashtable_new (NULL, NULL);
-       filtered_classes = mono_conc_hashtable_new (NULL, NULL);
-       entered_methods = mono_conc_hashtable_new (NULL, NULL);
-       image_to_methods = mono_conc_hashtable_new (NULL, NULL);
-       init_suppressed_assemblies ();
-
-       coverage_initialized = TRUE;
-#endif /* DISABLE_HELPER_THREAD */
-}
-
-static void
-unref_coverage_assemblies (gpointer key, gpointer value, gpointer userdata)
-{
-       MonoAssembly *assembly = (MonoAssembly *)value;
-       mono_assembly_close (assembly);
-}
-
-static void
-free_sample_hit (gpointer p)
-{
-       mono_lock_free_free (p, SAMPLE_BLOCK_SIZE);
-}
-
-static void
-cleanup_reusable_samples (MonoProfiler *prof)
-{
-       SampleHit *sample;
-
-       while ((sample = (SampleHit *) mono_lock_free_queue_dequeue (&prof->sample_reuse_queue)))
-               mono_thread_hazardous_try_free (sample, free_sample_hit);
-}
-
-static void
-log_shutdown (MonoProfiler *prof)
-{
-       void *res;
-
-       in_shutdown = 1;
-#ifndef DISABLE_HELPER_THREAD
-       counters_and_perfcounters_sample (prof, FALSE);
-
-       dump_coverage (prof);
-
-       if (prof->command_port) {
-               char c = 1;
-               ign_res (write (prof->pipes [1], &c, 1));
-               pthread_join (prof->helper_thread, &res);
-       }
-#endif
-#if USE_PERF_EVENTS
-       if (perf_data) {
-               int i;
-               for (i = 0; i < num_perf; ++i)
-                       read_perf_mmap (prof, i);
-       }
-#endif
-
-       if (TLS_GET (LogBuffer, tlsbuffer))
-               send_buffer (prof, TLS_GET (GPtrArray, tlsmethodlist), TLS_GET (LogBuffer, tlsbuffer));
-
-       TLS_SET (tlsbuffer, NULL);
-       TLS_SET (tlsmethodlist, NULL);
-
-       InterlockedWrite (&prof->run_dumper_thread, 0);
-       mono_os_sem_post (&prof->dumper_queue_sem);
-       pthread_join (prof->dumper_thread, &res);
-       mono_os_sem_destroy (&prof->dumper_queue_sem);
-
-       InterlockedWrite (&prof->run_writer_thread, 0);
-       mono_os_sem_post (&prof->writer_queue_sem);
-       pthread_join (prof->writer_thread, &res);
-       mono_os_sem_destroy (&prof->writer_queue_sem);
-
-       cleanup_reusable_samples (prof);
-
-#if defined (HAVE_SYS_ZLIB)
-       if (prof->gzfile)
-               gzclose (prof->gzfile);
-#endif
-       if (prof->pipe_output)
-               pclose (prof->file);
-       else
-               fclose (prof->file);
-
-       mono_conc_hashtable_destroy (prof->method_table);
-       mono_os_mutex_destroy (&prof->method_table_mutex);
-
-       if (coverage_initialized) {
-               mono_os_mutex_lock (&coverage_mutex);
-               mono_conc_hashtable_foreach (coverage_assemblies, unref_coverage_assemblies, prof);
-               mono_os_mutex_unlock (&coverage_mutex);
-
-               mono_conc_hashtable_destroy (coverage_methods);
-               mono_conc_hashtable_destroy (coverage_assemblies);
-               mono_conc_hashtable_destroy (coverage_classes);
-               mono_conc_hashtable_destroy (filtered_classes);
-
-               mono_conc_hashtable_destroy (entered_methods);
-               mono_conc_hashtable_destroy (image_to_methods);
-               mono_conc_hashtable_destroy (suppressed_assemblies);
-               mono_os_mutex_destroy (&coverage_mutex);
-       }
-
-       free (prof);
-}
-
-static char*
-new_filename (const char* filename)
-{
-       time_t t = time (NULL);
-       int pid = process_id ();
-       char pid_buf [16];
-       char time_buf [16];
-       char *res, *d;
-       const char *p;
-       int count_dates = 0;
-       int count_pids = 0;
-       int s_date, s_pid;
-       struct tm *ts;
-       for (p = filename; *p; p++) {
-               if (*p != '%')
-                       continue;
-               p++;
-               if (*p == 't')
-                       count_dates++;
-               else if (*p == 'p')
-                       count_pids++;
-               else if (*p == 0)
-                       break;
-       }
-       if (!count_dates && !count_pids)
-               return pstrdup (filename);
-       snprintf (pid_buf, sizeof (pid_buf), "%d", pid);
-       ts = gmtime (&t);
-       snprintf (time_buf, sizeof (time_buf), "%d%02d%02d%02d%02d%02d",
-               1900 + ts->tm_year, 1 + ts->tm_mon, ts->tm_mday, ts->tm_hour, ts->tm_min, ts->tm_sec);
-       s_date = strlen (time_buf);
-       s_pid = strlen (pid_buf);
-       d = res = (char *)malloc (strlen (filename) + s_date * count_dates + s_pid * count_pids);
-       for (p = filename; *p; p++) {
-               if (*p != '%') {
-                       *d++ = *p;
-                       continue;
-               }
-               p++;
-               if (*p == 't') {
-                       strcpy (d, time_buf);
-                       d += s_date;
-                       continue;
-               } else if (*p == 'p') {
-                       strcpy (d, pid_buf);
-                       d += s_pid;
-                       continue;
-               } else if (*p == '%') {
-                       *d++ = '%';
-                       continue;
-               } else if (*p == 0)
-                       break;
-               *d++ = '%';
-               *d++ = *p;
-       }
-       *d = 0;
-       return res;
-}
-
-//this is exposed by the JIT, but it's not meant to be a supported API for now.
-extern void mono_threads_attach_tools_thread (void);
-
-#ifndef DISABLE_HELPER_THREAD
-
-static void*
-helper_thread (void* arg)
-{
-       MonoProfiler* prof = (MonoProfiler *)arg;
-       int command_socket;
-       int len;
-       char buf [64];
-       MonoThread *thread = NULL;
-
-       mono_threads_attach_tools_thread ();
-       mono_native_thread_set_name (mono_native_thread_id_get (), "Profiler helper");
-
-       //fprintf (stderr, "Server listening\n");
-       command_socket = -1;
-       while (1) {
-               fd_set rfds;
-               struct timeval tv;
-               int max_fd = -1;
-               FD_ZERO (&rfds);
-               FD_SET (prof->server_socket, &rfds);
-               max_fd = prof->server_socket;
-               FD_SET (prof->pipes [0], &rfds);
-               if (max_fd < prof->pipes [0])
-                       max_fd = prof->pipes [0];
-               if (command_socket >= 0) {
-                       FD_SET (command_socket, &rfds);
-                       if (max_fd < command_socket)
-                               max_fd = command_socket;
-               }
-#if USE_PERF_EVENTS
-               if (perf_data) {
-                       int i;
-                       for ( i = 0; i < num_perf; ++i) {
-                               if (perf_data [i].perf_fd < 0)
-                                       continue;
-                               FD_SET (perf_data [i].perf_fd, &rfds);
-                               if (max_fd < perf_data [i].perf_fd)
-                                       max_fd = perf_data [i].perf_fd;
-                       }
-               }
-#endif
-
-               counters_and_perfcounters_sample (prof, TRUE);
-
-               tv.tv_sec = 1;
-               tv.tv_usec = 0;
-               len = select (max_fd + 1, &rfds, NULL, NULL, &tv);
-
-               if (len < 0) {
-                       if (errno == EINTR)
-                               continue;
-
-                       g_warning ("Error in proflog server: %s", strerror (errno));
-                       return NULL;
-               }
-
-               if (FD_ISSET (prof->pipes [0], &rfds)) {
-                       char c;
-                       read (prof->pipes [0], &c, 1);
-                       if (thread)
-                               mono_thread_detach (thread);
-                       if (do_debug)
-                               fprintf (stderr, "helper shutdown\n");
-#if USE_PERF_EVENTS
-                       if (perf_data) {
-                               int i;
-                               for ( i = 0; i < num_perf; ++i) {
-                                       if (perf_data [i].perf_fd < 0)
-                                               continue;
-                                       if (FD_ISSET (perf_data [i].perf_fd, &rfds))
-                                               read_perf_mmap (prof, i);
-                               }
-                       }
-#endif
-                       safe_send_threadless (prof, ensure_logbuf (0));
-                       return NULL;
-               }
-#if USE_PERF_EVENTS
-               if (perf_data) {
-                       int i;
-                       for ( i = 0; i < num_perf; ++i) {
-                               if (perf_data [i].perf_fd < 0)
-                                       continue;
-                               if (FD_ISSET (perf_data [i].perf_fd, &rfds)) {
-                                       read_perf_mmap (prof, i);
-                                       safe_send_threadless (prof, ensure_logbuf (0));
-                               }
-                       }
-               }
-#endif
-               if (command_socket >= 0 && FD_ISSET (command_socket, &rfds)) {
-                       len = read (command_socket, buf, sizeof (buf) - 1);
-                       if (len < 0)
-                               continue;
-                       if (len == 0) {
-                               close (command_socket);
-                               command_socket = -1;
-                               continue;
-                       }
-                       buf [len] = 0;
-                       if (strcmp (buf, "heapshot\n") == 0) {
-                               heapshot_requested = 1;
-                               //fprintf (stderr, "perform heapshot\n");
-                               if (InterlockedRead (&runtime_inited) && !thread) {
-                                       thread = mono_thread_attach (mono_get_root_domain ());
-                                       /*fprintf (stderr, "attached\n");*/
-                               }
-                               if (thread) {
-                                       process_requests (prof);
-                                       mono_thread_detach (thread);
-                                       thread = NULL;
-                               }
-                       }
-                       continue;
-               }
-               if (!FD_ISSET (prof->server_socket, &rfds)) {
-                       continue;
-               }
-               command_socket = accept (prof->server_socket, NULL, NULL);
-               if (command_socket < 0)
-                       continue;
-               //fprintf (stderr, "Accepted connection\n");
-       }
-
-       mono_thread_info_detach ();
-
-       return NULL;
-}
-
-static int
-start_helper_thread (MonoProfiler* prof)
-{
-       struct sockaddr_in server_address;
-       int r;
-       socklen_t slen;
-       if (pipe (prof->pipes) < 0) {
-               fprintf (stderr, "Cannot create pipe\n");
-               return 0;
-       }
-       prof->server_socket = socket (PF_INET, SOCK_STREAM, 0);
-       if (prof->server_socket < 0) {
-               fprintf (stderr, "Cannot create server socket\n");
-               return 0;
-       }
-       memset (&server_address, 0, sizeof (server_address));
-       server_address.sin_family = AF_INET;
-       server_address.sin_addr.s_addr = INADDR_ANY;
-       server_address.sin_port = htons (prof->command_port);
-       if (bind (prof->server_socket, (struct sockaddr *) &server_address, sizeof (server_address)) < 0) {
-               fprintf (stderr, "Cannot bind server socket, port: %d: %s\n", prof->command_port, strerror (errno));
-               close (prof->server_socket);
-               return 0;
-       }
-       if (listen (prof->server_socket, 1) < 0) {
-               fprintf (stderr, "Cannot listen server socket\n");
-               close (prof->server_socket);
-               return 0;
-       }
-       slen = sizeof (server_address);
-       if (getsockname (prof->server_socket, (struct sockaddr *)&server_address, &slen) == 0) {
-               prof->command_port = ntohs (server_address.sin_port);
-               /*fprintf (stderr, "Assigned server port: %d\n", prof->command_port);*/
-       }
-
-       r = pthread_create (&prof->helper_thread, NULL, helper_thread, prof);
-       if (r) {
-               close (prof->server_socket);
-               return 0;
-       }
-       return 1;
-}
-#endif
-
-static gboolean
-handle_writer_queue_entry (MonoProfiler *prof)
-{
-       WriterQueueEntry *entry;
-
-       if ((entry = (WriterQueueEntry *) mono_lock_free_queue_dequeue (&prof->writer_queue))) {
-               LogBuffer *method_buffer = NULL;
-               gboolean new_methods = FALSE;
-
-               if (entry->methods->len)
-                       method_buffer = create_buffer ();
-
-               /*
-                * Encode the method events in a temporary log buffer that we
-                * flush to disk before the main buffer, ensuring that all
-                * methods have metadata emitted before they're referenced.
-                */
-               for (guint i = 0; i < entry->methods->len; i++) {
-                       MethodInfo *info = (MethodInfo *)g_ptr_array_index (entry->methods, i);
-
-                       if (mono_conc_hashtable_lookup (prof->method_table, info->method))
-                               continue;
-
-                       new_methods = TRUE;
-
-                       /*
-                        * Other threads use this hash table to get a general
-                        * idea of whether a method has already been emitted to
-                        * the stream. Due to the way we add to this table, it
-                        * can easily happen that multiple threads queue up the
-                        * same methods, but that's OK since eventually all
-                        * methods will be in this table and the thread-local
-                        * method lists will just be empty for the rest of the
-                        * app's lifetime.
-                        */
-                       mono_os_mutex_lock (&prof->method_table_mutex);
-                       mono_conc_hashtable_insert (prof->method_table, info->method, info->method);
-                       mono_os_mutex_unlock (&prof->method_table_mutex);
-
-                       char *name = mono_method_full_name (info->method, 1);
-                       int nlen = strlen (name) + 1;
-                       void *cstart = info->ji ? mono_jit_info_get_code_start (info->ji) : NULL;
-                       int csize = info->ji ? mono_jit_info_get_code_size (info->ji) : 0;
-
-                       method_buffer = ensure_logbuf_inner (method_buffer,
-                               EVENT_SIZE /* event */ +
-                               LEB128_SIZE /* time */ +
-                               LEB128_SIZE /* method */ +
-                               LEB128_SIZE /* start */ +
-                               LEB128_SIZE /* size */ +
-                               nlen /* name */
-                       );
-
-                       emit_byte (method_buffer, TYPE_JIT | TYPE_METHOD);
-                       emit_time (method_buffer, info->time);
-                       emit_method_inner (method_buffer, info->method);
-                       emit_ptr (method_buffer, cstart);
-                       emit_value (method_buffer, csize);
-
-                       memcpy (method_buffer->cursor, name, nlen);
-                       method_buffer->cursor += nlen;
-
-                       mono_free (name);
-                       free (info);
-               }
-
-               g_ptr_array_free (entry->methods, TRUE);
-
-               if (new_methods) {
-                       for (LogBuffer *iter = method_buffer; iter; iter = iter->next)
-                               iter->thread_id = 0;
-
-                       dump_buffer (prof, method_buffer);
-               } else if (method_buffer)
-                       free_buffer (method_buffer, method_buffer->size);
-
-               dump_buffer (prof, entry->buffer);
-
-               mono_thread_hazardous_try_free (entry, free);
-
-               return TRUE;
-       }
-
-       return FALSE;
-}
-
-static void *
-writer_thread (void *arg)
-{
-       MonoProfiler *prof = (MonoProfiler *)arg;
-
-       mono_threads_attach_tools_thread ();
-       mono_native_thread_set_name (mono_native_thread_id_get (), "Profiler writer");
-
-       dump_header (prof);
-
-       while (InterlockedRead (&prof->run_writer_thread)) {
-               mono_os_sem_wait (&prof->writer_queue_sem, MONO_SEM_FLAGS_NONE);
-               handle_writer_queue_entry (prof);
-       }
-
-       /* Drain any remaining entries on shutdown. */
-       while (handle_writer_queue_entry (prof));
-
-       mono_thread_info_detach ();
-
-       return NULL;
-}
-
-static int
-start_writer_thread (MonoProfiler* prof)
-{
-       InterlockedWrite (&prof->run_writer_thread, 1);
-
-       return !pthread_create (&prof->writer_thread, NULL, writer_thread, prof);
-}
-
-static void
-reuse_sample_hit (gpointer p)
-{
-       SampleHit *sample = p;
-
-       mono_lock_free_queue_node_unpoison (&sample->node);
-       mono_lock_free_queue_enqueue (&sample->prof->sample_reuse_queue, &sample->node);
-}
-
-static gboolean
-handle_dumper_queue_entry (MonoProfiler *prof)
-{
-       SampleHit *sample;
-
-       if ((sample = (SampleHit *) mono_lock_free_queue_dequeue (&prof->dumper_queue))) {
-               for (int i = 0; i < sample->count; ++i) {
-                       MonoMethod *method = sample->frames [i].method;
-                       MonoDomain *domain = sample->frames [i].domain;
-                       void *address = sample->frames [i].base_address;
-
-                       if (!method) {
-                               g_assert (domain);
-                               g_assert (address);
-
-                               MonoJitInfo *ji = mono_jit_info_table_find (domain, (char *) address);
-
-                               if (ji)
-                                       sample->frames [i].method = mono_jit_info_get_method (ji);
-                       }
-               }
-
-               LogBuffer *logbuffer = ensure_logbuf (
-                       EVENT_SIZE /* event */ +
-                       LEB128_SIZE /* type */ +
-                       LEB128_SIZE /* time */ +
-                       LEB128_SIZE /* tid */ +
-                       LEB128_SIZE /* count */ +
-                       1 * (
-                               LEB128_SIZE /* ip */
-                       ) +
-                       LEB128_SIZE /* managed count */ +
-                       sample->count * (
-                               LEB128_SIZE /* method */ +
-                               LEB128_SIZE /* il offset */ +
-                               LEB128_SIZE /* native offset */
-                       )
-               );
-
-               emit_byte (logbuffer, TYPE_SAMPLE | TYPE_SAMPLE_HIT);
-               emit_value (logbuffer, sample_type);
-               emit_uvalue (logbuffer, prof->startup_time + sample->elapsed * 10000);
-               emit_ptr (logbuffer, (void *) sample->tid);
-               emit_value (logbuffer, 1);
-
-               // TODO: Actual native unwinding.
-               for (int i = 0; i < 1; ++i) {
-                       emit_ptr (logbuffer, sample->ip);
-                       add_code_pointer ((uintptr_t) sample->ip);
-               }
-
-               /* new in data version 6 */
-               emit_uvalue (logbuffer, sample->count);
-
-               for (int i = 0; i < sample->count; ++i) {
-                       emit_method (prof, logbuffer, sample->frames [i].method);
-                       emit_svalue (logbuffer, 0); /* il offset will always be 0 from now on */
-                       emit_svalue (logbuffer, sample->frames [i].offset);
-               }
-
-               mono_thread_hazardous_try_free (sample, reuse_sample_hit);
-
-               dump_unmanaged_coderefs (prof);
-
-               if (logbuffer->next)
-                       safe_send_threadless (prof, logbuffer);
-       }
-
-       return FALSE;
-}
-
-static void *
-dumper_thread (void *arg)
-{
-       MonoProfiler *prof = (MonoProfiler *)arg;
-
-       mono_threads_attach_tools_thread ();
-       mono_native_thread_set_name (mono_native_thread_id_get (), "Profiler dumper");
-
-       while (InterlockedRead (&prof->run_dumper_thread)) {
-               mono_os_sem_wait (&prof->dumper_queue_sem, MONO_SEM_FLAGS_NONE);
-               handle_dumper_queue_entry (prof);
-       }
-
-       /* Drain any remaining entries on shutdown. */
-       while (handle_dumper_queue_entry (prof));
-
-       safe_send_threadless (prof, ensure_logbuf (0));
-
-       mono_thread_info_detach ();
-
-       return NULL;
-}
-
-static int
-start_dumper_thread (MonoProfiler* prof)
-{
-       InterlockedWrite (&prof->run_dumper_thread, 1);
-
-       return !pthread_create (&prof->dumper_thread, NULL, dumper_thread, prof);
-}
-
-static void
-runtime_initialized (MonoProfiler *profiler)
-{
-#ifndef DISABLE_HELPER_THREAD
-       if (hs_mode_ondemand || need_helper_thread) {
-               if (!start_helper_thread (profiler))
-                       profiler->command_port = 0;
-       }
-#endif
-
-       start_writer_thread (profiler);
-       start_dumper_thread (profiler);
-
-       InterlockedWrite (&runtime_inited, 1);
-#ifndef DISABLE_HELPER_THREAD
-       counters_init (profiler);
-       counters_sample (profiler, 0, FALSE);
-#endif
-       /* ensure the main thread data and startup are available soon */
-       safe_send (profiler, ensure_logbuf (0));
-}
-
-static MonoProfiler*
-create_profiler (const char *filename, GPtrArray *filters)
-{
-       MonoProfiler *prof;
-       char *nf;
-       int force_delete = 0;
-       prof = (MonoProfiler *)calloc (1, sizeof (MonoProfiler));
-
-       prof->command_port = command_port;
-       if (filename && *filename == '-') {
-               force_delete = 1;
-               filename++;
-       }
-       if (!filename) {
-               if (do_report)
-                       filename = "|mprof-report -";
-               else
-                       filename = "output.mlpd";
-               nf = (char*)filename;
-       } else {
-               nf = new_filename (filename);
-               if (do_report) {
-                       int s = strlen (nf) + 32;
-                       char *p = (char *)malloc (s);
-                       snprintf (p, s, "|mprof-report '--out=%s' -", nf);
-                       free (nf);
-                       nf = p;
-               }
-       }
-       if (*nf == '|') {
-               prof->file = popen (nf + 1, "w");
-               prof->pipe_output = 1;
-       } else if (*nf == '#') {
-               int fd = strtol (nf + 1, NULL, 10);
-               prof->file = fdopen (fd, "a");
-       } else {
-               if (force_delete)
-                       unlink (nf);
-               prof->file = fopen (nf, "wb");
-       }
-       if (!prof->file) {
-               fprintf (stderr, "Cannot create profiler output: %s\n", nf);
-               exit (1);
-       }
-#if defined (HAVE_SYS_ZLIB)
-       if (use_zip)
-               prof->gzfile = gzdopen (fileno (prof->file), "wb");
-#endif
-#if USE_PERF_EVENTS
-       if (sample_type && !do_mono_sample)
-               need_helper_thread = setup_perf_event ();
-       if (!perf_data) {
-               /* FIXME: warn if different freq or sample type */
-               do_mono_sample = 1;
-       }
-#endif
-       if (do_mono_sample) {
-               need_helper_thread = 1;
-       }
-       if (do_counters && !need_helper_thread) {
-               need_helper_thread = 1;
-       }
-
-       /*
-        * If you hit this assert while increasing MAX_FRAMES, you need to increase
-        * SAMPLE_BLOCK_SIZE as well.
-        */
-       g_assert (SAMPLE_SLOT_SIZE (MAX_FRAMES) * 2 < LOCK_FREE_ALLOC_SB_USABLE_SIZE (SAMPLE_BLOCK_SIZE));
-
-       // FIXME: We should free this stuff too.
-       mono_lock_free_allocator_init_size_class (&prof->sample_size_class, SAMPLE_SLOT_SIZE (num_frames), SAMPLE_BLOCK_SIZE);
-       mono_lock_free_allocator_init_allocator (&prof->sample_allocator, &prof->sample_size_class);
-
-       mono_lock_free_queue_init (&prof->sample_reuse_queue);
-
-#ifdef DISABLE_HELPER_THREAD
-       if (hs_mode_ondemand)
-               fprintf (stderr, "Ondemand heapshot unavailable on this arch.\n");
-
-       if (do_coverage)
-               fprintf (stderr, "Coverage unavailable on this arch.\n");
-
-#endif
-
-       mono_lock_free_queue_init (&prof->writer_queue);
-       mono_os_sem_init (&prof->writer_queue_sem, 0);
-
-       mono_lock_free_queue_init (&prof->dumper_queue);
-       mono_os_sem_init (&prof->dumper_queue_sem, 0);
-
-       mono_os_mutex_init (&prof->method_table_mutex);
-       prof->method_table = mono_conc_hashtable_new (NULL, NULL);
-
-       if (do_coverage)
-               coverage_init (prof);
-       prof->coverage_filters = filters;
-
-       prof->startup_time = current_time ();
-       return prof;
-}
-
-static void
-usage (int do_exit)
-{
-       printf ("Log profiler version %d.%d (format: %d)\n", LOG_VERSION_MAJOR, LOG_VERSION_MINOR, LOG_DATA_VERSION);
-       printf ("Usage: mono --profile=log[:OPTION1[,OPTION2...]] program.exe\n");
-       printf ("Options:\n");
-       printf ("\thelp                 show this usage info\n");
-       printf ("\t[no]alloc            enable/disable recording allocation info\n");
-       printf ("\t[no]calls            enable/disable recording enter/leave method events\n");
-       printf ("\theapshot[=MODE]      record heap shot info (by default at each major collection)\n");
-       printf ("\t                     MODE: every XXms milliseconds, every YYgc collections, ondemand\n");
-       printf ("\tcounters             sample counters every 1s\n");
-       printf ("\tsample[=TYPE]        use statistical sampling mode (by default cycles/100)\n");
-       printf ("\t                     TYPE: cycles,instr,cacherefs,cachemiss,branches,branchmiss\n");
-       printf ("\t                     TYPE can be followed by /FREQUENCY\n");
-       printf ("\ttime=fast            use a faster (but more inaccurate) timer\n");
-       printf ("\tmaxframes=NUM        collect up to NUM stack frames\n");
-       printf ("\tcalldepth=NUM        ignore method events for call chain depth bigger than NUM\n");
-       printf ("\toutput=FILENAME      write the data to file FILENAME (-FILENAME to overwrite)\n");
-       printf ("\toutput=|PROGRAM      write the data to the stdin of PROGRAM\n");
-       printf ("\t                     %%t is subtituted with date and time, %%p with the pid\n");
-       printf ("\treport               create a report instead of writing the raw data to a file\n");
-       printf ("\tzip                  compress the output data\n");
-       printf ("\tport=PORTNUM         use PORTNUM for the listening command server\n");
-       printf ("\tcoverage             enable collection of code coverage data\n");
-       printf ("\tcovfilter=ASSEMBLY   add an assembly to the code coverage filters\n");
-       printf ("\t                     add a + to include the assembly or a - to exclude it\n");
-       printf ("\t                     filter=-mscorlib\n");
-       printf ("\tcovfilter-file=FILE  use FILE to generate the list of assemblies to be filtered\n");
-       if (do_exit)
-               exit (1);
-}
-
-static const char*
-match_option (const char* p, const char *opt, char **rval)
-{
-       int len = strlen (opt);
-       if (strncmp (p, opt, len) == 0) {
-               if (rval) {
-                       if (p [len] == '=' && p [len + 1]) {
-                               const char *opt = p + len + 1;
-                               const char *end = strchr (opt, ',');
-                               char *val;
-                               int l;
-                               if (end == NULL) {
-                                       l = strlen (opt);
-                               } else {
-                                       l = end - opt;
-                               }
-                               val = (char *)malloc (l + 1);
-                               memcpy (val, opt, l);
-                               val [l] = 0;
-                               *rval = val;
-                               return opt + l;
-                       }
-                       if (p [len] == 0 || p [len] == ',') {
-                               *rval = NULL;
-                               return p + len + (p [len] == ',');
-                       }
-                       usage (1);
-               } else {
-                       if (p [len] == 0)
-                               return p + len;
-                       if (p [len] == ',')
-                               return p + len + 1;
-               }
-       }
-       return p;
-}
-
-typedef struct {
-       const char *name;
-       int sample_mode;
-} SampleMode;
-
-static const SampleMode sample_modes [] = {
-       {"cycles", SAMPLE_CYCLES},
-       {"instr", SAMPLE_INSTRUCTIONS},
-       {"cachemiss", SAMPLE_CACHE_MISSES},
-       {"cacherefs", SAMPLE_CACHE_REFS},
-       {"branches", SAMPLE_BRANCHES},
-       {"branchmiss", SAMPLE_BRANCH_MISSES},
-       {NULL, 0}
-};
-
-static void
-set_sample_mode (char* val, int allow_empty)
-{
-       char *end;
-       char *maybe_freq = NULL;
-       unsigned int count;
-       const SampleMode *smode = sample_modes;
-#ifndef USE_PERF_EVENTS
-       do_mono_sample = 1;
-#endif
-       if (allow_empty && !val) {
-               sample_type = SAMPLE_CYCLES;
-               sample_freq = 100;
-               return;
-       }
-       if (strcmp (val, "mono") == 0) {
-               do_mono_sample = 1;
-               sample_type = SAMPLE_CYCLES;
-               free (val);
-               return;
-       }
-       for (smode = sample_modes; smode->name; smode++) {
-               int l = strlen (smode->name);
-               if (strncmp (val, smode->name, l) == 0) {
-                       sample_type = smode->sample_mode;
-                       maybe_freq = val + l;
-                       break;
-               }
-       }
-       if (!smode->name)
-               usage (1);
-       if (*maybe_freq == '/') {
-               count = strtoul (maybe_freq + 1, &end, 10);
-               if (maybe_freq + 1 == end)
-                       usage (1);
-               sample_freq = count;
-       } else if (*maybe_freq != 0) {
-               usage (1);
-       } else {
-               sample_freq = 100;
-       }
-       free (val);
-}
-
-static void
-set_hsmode (char* val, int allow_empty)
-{
-       char *end;
-       unsigned int count;
-       if (allow_empty && !val)
-               return;
-       if (strcmp (val, "ondemand") == 0) {
-               hs_mode_ondemand = 1;
-               free (val);
-               return;
-       }
-       count = strtoul (val, &end, 10);
-       if (val == end)
-               usage (1);
-       if (strcmp (end, "ms") == 0)
-               hs_mode_ms = count;
-       else if (strcmp (end, "gc") == 0)
-               hs_mode_gc = count;
-       else
-               usage (1);
-       free (val);
-}
-
-/*
- * declaration to silence the compiler: this is the entry point that
- * mono will load from the shared library and call.
- */
-extern void
-mono_profiler_startup (const char *desc);
-
-extern void
-mono_profiler_startup_log (const char *desc);
-
-/*
- * this is the entry point that will be used when the profiler
- * is embedded inside the main executable.
- */
-void
-mono_profiler_startup_log (const char *desc)
-{
-       mono_profiler_startup (desc);
-}
-
-void
-mono_profiler_startup (const char *desc)
-{
-       MonoProfiler *prof;
-       GPtrArray *filters = NULL;
-       char *filename = NULL;
-       const char *p;
-       const char *opt;
-       int fast_time = 0;
-       int calls_enabled = 0;
-       int allocs_enabled = 0;
-       int only_counters = 0;
-       int only_coverage = 0;
-       int events = MONO_PROFILE_GC|MONO_PROFILE_ALLOCATIONS|
-               MONO_PROFILE_GC_MOVES|MONO_PROFILE_CLASS_EVENTS|MONO_PROFILE_THREADS|
-               MONO_PROFILE_ENTER_LEAVE|MONO_PROFILE_JIT_COMPILATION|MONO_PROFILE_EXCEPTIONS|
-               MONO_PROFILE_MONITOR_EVENTS|MONO_PROFILE_MODULE_EVENTS|MONO_PROFILE_GC_ROOTS|
-               MONO_PROFILE_INS_COVERAGE|MONO_PROFILE_APPDOMAIN_EVENTS|MONO_PROFILE_CONTEXT_EVENTS|
-               MONO_PROFILE_ASSEMBLY_EVENTS;
-
-       max_allocated_sample_hits = mono_cpu_count () * 1000;
-
-       mono_counters_register ("Sample hits", MONO_COUNTER_UINT | MONO_COUNTER_PROFILER | MONO_COUNTER_MONOTONIC, &sample_hits);
-       mono_counters_register ("Sample flushes", MONO_COUNTER_UINT | MONO_COUNTER_PROFILER | MONO_COUNTER_MONOTONIC, &sample_flushes);
-       mono_counters_register ("Sample events allocated", MONO_COUNTER_UINT | MONO_COUNTER_PROFILER | MONO_COUNTER_MONOTONIC, &sample_allocations);
-       mono_counters_register ("Log buffers allocated", MONO_COUNTER_UINT | MONO_COUNTER_PROFILER | MONO_COUNTER_MONOTONIC, &buffer_allocations);
-       mono_counters_register ("Thread start events", MONO_COUNTER_UINT | MONO_COUNTER_PROFILER | MONO_COUNTER_MONOTONIC, &thread_starts);
-       mono_counters_register ("Thread stop events", MONO_COUNTER_UINT | MONO_COUNTER_PROFILER | MONO_COUNTER_MONOTONIC, &thread_ends);
-       mono_counters_register ("Domain load events", MONO_COUNTER_UINT | MONO_COUNTER_PROFILER | MONO_COUNTER_MONOTONIC, &domain_loads);
-       mono_counters_register ("Domain unload events", MONO_COUNTER_UINT | MONO_COUNTER_PROFILER | MONO_COUNTER_MONOTONIC, &domain_unloads);
-       mono_counters_register ("Context load events", MONO_COUNTER_UINT | MONO_COUNTER_PROFILER | MONO_COUNTER_MONOTONIC, &context_loads);
-       mono_counters_register ("Context unload events", MONO_COUNTER_UINT | MONO_COUNTER_PROFILER | MONO_COUNTER_MONOTONIC, &context_unloads);
-       mono_counters_register ("Assembly load events", MONO_COUNTER_UINT | MONO_COUNTER_PROFILER | MONO_COUNTER_MONOTONIC, &assembly_loads);
-       mono_counters_register ("Assembly unload events", MONO_COUNTER_UINT | MONO_COUNTER_PROFILER | MONO_COUNTER_MONOTONIC, &assembly_unloads);
-       mono_counters_register ("Image load events", MONO_COUNTER_UINT | MONO_COUNTER_PROFILER | MONO_COUNTER_MONOTONIC, &image_loads);
-       mono_counters_register ("Image unload events", MONO_COUNTER_UINT | MONO_COUNTER_PROFILER | MONO_COUNTER_MONOTONIC, &image_unloads);
-       mono_counters_register ("Class load events", MONO_COUNTER_UINT | MONO_COUNTER_PROFILER | MONO_COUNTER_MONOTONIC, &class_loads);
-       mono_counters_register ("Class unload events", MONO_COUNTER_UINT | MONO_COUNTER_PROFILER | MONO_COUNTER_MONOTONIC, &class_unloads);
-
-       p = desc;
-       if (strncmp (p, "log", 3))
-               usage (1);
-       p += 3;
-       if (*p == ':')
-               p++;
-       for (; *p; p = opt) {
-               char *val;
-               if (*p == ',') {
-                       opt = p + 1;
-                       continue;
-               }
-               if ((opt = match_option (p, "help", NULL)) != p) {
-                       usage (0);
-                       continue;
-               }
-               if ((opt = match_option (p, "calls", NULL)) != p) {
-                       calls_enabled = 1;
-                       continue;
-               }
-               if ((opt = match_option (p, "nocalls", NULL)) != p) {
-                       events &= ~MONO_PROFILE_ENTER_LEAVE;
-                       nocalls = 1;
-                       continue;
-               }
-               if ((opt = match_option (p, "alloc", NULL)) != p) {
-                       allocs_enabled = 1;
-                       continue;
-               }
-               if ((opt = match_option (p, "noalloc", NULL)) != p) {
-                       events &= ~MONO_PROFILE_ALLOCATIONS;
-                       continue;
-               }
-               if ((opt = match_option (p, "time", &val)) != p) {
-                       if (strcmp (val, "fast") == 0)
-                               fast_time = 1;
-                       else if (strcmp (val, "null") == 0)
-                               fast_time = 2;
-                       else
-                               usage (1);
-                       free (val);
-                       continue;
-               }
-               if ((opt = match_option (p, "report", NULL)) != p) {
-                       do_report = 1;
-                       continue;
-               }
-               if ((opt = match_option (p, "debug", NULL)) != p) {
-                       do_debug = 1;
-                       continue;
-               }
-               if ((opt = match_option (p, "sampling-real", NULL)) != p) {
-                       sampling_mode = MONO_PROFILER_STAT_MODE_REAL;
-                       continue;
-               }
-               if ((opt = match_option (p, "sampling-process", NULL)) != p) {
-                       sampling_mode = MONO_PROFILER_STAT_MODE_PROCESS;
-                       continue;
-               }
-               if ((opt = match_option (p, "heapshot", &val)) != p) {
-                       events &= ~MONO_PROFILE_ALLOCATIONS;
-                       events &= ~MONO_PROFILE_ENTER_LEAVE;
-                       nocalls = 1;
-                       do_heap_shot = 1;
-                       set_hsmode (val, 1);
-                       continue;
-               }
-               if ((opt = match_option (p, "sample", &val)) != p) {
-                       events &= ~MONO_PROFILE_ALLOCATIONS;
-                       events &= ~MONO_PROFILE_ENTER_LEAVE;
-                       nocalls = 1;
-                       set_sample_mode (val, 1);
-                       continue;
-               }
-               if ((opt = match_option (p, "hsmode", &val)) != p) {
-                       fprintf (stderr, "The hsmode profiler option is obsolete, use heapshot=MODE.\n");
-                       set_hsmode (val, 0);
-                       continue;
-               }
-               if ((opt = match_option (p, "zip", NULL)) != p) {
-                       use_zip = 1;
-                       continue;
-               }
-               if ((opt = match_option (p, "output", &val)) != p) {
-                       filename = val;
-                       continue;
-               }
-               if ((opt = match_option (p, "port", &val)) != p) {
-                       char *end;
-                       command_port = strtoul (val, &end, 10);
-                       free (val);
-                       continue;
-               }
-               if ((opt = match_option (p, "maxframes", &val)) != p) {
-                       char *end;
-                       num_frames = strtoul (val, &end, 10);
-                       if (num_frames > MAX_FRAMES)
-                               num_frames = MAX_FRAMES;
-                       free (val);
-                       notraces = num_frames == 0;
-                       continue;
-               }
-               if ((opt = match_option (p, "maxsamples", &val)) != p) {
-                       char *end;
-                       max_allocated_sample_hits = strtoul (val, &end, 10);
-                       if (!max_allocated_sample_hits)
-                               max_allocated_sample_hits = G_MAXINT32;
-                       free (val);
-                       continue;
-               }
-               if ((opt = match_option (p, "calldepth", &val)) != p) {
-                       char *end;
-                       max_call_depth = strtoul (val, &end, 10);
-                       free (val);
-                       continue;
-               }
-               if ((opt = match_option (p, "counters", NULL)) != p) {
-                       do_counters = 1;
-                       continue;
-               }
-               if ((opt = match_option (p, "countersonly", NULL)) != p) {
-                       only_counters = 1;
-                       continue;
-               }
-               if ((opt = match_option (p, "coverage", NULL)) != p) {
-                       do_coverage = 1;
-                       events |= MONO_PROFILE_ENTER_LEAVE;
-                       debug_coverage = (g_getenv ("MONO_PROFILER_DEBUG_COVERAGE") != NULL);
-                       continue;
-               }
-               if ((opt = match_option (p, "onlycoverage", NULL)) != p) {
-                       only_coverage = 1;
-                       continue;
-               }
-               if ((opt = match_option (p, "covfilter-file", &val)) != p) {
-                       FILE *filter_file;
-                       char *line, *content;
-
-                       if (filters == NULL)
-                               filters = g_ptr_array_new ();
-
-                       filter_file = fopen (val, "r");
-                       if (filter_file == NULL) {
-                               fprintf (stderr, "Unable to open %s\n", val);
-                               exit (0);
-                       }
-
-                       /* Don't need to free content as it is referred to by the lines stored in @filters */
-                       content = get_file_content (filter_file);
-                       if (content == NULL)
-                               fprintf (stderr, "WARNING: %s is greater than 128kb - ignoring\n", val);
-
-                       while ((line = get_next_line (content, &content)))
-                               g_ptr_array_add (filters, g_strchug (g_strchomp (line)));
-
-                       fclose (filter_file);
-                       continue;
-               }
-               if ((opt = match_option (p, "covfilter", &val)) != p) {
-                       if (filters == NULL)
-                               filters = g_ptr_array_new ();
-
-                       g_ptr_array_add (filters, val);
-                       continue;
-               }
-               if (opt == p) {
-                       usage (0);
-                       exit (0);
-               }
-       }
-       if (calls_enabled) {
-               events |= MONO_PROFILE_ENTER_LEAVE;
-               nocalls = 0;
-       }
-       if (allocs_enabled)
-               events |= MONO_PROFILE_ALLOCATIONS;
-       if (only_counters)
-               events = 0;
-       if (only_coverage)
-               events = MONO_PROFILE_ENTER_LEAVE | MONO_PROFILE_INS_COVERAGE;
-
-       utils_init (fast_time);
-
-       prof = create_profiler (filename, filters);
-       if (!prof)
-               return;
-
-       init_thread ();
-
-       mono_profiler_install (prof, log_shutdown);
-       mono_profiler_install_gc (gc_event, gc_resize);
-       mono_profiler_install_allocation (gc_alloc);
-       mono_profiler_install_gc_moves (gc_moves);
-       mono_profiler_install_gc_roots (gc_handle, gc_roots);
-       mono_profiler_install_appdomain (NULL, domain_loaded, domain_unloaded, NULL);
-       mono_profiler_install_appdomain_name (domain_name);
-       mono_profiler_install_context (context_loaded, context_unloaded);
-       mono_profiler_install_class (NULL, class_loaded, class_unloaded, NULL);
-       mono_profiler_install_module (NULL, image_loaded, image_unloaded, NULL);
-       mono_profiler_install_assembly (NULL, assembly_loaded, assembly_unloaded, NULL);
-       mono_profiler_install_thread (thread_start, thread_end);
-       mono_profiler_install_thread_name (thread_name);
-       mono_profiler_install_enter_leave (method_enter, method_leave);
-       mono_profiler_install_jit_end (method_jitted);
-       mono_profiler_install_code_buffer_new (code_buffer_new);
-       mono_profiler_install_exception (throw_exc, method_exc_leave, clause_exc);
-       mono_profiler_install_monitor (monitor_event);
-       mono_profiler_install_runtime_initialized (runtime_initialized);
-       if (do_coverage)
-               mono_profiler_install_coverage_filter (coverage_filter);
-
-       if (do_mono_sample && sample_type == SAMPLE_CYCLES && !only_counters) {
-               events |= MONO_PROFILE_STATISTICAL;
-               mono_profiler_set_statistical_mode (sampling_mode, sample_freq);
-               mono_profiler_install_statistical (mono_sample_hit);
-       }
-
-       mono_profiler_set_events ((MonoProfileFlags)events);
-
-       TLS_INIT (tlsbuffer);
-       TLS_INIT (tlsmethodlist);
-}
diff --git a/mono/profiler/proflog.h b/mono/profiler/proflog.h
deleted file mode 100644 (file)
index ecb0e43..0000000
+++ /dev/null
@@ -1,109 +0,0 @@
-#ifndef __MONO_PROFLOG_H__
-#define __MONO_PROFLOG_H__
-
-#define BUF_ID 0x4D504C01
-#define LOG_HEADER_ID 0x4D505A01
-#define LOG_VERSION_MAJOR 0
-#define LOG_VERSION_MINOR 4
-#define LOG_DATA_VERSION 12
-/*
- * Changes in data versions:
- * version 2: added offsets in heap walk
- * version 3: added GC roots
- * version 4: added sample/statistical profiling
- * version 5: added counters sampling
- * version 6: added optional backtrace in sampling info
- * version 8: added TYPE_RUNTIME and JIT helpers/trampolines
- * version 9: added MONO_PROFILER_CODE_BUFFER_EXCEPTION_HANDLING
- * version 10: added TYPE_COVERAGE
- * version 11: added thread ID to TYPE_SAMPLE_HIT
-               added more load/unload events
-                   unload for class
-                   unload for image
-                   load/unload for appdomain
-                   load/unload for contexts
-                   load/unload/name for assemblies
-               removed TYPE_LOAD_ERR flag (profiler never generated it, now removed from the format itself)
-               added TYPE_GC_HANDLE_{CREATED,DESTROYED}_BT
-               TYPE_JIT events are no longer guaranteed to have code start/size info (can be zero)
- * version 12: added MONO_COUNTER_PROFILER
- */
-
-enum {
-       TYPE_ALLOC,
-       TYPE_GC,
-       TYPE_METADATA,
-       TYPE_METHOD,
-       TYPE_EXCEPTION,
-       TYPE_MONITOR,
-       TYPE_HEAP,
-       TYPE_SAMPLE,
-       TYPE_RUNTIME,
-       TYPE_COVERAGE,
-       /* extended type for TYPE_HEAP */
-       TYPE_HEAP_START  = 0 << 4,
-       TYPE_HEAP_END    = 1 << 4,
-       TYPE_HEAP_OBJECT = 2 << 4,
-       TYPE_HEAP_ROOT   = 3 << 4,
-       /* extended type for TYPE_METADATA */
-       TYPE_END_LOAD     = 2 << 4,
-       TYPE_END_UNLOAD   = 4 << 4,
-       /* metadata type byte for TYPE_METADATA */
-       TYPE_CLASS     = 1,
-       TYPE_IMAGE     = 2,
-       TYPE_ASSEMBLY  = 3,
-       TYPE_DOMAIN    = 4,
-       TYPE_THREAD    = 5,
-       TYPE_CONTEXT   = 6,
-       /* extended type for TYPE_GC */
-       TYPE_GC_EVENT  = 1 << 4,
-       TYPE_GC_RESIZE = 2 << 4,
-       TYPE_GC_MOVE   = 3 << 4,
-       TYPE_GC_HANDLE_CREATED      = 4 << 4,
-       TYPE_GC_HANDLE_DESTROYED    = 5 << 4,
-       TYPE_GC_HANDLE_CREATED_BT   = 6 << 4,
-       TYPE_GC_HANDLE_DESTROYED_BT = 7 << 4,
-       /* extended type for TYPE_METHOD */
-       TYPE_LEAVE     = 1 << 4,
-       TYPE_ENTER     = 2 << 4,
-       TYPE_EXC_LEAVE = 3 << 4,
-       TYPE_JIT       = 4 << 4,
-       /* extended type for TYPE_EXCEPTION */
-       TYPE_THROW        = 0 << 4,
-       TYPE_CLAUSE       = 1 << 4,
-       TYPE_EXCEPTION_BT = 1 << 7,
-       /* extended type for TYPE_ALLOC */
-       TYPE_ALLOC_NO_BT  = 0 << 4,
-       TYPE_ALLOC_BT     = 1 << 4,
-       /* extended type for TYPE_MONITOR */
-       TYPE_MONITOR_NO_BT  = 0 << 7,
-       TYPE_MONITOR_BT     = 1 << 7,
-       /* extended type for TYPE_SAMPLE */
-       TYPE_SAMPLE_HIT           = 0 << 4,
-       TYPE_SAMPLE_USYM          = 1 << 4,
-       TYPE_SAMPLE_UBIN          = 2 << 4,
-       TYPE_SAMPLE_COUNTERS_DESC = 3 << 4,
-       TYPE_SAMPLE_COUNTERS      = 4 << 4,
-       /* extended type for TYPE_RUNTIME */
-       TYPE_JITHELPER = 1 << 4,
-       /* extended type for TYPE_COVERAGE */
-       TYPE_COVERAGE_ASSEMBLY = 0 << 4,
-       TYPE_COVERAGE_METHOD   = 1 << 4,
-       TYPE_COVERAGE_STATEMENT = 2 << 4,
-       TYPE_COVERAGE_CLASS = 3 << 4,
-       TYPE_END
-};
-
-// Sampling sources
-// Unless you have compiled with --enable-perf-events, only SAMPLE_CYCLES is available
-enum {
-       SAMPLE_CYCLES = 1,
-       SAMPLE_INSTRUCTIONS,
-       SAMPLE_CACHE_MISSES,
-       SAMPLE_CACHE_REFS,
-       SAMPLE_BRANCHES,
-       SAMPLE_BRANCH_MISSES,
-       SAMPLE_LAST
-};
-
-#endif /* __MONO_PROFLOG_H__ */
diff --git a/mono/profiler/utils.c b/mono/profiler/utils.c
deleted file mode 100644 (file)
index 753024d..0000000
+++ /dev/null
@@ -1,426 +0,0 @@
-/*
- * utils.c: log profiler and reporter utils
- *
- * We have here the minimal needed portability functions: we can't depend
- * on the ones provided by the runtime, since they are internal and,
- * especially mprof-report is an external program.
- * Note also that we don't take a glib/eglib dependency here for mostly
- * the same reason (but also because we need tight control in the profiler
- * over memory allocation, which needs to work with the world stopped).
- *
- * Author:
- *   Paolo Molaro (lupus@ximian.com)
- *
- * Copyright 2010 Novell, Inc (http://www.novell.com)
- * Licensed under the MIT license. See LICENSE file in the project root for full license information.
- */
-#include "utils.h"
-#include <stdlib.h>
-#include <time.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-#ifdef HOST_WIN32
-#include <windows.h>
-#else
-#include <pthread.h>
-#include <sched.h>
-#endif
-
-
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
-#if HAVE_SYS_MMAN_H
-#include <sys/mman.h>
-#endif
-
-#if defined(__APPLE__)
-#include <mach/mach_time.h>  
-#include <stdio.h> 
-
-static mach_timebase_info_data_t timebase_info;
-#endif
-
-#ifndef MAP_ANONYMOUS
-#define MAP_ANONYMOUS MAP_ANON
-#endif
-
-#define TICKS_PER_SEC 1000000000LL
-
-#if (defined(TARGET_X86) || defined(TARGET_AMD64)) && defined(__linux__) && defined(HAVE_SCHED_GETCPU)
-#define HAVE_RDTSC 1
-#endif
-
-typedef struct {
-       unsigned int timer_count;
-       int last_cpu;
-       uint64_t last_rdtsc;
-       uint64_t last_time;
-} TlsData;
-
-#ifdef HOST_WIN32
-static int tls_data;
-#define DECL_TLS_DATA TlsData *tls; tls = (TlsData *) TlsGetValue (tls_data); if (tls == NULL) { tls = (TlsData *) calloc (sizeof (TlsData), 1); TlsSetValue (tls_data, tls); }
-#define TLS_INIT(x) x = TlsAlloc()
-#elif HAVE_KW_THREAD
-static __thread TlsData tls_data;
-#define DECL_TLS_DATA TlsData *tls = &tls_data
-#define TLS_INIT(x)
-#else
-static pthread_key_t tls_data;
-#define DECL_TLS_DATA TlsData *tls; tls = (TlsData *) pthread_getspecific (tls_data); if (tls == NULL) { tls = (TlsData *) calloc (sizeof (TlsData), 1); pthread_setspecific (tls_data, tls); }
-#define TLS_INIT(x) pthread_key_create(&x, NULL)
-#endif
-
-#ifdef HOST_WIN32
-static CRITICAL_SECTION log_lock;
-static LARGE_INTEGER pcounter_freq;
-#else
-static pthread_mutex_t log_lock = PTHREAD_MUTEX_INITIALIZER;
-#endif
-
-static int timer_overhead = 0;
-static uint64_t time_inc = 0;
-typedef uint64_t (*TimeFunc)(void);
-
-static TimeFunc time_func;
-
-static uint64_t
-clock_time (void)
-{
-#if defined(__APPLE__)
-       uint64_t time = mach_absolute_time ();
-       
-       time *= timebase_info.numer;
-       time /= timebase_info.denom;
-
-       return time;
-#elif defined(HOST_WIN32)
-       LARGE_INTEGER value;
-       QueryPerformanceCounter (&value);
-       return value.QuadPart * TICKS_PER_SEC / pcounter_freq.QuadPart;
-#elif defined(CLOCK_MONOTONIC)
-       struct timespec tspec;
-       clock_gettime (CLOCK_MONOTONIC, &tspec);
-       return ((uint64_t)tspec.tv_sec * TICKS_PER_SEC + tspec.tv_nsec);
-#else
-       struct timeval tv;
-       gettimeofday (&tv, NULL);
-       return ((uint64_t)tv.tv_sec * TICKS_PER_SEC + tv.tv_usec * 1000);
-#endif
-}
-
-/* must be power of two */
-#define TIME_ADJ 8
-
-static uint64_t
-fast_current_time (void)
-{
-       DECL_TLS_DATA;
-       if (tls->timer_count++ & (TIME_ADJ - 1)) {
-               tls->last_time += time_inc;
-               return tls->last_time;
-       }
-       tls->last_time = clock_time ();
-       return tls->last_time;
-}
-
-#if HAVE_RDTSC
-
-#define rdtsc(low,high) \
-       __asm__ __volatile__("rdtsc" : "=a" (low), "=d" (high))
-
-static uint64_t
-safe_rdtsc (int *cpu)
-{
-       unsigned int low, high;
-       int c1 = sched_getcpu ();
-       int c2;
-       rdtsc (low, high);
-       c2 = sched_getcpu ();
-       if (c1 != c2) {
-               *cpu = -1;
-               return 0;
-       }
-       *cpu = c1;
-       return (((uint64_t) high) << 32) + (uint64_t)low;
-}
-
-static double cpu_freq;
-
-static int 
-have_rdtsc (void) {
-       char buf[256];
-       int have_freq = 0;
-       int have_flag = 0;
-       float val;
-       FILE *cpuinfo;
-       int cpu = sched_getcpu ();
-
-       if (cpu < 0)
-               return 0;
-
-       if (!(cpuinfo = fopen ("/proc/cpuinfo", "r")))
-               return 0;
-       while (fgets (buf, sizeof(buf), cpuinfo)) {
-               if (sscanf (buf, "cpu MHz : %f", &val) == 1) {
-                       /*printf ("got mh: %f\n", val);*/
-                       have_freq = 1;
-                       cpu_freq = val * 1000000;
-               }
-               if (strncmp (buf, "flags :", 5) == 0) {
-                       if (strstr (buf, "constant_tsc")) {
-                               have_flag = 1;
-                               /*printf ("have tsc\n");*/
-                       }
-               }
-       }
-       fclose (cpuinfo);
-       return have_flag? have_freq: 0;
-}
-
-static uint64_t
-rdtsc_current_time (void)
-{
-       DECL_TLS_DATA;
-       if (tls->timer_count++ & (TIME_ADJ*8 - 1)) {
-               int cpu;
-               uint64_t tsc = safe_rdtsc (&cpu);
-               if (cpu != -1 && cpu == tls->last_cpu) {
-                       int64_t diff = tsc - tls->last_rdtsc;
-                       uint64_t nsecs;
-                       if (diff > 0) {
-                               nsecs = (double)diff/cpu_freq;
-                               //printf ("%llu cycles: %llu nsecs\n", diff, nsecs);
-                               return tls->last_time + nsecs;
-                       } else {
-                               printf ("tsc went backwards\n");
-                       }
-               } else {
-                       //printf ("wrong cpu: %d\n", cpu);
-               }
-       }
-       tls->last_time = clock_time ();
-       tls->last_rdtsc = safe_rdtsc (&tls->last_cpu);
-       return tls->last_time;
-}
-#else
-#define have_rdtsc() 0
-#define rdtsc_current_time fast_current_time
-#endif
-
-static uint64_t
-null_time (void)
-{
-       static uint64_t timer = 0;
-       return timer++;
-}
-
-void
-utils_init (int fast_time)
-{
-       int i;
-       uint64_t time_start, time_end;
-       TLS_INIT (tls_data);
-#ifdef HOST_WIN32
-       InitializeCriticalSection (&log_lock);
-       QueryPerformanceFrequency (&pcounter_freq);
-#endif
-#if defined (__APPLE__)
-       mach_timebase_info (&timebase_info);
-#endif
-
-       if (fast_time > 1) {
-               time_func = null_time;
-       } else if (fast_time) {
-               uint64_t timea;
-               uint64_t timeb;
-               clock_time ();
-               timea = clock_time ();
-               timeb = clock_time ();
-               time_inc = (timeb - timea) / TIME_ADJ;
-               /*printf ("time inc: %llu, timea: %llu, timeb: %llu, diff: %llu\n", time_inc, timea, timeb, timec-timeb);*/
-               if (have_rdtsc ())
-                       time_func = rdtsc_current_time;
-               else
-                       time_func = fast_current_time;
-       } else {
-               time_func = clock_time;
-       }
-       time_start = time_func ();
-       for (i = 0; i < 256; ++i)
-               time_func ();
-       time_end = time_func ();
-       timer_overhead = (time_end - time_start) / 256;
-}
-
-int
-get_timer_overhead (void)
-{
-       return timer_overhead;
-}
-
-uint64_t
-current_time (void)
-{
-       return time_func ();
-}
-
-void*
-alloc_buffer (int size)
-{
-       void *ptr;
-#ifdef HOST_WIN32
-       ptr = VirtualAlloc (NULL, size, MEM_COMMIT, PAGE_READWRITE);
-       return ptr;
-#else
-       ptr = mmap (NULL, size, PROT_READ|PROT_WRITE, MAP_ANONYMOUS|MAP_PRIVATE, -1, 0);
-       if (ptr == MAP_FAILED)
-               return NULL;
-       return ptr;
-#endif
-}
-
-void
-free_buffer (void *buf, int size)
-{
-#ifdef HOST_WIN32
-       VirtualFree (buf, 0, MEM_RELEASE);
-#else
-       munmap (buf, size);
-#endif
-}
-
-void
-take_lock (void)
-{
-#ifdef HOST_WIN32
-       EnterCriticalSection (&log_lock);
-#else
-       pthread_mutex_lock (&log_lock);
-#endif
-}
-
-void
-release_lock (void)
-{
-#ifdef HOST_WIN32
-       LeaveCriticalSection (&log_lock);
-#else
-       pthread_mutex_unlock (&log_lock);
-#endif
-}
-
-void
-encode_uleb128 (uint64_t value, uint8_t *buf, uint8_t **endbuf)
-{
-       uint8_t *p = buf;
-
-       do {
-               uint8_t b = value & 0x7f;
-               value >>= 7;
-               if (value != 0) /* more bytes to come */
-                       b |= 0x80;
-               *p ++ = b;
-       } while (value);
-
-       *endbuf = p;
-}
-
-void
-encode_sleb128 (intptr_t value, uint8_t *buf, uint8_t **endbuf)
-{
-       int more = 1;
-       int negative = (value < 0);
-       unsigned int size = sizeof (intptr_t) * 8;
-       uint8_t byte;
-       uint8_t *p = buf;
-
-       while (more) {
-               byte = value & 0x7f;
-               value >>= 7;
-               /* the following is unnecessary if the
-                * implementation of >>= uses an arithmetic rather
-                * than logical shift for a signed left operand
-                */
-               if (negative)
-                       /* sign extend */
-                       value |= - ((intptr_t)1 <<(size - 7));
-               /* sign bit of byte is second high order bit (0x40) */
-               if ((value == 0 && !(byte & 0x40)) ||
-                       (value == -1 && (byte & 0x40)))
-                       more = 0;
-               else
-                       byte |= 0x80;
-               *p ++= byte;
-       }
-
-       *endbuf = p;
-}
-
-uint64_t
-decode_uleb128 (uint8_t *buf, uint8_t **endbuf)
-{
-       uint64_t res = 0;
-       int shift = 0;
-
-       while (1) {
-               uint8_t b = *buf++;
-
-               res |= (((uint64_t)(b & 0x7f)) << shift);
-               if (!(b & 0x80))
-                       break;
-               shift += 7;
-       }
-
-       *endbuf = buf;
-
-       return res;
-}
-
-intptr_t
-decode_sleb128 (uint8_t *buf, uint8_t **endbuf)
-{
-       uint8_t *p = buf;
-       intptr_t res = 0;
-       int shift = 0;
-
-       while (1) {
-               uint8_t b = *p;
-               p ++;
-
-               res = res | (((intptr_t)(b & 0x7f)) << shift);
-               shift += 7;
-               if (!(b & 0x80)) {
-                       if (shift < sizeof (intptr_t) * 8 && (b & 0x40))
-                               res |= - ((intptr_t)1 << shift);
-                       break;
-               }
-       }
-
-       *endbuf = p;
-
-       return res;
-}
-
-uintptr_t
-thread_id (void)
-{
-#ifdef HOST_WIN32
-       return (uintptr_t)GetCurrentThreadId ();
-#else
-       return (uintptr_t)pthread_self ();
-#endif
-}
-
-uintptr_t
-process_id (void)
-{
-#ifdef HOST_WIN32
-       return 0; /* FIXME */
-#else
-       return (uintptr_t)getpid ();
-#endif
-}
-
diff --git a/mono/profiler/utils.h b/mono/profiler/utils.h
deleted file mode 100644 (file)
index 3af56d2..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-#ifndef __MONO_MPLOG_UTILS_H__
-#define __MONO_MPLOG_UTILS_H__
-
-#include "config.h"
-#include "mono/utils/mono-publib.h"
-
-void utils_init (int fast_time);
-int get_timer_overhead (void);
-uint64_t current_time (void);
-void* alloc_buffer (int size);
-void free_buffer (void *buf, int size);
-void take_lock (void);
-void release_lock (void);
-uintptr_t thread_id (void);
-uintptr_t process_id (void);
-
-void encode_uleb128 (uint64_t value, uint8_t *buf, uint8_t **endbuf);
-void encode_sleb128 (intptr_t value, uint8_t *buf, uint8_t **endbuf);
-uint64_t decode_uleb128 (uint8_t *buf, uint8_t **endbuf);
-intptr_t decode_sleb128 (uint8_t *buf, uint8_t **endbuf);
-
-
-#endif /* __MONO_MPLOG_UTILS_H__ */
-
index 9fe2f3ceeb4a62b9fc16be861e6d28179fcaac1c..62039f7267901a805e94c8e1fb79c4c7c72a9dca 100644 (file)
@@ -110,4 +110,9 @@ void mono_gc_memmove_aligned (void *dest, const void *src, size_t size);
 
 FILE *mono_gc_get_logfile (void);
 
+/* equivalent to options set via MONO_GC_PARAMS */
+void mono_gc_params_set (const char* options);
+/* equivalent to options set via MONO_GC_DEBUG */
+void mono_gc_debug_set (const char* options);
+
 #endif
index 2e9f4666d21675f5a13596ee5bb8d14ecd26c68d..fa6046f519a7eca2a9bb6b91854e07ac7058da5c 100644 (file)
@@ -57,27 +57,11 @@ static guint64 stat_bytes_alloced_los = 0;
  * tlab_real_end points to the end of the TLAB.
  */
 
-/*
- * FIXME: What is faster, a TLS variable pointing to a structure, or separate TLS 
- * variables for next+temp_end ?
- */
-#ifdef HAVE_KW_THREAD
-static __thread char *tlab_start;
-static __thread char *tlab_next;
-static __thread char *tlab_temp_end;
-static __thread char *tlab_real_end;
-/* Used by the managed allocator/wbarrier */
-static __thread char **tlab_next_addr MONO_ATTR_USED;
-#ifndef SGEN_WITHOUT_MONO
-static __thread volatile int *in_critical_region_addr MONO_ATTR_USED;
-#endif
-#endif
-
 #ifdef HAVE_KW_THREAD
-#define TLAB_START     tlab_start
-#define TLAB_NEXT      tlab_next
-#define TLAB_TEMP_END  tlab_temp_end
-#define TLAB_REAL_END  tlab_real_end
+#define TLAB_START     (sgen_thread_info->tlab_start)
+#define TLAB_NEXT      (sgen_thread_info->tlab_next)
+#define TLAB_TEMP_END  (sgen_thread_info->tlab_temp_end)
+#define TLAB_REAL_END  (sgen_thread_info->tlab_real_end)
 #else
 #define TLAB_START     (__thread_info__->tlab_start)
 #define TLAB_NEXT      (__thread_info__->tlab_next)
@@ -418,8 +402,11 @@ sgen_alloc_obj (GCVTable vtable, size_t size)
                int current_alloc = InterlockedIncrement (&alloc_count);
 
                if (verify_before_allocs) {
-                       if ((current_alloc % verify_before_allocs) == 0)
+                       if ((current_alloc % verify_before_allocs) == 0) {
+                               LOCK_GC;
                                sgen_check_whole_heap_stw ();
+                               UNLOCK_GC;
+                       }
                }
                if (collect_before_allocs) {
                        if (((current_alloc % collect_before_allocs) == 0) && nursery_section) {
@@ -490,26 +477,6 @@ sgen_alloc_obj_mature (GCVTable vtable, size_t size)
        return res;
 }
 
-void
-sgen_init_tlab_info (SgenThreadInfo* info)
-{
-#ifndef HAVE_KW_THREAD
-       SgenThreadInfo *__thread_info__ = info;
-#endif
-
-       info->tlab_start_addr = &TLAB_START;
-       info->tlab_next_addr = &TLAB_NEXT;
-       info->tlab_temp_end_addr = &TLAB_TEMP_END;
-       info->tlab_real_end_addr = &TLAB_REAL_END;
-
-#ifdef HAVE_KW_THREAD
-       tlab_next_addr = &tlab_next;
-#ifndef SGEN_WITHOUT_MONO
-       in_critical_region_addr = &info->client_info.in_critical_region;
-#endif
-#endif
-}
-
 /*
  * Clear the thread local TLAB variables for all threads.
  */
@@ -518,30 +485,16 @@ sgen_clear_tlabs (void)
 {
        FOREACH_THREAD (info) {
                /* A new TLAB will be allocated when the thread does its first allocation */
-               *info->tlab_start_addr = NULL;
-               *info->tlab_next_addr = NULL;
-               *info->tlab_temp_end_addr = NULL;
-               *info->tlab_real_end_addr = NULL;
+               info->tlab_start = NULL;
+               info->tlab_next = NULL;
+               info->tlab_temp_end = NULL;
+               info->tlab_real_end = NULL;
        } FOREACH_THREAD_END
 }
 
 void
 sgen_init_allocator (void)
 {
-#if defined(HAVE_KW_THREAD) && !defined(SGEN_WITHOUT_MONO)
-       int tlab_next_addr_offset = -1;
-       int tlab_temp_end_offset = -1;
-       int in_critical_region_addr_offset = -1;
-
-       MONO_THREAD_VAR_OFFSET (tlab_next_addr, tlab_next_addr_offset);
-       MONO_THREAD_VAR_OFFSET (tlab_temp_end, tlab_temp_end_offset);
-       MONO_THREAD_VAR_OFFSET (in_critical_region_addr, in_critical_region_addr_offset);
-
-       mono_tls_key_set_offset (TLS_KEY_SGEN_TLAB_NEXT_ADDR, tlab_next_addr_offset);
-       mono_tls_key_set_offset (TLS_KEY_SGEN_TLAB_TEMP_END, tlab_temp_end_offset);
-       mono_tls_key_set_offset (TLS_KEY_SGEN_IN_CRITICAL_REGION_ADDR, in_critical_region_addr_offset);
-#endif
-
 #ifdef HEAVY_STATISTICS
        mono_counters_register ("# objects allocated", MONO_COUNTER_GC | MONO_COUNTER_ULONG, &stat_objects_alloced);
        mono_counters_register ("bytes allocated", MONO_COUNTER_GC | MONO_COUNTER_ULONG, &stat_bytes_alloced);
index 50369b0a783f22a7314279f70f0416c6a3ab84aa..af9fd1e33d525a20df807957f744911e64deb73a 100644 (file)
@@ -573,10 +573,10 @@ sgen_card_tables_collect_stats (gboolean begin)
 void
 sgen_card_table_init (SgenRememberedSet *remset)
 {
-       sgen_cardtable = (guint8 *)sgen_alloc_os_memory (CARD_COUNT_IN_BYTES, (SgenAllocFlags)(SGEN_ALLOC_INTERNAL | SGEN_ALLOC_ACTIVATE), "card table");
+       sgen_cardtable = (guint8 *)sgen_alloc_os_memory (CARD_COUNT_IN_BYTES, (SgenAllocFlags)(SGEN_ALLOC_INTERNAL | SGEN_ALLOC_ACTIVATE), "card table", MONO_MEM_ACCOUNT_SGEN_CARD_TABLE);
 
 #ifdef SGEN_HAVE_OVERLAPPING_CARDS
-       sgen_shadow_cardtable = (guint8 *)sgen_alloc_os_memory (CARD_COUNT_IN_BYTES, (SgenAllocFlags)(SGEN_ALLOC_INTERNAL | SGEN_ALLOC_ACTIVATE), "shadow card table");
+       sgen_shadow_cardtable = (guint8 *)sgen_alloc_os_memory (CARD_COUNT_IN_BYTES, (SgenAllocFlags)(SGEN_ALLOC_INTERNAL | SGEN_ALLOC_ACTIVATE), "shadow card table", MONO_MEM_ACCOUNT_SGEN_SHADOW_CARD_TABLE);
 #endif
 
 #ifdef HEAVY_STATISTICS
index f073dc740648154853db6016d8a4564f7f137fe0..195894f8cbf1eecfa6997df325edc00fd9caf643 100644 (file)
@@ -216,7 +216,7 @@ is_major_or_los_object_marked (GCObject *obj)
 #undef HANDLE_PTR
 #define HANDLE_PTR(ptr,obj)    do {    \
        if (*(ptr) && !sgen_ptr_in_nursery ((char*)*(ptr)) && !is_major_or_los_object_marked ((GCObject*)*(ptr))) { \
-               if (!sgen_get_remset ()->find_address_with_cards (start, cards, (char*)(ptr))) { \
+               if (!cards || !sgen_get_remset ()->find_address_with_cards (start, cards, (char*)(ptr))) { \
                        GCVTable __vt = SGEN_LOAD_VTABLE (obj); \
                        SGEN_LOG (0, "major->major reference %p at offset %zd in object %p (%s.%s) not found in remsets.", *(ptr), (char*)(ptr) - (char*)(obj), (obj), sgen_client_vtable_get_namespace (__vt), sgen_client_vtable_get_name (__vt)); \
                        binary_protocol_missing_remset ((obj), __vt, (int) ((char*)(ptr) - (char*)(obj)), *(ptr), (gpointer)LOAD_VTABLE(*(ptr)), object_is_pinned (*(ptr))); \
@@ -243,8 +243,6 @@ check_mod_union_callback (GCObject *obj, size_t size, void *dummy)
        else
                cards = sgen_get_major_collector ()->get_cardtable_mod_union_for_reference (start);
 
-       SGEN_ASSERT (0, cards, "we must have mod union for marked major objects");
-
 #include "sgen-scan-object.h"
 }
 
@@ -253,7 +251,7 @@ sgen_check_mod_union_consistency (void)
 {
        missing_remsets = FALSE;
 
-       major_collector.iterate_objects (ITERATE_OBJECTS_ALL, (IterateObjectCallbackFunc)check_mod_union_callback, (void*)FALSE);
+       major_collector.iterate_objects (ITERATE_OBJECTS_SWEEP_ALL, (IterateObjectCallbackFunc)check_mod_union_callback, (void*)FALSE);
 
        sgen_los_iterate_objects ((IterateObjectCallbackFunc)check_mod_union_callback, (void*)TRUE);
 
@@ -326,7 +324,7 @@ static void
 setup_valid_nursery_objects (void)
 {
        if (!valid_nursery_objects)
-               valid_nursery_objects = (GCObject **)sgen_alloc_os_memory (DEFAULT_NURSERY_SIZE, (SgenAllocFlags)(SGEN_ALLOC_INTERNAL | SGEN_ALLOC_ACTIVATE), "debugging data");
+               valid_nursery_objects = (GCObject **)sgen_alloc_os_memory (DEFAULT_NURSERY_SIZE, (SgenAllocFlags)(SGEN_ALLOC_INTERNAL | SGEN_ALLOC_ACTIVATE), "debugging data", MONO_MEM_ACCOUNT_SGEN_DEBUGGING);
        valid_nursery_object_count = 0;
        sgen_scan_area_with_callback (nursery_section->data, nursery_section->end_data, setup_mono_sgen_scan_area_with_callback, NULL, FALSE, FALSE);
 }
@@ -445,7 +443,7 @@ verify_object_pointers_callback (GCObject *obj, size_t size, void *data)
 {
        char *start = (char*)obj;
        gboolean allow_missing_pinned = (gboolean) (size_t) data;
-       SgenDescriptor desc = sgen_obj_get_descriptor (obj);
+       SgenDescriptor desc = sgen_obj_get_descriptor_safe (obj);
 
 #include "sgen-scan-object.h"
 }
@@ -985,7 +983,8 @@ check_reference_for_xdomain (GCObject **ptr, GCObject *obj, MonoDomain *domain)
        for (klass = obj->vtable->klass; klass; klass = klass->parent) {
                int i;
 
-               for (i = 0; i < klass->field.count; ++i) {
+               int fcount = mono_class_get_field_count (klass);
+               for (i = 0; i < fcount; ++i) {
                        if (klass->fields[i].offset == offset) {
                                field = &klass->fields[i];
                                break;
index 7b650e42caed2aca222b783dea5788135e495edf..2fdd86c2bf0613f7e75129c417d5a3341f82c1a4 100644 (file)
@@ -290,6 +290,8 @@ static SGEN_TV_DECLARE (time_major_conc_collection_end);
 
 int gc_debug_level = 0;
 FILE* gc_debug_file;
+static char* gc_params_options;
+static char* gc_debug_options;
 
 /*
 void
@@ -990,6 +992,24 @@ mono_gc_get_logfile (void)
        return gc_debug_file;
 }
 
+void
+mono_gc_params_set (const char* options)
+{
+       if (gc_params_options)
+               g_free (gc_params_options);
+
+       gc_params_options = g_strdup (options);
+}
+
+void
+mono_gc_debug_set (const char* options)
+{
+       if (gc_debug_options)
+               g_free (gc_debug_options);
+
+       gc_debug_options = g_strdup (options);
+}
+
 static void
 scan_finalizer_entries (SgenPointerQueue *fin_queue, ScanCopyContext ctx)
 {
@@ -1169,7 +1189,6 @@ finish_gray_stack (int generation, ScanCopyContext ctx)
 
        g_assert (sgen_gray_object_queue_is_empty (queue));
 
-       sgen_gray_object_queue_trim_free_list (queue);
        binary_protocol_finish_gray_stack_end (sgen_timestamp (), generation);
 }
 
@@ -1461,7 +1480,7 @@ enqueue_scan_from_roots_jobs (SgenGrayQueue *gc_thread_gray_queue, char *heap_st
  * Return whether any objects were late-pinned due to being out of memory.
  */
 static gboolean
-collect_nursery (const char *reason, gboolean is_overflow, SgenGrayQueue *unpin_queue, gboolean finish_up_concurrent_mark)
+collect_nursery (const char *reason, gboolean is_overflow, SgenGrayQueue *unpin_queue)
 {
        gboolean needs_major;
        size_t max_garbage_amount;
@@ -1529,11 +1548,6 @@ collect_nursery (const char *reason, gboolean is_overflow, SgenGrayQueue *unpin_
 
        gc_stats.minor_gc_count ++;
 
-       if (whole_heap_check_before_collection) {
-               sgen_clear_nursery_fragments ();
-               sgen_check_whole_heap (finish_up_concurrent_mark);
-       }
-
        sgen_process_fin_stage_entries ();
 
        /* pin from pinned handles */
@@ -1552,6 +1566,11 @@ collect_nursery (const char *reason, gboolean is_overflow, SgenGrayQueue *unpin_
        if (remset_consistency_checks)
                sgen_check_remset_consistency ();
 
+       if (whole_heap_check_before_collection) {
+               sgen_clear_nursery_fragments ();
+               sgen_check_whole_heap (FALSE);
+       }
+
        TV_GETTIME (atv);
        time_minor_pinning += TV_ELAPSED (btv, atv);
        SGEN_LOG (2, "Finding pinned pointers: %zd in %lld usecs", sgen_get_pinned_count (), (long long)TV_ELAPSED (btv, atv));
@@ -1697,7 +1716,7 @@ major_copy_or_mark_from_roots (SgenGrayQueue *gc_thread_gray_queue, size_t *old_
        sgen_clear_nursery_fragments ();
 
        if (whole_heap_check_before_collection)
-               sgen_check_whole_heap (mode == COPY_OR_MARK_FROM_ROOTS_FINISH_CONCURRENT);
+               sgen_check_whole_heap (TRUE);
 
        TV_GETTIME (btv);
        time_major_pre_collection_fragment_clear += TV_ELAPSED (atv, btv);
@@ -1786,13 +1805,6 @@ major_copy_or_mark_from_roots (SgenGrayQueue *gc_thread_gray_queue, size_t *old_
        if (old_next_pin_slot)
                *old_next_pin_slot = sgen_get_pinned_count ();
 
-       /*
-        * We don't actually pin when starting a concurrent collection, so the remset
-        * consistency check won't work.
-        */
-       if (remset_consistency_checks && mode != COPY_OR_MARK_FROM_ROOTS_START_CONCURRENT)
-               sgen_check_remset_consistency ();
-
        TV_GETTIME (btv);
        time_major_pinning += TV_ELAPSED (atv, btv);
        SGEN_LOG (2, "Finding pinned pointers: %zd in %lld usecs", sgen_get_pinned_count (), (long long)TV_ELAPSED (atv, btv));
@@ -1975,9 +1987,6 @@ major_finish_collection (SgenGrayQueue *gc_thread_gray_queue, const char *reason
        reset_heap_boundaries ();
        sgen_update_heap_boundaries ((mword)sgen_get_nursery_start (), (mword)sgen_get_nursery_end ());
 
-       if (whole_heap_check_before_collection)
-               sgen_check_whole_heap (FALSE);
-
        /* walk the pin_queue, build up the fragment list of free memory, unmark
         * pinned objects as we go, memzero() the empty fragments so they are ready for the
         * next allocations.
@@ -2257,7 +2266,7 @@ sgen_perform_collection (size_t requested_size, int generation_to_collect, const
                if (concurrent_collection_in_progress)
                        major_update_concurrent_collection ();
 
-               if (collect_nursery (reason, FALSE, NULL, FALSE) && !concurrent_collection_in_progress) {
+               if (collect_nursery (reason, FALSE, NULL) && !concurrent_collection_in_progress) {
                        overflow_generation_to_collect = GENERATION_OLD;
                        overflow_reason = "Minor overflow";
                }
@@ -2267,7 +2276,7 @@ sgen_perform_collection (size_t requested_size, int generation_to_collect, const
        } else {
                SGEN_ASSERT (0, generation_to_collect == GENERATION_OLD, "We should have handled nursery collections above");
                if (major_collector.is_concurrent && !wait_to_finish) {
-                       collect_nursery ("Concurrent start", FALSE, NULL, FALSE);
+                       collect_nursery ("Concurrent start", FALSE, NULL);
                        major_start_concurrent_collection (reason);
                        oldest_generation_collected = GENERATION_NURSERY;
                } else if (major_do_collection (reason, FALSE, wait_to_finish)) {
@@ -2285,7 +2294,7 @@ sgen_perform_collection (size_t requested_size, int generation_to_collect, const
                 */
 
                if (overflow_generation_to_collect == GENERATION_NURSERY)
-                       collect_nursery (overflow_reason, TRUE, NULL, FALSE);
+                       collect_nursery (overflow_reason, TRUE, NULL);
                else
                        major_do_collection (overflow_reason, TRUE, wait_to_finish);
 
@@ -2545,11 +2554,7 @@ sgen_get_current_collection_generation (void)
 void*
 sgen_thread_register (SgenThreadInfo* info, void *stack_bottom_fallback)
 {
-#ifndef HAVE_KW_THREAD
        info->tlab_start = info->tlab_next = info->tlab_temp_end = info->tlab_real_end = NULL;
-#endif
-
-       sgen_init_tlab_info (info);
 
        sgen_client_thread_register (info, stack_bottom_fallback);
 
@@ -2750,6 +2755,8 @@ sgen_gc_init (void)
        char **opts, **ptr;
        char *major_collector_opt = NULL;
        char *minor_collector_opt = NULL;
+       char *params_opts = NULL;
+       char *debug_opts = NULL;
        size_t max_heap = 0;
        size_t soft_limit = 0;
        int result;
@@ -2787,8 +2794,12 @@ sgen_gc_init (void)
 
        mono_coop_mutex_init (&sgen_interruption_mutex);
 
-       if ((env = g_getenv (MONO_GC_PARAMS_NAME))) {
-               opts = g_strsplit (env, ",", -1);
+       if ((env = g_getenv (MONO_GC_PARAMS_NAME)) || gc_params_options) {
+               params_opts = g_strdup_printf ("%s,%s", gc_params_options ? gc_params_options : "", env ? env : "");
+       }
+
+       if (params_opts) {
+               opts = g_strsplit (params_opts, ",", -1);
                for (ptr = opts; *ptr; ++ptr) {
                        char *opt = *ptr;
                        if (g_str_has_prefix (opt, "major=")) {
@@ -2990,15 +3001,22 @@ sgen_gc_init (void)
        if (minor_collector_opt)
                g_free (minor_collector_opt);
 
+       if (params_opts)
+               g_free (params_opts);
+
        alloc_nursery ();
 
        sgen_pinning_init ();
        sgen_cement_init (cement_enabled);
 
-       if ((env = g_getenv (MONO_GC_DEBUG_NAME))) {
+       if ((env = g_getenv (MONO_GC_DEBUG_NAME)) || gc_debug_options) {
+               debug_opts = g_strdup_printf ("%s,%s", gc_debug_options ? gc_debug_options  : "", env ? env : "");
+       }
+
+       if (debug_opts) {
                gboolean usage_printed = FALSE;
 
-               opts = g_strsplit (env, ",", -1);
+               opts = g_strsplit (debug_opts, ",", -1);
                for (ptr = opts; ptr && *ptr; ptr ++) {
                        char *opt = *ptr;
                        if (!strcmp (opt, ""))
@@ -3129,6 +3147,9 @@ sgen_gc_init (void)
                g_strfreev (opts);
        }
 
+       if (debug_opts)
+               g_free (debug_opts);
+
        if (check_mark_bits_after_major_collection)
                nursery_clear_policy = CLEAR_AT_GC;
 
@@ -3263,7 +3284,7 @@ sgen_check_whole_heap_stw (void)
 {
        sgen_stop_world (0);
        sgen_clear_nursery_fragments ();
-       sgen_check_whole_heap (FALSE);
+       sgen_check_whole_heap (TRUE);
        sgen_restart_world (0);
 }
 
index a517035499306398ce354ef0bff9957ecf6a181d..a767781ac56752a11bb304aa7edd4a3e0d7b6601 100644 (file)
@@ -182,7 +182,7 @@ sgen_aligned_addr_hash (gconstpointer ptr)
        return GPOINTER_TO_UINT (ptr) >> 3;
 }
 
-#define SGEN_PTR_IN_NURSERY(p,bits,start,end)  (((mword)(p) & ~((1 << (bits)) - 1)) == (mword)(start))
+#define SGEN_PTR_IN_NURSERY(p,bits,start,end)  (((mword)(p) & ~(((mword)1 << (bits)) - 1)) == (mword)(start))
 
 #ifdef USER_CONFIG
 
@@ -407,17 +407,10 @@ void sgen_scan_area_with_callback (char *start, char *end, IterateObjectCallback
 struct _SgenThreadInfo {
        SgenClientThreadInfo client_info;
 
-       char **tlab_next_addr;
-       char **tlab_start_addr;
-       char **tlab_temp_end_addr;
-       char **tlab_real_end_addr;
-
-#ifndef HAVE_KW_THREAD
        char *tlab_start;
        char *tlab_next;
        char *tlab_temp_end;
        char *tlab_real_end;
-#endif
 };
 
 gboolean sgen_is_worker_thread (MonoNativeThreadId thread);
@@ -606,7 +599,6 @@ typedef enum {
        ITERATE_OBJECTS_SWEEP = 1,
        ITERATE_OBJECTS_NON_PINNED = 2,
        ITERATE_OBJECTS_PINNED = 4,
-       ITERATE_OBJECTS_ALL = ITERATE_OBJECTS_NON_PINNED | ITERATE_OBJECTS_PINNED,
        ITERATE_OBJECTS_SWEEP_NON_PINNED = ITERATE_OBJECTS_SWEEP | ITERATE_OBJECTS_NON_PINNED,
        ITERATE_OBJECTS_SWEEP_PINNED = ITERATE_OBJECTS_SWEEP | ITERATE_OBJECTS_PINNED,
        ITERATE_OBJECTS_SWEEP_ALL = ITERATE_OBJECTS_SWEEP | ITERATE_OBJECTS_NON_PINNED | ITERATE_OBJECTS_PINNED
@@ -661,7 +653,7 @@ struct _SgenMajorCollector {
        void (*sweep) (void);
        gboolean (*have_swept) (void);
        void (*finish_sweeping) (void);
-       void (*free_swept_blocks) (size_t allowance);
+       void (*free_swept_blocks) (size_t section_reserve);
        void (*check_scan_starts) (void);
        void (*dump_heap) (FILE *heap_dump_file);
        gint64 (*get_used_size) (void);
@@ -1004,7 +996,6 @@ typedef enum {
        ATYPE_NUM
 } SgenAllocatorType;
 
-void sgen_init_tlab_info (SgenThreadInfo* info);
 void sgen_clear_tlabs (void);
 
 GCObject* sgen_alloc_obj (GCVTable vtable, size_t size);
@@ -1041,7 +1032,7 @@ void sgen_env_var_error (const char *env_var, const char *fallback, const char *
 
 /* Utilities */
 
-void sgen_qsort (void *base, size_t nel, size_t width, int (*compar) (const void*, const void*));
+void sgen_qsort (void *array, size_t count, size_t element_size, int (*compare) (const void*, const void*));
 gint64 sgen_timestamp (void);
 
 /*
index 9b5f92a19547916049f9129c7ed8a1fd360497c8..f8f04c145807db19fb27a7676f73d36f77555a05 100644 (file)
@@ -49,8 +49,6 @@ sgen_gray_object_alloc_queue_section (SgenGrayQueue *queue)
 {
        GrayQueueSection *section;
 
-       HEAVY_STAT (stat_gray_queue_section_alloc ++);
-
        if (queue->alloc_prepare_func)
                queue->alloc_prepare_func (queue);
 
@@ -60,6 +58,8 @@ sgen_gray_object_alloc_queue_section (SgenGrayQueue *queue)
                queue->free_list = section->next;
                STATE_TRANSITION (section, GRAY_QUEUE_SECTION_STATE_FREE_LIST, GRAY_QUEUE_SECTION_STATE_FLOATING);
        } else {
+               HEAVY_STAT (stat_gray_queue_section_alloc ++);
+
                /* Allocate a new section */
                section = (GrayQueueSection *)sgen_alloc_internal (INTERNAL_MEM_GRAY_QUEUE);
                STATE_SET (section, GRAY_QUEUE_SECTION_STATE_FLOATING);
index 12ace19a3e904e4782f5bdc8febd21709cb3e78d..e8c0d7ab595a74fa63e86d3a8e03e087df4fd542 100644 (file)
 #include "mono/sgen/sgen-memory-governor.h"
 #include "mono/sgen/sgen-client.h"
 
-/* keep each size a multiple of ALLOC_ALIGN */
+/*
+ * When allocating sgen memory we choose the allocator with the smallest slot size
+ * that can fit our requested size. These slots are allocated within a block that
+ * can contain at least 2 slots of the specific size.
+ *
+ * Currently, slots from 8 to 2044/2040 are allocated inside 4096 sized blocks,
+ * 2728 to 4092/4088 inside 8192 sized blocks, and higher inside 16384 sized
+ * blocks. We also need to make sure the slots are pointer size aligned so we
+ * don't allocate unaligned memory.
+ *
+ * The computation of these sizes spawns from two basic rules :
+ *     - if we use slots of size s1 that fit n times in a block, it is illogical
+ * to use another slot of size s2 which also fits the same n times in a block.
+ *     - if we use slots of size s1 that fit n times in a block, there is no
+ * s2 > s1 that can fit n times in the block. That would mean we are wasting memory
+ * when allocating size S where s1 < S <= s2.
+ */
 #if SIZEOF_VOID_P == 4
 static const int allocator_sizes [] = {
           8,   16,   24,   32,   40,   48,   64,   80,
-         96,  128,  160,  192,  224,  248,  296,  320,
-        384,  448,  504,  528,  584,  680,  816, 1088,
-       1360, 2044, 2336, 2728, 3272, 4092, 5456, 8188 };
+         96,  124,  160,  192,  224,  252,  292,  340,
+        408,  452,  508,  584,  680,  816, 1020,
+       1364, 2044, 2728, 4092, 5460, 8188 };
 #else
 static const int allocator_sizes [] = {
           8,   16,   24,   32,   40,   48,   64,   80,
-         96,  128,  160,  192,  224,  248,  320,  328,
-        384,  448,  528,  584,  680,  816, 1016, 1088,
-       1360, 2040, 2336, 2728, 3272, 4088, 5456, 8184 };
+         96,  128,  160,  192,  224,  248,  288,  336,
+        368,  448,  504,  584,  680,  816, 1016,
+       1360, 2040, 2728, 4088, 5456, 8184 };
 #endif
 
 #define NUM_ALLOCATORS (sizeof (allocator_sizes) / sizeof (int))
@@ -49,12 +65,13 @@ block_size (size_t slot_size)
        static int pagesize = -1;
 
        int size;
+       size_t aligned_slot_size = SGEN_ALIGN_UP_TO (slot_size, SIZEOF_VOID_P);
 
        if (pagesize == -1)
                pagesize = mono_pagesize ();
 
        for (size = pagesize; size < LOCK_FREE_ALLOC_SB_MAX_SIZE; size <<= 1) {
-               if (slot_size * 2 <= LOCK_FREE_ALLOC_SB_USABLE_SIZE (size))
+               if (aligned_slot_size * 2 <= LOCK_FREE_ALLOC_SB_USABLE_SIZE (size))
                        return size;
        }
        return LOCK_FREE_ALLOC_SB_MAX_SIZE;
@@ -158,7 +175,7 @@ sgen_alloc_internal_dynamic (size_t size, int type, gboolean assert_on_failure)
        void *p;
 
        if (size > allocator_sizes [NUM_ALLOCATORS - 1]) {
-               p = sgen_alloc_os_memory (size, (SgenAllocFlags)(SGEN_ALLOC_INTERNAL | SGEN_ALLOC_ACTIVATE), NULL);
+               p = sgen_alloc_os_memory (size, (SgenAllocFlags)(SGEN_ALLOC_INTERNAL | SGEN_ALLOC_ACTIVATE), NULL, MONO_MEM_ACCOUNT_SGEN_INTERNAL);
                if (!p)
                        sgen_assert_memory_alloc (NULL, size, description_for_type (type));
        } else {
@@ -173,6 +190,8 @@ sgen_alloc_internal_dynamic (size_t size, int type, gboolean assert_on_failure)
                        sgen_assert_memory_alloc (NULL, size, description_for_type (type));
                memset (p, 0, size);
        }
+
+       SGEN_ASSERT (0, !(((mword)p) & (sizeof(gpointer) - 1)), "Why do we allocate unaligned addresses ?");
        return p;
 }
 
@@ -183,7 +202,7 @@ sgen_free_internal_dynamic (void *addr, size_t size, int type)
                return;
 
        if (size > allocator_sizes [NUM_ALLOCATORS - 1])
-               sgen_free_os_memory (addr, size, SGEN_ALLOC_INTERNAL);
+               sgen_free_os_memory (addr, size, SGEN_ALLOC_INTERNAL, MONO_MEM_ACCOUNT_SGEN_INTERNAL);
        else
                mono_lock_free_free (addr, block_size (size));
 }
@@ -206,6 +225,8 @@ sgen_alloc_internal (int type)
        p = mono_lock_free_alloc (&allocators [index]);
        memset (p, 0, size);
 
+       SGEN_ASSERT (0, !(((mword)p) & (sizeof(gpointer) - 1)), "Why do we allocate unaligned addresses ?");
+
        return p;
 }
 
@@ -260,17 +281,21 @@ sgen_init_internal_allocator (void)
        for (i = 0; i < NUM_ALLOCATORS; ++i) {
                allocator_block_sizes [i] = block_size (allocator_sizes [i]);
                mono_lock_free_allocator_init_size_class (&size_classes [i], allocator_sizes [i], allocator_block_sizes [i]);
-               mono_lock_free_allocator_init_allocator (&allocators [i], &size_classes [i]);
+               mono_lock_free_allocator_init_allocator (&allocators [i], &size_classes [i], MONO_MEM_ACCOUNT_SGEN_INTERNAL);
        }
 
        for (size = mono_pagesize (); size <= LOCK_FREE_ALLOC_SB_MAX_SIZE; size <<= 1) {
-               int max_size = LOCK_FREE_ALLOC_SB_USABLE_SIZE (size) / 2;
+               int max_size = (LOCK_FREE_ALLOC_SB_USABLE_SIZE (size) / 2) & ~(SIZEOF_VOID_P - 1);
                /*
                 * we assert that allocator_sizes contains the biggest possible object size
-                * per block (4K => 4080 / 2 = 2040, 8k => 8176 / 2 = 4088, 16k => 16368 / 2 = 8184 on 64bits),
+                * per block which has to be an aligned address.
+                * (4K => 2040, 8k => 4088, 16k => 8184 on 64bits),
                 * so that we do not get different block sizes for sizes that should go to the same one
                 */
                g_assert (allocator_sizes [index_for_size (max_size)] == max_size);
+               g_assert (block_size (max_size) == size);
+               if (size < LOCK_FREE_ALLOC_SB_MAX_SIZE)
+                       g_assert (block_size (max_size + 1) == size << 1);
        }
 }
 
index 74c5c02a0278355074ab21273d63831791da11af..04b1f241e1abaff2b96990b572e1bdf5e5bf8907 100644 (file)
@@ -9,6 +9,7 @@
 
 #include "sgen/sgen-gc.h"
 #include "sgen/sgen-layout-stats.h"
+#include <mono/utils/mono-compiler.h>
 
 #ifdef SGEN_OBJECT_LAYOUT_STATISTICS
 
@@ -58,6 +59,8 @@ sgen_object_layout_dump (FILE *out)
        fprintf (out, "ref-array %lu\n", count_ref_array);
        fprintf (out, "vtype-array %lu\n", count_vtype_array);
 }
+#else
 
-#endif
+MONO_EMPTY_SOURCE_FILE (sgen_layout_stats);
+#endif /* SGEN_OBJECT_LAYOUT_STATISTICS */
 #endif
index c032d1946f41c18b3dcf1df001b2f1b976025253..454cb89fda70eb88ce31bd6277b148fb323acf64 100644 (file)
@@ -251,7 +251,7 @@ get_los_section_memory (size_t size)
        if (!sgen_memgov_try_alloc_space (LOS_SECTION_SIZE, SPACE_LOS))
                return NULL;
 
-       section = (LOSSection *)sgen_alloc_os_memory_aligned (LOS_SECTION_SIZE, LOS_SECTION_SIZE, (SgenAllocFlags)(SGEN_ALLOC_HEAP | SGEN_ALLOC_ACTIVATE), NULL);
+       section = (LOSSection *)sgen_alloc_os_memory_aligned (LOS_SECTION_SIZE, LOS_SECTION_SIZE, (SgenAllocFlags)(SGEN_ALLOC_HEAP | SGEN_ALLOC_ACTIVATE), NULL, MONO_MEM_ACCOUNT_SGEN_LOS);
 
        if (!section)
                return NULL;
@@ -323,13 +323,13 @@ sgen_los_free_object (LOSObject *obj)
        los_num_objects--;
 
 #ifdef USE_MALLOC
-       free (obj);
+       g_free (obj);
 #else
        if (size > LOS_SECTION_OBJECT_LIMIT) {
                int pagesize = mono_pagesize ();
                size += sizeof (LOSObject);
                size = SGEN_ALIGN_UP_TO (size, pagesize);
-               sgen_free_os_memory ((gpointer)SGEN_ALIGN_DOWN_TO ((mword)obj, pagesize), size, SGEN_ALLOC_HEAP);
+               sgen_free_os_memory ((gpointer)SGEN_ALIGN_DOWN_TO ((mword)obj, pagesize), size, SGEN_ALLOC_HEAP, MONO_MEM_ACCOUNT_SGEN_LOS);
                los_memory_usage_total -= size;
                sgen_memgov_release_space (size, SPACE_LOS);
        } else {
@@ -379,7 +379,7 @@ sgen_los_alloc_large_inner (GCVTable vtable, size_t size)
        sgen_ensure_free_space (size, GENERATION_OLD);
 
 #ifdef USE_MALLOC
-       obj = malloc (size + sizeof (LOSObject));
+       obj = g_malloc (size + sizeof (LOSObject));
        memset (obj, 0, size + sizeof (LOSObject));
 #else
        if (size > LOS_SECTION_OBJECT_LIMIT) {
@@ -387,7 +387,7 @@ sgen_los_alloc_large_inner (GCVTable vtable, size_t size)
                int pagesize = mono_pagesize ();
                size_t alloc_size = SGEN_ALIGN_UP_TO (obj_size, pagesize);
                if (sgen_memgov_try_alloc_space (alloc_size, SPACE_LOS)) {
-                       obj = (LOSObject *)sgen_alloc_os_memory (alloc_size, (SgenAllocFlags)(SGEN_ALLOC_HEAP | SGEN_ALLOC_ACTIVATE), NULL);
+                       obj = (LOSObject *)sgen_alloc_os_memory (alloc_size, (SgenAllocFlags)(SGEN_ALLOC_HEAP | SGEN_ALLOC_ACTIVATE), NULL, MONO_MEM_ACCOUNT_SGEN_LOS);
                        if (obj) {
                                los_memory_usage_total += alloc_size;
                                obj = randomize_los_object_start (obj, obj_size, alloc_size, pagesize);
@@ -479,7 +479,7 @@ sgen_los_sweep (void)
                                prev->next = next;
                        else
                                los_sections = next;
-                       sgen_free_os_memory (section, LOS_SECTION_SIZE, SGEN_ALLOC_HEAP);
+                       sgen_free_os_memory (section, LOS_SECTION_SIZE, SGEN_ALLOC_HEAP, MONO_MEM_ACCOUNT_SGEN_LOS);
                        sgen_memgov_release_space (LOS_SECTION_SIZE, SPACE_LOS);
                        section = next;
                        --los_num_sections;
index 3c96a2f0106bfc78cf20bca223315e7bd3f8c63a..d6460111a0f4094c25b90ca38e8f2445e0d6edd8 100644 (file)
@@ -142,7 +142,8 @@ COPY_OR_MARK_FUNCTION_NAME (GCObject **ptr, GCObject *obj, SgenGrayQueue *queue)
 
                SGEN_ASSERT (9, !SGEN_VTABLE_IS_PINNED (vtable_word), "Pinned object in non-pinned block?");
 
-               desc = sgen_vtable_get_descriptor ((GCVTable)vtable_word);
+               /* We untag the vtable for concurrent M&S, in case bridge is running and it tagged it */
+               desc = sgen_vtable_get_descriptor ((GCVTable)SGEN_POINTER_UNTAG_VTABLE (vtable_word));
                type = desc & DESC_TYPE_MASK;
 
                if (sgen_safe_object_is_small (obj, type)) {
@@ -183,7 +184,7 @@ COPY_OR_MARK_FUNCTION_NAME (GCObject **ptr, GCObject *obj, SgenGrayQueue *queue)
 
                        sgen_los_pin_object (obj);
                        if (SGEN_OBJECT_HAS_REFERENCES (obj))
-                               GRAY_OBJECT_ENQUEUE (queue, obj, sgen_obj_get_descriptor (obj));
+                               GRAY_OBJECT_ENQUEUE (queue, obj, desc);
                }
                return FALSE;
        }
index aa5ef1a44a93ace9fe040a3089e3bcffbf19f93e..8ae553c23b3d90687ef6ac7720a4e0d68127b155 100644 (file)
@@ -240,12 +240,10 @@ static guint64 stat_major_blocks_alloced = 0;
 static guint64 stat_major_blocks_freed = 0;
 static guint64 stat_major_blocks_lazy_swept = 0;
 
-#if SIZEOF_VOID_P != 8
 static guint64 stat_major_blocks_freed_ideal = 0;
 static guint64 stat_major_blocks_freed_less_ideal = 0;
 static guint64 stat_major_blocks_freed_individual = 0;
 static guint64 stat_major_blocks_alloced_less_ideal = 0;
-#endif
 
 #ifdef SGEN_COUNT_NUMBER_OF_MAJOR_OBJECTS_MARKED
 static guint64 num_major_objects_marked = 0;
@@ -297,9 +295,9 @@ major_alloc_heap (mword nursery_size, mword nursery_align, int the_nursery_bits)
 {
        char *start;
        if (nursery_align)
-               start = (char *)sgen_alloc_os_memory_aligned (nursery_size, nursery_align, (SgenAllocFlags)(SGEN_ALLOC_HEAP | SGEN_ALLOC_ACTIVATE), "nursery");
+               start = (char *)sgen_alloc_os_memory_aligned (nursery_size, nursery_align, (SgenAllocFlags)(SGEN_ALLOC_HEAP | SGEN_ALLOC_ACTIVATE), "nursery", MONO_MEM_ACCOUNT_SGEN_NURSERY);
        else
-               start = (char *)sgen_alloc_os_memory (nursery_size, (SgenAllocFlags)(SGEN_ALLOC_HEAP | SGEN_ALLOC_ACTIVATE), "nursery");
+               start = (char *)sgen_alloc_os_memory (nursery_size, (SgenAllocFlags)(SGEN_ALLOC_HEAP | SGEN_ALLOC_ACTIVATE), "nursery", MONO_MEM_ACCOUNT_SGEN_NURSERY);
 
        return start;
 }
@@ -331,7 +329,7 @@ ms_get_empty_block (void)
                for (;;) {
                        p = (char *)sgen_alloc_os_memory_aligned (MS_BLOCK_SIZE * alloc_num, MS_BLOCK_SIZE,
                                (SgenAllocFlags)(SGEN_ALLOC_HEAP | SGEN_ALLOC_ACTIVATE),
-                               alloc_num == 1 ? "major heap section" : NULL);
+                               alloc_num == 1 ? "major heap section" : NULL, MONO_MEM_ACCOUNT_SGEN_MARKSWEEP);
                        if (p)
                                break;
                        alloc_num >>= 1;
@@ -872,6 +870,7 @@ major_iterate_objects (IterateObjectsFlags flags, IterateObjectCallbackFunc call
        gboolean pinned = flags & ITERATE_OBJECTS_PINNED;
        MSBlockInfo *block;
 
+       /* No actual sweeping will take place if we are in the middle of a major collection. */
        major_finish_sweep_checking ();
        FOREACH_BLOCK_NO_LOCK (block) {
                int count = MS_BLOCK_FREE / block->obj_size;
@@ -881,26 +880,13 @@ major_iterate_objects (IterateObjectsFlags flags, IterateObjectCallbackFunc call
                        continue;
                if (!block->pinned && !non_pinned)
                        continue;
-               if (sweep && lazy_sweep) {
+               if (sweep && lazy_sweep && !block_is_swept_or_marking (block)) {
                        sweep_block (block);
                        SGEN_ASSERT (6, block->state == BLOCK_STATE_SWEPT, "Block must be swept after sweeping");
                }
 
                for (i = 0; i < count; ++i) {
                        void **obj = (void**) MS_BLOCK_OBJ (block, i);
-                       /*
-                        * We've finished sweep checking, but if we're sweeping lazily and
-                        * the flags don't require us to sweep, the block might still need
-                        * sweeping.  In that case, we need to consult the mark bits to tell
-                        * us whether an object slot is live.
-                        */
-                       if (!block_is_swept_or_marking (block)) {
-                               int word, bit;
-                               SGEN_ASSERT (6, !sweep && block->state == BLOCK_STATE_NEED_SWEEPING, "Has sweeping not finished?");
-                               MS_CALC_MARK_BIT (word, bit, obj);
-                               if (!MS_MARK_BIT (block, word, bit))
-                                       continue;
-                       }
                        if (MS_OBJ_ALLOCED (obj, block))
                                callback ((GCObject*)obj, block->obj_size, data);
                }
@@ -1138,10 +1124,7 @@ major_get_and_reset_num_major_objects_marked (void)
 
 /* gcc 4.2.1 from xcode4 crashes on sgen_card_table_get_card_address () when this is enabled */
 #if defined(PLATFORM_MACOSX)
-#define GCC_VERSION (__GNUC__ * 10000 \
-                               + __GNUC_MINOR__ * 100 \
-                               + __GNUC_PATCHLEVEL__)
-#if GCC_VERSION <= 40300
+#if MONO_GNUC_VERSION <= 40300
 #undef PREFETCH_CARDS
 #endif
 #endif
@@ -1956,7 +1939,6 @@ major_finish_major_collection (ScannedObjectCounts *counts)
 #endif
 }
 
-#if SIZEOF_VOID_P != 8
 static int
 compare_pointers (const void *va, const void *vb) {
        char *a = *(char**)va, *b = *(char**)vb;
@@ -1966,17 +1948,13 @@ compare_pointers (const void *va, const void *vb) {
                return 1;
        return 0;
 }
-#endif
 
 /*
  * This is called with sweep completed and the world stopped.
  */
 static void
-major_free_swept_blocks (size_t allowance)
+major_free_swept_blocks (size_t section_reserve)
 {
-       /* FIXME: This is probably too much.  It's assuming all objects are small. */
-       size_t section_reserve = allowance / MS_BLOCK_SIZE;
-
        SGEN_ASSERT (0, sweep_state == SWEEP_STATE_SWEPT, "Sweeping must have finished before freeing blocks");
 
 #ifdef TARGET_WIN32
@@ -1987,7 +1965,6 @@ major_free_swept_blocks (size_t allowance)
                return;
 #endif
 
-#if SIZEOF_VOID_P != 8
        {
                int i, num_empty_blocks_orig, num_blocks, arr_length;
                void *block;
@@ -2060,7 +2037,7 @@ major_free_swept_blocks (size_t allowance)
                                         * we're iterating.
                                         */
                                        int j;
-                                       sgen_free_os_memory (empty_block_arr [first], MS_BLOCK_SIZE * num_blocks, SGEN_ALLOC_HEAP);
+                                       sgen_free_os_memory (empty_block_arr [first], MS_BLOCK_SIZE * num_blocks, SGEN_ALLOC_HEAP, MONO_MEM_ACCOUNT_SGEN_MARKSWEEP);
                                        for (j = first; j <= d; ++j)
                                                empty_block_arr [j] = NULL;
                                        dest = first;
@@ -2107,11 +2084,10 @@ major_free_swept_blocks (size_t allowance)
         */
        if (num_empty_blocks <= num_major_sections)
                return;
-#endif
 
        while (num_empty_blocks > section_reserve) {
                void *next = *(void**)empty_blocks;
-               sgen_free_os_memory (empty_blocks, MS_BLOCK_SIZE, SGEN_ALLOC_HEAP);
+               sgen_free_os_memory (empty_blocks, MS_BLOCK_SIZE, SGEN_ALLOC_HEAP, MONO_MEM_ACCOUNT_SGEN_MARKSWEEP);
                empty_blocks = next;
                /*
                 * Needs not be atomic because this is running
@@ -2120,9 +2096,7 @@ major_free_swept_blocks (size_t allowance)
                --num_empty_blocks;
 
                ++stat_major_blocks_freed;
-#if SIZEOF_VOID_P != 8
                ++stat_major_blocks_freed_individual;
-#endif
        }
 }
 
@@ -2611,12 +2585,10 @@ sgen_marksweep_init_internal (SgenMajorCollector *collector, gboolean is_concurr
        mono_counters_register ("# major blocks allocated", MONO_COUNTER_GC | MONO_COUNTER_ULONG, &stat_major_blocks_alloced);
        mono_counters_register ("# major blocks freed", MONO_COUNTER_GC | MONO_COUNTER_ULONG, &stat_major_blocks_freed);
        mono_counters_register ("# major blocks lazy swept", MONO_COUNTER_GC | MONO_COUNTER_ULONG, &stat_major_blocks_lazy_swept);
-#if SIZEOF_VOID_P != 8
        mono_counters_register ("# major blocks freed ideally", MONO_COUNTER_GC | MONO_COUNTER_ULONG, &stat_major_blocks_freed_ideal);
        mono_counters_register ("# major blocks freed less ideally", MONO_COUNTER_GC | MONO_COUNTER_ULONG, &stat_major_blocks_freed_less_ideal);
        mono_counters_register ("# major blocks freed individually", MONO_COUNTER_GC | MONO_COUNTER_ULONG, &stat_major_blocks_freed_individual);
        mono_counters_register ("# major blocks allocated less ideally", MONO_COUNTER_GC | MONO_COUNTER_ULONG, &stat_major_blocks_alloced_less_ideal);
-#endif
 
        collector->section_size = MAJOR_SECTION_SIZE;
 
index e7de362976055377c0a67e6da9e4874d0c3b2db5..d6c7f130f3cae7571d5524cd7cdf67c65119ce28 100644 (file)
@@ -111,7 +111,7 @@ sgen_memgov_calculate_minor_collection_allowance (void)
 
        /* FIXME: Why is this here? */
        if (major_collector.free_swept_blocks)
-               major_collector.free_swept_blocks (allowance);
+               major_collector.free_swept_blocks (major_collector.get_num_major_sections () * SGEN_DEFAULT_ALLOWANCE_HEAP_SIZE_RATIO);
 
        major_collection_trigger_size = new_heap_size + allowance;
 
@@ -295,7 +295,7 @@ sgen_output_log_entry (SgenLogEntry *entry, gint64 stw_time, int generation)
 
        switch (entry->type) {
                case SGEN_LOG_NURSERY:
-                       mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_GC, "GC_MINOR%s: (%s) time %.2fms, %s promoted %dK major size: %dK in use: %dK los size: %dK in use: %dK",
+                       mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_GC, "GC_MINOR%s: (%s) time %.2fms, %s promoted %zdK major size: %zdK in use: %zdK los size: %zdK in use: %zdK",
                                entry->is_overflow ? "_OVERFLOW" : "",
                                entry->reason ? entry->reason : "",
                                entry->time / 10000.0f,
@@ -307,7 +307,7 @@ sgen_output_log_entry (SgenLogEntry *entry, gint64 stw_time, int generation)
                                entry->los_size_in_use / 1024);
                        break;
                case SGEN_LOG_MAJOR_SERIAL:
-                       mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_GC, "GC_MAJOR%s: (%s) time %.2fms, %s los size: %dK in use: %dK",
+                       mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_GC, "GC_MAJOR%s: (%s) time %.2fms, %s los size: %zdK in use: %zdK",
                                entry->is_overflow ? "_OVERFLOW" : "",
                                entry->reason ? entry->reason : "",
                                (int)entry->time / 10000.0f,
@@ -319,7 +319,7 @@ sgen_output_log_entry (SgenLogEntry *entry, gint64 stw_time, int generation)
                        mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_GC, "GC_MAJOR_CONCURRENT_START: (%s)", entry->reason ? entry->reason : "");
                        break;
                case SGEN_LOG_MAJOR_CONC_FINISH:
-                       mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_GC, "GC_MAJOR_CONCURRENT_FINISH: (%s) time %.2fms, %s los size: %dK in use: %dK",
+                       mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_GC, "GC_MAJOR_CONCURRENT_FINISH: (%s) time %.2fms, %s los size: %zdK in use: %zdK",
                                entry->reason ? entry->reason : "",
                                entry->time / 10000.0f,
                                full_timing_buff,
@@ -327,7 +327,7 @@ sgen_output_log_entry (SgenLogEntry *entry, gint64 stw_time, int generation)
                                entry->los_size_in_use / 1024);
                        break;
                case SGEN_LOG_MAJOR_SWEEP_FINISH:
-                       mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_GC, "GC_MAJOR_SWEEP: major size: %dK in use: %dK",
+                       mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_GC, "GC_MAJOR_SWEEP: major size: %zdK in use: %zdK",
                                entry->major_size / 1024,
                                entry->major_size_in_use / 1024);
                        break;
@@ -384,13 +384,13 @@ sgen_assert_memory_alloc (void *ptr, size_t requested_size, const char *assert_d
  * This must not require any lock.
  */
 void*
-sgen_alloc_os_memory (size_t size, SgenAllocFlags flags, const char *assert_description)
+sgen_alloc_os_memory (size_t size, SgenAllocFlags flags, const char *assert_description, MonoMemAccountType type)
 {
        void *ptr;
 
        g_assert (!(flags & ~(SGEN_ALLOC_HEAP | SGEN_ALLOC_ACTIVATE)));
 
-       ptr = mono_valloc (0, size, prot_flags_for_activate (flags & SGEN_ALLOC_ACTIVATE));
+       ptr = mono_valloc (0, size, prot_flags_for_activate (flags & SGEN_ALLOC_ACTIVATE), type);
        sgen_assert_memory_alloc (ptr, size, assert_description);
        if (ptr) {
                SGEN_ATOMIC_ADD_P (total_alloc, size);
@@ -400,14 +400,15 @@ sgen_alloc_os_memory (size_t size, SgenAllocFlags flags, const char *assert_desc
 }
 
 /* size must be a power of 2 */
+// FIXME: remove assert_description
 void*
-sgen_alloc_os_memory_aligned (size_t size, mword alignment, SgenAllocFlags flags, const char *assert_description)
+sgen_alloc_os_memory_aligned (size_t size, mword alignment, SgenAllocFlags flags, const char *assert_description, MonoMemAccountType type)
 {
        void *ptr;
 
        g_assert (!(flags & ~(SGEN_ALLOC_HEAP | SGEN_ALLOC_ACTIVATE)));
 
-       ptr = mono_valloc_aligned (size, alignment, prot_flags_for_activate (flags & SGEN_ALLOC_ACTIVATE));
+       ptr = mono_valloc_aligned (size, alignment, prot_flags_for_activate (flags & SGEN_ALLOC_ACTIVATE), type);
        sgen_assert_memory_alloc (ptr, size, assert_description);
        if (ptr) {
                SGEN_ATOMIC_ADD_P (total_alloc, size);
@@ -420,11 +421,11 @@ sgen_alloc_os_memory_aligned (size_t size, mword alignment, SgenAllocFlags flags
  * Free the memory returned by sgen_alloc_os_memory (), returning it to the OS.
  */
 void
-sgen_free_os_memory (void *addr, size_t size, SgenAllocFlags flags)
+sgen_free_os_memory (void *addr, size_t size, SgenAllocFlags flags, MonoMemAccountType type)
 {
        g_assert (!(flags & ~SGEN_ALLOC_HEAP));
 
-       mono_vfree (addr, size);
+       mono_vfree (addr, size, type);
        SGEN_ATOMIC_ADD_P (total_alloc, -(gssize)size);
        total_alloc_max = MAX (total_alloc_max, total_alloc);
 }
@@ -476,8 +477,8 @@ sgen_memgov_init (size_t max_heap, size_t soft_limit, gboolean debug_allowance,
        debug_print_allowance = debug_allowance;
        major_collection_trigger_size = MIN_MINOR_COLLECTION_ALLOWANCE;
 
-       mono_counters_register ("Memgov alloc", MONO_COUNTER_GC | MONO_COUNTER_WORD | MONO_COUNTER_BYTES | MONO_COUNTER_VARIABLE, &total_alloc);
-       mono_counters_register ("Memgov max alloc", MONO_COUNTER_GC | MONO_COUNTER_WORD | MONO_COUNTER_BYTES | MONO_COUNTER_MONOTONIC, &total_alloc_max);
+       mono_counters_register ("Memgov alloc", MONO_COUNTER_GC | MONO_COUNTER_WORD | MONO_COUNTER_BYTES | MONO_COUNTER_VARIABLE, (void*)&total_alloc);
+       mono_counters_register ("Memgov max alloc", MONO_COUNTER_GC | MONO_COUNTER_WORD | MONO_COUNTER_BYTES | MONO_COUNTER_MONOTONIC, (void*)&total_alloc_max);
 
        mono_coop_mutex_init (&log_entries_mutex);
 
index d669e4730d18a058c44a026e9ae7dd48446c71a5..585fbe9a8388af909098645da5304d8a7ff2e121 100644 (file)
@@ -54,9 +54,9 @@ typedef struct {
 } SgenLogEntry;
 
 /* OS memory allocation */
-void* sgen_alloc_os_memory (size_t size, SgenAllocFlags flags, const char *assert_description);
-void* sgen_alloc_os_memory_aligned (size_t size, mword alignment, SgenAllocFlags flags, const char *assert_description);
-void sgen_free_os_memory (void *addr, size_t size, SgenAllocFlags flags);
+void* sgen_alloc_os_memory (size_t size, SgenAllocFlags flags, const char *assert_description, MonoMemAccountType type);
+void* sgen_alloc_os_memory_aligned (size_t size, mword alignment, SgenAllocFlags flags, const char *assert_description, MonoMemAccountType type);
+void sgen_free_os_memory (void *addr, size_t size, SgenAllocFlags flags, MonoMemAccountType type);
 
 /* Error handling */
 void sgen_assert_memory_alloc (void *ptr, size_t requested_size, const char *assert_description);
index ce504201f62d7ce42f8c0f5d64df086f7ed9d786..8b9c432961fee581d76dc597dd08f7179617c72e 100644 (file)
@@ -231,7 +231,7 @@ binary_protocol_flush_buffer (BinaryProtocolBuffer *buffer)
 
        current_file_size += buffer->index;
 
-       sgen_free_os_memory (buffer, sizeof (BinaryProtocolBuffer), SGEN_ALLOC_INTERNAL);
+       sgen_free_os_memory (buffer, sizeof (BinaryProtocolBuffer), SGEN_ALLOC_INTERNAL, MONO_MEM_ACCOUNT_SGEN_BINARY_PROTOCOL);
 }
 
 static void
@@ -315,12 +315,12 @@ binary_protocol_get_buffer (int length)
        if (buffer && buffer->index + length <= BINARY_PROTOCOL_BUFFER_SIZE)
                return buffer;
 
-       new_buffer = (BinaryProtocolBuffer *)sgen_alloc_os_memory (sizeof (BinaryProtocolBuffer), (SgenAllocFlags)(SGEN_ALLOC_INTERNAL | SGEN_ALLOC_ACTIVATE), "debugging memory");
+       new_buffer = (BinaryProtocolBuffer *)sgen_alloc_os_memory (sizeof (BinaryProtocolBuffer), (SgenAllocFlags)(SGEN_ALLOC_INTERNAL | SGEN_ALLOC_ACTIVATE), "debugging memory", MONO_MEM_ACCOUNT_SGEN_BINARY_PROTOCOL);
        new_buffer->next = buffer;
        new_buffer->index = 0;
 
        if (InterlockedCompareExchangePointer ((void**)&binary_protocol_buffers, new_buffer, buffer) != buffer) {
-               sgen_free_os_memory (new_buffer, sizeof (BinaryProtocolBuffer), SGEN_ALLOC_INTERNAL);
+               sgen_free_os_memory (new_buffer, sizeof (BinaryProtocolBuffer), SGEN_ALLOC_INTERNAL, MONO_MEM_ACCOUNT_SGEN_BINARY_PROTOCOL);
                goto retry;
        }
 
index 802dd561e9ed260df85cfd512b843034f9d4fcf1..e59f206a04201118c7ca9c6fbc1d26810a8ed16c 100644 (file)
 
 #include "sgen/sgen-gc.h"
 
-#define ELEM(i)                (((unsigned char*)base) + ((i) * width))
-#define SWAP(i,j)      do {                                    \
-               size_t __i = (i), __j = (j);                    \
-               if (__i != __j) {                               \
-                       memcpy (swap_tmp, ELEM (__i), width);   \
-                       memcpy (ELEM (__i), ELEM (__j), width); \
-                       memcpy (ELEM (__j), swap_tmp, width);   \
-               }                                               \
+#define ELEM(i) \
+       (((unsigned char*)array) + ((i) * element_size))
+#define SET(i,j) \
+       do memcpy ((i), (j), element_size); while (0)
+#define SWAP(i,j) \
+       do { \
+               size_t __i = (i), __j = (j); \
+               if (__i != __j) { \
+                       SET (swap_tmp, ELEM (__i)); \
+                       SET (ELEM (__i), ELEM (__j)); \
+                       SET (ELEM (__j), swap_tmp); \
+               } \
        } while (0)
 
-static size_t
-partition (void *base, size_t nel, size_t width, int (*compar) (const void*, const void*), unsigned char *pivot_tmp, unsigned char *swap_tmp)
-{
-       size_t pivot_idx = nel >> 1;
-       size_t s, i;
-
-       memcpy (pivot_tmp, ELEM (pivot_idx), width);
-       SWAP (pivot_idx, nel - 1);
-       s = 0;
-       for (i = 0; i < nel - 1; ++i) {
-               if (compar (ELEM (i), pivot_tmp) <= 0) {
-                       SWAP (i, s);
-                       ++s;
-               }
-       }
-       SWAP (s, nel - 1);
-       return s;
-}
-
 static void
-qsort_rec (void *base, size_t nel, size_t width, int (*compar) (const void*, const void*), unsigned char *pivot_tmp, unsigned char *swap_tmp)
+sgen_qsort_rec (
+       void *const array,
+       const size_t element_size,
+       int (*compare) (const void *, const void *),
+       ssize_t begin,
+       ssize_t end,
+       unsigned char *const pivot_tmp,
+       unsigned char *const swap_tmp)
 {
-       size_t pivot_idx;
+       ssize_t left, right, mid, pivot;
+       while (begin < end) {
+               left = begin;
+               right = end;
+               mid = begin + (end - begin) / 2;
 
-       if (nel <= 1)
-               return;
+               /* Choose median of 3 as pivot and pre-sort to avoid O(n^2) case.
+                *
+                * L --o--o----->
+                *     |  |
+                * M --o--|--o-->
+                *        |  |
+                * R -----o--o-->
+                */
+               if (compare (ELEM (mid), ELEM (left)) < 0)
+                       SWAP (mid, left);
+               if (compare (ELEM (right), ELEM (left)) < 0)
+                       SWAP (right, left);
+               if (compare (ELEM (right), ELEM (mid)) < 0)
+                       SWAP (right, mid);
+               pivot = mid;
+               SET (pivot_tmp, ELEM (pivot));
 
-       pivot_idx = partition (base, nel, width, compar, pivot_tmp, swap_tmp);
-       qsort_rec (base, pivot_idx, width, compar, pivot_tmp, swap_tmp);
-       if (pivot_idx < nel)
-               qsort_rec (ELEM (pivot_idx + 1), nel - pivot_idx - 1, width, compar, pivot_tmp, swap_tmp);
+               /* Partition. */
+               for (;;) {
+                       while (left <= right && compare (ELEM (left), pivot_tmp) <= 0)
+                               ++left;
+                       while (left <= right && compare (ELEM (right), pivot_tmp) > 0)
+                               --right;
+                       if (left > right)
+                               break;
+                       SWAP (left, right);
+                       if (pivot == right)
+                               pivot = left;
+                       ++left;
+                       --right;
+               }
+               SET (ELEM (pivot), ELEM (right));
+               SET (ELEM (right), pivot_tmp);
+               --right;
+
+               /* Recursively sort shorter partition, loop on longer partition. */
+               if (right - begin < end - left) {
+                       sgen_qsort_rec (
+                               array,
+                               element_size,
+                               compare,
+                               begin,
+                               right,
+                               pivot_tmp,
+                               swap_tmp);
+                       begin = left;
+               } else {
+                       sgen_qsort_rec (
+                               array,
+                               element_size,
+                               compare,
+                               left,
+                               end,
+                               pivot_tmp,
+                               swap_tmp);
+                       end = right;
+               }
+       }
 }
 
-void
-sgen_qsort (void *base, size_t nel, size_t width, int (*compar) (const void*, const void*))
+void sgen_qsort (
+       void *const array,
+       const size_t count,
+       const size_t element_size,
+       int (*compare) (const void *, const void *))
 {
 #ifndef _MSC_VER
-       unsigned char pivot_tmp [width];
-       unsigned char swap_tmp [width];
+       unsigned char pivot_tmp [element_size];
+       unsigned char swap_tmp [element_size];
 #else
-       unsigned char* pivot_tmp = (unsigned char*) alloca(width);
-       unsigned char* swap_tmp = (unsigned char*) alloca(width);
+       unsigned char *pivot_tmp = (unsigned char *)alloca (element_size);
+       unsigned char *swap_tmp = (unsigned char *)alloca (element_size);
 #endif
-
-       qsort_rec (base, nel, width, compar, pivot_tmp, swap_tmp);
+       sgen_qsort_rec (
+               array,
+               element_size,
+               compare,
+               0,
+               (ssize_t)count - 1,
+               pivot_tmp,
+               swap_tmp);
 }
 
 #endif
index b9d0f648138e4c694eac038b0d3b295001df4270..46a7489691086013a11f35ce74a8ce8206295aaa 100644 (file)
@@ -8,34 +8,69 @@
 #ifndef __MONO_SGENQSORT_H__
 #define __MONO_SGENQSORT_H__
 
-#define DEF_QSORT_INLINE(NAME,ARRAY_TYPE,COMPARE_FUN)  \
-static size_t partition_##NAME (ARRAY_TYPE base[], size_t nel) {       \
-       size_t pivot_idx = nel >> 1;    \
-       size_t s, i;    \
-       ARRAY_TYPE pivot = base [pivot_idx];    \
-       { ARRAY_TYPE tmp = base [pivot_idx]; base [pivot_idx] = base [nel - 1]; base [nel - 1] = tmp; } \
-       s = 0;  \
-       for (i = 0; i < nel - 1; ++i) { \
-               if (COMPARE_FUN (base [i], pivot) <= 0) {       \
-                       { ARRAY_TYPE tmp = base [i]; base [i] = base [s]; base [s] = tmp; }     \
-                       ++s;    \
-               }       \
-       }       \
-       { ARRAY_TYPE tmp = base [s]; base [s] = base [nel - 1]; base [nel - 1] = tmp; } \
-       return s;       \
+/* Copied from non-inline implementation in sgen-qsort.c */
+#define DEF_QSORT_INLINE(name, type, compare) \
+static inline void \
+qsort_swap_##name (type array[], const ssize_t i, const ssize_t j, type *const swap_tmp) \
+{ \
+       *swap_tmp = array [i]; \
+       array [i] = array [j]; \
+       array [j] = *swap_tmp; \
+} \
+\
+static void \
+qsort_rec_##name ( \
+       type array[], \
+       ssize_t begin, \
+       ssize_t end, \
+       type *const pivot_tmp, \
+       type *const swap_tmp) \
+{ \
+       ssize_t left, right, middle, pivot; \
+       while (begin < end) { \
+               left = begin; \
+               right = end; \
+               middle = begin + (end - begin) / 2; \
+               if (compare (array [middle], array [left]) < 0) \
+                       qsort_swap_##name (array, middle, left, swap_tmp); \
+               if (compare (array [right], array [left]) < 0) \
+                       qsort_swap_##name (array, right, left, swap_tmp); \
+               if (compare (array [right], array [middle]) < 0) \
+                       qsort_swap_##name (array, right, middle, swap_tmp); \
+               pivot = middle; \
+               *pivot_tmp = array [pivot]; \
+               for (;;) { \
+                       while (left <= right && compare (array [left], *pivot_tmp) <= 0) \
+                               ++left; \
+                       while (left <= right && compare (array [right], *pivot_tmp) > 0) \
+                               --right; \
+                       if (left > right) \
+                               break; \
+                       qsort_swap_##name (array, left, right, swap_tmp); \
+                       if (pivot == right) \
+                               pivot = left; \
+                       ++left; \
+                       --right; \
+               } \
+               array [pivot] = array [right]; \
+               array [right] = *pivot_tmp; \
+               --right; \
+               if (right - begin < end - left) { \
+                       qsort_rec_##name (array, begin, right, pivot_tmp, swap_tmp); \
+                       begin = left; \
+               } else { \
+                       qsort_rec_##name (array, left, end, pivot_tmp, swap_tmp); \
+                       end = right; \
+               } \
+       } \
 }      \
-static void rec_##NAME (ARRAY_TYPE base[], size_t nel) {       \
-       size_t pivot_idx;       \
-       if (nel <= 1)   \
-               return; \
-       pivot_idx = partition_##NAME (base, nel); \
-       rec_##NAME (base, pivot_idx);   \
-       if (pivot_idx < nel)    \
-               rec_##NAME (&base[pivot_idx + 1], nel - pivot_idx - 1); \
-}      \
-static void qsort_##NAME (ARRAY_TYPE base[], size_t nel) {     \
-       rec_##NAME (base, nel); \
-}      \
-
+\
+static inline void \
+qsort_##name (type array[], size_t count) \
+{ \
+       type pivot_tmp; \
+       type swap_tmp; \
+       qsort_rec_##name (array, 0, (ssize_t)count - 1, &pivot_tmp, &swap_tmp); \
+}
 
 #endif
index dfdff8c9062f2a7e25f8b5d5591ebc1b1b598187..76eebdd86edfe066f5bfbdf1c6c51d6ad562372e 100644 (file)
@@ -97,7 +97,7 @@ sgen_workers_ensure_awake (void)
 }
 
 static void
-worker_try_finish (void)
+worker_try_finish (WorkerData *data)
 {
        State old_state;
 
@@ -115,6 +115,8 @@ worker_try_finish (void)
        } while (!set_state (old_state, STATE_NOT_WORKING));
 
        binary_protocol_worker_finish (sgen_timestamp (), forced_stop);
+
+       sgen_gray_object_queue_trim_free_list (&data->private_gray_queue);
 }
 
 void
@@ -226,7 +228,7 @@ marker_idle_func (void *data_untyped)
                        sgen_thread_pool_job_enqueue (job);
                        preclean_job = NULL;
                } else {
-                       worker_try_finish ();
+                       worker_try_finish (data);
                }
        }
 }
index 0ac6d87689963392f0f37e620a9e5bf1332fa64d..81113f07facb6a1c7cd41311d12a169722a6f618 100644 (file)
@@ -6,7 +6,7 @@ else
 FEATUREFUL_RUNTIME_TEST = test-appdomain-unload
 endif
 
-check-local: assemblyresolve/test/asm.dll testjit test-generic-sharing test-type-load test-cattr-type-load test-reflection-load-with-context test_platform     \
+check-local: assemblyresolve/test/asm.dll testjit test-generic-sharing test-type-load test-multi-netmodule test-cattr-type-load test-reflection-load-with-context test_platform        \
                 test-console-output test-messages test-env-options test-unhandled-exception-2 $(FEATUREFUL_RUNTIME_TEST) test-process-stress rm-empty-logs
 check-full: test-sgen check-local
 check-parallel: compile-tests check-full
@@ -85,64 +85,68 @@ STRESS_TESTS_SRC=   \
        assembly-load-stress.cs
 
 BASE_TEST_MOBILE_STATIC_NOT_SUPPORTED= \
-       remoting4.cs            # Needs remoting support \
-       remoting1.cs            # Needs remoting support \
-       remoting2.cs            # Needs remoting support \
-       remoting3.cs            # Needs remoting support \
-       remoting5.cs            # Needs remoting support \
-       appdomain.cs        # Needs appdomain support \
-       appdomain-client.cs     # Needs appdomain support \
-       appdomain-unload.cs # Needs appdomain support \
-       appdomain-async-invoke.cs       # Needs appdomain support \
-       appdomain-thread-abort.cs       # Needs appdomain support \
-       appdomain1.cs           # Needs appdomain support \
-       appdomain2.cs           # Needs appdomain support \
-       appdomain-exit.cs       # Needs appdomain support \
-       assemblyresolve_event2.2.cs     # Needs appdomain support \
-       appdomain-unload-callback.cs    # Needs appdomain support \
-       appdomain-unload-doesnot-raise-pending-events.cs        # Needs appdomain support \
-       unload-appdomain-on-shutdown.cs # Needs appdomain support \
-       bug-47295.cs # Needs SRE \
-       loader.cs # Needs SRE \
-       pinvoke2.cs # Needs SRE \
-       generic-type-builder.2.cs       # Needs SRE \
-       dynamic-generic-size.cs # Needs SRE \
-       cominterop.cs   # Needs COM \
-       dynamic-method-access.2.cs      # Need SRE \
-       dynamic-method-finalize.2.cs    # Need SRE \
-       dynamic-method-stack-traces.cs # Need SRE\
-       generic_type_definition.2.cs    # Need SRE \
-       bug-333798-tb.2.cs      # Need SRE \
-       bug-335131.2.cs # Need SRE \
-       bug-322722_patch_bx.2.cs        # Need SRE\
-       bug-322722_dyn_method_throw.2.cs        # Need SRE \
-       bug-389886-2.cs # Need SRE \
-       bug-349190.2.cs # Need SRE \
-       bug-389886-sre-generic-interface-instances.cs   # Need SRE \
-       bug-462592.cs   # Need SRE \
-       bug-575941.cs   # Need SRE \
-       bug-389886-3.cs # Need SRE \
-       dynamic-method-resurrection.cs  # Need SRE \
-       bug-80307.cs    # Need System.Web \
-       assembly_append_ordering.cs # Need SRE \
-       bug-544446.cs   # Needs AppDomains / TranparentProxy \
-       bug-36848.cs   # Needs AppDomains / TranparentProxy \
-       generic-marshalbyref.2.cs # Needs AppDomains \
-       stackframes-async.2.cs # Needs AppDomains \
-       transparentproxy.cs # Needs AppDomains / TranparentProxy \
-       bug-48015.cs # Needs AppDomains / TranparentProxy \
-       delegate9.cs # Needs AppDomains \
-       marshal-valuetypes.cs   # Needs AppDomains \
-       xdomain-threads.cs      # Needs AppDomains \
-       monitor.cs # Needs AppDomains \
-       generic-xdomain.2.cs # Needs AppDomains \
-       threadpool-exceptions7.cs # Needs AppDomains \
-       cross-domain.cs # Needs AppDomains \
-       generic-unloading.2.cs # Needs AppDomains \
-       thread6.cs # On MOBILE, ThreadAbortException doesn't have necessary field for this test
+       remoting4.cs    \
+       remoting1.cs    \
+       remoting2.cs    \
+       remoting3.cs    \
+       remoting5.cs    \
+       appdomain.cs    \
+       appdomain-client.cs     \
+       appdomain-unload.cs     \
+       appdomain-async-invoke.cs       \
+       appdomain-thread-abort.cs       \
+       appdomain1.cs   \
+       appdomain2.cs   \
+       appdomain-exit.cs       \
+       assemblyresolve_event2.2.cs     \
+       appdomain-unload-callback.cs    \
+       appdomain-unload-doesnot-raise-pending-events.cs        \
+       unload-appdomain-on-shutdown.cs \
+       bug-47295.cs    \
+       loader.cs       \
+       pinvoke2.cs     \
+       generic-type-builder.2.cs       \
+       dynamic-generic-size.cs \
+       cominterop.cs   \
+       dynamic-method-access.2.cs      \
+       dynamic-method-finalize.2.cs    \
+       dynamic-method-stack-traces.cs  \
+       generic_type_definition.2.cs    \
+       bug-333798-tb.2.cs      \
+       bug-335131.2.cs \
+       bug-322722_patch_bx.2.cs        \
+       bug-322722_dyn_method_throw.2.cs        \
+       bug-389886-2.cs \
+       bug-349190.2.cs \
+       bug-389886-sre-generic-interface-instances.cs   \
+       bug-462592.cs   \
+       bug-575941.cs   \
+       bug-389886-3.cs \
+       constant-division.cs    \
+       dynamic-method-resurrection.cs  \
+       bug-80307.cs    \
+       assembly_append_ordering.cs     \
+       bug-544446.cs   \
+       bug-36848.cs    \
+       generic-marshalbyref.2.cs       \
+       stackframes-async.2.cs  \
+       transparentproxy.cs     \
+       bug-48015.cs    \
+       delegate9.cs    \
+       marshal-valuetypes.cs   \
+       xdomain-threads.cs      \
+       monitor.cs      \
+       generic-xdomain.2.cs    \
+       threadpool-exceptions7.cs       \
+       cross-domain.cs \
+       generic-unloading.2.cs  \
+       namedmutex-destroy-race.cs      \
+       thread6.cs      \
+       appdomain-threadpool-unload.cs
 
 # Disabled until ?mcs is fixed
 #      bug-331958.cs
+# Note: only add tests that are compatible with mobile_static to this category
 BASE_TEST_CS_SRC_UNIVERSAL=            \
        generic-unloading-sub.2.cs      \
        create-instance.cs      \
@@ -191,6 +195,7 @@ BASE_TEST_CS_SRC_UNIVERSAL=         \
        typeof-ptr.cs           \
        static-constructor.cs   \
        pinvoke.cs              \
+       pinvoke-utf8.cs         \
        pinvoke3.cs             \
        pinvoke11.cs            \
        pinvoke13.cs            \
@@ -254,7 +259,6 @@ BASE_TEST_CS_SRC_UNIVERSAL=         \
        long.cs                 \
        jit-ulong.cs            \
        jit-float.cs            \
-       constant-division.cs    \
        pop.cs                  \
        time.cs                 \
        pointer.cs              \
@@ -465,7 +469,12 @@ BASE_TEST_CS_SRC_UNIVERSAL=                \
        pinvoke_ppcf.cs \
        pinvoke_ppcd.cs \
        bug-29585.cs    \
-       priority.cs
+       priority.cs     \
+       abort-cctor.cs  \
+       thread-native-exit.cs \
+       reference-loader.cs \
+       thread-suspend-suspended.cs \
+       thread-suspend-selfsuspended.cs
 
 if INSTALL_MOBILE_STATIC
 BASE_TEST_CS_SRC= \
@@ -522,7 +531,11 @@ endif
 
 if POWERPC64
 # FIXME: These tests hang/fail for unknown reasons
-PLATFORM_DISABLED_TESTS=monitor.exe threadpool-exceptions5.exe
+PLATFORM_DISABLED_TESTS=monitor.exe threadpool-exceptions5.exe appdomain-thread-abort.exe appdomain-unload.exe \
+       pinvoke2.exe pinvoke3.exe pinvoke11.exe threadpool-exceptions7.exe winx64structs.exe bug-10127.exe pinvoke_ppcc.exe \
+       pinvoke_ppcs.exe pinvoke_ppci.exe pinvoke_ppcf.exe pinvoke_ppcd.exe abort-cctor.exe \
+       sgen-domain-unload-2.exe sgen-weakref-stress.exe sgen-cementing-stress.exe sgen-new-threads-dont-join-stw.exe \
+       sgen-new-threads-dont-join-stw-2.exe sgen-new-threads-collect.exe sgen-bridge.exe
 endif
 
 if ARM
@@ -681,20 +694,30 @@ endif
 # delegate-invoke.exe depends on 929c6bc9b6d76a273f251e6f5dfacac36e9c38bd which was
 # reverted.
 # bug-Xamarin-5278.exe got broken by 5d26590e79da139a284459299aee95c25f4cd835
+# bug-45841-fpstack-exceptions.exe: https://bugzilla.xamarin.com/show_bug.cgi?id=47053
+# appdomain-thread-abort.exe: https://bugzilla.xamarin.com/show_bug.cgi?id=47054
 DISABLED_TESTS=                        \
        delegate-async-exception.exe    \
        bug-348522.2.exe        \
        bug-459094.exe \
        delegate-invoke.exe \
        bug-Xamarin-5278.exe \
+       bug-45841-fpstack-exceptions.exe \
+       appdomain-thread-abort.exe \
        $(PLATFORM_DISABLED_TESTS) \
        $(EXTRA_DISABLED_TESTS) \
        $(COOP_DISABLED_TESTS) \
        $(PROFILE_DISABLED_TESTS)
 
-DISABLED_TESTS_WRENCH= \
+# failing tests which we temporarily disable for PRs
+# so they don't interfere with other people's work
+DISABLED_TESTS_CI_PR = \
+       appdomain-threadpool-unload.exe \
+       appdomain-thread-abort.exe
+
+DISABLED_TESTS_CI=     \
        $(DISABLED_TESTS)       \
-       $(PLATFORM_DISABLED_TESTS_WRENCH)       \
+       $(shell if [ "x$(CI_PR)" != "x" ]; then echo $(DISABLED_TESTS_CI_PR); fi)       \
        main-returns-background-resetabort.exe \
        main-returns-background-abort-resetabort.exe    \
        thread6.exe     \
@@ -783,7 +806,8 @@ TEST_IL_SRC_UNIVERSAL=                      \
        delegate-with-null-target.il    \
        bug-318677.il   \
        gsharing-valuetype-layout.il    \
-       invalid_generic_instantiation.il
+       invalid_generic_instantiation.il \
+       bug-45841-fpstack-exceptions.il
 
 if INSTALL_MOBILE_STATIC
 TEST_IL_SRC= \
@@ -798,18 +822,22 @@ endif
 # but that need to be compiled
 PREREQ_IL_SRC=event-il.il module-cctor.il
 PREREQ_CS_SRC=
-PREREQ_IL_DLL_SRC=event-il.il module-cctor.il
-PREREQ_CS_DLL_SRC=
+PREREQ_IL_DLL_SRC=
+PREREQ_CS_DLL_SRC=TestingReferenceAssembly.cs TestingReferenceReferenceAssembly.cs
 
-PREREQSI_IL=$(PREREQ_IL_SRC:.il=.exe)
-PREREQSI_CS=$(PREREQ_CS_SRC:.cs=.exe)
+PREREQSI_IL=$(PREREQ_IL_SRC:.il=.exe) \
+       $(PREREQ_IL_DLL_SRC:.il=.dll)
+PREREQSI_CS=$(PREREQ_CS_SRC:.cs=.exe) \
+       $(PREREQ_CS_DLL_SRC:.cs=.dll)
 TESTSI_CS=$(TEST_CS_SRC:.cs=.exe)
 TESTSI_IL=$(TEST_IL_SRC:.il=.exe)
 TESTBS=$(BENCHSRC:.cs=.exe)
 STRESS_TESTS=$(STRESS_TESTS_SRC:.cs=.exe)
 
-PREREQSI_IL_AOT=$(PREREQ_IL_SRC:.il=.exe$(PLATFORM_AOT_SUFFIX))
-PREREQSI_CS_AOT=$(PREREQ_CS_SRC:.cs=.exe$(PLATFORM_AOT_SUFFIX))
+PREREQSI_IL_AOT=$(PREREQ_IL_SRC:.il=.exe$(PLATFORM_AOT_SUFFIX)) \
+               $(PREREQ_IL_DLL_SRC:.il=.dll$(PLATFORM_AOT_SUFFIX))
+PREREQSI_CS_AOT=$(PREREQ_CS_SRC:.cs=.exe$(PLATFORM_AOT_SUFFIX)) \
+               $(PREREQ_CS_DLL_SRC:.cs=.dll$(PLATFORM_AOT_SUFFIX))
 
 EXTRA_DIST=test-driver test-runner.cs $(TEST_CS_SRC_DIST) $(TEST_IL_SRC) \
        $(BENCHSRC) $(STRESS_TESTS_SRC) stress-runner.pl $(PREREQ_IL_SRC) $(PREREQ_CS_SRC)
@@ -830,6 +858,12 @@ endif
 %.exe: %.cs $(TEST_DRIVER_DEPEND)
        $(MCS) -r:System.dll -r:System.Xml.dll -r:System.Core.dll -r:TestDriver.dll $(TEST_DRIVER_HARD_KILL_FEATURE) -out:$@ $<
 
+%.dll: %.cs
+       $(MCS) -r:System.dll -target:library -out:$@ $<
+
+TestingReferenceReferenceAssembly.dll: TestingReferenceReferenceAssembly.cs TestingReferenceAssembly.dll
+       $(MCS) -r:TestingReferenceAssembly.dll -target:library -out:$@ $<
+
 %.exe$(PLATFORM_AOT_SUFFIX): %.exe 
        $(RUNTIME) $(AOT_BUILD_FLAGS) $<
 
@@ -864,7 +898,9 @@ bug-324535-il.dll$(PLATFORM_AOT_SUFFIX)     \
 bug-36848-a.dll$(PLATFORM_AOT_SUFFIX)  \
 bug-81691-b.dll$(PLATFORM_AOT_SUFFIX)  \
 bug-327438.2.exe$(PLATFORM_AOT_SUFFIX) \
-bug-81466-lib.dll$(PLATFORM_AOT_SUFFIX)
+bug-81466-lib.dll$(PLATFORM_AOT_SUFFIX)        \
+TestingReferenceAssembly.dll$(PLATFORM_AOT_SUFFIX)     \
+TestingReferenceReferenceAssembly.dll$(PLATFORM_AOT_SUFFIX)
 
 if INSTALL_MOBILE_STATIC
 prereqs: $(PREREQSI_IL_AOT) $(PREREQSI_CS_AOT) $(AOT_EXTRA_LIBS)
@@ -930,7 +966,7 @@ test_cs: $(TEST_PROG) $(TESTSI_CS) libtest.la
        @failed=0; \
        passed=0; \
        if [ "x$$V" = "x1" ]; then dump_action="dump-output"; else dump_action="no-dump"; fi; \
-       if [ "x$$CI" = "x1" ]; then disabled_tests="$(DISABLED_TESTS_WRENCH)"; else disabled_tests="$(DISABLED_TESTS)"; fi; \
+       if [ "x$$CI" = "x1" ]; then disabled_tests="$(DISABLED_TESTS_CI)"; else disabled_tests="$(DISABLED_TESTS)"; fi; \
        for i in $(TESTSI_CS); do       \
                if $(srcdir)/test-driver '$(with_mono_path) $(TEST_PROG_RUN)' $$i "$${disabled_tests}" "$${dump_action}" $(RUNTIME_ARGS); \
                then \
@@ -946,7 +982,7 @@ test_il: $(TEST_PROG) $(TESTSI_IL) libtest.la
        @failed=0; \
        passed=0; \
        if [ "x$$V" = "x1" ]; then dump_action="dump-output"; else dump_action="no-dump"; fi; \
-       if [ "x$$CI" = "x1" ]; then disabled_tests="$(DISABLED_TESTS_WRENCH)"; else disabled_tests="$(DISABLED_TESTS)"; fi; \
+       if [ "x$$CI" = "x1" ]; then disabled_tests="$(DISABLED_TESTS_CI)"; else disabled_tests="$(DISABLED_TESTS)"; fi; \
        for i in $(TESTSI_IL); do       \
                if $(srcdir)/test-driver '$(with_mono_path) $(TEST_PROG_RUN)' $$i "$${disabled_tests}" "$${dump_action}" $(RUNTIME_ARGS); \
                then \
@@ -960,7 +996,7 @@ test_il: $(TEST_PROG) $(TESTSI_IL) libtest.la
 
 testb: $(TEST_PROG) $(TESTBS)
        if [ "x$$V" = "x1" ]; then dump_action="dump-output"; else dump_action="no-dump"; fi; \
-       if [ "x$$CI" = "x1" ]; then disabled_tests="$(DISABLED_TESTS_WRENCH)"; else disabled_tests="$(DISABLED_TESTS)"; fi; \
+       if [ "x$$CI" = "x1" ]; then disabled_tests="$(DISABLED_TESTS_CI)"; else disabled_tests="$(DISABLED_TESTS)"; fi; \
        for i in $(TESTBS); do  \
                $(srcdir)/test-driver '$(with_mono_path) $(TEST_PROG_RUN)' $$i "$${disabled_tests}" "$${dump_action}" $(RUNTIME_ARGS);  \
        done
@@ -970,7 +1006,7 @@ runtest: $(TESTSI_CS) $(TESTSI_IL) $(TESTBS) libtest.la $(PREREQSI_IL) $(PREREQS
        passed=0; \
        failed_tests="";\
        if [ "x$$V" = "x1" ]; then dump_action="dump-output"; else dump_action="no-dump"; fi; \
-       if [ "x$$CI" = "x1" ]; then disabled_tests="$(DISABLED_TESTS_WRENCH)"; else disabled_tests="$(DISABLED_TESTS)"; fi; \
+       if [ "x$$CI" = "x1" ]; then disabled_tests="$(DISABLED_TESTS_CI)"; else disabled_tests="$(DISABLED_TESTS)"; fi; \
        rm -f testlist testlist.sorted; \
        for i in $(TESTSI_CS) $(TESTBS) $(TESTSI_IL); do echo $${i} >> testlist; sort testlist > testlist.sorted; done; \
        for i in `cat testlist.sorted`; do \
@@ -1000,11 +1036,11 @@ runtest: $(TESTSI_CS) $(TESTSI_IL) $(TESTBS) libtest.la $(PREREQSI_IL) $(PREREQS
        fi
 
 runtest-managed: test-runner.exe $(TESTSI_CS) $(TESTSI_IL) $(TESTBS) libtest.la $(PREREQSI_IL) $(PREREQSI_CS)
-       @if [ "x$$CI" = "x1" ]; then disabled_tests="$(DISABLED_TESTS_WRENCH)"; else disabled_tests="$(DISABLED_TESTS)"; fi; \
+       @if [ "x$$CI" = "x1" ]; then disabled_tests="$(DISABLED_TESTS_CI)"; else disabled_tests="$(DISABLED_TESTS)"; fi; \
        $(RUNTIME) --debug $(TEST_RUNNER) $(TEST_RUNNER_ARGS) -j a --testsuite-name "runtime" --timeout 300 --disabled "$${disabled_tests}" $(TESTSI_CS) $(TESTBS) $(TESTSI_IL)
 
 runtest-managed-serial: test-runner.exe $(TESTSI_CS) $(TESTSI_IL) $(TESTBS) libtest.la $(PREREQSI_IL) $(PREREQSI_CS)
-       @if [ "x$$CI" = "x1" ]; then disabled_tests="$(DISABLED_TESTS_WRENCH)"; else disabled_tests="$(DISABLED_TESTS)"; fi; \
+       @if [ "x$$CI" = "x1" ]; then disabled_tests="$(DISABLED_TESTS_CI)"; else disabled_tests="$(DISABLED_TESTS)"; fi; \
        $(RUNTIME) --debug $(TEST_RUNNER) $(TEST_RUNNER_ARGS) -j 1 --testsuite-name "runtime" --disabled "$${disabled_tests}" $(TESTSI_CS) $(TESTBS) $(TESTSI_IL)
 
 testjit:
@@ -1056,12 +1092,22 @@ testbundle: console.exe
 
 EXTRA_DIST += load-missing.il t-missing.cs load-exceptions.cs
 test-type-load: $(TEST_DRIVER_DEPEND)
+if !POWERPC64
        @$(ILASM) /dll /output:load-missing.dll $(srcdir)/load-missing.il > /dev/null
        @$(MCS) -t:library -out:t.dll -d:FOUND $(srcdir)/t-missing.cs
        @$(MCS) -r:TestDriver.dll -r:load-missing.dll -r:t.dll -out:load-exceptions.exe $(srcdir)/load-exceptions.cs
        @$(MCS) -t:library -out:t.dll $(srcdir)/t-missing.cs
        @echo "Testing load-exception.exe..."
        @$(RUNTIME) load-exceptions.exe > load-exceptions.exe.stdout 2> load-exceptions.exe.stderr
+endif
+
+EXTRA_DIST += test-multi-netmodule-1-netmodule.cs test-multi-netmodule-2-dll1.cs test-multi-netmodule-3-dll2.cs test-multi-netmodule-4-exe.cs
+test-multi-netmodule:
+       @$(MCS) -t:module test-multi-netmodule-1-netmodule.cs
+       @$(MCS) -addmodule:test-multi-netmodule-1-netmodule.netmodule -t:library test-multi-netmodule-2-dll1.cs
+       @$(MCS) -addmodule:test-multi-netmodule-1-netmodule.netmodule -t:library test-multi-netmodule-3-dll2.cs
+       @$(MCS) -r:test-multi-netmodule-2-dll1.dll test-multi-netmodule-4-exe.cs
+       $(RUNTIME) test-multi-netmodule-4-exe.exe > test-multi-netmodule-4-exe.exe.stdout 2> test-multi-netmodule-4-exe.exe.stderr
 
 EXTRA_DIST += custom-attr-errors.cs custom-attr-errors-lib.cs
 test-cattr-type-load: $(TEST_DRIVER_DEPEND) custom-attr-errors.cs custom-attr-errors-lib.cs
@@ -1087,7 +1133,7 @@ debug-casts:
        @$(MCS) -r:TestDriver.dll $(srcdir)/debug-casts.cs
        @$(RUNTIME) --debug=casts debug-casts.exe
 
-EXTRA_DIST += sgen-bridge.cs sgen-descriptors.cs sgen-gshared-vtype.cs sgen-bridge-major-fragmentation.cs sgen-domain-unload.cs sgen-weakref-stress.cs sgen-cementing-stress.cs sgen-case-23400.cs     finalizer-wait.cs critical-finalizers.cs sgen-domain-unload-2.cs sgen-suspend.cs sgen-new-threads-dont-join-stw.cs sgen-new-threads-dont-join-stw-2.cs sgen-bridge-xref.cs bug-17590.cs sgen-toggleref.cs sgen-bridge-gchandle.cs
+EXTRA_DIST += sgen-bridge.cs sgen-descriptors.cs sgen-gshared-vtype.cs sgen-bridge-major-fragmentation.cs sgen-domain-unload.cs sgen-weakref-stress.cs sgen-cementing-stress.cs sgen-case-23400.cs     finalizer-wait.cs critical-finalizers.cs sgen-domain-unload-2.cs sgen-suspend.cs sgen-new-threads-dont-join-stw.cs sgen-new-threads-dont-join-stw-2.cs sgen-new-threads-collect.cs sgen-bridge-xref.cs bug-17590.cs sgen-toggleref.cs sgen-bridge-gchandle.cs
 
 
 sgen-tests:
@@ -1112,6 +1158,7 @@ SGEN_REGULAR_TESTS_UNIVERSAL =    \
        sgen-case-23400.exe     \
        sgen-new-threads-dont-join-stw.exe      \
        sgen-new-threads-dont-join-stw-2.exe    \
+       sgen-new-threads-collect.exe    \
        gc-graystack-stress.exe \
        bug-17590.exe
 
@@ -1125,31 +1172,31 @@ SGEN_REGULAR_TESTS= \
 endif
 
 sgen-regular-tests: $(SGEN_REGULAR_TESTS)
-       $(MAKE) sgen-regular-tests-plain
+       $(MAKE) sgen-regular-tests-ms
        $(MAKE) sgen-regular-tests-ms-conc
        $(MAKE) sgen-regular-tests-ms-conc-split
        $(MAKE) sgen-regular-tests-ms-split
-       $(MAKE) sgen-regular-tests-ms-split-95
-       $(MAKE) sgen-regular-tests-plain-clear-at-gc
+       $(MAKE) sgen-regular-tests-ms-conc-split-95
+       $(MAKE) sgen-regular-tests-ms-clear-at-gc
        $(MAKE) sgen-regular-tests-ms-conc-clear-at-gc
-       $(MAKE) sgen-regular-tests-ms-split-clear-at-gc
+       $(MAKE) sgen-regular-tests-ms-conc-split-clear-at-gc
 
-sgen-regular-tests-plain: $(SGEN_REGULAR_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_REGULAR_TESTS)
+sgen-regular-tests-ms: $(SGEN_REGULAR_TESTS) test-runner.exe
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="major=marksweep" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_REGULAR_TESTS)
 sgen-regular-tests-ms-conc: $(SGEN_REGULAR_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="major=marksweep-conc" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_REGULAR_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="major=marksweep-conc" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_REGULAR_TESTS)
 sgen-regular-tests-ms-conc-split: $(SGEN_REGULAR_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="major=marksweep-conc,minor=split" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_REGULAR_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="major=marksweep-conc,minor=split" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_REGULAR_TESTS)
 sgen-regular-tests-ms-split: $(SGEN_REGULAR_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="minor=split" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_REGULAR_TESTS)
-sgen-regular-tests-ms-split-95: $(SGEN_REGULAR_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="minor=split,alloc-ratio=95" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_REGULAR_TESTS)
-sgen-regular-tests-plain-clear-at-gc: $(SGEN_REGULAR_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="clear-at-gc" MONO_GC_PARAMS="" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_REGULAR_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="major=marksweep,minor=split" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_REGULAR_TESTS)
+sgen-regular-tests-ms-conc-split-95: $(SGEN_REGULAR_TESTS) test-runner.exe
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="major=marksweep-conc,minor=split,alloc-ratio=95" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_REGULAR_TESTS)
+sgen-regular-tests-ms-clear-at-gc: $(SGEN_REGULAR_TESTS) test-runner.exe
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="clear-at-gc" MONO_GC_PARAMS="major=marksweep" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_REGULAR_TESTS)
 sgen-regular-tests-ms-conc-clear-at-gc: $(SGEN_REGULAR_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="clear-at-gc" MONO_GC_PARAMS="major=marksweep-conc" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_REGULAR_TESTS)
-sgen-regular-tests-ms-split-clear-at-gc: $(SGEN_REGULAR_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="clear-at-gc" MONO_GC_PARAMS="minor=split" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_REGULAR_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="clear-at-gc" MONO_GC_PARAMS="major=marksweep-conc" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_REGULAR_TESTS)
+sgen-regular-tests-ms-conc-split-clear-at-gc: $(SGEN_REGULAR_TESTS) test-runner.exe
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="clear-at-gc" MONO_GC_PARAMS="major=marksweep-conc,minor=split" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_REGULAR_TESTS)
 
 SGEN_TOGGLEREF_TESTS=  \
        sgen-toggleref.exe
@@ -1165,21 +1212,21 @@ sgen-toggleref-tests: $(SGEN_TOGGLEREF_TESTS)
        $(MAKE) sgen-toggleref-tests-ms-split-clear-at-gc
 
 sgen-toggleref-tests-plain: $(SGEN_TOGGLEREF_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="toggleref-test" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_TOGGLEREF_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="toggleref-test" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_TOGGLEREF_TESTS)
 sgen-toggleref-tests-ms-conc: $(SGEN_TOGGLEREF_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="toggleref-test,major=marksweep-conc" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_TOGGLEREF_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="toggleref-test,major=marksweep-conc" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_TOGGLEREF_TESTS)
 sgen-toggleref-tests-ms-conc-split: $(SGEN_TOGGLEREF_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="toggleref-test,major=marksweep-conc,minor=split" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_TOGGLEREF_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="toggleref-test,major=marksweep-conc,minor=split" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_TOGGLEREF_TESTS)
 sgen-toggleref-tests-ms-split: $(SGEN_TOGGLEREF_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="toggleref-test,minor=split" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_TOGGLEREF_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="toggleref-test,minor=split" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_TOGGLEREF_TESTS)
 sgen-toggleref-tests-ms-split-95: $(SGEN_TOGGLEREF_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="toggleref-test,minor=split,alloc-ratio=95" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_TOGGLEREF_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="toggleref-test,minor=split,alloc-ratio=95" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_TOGGLEREF_TESTS)
 sgen-toggleref-tests-plain-clear-at-gc: $(SGEN_TOGGLEREF_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="clear-at-gc" MONO_GC_PARAMS="toggleref-test" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_TOGGLEREF_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="clear-at-gc" MONO_GC_PARAMS="toggleref-test" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_TOGGLEREF_TESTS)
 sgen-toggleref-tests-ms-conc-clear-at-gc: $(SGEN_TOGGLEREF_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="clear-at-gc" MONO_GC_PARAMS="toggleref-test,major=marksweep-conc" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_TOGGLEREF_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="clear-at-gc" MONO_GC_PARAMS="toggleref-test,major=marksweep-conc" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_TOGGLEREF_TESTS)
 sgen-toggleref-tests-ms-split-clear-at-gc: $(SGEN_TOGGLEREF_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="clear-at-gc" MONO_GC_PARAMS="toggleref-test,minor=split" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_TOGGLEREF_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="clear-at-gc" MONO_GC_PARAMS="toggleref-test,minor=split" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_TOGGLEREF_TESTS)
 
 SGEN_BRIDGE_TESTS=     \
        sgen-bridge.exe \
@@ -1196,21 +1243,21 @@ sgen-bridge-tests: $(SGEN_BRIDGE_TESTS)
        $(MAKE) sgen-bridge-tests-ms-split-tarjan-bridge
 
 sgen-bridge-tests-plain: $(SGEN_BRIDGE_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=Bridge" MONO_GC_PARAMS="" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=Bridge" MONO_GC_PARAMS="" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_BRIDGE_TESTS)
 sgen-bridge-tests-ms-conc: $(SGEN_BRIDGE_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=Bridge" MONO_GC_PARAMS="major=marksweep-conc" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=Bridge" MONO_GC_PARAMS="major=marksweep-conc" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_BRIDGE_TESTS)
 sgen-bridge-tests-ms-split: $(SGEN_BRIDGE_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=Bridge" MONO_GC_PARAMS="minor=split" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=Bridge" MONO_GC_PARAMS="minor=split" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_BRIDGE_TESTS)
 sgen-bridge-tests-plain-new-bridge: $(SGEN_BRIDGE_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=Bridge" MONO_GC_PARAMS="bridge-implementation=new" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=Bridge" MONO_GC_PARAMS="bridge-implementation=new" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_BRIDGE_TESTS)
 sgen-bridge-tests-ms-conc-new-bridge: $(SGEN_BRIDGE_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=Bridge" MONO_GC_PARAMS="bridge-implementation=new,major=marksweep-conc" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=Bridge" MONO_GC_PARAMS="bridge-implementation=new,major=marksweep-conc" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_BRIDGE_TESTS)
 sgen-bridge-tests-ms-split-new-bridge: $(SGEN_BRIDGE_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=Bridge" MONO_GC_PARAMS="bridge-implementation=new,minor=split" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=Bridge" MONO_GC_PARAMS="bridge-implementation=new,minor=split" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_BRIDGE_TESTS)
 sgen-bridge-tests-plain-tarjan-bridge: $(SGEN_BRIDGE_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=Bridge" MONO_GC_PARAMS="bridge-implementation=tarjan" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=Bridge" MONO_GC_PARAMS="bridge-implementation=tarjan" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_BRIDGE_TESTS)
 sgen-bridge-tests-ms-split-tarjan-bridge: $(SGEN_BRIDGE_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=Bridge" MONO_GC_PARAMS="bridge-implementation=tarjan,minor=split" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=Bridge" MONO_GC_PARAMS="bridge-implementation=tarjan,minor=split" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_BRIDGE_TESTS)
 
 SGEN_BRIDGE2_TESTS=    \
        sgen-bridge-xref.exe
@@ -1226,21 +1273,21 @@ sgen-bridge2-tests: $(SGEN_BRIDGE2_TESTS)
        $(MAKE) sgen-bridge2-tests-ms-split-tarjan-bridge
 
 sgen-bridge2-tests-plain: $(SGEN_BRIDGE2_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=2Bridge" MONO_GC_PARAMS="" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE2_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=2Bridge" MONO_GC_PARAMS="" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_BRIDGE2_TESTS)
 sgen-bridge2-tests-ms-conc: $(SGEN_BRIDGE2_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=2Bridge" MONO_GC_PARAMS="major=marksweep-conc" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE2_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=2Bridge" MONO_GC_PARAMS="major=marksweep-conc" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_BRIDGE2_TESTS)
 sgen-bridge2-tests-ms-split: $(SGEN_BRIDGE2_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=2Bridge" MONO_GC_PARAMS="minor=split" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE2_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=2Bridge" MONO_GC_PARAMS="minor=split" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_BRIDGE2_TESTS)
 sgen-bridge2-tests-plain-new-bridge: $(SGEN_BRIDGE2_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=2Bridge" MONO_GC_PARAMS="bridge-implementation=new" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE2_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=2Bridge" MONO_GC_PARAMS="bridge-implementation=new" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_BRIDGE2_TESTS)
 sgen-bridge2-tests-ms-conc-new-bridge: $(SGEN_BRIDGE2_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=2Bridge" MONO_GC_PARAMS="bridge-implementation=new,major=marksweep-conc" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE2_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=2Bridge" MONO_GC_PARAMS="bridge-implementation=new,major=marksweep-conc" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_BRIDGE2_TESTS)
 sgen-bridge2-tests-ms-split-new-bridge: $(SGEN_BRIDGE2_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=2Bridge" MONO_GC_PARAMS="bridge-implementation=new,minor=split" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE2_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=2Bridge" MONO_GC_PARAMS="bridge-implementation=new,minor=split" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_BRIDGE2_TESTS)
 sgen-bridge2-tests-plain-tarjan-bridge: $(SGEN_BRIDGE2_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=2Bridge" MONO_GC_PARAMS="bridge-implementation=tarjan" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE2_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=2Bridge" MONO_GC_PARAMS="bridge-implementation=tarjan" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_BRIDGE2_TESTS)
 sgen-bridge2-tests-ms-split-tarjan-bridge: $(SGEN_BRIDGE2_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=2Bridge" MONO_GC_PARAMS="bridge-implementation=tarjan,minor=split" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE2_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=2Bridge" MONO_GC_PARAMS="bridge-implementation=tarjan,minor=split" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_BRIDGE2_TESTS)
 
 SGEN_BRIDGE3_TESTS=    \
        sgen-bridge-gchandle.exe
@@ -1646,7 +1693,7 @@ PROCESS_STRESS_TESTS=     \
                process-leak.exe
 
 test-process-stress: $(PROCESS_STRESS_TESTS) test-runner.exe
-       $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 600 $(PROCESS_STRESS_TESTS)
+       $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 600 $(PROCESS_STRESS_TESTS)
 
 coreclr-gcstress:
        $(MAKE) -C $(mono_build_root)/acceptance-tests coreclr-gcstress
diff --git a/mono/tests/TestingReferenceAssembly.cs b/mono/tests/TestingReferenceAssembly.cs
new file mode 100644 (file)
index 0000000..e68a2c8
--- /dev/null
@@ -0,0 +1,7 @@
+using System.Runtime.CompilerServices;
+
+[assembly: ReferenceAssemblyAttribute]
+
+public class X {
+       public int Y;
+}
diff --git a/mono/tests/TestingReferenceReferenceAssembly.cs b/mono/tests/TestingReferenceReferenceAssembly.cs
new file mode 100644 (file)
index 0000000..0acb6f1
--- /dev/null
@@ -0,0 +1,7 @@
+// An assembly that refereces the TestingReferenceAssembly
+
+class Z : X {
+       public Z () {
+               Y = 1;
+       }
+}
diff --git a/mono/tests/abort-cctor.cs b/mono/tests/abort-cctor.cs
new file mode 100644 (file)
index 0000000..34f8780
--- /dev/null
@@ -0,0 +1,332 @@
+using System;
+using System.Diagnostics;
+using System.Threading;
+using System.Runtime.CompilerServices;
+
+class Driver
+{
+       public static ManualResetEvent mre1 = new ManualResetEvent (false);
+       public static ManualResetEvent mre2 = new ManualResetEvent (false);
+
+       class StaticConstructor1
+       {
+               internal static bool gotToEnd, caughtException;
+               static StaticConstructor1 ()
+               {
+                       try {
+                               Console.WriteLine ("StaticConstructor1.StaticConstructor1 (1)");
+                               Driver.mre1.Set ();
+                               var sw = Stopwatch.StartNew ();
+                               Thread.Sleep (1000);
+                               sw.Stop ();
+                               typeof (string).GetMethods ();
+                               //XXX we assume that if we slept less than 900ms we got aborted
+                               if (sw.ElapsedMilliseconds < 900)
+                                       throw new Exception ("Bad abort broke our sleep");
+                               Console.WriteLine ("StaticConstructor1.StaticConstructor1 (2) waited {0}", sw.ElapsedMilliseconds);
+                               gotToEnd = true;
+                       } catch (Exception e) {
+                               caughtException = true;
+                               throw;
+                       }
+               }
+
+               public static void Init ()
+               {
+                       Console.WriteLine ("StaticConstructor1.Init");
+               }
+       }
+
+       [MethodImplAttribute (MethodImplOptions.NoInlining)]
+       static void IsStaticConstructor1Viable () {
+               new StaticConstructor1 ();
+               Console.WriteLine ("Did it get to the end? {0} Did it catch an exception {1}", StaticConstructor1.gotToEnd, StaticConstructor1.caughtException);
+               if (!StaticConstructor1.gotToEnd) /* the TAE must not land during a .cctor */
+                       Environment.Exit (1);
+               if (StaticConstructor1.caughtException)
+                       Environment.Exit (1);
+                       
+       }
+
+       static void Test1 ()
+       {
+               Console.WriteLine ("Test 1:");
+
+               Driver.mre1.Reset ();
+               Driver.mre2.Reset ();
+
+               Thread thread = new Thread (() => {
+                       try {
+                               StaticConstructor1.Init ();
+                       } catch (Exception e) {
+                               Console.WriteLine ("StaticConstructor1::init caught exception {0}", e);
+
+                               if (!(e is ThreadAbortException))
+                                       throw;
+                       }
+               });
+
+               thread.Start ();
+
+               Driver.mre1.WaitOne ();
+
+               // The ThreadAbortException should land while in
+               // the StaticConstructor1.cctor. The exception should
+               // be queued, and be rethrown when exiting the cctor.
+               thread.Abort ();
+
+               thread.Join ();
+
+               //is StaticConstructor1 viable?
+               try {
+                       IsStaticConstructor1Viable ();
+                       Console.WriteLine ("StaticConstructor1 is viable"); /* a TAE doesn't make a type unusable */
+               } catch (TypeInitializationException  e) {
+                       Console.WriteLine ("StaticConstructor1 not viable");
+                       Environment.Exit (1);
+               }
+       }
+
+       class StaticConstructor2Exception : Exception {}
+
+       class StaticConstructor2
+       {
+               static StaticConstructor2 ()
+               {
+                       Console.WriteLine ("StaticConstructor2.StaticConstructor2 (1)");
+                       Driver.mre1.Set ();
+                       throw new StaticConstructor2Exception ();
+                       /* Unreachable */
+                       Driver.mre2.Set ();
+                       Console.WriteLine ("StaticConstructor2.StaticConstructor2 (2)");
+               }
+
+               public static void Init ()
+               {
+                       Console.WriteLine ("StaticConstructor2.Init");
+               }
+       }
+
+       [MethodImplAttribute (MethodImplOptions.NoInlining)]
+       static void IsStaticConstructor2Viable () {
+               new StaticConstructor2 ();
+       }
+
+
+       static void Test2 ()
+       {
+               Console.WriteLine ("Test 2:");
+
+               Driver.mre1.Reset ();
+               Driver.mre2.Reset ();
+
+               Thread thread = new Thread (() => {
+                       try {
+                               StaticConstructor2.Init ();
+                       } catch (TypeInitializationException e) {
+                               Console.WriteLine (e);
+
+                               if (!(e.InnerException is StaticConstructor2Exception))
+                                       throw;
+                       }
+               });
+
+               thread.Start ();
+
+               Driver.mre1.WaitOne ();
+
+               // A InvalidOperationException should be thrown while in
+               // the StaticConstructor2.cctor. The exception should
+               // be wrapped in a TypeInitializationException.
+
+               if (Driver.mre2.WaitOne (500)) {
+                       /* We shouldn't reach Driver.mre.Set () in StaticConstructor2.cctor */
+                       Environment.Exit (1);
+               }
+
+               thread.Join ();
+
+               //is StaticConstructor2 viable?
+               try {
+                       IsStaticConstructor2Viable ();
+                       Console.WriteLine ("StaticConstructor2 is viable");
+                       /* A regular exception escaping the .cctor makes the type not usable */
+                       Environment.Exit (1);
+               } catch (TypeInitializationException e) {
+                       Console.WriteLine ("StaticConstructor2 not viable");
+               }
+
+       }
+
+       class StaticConstructor3
+       {
+               static StaticConstructor3 ()
+               {
+                       Console.WriteLine ("StaticConstructor3.StaticConstructor3 (1)");
+                       Driver.mre1.Set ();
+                       Thread.CurrentThread.Abort ();
+                       /* Unreachable */
+                       Driver.mre2.Set ();
+                       Console.WriteLine ("StaticConstructor3.StaticConstructor3 (2)");
+                       Environment.Exit (1);
+               }
+
+               public static void Init ()
+               {
+                       Console.WriteLine ("StaticConstructor3.Init");
+               }
+       }
+
+       [MethodImplAttribute (MethodImplOptions.NoInlining)]
+       static void IsStaticConstructor3Viable () {
+               new StaticConstructor3 ();
+       }
+
+       static void Test3 ()
+       {
+               Console.WriteLine ("Test 3:");
+
+               Driver.mre1.Reset ();
+               Driver.mre2.Reset ();
+
+               Thread thread = new Thread (() => {
+                       try {
+                               StaticConstructor3.Init ();
+                               Console.WriteLine ("cctor3 didn't throw?!?!");
+                               /* StaticConstructor3 self aborted */
+                               Environment.Exit (1);
+                       } catch (ThreadAbortException e) {
+                               Console.WriteLine ("TEST 3: aborted {0}", e);
+                       }
+               });
+
+               thread.Start ();
+
+               Driver.mre1.WaitOne ();
+
+               // A InvalidOperationException should be thrown while in
+               // the StaticConstructor2.cctor. The exception should
+               // be wrapped in a TypeInitializationException.
+
+               thread.Join ();
+
+               //is StaticConstructor2 viable?
+               try {
+                       IsStaticConstructor3Viable ();
+                       Console.WriteLine ("StaticConstructor3 is viable");
+                       /* A regular exception escaping the .cctor makes the type not usable */
+                       Environment.Exit (1);
+               } catch (TypeInitializationException e) {
+                       Console.WriteLine ("StaticConstructor3 not viable");
+               }
+       }
+
+
+
+
+
+       class StaticConstructor4
+       {
+               internal static bool gotToEnd, caughtException;
+
+               static StaticConstructor4 ()
+               {
+                       try {
+                               Console.WriteLine ("StaticConstructor4.StaticConstructor4 (1)");
+                               Driver.mre1.Set ();
+                               var sw = Stopwatch.StartNew ();
+                               Thread.Sleep (1000);
+                               sw.Stop ();
+                               typeof (string).GetMethods ();
+                               //XXX we assume that if we slept less than 900ms we got aborted
+                               if (sw.ElapsedMilliseconds < 900)
+                                       throw new Exception ("Bad abort broke our sleep");
+                               Console.WriteLine ("StaticConstructor4.StaticConstructor4 (2) waited {0}", sw.ElapsedMilliseconds);
+                               gotToEnd = true;
+                       } catch (Exception e) {
+                               caughtException = true;
+                               throw;
+                       }       
+               }
+
+               public static void Init ()
+               {
+                       Console.WriteLine ("StaticConstructor4.Init");
+               }
+       }
+
+       static bool got_to_the_end_of_the_finally = false;
+
+       [MethodImplAttribute (MethodImplOptions.NoInlining)]
+       static void IsStaticConstructor4Viable () {
+               new StaticConstructor4 ();
+               Console.WriteLine ("IsStaticConstructor4Viable: Did it get to the end? {0} Did it catch an exception {1} and end of the finally block {2}", StaticConstructor4.gotToEnd, StaticConstructor4.caughtException, got_to_the_end_of_the_finally);
+               if (!StaticConstructor4.gotToEnd) /* the TAE must not land during a .cctor */
+                       Environment.Exit (1);
+               if (StaticConstructor4.caughtException)
+                       Environment.Exit (1);
+       }
+
+       static void Test4 ()
+       {
+               Console.WriteLine ("Test 4:");
+
+               Driver.mre1.Reset ();
+               Driver.mre2.Reset ();
+
+               Thread thread = new Thread (() => {
+                       try {
+
+                               try {
+                               } finally {
+                                       StaticConstructor4.Init ();
+                                       Console.WriteLine ("Test 4: After the cctor");
+                                       got_to_the_end_of_the_finally = true;
+                               }
+                       } catch (Exception e) {
+                               Console.WriteLine ("StaticConstructor4::init caught exception {0}", e);
+                               if (!(e is ThreadAbortException))
+                                       throw;
+                               if (!got_to_the_end_of_the_finally)
+                                       throw new Exception ("Test 4: did not get to the end of the cctor");
+                       }
+               });
+
+               thread.Start ();
+
+               Driver.mre1.WaitOne ();
+
+               // The ThreadAbortException should land while in
+               // the StaticConstructor4.cctor. The exception should
+               // be queued, and be rethrown when exiting the cctor.
+               thread.Abort ();
+
+               thread.Join ();
+
+               if (!got_to_the_end_of_the_finally) { 
+                       Console.WriteLine ("Did not get to the end of test 4 cctor");
+                       Environment.Exit (1);
+               }
+
+               //is StaticConstructor4viable?
+               try {
+                       IsStaticConstructor4Viable ();
+                       Console.WriteLine ("StaticConstructor4 is viable"); /* a TAE doesn't make a type unusable */
+               } catch (TypeInitializationException  e) {
+                       Console.WriteLine ("StaticConstructor4 not viable");
+                       Environment.Exit (1);
+               }
+       }
+
+
+
+       public static int Main ()
+       {
+               Test1 ();
+               Test2 ();
+               Test3 ();
+               Test4 ();
+               Console.WriteLine ("done, all things good");
+               return 0;
+       }
+}
\ No newline at end of file
diff --git a/mono/tests/appdomain-threadpool-unload.cs b/mono/tests/appdomain-threadpool-unload.cs
new file mode 100644 (file)
index 0000000..d8a7049
--- /dev/null
@@ -0,0 +1,52 @@
+
+using System;
+using System.Linq;
+using System.Threading;
+
+class Driver
+{
+       class ThreadPoolLauncherObject
+       {
+               public volatile int i = 0;
+
+               public ThreadPoolLauncherObject ()
+               {
+                       ThreadPool.QueueUserWorkItem (_ => { for (int i = 0; i < 10 * 1000 * 1000; ++i); }, null);
+               }
+       }
+
+       public static void Main ()
+       {
+               int count = 0;
+               object o = new object ();
+
+               foreach (var i in
+                       Enumerable.Range (0, 100)
+                               .AsParallel ().WithDegreeOfParallelism (Environment.ProcessorCount)
+                               .Select (i => {
+                                       AppDomain ad;
+
+                                       ad = AppDomain.CreateDomain ("testdomain" + i);
+                                       ad.CreateInstance (typeof (ThreadPoolLauncherObject).Assembly.FullName, typeof (ThreadPoolLauncherObject).FullName);
+
+                                       Thread.Sleep (10);
+
+                                       AppDomain.Unload (ad);
+
+                                       return i;
+                               })
+                               .Select (i => {
+                                       lock (o) {
+                                               count += 1;
+
+                                               Console.Write (".");
+                                               if (count % 25 == 0)
+                                                       Console.WriteLine ();
+                                       }
+
+                                       return i;
+                               })
+               ) {
+               }
+       }
+}
diff --git a/mono/tests/bug-45841-fpstack-exceptions.il b/mono/tests/bug-45841-fpstack-exceptions.il
new file mode 100644 (file)
index 0000000..d657476
--- /dev/null
@@ -0,0 +1,165 @@
+
+// Metadata version: v4.0.30319
+.assembly extern mscorlib
+{
+  .publickeytoken = (B7 7A 5C 56 19 34 E0 89 )                         // .z\V.4..
+  .ver 4:0:0:0
+}
+.assembly extern System.Data
+{
+  .publickeytoken = (B7 7A 5C 56 19 34 E0 89 )                         // .z\V.4..
+  .ver 4:0:0:0
+}
+.assembly x
+{
+  .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(int32) = ( 01 00 08 00 00 00 00 00 ) 
+  .custom instance void [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::.ctor() = ( 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78   // ....T..WrapNonEx
+                                                                                                             63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 )       // ceptionThrows.
+  .custom instance void [mscorlib]System.Diagnostics.DebuggableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggableAttribute/DebuggingModes) = ( 01 00 02 00 00 00 00 00 ) 
+  .hash algorithm 0x00008004
+  .ver 0:0:0:0
+}
+.module x.exe
+// MVID: {0EDDDD7B-2C90-4D6D-9C28-383B7DA8A1EB}
+.imagebase 0x00400000
+.file alignment 0x00000200
+.stackreserve 0x00100000
+.subsystem 0x0003       // WINDOWS_CUI
+.corflags 0x00000001    //  ILONLY
+
+
+// =============== CLASS MEMBERS DECLARATION ===================
+
+.class public auto ansi beforefieldinit SqlSingleTest
+       extends [mscorlib]System.Object
+{
+  .method public hidebysig static int32 Main() cil managed
+  {
+    .entrypoint
+    // Code size       164 (0xa4)
+    .maxstack  2
+    .locals init (valuetype [System.Data]System.Data.SqlTypes.SqlDecimal V_0)
+    .try
+    {
+               ldc.r8 5
+       newobj     instance void [mscorlib]System.OverflowException::.ctor(string)
+       throw
+                         pop
+      IL_001c:  leave.s    IL_0021
+
+    }  // end .try
+    catch [mscorlib]System.Exception 
+    {
+      IL_001e:  pop
+      IL_001f:  leave.s    IL_0021
+
+    }  // end handler
+    IL_0021:  nop
+    .try
+    {
+               ldc.r8 5
+       newobj     instance void [mscorlib]System.OverflowException::.ctor(string)
+       throw
+                         pop
+      IL_002e:  leave.s    IL_0033
+
+    }  // end .try
+    catch [mscorlib]System.Exception 
+    {
+      IL_0030:  pop
+      IL_0031:  leave.s    IL_0033
+
+    }  // end handler
+    IL_0033:  nop
+    .try
+    {
+               ldc.r8 5
+       newobj     instance void [mscorlib]System.OverflowException::.ctor(string)
+       throw
+      IL_0044:  leave.s    IL_0049
+
+    }  // end .try
+    catch [mscorlib]System.Exception 
+    {
+      IL_0046:  pop
+      IL_0047:  leave.s    IL_0049
+
+    }  // end handler
+    IL_0049:  nop
+    .try
+    {
+               ldc.r8 5
+       newobj     instance void [mscorlib]System.OverflowException::.ctor(string)
+       throw
+               pop
+      IL_005a:  leave.s    IL_005f
+
+    }  // end .try
+    catch [mscorlib]System.Exception 
+    {
+      IL_005c:  pop
+      IL_005d:  leave.s    IL_005f
+
+    }  // end handler
+    IL_005f:  nop
+    .try
+    {
+               ldc.r8 5
+       newobj     instance void [mscorlib]System.OverflowException::.ctor(string)
+       throw
+               pop
+      IL_006c:  leave.s    IL_0071
+
+    }  // end .try
+    catch [mscorlib]System.Exception 
+    {
+      IL_006e:  pop
+      IL_006f:  leave.s    IL_0071
+
+    }  // end handler
+    IL_0071:  nop
+    .try
+    {
+               ldc.r8 5
+       newobj     instance void [mscorlib]System.OverflowException::.ctor(string)
+       throw
+               pop
+      IL_0082:  leave.s    IL_0087
+
+    }  // end .try
+    catch [mscorlib]System.Exception 
+    {
+      IL_0084:  pop
+      IL_0085:  leave.s    IL_0087
+
+    }  // end handler
+       IL_0087:        
+    ldloca.s   V_0
+    IL_0089:  ldc.r8     5
+    IL_0092:  call       instance void [System.Data]System.Data.SqlTypes.SqlDecimal::.ctor(float64)
+    IL_0097:  ldloca.s   V_0
+    IL_0099:  call       instance valuetype [mscorlib]System.Decimal [System.Data]System.Data.SqlTypes.SqlDecimal::get_Value()
+    call       float64 [mscorlib]System.Decimal::ToDouble([mscorlib]System.Decimal)
+       ldc.r8 5
+       ceq
+       ldc.i4 0
+       ceq
+    ret
+  } // end of method SqlSingleTest::Main
+
+  .method public hidebysig specialname rtspecialname 
+          instance void  .ctor() cil managed
+  {
+    // Code size       7 (0x7)
+    .maxstack  8
+    IL_0000:  ldarg.0
+    IL_0001:  call       instance void [mscorlib]System.Object::.ctor()
+    IL_0006:  ret
+  } // end of method SqlSingleTest::.ctor
+
+} // end of class SqlSingleTest
+
+
+// =============================================================
+
+// *********** DISASSEMBLY COMPLETE ***********************
index 83f3ff71c297047f73fa0fa50fc1ee9d8e9bced4..7d0c812357d15c0c999445db9baeca94b97cb31f 100644 (file)
@@ -1,6 +1,9 @@
 using System;
 using System.Reflection;
 
+// this for test_0_missing_attr_on_assembly
+[assembly: MissingAttribute]
+
 public sealed class MyAttribute : Attribute
 {
        public Type Type { get; set; }
@@ -45,6 +48,15 @@ public class Bar {}
 
 class Tests {
 
+       public static int test_0_missing_attr_on_assembly () {
+               try {
+                       Assembly.GetExecutingAssembly().GetCustomAttributes (false);
+                       return 1;
+               } catch (TypeLoadException exn) {
+                       return 0;
+               }
+       }
+
        [My3 (new object[] { DisappearingEnum.V0 })]
        public static int test_0_missing_enum_arg_alt3 () {
                try {
index 340b28f2678511b1bba7f8a9aadc9fac4502e3c5..499cf9e8d0075fb7e82282a5fd2fa29de18eb3d3 100644 (file)
@@ -38,6 +38,8 @@ public class main {
        for (int i = 0; i < st.FrameCount; ++i) {
            StackFrame sf = st.GetFrame (i);
            MethodBase m = sf.GetMethod ();
+               if (m == null)
+                       continue;
            Type t = m.DeclaringType;
            if (m.IsGenericMethod) {
                Type[] margs = m.GetGenericArguments ();
index 8f1cef273f40075165310ad858c344b9fb71324f..3b0d98c37c81207db3d43c1683278182a8a31611 100644 (file)
@@ -7220,3 +7220,202 @@ mono_return_double_array4 (double_array4 sa4, int addend) {
        return sa4;
 }
 
+typedef struct {
+       int array [3];
+} FixedArrayStruct;
+
+LIBTEST_API int STDCALL
+mono_test_marshal_fixed_array (FixedArrayStruct s)
+{
+       return s.array [0] + s.array [1] + s.array [2];
+}
+
+const int NSTRINGS = 6;
+//test strings
+const char  *utf8Strings[] = {  
+                                "Managed",
+                                 "Sîne klâwen durh die wolken sint geslagen" ,
+                                 "काचं शक्नोम्यत्तुम् । नोपहिनस्ति माम्",
+                                 "我能吞下玻璃而不伤身体",
+                                 "ღმერთსი შემვედრე,შემვედრე, ნუთუ კვლა დამხსნას შემვედრე,სოფლისა შემვედრე, შემვედრე,შემვედრე,შემვედრე,შრომასა, ცეცხლს, წყალსა და მიწასა, ჰაერთა თანა მრომასა; მომცნეს ფრთენი და აღვფრინდე, მივჰხვდე მას ჩემსა ნდომასა, დღისით და ღამით ვჰხედვიდე მზისა ელვათა კრთომაასაშემვედრე,შემვედრე,",
+                                 "Τη γλώσσα μου έδωσαν ελληνική",
+"\0"
+};
+
+LIBTEST_API char *
+build_return_string(const char* pReturn)
+{
+       char *ret = 0;
+       if (pReturn == 0 || *pReturn == 0)
+               return ret;
+
+       size_t strLength = strlen(pReturn);
+       ret = (char *)(marshal_alloc (sizeof(char)* (strLength + 1)));
+       memset(ret, '\0', strLength + 1);
+       strncpy(ret, pReturn, strLength);
+       return ret;
+}
+
+LIBTEST_API char *
+StringParameterInOut(/*[In,Out]*/ char *s, int index)
+{
+       // return a copy
+       return build_return_string(s);
+}
+
+LIBTEST_API void
+StringParameterRefOut(/*out*/ char **s, int index)
+{
+       char *pszTextutf8 = (char*)utf8Strings[index];
+       size_t strLength = strlen(pszTextutf8);
+       *s = (char *)(marshal_alloc (sizeof(char)* (strLength + 1)));
+       memcpy(*s, pszTextutf8, strLength);
+       (*s)[strLength] = '\0';
+}
+
+LIBTEST_API void
+StringParameterRef(/*ref*/ char **s, int index)
+{
+    char *pszTextutf8 = (char*)utf8Strings[index];
+    size_t strLength = strlen(pszTextutf8);
+    // do byte by byte validation of in string
+    size_t szLen = strlen(*s);
+    for (size_t i = 0; i < szLen; i++)
+    {
+        if ((*s)[i] != pszTextutf8[i])
+        {
+            printf("[in] managed string do not match native string\n");
+           abort ();
+        }
+    }
+
+    if (*s)
+    {
+       marshal_free (*s);
+    }
+    // overwrite the orginal 
+    *s = (char *)(marshal_alloc (sizeof(char)* (strLength + 1)));
+    memcpy(*s, pszTextutf8, strLength);
+    (*s)[strLength] = '\0';
+}
+
+LIBTEST_API void
+StringBuilderParameterInOut(/*[In,Out] StringBuilder*/ char *s, int index)
+{
+    // if string.empty 
+    if (s == 0 || *s == 0)
+        return;
+
+    char *pszTextutf8 = (char*)utf8Strings[index];
+
+    // do byte by byte validation of in string
+    size_t szLen = strlen(s);
+    for (size_t i = 0; i < szLen; i++) 
+    {
+        if (s[i] != pszTextutf8[i])
+        {
+            printf("[in] managed string do not match native string\n");
+           abort ();
+        }
+    }  
+
+    // modify the string inplace 
+    size_t outLen = strlen(pszTextutf8);
+    for (size_t i = 0; i < outLen; i++) {
+        s[i] = pszTextutf8[i];
+    }
+    s[outLen] = '\0';
+}
+
+//out string builder
+LIBTEST_API void
+StringBuilderParameterOut(/*[Out] StringBuilder*/ char *s, int index)
+{
+    char *pszTextutf8 = (char*)utf8Strings[index];
+
+    printf ("SBPO: Receiving %s\n", s);
+    // modify the string inplace 
+    size_t outLen = strlen(pszTextutf8);
+    for (size_t i = 0; i < outLen; i++) {
+        s[i] = pszTextutf8[i];
+    }
+    s[outLen] = '\0';
+}
+
+LIBTEST_API char *
+StringParameterOut(/*[Out]*/ char *s, int index)
+{
+    // return a copy
+    return build_return_string(s);
+}
+
+// Utf8 field
+typedef struct FieldWithUtf8
+{
+    char *pFirst;
+    int index;
+}FieldWithUtf8;
+
+//utf8 struct field
+LIBTEST_API void
+TestStructWithUtf8Field(struct FieldWithUtf8 fieldStruct)
+{
+    char *pszManagedutf8 = fieldStruct.pFirst;
+    int stringIndex = fieldStruct.index;
+    char *pszNative = 0;
+    size_t outLen = 0;
+
+    if (pszManagedutf8 == 0 || *pszManagedutf8 == 0)
+        return;
+
+    pszNative = (char*)utf8Strings[stringIndex];
+
+    outLen = strlen(pszNative);
+    // do byte by byte comparision
+    for (size_t i = 0; i < outLen; i++) 
+    {
+        if (pszNative[i] != pszManagedutf8[i]) 
+        {
+            printf("Native and managed string do not match.\n");
+           abort ();
+        }
+    }
+}
+
+typedef void (* Callback2)(char *text, int index);
+
+LIBTEST_API void
+Utf8DelegateAsParameter(Callback2 managedCallback)
+{
+    for (int i = 0; i < NSTRINGS; ++i) 
+    {
+        char *pszNative = 0;
+        pszNative = (char*)utf8Strings[i];
+        managedCallback(pszNative, i);
+    }
+}
+
+
+LIBTEST_API char*
+StringBuilderParameterReturn(int index)
+{
+    char *pszTextutf8 = (char*)utf8Strings[index];
+    size_t strLength = strlen(pszTextutf8);
+    char * ret = (char *)(marshal_alloc (sizeof(char)* (strLength + 1)));
+    memcpy(ret, pszTextutf8, strLength);
+    ret[strLength] = '\0';
+
+    return  ret;
+}
+
+LIBTEST_API int STDCALL
+mono_test_marshal_pointer_array (int *arr[])
+{
+       int i;
+
+       for (i = 0; i < 10; ++i) {
+               if (*arr [i] != -1)
+                       return 1;
+       }
+       return 0;
+}
diff --git a/mono/tests/namedmutex-destroy-race.cs b/mono/tests/namedmutex-destroy-race.cs
new file mode 100644 (file)
index 0000000..265f146
--- /dev/null
@@ -0,0 +1,45 @@
+
+/* test for https://bugzilla.xamarin.com/show_bug.cgi?id=41914 */
+
+using System;
+using System.Threading;
+
+namespace Crasher
+{
+       class Program
+       {
+               public static void Main (string[] args)
+               {
+                       Thread[] threads = new Thread[100];
+
+                       DateTime start = DateTime.Now;
+
+                       for (int i = 0; i < threads.Length; ++i) {
+                               threads [i] = new Thread (() => {
+                                       var rnd = new Random();
+                                       do {
+                                               using (var mutex = new Mutex(false, "Global\\TEST")) {
+                                                       var owner = false;
+                                                       try {
+                                                               owner = mutex.WaitOne(TimeSpan.FromMinutes(1));
+                                                       } finally {
+                                                               if (owner)
+                                                                       mutex.ReleaseMutex();
+                                                       }
+                                               }
+                                               Thread.Sleep(rnd.Next(100, 1000));
+                                       } while ((DateTime.Now - start) < TimeSpan.FromSeconds (30));
+                               });
+                       }
+
+                       for (int i = 0; i < threads.Length; ++i)
+                               threads [i].Start ();
+
+                       for (int i = 0; i < threads.Length; ++i)
+                               threads [i].Join ();
+               }
+
+               private static void Crasher(){
+               }
+       }
+}
\ No newline at end of file
diff --git a/mono/tests/pinvoke-utf8.cs b/mono/tests/pinvoke-utf8.cs
new file mode 100644 (file)
index 0000000..fd58ad4
--- /dev/null
@@ -0,0 +1,263 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Runtime.InteropServices;
+using System.Text;
+using System.Collections.Generic;
+
+
+// UTF8 
+class UTF8StringTests
+{
+       [DllImport("libtest", CallingConvention = CallingConvention.Cdecl)]
+       [return: MarshalAs(UnmanagedType.LPUTF8Str)]
+       public static extern string StringParameterInOut([In, Out][MarshalAs(UnmanagedType.LPUTF8Str)]string s, int index);
+       public static bool TestInOutStringParameter(string orgString, int index)
+       {
+               string passedString = orgString;
+               string expectedNativeString = passedString;
+               
+               string nativeString = StringParameterInOut(passedString, index);
+               if (!(nativeString == expectedNativeString))
+               {
+                       Console.WriteLine("StringParameterInOut: nativeString != expecedNativeString ");
+                       return false;
+               }
+               return true;
+       }
+
+       [DllImport("libtest", CallingConvention = CallingConvention.Cdecl)]
+       [return: MarshalAs(UnmanagedType.LPUTF8Str)]
+       public static extern string StringParameterOut([Out][MarshalAs(UnmanagedType.LPUTF8Str)]string s, int index);
+       public static bool TestOutStringParameter(string orgString, int index)
+       {
+               string passedString = orgString;
+               string expecedNativeString = passedString;
+               string nativeString = StringParameterInOut(passedString, index);
+               if (!(nativeString == expecedNativeString))
+               {
+                       Console.WriteLine("StringParameterInOut: nativeString != expecedNativeString ");
+                       return false;
+               }
+               return true;
+       }
+
+       [DllImport("libtest", CallingConvention = CallingConvention.Cdecl)]
+       public static extern void StringParameterRefOut([MarshalAs(UnmanagedType.LPUTF8Str)]out string s, int index);
+       public static bool TestStringPassByOut(string orgString, int index)
+       {
+               // out string 
+               string expectedNative = string.Empty;
+               StringParameterRefOut(out expectedNative, index);
+               if (orgString != expectedNative)
+               {
+                       Console.WriteLine ("TestStringPassByOut : expectedNative != outString");
+                       return false;
+               }
+               return true;
+       }
+
+       [DllImport("libtest", CallingConvention = CallingConvention.Cdecl)]
+       public static extern void StringParameterRef([MarshalAs(UnmanagedType.LPUTF8Str)]ref string s, int index);
+       public static bool TestStringPassByRef(string orgString, int index)
+       {
+               string orgCopy = new string(orgString.ToCharArray());
+               StringParameterRef(ref orgString, index);
+               if (orgString != orgCopy)
+               {
+                       Console.WriteLine("TestStringPassByOut : string mismatch");
+                       return false;
+               }
+               return true;
+       }
+
+       public static bool EmptyStringTest()
+       {
+               StringParameterInOut(string.Empty, 0);
+               StringParameterOut(string.Empty, 0);
+               return true;
+       }
+}
+
+// UTF8 stringbuilder
+class UTF8StringBuilderTests
+{
+       [DllImport("libtest", CallingConvention = CallingConvention.Cdecl)]
+       public static extern void StringBuilderParameterInOut([In,Out][MarshalAs(UnmanagedType.LPUTF8Str)]StringBuilder s, int index);
+       public static bool TestInOutStringBuilderParameter(string expectedString, int index)
+       {
+               StringBuilder nativeStrBuilder = new StringBuilder(expectedString);
+               
+               StringBuilderParameterInOut(nativeStrBuilder, index);
+               
+               if (!nativeStrBuilder.ToString().Equals(expectedString))
+               {
+                       Console.WriteLine($"TestInOutStringBuilderParameter: nativeString != expecedNativeString index={index} got={nativeStrBuilder} and expected={expectedString} ");
+                       return false;
+               }
+               return true;
+       }
+       
+       [DllImport("libtest", CallingConvention = CallingConvention.Cdecl)]
+       public static extern void StringBuilderParameterOut([Out][MarshalAs(UnmanagedType.LPUTF8Str)]StringBuilder s, int index);
+       public static bool TestOutStringBuilderParameter(string expectedString, int index)
+       {
+               // string builder capacity
+               StringBuilder nativeStringBuilder = new StringBuilder(expectedString.Length);
+               
+               StringBuilderParameterOut(nativeStringBuilder, index);
+               
+               if (!nativeStringBuilder.ToString().Equals(expectedString))
+               {
+                       Console.WriteLine("TestOutStringBuilderParameter: string != expecedString ");
+                       return false;
+               }
+               return true;
+       }
+       
+
+       [DllImport("libtest", CallingConvention = CallingConvention.Cdecl)]
+       [return: MarshalAs(UnmanagedType.LPUTF8Str,SizeConst = 512)]
+       public static extern StringBuilder StringBuilderParameterReturn(int index);
+       public static bool TestReturnStringBuilder(string expectedReturn, int index)
+       {
+               StringBuilder nativeString = StringBuilderParameterReturn(index);
+               if (!expectedReturn.Equals(nativeString.ToString()))
+               {
+                       Console.WriteLine(string.Format( "TestReturnStringBuilder: nativeString {0} != expecedNativeString {1}",nativeString.ToString(),expectedReturn) );
+                       return false;
+               }
+               return true;
+       }
+}
+
+// UTF8 string as struct field
+class UTF8StructMarshalling
+{
+       public struct Utf8Struct
+       {
+               [MarshalAs(UnmanagedType.LPUTF8Str)]
+               public string FirstName;
+               public int index;
+       }
+
+       [DllImport("libtest", CallingConvention = CallingConvention.Cdecl)]
+       public static extern void TestStructWithUtf8Field(Utf8Struct utfStruct);
+       public static bool  TestUTF8StructMarshalling(string[] utf8Strings)
+       {
+               Utf8Struct utf8Struct = new Utf8Struct();
+               for (int i = 0; i < utf8Strings.Length; i++)
+               {
+                       utf8Struct.FirstName = utf8Strings[i];
+                       utf8Struct.index = i;
+                       TestStructWithUtf8Field(utf8Struct);
+               }
+               return true;
+       }
+}
+
+// UTF8 string as delegate parameter
+class UTF8DelegateMarshalling
+{
+       [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+       public delegate void DelegateUTF8Parameter([MarshalAs(UnmanagedType.LPUTF8Str)]string utf8String, int index);
+
+       [DllImport("libtest", CallingConvention = CallingConvention.Cdecl)]
+       public static extern void Utf8DelegateAsParameter(DelegateUTF8Parameter param);
+       
+       static bool failed;
+       public static bool TestUTF8DelegateMarshalling()
+       {
+               failed = false;
+               Utf8DelegateAsParameter(new DelegateUTF8Parameter(Utf8StringCallback));
+               
+               return !failed;
+       }
+       
+       public static void Utf8StringCallback(string nativeString, int index)
+       {
+               if (string.CompareOrdinal(nativeString, Test.utf8Strings[index]) != 0)
+               {
+                       Console.WriteLine("Utf8StringCallback string do not match");
+                       failed = true;
+               }
+       }
+}
+
+class Test
+{
+       //test strings
+       public static string[] utf8Strings = {
+               "Managed",
+               "Sîne klâwen durh die wolken sint geslagen" ,
+               "काचं शक्नोम्यत्तुम् । नोपहिनस्ति माम्",
+               "我能吞下玻璃而不伤身体",
+               "ღმერთსი შემვედრე,შემვედრე, ნუთუ კვლა დამხსნას შემვედრე,სოფლისა შემვედრე, შემვედრე,შემვედრე,შემვედრე,შრომასა, ცეცხლს, წყალსა და მიწასა, ჰაერთა თანა მრომასა; მომცნეს ფრთენი და აღვფრინდე, მივჰხვდე მას ჩემსა ნდომასა, დღისით და ღამით ვჰხედვიდე მზისა ელვათა კრთომაასაშემვედრე,შემვედრე,",
+               "Τη γλώσσα μου έδωσαν ελληνική",
+               null,
+       };
+       
+       public static int Main(string[] args)
+       {
+               // Test string as [In,Out] parameter
+               for (int i = 0; i < utf8Strings.Length; i++)
+                       if (!UTF8StringTests.TestInOutStringParameter(utf8Strings[i], i))
+                               return i+1;
+               
+               // Test string as [Out] parameter
+               for (int i = 0; i < utf8Strings.Length; i++)
+                       if (!UTF8StringTests.TestOutStringParameter(utf8Strings[i], i))
+                               return i+100;
+               
+               for (int i = 0; i < utf8Strings.Length - 1; i++)
+                       if (!UTF8StringTests.TestStringPassByOut(utf8Strings[i], i))
+                               return i+200;
+               
+               for (int i = 0; i < utf8Strings.Length - 1; i++)
+                       if (!UTF8StringTests.TestStringPassByRef(utf8Strings[i], i))
+                               return i+300;
+               
+               
+               // Test StringBuilder as [In,Out] parameter
+               for (int i = 0; i < utf8Strings.Length - 1; i++)
+                       if (!UTF8StringBuilderTests.TestInOutStringBuilderParameter(utf8Strings[i], i))
+                               return i+400;
+               
+#if NOT_YET
+               // This requires support for [Out] in StringBuilder
+               
+               // Test StringBuilder as [Out] parameter
+               for (int i = 0; i < utf8Strings.Length - 1; i++){
+                       if (!UTF8StringBuilderTests.TestOutStringBuilderParameter(utf8Strings[i], i))
+                               return i+500;
+               }
+
+#endif
+       
+               // utf8 string as struct fields
+               if (!UTF8StructMarshalling.TestUTF8StructMarshalling(utf8Strings))
+                       return 600;
+
+               // delegate
+               try {
+                       UTF8DelegateMarshalling.TestUTF8DelegateMarshalling();
+               } catch (ExecutionEngineException){
+                       // Known issue on AOT - we do not AOT this yet.
+               }
+
+#if NOT_YET
+               // This requires special support for StringBuilder return values
+               // Test StringBuilder as return value
+               for (int i = 0; i < utf8Strings.Length - 1; i++)
+                       if (!UTF8StringBuilderTests.TestReturnStringBuilder(utf8Strings[i], i))
+                               return 700+i;
+#endif
+               // String.Empty tests
+               if (!UTF8StringTests.EmptyStringTest())
+                       return 800;
+
+               return 0;
+       }
+}
index 9b80f969d65eeebb526c3f90e46a2a32f90d6f95..f9ecf68a4027a95b9da5b0681024afd47b435f97 100644 (file)
@@ -9,7 +9,7 @@ using System.Runtime.InteropServices;
 using System.Runtime.CompilerServices;
 using System.Reflection.Emit;
 
-public class Tests {
+public unsafe class Tests {
 
        public int int_field;
 
@@ -1904,5 +1904,40 @@ public class Tests {
                else
                        return 0;
        }
+
+    [StructLayout(LayoutKind.Explicit, Size = 12)]
+       public struct FixedArrayStruct {
+        [FieldOffset(0)]
+        public fixed int array[3];
+       }
+
+       [DllImport ("libtest", EntryPoint="mono_test_marshal_fixed_array")]
+       public static extern int mono_test_marshal_fixed_array (FixedArrayStruct s);
+
+       public static unsafe int test_6_fixed_array_struct () {
+               var s = new FixedArrayStruct ();
+               s.array [0] = 1;
+               s.array [1] = 2;
+               s.array [2] = 3;
+
+               return mono_test_marshal_fixed_array (s);
+       }
+
+       [DllImport ("libtest", EntryPoint="mono_test_marshal_pointer_array")]
+       public static extern int mono_test_marshal_pointer_array (int*[] arr);
+
+       public static unsafe int test_0_pointer_array () {
+               var arr = new int [10];
+               for (int i = 0; i < arr.Length; i++)
+                       arr [i] = -1;
+               var arr2 = new int*[10];
+               for (int i = 0; i < arr2.Length; i++) {
+                       GCHandle handle = GCHandle.Alloc(arr[i], GCHandleType.Pinned);
+                       fixed (int *ptr = &arr[i]) {
+                               arr2[i] = ptr;
+                       }
+               }
+               return mono_test_marshal_pointer_array (arr2);
+       }
 }
 
index 8d5cfb619f0657d5ab751afc0f509ba163b296f9..075ef08bc48c809174db8e1e6d87f594713fa550 100644 (file)
@@ -746,6 +746,21 @@ public class Tests {
                return mono_test_marshal_array_delegate1 (null, 0, new ArrayDelegate1 (array_delegate2));
        }
 
+       public delegate int ArrayDelegateBlittable (int i, string j,
+                                                                               [In, MarshalAs(UnmanagedType.LPArray,
+                                                                                                          ArraySubType=UnmanagedType.LPStr, SizeParamIndex=0)] int[] arr);
+
+       [DllImport ("libtest", EntryPoint="mono_test_marshal_array_delegate")]
+       public static extern int mono_test_marshal_array_delegate1 (string[] arr, int len, ArrayDelegateBlittable d);
+
+       public static int array_delegate_null_blittable (int i, string j, int[] arr) {
+               return (arr == null) ? 0 : 1;
+       }
+
+       public static int test_0_marshal_array_delegate_null_blittable () {
+               return mono_test_marshal_array_delegate1 (null, 0, new ArrayDelegateBlittable (array_delegate_null_blittable));
+       }
+
        public delegate int ArrayDelegate3 (int i, 
                                                                                string j, 
                                                                                [In, MarshalAs(UnmanagedType.LPArray, 
diff --git a/mono/tests/reference-loader.cs b/mono/tests/reference-loader.cs
new file mode 100644 (file)
index 0000000..a66d3c5
--- /dev/null
@@ -0,0 +1,110 @@
+//
+// reference-loader.cs:
+//
+//  Test for reference assembly loading
+
+using System;
+using System.IO;
+using System.Reflection;
+
+public class Tests {
+       public static int Main (string[] args)
+       {
+               return TestDriver.RunTests (typeof (Tests), args);
+       }
+
+       public static int test_0_loadFrom_reference ()
+       {
+               // Check that loading a reference assembly by filename for execution is an error
+               try {
+                       var a = Assembly.LoadFrom ("./TestingReferenceAssembly.dll");
+               } catch (BadImageFormatException exn) {
+                       // .NET Framework 4.6.2 throws BIFE here.
+                       return 0;
+               }
+               return 1;
+       }
+
+       public static int test_0_load_reference ()
+       {
+               // Check that loading a reference assembly for execution is an error
+               try {
+                       var an = new AssemblyName ("TestingReferenceAssembly");
+                       var a = Assembly.Load (an);
+               } catch (FileNotFoundException exn) {
+                       return 0;
+               } catch (BadImageFormatException exn) {
+                       // .NET Framework 4.6.2 throws BIFE here.
+                       return 0;
+               }
+               return 1;
+       }
+
+       public static int test_0_reflection_load_reference ()
+       {
+               // Check that reflection-only loading a reference assembly is okay
+               var an = new AssemblyName ("TestingReferenceAssembly");
+               var a = Assembly.ReflectionOnlyLoad (an.FullName);
+               var t = a.GetType ("X");
+               var f = t.GetField ("Y");
+               if (f.FieldType.Equals (typeof (Int32)))
+                       return 0;
+               return 1;
+       }
+
+       public static int test_0_load_reference_asm_via_reference ()
+       {
+               // Check that loading an assembly that references a reference assembly doesn't succeed.
+               var an = new AssemblyName ("TestingReferenceReferenceAssembly");
+               try {
+                       var a = Assembly.Load (an);
+                       var t = a.GetType ("Z");
+               } catch (FileNotFoundException){
+                       return 0;
+               }
+               return 1;
+       }
+
+       public static int test_0_reflection_load_reference_asm_via_reference ()
+       {
+               // Check that reflection-only loading an assembly that
+               // references a reference assembly is okay.
+               var an = new AssemblyName ("TestingReferenceReferenceAssembly");
+               var a = Assembly.ReflectionOnlyLoad (an.FullName);
+               var t = a.GetType ("Z");
+               var f = t.GetField ("Y");
+               if (f.FieldType.Equals (typeof (Int32)))
+                       return 0;
+               return 1;
+       }
+
+
+       public static int test_0_load_reference_bytes ()
+       {
+               // Check that loading a reference assembly from a byte array for execution is an error
+               byte[] bs = File.ReadAllBytes ("./TestingReferenceAssembly.dll");
+               try {
+                       var a = Assembly.Load (bs);
+               } catch (BadImageFormatException) {
+                       return 0;
+               } catch (FileNotFoundException exn) {
+                       Console.Error.WriteLine ("incorrect exn was {0}", exn);
+                       return 2;
+               }
+               return 1;
+       }
+
+       public static int test_0_reflection_load_reference_bytes ()
+       {
+               // Check that loading a reference assembly from a byte
+               // array for reflection only is okay.
+               byte[] bs = File.ReadAllBytes ("./TestingReferenceAssembly.dll");
+               var a = Assembly.ReflectionOnlyLoad (bs);
+               var t = a.GetType ("X");
+               var f = t.GetField ("Y");
+               if (f.FieldType.Equals (typeof (Int32)))
+                       return 0;
+               return 1;
+       }
+
+}
index 68fc0a5d0603301897fe4cbad95de05495156d25..7c8dbc087311677c159a0f3b86b57f8e6d62ef6f 100644 (file)
@@ -111,13 +111,29 @@ class Driver {
                var heads = new Bridge [FAN_OUT];
                for (int i = 0; i < FAN_OUT; ++i)
                        heads [i] = new Bridge ();
-               var multiplexer = new Bridge [FAN_OUT];
-               for (int i = 0; i < FAN_OUT; ++i)
-               {
-                       heads [i].Links.Add (multiplexer);
-                       multiplexer [i] = new Bridge ();
+
+               // We make five identical multiplexers to verify Tarjan-bridge can merge them together correctly.
+               var MULTIPLEXER_COUNT = 5;
+               Bridge[] multiplexer0 = null;
+               for(int m = 0; m < MULTIPLEXER_COUNT; m++) {
+                       var multiplexer = new Bridge [FAN_OUT];
+                       if (m == 0) {
+                               multiplexer0 = multiplexer;
+                               for (int i = 0; i < FAN_OUT; ++i)
+                               {
+                                       heads [i].Links.Add (multiplexer);
+                                       multiplexer [i] = new Bridge ();
+                               }
+                       } else {
+                               for (int i = 0; i < FAN_OUT; ++i)
+                               {
+                                       heads [i].Links.Add (multiplexer);
+                                       multiplexer [i] = multiplexer0 [i];
+                               }
+                       }
                }
-               Console.WriteLine ("-double fan done-");
+
+               Console.WriteLine ("-double fan x5 done-");
        }
 
        /*
diff --git a/mono/tests/sgen-new-threads-collect.cs b/mono/tests/sgen-new-threads-collect.cs
new file mode 100644 (file)
index 0000000..5deee6b
--- /dev/null
@@ -0,0 +1,51 @@
+
+using System;
+using System.Collections.Concurrent;
+using System.Threading;
+
+class Driver
+{
+       public static void Main ()
+       {
+               BlockingCollection<Thread> threads = new BlockingCollection<Thread> (new ConcurrentQueue<Thread> (), 128);
+
+               bool finished = false;
+
+               Thread gcThread = new Thread (() => {
+                       while (!finished) {
+                               GC.Collect ();
+                               Thread.Yield ();
+                       }
+               });
+
+               Thread joinThread = new Thread (() => {
+                       for (int i = 0; ; ++i) {
+                               Thread t = threads.Take ();
+                               if (t == null)
+                                       break;
+                               t.Join ();
+                               if ((i + 1) % (50) == 0)
+                                       Console.Write (".");
+                               if ((i + 1) % (50 * 50) == 0)
+                                       Console.WriteLine ();
+                       }
+               });
+
+               gcThread.Start ();
+               joinThread.Start ();
+
+               for (int i = 0; i < 10 * 1000; ++i) {
+                       Thread t = new Thread (() => { Thread.Yield (); });
+                       t.Start ();
+
+                       threads.Add (t);
+               }
+
+               threads.Add (null);
+
+               joinThread.Join ();
+
+               finished = true;
+               gcThread.Join ();
+       }
+}
\ No newline at end of file
diff --git a/mono/tests/test-multi-netmodule-1-netmodule.cs b/mono/tests/test-multi-netmodule-1-netmodule.cs
new file mode 100644 (file)
index 0000000..2abdc39
--- /dev/null
@@ -0,0 +1,4 @@
+// Compiler options: -t:module
+
+public class M1 {
+}
diff --git a/mono/tests/test-multi-netmodule-2-dll1.cs b/mono/tests/test-multi-netmodule-2-dll1.cs
new file mode 100644 (file)
index 0000000..018db84
--- /dev/null
@@ -0,0 +1,5 @@
+// Compiler options: -addmodule:test-multi-netmodule-1-netmodule.netmodule -t:library
+
+public class M2 {
+       public M1 m1 = new M1();
+}
diff --git a/mono/tests/test-multi-netmodule-3-dll2.cs b/mono/tests/test-multi-netmodule-3-dll2.cs
new file mode 100644 (file)
index 0000000..4229b80
--- /dev/null
@@ -0,0 +1,5 @@
+// Compiler options: -addmodule:test-multi-netmodule-1-netmodule.netmodule -t:library
+
+public class M3 {
+       public M1 m1 = new M1();
+}
diff --git a/mono/tests/test-multi-netmodule-4-exe.cs b/mono/tests/test-multi-netmodule-4-exe.cs
new file mode 100644 (file)
index 0000000..03cd242
--- /dev/null
@@ -0,0 +1,28 @@
+// Compiler options: -r:test-multi-netmodule-2-dll1.dll
+
+using System;
+using System.Reflection;
+
+public class M4 {
+       public static int Main () {
+               M2 m2 = new M2();
+
+               // Expecting failure
+               try {
+                       var DLL = Assembly.LoadFile(@"test-multi-netmodule-3-dll2.dll");
+               var m3Type = DLL.GetType("M3");
+               var m3 = Activator.CreateInstance(m3Type);
+               var m3m1Field = m3Type.GetField("m1");
+
+               Console.WriteLine("M3    assembly:" + m3Type.Assembly);
+                       Console.WriteLine("M3.M1 assembly:" + m3m1Field.DeclaringType.Assembly);
+        } catch (System.TypeLoadException) {
+               return 0;
+        }
+
+               Console.WriteLine("M2    assembly:" + typeof (M2).Assembly);
+               Console.WriteLine("M2.M1 assembly:" + m2.m1.GetType().Assembly);
+
+               return 1;
+       }
+}
diff --git a/mono/tests/thread-native-exit.cs b/mono/tests/thread-native-exit.cs
new file mode 100644 (file)
index 0000000..e112be0
--- /dev/null
@@ -0,0 +1,71 @@
+
+using System;
+using System.Runtime.InteropServices;
+using System.Threading;
+
+class Driver
+{
+       [DllImport ("libc")]
+       extern static void pthread_exit (IntPtr value);
+
+       [DllImport ("kernel32")]
+       extern static void ExitThread (IntPtr value);
+
+       static Thread GetThread1 ()
+       {
+               return new Thread (() => {
+                       /* Exit bypassing completely the runtime */
+                       if (Environment.OSVersion.Platform == PlatformID.Unix || Environment.OSVersion.Platform == PlatformID.MacOSX)
+                           pthread_exit (IntPtr.Zero);
+                       else
+                           ExitThread (IntPtr.Zero);
+               });
+       }
+
+       static Thread GetThread2 ()
+       {
+               return new Thread (() => {
+                       /* Exit without returning from the ThreadStart delegate */
+                       Thread.CurrentThread.Abort ();
+               });
+       }
+
+       static Thread GetThread3 ()
+       {
+               return new Thread (() => {
+                       /* Exit by returning from the ThreadStart delegate */
+                       return;
+               });
+       }
+
+       static Thread[] CreateThreads ()
+       {
+               return new Thread [] {
+                       GetThread1 (),
+                       GetThread2 (),
+                       GetThread3 (),
+               };
+       }
+
+       public static void Main ()
+       {
+               Thread[] threads;
+
+               {
+                       threads = CreateThreads ();
+
+                       for (int i = 0; i < threads.Length; ++i)
+                               threads [i].Start ();
+
+                       for (int i = 0; i < threads.Length; ++i)
+                               threads [i].Join ();
+               }
+
+               {
+                       threads = CreateThreads ();
+
+                       for (int i = 0; i < threads.Length; ++i)
+                               threads [i].Start ();
+               }
+       }
+}
\ No newline at end of file
diff --git a/mono/tests/thread-suspend-selfsuspended.cs b/mono/tests/thread-suspend-selfsuspended.cs
new file mode 100644 (file)
index 0000000..c9681df
--- /dev/null
@@ -0,0 +1,42 @@
+
+using System;
+using System.Threading;
+
+class Driver
+{
+       public static void Main ()
+       {
+               bool finished = false;
+
+               Thread t1 = Thread.CurrentThread;
+
+               Thread t2 = new Thread (() => {
+                       while (!finished) {
+                               GC.Collect ();
+
+                               try {
+                                       t1.Resume ();
+                               } catch (ThreadStateException) {
+                               }
+
+                               Thread.Yield ();
+                       }
+               });
+
+               t2.Start ();
+
+               Thread.Sleep (10);
+
+               for (int i = 0; i < 50 * 40 * 20; ++i) {
+                       Thread.CurrentThread.Suspend ();
+                       if ((i + 1) % (50) == 0)
+                               Console.Write (".");
+                       if ((i + 1) % (50 * 40) == 0)
+                               Console.WriteLine ();
+               }
+
+               finished = true;
+
+               t2.Join ();
+       }
+}
diff --git a/mono/tests/thread-suspend-suspended.cs b/mono/tests/thread-suspend-suspended.cs
new file mode 100644 (file)
index 0000000..994042b
--- /dev/null
@@ -0,0 +1,43 @@
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Threading;
+
+class Driver
+{
+       public static void Main ()
+       {
+               bool finished = false;
+
+               Thread t1 = new Thread (() => {
+                       while (!finished) {}
+               });
+
+               Thread t2 = new Thread (() => {
+                       while (!finished) {
+                               GC.Collect ();
+                               Thread.Yield ();
+                       }
+               });
+
+               t1.Start ();
+               t2.Start ();
+
+               Thread.Sleep (10);
+
+               for (int i = 0; i < 50 * 40 * 20; ++i) {
+                       t1.Suspend ();
+                       Thread.Yield ();
+                       t1.Resume ();
+                       if ((i + 1) % (50) == 0)
+                               Console.Write (".");
+                       if ((i + 1) % (50 * 40) == 0)
+                               Console.WriteLine ();
+               }
+
+               finished = true;
+
+               t1.Join ();
+               t2.Join ();
+       }
+}
index 32d859c50d56cee18c92a9518db37a9c762a0597..712e2efa3816674170acfe4a2ca771dcb33d502e 100644 (file)
@@ -11,6 +11,7 @@
 #include "utils/mono-threads.h"
 #include "utils/mono-conc-hashtable.h"
 #include "utils/checked-build.h"
+#include "metadata/w32handle.h"
 
 #include <stdlib.h>
 #include <string.h>
@@ -335,6 +336,9 @@ main (void)
        memset (&ticallbacks, 0, sizeof (ticallbacks));
        ticallbacks.thread_state_init = thread_state_init;
        mono_threads_runtime_init (&ticallbacks);
+#ifndef HOST_WIN32
+       mono_w32handle_init ();
+#endif
 
        mono_thread_info_attach ((gpointer)&cb);
 
index 3841581e0bb02fd61fe9f407dbcbef8891a0cea9..a5e01ebe09ec6e5f913e1ad936c822596d39ecde 100644 (file)
@@ -74,11 +74,11 @@ worker (void *arg)
                        break;
                case STATE_OUT:
                        if (InterlockedCompareExchange (&nodes [i].state, STATE_BUSY, STATE_OUT) == STATE_OUT) {
-                               result = mono_lls_find (&lls, hp, i, HAZARD_FREE_SAFE_CTX);
+                               result = mono_lls_find (&lls, hp, i);
                                assert (!result);
                                mono_hazard_pointer_clear_all (hp, -1);
 
-                               result = mono_lls_insert (&lls, hp, &nodes [i].node, HAZARD_FREE_SAFE_CTX);
+                               result = mono_lls_insert (&lls, hp, &nodes [i].node);
                                mono_hazard_pointer_clear_all (hp, -1);
 
                                assert (nodes [i].state == STATE_BUSY);
@@ -89,12 +89,12 @@ worker (void *arg)
                        break;
                case STATE_IN:
                        if (InterlockedCompareExchange (&nodes [i].state, STATE_BUSY, STATE_IN) == STATE_IN) {
-                               result = mono_lls_find (&lls, hp, i, HAZARD_FREE_SAFE_CTX);
+                               result = mono_lls_find (&lls, hp, i);
                                assert (result);
                                assert (mono_hazard_pointer_get_val (hp, 1) == &nodes [i].node);
                                mono_hazard_pointer_clear_all (hp, -1);
 
-                               result = mono_lls_remove (&lls, hp, &nodes [i].node, HAZARD_FREE_SAFE_CTX);
+                               result = mono_lls_remove (&lls, hp, &nodes [i].node);
                                mono_hazard_pointer_clear_all (hp, -1);
 
                                ++thread_data->num_removes;
@@ -126,7 +126,7 @@ main (int argc, char *argv [])
 
        mono_threads_init (&thread_callbacks, 0);
 
-       mono_lls_init (&lls, free_node, HAZARD_FREE_NO_LOCK);
+       mono_lls_init (&lls, free_node);
 
        for (i = 0; i < N; ++i) {
                nodes [i].node.key = i;
index 7cc6b627445a683c4af6a12971246b36ab28864a..ca539fb398083b13ad5fb45fa3c7503e1ff4798c 100644 (file)
@@ -72,7 +72,13 @@ compare_sorts (void *base, size_t nel, size_t width, int (*compar) (const void*,
        qsort (b1, nel, width, compar);
        sgen_qsort (b2, nel, width, compar);
 
-       assert (!memcmp (b1, b2, len));
+       /* We can't assert that qsort and sgen_qsort produce the same results
+        * because qsort is not guaranteed to be stable, so they will tend to differ
+        * in adjacent equal elements. Instead, we assert that the array is sorted
+        * according to the comparator.
+        */
+       for (size_t i = 0; i < nel - 1; ++i)
+               assert (compar ((char *)b2 + i * width, (char *)b2 + (i + 1) * width) <= 0);
 
        free (b1);
        free (b2);
@@ -81,7 +87,8 @@ compare_sorts (void *base, size_t nel, size_t width, int (*compar) (const void*,
 static void
 compare_sorts2 (void *base, size_t nel)
 {
-       size_t len = nel * sizeof (teststruct_t*);
+       size_t width = sizeof (teststruct_t*);
+       size_t len = nel * width;
        void *b1 = malloc (len);
        void *b2 = malloc (len);
 
@@ -91,7 +98,8 @@ compare_sorts2 (void *base, size_t nel)
        qsort (b1, nel, sizeof (teststruct_t*), compare_teststructs2);
        qsort_test_struct ((teststruct_t **)b2, nel);
 
-       assert (!memcmp (b1, b2, len));
+       for (size_t i = 0; i < nel - 1; ++i)
+               assert (compare_teststructs2 ((char *)b2 + i * width, (char *)b2 + (i + 1) * width) <= 0);
 
        free (b1);
        free (b2);
index 2e873cde79844c8793f096b5913a5cc854e28103..35f218a8d0ac5cd4d0bd0ff650f69d1468ee6f14 100644 (file)
@@ -11,7 +11,20 @@ mono-dtrace.h: $(top_srcdir)/data/mono.d
 
 endif
 
+if HOST_WIN32
+win32_sources = \
+       os-event-win32.c
+
+platform_sources = $(win32_sources)
+else
+unix_sources = \
+       os-event-unix.c
+
+platform_sources = $(unix_sources)
+endif
+
 monoutils_sources = \
+       $(platform_sources)     \
        mono-md5.c              \
        mono-sha1.c             \
        mono-logger.c           \
@@ -27,9 +40,12 @@ monoutils_sources = \
        mono-dl-darwin.c        \
        mono-dl-posix.c         \
        mono-dl.h               \
+       mono-dl-windows-internals.h     \
        mono-log-windows.c      \
        mono-log-common.c       \
        mono-log-posix.c        \
+       mono-log-android.c \
+       mono-log-darwin.c \
        mono-internal-hash.c    \
        mono-internal-hash.h    \
        mono-io-portability.c   \
@@ -38,8 +54,10 @@ monoutils_sources = \
        mono-filemap.c          \
        mono-math.c             \
        mono-mmap.c             \
+       mono-mmap-windows.c             \
        mono-mmap.h             \
        mono-mmap-internals.h   \
+       mono-mmap-windows-internals.h   \
        mono-os-mutex.h         \
        mono-coop-mutex.h               \
        mono-once.h             \
@@ -47,7 +65,9 @@ monoutils_sources = \
        mono-networkinterfaces.c                \
        mono-networkinterfaces.h                \
        mono-proclib.c          \
+       mono-proclib-windows.c          \
        mono-proclib.h          \
+       mono-proclib-windows-internals.h                \
        mono-publib.c           \
        mono-string.h           \
        mono-time.c             \
@@ -106,7 +126,6 @@ monoutils_sources = \
        mono-threads-state-machine.c    \
        mono-threads-posix.c    \
        mono-threads-posix-signals.c    \
-       mono-threads-posix-signals.h    \
        mono-threads-mach.c     \
        mono-threads-mach-helper.c      \
        mono-threads-windows.c  \
@@ -116,12 +135,10 @@ monoutils_sources = \
        mono-threads-openbsd.c  \
        mono-threads-android.c  \
        mono-threads.h  \
+       mono-threads-debug.h    \
        mono-threads-api.h      \
        mono-threads-coop.c     \
        mono-threads-coop.h     \
-       mono-threads-mach-abort-syscall.c       \
-       mono-threads-posix-abort-syscall.c      \
-       mono-threads-windows-abort-syscall.c    \
        mono-tls.h      \
        mono-tls.c      \
        linux_magic.h   \
@@ -130,6 +147,7 @@ monoutils_sources = \
        atomic.c        \
        mono-hwcap.h    \
        mono-hwcap.c    \
+       mono-hwcap-vars.h       \
        bsearch.h       \
        bsearch.c       \
        mono-signal-handler.h   \
@@ -146,15 +164,16 @@ monoutils_sources = \
        networking-windows.c    \
        networking.h    \
        mono-rand.c     \
+       mono-rand-windows.c     \
        mono-rand.h \
+       mono-rand-windows-internals.h \
        memfuncs.c \
        memfuncs.h \
        parse.c \
        parse.h \
        checked-build.c \
        checked-build.h \
-       w32handle.c \
-       w32handle.h
+       os-event.h
 
 arch_sources = 
 
@@ -182,48 +201,56 @@ arch_sources += mach-support-unknown.c
 
 endif
 
+if !CROSS_COMPILE
+
 if X86
-arch_sources += mono-hwcap-x86.c mono-hwcap-x86.h
+arch_sources += mono-hwcap-x86.c
 endif
 
 if AMD64
-arch_sources += mono-hwcap-x86.c mono-hwcap-x86.h
+arch_sources += mono-hwcap-x86.c
 endif
 
 if ARM
-arch_sources += mono-hwcap-arm.c mono-hwcap-arm.h
+arch_sources += mono-hwcap-arm.c
 endif
 
 if ARM64
-arch_sources += mono-hwcap-arm64.c mono-hwcap-arm64.h
+arch_sources += mono-hwcap-arm64.c
 endif
 
 if MIPS
-arch_sources += mono-hwcap-mips.c mono-hwcap-mips.h
+arch_sources += mono-hwcap-mips.c
 endif
 
 if POWERPC
-arch_sources += mono-hwcap-ppc.c mono-hwcap-ppc.h
+arch_sources += mono-hwcap-ppc.c
 endif
 
 if POWERPC64
-arch_sources += mono-hwcap-ppc.c mono-hwcap-ppc.h
+arch_sources += mono-hwcap-ppc.c
 endif
 
 if SPARC
-arch_sources += mono-hwcap-sparc.c mono-hwcap-sparc.h
+arch_sources += mono-hwcap-sparc.c
 endif
 
 if SPARC64
-arch_sources += mono-hwcap-sparc.c mono-hwcap-sparc.h
+arch_sources += mono-hwcap-sparc.c
 endif
 
 if IA64
-arch_sources += mono-hwcap-ia64.c mono-hwcap-ia64.h
+arch_sources += mono-hwcap-ia64.c
 endif
 
 if S390X
-arch_sources += mono-hwcap-s390x.c mono-hwcap-s390x.h
+arch_sources += mono-hwcap-s390x.c
+endif
+
+else
+
+arch_sources += mono-hwcap-cross.c
+
 endif
 
 libmonoutils_la_SOURCES = $(monoutils_sources) $(arch_sources)
index 86afad502ffe27947c4bf7718bc49abbd4ded33c..543e8ce9b0cb2c7171035f965964887b9835bd42 100644 (file)
@@ -12,6 +12,7 @@
 #include <glib.h>
 
 #include <mono/utils/atomic.h>
+#include <mono/utils/mono-compiler.h>
 
 #if defined (WAPI_NO_ATOMIC_ASM) || defined (BROKEN_64BIT_ATOMICS_INTRINSIC)
 
@@ -581,6 +582,9 @@ InterlockedCompareExchange64(volatile gint64 *dest, gint64 exch, gint64 comp)
        return(old);
 }
 
+#endif
 #endif
 
+#if !defined (WAPI_NO_ATOMIC_ASM) && !defined (BROKEN_64BIT_ATOMICS_INTRINSIC) && !defined (NEED_64BIT_CMPXCHG_FALLBACK)
+MONO_EMPTY_SOURCE_FILE (atomic);
 #endif
index 4f5f010afd31bd61551347f754fe9f31639b0bae..dca6170a1a1e72cfe2f03cc77a5ce9a2895e1d6d 100755 (executable)
@@ -14,6 +14,7 @@
 
 #include "config.h"
 #include <glib.h>
+#include <mono/utils/mono-membar.h>
 
 /*
 The current Nexus 7 arm-v7a fails with:
@@ -29,7 +30,6 @@ Apple targets have historically being problematic, xcode 4.6 would miscompile th
 #define WIN32_LEAN_AND_MEAN
 #endif
 #include <windows.h>
-#include <mono/utils/mono-membar.h>
 
 /* mingw is missing InterlockedCompareExchange64 () from winbase.h */
 #if HAVE_DECL_INTERLOCKEDCOMPAREEXCHANGE64==0
@@ -180,30 +180,63 @@ static inline void InterlockedWrite16(volatile gint16 *dst, gint16 val)
 /* Prefer GCC atomic ops if the target supports it (see configure.ac). */
 #elif defined(USE_GCC_ATOMIC_OPS)
 
+/*
+ * As of this comment (August 2016), all current Clang versions get atomic
+ * intrinsics on ARM64 wrong. All GCC versions prior to 5.3.0 do, too. The bug
+ * is the same: The compiler developers thought that the acq + rel barriers
+ * that ARM64 load/store instructions can impose are sufficient to provide
+ * sequential consistency semantics. This is not the case:
+ *
+ *     http://lists.infradead.org/pipermail/linux-arm-kernel/2014-February/229588.html
+ *
+ * We work around this bug by inserting full barriers around each atomic
+ * intrinsic if we detect that we're built with a buggy compiler.
+ */
+
+#if defined (HOST_ARM64) && (defined (__clang__) || MONO_GNUC_VERSION < 50300)
+#define WRAP_ATOMIC_INTRINSIC(INTRIN) \
+       ({ \
+               mono_memory_barrier (); \
+               __typeof__ (INTRIN) atomic_ret__ = (INTRIN); \
+               mono_memory_barrier (); \
+               atomic_ret__; \
+       })
+
+#define gcc_sync_val_compare_and_swap(a, b, c) WRAP_ATOMIC_INTRINSIC (__sync_val_compare_and_swap (a, b, c))
+#define gcc_sync_add_and_fetch(a, b) WRAP_ATOMIC_INTRINSIC (__sync_add_and_fetch (a, b))
+#define gcc_sync_sub_and_fetch(a, b) WRAP_ATOMIC_INTRINSIC (__sync_sub_and_fetch (a, b))
+#define gcc_sync_fetch_and_add(a, b) WRAP_ATOMIC_INTRINSIC (__sync_fetch_and_add (a, b))
+#else
+#define gcc_sync_val_compare_and_swap(a, b, c) __sync_val_compare_and_swap (a, b, c)
+#define gcc_sync_add_and_fetch(a, b) __sync_add_and_fetch (a, b)
+#define gcc_sync_sub_and_fetch(a, b) __sync_sub_and_fetch (a, b)
+#define gcc_sync_fetch_and_add(a, b) __sync_fetch_and_add (a, b)
+#endif
+
 static inline gint32 InterlockedCompareExchange(volatile gint32 *dest,
                                                gint32 exch, gint32 comp)
 {
-       return __sync_val_compare_and_swap (dest, comp, exch);
+       return gcc_sync_val_compare_and_swap (dest, comp, exch);
 }
 
 static inline gpointer InterlockedCompareExchangePointer(volatile gpointer *dest, gpointer exch, gpointer comp)
 {
-       return __sync_val_compare_and_swap (dest, comp, exch);
+       return gcc_sync_val_compare_and_swap (dest, comp, exch);
 }
 
 static inline gint32 InterlockedAdd(volatile gint32 *dest, gint32 add)
 {
-       return __sync_add_and_fetch (dest, add);
+       return gcc_sync_add_and_fetch (dest, add);
 }
 
 static inline gint32 InterlockedIncrement(volatile gint32 *val)
 {
-       return __sync_add_and_fetch (val, 1);
+       return gcc_sync_add_and_fetch (val, 1);
 }
 
 static inline gint32 InterlockedDecrement(volatile gint32 *val)
 {
-       return __sync_sub_and_fetch (val, 1);
+       return gcc_sync_sub_and_fetch (val, 1);
 }
 
 static inline gint32 InterlockedExchange(volatile gint32 *val, gint32 new_val)
@@ -211,7 +244,7 @@ static inline gint32 InterlockedExchange(volatile gint32 *val, gint32 new_val)
        gint32 old_val;
        do {
                old_val = *val;
-       } while (__sync_val_compare_and_swap (val, old_val, new_val) != old_val);
+       } while (gcc_sync_val_compare_and_swap (val, old_val, new_val) != old_val);
        return old_val;
 }
 
@@ -221,30 +254,30 @@ static inline gpointer InterlockedExchangePointer(volatile gpointer *val,
        gpointer old_val;
        do {
                old_val = *val;
-       } while (__sync_val_compare_and_swap (val, old_val, new_val) != old_val);
+       } while (gcc_sync_val_compare_and_swap (val, old_val, new_val) != old_val);
        return old_val;
 }
 
 static inline gint32 InterlockedExchangeAdd(volatile gint32 *val, gint32 add)
 {
-       return __sync_fetch_and_add (val, add);
+       return gcc_sync_fetch_and_add (val, add);
 }
 
 static inline gint8 InterlockedRead8(volatile gint8 *src)
 {
        /* Kind of a hack, but GCC doesn't give us anything better, and it's
         * certainly not as bad as using a CAS loop. */
-       return __sync_fetch_and_add (src, 0);
+       return gcc_sync_fetch_and_add (src, 0);
 }
 
 static inline gint16 InterlockedRead16(volatile gint16 *src)
 {
-       return __sync_fetch_and_add (src, 0);
+       return gcc_sync_fetch_and_add (src, 0);
 }
 
 static inline gint32 InterlockedRead(volatile gint32 *src)
 {
-       return __sync_fetch_and_add (src, 0);
+       return gcc_sync_fetch_and_add (src, 0);
 }
 
 static inline void InterlockedWrite8(volatile gint8 *dst, gint8 val)
@@ -253,7 +286,7 @@ static inline void InterlockedWrite8(volatile gint8 *dst, gint8 val)
        gint8 old_val;
        do {
                old_val = *dst;
-       } while (__sync_val_compare_and_swap (dst, old_val, val) != old_val);
+       } while (gcc_sync_val_compare_and_swap (dst, old_val, val) != old_val);
 }
 
 static inline void InterlockedWrite16(volatile gint16 *dst, gint16 val)
@@ -261,7 +294,7 @@ static inline void InterlockedWrite16(volatile gint16 *dst, gint16 val)
        gint16 old_val;
        do {
                old_val = *dst;
-       } while (__sync_val_compare_and_swap (dst, old_val, val) != old_val);
+       } while (gcc_sync_val_compare_and_swap (dst, old_val, val) != old_val);
 }
 
 static inline void InterlockedWrite(volatile gint32 *dst, gint32 val)
@@ -270,7 +303,7 @@ static inline void InterlockedWrite(volatile gint32 *dst, gint32 val)
        gint32 old_val;
        do {
                old_val = *dst;
-       } while (__sync_val_compare_and_swap (dst, old_val, val) != old_val);
+       } while (gcc_sync_val_compare_and_swap (dst, old_val, val) != old_val);
 }
 
 #if defined (TARGET_OSX) || defined (__arm__) || (defined (__mips__) && !defined (__mips64)) || (defined (__powerpc__) && !defined (__powerpc64__)) || (defined (__sparc__) && !defined (__arch64__))
@@ -281,33 +314,33 @@ static inline void InterlockedWrite(volatile gint32 *dst, gint32 val)
 
 static inline gint64 InterlockedCompareExchange64(volatile gint64 *dest, gint64 exch, gint64 comp)
 {
-       return __sync_val_compare_and_swap (dest, comp, exch);
+       return gcc_sync_val_compare_and_swap (dest, comp, exch);
 }
 
 static inline gint64 InterlockedAdd64(volatile gint64 *dest, gint64 add)
 {
-       return __sync_add_and_fetch (dest, add);
+       return gcc_sync_add_and_fetch (dest, add);
 }
 
 static inline gint64 InterlockedIncrement64(volatile gint64 *val)
 {
-       return __sync_add_and_fetch (val, 1);
+       return gcc_sync_add_and_fetch (val, 1);
 }
 
 static inline gint64 InterlockedDecrement64(volatile gint64 *val)
 {
-       return __sync_sub_and_fetch (val, 1);
+       return gcc_sync_sub_and_fetch (val, 1);
 }
 
 static inline gint64 InterlockedExchangeAdd64(volatile gint64 *val, gint64 add)
 {
-       return __sync_fetch_and_add (val, add);
+       return gcc_sync_fetch_and_add (val, add);
 }
 
 static inline gint64 InterlockedRead64(volatile gint64 *src)
 {
        /* Kind of a hack, but GCC doesn't give us anything better. */
-       return __sync_fetch_and_add (src, 0);
+       return gcc_sync_fetch_and_add (src, 0);
 }
 
 #else
@@ -393,122 +426,6 @@ static inline void InterlockedWrite64(volatile gint64 *dst, gint64 val)
        InterlockedExchange64 (dst, val);
 }
 
-#elif defined(__ia64__)
-
-#ifdef __INTEL_COMPILER
-#include <ia64intrin.h>
-#endif
-
-static inline gint32 InterlockedCompareExchange(gint32 volatile *dest,
-                                               gint32 exch, gint32 comp)
-{
-       gint32 old;
-       guint64 real_comp;
-
-#ifdef __INTEL_COMPILER
-       old = _InterlockedCompareExchange (dest, exch, comp);
-#else
-       /* cmpxchg4 zero extends the value read from memory */
-       real_comp = (guint64)(guint32)comp;
-       asm volatile ("mov ar.ccv = %2 ;;\n\t"
-                                 "cmpxchg4.acq %0 = [%1], %3, ar.ccv\n\t"
-                                 : "=r" (old) : "r" (dest), "r" (real_comp), "r" (exch));
-#endif
-
-       return(old);
-}
-
-static inline gpointer InterlockedCompareExchangePointer(gpointer volatile *dest,
-                                               gpointer exch, gpointer comp)
-{
-       gpointer old;
-
-#ifdef __INTEL_COMPILER
-       old = _InterlockedCompareExchangePointer (dest, exch, comp);
-#else
-       asm volatile ("mov ar.ccv = %2 ;;\n\t"
-                                 "cmpxchg8.acq %0 = [%1], %3, ar.ccv\n\t"
-                                 : "=r" (old) : "r" (dest), "r" (comp), "r" (exch));
-#endif
-
-       return(old);
-}
-
-static inline gint32 InterlockedIncrement(gint32 volatile *val)
-{
-#ifdef __INTEL_COMPILER
-       return _InterlockedIncrement (val);
-#else
-       gint32 old;
-
-       do {
-               old = *val;
-       } while (InterlockedCompareExchange (val, old + 1, old) != old);
-
-       return old + 1;
-#endif
-}
-
-static inline gint32 InterlockedDecrement(gint32 volatile *val)
-{
-#ifdef __INTEL_COMPILER
-       return _InterlockedDecrement (val);
-#else
-       gint32 old;
-
-       do {
-               old = *val;
-       } while (InterlockedCompareExchange (val, old - 1, old) != old);
-
-       return old - 1;
-#endif
-}
-
-static inline gint32 InterlockedExchange(gint32 volatile *dest, gint32 new_val)
-{
-#ifdef __INTEL_COMPILER
-       return _InterlockedExchange (dest, new_val);
-#else
-       gint32 res;
-
-       do {
-               res = *dest;
-       } while (InterlockedCompareExchange (dest, new_val, res) != res);
-
-       return res;
-#endif
-}
-
-static inline gpointer InterlockedExchangePointer(gpointer volatile *dest, gpointer new_val)
-{
-#ifdef __INTEL_COMPILER
-       return (gpointer)_InterlockedExchange64 ((gint64*)dest, (gint64)new_val);
-#else
-       gpointer res;
-
-       do {
-               res = *dest;
-       } while (InterlockedCompareExchangePointer (dest, new_val, res) != res);
-
-       return res;
-#endif
-}
-
-static inline gint32 InterlockedExchangeAdd(gint32 volatile *val, gint32 add)
-{
-       gint32 old;
-
-#ifdef __INTEL_COMPILER
-       old = _InterlockedExchangeAdd (val, add);
-#else
-       do {
-               old = *val;
-       } while (InterlockedCompareExchange (val, old + add, old) != old);
-
-       return old;
-#endif
-}
-
 #else
 
 #define WAPI_NO_ATOMIC_ASM
index 6f5606bdb80919b7890bd9bed1da15997a77757d..09926ffcd5f2266ce632b71bf837ec8dc73c9c5e 100644 (file)
@@ -146,7 +146,7 @@ translate_backtrace (gpointer native_trace[], int size)
                        g_string_append_printf (bt, "\tat %s\n", names [i]);
        }
 
-       free (names);
+       g_free (names);
        return g_string_free (bt, FALSE);
 }
 
@@ -473,6 +473,12 @@ check_image_may_reference_image(MonoImage *from, MonoImage *to)
                        // For each queued image visit all directly referenced images
                        int inner_idx;
 
+                       // 'files' and 'modules' semantically contain the same items but because of lazy loading we must check both
+                       for (inner_idx = 0; !success && inner_idx < checking->file_count; inner_idx++)
+                       {
+                               CHECK_IMAGE_VISIT (checking->files[inner_idx]);
+                       }
+
                        for (inner_idx = 0; !success && inner_idx < checking->module_count; inner_idx++)
                        {
                                CHECK_IMAGE_VISIT (checking->modules[inner_idx]);
@@ -480,8 +486,8 @@ check_image_may_reference_image(MonoImage *from, MonoImage *to)
 
                        for (inner_idx = 0; !success && inner_idx < checking->nreferences; inner_idx++)
                        {
-                               // References are lazy-loaded and thus allowed to be NULL.
-                               // If they are NULL, we don't care about them for this search, because they haven't impacted ref_count yet.
+                               // Assembly references are lazy-loaded and thus allowed to be NULL.
+                               // If they are NULL, we don't care about them for this search, because their images haven't impacted ref_count yet.
                                if (checking->references[inner_idx])
                                {
                                        CHECK_IMAGE_VISIT (checking->references[inner_idx]->image);
@@ -540,10 +546,10 @@ check_image_set_may_reference_image_set (MonoImageSet *from, MonoImageSet *to)
                if (to->images[to_idx] == mono_defaults.corlib)
                        seen = TRUE;
 
-               // For each item in to->images, scan over from->images looking for it.
+               // For each item in to->images, scan over from->images seeking a path to it.
                for (from_idx = 0; !seen && from_idx < from->nimages; from_idx++)
                {
-                       if (to->images[to_idx] == from->images[from_idx])
+                       if (check_image_may_reference_image (from->images[from_idx], to->images[to_idx]))
                                seen = TRUE;
                }
 
index 1f4ca74112a498f7b4b35316c4ebffebd369eb73..3dcbe286cca7ee4da0924ddf14f8e010e40607b7 100644 (file)
@@ -12,6 +12,7 @@
 
 #include <config.h>
 #include <mono/utils/atomic.h>
+#include <mono/utils/mono-compiler.h>
 #include <mono/utils/mono-publib.h>
 
 typedef enum {
@@ -185,12 +186,18 @@ void assert_in_gc_critical_region (void);
 void check_metadata_store(void *from, void *to);
 void check_metadata_store_local(void *from, void *to);
 
+#define CHECKED_METADATA_STORE(ptr, val) check_metadata_store ((ptr), (val))
+#define CHECKED_METADATA_STORE_LOCAL(ptr, val) check_metadata_store_local ((ptr), (val))
+
 #else
 
 #define CHECKED_METADATA_WRITE_PTR(ptr, val) do { (ptr) = (val); } while (0)
 #define CHECKED_METADATA_WRITE_PTR_LOCAL(ptr, val) do { (ptr) = (val); } while (0)
 #define CHECKED_METADATA_WRITE_PTR_ATOMIC(ptr, val) do { mono_atomic_store_release (&(ptr), (val)); } while (0)
 
+#define CHECKED_METADATA_STORE(ptr, val) do { (ptr); (val); } while (0)
+#define CHECKED_METADATA_STORE_LOCAL(ptr, val) do { (ptr); (val); } while (0)
+
 #endif /* defined(ENABLE_CHECKED_BUILD_METADATA) */
 
 #ifdef ENABLE_CHECKED_BUILD_THREAD
@@ -201,7 +208,7 @@ void check_metadata_store_local(void *from, void *to);
 
 void checked_build_thread_transition(const char *transition, void *info, int from_state, int suspend_count, int next_state, int suspend_count_delta);
 
-G_GNUC_NORETURN void mono_fatal_with_history(const char *msg, ...);
+G_GNUC_NORETURN MONO_ATTR_FORMAT_PRINTF(1,2) void mono_fatal_with_history(const char *msg, ...);
 
 #else
 
index efe6b649b3039450cbdc176f0373cd55754a69be..cc00f5c8eba8b3d44318745c735ec03ce4abae32 100644 (file)
@@ -29,7 +29,6 @@
 typedef struct {
        gpointer p;
        MonoHazardousFreeFunc free_func;
-       HazardFreeLocking locking;
 } DelayedFreeItem;
 
 /* The hazard table */
@@ -53,7 +52,7 @@ static volatile gint32 overflow_busy [HAZARD_TABLE_OVERFLOW];
 
 /* The table where we keep pointers to blocks to be freed but that
    have to wait because they're guarded by a hazard pointer. */
-static MonoLockFreeArrayQueue delayed_free_queue = MONO_LOCK_FREE_ARRAY_QUEUE_INIT (sizeof (DelayedFreeItem));
+static MonoLockFreeArrayQueue delayed_free_queue = MONO_LOCK_FREE_ARRAY_QUEUE_INIT (sizeof (DelayedFreeItem), MONO_MEM_ACCOUNT_HAZARD_POINTERS);
 
 /* The table for small ID assignment */
 static mono_mutex_t small_id_mutex;
@@ -113,7 +112,7 @@ mono_thread_small_id_alloc (void)
                if (hazard_table == NULL) {
                        hazard_table = (MonoThreadHazardPointers *volatile) mono_valloc (NULL,
                                sizeof (MonoThreadHazardPointers) * HAZARD_TABLE_MAX_SIZE,
-                               MONO_MMAP_NONE);
+                               MONO_MMAP_NONE, MONO_MEM_ACCOUNT_HAZARD_POINTERS);
                }
 
                g_assert (hazard_table != NULL);
@@ -191,7 +190,7 @@ mono_hazard_pointer_get (void)
    mono_jit_info_table_add(), which doesn't have to care about hazards
    because it holds the respective domain lock. */
 gpointer
-get_hazardous_pointer (gpointer volatile *pp, MonoThreadHazardPointers *hp, int hazard_index)
+mono_get_hazardous_pointer (gpointer volatile *pp, MonoThreadHazardPointers *hp, int hazard_index)
 {
        gpointer p;
 
@@ -287,26 +286,6 @@ mono_hazard_pointer_restore_for_signal_handler (int small_id)
        overflow_busy [small_id] = 0;
 }
 
-static gboolean
-try_free_delayed_free_item (HazardFreeContext context)
-{
-       DelayedFreeItem item;
-       gboolean popped = mono_lock_free_array_queue_pop (&delayed_free_queue, &item);
-
-       if (!popped)
-               return FALSE;
-
-       if ((context == HAZARD_FREE_ASYNC_CTX && item.locking == HAZARD_FREE_MAY_LOCK) ||
-           (is_pointer_hazardous (item.p))) {
-               mono_lock_free_array_queue_push (&delayed_free_queue, &item);
-               return FALSE;
-       }
-
-       item.free_func (item.p);
-
-       return TRUE;
-}
-
 /**
  * mono_thread_hazardous_try_free:
  * @p: the pointer to free
@@ -348,7 +327,7 @@ mono_thread_hazardous_try_free (gpointer p, MonoHazardousFreeFunc free_func)
 void
 mono_thread_hazardous_queue_free (gpointer p, MonoHazardousFreeFunc free_func)
 {
-       DelayedFreeItem item = { p, free_func, HAZARD_FREE_MAY_LOCK };
+       DelayedFreeItem item = { p, free_func };
 
        InterlockedIncrement (&hazardous_pointer_count);
 
@@ -366,19 +345,48 @@ mono_hazard_pointer_install_free_queue_size_callback (MonoHazardFreeQueueSizeCal
        queue_size_cb = cb;
 }
 
+static void
+try_free_delayed_free_items (guint32 limit)
+{
+       GArray *hazardous = NULL;
+       DelayedFreeItem item;
+       guint32 freed = 0;
+
+       // Free all the items we can and re-add the ones we can't to the queue.
+       while (mono_lock_free_array_queue_pop (&delayed_free_queue, &item)) {
+               if (is_pointer_hazardous (item.p)) {
+                       if (!hazardous)
+                               hazardous = g_array_sized_new (FALSE, FALSE, sizeof (DelayedFreeItem), delayed_free_queue.num_used_entries);
+
+                       g_array_append_val (hazardous, item);
+                       continue;
+               }
+
+               item.free_func (item.p);
+               freed++;
+
+               if (limit && freed == limit)
+                       break;
+       }
+
+       if (hazardous) {
+               for (gint i = 0; i < hazardous->len; i++)
+                       mono_lock_free_array_queue_push (&delayed_free_queue, &g_array_index (hazardous, DelayedFreeItem, i));
+
+               g_array_free (hazardous, TRUE);
+       }
+}
+
 void
 mono_thread_hazardous_try_free_all (void)
 {
-       while (try_free_delayed_free_item (HAZARD_FREE_SAFE_CTX))
-               ;
+       try_free_delayed_free_items (0);
 }
 
 void
 mono_thread_hazardous_try_free_some (void)
 {
-       int i;
-       for (i = 0; i < 10; ++i)
-               try_free_delayed_free_item (HAZARD_FREE_SAFE_CTX);
+       try_free_delayed_free_items (10);
 }
 
 void
index 0102c103f7629785b1eb8c231a88f86269dbc56c..558c0ad0afa9d5f1a2c7896bd8a34e3c7b10cfa9 100644 (file)
@@ -20,23 +20,13 @@ typedef struct {
 
 typedef void (*MonoHazardousFreeFunc) (gpointer p);
 
-typedef enum {
-       HAZARD_FREE_MAY_LOCK,
-       HAZARD_FREE_NO_LOCK,
-} HazardFreeLocking;
-
-typedef enum {
-       HAZARD_FREE_SAFE_CTX,
-       HAZARD_FREE_ASYNC_CTX,
-} HazardFreeContext;
-
 MONO_API gboolean mono_thread_hazardous_try_free (gpointer p, MonoHazardousFreeFunc free_func);
-void mono_thread_hazardous_queue_free (gpointer p, MonoHazardousFreeFunc free_func);
+MONO_API void mono_thread_hazardous_queue_free (gpointer p, MonoHazardousFreeFunc free_func);
 
-void mono_thread_hazardous_try_free_all (void);
+MONO_API void mono_thread_hazardous_try_free_all (void);
 void mono_thread_hazardous_try_free_some (void);
-MonoThreadHazardPointers* mono_hazard_pointer_get (void);
-gpointer get_hazardous_pointer (gpointer volatile *pp, MonoThreadHazardPointers *hp, int hazard_index);
+MONO_API MonoThreadHazardPointers* mono_hazard_pointer_get (void);
+gpointer mono_get_hazardous_pointer (gpointer volatile *pp, MonoThreadHazardPointers *hp, int hazard_index);
 
 #define mono_hazard_pointer_set(hp,i,v)        \
        do { g_assert ((i) >= 0 && (i) < HAZARD_POINTER_COUNT); \
index d103ef6aa333eeb96a920d8e62ef0af79db5ecb2..08b4deff37c0379b92524ce00ee5788e717b57b0 100644 (file)
@@ -138,8 +138,8 @@ alloc_sb (Descriptor *desc)
                pagesize = mono_pagesize ();
 
        sb_header = desc->block_size == pagesize ?
-               mono_valloc (NULL, desc->block_size, prot_flags_for_activate (TRUE)) :
-               mono_valloc_aligned (desc->block_size, desc->block_size, prot_flags_for_activate (TRUE));
+               mono_valloc (NULL, desc->block_size, prot_flags_for_activate (TRUE), desc->heap->account_type) :
+               mono_valloc_aligned (desc->block_size, desc->block_size, prot_flags_for_activate (TRUE), desc->heap->account_type);
 
        g_assert (sb_header == sb_header_for_addr (sb_header, desc->block_size));
 
@@ -150,11 +150,11 @@ alloc_sb (Descriptor *desc)
 }
 
 static void
-free_sb (gpointer sb, size_t block_size)
+free_sb (gpointer sb, size_t block_size, MonoMemAccountType type)
 {
        gpointer sb_header = sb_header_for_addr (sb, block_size);
        g_assert ((char*)sb_header + LOCK_FREE_ALLOC_SB_HEADER_SIZE == sb);
-       mono_vfree (sb_header, block_size);
+       mono_vfree (sb_header, block_size, type);
        //g_print ("free sb %p\n", sb_header);
 }
 
@@ -162,7 +162,7 @@ free_sb (gpointer sb, size_t block_size)
 static Descriptor * volatile desc_avail;
 
 static Descriptor*
-desc_alloc (void)
+desc_alloc (MonoMemAccountType type)
 {
        MonoThreadHazardPointers *hp = mono_hazard_pointer_get ();
        Descriptor *desc;
@@ -170,7 +170,7 @@ desc_alloc (void)
        for (;;) {
                gboolean success;
 
-               desc = (Descriptor *) get_hazardous_pointer ((gpointer * volatile)&desc_avail, hp, 1);
+               desc = (Descriptor *) mono_get_hazardous_pointer ((gpointer * volatile)&desc_avail, hp, 1);
                if (desc) {
                        Descriptor *next = desc->next;
                        success = (InterlockedCompareExchangePointer ((gpointer * volatile)&desc_avail, next, desc) == desc);
@@ -179,7 +179,7 @@ desc_alloc (void)
                        Descriptor *d;
                        int i;
 
-                       desc = (Descriptor *) mono_valloc (NULL, desc_size * NUM_DESC_BATCH, prot_flags_for_activate (TRUE));
+                       desc = (Descriptor *) mono_valloc (NULL, desc_size * NUM_DESC_BATCH, prot_flags_for_activate (TRUE), type);
 
                        /* Organize into linked list. */
                        d = desc;
@@ -195,7 +195,7 @@ desc_alloc (void)
                        success = (InterlockedCompareExchangePointer ((gpointer * volatile)&desc_avail, desc->next, NULL) == NULL);
 
                        if (!success)
-                               mono_vfree (desc, desc_size * NUM_DESC_BATCH);
+                               mono_vfree (desc, desc_size * NUM_DESC_BATCH, type);
                }
 
                mono_hazard_pointer_clear (hp, 1);
@@ -232,27 +232,27 @@ desc_retire (Descriptor *desc)
        g_assert (desc->anchor.data.state == STATE_EMPTY);
        g_assert (desc->in_use);
        desc->in_use = FALSE;
-       free_sb (desc->sb, desc->block_size);
+       free_sb (desc->sb, desc->block_size, desc->heap->account_type);
        mono_thread_hazardous_try_free (desc, desc_enqueue_avail);
 }
 #else
 MonoLockFreeQueue available_descs;
 
 static Descriptor*
-desc_alloc (void)
+desc_alloc (MonoMemAccountType type)
 {
        Descriptor *desc = (Descriptor*)mono_lock_free_queue_dequeue (&available_descs);
 
        if (desc)
                return desc;
 
-       return calloc (1, sizeof (Descriptor));
+       return g_calloc (1, sizeof (Descriptor));
 }
 
 static void
 desc_retire (Descriptor *desc)
 {
-       free_sb (desc->sb, desc->block_size);
+       free_sb (desc->sb, desc->block_size, desc->heap->account_type);
        mono_lock_free_queue_enqueue (&available_descs, &desc->node);
 }
 #endif
@@ -390,7 +390,7 @@ static gpointer
 alloc_from_new_sb (MonoLockFreeAllocator *heap)
 {
        unsigned int slot_size, block_size, count, i;
-       Descriptor *desc = desc_alloc ();
+       Descriptor *desc = desc_alloc (heap->account_type);
 
        slot_size = desc->slot_size = heap->sc->slot_size;
        block_size = desc->block_size = heap->sc->block_size;
@@ -611,8 +611,9 @@ mono_lock_free_allocator_init_size_class (MonoLockFreeAllocSizeClass *sc, unsign
 }
 
 void
-mono_lock_free_allocator_init_allocator (MonoLockFreeAllocator *heap, MonoLockFreeAllocSizeClass *sc)
+mono_lock_free_allocator_init_allocator (MonoLockFreeAllocator *heap, MonoLockFreeAllocSizeClass *sc, MonoMemAccountType account_type)
 {
        heap->sc = sc;
        heap->active = NULL;
+       heap->account_type = account_type;
 }
index f0420b492ec1bc39ee043f826f85bd933996ea0f..9501307fc1dd29f5c8c3c26baa9073c3b5856bf5 100644 (file)
@@ -27,8 +27,8 @@
 #define __MONO_LOCKFREEALLOC_H__
 
 #include <glib.h>
-
-#include "lock-free-queue.h"
+#include <mono/utils/lock-free-queue.h>
+#include <mono/utils/mono-mmap.h>
 
 typedef struct {
        MonoLockFreeQueue partial;
@@ -41,14 +41,15 @@ struct _MonoLockFreeAllocDescriptor;
 typedef struct {
        struct _MonoLockFreeAllocDescriptor *active;
        MonoLockFreeAllocSizeClass *sc;
+       MonoMemAccountType account_type;
 } MonoLockFreeAllocator;
 
 #define LOCK_FREE_ALLOC_SB_MAX_SIZE                                    16384
-#define LOCK_FREE_ALLOC_SB_HEADER_SIZE                         (sizeof (MonoLockFreeAllocator))
+#define LOCK_FREE_ALLOC_SB_HEADER_SIZE                         (sizeof (gpointer))
 #define LOCK_FREE_ALLOC_SB_USABLE_SIZE(block_size)     ((block_size) - LOCK_FREE_ALLOC_SB_HEADER_SIZE)
 
 MONO_API void mono_lock_free_allocator_init_size_class (MonoLockFreeAllocSizeClass *sc, unsigned int slot_size, unsigned int block_size);
-MONO_API void mono_lock_free_allocator_init_allocator (MonoLockFreeAllocator *heap, MonoLockFreeAllocSizeClass *sc);
+MONO_API void mono_lock_free_allocator_init_allocator (MonoLockFreeAllocator *heap, MonoLockFreeAllocSizeClass *sc, MonoMemAccountType account_type);
 
 MONO_API gpointer mono_lock_free_alloc (MonoLockFreeAllocator *heap);
 MONO_API void mono_lock_free_free (gpointer ptr, size_t block_size);
index b0d0a9a1dfe593ab67005f1cb52e960b0d89447b..5e48558a0d94c438b9afd9db4994ce8c538b7002 100644 (file)
@@ -45,16 +45,16 @@ alloc_chunk (MonoLockFreeArray *arr)
 {
        int size = mono_pagesize ();
        int num_entries = (size - (sizeof (Chunk) - arr->entry_size * MONO_ZERO_LEN_ARRAY)) / arr->entry_size;
-       Chunk *chunk = (Chunk *) mono_valloc (NULL, size, MONO_MMAP_READ | MONO_MMAP_WRITE);
+       Chunk *chunk = (Chunk *) mono_valloc (NULL, size, MONO_MMAP_READ | MONO_MMAP_WRITE, arr->account_type);
        g_assert (chunk);
        chunk->num_entries = num_entries;
        return chunk;
 }
 
 static void
-free_chunk (Chunk *chunk)
+free_chunk (Chunk *chunk, MonoMemAccountType type)
 {
-       mono_vfree (chunk, mono_pagesize ());
+       mono_vfree (chunk, mono_pagesize (), type);
 }
 
 gpointer
@@ -68,7 +68,7 @@ mono_lock_free_array_nth (MonoLockFreeArray *arr, int index)
                chunk = alloc_chunk (arr);
                mono_memory_write_barrier ();
                if (InterlockedCompareExchangePointer ((volatile gpointer *)&arr->chunk_list, chunk, NULL) != NULL)
-                       free_chunk (chunk);
+                       free_chunk (chunk, arr->account_type);
        }
 
        chunk = arr->chunk_list;
@@ -80,7 +80,7 @@ mono_lock_free_array_nth (MonoLockFreeArray *arr, int index)
                        next = alloc_chunk (arr);
                        mono_memory_write_barrier ();
                        if (InterlockedCompareExchangePointer ((volatile gpointer *) &chunk->next, next, NULL) != NULL) {
-                               free_chunk (next);
+                               free_chunk (next, arr->account_type);
                                next = chunk->next;
                                g_assert (next);
                        }
@@ -116,7 +116,7 @@ mono_lock_free_array_cleanup (MonoLockFreeArray *arr)
        arr->chunk_list = NULL;
        while (chunk) {
                Chunk *next = chunk->next;
-               free_chunk (chunk);
+               free_chunk (chunk, arr->account_type);
                chunk = next;
        }
 }
index fc924a7639ab011bf567d6f44db039d9648ee899..8e198e9227df62230c3e31cf092401d66c117c15 100644 (file)
 
 #include <glib.h>
 #include <mono/utils/mono-compiler.h>
+#include <mono/utils/mono-mmap.h>
 
 typedef struct _MonoLockFreeArrayChunk MonoLockFreeArrayChunk;
 
 typedef struct {
        size_t entry_size;
        MonoLockFreeArrayChunk *chunk_list;
+       MonoMemAccountType account_type;
 } MonoLockFreeArray;
 
 typedef struct {
@@ -23,8 +25,8 @@ typedef struct {
        gint32 num_used_entries;
 } MonoLockFreeArrayQueue;
 
-#define MONO_LOCK_FREE_ARRAY_INIT(entry_size)          { (entry_size), NULL }
-#define MONO_LOCK_FREE_ARRAY_QUEUE_INIT(entry_size)    { MONO_LOCK_FREE_ARRAY_INIT ((entry_size) + sizeof (gpointer)), 0 }
+#define MONO_LOCK_FREE_ARRAY_INIT(entry_size, account_type)            { (entry_size), NULL, (account_type) }
+#define MONO_LOCK_FREE_ARRAY_QUEUE_INIT(entry_size, account_type)      { MONO_LOCK_FREE_ARRAY_INIT ((entry_size) + sizeof (gpointer), (account_type)), 0 }
 
 gpointer mono_lock_free_array_nth (MonoLockFreeArray *arr, int index);
 
index 2e06b63f526258de4e6f2004e3fd397d8f523611..3abb84104732786d6978fed3f01d42496de8585d 100644 (file)
@@ -133,7 +133,7 @@ mono_lock_free_queue_enqueue (MonoLockFreeQueue *q, MonoLockFreeQueueNode *node)
        for (;;) {
                MonoLockFreeQueueNode *next;
 
-               tail = (MonoLockFreeQueueNode *) get_hazardous_pointer ((gpointer volatile*)&q->tail, hp, 0);
+               tail = (MonoLockFreeQueueNode *) mono_get_hazardous_pointer ((gpointer volatile*)&q->tail, hp, 0);
                mono_memory_read_barrier ();
                /*
                 * We never dereference next so we don't need a
@@ -243,7 +243,7 @@ mono_lock_free_queue_dequeue (MonoLockFreeQueue *q)
        for (;;) {
                MonoLockFreeQueueNode *tail, *next;
 
-               head = (MonoLockFreeQueueNode *) get_hazardous_pointer ((gpointer volatile*)&q->head, hp, 0);
+               head = (MonoLockFreeQueueNode *) mono_get_hazardous_pointer ((gpointer volatile*)&q->head, hp, 0);
                tail = (MonoLockFreeQueueNode*)q->tail;
                mono_memory_read_barrier ();
                next = head->next;
index 1802ff79f5364d8301566717bc2da54b5bcad12d..179a4f7ed748199ed0f6ccc018a63957e7fde44a 100644 (file)
@@ -59,27 +59,30 @@ mono_mach_arch_get_mcontext_size ()
 }
 
 void
-mono_mach_arch_thread_state_to_mcontext (thread_state_t state, void *context)
+mono_mach_arch_thread_states_to_mcontext (thread_state_t state, thread_state_t fpstate, void *context)
 {
        x86_thread_state64_t *arch_state = (x86_thread_state64_t *) state;
+       x86_float_state64_t *arch_fpstate = (x86_float_state64_t *) fpstate;
        struct __darwin_mcontext64 *ctx = (struct __darwin_mcontext64 *) context;
-
        ctx->__ss = *arch_state;
+       ctx->__fs = *arch_fpstate;
 }
 
 void
-mono_mach_arch_mcontext_to_thread_state (void *context, thread_state_t state)
+mono_mach_arch_mcontext_to_thread_states (void *context, thread_state_t state, thread_state_t fpstate)
 {
        x86_thread_state64_t *arch_state = (x86_thread_state64_t *) state;
+       x86_float_state64_t *arch_fpstate = (x86_float_state64_t *) fpstate;
        struct __darwin_mcontext64 *ctx = (struct __darwin_mcontext64 *) context;
-
        *arch_state = ctx->__ss;
+       *arch_fpstate = ctx->__fs;
 }
 
 void
-mono_mach_arch_thread_state_to_mono_context (thread_state_t state, MonoContext *context)
+mono_mach_arch_thread_states_to_mono_context (thread_state_t state, thread_state_t fpstate, MonoContext *context)
 {
        x86_thread_state64_t *arch_state = (x86_thread_state64_t *) state;
+       x86_float_state64_t *arch_fpstate = (x86_float_state64_t *) fpstate;
        context->gregs [AMD64_RAX] = arch_state->__rax;
        context->gregs [AMD64_RBX] = arch_state->__rbx;
        context->gregs [AMD64_RCX] = arch_state->__rcx;
@@ -96,6 +99,22 @@ mono_mach_arch_thread_state_to_mono_context (thread_state_t state, MonoContext *
        context->gregs [AMD64_R14] = arch_state->__r14;
        context->gregs [AMD64_R15] = arch_state->__r15;
        context->gregs [AMD64_RIP] = arch_state->__rip;
+       context->fregs [AMD64_XMM0] = arch_fpstate->__fpu_xmm0;
+       context->fregs [AMD64_XMM1] = arch_fpstate->__fpu_xmm1;
+       context->fregs [AMD64_XMM2] = arch_fpstate->__fpu_xmm2;
+       context->fregs [AMD64_XMM3] = arch_fpstate->__fpu_xmm3;
+       context->fregs [AMD64_XMM4] = arch_fpstate->__fpu_xmm4;
+       context->fregs [AMD64_XMM5] = arch_fpstate->__fpu_xmm5;
+       context->fregs [AMD64_XMM6] = arch_fpstate->__fpu_xmm6;
+       context->fregs [AMD64_XMM7] = arch_fpstate->__fpu_xmm7;
+       context->fregs [AMD64_XMM8] = arch_fpstate->__fpu_xmm8;
+       context->fregs [AMD64_XMM9] = arch_fpstate->__fpu_xmm9;
+       context->fregs [AMD64_XMM10] = arch_fpstate->__fpu_xmm10;
+       context->fregs [AMD64_XMM11] = arch_fpstate->__fpu_xmm11;
+       context->fregs [AMD64_XMM12] = arch_fpstate->__fpu_xmm12;
+       context->fregs [AMD64_XMM13] = arch_fpstate->__fpu_xmm13;
+       context->fregs [AMD64_XMM14] = arch_fpstate->__fpu_xmm14;
+       context->fregs [AMD64_XMM15] = arch_fpstate->__fpu_xmm15;
 }
 
 int
@@ -104,23 +123,39 @@ mono_mach_arch_get_thread_state_size ()
        return sizeof (x86_thread_state64_t);
 }
 
+int
+mono_mach_arch_get_thread_fpstate_size ()
+{
+       return sizeof (x86_float_state64_t);
+}
+
 kern_return_t
-mono_mach_arch_get_thread_state (thread_port_t thread, thread_state_t state, mach_msg_type_number_t *count)
+mono_mach_arch_get_thread_states (thread_port_t thread, thread_state_t state, mach_msg_type_number_t *count, thread_state_t fpstate, mach_msg_type_number_t *fpcount)
 {
-       x86_thread_state64_t *arch_state = (x86_thread_state64_t *) state;
+       x86_thread_state64_t *arch_state = (x86_thread_state64_t *)state;
+       x86_float_state64_t *arch_fpstate = (x86_float_state64_t *)fpstate;
        kern_return_t ret;
 
        *count = x86_THREAD_STATE64_COUNT;
+       *fpcount = x86_FLOAT_STATE64_COUNT;
 
-       ret = thread_get_state (thread, x86_THREAD_STATE64, (thread_state_t) arch_state, count);
+       ret = thread_get_state (thread, x86_THREAD_STATE64, (thread_state_t)arch_state, count);
+       if (ret != KERN_SUCCESS)
+               return ret;
 
+       ret = thread_get_state (thread, x86_FLOAT_STATE64, (thread_state_t)arch_fpstate, fpcount);
        return ret;
 }
 
 kern_return_t
-mono_mach_arch_set_thread_state (thread_port_t thread, thread_state_t state, mach_msg_type_number_t count)
+mono_mach_arch_set_thread_states (thread_port_t thread, thread_state_t state, mach_msg_type_number_t count, thread_state_t fpstate, mach_msg_type_number_t fpcount)
 {
-       return thread_set_state (thread, x86_THREAD_STATE64, state, count);
+       kern_return_t ret;
+       ret = thread_set_state (thread, x86_THREAD_STATE64, state, count);
+       if (ret != KERN_SUCCESS)
+               return ret;
+       ret = thread_set_state (thread, x86_FLOAT_STATE64, fpstate, fpcount);
+       return ret;
 }
 
 void *
index d535fbc18ddce3689a7701acc1da0cd4eeca0492..a7fd9836d18326238294ffc4c48f2a4a3cf96032 100644 (file)
@@ -66,7 +66,7 @@ mono_mach_arch_get_mcontext_size ()
 }
 
 void
-mono_mach_arch_thread_state_to_mcontext (thread_state_t state, void *context)
+mono_mach_arch_thread_states_to_mcontext (thread_state_t state, thread_state_t fpstate, void *context)
 {
        arm_thread_state_t *arch_state = (arm_thread_state_t *) state;
        struct __darwin_mcontext *ctx = (struct __darwin_mcontext *) context;
@@ -75,7 +75,7 @@ mono_mach_arch_thread_state_to_mcontext (thread_state_t state, void *context)
 }
 
 void
-mono_mach_arch_mcontext_to_thread_state (void *context, thread_state_t state)
+mono_mach_arch_mcontext_to_thread_states (void *context, thread_state_t state, thread_state_t fpstate)
 {
        arm_thread_state_t *arch_state = (arm_thread_state_t *) state;
        struct __darwin_mcontext *ctx = (struct __darwin_mcontext *) context;
@@ -84,7 +84,7 @@ mono_mach_arch_mcontext_to_thread_state (void *context, thread_state_t state)
 }
 
 void
-mono_mach_arch_thread_state_to_mono_context (thread_state_t state, MonoContext *context)
+mono_mach_arch_thread_states_to_mono_context (thread_state_t state, thread_state_t fpstate, MonoContext *context)
 {
        int i;
        arm_thread_state_t *arch_state = (arm_thread_state_t *) state;
@@ -103,8 +103,14 @@ mono_mach_arch_get_thread_state_size ()
        return sizeof (arm_thread_state_t);
 }
 
+int
+mono_mach_arch_get_thread_fpstate_size ()
+{
+       g_assert_not_reached ();
+}
+
 kern_return_t
-mono_mach_arch_get_thread_state (thread_port_t thread, thread_state_t state, mach_msg_type_number_t *count)
+mono_mach_arch_get_thread_states (thread_port_t thread, thread_state_t state, mach_msg_type_number_t *count, thread_state_t fpstate, mach_msg_type_number_t *fpcount)
 {
 #if defined(HOST_WATCHOS)
        g_error ("thread_get_state() is not supported by this platform");
@@ -120,7 +126,7 @@ mono_mach_arch_get_thread_state (thread_port_t thread, thread_state_t state, mac
 }
 
 kern_return_t
-mono_mach_arch_set_thread_state (thread_port_t thread, thread_state_t state, mach_msg_type_number_t count)
+mono_mach_arch_set_thread_states (thread_port_t thread, thread_state_t state, mach_msg_type_number_t count, thread_state_t fpstate, mach_msg_type_number_t fpcount)
 {
 #if defined(HOST_WATCHOS)
        g_error ("thread_set_state() is not supported by this platform");
index 6483238d4565568b2695e254d7428c2c1426a70f..2035f485b14c22281602214440bc47fbaa8a30f6 100644 (file)
@@ -66,7 +66,7 @@ mono_mach_arch_get_mcontext_size ()
 }
 
 void
-mono_mach_arch_thread_state_to_mcontext (thread_state_t state, void *context)
+mono_mach_arch_thread_states_to_mcontext (thread_state_t state, thread_state_t fpstate, void *context)
 {
        arm_unified_thread_state_t *arch_state = (arm_unified_thread_state_t *) state;
        struct __darwin_mcontext64 *ctx = (struct __darwin_mcontext64 *) context;
@@ -75,7 +75,7 @@ mono_mach_arch_thread_state_to_mcontext (thread_state_t state, void *context)
 }
 
 void
-mono_mach_arch_mcontext_to_thread_state (void *context, thread_state_t state)
+mono_mach_arch_mcontext_to_thread_states (void *context, thread_state_t state, thread_state_t fpstate)
 {
        arm_unified_thread_state_t *arch_state = (arm_unified_thread_state_t *) state;
        struct __darwin_mcontext64 *ctx = (struct __darwin_mcontext64 *) context;
@@ -84,7 +84,7 @@ mono_mach_arch_mcontext_to_thread_state (void *context, thread_state_t state)
 }
 
 void
-mono_mach_arch_thread_state_to_mono_context (thread_state_t state, MonoContext *context)
+mono_mach_arch_thread_states_to_mono_context (thread_state_t state, thread_state_t fpstate, MonoContext *context)
 {
        int i;
        arm_unified_thread_state_t *arch_state = (arm_unified_thread_state_t *) state;
@@ -103,8 +103,14 @@ mono_mach_arch_get_thread_state_size ()
        return sizeof (arm_unified_thread_state_t);
 }
 
+int
+mono_mach_arch_get_thread_fpstate_size ()
+{
+       g_assert_not_reached ();
+}
+
 kern_return_t
-mono_mach_arch_get_thread_state (thread_port_t thread, thread_state_t state, mach_msg_type_number_t *count)
+mono_mach_arch_get_thread_states (thread_port_t thread, thread_state_t state, mach_msg_type_number_t *count, thread_state_t fpstate, mach_msg_type_number_t *fpcount)
 {
        arm_unified_thread_state_t *arch_state = (arm_unified_thread_state_t *) state;
        kern_return_t ret;
@@ -116,7 +122,7 @@ mono_mach_arch_get_thread_state (thread_port_t thread, thread_state_t state, mac
 }
 
 kern_return_t
-mono_mach_arch_set_thread_state (thread_port_t thread, thread_state_t state, mach_msg_type_number_t count)
+mono_mach_arch_set_thread_states (thread_port_t thread, thread_state_t state, mach_msg_type_number_t count, thread_state_t fpstate, mach_msg_type_number_t fpcount)
 {
        return thread_set_state (thread, ARM_UNIFIED_THREAD_STATE, state, count);
 }
index 20012550114610c911623f8a0cbdf9af0197c277..88eb187da4476b24dbb4980a851ab217ba1c1d5e 100644 (file)
@@ -35,19 +35,19 @@ mono_mach_arch_get_mcontext_size ()
 }
 
 void
-mono_mach_arch_thread_state_to_mcontext (thread_state_t state, void *context)
+mono_mach_arch_thread_states_to_mcontext (thread_state_t state, thread_state_t fpstate, void *context)
 {
        g_assert_not_reached ();
 }
 
 void
-mono_mach_arch_mcontext_to_thread_state (void *context, thread_state_t state)
+mono_mach_arch_mcontext_to_thread_states (void *context, thread_state_t state, thread_state_t fpstate)
 {
        g_assert_not_reached ();
 }
 
 void
-mono_mach_arch_thread_state_to_mono_context (thread_state_t state, MonoContext *context)
+mono_mach_arch_thread_states_to_mono_context (thread_state_t state, thread_state_t fpstate, MonoContext *context)
 {
        g_assert_not_reached ();
 }
@@ -58,14 +58,20 @@ mono_mach_arch_get_thread_state_size ()
        g_assert_not_reached ();
 }
 
+int
+mono_mach_arch_get_thread_fpstate_size ()
+{
+       g_assert_not_reached ();
+}
+
 kern_return_t
-mono_mach_arch_get_thread_state (thread_port_t thread, thread_state_t state, mach_msg_type_number_t *count)
+mono_mach_arch_get_thread_states (thread_port_t thread, thread_state_t state, mach_msg_type_number_t *count, thread_state_t fpstate, mach_msg_type_number_t *fpcount)
 {
        g_assert_not_reached ();
 }
 
 kern_return_t
-mono_mach_arch_set_thread_state (thread_port_t thread, thread_state_t state, mach_msg_type_number_t count)
+mono_mach_arch_set_thread_states (thread_port_t thread, thread_state_t state, mach_msg_type_number_t count, thread_state_t fpstate, mach_msg_type_number_t fpcount)
 {
        g_assert_not_reached ();        
 }
index 3e8b166eaf2b51a7dc69f49d889c896762d75732..a296254cd2cffb17f92947fdbc9dce54f7aa1c4e 100644 (file)
@@ -16,6 +16,9 @@
 #include "utils/mono-sigcontext.h"
 #include "mach-support.h"
 
+// For reg numbers
+#include <mono/arch/amd64/amd64-codegen.h>
+
 /* Known offsets used for TLS storage*/
 
 /* All OSX versions up to 10.8 */
@@ -55,27 +58,30 @@ mono_mach_arch_get_mcontext_size ()
 }
 
 void
-mono_mach_arch_thread_state_to_mcontext (thread_state_t state, void *context)
+mono_mach_arch_thread_states_to_mcontext (thread_state_t state, thread_state_t fpstate, void *context)
 {
        x86_thread_state32_t *arch_state = (x86_thread_state32_t *) state;
+       x86_float_state32_t *arch_fpstate = (x86_float_state32_t *) fpstate;
        struct __darwin_mcontext32 *ctx = (struct __darwin_mcontext32 *) context;
-
        ctx->__ss = *arch_state;
+       ctx->__fs = *arch_fpstate;
 }
 
 void
-mono_mach_arch_mcontext_to_thread_state (void *context, thread_state_t state)
+mono_mach_arch_mcontext_to_thread_states (void *context, thread_state_t state, thread_state_t fpstate)
 {
        x86_thread_state32_t *arch_state = (x86_thread_state32_t *) state;
+       x86_float_state32_t *arch_fpstate = (x86_float_state32_t *) fpstate;
        struct __darwin_mcontext32 *ctx = (struct __darwin_mcontext32 *) context;
-
        *arch_state = ctx->__ss;
+       *arch_fpstate = ctx->__fs;
 }
 
 void
-mono_mach_arch_thread_state_to_mono_context (thread_state_t state, MonoContext *context)
+mono_mach_arch_thread_states_to_mono_context (thread_state_t state, thread_state_t fpstate, MonoContext *context)
 {
        x86_thread_state32_t *arch_state = (x86_thread_state32_t *) state;
+       x86_float_state32_t *arch_fpstate = (x86_float_state32_t *) state;
        context->eax = arch_state->__eax;
        context->ebx = arch_state->__ebx;
        context->ecx = arch_state->__ecx;
@@ -85,38 +91,62 @@ mono_mach_arch_thread_state_to_mono_context (thread_state_t state, MonoContext *
        context->esi = arch_state->__edi;
        context->edi = arch_state->__esi;
        context->eip = arch_state->__eip;
+       context->fregs [X86_XMM0] = arch_fpstate->__fpu_xmm0;
+       context->fregs [X86_XMM1] = arch_fpstate->__fpu_xmm1;
+       context->fregs [X86_XMM2] = arch_fpstate->__fpu_xmm2;
+       context->fregs [X86_XMM3] = arch_fpstate->__fpu_xmm3;
+       context->fregs [X86_XMM4] = arch_fpstate->__fpu_xmm4;
+       context->fregs [X86_XMM5] = arch_fpstate->__fpu_xmm5;
+       context->fregs [X86_XMM6] = arch_fpstate->__fpu_xmm6;
+       context->fregs [X86_XMM7] = arch_fpstate->__fpu_xmm7;
 }
 
-
 int
 mono_mach_arch_get_thread_state_size ()
 {
        return sizeof (x86_thread_state32_t);
 }
 
+int
+mono_mach_arch_get_thread_fpstate_size ()
+{
+       return sizeof (x86_float_state32_t);
+}
+
 kern_return_t
-mono_mach_arch_get_thread_state (thread_port_t thread, thread_state_t state, mach_msg_type_number_t *count)
+mono_mach_arch_get_thread_states (thread_port_t thread, thread_state_t state, mach_msg_type_number_t *count, thread_state_t fpstate, mach_msg_type_number_t *fpcount)
 {
 #if defined(HOST_WATCHOS)
        g_error ("thread_get_state() is not supported by this platform");
 #else
        x86_thread_state32_t *arch_state = (x86_thread_state32_t *) state;
+       x86_float_state32_t *arch_fpstate = (x86_float_state32_t *) fpstate;
        kern_return_t ret;
 
        *count = x86_THREAD_STATE32_COUNT;
-       ret = thread_get_state (thread, x86_THREAD_STATE32, (thread_state_t) arch_state, count);
+       *fpcount = x86_FLOAT_STATE32_COUNT;
+
+       ret = thread_get_state (thread, x86_THREAD_STATE32, (thread_state_t)arch_state, count);
+       if (ret != KERN_SUCCESS)
+               return ret;
 
+       ret = thread_get_state (thread, x86_FLOAT_STATE32, (thread_state_t)arch_fpstate, fpcount);
        return ret;
 #endif
 }
 
 kern_return_t
-mono_mach_arch_set_thread_state (thread_port_t thread, thread_state_t state, mach_msg_type_number_t count)
+mono_mach_arch_set_thread_states (thread_port_t thread, thread_state_t state, mach_msg_type_number_t count, thread_state_t fpstate, mach_msg_type_number_t fpcount)
 {
 #if defined(HOST_WATCHOS)
        g_error ("thread_set_state() is not supported by this platform");
 #else
-       return thread_set_state (thread, x86_THREAD_STATE32, state, count);
+       kern_return_t ret;
+       ret = thread_set_state (thread, x86_THREAD_STATE32, state, count);
+       if (ret != KERN_SUCCESS)
+               return ret;
+       ret = thread_set_state (thread, x86_FLOAT_STATE32, fpstate, fpcount);
+       return ret;
 #endif 
 }
 
index abc135bd4eb8eb9987db2bb56f5bbf6aadf59093..9ac334c7171a729dbbf5bfbca16b6da1e4291087 100644 (file)
@@ -29,15 +29,17 @@ void *mono_mach_arch_get_sp (thread_state_t state);
 void mono_mach_init (pthread_key_t key);
 
 int mono_mach_arch_get_mcontext_size (void);
-void mono_mach_arch_thread_state_to_mcontext (thread_state_t state, void *context);
-void mono_mach_arch_mcontext_to_thread_state (void *context, thread_state_t state);
-void mono_mach_arch_thread_state_to_mono_context (thread_state_t state, MonoContext *context);
+void mono_mach_arch_thread_states_to_mcontext (thread_state_t state, thread_state_t fpstate, void *context);
+void mono_mach_arch_mcontext_to_thread_states (void *context, thread_state_t state, thread_state_t fpstate);
+void mono_mach_arch_thread_states_to_mono_context (thread_state_t state, thread_state_t fpstate, MonoContext *context);
 
+/* FIXME: Should return size_t, not int. */
 int mono_mach_arch_get_thread_state_size (void);
+int mono_mach_arch_get_thread_fpstate_size (void);
 kern_return_t mono_mach_get_threads (thread_act_array_t *threads, guint32 *count);
 kern_return_t mono_mach_free_threads (thread_act_array_t threads, guint32 count);
-kern_return_t mono_mach_arch_get_thread_state (thread_port_t thread, thread_state_t state, mach_msg_type_number_t *count);
-kern_return_t mono_mach_arch_set_thread_state (thread_port_t thread, thread_state_t state, mach_msg_type_number_t count);
+kern_return_t mono_mach_arch_get_thread_states (thread_port_t thread, thread_state_t state, mach_msg_type_number_t *count, thread_state_t fpstate, mach_msg_type_number_t *fpcount);
+kern_return_t mono_mach_arch_set_thread_states (thread_port_t thread, thread_state_t state, mach_msg_type_number_t count, thread_state_t fpstate, mach_msg_type_number_t fpcount);
 void *mono_mach_arch_get_tls_value_from_thread (pthread_t thread, guint32 key);
 void *mono_mach_get_tls_address_from_thread (pthread_t thread, pthread_key_t key);
 
index 83c2bdcc690dcf1847789d4491897350cf6dea90..f29a67ca096690a978db2922ef8717ce7afa1920 100644 (file)
@@ -115,9 +115,9 @@ codechunk_valloc (void *preferred, guint32 size)
                freelist = g_slist_delete_link (freelist, freelist);
                g_hash_table_insert (valloc_freelists, GUINT_TO_POINTER (size), freelist);
        } else {
-               ptr = mono_valloc (preferred, size, MONO_PROT_RWX | ARCH_MAP_FLAGS);
+               ptr = mono_valloc (preferred, size, MONO_PROT_RWX | ARCH_MAP_FLAGS, MONO_MEM_ACCOUNT_CODE);
                if (!ptr && preferred)
-                       ptr = mono_valloc (NULL, size, MONO_PROT_RWX | ARCH_MAP_FLAGS);
+                       ptr = mono_valloc (NULL, size, MONO_PROT_RWX | ARCH_MAP_FLAGS, MONO_MEM_ACCOUNT_CODE);
        }
        mono_os_mutex_unlock (&valloc_mutex);
        return ptr;
@@ -134,7 +134,7 @@ codechunk_vfree (void *ptr, guint32 size)
                freelist = g_slist_prepend (freelist, ptr);
                g_hash_table_insert (valloc_freelists, GUINT_TO_POINTER (size), freelist);
        } else {
-               mono_vfree (ptr, size);
+               mono_vfree (ptr, size, MONO_MEM_ACCOUNT_CODE);
        }
        mono_os_mutex_unlock (&valloc_mutex);
 }              
@@ -153,7 +153,7 @@ codechunk_cleanup (void)
                GSList *l;
 
                for (l = freelist; l; l = l->next) {
-                       mono_vfree (l->data, GPOINTER_TO_UINT (key));
+                       mono_vfree (l->data, GPOINTER_TO_UINT (key), MONO_MEM_ACCOUNT_CODE);
                }
                g_slist_free (freelist);
        }
@@ -234,7 +234,7 @@ free_chunklist (CodeChunk *chunk)
                        dlfree (dead->data);
                }
                code_memory_used -= dead->size;
-               free (dead);
+               g_free (dead);
        }
 }
 
@@ -249,7 +249,7 @@ mono_code_manager_destroy (MonoCodeManager *cman)
 {
        free_chunklist (cman->full);
        free_chunklist (cman->current);
-       free (cman);
+       g_free (cman);
 }
 
 /**
@@ -329,7 +329,7 @@ new_codechunk (CodeChunk *last, int dynamic, int size)
 {
        int minsize, flags = CODE_FLAG_MMAP;
        int chunk_size, bsize = 0;
-       int pagesize;
+       int pagesize, valloc_granule;
        CodeChunk *chunk;
        void *ptr;
 
@@ -338,12 +338,13 @@ new_codechunk (CodeChunk *last, int dynamic, int size)
 #endif
 
        pagesize = mono_pagesize ();
+       valloc_granule = mono_valloc_granule ();
 
        if (dynamic) {
                chunk_size = size;
                flags = CODE_FLAG_MALLOC;
        } else {
-               minsize = pagesize * MIN_PAGES;
+               minsize = MAX (pagesize * MIN_PAGES, valloc_granule);
                if (size < minsize)
                        chunk_size = minsize;
                else {
@@ -353,8 +354,8 @@ new_codechunk (CodeChunk *last, int dynamic, int size)
                        size += MIN_ALIGN - 1;
                        size &= ~(MIN_ALIGN - 1);
                        chunk_size = size;
-                       chunk_size += pagesize - 1;
-                       chunk_size &= ~ (pagesize - 1);
+                       chunk_size += valloc_granule - 1;
+                       chunk_size &= ~ (valloc_granule - 1);
                }
        }
 #ifdef BIND_ROOM
@@ -370,8 +371,8 @@ new_codechunk (CodeChunk *last, int dynamic, int size)
        if (chunk_size - size < bsize) {
                chunk_size = size + bsize;
                if (!dynamic) {
-                       chunk_size += pagesize - 1;
-                       chunk_size &= ~ (pagesize - 1);
+                       chunk_size += valloc_granule - 1;
+                       chunk_size &= ~ (valloc_granule - 1);
                }
        }
 #endif
@@ -398,12 +399,12 @@ new_codechunk (CodeChunk *last, int dynamic, int size)
 #endif
        }
 
-       chunk = (CodeChunk *) malloc (sizeof (CodeChunk));
+       chunk = (CodeChunk *) g_malloc (sizeof (CodeChunk));
        if (!chunk) {
                if (flags == CODE_FLAG_MALLOC)
                        dlfree (ptr);
                else
-                       mono_vfree (ptr, chunk_size);
+                       mono_vfree (ptr, chunk_size, MONO_MEM_ACCOUNT_CODE);
                return NULL;
        }
        chunk->next = NULL;
index 2b3b86e2ef2e305dd8de427b6eb4902b999283de..680c5a4cdded0ff203f10adf121c6dff8d416fa5 100644 (file)
 #define MONO_ATTR_USED
 #endif
 
+#ifdef __GNUC__
+#define MONO_ATTR_FORMAT_PRINTF(fmt_pos,arg_pos) __attribute__((format(printf,fmt_pos,arg_pos)))
+#else
+#define MONO_ATTR_FORMAT_PRINTF(fmt_pos,arg_pos)
+#endif
+
 #ifdef HAVE_KW_THREAD
 
 #define MONO_HAVE_FAST_TLS
 #include <direct.h>
 #define mkdir(x)       _mkdir(x)
 
-/* GCC specific functions aren't available */
-#define __builtin_return_address(x)    NULL
-
 #define __func__ __FUNCTION__
 
 #include <BaseTsd.h>
@@ -265,6 +268,13 @@ typedef SSIZE_T ssize_t;
 
 #endif /* _MSC_VER */
 
+#ifdef _MSC_VER
+// Quiet Visual Studio linker warning, LNK4221, in cases when this source file intentional ends up empty.
+#define MONO_EMPTY_SOURCE_FILE(x) void __mono_win32_ ## x ## _quiet_lnk4221 (void) {}
+#else
+#define MONO_EMPTY_SOURCE_FILE(x)
+#endif
+
 #if !defined(_MSC_VER) && !defined(PLATFORM_SOLARIS) && !defined(_WIN32) && !defined(__CYGWIN__) && !defined(MONOTOUCH) && HAVE_VISIBILITY_HIDDEN
 #if MONO_LLVM_LOADED
 #define MONO_LLVM_INTERNAL MONO_API
@@ -275,12 +285,6 @@ typedef SSIZE_T ssize_t;
 #define MONO_LLVM_INTERNAL 
 #endif
 
-#if HAVE_DEPRECATED
-#define MONO_DEPRECATED __attribute__ ((deprecated))
-#else
-#define MONO_DEPRECATED 
-#endif
-
 #ifdef __GNUC__
 #define MONO_ALWAYS_INLINE __attribute__((always_inline))
 #elif defined(_MSC_VER)
@@ -303,5 +307,9 @@ typedef SSIZE_T ssize_t;
 #define MONO_COLD
 #endif
 
+#if defined (__GNUC__) && defined (__GNUC_MINOR__) && defined (__GNUC_PATCHLEVEL__)
+#define MONO_GNUC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
+#endif
+
 #endif /* __UTILS_MONO_COMPILER_H__*/
 
index b5b3539d116c00eef3eba67d112ff9d521df3f9c..9b92493191ed1a08bad915c7ab7df8ecd6a5fcb5 100644 (file)
@@ -164,7 +164,7 @@ mono_conc_hashtable_lookup (MonoConcurrentHashTable *hash_table, gpointer key)
        hp = mono_hazard_pointer_get ();
 
 retry:
-       table = (conc_table *)get_hazardous_pointer ((gpointer volatile*)&hash_table->table, hp, 0);
+       table = (conc_table *)mono_get_hazardous_pointer ((gpointer volatile*)&hash_table->table, hp, 0);
        table_mask = table->table_size - 1;
        kvs = table->kvs;
        i = hash & table_mask;
index 632513d874f7c8069bd6a1ee0d57c23b1c06bdd3..3056c3afd3a63e31ed39b746dabc589cc0ccc6a1 100644 (file)
@@ -170,6 +170,26 @@ mono_sigctx_to_monoctx (void *sigctx, MonoContext *mctx)
        mctx->gregs [AMD64_R14] = UCONTEXT_REG_R14 (ctx);
        mctx->gregs [AMD64_R15] = UCONTEXT_REG_R15 (ctx);
        mctx->gregs [AMD64_RIP] = UCONTEXT_REG_RIP (ctx);
+
+#ifdef UCONTEXT_REG_XMM
+       mctx->fregs [0] = UCONTEXT_REG_XMM0 (ctx);
+       mctx->fregs [1] = UCONTEXT_REG_XMM1 (ctx);
+       mctx->fregs [2] = UCONTEXT_REG_XMM2 (ctx);
+       mctx->fregs [3] = UCONTEXT_REG_XMM3 (ctx);
+       mctx->fregs [4] = UCONTEXT_REG_XMM4 (ctx);
+       mctx->fregs [5] = UCONTEXT_REG_XMM5 (ctx);
+       mctx->fregs [6] = UCONTEXT_REG_XMM6 (ctx);
+       mctx->fregs [7] = UCONTEXT_REG_XMM7 (ctx);
+       mctx->fregs [8] = UCONTEXT_REG_XMM8 (ctx);
+       mctx->fregs [9] = UCONTEXT_REG_XMM9 (ctx);
+       mctx->fregs [10] = UCONTEXT_REG_XMM10 (ctx);
+       mctx->fregs [11] = UCONTEXT_REG_XMM11 (ctx);
+       mctx->fregs [12] = UCONTEXT_REG_XMM12 (ctx);
+       mctx->fregs [13] = UCONTEXT_REG_XMM13 (ctx);
+       mctx->fregs [14] = UCONTEXT_REG_XMM14 (ctx);
+       mctx->fregs [15] = UCONTEXT_REG_XMM15 (ctx);
+#endif
+
 #elif defined(HOST_WIN32)
        CONTEXT *context = (CONTEXT*)sigctx;
 
@@ -224,6 +244,26 @@ mono_monoctx_to_sigctx (MonoContext *mctx, void *sigctx)
        UCONTEXT_REG_R14 (ctx) = mctx->gregs [AMD64_R14];
        UCONTEXT_REG_R15 (ctx) = mctx->gregs [AMD64_R15];
        UCONTEXT_REG_RIP (ctx) = mctx->gregs [AMD64_RIP];
+
+#ifdef UCONTEXT_REG_XMM
+       UCONTEXT_REG_XMM0 (ctx) = mctx->fregs [0];
+       UCONTEXT_REG_XMM1 (ctx) = mctx->fregs [1];
+       UCONTEXT_REG_XMM2 (ctx) = mctx->fregs [2];
+       UCONTEXT_REG_XMM3 (ctx) = mctx->fregs [3];
+       UCONTEXT_REG_XMM4 (ctx) = mctx->fregs [4];
+       UCONTEXT_REG_XMM5 (ctx) = mctx->fregs [5];
+       UCONTEXT_REG_XMM6 (ctx) = mctx->fregs [6];
+       UCONTEXT_REG_XMM7 (ctx) = mctx->fregs [7];
+       UCONTEXT_REG_XMM8 (ctx) = mctx->fregs [8];
+       UCONTEXT_REG_XMM9 (ctx) = mctx->fregs [9];
+       UCONTEXT_REG_XMM10 (ctx) = mctx->fregs [10];
+       UCONTEXT_REG_XMM11 (ctx) = mctx->fregs [11];
+       UCONTEXT_REG_XMM12 (ctx) = mctx->fregs [12];
+       UCONTEXT_REG_XMM13 (ctx) = mctx->fregs [13];
+       UCONTEXT_REG_XMM14 (ctx) = mctx->fregs [14];
+       UCONTEXT_REG_XMM15 (ctx) = mctx->fregs [15];
+#endif
+
 #elif defined(HOST_WIN32)
        CONTEXT *context = (CONTEXT*)sigctx;
 
index 2704c8662a8d1e2919a99fb3afb91361a551bb1d..499c37846b714eea7f0e525f1b1dd04aed3e09e7 100644 (file)
 #include <signal.h>
 #endif
 
+#define MONO_CONTEXT_OFFSET(field, index, field_type) \
+    "i" (offsetof (MonoContext, field) + (index) * sizeof (field_type))
+
+#if defined(__APPLE__)
+typedef struct __darwin_xmm_reg MonoContextSimdReg;
+#endif
+
 /*
  * General notes about mono-context.
  * Each arch defines a MonoContext struct with all GPR regs + IP/PC.
@@ -87,6 +94,8 @@ struct sigcontext {
 # define SC_ESI esi
 #endif
 
+#include <mono/arch/x86/x86-codegen.h>
+
 typedef struct {
        mgreg_t eax;
        mgreg_t ebx;
@@ -97,6 +106,9 @@ typedef struct {
        mgreg_t esi;
        mgreg_t edi;
        mgreg_t eip;
+#ifdef __APPLE__
+    MonoContextSimdReg fregs [X86_XMM_NREG];
+#endif
 } MonoContext;
 
 #define MONO_CONTEXT_SET_IP(ctx,ip) do { (ctx)->eip = (mgreg_t)(ip); } while (0); 
@@ -129,18 +141,26 @@ typedef struct {
 #else
 #define MONO_CONTEXT_GET_CURRENT(ctx) \
        __asm__ __volatile__(   \
-       "movl $0x0, 0x00(%0)\n" \
-       "mov %%ebx, 0x04(%0)\n" \
-       "mov %%ecx, 0x08(%0)\n" \
-       "mov %%edx, 0x0c(%0)\n" \
-       "mov %%ebp, 0x10(%0)\n" \
-       "mov %%esp, 0x14(%0)\n" \
-       "mov %%esi, 0x18(%0)\n" \
-       "mov %%edi, 0x1c(%0)\n" \
+       "movl $0x0, %c[eax](%0)\n" \
+       "mov %%ebx, %c[ebx](%0)\n" \
+       "mov %%ecx, %c[ecx](%0)\n" \
+       "mov %%edx, %c[edx](%0)\n" \
+       "mov %%ebp, %c[ebp](%0)\n" \
+       "mov %%esp, %c[esp](%0)\n" \
+       "mov %%esi, %c[esi](%0)\n" \
+       "mov %%edi, %c[edi](%0)\n" \
        "call 1f\n"     \
        "1: pop 0x20(%0)\n"     \
        :       \
-       : "a" (&(ctx))  \
+       : "a" (&(ctx)), \
+               [eax] MONO_CONTEXT_OFFSET (eax, 0, mgreg_t), \
+               [ebx] MONO_CONTEXT_OFFSET (ebx, 0, mgreg_t), \
+               [ecx] MONO_CONTEXT_OFFSET (ecx, 0, mgreg_t), \
+               [edx] MONO_CONTEXT_OFFSET (edx, 0, mgreg_t), \
+               [ebp] MONO_CONTEXT_OFFSET (ebp, 0, mgreg_t), \
+               [esp] MONO_CONTEXT_OFFSET (esp, 0, mgreg_t), \
+               [esi] MONO_CONTEXT_OFFSET (esi, 0, mgreg_t), \
+               [edi] MONO_CONTEXT_OFFSET (edi, 0, mgreg_t) \
        : "memory")
 #endif
 
@@ -160,7 +180,11 @@ typedef struct {
 
 typedef struct {
        mgreg_t gregs [AMD64_NREG];
+#ifdef __APPLE__
+       MonoContextSimdReg fregs [AMD64_XMM_NREG];
+#else
        double fregs [AMD64_XMM_NREG];
+#endif
 } MonoContext;
 
 #define MONO_CONTEXT_SET_IP(ctx,ip) do { (ctx)->gregs [AMD64_RIP] = (mgreg_t)(ip); } while (0);
@@ -202,30 +226,98 @@ extern void mono_context_get_current (void *);
                : "rdx", "memory")
 #else
 
-#define MONO_CONTEXT_GET_CURRENT(ctx)  \
-       __asm__ __volatile__(   \
-               "movq $0x0,  0x00(%0)\n"        \
-               "movq %%rcx, 0x08(%0)\n"        \
-               "movq %%rdx, 0x10(%0)\n"        \
-               "movq %%rbx, 0x18(%0)\n"        \
-               "movq %%rsp, 0x20(%0)\n"        \
-               "movq %%rbp, 0x28(%0)\n"        \
-               "movq %%rsi, 0x30(%0)\n"        \
-               "movq %%rdi, 0x38(%0)\n"        \
-               "movq %%r8,  0x40(%0)\n"        \
-               "movq %%r9,  0x48(%0)\n"        \
-               "movq %%r10, 0x50(%0)\n"        \
-               "movq %%r11, 0x58(%0)\n"        \
-               "movq %%r12, 0x60(%0)\n"        \
-               "movq %%r13, 0x68(%0)\n"        \
-               "movq %%r14, 0x70(%0)\n"        \
-               "movq %%r15, 0x78(%0)\n"        \
-               /* "leaq (%%rip), %%rdx\n" is not understood by icc */  \
-               ".byte 0x48, 0x8d, 0x15, 0x00, 0x00, 0x00, 0x00\n" \
-               "movq %%rdx, 0x80(%0)\n"        \
-               :       \
-               : "a" (&(ctx))  \
-               : "rdx", "memory")
+#define MONO_CONTEXT_GET_CURRENT_GREGS(ctx) \
+       do { \
+               __asm__ __volatile__(   \
+                       "movq $0x0,  %c[rax](%0)\n"     \
+                       "movq %%rcx, %c[rcx](%0)\n"     \
+                       "movq %%rdx, %c[rdx](%0)\n"     \
+                       "movq %%rbx, %c[rbx](%0)\n"     \
+                       "movq %%rsp, %c[rsp](%0)\n"     \
+                       "movq %%rbp, %c[rbp](%0)\n"     \
+                       "movq %%rsi, %c[rsi](%0)\n"     \
+                       "movq %%rdi, %c[rdi](%0)\n"     \
+                       "movq %%r8,  %c[r8](%0)\n"      \
+                       "movq %%r9,  %c[r9](%0)\n"      \
+                       "movq %%r10, %c[r10](%0)\n"     \
+                       "movq %%r11, %c[r11](%0)\n"     \
+                       "movq %%r12, %c[r12](%0)\n"     \
+                       "movq %%r13, %c[r13](%0)\n"     \
+                       "movq %%r14, %c[r14](%0)\n"     \
+                       "movq %%r15, %c[r15](%0)\n"     \
+                       /* "leaq (%%rip), %%rdx\n" is not understood by icc */  \
+                       ".byte 0x48, 0x8d, 0x15, 0x00, 0x00, 0x00, 0x00\n" \
+                       "movq %%rdx, %c[rip](%0)\n"     \
+                       :       \
+                       : "a" (&(ctx)), \
+                               [rax] MONO_CONTEXT_OFFSET (gregs, AMD64_RAX, mgreg_t),  \
+                               [rcx] MONO_CONTEXT_OFFSET (gregs, AMD64_RCX, mgreg_t),  \
+                               [rdx] MONO_CONTEXT_OFFSET (gregs, AMD64_RDX, mgreg_t),  \
+                               [rbx] MONO_CONTEXT_OFFSET (gregs, AMD64_RBX, mgreg_t),  \
+                               [rsp] MONO_CONTEXT_OFFSET (gregs, AMD64_RSP, mgreg_t),  \
+                               [rbp] MONO_CONTEXT_OFFSET (gregs, AMD64_RBP, mgreg_t),  \
+                               [rsi] MONO_CONTEXT_OFFSET (gregs, AMD64_RSI, mgreg_t),  \
+                               [rdi] MONO_CONTEXT_OFFSET (gregs, AMD64_RDI, mgreg_t),  \
+                               [r8] MONO_CONTEXT_OFFSET (gregs, AMD64_R8, mgreg_t), \
+                               [r9] MONO_CONTEXT_OFFSET (gregs, AMD64_R9, mgreg_t), \
+                               [r10] MONO_CONTEXT_OFFSET (gregs, AMD64_R10, mgreg_t),  \
+                               [r11] MONO_CONTEXT_OFFSET (gregs, AMD64_R11, mgreg_t),  \
+                               [r12] MONO_CONTEXT_OFFSET (gregs, AMD64_R12, mgreg_t),  \
+                               [r13] MONO_CONTEXT_OFFSET (gregs, AMD64_R13, mgreg_t),  \
+                               [r14] MONO_CONTEXT_OFFSET (gregs, AMD64_R14, mgreg_t),  \
+                               [r15] MONO_CONTEXT_OFFSET (gregs, AMD64_R15, mgreg_t),  \
+                               [rip] MONO_CONTEXT_OFFSET (gregs, AMD64_RIP, mgreg_t)   \
+                       : "rdx", "memory");     \
+       } while (0)
+
+#ifdef UCONTEXT_REG_XMM
+#define MONO_CONTEXT_GET_CURRENT_FREGS(ctx) \
+       do { \
+               __asm__ __volatile__ ( \
+                       "movups %%xmm0, %c[xmm0](%0)\n" \
+                       "movups %%xmm1, %c[xmm1](%0)\n" \
+                       "movups %%xmm2, %c[xmm2](%0)\n" \
+                       "movups %%xmm3, %c[xmm3](%0)\n" \
+                       "movups %%xmm4, %c[xmm4](%0)\n" \
+                       "movups %%xmm5, %c[xmm5](%0)\n" \
+                       "movups %%xmm6, %c[xmm6](%0)\n" \
+                       "movups %%xmm7, %c[xmm7](%0)\n" \
+                       "movups %%xmm8, %c[xmm8](%0)\n" \
+                       "movups %%xmm9, %c[xmm9](%0)\n" \
+                       "movups %%xmm10, %c[xmm10](%0)\n"       \
+                       "movups %%xmm11, %c[xmm11](%0)\n"       \
+                       "movups %%xmm12, %c[xmm12](%0)\n"       \
+                       "movups %%xmm12, %c[xmm12](%0)\n"       \
+                       "movups %%xmm14, %c[xmm14](%0)\n"       \
+                       "movups %%xmm15, %c[xmm15](%0)\n"       \
+                       : \
+                       : "a" (&(ctx)), \
+                               [xmm0] MONO_CONTEXT_OFFSET (fregs, AMD64_XMM0, MonoContextSimdReg), \
+                               [xmm1] MONO_CONTEXT_OFFSET (fregs, AMD64_XMM1, MonoContextSimdReg), \
+                               [xmm2] MONO_CONTEXT_OFFSET (fregs, AMD64_XMM2, MonoContextSimdReg), \
+                               [xmm3] MONO_CONTEXT_OFFSET (fregs, AMD64_XMM3, MonoContextSimdReg), \
+                               [xmm4] MONO_CONTEXT_OFFSET (fregs, AMD64_XMM4, MonoContextSimdReg), \
+                               [xmm5] MONO_CONTEXT_OFFSET (fregs, AMD64_XMM5, MonoContextSimdReg), \
+                               [xmm6] MONO_CONTEXT_OFFSET (fregs, AMD64_XMM6, MonoContextSimdReg), \
+                               [xmm7] MONO_CONTEXT_OFFSET (fregs, AMD64_XMM7, MonoContextSimdReg), \
+                               [xmm8] MONO_CONTEXT_OFFSET (fregs, AMD64_XMM8, MonoContextSimdReg), \
+                               [xmm9] MONO_CONTEXT_OFFSET (fregs, AMD64_XMM9, MonoContextSimdReg), \
+                               [xmm10] MONO_CONTEXT_OFFSET (fregs, AMD64_XMM10, MonoContextSimdReg), \
+                               [xmm11] MONO_CONTEXT_OFFSET (fregs, AMD64_XMM11, MonoContextSimdReg), \
+                               [xmm12] MONO_CONTEXT_OFFSET (fregs, AMD64_XMM12, MonoContextSimdReg), \
+                               [xmm13] MONO_CONTEXT_OFFSET (fregs, AMD64_XMM13, MonoContextSimdReg), \
+                               [xmm14] MONO_CONTEXT_OFFSET (fregs, AMD64_XMM14, MonoContextSimdReg), \
+                               [xmm15] MONO_CONTEXT_OFFSET (fregs, AMD64_XMM15, MonoContextSimdReg));  \
+       } while (0)
+#else
+#define MONO_CONTEXT_GET_CURRENT_FREGS(ctx)
+#endif
+
+#define MONO_CONTEXT_GET_CURRENT(ctx) \
+    do {       \
+               MONO_CONTEXT_GET_CURRENT_GREGS(ctx);    \
+               MONO_CONTEXT_GET_CURRENT_FREGS(ctx);    \
+       } while (0)
 #endif
 
 #define MONO_ARCH_HAS_MONO_CONTEXT 1
@@ -264,15 +356,15 @@ typedef struct {
                "push {r0}\n"                           \
                "push {r1}\n"                           \
                "mov r0, %0\n"                          \
-               "ldr r1, [sp, #4]\n"                    \
-               "str r1, [r0]!\n"                       \
-               "ldr r1, [sp, #0]\n"                    \
-               "str r1, [r0]!\n"                       \
+               "ldr r1, [sp, #4]\n"            \
+               "str r1, [r0], #4\n"            \
+               "ldr r1, [sp, #0]\n"            \
+               "str r1, [r0], #4\n"            \
                "stmia r0!, {r2-r12}\n"         \
-               "str sp, [r0]!\n"                       \
-               "str lr, [r0]!\n"                       \
+               "str sp, [r0], #4\n"            \
+               "str lr, [r0], #4\n"            \
                "mov r1, pc\n"                          \
-               "str r1, [r0]!\n"                       \
+               "str r1, [r0], #4\n"            \
                "pop {r1}\n"                            \
                "pop {r0}\n"                            \
                :                                                       \
@@ -294,6 +386,11 @@ typedef struct {
        mgreg_t regs [32];
        double fregs [32];
        mgreg_t pc;
+       /*
+        * fregs might not be initialized if this context was created from a
+        * ucontext.
+        */
+       mgreg_t has_fregs;
 } MonoContext;
 
 #define MONO_CONTEXT_SET_IP(ctx,ip) do { (ctx)->pc = (mgreg_t)ip; } while (0)
@@ -313,7 +410,7 @@ typedef struct {
        thread_port_t self = mach_thread_self ();       \
        kern_return_t ret = thread_get_state (self, state_flavor, (thread_state_t) &thread_state, &state_count);        \
        g_assert (ret == 0);    \
-       mono_mach_arch_thread_state_to_mono_context ((thread_state_t)&thread_state, &ctx); \
+       mono_mach_arch_thread_states_to_mono_context ((thread_state_t)&thread_state, (thread_state_t)NULL, &ctx); \
        mach_port_deallocate (current_task (), self);   \
 } while (0);
 
@@ -476,40 +573,40 @@ typedef struct {
 
 #define MONO_CONTEXT_GET_CURRENT(ctx)  \
        __asm__ __volatile__(   \
-               "std 0, 0(%0)\n"        \
-               "std 1, 4(%0)\n"        \
-               "std 0, 4*0+8(%0)\n"    \
-               "std 1, 4*1+8(%0)\n"    \
-               "std 2, 4*2+8(%0)\n"    \
-               "std 3, 4*3+8(%0)\n"    \
-               "std 4, 4*4+8(%0)\n"    \
-               "std 5, 4*5+8(%0)\n"    \
-               "std 6, 4*6+8(%0)\n"    \
-               "std 7, 4*7+8(%0)\n"    \
-               "std 8, 4*8+8(%0)\n"    \
-               "std 9, 4*9+8(%0)\n"    \
-               "std 10, 4*10+8(%0)\n"  \
-               "std 11, 4*11+8(%0)\n"  \
-               "std 12, 4*12+8(%0)\n"  \
-               "std 13, 4*13+8(%0)\n"  \
-               "std 14, 4*14+8(%0)\n"  \
-               "std 15, 4*15+8(%0)\n"  \
-               "std 16, 4*16+8(%0)\n"  \
-               "std 17, 4*17+8(%0)\n"  \
-               "std 18, 4*18+8(%0)\n"  \
-               "std 19, 4*19+8(%0)\n"  \
-               "std 20, 4*20+8(%0)\n"  \
-               "std 21, 4*21+8(%0)\n"  \
-               "std 22, 4*22+8(%0)\n"  \
-               "std 23, 4*23+8(%0)\n"  \
-               "std 24, 4*24+8(%0)\n"  \
-               "std 25, 4*25+8(%0)\n"  \
-               "std 26, 4*26+8(%0)\n"  \
-               "std 27, 4*27+8(%0)\n"  \
-               "std 28, 4*28+8(%0)\n"  \
-               "std 29, 4*29+8(%0)\n"  \
-               "std 30, 4*30+8(%0)\n"  \
-               "std 31, 4*31+8(%0)\n"  \
+               "stw 0, 0(%0)\n"        \
+               "stw 1, 4(%0)\n"        \
+               "stw 0, 4*0+8(%0)\n"    \
+               "stw 1, 4*1+8(%0)\n"    \
+               "stw 2, 4*2+8(%0)\n"    \
+               "stw 3, 4*3+8(%0)\n"    \
+               "stw 4, 4*4+8(%0)\n"    \
+               "stw 5, 4*5+8(%0)\n"    \
+               "stw 6, 4*6+8(%0)\n"    \
+               "stw 7, 4*7+8(%0)\n"    \
+               "stw 8, 4*8+8(%0)\n"    \
+               "stw 9, 4*9+8(%0)\n"    \
+               "stw 10, 4*10+8(%0)\n"  \
+               "stw 11, 4*11+8(%0)\n"  \
+               "stw 12, 4*12+8(%0)\n"  \
+               "stw 13, 4*13+8(%0)\n"  \
+               "stw 14, 4*14+8(%0)\n"  \
+               "stw 15, 4*15+8(%0)\n"  \
+               "stw 16, 4*16+8(%0)\n"  \
+               "stw 17, 4*17+8(%0)\n"  \
+               "stw 18, 4*18+8(%0)\n"  \
+               "stw 19, 4*19+8(%0)\n"  \
+               "stw 20, 4*20+8(%0)\n"  \
+               "stw 21, 4*21+8(%0)\n"  \
+               "stw 22, 4*22+8(%0)\n"  \
+               "stw 23, 4*23+8(%0)\n"  \
+               "stw 24, 4*24+8(%0)\n"  \
+               "stw 25, 4*25+8(%0)\n"  \
+               "stw 26, 4*26+8(%0)\n"  \
+               "stw 27, 4*27+8(%0)\n"  \
+               "stw 28, 4*28+8(%0)\n"  \
+               "stw 29, 4*29+8(%0)\n"  \
+               "stw 30, 4*30+8(%0)\n"  \
+               "stw 31, 4*31+8(%0)\n"  \
                "stfd 0, 8*0+4*32+8(%0)\n"      \
                "stfd 1, 8*1+4*32+8(%0)\n"      \
                "stfd 2, 8*2+4*32+8(%0)\n"      \
@@ -543,7 +640,7 @@ typedef struct {
                "stfd 30, 8*30+4*32+8(%0)\n"    \
                "stfd 31, 8*31+4*32+8(%0)\n"    \
                : : "r" (&(ctx))        \
-               : "memory"                      \
+               : "memory", "r0"        \
        )
 
 #endif
@@ -699,6 +796,8 @@ mono_ia64_context_get_fp (MonoContext *ctx)
 
 #elif ((defined(__mips__) && !defined(MONO_CROSS_COMPILE)) || (defined(TARGET_MIPS))) && SIZEOF_REGISTER == 4 /* defined(__ia64__) */
 
+#define MONO_ARCH_HAS_MONO_CONTEXT 1
+
 #include <mono/arch/mips/mips-codegen.h>
 
 typedef struct {
index 1bd0a646054f2e7e7586ad1e8b46b4ce2c215969..cf631d04ffd1ffbab5ad389a20239da3fa6acf4a 100644 (file)
@@ -35,10 +35,10 @@ mono_coop_mutex_init_recursive (MonoCoopMutex *mutex)
        mono_os_mutex_init_recursive (&mutex->m);
 }
 
-static inline gint
+static inline void
 mono_coop_mutex_destroy (MonoCoopMutex *mutex)
 {
-       return mono_os_mutex_destroy (&mutex->m);
+       mono_os_mutex_destroy (&mutex->m);
 }
 
 static inline void
@@ -73,10 +73,10 @@ mono_coop_cond_init (MonoCoopCond *cond)
        mono_os_cond_init (&cond->c);
 }
 
-static inline gint
+static inline void
 mono_coop_cond_destroy (MonoCoopCond *cond)
 {
-       return mono_os_cond_destroy (&cond->c);
+       mono_os_cond_destroy (&cond->c);
 }
 
 static inline void
index 2ca19a8b3d645fca66230e58f15d4b0e2b9cccf2..f867960803ba46f7c81f828b8a4e56fc614fd382 100644 (file)
@@ -166,7 +166,7 @@ register_internal (const char *name, int type, void *addr, int size)
                }
        }
 
-       counter = (MonoCounter *) malloc (sizeof (MonoCounter));
+       counter = (MonoCounter *) g_malloc (sizeof (MonoCounter));
        if (!counter) {
                mono_os_mutex_unlock (&counters_mutex);
                return;
@@ -347,6 +347,13 @@ page_faults (void)
        return mono_process_get_data (GINT_TO_POINTER (mono_process_current_pid ()), MONO_PROCESS_FAULTS);
 }
 
+
+// If cpu_load gets inlined on Windows then cpu_load_1min, cpu_load_5min and cpu_load_15min can be folded into a single function and that will
+// cause a failure when registering counters since the same function address will be used by all three functions. Preventing this method from being inlined
+// will make sure the registered callback functions remains unique.
+#ifdef _MSC_VER
+__declspec(noinline)
+#endif
 static double
 cpu_load (int kind)
 {
@@ -648,8 +655,8 @@ mono_counters_cleanup (void)
        while (counter) {
                MonoCounter *tmp = counter;
                counter = counter->next;
-               free ((void*)tmp->name);
-               free (tmp);
+               g_free ((void*)tmp->name);
+               g_free (tmp);
        }
 
        mono_os_mutex_unlock (&counters_mutex);
diff --git a/mono/utils/mono-dl-windows-internals.h b/mono/utils/mono-dl-windows-internals.h
new file mode 100644 (file)
index 0000000..5215418
--- /dev/null
@@ -0,0 +1,14 @@
+#ifndef __MONO_UTILS_DL_WINDOWS_H__
+#define __MONO_UTILS_DL_WINDOWS_H__
+
+#include <config.h>
+#include <glib.h>
+
+#ifdef HOST_WIN32
+#include "mono/utils/mono-dl.h"
+
+void*
+mono_dl_lookup_symbol_in_process (const char *symbol_name);
+#endif /* HOST_WIN32 */
+#endif /* __MONO_UTILS_DL_WINDOWS_H__ */
+
diff --git a/mono/utils/mono-dl-windows-uwp.c b/mono/utils/mono-dl-windows-uwp.c
new file mode 100644 (file)
index 0000000..36ade1f
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * mono-dl-windows-uwp.c: UWP dl support for Mono.
+ *
+ * Copyright 2016 Microsoft
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
+*/
+#include <config.h>
+#include <glib.h>
+#include "mono/utils/mono-compiler.h"
+
+#if G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT)
+#include <windows.h>
+#include "mono/utils/mono-dl-windows-internals.h"
+
+void*
+mono_dl_lookup_symbol_in_process (const char *symbol_name)
+{
+       g_unsupported_api ("EnumProcessModules");
+       SetLastError (ERROR_NOT_SUPPORTED);
+
+       return NULL;
+}
+
+char*
+mono_dl_current_error_string (void)
+{
+       char *ret = NULL;
+       TCHAR buf [1024];
+       DWORD code = GetLastError ();
+
+       if (!FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL,
+               code, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), buf, G_N_ELEMENTS(buf) - 1, NULL))
+               buf[0] = TEXT('\0');
+
+       ret = u16to8 (buf);
+       return ret;
+}
+
+#else /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
+
+MONO_EMPTY_SOURCE_FILE (mono_dl_windows_uwp);
+#endif /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
index 9e3efa796f7aa93503ab2fa1712d2be476519c73..32eaac799b6cae03ebef2cc16efd1584cb29cc09 100644 (file)
@@ -13,6 +13,7 @@
 #if defined(HOST_WIN32)
 
 #include "mono/utils/mono-dl.h"
+#include "mono/utils/mono-dl-windows-internals.h"
 #include "mono/utils/mono-embed.h"
 #include "mono/utils/mono-path.h"
 
@@ -25,7 +26,6 @@
 #include <windows.h>
 #include <psapi.h>
 
-
 const char*
 mono_dl_get_so_prefix (void)
 {
@@ -48,14 +48,20 @@ mono_dl_open_file (const char *file, int flags)
        gpointer hModule = NULL;
        if (file) {
                gunichar2* file_utf16 = g_utf8_to_utf16 (file, strlen (file), NULL, NULL, NULL);
+
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
                guint last_sem = SetErrorMode (SEM_FAILCRITICALERRORS);
+#endif
                guint32 last_error = 0;
 
                hModule = LoadLibrary (file_utf16);
                if (!hModule)
                        last_error = GetLastError ();
 
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
                SetErrorMode (last_sem);
+#endif
+
                g_free (file_utf16);
 
                if (!hModule)
@@ -73,23 +79,15 @@ mono_dl_close_handle (MonoDl *module)
                FreeLibrary (module->handle);
 }
 
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
 void*
-mono_dl_lookup_symbol (MonoDl *module, const char *symbol_name)
+mono_dl_lookup_symbol_in_process (const char *symbol_name)
 {
        HMODULE *modules;
        DWORD buffer_size = sizeof (HMODULE) * 1024;
        DWORD needed, i;
        gpointer proc = NULL;
 
-       /* get the symbol directly from the specified module */
-       if (!module->main_module)
-               return GetProcAddress (module->handle, symbol_name);
-
-       /* get the symbol from the main module */
-       proc = GetProcAddress (module->handle, symbol_name);
-       if (proc != NULL)
-               return proc;
-
        /* get the symbol from the loaded DLLs */
        modules = (HMODULE *) g_malloc (buffer_size);
        if (modules == NULL)
@@ -129,6 +127,25 @@ mono_dl_lookup_symbol (MonoDl *module, const char *symbol_name)
        g_free (modules);
        return NULL;
 }
+#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */
+
+void*
+mono_dl_lookup_symbol (MonoDl *module, const char *symbol_name)
+{
+       gpointer proc = NULL;
+
+       /* get the symbol directly from the specified module */
+       if (!module->main_module)
+               return GetProcAddress (module->handle, symbol_name);
+
+       /* get the symbol from the main module */
+       proc = GetProcAddress (module->handle, symbol_name);
+       if (proc != NULL)
+               return proc;
+
+       /* get the symbol from the loaded DLLs */
+       return mono_dl_lookup_symbol_in_process (symbol_name);
+}
 
 int
 mono_dl_convert_flags (int flags)
@@ -136,6 +153,7 @@ mono_dl_convert_flags (int flags)
        return 0;
 }
 
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
 char*
 mono_dl_current_error_string (void)
 {
@@ -153,6 +171,7 @@ mono_dl_current_error_string (void)
        }
        return ret;
 }
+#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */
 
 int
 mono_dl_get_executable_path (char *buf, int buflen)
@@ -165,5 +184,4 @@ mono_dl_get_system_dir (void)
 {
        return NULL;
 }
-
 #endif
index 43116130309eec7195e24a87f8d39e10e544dbce..6c0f582cf6d1ddc170d86bf4f6fb40374138525a 100644 (file)
@@ -140,7 +140,7 @@ mono_dl_open (const char *name, int flags, char **error_msg)
        if (error_msg)
                *error_msg = NULL;
 
-       module = (MonoDl *) malloc (sizeof (MonoDl));
+       module = (MonoDl *) g_malloc (sizeof (MonoDl));
        if (!module) {
                if (error_msg)
                        *error_msg = g_strdup ("Out of memory");
@@ -174,7 +174,7 @@ mono_dl_open (const char *name, int flags, char **error_msg)
                const char *ext;
                /* This platform does not support dlopen */
                if (name == NULL) {
-                       free (module);
+                       g_free (module);
                        return NULL;
                }
                
@@ -193,7 +193,7 @@ mono_dl_open (const char *name, int flags, char **error_msg)
                        if (error_msg) {
                                *error_msg = mono_dl_current_error_string ();
                        }
-                       free (module);
+                       g_free (module);
                        return NULL;
                }
        }
@@ -224,11 +224,11 @@ mono_dl_symbol (MonoDl *module, const char *name, void **symbol)
        } else {
 #if MONO_DL_NEED_USCORE
                {
-                       char *usname = malloc (strlen (name) + 2);
+                       char *usname = g_malloc (strlen (name) + 2);
                        *usname = '_';
                        strcpy (usname + 1, name);
                        sym = mono_dl_lookup_symbol (module, usname);
-                       free (usname);
+                       g_free (usname);
                }
 #else
                sym = mono_dl_lookup_symbol (module, name);
@@ -264,7 +264,7 @@ mono_dl_close (MonoDl *module)
        } else
                mono_dl_close_handle (module);
        
-       free (module);
+       g_free (module);
 }
 
 /**
index e143901748d710d2e2f8bce87d31b0bf32dbe102..c74923c00944b34d83aa5c2da0cc4a2fa19931d4 100644 (file)
@@ -32,6 +32,12 @@ typedef struct {
        void *padding [3];
 } MonoErrorInternal;
 
+/* Invariant: the error strings are allocated in the mempool of the given image */
+struct _MonoErrorBoxed {
+       MonoError error;
+       MonoImage *image;
+};
+
 #define error_init(error) do { \
        ((MonoErrorInternal*)(error))->error_code = MONO_ERROR_NONE;    \
        ((MonoErrorInternal*)(error))->flags = 0;       \
@@ -57,64 +63,67 @@ mono_error_dup_strings (MonoError *error, gboolean dup_strings);
 
 /* This function is not very useful as you can't provide any details beyond the message.*/
 void
-mono_error_set_error (MonoError *error, int error_code, const char *msg_format, ...);
+mono_error_set_error (MonoError *error, int error_code, const char *msg_format, ...) MONO_ATTR_FORMAT_PRINTF(3,4);
 
 void
-mono_error_set_assembly_load (MonoError *error, const char *assembly_name, const char *msg_format, ...);
+mono_error_set_assembly_load (MonoError *error, const char *assembly_name, const char *msg_format, ...) MONO_ATTR_FORMAT_PRINTF(3,4);
 
 void
 mono_error_set_assembly_load_simple (MonoError *error, const char *assembly_name, gboolean refection_only);
 
 void
-mono_error_set_type_load_class (MonoError *error, MonoClass *klass, const char *msg_format, ...);
+mono_error_set_type_load_class (MonoError *error, MonoClass *klass, const char *msg_format, ...) MONO_ATTR_FORMAT_PRINTF(3,4);
+
+void
+mono_error_vset_type_load_class (MonoError *error, MonoClass *klass, const char *msg_format, va_list args);
 
 void
-mono_error_set_type_load_name (MonoError *error, const char *type_name, const char *assembly_name, const char *msg_format, ...);
+mono_error_set_type_load_name (MonoError *error, const char *type_name, const char *assembly_name, const char *msg_format, ...) MONO_ATTR_FORMAT_PRINTF(4,5);
 
 void
-mono_error_set_method_load (MonoError *error, MonoClass *klass, const char *method_name, const char *msg_format, ...);
+mono_error_set_method_load (MonoError *error, MonoClass *klass, const char *method_name, const char *msg_format, ...) MONO_ATTR_FORMAT_PRINTF(4,5);
 
 void
-mono_error_set_field_load (MonoError *error, MonoClass *klass, const char *field_name, const char *msg_format, ...);
+mono_error_set_field_load (MonoError *error, MonoClass *klass, const char *field_name, const char *msg_format, ...)  MONO_ATTR_FORMAT_PRINTF(4,5);
 
 void
-mono_error_set_bad_image (MonoError *error, MonoImage *image, const char *msg_format, ...);
+mono_error_set_bad_image (MonoError *error, MonoImage *image, const char *msg_format, ...) MONO_ATTR_FORMAT_PRINTF(3,4);
 
 void
-mono_error_set_bad_image_name (MonoError *error, const char *file_name, const char *msg_format, ...);
+mono_error_set_bad_image_name (MonoError *error, const char *file_name, const char *msg_format, ...) MONO_ATTR_FORMAT_PRINTF(3,4);
 
 void
-mono_error_set_out_of_memory (MonoError *error, const char *msg_format, ...);
+mono_error_set_out_of_memory (MonoError *error, const char *msg_format, ...) MONO_ATTR_FORMAT_PRINTF(2,3);
 
 void
-mono_error_set_argument (MonoError *error, const char *argument, const char *msg_format, ...);
+mono_error_set_argument (MonoError *error, const char *argument, const char *msg_format, ...) MONO_ATTR_FORMAT_PRINTF(3,4);
 
 void
-mono_error_set_argument_null (MonoError *oerror, const char *argument, const char *msg_format, ...);
+mono_error_set_argument_null (MonoError *oerror, const char *argument, const char *msg_format, ...) MONO_ATTR_FORMAT_PRINTF(3,4);
 
 void
-mono_error_set_not_verifiable (MonoError *oerror, MonoMethod *method, const char *msg_format, ...);
+mono_error_set_not_verifiable (MonoError *oerror, MonoMethod *method, const char *msg_format, ...) MONO_ATTR_FORMAT_PRINTF(3,4);
 
 void
-mono_error_set_generic_error (MonoError *error, const char * name_space, const char *name, const char *msg_format, ...);
+mono_error_set_generic_error (MonoError *error, const char * name_space, const char *name, const char *msg_format, ...) MONO_ATTR_FORMAT_PRINTF(4,5);
 
 void
-mono_error_set_execution_engine (MonoError *error, const char *msg_format, ...);
+mono_error_set_execution_engine (MonoError *error, const char *msg_format, ...) MONO_ATTR_FORMAT_PRINTF(2,3);
 
 void
-mono_error_set_not_implemented (MonoError *error, const char *msg_format, ...);
+mono_error_set_not_implemented (MonoError *error, const char *msg_format, ...) MONO_ATTR_FORMAT_PRINTF(2,3);
 
 void
-mono_error_set_not_supported (MonoError *error, const char *msg_format, ...);
+mono_error_set_not_supported (MonoError *error, const char *msg_format, ...) MONO_ATTR_FORMAT_PRINTF(2,3);
 
 void
-mono_error_set_invalid_operation (MonoError *error, const char *msg_format, ...);
+mono_error_set_invalid_operation (MonoError *error, const char *msg_format, ...) MONO_ATTR_FORMAT_PRINTF(2,3);
 
 void
 mono_error_set_exception_instance (MonoError *error, MonoException *exc);
 
 void
-mono_error_set_invalid_program (MonoError *oerror, const char *msg_format, ...);
+mono_error_set_invalid_program (MonoError *oerror, const char *msg_format, ...) MONO_ATTR_FORMAT_PRINTF(2,3);
 
 MonoException*
 mono_error_prepare_exception (MonoError *error, MonoError *error_out);
@@ -128,4 +137,11 @@ mono_error_raise_exception (MonoError *error);
 void
 mono_error_move (MonoError *dest, MonoError *src);
 
+MonoErrorBoxed*
+mono_error_box (const MonoError *error, MonoImage *image);
+
+gboolean
+mono_error_set_from_boxed (MonoError *error, const MonoErrorBoxed *from);
+
+
 #endif
index 7e186b6b717ce06b2f4103bb2ab3abe22e5ce2df..66a3e169ab77d80ec5cb8d25832debc848c2afe1 100644 (file)
@@ -38,6 +38,12 @@ is_managed_exception (MonoErrorInternal *error)
        return (error->error_code == MONO_ERROR_EXCEPTION_INSTANCE);
 }
 
+static gboolean
+is_boxed (MonoErrorInternal *error)
+{
+       return ((error->flags & MONO_ERROR_MEMPOOL_BOXED) != 0);
+}
+
 static void
 mono_error_prepare (MonoErrorInternal *error)
 {
@@ -116,6 +122,8 @@ mono_error_cleanup (MonoError *oerror)
 
        /* Two cleanups in a row without an intervening init. */
        g_assert (orig_error_code != MONO_ERROR_CLEANUP_CALLED_SENTINEL);
+       /* Mempool stored error shouldn't be cleaned up */
+       g_assert (!is_boxed (error));
 
        /* Mark it as cleaned up. */
        error->error_code = MONO_ERROR_CLEANUP_CALLED_SENTINEL;
@@ -289,18 +297,27 @@ mono_error_set_assembly_load_simple (MonoError *oerror, const char *assembly_nam
        if (refection_only)
                mono_error_set_assembly_load (oerror, assembly_name, "Cannot resolve dependency to assembly because it has not been preloaded. When using the ReflectionOnly APIs, dependent assemblies must be pre-loaded or loaded on demand through the ReflectionOnlyAssemblyResolve event.");
        else
-               mono_error_set_assembly_load (oerror, assembly_name, "Could not load file or assembly or one of its dependencies.");
+               mono_error_set_assembly_load (oerror, assembly_name, "Could not load file or assembly '%s' or one of its dependencies.", assembly_name);
 }
 
 void
 mono_error_set_type_load_class (MonoError *oerror, MonoClass *klass, const char *msg_format, ...)
+{
+       va_list args;
+       va_start (args, msg_format);
+       mono_error_vset_type_load_class (oerror, klass, msg_format, args);
+       va_end (args);
+}
+
+void
+mono_error_vset_type_load_class (MonoError *oerror, MonoClass *klass, const char *msg_format, va_list args)
 {
        MonoErrorInternal *error = (MonoErrorInternal*)oerror;
        mono_error_prepare (error);
 
        error->error_code = MONO_ERROR_TYPE_LOAD;
        mono_error_set_class (oerror, klass);
-       set_error_message ();
+       set_error_messagev ();
 }
 
 /*
@@ -618,7 +635,7 @@ mono_error_prepare_exception (MonoError *oerror, MonoError *error_out)
                        }
 
                        exception = mono_exception_from_name_two_strings_checked (mono_get_corlib (), "System", "TypeLoadException", type_name, assembly_name, error_out);
-                       if (exception)
+                       if (exception && error->full_message != NULL && strcmp (error->full_message, ""))
                                set_message_on_exception (exception, error, error_out);
                } else {
                        exception = mono_exception_from_name_msg (mono_defaults.corlib, "System", "TypeLoadException", error->full_message);
@@ -730,6 +747,9 @@ mono_error_convert_to_exception (MonoError *target_error)
        MonoError error;
        MonoException *ex;
 
+       /* Mempool stored error shouldn't be cleaned up */
+       g_assert (!is_boxed ((MonoErrorInternal*)target_error));
+
        if (mono_error_ok (target_error))
                return NULL;
 
@@ -752,3 +772,97 @@ mono_error_move (MonoError *dest, MonoError *src)
        memcpy (dest, src, sizeof (MonoErrorInternal));
        mono_error_init (src);
 }
+
+/**
+ * mono_error_box:
+ * @ierror: The input error that will be boxed.
+ * @image: The mempool of this image will hold the boxed error.
+ *
+ * Creates a new boxed error in the given mempool from MonoError.
+ * It does not alter ierror, so you still have to clean it up with
+ * mono_error_cleanup or mono_error_convert_to_exception or another such function.
+ *
+ * Returns the boxed error, or NULL if the mempool could not allocate.
+ */
+MonoErrorBoxed*
+mono_error_box (const MonoError *ierror, MonoImage *image)
+{
+       MonoErrorInternal *from = (MonoErrorInternal*)ierror;
+       /* Don't know how to box a gchandle */
+       g_assert (!is_managed_exception (from));
+       MonoErrorBoxed* box = mono_image_alloc (image, sizeof (MonoErrorBoxed));
+       box->image = image;
+       mono_error_init_flags (&box->error, MONO_ERROR_MEMPOOL_BOXED);
+       MonoErrorInternal *to = (MonoErrorInternal*)&box->error;
+
+#define DUP_STR(field) do {                                            \
+               if (from->field) {                                      \
+                       if (!(to->field = mono_image_strdup (image, from->field))) \
+                               to->flags |= MONO_ERROR_INCOMPLETE;     \
+               } else {                                                \
+                       to->field = NULL;                               \
+               }                                                       \
+       } while (0)
+
+       to->error_code = from->error_code;
+       DUP_STR (type_name);
+       DUP_STR (assembly_name);
+       DUP_STR (member_name);
+       DUP_STR (exception_name_space);
+       DUP_STR (exception_name);
+       DUP_STR (full_message);
+       DUP_STR (full_message_with_fields);
+       DUP_STR (first_argument);
+       to->exn.klass = from->exn.klass;
+
+#undef DUP_STR
+       
+       return box;
+}
+
+
+/**
+ * mono_error_set_from_boxed:
+ * @oerror: The error that will be set to the contents of the box.
+ * @box: A mempool-allocated error.
+ *
+ * Sets the error condition in the oerror from the contents of the
+ * given boxed error.  Does not alter the boxed error, so it can be
+ * used in a future call to mono_error_set_from_boxed as needed.  The
+ * oerror should've been previously initialized with mono_error_init,
+ * as usual.
+ *
+ * Returns TRUE on success or FALSE on failure.
+ */
+gboolean
+mono_error_set_from_boxed (MonoError *oerror, const MonoErrorBoxed *box)
+{
+       MonoErrorInternal* to = (MonoErrorInternal*)oerror;
+       MonoErrorInternal* from = (MonoErrorInternal*)&box->error;
+       g_assert (!is_managed_exception (from));
+
+       mono_error_prepare (to);
+       to->flags |= MONO_ERROR_FREE_STRINGS;
+#define DUP_STR(field) do {                                            \
+               if (from->field) {                                      \
+                       if (!(to->field = g_strdup (from->field)))      \
+                               to->flags |= MONO_ERROR_INCOMPLETE;     \
+               } else {                                                \
+                       to->field = NULL;                               \
+               }                                                       \
+       } while (0)
+
+       to->error_code = from->error_code;
+       DUP_STR (type_name);
+       DUP_STR (assembly_name);
+       DUP_STR (member_name);
+       DUP_STR (exception_name_space);
+       DUP_STR (exception_name);
+       DUP_STR (full_message);
+       DUP_STR (full_message_with_fields);
+       DUP_STR (first_argument);
+       to->exn.klass = from->exn.klass;
+                 
+#undef DUP_STR
+       return (to->flags & MONO_ERROR_INCOMPLETE) == 0 ;
+}
index 0aba0e1d61abb4219d6cfc15a9a8ead976c1ceaa..fa9caa6759e36bb2cecb619b19822f56e08520e2 100644 (file)
@@ -12,7 +12,11 @@ enum {
        /*
        Something happened while processing the error and the resulting message is incomplete.
        */
-       MONO_ERROR_INCOMPLETE = 0x0002
+       MONO_ERROR_INCOMPLETE = 0x0002,
+       /*
+       This MonoError is heap allocated in a mempool
+        */
+       MONO_ERROR_MEMPOOL_BOXED = 0x0004
 };
 
 enum {
@@ -48,6 +52,9 @@ typedef struct _MonoError {
        void *hidden_1 [12]; /*DON'T TOUCH */
 } MonoError;
 
+/* Mempool-allocated MonoError.*/
+typedef struct _MonoErrorBoxed MonoErrorBoxed;
+
 MONO_BEGIN_DECLS
 
 MONO_API void
index 758c3dc6fc2651487fc8cc87fcd97714f1882d13..e51387776b93ed25d0c69b83d1abdd1d77d9b7f9 100644 (file)
@@ -19,7 +19,7 @@
  * Licensed under the MIT license. See LICENSE file in the project root for full license information.
  */
 
-#include "mono/utils/mono-hwcap-arm.h"
+#include "mono/utils/mono-hwcap.h"
 
 #if defined(HAVE_SYS_AUXV_H) && !defined(PLATFORM_ANDROID)
 #include <sys/auxv.h>
 #include <stdio.h>
 #endif
 
-gboolean mono_hwcap_arm_is_v5 = FALSE;
-gboolean mono_hwcap_arm_is_v6 = FALSE;
-gboolean mono_hwcap_arm_is_v7 = FALSE;
-gboolean mono_hwcap_arm_has_vfp = FALSE;
-gboolean mono_hwcap_arm_has_vfp3 = FALSE;
-gboolean mono_hwcap_arm_has_vfp3_d16 = FALSE;
-gboolean mono_hwcap_arm_has_thumb = FALSE;
-gboolean mono_hwcap_arm_has_thumb2 = FALSE;
-
 void
 mono_hwcap_arch_init (void)
 {
@@ -202,16 +193,3 @@ mono_hwcap_arch_init (void)
        }
 #endif
 }
-
-void
-mono_hwcap_print(FILE *f)
-{
-       g_fprintf (f, "mono_hwcap_arm_is_v5 = %i\n", mono_hwcap_arm_is_v5);
-       g_fprintf (f, "mono_hwcap_arm_is_v6 = %i\n", mono_hwcap_arm_is_v6);
-       g_fprintf (f, "mono_hwcap_arm_is_v7 = %i\n", mono_hwcap_arm_is_v7);
-       g_fprintf (f, "mono_hwcap_arm_has_vfp = %i\n", mono_hwcap_arm_has_vfp);
-       g_fprintf (f, "mono_hwcap_arm_has_vfp3 = %i\n", mono_hwcap_arm_has_vfp3);
-       g_fprintf (f, "mono_hwcap_arm_has_vfp3_d16 = %i\n", mono_hwcap_arm_has_vfp3_d16);
-       g_fprintf (f, "mono_hwcap_arm_has_thumb = %i\n", mono_hwcap_arm_has_thumb);
-       g_fprintf (f, "mono_hwcap_arm_has_thumb2 = %i\n", mono_hwcap_arm_has_thumb2);
-}
diff --git a/mono/utils/mono-hwcap-arm.h b/mono/utils/mono-hwcap-arm.h
deleted file mode 100644 (file)
index 29adf7b..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-#ifndef __MONO_UTILS_HWCAP_ARM_H__
-#define __MONO_UTILS_HWCAP_ARM_H__
-
-#include "mono/utils/mono-hwcap.h"
-
-extern gboolean mono_hwcap_arm_is_v5;
-extern gboolean mono_hwcap_arm_is_v6;
-extern gboolean mono_hwcap_arm_is_v7;
-extern gboolean mono_hwcap_arm_has_vfp;
-extern gboolean mono_hwcap_arm_has_vfp3;
-extern gboolean mono_hwcap_arm_has_vfp3_d16;
-extern gboolean mono_hwcap_arm_has_thumb;
-extern gboolean mono_hwcap_arm_has_thumb2;
-
-#endif /* __MONO_UTILS_HWCAP_ARM_H__ */
index 5491cff96cfd60ec93560dee66aa7343c11c5803..f541ea3df2bebc78f42295ad212f739f63f1982f 100644 (file)
@@ -1,25 +1,13 @@
 /*
- * mono-hwcap-arm64.c: ARM hardware feature detection
+ * mono-hwcap-arm64.c: ARM64 hardware feature detection
  *
  * Copyright 2013 Xamarin Inc
  * Licensed under the MIT license. See LICENSE file in the project root for full license information.
  */
 
-#include "mono/utils/mono-hwcap-arm64.h"
+#include "mono/utils/mono-hwcap.h"
 
-#if defined(MONO_CROSS_COMPILE)
 void
 mono_hwcap_arch_init (void)
 {
 }
-#else
-void
-mono_hwcap_arch_init (void)
-{
-}
-#endif
-
-void
-mono_hwcap_print(FILE *f)
-{
-}
diff --git a/mono/utils/mono-hwcap-arm64.h b/mono/utils/mono-hwcap-arm64.h
deleted file mode 100644 (file)
index 2d41209..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef __MONO_UTILS_HWCAP_ARM64_H__
-#define __MONO_UTILS_HWCAP_ARM64_H__
-
-#include "mono/utils/mono-hwcap.h"
-
-#endif
diff --git a/mono/utils/mono-hwcap-cross.c b/mono/utils/mono-hwcap-cross.c
new file mode 100644 (file)
index 0000000..4311a99
--- /dev/null
@@ -0,0 +1,16 @@
+/*
+ * mono-hwcap-cross.c: No-op hardware feature detection
+ *
+ * Author:
+ *  Alex Rønne Petersen (alexrp@xamarin.com)
+ *
+ * Copyright 2015 Xamarin, Inc (http://www.xamarin.com)
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
+ */
+
+#include "mono/utils/mono-hwcap.h"
+
+void
+mono_hwcap_arch_init (void)
+{
+}
index b5979862208a32a61fc594f5b150a183f225df6d..dd1edbd8d40dcb6d79e62325a157d585845ddd6c 100644 (file)
  * Licensed under the MIT license. See LICENSE file in the project root for full license information.
  */
 
-#include "mono/utils/mono-hwcap-ia64.h"
+#include "mono/utils/mono-hwcap.h"
 
 void
 mono_hwcap_arch_init (void)
-{
-       /* Nothing needed here yet. */
-}
-
-void
-mono_hwcap_print (FILE *f)
 {
 }
diff --git a/mono/utils/mono-hwcap-ia64.h b/mono/utils/mono-hwcap-ia64.h
deleted file mode 100644 (file)
index 15b64a8..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef __MONO_UTILS_HWCAP_IA64_H__
-#define __MONO_UTILS_HWCAP_IA64_H__
-
-#include "mono/utils/mono-hwcap.h"
-
-/* Nothing needed here yet. */
-
-#endif /* __MONO_UTILS_HWCAP_IA64_H__ */
index 6d809a79ac54cf488c61faf587a0f5a5d3e50196..119f930a685a4d0915736d14f4d623b4291deca8 100644 (file)
  * Licensed under the MIT license. See LICENSE file in the project root for full license information.
  */
 
-#include "mono/utils/mono-hwcap-mips.h"
+#include "mono/utils/mono-hwcap.h"
 
 void
 mono_hwcap_arch_init (void)
-{
-       /* Nothing needed here yet. */
-}
-
-void
-mono_hwcap_print (FILE *f)
 {
 }
diff --git a/mono/utils/mono-hwcap-mips.h b/mono/utils/mono-hwcap-mips.h
deleted file mode 100644 (file)
index dd0622a..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef __MONO_UTILS_HWCAP_MIPS_H__
-#define __MONO_UTILS_HWCAP_MIPS_H__
-
-#include "mono/utils/mono-hwcap.h"
-
-/* Nothing needed here yet. */
-
-#endif /* __MONO_UTILS_HWCAP_MIPS_H__ */
index 174cc620a202c7af27d8012b11075f09d78d93ed..af36c4d5473191c740746c83b47b726e4ddc0524 100644 (file)
  * Licensed under the MIT license. See LICENSE file in the project root for full license information.
  */
 
-#include "mono/utils/mono-hwcap-ppc.h"
+#include "mono/utils/mono-hwcap.h"
 
 #if defined(__linux__) && defined(HAVE_SYS_AUXV_H)
 #include <string.h>
 #include <sys/auxv.h>
 #endif
 
-gboolean mono_hwcap_ppc_has_icache_snoop = FALSE;
-gboolean mono_hwcap_ppc_is_isa_2x = FALSE;
-gboolean mono_hwcap_ppc_is_isa_64 = FALSE;
-gboolean mono_hwcap_ppc_has_move_fpr_gpr = FALSE;
-gboolean mono_hwcap_ppc_has_multiple_ls_units = FALSE;
-
 void
 mono_hwcap_arch_init (void)
 {
@@ -66,13 +60,3 @@ mono_hwcap_arch_init (void)
        }
 #endif
 }
-
-void
-mono_hwcap_print (FILE* f)
-{
-       g_fprintf (f, "mono_hwcap_ppc_has_icache_snoop = %i\n", mono_hwcap_ppc_has_icache_snoop);
-       g_fprintf (f, "mono_hwcap_ppc_is_isa_2x = %i\n", mono_hwcap_ppc_is_isa_2x);
-       g_fprintf (f, "mono_hwcap_ppc_is_isa_64 = %i\n", mono_hwcap_ppc_is_isa_64);
-       g_fprintf (f, "mono_hwcap_ppc_has_move_fpr_gpr = %i\n", mono_hwcap_ppc_has_move_fpr_gpr);
-       g_fprintf (f, "mono_hwcap_ppc_has_multiple_ls_units = %i\n", mono_hwcap_ppc_has_multiple_ls_units);
-}
diff --git a/mono/utils/mono-hwcap-ppc.h b/mono/utils/mono-hwcap-ppc.h
deleted file mode 100644 (file)
index 0ae2578..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef __MONO_UTILS_HWCAP_PPC_H__
-#define __MONO_UTILS_HWCAP_PPC_H__
-
-#include "mono/utils/mono-hwcap.h"
-
-extern gboolean mono_hwcap_ppc_has_icache_snoop;
-extern gboolean mono_hwcap_ppc_is_isa_2x;
-extern gboolean mono_hwcap_ppc_is_isa_64;
-extern gboolean mono_hwcap_ppc_has_move_fpr_gpr;
-extern gboolean mono_hwcap_ppc_has_multiple_ls_units;
-
-#endif /* __MONO_UTILS_HWCAP_PPC_H__ */
index 19a7fba11017251a55864c39a93fa94ff5b5b2de..c578a620d925d87eca46a3709d5df296c5570654 100644 (file)
  * Licensed under the MIT license. See LICENSE file in the project root for full license information.
  */
 
-#include "mono/utils/mono-hwcap-s390x.h"
+#include "mono/utils/mono-hwcap.h"
+
 #include <signal.h>
 
-facilityList_t facs;
+typedef struct {
+       uint8_t n3:1;           // 000 - N3 instructions
+       uint8_t zi:1;           // 001 - z/Arch installed
+       uint8_t za:1;           // 002 - z/Arch active
+       uint8_t date:1;         // 003 - DAT-enhancement
+       uint8_t idtes:1;        // 004 - IDTE-segment tables
+       uint8_t idter:1;        // 005 - IDTE-region tables
+       uint8_t asnlx:1;        // 006 - ASN-LX reuse
+       uint8_t stfle:1;        // 007 - STFLE
+       uint8_t edat1:1;        // 008 - EDAT 1
+       uint8_t srs:1;          // 009 - Sense-Running-Status
+       uint8_t csske:1;        // 010 - Conditional SSKE
+       uint8_t ctf:1;          // 011 - Configuration-topology
+       uint8_t ibm01:1;        // 012 - Assigned to IBM
+       uint8_t ipter:1;        // 013 - IPTE-range
+       uint8_t nqks:1;         // 014 - Nonquiescing key-setting
+       uint8_t ibm02:1;        // 015 - Assigned to IBM
+       uint8_t etf2:1;         // 016 - Extended translation 2
+       uint8_t msa:1;          // 017 - Message security assist 1
+       uint8_t ld:1;           // 018 - Long displacement
+       uint8_t ldh:1;          // 019 - Long displacement high perf
+       uint8_t mas:1;          // 020 - HFP multiply-add-subtract
+       uint8_t eif:1;          // 021 - Extended immediate
+       uint8_t etf3:1;         // 022 - Extended translation 3
+       uint8_t hux:1;          // 023 - HFP unnormalized extension
+       uint8_t etf2e:1;        // 024 - Extended translation enhanced 2
+       uint8_t stckf:1;        // 025 - Store clock fast
+       uint8_t pe:1;           // 026 - Parsing enhancement
+       uint8_t mvcos:1;        // 027 - Move with optional specs
+       uint8_t tods:1;         // 028 - TOD steering
+       uint8_t x000:1;         // 029 - Undefined
+       uint8_t etf3e:1;        // 030 - ETF3 enhancement
+       uint8_t ecput:1;        // 031 - Extract CPU time
+       uint8_t csst:1;         // 032 - Compare swap and store
+       uint8_t csst2:1;        // 033 - Compare swap and store 2
+       uint8_t gie:1;          // 034 - General instructions extension
+       uint8_t ee:1;           // 035 - Execute extensions
+       uint8_t em:1;           // 036 - Enhanced monitor
+       uint8_t fpe:1;          // 037 - Floating point extension
+       uint8_t x001:1;         // 038 - Undefined
+       uint8_t ibm03:1;        // 039 - Assigned to IBM
+       uint8_t spp:1;          // 040 - Set program parameters
+       uint8_t fpse:1;         // 041 - FP support enhancement
+       uint8_t dfp:1;          // 042 - DFP
+       uint8_t dfph:1;         // 043 - DFP high performance
+       uint8_t pfpo:1;         // 044 - PFPO instruction
+       uint8_t multi:1;        // 045 - Multiple inc load/store on CC 1
+       uint8_t ibm04:1;        // 046 - Assigned to IBM
+       uint8_t cmpsce:1;       // 047 - CMPSC enhancement
+       uint8_t dfpzc:1;        // 048 - DFP zoned conversion
+       uint8_t misc:1;         // 049 - Multiple inc load and trap
+       uint8_t ctx:1;          // 050 - Constrained transactional-execution
+       uint8_t ltlb:1;         // 051 - Local TLB clearing
+       uint8_t ia:1;           // 052 - Interlocked access
+       uint8_t lsoc2:1;        // 053 - Load/store on CC 2
+       uint8_t x002:1;         // 054 - Undefined
+       uint8_t ibm05:1;        // 055 - Assigned to IBM
+       uint8_t x003:1;         // 056 - Undefined
+       uint8_t msa5:1;         // 057 - Message security assist 5
+       uint8_t x004:1;         // 058 - Undefined
+       uint8_t x005:1;         // 059 - Undefined
+       uint8_t x006:1;         // 060 - Undefined
+       uint8_t x007:1;         // 061 - Undefined
+       uint8_t ibm06:1;        // 062 - Assigned to IBM
+       uint8_t x008:1;         // 063 - Undefined
+       uint8_t x009:1;         // 064 - Undefined
+       uint8_t ibm07:1;        // 065 - Assigned to IBM
+       uint8_t rrbm:1;         // 066 - Reset reference bits multiple
+       uint8_t cmc:1;          // 067 - CPU measurement counter
+       uint8_t cms:1;          // 068 - CPU Measurement sampling
+       uint8_t ibm08:1;        // 069 - Assigned to IBM
+       uint8_t ibm09:1;        // 070 - Assigned to IBM
+       uint8_t ibm10:1;        // 071 - Assigned to IBM
+       uint8_t ibm11:1;        // 072 - Assigned to IBM
+       uint8_t txe:1;          // 073 - Transactional execution
+       uint8_t sthy:1;         // 074 - Store hypervisor information
+       uint8_t aefsi:1;        // 075 - Access exception fetch/store indication
+       uint8_t msa3:1;         // 076 - Message security assist 3
+       uint8_t msa4:1;         // 077 - Message security assist 4
+       uint8_t edat2:1;        // 078 - Enhanced DAT 2
+       uint8_t x010:1;         // 079 - Undefined
+       uint8_t dfppc:1;        // 080 - DFP packed conversion
+       uint8_t x011:7;         // 081-87 - Undefined
+       uint8_t x012[5];        // 088-127 - Undefined
+       uint8_t ibm12:1;        // 128 - Assigned to IBM
+       uint8_t vec:1;          // 129 - Vector facility
+       uint8_t x013:6;         // 130-135 - Undefined
+       uint8_t x014:6;         // 136-141 - Undefined
+       uint8_t sccm:1;         // 142 - Store CPU counter multiple
+       uint8_t ibm13:1;        // 143 - Assigned to IBM
+       uint8_t x015[14];       // 144-256 Undefined
+} __attribute__ ((packed)) __attribute__ ((aligned(8))) facilityList_t;
 
 void
 mono_hwcap_arch_init (void)
 {
-       int lFacs = sizeof(facs) / 8;
+       facilityList_t facs;
+       int lFacs = sizeof (facs) / 8;
 
-       __asm__ ("      lgfr    0,%1\n"
-                "      .insn   s,0xb2b00000,%0\n"
-                : "=m" (facs) : "r" (lFacs) : "0", "cc");
-}
+       __asm__ __volatile__ (
+               "lgfr\t0,%1\n\t"
+               ".insn\ts,0xb2b00000,%0\n\t"
+               : "=m" (facs)
+               : "r" (lFacs)
+               : "0", "cc"
+       );
 
-void
-mono_hwcap_print (FILE *f)
-{
+       mono_hwcap_s390x_has_fpe = facs.fpe;
+       mono_hwcap_s390x_has_vec = facs.vec;
 }
diff --git a/mono/utils/mono-hwcap-s390x.h b/mono/utils/mono-hwcap-s390x.h
deleted file mode 100644 (file)
index 7a4522f..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-#ifndef __MONO_UTILS_HWCAP_S390X_H__
-#define __MONO_UTILS_HWCAP_S390X_H__
-
-#include "mono/utils/mono-hwcap.h"
-
-typedef struct __FACLIST__ {
-       uint8_t n3:1;           // 000 - N3 instructions
-       uint8_t zi:1;           // 001 - z/Arch installed
-       uint8_t za:1;           // 002 - z/Arch active
-       uint8_t date:1;         // 003 - DAT-enhancement
-       uint8_t idtes:1;        // 004 - IDTE-segment tables
-       uint8_t idter:1;        // 005 - IDTE-region tables
-       uint8_t asnlx:1;        // 006 - ASN-LX reuse
-       uint8_t stfle:1;        // 007 - STFLE
-       uint8_t edat1:1;        // 008 - EDAT 1
-       uint8_t srs:1;          // 009 - Sense-Running-Status
-       uint8_t csske:1;        // 010 - Conditional SSKE
-       uint8_t ctf:1;          // 011 - Configuration-topology
-       uint8_t ibm01:1;        // 012 - Assigned to IBM
-       uint8_t ipter:1;        // 013 - IPTE-range
-       uint8_t nqks:1;         // 014 - Nonquiescing key-setting
-       uint8_t ibm02:1;        // 015 - Assigned to IBM
-       uint8_t etf2:1;         // 016 - Extended translation 2
-       uint8_t msa:1;          // 017 - Message security assist 1
-       uint8_t ld:1;           // 018 - Long displacement
-       uint8_t ldh:1;          // 019 - Long displacement high perf
-       uint8_t mas:1;          // 020 - HFP multiply-add-subtract
-       uint8_t eif:1;          // 021 - Extended immediate
-       uint8_t etf3:1;         // 022 - Extended translation 3
-       uint8_t hux:1;          // 023 - HFP unnormalized extension
-       uint8_t etf2e:1;        // 024 - Extended translation enhanced 2
-       uint8_t stckf:1;        // 025 - Store clock fast
-       uint8_t pe:1;           // 026 - Parsing enhancement
-       uint8_t mvcos:1;        // 027 - Move with optional specs
-       uint8_t tods:1;         // 028 - TOD steering
-       uint8_t x000:1;         // 029 - Undefined
-       uint8_t etf3e:1;        // 030 - ETF3 enhancement
-       uint8_t ecput:1;        // 031 - Extract CPU time
-       uint8_t csst:1;         // 032 - Compare swap and store
-       uint8_t csst2:1;        // 033 - Compare swap and store 2
-       uint8_t gie:1;          // 034 - General instructions extension
-       uint8_t ee:1;           // 035 - Execute extensions
-       uint8_t em:1;           // 036 - Enhanced monitor
-       uint8_t fpe:1;          // 037 - Floating point extension
-       uint8_t x001:1;         // 038 - Undefined
-       uint8_t ibm03:1;        // 039 - Assigned to IBM
-       uint8_t spp:1;          // 040 - Set program parameters
-       uint8_t fpse:1;         // 041 - FP support enhancement
-       uint8_t dfp:1;          // 042 - DFP
-       uint8_t dfph:1;         // 043 - DFP high performance
-       uint8_t pfpo:1;         // 044 - PFPO instruction
-       uint8_t multi:1;        // 045 - Multiple inc load/store on CC 1
-       uint8_t ibm04:1;        // 046 - Assigned to IBM
-       uint8_t cmpsce:1;       // 047 - CMPSC enhancement
-       uint8_t dfpzc:1;        // 048 - DFP zoned conversion
-       uint8_t misc:1;         // 049 - Multiple inc load and trap
-       uint8_t ctx:1;          // 050 - Constrained transactional-execution
-       uint8_t ltlb:1;         // 051 - Local TLB clearing
-       uint8_t ia:1;           // 052 - Interlocked access
-       uint8_t lsoc2:1;        // 053 - Load/store on CC 2
-       uint8_t x002:1;         // 054 - Undefined
-       uint8_t ibm05:1;        // 055 - Assigned to IBM
-       uint8_t x003:1;         // 056 - Undefined
-       uint8_t msa5:1;         // 057 - Message security assist 5
-       uint8_t x004:1;         // 058 - Undefined
-       uint8_t x005:1;         // 059 - Undefined
-       uint8_t x006:1;         // 060 - Undefined
-       uint8_t x007:1;         // 061 - Undefined
-       uint8_t ibm06:1;        // 062 - Assigned to IBM
-       uint8_t x008:1;         // 063 - Undefined
-       uint8_t x009:1;         // 064 - Undefined
-       uint8_t ibm07:1;        // 065 - Assigned to IBM
-       uint8_t rrbm:1;         // 066 - Reset reference bits multiple
-       uint8_t cmc:1;          // 067 - CPU measurement counter
-       uint8_t cms:1;          // 068 - CPU Measurement sampling
-       uint8_t ibm08:1;        // 069 - Assigned to IBM
-       uint8_t ibm09:1;        // 070 - Assigned to IBM
-       uint8_t ibm10:1;        // 071 - Assigned to IBM
-       uint8_t ibm11:1;        // 072 - Assigned to IBM
-       uint8_t txe:1;          // 073 - Transactional execution
-       uint8_t sthy:1;         // 074 - Store hypervisor information
-       uint8_t aefsi:1;        // 075 - Access exception fetch/store indication
-       uint8_t msa3:1;         // 076 - Message security assist 3
-       uint8_t msa4:1;         // 077 - Message security assist 4
-       uint8_t edat2:1;        // 078 - Enhanced DAT 2
-       uint8_t x010:1;         // 079 - Undefined
-       uint8_t dfppc:1;        // 080 - DFP packed conversion
-       uint8_t x011:7;         // 081-87 - Undefined
-       uint8_t x012[5];        // 088-127 - Undefined
-       uint8_t ibm12:1;        // 128 - Assigned to IBM
-       uint8_t vec:1;          // 129 - Vector facility
-       uint8_t x013:6;         // 130-135 - Undefined
-       uint8_t x014:6;         // 136-141 - Undefined
-       uint8_t sccm:1;         // 142 - Store CPU counter multiple
-       uint8_t ibm13:1;        // 143 - Assigned to IBM
-       uint8_t x015[14];       // 144-256 Undefined
-} __attribute__ ((packed)) __attribute__ ((aligned(8))) facilityList_t;
-
-extern facilityList_t facs;
-
-#endif /* __MONO_UTILS_HWCAP_S390X_H__ */
index ba849873632cf0798c66c34ecddf2990056d9873..75208bdeff7bc02996f188a00eeaed769007d138 100644 (file)
  * Licensed under the MIT license. See LICENSE file in the project root for full license information.
  */
 
-#include "mono/utils/mono-hwcap-sparc.h"
+#include "mono/utils/mono-hwcap.h"
 
 #include <string.h>
-
 #if !defined(__linux__)
 #include <sys/systeminfo.h>
 #else
 #include <unistd.h>
 #endif
 
-gboolean mono_hwcap_sparc_is_v9 = FALSE;
-
 void
 mono_hwcap_arch_init (void)
 {
        char buf [1024];
 
 #if !defined(__linux__)
-       if (!sysinfo (SI_ISALIST, buf, 1024))
-               g_assert_not_reached ();
+       g_assert (sysinfo (SI_ISALIST, buf, 1024));
 #else
        /* If the page size is 8192, we're on a 64-bit SPARC, which
         * in turn means a v9 or better.
@@ -51,9 +47,3 @@ mono_hwcap_arch_init (void)
 
        mono_hwcap_sparc_is_v9 = strstr (buf, "sparcv9");
 }
-
-void
-mono_hwcap_print (FILE *f)
-{
-       g_fprintf (f, "mono_hwcap_sparc_is_v9 = %i\n", mono_hwcap_sparc_is_v9);
-}
diff --git a/mono/utils/mono-hwcap-vars.h b/mono/utils/mono-hwcap-vars.h
new file mode 100644 (file)
index 0000000..620a3d4
--- /dev/null
@@ -0,0 +1,56 @@
+#include "config.h"
+
+#if defined (TARGET_ARM)
+
+MONO_HWCAP_VAR(arm_is_v5)
+MONO_HWCAP_VAR(arm_is_v6)
+MONO_HWCAP_VAR(arm_is_v7)
+MONO_HWCAP_VAR(arm_has_vfp)
+MONO_HWCAP_VAR(arm_has_vfp3)
+MONO_HWCAP_VAR(arm_has_vfp3_d16)
+MONO_HWCAP_VAR(arm_has_thumb)
+MONO_HWCAP_VAR(arm_has_thumb2)
+
+#elif defined (TARGET_ARM64)
+
+// Nothing here yet.
+
+#elif defined (TARGET_IA64)
+
+// Nothing here yet.
+
+#elif defined (TARGET_MIPS)
+
+// Nothing here yet.
+
+#elif defined (TARGET_POWERPC) || defined (TARGET_POWERPC64)
+
+MONO_HWCAP_VAR(ppc_has_icache_snoop)
+MONO_HWCAP_VAR(ppc_is_isa_2x)
+MONO_HWCAP_VAR(ppc_is_isa_64)
+MONO_HWCAP_VAR(ppc_has_move_fpr_gpr)
+MONO_HWCAP_VAR(ppc_has_multiple_ls_units)
+
+#elif defined (TARGET_S390X)
+
+MONO_HWCAP_VAR(s390x_has_fpe)
+MONO_HWCAP_VAR(s390x_has_vec)
+
+#elif defined (TARGET_SPARC) || defined (TARGET_SPARC64)
+
+MONO_HWCAP_VAR(sparc_is_v9)
+
+#elif defined (TARGET_X86) || defined (TARGET_AMD64)
+
+MONO_HWCAP_VAR(x86_is_xen)
+MONO_HWCAP_VAR(x86_has_cmov)
+MONO_HWCAP_VAR(x86_has_fcmov)
+MONO_HWCAP_VAR(x86_has_sse1)
+MONO_HWCAP_VAR(x86_has_sse2)
+MONO_HWCAP_VAR(x86_has_sse3)
+MONO_HWCAP_VAR(x86_has_ssse3)
+MONO_HWCAP_VAR(x86_has_sse41)
+MONO_HWCAP_VAR(x86_has_sse42)
+MONO_HWCAP_VAR(x86_has_sse4a)
+
+#endif
index 4a96aa3a088eeb3d6a646c123c603bb305c29296..5d72a4c7e2030260e74b82369ffc82db450636f4 100644 (file)
  * Licensed under the MIT license. See LICENSE file in the project root for full license information.
  */
 
-#include "mono/utils/mono-hwcap-x86.h"
+#include "mono/utils/mono-hwcap.h"
 
 #if defined(HAVE_UNISTD_H)
 #include <unistd.h>
 #endif
-
 #if defined(_MSC_VER)
 #include <intrin.h>
 #endif
 
-gboolean mono_hwcap_x86_is_xen = FALSE;
-gboolean mono_hwcap_x86_has_cmov = FALSE;
-gboolean mono_hwcap_x86_has_fcmov = FALSE;
-gboolean mono_hwcap_x86_has_sse1 = FALSE;
-gboolean mono_hwcap_x86_has_sse2 = FALSE;
-gboolean mono_hwcap_x86_has_sse3 = FALSE;
-gboolean mono_hwcap_x86_has_ssse3 = FALSE;
-gboolean mono_hwcap_x86_has_sse41 = FALSE;
-gboolean mono_hwcap_x86_has_sse42 = FALSE;
-gboolean mono_hwcap_x86_has_sse4a = FALSE;
-
 static gboolean
 cpuid (int id, int *p_eax, int *p_ebx, int *p_ecx, int *p_edx)
 {
@@ -162,18 +150,3 @@ mono_hwcap_arch_init (void)
        mono_hwcap_x86_is_xen = !access ("/proc/xen", F_OK);
 #endif
 }
-
-void
-mono_hwcap_print (FILE *f)
-{
-       g_fprintf (f, "mono_hwcap_x86_is_xen = %i\n", mono_hwcap_x86_is_xen);
-       g_fprintf (f, "mono_hwcap_x86_has_cmov = %i\n", mono_hwcap_x86_has_cmov);
-       g_fprintf (f, "mono_hwcap_x86_has_fcmov = %i\n", mono_hwcap_x86_has_fcmov);
-       g_fprintf (f, "mono_hwcap_x86_has_sse1 = %i\n", mono_hwcap_x86_has_sse1);
-       g_fprintf (f, "mono_hwcap_x86_has_sse2 = %i\n", mono_hwcap_x86_has_sse2);
-       g_fprintf (f, "mono_hwcap_x86_has_sse3 = %i\n", mono_hwcap_x86_has_sse3);
-       g_fprintf (f, "mono_hwcap_x86_has_ssse3 = %i\n", mono_hwcap_x86_has_ssse3);
-       g_fprintf (f, "mono_hwcap_x86_has_sse41 = %i\n", mono_hwcap_x86_has_sse41);
-       g_fprintf (f, "mono_hwcap_x86_has_sse42 = %i\n", mono_hwcap_x86_has_sse42);
-       g_fprintf (f, "mono_hwcap_x86_has_sse4a = %i\n", mono_hwcap_x86_has_sse4a);
-}
diff --git a/mono/utils/mono-hwcap-x86.h b/mono/utils/mono-hwcap-x86.h
deleted file mode 100644 (file)
index 5e1f4f7..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-#ifndef __MONO_UTILS_HWCAP_X86_H__
-#define __MONO_UTILS_HWCAP_X86_H__
-
-#include "mono/utils/mono-hwcap.h"
-
-extern gboolean mono_hwcap_x86_is_xen;
-extern gboolean mono_hwcap_x86_has_cmov;
-extern gboolean mono_hwcap_x86_has_fcmov;
-extern gboolean mono_hwcap_x86_has_sse1;
-extern gboolean mono_hwcap_x86_has_sse2;
-extern gboolean mono_hwcap_x86_has_sse3;
-extern gboolean mono_hwcap_x86_has_ssse3;
-extern gboolean mono_hwcap_x86_has_sse41;
-extern gboolean mono_hwcap_x86_has_sse42;
-extern gboolean mono_hwcap_x86_has_sse4a;
-
-#endif /* __MONO_UTILS_HWCAP_X86_H__ */
index a3d2b6078bfdb0d3e401d6e2854497e5ec7f3b8f..00fad690193a5f8415f4afc317b1c28afa97fd99 100644 (file)
 
 #include "mono/utils/mono-hwcap.h"
 
+#define MONO_HWCAP_VAR(NAME) gboolean mono_hwcap_ ## NAME = FALSE;
+#include "mono/utils/mono-hwcap-vars.h"
+#undef MONO_HWCAP_VAR
+
 static gboolean hwcap_inited = FALSE;
 
 void
@@ -35,19 +39,21 @@ mono_hwcap_init (void)
        if (hwcap_inited)
                return;
 
-#ifdef MONO_CROSS_COMPILE
-       /*
-        * If we're cross-compiling, we want to be as
-        * conservative as possible so that we produce
-        * code that's portable. Default to that.
-        */
-       if (!conservative)
-               conservative = "1";
-#endif
-
        if (!conservative || strncmp (conservative, "1", 1))
                mono_hwcap_arch_init ();
 
        if (verbose && !strncmp (verbose, "1", 1))
-               mono_hwcap_print (stdout);
+               mono_hwcap_print ();
+}
+
+void
+mono_hwcap_print (void)
+{
+       g_print ("[mono-hwcap] Detected following hardware capabilities:\n\n");
+
+#define MONO_HWCAP_VAR(NAME) g_print ("\t" #NAME " = %s\n", mono_hwcap_ ## NAME ? "yes" : "no");
+#include "mono/utils/mono-hwcap-vars.h"
+#undef MONO_HWCAP_VAR
+
+       g_print ("\n");
 }
index af5d665426905beefe8e3e89318e82e1a2610f49..1867d3d258a62bbb0c0e4d8b820892a691781586 100644 (file)
@@ -8,6 +8,10 @@
 
 #include "mono/utils/mono-compiler.h"
 
+#define MONO_HWCAP_VAR(NAME) extern gboolean mono_hwcap_ ## NAME;
+#include "mono/utils/mono-hwcap-vars.h"
+#undef MONO_HWCAP_VAR
+
 /* Call this function to perform hardware feature detection. Until
  * this function has been called, all feature variables will be
  * FALSE as a default.
  * result in an inconsistent state of the variables. Further,
  * feature variables should not be read *while* this function is
  * executing.
- *
- * To get at feature variables, include the appropriate header,
- * e.g. mono-hwcap-x86.h for x86(-64).
  */
 void mono_hwcap_init (void);
 
 /* Implemented in mono-hwcap-$TARGET.c. Do not call. */
 void mono_hwcap_arch_init (void);
 
-/* Print detected features to the given file. */
-void mono_hwcap_print (FILE *f);
+/* Print detected features to stdout. */
+void mono_hwcap_print (void);
 
 /* Please note: If you're going to use the Linux auxiliary vector
  * to detect CPU features, don't use any of the constant names in
index 54c6320d2b6f6a08bc8fc2fe249f315bbde8cac8..7e22eafa8cc9cf25b2c9870a6ad44c42e5e3df0b 100644 (file)
@@ -7,6 +7,7 @@
 #include <errno.h>
 #include <mono/utils/mono-io-portability.h>
 #include <mono/metadata/profiler-private.h>
+#include <mono/utils/mono-compiler.h>
 
 #ifndef DISABLE_PORTABILITY
 
@@ -387,4 +388,9 @@ static inline gchar *mono_portability_find_file_internal (GString **report, cons
        g_free (new_pathname);
        return(NULL);
 }
-#endif
+
+#else /* DISABLE_PORTABILITY */
+
+MONO_EMPTY_SOURCE_FILE (mono_io_portability);
+
+#endif /* DISABLE_PORTABILITY */
index f076034da21d7f0dc9ff4aa6c3e1e535f20c8ef5..ea11fcc634bbc948e11af5338c56f1304cdc6f31 100644 (file)
@@ -25,7 +25,7 @@ mask (gpointer n, uintptr_t bit)
 }
 
 gpointer
-get_hazardous_pointer_with_mask (gpointer volatile *pp, MonoThreadHazardPointers *hp, int hazard_index)
+mono_lls_get_hazardous_pointer_with_mask (gpointer volatile *pp, MonoThreadHazardPointers *hp, int hazard_index)
 {
        gpointer p;
 
@@ -56,28 +56,21 @@ get_hazardous_pointer_with_mask (gpointer volatile *pp, MonoThreadHazardPointers
 /*
 Initialize @list and will use @free_node_func to release memory.
 If @free_node_func is null the caller is responsible for releasing node memory.
-If @free_node_func may lock, @free_node_func_locking must be
-HAZARD_FREE_MAY_LOCK; otherwise, HAZARD_FREE_NO_LOCK. It is ignored if
-@free_node_func is null.
 */
 void
-mono_lls_init (MonoLinkedListSet *list, void (*free_node_func)(void *), HazardFreeLocking free_node_func_locking)
+mono_lls_init (MonoLinkedListSet *list, void (*free_node_func)(void *))
 {
        list->head = NULL;
        list->free_node_func = free_node_func;
-       list->locking = free_node_func_locking;
 }
 
 /*
 Search @list for element with key @key.
-@context specifies whether the function is being called from a lock-free (i.e.
-signal handler or world stopped) context. It is only relevant if a node free
-function was given.
 The nodes next, cur and prev are returned in @hp.
 Returns true if a node with key @key was found.
 */
 gboolean
-mono_lls_find (MonoLinkedListSet *list, MonoThreadHazardPointers *hp, uintptr_t key, HazardFreeContext context)
+mono_lls_find (MonoLinkedListSet *list, MonoThreadHazardPointers *hp, uintptr_t key)
 {
        MonoLinkedListSetNode *cur, *next;
        MonoLinkedListSetNode **prev;
@@ -95,12 +88,12 @@ try_again:
         */
        mono_hazard_pointer_set (hp, 2, prev);
 
-       cur = (MonoLinkedListSetNode *) get_hazardous_pointer_with_mask ((gpointer*)prev, hp, 1);
+       cur = (MonoLinkedListSetNode *) mono_lls_get_hazardous_pointer_with_mask ((gpointer*)prev, hp, 1);
 
        while (1) {
                if (cur == NULL)
                        return FALSE;
-               next = (MonoLinkedListSetNode *) get_hazardous_pointer_with_mask ((gpointer*)&cur->next, hp, 0);
+               next = (MonoLinkedListSetNode *) mono_lls_get_hazardous_pointer_with_mask ((gpointer*)&cur->next, hp, 0);
                cur_key = cur->key;
 
                /*
@@ -137,15 +130,12 @@ try_again:
 
 /*
 Insert @value into @list.
-@context specifies whether the function is being called from a lock-free (i.e.
-signal handler or world stopped) context. It is only relevant if a node free
-function was given.
 The nodes value, cur and prev are returned in @hp.
 Return true if @value was inserted by this call. If it returns FALSE, it's the caller
 resposibility to release memory.
 */
 gboolean
-mono_lls_insert (MonoLinkedListSet *list, MonoThreadHazardPointers *hp, MonoLinkedListSetNode *value, HazardFreeContext context)
+mono_lls_insert (MonoLinkedListSet *list, MonoThreadHazardPointers *hp, MonoLinkedListSetNode *value)
 {
        MonoLinkedListSetNode *cur, **prev;
        /*We must do a store barrier before inserting 
@@ -153,7 +143,7 @@ mono_lls_insert (MonoLinkedListSet *list, MonoThreadHazardPointers *hp, MonoLink
        mono_memory_barrier ();
 
        while (1) {
-               if (mono_lls_find (list, hp, value->key, context))
+               if (mono_lls_find (list, hp, value->key))
                        return FALSE;
                cur = (MonoLinkedListSetNode *) mono_hazard_pointer_get_val (hp, 1);
                prev = (MonoLinkedListSetNode **) mono_hazard_pointer_get_val (hp, 2);
@@ -169,18 +159,15 @@ mono_lls_insert (MonoLinkedListSet *list, MonoThreadHazardPointers *hp, MonoLink
 
 /*
 Search @list for element with key @key and remove it.
-@context specifies whether the function is being called from a lock-free (i.e.
-signal handler or world stopped) context. It is only relevant if a node free
-function was given.
 The nodes next, cur and prev are returned in @hp
 Returns true if @value was removed by this call.
 */
 gboolean
-mono_lls_remove (MonoLinkedListSet *list, MonoThreadHazardPointers *hp, MonoLinkedListSetNode *value, HazardFreeContext context)
+mono_lls_remove (MonoLinkedListSet *list, MonoThreadHazardPointers *hp, MonoLinkedListSetNode *value)
 {
        MonoLinkedListSetNode *cur, **prev, *next;
        while (1) {
-               if (!mono_lls_find (list, hp, value->key, context))
+               if (!mono_lls_find (list, hp, value->key))
                        return FALSE;
 
                next = (MonoLinkedListSetNode *) mono_hazard_pointer_get_val (hp, 0);
@@ -198,9 +185,9 @@ mono_lls_remove (MonoLinkedListSet *list, MonoThreadHazardPointers *hp, MonoLink
                        mono_memory_write_barrier ();
                        mono_hazard_pointer_clear (hp, 1);
                        if (list->free_node_func)
-                               mono_thread_hazardous_try_free (value, list->free_node_func);
+                               mono_thread_hazardous_queue_free (value, list->free_node_func);
                } else
-                       mono_lls_find (list, hp, value->key, context);
+                       mono_lls_find (list, hp, value->key);
                return TRUE;
        }
 }
index 947602f0c34e2177d3a829fd6863850208d24c6f..ee4d77799ec50d1d54573851d4c20994899a21de 100644 (file)
@@ -24,7 +24,6 @@ struct _MonoLinkedListSetNode {
 typedef struct {
        MonoLinkedListSetNode *head;
        void (*free_node_func)(void *);
-       HazardFreeLocking locking;
 } MonoLinkedListSet;
 
 
@@ -45,20 +44,20 @@ Those are low level operations. prev, cur, next are returned in the hazard point
 You must manually clean the hazard pointer table after using them.
 */
 
-void
-mono_lls_init (MonoLinkedListSet *list, void (*free_node_func)(void *), HazardFreeLocking free_node_func_locking);
+MONO_API void
+mono_lls_init (MonoLinkedListSet *list, void (*free_node_func)(void *));
 
-gboolean
-mono_lls_find (MonoLinkedListSet *list, MonoThreadHazardPointers *hp, uintptr_t key, HazardFreeContext context);
+MONO_API gboolean
+mono_lls_find (MonoLinkedListSet *list, MonoThreadHazardPointers *hp, uintptr_t key);
 
-gboolean
-mono_lls_insert (MonoLinkedListSet *list, MonoThreadHazardPointers *hp, MonoLinkedListSetNode *value, HazardFreeContext context);
+MONO_API gboolean
+mono_lls_insert (MonoLinkedListSet *list, MonoThreadHazardPointers *hp, MonoLinkedListSetNode *value);
 
-gboolean
-mono_lls_remove (MonoLinkedListSet *list, MonoThreadHazardPointers *hp, MonoLinkedListSetNode *value, HazardFreeContext context);
+MONO_API gboolean
+mono_lls_remove (MonoLinkedListSet *list, MonoThreadHazardPointers *hp, MonoLinkedListSetNode *value);
 
-gpointer
-get_hazardous_pointer_with_mask (gpointer volatile *pp, MonoThreadHazardPointers *hp, int hazard_index);
+MONO_API gpointer
+mono_lls_get_hazardous_pointer_with_mask (gpointer volatile *pp, MonoThreadHazardPointers *hp, int hazard_index);
 
 static inline gboolean
 mono_lls_filter_accept_all (gpointer elem)
@@ -108,12 +107,12 @@ mono_lls_filter_accept_all (gpointer elem)
                        restart__ = FALSE; \
                        MonoLinkedListSetNode **prev__ = &list__->head; \
                        mono_hazard_pointer_set (hp__, 2, prev__); \
-                       MonoLinkedListSetNode *cur__ = (MonoLinkedListSetNode *) get_hazardous_pointer_with_mask ((gpointer *) prev__, hp__, 1); \
+                       MonoLinkedListSetNode *cur__ = (MonoLinkedListSetNode *) mono_lls_get_hazardous_pointer_with_mask ((gpointer *) prev__, hp__, 1); \
                        while (1) { \
                                if (!cur__) { \
                                        break; \
                                } \
-                               MonoLinkedListSetNode *next__ = (MonoLinkedListSetNode *) get_hazardous_pointer_with_mask ((gpointer *) &cur__->next, hp__, 0); \
+                               MonoLinkedListSetNode *next__ = (MonoLinkedListSetNode *) mono_lls_get_hazardous_pointer_with_mask ((gpointer *) &cur__->next, hp__, 0); \
                                uintptr_t ckey__ = cur__->key; \
                                mono_memory_read_barrier (); \
                                if (*prev__ != cur__) { \
diff --git a/mono/utils/mono-log-android.c b/mono/utils/mono-log-android.c
new file mode 100644 (file)
index 0000000..fde2fd0
--- /dev/null
@@ -0,0 +1,92 @@
+/*
+ * mono-log-android.c: Android-specific interface to the logger
+ *
+ * This module contains the Android logcat logger interface
+ *
+ * Author:
+ *    Marek Habersack <grendel@twistedcode.net>
+ *
+ */
+#include <config.h>
+
+#if defined (PLATFORM_ANDROID)
+
+#include <android/log.h>
+#include "mono-logger-internals.h"
+
+/**
+ * mono_log_open_logcat
+ *
+ *     Open access to Android logcat (no-op)
+ *
+ *     @path - Not used
+ *     @userData - Not used
+ */   
+void
+mono_log_open_logcat (const char *path, void *userData)
+{
+       /* No-op on Android */
+}
+
+/**
+ * mono_log_write_logcat
+ *
+ *     Write data to Android logcat.
+ *
+ *     @domain - Identifier string
+ *     @level - Logging level flags
+ *     @format - Printf format string
+ *     @vargs - Variable argument list
+ */
+void
+mono_log_write_logcat (const char *log_domain, GLogLevelFlags level, mono_bool hdr, const char *message)
+{
+       android_LogPriority apriority;
+
+       switch (level & G_LOG_LEVEL_MASK)
+       {
+               case G_LOG_LEVEL_ERROR:
+                       apriority = ANDROID_LOG_FATAL;
+                       break;
+
+               case G_LOG_LEVEL_CRITICAL:
+                       apriority = ANDROID_LOG_ERROR;
+                       break;
+
+               case G_LOG_LEVEL_WARNING:
+                       apriority = ANDROID_LOG_WARN;
+                       break;
+
+               case G_LOG_LEVEL_MESSAGE:
+                       apriority = ANDROID_LOG_INFO;
+                       break;
+
+               case G_LOG_LEVEL_INFO:
+                       apriority = ANDROID_LOG_DEBUG;
+                       break;
+
+               case G_LOG_LEVEL_DEBUG:
+                       apriority = ANDROID_LOG_VERBOSE;
+                       break;
+
+               default:
+                       apriority = ANDROID_LOG_UNKNOWN;
+                       break;
+       }
+
+       __android_log_write (apriority, log_domain, message);
+       if (apriority == ANDROID_LOG_FATAL)
+               abort ();
+}
+
+/**
+ * mono_log_close_logcat
+ *
+ *     Close access to Android logcat (no-op)
+ */
+void
+mono_log_close_logcat ()
+{
+       /* No-op on Android */
+}
+#endif
index fa11aabcb7b2789f1a1b6f8f486a369bd8dee21c..bdb6dffb50e27f1838959452b585907afa062bbf 100644 (file)
@@ -25,7 +25,8 @@
 #else
 #include <process.h>
 #endif
-#include "mono-logger.h"
+#include "mono-logger-internals.h"
+#include "mono-proclib.h"
 
 static FILE *logFile = NULL;
 static void *logUserData = NULL;
@@ -98,19 +99,17 @@ mono_log_open_logfile(const char *path, void *userData)
  *     @vargs - Variable argument list
  */
 void
-mono_log_write_logfile(const char *domain, GLogLevelFlags level, mono_bool hdr, const char *format, va_list args)
+mono_log_write_logfile (const char *log_domain, GLogLevelFlags level, mono_bool hdr, const char *message)
 {
        time_t t;
-       char logTime[80],       
-            logMessage[512];
-       pid_t pid;
-       int iLog = 0;
-       size_t nLog;
 
        if (logFile == NULL)
                logFile = stdout;
 
        if (hdr) {
+               pid_t pid;
+               char logTime [80];
+
 #ifndef HOST_WIN32
                struct tm tod;
                time(&t);
@@ -121,21 +120,20 @@ mono_log_write_logfile(const char *domain, GLogLevelFlags level, mono_bool hdr,
                struct tm *tod;
                time(&t);
                tod = localtime(&t);
-               pid = _getpid();
+               pid = mono_process_current_pid ();
                strftime(logTime, sizeof(logTime), "%F %T", tod);
 #endif
-               iLog = sprintf(logMessage, "%s level[%c] mono[%d]: ",
-                              logTime,mapLogFileLevel(level),pid);
+               fprintf (logFile, "%s level[%c] mono[%d]: %s\n", logTime, mapLogFileLevel (level), pid, message);
+       } else {
+               fprintf (logFile, "%s%s%s\n",
+                       log_domain != NULL ? log_domain : "",
+                       log_domain != NULL ? ": " : "",
+                       message);
        }
-       nLog = sizeof(logMessage) - iLog - 2;
-       vsnprintf(logMessage+iLog, nLog, format, args);
-       iLog = strlen(logMessage);
-       logMessage[iLog++] = '\n';
-       logMessage[iLog++] = '\0';
-       fputs(logMessage, logFile);
+
        fflush(logFile);
 
-       if (level == G_LOG_FLAG_FATAL)
+       if (level & G_LOG_LEVEL_ERROR)
                abort();
 }
 
diff --git a/mono/utils/mono-log-darwin.c b/mono/utils/mono-log-darwin.c
new file mode 100644 (file)
index 0000000..1214291
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * mono-log-darwin.c: Darwin-specific interface to the logger
+ *
+ */
+#include <config.h>
+
+#if defined(HOST_IOS)
+
+#include <asl.h>
+#include "mono-logger-internals.h"
+static int
+to_asl_priority (GLogLevelFlags log_level)
+{
+       switch (log_level & G_LOG_LEVEL_MASK)
+       {
+               case G_LOG_LEVEL_ERROR:     return ASL_LEVEL_CRIT;
+               case G_LOG_LEVEL_CRITICAL:  return ASL_LEVEL_ERR;
+               case G_LOG_LEVEL_WARNING:   return ASL_LEVEL_WARNING;
+               case G_LOG_LEVEL_MESSAGE:   return ASL_LEVEL_NOTICE;
+               case G_LOG_LEVEL_INFO:      return ASL_LEVEL_INFO;
+               case G_LOG_LEVEL_DEBUG:     return ASL_LEVEL_DEBUG;
+       }
+       return ASL_LEVEL_ERR;
+}
+
+void
+mono_log_open_asl (const char *path, void *userData)
+{
+}
+
+void
+mono_log_write_asl (const char *log_domain, GLogLevelFlags level, mono_bool hdr, const char *message)
+{
+       asl_log (NULL, NULL, to_asl_priority (level), "%s%s%s\n",
+               log_domain != NULL ? log_domain : "",
+               log_domain != NULL ? ": " : "",
+               message);
+
+       if (level & G_LOG_LEVEL_ERROR)
+               abort();
+}
+
+void
+mono_log_close_asl ()
+{
+}
+#endif
index 1ce111c1762e2ee67fea21015345fa6ea4c7ffdb..6d25d3a6117b7cc4237bc10c8c6ef9e1e67cec3d 100644 (file)
@@ -25,7 +25,7 @@
 #include <errno.h>
 #include <time.h>
 #include <sys/time.h>
-#include "mono-logger.h"
+#include "mono-logger-internals.h"
 
 static void *logUserData = NULL;
 
@@ -70,7 +70,7 @@ mono_log_open_syslog(const char *ident, void *userData)
 }
 
 /**
- * mono_log_write_logfile
+ * mono_log_write_syslog
  *     
  *     Write data to the log file.
  *
@@ -80,11 +80,11 @@ mono_log_open_syslog(const char *ident, void *userData)
  *     @vargs - Variable argument list
  */
 void
-mono_log_write_syslog(const char *domain, GLogLevelFlags level, mono_bool hdr, const char *format, va_list args)
+mono_log_write_syslog(const char *domain, GLogLevelFlags level, mono_bool hdr, const char *message)
 {
-       vsyslog(mapSyslogLevel(level), format, args);
+       syslog (mapSyslogLevel(level), "%s", message);
 
-       if (level == G_LOG_FLAG_FATAL)
+       if (level & G_LOG_LEVEL_ERROR)
                abort();
 }
 
index 1746128a9384306ebbd0619ec95335eb08264ec4..ab5db470e1941f75bd2e712d119f979ffa6ff602 100644 (file)
@@ -23,7 +23,8 @@
 #include <errno.h>
 #include <time.h>
 #include <process.h>
-#include "mono-logger.h"
+#include "mono-logger-internals.h"
+#include "mono-proclib.h"
 
 static FILE *logFile = NULL;
 static void *logUserData = NULL;
@@ -85,34 +86,26 @@ mono_log_open_syslog(const char *ident, void *userData)
  *     @vargs - Variable argument list
  */
 void
-mono_log_write_syslog(const char *domain, GLogLevelFlags level, mono_bool hdr, const char *format, va_list args)
+mono_log_write_syslog(const char *domain, GLogLevelFlags level, mono_bool hdr, const char *message)
 {
        time_t t;
-       struct tm *tod;
-       char logTime[80],
-             logMessage[512];
-       pid_t pid;
-       int iLog = 0;
-       size_t nLog;
+       int pid;
+       char logTime [80];
 
        if (logFile == NULL)
-               mono_log_open_syslog(NULL, NULL);
+               logFile = stdout;
 
+       struct tm *tod;
        time(&t);
        tod = localtime(&t);
-       pid = _getpid();
-       strftime(logTime, sizeof(logTime), "%Y-%m-%d %H:%M:%S", tod);
-       iLog = sprintf(logMessage, "%s level[%c] mono[%d]: ",
-                      logTime,mapLogFileLevel(level),pid);
-       nLog = sizeof(logMessage) - iLog - 2;
-       vsnprintf(logMessage+iLog, nLog, format, args);
-       iLog = strlen(logMessage);
-       logMessage[iLog++] = '\n';
-       logMessage[iLog++] = 0;
-       fputs(logMessage, logFile);
+       pid = mono_process_current_pid ();
+       strftime(logTime, sizeof(logTime), "%F %T", tod);
+
+       fprintf (logFile, "%s level[%c] mono[%d]: %s\n", logTime, mapLogFileLevel (level), pid, message);
+
        fflush(logFile);
 
-       if (level == G_LOG_FLAG_FATAL)
+       if (level & G_LOG_LEVEL_ERROR)
                abort();
 }
 
index f32a25e306d75f5a64ddd70ef84aaea354a290e2..d1e2599c30dd1e489a3cf8ff2884e09241d2b62f 100644 (file)
@@ -2,6 +2,7 @@
 #define __MONO_LOGGER_INTERNAL_H__
 
 #include <glib.h>
+#include <mono/utils/mono-compiler.h>
 #include "mono-logger.h"
 
 G_BEGIN_DECLS
@@ -74,8 +75,8 @@ mono_tracev (GLogLevelFlags level, MonoTraceMask mask, const char *format, va_li
  * Traces a new message, depending on the current logging level
  * and trace mask.
  */
-G_GNUC_UNUSED static void
-mono_trace (GLogLevelFlags level, MonoTraceMask mask, const char *format, ...) 
+G_GNUC_UNUSED MONO_ATTR_FORMAT_PRINTF(3,4) static void
+mono_trace (GLogLevelFlags level, MonoTraceMask mask, const char *format, ...)
 {
        if(G_UNLIKELY (level <= mono_internal_current_level && mask & mono_internal_current_mask)) {
                va_list args;
@@ -149,6 +150,44 @@ mono_trace_message(MonoTraceMask mask, const char *format, ...)
 
 #endif
 
+/* Internal logging API */
+typedef void (*MonoLoggerOpen) (const char *, void *);
+typedef void (*MonoLoggerWrite) (const char *, GLogLevelFlags, mono_bool, const char *);
+typedef void (*MonoLoggerClose) (void);
+
+typedef struct _MonoLogCallParm_ {
+       MonoLoggerOpen  opener;         /* Routine to open logging */
+       MonoLoggerWrite writer;         /* Routine to write log data */
+       MonoLoggerClose closer;         /* Routine to close logging */
+       char            *dest;          /* Log destination */
+       void            *user_data;     /* User data from legacy handler */
+       mono_bool       header;         /* Whether we want pid/time/date in log message */
+} MonoLogCallParm;
+
+void mono_trace_set_log_handler_internal (MonoLogCallParm *callback, void *user_data);
+void mono_trace_set_logdest_string (const char *value);
+void mono_trace_set_logheader_string (const char *value);
+
+void mono_log_open_syslog (const char *, void *);
+void mono_log_write_syslog (const char *, GLogLevelFlags, mono_bool, const char *);
+void mono_log_close_syslog (void);
+
+void mono_log_open_logfile (const char *, void *);
+void mono_log_write_logfile (const char *, GLogLevelFlags, mono_bool, const char *);
+void mono_log_close_logfile (void);
+
+#if PLATFORM_ANDROID
+void mono_log_open_logcat (const char *path, void *userData);
+void mono_log_write_logcat (const char *log_domain, GLogLevelFlags level, mono_bool hdr, const char *message);
+void mono_log_close_logcat (void);
+#endif
+
+#if defined(HOST_IOS)
+void mono_log_open_asl (const char *path, void *userData);
+void mono_log_write_asl (const char *log_domain, GLogLevelFlags level, mono_bool hdr, const char *message);
+void mono_log_close_asl (void);
+
+#endif
 
 G_END_DECLS
 
index f6cdd40b20d8df63eb141fdebd1b721017e12899..5cc59c77fbe6dd87bf56d097df56dc7380e9baf9 100644 (file)
@@ -29,7 +29,7 @@ static MonoLogCallParm logCallback = {
 typedef struct {
    MonoLogCallback legacy_callback;
    gpointer user_data;
-} legacyLoggerUserData;
+} UserSuppliedLoggerUserData;
 
 /**
  * mono_trace_init:
@@ -81,19 +81,19 @@ mono_trace_cleanup (void)
 void 
 mono_tracev_inner (GLogLevelFlags level, MonoTraceMask mask, const char *format, va_list args)
 {
+       char *log_message;
        if (level_stack == NULL) {
                mono_trace_init ();
                if(level > mono_internal_current_level || !(mask & mono_internal_current_mask))
                        return;
        }
 
-       if (logCallback.opener == NULL) {
-               logCallback.opener = mono_log_open_logfile;
-               logCallback.writer = mono_log_write_logfile;
-               logCallback.closer = mono_log_close_logfile;
-               logCallback.opener(NULL, NULL);
-       }
-       logCallback.writer(mono_log_domain, level, logCallback.header, format, args);
+       g_assert (logCallback.opener); // mono_trace_init should have provided us with one!
+
+       if (g_vasprintf (&log_message, format, args) < 0)
+               return;
+       logCallback.writer (mono_log_domain, level, logCallback.header, log_message);
+       g_free (log_message);
 }
 
 /**
@@ -148,19 +148,30 @@ mono_trace_set_logdest_string (const char *dest)
        if(level_stack == NULL)
                mono_trace_init();
 
+#if PLATFORM_ANDROID
+       logger.opener = mono_log_open_logcat;
+       logger.writer = mono_log_write_logcat;
+       logger.closer = mono_log_close_logcat;
+       logger.dest   = (char*) dest;
+#elif defined (HOST_IOS)
+       logger.opener = mono_log_open_asl;
+       logger.writer = mono_log_write_asl;
+       logger.closer = mono_log_close_asl;
+       logger.dest   = (char*) dest;
+#else
        if ((dest == NULL) || (strcmp("syslog", dest) != 0)) {
                logger.opener = mono_log_open_logfile;
                logger.writer = mono_log_write_logfile;
                logger.closer = mono_log_close_logfile;
                logger.dest   = (char *) dest;
-               mono_trace_set_log_handler_internal(&logger, NULL);
        } else {
                logger.opener = mono_log_open_syslog;
                logger.writer = mono_log_write_syslog;
                logger.closer = mono_log_close_syslog;
                logger.dest   = (char *) dest;
-               mono_trace_set_log_handler_internal(&logger, NULL);
        }
+#endif
+       mono_trace_set_log_handler_internal(&logger, NULL);
 }
 
 /**
@@ -280,7 +291,7 @@ mono_trace_set_mask_string (const char *value)
                        continue;
                }
                for (i = 0; valid_flags[i]; i++) {
-                       int len = strlen (valid_flags[i]);
+                       size_t len = strlen (valid_flags[i]);
                        if (strncmp (tok, valid_flags[i], len) == 0 && (tok[len] == 0 || tok[len] == ',')) {
                                flags |= valid_masks[i];
                                tok += len;
@@ -340,13 +351,19 @@ log_level_get_name (GLogLevelFlags log_level)
  * logging. We ignore the header request as legacy handlers never had headers.
  */
 static void
-callback_adapter(const char *domain, GLogLevelFlags level, mono_bool fatal, const char *fmt, va_list args)
+callback_adapter (const char *domain, GLogLevelFlags level, mono_bool fatal, const char *message)
 {
-       legacyLoggerUserData *ll = (legacyLoggerUserData *) logCallback.user_data;
-       const char *msg = g_strdup_vprintf (fmt, args);
+       UserSuppliedLoggerUserData *ll =logCallback.user_data;
 
-       ll->legacy_callback (domain, log_level_get_name(level), msg, fatal, ll->user_data);
-       g_free ((void *) msg);
+       ll->legacy_callback (domain, log_level_get_name(level), message, fatal, ll->user_data);
+}
+
+static void
+eglib_log_adapter (const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer user_data)
+{
+       UserSuppliedLoggerUserData *ll = logCallback.user_data;
+
+       ll->legacy_callback (log_domain, log_level_get_name (log_level), message, log_level & G_LOG_LEVEL_ERROR, ll->user_data);
 }
 
 /**
@@ -369,7 +386,7 @@ static void
 legacy_closer(void)
 {
        if (logCallback.user_data != NULL) {
-               g_free (logCallback.user_data); /* This is a LegacyLoggerUserData struct */
+               g_free (logCallback.user_data); /* This is a UserSuppliedLoggerUserData struct */
                logCallback.opener = NULL;      
                logCallback.writer = NULL;
                logCallback.closer = NULL;
@@ -386,15 +403,16 @@ legacy_closer(void)
  * 
  * The log handler replaces the default runtime logger. All logging requests with be routed to it.
  * If the fatal argument in the callback is true, the callback must abort the current process. The runtime expects that
- * execution will not resume after a fatal error. This is for "old-style" or legacy log handers.
+ * execution will not resume after a fatal error.
  */
 void
 mono_trace_set_log_handler (MonoLogCallback callback, void *user_data)
 {
-        g_assert (callback);
+       g_assert (callback);
+
        if (logCallback.closer != NULL)
                logCallback.closer();
-       legacyLoggerUserData *ll = g_malloc (sizeof (legacyLoggerUserData));
+       UserSuppliedLoggerUserData *ll = g_malloc (sizeof (UserSuppliedLoggerUserData));
        ll->legacy_callback = callback;
        ll->user_data = user_data;
        logCallback.opener = legacy_opener;
@@ -402,6 +420,14 @@ mono_trace_set_log_handler (MonoLogCallback callback, void *user_data)
        logCallback.closer = legacy_closer;
        logCallback.user_data = ll;
        logCallback.dest = NULL;
+
+       g_log_set_default_handler (eglib_log_adapter, user_data);
+}
+
+static void
+structured_log_adapter (const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer user_data)
+{
+       logCallback.writer (log_domain, log_level, logCallback.header, message);
 }
 
 /**
@@ -425,7 +451,9 @@ mono_trace_set_log_handler_internal (MonoLogCallParm *callback, void *user_data)
        logCallback.closer = callback->closer;
        logCallback.header = mono_trace_log_header;
        logCallback.dest   = callback->dest;
-       logCallback.opener(logCallback.dest, user_data);
+       logCallback.opener (logCallback.dest, user_data);
+
+       g_log_set_default_handler (structured_log_adapter, user_data);
 }
 
 static void
index 073daf1c87a16260f452584f96026e771eff8167..5f0943d5e1d698981354c2c86604edda6255d204 100644 (file)
@@ -10,32 +10,9 @@ mono_trace_set_level_string (const char *value);
 MONO_API void 
 mono_trace_set_mask_string (const char *value);
 
-MONO_API void 
-mono_trace_set_logdest_string (const char *value);
-
-MONO_API void 
-mono_trace_set_logheader_string (const char *value);
-
 typedef void (*MonoPrintCallback) (const char *string, mono_bool is_stdout);
 typedef void (*MonoLogCallback) (const char *log_domain, const char *log_level, const char *message, mono_bool fatal, void *user_data);
 
-
-typedef void (*MonoLoggerOpen) (const char *, void *);
-typedef void (*MonoLoggerWrite) (const char *, GLogLevelFlags, mono_bool, const char *, va_list);
-typedef void (*MonoLoggerClose) (void);
-
-typedef struct _MonoLogCallParm_ {
-       MonoLoggerOpen  opener;         /* Routine to open logging */
-       MonoLoggerWrite writer;         /* Routine to write log data */
-       MonoLoggerClose closer;         /* Routine to close logging */
-       char            *dest;          /* Log destination */
-       void            *user_data;     /* User data from legacy handler */
-       mono_bool       header;         /* Whether we want pid/time/date in log message */
-} MonoLogCallParm;
-
-void
-mono_trace_set_log_handler_internal (MonoLogCallParm *callback, void *user_data);
-
 MONO_API void
 mono_trace_set_log_handler (MonoLogCallback callback, void *user_data);
 
@@ -45,24 +22,6 @@ mono_trace_set_print_handler (MonoPrintCallback callback);
 MONO_API void
 mono_trace_set_printerr_handler (MonoPrintCallback callback);
 
-MONO_API void
-mono_log_open_syslog(const char *, void *);
-
-MONO_API void
-mono_log_write_syslog(const char *, GLogLevelFlags, mono_bool, const char *, va_list);
-
-MONO_API void
-mono_log_close_syslog(void);
-
-MONO_API void
-mono_log_open_logfile(const char *, void *);
-
-MONO_API void
-mono_log_write_logfile(const char *, GLogLevelFlags, mono_bool, const char *, va_list);
-
-MONO_API void
-mono_log_close_logfile(void);
-
 MONO_END_DECLS
 
 #endif /* __MONO_LOGGER_H__ */
index 60f6164dc4511921906c9076701ea86db707f50e..b59ffff85f93b28573c3089420381f8eeef6b484 100644 (file)
@@ -56,21 +56,6 @@ static inline void mono_memory_read_barrier (void)
        mono_memory_barrier ();
 }
 
-static inline void mono_memory_write_barrier (void)
-{
-       mono_memory_barrier ();
-}
-#elif defined(__ia64__)
-static inline void mono_memory_barrier (void)
-{
-       __asm__ __volatile__ ("mf" : : : "memory");
-}
-
-static inline void mono_memory_read_barrier (void)
-{
-       mono_memory_barrier ();
-}
-
 static inline void mono_memory_write_barrier (void)
 {
        mono_memory_barrier ();
index faca70b8ca95e655d759182f8538356a5291a8e5..90695609f0875b608f7c6ad3069b970459e4e86c 100644 (file)
 
 #include "mono-compiler.h"
 
-int mono_pages_not_faulted (void *addr, size_t length);
+void *
+malloc_shared_area (int pid);
+
+char*
+aligned_address (char *mem, size_t size, size_t alignment);
+
+void
+account_mem (MonoMemAccountType type, ssize_t size);
+
+int
+mono_pages_not_faulted (void *addr, size_t length);
 
 #endif /* __MONO_UTILS_MMAP_INTERNAL_H__ */
 
diff --git a/mono/utils/mono-mmap-windows-internals.h b/mono/utils/mono-mmap-windows-internals.h
new file mode 100644 (file)
index 0000000..44da254
--- /dev/null
@@ -0,0 +1,15 @@
+#ifndef __MONO_UTILS_MMAP_WINDOWS_H__
+#define __MONO_UTILS_MMAP_WINDOWS_H__
+
+#include <config.h>
+#include <glib.h>
+
+#ifdef HOST_WIN32
+#include "mono/utils/mono-mmap.h"
+#include "mono/utils/mono-mmap-internals.h"
+
+int
+mono_mmap_win_prot_from_flags (int flags);
+#endif /* HOST_WIN32 */
+#endif /* __MONO_UTILS_MMAP_WINDOWS_H__ */
+
diff --git a/mono/utils/mono-mmap-windows-uwp.c b/mono/utils/mono-mmap-windows-uwp.c
new file mode 100644 (file)
index 0000000..347fb70
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * mono-dl-windows-uwp.c: UWP dl support for Mono.
+ *
+ * Copyright 2016 Microsoft
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
+*/
+#include <config.h>
+#include <glib.h>
+#include "mono/utils/mono-compiler.h"
+
+#if G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT)
+#include <windows.h>
+#include <mono/utils/mono-mmap-windows-internals.h>
+
+void*
+mono_file_map (size_t length, int flags, int fd, guint64 offset, void **ret_handle)
+{
+       void *ptr;
+       int mflags = 0;
+       HANDLE file, mapping;
+       int prot = mono_mmap_win_prot_from_flags (flags);
+
+       mflags = FILE_MAP_READ;
+       if (flags & MONO_MMAP_WRITE)
+               mflags = FILE_MAP_COPY;
+
+       file = (HANDLE) _get_osfhandle (fd);
+       mapping = CreateFileMappingFromApp (file, NULL, prot, length, NULL);
+
+       if (mapping == NULL)
+               return NULL;
+
+       ptr = MapViewOfFileFromApp (mapping, mflags, offset, length);
+
+       if (ptr == NULL) {
+               CloseHandle (mapping);
+               return NULL;
+       }
+
+       *ret_handle = (void*)mapping;
+       return ptr;
+}
+
+int
+mono_file_unmap (void *addr, void *handle)
+{
+       UnmapViewOfFile (addr);
+       CloseHandle ((HANDLE)handle);
+       return 0;
+}
+
+#else /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
+
+MONO_EMPTY_SOURCE_FILE (mono_mmap_windows_uwp);
+#endif /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
diff --git a/mono/utils/mono-mmap-windows.c b/mono/utils/mono-mmap-windows.c
new file mode 100644 (file)
index 0000000..69619f8
--- /dev/null
@@ -0,0 +1,216 @@
+/*
+ * mono-mmap-windows.c: Windows support for mapping code into the process address space
+ *
+ * Author:
+ *   Mono Team (mono-list@lists.ximian.com)
+ *
+ * Copyright 2001-2008 Novell, Inc.
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
+ */
+
+#include <config.h>
+#include <glib.h>
+
+#if defined(HOST_WIN32)
+#include <windows.h>
+#include "mono/utils/mono-mmap-windows-internals.h"
+#include <mono/utils/mono-counters.h>
+#include <io.h>
+
+static void *malloced_shared_area = NULL;
+
+int
+mono_pagesize (void)
+{
+       SYSTEM_INFO info;
+       static int saved_pagesize = 0;
+       if (saved_pagesize)
+               return saved_pagesize;
+       GetSystemInfo (&info);
+       saved_pagesize = info.dwPageSize;
+       return saved_pagesize;
+}
+
+int
+mono_valloc_granule (void)
+{
+       SYSTEM_INFO info;
+       static int saved_valloc_granule = 0;
+       if (saved_valloc_granule)
+               return saved_valloc_granule;
+       GetSystemInfo (&info);
+       saved_valloc_granule = info.dwAllocationGranularity;
+       return saved_valloc_granule;
+}
+
+int
+mono_mmap_win_prot_from_flags (int flags)
+{
+       int prot = flags & (MONO_MMAP_READ|MONO_MMAP_WRITE|MONO_MMAP_EXEC);
+       switch (prot) {
+       case 0: prot = PAGE_NOACCESS; break;
+       case MONO_MMAP_READ: prot = PAGE_READONLY; break;
+       case MONO_MMAP_READ|MONO_MMAP_EXEC: prot = PAGE_EXECUTE_READ; break;
+       case MONO_MMAP_READ|MONO_MMAP_WRITE: prot = PAGE_READWRITE; break;
+       case MONO_MMAP_READ|MONO_MMAP_WRITE|MONO_MMAP_EXEC: prot = PAGE_EXECUTE_READWRITE; break;
+       case MONO_MMAP_WRITE: prot = PAGE_READWRITE; break;
+       case MONO_MMAP_WRITE|MONO_MMAP_EXEC: prot = PAGE_EXECUTE_READWRITE; break;
+       case MONO_MMAP_EXEC: prot = PAGE_EXECUTE; break;
+       default:
+               g_assert_not_reached ();
+       }
+       return prot;
+}
+
+void*
+mono_valloc (void *addr, size_t length, int flags, MonoMemAccountType type)
+{
+       void *ptr;
+       int mflags = MEM_RESERVE|MEM_COMMIT;
+       int prot = mono_mmap_win_prot_from_flags (flags);
+       /* translate the flags */
+
+       ptr = VirtualAlloc (addr, length, mflags, prot);
+
+       account_mem (type, (ssize_t)length);
+
+       return ptr;
+}
+
+void*
+mono_valloc_aligned (size_t length, size_t alignment, int flags, MonoMemAccountType type)
+{
+       int prot = mono_mmap_win_prot_from_flags (flags);
+       char *mem = VirtualAlloc (NULL, length + alignment, MEM_RESERVE, prot);
+       char *aligned;
+
+       if (!mem)
+               return NULL;
+
+       aligned = aligned_address (mem, length, alignment);
+
+       aligned = VirtualAlloc (aligned, length, MEM_COMMIT, prot);
+       g_assert (aligned);
+
+       account_mem (type, (ssize_t)length);
+
+       return aligned;
+}
+
+int
+mono_vfree (void *addr, size_t length, MonoMemAccountType type)
+{
+       MEMORY_BASIC_INFORMATION mbi;
+       SIZE_T query_result = VirtualQuery (addr, &mbi, sizeof (mbi));
+       BOOL res;
+
+       g_assert (query_result);
+
+       res = VirtualFree (mbi.AllocationBase, 0, MEM_RELEASE);
+
+       g_assert (res);
+
+       account_mem (type, -(ssize_t)length);
+
+       return 0;
+}
+
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
+void*
+mono_file_map (size_t length, int flags, int fd, guint64 offset, void **ret_handle)
+{
+       void *ptr;
+       int mflags = 0;
+       HANDLE file, mapping;
+       int prot = mono_mmap_win_prot_from_flags (flags);
+       /* translate the flags */
+       /*if (flags & MONO_MMAP_PRIVATE)
+               mflags |= MAP_PRIVATE;
+       if (flags & MONO_MMAP_SHARED)
+               mflags |= MAP_SHARED;
+       if (flags & MONO_MMAP_ANON)
+               mflags |= MAP_ANONYMOUS;
+       if (flags & MONO_MMAP_FIXED)
+               mflags |= MAP_FIXED;
+       if (flags & MONO_MMAP_32BIT)
+               mflags |= MAP_32BIT;*/
+
+       mflags = FILE_MAP_READ;
+       if (flags & MONO_MMAP_WRITE)
+               mflags = FILE_MAP_COPY;
+
+       file = (HANDLE) _get_osfhandle (fd);
+
+       mapping = CreateFileMapping (file, NULL, prot, 0, 0, NULL);
+
+       if (mapping == NULL)
+               return NULL;
+
+       ptr = MapViewOfFile (mapping, mflags, 0, offset, length);
+
+       if (ptr == NULL) {
+               CloseHandle (mapping);
+               return NULL;
+       }
+       *ret_handle = (void*)mapping;
+       return ptr;
+}
+
+int
+mono_file_unmap (void *addr, void *handle)
+{
+       UnmapViewOfFile (addr);
+       CloseHandle ((HANDLE)handle);
+       return 0;
+}
+#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */
+
+int
+mono_mprotect (void *addr, size_t length, int flags)
+{
+       DWORD oldprot;
+       int prot = mono_mmap_win_prot_from_flags (flags);
+
+       if (flags & MONO_MMAP_DISCARD) {
+               VirtualFree (addr, length, MEM_DECOMMIT);
+               VirtualAlloc (addr, length, MEM_COMMIT, prot);
+               return 0;
+       }
+       return VirtualProtect (addr, length, prot, &oldprot) == 0;
+}
+
+void*
+mono_shared_area (void)
+{
+       if (!malloced_shared_area)
+               malloced_shared_area = malloc_shared_area (0);
+       /* get the pid here */
+       return malloced_shared_area;
+}
+
+void
+mono_shared_area_remove (void)
+{
+       if (malloced_shared_area)
+               g_free (malloced_shared_area);
+       malloced_shared_area = NULL;
+}
+
+void*
+mono_shared_area_for_pid (void *pid)
+{
+       return NULL;
+}
+
+void
+mono_shared_area_unload (void *area)
+{
+}
+
+int
+mono_shared_area_instances (void **array, int count)
+{
+       return 0;
+}
+
+#endif
index 7fa483ce593747f586e4842fed1a720ffeff2dee..10a190ff9b059383a5705e6e0e5d765a79a7122d 100644 (file)
@@ -8,12 +8,9 @@
  * Licensed under the MIT license. See LICENSE file in the project root for full license information.
  */
 
-#include "config.h"
+#include <config.h>
 
-#ifdef HOST_WIN32
-#include <windows.h>
-#include <io.h>
-#else
+#ifndef HOST_WIN32
 #include <sys/types.h>
 #if HAVE_SYS_STAT_H
 #include <sys/stat.h>
 #include <unistd.h>
 #include <stdlib.h>
 #include <errno.h>
-#endif
+#endif /* !HOST_WIN32 */
 
 #include "mono-mmap.h"
 #include "mono-mmap-internals.h"
 #include "mono-proclib.h"
 #include <mono/utils/mono-threads.h>
-
+#include <mono/utils/atomic.h>
+#include <mono/utils/mono-counters.h>
 
 #define BEGIN_CRITICAL_SECTION do { \
        MonoThreadInfo *__info = mono_thread_info_current_unchecked (); \
@@ -61,9 +59,7 @@ typedef struct {
        short stats_end;
 } SAreaHeader;
 
-static void* malloced_shared_area = NULL;
-
-static void*
+void*
 malloc_shared_area (int pid)
 {
        int size = mono_pagesize ();
@@ -76,7 +72,7 @@ malloc_shared_area (int pid)
        return sarea;
 }
 
-static char*
+char*
 aligned_address (char *mem, size_t size, size_t alignment)
 {
        char *aligned = (char*)((size_t)(mem + (alignment - 1)) & ~(alignment - 1));
@@ -84,180 +80,61 @@ aligned_address (char *mem, size_t size, size_t alignment)
        return aligned;
 }
 
-#ifdef HOST_WIN32
-
-int
-mono_pagesize (void)
-{
-       SYSTEM_INFO info;
-       static int saved_pagesize = 0;
-       if (saved_pagesize)
-               return saved_pagesize;
-       GetSystemInfo (&info);
-       saved_pagesize = info.dwAllocationGranularity;
-       return saved_pagesize;
-}
-
-static int
-prot_from_flags (int flags)
-{
-       int prot = flags & (MONO_MMAP_READ|MONO_MMAP_WRITE|MONO_MMAP_EXEC);
-       switch (prot) {
-       case 0: prot = PAGE_NOACCESS; break;
-       case MONO_MMAP_READ: prot = PAGE_READONLY; break;
-       case MONO_MMAP_READ|MONO_MMAP_EXEC: prot = PAGE_EXECUTE_READ; break;
-       case MONO_MMAP_READ|MONO_MMAP_WRITE: prot = PAGE_READWRITE; break;
-       case MONO_MMAP_READ|MONO_MMAP_WRITE|MONO_MMAP_EXEC: prot = PAGE_EXECUTE_READWRITE; break;
-       case MONO_MMAP_WRITE: prot = PAGE_READWRITE; break;
-       case MONO_MMAP_WRITE|MONO_MMAP_EXEC: prot = PAGE_EXECUTE_READWRITE; break;
-       case MONO_MMAP_EXEC: prot = PAGE_EXECUTE; break;
-       default:
-               g_assert_not_reached ();
-       }
-       return prot;
-}
-
-void*
-mono_valloc (void *addr, size_t length, int flags)
-{
-       void *ptr;
-       int mflags = MEM_RESERVE|MEM_COMMIT;
-       int prot = prot_from_flags (flags);
-       /* translate the flags */
-
-       ptr = VirtualAlloc (addr, length, mflags, prot);
-       return ptr;
-}
-
-void*
-mono_valloc_aligned (size_t length, size_t alignment, int flags)
-{
-       int prot = prot_from_flags (flags);
-       char *mem = VirtualAlloc (NULL, length + alignment, MEM_RESERVE, prot);
-       char *aligned;
-
-       if (!mem)
-               return NULL;
-
-       aligned = aligned_address (mem, length, alignment);
-
-       aligned = VirtualAlloc (aligned, length, MEM_COMMIT, prot);
-       g_assert (aligned);
-
-       return aligned;
-}
-
-#define HAVE_VALLOC_ALIGNED
-
-int
-mono_vfree (void *addr, size_t length)
-{
-       MEMORY_BASIC_INFORMATION mbi;
-       SIZE_T query_result = VirtualQuery (addr, &mbi, sizeof (mbi));
-       BOOL res;
-
-       g_assert (query_result);
-
-       res = VirtualFree (mbi.AllocationBase, 0, MEM_RELEASE);
-
-       g_assert (res);
-
-       return 0;
-}
-
-void*
-mono_file_map (size_t length, int flags, int fd, guint64 offset, void **ret_handle)
-{
-       void *ptr;
-       int mflags = 0;
-       HANDLE file, mapping;
-       int prot = prot_from_flags (flags);
-       /* translate the flags */
-       /*if (flags & MONO_MMAP_PRIVATE)
-               mflags |= MAP_PRIVATE;
-       if (flags & MONO_MMAP_SHARED)
-               mflags |= MAP_SHARED;
-       if (flags & MONO_MMAP_ANON)
-               mflags |= MAP_ANONYMOUS;
-       if (flags & MONO_MMAP_FIXED)
-               mflags |= MAP_FIXED;
-       if (flags & MONO_MMAP_32BIT)
-               mflags |= MAP_32BIT;*/
-
-       mflags = FILE_MAP_READ;
-       if (flags & MONO_MMAP_WRITE)
-               mflags = FILE_MAP_COPY;
-
-       file = (HANDLE) _get_osfhandle (fd);
-       mapping = CreateFileMapping (file, NULL, prot, 0, 0, NULL);
-       if (mapping == NULL)
-               return NULL;
-       ptr = MapViewOfFile (mapping, mflags, 0, offset, length);
-       if (ptr == NULL) {
-               CloseHandle (mapping);
-               return NULL;
-       }
-       *ret_handle = (void*)mapping;
-       return ptr;
-}
-
-int
-mono_file_unmap (void *addr, void *handle)
-{
-       UnmapViewOfFile (addr);
-       CloseHandle ((HANDLE)handle);
-       return 0;
-}
-
-int
-mono_mprotect (void *addr, size_t length, int flags)
-{
-       DWORD oldprot;
-       int prot = prot_from_flags (flags);
-
-       if (flags & MONO_MMAP_DISCARD) {
-               VirtualFree (addr, length, MEM_DECOMMIT);
-               VirtualAlloc (addr, length, MEM_COMMIT, prot);
-               return 0;
-       }
-       return VirtualProtect (addr, length, prot, &oldprot) == 0;
-}
-
-void*
-mono_shared_area (void)
-{
-       if (!malloced_shared_area)
-               malloced_shared_area = malloc_shared_area (0);
-       /* get the pid here */
-       return malloced_shared_area;
-}
+static volatile size_t allocation_count [MONO_MEM_ACCOUNT_MAX];
 
 void
-mono_shared_area_remove (void)
+account_mem (MonoMemAccountType type, ssize_t size)
 {
-       if (malloced_shared_area)
-               g_free (malloced_shared_area);
-       malloced_shared_area = NULL;
+#if SIZEOF_VOID_P == 4
+       InterlockedAdd ((volatile gint32*)&allocation_count [type], (gint32)size);
+#else
+       InterlockedAdd64 ((volatile gint64*)&allocation_count [type], (gint64)size);
+#endif
 }
 
-void*
-mono_shared_area_for_pid (void *pid)
+const char*
+mono_mem_account_type_name (MonoMemAccountType type)
 {
-       return NULL;
+       static const char *names[] = {
+               "code",
+               "hazard pointers",
+               "domain",
+               "SGen internal",
+               "SGen nursery",
+               "SGen LOS",
+               "SGen mark&sweep",
+               "SGen card table",
+               "SGen shadow card table",
+               "SGen debugging",
+               "SGen binary protocol",
+               "exceptions",
+               "profiler",
+               "other"
+       };
+
+       return names [type];
 }
 
 void
-mono_shared_area_unload (void *area)
-{
+mono_mem_account_register_counters (void)
+{
+       for (int i = 0; i < MONO_MEM_ACCOUNT_MAX; ++i) {
+               const char *prefix = "Valloc ";
+               const char *name = mono_mem_account_type_name (i);
+               char descr [128];
+               g_assert (strlen (prefix) + strlen (name) < sizeof (descr));
+               sprintf (descr, "%s%s", prefix, name);
+               mono_counters_register (descr, MONO_COUNTER_WORD | MONO_COUNTER_RUNTIME | MONO_COUNTER_BYTES | MONO_COUNTER_VARIABLE, (void*)&allocation_count [i]);
+       }
 }
 
-int
-mono_shared_area_instances (void **array, int count)
-{
-       return 0;
-}
+#ifdef HOST_WIN32
+// Windows specific implementation in mono-mmap-windows.c
+#define HAVE_VALLOC_ALIGNED
 
 #else
+
+static void* malloced_shared_area = NULL;
 #if defined(HAVE_MMAP)
 
 /**
@@ -278,6 +155,12 @@ mono_pagesize (void)
        return saved_pagesize;
 }
 
+int
+mono_valloc_granule (void)
+{
+       return mono_pagesize ();
+}
+
 static int
 prot_from_flags (int flags)
 {
@@ -307,7 +190,7 @@ prot_from_flags (int flags)
  * Returns: NULL on failure, the address of the memory area otherwise
  */
 void*
-mono_valloc (void *addr, size_t length, int flags)
+mono_valloc (void *addr, size_t length, int flags, MonoMemAccountType type)
 {
        void *ptr;
        int mflags = 0;
@@ -334,6 +217,9 @@ mono_valloc (void *addr, size_t length, int flags)
 
        if (ptr == MAP_FAILED)
                return NULL;
+
+       account_mem (type, (ssize_t)length);
+
        return ptr;
 }
 
@@ -347,12 +233,15 @@ mono_valloc (void *addr, size_t length, int flags)
  * Returns: 0 on success.
  */
 int
-mono_vfree (void *addr, size_t length)
+mono_vfree (void *addr, size_t length, MonoMemAccountType type)
 {
        int res;
        BEGIN_CRITICAL_SECTION;
        res = munmap (addr, length);
        END_CRITICAL_SECTION;
+
+       account_mem (type, -(ssize_t)length);
+
        return res;
 }
 
@@ -481,14 +370,20 @@ mono_pagesize (void)
        return 4096;
 }
 
+int
+mono_valloc_granule (void)
+{
+       return mono_pagesize ();
+}
+
 void*
-mono_valloc (void *addr, size_t length, int flags)
+mono_valloc (void *addr, size_t length, int flags, MonoMemAccountType type)
 {
-       return malloc (length);
+       return g_malloc (length);
 }
 
 void*
-mono_valloc_aligned (size_t length, size_t alignment, int flags)
+mono_valloc_aligned (size_t size, size_t alignment, int flags, MonoMemAccountType type)
 {
        g_assert_not_reached ();
 }
@@ -496,9 +391,9 @@ mono_valloc_aligned (size_t length, size_t alignment, int flags)
 #define HAVE_VALLOC_ALIGNED
 
 int
-mono_vfree (void *addr, size_t length)
+mono_vfree (void *addr, size_t length, MonoMemAccountType type)
 {
-       free (addr);
+       g_free (addr);
        return 0;
 }
 
@@ -747,10 +642,10 @@ mono_shared_area_instances (void **array, int count)
 
 #ifndef HAVE_VALLOC_ALIGNED
 void*
-mono_valloc_aligned (size_t size, size_t alignment, int flags)
+mono_valloc_aligned (size_t size, size_t alignment, int flags, MonoMemAccountType type)
 {
        /* Allocate twice the memory to be able to put the block on an aligned address */
-       char *mem = (char *) mono_valloc (NULL, size + alignment, flags);
+       char *mem = (char *) mono_valloc (NULL, size + alignment, flags, type);
        char *aligned;
 
        if (!mem)
@@ -759,9 +654,9 @@ mono_valloc_aligned (size_t size, size_t alignment, int flags)
        aligned = aligned_address (mem, size, alignment);
 
        if (aligned > mem)
-               mono_vfree (mem, aligned - mem);
+               mono_vfree (mem, aligned - mem, type);
        if (aligned + size < mem + size + alignment)
-               mono_vfree (aligned + size, (mem + size + alignment) - (aligned + size));
+               mono_vfree (aligned + size, (mem + size + alignment) - (aligned + size), type);
 
        return aligned;
 }
index 017bbcec5bb6aab1b023661caa5b2102b17469b7..1b3b1d63af9fae39922ffe6aaceb51b3266bf3e6 100644 (file)
@@ -20,6 +20,24 @@ enum {
        MONO_MMAP_32BIT   = 1 << 8
 };
 
+typedef enum {
+       MONO_MEM_ACCOUNT_CODE,
+       MONO_MEM_ACCOUNT_HAZARD_POINTERS,
+       MONO_MEM_ACCOUNT_DOMAIN,
+       MONO_MEM_ACCOUNT_SGEN_INTERNAL,
+       MONO_MEM_ACCOUNT_SGEN_NURSERY,
+       MONO_MEM_ACCOUNT_SGEN_LOS,
+       MONO_MEM_ACCOUNT_SGEN_MARKSWEEP,
+       MONO_MEM_ACCOUNT_SGEN_CARD_TABLE,
+       MONO_MEM_ACCOUNT_SGEN_SHADOW_CARD_TABLE,
+       MONO_MEM_ACCOUNT_SGEN_DEBUGGING,
+       MONO_MEM_ACCOUNT_SGEN_BINARY_PROTOCOL,
+       MONO_MEM_ACCOUNT_EXCEPTIONS,
+       MONO_MEM_ACCOUNT_PROFILER,
+       MONO_MEM_ACCOUNT_OTHER,
+       MONO_MEM_ACCOUNT_MAX
+} MonoMemAccountType;
+
 /*
  * A simple interface to fopen/fstat/fileno
  */
@@ -31,9 +49,10 @@ MONO_API int          mono_file_map_fd    (MonoFileMap *fmap);
 MONO_API int          mono_file_map_close (MonoFileMap *fmap);
 
 MONO_API int   mono_pagesize   (void);
-MONO_API void* mono_valloc     (void *addr, size_t length, int flags);
-MONO_API void* mono_valloc_aligned (size_t length, size_t alignment, int flags);
-MONO_API int   mono_vfree      (void *addr, size_t length);
+MONO_API int   mono_valloc_granule (void);
+MONO_API void* mono_valloc     (void *addr, size_t length, int flags, MonoMemAccountType type);
+MONO_API void* mono_valloc_aligned (size_t length, size_t alignment, int flags, MonoMemAccountType type);
+MONO_API int   mono_vfree      (void *addr, size_t length, MonoMemAccountType type);
 MONO_API void* mono_file_map   (size_t length, int flags, int fd, guint64 offset, void **ret_handle);
 MONO_API int   mono_file_unmap (void *addr, void *handle);
 #ifndef HOST_WIN32
@@ -42,6 +61,9 @@ MONO_API int   mono_file_unmap_fileio (void *addr, void *handle);
 #endif
 MONO_API int   mono_mprotect   (void *addr, size_t length, int flags);
 
+MONO_API const char* mono_mem_account_type_name (MonoMemAccountType type);
+MONO_API void  mono_mem_account_register_counters (void);
+
 MONO_API void* mono_shared_area         (void);
 MONO_API void  mono_shared_area_remove  (void);
 MONO_API void* mono_shared_area_for_pid (void *pid);
index ece9bd410f6142aa38b59773fbdd144ed1d60c07..cd33375894c1db0f95fdf61ae054c50043a18f2d 100644 (file)
@@ -76,16 +76,14 @@ mono_os_mutex_init_recursive (mono_mutex_t *mutex)
                g_error ("%s: pthread_mutexattr_destroy failed with \"%s\" (%d)", __func__, g_strerror (res), res);
 }
 
-static inline int
+static inline void
 mono_os_mutex_destroy (mono_mutex_t *mutex)
 {
        int res;
 
        res = pthread_mutex_destroy (mutex);
-       if (G_UNLIKELY (res != 0 && res != EBUSY))
+       if (G_UNLIKELY (res != 0))
                g_error ("%s: pthread_mutex_destroy failed with \"%s\" (%d)", __func__, g_strerror (res), res);
-
-       return res != 0 ? -1 : 0;
 }
 
 static inline void
@@ -130,16 +128,14 @@ mono_os_cond_init (mono_cond_t *cond)
                g_error ("%s: pthread_cond_init failed with \"%s\" (%d)", __func__, g_strerror (res), res);
 }
 
-static inline int
+static inline void
 mono_os_cond_destroy (mono_cond_t *cond)
 {
        int res;
 
        res = pthread_cond_destroy (cond);
-       if (G_UNLIKELY (res != 0 && res != EBUSY))
+       if (G_UNLIKELY (res != 0))
                g_error ("%s: pthread_cond_destroy failed with \"%s\" (%d)", __func__, g_strerror (res), res);
-
-       return res != 0 ? -1 : 0;
 }
 
 static inline void
@@ -169,7 +165,7 @@ mono_os_cond_timedwait (mono_cond_t *cond, mono_mutex_t *mutex, guint32 timeout_
 
        res = gettimeofday (&tv, NULL);
        if (G_UNLIKELY (res != 0))
-               g_error ("%s: pthread_cond_timedwait failed with \"%s\" (%d)", __func__, g_strerror (errno), errno);
+               g_error ("%s: gettimeofday failed with \"%s\" (%d)", __func__, g_strerror (errno), errno);
 
        tv.tv_sec += timeout_ms / 1000;
        usecs = tv.tv_usec + ((timeout_ms % 1000) * 1000);
@@ -296,11 +292,10 @@ mono_os_mutex_init_recursive (mono_mutex_t *mutex)
                g_error ("%s: InitializeCriticalSectionEx failed with error %d", __func__, GetLastError ());
 }
 
-static inline int
+static inline void
 mono_os_mutex_destroy (mono_mutex_t *mutex)
 {
        DeleteCriticalSection (mutex);
-       return 0;
 }
 
 static inline void
@@ -327,11 +322,10 @@ mono_os_cond_init (mono_cond_t *cond)
        InitializeConditionVariable (cond);
 }
 
-static inline int
+static inline void
 mono_os_cond_destroy (mono_cond_t *cond)
 {
        /* Beauty of win32 API: do not destroy it */
-       return 0;
 }
 
 static inline void
index 9f59ce1ea821df2fa3dd849edd89d8e3a8b8aee7..c4bfe620f98edd116b07884e10c0f9b5ecae0922 100644 (file)
@@ -291,7 +291,12 @@ typedef HANDLE MonoSemType;
 static inline void
 mono_os_sem_init (MonoSemType *sem, int value)
 {
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
        *sem = CreateSemaphore (NULL, value, 0x7FFFFFFF, NULL);
+#else
+       *sem = CreateSemaphoreEx (NULL, value, 0x7FFFFFFF, NULL, 0, SEMAPHORE_ALL_ACCESS);
+#endif
+
        if (G_UNLIKELY (*sem == NULL))
                g_error ("%s: CreateSemaphore failed with error %d", __func__, GetLastError ());
 }
diff --git a/mono/utils/mono-proclib-windows-internals.h b/mono/utils/mono-proclib-windows-internals.h
new file mode 100644 (file)
index 0000000..f14c7a4
--- /dev/null
@@ -0,0 +1,13 @@
+#ifndef __MONO_UTILS_PROCLIB_WINDOWS_H__
+#define __MONO_UTILS_PROCLIB_WINDOWS_H__
+
+#include <config.h>
+#include <glib.h>
+
+#ifdef HOST_WIN32
+#include <process.h>
+#include "mono/utils/mono-proclib.h"
+
+#endif /* HOST_WIN32 */
+#endif /* __MONO_UTILS_PROCLIB_WINDOWS_H__ */
+
diff --git a/mono/utils/mono-proclib-windows-uwp.c b/mono/utils/mono-proclib-windows-uwp.c
new file mode 100644 (file)
index 0000000..4a2f37d
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+ * mono-proclib-windows-uwp.c: UWP proclib support for Mono.
+ *
+ * Copyright 2016 Microsoft
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
+*/
+#include <config.h>
+#include <glib.h>
+#include "mono/utils/mono-compiler.h"
+
+#if G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT)
+#include <windows.h>
+#include <mono/utils/mono-proclib.h>
+
+gint32
+mono_cpu_usage (MonoCpuUsageState *prev)
+{
+       gint32 cpu_usage = 0;
+       gint64 cpu_total_time;
+       gint64 cpu_busy_time;
+       guint64 idle_time;
+       guint64 kernel_time;
+       guint64 user_time;
+       guint64 current_time;
+       guint64 creation_time;
+       guint64 exit_time;
+
+       GetSystemTimeAsFileTime ((FILETIME*)&current_time);
+       if (!GetProcessTimes (GetCurrentProcess (), (FILETIME*)&creation_time, (FILETIME*)&exit_time, (FILETIME*)&kernel_time, (FILETIME*)&user_time)) {
+               g_error ("GetProcessTimes() failed, error code is %d\n", GetLastError ());
+               return -1;
+       }
+
+       // GetProcessTimes user_time is a sum of user time spend by all threads in the process.
+       // This means that the total user time can be more than real time. In order to adjust for this
+       // the total available time that we can be scheduled depends on the number of available cores.
+       // For example, having 2 threads running 100% on a 2 core system for 100 ms will return a user_time of 200ms
+       // but the current_time - creation_time will only be 100ms but by adjusting the available time based on number of
+       // of availalbe cores will gives use the total load of the process.
+       guint64 total_available_time = (current_time - creation_time) * mono_cpu_count ();
+
+       idle_time = total_available_time - (kernel_time + user_time);
+
+       cpu_total_time = (gint64)((idle_time - (prev ? prev->idle_time : 0)) + (user_time - (prev ? prev->user_time : 0)) + (kernel_time - (prev ? prev->kernel_time : 0)));
+       cpu_busy_time = (gint64)(cpu_total_time - (idle_time - (prev ? prev->idle_time : 0)));
+
+       if (prev) {
+               prev->idle_time = idle_time;
+               prev->kernel_time = kernel_time;
+               prev->user_time = user_time;
+       }
+
+       if (cpu_total_time > 0 && cpu_busy_time > 0)
+               cpu_usage = (gint32)(cpu_busy_time * 100 / cpu_total_time);
+
+       return cpu_usage;
+}
+
+#else /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
+
+MONO_EMPTY_SOURCE_FILE (mono_proclib_windows_uwp);
+#endif /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
diff --git a/mono/utils/mono-proclib-windows.c b/mono/utils/mono-proclib-windows.c
new file mode 100644 (file)
index 0000000..6386a51
--- /dev/null
@@ -0,0 +1,74 @@
+/*
+ * mono-proclib-windows.c: Windows proclib support for Mono.
+ *
+ * Copyright 2016 Microsoft
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
+*/
+
+#include <config.h>
+#include <glib.h>
+
+#ifdef HOST_WIN32
+#include <windows.h>
+#include "mono/utils/mono-proclib.h"
+
+int
+mono_process_current_pid ()
+{
+       return (int) GetCurrentProcessId ();
+}
+
+/**
+ * mono_cpu_count:
+ *
+ * Return the number of processors on the system.
+ */
+int
+mono_cpu_count (void)
+{
+       SYSTEM_INFO info;
+       GetSystemInfo (&info);
+       return info.dwNumberOfProcessors;
+}
+
+/*
+ * This function returns the cpu usage in percentage,
+ * normalized on the number of cores.
+ *
+ * Warning : the percentage returned can be > 100%. This
+ * might happens on systems like Android which, for
+ * battery and performance reasons, shut down cores and
+ * lie about the number of active cores.
+ */
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
+gint32
+mono_cpu_usage (MonoCpuUsageState *prev)
+{
+       gint32 cpu_usage = 0;
+       gint64 cpu_total_time;
+       gint64 cpu_busy_time;
+       guint64 idle_time;
+       guint64 kernel_time;
+       guint64 user_time;
+
+       if (!GetSystemTimes ((FILETIME*) &idle_time, (FILETIME*) &kernel_time, (FILETIME*) &user_time)) {
+               g_error ("GetSystemTimes() failed, error code is %d\n", GetLastError ());
+               return -1;
+       }
+
+       cpu_total_time = (gint64)((user_time - (prev ? prev->user_time : 0)) + (kernel_time - (prev ? prev->kernel_time : 0)));
+       cpu_busy_time = (gint64)(cpu_total_time - (idle_time - (prev ? prev->idle_time : 0)));
+
+       if (prev) {
+               prev->idle_time = idle_time;
+               prev->kernel_time = kernel_time;
+               prev->user_time = user_time;
+       }
+
+       if (cpu_total_time > 0 && cpu_busy_time > 0)
+               cpu_usage = (gint32)(cpu_busy_time * 100 / cpu_total_time);
+
+       return cpu_usage;
+}
+#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */
+#endif /* HOST_WIN32*/
index efd732d6d56b7592b9de709a4d34c352e42baf8f..9c37ccf2ec11874e121c4a394e980461c8a3c9f3 100644 (file)
 #include <sched.h>
 #endif
 
-#ifdef HOST_WIN32
-#include <windows.h>
-#include <process.h>
-#endif
-
 #if defined(_POSIX_VERSION)
 #include <sys/errno.h>
 #include <sys/param.h>
 #    define kinfo_starttime_member kp_proc.p_starttime
 #    define kinfo_pid_member kp_proc.p_pid
 #    define kinfo_name_member kp_proc.p_comm
+#elif defined(__NetBSD__)
+#    define kinfo_starttime_member p_ustart_sec
+#    define kinfo_pid_member p_pid
+#    define kinfo_name_member p_comm
 #elif defined(__OpenBSD__)
 // Can not figure out how to get the proc's start time on OpenBSD
 #    undef kinfo_starttime_member 
@@ -76,7 +75,7 @@ mono_process_list (int *size)
 #ifdef KERN_PROC2
        int mib [6];
        size_t data_len = sizeof (struct kinfo_proc2) * 400;
-       struct kinfo_proc2 *processes = malloc (data_len);
+       struct kinfo_proc2 *processes = g_malloc (data_len);
 #else
        int mib [4];
        size_t data_len = sizeof (struct kinfo_proc) * 16;
@@ -101,7 +100,7 @@ mono_process_list (int *size)
 
        res = sysctl (mib, 6, processes, &data_len, NULL, 0);
        if (res < 0) {
-               free (processes);
+               g_free (processes);
                return NULL;
        }
 #else
@@ -115,10 +114,10 @@ mono_process_list (int *size)
                res = sysctl (mib, 4, NULL, &data_len, NULL, 0);
                if (res)
                        return NULL;
-               processes = (struct kinfo_proc *) malloc (data_len);
+               processes = (struct kinfo_proc *) g_malloc (data_len);
                res = sysctl (mib, 4, processes, &data_len, NULL, 0);
                if (res < 0) {
-                       free (processes);
+                       g_free (processes);
                        if (errno != ENOMEM)
                                return NULL;
                        limit --;
@@ -136,7 +135,7 @@ mono_process_list (int *size)
        buf = (void **) g_realloc (buf, res * sizeof (void*));
        for (i = 0; i < res; ++i)
                buf [i] = GINT_TO_POINTER (processes [i].kinfo_pid_member);
-       free (processes);
+       g_free (processes);
        if (size)
                *size = res;
        return buf;
@@ -183,7 +182,7 @@ get_pid_status_item_buf (int pid, const char *item, char *rbuf, int blen, MonoPr
        char buf [256];
        char *s;
        FILE *f;
-       int len = strlen (item);
+       size_t len = strlen (item);
 
        g_snprintf (buf, sizeof (buf), "/proc/%d/status", pid);
        f = fopen (buf, "r");
@@ -282,7 +281,7 @@ mono_process_get_name (gpointer pid, char *buf, int len)
        char fname [128];
        FILE *file;
        char *p;
-       int r;
+       size_t r;
        sprintf (fname, "/proc/%d/cmdline", GPOINTER_TO_INT (pid));
        buf [0] = 0;
        file = fopen (fname, "r");
@@ -317,8 +316,16 @@ mono_process_get_times (gpointer pid, gint64 *start_time, gint64 *user_time, gin
                {
                        KINFO_PROC processi;
 
-                       if (sysctl_kinfo_proc (pid, &processi))
+                       if (sysctl_kinfo_proc (pid, &processi)) {
+#if defined(__NetBSD__)
+                               struct timeval tv;
+                               tv.tv_sec = processi.kinfo_starttime_member;
+                               tv.tv_usec = processi.p_ustart_usec;
+                               *start_time = mono_100ns_datetime_from_timeval(tv);
+#else
                                *start_time = mono_100ns_datetime_from_timeval (processi.kinfo_starttime_member);
+#endif
+                       }
                }
 #endif
 
@@ -431,7 +438,8 @@ get_process_stat_item (int pid, int pos, int sum, MonoProcessError *error)
        char buf [512];
        char *s, *end;
        FILE *f;
-       int len, i;
+       size_t len;
+       int i;
        gint64 value;
 
        g_snprintf (buf, sizeof (buf), "/proc/%d/stat", pid);
@@ -625,31 +633,27 @@ mono_process_get_data (gpointer pid, MonoProcessData data)
        return mono_process_get_data_with_error (pid, data, &error);
 }
 
+#ifndef HOST_WIN32
 int
 mono_process_current_pid ()
 {
 #if defined(HAVE_UNISTD_H)
        return (int) getpid ();
-#elif defined(HOST_WIN32)
-       return (int) GetCurrentProcessId ();
 #else
 #error getpid
 #endif
 }
+#endif /* !HOST_WIN32 */
 
 /**
  * mono_cpu_count:
  *
  * Return the number of processors on the system.
  */
+#ifndef HOST_WIN32
 int
 mono_cpu_count (void)
 {
-#ifdef HOST_WIN32
-       SYSTEM_INFO info;
-       GetSystemInfo (&info);
-       return info.dwNumberOfProcessors;
-#else
 #ifdef PLATFORM_ANDROID
        /* Android tries really hard to save power by powering off CPUs on SMP phones which
         * means the normal way to query cpu count returns a wrong value with userspace API.
@@ -767,10 +771,10 @@ mono_cpu_count (void)
                        return count;
        }
 #endif
-#endif /* HOST_WIN32 */
        /* FIXME: warn */
        return 1;
 }
+#endif /* !HOST_WIN32 */
 
 static void
 get_cpu_times (int cpu_id, gint64 *user, gint64 *systemt, gint64 *irq, gint64 *sirq, gint64 *idle)
@@ -877,14 +881,13 @@ mono_atexit (void (*func)(void))
  * battery and performance reasons, shut down cores and
  * lie about the number of active cores.
  */
+#ifndef HOST_WIN32
 gint32
 mono_cpu_usage (MonoCpuUsageState *prev)
 {
        gint32 cpu_usage = 0;
        gint64 cpu_total_time;
        gint64 cpu_busy_time;
-
-#ifndef HOST_WIN32
        struct rusage resource_usage;
        gint64 current_time;
        gint64 kernel_time;
@@ -907,28 +910,10 @@ mono_cpu_usage (MonoCpuUsageState *prev)
                prev->user_time = user_time;
                prev->current_time = current_time;
        }
-#else
-       guint64 idle_time;
-       guint64 kernel_time;
-       guint64 user_time;
-
-       if (!GetSystemTimes ((FILETIME*) &idle_time, (FILETIME*) &kernel_time, (FILETIME*) &user_time)) {
-               g_error ("GetSystemTimes() failed, error code is %d\n", GetLastError ());
-               return -1;
-       }
-
-       cpu_total_time = (gint64)((user_time - (prev ? prev->user_time : 0)) + (kernel_time - (prev ? prev->kernel_time : 0)));
-       cpu_busy_time = (gint64)(cpu_total_time - (idle_time - (prev ? prev->idle_time : 0)));
-
-       if (prev) {
-               prev->idle_time = idle_time;
-               prev->kernel_time = kernel_time;
-               prev->user_time = user_time;
-       }
-#endif
 
        if (cpu_total_time > 0 && cpu_busy_time > 0)
                cpu_usage = (gint32)(cpu_busy_time * 100 / cpu_total_time);
 
        return cpu_usage;
 }
+#endif /* !HOST_WIN32 */
index 89d4fb68b7590a565057dd42d4ca1844ac571340..e2614388ce96038ff74ab94e56bea381c128ee23 100644 (file)
@@ -116,6 +116,15 @@ mono_set_allocator_vtable (MonoAllocatorVTable* vtable);
 #define MONO_RT_EXTERNAL_ONLY
 #endif /* MONO_INSIDE_RUNTIME */
 
+#ifdef __GNUC__
+#define _MONO_DEPRECATED __attribute__ ((deprecated))
+#elif defined (_MSC_VER)
+#define _MONO_DEPRECATED __declspec (deprecated)
+#else
+#define _MONO_DEPRECATED
+#endif
+
+#define MONO_DEPRECATED MONO_API MONO_RT_EXTERNAL_ONLY _MONO_DEPRECATED
 
 MONO_END_DECLS
 
diff --git a/mono/utils/mono-rand-windows-internals.h b/mono/utils/mono-rand-windows-internals.h
new file mode 100644 (file)
index 0000000..f60c121
--- /dev/null
@@ -0,0 +1,33 @@
+#ifndef _MONO_UTILS_RAND_WINDOWS_H_
+#define _MONO_UTILS_RAND_WINDOWS_H_
+
+#include <config.h>
+#include <glib.h>
+
+#ifdef HOST_WIN32
+
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
+#include <wincrypt.h>
+#define MONO_WIN32_CRYPT_PROVIDER_HANDLE HCRYPTPROV
+
+#else
+
+#include <bcrypt.h>
+#define MONO_WIN32_CRYPT_PROVIDER_HANDLE BCRYPT_ALG_HANDLE
+#endif
+
+MONO_WIN32_CRYPT_PROVIDER_HANDLE
+mono_rand_win_open_provider (void);
+
+gboolean
+mono_rand_win_gen (MONO_WIN32_CRYPT_PROVIDER_HANDLE provider, guchar *buffer, size_t buffer_size);
+
+gboolean
+mono_rand_win_seed (MONO_WIN32_CRYPT_PROVIDER_HANDLE provider, guchar *seed, size_t seed_size);
+
+void
+mono_rand_win_close_provider (MONO_WIN32_CRYPT_PROVIDER_HANDLE provider);
+
+#endif /* HOST_WIN32 */
+#endif /* _MONO_UTILS_RAND_WINDOWS_H_ */
+
diff --git a/mono/utils/mono-rand-windows-uwp.c b/mono/utils/mono-rand-windows-uwp.c
new file mode 100644 (file)
index 0000000..7d92434
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * mono-rand-windows-uwp.c: UWP rand support for Mono.
+ *
+ * Copyright 2016 Microsoft
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
+*/
+#include <config.h>
+#include <glib.h>
+#include "mono/utils/mono-compiler.h"
+
+#if G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT)
+#include <windows.h>
+#include "mono/utils/mono-rand-windows-internals.h"
+
+MONO_WIN32_CRYPT_PROVIDER_HANDLE
+mono_rand_win_open_provider (void)
+{
+       MONO_WIN32_CRYPT_PROVIDER_HANDLE provider = 0;
+
+       if (!BCRYPT_SUCCESS (BCryptOpenAlgorithmProvider (&provider, BCRYPT_RNG_ALGORITHM, NULL, 0)))
+               provider = 0;
+
+       return provider;
+}
+
+gboolean
+mono_rand_win_gen (MONO_WIN32_CRYPT_PROVIDER_HANDLE provider, guchar *buffer, size_t buffer_size)
+{
+       g_assert (provider != 0 && buffer != 0);
+       return (BCRYPT_SUCCESS (BCryptGenRandom (provider, buffer, (ULONG) buffer_size, 0))) ? TRUE : FALSE;
+}
+
+gboolean
+mono_rand_win_seed (MONO_WIN32_CRYPT_PROVIDER_HANDLE provider, guchar *seed, size_t seed_size)
+{
+       g_assert (provider != 0 && seed != 0);
+       return (BCRYPT_SUCCESS (BCryptGenRandom (provider, seed, (ULONG) seed_size, BCRYPT_RNG_USE_ENTROPY_IN_BUFFER))) ? TRUE : FALSE;
+}
+
+void
+mono_rand_win_close_provider (MONO_WIN32_CRYPT_PROVIDER_HANDLE provider)
+{
+       g_assert (provider != 0);
+       BCryptCloseAlgorithmProvider (provider, 0);
+}
+
+#else /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
+
+MONO_EMPTY_SOURCE_FILE (mono_rand_windows_uwp);
+#endif /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
diff --git a/mono/utils/mono-rand-windows.c b/mono/utils/mono-rand-windows.c
new file mode 100644 (file)
index 0000000..97f57ce
--- /dev/null
@@ -0,0 +1,172 @@
+/*
+ * mono-rand-windows.c: Windows rand support for Mono.
+ *
+ * Copyright 2016 Microsoft
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
+*/
+#include <config.h>
+#include <glib.h>
+#include "mono-error.h"
+#include "mono-error-internals.h"
+#include "mono-rand.h"
+
+#if defined(HOST_WIN32)
+#include <windows.h>
+#include "mono/utils/mono-rand-windows-internals.h"
+
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
+#ifndef PROV_INTEL_SEC
+#define PROV_INTEL_SEC         22
+#endif
+#ifndef CRYPT_VERIFY_CONTEXT
+#define CRYPT_VERIFY_CONTEXT   0xF0000000
+#endif
+
+MONO_WIN32_CRYPT_PROVIDER_HANDLE
+mono_rand_win_open_provider (void)
+{
+       MONO_WIN32_CRYPT_PROVIDER_HANDLE provider = 0;
+
+       /* There is no need to create a container for just random data,
+        * so we can use CRYPT_VERIFY_CONTEXT (one call) see:
+        * http://blogs.msdn.com/dangriff/archive/2003/11/19/51709.aspx */
+
+       /* We first try to use the Intel PIII RNG if drivers are present */
+       if (!CryptAcquireContext (&provider, NULL, NULL, PROV_INTEL_SEC, CRYPT_VERIFY_CONTEXT)) {
+               /* not a PIII or no drivers available, use default RSA CSP */
+               if (!CryptAcquireContext (&provider, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFY_CONTEXT)) {
+                       /* exception will be thrown in managed code */
+                       provider = 0;
+               }
+       }
+
+       return provider;
+}
+
+void
+mono_rand_win_close_provider (MONO_WIN32_CRYPT_PROVIDER_HANDLE provider)
+{
+       CryptReleaseContext (provider, 0);
+}
+
+gboolean
+mono_rand_win_gen (MONO_WIN32_CRYPT_PROVIDER_HANDLE provider, guchar *buffer, size_t buffer_size)
+{
+       return CryptGenRandom (provider, (DWORD) buffer_size, buffer);
+}
+
+gboolean
+mono_rand_win_seed (MONO_WIN32_CRYPT_PROVIDER_HANDLE provider, guchar *seed, size_t seed_size)
+{
+       /* add seeding material to the RNG */
+       return CryptGenRandom (provider, (DWORD) seed_size, seed);
+}
+#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */
+
+/**
+ * mono_rand_open:
+ *
+ * Returns: True if random source is global, false if mono_rand_init can be called repeatedly to get randomness instances.
+ *
+ * Initializes entire RNG system. Must be called once per process before calling mono_rand_init.
+ */
+gboolean
+mono_rand_open (void)
+{
+       return FALSE;
+}
+
+/**
+ * mono_rand_init:
+ * @seed: A string containing seed data
+ * @seed_size: Length of seed string
+ *
+ * Returns: On success, a non-NULL handle which can be used to fetch random data from mono_rand_try_get_bytes. On failure, NULL.
+ *
+ * Initializes an RNG client.
+ */
+gpointer
+mono_rand_init (guchar *seed, gint seed_size)
+{
+       MONO_WIN32_CRYPT_PROVIDER_HANDLE provider = 0;
+
+       /* try to open crypto provider. */
+       provider = mono_rand_win_open_provider ();
+
+       /* seed the CSP with the supplied buffer (if present) */
+       if (provider != 0 && seed != NULL) {
+               /* the call we replace the seed with random - this isn't what is
+                * expected from the class library user */
+               guchar *data = g_malloc (seed_size);
+               if (data != NULL) {
+                       memcpy (data, seed, seed_size);
+                       /* add seeding material to the RNG */
+                       mono_rand_win_seed (provider, data, seed_size);
+                       /* zeroize and free */
+                       memset (data, 0, seed_size);
+                       g_free (data);
+               }
+       }
+
+       return (gpointer) provider;
+}
+
+/**
+ * mono_rand_try_get_bytes:
+ * @handle: A pointer to an RNG handle. Handle is set to NULL on failure.
+ * @buffer: A buffer into which to write random data.
+ * @buffer_size: Number of bytes to write into buffer.
+ * @error: Set on error.
+ *
+ * Returns: FALSE on failure and sets @error, TRUE on success.
+ *
+ * Extracts bytes from an RNG handle.
+ */
+gboolean
+mono_rand_try_get_bytes (gpointer *handle, guchar *buffer, gint buffer_size, MonoError *error)
+{
+       MONO_WIN32_CRYPT_PROVIDER_HANDLE provider;
+
+       mono_error_init (error);
+
+       g_assert (handle);
+       provider = (MONO_WIN32_CRYPT_PROVIDER_HANDLE) *handle;
+
+       /* generate random bytes */
+       if (!mono_rand_win_gen (provider, buffer, buffer_size)) {
+               mono_rand_win_close_provider (provider);
+               /* we may have lost our context with CryptoAPI, but all hope isn't lost yet! */
+               provider = mono_rand_win_open_provider ();
+               if (provider != 0) {
+
+                       /* retry generate of random bytes */
+                       if (!mono_rand_win_gen (provider, buffer, buffer_size)) {
+                               /* failure, close provider */
+                               mono_rand_win_close_provider (provider);
+                               provider = 0;
+                       }
+               }
+
+               /* make sure client gets new opened provider handle or NULL on failure */
+               *handle = (gpointer) provider;
+               if (*handle == 0) {
+                       /* exception will be thrown in managed code */
+                       mono_error_set_execution_engine (error, "Failed to gen random bytes (%d)", GetLastError ());
+                       return FALSE;
+               }
+       }
+       return TRUE;
+}
+
+/**
+ * mono_rand_close:
+ * @handle: An RNG handle.
+ *
+ * Releases an RNG handle.
+ */
+void
+mono_rand_close (gpointer handle)
+{
+       mono_rand_win_close_provider ((MONO_WIN32_CRYPT_PROVIDER_HANDLE) handle);
+}
+#endif /* HOST_WIN32 */
index 1e8297750bfb64858fe3f25ec5b5e30bc2b96ede..1ac91179382d2ffb4ee7f5e826bca141e7cc4bb5 100644 (file)
@@ -13,7 +13,6 @@
  * Licensed under the MIT license. See LICENSE file in the project root for full license information.
  */
 
-
 #include <glib.h>
 #include <config.h>
 
 #include "metadata/object.h"
 
 #ifdef HOST_WIN32
-
-#include <windows.h>
-#include <wincrypt.h>
-
-#ifndef PROV_INTEL_SEC
-#define PROV_INTEL_SEC         22
-#endif
-#ifndef CRYPT_VERIFY_CONTEXT
-#define CRYPT_VERIFY_CONTEXT   0xF0000000
-#endif
-
-/**
- * mono_rand_open:
- *
- * Returns: True if random source is global, false if mono_rand_init can be called repeatedly to get randomness instances.
- *
- * Initializes entire RNG system. Must be called once per process before calling mono_rand_init.
- */
-gboolean
-mono_rand_open (void)
-{
-       return FALSE;
-}
-
-/**
- * mono_rand_init:
- * @seed: A string containing seed data
- * @seed_size: Length of seed string
- *
- * Returns: On success, a non-NULL handle which can be used to fetch random data from mono_rand_try_get_bytes. On failure, NULL.
- *
- * Initializes an RNG client.
- */
-gpointer
-mono_rand_init (guchar *seed, gint seed_size)
-{
-       HCRYPTPROV provider = 0;
-
-       /* There is no need to create a container for just random data,
-        * so we can use CRYPT_VERIFY_CONTEXT (one call) see: 
-        * http://blogs.msdn.com/dangriff/archive/2003/11/19/51709.aspx */
-
-       /* We first try to use the Intel PIII RNG if drivers are present */
-       if (!CryptAcquireContext (&provider, NULL, NULL, PROV_INTEL_SEC, CRYPT_VERIFY_CONTEXT)) {
-               /* not a PIII or no drivers available, use default RSA CSP */
-               if (!CryptAcquireContext (&provider, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFY_CONTEXT)) {
-                       /* exception will be thrown in managed code */
-                       provider = 0;
-               }
-       }
-
-       /* seed the CSP with the supplied buffer (if present) */
-       if (provider != 0 && seed) {
-               /* the call we replace the seed with random - this isn't what is
-                * expected from the class library user */
-               guchar *data = g_malloc (seed_size);
-               if (data) {
-                       memcpy (data, seed, seed_size);
-                       /* add seeding material to the RNG */
-                       CryptGenRandom (provider, seed_size, data);
-                       /* zeroize and free */
-                       memset (data, 0, seed_size);
-                       g_free (data);
-               }
-       }
-
-       return (gpointer) provider;
-}
-
-/**
- * mono_rand_try_get_bytes:
- * @handle: A pointer to an RNG handle. Handle is set to NULL on failure.
- * @buffer: A buffer into which to write random data.
- * @buffer_size: Number of bytes to write into buffer.
- * @error: Set on error.
- *
- * Returns: FALSE on failure and sets @error, TRUE on success.
- *
- * Extracts bytes from an RNG handle.
- */
-gboolean
-mono_rand_try_get_bytes (gpointer *handle, guchar *buffer, gint buffer_size, MonoError *error)
-{
-       HCRYPTPROV provider;
-
-       mono_error_init (error);
-
-       g_assert (handle);
-       provider = (HCRYPTPROV) *handle;
-
-       if (!CryptGenRandom (provider, buffer_size, buffer)) {
-               CryptReleaseContext (provider, 0);
-               /* we may have lost our context with CryptoAPI, but all hope isn't lost yet! */
-               provider = (HCRYPTPROV) mono_rand_init (NULL, 0);
-               if (!CryptGenRandom (provider, buffer_size, buffer)) {
-                       /* exception will be thrown in managed code */
-                       CryptReleaseContext (provider, 0);
-                       *handle = 0;
-                       mono_error_set_execution_engine (error, "Failed to gen random bytes (%d)", GetLastError ());
-                       return FALSE;
-               }
-       }
-       return TRUE;
-}
-
-/**
- * mono_rand_close:
- * @handle: An RNG handle.
- * @buffer: A buffer into which to write random data.
- * @buffer_size: Number of bytes to write into buffer.
- *
- * Releases an RNG handle.
- */
-void
-mono_rand_close (gpointer handle)
-{
-       CryptReleaseContext ((HCRYPTPROV) handle, 0);
-}
-
+// Windows specific implementation in mono-rand-windows.c
 #elif defined (HAVE_SYS_UN_H) && !defined(__native_client__)
 
 #include <errno.h>
@@ -165,27 +46,27 @@ static void
 get_entropy_from_egd (const char *path, guchar *buffer, int buffer_size, MonoError *error)
 {
        struct sockaddr_un egd_addr;
-       gint file;
+       gint socket_fd;
        gint ret;
        guint offset = 0;
        int err = 0;
 
        mono_error_init (error);
        
-       file = socket (PF_UNIX, SOCK_STREAM, 0);
-       if (file < 0) {
+       socket_fd = socket (PF_UNIX, SOCK_STREAM, 0);
+       if (socket_fd < 0) {
                ret = -1;
                err = errno;
        } else {
                egd_addr.sun_family = AF_UNIX;
                strncpy (egd_addr.sun_path, path, sizeof (egd_addr.sun_path) - 1);
                egd_addr.sun_path [sizeof (egd_addr.sun_path) - 1] = '\0';
-               ret = connect (file, (struct sockaddr*) &egd_addr, sizeof (egd_addr));
+               ret = connect (socket_fd, (struct sockaddr*) &egd_addr, sizeof (egd_addr));
                err = errno;
        }
        if (ret == -1) {
-               if (file >= 0)
-                       close (file);
+               if (socket_fd >= 0)
+                       close (socket_fd);
                g_warning ("Entropy problem! Can't create or connect to egd socket %s", path);
                mono_error_set_execution_engine (error, "Failed to open egd socket %s: %s", path, strerror (err));
                return;
@@ -199,14 +80,14 @@ get_entropy_from_egd (const char *path, guchar *buffer, int buffer_size, MonoErr
                request [0] = 2;
                request [1] = buffer_size < 255 ? buffer_size : 255;
                while (count < 2) {
-                       int sent = write (file, request + count, 2 - count);
+                       int sent = write (socket_fd, request + count, 2 - count);
                        err = errno;
                        if (sent >= 0) {
                                count += sent;
                        } else if (err == EINTR) {
                                continue;
                        } else {
-                               close (file);
+                               close (socket_fd);
                                g_warning ("Send egd request failed %d", err);
                                mono_error_set_execution_engine (error, "Failed to send request to egd socket: %s", strerror (err));
                                return;
@@ -216,7 +97,7 @@ get_entropy_from_egd (const char *path, guchar *buffer, int buffer_size, MonoErr
                count = 0;
                while (count != request [1]) {
                        int received;
-                       received = read (file, buffer + offset, request [1] - count);
+                       received = read (socket_fd, buffer + offset, request [1] - count);
                        err = errno;
                        if (received > 0) {
                                count += received;
@@ -224,7 +105,7 @@ get_entropy_from_egd (const char *path, guchar *buffer, int buffer_size, MonoErr
                        } else if (received < 0 && err == EINTR) {
                                continue;
                        } else {
-                               close (file);
+                               close (socket_fd);
                                g_warning ("Receive egd request failed %d", err);
                                mono_error_set_execution_engine (error, "Failed to get response from egd socket: %s", strerror(err));
                                return;
@@ -234,7 +115,7 @@ get_entropy_from_egd (const char *path, guchar *buffer, int buffer_size, MonoErr
                buffer_size -= request [1];
        }
 
-       close (file);
+       close (socket_fd);
 }
 
 gboolean
index 3c2f79b58c37e99ac92e90325b6f603118182aaa..643bb4d7709a9f7299bd8b039e7665d6e058921c 100644 (file)
@@ -173,6 +173,23 @@ typedef struct ucontext {
        #define UCONTEXT_REG_R13(ctx) (((ucontext_t*)(ctx))->uc_mcontext->__ss.__r13)
        #define UCONTEXT_REG_R14(ctx) (((ucontext_t*)(ctx))->uc_mcontext->__ss.__r14)
        #define UCONTEXT_REG_R15(ctx) (((ucontext_t*)(ctx))->uc_mcontext->__ss.__r15)
+       #define UCONTEXT_REG_XMM
+       #define UCONTEXT_REG_XMM0(ctx) (((ucontext_t*)(ctx))->uc_mcontext->__fs.__fpu_xmm0)
+       #define UCONTEXT_REG_XMM1(ctx) (((ucontext_t*)(ctx))->uc_mcontext->__fs.__fpu_xmm1)
+       #define UCONTEXT_REG_XMM2(ctx) (((ucontext_t*)(ctx))->uc_mcontext->__fs.__fpu_xmm2)
+       #define UCONTEXT_REG_XMM3(ctx) (((ucontext_t*)(ctx))->uc_mcontext->__fs.__fpu_xmm3)
+       #define UCONTEXT_REG_XMM4(ctx) (((ucontext_t*)(ctx))->uc_mcontext->__fs.__fpu_xmm4)
+       #define UCONTEXT_REG_XMM5(ctx) (((ucontext_t*)(ctx))->uc_mcontext->__fs.__fpu_xmm5)
+       #define UCONTEXT_REG_XMM6(ctx) (((ucontext_t*)(ctx))->uc_mcontext->__fs.__fpu_xmm6)
+       #define UCONTEXT_REG_XMM7(ctx) (((ucontext_t*)(ctx))->uc_mcontext->__fs.__fpu_xmm7)
+       #define UCONTEXT_REG_XMM8(ctx) (((ucontext_t*)(ctx))->uc_mcontext->__fs.__fpu_xmm8)
+       #define UCONTEXT_REG_XMM9(ctx) (((ucontext_t*)(ctx))->uc_mcontext->__fs.__fpu_xmm9)
+       #define UCONTEXT_REG_XMM10(ctx) (((ucontext_t*)(ctx))->uc_mcontext->__fs.__fpu_xmm10)
+       #define UCONTEXT_REG_XMM11(ctx) (((ucontext_t*)(ctx))->uc_mcontext->__fs.__fpu_xmm11)
+       #define UCONTEXT_REG_XMM12(ctx) (((ucontext_t*)(ctx))->uc_mcontext->__fs.__fpu_xmm12)
+       #define UCONTEXT_REG_XMM13(ctx) (((ucontext_t*)(ctx))->uc_mcontext->__fs.__fpu_xmm13)
+       #define UCONTEXT_REG_XMM14(ctx) (((ucontext_t*)(ctx))->uc_mcontext->__fs.__fpu_xmm14)
+       #define UCONTEXT_REG_XMM15(ctx) (((ucontext_t*)(ctx))->uc_mcontext->__fs.__fpu_xmm15)
 #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
        #define UCONTEXT_REG_RAX(ctx) (((ucontext_t*)(ctx))->uc_mcontext.mc_rax)
        #define UCONTEXT_REG_RBX(ctx) (((ucontext_t*)(ctx))->uc_mcontext.mc_rbx)
@@ -229,7 +246,7 @@ typedef struct ucontext {
        #define UCONTEXT_REG_R14(ctx) (((ucontext_t*)(ctx))->sc_r14)
        #define UCONTEXT_REG_R15(ctx) (((ucontext_t*)(ctx))->sc_r15)
 #elif !defined(HOST_WIN32)
-#define UCONTEXT_GREGS(ctx)    ((guint64*)&(((ucontext_t*)(ctx))->uc_mcontext.gregs))
+       #define UCONTEXT_GREGS(ctx)     ((guint64*)&(((ucontext_t*)(ctx))->uc_mcontext.gregs))
 #endif
 
 #ifdef UCONTEXT_GREGS
index 9bfbdc51682b2db4fa1b2f94e30a6028ae7e2764..7f2748536830157d0179423a510f6c7e21e9b6da 100644 (file)
@@ -27,6 +27,7 @@
 #include <mono/utils/mono-threads-coop.h>
 #include <mono/utils/mono-threads-api.h>
 #include <mono/utils/checked-build.h>
+#include <mono/utils/mono-threads-debug.h>
 
 #ifdef TARGET_OSX
 #include <mono/utils/mach-support.h>
@@ -70,7 +71,7 @@ coop_tls_pop (gpointer received_cookie)
 
        stack = mono_native_tls_get_value (coop_reset_count_stack_key);
        if (!stack || 0 == stack->len)
-               mono_fatal_with_history ("Received cookie %p but found no stack at all, %x\n", received_cookie);
+               mono_fatal_with_history ("Received cookie %p but found no stack at all\n", received_cookie);
 
        expected_cookie = g_array_index (stack, gpointer, stack->len - 1);
        stack->len --;
@@ -134,7 +135,7 @@ mono_threads_state_poll_with_info (MonoThreadInfo *info)
        /* commit the saved state and notify others if needed */
        switch (mono_threads_transition_state_poll (info)) {
        case SelfSuspendResumed:
-               return;
+               break;
        case SelfSuspendWait:
                mono_thread_info_wait_for_resume (info);
                break;
@@ -143,6 +144,12 @@ mono_threads_state_poll_with_info (MonoThreadInfo *info)
                mono_thread_info_wait_for_resume (info);
                break;
        }
+
+       if (info->async_target) {
+               info->async_target (info->user_data);
+               info->async_target = NULL;
+               info->user_data = NULL;
+       }
 }
 
 static volatile gpointer* dummy_global;
diff --git a/mono/utils/mono-threads-debug.h b/mono/utils/mono-threads-debug.h
new file mode 100644 (file)
index 0000000..750d53d
--- /dev/null
@@ -0,0 +1,42 @@
+
+#ifndef __MONO_UTILS_MONO_THREADS_DEBUG_H__
+#define __MONO_UTILS_MONO_THREADS_DEBUG_H__
+
+/* Logging - enable them below if you need specific logging for the category you need */
+#define MOSTLY_ASYNC_SAFE_PRINTF(...) do { \
+       char __buff[1024];      __buff [0] = '\0'; \
+       g_snprintf (__buff, sizeof (__buff), __VA_ARGS__);      \
+       write (1, __buff, strlen (__buff));     \
+} while (0)
+
+#if 1
+#define THREADS_DEBUG(...)
+#else
+#define THREADS_DEBUG MOSTLY_ASYNC_SAFE_PRINTF
+#endif
+
+#if 1
+#define THREADS_STW_DEBUG(...)
+#else
+#define THREADS_STW_DEBUG MOSTLY_ASYNC_SAFE_PRINTF
+#endif
+
+#if 1
+#define THREADS_SUSPEND_DEBUG(...)
+#else
+#define THREADS_SUSPEND_DEBUG MOSTLY_ASYNC_SAFE_PRINTF
+#endif
+
+#if 1
+#define THREADS_STATE_MACHINE_DEBUG(...)
+#else
+#define THREADS_STATE_MACHINE_DEBUG MOSTLY_ASYNC_SAFE_PRINTF
+#endif
+
+#if 1
+#define THREADS_INTERRUPT_DEBUG(...)
+#else
+#define THREADS_INTERRUPT_DEBUG MOSTLY_ASYNC_SAFE_PRINTF
+#endif
+
+#endif /* __MONO_UTILS_MONO_THREADS_DEBUG_H__ */
diff --git a/mono/utils/mono-threads-mach-abort-syscall.c b/mono/utils/mono-threads-mach-abort-syscall.c
deleted file mode 100644 (file)
index eb43625..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * mono-threads-mach-abort-syscall.c: Low-level syscall aborting
- *
- * Author:
- *     Ludovic Henry (ludovic@xamarin.com)
- *
- * (C) 2015 Xamarin, Inc
- */
-
-#include "config.h"
-#include <glib.h>
-
-#if defined (__MACH__)
-#define _DARWIN_C_SOURCE 1
-#endif
-
-#include <mono/utils/mono-threads.h>
-
-#if defined(USE_MACH_BACKEND)
-
-#if defined(HOST_WATCHOS) || defined(HOST_TVOS)
-
-void
-mono_threads_abort_syscall_init (void)
-{
-}
-
-void
-mono_threads_suspend_abort_syscall (MonoThreadInfo *info)
-{
-
-}
-
-gboolean
-mono_threads_suspend_needs_abort_syscall (void)
-{
-       return FALSE;
-}
-
-#else
-
-void
-mono_threads_abort_syscall_init (void)
-{
-}
-
-void
-mono_threads_suspend_abort_syscall (MonoThreadInfo *info)
-{
-       kern_return_t ret;
-
-       do {
-               ret = thread_suspend (info->native_handle);
-       } while (ret == KERN_ABORTED);
-
-       if (ret != KERN_SUCCESS)
-               return;
-
-       do {
-               ret = thread_abort_safely (info->native_handle);
-       } while (ret == KERN_ABORTED);
-
-       /*
-        * We are doing thread_abort when thread_abort_safely returns KERN_SUCCESS because
-        * for some reason accept is not interrupted by thread_abort_safely.
-        * The risk of aborting non-atomic operations while calling thread_abort should not
-        * exist because by the time thread_abort_safely returns KERN_SUCCESS the target
-        * thread should have return from the kernel and should be waiting for thread_resume
-        * to resume the user code.
-        */
-       if (ret == KERN_SUCCESS)
-               ret = thread_abort (info->native_handle);
-
-       do {
-               ret = thread_resume (info->native_handle);
-       } while (ret == KERN_ABORTED);
-
-       g_assert (ret == KERN_SUCCESS);
-}
-
-gboolean
-mono_threads_suspend_needs_abort_syscall (void)
-{
-       return TRUE;
-}
-
-#endif
-
-#endif
index 948804243ccc61d2f9a43420d7c4e806e300056f..fdf18bb1891eeb47c08ec7e6176341912fe57b03 100644 (file)
@@ -23,6 +23,7 @@
 #include <mono/utils/mono-compiler.h>
 #include <mono/utils/mono-threads.h>
 #include <mono/utils/hazard-pointer.h>
+#include <mono/utils/mono-threads-debug.h>
 
 void
 mono_threads_suspend_init (void)
@@ -50,6 +51,18 @@ mono_threads_suspend_begin_async_resume (MonoThreadInfo *info)
        g_assert_not_reached ();
 }
 
+void
+mono_threads_suspend_abort_syscall (MonoThreadInfo *info)
+{
+       g_assert_not_reached ();
+}
+
+gboolean
+mono_threads_suspend_needs_abort_syscall (void)
+{
+       return FALSE;
+}
+
 #else /* defined(HOST_WATCHOS) || defined(HOST_TVOS) */
 
 gboolean
@@ -81,14 +94,14 @@ mono_threads_suspend_begin_async_suspend (MonoThreadInfo *info, gboolean interru
        }
        info->suspend_can_continue = mono_threads_get_runtime_callbacks ()->
                thread_state_init_from_handle (&info->thread_saved_state [ASYNC_SUSPEND_STATE_INDEX], info);
-       THREADS_SUSPEND_DEBUG ("thread state %p -> %d\n", (gpointer)(gsize)info->native_handle, res);
+       THREADS_SUSPEND_DEBUG ("thread state %p -> %d\n", (gpointer)(gsize)info->native_handle, ret);
        if (info->suspend_can_continue) {
                if (interrupt_kernel)
                        thread_abort (info->native_handle);
        } else {
                THREADS_SUSPEND_DEBUG ("FAILSAFE RESUME/2 %p -> %d\n", (gpointer)(gsize)info->native_handle, 0);
        }
-       return info->suspend_can_continue;
+       return TRUE;
 }
 
 gboolean
@@ -104,8 +117,8 @@ mono_threads_suspend_begin_async_resume (MonoThreadInfo *info)
 
        if (info->async_target) {
                MonoContext tmp = info->thread_saved_state [ASYNC_SUSPEND_STATE_INDEX].ctx;
-               mach_msg_type_number_t num_state;
-               thread_state_t state;
+               mach_msg_type_number_t num_state, num_fpstate;
+               thread_state_t state, fpstate;
                ucontext_t uctx;
                mcontext_t mctx;
 
@@ -114,23 +127,24 @@ mono_threads_suspend_begin_async_resume (MonoThreadInfo *info)
                info->async_target = (void (*)(void *)) info->user_data;
 
                state = (thread_state_t) alloca (mono_mach_arch_get_thread_state_size ());
+               fpstate = (thread_state_t) alloca (mono_mach_arch_get_thread_fpstate_size ());
                mctx = (mcontext_t) alloca (mono_mach_arch_get_mcontext_size ());
 
                do {
-                       ret = mono_mach_arch_get_thread_state (info->native_handle, state, &num_state);
+                       ret = mono_mach_arch_get_thread_states (info->native_handle, state, &num_state, fpstate, &num_fpstate);
                } while (ret == KERN_ABORTED);
 
                if (ret != KERN_SUCCESS)
                        return FALSE;
 
-               mono_mach_arch_thread_state_to_mcontext (state, mctx);
+               mono_mach_arch_thread_states_to_mcontext (state, fpstate, mctx);
                uctx.uc_mcontext = mctx;
                mono_monoctx_to_sigctx (&tmp, &uctx);
 
-               mono_mach_arch_mcontext_to_thread_state (mctx, state);
+               mono_mach_arch_mcontext_to_thread_states (mctx, state, fpstate);
 
                do {
-                       ret = mono_mach_arch_set_thread_state (info->native_handle, state, num_state);
+                       ret = mono_mach_arch_set_thread_states (info->native_handle, state, num_state, fpstate, num_fpstate);
                } while (ret == KERN_ABORTED);
 
                if (ret != KERN_SUCCESS)
@@ -145,6 +159,46 @@ mono_threads_suspend_begin_async_resume (MonoThreadInfo *info)
        return ret == KERN_SUCCESS;
 }
 
+void
+mono_threads_suspend_abort_syscall (MonoThreadInfo *info)
+{
+       kern_return_t ret;
+
+       do {
+               ret = thread_suspend (info->native_handle);
+       } while (ret == KERN_ABORTED);
+
+       if (ret != KERN_SUCCESS)
+               return;
+
+       do {
+               ret = thread_abort_safely (info->native_handle);
+       } while (ret == KERN_ABORTED);
+
+       /*
+        * We are doing thread_abort when thread_abort_safely returns KERN_SUCCESS because
+        * for some reason accept is not interrupted by thread_abort_safely.
+        * The risk of aborting non-atomic operations while calling thread_abort should not
+        * exist because by the time thread_abort_safely returns KERN_SUCCESS the target
+        * thread should have return from the kernel and should be waiting for thread_resume
+        * to resume the user code.
+        */
+       if (ret == KERN_SUCCESS)
+               ret = thread_abort (info->native_handle);
+
+       do {
+               ret = thread_resume (info->native_handle);
+       } while (ret == KERN_ABORTED);
+
+       g_assert (ret == KERN_SUCCESS);
+}
+
+gboolean
+mono_threads_suspend_needs_abort_syscall (void)
+{
+       return TRUE;
+}
+
 #endif /* defined(HOST_WATCHOS) || defined(HOST_TVOS) */
 
 void
@@ -166,6 +220,35 @@ mono_threads_suspend_free (MonoThreadInfo *info)
        mach_port_deallocate (current_task (), info->native_handle);
 }
 
+void
+mono_threads_suspend_init_signals (void)
+{
+}
+
+gint
+mono_threads_suspend_search_alternative_signal (void)
+{
+       g_assert_not_reached ();
+}
+
+gint
+mono_threads_suspend_get_suspend_signal (void)
+{
+       return -1;
+}
+
+gint
+mono_threads_suspend_get_restart_signal (void)
+{
+       return -1;
+}
+
+gint
+mono_threads_suspend_get_abort_signal (void)
+{
+       return -1;
+}
+
 #endif /* USE_MACH_BACKEND */
 
 #ifdef __MACH__
diff --git a/mono/utils/mono-threads-posix-abort-syscall.c b/mono/utils/mono-threads-posix-abort-syscall.c
deleted file mode 100644 (file)
index 232161c..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * mono-threads-posix-abort-syscall.c: Low-level syscall aborting
- *
- * Author:
- *     Ludovic Henry (ludovic@xamarin.com)
- *
- * (C) 2015 Xamarin, Inc
- */
-
-#include "config.h"
-#include <glib.h>
-
-#if defined (__MACH__)
-#define _DARWIN_C_SOURCE 1
-#endif
-
-#include "mono-threads.h"
-#include "mono-threads-posix-signals.h"
-
-#if defined(USE_POSIX_BACKEND)
-
-void
-mono_threads_abort_syscall_init (void)
-{
-       mono_threads_posix_init_signals (MONO_THREADS_POSIX_INIT_SIGNALS_ABORT);
-}
-
-void
-mono_threads_suspend_abort_syscall (MonoThreadInfo *info)
-{
-       /* We signal a thread to break it from the current syscall.
-        * This signal should not be interpreted as a suspend request. */
-       info->syscall_break_signal = TRUE;
-       if (!mono_threads_pthread_kill (info, mono_threads_posix_get_abort_signal ()))
-               mono_threads_add_to_pending_operation_set (info);
-}
-
-gboolean
-mono_threads_suspend_needs_abort_syscall (void)
-{
-       return TRUE;
-}
-
-#endif
index c1b67330fb566d54589fc7bf849770295007bff0..0c8e6b462b187f14f9a02dba0918722e0e2c54a5 100644 (file)
@@ -17,7 +17,7 @@
 #include <errno.h>
 #include <signal.h>
 
-#include "mono-threads-posix-signals.h"
+#include "mono-threads-debug.h"
 
 #if defined(__APPLE__) || defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
 #define DEFAULT_SUSPEND_SIGNAL SIGXFSZ
 #endif
 #define DEFAULT_RESTART_SIGNAL SIGXCPU
 
-static int suspend_signal_num;
-static int restart_signal_num;
 static int abort_signal_num;
 
 static sigset_t suspend_signal_mask;
 static sigset_t suspend_ack_signal_mask;
 
-//Can't avoid the circular dep on this. Will be gone pretty soon
-extern int mono_gc_get_suspend_signal (void);
-
-int
-mono_threads_posix_signal_search_alternative (int min_signal)
+gint
+mono_threads_suspend_search_alternative_signal (void)
 {
 #if !defined (SIGRTMIN)
        g_error ("signal search only works with RTMIN");
 #else
        int i;
        /* we try to avoid SIGRTMIN and any one that might have been set already, see bug #75387 */
-       for (i = MAX (min_signal, SIGRTMIN) + 1; i < SIGRTMAX; ++i) {
+       for (i = SIGRTMIN + 1; i < SIGRTMAX; ++i) {
                struct sigaction sinfo;
                sigaction (i, NULL, &sinfo);
                if (sinfo.sa_handler == SIG_DFL && (void*)sinfo.sa_sigaction == (void*)SIG_DFL) {
@@ -58,7 +53,9 @@ mono_threads_posix_signal_search_alternative (int min_signal)
 static void
 signal_add_handler (int signo, gpointer handler, int flags)
 {
-#if !defined(__native_client__)
+#if defined(__native_client__)
+       g_assert_not_reached ();
+#else
        /*FIXME, move the code from mini to utils and do the right thing!*/
        struct sigaction sa;
        struct sigaction previous_sa;
@@ -74,62 +71,21 @@ signal_add_handler (int signo, gpointer handler, int flags)
 #endif
 }
 
-static int
-suspend_signal_get (void)
-{
-#if defined(PLATFORM_ANDROID)
-       return SIGUNUSED;
-#elif !defined (SIGRTMIN)
-#ifdef SIGUSR1
-       return SIGUSR1;
-#else
-       return -1;
-#endif /* SIGUSR1 */
-#else
-       static int suspend_signum = -1;
-       if (suspend_signum == -1)
-               suspend_signum = mono_threads_posix_signal_search_alternative (-1);
-       return suspend_signum;
-#endif /* SIGRTMIN */
-}
-
-static int
-restart_signal_get (void)
-{
-#if defined(PLATFORM_ANDROID)
-       return SIGTTOU;
-#elif !defined (SIGRTMIN)
-#ifdef SIGUSR2
-       return SIGUSR2;
-#else
-       return -1;
-#endif /* SIGUSR1 */
-#else
-       static int resume_signum = -1;
-       if (resume_signum == -1)
-               resume_signum = mono_threads_posix_signal_search_alternative (suspend_signal_get () + 1);
-       return resume_signum;
-#endif /* SIGRTMIN */
-}
-
-
 static int
 abort_signal_get (void)
 {
 #if defined(PLATFORM_ANDROID)
        return SIGTTIN;
-#elif !defined (SIGRTMIN)
-#ifdef SIGTTIN
-       return SIGTTIN;
-#else
-       return -1;
-#endif /* SIGRTMIN */
-#else
+#elif defined (SIGRTMIN)
        static int abort_signum = -1;
        if (abort_signum == -1)
-               abort_signum = mono_threads_posix_signal_search_alternative (restart_signal_get () + 1);
+               abort_signum = mono_threads_suspend_search_alternative_signal ();
        return abort_signum;
-#endif /* SIGRTMIN */
+#elif defined (SIGTTIN)
+       return SIGTTIN;
+#else
+       return -1;
+#endif
 }
 
 static void
@@ -142,7 +98,7 @@ restart_signal_handler (int _dummy, siginfo_t *_info, void *context)
        int old_errno = errno;
 
        info = mono_thread_info_current ();
-       info->signal = restart_signal_num;
+       info->signal = DEFAULT_RESTART_SIGNAL;
        errno = old_errno;
 #endif
 }
@@ -206,7 +162,7 @@ suspend_signal_handler (int _dummy, siginfo_t *info, void *context)
        do {
                current->signal = 0;
                sigsuspend (&suspend_signal_mask);
-       } while (current->signal != restart_signal_num);
+       } while (current->signal != DEFAULT_RESTART_SIGNAL);
 
        /* Unblock the restart signal. */
        pthread_sigmask (SIG_UNBLOCK, &suspend_ack_signal_mask, NULL);
@@ -232,81 +188,52 @@ done:
 #endif
 }
 
-static void
-abort_signal_handler (int _dummy, siginfo_t *info, void *context)
-{
-#if defined(__native_client__)
-       g_assert_not_reached ();
-#else
-       suspend_signal_handler (_dummy, info, context);
-#endif
-}
-
 void
-mono_threads_posix_init_signals (MonoThreadPosixInitSignals signals)
+mono_threads_suspend_init_signals (void)
 {
        sigset_t signal_set;
 
-       g_assert ((signals == MONO_THREADS_POSIX_INIT_SIGNALS_SUSPEND_RESTART) ^ (signals == MONO_THREADS_POSIX_INIT_SIGNALS_ABORT));
-
        sigemptyset (&signal_set);
 
-       switch (signals) {
-       case MONO_THREADS_POSIX_INIT_SIGNALS_SUSPEND_RESTART: {
-               if (mono_thread_info_unified_management_enabled ()) {
-                       suspend_signal_num = DEFAULT_SUSPEND_SIGNAL;
-                       restart_signal_num = DEFAULT_RESTART_SIGNAL;
-               } else {
-                       suspend_signal_num = suspend_signal_get ();
-                       restart_signal_num = restart_signal_get ();
-               }
+       sigfillset (&suspend_signal_mask);
+       sigdelset (&suspend_signal_mask, DEFAULT_RESTART_SIGNAL);
 
-               sigfillset (&suspend_signal_mask);
-               sigdelset (&suspend_signal_mask, restart_signal_num);
-               if (!mono_thread_info_unified_management_enabled ())
-                       sigdelset (&suspend_signal_mask, mono_gc_get_suspend_signal ());
+       sigemptyset (&suspend_ack_signal_mask);
+       sigaddset (&suspend_ack_signal_mask, DEFAULT_RESTART_SIGNAL);
 
-               sigemptyset (&suspend_ack_signal_mask);
-               sigaddset (&suspend_ack_signal_mask, restart_signal_num);
+       signal_add_handler (DEFAULT_SUSPEND_SIGNAL, suspend_signal_handler, SA_RESTART);
+       signal_add_handler (DEFAULT_RESTART_SIGNAL, restart_signal_handler, SA_RESTART);
 
-               signal_add_handler (suspend_signal_num, suspend_signal_handler, SA_RESTART);
-               signal_add_handler (restart_signal_num, restart_signal_handler, SA_RESTART);
+       sigaddset (&signal_set, DEFAULT_SUSPEND_SIGNAL);
+       sigaddset (&signal_set, DEFAULT_RESTART_SIGNAL);
 
-               sigaddset (&signal_set, suspend_signal_num);
-               sigaddset (&signal_set, restart_signal_num);
+       abort_signal_num = abort_signal_get ();
 
-               break;
-       }
-       case MONO_THREADS_POSIX_INIT_SIGNALS_ABORT: {
-               abort_signal_num = abort_signal_get ();
-
-               signal_add_handler (abort_signal_num, abort_signal_handler, 0);
-
-               sigaddset (&signal_set, abort_signal_num);
+       /* the difference between abort and suspend here is made by not
+        * passing SA_RESTART, meaning we won't restart the syscall when
+        * receiving a signal */
+       signal_add_handler (abort_signal_num, suspend_signal_handler, 0);
 
-               break;
-       }
-       default: g_assert_not_reached ();
-       }
+       sigaddset (&signal_set, abort_signal_num);
 
        /* ensure all the new signals are unblocked */
        sigprocmask (SIG_UNBLOCK, &signal_set, NULL);
 }
 
 gint
-mono_threads_posix_get_suspend_signal (void)
+mono_threads_suspend_get_suspend_signal (void)
 {
-       return suspend_signal_num;
+       return DEFAULT_SUSPEND_SIGNAL;
 }
 
 gint
-mono_threads_posix_get_restart_signal (void)
+mono_threads_suspend_get_restart_signal (void)
 {
-       return restart_signal_num;
+       return DEFAULT_RESTART_SIGNAL;
 }
 
 gint
-mono_threads_posix_get_abort_signal (void)
+mono_threads_suspend_get_abort_signal (void)
 {
        return abort_signal_num;
 }
diff --git a/mono/utils/mono-threads-posix-signals.h b/mono/utils/mono-threads-posix-signals.h
deleted file mode 100644 (file)
index 59a38c1..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-
-#ifndef __MONO_THREADS_POSIX_SIGNALS_H__
-#define __MONO_THREADS_POSIX_SIGNALS_H__
-
-#include <config.h>
-#include <glib.h>
-
-#include "mono-threads.h"
-
-#if defined(USE_POSIX_BACKEND) || defined(USE_POSIX_SYSCALL_ABORT)
-
-typedef enum {
-       MONO_THREADS_POSIX_INIT_SIGNALS_SUSPEND_RESTART,
-       MONO_THREADS_POSIX_INIT_SIGNALS_ABORT,
-} MonoThreadPosixInitSignals;
-
-int
-mono_threads_posix_signal_search_alternative (int min_signal);
-
-void
-mono_threads_posix_init_signals (MonoThreadPosixInitSignals signals);
-
-gint
-mono_threads_posix_get_suspend_signal (void);
-
-gint
-mono_threads_posix_get_restart_signal (void);
-
-gint
-mono_threads_posix_get_abort_signal (void);
-
-#endif /* defined(USE_POSIX_BACKEND) || defined(USE_POSIX_SYSCALL_ABORT) */
-
-#endif /* __MONO_THREADS_POSIX_SIGNALS_H__ */
index cbf92bb1ce763ee726ca92b17688d746d38089d2..5447a8fe93f412b9eef902ff644c9246197a7830 100644 (file)
 #endif
 
 #include <mono/utils/mono-threads.h>
-#include <mono/utils/mono-threads-posix-signals.h>
 #include <mono/utils/mono-coop-semaphore.h>
 #include <mono/metadata/gc-internals.h>
-#include <mono/utils/w32handle.h>
+#include <mono/utils/mono-threads-debug.h>
 
 #include <errno.h>
 
@@ -36,209 +35,102 @@ extern int tkill (pid_t tid, int signal);
 
 #include <sys/resource.h>
 
-#if defined(__native_client__)
-void nacl_shutdown_gc_thread(void);
-#endif
+int
+mono_threads_platform_create_thread (MonoThreadStart thread_fn, gpointer thread_data, gsize* const stack_size, MonoNativeThreadId *out_tid)
+{
+       pthread_attr_t attr;
+       pthread_t thread;
+       int policy;
+       struct sched_param param;
+       gint res;
+       gsize set_stack_size;
+       size_t min_size;
 
-typedef struct {
-       pthread_t id;
-       GPtrArray *owned_mutexes;
-       gint32 priority;
-} MonoW32HandleThread;
+       res = pthread_attr_init (&attr);
+       g_assert (!res);
 
-static gpointer
-thread_handle_create (void)
-{
-       MonoW32HandleThread thread_data;
-       gpointer thread_handle;
+       if (stack_size)
+               set_stack_size = *stack_size;
+       else
+               set_stack_size = 0;
 
-       thread_data.id = pthread_self ();
-       thread_data.owned_mutexes = g_ptr_array_new ();
-       thread_data.priority = MONO_THREAD_PRIORITY_NORMAL;
+#ifdef HAVE_PTHREAD_ATTR_SETSTACKSIZE
+       if (set_stack_size == 0) {
+#if HAVE_VALGRIND_MEMCHECK_H
+               if (RUNNING_ON_VALGRIND)
+                       set_stack_size = 1 << 20;
+               else
+                       set_stack_size = (SIZEOF_VOID_P / 4) * 1024 * 1024;
+#else
+               set_stack_size = (SIZEOF_VOID_P / 4) * 1024 * 1024;
+#endif
+       }
 
-       thread_handle = mono_w32handle_new (MONO_W32HANDLE_THREAD, (gpointer) &thread_data);
-       if (thread_handle == INVALID_HANDLE_VALUE)
-               return NULL;
+#ifdef PTHREAD_STACK_MIN
+       if (set_stack_size < PTHREAD_STACK_MIN)
+               set_stack_size = PTHREAD_STACK_MIN;
+#endif
 
-       /* We need to keep the handle alive, as long as the corresponding managed
-        * thread object is alive. The handle is going to be unref when calling
-        * the finalizer on the MonoThreadInternal object */
-       mono_w32handle_ref (thread_handle);
+       res = pthread_attr_setstacksize (&attr, set_stack_size);
+       g_assert (!res);
+#endif /* HAVE_PTHREAD_ATTR_SETSTACKSIZE */
 
-       return thread_handle;
-}
+       memset (&param, 0, sizeof (param));
 
-static int
-win32_priority_to_posix_priority (MonoThreadPriority priority, int policy)
-{
-       g_assert (priority >= MONO_THREAD_PRIORITY_LOWEST);
-       g_assert (priority <= MONO_THREAD_PRIORITY_HIGHEST);
+       res = pthread_attr_getschedpolicy (&attr, &policy);
+       if (res != 0)
+               g_error ("%s: pthread_attr_getschedpolicy failed, error: \"%s\" (%d)", g_strerror (res), res);
 
-/* Necessary to get valid priority range */
 #ifdef _POSIX_PRIORITY_SCHEDULING
        int max, min;
 
+       /* Necessary to get valid priority range */
+
        min = sched_get_priority_min (policy);
        max = sched_get_priority_max (policy);
 
-       /* Partition priority range linearly (cross-multiply) */
        if (max > 0 && min >= 0 && max > min)
-               return (int)((double) priority * (max - min) / (MONO_THREAD_PRIORITY_HIGHEST - MONO_THREAD_PRIORITY_LOWEST));
+               param.sched_priority = (max - min) / 2 + min;
+       else
 #endif
-
-       switch (policy) {
-       case SCHED_FIFO:
-       case SCHED_RR:
-               return 50;
+       {
+               switch (policy) {
+               case SCHED_FIFO:
+               case SCHED_RR:
+                       param.sched_priority = 50;
+                       break;
 #ifdef SCHED_BATCH
-       case SCHED_BATCH:
+               case SCHED_BATCH:
 #endif
-       case SCHED_OTHER:
-               return 0;
-       default:
-               return -1;
-       }
-}
-
-typedef struct {
-       void *(*start_routine)(void*);
-       void *arg;
-       int flags;
-       gint32 priority;
-       MonoCoopSem registered;
-       HANDLE handle;
-} StartInfo;
-
-static void*
-inner_start_thread (void *arg)
-{
-       StartInfo *start_info = (StartInfo *) arg;
-       void *t_arg = start_info->arg;
-       int res;
-       void *(*start_func)(void*) = start_info->start_routine;
-       guint32 flags = start_info->flags;
-       void *result;
-       HANDLE handle;
-       MonoThreadInfo *info;
-
-       /* Register the thread with the io-layer */
-       handle = thread_handle_create ();
-       if (!handle) {
-               mono_coop_sem_post (&(start_info->registered));
-               return NULL;
-       }
-       start_info->handle = handle;
-
-       info = mono_thread_info_attach (&result);
-
-       info->runtime_thread = TRUE;
-       info->handle = handle;
-
-       mono_threads_platform_set_priority (info, start_info->priority);
-
-       if (flags & CREATE_SUSPENDED) {
-               info->create_suspended = TRUE;
-               mono_coop_sem_init (&info->create_suspended_sem, 0);
+               case SCHED_OTHER:
+                       param.sched_priority = 0;
+                       break;
+               default:
+                       g_error ("%s: unknown policy %d", __func__, policy);
+               }
        }
 
-       /* start_info is not valid after this */
-       mono_coop_sem_post (&(start_info->registered));
-       start_info = NULL;
-
-       if (flags & CREATE_SUSPENDED) {
-               res = mono_coop_sem_wait (&info->create_suspended_sem, MONO_SEM_FLAGS_NONE);
-               g_assert (res != -1);
-
-               mono_coop_sem_destroy (&info->create_suspended_sem);
-       }
-
-       /* Run the actual main function of the thread */
-       result = start_func (t_arg);
-
-       mono_threads_platform_exit (GPOINTER_TO_UINT (result));
-       g_assert_not_reached ();
-}
-
-HANDLE
-mono_threads_platform_create_thread (MonoThreadStart start_routine, gpointer arg, MonoThreadParm *tp, MonoNativeThreadId *out_tid)
-{
-       pthread_attr_t attr;
-       int res;
-       pthread_t thread;
-       StartInfo start_info;
-       guint32 stack_size;
-       int policy;
-       struct sched_param sp;
+       res = pthread_attr_setschedparam (&attr, &param);
+       if (res != 0)
+               g_error ("%s: pthread_attr_setschedparam failed, error: \"%s\" (%d)", g_strerror (res), res);
 
-       res = pthread_attr_init (&attr);
-       g_assert (!res);
-
-       if (tp->stack_size == 0) {
-#if HAVE_VALGRIND_MEMCHECK_H
-               if (RUNNING_ON_VALGRIND)
-                       stack_size = 1 << 20;
+       if (stack_size) {
+               res = pthread_attr_getstacksize (&attr, &min_size);
+               if (res != 0)
+                       g_error ("%s: pthread_attr_getstacksize failed, error: \"%s\" (%d)", g_strerror (res), res);
                else
-                       stack_size = (SIZEOF_VOID_P / 4) * 1024 * 1024;
-#else
-               stack_size = (SIZEOF_VOID_P / 4) * 1024 * 1024;
-#endif
-       } else
-               stack_size = tp->stack_size;
-
-#ifdef PTHREAD_STACK_MIN
-       if (stack_size < PTHREAD_STACK_MIN)
-               stack_size = PTHREAD_STACK_MIN;
-#endif
-
-#ifdef HAVE_PTHREAD_ATTR_SETSTACKSIZE
-       res = pthread_attr_setstacksize (&attr, stack_size);
-       g_assert (!res);
-#endif
-
-       /*
-        * For policies that respect priorities set the prirority for the new thread
-        */ 
-       pthread_getschedparam(pthread_self(), &policy, &sp);
-       if ((policy == SCHED_FIFO) || (policy == SCHED_RR)) {
-               sp.sched_priority = win32_priority_to_posix_priority (tp->priority, policy);
-               res = pthread_attr_setschedparam (&attr, &sp);
+                       *stack_size = min_size;
        }
 
-       memset (&start_info, 0, sizeof (StartInfo));
-       start_info.start_routine = (void *(*)(void *)) start_routine;
-       start_info.arg = arg;
-       start_info.flags = tp->creation_flags;
-       start_info.priority = tp->priority;
-       mono_coop_sem_init (&(start_info.registered), 0);
-
        /* Actually start the thread */
-       res = mono_gc_pthread_create (&thread, &attr, inner_start_thread, &start_info);
-       if (res) {
-               mono_coop_sem_destroy (&(start_info.registered));
-               return NULL;
-       }
-
-       /* Wait until the thread register itself in various places */
-       res = mono_coop_sem_wait (&start_info.registered, MONO_SEM_FLAGS_NONE);
-       g_assert (res != -1);
-
-       mono_coop_sem_destroy (&(start_info.registered));
+       res = mono_gc_pthread_create (&thread, &attr, (gpointer (*)(gpointer)) thread_fn, thread_data);
+       if (res)
+               return -1;
 
        if (out_tid)
                *out_tid = thread;
 
-       return start_info.handle;
-}
-
-/*
- * mono_threads_platform_resume_created:
- *
- *   Resume a newly created thread created using CREATE_SUSPENDED.
- */
-void
-mono_threads_platform_resume_created (MonoThreadInfo *info, MonoNativeThreadId tid)
-{
-       mono_coop_sem_post (&info->create_suspended_sem);
+       return 0;
 }
 
 gboolean
@@ -248,43 +140,9 @@ mono_threads_platform_yield (void)
 }
 
 void
-mono_threads_platform_exit (int exit_code)
+mono_threads_platform_exit (gsize exit_code)
 {
-       MonoThreadInfo *current = mono_thread_info_current ();
-
-#if defined(__native_client__)
-       nacl_shutdown_gc_thread();
-#endif
-
-       mono_threads_platform_set_exited (current);
-
-       mono_thread_info_detach ();
-
-       pthread_exit (NULL);
-}
-
-void
-mono_threads_platform_unregister (MonoThreadInfo *info)
-{
-       if (info->handle) {
-               mono_threads_platform_set_exited (info);
-               info->handle = NULL;
-       }
-}
-
-HANDLE
-mono_threads_platform_open_handle (void)
-{
-       MonoThreadInfo *info;
-
-       info = mono_thread_info_current ();
-       g_assert (info);
-
-       if (!info->handle)
-               info->handle = thread_handle_create ();
-       else
-               mono_w32handle_ref (info->handle);
-       return info->handle;
+       pthread_exit ((gpointer) exit_code);
 }
 
 int
@@ -301,14 +159,6 @@ mono_threads_get_max_stack_size (void)
        return (int)lim.rlim_max;
 }
 
-HANDLE
-mono_threads_platform_open_thread_handle (HANDLE handle, MonoNativeThreadId tid)
-{
-       mono_w32handle_ref (handle);
-
-       return handle;
-}
-
 int
 mono_threads_pthread_kill (MonoThreadInfo *info, int signum)
 {
@@ -397,196 +247,12 @@ mono_native_thread_set_name (MonoNativeThreadId tid, const char *name)
 #endif
 }
 
-void
-mono_threads_platform_set_exited (MonoThreadInfo *info)
-{
-       MonoW32HandleThread *thread_data;
-       gpointer mutex_handle;
-       int i, thr_ret;
-       pid_t pid;
-       pthread_t tid;
-
-       if (!info->handle || mono_w32handle_issignalled (info->handle) || mono_w32handle_get_type (info->handle) == MONO_W32HANDLE_UNUSED) {
-               /* We must have already deliberately finished
-                * with this thread, so don't do any more now */
-               return;
-       }
-
-       if (!mono_w32handle_lookup (info->handle, MONO_W32HANDLE_THREAD, (gpointer*) &thread_data))
-               g_error ("unknown thread handle %p", info->handle);
-
-       pid = wapi_getpid ();
-       tid = pthread_self ();
-
-       for (i = 0; i < thread_data->owned_mutexes->len; i++) {
-               mutex_handle = g_ptr_array_index (thread_data->owned_mutexes, i);
-               wapi_mutex_abandon (mutex_handle, pid, tid);
-               mono_thread_info_disown_mutex (info, mutex_handle);
-       }
-
-       g_ptr_array_free (thread_data->owned_mutexes, TRUE);
-
-       thr_ret = mono_w32handle_lock_handle (info->handle);
-       g_assert (thr_ret == 0);
-
-       mono_w32handle_set_signal_state (info->handle, TRUE, TRUE);
-
-       thr_ret = mono_w32handle_unlock_handle (info->handle);
-       g_assert (thr_ret == 0);
-
-       /* The thread is no longer active, so unref it */
-       mono_w32handle_unref (info->handle);
-
-       info->handle = NULL;
-}
-
-void
-mono_threads_platform_describe (MonoThreadInfo *info, GString *text)
-{
-       MonoW32HandleThread *thread_data;
-       int i;
-
-       g_assert (info->handle);
-
-       if (!mono_w32handle_lookup (info->handle, MONO_W32HANDLE_THREAD, (gpointer*) &thread_data))
-               g_error ("unknown thread handle %p", info->handle);
-
-       g_string_append_printf (text, "thread handle %p state : ", info->handle);
-
-       mono_thread_info_describe_interrupt_token (info, text);
-
-       g_string_append_printf (text, ", owns (");
-       for (i = 0; i < thread_data->owned_mutexes->len; i++)
-               g_string_append_printf (text, i > 0 ? ", %p" : "%p", g_ptr_array_index (thread_data->owned_mutexes, i));
-       g_string_append_printf (text, ")");
-}
-
-void
-mono_threads_platform_own_mutex (MonoThreadInfo *info, gpointer mutex_handle)
-{
-       MonoW32HandleThread *thread_data;
-
-       g_assert (info->handle);
-
-       if (!mono_w32handle_lookup (info->handle, MONO_W32HANDLE_THREAD, (gpointer*) &thread_data))
-               g_error ("unknown thread handle %p", info->handle);
-
-       mono_w32handle_ref (mutex_handle);
-
-       g_ptr_array_add (thread_data->owned_mutexes, mutex_handle);
-}
-
-void
-mono_threads_platform_disown_mutex (MonoThreadInfo *info, gpointer mutex_handle)
-{
-       MonoW32HandleThread *thread_data;
-
-       g_assert (info->handle);
-
-       if (!mono_w32handle_lookup (info->handle, MONO_W32HANDLE_THREAD, (gpointer*) &thread_data))
-               g_error ("unknown thread handle %p", info->handle);
-
-       mono_w32handle_unref (mutex_handle);
-
-       g_ptr_array_remove (thread_data->owned_mutexes, mutex_handle);
-}
-
-MonoThreadPriority
-mono_threads_platform_get_priority (MonoThreadInfo *info)
-{
-       MonoW32HandleThread *thread_data;
-
-       g_assert (info->handle);
-
-       if (!mono_w32handle_lookup (info->handle, MONO_W32HANDLE_THREAD, (gpointer *)&thread_data))
-               return MONO_THREAD_PRIORITY_NORMAL;
-
-       return thread_data->priority;
-}
-
 gboolean
-mono_threads_platform_set_priority (MonoThreadInfo *info, MonoThreadPriority priority)
-{
-       MonoW32HandleThread *thread_data;
-       int policy, posix_priority;
-       struct sched_param param;
-
-       g_assert (info->handle);
-
-       if (!mono_w32handle_lookup (info->handle, MONO_W32HANDLE_THREAD, (gpointer*) &thread_data))
-               return FALSE;
-
-       switch (pthread_getschedparam (thread_data->id, &policy, &param)) {
-       case 0:
-               break;
-       case ESRCH:
-               g_warning ("pthread_getschedparam: error looking up thread id %x", (gsize)thread_data->id);
-               return FALSE;
-       default:
-               return FALSE;
-       }
-
-       posix_priority =  win32_priority_to_posix_priority (priority, policy);
-       if (posix_priority < 0)
-               return FALSE;
-
-       param.sched_priority = posix_priority;
-       switch (pthread_setschedparam (thread_data->id, policy, &param)) {
-       case 0:
-               break;
-       case ESRCH:
-               g_warning ("%s: pthread_setschedprio: error looking up thread id %x", __func__, (gsize)thread_data->id);
-               return FALSE;
-       case ENOTSUP:
-               g_warning ("%s: priority %d not supported", __func__, priority);
-               return FALSE;
-       case EPERM:
-               g_warning ("%s: permission denied", __func__);
-               return FALSE;
-       default:
-               return FALSE;
-       }
-
-       thread_data->priority = priority;
-       return TRUE;
-
-}
-
-static void thread_details (gpointer data)
-{
-       MonoW32HandleThread *thread = (MonoW32HandleThread*) data;
-       g_print ("id: %p, owned_mutexes: %d, priority: %d",
-               thread->id, thread->owned_mutexes->len, thread->priority);
-}
-
-static const gchar* thread_typename (void)
-{
-       return "Thread";
-}
-
-static gsize thread_typesize (void)
+mono_native_thread_join (MonoNativeThreadId tid)
 {
-       return sizeof (MonoW32HandleThread);
-}
-
-static MonoW32HandleOps thread_ops = {
-       NULL,                           /* close */
-       NULL,                           /* signal */
-       NULL,                           /* own */
-       NULL,                           /* is_owned */
-       NULL,                           /* special_wait */
-       NULL,                           /* prewait */
-       thread_details,         /* details */
-       thread_typename,        /* typename */
-       thread_typesize,        /* typesize */
-};
-
-void
-mono_threads_platform_init (void)
-{
-       mono_w32handle_register_ops (MONO_W32HANDLE_THREAD, &thread_ops);
+       void *res;
 
-       mono_w32handle_register_capabilities (MONO_W32HANDLE_THREAD, MONO_W32HANDLE_CAP_WAIT);
+       return !pthread_join (tid, &res);
 }
 
 #endif /* defined(_POSIX_VERSION) || defined(__native_client__) */
@@ -596,7 +262,7 @@ mono_threads_platform_init (void)
 gboolean
 mono_threads_suspend_begin_async_suspend (MonoThreadInfo *info, gboolean interrupt_kernel)
 {
-       int sig = interrupt_kernel ? mono_threads_posix_get_abort_signal () :  mono_threads_posix_get_suspend_signal ();
+       int sig = interrupt_kernel ? mono_threads_suspend_get_abort_signal () :  mono_threads_suspend_get_suspend_signal ();
 
        if (!mono_threads_pthread_kill (info, sig)) {
                mono_threads_add_to_pending_operation_set (info);
@@ -620,8 +286,30 @@ This begins async resume. This function must do the following:
 gboolean
 mono_threads_suspend_begin_async_resume (MonoThreadInfo *info)
 {
-       mono_threads_add_to_pending_operation_set (info);
-       return mono_threads_pthread_kill (info, mono_threads_posix_get_restart_signal ()) == 0;
+       int sig = mono_threads_suspend_get_restart_signal ();
+
+       if (!mono_threads_pthread_kill (info, sig)) {
+               mono_threads_add_to_pending_operation_set (info);
+               return TRUE;
+       }
+       return FALSE;
+}
+
+void
+mono_threads_suspend_abort_syscall (MonoThreadInfo *info)
+{
+       /* We signal a thread to break it from the current syscall.
+        * This signal should not be interpreted as a suspend request. */
+       info->syscall_break_signal = TRUE;
+       if (mono_threads_pthread_kill (info, mono_threads_suspend_get_abort_signal ()) == 0) {
+               mono_threads_add_to_pending_operation_set (info);
+       }
+}
+
+gboolean
+mono_threads_suspend_needs_abort_syscall (void)
+{
+       return TRUE;
 }
 
 void
@@ -630,9 +318,6 @@ mono_threads_suspend_register (MonoThreadInfo *info)
 #if defined (PLATFORM_ANDROID)
        info->native_handle = gettid ();
 #endif
-
-       g_assert (!info->handle);
-       info->handle = thread_handle_create ();
 }
 
 void
@@ -643,7 +328,6 @@ mono_threads_suspend_free (MonoThreadInfo *info)
 void
 mono_threads_suspend_init (void)
 {
-       mono_threads_posix_init_signals (MONO_THREADS_POSIX_INIT_SIGNALS_SUSPEND_RESTART);
 }
 
 #endif /* defined(USE_POSIX_BACKEND) */
index 9792d5dbe217f09528628012ed96ed83b8e6ee7b..27acdda1f7117680e9c6bb27467e8f8b7b4d3c59 100644 (file)
@@ -6,6 +6,7 @@
 #include <mono/utils/mono-memory-model.h>
 #include <mono/utils/atomic.h>
 #include <mono/utils/checked-build.h>
+#include <mono/utils/mono-threads-debug.h>
 
 #include <errno.h>
 
@@ -155,50 +156,6 @@ STATE_BLOCKING_AND_SUSPENDED: This is a bug in coop x suspend that resulted the
        }
 }
 
-/*
-This transition initiates the suspension of the current thread.
-*/
-void
-mono_threads_transition_request_self_suspension (MonoThreadInfo *info)
-{
-       int raw_state, cur_state, suspend_count;
-       g_assert (info ==  mono_thread_info_current ());
-
-retry_state_change:
-       UNWRAP_THREAD_STATE (raw_state, cur_state, suspend_count, info);
-
-       switch (cur_state) {
-       case STATE_RUNNING: //Post a self suspend request
-               if (!(suspend_count == 0))
-                       mono_fatal_with_history ("suspend_count = %d, but should be == 0", suspend_count);
-               if (InterlockedCompareExchange (&info->thread_state, build_thread_state (STATE_SELF_SUSPEND_REQUESTED, 1), raw_state) != raw_state)
-                       goto retry_state_change;
-               trace_state_change ("SELF_SUSPEND_REQUEST", info, raw_state, STATE_SELF_SUSPEND_REQUESTED, 1);
-               break;
-
-       case STATE_ASYNC_SUSPEND_REQUESTED: //Bump the suspend count but don't change the request type as async takes preference
-               if (!(suspend_count > 0 && suspend_count < THREAD_SUSPEND_COUNT_MAX))
-                       mono_fatal_with_history ("suspend_count = %d, but should be > 0 and < THREAD_SUSPEND_COUNT_MAX", suspend_count);
-               if (InterlockedCompareExchange (&info->thread_state, build_thread_state (cur_state, suspend_count + 1), raw_state) != raw_state)
-                       goto retry_state_change;
-               trace_state_change ("SUSPEND_REQUEST", info, raw_state, cur_state, 1);
-               break;
-/*
-Other states:
-STATE_ASYNC_SUSPENDED: Code should not be running while suspended.
-STATE_SELF_SUSPENDED: Code should not be running while suspended.
-STATE_SELF_SUSPEND_REQUESTED: Self suspends should not nest as begin/end should be paired. [1]
-STATE_BLOCKING:
-STATE_BLOCKING_AND_SUSPENDED: Self suspension cannot be started when the thread is in blocking state as it must finish first
-
-[1] This won't trap this sequence of requests: self suspend, async suspend and self suspend. 
-If this turns to be an issue we can introduce a new suspend request state for when both have been requested.
-*/
-       default:
-               mono_fatal_with_history ("Cannot transition thread %p from %s with SUSPEND_REQUEST", mono_thread_info_get_tid (info), state_name (cur_state));
-       }
-}
-
 /*
 This transition initiates the suspension of another thread.
 
diff --git a/mono/utils/mono-threads-windows-abort-syscall.c b/mono/utils/mono-threads-windows-abort-syscall.c
deleted file mode 100644 (file)
index 19afe3e..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * mono-threads-windows-abort-syscall.c: Low-level syscall aborting
- *
- * Author:
- *     Ludovic Henry (ludovic@xamarin.com)
- *
- * (C) 2015 Xamarin, Inc
- */
-
-#include "config.h"
-#include <glib.h>
-
-#include <mono/utils/mono-threads.h>
-
-#if defined(USE_WINDOWS_BACKEND)
-
-#include <limits.h>
-
-void
-mono_threads_abort_syscall_init (void)
-{
-}
-
-static void CALLBACK
-abort_apc (ULONG_PTR param)
-{
-}
-
-void
-mono_threads_suspend_abort_syscall (MonoThreadInfo *info)
-{
-       DWORD id = mono_thread_info_get_tid (info);
-       HANDLE handle;
-
-       handle = OpenThread (THREAD_ALL_ACCESS, FALSE, id);
-       g_assert (handle);
-
-       QueueUserAPC ((PAPCFUNC)abort_apc, handle, (ULONG_PTR)NULL);
-
-       CloseHandle (handle);
-}
-
-gboolean
-mono_threads_suspend_needs_abort_syscall (void)
-{
-       return TRUE;
-}
-
-#endif
index b926791f0621f7dd5e0a57dba29569ae6b10815a..f3f160b30c93e2a0146638caff40639a338b45f7 100644 (file)
@@ -12,6 +12,7 @@
 #if defined(USE_WINDOWS_BACKEND)
 
 #include <mono/utils/mono-compiler.h>
+#include <mono/utils/mono-threads-debug.h>
 #include <limits.h>
 
 
@@ -63,7 +64,7 @@ mono_threads_suspend_begin_async_suspend (MonoThreadInfo *info, gboolean interru
        }
 
        CloseHandle (handle);
-       return info->suspend_can_continue;
+       return TRUE;
 }
 
 gboolean
@@ -72,6 +73,33 @@ mono_threads_suspend_check_suspend_result (MonoThreadInfo *info)
        return info->suspend_can_continue;
 }
 
+static void CALLBACK
+abort_apc (ULONG_PTR param)
+{
+       THREADS_INTERRUPT_DEBUG ("%06d - abort_apc () called", GetCurrentThreadId ());
+}
+
+void
+mono_threads_suspend_abort_syscall (MonoThreadInfo *info)
+{
+       DWORD id = mono_thread_info_get_tid (info);
+       HANDLE handle;
+
+       handle = OpenThread (THREAD_ALL_ACCESS, FALSE, id);
+       g_assert (handle);
+
+       THREADS_INTERRUPT_DEBUG ("%06d - Aborting syscall in thread %06d", GetCurrentThreadId (), id);
+       QueueUserAPC ((PAPCFUNC)abort_apc, handle, (ULONG_PTR)NULL);
+
+       CloseHandle (handle);
+}
+
+gboolean
+mono_threads_suspend_needs_abort_syscall (void)
+{
+       return TRUE;
+}
+
 gboolean
 mono_threads_suspend_begin_async_resume (MonoThreadInfo *info)
 {
@@ -121,8 +149,6 @@ mono_threads_suspend_begin_async_resume (MonoThreadInfo *info)
 void
 mono_threads_suspend_register (MonoThreadInfo *info)
 {
-       g_assert (!info->handle);
-       info->handle = mono_threads_platform_open_handle();
 }
 
 void
@@ -130,92 +156,63 @@ mono_threads_suspend_free (MonoThreadInfo *info)
 {
 }
 
-#endif
-
-#if defined (HOST_WIN32)
-
-typedef struct {
-       LPTHREAD_START_ROUTINE start_routine;
-       void *arg;
-       gint32 priority;
-       MonoCoopSem registered;
-       gboolean suspend;
-       HANDLE suspend_event;
-} ThreadStartInfo;
-
-static DWORD WINAPI
-inner_start_thread (LPVOID arg)
+void
+mono_threads_suspend_init_signals (void)
 {
-       ThreadStartInfo *start_info = arg;
-       void *t_arg = start_info->arg;
-       int post_result;
-       LPTHREAD_START_ROUTINE start_func = start_info->start_routine;
-       DWORD result;
-       gboolean suspend = start_info->suspend;
-       HANDLE suspend_event = start_info->suspend_event;
-       MonoThreadInfo *info;
-
-       info = mono_thread_info_attach (&result);
-       info->runtime_thread = TRUE;
-       info->create_suspended = suspend;
+}
 
-       mono_threads_platform_set_priority(info, start_info->priority);
+gint
+mono_threads_suspend_search_alternative_signal (void)
+{
+       g_assert_not_reached ();
+}
 
-       mono_coop_sem_post (&(start_info->registered));
+gint
+mono_threads_suspend_get_suspend_signal (void)
+{
+       return -1;
+}
 
-       if (suspend) {
-               WaitForSingleObject (suspend_event, INFINITE); /* caller will suspend the thread before setting the event. */
-               CloseHandle (suspend_event);
-       }
+gint
+mono_threads_suspend_get_restart_signal (void)
+{
+       return -1;
+}
 
-       result = start_func (t_arg);
+gint
+mono_threads_suspend_get_abort_signal (void)
+{
+       return -1;
+}
 
-       mono_thread_info_detach ();
+#endif
 
-       return result;
-}
+#if defined (HOST_WIN32)
 
-HANDLE
-mono_threads_platform_create_thread (MonoThreadStart start_routine, gpointer arg, MonoThreadParm *tp, MonoNativeThreadId *out_tid)
+int
+mono_threads_platform_create_thread (MonoThreadStart thread_fn, gpointer thread_data, gsize* const stack_size, MonoNativeThreadId *out_tid)
 {
-       ThreadStartInfo *start_info;
        HANDLE result;
        DWORD thread_id;
-       guint32 creation_flags = tp->creation_flags;
-       int res;
-
-       start_info = g_malloc0 (sizeof (ThreadStartInfo));
-       if (!start_info)
-               return NULL;
-       mono_coop_sem_init (&(start_info->registered), 0);
-       start_info->arg = arg;
-       start_info->priority = tp->priority;
-       start_info->start_routine = start_routine;
-       start_info->suspend = creation_flags & CREATE_SUSPENDED;
-       creation_flags &= ~CREATE_SUSPENDED;
-       if (start_info->suspend) {
-               start_info->suspend_event = CreateEvent (NULL, TRUE, FALSE, NULL);
-               if (!start_info->suspend_event)
-                       return NULL;
-       }
 
-       result = CreateThread (NULL, tp->stack_size, inner_start_thread, start_info, creation_flags, &thread_id);
-       if (result) {
-               res = mono_coop_sem_wait (&(start_info->registered), MONO_SEM_FLAGS_NONE);
-               g_assert (res != -1);
+       result = CreateThread (NULL, stack_size ? *stack_size : 0, (LPTHREAD_START_ROUTINE) thread_fn, thread_data, 0, &thread_id);
+       if (!result)
+               return -1;
+
+       /* A new handle is open when attaching
+        * the thread, so we don't need this one */
+       CloseHandle (result);
 
-               if (start_info->suspend) {
-                       g_assert (SuspendThread (result) != (DWORD)-1);
-                       SetEvent (start_info->suspend_event);
-               }
-       } else if (start_info->suspend) {
-               CloseHandle (start_info->suspend_event);
-       }
        if (out_tid)
                *out_tid = thread_id;
-       mono_coop_sem_destroy (&(start_info->registered));
-       g_free (start_info);
-       return result;
+
+       if (stack_size) {
+               // TOOD: Use VirtualQuery to get correct value 
+               // http://stackoverflow.com/questions/2480095/thread-stack-size-on-windows-visual-c
+               *stack_size = 2 * 1024 * 1024;
+       }
+
+       return 0;
 }
 
 
@@ -237,15 +234,19 @@ mono_native_thread_create (MonoNativeThreadId *tid, gpointer func, gpointer arg)
        return CreateThread (NULL, 0, (func), (arg), 0, (tid)) != NULL;
 }
 
-void
-mono_threads_platform_resume_created (MonoThreadInfo *info, MonoNativeThreadId tid)
+gboolean
+mono_native_thread_join (MonoNativeThreadId tid)
 {
        HANDLE handle;
 
-       handle = OpenThread (THREAD_ALL_ACCESS, TRUE, tid);
-       g_assert (handle);
-       ResumeThread (handle);
+       if (!(handle = OpenThread (THREAD_ALL_ACCESS, TRUE, tid)))
+               return FALSE;
+
+       DWORD res = WaitForSingleObject (handle, INFINITE);
+
        CloseHandle (handle);
+
+       return res != WAIT_FAILED;
 }
 
 #if HAVE_DECL___READFSDWORD==0
@@ -295,34 +296,11 @@ mono_threads_platform_yield (void)
 }
 
 void
-mono_threads_platform_exit (int exit_code)
+mono_threads_platform_exit (gsize exit_code)
 {
        ExitThread (exit_code);
 }
 
-void
-mono_threads_platform_unregister (MonoThreadInfo *info)
-{
-}
-
-HANDLE
-mono_threads_platform_open_handle (void)
-{
-       HANDLE thread_handle;
-
-       thread_handle = GetCurrentThread ();
-       g_assert (thread_handle);
-
-       /*
-        * The handle returned by GetCurrentThread () is a pseudo handle, so it can't be used to
-        * refer to the thread from other threads for things like aborting.
-        */
-       DuplicateHandle (GetCurrentProcess (), thread_handle, GetCurrentProcess (), &thread_handle,
-                                        THREAD_ALL_ACCESS, TRUE, 0);
-
-       return thread_handle;
-}
-
 int
 mono_threads_get_max_stack_size (void)
 {
@@ -330,12 +308,6 @@ mono_threads_get_max_stack_size (void)
        return INT_MAX;
 }
 
-HANDLE
-mono_threads_platform_open_thread_handle (HANDLE handle, MonoNativeThreadId tid)
-{
-       return OpenThread (THREAD_ALL_ACCESS, TRUE, tid);
-}
-
 #if defined(_MSC_VER)
 const DWORD MS_VC_EXCEPTION=0x406D1388;
 #pragma pack(push,8)
@@ -368,46 +340,4 @@ mono_native_thread_set_name (MonoNativeThreadId tid, const char *name)
 #endif
 }
 
-void
-mono_threads_platform_set_exited (MonoThreadInfo *info)
-{
-}
-
-void
-mono_threads_platform_describe (MonoThreadInfo *info, GString *text)
-{
-       /* TODO */
-}
-
-void
-mono_threads_platform_own_mutex (MonoThreadInfo *info, gpointer mutex_handle)
-{
-       g_assert_not_reached ();
-}
-
-void
-mono_threads_platform_disown_mutex (MonoThreadInfo *info, gpointer mutex_handle)
-{
-       g_assert_not_reached ();
-}
-
-MonoThreadPriority
-mono_threads_platform_get_priority (MonoThreadInfo *info)
-{
-       g_assert (info->handle);
-       return GetThreadPriority (info->handle) + 2;
-}
-
-gboolean
-mono_threads_platform_set_priority (MonoThreadInfo *info, MonoThreadPriority priority)
-{
-       g_assert (info->handle);
-       return SetThreadPriority (info->handle, priority - 2);
-}
-
-void
-mono_threads_platform_init (void)
-{
-}
-
 #endif
index 33796525b90bec8fca74b00d013382cf4eec6398..0b3f71b85d3587bb7650dcb4852100b6737951a4 100644 (file)
@@ -29,6 +29,8 @@
 #include <mono/utils/mono-coop-mutex.h>
 #include <mono/utils/mono-coop-semaphore.h>
 #include <mono/utils/mono-threads-coop.h>
+#include <mono/utils/mono-threads-debug.h>
+#include <mono/utils/os-event.h>
 
 #include <errno.h>
 
@@ -71,7 +73,6 @@ static gboolean mono_threads_inited = FALSE;
 
 static MonoSemType suspend_semaphore;
 static size_t pending_suspends;
-static gboolean unified_suspend_enabled;
 
 #define mono_thread_info_run_state(info) (((MonoThreadInfo*)info)->thread_state & THREAD_STATE_MASK)
 
@@ -260,8 +261,6 @@ mono_threads_wait_pending_operations (void)
 
 //Thread initialization code
 
-static void mono_threads_unregister_current_thread (MonoThreadInfo *info);
-
 static inline void
 mono_hazard_pointer_clear_all (MonoThreadHazardPointers *hp, int retain)
 {
@@ -279,9 +278,9 @@ If return non null Hazard Pointer 1 holds the return value.
 MonoThreadInfo*
 mono_thread_info_lookup (MonoNativeThreadId id)
 {
-               MonoThreadHazardPointers *hp = mono_hazard_pointer_get ();
+       MonoThreadHazardPointers *hp = mono_hazard_pointer_get ();
 
-       if (!mono_lls_find (&thread_list, hp, (uintptr_t)id, HAZARD_FREE_ASYNC_CTX)) {
+       if (!mono_lls_find (&thread_list, hp, (uintptr_t)id)) {
                mono_hazard_pointer_clear_all (hp, -1);
                return NULL;
        } 
@@ -295,7 +294,7 @@ mono_thread_info_insert (MonoThreadInfo *info)
 {
        MonoThreadHazardPointers *hp = mono_hazard_pointer_get ();
 
-       if (!mono_lls_insert (&thread_list, hp, (MonoLinkedListSetNode*)info, HAZARD_FREE_SAFE_CTX)) {
+       if (!mono_lls_insert (&thread_list, hp, (MonoLinkedListSetNode*)info)) {
                mono_hazard_pointer_clear_all (hp, -1);
                return FALSE;
        } 
@@ -311,7 +310,7 @@ mono_thread_info_remove (MonoThreadInfo *info)
        gboolean res;
 
        THREADS_DEBUG ("removing info %p\n", info);
-       res = mono_lls_remove (&thread_list, hp, (MonoLinkedListSetNode*)info, HAZARD_FREE_SAFE_CTX);
+       res = mono_lls_remove (&thread_list, hp, (MonoLinkedListSetNode*)info);
        mono_hazard_pointer_clear_all (hp, -1);
        return res;
 }
@@ -349,6 +348,10 @@ register_thread (MonoThreadInfo *info, gpointer baseptr)
        mono_thread_info_set_tid (info, mono_native_thread_id_get ());
        info->small_id = small_id;
 
+       info->handle = g_new0 (MonoThreadHandle, 1);
+       info->handle->ref = 1;
+       mono_os_event_init (&info->handle->event, FALSE);
+
        mono_os_sem_init (&info->resume_semaphore, 0);
 
        /*set TLS early so SMR works */
@@ -393,12 +396,17 @@ register_thread (MonoThreadInfo *info, gpointer baseptr)
 static void
 mono_thread_info_suspend_lock_with_info (MonoThreadInfo *info);
 
+static void
+mono_threads_signal_thread_handle (MonoThreadHandle* thread_handle);
+
 static void
 unregister_thread (void *arg)
 {
        gpointer gc_unsafe_stackdata;
        MonoThreadInfo *info;
        int small_id;
+       gboolean result;
+       gpointer handle;
 
        info = (MonoThreadInfo *) arg;
        g_assert (info);
@@ -415,8 +423,6 @@ unregister_thread (void *arg)
 
        mono_native_tls_set_value (thread_exited_key, GUINT_TO_POINTER (1));
 
-       mono_threads_platform_unregister (info);
-
        /*
         * TLS destruction order is not reliable so small_id might be cleaned up
         * before us.
@@ -425,6 +431,10 @@ unregister_thread (void *arg)
        mono_native_tls_set_value (small_id_key, GUINT_TO_POINTER (info->small_id + 1));
 #endif
 
+       /* we need to duplicate it, as the info->handle is going
+        * to be closed when unregistering from the platform */
+       handle = mono_threads_open_thread_handle (info->handle);
+
        /*
        First perform the callback that requires no locks.
        This callback has the potential of taking other locks, so we do it before.
@@ -443,7 +453,13 @@ unregister_thread (void *arg)
        */
        if (threads_callbacks.thread_unregister)
                threads_callbacks.thread_unregister (info);
-       mono_threads_unregister_current_thread (info);
+
+       /* The thread is no longer active, so unref its handle */
+       mono_threads_close_thread_handle (info->handle);
+       info->handle = NULL;
+
+       result = mono_thread_info_remove (info);
+       g_assert (result);
        mono_threads_transition_detach (info);
 
        mono_thread_info_suspend_unlock ();
@@ -456,6 +472,10 @@ unregister_thread (void *arg)
        mono_thread_hazardous_try_free_some ();
 
        mono_thread_small_id_free (small_id);
+
+       mono_threads_signal_thread_handle (handle);
+
+       mono_threads_close_thread_handle (handle);
 }
 
 static void
@@ -479,20 +499,6 @@ thread_exited_dtor (void *arg)
 #endif
 }
 
-/**
- * Removes the current thread from the thread list.
- * This must be called from the thread unregister callback and nowhere else.
- * The current thread must be passed as TLS might have already been cleaned up.
-*/
-static void
-mono_threads_unregister_current_thread (MonoThreadInfo *info)
-{
-       gboolean result;
-       g_assert (mono_thread_info_get_tid (info) == mono_native_thread_id_get ());
-       result = mono_thread_info_remove (info);
-       g_assert (result);
-}
-
 MonoThreadInfo*
 mono_thread_info_current_unchecked (void)
 {
@@ -675,8 +681,6 @@ mono_threads_init (MonoThreadInfoCallbacks *callbacks, size_t info_size)
 #endif
        g_assert (res);
 
-       unified_suspend_enabled = g_getenv ("MONO_ENABLE_UNIFIED_SUSPEND") != NULL || mono_threads_is_coop_enabled ();
-       
        if ((sleepLimit = g_getenv ("MONO_SLEEP_ABORT_LIMIT")) != NULL) {
                errno = 0;
                long threshold = strtol(sleepLimit, NULL, 10);
@@ -690,12 +694,11 @@ mono_threads_init (MonoThreadInfoCallbacks *callbacks, size_t info_size)
        mono_os_sem_init (&global_suspend_semaphore, 1);
        mono_os_sem_init (&suspend_semaphore, 0);
 
-       mono_lls_init (&thread_list, NULL, HAZARD_FREE_NO_LOCK);
+       mono_lls_init (&thread_list, NULL);
        mono_thread_smr_init ();
-       mono_threads_platform_init ();
        mono_threads_suspend_init ();
+       mono_threads_suspend_init_signals ();
        mono_threads_coop_init ();
-       mono_threads_abort_syscall_init ();
 
 #if defined(__MACH__)
        mono_mach_init (thread_info_key);
@@ -718,60 +721,10 @@ mono_threads_get_runtime_callbacks (void)
        return &runtime_callbacks;
 }
 
-/*
-Signal that the current thread wants to be suspended.
-This function can be called without holding the suspend lock held.
-To finish suspending, call mono_suspend_check.
-*/
-void
-mono_thread_info_begin_self_suspend (void)
-{
-       MonoThreadInfo *info = mono_thread_info_current_unchecked ();
-       if (!info)
-               return;
-
-       THREADS_SUSPEND_DEBUG ("BEGIN SELF SUSPEND OF %p\n", info);
-       mono_threads_transition_request_self_suspension (info);
-}
-
-void
-mono_thread_info_end_self_suspend (void)
-{
-       MonoThreadInfo *info;
-
-       info = mono_thread_info_current ();
-       if (!info)
-               return;
-       THREADS_SUSPEND_DEBUG ("FINISH SELF SUSPEND OF %p\n", info);
-
-       mono_threads_get_runtime_callbacks ()->thread_state_init (&info->thread_saved_state [SELF_SUSPEND_STATE_INDEX]);
-
-       /* commit the saved state and notify others if needed */
-       switch (mono_threads_transition_state_poll (info)) {
-       case SelfSuspendResumed:
-               return;
-       case SelfSuspendWait:
-               mono_thread_info_wait_for_resume (info);
-               break;
-       case SelfSuspendNotifyAndWait:
-               mono_threads_notify_initiator_of_suspend (info);
-               mono_thread_info_wait_for_resume (info);
-               mono_threads_notify_initiator_of_resume (info);
-               break;
-       }
-}
-
 static gboolean
 mono_thread_info_core_resume (MonoThreadInfo *info)
 {
        gboolean res = FALSE;
-       if (info->create_suspended) {
-               MonoNativeThreadId tid = mono_thread_info_get_tid (info);
-               /* Have to special case this, as the normal suspend/resume pair are racy, they don't work if he resume is received before the suspend */
-               info->create_suspended = FALSE;
-               mono_threads_platform_resume_created (info, tid);
-               return TRUE;
-       }
 
        switch (mono_threads_transition_request_resume (info)) {
        case ResumeError:
@@ -879,6 +832,9 @@ is_thread_in_critical_region (MonoThreadInfo *info)
        if (stack_start < info->stack_start_limit || stack_start >= info->stack_end)
                return TRUE;
 
+       if (threads_callbacks.ip_in_critical_region)
+               return threads_callbacks.ip_in_critical_region ((MonoDomain *) state->unwind_data [MONO_UNWIND_DATA_DOMAIN], (char *) MONO_CONTEXT_GET_IP (&state->ctx));
+
        ji = mono_jit_info_table_find (
                (MonoDomain *) state->unwind_data [MONO_UNWIND_DATA_DOMAIN],
                (char *) MONO_CONTEXT_GET_IP (&state->ctx));
@@ -922,7 +878,7 @@ suspend_sync (MonoNativeThreadId tid, gboolean interrupt_kernel)
                }
                break;
        case AsyncSuspendBlocking:
-               if (interrupt_kernel)
+               if (interrupt_kernel && mono_threads_suspend_needs_abort_syscall ())
                        mono_threads_suspend_abort_syscall (info);
 
                break;
@@ -1002,6 +958,7 @@ mono_thread_info_safe_suspend_and_run (MonoNativeThreadId id, gboolean interrupt
                mono_threads_wait_pending_operations ();
                break;
        case KeepSuspended:
+               g_assert (!mono_threads_is_coop_enabled ());
                break;
        default:
                g_error ("Invalid suspend_and_run callback return value %d", result);
@@ -1106,12 +1063,6 @@ mono_thread_info_abort_socket_syscall_for_close (MonoNativeThreadId tid)
        mono_thread_info_suspend_unlock ();
 }
 
-gboolean
-mono_thread_info_unified_management_enabled (void)
-{
-       return unified_suspend_enabled;
-}
-
 /*
  * mono_thread_info_set_is_async_context:
  *
@@ -1138,16 +1089,94 @@ mono_thread_info_is_async_context (void)
                return FALSE;
 }
 
+typedef struct {
+       gint32 ref;
+       MonoThreadStart start_routine;
+       gpointer start_routine_arg;
+       gint32 priority;
+       MonoCoopSem registered;
+       MonoThreadHandle *handle;
+} CreateThreadData;
+
+static gsize WINAPI
+inner_start_thread (gpointer data)
+{
+       CreateThreadData *thread_data;
+       MonoThreadInfo *info;
+       MonoThreadStart start_routine;
+       gpointer start_routine_arg;
+       gsize start_routine_res;
+       gsize dummy;
+
+       thread_data = (CreateThreadData*) data;
+       g_assert (thread_data);
+
+       start_routine = thread_data->start_routine;
+       start_routine_arg = thread_data->start_routine_arg;
+
+       info = mono_thread_info_attach (&dummy);
+       info->runtime_thread = TRUE;
+
+       thread_data->handle = mono_threads_open_thread_handle (info->handle);
+
+       mono_coop_sem_post (&thread_data->registered);
+
+       if (InterlockedDecrement (&thread_data->ref) == 0) {
+               mono_coop_sem_destroy (&thread_data->registered);
+               g_free (thread_data);
+       }
+
+       /* thread_data is not valid anymore */
+       thread_data = NULL;
+
+       /* Run the actual main function of the thread */
+       start_routine_res = start_routine (start_routine_arg);
+
+       mono_thread_info_exit (start_routine_res);
+
+       g_assert_not_reached ();
+}
+
 /*
  * mono_threads_create_thread:
  *
  *   Create a new thread executing START with argument ARG. Store its id into OUT_TID.
  * Returns: a windows or io-layer handle for the thread.
  */
-HANDLE
-mono_threads_create_thread (MonoThreadStart start, gpointer arg, MonoThreadParm *tp, MonoNativeThreadId *out_tid)
-{
-       return mono_threads_platform_create_thread (start, arg, tp, out_tid);
+MonoThreadHandle*
+mono_threads_create_thread (MonoThreadStart start, gpointer arg, gsize * const stack_size, MonoNativeThreadId *out_tid)
+{
+       CreateThreadData *thread_data;
+       gint res;
+       MonoThreadHandle *ret;
+
+       thread_data = g_new0 (CreateThreadData, 1);
+       thread_data->ref = 2;
+       thread_data->start_routine = start;
+       thread_data->start_routine_arg = arg;
+       mono_coop_sem_init (&thread_data->registered, 0);
+
+       res = mono_threads_platform_create_thread (inner_start_thread, (gpointer) thread_data, stack_size, out_tid);
+       if (res != 0) {
+               /* ref is not going to be decremented in inner_start_thread */
+               InterlockedDecrement (&thread_data->ref);
+               ret = NULL;
+               goto done;
+       }
+
+       res = mono_coop_sem_wait (&thread_data->registered, MONO_SEM_FLAGS_NONE);
+       g_assert (res == 0);
+
+       ret = thread_data->handle;
+       g_assert (ret);
+
+done:
+       if (InterlockedDecrement (&thread_data->ref) == 0) {
+               mono_coop_sem_destroy (&thread_data->registered);
+               g_free (thread_data);
+       }
+
+       return ret;
 }
 
 /*
@@ -1206,7 +1235,7 @@ sleep_interruptable (guint32 ms, gboolean *alerted)
        *alerted = FALSE;
 
        if (ms != INFINITE)
-               end = mono_100ns_ticks () + (ms * 1000 * 10);
+               end = mono_msec_ticks() + ms;
 
        mono_lazy_initialize (&sleep_init, sleep_initialize);
 
@@ -1214,8 +1243,8 @@ sleep_interruptable (guint32 ms, gboolean *alerted)
 
        for (;;) {
                if (ms != INFINITE) {
-                       now = mono_100ns_ticks ();
-                       if (now > end)
+                       now = mono_msec_ticks();
+                       if (now >= end)
                                break;
                }
 
@@ -1226,7 +1255,7 @@ sleep_interruptable (guint32 ms, gboolean *alerted)
                }
 
                if (ms != INFINITE)
-                       mono_coop_cond_timedwait (&sleep_cond, &sleep_mutex, (end - now) / 10 / 1000);
+                       mono_coop_cond_timedwait (&sleep_cond, &sleep_mutex, end - now);
                else
                        mono_coop_cond_wait (&sleep_cond, &sleep_mutex);
 
@@ -1339,6 +1368,10 @@ mono_thread_info_tls_set (THREAD_INFO_TYPE *info, MonoTlsKey key, gpointer value
        ((MonoThreadInfo*)info)->tls [key] = value;
 }
 
+#if defined(__native_client__)
+void nacl_shutdown_gc_thread(void);
+#endif
+
 /*
  * mono_thread_info_exit:
  *
@@ -1346,35 +1379,66 @@ mono_thread_info_tls_set (THREAD_INFO_TYPE *info, MonoTlsKey key, gpointer value
  * This function doesn't return.
  */
 void
-mono_thread_info_exit (void)
+mono_thread_info_exit (gsize exit_code)
 {
+#if defined(__native_client__)
+       nacl_shutdown_gc_thread();
+#endif
+
+       mono_thread_info_detach ();
+
        mono_threads_platform_exit (0);
 }
 
 /*
- * mono_thread_info_open_handle:
+ * mono_threads_open_thread_handle:
  *
- *   Return a io-layer/win32 handle for the current thread.
- * The handle need to be closed by calling CloseHandle () when it is no
- * longer needed.
+ *  Duplicate the handle. The handle needs to be closed by calling
+ *  mono_threads_close_thread_handle () when it is no longer needed.
  */
-HANDLE
-mono_thread_info_open_handle (void)
+MonoThreadHandle*
+mono_threads_open_thread_handle (MonoThreadHandle *thread_handle)
 {
-       return mono_threads_platform_open_handle ();
+       guint32 oldref, newref;
+
+       g_assert (thread_handle);
+
+       do {
+               oldref = thread_handle->ref;
+               if (!(oldref >= 1))
+                       g_error ("%s: thread_handle %p has ref %u, it should be >= 1", __func__, thread_handle, oldref);
+
+               newref = oldref + 1;
+       } while (InterlockedCompareExchange ((gint32*) &thread_handle->ref, newref, oldref) != oldref);
+
+       return thread_handle;
 }
 
-/*
- * mono_threads_open_thread_handle:
- *
- *   Return a io-layer/win32 handle for the thread identified by HANDLE/TID.
- * The handle need to be closed by calling CloseHandle () when it is no
- * longer needed.
- */
-HANDLE
-mono_threads_open_thread_handle (HANDLE handle, MonoNativeThreadId tid)
+void
+mono_threads_close_thread_handle (MonoThreadHandle *thread_handle)
+{
+       guint32 oldref, newref;
+
+       g_assert (thread_handle);
+
+       do {
+               oldref = thread_handle->ref;
+               if (!(oldref >= 1))
+                       g_error ("%s: thread_handle %p has ref %u, it should be >= 1", __func__, thread_handle, oldref);
+
+               newref = oldref - 1;
+       } while (InterlockedCompareExchange ((gint32*) &thread_handle->ref, newref, oldref) != oldref);
+
+       if (newref == 0) {
+               mono_os_event_destroy (&thread_handle->event);
+               g_free (thread_handle);
+       }
+}
+
+static void
+mono_threads_signal_thread_handle (MonoThreadHandle* thread_handle)
 {
-       return mono_threads_platform_open_thread_handle (handle, tid);
+       mono_os_event_set (&thread_handle->event);
 }
 
 #define INTERRUPT_STATE ((MonoThreadInfoInterruptToken*) (size_t) -1)
@@ -1583,46 +1647,46 @@ mono_thread_info_is_current (MonoThreadInfo *info)
        return mono_thread_info_get_tid (info) == mono_native_thread_id_get ();
 }
 
-void
-mono_thread_info_set_exited (THREAD_INFO_TYPE *info)
+MonoThreadInfoWaitRet
+mono_thread_info_wait_one_handle (MonoThreadHandle *thread_handle, guint32 timeout, gboolean alertable)
 {
-       g_assert (mono_thread_info_is_current (info));
-       mono_threads_platform_set_exited (info);
-}
+       MonoOSEventWaitRet res;
 
-gpointer
-mono_thread_info_get_handle (THREAD_INFO_TYPE *info)
-{
-       g_assert (info->handle);
-       return info->handle;
+       res = mono_os_event_wait_one (&thread_handle->event, timeout);
+       if (res == MONO_OS_EVENT_WAIT_RET_SUCCESS_0)
+               return MONO_THREAD_INFO_WAIT_RET_SUCCESS_0;
+       else if (res == MONO_OS_EVENT_WAIT_RET_ALERTED)
+               return MONO_THREAD_INFO_WAIT_RET_ALERTED;
+       else if (res == MONO_OS_EVENT_WAIT_RET_TIMEOUT)
+               return MONO_THREAD_INFO_WAIT_RET_TIMEOUT;
+       else
+               g_error ("%s: unknown res value %d", __func__, res);
 }
 
-void
-mono_thread_info_describe (MonoThreadInfo *info, GString *text)
+MonoThreadInfoWaitRet
+mono_thread_info_wait_multiple_handle (MonoThreadHandle **thread_handles, gsize nhandles, MonoOSEvent *background_change_event, gboolean waitall, guint32 timeout, gboolean alertable)
 {
-       mono_threads_platform_describe (info, text);
-}
+       MonoOSEventWaitRet res;
+       MonoOSEvent *thread_events [MONO_OS_EVENT_WAIT_MAXIMUM_OBJECTS];
+       gint i;
 
-void
-mono_thread_info_own_mutex (MonoThreadInfo *info, gpointer mutex_handle)
-{
-       mono_threads_platform_own_mutex (info, mutex_handle);
-}
+       g_assert (nhandles <= MONO_OS_EVENT_WAIT_MAXIMUM_OBJECTS);
+       if (background_change_event)
+               g_assert (nhandles <= MONO_OS_EVENT_WAIT_MAXIMUM_OBJECTS - 1);
 
-void
-mono_thread_info_disown_mutex (MonoThreadInfo *info, gpointer mutex_handle)
-{
-       mono_threads_platform_disown_mutex (info, mutex_handle);
-}
+       for (i = 0; i < nhandles; ++i)
+               thread_events [i] = &thread_handles [i]->event;
 
-MonoThreadPriority
-mono_thread_info_get_priority (MonoThreadInfo *info)
-{
-       return mono_threads_platform_get_priority (info);
-}
+       if (background_change_event)
+               thread_events [nhandles ++] = background_change_event;
 
-gboolean
-mono_thread_info_set_priority (MonoThreadInfo *info, MonoThreadPriority priority)
-{
-       return mono_threads_platform_set_priority (info, priority);
+       res = mono_os_event_wait_multiple (thread_events, nhandles, waitall, timeout);
+       if (res >= MONO_OS_EVENT_WAIT_RET_SUCCESS_0 && res <= MONO_OS_EVENT_WAIT_RET_SUCCESS_0 + nhandles - 1)
+               return MONO_THREAD_INFO_WAIT_RET_SUCCESS_0 + (res - MONO_OS_EVENT_WAIT_RET_SUCCESS_0);
+       else if (res == MONO_OS_EVENT_WAIT_RET_ALERTED)
+               return MONO_THREAD_INFO_WAIT_RET_ALERTED;
+       else if (res == MONO_OS_EVENT_WAIT_RET_TIMEOUT)
+               return MONO_THREAD_INFO_WAIT_RET_TIMEOUT;
+       else
+               g_error ("%s: unknown res value %d", __func__, res);
 }
index 6e74ec9fb8aa0ef95f5dbabcb429cc35dd680f24..b076433999ba43c501b23a0d934abe798cd0f64a 100644 (file)
@@ -15,6 +15,7 @@
 #include <mono/utils/mono-linked-list-set.h>
 #include <mono/utils/mono-tls.h>
 #include <mono/utils/mono-coop-semaphore.h>
+#include <mono/utils/os-event.h>
 
 #include <mono/io-layer/io-layer.h>
 
@@ -28,6 +29,7 @@ typedef DWORD MonoNativeThreadId;
 typedef HANDLE MonoNativeThreadHandle; /* unused */
 
 typedef DWORD mono_native_thread_return_t;
+typedef DWORD mono_thread_start_return_t;
 
 #define MONO_NATIVE_THREAD_ID_TO_UINT(tid) (tid)
 #define MONO_UINT_TO_NATIVE_THREAD_ID(tid) ((MonoNativeThreadId)(tid))
@@ -54,6 +56,7 @@ typedef pid_t MonoNativeThreadHandle;
 typedef pthread_t MonoNativeThreadId;
 
 typedef void* mono_native_thread_return_t;
+typedef gsize mono_thread_start_return_t;
 
 #define MONO_NATIVE_THREAD_ID_TO_UINT(tid) (gsize)(tid)
 #define MONO_UINT_TO_NATIVE_THREAD_ID(tid) (MonoNativeThreadId)(gsize)(tid)
@@ -62,6 +65,11 @@ typedef gsize (*MonoThreadStart)(gpointer);
 
 #endif /* #ifdef HOST_WIN32 */
 
+typedef struct {
+       guint32 ref;
+       MonoOSEvent event;
+} MonoThreadHandle;
+
 /*
 THREAD_INFO_TYPE is a way to make the mono-threads module parametric - or sort of.
 The GC using mono-threads might extend the MonoThreadInfo struct to add its own
@@ -90,44 +98,6 @@ and reduce the number of casts drastically.
 
 /* Mono Threads internal configuration knows*/
 
-/* Logging - enable them below if you need specific logging for the category you need */
-#define MOSTLY_ASYNC_SAFE_PRINTF(...) do { \
-       char __buff[1024];      __buff [0] = '\0'; \
-       g_snprintf (__buff, sizeof (__buff), __VA_ARGS__);      \
-       write (1, __buff, strlen (__buff));     \
-} while (0)
-
-
-#if 1
-#define THREADS_DEBUG(...)
-#else
-#define THREADS_DEBUG MOSTLY_ASYNC_SAFE_PRINTF
-#endif
-
-#if 1
-#define THREADS_STW_DEBUG(...)
-#else
-#define THREADS_STW_DEBUG MOSTLY_ASYNC_SAFE_PRINTF
-#endif
-
-#if 1
-#define THREADS_SUSPEND_DEBUG(...)
-#else
-#define THREADS_SUSPEND_DEBUG MOSTLY_ASYNC_SAFE_PRINTF
-#endif
-
-#if 1
-#define THREADS_STATE_MACHINE_DEBUG(...)
-#else
-#define THREADS_STATE_MACHINE_DEBUG MOSTLY_ASYNC_SAFE_PRINTF
-#endif
-
-#if 1
-#define THREADS_INTERRUPT_DEBUG(...)
-#else
-#define THREADS_INTERRUPT_DEBUG MOSTLY_ASYNC_SAFE_PRINTF
-#endif
-
 /* If this is defined, use the signals backed on Mach. Debug only as signals can't be made usable on OSX. */
 // #define USE_SIGNALS_ON_MACH
 
@@ -221,11 +191,6 @@ typedef struct {
         */
        gboolean is_async_context;
 
-       gboolean create_suspended;
-
-       /* Semaphore used to implement CREATE_SUSPENDED */
-       MonoCoopSem create_suspended_sem;
-
        /*
         * Values of TLS variables for this thread.
         * This can be used to obtain the values of TLS variable for threads
@@ -235,7 +200,7 @@ typedef struct {
 
        /* IO layer handle for this thread */
        /* Set when the thread is started, or in _wapi_thread_duplicate () */
-       HANDLE handle;
+       MonoThreadHandle *handle;
 
        void *jit_data;
 
@@ -266,6 +231,7 @@ typedef struct {
        void (*thread_detach)(THREAD_INFO_TYPE *info);
        void (*thread_attach)(THREAD_INFO_TYPE *info);
        gboolean (*mono_method_is_critical) (void *method);
+       gboolean (*ip_in_critical_region) (MonoDomain *domain, gpointer ip);
        gboolean (*mono_thread_in_critical_region) (THREAD_INFO_TYPE *info);
 } MonoThreadInfoCallbacks;
 
@@ -284,23 +250,6 @@ typedef enum {
 
 typedef SuspendThreadResult (*MonoSuspendThreadCallback) (THREAD_INFO_TYPE *info, gpointer user_data);
 
-/*
- * Parameters to pass for thread creation
- */
-typedef struct {
-       int priority;
-       guint32 creation_flags; 
-       guint32 stack_size;             
-} MonoThreadParm;
-
-typedef enum {
-       MONO_THREAD_PRIORITY_LOWEST       = 0,
-       MONO_THREAD_PRIORITY_BELOW_NORMAL = 1,
-       MONO_THREAD_PRIORITY_NORMAL       = 2,
-       MONO_THREAD_PRIORITY_ABOVE_NORMAL = 3,
-       MONO_THREAD_PRIORITY_HIGHEST      = 4,
-} MonoThreadPriority;
-
 static inline gboolean
 mono_threads_filter_tools_threads (THREAD_INFO_TYPE *info)
 {
@@ -383,18 +332,6 @@ mono_thread_info_resume (MonoNativeThreadId tid);
 void
 mono_thread_info_safe_suspend_and_run (MonoNativeThreadId id, gboolean interrupt_kernel, MonoSuspendThreadCallback callback, gpointer user_data);
 
-//XXX new API, fix the world
-void
-mono_thread_info_begin_self_suspend (void);
-
-void
-mono_thread_info_end_self_suspend (void);
-
-//END of new API
-
-gboolean
-mono_thread_info_unified_management_enabled (void);
-
 void
 mono_thread_info_setup_async_call (THREAD_INFO_TYPE *info, void (*target_func)(void*), void *user_data);
 
@@ -416,7 +353,7 @@ mono_thread_info_is_async_context (void);
 void
 mono_thread_info_get_stack_bounds (guint8 **staddr, size_t *stsize);
 
-gboolean
+MONO_API gboolean
 mono_thread_info_yield (void);
 
 gint
@@ -432,13 +369,7 @@ void
 mono_thread_info_tls_set (THREAD_INFO_TYPE *info, MonoTlsKey key, gpointer value);
 
 void
-mono_thread_info_exit (void);
-
-HANDLE
-mono_thread_info_open_handle (void);
-
-void
-mono_thread_info_set_exited (THREAD_INFO_TYPE *info);
+mono_thread_info_exit (gsize exit_code);
 
 void
 mono_thread_info_install_interrupt (void (*callback) (gpointer data), gpointer data, gboolean *interrupted);
@@ -467,14 +398,17 @@ mono_thread_info_describe_interrupt_token (THREAD_INFO_TYPE *info, GString *text
 gboolean
 mono_thread_info_is_live (THREAD_INFO_TYPE *info);
 
-HANDLE
-mono_threads_create_thread (MonoThreadStart start, gpointer arg, MonoThreadParm *tp, MonoNativeThreadId *out_tid);
+MonoThreadHandle*
+mono_threads_create_thread (MonoThreadStart start, gpointer arg, gsize * const stack_size, MonoNativeThreadId *out_tid);
 
 int
 mono_threads_get_max_stack_size (void);
 
-HANDLE
-mono_threads_open_thread_handle (HANDLE handle, MonoNativeThreadId tid);
+MonoThreadHandle*
+mono_threads_open_thread_handle (MonoThreadHandle *handle);
+
+void
+mono_threads_close_thread_handle (MonoThreadHandle *handle);
 
 MONO_API void
 mono_threads_attach_tools_thread (void);
@@ -497,12 +431,10 @@ This is called very early in the runtime, it cannot access any runtime facilitie
 */
 void mono_threads_suspend_init (void); //ok
 
-void mono_threads_platform_init (void);
+void mono_threads_suspend_init_signals (void);
 
 void mono_threads_coop_init (void);
 
-void mono_threads_abort_syscall_init (void);
-
 /*
 This begins async suspend. This function must do the following:
 
@@ -535,21 +467,15 @@ void mono_threads_suspend_register (THREAD_INFO_TYPE *info); //ok
 void mono_threads_suspend_free (THREAD_INFO_TYPE *info);
 void mono_threads_suspend_abort_syscall (THREAD_INFO_TYPE *info);
 gboolean mono_threads_suspend_needs_abort_syscall (void);
+gint mono_threads_suspend_search_alternative_signal (void);
+gint mono_threads_suspend_get_suspend_signal (void);
+gint mono_threads_suspend_get_restart_signal (void);
+gint mono_threads_suspend_get_abort_signal (void);
 
-HANDLE mono_threads_platform_create_thread (MonoThreadStart start, gpointer arg, MonoThreadParm *, MonoNativeThreadId *out_tid);
-void mono_threads_platform_resume_created (THREAD_INFO_TYPE *info, MonoNativeThreadId tid);
+int mono_threads_platform_create_thread (MonoThreadStart thread_fn, gpointer thread_data, gsize* const stack_size, MonoNativeThreadId *out_tid);
 void mono_threads_platform_get_stack_bounds (guint8 **staddr, size_t *stsize);
 gboolean mono_threads_platform_yield (void);
-void mono_threads_platform_exit (int exit_code);
-void mono_threads_platform_unregister (THREAD_INFO_TYPE *info);
-HANDLE mono_threads_platform_open_handle (void);
-HANDLE mono_threads_platform_open_thread_handle (HANDLE handle, MonoNativeThreadId tid);
-void mono_threads_platform_set_exited (THREAD_INFO_TYPE *info);
-void mono_threads_platform_describe (THREAD_INFO_TYPE *info, GString *text);
-void mono_threads_platform_own_mutex (THREAD_INFO_TYPE *info, gpointer mutex_handle);
-void mono_threads_platform_disown_mutex (THREAD_INFO_TYPE *info, gpointer mutex_handle);
-MonoThreadPriority mono_threads_platform_get_priority (THREAD_INFO_TYPE *info);
-gboolean mono_threads_platform_set_priority (THREAD_INFO_TYPE *info, MonoThreadPriority priority);
+void mono_threads_platform_exit (gsize exit_code);
 
 void mono_threads_coop_begin_global_suspend (void);
 void mono_threads_coop_end_global_suspend (void);
@@ -557,15 +483,18 @@ void mono_threads_coop_end_global_suspend (void);
 MONO_API MonoNativeThreadId
 mono_native_thread_id_get (void);
 
-gboolean
+MONO_API gboolean
 mono_native_thread_id_equals (MonoNativeThreadId id1, MonoNativeThreadId id2);
 
-gboolean
+MONO_API gboolean
 mono_native_thread_create (MonoNativeThreadId *tid, gpointer func, gpointer arg);
 
 MONO_API void
 mono_native_thread_set_name (MonoNativeThreadId tid, const char *name);
 
+MONO_API gboolean
+mono_native_thread_join (MonoNativeThreadId tid);
+
 /*Mach specific internals */
 void mono_threads_init_dead_letter (void);
 void mono_threads_install_dead_letter (void);
@@ -629,7 +558,6 @@ typedef enum {
 
 void mono_threads_transition_attach (THREAD_INFO_TYPE* info);
 gboolean mono_threads_transition_detach (THREAD_INFO_TYPE *info);
-void mono_threads_transition_request_self_suspension (THREAD_INFO_TYPE *info);
 MonoRequestAsyncSuspendResult mono_threads_transition_request_async_suspension (THREAD_INFO_TYPE *info);
 MonoSelfSupendResult mono_threads_transition_state_poll (THREAD_INFO_TYPE *info);
 MonoResumeResult mono_threads_transition_request_resume (THREAD_INFO_TYPE* info);
@@ -664,22 +592,17 @@ void mono_threads_end_global_suspend (void);
 gboolean
 mono_thread_info_is_current (THREAD_INFO_TYPE *info);
 
-gpointer
-mono_thread_info_get_handle (THREAD_INFO_TYPE *info);
-
-void
-mono_thread_info_describe (THREAD_INFO_TYPE *info, GString *text);
-
-void
-mono_thread_info_own_mutex (THREAD_INFO_TYPE *info, gpointer mutex_handle);
-
-void
-mono_thread_info_disown_mutex (THREAD_INFO_TYPE *info, gpointer mutex_handle);
+typedef enum {
+       MONO_THREAD_INFO_WAIT_RET_SUCCESS_0   =  0,
+       MONO_THREAD_INFO_WAIT_RET_ALERTED     = -1,
+       MONO_THREAD_INFO_WAIT_RET_TIMEOUT     = -2,
+       MONO_THREAD_INFO_WAIT_RET_FAILED      = -3,
+} MonoThreadInfoWaitRet;
 
-MonoThreadPriority
-mono_thread_info_get_priority (THREAD_INFO_TYPE *info);
+MonoThreadInfoWaitRet
+mono_thread_info_wait_one_handle (MonoThreadHandle *handle, guint32 timeout, gboolean alertable);
 
-gboolean
-mono_thread_info_set_priority (THREAD_INFO_TYPE *info, MonoThreadPriority priority);
+MonoThreadInfoWaitRet
+mono_thread_info_wait_multiple_handle (MonoThreadHandle **thread_handles, gsize nhandles, MonoOSEvent *background_change_event, gboolean waitall, guint32 timeout, gboolean alertable);
 
 #endif /* __MONO_THREADS_H__ */
index 2c3ed31df4539c5aa6813646d062bfb03fbdef9f..40b09e1dcad579aa43303e5efd8f4d52d8fded28 100644 (file)
@@ -23,12 +23,9 @@ typedef enum {
        TLS_KEY_DOMAIN = 2,
        TLS_KEY_LMF = 3,
        TLS_KEY_SGEN_THREAD_INFO = 4,
-       TLS_KEY_SGEN_TLAB_NEXT_ADDR = 5,
-       TLS_KEY_SGEN_TLAB_TEMP_END = 6,
-       TLS_KEY_BOEHM_GC_THREAD = 7,
-       TLS_KEY_LMF_ADDR = 8,
-       TLS_KEY_SGEN_IN_CRITICAL_REGION_ADDR = 9,
-       TLS_KEY_NUM = 10
+       TLS_KEY_BOEHM_GC_THREAD = 5,
+       TLS_KEY_LMF_ADDR = 6,
+       TLS_KEY_NUM = 7
 } MonoTlsKey;
 
 #ifdef HOST_WIN32
index 7a2c4ac8100ebd9afec9607a8b7b0640c498f3a5..8ebc25a69b303019f66ecd117a2e9f7a5843a0c1 100644 (file)
@@ -36,7 +36,7 @@ mono_escape_uri_string (const gchar *string)
 #if TEST
 int main ()
 {
-       char *s = malloc (256);
+       char *s = g_malloc (256);
        int i = 0;
        
        s [255] = 0;
index c3501f25268fdc6b74b4bea84595698f1139a935..8c8c75b5a1012ffdaab66fdac3d976abb6c76cea 100644 (file)
@@ -8,6 +8,7 @@
  */
 
 #include <mono/utils/networking.h>
+#include <mono/utils/mono-compiler.h>
 #include <glib.h>
 
 #ifdef HAVE_NETDB_H
@@ -53,4 +54,7 @@ inet_pton (int family, const char *address, void *inaddrp)
        return -1;
 }
 
+#else /* !HAVE_INET_PTON */
+
+MONO_EMPTY_SOURCE_FILE (networking_missing);
 #endif /* !HAVE_INET_PTON */
diff --git a/mono/utils/os-event-unix.c b/mono/utils/os-event-unix.c
new file mode 100644 (file)
index 0000000..611cb76
--- /dev/null
@@ -0,0 +1,228 @@
+/*
+ * os-event-unix.c: MonoOSEvent on Unix
+ *
+ * Author:
+ *     Ludovic Henry (luhenry@microsoft.com)
+ *
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
+ */
+
+#include "os-event.h"
+
+#include "atomic.h"
+#include "mono-lazy-init.h"
+#include "mono-threads.h"
+#include "mono-time.h"
+
+static mono_lazy_init_t status = MONO_LAZY_INIT_STATUS_NOT_INITIALIZED;
+
+static mono_mutex_t signal_mutex;
+
+static void
+initialize (void)
+{
+       mono_os_mutex_init (&signal_mutex);
+}
+
+void
+mono_os_event_init (MonoOSEvent *event, gboolean initial)
+{
+       g_assert (event);
+
+       mono_lazy_initialize (&status, initialize);
+
+       event->conds = g_ptr_array_new ();
+       event->signalled = initial;
+}
+
+void
+mono_os_event_destroy (MonoOSEvent *event)
+{
+       g_assert (mono_lazy_is_initialized (&status));
+
+       g_assert (event);
+
+       if (event->conds->len > 0)
+               g_error ("%s: cannot destroy osevent, there are still %d threads waiting on it", __func__, event->conds->len);
+
+       g_ptr_array_free (event->conds, TRUE);
+}
+
+static gboolean
+mono_os_event_is_signalled (MonoOSEvent *event)
+{
+       return event->signalled;
+}
+
+void
+mono_os_event_set (MonoOSEvent *event)
+{
+       gsize i;
+
+       g_assert (mono_lazy_is_initialized (&status));
+
+       g_assert (event);
+
+       mono_os_mutex_lock (&signal_mutex);
+
+       event->signalled = TRUE;
+
+       for (i = 0; i < event->conds->len; ++i)
+               mono_os_cond_signal ((mono_cond_t*) event->conds->pdata [i]);
+
+       mono_os_mutex_unlock (&signal_mutex);
+}
+
+void
+mono_os_event_reset (MonoOSEvent *event)
+{
+       g_assert (mono_lazy_is_initialized (&status));
+
+       g_assert (event);
+
+       mono_os_mutex_lock (&signal_mutex);
+
+       event->signalled = FALSE;
+
+       mono_os_mutex_unlock (&signal_mutex);
+}
+
+MonoOSEventWaitRet
+mono_os_event_wait_one (MonoOSEvent *event, guint32 timeout)
+{
+       return mono_os_event_wait_multiple (&event, 1, TRUE, timeout);
+}
+
+typedef struct {
+       guint32 ref;
+       MonoOSEvent event;
+} OSEventWaitData;
+
+static void
+signal_and_unref (gpointer user_data)
+{
+       OSEventWaitData *data;
+
+       data = (OSEventWaitData*) user_data;
+
+       mono_os_event_set (&data->event);
+       if (InterlockedDecrement ((gint32*) &data->ref) == 0) {
+               mono_os_event_destroy (&data->event);
+               g_free (data);
+       }
+}
+
+MonoOSEventWaitRet
+mono_os_event_wait_multiple (MonoOSEvent **events, gsize nevents, gboolean waitall, guint32 timeout)
+{
+       MonoOSEventWaitRet ret;
+       mono_cond_t signal_cond;
+       OSEventWaitData *data;
+       gboolean alerted;
+       gint64 start;
+       gint i;
+
+       g_assert (mono_lazy_is_initialized (&status));
+
+       g_assert (events);
+       g_assert (nevents > 0);
+       g_assert (nevents <= MONO_OS_EVENT_WAIT_MAXIMUM_OBJECTS);
+
+       for (i = 0; i < nevents; ++i)
+               g_assert (events [i]);
+
+       data = g_new0 (OSEventWaitData, 1);
+       data->ref = 2;
+       mono_os_event_init (&data->event, FALSE);
+
+       alerted = FALSE;
+       mono_thread_info_install_interrupt (signal_and_unref, data, &alerted);
+       if (alerted) {
+               mono_os_event_destroy (&data->event);
+               g_free (data);
+               return MONO_OS_EVENT_WAIT_RET_ALERTED;
+       }
+
+       if (timeout != MONO_INFINITE_WAIT)
+               start = mono_msec_ticks ();
+
+       mono_os_cond_init (&signal_cond);
+
+       mono_os_mutex_lock (&signal_mutex);
+
+       for (i = 0; i < nevents; ++i)
+               g_ptr_array_add (events [i]->conds, &signal_cond);
+
+       g_ptr_array_add (data->event.conds, &signal_cond);
+
+       for (;;) {
+               gint count, lowest;
+               gboolean signalled;
+
+               count = 0;
+               lowest = -1;
+
+               for (i = 0; i < nevents; ++i) {
+                       if (mono_os_event_is_signalled (events [i])) {
+                               count += 1;
+                               if (lowest == -1)
+                                       lowest = i;
+                       }
+               }
+
+               if (mono_os_event_is_signalled (&data->event))
+                       signalled = TRUE;
+               else if (waitall)
+                       signalled = (count == nevents);
+               else /* waitany */
+                       signalled = (count > 0);
+
+               if (signalled) {
+                       ret = MONO_OS_EVENT_WAIT_RET_SUCCESS_0 + lowest;
+                       goto done;
+               }
+
+               if (timeout == MONO_INFINITE_WAIT) {
+                       mono_os_cond_wait (&signal_cond, &signal_mutex);
+               } else {
+                       gint64 elapsed;
+                       gint res;
+
+                       elapsed = mono_msec_ticks () - start;
+                       if (elapsed >= timeout) {
+                               ret = MONO_OS_EVENT_WAIT_RET_TIMEOUT;
+                               goto done;
+                       }
+
+                       res = mono_os_cond_timedwait (&signal_cond, &signal_mutex, timeout - elapsed);
+                       if (res != 0) {
+                               ret = MONO_OS_EVENT_WAIT_RET_TIMEOUT;
+                               goto done;
+                       }
+               }
+       }
+
+done:
+       for (i = 0; i < nevents; ++i)
+               g_ptr_array_remove (events [i]->conds, &signal_cond);
+
+       g_ptr_array_remove (data->event.conds, &signal_cond);
+
+       mono_os_mutex_unlock (&signal_mutex);
+
+       mono_os_cond_destroy (&signal_cond);
+
+       mono_thread_info_uninstall_interrupt (&alerted);
+       if (alerted) {
+               if (InterlockedDecrement ((gint32*) &data->ref) == 0) {
+                       mono_os_event_destroy (&data->event);
+                       g_free (data);
+               }
+               return MONO_OS_EVENT_WAIT_RET_ALERTED;
+       }
+
+       mono_os_event_destroy (&data->event);
+       g_free (data);
+
+       return ret;
+}
diff --git a/mono/utils/os-event-win32.c b/mono/utils/os-event-win32.c
new file mode 100644 (file)
index 0000000..e28833c
--- /dev/null
@@ -0,0 +1,118 @@
+/*
+ * os-event-win32.c: MonoOSEvent on Win32
+ *
+ * Author:
+ *     Ludovic Henry (luhenry@microsoft.com)
+ *
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
+ */
+
+#include "os-event.h"
+
+#include <windows.h>
+#include <winbase.h>
+
+#include "atomic.h"
+
+void
+mono_os_event_init (MonoOSEvent *event, gboolean initial)
+{
+       g_assert (event);
+
+       event->handle = CreateEvent (NULL, TRUE, initial, NULL);
+       if (G_UNLIKELY (!event->handle))
+               g_error ("%s: CreateEvent failed with error %d", __func__, GetLastError ());
+}
+
+void
+mono_os_event_destroy (MonoOSEvent *event)
+{
+       BOOL res;
+
+       g_assert (event);
+       g_assert (event->handle);
+
+       res = CloseHandle (event->handle);
+       if (G_UNLIKELY (res == 0))
+               g_error ("%s: CloseHandle failed with error %d", __func__, GetLastError ());
+}
+
+void
+mono_os_event_set (MonoOSEvent *event)
+{
+       BOOL res;
+
+       g_assert (event);
+       g_assert (event->handle);
+
+       res = SetEvent (event->handle);
+       if (G_UNLIKELY (res == 0))
+               g_error ("%s: SetEvent failed with error %d", __func__, GetLastError ());
+}
+
+void
+mono_os_event_reset (MonoOSEvent *event)
+{
+       BOOL res;
+
+       g_assert (event);
+       g_assert (event->handle);
+
+       res = ResetEvent (event->handle);
+       if (G_UNLIKELY (res == 0))
+               g_error ("%s: ResetEvent failed with error %d", __func__, GetLastError ());
+}
+
+MonoOSEventWaitRet
+mono_os_event_wait_one (MonoOSEvent *event, guint32 timeout)
+{
+       DWORD res;
+
+       g_assert (event);
+       g_assert (event->handle);
+
+       res = WaitForSingleObjectEx (event->handle, timeout, TRUE);
+       if (res == WAIT_OBJECT_0)
+               return MONO_OS_EVENT_WAIT_RET_SUCCESS_0;
+       else if (res == WAIT_IO_COMPLETION)
+               return MONO_OS_EVENT_WAIT_RET_ALERTED;
+       else if (res == WAIT_TIMEOUT)
+               return MONO_OS_EVENT_WAIT_RET_TIMEOUT;
+       else if (res == WAIT_FAILED)
+               g_error ("%s: WaitForSingleObjectEx failed with error %d", __func__, GetLastError ());
+       else
+               g_error ("%s: unknown res value %d", __func__, res);
+}
+
+MonoOSEventWaitRet
+mono_os_event_wait_multiple (MonoOSEvent **events, gsize nevents, gboolean waitall, guint32 timeout)
+{
+       DWORD res;
+       gpointer handles [MONO_OS_EVENT_WAIT_MAXIMUM_OBJECTS];
+       gint i;
+
+       g_assert (events);
+       g_assert (nevents > 0);
+       g_assert (nevents <= MONO_OS_EVENT_WAIT_MAXIMUM_OBJECTS);
+
+       if (nevents == 1)
+               return mono_os_event_wait_one (events [0], timeout);
+
+       for (i = 0; i < nevents; ++i) {
+               g_assert (events [i]);
+               g_assert (events [i]->handle);
+               handles [i] = events [i]->handle;
+       }
+
+       res = WaitForMultipleObjectsEx (nevents, handles, waitall, timeout, TRUE);
+       if (res >= WAIT_OBJECT_0 && res < WAIT_OBJECT_0 + MONO_OS_EVENT_WAIT_MAXIMUM_OBJECTS)
+               return MONO_OS_EVENT_WAIT_RET_SUCCESS_0 + (res - WAIT_OBJECT_0);
+       else if (res == WAIT_IO_COMPLETION)
+               return MONO_OS_EVENT_WAIT_RET_ALERTED;
+       else if (res == WAIT_TIMEOUT)
+               return MONO_OS_EVENT_WAIT_RET_TIMEOUT;
+       else if (res == WAIT_FAILED)
+               g_error ("%s: WaitForSingleObjectEx failed with error %d", __func__, GetLastError ());
+       else
+               g_error ("%s: unknown res value %d", __func__, res);
+}
diff --git a/mono/utils/os-event.h b/mono/utils/os-event.h
new file mode 100644 (file)
index 0000000..c3ca11b
--- /dev/null
@@ -0,0 +1,53 @@
+
+#ifndef _MONO_UTILS_OS_EVENT_H_
+#define _MONO_UTILS_OS_EVENT_H_
+
+#include <config.h>
+#include <glib.h>
+
+#include "mono-os-mutex.h"
+
+#ifndef MONO_INFINITE_WAIT
+#define MONO_INFINITE_WAIT ((guint32) 0xFFFFFFFF)
+#endif
+
+#define MONO_OS_EVENT_WAIT_MAXIMUM_OBJECTS 64
+
+typedef enum {
+       MONO_OS_EVENT_WAIT_RET_SUCCESS_0 =  0,
+       MONO_OS_EVENT_WAIT_RET_ALERTED   = -1,
+       MONO_OS_EVENT_WAIT_RET_TIMEOUT   = -2,
+} MonoOSEventWaitRet;
+
+typedef struct _MonoOSEvent MonoOSEvent;
+
+typedef void (*MonoOSEventFreeCb) (MonoOSEvent*);
+
+struct _MonoOSEvent {
+#ifdef HOST_WIN32
+       gpointer handle;
+#else
+       GPtrArray *conds;
+       gboolean signalled;
+#endif
+};
+
+void
+mono_os_event_init (MonoOSEvent *event, gboolean initial);
+
+void
+mono_os_event_destroy (MonoOSEvent *event);
+
+void
+mono_os_event_set (MonoOSEvent *event);
+
+void
+mono_os_event_reset (MonoOSEvent *event);
+
+MonoOSEventWaitRet
+mono_os_event_wait_one (MonoOSEvent *event, guint32 timeout);
+
+MonoOSEventWaitRet
+mono_os_event_wait_multiple (MonoOSEvent **events, gsize nevents, gboolean waitall, guint32 timeout);
+
+#endif /* _MONO_UTILS_OS_EVENT_H_ */
diff --git a/mono/utils/w32handle.c b/mono/utils/w32handle.c
deleted file mode 100644 (file)
index 9b51b0f..0000000
+++ /dev/null
@@ -1,1165 +0,0 @@
-/*
- * w32handle.c:  Generic and internal operations on handles
- *
- * Author:
- *     Dick Porter (dick@ximian.com)
- *     Ludovic Henry (luhenry@microsoft.com)
- *
- * (C) 2002-2011 Novell, Inc.
- * Copyright 2011 Xamarin Inc
- * Licensed under the MIT license. See LICENSE file in the project root for full license information.
- */
-
-#include <config.h>
-
-#if !defined(HOST_WIN32)
-
-#include <glib.h>
-#include <pthread.h>
-#include <errno.h>
-#include <unistd.h>
-#ifdef HAVE_SIGNAL_H
-#include <signal.h>
-#endif
-#include <string.h>
-#include <sys/types.h>
-#ifdef HAVE_SYS_SOCKET_H
-#  include <sys/socket.h>
-#endif
-#ifdef HAVE_SYS_UN_H
-#  include <sys/un.h>
-#endif
-#ifdef HAVE_SYS_MMAN_H
-#  include <sys/mman.h>
-#endif
-#ifdef HAVE_DIRENT_H
-#  include <dirent.h>
-#endif
-#include <sys/stat.h>
-#ifdef HAVE_SYS_RESOURCE_H
-#  include <sys/resource.h>
-#endif
-
-#include "w32handle.h"
-
-#include "atomic.h"
-#include "mono-logger-internals.h"
-#include "mono-os-mutex.h"
-#include "mono-proclib.h"
-#include "mono-threads.h"
-
-#undef DEBUG_REFS
-
-#define SLOT_MAX               (1024 * 16)
-
-/* must be a power of 2 */
-#define HANDLE_PER_SLOT        (256)
-
-typedef struct {
-       MonoW32HandleType type;
-       guint ref;
-       gboolean signalled;
-       mono_mutex_t signal_mutex;
-       mono_cond_t signal_cond;
-       gpointer specific;
-} MonoW32HandleBase;
-
-static MonoW32HandleCapability handle_caps [MONO_W32HANDLE_COUNT];
-static MonoW32HandleOps *handle_ops [MONO_W32HANDLE_COUNT];
-
-/*
- * We can hold SLOT_MAX * HANDLE_PER_SLOT handles.
- * If 4M handles are not enough... Oh, well... we will crash.
- */
-#define SLOT_INDEX(x)  (x / HANDLE_PER_SLOT)
-#define SLOT_OFFSET(x) (x % HANDLE_PER_SLOT)
-
-static MonoW32HandleBase *private_handles [SLOT_MAX];
-static guint32 private_handles_count = 0;
-static guint32 private_handles_slots_count = 0;
-
-guint32 mono_w32handle_fd_reserve;
-
-/*
- * This is an internal handle which is used for handling waiting for multiple handles.
- * Threads which wait for multiple handles wait on this one handle, and when a handle
- * is signalled, this handle is signalled too.
- */
-static mono_mutex_t global_signal_mutex;
-static mono_cond_t global_signal_cond;
-
-static mono_mutex_t scan_mutex;
-
-static gboolean shutting_down = FALSE;
-
-static gboolean
-type_is_fd (MonoW32HandleType type)
-{
-       switch (type) {
-       case MONO_W32HANDLE_FILE:
-       case MONO_W32HANDLE_CONSOLE:
-       case MONO_W32HANDLE_SOCKET:
-       case MONO_W32HANDLE_PIPE:
-               return TRUE;
-       default:
-               return FALSE;
-       }
-}
-
-static gboolean
-mono_w32handle_lookup_data (gpointer handle, MonoW32HandleBase **handle_data)
-{
-       gsize index, offset;
-
-       g_assert (handle_data);
-
-       index = SLOT_INDEX ((gsize) handle);
-       if (index >= SLOT_MAX)
-               return FALSE;
-       if (!private_handles [index])
-               return FALSE;
-
-       offset = SLOT_OFFSET ((gsize) handle);
-       if (private_handles [index][offset].type == MONO_W32HANDLE_UNUSED)
-               return FALSE;
-
-       *handle_data = &private_handles [index][offset];
-       return TRUE;
-}
-
-MonoW32HandleType
-mono_w32handle_get_type (gpointer handle)
-{
-       MonoW32HandleBase *handle_data;
-
-       if (!mono_w32handle_lookup_data (handle, &handle_data))
-               return MONO_W32HANDLE_UNUSED;   /* An impossible type */
-
-       return handle_data->type;
-}
-
-void
-mono_w32handle_set_signal_state (gpointer handle, gboolean state, gboolean broadcast)
-{
-       MonoW32HandleBase *handle_data;
-
-       if (!mono_w32handle_lookup_data (handle, &handle_data)) {
-               return;
-       }
-
-#ifdef DEBUG
-       g_message ("%s: setting state of %p to %s (broadcast %s)", __func__,
-                  handle, state?"TRUE":"FALSE", broadcast?"TRUE":"FALSE");
-#endif
-
-       if (state == TRUE) {
-               /* Tell everyone blocking on a single handle */
-
-               /* The condition the global signal cond is waiting on is the signalling of
-                * _any_ handle. So lock it before setting the signalled state.
-                */
-               mono_os_mutex_lock (&global_signal_mutex);
-
-               /* This function _must_ be called with
-                * handle->signal_mutex locked
-                */
-               handle_data->signalled=state;
-
-               if (broadcast == TRUE) {
-                       mono_os_cond_broadcast (&handle_data->signal_cond);
-               } else {
-                       mono_os_cond_signal (&handle_data->signal_cond);
-               }
-
-               /* Tell everyone blocking on multiple handles that something
-                * was signalled
-                */
-               mono_os_cond_broadcast (&global_signal_cond);
-
-               mono_os_mutex_unlock (&global_signal_mutex);
-       } else {
-               handle_data->signalled=state;
-       }
-}
-
-gboolean
-mono_w32handle_issignalled (gpointer handle)
-{
-       MonoW32HandleBase *handle_data;
-
-       if (!mono_w32handle_lookup_data (handle, &handle_data)) {
-               return(FALSE);
-       }
-
-       return handle_data->signalled;
-}
-
-int
-mono_w32handle_lock_signal_mutex (void)
-{
-#ifdef DEBUG
-       g_message ("%s: lock global signal mutex", __func__);
-#endif
-
-       mono_os_mutex_lock (&global_signal_mutex);
-
-       return 0;
-}
-
-int
-mono_w32handle_unlock_signal_mutex (void)
-{
-#ifdef DEBUG
-       g_message ("%s: unlock global signal mutex", __func__);
-#endif
-
-       mono_os_mutex_unlock (&global_signal_mutex);
-
-       return 0;
-}
-
-int
-mono_w32handle_lock_handle (gpointer handle)
-{
-       MonoW32HandleBase *handle_data;
-
-#ifdef DEBUG
-       g_message ("%s: locking handle %p", __func__, handle);
-#endif
-
-       if (!mono_w32handle_lookup_data (handle, &handle_data)) {
-               return(0);
-       }
-
-       mono_w32handle_ref (handle);
-
-       mono_os_mutex_lock (&handle_data->signal_mutex);
-
-       return 0;
-}
-
-int
-mono_w32handle_trylock_handle (gpointer handle)
-{
-       MonoW32HandleBase *handle_data;
-       int ret;
-
-#ifdef DEBUG
-       g_message ("%s: locking handle %p", __func__, handle);
-#endif
-
-       if (!mono_w32handle_lookup_data (handle, &handle_data)) {
-               return(0);
-       }
-
-       mono_w32handle_ref (handle);
-
-       ret = mono_os_mutex_trylock (&handle_data->signal_mutex);
-       if (ret != 0) {
-               mono_w32handle_unref (handle);
-       }
-
-       return(ret);
-}
-
-int
-mono_w32handle_unlock_handle (gpointer handle)
-{
-       MonoW32HandleBase *handle_data;
-
-#ifdef DEBUG
-       g_message ("%s: unlocking handle %p", __func__, handle);
-#endif
-
-       if (!mono_w32handle_lookup_data (handle, &handle_data)) {
-               return(0);
-       }
-
-       mono_os_mutex_unlock (&handle_data->signal_mutex);
-
-       mono_w32handle_unref (handle);
-
-       return 0;
-}
-
-/*
- * wapi_init:
- *
- *   Initialize the io-layer.
- */
-void
-mono_w32handle_init (void)
-{
-       g_assert ((sizeof (handle_ops) / sizeof (handle_ops[0]))
-                 == MONO_W32HANDLE_COUNT);
-
-       /* This is needed by the code in mono_w32handle_new_internal */
-       mono_w32handle_fd_reserve = (eg_getdtablesize () + (HANDLE_PER_SLOT - 1)) & ~(HANDLE_PER_SLOT - 1);
-
-       do {
-               /*
-                * The entries in private_handles reserved for fds are allocated lazily to
-                * save memory.
-                */
-
-               private_handles_count += HANDLE_PER_SLOT;
-               private_handles_slots_count ++;
-       } while(mono_w32handle_fd_reserve > private_handles_count);
-
-       mono_os_mutex_init (&scan_mutex);
-
-       mono_os_cond_init (&global_signal_cond);
-       mono_os_mutex_init (&global_signal_mutex);
-}
-
-static void mono_w32handle_unref_full (gpointer handle, gboolean ignore_private_busy_handles);
-
-void
-mono_w32handle_cleanup (void)
-{
-       int i, j, k;
-
-       g_assert (!shutting_down);
-       shutting_down = TRUE;
-
-       /* Every shared handle we were using ought really to be closed
-        * by now, but to make sure just blow them all away.  The
-        * exiting finalizer thread in particular races us to the
-        * program exit and doesn't always win, so it can be left
-        * cluttering up the shared file.  Anything else left over is
-        * really a bug.
-        */
-       for(i = SLOT_INDEX (0); private_handles[i] != NULL; i++) {
-               for(j = SLOT_OFFSET (0); j < HANDLE_PER_SLOT; j++) {
-                       MonoW32HandleBase *handle_data = &private_handles[i][j];
-                       gpointer handle = GINT_TO_POINTER (i*HANDLE_PER_SLOT+j);
-
-                       for(k = handle_data->ref; k > 0; k--) {
-                               mono_w32handle_unref_full (handle, TRUE);
-                       }
-               }
-       }
-
-       for (i = 0; i < SLOT_MAX; ++i)
-               g_free (private_handles [i]);
-}
-
-static void mono_w32handle_init_handle (MonoW32HandleBase *handle,
-                              MonoW32HandleType type, gpointer handle_specific)
-{
-       g_assert (!shutting_down);
-       
-       handle->type = type;
-       handle->signalled = FALSE;
-       handle->ref = 1;
-
-       mono_os_cond_init (&handle->signal_cond);
-       mono_os_mutex_init (&handle->signal_mutex);
-
-       if (handle_specific)
-               handle->specific = g_memdup (handle_specific, mono_w32handle_ops_typesize (type));
-}
-
-/*
- * mono_w32handle_new_internal:
- * @type: Init handle to this type
- *
- * Search for a free handle and initialize it. Return the handle on
- * success and 0 on failure.  This is only called from
- * mono_w32handle_new, and scan_mutex must be held.
- */
-static guint32 mono_w32handle_new_internal (MonoW32HandleType type,
-                                         gpointer handle_specific)
-{
-       guint32 i, k, count;
-       static guint32 last = 0;
-       gboolean retry = FALSE;
-       
-       g_assert (!shutting_down);
-       
-       /* A linear scan should be fast enough.  Start from the last
-        * allocation, assuming that handles are allocated more often
-        * than they're freed. Leave the space reserved for file
-        * descriptors
-        */
-
-       if (last < mono_w32handle_fd_reserve) {
-               last = mono_w32handle_fd_reserve;
-       } else {
-               retry = TRUE;
-       }
-
-again:
-       count = last;
-       for(i = SLOT_INDEX (count); i < private_handles_slots_count; i++) {
-               if (private_handles [i]) {
-                       for (k = SLOT_OFFSET (count); k < HANDLE_PER_SLOT; k++) {
-                               MonoW32HandleBase *handle = &private_handles [i][k];
-
-                               if(handle->type == MONO_W32HANDLE_UNUSED) {
-                                       last = count + 1;
-
-                                       mono_w32handle_init_handle (handle, type, handle_specific);
-                                       return (count);
-                               }
-                               count++;
-                       }
-               }
-       }
-
-       if(retry && last > mono_w32handle_fd_reserve) {
-               /* Try again from the beginning */
-               last = mono_w32handle_fd_reserve;
-               goto again;
-       }
-
-       /* Will need to expand the array.  The caller will sort it out */
-
-       return(0);
-}
-
-gpointer
-mono_w32handle_new (MonoW32HandleType type, gpointer handle_specific)
-{
-       guint32 handle_idx = 0;
-       gpointer handle;
-
-       g_assert (!shutting_down);
-
-       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_W32HANDLE, "%s: Creating new handle of type %s", __func__,
-                  mono_w32handle_ops_typename (type));
-
-       g_assert(!type_is_fd(type));
-
-       mono_os_mutex_lock (&scan_mutex);
-
-       while ((handle_idx = mono_w32handle_new_internal (type, handle_specific)) == 0) {
-               /* Try and expand the array, and have another go */
-               int idx = SLOT_INDEX (private_handles_count);
-               if (idx >= SLOT_MAX) {
-                       break;
-               }
-
-               private_handles [idx] = g_new0 (MonoW32HandleBase, HANDLE_PER_SLOT);
-
-               private_handles_count += HANDLE_PER_SLOT;
-               private_handles_slots_count ++;
-       }
-
-       mono_os_mutex_unlock (&scan_mutex);
-
-       if (handle_idx == 0) {
-               /* We ran out of slots */
-               handle = INVALID_HANDLE_VALUE;
-               goto done;
-       }
-
-       /* Make sure we left the space for fd mappings */
-       g_assert (handle_idx >= mono_w32handle_fd_reserve);
-
-       handle = GUINT_TO_POINTER (handle_idx);
-
-       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_W32HANDLE, "%s: Allocated new handle %p", __func__, handle);
-
-done:
-       return(handle);
-}
-
-gpointer mono_w32handle_new_fd (MonoW32HandleType type, int fd,
-                             gpointer handle_specific)
-{
-       MonoW32HandleBase *handle_data;
-       int fd_index, fd_offset;
-
-       g_assert (!shutting_down);
-
-       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_W32HANDLE, "%s: Creating new handle of type %s", __func__,
-                  mono_w32handle_ops_typename (type));
-
-       g_assert(type_is_fd(type));
-
-       if (fd >= mono_w32handle_fd_reserve) {
-               mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_W32HANDLE, "%s: fd %d is too big", __func__, fd);
-
-               return(GUINT_TO_POINTER (INVALID_HANDLE_VALUE));
-       }
-
-       fd_index = SLOT_INDEX (fd);
-       fd_offset = SLOT_OFFSET (fd);
-
-       /* Initialize the array entries on demand */
-       if (!private_handles [fd_index]) {
-               mono_os_mutex_lock (&scan_mutex);
-
-               if (!private_handles [fd_index])
-                       private_handles [fd_index] = g_new0 (MonoW32HandleBase, HANDLE_PER_SLOT);
-
-               mono_os_mutex_unlock (&scan_mutex);
-       }
-
-       handle_data = &private_handles [fd_index][fd_offset];
-
-       if (handle_data->type != MONO_W32HANDLE_UNUSED) {
-               mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_W32HANDLE, "%s: fd %d is already in use!", __func__, fd);
-               /* FIXME: clean up this handle?  We can't do anything
-                * with the fd, cos thats the new one
-                */
-       }
-
-       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_W32HANDLE, "%s: Assigning new fd handle %p", __func__, (gpointer)(gsize)fd);
-
-       mono_w32handle_init_handle (handle_data, type, handle_specific);
-
-       return(GUINT_TO_POINTER(fd));
-}
-
-gboolean
-mono_w32handle_lookup (gpointer handle, MonoW32HandleType type,
-                             gpointer *handle_specific)
-{
-       MonoW32HandleBase *handle_data;
-
-       g_assert (handle_specific);
-
-       if (!mono_w32handle_lookup_data (handle, &handle_data)) {
-               return(FALSE);
-       }
-
-       if (handle_data->type != type) {
-               return(FALSE);
-       }
-
-       *handle_specific = handle_data->specific;
-
-       return(TRUE);
-}
-
-void
-mono_w32handle_foreach (gboolean (*on_each)(gpointer handle, gpointer data, gpointer user_data), gpointer user_data)
-{
-       MonoW32HandleBase *handle_data = NULL;
-       gpointer handle;
-       guint32 i, k;
-
-       mono_os_mutex_lock (&scan_mutex);
-
-       for (i = SLOT_INDEX (0); i < private_handles_slots_count; i++) {
-               if (private_handles [i]) {
-                       for (k = SLOT_OFFSET (0); k < HANDLE_PER_SLOT; k++) {
-                               handle_data = &private_handles [i][k];
-                               if (handle_data->type == MONO_W32HANDLE_UNUSED)
-                                       continue;
-                               handle = GUINT_TO_POINTER (i * HANDLE_PER_SLOT + k);
-                               if (on_each (handle, handle_data->specific, user_data) == TRUE)
-                                       goto done;
-                       }
-               }
-       }
-
-done:
-       mono_os_mutex_unlock (&scan_mutex);
-}
-
-/* This might list some shared handles twice if they are already
- * opened by this process, and the check function returns FALSE the
- * first time.  Shared handles that are created during the search are
- * unreffed if the check function returns FALSE, so callers must not
- * rely on the handle persisting (unless the check function returns
- * TRUE)
- * The caller owns the returned handle.
- */
-gpointer mono_w32handle_search (MonoW32HandleType type,
-                             gboolean (*check)(gpointer test, gpointer user),
-                             gpointer user_data,
-                             gpointer *handle_specific,
-                             gboolean search_shared)
-{
-       MonoW32HandleBase *handle_data = NULL;
-       gpointer ret = NULL;
-       guint32 i, k;
-       gboolean found = FALSE;
-
-       mono_os_mutex_lock (&scan_mutex);
-
-       for (i = SLOT_INDEX (0); !found && i < private_handles_slots_count; i++) {
-               if (private_handles [i]) {
-                       for (k = SLOT_OFFSET (0); k < HANDLE_PER_SLOT; k++) {
-                               handle_data = &private_handles [i][k];
-
-                               if (handle_data->type == type) {
-                                       ret = GUINT_TO_POINTER (i * HANDLE_PER_SLOT + k);
-                                       if (check (ret, user_data) == TRUE) {
-                                               mono_w32handle_ref (ret);
-                                               found = TRUE;
-                                               break;
-                                       }
-                               }
-                       }
-               }
-       }
-
-       mono_os_mutex_unlock (&scan_mutex);
-
-       if (!found) {
-               ret = NULL;
-               goto done;
-       }
-
-       if(handle_specific != NULL) {
-               *handle_specific = handle_data->specific;
-       }
-
-done:
-       return(ret);
-}
-
-void mono_w32handle_ref (gpointer handle)
-{
-       MonoW32HandleBase *handle_data;
-
-       if (!mono_w32handle_lookup_data (handle, &handle_data)) {
-               mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_W32HANDLE, "%s: Attempting to ref invalid private handle %p", __func__, handle);
-               return;
-       }
-
-       InterlockedIncrement ((gint32 *)&handle_data->ref);
-
-#ifdef DEBUG_REFS
-       g_message ("%s: %s handle %p ref now %d",
-               __func__, mono_w32handle_ops_typename (handle_data->type), handle, handle_data->ref);
-#endif
-}
-
-static void (*_wapi_handle_ops_get_close_func (MonoW32HandleType type))(gpointer, gpointer);
-
-/* The handle must not be locked on entry to this function */
-static void mono_w32handle_unref_full (gpointer handle, gboolean ignore_private_busy_handles)
-{
-       MonoW32HandleBase *handle_data;
-       gboolean destroy = FALSE, early_exit = FALSE;
-       int thr_ret;
-
-       if (!mono_w32handle_lookup_data (handle, &handle_data)) {
-               mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_W32HANDLE, "%s: Attempting to unref invalid private handle %p",
-                       __func__, handle);
-               return;
-       }
-
-       /* Possible race condition here if another thread refs the
-        * handle between here and setting the type to UNUSED.  I
-        * could lock a mutex, but I'm not sure that allowing a handle
-        * reference to reach 0 isn't an application bug anyway.
-        */
-       destroy = (InterlockedDecrement ((gint32 *)&handle_data->ref) ==0);
-
-#ifdef DEBUG_REFS
-       g_message ("%s: %s handle %p ref now %d (destroy %s)",
-               __func__, mono_w32handle_ops_typename (handle_data->type), handle, handle_data->ref, destroy?"TRUE":"FALSE");
-#endif
-
-       if(destroy==TRUE) {
-               /* Need to copy the handle info, reset the slot in the
-                * array, and _only then_ call the close function to
-                * avoid race conditions (eg file descriptors being
-                * closed, and another file being opened getting the
-                * same fd racing the memset())
-                */
-               MonoW32HandleType type;
-               gpointer handle_specific;
-               void (*close_func)(gpointer, gpointer);
-
-               type = handle_data->type;
-               handle_specific = handle_data->specific;
-
-               mono_os_mutex_lock (&scan_mutex);
-
-               mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_W32HANDLE, "%s: Destroying handle %p", __func__, handle);
-
-               /* Destroy the mutex and cond var.  We hope nobody
-                * tried to grab them between the handle unlock and
-                * now, but pthreads doesn't have a
-                * "unlock_and_destroy" atomic function.
-                */
-               thr_ret = mono_os_mutex_destroy (&handle_data->signal_mutex);
-               /*WARNING gross hack to make cleanup not crash when exiting without the whole runtime teardown.*/
-               if (thr_ret == EBUSY && ignore_private_busy_handles) {
-                       early_exit = TRUE;
-               } else {
-                       if (thr_ret != 0)
-                               g_error ("Error destroying handle %p mutex due to %d\n", handle, thr_ret);
-
-                       thr_ret = mono_os_cond_destroy (&handle_data->signal_cond);
-                       if (thr_ret == EBUSY && ignore_private_busy_handles)
-                               early_exit = TRUE;
-                       else if (thr_ret != 0)
-                               g_error ("Error destroying handle %p cond var due to %d\n", handle, thr_ret);
-               }
-
-               memset (handle_data, 0, sizeof (MonoW32HandleBase));
-
-               mono_os_mutex_unlock (&scan_mutex);
-
-               if (early_exit)
-                       return;
-
-               close_func = _wapi_handle_ops_get_close_func (type);
-               if (close_func != NULL) {
-                       close_func (handle, handle_specific);
-               }
-
-               g_free (handle_specific);
-       }
-}
-
-void mono_w32handle_unref (gpointer handle)
-{
-       mono_w32handle_unref_full (handle, FALSE);
-}
-
-void
-mono_w32handle_register_ops (MonoW32HandleType type, MonoW32HandleOps *ops)
-{
-       handle_ops [type] = ops;
-}
-
-void mono_w32handle_register_capabilities (MonoW32HandleType type,
-                                        MonoW32HandleCapability caps)
-{
-       handle_caps[type] = caps;
-}
-
-gboolean mono_w32handle_test_capabilities (gpointer handle,
-                                        MonoW32HandleCapability caps)
-{
-       MonoW32HandleBase *handle_data;
-       MonoW32HandleType type;
-
-       if (!mono_w32handle_lookup_data (handle, &handle_data)) {
-               return(FALSE);
-       }
-
-       type = handle_data->type;
-
-       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_W32HANDLE, "%s: testing 0x%x against 0x%x (%d)", __func__,
-                  handle_caps[type], caps, handle_caps[type] & caps);
-
-       return((handle_caps[type] & caps) != 0);
-}
-
-static void (*_wapi_handle_ops_get_close_func (MonoW32HandleType type))(gpointer, gpointer)
-{
-       if (handle_ops[type] != NULL &&
-           handle_ops[type]->close != NULL) {
-               return (handle_ops[type]->close);
-       }
-
-       return (NULL);
-}
-
-void mono_w32handle_ops_close (gpointer handle, gpointer data)
-{
-       MonoW32HandleBase *handle_data;
-       MonoW32HandleType type;
-
-       if (!mono_w32handle_lookup_data (handle, &handle_data)) {
-               return;
-       }
-
-       type = handle_data->type;
-
-       if (handle_ops[type] != NULL &&
-           handle_ops[type]->close != NULL) {
-               handle_ops[type]->close (handle, data);
-       }
-}
-
-void mono_w32handle_ops_details (MonoW32HandleType type, gpointer data)
-{
-       if (handle_ops[type] != NULL &&
-           handle_ops[type]->details != NULL) {
-               handle_ops[type]->details (data);
-       }
-}
-
-const gchar* mono_w32handle_ops_typename (MonoW32HandleType type)
-{
-       g_assert (handle_ops [type]);
-       g_assert (handle_ops [type]->typename);
-       return handle_ops [type]->typename ();
-}
-
-gsize mono_w32handle_ops_typesize (MonoW32HandleType type)
-{
-       g_assert (handle_ops [type]);
-       g_assert (handle_ops [type]->typesize);
-       return handle_ops [type]->typesize ();
-}
-
-void mono_w32handle_ops_signal (gpointer handle)
-{
-       MonoW32HandleBase *handle_data;
-       MonoW32HandleType type;
-
-       if (!mono_w32handle_lookup_data (handle, &handle_data)) {
-               return;
-       }
-
-       type = handle_data->type;
-
-       if (handle_ops[type] != NULL && handle_ops[type]->signal != NULL) {
-               handle_ops[type]->signal (handle);
-       }
-}
-
-gboolean mono_w32handle_ops_own (gpointer handle)
-{
-       MonoW32HandleBase *handle_data;
-       MonoW32HandleType type;
-
-       if (!mono_w32handle_lookup_data (handle, &handle_data)) {
-               return(FALSE);
-       }
-
-       type = handle_data->type;
-
-       if (handle_ops[type] != NULL && handle_ops[type]->own_handle != NULL) {
-               return(handle_ops[type]->own_handle (handle));
-       } else {
-               return(FALSE);
-       }
-}
-
-gboolean mono_w32handle_ops_isowned (gpointer handle)
-{
-       MonoW32HandleBase *handle_data;
-       MonoW32HandleType type;
-
-       if (!mono_w32handle_lookup_data (handle, &handle_data)) {
-               return(FALSE);
-       }
-
-       type = handle_data->type;
-
-       if (handle_ops[type] != NULL && handle_ops[type]->is_owned != NULL) {
-               return(handle_ops[type]->is_owned (handle));
-       } else {
-               return(FALSE);
-       }
-}
-
-guint32 mono_w32handle_ops_specialwait (gpointer handle, guint32 timeout, gboolean *alerted)
-{
-       MonoW32HandleBase *handle_data;
-       MonoW32HandleType type;
-
-       if (!mono_w32handle_lookup_data (handle, &handle_data)) {
-               return(WAIT_FAILED);
-       }
-
-       type = handle_data->type;
-
-       if (handle_ops[type] != NULL &&
-           handle_ops[type]->special_wait != NULL) {
-               return(handle_ops[type]->special_wait (handle, timeout, alerted));
-       } else {
-               return(WAIT_FAILED);
-       }
-}
-
-void mono_w32handle_ops_prewait (gpointer handle)
-{
-       MonoW32HandleBase *handle_data;
-       MonoW32HandleType type;
-
-       if (!mono_w32handle_lookup_data (handle, &handle_data)) {
-               return;
-       }
-
-       type = handle_data->type;
-
-       if (handle_ops[type] != NULL &&
-           handle_ops[type]->prewait != NULL) {
-               handle_ops[type]->prewait (handle);
-       }
-}
-
-static void
-spin (guint32 ms)
-{
-       struct timespec sleepytime;
-
-       g_assert (ms < 1000);
-
-       sleepytime.tv_sec = 0;
-       sleepytime.tv_nsec = ms * 1000000;
-       nanosleep (&sleepytime, NULL);
-}
-
-gboolean
-mono_w32handle_count_signalled_handles (guint32 numhandles, gpointer *handles,
-       gboolean waitall, guint32 *retcount, guint32 *lowest)
-{
-       guint32 count, i, iter=0;
-       gboolean ret;
-       int thr_ret;
-
-       /* Lock all the handles, with backoff */
-again:
-       for(i=0; i<numhandles; i++) {
-               gpointer handle = handles[i];
-
-               mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_W32HANDLE, "%s: attempting to lock %p", __func__, handle);
-
-               thr_ret = mono_w32handle_trylock_handle (handle);
-
-               if (thr_ret != 0) {
-                       /* Bummer */
-
-                       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_W32HANDLE, "%s: attempt failed for %p: %s", __func__,
-                                  handle, strerror (thr_ret));
-
-                       while (i--) {
-                               handle = handles[i];
-
-                               thr_ret = mono_w32handle_unlock_handle (handle);
-                               g_assert (thr_ret == 0);
-                       }
-
-                       /* If iter ever reaches 100 the nanosleep will
-                        * return EINVAL immediately, but we have a
-                        * design flaw if that happens.
-                        */
-                       iter++;
-                       if(iter==100) {
-                               g_warning ("%s: iteration overflow!",
-                                          __func__);
-                               iter=1;
-                       }
-
-                       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_W32HANDLE, "%s: Backing off for %d ms", __func__,
-                                  iter*10);
-                       spin (10 * iter);
-
-                       goto again;
-               }
-       }
-
-       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_W32HANDLE, "%s: Locked all handles", __func__);
-
-       count=0;
-       *lowest=numhandles;
-
-       for(i=0; i<numhandles; i++) {
-               gpointer handle = handles[i];
-
-               mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_W32HANDLE, "%s: Checking handle %p", __func__, handle);
-
-               if(((mono_w32handle_test_capabilities (handle, MONO_W32HANDLE_CAP_OWN)==TRUE) &&
-                   (mono_w32handle_ops_isowned (handle) == TRUE)) ||
-                  (mono_w32handle_issignalled (handle))) {
-                       count++;
-
-                       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_W32HANDLE, "%s: Handle %p signalled", __func__,
-                                  handle);
-                       if(*lowest>i) {
-                               *lowest=i;
-                       }
-               }
-       }
-
-       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_W32HANDLE, "%s: %d event handles signalled", __func__, count);
-
-       if ((waitall == TRUE && count == numhandles) ||
-           (waitall == FALSE && count > 0)) {
-               ret=TRUE;
-       } else {
-               ret=FALSE;
-       }
-
-       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_W32HANDLE, "%s: Returning %d", __func__, ret);
-
-       *retcount=count;
-
-       return(ret);
-}
-
-void mono_w32handle_unlock_handles (guint32 numhandles, gpointer *handles)
-{
-       guint32 i;
-       int thr_ret;
-
-       for(i=0; i<numhandles; i++) {
-               gpointer handle = handles[i];
-
-               mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_W32HANDLE, "%s: unlocking handle %p", __func__, handle);
-
-               thr_ret = mono_w32handle_unlock_handle (handle);
-               g_assert (thr_ret == 0);
-       }
-}
-
-static int
-mono_w32handle_timedwait_signal_naked (mono_cond_t *cond, mono_mutex_t *mutex, guint32 timeout, gboolean poll, gboolean *alerted)
-{
-       int res;
-
-       if (!poll) {
-               res = mono_os_cond_timedwait (cond, mutex, timeout);
-       } else {
-               /* This is needed when waiting for process handles */
-               if (!alerted) {
-                       /*
-                        * pthread_cond_(timed)wait() can return 0 even if the condition was not
-                        * signalled.  This happens at least on Darwin.  We surface this, i.e., we
-                        * get spurious wake-ups.
-                        *
-                        * http://pubs.opengroup.org/onlinepubs/007908775/xsh/pthread_cond_wait.html
-                        */
-                       res = mono_os_cond_timedwait (cond, mutex, timeout);
-               } else {
-                       if (timeout < 100) {
-                               /* Real timeout is less than 100ms time */
-                               res = mono_os_cond_timedwait (cond, mutex, timeout);
-                       } else {
-                               res = mono_os_cond_timedwait (cond, mutex, 100);
-
-                               /* Mask the fake timeout, this will cause
-                                * another poll if the cond was not really signaled
-                                */
-                               if (res == -1)
-                                       res = 0;
-                       }
-               }
-       }
-
-       return res;
-}
-
-static void
-signal_global (gpointer unused)
-{
-       /* If we reach here, then interrupt token is set to the flag value, which
-        * means that the target thread is either
-        * - before the first CAS in timedwait, which means it won't enter the wait.
-        * - it is after the first CAS, so it is already waiting, or it will enter
-        *    the wait, and it will be interrupted by the broadcast. */
-       mono_os_mutex_lock (&global_signal_mutex);
-       mono_os_cond_broadcast (&global_signal_cond);
-       mono_os_mutex_unlock (&global_signal_mutex);
-}
-
-int
-mono_w32handle_timedwait_signal (guint32 timeout, gboolean poll, gboolean *alerted)
-{
-       int res;
-
-       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_W32HANDLE, "%s: waiting for global", __func__);
-
-       if (alerted)
-               *alerted = FALSE;
-
-       if (alerted) {
-               mono_thread_info_install_interrupt (signal_global, NULL, alerted);
-               if (*alerted)
-                       return 0;
-       }
-
-       res = mono_w32handle_timedwait_signal_naked (&global_signal_cond, &global_signal_mutex, timeout, poll, alerted);
-
-       if (alerted)
-               mono_thread_info_uninstall_interrupt (alerted);
-
-       return res;
-}
-
-static void
-signal_handle_and_unref (gpointer handle)
-{
-       MonoW32HandleBase *handle_data;
-       mono_cond_t *cond;
-       mono_mutex_t *mutex;
-
-       if (!mono_w32handle_lookup_data (handle, &handle_data))
-               g_error ("cannot signal unknown handle %p", handle);
-
-       /* If we reach here, then interrupt token is set to the flag value, which
-        * means that the target thread is either
-        * - before the first CAS in timedwait, which means it won't enter the wait.
-        * - it is after the first CAS, so it is already waiting, or it will enter
-        *    the wait, and it will be interrupted by the broadcast. */
-       cond = &handle_data->signal_cond;
-       mutex = &handle_data->signal_mutex;
-
-       mono_os_mutex_lock (mutex);
-       mono_os_cond_broadcast (cond);
-       mono_os_mutex_unlock (mutex);
-
-       mono_w32handle_unref (handle);
-}
-
-int
-mono_w32handle_timedwait_signal_handle (gpointer handle, guint32 timeout, gboolean poll, gboolean *alerted)
-{
-       MonoW32HandleBase *handle_data;
-       int res;
-
-       if (!mono_w32handle_lookup_data (handle, &handle_data))
-               g_error ("cannot wait on unknown handle %p", handle);
-
-       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_W32HANDLE, "%s: waiting for %p (type %s)", __func__, handle,
-                  mono_w32handle_ops_typename (mono_w32handle_get_type (handle)));
-
-       if (alerted)
-               *alerted = FALSE;
-
-       if (alerted) {
-               mono_thread_info_install_interrupt (signal_handle_and_unref, handle, alerted);
-               if (*alerted)
-                       return 0;
-               mono_w32handle_ref (handle);
-       }
-
-       res = mono_w32handle_timedwait_signal_naked (&handle_data->signal_cond, &handle_data->signal_mutex, timeout, poll, alerted);
-
-       if (alerted) {
-               mono_thread_info_uninstall_interrupt (alerted);
-               if (!*alerted) {
-                       /* if it is alerted, then the handle is unref in the interrupt callback */
-                       mono_w32handle_unref (handle);
-               }
-       }
-
-       return res;
-}
-
-void mono_w32handle_dump (void)
-{
-       MonoW32HandleBase *handle_data;
-       guint32 i, k;
-
-       mono_os_mutex_lock (&scan_mutex);
-
-       for(i = SLOT_INDEX (0); i < private_handles_slots_count; i++) {
-               if (private_handles [i]) {
-                       for (k = SLOT_OFFSET (0); k < HANDLE_PER_SLOT; k++) {
-                               handle_data = &private_handles [i][k];
-
-                               if (handle_data->type == MONO_W32HANDLE_UNUSED) {
-                                       continue;
-                               }
-
-                               g_print ("%3x [%7s] %s %d ",
-                                                i * HANDLE_PER_SLOT + k,
-                                                mono_w32handle_ops_typename (handle_data->type),
-                                                handle_data->signalled?"Sg":"Un",
-                                                handle_data->ref);
-                               mono_w32handle_ops_details (handle_data->type, handle_data->specific);
-                               g_print ("\n");
-                       }
-               }
-       }
-
-       mono_os_mutex_unlock (&scan_mutex);
-}
-
-#endif /* !defined(HOST_WIN32) */
diff --git a/mono/utils/w32handle.h b/mono/utils/w32handle.h
deleted file mode 100644 (file)
index 0ba409f..0000000
+++ /dev/null
@@ -1,186 +0,0 @@
-
-#ifndef _MONO_UTILS_W32HANDLE_H_
-#define _MONO_UTILS_W32HANDLE_H_
-
-#include <config.h>
-
-#if !defined(HOST_WIN32)
-
-#include <glib.h>
-
-#define INVALID_HANDLE_VALUE (gpointer)-1
-
-typedef enum {
-       MONO_W32HANDLE_UNUSED = 0,
-       MONO_W32HANDLE_FILE,
-       MONO_W32HANDLE_CONSOLE,
-       MONO_W32HANDLE_THREAD,
-       MONO_W32HANDLE_SEM,
-       MONO_W32HANDLE_MUTEX,
-       MONO_W32HANDLE_EVENT,
-       MONO_W32HANDLE_SOCKET,
-       MONO_W32HANDLE_FIND,
-       MONO_W32HANDLE_PROCESS,
-       MONO_W32HANDLE_PIPE,
-       MONO_W32HANDLE_NAMEDMUTEX,
-       MONO_W32HANDLE_NAMEDSEM,
-       MONO_W32HANDLE_NAMEDEVENT,
-       MONO_W32HANDLE_COUNT
-} MonoW32HandleType;
-
-typedef struct 
-{
-       void (*close)(gpointer handle, gpointer data);
-
-       /* SignalObjectAndWait */
-       void (*signal)(gpointer signal);
-
-       /* Called by WaitForSingleObject and WaitForMultipleObjects,
-        * with the handle locked (shared handles aren't locked.)
-        * Returns TRUE if ownership was established, false otherwise.
-        */
-       gboolean (*own_handle)(gpointer handle);
-
-       /* Called by WaitForSingleObject and WaitForMultipleObjects, if the
-        * handle in question is "ownable" (ie mutexes), to see if the current
-        * thread already owns this handle
-        */
-       gboolean (*is_owned)(gpointer handle);
-
-       /* Called by WaitForSingleObject and WaitForMultipleObjects,
-        * if the handle in question needs a special wait function
-        * instead of using the normal handle signal mechanism.
-        * Returns the WaitForSingleObject return code.
-        */
-       guint32 (*special_wait)(gpointer handle, guint32 timeout, gboolean *alerted);
-
-       /* Called by WaitForSingleObject and WaitForMultipleObjects,
-        * if the handle in question needs some preprocessing before the
-        * signal wait.
-        */
-       void (*prewait)(gpointer handle);
-
-       /* Called when dumping the handles */
-       void (*details)(gpointer data);
-
-       /* Called to get the name of the handle type */
-       const gchar* (*typename) (void);
-
-       /* Called to get the size of the handle type */
-       gsize (*typesize) (void);
-} MonoW32HandleOps;
-
-typedef enum {
-       MONO_W32HANDLE_CAP_WAIT         = 0x01,
-       MONO_W32HANDLE_CAP_SIGNAL       = 0x02,
-       MONO_W32HANDLE_CAP_OWN          = 0x04,
-       MONO_W32HANDLE_CAP_SPECIAL_WAIT = 0x08,
-} MonoW32HandleCapability;
-
-extern guint32 mono_w32handle_fd_reserve;
-
-void
-mono_w32handle_init (void);
-
-void
-mono_w32handle_cleanup (void);
-
-void
-mono_w32handle_register_ops (MonoW32HandleType type, MonoW32HandleOps *ops);
-
-gpointer
-mono_w32handle_new (MonoW32HandleType type, gpointer handle_specific);
-
-gpointer
-mono_w32handle_new_fd (MonoW32HandleType type, int fd, gpointer handle_specific);
-
-MonoW32HandleType
-mono_w32handle_get_type (gpointer handle);
-
-gboolean
-mono_w32handle_lookup (gpointer handle, MonoW32HandleType type, gpointer *handle_specific);
-
-gpointer
-mono_w32handle_search (MonoW32HandleType type, gboolean (*check)(gpointer, gpointer), gpointer user_data, gpointer *handle_specific, gboolean search_shared);
-
-void
-mono_w32handle_foreach (gboolean (*on_each)(gpointer handle, gpointer data, gpointer user_data), gpointer user_data);
-
-void
-mono_w32handle_dump (void);
-
-void
-mono_w32handle_ref (gpointer handle);
-
-void
-mono_w32handle_unref (gpointer handle);
-
-void
-mono_w32handle_register_capabilities (MonoW32HandleType type, MonoW32HandleCapability caps);
-
-gboolean
-mono_w32handle_test_capabilities (gpointer handle, MonoW32HandleCapability caps);
-
-void
-mono_w32handle_ops_close (gpointer handle, gpointer data);
-
-void
-mono_w32handle_ops_signal (gpointer handle);
-
-gboolean
-mono_w32handle_ops_own (gpointer handle);
-
-gboolean
-mono_w32handle_ops_isowned (gpointer handle);
-
-guint32
-mono_w32handle_ops_specialwait (gpointer handle, guint32 timeout, gboolean *alerted);
-
-void
-mono_w32handle_ops_prewait (gpointer handle);
-
-void
-mono_w32handle_ops_details (MonoW32HandleType type, gpointer data);
-
-const gchar*
-mono_w32handle_ops_typename (MonoW32HandleType type);
-
-gsize
-mono_w32handle_ops_typesize (MonoW32HandleType type);
-
-gboolean
-mono_w32handle_count_signalled_handles (guint32 numhandles, gpointer *handles, gboolean waitall, guint32 *retcount, guint32 *lowest);
-
-void
-mono_w32handle_unlock_handles (guint32 numhandles, gpointer *handles);
-
-int
-mono_w32handle_timedwait_signal_handle (gpointer handle, guint32 timeout, gboolean poll, gboolean *alerted);
-
-int
-mono_w32handle_timedwait_signal (guint32 timeout, gboolean poll, gboolean *alerted);
-
-void
-mono_w32handle_set_signal_state (gpointer handle, gboolean state, gboolean broadcast);
-
-gboolean
-mono_w32handle_issignalled (gpointer handle);
-
-int
-mono_w32handle_lock_handle (gpointer handle);
-
-int
-mono_w32handle_trylock_handle (gpointer handle);
-
-int
-mono_w32handle_unlock_handle (gpointer handle);
-
-int
-mono_w32handle_lock_signal_mutex (void);
-
-int
-mono_w32handle_unlock_signal_mutex (void);
-
-#endif /* !defined(HOST_WIN32) */
-
-#endif /* _MONO_UTILS_W32HANDLE_H_ */
index 15984b6c059dfdabc3d03ba6f7f91df67ab3bc06..1ac7e077af462557f02a22fb47bf04a457638998 100644 (file)
@@ -13,13 +13,13 @@ ifdef RAX
 PUBLIC mono_context_get_current
 
 mono_context_get_current PROC
-;rdi has the ctx ptr
+;rcx has the ctx ptr
        mov [rcx + 00h], rax
-       mov [rcx + 08h], rbx
-       mov [rcx + 10h], rcx
-       mov [rcx + 18h], rdx
-       mov [rcx + 20h], rbp
-       mov [rcx + 28h], rsp
+       mov [rcx + 08h], rcx
+       mov [rcx + 10h], rdx
+       mov [rcx + 18h], rbx
+       mov [rcx + 20h], rsp
+       mov [rcx + 28h], rbp
        mov [rcx + 30h], rsi
        mov [rcx + 38h], rdi
        mov [rcx + 40h], r8
index 94a7127d7318cad19bd892a6f7e50eb800455856..98a8849ab35efb07f61a8c00374ca6cdce77dbe9 100644 (file)
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>\r
+<?xml version="1.0" encoding="utf-8"?>\r
 <Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <ItemGroup Label="ProjectConfigurations">\r
     <ProjectConfiguration Include="Debug|Win32">\r
     <ClCompile Include="..\eglib\src\gstr.c" />\r
     <ClCompile Include="..\eglib\src\gstring.c" />\r
     <ClCompile Include="..\eglib\src\gtimer-win32.c" />\r
+    <ClCompile Include="..\eglib\src\gunicode-win32.c" />\r
     <ClCompile Include="..\eglib\src\gunicode.c" />\r
     <ClCompile Include="..\eglib\src\gutf8.c" />\r
   </ItemGroup>\r
   <ItemGroup>\r
     <ClInclude Include="..\eglib\src\glib.h" />\r
+    <ClInclude Include="..\eglib\src\gmodule-win32-internals.h" />\r
     <ClInclude Include="..\eglib\src\gmodule.h" />\r
     <ClInclude Include="..\eglib\src\sort.frag.h" />\r
   </ItemGroup>\r
       <Project>{92ae7622-5f58-4234-9a26-9ec71876b3f4}</Project>\r
     </ProjectReference>\r
   </ItemGroup>\r
+  <ItemGroup>\r
+    <None Include="..\eglib\src\Makefile.am" />\r
+  </ItemGroup>\r
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />\r
   <ImportGroup Label="ExtensionTargets">\r
   </ImportGroup>\r
-</Project>\r
+</Project>
\ No newline at end of file
index 680ff1a9fd998f8e518d723e3d93cb9f68a901c4..f49e42ae1598c84abe46799a2e66114c1017bfa9 100644 (file)
@@ -88,7 +88,7 @@
     <ClCompile Include="..\eglib\src\gutf8.c">\r
       <Filter>Source Files</Filter>\r
     </ClCompile>\r
-    <ClCompile Include="..\eglib\src\vasprintf.c">\r
+    <ClCompile Include="..\eglib\src\gunicode-win32.c">\r
       <Filter>Source Files</Filter>\r
     </ClCompile>\r
   </ItemGroup>\r
     <ClInclude Include="..\eglib\src\sort.frag.h">\r
       <Filter>Header Files</Filter>\r
     </ClInclude>\r
+    <ClInclude Include="..\eglib\src\gmodule-win32-internals.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
   </ItemGroup>\r
   <ItemGroup>\r
     <Filter Include="Source Files">\r
       <UniqueIdentifier>{38a39ff1-842b-431b-b54b-24094e8283eb}</UniqueIdentifier>\r
     </Filter>\r
   </ItemGroup>\r
+  <ItemGroup>\r
+    <None Include="..\eglib\src\Makefile.am">\r
+      <Filter>Resource Files</Filter>\r
+    </None>\r
+  </ItemGroup>\r
 </Project>
\ No newline at end of file
index 52dd0baad9a24d0fbc87a2b336decb51bbe8216f..e0979dbbee07d46d915e1984a3d051cd16c388da 100644 (file)
@@ -20,7 +20,6 @@
   </ItemGroup>\r
   <ItemGroup>\r
     <ClCompile Include="..\mono\sgen\sgen-alloc.c" />\r
-    <ClCompile Include="..\mono\metadata\sgen-bridge.c" />\r
     <ClCompile Include="..\mono\sgen\sgen-array-list.c" />\r
     <ClCompile Include="..\mono\sgen\sgen-cardtable.c" />\r
     <ClCompile Include="..\mono\sgen\sgen-debug.c" />\r
index d40313b932436adff6a28bcfcf9f1a0623144223..b1c22545a6c7bdff143e26a4f54bf490bd33d539 100644 (file)
@@ -4,9 +4,6 @@
     <ClCompile Include="..\mono\sgen\sgen-alloc.c">\r
       <Filter>Source Files</Filter>\r
     </ClCompile>\r
-    <ClCompile Include="..\mono\metadata\sgen-bridge.c">\r
-      <Filter>Source Files</Filter>\r
-    </ClCompile>\r
     <ClCompile Include="..\mono\sgen\sgen-cardtable.c">\r
       <Filter>Source Files</Filter>\r
     </ClCompile>\r
index 66283179cfe3af2b78a5e7cbc167cef82b817279..b8ba2add1e26cb63a52cf948d3b12717f7d75910 100644 (file)
@@ -19,7 +19,6 @@
     </ProjectConfiguration>\r
   </ItemGroup>\r
   <ItemGroup>\r
-    <ClCompile Include="..\mono\metadata\remoting.c" />\r
     <ClCompile Include="..\mono\mini\alias-analysis.c" />\r
     <ClCompile Include="..\mono\mini\arch-stubs.c" />\r
     <ClCompile Include="..\mono\mini\exceptions-amd64.c">\r
@@ -61,6 +60,7 @@
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>\r
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>\r
     </ClInclude>\r
+    <ClInclude Include="..\mono\mini\mini-windows.h" />\r
     <ClInclude Include="..\mono\mini\mini-x86.h">\r
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>\r
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>\r
       <Project>{8fc2b0c8-51ad-49df-851f-5d01a77a75e4}</Project>\r
     </ProjectReference>\r
   </ItemGroup>\r
+  <ItemGroup>\r
+    <None Include="..\mono\mini\Makefile.am.in" />\r
+  </ItemGroup>\r
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />\r
   <ImportGroup Label="ExtensionTargets">\r
   </ImportGroup>\r
index 75748b858bebbf78297ef860fe58601862bad323..77099bed2f10b87c0f4fcfd21ac3839069c5e2a6 100644 (file)
     <ClCompile Include="..\mono\mini\mini-x86.c">\r
       <Filter>Source Files</Filter>\r
     </ClCompile>\r
-    <ClCompile Include="..\mono\metadata\remoting.c">\r
-      <Filter>Source Files</Filter>\r
-    </ClCompile>\r
     <ClCompile Include="..\mono\mini\seq-points.c">\r
       <Filter>Source Files</Filter>\r
     </ClCompile>\r
     <ClInclude Include="..\mono\mini\mini-amd64-gsharedvt.h">\r
       <Filter>Header Files</Filter>\r
     </ClInclude>\r
+    <ClInclude Include="..\mono\mini\mini-windows.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
   </ItemGroup>\r
   <ItemGroup>\r
     <Filter Include="Header Files">\r
       <UniqueIdentifier>{5370c3c4-b6ec-4f8a-8b21-ce4e782720a6}</UniqueIdentifier>\r
     </Filter>\r
   </ItemGroup>\r
+  <ItemGroup>\r
+    <None Include="..\mono\mini\Makefile.am.in">\r
+      <Filter>Resource Files</Filter>\r
+    </None>\r
+  </ItemGroup>\r
 </Project>
\ No newline at end of file
index 3acce45d4bbc5356b29c7993c7e5c5bef8f58108..82eff3379b65384685a22c13a1ffa58426c62d70 100644 (file)
       <LinkLibraryDependencies>true</LinkLibraryDependencies>\r
     </ProjectReference>\r
     <Link>\r
-      <AdditionalDependencies>eglib.lib;libmonoutils.lib;libmonoruntime$(MONO_TARGET_SUFFIX).lib;libmono-static$(MONO_TARGET_SUFFIX).lib;$(GC_LIB);%(AdditionalDependencies)</AdditionalDependencies>\r
+      <AdditionalDependencies>eglib.lib;$(MONO_STATIC_LIBMONO_LIB);%(AdditionalDependencies)</AdditionalDependencies>\r
       <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\r
       <ModuleDefinitionFile>$(MONO_DEF)</ModuleDefinitionFile>\r
       <GenerateDebugInformation>true</GenerateDebugInformation>\r
       <LinkLibraryDependencies>true</LinkLibraryDependencies>\r
     </ProjectReference>\r
     <Link>\r
-      <AdditionalDependencies>eglib.lib;libmonoutils.lib;libmonoruntime$(MONO_TARGET_SUFFIX).lib;libmono-static$(MONO_TARGET_SUFFIX).lib;$(GC_LIB);%(AdditionalDependencies)</AdditionalDependencies>\r
+      <AdditionalDependencies>eglib.lib;$(MONO_STATIC_LIBMONO_LIB);%(AdditionalDependencies)</AdditionalDependencies>\r
       <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\r
       <ModuleDefinitionFile>$(MONO_DEF)</ModuleDefinitionFile>\r
       <GenerateDebugInformation>true</GenerateDebugInformation>\r
       <LinkLibraryDependencies>true</LinkLibraryDependencies>\r
     </ProjectReference>\r
     <Link>\r
-      <AdditionalDependencies>eglib.lib;libmonoutils.lib;libmonoruntime$(MONO_TARGET_SUFFIX).lib;libmono-static$(MONO_TARGET_SUFFIX).lib;$(GC_LIB);%(AdditionalDependencies)</AdditionalDependencies>\r
+      <AdditionalDependencies>eglib.lib;$(MONO_STATIC_LIBMONO_LIB);%(AdditionalDependencies)</AdditionalDependencies>\r
       <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\r
       <ModuleDefinitionFile>$(MONO_DEF)</ModuleDefinitionFile>\r
       <RandomizedBaseAddress>false</RandomizedBaseAddress>\r
       <LinkLibraryDependencies>true</LinkLibraryDependencies>\r
     </ProjectReference>\r
     <Link>\r
-      <AdditionalDependencies>eglib.lib;libmonoutils.lib;libmonoruntime$(MONO_TARGET_SUFFIX).lib;libmono-static$(MONO_TARGET_SUFFIX).lib;$(GC_LIB);%(AdditionalDependencies)</AdditionalDependencies>\r
+      <AdditionalDependencies>eglib.lib;$(MONO_STATIC_LIBMONO_LIB);%(AdditionalDependencies)</AdditionalDependencies>\r
       <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\r
       <ModuleDefinitionFile>$(MONO_DEF)</ModuleDefinitionFile>\r
       <ImportLibrary>$(MONO_BUILD_DIR_PREFIX)$(Platform)\lib\$(Configuration)\$(TargetName).lib</ImportLibrary>\r
       <Project>{8fc2b0c8-51ad-49df-851f-5d01a77a75e4}</Project>\r
     </ProjectReference>\r
   </ItemGroup>\r
+  <ItemGroup>\r
+    <ClCompile Include="..\mono\mini\mini-windows-dllmain.c" />\r
+  </ItemGroup>\r
+  <ItemGroup>\r
+    <None Include="mono.def" />\r
+  </ItemGroup>\r
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />\r
   <ImportGroup Label="ExtensionTargets">\r
   </ImportGroup>\r
index 0d407ea4f940edc25a0d364ff323a36f41c96cb9..91861b6cc1dc725ce34082e0fd3feaa8aea7d309 100644 (file)
       <UniqueIdentifier>{5370c3c4-b6ec-4f8a-8b21-ce4e782720a6}</UniqueIdentifier>\r
     </Filter>\r
   </ItemGroup>\r
+  <ItemGroup>\r
+    <ClCompile Include="..\mono\mini\mini-windows-dllmain.c">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+  </ItemGroup>\r
+  <ItemGroup>\r
+    <None Include="mono.def">\r
+      <Filter>Resource Files</Filter>\r
+    </None>\r
+  </ItemGroup>\r
 </Project>
\ No newline at end of file
index d0c79d0f0a4e2d66cd6335238edaae8736756357..762947af907c7144679b385094aa5574ac0cdde7 100644 (file)
     <ClCompile Include="..\mono\metadata\assembly.c" />\r
     <ClCompile Include="..\mono\metadata\attach.c" />\r
     <ClCompile Include="..\mono\metadata\boehm-gc.c" />\r
+    <ClCompile Include="..\mono\metadata\class-accessors.c" />\r
     <ClCompile Include="..\mono\metadata\class.c" />\r
     <ClCompile Include="..\mono\metadata\cominterop.c" />\r
     <ClCompile Include="..\mono\metadata\console-win32.c" />\r
+    <ClCompile Include="..\mono\metadata\property-bag.c" />\r
+    <ClCompile Include="..\mono\metadata\socket-io-windows.c" />\r
+    <ClCompile Include="..\mono\metadata\file-io-windows.c" />\r
+    <ClCompile Include="..\mono\metadata\icall-windows.c" />\r
+    <ClCompile Include="..\mono\metadata\marshal-windows.c" />\r
+    <ClCompile Include="..\mono\metadata\mono-security-windows.c" />\r
+    <ClCompile Include="..\mono\metadata\w32mutex-win32.c" />\r
+    <ClCompile Include="..\mono\metadata\w32semaphore-win32.c" />\r
+    <ClCompile Include="..\mono\metadata\w32event-win32.c" />\r
+    <ClCompile Include="..\mono\metadata\w32process.c" />\r
+    <ClCompile Include="..\mono\metadata\w32process-win32.c" />\r
     <ClCompile Include="..\mono\metadata\coree.c" />\r
+    <ClCompile Include="..\mono\metadata\custom-attrs.c" />\r
     <ClCompile Include="..\mono\metadata\debug-helpers.c" />\r
     <ClCompile Include="..\mono\metadata\debug-mono-ppdb.c" />\r
     <ClCompile Include="..\mono\metadata\debug-mono-symfile.c" />\r
     <ClCompile Include="..\mono\metadata\decimal-ms.c" />\r
+    <ClCompile Include="..\mono\metadata\dynamic-image.c" />\r
+    <ClCompile Include="..\mono\metadata\dynamic-stream.c" />\r
     <ClCompile Include="..\mono\metadata\domain.c" />\r
     <ClCompile Include="..\mono\metadata\environment.c" />\r
     <ClCompile Include="..\mono\metadata\exception.c" />\r
@@ -66,7 +81,6 @@
     <ClCompile Include="..\mono\metadata\number-ms.c" />\r
     <ClCompile Include="..\mono\metadata\object.c" />\r
     <ClCompile Include="..\mono\metadata\opcodes.c" />\r
-    <ClCompile Include="..\mono\metadata\process.c" />\r
     <ClCompile Include="..\mono\metadata\profiler.c" />\r
     <ClCompile Include="..\mono\metadata\rand.c" />\r
     <ClCompile Include="..\mono\metadata\reflection.c" />\r
     <ClCompile Include="..\mono\metadata\sgen-bridge.c" />\r
     <ClCompile Include="..\mono\metadata\sgen-new-bridge.c" />\r
     <ClCompile Include="..\mono\metadata\sgen-old-bridge.c" />\r
-    <ClCompile Include="..\mono\metadata\sgen-os-mach.c">\r
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>\r
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>\r
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>\r
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>\r
-    </ClCompile>\r
-    <ClCompile Include="..\mono\metadata\sgen-os-posix.c">\r
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>\r
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>\r
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>\r
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>\r
-    </ClCompile>\r
-    <ClCompile Include="..\mono\metadata\sgen-os-win32.c" />\r
     <ClCompile Include="..\mono\metadata\sgen-tarjan-bridge.c" />\r
     <ClCompile Include="..\mono\metadata\sgen-toggleref.c" />\r
     <ClCompile Include="..\mono\metadata\sgen-stw.c" />\r
     <ClCompile Include="..\mono\metadata\socket-io.c" />\r
+    <ClCompile Include="..\mono\metadata\sre.c" />\r
+    <ClCompile Include="..\mono\metadata\sre-encode.c" />\r
+    <ClCompile Include="..\mono\metadata\sre-save.c" />\r
     <ClCompile Include="..\mono\metadata\string-icalls.c" />\r
     <ClCompile Include="..\mono\metadata\sysmath.c" />\r
     <ClCompile Include="..\mono\metadata\threads.c" />\r
     <ClInclude Include="..\mono\metadata\class.h" />\r
     <ClInclude Include="..\mono\metadata\cominterop.h" />\r
     <ClInclude Include="..\mono\metadata\console-io.h" />\r
+    <ClInclude Include="..\mono\metadata\console-win32-internals.h" />\r
+    <ClInclude Include="..\mono\metadata\coree-internals.h" />\r
     <ClInclude Include="..\mono\metadata\coree.h" />\r
     <ClInclude Include="..\mono\metadata\culture-info-tables.h" />\r
     <ClInclude Include="..\mono\metadata\culture-info.h" />\r
+    <ClInclude Include="..\mono\metadata\custom-attrs-internals.h" />\r
     <ClInclude Include="..\mono\metadata\debug-helpers.h" />\r
     <ClInclude Include="..\mono\metadata\debug-mono-ppdb.h" />\r
     <ClInclude Include="..\mono\metadata\debug-mono-symfile.h" />\r
     <ClInclude Include="..\mono\metadata\domain-internals.h" />\r
+    <ClInclude Include="..\mono\metadata\dynamic-image-internals.h" />\r
+    <ClInclude Include="..\mono\metadata\dynamic-stream-internals.h" />\r
     <ClInclude Include="..\mono\metadata\environment.h" />\r
     <ClInclude Include="..\mono\metadata\exception.h" />\r
+    <ClInclude Include="..\mono\metadata\file-io-internals.h" />\r
+    <ClInclude Include="..\mono\metadata\file-io-windows-internals.h" />\r
     <ClInclude Include="..\mono\metadata\file-io.h" />\r
     <ClInclude Include="..\mono\metadata\filewatcher.h" />\r
     <ClInclude Include="..\mono\metadata\gc-internals.h" />\r
     <ClInclude Include="..\mono\metadata\handle.h" />\r
+    <ClInclude Include="..\mono\metadata\icall-windows-internals.h" />\r
+    <ClInclude Include="..\mono\metadata\icall-internals.h" />\r
+    <ClInclude Include="..\mono\metadata\marshal-internals.h" />\r
+    <ClInclude Include="..\mono\metadata\marshal-windows-internals.h" />\r
+    <ClInclude Include="..\mono\metadata\mono-security-windows-internals.h" />\r
     <ClInclude Include="..\mono\metadata\number-ms.h" />\r
+    <ClInclude Include="..\mono\metadata\property-bag.h" />\r
+    <ClInclude Include="..\mono\metadata\w32process.h" />\r
+    <ClInclude Include="..\mono\metadata\w32process-internals.h" />\r
+    <ClInclude Include="..\mono\metadata\w32process-win32-internals.h" />\r
     <ClInclude Include="..\mono\metadata\remoting.h" />\r
     <ClInclude Include="..\mono\metadata\seq-points-data.h" />\r
     <ClInclude Include="..\mono\metadata\sgen-bridge-internals.h" />\r
     <ClInclude Include="..\mono\metadata\sgen-client-mono.h" />\r
+    <ClInclude Include="..\mono\metadata\socket-io-windows-internals.h" />\r
     <ClInclude Include="..\mono\metadata\threadpool-ms-io.h" />\r
     <ClInclude Include="..\mono\metadata\threadpool-ms.h" />\r
     <ClInclude Include="..\mono\sgen\gc-internal-agnostic.h" />\r
     <ClInclude Include="..\mono\metadata\object-internals.h" />\r
     <ClInclude Include="..\mono\metadata\object.h" />\r
     <ClInclude Include="..\mono\metadata\opcodes.h" />\r
-    <ClInclude Include="..\mono\metadata\process.h" />\r
     <ClInclude Include="..\mono\metadata\profiler-private.h" />\r
     <ClInclude Include="..\mono\metadata\profiler.h" />\r
     <ClInclude Include="..\mono\metadata\rand.h" />\r
     <ClInclude Include="..\mono\metadata\reflection.h" />\r
+    <ClInclude Include="..\mono\metadata\reflection-cache.h" />\r
+    <ClInclude Include="..\mono\metadata\reflection-internals.h" />\r
     <ClInclude Include="..\mono\metadata\runtime.h" />\r
     <ClInclude Include="..\mono\metadata\security-core-clr.h" />\r
     <ClInclude Include="..\mono\metadata\security-manager.h" />\r
     <ClInclude Include="..\mono\metadata\sgen-bridge.h" />\r
     <ClInclude Include="..\mono\metadata\sgen-toggleref.h" />\r
     <ClInclude Include="..\mono\metadata\socket-io.h" />\r
+    <ClInclude Include="..\mono\metadata\sre-internals.h" />\r
     <ClInclude Include="..\mono\metadata\string-icalls.h" />\r
     <ClInclude Include="..\mono\metadata\sysmath.h" />\r
     <ClInclude Include="..\mono\metadata\tabledefs.h" />\r
       <Project>{158073ed-99ae-4196-9edc-ddb2344f8466}</Project>\r
     </ProjectReference>\r
   </ItemGroup>\r
+  <ItemGroup>\r
+    <None Include="..\mono\metadata\Makefile.am" />\r
+  </ItemGroup>\r
   <PropertyGroup Label="Globals">\r
     <ProjectGuid>{C36612BD-22D3-4B95-85E2-7FDC4FC5D739}</ProjectGuid>\r
     <Keyword>Win32Proj</Keyword>\r
index e7d4b4110f5afa7abcbf9ed4fa9876ae1a803193..d36472937a11002b372216ac0db1d035b0d1d18b 100644 (file)
     <ClCompile Include="..\mono\metadata\console-win32.c">\r
       <Filter>Source Files</Filter>\r
     </ClCompile>\r
+    <ClCompile Include="..\mono\metadata\w32mutex-win32.c">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\mono\metadata\w32semaphore-win32.c">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\mono\metadata\w32event-win32.c">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
     <ClCompile Include="..\mono\metadata\coree.c">\r
       <Filter>Source Files</Filter>\r
     </ClCompile>\r
     <ClCompile Include="..\mono\metadata\opcodes.c">\r
       <Filter>Source Files</Filter>\r
     </ClCompile>\r
-    <ClCompile Include="..\mono\metadata\process.c">\r
+    <ClCompile Include="..\mono\metadata\w32process.c">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\mono\metadata\w32process-win32.c">\r
       <Filter>Source Files</Filter>\r
     </ClCompile>\r
     <ClCompile Include="..\mono\metadata\profiler.c">\r
     <ClCompile Include="..\mono\metadata\boehm-gc.c">\r
       <Filter>Source Files\boehm</Filter>\r
     </ClCompile>\r
-    <ClCompile Include="..\mono\metadata\sgen-os-mach.c">\r
-      <Filter>Source Files\sgen</Filter>\r
-    </ClCompile>\r
-    <ClCompile Include="..\mono\metadata\sgen-os-posix.c">\r
-      <Filter>Source Files\sgen</Filter>\r
-    </ClCompile>\r
-    <ClCompile Include="..\mono\metadata\sgen-os-win32.c">\r
-      <Filter>Source Files\sgen</Filter>\r
-    </ClCompile>\r
     <ClCompile Include="..\mono\metadata\appdomain.c">\r
       <Filter>Source Files\gc</Filter>\r
     </ClCompile>\r
     <ClCompile Include="..\mono\metadata\metadata-cross-helpers.c">\r
       <Filter>Source Files</Filter>\r
     </ClCompile>\r
+    <ClCompile Include="..\mono\metadata\custom-attrs.c">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\mono\metadata\dynamic-image.c">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\mono\metadata\dynamic-stream.c">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\mono\metadata\sre.c">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\mono\metadata\sre-encode.c">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\mono\metadata\sre-save.c">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\mono\metadata\socket-io-windows.c">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\mono\metadata\file-io-windows.c">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\mono\metadata\icall-windows.c">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\mono\metadata\marshal-windows.c">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\mono\metadata\mono-security-windows.c">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\mono\metadata\class-accessors.c">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\mono\metadata\property-bag.c">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
   </ItemGroup>\r
   <ItemGroup>\r
     <ClInclude Include="..\mono\metadata\appdomain.h">\r
     <ClInclude Include="..\mono\metadata\opcodes.h">\r
       <Filter>Header Files</Filter>\r
     </ClInclude>\r
-    <ClInclude Include="..\mono\metadata\process.h">\r
+    <ClInclude Include="..\mono\metadata\w32process.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="..\mono\metadata\w32process-internals.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="..\mono\metadata\w32process-win32-internals.h">\r
       <Filter>Header Files</Filter>\r
     </ClInclude>\r
     <ClInclude Include="..\mono\metadata\profiler.h">\r
     <ClInclude Include="..\mono\metadata\gc-internals.h">\r
       <Filter>Header Files\gc</Filter>\r
     </ClInclude>\r
+    <ClInclude Include="..\mono\metadata\custom-attrs-internals.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="..\mono\metadata\dynamic-image-internals.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="..\mono\metadata\dynamic-stream-internals.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="..\mono\metadata\reflection-cache.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="..\mono\metadata\reflection-internals.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="..\mono\metadata\sre-internals.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="..\mono\metadata\socket-io-windows-internals.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="..\mono\metadata\coree-internals.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="..\mono\metadata\console-win32-internals.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="..\mono\metadata\file-io-windows-internals.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="..\mono\metadata\file-io-internals.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="..\mono\metadata\icall-internals.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="..\mono\metadata\icall-windows-internals.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="..\mono\metadata\marshal-windows-internals.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="..\mono\metadata\marshal-internals.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="..\mono\metadata\mono-security-windows-internals.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="..\mono\metadata\property-bag.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
   </ItemGroup>\r
   <ItemGroup>\r
     <Filter Include="Header Files">\r
       <UniqueIdentifier>{e37c9a88-bfb3-47dd-948c-a74dea25b3ad}</UniqueIdentifier>\r
     </Filter>\r
   </ItemGroup>\r
+  <ItemGroup>\r
+    <None Include="..\mono\metadata\Makefile.am">\r
+      <Filter>Resource Files</Filter>\r
+    </None>\r
+  </ItemGroup>\r
 </Project>
\ No newline at end of file
index ca9ce67c4658365ada96d183ab9f909a5e9a2ec0..bd512ab75e69be5420df3b1f02b3fdfaec296edc 100644 (file)
     <ClCompile Include="..\mono\utils\mono-log-common.c" />\r
     <ClCompile Include="..\mono\utils\mono-math.c" />\r
     <ClCompile Include="..\mono\utils\mono-md5.c" />\r
+    <ClCompile Include="..\mono\utils\mono-mmap-windows.c" />\r
     <ClCompile Include="..\mono\utils\mono-mmap.c" />\r
     <ClCompile Include="..\mono\utils\mono-networkinterfaces.c" />\r
+    <ClCompile Include="..\mono\utils\mono-proclib-windows.c" />\r
+    <ClCompile Include="..\mono\utils\mono-rand-windows.c" />\r
     <ClCompile Include="..\mono\utils\mono-rand.c" />\r
     <ClCompile Include="..\mono\utils\mono-threads-state-machine.c" />\r
     <ClCompile Include="..\mono\utils\networking.c" />\r
     <ClCompile Include="..\mono\utils\mono-threads-windows.c" />\r
     <ClCompile Include="..\mono\utils\mono-threads.c" />\r
     <ClCompile Include="..\mono\utils\mono-threads-coop.c" />\r
-    <ClCompile Include="..\mono\utils\mono-threads-posix-abort-syscall.c">\r
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>\r
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>\r
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>\r
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>\r
-    </ClCompile>\r
-    <ClCompile Include="..\mono\utils\mono-threads-mach-abort-syscall.c">\r
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>\r
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>\r
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>\r
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>\r
-    </ClCompile>\r
-    <ClCompile Include="..\mono\utils\mono-threads-windows-abort-syscall.c" />\r
     <ClCompile Include="..\mono\utils\mono-time.c" />\r
     <ClCompile Include="..\mono\utils\mono-tls.c" />\r
     <ClCompile Include="..\mono\utils\mono-uri.c" />\r
     <ClCompile Include="..\mono\utils\mono-value-hash.c" />\r
     <ClCompile Include="..\mono\utils\monobitset.c" />\r
+    <ClCompile Include="..\mono\utils\os-event-win32.c" />\r
     <ClCompile Include="..\mono\utils\strenc.c" />\r
     <ClCompile Include="..\mono\utils\atomic.c" />\r
     <ClCompile Include="..\mono\utils\mono-hwcap.c" />\r
     <ClInclude Include="..\mono\utils\mono-counters.h" />\r
     <ClInclude Include="..\mono\utils\mono-digest.h" />\r
     <ClInclude Include="..\mono\utils\mono-dl-fallback.h" />\r
+    <ClInclude Include="..\mono\utils\mono-dl-windows-internals.h" />\r
     <ClInclude Include="..\mono\utils\mono-dl.h" />\r
     <ClInclude Include="..\mono\utils\mono-error-internals.h" />\r
     <ClInclude Include="..\mono\utils\mono-error.h" />\r
     <ClInclude Include="..\mono\utils\mono-math.h" />\r
     <ClInclude Include="..\mono\utils\mono-membar.h" />\r
     <ClInclude Include="..\mono\utils\mono-memory-model.h" />\r
+    <ClInclude Include="..\mono\utils\mono-mmap-internals.h" />\r
+    <ClInclude Include="..\mono\utils\mono-mmap-windows-internals.h" />\r
     <ClInclude Include="..\mono\utils\mono-mmap.h" />\r
     <ClInclude Include="..\mono\utils\mono-networkinterfaces.h" />\r
     <ClInclude Include="..\mono\utils\mono-once.h" />\r
     <ClInclude Include="..\mono\utils\mono-os-semaphore.h" />\r
     <ClInclude Include="..\mono\utils\mono-path.h" />\r
     <ClInclude Include="..\mono\utils\mono-poll.h" />\r
+    <ClInclude Include="..\mono\utils\mono-proclib-windows-internals.h" />\r
     <ClInclude Include="..\mono\utils\mono-proclib.h" />\r
     <ClInclude Include="..\mono\utils\mono-property-hash.h" />\r
     <ClInclude Include="..\mono\utils\mono-publib.h" />\r
+    <ClInclude Include="..\mono\utils\mono-rand-windows-internals.h" />\r
     <ClInclude Include="..\mono\utils\mono-rand.h" />\r
     <ClInclude Include="..\mono\utils\mono-sigcontext.h" />\r
     <ClInclude Include="..\mono\utils\mono-stack-unwinding.h" />\r
     <ClInclude Include="..\mono\utils\mono-threads.h" />\r
     <ClInclude Include="..\mono\utils\mono-threads-api.h" />\r
     <ClInclude Include="..\mono\utils\mono-threads-coop.h" />\r
-    <ClInclude Include="..\mono\utils\mono-threads-posix-signals.h" />\r
     <ClInclude Include="..\mono\utils\mono-time.h" />\r
     <ClInclude Include="..\mono\utils\mono-tls.h" />\r
     <ClInclude Include="..\mono\utils\mono-uri.h" />\r
     <ClInclude Include="..\mono\utils\mono-value-hash.h" />\r
     <ClInclude Include="..\mono\utils\monobitset.h" />\r
+    <ClInclude Include="..\mono\utils\os-event.h" />\r
     <ClInclude Include="..\mono\utils\strenc.h" />\r
     <ClInclude Include="..\mono\utils\valgrind.h" />\r
     <ClInclude Include="..\mono\utils\atomic.h" />\r
       <Project>{158073ed-99ae-4196-9edc-ddb2344f8466}</Project>\r
     </ProjectReference>\r
   </ItemGroup>\r
+  <ItemGroup>\r
+    <None Include="..\mono\utils\Makefile.am" />\r
+  </ItemGroup>\r
   <PropertyGroup Label="Globals">\r
     <ProjectGuid>{8FC2B0C8-51AD-49DF-851F-5D01A77A75E4}</ProjectGuid>\r
     <Keyword>Win32Proj</Keyword>\r
   <ImportGroup Label="ExtensionTargets">\r
     <Import Project="$(VCTargetsPath)\BuildCustomizations\masm.targets" />\r
   </ImportGroup>\r
-</Project>
+</Project>
\ No newline at end of file
index dae5e304a8738c178927c709bde9b29795b02e85..30b819626b6fc91f3f5f3cea2ffabec06f416384 100644 (file)
     <ClCompile Include="..\mono\utils\mono-log-windows.c">\r
       <Filter>Source Files</Filter>\r
     </ClCompile>\r
+    <ClCompile Include="..\mono\utils\mono-rand-windows.c">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\mono\utils\mono-proclib-windows.c">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\mono\utils\mono-mmap-windows.c">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\mono\utils\os-event-win32.c">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
   </ItemGroup>\r
   <ItemGroup>\r
     <ClInclude Include="..\mono\utils\atomic.h">\r
     <ClInclude Include="..\mono\utils\valgrind.h">\r
       <Filter>Header Files</Filter>\r
     </ClInclude>\r
+    <ClInclude Include="..\mono\utils\mono-mmap-windows-internals.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="..\mono\utils\mono-mmap-internals.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="..\mono\utils\mono-proclib-windows-internals.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="..\mono\utils\mono-rand-windows-internals.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="..\mono\utils\mono-dl-windows-internals.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="..\mono\utils\os-event.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
   </ItemGroup>\r
   <ItemGroup>\r
     <Filter Include="Header Files">\r
       <Filter>Resource Files</Filter>\r
     </MASM>\r
   </ItemGroup>\r
+  <ItemGroup>\r
+    <None Include="..\mono\utils\Makefile.am">\r
+      <Filter>Resource Files</Filter>\r
+    </None>\r
+  </ItemGroup>\r
 </Project>
\ No newline at end of file
diff --git a/msvc/mono-full-aot-compile-test.vcxproj b/msvc/mono-full-aot-compile-test.vcxproj
new file mode 100644 (file)
index 0000000..1ccf4e7
--- /dev/null
@@ -0,0 +1,203 @@
+<?xml version="1.0" encoding="utf-8"?>\r
+<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
+  <ItemGroup Label="ProjectConfigurations">\r
+    <ProjectConfiguration Include="Debug|Win32">\r
+      <Configuration>Debug</Configuration>\r
+      <Platform>Win32</Platform>\r
+    </ProjectConfiguration>\r
+    <ProjectConfiguration Include="Release|Win32">\r
+      <Configuration>Release</Configuration>\r
+      <Platform>Win32</Platform>\r
+    </ProjectConfiguration>\r
+    <ProjectConfiguration Include="Debug|x64">\r
+      <Configuration>Debug</Configuration>\r
+      <Platform>x64</Platform>\r
+    </ProjectConfiguration>\r
+    <ProjectConfiguration Include="Release|x64">\r
+      <Configuration>Release</Configuration>\r
+      <Platform>x64</Platform>\r
+    </ProjectConfiguration>\r
+  </ItemGroup>\r
+  <PropertyGroup Label="Globals">\r
+    <ProjectGuid>{C7D83158-4EB6-4409-8730-612AD45FAF6A}</ProjectGuid>\r
+    <RootNamespace>monofullaotcompiletest</RootNamespace>\r
+    <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>\r
+  </PropertyGroup>\r
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />\r
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">\r
+    <ConfigurationType>Utility</ConfigurationType>\r
+    <UseDebugLibraries>true</UseDebugLibraries>\r
+    <CharacterSet>Unicode</CharacterSet>\r
+    <PlatformToolset>v140</PlatformToolset>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">\r
+    <ConfigurationType>Utility</ConfigurationType>\r
+    <UseDebugLibraries>false</UseDebugLibraries>\r
+    <WholeProgramOptimization>true</WholeProgramOptimization>\r
+    <CharacterSet>Unicode</CharacterSet>\r
+    <PlatformToolset>v140</PlatformToolset>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">\r
+    <ConfigurationType>Utility</ConfigurationType>\r
+    <UseDebugLibraries>true</UseDebugLibraries>\r
+    <CharacterSet>Unicode</CharacterSet>\r
+    <PlatformToolset>v140</PlatformToolset>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">\r
+    <ConfigurationType>Utility</ConfigurationType>\r
+    <UseDebugLibraries>false</UseDebugLibraries>\r
+    <WholeProgramOptimization>true</WholeProgramOptimization>\r
+    <CharacterSet>Unicode</CharacterSet>\r
+    <PlatformToolset>v140</PlatformToolset>\r
+  </PropertyGroup>\r
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />\r
+  <ImportGroup Label="ExtensionSettings">\r
+  </ImportGroup>\r
+  <ImportGroup Label="Shared">\r
+  </ImportGroup>\r
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">\r
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
+    <Import Project="mono.props" />\r
+    <Import Project="mono-test.props" />\r
+    <Import Project="mono-test-Win32.props" />\r
+    <Import Project="mono-full-aot-test.props" />\r
+    <Import Project="mono-test-env.props" />\r
+  </ImportGroup>\r
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">\r
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
+    <Import Project="mono.props" />\r
+    <Import Project="mono-test.props" />\r
+    <Import Project="mono-test-Win32.props" />\r
+    <Import Project="mono-full-aot-test.props" />\r
+    <Import Project="mono-test-env.props" />\r
+  </ImportGroup>\r
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">\r
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
+    <Import Project="mono.props" />\r
+    <Import Project="mono-test.props" />\r
+    <Import Project="mono-test-x64.props" />\r
+    <Import Project="mono-full-aot-test.props" />\r
+    <Import Project="mono-test-env.props" />\r
+  </ImportGroup>\r
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">\r
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
+    <Import Project="mono.props" />\r
+    <Import Project="mono-test.props" />\r
+    <Import Project="mono-test-x64.props" />\r
+    <Import Project="mono-full-aot-test.props" />\r
+    <Import Project="mono-test-env.props" />\r
+  </ImportGroup>\r
+  <PropertyGroup Label="UserMacros" />\r
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">\r
+    <OutDir>$(MONO_BUILD_DIR_PREFIX)$(Platform)\lib\$(Configuration)\</OutDir>\r
+    <IntDir>$(MONO_BUILD_DIR_PREFIX)$(Platform)\obj\$(ProjectName)\$(Configuration)\</IntDir>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">\r
+    <OutDir>$(MONO_BUILD_DIR_PREFIX)$(Platform)\lib\$(Configuration)\</OutDir>\r
+    <IntDir>$(MONO_BUILD_DIR_PREFIX)$(Platform)\obj\$(ProjectName)\$(Configuration)\</IntDir>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">\r
+    <OutDir>$(MONO_BUILD_DIR_PREFIX)$(Platform)\lib\$(Configuration)\</OutDir>\r
+    <IntDir>$(MONO_BUILD_DIR_PREFIX)$(Platform)\obj\$(ProjectName)\$(Configuration)\</IntDir>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">\r
+    <OutDir>$(MONO_BUILD_DIR_PREFIX)$(Platform)\lib\$(Configuration)\</OutDir>\r
+    <IntDir>$(MONO_BUILD_DIR_PREFIX)$(Platform)\obj\$(ProjectName)\$(Configuration)\</IntDir>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">\r
+    <LocalDebuggerCommand>$(MONO_EXECUTABLE)</LocalDebuggerCommand>\r
+    <LocalDebuggerCommandArguments>$(MONO_FULL_AOT_COMPILE_ARGS)</LocalDebuggerCommandArguments>\r
+    <LocalDebuggerWorkingDirectory>$(MONO_FULL_AOT_TEST_DIR)</LocalDebuggerWorkingDirectory>\r
+    <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>\r
+    <LocalDebuggerEnvironment>$(MONO_PATH_ENV)\r
+$(MONO_CFG_DIR_ENV)\r
+$(MONO_TOOLCHAIN_PATH_ENV)\r
+$(MONO_LOG_LEVEL_ENV)\r
+$(MONO_LOG_MASK_ENV)\r
+$(LocalDebuggerEnvironment)</LocalDebuggerEnvironment>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">\r
+    <LocalDebuggerCommand>$(MONO_EXECUTABLE)</LocalDebuggerCommand>\r
+    <LocalDebuggerCommandArguments>$(MONO_FULL_AOT_COMPILE_ARGS)</LocalDebuggerCommandArguments>\r
+    <LocalDebuggerWorkingDirectory>$(MONO_FULL_AOT_TEST_DIR)</LocalDebuggerWorkingDirectory>\r
+    <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>\r
+    <LocalDebuggerEnvironment>$(MONO_PATH_ENV)\r
+$(MONO_CFG_DIR_ENV)\r
+$(MONO_TOOLCHAIN_PATH_ENV)\r
+$(MONO_LOG_LEVEL_ENV)\r
+$(MONO_LOG_MASK_ENV)\r
+$(LocalDebuggerEnvironment)</LocalDebuggerEnvironment>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">\r
+    <LocalDebuggerCommand>$(MONO_EXECUTABLE)</LocalDebuggerCommand>\r
+    <LocalDebuggerCommandArguments>$(MONO_FULL_AOT_COMPILE_ARGS)</LocalDebuggerCommandArguments>\r
+    <LocalDebuggerWorkingDirectory>$(MONO_FULL_AOT_TEST_DIR)</LocalDebuggerWorkingDirectory>\r
+    <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>\r
+    <LocalDebuggerEnvironment>$(MONO_PATH_ENV)\r
+$(MONO_CFG_DIR_ENV)\r
+$(MONO_TOOLCHAIN_PATH_ENV)\r
+$(MONO_LOG_LEVEL_ENV)\r
+$(MONO_LOG_MASK_ENV)\r
+$(LocalDebuggerEnvironment)</LocalDebuggerEnvironment>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">\r
+    <LocalDebuggerCommand>$(MONO_EXECUTABLE)</LocalDebuggerCommand>\r
+    <LocalDebuggerCommandArguments>$(MONO_FULL_AOT_COMPILE_ARGS)</LocalDebuggerCommandArguments>\r
+    <LocalDebuggerWorkingDirectory>$(MONO_FULL_AOT_TEST_DIR)</LocalDebuggerWorkingDirectory>\r
+    <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>\r
+    <LocalDebuggerEnvironment>$(MONO_PATH_ENV)\r
+$(MONO_CFG_DIR_ENV)\r
+$(MONO_TOOLCHAIN_PATH_ENV)\r
+$(MONO_LOG_LEVEL_ENV)\r
+$(MONO_LOG_MASK_ENV)\r
+$(LocalDebuggerEnvironment)</LocalDebuggerEnvironment>\r
+  </PropertyGroup>\r
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">\r
+    <ClCompile>\r
+      <WarningLevel>Level3</WarningLevel>\r
+      <Optimization>Disabled</Optimization>\r
+      <SDLCheck>true</SDLCheck>\r
+    </ClCompile>\r
+  </ItemDefinitionGroup>\r
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">\r
+    <ClCompile>\r
+      <WarningLevel>Level3</WarningLevel>\r
+      <Optimization>Disabled</Optimization>\r
+      <SDLCheck>true</SDLCheck>\r
+    </ClCompile>\r
+  </ItemDefinitionGroup>\r
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">\r
+    <ClCompile>\r
+      <WarningLevel>Level3</WarningLevel>\r
+      <Optimization>MaxSpeed</Optimization>\r
+      <FunctionLevelLinking>true</FunctionLevelLinking>\r
+      <IntrinsicFunctions>true</IntrinsicFunctions>\r
+      <SDLCheck>true</SDLCheck>\r
+    </ClCompile>\r
+    <Link>\r
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>\r
+      <OptimizeReferences>true</OptimizeReferences>\r
+    </Link>\r
+  </ItemDefinitionGroup>\r
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">\r
+    <ClCompile>\r
+      <WarningLevel>Level3</WarningLevel>\r
+      <Optimization>MaxSpeed</Optimization>\r
+      <FunctionLevelLinking>true</FunctionLevelLinking>\r
+      <IntrinsicFunctions>true</IntrinsicFunctions>\r
+      <SDLCheck>true</SDLCheck>\r
+    </ClCompile>\r
+    <Link>\r
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>\r
+      <OptimizeReferences>true</OptimizeReferences>\r
+    </Link>\r
+  </ItemDefinitionGroup>\r
+  <ItemGroup>\r
+    <ProjectReference Include="mono.vcxproj">\r
+      <Project>{a0eddcd9-940f-432c-a28f-7ef322437d79}</Project>\r
+    </ProjectReference>\r
+  </ItemGroup>\r
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />\r
+  <ImportGroup Label="ExtensionTargets">\r
+  </ImportGroup>\r
+</Project>
\ No newline at end of file
diff --git a/msvc/mono-full-aot-run-test.vcxproj b/msvc/mono-full-aot-run-test.vcxproj
new file mode 100644 (file)
index 0000000..e16fcf2
--- /dev/null
@@ -0,0 +1,203 @@
+<?xml version="1.0" encoding="utf-8"?>\r
+<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
+  <ItemGroup Label="ProjectConfigurations">\r
+    <ProjectConfiguration Include="Debug|Win32">\r
+      <Configuration>Debug</Configuration>\r
+      <Platform>Win32</Platform>\r
+    </ProjectConfiguration>\r
+    <ProjectConfiguration Include="Release|Win32">\r
+      <Configuration>Release</Configuration>\r
+      <Platform>Win32</Platform>\r
+    </ProjectConfiguration>\r
+    <ProjectConfiguration Include="Debug|x64">\r
+      <Configuration>Debug</Configuration>\r
+      <Platform>x64</Platform>\r
+    </ProjectConfiguration>\r
+    <ProjectConfiguration Include="Release|x64">\r
+      <Configuration>Release</Configuration>\r
+      <Platform>x64</Platform>\r
+    </ProjectConfiguration>\r
+  </ItemGroup>\r
+  <PropertyGroup Label="Globals">\r
+    <ProjectGuid>{6C64262B-077B-4E12-AF91-9409ECCB75F6}</ProjectGuid>\r
+    <RootNamespace>monofullaotruntest</RootNamespace>\r
+    <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>\r
+  </PropertyGroup>\r
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />\r
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">\r
+    <ConfigurationType>Utility</ConfigurationType>\r
+    <UseDebugLibraries>true</UseDebugLibraries>\r
+    <CharacterSet>Unicode</CharacterSet>\r
+    <PlatformToolset>v140</PlatformToolset>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">\r
+    <ConfigurationType>Utility</ConfigurationType>\r
+    <UseDebugLibraries>false</UseDebugLibraries>\r
+    <WholeProgramOptimization>true</WholeProgramOptimization>\r
+    <CharacterSet>Unicode</CharacterSet>\r
+    <PlatformToolset>v140</PlatformToolset>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">\r
+    <ConfigurationType>Utility</ConfigurationType>\r
+    <UseDebugLibraries>true</UseDebugLibraries>\r
+    <CharacterSet>Unicode</CharacterSet>\r
+    <PlatformToolset>v140</PlatformToolset>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">\r
+    <ConfigurationType>Utility</ConfigurationType>\r
+    <UseDebugLibraries>false</UseDebugLibraries>\r
+    <WholeProgramOptimization>true</WholeProgramOptimization>\r
+    <CharacterSet>Unicode</CharacterSet>\r
+    <PlatformToolset>v140</PlatformToolset>\r
+  </PropertyGroup>\r
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />\r
+  <ImportGroup Label="ExtensionSettings">\r
+  </ImportGroup>\r
+  <ImportGroup Label="Shared">\r
+  </ImportGroup>\r
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">\r
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
+    <Import Project="mono.props" />\r
+    <Import Project="mono-test.props" />\r
+    <Import Project="mono-test-Win32.props" />\r
+    <Import Project="mono-full-aot-test.props" />\r
+    <Import Project="mono-test-env.props" />\r
+  </ImportGroup>\r
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">\r
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
+    <Import Project="mono.props" />\r
+    <Import Project="mono-test.props" />\r
+    <Import Project="mono-test-Win32.props" />\r
+    <Import Project="mono-full-aot-test.props" />\r
+    <Import Project="mono-test-env.props" />\r
+  </ImportGroup>\r
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">\r
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
+    <Import Project="mono.props" />\r
+    <Import Project="mono-test.props" />\r
+    <Import Project="mono-test-x64.props" />\r
+    <Import Project="mono-full-aot-test.props" />\r
+    <Import Project="mono-test-env.props" />\r
+  </ImportGroup>\r
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">\r
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
+    <Import Project="mono.props" />\r
+    <Import Project="mono-test.props" />\r
+    <Import Project="mono-test-x64.props" />\r
+    <Import Project="mono-full-aot-test.props" />\r
+    <Import Project="mono-test-env.props" />\r
+  </ImportGroup>\r
+  <PropertyGroup Label="UserMacros" />\r
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">\r
+    <OutDir>$(MONO_BUILD_DIR_PREFIX)$(Platform)\lib\$(Configuration)\</OutDir>\r
+    <IntDir>$(MONO_BUILD_DIR_PREFIX)$(Platform)\obj\$(ProjectName)\$(Configuration)\</IntDir>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">\r
+    <OutDir>$(MONO_BUILD_DIR_PREFIX)$(Platform)\lib\$(Configuration)\</OutDir>\r
+    <IntDir>$(MONO_BUILD_DIR_PREFIX)$(Platform)\obj\$(ProjectName)\$(Configuration)\</IntDir>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">\r
+    <OutDir>$(MONO_BUILD_DIR_PREFIX)$(Platform)\lib\$(Configuration)\</OutDir>\r
+    <IntDir>$(MONO_BUILD_DIR_PREFIX)$(Platform)\obj\$(ProjectName)\$(Configuration)\</IntDir>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">\r
+    <OutDir>$(MONO_BUILD_DIR_PREFIX)$(Platform)\lib\$(Configuration)\</OutDir>\r
+    <IntDir>$(MONO_BUILD_DIR_PREFIX)$(Platform)\obj\$(ProjectName)\$(Configuration)\</IntDir>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">\r
+    <LocalDebuggerCommand>$(MONO_EXECUTABLE)</LocalDebuggerCommand>\r
+    <LocalDebuggerCommandArguments>$(MONO_FULL_AOT_RUN_ARGS)</LocalDebuggerCommandArguments>\r
+    <LocalDebuggerWorkingDirectory>$(MONO_FULL_AOT_TEST_DIR)</LocalDebuggerWorkingDirectory>\r
+    <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>\r
+    <LocalDebuggerEnvironment>$(MONO_PATH_ENV)\r
+$(MONO_CFG_DIR_ENV)\r
+$(MONO_TOOLCHAIN_PATH_ENV)\r
+$(MONO_LOG_LEVEL_ENV)\r
+$(MONO_LOG_MASK_ENV)\r
+$(LocalDebuggerEnvironment)</LocalDebuggerEnvironment>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">\r
+    <LocalDebuggerCommand>$(MONO_EXECUTABLE)</LocalDebuggerCommand>\r
+    <LocalDebuggerCommandArguments>$(MONO_FULL_AOT_RUN_ARGS)</LocalDebuggerCommandArguments>\r
+    <LocalDebuggerWorkingDirectory>$(MONO_FULL_AOT_TEST_DIR)</LocalDebuggerWorkingDirectory>\r
+    <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>\r
+    <LocalDebuggerEnvironment>$(MONO_PATH_ENV)\r
+$(MONO_CFG_DIR_ENV)\r
+$(MONO_TOOLCHAIN_PATH_ENV)\r
+$(MONO_LOG_LEVEL_ENV)\r
+$(MONO_LOG_MASK_ENV)\r
+$(LocalDebuggerEnvironment)</LocalDebuggerEnvironment>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">\r
+    <LocalDebuggerCommand>$(MONO_EXECUTABLE)</LocalDebuggerCommand>\r
+    <LocalDebuggerCommandArguments>$(MONO_FULL_AOT_RUN_ARGS)</LocalDebuggerCommandArguments>\r
+    <LocalDebuggerWorkingDirectory>$(MONO_FULL_AOT_TEST_DIR)</LocalDebuggerWorkingDirectory>\r
+    <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>\r
+    <LocalDebuggerEnvironment>$(MONO_PATH_ENV)\r
+$(MONO_CFG_DIR_ENV)\r
+$(MONO_TOOLCHAIN_PATH_ENV)\r
+$(MONO_LOG_LEVEL_ENV)\r
+$(MONO_LOG_MASK_ENV)\r
+$(LocalDebuggerEnvironment)</LocalDebuggerEnvironment>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">\r
+    <LocalDebuggerCommand>$(MONO_EXECUTABLE)</LocalDebuggerCommand>\r
+    <LocalDebuggerCommandArguments>$(MONO_FULL_AOT_RUN_ARGS)</LocalDebuggerCommandArguments>\r
+    <LocalDebuggerWorkingDirectory>$(MONO_FULL_AOT_TEST_DIR)</LocalDebuggerWorkingDirectory>\r
+    <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>\r
+    <LocalDebuggerEnvironment>$(MONO_PATH_ENV)\r
+$(MONO_CFG_DIR_ENV)\r
+$(MONO_TOOLCHAIN_PATH_ENV)\r
+$(MONO_LOG_LEVEL_ENV)\r
+$(MONO_LOG_MASK_ENV)\r
+$(LocalDebuggerEnvironment)</LocalDebuggerEnvironment>\r
+  </PropertyGroup>\r
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">\r
+    <ClCompile>\r
+      <WarningLevel>Level3</WarningLevel>\r
+      <Optimization>Disabled</Optimization>\r
+      <SDLCheck>true</SDLCheck>\r
+    </ClCompile>\r
+  </ItemDefinitionGroup>\r
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">\r
+    <ClCompile>\r
+      <WarningLevel>Level3</WarningLevel>\r
+      <Optimization>Disabled</Optimization>\r
+      <SDLCheck>true</SDLCheck>\r
+    </ClCompile>\r
+  </ItemDefinitionGroup>\r
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">\r
+    <ClCompile>\r
+      <WarningLevel>Level3</WarningLevel>\r
+      <Optimization>MaxSpeed</Optimization>\r
+      <FunctionLevelLinking>true</FunctionLevelLinking>\r
+      <IntrinsicFunctions>true</IntrinsicFunctions>\r
+      <SDLCheck>true</SDLCheck>\r
+    </ClCompile>\r
+    <Link>\r
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>\r
+      <OptimizeReferences>true</OptimizeReferences>\r
+    </Link>\r
+  </ItemDefinitionGroup>\r
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">\r
+    <ClCompile>\r
+      <WarningLevel>Level3</WarningLevel>\r
+      <Optimization>MaxSpeed</Optimization>\r
+      <FunctionLevelLinking>true</FunctionLevelLinking>\r
+      <IntrinsicFunctions>true</IntrinsicFunctions>\r
+      <SDLCheck>true</SDLCheck>\r
+    </ClCompile>\r
+    <Link>\r
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>\r
+      <OptimizeReferences>true</OptimizeReferences>\r
+    </Link>\r
+  </ItemDefinitionGroup>\r
+  <ItemGroup>\r
+    <ProjectReference Include="mono.vcxproj">\r
+      <Project>{a0eddcd9-940f-432c-a28f-7ef322437d79}</Project>\r
+    </ProjectReference>\r
+  </ItemGroup>\r
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />\r
+  <ImportGroup Label="ExtensionTargets">\r
+  </ImportGroup>\r
+</Project>
\ No newline at end of file
diff --git a/msvc/mono-full-aot-test.props b/msvc/mono-full-aot-test.props
new file mode 100644 (file)
index 0000000..a3a6eb8
--- /dev/null
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup Label="UserMacros">
+       <MONO_FULL_AOT_TEST_DIR>$(MONO_DIR)/mono/mini</MONO_FULL_AOT_TEST_DIR>
+       <MONO_PATH>$(MONO_PATH);$(MONO_FULL_AOT_TEST_DIR)</MONO_PATH>
+       <MONO_CFG_DIR>$(MONO_DIR)/runtime/etc</MONO_CFG_DIR>
+    <MONO_FULL_AOT_COMPILE_SYSTEM_TARGETS>mscorlib.dll,System.Core.dll,System.dll,Mono.Posix.dll,System.Configuration.dll,System.Security.dll,System.Xml.dll,Mono.Security.dll,Mono.Simd.dll,I18N.dll,I18N.West.dll</MONO_FULL_AOT_COMPILE_SYSTEM_TARGETS>
+    <MONO_FULL_AOT_COMPILE_TEST_SUPPORT_TARGETS>TestDriver.dll</MONO_FULL_AOT_COMPILE_TEST_SUPPORT_TARGETS>
+    <MONO_FULL_AOT_COMPILE_TARGETS>basic.exe</MONO_FULL_AOT_COMPILE_TARGETS>
+    <MONO_FULL_AOT_COMPILE_ARGS>--aot=full,tool-prefix="$(MONO_TOOLCHAIN_PREFIX)",print-skipped $(MONO_FULL_AOT_COMPILE_TARGETS)</MONO_FULL_AOT_COMPILE_ARGS>
+    <MONO_FULL_AOT_RUN_TARGET>basic.exe</MONO_FULL_AOT_RUN_TARGET>
+    <MONO_FULL_AOT_RUN_ADDITIONAL_ARGS>--exclude "!FULLAOT" --exclude "!FULLAOT-AMD64"</MONO_FULL_AOT_RUN_ADDITIONAL_ARGS>
+    <MONO_FULL_AOT_RUN_ARGS>--full-aot "$(MONO_FULL_AOT_RUN_TARGET)" $(MONO_FULL_AOT_RUN_ADDITIONAL_ARGS)</MONO_FULL_AOT_RUN_ARGS>
+  </PropertyGroup>
+  <ItemGroup>
+       <BuildMacro Include="MONO_FULL_AOT_TEST_DIR">
+      <Value>$(MONO_FULL_AOT_TEST_DIR)</Value>
+    </BuildMacro>
+       <BuildMacro Include="MONO_PATH">
+      <Value>$(MONO_PATH)</Value>
+    </BuildMacro>
+       <BuildMacro Include="MONO_CFG_DIR">
+      <Value>$(MONO_CFG_DIR)</Value>
+    </BuildMacro>
+    <BuildMacro Include="MONO_FULL_AOT_COMPILE_SYSTEM_TARGETS">
+      <Value>$(MONO_FULL_AOT_COMPILE_SYSTEM_TARGETS)</Value>
+    </BuildMacro>
+    <BuildMacro Include="MONO_FULL_AOT_COMPILE_TEST_SUPPORT_TARGETS">
+      <Value>$(MONO_FULL_AOT_COMPILE_TEST_SUPPORT_TARGETS)</Value>
+    </BuildMacro>
+    <BuildMacro Include="MONO_FULL_AOT_COMPILE_TARGETS">
+      <Value>$(MONO_FULL_AOT_COMPILE_TARGETS)</Value>
+    </BuildMacro>
+    <BuildMacro Include="MONO_FULL_AOT_COMPILE_ARGS">
+      <Value>$(MONO_FULL_AOT_COMPILE_ARGS)</Value>
+    </BuildMacro>
+    <BuildMacro Include="MONO_FULL_AOT_RUN_TARGET">
+      <Value>$(MONO_FULL_AOT_RUN_TARGET)</Value>
+    </BuildMacro>
+    <BuildMacro Include="MONO_FULL_AOT_RUN_ADDITIONAL_ARGS">
+      <Value>$(MONO_FULL_AOT_RUN_ADDITIONAL_ARGS)</Value>
+    </BuildMacro>
+    <BuildMacro Include="MONO_FULL_AOT_RUN_ARGS">
+      <Value>$(MONO_FULL_AOT_RUN_ARGS)</Value>
+    </BuildMacro>
+  </ItemGroup>
+  <ItemDefinitionGroup />
+</Project>
\ No newline at end of file
diff --git a/msvc/mono-mini-regression-aot-test.vcxproj b/msvc/mono-mini-regression-aot-test.vcxproj
deleted file mode 100644 (file)
index 9dcde12..0000000
+++ /dev/null
@@ -1,199 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>\r
-<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
-  <ItemGroup Label="ProjectConfigurations">\r
-    <ProjectConfiguration Include="Debug|Win32">\r
-      <Configuration>Debug</Configuration>\r
-      <Platform>Win32</Platform>\r
-    </ProjectConfiguration>\r
-    <ProjectConfiguration Include="Release|Win32">\r
-      <Configuration>Release</Configuration>\r
-      <Platform>Win32</Platform>\r
-    </ProjectConfiguration>\r
-    <ProjectConfiguration Include="Debug|x64">\r
-      <Configuration>Debug</Configuration>\r
-      <Platform>x64</Platform>\r
-    </ProjectConfiguration>\r
-    <ProjectConfiguration Include="Release|x64">\r
-      <Configuration>Release</Configuration>\r
-      <Platform>x64</Platform>\r
-    </ProjectConfiguration>\r
-  </ItemGroup>\r
-  <PropertyGroup Label="Globals">\r
-    <ProjectGuid>{D632D664-C0F5-4B60-9375-BDDAD5C7A649}</ProjectGuid>\r
-    <RootNamespace>monominiregressionaottest</RootNamespace>\r
-    <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>\r
-  </PropertyGroup>\r
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />\r
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">\r
-    <ConfigurationType>Utility</ConfigurationType>\r
-    <UseDebugLibraries>true</UseDebugLibraries>\r
-    <CharacterSet>MultiByte</CharacterSet>\r
-    <PlatformToolset>v140</PlatformToolset>\r
-  </PropertyGroup>\r
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">\r
-    <ConfigurationType>Utility</ConfigurationType>\r
-    <UseDebugLibraries>false</UseDebugLibraries>\r
-    <WholeProgramOptimization>true</WholeProgramOptimization>\r
-    <CharacterSet>MultiByte</CharacterSet>\r
-    <PlatformToolset>v140</PlatformToolset>\r
-  </PropertyGroup>\r
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">\r
-    <ConfigurationType>Utility</ConfigurationType>\r
-    <UseDebugLibraries>true</UseDebugLibraries>\r
-    <CharacterSet>MultiByte</CharacterSet>\r
-    <PlatformToolset>v140</PlatformToolset>\r
-  </PropertyGroup>\r
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">\r
-    <ConfigurationType>Utility</ConfigurationType>\r
-    <UseDebugLibraries>false</UseDebugLibraries>\r
-    <WholeProgramOptimization>true</WholeProgramOptimization>\r
-    <CharacterSet>MultiByte</CharacterSet>\r
-    <PlatformToolset>v140</PlatformToolset>\r
-  </PropertyGroup>\r
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />\r
-  <ImportGroup Label="ExtensionSettings">\r
-  </ImportGroup>\r
-  <ImportGroup Label="Shared">\r
-  </ImportGroup>\r
-  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">\r
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
-    <Import Project="mono.props" />\r
-    <Import Project="mono-regression-test-Win32.props" />\r
-    <Import Project="mono-regression-test.props" />\r
-    <Import Project="mono-mini-regression-test-aot.props" />\r
-  </ImportGroup>\r
-  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">\r
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
-    <Import Project="mono.props" />\r
-    <Import Project="mono-regression-test-Win32.props" />\r
-    <Import Project="mono-regression-test.props" />\r
-    <Import Project="mono-mini-regression-test-aot.props" />\r
-  </ImportGroup>\r
-  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">\r
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
-    <Import Project="mono.props" />\r
-    <Import Project="mono-regression-test-x64.props" />\r
-    <Import Project="mono-regression-test.props" />\r
-    <Import Project="mono-mini-regression-test-aot.props" />\r
-  </ImportGroup>\r
-  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">\r
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
-    <Import Project="mono.props" />\r
-    <Import Project="mono-regression-test-x64.props" />\r
-    <Import Project="mono-regression-test.props" />\r
-    <Import Project="mono-mini-regression-test-aot.props" />\r
-  </ImportGroup>\r
-  <PropertyGroup Label="UserMacros" />\r
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">\r
-    <OutDir>$(MONO_BUILD_DIR_PREFIX)$(Platform)\lib\$(Configuration)\</OutDir>\r
-    <IntDir>$(MONO_BUILD_DIR_PREFIX)$(Platform)\obj\$(ProjectName)\$(Configuration)\</IntDir>\r
-  </PropertyGroup>\r
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">\r
-    <OutDir>$(MONO_BUILD_DIR_PREFIX)$(Platform)\lib\$(Configuration)\</OutDir>\r
-    <IntDir>$(MONO_BUILD_DIR_PREFIX)$(Platform)\obj\$(ProjectName)\$(Configuration)\</IntDir>\r
-  </PropertyGroup>\r
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">\r
-    <OutDir>$(MONO_BUILD_DIR_PREFIX)$(Platform)\lib\$(Configuration)\</OutDir>\r
-    <IntDir>$(MONO_BUILD_DIR_PREFIX)$(Platform)\obj\$(ProjectName)\$(Configuration)\</IntDir>\r
-  </PropertyGroup>\r
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">\r
-    <OutDir>$(MONO_BUILD_DIR_PREFIX)$(Platform)\lib\$(Configuration)\</OutDir>\r
-    <IntDir>$(MONO_BUILD_DIR_PREFIX)$(Platform)\obj\$(ProjectName)\$(Configuration)\</IntDir>\r
-  </PropertyGroup>\r
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">\r
-    <LocalDebuggerCommand>$(MONO_EXECUTABLE)</LocalDebuggerCommand>\r
-    <LocalDebuggerCommandArguments>$(MONO_MINI_REGRESSION_TEST_AOT_ARGS)</LocalDebuggerCommandArguments>\r
-    <LocalDebuggerWorkingDirectory>$(MONO_EXECUTABLE_DIR)</LocalDebuggerWorkingDirectory>\r
-    <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>\r
-    <LocalDebuggerEnvironment>$(MONO_PATH_ENV)\r
-$(MONO_CFG_DIR_ENV)\r
-$(MONO_TOOLCHAIN_PATH_ENV)\r
-$(MONO_LOG_LEVEL_ENV)\r
-$(MONO_LOG_MASK_ENV)\r
-$(LocalDebuggerEnvironment)</LocalDebuggerEnvironment>\r
-  </PropertyGroup>\r
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">\r
-    <LocalDebuggerCommand>$(MONO_EXECUTABLE)</LocalDebuggerCommand>\r
-    <LocalDebuggerCommandArguments>$(MONO_MINI_REGRESSION_TEST_AOT_ARGS)</LocalDebuggerCommandArguments>\r
-    <LocalDebuggerWorkingDirectory>$(MONO_EXECUTABLE_DIR)</LocalDebuggerWorkingDirectory>\r
-    <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>\r
-    <LocalDebuggerEnvironment>$(MONO_PATH_ENV)\r
-$(MONO_CFG_DIR_ENV)\r
-$(MONO_TOOLCHAIN_PATH_ENV)\r
-$(MONO_LOG_LEVEL_ENV)\r
-$(MONO_LOG_MASK_ENV)\r
-$(LocalDebuggerEnvironment)</LocalDebuggerEnvironment>\r
-  </PropertyGroup>\r
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">\r
-    <LocalDebuggerCommand>$(MONO_EXECUTABLE)</LocalDebuggerCommand>\r
-    <LocalDebuggerCommandArguments>$(MONO_MINI_REGRESSION_TEST_AOT_ARGS)</LocalDebuggerCommandArguments>\r
-    <LocalDebuggerWorkingDirectory>$(MONO_EXECUTABLE_DIR)</LocalDebuggerWorkingDirectory>\r
-    <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>\r
-    <LocalDebuggerEnvironment>$(MONO_PATH_ENV)\r
-$(MONO_CFG_DIR_ENV)\r
-$(MONO_TOOLCHAIN_PATH_ENV)\r
-$(MONO_LOG_LEVEL_ENV)\r
-$(MONO_LOG_MASK_ENV)\r
-$(LocalDebuggerEnvironment)</LocalDebuggerEnvironment>\r
-  </PropertyGroup>\r
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">\r
-    <LocalDebuggerCommand>$(MONO_EXECUTABLE)</LocalDebuggerCommand>\r
-    <LocalDebuggerCommandArguments>$(MONO_MINI_REGRESSION_TEST_AOT_ARGS)</LocalDebuggerCommandArguments>\r
-    <LocalDebuggerWorkingDirectory>$(MONO_EXECUTABLE_DIR)</LocalDebuggerWorkingDirectory>\r
-    <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>\r
-    <LocalDebuggerEnvironment>$(MONO_PATH_ENV)\r
-$(MONO_CFG_DIR_ENV)\r
-$(MONO_TOOLCHAIN_PATH_ENV)\r
-$(MONO_LOG_LEVEL_ENV)\r
-$(MONO_LOG_MASK_ENV)\r
-$(LocalDebuggerEnvironment)</LocalDebuggerEnvironment>\r
-  </PropertyGroup>\r
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">\r
-    <ClCompile>\r
-      <WarningLevel>Level3</WarningLevel>\r
-      <Optimization>Disabled</Optimization>\r
-      <SDLCheck>true</SDLCheck>\r
-    </ClCompile>\r
-  </ItemDefinitionGroup>\r
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">\r
-    <ClCompile>\r
-      <WarningLevel>Level3</WarningLevel>\r
-      <Optimization>Disabled</Optimization>\r
-      <SDLCheck>true</SDLCheck>\r
-    </ClCompile>\r
-  </ItemDefinitionGroup>\r
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">\r
-    <ClCompile>\r
-      <WarningLevel>Level3</WarningLevel>\r
-      <Optimization>MaxSpeed</Optimization>\r
-      <FunctionLevelLinking>true</FunctionLevelLinking>\r
-      <IntrinsicFunctions>true</IntrinsicFunctions>\r
-      <SDLCheck>true</SDLCheck>\r
-    </ClCompile>\r
-    <Link>\r
-      <EnableCOMDATFolding>true</EnableCOMDATFolding>\r
-      <OptimizeReferences>true</OptimizeReferences>\r
-    </Link>\r
-  </ItemDefinitionGroup>\r
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">\r
-    <ClCompile>\r
-      <WarningLevel>Level3</WarningLevel>\r
-      <Optimization>MaxSpeed</Optimization>\r
-      <FunctionLevelLinking>true</FunctionLevelLinking>\r
-      <IntrinsicFunctions>true</IntrinsicFunctions>\r
-      <SDLCheck>true</SDLCheck>\r
-    </ClCompile>\r
-    <Link>\r
-      <EnableCOMDATFolding>true</EnableCOMDATFolding>\r
-      <OptimizeReferences>true</OptimizeReferences>\r
-    </Link>\r
-  </ItemDefinitionGroup>\r
-  <ItemGroup>\r
-    <ProjectReference Include="mono.vcxproj">\r
-      <Project>{a0eddcd9-940f-432c-a28f-7ef322437d79}</Project>\r
-    </ProjectReference>\r
-  </ItemGroup>\r
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />\r
-  <ImportGroup Label="ExtensionTargets">\r
-  </ImportGroup>\r
-</Project>
\ No newline at end of file
diff --git a/msvc/mono-mini-regression-aot-test.vcxproj.filters b/msvc/mono-mini-regression-aot-test.vcxproj.filters
deleted file mode 100644 (file)
index f81daba..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>\r
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
-  <ItemGroup>\r
-    <Filter Include="Source Files">\r
-      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>\r
-      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>\r
-    </Filter>\r
-    <Filter Include="Header Files">\r
-      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>\r
-      <Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>\r
-    </Filter>\r
-    <Filter Include="Resource Files">\r
-      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>\r
-      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>\r
-    </Filter>\r
-  </ItemGroup>\r
-</Project>
\ No newline at end of file
diff --git a/msvc/mono-mini-regression-test-aot.props b/msvc/mono-mini-regression-test-aot.props
deleted file mode 100644 (file)
index e741e13..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <!--<ImportGroup Label="PropertySheets" />-->
-  <PropertyGroup Label="UserMacros">
-    <MONO_MINI_ALL_REGRESSION_TEST_AOT_ARG>--aot="tool-prefix=$(MONO_TOOLCHAIN_PREFIX)"  $(MONO_MINI_REGRESSION_TESTS)</MONO_MINI_ALL_REGRESSION_TEST_AOT_ARG>
-    <MONO_MINI_ONE_REGRESSION_TEST_AOT_ARG>--aot="tool-prefix=$(MONO_TOOLCHAIN_PREFIX)" basic.exe</MONO_MINI_ONE_REGRESSION_TEST_AOT_ARG>
-    <MONO_MINI_REGRESSION_TEST_AOT_ARGS>$(MONO_EXECUTABLE_CONFIG_ARG) $(MONO_MINI_ALL_REGRESSION_TEST_AOT_ARG)</MONO_MINI_REGRESSION_TEST_AOT_ARGS>
-  </PropertyGroup>
-  <ItemGroup>
-    <BuildMacro Include="MONO_MINI_ALL_REGRESSION_TEST_AOT_ARG">
-      <Value>$(MONO_MINI_ALL_REGRESSION_TEST_AOT_ARG)</Value>
-    </BuildMacro>
-    <BuildMacro Include="MONO_MINI_ONE_REGRESSION_TEST_AOT_ARG">
-      <Value>$(MONO_MINI_ONE_REGRESSION_TEST_AOT_ARG)</Value>
-    </BuildMacro>
-    <BuildMacro Include="MONO_MINI_REGRESSION_TEST_AOT_ARGS">
-      <Value>$(MONO_MINI_REGRESSION_TEST_AOT_ARGS)</Value>
-    </BuildMacro>
-  </ItemGroup>
-  <ItemDefinitionGroup />
-</Project>
\ No newline at end of file
index b0003104b537c45dc696b3b81f32c151d2d4be86..02d1f6f94c457ef26879b466714de8ba82d65383 100644 (file)
@@ -1,12 +1,31 @@
 <?xml version="1.0" encoding="utf-8"?>
 <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <!--<ImportGroup Label="PropertySheets" />-->
   <PropertyGroup Label="UserMacros">
+       <MONO_MINI_REGRESSION_TEST_DIR>$(MONO_DIR)/mono/mini</MONO_MINI_REGRESSION_TEST_DIR>
+       <MONO_PATH>$(MONO_PATH);$(MONO_MINI_REGRESSION_TEST_DIR)</MONO_PATH>
+       <MONO_CFG_DIR>$(MONO_DIR)/runtime/etc</MONO_CFG_DIR>
+    <MONO_CONFIG_ARG>--config "$(MONO_CFG_DIR)/mono/config"</MONO_CONFIG_ARG>
+    <MONO_MINI_REGRESSION_TESTS>basic.exe basic-float.exe basic-long.exe basic-calls.exe objects.exe arrays.exe basic-math.exe exceptions.exe iltests.exe devirtualization.exe generics.exe basic-simd.exe</MONO_MINI_REGRESSION_TESTS>
     <MONO_MINI_ALL_REGRESSION_TEST_ARG>--regression $(MONO_MINI_REGRESSION_TESTS)</MONO_MINI_ALL_REGRESSION_TEST_ARG>
     <MONO_MINI_ONE_REGRESSION_TEST_ARG>--regression basic.exe</MONO_MINI_ONE_REGRESSION_TEST_ARG>
-    <MONO_MINI_REGRESSION_TEST_ARGS>$(MONO_EXECUTABLE_CONFIG_ARG) $(MONO_MINI_ALL_REGRESSION_TEST_ARG)</MONO_MINI_REGRESSION_TEST_ARGS>
+    <MONO_MINI_REGRESSION_TEST_ARGS>$(MONO_CONFIG_ARG) $(MONO_MINI_ALL_REGRESSION_TEST_ARG)</MONO_MINI_REGRESSION_TEST_ARGS>
   </PropertyGroup>
   <ItemGroup>
+       <BuildMacro Include="MONO_MINI_REGRESSION_TEST_DIR">
+      <Value>$(MONO_MINI_REGRESSION_TEST_DIR)</Value>
+    </BuildMacro>
+       <BuildMacro Include="MONO_PATH">
+      <Value>$(MONO_PATH)</Value>
+    </BuildMacro>
+       <BuildMacro Include="MONO_CFG_DIR">
+      <Value>$(MONO_CFG_DIR)</Value>
+    </BuildMacro>
+    <BuildMacro Include="MONO_CONFIG_ARG">
+      <Value>$(MONO_CONFIG_ARG)</Value>
+    </BuildMacro>
+    <BuildMacro Include="MONO_MINI_REGRESSION_TESTS">
+      <Value>$(MONO_MINI_REGRESSION_TESTS)</Value>
+    </BuildMacro>
     <BuildMacro Include="MONO_MINI_ALL_REGRESSION_TEST_ARG">
       <Value>$(MONO_MINI_ALL_REGRESSION_TEST_ARG)</Value>
     </BuildMacro>
index 6ad3801af37c89c980ed4b75941a5cd7b11eeb75..3b853a182a33f7024325520b5fc5c76e4b4ad7d3 100644 (file)
     <ConfigurationType>Utility</ConfigurationType>\r
     <UseDebugLibraries>true</UseDebugLibraries>\r
     <PlatformToolset>v140</PlatformToolset>\r
-    <CharacterSet>MultiByte</CharacterSet>\r
+    <CharacterSet>Unicode</CharacterSet>\r
   </PropertyGroup>\r
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">\r
     <ConfigurationType>Utility</ConfigurationType>\r
     <UseDebugLibraries>false</UseDebugLibraries>\r
     <PlatformToolset>v140</PlatformToolset>\r
     <WholeProgramOptimization>true</WholeProgramOptimization>\r
-    <CharacterSet>MultiByte</CharacterSet>\r
+    <CharacterSet>Unicode</CharacterSet>\r
   </PropertyGroup>\r
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">\r
     <ConfigurationType>Utility</ConfigurationType>\r
     <UseDebugLibraries>true</UseDebugLibraries>\r
     <PlatformToolset>v140</PlatformToolset>\r
-    <CharacterSet>MultiByte</CharacterSet>\r
+    <CharacterSet>Unicode</CharacterSet>\r
   </PropertyGroup>\r
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">\r
     <ConfigurationType>Utility</ConfigurationType>\r
     <UseDebugLibraries>false</UseDebugLibraries>\r
     <PlatformToolset>v140</PlatformToolset>\r
     <WholeProgramOptimization>true</WholeProgramOptimization>\r
-    <CharacterSet>MultiByte</CharacterSet>\r
+    <CharacterSet>Unicode</CharacterSet>\r
   </PropertyGroup>\r
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />\r
   <ImportGroup Label="ExtensionSettings">\r
   <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">\r
     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
     <Import Project="mono.props" />\r
-    <Import Project="mono-regression-test-Win32.props" />\r
-    <Import Project="mono-regression-test.props" />\r
+    <Import Project="mono-test.props" />\r
+    <Import Project="mono-test-Win32.props" />\r
     <Import Project="mono-mini-regression-test.props" />\r
+    <Import Project="mono-test-env.props" />\r
   </ImportGroup>\r
   <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">\r
     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
     <Import Project="mono.props" />\r
-    <Import Project="mono-regression-test-Win32.props" />\r
-    <Import Project="mono-regression-test.props" />\r
+    <Import Project="mono-test.props" />\r
+    <Import Project="mono-test-Win32.props" />\r
     <Import Project="mono-mini-regression-test.props" />\r
+    <Import Project="mono-test-env.props" />\r
   </ImportGroup>\r
   <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">\r
     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
     <Import Project="mono.props" />\r
-    <Import Project="mono-regression-test-x64.props" />\r
-    <Import Project="mono-regression-test.props" />\r
+    <Import Project="mono-test.props" />\r
+    <Import Project="mono-test-x64.props" />\r
     <Import Project="mono-mini-regression-test.props" />\r
+    <Import Project="mono-test-env.props" />\r
   </ImportGroup>\r
   <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">\r
     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
     <Import Project="mono.props" />\r
-    <Import Project="mono-regression-test-x64.props" />\r
-    <Import Project="mono-regression-test.props" />\r
+    <Import Project="mono-test.props" />\r
+    <Import Project="mono-test-x64.props" />\r
     <Import Project="mono-mini-regression-test.props" />\r
+    <Import Project="mono-test-env.props" />\r
   </ImportGroup>\r
   <PropertyGroup Label="UserMacros" />\r
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">\r
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">\r
     <LocalDebuggerCommand>$(MONO_EXECUTABLE)</LocalDebuggerCommand>\r
     <LocalDebuggerCommandArguments>$(MONO_MINI_REGRESSION_TEST_ARGS)</LocalDebuggerCommandArguments>\r
-    <LocalDebuggerWorkingDirectory>$(MONO_EXECUTABLE_DIR)</LocalDebuggerWorkingDirectory>\r
+    <LocalDebuggerWorkingDirectory>$(MONO_MINI_REGRESSION_TEST_DIR)</LocalDebuggerWorkingDirectory>\r
     <LocalDebuggerEnvironment>$(MONO_PATH_ENV)\r
 $(MONO_CFG_DIR_ENV)\r
 $(MONO_TOOLCHAIN_PATH_ENV)\r
@@ -122,7 +126,7 @@ $(LocalDebuggerEnvironment)</LocalDebuggerEnvironment>
     <LocalDebuggerCommand>$(MONO_EXECUTABLE)</LocalDebuggerCommand>\r
     <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>\r
     <LocalDebuggerCommandArguments>$(MONO_MINI_REGRESSION_TEST_ARGS)</LocalDebuggerCommandArguments>\r
-    <LocalDebuggerWorkingDirectory>$(MONO_EXECUTABLE_DIR)</LocalDebuggerWorkingDirectory>\r
+    <LocalDebuggerWorkingDirectory>$(MONO_MINI_REGRESSION_TEST_DIR)</LocalDebuggerWorkingDirectory>\r
     <LocalDebuggerEnvironment>$(MONO_PATH_ENV)\r
 $(MONO_CFG_DIR_ENV)\r
 $(MONO_TOOLCHAIN_PATH_ENV)\r
@@ -134,7 +138,7 @@ $(LocalDebuggerEnvironment)</LocalDebuggerEnvironment>
     <LocalDebuggerCommand>$(MONO_EXECUTABLE)</LocalDebuggerCommand>\r
     <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>\r
     <LocalDebuggerCommandArguments>$(MONO_MINI_REGRESSION_TEST_ARGS)</LocalDebuggerCommandArguments>\r
-    <LocalDebuggerWorkingDirectory>$(MONO_EXECUTABLE_DIR)</LocalDebuggerWorkingDirectory>\r
+    <LocalDebuggerWorkingDirectory>$(MONO_MINI_REGRESSION_TEST_DIR)</LocalDebuggerWorkingDirectory>\r
     <LocalDebuggerEnvironment>$(MONO_PATH_ENV)\r
 $(MONO_CFG_DIR_ENV)\r
 $(MONO_TOOLCHAIN_PATH_ENV)\r
@@ -146,7 +150,7 @@ $(LocalDebuggerEnvironment)</LocalDebuggerEnvironment>
     <LocalDebuggerCommand>$(MONO_EXECUTABLE)</LocalDebuggerCommand>\r
     <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>\r
     <LocalDebuggerCommandArguments>$(MONO_MINI_REGRESSION_TEST_ARGS)</LocalDebuggerCommandArguments>\r
-    <LocalDebuggerWorkingDirectory>$(MONO_EXECUTABLE_DIR)</LocalDebuggerWorkingDirectory>\r
+    <LocalDebuggerWorkingDirectory>$(MONO_MINI_REGRESSION_TEST_DIR)</LocalDebuggerWorkingDirectory>\r
     <LocalDebuggerEnvironment>$(MONO_PATH_ENV)\r
 $(MONO_CFG_DIR_ENV)\r
 $(MONO_TOOLCHAIN_PATH_ENV)\r
diff --git a/msvc/mono-nunit-test.props b/msvc/mono-nunit-test.props
new file mode 100644 (file)
index 0000000..5c3c2b7
--- /dev/null
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup Label="UserMacros">
+    <MONO_NUNIT_TEST_DIR>$(MONO_DIR)/mcs/class/System</MONO_NUNIT_TEST_DIR>
+    <MONO_NUNIT_TARGET>$(MONO_DIR)/mcs/class/lib/net_4_x/nunit-console.exe</MONO_NUNIT_TARGET>
+    <MONO_PATH>$(MONO_PATH);$(MONO_NUNIT_TEST_DIR)</MONO_PATH>
+    <MONO_CFG_DIR>$(MONO_DIR)/runtime/etc</MONO_CFG_DIR>
+    <MONO_NUNIT_RUN_TARGET>net_4_x_System_test.dll</MONO_NUNIT_RUN_TARGET>
+    <MONO_NUNIT_FIXTURE></MONO_NUNIT_FIXTURE>
+    <MONO_NUNIT_ARGS>-noshadow -exclude=NotWorking,ValueAdd,CAS,InetAccess /labels</MONO_NUNIT_ARGS>
+    <MONO_NUNIT_ARGS Condition="'$(MONO_NUNIT_FIXTURE)'!=''">$(MONO_NUNIT_ARGS) -fixture $(MONO_NUNIT_FIXTURE)</MONO_NUNIT_ARGS>
+    <MONO_NUNIT_RUN_ADDITIONAL_ARGS>
+    </MONO_NUNIT_RUN_ADDITIONAL_ARGS>
+    <MONO_NUNIT_RUN_ARGS>"$(MONO_NUNIT_TARGET)" "$(MONO_NUNIT_RUN_TARGET)" $(MONO_NUNIT_ARGS) $(MONO_NUNIT_RUN_ADDITIONAL_ARGS)</MONO_NUNIT_RUN_ARGS>
+  </PropertyGroup>
+  <ItemGroup>
+    <BuildMacro Include="MONO_NUNIT_TEST_DIR">
+      <Value>$(MONO_NUNIT_TEST_DIR)</Value>
+    </BuildMacro>
+    <BuildMacro Include="MONO_NUNIT_TARGET">
+      <Value>$(MONO_NUNIT_TARGET)</Value>
+    </BuildMacro>
+    <BuildMacro Include="MONO_PATH">
+      <Value>$(MONO_PATH)</Value>
+    </BuildMacro>
+    <BuildMacro Include="MONO_CFG_DIR">
+      <Value>$(MONO_CFG_DIR)</Value>
+    </BuildMacro>
+    <BuildMacro Include="MONO_NUNIT_RUN_TARGET">
+      <Value>$(MONO_NUNIT_RUN_TARGET)</Value>
+    </BuildMacro>
+    <BuildMacro Include="MONO_NUNIT_FIXTURE">
+      <Value>$(MONO_NUNIT_FIXTURE)</Value>
+    </BuildMacro>
+    <BuildMacro Include="MONO_NUNIT_ARGS">
+      <Value>$(MONO_NUNIT_ARGS)</Value>
+    </BuildMacro>
+    <BuildMacro Include="MONO_NUNIT_RUN_ADDITIONAL_ARGS">
+      <Value>$(MONO_NUNIT_RUN_ADDITIONAL_ARGS)</Value>
+    </BuildMacro>
+    <BuildMacro Include="MONO_NUNIT_RUN_ARGS">
+      <Value>$(MONO_NUNIT_RUN_ARGS)</Value>
+    </BuildMacro>
+  </ItemGroup>
+  <ItemDefinitionGroup />
+</Project>
\ No newline at end of file
diff --git a/msvc/mono-nunit-test.vcxproj b/msvc/mono-nunit-test.vcxproj
new file mode 100644 (file)
index 0000000..0e9d6f8
--- /dev/null
@@ -0,0 +1,224 @@
+<?xml version="1.0" encoding="utf-8"?>\r
+<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
+  <ItemGroup Label="ProjectConfigurations">\r
+    <ProjectConfiguration Include="Debug|Win32">\r
+      <Configuration>Debug</Configuration>\r
+      <Platform>Win32</Platform>\r
+    </ProjectConfiguration>\r
+    <ProjectConfiguration Include="Release|Win32">\r
+      <Configuration>Release</Configuration>\r
+      <Platform>Win32</Platform>\r
+    </ProjectConfiguration>\r
+    <ProjectConfiguration Include="Debug|x64">\r
+      <Configuration>Debug</Configuration>\r
+      <Platform>x64</Platform>\r
+    </ProjectConfiguration>\r
+    <ProjectConfiguration Include="Release|x64">\r
+      <Configuration>Release</Configuration>\r
+      <Platform>x64</Platform>\r
+    </ProjectConfiguration>\r
+  </ItemGroup>\r
+  <ItemGroup>\r
+    <ProjectReference Include="mono.vcxproj">\r
+      <Project>{a0eddcd9-940f-432c-a28f-7ef322437d79}</Project>\r
+    </ProjectReference>\r
+  </ItemGroup>\r
+  <PropertyGroup Label="Globals">\r
+    <ProjectGuid>{0046B994-40A8-4C64-AC9D-429DC9177B54}</ProjectGuid>\r
+    <Keyword>Win32Proj</Keyword>\r
+    <RootNamespace>mononunittest</RootNamespace>\r
+    <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>\r
+  </PropertyGroup>\r
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />\r
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">\r
+    <ConfigurationType>Utility</ConfigurationType>\r
+    <UseDebugLibraries>true</UseDebugLibraries>\r
+    <PlatformToolset>v140</PlatformToolset>\r
+    <CharacterSet>Unicode</CharacterSet>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">\r
+    <ConfigurationType>Utility</ConfigurationType>\r
+    <UseDebugLibraries>false</UseDebugLibraries>\r
+    <PlatformToolset>v140</PlatformToolset>\r
+    <WholeProgramOptimization>true</WholeProgramOptimization>\r
+    <CharacterSet>Unicode</CharacterSet>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">\r
+    <ConfigurationType>Utility</ConfigurationType>\r
+    <UseDebugLibraries>true</UseDebugLibraries>\r
+    <PlatformToolset>v140</PlatformToolset>\r
+    <CharacterSet>Unicode</CharacterSet>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">\r
+    <ConfigurationType>Utility</ConfigurationType>\r
+    <UseDebugLibraries>false</UseDebugLibraries>\r
+    <PlatformToolset>v140</PlatformToolset>\r
+    <WholeProgramOptimization>true</WholeProgramOptimization>\r
+    <CharacterSet>Unicode</CharacterSet>\r
+  </PropertyGroup>\r
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />\r
+  <ImportGroup Label="ExtensionSettings">\r
+  </ImportGroup>\r
+  <ImportGroup Label="Shared">\r
+  </ImportGroup>\r
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">\r
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
+    <Import Project="mono.props" />\r
+    <Import Project="mono-test.props" />\r
+    <Import Project="mono-test-Win32.props" />\r
+    <Import Project="mono-nunit-test.props" />\r
+    <Import Project="mono-test-env.props" />\r
+  </ImportGroup>\r
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">\r
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
+    <Import Project="mono.props" />\r
+    <Import Project="mono-test.props" />\r
+    <Import Project="mono-test-Win32.props" />\r
+    <Import Project="mono-nunit-test.props" />\r
+    <Import Project="mono-test-env.props" />\r
+  </ImportGroup>\r
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">\r
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
+    <Import Project="mono.props" />\r
+    <Import Project="mono-test.props" />\r
+    <Import Project="mono-test-x64.props" />\r
+    <Import Project="mono-nunit-test.props" />\r
+    <Import Project="mono-test-env.props" />\r
+  </ImportGroup>\r
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">\r
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
+    <Import Project="mono.props" />\r
+    <Import Project="mono-test.props" />\r
+    <Import Project="mono-test-x64.props" />\r
+    <Import Project="mono-nunit-test.props" />\r
+    <Import Project="mono-test-env.props" />\r
+  </ImportGroup>\r
+  <PropertyGroup Label="UserMacros" />\r
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">\r
+    <LinkIncremental>true</LinkIncremental>\r
+    <OutDir>$(MONO_BUILD_DIR_PREFIX)$(Platform)\lib\$(Configuration)\</OutDir>\r
+    <IntDir>$(MONO_BUILD_DIR_PREFIX)$(Platform)\obj\$(ProjectName)\$(Configuration)\</IntDir>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">\r
+    <LinkIncremental>true</LinkIncremental>\r
+    <OutDir>$(MONO_BUILD_DIR_PREFIX)$(Platform)\lib\$(Configuration)\</OutDir>\r
+    <IntDir>$(MONO_BUILD_DIR_PREFIX)$(Platform)\obj\$(ProjectName)\$(Configuration)\</IntDir>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">\r
+    <LinkIncremental>false</LinkIncremental>\r
+    <OutDir>$(MONO_BUILD_DIR_PREFIX)$(Platform)\lib\$(Configuration)\</OutDir>\r
+    <IntDir>$(MONO_BUILD_DIR_PREFIX)$(Platform)\obj\$(ProjectName)\$(Configuration)\</IntDir>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">\r
+    <LinkIncremental>false</LinkIncremental>\r
+    <OutDir>$(MONO_BUILD_DIR_PREFIX)$(Platform)\lib\$(Configuration)\</OutDir>\r
+    <IntDir>$(MONO_BUILD_DIR_PREFIX)$(Platform)\obj\$(ProjectName)\$(Configuration)\</IntDir>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">\r
+    <LocalDebuggerCommand>$(MONO_EXECUTABLE)</LocalDebuggerCommand>\r
+    <LocalDebuggerCommandArguments>$(MONO_NUNIT_RUN_ARGS)</LocalDebuggerCommandArguments>\r
+    <LocalDebuggerWorkingDirectory>$(MONO_NUNIT_TEST_DIR)</LocalDebuggerWorkingDirectory>\r
+    <LocalDebuggerEnvironment>$(MONO_PATH_ENV)\r
+$(MONO_CFG_DIR_ENV)\r
+$(MONO_TOOLCHAIN_PATH_ENV)\r
+$(MONO_LOG_LEVEL_ENV)\r
+$(MONO_LOG_MASK_ENV)\r
+$(LocalDebuggerEnvironment)</LocalDebuggerEnvironment>\r
+    <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">\r
+    <LocalDebuggerCommand>$(MONO_EXECUTABLE)</LocalDebuggerCommand>\r
+    <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>\r
+    <LocalDebuggerCommandArguments>$(MONO_NUNIT_RUN_ARGS)</LocalDebuggerCommandArguments>\r
+    <LocalDebuggerWorkingDirectory>$(MONO_NUNIT_TEST_DIR)</LocalDebuggerWorkingDirectory>\r
+    <LocalDebuggerEnvironment>$(MONO_PATH_ENV)\r
+$(MONO_CFG_DIR_ENV)\r
+$(MONO_TOOLCHAIN_PATH_ENV)\r
+$(MONO_LOG_LEVEL_ENV)\r
+$(MONO_LOG_MASK_ENV)\r
+$(LocalDebuggerEnvironment)</LocalDebuggerEnvironment>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">\r
+    <LocalDebuggerCommand>$(MONO_EXECUTABLE)</LocalDebuggerCommand>\r
+    <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>\r
+    <LocalDebuggerCommandArguments>$(MONO_NUNIT_RUN_ARGS)</LocalDebuggerCommandArguments>\r
+    <LocalDebuggerWorkingDirectory>$(MONO_NUNIT_TEST_DIR)</LocalDebuggerWorkingDirectory>\r
+    <LocalDebuggerEnvironment>$(MONO_PATH_ENV)\r
+$(MONO_CFG_DIR_ENV)\r
+$(MONO_TOOLCHAIN_PATH_ENV)\r
+$(MONO_LOG_LEVEL_ENV)\r
+$(MONO_LOG_MASK_ENV)\r
+$(LocalDebuggerEnvironment)</LocalDebuggerEnvironment>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">\r
+    <LocalDebuggerCommand>$(MONO_EXECUTABLE)</LocalDebuggerCommand>\r
+    <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>\r
+    <LocalDebuggerCommandArguments>$(MONO_NUNIT_RUN_ARGS)</LocalDebuggerCommandArguments>\r
+    <LocalDebuggerWorkingDirectory>$(MONO_NUNIT_TEST_DIR)</LocalDebuggerWorkingDirectory>\r
+    <LocalDebuggerEnvironment>$(MONO_PATH_ENV)\r
+$(MONO_CFG_DIR_ENV)\r
+$(MONO_TOOLCHAIN_PATH_ENV)\r
+$(MONO_LOG_LEVEL_ENV)\r
+$(MONO_LOG_MASK_ENV)\r
+$(LocalDebuggerEnvironment)</LocalDebuggerEnvironment>\r
+  </PropertyGroup>\r
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">\r
+    <ClCompile>\r
+      <WarningLevel>Level3</WarningLevel>\r
+      <Optimization>Disabled</Optimization>\r
+      <SDLCheck>true</SDLCheck>\r
+    </ClCompile>\r
+    <PreBuildEvent>\r
+      <Command>\r
+      </Command>\r
+    </PreBuildEvent>\r
+  </ItemDefinitionGroup>\r
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">\r
+    <ClCompile>\r
+      <WarningLevel>Level3</WarningLevel>\r
+      <Optimization>Disabled</Optimization>\r
+      <SDLCheck>true</SDLCheck>\r
+    </ClCompile>\r
+    <PreBuildEvent>\r
+      <Command>\r
+      </Command>\r
+    </PreBuildEvent>\r
+  </ItemDefinitionGroup>\r
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">\r
+    <ClCompile>\r
+      <WarningLevel>Level3</WarningLevel>\r
+      <Optimization>MaxSpeed</Optimization>\r
+      <FunctionLevelLinking>true</FunctionLevelLinking>\r
+      <IntrinsicFunctions>true</IntrinsicFunctions>\r
+      <SDLCheck>true</SDLCheck>\r
+    </ClCompile>\r
+    <Link>\r
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>\r
+      <OptimizeReferences>true</OptimizeReferences>\r
+    </Link>\r
+    <PreBuildEvent>\r
+      <Command>\r
+      </Command>\r
+    </PreBuildEvent>\r
+  </ItemDefinitionGroup>\r
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">\r
+    <ClCompile>\r
+      <WarningLevel>Level3</WarningLevel>\r
+      <Optimization>MaxSpeed</Optimization>\r
+      <FunctionLevelLinking>true</FunctionLevelLinking>\r
+      <IntrinsicFunctions>true</IntrinsicFunctions>\r
+      <SDLCheck>true</SDLCheck>\r
+    </ClCompile>\r
+    <Link>\r
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>\r
+      <OptimizeReferences>true</OptimizeReferences>\r
+    </Link>\r
+    <PreBuildEvent>\r
+      <Command>\r
+      </Command>\r
+    </PreBuildEvent>\r
+  </ItemDefinitionGroup>\r
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />\r
+  <ImportGroup Label="ExtensionTargets">\r
+  </ImportGroup>\r
+</Project>
\ No newline at end of file
diff --git a/msvc/mono-regression-test-Win32.props b/msvc/mono-regression-test-Win32.props
deleted file mode 100644 (file)
index c74e5c8..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <ImportGroup Label="PropertySheets" />
-  <PropertyGroup Label="UserMacros">
-    <MONO_TOOLCHAIN_PREFIX>i686-w64-mingw32-</MONO_TOOLCHAIN_PREFIX>
-    <MONO_TOOLCHAIN_PATH>C:/ProgramData/chocolatey/lib/Cygwin/tools/cygwin/bin</MONO_TOOLCHAIN_PATH>
-  </PropertyGroup>
-  <PropertyGroup />
-  <ItemDefinitionGroup />
-  <ItemGroup>
-    <BuildMacro Include="MONO_TOOLCHAIN_PREFIX">
-      <Value>$(MONO_TOOLCHAIN_PREFIX)</Value>
-    </BuildMacro>
-    <BuildMacro Include="MONO_TOOLCHAIN_PATH">
-      <Value>$(MONO_TOOLCHAIN_PATH)</Value>
-    </BuildMacro>
-  </ItemGroup>
-</Project>
\ No newline at end of file
diff --git a/msvc/mono-regression-test-x64.props b/msvc/mono-regression-test-x64.props
deleted file mode 100644 (file)
index a2724a9..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <ImportGroup Label="PropertySheets" />
-  <PropertyGroup Label="UserMacros">
-    <MONO_TOOLCHAIN_PREFIX>x86_64-w64-mingw32-</MONO_TOOLCHAIN_PREFIX>
-    <MONO_TOOLCHAIN_PATH>C:/ProgramData/chocolatey/lib/Cygwin/tools/cygwin/bin</MONO_TOOLCHAIN_PATH>
-  </PropertyGroup>
-  <PropertyGroup />
-  <ItemDefinitionGroup />
-  <ItemGroup>
-    <BuildMacro Include="MONO_TOOLCHAIN_PREFIX">
-      <Value>$(MONO_TOOLCHAIN_PREFIX)</Value>
-    </BuildMacro>
-    <BuildMacro Include="MONO_TOOLCHAIN_PATH">
-      <Value>$(MONO_TOOLCHAIN_PATH)</Value>
-    </BuildMacro>
-  </ItemGroup>
-</Project>
\ No newline at end of file
diff --git a/msvc/mono-regression-test.props b/msvc/mono-regression-test.props
deleted file mode 100644 (file)
index d4e6bf6..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <!--<ImportGroup Label="PropertySheets" />-->
-  <PropertyGroup Label="UserMacros">
-    <MONO_PATH>$(MONO_DIR)/mcs/class/lib/net_4_x</MONO_PATH>
-    <MONO_CFG_DIR>$(MONO_DIR)/runtime/etc</MONO_CFG_DIR>
-    <MONO_CONFIG_ARG>--config "$(MONO_DIR)/runtime/etc/mono/config"</MONO_CONFIG_ARG>
-    <MONO_MINI_REGRESSION_TEST_DIR>$(MONO_DIR)/mono/mini</MONO_MINI_REGRESSION_TEST_DIR>
-    <MONO_MINI_REGRESSION_TESTS>basic.exe basic-float.exe basic-long.exe basic-calls.exe objects.exe arrays.exe basic-math.exe exceptions.exe iltests.exe devirtualization.exe generics.exe basic-simd.exe</MONO_MINI_REGRESSION_TESTS>
-    <MONO_EXECUTABLE>$(MONO_BUILD_DIR_PREFIX)$(Platform)/bin/$(Configuration)/mono$(MONO_TARGET_SUFFIX).exe</MONO_EXECUTABLE>
-    <MONO_EXECUTABLE_DIR>$(MONO_MINI_REGRESSION_TEST_DIR)</MONO_EXECUTABLE_DIR>
-    <MONO_PATH_ENV>MONO_PATH=$(MONO_PATH)</MONO_PATH_ENV>
-    <MONO_CFG_DIR_ENV>MONO_CFG_DIR=$(MONO_CFG_DIR)</MONO_CFG_DIR_ENV>
-    <MONO_TOOLCHAIN_PATH_ENV>PATH=$(MONO_TOOLCHAIN_PATH)</MONO_TOOLCHAIN_PATH_ENV>
-    <MONO_LOG_LEVEL_ENV>MONO_LOG_LEVEL=debug</MONO_LOG_LEVEL_ENV>
-    <MONO_LOG_MASK_ENV>MONO_LOG_MASK=asm,aot</MONO_LOG_MASK_ENV>
-  </PropertyGroup>
-  <ItemGroup>
-    <BuildMacro Include="MONO_PATH">
-      <Value>$(MONO_PATH)</Value>
-    </BuildMacro>
-    <BuildMacro Include="MONO_CFG_DIR">
-      <Value>$(MONO_CFG_DIR)</Value>
-    </BuildMacro>
-    <BuildMacro Include="MONO_CONFIG_ARG">
-      <Value>$(MONO_CONFIG_ARG)</Value>
-    </BuildMacro>
-    <BuildMacro Include="MONO_MINI_REGRESSION_TEST_DIR">
-      <Value>$(MONO_MINI_REGRESSION_TEST_DIR)</Value>
-    </BuildMacro>
-    <BuildMacro Include="MONO_MINI_REGRESSION_TESTS">
-      <Value>$(MONO_MINI_REGRESSION_TESTS)</Value>
-    </BuildMacro>
-    <BuildMacro Include="MONO_EXECUTABLE">
-      <Value>$(MONO_EXECUTABLE)</Value>
-    </BuildMacro>
-    <BuildMacro Include="MONO_EXECUTABLE_DIR">
-      <Value>$(MONO_EXECUTABLE_DIR)</Value>
-    </BuildMacro>
-    <BuildMacro Include="MONO_PATH_ENV">
-      <Value>$(MONO_PATH_ENV)</Value>
-    </BuildMacro>
-    <BuildMacro Include="MONO_CFG_DIR_ENV">
-      <Value>$(MONO_CFG_DIR_ENV)</Value>
-    </BuildMacro>
-    <BuildMacro Include="MONO_TOOLCHAIN_PATH_ENV">
-      <Value>$(MONO_TOOLCHAIN_PATH_ENV)</Value>
-    </BuildMacro>
-    <BuildMacro Include="MONO_LOG_LEVEL_ENV">
-      <Value>$(MONO_LOG_LEVEL_ENV)</Value>
-    </BuildMacro>
-    <BuildMacro Include="MONO_LOG_MASK_ENV">
-      <Value>$(MONO_LOG_MASK_ENV)</Value>
-    </BuildMacro>
-  </ItemGroup>
-  <ItemDefinitionGroup />
-</Project>
\ No newline at end of file
diff --git a/msvc/mono-test-Win32.props b/msvc/mono-test-Win32.props
new file mode 100644 (file)
index 0000000..c289e0f
--- /dev/null
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ImportGroup Label="PropertySheets" />
+  <PropertyGroup Label="UserMacros">
+    <MONO_TOOLCHAIN_PREFIX>i686-w64-mingw32-</MONO_TOOLCHAIN_PREFIX>
+  </PropertyGroup>
+  <PropertyGroup />
+  <ItemDefinitionGroup />
+  <ItemGroup>
+    <BuildMacro Include="MONO_TOOLCHAIN_PREFIX">
+      <Value>$(MONO_TOOLCHAIN_PREFIX)</Value>
+    </BuildMacro>
+  </ItemGroup>
+</Project>
\ No newline at end of file
diff --git a/msvc/mono-test-env.props b/msvc/mono-test-env.props
new file mode 100644 (file)
index 0000000..51dcb2a
--- /dev/null
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup Label="UserMacros">
+    <MONO_PATH_ENV>MONO_PATH=$(MONO_PATH)</MONO_PATH_ENV>
+    <MONO_CFG_DIR_ENV>MONO_CFG_DIR=$(MONO_CFG_DIR)</MONO_CFG_DIR_ENV>
+    <MONO_TOOLCHAIN_PATH_ENV>PATH=$(MONO_TOOLCHAIN_PATH)</MONO_TOOLCHAIN_PATH_ENV>
+    <MONO_LOG_LEVEL_ENV>MONO_LOG_LEVEL=</MONO_LOG_LEVEL_ENV>
+    <MONO_LOG_MASK_ENV>MONO_LOG_MASK=</MONO_LOG_MASK_ENV>
+  </PropertyGroup>
+  <ItemGroup>
+    <BuildMacro Include="MONO_PATH_ENV">
+      <Value>$(MONO_PATH_ENV)</Value>
+    </BuildMacro>
+    <BuildMacro Include="MONO_CFG_DIR_ENV">
+      <Value>$(MONO_CFG_DIR_ENV)</Value>
+    </BuildMacro>
+    <BuildMacro Include="MONO_TOOLCHAIN_PATH_ENV">
+      <Value>$(MONO_TOOLCHAIN_PATH_ENV)</Value>
+    </BuildMacro>
+    <BuildMacro Include="MONO_LOG_LEVEL_ENV">
+      <Value>$(MONO_LOG_LEVEL_ENV)</Value>
+    </BuildMacro>
+    <BuildMacro Include="MONO_LOG_MASK_ENV">
+      <Value>$(MONO_LOG_MASK_ENV)</Value>
+    </BuildMacro>
+  </ItemGroup>
+  <ItemDefinitionGroup />
+</Project>
\ No newline at end of file
diff --git a/msvc/mono-test-x64.props b/msvc/mono-test-x64.props
new file mode 100644 (file)
index 0000000..8b105ea
--- /dev/null
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ImportGroup Label="PropertySheets" />
+  <PropertyGroup Label="UserMacros">
+    <MONO_TOOLCHAIN_PREFIX>x86_64-w64-mingw32-</MONO_TOOLCHAIN_PREFIX>
+  </PropertyGroup>
+  <PropertyGroup />
+  <ItemDefinitionGroup />
+  <ItemGroup>
+    <BuildMacro Include="MONO_TOOLCHAIN_PREFIX">
+      <Value>$(MONO_TOOLCHAIN_PREFIX)</Value>
+    </BuildMacro>
+  </ItemGroup>
+</Project>
\ No newline at end of file
diff --git a/msvc/mono-test.props b/msvc/mono-test.props
new file mode 100644 (file)
index 0000000..b6179b1
--- /dev/null
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup Label="UserMacros">
+       <MONO_TOOLCHAIN_PATH>C:/tools/cygwin/bin</MONO_TOOLCHAIN_PATH>
+    <MONO_PATH>$(MONO_DIR)/mcs/class/lib/net_4_x</MONO_PATH>
+       <MONO_EXECUTABLE_DIR>$(MONO_BUILD_DIR_PREFIX)$(Platform)/bin/$(Configuration)</MONO_EXECUTABLE_DIR>
+    <MONO_EXECUTABLE>$(MONO_EXECUTABLE_DIR)/mono$(MONO_TARGET_SUFFIX).exe</MONO_EXECUTABLE>
+  </PropertyGroup>
+  <ItemGroup>
+    <BuildMacro Include="MONO_TOOLCHAIN_PATH">
+      <Value>$(MONO_TOOLCHAIN_PATH)</Value>
+    </BuildMacro>
+    <BuildMacro Include="MONO_PATH">
+      <Value>$(MONO_PATH)</Value>
+    </BuildMacro>
+       <BuildMacro Include="MONO_EXECUTABLE_DIR">
+      <Value>$(MONO_EXECUTABLE_DIR)</Value>
+    </BuildMacro>
+    <BuildMacro Include="MONO_EXECUTABLE">
+      <Value>$(MONO_EXECUTABLE)</Value>
+    </BuildMacro>
+  </ItemGroup>
+  <ItemDefinitionGroup />
+</Project>
\ No newline at end of file
diff --git a/msvc/mono-testdriver-test.props b/msvc/mono-testdriver-test.props
new file mode 100644 (file)
index 0000000..1c03bbd
--- /dev/null
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup Label="UserMacros">
+    <MONO_TESTDRIVER_TEST_DIR>$(MONO_DIR)/mono/tests</MONO_TESTDRIVER_TEST_DIR>
+    <MONO_PATH>$(MONO_PATH);$(MONO_TESTDRIVER_TEST_DIR)</MONO_PATH>
+       <MONO_CONFIG_PATH>$(MONO_EXECUTABLE_DIR)\tests-config.xml</MONO_CONFIG_PATH>
+    <MONO_CONFIG_ARG>--config "$(MONO_CONFIG_PATH)"</MONO_CONFIG_ARG>
+    <MONO_TESTDRIVER_RUN_TARGET>winx64structs.exe</MONO_TESTDRIVER_RUN_TARGET>
+    <MONO_TESTDRIVER_RUN_ADDITIONAL_ARGS>
+    </MONO_TESTDRIVER_RUN_ADDITIONAL_ARGS>
+    <MONO_TESTDRIVER_RUN_ARGS>$(MONO_CONFIG_ARG) "$(MONO_TESTDRIVER_RUN_TARGET)" $(MONO_TESTDRIVER_RUN_ADDITIONAL_ARGS)</MONO_TESTDRIVER_RUN_ARGS>
+  </PropertyGroup>
+  <ItemGroup>
+    <BuildMacro Include="MONO_TESTDRIVER_TEST_DIR">
+      <Value>$(MONO_TESTDRIVER_TEST_DIR)</Value>
+    </BuildMacro>
+    <BuildMacro Include="MONO_PATH">
+      <Value>$(MONO_PATH)</Value>
+    </BuildMacro>
+       <BuildMacro Include="MONO_CONFIG_PATH">
+      <Value>$(MONO_CONFIG_PATH)</Value>
+    </BuildMacro>
+    <BuildMacro Include="MONO_CONFIG_ARG">
+      <Value>$(MONO_CONFIG_ARG)</Value>
+    </BuildMacro>
+    <BuildMacro Include="MONO_TESTDRIVER_RUN_TARGET">
+      <Value>$(MONO_TESTDRIVER_RUN_TARGET)</Value>
+    </BuildMacro>
+    <BuildMacro Include="MONO_TESTDRIVER_RUN_ADDITIONAL_ARGS">
+      <Value>$(MONO_TESTDRIVER_RUN_ADDITIONAL_ARGS)</Value>
+    </BuildMacro>
+    <BuildMacro Include="MONO_TESTDRIVER_RUN_ARGS">
+      <Value>$(MONO_TESTDRIVER_RUN_ARGS)</Value>
+    </BuildMacro>
+  </ItemGroup>
+  <ItemDefinitionGroup />
+</Project>
\ No newline at end of file
diff --git a/msvc/mono-testdriver-test.vcxproj b/msvc/mono-testdriver-test.vcxproj
new file mode 100644 (file)
index 0000000..fce7b4d
--- /dev/null
@@ -0,0 +1,220 @@
+<?xml version="1.0" encoding="utf-8"?>\r
+<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
+  <ItemGroup Label="ProjectConfigurations">\r
+    <ProjectConfiguration Include="Debug|Win32">\r
+      <Configuration>Debug</Configuration>\r
+      <Platform>Win32</Platform>\r
+    </ProjectConfiguration>\r
+    <ProjectConfiguration Include="Release|Win32">\r
+      <Configuration>Release</Configuration>\r
+      <Platform>Win32</Platform>\r
+    </ProjectConfiguration>\r
+    <ProjectConfiguration Include="Debug|x64">\r
+      <Configuration>Debug</Configuration>\r
+      <Platform>x64</Platform>\r
+    </ProjectConfiguration>\r
+    <ProjectConfiguration Include="Release|x64">\r
+      <Configuration>Release</Configuration>\r
+      <Platform>x64</Platform>\r
+    </ProjectConfiguration>\r
+  </ItemGroup>\r
+  <ItemGroup>\r
+    <ProjectReference Include="mono.vcxproj">\r
+      <Project>{a0eddcd9-940f-432c-a28f-7ef322437d79}</Project>\r
+    </ProjectReference>\r
+  </ItemGroup>\r
+  <PropertyGroup Label="Globals">\r
+    <ProjectGuid>{7BECCFA0-28A0-4995-9856-558560F720E6}</ProjectGuid>\r
+    <Keyword>Win32Proj</Keyword>\r
+    <RootNamespace>monotestdrivertest</RootNamespace>\r
+    <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>\r
+  </PropertyGroup>\r
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />\r
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">\r
+    <ConfigurationType>Utility</ConfigurationType>\r
+    <UseDebugLibraries>true</UseDebugLibraries>\r
+    <PlatformToolset>v140</PlatformToolset>\r
+    <CharacterSet>Unicode</CharacterSet>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">\r
+    <ConfigurationType>Utility</ConfigurationType>\r
+    <UseDebugLibraries>false</UseDebugLibraries>\r
+    <PlatformToolset>v140</PlatformToolset>\r
+    <WholeProgramOptimization>true</WholeProgramOptimization>\r
+    <CharacterSet>Unicode</CharacterSet>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">\r
+    <ConfigurationType>Utility</ConfigurationType>\r
+    <UseDebugLibraries>true</UseDebugLibraries>\r
+    <PlatformToolset>v140</PlatformToolset>\r
+    <CharacterSet>Unicode</CharacterSet>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">\r
+    <ConfigurationType>Utility</ConfigurationType>\r
+    <UseDebugLibraries>false</UseDebugLibraries>\r
+    <PlatformToolset>v140</PlatformToolset>\r
+    <WholeProgramOptimization>true</WholeProgramOptimization>\r
+    <CharacterSet>Unicode</CharacterSet>\r
+  </PropertyGroup>\r
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />\r
+  <ImportGroup Label="ExtensionSettings">\r
+  </ImportGroup>\r
+  <ImportGroup Label="Shared">\r
+  </ImportGroup>\r
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">\r
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
+    <Import Project="mono.props" />\r
+    <Import Project="mono-test.props" />\r
+    <Import Project="mono-test-Win32.props" />\r
+    <Import Project="mono-testdriver-test.props" />\r
+    <Import Project="mono-test-env.props" />\r
+  </ImportGroup>\r
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">\r
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
+    <Import Project="mono.props" />\r
+    <Import Project="mono-test.props" />\r
+    <Import Project="mono-test-Win32.props" />\r
+    <Import Project="mono-testdriver-test.props" />\r
+    <Import Project="mono-test-env.props" />\r
+  </ImportGroup>\r
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">\r
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
+    <Import Project="mono.props" />\r
+    <Import Project="mono-test.props" />\r
+    <Import Project="mono-test-x64.props" />\r
+    <Import Project="mono-testdriver-test.props" />\r
+    <Import Project="mono-test-env.props" />\r
+  </ImportGroup>\r
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">\r
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
+    <Import Project="mono.props" />\r
+    <Import Project="mono-test.props" />\r
+    <Import Project="mono-test-x64.props" />\r
+    <Import Project="mono-testdriver-test.props" />\r
+    <Import Project="mono-test-env.props" />\r
+  </ImportGroup>\r
+  <PropertyGroup Label="UserMacros" />\r
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">\r
+    <LinkIncremental>true</LinkIncremental>\r
+    <OutDir>$(MONO_BUILD_DIR_PREFIX)$(Platform)\lib\$(Configuration)\</OutDir>\r
+    <IntDir>$(MONO_BUILD_DIR_PREFIX)$(Platform)\obj\$(ProjectName)\$(Configuration)\</IntDir>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">\r
+    <LinkIncremental>true</LinkIncremental>\r
+    <OutDir>$(MONO_BUILD_DIR_PREFIX)$(Platform)\lib\$(Configuration)\</OutDir>\r
+    <IntDir>$(MONO_BUILD_DIR_PREFIX)$(Platform)\obj\$(ProjectName)\$(Configuration)\</IntDir>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">\r
+    <LinkIncremental>false</LinkIncremental>\r
+    <OutDir>$(MONO_BUILD_DIR_PREFIX)$(Platform)\lib\$(Configuration)\</OutDir>\r
+    <IntDir>$(MONO_BUILD_DIR_PREFIX)$(Platform)\obj\$(ProjectName)\$(Configuration)\</IntDir>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">\r
+    <LinkIncremental>false</LinkIncremental>\r
+    <OutDir>$(MONO_BUILD_DIR_PREFIX)$(Platform)\lib\$(Configuration)\</OutDir>\r
+    <IntDir>$(MONO_BUILD_DIR_PREFIX)$(Platform)\obj\$(ProjectName)\$(Configuration)\</IntDir>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">\r
+    <LocalDebuggerCommand>$(MONO_EXECUTABLE)</LocalDebuggerCommand>\r
+    <LocalDebuggerCommandArguments>$(MONO_TESTDRIVER_RUN_ARGS)</LocalDebuggerCommandArguments>\r
+    <LocalDebuggerWorkingDirectory>$(MONO_TESTDRIVER_TEST_DIR)</LocalDebuggerWorkingDirectory>\r
+    <LocalDebuggerEnvironment>$(MONO_PATH_ENV)\r
+$(MONO_CFG_DIR_ENV)\r
+$(MONO_TOOLCHAIN_PATH_ENV)\r
+$(MONO_LOG_LEVEL_ENV)\r
+$(MONO_LOG_MASK_ENV)\r
+$(LocalDebuggerEnvironment)</LocalDebuggerEnvironment>\r
+    <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">\r
+    <LocalDebuggerCommand>$(MONO_EXECUTABLE)</LocalDebuggerCommand>\r
+    <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>\r
+    <LocalDebuggerCommandArguments>$(MONO_TESTDRIVER_RUN_ARGS)</LocalDebuggerCommandArguments>\r
+    <LocalDebuggerWorkingDirectory>$(MONO_TESTDRIVER_TEST_DIR)</LocalDebuggerWorkingDirectory>\r
+    <LocalDebuggerEnvironment>$(MONO_PATH_ENV)\r
+$(MONO_CFG_DIR_ENV)\r
+$(MONO_TOOLCHAIN_PATH_ENV)\r
+$(MONO_LOG_LEVEL_ENV)\r
+$(MONO_LOG_MASK_ENV)\r
+$(LocalDebuggerEnvironment)</LocalDebuggerEnvironment>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">\r
+    <LocalDebuggerCommand>$(MONO_EXECUTABLE)</LocalDebuggerCommand>\r
+    <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>\r
+    <LocalDebuggerCommandArguments>$(MONO_TESTDRIVER_RUN_ARGS)</LocalDebuggerCommandArguments>\r
+    <LocalDebuggerWorkingDirectory>$(MONO_TESTDRIVER_TEST_DIR)</LocalDebuggerWorkingDirectory>\r
+    <LocalDebuggerEnvironment>$(MONO_PATH_ENV)\r
+$(MONO_CFG_DIR_ENV)\r
+$(MONO_TOOLCHAIN_PATH_ENV)\r
+$(MONO_LOG_LEVEL_ENV)\r
+$(MONO_LOG_MASK_ENV)\r
+$(LocalDebuggerEnvironment)</LocalDebuggerEnvironment>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">\r
+    <LocalDebuggerCommand>$(MONO_EXECUTABLE)</LocalDebuggerCommand>\r
+    <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>\r
+    <LocalDebuggerCommandArguments>$(MONO_TESTDRIVER_RUN_ARGS)</LocalDebuggerCommandArguments>\r
+    <LocalDebuggerWorkingDirectory>$(MONO_TESTDRIVER_TEST_DIR)</LocalDebuggerWorkingDirectory>\r
+    <LocalDebuggerEnvironment>$(MONO_PATH_ENV)\r
+$(MONO_CFG_DIR_ENV)\r
+$(MONO_TOOLCHAIN_PATH_ENV)\r
+$(MONO_LOG_LEVEL_ENV)\r
+$(MONO_LOG_MASK_ENV)\r
+$(LocalDebuggerEnvironment)</LocalDebuggerEnvironment>\r
+  </PropertyGroup>\r
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">\r
+    <ClCompile>\r
+      <WarningLevel>Level3</WarningLevel>\r
+      <Optimization>Disabled</Optimization>\r
+      <SDLCheck>true</SDLCheck>\r
+    </ClCompile>\r
+    <PreBuildEvent>\r
+      <Command>test-config-setup.bat "$(MONO_CONFIG_PATH)" "$(MONO_EXECUTABLE_DIR)" x86</Command>\r
+    </PreBuildEvent>\r
+  </ItemDefinitionGroup>\r
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">\r
+    <ClCompile>\r
+      <WarningLevel>Level3</WarningLevel>\r
+      <Optimization>Disabled</Optimization>\r
+      <SDLCheck>true</SDLCheck>\r
+    </ClCompile>\r
+    <PreBuildEvent>\r
+      <Command>test-config-setup.bat "$(MONO_CONFIG_PATH)" "$(MONO_EXECUTABLE_DIR)" x86-64</Command>\r
+    </PreBuildEvent>\r
+  </ItemDefinitionGroup>\r
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">\r
+    <ClCompile>\r
+      <WarningLevel>Level3</WarningLevel>\r
+      <Optimization>MaxSpeed</Optimization>\r
+      <FunctionLevelLinking>true</FunctionLevelLinking>\r
+      <IntrinsicFunctions>true</IntrinsicFunctions>\r
+      <SDLCheck>true</SDLCheck>\r
+    </ClCompile>\r
+    <Link>\r
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>\r
+      <OptimizeReferences>true</OptimizeReferences>\r
+    </Link>\r
+    <PreBuildEvent>\r
+      <Command>test-config-setup.bat "$(MONO_CONFIG_PATH)" "$(MONO_EXECUTABLE_DIR)" x86</Command>\r
+    </PreBuildEvent>\r
+  </ItemDefinitionGroup>\r
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">\r
+    <ClCompile>\r
+      <WarningLevel>Level3</WarningLevel>\r
+      <Optimization>MaxSpeed</Optimization>\r
+      <FunctionLevelLinking>true</FunctionLevelLinking>\r
+      <IntrinsicFunctions>true</IntrinsicFunctions>\r
+      <SDLCheck>true</SDLCheck>\r
+    </ClCompile>\r
+    <Link>\r
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>\r
+      <OptimizeReferences>true</OptimizeReferences>\r
+    </Link>\r
+    <PreBuildEvent>\r
+      <Command>test-config-setup.bat "$(MONO_CONFIG_PATH)" "$(MONO_EXECUTABLE_DIR)" x86-64</Command>\r
+    </PreBuildEvent>\r
+  </ItemDefinitionGroup>\r
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />\r
+  <ImportGroup Label="ExtensionTargets">\r
+  </ImportGroup>\r
+</Project>
\ No newline at end of file
diff --git a/msvc/mono-testdriver-test.vcxproj.filters b/msvc/mono-testdriver-test.vcxproj.filters
new file mode 100644 (file)
index 0000000..ef1ebf5
--- /dev/null
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="utf-8"?>\r
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" />
\ No newline at end of file
index 2251543e666491a794934617bde33931d99d5dfd..f5a0e9ab98ae02180157b09927d2fccd54f239a3 100644 (file)
@@ -241,6 +241,7 @@ mono_disasm_code
 mono_disasm_code_one
 mono_dl_fallback_register
 mono_dl_fallback_unregister
+mono_dl_open
 mono_dllmap_insert
 mono_domain_add_class_static_data
 mono_domain_assembly_open
@@ -495,6 +496,7 @@ mono_ldstr
 mono_ldtoken
 mono_load_remote_field
 mono_load_remote_field_new
+mono_loader_register_module
 mono_lock_free_alloc
 mono_lock_free_allocator_check_consistency
 mono_lock_free_allocator_init_allocator
index 5384dc846b4cb2c0ee72d1e25695c04c47c44898..abc81a55abd8fb65449c0a008f6696c2feeab76e 100644 (file)
@@ -13,6 +13,8 @@
     <MONO_USE_SEPARATE_BUILD_DIR>true</MONO_USE_SEPARATE_BUILD_DIR>
     <!-- When true, all binaries and libraries will link using static c-runtime. When false, all binaries and libraries will link using dynamic c-runtime.  -->
     <MONO_USE_STATIC_C_RUNTIME>false</MONO_USE_STATIC_C_RUNTIME>
+    <!-- When true, mono binaries will link using static libmono. When false, mono binaries will link using dynamic libmono.  -->
+    <MONO_USE_STATIC_LIBMONO>false</MONO_USE_STATIC_LIBMONO>
   </PropertyGroup>
   <PropertyGroup Label="MonoDirectories">
     <top_srcdir>$(MSBuildProjectDirectory)/..</top_srcdir>
     <MONO_TARGET_SUFFIX Condition="'$(MONO_USE_TARGET_SUFFIX)'=='true'">-boehm</MONO_TARGET_SUFFIX>
     <MONO_BUILD_DIR_PREFIX Condition="'$(MONO_USE_SEPARATE_BUILD_DIR)'=='true'">$(MONO_BUILD_DIR_PREFIX)boehm/</MONO_BUILD_DIR_PREFIX>
   </PropertyGroup>
+  <PropertyGroup Label="Static-Mono-Libraries">
+    <MONO_RUNTIME_LIBS>libmonoutils.lib;libmonoruntime$(MONO_TARGET_SUFFIX).lib;$(GC_LIB)</MONO_RUNTIME_LIBS>
+    <MONO_STATIC_LIBMONO_LIB>libmono-static$(MONO_TARGET_SUFFIX).lib;$(MONO_RUNTIME_LIBS)</MONO_STATIC_LIBMONO_LIB>
+    <MONO_DYNAMIC_LIBMONO_LIB>mono-2.0$(MONO_TARGET_SUFFIX).lib</MONO_DYNAMIC_LIBMONO_LIB>
+  </PropertyGroup>
+  <PropertyGroup Label="Static-libmono-Library" Condition="$(MONO_USE_STATIC_LIBMONO)=='true'">
+    <MONO_LIBMONO_LIB>$(MONO_STATIC_LIBMONO_LIB)</MONO_LIBMONO_LIB>
+  </PropertyGroup>
+  <PropertyGroup Label="Dynamic-libmono-Library" Condition="$(MONO_USE_STATIC_LIBMONO)!='true'">
+    <MONO_LIBMONO_LIB>$(MONO_DYNAMIC_LIBMONO_LIB)</MONO_LIBMONO_LIB>
+  </PropertyGroup>
   <PropertyGroup Label="MonoProfiler">
     <VTUNE_INCLUDE_DIR>$(ProgramFiles)/Intel/VTune Amplifier XE 2013/include</VTUNE_INCLUDE_DIR>
   </PropertyGroup>
@@ -73,6 +86,9 @@
     <BuildMacro Include="MONO_USE_STATIC_C_RUNTIME">
       <Value>$(MONO_USE_STATIC_C_RUNTIME)</Value>
     </BuildMacro>
+    <BuildMacro Include="MONO_USE_STATIC_LIBMONO">
+      <Value>$(MONO_USE_STATIC_LIBMONO)</Value>
+    </BuildMacro>
   </ItemGroup>
   <ItemDefinitionGroup>
     <ClCompile>
index 0861cda54050dc6d3e14cfd52a335da11e7d7542..0dcd61f4c59cd4fde9fcf70ed3c7812c8c9ae067 100644 (file)
@@ -157,12 +157,20 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libgcmonosgen", "libgcmonos
 EndProject\r
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mono-mini-regression-test", "mono-mini-regression-test.vcxproj", "{3E0D229E-C39F-4EDA-9A6A-A33ECEA0322D}"\r
 EndProject\r
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mono-mini-regression-aot-test", "mono-mini-regression-aot-test.vcxproj", "{D632D664-C0F5-4B60-9375-BDDAD5C7A649}"\r
-EndProject\r
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "regression", "regression", "{A0068765-334B-414C-8E21-8376CD2EC9F6}"\r
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "jit", "jit", "{A0068765-334B-414C-8E21-8376CD2EC9F6}"\r
 EndProject\r
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libmono-static", "libmono-static.vcxproj", "{CB0D9E92-293C-439C-9AC7-C5F59B6E0772}"\r
 EndProject\r
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "full-aot", "full-aot", "{BACF489E-EAEB-42BF-9E0A-C54D7CF455B4}"\r
+EndProject\r
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mono-full-aot-compile-test", "mono-full-aot-compile-test.vcxproj", "{C7D83158-4EB6-4409-8730-612AD45FAF6A}"\r
+EndProject\r
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mono-full-aot-run-test", "mono-full-aot-run-test.vcxproj", "{6C64262B-077B-4E12-AF91-9409ECCB75F6}"\r
+EndProject\r
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mono-testdriver-test", "mono-testdriver-test.vcxproj", "{7BECCFA0-28A0-4995-9856-558560F720E6}"\r
+EndProject\r
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mono-nunit-test", "mono-nunit-test.vcxproj", "{0046B994-40A8-4C64-AC9D-429DC9177B54}"\r
+EndProject\r
 Global\r
        GlobalSection(SolutionConfigurationPlatforms) = preSolution\r
                Debug|Win32 = Debug|Win32\r
@@ -345,14 +353,6 @@ Global
                {3E0D229E-C39F-4EDA-9A6A-A33ECEA0322D}.Release|Win32.Build.0 = Release|Win32\r
                {3E0D229E-C39F-4EDA-9A6A-A33ECEA0322D}.Release|x64.ActiveCfg = Release|x64\r
                {3E0D229E-C39F-4EDA-9A6A-A33ECEA0322D}.Release|x64.Build.0 = Release|x64\r
-               {D632D664-C0F5-4B60-9375-BDDAD5C7A649}.Debug|Win32.ActiveCfg = Debug|Win32\r
-               {D632D664-C0F5-4B60-9375-BDDAD5C7A649}.Debug|Win32.Build.0 = Debug|Win32\r
-               {D632D664-C0F5-4B60-9375-BDDAD5C7A649}.Debug|x64.ActiveCfg = Debug|x64\r
-               {D632D664-C0F5-4B60-9375-BDDAD5C7A649}.Debug|x64.Build.0 = Debug|x64\r
-               {D632D664-C0F5-4B60-9375-BDDAD5C7A649}.Release|Win32.ActiveCfg = Release|Win32\r
-               {D632D664-C0F5-4B60-9375-BDDAD5C7A649}.Release|Win32.Build.0 = Release|Win32\r
-               {D632D664-C0F5-4B60-9375-BDDAD5C7A649}.Release|x64.ActiveCfg = Release|x64\r
-               {D632D664-C0F5-4B60-9375-BDDAD5C7A649}.Release|x64.Build.0 = Release|x64\r
                {CB0D9E92-293C-439C-9AC7-C5F59B6E0772}.Debug|Win32.ActiveCfg = Debug|Win32\r
                {CB0D9E92-293C-439C-9AC7-C5F59B6E0772}.Debug|Win32.Build.0 = Debug|Win32\r
                {CB0D9E92-293C-439C-9AC7-C5F59B6E0772}.Debug|x64.ActiveCfg = Debug|x64\r
@@ -361,6 +361,38 @@ Global
                {CB0D9E92-293C-439C-9AC7-C5F59B6E0772}.Release|Win32.Build.0 = Release|Win32\r
                {CB0D9E92-293C-439C-9AC7-C5F59B6E0772}.Release|x64.ActiveCfg = Release|x64\r
                {CB0D9E92-293C-439C-9AC7-C5F59B6E0772}.Release|x64.Build.0 = Release|x64\r
+               {C7D83158-4EB6-4409-8730-612AD45FAF6A}.Debug|Win32.ActiveCfg = Debug|Win32\r
+               {C7D83158-4EB6-4409-8730-612AD45FAF6A}.Debug|Win32.Build.0 = Debug|Win32\r
+               {C7D83158-4EB6-4409-8730-612AD45FAF6A}.Debug|x64.ActiveCfg = Debug|x64\r
+               {C7D83158-4EB6-4409-8730-612AD45FAF6A}.Debug|x64.Build.0 = Debug|x64\r
+               {C7D83158-4EB6-4409-8730-612AD45FAF6A}.Release|Win32.ActiveCfg = Release|Win32\r
+               {C7D83158-4EB6-4409-8730-612AD45FAF6A}.Release|Win32.Build.0 = Release|Win32\r
+               {C7D83158-4EB6-4409-8730-612AD45FAF6A}.Release|x64.ActiveCfg = Release|x64\r
+               {C7D83158-4EB6-4409-8730-612AD45FAF6A}.Release|x64.Build.0 = Release|x64\r
+               {6C64262B-077B-4E12-AF91-9409ECCB75F6}.Debug|Win32.ActiveCfg = Debug|Win32\r
+               {6C64262B-077B-4E12-AF91-9409ECCB75F6}.Debug|Win32.Build.0 = Debug|Win32\r
+               {6C64262B-077B-4E12-AF91-9409ECCB75F6}.Debug|x64.ActiveCfg = Debug|x64\r
+               {6C64262B-077B-4E12-AF91-9409ECCB75F6}.Debug|x64.Build.0 = Debug|x64\r
+               {6C64262B-077B-4E12-AF91-9409ECCB75F6}.Release|Win32.ActiveCfg = Release|Win32\r
+               {6C64262B-077B-4E12-AF91-9409ECCB75F6}.Release|Win32.Build.0 = Release|Win32\r
+               {6C64262B-077B-4E12-AF91-9409ECCB75F6}.Release|x64.ActiveCfg = Release|x64\r
+               {6C64262B-077B-4E12-AF91-9409ECCB75F6}.Release|x64.Build.0 = Release|x64\r
+               {7BECCFA0-28A0-4995-9856-558560F720E6}.Debug|Win32.ActiveCfg = Debug|Win32\r
+               {7BECCFA0-28A0-4995-9856-558560F720E6}.Debug|Win32.Build.0 = Debug|Win32\r
+               {7BECCFA0-28A0-4995-9856-558560F720E6}.Debug|x64.ActiveCfg = Debug|x64\r
+               {7BECCFA0-28A0-4995-9856-558560F720E6}.Debug|x64.Build.0 = Debug|x64\r
+               {7BECCFA0-28A0-4995-9856-558560F720E6}.Release|Win32.ActiveCfg = Release|Win32\r
+               {7BECCFA0-28A0-4995-9856-558560F720E6}.Release|Win32.Build.0 = Release|Win32\r
+               {7BECCFA0-28A0-4995-9856-558560F720E6}.Release|x64.ActiveCfg = Release|x64\r
+               {7BECCFA0-28A0-4995-9856-558560F720E6}.Release|x64.Build.0 = Release|x64\r
+               {0046B994-40A8-4C64-AC9D-429DC9177B54}.Debug|Win32.ActiveCfg = Debug|Win32\r
+               {0046B994-40A8-4C64-AC9D-429DC9177B54}.Debug|Win32.Build.0 = Debug|Win32\r
+               {0046B994-40A8-4C64-AC9D-429DC9177B54}.Debug|x64.ActiveCfg = Debug|x64\r
+               {0046B994-40A8-4C64-AC9D-429DC9177B54}.Debug|x64.Build.0 = Debug|x64\r
+               {0046B994-40A8-4C64-AC9D-429DC9177B54}.Release|Win32.ActiveCfg = Release|Win32\r
+               {0046B994-40A8-4C64-AC9D-429DC9177B54}.Release|Win32.Build.0 = Release|Win32\r
+               {0046B994-40A8-4C64-AC9D-429DC9177B54}.Release|x64.ActiveCfg = Release|x64\r
+               {0046B994-40A8-4C64-AC9D-429DC9177B54}.Release|x64.Build.0 = Release|x64\r
        EndGlobalSection\r
        GlobalSection(SolutionProperties) = preSolution\r
                HideSolutionNode = FALSE\r
@@ -390,9 +422,13 @@ Global
                {B6E563B8-7F57-4F7F-9439-F2405D4E2522} = {DC782E23-920A-4873-82A7-37F195FB92C1}\r
                {C36612BD-22D3-4B95-85E2-7FDC4FC5D740} = {21DF4C80-0EC9-4BFE-8552-2D47FCEF419A}\r
                {3E0D229E-C39F-4EDA-9A6A-A33ECEA0322D} = {A0068765-334B-414C-8E21-8376CD2EC9F6}\r
-               {D632D664-C0F5-4B60-9375-BDDAD5C7A649} = {A0068765-334B-414C-8E21-8376CD2EC9F6}\r
                {A0068765-334B-414C-8E21-8376CD2EC9F6} = {ECA11C76-E192-4F67-A8FA-28B637D9716F}\r
                {CB0D9E92-293C-439C-9AC7-C5F59B6E0772} = {DE3617B4-17A8-4E5F-A00F-BA43D956881F}\r
+               {BACF489E-EAEB-42BF-9E0A-C54D7CF455B4} = {ECA11C76-E192-4F67-A8FA-28B637D9716F}\r
+               {C7D83158-4EB6-4409-8730-612AD45FAF6A} = {BACF489E-EAEB-42BF-9E0A-C54D7CF455B4}\r
+               {6C64262B-077B-4E12-AF91-9409ECCB75F6} = {BACF489E-EAEB-42BF-9E0A-C54D7CF455B4}\r
+               {7BECCFA0-28A0-4995-9856-558560F720E6} = {A0068765-334B-414C-8E21-8376CD2EC9F6}\r
+               {0046B994-40A8-4C64-AC9D-429DC9177B54} = {A0068765-334B-414C-8E21-8376CD2EC9F6}\r
        EndGlobalSection\r
        GlobalSection(ExtensibilityGlobals) = postSolution\r
                AMDCaProjectFile = C:\Users\Owner\Development\monogit\mono\msvc\CodeAnalyst\mono.caw\r
index 12cceebe601e6c6be260770cff6f7ef0598e753a..f277f33258b4902a3d14f6249a026c24501ee912 100644 (file)
     </ClCompile>\r
     <ProjectReference />\r
     <Link>\r
-      <AdditionalDependencies>eglib.lib;mono-2.0$(MONO_TARGET_SUFFIX).lib;%(AdditionalDependencies)</AdditionalDependencies>\r
+      <AdditionalDependencies>eglib.lib;$(MONO_LIBMONO_LIB);%(AdditionalDependencies)</AdditionalDependencies>\r
       <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\r
       <GenerateDebugInformation>true</GenerateDebugInformation>\r
       <SubSystem>Console</SubSystem>\r
       <LinkLibraryDependencies>false</LinkLibraryDependencies>\r
     </ProjectReference>\r
     <Link>\r
-      <AdditionalDependencies>eglib.lib;mono-2.0$(MONO_TARGET_SUFFIX).lib;%(AdditionalDependencies)</AdditionalDependencies>\r
+      <AdditionalDependencies>eglib.lib;$(MONO_LIBMONO_LIB);%(AdditionalDependencies)</AdditionalDependencies>\r
       <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\r
       <GenerateDebugInformation>true</GenerateDebugInformation>\r
       <SubSystem>Console</SubSystem>\r
       <LinkLibraryDependencies>false</LinkLibraryDependencies>\r
     </ProjectReference>\r
     <Link>\r
-      <AdditionalDependencies>eglib.lib;mono-2.0$(MONO_TARGET_SUFFIX).lib;%(AdditionalDependencies)</AdditionalDependencies>\r
+      <AdditionalDependencies>eglib.lib;$(MONO_LIBMONO_LIB);%(AdditionalDependencies)</AdditionalDependencies>\r
       <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\r
       <SubSystem>Console</SubSystem>\r
       <OptimizeReferences>true</OptimizeReferences>\r
       <LinkLibraryDependencies>false</LinkLibraryDependencies>\r
     </ProjectReference>\r
     <Link>\r
-      <AdditionalDependencies>eglib.lib;mono-2.0$(MONO_TARGET_SUFFIX).lib;%(AdditionalDependencies)</AdditionalDependencies>\r
+      <AdditionalDependencies>eglib.lib;$(MONO_LIBMONO_LIB);%(AdditionalDependencies)</AdditionalDependencies>\r
       <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\r
       <GenerateDebugInformation>true</GenerateDebugInformation>\r
       <SubSystem>Console</SubSystem>\r
index 7e7eb2df1552132be1d5f91f13028c9ee2f631ff..7f14c93115fca10fa728f62d78fb86f5afdaa9de 100644 (file)
       <LinkLibraryDependencies>false</LinkLibraryDependencies>\r
     </ProjectReference>\r
     <Link>\r
-      <AdditionalDependencies>eglib.lib;libmonoruntime$(MONO_TARGET_SUFFIX).lib;libmonoutils.lib;$(GC_LIB);%(AdditionalDependencies)</AdditionalDependencies>\r
+      <AdditionalDependencies>eglib.lib;$(MONO_RUNTIME_LIBS);%(AdditionalDependencies)</AdditionalDependencies>\r
       <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\r
       <GenerateDebugInformation>true</GenerateDebugInformation>\r
       <SubSystem>Console</SubSystem>\r
       <DataExecutionPrevention>\r
       </DataExecutionPrevention>\r
       <TargetMachine>MachineX86</TargetMachine>\r
-      <AdditionalDependencies>eglib.lib;libmonoruntime$(MONO_TARGET_SUFFIX).lib;libmonoutils.lib;$(GC_LIB);%(AdditionalDependencies)</AdditionalDependencies>\r
+      <AdditionalDependencies>eglib.lib;$(MONO_RUNTIME_LIBS);%(AdditionalDependencies)</AdditionalDependencies>\r
     </Link>\r
   </ItemDefinitionGroup>\r
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">\r
       <LinkLibraryDependencies>false</LinkLibraryDependencies>\r
     </ProjectReference>\r
     <Link>\r
-      <AdditionalDependencies>eglib.lib;libmonoruntime$(MONO_TARGET_SUFFIX).lib;libmonoutils.lib;$(GC_LIB);%(AdditionalDependencies)</AdditionalDependencies>\r
+      <AdditionalDependencies>eglib.lib;$(MONO_RUNTIME_LIBS);%(AdditionalDependencies)</AdditionalDependencies>\r
       <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\r
       <GenerateDebugInformation>true</GenerateDebugInformation>\r
       <SubSystem>Console</SubSystem>\r
       <OptimizeReferences>true</OptimizeReferences>\r
       <EnableCOMDATFolding>true</EnableCOMDATFolding>\r
       <TargetMachine>MachineX64</TargetMachine>\r
-      <AdditionalDependencies>eglib.lib;libmonoruntime$(MONO_TARGET_SUFFIX).lib;libmonoutils.lib;$(GC_LIB);%(AdditionalDependencies)</AdditionalDependencies>\r
+      <AdditionalDependencies>eglib.lib;$(MONO_RUNTIME_LIBS);%(AdditionalDependencies)</AdditionalDependencies>\r
     </Link>\r
   </ItemDefinitionGroup>\r
   <ItemGroup>\r
index cce843fff837109d89404089ffbf4356c2d69fba..ce3658dd42cb5e0e5e8e514ac538c4dd5e076eca 100644 (file)
       <LinkLibraryDependencies>false</LinkLibraryDependencies>\r
     </ProjectReference>\r
     <Link>\r
-      <AdditionalDependencies>eglib.lib;mono-2.0$(MONO_TARGET_SUFFIX).lib;%(AdditionalDependencies)</AdditionalDependencies>\r
+      <AdditionalDependencies>eglib.lib;$(MONO_LIBMONO_LIB);%(AdditionalDependencies)</AdditionalDependencies>\r
       <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\r
       <GenerateDebugInformation>true</GenerateDebugInformation>\r
       <SubSystem>Console</SubSystem>\r
       <DataExecutionPrevention>\r
       </DataExecutionPrevention>\r
       <TargetMachine>MachineX86</TargetMachine>\r
-      <AdditionalDependencies>eglib.lib;mono-2.0$(MONO_TARGET_SUFFIX).lib;%(AdditionalDependencies)</AdditionalDependencies>\r
+      <AdditionalDependencies>eglib.lib;$(MONO_LIBMONO_LIB);%(AdditionalDependencies)</AdditionalDependencies>\r
     </Link>\r
   </ItemDefinitionGroup>\r
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">\r
       <LinkLibraryDependencies>false</LinkLibraryDependencies>\r
     </ProjectReference>\r
     <Link>\r
-      <AdditionalDependencies>eglib.lib;mono-2.0$(MONO_TARGET_SUFFIX).lib;%(AdditionalDependencies)</AdditionalDependencies>\r
+      <AdditionalDependencies>eglib.lib;$(MONO_LIBMONO_LIB);%(AdditionalDependencies)</AdditionalDependencies>\r
       <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\r
       <GenerateDebugInformation>true</GenerateDebugInformation>\r
       <SubSystem>Console</SubSystem>\r
       <OptimizeReferences>true</OptimizeReferences>\r
       <EnableCOMDATFolding>true</EnableCOMDATFolding>\r
       <TargetMachine>MachineX64</TargetMachine>\r
-      <AdditionalDependencies>eglib.lib;mono-2.0$(MONO_TARGET_SUFFIX).lib;%(AdditionalDependencies)</AdditionalDependencies>\r
+      <AdditionalDependencies>eglib.lib;$(MONO_LIBMONO_LIB);%(AdditionalDependencies)</AdditionalDependencies>\r
     </Link>\r
   </ItemDefinitionGroup>\r
   <ItemGroup>\r
index fca1c3d1d9c09cfb2b76a2fac8804126d102934a..b8cf7cbfe551818251d48c6737bc66a60f4478bc 100644 (file)
@@ -35,6 +35,7 @@ Mono_Posix_Stdlib_EXIT_FAILURE
 Mono_Posix_Stdlib_EXIT_SUCCESS\r
 Mono_Posix_Stdlib_FILENAME_MAX\r
 Mono_Posix_Stdlib_FOPEN_MAX\r
+Mono_Posix_Stdlib_GetLastError\r
 Mono_Posix_Stdlib_InvokeSignalHandler\r
 Mono_Posix_Stdlib_L_tmpnam\r
 Mono_Posix_Stdlib_MB_CUR_MAX\r
@@ -49,8 +50,20 @@ Mono_Posix_Stdlib__IOLBF
 Mono_Posix_Stdlib__IONBF\r
 Mono_Posix_Stdlib_calloc\r
 Mono_Posix_Stdlib_clearerr\r
+Mono_Posix_Stdlib_fclose\r
+Mono_Posix_Stdlib_feof\r
+Mono_Posix_Stdlib_ferror\r
+Mono_Posix_Stdlib_fflush\r
+Mono_Posix_Stdlib_fgetc\r
 Mono_Posix_Stdlib_fgetpos\r
+Mono_Posix_Stdlib_fgets\r
+Mono_Posix_Stdlib_fopen\r
+Mono_Posix_Stdlib_fprintf\r
+Mono_Posix_Stdlib_fputc\r
+Mono_Posix_Stdlib_fputs\r
 Mono_Posix_Stdlib_fread\r
+Mono_Posix_Stdlib_free\r
+Mono_Posix_Stdlib_freopen\r
 Mono_Posix_Stdlib_fseek\r
 Mono_Posix_Stdlib_fsetpos\r
 Mono_Posix_Stdlib_ftell\r
@@ -65,6 +78,8 @@ Mono_Posix_Stdlib_stderr
 Mono_Posix_Stdlib_stdin\r
 Mono_Posix_Stdlib_stdout\r
 Mono_Posix_Stdlib_strlen\r
+Mono_Posix_Stdlib_tmpfile\r
+Mono_Posix_Stdlib_ungetc\r
 Mono_Posix_ToAccessModes\r
 Mono_Posix_ToConfstrName\r
 Mono_Posix_ToDirectoryNotifyFlags\r
@@ -92,9 +107,24 @@ Mono_Posix_ToSyslogLevel
 Mono_Posix_ToSyslogOptions\r
 Mono_Posix_ToWaitOptions\r
 Mono_Posix_ToXattrFlags\r
+Mono_Unix_VersionString\r
 CreateZStream\r
 CloseZStream\r
 ReadZStream\r
 WriteZStream\r
 Flush\r
-\r
+zipWriteInFileInZip\r
+zipCloseFileInZip\r
+zipOpen2\r
+zipClose\r
+zipOpenNewFileInZip\r
+unzOpen2\r
+unzCloseCurrentFile\r
+unztell\r
+unzGoToFirstFile\r
+unzGoToNextFile\r
+unzLocateFile\r
+unzOpenCurrentFile2\r
+unzGetCurrentFileInfo\r
+unzReadCurrentFile\r
+unzClose\r
index 83304969ab20ec2f93929d747146fd03db64a965..de0276892fa51410ace9318b026d559401d2cdc4 100644 (file)
@@ -87,7 +87,6 @@
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">\r
     <ClCompile>\r
       <Optimization>Disabled</Optimization>\r
-      <AdditionalIncludeDirectories>$(MONO_DIR);$(MONO_EGLIB_SOURCE_DIR);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
       <PreprocessorDefinitions>_DEBUG;__i386__;TARGET_X86;_WIN32_WINNT=0x0600;WIN32;_WIN32;__WIN32__;_WINDOWS;WINDOWS;HOST_WIN32;TARGET_WIN32;_CRT_SECURE_NO_DEPRECATE;HAVE_CONFIG_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
       <MinimalRebuild>true</MinimalRebuild>\r
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>\r
@@ -96,6 +95,7 @@
       <WarningLevel>Level3</WarningLevel>\r
       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>\r
       <CompileAs>CompileAsC</CompileAs>\r
+      <AdditionalIncludeDirectories>$(MONO_DIR);$(MONO_EGLIB_SOURCE_DIR);$(MONO_DIR)/support;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
     </ClCompile>\r
     <Link>\r
       <AdditionalDependencies>eglib.lib;%(AdditionalDependencies)</AdditionalDependencies>\r
     </Midl>\r
     <ClCompile>\r
       <Optimization>Disabled</Optimization>\r
-      <AdditionalIncludeDirectories>$(MONO_DIR);$(MONO_EGLIB_SOURCE_DIR);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
       <PreprocessorDefinitions>_DEBUG;__x86_64__;_WIN32_WINNT=0x0600;WIN64;_WIN64;WIN32;_WIN32;__WIN32__;_WINDOWS;WINDOWS;HOST_WIN32;TARGET_WIN32;_CRT_SECURE_NO_DEPRECATE;HAVE_CONFIG_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
       <MinimalRebuild>true</MinimalRebuild>\r
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>\r
       <WarningLevel>Level3</WarningLevel>\r
       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>\r
       <CompileAs>CompileAsC</CompileAs>\r
+      <AdditionalIncludeDirectories>$(MONO_DIR);$(MONO_EGLIB_SOURCE_DIR);$(MONO_DIR)/support;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
     </ClCompile>\r
     <Link>\r
       <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>\r
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">\r
     <ClCompile>\r
       <Optimization>MinSpace</Optimization>\r
-      <AdditionalIncludeDirectories>$(MONO_DIR);$(MONO_EGLIB_SOURCE_DIR);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
       <PreprocessorDefinitions>NDEBUG;__i386__;TARGET_X86;i386;_WIN32_WINNT=0x0600;WIN32;_WIN32;__WIN32__;_WINDOWS;WINDOWS;HOST_WIN32;TARGET_WIN32;_CRT_SECURE_NO_DEPRECATE;HAVE_CONFIG_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
       <PrecompiledHeader>\r
       </PrecompiledHeader>\r
       <WarningLevel>Level3</WarningLevel>\r
       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>\r
       <CompileAs>CompileAsC</CompileAs>\r
+      <AdditionalIncludeDirectories>$(MONO_DIR);$(MONO_EGLIB_SOURCE_DIR);$(MONO_DIR)/support;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
     </ClCompile>\r
     <Link>\r
       <AdditionalDependencies>eglib.lib;%(AdditionalDependencies)</AdditionalDependencies>\r
     </Midl>\r
     <ClCompile>\r
       <Optimization>MinSpace</Optimization>\r
-      <AdditionalIncludeDirectories>$(MONO_DIR);$(MONO_EGLIB_SOURCE_DIR);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
       <PreprocessorDefinitions>NDEBUG;__x86_64__;_WIN32_WINNT=0x0600;WIN64;_WIN64;WIN32;_WIN32;__WIN32__;_WINDOWS;WINDOWS;HOST_WIN32;TARGET_WIN32;_CRT_SECURE_NO_DEPRECATE;HAVE_CONFIG_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
       <PrecompiledHeader>\r
       </PrecompiledHeader>\r
       <WarningLevel>Level3</WarningLevel>\r
       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>\r
       <CompileAs>CompileAsC</CompileAs>\r
+      <AdditionalIncludeDirectories>$(MONO_DIR);$(MONO_EGLIB_SOURCE_DIR);$(MONO_DIR)/support;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
     </ClCompile>\r
     <Link>\r
       <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>\r
     <ClCompile Include="..\support\inflate.c" />\r
     <ClCompile Include="..\support\inftrees.c" />\r
     <ClCompile Include="..\support\map.c" />\r
+    <ClCompile Include="..\support\minizip\ioapi.c" />\r
+    <ClCompile Include="..\support\minizip\iowin32.c" />\r
+    <ClCompile Include="..\support\minizip\minizip.c" />\r
+    <ClCompile Include="..\support\minizip\unzip.c" />\r
+    <ClCompile Include="..\support\minizip\zip.c" />\r
     <ClCompile Include="..\support\signal.c" />\r
     <ClCompile Include="..\support\stdio.c" />\r
     <ClCompile Include="..\support\stdlib.c" />\r
     <ClInclude Include="..\support\inflate.h" />\r
     <ClInclude Include="..\support\inftrees.h" />\r
     <ClInclude Include="..\support\map.h" />\r
+    <ClInclude Include="..\support\minizip\crypt.h" />\r
+    <ClInclude Include="..\support\minizip\ioapi.h" />\r
+    <ClInclude Include="..\support\minizip\iowin32.h" />\r
+    <ClInclude Include="..\support\minizip\unzip.h" />\r
+    <ClInclude Include="..\support\minizip\zip.h" />\r
     <ClInclude Include="..\support\mph.h" />\r
     <ClInclude Include="..\support\trees.h" />\r
     <ClInclude Include="..\support\zconf.h" />\r
+    <ClInclude Include="..\support\zlib.h" />\r
     <ClInclude Include="..\support\zutil.h" />\r
   </ItemGroup>\r
   <ItemGroup>\r
index 9df33f5e0d4580e92a5ec3325a5827f1df5a95d1..1cd4d6b86659f977351c9e9a6ab4f309af855c4f 100644 (file)
     <ClCompile Include="..\support\zutil.c">\r
       <Filter>Source Files</Filter>\r
     </ClCompile>\r
+    <ClCompile Include="..\support\minizip\iowin32.c">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\support\minizip\minizip.c">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\support\minizip\unzip.c">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\support\minizip\zip.c">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\support\minizip\ioapi.c">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
   </ItemGroup>\r
   <ItemGroup>\r
     <ClInclude Include="..\support\crc32.h">\r
     <ClInclude Include="..\support\zutil.h">\r
       <Filter>Header Files</Filter>\r
     </ClInclude>\r
+    <ClInclude Include="..\support\minizip\crypt.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="..\support\minizip\unzip.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="..\support\minizip\iowin32.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="..\support\minizip\zip.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="..\support\zlib.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="..\support\minizip\ioapi.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
   </ItemGroup>\r
   <ItemGroup>\r
     <Filter Include="Header Files">\r
index 1f82284e7c29e944108087ebb05d2fa117fdac27..1722591c2f397fcd574413a75dd699b8602dcec5 100644 (file)
@@ -241,6 +241,7 @@ mono_disasm_code
 mono_disasm_code_one
 mono_dl_fallback_register
 mono_dl_fallback_unregister
+mono_dl_open
 mono_dllmap_insert
 mono_domain_add_class_static_data
 mono_domain_assembly_open
@@ -497,6 +498,7 @@ mono_ldstr
 mono_ldtoken
 mono_load_remote_field
 mono_load_remote_field_new
+mono_loader_register_module
 mono_lock_free_alloc
 mono_lock_free_allocator_check_consistency
 mono_lock_free_allocator_init_allocator
index 5a6e9116bd9759204af84f6bbdaa11fd2f611fb0..ad0d476fd93bb58a0f64d00d9978c38a414291e0 100644 (file)
@@ -96,7 +96,7 @@
     <ClCompile>\r
       <Optimization>Disabled</Optimization>\r
       <AdditionalIncludeDirectories>$(MONO_DIR);$(MONO_INCLUDE_DIR);$(MONO_JIT_INCLUDE_DIR);$(MONO_EGLIB_SOURCE_DIR);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
-      <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_WINDOWS;__WIN32__;HOST_WIN32;TARGET_WIN32;__i386__;TARGET_X86;GC_NOT_DLL;GC_GCJ_SUPPORT;GC_WIN32_THREADS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+      <PreprocessorDefinitions>WIN32;WIN32_LEAN_AND_MEAN;_DEBUG;_CONSOLE;_WINDOWS;__WIN32__;HOST_WIN32;TARGET_WIN32;__i386__;TARGET_X86;GC_NOT_DLL;GC_GCJ_SUPPORT;GC_WIN32_THREADS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
       <MinimalRebuild>true</MinimalRebuild>\r
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>\r
       <PrecompiledHeader>\r
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">\r
     <ClCompile>\r
       <Optimization>MinSpace</Optimization>\r
-      <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+      <PreprocessorDefinitions>WIN32;WIN32_LEAN_AND_MEAN;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
       <PrecompiledHeader>\r
       </PrecompiledHeader>\r
       <WarningLevel>Level3</WarningLevel>\r
     <ClCompile>\r
       <Optimization>Disabled</Optimization>\r
       <AdditionalIncludeDirectories>$(MONO_DIR);$(MONO_INCLUDE_DIR);$(MONO_JIT_INCLUDE_DIR);$(MONO_EGLIB_SOURCE_DIR);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
-      <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_WINDOWS;__WIN32__;HOST_WIN32;TARGET_WIN32;__i386__;TARGET_X86;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+      <PreprocessorDefinitions>WIN32;WIN32_LEAN_AND_MEAN;_DEBUG;_CONSOLE;_WINDOWS;__WIN32__;HOST_WIN32;TARGET_WIN32;__i386__;TARGET_X86;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
       <MinimalRebuild>true</MinimalRebuild>\r
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>\r
       <PrecompiledHeader>\r
     </Midl>\r
     <ClCompile>\r
       <Optimization>MinSpace</Optimization>\r
-      <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+      <PreprocessorDefinitions>WIN32;WIN32_LEAN_AND_MEAN;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
       <PrecompiledHeader>\r
       </PrecompiledHeader>\r
       <WarningLevel>Level3</WarningLevel>\r
     <ClCompile Include="..\mono\metadata\console-win32.c" />\r
     <ClCompile Include="..\mono\metadata\domain.c" />\r
     <ClCompile Include="..\mono\metadata\environment.c" />\r
+    <ClCompile Include="..\mono\metadata\file-io-windows.c" />\r
     <ClCompile Include="..\mono\metadata\file-io.c" />\r
     <ClCompile Include="..\mono\metadata\filewatcher.c" />\r
     <ClCompile Include="..\mono\metadata\gc.c" />\r
+    <ClCompile Include="..\mono\metadata\icall-windows.c" />\r
     <ClCompile Include="..\mono\metadata\icall.c" />\r
     <ClCompile Include="..\mono\metadata\image.c" />\r
     <ClCompile Include="..\mono\metadata\loader.c" />\r
     <ClCompile Include="..\mono\metadata\locales.c" />\r
+    <ClCompile Include="..\mono\metadata\marshal-windows.c" />\r
     <ClCompile Include="..\mono\metadata\marshal.c" />\r
     <ClCompile Include="..\mono\metadata\metadata.c" />\r
     <ClCompile Include="..\mono\metadata\monitor.c" />\r
     <ClCompile Include="..\mono\metadata\mono-config.c" />\r
     <ClCompile Include="..\mono\utils\mono-dl.c" />\r
     <ClCompile Include="..\mono\metadata\object.c" />\r
-    <ClCompile Include="..\mono\metadata\process.c" />\r
+    <ClCompile Include="..\mono\metadata\w32process.c" />\r
+    <ClCompile Include="..\mono\metadata\w32process-win32.c" />\r
     <ClCompile Include="..\mono\metadata\profiler.c" />\r
     <ClCompile Include="..\mono\metadata\rand.c" />\r
     <ClCompile Include="..\mono\metadata\reflection.c" />\r
index 7658bc13f5ccac3041bad6c063a548c009266315..72a54e162553c060c3b513b3724e503de4a7dff7 100644 (file)
     <ClCompile Include="..\mono\metadata\object.c">\r
       <Filter>Source Files</Filter>\r
     </ClCompile>\r
-    <ClCompile Include="..\mono\metadata\process.c">\r
+    <ClCompile Include="..\mono\metadata\w32process.c">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\mono\metadata\w32process-win32.c">\r
       <Filter>Source Files</Filter>\r
     </ClCompile>\r
     <ClCompile Include="..\mono\metadata\profiler.c">\r
     <ClCompile Include="..\tools\pedump\pedump.c">\r
       <Filter>Source Files</Filter>\r
     </ClCompile>\r
+    <ClCompile Include="..\mono\metadata\marshal-windows.c">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\mono\metadata\icall-windows.c">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\mono\metadata\file-io-windows.c">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
   </ItemGroup>\r
   <ItemGroup>\r
     <Filter Include="Header Files">\r
index 45c497b9bdc31612d3d1fbd4a95b2bdd7041ba50..544a89d32a2bb0a27ec120f80b791caf98a5bd9f 100644 (file)
       <EnableCOMDATFolding>true</EnableCOMDATFolding>\r
       <TargetMachine>MachineX86</TargetMachine>\r
       <ModuleDefinitionFile>mono-profiler-vtune.def</ModuleDefinitionFile>\r
-      <AdditionalDependencies>mono-2.0$(MONO_TARGET_SUFFIX).lib;$(GC_LIB);eglib.lib;jitprofiling.lib;%(AdditionalDependencies)</AdditionalDependencies>\r
+      <AdditionalDependencies>$(MONO_LIBMONO_LIB);$(GC_LIB);eglib.lib;jitprofiling.lib;%(AdditionalDependencies)</AdditionalDependencies>\r
       <AdditionalLibraryDirectories>$(ProgramFiles)\Intel\VTune Amplifier XE 2013\lib32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\r
     </Link>\r
     <ProjectReference>\r
       <OptimizeReferences>true</OptimizeReferences>\r
       <EnableCOMDATFolding>true</EnableCOMDATFolding>\r
       <ModuleDefinitionFile>mono-profiler-vtune.def</ModuleDefinitionFile>\r
-      <AdditionalDependencies>mono-2.0$(MONO_TARGET_SUFFIX).lib;$(GC_LIB);eglib.lib;jitprofiling.lib;%(AdditionalDependencies)</AdditionalDependencies>\r
+      <AdditionalDependencies>$(MONO_LIBMONO_LIB);$(GC_LIB);eglib.lib;jitprofiling.lib;%(AdditionalDependencies)</AdditionalDependencies>\r
       <AdditionalLibraryDirectories>$(ProgramFiles)\Intel\VTune Amplifier XE 2013\lib32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\r
     </Link>\r
     <ProjectReference>\r
       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>\r
     </ClCompile>\r
     <Link>\r
-      <AdditionalDependencies>mono-2.0$(MONO_TARGET_SUFFIX).lib;$(GC_LIB);eglib.lib;jitprofiling.lib;%(AdditionalDependencies)</AdditionalDependencies>\r
+      <AdditionalDependencies>$(MONO_LIBMONO_LIB);$(GC_LIB);eglib.lib;jitprofiling.lib;%(AdditionalDependencies)</AdditionalDependencies>\r
       <AdditionalLibraryDirectories>$(ProgramFiles)\Intel\VTune Amplifier XE 2013\lib32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\r
       <GenerateDebugInformation>true</GenerateDebugInformation>\r
       <SubSystem>Windows</SubSystem>\r
       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>\r
     </ClCompile>\r
     <Link>\r
-      <AdditionalDependencies>mono-2.0$(MONO_TARGET_SUFFIX).lib;$(GC_LIB);eglib.lib;jitprofiling.lib;%(AdditionalDependencies)</AdditionalDependencies>\r
+      <AdditionalDependencies>$(MONO_LIBMONO_LIB);$(GC_LIB);eglib.lib;jitprofiling.lib;%(AdditionalDependencies)</AdditionalDependencies>\r
       <AdditionalLibraryDirectories>$(ProgramFiles)\Intel\VTune Amplifier XE 2013\lib32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\r
       <GenerateDebugInformation>true</GenerateDebugInformation>\r
       <SubSystem>Windows</SubSystem>\r
index 02ef2e45743d279ddbe795a9c3cb20ce3334647c..4c7e1dba13730b023206ef8b0b1da39c9aced209 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
+<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <PropertyGroup>\r
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
index d2424feca659f855fe33bd575d5348dc83ffd53b..cece22ecd78d5ca0c055dff860963d787cbdd29d 100644 (file)
@@ -13,7 +13,7 @@
     </project>
     <project dir="class/corlib" library="corlib-basic">
       <boot>true</boot>
-      <flags>/codepage:65001 -unsafe -nostdlib -nowarn:612,618,1635 -d:INSIDE_CORLIB,MONO_CULTURE_DATA -d:LIBC -d:FEATURE_PAL,GENERICS_WORK,FEATURE_LIST_PREDICATES,FEATURE_SERIALIZATION,FEATURE_ASCII,FEATURE_LATIN1,FEATURE_UTF7,FEATURE_UTF32,MONO_HYBRID_ENCODING_SUPPORT,FEATURE_ASYNC_IO,NEW_EXPERIMENTAL_ASYNC_IO,FEATURE_UTF32,FEATURE_EXCEPTIONDISPATCHINFO,FEATURE_CORRUPTING_EXCEPTIONS,FEATURE_EXCEPTION_NOTIFICATIONS,FEATURE_STRONGNAME_MIGRATION,FEATURE_USE_LCID,FEATURE_FUSION,FEATURE_CRYPTO,FEATURE_X509_SECURESTRINGS,FEATURE_SYNCHRONIZATIONCONTEXT,FEATURE_SYNCHRONIZATIONCONTEXT_WAIT -d:FEATURE_MACL -d:FEATURE_REMOTING,MONO_COM,FEATURE_COMINTEROP,FEATURE_ROLE_BASED_SECURITY -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -d:NET_4_0 -d:NET_4_5 -d:MONO -d:BOOTSTRAP_BASIC -nowarn:1699 -lib:./../../class/lib/basic -optimize /noconfig -d:FEATURE_PAL,GENERICS_WORK,FEATURE_LIST_PREDICATES,FEATURE_SERIALIZATION,FEATURE_ASCII,FEATURE_LATIN1,FEATURE_UTF7,FEATURE_UTF32,MONO_HYBRID_ENCODING_SUPPORT,FEATURE_ASYNC_IO,NEW_EXPERIMENTAL_ASYNC_IO,FEATURE_UTF32,FEATURE_EXCEPTIONDISPATCHINFO,FEATURE_CORRUPTING_EXCEPTIONS,FEATURE_EXCEPTION_NOTIFICATIONS,FEATURE_STRONGNAME_MIGRATION,FEATURE_USE_LCID,FEATURE_FUSION,FEATURE_CRYPTO,FEATURE_X509_SECURESTRINGS,FEATURE_SYNCHRONIZATIONCONTEXT,FEATURE_SYNCHRONIZATIONCONTEXT_WAIT -d:FEATURE_MACL -d:FEATURE_REMOTING,MONO_COM,FEATURE_COMINTEROP,FEATURE_ROLE_BASED_SECURITY -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -resource:resources/charinfo.nlp -resource:resources/collation.core.bin -resource:resources/collation.tailoring.bin -resource:resources/collation.cjkCHS.bin -resource:resources/collation.cjkCHT.bin -resource:resources/collation.cjkJA.bin -resource:resources/collation.cjkKO.bin -resource:resources/collation.cjkKOlv2.bin --runtime:v4</flags>
+      <flags>/codepage:65001 -unsafe -nostdlib -nowarn:612,618,1635 -d:INSIDE_CORLIB,MONO_CULTURE_DATA -d:LIBC -d:FEATURE_PAL,GENERICS_WORK,FEATURE_LIST_PREDICATES,FEATURE_SERIALIZATION,FEATURE_ASCII,FEATURE_LATIN1,FEATURE_UTF7,FEATURE_UTF32,MONO_HYBRID_ENCODING_SUPPORT,FEATURE_ASYNC_IO,NEW_EXPERIMENTAL_ASYNC_IO,FEATURE_UTF32,FEATURE_EXCEPTIONDISPATCHINFO,FEATURE_CORRUPTING_EXCEPTIONS,FEATURE_EXCEPTION_NOTIFICATIONS,FEATURE_STRONGNAME_MIGRATION,FEATURE_USE_LCID,FEATURE_FUSION,FEATURE_CRYPTO,FEATURE_X509_SECURESTRINGS,FEATURE_SYNCHRONIZATIONCONTEXT,FEATURE_SYNCHRONIZATIONCONTEXT_WAIT,HAS_CORLIB_CONTRACTS -d:FEATURE_MACL -d:FEATURE_REMOTING,MONO_COM,FEATURE_COMINTEROP,FEATURE_ROLE_BASED_SECURITY -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -d:NET_4_0 -d:NET_4_5 -d:MONO -d:BOOTSTRAP_BASIC -nowarn:1699 -lib:./../../class/lib/basic -optimize /noconfig -d:FEATURE_PAL,GENERICS_WORK,FEATURE_LIST_PREDICATES,FEATURE_SERIALIZATION,FEATURE_ASCII,FEATURE_LATIN1,FEATURE_UTF7,FEATURE_UTF32,MONO_HYBRID_ENCODING_SUPPORT,FEATURE_ASYNC_IO,NEW_EXPERIMENTAL_ASYNC_IO,FEATURE_UTF32,FEATURE_EXCEPTIONDISPATCHINFO,FEATURE_CORRUPTING_EXCEPTIONS,FEATURE_EXCEPTION_NOTIFICATIONS,FEATURE_STRONGNAME_MIGRATION,FEATURE_USE_LCID,FEATURE_FUSION,FEATURE_CRYPTO,FEATURE_X509_SECURESTRINGS,FEATURE_SYNCHRONIZATIONCONTEXT,FEATURE_SYNCHRONIZATIONCONTEXT_WAIT,HAS_CORLIB_CONTRACTS -d:FEATURE_MACL -d:FEATURE_REMOTING,MONO_COM,FEATURE_COMINTEROP,FEATURE_ROLE_BASED_SECURITY -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -resource:resources/charinfo.nlp -resource:resources/collation.core.bin -resource:resources/collation.tailoring.bin -resource:resources/collation.cjkCHS.bin -resource:resources/collation.cjkCHT.bin -resource:resources/collation.cjkJA.bin -resource:resources/collation.cjkKO.bin -resource:resources/collation.cjkKOlv2.bin --runtime:v4</flags>
       <output>mscorlib.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/basic/mscorlib.dll</library_output>
@@ -35,7 +35,7 @@
     </project>
     <project dir="class/System" library="System-basic">
       <boot>true</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:BOOTSTRAP_BASIC -nowarn:1699 -lib:./../../class/lib/basic -optimize /noconfig -nowarn:618 -d:CONFIGURATION_2_0 -d:FEATURE_PAL,SYSTEM_NAMESPACE,MONO,PLATFORM_UNIX -d:MONO_FEATURE_PROCESS_START -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -unsafe -resource:resources/Asterisk.wav -resource:resources/Beep.wav -resource:resources/Exclamation.wav -resource:resources/Hand.wav -resource:resources/Question.wav -d:SECURITY_DEP -d:XML_DEP -d:MONO_SECURITY_ALIAS -d:CONFIGURATION_DEP -r:./../../class/lib/basic/System.Xml.dll -r:./../../class/lib/basic/System.Configuration.dll -r:MonoSecurity=./../../class/lib/basic/Mono.Security.dll</flags>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:BOOTSTRAP_BASIC -nowarn:1699 -lib:./../../class/lib/basic -optimize /noconfig -d:CONFIGURATION_2_0 -d:FEATURE_PAL,SYSTEM_NAMESPACE,MONO,PLATFORM_UNIX -d:MONO_FEATURE_PROCESS_START -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -unsafe -resource:resources/Asterisk.wav -resource:resources/Beep.wav -resource:resources/Exclamation.wav -resource:resources/Hand.wav -resource:resources/Question.wav -d:MONO_FEATURE_BTLS -d:SECURITY_DEP -d:XML_DEP -d:MONO_SECURITY_ALIAS -d:CONFIGURATION_DEP -r:./../../class/lib/basic/System.Xml.dll -r:./../../class/lib/basic/System.Configuration.dll -r:MonoSecurity=./../../class/lib/basic/Mono.Security.dll</flags>
       <output>System.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/basic/System.dll</library_output>
@@ -68,7 +68,7 @@
     </project>
     <project dir="class/corlib" library="corlib-build">
       <boot>true</boot>
-      <flags>/codepage:65001 -unsafe -nostdlib -nowarn:612,618,1635 -d:INSIDE_CORLIB,MONO_CULTURE_DATA -d:LIBC -d:FEATURE_PAL,GENERICS_WORK,FEATURE_LIST_PREDICATES,FEATURE_SERIALIZATION,FEATURE_ASCII,FEATURE_LATIN1,FEATURE_UTF7,FEATURE_UTF32,MONO_HYBRID_ENCODING_SUPPORT,FEATURE_ASYNC_IO,NEW_EXPERIMENTAL_ASYNC_IO,FEATURE_UTF32,FEATURE_EXCEPTIONDISPATCHINFO,FEATURE_CORRUPTING_EXCEPTIONS,FEATURE_EXCEPTION_NOTIFICATIONS,FEATURE_STRONGNAME_MIGRATION,FEATURE_USE_LCID,FEATURE_FUSION,FEATURE_CRYPTO,FEATURE_X509_SECURESTRINGS,FEATURE_SYNCHRONIZATIONCONTEXT,FEATURE_SYNCHRONIZATIONCONTEXT_WAIT -d:FEATURE_MACL -d:FEATURE_REMOTING,MONO_COM,FEATURE_COMINTEROP,FEATURE_ROLE_BASED_SECURITY -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -d:NET_4_0 -d:NET_4_5 -d:MONO -nowarn:1699 -nostdlib -optimize /noconfig -d:FEATURE_PAL,GENERICS_WORK,FEATURE_LIST_PREDICATES,FEATURE_SERIALIZATION,FEATURE_ASCII,FEATURE_LATIN1,FEATURE_UTF7,FEATURE_UTF32,MONO_HYBRID_ENCODING_SUPPORT,FEATURE_ASYNC_IO,NEW_EXPERIMENTAL_ASYNC_IO,FEATURE_UTF32,FEATURE_EXCEPTIONDISPATCHINFO,FEATURE_CORRUPTING_EXCEPTIONS,FEATURE_EXCEPTION_NOTIFICATIONS,FEATURE_STRONGNAME_MIGRATION,FEATURE_USE_LCID,FEATURE_FUSION,FEATURE_CRYPTO,FEATURE_X509_SECURESTRINGS,FEATURE_SYNCHRONIZATIONCONTEXT,FEATURE_SYNCHRONIZATIONCONTEXT_WAIT -d:FEATURE_MACL -d:FEATURE_REMOTING,MONO_COM,FEATURE_COMINTEROP,FEATURE_ROLE_BASED_SECURITY -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -resource:resources/charinfo.nlp -resource:resources/collation.core.bin -resource:resources/collation.tailoring.bin -resource:resources/collation.cjkCHS.bin -resource:resources/collation.cjkCHT.bin -resource:resources/collation.cjkJA.bin -resource:resources/collation.cjkKO.bin -resource:resources/collation.cjkKOlv2.bin --runtime:v4</flags>
+      <flags>/codepage:65001 -unsafe -nostdlib -nowarn:612,618,1635 -d:INSIDE_CORLIB,MONO_CULTURE_DATA -d:LIBC -d:FEATURE_PAL,GENERICS_WORK,FEATURE_LIST_PREDICATES,FEATURE_SERIALIZATION,FEATURE_ASCII,FEATURE_LATIN1,FEATURE_UTF7,FEATURE_UTF32,MONO_HYBRID_ENCODING_SUPPORT,FEATURE_ASYNC_IO,NEW_EXPERIMENTAL_ASYNC_IO,FEATURE_UTF32,FEATURE_EXCEPTIONDISPATCHINFO,FEATURE_CORRUPTING_EXCEPTIONS,FEATURE_EXCEPTION_NOTIFICATIONS,FEATURE_STRONGNAME_MIGRATION,FEATURE_USE_LCID,FEATURE_FUSION,FEATURE_CRYPTO,FEATURE_X509_SECURESTRINGS,FEATURE_SYNCHRONIZATIONCONTEXT,FEATURE_SYNCHRONIZATIONCONTEXT_WAIT,HAS_CORLIB_CONTRACTS -d:FEATURE_MACL -d:FEATURE_REMOTING,MONO_COM,FEATURE_COMINTEROP,FEATURE_ROLE_BASED_SECURITY -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -d:NET_4_0 -d:NET_4_5 -d:MONO -nowarn:1699 -nostdlib -optimize /noconfig -d:FEATURE_PAL,GENERICS_WORK,FEATURE_LIST_PREDICATES,FEATURE_SERIALIZATION,FEATURE_ASCII,FEATURE_LATIN1,FEATURE_UTF7,FEATURE_UTF32,MONO_HYBRID_ENCODING_SUPPORT,FEATURE_ASYNC_IO,NEW_EXPERIMENTAL_ASYNC_IO,FEATURE_UTF32,FEATURE_EXCEPTIONDISPATCHINFO,FEATURE_CORRUPTING_EXCEPTIONS,FEATURE_EXCEPTION_NOTIFICATIONS,FEATURE_STRONGNAME_MIGRATION,FEATURE_USE_LCID,FEATURE_FUSION,FEATURE_CRYPTO,FEATURE_X509_SECURESTRINGS,FEATURE_SYNCHRONIZATIONCONTEXT,FEATURE_SYNCHRONIZATIONCONTEXT_WAIT,HAS_CORLIB_CONTRACTS -d:FEATURE_MACL -d:FEATURE_REMOTING,MONO_COM,FEATURE_COMINTEROP,FEATURE_ROLE_BASED_SECURITY -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -resource:resources/charinfo.nlp -resource:resources/collation.core.bin -resource:resources/collation.tailoring.bin -resource:resources/collation.cjkCHS.bin -resource:resources/collation.cjkCHT.bin -resource:resources/collation.cjkJA.bin -resource:resources/collation.cjkKO.bin -resource:resources/collation.cjkKOlv2.bin --runtime:v4</flags>
       <output>mscorlib.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/build/mscorlib.dll</library_output>
@@ -90,7 +90,7 @@
     </project>
     <project dir="class/System" library="System-build">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/build/mscorlib.dll -optimize /noconfig -nowarn:618 -d:CONFIGURATION_2_0 -d:FEATURE_PAL,SYSTEM_NAMESPACE,MONO,PLATFORM_UNIX -d:MONO_FEATURE_PROCESS_START -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -unsafe -resource:resources/Asterisk.wav -resource:resources/Beep.wav -resource:resources/Exclamation.wav -resource:resources/Hand.wav -resource:resources/Question.wav -d:SECURITY_DEP -d:XML_DEP -d:MONO_SECURITY_ALIAS -d:CONFIGURATION_DEP -r:./../../class/lib/build/System.Xml.dll -r:./../../class/lib/build/System.Configuration.dll -r:MonoSecurity=./../../class/lib/build/Mono.Security.dll</flags>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/build/mscorlib.dll -optimize /noconfig -d:CONFIGURATION_2_0 -d:FEATURE_PAL,SYSTEM_NAMESPACE,MONO,PLATFORM_UNIX -d:MONO_FEATURE_PROCESS_START -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -unsafe -resource:resources/Asterisk.wav -resource:resources/Beep.wav -resource:resources/Exclamation.wav -resource:resources/Hand.wav -resource:resources/Question.wav -d:MONO_FEATURE_BTLS -d:SECURITY_DEP -d:XML_DEP -d:MONO_SECURITY_ALIAS -d:CONFIGURATION_DEP -r:./../../class/lib/build/System.Xml.dll -r:./../../class/lib/build/System.Configuration.dll -r:MonoSecurity=./../../class/lib/build/Mono.Security.dll</flags>
       <output>System.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/build/System.dll</library_output>
     </project>
     <project dir="class/System" library="System-bare-build">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/build/mscorlib.dll -optimize /noconfig -nowarn:618 -d:CONFIGURATION_2_0 -d:FEATURE_PAL,SYSTEM_NAMESPACE,MONO,PLATFORM_UNIX -d:MONO_FEATURE_PROCESS_START -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -unsafe -resource:resources/Asterisk.wav -resource:resources/Beep.wav -resource:resources/Exclamation.wav -resource:resources/Hand.wav -resource:resources/Question.wav</flags>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/build/mscorlib.dll -optimize /noconfig -d:CONFIGURATION_2_0 -d:FEATURE_PAL,SYSTEM_NAMESPACE,MONO,PLATFORM_UNIX -d:MONO_FEATURE_PROCESS_START -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -unsafe -resource:resources/Asterisk.wav -resource:resources/Beep.wav -resource:resources/Exclamation.wav -resource:resources/Hand.wav -resource:resources/Question.wav -d:MONO_FEATURE_BTLS</flags>
       <output>System.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/build/bare/System.dll</library_output>
     </project>
     <project dir="class/System" library="System-secxml-build">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/build/mscorlib.dll -optimize /noconfig -nowarn:618 -d:CONFIGURATION_2_0 -d:FEATURE_PAL,SYSTEM_NAMESPACE,MONO,PLATFORM_UNIX -d:MONO_FEATURE_PROCESS_START -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -unsafe -resource:resources/Asterisk.wav -resource:resources/Beep.wav -resource:resources/Exclamation.wav -resource:resources/Hand.wav -resource:resources/Question.wav -d:SECURITY_DEP -d:XML_DEP -d:MONO_SECURITY_ALIAS -r:./../../class/lib/build/bare/System.Xml.dll -r:MonoSecurity=./../../class/lib/build/Mono.Security.dll</flags>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/build/mscorlib.dll -optimize /noconfig -d:CONFIGURATION_2_0 -d:FEATURE_PAL,SYSTEM_NAMESPACE,MONO,PLATFORM_UNIX -d:MONO_FEATURE_PROCESS_START -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -unsafe -resource:resources/Asterisk.wav -resource:resources/Beep.wav -resource:resources/Exclamation.wav -resource:resources/Hand.wav -resource:resources/Question.wav -d:MONO_FEATURE_BTLS -d:SECURITY_DEP -d:XML_DEP -d:MONO_SECURITY_ALIAS -r:./../../class/lib/build/bare/System.Xml.dll -r:MonoSecurity=./../../class/lib/build/Mono.Security.dll</flags>
       <output>System.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/build/secxml/System.dll</library_output>
     </project>
     <project dir="class/Mono.Cecil" library="Mono.Cecil-build">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/build/mscorlib.dll -optimize /noconfig -keyfile:../mono.snk -d:NET_3_5 /publicsign -r:./../../class/lib/build/System.Core.dll</flags>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/build/mscorlib.dll -optimize /noconfig -keyfile:../mono.snk -d:NET_4_0 /publicsign -r:./../../class/lib/build/System.Core.dll</flags>
       <output>Mono.Cecil.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/build/Mono.Cecil.dll</library_output>
       <resources></resources>
       <response>Mono.Cecil.Mdb.dll.sources</response>
     </project>
+    <project dir="class/System.ComponentModel.Composition.4.5" library="System.ComponentModel.Composition-build">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/build/mscorlib.dll -optimize /noconfig -d:CLR40 -d:USE_ECMA_KEY,FEATURE_REFLECTIONCONTEXT,FEATURE_REFLECTIONFILEIO,FEATURE_SERIALIZATION,FEATURE_SLIMLOCK -nowarn:219,414 -r:./../../class/lib/build/System.dll -r:./../../class/lib/build/System.Core.dll</flags>
+      <output>System.ComponentModel.Composition.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/build/System.ComponentModel.Composition.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>build</profile>
+      <resources></resources>
+      <response>System.ComponentModel.Composition.dll.sources</response>
+    </project>
+    <project dir="class/System.Numerics" library="System.Numerics-build">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/build/mscorlib.dll -optimize /noconfig /unsafe -nowarn:414 -r:./../../class/lib/build/System.dll</flags>
+      <output>System.Numerics.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/build/System.Numerics.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>build</profile>
+      <resources></resources>
+      <response>System.Numerics.dll.sources</response>
+    </project>
+    <project dir="class/System.Xml.Linq" library="System.Xml.Linq-build">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/build/mscorlib.dll -optimize /noconfig -r:./../../class/lib/build/System.dll -r:./../../class/lib/build/System.Core.dll -r:./../../class/lib/build/System.Xml.dll</flags>
+      <output>System.Xml.Linq.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/build/System.Xml.Linq.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>build</profile>
+      <resources></resources>
+      <response>System.Xml.Linq.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Runtime" library="Facades_System.Runtime-build">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/build/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/build/System.dll -r:./../../../class/lib/build/System.ComponentModel.Composition.dll -r:./../../../class/lib/build/System.Core.dll</flags>
+      <output>System.Runtime.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/build/Facades/System.Runtime.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>build</profile>
+      <resources></resources>
+      <response>System.Runtime.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Reflection" library="Facades_System.Reflection-build">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/build/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Reflection.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/build/Facades/System.Reflection.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>build</profile>
+      <resources></resources>
+      <response>System.Reflection.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Collections" library="Facades_System.Collections-build">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/build/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/build/System.dll -r:./../../../class/lib/build/System.Core.dll</flags>
+      <output>System.Collections.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/build/Facades/System.Collections.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>build</profile>
+      <resources></resources>
+      <response>System.Collections.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Resources.ResourceManager" library="Facades_System.Resources.ResourceManager-build">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/build/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Resources.ResourceManager.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/build/Facades/System.Resources.ResourceManager.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>build</profile>
+      <resources></resources>
+      <response>System.Resources.ResourceManager.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Globalization" library="Facades_System.Globalization-build">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/build/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Globalization.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/build/Facades/System.Globalization.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>build</profile>
+      <resources></resources>
+      <response>System.Globalization.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Threading.Tasks" library="Facades_System.Threading.Tasks-build">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/build/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/build/System.Core.dll</flags>
+      <output>System.Threading.Tasks.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/build/Facades/System.Threading.Tasks.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>build</profile>
+      <resources></resources>
+      <response>System.Threading.Tasks.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Collections.Concurrent" library="Facades_System.Collections.Concurrent-build">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/build/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/build/System.dll</flags>
+      <output>System.Collections.Concurrent.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/build/Facades/System.Collections.Concurrent.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>build</profile>
+      <resources></resources>
+      <response>System.Collections.Concurrent.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Text.Encoding" library="Facades_System.Text.Encoding-build">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/build/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Text.Encoding.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/build/Facades/System.Text.Encoding.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>build</profile>
+      <resources></resources>
+      <response>System.Text.Encoding.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.IO" library="Facades_System.IO-build">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/build/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/build/System.dll</flags>
+      <output>System.IO.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/build/Facades/System.IO.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>build</profile>
+      <resources></resources>
+      <response>System.IO.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Threading" library="Facades_System.Threading-build">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/build/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/build/System.dll -r:./../../../class/lib/build/System.Core.dll</flags>
+      <output>System.Threading.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/build/Facades/System.Threading.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>build</profile>
+      <resources></resources>
+      <response>System.Threading.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Diagnostics.Debug" library="Facades_System.Diagnostics.Debug-build">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/build/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/build/System.dll</flags>
+      <output>System.Diagnostics.Debug.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/build/Facades/System.Diagnostics.Debug.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>build</profile>
+      <resources></resources>
+      <response>System.Diagnostics.Debug.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Linq.Expressions" library="Facades_System.Linq.Expressions-build">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/build/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/build/System.Core.dll</flags>
+      <output>System.Linq.Expressions.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/build/Facades/System.Linq.Expressions.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>build</profile>
+      <resources></resources>
+      <response>System.Linq.Expressions.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Dynamic.Runtime" library="Facades_System.Dynamic.Runtime-build">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/build/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/build/System.Core.dll -r:./../../../class/lib/build/System.dll</flags>
+      <output>System.Dynamic.Runtime.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/build/Facades/System.Dynamic.Runtime.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>build</profile>
+      <resources></resources>
+      <response>System.Dynamic.Runtime.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Linq" library="Facades_System.Linq-build">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/build/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/build/System.Core.dll</flags>
+      <output>System.Linq.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/build/Facades/System.Linq.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>build</profile>
+      <resources></resources>
+      <response>System.Linq.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Threading.Tasks.Parallel" library="Facades_System.Threading.Tasks.Parallel-build">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/build/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Threading.Tasks.Parallel.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/build/Facades/System.Threading.Tasks.Parallel.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>build</profile>
+      <resources></resources>
+      <response>System.Threading.Tasks.Parallel.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Xml.ReaderWriter" library="Facades_System.Xml.ReaderWriter-build">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/build/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/build/System.Xml.dll</flags>
+      <output>System.Xml.ReaderWriter.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/build/Facades/System.Xml.ReaderWriter.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>build</profile>
+      <resources></resources>
+      <response>System.Xml.ReaderWriter.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Diagnostics.Tools" library="Facades_System.Diagnostics.Tools-build">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/build/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/build/System.dll</flags>
+      <output>System.Diagnostics.Tools.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/build/Facades/System.Diagnostics.Tools.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>build</profile>
+      <resources></resources>
+      <response>System.Diagnostics.Tools.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Reflection.Primitives" library="Facades_System.Reflection.Primitives-build">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/build/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Reflection.Primitives.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/build/Facades/System.Reflection.Primitives.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>build</profile>
+      <resources></resources>
+      <response>System.Reflection.Primitives.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Runtime.Extensions" library="Facades_System.Runtime.Extensions-build">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/build/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/build/System.dll</flags>
+      <output>System.Runtime.Extensions.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/build/Facades/System.Runtime.Extensions.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>build</profile>
+      <resources></resources>
+      <response>System.Runtime.Extensions.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Runtime.InteropServices" library="Facades_System.Runtime.InteropServices-build">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/build/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/build/System.dll -r:./../../../class/lib/build/System.Core.dll</flags>
+      <output>System.Runtime.InteropServices.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/build/Facades/System.Runtime.InteropServices.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>build</profile>
+      <resources></resources>
+      <response>System.Runtime.InteropServices.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Text.Encoding.Extensions" library="Facades_System.Text.Encoding.Extensions-build">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/build/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Text.Encoding.Extensions.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/build/Facades/System.Text.Encoding.Extensions.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>build</profile>
+      <resources></resources>
+      <response>System.Text.Encoding.Extensions.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Runtime.Numerics" library="Facades_System.Runtime.Numerics-build">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/build/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/build/System.Numerics.dll</flags>
+      <output>System.Runtime.Numerics.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/build/Facades/System.Runtime.Numerics.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>build</profile>
+      <resources></resources>
+      <response>System.Runtime.Numerics.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Xml.XDocument" library="Facades_System.Xml.XDocument-build">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/build/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/build/System.Xml.Linq.dll -r:./../../../class/lib/build/System.Xml.dll</flags>
+      <output>System.Xml.XDocument.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/build/Facades/System.Xml.XDocument.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>build</profile>
+      <resources></resources>
+      <response>System.Xml.XDocument.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Reflection.Extensions" library="Facades_System.Reflection.Extensions-build">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/build/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Reflection.Extensions.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/build/Facades/System.Reflection.Extensions.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>build</profile>
+      <resources></resources>
+      <response>System.Reflection.Extensions.dll.sources</response>
+    </project>
     <project dir="mcs" library="mcs-build">
       <boot></boot>
       <flags>/codepage:65001 -debug -d:STATIC,NO_SYMBOL_WRITER,NO_AUTHENTICODE -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_PROCESS_START -d:NET_4_0 -d:NET_4_5 -d:MONO -nowarn:1699 -nostdlib -r:./../class/lib/build/mscorlib.dll -optimize /noconfig -r:System -r:System.Core -r:System.Xml</flags>
     </project>
     <project dir="tools/gacutil" library="gacutil-build">
       <boot></boot>
-      <flags>/codepage:65001 -unsafe -d:NET_4_0 -d:NET_4_5 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/build/mscorlib.dll -optimize /noconfig -r:Mono.Security</flags>
+      <flags>/codepage:65001 -unsafe -define:NO_SYMBOL_WRITER -d:NET_4_0 -d:NET_4_5 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/build/mscorlib.dll -optimize /noconfig -r:System -r:Mono.Security -r:System.Security</flags>
       <output>gacutil.exe</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/build/gacutil.exe</library_output>
     </project>
     <project dir="class/corlib" library="corlib-net_4_x">
       <boot>true</boot>
-      <flags>/codepage:65001 -unsafe -nostdlib -nowarn:612,618,1635 -d:INSIDE_CORLIB,MONO_CULTURE_DATA -d:LIBC -d:FEATURE_PAL,GENERICS_WORK,FEATURE_LIST_PREDICATES,FEATURE_SERIALIZATION,FEATURE_ASCII,FEATURE_LATIN1,FEATURE_UTF7,FEATURE_UTF32,MONO_HYBRID_ENCODING_SUPPORT,FEATURE_ASYNC_IO,NEW_EXPERIMENTAL_ASYNC_IO,FEATURE_UTF32,FEATURE_EXCEPTIONDISPATCHINFO,FEATURE_CORRUPTING_EXCEPTIONS,FEATURE_EXCEPTION_NOTIFICATIONS,FEATURE_STRONGNAME_MIGRATION,FEATURE_USE_LCID,FEATURE_FUSION,FEATURE_CRYPTO,FEATURE_X509_SECURESTRINGS,FEATURE_SYNCHRONIZATIONCONTEXT,FEATURE_SYNCHRONIZATIONCONTEXT_WAIT -d:FEATURE_MACL -d:FEATURE_REMOTING,MONO_COM,FEATURE_COMINTEROP,FEATURE_ROLE_BASED_SECURITY -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -debug -optimize /noconfig -d:FEATURE_PAL,GENERICS_WORK,FEATURE_LIST_PREDICATES,FEATURE_SERIALIZATION,FEATURE_ASCII,FEATURE_LATIN1,FEATURE_UTF7,FEATURE_UTF32,MONO_HYBRID_ENCODING_SUPPORT,FEATURE_ASYNC_IO,NEW_EXPERIMENTAL_ASYNC_IO,FEATURE_UTF32,FEATURE_EXCEPTIONDISPATCHINFO,FEATURE_CORRUPTING_EXCEPTIONS,FEATURE_EXCEPTION_NOTIFICATIONS,FEATURE_STRONGNAME_MIGRATION,FEATURE_USE_LCID,FEATURE_FUSION,FEATURE_CRYPTO,FEATURE_X509_SECURESTRINGS,FEATURE_SYNCHRONIZATIONCONTEXT,FEATURE_SYNCHRONIZATIONCONTEXT_WAIT -d:FEATURE_MACL -d:FEATURE_REMOTING,MONO_COM,FEATURE_COMINTEROP,FEATURE_ROLE_BASED_SECURITY -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -resource:resources/charinfo.nlp -resource:resources/collation.core.bin -resource:resources/collation.tailoring.bin -resource:resources/collation.cjkCHS.bin -resource:resources/collation.cjkCHT.bin -resource:resources/collation.cjkJA.bin -resource:resources/collation.cjkKO.bin -resource:resources/collation.cjkKOlv2.bin --runtime:v4</flags>
+      <flags>/codepage:65001 -unsafe -nostdlib -nowarn:612,618,1635 -d:INSIDE_CORLIB,MONO_CULTURE_DATA -d:LIBC -d:FEATURE_PAL,GENERICS_WORK,FEATURE_LIST_PREDICATES,FEATURE_SERIALIZATION,FEATURE_ASCII,FEATURE_LATIN1,FEATURE_UTF7,FEATURE_UTF32,MONO_HYBRID_ENCODING_SUPPORT,FEATURE_ASYNC_IO,NEW_EXPERIMENTAL_ASYNC_IO,FEATURE_UTF32,FEATURE_EXCEPTIONDISPATCHINFO,FEATURE_CORRUPTING_EXCEPTIONS,FEATURE_EXCEPTION_NOTIFICATIONS,FEATURE_STRONGNAME_MIGRATION,FEATURE_USE_LCID,FEATURE_FUSION,FEATURE_CRYPTO,FEATURE_X509_SECURESTRINGS,FEATURE_SYNCHRONIZATIONCONTEXT,FEATURE_SYNCHRONIZATIONCONTEXT_WAIT,HAS_CORLIB_CONTRACTS -d:FEATURE_MACL -d:FEATURE_REMOTING,MONO_COM,FEATURE_COMINTEROP,FEATURE_ROLE_BASED_SECURITY -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -debug -optimize /noconfig -d:FEATURE_PAL,GENERICS_WORK,FEATURE_LIST_PREDICATES,FEATURE_SERIALIZATION,FEATURE_ASCII,FEATURE_LATIN1,FEATURE_UTF7,FEATURE_UTF32,MONO_HYBRID_ENCODING_SUPPORT,FEATURE_ASYNC_IO,NEW_EXPERIMENTAL_ASYNC_IO,FEATURE_UTF32,FEATURE_EXCEPTIONDISPATCHINFO,FEATURE_CORRUPTING_EXCEPTIONS,FEATURE_EXCEPTION_NOTIFICATIONS,FEATURE_STRONGNAME_MIGRATION,FEATURE_USE_LCID,FEATURE_FUSION,FEATURE_CRYPTO,FEATURE_X509_SECURESTRINGS,FEATURE_SYNCHRONIZATIONCONTEXT,FEATURE_SYNCHRONIZATIONCONTEXT_WAIT,HAS_CORLIB_CONTRACTS -d:FEATURE_MACL -d:FEATURE_REMOTING,MONO_COM,FEATURE_COMINTEROP,FEATURE_ROLE_BASED_SECURITY -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -resource:resources/charinfo.nlp -resource:resources/collation.core.bin -resource:resources/collation.tailoring.bin -resource:resources/collation.cjkCHS.bin -resource:resources/collation.cjkCHT.bin -resource:resources/collation.cjkJA.bin -resource:resources/collation.cjkKO.bin -resource:resources/collation.cjkKOlv2.bin --runtime:v4</flags>
       <output>mscorlib.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/mscorlib.dll</library_output>
       <fx_version>4.5</fx_version>
       <profile>net_4_x</profile>
       <resources></resources>
-      <response>./../../build/deps/net_4_x_corlib.dll.sources</response>
+      <response>corlib.dll.sources</response>
     </project>
     <project dir="class/corlib" library="corlib-tests-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -unsafe -nostdlib -nowarn:612,618,1635 -d:INSIDE_CORLIB,MONO_CULTURE_DATA -d:LIBC -d:FEATURE_PAL,GENERICS_WORK,FEATURE_LIST_PREDICATES,FEATURE_SERIALIZATION,FEATURE_ASCII,FEATURE_LATIN1,FEATURE_UTF7,FEATURE_UTF32,MONO_HYBRID_ENCODING_SUPPORT,FEATURE_ASYNC_IO,NEW_EXPERIMENTAL_ASYNC_IO,FEATURE_UTF32,FEATURE_EXCEPTIONDISPATCHINFO,FEATURE_CORRUPTING_EXCEPTIONS,FEATURE_EXCEPTION_NOTIFICATIONS,FEATURE_STRONGNAME_MIGRATION,FEATURE_USE_LCID,FEATURE_FUSION,FEATURE_CRYPTO,FEATURE_X509_SECURESTRINGS,FEATURE_SYNCHRONIZATIONCONTEXT,FEATURE_SYNCHRONIZATIONCONTEXT_WAIT -d:FEATURE_MACL -d:FEATURE_REMOTING,MONO_COM,FEATURE_COMINTEROP,FEATURE_ROLE_BASED_SECURITY -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -debug -optimize -r:./../../class/lib/net_4_x/mscorlib.dll -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -debug -nowarn:168,219,618,672 -unsafe -define:MONO_DATACONVERTER_STATIC_METHODS -resource:Test/resources/Resources.resources</flags>
+      <flags>/codepage:65001 -unsafe -nostdlib -nowarn:612,618,1635 -d:INSIDE_CORLIB,MONO_CULTURE_DATA -d:LIBC -d:FEATURE_PAL,GENERICS_WORK,FEATURE_LIST_PREDICATES,FEATURE_SERIALIZATION,FEATURE_ASCII,FEATURE_LATIN1,FEATURE_UTF7,FEATURE_UTF32,MONO_HYBRID_ENCODING_SUPPORT,FEATURE_ASYNC_IO,NEW_EXPERIMENTAL_ASYNC_IO,FEATURE_UTF32,FEATURE_EXCEPTIONDISPATCHINFO,FEATURE_CORRUPTING_EXCEPTIONS,FEATURE_EXCEPTION_NOTIFICATIONS,FEATURE_STRONGNAME_MIGRATION,FEATURE_USE_LCID,FEATURE_FUSION,FEATURE_CRYPTO,FEATURE_X509_SECURESTRINGS,FEATURE_SYNCHRONIZATIONCONTEXT,FEATURE_SYNCHRONIZATIONCONTEXT_WAIT,HAS_CORLIB_CONTRACTS -d:FEATURE_MACL -d:FEATURE_REMOTING,MONO_COM,FEATURE_COMINTEROP,FEATURE_ROLE_BASED_SECURITY -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -debug -optimize -r:./../../class/lib/net_4_x/mscorlib.dll -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -debug -nowarn:168,219,618,672 -unsafe -define:MONO_DATACONVERTER_STATIC_METHODS -resource:Test/resources/Resources.resources</flags>
       <output>net_4_x_corlib_test.dll</output>
       <built_sources></built_sources>
       <library_output>net_4_x_corlib_test.dll</library_output>
     </project>
     <project dir="class/System" library="System-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -nowarn:618 -d:CONFIGURATION_2_0 -d:FEATURE_PAL,SYSTEM_NAMESPACE,MONO,PLATFORM_UNIX -d:MONO_FEATURE_PROCESS_START -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -unsafe -resource:resources/Asterisk.wav -resource:resources/Beep.wav -resource:resources/Exclamation.wav -resource:resources/Hand.wav -resource:resources/Question.wav -d:SECURITY_DEP -d:XML_DEP -d:MONO_SECURITY_ALIAS -d:CONFIGURATION_DEP -r:./../../class/lib/net_4_x/System.Xml.dll -r:./../../class/lib/net_4_x/System.Configuration.dll -r:MonoSecurity=./../../class/lib/net_4_x/Mono.Security.dll</flags>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -d:CONFIGURATION_2_0 -d:FEATURE_PAL,SYSTEM_NAMESPACE,MONO,PLATFORM_UNIX -d:MONO_FEATURE_PROCESS_START -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -unsafe -resource:resources/Asterisk.wav -resource:resources/Beep.wav -resource:resources/Exclamation.wav -resource:resources/Hand.wav -resource:resources/Question.wav -d:MONO_FEATURE_BTLS -d:SECURITY_DEP -d:XML_DEP -d:MONO_SECURITY_ALIAS -d:CONFIGURATION_DEP -r:./../../class/lib/net_4_x/System.Xml.dll -r:./../../class/lib/net_4_x/System.Configuration.dll -r:MonoSecurity=./../../class/lib/net_4_x/Mono.Security.dll</flags>
       <output>System.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.dll</library_output>
     </project>
     <project dir="class/System" library="System-bare-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -nowarn:618 -d:CONFIGURATION_2_0 -d:FEATURE_PAL,SYSTEM_NAMESPACE,MONO,PLATFORM_UNIX -d:MONO_FEATURE_PROCESS_START -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -unsafe -resource:resources/Asterisk.wav -resource:resources/Beep.wav -resource:resources/Exclamation.wav -resource:resources/Hand.wav -resource:resources/Question.wav</flags>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -d:CONFIGURATION_2_0 -d:FEATURE_PAL,SYSTEM_NAMESPACE,MONO,PLATFORM_UNIX -d:MONO_FEATURE_PROCESS_START -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -unsafe -resource:resources/Asterisk.wav -resource:resources/Beep.wav -resource:resources/Exclamation.wav -resource:resources/Hand.wav -resource:resources/Question.wav -d:MONO_FEATURE_BTLS</flags>
       <output>System.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/bare/System.dll</library_output>
     </project>
     <project dir="class/System" library="System-secxml-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -nowarn:618 -d:CONFIGURATION_2_0 -d:FEATURE_PAL,SYSTEM_NAMESPACE,MONO,PLATFORM_UNIX -d:MONO_FEATURE_PROCESS_START -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -unsafe -resource:resources/Asterisk.wav -resource:resources/Beep.wav -resource:resources/Exclamation.wav -resource:resources/Hand.wav -resource:resources/Question.wav -d:SECURITY_DEP -d:XML_DEP -d:MONO_SECURITY_ALIAS -r:./../../class/lib/net_4_x/bare/System.Xml.dll -r:MonoSecurity=./../../class/lib/net_4_x/Mono.Security.dll</flags>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -d:CONFIGURATION_2_0 -d:FEATURE_PAL,SYSTEM_NAMESPACE,MONO,PLATFORM_UNIX -d:MONO_FEATURE_PROCESS_START -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -unsafe -resource:resources/Asterisk.wav -resource:resources/Beep.wav -resource:resources/Exclamation.wav -resource:resources/Hand.wav -resource:resources/Question.wav -d:MONO_FEATURE_BTLS -d:SECURITY_DEP -d:XML_DEP -d:MONO_SECURITY_ALIAS -r:./../../class/lib/net_4_x/bare/System.Xml.dll -r:MonoSecurity=./../../class/lib/net_4_x/Mono.Security.dll</flags>
       <output>System.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/secxml/System.dll</library_output>
     </project>
     <project dir="class/System.Data" library="System.Data-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -nowarn:169,219,414,649 -d:PLATFORM_UNIX -d:USEOFFSET -d:MONO_PARTIAL_DATA_IMPORT -unsafe -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Xml.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.Numerics.dll -r:./../../class/lib/net_4_x/System.EnterpriseServices.dll -r:./../../class/lib/net_4_x/Mono.Data.Tds.dll -r:./../../class/lib/net_4_x/System.Configuration.dll -r:./../../class/lib/net_4_x/System.Transactions.dll</flags>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -nowarn:219,414,649 -d:PLATFORM_UNIX -d:USEOFFSET -d:MONO_PARTIAL_DATA_IMPORT -unsafe -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Xml.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.Numerics.dll -r:./../../class/lib/net_4_x/System.EnterpriseServices.dll -r:./../../class/lib/net_4_x/Mono.Data.Tds.dll -r:./../../class/lib/net_4_x/System.Configuration.dll -r:./../../class/lib/net_4_x/System.Transactions.dll</flags>
       <output>System.Data.dll</output>
       <built_sources>gen_OdbcConnection.cs gen_OleDbConnection.cs gen_OdbcParameter.cs gen_OleDbParameter.cs gen_OdbcParameterCollection.cs gen_OleDbParameterCollection.cs</built_sources>
       <library_output>./../../class/lib/net_4_x/System.Data.dll</library_output>
     </project>
     <project dir="class/System.Data" library="System.Data-tests-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize -r:./../../class/lib/net_4_x/System.Data.dll -nowarn:169,219,414,649 -d:PLATFORM_UNIX -d:USEOFFSET -d:MONO_PARTIAL_DATA_IMPORT -unsafe -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Xml.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.Numerics.dll -r:./../../class/lib/net_4_x/System.EnterpriseServices.dll -r:./../../class/lib/net_4_x/Mono.Data.Tds.dll -r:./../../class/lib/net_4_x/System.Configuration.dll -r:./../../class/lib/net_4_x/System.Transactions.dll -nowarn:618,169,612,219,168</flags>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize -r:./../../class/lib/net_4_x/System.Data.dll -nowarn:219,414,649 -d:PLATFORM_UNIX -d:USEOFFSET -d:MONO_PARTIAL_DATA_IMPORT -unsafe -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Xml.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.Numerics.dll -r:./../../class/lib/net_4_x/System.EnterpriseServices.dll -r:./../../class/lib/net_4_x/Mono.Data.Tds.dll -r:./../../class/lib/net_4_x/System.Configuration.dll -r:./../../class/lib/net_4_x/System.Transactions.dll -nowarn:618,169,612,219,168</flags>
       <output>net_4_x_System.Data_test.dll</output>
       <built_sources>gen_OdbcConnection.cs gen_OleDbConnection.cs gen_OdbcParameter.cs gen_OleDbParameter.cs gen_OdbcParameterCollection.cs gen_OleDbParameterCollection.cs</built_sources>
       <library_output>net_4_x_System.Data_test.dll</library_output>
     </project>
     <project dir="class/System.IdentityModel" library="System.IdentityModel-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig /d:NET_3_0 -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Xml.dll -r:./../../class/lib/net_4_x/System.Security.dll -r:./../../class/lib/net_4_x/System.Configuration.dll -r:./../../class/lib/net_4_x/Mono.Security.dll -r:./../../class/lib/net_4_x/System.Runtime.Serialization.dll -r:./../../class/lib/net_4_x/System.Web.dll -r:./../../class/lib/net_4_x/System.Web.ApplicationServices.dll</flags>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig /d:NET_3_0 -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Xml.dll -r:./../../class/lib/net_4_x/System.Security.dll -r:./../../class/lib/net_4_x/Mono.Security.dll -r:./../../class/lib/net_4_x/System.Runtime.Serialization.dll -r:./../../class/lib/net_4_x/System.Configuration.dll -r:./../../class/lib/net_4_x/System.Web.dll -r:./../../class/lib/net_4_x/System.Web.ApplicationServices.dll</flags>
       <output>System.IdentityModel.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.IdentityModel.dll</library_output>
       <fx_version>4.5</fx_version>
       <profile>net_4_x</profile>
       <resources></resources>
-      <response>System.IdentityModel.dll.sources</response>
+      <response>./../../build/deps/net_4_x_System.IdentityModel.dll.sources</response>
     </project>
     <project dir="class/System.IdentityModel" library="System.IdentityModel-tests-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize -r:./../../class/lib/net_4_x/System.IdentityModel.dll /d:NET_3_0 -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Xml.dll -r:./../../class/lib/net_4_x/System.Security.dll -r:./../../class/lib/net_4_x/System.Configuration.dll -r:./../../class/lib/net_4_x/Mono.Security.dll -r:./../../class/lib/net_4_x/System.Runtime.Serialization.dll -r:./../../class/lib/net_4_x/System.Web.dll -r:./../../class/lib/net_4_x/System.Web.ApplicationServices.dll</flags>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize -r:./../../class/lib/net_4_x/System.IdentityModel.dll /d:NET_3_0 -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Xml.dll -r:./../../class/lib/net_4_x/System.Security.dll -r:./../../class/lib/net_4_x/Mono.Security.dll -r:./../../class/lib/net_4_x/System.Runtime.Serialization.dll -r:./../../class/lib/net_4_x/System.Configuration.dll -r:./../../class/lib/net_4_x/System.Web.dll -r:./../../class/lib/net_4_x/System.Web.ApplicationServices.dll</flags>
       <output>net_4_x_System.IdentityModel_test.dll</output>
       <built_sources></built_sources>
       <library_output>net_4_x_System.IdentityModel_test.dll</library_output>
     </project>
     <project dir="class/System.ServiceModel" library="System.ServiceModel-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig /nowarn:414,169,67,3005,436,219,618 /unsafe /d:TRACE /resource:resources/WS-Addressing.schema /resource:resources/ws-addr.xsd /d:NET_3_0 -define:HAS_ACTIVATION -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Xml.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.Runtime.Serialization.dll -r:./../../class/lib/net_4_x/System.Configuration.dll -r:./../../class/lib/net_4_x/System.Data.dll -r:./../../class/lib/net_4_x/System.Security.dll -r:./../../class/lib/net_4_x/System.IdentityModel.dll -r:./../../class/lib/net_4_x/System.IdentityModel.Selectors.dll -r:./../../class/lib/net_4_x/System.Transactions.dll -r:./../../class/lib/net_4_x/System.Messaging.dll -r:./../../class/lib/net_4_x/System.Web.Services.dll -r:./../../class/lib/net_4_x/Mono.Security.dll -r:./../../class/lib/net_4_x/System.Web.dll -r:./../../class/lib/net_4_x/System.ServiceModel.Activation.dll -r:./../../class/lib/net_4_x/System.Web.ApplicationServices.dll</flags>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig /nowarn:414,169,67,3005,436,219,618 /unsafe /d:TRACE /resource:resources/WS-Addressing.schema /resource:resources/ws-addr.xsd /d:NET_3_0 -define:HAS_ACTIVATION -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Xml.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.Runtime.Serialization.dll -r:./../../class/lib/net_4_x/System.IdentityModel.dll -r:./../../class/lib/net_4_x/System.Configuration.dll -r:./../../class/lib/net_4_x/System.Data.dll -r:./../../class/lib/net_4_x/System.Security.dll -r:./../../class/lib/net_4_x/System.IdentityModel.Selectors.dll -r:./../../class/lib/net_4_x/System.Transactions.dll -r:./../../class/lib/net_4_x/System.Messaging.dll -r:./../../class/lib/net_4_x/System.Web.Services.dll -r:./../../class/lib/net_4_x/Mono.Security.dll -r:./../../class/lib/net_4_x/System.Web.dll -r:./../../class/lib/net_4_x/System.ServiceModel.Activation.dll -r:./../../class/lib/net_4_x/System.Web.ApplicationServices.dll</flags>
       <output>System.ServiceModel.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.ServiceModel.dll</library_output>
     </project>
     <project dir="class/System.ServiceModel" library="System.ServiceModel-tests-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize -r:./../../class/lib/net_4_x/plainservice/System.ServiceModel.dll /nowarn:414,169,67,3005,436,219,618 /unsafe /d:TRACE /resource:resources/WS-Addressing.schema /resource:resources/ws-addr.xsd /d:NET_3_0 -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Xml.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.Runtime.Serialization.dll -r:./../../class/lib/net_4_x/System.Configuration.dll -r:./../../class/lib/net_4_x/System.Data.dll -r:./../../class/lib/net_4_x/System.Security.dll -r:./../../class/lib/net_4_x/System.IdentityModel.dll -r:./../../class/lib/net_4_x/System.IdentityModel.Selectors.dll -r:./../../class/lib/net_4_x/System.Transactions.dll -r:./../../class/lib/net_4_x/System.Messaging.dll -r:./../../class/lib/net_4_x/System.Web.Services.dll -r:./../../class/lib/net_4_x/Mono.Security.dll -r:./../../class/lib/net_4_x/System.Web.dll -r:./../../class/lib/net_4_x/System.Web.ApplicationServices.dll</flags>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize -r:./../../class/lib/net_4_x/plainservice/System.ServiceModel.dll /nowarn:414,169,67,3005,436,219,618 /unsafe /d:TRACE /resource:resources/WS-Addressing.schema /resource:resources/ws-addr.xsd /d:NET_3_0 -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Xml.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.Runtime.Serialization.dll -r:./../../class/lib/net_4_x/System.IdentityModel.dll -r:./../../class/lib/net_4_x/System.Configuration.dll -r:./../../class/lib/net_4_x/System.Data.dll -r:./../../class/lib/net_4_x/System.Security.dll -r:./../../class/lib/net_4_x/System.IdentityModel.Selectors.dll -r:./../../class/lib/net_4_x/System.Transactions.dll -r:./../../class/lib/net_4_x/System.Messaging.dll -r:./../../class/lib/net_4_x/System.Web.Services.dll -r:./../../class/lib/net_4_x/Mono.Security.dll -r:./../../class/lib/net_4_x/System.Web.dll -r:./../../class/lib/net_4_x/System.Web.ApplicationServices.dll</flags>
       <output>net_4_x_System.ServiceModel_test.dll</output>
       <built_sources></built_sources>
       <library_output>net_4_x_System.ServiceModel_test.dll</library_output>
     </project>
     <project dir="class/System.ServiceModel" library="System.ServiceModel-plainservice-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig /nowarn:414,169,67,3005,436,219,618 /unsafe /d:TRACE /resource:resources/WS-Addressing.schema /resource:resources/ws-addr.xsd /d:NET_3_0 -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Xml.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.Runtime.Serialization.dll -r:./../../class/lib/net_4_x/System.Configuration.dll -r:./../../class/lib/net_4_x/System.Data.dll -r:./../../class/lib/net_4_x/System.Security.dll -r:./../../class/lib/net_4_x/System.IdentityModel.dll -r:./../../class/lib/net_4_x/System.IdentityModel.Selectors.dll -r:./../../class/lib/net_4_x/System.Transactions.dll -r:./../../class/lib/net_4_x/System.Messaging.dll -r:./../../class/lib/net_4_x/System.Web.Services.dll -r:./../../class/lib/net_4_x/Mono.Security.dll -r:./../../class/lib/net_4_x/System.Web.dll -r:./../../class/lib/net_4_x/System.Web.ApplicationServices.dll</flags>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig /nowarn:414,169,67,3005,436,219,618 /unsafe /d:TRACE /resource:resources/WS-Addressing.schema /resource:resources/ws-addr.xsd /d:NET_3_0 -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Xml.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.Runtime.Serialization.dll -r:./../../class/lib/net_4_x/System.IdentityModel.dll -r:./../../class/lib/net_4_x/System.Configuration.dll -r:./../../class/lib/net_4_x/System.Data.dll -r:./../../class/lib/net_4_x/System.Security.dll -r:./../../class/lib/net_4_x/System.IdentityModel.Selectors.dll -r:./../../class/lib/net_4_x/System.Transactions.dll -r:./../../class/lib/net_4_x/System.Messaging.dll -r:./../../class/lib/net_4_x/System.Web.Services.dll -r:./../../class/lib/net_4_x/Mono.Security.dll -r:./../../class/lib/net_4_x/System.Web.dll -r:./../../class/lib/net_4_x/System.Web.ApplicationServices.dll</flags>
       <output>System.ServiceModel.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/plainservice/System.ServiceModel.dll</library_output>
     </project>
     <project dir="class/System.ServiceModel" library="System.ServiceModel-tests-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize -r:./../../class/lib/net_4_x/plainservice/System.ServiceModel.dll /nowarn:414,169,67,3005,436,219,618 /unsafe /d:TRACE /resource:resources/WS-Addressing.schema /resource:resources/ws-addr.xsd /d:NET_3_0 -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Xml.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.Runtime.Serialization.dll -r:./../../class/lib/net_4_x/System.Configuration.dll -r:./../../class/lib/net_4_x/System.Data.dll -r:./../../class/lib/net_4_x/System.Security.dll -r:./../../class/lib/net_4_x/System.IdentityModel.dll -r:./../../class/lib/net_4_x/System.IdentityModel.Selectors.dll -r:./../../class/lib/net_4_x/System.Transactions.dll -r:./../../class/lib/net_4_x/System.Messaging.dll -r:./../../class/lib/net_4_x/System.Web.Services.dll -r:./../../class/lib/net_4_x/Mono.Security.dll -r:./../../class/lib/net_4_x/System.Web.dll -r:./../../class/lib/net_4_x/System.Web.ApplicationServices.dll</flags>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize -r:./../../class/lib/net_4_x/plainservice/System.ServiceModel.dll /nowarn:414,169,67,3005,436,219,618 /unsafe /d:TRACE /resource:resources/WS-Addressing.schema /resource:resources/ws-addr.xsd /d:NET_3_0 -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Xml.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.Runtime.Serialization.dll -r:./../../class/lib/net_4_x/System.IdentityModel.dll -r:./../../class/lib/net_4_x/System.Configuration.dll -r:./../../class/lib/net_4_x/System.Data.dll -r:./../../class/lib/net_4_x/System.Security.dll -r:./../../class/lib/net_4_x/System.IdentityModel.Selectors.dll -r:./../../class/lib/net_4_x/System.Transactions.dll -r:./../../class/lib/net_4_x/System.Messaging.dll -r:./../../class/lib/net_4_x/System.Web.Services.dll -r:./../../class/lib/net_4_x/Mono.Security.dll -r:./../../class/lib/net_4_x/System.Web.dll -r:./../../class/lib/net_4_x/System.Web.ApplicationServices.dll</flags>
       <output>net_4_x_System.ServiceModel_test.dll</output>
       <built_sources></built_sources>
       <library_output>net_4_x_System.ServiceModel_test.dll</library_output>
       <resources>System.Web.Http.WebHost.Properties.CommonWebApiResources,../../../external/aspnetwebstack/src/Common/CommonWebApiResources.resx System.Web.Http.WebHost.Properties.SRResources,../../../external/aspnetwebstack/src/System.Web.Http.WebHost/Properties/SRResources.resx</resources>
       <response>System.Web.Http.WebHost.dll.sources</response>
     </project>
-    <project dir="class/Mono.Security.Providers.NewSystemSource" library="Mono.Security.Providers.NewSystemSource-net_4_x">
-      <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -d:SECURITY_DEP -unsafe -nowarn:1030 -keyfile:../mono.pub -delaysign -d:MONO -d:FEATURE_PAL -d:MONO_FEATURE_NEW_TLS -d:MONO_FEATURE_NEW_SYSTEM_SOURCE -d:DISABLE_CAS_USE -d:MONO_SECURITY_ALIAS -r:./../../class/lib/net_4_x/System.dll -r:MonoSecurity=./../../class/lib/net_4_x/Mono.Security.dll</flags>
-      <output>Mono.Security.Providers.NewSystemSource.dll</output>
-      <built_sources></built_sources>
-      <library_output>./../../class/lib/net_4_x/Mono.Security.Providers.NewSystemSource.dll</library_output>
-      <fx_version>4.5</fx_version>
-      <profile>net_4_x</profile>
-      <resources></resources>
-      <response>Mono.Security.Providers.NewSystemSource.dll.sources</response>
-    </project>
-    <project dir="class/Mono.Security.Providers.NewTls" library="Mono.Security.Providers.NewTls-net_4_x">
-      <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -unsafe -nowarn:1030 -keyfile:../mono.pub -delaysign -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/Mono.Security.dll -r:NewSystemSource=./../../class/lib/net_4_x/Mono.Security.Providers.NewSystemSource.dll</flags>
-      <output>Mono.Security.Providers.NewTls.dll</output>
-      <built_sources></built_sources>
-      <library_output>./../../class/lib/net_4_x/Mono.Security.Providers.NewTls.dll</library_output>
-      <fx_version>4.5</fx_version>
-      <profile>net_4_x</profile>
-      <resources></resources>
-      <response>Mono.Security.Providers.NewTls.dll.sources</response>
-    </project>
     <project dir="class/System.Runtime.InteropServices.RuntimeInformation" library="System.Runtime.InteropServices.RuntimeInformation-net_4_x">
       <boot>false</boot>
       <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:./../../class/lib/net_4_x/System.dll</flags>
       <resources></resources>
       <response>./../../../build/deps/net_4_x_I18N.CJK_test.dll.response</response>
     </project>
+    <project dir="class/Mono.Btls.Interface" library="Mono.Btls.Interface-net_4_x">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -unsafe -nowarn:1030 -keyfile:../mono.pub -delaysign -d:SECURITY_DEP -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/Mono.Security.dll</flags>
+      <output>Mono.Btls.Interface.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/net_4_x/Mono.Btls.Interface.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>net_4_x</profile>
+      <resources></resources>
+      <response>Mono.Btls.Interface.dll.sources</response>
+    </project>
     <project dir="class/Mono.Http" library="Mono.Http-net_4_x">
       <boot>false</boot>
       <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -nowarn:618 -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Xml.dll -r:./../../class/lib/net_4_x/System.Web.dll -r:./../../class/lib/net_4_x/ICSharpCode.SharpZipLib.dll -r:./../../class/lib/net_4_x/Mono.Security.dll</flags>
     </project>
     <project dir="class/Mono.Cecil" library="Mono.Cecil-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -keyfile:../mono.snk -d:NET_3_5 /publicsign -r:./../../class/lib/net_4_x/System.Core.dll</flags>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -keyfile:../../mono.snk -d:NET_3_5 /publicsign -r:./../../../class/lib/net_4_x/System.Core.dll</flags>
       <output>Mono.Cecil.dll</output>
       <built_sources></built_sources>
-      <library_output>./../../class/lib/net_4_x/Mono.Cecil.dll</library_output>
+      <library_output>./../../../class/lib/net_4_x/legacy/Mono.Cecil.dll</library_output>
       <fx_version>4.5</fx_version>
       <profile>net_4_x</profile>
       <resources></resources>
     </project>
     <project dir="class/Mono.CodeContracts" library="Mono.CodeContracts-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/Mono.Cecil.dll -r:./../../class/lib/net_4_x/Mono.Cecil.Mdb.dll</flags>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -nowarn:618 -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/Mono.Cecil.dll -r:./../../class/lib/net_4_x/Mono.Cecil.Mdb.dll</flags>
       <output>Mono.CodeContracts.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/Mono.CodeContracts.dll</library_output>
       <resources></resources>
       <response>System.Xml.Serialization.dll.sources</response>
     </project>
-    <project dir="class/Mono.Security.Providers.DotNet" library="Mono.Security.Providers.DotNet-net_4_x">
-      <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -unsafe -nowarn:1030 -keyfile:../mono.pub -delaysign -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/Mono.Security.dll</flags>
-      <output>Mono.Security.Providers.DotNet.dll</output>
-      <built_sources></built_sources>
-      <library_output>./../../class/lib/net_4_x/Mono.Security.Providers.DotNet.dll</library_output>
-      <fx_version>4.5</fx_version>
-      <profile>net_4_x</profile>
-      <resources></resources>
-      <response>Mono.Security.Providers.DotNet.dll.sources</response>
-    </project>
-    <project dir="class/Mono.Security.Providers.OldTls" library="Mono.Security.Providers.OldTls-net_4_x">
-      <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -unsafe -nowarn:1030 -keyfile:../mono.pub -delaysign -d:SECURITY_DEP -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/Mono.Security.dll</flags>
-      <output>Mono.Security.Providers.OldTls.dll</output>
-      <built_sources></built_sources>
-      <library_output>./../../class/lib/net_4_x/Mono.Security.Providers.OldTls.dll</library_output>
-      <fx_version>4.5</fx_version>
-      <profile>net_4_x</profile>
-      <resources></resources>
-      <response>Mono.Security.Providers.OldTls.dll.sources</response>
-    </project>
     <project dir="class/System.DirectoryServices.Protocols" library="System.DirectoryServices.Protocols-net_4_x">
       <boot>false</boot>
       <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.DirectoryServices.dll -r:./../../class/lib/net_4_x/System.Xml.dll</flags>
       <resources></resources>
       <response>System.Reflection.Context.dll.sources</response>
     </project>
-    <project dir="class/Facades/System.Security.Cryptography.X509Certificates" library="Facades_System.Security.Cryptography.X509Certificates-net_4_x">
+    <project dir="class/legacy/Mono.Cecil" library="Mono.Cecil-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/net_4_x/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/net_4_x/System.dll -r:./../../../class/lib/net_4_x/System.Core.dll</flags>
-      <output>System.Security.Cryptography.X509Certificates.dll</output>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -keyfile:../../mono.snk -d:NET_3_5 /publicsign -r:./../../../class/lib/net_4_x/System.Core.dll</flags>
+      <output>Mono.Cecil.dll</output>
       <built_sources></built_sources>
-      <library_output>./../../../class/lib/net_4_x/Facades/System.Security.Cryptography.X509Certificates.dll</library_output>
+      <library_output>./../../../class/lib/net_4_x/legacy/Mono.Cecil.dll</library_output>
       <fx_version>4.5</fx_version>
       <profile>net_4_x</profile>
       <resources></resources>
-      <response>System.Security.Cryptography.X509Certificates.dll.sources</response>
+      <response>Mono.Cecil.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.X509Certificates" library="Facades_System.Security.Cryptography.X509Certificates-net_4_x">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/net_4_x/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/net_4_x/System.dll -r:./../../../class/lib/net_4_x/System.Core.dll</flags>
+      <output>System.Security.Cryptography.X509Certificates.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/net_4_x/Facades/System.Security.Cryptography.X509Certificates.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>net_4_x</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.X509Certificates.dll.sources</response>
     </project>
     <project dir="class/Facades/System.ServiceModel.Primitives" library="Facades_System.ServiceModel.Primitives-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/net_4_x/System.dll -r:./../../../class/lib/net_4_x/System.ServiceModel.dll -r:./../../../class/lib/net_4_x/System.Xml.dll -r:./../../../class/lib/net_4_x/Facades/System.Security.Cryptography.X509Certificates.dll -r:./../../../class/lib/net_4_x/System.IdentityModel.dll</flags>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/net_4_x/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/net_4_x/System.dll -r:./../../../class/lib/net_4_x/System.ServiceModel.dll -r:./../../../class/lib/net_4_x/System.Xml.dll -r:./../../../class/lib/net_4_x/System.IdentityModel.dll -r:./../../../class/lib/net_4_x/Facades/System.Security.Cryptography.X509Certificates.dll</flags>
       <output>System.ServiceModel.Primitives.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.ServiceModel.Primitives.dll</library_output>
       <resources></resources>
       <response>System.IO.FileSystem.AccessControl.dll.sources</response>
     </project>
-    <project dir="class/Facades/System.Private.CoreLib.InteropServices" library="Facades_System.Private.CoreLib.InteropServices-net_4_x">
+    <project dir="class/Facades/System.Reflection.TypeExtensions" library="Facades_System.Reflection.TypeExtensions-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/net_4_x/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/net_4_x/System.dll</flags>
-      <output>System.Private.CoreLib.InteropServices.dll</output>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/net_4_x/System.dll</flags>
+      <output>System.Reflection.TypeExtensions.dll</output>
       <built_sources></built_sources>
-      <library_output>./../../../class/lib/net_4_x/Facades/System.Private.CoreLib.InteropServices.dll</library_output>
+      <library_output>./../../../class/lib/net_4_x/Facades/System.Reflection.TypeExtensions.dll</library_output>
       <fx_version>4.5</fx_version>
       <profile>net_4_x</profile>
       <resources></resources>
-      <response>System.Private.CoreLib.InteropServices.dll.sources</response>
+      <response>System.Reflection.TypeExtensions.dll.sources</response>
     </project>
-    <project dir="class/Facades/System.Reflection.TypeExtensions" library="Facades_System.Reflection.TypeExtensions-net_4_x">
+    <project dir="class/Facades/System.Reflection.Emit.Lightweight" library="Facades_System.Reflection.Emit.Lightweight-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/net_4_x/System.dll</flags>
-      <output>System.Reflection.TypeExtensions.dll</output>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/net_4_x/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Reflection.Emit.Lightweight.dll</output>
       <built_sources></built_sources>
-      <library_output>./../../../class/lib/net_4_x/Facades/System.Reflection.TypeExtensions.dll</library_output>
+      <library_output>./../../../class/lib/net_4_x/Facades/System.Reflection.Emit.Lightweight.dll</library_output>
       <fx_version>4.5</fx_version>
       <profile>net_4_x</profile>
       <resources></resources>
-      <response>System.Reflection.TypeExtensions.dll.sources</response>
+      <response>System.Reflection.Emit.Lightweight.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Reflection.Emit.ILGeneration" library="Facades_System.Reflection.Emit.ILGeneration-net_4_x">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/net_4_x/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Reflection.Emit.ILGeneration.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/net_4_x/Facades/System.Reflection.Emit.ILGeneration.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>net_4_x</profile>
+      <resources></resources>
+      <response>System.Reflection.Emit.ILGeneration.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Reflection.Emit" library="Facades_System.Reflection.Emit-net_4_x">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/net_4_x/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Reflection.Emit.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/net_4_x/Facades/System.Reflection.Emit.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>net_4_x</profile>
+      <resources></resources>
+      <response>System.Reflection.Emit.dll.sources</response>
     </project>
     <project dir="class/Facades/System.Security.SecureString" library="Facades_System.Security.SecureString-net_4_x">
       <boot>false</boot>
       <resources></resources>
       <response>System.Xml.XPath.XDocument.dll.sources</response>
     </project>
-    <project dir="class/Facades/System.Security.Cryptography.Algorithms" library="Facades_System.Security.Cryptography.Algorithms-net_4_x">
-      <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/net_4_x/System.dll -r:./../../../class/lib/net_4_x/System.Core.dll</flags>
-      <output>System.Security.Cryptography.Algorithms.dll</output>
-      <built_sources></built_sources>
-      <library_output>./../../../class/lib/net_4_x/Facades/System.Security.Cryptography.Algorithms.dll</library_output>
-      <fx_version>4.5</fx_version>
-      <profile>net_4_x</profile>
-      <resources></resources>
-      <response>System.Security.Cryptography.Algorithms.dll.sources</response>
-    </project>
     <project dir="class/Facades/System.Security.Cryptography.Primitives" library="Facades_System.Security.Cryptography.Primitives-net_4_x">
       <boot>false</boot>
       <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/net_4_x/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/net_4_x/System.dll</flags>
       <resources></resources>
       <response>System.IO.Pipes.dll.sources</response>
     </project>
-    <project dir="class/Facades/System.Reflection.Emit.ILGeneration" library="Facades_System.Reflection.Emit.ILGeneration-net_4_x">
-      <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/net_4_x/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
-      <output>System.Reflection.Emit.ILGeneration.dll</output>
-      <built_sources></built_sources>
-      <library_output>./../../../class/lib/net_4_x/Facades/System.Reflection.Emit.ILGeneration.dll</library_output>
-      <fx_version>4.5</fx_version>
-      <profile>net_4_x</profile>
-      <resources></resources>
-      <response>System.Reflection.Emit.ILGeneration.dll.sources</response>
-    </project>
-    <project dir="class/Facades/System.Reflection.Emit.Lightweight" library="Facades_System.Reflection.Emit.Lightweight-net_4_x">
-      <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/net_4_x/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
-      <output>System.Reflection.Emit.Lightweight.dll</output>
-      <built_sources></built_sources>
-      <library_output>./../../../class/lib/net_4_x/Facades/System.Reflection.Emit.Lightweight.dll</library_output>
-      <fx_version>4.5</fx_version>
-      <profile>net_4_x</profile>
-      <resources></resources>
-      <response>System.Reflection.Emit.Lightweight.dll.sources</response>
-    </project>
-    <project dir="class/Facades/System.Reflection.Emit" library="Facades_System.Reflection.Emit-net_4_x">
-      <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/net_4_x/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
-      <output>System.Reflection.Emit.dll</output>
-      <built_sources></built_sources>
-      <library_output>./../../../class/lib/net_4_x/Facades/System.Reflection.Emit.dll</library_output>
-      <fx_version>4.5</fx_version>
-      <profile>net_4_x</profile>
-      <resources></resources>
-      <response>System.Reflection.Emit.dll.sources</response>
-    </project>
-    <project dir="class/Facades/System.Diagnostics.PerformanceCounter" library="Facades_System.Diagnostics.PerformanceCounter-net_4_x">
-      <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/net_4_x/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/net_4_x/System.dll</flags>
-      <output>System.Diagnostics.PerformanceCounter.dll</output>
-      <built_sources></built_sources>
-      <library_output>./../../../class/lib/net_4_x/Facades/System.Diagnostics.PerformanceCounter.dll</library_output>
-      <fx_version>4.5</fx_version>
-      <profile>net_4_x</profile>
-      <resources></resources>
-      <response>System.Diagnostics.PerformanceCounter.dll.sources</response>
-    </project>
-    <project dir="class/Facades/System.Net.Http.WebRequestHandler" library="Facades_System.Net.Http.WebRequestHandler-net_4_x">
-      <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/net_4_x/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/net_4_x/System.dll -r:./../../../class/lib/net_4_x/System.Net.Http.WebRequest.dll -r:./../../../class/lib/net_4_x/System.Net.Http.dll</flags>
-      <output>System.Net.Http.WebRequestHandler.dll</output>
-      <built_sources></built_sources>
-      <library_output>./../../../class/lib/net_4_x/Facades/System.Net.Http.WebRequestHandler.dll</library_output>
-      <fx_version>4.5</fx_version>
-      <profile>net_4_x</profile>
-      <resources></resources>
-      <response>System.Net.Http.WebRequestHandler.dll.sources</response>
-    </project>
     <project dir="nunit24/NUnitFramework/framework" library="NUnit.Framework-net_4_x">
       <boot>false</boot>
       <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig /d:StronglyNamedAssembly -warn:1 /publicsign -r:./../../../class/lib/net_4_x/System.Xml.dll -r:./../../../class/lib/net_4_x/System.dll</flags>
     </project>
     <project dir="tools/gacutil" library="gacutil-net_4_x">
       <boot></boot>
-      <flags>/codepage:65001 -unsafe -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:Mono.Security</flags>
+      <flags>/codepage:65001 -unsafe -define:NO_SYMBOL_WRITER -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:System -r:Mono.Security -r:System.Security</flags>
       <output>gacutil.exe</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/gacutil.exe</library_output>
       <resources></resources>
       <response>monolinker.exe.sources</response>
     </project>
-    <project dir="tools/tuner" library="Mono.Tuner-net_4_x">
-      <boot>false</boot>
-      <flags>/codepage:65001 -r:./../../class/lib/net_4_x/monolinker.exe -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.Xml.dll -r:./../../class/lib/net_4_x/Mono.Cecil.dll</flags>
-      <output>Mono.Tuner.dll</output>
-      <built_sources></built_sources>
-      <library_output>./../../class/lib/net_4_x/Mono.Tuner.dll</library_output>
-      <fx_version>4.5</fx_version>
-      <profile>net_4_x</profile>
-      <resources></resources>
-      <response>Mono.Tuner.dll.sources</response>
-    </project>
     <project dir="tools/culevel" library="culevel-net_4_x">
       <boot></boot>
       <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:System -r:System.Xml</flags>
     </project>
     <project dir="tools/mkbundle" library="mkbundle-net_4_x">
       <boot></boot>
-      <flags>/codepage:65001 -resource:template.c -resource:template_z.c -resource:template_main.c -d:STATIC,NO_SYMBOL_WRITER,NO_AUTHENTICODE -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:System.Xml -r:System -r:System.Core</flags>
+      <flags>/codepage:65001 -resource:template.c -resource:template_z.c -resource:template_main.c -d:STATIC,NO_SYMBOL_WRITER,NO_AUTHENTICODE -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:System.Xml -r:System -r:System.Core -r:System.IO.Compression.FileSystem</flags>
       <output>mkbundle.exe</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/mkbundle.exe</library_output>
     </project>
     <project dir="tools/gacutil" library="gacutil-net_4_x">
       <boot></boot>
-      <flags>/codepage:65001 -unsafe -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:Mono.Security</flags>
+      <flags>/codepage:65001 -unsafe -define:NO_SYMBOL_WRITER -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:System -r:Mono.Security -r:System.Security</flags>
       <output>gacutil.exe</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/gacutil.exe</library_output>
     </project>
     <project dir="tools/mono-api-html" library="mono-api-html-net_4_x">
       <boot></boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:Mono.Cecil -r:System.Xml -r:System.Core -r:System -r:System.Xml.Linq</flags>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:System.Xml -r:System.Core -r:System -r:System.Xml.Linq</flags>
       <output>mono-api-html.exe</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/mono-api-html.exe</library_output>
       <resources></resources>
       <response>pdb2mdb.exe.sources</response>
     </project>
-    <project dir="tools/SqlSharp" library="sqlsharp-net_4_x">
+    <project dir="tools/sqlsharp" library="sqlsharp-net_4_x">
       <boot></boot>
       <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:System -r:System.Xml -r:System.Data</flags>
       <output>sqlsharp.exe</output>
     <project dir="tools/mdoc" library="mdoc-net_4_x">
       <boot></boot>
       <flags>/codepage:65001 /resource:../../class/monodoc/Resources/mdoc-html-format.xsl,mdoc-html-format.xsl /resource:../../class/monodoc/Resources/mdoc-html-utils.xsl,mdoc-html-utils.xsl /resource:../../class/monodoc/Resources/mdoc-sections-css.xsl,mdoc-sections-css.xsl /resource:../../class/monodoc/Resources/mono-ecma-css.xsl,mono-ecma-css.xsl /resource:Resources/defaulttemplate.xsl,defaulttemplate.xsl /resource:Resources/monodoc-ecma.xsd,monodoc-ecma.xsd /resource:Resources/msitomsx.xsl,msitomsx.xsl /resource:Resources/overview.xsl,overview.xsl /resource:Resources/stylesheet.xsl,stylesheet.xsl -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:monodoc -r:System -r:System.Xml -r:System.Core -r:Mono.Cecil -r:ICSharpCode.SharpZipLib -r:System.Xml.Linq -r:System.Web</flags>
-      <output>mdoc.exe</output>
+      <output>./../../class/lib/net_4_x/mdoc.exe</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/mdoc.exe</library_output>
       <fx_version>4.5</fx_version>
     </project>
     <project dir="tools/mono-symbolicate" library="mono-symbolicate-net_4_x">
       <boot></boot>
-      <flags>/codepage:65001 /D:NO_AUTHENTICODE -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:Mono.Cecil -r:Mono.Cecil.Mdb -r:System.Xml -r:System.Core -r:System</flags>
+      <flags>/codepage:65001 /D:NO_AUTHENTICODE /D:CECIL -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:System.Xml -r:System.Core -r:System</flags>
       <output>mono-symbolicate.exe</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/mono-symbolicate.exe</library_output>
       <resources></resources>
       <response>linkeranalyzer.exe.sources</response>
     </project>
+    <project dir="tools/btls" library="btls-cert-sync-net_4_x">
+      <boot></boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:System -r:Mono.Security -r:Mono.Btls.Interface</flags>
+      <output>btls-cert-sync.exe</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/net_4_x/btls-cert-sync.exe</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>net_4_x</profile>
+      <resources></resources>
+      <response>btls-cert-sync.exe.sources</response>
+    </project>
     <project dir="class/Microsoft.Build.Framework" library="Microsoft.Build.Framework-xbuild_12">
       <boot>false</boot>
       <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -d:XBUILD_12 -optimize /noconfig -r:./../../class/lib/xbuild_12/../net_4_x/System.dll</flags>
       <resources></resources>
       <response>xbuild.exe.sources</response>
     </project>
+    <project dir="class/corlib" library="corlib-monodroid">
+      <boot>true</boot>
+      <flags>/codepage:65001 -unsafe -nostdlib -nowarn:612,618,1635 -d:INSIDE_CORLIB,MONO_CULTURE_DATA -d:LIBC -d:FEATURE_PAL,GENERICS_WORK,FEATURE_LIST_PREDICATES,FEATURE_SERIALIZATION,FEATURE_ASCII,FEATURE_LATIN1,FEATURE_UTF7,FEATURE_UTF32,MONO_HYBRID_ENCODING_SUPPORT,FEATURE_ASYNC_IO,NEW_EXPERIMENTAL_ASYNC_IO,FEATURE_UTF32,FEATURE_EXCEPTIONDISPATCHINFO,FEATURE_CORRUPTING_EXCEPTIONS,FEATURE_EXCEPTION_NOTIFICATIONS,FEATURE_STRONGNAME_MIGRATION,FEATURE_USE_LCID,FEATURE_FUSION,FEATURE_CRYPTO,FEATURE_X509_SECURESTRINGS,FEATURE_SYNCHRONIZATIONCONTEXT,FEATURE_SYNCHRONIZATIONCONTEXT_WAIT,HAS_CORLIB_CONTRACTS -d:FEATURE_REMOTING,MONO_COM,FEATURE_COMINTEROP,FEATURE_ROLE_BASED_SECURITY -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -debug -optimize /noconfig -d:FEATURE_PAL,GENERICS_WORK,FEATURE_LIST_PREDICATES,FEATURE_SERIALIZATION,FEATURE_ASCII,FEATURE_LATIN1,FEATURE_UTF7,FEATURE_UTF32,MONO_HYBRID_ENCODING_SUPPORT,FEATURE_ASYNC_IO,NEW_EXPERIMENTAL_ASYNC_IO,FEATURE_UTF32,FEATURE_EXCEPTIONDISPATCHINFO,FEATURE_CORRUPTING_EXCEPTIONS,FEATURE_EXCEPTION_NOTIFICATIONS,FEATURE_STRONGNAME_MIGRATION,FEATURE_USE_LCID,FEATURE_FUSION,FEATURE_CRYPTO,FEATURE_X509_SECURESTRINGS,FEATURE_SYNCHRONIZATIONCONTEXT,FEATURE_SYNCHRONIZATIONCONTEXT_WAIT,HAS_CORLIB_CONTRACTS -d:FEATURE_REMOTING,MONO_COM,FEATURE_COMINTEROP,FEATURE_ROLE_BASED_SECURITY -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -resource:resources/charinfo.nlp -resource:resources/collation.core.bin -resource:resources/collation.tailoring.bin -resource:resources/collation.cjkCHS.bin -resource:resources/collation.cjkCHT.bin -resource:resources/collation.cjkJA.bin -resource:resources/collation.cjkKO.bin -resource:resources/collation.cjkKOlv2.bin --runtime:v4</flags>
+      <output>mscorlib.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monodroid/mscorlib.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>corlib.dll.sources</response>
+    </project>
+    <project dir="class/Mono.Security" library="Mono.Security-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monodroid/mscorlib.dll -debug -optimize /noconfig -unsafe -nowarn:1030,3009 -r:./../../class/lib/monodroid/bare/System.dll</flags>
+      <output>Mono.Security.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monodroid/Mono.Security.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>./../../build/deps/monodroid_Mono.Security.dll.sources</response>
+    </project>
+    <project dir="class/System" library="System-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monodroid/mscorlib.dll -debug -optimize /noconfig -d:CONFIGURATION_2_0 -d:FEATURE_PAL,SYSTEM_NAMESPACE,MONO,PLATFORM_UNIX -d:MONO_FEATURE_PROCESS_START -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -unsafe -d:MONO_FEATURE_BTLS -d:INSIDE_SYSTEM -d:SECURITY_DEP -nowarn:618,1635 -d:SECURITY_DEP -d:XML_DEP -r:./../../class/lib/monodroid/System.Xml.dll -r:MonoSecurity=./../../class/lib/monodroid/Mono.Security.dll</flags>
+      <output>System.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monodroid/System.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>./../../build/deps/monodroid_System.dll.sources</response>
+    </project>
+    <project dir="class/System" library="System-bare-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monodroid/mscorlib.dll -debug -optimize /noconfig -d:CONFIGURATION_2_0 -d:FEATURE_PAL,SYSTEM_NAMESPACE,MONO,PLATFORM_UNIX -d:MONO_FEATURE_PROCESS_START -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -unsafe -d:MONO_FEATURE_BTLS -d:INSIDE_SYSTEM -d:SECURITY_DEP -nowarn:618,1635</flags>
+      <output>System.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monodroid/bare/System.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>./../../build/deps/monodroid_System.dll.sources</response>
+    </project>
+    <project dir="class/System" library="System-secxml-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monodroid/mscorlib.dll -debug -optimize /noconfig -d:CONFIGURATION_2_0 -d:FEATURE_PAL,SYSTEM_NAMESPACE,MONO,PLATFORM_UNIX -d:MONO_FEATURE_PROCESS_START -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -unsafe -d:MONO_FEATURE_BTLS -d:INSIDE_SYSTEM -d:SECURITY_DEP -nowarn:618,1635 -d:SECURITY_DEP -d:XML_DEP -r:./../../class/lib/monodroid/bare/System.Xml.dll -r:MonoSecurity=./../../class/lib/monodroid/Mono.Security.dll</flags>
+      <output>System.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monodroid/secxml/System.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>./../../build/deps/monodroid_System.dll.sources</response>
+    </project>
+    <project dir="class/System.Core" library="System.Core-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monodroid/mscorlib.dll -debug -optimize /noconfig -d:FEATURE_PAL,PFX_LEGACY_3_5,FEATURE_NETCORE -d:INSIDE_SYSCORE -d:LIBC -unsafe -d:FEATURE_CORE_DLR,FEATURE_REFEMIT -r:./../../class/lib/monodroid/System.dll</flags>
+      <output>System.Core.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monodroid/System.Core.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>./../../build/deps/monodroid_System.Core.dll.sources</response>
+    </project>
+    <project dir="class/System.Core" library="System.Core-plaincore-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monodroid/mscorlib.dll -debug -optimize /noconfig -d:FEATURE_PAL,PFX_LEGACY_3_5,FEATURE_NETCORE -d:INSIDE_SYSCORE -d:LIBC -unsafe -d:FEATURE_CORE_DLR,FEATURE_REFEMIT -r:./../../class/lib/monodroid/System.dll</flags>
+      <output>System.Core.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monodroid/plaincore/System.Core.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>./../../build/deps/monodroid_System.Core.dll.sources</response>
+    </project>
+    <project dir="class/System.Security" library="System.Security-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monodroid/mscorlib.dll -debug -optimize /noconfig -nowarn:618 -d:SECURITY_DEP -nowarn:414 -r:./../../class/lib/monodroid/secxml/System.dll -r:./../../class/lib/monodroid/bare/System.Xml.dll -r:./../../class/lib/monodroid/Mono.Security.dll</flags>
+      <output>System.Security.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monodroid/System.Security.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>./../../build/deps/monodroid_System.Security.dll.sources</response>
+    </project>
+    <project dir="class/System.XML" library="System.Xml-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monodroid/mscorlib.dll -debug -optimize /noconfig -nowarn:219,414,649,1717 -unsafe -d:ASYNC -d:AGCLR -d:DISABLE_XSLT_COMPILER -d:DISABLE_XSLT_SCRIPT,MONO_HYBRID_SYSTEM_XML -d:DISABLE_CAS_USE -r:./../../class/lib/monodroid/secxml/System.dll</flags>
+      <output>System.Xml.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monodroid/System.Xml.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>./../../build/deps/monodroid_System.Xml.dll.sources</response>
+    </project>
+    <project dir="class/System.XML" library="System.Xml-bare-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monodroid/mscorlib.dll -debug -optimize /noconfig -nowarn:219,414,649,1717 -unsafe -d:ASYNC -d:AGCLR -d:DISABLE_XSLT_COMPILER -d:DISABLE_XSLT_SCRIPT,MONO_HYBRID_SYSTEM_XML -d:DISABLE_CAS_USE -r:./../../class/lib/monodroid/bare/System.dll</flags>
+      <output>System.Xml.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monodroid/bare/System.Xml.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>./../../build/deps/monodroid_System.Xml.dll.sources</response>
+    </project>
+    <project dir="class/I18N/Common" library="I18N-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 /unsafe /define:DISABLE_UNSAFE -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -debug -optimize /noconfig</flags>
+      <output>I18N.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/I18N.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>I18N.dll.sources</response>
+    </project>
+    <project dir="class/I18N/West" library="I18N.West-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 /unsafe -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -debug -optimize /noconfig -r:./../../../class/lib/monodroid/I18N.dll</flags>
+      <output>I18N.West.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/I18N.West.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>I18N.West.dll.sources</response>
+    </project>
+    <project dir="class/I18N/MidEast" library="I18N.MidEast-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 /unsafe -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -debug -optimize /noconfig -r:./../../../class/lib/monodroid/I18N.dll</flags>
+      <output>I18N.MidEast.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/I18N.MidEast.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>I18N.MidEast.dll.sources</response>
+    </project>
+    <project dir="class/I18N/Other" library="I18N.Other-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 /unsafe -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -debug -optimize /noconfig -r:./../../../class/lib/monodroid/I18N.dll</flags>
+      <output>I18N.Other.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/I18N.Other.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>I18N.Other.dll.sources</response>
+    </project>
+    <project dir="class/I18N/Rare" library="I18N.Rare-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 /unsafe -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -debug -optimize /noconfig -r:./../../../class/lib/monodroid/I18N.dll</flags>
+      <output>I18N.Rare.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/I18N.Rare.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>I18N.Rare.dll.sources</response>
+    </project>
+    <project dir="class/I18N/CJK" library="I18N.CJK-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 /unsafe /resource:big5.table /resource:gb2312.table /resource:jis.table /resource:ks.table /resource:gb18030.table /define:DISABLE_UNSAFE -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -debug -optimize /noconfig -r:./../../../class/lib/monodroid/I18N.dll</flags>
+      <output>I18N.CJK.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/I18N.CJK.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>I18N.CJK.dll.sources</response>
+    </project>
+    <project dir="class/System.ServiceModel.Internals" library="System.ServiceModel.Internals-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monodroid/mscorlib.dll -debug -optimize /noconfig /unsafe -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -r:./../../class/lib/monodroid/System.dll -r:./../../class/lib/monodroid/System.Core.dll -r:./../../class/lib/monodroid/System.Xml.dll</flags>
+      <output>System.ServiceModel.Internals.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monodroid/System.ServiceModel.Internals.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.ServiceModel.Internals.dll.sources</response>
+    </project>
+    <project dir="class/System.Runtime.Serialization" library="System.Runtime.Serialization-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monodroid/mscorlib.dll -debug -optimize /noconfig -unsafe -d:NO_DYNAMIC_CODEGEN /nowarn:168,169,219,414 /d:NO_CONFIGURATION /d:NO_SECURITY_ATTRIBUTES /d:NO_CODEDOM /d:NO_DESKTOP_SECURITY -r:./../../class/lib/monodroid/System.dll -r:./../../class/lib/monodroid/System.Xml.dll -r:./../../class/lib/monodroid/System.Core.dll -r:./../../class/lib/monodroid/System.ServiceModel.Internals.dll</flags>
+      <output>System.Runtime.Serialization.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monodroid/System.Runtime.Serialization.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>./../../build/deps/monodroid_System.Runtime.Serialization.dll.sources</response>
+    </project>
+    <project dir="class/System.Xml.Linq" library="System.Xml.Linq-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monodroid/mscorlib.dll -debug -optimize /noconfig -d:FEATURE_SERIALIZATION -d:MONO_HYBRID_SYSTEM_XML -r:./../../class/lib/monodroid/System.dll -r:./../../class/lib/monodroid/System.Core.dll -r:./../../class/lib/monodroid/System.Xml.dll -r:./../../class/lib/monodroid/System.Runtime.Serialization.dll</flags>
+      <output>System.Xml.Linq.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monodroid/System.Xml.Linq.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Xml.Linq.dll.sources</response>
+    </project>
+    <project dir="class/System.IdentityModel" library="System.IdentityModel-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monodroid/mscorlib.dll -debug -optimize /noconfig /d:NET_3_0 -r:./../../class/lib/monodroid/System.dll -r:./../../class/lib/monodroid/System.Xml.dll -r:./../../class/lib/monodroid/System.Security.dll -r:./../../class/lib/monodroid/Mono.Security.dll -r:./../../class/lib/monodroid/System.Runtime.Serialization.dll</flags>
+      <output>System.IdentityModel.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monodroid/System.IdentityModel.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>./../../build/deps/monodroid_System.IdentityModel.dll.sources</response>
+    </project>
+    <project dir="class/System.ServiceModel" library="System.ServiceModel-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monodroid/mscorlib.dll -debug -optimize /noconfig /nowarn:414,169,67,3005,436,219,618 /unsafe /d:TRACE /resource:resources/WS-Addressing.schema /resource:resources/ws-addr.xsd -r:./../../class/lib/monodroid/System.dll -r:./../../class/lib/monodroid/System.Xml.dll -r:./../../class/lib/monodroid/System.Core.dll -r:./../../class/lib/monodroid/System.Runtime.Serialization.dll -r:./../../class/lib/monodroid/System.IdentityModel.dll</flags>
+      <output>System.ServiceModel.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monodroid/System.ServiceModel.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>./../../build/deps/monodroid_System.ServiceModel.dll.sources</response>
+    </project>
+    <project dir="class/System.ServiceModel" library="System.ServiceModel-plainservice-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monodroid/mscorlib.dll -debug -optimize /noconfig /nowarn:414,169,67,3005,436,219,618 /unsafe /d:TRACE /resource:resources/WS-Addressing.schema /resource:resources/ws-addr.xsd -r:./../../class/lib/monodroid/System.dll -r:./../../class/lib/monodroid/System.Xml.dll -r:./../../class/lib/monodroid/System.Core.dll -r:./../../class/lib/monodroid/System.Runtime.Serialization.dll -r:./../../class/lib/monodroid/System.IdentityModel.dll</flags>
+      <output>System.ServiceModel.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monodroid/plainservice/System.ServiceModel.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>./../../build/deps/monodroid_System.ServiceModel.dll.sources</response>
+    </project>
+    <project dir="class/System.ServiceModel.Web" library="System.ServiceModel.Web-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monodroid/mscorlib.dll -debug -optimize /noconfig -r:./../../class/lib/monodroid/System.dll -r:./../../class/lib/monodroid/System.Xml.dll -r:./../../class/lib/monodroid/System.Runtime.Serialization.dll -r:./../../class/lib/monodroid/System.ServiceModel.dll -r:./../../class/lib/monodroid/System.Core.dll</flags>
+      <output>System.ServiceModel.Web.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monodroid/System.ServiceModel.Web.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>./../../build/deps/monodroid_System.ServiceModel.Web.dll.sources</response>
+    </project>
+    <project dir="class/System.Json" library="System.Json-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monodroid/mscorlib.dll -debug -optimize /noconfig -r:./../../class/lib/monodroid/System.dll -r:./../../class/lib/monodroid/System.Xml.dll -r:./../../class/lib/monodroid/System.Core.dll</flags>
+      <output>System.Json.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monodroid/System.Json.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Json.dll.sources</response>
+    </project>
+    <project dir="class/System.Web.Services" library="System.Web.Services-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monodroid/mscorlib.dll -debug -optimize /noconfig -nowarn:649 -nowarn:169 -resource:System.Web.Services.Description/wsdl-1.1.xsd,wsdl-1.1.xsd -resource:System.Web.Services.Description/wsdl-1.1-soap.xsd,wsdl-1.1-soap.xsd -resource:System.Web.Services.Description/web-reference.xsd,web-reference.xsd -r:./../../class/lib/monodroid/System.dll -r:./../../class/lib/monodroid/System.Xml.dll</flags>
+      <output>System.Web.Services.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monodroid/System.Web.Services.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>./../../build/deps/monodroid_System.Web.Services.dll.sources</response>
+    </project>
+    <project dir="class/Mono.Data.Tds" library="Mono.Data.Tds-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monodroid/mscorlib.dll -debug -optimize /noconfig -r:./../../class/lib/monodroid/System.dll -r:./../../class/lib/monodroid/System.Xml.dll -r:./../../class/lib/monodroid/Mono.Security.dll</flags>
+      <output>Mono.Data.Tds.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monodroid/Mono.Data.Tds.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>Mono.Data.Tds.dll.sources</response>
+    </project>
+    <project dir="class/System.Transactions" library="System.Transactions-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monodroid/mscorlib.dll -debug -optimize /noconfig /define:MOBILE -r:./../../class/lib/monodroid/System.dll</flags>
+      <output>System.Transactions.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monodroid/System.Transactions.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Transactions.dll.sources</response>
+    </project>
+    <project dir="class/System.Numerics" library="System.Numerics-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monodroid/mscorlib.dll -debug -optimize /noconfig /unsafe -nowarn:414 -r:./../../class/lib/monodroid/System.dll</flags>
+      <output>System.Numerics.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monodroid/System.Numerics.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Numerics.dll.sources</response>
+    </project>
+    <project dir="class/System.Numerics.Vectors" library="System.Numerics.Vectors-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monodroid/mscorlib.dll -debug -optimize /noconfig -unsafe -r:./../../class/lib/monodroid/System.dll -r:./../../class/lib/monodroid/System.Numerics.dll</flags>
+      <output>System.Numerics.Vectors.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monodroid/System.Numerics.Vectors.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Numerics.Vectors.dll.sources</response>
+    </project>
+    <project dir="class/System.Data" library="System.Data-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monodroid/mscorlib.dll -debug -optimize /noconfig -nowarn:219,414,649 -d:PLATFORM_UNIX -d:USEOFFSET -d:MONO_PARTIAL_DATA_IMPORT -unsafe -d:NO_CODEDOM -d:NO_OLEDB -d:NO_ODBC -d:NO_CONFIGURATION -r:./../../class/lib/monodroid/System.dll -r:./../../class/lib/monodroid/System.Xml.dll -r:./../../class/lib/monodroid/System.Core.dll -r:./../../class/lib/monodroid/System.Numerics.dll -r:./../../class/lib/monodroid/Mono.Data.Tds.dll -r:./../../class/lib/monodroid/System.Transactions.dll</flags>
+      <output>System.Data.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monodroid/System.Data.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>./../../build/deps/monodroid_System.Data.dll.sources</response>
+    </project>
+    <project dir="class/Mono.Data.Sqlite" library="Mono.Data.Sqlite-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monodroid/mscorlib.dll -debug -optimize /noconfig /unsafe -resource:resources/SR.resources -resource:resources/SQLiteCommand.bmp -resource:resources/SQLiteConnection.bmp -resource:resources/SQLiteDataAdapter.bmp -d:SQLITE_STANDARD -r:./../../class/lib/monodroid/System.dll -r:./../../class/lib/monodroid/System.Data.dll -r:./../../class/lib/monodroid/System.Transactions.dll -r:./../../class/lib/monodroid/System.Xml.dll</flags>
+      <output>Mono.Data.Sqlite.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monodroid/Mono.Data.Sqlite.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>Mono.Data.Sqlite.dll.sources</response>
+    </project>
+    <project dir="class/System.Data.Services.Client" library="System.Data.Services.Client-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monodroid/mscorlib.dll -debug -optimize /noconfig -d:NET_3_5 -warn:2 -r:./../../class/lib/monodroid/System.dll -r:./../../class/lib/monodroid/System.Core.dll -r:./../../class/lib/monodroid/System.Xml.Linq.dll -r:./../../class/lib/monodroid/System.Data.dll -r:./../../class/lib/monodroid/System.Xml.dll</flags>
+      <output>System.Data.Services.Client.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monodroid/System.Data.Services.Client.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources>System.Data.Services.Client,Client/System.Data.Services.Client.txt</resources>
+      <response>System.Data.Services.Client.dll.sources</response>
+    </project>
+    <project dir="class/System.IO.Compression" library="System.IO.Compression-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monodroid/mscorlib.dll -debug -optimize /noconfig /unsafe -r:./../../class/lib/monodroid/System.dll -r:./../../class/lib/monodroid/System.Core.dll</flags>
+      <output>System.IO.Compression.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monodroid/System.IO.Compression.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.IO.Compression.dll.sources</response>
+    </project>
+    <project dir="class/System.IO.Compression.FileSystem" library="System.IO.Compression.FileSystem-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monodroid/mscorlib.dll -debug -optimize /noconfig -r:./../../class/lib/monodroid/System.dll -r:./../../class/lib/monodroid/System.IO.Compression.dll</flags>
+      <output>System.IO.Compression.FileSystem.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monodroid/System.IO.Compression.FileSystem.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.IO.Compression.FileSystem.dll.sources</response>
+    </project>
+    <project dir="class/System.ComponentModel.DataAnnotations" library="System.ComponentModel.DataAnnotations-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monodroid/mscorlib.dll -debug -optimize /noconfig -nowarn:414 -r:./../../class/lib/monodroid/System.dll -r:./../../class/lib/monodroid/System.Core.dll -r:./../../class/lib/monodroid/System.Data.dll -r:./../../class/lib/monodroid/System.Xml.dll</flags>
+      <output>System.ComponentModel.DataAnnotations.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monodroid/System.ComponentModel.DataAnnotations.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.ComponentModel.DataAnnotations.dll.sources</response>
+    </project>
+    <project dir="class/System.ComponentModel.Composition.4.5" library="System.ComponentModel.Composition-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monodroid/mscorlib.dll -debug -optimize /noconfig -d:CLR40 -d:USE_ECMA_KEY,FEATURE_REFLECTIONCONTEXT,FEATURE_REFLECTIONFILEIO,FEATURE_SERIALIZATION,FEATURE_SLIMLOCK -nowarn:219,414 -r:./../../class/lib/monodroid/System.dll -r:./../../class/lib/monodroid/System.Core.dll</flags>
+      <output>System.ComponentModel.Composition.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monodroid/System.ComponentModel.Composition.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources>Microsoft.Internal.Strings,src/ComponentModel/Strings.resx</resources>
+      <response>System.ComponentModel.Composition.dll.sources</response>
+    </project>
+    <project dir="class/System.Net" library="System.Net-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monodroid/mscorlib.dll -debug -optimize /noconfig -unsafe -r:./../../class/lib/monodroid/System.dll -r:./../../class/lib/monodroid/System.Core.dll -r:./../../class/lib/monodroid/System.Xml.dll</flags>
+      <output>System.Net.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monodroid/System.Net.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Net.dll.sources</response>
+    </project>
+    <project dir="class/System.Net.Http" library="System.Net.Http-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monodroid/mscorlib.dll -debug -optimize /noconfig -d:XAMARIN_MODERN -r:./../../class/lib/monodroid/System.Core.dll -r:./../../class/lib/monodroid/System.dll</flags>
+      <output>System.Net.Http.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monodroid/System.Net.Http.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>./../../build/deps/monodroid_System.Net.Http.dll.sources</response>
+    </project>
+    <project dir="class/System.Windows" library="System.Windows-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monodroid/mscorlib.dll -optimize /noconfig -r:./../../class/lib/monodroid/System.dll</flags>
+      <output>System.Windows.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monodroid/System.Windows.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Windows.dll.sources</response>
+    </project>
+    <project dir="class/System.Xml.Serialization" library="System.Xml.Serialization-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monodroid/mscorlib.dll -optimize /noconfig -r:./../../class/lib/monodroid/System.Xml.dll -r:./../../class/lib/monodroid/System.ServiceModel.dll</flags>
+      <output>System.Xml.Serialization.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monodroid/System.Xml.Serialization.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Xml.Serialization.dll.sources</response>
+    </project>
+    <project dir="class/Mono.CSharp" library="Mono.CSharp-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monodroid/mscorlib.dll -debug -optimize /noconfig -d:MONO_FEATURE_THREAD_ABORT -r:./../../class/lib/monodroid/System.Core.dll -r:./../../class/lib/monodroid/System.Xml.dll -r:./../../class/lib/monodroid/System.dll</flags>
+      <output>Mono.CSharp.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monodroid/Mono.CSharp.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>Mono.CSharp.dll.sources</response>
+    </project>
+    <project dir="class/Microsoft.CSharp" library="Microsoft.CSharp-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monodroid/mscorlib.dll -debug -optimize /noconfig -r:./../../class/lib/monodroid/System.Core.dll -r:./../../class/lib/monodroid/Mono.CSharp.dll</flags>
+      <output>Microsoft.CSharp.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monodroid/Microsoft.CSharp.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>Microsoft.CSharp.dll.sources</response>
+    </project>
+    <project dir="class/System.Runtime.InteropServices.RuntimeInformation" library="System.Runtime.InteropServices.RuntimeInformation-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monodroid/mscorlib.dll -debug -optimize /noconfig -r:./../../class/lib/monodroid/System.dll</flags>
+      <output>System.Runtime.InteropServices.RuntimeInformation.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monodroid/System.Runtime.InteropServices.RuntimeInformation.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Runtime.InteropServices.RuntimeInformation.dll.sources</response>
+    </project>
+    <project dir="class/System.Reflection.DispatchProxy" library="System.Reflection.DispatchProxy-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monodroid/mscorlib.dll -debug -optimize /noconfig -r:./../../class/lib/monodroid/System.dll</flags>
+      <output>System.Reflection.DispatchProxy.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monodroid/System.Reflection.DispatchProxy.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Reflection.DispatchProxy.dll.sources</response>
+    </project>
+    <project dir="class/System.Xml.XPath.XmlDocument" library="System.Xml.XPath.XmlDocument-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monodroid/mscorlib.dll -debug -optimize /noconfig -r:./../../class/lib/monodroid/System.dll -r:./../../class/lib/monodroid/System.Xml.dll</flags>
+      <output>System.Xml.XPath.XmlDocument.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monodroid/System.Xml.XPath.XmlDocument.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Xml.XPath.XmlDocument.dll.sources</response>
+    </project>
+    <project dir="class/System.Reflection.Context" library="System.Reflection.Context-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monodroid/mscorlib.dll -debug -optimize /noconfig -r:./../../class/lib/monodroid/System.dll</flags>
+      <output>System.Reflection.Context.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monodroid/System.Reflection.Context.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Reflection.Context.dll.sources</response>
+    </project>
+    <project dir="class/System.Net.Http.WinHttpHandler" library="System.Net.Http.WinHttpHandler-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monodroid/mscorlib.dll -debug -optimize /noconfig -r:./../../class/lib/monodroid/System.dll -r:./../../class/lib/monodroid/System.Net.Http.dll</flags>
+      <output>System.Net.Http.WinHttpHandler.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monodroid/System.Net.Http.WinHttpHandler.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Net.Http.WinHttpHandler.dll.sources</response>
+    </project>
+    <project dir="class/Mono.CompilerServices.SymbolWriter" library="Mono.CompilerServices.SymbolWriter-monodroid">
+      <boot>true</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monodroid/mscorlib.dll -debug -optimize /noconfig -r:./../../class/lib/monodroid/System.dll</flags>
+      <output>Mono.CompilerServices.SymbolWriter.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monodroid/Mono.CompilerServices.SymbolWriter.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>Mono.CompilerServices.SymbolWriter.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.X509Certificates" library="Facades_System.Security.Cryptography.X509Certificates-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll -r:./../../../class/lib/monodroid/System.Core.dll</flags>
+      <output>System.Security.Cryptography.X509Certificates.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Security.Cryptography.X509Certificates.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.X509Certificates.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.ServiceModel.Primitives" library="Facades_System.ServiceModel.Primitives-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll -r:./../../../class/lib/monodroid/System.ServiceModel.dll -r:./../../../class/lib/monodroid/System.Xml.dll -r:./../../../class/lib/monodroid/System.IdentityModel.dll -r:./../../../class/lib/monodroid/Facades/System.Security.Cryptography.X509Certificates.dll</flags>
+      <output>System.ServiceModel.Primitives.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.ServiceModel.Primitives.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.ServiceModel.Primitives.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Runtime.Serialization.Primitives" library="Facades_System.Runtime.Serialization.Primitives-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -debug -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.Runtime.Serialization.dll</flags>
+      <output>System.Runtime.Serialization.Primitives.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Runtime.Serialization.Primitives.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Runtime.Serialization.Primitives.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Runtime.Serialization.Xml" library="Facades_System.Runtime.Serialization.Xml-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -debug -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 /d:NO_CODEDOM -r:./../../../class/lib/monodroid/System.dll -r:./../../../class/lib/monodroid/System.Runtime.Serialization.dll -r:./../../../class/lib/monodroid/System.Xml.dll -r:./../../../class/lib/monodroid/Facades/System.Runtime.Serialization.Primitives.dll</flags>
+      <output>System.Runtime.Serialization.Xml.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Runtime.Serialization.Xml.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Runtime.Serialization.Xml.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.Algorithms" library="Facades_System.Security.Cryptography.Algorithms-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll -r:./../../../class/lib/monodroid/System.Core.dll</flags>
+      <output>System.Security.Cryptography.Algorithms.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Security.Cryptography.Algorithms.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.Algorithms.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.OpenSsl" library="Facades_System.Security.Cryptography.OpenSsl-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -debug -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.Core.dll -r:./../../../class/lib/monodroid/Facades/System.Security.Cryptography.Algorithms.dll</flags>
+      <output>System.Security.Cryptography.OpenSsl.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Security.Cryptography.OpenSsl.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.OpenSsl.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Collections.Concurrent" library="Facades_System.Collections.Concurrent-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll</flags>
+      <output>System.Collections.Concurrent.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Collections.Concurrent.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Collections.Concurrent.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Collections" library="Facades_System.Collections-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll -r:./../../../class/lib/monodroid/System.Core.dll</flags>
+      <output>System.Collections.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Collections.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Collections.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.ComponentModel.Annotations" library="Facades_System.ComponentModel.Annotations-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.ComponentModel.DataAnnotations.dll</flags>
+      <output>System.ComponentModel.Annotations.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.ComponentModel.Annotations.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.ComponentModel.Annotations.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.ComponentModel.EventBasedAsync" library="Facades_System.ComponentModel.EventBasedAsync-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll</flags>
+      <output>System.ComponentModel.EventBasedAsync.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.ComponentModel.EventBasedAsync.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.ComponentModel.EventBasedAsync.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.ComponentModel" library="Facades_System.ComponentModel-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll</flags>
+      <output>System.ComponentModel.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.ComponentModel.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.ComponentModel.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Diagnostics.Contracts" library="Facades_System.Diagnostics.Contracts-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Diagnostics.Contracts.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Diagnostics.Contracts.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Diagnostics.Contracts.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Diagnostics.Debug" library="Facades_System.Diagnostics.Debug-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll</flags>
+      <output>System.Diagnostics.Debug.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Diagnostics.Debug.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Diagnostics.Debug.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Diagnostics.Tracing" library="Facades_System.Diagnostics.Tracing-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -debug -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Diagnostics.Tracing.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Diagnostics.Tracing.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Diagnostics.Tracing.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Diagnostics.Tools" library="Facades_System.Diagnostics.Tools-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll</flags>
+      <output>System.Diagnostics.Tools.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Diagnostics.Tools.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Diagnostics.Tools.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Dynamic.Runtime" library="Facades_System.Dynamic.Runtime-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.Core.dll -r:./../../../class/lib/monodroid/System.dll</flags>
+      <output>System.Dynamic.Runtime.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Dynamic.Runtime.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Dynamic.Runtime.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Globalization" library="Facades_System.Globalization-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Globalization.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Globalization.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Globalization.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.IO" library="Facades_System.IO-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll</flags>
+      <output>System.IO.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.IO.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.IO.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Linq.Expressions" library="Facades_System.Linq.Expressions-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.Core.dll</flags>
+      <output>System.Linq.Expressions.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Linq.Expressions.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Linq.Expressions.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Linq.Parallel" library="Facades_System.Linq.Parallel-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.Core.dll</flags>
+      <output>System.Linq.Parallel.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Linq.Parallel.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Linq.Parallel.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Linq.Queryable" library="Facades_System.Linq.Queryable-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.Core.dll</flags>
+      <output>System.Linq.Queryable.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Linq.Queryable.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Linq.Queryable.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Linq" library="Facades_System.Linq-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.Core.dll</flags>
+      <output>System.Linq.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Linq.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Linq.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.NetworkInformation" library="Facades_System.Net.NetworkInformation-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll</flags>
+      <output>System.Net.NetworkInformation.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Net.NetworkInformation.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Net.NetworkInformation.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.Primitives" library="Facades_System.Net.Primitives-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll</flags>
+      <output>System.Net.Primitives.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Net.Primitives.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Net.Primitives.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.Requests" library="Facades_System.Net.Requests-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll</flags>
+      <output>System.Net.Requests.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Net.Requests.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Net.Requests.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.ObjectModel" library="Facades_System.ObjectModel-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll</flags>
+      <output>System.ObjectModel.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.ObjectModel.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.ObjectModel.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Reflection.Extensions" library="Facades_System.Reflection.Extensions-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Reflection.Extensions.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Reflection.Extensions.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Reflection.Extensions.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Reflection.Primitives" library="Facades_System.Reflection.Primitives-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Reflection.Primitives.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Reflection.Primitives.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Reflection.Primitives.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Reflection" library="Facades_System.Reflection-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Reflection.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Reflection.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Reflection.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Resources.ResourceManager" library="Facades_System.Resources.ResourceManager-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Resources.ResourceManager.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Resources.ResourceManager.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Resources.ResourceManager.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Runtime.Extensions" library="Facades_System.Runtime.Extensions-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll</flags>
+      <output>System.Runtime.Extensions.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Runtime.Extensions.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Runtime.Extensions.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Runtime.InteropServices" library="Facades_System.Runtime.InteropServices-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll -r:./../../../class/lib/monodroid/System.Core.dll</flags>
+      <output>System.Runtime.InteropServices.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Runtime.InteropServices.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Runtime.InteropServices.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Runtime.InteropServices.WindowsRuntime" library="Facades_System.Runtime.InteropServices.WindowsRuntime-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Runtime.InteropServices.WindowsRuntime.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Runtime.InteropServices.WindowsRuntime.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Runtime.InteropServices.WindowsRuntime.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Runtime.Numerics" library="Facades_System.Runtime.Numerics-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.Numerics.dll</flags>
+      <output>System.Runtime.Numerics.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Runtime.Numerics.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Runtime.Numerics.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Runtime.Serialization.Json" library="Facades_System.Runtime.Serialization.Json-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.Runtime.Serialization.dll</flags>
+      <output>System.Runtime.Serialization.Json.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Runtime.Serialization.Json.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Runtime.Serialization.Json.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Runtime" library="Facades_System.Runtime-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll -r:./../../../class/lib/monodroid/System.ComponentModel.Composition.dll -r:./../../../class/lib/monodroid/System.Core.dll</flags>
+      <output>System.Runtime.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Runtime.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Runtime.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Principal" library="Facades_System.Security.Principal-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Security.Principal.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Security.Principal.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Security.Principal.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.ServiceModel.Http" library="Facades_System.ServiceModel.Http-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.ServiceModel.dll</flags>
+      <output>System.ServiceModel.Http.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.ServiceModel.Http.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.ServiceModel.Http.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.ServiceModel.Security" library="Facades_System.ServiceModel.Security-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.ServiceModel.dll</flags>
+      <output>System.ServiceModel.Security.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.ServiceModel.Security.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.ServiceModel.Security.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Text.Encoding.Extensions" library="Facades_System.Text.Encoding.Extensions-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Text.Encoding.Extensions.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Text.Encoding.Extensions.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Text.Encoding.Extensions.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Text.Encoding" library="Facades_System.Text.Encoding-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Text.Encoding.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Text.Encoding.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Text.Encoding.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Text.RegularExpressions" library="Facades_System.Text.RegularExpressions-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll</flags>
+      <output>System.Text.RegularExpressions.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Text.RegularExpressions.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Text.RegularExpressions.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Threading.Tasks.Parallel" library="Facades_System.Threading.Tasks.Parallel-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Threading.Tasks.Parallel.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Threading.Tasks.Parallel.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Threading.Tasks.Parallel.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Threading.Tasks" library="Facades_System.Threading.Tasks-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.Core.dll</flags>
+      <output>System.Threading.Tasks.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Threading.Tasks.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Threading.Tasks.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Threading.Timer" library="Facades_System.Threading.Timer-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll -r:./../../../class/lib/monodroid/System.Core.dll</flags>
+      <output>System.Threading.Timer.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Threading.Timer.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Threading.Timer.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Threading" library="Facades_System.Threading-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll -r:./../../../class/lib/monodroid/System.Core.dll</flags>
+      <output>System.Threading.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Threading.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Threading.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Xml.ReaderWriter" library="Facades_System.Xml.ReaderWriter-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.Xml.dll</flags>
+      <output>System.Xml.ReaderWriter.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Xml.ReaderWriter.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Xml.ReaderWriter.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Xml.XDocument" library="Facades_System.Xml.XDocument-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.Xml.Linq.dll -r:./../../../class/lib/monodroid/System.Xml.dll</flags>
+      <output>System.Xml.XDocument.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Xml.XDocument.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Xml.XDocument.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Xml.XmlSerializer" library="Facades_System.Xml.XmlSerializer-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.Xml.dll</flags>
+      <output>System.Xml.XmlSerializer.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Xml.XmlSerializer.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Xml.XmlSerializer.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Runtime.Handles" library="Facades_System.Runtime.Handles-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll -r:./../../../class/lib/monodroid/System.Core.dll</flags>
+      <output>System.Runtime.Handles.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Runtime.Handles.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Runtime.Handles.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.ServiceModel.Duplex" library="Facades_System.ServiceModel.Duplex-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.ServiceModel.dll</flags>
+      <output>System.ServiceModel.Duplex.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.ServiceModel.Duplex.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.ServiceModel.Duplex.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.ServiceModel.NetTcp" library="Facades_System.ServiceModel.NetTcp-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.ServiceModel.dll</flags>
+      <output>System.ServiceModel.NetTcp.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.ServiceModel.NetTcp.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.ServiceModel.NetTcp.dll.sources</response>
+    </project>
+    <project dir="class/Facades/Microsoft.Win32.Primitives" library="Facades_Microsoft.Win32.Primitives-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll</flags>
+      <output>Microsoft.Win32.Primitives.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/Microsoft.Win32.Primitives.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>Microsoft.Win32.Primitives.dll.sources</response>
+    </project>
+    <project dir="class/Facades/Microsoft.Win32.Registry" library="Facades_Microsoft.Win32.Registry-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll</flags>
+      <output>Microsoft.Win32.Registry.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/Microsoft.Win32.Registry.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>Microsoft.Win32.Registry.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.AppContext" library="Facades_System.AppContext-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll</flags>
+      <output>System.AppContext.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.AppContext.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.AppContext.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Collections.NonGeneric" library="Facades_System.Collections.NonGeneric-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll</flags>
+      <output>System.Collections.NonGeneric.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Collections.NonGeneric.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Collections.NonGeneric.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Collections.Specialized" library="Facades_System.Collections.Specialized-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll</flags>
+      <output>System.Collections.Specialized.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Collections.Specialized.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Collections.Specialized.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.ComponentModel.Primitives" library="Facades_System.ComponentModel.Primitives-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll</flags>
+      <output>System.ComponentModel.Primitives.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.ComponentModel.Primitives.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.ComponentModel.Primitives.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.ComponentModel.TypeConverter" library="Facades_System.ComponentModel.TypeConverter-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll</flags>
+      <output>System.ComponentModel.TypeConverter.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.ComponentModel.TypeConverter.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.ComponentModel.TypeConverter.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Console" library="Facades_System.Console-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll</flags>
+      <output>System.Console.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Console.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Console.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Data.Common" library="Facades_System.Data.Common-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -debug -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll -r:./../../../class/lib/monodroid/System.Data.dll -r:./../../../class/lib/monodroid/System.Xml.dll</flags>
+      <output>System.Data.Common.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Data.Common.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Data.Common.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Data.SqlClient" library="Facades_System.Data.SqlClient-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll -r:./../../../class/lib/monodroid/System.Data.dll -r:./../../../class/lib/monodroid/System.Xml.dll</flags>
+      <output>System.Data.SqlClient.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Data.SqlClient.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Data.SqlClient.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Diagnostics.FileVersionInfo" library="Facades_System.Diagnostics.FileVersionInfo-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll</flags>
+      <output>System.Diagnostics.FileVersionInfo.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Diagnostics.FileVersionInfo.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Diagnostics.FileVersionInfo.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Diagnostics.Process" library="Facades_System.Diagnostics.Process-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll</flags>
+      <output>System.Diagnostics.Process.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Diagnostics.Process.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Diagnostics.Process.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Diagnostics.TextWriterTraceListener" library="Facades_System.Diagnostics.TextWriterTraceListener-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll</flags>
+      <output>System.Diagnostics.TextWriterTraceListener.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Diagnostics.TextWriterTraceListener.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Diagnostics.TextWriterTraceListener.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Diagnostics.TraceEvent" library="Facades_System.Diagnostics.TraceEvent-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll</flags>
+      <output>System.Diagnostics.TraceEvent.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Diagnostics.TraceEvent.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Diagnostics.TraceEvent.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Diagnostics.TraceSource" library="Facades_System.Diagnostics.TraceSource-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll</flags>
+      <output>System.Diagnostics.TraceSource.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Diagnostics.TraceSource.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Diagnostics.TraceSource.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Globalization.Calendars" library="Facades_System.Globalization.Calendars-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll</flags>
+      <output>System.Globalization.Calendars.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Globalization.Calendars.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Globalization.Calendars.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.IO.Compression.ZipFile" library="Facades_System.IO.Compression.ZipFile-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll -r:./../../../class/lib/monodroid/System.IO.Compression.FileSystem.dll</flags>
+      <output>System.IO.Compression.ZipFile.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.IO.Compression.ZipFile.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.IO.Compression.ZipFile.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.IO.FileSystem" library="Facades_System.IO.FileSystem-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll</flags>
+      <output>System.IO.FileSystem.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.IO.FileSystem.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.IO.FileSystem.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.IO.FileSystem.DriveInfo" library="Facades_System.IO.FileSystem.DriveInfo-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll</flags>
+      <output>System.IO.FileSystem.DriveInfo.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.IO.FileSystem.DriveInfo.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.IO.FileSystem.DriveInfo.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.IO.FileSystem.Primitives" library="Facades_System.IO.FileSystem.Primitives-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll</flags>
+      <output>System.IO.FileSystem.Primitives.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.IO.FileSystem.Primitives.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.IO.FileSystem.Primitives.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.IO.IsolatedStorage" library="Facades_System.IO.IsolatedStorage-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll</flags>
+      <output>System.IO.IsolatedStorage.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.IO.IsolatedStorage.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.IO.IsolatedStorage.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.IO.MemoryMappedFiles" library="Facades_System.IO.MemoryMappedFiles-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll -r:./../../../class/lib/monodroid/System.Core.dll</flags>
+      <output>System.IO.MemoryMappedFiles.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.IO.MemoryMappedFiles.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.IO.MemoryMappedFiles.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.IO.UnmanagedMemoryStream" library="Facades_System.IO.UnmanagedMemoryStream-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll</flags>
+      <output>System.IO.UnmanagedMemoryStream.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.IO.UnmanagedMemoryStream.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.IO.UnmanagedMemoryStream.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.AuthenticationManager" library="Facades_System.Net.AuthenticationManager-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll</flags>
+      <output>System.Net.AuthenticationManager.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Net.AuthenticationManager.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Net.AuthenticationManager.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.Cache" library="Facades_System.Net.Cache-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll</flags>
+      <output>System.Net.Cache.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Net.Cache.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Net.Cache.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.HttpListener" library="Facades_System.Net.HttpListener-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll</flags>
+      <output>System.Net.HttpListener.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Net.HttpListener.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Net.HttpListener.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.Mail" library="Facades_System.Net.Mail-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll</flags>
+      <output>System.Net.Mail.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Net.Mail.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Net.Mail.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.NameResolution" library="Facades_System.Net.NameResolution-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll</flags>
+      <output>System.Net.NameResolution.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Net.NameResolution.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Net.NameResolution.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.Security" library="Facades_System.Net.Security-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll</flags>
+      <output>System.Net.Security.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Net.Security.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Net.Security.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.ServicePoint" library="Facades_System.Net.ServicePoint-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll</flags>
+      <output>System.Net.ServicePoint.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Net.ServicePoint.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Net.ServicePoint.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.Sockets" library="Facades_System.Net.Sockets-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -debug -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll</flags>
+      <output>System.Net.Sockets.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Net.Sockets.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Net.Sockets.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.Utilities" library="Facades_System.Net.Utilities-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll</flags>
+      <output>System.Net.Utilities.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Net.Utilities.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Net.Utilities.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.WebHeaderCollection" library="Facades_System.Net.WebHeaderCollection-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll</flags>
+      <output>System.Net.WebHeaderCollection.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Net.WebHeaderCollection.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Net.WebHeaderCollection.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.WebSockets" library="Facades_System.Net.WebSockets-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll</flags>
+      <output>System.Net.WebSockets.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Net.WebSockets.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Net.WebSockets.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.WebSockets.Client" library="Facades_System.Net.WebSockets.Client-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll</flags>
+      <output>System.Net.WebSockets.Client.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Net.WebSockets.Client.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Net.WebSockets.Client.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Resources.ReaderWriter" library="Facades_System.Resources.ReaderWriter-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll</flags>
+      <output>System.Resources.ReaderWriter.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Resources.ReaderWriter.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Resources.ReaderWriter.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Runtime.CompilerServices.VisualC" library="Facades_System.Runtime.CompilerServices.VisualC-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll</flags>
+      <output>System.Runtime.CompilerServices.VisualC.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Runtime.CompilerServices.VisualC.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Runtime.CompilerServices.VisualC.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.AccessControl" library="Facades_System.Security.AccessControl-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll</flags>
+      <output>System.Security.AccessControl.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Security.AccessControl.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Security.AccessControl.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Claims" library="Facades_System.Security.Claims-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll</flags>
+      <output>System.Security.Claims.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Security.Claims.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Security.Claims.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.DeriveBytes" library="Facades_System.Security.Cryptography.DeriveBytes-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll</flags>
+      <output>System.Security.Cryptography.DeriveBytes.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Security.Cryptography.DeriveBytes.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.DeriveBytes.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.Encoding" library="Facades_System.Security.Cryptography.Encoding-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll</flags>
+      <output>System.Security.Cryptography.Encoding.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Security.Cryptography.Encoding.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.Encoding.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.Encryption" library="Facades_System.Security.Cryptography.Encryption-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll</flags>
+      <output>System.Security.Cryptography.Encryption.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Security.Cryptography.Encryption.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.Encryption.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.Encryption.Aes" library="Facades_System.Security.Cryptography.Encryption.Aes-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll</flags>
+      <output>System.Security.Cryptography.Encryption.Aes.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Security.Cryptography.Encryption.Aes.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.Encryption.Aes.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.Encryption.ECDiffieHellman" library="Facades_System.Security.Cryptography.Encryption.ECDiffieHellman-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll -r:./../../../class/lib/monodroid/System.Core.dll</flags>
+      <output>System.Security.Cryptography.Encryption.ECDiffieHellman.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Security.Cryptography.Encryption.ECDiffieHellman.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.Encryption.ECDiffieHellman.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.Encryption.ECDsa" library="Facades_System.Security.Cryptography.Encryption.ECDsa-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll -r:./../../../class/lib/monodroid/System.Core.dll</flags>
+      <output>System.Security.Cryptography.Encryption.ECDsa.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Security.Cryptography.Encryption.ECDsa.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.Encryption.ECDsa.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.Hashing" library="Facades_System.Security.Cryptography.Hashing-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll</flags>
+      <output>System.Security.Cryptography.Hashing.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Security.Cryptography.Hashing.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.Hashing.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.Hashing.Algorithms" library="Facades_System.Security.Cryptography.Hashing.Algorithms-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll</flags>
+      <output>System.Security.Cryptography.Hashing.Algorithms.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Security.Cryptography.Hashing.Algorithms.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.Hashing.Algorithms.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.RSA" library="Facades_System.Security.Cryptography.RSA-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll</flags>
+      <output>System.Security.Cryptography.RSA.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Security.Cryptography.RSA.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.RSA.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.RandomNumberGenerator" library="Facades_System.Security.Cryptography.RandomNumberGenerator-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll</flags>
+      <output>System.Security.Cryptography.RandomNumberGenerator.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Security.Cryptography.RandomNumberGenerator.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.RandomNumberGenerator.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Principal.Windows" library="Facades_System.Security.Principal.Windows-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll</flags>
+      <output>System.Security.Principal.Windows.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Security.Principal.Windows.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Security.Principal.Windows.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Threading.Thread" library="Facades_System.Threading.Thread-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll</flags>
+      <output>System.Threading.Thread.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Threading.Thread.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Threading.Thread.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Threading.ThreadPool" library="Facades_System.Threading.ThreadPool-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll</flags>
+      <output>System.Threading.ThreadPool.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Threading.ThreadPool.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Threading.ThreadPool.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Xml.XPath" library="Facades_System.Xml.XPath-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll -r:./../../../class/lib/monodroid/System.Xml.dll</flags>
+      <output>System.Xml.XPath.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Xml.XPath.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Xml.XPath.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Xml.XmlDocument" library="Facades_System.Xml.XmlDocument-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll -r:./../../../class/lib/monodroid/System.Xml.dll</flags>
+      <output>System.Xml.XmlDocument.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Xml.XmlDocument.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Xml.XmlDocument.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Xml.Xsl.Primitives" library="Facades_System.Xml.Xsl.Primitives-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll -r:./../../../class/lib/monodroid/System.Xml.dll</flags>
+      <output>System.Xml.Xsl.Primitives.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Xml.Xsl.Primitives.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Xml.Xsl.Primitives.dll.sources</response>
+    </project>
+    <project dir="class/Facades/Microsoft.Win32.Registry.AccessControl" library="Facades_Microsoft.Win32.Registry.AccessControl-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -debug -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll</flags>
+      <output>Microsoft.Win32.Registry.AccessControl.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/Microsoft.Win32.Registry.AccessControl.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>Microsoft.Win32.Registry.AccessControl.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Diagnostics.StackTrace" library="Facades_System.Diagnostics.StackTrace-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -debug -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll</flags>
+      <output>System.Diagnostics.StackTrace.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Diagnostics.StackTrace.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Diagnostics.StackTrace.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Globalization.Extensions" library="Facades_System.Globalization.Extensions-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -debug -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll</flags>
+      <output>System.Globalization.Extensions.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Globalization.Extensions.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Globalization.Extensions.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.IO.FileSystem.AccessControl" library="Facades_System.IO.FileSystem.AccessControl-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -debug -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll</flags>
+      <output>System.IO.FileSystem.AccessControl.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.IO.FileSystem.AccessControl.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.IO.FileSystem.AccessControl.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Reflection.TypeExtensions" library="Facades_System.Reflection.TypeExtensions-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -debug -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll</flags>
+      <output>System.Reflection.TypeExtensions.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Reflection.TypeExtensions.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Reflection.TypeExtensions.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Reflection.Emit.Lightweight" library="Facades_System.Reflection.Emit.Lightweight-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Reflection.Emit.Lightweight.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Reflection.Emit.Lightweight.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Reflection.Emit.Lightweight.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Reflection.Emit.ILGeneration" library="Facades_System.Reflection.Emit.ILGeneration-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Reflection.Emit.ILGeneration.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Reflection.Emit.ILGeneration.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Reflection.Emit.ILGeneration.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Reflection.Emit" library="Facades_System.Reflection.Emit-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Reflection.Emit.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Reflection.Emit.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Reflection.Emit.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.SecureString" library="Facades_System.Security.SecureString-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -debug -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll</flags>
+      <output>System.Security.SecureString.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Security.SecureString.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Security.SecureString.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Threading.AccessControl" library="Facades_System.Threading.AccessControl-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -debug -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll</flags>
+      <output>System.Threading.AccessControl.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Threading.AccessControl.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Threading.AccessControl.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Threading.Overlapped" library="Facades_System.Threading.Overlapped-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -debug -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -unsafe -r:./../../../class/lib/monodroid/System.dll</flags>
+      <output>System.Threading.Overlapped.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Threading.Overlapped.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Threading.Overlapped.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Xml.XPath.XDocument" library="Facades_System.Xml.XPath.XDocument-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -debug -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll -r:./../../../class/lib/monodroid/System.Xml.dll -r:./../../../class/lib/monodroid/System.Xml.Linq.dll</flags>
+      <output>System.Xml.XPath.XDocument.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Xml.XPath.XDocument.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Xml.XPath.XDocument.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.Primitives" library="Facades_System.Security.Cryptography.Primitives-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll</flags>
+      <output>System.Security.Cryptography.Primitives.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Security.Cryptography.Primitives.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.Primitives.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Text.Encoding.CodePages" library="Facades_System.Text.Encoding.CodePages-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -debug -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll</flags>
+      <output>System.Text.Encoding.CodePages.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Text.Encoding.CodePages.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Text.Encoding.CodePages.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.IO.FileSystem.Watcher" library="Facades_System.IO.FileSystem.Watcher-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll</flags>
+      <output>System.IO.FileSystem.Watcher.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.IO.FileSystem.Watcher.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.IO.FileSystem.Watcher.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.ProtectedData" library="Facades_System.Security.Cryptography.ProtectedData-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll -r:./../../../class/lib/monodroid/System.Security.dll</flags>
+      <output>System.Security.Cryptography.ProtectedData.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Security.Cryptography.ProtectedData.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.ProtectedData.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.ServiceProcess.ServiceController" library="Facades_System.ServiceProcess.ServiceController-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -debug -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll</flags>
+      <output>System.ServiceProcess.ServiceController.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.ServiceProcess.ServiceController.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.ServiceProcess.ServiceController.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.IO.Pipes" library="Facades_System.IO.Pipes-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll -r:./../../../class/lib/monodroid/System.Core.dll</flags>
+      <output>System.IO.Pipes.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.IO.Pipes.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.IO.Pipes.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.Ping" library="Facades_System.Net.Ping-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll</flags>
+      <output>System.Net.Ping.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Net.Ping.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Net.Ping.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Runtime.Serialization.Formatters" library="Facades_System.Runtime.Serialization.Formatters-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll</flags>
+      <output>System.Runtime.Serialization.Formatters.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Runtime.Serialization.Formatters.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Runtime.Serialization.Formatters.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.Csp" library="Facades_System.Security.Cryptography.Csp-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll</flags>
+      <output>System.Security.Cryptography.Csp.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Security.Cryptography.Csp.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.Csp.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.Pkcs" library="Facades_System.Security.Cryptography.Pkcs-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll -r:./../../../class/lib/monodroid/System.Security.dll</flags>
+      <output>System.Security.Cryptography.Pkcs.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Security.Cryptography.Pkcs.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.Pkcs.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.Cng" library="Facades_System.Security.Cryptography.Cng-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monodroid/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monodroid/System.dll -r:./../../../class/lib/monodroid/System.Core.dll</flags>
+      <output>System.Security.Cryptography.Cng.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monodroid/Facades/System.Security.Cryptography.Cng.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.Cng.dll.sources</response>
+    </project>
+    <project dir="class/Mono.Btls.Interface" library="Mono.Btls.Interface-monodroid">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE,MOBILE_LEGACY -d:MOBILE_DYNAMIC -d:MONODROID -d:ANDROID -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monodroid/mscorlib.dll -debug -optimize /noconfig -unsafe -nowarn:1030 -keyfile:../mono.pub -delaysign -d:SECURITY_DEP -r:./../../class/lib/monodroid/System.dll -r:./../../class/lib/monodroid/Mono.Security.dll</flags>
+      <output>Mono.Btls.Interface.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monodroid/Mono.Btls.Interface.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monodroid</profile>
+      <resources></resources>
+      <response>Mono.Btls.Interface.dll.sources</response>
+    </project>
+    <project dir="class/corlib" library="corlib-monotouch">
+      <boot>true</boot>
+      <flags>/codepage:65001 -unsafe -nostdlib -nowarn:612,618,1635 -d:INSIDE_CORLIB,MONO_CULTURE_DATA -d:LIBC -d:FEATURE_PAL,GENERICS_WORK,FEATURE_LIST_PREDICATES,FEATURE_SERIALIZATION,FEATURE_ASCII,FEATURE_LATIN1,FEATURE_UTF7,FEATURE_UTF32,MONO_HYBRID_ENCODING_SUPPORT,FEATURE_ASYNC_IO,NEW_EXPERIMENTAL_ASYNC_IO,FEATURE_UTF32,FEATURE_EXCEPTIONDISPATCHINFO,FEATURE_CORRUPTING_EXCEPTIONS,FEATURE_EXCEPTION_NOTIFICATIONS,FEATURE_STRONGNAME_MIGRATION,FEATURE_USE_LCID,FEATURE_FUSION,FEATURE_CRYPTO,FEATURE_X509_SECURESTRINGS,FEATURE_SYNCHRONIZATIONCONTEXT,FEATURE_SYNCHRONIZATIONCONTEXT_WAIT,HAS_CORLIB_CONTRACTS -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -debug -d:FULL_AOT_RUNTIME -optimize /noconfig -d:FEATURE_PAL,GENERICS_WORK,FEATURE_LIST_PREDICATES,FEATURE_SERIALIZATION,FEATURE_ASCII,FEATURE_LATIN1,FEATURE_UTF7,FEATURE_UTF32,MONO_HYBRID_ENCODING_SUPPORT,FEATURE_ASYNC_IO,NEW_EXPERIMENTAL_ASYNC_IO,FEATURE_UTF32,FEATURE_EXCEPTIONDISPATCHINFO,FEATURE_CORRUPTING_EXCEPTIONS,FEATURE_EXCEPTION_NOTIFICATIONS,FEATURE_STRONGNAME_MIGRATION,FEATURE_USE_LCID,FEATURE_FUSION,FEATURE_CRYPTO,FEATURE_X509_SECURESTRINGS,FEATURE_SYNCHRONIZATIONCONTEXT,FEATURE_SYNCHRONIZATIONCONTEXT_WAIT,HAS_CORLIB_CONTRACTS -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -resource:resources/charinfo.nlp -resource:resources/collation.core.bin -resource:resources/collation.tailoring.bin -resource:resources/collation.cjkCHS.bin -resource:resources/collation.cjkCHT.bin -resource:resources/collation.cjkJA.bin -resource:resources/collation.cjkKO.bin -resource:resources/collation.cjkKOlv2.bin --runtime:v4</flags>
+      <output>mscorlib.dll</output>
+      <built_sources>CommonCrypto/MD5CryptoServiceProvider.g.cs CommonCrypto/SHA256Managed.g.cs CommonCrypto/RC2CryptoServiceProvider.g.cs CommonCrypto/SHA384Managed.g.cs CommonCrypto/DESCryptoServiceProvider.g.cs CommonCrypto/SHA1CryptoServiceProvider.g.cs CommonCrypto/SHA512Managed.g.cs CommonCrypto/MD2Managed.g.cs CommonCrypto/SHA1Managed.g.cs CommonCrypto/TripleDESCryptoServiceProvider.g.cs CommonCrypto/MD4Managed.g.cs</built_sources>
+      <library_output>./../../class/lib/monotouch/mscorlib.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_corlib.dll.sources</response>
+    </project>
+    <project dir="class/corlib" library="corlib-tests-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -unsafe -nostdlib -nowarn:612,618,1635 -d:INSIDE_CORLIB,MONO_CULTURE_DATA -d:LIBC -d:FEATURE_PAL,GENERICS_WORK,FEATURE_LIST_PREDICATES,FEATURE_SERIALIZATION,FEATURE_ASCII,FEATURE_LATIN1,FEATURE_UTF7,FEATURE_UTF32,MONO_HYBRID_ENCODING_SUPPORT,FEATURE_ASYNC_IO,NEW_EXPERIMENTAL_ASYNC_IO,FEATURE_UTF32,FEATURE_EXCEPTIONDISPATCHINFO,FEATURE_CORRUPTING_EXCEPTIONS,FEATURE_EXCEPTION_NOTIFICATIONS,FEATURE_STRONGNAME_MIGRATION,FEATURE_USE_LCID,FEATURE_FUSION,FEATURE_CRYPTO,FEATURE_X509_SECURESTRINGS,FEATURE_SYNCHRONIZATIONCONTEXT,FEATURE_SYNCHRONIZATIONCONTEXT_WAIT,HAS_CORLIB_CONTRACTS -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -debug -d:FULL_AOT_RUNTIME -optimize -r:./../../class/lib/monotouch/mscorlib.dll -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -debug -nowarn:168,219,618,672 -unsafe -define:MONO_DATACONVERTER_STATIC_METHODS -resource:Test/resources/Resources.resources</flags>
+      <output>monotouch_corlib_test.dll</output>
+      <built_sources>CommonCrypto/MD5CryptoServiceProvider.g.cs CommonCrypto/SHA256Managed.g.cs CommonCrypto/RC2CryptoServiceProvider.g.cs CommonCrypto/SHA384Managed.g.cs CommonCrypto/DESCryptoServiceProvider.g.cs CommonCrypto/SHA1CryptoServiceProvider.g.cs CommonCrypto/SHA512Managed.g.cs CommonCrypto/MD2Managed.g.cs CommonCrypto/SHA1Managed.g.cs CommonCrypto/TripleDESCryptoServiceProvider.g.cs CommonCrypto/MD4Managed.g.cs</built_sources>
+      <library_output>monotouch_corlib_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_corlib_test.dll.response</response>
+    </project>
+    <project dir="class/Mono.Security" library="Mono.Security-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize /noconfig -unsafe -nowarn:1030,3009 -r:./../../class/lib/monotouch/bare/System.dll</flags>
+      <output>Mono.Security.dll</output>
+      <built_sources>../corlib/CommonCrypto/SHA224Managed.g.cs ../corlib/CommonCrypto/MD2Managed.g.cs ../corlib/CommonCrypto/MD4Managed.g.cs</built_sources>
+      <library_output>./../../class/lib/monotouch/Mono.Security.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_Mono.Security.dll.sources</response>
+    </project>
+    <project dir="class/Mono.Security" library="Mono.Security-tests-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize -r:./../../class/lib/monotouch/Mono.Security.dll -unsafe -nowarn:1030,3009 -r:./../../class/lib/monotouch/bare/System.dll -nowarn:169,219,618,672</flags>
+      <output>monotouch_Mono.Security_test.dll</output>
+      <built_sources>../corlib/CommonCrypto/SHA224Managed.g.cs ../corlib/CommonCrypto/MD2Managed.g.cs ../corlib/CommonCrypto/MD4Managed.g.cs</built_sources>
+      <library_output>monotouch_Mono.Security_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_Mono.Security_test.dll.response</response>
+    </project>
+    <project dir="class/System" library="System-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize /noconfig -d:CONFIGURATION_2_0 -d:FEATURE_PAL,SYSTEM_NAMESPACE,MONO,PLATFORM_UNIX -d:MONO_FEATURE_PROCESS_START -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -unsafe -d:INSIDE_SYSTEM -d:SECURITY_DEP -nowarn:618,1635 -d:SECURITY_DEP -d:XML_DEP -r:./../../class/lib/monotouch/System.Xml.dll -r:MonoSecurity=./../../class/lib/monotouch/Mono.Security.dll</flags>
+      <output>System.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch/System.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_System.dll.sources</response>
+    </project>
+    <project dir="class/System" library="System-tests-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize -r:./../../class/lib/monotouch/secxml/System.dll -nowarn:618,672,219,67,169,612 -resource:Test/System/test-uri-props.txt,test-uri-props.txt -resource:Test/System/test-uri-props-manual.txt,test-uri-props-manual.txt -resource:Test/System/test-uri-relative-props.txt,test-uri-relative-props.txt -d:MONO_FEATURE_PROCESS_START -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS</flags>
+      <output>monotouch_System_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_System_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_System_test.dll.response</response>
+    </project>
+    <project dir="class/System" library="System-bare-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize /noconfig -d:CONFIGURATION_2_0 -d:FEATURE_PAL,SYSTEM_NAMESPACE,MONO,PLATFORM_UNIX -d:MONO_FEATURE_PROCESS_START -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -unsafe -d:INSIDE_SYSTEM -d:SECURITY_DEP -nowarn:618,1635</flags>
+      <output>System.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch/bare/System.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_System.dll.sources</response>
+    </project>
+    <project dir="class/System" library="System-tests-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize -r:./../../class/lib/monotouch/secxml/System.dll -nowarn:618,672,219,67,169,612 -resource:Test/System/test-uri-props.txt,test-uri-props.txt -resource:Test/System/test-uri-props-manual.txt,test-uri-props-manual.txt -resource:Test/System/test-uri-relative-props.txt,test-uri-relative-props.txt -d:MONO_FEATURE_PROCESS_START -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS</flags>
+      <output>monotouch_System_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_System_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_System_test.dll.response</response>
+    </project>
+    <project dir="class/System" library="System-secxml-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize /noconfig -d:CONFIGURATION_2_0 -d:FEATURE_PAL,SYSTEM_NAMESPACE,MONO,PLATFORM_UNIX -d:MONO_FEATURE_PROCESS_START -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -unsafe -d:INSIDE_SYSTEM -d:SECURITY_DEP -nowarn:618,1635 -d:SECURITY_DEP -d:XML_DEP -r:./../../class/lib/monotouch/bare/System.Xml.dll -r:MonoSecurity=./../../class/lib/monotouch/Mono.Security.dll</flags>
+      <output>System.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch/secxml/System.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_System.dll.sources</response>
+    </project>
+    <project dir="class/System" library="System-tests-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize -r:./../../class/lib/monotouch/secxml/System.dll -nowarn:618,672,219,67,169,612 -resource:Test/System/test-uri-props.txt,test-uri-props.txt -resource:Test/System/test-uri-props-manual.txt,test-uri-props-manual.txt -resource:Test/System/test-uri-relative-props.txt,test-uri-relative-props.txt -d:MONO_FEATURE_PROCESS_START -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS</flags>
+      <output>monotouch_System_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_System_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_System_test.dll.response</response>
+    </project>
+    <project dir="class/System.Core" library="System.Core-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize /noconfig -d:FEATURE_PAL,PFX_LEGACY_3_5,FEATURE_NETCORE -d:INSIDE_SYSCORE -d:LIBC -unsafe -d:FEATURE_CORE_DLR -d:MONO_INTERPRETER -r:./../../class/lib/monotouch/System.dll -r:./../../class/lib/monotouch/Mono.Dynamic.Interpreter.dll</flags>
+      <output>System.Core.dll</output>
+      <built_sources>../corlib/CommonCrypto/AesManaged.g.cs ../corlib/CommonCrypto/AesCryptoServiceProvider.g.cs</built_sources>
+      <library_output>./../../class/lib/monotouch/System.Core.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_System.Core.dll.sources</response>
+    </project>
+    <project dir="class/System.Core" library="System.Core-tests-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize -r:./../../class/lib/monotouch/plaincore/System.Core.dll -d:FEATURE_PAL,PFX_LEGACY_3_5,FEATURE_NETCORE -d:INSIDE_SYSCORE -d:LIBC -unsafe -d:FEATURE_CORE_DLR -r:./../../class/lib/monotouch/System.dll</flags>
+      <output>monotouch_System.Core_test.dll</output>
+      <built_sources>../corlib/CommonCrypto/AesManaged.g.cs ../corlib/CommonCrypto/AesCryptoServiceProvider.g.cs</built_sources>
+      <library_output>monotouch_System.Core_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_System.Core_test.dll.response</response>
+    </project>
+    <project dir="class/System.Core" library="System.Core-plaincore-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize /noconfig -d:FEATURE_PAL,PFX_LEGACY_3_5,FEATURE_NETCORE -d:INSIDE_SYSCORE -d:LIBC -unsafe -d:FEATURE_CORE_DLR -r:./../../class/lib/monotouch/System.dll</flags>
+      <output>System.Core.dll</output>
+      <built_sources>../corlib/CommonCrypto/AesManaged.g.cs ../corlib/CommonCrypto/AesCryptoServiceProvider.g.cs</built_sources>
+      <library_output>./../../class/lib/monotouch/plaincore/System.Core.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_System.Core.dll.sources</response>
+    </project>
+    <project dir="class/System.Core" library="System.Core-tests-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize -r:./../../class/lib/monotouch/plaincore/System.Core.dll -d:FEATURE_PAL,PFX_LEGACY_3_5,FEATURE_NETCORE -d:INSIDE_SYSCORE -d:LIBC -unsafe -d:FEATURE_CORE_DLR -r:./../../class/lib/monotouch/System.dll</flags>
+      <output>monotouch_System.Core_test.dll</output>
+      <built_sources>../corlib/CommonCrypto/AesManaged.g.cs ../corlib/CommonCrypto/AesCryptoServiceProvider.g.cs</built_sources>
+      <library_output>monotouch_System.Core_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_System.Core_test.dll.response</response>
+    </project>
+    <project dir="class/System.Security" library="System.Security-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize /noconfig -nowarn:618 -d:SECURITY_DEP -nowarn:414 -r:./../../class/lib/monotouch/secxml/System.dll -r:./../../class/lib/monotouch/bare/System.Xml.dll -r:./../../class/lib/monotouch/Mono.Security.dll</flags>
+      <output>System.Security.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch/System.Security.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_System.Security.dll.sources</response>
+    </project>
+    <project dir="class/System.Security" library="System.Security-tests-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize -r:./../../class/lib/monotouch/System.Security.dll -nowarn:618 -d:SECURITY_DEP -nowarn:414 -r:./../../class/lib/monotouch/secxml/System.dll -r:./../../class/lib/monotouch/bare/System.Xml.dll -r:./../../class/lib/monotouch/Mono.Security.dll -nowarn:168,169,183,219,414</flags>
+      <output>monotouch_System.Security_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_System.Security_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_System.Security_test.dll.response</response>
+    </project>
+    <project dir="class/System.XML" library="System.Xml-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize /noconfig -nowarn:219,414,649,1717 -unsafe -d:ASYNC -d:AGCLR -d:DISABLE_XSLT_COMPILER -d:DISABLE_XSLT_SCRIPT,MONO_HYBRID_SYSTEM_XML -d:DISABLE_CAS_USE -r:./../../class/lib/monotouch/secxml/System.dll</flags>
+      <output>System.Xml.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch/System.Xml.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_System.Xml.dll.sources</response>
+    </project>
+    <project dir="class/System.XML" library="System.Xml-tests-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize -r:./../../class/lib/monotouch/bare/System.Xml.dll -nowarn:219,414,649,1717 -unsafe -d:ASYNC -d:AGCLR -d:DISABLE_XSLT_COMPILER -d:DISABLE_XSLT_SCRIPT,MONO_HYBRID_SYSTEM_XML -d:DISABLE_CAS_USE -r:./../../class/lib/monotouch/bare/System.dll -nowarn:0618 -nowarn:219 -nowarn:169</flags>
+      <output>monotouch_System.Xml_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_System.Xml_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_System.Xml_test.dll.response</response>
+    </project>
+    <project dir="class/System.XML" library="System.Xml-bare-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize /noconfig -nowarn:219,414,649,1717 -unsafe -d:ASYNC -d:AGCLR -d:DISABLE_XSLT_COMPILER -d:DISABLE_XSLT_SCRIPT,MONO_HYBRID_SYSTEM_XML -d:DISABLE_CAS_USE -r:./../../class/lib/monotouch/bare/System.dll</flags>
+      <output>System.Xml.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch/bare/System.Xml.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_System.Xml.dll.sources</response>
+    </project>
+    <project dir="class/System.XML" library="System.Xml-tests-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize -r:./../../class/lib/monotouch/bare/System.Xml.dll -nowarn:219,414,649,1717 -unsafe -d:ASYNC -d:AGCLR -d:DISABLE_XSLT_COMPILER -d:DISABLE_XSLT_SCRIPT,MONO_HYBRID_SYSTEM_XML -d:DISABLE_CAS_USE -r:./../../class/lib/monotouch/bare/System.dll -nowarn:0618 -nowarn:219 -nowarn:169</flags>
+      <output>monotouch_System.Xml_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_System.Xml_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_System.Xml_test.dll.response</response>
+    </project>
+    <project dir="class/I18N/Common" library="I18N-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 /unsafe /define:DISABLE_UNSAFE -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize /noconfig</flags>
+      <output>I18N.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/I18N.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>I18N.dll.sources</response>
+    </project>
+    <project dir="class/I18N/West" library="I18N.West-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 /unsafe -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize /noconfig -r:./../../../class/lib/monotouch/I18N.dll</flags>
+      <output>I18N.West.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/I18N.West.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>I18N.West.dll.sources</response>
+    </project>
+    <project dir="class/I18N/West" library="I18N.West-tests-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 /unsafe -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize -r:./../../../class/lib/monotouch/I18N.West.dll</flags>
+      <output>monotouch_I18N.West_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_I18N.West_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>./../../../build/deps/monotouch_I18N.West_test.dll.response</response>
+    </project>
+    <project dir="class/I18N/MidEast" library="I18N.MidEast-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 /unsafe -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize /noconfig -r:./../../../class/lib/monotouch/I18N.dll</flags>
+      <output>I18N.MidEast.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/I18N.MidEast.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>I18N.MidEast.dll.sources</response>
+    </project>
+    <project dir="class/I18N/MidEast" library="I18N.MidEast-tests-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 /unsafe -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize -r:./../../../class/lib/monotouch/I18N.MidEast.dll</flags>
+      <output>monotouch_I18N.MidEast_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_I18N.MidEast_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>./../../../build/deps/monotouch_I18N.MidEast_test.dll.response</response>
+    </project>
+    <project dir="class/I18N/Other" library="I18N.Other-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 /unsafe -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize /noconfig -r:./../../../class/lib/monotouch/I18N.dll</flags>
+      <output>I18N.Other.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/I18N.Other.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>I18N.Other.dll.sources</response>
+    </project>
+    <project dir="class/I18N/Rare" library="I18N.Rare-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 /unsafe -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize /noconfig -r:./../../../class/lib/monotouch/I18N.dll</flags>
+      <output>I18N.Rare.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/I18N.Rare.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>I18N.Rare.dll.sources</response>
+    </project>
+    <project dir="class/I18N/CJK" library="I18N.CJK-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 /unsafe /resource:big5.table /resource:gb2312.table /resource:jis.table /resource:ks.table /resource:gb18030.table /define:DISABLE_UNSAFE -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize /noconfig -r:./../../../class/lib/monotouch/I18N.dll</flags>
+      <output>I18N.CJK.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/I18N.CJK.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>I18N.CJK.dll.sources</response>
+    </project>
+    <project dir="class/I18N/CJK" library="I18N.CJK-tests-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 /unsafe /resource:big5.table /resource:gb2312.table /resource:jis.table /resource:ks.table /resource:gb18030.table /define:DISABLE_UNSAFE -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize -r:./../../../class/lib/monotouch/I18N.CJK.dll</flags>
+      <output>monotouch_I18N.CJK_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_I18N.CJK_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>./../../../build/deps/monotouch_I18N.CJK_test.dll.response</response>
+    </project>
+    <project dir="class/System.ServiceModel.Internals" library="System.ServiceModel.Internals-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize /noconfig /unsafe -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -r:./../../class/lib/monotouch/System.dll -r:./../../class/lib/monotouch/System.Core.dll -r:./../../class/lib/monotouch/System.Xml.dll</flags>
+      <output>System.ServiceModel.Internals.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch/System.ServiceModel.Internals.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_System.ServiceModel.Internals.dll.sources</response>
+    </project>
+    <project dir="class/System.Runtime.Serialization" library="System.Runtime.Serialization-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize /noconfig -unsafe -d:NO_DYNAMIC_CODEGEN /nowarn:168,169,219,414 /d:NO_CONFIGURATION /d:NO_SECURITY_ATTRIBUTES /d:NO_CODEDOM /d:NO_DESKTOP_SECURITY -r:./../../class/lib/monotouch/System.dll -r:./../../class/lib/monotouch/System.Xml.dll -r:./../../class/lib/monotouch/System.Core.dll -r:./../../class/lib/monotouch/System.ServiceModel.Internals.dll</flags>
+      <output>System.Runtime.Serialization.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch/System.Runtime.Serialization.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_System.Runtime.Serialization.dll.sources</response>
+    </project>
+    <project dir="class/System.Runtime.Serialization" library="System.Runtime.Serialization-tests-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize -r:./../../class/lib/monotouch/System.Runtime.Serialization.dll -unsafe -d:NO_DYNAMIC_CODEGEN /nowarn:168,169,219,414 /d:NO_CONFIGURATION /d:NO_SECURITY_ATTRIBUTES /d:NO_CODEDOM /d:NO_DESKTOP_SECURITY -r:./../../class/lib/monotouch/System.dll -r:./../../class/lib/monotouch/System.Xml.dll -r:./../../class/lib/monotouch/System.Core.dll -r:./../../class/lib/monotouch/System.ServiceModel.Internals.dll /resource:Test/Resources/WSDL/collections.wsdl /resource:Test/Resources/WSDL/custom-collections.wsdl</flags>
+      <output>monotouch_System.Runtime.Serialization_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_System.Runtime.Serialization_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_System.Runtime.Serialization_test.dll.response</response>
+    </project>
+    <project dir="class/System.Xml.Linq" library="System.Xml.Linq-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize /noconfig -d:FEATURE_SERIALIZATION -d:MONO_HYBRID_SYSTEM_XML -r:./../../class/lib/monotouch/System.dll -r:./../../class/lib/monotouch/System.Core.dll -r:./../../class/lib/monotouch/System.Xml.dll -r:./../../class/lib/monotouch/System.Runtime.Serialization.dll</flags>
+      <output>System.Xml.Linq.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch/System.Xml.Linq.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Xml.Linq.dll.sources</response>
+    </project>
+    <project dir="class/System.Xml.Linq" library="System.Xml.Linq-tests-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize -r:./../../class/lib/monotouch/System.Xml.Linq.dll -d:FEATURE_SERIALIZATION -d:MONO_HYBRID_SYSTEM_XML -r:./../../class/lib/monotouch/System.dll -r:./../../class/lib/monotouch/System.Core.dll -r:./../../class/lib/monotouch/System.Xml.dll -r:./../../class/lib/monotouch/System.Runtime.Serialization.dll</flags>
+      <output>monotouch_System.Xml.Linq_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_System.Xml.Linq_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_System.Xml.Linq_test.dll.response</response>
+    </project>
+    <project dir="class/System.IdentityModel" library="System.IdentityModel-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize /noconfig /d:NET_3_0 -r:./../../class/lib/monotouch/System.dll -r:./../../class/lib/monotouch/System.Xml.dll -r:./../../class/lib/monotouch/System.Security.dll -r:./../../class/lib/monotouch/Mono.Security.dll -r:./../../class/lib/monotouch/System.Runtime.Serialization.dll</flags>
+      <output>System.IdentityModel.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch/System.IdentityModel.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_System.IdentityModel.dll.sources</response>
+    </project>
+    <project dir="class/System.IdentityModel" library="System.IdentityModel-tests-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize -r:./../../class/lib/monotouch/System.IdentityModel.dll /d:NET_3_0 -r:./../../class/lib/monotouch/System.dll -r:./../../class/lib/monotouch/System.Xml.dll -r:./../../class/lib/monotouch/System.Security.dll -r:./../../class/lib/monotouch/Mono.Security.dll -r:./../../class/lib/monotouch/System.Runtime.Serialization.dll</flags>
+      <output>monotouch_System.IdentityModel_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_System.IdentityModel_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_System.IdentityModel_test.dll.response</response>
+    </project>
+    <project dir="class/System.ServiceModel" library="System.ServiceModel-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize /noconfig /nowarn:414,169,67,3005,436,219,618 /unsafe /d:TRACE /resource:resources/WS-Addressing.schema /resource:resources/ws-addr.xsd -r:./../../class/lib/monotouch/System.dll -r:./../../class/lib/monotouch/System.Xml.dll -r:./../../class/lib/monotouch/System.Core.dll -r:./../../class/lib/monotouch/System.Runtime.Serialization.dll -r:./../../class/lib/monotouch/System.IdentityModel.dll</flags>
+      <output>System.ServiceModel.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch/System.ServiceModel.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_System.ServiceModel.dll.sources</response>
+    </project>
+    <project dir="class/System.ServiceModel" library="System.ServiceModel-tests-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize -r:./../../class/lib/monotouch/plainservice/System.ServiceModel.dll /nowarn:414,169,67,3005,436,219,618 /unsafe /d:TRACE /resource:resources/WS-Addressing.schema /resource:resources/ws-addr.xsd -r:./../../class/lib/monotouch/System.dll -r:./../../class/lib/monotouch/System.Xml.dll -r:./../../class/lib/monotouch/System.Core.dll -r:./../../class/lib/monotouch/System.Runtime.Serialization.dll -r:./../../class/lib/monotouch/System.IdentityModel.dll</flags>
+      <output>monotouch_System.ServiceModel_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_System.ServiceModel_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_System.ServiceModel_test.dll.response</response>
+    </project>
+    <project dir="class/System.ServiceModel" library="System.ServiceModel-plainservice-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize /noconfig /nowarn:414,169,67,3005,436,219,618 /unsafe /d:TRACE /resource:resources/WS-Addressing.schema /resource:resources/ws-addr.xsd -r:./../../class/lib/monotouch/System.dll -r:./../../class/lib/monotouch/System.Xml.dll -r:./../../class/lib/monotouch/System.Core.dll -r:./../../class/lib/monotouch/System.Runtime.Serialization.dll -r:./../../class/lib/monotouch/System.IdentityModel.dll</flags>
+      <output>System.ServiceModel.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch/plainservice/System.ServiceModel.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_System.ServiceModel.dll.sources</response>
+    </project>
+    <project dir="class/System.ServiceModel" library="System.ServiceModel-tests-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize -r:./../../class/lib/monotouch/plainservice/System.ServiceModel.dll /nowarn:414,169,67,3005,436,219,618 /unsafe /d:TRACE /resource:resources/WS-Addressing.schema /resource:resources/ws-addr.xsd -r:./../../class/lib/monotouch/System.dll -r:./../../class/lib/monotouch/System.Xml.dll -r:./../../class/lib/monotouch/System.Core.dll -r:./../../class/lib/monotouch/System.Runtime.Serialization.dll -r:./../../class/lib/monotouch/System.IdentityModel.dll</flags>
+      <output>monotouch_System.ServiceModel_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_System.ServiceModel_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_System.ServiceModel_test.dll.response</response>
+    </project>
+    <project dir="class/System.ServiceModel.Web" library="System.ServiceModel.Web-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize /noconfig -r:./../../class/lib/monotouch/System.dll -r:./../../class/lib/monotouch/System.Xml.dll -r:./../../class/lib/monotouch/System.Runtime.Serialization.dll -r:./../../class/lib/monotouch/System.ServiceModel.dll -r:./../../class/lib/monotouch/System.Core.dll</flags>
+      <output>System.ServiceModel.Web.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch/System.ServiceModel.Web.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_System.ServiceModel.Web.dll.sources</response>
+    </project>
+    <project dir="class/System.ServiceModel.Web" library="System.ServiceModel.Web-tests-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize -r:./../../class/lib/monotouch/System.ServiceModel.Web.dll -r:./../../class/lib/monotouch/System.dll -r:./../../class/lib/monotouch/System.Xml.dll -r:./../../class/lib/monotouch/System.Runtime.Serialization.dll -r:./../../class/lib/monotouch/System.ServiceModel.dll -r:./../../class/lib/monotouch/System.Core.dll</flags>
+      <output>monotouch_System.ServiceModel.Web_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_System.ServiceModel.Web_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_System.ServiceModel.Web_test.dll.response</response>
+    </project>
+    <project dir="class/System.Json" library="System.Json-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize /noconfig -r:./../../class/lib/monotouch/System.dll -r:./../../class/lib/monotouch/System.Xml.dll -r:./../../class/lib/monotouch/System.Core.dll</flags>
+      <output>System.Json.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch/System.Json.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Json.dll.sources</response>
+    </project>
+    <project dir="class/System.Json" library="System.Json-tests-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize -r:./../../class/lib/monotouch/System.Json.dll -r:./../../class/lib/monotouch/System.dll -r:./../../class/lib/monotouch/System.Xml.dll -r:./../../class/lib/monotouch/System.Core.dll</flags>
+      <output>monotouch_System.Json_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_System.Json_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_System.Json_test.dll.response</response>
+    </project>
+    <project dir="class/System.Web.Services" library="System.Web.Services-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize /noconfig -nowarn:649 -nowarn:169 -resource:System.Web.Services.Description/wsdl-1.1.xsd,wsdl-1.1.xsd -resource:System.Web.Services.Description/wsdl-1.1-soap.xsd,wsdl-1.1-soap.xsd -resource:System.Web.Services.Description/web-reference.xsd,web-reference.xsd -r:./../../class/lib/monotouch/System.dll -r:./../../class/lib/monotouch/System.Xml.dll</flags>
+      <output>System.Web.Services.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch/System.Web.Services.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_System.Web.Services.dll.sources</response>
+    </project>
+    <project dir="class/System.Web.Services" library="System.Web.Services-tests-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize -r:./../../class/lib/monotouch/System.Web.Services.dll -nowarn:649 -nowarn:169 -resource:System.Web.Services.Description/wsdl-1.1.xsd,wsdl-1.1.xsd -resource:System.Web.Services.Description/wsdl-1.1-soap.xsd,wsdl-1.1-soap.xsd -resource:System.Web.Services.Description/web-reference.xsd,web-reference.xsd -r:./../../class/lib/monotouch/System.dll -r:./../../class/lib/monotouch/System.Xml.dll -nowarn:618 -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME</flags>
+      <output>monotouch_System.Web.Services_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_System.Web.Services_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_System.Web.Services_test.dll.response</response>
+    </project>
+    <project dir="class/Mono.Data.Tds" library="Mono.Data.Tds-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize /noconfig -r:./../../class/lib/monotouch/System.dll -r:./../../class/lib/monotouch/System.Xml.dll -r:./../../class/lib/monotouch/Mono.Security.dll</flags>
+      <output>Mono.Data.Tds.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch/Mono.Data.Tds.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>Mono.Data.Tds.dll.sources</response>
+    </project>
+    <project dir="class/Mono.Data.Tds" library="Mono.Data.Tds-tests-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize -r:./../../class/lib/monotouch/Mono.Data.Tds.dll</flags>
+      <output>monotouch_Mono.Data.Tds_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_Mono.Data.Tds_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_Mono.Data.Tds_test.dll.response</response>
+    </project>
+    <project dir="class/System.Transactions" library="System.Transactions-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize /noconfig /define:MOBILE -r:./../../class/lib/monotouch/System.dll</flags>
+      <output>System.Transactions.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch/System.Transactions.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Transactions.dll.sources</response>
+    </project>
+    <project dir="class/System.Transactions" library="System.Transactions-tests-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize -r:./../../class/lib/monotouch/System.Transactions.dll /define:MOBILE -r:./../../class/lib/monotouch/System.dll</flags>
+      <output>monotouch_System.Transactions_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_System.Transactions_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_System.Transactions_test.dll.response</response>
+    </project>
+    <project dir="class/System.Numerics" library="System.Numerics-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize /noconfig /unsafe -nowarn:414 -r:./../../class/lib/monotouch/System.dll</flags>
+      <output>System.Numerics.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch/System.Numerics.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Numerics.dll.sources</response>
+    </project>
+    <project dir="class/System.Numerics" library="System.Numerics-tests-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize -r:./../../class/lib/monotouch/System.Numerics.dll /unsafe -nowarn:414 -r:./../../class/lib/monotouch/System.dll</flags>
+      <output>monotouch_System.Numerics_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_System.Numerics_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_System.Numerics_test.dll.response</response>
+    </project>
+    <project dir="class/System.Numerics.Vectors" library="System.Numerics.Vectors-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize /noconfig -unsafe -r:./../../class/lib/monotouch/System.dll -r:./../../class/lib/monotouch/System.Numerics.dll</flags>
+      <output>System.Numerics.Vectors.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch/System.Numerics.Vectors.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Numerics.Vectors.dll.sources</response>
+    </project>
+    <project dir="class/System.Data" library="System.Data-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize /noconfig -nowarn:219,414,649 -d:PLATFORM_UNIX -d:USEOFFSET -d:MONO_PARTIAL_DATA_IMPORT -unsafe -d:NO_CODEDOM -d:NO_OLEDB -d:NO_ODBC -d:NO_CONFIGURATION -r:./../../class/lib/monotouch/System.dll -r:./../../class/lib/monotouch/System.Xml.dll -r:./../../class/lib/monotouch/System.Core.dll -r:./../../class/lib/monotouch/System.Numerics.dll -r:./../../class/lib/monotouch/Mono.Data.Tds.dll -r:./../../class/lib/monotouch/System.Transactions.dll</flags>
+      <output>System.Data.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch/System.Data.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_System.Data.dll.sources</response>
+    </project>
+    <project dir="class/System.Data" library="System.Data-tests-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize -r:./../../class/lib/monotouch/System.Data.dll -nowarn:219,414,649 -d:PLATFORM_UNIX -d:USEOFFSET -d:MONO_PARTIAL_DATA_IMPORT -unsafe -d:NO_CODEDOM -d:NO_OLEDB -d:NO_ODBC -d:NO_CONFIGURATION -r:./../../class/lib/monotouch/System.dll -r:./../../class/lib/monotouch/System.Xml.dll -r:./../../class/lib/monotouch/System.Core.dll -r:./../../class/lib/monotouch/System.Numerics.dll -r:./../../class/lib/monotouch/Mono.Data.Tds.dll -r:./../../class/lib/monotouch/System.Transactions.dll -nowarn:618,169,612,219,168</flags>
+      <output>monotouch_System.Data_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_System.Data_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_System.Data_test.dll.response</response>
+    </project>
+    <project dir="class/Mono.Data.Sqlite" library="Mono.Data.Sqlite-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize /noconfig /unsafe -resource:resources/SR.resources -resource:resources/SQLiteCommand.bmp -resource:resources/SQLiteConnection.bmp -resource:resources/SQLiteDataAdapter.bmp -d:SQLITE_STANDARD -r:./../../class/lib/monotouch/System.dll -r:./../../class/lib/monotouch/System.Data.dll -r:./../../class/lib/monotouch/System.Transactions.dll -r:./../../class/lib/monotouch/System.Xml.dll</flags>
+      <output>Mono.Data.Sqlite.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch/Mono.Data.Sqlite.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>Mono.Data.Sqlite.dll.sources</response>
+    </project>
+    <project dir="class/Mono.Data.Sqlite" library="Mono.Data.Sqlite-tests-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize -r:./../../class/lib/monotouch/Mono.Data.Sqlite.dll /unsafe -resource:resources/SR.resources -resource:resources/SQLiteCommand.bmp -resource:resources/SQLiteConnection.bmp -resource:resources/SQLiteDataAdapter.bmp -d:SQLITE_STANDARD -r:./../../class/lib/monotouch/System.dll -r:./../../class/lib/monotouch/System.Data.dll -r:./../../class/lib/monotouch/System.Transactions.dll -r:./../../class/lib/monotouch/System.Xml.dll /nowarn:618</flags>
+      <output>monotouch_Mono.Data.Sqlite_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_Mono.Data.Sqlite_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_Mono.Data.Sqlite_test.dll.response</response>
+    </project>
+    <project dir="class/System.Data.Services.Client" library="System.Data.Services.Client-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize /noconfig -d:NET_3_5 -warn:2 -r:./../../class/lib/monotouch/System.dll -r:./../../class/lib/monotouch/System.Core.dll -r:./../../class/lib/monotouch/System.Xml.Linq.dll -r:./../../class/lib/monotouch/System.Data.dll -r:./../../class/lib/monotouch/System.Xml.dll</flags>
+      <output>System.Data.Services.Client.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch/System.Data.Services.Client.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources>System.Data.Services.Client,Client/System.Data.Services.Client.txt</resources>
+      <response>System.Data.Services.Client.dll.sources</response>
+    </project>
+    <project dir="class/System.IO.Compression" library="System.IO.Compression-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize /noconfig /unsafe -r:./../../class/lib/monotouch/System.dll -r:./../../class/lib/monotouch/System.Core.dll</flags>
+      <output>System.IO.Compression.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch/System.IO.Compression.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.IO.Compression.dll.sources</response>
+    </project>
+    <project dir="class/System.IO.Compression" library="System.IO.Compression-tests-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize -r:./../../class/lib/monotouch/System.IO.Compression.dll</flags>
+      <output>monotouch_System.IO.Compression_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_System.IO.Compression_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_System.IO.Compression_test.dll.response</response>
+    </project>
+    <project dir="class/System.IO.Compression.FileSystem" library="System.IO.Compression.FileSystem-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize /noconfig -r:./../../class/lib/monotouch/System.dll -r:./../../class/lib/monotouch/System.IO.Compression.dll</flags>
+      <output>System.IO.Compression.FileSystem.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch/System.IO.Compression.FileSystem.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.IO.Compression.FileSystem.dll.sources</response>
+    </project>
+    <project dir="class/System.IO.Compression.FileSystem" library="System.IO.Compression.FileSystem-tests-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize -r:./../../class/lib/monotouch/System.IO.Compression.FileSystem.dll</flags>
+      <output>monotouch_System.IO.Compression.FileSystem_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_System.IO.Compression.FileSystem_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_System.IO.Compression.FileSystem_test.dll.response</response>
+    </project>
+    <project dir="class/System.ComponentModel.DataAnnotations" library="System.ComponentModel.DataAnnotations-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize /noconfig -nowarn:414 -r:./../../class/lib/monotouch/System.dll -r:./../../class/lib/monotouch/System.Core.dll -r:./../../class/lib/monotouch/System.Data.dll -r:./../../class/lib/monotouch/System.Xml.dll</flags>
+      <output>System.ComponentModel.DataAnnotations.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch/System.ComponentModel.DataAnnotations.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.ComponentModel.DataAnnotations.dll.sources</response>
+    </project>
+    <project dir="class/System.ComponentModel.DataAnnotations" library="System.ComponentModel.DataAnnotations-tests-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize -r:./../../class/lib/monotouch/System.ComponentModel.DataAnnotations.dll -nowarn:414 -r:./../../class/lib/monotouch/System.dll -r:./../../class/lib/monotouch/System.Core.dll -r:./../../class/lib/monotouch/System.Data.dll -r:./../../class/lib/monotouch/System.Xml.dll</flags>
+      <output>monotouch_System.ComponentModel.DataAnnotations_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_System.ComponentModel.DataAnnotations_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_System.ComponentModel.DataAnnotations_test.dll.response</response>
+    </project>
+    <project dir="class/System.ComponentModel.Composition.4.5" library="System.ComponentModel.Composition-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize /noconfig -d:CLR40 -d:USE_ECMA_KEY,FEATURE_REFLECTIONCONTEXT,FEATURE_REFLECTIONFILEIO,FEATURE_SERIALIZATION,FEATURE_SLIMLOCK -nowarn:219,414 -r:./../../class/lib/monotouch/System.dll -r:./../../class/lib/monotouch/System.Core.dll</flags>
+      <output>System.ComponentModel.Composition.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch/System.ComponentModel.Composition.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources>Microsoft.Internal.Strings,src/ComponentModel/Strings.resx</resources>
+      <response>System.ComponentModel.Composition.dll.sources</response>
+    </project>
+    <project dir="class/System.Net" library="System.Net-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize /noconfig -unsafe -r:./../../class/lib/monotouch/System.dll -r:./../../class/lib/monotouch/System.Core.dll -r:./../../class/lib/monotouch/System.Xml.dll</flags>
+      <output>System.Net.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch/System.Net.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Net.dll.sources</response>
+    </project>
+    <project dir="class/System.Net.Http" library="System.Net.Http-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize /noconfig -r:./../../class/lib/monotouch/System.Core.dll -r:./../../class/lib/monotouch/System.dll</flags>
+      <output>System.Net.Http.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch/System.Net.Http.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Net.Http.dll.sources</response>
+    </project>
+    <project dir="class/System.Net.Http" library="System.Net.Http-tests-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize -r:./../../class/lib/monotouch/System.Net.Http.dll</flags>
+      <output>monotouch_System.Net.Http_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_System.Net.Http_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_System.Net.Http_test.dll.response</response>
+    </project>
+    <project dir="class/System.Windows" library="System.Windows-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig -r:./../../class/lib/monotouch/System.dll</flags>
+      <output>System.Windows.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch/System.Windows.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Windows.dll.sources</response>
+    </project>
+    <project dir="class/System.Xml.Serialization" library="System.Xml.Serialization-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig -r:./../../class/lib/monotouch/System.Xml.dll -r:./../../class/lib/monotouch/System.ServiceModel.dll</flags>
+      <output>System.Xml.Serialization.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch/System.Xml.Serialization.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Xml.Serialization.dll.sources</response>
+    </project>
+    <project dir="class/Mono.CSharp" library="Mono.CSharp-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize /noconfig -d:IOS_REFLECTION -d:MONO_FEATURE_THREAD_ABORT -r:./../../class/lib/monotouch/System.Core.dll -r:./../../class/lib/monotouch/System.Xml.dll -r:./../../class/lib/monotouch/System.dll</flags>
+      <output>Mono.CSharp.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch/Mono.CSharp.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_Mono.CSharp.dll.sources</response>
+    </project>
+    <project dir="class/Mono.CSharp" library="Mono.CSharp-tests-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize -r:./../../class/lib/monotouch/Mono.CSharp.dll</flags>
+      <output>monotouch_Mono.CSharp_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_Mono.CSharp_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_Mono.CSharp_test.dll.response</response>
+    </project>
+    <project dir="class/Microsoft.CSharp" library="Microsoft.CSharp-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize /noconfig -r:./../../class/lib/monotouch/System.Core.dll -r:./../../class/lib/monotouch/Mono.CSharp.dll</flags>
+      <output>Microsoft.CSharp.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch/Microsoft.CSharp.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>Microsoft.CSharp.dll.sources</response>
+    </project>
+    <project dir="class/System.Runtime.InteropServices.RuntimeInformation" library="System.Runtime.InteropServices.RuntimeInformation-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize /noconfig -r:./../../class/lib/monotouch/System.dll</flags>
+      <output>System.Runtime.InteropServices.RuntimeInformation.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch/System.Runtime.InteropServices.RuntimeInformation.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Runtime.InteropServices.RuntimeInformation.dll.sources</response>
+    </project>
+    <project dir="class/System.Reflection.DispatchProxy" library="System.Reflection.DispatchProxy-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize /noconfig -r:./../../class/lib/monotouch/System.dll</flags>
+      <output>System.Reflection.DispatchProxy.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch/System.Reflection.DispatchProxy.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Reflection.DispatchProxy.dll.sources</response>
+    </project>
+    <project dir="class/System.Xml.XPath.XmlDocument" library="System.Xml.XPath.XmlDocument-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize /noconfig -r:./../../class/lib/monotouch/System.dll -r:./../../class/lib/monotouch/System.Xml.dll</flags>
+      <output>System.Xml.XPath.XmlDocument.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch/System.Xml.XPath.XmlDocument.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Xml.XPath.XmlDocument.dll.sources</response>
+    </project>
+    <project dir="class/System.Reflection.Context" library="System.Reflection.Context-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize /noconfig -r:./../../class/lib/monotouch/System.dll</flags>
+      <output>System.Reflection.Context.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch/System.Reflection.Context.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Reflection.Context.dll.sources</response>
+    </project>
+    <project dir="class/System.Net.Http.WinHttpHandler" library="System.Net.Http.WinHttpHandler-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize /noconfig -r:./../../class/lib/monotouch/System.dll -r:./../../class/lib/monotouch/System.Net.Http.dll</flags>
+      <output>System.Net.Http.WinHttpHandler.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch/System.Net.Http.WinHttpHandler.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Net.Http.WinHttpHandler.dll.sources</response>
+    </project>
+    <project dir="class/Mono.Dynamic.Interpreter" library="Mono.Dynamic.Interpreter-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize /noconfig -d:FEATURE_CORE_DLR,FEATURE_DBNULL,FEATURE_DEFAULT_PARAMETER_VALUE,FEATURE_GET_TYPE_INFO,FEATURE_VARIANCE,FEATURE_SERIALIZATION,CLR45 -d:MONO_INTERPRETER -delaysign -keyfile:../mono.pub -r:./../../class/lib/monotouch/System.dll -r:./../../class/lib/monotouch/plaincore/System.Core.dll</flags>
+      <output>Mono.Dynamic.Interpreter.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch/Mono.Dynamic.Interpreter.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>Mono.Dynamic.Interpreter.dll.sources</response>
+    </project>
+    <project dir="class/PEAPI" library="PEAPI-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize /noconfig -nowarn:414,618 -r:./../../class/lib/monotouch/System.dll</flags>
+      <output>PEAPI.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch/PEAPI.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>PEAPI.dll.sources</response>
+    </project>
+    <project dir="class/Mono.CompilerServices.SymbolWriter" library="Mono.CompilerServices.SymbolWriter-monotouch">
+      <boot>true</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize /noconfig -r:./../../class/lib/monotouch/System.dll</flags>
+      <output>Mono.CompilerServices.SymbolWriter.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch/Mono.CompilerServices.SymbolWriter.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>Mono.CompilerServices.SymbolWriter.dll.sources</response>
+    </project>
+    <project dir="class/Mono.Simd" library="Mono.Simd-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize /noconfig /unsafe -r:./../../class/lib/monotouch/System.Core.dll</flags>
+      <output>Mono.Simd.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch/Mono.Simd.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>Mono.Simd.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.X509Certificates" library="Facades_System.Security.Cryptography.X509Certificates-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll -r:./../../../class/lib/monotouch/System.Core.dll</flags>
+      <output>System.Security.Cryptography.X509Certificates.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Security.Cryptography.X509Certificates.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.X509Certificates.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.ServiceModel.Primitives" library="Facades_System.ServiceModel.Primitives-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll -r:./../../../class/lib/monotouch/System.ServiceModel.dll -r:./../../../class/lib/monotouch/System.Xml.dll -r:./../../../class/lib/monotouch/System.IdentityModel.dll -r:./../../../class/lib/monotouch/Facades/System.Security.Cryptography.X509Certificates.dll</flags>
+      <output>System.ServiceModel.Primitives.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.ServiceModel.Primitives.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.ServiceModel.Primitives.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Runtime.Serialization.Primitives" library="Facades_System.Runtime.Serialization.Primitives-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.Runtime.Serialization.dll</flags>
+      <output>System.Runtime.Serialization.Primitives.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Runtime.Serialization.Primitives.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Runtime.Serialization.Primitives.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Runtime.Serialization.Xml" library="Facades_System.Runtime.Serialization.Xml-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 /d:NO_CODEDOM -r:./../../../class/lib/monotouch/System.dll -r:./../../../class/lib/monotouch/System.Runtime.Serialization.dll -r:./../../../class/lib/monotouch/System.Xml.dll -r:./../../../class/lib/monotouch/Facades/System.Runtime.Serialization.Primitives.dll</flags>
+      <output>System.Runtime.Serialization.Xml.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Runtime.Serialization.Xml.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Runtime.Serialization.Xml.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.Algorithms" library="Facades_System.Security.Cryptography.Algorithms-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll -r:./../../../class/lib/monotouch/System.Core.dll</flags>
+      <output>System.Security.Cryptography.Algorithms.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Security.Cryptography.Algorithms.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.Algorithms.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.OpenSsl" library="Facades_System.Security.Cryptography.OpenSsl-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.Core.dll -r:./../../../class/lib/monotouch/Facades/System.Security.Cryptography.Algorithms.dll</flags>
+      <output>System.Security.Cryptography.OpenSsl.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Security.Cryptography.OpenSsl.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.OpenSsl.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Collections.Concurrent" library="Facades_System.Collections.Concurrent-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll</flags>
+      <output>System.Collections.Concurrent.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Collections.Concurrent.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Collections.Concurrent.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Collections" library="Facades_System.Collections-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll -r:./../../../class/lib/monotouch/System.Core.dll</flags>
+      <output>System.Collections.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Collections.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Collections.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.ComponentModel.Annotations" library="Facades_System.ComponentModel.Annotations-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.ComponentModel.DataAnnotations.dll</flags>
+      <output>System.ComponentModel.Annotations.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.ComponentModel.Annotations.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.ComponentModel.Annotations.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.ComponentModel.EventBasedAsync" library="Facades_System.ComponentModel.EventBasedAsync-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll</flags>
+      <output>System.ComponentModel.EventBasedAsync.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.ComponentModel.EventBasedAsync.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.ComponentModel.EventBasedAsync.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.ComponentModel" library="Facades_System.ComponentModel-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll</flags>
+      <output>System.ComponentModel.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.ComponentModel.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.ComponentModel.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Diagnostics.Contracts" library="Facades_System.Diagnostics.Contracts-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Diagnostics.Contracts.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Diagnostics.Contracts.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Diagnostics.Contracts.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Diagnostics.Debug" library="Facades_System.Diagnostics.Debug-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll</flags>
+      <output>System.Diagnostics.Debug.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Diagnostics.Debug.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Diagnostics.Debug.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Diagnostics.Tracing" library="Facades_System.Diagnostics.Tracing-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Diagnostics.Tracing.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Diagnostics.Tracing.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Diagnostics.Tracing.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Diagnostics.Tools" library="Facades_System.Diagnostics.Tools-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll</flags>
+      <output>System.Diagnostics.Tools.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Diagnostics.Tools.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Diagnostics.Tools.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Dynamic.Runtime" library="Facades_System.Dynamic.Runtime-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.Core.dll -r:./../../../class/lib/monotouch/System.dll</flags>
+      <output>System.Dynamic.Runtime.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Dynamic.Runtime.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Dynamic.Runtime.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Globalization" library="Facades_System.Globalization-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Globalization.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Globalization.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Globalization.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.IO" library="Facades_System.IO-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll</flags>
+      <output>System.IO.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.IO.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.IO.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Linq.Expressions" library="Facades_System.Linq.Expressions-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.Core.dll</flags>
+      <output>System.Linq.Expressions.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Linq.Expressions.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Linq.Expressions.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Linq.Parallel" library="Facades_System.Linq.Parallel-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.Core.dll</flags>
+      <output>System.Linq.Parallel.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Linq.Parallel.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Linq.Parallel.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Linq.Queryable" library="Facades_System.Linq.Queryable-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.Core.dll</flags>
+      <output>System.Linq.Queryable.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Linq.Queryable.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Linq.Queryable.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Linq" library="Facades_System.Linq-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.Core.dll</flags>
+      <output>System.Linq.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Linq.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Linq.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.NetworkInformation" library="Facades_System.Net.NetworkInformation-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll</flags>
+      <output>System.Net.NetworkInformation.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Net.NetworkInformation.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Net.NetworkInformation.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.Primitives" library="Facades_System.Net.Primitives-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll</flags>
+      <output>System.Net.Primitives.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Net.Primitives.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Net.Primitives.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.Requests" library="Facades_System.Net.Requests-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll</flags>
+      <output>System.Net.Requests.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Net.Requests.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Net.Requests.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.ObjectModel" library="Facades_System.ObjectModel-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll</flags>
+      <output>System.ObjectModel.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.ObjectModel.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.ObjectModel.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Reflection.Extensions" library="Facades_System.Reflection.Extensions-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Reflection.Extensions.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Reflection.Extensions.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Reflection.Extensions.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Reflection.Primitives" library="Facades_System.Reflection.Primitives-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Reflection.Primitives.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Reflection.Primitives.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Reflection.Primitives.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Reflection" library="Facades_System.Reflection-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Reflection.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Reflection.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Reflection.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Resources.ResourceManager" library="Facades_System.Resources.ResourceManager-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Resources.ResourceManager.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Resources.ResourceManager.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Resources.ResourceManager.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Runtime.Extensions" library="Facades_System.Runtime.Extensions-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll</flags>
+      <output>System.Runtime.Extensions.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Runtime.Extensions.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Runtime.Extensions.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Runtime.InteropServices" library="Facades_System.Runtime.InteropServices-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll -r:./../../../class/lib/monotouch/System.Core.dll</flags>
+      <output>System.Runtime.InteropServices.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Runtime.InteropServices.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Runtime.InteropServices.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Runtime.InteropServices.WindowsRuntime" library="Facades_System.Runtime.InteropServices.WindowsRuntime-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Runtime.InteropServices.WindowsRuntime.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Runtime.InteropServices.WindowsRuntime.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Runtime.InteropServices.WindowsRuntime.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Runtime.Numerics" library="Facades_System.Runtime.Numerics-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.Numerics.dll</flags>
+      <output>System.Runtime.Numerics.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Runtime.Numerics.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Runtime.Numerics.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Runtime.Serialization.Json" library="Facades_System.Runtime.Serialization.Json-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.Runtime.Serialization.dll</flags>
+      <output>System.Runtime.Serialization.Json.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Runtime.Serialization.Json.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Runtime.Serialization.Json.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Runtime" library="Facades_System.Runtime-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll -r:./../../../class/lib/monotouch/System.ComponentModel.Composition.dll -r:./../../../class/lib/monotouch/System.Core.dll</flags>
+      <output>System.Runtime.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Runtime.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Runtime.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Principal" library="Facades_System.Security.Principal-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Security.Principal.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Security.Principal.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Security.Principal.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.ServiceModel.Http" library="Facades_System.ServiceModel.Http-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.ServiceModel.dll</flags>
+      <output>System.ServiceModel.Http.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.ServiceModel.Http.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.ServiceModel.Http.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.ServiceModel.Security" library="Facades_System.ServiceModel.Security-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.ServiceModel.dll</flags>
+      <output>System.ServiceModel.Security.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.ServiceModel.Security.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.ServiceModel.Security.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Text.Encoding.Extensions" library="Facades_System.Text.Encoding.Extensions-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Text.Encoding.Extensions.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Text.Encoding.Extensions.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Text.Encoding.Extensions.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Text.Encoding" library="Facades_System.Text.Encoding-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Text.Encoding.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Text.Encoding.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Text.Encoding.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Text.RegularExpressions" library="Facades_System.Text.RegularExpressions-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll</flags>
+      <output>System.Text.RegularExpressions.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Text.RegularExpressions.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Text.RegularExpressions.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Threading.Tasks.Parallel" library="Facades_System.Threading.Tasks.Parallel-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Threading.Tasks.Parallel.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Threading.Tasks.Parallel.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Threading.Tasks.Parallel.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Threading.Tasks" library="Facades_System.Threading.Tasks-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.Core.dll</flags>
+      <output>System.Threading.Tasks.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Threading.Tasks.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Threading.Tasks.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Threading.Timer" library="Facades_System.Threading.Timer-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll -r:./../../../class/lib/monotouch/System.Core.dll</flags>
+      <output>System.Threading.Timer.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Threading.Timer.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Threading.Timer.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Threading" library="Facades_System.Threading-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll -r:./../../../class/lib/monotouch/System.Core.dll</flags>
+      <output>System.Threading.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Threading.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Threading.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Xml.ReaderWriter" library="Facades_System.Xml.ReaderWriter-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.Xml.dll</flags>
+      <output>System.Xml.ReaderWriter.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Xml.ReaderWriter.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Xml.ReaderWriter.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Xml.XDocument" library="Facades_System.Xml.XDocument-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.Xml.Linq.dll -r:./../../../class/lib/monotouch/System.Xml.dll</flags>
+      <output>System.Xml.XDocument.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Xml.XDocument.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Xml.XDocument.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Xml.XmlSerializer" library="Facades_System.Xml.XmlSerializer-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.Xml.dll</flags>
+      <output>System.Xml.XmlSerializer.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Xml.XmlSerializer.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Xml.XmlSerializer.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Runtime.Handles" library="Facades_System.Runtime.Handles-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll -r:./../../../class/lib/monotouch/System.Core.dll</flags>
+      <output>System.Runtime.Handles.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Runtime.Handles.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Runtime.Handles.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.ServiceModel.Duplex" library="Facades_System.ServiceModel.Duplex-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.ServiceModel.dll</flags>
+      <output>System.ServiceModel.Duplex.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.ServiceModel.Duplex.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.ServiceModel.Duplex.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.ServiceModel.NetTcp" library="Facades_System.ServiceModel.NetTcp-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.ServiceModel.dll</flags>
+      <output>System.ServiceModel.NetTcp.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.ServiceModel.NetTcp.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.ServiceModel.NetTcp.dll.sources</response>
+    </project>
+    <project dir="class/Facades/Microsoft.Win32.Primitives" library="Facades_Microsoft.Win32.Primitives-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll</flags>
+      <output>Microsoft.Win32.Primitives.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/Microsoft.Win32.Primitives.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>Microsoft.Win32.Primitives.dll.sources</response>
+    </project>
+    <project dir="class/Facades/Microsoft.Win32.Registry" library="Facades_Microsoft.Win32.Registry-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll</flags>
+      <output>Microsoft.Win32.Registry.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/Microsoft.Win32.Registry.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>Microsoft.Win32.Registry.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.AppContext" library="Facades_System.AppContext-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll</flags>
+      <output>System.AppContext.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.AppContext.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.AppContext.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Collections.NonGeneric" library="Facades_System.Collections.NonGeneric-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll</flags>
+      <output>System.Collections.NonGeneric.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Collections.NonGeneric.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Collections.NonGeneric.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Collections.Specialized" library="Facades_System.Collections.Specialized-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll</flags>
+      <output>System.Collections.Specialized.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Collections.Specialized.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Collections.Specialized.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.ComponentModel.Primitives" library="Facades_System.ComponentModel.Primitives-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll</flags>
+      <output>System.ComponentModel.Primitives.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.ComponentModel.Primitives.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.ComponentModel.Primitives.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.ComponentModel.TypeConverter" library="Facades_System.ComponentModel.TypeConverter-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll</flags>
+      <output>System.ComponentModel.TypeConverter.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.ComponentModel.TypeConverter.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.ComponentModel.TypeConverter.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Console" library="Facades_System.Console-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll</flags>
+      <output>System.Console.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Console.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Console.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Data.Common" library="Facades_System.Data.Common-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll -r:./../../../class/lib/monotouch/System.Data.dll -r:./../../../class/lib/monotouch/System.Xml.dll</flags>
+      <output>System.Data.Common.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Data.Common.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Data.Common.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Data.SqlClient" library="Facades_System.Data.SqlClient-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll -r:./../../../class/lib/monotouch/System.Data.dll -r:./../../../class/lib/monotouch/System.Xml.dll</flags>
+      <output>System.Data.SqlClient.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Data.SqlClient.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Data.SqlClient.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Diagnostics.FileVersionInfo" library="Facades_System.Diagnostics.FileVersionInfo-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll</flags>
+      <output>System.Diagnostics.FileVersionInfo.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Diagnostics.FileVersionInfo.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Diagnostics.FileVersionInfo.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Diagnostics.Process" library="Facades_System.Diagnostics.Process-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll</flags>
+      <output>System.Diagnostics.Process.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Diagnostics.Process.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Diagnostics.Process.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Diagnostics.TextWriterTraceListener" library="Facades_System.Diagnostics.TextWriterTraceListener-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll</flags>
+      <output>System.Diagnostics.TextWriterTraceListener.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Diagnostics.TextWriterTraceListener.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Diagnostics.TextWriterTraceListener.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Diagnostics.TraceEvent" library="Facades_System.Diagnostics.TraceEvent-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll</flags>
+      <output>System.Diagnostics.TraceEvent.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Diagnostics.TraceEvent.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Diagnostics.TraceEvent.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Diagnostics.TraceSource" library="Facades_System.Diagnostics.TraceSource-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll</flags>
+      <output>System.Diagnostics.TraceSource.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Diagnostics.TraceSource.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Diagnostics.TraceSource.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Globalization.Calendars" library="Facades_System.Globalization.Calendars-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll</flags>
+      <output>System.Globalization.Calendars.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Globalization.Calendars.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Globalization.Calendars.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.IO.Compression.ZipFile" library="Facades_System.IO.Compression.ZipFile-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll -r:./../../../class/lib/monotouch/System.IO.Compression.FileSystem.dll</flags>
+      <output>System.IO.Compression.ZipFile.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.IO.Compression.ZipFile.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.IO.Compression.ZipFile.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.IO.FileSystem" library="Facades_System.IO.FileSystem-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll</flags>
+      <output>System.IO.FileSystem.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.IO.FileSystem.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.IO.FileSystem.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.IO.FileSystem.DriveInfo" library="Facades_System.IO.FileSystem.DriveInfo-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll</flags>
+      <output>System.IO.FileSystem.DriveInfo.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.IO.FileSystem.DriveInfo.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.IO.FileSystem.DriveInfo.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.IO.FileSystem.Primitives" library="Facades_System.IO.FileSystem.Primitives-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll</flags>
+      <output>System.IO.FileSystem.Primitives.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.IO.FileSystem.Primitives.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.IO.FileSystem.Primitives.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.IO.IsolatedStorage" library="Facades_System.IO.IsolatedStorage-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll</flags>
+      <output>System.IO.IsolatedStorage.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.IO.IsolatedStorage.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.IO.IsolatedStorage.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.IO.MemoryMappedFiles" library="Facades_System.IO.MemoryMappedFiles-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll -r:./../../../class/lib/monotouch/System.Core.dll</flags>
+      <output>System.IO.MemoryMappedFiles.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.IO.MemoryMappedFiles.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.IO.MemoryMappedFiles.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.IO.UnmanagedMemoryStream" library="Facades_System.IO.UnmanagedMemoryStream-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll</flags>
+      <output>System.IO.UnmanagedMemoryStream.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.IO.UnmanagedMemoryStream.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.IO.UnmanagedMemoryStream.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.AuthenticationManager" library="Facades_System.Net.AuthenticationManager-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll</flags>
+      <output>System.Net.AuthenticationManager.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Net.AuthenticationManager.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Net.AuthenticationManager.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.Cache" library="Facades_System.Net.Cache-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll</flags>
+      <output>System.Net.Cache.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Net.Cache.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Net.Cache.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.HttpListener" library="Facades_System.Net.HttpListener-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll</flags>
+      <output>System.Net.HttpListener.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Net.HttpListener.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Net.HttpListener.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.Mail" library="Facades_System.Net.Mail-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll</flags>
+      <output>System.Net.Mail.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Net.Mail.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Net.Mail.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.NameResolution" library="Facades_System.Net.NameResolution-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll</flags>
+      <output>System.Net.NameResolution.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Net.NameResolution.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Net.NameResolution.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.Security" library="Facades_System.Net.Security-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll</flags>
+      <output>System.Net.Security.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Net.Security.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Net.Security.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.ServicePoint" library="Facades_System.Net.ServicePoint-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll</flags>
+      <output>System.Net.ServicePoint.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Net.ServicePoint.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Net.ServicePoint.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.Sockets" library="Facades_System.Net.Sockets-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll</flags>
+      <output>System.Net.Sockets.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Net.Sockets.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Net.Sockets.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.Utilities" library="Facades_System.Net.Utilities-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll</flags>
+      <output>System.Net.Utilities.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Net.Utilities.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Net.Utilities.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.WebHeaderCollection" library="Facades_System.Net.WebHeaderCollection-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll</flags>
+      <output>System.Net.WebHeaderCollection.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Net.WebHeaderCollection.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Net.WebHeaderCollection.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.WebSockets" library="Facades_System.Net.WebSockets-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll</flags>
+      <output>System.Net.WebSockets.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Net.WebSockets.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Net.WebSockets.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.WebSockets.Client" library="Facades_System.Net.WebSockets.Client-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll</flags>
+      <output>System.Net.WebSockets.Client.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Net.WebSockets.Client.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Net.WebSockets.Client.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Resources.ReaderWriter" library="Facades_System.Resources.ReaderWriter-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll</flags>
+      <output>System.Resources.ReaderWriter.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Resources.ReaderWriter.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Resources.ReaderWriter.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Runtime.CompilerServices.VisualC" library="Facades_System.Runtime.CompilerServices.VisualC-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll</flags>
+      <output>System.Runtime.CompilerServices.VisualC.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Runtime.CompilerServices.VisualC.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Runtime.CompilerServices.VisualC.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.AccessControl" library="Facades_System.Security.AccessControl-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll</flags>
+      <output>System.Security.AccessControl.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Security.AccessControl.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Security.AccessControl.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Claims" library="Facades_System.Security.Claims-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll</flags>
+      <output>System.Security.Claims.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Security.Claims.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Security.Claims.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.DeriveBytes" library="Facades_System.Security.Cryptography.DeriveBytes-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll</flags>
+      <output>System.Security.Cryptography.DeriveBytes.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Security.Cryptography.DeriveBytes.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.DeriveBytes.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.Encoding" library="Facades_System.Security.Cryptography.Encoding-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll</flags>
+      <output>System.Security.Cryptography.Encoding.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Security.Cryptography.Encoding.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.Encoding.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.Encryption" library="Facades_System.Security.Cryptography.Encryption-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll</flags>
+      <output>System.Security.Cryptography.Encryption.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Security.Cryptography.Encryption.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.Encryption.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.Encryption.Aes" library="Facades_System.Security.Cryptography.Encryption.Aes-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll</flags>
+      <output>System.Security.Cryptography.Encryption.Aes.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Security.Cryptography.Encryption.Aes.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.Encryption.Aes.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.Encryption.ECDiffieHellman" library="Facades_System.Security.Cryptography.Encryption.ECDiffieHellman-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll -r:./../../../class/lib/monotouch/System.Core.dll</flags>
+      <output>System.Security.Cryptography.Encryption.ECDiffieHellman.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Security.Cryptography.Encryption.ECDiffieHellman.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.Encryption.ECDiffieHellman.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.Encryption.ECDsa" library="Facades_System.Security.Cryptography.Encryption.ECDsa-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll -r:./../../../class/lib/monotouch/System.Core.dll</flags>
+      <output>System.Security.Cryptography.Encryption.ECDsa.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Security.Cryptography.Encryption.ECDsa.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.Encryption.ECDsa.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.Hashing" library="Facades_System.Security.Cryptography.Hashing-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll</flags>
+      <output>System.Security.Cryptography.Hashing.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Security.Cryptography.Hashing.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.Hashing.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.Hashing.Algorithms" library="Facades_System.Security.Cryptography.Hashing.Algorithms-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll</flags>
+      <output>System.Security.Cryptography.Hashing.Algorithms.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Security.Cryptography.Hashing.Algorithms.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.Hashing.Algorithms.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.RSA" library="Facades_System.Security.Cryptography.RSA-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll</flags>
+      <output>System.Security.Cryptography.RSA.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Security.Cryptography.RSA.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.RSA.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.RandomNumberGenerator" library="Facades_System.Security.Cryptography.RandomNumberGenerator-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll</flags>
+      <output>System.Security.Cryptography.RandomNumberGenerator.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Security.Cryptography.RandomNumberGenerator.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.RandomNumberGenerator.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Principal.Windows" library="Facades_System.Security.Principal.Windows-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll</flags>
+      <output>System.Security.Principal.Windows.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Security.Principal.Windows.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Security.Principal.Windows.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Threading.Thread" library="Facades_System.Threading.Thread-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll</flags>
+      <output>System.Threading.Thread.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Threading.Thread.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Threading.Thread.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Threading.ThreadPool" library="Facades_System.Threading.ThreadPool-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll</flags>
+      <output>System.Threading.ThreadPool.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Threading.ThreadPool.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Threading.ThreadPool.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Xml.XPath" library="Facades_System.Xml.XPath-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll -r:./../../../class/lib/monotouch/System.Xml.dll</flags>
+      <output>System.Xml.XPath.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Xml.XPath.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Xml.XPath.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Xml.XmlDocument" library="Facades_System.Xml.XmlDocument-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll -r:./../../../class/lib/monotouch/System.Xml.dll</flags>
+      <output>System.Xml.XmlDocument.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Xml.XmlDocument.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Xml.XmlDocument.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Xml.Xsl.Primitives" library="Facades_System.Xml.Xsl.Primitives-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll -r:./../../../class/lib/monotouch/System.Xml.dll</flags>
+      <output>System.Xml.Xsl.Primitives.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Xml.Xsl.Primitives.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Xml.Xsl.Primitives.dll.sources</response>
+    </project>
+    <project dir="class/Facades/Microsoft.Win32.Registry.AccessControl" library="Facades_Microsoft.Win32.Registry.AccessControl-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll</flags>
+      <output>Microsoft.Win32.Registry.AccessControl.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/Microsoft.Win32.Registry.AccessControl.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>Microsoft.Win32.Registry.AccessControl.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Diagnostics.StackTrace" library="Facades_System.Diagnostics.StackTrace-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll</flags>
+      <output>System.Diagnostics.StackTrace.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Diagnostics.StackTrace.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Diagnostics.StackTrace.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Globalization.Extensions" library="Facades_System.Globalization.Extensions-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll</flags>
+      <output>System.Globalization.Extensions.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Globalization.Extensions.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Globalization.Extensions.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.IO.FileSystem.AccessControl" library="Facades_System.IO.FileSystem.AccessControl-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll</flags>
+      <output>System.IO.FileSystem.AccessControl.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.IO.FileSystem.AccessControl.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.IO.FileSystem.AccessControl.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Reflection.TypeExtensions" library="Facades_System.Reflection.TypeExtensions-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll</flags>
+      <output>System.Reflection.TypeExtensions.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Reflection.TypeExtensions.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Reflection.TypeExtensions.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Reflection.Emit.Lightweight" library="Facades_System.Reflection.Emit.Lightweight-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Reflection.Emit.Lightweight.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Reflection.Emit.Lightweight.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Reflection.Emit.Lightweight.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Reflection.Emit.ILGeneration" library="Facades_System.Reflection.Emit.ILGeneration-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Reflection.Emit.ILGeneration.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Reflection.Emit.ILGeneration.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Reflection.Emit.ILGeneration.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Reflection.Emit" library="Facades_System.Reflection.Emit-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Reflection.Emit.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Reflection.Emit.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Reflection.Emit.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.SecureString" library="Facades_System.Security.SecureString-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll</flags>
+      <output>System.Security.SecureString.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Security.SecureString.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Security.SecureString.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Threading.AccessControl" library="Facades_System.Threading.AccessControl-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll</flags>
+      <output>System.Threading.AccessControl.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Threading.AccessControl.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Threading.AccessControl.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Threading.Overlapped" library="Facades_System.Threading.Overlapped-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -unsafe -r:./../../../class/lib/monotouch/System.dll</flags>
+      <output>System.Threading.Overlapped.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Threading.Overlapped.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Threading.Overlapped.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Xml.XPath.XDocument" library="Facades_System.Xml.XPath.XDocument-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll -r:./../../../class/lib/monotouch/System.Xml.dll -r:./../../../class/lib/monotouch/System.Xml.Linq.dll</flags>
+      <output>System.Xml.XPath.XDocument.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Xml.XPath.XDocument.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Xml.XPath.XDocument.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.Primitives" library="Facades_System.Security.Cryptography.Primitives-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll</flags>
+      <output>System.Security.Cryptography.Primitives.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Security.Cryptography.Primitives.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.Primitives.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Text.Encoding.CodePages" library="Facades_System.Text.Encoding.CodePages-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll</flags>
+      <output>System.Text.Encoding.CodePages.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Text.Encoding.CodePages.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Text.Encoding.CodePages.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.IO.FileSystem.Watcher" library="Facades_System.IO.FileSystem.Watcher-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll</flags>
+      <output>System.IO.FileSystem.Watcher.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.IO.FileSystem.Watcher.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.IO.FileSystem.Watcher.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.ProtectedData" library="Facades_System.Security.Cryptography.ProtectedData-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll -r:./../../../class/lib/monotouch/System.Security.dll</flags>
+      <output>System.Security.Cryptography.ProtectedData.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Security.Cryptography.ProtectedData.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.ProtectedData.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.ServiceProcess.ServiceController" library="Facades_System.ServiceProcess.ServiceController-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll</flags>
+      <output>System.ServiceProcess.ServiceController.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.ServiceProcess.ServiceController.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.ServiceProcess.ServiceController.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.IO.Pipes" library="Facades_System.IO.Pipes-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll -r:./../../../class/lib/monotouch/System.Core.dll</flags>
+      <output>System.IO.Pipes.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.IO.Pipes.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.IO.Pipes.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.Ping" library="Facades_System.Net.Ping-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll</flags>
+      <output>System.Net.Ping.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Net.Ping.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Net.Ping.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Runtime.Serialization.Formatters" library="Facades_System.Runtime.Serialization.Formatters-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll</flags>
+      <output>System.Runtime.Serialization.Formatters.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Runtime.Serialization.Formatters.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Runtime.Serialization.Formatters.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.Csp" library="Facades_System.Security.Cryptography.Csp-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll</flags>
+      <output>System.Security.Cryptography.Csp.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Security.Cryptography.Csp.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.Csp.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.Pkcs" library="Facades_System.Security.Cryptography.Pkcs-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll -r:./../../../class/lib/monotouch/System.Security.dll</flags>
+      <output>System.Security.Cryptography.Pkcs.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Security.Cryptography.Pkcs.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.Pkcs.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.Cng" library="Facades_System.Security.Cryptography.Cng-monotouch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch/mscorlib.dll -d:FULL_AOT_RUNTIME -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch/System.dll -r:./../../../class/lib/monotouch/System.Core.dll</flags>
+      <output>System.Security.Cryptography.Cng.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch/Facades/System.Security.Cryptography.Cng.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.Cng.dll.sources</response>
+    </project>
+    <project dir="class/corlib" library="corlib-monotouch_runtime">
+      <boot>true</boot>
+      <flags>/codepage:65001 -unsafe -nostdlib -nowarn:612,618,1635 -d:INSIDE_CORLIB,MONO_CULTURE_DATA -d:LIBC -d:FEATURE_PAL,GENERICS_WORK,FEATURE_LIST_PREDICATES,FEATURE_SERIALIZATION,FEATURE_ASCII,FEATURE_LATIN1,FEATURE_UTF7,FEATURE_UTF32,MONO_HYBRID_ENCODING_SUPPORT,FEATURE_ASYNC_IO,NEW_EXPERIMENTAL_ASYNC_IO,FEATURE_UTF32,FEATURE_EXCEPTIONDISPATCHINFO,FEATURE_CORRUPTING_EXCEPTIONS,FEATURE_EXCEPTION_NOTIFICATIONS,FEATURE_STRONGNAME_MIGRATION,FEATURE_USE_LCID,FEATURE_FUSION,FEATURE_CRYPTO,FEATURE_X509_SECURESTRINGS,FEATURE_SYNCHRONIZATIONCONTEXT,FEATURE_SYNCHRONIZATIONCONTEXT_WAIT,HAS_CORLIB_CONTRACTS -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -debug -optimize /noconfig -d:FEATURE_PAL,GENERICS_WORK,FEATURE_LIST_PREDICATES,FEATURE_SERIALIZATION,FEATURE_ASCII,FEATURE_LATIN1,FEATURE_UTF7,FEATURE_UTF32,MONO_HYBRID_ENCODING_SUPPORT,FEATURE_ASYNC_IO,NEW_EXPERIMENTAL_ASYNC_IO,FEATURE_UTF32,FEATURE_EXCEPTIONDISPATCHINFO,FEATURE_CORRUPTING_EXCEPTIONS,FEATURE_EXCEPTION_NOTIFICATIONS,FEATURE_STRONGNAME_MIGRATION,FEATURE_USE_LCID,FEATURE_FUSION,FEATURE_CRYPTO,FEATURE_X509_SECURESTRINGS,FEATURE_SYNCHRONIZATIONCONTEXT,FEATURE_SYNCHRONIZATIONCONTEXT_WAIT,HAS_CORLIB_CONTRACTS -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -resource:resources/charinfo.nlp -resource:resources/collation.core.bin -resource:resources/collation.tailoring.bin -resource:resources/collation.cjkCHS.bin -resource:resources/collation.cjkCHT.bin -resource:resources/collation.cjkJA.bin -resource:resources/collation.cjkKO.bin -resource:resources/collation.cjkKOlv2.bin --runtime:v4</flags>
+      <output>mscorlib.dll</output>
+      <built_sources>CommonCrypto/MD5CryptoServiceProvider.g.cs CommonCrypto/SHA256Managed.g.cs CommonCrypto/RC2CryptoServiceProvider.g.cs CommonCrypto/SHA384Managed.g.cs CommonCrypto/DESCryptoServiceProvider.g.cs CommonCrypto/SHA1CryptoServiceProvider.g.cs CommonCrypto/SHA512Managed.g.cs CommonCrypto/MD2Managed.g.cs CommonCrypto/SHA1Managed.g.cs CommonCrypto/TripleDESCryptoServiceProvider.g.cs CommonCrypto/MD4Managed.g.cs</built_sources>
+      <library_output>./../../class/lib/monotouch_runtime/mscorlib.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_runtime</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_runtime_corlib.dll.sources</response>
+    </project>
+    <project dir="class/corlib" library="corlib-tests-monotouch_runtime">
+      <boot>false</boot>
+      <flags>/codepage:65001 -unsafe -nostdlib -nowarn:612,618,1635 -d:INSIDE_CORLIB,MONO_CULTURE_DATA -d:LIBC -d:FEATURE_PAL,GENERICS_WORK,FEATURE_LIST_PREDICATES,FEATURE_SERIALIZATION,FEATURE_ASCII,FEATURE_LATIN1,FEATURE_UTF7,FEATURE_UTF32,MONO_HYBRID_ENCODING_SUPPORT,FEATURE_ASYNC_IO,NEW_EXPERIMENTAL_ASYNC_IO,FEATURE_UTF32,FEATURE_EXCEPTIONDISPATCHINFO,FEATURE_CORRUPTING_EXCEPTIONS,FEATURE_EXCEPTION_NOTIFICATIONS,FEATURE_STRONGNAME_MIGRATION,FEATURE_USE_LCID,FEATURE_FUSION,FEATURE_CRYPTO,FEATURE_X509_SECURESTRINGS,FEATURE_SYNCHRONIZATIONCONTEXT,FEATURE_SYNCHRONIZATIONCONTEXT_WAIT,HAS_CORLIB_CONTRACTS -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -debug -optimize -r:./../../class/lib/monotouch_runtime/mscorlib.dll -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -debug -nowarn:168,219,618,672 -unsafe -define:MONO_DATACONVERTER_STATIC_METHODS -resource:Test/resources/Resources.resources</flags>
+      <output>monotouch_runtime_corlib_test.dll</output>
+      <built_sources>CommonCrypto/MD5CryptoServiceProvider.g.cs CommonCrypto/SHA256Managed.g.cs CommonCrypto/RC2CryptoServiceProvider.g.cs CommonCrypto/SHA384Managed.g.cs CommonCrypto/DESCryptoServiceProvider.g.cs CommonCrypto/SHA1CryptoServiceProvider.g.cs CommonCrypto/SHA512Managed.g.cs CommonCrypto/MD2Managed.g.cs CommonCrypto/SHA1Managed.g.cs CommonCrypto/TripleDESCryptoServiceProvider.g.cs CommonCrypto/MD4Managed.g.cs</built_sources>
+      <library_output>monotouch_runtime_corlib_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_runtime</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_runtime_corlib_test.dll.response</response>
+    </project>
+    <project dir="class/Mono.Security" library="Mono.Security-monotouch_runtime">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_runtime/mscorlib.dll -debug -optimize /noconfig -unsafe -nowarn:1030,3009 -r:./../../class/lib/monotouch_runtime/bare/System.dll</flags>
+      <output>Mono.Security.dll</output>
+      <built_sources>../corlib/CommonCrypto/SHA224Managed.g.cs ../corlib/CommonCrypto/MD2Managed.g.cs ../corlib/CommonCrypto/MD4Managed.g.cs</built_sources>
+      <library_output>./../../class/lib/monotouch_runtime/Mono.Security.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_runtime</profile>
+      <resources></resources>
+      <response>Mono.Security.dll.sources</response>
+    </project>
+    <project dir="class/Mono.Security" library="Mono.Security-tests-monotouch_runtime">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_runtime/mscorlib.dll -debug -optimize -r:./../../class/lib/monotouch_runtime/Mono.Security.dll -unsafe -nowarn:1030,3009 -r:./../../class/lib/monotouch_runtime/bare/System.dll -nowarn:169,219,618,672</flags>
+      <output>monotouch_runtime_Mono.Security_test.dll</output>
+      <built_sources>../corlib/CommonCrypto/SHA224Managed.g.cs ../corlib/CommonCrypto/MD2Managed.g.cs ../corlib/CommonCrypto/MD4Managed.g.cs</built_sources>
+      <library_output>monotouch_runtime_Mono.Security_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_runtime</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_runtime_Mono.Security_test.dll.response</response>
+    </project>
+    <project dir="class/System" library="System-monotouch_runtime">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_runtime/mscorlib.dll -debug -optimize /noconfig -d:CONFIGURATION_2_0 -d:FEATURE_PAL,SYSTEM_NAMESPACE,MONO,PLATFORM_UNIX -d:MONO_FEATURE_PROCESS_START -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -unsafe -d:INSIDE_SYSTEM -d:SECURITY_DEP -nowarn:618,1635 -d:SECURITY_DEP -d:XML_DEP -r:./../../class/lib/monotouch_runtime/System.Xml.dll -r:MonoSecurity=./../../class/lib/monotouch_runtime/Mono.Security.dll</flags>
+      <output>System.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_runtime/System.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_runtime</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_runtime_System.dll.sources</response>
+    </project>
+    <project dir="class/System" library="System-tests-monotouch_runtime">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_runtime/mscorlib.dll -debug -optimize -r:./../../class/lib/monotouch_runtime/secxml/System.dll -nowarn:618,672,219,67,169,612 -resource:Test/System/test-uri-props.txt,test-uri-props.txt -resource:Test/System/test-uri-props-manual.txt,test-uri-props-manual.txt -resource:Test/System/test-uri-relative-props.txt,test-uri-relative-props.txt -d:MONO_FEATURE_PROCESS_START -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS</flags>
+      <output>monotouch_runtime_System_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_runtime_System_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_runtime</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_runtime_System_test.dll.response</response>
+    </project>
+    <project dir="class/System" library="System-bare-monotouch_runtime">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_runtime/mscorlib.dll -debug -optimize /noconfig -d:CONFIGURATION_2_0 -d:FEATURE_PAL,SYSTEM_NAMESPACE,MONO,PLATFORM_UNIX -d:MONO_FEATURE_PROCESS_START -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -unsafe -d:INSIDE_SYSTEM -d:SECURITY_DEP -nowarn:618,1635</flags>
+      <output>System.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_runtime/bare/System.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_runtime</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_runtime_System.dll.sources</response>
+    </project>
+    <project dir="class/System" library="System-tests-monotouch_runtime">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_runtime/mscorlib.dll -debug -optimize -r:./../../class/lib/monotouch_runtime/secxml/System.dll -nowarn:618,672,219,67,169,612 -resource:Test/System/test-uri-props.txt,test-uri-props.txt -resource:Test/System/test-uri-props-manual.txt,test-uri-props-manual.txt -resource:Test/System/test-uri-relative-props.txt,test-uri-relative-props.txt -d:MONO_FEATURE_PROCESS_START -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS</flags>
+      <output>monotouch_runtime_System_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_runtime_System_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_runtime</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_runtime_System_test.dll.response</response>
+    </project>
+    <project dir="class/System" library="System-secxml-monotouch_runtime">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_runtime/mscorlib.dll -debug -optimize /noconfig -d:CONFIGURATION_2_0 -d:FEATURE_PAL,SYSTEM_NAMESPACE,MONO,PLATFORM_UNIX -d:MONO_FEATURE_PROCESS_START -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -unsafe -d:INSIDE_SYSTEM -d:SECURITY_DEP -nowarn:618,1635 -d:SECURITY_DEP -d:XML_DEP -r:./../../class/lib/monotouch_runtime/bare/System.Xml.dll -r:MonoSecurity=./../../class/lib/monotouch_runtime/Mono.Security.dll</flags>
+      <output>System.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_runtime/secxml/System.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_runtime</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_runtime_System.dll.sources</response>
+    </project>
+    <project dir="class/System" library="System-tests-monotouch_runtime">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_runtime/mscorlib.dll -debug -optimize -r:./../../class/lib/monotouch_runtime/secxml/System.dll -nowarn:618,672,219,67,169,612 -resource:Test/System/test-uri-props.txt,test-uri-props.txt -resource:Test/System/test-uri-props-manual.txt,test-uri-props-manual.txt -resource:Test/System/test-uri-relative-props.txt,test-uri-relative-props.txt -d:MONO_FEATURE_PROCESS_START -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS</flags>
+      <output>monotouch_runtime_System_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_runtime_System_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_runtime</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_runtime_System_test.dll.response</response>
+    </project>
+    <project dir="class/System.Core" library="System.Core-monotouch_runtime">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_runtime/mscorlib.dll -debug -optimize /noconfig -d:FEATURE_PAL,PFX_LEGACY_3_5,FEATURE_NETCORE -d:INSIDE_SYSCORE -d:LIBC -unsafe -d:FEATURE_CORE_DLR -d:MONO_INTERPRETER -d:FULL_AOT_RUNTIME -r:./../../class/lib/monotouch_runtime/System.dll -r:./../../class/lib/monotouch_runtime/Mono.Dynamic.Interpreter.dll</flags>
+      <output>System.Core.dll</output>
+      <built_sources>../corlib/CommonCrypto/AesManaged.g.cs ../corlib/CommonCrypto/AesCryptoServiceProvider.g.cs</built_sources>
+      <library_output>./../../class/lib/monotouch_runtime/System.Core.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_runtime</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_runtime_System.Core.dll.sources</response>
+    </project>
+    <project dir="class/System.Core" library="System.Core-tests-monotouch_runtime">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_runtime/mscorlib.dll -debug -optimize -r:./../../class/lib/monotouch_runtime/plaincore/System.Core.dll -d:FEATURE_PAL,PFX_LEGACY_3_5,FEATURE_NETCORE -d:INSIDE_SYSCORE -d:LIBC -unsafe -d:FEATURE_CORE_DLR -d:FULL_AOT_RUNTIME -r:./../../class/lib/monotouch_runtime/System.dll</flags>
+      <output>monotouch_runtime_System.Core_test.dll</output>
+      <built_sources>../corlib/CommonCrypto/AesManaged.g.cs ../corlib/CommonCrypto/AesCryptoServiceProvider.g.cs</built_sources>
+      <library_output>monotouch_runtime_System.Core_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_runtime</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_runtime_System.Core_test.dll.response</response>
+    </project>
+    <project dir="class/System.Core" library="System.Core-plaincore-monotouch_runtime">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_runtime/mscorlib.dll -debug -optimize /noconfig -d:FEATURE_PAL,PFX_LEGACY_3_5,FEATURE_NETCORE -d:INSIDE_SYSCORE -d:LIBC -unsafe -d:FEATURE_CORE_DLR -d:FULL_AOT_RUNTIME -r:./../../class/lib/monotouch_runtime/System.dll</flags>
+      <output>System.Core.dll</output>
+      <built_sources>../corlib/CommonCrypto/AesManaged.g.cs ../corlib/CommonCrypto/AesCryptoServiceProvider.g.cs</built_sources>
+      <library_output>./../../class/lib/monotouch_runtime/plaincore/System.Core.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_runtime</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_runtime_System.Core.dll.sources</response>
+    </project>
+    <project dir="class/System.Core" library="System.Core-tests-monotouch_runtime">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_runtime/mscorlib.dll -debug -optimize -r:./../../class/lib/monotouch_runtime/plaincore/System.Core.dll -d:FEATURE_PAL,PFX_LEGACY_3_5,FEATURE_NETCORE -d:INSIDE_SYSCORE -d:LIBC -unsafe -d:FEATURE_CORE_DLR -d:FULL_AOT_RUNTIME -r:./../../class/lib/monotouch_runtime/System.dll</flags>
+      <output>monotouch_runtime_System.Core_test.dll</output>
+      <built_sources>../corlib/CommonCrypto/AesManaged.g.cs ../corlib/CommonCrypto/AesCryptoServiceProvider.g.cs</built_sources>
+      <library_output>monotouch_runtime_System.Core_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_runtime</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_runtime_System.Core_test.dll.response</response>
+    </project>
+    <project dir="class/System.XML" library="System.Xml-monotouch_runtime">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_runtime/mscorlib.dll -debug -optimize /noconfig -nowarn:219,414,649,1717 -unsafe -d:ASYNC -d:AGCLR -d:DISABLE_XSLT_COMPILER -d:DISABLE_XSLT_SCRIPT,MONO_HYBRID_SYSTEM_XML -d:DISABLE_CAS_USE -r:./../../class/lib/monotouch_runtime/secxml/System.dll</flags>
+      <output>System.Xml.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_runtime/System.Xml.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_runtime</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_runtime_System.Xml.dll.sources</response>
+    </project>
+    <project dir="class/System.XML" library="System.Xml-tests-monotouch_runtime">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_runtime/mscorlib.dll -debug -optimize -r:./../../class/lib/monotouch_runtime/bare/System.Xml.dll -nowarn:219,414,649,1717 -unsafe -d:ASYNC -d:AGCLR -d:DISABLE_XSLT_COMPILER -d:DISABLE_XSLT_SCRIPT,MONO_HYBRID_SYSTEM_XML -d:DISABLE_CAS_USE -r:./../../class/lib/monotouch_runtime/bare/System.dll -nowarn:0618 -nowarn:219 -nowarn:169</flags>
+      <output>monotouch_runtime_System.Xml_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_runtime_System.Xml_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_runtime</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_runtime_System.Xml_test.dll.response</response>
+    </project>
+    <project dir="class/System.XML" library="System.Xml-bare-monotouch_runtime">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_runtime/mscorlib.dll -debug -optimize /noconfig -nowarn:219,414,649,1717 -unsafe -d:ASYNC -d:AGCLR -d:DISABLE_XSLT_COMPILER -d:DISABLE_XSLT_SCRIPT,MONO_HYBRID_SYSTEM_XML -d:DISABLE_CAS_USE -r:./../../class/lib/monotouch_runtime/bare/System.dll</flags>
+      <output>System.Xml.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_runtime/bare/System.Xml.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_runtime</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_runtime_System.Xml.dll.sources</response>
+    </project>
+    <project dir="class/System.XML" library="System.Xml-tests-monotouch_runtime">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_runtime/mscorlib.dll -debug -optimize -r:./../../class/lib/monotouch_runtime/bare/System.Xml.dll -nowarn:219,414,649,1717 -unsafe -d:ASYNC -d:AGCLR -d:DISABLE_XSLT_COMPILER -d:DISABLE_XSLT_SCRIPT,MONO_HYBRID_SYSTEM_XML -d:DISABLE_CAS_USE -r:./../../class/lib/monotouch_runtime/bare/System.dll -nowarn:0618 -nowarn:219 -nowarn:169</flags>
+      <output>monotouch_runtime_System.Xml_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_runtime_System.Xml_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_runtime</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_runtime_System.Xml_test.dll.response</response>
+    </project>
+    <project dir="class/Mono.CSharp" library="Mono.CSharp-monotouch_runtime">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_runtime/mscorlib.dll -debug -optimize /noconfig -d:IOS_REFLECTION -d:MONO_FEATURE_THREAD_ABORT -r:./../../class/lib/monotouch_runtime/System.Core.dll -r:./../../class/lib/monotouch_runtime/System.Xml.dll -r:./../../class/lib/monotouch_runtime/System.dll</flags>
+      <output>Mono.CSharp.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_runtime/Mono.CSharp.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_runtime</profile>
+      <resources></resources>
+      <response>Mono.CSharp.dll.sources</response>
+    </project>
+    <project dir="class/Mono.CSharp" library="Mono.CSharp-tests-monotouch_runtime">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_runtime/mscorlib.dll -debug -optimize -r:./../../class/lib/monotouch_runtime/Mono.CSharp.dll</flags>
+      <output>monotouch_runtime_Mono.CSharp_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_runtime_Mono.CSharp_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_runtime</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_runtime_Mono.CSharp_test.dll.response</response>
+    </project>
+    <project dir="class/corlib" library="corlib-monotouch_watch">
+      <boot>true</boot>
+      <flags>/codepage:65001 -unsafe -nostdlib -nowarn:612,618,1635 -d:INSIDE_CORLIB,MONO_CULTURE_DATA -d:LIBC -d:FEATURE_PAL,GENERICS_WORK,FEATURE_LIST_PREDICATES,FEATURE_SERIALIZATION,FEATURE_ASCII,FEATURE_LATIN1,FEATURE_UTF7,FEATURE_UTF32,MONO_HYBRID_ENCODING_SUPPORT,FEATURE_ASYNC_IO,NEW_EXPERIMENTAL_ASYNC_IO,FEATURE_UTF32,FEATURE_EXCEPTIONDISPATCHINFO,FEATURE_CORRUPTING_EXCEPTIONS,FEATURE_EXCEPTION_NOTIFICATIONS,FEATURE_STRONGNAME_MIGRATION,FEATURE_USE_LCID,FEATURE_FUSION,FEATURE_CRYPTO,FEATURE_X509_SECURESTRINGS,FEATURE_SYNCHRONIZATIONCONTEXT,FEATURE_SYNCHRONIZATIONCONTEXT_WAIT,HAS_CORLIB_CONTRACTS -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig -d:FEATURE_PAL,GENERICS_WORK,FEATURE_LIST_PREDICATES,FEATURE_SERIALIZATION,FEATURE_ASCII,FEATURE_LATIN1,FEATURE_UTF7,FEATURE_UTF32,MONO_HYBRID_ENCODING_SUPPORT,FEATURE_ASYNC_IO,NEW_EXPERIMENTAL_ASYNC_IO,FEATURE_UTF32,FEATURE_EXCEPTIONDISPATCHINFO,FEATURE_CORRUPTING_EXCEPTIONS,FEATURE_EXCEPTION_NOTIFICATIONS,FEATURE_STRONGNAME_MIGRATION,FEATURE_USE_LCID,FEATURE_FUSION,FEATURE_CRYPTO,FEATURE_X509_SECURESTRINGS,FEATURE_SYNCHRONIZATIONCONTEXT,FEATURE_SYNCHRONIZATIONCONTEXT_WAIT,HAS_CORLIB_CONTRACTS -resource:resources/charinfo.nlp -resource:resources/collation.core.bin -resource:resources/collation.tailoring.bin -resource:resources/collation.cjkCHS.bin -resource:resources/collation.cjkCHT.bin -resource:resources/collation.cjkJA.bin -resource:resources/collation.cjkKO.bin -resource:resources/collation.cjkKOlv2.bin --runtime:v4</flags>
+      <output>mscorlib.dll</output>
+      <built_sources>CommonCrypto/MD5CryptoServiceProvider.g.cs CommonCrypto/SHA256Managed.g.cs CommonCrypto/RC2CryptoServiceProvider.g.cs CommonCrypto/SHA384Managed.g.cs CommonCrypto/DESCryptoServiceProvider.g.cs CommonCrypto/SHA1CryptoServiceProvider.g.cs CommonCrypto/SHA512Managed.g.cs CommonCrypto/MD2Managed.g.cs CommonCrypto/SHA1Managed.g.cs CommonCrypto/TripleDESCryptoServiceProvider.g.cs CommonCrypto/MD4Managed.g.cs</built_sources>
+      <library_output>./../../class/lib/monotouch_watch/mscorlib.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_watch_corlib.dll.sources</response>
+    </project>
+    <project dir="class/corlib" library="corlib-tests-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -unsafe -nostdlib -nowarn:612,618,1635 -d:INSIDE_CORLIB,MONO_CULTURE_DATA -d:LIBC -d:FEATURE_PAL,GENERICS_WORK,FEATURE_LIST_PREDICATES,FEATURE_SERIALIZATION,FEATURE_ASCII,FEATURE_LATIN1,FEATURE_UTF7,FEATURE_UTF32,MONO_HYBRID_ENCODING_SUPPORT,FEATURE_ASYNC_IO,NEW_EXPERIMENTAL_ASYNC_IO,FEATURE_UTF32,FEATURE_EXCEPTIONDISPATCHINFO,FEATURE_CORRUPTING_EXCEPTIONS,FEATURE_EXCEPTION_NOTIFICATIONS,FEATURE_STRONGNAME_MIGRATION,FEATURE_USE_LCID,FEATURE_FUSION,FEATURE_CRYPTO,FEATURE_X509_SECURESTRINGS,FEATURE_SYNCHRONIZATIONCONTEXT,FEATURE_SYNCHRONIZATIONCONTEXT_WAIT,HAS_CORLIB_CONTRACTS -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize -r:./../../class/lib/monotouch_watch/mscorlib.dll -debug -nowarn:168,219,618,672 -unsafe -define:MONO_DATACONVERTER_STATIC_METHODS -resource:Test/resources/Resources.resources</flags>
+      <output>monotouch_watch_corlib_test.dll</output>
+      <built_sources>CommonCrypto/MD5CryptoServiceProvider.g.cs CommonCrypto/SHA256Managed.g.cs CommonCrypto/RC2CryptoServiceProvider.g.cs CommonCrypto/SHA384Managed.g.cs CommonCrypto/DESCryptoServiceProvider.g.cs CommonCrypto/SHA1CryptoServiceProvider.g.cs CommonCrypto/SHA512Managed.g.cs CommonCrypto/MD2Managed.g.cs CommonCrypto/SHA1Managed.g.cs CommonCrypto/TripleDESCryptoServiceProvider.g.cs CommonCrypto/MD4Managed.g.cs</built_sources>
+      <library_output>monotouch_watch_corlib_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_watch_corlib_test.dll.response</response>
+    </project>
+    <project dir="class/System" library="System-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig -d:CONFIGURATION_2_0 -d:FEATURE_PAL,SYSTEM_NAMESPACE,MONO,PLATFORM_UNIX -unsafe -d:INSIDE_SYSTEM -d:SECURITY_DEP -nowarn:618,1635 -d:SECURITY_DEP -d:XML_DEP -r:./../../class/lib/monotouch_watch/System.Xml.dll</flags>
+      <output>System.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_watch/System.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_watch_System.dll.sources</response>
+    </project>
+    <project dir="class/System" library="System-tests-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize -r:./../../class/lib/monotouch_watch/secxml/System.dll -nowarn:618,672,219,67,169,612 -resource:Test/System/test-uri-props.txt,test-uri-props.txt -resource:Test/System/test-uri-props-manual.txt,test-uri-props-manual.txt -resource:Test/System/test-uri-relative-props.txt,test-uri-relative-props.txt</flags>
+      <output>monotouch_watch_System_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_watch_System_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_watch_System_test.dll.response</response>
+    </project>
+    <project dir="class/System" library="System-bare-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig -d:CONFIGURATION_2_0 -d:FEATURE_PAL,SYSTEM_NAMESPACE,MONO,PLATFORM_UNIX -unsafe -d:INSIDE_SYSTEM -d:SECURITY_DEP -nowarn:618,1635</flags>
+      <output>System.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_watch/bare/System.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_watch_System.dll.sources</response>
+    </project>
+    <project dir="class/System" library="System-tests-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize -r:./../../class/lib/monotouch_watch/secxml/System.dll -nowarn:618,672,219,67,169,612 -resource:Test/System/test-uri-props.txt,test-uri-props.txt -resource:Test/System/test-uri-props-manual.txt,test-uri-props-manual.txt -resource:Test/System/test-uri-relative-props.txt,test-uri-relative-props.txt</flags>
+      <output>monotouch_watch_System_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_watch_System_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_watch_System_test.dll.response</response>
+    </project>
+    <project dir="class/System" library="System-secxml-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig -d:CONFIGURATION_2_0 -d:FEATURE_PAL,SYSTEM_NAMESPACE,MONO,PLATFORM_UNIX -unsafe -d:INSIDE_SYSTEM -d:SECURITY_DEP -nowarn:618,1635 -d:SECURITY_DEP -d:XML_DEP -r:./../../class/lib/monotouch_watch/bare/System.Xml.dll</flags>
+      <output>System.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_watch/secxml/System.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_watch_System.dll.sources</response>
+    </project>
+    <project dir="class/System" library="System-tests-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize -r:./../../class/lib/monotouch_watch/secxml/System.dll -nowarn:618,672,219,67,169,612 -resource:Test/System/test-uri-props.txt,test-uri-props.txt -resource:Test/System/test-uri-props-manual.txt,test-uri-props-manual.txt -resource:Test/System/test-uri-relative-props.txt,test-uri-relative-props.txt</flags>
+      <output>monotouch_watch_System_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_watch_System_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_watch_System_test.dll.response</response>
+    </project>
+    <project dir="class/System.Core" library="System.Core-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig -d:FEATURE_PAL,PFX_LEGACY_3_5,FEATURE_NETCORE -d:INSIDE_SYSCORE -d:LIBC -unsafe -d:FEATURE_CORE_DLR -d:MONO_INTERPRETER -r:./../../class/lib/monotouch_watch/System.dll -r:./../../class/lib/monotouch_watch/Mono.Dynamic.Interpreter.dll</flags>
+      <output>System.Core.dll</output>
+      <built_sources>../corlib/CommonCrypto/AesManaged.g.cs ../corlib/CommonCrypto/AesCryptoServiceProvider.g.cs</built_sources>
+      <library_output>./../../class/lib/monotouch_watch/System.Core.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_watch_System.Core.dll.sources</response>
+    </project>
+    <project dir="class/System.Core" library="System.Core-tests-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize -r:./../../class/lib/monotouch_watch/plaincore/System.Core.dll -d:FEATURE_PAL,PFX_LEGACY_3_5,FEATURE_NETCORE -d:INSIDE_SYSCORE -d:LIBC -unsafe -d:FEATURE_CORE_DLR -r:./../../class/lib/monotouch_watch/System.dll</flags>
+      <output>monotouch_watch_System.Core_test.dll</output>
+      <built_sources>../corlib/CommonCrypto/AesManaged.g.cs ../corlib/CommonCrypto/AesCryptoServiceProvider.g.cs</built_sources>
+      <library_output>monotouch_watch_System.Core_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_watch_System.Core_test.dll.response</response>
+    </project>
+    <project dir="class/System.Core" library="System.Core-plaincore-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig -d:FEATURE_PAL,PFX_LEGACY_3_5,FEATURE_NETCORE -d:INSIDE_SYSCORE -d:LIBC -unsafe -d:FEATURE_CORE_DLR -r:./../../class/lib/monotouch_watch/System.dll</flags>
+      <output>System.Core.dll</output>
+      <built_sources>../corlib/CommonCrypto/AesManaged.g.cs ../corlib/CommonCrypto/AesCryptoServiceProvider.g.cs</built_sources>
+      <library_output>./../../class/lib/monotouch_watch/plaincore/System.Core.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_watch_System.Core.dll.sources</response>
+    </project>
+    <project dir="class/System.Core" library="System.Core-tests-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize -r:./../../class/lib/monotouch_watch/plaincore/System.Core.dll -d:FEATURE_PAL,PFX_LEGACY_3_5,FEATURE_NETCORE -d:INSIDE_SYSCORE -d:LIBC -unsafe -d:FEATURE_CORE_DLR -r:./../../class/lib/monotouch_watch/System.dll</flags>
+      <output>monotouch_watch_System.Core_test.dll</output>
+      <built_sources>../corlib/CommonCrypto/AesManaged.g.cs ../corlib/CommonCrypto/AesCryptoServiceProvider.g.cs</built_sources>
+      <library_output>monotouch_watch_System.Core_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_watch_System.Core_test.dll.response</response>
+    </project>
+    <project dir="class/System.Security" library="System.Security-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig -nowarn:618 -d:SECURITY_DEP -nowarn:414 -r:./../../class/lib/monotouch_watch/secxml/System.dll -r:./../../class/lib/monotouch_watch/bare/System.Xml.dll</flags>
+      <output>System.Security.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_watch/System.Security.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_watch_System.Security.dll.sources</response>
+    </project>
+    <project dir="class/System.Security" library="System.Security-tests-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize -r:./../../class/lib/monotouch_watch/System.Security.dll -nowarn:618 -d:SECURITY_DEP -nowarn:414 -r:./../../class/lib/monotouch_watch/secxml/System.dll -r:./../../class/lib/monotouch_watch/bare/System.Xml.dll -nowarn:168,169,183,219,414</flags>
+      <output>monotouch_watch_System.Security_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_watch_System.Security_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_watch_System.Security_test.dll.response</response>
+    </project>
+    <project dir="class/System.XML" library="System.Xml-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig -nowarn:219,414,649,1717 -unsafe -d:ASYNC -d:AGCLR -d:DISABLE_XSLT_COMPILER -d:DISABLE_XSLT_SCRIPT,MONO_HYBRID_SYSTEM_XML -d:DISABLE_CAS_USE -r:./../../class/lib/monotouch_watch/secxml/System.dll</flags>
+      <output>System.Xml.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_watch/System.Xml.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_watch_System.Xml.dll.sources</response>
+    </project>
+    <project dir="class/System.XML" library="System.Xml-tests-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize -r:./../../class/lib/monotouch_watch/bare/System.Xml.dll -nowarn:219,414,649,1717 -unsafe -d:ASYNC -d:AGCLR -d:DISABLE_XSLT_COMPILER -d:DISABLE_XSLT_SCRIPT,MONO_HYBRID_SYSTEM_XML -d:DISABLE_CAS_USE -r:./../../class/lib/monotouch_watch/bare/System.dll -nowarn:0618 -nowarn:219 -nowarn:169</flags>
+      <output>monotouch_watch_System.Xml_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_watch_System.Xml_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_watch_System.Xml_test.dll.response</response>
+    </project>
+    <project dir="class/System.XML" library="System.Xml-bare-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig -nowarn:219,414,649,1717 -unsafe -d:ASYNC -d:AGCLR -d:DISABLE_XSLT_COMPILER -d:DISABLE_XSLT_SCRIPT,MONO_HYBRID_SYSTEM_XML -d:DISABLE_CAS_USE -r:./../../class/lib/monotouch_watch/bare/System.dll</flags>
+      <output>System.Xml.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_watch/bare/System.Xml.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_watch_System.Xml.dll.sources</response>
+    </project>
+    <project dir="class/System.XML" library="System.Xml-tests-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize -r:./../../class/lib/monotouch_watch/bare/System.Xml.dll -nowarn:219,414,649,1717 -unsafe -d:ASYNC -d:AGCLR -d:DISABLE_XSLT_COMPILER -d:DISABLE_XSLT_SCRIPT,MONO_HYBRID_SYSTEM_XML -d:DISABLE_CAS_USE -r:./../../class/lib/monotouch_watch/bare/System.dll -nowarn:0618 -nowarn:219 -nowarn:169</flags>
+      <output>monotouch_watch_System.Xml_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_watch_System.Xml_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_watch_System.Xml_test.dll.response</response>
+    </project>
+    <project dir="class/I18N/Common" library="I18N-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 /unsafe /define:DISABLE_UNSAFE -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig</flags>
+      <output>I18N.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/I18N.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>I18N.dll.sources</response>
+    </project>
+    <project dir="class/I18N/West" library="I18N.West-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 /unsafe -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig -r:./../../../class/lib/monotouch_watch/I18N.dll</flags>
+      <output>I18N.West.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/I18N.West.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>I18N.West.dll.sources</response>
+    </project>
+    <project dir="class/I18N/West" library="I18N.West-tests-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 /unsafe -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize -r:./../../../class/lib/monotouch_watch/I18N.West.dll</flags>
+      <output>monotouch_watch_I18N.West_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_watch_I18N.West_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>./../../../build/deps/monotouch_watch_I18N.West_test.dll.response</response>
+    </project>
+    <project dir="class/I18N/MidEast" library="I18N.MidEast-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 /unsafe -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig -r:./../../../class/lib/monotouch_watch/I18N.dll</flags>
+      <output>I18N.MidEast.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/I18N.MidEast.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>I18N.MidEast.dll.sources</response>
+    </project>
+    <project dir="class/I18N/MidEast" library="I18N.MidEast-tests-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 /unsafe -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize -r:./../../../class/lib/monotouch_watch/I18N.MidEast.dll</flags>
+      <output>monotouch_watch_I18N.MidEast_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_watch_I18N.MidEast_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>./../../../build/deps/monotouch_watch_I18N.MidEast_test.dll.response</response>
+    </project>
+    <project dir="class/I18N/Other" library="I18N.Other-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 /unsafe -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig -r:./../../../class/lib/monotouch_watch/I18N.dll</flags>
+      <output>I18N.Other.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/I18N.Other.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>I18N.Other.dll.sources</response>
+    </project>
+    <project dir="class/I18N/Rare" library="I18N.Rare-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 /unsafe -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig -r:./../../../class/lib/monotouch_watch/I18N.dll</flags>
+      <output>I18N.Rare.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/I18N.Rare.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>I18N.Rare.dll.sources</response>
+    </project>
+    <project dir="class/I18N/CJK" library="I18N.CJK-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 /unsafe /resource:big5.table /resource:gb2312.table /resource:jis.table /resource:ks.table /resource:gb18030.table /define:DISABLE_UNSAFE -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig -r:./../../../class/lib/monotouch_watch/I18N.dll</flags>
+      <output>I18N.CJK.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/I18N.CJK.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>I18N.CJK.dll.sources</response>
+    </project>
+    <project dir="class/I18N/CJK" library="I18N.CJK-tests-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 /unsafe /resource:big5.table /resource:gb2312.table /resource:jis.table /resource:ks.table /resource:gb18030.table /define:DISABLE_UNSAFE -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize -r:./../../../class/lib/monotouch_watch/I18N.CJK.dll</flags>
+      <output>monotouch_watch_I18N.CJK_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_watch_I18N.CJK_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>./../../../build/deps/monotouch_watch_I18N.CJK_test.dll.response</response>
+    </project>
+    <project dir="class/System.ServiceModel.Internals" library="System.ServiceModel.Internals-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /unsafe -r:./../../class/lib/monotouch_watch/System.dll -r:./../../class/lib/monotouch_watch/System.Core.dll -r:./../../class/lib/monotouch_watch/System.Xml.dll</flags>
+      <output>System.ServiceModel.Internals.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_watch/System.ServiceModel.Internals.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_watch_System.ServiceModel.Internals.dll.sources</response>
+    </project>
+    <project dir="class/System.Runtime.Serialization" library="System.Runtime.Serialization-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig -unsafe -d:NO_DYNAMIC_CODEGEN /nowarn:168,169,219,414 /d:NO_CONFIGURATION /d:NO_SECURITY_ATTRIBUTES /d:NO_CODEDOM /d:NO_DESKTOP_SECURITY -r:./../../class/lib/monotouch_watch/System.dll -r:./../../class/lib/monotouch_watch/System.Xml.dll -r:./../../class/lib/monotouch_watch/System.Core.dll -r:./../../class/lib/monotouch_watch/System.ServiceModel.Internals.dll</flags>
+      <output>System.Runtime.Serialization.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_watch/System.Runtime.Serialization.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_watch_System.Runtime.Serialization.dll.sources</response>
+    </project>
+    <project dir="class/System.Runtime.Serialization" library="System.Runtime.Serialization-tests-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize -r:./../../class/lib/monotouch_watch/System.Runtime.Serialization.dll -unsafe -d:NO_DYNAMIC_CODEGEN /nowarn:168,169,219,414 /d:NO_CONFIGURATION /d:NO_SECURITY_ATTRIBUTES /d:NO_CODEDOM /d:NO_DESKTOP_SECURITY -r:./../../class/lib/monotouch_watch/System.dll -r:./../../class/lib/monotouch_watch/System.Xml.dll -r:./../../class/lib/monotouch_watch/System.Core.dll -r:./../../class/lib/monotouch_watch/System.ServiceModel.Internals.dll /resource:Test/Resources/WSDL/collections.wsdl /resource:Test/Resources/WSDL/custom-collections.wsdl</flags>
+      <output>monotouch_watch_System.Runtime.Serialization_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_watch_System.Runtime.Serialization_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_watch_System.Runtime.Serialization_test.dll.response</response>
+    </project>
+    <project dir="class/System.Xml.Linq" library="System.Xml.Linq-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig -d:FEATURE_SERIALIZATION -d:MONO_HYBRID_SYSTEM_XML -r:./../../class/lib/monotouch_watch/System.dll -r:./../../class/lib/monotouch_watch/System.Core.dll -r:./../../class/lib/monotouch_watch/System.Xml.dll -r:./../../class/lib/monotouch_watch/System.Runtime.Serialization.dll</flags>
+      <output>System.Xml.Linq.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_watch/System.Xml.Linq.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Xml.Linq.dll.sources</response>
+    </project>
+    <project dir="class/System.Xml.Linq" library="System.Xml.Linq-tests-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize -r:./../../class/lib/monotouch_watch/System.Xml.Linq.dll -d:FEATURE_SERIALIZATION -d:MONO_HYBRID_SYSTEM_XML -r:./../../class/lib/monotouch_watch/System.dll -r:./../../class/lib/monotouch_watch/System.Core.dll -r:./../../class/lib/monotouch_watch/System.Xml.dll -r:./../../class/lib/monotouch_watch/System.Runtime.Serialization.dll</flags>
+      <output>monotouch_watch_System.Xml.Linq_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_watch_System.Xml.Linq_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_watch_System.Xml.Linq_test.dll.response</response>
+    </project>
+    <project dir="class/System.IdentityModel" library="System.IdentityModel-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /d:NET_3_0 -r:./../../class/lib/monotouch_watch/System.dll -r:./../../class/lib/monotouch_watch/System.Xml.dll -r:./../../class/lib/monotouch_watch/System.Security.dll -r:./../../class/lib/monotouch_watch/System.Runtime.Serialization.dll</flags>
+      <output>System.IdentityModel.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_watch/System.IdentityModel.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_watch_System.IdentityModel.dll.sources</response>
+    </project>
+    <project dir="class/System.IdentityModel" library="System.IdentityModel-tests-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize -r:./../../class/lib/monotouch_watch/System.IdentityModel.dll /d:NET_3_0 -r:./../../class/lib/monotouch_watch/System.dll -r:./../../class/lib/monotouch_watch/System.Xml.dll -r:./../../class/lib/monotouch_watch/System.Security.dll -r:./../../class/lib/monotouch_watch/System.Runtime.Serialization.dll</flags>
+      <output>monotouch_watch_System.IdentityModel_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_watch_System.IdentityModel_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_watch_System.IdentityModel_test.dll.response</response>
+    </project>
+    <project dir="class/System.ServiceModel" library="System.ServiceModel-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /nowarn:414,169,67,3005,436,219,618 /unsafe /d:TRACE /resource:resources/WS-Addressing.schema /resource:resources/ws-addr.xsd -r:./../../class/lib/monotouch_watch/System.dll -r:./../../class/lib/monotouch_watch/System.Xml.dll -r:./../../class/lib/monotouch_watch/System.Core.dll -r:./../../class/lib/monotouch_watch/System.Runtime.Serialization.dll -r:./../../class/lib/monotouch_watch/System.IdentityModel.dll</flags>
+      <output>System.ServiceModel.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_watch/System.ServiceModel.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_watch_System.ServiceModel.dll.sources</response>
+    </project>
+    <project dir="class/System.ServiceModel" library="System.ServiceModel-tests-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize -r:./../../class/lib/monotouch_watch/plainservice/System.ServiceModel.dll /nowarn:414,169,67,3005,436,219,618 /unsafe /d:TRACE /resource:resources/WS-Addressing.schema /resource:resources/ws-addr.xsd -r:./../../class/lib/monotouch_watch/System.dll -r:./../../class/lib/monotouch_watch/System.Xml.dll -r:./../../class/lib/monotouch_watch/System.Core.dll -r:./../../class/lib/monotouch_watch/System.Runtime.Serialization.dll -r:./../../class/lib/monotouch_watch/System.IdentityModel.dll</flags>
+      <output>monotouch_watch_System.ServiceModel_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_watch_System.ServiceModel_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_watch_System.ServiceModel_test.dll.response</response>
+    </project>
+    <project dir="class/System.ServiceModel" library="System.ServiceModel-plainservice-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /nowarn:414,169,67,3005,436,219,618 /unsafe /d:TRACE /resource:resources/WS-Addressing.schema /resource:resources/ws-addr.xsd -r:./../../class/lib/monotouch_watch/System.dll -r:./../../class/lib/monotouch_watch/System.Xml.dll -r:./../../class/lib/monotouch_watch/System.Core.dll -r:./../../class/lib/monotouch_watch/System.Runtime.Serialization.dll -r:./../../class/lib/monotouch_watch/System.IdentityModel.dll</flags>
+      <output>System.ServiceModel.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_watch/plainservice/System.ServiceModel.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_watch_System.ServiceModel.dll.sources</response>
+    </project>
+    <project dir="class/System.ServiceModel" library="System.ServiceModel-tests-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize -r:./../../class/lib/monotouch_watch/plainservice/System.ServiceModel.dll /nowarn:414,169,67,3005,436,219,618 /unsafe /d:TRACE /resource:resources/WS-Addressing.schema /resource:resources/ws-addr.xsd -r:./../../class/lib/monotouch_watch/System.dll -r:./../../class/lib/monotouch_watch/System.Xml.dll -r:./../../class/lib/monotouch_watch/System.Core.dll -r:./../../class/lib/monotouch_watch/System.Runtime.Serialization.dll -r:./../../class/lib/monotouch_watch/System.IdentityModel.dll</flags>
+      <output>monotouch_watch_System.ServiceModel_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_watch_System.ServiceModel_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_watch_System.ServiceModel_test.dll.response</response>
+    </project>
+    <project dir="class/System.ServiceModel.Web" library="System.ServiceModel.Web-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig -r:./../../class/lib/monotouch_watch/System.dll -r:./../../class/lib/monotouch_watch/System.Xml.dll -r:./../../class/lib/monotouch_watch/System.Runtime.Serialization.dll -r:./../../class/lib/monotouch_watch/System.ServiceModel.dll -r:./../../class/lib/monotouch_watch/System.Core.dll</flags>
+      <output>System.ServiceModel.Web.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_watch/System.ServiceModel.Web.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_watch_System.ServiceModel.Web.dll.sources</response>
+    </project>
+    <project dir="class/System.ServiceModel.Web" library="System.ServiceModel.Web-tests-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize -r:./../../class/lib/monotouch_watch/System.ServiceModel.Web.dll -r:./../../class/lib/monotouch_watch/System.dll -r:./../../class/lib/monotouch_watch/System.Xml.dll -r:./../../class/lib/monotouch_watch/System.Runtime.Serialization.dll -r:./../../class/lib/monotouch_watch/System.ServiceModel.dll -r:./../../class/lib/monotouch_watch/System.Core.dll</flags>
+      <output>monotouch_watch_System.ServiceModel.Web_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_watch_System.ServiceModel.Web_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_watch_System.ServiceModel.Web_test.dll.response</response>
+    </project>
+    <project dir="class/System.Json" library="System.Json-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig -r:./../../class/lib/monotouch_watch/System.dll -r:./../../class/lib/monotouch_watch/System.Xml.dll -r:./../../class/lib/monotouch_watch/System.Core.dll</flags>
+      <output>System.Json.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_watch/System.Json.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Json.dll.sources</response>
+    </project>
+    <project dir="class/System.Json" library="System.Json-tests-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize -r:./../../class/lib/monotouch_watch/System.Json.dll -r:./../../class/lib/monotouch_watch/System.dll -r:./../../class/lib/monotouch_watch/System.Xml.dll -r:./../../class/lib/monotouch_watch/System.Core.dll</flags>
+      <output>monotouch_watch_System.Json_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_watch_System.Json_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_watch_System.Json_test.dll.response</response>
+    </project>
+    <project dir="class/System.Web.Services" library="System.Web.Services-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig -nowarn:649 -nowarn:169 -resource:System.Web.Services.Description/wsdl-1.1.xsd,wsdl-1.1.xsd -resource:System.Web.Services.Description/wsdl-1.1-soap.xsd,wsdl-1.1-soap.xsd -resource:System.Web.Services.Description/web-reference.xsd,web-reference.xsd -r:./../../class/lib/monotouch_watch/System.dll -r:./../../class/lib/monotouch_watch/System.Xml.dll</flags>
+      <output>System.Web.Services.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_watch/System.Web.Services.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_watch_System.Web.Services.dll.sources</response>
+    </project>
+    <project dir="class/System.Web.Services" library="System.Web.Services-tests-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize -r:./../../class/lib/monotouch_watch/System.Web.Services.dll -nowarn:649 -nowarn:169 -resource:System.Web.Services.Description/wsdl-1.1.xsd,wsdl-1.1.xsd -resource:System.Web.Services.Description/wsdl-1.1-soap.xsd,wsdl-1.1-soap.xsd -resource:System.Web.Services.Description/web-reference.xsd,web-reference.xsd -r:./../../class/lib/monotouch_watch/System.dll -r:./../../class/lib/monotouch_watch/System.Xml.dll -nowarn:618</flags>
+      <output>monotouch_watch_System.Web.Services_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_watch_System.Web.Services_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_watch_System.Web.Services_test.dll.response</response>
+    </project>
+    <project dir="class/System.Transactions" library="System.Transactions-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /define:MOBILE -r:./../../class/lib/monotouch_watch/System.dll</flags>
+      <output>System.Transactions.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_watch/System.Transactions.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Transactions.dll.sources</response>
+    </project>
+    <project dir="class/System.Transactions" library="System.Transactions-tests-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize -r:./../../class/lib/monotouch_watch/System.Transactions.dll /define:MOBILE -r:./../../class/lib/monotouch_watch/System.dll</flags>
+      <output>monotouch_watch_System.Transactions_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_watch_System.Transactions_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_watch_System.Transactions_test.dll.response</response>
+    </project>
+    <project dir="class/System.Numerics" library="System.Numerics-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /unsafe -nowarn:414 -r:./../../class/lib/monotouch_watch/System.dll</flags>
+      <output>System.Numerics.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_watch/System.Numerics.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Numerics.dll.sources</response>
+    </project>
+    <project dir="class/System.Numerics" library="System.Numerics-tests-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize -r:./../../class/lib/monotouch_watch/System.Numerics.dll /unsafe -nowarn:414 -r:./../../class/lib/monotouch_watch/System.dll</flags>
+      <output>monotouch_watch_System.Numerics_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_watch_System.Numerics_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_watch_System.Numerics_test.dll.response</response>
+    </project>
+    <project dir="class/System.Numerics.Vectors" library="System.Numerics.Vectors-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig -unsafe -r:./../../class/lib/monotouch_watch/System.dll -r:./../../class/lib/monotouch_watch/System.Numerics.dll</flags>
+      <output>System.Numerics.Vectors.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_watch/System.Numerics.Vectors.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Numerics.Vectors.dll.sources</response>
+    </project>
+    <project dir="class/System.Data" library="System.Data-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig -nowarn:219,414,649 -d:PLATFORM_UNIX -d:USEOFFSET -d:MONO_PARTIAL_DATA_IMPORT -unsafe -d:NO_CODEDOM -d:NO_OLEDB -d:NO_ODBC -d:NO_CONFIGURATION -r:./../../class/lib/monotouch_watch/System.dll -r:./../../class/lib/monotouch_watch/System.Xml.dll -r:./../../class/lib/monotouch_watch/System.Core.dll -r:./../../class/lib/monotouch_watch/System.Numerics.dll -r:./../../class/lib/monotouch_watch/System.Transactions.dll</flags>
+      <output>System.Data.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_watch/System.Data.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_watch_System.Data.dll.sources</response>
+    </project>
+    <project dir="class/System.Data" library="System.Data-tests-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize -r:./../../class/lib/monotouch_watch/System.Data.dll -nowarn:219,414,649 -d:PLATFORM_UNIX -d:USEOFFSET -d:MONO_PARTIAL_DATA_IMPORT -unsafe -d:NO_CODEDOM -d:NO_OLEDB -d:NO_ODBC -d:NO_CONFIGURATION -r:./../../class/lib/monotouch_watch/System.dll -r:./../../class/lib/monotouch_watch/System.Xml.dll -r:./../../class/lib/monotouch_watch/System.Core.dll -r:./../../class/lib/monotouch_watch/System.Numerics.dll -r:./../../class/lib/monotouch_watch/System.Transactions.dll -nowarn:618,169,612,219,168</flags>
+      <output>monotouch_watch_System.Data_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_watch_System.Data_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_watch_System.Data_test.dll.response</response>
+    </project>
+    <project dir="class/Mono.Data.Sqlite" library="Mono.Data.Sqlite-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /unsafe -resource:resources/SR.resources -resource:resources/SQLiteCommand.bmp -resource:resources/SQLiteConnection.bmp -resource:resources/SQLiteDataAdapter.bmp -d:SQLITE_STANDARD -r:./../../class/lib/monotouch_watch/System.dll -r:./../../class/lib/monotouch_watch/System.Data.dll -r:./../../class/lib/monotouch_watch/System.Transactions.dll -r:./../../class/lib/monotouch_watch/System.Xml.dll</flags>
+      <output>Mono.Data.Sqlite.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_watch/Mono.Data.Sqlite.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>Mono.Data.Sqlite.dll.sources</response>
+    </project>
+    <project dir="class/Mono.Data.Sqlite" library="Mono.Data.Sqlite-tests-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize -r:./../../class/lib/monotouch_watch/Mono.Data.Sqlite.dll /unsafe -resource:resources/SR.resources -resource:resources/SQLiteCommand.bmp -resource:resources/SQLiteConnection.bmp -resource:resources/SQLiteDataAdapter.bmp -d:SQLITE_STANDARD -r:./../../class/lib/monotouch_watch/System.dll -r:./../../class/lib/monotouch_watch/System.Data.dll -r:./../../class/lib/monotouch_watch/System.Transactions.dll -r:./../../class/lib/monotouch_watch/System.Xml.dll /nowarn:618</flags>
+      <output>monotouch_watch_Mono.Data.Sqlite_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_watch_Mono.Data.Sqlite_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_watch_Mono.Data.Sqlite_test.dll.response</response>
+    </project>
+    <project dir="class/System.Data.Services.Client" library="System.Data.Services.Client-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig -d:NET_3_5 -warn:2 -r:./../../class/lib/monotouch_watch/System.dll -r:./../../class/lib/monotouch_watch/System.Core.dll -r:./../../class/lib/monotouch_watch/System.Xml.Linq.dll -r:./../../class/lib/monotouch_watch/System.Data.dll -r:./../../class/lib/monotouch_watch/System.Xml.dll</flags>
+      <output>System.Data.Services.Client.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_watch/System.Data.Services.Client.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources>System.Data.Services.Client,Client/System.Data.Services.Client.txt</resources>
+      <response>System.Data.Services.Client.dll.sources</response>
+    </project>
+    <project dir="class/System.IO.Compression" library="System.IO.Compression-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /unsafe -r:./../../class/lib/monotouch_watch/System.dll -r:./../../class/lib/monotouch_watch/System.Core.dll</flags>
+      <output>System.IO.Compression.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_watch/System.IO.Compression.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.IO.Compression.dll.sources</response>
+    </project>
+    <project dir="class/System.IO.Compression" library="System.IO.Compression-tests-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize -r:./../../class/lib/monotouch_watch/System.IO.Compression.dll</flags>
+      <output>monotouch_watch_System.IO.Compression_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_watch_System.IO.Compression_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_watch_System.IO.Compression_test.dll.response</response>
+    </project>
+    <project dir="class/System.IO.Compression.FileSystem" library="System.IO.Compression.FileSystem-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig -r:./../../class/lib/monotouch_watch/System.dll -r:./../../class/lib/monotouch_watch/System.IO.Compression.dll</flags>
+      <output>System.IO.Compression.FileSystem.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_watch/System.IO.Compression.FileSystem.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.IO.Compression.FileSystem.dll.sources</response>
+    </project>
+    <project dir="class/System.IO.Compression.FileSystem" library="System.IO.Compression.FileSystem-tests-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize -r:./../../class/lib/monotouch_watch/System.IO.Compression.FileSystem.dll</flags>
+      <output>monotouch_watch_System.IO.Compression.FileSystem_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_watch_System.IO.Compression.FileSystem_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_watch_System.IO.Compression.FileSystem_test.dll.response</response>
+    </project>
+    <project dir="class/System.ComponentModel.DataAnnotations" library="System.ComponentModel.DataAnnotations-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig -nowarn:414 -r:./../../class/lib/monotouch_watch/System.dll -r:./../../class/lib/monotouch_watch/System.Core.dll -r:./../../class/lib/monotouch_watch/System.Data.dll -r:./../../class/lib/monotouch_watch/System.Xml.dll</flags>
+      <output>System.ComponentModel.DataAnnotations.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_watch/System.ComponentModel.DataAnnotations.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.ComponentModel.DataAnnotations.dll.sources</response>
+    </project>
+    <project dir="class/System.ComponentModel.DataAnnotations" library="System.ComponentModel.DataAnnotations-tests-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize -r:./../../class/lib/monotouch_watch/System.ComponentModel.DataAnnotations.dll -nowarn:414 -r:./../../class/lib/monotouch_watch/System.dll -r:./../../class/lib/monotouch_watch/System.Core.dll -r:./../../class/lib/monotouch_watch/System.Data.dll -r:./../../class/lib/monotouch_watch/System.Xml.dll</flags>
+      <output>monotouch_watch_System.ComponentModel.DataAnnotations_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_watch_System.ComponentModel.DataAnnotations_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_watch_System.ComponentModel.DataAnnotations_test.dll.response</response>
+    </project>
+    <project dir="class/System.ComponentModel.Composition.4.5" library="System.ComponentModel.Composition-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig -d:CLR40 -d:USE_ECMA_KEY,FEATURE_REFLECTIONCONTEXT,FEATURE_REFLECTIONFILEIO,FEATURE_SERIALIZATION,FEATURE_SLIMLOCK -nowarn:219,414 -r:./../../class/lib/monotouch_watch/System.dll -r:./../../class/lib/monotouch_watch/System.Core.dll</flags>
+      <output>System.ComponentModel.Composition.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_watch/System.ComponentModel.Composition.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources>Microsoft.Internal.Strings,src/ComponentModel/Strings.resx</resources>
+      <response>System.ComponentModel.Composition.dll.sources</response>
+    </project>
+    <project dir="class/System.Net" library="System.Net-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig -unsafe -r:./../../class/lib/monotouch_watch/System.dll -r:./../../class/lib/monotouch_watch/System.Core.dll -r:./../../class/lib/monotouch_watch/System.Xml.dll</flags>
+      <output>System.Net.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_watch/System.Net.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Net.dll.sources</response>
+    </project>
+    <project dir="class/System.Net.Http" library="System.Net.Http-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig -r:./../../class/lib/monotouch_watch/System.Core.dll -r:./../../class/lib/monotouch_watch/System.dll</flags>
+      <output>System.Net.Http.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_watch/System.Net.Http.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_watch_System.Net.Http.dll.sources</response>
+    </project>
+    <project dir="class/System.Net.Http" library="System.Net.Http-tests-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize -r:./../../class/lib/monotouch_watch/System.Net.Http.dll</flags>
+      <output>monotouch_watch_System.Net.Http_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_watch_System.Net.Http_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_watch_System.Net.Http_test.dll.response</response>
+    </project>
+    <project dir="class/System.Windows" library="System.Windows-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig -r:./../../class/lib/monotouch_watch/System.dll</flags>
+      <output>System.Windows.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_watch/System.Windows.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Windows.dll.sources</response>
+    </project>
+    <project dir="class/System.Xml.Serialization" library="System.Xml.Serialization-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig -r:./../../class/lib/monotouch_watch/System.Xml.dll -r:./../../class/lib/monotouch_watch/System.ServiceModel.dll</flags>
+      <output>System.Xml.Serialization.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_watch/System.Xml.Serialization.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Xml.Serialization.dll.sources</response>
+    </project>
+    <project dir="class/Mono.CSharp" library="Mono.CSharp-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig -d:IOS_REFLECTION -r:./../../class/lib/monotouch_watch/System.Core.dll -r:./../../class/lib/monotouch_watch/System.Xml.dll -r:./../../class/lib/monotouch_watch/System.dll</flags>
+      <output>Mono.CSharp.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_watch/Mono.CSharp.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_watch_Mono.CSharp.dll.sources</response>
+    </project>
+    <project dir="class/Mono.CSharp" library="Mono.CSharp-tests-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize -r:./../../class/lib/monotouch_watch/Mono.CSharp.dll</flags>
+      <output>monotouch_watch_Mono.CSharp_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_watch_Mono.CSharp_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_watch_Mono.CSharp_test.dll.response</response>
+    </project>
+    <project dir="class/Microsoft.CSharp" library="Microsoft.CSharp-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig -r:./../../class/lib/monotouch_watch/System.Core.dll -r:./../../class/lib/monotouch_watch/Mono.CSharp.dll</flags>
+      <output>Microsoft.CSharp.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_watch/Microsoft.CSharp.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>Microsoft.CSharp.dll.sources</response>
+    </project>
+    <project dir="class/System.Runtime.InteropServices.RuntimeInformation" library="System.Runtime.InteropServices.RuntimeInformation-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig -r:./../../class/lib/monotouch_watch/System.dll</flags>
+      <output>System.Runtime.InteropServices.RuntimeInformation.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_watch/System.Runtime.InteropServices.RuntimeInformation.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Runtime.InteropServices.RuntimeInformation.dll.sources</response>
+    </project>
+    <project dir="class/System.Reflection.DispatchProxy" library="System.Reflection.DispatchProxy-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig -r:./../../class/lib/monotouch_watch/System.dll</flags>
+      <output>System.Reflection.DispatchProxy.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_watch/System.Reflection.DispatchProxy.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Reflection.DispatchProxy.dll.sources</response>
+    </project>
+    <project dir="class/System.Xml.XPath.XmlDocument" library="System.Xml.XPath.XmlDocument-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig -r:./../../class/lib/monotouch_watch/System.dll -r:./../../class/lib/monotouch_watch/System.Xml.dll</flags>
+      <output>System.Xml.XPath.XmlDocument.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_watch/System.Xml.XPath.XmlDocument.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Xml.XPath.XmlDocument.dll.sources</response>
+    </project>
+    <project dir="class/System.Reflection.Context" library="System.Reflection.Context-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig -r:./../../class/lib/monotouch_watch/System.dll</flags>
+      <output>System.Reflection.Context.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_watch/System.Reflection.Context.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Reflection.Context.dll.sources</response>
+    </project>
+    <project dir="class/System.Net.Http.WinHttpHandler" library="System.Net.Http.WinHttpHandler-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig -r:./../../class/lib/monotouch_watch/System.dll -r:./../../class/lib/monotouch_watch/System.Net.Http.dll</flags>
+      <output>System.Net.Http.WinHttpHandler.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_watch/System.Net.Http.WinHttpHandler.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Net.Http.WinHttpHandler.dll.sources</response>
+    </project>
+    <project dir="class/Mono.Dynamic.Interpreter" library="Mono.Dynamic.Interpreter-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig -d:FEATURE_CORE_DLR,FEATURE_DBNULL,FEATURE_DEFAULT_PARAMETER_VALUE,FEATURE_GET_TYPE_INFO,FEATURE_VARIANCE,FEATURE_SERIALIZATION,CLR45 -d:MONO_INTERPRETER -delaysign -keyfile:../mono.pub -r:./../../class/lib/monotouch_watch/System.dll -r:./../../class/lib/monotouch_watch/plaincore/System.Core.dll</flags>
+      <output>Mono.Dynamic.Interpreter.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_watch/Mono.Dynamic.Interpreter.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>Mono.Dynamic.Interpreter.dll.sources</response>
+    </project>
+    <project dir="class/PEAPI" library="PEAPI-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig -nowarn:414,618 -r:./../../class/lib/monotouch_watch/System.dll</flags>
+      <output>PEAPI.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_watch/PEAPI.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>PEAPI.dll.sources</response>
+    </project>
+    <project dir="class/Mono.CompilerServices.SymbolWriter" library="Mono.CompilerServices.SymbolWriter-monotouch_watch">
+      <boot>true</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig -r:./../../class/lib/monotouch_watch/System.dll</flags>
+      <output>Mono.CompilerServices.SymbolWriter.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_watch/Mono.CompilerServices.SymbolWriter.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>Mono.CompilerServices.SymbolWriter.dll.sources</response>
+    </project>
+    <project dir="class/Mono.Simd" library="Mono.Simd-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /unsafe -r:./../../class/lib/monotouch_watch/System.Core.dll</flags>
+      <output>Mono.Simd.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_watch/Mono.Simd.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>Mono.Simd.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.X509Certificates" library="Facades_System.Security.Cryptography.X509Certificates-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll -r:./../../../class/lib/monotouch_watch/System.Core.dll</flags>
+      <output>System.Security.Cryptography.X509Certificates.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Security.Cryptography.X509Certificates.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.X509Certificates.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.ServiceModel.Primitives" library="Facades_System.ServiceModel.Primitives-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll -r:./../../../class/lib/monotouch_watch/System.ServiceModel.dll -r:./../../../class/lib/monotouch_watch/System.Xml.dll -r:./../../../class/lib/monotouch_watch/System.IdentityModel.dll -r:./../../../class/lib/monotouch_watch/Facades/System.Security.Cryptography.X509Certificates.dll</flags>
+      <output>System.ServiceModel.Primitives.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.ServiceModel.Primitives.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.ServiceModel.Primitives.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Runtime.Serialization.Primitives" library="Facades_System.Runtime.Serialization.Primitives-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.Runtime.Serialization.dll</flags>
+      <output>System.Runtime.Serialization.Primitives.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Runtime.Serialization.Primitives.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Runtime.Serialization.Primitives.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Runtime.Serialization.Xml" library="Facades_System.Runtime.Serialization.Xml-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 /d:NO_CODEDOM -r:./../../../class/lib/monotouch_watch/System.dll -r:./../../../class/lib/monotouch_watch/System.Runtime.Serialization.dll -r:./../../../class/lib/monotouch_watch/System.Xml.dll -r:./../../../class/lib/monotouch_watch/Facades/System.Runtime.Serialization.Primitives.dll</flags>
+      <output>System.Runtime.Serialization.Xml.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Runtime.Serialization.Xml.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Runtime.Serialization.Xml.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.Algorithms" library="Facades_System.Security.Cryptography.Algorithms-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll -r:./../../../class/lib/monotouch_watch/System.Core.dll</flags>
+      <output>System.Security.Cryptography.Algorithms.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Security.Cryptography.Algorithms.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.Algorithms.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.OpenSsl" library="Facades_System.Security.Cryptography.OpenSsl-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.Core.dll -r:./../../../class/lib/monotouch_watch/Facades/System.Security.Cryptography.Algorithms.dll</flags>
+      <output>System.Security.Cryptography.OpenSsl.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Security.Cryptography.OpenSsl.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.OpenSsl.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Drawing.Primitives" library="Facades_System.Drawing.Primitives-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll</flags>
+      <output>System.Drawing.Primitives.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Drawing.Primitives.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>./../../../build/deps/monotouch_watch_System.Drawing.Primitives.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Collections.Concurrent" library="Facades_System.Collections.Concurrent-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll</flags>
+      <output>System.Collections.Concurrent.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Collections.Concurrent.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Collections.Concurrent.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Collections" library="Facades_System.Collections-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll -r:./../../../class/lib/monotouch_watch/System.Core.dll</flags>
+      <output>System.Collections.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Collections.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Collections.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.ComponentModel.Annotations" library="Facades_System.ComponentModel.Annotations-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.ComponentModel.DataAnnotations.dll</flags>
+      <output>System.ComponentModel.Annotations.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.ComponentModel.Annotations.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.ComponentModel.Annotations.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.ComponentModel.EventBasedAsync" library="Facades_System.ComponentModel.EventBasedAsync-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll</flags>
+      <output>System.ComponentModel.EventBasedAsync.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.ComponentModel.EventBasedAsync.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.ComponentModel.EventBasedAsync.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.ComponentModel" library="Facades_System.ComponentModel-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll</flags>
+      <output>System.ComponentModel.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.ComponentModel.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.ComponentModel.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Diagnostics.Contracts" library="Facades_System.Diagnostics.Contracts-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Diagnostics.Contracts.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Diagnostics.Contracts.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Diagnostics.Contracts.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Diagnostics.Debug" library="Facades_System.Diagnostics.Debug-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll</flags>
+      <output>System.Diagnostics.Debug.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Diagnostics.Debug.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Diagnostics.Debug.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Diagnostics.Tracing" library="Facades_System.Diagnostics.Tracing-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Diagnostics.Tracing.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Diagnostics.Tracing.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Diagnostics.Tracing.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Diagnostics.Tools" library="Facades_System.Diagnostics.Tools-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll</flags>
+      <output>System.Diagnostics.Tools.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Diagnostics.Tools.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Diagnostics.Tools.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Dynamic.Runtime" library="Facades_System.Dynamic.Runtime-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.Core.dll -r:./../../../class/lib/monotouch_watch/System.dll</flags>
+      <output>System.Dynamic.Runtime.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Dynamic.Runtime.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Dynamic.Runtime.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Globalization" library="Facades_System.Globalization-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Globalization.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Globalization.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Globalization.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.IO" library="Facades_System.IO-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll</flags>
+      <output>System.IO.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.IO.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.IO.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Linq.Expressions" library="Facades_System.Linq.Expressions-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.Core.dll</flags>
+      <output>System.Linq.Expressions.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Linq.Expressions.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Linq.Expressions.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Linq.Parallel" library="Facades_System.Linq.Parallel-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.Core.dll</flags>
+      <output>System.Linq.Parallel.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Linq.Parallel.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Linq.Parallel.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Linq.Queryable" library="Facades_System.Linq.Queryable-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.Core.dll</flags>
+      <output>System.Linq.Queryable.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Linq.Queryable.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Linq.Queryable.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Linq" library="Facades_System.Linq-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.Core.dll</flags>
+      <output>System.Linq.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Linq.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Linq.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.NetworkInformation" library="Facades_System.Net.NetworkInformation-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll</flags>
+      <output>System.Net.NetworkInformation.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Net.NetworkInformation.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Net.NetworkInformation.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.Primitives" library="Facades_System.Net.Primitives-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll</flags>
+      <output>System.Net.Primitives.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Net.Primitives.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Net.Primitives.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.Requests" library="Facades_System.Net.Requests-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll</flags>
+      <output>System.Net.Requests.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Net.Requests.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Net.Requests.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.ObjectModel" library="Facades_System.ObjectModel-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll</flags>
+      <output>System.ObjectModel.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.ObjectModel.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.ObjectModel.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Reflection.Extensions" library="Facades_System.Reflection.Extensions-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Reflection.Extensions.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Reflection.Extensions.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Reflection.Extensions.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Reflection.Primitives" library="Facades_System.Reflection.Primitives-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Reflection.Primitives.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Reflection.Primitives.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Reflection.Primitives.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Reflection" library="Facades_System.Reflection-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Reflection.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Reflection.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Reflection.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Resources.ResourceManager" library="Facades_System.Resources.ResourceManager-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Resources.ResourceManager.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Resources.ResourceManager.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Resources.ResourceManager.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Runtime.Extensions" library="Facades_System.Runtime.Extensions-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll</flags>
+      <output>System.Runtime.Extensions.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Runtime.Extensions.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Runtime.Extensions.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Runtime.InteropServices" library="Facades_System.Runtime.InteropServices-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll -r:./../../../class/lib/monotouch_watch/System.Core.dll</flags>
+      <output>System.Runtime.InteropServices.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Runtime.InteropServices.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Runtime.InteropServices.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Runtime.InteropServices.WindowsRuntime" library="Facades_System.Runtime.InteropServices.WindowsRuntime-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Runtime.InteropServices.WindowsRuntime.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Runtime.InteropServices.WindowsRuntime.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Runtime.InteropServices.WindowsRuntime.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Runtime.Numerics" library="Facades_System.Runtime.Numerics-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.Numerics.dll</flags>
+      <output>System.Runtime.Numerics.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Runtime.Numerics.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Runtime.Numerics.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Runtime.Serialization.Json" library="Facades_System.Runtime.Serialization.Json-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.Runtime.Serialization.dll</flags>
+      <output>System.Runtime.Serialization.Json.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Runtime.Serialization.Json.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Runtime.Serialization.Json.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Runtime" library="Facades_System.Runtime-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll -r:./../../../class/lib/monotouch_watch/System.ComponentModel.Composition.dll -r:./../../../class/lib/monotouch_watch/System.Core.dll</flags>
+      <output>System.Runtime.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Runtime.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Runtime.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Principal" library="Facades_System.Security.Principal-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Security.Principal.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Security.Principal.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Security.Principal.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.ServiceModel.Http" library="Facades_System.ServiceModel.Http-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.ServiceModel.dll</flags>
+      <output>System.ServiceModel.Http.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.ServiceModel.Http.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.ServiceModel.Http.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.ServiceModel.Security" library="Facades_System.ServiceModel.Security-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.ServiceModel.dll</flags>
+      <output>System.ServiceModel.Security.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.ServiceModel.Security.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.ServiceModel.Security.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Text.Encoding.Extensions" library="Facades_System.Text.Encoding.Extensions-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Text.Encoding.Extensions.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Text.Encoding.Extensions.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Text.Encoding.Extensions.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Text.Encoding" library="Facades_System.Text.Encoding-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Text.Encoding.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Text.Encoding.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Text.Encoding.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Text.RegularExpressions" library="Facades_System.Text.RegularExpressions-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll</flags>
+      <output>System.Text.RegularExpressions.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Text.RegularExpressions.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Text.RegularExpressions.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Threading.Tasks.Parallel" library="Facades_System.Threading.Tasks.Parallel-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Threading.Tasks.Parallel.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Threading.Tasks.Parallel.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Threading.Tasks.Parallel.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Threading.Tasks" library="Facades_System.Threading.Tasks-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.Core.dll</flags>
+      <output>System.Threading.Tasks.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Threading.Tasks.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Threading.Tasks.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Threading.Timer" library="Facades_System.Threading.Timer-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll -r:./../../../class/lib/monotouch_watch/System.Core.dll</flags>
+      <output>System.Threading.Timer.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Threading.Timer.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Threading.Timer.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Threading" library="Facades_System.Threading-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll -r:./../../../class/lib/monotouch_watch/System.Core.dll</flags>
+      <output>System.Threading.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Threading.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Threading.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Xml.ReaderWriter" library="Facades_System.Xml.ReaderWriter-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.Xml.dll</flags>
+      <output>System.Xml.ReaderWriter.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Xml.ReaderWriter.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Xml.ReaderWriter.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Xml.XDocument" library="Facades_System.Xml.XDocument-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.Xml.Linq.dll -r:./../../../class/lib/monotouch_watch/System.Xml.dll</flags>
+      <output>System.Xml.XDocument.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Xml.XDocument.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Xml.XDocument.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Xml.XmlSerializer" library="Facades_System.Xml.XmlSerializer-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.Xml.dll</flags>
+      <output>System.Xml.XmlSerializer.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Xml.XmlSerializer.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Xml.XmlSerializer.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Runtime.Handles" library="Facades_System.Runtime.Handles-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll -r:./../../../class/lib/monotouch_watch/System.Core.dll</flags>
+      <output>System.Runtime.Handles.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Runtime.Handles.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Runtime.Handles.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.ServiceModel.Duplex" library="Facades_System.ServiceModel.Duplex-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.ServiceModel.dll</flags>
+      <output>System.ServiceModel.Duplex.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.ServiceModel.Duplex.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.ServiceModel.Duplex.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.ServiceModel.NetTcp" library="Facades_System.ServiceModel.NetTcp-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.ServiceModel.dll</flags>
+      <output>System.ServiceModel.NetTcp.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.ServiceModel.NetTcp.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.ServiceModel.NetTcp.dll.sources</response>
+    </project>
+    <project dir="class/Facades/Microsoft.Win32.Primitives" library="Facades_Microsoft.Win32.Primitives-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll</flags>
+      <output>Microsoft.Win32.Primitives.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/Microsoft.Win32.Primitives.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>Microsoft.Win32.Primitives.dll.sources</response>
+    </project>
+    <project dir="class/Facades/Microsoft.Win32.Registry" library="Facades_Microsoft.Win32.Registry-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll</flags>
+      <output>Microsoft.Win32.Registry.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/Microsoft.Win32.Registry.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>Microsoft.Win32.Registry.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.AppContext" library="Facades_System.AppContext-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll</flags>
+      <output>System.AppContext.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.AppContext.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.AppContext.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Collections.NonGeneric" library="Facades_System.Collections.NonGeneric-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll</flags>
+      <output>System.Collections.NonGeneric.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Collections.NonGeneric.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Collections.NonGeneric.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Collections.Specialized" library="Facades_System.Collections.Specialized-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll</flags>
+      <output>System.Collections.Specialized.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Collections.Specialized.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Collections.Specialized.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.ComponentModel.Primitives" library="Facades_System.ComponentModel.Primitives-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll</flags>
+      <output>System.ComponentModel.Primitives.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.ComponentModel.Primitives.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.ComponentModel.Primitives.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.ComponentModel.TypeConverter" library="Facades_System.ComponentModel.TypeConverter-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll</flags>
+      <output>System.ComponentModel.TypeConverter.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.ComponentModel.TypeConverter.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.ComponentModel.TypeConverter.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Console" library="Facades_System.Console-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll</flags>
+      <output>System.Console.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Console.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Console.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Data.Common" library="Facades_System.Data.Common-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll -r:./../../../class/lib/monotouch_watch/System.Data.dll -r:./../../../class/lib/monotouch_watch/System.Xml.dll</flags>
+      <output>System.Data.Common.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Data.Common.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Data.Common.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Data.SqlClient" library="Facades_System.Data.SqlClient-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll -r:./../../../class/lib/monotouch_watch/System.Data.dll -r:./../../../class/lib/monotouch_watch/System.Xml.dll</flags>
+      <output>System.Data.SqlClient.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Data.SqlClient.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Data.SqlClient.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Diagnostics.FileVersionInfo" library="Facades_System.Diagnostics.FileVersionInfo-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll</flags>
+      <output>System.Diagnostics.FileVersionInfo.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Diagnostics.FileVersionInfo.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Diagnostics.FileVersionInfo.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Diagnostics.Process" library="Facades_System.Diagnostics.Process-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll</flags>
+      <output>System.Diagnostics.Process.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Diagnostics.Process.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Diagnostics.Process.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Diagnostics.TextWriterTraceListener" library="Facades_System.Diagnostics.TextWriterTraceListener-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll</flags>
+      <output>System.Diagnostics.TextWriterTraceListener.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Diagnostics.TextWriterTraceListener.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Diagnostics.TextWriterTraceListener.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Diagnostics.TraceEvent" library="Facades_System.Diagnostics.TraceEvent-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll</flags>
+      <output>System.Diagnostics.TraceEvent.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Diagnostics.TraceEvent.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Diagnostics.TraceEvent.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Diagnostics.TraceSource" library="Facades_System.Diagnostics.TraceSource-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll</flags>
+      <output>System.Diagnostics.TraceSource.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Diagnostics.TraceSource.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Diagnostics.TraceSource.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Globalization.Calendars" library="Facades_System.Globalization.Calendars-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll</flags>
+      <output>System.Globalization.Calendars.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Globalization.Calendars.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Globalization.Calendars.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.IO.Compression.ZipFile" library="Facades_System.IO.Compression.ZipFile-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll -r:./../../../class/lib/monotouch_watch/System.IO.Compression.FileSystem.dll</flags>
+      <output>System.IO.Compression.ZipFile.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.IO.Compression.ZipFile.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.IO.Compression.ZipFile.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.IO.FileSystem" library="Facades_System.IO.FileSystem-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll</flags>
+      <output>System.IO.FileSystem.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.IO.FileSystem.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.IO.FileSystem.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.IO.FileSystem.DriveInfo" library="Facades_System.IO.FileSystem.DriveInfo-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll</flags>
+      <output>System.IO.FileSystem.DriveInfo.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.IO.FileSystem.DriveInfo.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.IO.FileSystem.DriveInfo.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.IO.FileSystem.Primitives" library="Facades_System.IO.FileSystem.Primitives-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll</flags>
+      <output>System.IO.FileSystem.Primitives.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.IO.FileSystem.Primitives.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.IO.FileSystem.Primitives.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.IO.IsolatedStorage" library="Facades_System.IO.IsolatedStorage-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll</flags>
+      <output>System.IO.IsolatedStorage.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.IO.IsolatedStorage.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.IO.IsolatedStorage.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.IO.MemoryMappedFiles" library="Facades_System.IO.MemoryMappedFiles-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll -r:./../../../class/lib/monotouch_watch/System.Core.dll</flags>
+      <output>System.IO.MemoryMappedFiles.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.IO.MemoryMappedFiles.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.IO.MemoryMappedFiles.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.IO.UnmanagedMemoryStream" library="Facades_System.IO.UnmanagedMemoryStream-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll</flags>
+      <output>System.IO.UnmanagedMemoryStream.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.IO.UnmanagedMemoryStream.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.IO.UnmanagedMemoryStream.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.AuthenticationManager" library="Facades_System.Net.AuthenticationManager-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll</flags>
+      <output>System.Net.AuthenticationManager.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Net.AuthenticationManager.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Net.AuthenticationManager.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.Cache" library="Facades_System.Net.Cache-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll</flags>
+      <output>System.Net.Cache.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Net.Cache.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Net.Cache.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.HttpListener" library="Facades_System.Net.HttpListener-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll</flags>
+      <output>System.Net.HttpListener.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Net.HttpListener.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Net.HttpListener.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.Mail" library="Facades_System.Net.Mail-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll</flags>
+      <output>System.Net.Mail.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Net.Mail.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Net.Mail.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.NameResolution" library="Facades_System.Net.NameResolution-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll</flags>
+      <output>System.Net.NameResolution.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Net.NameResolution.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Net.NameResolution.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.Security" library="Facades_System.Net.Security-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll</flags>
+      <output>System.Net.Security.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Net.Security.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Net.Security.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.ServicePoint" library="Facades_System.Net.ServicePoint-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll</flags>
+      <output>System.Net.ServicePoint.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Net.ServicePoint.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Net.ServicePoint.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.Sockets" library="Facades_System.Net.Sockets-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll</flags>
+      <output>System.Net.Sockets.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Net.Sockets.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Net.Sockets.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.Utilities" library="Facades_System.Net.Utilities-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll</flags>
+      <output>System.Net.Utilities.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Net.Utilities.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Net.Utilities.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.WebHeaderCollection" library="Facades_System.Net.WebHeaderCollection-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll</flags>
+      <output>System.Net.WebHeaderCollection.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Net.WebHeaderCollection.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Net.WebHeaderCollection.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.WebSockets" library="Facades_System.Net.WebSockets-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll</flags>
+      <output>System.Net.WebSockets.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Net.WebSockets.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Net.WebSockets.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.WebSockets.Client" library="Facades_System.Net.WebSockets.Client-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll</flags>
+      <output>System.Net.WebSockets.Client.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Net.WebSockets.Client.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Net.WebSockets.Client.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Resources.ReaderWriter" library="Facades_System.Resources.ReaderWriter-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll</flags>
+      <output>System.Resources.ReaderWriter.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Resources.ReaderWriter.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Resources.ReaderWriter.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Runtime.CompilerServices.VisualC" library="Facades_System.Runtime.CompilerServices.VisualC-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll</flags>
+      <output>System.Runtime.CompilerServices.VisualC.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Runtime.CompilerServices.VisualC.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Runtime.CompilerServices.VisualC.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.AccessControl" library="Facades_System.Security.AccessControl-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll</flags>
+      <output>System.Security.AccessControl.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Security.AccessControl.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Security.AccessControl.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Claims" library="Facades_System.Security.Claims-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll</flags>
+      <output>System.Security.Claims.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Security.Claims.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Security.Claims.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.DeriveBytes" library="Facades_System.Security.Cryptography.DeriveBytes-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll</flags>
+      <output>System.Security.Cryptography.DeriveBytes.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Security.Cryptography.DeriveBytes.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.DeriveBytes.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.Encoding" library="Facades_System.Security.Cryptography.Encoding-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll</flags>
+      <output>System.Security.Cryptography.Encoding.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Security.Cryptography.Encoding.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.Encoding.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.Encryption" library="Facades_System.Security.Cryptography.Encryption-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll</flags>
+      <output>System.Security.Cryptography.Encryption.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Security.Cryptography.Encryption.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.Encryption.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.Encryption.Aes" library="Facades_System.Security.Cryptography.Encryption.Aes-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll</flags>
+      <output>System.Security.Cryptography.Encryption.Aes.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Security.Cryptography.Encryption.Aes.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.Encryption.Aes.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.Encryption.ECDiffieHellman" library="Facades_System.Security.Cryptography.Encryption.ECDiffieHellman-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll -r:./../../../class/lib/monotouch_watch/System.Core.dll</flags>
+      <output>System.Security.Cryptography.Encryption.ECDiffieHellman.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Security.Cryptography.Encryption.ECDiffieHellman.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.Encryption.ECDiffieHellman.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.Encryption.ECDsa" library="Facades_System.Security.Cryptography.Encryption.ECDsa-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll -r:./../../../class/lib/monotouch_watch/System.Core.dll</flags>
+      <output>System.Security.Cryptography.Encryption.ECDsa.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Security.Cryptography.Encryption.ECDsa.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.Encryption.ECDsa.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.Hashing" library="Facades_System.Security.Cryptography.Hashing-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll</flags>
+      <output>System.Security.Cryptography.Hashing.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Security.Cryptography.Hashing.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.Hashing.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.Hashing.Algorithms" library="Facades_System.Security.Cryptography.Hashing.Algorithms-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll</flags>
+      <output>System.Security.Cryptography.Hashing.Algorithms.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Security.Cryptography.Hashing.Algorithms.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.Hashing.Algorithms.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.RSA" library="Facades_System.Security.Cryptography.RSA-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll</flags>
+      <output>System.Security.Cryptography.RSA.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Security.Cryptography.RSA.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.RSA.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.RandomNumberGenerator" library="Facades_System.Security.Cryptography.RandomNumberGenerator-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll</flags>
+      <output>System.Security.Cryptography.RandomNumberGenerator.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Security.Cryptography.RandomNumberGenerator.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.RandomNumberGenerator.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Principal.Windows" library="Facades_System.Security.Principal.Windows-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll</flags>
+      <output>System.Security.Principal.Windows.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Security.Principal.Windows.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Security.Principal.Windows.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Threading.Thread" library="Facades_System.Threading.Thread-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll</flags>
+      <output>System.Threading.Thread.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Threading.Thread.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Threading.Thread.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Threading.ThreadPool" library="Facades_System.Threading.ThreadPool-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll</flags>
+      <output>System.Threading.ThreadPool.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Threading.ThreadPool.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Threading.ThreadPool.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Xml.XPath" library="Facades_System.Xml.XPath-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll -r:./../../../class/lib/monotouch_watch/System.Xml.dll</flags>
+      <output>System.Xml.XPath.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Xml.XPath.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Xml.XPath.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Xml.XmlDocument" library="Facades_System.Xml.XmlDocument-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll -r:./../../../class/lib/monotouch_watch/System.Xml.dll</flags>
+      <output>System.Xml.XmlDocument.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Xml.XmlDocument.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Xml.XmlDocument.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Xml.Xsl.Primitives" library="Facades_System.Xml.Xsl.Primitives-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll -r:./../../../class/lib/monotouch_watch/System.Xml.dll</flags>
+      <output>System.Xml.Xsl.Primitives.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Xml.Xsl.Primitives.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Xml.Xsl.Primitives.dll.sources</response>
+    </project>
+    <project dir="class/Facades/Microsoft.Win32.Registry.AccessControl" library="Facades_Microsoft.Win32.Registry.AccessControl-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll</flags>
+      <output>Microsoft.Win32.Registry.AccessControl.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/Microsoft.Win32.Registry.AccessControl.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>Microsoft.Win32.Registry.AccessControl.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Diagnostics.StackTrace" library="Facades_System.Diagnostics.StackTrace-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll</flags>
+      <output>System.Diagnostics.StackTrace.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Diagnostics.StackTrace.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Diagnostics.StackTrace.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Globalization.Extensions" library="Facades_System.Globalization.Extensions-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll</flags>
+      <output>System.Globalization.Extensions.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Globalization.Extensions.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Globalization.Extensions.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.IO.FileSystem.AccessControl" library="Facades_System.IO.FileSystem.AccessControl-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll</flags>
+      <output>System.IO.FileSystem.AccessControl.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.IO.FileSystem.AccessControl.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.IO.FileSystem.AccessControl.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Reflection.TypeExtensions" library="Facades_System.Reflection.TypeExtensions-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll</flags>
+      <output>System.Reflection.TypeExtensions.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Reflection.TypeExtensions.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Reflection.TypeExtensions.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Reflection.Emit.Lightweight" library="Facades_System.Reflection.Emit.Lightweight-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Reflection.Emit.Lightweight.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Reflection.Emit.Lightweight.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Reflection.Emit.Lightweight.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Reflection.Emit.ILGeneration" library="Facades_System.Reflection.Emit.ILGeneration-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Reflection.Emit.ILGeneration.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Reflection.Emit.ILGeneration.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Reflection.Emit.ILGeneration.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Reflection.Emit" library="Facades_System.Reflection.Emit-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Reflection.Emit.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Reflection.Emit.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Reflection.Emit.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.SecureString" library="Facades_System.Security.SecureString-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll</flags>
+      <output>System.Security.SecureString.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Security.SecureString.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Security.SecureString.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Threading.AccessControl" library="Facades_System.Threading.AccessControl-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll</flags>
+      <output>System.Threading.AccessControl.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Threading.AccessControl.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Threading.AccessControl.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Threading.Overlapped" library="Facades_System.Threading.Overlapped-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -unsafe -r:./../../../class/lib/monotouch_watch/System.dll</flags>
+      <output>System.Threading.Overlapped.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Threading.Overlapped.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Threading.Overlapped.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Xml.XPath.XDocument" library="Facades_System.Xml.XPath.XDocument-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll -r:./../../../class/lib/monotouch_watch/System.Xml.dll -r:./../../../class/lib/monotouch_watch/System.Xml.Linq.dll</flags>
+      <output>System.Xml.XPath.XDocument.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Xml.XPath.XDocument.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Xml.XPath.XDocument.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.Primitives" library="Facades_System.Security.Cryptography.Primitives-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll</flags>
+      <output>System.Security.Cryptography.Primitives.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Security.Cryptography.Primitives.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.Primitives.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Text.Encoding.CodePages" library="Facades_System.Text.Encoding.CodePages-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll</flags>
+      <output>System.Text.Encoding.CodePages.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Text.Encoding.CodePages.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Text.Encoding.CodePages.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.IO.FileSystem.Watcher" library="Facades_System.IO.FileSystem.Watcher-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll</flags>
+      <output>System.IO.FileSystem.Watcher.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.IO.FileSystem.Watcher.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.IO.FileSystem.Watcher.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.ProtectedData" library="Facades_System.Security.Cryptography.ProtectedData-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll -r:./../../../class/lib/monotouch_watch/System.Security.dll</flags>
+      <output>System.Security.Cryptography.ProtectedData.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Security.Cryptography.ProtectedData.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.ProtectedData.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.ServiceProcess.ServiceController" library="Facades_System.ServiceProcess.ServiceController-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll</flags>
+      <output>System.ServiceProcess.ServiceController.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.ServiceProcess.ServiceController.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.ServiceProcess.ServiceController.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.IO.Pipes" library="Facades_System.IO.Pipes-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll -r:./../../../class/lib/monotouch_watch/System.Core.dll</flags>
+      <output>System.IO.Pipes.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.IO.Pipes.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.IO.Pipes.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.Ping" library="Facades_System.Net.Ping-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll</flags>
+      <output>System.Net.Ping.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Net.Ping.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Net.Ping.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Runtime.Serialization.Formatters" library="Facades_System.Runtime.Serialization.Formatters-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll</flags>
+      <output>System.Runtime.Serialization.Formatters.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Runtime.Serialization.Formatters.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Runtime.Serialization.Formatters.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.Csp" library="Facades_System.Security.Cryptography.Csp-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll</flags>
+      <output>System.Security.Cryptography.Csp.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Security.Cryptography.Csp.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.Csp.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.Pkcs" library="Facades_System.Security.Cryptography.Pkcs-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll -r:./../../../class/lib/monotouch_watch/System.Security.dll</flags>
+      <output>System.Security.Cryptography.Pkcs.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Security.Cryptography.Pkcs.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.Pkcs.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.Cng" library="Facades_System.Security.Cryptography.Cng-monotouch_watch">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_watch/mscorlib.dll -d:FULL_AOT_RUNTIME -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_watch/System.dll -r:./../../../class/lib/monotouch_watch/System.Core.dll</flags>
+      <output>System.Security.Cryptography.Cng.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_watch/Facades/System.Security.Cryptography.Cng.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.Cng.dll.sources</response>
+    </project>
+    <project dir="class/corlib" library="corlib-monotouch_watch_runtime">
+      <boot>true</boot>
+      <flags>/codepage:65001 -unsafe -nostdlib -nowarn:612,618,1635 -d:INSIDE_CORLIB,MONO_CULTURE_DATA -d:LIBC -d:FEATURE_PAL,GENERICS_WORK,FEATURE_LIST_PREDICATES,FEATURE_SERIALIZATION,FEATURE_ASCII,FEATURE_LATIN1,FEATURE_UTF7,FEATURE_UTF32,MONO_HYBRID_ENCODING_SUPPORT,FEATURE_ASYNC_IO,NEW_EXPERIMENTAL_ASYNC_IO,FEATURE_UTF32,FEATURE_EXCEPTIONDISPATCHINFO,FEATURE_CORRUPTING_EXCEPTIONS,FEATURE_EXCEPTION_NOTIFICATIONS,FEATURE_STRONGNAME_MIGRATION,FEATURE_USE_LCID,FEATURE_FUSION,FEATURE_CRYPTO,FEATURE_X509_SECURESTRINGS,FEATURE_SYNCHRONIZATIONCONTEXT,FEATURE_SYNCHRONIZATIONCONTEXT_WAIT,HAS_CORLIB_CONTRACTS -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -debug -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig -d:FEATURE_PAL,GENERICS_WORK,FEATURE_LIST_PREDICATES,FEATURE_SERIALIZATION,FEATURE_ASCII,FEATURE_LATIN1,FEATURE_UTF7,FEATURE_UTF32,MONO_HYBRID_ENCODING_SUPPORT,FEATURE_ASYNC_IO,NEW_EXPERIMENTAL_ASYNC_IO,FEATURE_UTF32,FEATURE_EXCEPTIONDISPATCHINFO,FEATURE_CORRUPTING_EXCEPTIONS,FEATURE_EXCEPTION_NOTIFICATIONS,FEATURE_STRONGNAME_MIGRATION,FEATURE_USE_LCID,FEATURE_FUSION,FEATURE_CRYPTO,FEATURE_X509_SECURESTRINGS,FEATURE_SYNCHRONIZATIONCONTEXT,FEATURE_SYNCHRONIZATIONCONTEXT_WAIT,HAS_CORLIB_CONTRACTS -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -resource:resources/charinfo.nlp -resource:resources/collation.core.bin -resource:resources/collation.tailoring.bin -resource:resources/collation.cjkCHS.bin -resource:resources/collation.cjkCHT.bin -resource:resources/collation.cjkJA.bin -resource:resources/collation.cjkKO.bin -resource:resources/collation.cjkKOlv2.bin --runtime:v4</flags>
+      <output>mscorlib.dll</output>
+      <built_sources>CommonCrypto/MD5CryptoServiceProvider.g.cs CommonCrypto/SHA256Managed.g.cs CommonCrypto/RC2CryptoServiceProvider.g.cs CommonCrypto/SHA384Managed.g.cs CommonCrypto/DESCryptoServiceProvider.g.cs CommonCrypto/SHA1CryptoServiceProvider.g.cs CommonCrypto/SHA512Managed.g.cs CommonCrypto/MD2Managed.g.cs CommonCrypto/SHA1Managed.g.cs CommonCrypto/TripleDESCryptoServiceProvider.g.cs CommonCrypto/MD4Managed.g.cs</built_sources>
+      <library_output>./../../class/lib/monotouch_watch_runtime/mscorlib.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch_runtime</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_watch_runtime_corlib.dll.sources</response>
+    </project>
+    <project dir="class/corlib" library="corlib-tests-monotouch_watch_runtime">
+      <boot>false</boot>
+      <flags>/codepage:65001 -unsafe -nostdlib -nowarn:612,618,1635 -d:INSIDE_CORLIB,MONO_CULTURE_DATA -d:LIBC -d:FEATURE_PAL,GENERICS_WORK,FEATURE_LIST_PREDICATES,FEATURE_SERIALIZATION,FEATURE_ASCII,FEATURE_LATIN1,FEATURE_UTF7,FEATURE_UTF32,MONO_HYBRID_ENCODING_SUPPORT,FEATURE_ASYNC_IO,NEW_EXPERIMENTAL_ASYNC_IO,FEATURE_UTF32,FEATURE_EXCEPTIONDISPATCHINFO,FEATURE_CORRUPTING_EXCEPTIONS,FEATURE_EXCEPTION_NOTIFICATIONS,FEATURE_STRONGNAME_MIGRATION,FEATURE_USE_LCID,FEATURE_FUSION,FEATURE_CRYPTO,FEATURE_X509_SECURESTRINGS,FEATURE_SYNCHRONIZATIONCONTEXT,FEATURE_SYNCHRONIZATIONCONTEXT_WAIT,HAS_CORLIB_CONTRACTS -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -debug -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize -r:./../../class/lib/monotouch_watch_runtime/mscorlib.dll -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -debug -nowarn:168,219,618,672 -unsafe -define:MONO_DATACONVERTER_STATIC_METHODS -resource:Test/resources/Resources.resources</flags>
+      <output>monotouch_watch_runtime_corlib_test.dll</output>
+      <built_sources>CommonCrypto/MD5CryptoServiceProvider.g.cs CommonCrypto/SHA256Managed.g.cs CommonCrypto/RC2CryptoServiceProvider.g.cs CommonCrypto/SHA384Managed.g.cs CommonCrypto/DESCryptoServiceProvider.g.cs CommonCrypto/SHA1CryptoServiceProvider.g.cs CommonCrypto/SHA512Managed.g.cs CommonCrypto/MD2Managed.g.cs CommonCrypto/SHA1Managed.g.cs CommonCrypto/TripleDESCryptoServiceProvider.g.cs CommonCrypto/MD4Managed.g.cs</built_sources>
+      <library_output>monotouch_watch_runtime_corlib_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch_runtime</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_watch_runtime_corlib_test.dll.response</response>
+    </project>
+    <project dir="class/System" library="System-monotouch_watch_runtime">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_watch_runtime/mscorlib.dll -debug -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig -d:CONFIGURATION_2_0 -d:FEATURE_PAL,SYSTEM_NAMESPACE,MONO,PLATFORM_UNIX -d:MONO_FEATURE_PROCESS_START -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -unsafe -d:INSIDE_SYSTEM -d:SECURITY_DEP -nowarn:618,1635 -d:SECURITY_DEP -d:XML_DEP -r:./../../class/lib/monotouch_watch_runtime/System.Xml.dll</flags>
+      <output>System.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_watch_runtime/System.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch_runtime</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_watch_runtime_System.dll.sources</response>
+    </project>
+    <project dir="class/System" library="System-tests-monotouch_watch_runtime">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_watch_runtime/mscorlib.dll -debug -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize -r:./../../class/lib/monotouch_watch_runtime/secxml/System.dll -nowarn:618,672,219,67,169,612 -resource:Test/System/test-uri-props.txt,test-uri-props.txt -resource:Test/System/test-uri-props-manual.txt,test-uri-props-manual.txt -resource:Test/System/test-uri-relative-props.txt,test-uri-relative-props.txt -d:MONO_FEATURE_PROCESS_START -d:MONO_FEATURE_MULTIPLE_APPDOMAINS</flags>
+      <output>monotouch_watch_runtime_System_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_watch_runtime_System_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch_runtime</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_watch_runtime_System_test.dll.response</response>
+    </project>
+    <project dir="class/System" library="System-bare-monotouch_watch_runtime">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_watch_runtime/mscorlib.dll -debug -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig -d:CONFIGURATION_2_0 -d:FEATURE_PAL,SYSTEM_NAMESPACE,MONO,PLATFORM_UNIX -d:MONO_FEATURE_PROCESS_START -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -unsafe -d:INSIDE_SYSTEM -d:SECURITY_DEP -nowarn:618,1635</flags>
+      <output>System.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_watch_runtime/bare/System.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch_runtime</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_watch_runtime_System.dll.sources</response>
+    </project>
+    <project dir="class/System" library="System-tests-monotouch_watch_runtime">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_watch_runtime/mscorlib.dll -debug -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize -r:./../../class/lib/monotouch_watch_runtime/secxml/System.dll -nowarn:618,672,219,67,169,612 -resource:Test/System/test-uri-props.txt,test-uri-props.txt -resource:Test/System/test-uri-props-manual.txt,test-uri-props-manual.txt -resource:Test/System/test-uri-relative-props.txt,test-uri-relative-props.txt -d:MONO_FEATURE_PROCESS_START -d:MONO_FEATURE_MULTIPLE_APPDOMAINS</flags>
+      <output>monotouch_watch_runtime_System_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_watch_runtime_System_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch_runtime</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_watch_runtime_System_test.dll.response</response>
+    </project>
+    <project dir="class/System" library="System-secxml-monotouch_watch_runtime">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_watch_runtime/mscorlib.dll -debug -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig -d:CONFIGURATION_2_0 -d:FEATURE_PAL,SYSTEM_NAMESPACE,MONO,PLATFORM_UNIX -d:MONO_FEATURE_PROCESS_START -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -unsafe -d:INSIDE_SYSTEM -d:SECURITY_DEP -nowarn:618,1635 -d:SECURITY_DEP -d:XML_DEP -r:./../../class/lib/monotouch_watch_runtime/bare/System.Xml.dll</flags>
+      <output>System.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_watch_runtime/secxml/System.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch_runtime</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_watch_runtime_System.dll.sources</response>
+    </project>
+    <project dir="class/System" library="System-tests-monotouch_watch_runtime">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_watch_runtime/mscorlib.dll -debug -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize -r:./../../class/lib/monotouch_watch_runtime/secxml/System.dll -nowarn:618,672,219,67,169,612 -resource:Test/System/test-uri-props.txt,test-uri-props.txt -resource:Test/System/test-uri-props-manual.txt,test-uri-props-manual.txt -resource:Test/System/test-uri-relative-props.txt,test-uri-relative-props.txt -d:MONO_FEATURE_PROCESS_START -d:MONO_FEATURE_MULTIPLE_APPDOMAINS</flags>
+      <output>monotouch_watch_runtime_System_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_watch_runtime_System_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch_runtime</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_watch_runtime_System_test.dll.response</response>
+    </project>
+    <project dir="class/System.Core" library="System.Core-monotouch_watch_runtime">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_watch_runtime/mscorlib.dll -debug -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig -d:FEATURE_PAL,PFX_LEGACY_3_5,FEATURE_NETCORE -d:INSIDE_SYSCORE -d:LIBC -unsafe -d:FEATURE_CORE_DLR -d:MONO_INTERPRETER -r:./../../class/lib/monotouch_watch_runtime/System.dll -r:./../../class/lib/monotouch_watch_runtime/Mono.Dynamic.Interpreter.dll</flags>
+      <output>System.Core.dll</output>
+      <built_sources>../corlib/CommonCrypto/AesManaged.g.cs ../corlib/CommonCrypto/AesCryptoServiceProvider.g.cs</built_sources>
+      <library_output>./../../class/lib/monotouch_watch_runtime/System.Core.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch_runtime</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_watch_runtime_System.Core.dll.sources</response>
+    </project>
+    <project dir="class/System.Core" library="System.Core-tests-monotouch_watch_runtime">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_watch_runtime/mscorlib.dll -debug -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize -r:./../../class/lib/monotouch_watch_runtime/plaincore/System.Core.dll -d:FEATURE_PAL,PFX_LEGACY_3_5,FEATURE_NETCORE -d:INSIDE_SYSCORE -d:LIBC -unsafe -d:FEATURE_CORE_DLR -r:./../../class/lib/monotouch_watch_runtime/System.dll</flags>
+      <output>monotouch_watch_runtime_System.Core_test.dll</output>
+      <built_sources>../corlib/CommonCrypto/AesManaged.g.cs ../corlib/CommonCrypto/AesCryptoServiceProvider.g.cs</built_sources>
+      <library_output>monotouch_watch_runtime_System.Core_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch_runtime</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_watch_runtime_System.Core_test.dll.response</response>
+    </project>
+    <project dir="class/System.Core" library="System.Core-plaincore-monotouch_watch_runtime">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_watch_runtime/mscorlib.dll -debug -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig -d:FEATURE_PAL,PFX_LEGACY_3_5,FEATURE_NETCORE -d:INSIDE_SYSCORE -d:LIBC -unsafe -d:FEATURE_CORE_DLR -r:./../../class/lib/monotouch_watch_runtime/System.dll</flags>
+      <output>System.Core.dll</output>
+      <built_sources>../corlib/CommonCrypto/AesManaged.g.cs ../corlib/CommonCrypto/AesCryptoServiceProvider.g.cs</built_sources>
+      <library_output>./../../class/lib/monotouch_watch_runtime/plaincore/System.Core.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch_runtime</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_watch_runtime_System.Core.dll.sources</response>
+    </project>
+    <project dir="class/System.Core" library="System.Core-tests-monotouch_watch_runtime">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_watch_runtime/mscorlib.dll -debug -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize -r:./../../class/lib/monotouch_watch_runtime/plaincore/System.Core.dll -d:FEATURE_PAL,PFX_LEGACY_3_5,FEATURE_NETCORE -d:INSIDE_SYSCORE -d:LIBC -unsafe -d:FEATURE_CORE_DLR -r:./../../class/lib/monotouch_watch_runtime/System.dll</flags>
+      <output>monotouch_watch_runtime_System.Core_test.dll</output>
+      <built_sources>../corlib/CommonCrypto/AesManaged.g.cs ../corlib/CommonCrypto/AesCryptoServiceProvider.g.cs</built_sources>
+      <library_output>monotouch_watch_runtime_System.Core_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch_runtime</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_watch_runtime_System.Core_test.dll.response</response>
+    </project>
+    <project dir="class/System.XML" library="System.Xml-monotouch_watch_runtime">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_watch_runtime/mscorlib.dll -debug -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig -nowarn:219,414,649,1717 -unsafe -d:ASYNC -d:AGCLR -d:DISABLE_XSLT_COMPILER -d:DISABLE_XSLT_SCRIPT,MONO_HYBRID_SYSTEM_XML -d:DISABLE_CAS_USE -r:./../../class/lib/monotouch_watch_runtime/secxml/System.dll</flags>
+      <output>System.Xml.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_watch_runtime/System.Xml.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch_runtime</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_watch_runtime_System.Xml.dll.sources</response>
+    </project>
+    <project dir="class/System.XML" library="System.Xml-tests-monotouch_watch_runtime">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_watch_runtime/mscorlib.dll -debug -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize -r:./../../class/lib/monotouch_watch_runtime/bare/System.Xml.dll -nowarn:219,414,649,1717 -unsafe -d:ASYNC -d:AGCLR -d:DISABLE_XSLT_COMPILER -d:DISABLE_XSLT_SCRIPT,MONO_HYBRID_SYSTEM_XML -d:DISABLE_CAS_USE -r:./../../class/lib/monotouch_watch_runtime/bare/System.dll -nowarn:0618 -nowarn:219 -nowarn:169</flags>
+      <output>monotouch_watch_runtime_System.Xml_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_watch_runtime_System.Xml_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch_runtime</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_watch_runtime_System.Xml_test.dll.response</response>
+    </project>
+    <project dir="class/System.XML" library="System.Xml-bare-monotouch_watch_runtime">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_watch_runtime/mscorlib.dll -debug -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig -nowarn:219,414,649,1717 -unsafe -d:ASYNC -d:AGCLR -d:DISABLE_XSLT_COMPILER -d:DISABLE_XSLT_SCRIPT,MONO_HYBRID_SYSTEM_XML -d:DISABLE_CAS_USE -r:./../../class/lib/monotouch_watch_runtime/bare/System.dll</flags>
+      <output>System.Xml.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_watch_runtime/bare/System.Xml.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch_runtime</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_watch_runtime_System.Xml.dll.sources</response>
+    </project>
+    <project dir="class/System.XML" library="System.Xml-tests-monotouch_watch_runtime">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_watch_runtime/mscorlib.dll -debug -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize -r:./../../class/lib/monotouch_watch_runtime/bare/System.Xml.dll -nowarn:219,414,649,1717 -unsafe -d:ASYNC -d:AGCLR -d:DISABLE_XSLT_COMPILER -d:DISABLE_XSLT_SCRIPT,MONO_HYBRID_SYSTEM_XML -d:DISABLE_CAS_USE -r:./../../class/lib/monotouch_watch_runtime/bare/System.dll -nowarn:0618 -nowarn:219 -nowarn:169</flags>
+      <output>monotouch_watch_runtime_System.Xml_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_watch_runtime_System.Xml_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch_runtime</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_watch_runtime_System.Xml_test.dll.response</response>
+    </project>
+    <project dir="class/Mono.CSharp" library="Mono.CSharp-monotouch_watch_runtime">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_watch_runtime/mscorlib.dll -debug -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize /noconfig -d:IOS_REFLECTION -r:./../../class/lib/monotouch_watch_runtime/System.Core.dll -r:./../../class/lib/monotouch_watch_runtime/System.Xml.dll -r:./../../class/lib/monotouch_watch_runtime/System.dll</flags>
+      <output>Mono.CSharp.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_watch_runtime/Mono.CSharp.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch_runtime</profile>
+      <resources></resources>
+      <response>Mono.CSharp.dll.sources</response>
+    </project>
+    <project dir="class/Mono.CSharp" library="Mono.CSharp-tests-monotouch_watch_runtime">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_watch_runtime/mscorlib.dll -debug -d:FEATURE_NO_BSD_SOCKETS -d:MONOTOUCH_WATCH -optimize -r:./../../class/lib/monotouch_watch_runtime/Mono.CSharp.dll</flags>
+      <output>monotouch_watch_runtime_Mono.CSharp_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_watch_runtime_Mono.CSharp_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_watch_runtime</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_watch_runtime_Mono.CSharp_test.dll.response</response>
+    </project>
+    <project dir="class/corlib" library="corlib-monotouch_tv">
+      <boot>true</boot>
+      <flags>/codepage:65001 -unsafe -nostdlib -nowarn:612,618,1635 -d:INSIDE_CORLIB,MONO_CULTURE_DATA -d:LIBC -d:FEATURE_PAL,GENERICS_WORK,FEATURE_LIST_PREDICATES,FEATURE_SERIALIZATION,FEATURE_ASCII,FEATURE_LATIN1,FEATURE_UTF7,FEATURE_UTF32,MONO_HYBRID_ENCODING_SUPPORT,FEATURE_ASYNC_IO,NEW_EXPERIMENTAL_ASYNC_IO,FEATURE_UTF32,FEATURE_EXCEPTIONDISPATCHINFO,FEATURE_CORRUPTING_EXCEPTIONS,FEATURE_EXCEPTION_NOTIFICATIONS,FEATURE_STRONGNAME_MIGRATION,FEATURE_USE_LCID,FEATURE_FUSION,FEATURE_CRYPTO,FEATURE_X509_SECURESTRINGS,FEATURE_SYNCHRONIZATIONCONTEXT,FEATURE_SYNCHRONIZATIONCONTEXT_WAIT,HAS_CORLIB_CONTRACTS -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig -d:FEATURE_PAL,GENERICS_WORK,FEATURE_LIST_PREDICATES,FEATURE_SERIALIZATION,FEATURE_ASCII,FEATURE_LATIN1,FEATURE_UTF7,FEATURE_UTF32,MONO_HYBRID_ENCODING_SUPPORT,FEATURE_ASYNC_IO,NEW_EXPERIMENTAL_ASYNC_IO,FEATURE_UTF32,FEATURE_EXCEPTIONDISPATCHINFO,FEATURE_CORRUPTING_EXCEPTIONS,FEATURE_EXCEPTION_NOTIFICATIONS,FEATURE_STRONGNAME_MIGRATION,FEATURE_USE_LCID,FEATURE_FUSION,FEATURE_CRYPTO,FEATURE_X509_SECURESTRINGS,FEATURE_SYNCHRONIZATIONCONTEXT,FEATURE_SYNCHRONIZATIONCONTEXT_WAIT,HAS_CORLIB_CONTRACTS -resource:resources/charinfo.nlp -resource:resources/collation.core.bin -resource:resources/collation.tailoring.bin -resource:resources/collation.cjkCHS.bin -resource:resources/collation.cjkCHT.bin -resource:resources/collation.cjkJA.bin -resource:resources/collation.cjkKO.bin -resource:resources/collation.cjkKOlv2.bin --runtime:v4</flags>
+      <output>mscorlib.dll</output>
+      <built_sources>CommonCrypto/MD5CryptoServiceProvider.g.cs CommonCrypto/SHA256Managed.g.cs CommonCrypto/RC2CryptoServiceProvider.g.cs CommonCrypto/SHA384Managed.g.cs CommonCrypto/DESCryptoServiceProvider.g.cs CommonCrypto/SHA1CryptoServiceProvider.g.cs CommonCrypto/SHA512Managed.g.cs CommonCrypto/MD2Managed.g.cs CommonCrypto/SHA1Managed.g.cs CommonCrypto/TripleDESCryptoServiceProvider.g.cs CommonCrypto/MD4Managed.g.cs</built_sources>
+      <library_output>./../../class/lib/monotouch_tv/mscorlib.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_tv_corlib.dll.sources</response>
+    </project>
+    <project dir="class/corlib" library="corlib-tests-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -unsafe -nostdlib -nowarn:612,618,1635 -d:INSIDE_CORLIB,MONO_CULTURE_DATA -d:LIBC -d:FEATURE_PAL,GENERICS_WORK,FEATURE_LIST_PREDICATES,FEATURE_SERIALIZATION,FEATURE_ASCII,FEATURE_LATIN1,FEATURE_UTF7,FEATURE_UTF32,MONO_HYBRID_ENCODING_SUPPORT,FEATURE_ASYNC_IO,NEW_EXPERIMENTAL_ASYNC_IO,FEATURE_UTF32,FEATURE_EXCEPTIONDISPATCHINFO,FEATURE_CORRUPTING_EXCEPTIONS,FEATURE_EXCEPTION_NOTIFICATIONS,FEATURE_STRONGNAME_MIGRATION,FEATURE_USE_LCID,FEATURE_FUSION,FEATURE_CRYPTO,FEATURE_X509_SECURESTRINGS,FEATURE_SYNCHRONIZATIONCONTEXT,FEATURE_SYNCHRONIZATIONCONTEXT_WAIT,HAS_CORLIB_CONTRACTS -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize -r:./../../class/lib/monotouch_tv/mscorlib.dll -debug -nowarn:168,219,618,672 -unsafe -define:MONO_DATACONVERTER_STATIC_METHODS -resource:Test/resources/Resources.resources</flags>
+      <output>monotouch_tv_corlib_test.dll</output>
+      <built_sources>CommonCrypto/MD5CryptoServiceProvider.g.cs CommonCrypto/SHA256Managed.g.cs CommonCrypto/RC2CryptoServiceProvider.g.cs CommonCrypto/SHA384Managed.g.cs CommonCrypto/DESCryptoServiceProvider.g.cs CommonCrypto/SHA1CryptoServiceProvider.g.cs CommonCrypto/SHA512Managed.g.cs CommonCrypto/MD2Managed.g.cs CommonCrypto/SHA1Managed.g.cs CommonCrypto/TripleDESCryptoServiceProvider.g.cs CommonCrypto/MD4Managed.g.cs</built_sources>
+      <library_output>monotouch_tv_corlib_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_tv_corlib_test.dll.response</response>
+    </project>
+    <project dir="class/Mono.Security" library="Mono.Security-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig -unsafe -nowarn:1030,3009 -r:./../../class/lib/monotouch_tv/bare/System.dll</flags>
+      <output>Mono.Security.dll</output>
+      <built_sources>../corlib/CommonCrypto/SHA224Managed.g.cs ../corlib/CommonCrypto/MD2Managed.g.cs ../corlib/CommonCrypto/MD4Managed.g.cs</built_sources>
+      <library_output>./../../class/lib/monotouch_tv/Mono.Security.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_tv_Mono.Security.dll.sources</response>
+    </project>
+    <project dir="class/Mono.Security" library="Mono.Security-tests-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize -r:./../../class/lib/monotouch_tv/Mono.Security.dll -unsafe -nowarn:1030,3009 -r:./../../class/lib/monotouch_tv/bare/System.dll -nowarn:169,219,618,672</flags>
+      <output>monotouch_tv_Mono.Security_test.dll</output>
+      <built_sources>../corlib/CommonCrypto/SHA224Managed.g.cs ../corlib/CommonCrypto/MD2Managed.g.cs ../corlib/CommonCrypto/MD4Managed.g.cs</built_sources>
+      <library_output>monotouch_tv_Mono.Security_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_tv_Mono.Security_test.dll.response</response>
+    </project>
+    <project dir="class/System" library="System-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig -d:CONFIGURATION_2_0 -d:FEATURE_PAL,SYSTEM_NAMESPACE,MONO,PLATFORM_UNIX -unsafe -d:INSIDE_SYSTEM -d:SECURITY_DEP -nowarn:618,1635 -d:SECURITY_DEP -d:XML_DEP -r:./../../class/lib/monotouch_tv/System.Xml.dll -r:MonoSecurity=./../../class/lib/monotouch_tv/Mono.Security.dll</flags>
+      <output>System.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_tv/System.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_tv_System.dll.sources</response>
+    </project>
+    <project dir="class/System" library="System-tests-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize -r:./../../class/lib/monotouch_tv/secxml/System.dll -nowarn:618,672,219,67,169,612 -resource:Test/System/test-uri-props.txt,test-uri-props.txt -resource:Test/System/test-uri-props-manual.txt,test-uri-props-manual.txt -resource:Test/System/test-uri-relative-props.txt,test-uri-relative-props.txt</flags>
+      <output>monotouch_tv_System_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_tv_System_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_tv_System_test.dll.response</response>
+    </project>
+    <project dir="class/System" library="System-bare-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig -d:CONFIGURATION_2_0 -d:FEATURE_PAL,SYSTEM_NAMESPACE,MONO,PLATFORM_UNIX -unsafe -d:INSIDE_SYSTEM -d:SECURITY_DEP -nowarn:618,1635</flags>
+      <output>System.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_tv/bare/System.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_tv_System.dll.sources</response>
+    </project>
+    <project dir="class/System" library="System-tests-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize -r:./../../class/lib/monotouch_tv/secxml/System.dll -nowarn:618,672,219,67,169,612 -resource:Test/System/test-uri-props.txt,test-uri-props.txt -resource:Test/System/test-uri-props-manual.txt,test-uri-props-manual.txt -resource:Test/System/test-uri-relative-props.txt,test-uri-relative-props.txt</flags>
+      <output>monotouch_tv_System_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_tv_System_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_tv_System_test.dll.response</response>
+    </project>
+    <project dir="class/System" library="System-secxml-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig -d:CONFIGURATION_2_0 -d:FEATURE_PAL,SYSTEM_NAMESPACE,MONO,PLATFORM_UNIX -unsafe -d:INSIDE_SYSTEM -d:SECURITY_DEP -nowarn:618,1635 -d:SECURITY_DEP -d:XML_DEP -r:./../../class/lib/monotouch_tv/bare/System.Xml.dll -r:MonoSecurity=./../../class/lib/monotouch_tv/Mono.Security.dll</flags>
+      <output>System.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_tv/secxml/System.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_tv_System.dll.sources</response>
+    </project>
+    <project dir="class/System" library="System-tests-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize -r:./../../class/lib/monotouch_tv/secxml/System.dll -nowarn:618,672,219,67,169,612 -resource:Test/System/test-uri-props.txt,test-uri-props.txt -resource:Test/System/test-uri-props-manual.txt,test-uri-props-manual.txt -resource:Test/System/test-uri-relative-props.txt,test-uri-relative-props.txt</flags>
+      <output>monotouch_tv_System_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_tv_System_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_tv_System_test.dll.response</response>
+    </project>
+    <project dir="class/System.Core" library="System.Core-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig -d:FEATURE_PAL,PFX_LEGACY_3_5,FEATURE_NETCORE -d:INSIDE_SYSCORE -d:LIBC -unsafe -d:FEATURE_CORE_DLR -d:MONO_INTERPRETER -r:./../../class/lib/monotouch_tv/System.dll -r:./../../class/lib/monotouch_tv/Mono.Dynamic.Interpreter.dll</flags>
+      <output>System.Core.dll</output>
+      <built_sources>../corlib/CommonCrypto/AesManaged.g.cs ../corlib/CommonCrypto/AesCryptoServiceProvider.g.cs</built_sources>
+      <library_output>./../../class/lib/monotouch_tv/System.Core.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_tv_System.Core.dll.sources</response>
+    </project>
+    <project dir="class/System.Core" library="System.Core-tests-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize -r:./../../class/lib/monotouch_tv/plaincore/System.Core.dll -d:FEATURE_PAL,PFX_LEGACY_3_5,FEATURE_NETCORE -d:INSIDE_SYSCORE -d:LIBC -unsafe -d:FEATURE_CORE_DLR -r:./../../class/lib/monotouch_tv/System.dll</flags>
+      <output>monotouch_tv_System.Core_test.dll</output>
+      <built_sources>../corlib/CommonCrypto/AesManaged.g.cs ../corlib/CommonCrypto/AesCryptoServiceProvider.g.cs</built_sources>
+      <library_output>monotouch_tv_System.Core_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_tv_System.Core_test.dll.response</response>
+    </project>
+    <project dir="class/System.Core" library="System.Core-plaincore-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig -d:FEATURE_PAL,PFX_LEGACY_3_5,FEATURE_NETCORE -d:INSIDE_SYSCORE -d:LIBC -unsafe -d:FEATURE_CORE_DLR -r:./../../class/lib/monotouch_tv/System.dll</flags>
+      <output>System.Core.dll</output>
+      <built_sources>../corlib/CommonCrypto/AesManaged.g.cs ../corlib/CommonCrypto/AesCryptoServiceProvider.g.cs</built_sources>
+      <library_output>./../../class/lib/monotouch_tv/plaincore/System.Core.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_tv_System.Core.dll.sources</response>
+    </project>
+    <project dir="class/System.Core" library="System.Core-tests-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize -r:./../../class/lib/monotouch_tv/plaincore/System.Core.dll -d:FEATURE_PAL,PFX_LEGACY_3_5,FEATURE_NETCORE -d:INSIDE_SYSCORE -d:LIBC -unsafe -d:FEATURE_CORE_DLR -r:./../../class/lib/monotouch_tv/System.dll</flags>
+      <output>monotouch_tv_System.Core_test.dll</output>
+      <built_sources>../corlib/CommonCrypto/AesManaged.g.cs ../corlib/CommonCrypto/AesCryptoServiceProvider.g.cs</built_sources>
+      <library_output>monotouch_tv_System.Core_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_tv_System.Core_test.dll.response</response>
+    </project>
+    <project dir="class/System.Security" library="System.Security-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig -nowarn:618 -d:SECURITY_DEP -nowarn:414 -r:./../../class/lib/monotouch_tv/secxml/System.dll -r:./../../class/lib/monotouch_tv/bare/System.Xml.dll -r:./../../class/lib/monotouch_tv/Mono.Security.dll</flags>
+      <output>System.Security.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_tv/System.Security.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_tv_System.Security.dll.sources</response>
+    </project>
+    <project dir="class/System.Security" library="System.Security-tests-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize -r:./../../class/lib/monotouch_tv/System.Security.dll -nowarn:618 -d:SECURITY_DEP -nowarn:414 -r:./../../class/lib/monotouch_tv/secxml/System.dll -r:./../../class/lib/monotouch_tv/bare/System.Xml.dll -r:./../../class/lib/monotouch_tv/Mono.Security.dll -nowarn:168,169,183,219,414</flags>
+      <output>monotouch_tv_System.Security_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_tv_System.Security_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_tv_System.Security_test.dll.response</response>
+    </project>
+    <project dir="class/System.XML" library="System.Xml-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig -nowarn:219,414,649,1717 -unsafe -d:ASYNC -d:AGCLR -d:DISABLE_XSLT_COMPILER -d:DISABLE_XSLT_SCRIPT,MONO_HYBRID_SYSTEM_XML -d:DISABLE_CAS_USE -r:./../../class/lib/monotouch_tv/secxml/System.dll</flags>
+      <output>System.Xml.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_tv/System.Xml.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_tv_System.Xml.dll.sources</response>
+    </project>
+    <project dir="class/System.XML" library="System.Xml-tests-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize -r:./../../class/lib/monotouch_tv/bare/System.Xml.dll -nowarn:219,414,649,1717 -unsafe -d:ASYNC -d:AGCLR -d:DISABLE_XSLT_COMPILER -d:DISABLE_XSLT_SCRIPT,MONO_HYBRID_SYSTEM_XML -d:DISABLE_CAS_USE -r:./../../class/lib/monotouch_tv/bare/System.dll -nowarn:0618 -nowarn:219 -nowarn:169</flags>
+      <output>monotouch_tv_System.Xml_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_tv_System.Xml_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_tv_System.Xml_test.dll.response</response>
+    </project>
+    <project dir="class/System.XML" library="System.Xml-bare-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig -nowarn:219,414,649,1717 -unsafe -d:ASYNC -d:AGCLR -d:DISABLE_XSLT_COMPILER -d:DISABLE_XSLT_SCRIPT,MONO_HYBRID_SYSTEM_XML -d:DISABLE_CAS_USE -r:./../../class/lib/monotouch_tv/bare/System.dll</flags>
+      <output>System.Xml.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_tv/bare/System.Xml.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_tv_System.Xml.dll.sources</response>
+    </project>
+    <project dir="class/System.XML" library="System.Xml-tests-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize -r:./../../class/lib/monotouch_tv/bare/System.Xml.dll -nowarn:219,414,649,1717 -unsafe -d:ASYNC -d:AGCLR -d:DISABLE_XSLT_COMPILER -d:DISABLE_XSLT_SCRIPT,MONO_HYBRID_SYSTEM_XML -d:DISABLE_CAS_USE -r:./../../class/lib/monotouch_tv/bare/System.dll -nowarn:0618 -nowarn:219 -nowarn:169</flags>
+      <output>monotouch_tv_System.Xml_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_tv_System.Xml_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_tv_System.Xml_test.dll.response</response>
+    </project>
+    <project dir="class/I18N/Common" library="I18N-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 /unsafe /define:DISABLE_UNSAFE -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig</flags>
+      <output>I18N.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/I18N.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>I18N.dll.sources</response>
+    </project>
+    <project dir="class/I18N/West" library="I18N.West-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 /unsafe -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig -r:./../../../class/lib/monotouch_tv/I18N.dll</flags>
+      <output>I18N.West.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/I18N.West.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>I18N.West.dll.sources</response>
+    </project>
+    <project dir="class/I18N/West" library="I18N.West-tests-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 /unsafe -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize -r:./../../../class/lib/monotouch_tv/I18N.West.dll</flags>
+      <output>monotouch_tv_I18N.West_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_tv_I18N.West_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>./../../../build/deps/monotouch_tv_I18N.West_test.dll.response</response>
+    </project>
+    <project dir="class/I18N/MidEast" library="I18N.MidEast-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 /unsafe -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig -r:./../../../class/lib/monotouch_tv/I18N.dll</flags>
+      <output>I18N.MidEast.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/I18N.MidEast.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>I18N.MidEast.dll.sources</response>
+    </project>
+    <project dir="class/I18N/MidEast" library="I18N.MidEast-tests-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 /unsafe -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize -r:./../../../class/lib/monotouch_tv/I18N.MidEast.dll</flags>
+      <output>monotouch_tv_I18N.MidEast_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_tv_I18N.MidEast_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>./../../../build/deps/monotouch_tv_I18N.MidEast_test.dll.response</response>
+    </project>
+    <project dir="class/I18N/Other" library="I18N.Other-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 /unsafe -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig -r:./../../../class/lib/monotouch_tv/I18N.dll</flags>
+      <output>I18N.Other.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/I18N.Other.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>I18N.Other.dll.sources</response>
+    </project>
+    <project dir="class/I18N/Rare" library="I18N.Rare-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 /unsafe -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig -r:./../../../class/lib/monotouch_tv/I18N.dll</flags>
+      <output>I18N.Rare.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/I18N.Rare.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>I18N.Rare.dll.sources</response>
+    </project>
+    <project dir="class/I18N/CJK" library="I18N.CJK-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 /unsafe /resource:big5.table /resource:gb2312.table /resource:jis.table /resource:ks.table /resource:gb18030.table /define:DISABLE_UNSAFE -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig -r:./../../../class/lib/monotouch_tv/I18N.dll</flags>
+      <output>I18N.CJK.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/I18N.CJK.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>I18N.CJK.dll.sources</response>
+    </project>
+    <project dir="class/I18N/CJK" library="I18N.CJK-tests-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 /unsafe /resource:big5.table /resource:gb2312.table /resource:jis.table /resource:ks.table /resource:gb18030.table /define:DISABLE_UNSAFE -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize -r:./../../../class/lib/monotouch_tv/I18N.CJK.dll</flags>
+      <output>monotouch_tv_I18N.CJK_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_tv_I18N.CJK_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>./../../../build/deps/monotouch_tv_I18N.CJK_test.dll.response</response>
+    </project>
+    <project dir="class/System.ServiceModel.Internals" library="System.ServiceModel.Internals-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /unsafe -r:./../../class/lib/monotouch_tv/System.dll -r:./../../class/lib/monotouch_tv/System.Core.dll -r:./../../class/lib/monotouch_tv/System.Xml.dll</flags>
+      <output>System.ServiceModel.Internals.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_tv/System.ServiceModel.Internals.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_tv_System.ServiceModel.Internals.dll.sources</response>
+    </project>
+    <project dir="class/System.Runtime.Serialization" library="System.Runtime.Serialization-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig -unsafe -d:NO_DYNAMIC_CODEGEN /nowarn:168,169,219,414 /d:NO_CONFIGURATION /d:NO_SECURITY_ATTRIBUTES /d:NO_CODEDOM /d:NO_DESKTOP_SECURITY -r:./../../class/lib/monotouch_tv/System.dll -r:./../../class/lib/monotouch_tv/System.Xml.dll -r:./../../class/lib/monotouch_tv/System.Core.dll -r:./../../class/lib/monotouch_tv/System.ServiceModel.Internals.dll</flags>
+      <output>System.Runtime.Serialization.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_tv/System.Runtime.Serialization.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_tv_System.Runtime.Serialization.dll.sources</response>
+    </project>
+    <project dir="class/System.Runtime.Serialization" library="System.Runtime.Serialization-tests-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize -r:./../../class/lib/monotouch_tv/System.Runtime.Serialization.dll -unsafe -d:NO_DYNAMIC_CODEGEN /nowarn:168,169,219,414 /d:NO_CONFIGURATION /d:NO_SECURITY_ATTRIBUTES /d:NO_CODEDOM /d:NO_DESKTOP_SECURITY -r:./../../class/lib/monotouch_tv/System.dll -r:./../../class/lib/monotouch_tv/System.Xml.dll -r:./../../class/lib/monotouch_tv/System.Core.dll -r:./../../class/lib/monotouch_tv/System.ServiceModel.Internals.dll /resource:Test/Resources/WSDL/collections.wsdl /resource:Test/Resources/WSDL/custom-collections.wsdl</flags>
+      <output>monotouch_tv_System.Runtime.Serialization_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_tv_System.Runtime.Serialization_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_tv_System.Runtime.Serialization_test.dll.response</response>
+    </project>
+    <project dir="class/System.Xml.Linq" library="System.Xml.Linq-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig -d:FEATURE_SERIALIZATION -d:MONO_HYBRID_SYSTEM_XML -r:./../../class/lib/monotouch_tv/System.dll -r:./../../class/lib/monotouch_tv/System.Core.dll -r:./../../class/lib/monotouch_tv/System.Xml.dll -r:./../../class/lib/monotouch_tv/System.Runtime.Serialization.dll</flags>
+      <output>System.Xml.Linq.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_tv/System.Xml.Linq.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Xml.Linq.dll.sources</response>
+    </project>
+    <project dir="class/System.Xml.Linq" library="System.Xml.Linq-tests-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize -r:./../../class/lib/monotouch_tv/System.Xml.Linq.dll -d:FEATURE_SERIALIZATION -d:MONO_HYBRID_SYSTEM_XML -r:./../../class/lib/monotouch_tv/System.dll -r:./../../class/lib/monotouch_tv/System.Core.dll -r:./../../class/lib/monotouch_tv/System.Xml.dll -r:./../../class/lib/monotouch_tv/System.Runtime.Serialization.dll</flags>
+      <output>monotouch_tv_System.Xml.Linq_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_tv_System.Xml.Linq_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_tv_System.Xml.Linq_test.dll.response</response>
+    </project>
+    <project dir="class/System.IdentityModel" library="System.IdentityModel-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /d:NET_3_0 -r:./../../class/lib/monotouch_tv/System.dll -r:./../../class/lib/monotouch_tv/System.Xml.dll -r:./../../class/lib/monotouch_tv/System.Security.dll -r:./../../class/lib/monotouch_tv/Mono.Security.dll -r:./../../class/lib/monotouch_tv/System.Runtime.Serialization.dll</flags>
+      <output>System.IdentityModel.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_tv/System.IdentityModel.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_tv_System.IdentityModel.dll.sources</response>
+    </project>
+    <project dir="class/System.IdentityModel" library="System.IdentityModel-tests-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize -r:./../../class/lib/monotouch_tv/System.IdentityModel.dll /d:NET_3_0 -r:./../../class/lib/monotouch_tv/System.dll -r:./../../class/lib/monotouch_tv/System.Xml.dll -r:./../../class/lib/monotouch_tv/System.Security.dll -r:./../../class/lib/monotouch_tv/Mono.Security.dll -r:./../../class/lib/monotouch_tv/System.Runtime.Serialization.dll</flags>
+      <output>monotouch_tv_System.IdentityModel_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_tv_System.IdentityModel_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_tv_System.IdentityModel_test.dll.response</response>
+    </project>
+    <project dir="class/System.ServiceModel" library="System.ServiceModel-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /nowarn:414,169,67,3005,436,219,618 /unsafe /d:TRACE /resource:resources/WS-Addressing.schema /resource:resources/ws-addr.xsd -r:./../../class/lib/monotouch_tv/System.dll -r:./../../class/lib/monotouch_tv/System.Xml.dll -r:./../../class/lib/monotouch_tv/System.Core.dll -r:./../../class/lib/monotouch_tv/System.Runtime.Serialization.dll -r:./../../class/lib/monotouch_tv/System.IdentityModel.dll</flags>
+      <output>System.ServiceModel.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_tv/System.ServiceModel.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_tv_System.ServiceModel.dll.sources</response>
+    </project>
+    <project dir="class/System.ServiceModel" library="System.ServiceModel-tests-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize -r:./../../class/lib/monotouch_tv/plainservice/System.ServiceModel.dll /nowarn:414,169,67,3005,436,219,618 /unsafe /d:TRACE /resource:resources/WS-Addressing.schema /resource:resources/ws-addr.xsd -r:./../../class/lib/monotouch_tv/System.dll -r:./../../class/lib/monotouch_tv/System.Xml.dll -r:./../../class/lib/monotouch_tv/System.Core.dll -r:./../../class/lib/monotouch_tv/System.Runtime.Serialization.dll -r:./../../class/lib/monotouch_tv/System.IdentityModel.dll</flags>
+      <output>monotouch_tv_System.ServiceModel_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_tv_System.ServiceModel_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_tv_System.ServiceModel_test.dll.response</response>
+    </project>
+    <project dir="class/System.ServiceModel" library="System.ServiceModel-plainservice-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /nowarn:414,169,67,3005,436,219,618 /unsafe /d:TRACE /resource:resources/WS-Addressing.schema /resource:resources/ws-addr.xsd -r:./../../class/lib/monotouch_tv/System.dll -r:./../../class/lib/monotouch_tv/System.Xml.dll -r:./../../class/lib/monotouch_tv/System.Core.dll -r:./../../class/lib/monotouch_tv/System.Runtime.Serialization.dll -r:./../../class/lib/monotouch_tv/System.IdentityModel.dll</flags>
+      <output>System.ServiceModel.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_tv/plainservice/System.ServiceModel.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_tv_System.ServiceModel.dll.sources</response>
+    </project>
+    <project dir="class/System.ServiceModel" library="System.ServiceModel-tests-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize -r:./../../class/lib/monotouch_tv/plainservice/System.ServiceModel.dll /nowarn:414,169,67,3005,436,219,618 /unsafe /d:TRACE /resource:resources/WS-Addressing.schema /resource:resources/ws-addr.xsd -r:./../../class/lib/monotouch_tv/System.dll -r:./../../class/lib/monotouch_tv/System.Xml.dll -r:./../../class/lib/monotouch_tv/System.Core.dll -r:./../../class/lib/monotouch_tv/System.Runtime.Serialization.dll -r:./../../class/lib/monotouch_tv/System.IdentityModel.dll</flags>
+      <output>monotouch_tv_System.ServiceModel_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_tv_System.ServiceModel_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_tv_System.ServiceModel_test.dll.response</response>
+    </project>
+    <project dir="class/System.ServiceModel.Web" library="System.ServiceModel.Web-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig -r:./../../class/lib/monotouch_tv/System.dll -r:./../../class/lib/monotouch_tv/System.Xml.dll -r:./../../class/lib/monotouch_tv/System.Runtime.Serialization.dll -r:./../../class/lib/monotouch_tv/System.ServiceModel.dll -r:./../../class/lib/monotouch_tv/System.Core.dll</flags>
+      <output>System.ServiceModel.Web.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_tv/System.ServiceModel.Web.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_tv_System.ServiceModel.Web.dll.sources</response>
+    </project>
+    <project dir="class/System.ServiceModel.Web" library="System.ServiceModel.Web-tests-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize -r:./../../class/lib/monotouch_tv/System.ServiceModel.Web.dll -r:./../../class/lib/monotouch_tv/System.dll -r:./../../class/lib/monotouch_tv/System.Xml.dll -r:./../../class/lib/monotouch_tv/System.Runtime.Serialization.dll -r:./../../class/lib/monotouch_tv/System.ServiceModel.dll -r:./../../class/lib/monotouch_tv/System.Core.dll</flags>
+      <output>monotouch_tv_System.ServiceModel.Web_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_tv_System.ServiceModel.Web_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_tv_System.ServiceModel.Web_test.dll.response</response>
+    </project>
+    <project dir="class/System.Json" library="System.Json-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig -r:./../../class/lib/monotouch_tv/System.dll -r:./../../class/lib/monotouch_tv/System.Xml.dll -r:./../../class/lib/monotouch_tv/System.Core.dll</flags>
+      <output>System.Json.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_tv/System.Json.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Json.dll.sources</response>
+    </project>
+    <project dir="class/System.Json" library="System.Json-tests-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize -r:./../../class/lib/monotouch_tv/System.Json.dll -r:./../../class/lib/monotouch_tv/System.dll -r:./../../class/lib/monotouch_tv/System.Xml.dll -r:./../../class/lib/monotouch_tv/System.Core.dll</flags>
+      <output>monotouch_tv_System.Json_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_tv_System.Json_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_tv_System.Json_test.dll.response</response>
+    </project>
+    <project dir="class/System.Web.Services" library="System.Web.Services-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig -nowarn:649 -nowarn:169 -resource:System.Web.Services.Description/wsdl-1.1.xsd,wsdl-1.1.xsd -resource:System.Web.Services.Description/wsdl-1.1-soap.xsd,wsdl-1.1-soap.xsd -resource:System.Web.Services.Description/web-reference.xsd,web-reference.xsd -r:./../../class/lib/monotouch_tv/System.dll -r:./../../class/lib/monotouch_tv/System.Xml.dll</flags>
+      <output>System.Web.Services.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_tv/System.Web.Services.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_tv_System.Web.Services.dll.sources</response>
+    </project>
+    <project dir="class/System.Web.Services" library="System.Web.Services-tests-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize -r:./../../class/lib/monotouch_tv/System.Web.Services.dll -nowarn:649 -nowarn:169 -resource:System.Web.Services.Description/wsdl-1.1.xsd,wsdl-1.1.xsd -resource:System.Web.Services.Description/wsdl-1.1-soap.xsd,wsdl-1.1-soap.xsd -resource:System.Web.Services.Description/web-reference.xsd,web-reference.xsd -r:./../../class/lib/monotouch_tv/System.dll -r:./../../class/lib/monotouch_tv/System.Xml.dll -nowarn:618</flags>
+      <output>monotouch_tv_System.Web.Services_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_tv_System.Web.Services_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_tv_System.Web.Services_test.dll.response</response>
+    </project>
+    <project dir="class/Mono.Data.Tds" library="Mono.Data.Tds-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig -r:./../../class/lib/monotouch_tv/System.dll -r:./../../class/lib/monotouch_tv/System.Xml.dll -r:./../../class/lib/monotouch_tv/Mono.Security.dll</flags>
+      <output>Mono.Data.Tds.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_tv/Mono.Data.Tds.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>Mono.Data.Tds.dll.sources</response>
+    </project>
+    <project dir="class/Mono.Data.Tds" library="Mono.Data.Tds-tests-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize -r:./../../class/lib/monotouch_tv/Mono.Data.Tds.dll</flags>
+      <output>monotouch_tv_Mono.Data.Tds_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_tv_Mono.Data.Tds_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_tv_Mono.Data.Tds_test.dll.response</response>
+    </project>
+    <project dir="class/System.Transactions" library="System.Transactions-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /define:MOBILE -r:./../../class/lib/monotouch_tv/System.dll</flags>
+      <output>System.Transactions.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_tv/System.Transactions.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Transactions.dll.sources</response>
+    </project>
+    <project dir="class/System.Transactions" library="System.Transactions-tests-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize -r:./../../class/lib/monotouch_tv/System.Transactions.dll /define:MOBILE -r:./../../class/lib/monotouch_tv/System.dll</flags>
+      <output>monotouch_tv_System.Transactions_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_tv_System.Transactions_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_tv_System.Transactions_test.dll.response</response>
+    </project>
+    <project dir="class/System.Numerics" library="System.Numerics-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /unsafe -nowarn:414 -r:./../../class/lib/monotouch_tv/System.dll</flags>
+      <output>System.Numerics.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_tv/System.Numerics.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Numerics.dll.sources</response>
+    </project>
+    <project dir="class/System.Numerics" library="System.Numerics-tests-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize -r:./../../class/lib/monotouch_tv/System.Numerics.dll /unsafe -nowarn:414 -r:./../../class/lib/monotouch_tv/System.dll</flags>
+      <output>monotouch_tv_System.Numerics_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_tv_System.Numerics_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_tv_System.Numerics_test.dll.response</response>
+    </project>
+    <project dir="class/System.Numerics.Vectors" library="System.Numerics.Vectors-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig -unsafe -r:./../../class/lib/monotouch_tv/System.dll -r:./../../class/lib/monotouch_tv/System.Numerics.dll</flags>
+      <output>System.Numerics.Vectors.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_tv/System.Numerics.Vectors.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Numerics.Vectors.dll.sources</response>
+    </project>
+    <project dir="class/System.Data" library="System.Data-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig -nowarn:219,414,649 -d:PLATFORM_UNIX -d:USEOFFSET -d:MONO_PARTIAL_DATA_IMPORT -unsafe -d:NO_CODEDOM -d:NO_OLEDB -d:NO_ODBC -d:NO_CONFIGURATION -r:./../../class/lib/monotouch_tv/System.dll -r:./../../class/lib/monotouch_tv/System.Xml.dll -r:./../../class/lib/monotouch_tv/System.Core.dll -r:./../../class/lib/monotouch_tv/System.Numerics.dll -r:./../../class/lib/monotouch_tv/Mono.Data.Tds.dll -r:./../../class/lib/monotouch_tv/System.Transactions.dll</flags>
+      <output>System.Data.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_tv/System.Data.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_tv_System.Data.dll.sources</response>
+    </project>
+    <project dir="class/System.Data" library="System.Data-tests-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize -r:./../../class/lib/monotouch_tv/System.Data.dll -nowarn:219,414,649 -d:PLATFORM_UNIX -d:USEOFFSET -d:MONO_PARTIAL_DATA_IMPORT -unsafe -d:NO_CODEDOM -d:NO_OLEDB -d:NO_ODBC -d:NO_CONFIGURATION -r:./../../class/lib/monotouch_tv/System.dll -r:./../../class/lib/monotouch_tv/System.Xml.dll -r:./../../class/lib/monotouch_tv/System.Core.dll -r:./../../class/lib/monotouch_tv/System.Numerics.dll -r:./../../class/lib/monotouch_tv/Mono.Data.Tds.dll -r:./../../class/lib/monotouch_tv/System.Transactions.dll -nowarn:618,169,612,219,168</flags>
+      <output>monotouch_tv_System.Data_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_tv_System.Data_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_tv_System.Data_test.dll.response</response>
+    </project>
+    <project dir="class/Mono.Data.Sqlite" library="Mono.Data.Sqlite-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /unsafe -resource:resources/SR.resources -resource:resources/SQLiteCommand.bmp -resource:resources/SQLiteConnection.bmp -resource:resources/SQLiteDataAdapter.bmp -d:SQLITE_STANDARD -r:./../../class/lib/monotouch_tv/System.dll -r:./../../class/lib/monotouch_tv/System.Data.dll -r:./../../class/lib/monotouch_tv/System.Transactions.dll -r:./../../class/lib/monotouch_tv/System.Xml.dll</flags>
+      <output>Mono.Data.Sqlite.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_tv/Mono.Data.Sqlite.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>Mono.Data.Sqlite.dll.sources</response>
+    </project>
+    <project dir="class/Mono.Data.Sqlite" library="Mono.Data.Sqlite-tests-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize -r:./../../class/lib/monotouch_tv/Mono.Data.Sqlite.dll /unsafe -resource:resources/SR.resources -resource:resources/SQLiteCommand.bmp -resource:resources/SQLiteConnection.bmp -resource:resources/SQLiteDataAdapter.bmp -d:SQLITE_STANDARD -r:./../../class/lib/monotouch_tv/System.dll -r:./../../class/lib/monotouch_tv/System.Data.dll -r:./../../class/lib/monotouch_tv/System.Transactions.dll -r:./../../class/lib/monotouch_tv/System.Xml.dll /nowarn:618</flags>
+      <output>monotouch_tv_Mono.Data.Sqlite_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_tv_Mono.Data.Sqlite_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_tv_Mono.Data.Sqlite_test.dll.response</response>
+    </project>
+    <project dir="class/System.Data.Services.Client" library="System.Data.Services.Client-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig -d:NET_3_5 -warn:2 -r:./../../class/lib/monotouch_tv/System.dll -r:./../../class/lib/monotouch_tv/System.Core.dll -r:./../../class/lib/monotouch_tv/System.Xml.Linq.dll -r:./../../class/lib/monotouch_tv/System.Data.dll -r:./../../class/lib/monotouch_tv/System.Xml.dll</flags>
+      <output>System.Data.Services.Client.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_tv/System.Data.Services.Client.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources>System.Data.Services.Client,Client/System.Data.Services.Client.txt</resources>
+      <response>System.Data.Services.Client.dll.sources</response>
+    </project>
+    <project dir="class/System.IO.Compression" library="System.IO.Compression-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /unsafe -r:./../../class/lib/monotouch_tv/System.dll -r:./../../class/lib/monotouch_tv/System.Core.dll</flags>
+      <output>System.IO.Compression.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_tv/System.IO.Compression.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.IO.Compression.dll.sources</response>
+    </project>
+    <project dir="class/System.IO.Compression" library="System.IO.Compression-tests-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize -r:./../../class/lib/monotouch_tv/System.IO.Compression.dll</flags>
+      <output>monotouch_tv_System.IO.Compression_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_tv_System.IO.Compression_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_tv_System.IO.Compression_test.dll.response</response>
+    </project>
+    <project dir="class/System.IO.Compression.FileSystem" library="System.IO.Compression.FileSystem-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig -r:./../../class/lib/monotouch_tv/System.dll -r:./../../class/lib/monotouch_tv/System.IO.Compression.dll</flags>
+      <output>System.IO.Compression.FileSystem.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_tv/System.IO.Compression.FileSystem.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.IO.Compression.FileSystem.dll.sources</response>
+    </project>
+    <project dir="class/System.IO.Compression.FileSystem" library="System.IO.Compression.FileSystem-tests-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize -r:./../../class/lib/monotouch_tv/System.IO.Compression.FileSystem.dll</flags>
+      <output>monotouch_tv_System.IO.Compression.FileSystem_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_tv_System.IO.Compression.FileSystem_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_tv_System.IO.Compression.FileSystem_test.dll.response</response>
+    </project>
+    <project dir="class/System.ComponentModel.DataAnnotations" library="System.ComponentModel.DataAnnotations-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig -nowarn:414 -r:./../../class/lib/monotouch_tv/System.dll -r:./../../class/lib/monotouch_tv/System.Core.dll -r:./../../class/lib/monotouch_tv/System.Data.dll -r:./../../class/lib/monotouch_tv/System.Xml.dll</flags>
+      <output>System.ComponentModel.DataAnnotations.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_tv/System.ComponentModel.DataAnnotations.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.ComponentModel.DataAnnotations.dll.sources</response>
+    </project>
+    <project dir="class/System.ComponentModel.DataAnnotations" library="System.ComponentModel.DataAnnotations-tests-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize -r:./../../class/lib/monotouch_tv/System.ComponentModel.DataAnnotations.dll -nowarn:414 -r:./../../class/lib/monotouch_tv/System.dll -r:./../../class/lib/monotouch_tv/System.Core.dll -r:./../../class/lib/monotouch_tv/System.Data.dll -r:./../../class/lib/monotouch_tv/System.Xml.dll</flags>
+      <output>monotouch_tv_System.ComponentModel.DataAnnotations_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_tv_System.ComponentModel.DataAnnotations_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_tv_System.ComponentModel.DataAnnotations_test.dll.response</response>
+    </project>
+    <project dir="class/System.ComponentModel.Composition.4.5" library="System.ComponentModel.Composition-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig -d:CLR40 -d:USE_ECMA_KEY,FEATURE_REFLECTIONCONTEXT,FEATURE_REFLECTIONFILEIO,FEATURE_SERIALIZATION,FEATURE_SLIMLOCK -nowarn:219,414 -r:./../../class/lib/monotouch_tv/System.dll -r:./../../class/lib/monotouch_tv/System.Core.dll</flags>
+      <output>System.ComponentModel.Composition.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_tv/System.ComponentModel.Composition.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources>Microsoft.Internal.Strings,src/ComponentModel/Strings.resx</resources>
+      <response>System.ComponentModel.Composition.dll.sources</response>
+    </project>
+    <project dir="class/System.Net" library="System.Net-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig -unsafe -r:./../../class/lib/monotouch_tv/System.dll -r:./../../class/lib/monotouch_tv/System.Core.dll -r:./../../class/lib/monotouch_tv/System.Xml.dll</flags>
+      <output>System.Net.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_tv/System.Net.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Net.dll.sources</response>
+    </project>
+    <project dir="class/System.Net.Http" library="System.Net.Http-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig -r:./../../class/lib/monotouch_tv/System.Core.dll -r:./../../class/lib/monotouch_tv/System.dll</flags>
+      <output>System.Net.Http.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_tv/System.Net.Http.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Net.Http.dll.sources</response>
+    </project>
+    <project dir="class/System.Net.Http" library="System.Net.Http-tests-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize -r:./../../class/lib/monotouch_tv/System.Net.Http.dll</flags>
+      <output>monotouch_tv_System.Net.Http_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_tv_System.Net.Http_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_tv_System.Net.Http_test.dll.response</response>
+    </project>
+    <project dir="class/System.Windows" library="System.Windows-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig -r:./../../class/lib/monotouch_tv/System.dll</flags>
+      <output>System.Windows.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_tv/System.Windows.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Windows.dll.sources</response>
+    </project>
+    <project dir="class/System.Xml.Serialization" library="System.Xml.Serialization-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig -r:./../../class/lib/monotouch_tv/System.Xml.dll -r:./../../class/lib/monotouch_tv/System.ServiceModel.dll</flags>
+      <output>System.Xml.Serialization.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_tv/System.Xml.Serialization.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Xml.Serialization.dll.sources</response>
+    </project>
+    <project dir="class/Mono.CSharp" library="Mono.CSharp-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig -d:IOS_REFLECTION -r:./../../class/lib/monotouch_tv/System.Core.dll -r:./../../class/lib/monotouch_tv/System.Xml.dll -r:./../../class/lib/monotouch_tv/System.dll</flags>
+      <output>Mono.CSharp.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_tv/Mono.CSharp.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_tv_Mono.CSharp.dll.sources</response>
+    </project>
+    <project dir="class/Mono.CSharp" library="Mono.CSharp-tests-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize -r:./../../class/lib/monotouch_tv/Mono.CSharp.dll</flags>
+      <output>monotouch_tv_Mono.CSharp_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_tv_Mono.CSharp_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_tv_Mono.CSharp_test.dll.response</response>
+    </project>
+    <project dir="class/Microsoft.CSharp" library="Microsoft.CSharp-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig -r:./../../class/lib/monotouch_tv/System.Core.dll -r:./../../class/lib/monotouch_tv/Mono.CSharp.dll</flags>
+      <output>Microsoft.CSharp.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_tv/Microsoft.CSharp.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>Microsoft.CSharp.dll.sources</response>
+    </project>
+    <project dir="class/System.Runtime.InteropServices.RuntimeInformation" library="System.Runtime.InteropServices.RuntimeInformation-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig -r:./../../class/lib/monotouch_tv/System.dll</flags>
+      <output>System.Runtime.InteropServices.RuntimeInformation.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_tv/System.Runtime.InteropServices.RuntimeInformation.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Runtime.InteropServices.RuntimeInformation.dll.sources</response>
+    </project>
+    <project dir="class/System.Reflection.DispatchProxy" library="System.Reflection.DispatchProxy-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig -r:./../../class/lib/monotouch_tv/System.dll</flags>
+      <output>System.Reflection.DispatchProxy.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_tv/System.Reflection.DispatchProxy.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Reflection.DispatchProxy.dll.sources</response>
+    </project>
+    <project dir="class/System.Xml.XPath.XmlDocument" library="System.Xml.XPath.XmlDocument-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig -r:./../../class/lib/monotouch_tv/System.dll -r:./../../class/lib/monotouch_tv/System.Xml.dll</flags>
+      <output>System.Xml.XPath.XmlDocument.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_tv/System.Xml.XPath.XmlDocument.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Xml.XPath.XmlDocument.dll.sources</response>
+    </project>
+    <project dir="class/System.Reflection.Context" library="System.Reflection.Context-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig -r:./../../class/lib/monotouch_tv/System.dll</flags>
+      <output>System.Reflection.Context.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_tv/System.Reflection.Context.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Reflection.Context.dll.sources</response>
+    </project>
+    <project dir="class/System.Net.Http.WinHttpHandler" library="System.Net.Http.WinHttpHandler-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig -r:./../../class/lib/monotouch_tv/System.dll -r:./../../class/lib/monotouch_tv/System.Net.Http.dll</flags>
+      <output>System.Net.Http.WinHttpHandler.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_tv/System.Net.Http.WinHttpHandler.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Net.Http.WinHttpHandler.dll.sources</response>
+    </project>
+    <project dir="class/Mono.Dynamic.Interpreter" library="Mono.Dynamic.Interpreter-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig -d:FEATURE_CORE_DLR,FEATURE_DBNULL,FEATURE_DEFAULT_PARAMETER_VALUE,FEATURE_GET_TYPE_INFO,FEATURE_VARIANCE,FEATURE_SERIALIZATION,CLR45 -d:MONO_INTERPRETER -delaysign -keyfile:../mono.pub -r:./../../class/lib/monotouch_tv/System.dll -r:./../../class/lib/monotouch_tv/plaincore/System.Core.dll</flags>
+      <output>Mono.Dynamic.Interpreter.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_tv/Mono.Dynamic.Interpreter.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>Mono.Dynamic.Interpreter.dll.sources</response>
+    </project>
+    <project dir="class/PEAPI" library="PEAPI-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig -nowarn:414,618 -r:./../../class/lib/monotouch_tv/System.dll</flags>
+      <output>PEAPI.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_tv/PEAPI.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>PEAPI.dll.sources</response>
+    </project>
+    <project dir="class/Mono.CompilerServices.SymbolWriter" library="Mono.CompilerServices.SymbolWriter-monotouch_tv">
+      <boot>true</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig -r:./../../class/lib/monotouch_tv/System.dll</flags>
+      <output>Mono.CompilerServices.SymbolWriter.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_tv/Mono.CompilerServices.SymbolWriter.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>Mono.CompilerServices.SymbolWriter.dll.sources</response>
+    </project>
+    <project dir="class/Mono.Simd" library="Mono.Simd-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /unsafe -r:./../../class/lib/monotouch_tv/System.Core.dll</flags>
+      <output>Mono.Simd.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_tv/Mono.Simd.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>Mono.Simd.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.X509Certificates" library="Facades_System.Security.Cryptography.X509Certificates-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll -r:./../../../class/lib/monotouch_tv/System.Core.dll</flags>
+      <output>System.Security.Cryptography.X509Certificates.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Security.Cryptography.X509Certificates.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.X509Certificates.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.ServiceModel.Primitives" library="Facades_System.ServiceModel.Primitives-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll -r:./../../../class/lib/monotouch_tv/System.ServiceModel.dll -r:./../../../class/lib/monotouch_tv/System.Xml.dll -r:./../../../class/lib/monotouch_tv/System.IdentityModel.dll -r:./../../../class/lib/monotouch_tv/Facades/System.Security.Cryptography.X509Certificates.dll</flags>
+      <output>System.ServiceModel.Primitives.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.ServiceModel.Primitives.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.ServiceModel.Primitives.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Runtime.Serialization.Primitives" library="Facades_System.Runtime.Serialization.Primitives-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.Runtime.Serialization.dll</flags>
+      <output>System.Runtime.Serialization.Primitives.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Runtime.Serialization.Primitives.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Runtime.Serialization.Primitives.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Runtime.Serialization.Xml" library="Facades_System.Runtime.Serialization.Xml-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 /d:NO_CODEDOM -r:./../../../class/lib/monotouch_tv/System.dll -r:./../../../class/lib/monotouch_tv/System.Runtime.Serialization.dll -r:./../../../class/lib/monotouch_tv/System.Xml.dll -r:./../../../class/lib/monotouch_tv/Facades/System.Runtime.Serialization.Primitives.dll</flags>
+      <output>System.Runtime.Serialization.Xml.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Runtime.Serialization.Xml.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Runtime.Serialization.Xml.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.Algorithms" library="Facades_System.Security.Cryptography.Algorithms-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll -r:./../../../class/lib/monotouch_tv/System.Core.dll</flags>
+      <output>System.Security.Cryptography.Algorithms.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Security.Cryptography.Algorithms.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.Algorithms.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.OpenSsl" library="Facades_System.Security.Cryptography.OpenSsl-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.Core.dll -r:./../../../class/lib/monotouch_tv/Facades/System.Security.Cryptography.Algorithms.dll</flags>
+      <output>System.Security.Cryptography.OpenSsl.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Security.Cryptography.OpenSsl.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.OpenSsl.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Collections.Concurrent" library="Facades_System.Collections.Concurrent-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll</flags>
+      <output>System.Collections.Concurrent.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Collections.Concurrent.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Collections.Concurrent.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Collections" library="Facades_System.Collections-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll -r:./../../../class/lib/monotouch_tv/System.Core.dll</flags>
+      <output>System.Collections.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Collections.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Collections.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.ComponentModel.Annotations" library="Facades_System.ComponentModel.Annotations-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.ComponentModel.DataAnnotations.dll</flags>
+      <output>System.ComponentModel.Annotations.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.ComponentModel.Annotations.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.ComponentModel.Annotations.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.ComponentModel.EventBasedAsync" library="Facades_System.ComponentModel.EventBasedAsync-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll</flags>
+      <output>System.ComponentModel.EventBasedAsync.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.ComponentModel.EventBasedAsync.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.ComponentModel.EventBasedAsync.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.ComponentModel" library="Facades_System.ComponentModel-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll</flags>
+      <output>System.ComponentModel.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.ComponentModel.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.ComponentModel.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Diagnostics.Contracts" library="Facades_System.Diagnostics.Contracts-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Diagnostics.Contracts.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Diagnostics.Contracts.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Diagnostics.Contracts.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Diagnostics.Debug" library="Facades_System.Diagnostics.Debug-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll</flags>
+      <output>System.Diagnostics.Debug.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Diagnostics.Debug.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Diagnostics.Debug.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Diagnostics.Tracing" library="Facades_System.Diagnostics.Tracing-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Diagnostics.Tracing.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Diagnostics.Tracing.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Diagnostics.Tracing.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Diagnostics.Tools" library="Facades_System.Diagnostics.Tools-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll</flags>
+      <output>System.Diagnostics.Tools.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Diagnostics.Tools.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Diagnostics.Tools.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Dynamic.Runtime" library="Facades_System.Dynamic.Runtime-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.Core.dll -r:./../../../class/lib/monotouch_tv/System.dll</flags>
+      <output>System.Dynamic.Runtime.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Dynamic.Runtime.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Dynamic.Runtime.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Globalization" library="Facades_System.Globalization-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Globalization.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Globalization.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Globalization.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.IO" library="Facades_System.IO-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll</flags>
+      <output>System.IO.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.IO.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.IO.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Linq.Expressions" library="Facades_System.Linq.Expressions-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.Core.dll</flags>
+      <output>System.Linq.Expressions.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Linq.Expressions.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Linq.Expressions.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Linq.Parallel" library="Facades_System.Linq.Parallel-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.Core.dll</flags>
+      <output>System.Linq.Parallel.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Linq.Parallel.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Linq.Parallel.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Linq.Queryable" library="Facades_System.Linq.Queryable-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.Core.dll</flags>
+      <output>System.Linq.Queryable.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Linq.Queryable.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Linq.Queryable.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Linq" library="Facades_System.Linq-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.Core.dll</flags>
+      <output>System.Linq.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Linq.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Linq.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.NetworkInformation" library="Facades_System.Net.NetworkInformation-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll</flags>
+      <output>System.Net.NetworkInformation.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Net.NetworkInformation.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Net.NetworkInformation.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.Primitives" library="Facades_System.Net.Primitives-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll</flags>
+      <output>System.Net.Primitives.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Net.Primitives.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Net.Primitives.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.Requests" library="Facades_System.Net.Requests-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll</flags>
+      <output>System.Net.Requests.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Net.Requests.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Net.Requests.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.ObjectModel" library="Facades_System.ObjectModel-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll</flags>
+      <output>System.ObjectModel.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.ObjectModel.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.ObjectModel.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Reflection.Extensions" library="Facades_System.Reflection.Extensions-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Reflection.Extensions.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Reflection.Extensions.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Reflection.Extensions.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Reflection.Primitives" library="Facades_System.Reflection.Primitives-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Reflection.Primitives.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Reflection.Primitives.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Reflection.Primitives.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Reflection" library="Facades_System.Reflection-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Reflection.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Reflection.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Reflection.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Resources.ResourceManager" library="Facades_System.Resources.ResourceManager-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Resources.ResourceManager.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Resources.ResourceManager.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Resources.ResourceManager.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Runtime.Extensions" library="Facades_System.Runtime.Extensions-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll</flags>
+      <output>System.Runtime.Extensions.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Runtime.Extensions.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Runtime.Extensions.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Runtime.InteropServices" library="Facades_System.Runtime.InteropServices-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll -r:./../../../class/lib/monotouch_tv/System.Core.dll</flags>
+      <output>System.Runtime.InteropServices.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Runtime.InteropServices.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Runtime.InteropServices.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Runtime.InteropServices.WindowsRuntime" library="Facades_System.Runtime.InteropServices.WindowsRuntime-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Runtime.InteropServices.WindowsRuntime.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Runtime.InteropServices.WindowsRuntime.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Runtime.InteropServices.WindowsRuntime.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Runtime.Numerics" library="Facades_System.Runtime.Numerics-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.Numerics.dll</flags>
+      <output>System.Runtime.Numerics.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Runtime.Numerics.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Runtime.Numerics.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Runtime.Serialization.Json" library="Facades_System.Runtime.Serialization.Json-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.Runtime.Serialization.dll</flags>
+      <output>System.Runtime.Serialization.Json.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Runtime.Serialization.Json.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Runtime.Serialization.Json.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Runtime" library="Facades_System.Runtime-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll -r:./../../../class/lib/monotouch_tv/System.ComponentModel.Composition.dll -r:./../../../class/lib/monotouch_tv/System.Core.dll</flags>
+      <output>System.Runtime.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Runtime.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Runtime.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Principal" library="Facades_System.Security.Principal-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Security.Principal.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Security.Principal.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Security.Principal.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.ServiceModel.Http" library="Facades_System.ServiceModel.Http-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.ServiceModel.dll</flags>
+      <output>System.ServiceModel.Http.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.ServiceModel.Http.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.ServiceModel.Http.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.ServiceModel.Security" library="Facades_System.ServiceModel.Security-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.ServiceModel.dll</flags>
+      <output>System.ServiceModel.Security.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.ServiceModel.Security.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.ServiceModel.Security.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Text.Encoding.Extensions" library="Facades_System.Text.Encoding.Extensions-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Text.Encoding.Extensions.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Text.Encoding.Extensions.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Text.Encoding.Extensions.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Text.Encoding" library="Facades_System.Text.Encoding-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Text.Encoding.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Text.Encoding.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Text.Encoding.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Text.RegularExpressions" library="Facades_System.Text.RegularExpressions-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll</flags>
+      <output>System.Text.RegularExpressions.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Text.RegularExpressions.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Text.RegularExpressions.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Threading.Tasks.Parallel" library="Facades_System.Threading.Tasks.Parallel-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Threading.Tasks.Parallel.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Threading.Tasks.Parallel.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Threading.Tasks.Parallel.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Threading.Tasks" library="Facades_System.Threading.Tasks-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.Core.dll</flags>
+      <output>System.Threading.Tasks.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Threading.Tasks.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Threading.Tasks.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Threading.Timer" library="Facades_System.Threading.Timer-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll -r:./../../../class/lib/monotouch_tv/System.Core.dll</flags>
+      <output>System.Threading.Timer.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Threading.Timer.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Threading.Timer.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Threading" library="Facades_System.Threading-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll -r:./../../../class/lib/monotouch_tv/System.Core.dll</flags>
+      <output>System.Threading.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Threading.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Threading.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Xml.ReaderWriter" library="Facades_System.Xml.ReaderWriter-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.Xml.dll</flags>
+      <output>System.Xml.ReaderWriter.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Xml.ReaderWriter.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Xml.ReaderWriter.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Xml.XDocument" library="Facades_System.Xml.XDocument-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.Xml.Linq.dll -r:./../../../class/lib/monotouch_tv/System.Xml.dll</flags>
+      <output>System.Xml.XDocument.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Xml.XDocument.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Xml.XDocument.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Xml.XmlSerializer" library="Facades_System.Xml.XmlSerializer-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.Xml.dll</flags>
+      <output>System.Xml.XmlSerializer.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Xml.XmlSerializer.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Xml.XmlSerializer.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Runtime.Handles" library="Facades_System.Runtime.Handles-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll -r:./../../../class/lib/monotouch_tv/System.Core.dll</flags>
+      <output>System.Runtime.Handles.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Runtime.Handles.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Runtime.Handles.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.ServiceModel.Duplex" library="Facades_System.ServiceModel.Duplex-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.ServiceModel.dll</flags>
+      <output>System.ServiceModel.Duplex.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.ServiceModel.Duplex.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.ServiceModel.Duplex.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.ServiceModel.NetTcp" library="Facades_System.ServiceModel.NetTcp-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.ServiceModel.dll</flags>
+      <output>System.ServiceModel.NetTcp.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.ServiceModel.NetTcp.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.ServiceModel.NetTcp.dll.sources</response>
+    </project>
+    <project dir="class/Facades/Microsoft.Win32.Primitives" library="Facades_Microsoft.Win32.Primitives-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll</flags>
+      <output>Microsoft.Win32.Primitives.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/Microsoft.Win32.Primitives.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>Microsoft.Win32.Primitives.dll.sources</response>
+    </project>
+    <project dir="class/Facades/Microsoft.Win32.Registry" library="Facades_Microsoft.Win32.Registry-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll</flags>
+      <output>Microsoft.Win32.Registry.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/Microsoft.Win32.Registry.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>Microsoft.Win32.Registry.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.AppContext" library="Facades_System.AppContext-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll</flags>
+      <output>System.AppContext.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.AppContext.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.AppContext.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Collections.NonGeneric" library="Facades_System.Collections.NonGeneric-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll</flags>
+      <output>System.Collections.NonGeneric.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Collections.NonGeneric.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Collections.NonGeneric.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Collections.Specialized" library="Facades_System.Collections.Specialized-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll</flags>
+      <output>System.Collections.Specialized.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Collections.Specialized.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Collections.Specialized.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.ComponentModel.Primitives" library="Facades_System.ComponentModel.Primitives-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll</flags>
+      <output>System.ComponentModel.Primitives.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.ComponentModel.Primitives.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.ComponentModel.Primitives.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.ComponentModel.TypeConverter" library="Facades_System.ComponentModel.TypeConverter-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll</flags>
+      <output>System.ComponentModel.TypeConverter.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.ComponentModel.TypeConverter.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.ComponentModel.TypeConverter.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Console" library="Facades_System.Console-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll</flags>
+      <output>System.Console.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Console.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Console.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Data.Common" library="Facades_System.Data.Common-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll -r:./../../../class/lib/monotouch_tv/System.Data.dll -r:./../../../class/lib/monotouch_tv/System.Xml.dll</flags>
+      <output>System.Data.Common.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Data.Common.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Data.Common.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Data.SqlClient" library="Facades_System.Data.SqlClient-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll -r:./../../../class/lib/monotouch_tv/System.Data.dll -r:./../../../class/lib/monotouch_tv/System.Xml.dll</flags>
+      <output>System.Data.SqlClient.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Data.SqlClient.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Data.SqlClient.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Diagnostics.FileVersionInfo" library="Facades_System.Diagnostics.FileVersionInfo-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll</flags>
+      <output>System.Diagnostics.FileVersionInfo.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Diagnostics.FileVersionInfo.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Diagnostics.FileVersionInfo.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Diagnostics.Process" library="Facades_System.Diagnostics.Process-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll</flags>
+      <output>System.Diagnostics.Process.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Diagnostics.Process.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Diagnostics.Process.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Diagnostics.TextWriterTraceListener" library="Facades_System.Diagnostics.TextWriterTraceListener-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll</flags>
+      <output>System.Diagnostics.TextWriterTraceListener.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Diagnostics.TextWriterTraceListener.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Diagnostics.TextWriterTraceListener.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Diagnostics.TraceEvent" library="Facades_System.Diagnostics.TraceEvent-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll</flags>
+      <output>System.Diagnostics.TraceEvent.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Diagnostics.TraceEvent.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Diagnostics.TraceEvent.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Diagnostics.TraceSource" library="Facades_System.Diagnostics.TraceSource-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll</flags>
+      <output>System.Diagnostics.TraceSource.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Diagnostics.TraceSource.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Diagnostics.TraceSource.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Globalization.Calendars" library="Facades_System.Globalization.Calendars-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll</flags>
+      <output>System.Globalization.Calendars.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Globalization.Calendars.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Globalization.Calendars.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.IO.Compression.ZipFile" library="Facades_System.IO.Compression.ZipFile-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll -r:./../../../class/lib/monotouch_tv/System.IO.Compression.FileSystem.dll</flags>
+      <output>System.IO.Compression.ZipFile.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.IO.Compression.ZipFile.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.IO.Compression.ZipFile.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.IO.FileSystem" library="Facades_System.IO.FileSystem-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll</flags>
+      <output>System.IO.FileSystem.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.IO.FileSystem.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.IO.FileSystem.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.IO.FileSystem.DriveInfo" library="Facades_System.IO.FileSystem.DriveInfo-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll</flags>
+      <output>System.IO.FileSystem.DriveInfo.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.IO.FileSystem.DriveInfo.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.IO.FileSystem.DriveInfo.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.IO.FileSystem.Primitives" library="Facades_System.IO.FileSystem.Primitives-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll</flags>
+      <output>System.IO.FileSystem.Primitives.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.IO.FileSystem.Primitives.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.IO.FileSystem.Primitives.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.IO.IsolatedStorage" library="Facades_System.IO.IsolatedStorage-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll</flags>
+      <output>System.IO.IsolatedStorage.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.IO.IsolatedStorage.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.IO.IsolatedStorage.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.IO.MemoryMappedFiles" library="Facades_System.IO.MemoryMappedFiles-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll -r:./../../../class/lib/monotouch_tv/System.Core.dll</flags>
+      <output>System.IO.MemoryMappedFiles.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.IO.MemoryMappedFiles.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.IO.MemoryMappedFiles.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.IO.UnmanagedMemoryStream" library="Facades_System.IO.UnmanagedMemoryStream-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll</flags>
+      <output>System.IO.UnmanagedMemoryStream.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.IO.UnmanagedMemoryStream.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.IO.UnmanagedMemoryStream.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.AuthenticationManager" library="Facades_System.Net.AuthenticationManager-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll</flags>
+      <output>System.Net.AuthenticationManager.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Net.AuthenticationManager.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Net.AuthenticationManager.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.Cache" library="Facades_System.Net.Cache-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll</flags>
+      <output>System.Net.Cache.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Net.Cache.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Net.Cache.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.HttpListener" library="Facades_System.Net.HttpListener-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll</flags>
+      <output>System.Net.HttpListener.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Net.HttpListener.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Net.HttpListener.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.Mail" library="Facades_System.Net.Mail-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll</flags>
+      <output>System.Net.Mail.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Net.Mail.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Net.Mail.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.NameResolution" library="Facades_System.Net.NameResolution-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll</flags>
+      <output>System.Net.NameResolution.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Net.NameResolution.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Net.NameResolution.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.Security" library="Facades_System.Net.Security-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll</flags>
+      <output>System.Net.Security.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Net.Security.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Net.Security.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.ServicePoint" library="Facades_System.Net.ServicePoint-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll</flags>
+      <output>System.Net.ServicePoint.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Net.ServicePoint.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Net.ServicePoint.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.Sockets" library="Facades_System.Net.Sockets-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll</flags>
+      <output>System.Net.Sockets.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Net.Sockets.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Net.Sockets.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.Utilities" library="Facades_System.Net.Utilities-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll</flags>
+      <output>System.Net.Utilities.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Net.Utilities.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Net.Utilities.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.WebHeaderCollection" library="Facades_System.Net.WebHeaderCollection-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll</flags>
+      <output>System.Net.WebHeaderCollection.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Net.WebHeaderCollection.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Net.WebHeaderCollection.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.WebSockets" library="Facades_System.Net.WebSockets-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll</flags>
+      <output>System.Net.WebSockets.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Net.WebSockets.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Net.WebSockets.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.WebSockets.Client" library="Facades_System.Net.WebSockets.Client-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll</flags>
+      <output>System.Net.WebSockets.Client.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Net.WebSockets.Client.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Net.WebSockets.Client.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Resources.ReaderWriter" library="Facades_System.Resources.ReaderWriter-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll</flags>
+      <output>System.Resources.ReaderWriter.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Resources.ReaderWriter.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Resources.ReaderWriter.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Runtime.CompilerServices.VisualC" library="Facades_System.Runtime.CompilerServices.VisualC-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll</flags>
+      <output>System.Runtime.CompilerServices.VisualC.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Runtime.CompilerServices.VisualC.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Runtime.CompilerServices.VisualC.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.AccessControl" library="Facades_System.Security.AccessControl-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll</flags>
+      <output>System.Security.AccessControl.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Security.AccessControl.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Security.AccessControl.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Claims" library="Facades_System.Security.Claims-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll</flags>
+      <output>System.Security.Claims.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Security.Claims.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Security.Claims.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.DeriveBytes" library="Facades_System.Security.Cryptography.DeriveBytes-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll</flags>
+      <output>System.Security.Cryptography.DeriveBytes.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Security.Cryptography.DeriveBytes.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.DeriveBytes.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.Encoding" library="Facades_System.Security.Cryptography.Encoding-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll</flags>
+      <output>System.Security.Cryptography.Encoding.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Security.Cryptography.Encoding.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.Encoding.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.Encryption" library="Facades_System.Security.Cryptography.Encryption-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll</flags>
+      <output>System.Security.Cryptography.Encryption.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Security.Cryptography.Encryption.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.Encryption.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.Encryption.Aes" library="Facades_System.Security.Cryptography.Encryption.Aes-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll</flags>
+      <output>System.Security.Cryptography.Encryption.Aes.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Security.Cryptography.Encryption.Aes.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.Encryption.Aes.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.Encryption.ECDiffieHellman" library="Facades_System.Security.Cryptography.Encryption.ECDiffieHellman-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll -r:./../../../class/lib/monotouch_tv/System.Core.dll</flags>
+      <output>System.Security.Cryptography.Encryption.ECDiffieHellman.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Security.Cryptography.Encryption.ECDiffieHellman.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.Encryption.ECDiffieHellman.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.Encryption.ECDsa" library="Facades_System.Security.Cryptography.Encryption.ECDsa-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll -r:./../../../class/lib/monotouch_tv/System.Core.dll</flags>
+      <output>System.Security.Cryptography.Encryption.ECDsa.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Security.Cryptography.Encryption.ECDsa.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.Encryption.ECDsa.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.Hashing" library="Facades_System.Security.Cryptography.Hashing-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll</flags>
+      <output>System.Security.Cryptography.Hashing.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Security.Cryptography.Hashing.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.Hashing.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.Hashing.Algorithms" library="Facades_System.Security.Cryptography.Hashing.Algorithms-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll</flags>
+      <output>System.Security.Cryptography.Hashing.Algorithms.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Security.Cryptography.Hashing.Algorithms.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.Hashing.Algorithms.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.RSA" library="Facades_System.Security.Cryptography.RSA-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll</flags>
+      <output>System.Security.Cryptography.RSA.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Security.Cryptography.RSA.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.RSA.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.RandomNumberGenerator" library="Facades_System.Security.Cryptography.RandomNumberGenerator-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll</flags>
+      <output>System.Security.Cryptography.RandomNumberGenerator.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Security.Cryptography.RandomNumberGenerator.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.RandomNumberGenerator.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Principal.Windows" library="Facades_System.Security.Principal.Windows-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll</flags>
+      <output>System.Security.Principal.Windows.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Security.Principal.Windows.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Security.Principal.Windows.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Threading.Thread" library="Facades_System.Threading.Thread-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll</flags>
+      <output>System.Threading.Thread.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Threading.Thread.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Threading.Thread.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Threading.ThreadPool" library="Facades_System.Threading.ThreadPool-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll</flags>
+      <output>System.Threading.ThreadPool.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Threading.ThreadPool.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Threading.ThreadPool.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Xml.XPath" library="Facades_System.Xml.XPath-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll -r:./../../../class/lib/monotouch_tv/System.Xml.dll</flags>
+      <output>System.Xml.XPath.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Xml.XPath.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Xml.XPath.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Xml.XmlDocument" library="Facades_System.Xml.XmlDocument-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll -r:./../../../class/lib/monotouch_tv/System.Xml.dll</flags>
+      <output>System.Xml.XmlDocument.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Xml.XmlDocument.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Xml.XmlDocument.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Xml.Xsl.Primitives" library="Facades_System.Xml.Xsl.Primitives-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll -r:./../../../class/lib/monotouch_tv/System.Xml.dll</flags>
+      <output>System.Xml.Xsl.Primitives.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Xml.Xsl.Primitives.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Xml.Xsl.Primitives.dll.sources</response>
+    </project>
+    <project dir="class/Facades/Microsoft.Win32.Registry.AccessControl" library="Facades_Microsoft.Win32.Registry.AccessControl-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll</flags>
+      <output>Microsoft.Win32.Registry.AccessControl.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/Microsoft.Win32.Registry.AccessControl.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>Microsoft.Win32.Registry.AccessControl.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Diagnostics.StackTrace" library="Facades_System.Diagnostics.StackTrace-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll</flags>
+      <output>System.Diagnostics.StackTrace.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Diagnostics.StackTrace.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Diagnostics.StackTrace.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Globalization.Extensions" library="Facades_System.Globalization.Extensions-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll</flags>
+      <output>System.Globalization.Extensions.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Globalization.Extensions.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Globalization.Extensions.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.IO.FileSystem.AccessControl" library="Facades_System.IO.FileSystem.AccessControl-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll</flags>
+      <output>System.IO.FileSystem.AccessControl.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.IO.FileSystem.AccessControl.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.IO.FileSystem.AccessControl.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Reflection.TypeExtensions" library="Facades_System.Reflection.TypeExtensions-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll</flags>
+      <output>System.Reflection.TypeExtensions.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Reflection.TypeExtensions.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Reflection.TypeExtensions.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Reflection.Emit.Lightweight" library="Facades_System.Reflection.Emit.Lightweight-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Reflection.Emit.Lightweight.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Reflection.Emit.Lightweight.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Reflection.Emit.Lightweight.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Reflection.Emit.ILGeneration" library="Facades_System.Reflection.Emit.ILGeneration-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Reflection.Emit.ILGeneration.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Reflection.Emit.ILGeneration.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Reflection.Emit.ILGeneration.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Reflection.Emit" library="Facades_System.Reflection.Emit-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Reflection.Emit.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Reflection.Emit.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Reflection.Emit.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.SecureString" library="Facades_System.Security.SecureString-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll</flags>
+      <output>System.Security.SecureString.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Security.SecureString.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Security.SecureString.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Threading.AccessControl" library="Facades_System.Threading.AccessControl-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll</flags>
+      <output>System.Threading.AccessControl.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Threading.AccessControl.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Threading.AccessControl.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Threading.Overlapped" library="Facades_System.Threading.Overlapped-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -unsafe -r:./../../../class/lib/monotouch_tv/System.dll</flags>
+      <output>System.Threading.Overlapped.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Threading.Overlapped.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Threading.Overlapped.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Xml.XPath.XDocument" library="Facades_System.Xml.XPath.XDocument-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll -r:./../../../class/lib/monotouch_tv/System.Xml.dll -r:./../../../class/lib/monotouch_tv/System.Xml.Linq.dll</flags>
+      <output>System.Xml.XPath.XDocument.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Xml.XPath.XDocument.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Xml.XPath.XDocument.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.Primitives" library="Facades_System.Security.Cryptography.Primitives-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll</flags>
+      <output>System.Security.Cryptography.Primitives.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Security.Cryptography.Primitives.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.Primitives.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Text.Encoding.CodePages" library="Facades_System.Text.Encoding.CodePages-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll</flags>
+      <output>System.Text.Encoding.CodePages.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Text.Encoding.CodePages.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Text.Encoding.CodePages.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.IO.FileSystem.Watcher" library="Facades_System.IO.FileSystem.Watcher-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll</flags>
+      <output>System.IO.FileSystem.Watcher.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.IO.FileSystem.Watcher.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.IO.FileSystem.Watcher.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.ProtectedData" library="Facades_System.Security.Cryptography.ProtectedData-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll -r:./../../../class/lib/monotouch_tv/System.Security.dll</flags>
+      <output>System.Security.Cryptography.ProtectedData.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Security.Cryptography.ProtectedData.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.ProtectedData.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.ServiceProcess.ServiceController" library="Facades_System.ServiceProcess.ServiceController-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -debug -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll</flags>
+      <output>System.ServiceProcess.ServiceController.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.ServiceProcess.ServiceController.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.ServiceProcess.ServiceController.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.IO.Pipes" library="Facades_System.IO.Pipes-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll -r:./../../../class/lib/monotouch_tv/System.Core.dll</flags>
+      <output>System.IO.Pipes.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.IO.Pipes.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.IO.Pipes.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.Ping" library="Facades_System.Net.Ping-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll</flags>
+      <output>System.Net.Ping.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Net.Ping.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Net.Ping.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Runtime.Serialization.Formatters" library="Facades_System.Runtime.Serialization.Formatters-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll</flags>
+      <output>System.Runtime.Serialization.Formatters.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Runtime.Serialization.Formatters.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Runtime.Serialization.Formatters.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.Csp" library="Facades_System.Security.Cryptography.Csp-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll</flags>
+      <output>System.Security.Cryptography.Csp.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Security.Cryptography.Csp.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.Csp.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.Pkcs" library="Facades_System.Security.Cryptography.Pkcs-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll -r:./../../../class/lib/monotouch_tv/System.Security.dll</flags>
+      <output>System.Security.Cryptography.Pkcs.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Security.Cryptography.Pkcs.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.Pkcs.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.Cng" library="Facades_System.Security.Cryptography.Cng-monotouch_tv">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/monotouch_tv/mscorlib.dll -d:FULL_AOT_RUNTIME -d:MONOTOUCH_TV -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/monotouch_tv/System.dll -r:./../../../class/lib/monotouch_tv/System.Core.dll</flags>
+      <output>System.Security.Cryptography.Cng.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/monotouch_tv/Facades/System.Security.Cryptography.Cng.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.Cng.dll.sources</response>
+    </project>
+    <project dir="class/corlib" library="corlib-monotouch_tv_runtime">
+      <boot>true</boot>
+      <flags>/codepage:65001 -unsafe -nostdlib -nowarn:612,618,1635 -d:INSIDE_CORLIB,MONO_CULTURE_DATA -d:LIBC -d:FEATURE_PAL,GENERICS_WORK,FEATURE_LIST_PREDICATES,FEATURE_SERIALIZATION,FEATURE_ASCII,FEATURE_LATIN1,FEATURE_UTF7,FEATURE_UTF32,MONO_HYBRID_ENCODING_SUPPORT,FEATURE_ASYNC_IO,NEW_EXPERIMENTAL_ASYNC_IO,FEATURE_UTF32,FEATURE_EXCEPTIONDISPATCHINFO,FEATURE_CORRUPTING_EXCEPTIONS,FEATURE_EXCEPTION_NOTIFICATIONS,FEATURE_STRONGNAME_MIGRATION,FEATURE_USE_LCID,FEATURE_FUSION,FEATURE_CRYPTO,FEATURE_X509_SECURESTRINGS,FEATURE_SYNCHRONIZATIONCONTEXT,FEATURE_SYNCHRONIZATIONCONTEXT_WAIT,HAS_CORLIB_CONTRACTS -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -debug -d:MONOTOUCH_TV -optimize /noconfig -d:FEATURE_PAL,GENERICS_WORK,FEATURE_LIST_PREDICATES,FEATURE_SERIALIZATION,FEATURE_ASCII,FEATURE_LATIN1,FEATURE_UTF7,FEATURE_UTF32,MONO_HYBRID_ENCODING_SUPPORT,FEATURE_ASYNC_IO,NEW_EXPERIMENTAL_ASYNC_IO,FEATURE_UTF32,FEATURE_EXCEPTIONDISPATCHINFO,FEATURE_CORRUPTING_EXCEPTIONS,FEATURE_EXCEPTION_NOTIFICATIONS,FEATURE_STRONGNAME_MIGRATION,FEATURE_USE_LCID,FEATURE_FUSION,FEATURE_CRYPTO,FEATURE_X509_SECURESTRINGS,FEATURE_SYNCHRONIZATIONCONTEXT,FEATURE_SYNCHRONIZATIONCONTEXT_WAIT,HAS_CORLIB_CONTRACTS -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -resource:resources/charinfo.nlp -resource:resources/collation.core.bin -resource:resources/collation.tailoring.bin -resource:resources/collation.cjkCHS.bin -resource:resources/collation.cjkCHT.bin -resource:resources/collation.cjkJA.bin -resource:resources/collation.cjkKO.bin -resource:resources/collation.cjkKOlv2.bin --runtime:v4</flags>
+      <output>mscorlib.dll</output>
+      <built_sources>CommonCrypto/MD5CryptoServiceProvider.g.cs CommonCrypto/SHA256Managed.g.cs CommonCrypto/RC2CryptoServiceProvider.g.cs CommonCrypto/SHA384Managed.g.cs CommonCrypto/DESCryptoServiceProvider.g.cs CommonCrypto/SHA1CryptoServiceProvider.g.cs CommonCrypto/SHA512Managed.g.cs CommonCrypto/MD2Managed.g.cs CommonCrypto/SHA1Managed.g.cs CommonCrypto/TripleDESCryptoServiceProvider.g.cs CommonCrypto/MD4Managed.g.cs</built_sources>
+      <library_output>./../../class/lib/monotouch_tv_runtime/mscorlib.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv_runtime</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_tv_runtime_corlib.dll.sources</response>
+    </project>
+    <project dir="class/corlib" library="corlib-tests-monotouch_tv_runtime">
+      <boot>false</boot>
+      <flags>/codepage:65001 -unsafe -nostdlib -nowarn:612,618,1635 -d:INSIDE_CORLIB,MONO_CULTURE_DATA -d:LIBC -d:FEATURE_PAL,GENERICS_WORK,FEATURE_LIST_PREDICATES,FEATURE_SERIALIZATION,FEATURE_ASCII,FEATURE_LATIN1,FEATURE_UTF7,FEATURE_UTF32,MONO_HYBRID_ENCODING_SUPPORT,FEATURE_ASYNC_IO,NEW_EXPERIMENTAL_ASYNC_IO,FEATURE_UTF32,FEATURE_EXCEPTIONDISPATCHINFO,FEATURE_CORRUPTING_EXCEPTIONS,FEATURE_EXCEPTION_NOTIFICATIONS,FEATURE_STRONGNAME_MIGRATION,FEATURE_USE_LCID,FEATURE_FUSION,FEATURE_CRYPTO,FEATURE_X509_SECURESTRINGS,FEATURE_SYNCHRONIZATIONCONTEXT,FEATURE_SYNCHRONIZATIONCONTEXT_WAIT,HAS_CORLIB_CONTRACTS -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -debug -d:MONOTOUCH_TV -optimize -r:./../../class/lib/monotouch_tv_runtime/mscorlib.dll -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -debug -nowarn:168,219,618,672 -unsafe -define:MONO_DATACONVERTER_STATIC_METHODS -resource:Test/resources/Resources.resources</flags>
+      <output>monotouch_tv_runtime_corlib_test.dll</output>
+      <built_sources>CommonCrypto/MD5CryptoServiceProvider.g.cs CommonCrypto/SHA256Managed.g.cs CommonCrypto/RC2CryptoServiceProvider.g.cs CommonCrypto/SHA384Managed.g.cs CommonCrypto/DESCryptoServiceProvider.g.cs CommonCrypto/SHA1CryptoServiceProvider.g.cs CommonCrypto/SHA512Managed.g.cs CommonCrypto/MD2Managed.g.cs CommonCrypto/SHA1Managed.g.cs CommonCrypto/TripleDESCryptoServiceProvider.g.cs CommonCrypto/MD4Managed.g.cs</built_sources>
+      <library_output>monotouch_tv_runtime_corlib_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv_runtime</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_tv_runtime_corlib_test.dll.response</response>
+    </project>
+    <project dir="class/Mono.Security" library="Mono.Security-monotouch_tv_runtime">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv_runtime/mscorlib.dll -debug -d:MONOTOUCH_TV -optimize /noconfig -unsafe -nowarn:1030,3009 -r:./../../class/lib/monotouch_tv_runtime/bare/System.dll</flags>
+      <output>Mono.Security.dll</output>
+      <built_sources>../corlib/CommonCrypto/SHA224Managed.g.cs ../corlib/CommonCrypto/MD2Managed.g.cs ../corlib/CommonCrypto/MD4Managed.g.cs</built_sources>
+      <library_output>./../../class/lib/monotouch_tv_runtime/Mono.Security.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv_runtime</profile>
+      <resources></resources>
+      <response>Mono.Security.dll.sources</response>
+    </project>
+    <project dir="class/Mono.Security" library="Mono.Security-tests-monotouch_tv_runtime">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv_runtime/mscorlib.dll -debug -d:MONOTOUCH_TV -optimize -r:./../../class/lib/monotouch_tv_runtime/Mono.Security.dll -unsafe -nowarn:1030,3009 -r:./../../class/lib/monotouch_tv_runtime/bare/System.dll -nowarn:169,219,618,672</flags>
+      <output>monotouch_tv_runtime_Mono.Security_test.dll</output>
+      <built_sources>../corlib/CommonCrypto/SHA224Managed.g.cs ../corlib/CommonCrypto/MD2Managed.g.cs ../corlib/CommonCrypto/MD4Managed.g.cs</built_sources>
+      <library_output>monotouch_tv_runtime_Mono.Security_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv_runtime</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_tv_runtime_Mono.Security_test.dll.response</response>
+    </project>
+    <project dir="class/System" library="System-monotouch_tv_runtime">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv_runtime/mscorlib.dll -debug -d:MONOTOUCH_TV -optimize /noconfig -d:CONFIGURATION_2_0 -d:FEATURE_PAL,SYSTEM_NAMESPACE,MONO,PLATFORM_UNIX -d:MONO_FEATURE_PROCESS_START -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -unsafe -d:INSIDE_SYSTEM -d:SECURITY_DEP -nowarn:618,1635 -d:SECURITY_DEP -d:XML_DEP -r:./../../class/lib/monotouch_tv_runtime/System.Xml.dll -r:MonoSecurity=./../../class/lib/monotouch_tv_runtime/Mono.Security.dll</flags>
+      <output>System.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_tv_runtime/System.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv_runtime</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_tv_runtime_System.dll.sources</response>
+    </project>
+    <project dir="class/System" library="System-tests-monotouch_tv_runtime">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv_runtime/mscorlib.dll -debug -d:MONOTOUCH_TV -optimize -r:./../../class/lib/monotouch_tv_runtime/secxml/System.dll -nowarn:618,672,219,67,169,612 -resource:Test/System/test-uri-props.txt,test-uri-props.txt -resource:Test/System/test-uri-props-manual.txt,test-uri-props-manual.txt -resource:Test/System/test-uri-relative-props.txt,test-uri-relative-props.txt -d:MONO_FEATURE_PROCESS_START -d:MONO_FEATURE_MULTIPLE_APPDOMAINS</flags>
+      <output>monotouch_tv_runtime_System_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_tv_runtime_System_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv_runtime</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_tv_runtime_System_test.dll.response</response>
+    </project>
+    <project dir="class/System" library="System-bare-monotouch_tv_runtime">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv_runtime/mscorlib.dll -debug -d:MONOTOUCH_TV -optimize /noconfig -d:CONFIGURATION_2_0 -d:FEATURE_PAL,SYSTEM_NAMESPACE,MONO,PLATFORM_UNIX -d:MONO_FEATURE_PROCESS_START -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -unsafe -d:INSIDE_SYSTEM -d:SECURITY_DEP -nowarn:618,1635</flags>
+      <output>System.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_tv_runtime/bare/System.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv_runtime</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_tv_runtime_System.dll.sources</response>
+    </project>
+    <project dir="class/System" library="System-tests-monotouch_tv_runtime">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv_runtime/mscorlib.dll -debug -d:MONOTOUCH_TV -optimize -r:./../../class/lib/monotouch_tv_runtime/secxml/System.dll -nowarn:618,672,219,67,169,612 -resource:Test/System/test-uri-props.txt,test-uri-props.txt -resource:Test/System/test-uri-props-manual.txt,test-uri-props-manual.txt -resource:Test/System/test-uri-relative-props.txt,test-uri-relative-props.txt -d:MONO_FEATURE_PROCESS_START -d:MONO_FEATURE_MULTIPLE_APPDOMAINS</flags>
+      <output>monotouch_tv_runtime_System_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_tv_runtime_System_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv_runtime</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_tv_runtime_System_test.dll.response</response>
+    </project>
+    <project dir="class/System" library="System-secxml-monotouch_tv_runtime">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv_runtime/mscorlib.dll -debug -d:MONOTOUCH_TV -optimize /noconfig -d:CONFIGURATION_2_0 -d:FEATURE_PAL,SYSTEM_NAMESPACE,MONO,PLATFORM_UNIX -d:MONO_FEATURE_PROCESS_START -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -unsafe -d:INSIDE_SYSTEM -d:SECURITY_DEP -nowarn:618,1635 -d:SECURITY_DEP -d:XML_DEP -r:./../../class/lib/monotouch_tv_runtime/bare/System.Xml.dll -r:MonoSecurity=./../../class/lib/monotouch_tv_runtime/Mono.Security.dll</flags>
+      <output>System.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_tv_runtime/secxml/System.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv_runtime</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_tv_runtime_System.dll.sources</response>
+    </project>
+    <project dir="class/System" library="System-tests-monotouch_tv_runtime">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv_runtime/mscorlib.dll -debug -d:MONOTOUCH_TV -optimize -r:./../../class/lib/monotouch_tv_runtime/secxml/System.dll -nowarn:618,672,219,67,169,612 -resource:Test/System/test-uri-props.txt,test-uri-props.txt -resource:Test/System/test-uri-props-manual.txt,test-uri-props-manual.txt -resource:Test/System/test-uri-relative-props.txt,test-uri-relative-props.txt -d:MONO_FEATURE_PROCESS_START -d:MONO_FEATURE_MULTIPLE_APPDOMAINS</flags>
+      <output>monotouch_tv_runtime_System_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_tv_runtime_System_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv_runtime</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_tv_runtime_System_test.dll.response</response>
+    </project>
+    <project dir="class/System.Core" library="System.Core-monotouch_tv_runtime">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv_runtime/mscorlib.dll -debug -d:MONOTOUCH_TV -optimize /noconfig -d:FEATURE_PAL,PFX_LEGACY_3_5,FEATURE_NETCORE -d:INSIDE_SYSCORE -d:LIBC -unsafe -d:FEATURE_CORE_DLR -d:MONO_INTERPRETER -r:./../../class/lib/monotouch_tv_runtime/System.dll -r:./../../class/lib/monotouch_tv_runtime/Mono.Dynamic.Interpreter.dll</flags>
+      <output>System.Core.dll</output>
+      <built_sources>../corlib/CommonCrypto/AesManaged.g.cs ../corlib/CommonCrypto/AesCryptoServiceProvider.g.cs</built_sources>
+      <library_output>./../../class/lib/monotouch_tv_runtime/System.Core.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv_runtime</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_tv_runtime_System.Core.dll.sources</response>
+    </project>
+    <project dir="class/System.Core" library="System.Core-tests-monotouch_tv_runtime">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv_runtime/mscorlib.dll -debug -d:MONOTOUCH_TV -optimize -r:./../../class/lib/monotouch_tv_runtime/plaincore/System.Core.dll -d:FEATURE_PAL,PFX_LEGACY_3_5,FEATURE_NETCORE -d:INSIDE_SYSCORE -d:LIBC -unsafe -d:FEATURE_CORE_DLR -r:./../../class/lib/monotouch_tv_runtime/System.dll</flags>
+      <output>monotouch_tv_runtime_System.Core_test.dll</output>
+      <built_sources>../corlib/CommonCrypto/AesManaged.g.cs ../corlib/CommonCrypto/AesCryptoServiceProvider.g.cs</built_sources>
+      <library_output>monotouch_tv_runtime_System.Core_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv_runtime</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_tv_runtime_System.Core_test.dll.response</response>
+    </project>
+    <project dir="class/System.Core" library="System.Core-plaincore-monotouch_tv_runtime">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv_runtime/mscorlib.dll -debug -d:MONOTOUCH_TV -optimize /noconfig -d:FEATURE_PAL,PFX_LEGACY_3_5,FEATURE_NETCORE -d:INSIDE_SYSCORE -d:LIBC -unsafe -d:FEATURE_CORE_DLR -r:./../../class/lib/monotouch_tv_runtime/System.dll</flags>
+      <output>System.Core.dll</output>
+      <built_sources>../corlib/CommonCrypto/AesManaged.g.cs ../corlib/CommonCrypto/AesCryptoServiceProvider.g.cs</built_sources>
+      <library_output>./../../class/lib/monotouch_tv_runtime/plaincore/System.Core.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv_runtime</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_tv_runtime_System.Core.dll.sources</response>
+    </project>
+    <project dir="class/System.Core" library="System.Core-tests-monotouch_tv_runtime">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv_runtime/mscorlib.dll -debug -d:MONOTOUCH_TV -optimize -r:./../../class/lib/monotouch_tv_runtime/plaincore/System.Core.dll -d:FEATURE_PAL,PFX_LEGACY_3_5,FEATURE_NETCORE -d:INSIDE_SYSCORE -d:LIBC -unsafe -d:FEATURE_CORE_DLR -r:./../../class/lib/monotouch_tv_runtime/System.dll</flags>
+      <output>monotouch_tv_runtime_System.Core_test.dll</output>
+      <built_sources>../corlib/CommonCrypto/AesManaged.g.cs ../corlib/CommonCrypto/AesCryptoServiceProvider.g.cs</built_sources>
+      <library_output>monotouch_tv_runtime_System.Core_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv_runtime</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_tv_runtime_System.Core_test.dll.response</response>
+    </project>
+    <project dir="class/System.XML" library="System.Xml-monotouch_tv_runtime">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv_runtime/mscorlib.dll -debug -d:MONOTOUCH_TV -optimize /noconfig -nowarn:219,414,649,1717 -unsafe -d:ASYNC -d:AGCLR -d:DISABLE_XSLT_COMPILER -d:DISABLE_XSLT_SCRIPT,MONO_HYBRID_SYSTEM_XML -d:DISABLE_CAS_USE -r:./../../class/lib/monotouch_tv_runtime/secxml/System.dll</flags>
+      <output>System.Xml.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_tv_runtime/System.Xml.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv_runtime</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_tv_runtime_System.Xml.dll.sources</response>
+    </project>
+    <project dir="class/System.XML" library="System.Xml-tests-monotouch_tv_runtime">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv_runtime/mscorlib.dll -debug -d:MONOTOUCH_TV -optimize -r:./../../class/lib/monotouch_tv_runtime/bare/System.Xml.dll -nowarn:219,414,649,1717 -unsafe -d:ASYNC -d:AGCLR -d:DISABLE_XSLT_COMPILER -d:DISABLE_XSLT_SCRIPT,MONO_HYBRID_SYSTEM_XML -d:DISABLE_CAS_USE -r:./../../class/lib/monotouch_tv_runtime/bare/System.dll -nowarn:0618 -nowarn:219 -nowarn:169</flags>
+      <output>monotouch_tv_runtime_System.Xml_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_tv_runtime_System.Xml_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv_runtime</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_tv_runtime_System.Xml_test.dll.response</response>
+    </project>
+    <project dir="class/System.XML" library="System.Xml-bare-monotouch_tv_runtime">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv_runtime/mscorlib.dll -debug -d:MONOTOUCH_TV -optimize /noconfig -nowarn:219,414,649,1717 -unsafe -d:ASYNC -d:AGCLR -d:DISABLE_XSLT_COMPILER -d:DISABLE_XSLT_SCRIPT,MONO_HYBRID_SYSTEM_XML -d:DISABLE_CAS_USE -r:./../../class/lib/monotouch_tv_runtime/bare/System.dll</flags>
+      <output>System.Xml.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_tv_runtime/bare/System.Xml.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv_runtime</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_tv_runtime_System.Xml.dll.sources</response>
+    </project>
+    <project dir="class/System.XML" library="System.Xml-tests-monotouch_tv_runtime">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv_runtime/mscorlib.dll -debug -d:MONOTOUCH_TV -optimize -r:./../../class/lib/monotouch_tv_runtime/bare/System.Xml.dll -nowarn:219,414,649,1717 -unsafe -d:ASYNC -d:AGCLR -d:DISABLE_XSLT_COMPILER -d:DISABLE_XSLT_SCRIPT,MONO_HYBRID_SYSTEM_XML -d:DISABLE_CAS_USE -r:./../../class/lib/monotouch_tv_runtime/bare/System.dll -nowarn:0618 -nowarn:219 -nowarn:169</flags>
+      <output>monotouch_tv_runtime_System.Xml_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_tv_runtime_System.Xml_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv_runtime</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_tv_runtime_System.Xml_test.dll.response</response>
+    </project>
+    <project dir="class/Mono.CSharp" library="Mono.CSharp-monotouch_tv_runtime">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv_runtime/mscorlib.dll -debug -d:MONOTOUCH_TV -optimize /noconfig -d:IOS_REFLECTION -r:./../../class/lib/monotouch_tv_runtime/System.Core.dll -r:./../../class/lib/monotouch_tv_runtime/System.Xml.dll -r:./../../class/lib/monotouch_tv_runtime/System.dll</flags>
+      <output>Mono.CSharp.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/monotouch_tv_runtime/Mono.CSharp.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv_runtime</profile>
+      <resources></resources>
+      <response>Mono.CSharp.dll.sources</response>
+    </project>
+    <project dir="class/Mono.CSharp" library="Mono.CSharp-tests-monotouch_tv_runtime">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE,MOBILE_LEGACY -d:MONO -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/monotouch_tv_runtime/mscorlib.dll -debug -d:MONOTOUCH_TV -optimize -r:./../../class/lib/monotouch_tv_runtime/Mono.CSharp.dll</flags>
+      <output>monotouch_tv_runtime_Mono.CSharp_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>monotouch_tv_runtime_Mono.CSharp_test.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>monotouch_tv_runtime</profile>
+      <resources></resources>
+      <response>./../../build/deps/monotouch_tv_runtime_Mono.CSharp_test.dll.response</response>
+    </project>
+    <project dir="class/corlib" library="corlib-xammac">
+      <boot>true</boot>
+      <flags>/codepage:65001 -unsafe -nostdlib -nowarn:612,618,1635 -d:INSIDE_CORLIB,MONO_CULTURE_DATA -d:LIBC -d:FEATURE_PAL,GENERICS_WORK,FEATURE_LIST_PREDICATES,FEATURE_SERIALIZATION,FEATURE_ASCII,FEATURE_LATIN1,FEATURE_UTF7,FEATURE_UTF32,MONO_HYBRID_ENCODING_SUPPORT,FEATURE_ASYNC_IO,NEW_EXPERIMENTAL_ASYNC_IO,FEATURE_UTF32,FEATURE_EXCEPTIONDISPATCHINFO,FEATURE_CORRUPTING_EXCEPTIONS,FEATURE_EXCEPTION_NOTIFICATIONS,FEATURE_STRONGNAME_MIGRATION,FEATURE_USE_LCID,FEATURE_FUSION,FEATURE_CRYPTO,FEATURE_X509_SECURESTRINGS,FEATURE_SYNCHRONIZATIONCONTEXT,FEATURE_SYNCHRONIZATIONCONTEXT_WAIT,HAS_CORLIB_CONTRACTS -d:FEATURE_REMOTING,MONO_COM,FEATURE_COMINTEROP,FEATURE_ROLE_BASED_SECURITY -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -debug -optimize /noconfig -d:FEATURE_PAL,GENERICS_WORK,FEATURE_LIST_PREDICATES,FEATURE_SERIALIZATION,FEATURE_ASCII,FEATURE_LATIN1,FEATURE_UTF7,FEATURE_UTF32,MONO_HYBRID_ENCODING_SUPPORT,FEATURE_ASYNC_IO,NEW_EXPERIMENTAL_ASYNC_IO,FEATURE_UTF32,FEATURE_EXCEPTIONDISPATCHINFO,FEATURE_CORRUPTING_EXCEPTIONS,FEATURE_EXCEPTION_NOTIFICATIONS,FEATURE_STRONGNAME_MIGRATION,FEATURE_USE_LCID,FEATURE_FUSION,FEATURE_CRYPTO,FEATURE_X509_SECURESTRINGS,FEATURE_SYNCHRONIZATIONCONTEXT,FEATURE_SYNCHRONIZATIONCONTEXT_WAIT,HAS_CORLIB_CONTRACTS -d:FEATURE_REMOTING,MONO_COM,FEATURE_COMINTEROP,FEATURE_ROLE_BASED_SECURITY -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -resource:resources/charinfo.nlp -resource:resources/collation.core.bin -resource:resources/collation.tailoring.bin -resource:resources/collation.cjkCHS.bin -resource:resources/collation.cjkCHT.bin -resource:resources/collation.cjkJA.bin -resource:resources/collation.cjkKO.bin -resource:resources/collation.cjkKOlv2.bin --runtime:v4</flags>
+      <output>mscorlib.dll</output>
+      <built_sources>CommonCrypto/MD5CryptoServiceProvider.g.cs CommonCrypto/SHA256Managed.g.cs CommonCrypto/RC2CryptoServiceProvider.g.cs CommonCrypto/SHA384Managed.g.cs CommonCrypto/DESCryptoServiceProvider.g.cs CommonCrypto/SHA1CryptoServiceProvider.g.cs CommonCrypto/SHA512Managed.g.cs CommonCrypto/MD2Managed.g.cs CommonCrypto/SHA1Managed.g.cs CommonCrypto/TripleDESCryptoServiceProvider.g.cs CommonCrypto/MD4Managed.g.cs</built_sources>
+      <library_output>./../../class/lib/xammac/mscorlib.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>./../../build/deps/xammac_corlib.dll.sources</response>
+    </project>
+    <project dir="class/Mono.Security" library="Mono.Security-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/xammac/mscorlib.dll -debug -optimize /noconfig -unsafe -nowarn:1030,3009 -r:./../../class/lib/xammac/bare/System.dll</flags>
+      <output>Mono.Security.dll</output>
+      <built_sources>../corlib/CommonCrypto/SHA224Managed.g.cs ../corlib/CommonCrypto/MD2Managed.g.cs ../corlib/CommonCrypto/MD4Managed.g.cs</built_sources>
+      <library_output>./../../class/lib/xammac/Mono.Security.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>./../../build/deps/xammac_Mono.Security.dll.sources</response>
+    </project>
+    <project dir="class/System" library="System-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/xammac/mscorlib.dll -debug -optimize /noconfig -d:CONFIGURATION_2_0 -d:FEATURE_PAL,SYSTEM_NAMESPACE,MONO,PLATFORM_UNIX -d:MONO_FEATURE_PROCESS_START -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -unsafe -d:INSIDE_SYSTEM -d:SECURITY_DEP -nowarn:618,1635 -d:SECURITY_DEP -d:XML_DEP -r:./../../class/lib/xammac/System.Xml.dll -r:MonoSecurity=./../../class/lib/xammac/Mono.Security.dll</flags>
+      <output>System.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac/System.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>./../../build/deps/xammac_System.dll.sources</response>
+    </project>
+    <project dir="class/System" library="System-bare-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/xammac/mscorlib.dll -debug -optimize /noconfig -d:CONFIGURATION_2_0 -d:FEATURE_PAL,SYSTEM_NAMESPACE,MONO,PLATFORM_UNIX -d:MONO_FEATURE_PROCESS_START -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -unsafe -d:INSIDE_SYSTEM -d:SECURITY_DEP -nowarn:618,1635</flags>
+      <output>System.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac/bare/System.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>./../../build/deps/xammac_System.dll.sources</response>
+    </project>
+    <project dir="class/System" library="System-secxml-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/xammac/mscorlib.dll -debug -optimize /noconfig -d:CONFIGURATION_2_0 -d:FEATURE_PAL,SYSTEM_NAMESPACE,MONO,PLATFORM_UNIX -d:MONO_FEATURE_PROCESS_START -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -unsafe -d:INSIDE_SYSTEM -d:SECURITY_DEP -nowarn:618,1635 -d:SECURITY_DEP -d:XML_DEP -r:./../../class/lib/xammac/bare/System.Xml.dll -r:MonoSecurity=./../../class/lib/xammac/Mono.Security.dll</flags>
+      <output>System.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac/secxml/System.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>./../../build/deps/xammac_System.dll.sources</response>
+    </project>
+    <project dir="class/System.Core" library="System.Core-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/xammac/mscorlib.dll -debug -optimize /noconfig -d:FEATURE_PAL,PFX_LEGACY_3_5,FEATURE_NETCORE -d:INSIDE_SYSCORE -d:LIBC -unsafe -d:FEATURE_CORE_DLR,FEATURE_REFEMIT -r:./../../class/lib/xammac/System.dll</flags>
+      <output>System.Core.dll</output>
+      <built_sources>../corlib/CommonCrypto/AesManaged.g.cs ../corlib/CommonCrypto/AesCryptoServiceProvider.g.cs</built_sources>
+      <library_output>./../../class/lib/xammac/System.Core.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>./../../build/deps/xammac_System.Core.dll.sources</response>
+    </project>
+    <project dir="class/System.Core" library="System.Core-plaincore-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/xammac/mscorlib.dll -debug -optimize /noconfig -d:FEATURE_PAL,PFX_LEGACY_3_5,FEATURE_NETCORE -d:INSIDE_SYSCORE -d:LIBC -unsafe -d:FEATURE_CORE_DLR,FEATURE_REFEMIT -r:./../../class/lib/xammac/System.dll</flags>
+      <output>System.Core.dll</output>
+      <built_sources>../corlib/CommonCrypto/AesManaged.g.cs ../corlib/CommonCrypto/AesCryptoServiceProvider.g.cs</built_sources>
+      <library_output>./../../class/lib/xammac/plaincore/System.Core.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>./../../build/deps/xammac_System.Core.dll.sources</response>
+    </project>
+    <project dir="class/System.Security" library="System.Security-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/xammac/mscorlib.dll -debug -optimize /noconfig -nowarn:618 -d:SECURITY_DEP -nowarn:414 -r:./../../class/lib/xammac/secxml/System.dll -r:./../../class/lib/xammac/bare/System.Xml.dll -r:./../../class/lib/xammac/Mono.Security.dll</flags>
+      <output>System.Security.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac/System.Security.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>./../../build/deps/xammac_System.Security.dll.sources</response>
+    </project>
+    <project dir="class/System.XML" library="System.Xml-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/xammac/mscorlib.dll -debug -optimize /noconfig -nowarn:219,414,649,1717 -unsafe -d:ASYNC -d:AGCLR -d:DISABLE_XSLT_COMPILER -d:DISABLE_XSLT_SCRIPT,MONO_HYBRID_SYSTEM_XML -d:DISABLE_CAS_USE -r:./../../class/lib/xammac/secxml/System.dll</flags>
+      <output>System.Xml.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac/System.Xml.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>./../../build/deps/xammac_System.Xml.dll.sources</response>
+    </project>
+    <project dir="class/System.XML" library="System.Xml-bare-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/xammac/mscorlib.dll -debug -optimize /noconfig -nowarn:219,414,649,1717 -unsafe -d:ASYNC -d:AGCLR -d:DISABLE_XSLT_COMPILER -d:DISABLE_XSLT_SCRIPT,MONO_HYBRID_SYSTEM_XML -d:DISABLE_CAS_USE -r:./../../class/lib/xammac/bare/System.dll</flags>
+      <output>System.Xml.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac/bare/System.Xml.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>./../../build/deps/xammac_System.Xml.dll.sources</response>
+    </project>
+    <project dir="class/I18N/Common" library="I18N-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 /unsafe /define:DISABLE_UNSAFE -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -debug -optimize /noconfig</flags>
+      <output>I18N.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/I18N.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>I18N.dll.sources</response>
+    </project>
+    <project dir="class/I18N/West" library="I18N.West-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 /unsafe -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -debug -optimize /noconfig -r:./../../../class/lib/xammac/I18N.dll</flags>
+      <output>I18N.West.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/I18N.West.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>I18N.West.dll.sources</response>
+    </project>
+    <project dir="class/I18N/MidEast" library="I18N.MidEast-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 /unsafe -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -debug -optimize /noconfig -r:./../../../class/lib/xammac/I18N.dll</flags>
+      <output>I18N.MidEast.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/I18N.MidEast.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>I18N.MidEast.dll.sources</response>
+    </project>
+    <project dir="class/I18N/Other" library="I18N.Other-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 /unsafe -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -debug -optimize /noconfig -r:./../../../class/lib/xammac/I18N.dll</flags>
+      <output>I18N.Other.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/I18N.Other.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>I18N.Other.dll.sources</response>
+    </project>
+    <project dir="class/I18N/Rare" library="I18N.Rare-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 /unsafe -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -debug -optimize /noconfig -r:./../../../class/lib/xammac/I18N.dll</flags>
+      <output>I18N.Rare.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/I18N.Rare.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>I18N.Rare.dll.sources</response>
+    </project>
+    <project dir="class/I18N/CJK" library="I18N.CJK-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 /unsafe /resource:big5.table /resource:gb2312.table /resource:jis.table /resource:ks.table /resource:gb18030.table /define:DISABLE_UNSAFE -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -debug -optimize /noconfig -r:./../../../class/lib/xammac/I18N.dll</flags>
+      <output>I18N.CJK.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/I18N.CJK.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>I18N.CJK.dll.sources</response>
+    </project>
+    <project dir="class/System.ServiceModel.Internals" library="System.ServiceModel.Internals-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/xammac/mscorlib.dll -debug -optimize /noconfig /unsafe -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -r:./../../class/lib/xammac/System.dll -r:./../../class/lib/xammac/System.Core.dll -r:./../../class/lib/xammac/System.Xml.dll</flags>
+      <output>System.ServiceModel.Internals.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac/System.ServiceModel.Internals.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>./../../build/deps/xammac_System.ServiceModel.Internals.dll.sources</response>
+    </project>
+    <project dir="class/System.Runtime.Serialization" library="System.Runtime.Serialization-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/xammac/mscorlib.dll -debug -optimize /noconfig -unsafe -d:NO_DYNAMIC_CODEGEN /nowarn:168,169,219,414 /d:NO_CONFIGURATION /d:NO_SECURITY_ATTRIBUTES /d:NO_CODEDOM /d:NO_DESKTOP_SECURITY -r:./../../class/lib/xammac/System.dll -r:./../../class/lib/xammac/System.Xml.dll -r:./../../class/lib/xammac/System.Core.dll -r:./../../class/lib/xammac/System.ServiceModel.Internals.dll</flags>
+      <output>System.Runtime.Serialization.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac/System.Runtime.Serialization.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>./../../build/deps/xammac_System.Runtime.Serialization.dll.sources</response>
+    </project>
+    <project dir="class/System.Xml.Linq" library="System.Xml.Linq-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/xammac/mscorlib.dll -debug -optimize /noconfig -d:FEATURE_SERIALIZATION -d:MONO_HYBRID_SYSTEM_XML -r:./../../class/lib/xammac/System.dll -r:./../../class/lib/xammac/System.Core.dll -r:./../../class/lib/xammac/System.Xml.dll -r:./../../class/lib/xammac/System.Runtime.Serialization.dll</flags>
+      <output>System.Xml.Linq.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac/System.Xml.Linq.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Xml.Linq.dll.sources</response>
+    </project>
+    <project dir="class/System.IdentityModel" library="System.IdentityModel-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/xammac/mscorlib.dll -debug -optimize /noconfig /d:NET_3_0 -r:./../../class/lib/xammac/System.dll -r:./../../class/lib/xammac/System.Xml.dll -r:./../../class/lib/xammac/System.Security.dll -r:./../../class/lib/xammac/Mono.Security.dll -r:./../../class/lib/xammac/System.Runtime.Serialization.dll</flags>
+      <output>System.IdentityModel.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac/System.IdentityModel.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>./../../build/deps/xammac_System.IdentityModel.dll.sources</response>
+    </project>
+    <project dir="class/System.ServiceModel" library="System.ServiceModel-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/xammac/mscorlib.dll -debug -optimize /noconfig /nowarn:414,169,67,3005,436,219,618 /unsafe /d:TRACE /resource:resources/WS-Addressing.schema /resource:resources/ws-addr.xsd -r:./../../class/lib/xammac/System.dll -r:./../../class/lib/xammac/System.Xml.dll -r:./../../class/lib/xammac/System.Core.dll -r:./../../class/lib/xammac/System.Runtime.Serialization.dll -r:./../../class/lib/xammac/System.IdentityModel.dll</flags>
+      <output>System.ServiceModel.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac/System.ServiceModel.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>./../../build/deps/xammac_System.ServiceModel.dll.sources</response>
+    </project>
+    <project dir="class/System.ServiceModel" library="System.ServiceModel-plainservice-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/xammac/mscorlib.dll -debug -optimize /noconfig /nowarn:414,169,67,3005,436,219,618 /unsafe /d:TRACE /resource:resources/WS-Addressing.schema /resource:resources/ws-addr.xsd -r:./../../class/lib/xammac/System.dll -r:./../../class/lib/xammac/System.Xml.dll -r:./../../class/lib/xammac/System.Core.dll -r:./../../class/lib/xammac/System.Runtime.Serialization.dll -r:./../../class/lib/xammac/System.IdentityModel.dll</flags>
+      <output>System.ServiceModel.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac/plainservice/System.ServiceModel.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>./../../build/deps/xammac_System.ServiceModel.dll.sources</response>
+    </project>
+    <project dir="class/System.ServiceModel.Web" library="System.ServiceModel.Web-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/xammac/mscorlib.dll -debug -optimize /noconfig -r:./../../class/lib/xammac/System.dll -r:./../../class/lib/xammac/System.Xml.dll -r:./../../class/lib/xammac/System.Runtime.Serialization.dll -r:./../../class/lib/xammac/System.ServiceModel.dll -r:./../../class/lib/xammac/System.Core.dll</flags>
+      <output>System.ServiceModel.Web.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac/System.ServiceModel.Web.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>./../../build/deps/xammac_System.ServiceModel.Web.dll.sources</response>
+    </project>
+    <project dir="class/System.Json" library="System.Json-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/xammac/mscorlib.dll -debug -optimize /noconfig -r:./../../class/lib/xammac/System.dll -r:./../../class/lib/xammac/System.Xml.dll -r:./../../class/lib/xammac/System.Core.dll</flags>
+      <output>System.Json.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac/System.Json.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Json.dll.sources</response>
+    </project>
+    <project dir="class/System.Web.Services" library="System.Web.Services-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/xammac/mscorlib.dll -debug -optimize /noconfig -nowarn:649 -nowarn:169 -resource:System.Web.Services.Description/wsdl-1.1.xsd,wsdl-1.1.xsd -resource:System.Web.Services.Description/wsdl-1.1-soap.xsd,wsdl-1.1-soap.xsd -resource:System.Web.Services.Description/web-reference.xsd,web-reference.xsd -r:./../../class/lib/xammac/System.dll -r:./../../class/lib/xammac/System.Xml.dll</flags>
+      <output>System.Web.Services.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac/System.Web.Services.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>./../../build/deps/xammac_System.Web.Services.dll.sources</response>
+    </project>
+    <project dir="class/Mono.Data.Tds" library="Mono.Data.Tds-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/xammac/mscorlib.dll -debug -optimize /noconfig -r:./../../class/lib/xammac/System.dll -r:./../../class/lib/xammac/System.Xml.dll -r:./../../class/lib/xammac/Mono.Security.dll</flags>
+      <output>Mono.Data.Tds.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac/Mono.Data.Tds.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>Mono.Data.Tds.dll.sources</response>
+    </project>
+    <project dir="class/System.Transactions" library="System.Transactions-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/xammac/mscorlib.dll -debug -optimize /noconfig /define:MOBILE -r:./../../class/lib/xammac/System.dll</flags>
+      <output>System.Transactions.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac/System.Transactions.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Transactions.dll.sources</response>
+    </project>
+    <project dir="class/System.Numerics" library="System.Numerics-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/xammac/mscorlib.dll -debug -optimize /noconfig /unsafe -nowarn:414 -r:./../../class/lib/xammac/System.dll</flags>
+      <output>System.Numerics.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac/System.Numerics.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Numerics.dll.sources</response>
+    </project>
+    <project dir="class/System.Numerics.Vectors" library="System.Numerics.Vectors-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/xammac/mscorlib.dll -debug -optimize /noconfig -unsafe -r:./../../class/lib/xammac/System.dll -r:./../../class/lib/xammac/System.Numerics.dll</flags>
+      <output>System.Numerics.Vectors.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac/System.Numerics.Vectors.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Numerics.Vectors.dll.sources</response>
+    </project>
+    <project dir="class/System.Data" library="System.Data-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/xammac/mscorlib.dll -debug -optimize /noconfig -nowarn:219,414,649 -d:PLATFORM_UNIX -d:USEOFFSET -d:MONO_PARTIAL_DATA_IMPORT -unsafe -d:NO_CODEDOM -d:NO_OLEDB -d:NO_ODBC -d:NO_CONFIGURATION -r:./../../class/lib/xammac/System.dll -r:./../../class/lib/xammac/System.Xml.dll -r:./../../class/lib/xammac/System.Core.dll -r:./../../class/lib/xammac/System.Numerics.dll -r:./../../class/lib/xammac/Mono.Data.Tds.dll -r:./../../class/lib/xammac/System.Transactions.dll</flags>
+      <output>System.Data.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac/System.Data.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>./../../build/deps/xammac_System.Data.dll.sources</response>
+    </project>
+    <project dir="class/Mono.Data.Sqlite" library="Mono.Data.Sqlite-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/xammac/mscorlib.dll -debug -optimize /noconfig /unsafe -resource:resources/SR.resources -resource:resources/SQLiteCommand.bmp -resource:resources/SQLiteConnection.bmp -resource:resources/SQLiteDataAdapter.bmp -d:SQLITE_STANDARD -r:./../../class/lib/xammac/System.dll -r:./../../class/lib/xammac/System.Data.dll -r:./../../class/lib/xammac/System.Transactions.dll -r:./../../class/lib/xammac/System.Xml.dll</flags>
+      <output>Mono.Data.Sqlite.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac/Mono.Data.Sqlite.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>Mono.Data.Sqlite.dll.sources</response>
+    </project>
+    <project dir="class/System.Data.Services.Client" library="System.Data.Services.Client-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/xammac/mscorlib.dll -debug -optimize /noconfig -d:NET_3_5 -warn:2 -r:./../../class/lib/xammac/System.dll -r:./../../class/lib/xammac/System.Core.dll -r:./../../class/lib/xammac/System.Xml.Linq.dll -r:./../../class/lib/xammac/System.Data.dll -r:./../../class/lib/xammac/System.Xml.dll</flags>
+      <output>System.Data.Services.Client.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac/System.Data.Services.Client.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources>System.Data.Services.Client,Client/System.Data.Services.Client.txt</resources>
+      <response>System.Data.Services.Client.dll.sources</response>
+    </project>
+    <project dir="class/System.IO.Compression" library="System.IO.Compression-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/xammac/mscorlib.dll -debug -optimize /noconfig /unsafe -r:./../../class/lib/xammac/System.dll -r:./../../class/lib/xammac/System.Core.dll</flags>
+      <output>System.IO.Compression.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac/System.IO.Compression.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.IO.Compression.dll.sources</response>
+    </project>
+    <project dir="class/System.IO.Compression.FileSystem" library="System.IO.Compression.FileSystem-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/xammac/mscorlib.dll -debug -optimize /noconfig -r:./../../class/lib/xammac/System.dll -r:./../../class/lib/xammac/System.IO.Compression.dll</flags>
+      <output>System.IO.Compression.FileSystem.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac/System.IO.Compression.FileSystem.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.IO.Compression.FileSystem.dll.sources</response>
+    </project>
+    <project dir="class/System.ComponentModel.DataAnnotations" library="System.ComponentModel.DataAnnotations-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/xammac/mscorlib.dll -debug -optimize /noconfig -nowarn:414 -r:./../../class/lib/xammac/System.dll -r:./../../class/lib/xammac/System.Core.dll -r:./../../class/lib/xammac/System.Data.dll -r:./../../class/lib/xammac/System.Xml.dll</flags>
+      <output>System.ComponentModel.DataAnnotations.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac/System.ComponentModel.DataAnnotations.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.ComponentModel.DataAnnotations.dll.sources</response>
+    </project>
+    <project dir="class/System.ComponentModel.Composition.4.5" library="System.ComponentModel.Composition-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/xammac/mscorlib.dll -debug -optimize /noconfig -d:CLR40 -d:USE_ECMA_KEY,FEATURE_REFLECTIONCONTEXT,FEATURE_REFLECTIONFILEIO,FEATURE_SERIALIZATION,FEATURE_SLIMLOCK -nowarn:219,414 -r:./../../class/lib/xammac/System.dll -r:./../../class/lib/xammac/System.Core.dll</flags>
+      <output>System.ComponentModel.Composition.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac/System.ComponentModel.Composition.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources>Microsoft.Internal.Strings,src/ComponentModel/Strings.resx</resources>
+      <response>System.ComponentModel.Composition.dll.sources</response>
+    </project>
+    <project dir="class/System.Net" library="System.Net-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/xammac/mscorlib.dll -debug -optimize /noconfig -unsafe -r:./../../class/lib/xammac/System.dll -r:./../../class/lib/xammac/System.Core.dll -r:./../../class/lib/xammac/System.Xml.dll</flags>
+      <output>System.Net.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac/System.Net.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Net.dll.sources</response>
+    </project>
+    <project dir="class/System.Net.Http" library="System.Net.Http-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/xammac/mscorlib.dll -debug -optimize /noconfig -r:./../../class/lib/xammac/System.Core.dll -r:./../../class/lib/xammac/System.dll</flags>
+      <output>System.Net.Http.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac/System.Net.Http.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>./../../build/deps/xammac_System.Net.Http.dll.sources</response>
+    </project>
+    <project dir="class/System.Windows" library="System.Windows-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/xammac/mscorlib.dll -optimize /noconfig -r:./../../class/lib/xammac/System.dll</flags>
+      <output>System.Windows.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac/System.Windows.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Windows.dll.sources</response>
+    </project>
+    <project dir="class/System.Xml.Serialization" library="System.Xml.Serialization-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/xammac/mscorlib.dll -optimize /noconfig -r:./../../class/lib/xammac/System.Xml.dll -r:./../../class/lib/xammac/System.ServiceModel.dll</flags>
+      <output>System.Xml.Serialization.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac/System.Xml.Serialization.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Xml.Serialization.dll.sources</response>
+    </project>
+    <project dir="class/Mono.CSharp" library="Mono.CSharp-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/xammac/mscorlib.dll -debug -optimize /noconfig -d:MONO_FEATURE_THREAD_ABORT -r:./../../class/lib/xammac/System.Core.dll -r:./../../class/lib/xammac/System.Xml.dll -r:./../../class/lib/xammac/System.dll</flags>
+      <output>Mono.CSharp.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac/Mono.CSharp.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>Mono.CSharp.dll.sources</response>
+    </project>
+    <project dir="class/Microsoft.CSharp" library="Microsoft.CSharp-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/xammac/mscorlib.dll -debug -optimize /noconfig -r:./../../class/lib/xammac/System.Core.dll -r:./../../class/lib/xammac/Mono.CSharp.dll</flags>
+      <output>Microsoft.CSharp.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac/Microsoft.CSharp.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>Microsoft.CSharp.dll.sources</response>
+    </project>
+    <project dir="class/System.Runtime.InteropServices.RuntimeInformation" library="System.Runtime.InteropServices.RuntimeInformation-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/xammac/mscorlib.dll -debug -optimize /noconfig -r:./../../class/lib/xammac/System.dll</flags>
+      <output>System.Runtime.InteropServices.RuntimeInformation.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac/System.Runtime.InteropServices.RuntimeInformation.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Runtime.InteropServices.RuntimeInformation.dll.sources</response>
+    </project>
+    <project dir="class/System.Reflection.DispatchProxy" library="System.Reflection.DispatchProxy-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/xammac/mscorlib.dll -debug -optimize /noconfig -r:./../../class/lib/xammac/System.dll</flags>
+      <output>System.Reflection.DispatchProxy.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac/System.Reflection.DispatchProxy.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Reflection.DispatchProxy.dll.sources</response>
+    </project>
+    <project dir="class/System.Xml.XPath.XmlDocument" library="System.Xml.XPath.XmlDocument-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/xammac/mscorlib.dll -debug -optimize /noconfig -r:./../../class/lib/xammac/System.dll -r:./../../class/lib/xammac/System.Xml.dll</flags>
+      <output>System.Xml.XPath.XmlDocument.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac/System.Xml.XPath.XmlDocument.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Xml.XPath.XmlDocument.dll.sources</response>
+    </project>
+    <project dir="class/System.Reflection.Context" library="System.Reflection.Context-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/xammac/mscorlib.dll -debug -optimize /noconfig -r:./../../class/lib/xammac/System.dll</flags>
+      <output>System.Reflection.Context.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac/System.Reflection.Context.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Reflection.Context.dll.sources</response>
+    </project>
+    <project dir="class/System.Net.Http.WinHttpHandler" library="System.Net.Http.WinHttpHandler-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/xammac/mscorlib.dll -debug -optimize /noconfig -r:./../../class/lib/xammac/System.dll -r:./../../class/lib/xammac/System.Net.Http.dll</flags>
+      <output>System.Net.Http.WinHttpHandler.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac/System.Net.Http.WinHttpHandler.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Net.Http.WinHttpHandler.dll.sources</response>
+    </project>
+    <project dir="class/Mono.CompilerServices.SymbolWriter" library="Mono.CompilerServices.SymbolWriter-xammac">
+      <boot>true</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../class/lib/xammac/mscorlib.dll -debug -optimize /noconfig -r:./../../class/lib/xammac/System.dll</flags>
+      <output>Mono.CompilerServices.SymbolWriter.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac/Mono.CompilerServices.SymbolWriter.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>Mono.CompilerServices.SymbolWriter.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.X509Certificates" library="Facades_System.Security.Cryptography.X509Certificates-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll -r:./../../../class/lib/xammac/System.Core.dll</flags>
+      <output>System.Security.Cryptography.X509Certificates.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Security.Cryptography.X509Certificates.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.X509Certificates.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.ServiceModel.Primitives" library="Facades_System.ServiceModel.Primitives-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll -r:./../../../class/lib/xammac/System.ServiceModel.dll -r:./../../../class/lib/xammac/System.Xml.dll -r:./../../../class/lib/xammac/System.IdentityModel.dll -r:./../../../class/lib/xammac/Facades/System.Security.Cryptography.X509Certificates.dll</flags>
+      <output>System.ServiceModel.Primitives.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.ServiceModel.Primitives.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.ServiceModel.Primitives.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Runtime.Serialization.Primitives" library="Facades_System.Runtime.Serialization.Primitives-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -debug -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.Runtime.Serialization.dll</flags>
+      <output>System.Runtime.Serialization.Primitives.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Runtime.Serialization.Primitives.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Runtime.Serialization.Primitives.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Runtime.Serialization.Xml" library="Facades_System.Runtime.Serialization.Xml-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -debug -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 /d:NO_CODEDOM -r:./../../../class/lib/xammac/System.dll -r:./../../../class/lib/xammac/System.Runtime.Serialization.dll -r:./../../../class/lib/xammac/System.Xml.dll -r:./../../../class/lib/xammac/Facades/System.Runtime.Serialization.Primitives.dll</flags>
+      <output>System.Runtime.Serialization.Xml.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Runtime.Serialization.Xml.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Runtime.Serialization.Xml.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.Algorithms" library="Facades_System.Security.Cryptography.Algorithms-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll -r:./../../../class/lib/xammac/System.Core.dll</flags>
+      <output>System.Security.Cryptography.Algorithms.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Security.Cryptography.Algorithms.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.Algorithms.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.OpenSsl" library="Facades_System.Security.Cryptography.OpenSsl-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -debug -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.Core.dll -r:./../../../class/lib/xammac/Facades/System.Security.Cryptography.Algorithms.dll</flags>
+      <output>System.Security.Cryptography.OpenSsl.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Security.Cryptography.OpenSsl.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.OpenSsl.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Collections.Concurrent" library="Facades_System.Collections.Concurrent-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll</flags>
+      <output>System.Collections.Concurrent.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Collections.Concurrent.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Collections.Concurrent.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Collections" library="Facades_System.Collections-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll -r:./../../../class/lib/xammac/System.Core.dll</flags>
+      <output>System.Collections.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Collections.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Collections.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.ComponentModel.Annotations" library="Facades_System.ComponentModel.Annotations-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.ComponentModel.DataAnnotations.dll</flags>
+      <output>System.ComponentModel.Annotations.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.ComponentModel.Annotations.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.ComponentModel.Annotations.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.ComponentModel.EventBasedAsync" library="Facades_System.ComponentModel.EventBasedAsync-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll</flags>
+      <output>System.ComponentModel.EventBasedAsync.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.ComponentModel.EventBasedAsync.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.ComponentModel.EventBasedAsync.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.ComponentModel" library="Facades_System.ComponentModel-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll</flags>
+      <output>System.ComponentModel.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.ComponentModel.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.ComponentModel.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Diagnostics.Contracts" library="Facades_System.Diagnostics.Contracts-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Diagnostics.Contracts.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Diagnostics.Contracts.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Diagnostics.Contracts.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Diagnostics.Debug" library="Facades_System.Diagnostics.Debug-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll</flags>
+      <output>System.Diagnostics.Debug.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Diagnostics.Debug.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Diagnostics.Debug.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Diagnostics.Tracing" library="Facades_System.Diagnostics.Tracing-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -debug -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Diagnostics.Tracing.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Diagnostics.Tracing.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Diagnostics.Tracing.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Diagnostics.Tools" library="Facades_System.Diagnostics.Tools-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll</flags>
+      <output>System.Diagnostics.Tools.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Diagnostics.Tools.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Diagnostics.Tools.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Dynamic.Runtime" library="Facades_System.Dynamic.Runtime-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.Core.dll -r:./../../../class/lib/xammac/System.dll</flags>
+      <output>System.Dynamic.Runtime.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Dynamic.Runtime.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Dynamic.Runtime.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Globalization" library="Facades_System.Globalization-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Globalization.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Globalization.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Globalization.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.IO" library="Facades_System.IO-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll</flags>
+      <output>System.IO.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.IO.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.IO.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Linq.Expressions" library="Facades_System.Linq.Expressions-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.Core.dll</flags>
+      <output>System.Linq.Expressions.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Linq.Expressions.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Linq.Expressions.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Linq.Parallel" library="Facades_System.Linq.Parallel-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.Core.dll</flags>
+      <output>System.Linq.Parallel.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Linq.Parallel.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Linq.Parallel.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Linq.Queryable" library="Facades_System.Linq.Queryable-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.Core.dll</flags>
+      <output>System.Linq.Queryable.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Linq.Queryable.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Linq.Queryable.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Linq" library="Facades_System.Linq-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.Core.dll</flags>
+      <output>System.Linq.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Linq.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Linq.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.NetworkInformation" library="Facades_System.Net.NetworkInformation-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll</flags>
+      <output>System.Net.NetworkInformation.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Net.NetworkInformation.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Net.NetworkInformation.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.Primitives" library="Facades_System.Net.Primitives-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll</flags>
+      <output>System.Net.Primitives.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Net.Primitives.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Net.Primitives.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.Requests" library="Facades_System.Net.Requests-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll</flags>
+      <output>System.Net.Requests.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Net.Requests.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Net.Requests.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.ObjectModel" library="Facades_System.ObjectModel-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll</flags>
+      <output>System.ObjectModel.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.ObjectModel.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.ObjectModel.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Reflection.Extensions" library="Facades_System.Reflection.Extensions-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Reflection.Extensions.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Reflection.Extensions.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Reflection.Extensions.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Reflection.Primitives" library="Facades_System.Reflection.Primitives-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Reflection.Primitives.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Reflection.Primitives.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Reflection.Primitives.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Reflection" library="Facades_System.Reflection-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Reflection.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Reflection.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Reflection.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Resources.ResourceManager" library="Facades_System.Resources.ResourceManager-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Resources.ResourceManager.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Resources.ResourceManager.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Resources.ResourceManager.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Runtime.Extensions" library="Facades_System.Runtime.Extensions-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll</flags>
+      <output>System.Runtime.Extensions.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Runtime.Extensions.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Runtime.Extensions.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Runtime.InteropServices" library="Facades_System.Runtime.InteropServices-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll -r:./../../../class/lib/xammac/System.Core.dll</flags>
+      <output>System.Runtime.InteropServices.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Runtime.InteropServices.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Runtime.InteropServices.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Runtime.InteropServices.WindowsRuntime" library="Facades_System.Runtime.InteropServices.WindowsRuntime-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Runtime.InteropServices.WindowsRuntime.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Runtime.InteropServices.WindowsRuntime.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Runtime.InteropServices.WindowsRuntime.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Runtime.Numerics" library="Facades_System.Runtime.Numerics-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.Numerics.dll</flags>
+      <output>System.Runtime.Numerics.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Runtime.Numerics.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Runtime.Numerics.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Runtime.Serialization.Json" library="Facades_System.Runtime.Serialization.Json-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.Runtime.Serialization.dll</flags>
+      <output>System.Runtime.Serialization.Json.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Runtime.Serialization.Json.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Runtime.Serialization.Json.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Runtime" library="Facades_System.Runtime-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll -r:./../../../class/lib/xammac/System.ComponentModel.Composition.dll -r:./../../../class/lib/xammac/System.Core.dll</flags>
+      <output>System.Runtime.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Runtime.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Runtime.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Principal" library="Facades_System.Security.Principal-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Security.Principal.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Security.Principal.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Security.Principal.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.ServiceModel.Http" library="Facades_System.ServiceModel.Http-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.ServiceModel.dll</flags>
+      <output>System.ServiceModel.Http.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.ServiceModel.Http.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.ServiceModel.Http.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.ServiceModel.Security" library="Facades_System.ServiceModel.Security-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.ServiceModel.dll</flags>
+      <output>System.ServiceModel.Security.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.ServiceModel.Security.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.ServiceModel.Security.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Text.Encoding.Extensions" library="Facades_System.Text.Encoding.Extensions-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Text.Encoding.Extensions.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Text.Encoding.Extensions.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Text.Encoding.Extensions.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Text.Encoding" library="Facades_System.Text.Encoding-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Text.Encoding.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Text.Encoding.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Text.Encoding.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Text.RegularExpressions" library="Facades_System.Text.RegularExpressions-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll</flags>
+      <output>System.Text.RegularExpressions.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Text.RegularExpressions.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Text.RegularExpressions.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Threading.Tasks.Parallel" library="Facades_System.Threading.Tasks.Parallel-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Threading.Tasks.Parallel.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Threading.Tasks.Parallel.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Threading.Tasks.Parallel.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Threading.Tasks" library="Facades_System.Threading.Tasks-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.Core.dll</flags>
+      <output>System.Threading.Tasks.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Threading.Tasks.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Threading.Tasks.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Threading.Timer" library="Facades_System.Threading.Timer-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll -r:./../../../class/lib/xammac/System.Core.dll</flags>
+      <output>System.Threading.Timer.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Threading.Timer.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Threading.Timer.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Threading" library="Facades_System.Threading-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll -r:./../../../class/lib/xammac/System.Core.dll</flags>
+      <output>System.Threading.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Threading.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Threading.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Xml.ReaderWriter" library="Facades_System.Xml.ReaderWriter-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.Xml.dll</flags>
+      <output>System.Xml.ReaderWriter.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Xml.ReaderWriter.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Xml.ReaderWriter.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Xml.XDocument" library="Facades_System.Xml.XDocument-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.Xml.Linq.dll -r:./../../../class/lib/xammac/System.Xml.dll</flags>
+      <output>System.Xml.XDocument.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Xml.XDocument.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Xml.XDocument.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Xml.XmlSerializer" library="Facades_System.Xml.XmlSerializer-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.Xml.dll</flags>
+      <output>System.Xml.XmlSerializer.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Xml.XmlSerializer.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Xml.XmlSerializer.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Runtime.Handles" library="Facades_System.Runtime.Handles-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll -r:./../../../class/lib/xammac/System.Core.dll</flags>
+      <output>System.Runtime.Handles.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Runtime.Handles.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Runtime.Handles.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.ServiceModel.Duplex" library="Facades_System.ServiceModel.Duplex-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.ServiceModel.dll</flags>
+      <output>System.ServiceModel.Duplex.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.ServiceModel.Duplex.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.ServiceModel.Duplex.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.ServiceModel.NetTcp" library="Facades_System.ServiceModel.NetTcp-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.ServiceModel.dll</flags>
+      <output>System.ServiceModel.NetTcp.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.ServiceModel.NetTcp.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.ServiceModel.NetTcp.dll.sources</response>
+    </project>
+    <project dir="class/Facades/Microsoft.Win32.Primitives" library="Facades_Microsoft.Win32.Primitives-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll</flags>
+      <output>Microsoft.Win32.Primitives.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/Microsoft.Win32.Primitives.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>Microsoft.Win32.Primitives.dll.sources</response>
+    </project>
+    <project dir="class/Facades/Microsoft.Win32.Registry" library="Facades_Microsoft.Win32.Registry-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll</flags>
+      <output>Microsoft.Win32.Registry.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/Microsoft.Win32.Registry.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>Microsoft.Win32.Registry.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.AppContext" library="Facades_System.AppContext-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll</flags>
+      <output>System.AppContext.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.AppContext.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.AppContext.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Collections.NonGeneric" library="Facades_System.Collections.NonGeneric-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll</flags>
+      <output>System.Collections.NonGeneric.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Collections.NonGeneric.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Collections.NonGeneric.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Collections.Specialized" library="Facades_System.Collections.Specialized-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll</flags>
+      <output>System.Collections.Specialized.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Collections.Specialized.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Collections.Specialized.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.ComponentModel.Primitives" library="Facades_System.ComponentModel.Primitives-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll</flags>
+      <output>System.ComponentModel.Primitives.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.ComponentModel.Primitives.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.ComponentModel.Primitives.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.ComponentModel.TypeConverter" library="Facades_System.ComponentModel.TypeConverter-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll</flags>
+      <output>System.ComponentModel.TypeConverter.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.ComponentModel.TypeConverter.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.ComponentModel.TypeConverter.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Console" library="Facades_System.Console-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll</flags>
+      <output>System.Console.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Console.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Console.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Data.Common" library="Facades_System.Data.Common-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -debug -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll -r:./../../../class/lib/xammac/System.Data.dll -r:./../../../class/lib/xammac/System.Xml.dll</flags>
+      <output>System.Data.Common.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Data.Common.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Data.Common.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Data.SqlClient" library="Facades_System.Data.SqlClient-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll -r:./../../../class/lib/xammac/System.Data.dll -r:./../../../class/lib/xammac/System.Xml.dll</flags>
+      <output>System.Data.SqlClient.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Data.SqlClient.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Data.SqlClient.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Diagnostics.FileVersionInfo" library="Facades_System.Diagnostics.FileVersionInfo-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll</flags>
+      <output>System.Diagnostics.FileVersionInfo.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Diagnostics.FileVersionInfo.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Diagnostics.FileVersionInfo.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Diagnostics.Process" library="Facades_System.Diagnostics.Process-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll</flags>
+      <output>System.Diagnostics.Process.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Diagnostics.Process.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Diagnostics.Process.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Diagnostics.TextWriterTraceListener" library="Facades_System.Diagnostics.TextWriterTraceListener-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll</flags>
+      <output>System.Diagnostics.TextWriterTraceListener.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Diagnostics.TextWriterTraceListener.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Diagnostics.TextWriterTraceListener.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Diagnostics.TraceEvent" library="Facades_System.Diagnostics.TraceEvent-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll</flags>
+      <output>System.Diagnostics.TraceEvent.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Diagnostics.TraceEvent.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Diagnostics.TraceEvent.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Diagnostics.TraceSource" library="Facades_System.Diagnostics.TraceSource-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll</flags>
+      <output>System.Diagnostics.TraceSource.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Diagnostics.TraceSource.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Diagnostics.TraceSource.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Globalization.Calendars" library="Facades_System.Globalization.Calendars-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll</flags>
+      <output>System.Globalization.Calendars.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Globalization.Calendars.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Globalization.Calendars.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.IO.Compression.ZipFile" library="Facades_System.IO.Compression.ZipFile-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll -r:./../../../class/lib/xammac/System.IO.Compression.FileSystem.dll</flags>
+      <output>System.IO.Compression.ZipFile.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.IO.Compression.ZipFile.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.IO.Compression.ZipFile.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.IO.FileSystem" library="Facades_System.IO.FileSystem-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll</flags>
+      <output>System.IO.FileSystem.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.IO.FileSystem.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.IO.FileSystem.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.IO.FileSystem.DriveInfo" library="Facades_System.IO.FileSystem.DriveInfo-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll</flags>
+      <output>System.IO.FileSystem.DriveInfo.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.IO.FileSystem.DriveInfo.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.IO.FileSystem.DriveInfo.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.IO.FileSystem.Primitives" library="Facades_System.IO.FileSystem.Primitives-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll</flags>
+      <output>System.IO.FileSystem.Primitives.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.IO.FileSystem.Primitives.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.IO.FileSystem.Primitives.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.IO.IsolatedStorage" library="Facades_System.IO.IsolatedStorage-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll</flags>
+      <output>System.IO.IsolatedStorage.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.IO.IsolatedStorage.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.IO.IsolatedStorage.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.IO.MemoryMappedFiles" library="Facades_System.IO.MemoryMappedFiles-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll -r:./../../../class/lib/xammac/System.Core.dll</flags>
+      <output>System.IO.MemoryMappedFiles.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.IO.MemoryMappedFiles.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.IO.MemoryMappedFiles.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.IO.UnmanagedMemoryStream" library="Facades_System.IO.UnmanagedMemoryStream-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll</flags>
+      <output>System.IO.UnmanagedMemoryStream.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.IO.UnmanagedMemoryStream.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.IO.UnmanagedMemoryStream.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.AuthenticationManager" library="Facades_System.Net.AuthenticationManager-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll</flags>
+      <output>System.Net.AuthenticationManager.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Net.AuthenticationManager.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Net.AuthenticationManager.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.Cache" library="Facades_System.Net.Cache-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll</flags>
+      <output>System.Net.Cache.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Net.Cache.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Net.Cache.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.HttpListener" library="Facades_System.Net.HttpListener-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll</flags>
+      <output>System.Net.HttpListener.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Net.HttpListener.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Net.HttpListener.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.Mail" library="Facades_System.Net.Mail-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll</flags>
+      <output>System.Net.Mail.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Net.Mail.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Net.Mail.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.NameResolution" library="Facades_System.Net.NameResolution-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll</flags>
+      <output>System.Net.NameResolution.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Net.NameResolution.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Net.NameResolution.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.Security" library="Facades_System.Net.Security-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll</flags>
+      <output>System.Net.Security.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Net.Security.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Net.Security.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.ServicePoint" library="Facades_System.Net.ServicePoint-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll</flags>
+      <output>System.Net.ServicePoint.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Net.ServicePoint.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Net.ServicePoint.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.Sockets" library="Facades_System.Net.Sockets-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -debug -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll</flags>
+      <output>System.Net.Sockets.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Net.Sockets.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Net.Sockets.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.Utilities" library="Facades_System.Net.Utilities-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll</flags>
+      <output>System.Net.Utilities.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Net.Utilities.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Net.Utilities.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.WebHeaderCollection" library="Facades_System.Net.WebHeaderCollection-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll</flags>
+      <output>System.Net.WebHeaderCollection.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Net.WebHeaderCollection.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Net.WebHeaderCollection.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.WebSockets" library="Facades_System.Net.WebSockets-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll</flags>
+      <output>System.Net.WebSockets.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Net.WebSockets.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Net.WebSockets.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.WebSockets.Client" library="Facades_System.Net.WebSockets.Client-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll</flags>
+      <output>System.Net.WebSockets.Client.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Net.WebSockets.Client.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Net.WebSockets.Client.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Resources.ReaderWriter" library="Facades_System.Resources.ReaderWriter-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll</flags>
+      <output>System.Resources.ReaderWriter.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Resources.ReaderWriter.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Resources.ReaderWriter.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Runtime.CompilerServices.VisualC" library="Facades_System.Runtime.CompilerServices.VisualC-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll</flags>
+      <output>System.Runtime.CompilerServices.VisualC.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Runtime.CompilerServices.VisualC.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Runtime.CompilerServices.VisualC.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.AccessControl" library="Facades_System.Security.AccessControl-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll</flags>
+      <output>System.Security.AccessControl.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Security.AccessControl.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Security.AccessControl.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Claims" library="Facades_System.Security.Claims-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll</flags>
+      <output>System.Security.Claims.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Security.Claims.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Security.Claims.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.DeriveBytes" library="Facades_System.Security.Cryptography.DeriveBytes-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll</flags>
+      <output>System.Security.Cryptography.DeriveBytes.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Security.Cryptography.DeriveBytes.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.DeriveBytes.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.Encoding" library="Facades_System.Security.Cryptography.Encoding-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll</flags>
+      <output>System.Security.Cryptography.Encoding.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Security.Cryptography.Encoding.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.Encoding.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.Encryption" library="Facades_System.Security.Cryptography.Encryption-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll</flags>
+      <output>System.Security.Cryptography.Encryption.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Security.Cryptography.Encryption.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.Encryption.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.Encryption.Aes" library="Facades_System.Security.Cryptography.Encryption.Aes-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll</flags>
+      <output>System.Security.Cryptography.Encryption.Aes.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Security.Cryptography.Encryption.Aes.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.Encryption.Aes.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.Encryption.ECDiffieHellman" library="Facades_System.Security.Cryptography.Encryption.ECDiffieHellman-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll -r:./../../../class/lib/xammac/System.Core.dll</flags>
+      <output>System.Security.Cryptography.Encryption.ECDiffieHellman.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Security.Cryptography.Encryption.ECDiffieHellman.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.Encryption.ECDiffieHellman.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.Encryption.ECDsa" library="Facades_System.Security.Cryptography.Encryption.ECDsa-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll -r:./../../../class/lib/xammac/System.Core.dll</flags>
+      <output>System.Security.Cryptography.Encryption.ECDsa.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Security.Cryptography.Encryption.ECDsa.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.Encryption.ECDsa.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.Hashing" library="Facades_System.Security.Cryptography.Hashing-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll</flags>
+      <output>System.Security.Cryptography.Hashing.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Security.Cryptography.Hashing.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.Hashing.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.Hashing.Algorithms" library="Facades_System.Security.Cryptography.Hashing.Algorithms-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll</flags>
+      <output>System.Security.Cryptography.Hashing.Algorithms.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Security.Cryptography.Hashing.Algorithms.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.Hashing.Algorithms.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.RSA" library="Facades_System.Security.Cryptography.RSA-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll</flags>
+      <output>System.Security.Cryptography.RSA.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Security.Cryptography.RSA.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.RSA.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.RandomNumberGenerator" library="Facades_System.Security.Cryptography.RandomNumberGenerator-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll</flags>
+      <output>System.Security.Cryptography.RandomNumberGenerator.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Security.Cryptography.RandomNumberGenerator.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.RandomNumberGenerator.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Principal.Windows" library="Facades_System.Security.Principal.Windows-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll</flags>
+      <output>System.Security.Principal.Windows.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Security.Principal.Windows.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Security.Principal.Windows.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Threading.Thread" library="Facades_System.Threading.Thread-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll</flags>
+      <output>System.Threading.Thread.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Threading.Thread.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Threading.Thread.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Threading.ThreadPool" library="Facades_System.Threading.ThreadPool-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll</flags>
+      <output>System.Threading.ThreadPool.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Threading.ThreadPool.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Threading.ThreadPool.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Xml.XPath" library="Facades_System.Xml.XPath-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll -r:./../../../class/lib/xammac/System.Xml.dll</flags>
+      <output>System.Xml.XPath.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Xml.XPath.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Xml.XPath.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Xml.XmlDocument" library="Facades_System.Xml.XmlDocument-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll -r:./../../../class/lib/xammac/System.Xml.dll</flags>
+      <output>System.Xml.XmlDocument.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Xml.XmlDocument.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Xml.XmlDocument.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Xml.Xsl.Primitives" library="Facades_System.Xml.Xsl.Primitives-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll -r:./../../../class/lib/xammac/System.Xml.dll</flags>
+      <output>System.Xml.Xsl.Primitives.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Xml.Xsl.Primitives.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Xml.Xsl.Primitives.dll.sources</response>
+    </project>
+    <project dir="class/Facades/Microsoft.Win32.Registry.AccessControl" library="Facades_Microsoft.Win32.Registry.AccessControl-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -debug -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll</flags>
+      <output>Microsoft.Win32.Registry.AccessControl.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/Microsoft.Win32.Registry.AccessControl.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>Microsoft.Win32.Registry.AccessControl.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Diagnostics.StackTrace" library="Facades_System.Diagnostics.StackTrace-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -debug -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll</flags>
+      <output>System.Diagnostics.StackTrace.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Diagnostics.StackTrace.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Diagnostics.StackTrace.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Globalization.Extensions" library="Facades_System.Globalization.Extensions-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -debug -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll</flags>
+      <output>System.Globalization.Extensions.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Globalization.Extensions.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Globalization.Extensions.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.IO.FileSystem.AccessControl" library="Facades_System.IO.FileSystem.AccessControl-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -debug -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll</flags>
+      <output>System.IO.FileSystem.AccessControl.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.IO.FileSystem.AccessControl.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.IO.FileSystem.AccessControl.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Reflection.TypeExtensions" library="Facades_System.Reflection.TypeExtensions-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -debug -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll</flags>
+      <output>System.Reflection.TypeExtensions.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Reflection.TypeExtensions.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Reflection.TypeExtensions.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Reflection.Emit.Lightweight" library="Facades_System.Reflection.Emit.Lightweight-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Reflection.Emit.Lightweight.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Reflection.Emit.Lightweight.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Reflection.Emit.Lightweight.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Reflection.Emit.ILGeneration" library="Facades_System.Reflection.Emit.ILGeneration-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Reflection.Emit.ILGeneration.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Reflection.Emit.ILGeneration.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Reflection.Emit.ILGeneration.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Reflection.Emit" library="Facades_System.Reflection.Emit-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Reflection.Emit.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Reflection.Emit.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Reflection.Emit.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.SecureString" library="Facades_System.Security.SecureString-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -debug -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll</flags>
+      <output>System.Security.SecureString.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Security.SecureString.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Security.SecureString.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Threading.AccessControl" library="Facades_System.Threading.AccessControl-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -debug -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll</flags>
+      <output>System.Threading.AccessControl.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Threading.AccessControl.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Threading.AccessControl.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Threading.Overlapped" library="Facades_System.Threading.Overlapped-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -debug -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -unsafe -r:./../../../class/lib/xammac/System.dll</flags>
+      <output>System.Threading.Overlapped.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Threading.Overlapped.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Threading.Overlapped.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Xml.XPath.XDocument" library="Facades_System.Xml.XPath.XDocument-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -debug -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll -r:./../../../class/lib/xammac/System.Xml.dll -r:./../../../class/lib/xammac/System.Xml.Linq.dll</flags>
+      <output>System.Xml.XPath.XDocument.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Xml.XPath.XDocument.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Xml.XPath.XDocument.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.Primitives" library="Facades_System.Security.Cryptography.Primitives-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll</flags>
+      <output>System.Security.Cryptography.Primitives.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Security.Cryptography.Primitives.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.Primitives.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Text.Encoding.CodePages" library="Facades_System.Text.Encoding.CodePages-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -debug -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll</flags>
+      <output>System.Text.Encoding.CodePages.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Text.Encoding.CodePages.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Text.Encoding.CodePages.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.IO.FileSystem.Watcher" library="Facades_System.IO.FileSystem.Watcher-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll</flags>
+      <output>System.IO.FileSystem.Watcher.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.IO.FileSystem.Watcher.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.IO.FileSystem.Watcher.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.ProtectedData" library="Facades_System.Security.Cryptography.ProtectedData-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll -r:./../../../class/lib/xammac/System.Security.dll</flags>
+      <output>System.Security.Cryptography.ProtectedData.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Security.Cryptography.ProtectedData.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.ProtectedData.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.ServiceProcess.ServiceController" library="Facades_System.ServiceProcess.ServiceController-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -debug -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll</flags>
+      <output>System.ServiceProcess.ServiceController.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.ServiceProcess.ServiceController.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.ServiceProcess.ServiceController.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.IO.Pipes" library="Facades_System.IO.Pipes-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll -r:./../../../class/lib/xammac/System.Core.dll</flags>
+      <output>System.IO.Pipes.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.IO.Pipes.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.IO.Pipes.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.Ping" library="Facades_System.Net.Ping-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll</flags>
+      <output>System.Net.Ping.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Net.Ping.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Net.Ping.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Runtime.Serialization.Formatters" library="Facades_System.Runtime.Serialization.Formatters-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll</flags>
+      <output>System.Runtime.Serialization.Formatters.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Runtime.Serialization.Formatters.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Runtime.Serialization.Formatters.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.Csp" library="Facades_System.Security.Cryptography.Csp-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll</flags>
+      <output>System.Security.Cryptography.Csp.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Security.Cryptography.Csp.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.Csp.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.Pkcs" library="Facades_System.Security.Cryptography.Pkcs-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll -r:./../../../class/lib/xammac/System.Security.dll</flags>
+      <output>System.Security.Cryptography.Pkcs.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Security.Cryptography.Pkcs.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.Pkcs.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.Cng" library="Facades_System.Security.Cryptography.Cng-xammac">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:MOBILE -d:MOBILE_DYNAMIC -d:XAMMAC -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:XAMARIN_MODERN -d:NETSTANDARD -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac/System.dll -r:./../../../class/lib/xammac/System.Core.dll</flags>
+      <output>System.Security.Cryptography.Cng.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac/Facades/System.Security.Cryptography.Cng.dll</library_output>
+      <fx_version>2.1</fx_version>
+      <profile>xammac</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.Cng.dll.sources</response>
+    </project>
+    <project dir="class/corlib" library="corlib-xammac_net_4_5">
+      <boot>true</boot>
+      <flags>/codepage:65001 -unsafe -nostdlib -nowarn:612,618,1635 -d:INSIDE_CORLIB,MONO_CULTURE_DATA -d:LIBC -d:FEATURE_PAL,GENERICS_WORK,FEATURE_LIST_PREDICATES,FEATURE_SERIALIZATION,FEATURE_ASCII,FEATURE_LATIN1,FEATURE_UTF7,FEATURE_UTF32,MONO_HYBRID_ENCODING_SUPPORT,FEATURE_ASYNC_IO,NEW_EXPERIMENTAL_ASYNC_IO,FEATURE_UTF32,FEATURE_EXCEPTIONDISPATCHINFO,FEATURE_CORRUPTING_EXCEPTIONS,FEATURE_EXCEPTION_NOTIFICATIONS,FEATURE_STRONGNAME_MIGRATION,FEATURE_USE_LCID,FEATURE_FUSION,FEATURE_CRYPTO,FEATURE_X509_SECURESTRINGS,FEATURE_SYNCHRONIZATIONCONTEXT,FEATURE_SYNCHRONIZATIONCONTEXT_WAIT,HAS_CORLIB_CONTRACTS -d:FEATURE_MACL -d:FEATURE_REMOTING,MONO_COM,FEATURE_COMINTEROP,FEATURE_ROLE_BASED_SECURITY -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig -d:FEATURE_PAL,GENERICS_WORK,FEATURE_LIST_PREDICATES,FEATURE_SERIALIZATION,FEATURE_ASCII,FEATURE_LATIN1,FEATURE_UTF7,FEATURE_UTF32,MONO_HYBRID_ENCODING_SUPPORT,FEATURE_ASYNC_IO,NEW_EXPERIMENTAL_ASYNC_IO,FEATURE_UTF32,FEATURE_EXCEPTIONDISPATCHINFO,FEATURE_CORRUPTING_EXCEPTIONS,FEATURE_EXCEPTION_NOTIFICATIONS,FEATURE_STRONGNAME_MIGRATION,FEATURE_USE_LCID,FEATURE_FUSION,FEATURE_CRYPTO,FEATURE_X509_SECURESTRINGS,FEATURE_SYNCHRONIZATIONCONTEXT,FEATURE_SYNCHRONIZATIONCONTEXT_WAIT,HAS_CORLIB_CONTRACTS -d:FEATURE_MACL -d:FEATURE_REMOTING,MONO_COM,FEATURE_COMINTEROP,FEATURE_ROLE_BASED_SECURITY -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -resource:resources/charinfo.nlp -resource:resources/collation.core.bin -resource:resources/collation.tailoring.bin -resource:resources/collation.cjkCHS.bin -resource:resources/collation.cjkCHT.bin -resource:resources/collation.cjkJA.bin -resource:resources/collation.cjkKO.bin -resource:resources/collation.cjkKOlv2.bin --runtime:v4</flags>
+      <output>mscorlib.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac_net_4_5/mscorlib.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>corlib.dll.sources</response>
+    </project>
+    <project dir="class/corlib" library="corlib-tests-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -unsafe -nostdlib -nowarn:612,618,1635 -d:INSIDE_CORLIB,MONO_CULTURE_DATA -d:LIBC -d:FEATURE_PAL,GENERICS_WORK,FEATURE_LIST_PREDICATES,FEATURE_SERIALIZATION,FEATURE_ASCII,FEATURE_LATIN1,FEATURE_UTF7,FEATURE_UTF32,MONO_HYBRID_ENCODING_SUPPORT,FEATURE_ASYNC_IO,NEW_EXPERIMENTAL_ASYNC_IO,FEATURE_UTF32,FEATURE_EXCEPTIONDISPATCHINFO,FEATURE_CORRUPTING_EXCEPTIONS,FEATURE_EXCEPTION_NOTIFICATIONS,FEATURE_STRONGNAME_MIGRATION,FEATURE_USE_LCID,FEATURE_FUSION,FEATURE_CRYPTO,FEATURE_X509_SECURESTRINGS,FEATURE_SYNCHRONIZATIONCONTEXT,FEATURE_SYNCHRONIZATIONCONTEXT_WAIT,HAS_CORLIB_CONTRACTS -d:FEATURE_MACL -d:FEATURE_REMOTING,MONO_COM,FEATURE_COMINTEROP,FEATURE_ROLE_BASED_SECURITY -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize -r:./../../class/lib/xammac_net_4_5/mscorlib.dll -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -debug -nowarn:168,219,618,672 -unsafe -define:MONO_DATACONVERTER_STATIC_METHODS -resource:Test/resources/Resources.resources</flags>
+      <output>xammac_net_4_5_corlib_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>xammac_net_4_5_corlib_test.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>./../../build/deps/xammac_net_4_5_corlib_test.dll.response</response>
+    </project>
+    <project dir="class/Mono.Security" library="Mono.Security-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig -unsafe -nowarn:1030,3009 -r:./../../class/lib/xammac_net_4_5/bare/System.dll</flags>
+      <output>Mono.Security.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac_net_4_5/Mono.Security.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>Mono.Security.dll.sources</response>
+    </project>
+    <project dir="class/Mono.Security" library="Mono.Security-tests-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize -r:./../../class/lib/xammac_net_4_5/Mono.Security.dll -unsafe -nowarn:1030,3009 -r:./../../class/lib/xammac_net_4_5/bare/System.dll -nowarn:169,219,618,672</flags>
+      <output>xammac_net_4_5_Mono.Security_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>xammac_net_4_5_Mono.Security_test.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>./../../build/deps/xammac_net_4_5_Mono.Security_test.dll.response</response>
+    </project>
+    <project dir="class/System" library="System-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig -d:CONFIGURATION_2_0 -d:FEATURE_PAL,SYSTEM_NAMESPACE,MONO,PLATFORM_UNIX -d:MONO_FEATURE_PROCESS_START -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -unsafe -resource:resources/Asterisk.wav -resource:resources/Beep.wav -resource:resources/Exclamation.wav -resource:resources/Hand.wav -resource:resources/Question.wav -d:SECURITY_DEP -d:XML_DEP -d:MONO_SECURITY_ALIAS -d:CONFIGURATION_DEP -r:./../../class/lib/xammac_net_4_5/System.Xml.dll -r:./../../class/lib/xammac_net_4_5/System.Configuration.dll -r:MonoSecurity=./../../class/lib/xammac_net_4_5/Mono.Security.dll</flags>
+      <output>System.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac_net_4_5/System.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>./../../build/deps/xammac_net_4_5_System.dll.sources</response>
+    </project>
+    <project dir="class/System" library="System-tests-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize -r:./../../class/lib/xammac_net_4_5/secxml/System.dll -nowarn:618,672,219,67,169,612 -resource:Test/System/test-uri-props.txt,test-uri-props.txt -resource:Test/System/test-uri-props-manual.txt,test-uri-props-manual.txt -resource:Test/System/test-uri-relative-props.txt,test-uri-relative-props.txt -d:MONO_FEATURE_PROCESS_START -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS</flags>
+      <output>xammac_net_4_5_System_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>xammac_net_4_5_System_test.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>./../../build/deps/xammac_net_4_5_System_test.dll.response</response>
+    </project>
+    <project dir="class/System" library="System-bare-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig -d:CONFIGURATION_2_0 -d:FEATURE_PAL,SYSTEM_NAMESPACE,MONO,PLATFORM_UNIX -d:MONO_FEATURE_PROCESS_START -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -unsafe -resource:resources/Asterisk.wav -resource:resources/Beep.wav -resource:resources/Exclamation.wav -resource:resources/Hand.wav -resource:resources/Question.wav</flags>
+      <output>System.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac_net_4_5/bare/System.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>./../../build/deps/xammac_net_4_5_System.dll.sources</response>
+    </project>
+    <project dir="class/System" library="System-tests-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize -r:./../../class/lib/xammac_net_4_5/secxml/System.dll -nowarn:618,672,219,67,169,612 -resource:Test/System/test-uri-props.txt,test-uri-props.txt -resource:Test/System/test-uri-props-manual.txt,test-uri-props-manual.txt -resource:Test/System/test-uri-relative-props.txt,test-uri-relative-props.txt -d:MONO_FEATURE_PROCESS_START -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS</flags>
+      <output>xammac_net_4_5_System_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>xammac_net_4_5_System_test.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>./../../build/deps/xammac_net_4_5_System_test.dll.response</response>
+    </project>
+    <project dir="class/System" library="System-secxml-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig -d:CONFIGURATION_2_0 -d:FEATURE_PAL,SYSTEM_NAMESPACE,MONO,PLATFORM_UNIX -d:MONO_FEATURE_PROCESS_START -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -unsafe -resource:resources/Asterisk.wav -resource:resources/Beep.wav -resource:resources/Exclamation.wav -resource:resources/Hand.wav -resource:resources/Question.wav -d:SECURITY_DEP -d:XML_DEP -d:MONO_SECURITY_ALIAS -r:./../../class/lib/xammac_net_4_5/bare/System.Xml.dll -r:MonoSecurity=./../../class/lib/xammac_net_4_5/Mono.Security.dll</flags>
+      <output>System.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac_net_4_5/secxml/System.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>./../../build/deps/xammac_net_4_5_System.dll.sources</response>
+    </project>
+    <project dir="class/System" library="System-tests-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize -r:./../../class/lib/xammac_net_4_5/secxml/System.dll -nowarn:618,672,219,67,169,612 -resource:Test/System/test-uri-props.txt,test-uri-props.txt -resource:Test/System/test-uri-props-manual.txt,test-uri-props-manual.txt -resource:Test/System/test-uri-relative-props.txt,test-uri-relative-props.txt -d:MONO_FEATURE_PROCESS_START -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS</flags>
+      <output>xammac_net_4_5_System_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>xammac_net_4_5_System_test.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>./../../build/deps/xammac_net_4_5_System_test.dll.response</response>
+    </project>
+    <project dir="class/Mono.Posix" library="Mono.Posix-xammac_net_4_5">
+      <boot>true</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /unsafe /nowarn:0618,612 -r:./../../class/lib/xammac_net_4_5/System.dll</flags>
+      <output>Mono.Posix.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac_net_4_5/Mono.Posix.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>Mono.Posix.dll.sources</response>
+    </project>
+    <project dir="class/Mono.Posix" library="Mono.Posix-tests-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize -r:./../../class/lib/xammac_net_4_5/Mono.Posix.dll /unsafe /nowarn:0219,0618</flags>
+      <output>xammac_net_4_5_Mono.Posix_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>xammac_net_4_5_Mono.Posix_test.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>./../../build/deps/xammac_net_4_5_Mono.Posix_test.dll.response</response>
+    </project>
+    <project dir="class/System.Core" library="System.Core-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig -d:FEATURE_PAL,PFX_LEGACY_3_5,FEATURE_NETCORE -d:INSIDE_SYSCORE -d:LIBC -unsafe -d:NET_3_5 -nowarn:1720 -d:FEATURE_CORE_DLR,FEATURE_REFEMIT,FEATURE_PDBEMIT -r:./../../class/lib/xammac_net_4_5/System.dll -r:./../../class/lib/xammac_net_4_5/Mono.Posix.dll</flags>
+      <output>System.Core.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac_net_4_5/System.Core.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>./../../build/deps/xammac_net_4_5_System.Core.dll.sources</response>
+    </project>
+    <project dir="class/System.Core" library="System.Core-tests-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize -r:./../../class/lib/xammac_net_4_5/plaincore/System.Core.dll -d:FEATURE_PAL,PFX_LEGACY_3_5,FEATURE_NETCORE -d:INSIDE_SYSCORE -d:LIBC -unsafe -d:NET_3_5 -nowarn:1720 -d:FEATURE_CORE_DLR,FEATURE_REFEMIT,FEATURE_PDBEMIT -r:./../../class/lib/xammac_net_4_5/System.dll -r:./../../class/lib/xammac_net_4_5/Mono.Posix.dll</flags>
+      <output>xammac_net_4_5_System.Core_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>xammac_net_4_5_System.Core_test.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>./../../build/deps/xammac_net_4_5_System.Core_test.dll.response</response>
+    </project>
+    <project dir="class/System.Core" library="System.Core-plaincore-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig -d:FEATURE_PAL,PFX_LEGACY_3_5,FEATURE_NETCORE -d:INSIDE_SYSCORE -d:LIBC -unsafe -d:NET_3_5 -nowarn:1720 -d:FEATURE_CORE_DLR,FEATURE_REFEMIT,FEATURE_PDBEMIT -r:./../../class/lib/xammac_net_4_5/System.dll -r:./../../class/lib/xammac_net_4_5/Mono.Posix.dll</flags>
+      <output>System.Core.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac_net_4_5/plaincore/System.Core.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>./../../build/deps/xammac_net_4_5_System.Core.dll.sources</response>
+    </project>
+    <project dir="class/System.Core" library="System.Core-tests-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize -r:./../../class/lib/xammac_net_4_5/plaincore/System.Core.dll -d:FEATURE_PAL,PFX_LEGACY_3_5,FEATURE_NETCORE -d:INSIDE_SYSCORE -d:LIBC -unsafe -d:NET_3_5 -nowarn:1720 -d:FEATURE_CORE_DLR,FEATURE_REFEMIT,FEATURE_PDBEMIT -r:./../../class/lib/xammac_net_4_5/System.dll -r:./../../class/lib/xammac_net_4_5/Mono.Posix.dll</flags>
+      <output>xammac_net_4_5_System.Core_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>xammac_net_4_5_System.Core_test.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>./../../build/deps/xammac_net_4_5_System.Core_test.dll.response</response>
+    </project>
+    <project dir="class/System.Security" library="System.Security-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig -nowarn:618 -d:SECURITY_DEP -nowarn:414 -r:./../../class/lib/xammac_net_4_5/secxml/System.dll -r:./../../class/lib/xammac_net_4_5/bare/System.Xml.dll -r:./../../class/lib/xammac_net_4_5/Mono.Security.dll</flags>
+      <output>System.Security.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac_net_4_5/System.Security.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Security.dll.sources</response>
+    </project>
+    <project dir="class/System.Security" library="System.Security-tests-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize -r:./../../class/lib/xammac_net_4_5/System.Security.dll -nowarn:618 -d:SECURITY_DEP -nowarn:414 -r:./../../class/lib/xammac_net_4_5/secxml/System.dll -r:./../../class/lib/xammac_net_4_5/bare/System.Xml.dll -r:./../../class/lib/xammac_net_4_5/Mono.Security.dll -nowarn:168,169,183,219,414</flags>
+      <output>xammac_net_4_5_System.Security_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>xammac_net_4_5_System.Security_test.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>./../../build/deps/xammac_net_4_5_System.Security_test.dll.response</response>
+    </project>
+    <project dir="class/System.XML" library="System.Xml-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig -nowarn:219,414,649,1717 -unsafe -d:ASYNC -d:CONFIGURATION_DEP -r:./../../class/lib/xammac_net_4_5/secxml/System.dll -r:./../../class/lib/xammac_net_4_5/System.Configuration.dll</flags>
+      <output>System.Xml.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac_net_4_5/System.Xml.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Xml.dll.sources</response>
+    </project>
+    <project dir="class/System.XML" library="System.Xml-tests-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize -r:./../../class/lib/xammac_net_4_5/bare/System.Xml.dll -nowarn:219,414,649,1717 -unsafe -d:ASYNC -r:./../../class/lib/xammac_net_4_5/bare/System.dll -nowarn:0618 -nowarn:219 -nowarn:169</flags>
+      <output>xammac_net_4_5_System.Xml_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>xammac_net_4_5_System.Xml_test.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>./../../build/deps/xammac_net_4_5_System.Xml_test.dll.response</response>
+    </project>
+    <project dir="class/System.XML" library="System.Xml-bare-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig -nowarn:219,414,649,1717 -unsafe -d:ASYNC -r:./../../class/lib/xammac_net_4_5/bare/System.dll</flags>
+      <output>System.Xml.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac_net_4_5/bare/System.Xml.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Xml.dll.sources</response>
+    </project>
+    <project dir="class/System.XML" library="System.Xml-tests-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize -r:./../../class/lib/xammac_net_4_5/bare/System.Xml.dll -nowarn:219,414,649,1717 -unsafe -d:ASYNC -r:./../../class/lib/xammac_net_4_5/bare/System.dll -nowarn:0618 -nowarn:219 -nowarn:169</flags>
+      <output>xammac_net_4_5_System.Xml_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>xammac_net_4_5_System.Xml_test.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>./../../build/deps/xammac_net_4_5_System.Xml_test.dll.response</response>
+    </project>
+    <project dir="class/I18N/Common" library="I18N-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 /unsafe /define:DISABLE_UNSAFE -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig</flags>
+      <output>I18N.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/I18N.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>I18N.dll.sources</response>
+    </project>
+    <project dir="class/I18N/West" library="I18N.West-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 /unsafe -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig -r:./../../../class/lib/xammac_net_4_5/I18N.dll</flags>
+      <output>I18N.West.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/I18N.West.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>I18N.West.dll.sources</response>
+    </project>
+    <project dir="class/I18N/West" library="I18N.West-tests-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 /unsafe -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize -r:./../../../class/lib/xammac_net_4_5/I18N.West.dll</flags>
+      <output>xammac_net_4_5_I18N.West_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>xammac_net_4_5_I18N.West_test.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>./../../../build/deps/xammac_net_4_5_I18N.West_test.dll.response</response>
+    </project>
+    <project dir="class/I18N/MidEast" library="I18N.MidEast-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 /unsafe -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig -r:./../../../class/lib/xammac_net_4_5/I18N.dll</flags>
+      <output>I18N.MidEast.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/I18N.MidEast.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>I18N.MidEast.dll.sources</response>
+    </project>
+    <project dir="class/I18N/MidEast" library="I18N.MidEast-tests-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 /unsafe -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize -r:./../../../class/lib/xammac_net_4_5/I18N.MidEast.dll</flags>
+      <output>xammac_net_4_5_I18N.MidEast_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>xammac_net_4_5_I18N.MidEast_test.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>./../../../build/deps/xammac_net_4_5_I18N.MidEast_test.dll.response</response>
+    </project>
+    <project dir="class/I18N/Other" library="I18N.Other-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 /unsafe -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig -r:./../../../class/lib/xammac_net_4_5/I18N.dll</flags>
+      <output>I18N.Other.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/I18N.Other.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>I18N.Other.dll.sources</response>
+    </project>
+    <project dir="class/I18N/Rare" library="I18N.Rare-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 /unsafe -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig -r:./../../../class/lib/xammac_net_4_5/I18N.dll</flags>
+      <output>I18N.Rare.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/I18N.Rare.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>I18N.Rare.dll.sources</response>
+    </project>
+    <project dir="class/I18N/CJK" library="I18N.CJK-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 /unsafe /resource:big5.table /resource:gb2312.table /resource:jis.table /resource:ks.table /resource:gb18030.table /define:DISABLE_UNSAFE -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig -r:./../../../class/lib/xammac_net_4_5/I18N.dll</flags>
+      <output>I18N.CJK.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/I18N.CJK.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>I18N.CJK.dll.sources</response>
+    </project>
+    <project dir="class/I18N/CJK" library="I18N.CJK-tests-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 /unsafe /resource:big5.table /resource:gb2312.table /resource:jis.table /resource:ks.table /resource:gb18030.table /define:DISABLE_UNSAFE -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize -r:./../../../class/lib/xammac_net_4_5/I18N.CJK.dll</flags>
+      <output>xammac_net_4_5_I18N.CJK_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>xammac_net_4_5_I18N.CJK_test.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>./../../../build/deps/xammac_net_4_5_I18N.CJK_test.dll.response</response>
+    </project>
+    <project dir="class/System.ServiceModel.Internals" library="System.ServiceModel.Internals-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /unsafe -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -r:./../../class/lib/xammac_net_4_5/System.dll -r:./../../class/lib/xammac_net_4_5/System.Core.dll -r:./../../class/lib/xammac_net_4_5/System.Xml.dll -r:./../../class/lib/xammac_net_4_5/System.Configuration.dll</flags>
+      <output>System.ServiceModel.Internals.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac_net_4_5/System.ServiceModel.Internals.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.ServiceModel.Internals.dll.sources</response>
+    </project>
+    <project dir="class/SMDiagnostics" library="SMDiagnostics-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig -r:./../../class/lib/xammac_net_4_5/System.dll -r:./../../class/lib/xammac_net_4_5/System.Core.dll -r:./../../class/lib/xammac_net_4_5/System.Xml.dll -r:./../../class/lib/xammac_net_4_5/System.ServiceModel.Internals.dll -r:./../../class/lib/xammac_net_4_5/System.Configuration.dll</flags>
+      <output>SMDiagnostics.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac_net_4_5/SMDiagnostics.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>SMDiagnostics.dll.sources</response>
+    </project>
+    <project dir="class/System.Numerics" library="System.Numerics-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /unsafe -nowarn:414 -r:./../../class/lib/xammac_net_4_5/System.dll</flags>
+      <output>System.Numerics.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac_net_4_5/System.Numerics.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Numerics.dll.sources</response>
+    </project>
+    <project dir="class/System.Numerics" library="System.Numerics-tests-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize -r:./../../class/lib/xammac_net_4_5/System.Numerics.dll /unsafe -nowarn:414 -r:./../../class/lib/xammac_net_4_5/System.dll</flags>
+      <output>xammac_net_4_5_System.Numerics_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>xammac_net_4_5_System.Numerics_test.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>./../../build/deps/xammac_net_4_5_System.Numerics_test.dll.response</response>
+    </project>
+    <project dir="class/System.Numerics.Vectors" library="System.Numerics.Vectors-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig -unsafe -r:./../../class/lib/xammac_net_4_5/System.dll -r:./../../class/lib/xammac_net_4_5/System.Numerics.dll</flags>
+      <output>System.Numerics.Vectors.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac_net_4_5/System.Numerics.Vectors.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Numerics.Vectors.dll.sources</response>
+    </project>
+    <project dir="class/Mono.Data.Tds" library="Mono.Data.Tds-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig -r:./../../class/lib/xammac_net_4_5/System.dll -r:./../../class/lib/xammac_net_4_5/System.Xml.dll -r:./../../class/lib/xammac_net_4_5/Mono.Security.dll</flags>
+      <output>Mono.Data.Tds.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac_net_4_5/Mono.Data.Tds.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>Mono.Data.Tds.dll.sources</response>
+    </project>
+    <project dir="class/Mono.Data.Tds" library="Mono.Data.Tds-tests-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize -r:./../../class/lib/xammac_net_4_5/Mono.Data.Tds.dll</flags>
+      <output>xammac_net_4_5_Mono.Data.Tds_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>xammac_net_4_5_Mono.Data.Tds_test.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>./../../build/deps/xammac_net_4_5_Mono.Data.Tds_test.dll.response</response>
+    </project>
+    <project dir="class/System.Transactions" library="System.Transactions-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig -r:./../../class/lib/xammac_net_4_5/System.dll -r:./../../class/lib/xammac_net_4_5/System.Configuration.dll</flags>
+      <output>System.Transactions.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac_net_4_5/System.Transactions.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Transactions.dll.sources</response>
+    </project>
+    <project dir="class/System.Transactions" library="System.Transactions-tests-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize -r:./../../class/lib/xammac_net_4_5/System.Transactions.dll -r:./../../class/lib/xammac_net_4_5/System.dll -r:./../../class/lib/xammac_net_4_5/System.Configuration.dll</flags>
+      <output>xammac_net_4_5_System.Transactions_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>xammac_net_4_5_System.Transactions_test.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>./../../build/deps/xammac_net_4_5_System.Transactions_test.dll.response</response>
+    </project>
+    <project dir="class/System.EnterpriseServices" library="System.EnterpriseServices-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /nowarn:0168 /nowarn:0162 -r:./../../class/lib/xammac_net_4_5/System.Transactions.dll</flags>
+      <output>System.EnterpriseServices.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac_net_4_5/System.EnterpriseServices.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.EnterpriseServices.dll.sources</response>
+    </project>
+    <project dir="class/System.Data" library="System.Data-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig -nowarn:219,414,649 -d:PLATFORM_UNIX -d:USEOFFSET -d:MONO_PARTIAL_DATA_IMPORT -unsafe -r:./../../class/lib/xammac_net_4_5/System.dll -r:./../../class/lib/xammac_net_4_5/System.Xml.dll -r:./../../class/lib/xammac_net_4_5/System.Core.dll -r:./../../class/lib/xammac_net_4_5/System.Numerics.dll -r:./../../class/lib/xammac_net_4_5/System.EnterpriseServices.dll -r:./../../class/lib/xammac_net_4_5/Mono.Data.Tds.dll -r:./../../class/lib/xammac_net_4_5/System.Configuration.dll -r:./../../class/lib/xammac_net_4_5/System.Transactions.dll</flags>
+      <output>System.Data.dll</output>
+      <built_sources>gen_OdbcConnection.cs gen_OleDbConnection.cs gen_OdbcParameter.cs gen_OleDbParameter.cs gen_OdbcParameterCollection.cs gen_OleDbParameterCollection.cs</built_sources>
+      <library_output>./../../class/lib/xammac_net_4_5/System.Data.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>./../../build/deps/xammac_net_4_5_System.Data.dll.sources</response>
+    </project>
+    <project dir="class/System.Data" library="System.Data-tests-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize -r:./../../class/lib/xammac_net_4_5/System.Data.dll -nowarn:219,414,649 -d:PLATFORM_UNIX -d:USEOFFSET -d:MONO_PARTIAL_DATA_IMPORT -unsafe -r:./../../class/lib/xammac_net_4_5/System.dll -r:./../../class/lib/xammac_net_4_5/System.Xml.dll -r:./../../class/lib/xammac_net_4_5/System.Core.dll -r:./../../class/lib/xammac_net_4_5/System.Numerics.dll -r:./../../class/lib/xammac_net_4_5/System.EnterpriseServices.dll -r:./../../class/lib/xammac_net_4_5/Mono.Data.Tds.dll -r:./../../class/lib/xammac_net_4_5/System.Configuration.dll -r:./../../class/lib/xammac_net_4_5/System.Transactions.dll -nowarn:618,169,612,219,168</flags>
+      <output>xammac_net_4_5_System.Data_test.dll</output>
+      <built_sources>gen_OdbcConnection.cs gen_OleDbConnection.cs gen_OdbcParameter.cs gen_OleDbParameter.cs gen_OdbcParameterCollection.cs gen_OleDbParameterCollection.cs</built_sources>
+      <library_output>xammac_net_4_5_System.Data_test.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>./../../build/deps/xammac_net_4_5_System.Data_test.dll.response</response>
+    </project>
+    <project dir="class/System.Runtime.Serialization" library="System.Runtime.Serialization-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig -unsafe -d:NO_DYNAMIC_CODEGEN /nowarn:168,169,219,414 /d:NET_3_0 /d:NO_CONFIGURATION -r:./../../class/lib/xammac_net_4_5/System.dll -r:./../../class/lib/xammac_net_4_5/System.Xml.dll -r:./../../class/lib/xammac_net_4_5/System.Core.dll -r:./../../class/lib/xammac_net_4_5/System.ServiceModel.Internals.dll -r:./../../class/lib/xammac_net_4_5/System.Data.dll -r:./../../class/lib/xammac_net_4_5/System.Configuration.dll -r:./../../class/lib/xammac_net_4_5/SMDiagnostics.dll</flags>
+      <output>System.Runtime.Serialization.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac_net_4_5/System.Runtime.Serialization.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>./../../build/deps/xammac_net_4_5_System.Runtime.Serialization.dll.sources</response>
+    </project>
+    <project dir="class/System.Runtime.Serialization" library="System.Runtime.Serialization-tests-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize -r:./../../class/lib/xammac_net_4_5/System.Runtime.Serialization.dll -unsafe -d:NO_DYNAMIC_CODEGEN /nowarn:168,169,219,414 /d:NET_3_0 /d:NO_CONFIGURATION -r:./../../class/lib/xammac_net_4_5/System.dll -r:./../../class/lib/xammac_net_4_5/System.Xml.dll -r:./../../class/lib/xammac_net_4_5/System.Core.dll -r:./../../class/lib/xammac_net_4_5/System.ServiceModel.Internals.dll -r:./../../class/lib/xammac_net_4_5/System.Data.dll -r:./../../class/lib/xammac_net_4_5/System.Configuration.dll -r:./../../class/lib/xammac_net_4_5/SMDiagnostics.dll /resource:Test/Resources/WSDL/collections.wsdl /resource:Test/Resources/WSDL/custom-collections.wsdl</flags>
+      <output>xammac_net_4_5_System.Runtime.Serialization_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>xammac_net_4_5_System.Runtime.Serialization_test.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>./../../build/deps/xammac_net_4_5_System.Runtime.Serialization_test.dll.response</response>
+    </project>
+    <project dir="class/System.Xml.Linq" library="System.Xml.Linq-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig -d:FEATURE_SERIALIZATION -r:./../../class/lib/xammac_net_4_5/System.dll -r:./../../class/lib/xammac_net_4_5/System.Core.dll -r:./../../class/lib/xammac_net_4_5/System.Xml.dll -r:./../../class/lib/xammac_net_4_5/System.Runtime.Serialization.dll</flags>
+      <output>System.Xml.Linq.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac_net_4_5/System.Xml.Linq.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Xml.Linq.dll.sources</response>
+    </project>
+    <project dir="class/System.Xml.Linq" library="System.Xml.Linq-tests-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize -r:./../../class/lib/xammac_net_4_5/System.Xml.Linq.dll -d:FEATURE_SERIALIZATION -r:./../../class/lib/xammac_net_4_5/System.dll -r:./../../class/lib/xammac_net_4_5/System.Core.dll -r:./../../class/lib/xammac_net_4_5/System.Xml.dll -r:./../../class/lib/xammac_net_4_5/System.Runtime.Serialization.dll</flags>
+      <output>xammac_net_4_5_System.Xml.Linq_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>xammac_net_4_5_System.Xml.Linq_test.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>./../../build/deps/xammac_net_4_5_System.Xml.Linq_test.dll.response</response>
+    </project>
+    <project dir="class/Mono.Data.Sqlite" library="Mono.Data.Sqlite-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /unsafe -resource:resources/SR.resources -resource:resources/SQLiteCommand.bmp -resource:resources/SQLiteConnection.bmp -resource:resources/SQLiteDataAdapter.bmp -d:SQLITE_STANDARD -r:./../../class/lib/xammac_net_4_5/System.dll -r:./../../class/lib/xammac_net_4_5/System.Data.dll -r:./../../class/lib/xammac_net_4_5/System.Transactions.dll -r:./../../class/lib/xammac_net_4_5/System.Xml.dll</flags>
+      <output>Mono.Data.Sqlite.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac_net_4_5/Mono.Data.Sqlite.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>Mono.Data.Sqlite.dll.sources</response>
+    </project>
+    <project dir="class/Mono.Data.Sqlite" library="Mono.Data.Sqlite-tests-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize -r:./../../class/lib/xammac_net_4_5/Mono.Data.Sqlite.dll /unsafe -resource:resources/SR.resources -resource:resources/SQLiteCommand.bmp -resource:resources/SQLiteConnection.bmp -resource:resources/SQLiteDataAdapter.bmp -d:SQLITE_STANDARD -r:./../../class/lib/xammac_net_4_5/System.dll -r:./../../class/lib/xammac_net_4_5/System.Data.dll -r:./../../class/lib/xammac_net_4_5/System.Transactions.dll -r:./../../class/lib/xammac_net_4_5/System.Xml.dll /nowarn:618</flags>
+      <output>xammac_net_4_5_Mono.Data.Sqlite_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>xammac_net_4_5_Mono.Data.Sqlite_test.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>./../../build/deps/xammac_net_4_5_Mono.Data.Sqlite_test.dll.response</response>
+    </project>
+    <project dir="class/System.Runtime.Serialization.Formatters.Soap" library="System.Runtime.Serialization.Formatters.Soap-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig -r:./../../class/lib/xammac_net_4_5/System.Xml.dll</flags>
+      <output>System.Runtime.Serialization.Formatters.Soap.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac_net_4_5/System.Runtime.Serialization.Formatters.Soap.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Runtime.Serialization.Formatters.Soap.dll.sources</response>
+    </project>
+    <project dir="class/System.Runtime.Serialization.Formatters.Soap" library="System.Runtime.Serialization.Formatters.Soap-tests-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize -r:./../../class/lib/xammac_net_4_5/System.Runtime.Serialization.Formatters.Soap.dll -r:./../../class/lib/xammac_net_4_5/System.Xml.dll -nowarn:0618 -nowarn:219 -nowarn:169</flags>
+      <output>xammac_net_4_5_System.Runtime.Serialization.Formatters.Soap_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>xammac_net_4_5_System.Runtime.Serialization.Formatters.Soap_test.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>./../../build/deps/xammac_net_4_5_System.Runtime.Serialization.Formatters.Soap_test.dll.response</response>
+    </project>
+    <project dir="class/System.ComponentModel.DataAnnotations" library="System.ComponentModel.DataAnnotations-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig -nowarn:414 -r:./../../class/lib/xammac_net_4_5/System.dll -r:./../../class/lib/xammac_net_4_5/System.Core.dll -r:./../../class/lib/xammac_net_4_5/System.Data.dll -r:./../../class/lib/xammac_net_4_5/System.Xml.dll</flags>
+      <output>System.ComponentModel.DataAnnotations.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac_net_4_5/System.ComponentModel.DataAnnotations.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.ComponentModel.DataAnnotations.dll.sources</response>
+    </project>
+    <project dir="class/System.ComponentModel.DataAnnotations" library="System.ComponentModel.DataAnnotations-tests-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize -r:./../../class/lib/xammac_net_4_5/System.ComponentModel.DataAnnotations.dll -nowarn:414 -r:./../../class/lib/xammac_net_4_5/System.dll -r:./../../class/lib/xammac_net_4_5/System.Core.dll -r:./../../class/lib/xammac_net_4_5/System.Data.dll -r:./../../class/lib/xammac_net_4_5/System.Xml.dll</flags>
+      <output>xammac_net_4_5_System.ComponentModel.DataAnnotations_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>xammac_net_4_5_System.ComponentModel.DataAnnotations_test.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>./../../build/deps/xammac_net_4_5_System.ComponentModel.DataAnnotations_test.dll.response</response>
+    </project>
+    <project dir="class/System.IdentityModel" library="System.IdentityModel-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /d:NET_3_0 -r:./../../class/lib/xammac_net_4_5/System.dll -r:./../../class/lib/xammac_net_4_5/System.Xml.dll -r:./../../class/lib/xammac_net_4_5/System.Security.dll -r:./../../class/lib/xammac_net_4_5/Mono.Security.dll -r:./../../class/lib/xammac_net_4_5/System.Runtime.Serialization.dll -r:./../../class/lib/xammac_net_4_5/System.Configuration.dll</flags>
+      <output>System.IdentityModel.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac_net_4_5/System.IdentityModel.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>./../../build/deps/xammac_net_4_5_System.IdentityModel.dll.sources</response>
+    </project>
+    <project dir="class/System.IdentityModel" library="System.IdentityModel-tests-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize -r:./../../class/lib/xammac_net_4_5/System.IdentityModel.dll /d:NET_3_0 -r:./../../class/lib/xammac_net_4_5/System.dll -r:./../../class/lib/xammac_net_4_5/System.Xml.dll -r:./../../class/lib/xammac_net_4_5/System.Security.dll -r:./../../class/lib/xammac_net_4_5/Mono.Security.dll -r:./../../class/lib/xammac_net_4_5/System.Runtime.Serialization.dll -r:./../../class/lib/xammac_net_4_5/System.Configuration.dll</flags>
+      <output>xammac_net_4_5_System.IdentityModel_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>xammac_net_4_5_System.IdentityModel_test.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>./../../build/deps/xammac_net_4_5_System.IdentityModel_test.dll.response</response>
+    </project>
+    <project dir="class/System.IdentityModel.Selectors" library="System.IdentityModel.Selectors-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /d:NET_3_0 -r:./../../class/lib/xammac_net_4_5/System.dll -r:./../../class/lib/xammac_net_4_5/System.Xml.dll -r:./../../class/lib/xammac_net_4_5/System.Security.dll -r:./../../class/lib/xammac_net_4_5/System.Runtime.Serialization.dll -r:./../../class/lib/xammac_net_4_5/System.IdentityModel.dll</flags>
+      <output>System.IdentityModel.Selectors.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac_net_4_5/System.IdentityModel.Selectors.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.IdentityModel.Selectors.dll.sources</response>
+    </project>
+    <project dir="class/Mono.Messaging" library="Mono.Messaging-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig -r:./../../class/lib/xammac_net_4_5/System.dll -r:./../../class/lib/xammac_net_4_5/System.Configuration.dll</flags>
+      <output>Mono.Messaging.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac_net_4_5/Mono.Messaging.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>Mono.Messaging.dll.sources</response>
+    </project>
+    <project dir="class/Mono.Messaging" library="Mono.Messaging-tests-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize -r:./../../class/lib/xammac_net_4_5/Mono.Messaging.dll -r:./../../class/lib/xammac_net_4_5/System.dll -r:./../../class/lib/xammac_net_4_5/System.Configuration.dll -nowarn:0618 -nowarn:219 -nowarn:169</flags>
+      <output>xammac_net_4_5_Mono.Messaging_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>xammac_net_4_5_Mono.Messaging_test.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>./../../build/deps/xammac_net_4_5_Mono.Messaging_test.dll.response</response>
+    </project>
+    <project dir="class/System.Configuration.Install" library="System.Configuration.Install-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig -r:./../../class/lib/xammac_net_4_5/System.dll -r:./../../class/lib/xammac_net_4_5/System.Xml.dll</flags>
+      <output>System.Configuration.Install.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac_net_4_5/System.Configuration.Install.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Configuration.Install.dll.sources</response>
+    </project>
+    <project dir="class/System.Messaging" library="System.Messaging-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /resource:System.Messaging/MessageQueue.resx -d:NO_WINFORMS_DEPENDENCY -r:./../../class/lib/xammac_net_4_5/System.dll -r:./../../class/lib/xammac_net_4_5/System.Xml.dll -r:./../../class/lib/xammac_net_4_5/Mono.Messaging.dll -r:./../../class/lib/xammac_net_4_5/System.Configuration.Install.dll</flags>
+      <output>System.Messaging.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac_net_4_5/System.Messaging.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Messaging.dll.sources</response>
+    </project>
+    <project dir="class/System.Messaging" library="System.Messaging-tests-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize -r:./../../class/lib/xammac_net_4_5/System.Messaging.dll /resource:System.Messaging/MessageQueue.resx -d:NO_WINFORMS_DEPENDENCY -r:./../../class/lib/xammac_net_4_5/System.dll -r:./../../class/lib/xammac_net_4_5/System.Xml.dll -r:./../../class/lib/xammac_net_4_5/Mono.Messaging.dll -r:./../../class/lib/xammac_net_4_5/System.Configuration.Install.dll -nowarn:0618 -nowarn:219 -nowarn:169</flags>
+      <output>xammac_net_4_5_System.Messaging_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>xammac_net_4_5_System.Messaging_test.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>./../../build/deps/xammac_net_4_5_System.Messaging_test.dll.response</response>
+    </project>
+    <project dir="class/System.Web.Services" library="System.Web.Services-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig -nowarn:168,169,219,414,612,649 -d:MONO_BROKEN_CONFIGURATION_DLL -resource:System.Web.Services.Description/wsdl-1.1.xsd,wsdl-1.1.xsd -resource:System.Web.Services.Description/wsdl-1.1-soap.xsd,wsdl-1.1-soap.xsd -resource:System.Web.Services.Description/web-reference.xsd,web-reference.xsd -r:./../../class/lib/xammac_net_4_5/System.dll -r:./../../class/lib/xammac_net_4_5/System.EnterpriseServices.dll -r:./../../class/lib/xammac_net_4_5/System.Xml.dll -r:./../../class/lib/xammac_net_4_5/System.Data.dll -r:./../../class/lib/xammac_net_4_5/System.Configuration.dll</flags>
+      <output>System.Web.Services.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac_net_4_5/System.Web.Services.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>./../../build/deps/xammac_net_4_5_System.Web.Services.dll.sources</response>
+    </project>
+    <project dir="class/System.Web.Services" library="System.Web.Services-tests-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize -r:./../../class/lib/xammac_net_4_5/System.Web.Services.dll -nowarn:168,169,219,414,612,649 -d:MONO_BROKEN_CONFIGURATION_DLL -resource:System.Web.Services.Description/wsdl-1.1.xsd,wsdl-1.1.xsd -resource:System.Web.Services.Description/wsdl-1.1-soap.xsd,wsdl-1.1-soap.xsd -resource:System.Web.Services.Description/web-reference.xsd,web-reference.xsd -r:./../../class/lib/xammac_net_4_5/System.dll -r:./../../class/lib/xammac_net_4_5/System.EnterpriseServices.dll -r:./../../class/lib/xammac_net_4_5/System.Xml.dll -r:./../../class/lib/xammac_net_4_5/System.Data.dll -r:./../../class/lib/xammac_net_4_5/System.Configuration.dll -nowarn:618 -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME</flags>
+      <output>xammac_net_4_5_System.Web.Services_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>xammac_net_4_5_System.Web.Services_test.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>./../../build/deps/xammac_net_4_5_System.Web.Services_test.dll.response</response>
+    </project>
+    <project dir="class/System.ServiceModel" library="System.ServiceModel-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /nowarn:414,169,67,3005,436,219,618 /unsafe /d:TRACE /resource:resources/WS-Addressing.schema /resource:resources/ws-addr.xsd /d:NET_3_0 -r:./../../class/lib/xammac_net_4_5/System.dll -r:./../../class/lib/xammac_net_4_5/System.Xml.dll -r:./../../class/lib/xammac_net_4_5/System.Core.dll -r:./../../class/lib/xammac_net_4_5/System.Runtime.Serialization.dll -r:./../../class/lib/xammac_net_4_5/System.IdentityModel.dll -r:./../../class/lib/xammac_net_4_5/System.ServiceModel.Internals.dll -r:./../../class/lib/xammac_net_4_5/System.Configuration.dll -r:./../../class/lib/xammac_net_4_5/System.Data.dll -r:./../../class/lib/xammac_net_4_5/System.Security.dll -r:./../../class/lib/xammac_net_4_5/System.IdentityModel.Selectors.dll -r:./../../class/lib/xammac_net_4_5/System.Transactions.dll -r:./../../class/lib/xammac_net_4_5/System.Messaging.dll -r:./../../class/lib/xammac_net_4_5/System.Web.Services.dll -r:./../../class/lib/xammac_net_4_5/Mono.Security.dll</flags>
+      <output>System.ServiceModel.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac_net_4_5/System.ServiceModel.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>./../../build/deps/xammac_net_4_5_System.ServiceModel.dll.sources</response>
+    </project>
+    <project dir="class/System.ServiceModel" library="System.ServiceModel-tests-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize -r:./../../class/lib/xammac_net_4_5/plainservice/System.ServiceModel.dll /nowarn:414,169,67,3005,436,219,618 /unsafe /d:TRACE /resource:resources/WS-Addressing.schema /resource:resources/ws-addr.xsd /d:NET_3_0 -r:./../../class/lib/xammac_net_4_5/System.dll -r:./../../class/lib/xammac_net_4_5/System.Xml.dll -r:./../../class/lib/xammac_net_4_5/System.Core.dll -r:./../../class/lib/xammac_net_4_5/System.Runtime.Serialization.dll -r:./../../class/lib/xammac_net_4_5/System.IdentityModel.dll -r:./../../class/lib/xammac_net_4_5/System.ServiceModel.Internals.dll -r:./../../class/lib/xammac_net_4_5/System.Configuration.dll -r:./../../class/lib/xammac_net_4_5/System.Data.dll -r:./../../class/lib/xammac_net_4_5/System.Security.dll -r:./../../class/lib/xammac_net_4_5/System.IdentityModel.Selectors.dll -r:./../../class/lib/xammac_net_4_5/System.Transactions.dll -r:./../../class/lib/xammac_net_4_5/System.Messaging.dll -r:./../../class/lib/xammac_net_4_5/System.Web.Services.dll -r:./../../class/lib/xammac_net_4_5/Mono.Security.dll</flags>
+      <output>xammac_net_4_5_System.ServiceModel_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>xammac_net_4_5_System.ServiceModel_test.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>./../../build/deps/xammac_net_4_5_System.ServiceModel_test.dll.response</response>
+    </project>
+    <project dir="class/System.ServiceModel" library="System.ServiceModel-plainservice-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /nowarn:414,169,67,3005,436,219,618 /unsafe /d:TRACE /resource:resources/WS-Addressing.schema /resource:resources/ws-addr.xsd /d:NET_3_0 -r:./../../class/lib/xammac_net_4_5/System.dll -r:./../../class/lib/xammac_net_4_5/System.Xml.dll -r:./../../class/lib/xammac_net_4_5/System.Core.dll -r:./../../class/lib/xammac_net_4_5/System.Runtime.Serialization.dll -r:./../../class/lib/xammac_net_4_5/System.IdentityModel.dll -r:./../../class/lib/xammac_net_4_5/System.ServiceModel.Internals.dll -r:./../../class/lib/xammac_net_4_5/System.Configuration.dll -r:./../../class/lib/xammac_net_4_5/System.Data.dll -r:./../../class/lib/xammac_net_4_5/System.Security.dll -r:./../../class/lib/xammac_net_4_5/System.IdentityModel.Selectors.dll -r:./../../class/lib/xammac_net_4_5/System.Transactions.dll -r:./../../class/lib/xammac_net_4_5/System.Messaging.dll -r:./../../class/lib/xammac_net_4_5/System.Web.Services.dll -r:./../../class/lib/xammac_net_4_5/Mono.Security.dll</flags>
+      <output>System.ServiceModel.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac_net_4_5/plainservice/System.ServiceModel.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>./../../build/deps/xammac_net_4_5_System.ServiceModel.dll.sources</response>
+    </project>
+    <project dir="class/System.ServiceModel" library="System.ServiceModel-tests-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize -r:./../../class/lib/xammac_net_4_5/plainservice/System.ServiceModel.dll /nowarn:414,169,67,3005,436,219,618 /unsafe /d:TRACE /resource:resources/WS-Addressing.schema /resource:resources/ws-addr.xsd /d:NET_3_0 -r:./../../class/lib/xammac_net_4_5/System.dll -r:./../../class/lib/xammac_net_4_5/System.Xml.dll -r:./../../class/lib/xammac_net_4_5/System.Core.dll -r:./../../class/lib/xammac_net_4_5/System.Runtime.Serialization.dll -r:./../../class/lib/xammac_net_4_5/System.IdentityModel.dll -r:./../../class/lib/xammac_net_4_5/System.ServiceModel.Internals.dll -r:./../../class/lib/xammac_net_4_5/System.Configuration.dll -r:./../../class/lib/xammac_net_4_5/System.Data.dll -r:./../../class/lib/xammac_net_4_5/System.Security.dll -r:./../../class/lib/xammac_net_4_5/System.IdentityModel.Selectors.dll -r:./../../class/lib/xammac_net_4_5/System.Transactions.dll -r:./../../class/lib/xammac_net_4_5/System.Messaging.dll -r:./../../class/lib/xammac_net_4_5/System.Web.Services.dll -r:./../../class/lib/xammac_net_4_5/Mono.Security.dll</flags>
+      <output>xammac_net_4_5_System.ServiceModel_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>xammac_net_4_5_System.ServiceModel_test.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>./../../build/deps/xammac_net_4_5_System.ServiceModel_test.dll.response</response>
+    </project>
+    <project dir="class/System.ServiceModel.Web" library="System.ServiceModel.Web-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig -d:NET_3_5 -d:NET_3_0 -r:./../../class/lib/xammac_net_4_5/System.dll -r:./../../class/lib/xammac_net_4_5/System.Xml.dll -r:./../../class/lib/xammac_net_4_5/System.Runtime.Serialization.dll -r:./../../class/lib/xammac_net_4_5/System.ServiceModel.dll -r:./../../class/lib/xammac_net_4_5/System.Core.dll -r:./../../class/lib/xammac_net_4_5/System.Configuration.dll</flags>
+      <output>System.ServiceModel.Web.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac_net_4_5/System.ServiceModel.Web.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>./../../build/deps/xammac_net_4_5_System.ServiceModel.Web.dll.sources</response>
+    </project>
+    <project dir="class/System.ServiceModel.Web" library="System.ServiceModel.Web-tests-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize -r:./../../class/lib/xammac_net_4_5/System.ServiceModel.Web.dll -d:NET_3_5 -d:NET_3_0 -r:./../../class/lib/xammac_net_4_5/System.dll -r:./../../class/lib/xammac_net_4_5/System.Xml.dll -r:./../../class/lib/xammac_net_4_5/System.Runtime.Serialization.dll -r:./../../class/lib/xammac_net_4_5/System.ServiceModel.dll -r:./../../class/lib/xammac_net_4_5/System.Core.dll -r:./../../class/lib/xammac_net_4_5/System.Configuration.dll</flags>
+      <output>xammac_net_4_5_System.ServiceModel.Web_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>xammac_net_4_5_System.ServiceModel.Web_test.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>./../../build/deps/xammac_net_4_5_System.ServiceModel.Web_test.dll.response</response>
+    </project>
+    <project dir="class/System.Json" library="System.Json-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig -r:./../../class/lib/xammac_net_4_5/System.dll -r:./../../class/lib/xammac_net_4_5/System.Xml.dll -r:./../../class/lib/xammac_net_4_5/System.Core.dll</flags>
+      <output>System.Json.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac_net_4_5/System.Json.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Json.dll.sources</response>
+    </project>
+    <project dir="class/System.Json" library="System.Json-tests-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize -r:./../../class/lib/xammac_net_4_5/System.Json.dll -r:./../../class/lib/xammac_net_4_5/System.dll -r:./../../class/lib/xammac_net_4_5/System.Xml.dll -r:./../../class/lib/xammac_net_4_5/System.Core.dll</flags>
+      <output>xammac_net_4_5_System.Json_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>xammac_net_4_5_System.Json_test.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>./../../build/deps/xammac_net_4_5_System.Json_test.dll.response</response>
+    </project>
+    <project dir="class/System.Data.Services.Client" library="System.Data.Services.Client-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig -d:NET_3_5 -warn:2 -r:./../../class/lib/xammac_net_4_5/System.dll -r:./../../class/lib/xammac_net_4_5/System.Core.dll -r:./../../class/lib/xammac_net_4_5/System.Xml.Linq.dll -r:./../../class/lib/xammac_net_4_5/System.Data.dll -r:./../../class/lib/xammac_net_4_5/System.Xml.dll</flags>
+      <output>System.Data.Services.Client.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac_net_4_5/System.Data.Services.Client.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources>System.Data.Services.Client,Client/System.Data.Services.Client.txt</resources>
+      <response>System.Data.Services.Client.dll.sources</response>
+    </project>
+    <project dir="class/System.IO.Compression" library="System.IO.Compression-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /unsafe -r:./../../class/lib/xammac_net_4_5/System.dll -r:./../../class/lib/xammac_net_4_5/System.Core.dll</flags>
+      <output>System.IO.Compression.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac_net_4_5/System.IO.Compression.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.IO.Compression.dll.sources</response>
+    </project>
+    <project dir="class/System.IO.Compression" library="System.IO.Compression-tests-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize -r:./../../class/lib/xammac_net_4_5/System.IO.Compression.dll</flags>
+      <output>xammac_net_4_5_System.IO.Compression_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>xammac_net_4_5_System.IO.Compression_test.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>./../../build/deps/xammac_net_4_5_System.IO.Compression_test.dll.response</response>
+    </project>
+    <project dir="class/System.IO.Compression.FileSystem" library="System.IO.Compression.FileSystem-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig -r:./../../class/lib/xammac_net_4_5/System.dll -r:./../../class/lib/xammac_net_4_5/System.IO.Compression.dll</flags>
+      <output>System.IO.Compression.FileSystem.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac_net_4_5/System.IO.Compression.FileSystem.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.IO.Compression.FileSystem.dll.sources</response>
+    </project>
+    <project dir="class/System.IO.Compression.FileSystem" library="System.IO.Compression.FileSystem-tests-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize -r:./../../class/lib/xammac_net_4_5/System.IO.Compression.FileSystem.dll</flags>
+      <output>xammac_net_4_5_System.IO.Compression.FileSystem_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>xammac_net_4_5_System.IO.Compression.FileSystem_test.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>./../../build/deps/xammac_net_4_5_System.IO.Compression.FileSystem_test.dll.response</response>
+    </project>
+    <project dir="class/System.ComponentModel.Composition.4.5" library="System.ComponentModel.Composition-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig -d:CLR40 -d:USE_ECMA_KEY,FEATURE_REFLECTIONCONTEXT,FEATURE_REFLECTIONFILEIO,FEATURE_SERIALIZATION,FEATURE_SLIMLOCK -nowarn:219,414 -r:./../../class/lib/xammac_net_4_5/System.dll -r:./../../class/lib/xammac_net_4_5/System.Core.dll</flags>
+      <output>System.ComponentModel.Composition.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac_net_4_5/System.ComponentModel.Composition.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources>Microsoft.Internal.Strings,src/ComponentModel/Strings.resx</resources>
+      <response>System.ComponentModel.Composition.dll.sources</response>
+    </project>
+    <project dir="class/System.Net" library="System.Net-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig -unsafe -d:NET_3_5 -nowarn:1720 -r:./../../class/lib/xammac_net_4_5/System.dll -r:./../../class/lib/xammac_net_4_5/System.Core.dll -r:./../../class/lib/xammac_net_4_5/System.Xml.dll</flags>
+      <output>System.Net.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac_net_4_5/System.Net.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Net.dll.sources</response>
+    </project>
+    <project dir="class/System.Windows" library="System.Windows-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig -r:./../../class/lib/xammac_net_4_5/System.dll</flags>
+      <output>System.Windows.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac_net_4_5/System.Windows.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Windows.dll.sources</response>
+    </project>
+    <project dir="class/System.Xml.Serialization" library="System.Xml.Serialization-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig -r:./../../class/lib/xammac_net_4_5/System.Xml.dll -r:./../../class/lib/xammac_net_4_5/System.ServiceModel.dll</flags>
+      <output>System.Xml.Serialization.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac_net_4_5/System.Xml.Serialization.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Xml.Serialization.dll.sources</response>
+    </project>
+    <project dir="class/Mono.CSharp" library="Mono.CSharp-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig -d:MONO_FEATURE_THREAD_ABORT -r:./../../class/lib/xammac_net_4_5/System.Core.dll -r:./../../class/lib/xammac_net_4_5/System.Xml.dll -r:./../../class/lib/xammac_net_4_5/System.dll</flags>
+      <output>Mono.CSharp.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac_net_4_5/Mono.CSharp.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>Mono.CSharp.dll.sources</response>
+    </project>
+    <project dir="class/Mono.CSharp" library="Mono.CSharp-tests-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize -r:./../../class/lib/xammac_net_4_5/Mono.CSharp.dll</flags>
+      <output>xammac_net_4_5_Mono.CSharp_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>xammac_net_4_5_Mono.CSharp_test.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>./../../build/deps/xammac_net_4_5_Mono.CSharp_test.dll.response</response>
+    </project>
+    <project dir="class/Microsoft.CSharp" library="Microsoft.CSharp-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig -r:./../../class/lib/xammac_net_4_5/System.Core.dll -r:./../../class/lib/xammac_net_4_5/Mono.CSharp.dll</flags>
+      <output>Microsoft.CSharp.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac_net_4_5/Microsoft.CSharp.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>Microsoft.CSharp.dll.sources</response>
+    </project>
+    <project dir="class/Mono.CompilerServices.SymbolWriter" library="Mono.CompilerServices.SymbolWriter-xammac_net_4_5">
+      <boot>true</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig -r:./../../class/lib/xammac_net_4_5/System.dll</flags>
+      <output>Mono.CompilerServices.SymbolWriter.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac_net_4_5/Mono.CompilerServices.SymbolWriter.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>Mono.CompilerServices.SymbolWriter.dll.sources</response>
+    </project>
+    <project dir="class/System.Data.Linq" library="System.Data.Linq-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /resource:./src/DbLinq/Schema/Dbml/DbmlSchema.xsd,DbLinq.Schema.Dbml.DbmlSchema.xsd /d:MONO_STRICT /d:MONO_DEPLOY -warn:1 -r:./../../class/lib/xammac_net_4_5/System.dll -r:./../../class/lib/xammac_net_4_5/System.Core.dll -r:./../../class/lib/xammac_net_4_5/System.Xml.dll -r:./../../class/lib/xammac_net_4_5/System.Data.dll -r:./../../class/lib/xammac_net_4_5/System.Runtime.Serialization.dll</flags>
+      <output>System.Data.Linq.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac_net_4_5/System.Data.Linq.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Data.Linq.dll.sources</response>
+    </project>
+    <project dir="class/System.Data.Linq" library="System.Data.Linq-tests-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize -r:./../../class/lib/xammac_net_4_5/System.Data.Linq.dll /resource:./src/DbLinq/Schema/Dbml/DbmlSchema.xsd,DbLinq.Schema.Dbml.DbmlSchema.xsd /d:MONO_STRICT /d:MONO_DEPLOY -warn:1 -r:./../../class/lib/xammac_net_4_5/System.dll -r:./../../class/lib/xammac_net_4_5/System.Core.dll -r:./../../class/lib/xammac_net_4_5/System.Xml.dll -r:./../../class/lib/xammac_net_4_5/System.Data.dll -r:./../../class/lib/xammac_net_4_5/System.Runtime.Serialization.dll</flags>
+      <output>xammac_net_4_5_System.Data.Linq_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>xammac_net_4_5_System.Data.Linq_test.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>./../../build/deps/xammac_net_4_5_System.Data.Linq_test.dll.response</response>
+    </project>
+    <project dir="class/System.Net.Http" library="System.Net.Http-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig -r:./../../class/lib/xammac_net_4_5/System.Core.dll -r:./../../class/lib/xammac_net_4_5/System.dll</flags>
+      <output>System.Net.Http.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac_net_4_5/System.Net.Http.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>./../../build/deps/xammac_net_4_5_System.Net.Http.dll.sources</response>
+    </project>
+    <project dir="class/System.Net.Http" library="System.Net.Http-tests-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize -r:./../../class/lib/xammac_net_4_5/System.Net.Http.dll</flags>
+      <output>xammac_net_4_5_System.Net.Http_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>xammac_net_4_5_System.Net.Http_test.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>./../../build/deps/xammac_net_4_5_System.Net.Http_test.dll.response</response>
+    </project>
+    <project dir="class/System.Net.Http.WebRequest" library="System.Net.Http.WebRequest-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig -r:./../../class/lib/xammac_net_4_5/System.Net.Http.dll -r:./../../class/lib/xammac_net_4_5/System.dll</flags>
+      <output>System.Net.Http.WebRequest.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac_net_4_5/System.Net.Http.WebRequest.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Net.Http.WebRequest.dll.sources</response>
+    </project>
+    <project dir="class/System.Runtime.InteropServices.RuntimeInformation" library="System.Runtime.InteropServices.RuntimeInformation-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig -r:./../../class/lib/xammac_net_4_5/System.dll</flags>
+      <output>System.Runtime.InteropServices.RuntimeInformation.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac_net_4_5/System.Runtime.InteropServices.RuntimeInformation.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Runtime.InteropServices.RuntimeInformation.dll.sources</response>
+    </project>
+    <project dir="class/System.Reflection.Context" library="System.Reflection.Context-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig -r:./../../class/lib/xammac_net_4_5/System.dll</flags>
+      <output>System.Reflection.Context.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac_net_4_5/System.Reflection.Context.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Reflection.Context.dll.sources</response>
+    </project>
+    <project dir="class/System.Net.Http.WinHttpHandler" library="System.Net.Http.WinHttpHandler-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig -r:./../../class/lib/xammac_net_4_5/System.dll -r:./../../class/lib/xammac_net_4_5/System.Net.Http.dll</flags>
+      <output>System.Net.Http.WinHttpHandler.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xammac_net_4_5/System.Net.Http.WinHttpHandler.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Net.Http.WinHttpHandler.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.X509Certificates" library="Facades_System.Security.Cryptography.X509Certificates-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll -r:./../../../class/lib/xammac_net_4_5/System.Core.dll</flags>
+      <output>System.Security.Cryptography.X509Certificates.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Security.Cryptography.X509Certificates.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.X509Certificates.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.ServiceModel.Primitives" library="Facades_System.ServiceModel.Primitives-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll -r:./../../../class/lib/xammac_net_4_5/System.ServiceModel.dll -r:./../../../class/lib/xammac_net_4_5/System.Xml.dll -r:./../../../class/lib/xammac_net_4_5/System.IdentityModel.dll -r:./../../../class/lib/xammac_net_4_5/Facades/System.Security.Cryptography.X509Certificates.dll</flags>
+      <output>System.ServiceModel.Primitives.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.ServiceModel.Primitives.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.ServiceModel.Primitives.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Runtime.Serialization.Primitives" library="Facades_System.Runtime.Serialization.Primitives-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.Runtime.Serialization.dll</flags>
+      <output>System.Runtime.Serialization.Primitives.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Runtime.Serialization.Primitives.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Runtime.Serialization.Primitives.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Runtime.Serialization.Xml" library="Facades_System.Runtime.Serialization.Xml-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll -r:./../../../class/lib/xammac_net_4_5/System.Runtime.Serialization.dll -r:./../../../class/lib/xammac_net_4_5/System.Xml.dll -r:./../../../class/lib/xammac_net_4_5/Facades/System.Runtime.Serialization.Primitives.dll</flags>
+      <output>System.Runtime.Serialization.Xml.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Runtime.Serialization.Xml.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Runtime.Serialization.Xml.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Drawing.Primitives" library="Facades_System.Drawing.Primitives-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll</flags>
+      <output>System.Drawing.Primitives.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Drawing.Primitives.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>./../../../build/deps/xammac_net_4_5_System.Drawing.Primitives.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Collections.Concurrent" library="Facades_System.Collections.Concurrent-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll</flags>
+      <output>System.Collections.Concurrent.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Collections.Concurrent.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Collections.Concurrent.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Collections" library="Facades_System.Collections-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll -r:./../../../class/lib/xammac_net_4_5/System.Core.dll</flags>
+      <output>System.Collections.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Collections.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Collections.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.ComponentModel.Annotations" library="Facades_System.ComponentModel.Annotations-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.ComponentModel.DataAnnotations.dll</flags>
+      <output>System.ComponentModel.Annotations.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.ComponentModel.Annotations.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.ComponentModel.Annotations.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.ComponentModel.EventBasedAsync" library="Facades_System.ComponentModel.EventBasedAsync-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll</flags>
+      <output>System.ComponentModel.EventBasedAsync.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.ComponentModel.EventBasedAsync.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.ComponentModel.EventBasedAsync.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.ComponentModel" library="Facades_System.ComponentModel-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll</flags>
+      <output>System.ComponentModel.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.ComponentModel.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.ComponentModel.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Diagnostics.Contracts" library="Facades_System.Diagnostics.Contracts-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Diagnostics.Contracts.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Diagnostics.Contracts.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Diagnostics.Contracts.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Diagnostics.Debug" library="Facades_System.Diagnostics.Debug-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll</flags>
+      <output>System.Diagnostics.Debug.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Diagnostics.Debug.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Diagnostics.Debug.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Diagnostics.Tracing" library="Facades_System.Diagnostics.Tracing-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Diagnostics.Tracing.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Diagnostics.Tracing.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Diagnostics.Tracing.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Diagnostics.Tools" library="Facades_System.Diagnostics.Tools-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll</flags>
+      <output>System.Diagnostics.Tools.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Diagnostics.Tools.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Diagnostics.Tools.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Dynamic.Runtime" library="Facades_System.Dynamic.Runtime-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.Core.dll -r:./../../../class/lib/xammac_net_4_5/System.dll</flags>
+      <output>System.Dynamic.Runtime.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Dynamic.Runtime.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Dynamic.Runtime.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Globalization" library="Facades_System.Globalization-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Globalization.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Globalization.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Globalization.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.IO" library="Facades_System.IO-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll</flags>
+      <output>System.IO.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.IO.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.IO.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Linq.Expressions" library="Facades_System.Linq.Expressions-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.Core.dll</flags>
+      <output>System.Linq.Expressions.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Linq.Expressions.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Linq.Expressions.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Linq.Parallel" library="Facades_System.Linq.Parallel-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.Core.dll</flags>
+      <output>System.Linq.Parallel.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Linq.Parallel.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Linq.Parallel.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Linq.Queryable" library="Facades_System.Linq.Queryable-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.Core.dll</flags>
+      <output>System.Linq.Queryable.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Linq.Queryable.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Linq.Queryable.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Linq" library="Facades_System.Linq-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.Core.dll</flags>
+      <output>System.Linq.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Linq.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Linq.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.NetworkInformation" library="Facades_System.Net.NetworkInformation-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll</flags>
+      <output>System.Net.NetworkInformation.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Net.NetworkInformation.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Net.NetworkInformation.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.Primitives" library="Facades_System.Net.Primitives-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll</flags>
+      <output>System.Net.Primitives.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Net.Primitives.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Net.Primitives.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.Requests" library="Facades_System.Net.Requests-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll</flags>
+      <output>System.Net.Requests.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Net.Requests.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Net.Requests.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.ObjectModel" library="Facades_System.ObjectModel-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll</flags>
+      <output>System.ObjectModel.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.ObjectModel.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.ObjectModel.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Reflection.Extensions" library="Facades_System.Reflection.Extensions-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Reflection.Extensions.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Reflection.Extensions.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Reflection.Extensions.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Reflection.Primitives" library="Facades_System.Reflection.Primitives-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Reflection.Primitives.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Reflection.Primitives.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Reflection.Primitives.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Reflection" library="Facades_System.Reflection-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Reflection.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Reflection.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Reflection.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Resources.ResourceManager" library="Facades_System.Resources.ResourceManager-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Resources.ResourceManager.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Resources.ResourceManager.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Resources.ResourceManager.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Runtime.Extensions" library="Facades_System.Runtime.Extensions-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll</flags>
+      <output>System.Runtime.Extensions.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Runtime.Extensions.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Runtime.Extensions.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Runtime.InteropServices" library="Facades_System.Runtime.InteropServices-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll -r:./../../../class/lib/xammac_net_4_5/System.Core.dll</flags>
+      <output>System.Runtime.InteropServices.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Runtime.InteropServices.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Runtime.InteropServices.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Runtime.InteropServices.WindowsRuntime" library="Facades_System.Runtime.InteropServices.WindowsRuntime-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Runtime.InteropServices.WindowsRuntime.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Runtime.InteropServices.WindowsRuntime.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Runtime.InteropServices.WindowsRuntime.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Runtime.Numerics" library="Facades_System.Runtime.Numerics-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.Numerics.dll</flags>
+      <output>System.Runtime.Numerics.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Runtime.Numerics.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Runtime.Numerics.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Runtime.Serialization.Json" library="Facades_System.Runtime.Serialization.Json-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.Runtime.Serialization.dll</flags>
+      <output>System.Runtime.Serialization.Json.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Runtime.Serialization.Json.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Runtime.Serialization.Json.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Runtime" library="Facades_System.Runtime-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll -r:./../../../class/lib/xammac_net_4_5/System.ComponentModel.Composition.dll -r:./../../../class/lib/xammac_net_4_5/System.Core.dll</flags>
+      <output>System.Runtime.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Runtime.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Runtime.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Principal" library="Facades_System.Security.Principal-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Security.Principal.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Security.Principal.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Security.Principal.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.ServiceModel.Http" library="Facades_System.ServiceModel.Http-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.ServiceModel.dll</flags>
+      <output>System.ServiceModel.Http.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.ServiceModel.Http.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.ServiceModel.Http.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.ServiceModel.Security" library="Facades_System.ServiceModel.Security-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.ServiceModel.dll</flags>
+      <output>System.ServiceModel.Security.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.ServiceModel.Security.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.ServiceModel.Security.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Text.Encoding.Extensions" library="Facades_System.Text.Encoding.Extensions-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Text.Encoding.Extensions.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Text.Encoding.Extensions.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Text.Encoding.Extensions.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Text.Encoding" library="Facades_System.Text.Encoding-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Text.Encoding.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Text.Encoding.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Text.Encoding.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Text.RegularExpressions" library="Facades_System.Text.RegularExpressions-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll</flags>
+      <output>System.Text.RegularExpressions.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Text.RegularExpressions.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Text.RegularExpressions.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Threading.Tasks.Parallel" library="Facades_System.Threading.Tasks.Parallel-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Threading.Tasks.Parallel.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Threading.Tasks.Parallel.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Threading.Tasks.Parallel.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Threading.Tasks" library="Facades_System.Threading.Tasks-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.Core.dll</flags>
+      <output>System.Threading.Tasks.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Threading.Tasks.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Threading.Tasks.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Threading.Timer" library="Facades_System.Threading.Timer-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll -r:./../../../class/lib/xammac_net_4_5/System.Core.dll</flags>
+      <output>System.Threading.Timer.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Threading.Timer.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Threading.Timer.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Threading" library="Facades_System.Threading-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll -r:./../../../class/lib/xammac_net_4_5/System.Core.dll</flags>
+      <output>System.Threading.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Threading.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Threading.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Xml.ReaderWriter" library="Facades_System.Xml.ReaderWriter-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.Xml.dll</flags>
+      <output>System.Xml.ReaderWriter.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Xml.ReaderWriter.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Xml.ReaderWriter.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Xml.XDocument" library="Facades_System.Xml.XDocument-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.Xml.Linq.dll -r:./../../../class/lib/xammac_net_4_5/System.Xml.dll</flags>
+      <output>System.Xml.XDocument.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Xml.XDocument.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Xml.XDocument.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Xml.XmlSerializer" library="Facades_System.Xml.XmlSerializer-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.Xml.dll</flags>
+      <output>System.Xml.XmlSerializer.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Xml.XmlSerializer.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Xml.XmlSerializer.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Runtime.Handles" library="Facades_System.Runtime.Handles-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll -r:./../../../class/lib/xammac_net_4_5/System.Core.dll</flags>
+      <output>System.Runtime.Handles.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Runtime.Handles.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Runtime.Handles.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.ServiceModel.Duplex" library="Facades_System.ServiceModel.Duplex-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.ServiceModel.dll</flags>
+      <output>System.ServiceModel.Duplex.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.ServiceModel.Duplex.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.ServiceModel.Duplex.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.ServiceModel.NetTcp" library="Facades_System.ServiceModel.NetTcp-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.ServiceModel.dll</flags>
+      <output>System.ServiceModel.NetTcp.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.ServiceModel.NetTcp.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.ServiceModel.NetTcp.dll.sources</response>
+    </project>
+    <project dir="class/Facades/Microsoft.Win32.Primitives" library="Facades_Microsoft.Win32.Primitives-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll</flags>
+      <output>Microsoft.Win32.Primitives.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/Microsoft.Win32.Primitives.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>Microsoft.Win32.Primitives.dll.sources</response>
+    </project>
+    <project dir="class/Facades/Microsoft.Win32.Registry" library="Facades_Microsoft.Win32.Registry-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll</flags>
+      <output>Microsoft.Win32.Registry.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/Microsoft.Win32.Registry.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>Microsoft.Win32.Registry.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.AppContext" library="Facades_System.AppContext-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll</flags>
+      <output>System.AppContext.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.AppContext.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.AppContext.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Collections.NonGeneric" library="Facades_System.Collections.NonGeneric-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll</flags>
+      <output>System.Collections.NonGeneric.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Collections.NonGeneric.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Collections.NonGeneric.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Collections.Specialized" library="Facades_System.Collections.Specialized-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll</flags>
+      <output>System.Collections.Specialized.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Collections.Specialized.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Collections.Specialized.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.ComponentModel.Primitives" library="Facades_System.ComponentModel.Primitives-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll</flags>
+      <output>System.ComponentModel.Primitives.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.ComponentModel.Primitives.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.ComponentModel.Primitives.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.ComponentModel.TypeConverter" library="Facades_System.ComponentModel.TypeConverter-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll</flags>
+      <output>System.ComponentModel.TypeConverter.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.ComponentModel.TypeConverter.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.ComponentModel.TypeConverter.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Console" library="Facades_System.Console-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll</flags>
+      <output>System.Console.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Console.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Console.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Data.Common" library="Facades_System.Data.Common-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll -r:./../../../class/lib/xammac_net_4_5/System.Data.dll -r:./../../../class/lib/xammac_net_4_5/System.Xml.dll</flags>
+      <output>System.Data.Common.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Data.Common.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Data.Common.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Data.SqlClient" library="Facades_System.Data.SqlClient-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll -r:./../../../class/lib/xammac_net_4_5/System.Data.dll -r:./../../../class/lib/xammac_net_4_5/System.Xml.dll</flags>
+      <output>System.Data.SqlClient.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Data.SqlClient.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Data.SqlClient.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Diagnostics.FileVersionInfo" library="Facades_System.Diagnostics.FileVersionInfo-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll</flags>
+      <output>System.Diagnostics.FileVersionInfo.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Diagnostics.FileVersionInfo.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Diagnostics.FileVersionInfo.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Diagnostics.Process" library="Facades_System.Diagnostics.Process-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll</flags>
+      <output>System.Diagnostics.Process.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Diagnostics.Process.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Diagnostics.Process.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Diagnostics.TextWriterTraceListener" library="Facades_System.Diagnostics.TextWriterTraceListener-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll</flags>
+      <output>System.Diagnostics.TextWriterTraceListener.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Diagnostics.TextWriterTraceListener.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Diagnostics.TextWriterTraceListener.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Diagnostics.TraceEvent" library="Facades_System.Diagnostics.TraceEvent-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll</flags>
+      <output>System.Diagnostics.TraceEvent.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Diagnostics.TraceEvent.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Diagnostics.TraceEvent.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Diagnostics.TraceSource" library="Facades_System.Diagnostics.TraceSource-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll</flags>
+      <output>System.Diagnostics.TraceSource.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Diagnostics.TraceSource.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Diagnostics.TraceSource.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Globalization.Calendars" library="Facades_System.Globalization.Calendars-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll</flags>
+      <output>System.Globalization.Calendars.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Globalization.Calendars.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Globalization.Calendars.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.IO.Compression.ZipFile" library="Facades_System.IO.Compression.ZipFile-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll -r:./../../../class/lib/xammac_net_4_5/System.IO.Compression.FileSystem.dll</flags>
+      <output>System.IO.Compression.ZipFile.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.IO.Compression.ZipFile.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.IO.Compression.ZipFile.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.IO.FileSystem" library="Facades_System.IO.FileSystem-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll</flags>
+      <output>System.IO.FileSystem.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.IO.FileSystem.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.IO.FileSystem.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.IO.FileSystem.DriveInfo" library="Facades_System.IO.FileSystem.DriveInfo-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll</flags>
+      <output>System.IO.FileSystem.DriveInfo.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.IO.FileSystem.DriveInfo.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.IO.FileSystem.DriveInfo.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.IO.FileSystem.Primitives" library="Facades_System.IO.FileSystem.Primitives-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll</flags>
+      <output>System.IO.FileSystem.Primitives.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.IO.FileSystem.Primitives.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.IO.FileSystem.Primitives.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.IO.IsolatedStorage" library="Facades_System.IO.IsolatedStorage-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll</flags>
+      <output>System.IO.IsolatedStorage.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.IO.IsolatedStorage.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.IO.IsolatedStorage.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.IO.MemoryMappedFiles" library="Facades_System.IO.MemoryMappedFiles-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll -r:./../../../class/lib/xammac_net_4_5/System.Core.dll</flags>
+      <output>System.IO.MemoryMappedFiles.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.IO.MemoryMappedFiles.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.IO.MemoryMappedFiles.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.IO.UnmanagedMemoryStream" library="Facades_System.IO.UnmanagedMemoryStream-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll</flags>
+      <output>System.IO.UnmanagedMemoryStream.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.IO.UnmanagedMemoryStream.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.IO.UnmanagedMemoryStream.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.AuthenticationManager" library="Facades_System.Net.AuthenticationManager-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll</flags>
+      <output>System.Net.AuthenticationManager.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Net.AuthenticationManager.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Net.AuthenticationManager.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.Cache" library="Facades_System.Net.Cache-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll</flags>
+      <output>System.Net.Cache.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Net.Cache.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Net.Cache.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.HttpListener" library="Facades_System.Net.HttpListener-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll</flags>
+      <output>System.Net.HttpListener.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Net.HttpListener.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Net.HttpListener.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.Mail" library="Facades_System.Net.Mail-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll</flags>
+      <output>System.Net.Mail.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Net.Mail.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Net.Mail.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.NameResolution" library="Facades_System.Net.NameResolution-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll</flags>
+      <output>System.Net.NameResolution.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Net.NameResolution.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Net.NameResolution.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.Security" library="Facades_System.Net.Security-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll</flags>
+      <output>System.Net.Security.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Net.Security.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Net.Security.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.ServicePoint" library="Facades_System.Net.ServicePoint-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll</flags>
+      <output>System.Net.ServicePoint.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Net.ServicePoint.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Net.ServicePoint.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.Sockets" library="Facades_System.Net.Sockets-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll</flags>
+      <output>System.Net.Sockets.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Net.Sockets.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Net.Sockets.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.Utilities" library="Facades_System.Net.Utilities-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll</flags>
+      <output>System.Net.Utilities.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Net.Utilities.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Net.Utilities.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.WebHeaderCollection" library="Facades_System.Net.WebHeaderCollection-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll</flags>
+      <output>System.Net.WebHeaderCollection.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Net.WebHeaderCollection.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Net.WebHeaderCollection.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.WebSockets" library="Facades_System.Net.WebSockets-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll</flags>
+      <output>System.Net.WebSockets.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Net.WebSockets.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Net.WebSockets.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Net.WebSockets.Client" library="Facades_System.Net.WebSockets.Client-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll</flags>
+      <output>System.Net.WebSockets.Client.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Net.WebSockets.Client.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Net.WebSockets.Client.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Resources.ReaderWriter" library="Facades_System.Resources.ReaderWriter-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll</flags>
+      <output>System.Resources.ReaderWriter.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Resources.ReaderWriter.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Resources.ReaderWriter.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Runtime.CompilerServices.VisualC" library="Facades_System.Runtime.CompilerServices.VisualC-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll</flags>
+      <output>System.Runtime.CompilerServices.VisualC.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Runtime.CompilerServices.VisualC.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Runtime.CompilerServices.VisualC.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.AccessControl" library="Facades_System.Security.AccessControl-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll</flags>
+      <output>System.Security.AccessControl.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Security.AccessControl.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Security.AccessControl.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Claims" library="Facades_System.Security.Claims-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll</flags>
+      <output>System.Security.Claims.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Security.Claims.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Security.Claims.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.DeriveBytes" library="Facades_System.Security.Cryptography.DeriveBytes-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll</flags>
+      <output>System.Security.Cryptography.DeriveBytes.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Security.Cryptography.DeriveBytes.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.DeriveBytes.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.Encoding" library="Facades_System.Security.Cryptography.Encoding-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll</flags>
+      <output>System.Security.Cryptography.Encoding.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Security.Cryptography.Encoding.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.Encoding.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.Encryption" library="Facades_System.Security.Cryptography.Encryption-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll</flags>
+      <output>System.Security.Cryptography.Encryption.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Security.Cryptography.Encryption.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.Encryption.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.Encryption.Aes" library="Facades_System.Security.Cryptography.Encryption.Aes-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll</flags>
+      <output>System.Security.Cryptography.Encryption.Aes.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Security.Cryptography.Encryption.Aes.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.Encryption.Aes.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.Encryption.ECDiffieHellman" library="Facades_System.Security.Cryptography.Encryption.ECDiffieHellman-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll -r:./../../../class/lib/xammac_net_4_5/System.Core.dll</flags>
+      <output>System.Security.Cryptography.Encryption.ECDiffieHellman.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Security.Cryptography.Encryption.ECDiffieHellman.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.Encryption.ECDiffieHellman.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.Encryption.ECDsa" library="Facades_System.Security.Cryptography.Encryption.ECDsa-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll -r:./../../../class/lib/xammac_net_4_5/System.Core.dll</flags>
+      <output>System.Security.Cryptography.Encryption.ECDsa.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Security.Cryptography.Encryption.ECDsa.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.Encryption.ECDsa.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.Hashing" library="Facades_System.Security.Cryptography.Hashing-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll</flags>
+      <output>System.Security.Cryptography.Hashing.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Security.Cryptography.Hashing.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.Hashing.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.Hashing.Algorithms" library="Facades_System.Security.Cryptography.Hashing.Algorithms-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll</flags>
+      <output>System.Security.Cryptography.Hashing.Algorithms.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Security.Cryptography.Hashing.Algorithms.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.Hashing.Algorithms.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.RSA" library="Facades_System.Security.Cryptography.RSA-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll</flags>
+      <output>System.Security.Cryptography.RSA.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Security.Cryptography.RSA.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.RSA.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.RandomNumberGenerator" library="Facades_System.Security.Cryptography.RandomNumberGenerator-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll</flags>
+      <output>System.Security.Cryptography.RandomNumberGenerator.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Security.Cryptography.RandomNumberGenerator.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.RandomNumberGenerator.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Principal.Windows" library="Facades_System.Security.Principal.Windows-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll</flags>
+      <output>System.Security.Principal.Windows.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Security.Principal.Windows.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Security.Principal.Windows.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Threading.Thread" library="Facades_System.Threading.Thread-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll</flags>
+      <output>System.Threading.Thread.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Threading.Thread.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Threading.Thread.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Threading.ThreadPool" library="Facades_System.Threading.ThreadPool-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll</flags>
+      <output>System.Threading.ThreadPool.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Threading.ThreadPool.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Threading.ThreadPool.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Xml.XPath" library="Facades_System.Xml.XPath-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll -r:./../../../class/lib/xammac_net_4_5/System.Xml.dll</flags>
+      <output>System.Xml.XPath.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Xml.XPath.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Xml.XPath.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Xml.XmlDocument" library="Facades_System.Xml.XmlDocument-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll -r:./../../../class/lib/xammac_net_4_5/System.Xml.dll</flags>
+      <output>System.Xml.XmlDocument.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Xml.XmlDocument.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Xml.XmlDocument.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Xml.Xsl.Primitives" library="Facades_System.Xml.Xsl.Primitives-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll -r:./../../../class/lib/xammac_net_4_5/System.Xml.dll</flags>
+      <output>System.Xml.Xsl.Primitives.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Xml.Xsl.Primitives.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Xml.Xsl.Primitives.dll.sources</response>
+    </project>
+    <project dir="class/Facades/Microsoft.Win32.Registry.AccessControl" library="Facades_Microsoft.Win32.Registry.AccessControl-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll</flags>
+      <output>Microsoft.Win32.Registry.AccessControl.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/Microsoft.Win32.Registry.AccessControl.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>Microsoft.Win32.Registry.AccessControl.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Diagnostics.StackTrace" library="Facades_System.Diagnostics.StackTrace-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll</flags>
+      <output>System.Diagnostics.StackTrace.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Diagnostics.StackTrace.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Diagnostics.StackTrace.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Globalization.Extensions" library="Facades_System.Globalization.Extensions-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll</flags>
+      <output>System.Globalization.Extensions.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Globalization.Extensions.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Globalization.Extensions.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.IO.FileSystem.AccessControl" library="Facades_System.IO.FileSystem.AccessControl-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll</flags>
+      <output>System.IO.FileSystem.AccessControl.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.IO.FileSystem.AccessControl.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.IO.FileSystem.AccessControl.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Reflection.TypeExtensions" library="Facades_System.Reflection.TypeExtensions-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll</flags>
+      <output>System.Reflection.TypeExtensions.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Reflection.TypeExtensions.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Reflection.TypeExtensions.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Reflection.Emit.Lightweight" library="Facades_System.Reflection.Emit.Lightweight-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Reflection.Emit.Lightweight.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Reflection.Emit.Lightweight.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Reflection.Emit.Lightweight.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Reflection.Emit.ILGeneration" library="Facades_System.Reflection.Emit.ILGeneration-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Reflection.Emit.ILGeneration.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Reflection.Emit.ILGeneration.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Reflection.Emit.ILGeneration.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Reflection.Emit" library="Facades_System.Reflection.Emit-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
+      <output>System.Reflection.Emit.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Reflection.Emit.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Reflection.Emit.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.SecureString" library="Facades_System.Security.SecureString-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll</flags>
+      <output>System.Security.SecureString.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Security.SecureString.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Security.SecureString.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Threading.AccessControl" library="Facades_System.Threading.AccessControl-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll</flags>
+      <output>System.Threading.AccessControl.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Threading.AccessControl.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Threading.AccessControl.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Threading.Overlapped" library="Facades_System.Threading.Overlapped-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -unsafe -r:./../../../class/lib/xammac_net_4_5/System.dll</flags>
+      <output>System.Threading.Overlapped.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Threading.Overlapped.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Threading.Overlapped.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Xml.XPath.XDocument" library="Facades_System.Xml.XPath.XDocument-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll -r:./../../../class/lib/xammac_net_4_5/System.Xml.dll -r:./../../../class/lib/xammac_net_4_5/System.Xml.Linq.dll</flags>
+      <output>System.Xml.XPath.XDocument.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Xml.XPath.XDocument.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Xml.XPath.XDocument.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.Primitives" library="Facades_System.Security.Cryptography.Primitives-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll</flags>
+      <output>System.Security.Cryptography.Primitives.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Security.Cryptography.Primitives.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.Primitives.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Text.Encoding.CodePages" library="Facades_System.Text.Encoding.CodePages-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll</flags>
+      <output>System.Text.Encoding.CodePages.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Text.Encoding.CodePages.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Text.Encoding.CodePages.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.IO.FileSystem.Watcher" library="Facades_System.IO.FileSystem.Watcher-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll</flags>
+      <output>System.IO.FileSystem.Watcher.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.IO.FileSystem.Watcher.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.IO.FileSystem.Watcher.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Security.Cryptography.ProtectedData" library="Facades_System.Security.Cryptography.ProtectedData-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll -r:./../../../class/lib/xammac_net_4_5/System.Security.dll</flags>
+      <output>System.Security.Cryptography.ProtectedData.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.Security.Cryptography.ProtectedData.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.Security.Cryptography.ProtectedData.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.ServiceProcess.ServiceController" library="Facades_System.ServiceProcess.ServiceController-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -debug -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll</flags>
+      <output>System.ServiceProcess.ServiceController.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.ServiceProcess.ServiceController.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.ServiceProcess.ServiceController.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.IO.Pipes" library="Facades_System.IO.Pipes-xammac_net_4_5">
+      <boot>false</boot>
+      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/xammac_net_4_5/mscorlib.dll -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5 -d:XAMARIN_MODERN -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/xammac_net_4_5/System.dll -r:./../../../class/lib/xammac_net_4_5/System.Core.dll</flags>
+      <output>System.IO.Pipes.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/xammac_net_4_5/Facades/System.IO.Pipes.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xammac_net_4_5</profile>
+      <resources></resources>
+      <response>System.IO.Pipes.dll.sources</response>
+    </project>
 </root>
diff --git a/msvc/test-config-setup.bat b/msvc/test-config-setup.bat
new file mode 100644 (file)
index 0000000..adb174d
--- /dev/null
@@ -0,0 +1,56 @@
+@ECHO off
+
+SET MONO_RESULT=1
+SET CONFIG_PATH=%1
+SET MONO_MODULE_PATH=%2
+SET CPU_ARCH=%3
+
+IF "" == "%CONFIG_PATH%" (
+       ECHO Error: No configuration path set.
+       GOTO ON_ERROR
+)
+
+IF "" == "%MONO_MODULE_PATH%" (
+       ECHO Error: No mono module path set.
+       GOTO ON_ERROR
+)
+
+IF "" == "%CPU_ARCH%" (
+       ECHO Error: No cpu architecture set.
+       GOTO ON_ERROR
+)
+
+IF NOT "x86" == "%CPU_ARCH%" (
+
+       IF NOT "x86-64" == "%CPU_ARCH%" (
+               ECHO Error: Unknown cpu architecture, %CPU_ARCH%.
+               GOTO ON_ERROR
+       )
+)
+
+SET CONFIG_PATH=%CONFIG_PATH:"=%
+SET CONFIG_PATH=%CONFIG_PATH:/=\%
+
+SET MONO_MODULE_PATH=%MONO_MODULE_PATH:"=%
+SET MONO_MODULE_PATH=%MONO_MODULE_PATH:/=\%
+
+REM Setup test configuration file.
+>%CONFIG_PATH% ECHO ^<configuration^>
+>>%CONFIG_PATH% ECHO ^<dllmap os="windows" cpu="%CPU_ARCH%" dll="libtest" target="%MONO_MODULE_PATH%\libtest.dll" /^>
+>>%CONFIG_PATH% ECHO ^</configuration^>
+
+SET MONO_RESULT=0
+ECHO Successfully setup test configuration file, %CONFIG_PATH%.
+
+GOTO ON_EXIT
+
+:ON_ERROR
+       ECHO Failed to setup test configuration file.
+       ECHO test-config-setup.bat [CONFIG_FILE_PATH] [MONO_MODULE_PATH] [x86|x86-64]
+       SET MONO_RESULT=1
+       GOTO ON_EXIT
+       
+:ON_EXIT
+       EXIT /b %MONO_RESULT%
+
+@ECHO on
index 06ad062761f931b6d9efb5ed880536f88741b425..f258fb673c65cf75f2bcee1ed5179608c7baaa2a 100644 (file)
       <LinkLibraryDependencies>false</LinkLibraryDependencies>\r
     </ProjectReference>\r
     <Link>\r
-      <AdditionalDependencies>mono-2.0$(MONO_TARGET_SUFFIX).lib;%(AdditionalDependencies)</AdditionalDependencies>\r
+      <AdditionalDependencies>$(MONO_DYNAMIC_LIBMONO_LIB);%(AdditionalDependencies)</AdditionalDependencies>\r
       <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\r
       <GenerateDebugInformation>true</GenerateDebugInformation>\r
       <SubSystem>Console</SubSystem>\r
       <DataExecutionPrevention>\r
       </DataExecutionPrevention>\r
       <TargetMachine>MachineX86</TargetMachine>\r
-      <AdditionalDependencies>mono-2.0$(MONO_TARGET_SUFFIX).lib;%(AdditionalDependencies)</AdditionalDependencies>\r
+      <AdditionalDependencies>$(MONO_DYNAMIC_LIBMONO_LIB);%(AdditionalDependencies)</AdditionalDependencies>\r
     </Link>\r
   </ItemDefinitionGroup>\r
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">\r
       <LinkLibraryDependencies>false</LinkLibraryDependencies>\r
     </ProjectReference>\r
     <Link>\r
-      <AdditionalDependencies>mono-2.0$(MONO_TARGET_SUFFIX).lib;%(AdditionalDependencies)</AdditionalDependencies>\r
+      <AdditionalDependencies>$(MONO_DYNAMIC_LIBMONO_LIB);%(AdditionalDependencies)</AdditionalDependencies>\r
       <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\r
       <GenerateDebugInformation>true</GenerateDebugInformation>\r
       <SubSystem>Console</SubSystem>\r
       <OptimizeReferences>true</OptimizeReferences>\r
       <EnableCOMDATFolding>true</EnableCOMDATFolding>\r
       <TargetMachine>MachineX64</TargetMachine>\r
-      <AdditionalDependencies>mono-2.0$(MONO_TARGET_SUFFIX).lib;%(AdditionalDependencies)</AdditionalDependencies>\r
+      <AdditionalDependencies>$(MONO_DYNAMIC_LIBMONO_LIB);%(AdditionalDependencies)</AdditionalDependencies>\r
     </Link>\r
   </ItemDefinitionGroup>\r
   <ItemGroup>\r
index 31411b0df6193224ec03e5f28a99bd440928a3ba..810f82f82fa93894eddc640d2de9388582f9c53b 100644 (file)
       <LinkLibraryDependencies>false</LinkLibraryDependencies>\r
     </ProjectReference>\r
     <Link>\r
-      <AdditionalDependencies>mono-2.0$(MONO_TARGET_SUFFIX).lib;%(AdditionalDependencies)</AdditionalDependencies>\r
+      <AdditionalDependencies>$(MONO_DYNAMIC_LIBMONO_LIB);%(AdditionalDependencies)</AdditionalDependencies>\r
       <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\r
       <GenerateDebugInformation>true</GenerateDebugInformation>\r
       <SubSystem>Console</SubSystem>\r
       <DataExecutionPrevention>\r
       </DataExecutionPrevention>\r
       <TargetMachine>MachineX86</TargetMachine>\r
-      <AdditionalDependencies>mono-2.0$(MONO_TARGET_SUFFIX).lib;%(AdditionalDependencies)</AdditionalDependencies>\r
+      <AdditionalDependencies>$(MONO_DYNAMIC_LIBMONO_LIB);%(AdditionalDependencies)</AdditionalDependencies>\r
     </Link>\r
   </ItemDefinitionGroup>\r
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">\r
       <LinkLibraryDependencies>false</LinkLibraryDependencies>\r
     </ProjectReference>\r
     <Link>\r
-      <AdditionalDependencies>mono-2.0$(MONO_TARGET_SUFFIX).lib;%(AdditionalDependencies)</AdditionalDependencies>\r
+      <AdditionalDependencies>$(MONO_DYNAMIC_LIBMONO_LIB);%(AdditionalDependencies)</AdditionalDependencies>\r
       <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\r
       <GenerateDebugInformation>true</GenerateDebugInformation>\r
       <SubSystem>Console</SubSystem>\r
       <OptimizeReferences>true</OptimizeReferences>\r
       <EnableCOMDATFolding>true</EnableCOMDATFolding>\r
       <TargetMachine>MachineX64</TargetMachine>\r
-      <AdditionalDependencies>mono-2.0$(MONO_TARGET_SUFFIX).lib;%(AdditionalDependencies)</AdditionalDependencies>\r
+      <AdditionalDependencies>$(MONO_DYNAMIC_LIBMONO_LIB);%(AdditionalDependencies)</AdditionalDependencies>\r
     </Link>\r
   </ItemDefinitionGroup>\r
   <ItemGroup>\r
index cd9433f8b1af0d5e3afe56396b78f2ac1f2e51d7..5fac6d8ac2349d1007bca1c36a2efdf3b8259c31 100644 (file)
       <LinkLibraryDependencies>false</LinkLibraryDependencies>\r
     </ProjectReference>\r
     <Link>\r
-      <AdditionalDependencies>mono-2.0$(MONO_TARGET_SUFFIX).lib;%(AdditionalDependencies)</AdditionalDependencies>\r
+      <AdditionalDependencies>$(MONO_DYNAMIC_LIBMONO_LIB);%(AdditionalDependencies)</AdditionalDependencies>\r
       <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\r
       <GenerateDebugInformation>true</GenerateDebugInformation>\r
       <SubSystem>Console</SubSystem>\r
       <DataExecutionPrevention>\r
       </DataExecutionPrevention>\r
       <TargetMachine>MachineX86</TargetMachine>\r
-      <AdditionalDependencies>mono-2.0$(MONO_TARGET_SUFFIX).lib;%(AdditionalDependencies)</AdditionalDependencies>\r
+      <AdditionalDependencies>$(MONO_DYNAMIC_LIBMONO_LIB);%(AdditionalDependencies)</AdditionalDependencies>\r
     </Link>\r
   </ItemDefinitionGroup>\r
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">\r
       <LinkLibraryDependencies>false</LinkLibraryDependencies>\r
     </ProjectReference>\r
     <Link>\r
-      <AdditionalDependencies>mono-2.0$(MONO_TARGET_SUFFIX).lib;%(AdditionalDependencies)</AdditionalDependencies>\r
+      <AdditionalDependencies>$(MONO_DYNAMIC_LIBMONO_LIB);%(AdditionalDependencies)</AdditionalDependencies>\r
       <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\r
       <GenerateDebugInformation>true</GenerateDebugInformation>\r
       <SubSystem>Console</SubSystem>\r
       <OptimizeReferences>true</OptimizeReferences>\r
       <EnableCOMDATFolding>true</EnableCOMDATFolding>\r
       <TargetMachine>MachineX64</TargetMachine>\r
-      <AdditionalDependencies>mono-2.0$(MONO_TARGET_SUFFIX).lib;%(AdditionalDependencies)</AdditionalDependencies>\r
+      <AdditionalDependencies>$(MONO_DYNAMIC_LIBMONO_LIB);%(AdditionalDependencies)</AdditionalDependencies>\r
     </Link>\r
   </ItemDefinitionGroup>\r
   <ItemGroup>\r
index a05395ca491b2fa58eabf042b27bd7116a848737..f25016fd5f5e872c9e58c95ae6e5779cfb2d8e6d 100755 (executable)
@@ -26,15 +26,15 @@ IF EXIST %EGLIB_CONFIG_H% (
        )
 )
 
-%windir%\system32\WindowsPowerShell\v1.0\powershell.exe -executionpolicy bypass -NonInteractive -File compare-config-files.ps1 %WIN_CONFIG_H% %CONFIG_H% %CONFIGURE_AC% >$null 2>&1
+%windir%\system32\WindowsPowerShell\v1.0\powershell.exe -executionpolicy bypass -NonInteractive -File compare-config-files.ps1 %WIN_CONFIG_H% %CONFIG_H% %CONFIGURE_AC% 2>&1
 
 IF NOT %ERRORLEVEL% == 0 (
        ECHO copy %WIN_CONFIG_H% %CONFIG_H%
        copy %WIN_CONFIG_H% %CONFIG_H%
-       %windir%\system32\WindowsPowerShell\v1.0\powershell.exe -NonInteractive -Command "(Get-Content %CONFIG_H%) -replace '#MONO_VERSION#', (Select-String -path %CONFIGURE_AC% -pattern 'AC_INIT\(mono, \[(.*)\]').Matches[0].Groups[1].Value | Set-Content %CONFIG_H%" >$null 2>&1
+       %windir%\system32\WindowsPowerShell\v1.0\powershell.exe -NonInteractive -Command "(Get-Content %CONFIG_H%) -replace '#MONO_VERSION#', (Select-String -path %CONFIGURE_AC% -pattern 'AC_INIT\(mono, \[(.*)\]').Matches[0].Groups[1].Value | Set-Content %CONFIG_H%" 2>&1
 )
 
-%windir%\system32\WindowsPowerShell\v1.0\powershell.exe -executionpolicy bypass -NonInteractive -File compare-config-files.ps1 %EGLIB_WIN_CONFIG_H% %EGLIB_CONFIG_H% >$null 2>&1
+%windir%\system32\WindowsPowerShell\v1.0\powershell.exe -executionpolicy bypass -NonInteractive -File compare-config-files.ps1 %EGLIB_WIN_CONFIG_H% %EGLIB_CONFIG_H% 2>&1
 
 IF NOT %ERRORLEVEL% == 0 (
        ECHO copy %EGLIB_WIN_CONFIG_H% %EGLIB_CONFIG_H%
@@ -42,7 +42,7 @@ IF NOT %ERRORLEVEL% == 0 (
 )
 
 SET VERSION_CONTENT="#define FULL_VERSION \"Visual Studio built mono\""
-%windir%\system32\WindowsPowerShell\v1.0\powershell.exe -executionpolicy bypass -NonInteractive -File compare-config-content.ps1 %VERSION_CONTENT% %VERSION_H%
+%windir%\system32\WindowsPowerShell\v1.0\powershell.exe -executionpolicy bypass -NonInteractive -File compare-config-content.ps1 %VERSION_CONTENT% %VERSION_H%  2>&1
 
 
 IF NOT %ERRORLEVEL% == 0 (
index ba17c5e4e215857005ff74c9b74f17746742998a..e0164c4ebcd6b12f041d954b00cf6fe6961a0a2a 100644 (file)
@@ -181,9 +181,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Web.Http.SelfHost-ne
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Web.Http.WebHost-net_4_x", "mcs/class/System.Web.Http.WebHost/System.Web.Http.WebHost-net_4_x.csproj", "{2AF7E697-07BA-439E-89BF-076AEE4AE04C}"
 EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mono.Security.Providers.NewSystemSource-net_4_x", "mcs/class/Mono.Security.Providers.NewSystemSource/Mono.Security.Providers.NewSystemSource-net_4_x.csproj", "{0BB4541F-9B1A-4CBC-BEB1-00B31B37F74E}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mono.Security.Providers.NewTls-net_4_x", "mcs/class/Mono.Security.Providers.NewTls/Mono.Security.Providers.NewTls-net_4_x.csproj", "{C8B8E524-BB3A-44E2-8C22-E3313E9F477C}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Runtime.InteropServices.RuntimeInformation-net_4_x", "mcs/class/System.Runtime.InteropServices.RuntimeInformation/System.Runtime.InteropServices.RuntimeInformation-net_4_x.csproj", "{1E1BC1A8-EAD2-496C-A6D6-8AFABD741F56}"
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Build.Framework-net_4_x", "mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework-net_4_x.csproj", "{5E39A911-F4E6-4B4B-B8AC-111BB1DD80C6}"
 EndProject
@@ -211,11 +209,13 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "I18N.Rare-net_4_x", "mcs/cl
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "I18N.CJK-net_4_x", "mcs/class/I18N/CJK/I18N.CJK-net_4_x.csproj", "{4742C0FA-2C03-4598-A3F2-4E7D9CDFF81B}"
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mono.Btls.Interface-net_4_x", "mcs/class/Mono.Btls.Interface/Mono.Btls.Interface-net_4_x.csproj", "{BF32D586-8FBB-4A2A-A734-AA17CDAB283F}"
+EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mono.Http-net_4_x", "mcs/class/Mono.Http/Mono.Http-net_4_x.csproj", "{11DD6F15-65AB-4CBD-9EFE-2C9626388C53}"
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mono.Cairo-net_4_x", "mcs/class/Mono.Cairo/Mono.Cairo-net_4_x.csproj", "{D76A0C93-56FE-4339-99A8-B7A3D49D6DDE}"
 EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mono.Cecil-net_4_x", "mcs/class/Mono.Cecil/Mono.Cecil-net_4_x.csproj", "{2C0D558F-0B38-4691-967E-A910A1B995C1}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mono.Cecil-net_4_x", "mcs/class/legacy/Mono.Cecil/Mono.Cecil-net_4_x.csproj", "{6DE38817-EC25-433A-AE58-0D30C5E6C460}"
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mono.Cecil.Mdb-net_4_x", "mcs/class/Mono.Cecil.Mdb/Mono.Cecil.Mdb-net_4_x.csproj", "{CF14D34A-F69B-47FB-A99C-D25C77198F30}"
 EndProject
@@ -287,10 +287,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Windows-net_4_x", "m
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Xml.Serialization-net_4_x", "mcs/class/System.Xml.Serialization/System.Xml.Serialization-net_4_x.csproj", "{2210873E-99FC-48A2-A261-D650BAE33A1C}"
 EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mono.Security.Providers.DotNet-net_4_x", "mcs/class/Mono.Security.Providers.DotNet/Mono.Security.Providers.DotNet-net_4_x.csproj", "{391EDD2B-85AC-4FCA-B607-AAD6C51E6799}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mono.Security.Providers.OldTls-net_4_x", "mcs/class/Mono.Security.Providers.OldTls/Mono.Security.Providers.OldTls-net_4_x.csproj", "{E485E885-59B1-4081-BC66-56AAAFD8771A}"
-EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.DirectoryServices.Protocols-net_4_x", "mcs/class/System.DirectoryServices.Protocols/System.DirectoryServices.Protocols-net_4_x.csproj", "{EF08F249-31A1-4E62-8391-ECBA5227B686}"
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.VisualC-net_4_x", "mcs/class/Microsoft.VisualC/Microsoft.VisualC-net_4_x.csproj", "{ACA2694D-9F07-4AE2-9171-9AB5DD1A8C18}"
@@ -311,6 +307,18 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Workflow.ComponentMo
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Workflow.Runtime-net_4_x", "mcs/class/System.Workflow.Runtime/System.Workflow.Runtime-net_4_x.csproj", "{E4180397-83B3-4F7B-9878-6891698F7C52}"
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Reflection.Context-net_4_x", "mcs/class/System.Reflection.Context/System.Reflection.Context-net_4_x.csproj", "{50A4818C-4BD7-49DB-AD2C-FF3FB0A9D392}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facades_System.Security.Cryptography.X509Certificates-net_4_x", "mcs/class/Facades/System.Security.Cryptography.X509Certificates/Facades_System.Security.Cryptography.X509Certificates-net_4_x.csproj", "{C2E71C2B-A806-4FEB-AE2D-A5BE884E3BA7}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facades_System.ServiceModel.Primitives-net_4_x", "mcs/class/Facades/System.ServiceModel.Primitives/Facades_System.ServiceModel.Primitives-net_4_x.csproj", "{524B10FC-880D-4131-8CAE-027BC3A68B6F}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facades_System.Runtime.Serialization.Primitives-net_4_x", "mcs/class/Facades/System.Runtime.Serialization.Primitives/Facades_System.Runtime.Serialization.Primitives-net_4_x.csproj", "{49BB9015-6989-4BD0-AF82-9184BE637D57}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facades_System.Runtime.Serialization.Xml-net_4_x", "mcs/class/Facades/System.Runtime.Serialization.Xml/Facades_System.Runtime.Serialization.Xml-net_4_x.csproj", "{C948B3D4-0BEE-4363-B4A7-635A169C8D63}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facades_System.Drawing.Primitives-net_4_x", "mcs/class/Facades/System.Drawing.Primitives/Facades_System.Drawing.Primitives-net_4_x.csproj", "{1AFDB281-5FB8-48A9-8694-7F515D835862}"
+EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facades_System.Collections.Concurrent-net_4_x", "mcs/class/Facades/System.Collections.Concurrent/Facades_System.Collections.Concurrent-net_4_x.csproj", "{EFD0287C-3651-4D42-B8CA-430776CB1E6D}"
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facades_System.Collections-net_4_x", "mcs/class/Facades/System.Collections/Facades_System.Collections-net_4_x.csproj", "{2597261D-EC05-4333-928D-1CA44AB1A5D2}"
@@ -369,18 +377,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facades_System.Runtime.Nume
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facades_System.Runtime.Serialization.Json-net_4_x", "mcs/class/Facades/System.Runtime.Serialization.Json/Facades_System.Runtime.Serialization.Json-net_4_x.csproj", "{88B512E6-3E9D-4F87-A9E4-5F9239848665}"
 EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facades_System.Runtime.Serialization.Primitives-net_4_x", "mcs/class/Facades/System.Runtime.Serialization.Primitives/Facades_System.Runtime.Serialization.Primitives-net_4_x.csproj", "{49BB9015-6989-4BD0-AF82-9184BE637D57}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facades_System.Runtime.Serialization.Xml-net_4_x", "mcs/class/Facades/System.Runtime.Serialization.Xml/Facades_System.Runtime.Serialization.Xml-net_4_x.csproj", "{C948B3D4-0BEE-4363-B4A7-635A169C8D63}"
-EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facades_System.Runtime-net_4_x", "mcs/class/Facades/System.Runtime/Facades_System.Runtime-net_4_x.csproj", "{CFB32425-69C5-425B-BF9A-66CB3AC52D71}"
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facades_System.Security.Principal-net_4_x", "mcs/class/Facades/System.Security.Principal/Facades_System.Security.Principal-net_4_x.csproj", "{9040CA8B-4352-4621-A2B3-5C32A383DE15}"
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facades_System.ServiceModel.Http-net_4_x", "mcs/class/Facades/System.ServiceModel.Http/Facades_System.ServiceModel.Http-net_4_x.csproj", "{4EE0B25C-F7D7-40A9-AE37-5B874791D3C1}"
 EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facades_System.ServiceModel.Primitives-net_4_x", "mcs/class/Facades/System.ServiceModel.Primitives/Facades_System.ServiceModel.Primitives-net_4_x.csproj", "{524B10FC-880D-4131-8CAE-027BC3A68B6F}"
-EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facades_System.ServiceModel.Security-net_4_x", "mcs/class/Facades/System.ServiceModel.Security/Facades_System.ServiceModel.Security-net_4_x.csproj", "{F937A550-0A4A-4A10-9FD9-E8DE7696671F}"
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facades_System.Text.Encoding.Extensions-net_4_x", "mcs/class/Facades/System.Text.Encoding.Extensions/Facades_System.Text.Encoding.Extensions-net_4_x.csproj", "{28CEA696-8466-4826-9128-B83318184EF4}"
@@ -507,8 +509,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facades_System.Security.Cry
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facades_System.Security.Cryptography.RandomNumberGenerator-net_4_x", "mcs/class/Facades/System.Security.Cryptography.RandomNumberGenerator/Facades_System.Security.Cryptography.RandomNumberGenerator-net_4_x.csproj", "{C87878D2-CDEF-4EC9-8C94-C1381144F4EC}"
 EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facades_System.Security.Cryptography.X509Certificates-net_4_x", "mcs/class/Facades/System.Security.Cryptography.X509Certificates/Facades_System.Security.Cryptography.X509Certificates-net_4_x.csproj", "{C2E71C2B-A806-4FEB-AE2D-A5BE884E3BA7}"
-EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facades_System.Security.Principal.Windows-net_4_x", "mcs/class/Facades/System.Security.Principal.Windows/Facades_System.Security.Principal.Windows-net_4_x.csproj", "{47977802-4193-48DC-AA0F-58D18AEDA405}"
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facades_System.Threading.Thread-net_4_x", "mcs/class/Facades/System.Threading.Thread/Facades_System.Threading.Thread-net_4_x.csproj", "{4D9EF694-5260-432D-BA34-503FFBE43B6C}"
@@ -529,11 +529,13 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facades_System.Globalizatio
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facades_System.IO.FileSystem.AccessControl-net_4_x", "mcs/class/Facades/System.IO.FileSystem.AccessControl/Facades_System.IO.FileSystem.AccessControl-net_4_x.csproj", "{321A53F3-A681-4CA5-A093-1C6650243F6A}"
 EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facades_System.Private.CoreLib.InteropServices-net_4_x", "mcs/class/Facades/System.Private.CoreLib.InteropServices/Facades_System.Private.CoreLib.InteropServices-net_4_x.csproj", "{5D05F5E2-7378-4A35-B1A3-76ABEB4A71C3}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facades_System.Reflection.TypeExtensions-net_4_x", "mcs/class/Facades/System.Reflection.TypeExtensions/Facades_System.Reflection.TypeExtensions-net_4_x.csproj", "{C315A617-25A4-447F-AA4F-0E0E7E35F919}"
 EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facades_System.Private.CoreLib.Threading-net_4_x", "mcs/class/Facades/System.Private.CoreLib.Threading/Facades_System.Private.CoreLib.Threading-net_4_x.csproj", "{642A1B9E-1A2F-4C55-B184-E22F8C2E95B5}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facades_System.Reflection.Emit.Lightweight-net_4_x", "mcs/class/Facades/System.Reflection.Emit.Lightweight/Facades_System.Reflection.Emit.Lightweight-net_4_x.csproj", "{03B29131-9D1A-4446-92F2-237F9EF70C5C}"
 EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facades_System.Reflection.TypeExtensions-net_4_x", "mcs/class/Facades/System.Reflection.TypeExtensions/Facades_System.Reflection.TypeExtensions-net_4_x.csproj", "{C315A617-25A4-447F-AA4F-0E0E7E35F919}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facades_System.Reflection.Emit.ILGeneration-net_4_x", "mcs/class/Facades/System.Reflection.Emit.ILGeneration/Facades_System.Reflection.Emit.ILGeneration-net_4_x.csproj", "{ACF5E339-FB52-48E0-A859-2CE75756DFE8}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facades_System.Reflection.Emit-net_4_x", "mcs/class/Facades/System.Reflection.Emit/Facades_System.Reflection.Emit-net_4_x.csproj", "{5327CF02-204D-45CD-A68D-3D836470E439}"
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facades_System.Security.SecureString-net_4_x", "mcs/class/Facades/System.Security.SecureString/Facades_System.Security.SecureString-net_4_x.csproj", "{57C02AD3-1118-4982-BCE3-53158D30F4E9}"
 EndProject
@@ -543,23 +545,17 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facades_System.Threading.Ov
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facades_System.Xml.XPath.XDocument-net_4_x", "mcs/class/Facades/System.Xml.XPath.XDocument/Facades_System.Xml.XPath.XDocument-net_4_x.csproj", "{38F046A2-EEBD-4FE7-B70E-636F5DB4BBF3}"
 EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facades_System.Reflection.Emit.ILGeneration-net_4_x", "mcs/class/Facades/System.Reflection.Emit.ILGeneration/Facades_System.Reflection.Emit.ILGeneration-net_4_x.csproj", "{ACF5E339-FB52-48E0-A859-2CE75756DFE8}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facades_System.Reflection.Emit.Lightweight-net_4_x", "mcs/class/Facades/System.Reflection.Emit.Lightweight/Facades_System.Reflection.Emit.Lightweight-net_4_x.csproj", "{03B29131-9D1A-4446-92F2-237F9EF70C5C}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facades_System.Reflection.Emit-net_4_x", "mcs/class/Facades/System.Reflection.Emit/Facades_System.Reflection.Emit-net_4_x.csproj", "{5327CF02-204D-45CD-A68D-3D836470E439}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facades_System.Security.Cryptography.Primitives-net_4_x", "mcs/class/Facades/System.Security.Cryptography.Primitives/Facades_System.Security.Cryptography.Primitives-net_4_x.csproj", "{62880D99-1C4C-4D38-A8FE-57EF2C9E2150}"
 EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facades_System.Diagnostics.PerformanceCounter-net_4_x", "mcs/class/Facades/System.Diagnostics.PerformanceCounter/Facades_System.Diagnostics.PerformanceCounter-net_4_x.csproj", "{BA0C64F1-3762-437D-8B58-75F68A5B4E7E}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facades_System.Text.Encoding.CodePages-net_4_x", "mcs/class/Facades/System.Text.Encoding.CodePages/Facades_System.Text.Encoding.CodePages-net_4_x.csproj", "{DF49AC88-C6F2-43B1-8560-3B74542BD874}"
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facades_System.IO.FileSystem.Watcher-net_4_x", "mcs/class/Facades/System.IO.FileSystem.Watcher/Facades_System.IO.FileSystem.Watcher-net_4_x.csproj", "{44647FAA-F785-44DE-B6B2-ABC2B9768233}"
 EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facades_System.IO.Pipes-net_4_x", "mcs/class/Facades/System.IO.Pipes/Facades_System.IO.Pipes-net_4_x.csproj", "{D835F3A9-C4FE-4162-8AB5-DC26D06AC81F}"
-EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facades_System.Security.Cryptography.ProtectedData-net_4_x", "mcs/class/Facades/System.Security.Cryptography.ProtectedData/Facades_System.Security.Cryptography.ProtectedData-net_4_x.csproj", "{66B88E44-F7DA-4C83-B028-A49D4D3EBD16}"
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facades_System.ServiceProcess.ServiceController-net_4_x", "mcs/class/Facades/System.ServiceProcess.ServiceController/Facades_System.ServiceProcess.ServiceController-net_4_x.csproj", "{8C71A924-2561-434B-A792-2F84ABA1C0C2}"
 EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facades_System.Net.Http.WebRequestHandler-net_4_x", "mcs/class/Facades/System.Net.Http.WebRequestHandler/Facades_System.Net.Http.WebRequestHandler-net_4_x.csproj", "{ACA10642-1D5B-443D-99BE-65C31491C54F}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facades_System.IO.Pipes-net_4_x", "mcs/class/Facades/System.IO.Pipes/Facades_System.IO.Pipes-net_4_x.csproj", "{D835F3A9-C4FE-4162-8AB5-DC26D06AC81F}"
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NUnit.Framework-net_4_x", "mcs/nunit24/NUnitFramework/framework/NUnit.Framework-net_4_x.csproj", "{B2272696-96AA-4638-B17C-60A4BA37CA0E}"
 EndProject
@@ -593,8 +589,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "al-net_4_x", "mcs/tools/al/
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "monolinker-net_4_x", "mcs/tools/linker/monolinker-net_4_x.csproj", "{FA920637-C202-4E75-AC0F-1A8DBD631DF1}"
 EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mono.Tuner-net_4_x", "mcs/tools/tuner/Mono.Tuner-net_4_x.csproj", "{8CCE7044-3466-4599-B09E-9F8E0C2F4614}"
-EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "genxs-net_4_x", "mcs/tools/genxs/genxs-net_4_x.csproj", "{DCD2613C-B1A0-489B-BCA1-79BEBB9B9541}"
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "mkbundle-net_4_x", "mcs/tools/mkbundle/mkbundle-net_4_x.csproj", "{3A3DAEC2-3DF4-4968-A191-8D6F207ABA5E}"
@@ -629,7 +623,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunitreport-net_4_x", "mcs/
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "pdb2mdb-net_4_x", "mcs/tools/pdb2mdb/pdb2mdb-net_4_x.csproj", "{F7C83E4F-C1C4-4939-8BA3-3EF6E3631E08}"
 EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "sqlsharp-net_4_x", "mcs/tools/SqlSharp/sqlsharp-net_4_x.csproj", "{DCCC3618-803B-4492-A968-010E2C0851E8}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "sqlsharp-net_4_x", "mcs/tools/sqlsharp/sqlsharp-net_4_x.csproj", "{DCCC3618-803B-4492-A968-010E2C0851E8}"
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "sqlmetal-net_4_x", "mcs/tools/sqlmetal/sqlmetal-net_4_x.csproj", "{71A04260-D8F6-4E97-898D-5F3D5A2F3D94}"
 EndProject
@@ -675,6 +669,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "mono-symbolicate-net_4_x",
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "linkeranalyzer-net_4_x", "mcs/tools/linker-analyzer/linkeranalyzer-net_4_x.csproj", "{D7789C48-C33A-4FE5-BD42-4DBAB2850796}"
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "btls-cert-sync-net_4_x", "mcs/tools/btls/btls-cert-sync-net_4_x.csproj", "{2323EB4F-0DBA-47C7-B4AA-AD38CCD16BF8}"
+EndProject
 Global
        GlobalSection(SolutionConfigurationPlatforms) = preSolution
                Debug|Any CPU = Debug|Any CPU
@@ -1041,14 +1037,10 @@ Global
                {2AF7E697-07BA-439E-89BF-076AEE4AE04C}.Debug|Any CPU.Build.0 = Debug|Any CPU
                {2AF7E697-07BA-439E-89BF-076AEE4AE04C}.Release|Any CPU.ActiveCfg = Release|Any CPU
                {2AF7E697-07BA-439E-89BF-076AEE4AE04C}.Release|Any CPU.Build.0 = Release|Any CPU
-               {0BB4541F-9B1A-4CBC-BEB1-00B31B37F74E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-               {0BB4541F-9B1A-4CBC-BEB1-00B31B37F74E}.Debug|Any CPU.Build.0 = Debug|Any CPU
-               {0BB4541F-9B1A-4CBC-BEB1-00B31B37F74E}.Release|Any CPU.ActiveCfg = Release|Any CPU
-               {0BB4541F-9B1A-4CBC-BEB1-00B31B37F74E}.Release|Any CPU.Build.0 = Release|Any CPU
-               {C8B8E524-BB3A-44E2-8C22-E3313E9F477C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-               {C8B8E524-BB3A-44E2-8C22-E3313E9F477C}.Debug|Any CPU.Build.0 = Debug|Any CPU
-               {C8B8E524-BB3A-44E2-8C22-E3313E9F477C}.Release|Any CPU.ActiveCfg = Release|Any CPU
-               {C8B8E524-BB3A-44E2-8C22-E3313E9F477C}.Release|Any CPU.Build.0 = Release|Any CPU
+               {1E1BC1A8-EAD2-496C-A6D6-8AFABD741F56}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+               {1E1BC1A8-EAD2-496C-A6D6-8AFABD741F56}.Debug|Any CPU.Build.0 = Debug|Any CPU
+               {1E1BC1A8-EAD2-496C-A6D6-8AFABD741F56}.Release|Any CPU.ActiveCfg = Release|Any CPU
+               {1E1BC1A8-EAD2-496C-A6D6-8AFABD741F56}.Release|Any CPU.Build.0 = Release|Any CPU
                {5E39A911-F4E6-4B4B-B8AC-111BB1DD80C6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
                {5E39A911-F4E6-4B4B-B8AC-111BB1DD80C6}.Debug|Any CPU.Build.0 = Debug|Any CPU
                {5E39A911-F4E6-4B4B-B8AC-111BB1DD80C6}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -1101,6 +1093,10 @@ Global
                {4742C0FA-2C03-4598-A3F2-4E7D9CDFF81B}.Debug|Any CPU.Build.0 = Debug|Any CPU
                {4742C0FA-2C03-4598-A3F2-4E7D9CDFF81B}.Release|Any CPU.ActiveCfg = Release|Any CPU
                {4742C0FA-2C03-4598-A3F2-4E7D9CDFF81B}.Release|Any CPU.Build.0 = Release|Any CPU
+               {BF32D586-8FBB-4A2A-A734-AA17CDAB283F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+               {BF32D586-8FBB-4A2A-A734-AA17CDAB283F}.Debug|Any CPU.Build.0 = Debug|Any CPU
+               {BF32D586-8FBB-4A2A-A734-AA17CDAB283F}.Release|Any CPU.ActiveCfg = Release|Any CPU
+               {BF32D586-8FBB-4A2A-A734-AA17CDAB283F}.Release|Any CPU.Build.0 = Release|Any CPU
                {11DD6F15-65AB-4CBD-9EFE-2C9626388C53}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
                {11DD6F15-65AB-4CBD-9EFE-2C9626388C53}.Debug|Any CPU.Build.0 = Debug|Any CPU
                {11DD6F15-65AB-4CBD-9EFE-2C9626388C53}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -1109,10 +1105,10 @@ Global
                {D76A0C93-56FE-4339-99A8-B7A3D49D6DDE}.Debug|Any CPU.Build.0 = Debug|Any CPU
                {D76A0C93-56FE-4339-99A8-B7A3D49D6DDE}.Release|Any CPU.ActiveCfg = Release|Any CPU
                {D76A0C93-56FE-4339-99A8-B7A3D49D6DDE}.Release|Any CPU.Build.0 = Release|Any CPU
-               {2C0D558F-0B38-4691-967E-A910A1B995C1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-               {2C0D558F-0B38-4691-967E-A910A1B995C1}.Debug|Any CPU.Build.0 = Debug|Any CPU
-               {2C0D558F-0B38-4691-967E-A910A1B995C1}.Release|Any CPU.ActiveCfg = Release|Any CPU
-               {2C0D558F-0B38-4691-967E-A910A1B995C1}.Release|Any CPU.Build.0 = Release|Any CPU
+               {6DE38817-EC25-433A-AE58-0D30C5E6C460}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+               {6DE38817-EC25-433A-AE58-0D30C5E6C460}.Debug|Any CPU.Build.0 = Debug|Any CPU
+               {6DE38817-EC25-433A-AE58-0D30C5E6C460}.Release|Any CPU.ActiveCfg = Release|Any CPU
+               {6DE38817-EC25-433A-AE58-0D30C5E6C460}.Release|Any CPU.Build.0 = Release|Any CPU
                {CF14D34A-F69B-47FB-A99C-D25C77198F30}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
                {CF14D34A-F69B-47FB-A99C-D25C77198F30}.Debug|Any CPU.Build.0 = Debug|Any CPU
                {CF14D34A-F69B-47FB-A99C-D25C77198F30}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -1253,14 +1249,6 @@ Global
                {2210873E-99FC-48A2-A261-D650BAE33A1C}.Debug|Any CPU.Build.0 = Debug|Any CPU
                {2210873E-99FC-48A2-A261-D650BAE33A1C}.Release|Any CPU.ActiveCfg = Release|Any CPU
                {2210873E-99FC-48A2-A261-D650BAE33A1C}.Release|Any CPU.Build.0 = Release|Any CPU
-               {391EDD2B-85AC-4FCA-B607-AAD6C51E6799}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-               {391EDD2B-85AC-4FCA-B607-AAD6C51E6799}.Debug|Any CPU.Build.0 = Debug|Any CPU
-               {391EDD2B-85AC-4FCA-B607-AAD6C51E6799}.Release|Any CPU.ActiveCfg = Release|Any CPU
-               {391EDD2B-85AC-4FCA-B607-AAD6C51E6799}.Release|Any CPU.Build.0 = Release|Any CPU
-               {E485E885-59B1-4081-BC66-56AAAFD8771A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-               {E485E885-59B1-4081-BC66-56AAAFD8771A}.Debug|Any CPU.Build.0 = Debug|Any CPU
-               {E485E885-59B1-4081-BC66-56AAAFD8771A}.Release|Any CPU.ActiveCfg = Release|Any CPU
-               {E485E885-59B1-4081-BC66-56AAAFD8771A}.Release|Any CPU.Build.0 = Release|Any CPU
                {EF08F249-31A1-4E62-8391-ECBA5227B686}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
                {EF08F249-31A1-4E62-8391-ECBA5227B686}.Debug|Any CPU.Build.0 = Debug|Any CPU
                {EF08F249-31A1-4E62-8391-ECBA5227B686}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -1301,6 +1289,30 @@ Global
                {E4180397-83B3-4F7B-9878-6891698F7C52}.Debug|Any CPU.Build.0 = Debug|Any CPU
                {E4180397-83B3-4F7B-9878-6891698F7C52}.Release|Any CPU.ActiveCfg = Release|Any CPU
                {E4180397-83B3-4F7B-9878-6891698F7C52}.Release|Any CPU.Build.0 = Release|Any CPU
+               {50A4818C-4BD7-49DB-AD2C-FF3FB0A9D392}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+               {50A4818C-4BD7-49DB-AD2C-FF3FB0A9D392}.Debug|Any CPU.Build.0 = Debug|Any CPU
+               {50A4818C-4BD7-49DB-AD2C-FF3FB0A9D392}.Release|Any CPU.ActiveCfg = Release|Any CPU
+               {50A4818C-4BD7-49DB-AD2C-FF3FB0A9D392}.Release|Any CPU.Build.0 = Release|Any CPU
+               {C2E71C2B-A806-4FEB-AE2D-A5BE884E3BA7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+               {C2E71C2B-A806-4FEB-AE2D-A5BE884E3BA7}.Debug|Any CPU.Build.0 = Debug|Any CPU
+               {C2E71C2B-A806-4FEB-AE2D-A5BE884E3BA7}.Release|Any CPU.ActiveCfg = Release|Any CPU
+               {C2E71C2B-A806-4FEB-AE2D-A5BE884E3BA7}.Release|Any CPU.Build.0 = Release|Any CPU
+               {524B10FC-880D-4131-8CAE-027BC3A68B6F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+               {524B10FC-880D-4131-8CAE-027BC3A68B6F}.Debug|Any CPU.Build.0 = Debug|Any CPU
+               {524B10FC-880D-4131-8CAE-027BC3A68B6F}.Release|Any CPU.ActiveCfg = Release|Any CPU
+               {524B10FC-880D-4131-8CAE-027BC3A68B6F}.Release|Any CPU.Build.0 = Release|Any CPU
+               {49BB9015-6989-4BD0-AF82-9184BE637D57}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+               {49BB9015-6989-4BD0-AF82-9184BE637D57}.Debug|Any CPU.Build.0 = Debug|Any CPU
+               {49BB9015-6989-4BD0-AF82-9184BE637D57}.Release|Any CPU.ActiveCfg = Release|Any CPU
+               {49BB9015-6989-4BD0-AF82-9184BE637D57}.Release|Any CPU.Build.0 = Release|Any CPU
+               {C948B3D4-0BEE-4363-B4A7-635A169C8D63}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+               {C948B3D4-0BEE-4363-B4A7-635A169C8D63}.Debug|Any CPU.Build.0 = Debug|Any CPU
+               {C948B3D4-0BEE-4363-B4A7-635A169C8D63}.Release|Any CPU.ActiveCfg = Release|Any CPU
+               {C948B3D4-0BEE-4363-B4A7-635A169C8D63}.Release|Any CPU.Build.0 = Release|Any CPU
+               {1AFDB281-5FB8-48A9-8694-7F515D835862}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+               {1AFDB281-5FB8-48A9-8694-7F515D835862}.Debug|Any CPU.Build.0 = Debug|Any CPU
+               {1AFDB281-5FB8-48A9-8694-7F515D835862}.Release|Any CPU.ActiveCfg = Release|Any CPU
+               {1AFDB281-5FB8-48A9-8694-7F515D835862}.Release|Any CPU.Build.0 = Release|Any CPU
                {EFD0287C-3651-4D42-B8CA-430776CB1E6D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
                {EFD0287C-3651-4D42-B8CA-430776CB1E6D}.Debug|Any CPU.Build.0 = Debug|Any CPU
                {EFD0287C-3651-4D42-B8CA-430776CB1E6D}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -1417,14 +1429,6 @@ Global
                {88B512E6-3E9D-4F87-A9E4-5F9239848665}.Debug|Any CPU.Build.0 = Debug|Any CPU
                {88B512E6-3E9D-4F87-A9E4-5F9239848665}.Release|Any CPU.ActiveCfg = Release|Any CPU
                {88B512E6-3E9D-4F87-A9E4-5F9239848665}.Release|Any CPU.Build.0 = Release|Any CPU
-               {49BB9015-6989-4BD0-AF82-9184BE637D57}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-               {49BB9015-6989-4BD0-AF82-9184BE637D57}.Debug|Any CPU.Build.0 = Debug|Any CPU
-               {49BB9015-6989-4BD0-AF82-9184BE637D57}.Release|Any CPU.ActiveCfg = Release|Any CPU
-               {49BB9015-6989-4BD0-AF82-9184BE637D57}.Release|Any CPU.Build.0 = Release|Any CPU
-               {C948B3D4-0BEE-4363-B4A7-635A169C8D63}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-               {C948B3D4-0BEE-4363-B4A7-635A169C8D63}.Debug|Any CPU.Build.0 = Debug|Any CPU
-               {C948B3D4-0BEE-4363-B4A7-635A169C8D63}.Release|Any CPU.ActiveCfg = Release|Any CPU
-               {C948B3D4-0BEE-4363-B4A7-635A169C8D63}.Release|Any CPU.Build.0 = Release|Any CPU
                {CFB32425-69C5-425B-BF9A-66CB3AC52D71}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
                {CFB32425-69C5-425B-BF9A-66CB3AC52D71}.Debug|Any CPU.Build.0 = Debug|Any CPU
                {CFB32425-69C5-425B-BF9A-66CB3AC52D71}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -1437,10 +1441,6 @@ Global
                {4EE0B25C-F7D7-40A9-AE37-5B874791D3C1}.Debug|Any CPU.Build.0 = Debug|Any CPU
                {4EE0B25C-F7D7-40A9-AE37-5B874791D3C1}.Release|Any CPU.ActiveCfg = Release|Any CPU
                {4EE0B25C-F7D7-40A9-AE37-5B874791D3C1}.Release|Any CPU.Build.0 = Release|Any CPU
-               {524B10FC-880D-4131-8CAE-027BC3A68B6F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-               {524B10FC-880D-4131-8CAE-027BC3A68B6F}.Debug|Any CPU.Build.0 = Debug|Any CPU
-               {524B10FC-880D-4131-8CAE-027BC3A68B6F}.Release|Any CPU.ActiveCfg = Release|Any CPU
-               {524B10FC-880D-4131-8CAE-027BC3A68B6F}.Release|Any CPU.Build.0 = Release|Any CPU
                {F937A550-0A4A-4A10-9FD9-E8DE7696671F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
                {F937A550-0A4A-4A10-9FD9-E8DE7696671F}.Debug|Any CPU.Build.0 = Debug|Any CPU
                {F937A550-0A4A-4A10-9FD9-E8DE7696671F}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -1693,10 +1693,6 @@ Global
                {C87878D2-CDEF-4EC9-8C94-C1381144F4EC}.Debug|Any CPU.Build.0 = Debug|Any CPU
                {C87878D2-CDEF-4EC9-8C94-C1381144F4EC}.Release|Any CPU.ActiveCfg = Release|Any CPU
                {C87878D2-CDEF-4EC9-8C94-C1381144F4EC}.Release|Any CPU.Build.0 = Release|Any CPU
-               {C2E71C2B-A806-4FEB-AE2D-A5BE884E3BA7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-               {C2E71C2B-A806-4FEB-AE2D-A5BE884E3BA7}.Debug|Any CPU.Build.0 = Debug|Any CPU
-               {C2E71C2B-A806-4FEB-AE2D-A5BE884E3BA7}.Release|Any CPU.ActiveCfg = Release|Any CPU
-               {C2E71C2B-A806-4FEB-AE2D-A5BE884E3BA7}.Release|Any CPU.Build.0 = Release|Any CPU
                {47977802-4193-48DC-AA0F-58D18AEDA405}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
                {47977802-4193-48DC-AA0F-58D18AEDA405}.Debug|Any CPU.Build.0 = Debug|Any CPU
                {47977802-4193-48DC-AA0F-58D18AEDA405}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -1737,18 +1733,22 @@ Global
                {321A53F3-A681-4CA5-A093-1C6650243F6A}.Debug|Any CPU.Build.0 = Debug|Any CPU
                {321A53F3-A681-4CA5-A093-1C6650243F6A}.Release|Any CPU.ActiveCfg = Release|Any CPU
                {321A53F3-A681-4CA5-A093-1C6650243F6A}.Release|Any CPU.Build.0 = Release|Any CPU
-               {5D05F5E2-7378-4A35-B1A3-76ABEB4A71C3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-               {5D05F5E2-7378-4A35-B1A3-76ABEB4A71C3}.Debug|Any CPU.Build.0 = Debug|Any CPU
-               {5D05F5E2-7378-4A35-B1A3-76ABEB4A71C3}.Release|Any CPU.ActiveCfg = Release|Any CPU
-               {5D05F5E2-7378-4A35-B1A3-76ABEB4A71C3}.Release|Any CPU.Build.0 = Release|Any CPU
-               {642A1B9E-1A2F-4C55-B184-E22F8C2E95B5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-               {642A1B9E-1A2F-4C55-B184-E22F8C2E95B5}.Debug|Any CPU.Build.0 = Debug|Any CPU
-               {642A1B9E-1A2F-4C55-B184-E22F8C2E95B5}.Release|Any CPU.ActiveCfg = Release|Any CPU
-               {642A1B9E-1A2F-4C55-B184-E22F8C2E95B5}.Release|Any CPU.Build.0 = Release|Any CPU
                {C315A617-25A4-447F-AA4F-0E0E7E35F919}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
                {C315A617-25A4-447F-AA4F-0E0E7E35F919}.Debug|Any CPU.Build.0 = Debug|Any CPU
                {C315A617-25A4-447F-AA4F-0E0E7E35F919}.Release|Any CPU.ActiveCfg = Release|Any CPU
                {C315A617-25A4-447F-AA4F-0E0E7E35F919}.Release|Any CPU.Build.0 = Release|Any CPU
+               {03B29131-9D1A-4446-92F2-237F9EF70C5C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+               {03B29131-9D1A-4446-92F2-237F9EF70C5C}.Debug|Any CPU.Build.0 = Debug|Any CPU
+               {03B29131-9D1A-4446-92F2-237F9EF70C5C}.Release|Any CPU.ActiveCfg = Release|Any CPU
+               {03B29131-9D1A-4446-92F2-237F9EF70C5C}.Release|Any CPU.Build.0 = Release|Any CPU
+               {ACF5E339-FB52-48E0-A859-2CE75756DFE8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+               {ACF5E339-FB52-48E0-A859-2CE75756DFE8}.Debug|Any CPU.Build.0 = Debug|Any CPU
+               {ACF5E339-FB52-48E0-A859-2CE75756DFE8}.Release|Any CPU.ActiveCfg = Release|Any CPU
+               {ACF5E339-FB52-48E0-A859-2CE75756DFE8}.Release|Any CPU.Build.0 = Release|Any CPU
+               {5327CF02-204D-45CD-A68D-3D836470E439}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+               {5327CF02-204D-45CD-A68D-3D836470E439}.Debug|Any CPU.Build.0 = Debug|Any CPU
+               {5327CF02-204D-45CD-A68D-3D836470E439}.Release|Any CPU.ActiveCfg = Release|Any CPU
+               {5327CF02-204D-45CD-A68D-3D836470E439}.Release|Any CPU.Build.0 = Release|Any CPU
                {57C02AD3-1118-4982-BCE3-53158D30F4E9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
                {57C02AD3-1118-4982-BCE3-53158D30F4E9}.Debug|Any CPU.Build.0 = Debug|Any CPU
                {57C02AD3-1118-4982-BCE3-53158D30F4E9}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -1765,30 +1765,18 @@ Global
                {38F046A2-EEBD-4FE7-B70E-636F5DB4BBF3}.Debug|Any CPU.Build.0 = Debug|Any CPU
                {38F046A2-EEBD-4FE7-B70E-636F5DB4BBF3}.Release|Any CPU.ActiveCfg = Release|Any CPU
                {38F046A2-EEBD-4FE7-B70E-636F5DB4BBF3}.Release|Any CPU.Build.0 = Release|Any CPU
-               {ACF5E339-FB52-48E0-A859-2CE75756DFE8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-               {ACF5E339-FB52-48E0-A859-2CE75756DFE8}.Debug|Any CPU.Build.0 = Debug|Any CPU
-               {ACF5E339-FB52-48E0-A859-2CE75756DFE8}.Release|Any CPU.ActiveCfg = Release|Any CPU
-               {ACF5E339-FB52-48E0-A859-2CE75756DFE8}.Release|Any CPU.Build.0 = Release|Any CPU
-               {03B29131-9D1A-4446-92F2-237F9EF70C5C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-               {03B29131-9D1A-4446-92F2-237F9EF70C5C}.Debug|Any CPU.Build.0 = Debug|Any CPU
-               {03B29131-9D1A-4446-92F2-237F9EF70C5C}.Release|Any CPU.ActiveCfg = Release|Any CPU
-               {03B29131-9D1A-4446-92F2-237F9EF70C5C}.Release|Any CPU.Build.0 = Release|Any CPU
-               {5327CF02-204D-45CD-A68D-3D836470E439}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-               {5327CF02-204D-45CD-A68D-3D836470E439}.Debug|Any CPU.Build.0 = Debug|Any CPU
-               {5327CF02-204D-45CD-A68D-3D836470E439}.Release|Any CPU.ActiveCfg = Release|Any CPU
-               {5327CF02-204D-45CD-A68D-3D836470E439}.Release|Any CPU.Build.0 = Release|Any CPU
-               {BA0C64F1-3762-437D-8B58-75F68A5B4E7E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-               {BA0C64F1-3762-437D-8B58-75F68A5B4E7E}.Debug|Any CPU.Build.0 = Debug|Any CPU
-               {BA0C64F1-3762-437D-8B58-75F68A5B4E7E}.Release|Any CPU.ActiveCfg = Release|Any CPU
-               {BA0C64F1-3762-437D-8B58-75F68A5B4E7E}.Release|Any CPU.Build.0 = Release|Any CPU
+               {62880D99-1C4C-4D38-A8FE-57EF2C9E2150}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+               {62880D99-1C4C-4D38-A8FE-57EF2C9E2150}.Debug|Any CPU.Build.0 = Debug|Any CPU
+               {62880D99-1C4C-4D38-A8FE-57EF2C9E2150}.Release|Any CPU.ActiveCfg = Release|Any CPU
+               {62880D99-1C4C-4D38-A8FE-57EF2C9E2150}.Release|Any CPU.Build.0 = Release|Any CPU
+               {DF49AC88-C6F2-43B1-8560-3B74542BD874}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+               {DF49AC88-C6F2-43B1-8560-3B74542BD874}.Debug|Any CPU.Build.0 = Debug|Any CPU
+               {DF49AC88-C6F2-43B1-8560-3B74542BD874}.Release|Any CPU.ActiveCfg = Release|Any CPU
+               {DF49AC88-C6F2-43B1-8560-3B74542BD874}.Release|Any CPU.Build.0 = Release|Any CPU
                {44647FAA-F785-44DE-B6B2-ABC2B9768233}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
                {44647FAA-F785-44DE-B6B2-ABC2B9768233}.Debug|Any CPU.Build.0 = Debug|Any CPU
                {44647FAA-F785-44DE-B6B2-ABC2B9768233}.Release|Any CPU.ActiveCfg = Release|Any CPU
                {44647FAA-F785-44DE-B6B2-ABC2B9768233}.Release|Any CPU.Build.0 = Release|Any CPU
-               {D835F3A9-C4FE-4162-8AB5-DC26D06AC81F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-               {D835F3A9-C4FE-4162-8AB5-DC26D06AC81F}.Debug|Any CPU.Build.0 = Debug|Any CPU
-               {D835F3A9-C4FE-4162-8AB5-DC26D06AC81F}.Release|Any CPU.ActiveCfg = Release|Any CPU
-               {D835F3A9-C4FE-4162-8AB5-DC26D06AC81F}.Release|Any CPU.Build.0 = Release|Any CPU
                {66B88E44-F7DA-4C83-B028-A49D4D3EBD16}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
                {66B88E44-F7DA-4C83-B028-A49D4D3EBD16}.Debug|Any CPU.Build.0 = Debug|Any CPU
                {66B88E44-F7DA-4C83-B028-A49D4D3EBD16}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -1797,10 +1785,10 @@ Global
                {8C71A924-2561-434B-A792-2F84ABA1C0C2}.Debug|Any CPU.Build.0 = Debug|Any CPU
                {8C71A924-2561-434B-A792-2F84ABA1C0C2}.Release|Any CPU.ActiveCfg = Release|Any CPU
                {8C71A924-2561-434B-A792-2F84ABA1C0C2}.Release|Any CPU.Build.0 = Release|Any CPU
-               {ACA10642-1D5B-443D-99BE-65C31491C54F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-               {ACA10642-1D5B-443D-99BE-65C31491C54F}.Debug|Any CPU.Build.0 = Debug|Any CPU
-               {ACA10642-1D5B-443D-99BE-65C31491C54F}.Release|Any CPU.ActiveCfg = Release|Any CPU
-               {ACA10642-1D5B-443D-99BE-65C31491C54F}.Release|Any CPU.Build.0 = Release|Any CPU
+               {D835F3A9-C4FE-4162-8AB5-DC26D06AC81F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+               {D835F3A9-C4FE-4162-8AB5-DC26D06AC81F}.Debug|Any CPU.Build.0 = Debug|Any CPU
+               {D835F3A9-C4FE-4162-8AB5-DC26D06AC81F}.Release|Any CPU.ActiveCfg = Release|Any CPU
+               {D835F3A9-C4FE-4162-8AB5-DC26D06AC81F}.Release|Any CPU.Build.0 = Release|Any CPU
                {B2272696-96AA-4638-B17C-60A4BA37CA0E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
                {B2272696-96AA-4638-B17C-60A4BA37CA0E}.Debug|Any CPU.Build.0 = Debug|Any CPU
                {B2272696-96AA-4638-B17C-60A4BA37CA0E}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -1865,10 +1853,6 @@ Global
                {FA920637-C202-4E75-AC0F-1A8DBD631DF1}.Debug|Any CPU.Build.0 = Debug|Any CPU
                {FA920637-C202-4E75-AC0F-1A8DBD631DF1}.Release|Any CPU.ActiveCfg = Release|Any CPU
                {FA920637-C202-4E75-AC0F-1A8DBD631DF1}.Release|Any CPU.Build.0 = Release|Any CPU
-               {8CCE7044-3466-4599-B09E-9F8E0C2F4614}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-               {8CCE7044-3466-4599-B09E-9F8E0C2F4614}.Debug|Any CPU.Build.0 = Debug|Any CPU
-               {8CCE7044-3466-4599-B09E-9F8E0C2F4614}.Release|Any CPU.ActiveCfg = Release|Any CPU
-               {8CCE7044-3466-4599-B09E-9F8E0C2F4614}.Release|Any CPU.Build.0 = Release|Any CPU
                {DCD2613C-B1A0-489B-BCA1-79BEBB9B9541}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
                {DCD2613C-B1A0-489B-BCA1-79BEBB9B9541}.Debug|Any CPU.Build.0 = Debug|Any CPU
                {DCD2613C-B1A0-489B-BCA1-79BEBB9B9541}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -2029,6 +2013,10 @@ Global
                {D7789C48-C33A-4FE5-BD42-4DBAB2850796}.Debug|Any CPU.Build.0 = Debug|Any CPU
                {D7789C48-C33A-4FE5-BD42-4DBAB2850796}.Release|Any CPU.ActiveCfg = Release|Any CPU
                {D7789C48-C33A-4FE5-BD42-4DBAB2850796}.Release|Any CPU.Build.0 = Release|Any CPU
+               {2323EB4F-0DBA-47C7-B4AA-AD38CCD16BF8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+               {2323EB4F-0DBA-47C7-B4AA-AD38CCD16BF8}.Debug|Any CPU.Build.0 = Debug|Any CPU
+               {2323EB4F-0DBA-47C7-B4AA-AD38CCD16BF8}.Release|Any CPU.ActiveCfg = Release|Any CPU
+               {2323EB4F-0DBA-47C7-B4AA-AD38CCD16BF8}.Release|Any CPU.Build.0 = Release|Any CPU
        EndGlobalSection
        GlobalSection(SolutionProperties) = preSolution
                HideSolutionNode = FALSE
diff --git a/packaging/MacSDK/__init__.py b/packaging/MacSDK/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/packaging/MacSDK/fsharp.py b/packaging/MacSDK/fsharp.py
new file mode 100644 (file)
index 0000000..9e53489
--- /dev/null
@@ -0,0 +1,24 @@
+class FsharpPackage(GitHubTarballPackage):
+
+    def __init__(self):
+        GitHubTarballPackage.__init__(self,
+                                      'fsharp', 'fsharp',
+                                      '4.0.1.9',
+                                      '0a6c66a8f18eb8a5c4d0bfac61d883b6994a918a',
+                                      configure='./configure --prefix="%{package_prefix}"')
+
+        self.extra_stage_files = [
+            'lib/mono/xbuild/Microsoft/VisualStudio/v/FSharp/Microsoft.FSharp.Targets']
+
+    def prep(self):
+        Package.prep(self)
+
+        for p in range(1, len(self.sources)):
+            self.sh('patch -p1 < "%{local_sources[' + str(p) + ']}"')
+
+    def build(self):
+        self.sh('autoreconf')
+        Package.configure(self)
+        Package.make(self)
+
+FsharpPackage()
diff --git a/packaging/MacSDK/gdk-pixbuf/0001-pixbuf-Add-getter-setter-for-the-2x-variants.patch b/packaging/MacSDK/gdk-pixbuf/0001-pixbuf-Add-getter-setter-for-the-2x-variants.patch
new file mode 100644 (file)
index 0000000..2ca1c6a
--- /dev/null
@@ -0,0 +1,56 @@
+From f6d2db5a0c105785ee6f03717966ef0dbb1421f6 Mon Sep 17 00:00:00 2001
+From: Carlos Garnacho <carlosg@gnome.org>
+Date: Tue, 16 Jul 2013 10:32:11 +0200
+Subject: [PATCH] pixbuf: Add getter/setter for the 2x variants
+
+---
+ gdk-pixbuf/gdk-pixbuf-core.h |  3 +++
+ gdk-pixbuf/gdk-pixbuf.c      | 22 ++++++++++++++++++++++
+ 2 files changed, 25 insertions(+)
+
+diff --git a/gdk-pixbuf/gdk-pixbuf-core.h b/gdk-pixbuf/gdk-pixbuf-core.h
+index eb4d0a1..60c4ea3 100644
+--- a/gdk-pixbuf/gdk-pixbuf-core.h
++++ b/gdk-pixbuf/gdk-pixbuf-core.h
+@@ -474,6 +474,9 @@ GdkPixbuf *gdk_pixbuf_apply_embedded_orientation (GdkPixbuf *src);
+ const gchar * gdk_pixbuf_get_option (GdkPixbuf   *pixbuf,
+                                               const gchar *key);
+
++GdkPixbuf * gdk_pixbuf_get_hires_variant (GdkPixbuf *pixbuf);
++void        gdk_pixbuf_set_hires_variant (GdkPixbuf *pixbuf,
++                                          GdkPixbuf *hires);
+
+ G_END_DECLS
+
+diff --git a/gdk-pixbuf/gdk-pixbuf.c b/gdk-pixbuf/gdk-pixbuf.c
+index 0e13f27..d61f2c7 100644
+--- a/gdk-pixbuf/gdk-pixbuf.c
++++ b/gdk-pixbuf/gdk-pixbuf.c
+@@ -990,3 +990,25 @@ gdk_pixbuf_get_property (GObject         *object,
+                   break;
+           }
+ }
++
++GdkPixbuf *
++gdk_pixbuf_get_hires_variant (GdkPixbuf *pixbuf)
++{
++        g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), NULL);
++
++        return g_object_get_data (G_OBJECT (pixbuf),
++                                  "gdk-pixbuf-2x-variant");
++}
++
++void
++gdk_pixbuf_set_hires_variant (GdkPixbuf *pixbuf,
++                              GdkPixbuf *hires)
++{
++        g_return_if_fail (GDK_IS_PIXBUF (pixbuf));
++        g_return_if_fail (GDK_IS_PIXBUF (hires));
++
++        g_object_set_data_full (G_OBJECT (pixbuf),
++                                "gdk-pixbuf-2x-variant",
++                                g_object_ref (hires),
++                                (GDestroyNotify) g_object_unref);
++}
+--
+1.8.3.2
diff --git a/packaging/MacSDK/gdk-pixbuf/0001-pixbuf-load-2x-variants-as-pixbuf-gobject-data.patch b/packaging/MacSDK/gdk-pixbuf/0001-pixbuf-load-2x-variants-as-pixbuf-gobject-data.patch
new file mode 100644 (file)
index 0000000..80d3d39
--- /dev/null
@@ -0,0 +1,99 @@
+>From de5d91aa15cc98795a68c8e553eb4baadaa0e501 Mon Sep 17 00:00:00 2001
+From: Carlos Garnacho <carlosg@gnome.org>
+Date: Fri, 17 May 2013 15:56:28 +0200
+Subject: [PATCH] pixbuf: load "@2x" variants as pixbuf gobject data
+
+if a variant of the filename is found that has a "@2x" appended
+to the file name (before the extension), such file is loaded
+and added as GObject data to the pixbuf
+---
+ gdk-pixbuf/gdk-pixbuf-io.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 55 insertions(+)
+
+diff --git a/gdk-pixbuf/gdk-pixbuf-io.c b/gdk-pixbuf/gdk-pixbuf-io.c
+index dac21b8..ed98cd3 100644
+--- a/gdk-pixbuf/gdk-pixbuf-io.c
++++ b/gdk-pixbuf/gdk-pixbuf-io.c
+@@ -1025,6 +1025,40 @@ _gdk_pixbuf_generic_image_load (GdkPixbufModule *module,
+         return pixbuf;
+ }
+
++static gboolean
++_gdk_pixbuf_file_is_scaled (const gchar *filename)
++{
++      gchar *basename, *ext;
++
++      basename = g_path_get_basename (filename);
++      ext = strrchr (basename, '.');
++
++      if (!ext)
++              ext = &basename[strlen(basename)];
++
++      if (ext > basename + 3 && strncmp (ext - 3, "@2x", 3) == 0)
++              return TRUE;
++
++      return FALSE;
++}
++
++static gchar *
++_gdk_pixbuf_compose_scaled_filename (const gchar *filename)
++{
++      gchar *ext, *first, *composed;
++
++      ext = strrchr (filename, '.');
++
++      if (!ext)
++              return NULL;
++
++      first = g_strndup (filename, ext - filename);
++      composed = g_strdup_printf ("%s@2x%s", first, ext);
++      g_free (first);
++
++      return composed;
++}
++
+ /**
+  * gdk_pixbuf_new_from_file:
+  * @filename: Name of file to load, in the GLib file name encoding
+@@ -1049,11 +1083,13 @@ gdk_pixbuf_new_from_file (const char *filename,
+         guchar buffer[SNIFF_BUFFER_SIZE];
+         GdkPixbufModule *image_module;
+         gchar *display_name;
++      gboolean filename_is_scaled;
+
+         g_return_val_if_fail (filename != NULL, NULL);
+         g_return_val_if_fail (error == NULL || *error == NULL, NULL);
+
+         display_name = g_filename_display_name (filename);
++      filename_is_scaled = _gdk_pixbuf_file_is_scaled (filename);
+
+         f = g_fopen (filename, "rb");
+         if (!f) {
+@@ -1097,6 +1133,25 @@ gdk_pixbuf_new_from_file (const char *filename,
+         pixbuf = _gdk_pixbuf_generic_image_load (image_module, f, error);
+         fclose (f);
+
++      if (pixbuf && !filename_is_scaled) {
++              GdkPixbuf *scaled_pixbuf = NULL;
++              gchar *scaled_filename;
++
++              scaled_filename = _gdk_pixbuf_compose_scaled_filename (filename);
++
++              if (scaled_filename) {
++                      scaled_pixbuf = gdk_pixbuf_new_from_file (scaled_filename, NULL);
++                      g_free (scaled_filename);
++              }
++
++              if (scaled_pixbuf) {
++                      g_object_set_data_full (G_OBJECT (pixbuf),
++                                                "gdk-pixbuf-2x-variant",
++                                                scaled_pixbuf,
++                                                (GDestroyNotify) g_object_unref);
++              }
++      }
++
+         if (pixbuf == NULL && error != NULL && *error == NULL) {
+
+                 /* I don't trust these crufty longjmp()'ing image libs
+--
+1.8.3.rc1
diff --git a/packaging/MacSDK/gtkrc b/packaging/MacSDK/gtkrc
new file mode 100644 (file)
index 0000000..b1168d6
--- /dev/null
@@ -0,0 +1,216 @@
+include "/Library/Frameworks/Mono.framework/Versions/Current/share/themes/Clearlooks/gtk-2.0/gtkrc"
+#gtk-icon-theme-name = "OSX"
+gtk-icon-theme-name = "Tango"
+gtk_color_scheme = "fg_color:#222\nbg_color:#e6e6e6\nbase_color:#f9f9f9\ntext_color:#222\nselected_bg_color:#788ab0\nselected_fg_color:#fff"
+gtk-menu-popup-delay = 1
+gtk-button-images = 0
+gtk-menu-images = 0
+gtk-enable-mnemonics = 0
+
+style "theme-default"
+{
+    GtkButton      ::default_border    = { 0, 0, 0, 0 }
+    GtkRange       ::trough_border     = 0
+    GtkPaned       ::handle_size       = 8
+    GtkRange       ::slider_width      = 15
+    GtkRange       ::stepper_size      = 15
+    GtkScrollbar   ::min_slider_length = 30
+    GtkCheckButton ::indicator_size    = 14
+    GtkMenuBar     ::internal-padding  = 0
+    GtkTreeView    ::expander_size     = 12
+    GtkExpander    ::expander_size     = 14
+
+    xthickness = 2
+    ythickness = 2
+
+    fg[NORMAL]        = @fg_color #"#000000" # black
+    fg[PRELIGHT]      = @fg_color #"#000000" # black
+    fg[SELECTED]      = @selected_fg_color #"#ffffff" # white
+    fg[ACTIVE]        = @fg_color #"#000000" # black
+    fg[INSENSITIVE]   = darker (@bg_color) #"#b5b3ac" # dark beige
+
+    bg[NORMAL]        = @bg_color # "#ede9e3"
+    bg[PRELIGHT]      = shade (1.02, @bg_color) #"#f9f7f3" # very light beige
+    bg[SELECTED]      = @selected_bg_color # "#5598d7" # deepsky
+    bg[INSENSITIVE]   = @bg_color # "#efebe5" # beige
+    bg[ACTIVE]        = shade (0.9, @bg_color) #"#dcd4c9" #"#d7d3ca" # dark beige
+
+    base[NORMAL]      = @base_color # "#ffffff" # white
+    base[PRELIGHT]    = shade (0.95, @bg_color) # "#5f8ec4" # dark beige
+    base[ACTIVE]      = shade (0.9, @selected_bg_color) # "#a69f91" # darker deepsky
+    base[SELECTED]    = @selected_bg_color # "#5598d7" # deepsky
+    base[INSENSITIVE] = @bg_color # "#e8e5de" # beige
+
+    text[NORMAL]      = @text_color # "#000000" # black
+    text[PRELIGHT]    = @text_color # "#000000" # black
+    text[ACTIVE]      = @selected_fg_color # "#ffffff" # white
+    text[SELECTED]    = @selected_fg_color # "#ffffff" # white
+    text[INSENSITIVE] = darker (@bg_color) # "#b5b3ac" # dark beige
+
+    engine "clearlooks"  {
+      style               = GUMMY   # gummy look
+      toolbarstyle        = 0       # flat toolbars
+      animation           = TRUE    # animated progressbars
+      menubarstyle        = 2       # rounded menus
+      colorize_scrollbar  = TRUE    # colored slider
+    }
+
+    font              = "Lucida Grande 14"
+}
+
+style "theme-wide" = "theme-default"
+{
+    xthickness = 3
+    ythickness = 3
+}
+
+style "theme-text" = "theme-default"
+{
+    #base[SELECTED]     = "#fc9747"  # Outline?
+}
+
+style "theme-toolbar" = "theme-default"
+{
+    #top and bottom border
+    bg[NORMAL] = @bg_color
+}
+
+style "theme-scrollbar" = "theme-default"
+{
+    bg[SELECTED] = shade (1.1, @selected_bg_color)
+}
+
+style "theme-tasklist" = "theme-default"
+{
+    xthickness = 5
+    ythickness = 3
+}
+
+style "theme-menu" = "theme-default"
+{
+    xthickness = 3
+    ythickness = 3
+    bg[NORMAL] = shade (1.1,@bg_color)
+}
+
+style "theme-menu-item" = "theme-default"
+{
+    xthickness = 2
+    ythickness = 4
+    fg[PRELIGHT] = @selected_fg_color
+    text[PRELIGHT] = @selected_fg_color
+    base[PRELIGHT] = @selected_bg_color # Selection color
+}
+
+style "theme-menu-itembar" = "theme-default"
+{
+    xthickness = 0
+    ythickness = 0
+}
+
+style "theme-tree" = "theme-default"
+{
+    xthickness = 2
+    ythickness = 2
+    GtkTreeView::odd-row-color = shade(0.9, @base_color)
+    GtkTreeView::even-row-color = @base_color
+}
+
+style "theme-frame-title" = "theme-default"
+{
+    #fg[NORMAL] = "#f00" #button frames
+}
+
+style "theme-tooltips" = "theme-default"
+{
+    xthickness = 4
+    ythickness = 4
+    bg[NORMAL] = { 1.0,1.0,0.75 }
+}
+
+style "theme-progressbar" = "theme-default"
+{
+    xthickness = 1
+    ythickness = 1
+    fg[PRELIGHT]  = @base_color
+}
+
+style "theme-combo" = "theme-default"
+{
+    xthickness = 2
+    ythickness = 4
+}
+
+style "theme-button" = "theme-wide"
+{
+    bg[NORMAL] = @bg_color
+    bg[PRELIGHT] = shade (1.1, @bg_color)
+    bg[ACTIVE] = shade (0.9, @bg_color)
+    #xthickness = 4
+    #ythickness = 2
+}
+
+style "theme-check" = "theme-button"
+{
+}
+
+style "theme-panel" = "theme-default"
+{
+    xthickness = 3
+    ythickness = 3
+    bg[ACTIVE] = shade (1.1, @selected_bg_color)
+    fg[ACTIVE] = @selected_fg_color
+}
+
+style "theme-notebook" = "theme-wide"
+{
+    base[SELECTED]    = @selected_bg_color  # Tab selection color
+    bg[ACTIVE]        = shade(0.9, @bg_color)  # Unselected tabs
+
+#    engine "clearlooks" {
+#        style = CLASSIC
+#    }
+}
+
+# widget styles
+class "GtkWidget" style "theme-default"
+class "GtkButton" style "theme-button"
+class "GtkCombo"  style "theme-button"
+class "GtkRange"  style "theme-wide"
+class "GtkFrame"  style "theme-wide"
+class "GtkMenu"   style "theme-menu"
+class "GtkEntry"  style "theme-button"
+class "GtkMenuItem"    style "theme-menu-item"
+class "GtkStatusbar"   style "theme-wide"
+class "GtkNotebook"    style "theme-notebook"
+class "GtkProgressBar" style "theme-progressbar"
+class "GtkCheckButton" style "theme-check"
+class "GtkRadioButton" style "theme-check"
+class "GtkToolbar" style "theme-toolbar"
+
+widget_class "*MenuItem.*" style "theme-menu-item"
+
+# combobox stuff
+widget_class "*.GtkComboBox.GtkButton" style "theme-combo"
+widget_class "*.GtkCombo.GtkButton"    style "theme-combo"
+
+# tooltips stuff
+widget_class "*.tooltips.*.GtkToggleButton" style "theme-tasklist"
+widget "gtk-tooltips" style "theme-tooltips"
+
+# treeview stuff
+widget "*GtkTreeView*" style "theme-tree"
+widget_class "*.GtkTreeView.GtkButton" style "theme-tree"
+widget_class "*.GtkCTree.GtkButton" style "theme-tree"
+widget_class "*.GtkList.GtkButton" style "theme-tree"
+widget_class "*.GtkCList.GtkButton" style "theme-tree"
+widget_class "*.GtkFrame.GtkLabel" style "theme-frame-title"
+
+# notebook stuff
+widget_class "*.GtkNotebook.*.GtkEventBox" style "theme-notebook"
+widget_class "*.GtkNotebook.*.GtkViewport" style "theme-notebook"
+
+# scrollbar stuff
+class "GtkScrollbar" style "theme-scrollbar"
+
+gtk-font-name = "Lucida Grande 12"
diff --git a/packaging/MacSDK/ironlangs.py b/packaging/MacSDK/ironlangs.py
new file mode 100644 (file)
index 0000000..0d4e336
--- /dev/null
@@ -0,0 +1,66 @@
+import os
+import string
+
+
+class IronLanguagesPackage(GitHubTarballPackage):
+
+    def __init__(self):
+        GitHubTarballPackage.__init__(self,
+                                      'IronLanguages', 'iron-languages',
+                                      '2.11',
+                                      'de63773744ccf9873c1826470730ae0446fd64d7',
+                                      configure='')
+
+        # override: avoid naming the package 'main' because of the repo name
+        self.sources = [
+            'https://github.com/%{organization}/main/tarball/%{revision}']
+        self.source_dir_name = '%s-%s-%s' % (
+            self.organization, 'main', self.revision[:7])
+
+    def build(self):
+        self.ironruby = os.path.join(
+            self.workspace, 'ironruby', 'bin') + os.sep
+        self.ironpython = os.path.join(
+            self.workspace, 'ironpython', 'bin') + os.sep
+        self.sh(
+            'xbuild /p:Configuration=Release /p:OutDir="%{ironruby}" Solutions/Ruby.sln')
+        self.sh(
+            'xbuild /p:Configuration=Release /p:OutDir="%{ironpython}" Solutions/IronPython.Mono.sln')
+
+    def install_ruby_scripts(self, path, installdir):
+        for cmd, ext in map(os.path.splitext, os.listdir(path)):
+            if ext != '.exe':
+                continue
+            wrapper = os.path.join(self.staged_prefix, "bin", cmd)
+            with open(wrapper, "w") as output:
+                output.write("#!/bin/sh\n")
+                output.write(
+                    "exec {0}/bin/mono {0}/lib/{1}/{2}.exe \"$@\"\n".format(
+                        self.staged_prefix, installdir, cmd))
+            os.chmod(wrapper, 0o755)
+
+    def install_python_scripts(self, path, installdir):
+        for cmd, ext in map(os.path.splitext, os.listdir(path)):
+            if ext != '.exe':
+                continue
+            wrapper = os.path.join(self.staged_prefix, "bin", cmd)
+            with open(wrapper, "w") as output:
+                output.write("#!/bin/sh\n")
+                output.write(
+                    'export IRONPYTHONPATH=/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/\n')
+                output.write(
+                    "exec {0}/bin/mono {0}/lib/{1}/{2}.exe \"$@\"\n".format(
+                        self.staged_prefix, installdir, cmd))
+            os.chmod(wrapper, 0o755)
+
+    def install(self):
+        self.sh("mkdir -p %{staged_prefix}/lib/ironruby/")
+        self.sh("mkdir -p %{staged_prefix}/bin/")
+        self.sh("cp -R %{ironruby} %{staged_prefix}/lib/ironruby/")
+        self.install_ruby_scripts(self.ironruby, 'ironruby')
+
+        self.sh("mkdir -p %{staged_prefix}/lib/ironpython/")
+        self.sh("cp -R %{ironpython} %{staged_prefix}/lib/ironpython/")
+        self.install_python_scripts(self.ironpython, 'ironpython')
+
+IronLanguagesPackage()
diff --git a/packaging/MacSDK/libgdiplus.py b/packaging/MacSDK/libgdiplus.py
new file mode 100644 (file)
index 0000000..e40baac
--- /dev/null
@@ -0,0 +1,8 @@
+GitHubTarballPackage(
+    'mono',
+    'libgdiplus',
+    '2.11',
+    '4e7ab0f555a13a6b2f954c714c4ee5213954ff79',
+    configure='CFLAGS="%{gcc_flags} %{local_gcc_flags} -I/opt/X11/include" ./autogen.sh --prefix="%{package_prefix}"',
+    override_properties={
+        'make': 'C_INCLUDE_PATH="" make'})
diff --git a/packaging/MacSDK/mono-basic.py b/packaging/MacSDK/mono-basic.py
new file mode 100644 (file)
index 0000000..ffdbde0
--- /dev/null
@@ -0,0 +1,12 @@
+
+class MonoBasicPackage (GitHubTarballPackage):
+
+    def __init__(self):
+        GitHubTarballPackage.__init__(self, 'mono', 'mono-basic', '4.6', 'c93133db1d511f994918391f429fee29b9250004',
+                                      configure='./configure --prefix="%{staged_profile}"')
+
+    def install(self):
+        self.sh('./configure --prefix="%{staged_prefix}"')
+        self.sh('make install')
+
+MonoBasicPackage()
diff --git a/packaging/MacSDK/mono-llvm.py b/packaging/MacSDK/mono-llvm.py
new file mode 100644 (file)
index 0000000..cf9e89b
--- /dev/null
@@ -0,0 +1,35 @@
+import os
+
+
+class MonoLlvmPackage (GitHubPackage):
+
+    def __init__(self):
+        GitHubPackage.__init__(self, 'mono', 'llvm', '3.0',
+                               revision='8b1520c8aae53e219cf80cdc0f02ad96600887d6',
+                               configure_flags=[
+                                   '--enable-optimized',
+                                   '--enable-assertions=no',
+                                   '--enable-targets="x86,x86_64"']
+                               )
+
+        # This package would like to be lipoed.
+        self.needs_lipo = True
+
+        # TODO: find out which flags are causing issues. reset ld_flags for the
+        # package
+        self.ld_flags = []
+        self.cpp_flags = []
+
+    def arch_build(self, arch):
+        if arch == 'darwin-64':  # 64-bit  build pass
+            self.local_configure_flags = ['--build=x86_64-apple-darwin11.2.0']
+
+        if arch == 'darwin-32':
+            self.local_configure_flags = ['--build=i386-apple-darwin11.2.0']
+
+        # LLVM says that libstdc++4.6 is broken and we should use libstdc++4.7.
+        # This switches it to the right libstdc++.
+        if Package.profile.name == 'darwin':
+            self.local_configure_flags.extend(['--enable-libcpp=yes'])
+
+MonoLlvmPackage()
diff --git a/packaging/MacSDK/mono.py b/packaging/MacSDK/mono.py
new file mode 100644 (file)
index 0000000..8b9f6b3
--- /dev/null
@@ -0,0 +1,99 @@
+import os
+import re
+
+from bockbuild.package import Package
+from bockbuild.util.util import *
+
+
+class MonoMasterPackage(Package):
+
+    def __init__(self):
+        Package.__init__(self, 'mono', None,
+                         sources=[
+                             Package.profile.git_root],
+                         git_branch=os.getenv('MONO_BRANCH') or None,
+                         revision=os.getenv('MONO_BUILD_REVISION'),
+                         configure_flags=[
+                             '--enable-nls=no',
+                             '--with-ikvm=yes'
+                         ]
+                         )
+        self.source_dir_name = 'mono'
+        # This package would like to be lipoed.
+        self.needs_lipo = True
+
+        # Don't clean the workspace, so we can run 'make check' afterwards
+        self.dont_clean = True
+
+        if Package.profile.name == 'darwin':
+            self.configure_flags.extend([
+                '--with-libgdiplus=%s/lib/libgdiplus.dylib' % Package.profile.staged_prefix,
+                '--enable-loadedllvm',
+                'CXXFLAGS=-stdlib=libc++'
+            ])
+
+            self.sources.extend([
+                # Fixes up pkg-config usage on the Mac
+                'patches/mcs-pkgconfig.patch'
+            ])
+        else:
+            self.configure_flags.extend([
+                '--with-libgdiplus=%s/lib/libgdiplus.so' % Package.profile.staged_prefix
+            ])
+
+        self.gcc_flags.extend(['-O2'])
+
+        self.configure = './autogen.sh --prefix="%{package_prefix}"'
+
+        self.extra_stage_files = ['etc/mono/config']
+
+    def build(self):
+        self.make = '%s EXTERNAL_MCS=%s EXTERNAL_RUNTIME=%s' % (
+            self.make, self.profile.env.system_mcs, self.profile.env.system_mono)
+        Package.build(self)
+
+    def prep(self):
+        Package.prep(self)
+        for p in range(1, len(self.local_sources)):
+            self.sh('patch -p1 < "%{local_sources[' + str(p) + ']}"')
+
+    def arch_build(self, arch):
+        if arch == 'darwin-64':  # 64-bit build pass
+            self.local_gcc_flags = ['-m64']
+            self.local_configure_flags = ['--build=x86_64-apple-darwin11.2.0']
+
+        if arch == 'darwin-32':  # 32-bit build pass
+            self.local_gcc_flags = ['-m32']
+            self.local_configure_flags = ['--build=i386-apple-darwin11.2.0']
+
+        self.local_configure_flags.extend(
+            ['--cache-file=%s/%s-%s.cache' % (self.profile.bockbuild.build_root, self.name, arch)])
+
+    def install(self):
+        Package.install(self)
+
+        registry_dir = os.path.join(
+            self.staged_prefix,
+            "etc",
+            "mono",
+            "registry",
+            "LocalMachine")
+        ensure_dir(registry_dir)
+
+        # Add ImportBefore/ImportAfter files from xbuild to the msbuild
+        # directories
+        xbuild_dir = os.path.join(self.staged_prefix, 'lib/mono/xbuild')
+        new_xbuild_tv_dir = os.path.join(xbuild_dir, self.version)
+        os.makedirs(new_xbuild_tv_dir)
+
+        self.sh('cp -R %s/14.0/Imports %s' % (xbuild_dir, new_xbuild_tv_dir))
+        self.sh(
+            'cp -R %s/14.0/Microsoft.Common.targets %s' %
+            (xbuild_dir, new_xbuild_tv_dir))
+
+    def deploy(self):
+        if bockbuild.cmd_options.arch == 'darwin-universal':
+            os.symlink('mono-sgen64', '%s/bin/mono64' % self.staged_profile)
+            os.symlink('mono-sgen32', '%s/bin/mono32' % self.staged_profile)
+
+MonoMasterPackage()
diff --git a/packaging/MacSDK/msbuild.py b/packaging/MacSDK/msbuild.py
new file mode 100644 (file)
index 0000000..0e16af1
--- /dev/null
@@ -0,0 +1,44 @@
+import fileinput
+
+
+class MSBuild (GitHubPackage):
+
+    def __init__(self):
+        GitHubPackage.__init__(self, 'mono', 'msbuild', '15.0',
+                               git_branch='xplat-c8p')
+
+    def build(self):
+        self.sh('./cibuild.sh --scope Compile --target Mono --host Mono')
+
+    def install(self):
+        # adjusted from 'install-mono-prefix.sh'
+
+        build_output = 'bin/Debug-MONO/OSX_Deployment'
+        new_location = os.path.join(
+            self.staged_prefix,
+            'lib/mono/msbuild/%s/bin' %
+            self.version)
+        bindir = os.path.join(self.staged_prefix, 'bin')
+
+        os.makedirs(new_location)
+        self.sh('cp -R %s/* %s' % (build_output, new_location))
+
+        os.makedirs(bindir)
+
+        self.sh('cp msbuild-mono-deploy.in %s/msbuild' % bindir)
+
+        for line in fileinput.input('%s/msbuild' % bindir, inplace=True):
+            line = line.replace('@bindir@', '%s/bin' % self.staged_prefix)
+            line = line.replace(
+                '@mono_instdir@',
+                '%s/lib/mono' %
+                self.staged_prefix)
+            print line
+
+        for excluded in glob.glob("%s/*UnitTests*" % new_location):
+            self.rm(excluded)
+
+        for excluded in glob.glob("%s/*xunit*" % new_location):
+            self.rm(excluded)
+
+MSBuild()
diff --git a/packaging/MacSDK/nuget.py b/packaging/MacSDK/nuget.py
new file mode 100644 (file)
index 0000000..321bedf
--- /dev/null
@@ -0,0 +1,18 @@
+
+class NuGetPackage(GitHubPackage):
+
+    def __init__(self):
+        GitHubPackage.__init__(self,
+                               'mono', 'nuget',
+                               '2.12.0',
+                               '9e2d2c1cc09d2a40eeb72e8c5db789e3b9bf2586',
+                               configure='')
+
+    def build(self):
+        self.sh('%{make} update_submodules')
+        self.sh('%{make} PREFIX=%{package_prefix}')
+
+    def install(self):
+        self.sh('%{makeinstall} PREFIX=%{staged_prefix}')
+
+NuGetPackage()
diff --git a/packaging/MacSDK/packaging/Info.plist b/packaging/MacSDK/packaging/Info.plist
new file mode 100644 (file)
index 0000000..8c3799d
--- /dev/null
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+        <key>CFBundleGetInfoString</key>
+        <string>@@MONO_VERSION_RELEASE@@</string>
+        <key>CFBundleIdentifier</key>
+        <string>com.ximian.mono-@@MONO_VERSION@@</string>
+        <key>CFBundleName</key>
+        <string>Mono.framework</string>
+        <key>CFBundleShortVersionString</key>
+        <string>@@MONO_VERSION@@</string>
+        <key>IFPkgFlagAllowBackRev</key>
+        <true/>
+        <key>IFPkgFlagAuthorizationAction</key>
+        <string>AdminAuthorization</string>
+        <key>IFPkgFlagDefaultLocation</key>
+        <string>/</string>
+        <key>IFPkgFlagInstallFat</key>
+        <false/>
+        <key>IFPkgFlagIsRequired</key>
+        <false/>
+        <key>IFPkgFlagRelocatable</key>
+        <false/>
+        <key>IFPkgFlagRestartAction</key>
+        <string>NoRestart</string>
+        <key>IFPkgFlagRootVolumeOnly</key>
+        <true/>
+        <key>IFPkgFlagUpdateInstalledLanguages</key>
+        <false/>
+        <key>IFPkgFormatVersion</key>
+        <real>0.10000000149011612</real>
+</dict>
+</plist>
diff --git a/packaging/MacSDK/packaging/Info_sdk.plist b/packaging/MacSDK/packaging/Info_sdk.plist
new file mode 100644 (file)
index 0000000..7d75b1a
--- /dev/null
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+        <key>CFBundleGetInfoString</key>
+        <string>@@MONO_VERSION_RELEASE@@</string>
+        <key>CFBundleIdentifier</key>
+        <string>com.ximian.mono-@@MONO_VERSION@@-csdk</string>
+        <key>CFBundleName</key>
+        <string>Mono.framework</string>
+        <key>CFBundleShortVersionString</key>
+        <string>@@MONO_VERSION@@</string>
+        <key>IFPkgFlagAllowBackRev</key>
+        <true/>
+        <key>IFPkgFlagAuthorizationAction</key>
+        <string>AdminAuthorization</string>
+        <key>IFPkgFlagDefaultLocation</key>
+        <string>/</string>
+        <key>IFPkgFlagInstallFat</key>
+        <false/>
+        <key>IFPkgFlagIsRequired</key>
+        <false/>
+        <key>IFPkgFlagRelocatable</key>
+        <false/>
+        <key>IFPkgFlagRestartAction</key>
+        <string>NoRestart</string>
+        <key>IFPkgFlagRootVolumeOnly</key>
+        <true/>
+        <key>IFPkgFlagUpdateInstalledLanguages</key>
+        <false/>
+        <key>IFPkgFormatVersion</key>
+        <real>0.10000000149011612</real>
+</dict>
+</plist>
diff --git a/packaging/MacSDK/packaging/mdk_blacklist.sh b/packaging/MacSDK/packaging/mdk_blacklist.sh
new file mode 100755 (executable)
index 0000000..ab426a7
--- /dev/null
@@ -0,0 +1,135 @@
+#!/bin/bash
+
+if test x$1 = x; then
+   echo usage is cleanup MONODIR
+   exit 1
+fi
+
+MONODIR=$1
+
+cd $MONODIR
+rm -rf lib/gtk-2.0/2.10.0/engines/libcrux-engine.so
+rm -rf lib/gtk-2.0/2.10.0/engines/libglide.so
+rm -rf lib/gtk-2.0/2.10.0/engines/libhcengine.so
+rm -rf lib/gtk-2.0/2.10.0/engines/libindustrial.so
+rm -rf lib/gtk-2.0/2.10.0/engines/libmist.so
+rm -rf lib/gtk-2.0/2.10.0/engines/libpixmap.so
+rm -rf lib/gtk-2.0/2.10.0/engines/libredmond95.so
+rm -rf lib/gtk-2.0/2.10.0/engines/libthinice.so
+rm -rf gtk-2.0/modules/libferret.*
+rm -rf gtk-2.0/modules/libgail.*
+rm -rf share/gtk-2.0/demo/*
+rm -rf share/man/man1/oldmono.1
+rm -rf share/themes/Crux
+rm -rf share/themes/Default
+rm -rf share/themes/Emacs
+rm -rf share/themes/Industrial
+rm -rf share/themes/Mist
+rm -rf share/themes/Raleigh
+rm -rf share/themes/Redmond
+rm -rf share/themes/ThinIce
+rm -rf share/info
+rm -rf share/icons/gnome
+rm -rf share/icons/hicolor
+rm -rf share/gtk-doc
+rm -rf share/gettext/*.class
+rm -rf share/doc
+rm -rf share/emacs
+rm -rf share/strings
+rm -rf share/pixmaps
+rm -rf share/intltool
+rm -rf var/cache/fontconfig
+
+# delete most of the *.a files
+rm -rf lib/cairo/libcairo-trace.a
+rm -rf lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-svg.a
+rm -rf lib/gtk-2.0/2.10.0/engines/libsvg.a
+rm -rf lib/libCompilerDriver.a
+rm -rf lib/libEnhancedDisassembly.a
+rm -rf lib/libLLVMAnalysis.a
+rm -rf lib/libLLVMArchive.a
+rm -rf lib/libLLVMAsmParser.a
+rm -rf lib/libLLVMAsmPrinter.a
+rm -rf lib/libLLVMBitReader.a
+rm -rf lib/libLLVMBitWriter.a
+rm -rf lib/libLLVMCodeGen.a
+rm -rf lib/libLLVMCore.a
+rm -rf lib/libLLVMExecutionEngine.a
+rm -rf lib/libLLVMInstCombine.a
+rm -rf lib/libLLVMInstrumentation.a
+rm -rf lib/libLLVMInterpreter.a
+rm -rf lib/libLLVMJIT.a
+rm -rf lib/libLLVMLinker.a
+rm -rf lib/libLLVMMC.a
+rm -rf lib/libLLVMMCDisassembler.a
+rm -rf lib/libLLVMMCJIT.a
+rm -rf lib/libLLVMMCParser.a
+rm -rf lib/libLLVMObject.a
+rm -rf lib/libLLVMScalarOpts.a
+rm -rf lib/libLLVMSelectionDAG.a
+rm -rf lib/libLLVMSupport.a
+rm -rf lib/libLLVMTarget.a
+rm -rf lib/libLLVMTransformUtils.a
+rm -rf lib/libLLVMX86AsmParser.a
+rm -rf lib/libLLVMX86AsmPrinter.a
+rm -rf lib/libLLVMX86CodeGen.a
+rm -rf lib/libLLVMX86Disassembler.a
+rm -rf lib/libLLVMX86Info.a
+rm -rf lib/libLLVMipa.a
+rm -rf lib/libLLVMipo.a
+rm -rf lib/libLTO.a
+# rm -rf lib/libMonoPosixHelper.a
+# rm -rf lib/libMonoSupportW.a
+rm -rf lib/libUnitTestMain.a
+rm -rf lib/libatksharpglue-2.a
+rm -rf lib/libcairo-gobject.a
+rm -rf lib/libcairo-script-interpreter.a
+rm -rf lib/libcairo.a
+rm -rf lib/libcroco-0.6.a
+rm -rf lib/libexpat.a
+rm -rf lib/libffi.a
+rm -rf lib/libfontconfig.a
+rm -rf lib/libfreetype.a
+rm -rf lib/libgdiplus.a
+rm -rf lib/libgdksharpglue-2.a
+rm -rf lib/libgettextpo.a
+rm -rf lib/libgif.a
+rm -rf lib/libglade-2.0.a
+rm -rf lib/libgladesharpglue-2.a
+rm -rf lib/libglibsharpglue-2.a
+rm -rf lib/libgtksharpglue-2.a
+rm -rf lib/libikvm-native.a
+rm -rf lib/libintl.a
+rm -rf lib/libjpeg.a
+rm -rf lib/liblzma.a
+# rm -rf lib/libmono-2.0.a
+# rm -rf lib/libmono-llvm.a
+# rm -rf lib/libmono-profiler-aot.a
+# rm -rf lib/libmono-profiler-cov.a
+# rm -rf lib/libmono-profiler-iomap.a
+# rm -rf lib/libmono-profiler-log.a
+# rm -rf lib/libmonosgen-2.0.a
+rm -rf lib/libpangosharpglue-2.a
+rm -rf lib/libpixman-1.a
+rm -rf lib/libpng.a
+rm -rf lib/libpng14.a
+rm -rf lib/librsvg-2.a
+rm -rf lib/libsqlite3.a
+rm -rf lib/libtiff.a
+rm -rf lib/libtiffxx.a
+rm -rf lib/libxml2.a
+
+# we don't need any of the llvm executables except llc and opt
+rm -rf bin/bugpoint
+rm -rf bin/lli
+rm -rf bin/llvm-*
+rm -rf bin/macho-dump
+rm -rf bin/ccache
+
+#
+# 14:39 <baulig> the install script needs to be modified not to
+#                install .mdb's for these
+# 14:39 <baulig> System.Windows.dll, System.Xml.Serialization.dll and
+#                everything in Facades
+
+find ./lib/mono/4.5/Facades -name "*.mdb" -delete
diff --git a/packaging/MacSDK/packaging/resources/License.rtf b/packaging/MacSDK/packaging/resources/License.rtf
new file mode 100644 (file)
index 0000000..ab13fe4
--- /dev/null
@@ -0,0 +1,26 @@
+{\rtf1\mac\ansicpg10000\cocoartf102
+{\fonttbl\f0\fswiss\fcharset77 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\margl1440\margr1440\vieww9000\viewh9000\viewkind0
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural
+
+\f0\fs24 \cf0 The software included in the package is licensed under several different agreements.\
+\
+MIT License:\
+\
+http://www.opensource.org/licenses/mit-license.php\
+\
+LGPL:\
+\
+http://www.opensource.org/licenses/lgpl-2.1.php\
+\
+GPL:\
+\
+http://www.opensource.org/licenses/gpl-2.0.php\
+\
+You can develop commercial applications and redistribute the code in this package.
+You only need to obtain a commercial license if you wish to make changes to Mono or
+if you are using Mono as an embedded runtime into your application.\
+\
+Contact contact@xamarin.com if you think you need a license.
+}
diff --git a/packaging/MacSDK/packaging/resources/ReadMe.rtf b/packaging/MacSDK/packaging/resources/ReadMe.rtf
new file mode 100644 (file)
index 0000000..704571f
--- /dev/null
@@ -0,0 +1,41 @@
+{\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf320
+{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\margl1440\margr1440\vieww15940\viewh15760\viewkind0
+\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640
+
+\f0\fs24 \cf0 This README is for
+\b  Mono.framework @@MONO_VERSION_RELEASE@@
+\b0 .\
+\
+This is the Mono Runtime and Development Platform (http://www.mono-project.com/).\
+\
+This package installs Mono and all of its dependencies inside of /Library/Frameworks/Mono.framework.  This behavior is likely to change with a future release so that dependancies will get their own frameworks.\
+\
+The following components are included inside Mono.framework:\
+@@PACKAGES@@\
+\
+Other packages used to build Mono.framework:\
+@@DEP_PACKAGES@@\
+If you want to build native Mac applications with Mono, you can use the MonoMac bindings, an add-on to this product available from http://www.mono-project.com/MonoMac\
+\
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720
+\cf0 \
+\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640
+\cf0 \
+\
+A simple uninstallMono.sh script is included in the disk image.  This is shell script that must be run as root, and it will remove the Mono.framework and the links in /usr/bin.\
+\
+This package was created by the Mono team.  Major contributors to this team include (in alphabetical order): \
+\
+Wade Berrier\
+Adhamh Findlay\
+Miguel de Icaza\
+Urs Muff\
+Geoff Norton\
+Andy Satori\
+\
+Questions or problems related directly to the Mono.framework should be addressed to mono-osx@lists.xamarin.com.\
+\
+Questions about Mono should be directed to an appropriate resource that can be found on http://www.mono-project.com/about. \
+}
\ No newline at end of file
diff --git a/packaging/MacSDK/packaging/resources/Welcome.rtf b/packaging/MacSDK/packaging/resources/Welcome.rtf
new file mode 100644 (file)
index 0000000..200bc99
--- /dev/null
@@ -0,0 +1,12 @@
+{\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf360
+{\fonttbl\f0\fnil\fcharset0 HelveticaNeue;}
+{\colortbl;\red255\green255\blue255;}
+\margl1440\margr1440\vieww9000\viewh9000\viewkind0
+\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural
+
+\f0\fs32 \cf0 Welcome to
+\b Mono.framework @@MONO_VERSION_RELEASE@@
+\b0  for OS X.
+\fs36 \
+\
+}
\ No newline at end of file
diff --git a/packaging/MacSDK/packaging/resources/distribution.xml b/packaging/MacSDK/packaging/resources/distribution.xml
new file mode 100644 (file)
index 0000000..39926f9
--- /dev/null
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8" standalone="no"?>
+<installer-gui-script minSpecVersion="1">
+    <title>Mono Framework</title>
+    <license file="License.rtf" mime-type="application/rtf" />
+    <readme file="ReadMe.rtf" mime-type="application/rtf" />
+    <pkg-ref id="mono">
+        <bundle-version/>
+    </pkg-ref>
+    <choices-outline>
+        <line choice="default">
+            <line choice="mono"/>
+        </line>
+    </choices-outline>
+    <choice id="default"/>
+    <choice id="mono" visible="false">
+        <pkg-ref id="mono"/>
+    </choice>
+    <pkg-ref id="mono">#mono.pkg</pkg-ref>
+</installer-gui-script>
diff --git a/packaging/MacSDK/packaging/resources/postinstall b/packaging/MacSDK/packaging/resources/postinstall
new file mode 100755 (executable)
index 0000000..5ad19ad
--- /dev/null
@@ -0,0 +1,107 @@
+#!/bin/sh -x
+
+FW=/Library/Frameworks/Mono.framework
+FW_CURRENT=${FW}/Versions/Current
+CURRENT=`basename $(readlink ${FW_CURRENT})`
+
+# Remove PCL assemblies that we installed from Mono 3.1.1
+LICENSE="Portable Class Library Reference Assemblies License-07JUN2013.docx"
+if [ -f "$FW/External/xbuild-frameworks/.NETPortable/$LICENSE" ]; then
+    echo "Removing PCL because we're upgrading from 3.1.1" >> /tmp/mono-installation
+    rm -rf $FW/External/xbuild-frameworks/.NETPortable
+fi
+
+# Remove /usr/local/bin/pkg-config if it's a symlink to the Mono-installed one
+PKG_CONFIG_LINK="/usr/local/bin/pkg-config"
+if [ -L $PKG_CONFIG_LINK ]; then
+    location=`readlink $PKG_CONFIG_LINK`
+    case "$location" in
+    *Mono.framework*) rm $PKG_CONFIG_LINK;;
+    esac
+fi
+
+WHITELIST=$(cat "$(dirname "$0")/whitelist.txt")
+MONO_COMMANDS_FILE=/etc/paths.d/mono-commands
+FW_WHITELISTED_COMMANDS=${FW_CURRENT}/Commands
+
+mkdir ${FW_WHITELISTED_COMMANDS}
+mkdir /etc/paths.d
+
+if test -e ${MONO_COMMANDS_FILE}; then
+    rm "${MONO_COMMANDS_FILE}"
+fi
+
+echo "${FW_WHITELISTED_COMMANDS}" >> "${MONO_COMMANDS_FILE}"
+
+if [ -d "${FW}"/Commands ]; then
+    for i in ${WHITELIST}; do
+        if test -e "${FW}/Commands/${i}"; then
+            ln -s "${FW}/Commands/${i}" "${FW_WHITELISTED_COMMANDS}/${i}"
+        fi
+    done;
+else
+    echo "${FW}/Commands does not exist"
+    echo "Can not add command links to $PATH."
+fi
+
+if [ -d ${FW_CURRENT} ]; then
+    cd ${FW_CURRENT}/share/man
+    for i in ${WHITELIST}; do
+        for j in $(ls man*/${i}.*); do
+            if test ! -e "/usr/local/share/man/${j}"; then
+                ln -sf "${FW_CURRENT}/share/man/${j}" "/usr/local/share/man/${j}"
+            fi
+        done
+    done
+
+    cd ${FW_CURRENT}/etc
+    # Make sure we run the files we lay down, and not other stuff installed on the system
+    export PATH=${FW_CURRENT}/bin:$PATH
+    # gtk+ setup
+    gdk-pixbuf-query-loaders --update-cache
+    # pango setup
+    mkdir -p pango
+    pango-querymodules >  pango/pango.modules
+    pango-querymodules --update-cache
+    fc-cache
+
+    cd ${FW_CURRENT}/lib/gtk-2.0/2.10.0
+    gtk-query-immodules-2.0 > immodules.cache
+fi
+
+# Delete older Monos
+#
+# - keep if the major version is different
+# - keep if 'Versions/x.y.z/keep' exists
+# - Keep if it is greater than $CURRENT
+#
+echo "Current:" $CURRENT >> /tmp/mono-installation
+
+pushd ${FW}/Versions
+for i in `ls -d *`; do
+    result=`echo "${i:0:1} == ${CURRENT:0:1}" | bc`
+    if [ $result -ne 1 ]; then
+        echo "keeping" $i "because it has a different major version" >> /tmp/mono-installation
+        continue
+    fi
+
+    if [ -f $i/keep ]; then
+        echo "Keeping" $i "because of keep file" >> /tmp/mono-installation
+        continue
+    fi
+
+    # A magical bit of Perl: http://stackoverflow.com/a/7366753/494990
+    result=$(perl -e '($a,$b)=@ARGV; for ($a,$b) {s/(\d+)/sprintf "%5d", $1/ge}; print $a cmp $b;' $i $CURRENT)
+    if [ $result -ge 0 ]; then
+        echo "Skipping" $i "because $i >= $CURRENT" >> /tmp/mono-installation
+        continue
+
+    else
+        echo "rm -rf" $i >> /tmp/mono-installation
+        rm -rf $i
+    fi
+done
+popd
+
+# Mono framework should be owned by root
+chown -R root:admin ${FW}
diff --git a/packaging/MacSDK/packaging/resources/version.plist b/packaging/MacSDK/packaging/resources/version.plist
new file mode 100644 (file)
index 0000000..df2e67c
--- /dev/null
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+        <key>BuildVersion</key>
+        <string>@@MONO_VERSION_RELEASE@@</string>
+        <key>CFBundleShortVersionString</key>
+        <string>@@MONO_VERSION_RELEASE@@</string>
+        <key>CFBundleVersion</key>
+        <string>@@MONO_VERSION_RELEASE@@</string>
+        <key>ProjectName</key>
+        <string>Mono</string>
+        <key>SourceVersion</key>
+        <string>@@MONO_VERSION_RELEASE@@</string>
+</dict>
+</plist>
diff --git a/packaging/MacSDK/packaging/resources/whitelist.txt b/packaging/MacSDK/packaging/resources/whitelist.txt
new file mode 100644 (file)
index 0000000..7d329a9
--- /dev/null
@@ -0,0 +1,129 @@
+al
+al2
+asp-state
+asp-state2
+asp-state4
+booc
+booi
+booish
+caspol
+ccrewrite
+cccheck
+cert2spc
+certmgr
+chktrust
+ClassInitGenerator
+csharp
+csharp2
+dbsessmgr
+dbsessmgr2
+dbsessmgr4
+disco
+dmcs
+dtd2rng
+dtd2xsd
+fastcgi-mono-server
+fastcgi-mono-server2
+fastcgi-mono-server4
+fsharpc
+fsharpc2
+fsharpi
+fsharpi2
+gacutil
+gacutil2
+gapi2-codegen
+gapi2-fixup
+gapi2-parser
+genxs
+gmcs
+httpcfg
+ikdasm
+ilasm
+installvst
+ipy
+ipy64
+ipyw
+ipyw64
+ir
+ir64
+IronRuby.Tests
+irw
+irw64
+lc
+macpack
+makecert
+mautil
+mconfig
+mcs
+mdassembler
+mdoc
+mdoc-assemble
+mdoc-export-html
+mdoc-export-msxdoc
+mdoc-update
+mdoc-validate
+mdvalidater
+mkbundle
+mod
+mod-mono-server
+mod-mono-server2
+mod-mono-server4
+mono
+mono64
+mono-boehm
+mono-api-info
+mono-api-html
+mono-cil-strip
+mono-configuration-crypto
+monodis
+monodocer
+monodocs2html
+monodocs2slashdoc
+mono-find-provides
+mono-find-requires
+mono-gdb.py
+monograph
+mono-heapviz
+monolinker
+monop
+monop2
+mono-service
+mono-service2
+mono-sgen
+mono-shlib-cop
+mono-symbolicate
+mono-test-install
+mono-xmltool
+mozroots
+mprof-report
+msbuild
+nant
+nuget
+nunit-console
+nunit-console2
+nunit-console4
+pdb2mdb
+pedump
+permview
+peverify
+prj2make
+resgen
+resgen2
+secutil
+setreg
+sgen
+signcode
+sn
+soapsuds
+sqlmetal
+sqlsharp
+svcutil
+vbnc
+vbnc2
+wsdl
+wsdl2
+xbuild
+xsd
+xsp
+xsp2
+xsp4
diff --git a/packaging/MacSDK/packaging/uninstallMono.sh b/packaging/MacSDK/packaging/uninstallMono.sh
new file mode 100755 (executable)
index 0000000..9e88ad1
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh -x
+
+#This script removes Mono from an OS X System.  It must be run as root
+
+rm -r /Library/Frameworks/Mono.framework
+
+# In 10.6+ the receipts are stored here
+rm /var/db/receipts/com.ximian.mono*
+
+for dir in /usr/local/bin; do
+   (cd ${dir};
+    for i in `ls -al | grep /Library/Frameworks/Mono.framework/ | awk '{print $9}'`; do
+      rm ${i}
+    done);
+done
diff --git a/packaging/MacSDK/patches/find-unused-patches.sh b/packaging/MacSDK/patches/find-unused-patches.sh
new file mode 100755 (executable)
index 0000000..b758c97
--- /dev/null
@@ -0,0 +1,3 @@
+#!/bin/sh
+for f in *.patch; do grep $f ../*.py > /dev/null || echo $f; done
+for f in */*.patch; do grep $f ../*.py > /dev/null || echo $f; done
diff --git a/packaging/MacSDK/patches/mcs-pkgconfig.patch b/packaging/MacSDK/patches/mcs-pkgconfig.patch
new file mode 100644 (file)
index 0000000..eeefebc
--- /dev/null
@@ -0,0 +1,23 @@
+diff --git a/scripts/Makefile.am b/scripts/Makefile.am
+index 73b9cea..98b8cfb 100644
+--- a/scripts/Makefile.am
++++ b/scripts/Makefile.am
+@@ -179,7 +179,8 @@ REWRITE_COMMON = sed \
+       -e 's,@''bindir@,$(bindir),g'                           \
+       -e 's,@''plat_bindir@,$(plat_bindir),g'                 \
+       -e 's,@''mono_instdir@,$(mono_instdir),g'               \
+-      -e 's,@''gtkdir@,$(gtkdir),g'
++      -e 's,@''gtkdir@,$(gtkdir),g'                           \
++      -e 's,@''mono_version@,$(VERSION),g'
+
+ REWRITE = $(REWRITE_COMMON) -e 's,@''mono_interp@,$(mono_interp),g'
+ REWRITE_DEBUG = $(REWRITE_COMMON) -e 's,@''mono_interp@,$(mono_interp) --debug,g'
+diff --git a/scripts/mcs.in b/scripts/mcs.in
+index 32498fa..c15087e 100644
+--- a/scripts/mcs.in
++++ b/scripts/mcs.in
+@@ -1,2 +1,4 @@
+ #!/bin/sh
++export PATH=$PATH:/Library/Frameworks/Mono.framework/Versions/@mono_version@/bin
++export PKG_CONFIG_PATH=/Library/Frameworks/Mono.framework/External/pkgconfig:/Library/Frameworks/Mono.framework/Versions/@mono_version@/lib/pkgconfig:/Library/Frameworks/Mono.framework/Versions/@mono_version@/share/pkgconfig:$PKG_CONFIG_PATH
+ exec @bindir@/mono $MONO_OPTIONS @mono_instdir@/2.0/mcs.exe -lib:@mono_instdir@/2.0 -lib:@mono_instdir@/3.5 "$@"
diff --git a/packaging/MacSDK/pcl-reference-assemblies.py b/packaging/MacSDK/pcl-reference-assemblies.py
new file mode 100644 (file)
index 0000000..216e9f7
--- /dev/null
@@ -0,0 +1,57 @@
+import glob
+import os
+import shutil
+
+
+class PCLReferenceAssembliesPackage(Package):
+
+    def __init__(self):
+        Package.__init__(self,
+                         name='PortableReferenceAssemblies',
+                         version='2014-04-14',
+                         sources=['http://xamarin-storage/bot-provisioning/PortableReferenceAssemblies-2014-04-14.zip'])
+
+    def build(self):
+        pass
+
+    # A bunch of shell script written inside python literals ;(
+    def install(self):
+        dest = os.path.join(
+            self.staged_prefix,
+            "lib",
+            "mono",
+            "xbuild-frameworks",
+            ".NETPortable")
+        if not os.path.exists(dest):
+            os.makedirs(dest)
+
+        shutil.rmtree(dest, ignore_errors=True)
+
+        self.sh("rsync -abv -q %s/* %s" % (self.workspace, dest))
+
+        for f in glob.glob("%s/*/Profile/*/SupportedFrameworks" % dest):
+            self.write_xml(f)
+
+    def write_xml(self, directory):
+        # print "Writing iOS/Android/Mac listings for " + directory
+        data = {
+            os.path.join(directory, "MonoTouch.xml"):
+            """<Framework Identifier="MonoTouch" MinimumVersion="1.0" Profile="*" DisplayName="Xamarin.iOS Classic"/>""",
+            os.path.join(directory, "Xamarin.iOS.xml"):
+            """<Framework Identifier="Xamarin.iOS" MinimumVersion="1.0" Profile="*" DisplayName="Xamarin.iOS Unified"/>""",
+            os.path.join(directory, "Xamarin.Android.xml"):
+            """<Framework Identifier="MonoAndroid" MinimumVersion="1.0" Profile="*" DisplayName="Xamarin.Android"/>""",
+            os.path.join(directory, "Xamarin.Mac.xml"):
+            """<Framework Identifier="Xamarin.Mac" MinimumVersion="2.0" Profile="*" DisplayName="Xamarin.Mac Unified"/>""",
+            os.path.join(directory, "Xamarin.TVOS.xml"):
+            """<Framework Identifier="Xamarin.TVOS" MinimumVersion="1.0" Profile="*" DisplayName="Xamarin.TVOS"/>""",
+            os.path.join(directory, "Xamarin.WatchOS.xml"):
+            """<Framework Identifier="Xamarin.WatchOS" MinimumVersion="1.0" Profile="*" DisplayName="Xamarin.WatchOS"/>""",
+        }
+        for filename, content in data.iteritems():
+            f = open(filename, "w")
+            f.write(content + "\n")
+            f.close()
+
+
+PCLReferenceAssembliesPackage()
diff --git a/packaging/MacSDK/profile.py b/packaging/MacSDK/profile.py
new file mode 100755 (executable)
index 0000000..1a7827d
--- /dev/null
@@ -0,0 +1,394 @@
+import itertools
+import os
+import re
+import shutil
+import string
+import sys
+import tempfile
+import subprocess
+import stat
+
+from bockbuild.darwinprofile import DarwinProfile
+from bockbuild.util.util import *
+from glob import glob
+
+class MonoReleaseProfile(DarwinProfile):
+    description = 'The Mono Framework for MacOS'
+    packages = [
+        'gettext',
+        'pkg-config',
+
+        # Base Libraries
+        'libpng',
+        'libjpeg',
+        'libtiff',
+        'libgif',
+        'libxml2',
+        'freetype',
+        'fontconfig',
+        'pixman',
+        'cairo',
+        'libffi',
+        'glib',
+        'pango',
+        'atk',
+        'intltool',
+        'gdk-pixbuf',
+        'gtk+',
+        'libglade',
+        'sqlite',
+        'expat',
+        'ige-mac-integration',
+
+        # Theme
+        'libcroco',
+        'librsvg',
+        'hicolor-icon-theme',
+        'gtk-engines',
+        'murrine',
+        'xamarin-gtk-theme',
+        'gtk-quartz-engine',
+
+        # Mono
+        'mono-llvm',
+        'mono',
+        'msbuild',
+        'pcl-reference-assemblies',
+        'libgdiplus',
+        'xsp',
+        'gtk-sharp',
+        'ironlangs',
+        'fsharp',
+        'mono-basic',
+        'nuget'
+    ]
+
+    def attach (self, bockbuild):
+        self.min_version = 7
+        DarwinProfile.attach (self, bockbuild)
+
+        # quick disk space check (http://stackoverflow.com/questions/787776/)
+        s = os.statvfs(bockbuild.root)
+        free_space = (s.f_bavail * s.f_frsize) / (1024 * 1024 * 1024)  # in GB
+
+        if free_space < 10:
+            error('Low disk space (less than 10GB), aborting')
+
+        # check for XQuartz installation (needed for libgdiplus)
+        if not os.path.exists('/opt/X11/include/X11/Xlib.h'):
+            error(
+                'XQuartz is required to be installed (download from http://xquartz.macosforge.org/) ')
+
+        self.MONO_ROOT = "/Library/Frameworks/Mono.framework"
+        self.BUILD_NUMBER = "0"
+        self.MDK_GUID = "964ebddd-1ffe-47e7-8128-5ce17ffffb05"
+
+        system_mono_dir = '/Library/Frameworks/Mono.framework/Versions/Current'
+        self.env.set('system_mono', os.path.join(
+            system_mono_dir, 'bin', 'mono'))
+        self.env.set('system_mcs', os.path.join(system_mono_dir, 'bin', 'mcs'))
+
+        self.env.set('system_mono_version', backtick(
+            '%s --version' % self.env.system_mono)[0])
+
+        # config overrides for some programs to be functional while staged
+
+        self.env.set('GDK_PIXBUF_MODULE_FILE',
+                     '%{staged_prefix}/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache')
+        self.env.set('GDK_PIXBUF_MODULEDIR',
+                     '%{staged_prefix}/lib/gdk-pixbuf-2.0/2.10.0/loaders')
+        self.env.set('PANGO_SYSCONFDIR', '%{staged_prefix}/etc')
+        self.env.set('PANGO_LIBDIR', '%{staged_prefix}/lib')
+        # self.env.set ('MONO_PATH', '%{staged_prefix}/lib/mono/4.0')
+        self.debug_info = ['gtk+', 'cairo',
+                           'pango', 'mono', 'llvm', 'libgdiplus']
+        self.cache_host = None
+
+    def setup_release(self):
+        self.mono_package = self.release_packages['mono']
+        self.mono_package.fetch()
+
+        verbose('Mono version: %s' % self.mono_package.version)
+        self.RELEASE_VERSION = self.mono_package.version
+        self.prefix = os.path.join(
+            self.MONO_ROOT, "Versions", self.RELEASE_VERSION)
+
+        if os.path.exists(self.prefix):
+            error('Prefix %s exists, and may interfere with the staged build. Please remove and try again.' % self.prefix)
+
+        self.calculate_updateid()
+        trace(self.package_info('MDK'))
+
+        self.dont_optimize = ['pixman']
+
+        for p in self.release_packages.values():
+            if p.name in self.dont_optimize:
+                continue
+            self.gcc_flags.extend(['-O2'])
+
+    # THIS IS THE MAIN METHOD FOR MAKING A PACKAGE
+    def package(self):
+        self.fix_gtksharp_configs()
+        self.verify_binaries()
+
+        working = self.setup_working_dir()
+        uninstall_script = os.path.join(working, "uninstallMono.sh")
+
+        # make the MDK
+        self.apply_blacklist(working, 'mdk_blacklist.sh')
+        self.make_updateinfo(working, self.MDK_GUID)
+        mdk_pkg = self.run_pkgbuild(working, "MDK")
+        title(mdk_pkg)
+        # self.make_dmg(mdk_dmg, title, mdk_pkg, uninstall_script)
+
+        shutil.rmtree(working)
+
+    def calculate_updateid(self):
+        # Create the updateid
+        pwd = os.getcwd()
+        git_bin = self.bockbuild.git_bin
+        trace("cur path is %s and git is %s" % (pwd, git_bin))
+        blame_rev_str = 'cd %s; %s blame configure.ac HEAD | grep AC_INIT | sed \'s/ .*//\' ' % (
+            self.mono_package.workspace, git_bin)
+        blame_rev = backtick(blame_rev_str)[0]
+        trace("Last commit to the version string %s" % (blame_rev))
+        version_number_str = 'cd %s; %s log %s..HEAD --oneline | wc -l | sed \'s/ //g\'' % (
+            self.mono_package.workspace, git_bin, blame_rev)
+        self.BUILD_NUMBER = backtick(version_number_str)[0]
+        trace("Calculating commit distance, %s" % (self.BUILD_NUMBER))
+        self.FULL_VERSION = self.RELEASE_VERSION + "." + self.BUILD_NUMBER
+        os.chdir(pwd)
+
+        parts = self.RELEASE_VERSION.split(".")
+        version_list = (parts + ["0"] * (3 - len(parts)))[:4]
+        for i in range(1, 3):
+            version_list[i] = version_list[i].zfill(2)
+            self.updateid = "".join(version_list)
+            self.updateid += self.BUILD_NUMBER.replace(
+                ".", "").zfill(9 - len(self.updateid))
+        trace(self.updateid)
+
+    # creates and returns the path to a working directory containing:
+    #   PKGROOT/ - this root will be bundled into the .pkg and extracted at /
+    #   uninstallMono.sh - copied onto the DMG
+    #   Info{_sdk}.plist - used by packagemaker to make the installer
+    #   resources/ - other resources used by packagemaker for the installer
+    def setup_working_dir(self):
+        def make_package_symlinks(root):
+            os.symlink(self.prefix, os.path.join(root, "Versions", "Current"))
+            currentlink = os.path.join(self.MONO_ROOT, "Versions", "Current")
+            links = [
+                ("bin", "Commands"),
+                ("include", "Headers"),
+                ("lib", "Libraries"),
+                ("", "Home"),
+                (os.path.join("lib", "libmono-2.0.dylib"), "Mono")
+            ]
+            for srcname, destname in links:
+                src = os.path.join(currentlink, srcname)
+                dest = os.path.join(root, destname)
+                # If the symlink exists, we remove it so we can create a fresh
+                # one
+                if os.path.exists(dest):
+                    os.unlink(dest)
+                os.symlink(src, dest)
+
+        tmpdir = tempfile.mkdtemp()
+        monoroot = os.path.join(tmpdir, "PKGROOT", self.MONO_ROOT[1:])
+        versions = os.path.join(monoroot, "Versions")
+        os.makedirs(versions)
+
+        print "Setting up temporary package directory:", tmpdir
+
+        # setup metadata
+        self.packaging_dir = os.path.join(self.resource_path, "packaging")
+        run_shell('rsync -aPq %s/* %s' % (self.packaging_dir, tmpdir), False)
+
+        packages_list = string.join(
+            [pkg.desc for pkg in self.release_packages.values()], "\\\n")
+        deps_list = 'bockbuild (rev. %s)\\\n' % bockbuild.bockbuild_rev + string.join(
+            [pkg.desc for pkg in self.toolchain_packages.values()], "\\\n")
+
+        parameter_map = {
+            '@@MONO_VERSION@@': self.RELEASE_VERSION,
+            '@@MONO_RELEASE@@': self.BUILD_NUMBER,
+            '@@MONO_VERSION_RELEASE@@': self.RELEASE_VERSION + '_' + self.BUILD_NUMBER,
+            '@@MONO_CSDK_GUID@@': self.MDK_GUID,
+            '@@MONO_VERSION_RELEASE_INT@@': self.updateid,
+            '@@PACKAGES@@': packages_list,
+            '@@DEP_PACKAGES@@': deps_list
+        }
+        for dirpath, d, files in os.walk(tmpdir):
+            for name in files:
+                if not name.startswith('.'):
+                    replace_in_file(os.path.join(dirpath, name), parameter_map)
+
+        make_package_symlinks(monoroot)
+
+        # copy to package root
+        run_shell('rsync -aPq "%s"/* "%s/%s"' %
+                  (bockbuild.package_root, versions, self.RELEASE_VERSION), False)
+
+        return tmpdir
+
+    def apply_blacklist(self, working_dir, blacklist_name):
+        print "Applying blacklist script:", blacklist_name
+        blacklist = os.path.join(self.packaging_dir, blacklist_name)
+        root = os.path.join(working_dir, "PKGROOT", self.prefix[1:])
+        run_shell('%s "%s" > /dev/null' % (blacklist, root), print_cmd=False)
+
+    def run_pkgbuild(self, working_dir, package_type):
+        print 'Running pkgbuild & productbuild...',
+        info = self.package_info(package_type)
+        output = os.path.join(self.resource_path, info["filename"])
+        identifier = "com.xamarin.mono-" + info["type"] + ".pkg"
+        resources_dir = os.path.join(working_dir, "resources")
+        distribution_xml = os.path.join(resources_dir, "distribution.xml")
+
+        old_cwd = os.getcwd()
+        os.chdir(working_dir)
+        pkgbuild = "/usr/bin/pkgbuild"
+        pkgbuild_cmd = ' '.join([pkgbuild,
+                                 "--identifier " + identifier,
+                                 "--root '%s/PKGROOT'" % working_dir,
+                                 "--version '%s'" % self.RELEASE_VERSION,
+                                 "--install-location '/'",
+                                 "--scripts '%s'" % resources_dir,
+                                 "--quiet",
+                                 os.path.join(working_dir, "mono.pkg")])
+
+        run_shell(pkgbuild_cmd)
+
+        productbuild = "/usr/bin/productbuild"
+        productbuild_cmd = ' '.join([productbuild,
+                                     "--resources %s" % resources_dir,
+                                     "--distribution %s" % distribution_xml,
+                                     "--package-path %s" % working_dir,
+                                     "--quiet",
+                                     output])
+
+        run_shell(productbuild_cmd)
+
+        assert_exists(output)
+        os.chdir(old_cwd)
+        print output
+        return output
+
+    def make_updateinfo(self, working_dir, guid):
+        updateinfo = os.path.join(
+            working_dir, "PKGROOT", self.prefix[1:], "updateinfo")
+        with open(updateinfo, "w") as updateinfo:
+            updateinfo.write(guid + ' ' + self.updateid + "\n")
+
+    def package_info(self, pkg_type):
+        arch = self.bockbuild.cmd_options.arch
+        arch_str = None
+        if  arch == "darwin-32":
+            arch_str = "x86"
+        elif arch == "darwin-64":
+            arch_str = "x64"
+        elif arch == "darwin-universal":
+            arch_str = "universal"
+        else:
+            error ("Unknown architecture")
+
+        if self.bockbuild.cmd_options.release_build:
+            info = (pkg_type, self.FULL_VERSION, arch_str)
+        else:
+            info = (pkg_type, '%s-%s' % (git_shortid(self.bockbuild,
+                                                     self.mono_package.workspace), self.FULL_VERSION), arch_str)
+
+        filename = "MonoFramework-%s-%s.macos10.xamarin.%s.pkg" % info
+        return {
+            "type": pkg_type,
+            "filename": filename
+        }
+
+    def fix_line(self, line, matcher):
+        def insert_install_root(matches):
+            root = self.prefix
+            captures = matches.groupdict()
+            return 'target="%s"' % os.path.join(root, "lib", captures["lib"])
+
+        if matcher(line):
+            pattern = r'target="(?P<lib>.+\.dylib)"'
+            result = re.sub(pattern, insert_install_root, line)
+            return result
+        else:
+            return line
+
+    def fix_dllmap(self, config, matcher):
+        handle, temp = tempfile.mkstemp()
+        with open(config) as c:
+            with open(temp, "w") as output:
+                for line in c:
+                    output.write(self.fix_line(line, matcher))
+        os.rename(temp, config)
+        os.system('chmod a+r %s' % config)
+
+    def fix_gtksharp_configs(self):
+        print 'Fixing GTK# configuration files...',
+        count = 0
+        libs = [
+            'atk-sharp',
+            'gdk-sharp',
+            'glade-sharp',
+            'glib-sharp',
+            'gtk-dotnet',
+            'gtk-sharp',
+            'pango-sharp'
+        ]
+        gac = os.path.join(bockbuild.package_root, "lib", "mono", "gac")
+        confs = [glob.glob(os.path.join(gac, x, "*", "*.dll.config")) for x in libs]
+        for c in itertools.chain(*confs):
+            count = count + 1
+            self.fix_dllmap(c, lambda line: "dllmap" in line)
+        print count
+
+    def verify(self, f):
+        result = " ".join(backtick("otool -L " + f))
+        regex = os.path.join(self.MONO_ROOT, "Versions", r"(\d+\.\d+\.\d+)")
+
+        match = re.search(regex, result)
+        if match is None:
+            return
+        token = match.group(1)
+        trace(token)
+        if self.RELEASE_VERSION not in token:
+            raise Exception("%s references Mono %s\n%s" % (f, token, text))
+
+    def verify_binaries(self):
+        bindir = os.path.join(bockbuild.package_root, "bin")
+        for path, dirs, files in os.walk(bindir):
+            for name in files:
+                f = os.path.join(path, name)
+                file_type = backtick('file "%s"' % f)
+                if "Mach-O executable" in "".join(file_type):
+                    self.verify(f)
+
+    def shell(self):
+        envscript = '''#!/bin/sh
+        PROFNAME="%s"
+        INSTALLDIR="%s"
+        ROOT="%s"
+        export DYLD_FALLBACK_LIBRARY_PATH="$INSTALLDIR/lib:/lib:/usr/lib"
+        export ACLOCAL_PATH="$INSTALLDIR/share/aclocal"
+        export CONFIG_SITE="$INSTALLDIR/$PROFNAME-config.site"
+        export MONO_GAC_PREFIX="$INSTALLDIR"
+        export MONO_ADDINS_REGISTRY="$ROOT/addinreg"
+        export MONO_INSTALL_PREFIX="$INSTALLDIR"
+
+        export PS1="\[\e[1;3m\][$PROFNAME] \w @ "
+        bash -i
+        ''' % (self.profile_name, self.staged_prefix, self.root)
+
+        path = os.path.join(self.root, self.profile_name + '.sh')
+
+        with open(path, 'w') as f:
+            f.write(envscript)
+
+        os.chmod(path, os.stat(path).st_mode | stat.S_IEXEC)
+
+        subprocess.call(['bash', '-c', path])
+
+MonoReleaseProfile()
\ No newline at end of file
diff --git a/packaging/MacSDK/sqlite.py b/packaging/MacSDK/sqlite.py
new file mode 100644 (file)
index 0000000..f0f5082
--- /dev/null
@@ -0,0 +1,3 @@
+Package('sqlite-autoconf', '3090200', sources=[
+    'http://www.sqlite.org/2015/%{name}-%{version}.tar.gz'
+])
diff --git a/packaging/MacSDK/xamarin-gtk-theme.py b/packaging/MacSDK/xamarin-gtk-theme.py
new file mode 100644 (file)
index 0000000..34d3ae0
--- /dev/null
@@ -0,0 +1,20 @@
+class XamarinGtkThemePackage (Package):
+
+    def __init__(self):
+        Package.__init__(self, 'xamarin-gtk-theme',
+                         sources=[
+                             'git://github.com/mono/xamarin-gtk-theme.git'],
+                         revision='cc3fb66e56d494e968be3a529a0737a60e31c1f3')
+
+    def build(self):
+        try:
+            self.sh('./autogen.sh --prefix=%{staged_prefix}')
+        except:
+            pass
+        finally:
+            #self.sh ('intltoolize --force --copy --debug')
+            #self.sh ('./configure --prefix="%{package_prefix}"')
+            Package.build(self)
+
+
+XamarinGtkThemePackage()
diff --git a/packaging/MacSDK/xsp.py b/packaging/MacSDK/xsp.py
new file mode 100644 (file)
index 0000000..8180001
--- /dev/null
@@ -0,0 +1,23 @@
+class XspPackage (GitHubTarballPackage):
+
+    def __init__(self):
+        GitHubTarballPackage.__init__(self, 'mono', 'xsp', '4.4',
+                                      'c98e068f5647fb06ff2fbef7cd5f1b35417362b1',
+                                      configure='./autogen.sh --prefix="%{package_prefix}"')
+
+    def install(self):
+        # scoop up some mislocated files
+        misdir = '%s%s' % (self.stage_root, self.staged_profile)
+        unprotect_dir(self.stage_root)
+        Package.install(self)
+        if not os.path.exists(misdir):
+            for path in iterate_dir(self.stage_root):
+                print path
+            error('Could not find mislocated files')
+
+        self.sh('rsync -a --ignore-existing %s/* %s' %
+                (misdir, self.profile.staged_prefix))
+        self.sh('rm -rf %s/*' % misdir)
+
+
+XspPackage()
diff --git a/packaging/MacSDKRelease/mono-extensions.py b/packaging/MacSDKRelease/mono-extensions.py
new file mode 100644 (file)
index 0000000..2d52fda
--- /dev/null
@@ -0,0 +1,25 @@
+from bockbuild.package import Package
+
+
+class MonoExtensionsPackage(Package):
+
+    def __init__(self):
+        Package.__init__(self, 'mono-extensions', None,
+                         sources=['git@github.com:xamarin/mono-extensions.git'],
+                         git_branch=self.profile.release_packages[
+                             'mono'].git_branch
+                         )
+        self.source_dir_name = 'mono-extensions'
+
+        # Mono pull requests won't have mono-extensions branches
+        if not self.git_branch or 'pull/' in self.git_branch:
+            warn('Using master branch for mono_extensions')
+            self.git_branch = 'master'
+
+    def build(self):
+        pass
+
+    def install(self):
+        pass
+
+MonoExtensionsPackage()
diff --git a/packaging/MacSDKRelease/packaging b/packaging/MacSDKRelease/packaging
new file mode 120000 (symlink)
index 0000000..714bc29
--- /dev/null
@@ -0,0 +1 @@
+../MacSDK/packaging
\ No newline at end of file
diff --git a/packaging/MacSDKRelease/profile.py b/packaging/MacSDKRelease/profile.py
new file mode 100755 (executable)
index 0000000..2b0d99a
--- /dev/null
@@ -0,0 +1,89 @@
+import itertools
+import os
+import re
+import shutil
+import string
+import sys
+import tempfile
+import traceback
+
+from glob import glob
+
+from MacSDK import profile
+from bockbuild.util.util import *
+
+
+class MonoXamarinPackageProfile(MonoReleaseProfile):
+    description = 'The Mono Framework for MacOS (official release)'
+
+    def setup (self):
+        MonoReleaseProfile.setup (self)
+        bockbuild.packages_to_build.extend(['mono-extensions'])
+        if bockbuild.cmd_options.release_build:
+            self.setup_codesign()
+        else:
+            info("'--release' option not set, will not attempt to sign package!")
+
+        self.cache_host = 'http://xamarin-storage/bockbuild_cache/'
+
+    def setup_codesign(self):
+        self.identity = "Developer ID Installer: Xamarin Inc"
+
+        output = backtick("security -v find-identity")
+        if self.identity not in " ".join(output):
+            error("Identity '%s' was not found. You can create an unsigned package by removing '--release' to your command line." % self.identity)
+
+        password = os.getenv("CODESIGN_KEYCHAIN_PASSWORD")
+        if password:
+            print "Unlocking the keychain"
+            run_shell("security unlock-keychain -p %s" % password)
+        else:
+            error("CODESIGN_KEYCHAIN_PASSWORD needs to be defined.")
+
+    def setup_release(self):
+        MonoReleaseProfile.setup_release(self)
+        self.release_packages['mono'].configure_flags.extend(
+            ['--enable-extension-module=xamarin --enable-native-types --enable-pecrypt'])
+        info('Xamarin extensions enabled')
+
+    def run_pkgbuild(self, working_dir, package_type):
+        output = MonoReleaseProfile.run_pkgbuild(
+            self, working_dir, package_type)
+
+        output_unsigned = os.path.join(os.path.dirname(
+            output), os.path.basename(output).replace('.pkg', '.UNSIGNED.pkg'))
+        shutil.move(output, output_unsigned)
+
+        if not bockbuild.cmd_options.release_build:
+            return output_unsigned
+
+        productsign = "/usr/bin/productsign"
+        productsign_cmd = ' '.join([productsign,
+                                    "-s '%s'" % self.identity,
+                                    "'%s'" % output_unsigned,
+                                    "'%s'" % output])
+        run_shell(productsign_cmd)
+        os.remove(output_unsigned)
+        self.verify_codesign(output)
+
+        return output
+
+    def verify_codesign(self, pkg):
+        oldcwd = os.getcwd()
+        try:
+            name = os.path.basename(pkg)
+            pkgdir = os.path.dirname(pkg)
+            os.chdir(pkgdir)
+            spctl = "/usr/sbin/spctl"
+            spctl_cmd = ' '.join(
+                [spctl, "-vvv", "--assess", "--type install", name, "2>&1"])
+            output = backtick(spctl_cmd)
+
+            if "accepted" in " ".join(output):
+                warn("%s IS SIGNED" % pkg)
+            else:
+                error("%s IS NOT SIGNED:" % pkg)
+        finally:
+            os.chdir(oldcwd)
+
+MonoXamarinPackageProfile()
\ No newline at end of file
index 068bb1d3dc0269bc87633813b76bae786ca0ac63..9ca318346557b586ab6b35914619cfa8fbe249dc 100644 (file)
@@ -165,10 +165,13 @@ CLEANFILES = etc/mono/config
 etc/mono/config: ../data/config Makefile $(symlinks)
        d=`cd ../support && pwd`; \
        sed 's,target="$$mono_libdir/libMonoPosixHelper$(libsuffix)",target="'$$d'/libMonoPosixHelper.la",' ../data/config > $@t
+       d=`cd ../mono/btls/build-shared && pwd`; \
+       sed 's,target="$$mono_libdir/libmono-btls-shared$(libsuffix)",target="'$$d'/libmono-btls-shared$(libsuffix)",' $@t > $@tt
        if test -z "$(libgdiplus_loc)"; then :; else \
-         sed 's,target="$(libgdiplus_install_loc)",target="$(libgdiplus_loc)",' $@t > $@tt; \
-         mv -f $@tt $@t; fi
-       mv -f $@t $@
+         sed 's,target="$(libgdiplus_install_loc)",target="$(libgdiplus_loc)",' $@tt > $@ttt; \
+         mv -f $@ttt $@tt; fi
+       mv -f $@tt $@
+       rm -f $@t
 
 $(tmpinst)/bin/mono: mono-wrapper etc/mono/config
        $(mkinstalldirs) $(tmpinst)/bin
index a036cf1f8dbc283329b0c3c07ec21baf97d9f750..a22d2a91ff418265354bc59c8043ba1a16403891 100644 (file)
@@ -2,6 +2,7 @@
 /al
 /al1
 /al2
+/btls-cert-sync
 /caspol
 /cert-sync
 /cert2spc
index fa2d8378bbf8dc85dcc279bf8c1a0cadf5e9790b..39595455dadf28dc64a1a5e957b13143d0b365b0 100644 (file)
@@ -34,8 +34,9 @@ bin_SCRIPTS = \
        $(MDOC_SUBCOMMANDS)     \
        $(MDOC_COMPAT)          \
        mono-test-install       \
-       peverify                        \
-       mcs                                     \
+       peverify                \
+       mcs                     \
+       mono-package-runtime    \
        mono-heapviz            \
        $(scripts_mono_configuration_crypto)
 
@@ -72,6 +73,7 @@ scripts_4_0 = \
        prj2make$(SCRIPT_SUFFIX)                \
        soapsuds$(SCRIPT_SUFFIX)                \
        caspol$(SCRIPT_SUFFIX)                  \
+       btls-cert-sync$(SCRIPT_SUFFIX)          \
        cert-sync$(SCRIPT_SUFFIX)               \
        cert2spc$(SCRIPT_SUFFIX)                \
        certmgr$(SCRIPT_SUFFIX)                 \
@@ -156,6 +158,7 @@ EXTRA_DIST =                        \
        update_submodules               \
        mcs.in                          \
        dmcs.in                         \
+       mono-package-runtime    \
        mono-test-install       \
        mono-heapviz            \
        $(MDOC_COMPAT)          \
index b202c2493fb11fac4ff3acf6dce92f6ecb56e979..fab38f5bd4ecfc856a81fd88627fc08b8db552c9 100755 (executable)
@@ -10,7 +10,10 @@ else
     export CFLAGS="-ggdb3 -O2"
 fi
 
-if [[ ${CI_TAGS} == *'coop-gc'* ]]; then EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --with-cooperative-gc=yes"; export MONO_CHECK_MODE=gc,thread; fi
+if [[ ${CI_TAGS} == *'coop-gc'* ]]; then EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --with-cooperative-gc=yes"; fi
+
+if [[ ${CI_TAGS} == *'checked-coop'* ]]; then EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --enable-checked-build=gc,thread"; export MONO_CHECK_MODE=gc,thread; fi
+if [[ ${CI_TAGS} == *'checked-all'* ]]; then EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --enable-checked-build=all"; export MONO_CHECK_MODE=all; fi
 
 if [[ ${label} == 'osx-i386' ]]; then EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --with-libgdiplus=/Library/Frameworks/Mono.framework/Versions/Current/lib/libgdiplus.dylib --build=i386-apple-darwin11.2.0"; fi
 if [[ ${label} == 'osx-amd64' ]]; then EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --with-libgdiplus=/Library/Frameworks/Mono.framework/Versions/Current/lib/libgdiplus.dylib "; fi
@@ -23,7 +26,7 @@ if [[ ${CI_TAGS} == *'mobile_static'* ]];
 elif [[ ${CI_TAGS} == *'acceptance-tests'* ]];
     then
     EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --prefix=${WORKSPACE}/tmp/mono-acceptance-tests --with-sgen-default-concurrent=yes";
-elif [[ ${label} != w* ]] && [[ ${label} != 'debian-ppc64el' ]] && [[ ${label} != 'centos-s390x' ]] && [[ ${CI_TAGS} != *'monolite'* ]];
+elif [[ ${label} != w* ]] && [[ ${label} != 'debian-8-ppc64el' ]] && [[ ${label} != 'centos-s390x' ]] && [[ ${CI_TAGS} != *'monolite'* ]];
     then
     # Override the defaults to skip profiles
     # only enable the mobile profiles and mobile_static on the main architectures
@@ -35,6 +38,8 @@ if [ -x "/usr/bin/dpkg-architecture" ];
        then
        EXTRA_CONF_FLAGS="$EXTRA_CONF_FLAGS --host=`/usr/bin/dpkg-architecture -qDEB_HOST_GNU_TYPE`"
        #force build arch = dpkg arch, sometimes misdetected
+       mkdir -p ~/.config/.mono/
+       wget -qO- https://download.mono-project.com/test/new-certs.tgz| tar zx -C ~/.config/.mono/
 fi
 
 
@@ -51,14 +56,20 @@ fi
 
 if [[ ${CI_TAGS} == *'monolite'* ]]; then make get-monolite-latest; fi
 
-${TESTCMD} --label=make --timeout=300m --fatal make -j4 -w V=1
-if [[ -n "${ghprbPullId}" ]] && [[ ${label} == w* ]];
-    then
-    exit 0
-    # we don't run the test suite on Windows PRs, we just ensure the build succeeds, so end here
-fi
+make_parallelism=-j4
+if [[ ${label} == 'debian-8-ppc64el' ]]; then make_parallelism=-j1; fi
+
+${TESTCMD} --label=make --timeout=300m --fatal make ${make_parallelism} -w V=1
 
 if [[ ${CI_TAGS} == *'acceptance-tests'* ]];
-then $(dirname "${BASH_SOURCE[0]}")/run-test-acceptance-tests.sh
-else make check-ci
-fi
\ No newline at end of file
+    then
+       $(dirname "${BASH_SOURCE[0]}")/run-test-acceptance-tests.sh
+elif [[ ${CI_TAGS} == *'profiler-stress-tests'* ]];
+    then
+       $(dirname "${BASH_SOURCE[0]}")/run-test-profiler-stress-tests.sh
+elif [[ ${CI_TAGS} == *'no-tests'* ]];
+    then
+       exit 0
+else
+       make check-ci
+fi
index bffda6b73f7191f1673b4e3123ca9c18b95589ea..e898c70e620249050e923ca0175236f7f4703061 100755 (executable)
@@ -3,32 +3,39 @@
 export TESTCMD=`dirname "${BASH_SOURCE[0]}"`/run-step.sh
 
 ${TESTCMD} --label=mini --timeout=5m make -w -C mono/mini -k check check-seq-points EMIT_NUNIT=1
-${TESTCMD} --label=runtime --timeout=160m make -w -C mono/tests -k test-wrench V=1 CI=1
-${TESTCMD} --label=corlib --timeout=30m make -w -C mcs/class/corlib run-test
+${TESTCMD} --label=compile-runtime-tests --timeout=20m make -w -C mono/tests -j4 tests
+${TESTCMD} --label=runtime --timeout=160m make -w -C mono/tests -k test-wrench V=1 CI=1 CI_PR=${ghprbPullId}
+${TESTCMD} --label=runtime-unit-tests --timeout=5m make -w -C mono/unit-tests -k check
+if [[ ${label} == 'debian-8-ppc64el' ]]; then ${TESTCMD} --label=corlib --skip; else ${TESTCMD} --label=corlib --timeout=30m make -w -C mcs/class/corlib run-test; fi
 ${TESTCMD} --label=verify --timeout=15m make -w -C runtime mcs-compileall
 ${TESTCMD} --label=profiler --timeout=30m make -w -C mono/profiler -k check
 ${TESTCMD} --label=compiler --timeout=30m make -w -C mcs/tests run-test
 ${TESTCMD} --label=compiler-errors --timeout=30m make -w -C mcs/errors run-test
-${TESTCMD} --label=System --timeout=10m make -w -C mcs/class/System run-test
-${TESTCMD} --label=System.XML --timeout=5m make -w -C mcs/class/System.XML run-test
+${TESTCMD} --label=System --timeout=10m bash -c "export MONO_TLS_PROVIDER=legacy && make -w -C mcs/class/System run-test"
+if [[ ${label} == osx-* ]]; then ${TESTCMD} --label=System-btls --timeout=10m bash -c "export MONO_TLS_PROVIDER=btls && make -w -C mcs/class/System run-test"; fi
+if [[ ${label} == 'debian-8-ppc64el' ]]; then ${TESTCMD} --label=System.XML --skip; else ${TESTCMD} --label=System.XML --timeout=5m make -w -C mcs/class/System.XML run-test; fi
 ${TESTCMD} --label=Mono.Security --timeout=5m make -w -C mcs/class/Mono.Security run-test
-${TESTCMD} --label=System.Security --timeout=5m make -w -C mcs/class/System.Security run-test;
-${TESTCMD} --label=System.Drawing --timeout=5m make -w -C mcs/class/System.Drawing run-test
-if [[ ${label} == osx-* ]]
+${TESTCMD} --label=System.Security --timeout=5m make -w -C mcs/class/System.Security run-test
+if [[ ${label} == w* ]]
+then ${TESTCMD} --label=System.Drawing --skip;
+else ${TESTCMD} --label=System.Drawing --timeout=5m make -w -C mcs/class/System.Drawing run-test
+fi
+if [[ ${label} == osx-* ]] || [[ ${label} == w* ]]
 then ${TESTCMD} --label=Windows.Forms --skip;
 else ${TESTCMD} --label=Windows.Forms --timeout=5m make -w -C mcs/class/System.Windows.Forms run-test
 fi
 ${TESTCMD} --label=System.Data --timeout=5m make -w -C mcs/class/System.Data run-test
+if [[ ${label} == w* ]]; then ${TESTCMD} --label=Mono.Data.Sqlite --skip; else ${TESTCMD} --label=Mono.Data.Sqlite --timeout=5m make -w -C mcs/class/Mono.Data.Sqlite run-test; fi
 ${TESTCMD} --label=System.Data.OracleClient --timeout=5m make -w -C mcs/class/System.Data.OracleClient run-test;
 ${TESTCMD} --label=System.Design --timeout=5m make -w -C mcs/class/System.Design run-test;
 ${TESTCMD} --label=Mono.Posix --timeout=5m make -w -C mcs/class/Mono.Posix run-test
 ${TESTCMD} --label=System.Web --timeout=30m make -w -C mcs/class/System.Web run-test
 ${TESTCMD} --label=System.Web.Services --timeout=5m make -w -C mcs/class/System.Web.Services run-test
 ${TESTCMD} --label=System.Runtime.SFS --timeout=5m make -w -C mcs/class/System.Runtime.Serialization.Formatters.Soap run-test;
-${TESTCMD} --label=System.Runtime.Remoting --timeout=5m make -w -C mcs/class/System.Runtime.Remoting run-test;
+${TESTCMD} --label=System.Runtime.Remoting --timeout=5m make -w -C mcs/class/System.Runtime.Remoting run-test
 ${TESTCMD} --label=Cscompmgd --timeout=5m make -w -C mcs/class/Cscompmgd run-test;
 ${TESTCMD} --label=Commons.Xml.Relaxng --timeout=5m make -w -C mcs/class/Commons.Xml.Relaxng run-test;
-${TESTCMD} --label=System.ServiceProcess --timeout=5m make -w -C mcs/class/System.ServiceProcess run-test;
+${TESTCMD} --label=System.ServiceProcess --timeout=5m make -w -C mcs/class/System.ServiceProcess run-test
 ${TESTCMD} --label=I18N.CJK --timeout=5m make -w -C mcs/class/I18N/CJK run-test
 ${TESTCMD} --label=I18N.West --timeout=5m make -w -C mcs/class/I18N/West run-test
 ${TESTCMD} --label=I18N.MidEast --timeout=5m make -w -C mcs/class/I18N/MidEast run-test
@@ -43,7 +50,7 @@ ${TESTCMD} --label=System.Configuration --timeout=5m make -w -C mcs/class/System
 ${TESTCMD} --label=System.Transactions --timeout=5m make -w -C mcs/class/System.Transactions run-test
 ${TESTCMD} --label=System.Web.Extensions --timeout=5m make -w -C mcs/class/System.Web.Extensions run-test
 ${TESTCMD} --label=System.Core --timeout=15m make -w -C mcs/class/System.Core run-test
-${TESTCMD} --label=symbolicate --timeout=60m make -w -C mcs/tools/mono-symbolicate check
+if [[ -n "${ghprbPullId}" && ${label} == w* || ${label} == 'debian-8-ppc64el' ]]; then ${TESTCMD} --label=symbolicate --skip; else ${TESTCMD} --label=symbolicate --timeout=60m make -w -C mcs/tools/mono-symbolicate check; fi
 ${TESTCMD} --label=System.Xml.Linq --timeout=5m make -w -C mcs/class/System.Xml.Linq run-test
 ${TESTCMD} --label=System.Data.DSE --timeout=5m make -w -C mcs/class/System.Data.DataSetExtensions run-test
 ${TESTCMD} --label=System.Web.Abstractions --timeout=5m make -w -C mcs/class/System.Web.Abstractions run-test
@@ -67,7 +74,7 @@ ${TESTCMD} --label=System.Xaml --timeout=5m make -w -C mcs/class/System.Xaml run
 ${TESTCMD} --label=System.Net.Http --timeout=5m make -w -C mcs/class/System.Net.Http run-test
 ${TESTCMD} --label=System.Json --timeout=5m make -w -C mcs/class/System.Json run-test
 ${TESTCMD} --label=System.Threading.Tasks.Dataflow --timeout=5m make -w -C mcs/class/System.Threading.Tasks.Dataflow run-test
-${TESTCMD} --label=Mono.Debugger.Soft --timeout=5m make -w -C mcs/class/Mono.Debugger.Soft run-test
+if [[ ${label} == 'debian-8-ppc64el' ]]; then ${TESTCMD} --label=Mono.Debugger.Soft --skip; else ${TESTCMD} --label=Mono.Debugger.Soft --timeout=5m make -w -C mcs/class/Mono.Debugger.Soft run-test; fi
 ${TESTCMD} --label=Microsoft.Build --timeout=5m make -w -C mcs/class/Microsoft.Build run-test
 ${TESTCMD} --label=monodoc --timeout=10m make -w -C mcs/tools/mdoc run-test
 ${TESTCMD} --label=Microsoft.Build-12 --timeout=10m make -w -C mcs/class/Microsoft.Build run-test PROFILE=xbuild_12
@@ -80,6 +87,7 @@ ${TESTCMD} --label=Microsoft.Build.Engine-14 --timeout=60m make -w -C mcs/class/
 ${TESTCMD} --label=Microsoft.Build.Framework-14 --timeout=60m make -w -C mcs/class/Microsoft.Build.Framework run-test PROFILE=xbuild_14
 ${TESTCMD} --label=Microsoft.Build.Tasks-14 --timeout=60m make -w -C mcs/class/Microsoft.Build.Tasks run-test PROFILE=xbuild_14
 ${TESTCMD} --label=Microsoft.Build.Utilities-14 --timeout=60m make -w -C mcs/class/Microsoft.Build.Utilities run-test PROFILE=xbuild_14
+${TESTCMD} --label=System.IO.Compression --timeout=5m make -w -C mcs/class/System.IO.Compression run-test
 if [[ ${label} == osx-* ]]
 then ${TESTCMD} --label=ms-test-suite --timeout=15m make -w -C acceptance-tests check-ms-test-suite
 else ${TESTCMD} --label=ms-test-suite --skip;
diff --git a/scripts/ci/run-test-profiler-stress-tests.sh b/scripts/ci/run-test-profiler-stress-tests.sh
new file mode 100755 (executable)
index 0000000..05f5015
--- /dev/null
@@ -0,0 +1,5 @@
+#!/bin/bash -e
+
+export TESTCMD=`dirname "${BASH_SOURCE[0]}"`/run-step.sh
+
+${TESTCMD} --label=check-profiler-stress --timeout=24h make -C acceptance-tests check-profiler-stress
diff --git a/scripts/mono-package-runtime b/scripts/mono-package-runtime
new file mode 100755 (executable)
index 0000000..d71942b
--- /dev/null
@@ -0,0 +1,36 @@
+#!/bin/sh
+
+if test x$2 = x; then
+   echo usage is: mono-package-runtime MONO_INSTALL_PREFIX LABEL
+   echo The file will be created in the current directory
+   exit 1
+fi
+
+prefix=$1
+output=$2
+if test ! -d $prefix; then
+   echo the specified path is not a directory: $prefix
+   exit 1
+fi
+
+if test -e $output.zip; then
+   echo The output file already exists, refusing to overwrite: $output.zip
+   exit 1
+fi
+
+if test ! -e $prefix/bin/mono; then
+   echo The $prefix does not contains a bin/mono
+   exit 1
+fi
+
+if test ! -d $prefix/lib/mono/4.5; then
+   echo The $prefix does not contains a lib/mono/4.5
+   exit 1
+fi
+
+o=`pwd`/$output
+
+cd $prefix
+(zip -u $o.zip bin/mono lib/mono/4.5/mscorlib.dll lib/mono/4.5/System*dll lib/mono/4.5/Mono.CSharp.dll lib/mono/4.5/Microsoft*dll lib/mono/4.5/FSharp*.dll lib/mono/4.5/I18N*dll lib/mono/4.5/Accessibility.dll lib/mono/4.5/RabbitMQ.Client.dll lib/mono/4.5/ICSharpCode.SharpZipLib.dll lib/mono/4.5/CustomMarshalers.dll etc/mono/config etc/mono/4.5/machine.config etc/mono/4.5/web.config lib/mono/4.5/Mono.Cairo.dll lib/mono/4.5/Mono.Data.Sqlite.dll lib/mono/4.5/Mono.Posix.dll lib/mono/4.5/Mono.Security.*dll lib/mono/4.5/Mono.Simd.dll)
+echo Created file $o.zip
+
index 74c2fdf5648bd0613f87d8cb93b41431e1481e2d..b066d462b167c0a3121486d462612e3e050fb171 100644 (file)
 
 G_BEGIN_DECLS
 
+int
+Mono_Posix_Stdlib_GetLastError (void)
+{
+       return errno;
+}
+
 void
 Mono_Posix_Stdlib_SetLastError (int error_number)
 {
index 92fca755371d09ab6336dd25c5c131d014c47d7d..615584889dfa5c4e7b8659d43b9dcc638481648c 100644 (file)
@@ -4716,52 +4716,36 @@ int Mono_Posix_ToPosixMadviseAdvice (int x, int *r)
 int Mono_Posix_FromSeekFlags (short x, short *r)
 {
        *r = 0;
-       if (x == Mono_Posix_SeekFlags_L_INCR)
 #ifdef L_INCR
+       if (x == Mono_Posix_SeekFlags_L_INCR)
                {*r = L_INCR; return 0;}
-#else /* def L_INCR */
-               {errno = EINVAL; return -1;}
-#endif /* ndef L_INCR */
-       if (x == Mono_Posix_SeekFlags_L_SET)
+#endif /* def L_INCR */
 #ifdef L_SET
+       if (x == Mono_Posix_SeekFlags_L_SET)
                {*r = L_SET; return 0;}
-#else /* def L_SET */
-               {errno = EINVAL; return -1;}
-#endif /* ndef L_SET */
-       if (x == Mono_Posix_SeekFlags_L_XTND)
+#endif /* def L_SET */
 #ifdef L_XTND
+       if (x == Mono_Posix_SeekFlags_L_XTND)
                {*r = L_XTND; return 0;}
-#else /* def L_XTND */
-               {errno = EINVAL; return -1;}
-#endif /* ndef L_XTND */
-       if (x == Mono_Posix_SeekFlags_SEEK_CUR)
+#endif /* def L_XTND */
 #ifdef SEEK_CUR
+       if (x == Mono_Posix_SeekFlags_SEEK_CUR)
                {*r = SEEK_CUR; return 0;}
-#else /* def SEEK_CUR */
-               {errno = EINVAL; return -1;}
-#endif /* ndef SEEK_CUR */
-       if (x == Mono_Posix_SeekFlags_SEEK_END)
+#endif /* def SEEK_CUR */
 #ifdef SEEK_END
+       if (x == Mono_Posix_SeekFlags_SEEK_END)
                {*r = SEEK_END; return 0;}
-#else /* def SEEK_END */
-               {errno = EINVAL; return -1;}
-#endif /* ndef SEEK_END */
-       if (x == Mono_Posix_SeekFlags_SEEK_SET)
+#endif /* def SEEK_END */
 #ifdef SEEK_SET
+       if (x == Mono_Posix_SeekFlags_SEEK_SET)
                {*r = SEEK_SET; return 0;}
-#else /* def SEEK_SET */
-               {errno = EINVAL; return -1;}
-#endif /* ndef SEEK_SET */
-       if (x == 0)
-               return 0;
+#endif /* def SEEK_SET */
        errno = EINVAL; return -1;
 }
 
 int Mono_Posix_ToSeekFlags (short x, short *r)
 {
        *r = 0;
-       if (x == 0)
-               return 0;
 #ifdef L_INCR
        if (x == L_INCR)
                {*r = Mono_Posix_SeekFlags_L_INCR; return 0;}
index ccd221b106a219d161e744e9e6f42828089f7130..cf6213c8c56f9e1b8f31cc5f2ca735390312e88d 100644 (file)
@@ -2181,10 +2181,25 @@ int Mono_Posix_Stdlib_MB_CUR_MAX (void);
 int Mono_Posix_Stdlib_perror (const char* s, int err);
 int Mono_Posix_Stdlib_RAND_MAX (void);
 void* Mono_Posix_Stdlib_realloc (void* ptr, guint64 size);
+void Mono_Posix_Stdlib_free (void* p);
 int Mono_Posix_Stdlib_rewind (void* stream);
 int Mono_Posix_Stdlib_setbuf (void* stream, void* buf);
+int Mono_Posix_Stdlib_GetLastError (void);
 void Mono_Posix_Stdlib_SetLastError (int error);
 int Mono_Posix_Stdlib_setvbuf (void* stream, void* buf, int mode, guint64 size);
+void* Mono_Posix_Stdlib_fopen (char* path, char* mode);
+void* Mono_Posix_Stdlib_freopen (char* path, char* mode, void *stream);
+gint32 Mono_Posix_Stdlib_fprintf (void* stream, char* format, char *message);
+gint32 Mono_Posix_Stdlib_fgetc (void* stream);
+char* Mono_Posix_Stdlib_fgets (char* str, gint32 size, void* stream);
+gint32 Mono_Posix_Stdlib_fputc (gint32 c, void* stream);
+gint32 Mono_Posix_Stdlib_fputs (char* s, void* stream);
+gint32 Mono_Posix_Stdlib_fclose (void* stream);
+gint32 Mono_Posix_Stdlib_fflush (void* stream);
+void* Mono_Posix_Stdlib_tmpfile (void);
+gint32 Mono_Posix_Stdlib_ungetc (gint32 c, void* stream);
+gint32 Mono_Posix_Stdlib_feof (void* stream);
+gint32 Mono_Posix_Stdlib_ferror (void* stream);
 void* Mono_Posix_Stdlib_SIG_DFL (void);
 void* Mono_Posix_Stdlib_SIG_ERR (void);
 void* Mono_Posix_Stdlib_SIG_IGN (void);
index e5b54da47b909f222d3664480c522d34d40ca1f8..b7cc689deb51087588140936b4f99f1cd10d5bf8 100644 (file)
@@ -49,7 +49,21 @@ Mono_Posix_Stdlib_fwrite (unsigned char *ptr, mph_size_t size, mph_size_t nmemb,
        mph_return_if_size_t_overflow (size);
        mph_return_if_size_t_overflow (nmemb);
 
-       return fwrite (ptr, (size_t) size, (size_t) nmemb, (FILE*) stream);
+       size_t ret = fwrite (ptr, (size_t) size, (size_t) nmemb, (FILE*) stream);
+#ifdef HOST_WIN32
+       // Workaround for a particular weirdness on Windows triggered by the
+       // StdioFileStreamTest.Write() test method. The test writes 15 bytes to a
+       // file, then rewinds the file pointer and reads the same bytes. It then
+       // writes 15 additional bytes to the file. This second write fails on
+       // Windows with 0 returned from fwrite(). Calling fseek() followed by a retry
+       // of fwrite() like we do here fixes the issue.
+       if (ret != nmemb)
+       {
+               fseek (stream, 0, SEEK_CUR);
+               ret = fwrite (ptr + (ret * nmemb), (size_t) size, (size_t) nmemb - ret, (FILE*) stream);
+       }
+#endif
+       return ret;
 }
 
 #ifdef HAVE_VSNPRINTF
@@ -142,6 +156,12 @@ Mono_Posix_Stdlib_TMP_MAX (void)
        return TMP_MAX;
 }
 
+void*
+Mono_Posix_Stdlib_tmpfile (void)
+{
+       return tmpfile ();
+}
+
 gint32
 Mono_Posix_Stdlib_setvbuf (void* stream, void *buf, int mode, mph_size_t size)
 {
@@ -156,6 +176,60 @@ Mono_Posix_Stdlib_setbuf (void* stream, void* buf)
        return 0;
 }
 
+void*
+Mono_Posix_Stdlib_fopen (char* path, char* mode)
+{
+       return fopen (path, mode);
+}
+
+void*
+Mono_Posix_Stdlib_freopen (char* path, char* mode, void *stream)
+{
+       return freopen (path, mode, stream);
+}
+
+gint32
+Mono_Posix_Stdlib_fprintf (void* stream, char* format, char *message)
+{
+       return fprintf (stream, format, message);
+}
+
+gint32
+Mono_Posix_Stdlib_fgetc (void* stream)
+{
+       return fgetc (stream);
+}
+
+char*
+Mono_Posix_Stdlib_fgets (char* str, gint32 size, void* stream)
+{
+       return fgets (str, size, stream);
+}
+
+gint32
+Mono_Posix_Stdlib_fputc (gint32 c, void* stream)
+{
+       return fputc (c, stream);
+}
+
+gint32
+Mono_Posix_Stdlib_fputs (char* s, void* stream)
+{
+       return fputs (s, stream);
+}
+
+gint32
+Mono_Posix_Stdlib_fclose (void* stream)
+{
+       return fclose (stream);
+}
+
+gint32
+Mono_Posix_Stdlib_fflush (void* stream)
+{
+       return fflush (stream);
+}
+
 gint32
 Mono_Posix_Stdlib_fseek (void* stream, gint64 offset, int origin)
 {
@@ -207,6 +281,24 @@ Mono_Posix_Stdlib_clearerr (void* stream)
        return 0;
 }
 
+gint32
+Mono_Posix_Stdlib_ungetc (gint32 c, void* stream)
+{
+       return ungetc (c, stream);
+}
+
+gint32
+Mono_Posix_Stdlib_feof (void* stream)
+{
+       return feof (((FILE*) stream));
+}
+
+gint32
+Mono_Posix_Stdlib_ferror (void* stream)
+{
+       return ferror (((FILE*) stream));
+}
+
 int
 Mono_Posix_Stdlib_perror (const char* s, int err)
 {
index 0c4358a51402d3d7b2b577db88eef64497857af2..077a85e58f56388f1ab9357ccbfbc5f2ba8cdc4f 100644 (file)
@@ -72,6 +72,12 @@ Mono_Posix_Stdlib_realloc (void* ptr, mph_size_t size)
        return realloc (ptr, (size_t) size);
 }
 
+void
+Mono_Posix_Stdlib_free (void* p)
+{
+       free (p);
+}
+
 G_END_DECLS
 
 /*
index f364a66095fcaf23a35524746f18d4accf891736..9dcebc7e967d6b04e9d8780c6cf7807e51bac228 100644 (file)
@@ -194,21 +194,22 @@ ReadZStream (ZStream *stream, guchar *buffer, gint length)
        while (zs->avail_out > 0) {
                if (zs->avail_in == 0) {
                        n = stream->func (stream->buffer, BUFFER_SIZE, stream->gchandle);
+                       n = n < 0 ? 0 : n;
                        stream->total_in += n;
-                       if (n <= 0) {
-                               stream->eof = TRUE;
-                       }
                        zs->next_in = stream->buffer;
-                       zs->avail_in = n < 0 ? 0 : n;
+                       zs->avail_in = n;
                }
 
-               if (zs->avail_in == 0 && (zs->total_in == 0 || stream->total_in == zs->total_in))
-                       return Z_STREAM_END;
+               if (zs->avail_in == 0 && zs->total_in == 0)
+                       return 0;
 
                status = inflate (stream->stream, Z_SYNC_FLUSH);
                if (status == Z_STREAM_END) {
                        stream->eof = TRUE;
                        break;
+               } else if (status == Z_BUF_ERROR && stream->total_in == zs->total_in) {
+                       stream->eof = TRUE;
+                       break;
                } else if (status != Z_OK) {
                        return status;
                }
index 27f1a5f3cf9cf801d857e750382395fcb80cccff..4d3cb8370693ebaa8616f7bc163d43ef3bc7d8fb 100644 (file)
@@ -260,9 +260,9 @@ method_stats (MonoMethod *method) {
                        if (i == MONO_CEE_CASTCLASS || i == MONO_CEE_ISINST) {
                                guint32 token = read32 (ip + 1);
                                MonoClass *k = mono_class_get (method->klass->image, token);
-                               if (k && k->flags & TYPE_ATTRIBUTE_SEALED)
+                               if (k && mono_class_get_flags (k) & TYPE_ATTRIBUTE_SEALED)
                                        cast_sealed++;
-                               if (k && k->flags & TYPE_ATTRIBUTE_INTERFACE)
+                               if (k && mono_class_get_flags (k) & TYPE_ATTRIBUTE_INTERFACE)
                                        cast_iface++;
                                total_cast++;
                        }
@@ -364,7 +364,7 @@ method_stats (MonoMethod *method) {
                                MonoMethod *cm = mono_get_method (method->klass->image, read32 (ip + 1), NULL);
                                if (cm && !(cm->flags & METHOD_ATTRIBUTE_VIRTUAL))
                                        nonvirt_callvirt++;
-                               if (cm && (cm->klass->flags & TYPE_ATTRIBUTE_INTERFACE))
+                               if (cm && (mono_class_get_flags (cm->klass) & TYPE_ATTRIBUTE_INTERFACE))
                                        iface_callvirt++;
                                total_callvirt++;
                        }
@@ -430,7 +430,7 @@ type_stats (MonoClass *klass) {
        MonoClass *parent;
        int depth = 1;
 
-       if (klass->flags & TYPE_ATTRIBUTE_INTERFACE) {
+       if (mono_class_get_flags (klass) & TYPE_ATTRIBUTE_INTERFACE) {
                num_ifaces++;
                return;
        }
index 61a0f8df9c00e1a1741c267488fe1ae3ee9c5e49..afc98f0d6b8c4483567b7da9c196e2d55b3decec 100644 (file)
@@ -1,4 +1,4 @@
-.stamp-clone
+.stamp-clone-*
 CppSharp
 *.exe
 *.h
index b4c6b68c22369b55c3ffcb20899241328b3287f5..4869bf291724bf41151719a4ca70023d19843e7b 100644 (file)
@@ -1,7 +1,34 @@
-CPPSHARP_DIR = CppSharp
+CPPSHARP_BASE_DIR = CppSharp
+
+ifeq ($(OS),Windows_NT)
+       CPPSHARP_OS=windows
+       ifeq ($(PROCESSOR_ARCHITEW6432),AMD64)
+               CPPSHARP_ARCH=64
+       else
+               ifeq ($(PROCESSOR_ARCHITECTURE),AMD64)
+                       CPPSHARP_ARCH=64
+               endif
+               ifeq ($(PROCESSOR_ARCHITECTURE),x86)
+                       CPPSHARP_ARCH=32
+               endif
+       endif
+else
+       UNAME_S := $(shell uname -s)
+       ifeq ($(UNAME_S),Linux)
+               CPPSHARP_OS=linux
+               CPPSHARP_ARCH=64
+       endif
+       ifeq ($(UNAME_S),Darwin)
+               CPPSHARP_OS=osx
+               CPPSHARP_ARCH=32
+       endif
+endif
+
+CPPSHARP_DIR = $(CPPSHARP_BASE_DIR)/$(CPPSHARP_OS)_$(CPPSHARP_ARCH)
 
 CPPSHARP_REFS = -r:$(CPPSHARP_DIR)/CppSharp.dll \
        -r:$(CPPSHARP_DIR)/CppSharp.AST.dll \
+       -r:$(CPPSHARP_DIR)/CppSharp.Parser.dll \
        -r:$(CPPSHARP_DIR)/CppSharp.Parser.CSharp.dll \
        -r:$(CPPSHARP_DIR)/CppSharp.Generator.dll
 
@@ -9,12 +36,12 @@ SRC_ROOT = ../..
 
 MONO_OPTIONS_SRC = $(SRC_ROOT)/mcs/class/Mono.Options/Mono.Options/Options.cs
 
-.stamp-clone:
-       @if [ ! -d $(CPPSHARP_DIR) ]; then \
-               git clone git://github.com/xamarin/CppSharpBinaries.git $(CPPSHARP_DIR) && touch $@; \
-       fi
+HASH=60f763a9
+.stamp-clone-$(HASH):
+       rm -Rf $(CPPSHARP_BASE_DIR)
+       git clone -b $(HASH) --depth 1 git://github.com/xamarin/CppSharpBinaries.git $(CPPSHARP_BASE_DIR) && touch $@
 
-MonoAotOffsetsDumper.exe: .stamp-clone MonoAotOffsetsDumper.cs $(MONO_OPTIONS_SRC)
+MonoAotOffsetsDumper.exe: .stamp-clone-$(HASH) MonoAotOffsetsDumper.cs $(MONO_OPTIONS_SRC)
        mcs MonoAotOffsetsDumper.cs /debug /nowarn:0436 $(MONO_OPTIONS_SRC) $(CPPSHARP_REFS)
 
 .PHONY: clean
index e04a23809a5428a760d06b8225467abacd3bbdaf..0f9a984833d766fdc48ceba51617882d361f3237 100644 (file)
@@ -235,7 +235,7 @@ namespace CppSharp
                 if (!driver.ParseCode())
                     return;
 
-                Dump(driver.ASTContext, driver.TargetInfo, target);
+                Dump(driver.Context.ASTContext, driver.Context.TargetInfo, target);
             }
         }
 
@@ -244,13 +244,13 @@ namespace CppSharp
             foreach (var header in driver.Options.Headers)
             {
                 var source = driver.Project.AddFile(header);
-                source.Options = driver.BuildParseOptions(source);
+                source.Options = driver.BuildParserOptions(source);
 
                 if (header.Contains ("mini"))
                     continue;
 
-                source.Options.addDefines ("HAVE_SGEN_GC");
-                source.Options.addDefines ("HAVE_MOVING_COLLECTOR");
+                source.Options.AddDefines ("HAVE_SGEN_GC");
+                source.Options.AddDefines ("HAVE_MOVING_COLLECTOR");
             }
         }
 
@@ -306,22 +306,24 @@ namespace CppSharp
         {
             var options = driver.Options;
             options.DryRun = true;
-            options.Verbose = false;
             options.LibraryName = "Mono";
-            options.MicrosoftMode = false;
-            options.addArguments("-xc");
-            options.addArguments("-std=gnu99");
-            options.addDefines("CPPSHARP");
+
+            var parserOptions = driver.ParserOptions;
+            parserOptions.Verbose = false;
+            parserOptions.MicrosoftMode = false;
+            parserOptions.AddArguments("-xc");
+            parserOptions.AddArguments("-std=gnu99");
+            parserOptions.AddDefines("CPPSHARP");
 
             foreach (var define in target.Defines)
-                options.addDefines(define);
+                parserOptions.AddDefines(define);
 
             SetupToolchainPaths(driver, target);
 
-            SetupMono(options, target);
+            SetupMono(driver, target);
         }
 
-        static void SetupMono(DriverOptions options, Target target)
+        static void SetupMono(Driver driver, Target target)
         {
             string targetPath;
             switch (target.Platform) {
@@ -356,7 +358,7 @@ namespace CppSharp
             };
 
             foreach (var inc in includeDirs)
-                options.addIncludeDirs(inc);
+                driver.ParserOptions.AddIncludeDirs(inc);
 
             var filesToParse = new[]
             {
@@ -365,15 +367,15 @@ namespace CppSharp
             };
 
             foreach (var file in filesToParse)
-                options.Headers.Add(file);
+                driver.Options.Headers.Add(file);
         }
 
         static void SetupMSVC(Driver driver, string triple)
         {
-            var options = driver.Options;
+            var parserOptions = driver.ParserOptions;
 
-            options.Abi = Parser.AST.CppAbi.Microsoft;
-            options.MicrosoftMode = true;
+            parserOptions.Abi = Parser.AST.CppAbi.Microsoft;
+            parserOptions.MicrosoftMode = true;
 
             var systemIncludeDirs = new[]
             {
@@ -382,9 +384,9 @@ namespace CppSharp
             };
 
             foreach (var inc in systemIncludeDirs)
-                options.addSystemIncludeDirs(inc);
+                parserOptions.AddSystemIncludeDirs(inc);
 
-            options.addDefines("HOST_WIN32");
+            parserOptions.AddDefines("HOST_WIN32");
         }
 
         static void SetupToolchainPaths(Driver driver, Target target)
@@ -487,7 +489,7 @@ namespace CppSharp
 
         static void SetupXcode(Driver driver, Target target)
         {
-            var options = driver.Options;
+            var parserOptions = driver.ParserOptions;
 
             var builtinsPath = GetXcodeBuiltinIncludesFolder();
             string includePath;
@@ -503,12 +505,12 @@ namespace CppSharp
                 throw new ArgumentOutOfRangeException ();
             }
 
-            options.addSystemIncludeDirs(builtinsPath);
-            options.addSystemIncludeDirs(includePath);
+            parserOptions.AddSystemIncludeDirs(builtinsPath);
+            parserOptions.AddSystemIncludeDirs(includePath);
 
-            options.NoBuiltinIncludes = true;
-            options.NoStandardIncludes = true;
-            options.TargetTriple = target.Triple;
+            parserOptions.NoBuiltinIncludes = true;
+            parserOptions.NoStandardIncludes = true;
+            parserOptions.TargetTriple = target.Triple;
         }
 
         static string GetAndroidHostToolchainPath()
@@ -555,9 +557,10 @@ namespace CppSharp
         static void SetupAndroidNDK(Driver driver, Target target)
         {
             var options = driver.Options;
+            var parserOptions = driver.ParserOptions;
 
             var builtinsPath = GetAndroidBuiltinIncludesFolder();
-            options.addSystemIncludeDirs(builtinsPath);
+            parserOptions.AddSystemIncludeDirs(builtinsPath);
 
             var androidNdkRoot = GetAndroidNdkPath ();
             const int androidNdkApiLevel = 21;
@@ -565,11 +568,11 @@ namespace CppSharp
             var toolchainPath = Path.Combine(androidNdkRoot, "platforms",
                 "android-" + androidNdkApiLevel, "arch-" + GetArchFromTriple(target.Triple),
                 "usr", "include");
-            options.addSystemIncludeDirs(toolchainPath);
+            parserOptions.AddSystemIncludeDirs(toolchainPath);
 
-            options.NoBuiltinIncludes = true;
-            options.NoStandardIncludes = true;
-            options.TargetTriple = target.Triple;
+            parserOptions.NoBuiltinIncludes = true;
+            parserOptions.NoStandardIncludes = true;
+            parserOptions.TargetTriple = target.Triple;
         }
 
         static uint GetTypeAlign(ParserTargetInfo target, ParserIntType type)
@@ -638,8 +641,8 @@ namespace CppSharp
         {
             var targetFile = target.Triple;
 
-                       if (!string.IsNullOrEmpty (OutputDir))
-                               targetFile = Path.Combine (OutputDir, targetFile);
+            if (!string.IsNullOrEmpty (OutputDir))
+                targetFile = Path.Combine (OutputDir, targetFile);
 
             targetFile += ".h";
 
@@ -754,7 +757,7 @@ namespace CppSharp
             var types = new List<string>
             {
                 "MonoObject",
-               "MonoObjectHandlePayload",
+                "MonoObjectHandlePayload",
                 "MonoClass",
                 "MonoVTable",
                 "MonoDelegate",
@@ -803,7 +806,7 @@ namespace CppSharp
                 "SeqPointInfo",
                 "DynCallArgs", 
                 "MonoLMFTramp",
-            };            
+            };
 
             DumpClasses(writer, ctx, optionalTypes, optional: true);
 
@@ -813,8 +816,8 @@ namespace CppSharp
         static void DumpStruct(TextWriter writer, Class @class)
         {
             var name = @class.Name;
-                       if (name.StartsWith ("_", StringComparison.Ordinal))
-                               name = name.Substring (1);
+            if (name.StartsWith ("_", StringComparison.Ordinal))
+                name = name.Substring (1);
 
             foreach (var field in @class.Fields)
             {
@@ -823,8 +826,10 @@ namespace CppSharp
                 if (name == "SgenThreadInfo" && field.Name == "regs")
                     continue;
 
+                var layout = @class.Layout.Fields.First(f => f.FieldPtr == field.OriginalPtr);
+
                 writer.WriteLine("DECL_OFFSET2({0},{1},{2})", name, field.Name,
-                    field.Offset / 8);
+                    layout.Offset);
             }
         }
     }
index a6daf8b05286c8b10b8dabe416649fee9906b609..73f67534019a237795922f6b7b855ce5e4c8a259 100644 (file)
 
 /* Version number of package */
 #define VERSION "#MONO_VERSION#"
+
+#ifndef HAVE_WINAPI_FAMILY_SUPPORT
+
+#define HAVE_WINAPI_FAMILY_SUPPORT
+
+/* WIN API Family support */
+#include <winapifamily.h>
+
+#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
+       #define HAVE_CLASSIC_WINAPI_SUPPORT 1
+       #define HAVE_UWP_WINAPI_SUPPORT 0
+#elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
+       #define HAVE_CLASSIC_WINAPI_SUPPORT 0
+       #define HAVE_UWP_WINAPI_SUPPORT 1
+#ifndef HAVE_EXTERN_DEFINED_WINAPI_SUPPORT
+       #error Unsupported WINAPI family
+#endif
+#else
+       #define HAVE_CLASSIC_WINAPI_SUPPORT 0
+       #define HAVE_UWP_WINAPI_SUPPORT 0
+#ifndef HAVE_EXTERN_DEFINED_WINAPI_SUPPORT
+       #error Unsupported WINAPI family
+#endif
+#endif
+
+#endif
 #endif